PageSourceSearch

https://bwayrush.com/_app/immutable/chunks/C64vahhe.js

js bwayrush.com collected 2026-10-08 03:39:39 UTC 725,210 bytes, 4,049 lines download raw bytes

1const Uv="183",Nv={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Fv={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},hd=0,_c=1,ud=2,Ov=3,Bv=0,$r=1,dd=2,Us=3,ei=0,Wt=1,Ln=2,Fn=0,as=1,xc=2,vc=3,yc=4,fd=5,zv=6,yi=100,pd=101,md=102,gd=103,_d=104,xd=200,vd=201,yd=202,Md=203,Ao=204,Eo=205,Sd=206,bd=207,Td=208,Ad=209,Ed=210,wd=211,Cd=212,Rd=213,Id=214,wo=0,Co=1,Ro=2,cs=3,Io=4,Po=5,Lo=6,Do=7,ya=0,Pd=1,Ld=2,Mn=0,nu=1,iu=2,su=3,ru=4,au=5,ou=6,lu=7,Mc="attached",Dd="detached",Sl=300,Bn=301,Ei=302,Kr=303,Qr=304,Ks=306,ra=1e3,jt=1001,aa=1002,St=1003,cu=1004,Vv=1004,Ns=1005,kv=1005,pt=1006,jr=1007,Gv=1007,Un=1008,Hv=1008,Kt=1009,hu=1010,uu=1011,Hs=1012,bl=1013,un=1014,Gt=1015,zn=1016,Tl=1017,Al=1018,Ws=1020,du=35902,fu=35899,pu=1021,mu=1022,Ht=1023,Vn=1026,Si=1027,El=1028,Ma=1029,hs=1030,wl=1031,Wv=1032,Cl=1033,ea=33776,ta=33777,na=33778,ia=33779,Uo=35840,No=35841,Fo=35842,Oo=35843,Bo=36196,zo=37492,Vo=37496,ko=37488,Go=37489,Ho=37490,Wo=37491,Xo=37808,qo=37809,Yo=37810,Zo=37811,Jo=37812,$o=37813,Ko=37814,Qo=37815,jo=37816,el=37817,tl=37818,nl=37819,il=37820,sl=37821,rl=36492,al=36494,ol=36495,ll=36283,cl=36284,hl=36285,ul=36286,Ud=2200,Nd=2201,Fd=2202,oa=2300,dl=2301,Da=2302,Sc=2303,is=2400,ss=2401,la=2402,Rl=2500,gu=2501,Xv=0,qv=1,Yv=2,Od=3200,Zv=3201,Jv=3202,$v=3203,Ri=0,Bd=1,Qn="",$t="srgb",us="srgb-linear",ca="linear",rt="srgb",Kv="",Qv="rg",jv="ga",ey=0,Ni=7680,ty=7681,ny=7682,iy=7683,sy=34055,ry=34056,ay=5386,oy=512,ly=513,cy=514,hy=515,uy=516,dy=517,fy=518,bc=519,zd=512,Vd=513,kd=514,Il=515,Gd=516,Hd=517,Pl=518,Wd=519,ha=35044,py=35048,my=35040,gy=35045,_y=35049,xy=35041,vy=35046,yy=35050,My=35042,Sy="100",Tc="300 es",sn=2e3,ds=2001,by={COMPUTE:"compute",RENDER:"render"},Ty={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},Ay={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},Ey={TEXTURE_COMPARE:"depthTextureCompare"};function Xd(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const qd={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function rs(r,e){return new qd[r](e)}function _u(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function Xs(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Yd(){const r=Xs("canvas");return r.style.display="block",r}const Ac={};let ti=null;function wy(r){ti=r}function Cy(){return ti}function ua(...r){const e="THREE."+r.shift();ti?ti("log",e,...r):console.log(e,...r)}function xu(r){const e=r[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=r[1];t&&t.isStackTrace?r[0]+=" "+t.getLocation():r[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return r}function ue(...r){r=xu(r);const e="THREE."+r.shift();if(ti)ti("warn",e,...r);else{const t=r[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...r)}}function Le(...r){r=xu(r);const e="THREE."+r.shift();if(ti)ti("error",e,...r);else{const t=r[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...r)}}function da(...r){const e=r.join(" ");e in Ac||(Ac[e]=!0,ue(...r))}function Zd(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)})}const Jd={[wo]:Co,[Ro]:Lo,[Io]:Do,[cs]:Po,[Co]:wo,[Lo]:Ro,[Do]:Io,[Po]:cs};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 It=["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","5
15","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 Ec=1234567;const Ai=Math.PI/180,fs=180/Math.PI;function en(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(It[r&255]+It[r>>8&255]+It[r>>16&255]+It[r>>24&255]+"-"+It[e&255]+It[e>>8&255]+"-"+It[e>>16&15|64]+It[e>>24&255]+"-"+It[t&63|128]+It[t>>8&255]+"-"+It[t>>16&255]+It[t>>24&255]+It[n&255]+It[n>>8&255]+It[n>>16&255]+It[n>>24&255]).toLowerCase()}function Ve(r,e,t){return Math.max(e,Math.min(t,r))}function Ll(r,e){return(r%e+e)%e}function $d(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function Kd(r,e,t){return r!==e?(t-r)/(e-r):0}function Vs(r,e,t){return(1-t)*r+t*e}function Qd(r,e,t,n){return Vs(r,e,1-Math.exp(-t*n))}function jd(r,e=1){return e-Math.abs(Ll(r,e*2)-e)}function ef(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function tf(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function nf(r,e){return r+Math.floor(Math.random()*(e-r+1))}function sf(r,e){return r+Math.random()*(e-r)}function rf(r){return r*(.5-Math.random())}function af(r){r!==void 0&&(Ec=r);let e=Ec+=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 of(r){return r*Ai}function lf(r){return r*fs}function cf(r){return(r&r-1)===0&&r!==0}function hf(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function uf(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function df(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),d=s((e-n)/2),u=a((e-n)/2),f=s((n-e)/2),p=a((n-e)/2);switch(i){case"XYX":r.set(o*h,l*d,l*u,o*c);break;case"YZY":r.set(l*u,o*h,l*d,o*c);break;case"ZXZ":r.set(l*d,l*u,o*h,o*c);break;case"XZX":r.set(o*h,l*p,l*f,o*c);break;case"YXY":r.set(l*f,o*h,l*p,o*c);break;case"ZYZ":r.set(l*p,l*f,o*h,o*c);break;default:ue("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Ot(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 Je(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 Ry={DEG2RAD:Ai,RAD2DEG:fs,generateUUID:en,clamp:Ve,euclideanModulo:Ll,mapLinear:$d,inverseLerp:Kd,lerp:Vs,damp:Qd,pingpong:jd,smoothstep:ef,smootherstep:tf,randInt:nf,randFloat:sf,randFloatSpread:rf,seededRandom:af,degToRad:of,radToDeg:lf,isPowerOfTwo:cf,ceilPowerOfTwo:hf,floorPowerOfTwo:uf,setQuaternionFromProperEuler:df,normalize:Je,denormalize:Ot};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}
vendor: 68,714 bytes, line 1
1sub(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=Ve(this.x,e.x,t.x),this.y=Ve(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Ve(this.x,e,t),this.y=Ve(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ve(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(Ve(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 Xt{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],d=n[i+3],u=s[a+0],f=s[a+1],p=s[a+2],_=s[a+3];if(d!==_||l!==u||c!==f||h!==p){let g=l*u+c*f+h*p+d*_;g<0&&(u=-u,f=-f,p=-p,_=-_,g=-g);let m=1-o;if(g<.9995){const x=Math.acos(g),y=Math.sin(x);m=Math.sin(m*x)/y,o=Math.sin(o*x)/y,l=l*m+u*o,c=c*m+f*o,h=h*m+p*o,d=d*m+_*o}else{l=l*m+u*o,c=c*m+f*o,h=h*m+p*o,d=d*m+_*o;const x=1/Math.sqrt(l*l+c*c+h*h+d*d);l*=x,c*=x,h*=x,d*=x}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=d}static multiplyQuaternionsFlat(e,t,n,i,s,a){const o=n[i],l=n[i+1],c=n[i+2],h=n[i+3],d=s[a],u=s[a+1],f=s[a+2],p=s[a+3];return e[t]=o*p+h*d+l*f-c*u,e[t+1]=l*p+h*u+c*d-o*f,e[t+2]=c*p+h*f+o*u-l*d,e[t+3]=h*p-o*d-l*u-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),d=o(s/2),u=l(n/2),f=l(i/2),p=l(s/2);switch(a){case"XYZ":this._x=u*h*d+c*f*p,this._y=c*f*d-u*h*p,this._z=c*h*p+u*f*d,this._w=c*h*d-u*f*p;break;case"YXZ":this._x=u*h*d+c*f*p,this._y=c*f*d-u*h*p,this._z=c*h*p-u*f*d,this._w=c*h*d+u*f*p;break;case"ZXY":this._x=u*h*d-c*f*p,this._y=c*f*d+u*h*p,this._z=c*h*p+u*f*d,this._w=c*h*d-u*f*p;break;case"ZYX":this._x=u*h*d-c*f*p,this._y=c*f*d+u*h*p,this._z=c*h*p-u*f*d,this._w=c*h*d+u*f*p;break;case"YZX":this._x=u*h*d+c*f*p,this._y=c*f*d+u*h*p,this._z=c*h*p-u*f*d,this._w=c*h*d-u*f*p;break;case"XZY":this._x=u*h*d-c*f*p,this._y=c*f*d-u*h*p,this._z=c*h*p+u*f*d,this._w=c*h*d+u*f*p;break;default:ue("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],d=t[10],u=n+o+d;if(u>0){const f=.5/Math.sqrt(u+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>d){const f=2*Math.sqrt(1+n-o-d);this._w=(h-l)/f,this._x=.25*f,this._y=(i+a)/f,this._z=(s+c)/f}else if(o>d){const f=2*Math.sqrt(1+o-n-d);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+d-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(Ve(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){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()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class C{constructor(e=0,t=0,n=0){C.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(wc.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(wc.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),d=2*(s*n-a*t);return this.x=t+l*c+a*d-o*h,this.y=n+l*h+o*c-s*d,this.z=i+l*d+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=Ve(this.x,e.x,t.x),this.y=Ve(this.y,e.y,t.y),this.z=Ve(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Ve(this.x,e,t),this.y=Ve(this.y,e,t),this.z=Ve(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ve(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}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}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 Ua.copy(this).projectOnVector(e),this.sub(Ua)}reflect(e){return this.sub(Ua.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(Ve(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 Ua=new C,wc=new Xt;class Ze{constructor(e,t,n,i,s,a,o,l,c){Ze.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],d=n[7],u=n[2],f=n[5],p=n[8],_=i[0],g=i[3],m=i[6],x=i[1],y=i[4],M=i[7],E=i[2],A=i[5],I=i[8];return s[0]=a*_+o*x+l*E,s[3]=a*g+o*y+l*A,s[6]=a*m+o*M+l*I,s[1]=c*_+h*x+d*E,s[4]=c*g+h*y+d*A,s[7]=c*m+h*M+d*I,s[2]=u*_+f*x+p*E,s[5]=u*g+f*y+p*A,s[8]=u*m+f*M+p*I,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],d=h*a-o*c,u=o*l-h*s,f=c*s-a*l,p=t*d+n*u+i*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/p;return e[0]=d*_,e[1]=(i*c-h*n)*_,e[2]=(o*n-i*a)*_,e[3]=u*_,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(Na.makeScale(e,t)),this}rotate(e){return this.premultiply(Na.makeRotation(-e)),this}translate(e,t){return this.premultiply(Na.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 Na=new Ze,Cc=new Ze().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Rc=new Ze().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function ff(){const r={enabled:!0,workingColorSpace:us,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=os(i.r),i.g=os(i.g),i.b=os(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===Qn?ca: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 da("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return da("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({[us]:{primaries:e,whitePoint:n,transfer:ca,toXYZ:Cc,fromXYZ:Rc,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:$t},outputColorSpaceConfig:{drawingBufferColorSpace:$t}},[$t]:{primaries:e,whitePoint:n,transfer:rt,toXYZ:Cc,fromXYZ:Rc,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:$t}}}),r}const je=ff();function On(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function os(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let Fi;class pf{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Fi===void 0&&(Fi=Xs("canvas")),Fi.width=e.width,Fi.height=e.height;const i=Fi.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=Fi}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Xs("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 ue("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let mf=0;class bi{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:mf++}),this.uuid=en(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&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(Fa(i[a].image)):s.push(Fa(i[a]))}else s=Fa(i);n.url=s}return t||(e.images[this.uuid]=n),n}}function Fa(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?pf.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(ue("Texture: Unable to serialize Texture."),{})}let gf=0;const Oa=new C;class yt extends kn{constructor(e=yt.DEFAULT_IMAGE,t=yt.DEFAULT_MAPPING,n=jt,i=jt,s=pt,a=Un,o=Ht,l=Kt,c=yt.DEFAULT_ANISOTROPY,h=Qn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:gf++}),this.uuid=en(),this.name="",this.source=new bi(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 Ze,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(Oa).x}get height(){return this.source.getSize(Oa).y}get depth(){return this.source.getSize(Oa).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){ue(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ue(`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!==Sl)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ra:e.x=e.x-Math.floor(e.x);break;case jt:e.x=e.x<0?0:1;break;case aa: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 ra:e.y=e.y-Math.floor(e.y);break;case jt:e.y=e.y<0?0:1;break;case aa: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++}}yt.DEFAULT_IMAGE=null;yt.DEFAULT_MAPPING=Sl;yt.DEFAULT_ANISOTROPY=1;class ft{constructor(e=0,t=0,n=0,i=1){ft.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],d=l[8],u=l[1],f=l[5],p=l[9],_=l[2],g=l[6],m=l[10];if(Math.abs(h-u)<.01&&Math.abs(d-_)<.01&&Math.abs(p-g)<.01){if(Math.abs(h+u)<.1&&Math.abs(d+_)<.1&&Math.abs(p+g)<.1&&Math.abs(c+f+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const y=(c+1)/2,M=(f+1)/2,E=(m+1)/2,A=(h+u)/4,I=(d+_)/4,v=(p+g)/4;return y>M&&y>E?y<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(y),i=A/n,s=I/n):M>E?M<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(M),n=A/i,s=v/i):E<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(E),n=I/s,i=v/s),this.set(n,i,s,t),this}let x=Math.sqrt((g-p)*(g-p)+(d-_)*(d-_)+(u-h)*(u-h));return Math.abs(x)<.001&&(x=1),this.x=(g-p)/x,this.y=(d-_)/x,this.z=(u-h)/x,this.w=Math.acos((c+f+m-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=Ve(this.x,e.x,t.x),this.y=Ve(this.y,e.y,t.y),this.z=Ve(this.z,e.z,t.z),this.w=Ve(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Ve(this.x,e,t),this.y=Ve(this.y,e,t),this.z=Ve(this.z,e,t),this.w=Ve(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Ve(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 vu extends kn{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:pt,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 ft(0,0,e,t),this.scissorTest=!1,this.viewport=new ft(0,0,e,t),this.textures=[];const i={width:e,height:t,depth:n.depth},s=new yt(i),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:pt,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 bi(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 rn extends vu{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Dl extends yt{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=St,this.minFilter=St,this.wrapR=jt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Iy extends rn{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new Dl(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class Ul extends yt{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=St,this.minFilter=St,this.wrapR=jt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Py extends rn{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new Ul(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class He{constructor(e,t,n,i,s,a,o,l,c,h,d,u,f,p,_,g){He.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,d,u,f,p,_,g)}set(e,t,n,i,s,a,o,l,c,h,d,u,f,p,_,g){const m=this.elements;return m[0]=e,m[4]=t,m[8]=n,m[12]=i,m[1]=s,m[5]=a,m[9]=o,m[13]=l,m[2]=c,m[6]=h,m[10]=d,m[14]=u,m[3]=f,m[7]=p,m[11]=_,m[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 He().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),d=Math.sin(s);if(e.order==="XYZ"){const u=a*h,f=a*d,p=o*h,_=o*d;t[0]=l*h,t[4]=-l*d,t[8]=c,t[1]=f+p*c,t[5]=u-_*c,t[9]=-o*l,t[2]=_-u*c,t[6]=p+f*c,t[10]=a*l}else if(e.order==="YXZ"){const u=l*h,f=l*d,p=c*h,_=c*d;t[0]=u+_*o,t[4]=p*o-f,t[8]=a*c,t[1]=a*d,t[5]=a*h,t[9]=-o,t[2]=f*o-p,t[6]=_+u*o,t[10]=a*l}else if(e.order==="ZXY"){const u=l*h,f=l*d,p=c*h,_=c*d;t[0]=u-_*o,t[4]=-a*d,t[8]=p+f*o,t[1]=f+p*o,t[5]=a*h,t[9]=_-u*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const u=a*h,f=a*d,p=o*h,_=o*d;t[0]=l*h,t[4]=p*c-f,t[8]=u*c+_,t[1]=l*d,t[5]=_*c+u,t[9]=f*c-p,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const u=a*l,f=a*c,p=o*l,_=o*c;t[0]=l*h,t[4]=_-u*d,t[8]=p*d+f,t[1]=d,t[5]=a*h,t[9]=-o*h,t[2]=-c*h,t[6]=f*d+p,t[10]=u-_*d}else if(e.order==="XZY"){const u=a*l,f=a*c,p=o*l,_=o*c;t[0]=l*h,t[4]=-d,t[8]=c*h,t[1]=u*d+_,t[5]=a*h,t[9]=f*d-p,t[2]=p*d-f,t[6]=o*h,t[10]=_*d+u}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(_f,e,xf)}lookAt(e,t,n){const i=this.elements;return Zt.subVectors(e,t),Zt.lengthSq()===0&&(Zt.z=1),Zt.normalize(),Xn.crossVectors(n,Zt),Xn.lengthSq()===0&&(Math.abs(n.z)===1?Zt.x+=1e-4:Zt.z+=1e-4,Zt.normalize(),Xn.crossVectors(n,Zt)),Xn.normalize(),sr.crossVectors(Zt,Xn),i[0]=Xn.x,i[4]=sr.x,i[8]=Zt.x,i[1]=Xn.y,i[5]=sr.y,i[9]=Zt.y,i[2]=Xn.z,i[6]=sr.z,i[10]=Zt.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],d=n[5],u=n[9],f=n[13],p=n[2],_=n[6],g=n[10],m=n[14],x=n[3],y=n[7],M=n[11],E=n[15],A=i[0],I=i[4],v=i[8],b=i[12],L=i[1],P=i[5],N=i[9],O=i[13],G=i[2],z=i[6],B=i[10],V=i[14],ie=i[3],j=i[7],ge=i[11],xe=i[15];return s[0]=a*A+o*L+l*G+c*ie,s[4]=a*I+o*P+l*z+c*j,s[8]=a*v+o*N+l*B+c*ge,s[12]=a*b+o*O+l*V+c*xe,s[1]=h*A+d*L+u*G+f*ie,s[5]=h*I+d*P+u*z+f*j,s[9]=h*v+d*N+u*B+f*ge,s[13]=h*b+d*O+u*V+f*xe,s[2]=p*A+_*L+g*G+m*ie,s[6]=p*I+_*P+g*z+m*j,s[10]=p*v+_*N+g*B+m*ge,s[14]=p*b+_*O+g*V+m*xe,s[3]=x*A+y*L+M*G+E*ie,s[7]=x*I+y*P+M*z+E*j,s[11]=x*v+y*N+M*B+E*ge,s[15]=x*b+y*O+M*V+E*xe,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],d=e[6],u=e[10],f=e[14],p=e[3],_=e[7],g=e[11],m=e[15],x=l*f-c*u,y=o*f-c*d,M=o*u-l*d,E=a*f-c*h,A=a*u-l*h,I=a*d-o*h;return t*(_*x-g*y+m*M)-n*(p*x-g*E+m*A)+i*(p*y-_*E+m*I)-s*(p*M-_*A+g*I)}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],d=e[9],u=e[10],f=e[11],p=e[12],_=e[13],g=e[14],m=e[15],x=t*o-n*a,y=t*l-i*a,M=t*c-s*a,E=n*l-i*o,A=n*c-s*o,I=i*c-s*l,v=h*_-d*p,b=h*g-u*p,L=h*m-f*p,P=d*g-u*_,N=d*m-f*_,O=u*m-f*g,G=x*O-y*N+M*P+E*L-A*b+I*v;if(G===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const z=1/G;return e[0]=(o*O-l*N+c*P)*z,e[1]=(i*N-n*O-s*P)*z,e[2]=(_*I-g*A+m*E)*z,e[3]=(u*A-d*I-f*E)*z,e[4]=(l*L-a*O-c*b)*z,e[5]=(t*O-i*L+s*b)*z,e[6]=(g*M-p*I-m*y)*z,e[7]=(h*I-u*M+f*y)*z,e[8]=(a*N-o*L+c*v)*z,e[9]=(n*L-t*N-s*v)*z,e[10]=(p*A-_*M+m*x)*z,e[11]=(d*M-h*A-f*x)*z,e[12]=(o*b-a*P-l*v)*z,e[13]=(t*P-n*b+i*v)*z,e[14]=(_*y-p*E-g*x)*z,e[15]=(h*E-d*y+u*x)*z,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,d=o+o,u=s*c,f=s*h,p=s*d,_=a*h,g=a*d,m=o*d,x=l*c,y=l*h,M=l*d,E=n.x,A=n.y,I=n.z;return i[0]=(1-(_+m))*E,i[1]=(f+M)*E,i[2]=(p-y)*E,i[3]=0,i[4]=(f-M)*A,i[5]=(1-(u+m))*A,i[6]=(g+x)*A,i[7]=0,i[8]=(p+y)*I,i[9]=(g-x)*I,i[10]=(1-(u+_))*I,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;e.x=i[12],e.y=i[13],e.z=i[14];const s=this.determinant();if(s===0)return n.set(1,1,1),t.identity(),this;let a=Oi.set(i[0],i[1],i[2]).length();const o=Oi.set(i[4],i[5],i[6]).length(),l=Oi.set(i[8],i[9],i[10]).length();s<0&&(a=-a),ln.copy(this);const c=1/a,h=1/o,d=1/l;return ln.elements[0]*=c,ln.elements[1]*=c,ln.elements[2]*=c,ln.elements[4]*=h,ln.elements[5]*=h,ln.elements[6]*=h,ln.elements[8]*=d,ln.elements[9]*=d,ln.elements[10]*=d,t.setFromRotationMatrix(ln),n.x=a,n.y=o,n.z=l,this}makePerspective(e,t,n,i,s,a,o=sn,l=!1){const c=this.elements,h=2*s/(t-e),d=2*s/(n-i),u=(t+e)/(t-e),f=(n+i)/(n-i);let p,_;if(l)p=s/(a-s),_=a*s/(a-s);else if(o===sn)p=-(a+s)/(a-s),_=-2*a*s/(a-s);else if(o===ds)p=-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]=u,c[12]=0,c[1]=0,c[5]=d,c[9]=f,c[13]=0,c[2]=0,c[6]=0,c[10]=p,c[14]=_,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,i,s,a,o=sn,l=!1){const c=this.elements,h=2/(t-e),d=2/(n-i),u=-(t+e)/(t-e),f=-(n+i)/(n-i);let p,_;if(l)p=1/(a-s),_=a/(a-s);else if(o===sn)p=-2/(a-s),_=-(a+s)/(a-s);else if(o===ds)p=-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]=u,c[1]=0,c[5]=d,c[9]=0,c[13]=f,c[2]=0,c[6]=0,c[10]=p,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 C,ln=new He,_f=new C(0,0,0),xf=new C(1,1,1),Xn=new C,sr=new C,Zt=new C,Ic=new He,Pc=new Xt;class an{constructor(e=0,t=0,n=0,i=an.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],d=i[2],u=i[6],f=i[10];switch(t){case"XYZ":this._y=Math.asin(Ve(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,f),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(u,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Ve(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(Ve(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-d,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Ve(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(u,f),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(Ve(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(o,f));break;case"XZY":this._z=Math.asin(-Ve(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(u,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,f),this._y=0);break;default:ue("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Ic.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ic,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Pc.setFromEuler(this),this.setFromQuaternion(Pc,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}}an.DEFAULT_ORDER="XYZ";class Nl{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 vf=0;const Lc=new C,Bi=new Xt,En=new He,rr=new C,Ms=new C,yf=new C,Mf=new Xt,Dc=new C(1,0,0),Uc=new C(0,1,0),Nc=new C(0,0,1),Fc={type:"added"},Sf={type:"removed"},zi={type:"childadded",child:null},Ba={type:"childremoved",child:null};class nt extends kn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:vf++}),this.uuid=en(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=nt.DEFAULT_UP.clone();const e=new C,t=new an,n=new Xt,i=new C(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 He},normalMatrix:{value:new Ze}}),this.matrix=new He,this.matrixWorld=new He,this.matrixAutoUpdate=nt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=nt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Nl,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.static=!1,this.userData={},this.pivot=null}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(Dc,e)}rotateY(e){return this.rotateOnAxis(Uc,e)}rotateZ(e){return this.rotateOnAxis(Nc,e)}translateOnAxis(e,t){return Lc.copy(e).applyQuaternion(this.quaternion),this.position.add(Lc.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Dc,e)}translateY(e){return this.translateOnAxis(Uc,e)}translateZ(e){return this.translateOnAxis(Nc,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(En.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?rr.copy(e):rr.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Ms.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?En.lookAt(Ms,rr,this.up):En.lookAt(rr,Ms,this.up),this.quaternion.setFromRotationMatrix(En),i&&(En.extractRotation(i.matrixWorld),Bi.setFromRotationMatrix(En),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(Fc),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(Sf),Ba.child=e,this.dispatchEvent(Ba),Ba.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),En.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),En.multiply(e.parent.matrixWorld)),e.applyMatrix4(En),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Fc),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(Ms,e,yf),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ms,Mf,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);const e=this.pivot;if(e!==null){const t=e.x,n=e.y,i=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*n-s[8]*i,s[13]+=n-s[1]*t-s[5]*n-s[9]*i,s[14]+=i-s[2]*t-s[6]*n-s[10]*i}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),this.static!==!1&&(i.static=this.static),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.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),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 d=l[c];s(e.shapes,d)}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),d=a(e.shapes),u=a(e.skeletons),f=a(e.animations),p=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),d.length>0&&(n.shapes=d),u.length>0&&(n.skeletons=u),f.length>0&&(n.animations=f),p.length>0&&(n.nodes=p)}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),e.pivot!==null&&(this.pivot=e.pivot.clone()),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.static=e.static,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 C(0,1,0);nt.DEFAULT_MATRIX_AUTO_UPDATE=!0;nt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class Fs extends nt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const bf={type:"move"};class za{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Fs,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 Fs,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new C,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new C),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Fs,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new C,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new C),this._grip}dispatchEvent(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),m=this._getHandJoint(c,_);g!==null&&(m.matrix.fromArray(g.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.matrixWorldNeedsUpdate=!0,m.jointRadius=g.radius),m.visible=g!==null}const h=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],u=h.position.distanceTo(d.position),f=.02,p=.005;c.inputState.pinching&&u>f+p?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&u<=f-p&&(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(bf)))}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 Fs;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const yu={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},qn={h:0,s:0,l:0},ar={h:0,s:0,l:0};function Va(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=$t){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=Ll(e,1),t=Ve(t,0,1),n=Ve(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=Va(a,s,e+1/3),this.g=Va(a,s,e),this.b=Va(a,s,e-1/3)}return je.colorSpaceToWorking(this,i),this}setStyle(e,t=$t){function n(s){s!==void 0&&parseFloat(s)<1&&ue("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:ue("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);ue("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=$t){const n=yu[e.toLowerCase()];return n!==void 0?this.setHex(n,t):ue("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=os(e.r),this.g=os(e.g),this.b=os(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=$t){return je.workingToColorSpace(Pt.copy(this),e),Math.round(Ve(Pt.r*255,0,255))*65536+Math.round(Ve(Pt.g*255,0,255))*256+Math.round(Ve(Pt.b*255,0,255))}getHexString(e=$t){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=je.workingColorSpace){je.workingToColorSpace(Pt.copy(this),t);const n=Pt.r,i=Pt.g,s=Pt.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 d=a-o;switch(c=h<=.5?d/(a+o):d/(2-a-o),a){case n:l=(i-s)/d+(i<s?6:0);break;case i:l=(s-n)/d+2;break;case s:l=(n-i)/d+4;break}l/=6}return e.h=l,e.s=c,e.l=h,e}getRGB(e,t=je.workingColorSpace){return je.workingToColorSpace(Pt.copy(this),t),e.r=Pt.r,e.g=Pt.g,e.b=Pt.b,e}getStyle(e=$t){je.workingToColorSpace(Pt.copy(this),e);const t=Pt.r,n=Pt.g,i=Pt.b;
vendor: 3,632 bytes, line 1
1return e!==$t?`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(qn),this.setHSL(qn.h+e,qn.s+t,qn.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(qn),e.getHSL(ar);const n=Vs(qn.h,ar.h,t),i=Vs(qn.s,ar.s,t),s=Vs(qn.l,ar.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 Pt=new Me;Me.NAMES=yu;class Fl{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Me(e),this.density=t}clone(){return new Fl(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Ol{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 Ol(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Tf 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 an,this.environmentIntensity=1,this.environmentRotation=new an,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__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}}const cn=new C,wn=new C,ka=new C,Cn=new C,Vi=new C,ki=new C,Oc=new C,Ga=new C,Ha=new C,Wa=new C,X
vendor: 10,586 bytes, line 1
1a=new ft,qa=new ft,Ya=new ft;class Qt{constructor(e=new C,t=new C,n=new C){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),cn.subVectors(e,t),i.cross(cn);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){cn.subVectors(i,t),wn.subVectors(n,t),ka.subVectors(e,t);const a=cn.dot(cn),o=cn.dot(wn),l=cn.dot(ka),c=wn.dot(wn),h=wn.dot(ka),d=a*c-o*o;if(d===0)return s.set(0,0,0),null;const u=1/d,f=(c*l-o*h)*u,p=(a*h-o*l)*u;return s.set(1-f-p,p,f)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Cn)===null?!1:Cn.x>=0&&Cn.y>=0&&Cn.x+Cn.y<=1}static getInterpolation(e,t,n,i,s,a,o,l){return this.getBarycoord(e,t,n,i,Cn)===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,Cn.x),l.addScaledVector(a,Cn.y),l.addScaledVector(o,Cn.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 cn.subVectors(n,t),wn.subVectors(e,t),cn.cross(wn).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 cn.subVectors(this.c,this.b),wn.subVectors(this.a,this.b),cn.cross(wn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Qt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Qt.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,s){return Qt.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return Qt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Qt.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),d=ki.dot(Ha);if(h>=0&&d<=h)return t.copy(i);const u=l*d-h*c;if(u<=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),p=ki.dot(Wa);if(p>=0&&f<=p)return t.copy(s);const _=f*c-l*p;if(_<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(ki,o);const g=h*p-f*d;if(g<=0&&d-h>=0&&f-p>=0)return Oc.subVectors(s,i),o=(d-h)/(d-h+(f-p)),t.copy(i).addScaledVector(Oc,o);const m=1/(g+_+u);return a=_*m,o=u*m,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)}}class Bt{constructor(e=new C(1/0,1/0,1/0),t=new C(-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(),or.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),or.copy(n.boundingBox)),or.applyMatrix4(e.matrixWorld),this.union(or)}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(Ss),lr.subVectors(this.max,Ss),Gi.subVectors(e.a,Ss),Hi.subVectors(e.b,Ss),Wi.subVectors(e.c,Ss),Yn.subVectors(Hi,Gi),Zn.subVectors(Wi,Hi),ri.subVectors(Gi,Wi);let t=[0,-Yn.z,Yn.y,0,-Zn.z,Zn.y,0,-ri.z,ri.y,Yn.z,0,-Yn.x,Zn.z,0,-Zn.x,ri.z,0,-ri.x,-Yn.y,Yn.x,0,-Zn.y,Zn.x,0,-ri.y,ri.x,0];return!Za(t,Gi,Hi,Wi,lr)||(t=[1,0,0,0,1,0,0,0,1],!Za(t,Gi,Hi,Wi,lr))?!1:(cr.crossVectors(Yn,Zn),t=[cr.x,cr.y,cr.z],Za(t,Gi,Hi,Wi,lr))}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:(Rn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Rn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Rn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Rn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Rn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Rn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Rn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Rn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Rn),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 Rn=[new C,new C,new C,new C,new C,new C,new C,new C],hn=new C,or=new Bt,Gi=new C,Hi=new C,Wi=new C,Yn=new C,Zn=new C,ri=new C,Ss=new C,lr=new C,cr=new C,ai=new C;function Za(r,e,t,n,i){for(let s=0,a=r.length-3;s<=a;s+=3){ai.fromArray(r,s);const o=i.x*Math.abs(ai.x)+i.y*Math.abs(ai.y)+i.z*Math.abs(ai.z),l=e.dot(ai),c=t.dot(ai),h=n.dot(ai);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const Dn=Af();function Af(){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 kt(r){Math.abs(r)>65504&&ue("DataUtils.toHalfFloat(): Value out of range."),r=Ve(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 Os(r){const e=r>>10;return Dn.uint32View[0]=Dn.mantissaTable[Dn.offsetTable[e]+(r&1023)]+Dn.exponentTable[e],Dn.floatView[0]}class Ly{static toHalfFloat(e){return kt(e)}static fromHalfFloat(e){return Os(e)}}const Mt=new C,hr=new K;let Ef=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:Ef++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ha,this.updateRanges=[],this.gpuType=Gt,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;
vendor: 5,901 bytes, line 1
1for(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++)Mt.fromBufferAttribute(this,t),Mt.applyMatrix3(e),this.setXYZ(t,Mt.x,Mt.y,Mt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Mt.fromBufferAttribute(this,t),Mt.applyMatrix4(e),this.setXYZ(t,Mt.x,Mt.y,Mt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Mt.fromBufferAttribute(this,t),Mt.applyNormalMatrix(e),this.setXYZ(t,Mt.x,Mt.y,Mt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Mt.fromBufferAttribute(this,t),Mt.transformDirection(e),this.setXYZ(t,Mt.x,Mt.y,Mt.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=Ot(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Je(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Ot(t,this.array)),t}setX(e,t){return this.normalized&&(t=Je(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Ot(t,this.array)),t}setY(e,t){return this.normalized&&(t=Je(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=Ot(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Je(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=Ot(t,this.array)),t}setW(e,t){return this.normalized&&(t=Je(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Je(t,this.array),n=Je(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=Je(t,this.array),n=Je(n,this.array),i=Je(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=Je(t,this.array),n=Je(n,this.array),i=Je(i,this.array),s=Je(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(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!==ha&&(e.usage=this.usage),e}}class Dy extends ut{constructor(e,t,n){super(new Int8Array(e),t,n)}}class Uy extends ut{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class Ny extends ut{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class Fy extends ut{constructor(e,t,n){super(new Int16Array(e),t,n)}}class Mu extends ut{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Oy extends ut{constructor(e,t,n){super(new Int32Array(e),t,n)}}class Su extends ut{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class By extends ut{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=Os(this.array[e*this.itemSize]);return this.normalized&&(t=Ot(t,this.array)),t}setX(e,t){return this.normalized&&(t=Je(t,this.array)),this.array[e*this.itemSize]=kt(t),this}getY(e){let t=Os(this.array[e*this.itemSize+1]);return this.normalized&&(t=Ot(t,this.array)),t}setY(e,t){return this.normalized&&(t=Je(t,this.array)),this.array[e*this.itemSize+1]=kt(t),this}getZ(e){let t=Os(this.array[e*this.itemSize+2]);return this.normalized&&(t=Ot(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Je(t,this.array)),this.array[e*this.itemSize+2]=kt(t),this}getW(e){let t=Os(this.array[e*this.itemSize+3]);return this.normalized&&(t=Ot(t,this.array)),t}setW(e,t){return this.normalized&&(t=Je(t,this.array)),this.array[e*this.itemSize+3]=kt(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array)),this.array[e+0]=kt(t),this.array[e+1]=kt(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array),i=Je(i,this.array)),this.array[e+0]=kt(t),this.array[e+1]=kt(n),this.array[e+2]=kt(i),this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=Je(t,this.array),n=Je(n,this.array),i=Je(i,this.array),s=Je(s,this.array)),this.array[e+0]=kt(t),this.array[e+1]=kt(n),this.array[e+2]=kt(i),this.array[e+3]=kt(s),this}}class Te extends ut{constructor(e,t,n){super(new Float32Array(e),t,n)}}const wf=new Bt,bs=new C,Ja=new C;class Ut{constructor(e=new C,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):wf.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)}
vendor: 18,233 bytes, line 1
1applyMatrix4(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;bs.subVectors(e,this.center);const t=bs.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(bs,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):(Ja.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(bs.copy(e.center).add(Ja)),this.expandByPoint(bs.copy(e.center).sub(Ja))),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}}let Cf=0;const nn=new He,$a=new nt,Xi=new C,Jt=new Bt,Ts=new Bt,wt=new C;class qe extends kn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Cf++}),this.uuid=en(),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(Xd(e)?Su:Mu)(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 Ze().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 nn.makeRotationFromQuaternion(e),this.applyMatrix4(nn),this}rotateX(e){return nn.makeRotationX(e),this.applyMatrix4(nn),this}rotateY(e){return nn.makeRotationY(e),this.applyMatrix4(nn),this}rotateZ(e){return nn.makeRotationZ(e),this.applyMatrix4(nn),this}translate(e,t,n){return nn.makeTranslation(e,t,n),this.applyMatrix4(nn),this}scale(e,t,n){return nn.makeScale(e,t,n),this.applyMatrix4(nn),this}lookAt(e){return $a.lookAt(e),$a.updateMatrix(),this.applyMatrix4($a.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Xi).negate(),this.translate(Xi.x,Xi.y,Xi.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&&ue("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 Bt);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 C(-1/0,-1/0,-1/0),new C(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];Jt.setFromBufferAttribute(s),this.morphTargetsRelative?(wt.addVectors(this.boundingBox.min,Jt.min),this.boundingBox.expandByPoint(wt),wt.addVectors(this.boundingBox.max,Jt.max),this.boundingBox.expandByPoint(wt)):(this.boundingBox.expandByPoint(Jt.min),this.boundingBox.expandByPoint(Jt.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 Ut);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 C,1/0);return}if(e){const n=this.boundingSphere.center;if(Jt.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];Ts.setFromBufferAttribute(o),this.morphTargetsRelative?(wt.addVectors(Jt.min,Ts.min),Jt.expandByPoint(wt),wt.addVectors(Jt.max,Ts.max),Jt.expandByPoint(wt)):(Jt.expandByPoint(Ts.min),Jt.expandByPoint(Ts.max))}Jt.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&&(Xi.fromBufferAttribute(e,c),wt.add(Xi)),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 v=0;v<n.count;v++)o[v]=new C,l[v]=new C;const c=new C,h=new C,d=new C,u=new K,f=new K,p=new K,_=new C,g=new C;function m(v,b,L){c.fromBufferAttribute(n,v),h.fromBufferAttribute(n,b),d.fromBufferAttribute(n,L),u.fromBufferAttribute(s,v),f.fromBufferAttribute(s,b),p.fromBufferAttribute(s,L),h.sub(c),d.sub(c),f.sub(u),p.sub(u);const P=1/(f.x*p.y-p.x*f.y);isFinite(P)&&(_.copy(h).multiplyScalar(p.y).addScaledVector(d,-f.y).multiplyScalar(P),g.copy(d).multiplyScalar(f.x).addScaledVector(h,-p.x).multiplyScalar(P),o[v].add(_),o[b].add(_),o[L].add(_),l[v].add(g),l[b].add(g),l[L].add(g))}let x=this.groups;x.length===0&&(x=[{start:0,count:e.count}]);for(let v=0,b=x.length;v<b;++v){const L=x[v],P=L.start,N=L.count;for(let O=P,G=P+N;O<G;O+=3)m(e.getX(O+0),e.getX(O+1),e.getX(O+2))}const y=new C,M=new C,E=new C,A=new C;function I(v){E.fromBufferAttribute(i,v),A.copy(E);const b=o[v];y.copy(b),y.sub(E.multiplyScalar(E.dot(b))).normalize(),M.crossVectors(A,b);const P=M.dot(l[v])<0?-1:1;a.setXYZW(v,y.x,y.y,y.z,P)}for(let v=0,b=x.length;v<b;++v){const L=x[v],P=L.start,N=L.count;for(let O=P,G=P+N;O<G;O+=3)I(e.getX(O+0)),I(e.getX(O+1)),I(e.getX(O+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 u=0,f=n.count;u<f;u++)n.setXYZ(u,0,0,0);const i=new C,s=new C,a=new C,o=new C,l=new C,c=new C,h=new C,d=new C;if(e)for(let u=0,f=e.count;u<f;u+=3){const p=e.getX(u+0),_=e.getX(u+1),g=e.getX(u+2);i.fromBufferAttribute(t,p),s.fromBufferAttribute(t,_),a.fromBufferAttribute(t,g),h.subVectors(a,s),d.subVectors(i,s),h.cross(d),o.fromBufferAttribute(n,p),l.fromBufferAttribute(n,_),c.fromBufferAttribute(n,g),o.add(h),l.add(h),c.add(h),n.setXYZ(p,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 u=0,f=t.count;u<f;u+=3)i.fromBufferAttribute(t,u+0),s.fromBufferAttribute(t,u+1),a.fromBufferAttribute(t,u+2),h.subVectors(a,s),d.subVectors(i,s),h.cross(d),n.setXYZ(u+0,h.x,h.y,h.z),n.setXYZ(u+1,h.x,h.y,h.z),n.setXYZ(u+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,d=o.normalized,u=new c.constructor(l.length*h);let f=0,p=0;for(let _=0,g=l.length;_<g;_++){o.isInterleavedBufferAttribute?f=l[_]*o.data.stride+o.offset:f=l[_]*h;for(let m=0;m<h;m++)u[p++]=c[f++]}return new ut(u,h,d)}if(this.index===null)return ue("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,d=c.length;h<d;h++){const u=c[h],f=e(u,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 d=0,u=c.length;d<u;d++){const f=c[d];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=[],d=s[c];for(let u=0,f=d.length;u<f;u++)h.push(d[u].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 d=a[c];this.addGroup(d.start,d.count,d.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"})}}class Bl{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=ha,this.updateRanges=[],this.version=0,this.uuid=en()}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=en()),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=en()),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 Nt=new C;class ps{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++)Nt.fromBufferAttribute(this,t),Nt.applyMatrix4(e),this.setXYZ(t,Nt.x,Nt.y,Nt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Nt.fromBufferAttribute(this,t),Nt.applyNormalMatrix(e),this.setXYZ(t,Nt.x,Nt.y,Nt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Nt.fromBufferAttribute(this,t),Nt.transformDirection(e),this.setXYZ(t,Nt.x,Nt.y,Nt.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Ot(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Je(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Je(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Je(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Je(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Je(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=Ot(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Ot(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Ot(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Ot(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Je(t,this.array),n=Je(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=Je(t,this.array),n=Je(n,this.array),i=Je(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=Je(t,this.array),n=Je(n,this.array),i=Je(i,this.array),s=Je(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){ua("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 ps(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){ua("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}}}let Rf=0;class zt extends kn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Rf++}),this.uuid=en(),this.name="",this.type="Material",this.blending=as,this.side=ei,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Ao,this.blendDst=Eo,this.blendEquation=yi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Me(0,0,0),this.blendAlpha=0,this.depthFunc=cs,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=bc,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ni,this.stencilZFail=Ni,this.stencilZPass=Ni,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){ue(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){ue(`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: 18,510 bytes, line 1
1n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(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!==as&&(n.blending=this.blending),this.side!==ei&&(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!==Ao&&(n.blendSrc=this.blendSrc),this.blendDst!==Eo&&(n.blendDst=this.blendDst),this.blendEquation!==yi&&(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!==cs&&(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!==bc&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ni&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Ni&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Ni&&(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.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.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 bu extends zt{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 qi;const As=new C,Yi=new C,Zi=new C,Ji=new K,Es=new K,Tu=new He,ur=new C,ws=new C,dr=new C,Bc=new K,Ka=new K,zc=new K;class If extends nt{constructor(e=new bu){if(super(),this.isSprite=!0,this.type="Sprite",qi===void 0){qi=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 Bl(t,5);qi.setIndex([0,1,2,0,2,3]),qi.setAttribute("position",new ps(n,3,0,!1)),qi.setAttribute("uv",new ps(n,2,3,!1))}this.geometry=qi,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.'),Yi.setFromMatrixScale(this.matrixWorld),Tu.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Zi.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Yi.multiplyScalar(-Zi.z);const n=this.material.rotation;let i,s;n!==0&&(s=Math.cos(n),i=Math.sin(n));const a=this.center;fr(ur.set(-.5,-.5,0),Zi,a,Yi,i,s),fr(ws.set(.5,-.5,0),Zi,a,Yi,i,s),fr(dr.set(.5,.5,0),Zi,a,Yi,i,s),Bc.set(0,0),Ka.set(1,0),zc.set(1,1);let o=e.ray.intersectTriangle(ur,ws,dr,!1,As);if(o===null&&(fr(ws.set(-.5,.5,0),Zi,a,Yi,i,s),Ka.set(0,1),o=e.ray.intersectTriangle(ur,dr,ws,!1,As),o===null))return;const l=e.ray.origin.distanceTo(As);l<e.near||l>e.far||t.push({distance:l,point:As.clone(),uv:Qt.getInterpolation(As,ur,ws,dr,Bc,Ka,zc,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 fr(r,e,t,n,i,s){Ji.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(Es.x=s*Ji.x-i*Ji.y,Es.y=i*Ji.x+s*Ji.y):Es.copy(Ji),r.copy(e),r.x+=Es.x,r.y+=Es.y,r.applyMatrix4(Tu)}const pr=new C,Vc=new C;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){pr.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(pr);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){pr.setFromMatrixPosition(e.matrixWorld),Vc.setFromMatrixPosition(this.matrixWorld);const n=pr.distanceTo(Vc)/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 In=new C,Qa=new C,mr=new C,Jn=new C,ja=new C,gr=new C,eo=new C;class Qs{constructor(e=new C,t=new C(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,In)),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=In.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(In.copy(this.origin).addScaledVector(this.direction,t),In.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Qa.copy(e).add(t).multiplyScalar(.5),mr.copy(t).sub(e).normalize(),Jn.copy(this.origin).sub(Qa);const s=e.distanceTo(t)*.5,a=-this.direction.dot(mr),o=Jn.dot(this.direction),l=-Jn.dot(mr),c=Jn.lengthSq(),h=Math.abs(1-a*a);let d,u,f,p;if(h>0)if(d=a*l-o,u=a*o-l,p=s*h,d>=0)if(u>=-p)if(u<=p){const _=1/h;d*=_,u*=_,f=d*(d+a*u+2*o)+u*(a*d+u+2*l)+c}else u=s,d=Math.max(0,-(a*u+o)),f=-d*d+u*(u+2*l)+c;else u=-s,d=Math.max(0,-(a*u+o)),f=-d*d+u*(u+2*l)+c;else u<=-p?(d=Math.max(0,-(-a*s+o)),u=d>0?-s:Math.min(Math.max(-s,-l),s),f=-d*d+u*(u+2*l)+c):u<=p?(d=0,u=Math.min(Math.max(-s,-l),s),f=u*(u+2*l)+c):(d=Math.max(0,-(a*s+o)),u=d>0?s:Math.min(Math.max(-s,-l),s),f=-d*d+u*(u+2*l)+c);else u=a>0?-s:s,d=Math.max(0,-(a*u+o)),f=-d*d+u*(u+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,d),i&&i.copy(Qa).addScaledVector(mr,u),f}intersectSphere(e,t){In.subVectors(e.center,this.origin);const n=In.dot(this.direction),i=In.dot(In)-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,d=1/this.direction.z,u=this.origin;return c>=0?(n=(e.min.x-u.x)*c,i=(e.max.x-u.x)*c):(n=(e.max.x-u.x)*c,i=(e.min.x-u.x)*c),h>=0?(s=(e.min.y-u.y)*h,a=(e.max.y-u.y)*h):(s=(e.max.y-u.y)*h,a=(e.min.y-u.y)*h),n>a||s>i||((s>n||isNaN(n))&&(n=s),(a<i||isNaN(i))&&(i=a),d>=0?(o=(e.min.z-u.z)*d,l=(e.max.z-u.z)*d):(o=(e.max.z-u.z)*d,l=(e.min.z-u.z)*d),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,In)!==null}intersectTriangle(e,t,n,i,s){ja.subVectors(t,e),gr.subVectors(n,e),eo.crossVectors(ja,gr);let a=this.direction.dot(eo),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Jn.subVectors(this.origin,e);const l=o*this.direction.dot(gr.crossVectors(Jn,gr));if(l<0)return null;const c=o*this.direction.dot(ja.cross(Jn));if(c<0||l+c>a)return null;const h=-o*Jn.dot(eo);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 Ii extends zt{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 an,this.combine=ya,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}}
vendor: 6,271 bytes, line 1
1const kc=new He,oi=new Qs,_r=new Ut,Gc=new C,xr=new C,vr=new C,yr=new C,to=new C,Mr=new C,Hc=new C,Sr=new C;class bt extends nt{constructor(e=new qe,t=new Ii){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],d=s[l];h!==0&&(to.fromBufferAttribute(d,e),a?Mr.addScaledVector(to,h):Mr.addScaledVector(to.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(),_r.copy(n.boundingSphere),_r.applyMatrix4(s),oi.copy(e.ray).recast(e.near),!(_r.containsPoint(oi.origin)===!1&&(oi.intersectSphere(_r,Gc)===null||oi.origin.distanceToSquared(Gc)>(e.far-e.near)**2))&&(kc.copy(s).invert(),oi.copy(e.ray).applyMatrix4(kc),!(n.boundingBox!==null&&oi.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,oi)))}_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,d=s.attributes.normal,u=s.groups,f=s.drawRange;if(o!==null)if(Array.isArray(a))for(let p=0,_=u.length;p<_;p++){const g=u[p],m=a[g.materialIndex],x=Math.max(g.start,f.start),y=Math.min(o.count,Math.min(g.start+g.count,f.start+f.count));for(let M=x,E=y;M<E;M+=3){const A=o.getX(M),I=o.getX(M+1),v=o.getX(M+2);i=br(this,m,e,n,c,h,d,A,I,v),i&&(i.faceIndex=Math.floor(M/3),i.face.materialIndex=g.materialIndex,t.push(i))}}else{const p=Math.max(0,f.start),_=Math.min(o.count,f.start+f.count);for(let g=p,m=_;g<m;g+=3){const x=o.getX(g),y=o.getX(g+1),M=o.getX(g+2);i=br(this,a,e,n,c,h,d,x,y,M),i&&(i.faceIndex=Math.floor(g/3),t.push(i))}}else if(l!==void 0)if(Array.isArray(a))for(let p=0,_=u.length;p<_;p++){const g=u[p],m=a[g.materialIndex],x=Math.max(g.start,f.start),y=Math.min(l.count,Math.min(g.start+g.count,f.start+f.count));for(let M=x,E=y;M<E;M+=3){const A=M,I=M+1,v=M+2;i=br(this,m,e,n,c,h,d,A,I,v),i&&(i.faceIndex=Math.floor(M/3),i.face.materialIndex=g.materialIndex,t.push(i))}}else{const p=Math.max(0,f.start),_=Math.min(l.count,f.start+f.count);for(let g=p,m=_;g<m;g+=3){const x=g,y=g+1,M=g+2;i=br(this,a,e,n,c,h,d,x,y,M),i&&(i.faceIndex=Math.floor(g/3),t.push(i))}}}}function Lf(r,e,t,n,i,s,a,o){let l;if(e.side===Wt?l=n.intersectTriangle(a,s,i,!0,o):l=n.intersectTriangle(i,s,a,e.side===ei,o),l===null)return null;Sr.copy(o),Sr.applyMatrix4(r.matrixWorld);const c=t.ray.origin.distanceTo(Sr);return c<t.near||c>t.far?null:{distance:c,point:Sr.clone(),object:r}}function br(r,e,t,n,i,s,a,o,l,c){r.getVertexPosition(o,xr),r.getVertexPosition(l,vr),r.getVertexPosition(c,yr);const h=Lf(r,e,t,n,xr,vr,yr,Hc);if(h){const d=new C;Qt.getBarycoord(Hc,xr,vr,yr,d),i&&(h.uv=Qt.getInterpolatedAttribute(i,o,l,c,d,new K)),s&&(h.uv1=Qt.getInterpolatedAttribute(s,o,l,c,d,new K)),a&&(h.normal=Qt.getInterpolatedAttribute(a,o,l,c,d,new C),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const u={a:o,b:l,c,normal:new C,materialIndex:0};Qt.getNormal(xr,vr,yr,u.normal),h.face=u,h.barycoord=d}return h}const Wc=new C,Xc=new ft,qc=new ft,Df=new C,Yc=new He,Tr=new C,no=new Ut,Zc=new He,io=new Qs;class Uf extends bt{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Mc,this.bindMatrix=new He,this.bindMatrixInverse=new He,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Bt),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Tr),this.boundingBox.expandByPoint(Tr)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Ut),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Tr),this.boundingSphere.expandByPoint(Tr)}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(),no.copy(this.boundingSphere),no.applyMatrix4(i),e.ray.intersectsSphere(no)!==!1&&(Zc.copy(i).invert(),io.copy(e.ray).applyMatrix4(Zc),!(this.boundingBox!==null&&io.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,io)))}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 ft,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===Mc?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===Dd?this.bindMatrixInverse.copy(this.bindMatrix).invert():ue("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}
vendor: 6,690 bytes, line 1
1applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;Xc.fromBufferAttribute(i.attributes.skinIndex,e),qc.fromBufferAttribute(i.attributes.skinWeight,e),Wc.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const a=qc.getComponent(s);if(a!==0){const o=Xc.getComponent(s);Yc.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(Df.copy(Wc).applyMatrix4(Yc),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}class Au extends nt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Sn extends yt{constructor(e=null,t=1,n=1,i,s,a,o,l,c=St,h=St,d,u){super(null,a,o,l,c,h,i,s,d,u),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Jc=new He,Nf=new He;class zl{constructor(e=[],t=[]){this.uuid=en(),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){ue("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 He)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new He;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:Nf;Jc.multiplyMatrices(o,t[s]),Jc.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new zl(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 Sn(t,e,e,Ht,Gt);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&&(ue("Skeleton: No bone found with UUID:",s),a=new Au),this.bones.push(a),this.boneInverses.push(new He().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 qs 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 $i=new He,$c=new He,Ar=[],Kc=new Bt,Ff=new He,Cs=new bt,Rs=new Ut;class Of extends bt{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new qs(new Float32Array(n*16),16),this.previousInstanceMatrix=null,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,Ff)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Bt),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,$i),Kc.copy(e.boundingBox).applyMatrix4($i),this.boundingBox.union(Kc)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Ut),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,$i),Rs.copy(e.boundingSphere).applyMatrix4($i),this.boundingSphere.union(Rs)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.previousInstanceMatrix!==null&&(this.previousInstanceMatrix=e.previousInstanceMatrix.clone()),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(Cs.geometry=this.geometry,Cs.material=this.material,Cs.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Rs.copy(this.boundingSphere),Rs.applyMatrix4(n),e.ray.intersectsSphere(Rs)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,$i),$c.multiplyMatrices(n,$i),Cs.matrixWorld=$c,Cs.raycast(e,Ar);for(let a=0,o=Ar.length;a<o;a++){const l=Ar[a];l.instanceId=s,l.object=this,t.push(l)}Ar.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new qs(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 Sn(new Float32Array(i*this.count),i,this.count,El,Gt));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 so=new C,Bf=new C,zf=new Ze;class vi{constructor(e=new C(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}
1setFromCoplanarPoints(e,t,n){const i=so.subVectors(n,t).cross(Bf.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(so),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||zf.getNormalMatrix(e),i=this.coplanarPoint(so).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 li=new Ut,Vf=new K(.5,.5),Er=new C;class js{constructor(e=new vi,t=new vi,n=new vi,i=new vi,s=new vi,a=new vi){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=sn,n=!1){const i=this.planes,s=e.elements,a=s[0],o=s[1],l=s[2],c=s[3],h=s[4],d=s[5],u=s[6],f=s[7],p=s[8],_=s[9],g=s[10],m=s[11],x=s[12],y=s[13],M=s[14],E=s[15];if(i[0].setComponents(c-a,f-h,m-p,E-x).normalize(),i[1].setComponents(c+a,f+h,m+p,E+x).normalize(),i[2].setComponents(c+o,f+d,m+_,E+y).normalize(),i[3].setComponents(c-o,f-d,m-_,E-y).normalize(),n)i[4].setComponents(l,u,g,M).normalize(),i[5].setComponents(c-l,f-u,m-g,E-M).normalize();else if(i[4].setComponents(c-l,f-u,m-g,E-M).normalize(),t===sn)i[5].setComponents(c+l,f+u,m+g,E+M).normalize();else if(t===ds)i[5].setComponents(l,u,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(),li.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),li.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(li)}intersectsSprite(e){li.center.set(0,0,0);const t=Vf.distanceTo(e.center);return li.radius=.7071067811865476+t,li.applyMatrix4(e.matrixWorld),this.intersectsSphere(li)}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(Er.x=i.normal.x>0?e.max.x:e.min.x,Er.y=i.normal.y>0?e.max.y:e.min.y,Er.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Er)<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 mn=new He,gn=new js;class Vl{constructor(){this.coordinateSystem=sn}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(mn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),gn.setFromProjectionMatrix(mn,i.coordinateSystem,i.reversedDepth),gn.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(mn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),gn.setFromProjectionMatrix(mn,i.coordinateSystem,i.reversedDepth),gn.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(mn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),gn.setFromProjectionMatrix(mn,i.coordinateSystem,i.reversedDepth),gn.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(mn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),gn.setFromProjectionMatrix(mn,i.coordinateSystem,i.reversedDepth),gn.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(mn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),gn.setFromProjectionMatrix(mn,i.coordinateSystem,i.reversedDepth),gn.containsPoint(e))return!0}return!1}clone(){return new Vl}}function ro(r,e){return r-e}function kf(r,e){return r.z-e.z}function Gf(r,e){return e.z-r.z}class Hf{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 Vt=new He,Wf=new Me(1,1,1),Qc=new js,Xf=new Vl,wr=new Bt,ci=new Ut,Is=new C,jc=new C,qf=new C,ao=new Hf,Lt=new bt,Cr=[];function Yf(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 hi(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 Zf extends bt{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 Sn(t,e,e,Ht,Gt);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new Sn(t,e,e,Ma,un);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 Sn(t,e,e,Ht,Gt);
1n.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),d=new ut(h,l,c);t.setAttribute(s,d)}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 Bt);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,Vt),this.getBoundingBoxAt(s,wr).applyMatrix4(Vt),e.union(wr)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Ut);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,Vt),this.getBoundingSphereAt(s,ci).applyMatrix4(Vt),e.union(ci)}}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(ro),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const s=this._matricesTexture;Vt.identity().toArray(s.image.data,i*16),s.needsUpdate=!0;const a=this._colorsTexture;return a&&(Wf.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(ro),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 d=t.getAttribute(h),u=n.getAttribute(h);Yf(d,u,l);const f=d.itemSize;
1for(let p=d.count,_=c;p<_;p++){const g=l+p;for(let m=0;m<f;m++)u.setComponent(g,m,0)}u.needsUpdate=!0,u.addUpdateRange(l*f,c*f)}if(i){const h=o.indexStart,d=o.reservedIndexCount;o.indexCount=t.getIndex().count;for(let u=0;u<a.count;u++)s.setX(h+u,l+a.getX(u));for(let u=a.count,f=d;u<f;u++)s.setX(h+u,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:d,reservedIndexCount:u}=c,f=s.index,p=f.array,_=e-d;for(let g=h;g<h+u;g++)p[g]=p[g]+_;f.array.copyWithin(t,h,h+u),f.addUpdateRange(t,u),f.needsUpdate=!0,c.indexStart=t}t+=c.reservedIndexCount}if(c.vertexStart!==e){const{vertexStart:h,reservedVertexCount:d}=c,u=s.attributes;for(const f in u){const p=u[f],{array:_,itemSize:g}=p;_.copyWithin(e*g,h*g,(h+d)*g),p.addUpdateRange(e*g,d*g),p.needsUpdate=!0}c.vertexStart=e}e+=c.reservedVertexCount,c.start=s.index?c.indexStart:c.vertexStart}}return this._nextIndexStart=t,this._nextVertexStart=e,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 Bt,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(Is.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 Ut;this.getBoundingBoxAt(e,wr),wr.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 d=c;a&&(d=a.getX(d)),Is.fromBufferAttribute(o,d),l=Math.max(l,s.center.distanceToSquared(Is))}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(ro);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);hi(this._multiDrawCounts,i),hi(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(),hi(a.image.data,this._indirectTexture.image.data),o.dispose(),this._initMatricesTexture(),hi(o.image.data,this._matricesTexture.image.data),l&&(l.dis
1pose(),this._initColorsTexture(),hi(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&&hi(s.index.array,a.index.array);for(const o in s.attributes)hi(s.attributes[o].array,a.attributes[o].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,s=this.matrixWorld,a=this.geometry;Lt.material=this.material,Lt.geometry.index=a.index,Lt.geometry.attributes=a.attributes,Lt.geometry.boundingBox===null&&(Lt.geometry.boundingBox=new Bt),Lt.geometry.boundingSphere===null&&(Lt.geometry.boundingSphere=new Ut);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];Lt.geometry.setDrawRange(h.start,h.count),this.getMatrixAt(o,Lt.matrixWorld).premultiply(s),this.getBoundingBoxAt(c,Lt.geometry.boundingBox),this.getBoundingSphereAt(c,Lt.geometry.boundingSphere),Lt.raycast(e,Cr);for(let d=0,u=Cr.length;d<u;d++){const f=Cr[d];f.object=this,f.batchId=o,t.push(f)}Cr.length=0}Lt.material=null,Lt.geometry.index=null,Lt.geometry.attributes={},Lt.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();let o=a===null?1:a.array.BYTES_PER_ELEMENT,l=1;s.wireframe&&(l=2,o=i.attributes.position.count>65535?4:2);const c=this._instanceInfo,h=this._multiDrawStarts,d=this._multiDrawCounts,u=this._geometryInfo,f=this.perObjectFrustumCulled,p=this._indirectTexture,_=p.image.data,g=n.isArrayCamera?Xf:Qc;f&&!n.isArrayCamera&&(Vt.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),Qc.setFromProjectionMatrix(Vt,n.coordinateSystem,n.reversedDepth));let m=0;if(this.sortObjects){Vt.copy(this.matrixWorld).invert(),Is.setFromMatrixPosition(n.matrixWorld).applyMatrix4(Vt),jc.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(Vt);for(let M=0,E=c.length;M<E;M++)if(c[M].visible&&c[M].active){const A=c[M].geometryIndex;this.getMatrixAt(M,Vt),this.getBoundingSphereAt(A,ci).applyMatrix4(Vt);let I=!1;if(f&&(I=!g.intersectsSphere(ci,n)),!I){const v=u[A],b=qf.subVectors(ci.center,Is).dot(jc);ao.push(v.start,v.count,b,M)}}const x=ao.list,y=this.customSort;y===null?x.sort(s.transparent?Gf:kf):y.call(this,x,n);for(let M=0,E=x.length;M<E;M++){const A=x[M];h[m]=A.start*o*l,d[m]=A.count*l,_[m]=A.index,m++}ao.reset()}else for(let x=0,y=c.length;x<y;x++)if(c[x].visible&&c[x].active){const M=c[x].geometryIndex;let E=!1;
vendor: 9,166 bytes, line 1
1if(f&&(this.getMatrixAt(x,Vt),this.getBoundingSphereAt(M,ci).applyMatrix4(Vt),E=!g.intersectsSphere(ci,n)),!E){const A=u[M];h[m]=A.start*o*l,d[m]=A.count*l,_[m]=x,m++}}p.needsUpdate=!0,this._multiDrawCount=m,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,s,a){this.onBeforeRender(e,null,i,s,a)}}class qt extends zt{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 fa=new C,pa=new C,eh=new He,Ps=new Qs,Rr=new Ut,oo=new C,th=new C;class wi 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++)fa.fromBufferAttribute(t,i-1),pa.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=fa.distanceTo(pa);e.setAttribute("lineDistance",new Te(n,1))}else ue("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(),Rr.copy(n.boundingSphere),Rr.applyMatrix4(i),Rr.radius+=s,e.ray.intersectsSphere(Rr)===!1)return;eh.copy(i).invert(),Ps.copy(e.ray).applyMatrix4(eh);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,h=n.index,u=n.attributes.position;if(h!==null){const f=Math.max(0,a.start),p=Math.min(h.count,a.start+a.count);for(let _=f,g=p-1;_<g;_+=c){const m=h.getX(_),x=h.getX(_+1),y=Ir(this,e,Ps,l,m,x,_);y&&t.push(y)}if(this.isLineLoop){const _=h.getX(p-1),g=h.getX(f),m=Ir(this,e,Ps,l,_,g,p-1);m&&t.push(m)}}else{const f=Math.max(0,a.start),p=Math.min(u.count,a.start+a.count);for(let _=f,g=p-1;_<g;_+=c){const m=Ir(this,e,Ps,l,_,_+1,_);m&&t.push(m)}if(this.isLineLoop){const _=Ir(this,e,Ps,l,p-1,f,p-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 Ir(r,e,t,n,i,s,a){const o=r.geometry.attributes.position;if(fa.fromBufferAttribute(o,i),pa.fromBufferAttribute(o,s),t.distanceSqToSegment(fa,pa,oo,th)>n)return;oo.applyMatrix4(r.matrixWorld);const c=e.ray.origin.distanceTo(oo);if(!(c<e.near||c>e.far))return{distance:c,point:th.clone().applyMatrix4(r.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:r}}const nh=new C,ih=new C;class Gn extends wi{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)nh.fromBufferAttribute(t,i),ih.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+nh.distanceTo(ih);e.setAttribute("lineDistance",new Te(n,1))}else ue("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Jf extends wi{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Eu extends zt{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 sh=new He,fl=new Qs,Pr=new Ut,Lr=new C;class $f extends nt{constructor(e=new qe,t=new Eu){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(),Pr.copy(n.boundingSphere),Pr.applyMatrix4(i),Pr.radius+=s,e.ray.intersectsSphere(Pr)===!1)return;sh.copy(i).invert(),fl.copy(e.ray).applyMatrix4(sh);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=n.index,d=n.attributes.position;if(c!==null){const u=Math.max(0,a.start),f=Math.min(c.count,a.start+a.count);for(let p=u,_=f;p<_;p++){const g=c.getX(p);Lr.fromBufferAttribute(d,g),rh(Lr,g,l,i,e,t,this)}}else{const u=Math.max(0,a.start),f=Math.min(d.count,a.start+a.count);for(let p=u,_=f;p<_;p++)Lr.fromBufferAttribute(d,p),rh(Lr,p,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 rh(r,e,t,n,i,s,a){const o=fl.distanceSqToPoint(r);if(o<t){const l=new C;fl.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 Kf extends yt{constructor(e,t,n,i,s=pt,a=pt,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 d(){h.needsUpdate=!0,h._requestVideoFrameCallbackId=e.requestVideoFrameCallback(d)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(d))}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 zy extends Kf{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 Vy extends yt{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=St,this.minFilter=St,this.generateMipmaps=!1,this.needsUpdate=!0}}class kl extends yt{constructor(e,t,n,i,s,a,o,l,c,h,d,u){super(null,a,o,l,c,h,i,s,d,u),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class ky extends kl{constructor(e,t,n,i,s,a){super(e,t,n,s,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=jt,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Gy extends kl{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 Sa extends yt{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 Hy extends yt{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 Ys extends yt{constructor(e,t,n=un,i,s,a,o=St,l=St,c,h=Vn,d=1){if(h!==Vn&&h!==Si)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const u={width:e,height:t,depth:d};super(u,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 bi(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 Qf extends Ys{constructor(e,t=un,n=Bn,i,s,a=St,o=St,l,c=Vn){const h={width:e,height:e,depth:1},d=[h,h,h,h,h,h];super(e,e,t,n,i,s,a,o,l,c),this.image=d,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class wu extends yt{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class _s 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=[],d=[];let u=0,f=0;p("z","y","x",-1,-1,n,t,e,a,s,0),p("z","y","x",1,-1,n,t,-e,a,s,1
vendor: 1,916 bytes, line 1
1),p("x","z","y",1,1,e,n,t,i,a,2),p("x","z","y",1,-1,e,n,-t,i,a,3),p("x","y","z",1,-1,e,t,n,i,s,4),p("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(d,2));function p(_,g,m,x,y,M,E,A,I,v,b){const L=M/I,P=E/v,N=M/2,O=E/2,G=A/2,z=I+1,B=v+1;let V=0,ie=0;const j=new C;for(let ge=0;ge<B;ge++){const xe=ge*P-O;for(let _e=0;_e<z;_e++){const ke=_e*L-N;j[_]=ke*x,j[g]=xe*y,j[m]=G,c.push(j.x,j.y,j.z),j[_]=0,j[g]=0,j[m]=A>0?1:-1,h.push(j.x,j.y,j.z),d.push(_e/I),d.push(1-ge/v),V+=1}}for(let ge=0;ge<v;ge++)for(let xe=0;xe<I;xe++){const _e=u+xe+z*ge,ke=u+xe+z*(ge+1),it=u+(xe+1)+z*(ge+1),at=u+(xe+1)+z*ge;l.push(_e,ke,at),l.push(ke,it,at),ie+=6}o.addGroup(f,ie,b),f+=ie,u+=V}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new _s(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class Gl 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,d=Math.PI/2*e,u=t,f=2*d+u,p=n*2+s,_=i+1,g=new C,m=new C;for(let x=0;x<=p;x++){let y=0,M=0,E=0,A=0;if(x<=n){const b=x/n,L=b*Math.PI/2;M=-h-e*Math.cos(L),E=e*Math.sin(L),A=-e*Math.cos(L),y=b*d}else if(x<=n+s){const b=(x-n)/s;M=-h+b*t,E=e,A=0,y=d+b*u}else{const b=(x-n-s)/n,L=b*Math.PI/2;M=h+e*Math.sin(L),E=e*Math.cos(L),A=e*Math.sin(L),y=d+u+b*d}const I=Math.max(0,Math.min(1,y/f));let v=0;x===0?v=.5/i:x===p&&(v=-.5/i);for(let b=0;b<=i;b++){const L=b/i,P=L*Math.PI*2,N=Math.sin(P),O=Math.cos(P);m.x=-E*O,m.y=M,m.z=E*N,o.push(m.x,m.y,m.z),g.set(-E*O,A,E*N),g.normalize(),l.push(g.x,g.y,g.z),c.push(L+v,I)}if(x>0){const b=(x-1)*_;for(let L=0;L<i;
vendor: 2,941 bytes, line 1
1L++){const P=b+L,N=b+L+1,O=x*_+L,G=x*_+L+1;a.push(P,N,O),a.push(N,G,O)}}}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 Gl(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class Hl 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 C,h=new K;a.push(0,0,0),o.push(0,0,1),l.push(.5,.5);for(let d=0,u=3;d<=t;d++,u+=3){const f=n+d/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[u]/e+1)/2,h.y=(a[u+1]/e+1)/2,l.push(h.x,h.y)}for(let d=1;d<=t;d++)s.push(d,d+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 Hl(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class ba 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=[],d=[],u=[],f=[];let p=0;const _=[],g=n/2;let m=0;x(),a===!1&&(e>0&&y(!0),t>0&&y(!1)),this.setIndex(h),this.setAttribute("position",new Te(d,3)),this.setAttribute("normal",new Te(u,3)),this.setAttribute("uv",new Te(f,2));function x(){const M=new C,E=new C;let A=0;const I=(t-e)/n;for(let v=0;v<=s;v++){const b=[],L=v/s,P=L*(t-e)+e;for(let N=0;N<=i;N++){const O=N/i,G=O*l+o,z=Math.sin(G),B=Math.cos(G);E.x=P*z,E.y=-L*n+g,E.z=P*B,d.push(E.x,E.y,E.z),M.set(z,I,B).normalize(),u.push(M.x,M.y,M.z),f.push(O,1-L),b.push(p++)}_.push(b)}for(let v=0;v<i;v++)for(let b=0;b<s;b++){const L=_[b][v],P=_[b+1][v],N=_[b+1][v+1],O=_[b][v+1];(e>0||b!==0)&&(h.push(L,P,O),A+=3),(t>0||b!==s-1)&&(h.push(P,N,O),A+=3)}c.addGroup(m,A,0),m+=A}function y(M){const E=p,A=new K,I=new C;let v=0;const b=M===!0?e:t,L=M===!0?1:-1;for(let N=1;N<=i;N++)d.push(0,g*L,0),u.push(0,L,0),f.push(.5,.5),p++;const P=p;for(let N=0;N<=i;N++){const G=N/i*l+o,z=Math.cos(G),B=Math.sin(G);I.x=b*B,I.y=g*L,I.z=b*z,d.push(I.x,I.y,I.z),u.push(0,L,0),A.x=z*.5+.5,A.y=B*.5*L+.5,f.push(A.x,A.y),p++}for(let N=0;N<i;N++){const O=E+N,G=P+N;M===!0?h.push(G,G+1,O):h.push(G+1,G,O),v+=3}c.addGroup(m,v,M===!0?1:2),m+=v}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ba(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Ta extends ba{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
1oneGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:s,thetaStart:a,thetaLength:o}}static fromJSON(e){return new Ta(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Pi 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(x){const y=new C,M=new C,E=new C;for(let A=0;A<t.length;A+=3)f(t[A+0],y),f(t[A+1],M),f(t[A+2],E),l(y,M,E,x)}function l(x,y,M,E){const A=E+1,I=[];for(let v=0;v<=A;v++){I[v]=[];const b=x.clone().lerp(M,v/A),L=y.clone().lerp(M,v/A),P=A-v;for(let N=0;N<=P;N++)N===0&&v===A?I[v][N]=b:I[v][N]=b.clone().lerp(L,N/P)}for(let v=0;v<A;v++)for(let b=0;b<2*(A-v)-1;b++){const L=Math.floor(b/2);b%2===0?(u(I[v][L+1]),u(I[v+1][L]),u(I[v][L])):(u(I[v][L+1]),u(I[v+1][L+1]),u(I[v+1][L]))}}function c(x){const y=new C;for(let M=0;M<s.length;M+=3)y.x=s[M+0],y.y=s[M+1],y.z=s[M+2],y.normalize().multiplyScalar(x),s[M+0]=y.x,s[M+1]=y.y,s[M+2]=y.z}function h(){const x=new C;for(let y=0;y<s.length;y+=3){x.x=s[y+0],x.y=s[y+1],x.z=s[y+2];const M=g(x)/2/Math.PI+.5,E=m(x)/Math.PI+.5;a.push(M,1-E)}p(),d()}function d(){for(let x=0;x<a.length;x+=6){const y=a[x+0],M=a[x+2],E=a[x+4],A=Math.max(y,M,E),I=Math.min(y,M,E);A>.9&&I<.1&&(y<.2&&(a[x+0]+=1),M<.2&&(a[x+2]+=1),E<.2&&(a[x+4]+=1))}}function u(x){s.push(x.x,x.y,x.z)}function f(x,y){const M=x*3;y.x=e[M+0],y.y=e[M+1],y.z=e[M+2]}function p(){const x=new C,y=new C,M=new C,E=new C,A=new K,I=new K,v=new K;for(let b=0,L=0;b<s.length;b+=9,L+=6){x.set(s[b+0],s[b+1],s[b+2]),y.set(s[b+3],s[b+4],s[b+5]),M.set(s[b+6],s[b+7],s[b+8]),A.set(a[L+0],a[L+1]),I.set(a[L+2],a[L+3]),v.set(a[L+4],a[L+5]),E.copy(x).add(y).add(M).divideScalar(3);const P=g(E);_(A,L+0,x,P),_(I,L+2,y,P),_(v,L+4,M,P)}}function _(x,y,M,E){E<0&&x.x===1&&(a[y]=x.x-1),M.x===0&&M.z===0&&(a[y]=E/2/Math.PI+.5)}function g(x){return Math.atan2(x.z,-x.x)}function m(x){return Math.atan2(-x.y,Math.sqrt(x.x*x.x+x.z*x.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Pi(e.vertices,e.indices,e.radius,e.detail)}}class Wl extends Pi{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 1
119,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 Wl(e.radius,e.detail)}}const Dr=new C,Ur=new C,lo=new C,Nr=new Qt;class jf 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(Ai*t),a=e.getIndex(),o=e.getAttribute("position"),l=a?a.count:o.count,c=[0,0,0],h=["a","b","c"],d=new Array(3),u={},f=[];for(let p=0;p<l;p+=3){a?(c[0]=a.getX(p),c[1]=a.getX(p+1),c[2]=a.getX(p+2)):(c[0]=p,c[1]=p+1,c[2]=p+2);const{a:_,b:g,c:m}=Nr;if(_.fromBufferAttribute(o,c[0]),g.fromBufferAttribute(o,c[1]),m.fromBufferAttribute(o,c[2]),Nr.getNormal(lo),d[0]=`${Math.round(_.x*i)},${Math.round(_.y*i)},${Math.round(_.z*i)}`,d[1]=`${Math.round(g.x*i)},${Math.round(g.y*i)},${Math.round(g.z*i)}`,d[2]=`${Math.round(m.x*i)},${Math.round(m.y*i)},${Math.round(m.z*i)}`,!(d[0]===d[1]||d[1]===d[2]||d[2]===d[0]))for(let x=0;x<3;x++){const y=(x+1)%3,M=d[x],E=d[y],A=Nr[h[x]],I=Nr[h[y]],v=`${M}_${E}`,b=`${E}_${M}`;b in u&&u[b]?(lo.dot(u[b].normal)<=s&&(f.push(A.x,A.y,A.z),f.push(I.x,I.y,I.z)),u[b]=null):v in u||(u[v]={index0:c[x],index1:c[y],normal:lo.clone()})}}for(const p in u)if(u[p]){const{index0:_,index1:g}=u[p];Dr.fromBufferAttribute(o,_),Ur.fromBufferAttribute(o,g),f.push(Dr.x,Dr.y,Dr.z),f.push(Ur.x,Ur.y,Ur.z)}this.setAttribute("position",new Te(f,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class bn{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){ue("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],u=n[i+1]-h,f=(a-h)/u;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 C);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 C,i=[],s=[],a=[],o=new C,l=new He;for(let f=0;f<=e;f++){const p=f/e;i[f]=this.getTangentAt(p,new C)}s[0]=new C,a[0]=new C;let c=Number.MAX_VALUE;const h=Math.abs(i[0].x),d=Math.abs(i[0].y),u=Math.abs(i[0].z);h<=c&&(c=h,n.set(1,0,0)),d<=c&&(c=d,n.set(0,1,0)),u<=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 p=Math.acos(Ve(i[f-1].dot(i[f]),-1,1));s[f].applyMatrix4(l.makeRotationAxis(o,p))}a[f].crossVectors(i[f],s[f])}if(t===!0){let f=Math.acos(Ve(s[0].dot(s[e]),-1,1));f/=e,i[0].dot(o.crossVectors(s[0],s[e]))>0&&(f=-f);for(let p=1;p<=e;p++)s[p].applyMatrix4(l.makeRotationAxis(i[p],f*p)),a[p].crossVectors(i[p],s[p])}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 Xl extends bn{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),d=Math.sin(this.aRotation),u=l-this.aX,f=c-this.aY;l=u*h-f*d+this.aX,c=u*d+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 ep extends Xl{constructor(e,t,n,i,s,a){super(e,t,n,n,i,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function ql(){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,d){let u=(a-s)/c-(o-s)/(c+h)+(o-a)/h,f=(o-a)/h-(l-a)/(h+d)+(l-o)/d;u*=h,f*=h,i(a,o,u,f)},calc:function(s){const a=s*s,o=a*s;return r+e*s+t*a+n*o}}}const Fr=new C,co=new ql,ho=new ql,uo=new ql;class tp extends bn{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 C){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]:(Fr.subVectors(i[0],i[1]).add(i[0]),c=Fr);const d=i[o%s],u=i[(o+1)%s];if(this.closed||o+2<s?h=i[(o+2)%s]:(Fr.subVectors(i[s-1],i[s-2]).add(i[s-1]),h=Fr),this.curveType==="centripetal"||this.curveType==="chordal"){const f=this.curveType==="chordal"?.5:.25;let p=Math.pow(c.distanceToSquared(d),f),_=Math.pow(d.distanceToSquared(u),f),g=Math.pow(u.distanceToSquared(h),f);_<1e-4&&(_=1),p<1e-4&&(p=_),g<1e-4&&(g=_),co.initNonuniformCatmullRom(c.x,d.x,u.x,h.x,p,_,g),ho.initNonuniformCatmullRom(c.y,d.y,u.y,h.y,p,_,g),uo.initNonuniformCatmullRom(c.z,d.z,u.z,h.z,p,_,g)}else this.curveType==="catmullrom"&&(co.initCatmullRom(c.x,d.x,u.x,h.x,this.tension),ho.initCatmullRom(c.y,d.y,u.y,h.y,this.tension),uo.initCatmullRom(c.z,d.z,u.z,h.z,this.tension));return n.set(co.calc(l),ho.calc(l),uo.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 C().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function ah(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 np(r,e){const t=1-r;return t*t*e}function ip(r,e){return 2*(1-r)*r*e}function sp(r,e){return r*r*e}function ks(r,e,t,n){return np(r,e)+ip(r,t)+sp(r,n)}function rp(r,e){const t=1-r;return t*t*t*e}function ap(r,e){const t=1-r;return 3*t*t*r*e}function op(r,e){return 3*(1-r)*r*r*e}function lp(r,e){return r*r*r*e}function Gs(r,e,t,n,i){return rp(r,e)+ap(r,t)+op(r,n)+lp(r,i)}class Cu extends bn{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(Gs(e,i.x,s.x,a.x,o.x),Gs(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 cp extends bn{constructor(e=new C,t=new C,n=new C,i=new C){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new C){const n=t,i=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(Gs(e,i.x,s.x,a.x,o.x),Gs(e,i.y,s.y,a.y,o.y),Gs(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 Ru extends bn{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: 13,938 bytes, line 1
1getTangent(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 hp extends bn{constructor(e=new C,t=new C){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new C){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 C){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 Iu extends bn{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(ks(e,i.x,s.x,a.x),ks(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 Pu extends bn{constructor(e=new C,t=new C,n=new C){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new C){const n=t,i=this.v0,s=this.v1,a=this.v2;return n.set(ks(e,i.x,s.x,a.x),ks(e,i.y,s.y,a.y),ks(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 Lu extends bn{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],d=i[a>i.length-3?i.length-1:a+2];return n.set(ah(o,l.x,c.x,h.x,d.x),ah(o,l.y,c.y,h.y,d.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 ma=Object.freeze({__proto__:null,ArcCurve:ep,CatmullRomCurve3:tp,CubicBezierCurve:Cu,CubicBezierCurve3:cp,EllipseCurve:Xl,LineCurve:Ru,LineCurve3:hp,QuadraticBezierCurve:Iu,QuadraticBezierCurve3:Pu,SplineCurve:Lu});class up extends bn{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 ma[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 ma[i.type]().fromJSON(i))}return this}}class pl extends up{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 Ru(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 Iu(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 Cu(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 Lu(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 Xl(e,t,n,i,s,a,o,l);if(this.curves.length>0){const d=c.getPoint(0);d.equals(this.currentPoint)||this.lineTo(d.x,d.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 ls extends pl{constructor(e){super(e),this.uuid=en(),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 pl().fromJSON(i))}return this}}function dp(r,e,t=2){const n=e&&e.length,i=n?e[0]*t:r.length;let s=Du(r,0,i,t,!0);const a=[];if(!s||s.next===s.prev)return a;let o,l,c;if(n&&(s=_p(r,e,s,t)),r.length>80*t){o=r[0],l=r[1];let h=o,d=l;for(let u=t;u<i;u+=t){const f=r[u],p=r[u+1];f<o&&(o=f),p<l&&(l=p),f>h&&(h=f),p>d&&(d=p)}c=Math.max(h-o,d-l),c=c!==0?32767/c:0}return Zs(s,a,t,o,l,c,0),a}function Du(r,e,t,n,i){let s;if(i===Cp(r,e,t,n)>0)for(let a=e;a<t;a+=n)s=oh(a/n|0,r[a],r[a+1],s);else for(let a=t-n;a>=e;a-=n)s=oh(a/n|0,r[a],r[a+1],s);return s&&ms(s,s.next)&&($s(s),s=s.next),s}function Ci(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(ms(t,t.next)||mt(t.prev,t,t.next)===0)){if($s(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Zs(r,e,t,n,i,s,a){if(!r)return;!a&&s&&Sp(r,n,i,s);let o=r;for(;r.prev!==r.next;){const l=r.prev,c=r.next;if(s?pp(r,n,i,s):fp(r)){e.push(l.i,r.i,c.i),$s(r),r=c.next,o=c.next;continue}if(r=c,r===o){a?a===1?(r=mp(Ci(r),e),Zs(r,e,t,n,i,s,2)):a===2&&gp(r,e,t,n,i,s):Zs(Ci(r),e,t,n,i,s,1);break}}}function fp(r){const e=r.prev,t=r,n=r.next;if(mt(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),d=Math.min(o,l,c),u=Math.max(i,s,a),f=Math.max(o,l,c);let p=n.next;for(;p!==e;){if(p.x>=h&&p.x<=u&&p.y>=d&&p.y<=f&&Bs(i,o,s,l,a,c,p.x,p.y)&&mt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function pp(r,e,t,n){const i=r.prev,s=r,a=r.next;if(mt(i,s,a)>=0)return!1;const o=i.x,l=s.x,c=a.x,h=i.y,d=s.y,u=a.y,f=Math.min(o,l,c),p=Math.min(h,d,u),_=Math.max(o,l,c),g=Math.max(h,d,u),m=ml(f,p,e,t,n),x=ml(_,g,e,t,n);let y=r.prevZ,M=r.nextZ;for(;y&&y.z>=m&&M&&M.z<=x;){if(y.x>=f&&y.x<=_&&y.y>=p&&y.y<=g&&y!==i&&y!==a&&Bs(o,h,l,d,c,u,y.x,y.y)&&mt(y.prev,y,y.next)>=0||(y=y.prevZ,M.x>=f&&M.x<=_&&M.y>=p&&M.y<=g&&M!==i&&M!==a&&Bs(o,h,l,d,c,u,M.x,M.y)&&mt(M.prev,M,M.next)>=0))return!1;M=M.nextZ}for(;y&&y.z>=m;){if(y.x>=f&&y.x<=_&&y.y>=p&&y.y<=g&&y!==i&&y!==a&&Bs(o,h,l,d,c,u,y.x,y.y)&&mt(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;M&&M.z<=x;){if(M.x>=f&&M.x<=_&&M.y>=p&&M.y<=g&&M!==i&&M!==a&&Bs(o,h,l,d,c,u,M.x,M.y)&&mt(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function mp(r,e){let t=r;do{const n=t.prev,i=t.next.next;!ms(n,i)&&Nu(n,t,t.next,i)&&Js(n,i)&&Js(i,n)&&(e.push(n.i,t.i,i.i),$s(t),$s(t.next),t=r=i),t=t.next}while(t!==r);return Ci(t)}function gp(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=Fu(a,o);a=Ci(a,a.next),l=Ci(l,l.next),Zs(a,e,t,n,i,s,0),Zs(l,e,t,n,i,s,0);return}o=o.next}a=a.next}while(a!==r)}function _p(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=Du(r,o,l,n,!1);c===c.next&&(c.steiner=!0),i.push(Tp(c))}i.sort(xp);for(let s=0;s<i.length;s++)t=vp(i[s],t);return t}function xp(r,e){let t=r.x-e.x;if(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 vp(r,e){const t=yp(r,e);if(!t)return e;const n=Fu(t,r);return Ci(n,n.next),Ci(t,t.next)}function yp(r,e){let t=e;const n=r.x,i=r.y;let s=-1/0,a;if(ms(r,t))return t;do{if(ms(r,t.next))return t.next;if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const d=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=n&&d>s&&(s=d,a=t.x<t.next.x?t:t.next,d===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&&Uu(i<c?n:s,i,l,c,i<c?s:n,i,t.x,t.y)){const d=Math.abs(i-t.y)/(n-t.x);Js(t,r)&&(d<h||d===h&&(t.x>a.x||t.x===a.x&&Mp(a,t)))&&(a=t,h=d)}t=t.next}while(t!==o);return a}function Mp(r,e){return mt(r.prev,r,e.prev)<0&&mt(e.next,r,r.next)<0}function Sp(r,e,t,n){let i=r;do i.z===0&&(i.z=ml(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,bp(i)}function bp(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 ml(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 Tp(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 Uu(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 Bs(r,e,t,n,i,s,a,o){return!(r===a&&e===o)&&Uu(r,e,t,n,i,s,a,o)}function Ap(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!Ep(r,e)&&(Js(r,e)&&Js(e,r)&&wp(r,e)&&(mt(r.prev,r,e.prev)||mt(r,e.prev,e))||ms(r,e)&&mt(r.prev,r,r.next)>0&&mt(e.prev,e,e.next)>0)}function mt(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function ms(r,e){return r.x===e.x&&r.y===e.y}function Nu(r,e,t,n){const i=Br(mt(r,e,t)),s=Br(mt(r,e,n)),a=Br(mt(t,n,r)),o=Br(mt(t,n,e));return!!(i!==s&&a!==o||i===0&&Or(r,t,e)||s===0&&Or(r,n,e)||a===0&&Or(t,r,n)||o===0&&Or(t,e,n))}function Or(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 Br(r){return r>0?1:r<0?-1:0}function Ep(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&&Nu(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function Js(r,e){return mt(r.prev,r,r.next)<0?mt(r,e,r.next)>=0&&mt(r,r.prev,e)>=0:mt(r,e,r.prev)<0||mt(r,r.next,e)<0}function wp(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 Fu(r,e){const t=gl(r.i,r.x,r.y),n=gl(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 oh(r,e,t,n){const i=gl(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 $s(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 gl(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Cp(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 Rp{static triangulate(e,t,n=2){return dp(e,t,n)}}class yn{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 yn.area(e)<0}
1static triangulateShape(e,t){const n=[],i=[],s=[];lh(e),ch(n,e);let a=e.length;t.forEach(lh);for(let l=0;l<t.length;l++)i.push(a),a+=t[l].length,ch(n,t[l]);const o=Rp.triangulate(n,i);for(let l=0;l<o.length;l+=3)s.push(o.slice(l,l+3));return s}}function lh(r){const e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function ch(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}class Yl extends qe{constructor(e=new ls([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,d=t.depth!==void 0?t.depth:1;let u=t.bevelEnabled!==void 0?t.bevelEnabled:!0,f=t.bevelThickness!==void 0?t.bevelThickness:.2,p=t.bevelSize!==void 0?t.bevelSize:f-.1,_=t.bevelOffset!==void 0?t.bevelOffset:0,g=t.bevelSegments!==void 0?t.bevelSegments:3;const m=t.extrudePath,x=t.UVGenerator!==void 0?t.UVGenerator:Ip;let y,M=!1,E,A,I,v;if(m){y=m.getSpacedPoints(h),M=!0,u=!1;const $=m.isCatmullRomCurve3?m.closed:!1;E=m.computeFrenetFrames(h,$),A=new C,I=new C,v=new C}u||(g=0,f=0,p=0,_=0);const b=o.extractPoints(c);let L=b.shape;const P=b.holes;if(!yn.isClockWise(L)){L=L.reverse();for(let $=0,te=P.length;$<te;$++){const Q=P[$];yn.isClockWise(Q)&&(P[$]=Q.reverse())}}function O($){const Q=10000000000000001e-36;let de=$[0];for(let R=1;R<=$.length;R++){const Fe=R%$.length,ve=$[Fe],Be=ve.x-de.x,le=ve.y-de.y,w=Be*Be+le*le,S=Math.max(Math.abs(ve.x),Math.abs(ve.y),Math.abs(de.x),Math.abs(de.y)),U=Q*S*S;if(w<=U){$.splice(Fe,1),R--;continue}de=ve}}O(L),P.forEach(O);const G=P.length,z=L;for(let $=0;$<G;$++){const te=P[$];L=L.concat(te)}function B($,te,Q){return te||Le("ExtrudeGeometry: vec does not exist"),$.clone().addScaledVector(te,Q)}const V=L.length;function ie($,te,Q){let de,R,Fe;const ve=$.x-te.x,Be=$.y-te.y,le=Q.x-$.x,w=Q.y-$.y,S=ve*ve+Be*Be,U=ve*w-Be*le;if(Math.abs(U)>Number.EPSILON){const X=Math.sqrt(S),J=Math.sqrt(le*le+w*w),q=te.x-Be/X,Ae=te.y+ve/X,ce=Q.x-w/J,De=Q.y+le/J,ze=((ce-q)*w-(De-Ae)*le)/(ve*w-Be*le);de=q+ve*ze-$.x,R=Ae+Be*ze-$.y;const ee=de*de+R*R;if(ee<=2)return new K(de,R);Fe=Math.sqrt(ee/2)}else{let X=!1;ve>Number.EPSILON?le>Number.EPSILON&&(X=!0):ve<-Number.EPSILON?le<-Number.EPSILON&&(X=!0):Math.sign(Be)===Math.sign(w)&&(X=!0),X?(de=-Be,R=ve,Fe=Math.sqrt(S)):(de=ve,R=Be,Fe=Math.sqrt(S/2))}return new K(de/Fe,R/Fe)}const j=[];for(let $=0,te=z.length,Q=te-1,de=$+1;$<te;$++,Q++,de++)Q===te&&(Q=0),de===te&&(de=0),j[$]=ie(z[$],z[Q],z[de]);const ge=[];let xe,_e=j.concat();for(let $=0,te=G;$<te;$++){const Q=P[$];xe=[];for(let de=0,R=Q.length,Fe=R-1,ve=de+1;de<R;de++,Fe++,ve++)Fe===R&&(Fe=0),ve===R&&(ve=0),xe[de]=ie(Q[de],Q[Fe],Q[ve]);ge.push(xe),_e=_e.concat(xe)}let ke;if(g===0)ke=yn.triangulateShape(z,P);else{const $=[],te=[];for(let Q=0;Q<g;Q++){const de=Q/g,R=f*Math.cos(de*Math.PI/2),Fe=p*Math.sin(de*Math.PI/2)+_;for(let ve=0,Be=z.length;ve<Be;ve++){const le=B(z[ve],j[ve],Fe);Oe(le.x,le.y,-R),de===0&&$.push(le)}for(let ve=0,Be=G;ve<Be;ve++){const le=P[ve];xe=ge[ve];const w=[];for(let S=0,U=le.length;S<U;S++){const X=B(le[S],xe[S],Fe);Oe(X.x,X.y,-R),de===0&&w.push(X)}de===0&&te.push(w)}}ke=yn.triangulateShape($,te)}const it=ke.length,at=p+_;for(let $=0;$<V;$++){const te=u?B(L[$],_e[$],at):L[$];M?(I.copy(E.normals[0]).multiplyScalar(te.x),A.copy(E.binormals[0]).multiplyScalar(te.y),v.copy(y[0]).add(I).add(A),Oe(v.x,v.y,v.z)):Oe(te.x,te.y,0)}for(let $=1;$<=h;$++)for(let te=0;te<V;te++){const Q=u?B(L[te],_e[te],at):L[te];M?(I.copy(E.normals[$]).multiplyScalar(Q.x),A.copy(E.binormals[$]).multiplyScalar(Q.y),v.copy(y[$]).add(I).add(A),Oe(v.x,v.y,v.z)):Oe(Q.x,Q.y,d/h*$)}for(let $=g-1;$>=0;$--){const te=$/g,Q=f*Math.cos(te*Math.PI/2),de=p*Math.sin(te*Math.PI/2)+_;for(let R=0,Fe=z.length;R<Fe;R++){const ve=B(z[R],j[R],de);Oe(ve.x,ve.y,d+Q)}for(let R=0,Fe=P.length;R<Fe;R++){const ve=P[R];xe=ge[R];for(let Be=0,le=ve.length;Be<le;Be++){const w=B(ve[Be],xe[Be],de);M?Oe(w.x,w.y+y[h-1].y,y[h-1].x+Q):Oe(w.x,w.y,d+Q)}}}Z(),ae();function Z(){const $=i.length/3;if(u){let te=0,Q=V*te;for(let de=0;de<it;de++){const R=ke[de];Ne(R[2]+Q,R[1]+Q,R[0]+Q)}te=h+g*2,Q=V*te;for(let de=0;de<it;de++){const R=ke[de];Ne(R[0]+Q,R[1]+Q,R[2]+Q)}}else{for(let te=0;te<it;te++){const Q=ke[te];Ne(Q[2],Q[1],Q[0])}for(let te=0;te<it;te++){const Q=ke[te];Ne(Q[0]+V*h,Q[1]+V*h,Q[2]+V*h)}}n.addGroup($,i.length/3-$,0)}function ae(){const $=i.length/3;let te=0;oe(z,te),te+=z.length;for(let Q=0,de=P.length;Q<de;Q++){const R=P[Q];oe(R,te),te+=R.length}n.addGroup($,i.length/3-$,1)}function oe($,te){let Q=$.length;for(;--Q>=0;){const de=Q;let R=Q-1;R<0&&(R=$.length-1);for(let Fe=0,ve=h+g*2;Fe<ve;Fe++){const Be=V*Fe,le=V*(Fe+1),w=te+de+Be,S=te+R+Be,U=te+R+le,X=te+de+le;Ge(w,S,U,X)}}}function Oe($,te,Q){l.push($),l.push(te),l.push(Q)}function Ne($,te,Q){ot($),ot(te),ot(Q);const de=i.length/3,R=x.generateTopUV(n,i,de-3,de-2,de-1);Xe(R[0]),Xe(R[1]),Xe(R[2])}function Ge($,te,Q,de){ot($),ot(te),ot(de),ot(te),ot(Q),ot(de);const R=i.length/3,Fe=x.generateSideWallUV(n,i,R-6,R-3,R-2,R-1);Xe(Fe[0]),Xe(Fe[1]),Xe(Fe[3]),Xe(Fe[1]),Xe(Fe[2]),Xe(Fe[3])}
vendor: 35,338 bytes, lines 1-5
1function ot($){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 Pp(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 ma[i.type]().fromJSON(i)),new Yl(n,e.options)}}const Ip={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],d=e[n*3+2],u=e[i*3],f=e[i*3+1],p=e[i*3+2],_=e[s*3],g=e[s*3+1],m=e[s*3+2];return Math.abs(o-h)<Math.abs(a-c)?[new K(a,1-l),new K(c,1-d),new K(u,1-p),new K(_,1-m)]:[new K(o,1-l),new K(h,1-d),new K(f,1-p),new K(g,1-m)]}};function Pp(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 Zl extends Pi{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 Zl(e.radius,e.detail)}}class Jl 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=Ve(i,0,Math.PI*2);const s=[],a=[],o=[],l=[],c=[],h=1/t,d=new C,u=new K,f=new C,p=new C,_=new C;let g=0,m=0;for(let x=0;x<=e.length-1;x++)switch(x){case 0:g=e[x+1].x-e[x].x,m=e[x+1].y-e[x].y,f.x=m*1,f.y=-g,f.z=m*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[x+1].x-e[x].x,m=e[x+1].y-e[x].y,f.x=m*1,f.y=-g,f.z=m*0,p.copy(f),f.x+=_.x,f.y+=_.y,f.z+=_.z,f.normalize(),l.push(f.x,f.y,f.z),_.copy(p)}for(let x=0;x<=t;x++){const y=n+x*h*i,M=Math.sin(y),E=Math.cos(y);for(let A=0;A<=e.length-1;A++){d.x=e[A].x*M,d.y=e[A].y,d.z=e[A].x*E,a.push(d.x,d.y,d.z),u.x=x/t,u.y=A/(e.length-1),o.push(u.x,u.y);const I=l[3*A+0]*M,v=l[3*A+1],b=l[3*A+0]*E;c.push(I,v,b)}}for(let x=0;x<t;x++)for(let y=0;y<e.length-1;y++){const M=y+x*e.length,E=M,A=M+e.length,I=M+e.length+1,v=M+1;s.push(E,A,v),s.push(I,v,A)}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 Jl(e.points,e.segments,e.phiStart,e.phiLength)}}class Aa extends Pi{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 Aa(e.radius,e.detail)}}class er 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,d=e/o,u=t/l,f=[],p=[],_=[],g=[];for(let m=0;m<h;m++){const x=m*u-a;for(let y=0;y<c;y++){const M=y*d-s;p.push(M,-x,0),_.push(0,0,1),g.push(y/o),g.push(1-m/l)}}for(let m=0;m<l;m++)for(let x=0;x<o;x++){const y=x+c*m,M=x+c*(m+1),E=x+1+c*(m+1),A=x+1+c*m;f.push(y,M,A),f.push(M,E,A)}this.setIndex(f),this.setAttribute("position",new Te(p,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 er(e.width,e.height,e.widthSegments,e.heightSegments)}}class $l 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 d=e;const u=(t-e)/i,f=new C,p=new K;for(let _=0;_<=i;_++){for(let g=0;g<=n;g++){const m=s+g/n*a;f.x=d*Math.cos(m),f.y=d*Math.sin(m),l.push(f.x,f.y,f.z),c.push(0,0,1),p.x=(f.x/t+1)/2,p.y=(f.y/t+1)/2,h.push(p.x,p.y)}d+=u}for(let _=0;_<i;_++){const g=_*(n+1);for(let m=0;m<n;m++){const x=m+g,y=x,M=x+n+1,E=x+n+2,A=x+1;o.push(y,M,A),o.push(M,E,A)}}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 $l(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Kl extends qe{constructor(e=new ls([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 d=i.length/3,u=h.extractPoints(t);let f=u.shape;const p=u.holes;yn.isClockWise(f)===!1&&(f=f.reverse());for(let g=0,m=p.length;g<m;g++){const x=p[g];yn.isClockWise(x)===!0&&(p[g]=x.reverse())}const _=yn.triangulateShape(f,p);for(let g=0,m=p.length;g<m;g++){const x=p[g];f=f.concat(x)}for(let g=0,m=f.length;g<m;g++){const x=f[g];i.push(x.x,x.y,0),s.push(0,0,1),a.push(x.x,x.y)}for(let g=0,m=_.length;g<m;g++){const x=_[g],y=x[0]+d,M=x[1]+d,E=x[2]+d;n.push(y,M,E),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 Lp(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 Kl(n,e.curveSegments)}}function Lp(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 Ea 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=[],d=new C,u=new C,f=[],p=[],_=[],g=[];for(let m=0;m<=n;m++){const x=[],y=m/n;let M=0;m===0&&a===0?M=.5/t:m===n&&l===Math.PI&&(M=-.5/t);for(let E=0;E<=t;E++){const A=E/t;d.x=-e*Math.cos(i+A*s)*Math.sin(a+y*o),d.y=e*Math.cos(a+y*o),d.z=e*Math.sin(i+A*s)*Math.sin(a+y*o),p.push(d.x,d.y,d.z),u.copy(d).normalize(),_.push(u.x,u.y,u.z),g.push(A+M,1-y),x.push(c++)}h.push(x)}for(let m=0;m<n;m++)for(let x=0;x<t;x++){const y=h[m][x+1],M=h[m][x],E=h[m+1][x],A=h[m+1][x+1];(m!==0||a>0)&&f.push(y,M,A),(m!==n-1||l<Math.PI)&&f.push(M,E,A)}this.setIndex(f),this.setAttribute("position",new Te(p,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 Ea(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Ql extends Pi{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 Ql(e.radius,e.detail)}}class jl extends qe{constructor(e=1,t=.4,n=12,i=48,s=Math.PI*2,a=0,o=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:s,thetaStart:a,thetaLength:o},n=Math.floor(n),i=Math.floor(i);const l=[],c=[],h=[],d=[],u=new C,f=new C,p=new C;for(let _=0;_<=n;_++){const g=a+_/n*o;for(let m=0;m<=i;m++){const x=m/i*s;f.x=(e+t*Math.cos(g))*Math.cos(x),f.y=(e+t*Math.cos(g))*Math.sin(x),f.z=t*Math.sin(g),c.push(f.x,f.y,f.z),u.x=e*Math.cos(x),u.y=e*Math.sin(x),p.subVectors(f,u).normalize(),h.push(p.x,p.y,p.z),d.push(m/i),d.push(_/n)}}for(let _=1;_<=n;_++)for(let g=1;g<=i;g++){const m=(i+1)*_+g-1,x=(i+1)*(_-1)+g-1,y=(i+1)*(_-1)+g,M=(i+1)*_+g;l.push(m,x,M),l.push(x,y,M)}this.setIndex(l),this.setAttribute("position",new Te(c,3)),this.setAttribute("normal",new Te(h,3)),this.setAttribute("uv",new Te(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new jl(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class ec 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=[],d=new C,u=new C,f=new C,p=new C,_=new C,g=new C,m=new C;for(let y=0;y<=n;++y){const M=y/n*s*Math.PI*2;x(M,s,a,e,f),x(M+.01,s,a,e,p),g.subVectors(p,f),m.addVectors(p,f),_.crossVectors(g,m),m.crossVectors(_,g),_.normalize(),m.normalize();for(let E=0;E<=i;++E){const A=E/i*Math.PI*2,I=-t*Math.cos(A),v=t*Math.sin(A);d.x=f.x+(I*m.x+v*_.x),d.y=f.y+(I*m.y+v*_.y),d.z=f.z+(I*m.z+v*_.z),l.push(d.x,d.y,d.z),u.subVectors(d,f).normalize(),c.push(u.x,u.y,u.z),h.push(y/n),h.push(E/i)}}for(let y=1;y<=n;y++)for(let M=1;M<=i;M++){const E=(i+1)*(y-1)+(M-1),A=(i+1)*y+(M-1),I=(i+1)*y+M,v=(i+1)*(y-1)+M;o.push(E,A,v),o.push(A,I,v)}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 x(y,M,E,A,I){const v=Math.cos(y),b=Math.sin(y),L=E/M*y,P=Math.cos(L);I.x=A*(2+P)*.5*v,I.y=A*(2+P)*b*.5,I.z=A*Math.sin(L)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ec(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class tc extends qe{constructor(e=new Pu(new C(-1,-1,0),new C(-1,1,0),new C(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 C,l=new C,c=new K;let h=new C;const d=[],u=[],f=[],p=[];_(),this.setIndex(p),this.setAttribute("position",new Te(d,3)),this.setAttribute("normal",new Te(u,3)),this.setAttribute("uv",new Te(f,2));function _(){for(let y=0;y<t;y++)g(y);g(s===!1?t:0),x(),m()}function g(y){h=e.getPointAt(y/t,h);const M=a.normals[y],E=a.binormals[y];for(let A=0;A<=i;A++){const I=A/i*Math.PI*2,v=Math.sin(I),b=-Math.cos(I);l.x=b*M.x+v*E.x,l.y=b*M.y+v*E.y,l.z=b*M.z+v*E.z,l.normalize(),u.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,d.push(o.x,o.y,o.z)}}function m(){for(let y=1;y<=t;y++)for(let M=1;M<=i;M++){const E=(i+1)*(y-1)+(M-1),A=(i+1)*y+(M-1),I=(i+1)*y+M,v=(i+1)*(y-1)+M;p.push(E,A,v),p.push(A,I,v)}}function x(){for(let y=0;y<=t;y++)for(let M=0;M<=i;M++)c.x=y/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 tc(new ma[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class Dp extends qe{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new C,s=new C;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 d=l[c],u=d.start,f=d.count;for(let p=u,_=u+f;p<_;p+=3)for(let g=0;g<3;g++){const m=o.getX(p+g),x=o.getX(p+(g+1)%3);i.fromBufferAttribute(a,m),s.fromBufferAttribute(a,x),hh(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,d=3*o+(c+1)%3;i.fromBufferAttribute(a,h),s.fromBufferAttribute(a,d),hh(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 hh(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 uh=Object.freeze({__proto__:null,BoxGeometry:_s,CapsuleGeometry:Gl,CircleGeometry:Hl,ConeGeometry:Ta,CylinderGeometry:ba,DodecahedronGeometry:Wl,EdgesGeometry:jf,ExtrudeGeometry:Yl,IcosahedronGeometry:Zl,LatheGeometry:Jl,OctahedronGeometry:Aa,PlaneGeometry:er,PolyhedronGeometry:Pi,RingGeometry:$l,ShapeGeometry:Kl,SphereGeometry:Ea,TetrahedronGeometry:Ql,TorusGeometry:jl,TorusKnotGeometry:ec,TubeGeometry:tc,WireframeGeometry:Dp});class Up extends zt{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}}function gs(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?(ue("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 Ft(r){const e={};for(let t=0;t<r.length;t++){const n=gs(r[t]);for(const i in n)e[i]=n[i]}return e}function Np(r){const e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function Ou(r){const e=r.getRenderTarget();return e===null?r.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:je.workingColorSpace}const Fp={clone:gs,merge:Ft};var Op=`void main() {
2	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3}`,Bp=`void main() {
4	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
5}`;class dn extends zt{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Op,this.fragmentShader=Bp,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=gs(e.uniforms),this.uniformsGroups=Np(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 Bu extends dn{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class zu extends zt{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=Ri,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 an,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 zp extends zu{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 Ve(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 Vp extends zt{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=Ri,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 an,this.combine=ya,this.reflectivity=1,this.envMapIntensity=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.envMapIntensity=e.envMapIntensity,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 kp extends zt{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=Ri,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 Gp extends zt{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ri,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 Hp extends zt{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=Ri,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 an,this.combine=ya,this.reflectivity=1,this.envMapIntensity=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.envMapIntensity=e.envMapIntensity,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 Vu extends zt{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Od,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 ku extends zt{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 Wp extends zt{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=Ri,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 Xp 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 Ti(r,e){return!r||r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function Gu(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 _l(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 nc(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 qp(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(),d=[],u=[];for(let f=0;f<c.times.length;++f){const p=c.times[f]*i;if(!(p<t||p>=n)){d.push(c.times[f]);for(let _=0;_<h;++_)u.push(c.values[f*h+_])}}d.length!==0&&(c.times=Ti(d,c.times.constructor),c.values=Ti(u,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 Yp(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(m){return m.name===o.name&&m.ValueTypeName===l});if(c===void 0)continue;let h=0;const d=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=d/3);let u=0;const f=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=f/3);const p=o.times.length-1;let _;if(s<=o.times[0]){const m=h,x=d-h;_=o.values.slice(m,x)}else if(s>=o.times[p]){const m=p*d+h,x=m+d-h;_=o.values.slice(m,x)}else{const m=o.createInterpolant(),x=h,y=d-h;m.evaluate(s),_=m.resultBuffer.slice(x,y)}l==="quaternion"&&new Xt().fromArray(_).normalize().conjugate().toArray(_);const g=c.times.length;for(let m=0;m<g;++m){const x=m*f+u;if(l==="quaternion")Xt.multiplyQuaternionsFlat(c.values,x,_,0,c.values,x);else{const y=f-u*2;for(let M=0;M<y;++M)c.values[x+M]-=_[M]}}}return r.blendMode=gu,r}class Wy{static convertArray(e,t){return Ti(e,t)}static isTypedArray(e){return _u(e)}static getKeyframeOrder(e){return Gu(e)}static sortedArray(e,t,n){return _l(e,t,n)}static flattenJSON(e,t,n,i){nc(e,t,n,i)}static subclip(e,t,n,i,s=30){return qp(e,t,n,i,s)}static makeClipAdditive(e,t=0,n=e,i=30){return Yp(e,t,n,i)}}class tr{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 Zp extends tr{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:is,endingEnd:is}}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 ss:s=e,o=2*t-n;break;case la: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 ss:a=e,l=2*n-t;break;case la: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,d=this._offsetNext,u=this._weightPrev,f=this._weightNext,p=(n-t)/(i-t),_=p*p,g=_*p,m=-u*g+2*u*_-u*p,x=(1+u)*g+(-1.5-2*u)*_+(-.5+u)*p+1,y=(-1-f)*g+(1.5+f)*_+.5*p,M=f*g-f*_;for(let E=0;E!==o;++E)s[E]=m*a[h+E]+x*a[c+E]+y*a[l+E]+M*a[d+E];return s}}class Hu extends tr{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),d=1-h;for(let u=0;u!==o;++u)s[u]=a[c+u]*d+a[l+u]*h;return s}}class Jp extends tr{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class $p extends tr{interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,h=this.settings||this.DefaultSettings_,d=h.inTangents,u=h.outTangents;if(!d||!u){const _=(n-t)/(i-t),g=1-_;for(let m=0;m!==o;++m)s[m]=a[c+m]*g+a[l+m]*_;return s}const f=o*2,p=e-1;for(let _=0;_!==o;
5++_){const g=a[c+_],m=a[l+_],x=p*f+_*2,y=u[x],M=u[x+1],E=e*f+_*2,A=d[E],I=d[E+1];let v=(n-t)/(i-t),b,L,P,N,O;for(let G=0;G<8;G++){b=v*v,L=b*v,P=1-v,N=P*P,O=N*P;const B=O*t+3*N*v*y+3*P*b*A+L*i-n;if(Math.abs(B)<1e-10)break;const V=3*N*(y-t)+6*P*v*(A-y)+3*b*(i-A);if(Math.abs(V)<1e-10)break;v=v-B/V,v=Math.max(0,Math.min(1,v))}s[_]=O*g+3*N*v*M+3*P*b*I+L*m}return s}}class fn{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=Ti(t,this.TimeBufferType),this.values=Ti(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:Ti(e.times,Array),values:Ti(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Jp(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Hu(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Zp(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){const t=new $p(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.settings=this.settings),t}setInterpolation(e){let t;switch(e){case oa:t=this.InterpolantFactoryMethodDiscrete;break;case dl:t=this.InterpolantFactoryMethodLinear;break;case Da:t=this.InterpolantFactoryMethodSmooth;break;case Sc:t=this.InterpolantFactoryMethodBezier;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 ue("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return oa;case this.InterpolantFactoryMethodLinear:return dl;case this.InterpolantFactoryMethodSmooth:return Da;case this.InterpolantFactoryMethodBezier:return Sc}}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&&_u(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()===Da,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 d=o*n,u=d-n,f=d+n;for(let p=0;p!==n;++p){const _=t[d+p];if(_!==t[u+p]||_!==t[f+p]){l=!0;break}}}if(l){if(o!==a){e[a]=e[o];const d=o*n,u=a*n;for(let f=0;f!==n;++f)t[u+f]=t[d+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}}fn.prototype.ValueTypeName="";fn.prototype.TimeBufferType=Float32Array;fn.prototype.ValueBufferType=Float32Array;fn.prototype.DefaultInterpolation=dl;class xs extends fn{constructor(e,t,n){super(e,t,n)}}xs.prototype.ValueTypeName="bool";xs.prototype.ValueBufferType=Array;xs.prototype.DefaultInterpolation=oa;xs.prototype.InterpolantFactoryMethodLinear=void 0;xs.prototype.InterpolantFactoryMethodSmooth=void 0;class Wu extends fn{constructor(e,t,n,i){super(e,t,n,i)}}Wu.prototype.ValueTypeName="color";class ga extends fn{constructor(e,t,n,i){super(e,t,n,i)}}ga.prototype.ValueTypeName="number";class Kp extends tr{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: 6,450 bytes, line 5
5c+=4)Xt.slerpFlat(s,0,a,c-o,a,c,l);return s}}class wa extends fn{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Kp(this.times,this.values,this.getValueSize(),e)}}wa.prototype.ValueTypeName="quaternion";wa.prototype.InterpolantFactoryMethodSmooth=void 0;class vs extends fn{constructor(e,t,n){super(e,t,n)}}vs.prototype.ValueTypeName="string";vs.prototype.ValueBufferType=Array;vs.prototype.DefaultInterpolation=oa;vs.prototype.InterpolantFactoryMethodLinear=void 0;vs.prototype.InterpolantFactoryMethodSmooth=void 0;class _a extends fn{constructor(e,t,n,i){super(e,t,n,i)}}_a.prototype.ValueTypeName="vector";class xa{constructor(e="",t=-1,n=[],i=Rl){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=en(),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(jp(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(fn.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=Gu(l);l=_l(l,1,h),c=_l(c,1,h),!i&&l[0]===0&&(l.push(s),c.push(c[0])),a.push(new ga(".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 d=h[1];let u=i[d];u||(i[d]=u=[]),u.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(ue("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return Le("AnimationClip: No animation in JSONLoader data."),null;const n=function(d,u,f,p,_){if(f.length!==0){const g=[],m=[];nc(f,g,m,p),g.length!==0&&_.push(new d(u,g,m))}},i=[],s=e.name||"default",a=e.fps||30,o=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let d=0;d<c.length;d++){const u=c[d].keys;if(!(!u||u.length===0))if(u[0].morphTargets){const f={};let p;for(p=0;p<u.length;p++)if(u[p].morphTargets)for(let _=0;_<u[p].morphTargets.length;_++)f[u[p].morphTargets[_]]=-1;for(const _ in f){const g=[],m=[];for(let x=0;x!==u[p].morphTargets.length;++x){const y=u[p];g.push(y.time),m.push(y.morphTarget===_?1:0)}i.push(new ga(".morphTargetInfluence["+_+"]",g,m))}l=f.length*a}else{const f=".bones["+t[d].name+"]";n(_a,f+".position",u,"pos",i),n(wa,f+".quaternion",u,"rot",i),n(_a,f+".scale",u,"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 ga;case"vector":case"vector2":case"vector3":case"vector4":return _a;case"color":return Wu;case"quaternion":return wa;case"bool":case"boolean":return xs;case"string":return vs}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function jp(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=[];nc(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&&(dh(r)||(this.files[r]=e))},get:function(r){if(this.enabled!==!1&&!dh(r))return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};function dh(r){try{const e=r.slice(r.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}class Xu{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,d){return c.push(h,d),this},this.removeHandler=function(h){const d=c.indexOf(h);return d!==-1&&c.splice(d,2),this},this.getHandler=function(h){for(let d=0,u=c.length;d<u;d+=2){const f=c[d],p=c[d+1];if(f.global&&(f.lastIndex=0),f.test(h))return p}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 em=new Xu;class tn{constructor(e){this.manager=e!==void 0?e:em,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}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}}tn.DEFAULT_MATERIAL_NAME="__DEFAULT";const Pn={};
5class tm extends Error{constructor(e,t){super(e),this.response=t}}class ni extends tn{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&&ue("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const h=Pn[e],d=c.body.getReader(),u=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),f=u?parseInt(u):0,p=f!==0;let _=0;const g=new ReadableStream({start(m){x();function x(){d.read().then(({done:y,value:M})=>{if(y)m.close();else{_+=M.byteLength;const E=new ProgressEvent("progress",{lengthComputable:p,loaded:_,total:f});for(let A=0,I=h.length;A<I;A++){const v=h[A];v.onProgress&&v.onProgress(E)}m.enqueue(M),x()}},y=>{m.error(y)})}}});return new Response(g)}else throw new tm(`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 d=/charset="?([^;"\s]*)"?/i.exec(o),u=d&&d[1]?d[1].toLowerCase():void 0,f=new TextDecoder(u);return c.arrayBuffer().then(p=>f.decode(p))}}}).then(c=>{Nn.add(`file:${e}`,c);const h=Pn[e];delete Pn[e];for(let d=0,u=h.length;d<u;d++){const f=h[d];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 d=0,u=h.length;d<u;d++){const f=h[d];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 Xy extends tn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new ni(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=xa.parse(e[n]);t.push(i)}return t}}class qy extends tn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=[],o=new kl,l=new ni(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function h(d){l.load(e[d],function(u){const f=s.parse(u,!0);a[d]={width:f.width,height:f.height,format:f.format,mipmaps:f.mipmaps},c+=1,c===6&&(f.mipmapCount===1&&(o.minFilter=pt),o.image=a,o.format=f.format,o.needsUpdate=!0,t&&t(o))},n,i)}if(Array.isArray(e))for(let d=0,u=e.length;d<u;++d)h(d);else l.load(e,function(d){const u=s.parse(d,!0);if(u.isCubemap){const f=u.mipmaps.length/u.mipmapCount;for(let p=0;p<f;p++){a[p]={mipmaps:[]};for(let _=0;_<u.mipmapCount;_++)a[p].mipmaps.push(u.mipmaps[p*u.mipmapCount+_]),a[p].format=u.format,a[p].width=u.width,a[p].height=u.height}o.image=a}else o.image.width=u.width,o.image.height=u.height,o.mipmaps=u.mipmaps;u.mipmapCount===1&&(o.minFilter=pt),o.format=u.format,o.needsUpdate=!0,t&&t(o)},n,i);return o}}const Ki=new WeakMap;class va extends tn{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 d=Ki.get(a);d===void 0&&(d=[],Ki.set(a,d)),d.push({onLoad:t,onError:i})}return a}const o=Xs("img");function l(){h(),t&&t(this);const d=Ki.get(this)||[];for(let u=0;u<d.length;u++){const f=d[u];f.onLoad&&f.onLoad(this)}Ki.delete(this),s.manager.itemEnd(e)}function c(d){h(),i&&i(d),Nn.remove(`image:${e}`);const u=Ki.get(this)||[];for(let f=0;f<u.length;f++){const p=u[f];p.onError&&p.onError(d)}Ki.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 Yy extends tn{constructor(e){super(e)}load(e,t,n,i){const s=new Sa;
vendor: 5,916 bytes, line 5
5s.colorSpace=$t;const a=new va(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 Zy extends tn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new Sn,o=new ni(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:jt,a.wrapT=c.wrapT!==void 0?c.wrapT:jt,a.magFilter=c.magFilter!==void 0?c.magFilter:pt,a.minFilter=c.minFilter!==void 0?c.minFilter:pt,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=pt),c.generateMipmaps!==void 0&&(a.generateMipmaps=c.generateMipmaps),a.needsUpdate=!0,t&&t(a,c)},n,i),a}}class Jy extends tn{constructor(e){super(e)}load(e,t,n,i){const s=new yt,a=new va(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 Li 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 nm extends Li{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 fo=new He,fh=new C,ph=new C;class ic{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new K(512,512),this.mapType=Kt,this.map=null,this.mapPass=null,this.matrix=new He,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new js,this._frameExtents=new K(1,1),this._viewportCount=1,this._viewports=[new ft(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;fh.setFromMatrixPosition(e.matrixWorld),t.position.copy(fh),ph.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(ph),t.updateMatrixWorld(),fo.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(fo,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===ds||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(fo)}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.biasNode=e.biasNode,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}}const zr=new C,Vr=new Xt,_n=new C;class sc extends nt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new He,this.projectionMatrix=new He,this.projectionMatrixInverse=new He,this.coordinateSystem=sn,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.matrixWorld.decompose(zr,Vr,_n),_n.x===1&&_n.y===1&&_n.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(zr,Vr,_n.set(1,1,1)).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorld.decompose(zr,Vr,_n),_n.x===1&&_n.y===1&&_n.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(zr,Vr,_n.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const $n=new C,mh=new K,gh=new K;class Dt extends sc{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=fs*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Ai*.5*this.fov);return .5*this.getFilmHeight()/e}
vendor: 4,977 bytes, line 5
5getEffectiveFOV(){return fs*2*Math.atan(Math.tan(Ai*.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){$n.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set($n.x,$n.y).multiplyScalar(-e/$n.z),$n.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set($n.x,$n.y).multiplyScalar(-e/$n.z)}getViewSize(e,t){return this.getViewBounds(e,mh,gh),t.subVectors(gh,mh)}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(Ai*.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}}class im extends ic{constructor(){super(new Dt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=fs*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 sm extends Li{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 im}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 rm extends ic{constructor(){super(new Dt(90,1,.5,500)),this.isPointLightShadow=!0}}class am extends Li{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 rm}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 Ca extends sc{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}
vendor: 19,120 bytes, line 5
5this.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 om extends ic{constructor(){super(new Ca(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class lm extends Li{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 om}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 cm extends Li{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class hm extends Li{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 qu{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new C)}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 um extends Li{constructor(e=new qu,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 rc extends tn{constructor(e){super(e),this.textures={}}load(e,t,n,i){const s=this,a=new ni(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&&ue("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 C().fromArray(a.value);break;case"v4":i.uniforms[s].value=new ft().fromArray(a.value);break;case"m3":i.uniforms[s].value=new Ze().fromArray(a.value);break;case"m4":i.uniforms[s].value=new He().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 rc.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:Up,SpriteMaterial:bu,RawShaderMaterial:Bu,ShaderMaterial:dn,PointsMaterial:Eu,MeshPhysicalMaterial:zp,MeshStandardMaterial:zu,MeshPhongMaterial:Vp,MeshToonMaterial:kp,MeshNormalMaterial:Gp,MeshLambertMaterial:Hp,MeshDepthMaterial:Vu,MeshDistanceMaterial:ku,MeshBasicMaterial:Ii,MeshMatcapMaterial:Wp,LineDashedMaterial:Xp,LineBasicMaterial:qt,Material:zt};return new t[e]}}class _h{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 dm 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 fm extends tn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new ni(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,p){if(t[p]!==void 0)return t[p];const g=f.interleavedBuffers[p],m=s(f,g.buffer),x=rs(g.type,m),y=new Bl(x,g.stride);return y.uuid=g.uuid,t[p]=y,y}function s(f,p){if(n[p]!==void 0)return n[p];const g=f.arrayBuffers[p],m=new Uint32Array(g).buffer;return n[p]=m,m}const a=e.isInstancedBufferGeometry?new dm:new qe,o=e.data.index;if(o!==void 0){const f=rs(o.type,o.array);a.setIndex(new ut(f,1))}const l=e.data.attributes;for(const f in l){const p=l[f];let _;if(p.isInterleavedBufferAttribute){const g=i(e.data,p.data);_=new ps(g,p.itemSize,p.offset,p.normalized)}else{const g=rs(p.type,p.array),m=p.isInstancedBufferAttribute?qs:ut;_=new m(g,p.itemSize,p.normalized)}p.name!==void 0&&(_.name=p.name),p.usage!==void 0&&_.setUsage(p.usage),a.setAttribute(f,_)}const c=e.data.morphAttributes;if(c)for(const f in c){const p=c[f],_=[];for(let g=0,m=p.length;g<m;g++){const x=p[g];let y;if(x.isInterleavedBufferAttribute){const M=i(e.data,x.data);y=new ps(M,x.itemSize,x.offset,x.normalized)}else{const M=rs(x.type,x.array);y=new ut(M,x.itemSize,x.normalized)}x.name!==void 0&&(y.name=x.name),_.push(y)}a.morphAttributes[f]=_}e.data.morphTargetsRelative&&(a.morphTargetsRelative=!0);const d=e.data.groups||e.data.drawcalls||e.data.offsets;if(d!==void 0)for(let f=0,p=d.length;f!==p;++f){const _=d[f];a.addGroup(_.start,_.count,_.materialIndex)}const u=e.data.boundingSphere;return u!==void 0&&(a.boundingSphere=new Ut().fromJSON(u)),e.name&&(a.name=e.name),e.userData&&(a.userData=e.userData),a}}class $y extends tn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=this.path===""?_h.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;const o=new ni(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(d){i!==void 0&&i(d),d("ObjectLoader: Can't parse "+e+".",d.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===""?_h.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new ni(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const a=await s.loadAsync(e,t);let o;try{o=JSON.parse(a)}catch(c){throw new Error("ObjectLoader: Can't parse "+e+". "+c.message)}const 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 d=!1;for(const u in a)if(a[u].data instanceof HTMLImageElement){d=!0;break}d===!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 ls().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 zl().fromJSON(e[s],i);n[o.uuid]=o}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new fm;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 uh?o=uh[l.type].fromJSON(l,t):ue(`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 rc;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=xa.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:rs(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new Xu(t);s=new va(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,h=e.length;c<h;c++){const d=e[c],u=d.url;if(Array.isArray(u)){const f=[];for(let p=0,_=u.length;p<_;p++){const g=u[p],m=o(g);m!==null&&(m instanceof HTMLImageElement?f.push(m):f.push(new Sn(m.data,m.width,m.height)))}i[d.uuid]=new bi(f)}else{const f=o(d.url);i[d.uuid]=new bi(f)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;
5async 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:rs(a.type,a.data),width:a.width,height:a.height}:null}if(e!==void 0&&e.length>0){i=new va(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 d=0,u=c.length;d<u;d++){const f=c[d],p=await s(f);p!==null&&(p instanceof HTMLImageElement?h.push(p):h.push(new Sn(p.data,p.width,p.height)))}n[l.uuid]=new bi(h)}else{const h=await s(l.url);n[l.uuid]=new bi(h)}}}return n}parseTextures(e,t){function n(s,a){return typeof s=="number"?s:(ue("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&&ue('ObjectLoader: No "image" specified for',o.uuid),t[o.image]===void 0&&ue("ObjectLoader: Undefined image",o.image);const l=t[o.image],c=l.data;let h;Array.isArray(c)?(h=new Sa,c.length===6&&(h.needsUpdate=!0)):(c&&c.data?h=new Sn:h=new yt,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,pm)),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],xh),h.wrapT=n(o.wrap[1],xh)),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,497 bytes, line 5
5=o.colorSpace),o.minFilter!==void 0&&(h.minFilter=n(o.minFilter,vh)),o.magFilter!==void 0&&(h.magFilter=n(o.magFilter,vh)),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(u){return t[u]===void 0&&ue("ObjectLoader: Undefined geometry",u),t[u]}function l(u){if(u!==void 0){if(Array.isArray(u)){const f=[];for(let p=0,_=u.length;p<_;p++){const g=u[p];n[g]===void 0&&ue("ObjectLoader: Undefined material",g),f.push(n[g])}return f}return n[u]===void 0&&ue("ObjectLoader: Undefined material",u),n[u]}}function c(u){return i[u]===void 0&&ue("ObjectLoader: Undefined texture",u),i[u]}let h,d;switch(e.type){case"Scene":a=new Tf,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 Ol(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(a.fog=new Fl(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 Dt(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 Ca(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 cm(e.color,e.intensity);break;case"DirectionalLight":a=new lm(e.color,e.intensity),a.target=e.target||"";break;case"PointLight":a=new am(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new hm(e.color,e.intensity,e.width,e.height);break;case"SpotLight":a=new sm(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),a.target=e.target||"";break;case"HemisphereLight":a=new nm(e.color,e.groundColor,e.intensity);break;case"LightProbe":const u=new qu().fromArray(e.sh);a=new um(u,e.intensity);break;case"SkinnedMesh":h=o(e.geometry),d=l(e.material),a=new Uf(h,d),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),d=l(e.material),a=new bt(h,d);break;case"InstancedMesh":h=o(e.geometry),d=l(e.material);const f=e.count,p=e.instanceMatrix,_=e.instanceColor;a=new Of(h,d,f),a.instanceMatrix=new qs(new Float32Array(p.array),16),_!==void 0&&(a.instanceColor=new qs(new Float32Array(_.array),_.itemSize));break;case"BatchedMesh":h=o(e.geometry),d=l(e.material),a=new Zf(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,d),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 m=null,x=null;return g.boundingBox!==void 0&&(m=new Bt().fromJSON(g.boundingBox)),g.boundingSphere!==void 0&&(x=new Ut().fromJSON(g.boundingSphere)),{...g,boundingBox:m,boundingSphere:x}}),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 Ut().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(a.boundingBox=new Bt().fromJSON(e.boundingBox));break;case"LOD":a=new Pf;break;case"Line":a=new wi(o(e.geometry),l(e.material));break;case"LineLoop":a=new Jf(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 $f(o(e.geometry),l(e.material));break;case"Sprite":a=new If(l(e.material));break;case"Group":a=new Fs;break;case"Bone":a=new Au;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.pivot!==void 0&&(a.pivot=new C().fromArray(e.pivot)),e.morphTargetDictionary!==void 0&&(a.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),e.morphTargetInfluences!==void 0&&(a.morphTargetInfluences=e.morphTargetInfluences.slice()),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.static!==void 0&&(a.static=e.static),e.userData!==void 0&&(a.userData=e.userData),e.layers!==void 0&&(a.layers.mask=e.layers
5),e.children!==void 0){const u=e.children;for(let f=0;f<u.length;f++)a.add(this.parseObject(u[f],t,n,i,s))}if(e.animations!==void 0){const u=e.animations;for(let f=0;f<u.length;f++){const p=u[f];a.animations.push(s[p])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(a.autoUpdate=e.autoUpdate);const u=e.levels;for(let f=0;f<u.length;f++){const p=u[f],_=a.getObjectByProperty("uuid",p.object);_!==void 0&&a.addLevel(_,p.distance,p.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?ue("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 pm={UVMapping:Sl,CubeReflectionMapping:Bn,CubeRefractionMapping:Ei,EquirectangularReflectionMapping:Kr,EquirectangularRefractionMapping:Qr,CubeUVReflectionMapping:Ks},xh={RepeatWrapping:ra,ClampToEdgeWrapping:jt,MirroredRepeatWrapping:aa},vh={NearestFilter:St,NearestMipmapNearestFilter:cu,NearestMipmapLinearFilter:Ns,LinearFilter:pt,LinearMipmapNearestFilter:jr,LinearMipmapLinearFilter:Un},po=new WeakMap;class Ky extends tn{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&ue("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&ue("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(po.has(a)===!0)i&&i(po.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),po.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 kr;class Yu{static getContext(){return kr===void 0&&(kr=new(window.AudioContext||window.webkitAudioContext)),kr}static setContext(e){kr=e}}class Qy extends tn{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new ni(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);Yu.getContext().decodeAudioData(c,function(d){t(d)}).catch(o)}catch(c){o(c)}},n,i);function o(l){i?i(l):Le(l),s.manager.itemError(e)}}}const yh=new He,Mh=new He,ui=new He;class jy{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Dt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Dt,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,ui.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,a=t.near*Math.tan(Ai*t.fov*.5)/t.zoom;let o,l;Mh.elements[12]=-i,yh.elements[12]=i,o=-a*t.aspect+s,l=a*t.aspect+s,ui.elements[0]=2*t.near/(l-o),ui.elements[8]=(l+o)/(l-o),this.cameraL.projectionMatrix.copy(ui),o=-a*t.aspect-s,l=a*t.aspect-s,ui.elements[0]=2*t.near/(l-o),ui.elements[8]=(l+o)/(l-o),this.cameraR.projectionMatrix.copy(ui)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Mh),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(yh)}}const Qi=-90,ji=1;class mm extends nt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Dt(Qi,ji,e,t);i.layers=this.layers,this.add(i);const s=new Dt(Qi,ji,e,t);s.layers=this.layers,this.add(s);const a=new Dt(Qi,ji,e,t);a.layers=this.layers,this.add(a);const o=new Dt(Qi,ji,e,t);o.layers=this.layers,this.add(o);const l=new Dt(Qi,ji,e,t);l.layers=this.layers,this.add(l);const c=new Dt(Qi,ji,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===sn)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===ds)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,d=e.getRenderTarget(),u=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;const _=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let g=!1;e.isWebGLRenderer===!0?g=e.state.buffers.depth.getReversed():g=e.reversedDepthBuffer,e.setRenderTarget(n,0,i),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,i),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,2,i),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,3,i),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,4,i),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),n.texture.generateMipmaps=_,e.setRenderTarget(n,5,i),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),e.setRenderTarget(d,u,f),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class gm extends Dt{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class _m{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=xm.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 xm(){this._document.hidden===!1&&this.reset()}const di=new C,mo=new Xt,vm=new C,fi=new C,pi=new C;class eM extends nt{constructor(){super(),this.type="AudioListener",this.context=Yu.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new _m}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),this._timer.update(
vendor: 4,318 bytes, line 5
5);const t=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(di,mo,vm),fi.set(0,0,-1).applyQuaternion(mo),pi.set(0,1,0).applyQuaternion(mo),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(di.x,n),t.positionY.linearRampToValueAtTime(di.y,n),t.positionZ.linearRampToValueAtTime(di.z,n),t.forwardX.linearRampToValueAtTime(fi.x,n),t.forwardY.linearRampToValueAtTime(fi.y,n),t.forwardZ.linearRampToValueAtTime(fi.z,n),t.upX.linearRampToValueAtTime(pi.x,n),t.upY.linearRampToValueAtTime(pi.y,n),t.upZ.linearRampToValueAtTime(pi.z,n)}else t.setPosition(di.x,di.y,di.z),t.setOrientation(fi.x,fi.y,fi.z,pi.x,pi.y,pi.z)}}class ym 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=!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){ue("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){ue("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){ue("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){ue("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){ue("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}
vendor: 9,301 bytes, line 5
5getLoop(){return this.hasPlaybackControl===!1?(ue("Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){ue("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"?(ue("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=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice(),this)}clone(e){return new this.constructor(this.listener).copy(this,e)}}const mi=new C,Sh=new Xt,Mm=new C,gi=new C;class tM extends ym{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(mi,Sh,Mm),gi.set(0,0,1).applyQuaternion(Sh);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(mi.x,n),t.positionY.linearRampToValueAtTime(mi.y,n),t.positionZ.linearRampToValueAtTime(mi.z,n),t.orientationX.linearRampToValueAtTime(gi.x,n),t.orientationY.linearRampToValueAtTime(gi.y,n),t.orientationZ.linearRampToValueAtTime(gi.z,n)}else t.setPosition(mi.x,mi.y,mi.z),t.setOrientation(gi.x,gi.y,gi.z)}}class nM{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 Sm{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){Xt.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const a=this._workIndex*s;Xt.multiplyQuaternionsFlat(e,a,e,t,e,n),Xt.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 ac="\\[\\]\\.:\\/",bm=new RegExp("["+ac+"]","g"),oc="[^"+ac+"]",Tm="[^"+ac.replace("\\.","")+"]",Am=/((?:WC+[\/:])*)/.source.replace("WC",oc),Em=/(WCOD+)?/.source.replace("WCOD",Tm),wm=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",oc),Cm=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",oc),Rm=new RegExp("^"+Am+Em+wm+Cm+"$"),Im=["material","materials","bones","map"];class Pm{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(bm,"")}static parseTrackName(e){const t=Rm.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);Im.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}
5_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){ue("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=Pm;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 iM{constructor(){this.isAnimationObjectGroup=!0,this.uuid=en(),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,d=arguments.length;h!==d;++h){const u=arguments[h],f=u.uuid;let p=t[f];if(p===void 0){p=l++,t[f]=p,e.push(u);for(let _=0,g=a;_!==g;++_)s[_].push(new tt(u,n[_],i[_]))}else if(p<c){o=e[p];const _=--c,g=e[_];t[g.uuid]=p,e[p]=g,t[f]=_,e[_]=u;for(let m=0,x=a;
vendor: 15,546 bytes, line 5
5m!==x;++m){const y=s[m],M=y[_];let E=y[p];y[p]=M,E===void 0&&(E=new tt(u,n[m],i[m])),y[_]=E}}else e[p]!==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 d=s++,u=e[d];t[u.uuid]=h,e[h]=u,t[c]=d,e[d]=l;for(let f=0,p=i;f!==p;++f){const _=n[f],g=_[d],m=_[h];_[h]=g,_[d]=m}}}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,d=t[h];if(d!==void 0)if(delete t[h],d<s){const u=--s,f=e[u],p=--a,_=e[p];t[f.uuid]=d,e[d]=f,t[_.uuid]=u,e[u]=_,e.pop();for(let g=0,m=i;g!==m;++g){const x=n[g],y=x[u],M=x[p];x[d]=y,x[u]=M,x.pop()}}else{const u=--a,f=e[u];u>0&&(t[f.uuid]=d),e[d]=f,e.pop();for(let p=0,_=i;p!==_;++p){const g=n[p];g[d]=g[u],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_,d=new Array(c);i=s.length,n[e]=i,a.push(e),o.push(t),s.push(d);for(let u=h,f=l.length;u!==f;++u){const p=l[u];d[u]=new tt(p,e,t)}return d}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 Lm{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:is,endingEnd:is};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=Nd,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 gu:for(let h=0,d=l.length;h!==d;++h)l[h].evaluate(a),c[h].accumulateAdditive(o);break;case Rl:default:for(let h=0,d=l.length;h!==d;++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===Fd;if(e===0)return s===-1?i:a&&(s&1)===1?t-i:i;if(n===Ud){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=ss,i.endingEnd=ss):(e?i.endingStart=this.zeroSlopeAtStart?ss:is:i.endingStart=la,t?i.endingEnd=this.zeroSlopeAtEnd?ss:is:i.endingEnd=la)}_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 Dm=new Float32Array(1);class sM extends kn{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_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 d=0;d!==s;++d){const u=i[d],f=u.name;let p=h[f];if(p!==void 0)++p.referenceCount,a[d]=p;else{if(p=a[d],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,l,f));continue}const _=t&&t._propertyBindings[d].binding.parsedPath;p=new Sm(tt.create(n,f,_),u.ValueTypeName,u.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,l,f),a[d]=p}o[d].resultBuffer=p.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 d=o.actionByRoot,u=(e._localRoot||this._root).uuid;delete d[u],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 Hu(new Float32Array(2),new Float32Array(2),1,Dm),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"?xa.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=Rl),l!==void 0){const d=l.actionByRoot[s];if(d!==void 0&&d.blendMode===n)return d;c=l.knownActions[0],a===null&&(a=c._clip)}if(a===null)return null;const h=new Lm(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"?xa.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,d=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,d._cacheIndex=h,t[h]=d,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 rM extends vu{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isRenderTarget3D=!0,this.depth=n,this.texture=new Ul(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class Zu{constructor(e){this.value=e}clone(){return new Zu(this.value.clone===void 0?this.value:this.value.clone())}}let Um=0;class aM extends kn{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:Um++}),this.name="",this.usage=ha,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 oM extends Bl{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 lM{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 bh=new He;class cM{constructor(e,t,n=0,i=1/0){this.ray=new Qs(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new Nl,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: 
5Unsupported camera type: "+t.type)}setFromXRController(e){return bh.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(bh),this}intersectObject(e,t=!0,n=[]){return xl(e,this,n,t),n.sort(Th),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i<s;i++)xl(e[i],this,n,t);return n.sort(Th),n}}function Th(r,e){return r.distance-e.distance}function xl(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++)xl(s[a],e,t,!0)}}class hM{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,ue("THREE.Clock: This module has been deprecated. Please use THREE.Timer instead.")}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}}class uM{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=Ve(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(Ve(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class dM{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 Ju{constructor(e,t,n,i){Ju.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 Ah=new K;class fM{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=Ah.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,Ah).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 Eh=new C,Gr=new C,es=new C,ts=new C,go=new C,Nm=new C,Fm=new C;class pM{constructor(e=new C,t=new C){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)}closestPointToPointParameter(e,t){Eh.subVectors(e,this.start),Gr.subVectors(this.end,this.start);const n=Gr.dot(Gr);let s=Gr.dot(Eh)/n;return t&&(s=Ve(s,0,1)),s}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}
5distanceSqToLine3(e,t=Nm,n=Fm){const i=10000000000000001e-32;let s,a;const o=this.start,l=e.start,c=this.end,h=e.end;es.subVectors(c,o),ts.subVectors(h,l),go.subVectors(o,l);const d=es.dot(es),u=ts.dot(ts),f=ts.dot(go);if(d<=i&&u<=i)return t.copy(o),n.copy(l),t.sub(n),t.dot(t);if(d<=i)s=0,a=f/u,a=Ve(a,0,1);else{const p=es.dot(go);if(u<=i)a=0,s=Ve(-p/d,0,1);else{const _=es.dot(ts),g=d*u-_*_;g!==0?s=Ve((_*f-p*u)/g,0,1):s=0,a=(_*s+f)/u,a<0?(a=0,s=Ve(-p/d,0,1)):a>1&&(a=1,s=Ve((_-p)/d,0,1))}}return t.copy(o).addScaledVector(es,s),n.copy(l).addScaledVector(ts,a),t.distanceToSquared(n)}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 wh=new C;class mM 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),wh.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(wh),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Kn=new C,Hr=new He,_o=new He;class gM extends Gn{constructor(e){const t=$u(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");_o.copy(this.root.matrixWorld).invert();for(let s=0,a=0;s<t.length;s++){const o=t[s];o.parent&&o.parent.isBone&&(Hr.multiplyMatrices(_o,o.matrixWorld),Kn.setFromMatrixPosition(Hr),i.setXYZ(a,Kn.x,Kn.y,Kn.z),Hr.multiplyMatrices(_o,o.parent.matrixWorld),Kn.setFromMatrixPosition(Hr),i.setXYZ(a+1,Kn.x,Kn.y,Kn.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 $u(r){const e=[];r.isBone===!0&&e.push(r);for(let t=0;t<r.children.length;t++)e.push(...$u(r.children[t]));return e}class _M extends bt{constructor(e,t,n){const i=new Ea(t,4,2),s=new Ii({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 Om=new C,Ch=new Me,Rh=new Me;class xM 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 Aa(t);i.rotateY(Math.PI*.5),this.material=new Ii({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 bt(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");Ch.copy(this.light.color),Rh.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const s=n<i/2?Ch:Rh;t.setXYZ(n,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(Om.setFromMatrixPosition(this.light.matrixWorld).negate())}}class vM 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 u=0,f=0,p=-o;u<=t;
vendor: 2,839 bytes, line 5
5u++,p+=a){l.push(-o,0,p,o,0,p),l.push(p,0,-o,p,0,o);const _=u===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 d=new qt({vertexColors:!0,toneMapped:!1});super(h,d),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class yM 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=[];if(t>1)for(let d=0;d<t;d++){const u=d/t*(Math.PI*2),f=Math.sin(u)*e,p=Math.cos(u)*e;o.push(0,0,0),o.push(f,0,p);const _=d&1?s:a;l.push(_.r,_.g,_.b),l.push(_.r,_.g,_.b)}for(let d=0;d<n;d++){const u=d&1?s:a,f=e-e/n*d;for(let p=0;p<i;p++){let _=p/i*(Math.PI*2),g=Math.sin(_)*f,m=Math.cos(_)*f;o.push(g,0,m),l.push(u.r,u.g,u.b),_=(p+1)/i*(Math.PI*2),g=Math.sin(_)*f,m=Math.cos(_)*f,o.push(g,0,m),l.push(u.r,u.g,u.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 Ih=new C,Wr=new C,Ph=new C;class MM 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 wi(i,s),this.add(this.lightPlane),i=new qe,i.setAttribute("position",new Te([0,0,0,0,0,1],3)),this.targetLine=new wi(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),Ih.setFromMatrixPosition(this.light.matrixWorld),Wr.setFromMatrixPosition(this.light.target.matrixWorld),Ph.subVectors(Wr,Ih),this.lightPlane.lookAt(Wr),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(Wr),this.targetLine.scale.z=Ph.length()}}const Xr=new C,_t=new sc;class SM 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(p,_){l(p),l(_)}
5function l(p){i.push(0,0,0),s.push(0,0,0),a[p]===void 0&&(a[p]=[]),a[p].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),d=new Me(43775),u=new Me(16777215),f=new Me(3355443);this.setColors(c,h,d,u,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(_t.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)s=1,a=0;else if(this.camera.coordinateSystem===sn)s=-1,a=1;else if(this.camera.coordinateSystem===ds)s=0,a=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);vt("c",t,e,_t,0,0,s),vt("t",t,e,_t,0,0,a),vt("n1",t,e,_t,-n,-i,s),vt("n2",t,e,_t,n,-i,s),vt("n3",t,e,_t,-n,i,s),vt("n4",t,e,_t,n,i,s),vt("f1",t,e,_t,-n,-i,a),vt("f2",t,e,_t,n,-i,a),vt("f3",t,e,_t,-n,i,a),vt("f4",t,e,_t,n,i,a),vt("u1",t,e,_t,n*.7,i*1.1,s),vt("u2",t,e,_t,-n*.7,i*1.1,s),vt("u3",t,e,_t,0,i*2,s),vt("cf1",t,e,_t,-n,0,a),vt("cf2",t,e,_t,n,0,a),vt("cf3",t,e,_t,0,-i,a),vt("cf4",t,e,_t,0,i,a),vt("cn1",t,e,_t,-n,0,s),vt("cn2",t,e,_t,n,0,s),vt("cn3",t,e,_t,0,-i,s),vt("cn4",t,e,_t,0,i,s),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function vt(r,e,t,n,i,s,a){Xr.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],Xr.x,Xr.y,Xr.z)}}const qr=new Bt;class bM 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(24),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&&qr.setFromObject(this.object),qr.isEmpty())return;const e=qr.min,t=qr.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 TM 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 AM extends wi{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 bt(l,new Ii({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 Lh=new C;let Yr,xo;class EM extends nt{constructor(e=new C(0,0,1),t=new C(0,0,0),n=1,i=16776960,s=n*.2,a=s*.2){super(),this.type="ArrowHelper",Yr===void 0&&(Yr=new qe,Yr.setAttribute("position",new Te([0,0,0,0,1,0],3)),xo=new Ta(.5,1,5,1),xo.translate(0,-.5,0)),this.position.copy(t),this.line=new wi(Yr,new qt({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new bt(xo,new Ii({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{Lh.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Lh,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 wM 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"}
vendor: 5,684 bytes, line 5
5setColors(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 CM{constructor(){this.type="ShapePath",this.color=new Me,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new pl,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(m){const x=[];for(let y=0,M=m.length;y<M;y++){const E=m[y],A=new ls;A.curves=E.curves,x.push(A)}return x}function n(m,x){const y=x.length;let M=!1;for(let E=y-1,A=0;A<y;E=A++){let I=x[E],v=x[A],b=v.x-I.x,L=v.y-I.y;if(Math.abs(L)>Number.EPSILON){if(L<0&&(I=x[A],b=-b,v=x[E],L=-L),m.y<I.y||m.y>v.y)continue;if(m.y===I.y){if(m.x===I.x)return!0}else{const P=L*(m.x-I.x)-b*(m.y-I.y);if(P===0)return!0;if(P<0)continue;M=!M}}else{if(m.y!==I.y)continue;if(v.x<=m.x&&m.x<=I.x||I.x<=m.x&&m.x<=v.x)return!0}}return M}const i=yn.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 ls,l.curves=o.curves,c.push(l),c;let h=!i(s[0].getPoints());h=e?!h:h;const d=[],u=[];let f=[],p=0,_;u[p]=void 0,f[p]=[];for(let m=0,x=s.length;m<x;m++)o=s[m],_=o.getPoints(),a=i(_),a=e?!a:a,a?(!h&&u[p]&&p++,u[p]={s:new ls,p:_},u[p].s.curves=o.curves,h&&p++,f[p]=[]):f[p].push({h:o,p:_[0]});if(!u[0])return t(s);if(u.length>1){let m=!1,x=0;for(let y=0,M=u.length;y<M;y++)d[y]=[];for(let y=0,M=u.length;y<M;y++){const E=f[y];for(let A=0;A<E.length;A++){const I=E[A];let v=!0;for(let b=0;b<u.length;b++)n(I.p,u[b].p)&&(y!==b&&x++,v?(v=!1,d[b].push(I)):m=!0);v&&d[y].push(I)}}x>0&&m===!1&&(f=d)}let g;for(let m=0,x=u.length;m<x;m++){l=u[m].s,c.push(l),g=f[m];for(let y=0,M=g.length;y<M;y++)l.holes.push(g[y].h)}return c}}class RM 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){ue("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function Bm(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 zm(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 Vm(r){return r.repeat.x=1,r.repeat.y=1,r.offset.x=0,r.offset.y=0,r}function vl(r,e,t,n){const i=km(n);switch(t){case pu:return r*e;case El:return r*e/i.components*i.byteLength;case Ma:return r*e/i.components*i.byteLength;case hs:return r*e*2/i.components*i.byteLength;case wl:return r*e*2/i.components*i.byteLength;case mu:return r*e*3/i.components*i.byteLength;case Ht:return r*e*4/i.components*i.byteLength;case Cl:return r*e*4/i.components*i.byteLength;case ea:case ta:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case na:case ia:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case No:case Oo:return Math.max(r,16)*Math.max(e,8)/4;case Uo:case Fo:return Math.max(r,8)*Math.max(e,8)/2;case Bo:case zo:case ko:case Go:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Vo:case Ho:case Wo:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Xo:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case qo:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case Yo:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case Zo:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case Jo:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case $o:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case Ko:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case Qo:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case jo:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case el:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case tl:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case nl:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case il:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case sl:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case rl:case al:case ol:return Math.ceil(r/4)*Math.ceil(e/4)*16;case ll:case cl:return Math.ceil(r/4)*Math.ceil(e/4)*8;case hl:case ul:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function km(r){switch(r){case Kt:case hu:return{byteLength:1,components:1};case Hs:case uu:case zn:return{byteLength:2,components:1};case Tl:case Al:return{byteLength:2,components:4};case un:case bl:case Gt:return{byteLength:4,components:1};case du:case fu:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}class IM{static contain(e,t){return Bm(e,t)}static cover(e,t){return zm(e,t)}static fill(e){return Vm(e)}static getByteLength(e,t,n,i){return vl(e,t,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"183"}}));typeof window<"u"&&(window.__THREE__?ue("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="
5183");function Ku(){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 Gm(r){const e=new WeakMap;function t(o,l){const c=o.array,h=o.usage,d=c.byteLength,u=r.createBuffer();r.bindBuffer(l,u),r.bufferData(l,c,h),o.onUploadCallback();let f;if(c instanceof Float32Array)f=r.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)f=r.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?f=r.HALF_FLOAT:f=r.UNSIGNED_SHORT;else if(c instanceof Int16Array)f=r.SHORT;else if(c instanceof Uint32Array)f=r.UNSIGNED_INT;else if(c instanceof Int32Array)f=r.INT;else if(c instanceof Int8Array)f=r.BYTE;else if(c instanceof Uint8Array)f=r.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)f=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:u,type:f,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:d}}function n(o,l,c){const h=l.array,d=l.updateRanges;if(r.bindBuffer(c,o),d.length===0)r.bufferSubData(c,0,h);else{d.sort((f,p)=>f.start-p.start);let u=0;for(let f=1;f<d.length;f++){const p=d[u],_=d[f];_.start<=p.start+p.count+1?p.count=Math.max(p.count,_.start+_.count-p.start):(++u,d[u]=_)}d.length=u+1;for(let f=0,p=d.length;f<p;f++){const _=d[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 Hm=`#ifdef USE_ALPHAHASH
6	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
7#endif`,Wm=`#ifdef USE_ALPHAHASH
8	const float ALPHA_HASH_SCALE = 0.05;
9	float hash2D( vec2 value ) {
10		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
11	}
12	float hash3D( vec3 value ) {
13		return hash2D( vec2( hash2D( value.xy ), value.z ) );
14	}
15	float getAlphaHashThreshold( vec3 position ) {
16		float maxDeriv = max(
17			length( dFdx( position.xyz ) ),
18			length( dFdy( position.xyz ) )
19		);
20		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
21		vec2 pixScales = vec2(
22			exp2( floor( log2( pixScale ) ) ),
23			exp2( ceil( log2( pixScale ) ) )
24		);
25		vec2 alpha = vec2(
26			hash3D( floor( pixScales.x * position.xyz ) ),
27			hash3D( floor( pixScales.y * position.xyz ) )
28		);
29		float lerpFactor = fract( log2( pixScale ) );
30		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
31		float a = min( lerpFactor, 1.0 - lerpFactor );
32		vec3 cases = vec3(
33			x * x / ( 2.0 * a * ( 1.0 - a ) ),
34			( x - 0.5 * a ) / ( 1.0 - a ),
35			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
36		);
37		float threshold = ( x < ( 1.0 - a ) )
38			? ( ( x < a ) ? cases.x : cases.y )
39			: cases.z;
40		return clamp( threshold , 1.0e-6, 1.0 );
41	}
42#endif`,Xm=`#ifdef USE_ALPHAMAP
43	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
44#endif`,qm=`#ifdef USE_ALPHAMAP
45	uniform sampler2D alphaMap;
46#endif`,Ym=`#ifdef USE_ALPHATEST
47	#ifdef ALPHA_TO_COVERAGE
48	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
49	if ( diffuseColor.a == 0.0 ) discard;
50	#else
51	if ( diffuseColor.a < alphaTest ) discard;
52	#endif
53#endif`,Zm=`#ifdef USE_ALPHATEST
54	uniform float alphaTest;
55#endif`,Jm=`#ifdef USE_AOMAP
56	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
57	reflectedLight.indirectDiffuse *= ambientOcclusion;
58	#if defined( USE_CLEARCOAT ) 
59		clearcoatSpecularIndirect *= ambientOcclusion;
60	#endif
61	#if defined( USE_SHEEN ) 
62		sheenSpecularIndirect *= ambientOcclusion;
63	#endif
64	#if defined( USE_ENVMAP ) && defined( STANDARD )
65		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
66		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
67	#endif
68#endif`,$m=`#ifdef USE_AOMAP
69	uniform sampler2D aoMap;
70	uniform float aoMapIntensity;
71#endif`,Km=`#ifdef USE_BATCHING
72	#if ! defined( GL_ANGLE_multi_draw )
73	#define gl_DrawID _gl_DrawID
74	uniform int _gl_DrawID;
75	#endif
76	uniform highp sampler2D batchingTexture;
77	uniform highp usampler2D batchingIdTexture;
78	mat4 getBatchingMatrix( const in float i ) {
79		int size = textureSize( batchingTexture, 0 ).x;
80		int j = int( i ) * 4;
81		int x = j % size;
82		int y = j / size;
83		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
84		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
85		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
86		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
87		return mat4( v1, v2, v3, v4 );
88	}
89	float getIndirectIndex( const in int i ) {
90		int size = textureSize( batchingIdTexture, 0 ).x;
91		int x = i % size;
92		int y = i / size;
93		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
94	}
95#endif
96#ifdef USE_BATCHING_COLOR
97	uniform sampler2D batchingColorTexture;
98	vec4 getBatchingColor( const in float i ) {
99		int size = textureSize( batchingColorTexture, 0 ).x;
100		int j = int( i );
101		int x = j % size;
102		int y = j / size;
103		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
104	}
105#endif`,Qm=`#ifdef USE_BATCHING
106	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
107#endif`,jm=`vec3 transformed = vec3( position );
108#ifdef USE_ALPHAHASH
109	vPosition = vec3( position );
110#endif`,eg=`vec3 objectNormal = vec3( normal );
111#ifdef USE_TANGENT
112	vec3 objectTangent = vec3( tangent.xyz );
113#endif`,tg=`float G_BlinnPhong_Implicit( ) {
114	return 0.25;
115}
116float D_BlinnPhong( const in float shininess, const in float dotNH ) {
117	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
118}
119vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
120	vec3 halfDir = normalize( lightDir + viewDir );
121	float dotNH = saturate( dot( normal, halfDir ) );
122	float dotVH = saturate( dot( viewDir, halfDir ) );
123	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
124	float G = G_BlinnPhong_Implicit( );
125	float D = D_BlinnPhong( shininess, dotNH );
126	return F * ( G * D );
127} // validated`,ng=`#ifdef USE_IRIDESCENCE
128	const mat3 XYZ_TO_REC709 = mat3(
129		 3.2404542, -0.9692660,  0.0556434,
130		-1.5371385,  1.8760108, -0.2040259,
131		-0.4985314,  0.0415560,  1.0572252
132	);
133	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
134		vec3 sqrtF0 = sqrt( fresnel0 );
135		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
136	}
137	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
138		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
139	}
140	float IorToFresnel0( float transmittedIor, float incidentIor ) {
141		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
142	}
143	vec3 evalSensitivity( float OPD, vec3 shift ) {
144		float phase = 2.0 * PI * OPD * 1.0e-9;
145		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
146		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
147		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
148		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
149		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 ) );
150		xyz /= 1.0685e-7;
151		vec3 rgb = XYZ_TO_REC709 * xyz;
152		return rgb;
153	}
154	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
155		vec3 I;
156		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
157		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
158		float cosTheta2Sq = 1.0 - sinTheta2Sq;
159		if ( cosTheta2Sq < 0.0 ) {
160			return vec3( 1.0 );
161		}
162		float cosTheta2 = sqrt( cosTheta2Sq );
163		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
164		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
165		float T121 = 1.0 - R12;
166		float phi12 = 0.0;
167		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
168		float phi21 = PI - phi12;
169		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
170		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
171		vec3 phi23 = vec3( 0.0 );
172		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
173		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
174		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
175		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
176		vec3 phi = vec3( phi21 ) + phi23;
177		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
178		vec3 r123 = sqrt( R123 );
179		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
180		vec3 C0 = R12 + Rs;
181		I = C0;
182		vec3 Cm = Rs - T121;
183		for ( int m = 1; m <= 2; ++ m ) {
184			Cm *= r123;
185			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
186			I += Cm * Sm;
187		}
188		return max( I, vec3( 0.0 ) );
189	}
190#endif`,ig=`#ifdef USE_BUMPMAP
191	uniform sampler2D bumpMap;
192	uniform float bumpScale;
193	vec2 dHdxy_fwd() {
194		vec2 dSTdx = dFdx( vBumpMapUv );
195		vec2 dSTdy = dFdy( vBumpMapUv );
196		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
197		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
198		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
199		return vec2( dBx, dBy );
200	}
201	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
202		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
203		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
204		vec3 vN = surf_norm;
205		vec3 R1 = cross( vSigmaY, vN );
206		vec3 R2 = cross( vN, vSigmaX );
207		float fDet = dot( vSigmaX, R1 ) * faceDirection;
208		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
209		return normalize( abs( fDet ) * surf_norm - vGrad );
210	}
211#endif`,sg=`#if NUM_CLIPPING_PLANES > 0
212	vec4 plane;
213	#ifdef ALPHA_TO_COVERAGE
214		float distanceToPlane, distanceGradient;
215		float clipOpacity = 1.0;
216		#pragma unroll_loop_start
217		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
218			plane = clippingPlanes[ i ];
219			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
220			distanceGradient = fwidth( distanceToPlane ) / 2.0;
221			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
222			if ( clipOpacity == 0.0 ) discard;
223		}
224		#pragma unroll_loop_end
225		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
226			float unionClipOpacity = 1.0;
227			#pragma unroll_loop_start
228			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
229				plane = clippingPlanes[ i ];
230				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
231				distanceGradient = fwidth( distanceToPlane ) / 2.0;
232				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
233			}
234			#pragma unroll_loop_end
235			clipOpacity *= 1.0 - unionClipOpacity;
236		#endif
237		diffuseColor.a *= clipOpacity;
238		if ( diffuseColor.a == 0.0 ) discard;
239	#else
240		#pragma unroll_loop_start
241		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
242			plane = clippingPlanes[ i ];
243			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
244		}
245		#pragma unroll_loop_end
246		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
247			bool clipped = true;
248			#pragma unroll_loop_start
249			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
250				plane = clippingPlanes[ i ];
251				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
252			}
253			#pragma unroll_loop_end
254			if ( clipped ) discard;
255		#endif
256	#endif
257#endif`,rg=`#if NUM_CLIPPING_PLANES > 0
258	varying vec3 vClipPosition;
259	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
260#endif`,ag=`#if NUM_CLIPPING_PLANES > 0
261	varying vec3 vClipPosition;
262#endif`,og=`#if NUM_CLIPPING_PLANES > 0
263	vClipPosition = - mvPosition.xyz;
264#endif`,lg=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
265	diffuseColor *= vColor;
266#endif`,cg=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
267	varying vec4 vColor;
268#endif`,hg=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
269	varying vec4 vColor;
270#endif`,ug=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
271	vColor = vec4( 1.0 );
272#endif
273#ifdef USE_COLOR_ALPHA
274	vColor *= color;
275#elif defined( USE_COLOR )
276	vColor.rgb *= color;
277#endif
278#ifdef USE_INSTANCING_COLOR
279	vColor.rgb *= instanceColor.rgb;
280#endif
281#ifdef USE_BATCHING_COLOR
282	vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
283#endif`,dg=`#define PI 3.141592653589793
284#define PI2 6.283185307179586
285#define PI_HALF 1.5707963267948966
286#define RECIPROCAL_PI 0.3183098861837907
287#define RECIPROCAL_PI2 0.15915494309189535
288#define EPSILON 1e-6
289#ifndef saturate
290#define saturate( a ) clamp( a, 0.0, 1.0 )
291#endif
292#define whiteComplement( a ) ( 1.0 - saturate( a ) )
293float pow2( const in float x ) { return x*x; }
294vec3 pow2( const in vec3 x ) { return x*x; }
295float pow3( const in float x ) { return x*x*x; }
296float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
297float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
298float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
299highp float rand( const in vec2 uv ) {
300	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
301	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
302	return fract( sin( sn ) * c );
303}
304#ifdef HIGH_PRECISION
305	float precisionSafeLength( vec3 v ) { return length( v ); }
306#else
307	float precisionSafeLength( vec3 v ) {
308		float maxComponent = max3( abs( v ) );
309		return length( v / maxComponent ) * maxComponent;
310	}
311#endif
312struct IncidentLight {
313	vec3 color;
314	vec3 direction;
315	bool visible;
316};
317struct ReflectedLight {
318	vec3 directDiffuse;
319	vec3 directSpecular;
320	vec3 indirectDiffuse;
321	vec3 indirectSpecular;
322};
323#ifdef USE_ALPHAHASH
324	varying vec3 vPosition;
325#endif
326vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
327	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
328}
329vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
330	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
331}
332bool isPerspectiveMatrix( mat4 m ) {
333	return m[ 2 ][ 3 ] == - 1.0;
334}
335vec2 equirectUv( in vec3 dir ) {
336	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
337	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
338	return vec2( u, v );
339}
340vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
341	return RECIPROCAL_PI * diffuseColor;
342}
343vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
344	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
345	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
346}
347float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
348	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
349	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
350} // validated`,fg=`#ifdef ENVMAP_TYPE_CUBE_UV
351	#define cubeUV_minMipLevel 4.0
352	#define cubeUV_minTileSize 16.0
353	float getFace( vec3 direction ) {
354		vec3 absDirection = abs( direction );
355		float face = - 1.0;
356		if ( absDirection.x > absDirection.z ) {
357			if ( absDirection.x > absDirection.y )
358				face = direction.x > 0.0 ? 0.0 : 3.0;
359			else
360				face = direction.y > 0.0 ? 1.0 : 4.0;
361		} else {
362			if ( absDirection.z > absDirection.y )
363				face = direction.z > 0.0 ? 2.0 : 5.0;
364			else
365				face = direction.y > 0.0 ? 1.0 : 4.0;
366		}
367		return face;
368	}
369	vec2 getUV( vec3 direction, float face ) {
370		vec2 uv;
371		if ( face == 0.0 ) {
372			uv = vec2( direction.z, direction.y ) / abs( direction.x );
373		} else if ( face == 1.0 ) {
374			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
375		} else if ( face == 2.0 ) {
376			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
377		} else if ( face == 3.0 ) {
378			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
379		} else if ( face == 4.0 ) {
380			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
381		} else {
382			uv = vec2( direction.x, direction.y ) / abs( direction.z );
383		}
384		return 0.5 * ( uv + 1.0 );
385	}
386	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
387		float face = getFace( direction );
388		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
389		mipInt = max( mipInt, cubeUV_minMipLevel );
390		float faceSize = exp2( mipInt );
391		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
392		if ( face > 2.0 ) {
393			uv.y += faceSize;
394			face -= 3.0;
395		}
396		uv.x += face * faceSize;
397		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
398		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
399		uv.x *= CUBEUV_TEXEL_WIDTH;
400		uv.y *= CUBEUV_TEXEL_HEIGHT;
401		#ifdef texture2DGradEXT
402			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
403		#else
404			return texture2D( envMap, uv ).rgb;
405		#endif
406	}
407	#define cubeUV_r0 1.0
408	#define cubeUV_m0 - 2.0
409	#define cubeUV_r1 0.8
410	#define cubeUV_m1 - 1.0
411	#define cubeUV_r4 0.4
412	#define cubeUV_m4 2.0
413	#define cubeUV_r5 0.305
414	#define cubeUV_m5 3.0
415	#define cubeUV_r6 0.21
416	#define cubeUV_m6 4.0
417	float roughnessToMip( float roughness ) {
418		float mip = 0.0;
419		if ( roughness >= cubeUV_r1 ) {
420			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
421		} else if ( roughness >= cubeUV_r4 ) {
422			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
423		} else if ( roughness >= cubeUV_r5 ) {
424			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
425		} else if ( roughness >= cubeUV_r6 ) {
426			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
427		} else {
428			mip = - 2.0 * log2( 1.16 * roughness );		}
429		return mip;
430	}
431	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
432		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
433		float mipF = fract( mip );
434		float mipInt = floor( mip );
435		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
436		if ( mipF == 0.0 ) {
437			return vec4( color0, 1.0 );
438		} else {
439			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
440			return vec4( mix( color0, color1, mipF ), 1.0 );
441		}
442	}
443#endif`,pg=`vec3 transformedNormal = objectNormal;
444#ifdef USE_TANGENT
445	vec3 transformedTangent = objectTangent;
446#endif
447#ifdef USE_BATCHING
448	mat3 bm = mat3( batchingMatrix );
449	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
450	transformedNormal = bm * transformedNormal;
451	#ifdef USE_TANGENT
452		transformedTangent = bm * transformedTangent;
453	#endif
454#endif
455#ifdef USE_INSTANCING
456	mat3 im = mat3( instanceMatrix );
457	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
458	transformedNormal = im * transformedNormal;
459	#ifdef USE_TANGENT
460		transformedTangent = im * transformedTangent;
461	#endif
462#endif
463transformedNormal = normalMatrix * transformedNormal;
464#ifdef FLIP_SIDED
465	transformedNormal = - transformedNormal;
466#endif
467#ifdef USE_TANGENT
468	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
469	#ifdef FLIP_SIDED
470		transformedTangent = - transformedTangent;
471	#endif
472#endif`,mg=`#ifdef USE_DISPLACEMENTMAP
473	uniform sampler2D displacementMap;
474	uniform float displacementScale;
475	uniform float displacementBias;
476#endif`,gg=`#ifdef USE_DISPLACEMENTMAP
477	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
477placementBias );
478#endif`,_g=`#ifdef USE_EMISSIVEMAP
479	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
480	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
481		emissiveColor = sRGBTransferEOTF( emissiveColor );
482	#endif
483	totalEmissiveRadiance *= emissiveColor.rgb;
484#endif`,xg=`#ifdef USE_EMISSIVEMAP
485	uniform sampler2D emissiveMap;
486#endif`,vg="gl_FragColor = linearToOutputTexel( gl_FragColor );",yg=`vec4 LinearTransferOETF( in vec4 value ) {
487	return value;
488}
489vec4 sRGBTransferEOTF( in vec4 value ) {
490	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 );
491}
492vec4 sRGBTransferOETF( in vec4 value ) {
493	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 );
494}`,Mg=`#ifdef USE_ENVMAP
495	#ifdef ENV_WORLDPOS
496		vec3 cameraToFrag;
497		if ( isOrthographic ) {
498			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
499		} else {
500			cameraToFrag = normalize( vWorldPosition - cameraPosition );
501		}
502		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
503		#ifdef ENVMAP_MODE_REFLECTION
504			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
505		#else
506			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
507		#endif
508	#else
509		vec3 reflectVec = vReflect;
510	#endif
511	#ifdef ENVMAP_TYPE_CUBE
512		vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
513		#ifdef ENVMAP_BLENDING_MULTIPLY
514			outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
515		#elif defined( ENVMAP_BLENDING_MIX )
516			outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
517		#elif defined( ENVMAP_BLENDING_ADD )
518			outgoingLight += envColor.xyz * specularStrength * reflectivity;
519		#endif
520	#endif
521#endif`,Sg=`#ifdef USE_ENVMAP
522	uniform float envMapIntensity;
523	uniform float flipEnvMap;
524	uniform mat3 envMapRotation;
525	#ifdef ENVMAP_TYPE_CUBE
526		uniform samplerCube envMap;
527	#else
528		uniform sampler2D envMap;
529	#endif
530#endif`,bg=`#ifdef USE_ENVMAP
531	uniform float reflectivity;
532	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
533		#define ENV_WORLDPOS
534	#endif
535	#ifdef ENV_WORLDPOS
536		varying vec3 vWorldPosition;
537		uniform float refractionRatio;
538	#else
539		varying vec3 vReflect;
540	#endif
541#endif`,Tg=`#ifdef USE_ENVMAP
542	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
543		#define ENV_WORLDPOS
544	#endif
545	#ifdef ENV_WORLDPOS
546		
547		varying vec3 vWorldPosition;
548	#else
549		varying vec3 vReflect;
550		uniform float refractionRatio;
551	#endif
552#endif`,Ag=`#ifdef USE_ENVMAP
553	#ifdef ENV_WORLDPOS
554		vWorldPosition = worldPosition.xyz;
555	#else
556		vec3 cameraToVertex;
557		if ( isOrthographic ) {
558			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
559		} else {
560			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
561		}
562		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
563		#ifdef ENVMAP_MODE_REFLECTION
564			vReflect = reflect( cameraToVertex, worldNormal );
565		#else
566			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
567		#endif
568	#endif
569#endif`,Eg=`#ifdef USE_FOG
570	vFogDepth = - mvPosition.z;
571#endif`,wg=`#ifdef USE_FOG
572	varying float vFogDepth;
573#endif`,Cg=`#ifdef USE_FOG
574	#ifdef FOG_EXP2
575		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
576	#else
577		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
578	#endif
579	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
580#endif`,Rg=`#ifdef USE_FOG
581	uniform vec3 fogColor;
582	varying float vFogDepth;
583	#ifdef FOG_EXP2
584		uniform float fogDensity;
585	#else
586		uniform float fogNear;
587		uniform float fogFar;
588	#endif
589#endif`,Ig=`#ifdef USE_GRADIENTMAP
590	uniform sampler2D gradientMap;
591#endif
592vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
593	float dotNL = dot( normal, lightDirection );
594	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
595	#ifdef USE_GRADIENTMAP
596		return vec3( texture2D( gradientMap, coord ).r );
597	#else
598		vec2 fw = fwidth( coord ) * 0.5;
599		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
600	#endif
601}`,Pg=`#ifdef USE_LIGHTMAP
602	uniform sampler2D lightMap;
603	uniform float lightMapIntensity;
604#endif`,Lg=`LambertMaterial material;
605material.diffuseColor = diffuseColor.rgb;
606material.specularStrength = specularStrength;`,Dg=`varying vec3 vViewPosition;
607struct LambertMaterial {
608	vec3 diffuseColor;
609	float specularStrength;
610};
611void 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 ) {
612	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
613	vec3 irradiance = dotNL * directLight.color;
614	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
615}
616void 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 ) {
617	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
618}
619#define RE_Direct				RE_Direct_Lambert
620#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,Ug=`uniform bool receiveShadow;
621uniform vec3 ambientLightColor;
622#if defined( USE_LIGHT_PROBES )
623	uniform vec3 lightProbe[ 9 ];
624#endif
625vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
626	float x = normal.x, y = normal.y, z = normal.z;
627	vec3 result = shCoefficients[ 0 ] * 0.886227;
628	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
629	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
630	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
631	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
632	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
633	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
634	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
635	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
636	return result;
637}
638vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
639	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
640	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
641	return irradiance;
642}
643vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
644	vec3 irradiance = ambientLightColor;
645	return irradiance;
646}
647float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
648	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
649	if ( cutoffDistance > 0.0 ) {
650		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
651	}
652	return distanceFalloff;
653}
654float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
655	return smoothstep( coneCosine, penumbraCosine, angleCosine );
656}
657#if NUM_DIR_LIGHTS > 0
658	struct DirectionalLight {
659		vec3 direction;
660		vec3 color;
661	};
662	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
663	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
664		light.color = directionalLight.color;
665		light.direction = directionalLight.direction;
666		light.visible = true;
667	}
668#endif
669#if NUM_POINT_LIGHTS > 0
670	struct PointLight {
671		vec3 position;
672		vec3 color;
673		float distance;
674		float decay;
675	};
676	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
677	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
678		vec3 lVector = pointLight.position - geometryPosition;
679		light.direction = normalize( lVector );
680		float lightDistance = length( lVector );
681		light.color = pointLight.color;
682		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
683		light.visible = ( light.color != vec3( 0.0 ) );
684	}
685#endif
686#if NUM_SPOT_LIGHTS > 0
687	struct SpotLight {
688		vec3 position;
689		vec3 direction;
690		vec3 color;
691		float distance;
692		float decay;
693		float coneCos;
694		float penumbraCos;
695	};
696	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
697	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
698		vec3 lVector = spotLight.position - geometryPosition;
699		light.direction = normalize( lVector );
700		float angleCos = dot( light.direction, spotLight.direction );
701		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
702		if ( spotAttenuation > 0.0 ) {
703			float lightDistance = length( lVector );
704			light.color = spotLight.color * spotAttenuation;
705			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
706			light.visible = ( light.color != vec3( 0.0 ) );
707		} else {
708			light.color = vec3( 0.0 );
709			light.visible = false;
710		}
711	}
712#endif
713#if NUM_RECT_AREA_LIGHTS > 0
714	struct RectAreaLight {
715		vec3 color;
716		vec3 position;
717		vec3 halfWidth;
718		vec3 halfHeight;
719	};
720	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
721	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
722#endif
723#if NUM_HEMI_LIGHTS > 0
724	struct HemisphereLight {
725		vec3 direction;
726		vec3 skyColor;
727		vec3 groundColor;
728	};
729	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
730	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
731		float dotNL = dot( normal, hemiLight.direction );
732		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
733		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
734		return irradiance;
735	}
736#endif`,Ng=`#ifdef USE_ENVMAP
737	vec3 getIBLIrradiance( const in vec3 normal ) {
738		#ifdef ENVMAP_TYPE_CUBE_UV
739			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
740			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
741			return PI * envMapColor.rgb * envMapIntensity;
742		#else
743			return vec3( 0.0 );
744		#endif
745	}
746	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
747		#ifdef ENVMAP_TYPE_CUBE_UV
748			vec3 reflectVec = reflect( - viewDir, normal );
749			reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
750			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
751			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
752			return envMapColor.rgb * envMapIntensity;
753		#else
754			return vec3( 0.0 );
755		#endif
756	}
757	#ifdef USE_ANISOTROPY
758		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
759			#ifdef ENVMAP_TYPE_CUBE_UV
760				vec3 bentNormal = cross( bitangent, viewDir );
761				bentNormal = normalize( cross( bentNormal, bitangent ) );
762				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
763				return getIBLRadiance( viewDir, bentNormal, roughness );
764			#else
765				return vec3( 0.0 );
766			#endif
767		}
768	#endif
769#endif`,Fg=`ToonMaterial material;
770material.diffuseColor = diffuseColor.rgb;`,Og=`varying vec3 vViewPosition;
771struct ToonMaterial {
772	vec3 diffuseColor;
773};
774void 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 ) {
775	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
776	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
777}
778void 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 ) {
779	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
780}
781#define RE_Direct				RE_Direct_Toon
782#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,Bg=`BlinnPhongMaterial material;
783material.diffuseColor = diffuseColor.rgb;
784material.specularColor = specular;
785material.specularShininess = shininess;
786material.specularStrength = specularStrength;`,zg=`varying vec3 vViewPosition;
787struct BlinnPhongMaterial {
788	vec3 diffuseColor;
789	vec3 specularColor;
790	float specularShininess;
791	float specularStrength;
792};
793void 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 ) {
794	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
795	vec3 irradiance = dotNL * directLight.color;
796	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
797	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
798}
799void 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 ) {
800	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
801}
802#define RE_Direct				RE_Direct_BlinnPhong
803#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,Vg=`PhysicalMaterial material;
804material.diffuseColor = diffuseColor.rgb;
805material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
806material.metalness = metalnessFactor;
807vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
808float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
809material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
810material.roughness = min( material.roughness, 1.0 );
811#ifdef IOR
812	material.ior = ior;
813	#ifdef USE_SPECULAR
814		float specularIntensityFactor = specularIntensity;
815		vec3 specularColorFactor = specularColor;
816		#ifdef USE_SPECULAR_COLORMAP
817			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
818		#endif
819		#ifdef USE_SPECULAR_INTENSITYMAP
820			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
821		#endif
822		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
823	#else
824		float specularIntensityFactor = 1.0;
825		vec3 specularColorFactor = vec3( 1.0 );
826		material.specularF90 = 1.0;
827	#endif
828	material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;
829	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
830#else
831	material.specularColor = vec3( 0.04 );
832	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
833	material.specularF90 = 1.0;
834#endif
835#ifdef USE_CLEARCOAT
836	material.clearcoat = clearcoat;
837	material.clearcoatRoughness = clearcoatRoughness;
838	material.clearcoatF0 = vec3( 0.04 );
839	material.clearcoatF90 = 1.0;
840	#ifdef USE_CLEARCOATMAP
841		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
842	#endif
843	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
844		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
845	#endif
846	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
847	material.clearcoatRoughness += geometryRoughness;
848	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
849#endif
850#ifdef USE_DISPERSION
851	material.dispersion = dispersion;
852#endif
853#ifdef USE_IRIDESCENCE
854	material.iridescence = iridescence;
855	material.iridescenceIOR = iridescenceIOR;
856	#ifdef USE_IRIDESCENCEMAP
857		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
858	#endif
859	#ifdef USE_IRIDESCENCE_THICKNESSMAP
860		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
861	#else
862		material.iridescenceThickness = iridescenceThicknessMaximum;
863	#endif
864#endif
865#ifdef USE_SHEEN
866	material.sheenColor = sheenColor;
867	#ifdef USE_SHEEN_COLORMAP
868		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
869	#endif
870	material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );
871	#ifdef USE_SHEEN_ROUGHNESSMAP
872		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
873	#endif
874#endif
875#ifdef USE_ANISOTROPY
876	#ifdef USE_ANISOTROPYMAP
877		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
878		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
879		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
880	#else
881		vec2 anisotropyV = anisotropyVector;
882	#endif
883	material.anisotropy = length( anisotropyV );
884	if( material.anisotropy == 0.0 ) {
885		anisotropyV = vec2( 1.0, 0.0 );
886	} else {
887		anisotropyV /= material.anisotropy;
888		material.anisotropy = saturate( material.anisotropy );
889	}
890	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
891	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
892	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
893#endif`,kg
vendor: 9,654 bytes, lines 893-1124
893=`uniform sampler2D dfgLUT;
894struct PhysicalMaterial {
895	vec3 diffuseColor;
896	vec3 diffuseContribution;
897	vec3 specularColor;
898	vec3 specularColorBlended;
899	float roughness;
900	float metalness;
901	float specularF90;
902	float dispersion;
903	#ifdef USE_CLEARCOAT
904		float clearcoat;
905		float clearcoatRoughness;
906		vec3 clearcoatF0;
907		float clearcoatF90;
908	#endif
909	#ifdef USE_IRIDESCENCE
910		float iridescence;
911		float iridescenceIOR;
912		float iridescenceThickness;
913		vec3 iridescenceFresnel;
914		vec3 iridescenceF0;
915		vec3 iridescenceFresnelDielectric;
916		vec3 iridescenceFresnelMetallic;
917	#endif
918	#ifdef USE_SHEEN
919		vec3 sheenColor;
920		float sheenRoughness;
921	#endif
922	#ifdef IOR
923		float ior;
924	#endif
925	#ifdef USE_TRANSMISSION
926		float transmission;
927		float transmissionAlpha;
928		float thickness;
929		float attenuationDistance;
930		vec3 attenuationColor;
931	#endif
932	#ifdef USE_ANISOTROPY
933		float anisotropy;
934		float alphaT;
935		vec3 anisotropyT;
936		vec3 anisotropyB;
937	#endif
938};
939vec3 clearcoatSpecularDirect = vec3( 0.0 );
940vec3 clearcoatSpecularIndirect = vec3( 0.0 );
941vec3 sheenSpecularDirect = vec3( 0.0 );
942vec3 sheenSpecularIndirect = vec3(0.0 );
943vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
944    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
945    float x2 = x * x;
946    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
947    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
948}
949float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
950	float a2 = pow2( alpha );
951	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
952	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
953	return 0.5 / max( gv + gl, EPSILON );
954}
955float D_GGX( const in float alpha, const in float dotNH ) {
956	float a2 = pow2( alpha );
957	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
958	return RECIPROCAL_PI * a2 / pow2( denom );
959}
960#ifdef USE_ANISOTROPY
961	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 ) {
962		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
963		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
964		float v = 0.5 / ( gv + gl );
965		return v;
966	}
967	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
968		float a2 = alphaT * alphaB;
969		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
970		highp float v2 = dot( v, v );
971		float w2 = a2 / v2;
972		return RECIPROCAL_PI * a2 * pow2 ( w2 );
973	}
974#endif
975#ifdef USE_CLEARCOAT
976	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
977		vec3 f0 = material.clearcoatF0;
978		float f90 = material.clearcoatF90;
979		float roughness = material.clearcoatRoughness;
980		float alpha = pow2( roughness );
981		vec3 halfDir = normalize( lightDir + viewDir );
982		float dotNL = saturate( dot( normal, lightDir ) );
983		float dotNV = saturate( dot( normal, viewDir ) );
984		float dotNH = saturate( dot( normal, halfDir ) );
985		float dotVH = saturate( dot( viewDir, halfDir ) );
986		vec3 F = F_Schlick( f0, f90, dotVH );
987		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
988		float D = D_GGX( alpha, dotNH );
989		return F * ( V * D );
990	}
991#endif
992vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
993	vec3 f0 = material.specularColorBlended;
994	float f90 = material.specularF90;
995	float roughness = material.roughness;
996	float alpha = pow2( roughness );
997	vec3 halfDir = normalize( lightDir + viewDir );
998	float dotNL = saturate( dot( normal, lightDir ) );
999	float dotNV = saturate( dot( normal, viewDir ) );
1000	float dotNH = saturate( dot( normal, halfDir ) );
1001	float dotVH = saturate( dot( viewDir, halfDir ) );
1002	vec3 F = F_Schlick( f0, f90, dotVH );
1003	#ifdef USE_IRIDESCENCE
1004		F = mix( F, material.iridescenceFresnel, material.iridescence );
1005	#endif
1006	#ifdef USE_ANISOTROPY
1007		float dotTL = dot( material.anisotropyT, lightDir );
1008		float dotTV = dot( material.anisotropyT, viewDir );
1009		float dotTH = dot( material.anisotropyT, halfDir );
1010		float dotBL = dot( material.anisotropyB, lightDir );
1011		float dotBV = dot( material.anisotropyB, viewDir );
1012		float dotBH = dot( material.anisotropyB, halfDir );
1013		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1014		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
1015	#else
1016		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1017		float D = D_GGX( alpha, dotNH );
1018	#endif
1019	return F * ( V * D );
1020}
1021vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
1022	const float LUT_SIZE = 64.0;
1023	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
1024	const float LUT_BIAS = 0.5 / LUT_SIZE;
1025	float dotNV = saturate( dot( N, V ) );
1026	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
1027	uv = uv * LUT_SCALE + LUT_BIAS;
1028	return uv;
1029}
1030float LTC_ClippedSphereFormFactor( const in vec3 f ) {
1031	float l = length( f );
1032	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
1033}
1034vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
1035	float x = dot( v1, v2 );
1036	float y = abs( x );
1037	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
1038	float b = 3.4175940 + ( 4.1616724 + y ) * y;
1039	float v = a / b;
1040	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
1041	return cross( v1, v2 ) * theta_sintheta;
1042}
1043vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
1044	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
1045	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
1046	vec3 lightNormal = cross( v1, v2 );
1047	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
1048	vec3 T1, T2;
1049	T1 = normalize( V - N * dot( V, N ) );
1050	T2 = - cross( N, T1 );
1051	mat3 mat = mInv * transpose( mat3( T1, T2, N ) );
1052	vec3 coords[ 4 ];
1053	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
1054	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
1055	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
1056	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
1057	coords[ 0 ] = normalize( coords[ 0 ] );
1058	coords[ 1 ] = normalize( coords[ 1 ] );
1059	coords[ 2 ] = normalize( coords[ 2 ] );
1060	coords[ 3 ] = normalize( coords[ 3 ] );
1061	vec3 vectorFormFactor = vec3( 0.0 );
1062	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
1063	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
1064	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
1065	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
1066	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
1067	return vec3( result );
1068}
1069#if defined( USE_SHEEN )
1070float D_Charlie( float roughness, float dotNH ) {
1071	float alpha = pow2( roughness );
1072	float invAlpha = 1.0 / alpha;
1073	float cos2h = dotNH * dotNH;
1074	float sin2h = max( 1.0 - cos2h, 0.0078125 );
1075	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
1076}
1077float V_Neubelt( float dotNV, float dotNL ) {
1078	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
1079}
1080vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
1081	vec3 halfDir = normalize( lightDir + viewDir );
1082	float dotNL = saturate( dot( normal, lightDir ) );
1083	float dotNV = saturate( dot( normal, viewDir ) );
1084	float dotNH = saturate( dot( normal, halfDir ) );
1085	float D = D_Charlie( sheenRoughness, dotNH );
1086	float V = V_Neubelt( dotNV, dotNL );
1087	return sheenColor * ( D * V );
1088}
1089#endif
1090float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1091	float dotNV = saturate( dot( normal, viewDir ) );
1092	float r2 = roughness * roughness;
1093	float rInv = 1.0 / ( roughness + 0.1 );
1094	float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;
1095	float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;
1096	float DG = exp( a * dotNV + b );
1097	return saturate( DG );
1098}
1099vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
1100	float dotNV = saturate( dot( normal, viewDir ) );
1101	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
1102	return specularColor * fab.x + specularF90 * fab.y;
1103}
1104#ifdef USE_IRIDESCENCE
1105void 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 ) {
1106#else
1107void 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 ) {
1108#endif
1109	float dotNV = saturate( dot( normal, viewDir ) );
1110	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
1111	#ifdef USE_IRIDESCENCE
1112		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
1113	#else
1114		vec3 Fr = specularColor;
1115	#endif
1116	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
1117	float Ess = fab.x + fab.y;
1118	float Ems = 1.0 - Ess;
1119	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
1120	singleScatter += FssEss;
1121	multiScatter += Fms * Ems;
1122}
1123vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1124	vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
vendor: 8,354 bytes, lines 1125-1254
1125	float dotNL = saturate( dot( normal, lightDir ) );
1126	float dotNV = saturate( dot( normal, viewDir ) );
1127	vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;
1128	vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;
1129	vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;
1130	vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;
1131	float Ess_V = dfgV.x + dfgV.y;
1132	float Ess_L = dfgL.x + dfgL.y;
1133	float Ems_V = 1.0 - Ess_V;
1134	float Ems_L = 1.0 - Ess_L;
1135	vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;
1136	vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );
1137	float compensationFactor = Ems_V * Ems_L;
1138	vec3 multiScatter = Fms * compensationFactor;
1139	return singleScatter + multiScatter;
1140}
1141#if NUM_RECT_AREA_LIGHTS > 0
1142	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 ) {
1143		vec3 normal = geometryNormal;
1144		vec3 viewDir = geometryViewDir;
1145		vec3 position = geometryPosition;
1146		vec3 lightPos = rectAreaLight.position;
1147		vec3 halfWidth = rectAreaLight.halfWidth;
1148		vec3 halfHeight = rectAreaLight.halfHeight;
1149		vec3 lightColor = rectAreaLight.color;
1150		float roughness = material.roughness;
1151		vec3 rectCoords[ 4 ];
1152		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
1153		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
1154		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
1155		vec2 uv = LTC_Uv( normal, viewDir, roughness );
1156		vec4 t1 = texture2D( ltc_1, uv );
1157		vec4 t2 = texture2D( ltc_2, uv );
1158		mat3 mInv = mat3(
1159			vec3( t1.x, 0, t1.y ),
1160			vec3(    0, 1,    0 ),
1161			vec3( t1.z, 0, t1.w )
1162		);
1163		vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );
1164		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1165		reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1166		#ifdef USE_CLEARCOAT
1167			vec3 Ncc = geometryClearcoatNormal;
1168			vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );
1169			vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );
1170			vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );
1171			mat3 mInvClearcoat = mat3(
1172				vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),
1173				vec3(             0, 1,             0 ),
1174				vec3( t1Clearcoat.z, 0, t1Clearcoat.w )
1175			);
1176			vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;
1177			clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );
1178		#endif
1179	}
1180#endif
1181void 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 ) {
1182	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1183	vec3 irradiance = dotNL * directLight.color;
1184	#ifdef USE_CLEARCOAT
1185		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
1186		vec3 ccIrradiance = dotNLcc * directLight.color;
1187		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
1188	#endif
1189	#ifdef USE_SHEEN
1190 
1191 		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
1192 
1193 		float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1194 		float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );
1195 
1196 		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );
1197 
1198 		irradiance *= sheenEnergyComp;
1199 
1200 	#endif
1201	reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );
1202	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );
1203}
1204void 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 ) {
1205	vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );
1206	#ifdef USE_SHEEN
1207		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1208		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
1209		diffuse *= sheenEnergyComp;
1210	#endif
1211	reflectedLight.indirectDiffuse += diffuse;
1212}
1213void 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) {
1214	#ifdef USE_CLEARCOAT
1215		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1216	#endif
1217	#ifdef USE_SHEEN
1218		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;
1219 	#endif
1220	vec3 singleScatteringDielectric = vec3( 0.0 );
1221	vec3 multiScatteringDielectric = vec3( 0.0 );
1222	vec3 singleScatteringMetallic = vec3( 0.0 );
1223	vec3 multiScatteringMetallic = vec3( 0.0 );
1224	#ifdef USE_IRIDESCENCE
1225		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
1226		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
1227	#else
1228		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
1229		computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
1230	#endif
1231	vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );
1232	vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );
1233	vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;
1234	vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
1235	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1236	vec3 indirectSpecular = radiance * singleScattering;
1237	indirectSpecular += multiScattering * cosineWeightedIrradiance;
1238	vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;
1239	#ifdef USE_SHEEN
1240		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1241		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
1242		indirectSpecular *= sheenEnergyComp;
1243		indirectDiffuse *= sheenEnergyComp;
1244	#endif
1245	reflectedLight.indirectSpecular += indirectSpecular;
1246	reflectedLight.indirectDiffuse += indirectDiffuse;
1247}
1248#define RE_Direct				RE_Direct_Physical
1249#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
1250#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
1251#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
1252float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1253	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1254}`,
1254Gg=`
1255vec3 geometryPosition = - vViewPosition;
1256vec3 geometryNormal = normal;
1257vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1258vec3 geometryClearcoatNormal = vec3( 0.0 );
1259#ifdef USE_CLEARCOAT
1260	geometryClearcoatNormal = clearcoatNormal;
1261#endif
1262#ifdef USE_IRIDESCENCE
1263	float dotNVi = saturate( dot( normal, geometryViewDir ) );
1264	if ( material.iridescenceThickness == 0.0 ) {
1265		material.iridescence = 0.0;
1266	} else {
1267		material.iridescence = saturate( material.iridescence );
1268	}
1269	if ( material.iridescence > 0.0 ) {
1270		material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
1271		material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );
1272		material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );
1273		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
1274	}
1275#endif
1276IncidentLight directLight;
1277#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1278	PointLight pointLight;
1279	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1280	PointLightShadow pointLightShadow;
1281	#endif
1282	#pragma unroll_loop_start
1283	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1284		pointLight = pointLights[ i ];
1285		getPointLightInfo( pointLight, geometryPosition, directLight );
1286		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
1287		pointLightShadow = pointLightShadows[ i ];
1288		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1289		#endif
1290		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1291	}
1292	#pragma unroll_loop_end
1293#endif
1294#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1295	SpotLight spotLight;
1296	vec4 spotColor;
1297	vec3 spotLightCoord;
1298	bool inSpotLightMap;
1299	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1300	SpotLightShadow spotLightShadow;
1301	#endif
1302	#pragma unroll_loop_start
1303	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1304		spotLight = spotLights[ i ];
1305		getSpotLightInfo( spotLight, geometryPosition, directLight );
1306		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1307		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
1308		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1309		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
1310		#else
1311		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1312		#endif
1313		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
1314			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
1315			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
1316			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
1317			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
1318		#endif
1319		#undef SPOT_LIGHT_MAP_INDEX
1320		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1321		spotLightShadow = spotLightShadows[ i ];
1322		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1323		#endif
1324		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1325	}
1326	#pragma unroll_loop_end
1327#endif
1328#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1329	DirectionalLight directionalLight;
1330	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1331	DirectionalLightShadow directionalLightShadow;
1332	#endif
1333	#pragma unroll_loop_start
1334	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1335		directionalLight = directionalLights[ i ];
1336		getDirectionalLightInfo( directionalLight, directLight );
1337		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1338		directionalLightShadow = directionalLightShadows[ i ];
1339		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1340		#endif
1341		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1342	}
1343	#pragma unroll_loop_end
1344#endif
1345#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1346	RectAreaLight rectAreaLight;
1347	#pragma unroll_loop_start
1348	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1349		rectAreaLight = rectAreaLights[ i ];
1350		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1351	}
1352	#pragma unroll_loop_end
1353#endif
1354#if defined( RE_IndirectDiffuse )
1355	vec3 iblIrradiance = vec3( 0.0 );
1356	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1357	#if defined( USE_LIGHT_PROBES )
1358		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
1359	#endif
1360	#if ( NUM_HEMI_LIGHTS > 0 )
1361		#pragma unroll_loop_start
1362		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1363			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
1364		}
1365		#pragma unroll_loop_end
1366	#endif
1367#endif
1368#if defined( RE_IndirectSpecular )
1369	vec3 radiance = vec3( 0.0 );
1370	vec3 clearcoatRadiance = vec3( 0.0 );
1371#endif`,Hg=`#if defined( RE_IndirectDiffuse )
1372	#ifdef USE_LIGHTMAP
1373		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1374		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1375		irradiance += lightMapIrradiance;
1376	#endif
1377	#if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )
1378		#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )
1379			iblIrradiance += getIBLIrradiance( geometryNormal );
1380		#endif
1381	#endif
1382#endif
1383#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1384	#ifdef USE_ANISOTROPY
1385		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
1386	#else
1387		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
1388	#endif
1389	#ifdef USE_CLEARCOAT
1390		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1391	#endif
1392#endif`,Wg=`#if defined( RE_IndirectDiffuse )
1393	#if defined( LAMBERT ) || defined( PHONG )
1394		irradiance += iblIrradiance;
1395	#endif
1396	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1397#endif
1398#if defined( RE_IndirectSpecular )
1399	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1400#endif`,Xg=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1401	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1402#endif`,qg=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1403	uniform float logDepthBufFC;
1404	varying float vFragDepth;
1405	varying float vIsPerspective;
1406#endif`,Yg=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1407	varying float vFragDepth;
1408	varying float vIsPerspective;
1409#endif`,Zg=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1410	vFragDepth = 1.0 + gl_Position.w;
1411	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1412#endif`,Jg=`#ifdef USE_MAP
1413	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1414	#ifdef DECODE_VIDEO_TEXTURE
1415		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1416	#endif
1417	diffuseColor *= sampledDiffuseColor;
1418#endif`,$g=`#ifdef USE_MAP
1419	uniform sampler2D map;
1420#endif`,Kg=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1421	#if defined( USE_POINTS_UV )
1422		vec2 uv = vUv;
1423	#else
1424		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1425	#endif
1426#endif
1427#ifdef USE_MAP
1428	diffuseColor *= texture2D( map, uv );
1429#endif
1430#ifdef USE_ALPHAMAP
1431	diffuseColor.a *= texture2D( alphaMap, uv ).g;
1432#endif`,Qg=`#if defined( USE_POINTS_UV )
1433	varying vec2 vUv;
1434#else
1435	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1436		uniform mat3 uvTransform;
1437	#endif
1438#endif
1439#ifdef USE_MAP
1440	uniform sampler2D map;
1441#endif
1442#ifdef USE_ALPHAMAP
1443	uniform sampler2D alphaMap;
1444#endif`,jg=`float metalnessFactor = metalness;
1445#ifdef USE_METALNESSMAP
1446	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1447	metalnessFactor *= texelMetalness.b;
1448#endif`,e0=`#ifdef USE_METALNESSMAP
1449	uniform sampler2D metalnessMap;
1450#endif`,t0=`#ifdef USE_INSTANCING_MORPH
1451	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1452	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1453	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1454		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1455	}
1456#endif`,n0=`#if defined( USE_MORPHCOLORS )
1457	vColor *= morphTargetBaseInfluence;
1458	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1459		#if defined( USE_COLOR_ALPHA )
1460			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1461		#elif defined( USE_COLOR )
1462			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1463		#endif
1464	}
1465#endif`,i0=`#ifdef USE_MORPHNORMALS
1466	objectNormal *= morphTargetBaseInfluence;
1467	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1468		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1469	}
1470#endif`,s0=`#ifdef USE_MORPHTARGETS
1471	#ifndef USE_INSTANCING_MORPH
1472		uniform float morphTargetBaseInfluence;
1473		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1474	#endif
1475	uniform sampler2DArray morphTargetsTexture;
1476	uniform ivec2 morphTargetsTextureSize;
1477	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
1478		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
1479		int y = texelIndex / morphTargetsTextureSize.x;
1480		int x = texelIndex - y * morphTargetsTextureSize.x;
1481		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1482		return texelFetch( morphTargetsTexture, morphUV, 0 );
1483	}
1484#endif`,r0=`#ifdef USE_MORPHTARGETS
1485	transformed *= morphTargetBaseInfluence;
1486	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1487		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1488	}
1489#endif`,a0=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1490#ifdef FLAT_SHADED
1491	vec3 fdx = dFdx( vViewPosition );
1492	vec3 fdy = dFdy( vViewPosition );
1493	vec3 normal = normalize( cross( fdx, fdy ) );
1494#else
1495	vec3 normal = normalize( vNormal );
1496	#ifdef DOUBLE_SIDED
1497		normal *= faceDirection;
1498	#endif
1499#endif
1500#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
1501	#ifdef USE_TANGENT
1502		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1503	#else
1504		mat3 tbn = getTangentFrame( - vViewPosition, normal,
1505		#if defined( USE_NORMALMAP )
1506			vNormalMapUv
1507		#elif defined( USE_CLEARCOAT_NORMALMAP )
1508			vClearcoatNormalMapUv
1509		#else
1510			vUv
1511		#endif
1512		);
1513	#endif
1514	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1515		tbn[0] *= faceDirection;
1516		tbn[1] *= faceDirection;
1517	#endif
1518#endif
1519#ifdef USE_CLEARCOAT_NORMALMAP
1520	#ifdef USE_TANGENT
1521		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1522	#else
1523		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
1524	#endif
1525	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1526		tbn2[0] *= faceDirection;
1527		tbn2[1] *= faceDirection;
1528	#endif
1529#endif
1530vec3 nonPerturbedNormal = normal;`,o0=`#ifdef USE_NORMALMAP_OBJECTSPACE
1531	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1532	#ifdef FLIP_SIDED
1533		normal = - normal;
1534	#endif
1535	#ifdef DOUBLE_SIDED
1536		normal = normal * faceDirection;
1537	#endif
1538	normal = normalize( normalMatrix * normal );
1539#elif defined( USE_NORMALMAP_TANGENTSPACE )
1540	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1541	mapN.xy *= normalScale;
1542	normal = normalize( tbn * mapN );
1543#elif defined( USE_BUMPMAP )
1544	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1545#endif`,l0=`#ifndef FLAT_SHADED
1546	varying vec3 vNormal;
1547	#ifdef USE_TANGENT
1548		varying vec3 vTangent;
1549		varying vec3 vBitangent;
1550	#endif
1551#endif`,c0=`#ifndef FLAT_SHADED
1552	varying vec3 vNormal;
1553	#ifdef USE_TANGENT
1554		varying vec3 vTangent;
1555		varying vec3 vBitangent;
1556	#endif
1557#endif`,h0=`#ifndef FLAT_SHADED
1558	vNormal = normalize( transformedNormal );
1559	#ifdef USE_TANGENT
1560		vTangent = normalize( transformedTangent );
1561		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1562	#endif
1563#endif`,u0=`#ifdef USE_NORMALMAP
1564	uniform sampler2D normalMap;
1565	uniform vec2 normalScale;
1566#endif
1567#ifdef USE_NORMALMAP_OBJECTSPACE
1568	uniform mat3 normalMatrix;
1569#endif
1570#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
1571	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
1572		vec3 q0 = dFdx( eye_pos.xyz );
1573		vec3 q1 = dFdy( eye_pos.xyz );
1574		vec2 st0 = dFdx( uv.st );
1575		vec2 st1 = dFdy( uv.st );
1576		vec3 N = surf_norm;
1577		vec3 q1perp = cross( q1, N );
1578		vec3 q0perp = cross( N, q0 );
1579		vec3 T = q1perp * st0.x + q0perp * st1.x;
1580		vec3 B = q1perp * st0.y + q0perp * st1.y;
1581		float det = max( dot( T, T ), dot( B, B ) );
1582		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1583		return mat3( T * scale, B * scale, N );
1584	}
1585#endif`,d0=`#ifdef USE_CLEARCOAT
1586	vec3 clearcoatNormal = nonPerturbedNormal;
1587#endif`,f0=`#ifdef USE_CLEARCOAT_NORMALMAP
1588	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1589	clearcoatMapN.xy *= clearcoatNormalScale;
1590	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1591#endif`,p0=`#ifdef USE_CLEARCOATMAP
1592	uniform sampler2D clearcoatMap;
1593#endif
1594#ifdef USE_CLEARCOAT_NORMALMAP
1595	uniform sampler2D clearcoatNormalMap;
1596	uniform vec2 clearcoatNormalScale;
1597#endif
1598#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1599	uniform sampler2D clearcoatRoughnessMap;
1600#endif`,m0=`#ifdef USE_IRIDESCENCEMAP
1601	uniform sampler2D iridescenceMap;
1602#endif
1603#ifdef USE_IRIDESCENCE_THICKNESSMAP
1604	uniform sampler2D iridescenceThicknessMap;
1605#endif`,g0=`#ifdef OPAQUE
1606diffuseColor.a = 1.0;
1607#endif
1608#ifdef USE_TRANSMISSION
1609diffuseColor.a *= material.transmissionAlpha;
1610#endif
1611gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,_0=`vec3 packNormalToRGB( const in vec3 normal ) {
1612	return normalize( normal ) * 0.5 + 0.5;
1613}
1614vec3 unpackRGBToNormal( const in vec3 rgb ) {
1615	return 2.0 * rgb.xyz - 1.0;
1616}
1617const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
1618const float Inv255 = 1. / 255.;
1619const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
1620const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
1621const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
1622const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
1623vec4 packDepthToRGBA( const in float v ) {
1624	if( v <= 0.0 )
1625		return vec4( 0., 0., 0., 0. );
1626	if( v >= 1.0 )
1627		return vec4( 1., 1., 1., 1. );
1628	float vuf;
1629	float af = modf( v * PackFactors.a, vuf );
1630	float bf = modf( vuf * ShiftRight8, vuf );
1631	float gf = modf( vuf * ShiftRight8, vuf );
1632	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
1633}
1634vec3 packDepthToRGB( const in float v ) {
1635	if( v <= 0.0 )
1636		return vec3( 0., 0., 0. );
1637	if( v >= 1.0 )
1638		return vec3( 1., 1., 1. );
1639	float vuf;
1640	float bf = modf( v * PackFactors.b, vuf );
1641	float gf = modf( vuf * ShiftRight8, vuf );
1642	return vec3( vuf * Inv255, gf * PackUpscale, bf );
1643}
1644vec2 packDepthToRG( const in float v ) {
1645	if( v <= 0.0 )
1646		return vec2( 0., 0. );
1647	if( v >= 1.0 )
1648		return vec2( 1., 1. );
1649	float vuf;
1650	float gf = modf( v * 256., vuf );
1651	return vec2( vuf * Inv255, gf );
1652}
1653float unpackRGBAToDepth( const in vec4 v ) {
1654	return dot( v, UnpackFactors4 );
1655}
1656float unpackRGBToDepth( const in vec3 v ) {
1657	return dot( v, UnpackFactors3 );
1658}
1659float unpackRGToDepth( const in vec2 v ) {
1660	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
1661}
1662vec4 pack2HalfToRGBA( const in vec2 v ) {
1663	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
1664	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
1665}
1666vec2 unpackRGBATo2Half( const in vec4 v ) {
1667	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
1668}
1669float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
1670	return ( viewZ + near ) / ( near - far );
1671}
1672float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
1673	#ifdef USE_REVERSED_DEPTH_BUFFER
1674	
1675		return depth * ( far - near ) - far;
1676	#else
1677		return depth * ( near - far ) - near;
1678	#endif
1679}
1680float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1681	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
1682}
1683float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
1684	
1685	#ifdef USE_REVERSED_DEPTH_BUFFER
1686		return ( near * far ) / ( ( near - far ) * depth - near );
1687	#else
1688		return ( near * far ) / ( ( far - near ) * depth - far );
1689	#endif
1690}`,x0=`#ifdef PREMULTIPLIED_ALPHA
1691	gl_FragColor.rgb *= gl_FragColor.a;
1692#endif`,v0=`vec4 mvPosition = vec4( transformed, 1.0 );
1693#ifdef USE_BATCHING
1694	mvPosition = batchingMatrix * mvPosition;
1695#endif
1696#ifdef USE_INSTANCING
1697	mvPosition = instanceMatrix * mvPosition;
1698#endif
1699mvPosition = modelViewMatrix * mvPosition;
1700gl_Position = projectionMatrix * mvPosition;`,y0=`#ifdef DITHERING
1701	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1702#endif`,M0=`#ifdef DITHERING
1703	vec3 dithering( vec3 color ) {
1704		float grid_position = rand( gl_FragCoord.xy );
1705		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1706		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1707		return color + dither_shift_RGB;
1708	}
1709#endif`,S0=`float roughnessFactor = roughness;
1710#ifdef USE_ROUGHNESSMAP
1711	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1712	roughnessFactor *= texelRoughness.g;
1713#endif`,b0=`#ifdef USE_ROUGHNESSMAP
1714	uniform sampler2D roughnessMap;
1715#endif`,T0=`#if NUM_SPOT_LIGHT_COORDS > 0
1716	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1717#endif
1718#if NUM_SPOT_LIGHT_MAPS > 0
1719	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
1720#endif
1721#ifdef USE_SHADOWMAP
1722	#if NUM_DIR_LIGHT_SHADOWS > 0
1723		#if defined( SHADOWMAP_TYPE_PCF )
1724			uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1725		#else
1726			uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1727		#endif
1728		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1729		struct DirectionalLightShadow {
1730			float shadowIntensity;
1731			float shadowBias;
1732			float shadowNormalBias;
1733			float shadowRadius;
1734			vec2 shadowMapSize;
1735		};
1736		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1737	#endif
1738	#if NUM_SPOT_LIGHT_SHADOWS > 0
1739		#if defined( SHADOWMAP_TYPE_PCF )
1740			uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1741		#else
1742			uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1743		#endif
1744		struct SpotLightShadow {
1745			float shadowIntensity;
1746			float shadowBias;
1747			float shadowNormalBias;
1748			float shadowRadius;
1749			vec2 shadowMapSize;
1750		};
1751		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1752	#endif
1753	#if NUM_POINT_LIGHT_SHADOWS > 0
1754		#if defined( SHADOWMAP_TYPE_PCF )
1755			uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1756		#elif defined( SHADOWMAP_TYPE_BASIC )
1757			uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1758		#endif
1759		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1760		struct PointLightShadow {
1761			float shadowIntensity;
1762			float shadowBias;
1763			float shadowNormalBias;
1764			float shadowRadius;
1765			vec2 shadowMapSize;
1766			float shadowCameraNear;
1767			float shadowCameraFar;
1768		};
1769		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1770	#endif
1771	#if defined( SHADOWMAP_TYPE_PCF )
1772		float interleavedGradientNoise( vec2 position ) {
1773			return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );
1774		}
1775		vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {
1776			const float goldenAngle = 2.399963229728653;
1777			float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );
1778			float theta = float( sampleIndex ) * goldenAngle + phi;
1779			return vec2( cos( theta ), sin( theta ) ) * r;
1780		}
1781	#endif
1782	#if defined( SHADOWMAP_TYPE_PCF )
1783		float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1784			float shadow = 1.0;
1785			shadowCoord.xyz /= shadowCoord.w;
1786			shadowCoord.z += shadowBias;
1787			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1788			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1789			if ( frustumTest ) {
1790				vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1791				float radius = shadowRadius * texelSize.x;
1792				float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
1793				shadow = (
1794					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +
1795					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +
1796					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +
1797					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +
1798					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )
1799				) * 0.2;
1800			}
1801			return mix( 1.0, shadow, shadowIntensity );
1802		}
1803	#elif defined( SHADOWMAP_TYPE_VSM )
1804		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1805			float shadow = 1.0;
1806			shadowCoord.xyz /= shadowCoord.w;
1807			#ifdef USE_REVERSED_DEPTH_BUFFER
1808				shadowCoord.z -= shadowBias;
1809			#else
1810				shadowCoord.z += shadowBias;
1811			#endif
1812			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1813			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1814			if ( frustumTest ) {
1815				vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;
1816				float mean = distribution.x;
1817				float variance = distribution.y * distribution.y;
1818				#ifdef USE_REVERSED_DEPTH_BUFFER
1819					float hard_shadow = step( mean, shadowCoord.z );
1820				#else
1821					float hard_shadow = step( shadowCoord.z, mean );
1822				#endif
1823				
1824				if ( hard_shadow == 1.0 ) {
1825					shadow = 1.0;
1826				} else {
1827					variance = max( variance, 0.0000001 );
1828					float d = shadowCoord.z - mean;
1829					float p_max = variance / ( variance + d * d );
1830					p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );
1831					shadow = max( hard_shadow, p_max );
1832				}
1833			}
1834			return mix( 1.0, shadow, shadowIntensity );
1835		}
1836	#else
1837		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1838			float shadow = 1.0;
1839			shadowCoord.xyz /= shadowCoord.w;
1840			#ifdef USE_REVERSED_DEPTH_BUFFER
1841				shadowCoord.z -= shadowBias;
1842			#else
1843				shadowCoord.z += shadowBias;
1844			#endif
1845			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1846			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1847			if ( frustumTest ) {
1848				float depth = texture2D( shadowMap, shadowCoord.xy ).r;
1849				#ifdef USE_REVERSED_DEPTH_BUFFER
1850					shadow = step( depth, shadowCoord.z );
1851				#else
1852					shadow = step( shadowCoord.z, depth );
1853				#endif
1854			}
1855			return mix( 1.0, shadow, shadowIntensity );
1856		}
1857	#endif
1858	#if NUM_POINT_LIGHT_SHADOWS > 0
1859	#if defined( SHADOWMAP_TYPE_PCF )
1860	float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1861		float shadow = 1.0;
1862		vec3 lightToPosition = shadowCoord.xyz;
1863		vec3 bd3D = normalize( lightToPosition );
1864		vec3 absVec = abs( lightToPosition );
1865		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
1866		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
1867			#ifdef USE_REVERSED_DEPTH_BUFFER
1868				float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1869				dp -= shadowBias;
1870			#else
1871				float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1872				dp += shadowBias;
1873			#endif
1874			float texelSize = shadowRadius / shadowMapSize.x;
1875			vec3 absDir = abs( bd3D );
1876			vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );
1877			tangent = normalize( cross( bd3D, tangent ) );
1878			vec3 bitangent = cross( bd3D, tangent );
1879			float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
1880			vec2 sample0 = vogelDiskSample( 0, 5, phi );
1881			vec2 sample1 = vogelDiskSample( 1, 5, phi );
1882			vec2 sample2 = vogelDiskSample( 2, 5, phi );
1883			vec2 sample3 = vogelDiskSample( 3, 5, phi );
1884			vec2 sample4 = vogelDiskSample( 4, 5, phi );
1885			shadow = (
1886				texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +
1887				texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +
1888				texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +
1889				texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +
1890				texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )
1891			) * 0.2;
1892		}
1893		return mix( 1.0, shadow, shadowIntensity );
1894	}
1895	#elif defined( SHADOWMAP_TYPE_BASIC )
1896	float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1897		float shadow = 1.0;
1898		vec3 lightToPosition = shadowCoord.xyz;
1899		vec3 absVec = abs( lightToPosition );
1900		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
1901		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
1902			float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1903			dp += shadowBias;
1904			vec3 bd3D = normalize( lightToPosition );
1905			float depth = textureCube( shadowMap, bd3D ).r;
1906			#ifdef USE_REVERSED_DEPTH_BUFFER
1907				depth = 1.0 - depth;
1908			#endif
1909			shadow = step( dp, depth );
1910		}
1911		return mix( 1.0, shadow, shadowIntensity );
1912	}
1913	#endif
1914	#endif
1915#endif`,A0=`#if NUM_SPOT_LIGHT_COORDS > 0
1916	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1917	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1918#endif
1919#ifdef USE_SHADOWMAP
1920	#if NUM_DIR_LIGHT_SHADOWS > 0
1921		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
1922		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1923		struct DirectionalLightShadow {
1924			float shadowIntensity;
1925			float shadowBias;
1926			float shadowNormalBias;
1927			float shadowRadius;
1928			vec2 shadowMapSize;
1929		};
1930		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1931	#endif
1932	#if NUM_SPOT_LIGHT_SHADOWS > 0
1933		struct SpotLightShadow {
1934			float shadowIntensity;
1935			float shadowBias;
1936			float shadowNormalBias;
1937			float shadowRadius;
1938			vec2 shadowMapSize;
1939		};
1940		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1941	#endif
1942	#if NUM_POINT_LIGHT_SHADOWS > 0
1943		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
1944		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1945		struct PointLightShadow {
1946			float shadowIntensity;
1947			float shadowBias;
1948			float shadowNormalBias;
1949			float shadowRadius;
1950			vec2 shadowMapSize;
1951			float shadowCameraNear;
1952			float shadowCameraFar;
1953		};
1954		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1955	#endif
1956#endif`,E0=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
1957	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
1958	vec4 shadowWorldPosition;
1959#endif
1960#if defined( USE_SHADOWMAP )
1961	#if NUM_DIR_LIGHT_SHADOWS > 0
1962		#pragma unroll_loop_start
1963		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1964			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
1965			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
1966		}
1967		#pragma unroll_loop_end
1968	#endif
1969	#if NUM_POINT_LIGHT_SHADOWS > 0
1970		#pragma unroll_loop_start
1971		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1972			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
1973			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
1974		}
1975		#pragma unroll_loop_end
1976	#endif
1977#endif
1978#if NUM_SPOT_LIGHT_COORDS > 0
1979	#pragma unroll_loop_start
1980	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
1981		shadowWorldPosition = worldPosition;
1982		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1983			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
1984		#endif
1985		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
1986	}
1987	#pragma unroll_loop_end
1988#endif`,w0=`float getShadowMask() {
1989	float shadow = 1.0;
1990	#ifdef USE_SHADOWMAP
1991	#if NUM_DIR_LIGHT_SHADOWS > 0
1992	DirectionalLightShadow directionalLight;
1993	#pragma unroll_loop_start
1994	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1995		directionalLight = directionalLightShadows[ i ];
1996		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1997	}
1998	#pragma unroll_loop_end
1999	#endif
2000	#if NUM_SPOT_LIGHT_SHADOWS > 0
2001	SpotLightShadow spotLight;
2002	#pragma unroll_loop_start
2003	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
2004		spotLight = spotLightShadows[ i ];
2005		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
2006	}
2007	#pragma unroll_loop_end
2008	#endif
2009	#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
2010	PointLightShadow pointLight;
2011	#pragma unroll_loop_start
2012	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2013		pointLight = pointLightShadows[ i ];
2014		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
2015	}
2016	#pragma unroll_loop_end
2017	#endif
2018	#endif
2019	return shadow;
2020}`,C0=`#ifdef USE_SKINNING
2021	mat4 boneMatX = getBoneMatrix( skinIndex.x );
2022	mat4 boneMatY = getBoneMatrix( skinIndex.y );
2023	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
2024	mat4 boneMatW = getBoneMatrix( skinIndex.w );
2025#endif`,R0=`#ifdef USE_SKINNING
2026	uniform mat4 bindMatrix;
2027	uniform mat4 bindMatrixInverse;
2028	uniform highp sampler2D boneTexture;
2029	mat4 getBoneMatrix( const in float i ) {
2030		int size = textureSize( boneTexture, 0 ).x;
2031		int j = int( i ) * 4;
2032		int x = j % size;
2033		int y = j / size;
2034		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
2035		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
2036		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
2037		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2038		return mat4( v1, v2, v3, v4 );
2039	}
2040#endif`,I0=`#ifdef USE_SKINNING
2041	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2042	vec4 skinned = vec4( 0.0 );
2043	skinned += boneMatX * skinVertex * skinWeight.x;
2044	skinned += boneMatY * skinVertex * skinWeight.y;
2045	skinned += boneMatZ * skinVertex * skinWeight.z;
2046	skinned += boneMatW * skinVertex * skinWeight.w;
2047	transformed = ( bindMatrixInverse * skinned ).xyz;
2048#endif`,P0=`#ifdef USE_SKINNING
2049	mat4 skinMatrix = mat4( 0.0 );
2050	skinMatrix += skinWeight.x * boneMatX;
2051	skinMatrix += skinWeight.y * boneMatY;
2052	skinMatrix += skinWeight.z * boneMatZ;
2053	skinMatrix += skinWeight.w * boneMatW;
2054	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
2055	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
2056	#ifdef USE_TANGENT
2057		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2058	#endif
2059#endif`,L0=`float specularStrength;
2060#ifdef USE_SPECULARMAP
2061	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2062	specularStrength = texelSpecular.r;
2063#else
2064	specularStrength = 1.0;
2065#endif`,D0=`#ifdef USE_SPECULARMAP
2066	uniform sampler2D specularMap;
2067#endif`,U0=`#if defined( TONE_MAPPING )
2068	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2069#endif`,N0=`#ifndef saturate
2070#define saturate( a ) clamp( a, 0.0, 1.0 )
2071#endif
2072uniform float toneMappingExposure;
2073vec3 LinearToneMapping( vec3 color ) {
2074	return saturate( toneMappingExposure * color );
2075}
2076vec3 ReinhardToneMapping( vec3 color ) {
2077	color *= toneMappingExposure;
2078	return saturate( color / ( vec3( 1.0 ) + color ) );
2079}
2080vec3 CineonToneMapping( vec3 color ) {
2081	color *= toneMappingExposure;
2082	color = max( vec3( 0.0 ), color - 0.004 );
2083	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
2084}
2085vec3 RRTAndODTFit( vec3 v ) {
2086	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
2087	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
2088	return a / b;
2089}
2090vec3 ACESFilmicToneMapping( vec3 color ) {
2091	const mat3 ACESInputMat = mat3(
2092		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
2093		vec3( 0.04823, 0.01566, 0.83777 )
2094	);
2095	const mat3 ACESOutputMat = mat3(
2096		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
2097		vec3( -0.07367, -0.00605,  1.07602 )
2098	);
2099	color *= toneMappingExposure / 0.6;
2100	color = ACESInputMat * color;
2101	color = RRTAndODTFit( color );
2102	color = ACESOutputMat * color;
2103	return saturate( color );
2104}
2105const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
2106	vec3( 1.6605, - 0.1246, - 0.0182 ),
2107	vec3( - 0.5876, 1.1329, - 0.1006 ),
2108	vec3( - 0.0728, - 0.0083, 1.1187 )
2109);
2110const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
2111	vec3( 0.6274, 0.0691, 0.0164 ),
2112	vec3( 0.3293, 0.9195, 0.0880 ),
2113	vec3( 0.0433, 0.0113, 0.8956 )
2114);
2115vec3 agxDefaultContrastApprox( vec3 x ) {
2116	vec3 x2 = x * x;
2117	vec3 x4 = x2 * x2;
2118	return + 15.5 * x4 * x2
2119		- 40.14 * x4 * x
2120		+ 31.96 * x4
2121		- 6.868 * x2 * x
2122		+ 0.4298 * x2
2123		+ 0.1191 * x
2124		- 0.00232;
2125}
2126vec3 AgXToneMapping( vec3 color ) {
2127	const mat3 AgXInsetMatrix = mat3(
2128		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
2129		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
2130		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
2131	);
2132	const mat3 AgXOutsetMatrix = mat3(
2133		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
2134		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
2135		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
2136	);
2137	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
2138	color *= toneMappingExposure;
2139	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
2140	color = AgXInsetMatrix * color;
2141	color = max( color, 1e-10 );	color = log2( color );
2142	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
2143	color = clamp( color, 0.0, 1.0 );
2144	color = agxDefaultContrastApprox( color );
2145	color = AgXOutsetMatrix * color;
2146	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
2147	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
2148	color = clamp( color, 0.0, 1.0 );
2149	return color;
2150}
2151vec3 NeutralToneMapping( vec3 color ) {
2152	const float StartCompression = 0.8 - 0.04;
2153	const float Desaturation = 0.15;
2154	color *= toneMappingExposure;
2155	float x = min( color.r, min( color.g, color.b ) );
2156	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
2157	color -= offset;
2158	float peak = max( color.r, max( color.g, color.b ) );
2159	if ( peak < StartCompression ) return color;
2160	float d = 1. - StartCompression;
2161	float newPeak = 1. - d * d / ( peak + d - StartCompression );
2162	color *= newPeak / peak;
2163	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2164	return mix( color, vec3( newPeak ), g );
2165}
2166vec3 CustomToneMapping( vec3 color ) { return color; }`,F0=`#ifdef USE_TRANSMISSION
2167	material.transmission = transmission;
2168	material.transmissionAlpha = 1.0;
2169	material.thickness = thickness;
2170	material.attenuationDistance = attenuationDistance;
2171	material.attenuationColor = attenuationColor;
2172	#ifdef USE_TRANSMISSIONMAP
2173		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
2174	#endif
2175	#ifdef USE_THICKNESSMAP
2176		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
2177	#endif
2178	vec3 pos = vWorldPosition;
2179	vec3 v = normalize( cameraPosition - pos );
2180	vec3 n = inverseTransformDirection( normal, viewMatrix );
2181	vec4 transmitted = getIBLVolumeRefraction(
2182		n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,
2183		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
2184		material.attenuationColor, material.attenuationDistance );
2185	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2186	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2187#endif`,O0=`#ifdef USE_TRANSMISSION
2188	uniform float transmission;
2189	uniform float thickness;
2190	uniform float attenuationDistance;
2191	uniform vec3 attenuationColor;
2192	#ifdef USE_TRANSMISSIONMAP
2193		uniform sampler2D transmissionMap;
2194	#endif
2195	#ifdef USE_THICKNESSMAP
2196		uniform sampler2D thicknessMap;
2197	#endif
2198	uniform vec2 transmissionSamplerSize;
2199	uniform sampler2D transmissionSamplerMap;
2200	uniform mat4 modelMatrix;
2201	uniform mat4 projectionMatrix;
2202	varying vec3 vWorldPosition;
2203	float w0( float a ) {
2204		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
2205	}
2206	float w1( float a ) {
2207		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
2208	}
2209	float w2( float a ){
2210		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
2211	}
2212	float w3( float a ) {
2213		return ( 1.0 / 6.0 ) * ( a * a * a );
2214	}
2215	float g0( float a ) {
2216		return w0( a ) + w1( a );
2217	}
2218	float g1( float a ) {
2219		return w2( a ) + w3( a );
2220	}
2221	float h0( float a ) {
2222		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
2223	}
2224	float h1( float a ) {
2225		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
2226	}
2227	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
2228		uv = uv * texelSize.zw + 0.5;
2229		vec2 iuv = floor( uv );
2230		vec2 fuv = fract( uv );
2231		float g0x = g0( fuv.x );
2232		float g1x = g1( fuv.x );
2233		float h0x = h0( fuv.x );
2234		float h1x = h1( fuv.x );
2235		float h0y = h0( fuv.y );
2236		float h1y = h1( fuv.y );
2237		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2238		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2239		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2240		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2241		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
2242			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
2243	}
2244	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
2245		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
2246		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
2247		vec2 fLodSizeInv = 1.0 / fLodSize;
2248		vec2 cLodSizeInv = 1.0 / cLodSize;
2249		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
2250		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
2251		return mix( fSample, cSample, fract( lod ) );
2252	}
2253	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
2254		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
2255		vec3 modelScale;
2256		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
2257		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
2258		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
2259		return normalize( refractionVector ) * thickness * modelScale;
2260	}
2261	float applyIorToRoughness( const in float roughness, const in float ior ) {
2262		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
2263	}
2264	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
2265		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
2266		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
2267	}
2268	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
2269		if ( isinf( attenuationDistance ) ) {
2270			return vec3( 1.0 );
2271		} else {
2272			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
2273			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
2274		}
2275	}
2276	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
2277		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
2278		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
2279		const in vec3 attenuationColor, const in float attenuationDistance ) {
2280		vec4 transmittedLight;
2281		vec3 transmittance;
2282		#ifdef USE_DISPERSION
2283			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
2284			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
2285			for ( int i = 0; i < 3; i ++ ) {
2286				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
2287				vec3 refractedRayExit = position + transmissionRay;
2288				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2289				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2290				refractionCoords += 1.0;
2291				refractionCoords /= 2.0;
2292				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
2293				transmittedLight[ i ] = transmissionSample[ i ];
2294				transmittedLight.a += transmissionSample.a;
2295				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
2296			}
2297			transmittedLight.a /= 3.0;
2298		#else
2299			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
2300			vec3 refractedRayExit = position + transmissionRay;
2301			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2302			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2303			refractionCoords += 1.0;
2304			refractionCoords /= 2.0;
2305			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
2306			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
2307		#endif
2308		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
2309		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
2310		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2311		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2312	}
2313#endif`,B0=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2314	varying vec2 vUv;
2315#endif
2316#ifdef USE_MAP
2317	varying vec2 vMapUv;
2318#endif
2319#ifdef USE_ALPHAMAP
2320	varying vec2 vAlphaMapUv;
2321#endif
2322#ifdef USE_LIGHTMAP
2323	varying vec2 vLightMapUv;
2324#endif
2325#ifdef USE_AOMAP
2326	varying vec2 vAoMapUv;
2327#endif
2328#ifdef USE_BUMPMAP
2329	varying vec2 vBumpMapUv;
2330#endif
2331#ifdef USE_NORMALMAP
2332	varying vec2 vNormalMapUv;
2333#endif
2334#ifdef USE_EMISSIVEMAP
2335	varying vec2 vEmissiveMapUv;
2336#endif
2337#ifdef USE_METALNESSMAP
2338	varying vec2 vMetalnessMapUv;
2339#endif
2340#ifdef USE_ROUGHNESSMAP
2341	varying vec2 vRoughnessMapUv;
2342#endif
2343#ifdef USE_ANISOTROPYMAP
2344	varying vec2 vAnisotropyMapUv;
2345#endif
2346#ifdef USE_CLEARCOATMAP
2347	varying vec2 vClearcoatMapUv;
2348#endif
2349#ifdef USE_CLEARCOAT_NORMALMAP
2350	varying vec2 vClearcoatNormalMapUv;
2351#endif
2352#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2353	varying vec2 vClearcoatRoughnessMapUv;
2354#endif
2355#ifdef USE_IRIDESCENCEMAP
2356	varying vec2 vIridescenceMapUv;
2357#endif
2358#ifdef USE_IRIDESCENCE_THICKNESSMAP
2359	varying vec2 vIridescenceThicknessMapUv;
2360#endif
2361#ifdef USE_SHEEN_COLORMAP
2362	varying vec2 vSheenColorMapUv;
2363#endif
2364#ifdef USE_SHEEN_ROUGHNESSMAP
2365	varying vec2 vSheenRoughnessMapUv;
2366#endif
2367#ifdef USE_SPECULARMAP
2368	varying vec2 vSpecularMapUv;
2369#endif
2370#ifdef USE_SPECULAR_COLORMAP
2371	varying vec2 vSpecularColorMapUv;
2372#endif
2373#ifdef USE_SPECULAR_INTENSITYMAP
2374	varying vec2 vSpecularIntensityMapUv;
2375#endif
2376#ifdef USE_TRANSMISSIONMAP
2377	uniform mat3 transmissionMapTransform;
2378	varying vec2 vTransmissionMapUv;
2379#endif
2380#ifdef USE_THICKNESSMAP
2381	uniform mat3 thicknessMapTransform;
2382	varying vec2 vThicknessMapUv;
2383#endif`,z0=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2384	varying vec2 vUv;
2385#endif
2386#ifdef USE_MAP
2387	uniform mat3 mapTransform;
2388	varying vec2 vMapUv;
2389#endif
2390#ifdef USE_ALPHAMAP
2391	uniform mat3 alphaMapTransform;
2392	varying vec2 vAlphaMapUv;
2393#endif
2394#ifdef USE_LIGHTMAP
2395	uniform mat3 lightMapTransform;
2396	varying vec2 vLightMapUv;
2397#endif
2398#ifdef USE_AOMAP
2399	uniform mat3 aoMapTransform;
2400	varying vec2 vAoMapUv;
2401#endif
2402#ifdef USE_BUMPMAP
2403	uniform mat3 bumpMapTransform;
2404	varying vec2 vBumpMapUv;
2405#endif
2406#ifdef USE_NORMALMAP
2407	uniform mat3 normalMapTransform;
2408	varying vec2 vNormalMapUv;
2409#endif
2410#ifdef USE_DISPLACEMENTMAP
2411	uniform mat3 displacementMapTransform;
2412	varying vec2 vDisplacementMapUv;
2413#endif
2414#ifdef USE_EMISSIVEMAP
2415	uniform mat3 emissiveMapTransform;
2416	varying vec2 vEmissiveMapUv;
2417#endif
2418#ifdef USE_METALNESSMAP
2419	uniform mat3 metalnessMapTransform;
2420	varying vec2 vMetalnessMapUv;
2421#endif
2422#ifdef USE_ROUGHNESSMAP
2423	uniform mat3 roughnessMapTransform;
2424	varying vec2 vRoughnessMapUv;
2425#endif
2426#ifdef USE_ANISOTROPYMAP
2427	uniform mat3 anisotropyMapTransform;
2428	varying vec2 vAnisotropyMapUv;
2429#endif
2430#ifdef USE_CLEARCOATMAP
2431	uniform mat3 clearcoatMapTransform;
2432	varying vec2 vClearcoatMapUv;
2433#endif
2434#ifdef USE_CLEARCOAT_NORMALMAP
2435	uniform mat3 clearcoatNormalMapTransform;
2436	varying vec2 vClearcoatNormalMapUv;
2437#endif
2438#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2439	uniform mat3 clearcoatRoughnessMapTransform;
2440	varying vec2 vClearcoatRoughnessMapUv;
2441#endif
2442#ifdef USE_SHEEN_COLORMAP
2443	uniform mat3 sheenColorMapTransform;
2444	varying vec2 vSheenColorMapUv;
2445#endif
2446#ifdef USE_SHEEN_ROUGHNESSMAP
2447	uniform mat3 sheenRoughnessMapTransform;
2448	varying vec2 vSheenRoughnessMapUv;
2449#endif
2450#ifdef USE_IRIDESCENCEMAP
2451	uniform mat3 iridescenceMapTransform;
2452	varying vec2 vIridescenceMapUv;
2453#endif
2454#ifdef USE_IRIDESCENCE_THICKNESSMAP
2455	uniform mat3 iridescenceThicknessMapTransform;
2456	varying vec2 vIridescenceThicknessMapUv;
2457#endif
2458#ifdef USE_SPECULARMAP
2459	uniform mat3 specularMapTransform;
2460	varying vec2 vSpecularMapUv;
2461#endif
2462#ifdef USE_SPECULAR_COLORMAP
2463	uniform mat3 specularColorMapTransform;
2464	varying vec2 vSpecularColorMapUv;
2465#endif
2466#ifdef USE_SPECULAR_INTENSITYMAP
2467	uniform mat3 specularIntensityMapTransform;
2468	varying vec2 vSpecularIntensityMapUv;
2469#endif
2470#ifdef USE_TRANSMISSIONMAP
2471	uniform mat3 transmissionMapTransform;
2472	varying vec2 vTransmissionMapUv;
2473#endif
2474#ifdef USE_THICKNESSMAP
2475	uniform mat3 thicknessMapTransform;
2476	varying vec2 vThicknessMapUv;
2477#endif`,V0=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2478	vUv = vec3( uv, 1 ).xy;
2479#endif
2480#ifdef USE_MAP
2481	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
2482#endif
2483#ifdef USE_ALPHAMAP
2484	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
2485#endif
2486#ifdef USE_LIGHTMAP
2487	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
2488#endif
2489#ifdef USE_AOMAP
2490	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
2491#endif
2492#ifdef USE_BUMPMAP
2493	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
2494#endif
2495#ifdef USE_NORMALMAP
2496	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
2497#endif
2498#ifdef USE_DISPLACEMENTMAP
2499	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
2500#endif
2501#ifdef USE_EMISSIVEMAP
2502	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
2503#endif
2504#ifdef USE_METALNESSMAP
2505	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
2506#endif
2507#ifdef USE_ROUGHNESSMAP
2508	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
2509#endif
2510#ifdef USE_ANISOTROPYMAP
2511	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
2512#endif
2513#ifdef USE_CLEARCOATMAP
2514	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
2515#endif
2516#ifdef USE_CLEARCOAT_NORMALMAP
2517	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
2518#endif
2519#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2520	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
2521#endif
2522#ifdef USE_IRIDESCENCEMAP
2523	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
2524#endif
2525#ifdef USE_IRIDESCENCE_THICKNESSMAP
2526	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
2527#endif
2528#ifdef USE_SHEEN_COLORMAP
2529	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
2530#endif
2531#ifdef USE_SHEEN_ROUGHNESSMAP
2532	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
2533#endif
2534#ifdef USE_SPECULARMAP
2535	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
2536#endif
2537#ifdef USE_SPECULAR_COLORMAP
2538	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
2539#endif
2540#ifdef USE_SPECULAR_INTENSITYMAP
2541	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
2542#endif
2543#ifdef USE_TRANSMISSIONMAP
2544	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
2545#endif
2546#ifdef USE_THICKNESSMAP
2547	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2548#endif`,k0=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2549	vec4 worldPosition = vec4( transformed, 1.0 );
2550	#ifdef USE_BATCHING
2551		worldPosition = batchingMatrix * worldPosition;
2552	#endif
2553	#ifdef USE_INSTANCING
2554		worldPosition = instanceMatrix * worldPosition;
2555	#endif
2556	worldPosition = modelMatrix * worldPosition;
2557#endif`;const G0=`varying vec2 vUv;
2558uniform mat3 uvTransform;
2559void main() {
2560	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2561	gl_Position = vec4( position.xy, 1.0, 1.0 );
2562}`,H0=`uniform sampler2D t2D;
2563uniform float backgroundIntensity;
2564varying vec2 vUv;
2565void main() {
2566	vec4 texColor = texture2D( t2D, vUv );
2567	#ifdef DECODE_VIDEO_TEXTURE
2568		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 );
2569	#endif
2570	texColor.rgb *= backgroundIntensity;
2571	gl_FragColor = texColor;
2572	#include <tonemapping_fragment>
2573	#include <colorspace_fragment>
2574}`,W0=`varying vec3 vWorldDirection;
2575#include <common>
2576void main() {
2577	vWorldDirection = transformDirection( position, modelMatrix );
2578	#include <begin_vertex>
2579	#include <project_vertex>
2580	gl_Position.z = gl_Position.w;
2581}`,X0=`#ifdef ENVMAP_TYPE_CUBE
2582	uniform samplerCube envMap;
2583#elif defined( ENVMAP_TYPE_CUBE_UV )
2584	uniform sampler2D envMap;
2585#endif
2586uniform float flipEnvMap;
2587uniform float backgroundBlurriness;
2588uniform float backgroundIntensity;
2589uniform mat3 backgroundRotation;
2590varying vec3 vWorldDirection;
2591#include <cube_uv_reflection_fragment>
2592void main() {
2593	#ifdef ENVMAP_TYPE_CUBE
2594		vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
2595	#elif defined( ENVMAP_TYPE_CUBE_UV )
2596		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
2597	#else
2598		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2599	#endif
2600	texColor.rgb *= backgroundIntensity;
2601	gl_FragColor = texColor;
2602	#include <tonemapping_fragment>
2603	#include <colorspace_fragment>
2604}`,q0=`varying vec3 vWorldDirection;
2605#include <common>
2606void main() {
2607	vWorldDirection = transformDirection( position, modelMatrix );
2608	#include <begin_vertex>
2609	#include <project_vertex>
2610	gl_Position.z = gl_Position.w;
2611}`,Y0=`uniform samplerCube tCube;
2612uniform float tFlip;
2613uniform float opacity;
2614varying vec3 vWorldDirection;
2615void main() {
2616	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
2617	gl_FragColor = texColor;
2618	gl_FragColor.a *= opacity;
2619	#include <tonemapping_fragment>
2620	#include <colorspace_fragment>
2621}`,Z0=`#include <common>
2622#include <batching_pars_vertex>
2623#include <uv_pars_vertex>
2624#include <displacementmap_pars_vertex>
2625#include <morphtarget_pars_vertex>
2626#include <skinning_pars_vertex>
2627#include <logdepthbuf_pars_vertex>
2628#include <clipping_planes_pars_vertex>
2629varying vec2 vHighPrecisionZW;
2630void main() {
2631	#include <uv_vertex>
2632	#include <batching_vertex>
2633	#include <skinbase_vertex>
2634	#include <morphinstance_vertex>
2635	#ifdef USE_DISPLACEMENTMAP
2636		#include <beginnormal_vertex>
2637		#include <morphnormal_vertex>
2638		#include <skinnormal_vertex>
2639	#endif
2640	#include <begin_vertex>
2641	#include <morphtarget_vertex>
2642	#include <skinning_vertex>
2643	#include <displacementmap_vertex>
2644	#include <project_vertex>
2645	#include <logdepthbuf_vertex>
2646	#include <clipping_planes_vertex>
2647	vHighPrecisionZW = gl_Position.zw;
2648}`,J0=`#if DEPTH_PACKING == 3200
2649	uniform float opacity;
2650#endif
2651#include <common>
2652#include <packing>
2653#include <uv_pars_fragment>
2654#include <map_pars_fragment>
2655#include <alphamap_pars_fragment>
2656#include <alphatest_pars_fragment>
2657#include <alphahash_pars_fragment>
2658#include <logdepthbuf_pars_fragment>
2659#include <clipping_planes_pars_fragment>
2660varying vec2 vHighPrecisionZW;
2661void main() {
2662	vec4 diffuseColor = vec4( 1.0 );
2663	#include <clipping_planes_fragment>
2664	#if DEPTH_PACKING == 3200
2665		diffuseColor.a = opacity;
2666	#endif
2667	#include <map_fragment>
2668	#include <alphamap_fragment>
2669	#include <alphatest_fragment>
2670	#include <alphahash_fragment>
2671	#include <logdepthbuf_fragment>
2672	#ifdef USE_REVERSED_DEPTH_BUFFER
2673		float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
2674	#else
2675		float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
2676	#endif
2677	#if DEPTH_PACKING == 3200
2678		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
2679	#elif DEPTH_PACKING == 3201
2680		gl_FragColor = packDepthToRGBA( fragCoordZ );
2681	#elif DEPTH_PACKING == 3202
2682		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
2683	#elif DEPTH_PACKING == 3203
2684		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
2685	#endif
2686}`,$0=`#define DISTANCE
2687varying vec3 vWorldPosition;
2688#include <common>
2689#include <batching_pars_vertex>
2690#include <uv_pars_vertex>
2691#include <displacementmap_pars_vertex>
2692#include <morphtarget_pars_vertex>
2693#include <skinning_pars_vertex>
2694#include <clipping_planes_pars_vertex>
2695void main() {
2696	#include <uv_vertex>
2697	#include <batching_vertex>
2698	#include <skinbase_vertex>
2699	#include <morphinstance_vertex>
2700	#ifdef USE_DISPLACEMENTMAP
2701		#include <beginnormal_vertex>
2702		#include <morphnormal_vertex>
2703		#include <skinnormal_vertex>
2704	#endif
2705	#include <begin_vertex>
2706	#include <morphtarget_vertex>
2707	#include <skinning_vertex>
2708	#include <displacementmap_vertex>
2709	#include <project_vertex>
2710	#include <worldpos_vertex>
2711	#include <clipping_planes_vertex>
2712	vWorldPosition = worldPosition.xyz;
2713}`,K0=`#define DISTANCE
2714uniform vec3 referencePosition;
2715uniform float nearDistance;
2716uniform float farDistance;
2717varying vec3 vWorldPosition;
2718#include <common>
2719#include <uv_pars_fragment>
2720#include <map_pars_fragment>
2721#include <alphamap_pars_fragment>
2722#include <alphatest_pars_fragment>
2723#include <alphahash_pars_fragment>
2724#include <clipping_planes_pars_fragment>
2725void main () {
2726	vec4 diffuseColor = vec4( 1.0 );
2727	#include <clipping_planes_fragment>
2728	#include <map_fragment>
2729	#include <alphamap_fragment>
2730	#include <alphatest_fragment>
2731	#include <alphahash_fragment>
2732	float dist = length( vWorldPosition - referencePosition );
2733	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2734	dist = saturate( dist );
2735	gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
2736}`,Q0=`varying vec3 vWorldDirection;
2737#include <common>
2738void main() {
2739	vWorldDirection = transformDirection( position, modelMatrix );
2740	#include <begin_vertex>
2741	#include <project_vertex>
2742}`,j0=`uniform sampler2D tEquirect;
2743varying vec3 vWorldDirection;
2744#include <common>
2745void main() {
2746	vec3 direction = normalize( vWorldDirection );
2747	vec2 sampleUV = equirectUv( direction );
2748	gl_FragColor = texture2D( tEquirect, sampleUV );
2749	#include <tonemapping_fragment>
2750	#include <colorspace_fragment>
2751}`,e_=`uniform float scale;
2752attribute float lineDistance;
2753varying float vLineDistance;
2754#include <common>
2755#include <uv_pars_vertex>
2756#include <color_pars_vertex>
2757#include <fog_pars_vertex>
2758#include <morphtarget_pars_vertex>
2759#include <logdepthbuf_pars_vertex>
2760#include <clipping_planes_pars_vertex>
2761void main() {
2762	vLineDistance = scale * lineDistance;
2763	#include <uv_vertex>
2764	#include <color_vertex>
2765	#include <morphinstance_vertex>
2766	#include <morphcolor_vertex>
2767	#include <begin_vertex>
2768	#include <morphtarget_vertex>
2769	#include <project_vertex>
2770	#include <logdepthbuf_vertex>
2771	#include <clipping_planes_vertex>
2772	#include <fog_vertex>
2773}`,t_=`uniform vec3 diffuse;
2774uniform float opacity;
2775uniform float dashSize;
2776uniform float totalSize;
2777varying float vLineDistance;
2778#include <common>
2779#include <color_pars_fragment>
2780#include <uv_pars_fragment>
2781#include <map_pars_fragment>
2782#include <fog_pars_fragment>
2783#include <logdepthbuf_pars_fragment>
2784#include <clipping_planes_pars_fragment>
2785void main() {
2786	vec4 diffuseColor = vec4( diffuse, opacity );
2787	#include <clipping_planes_fragment>
2788	if ( mod( vLineDistance, totalSize ) > dashSize ) {
2789		discard;
2790	}
2791	vec3 outgoingLight = vec3( 0.0 );
2792	#include <logdepthbuf_fragment>
2793	#include <map_fragment>
2794	#include <color_fragment>
2795	outgoingLight = diffuseColor.rgb;
2796	#include <opaque_fragment>
2797	#include <tonemapping_fragment>
2798	#include <colorspace_fragment>
2799	#include <fog_fragment>
2800	#include <premultiplied_alpha_fragment>
2801}`,n_=`#include <common>
2802#include <batching_pars_vertex>
2803#include <uv_pars_vertex>
2804#include <envmap_pars_vertex>
2805#include <color_pars_vertex>
2806#include <fog_pars_vertex>
2807#include <morphtarget_pars_vertex>
2808#include <skinning_pars_vertex>
2809#include <logdepthbuf_pars_vertex>
2810#include <clipping_planes_pars_vertex>
2811void main() {
2812	#include <uv_vertex>
2813	#include <color_vertex>
2814	#include <morphinstance_vertex>
2815	#include <morphcolor_vertex>
2816	#include <batching_vertex>
2817	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
2818		#include <beginnormal_vertex>
2819		#include <morphnormal_vertex>
2820		#include <skinbase_vertex>
2821		#include <skinnormal_vertex>
2822		#include <defaultnormal_vertex>
2823	#endif
2824	#include <begin_vertex>
2825	#include <morphtarget_vertex>
2826	#include <skinning_vertex>
2827	#include <project_vertex>
2828	#include <logdepthbuf_vertex>
2829	#include <clipping_planes_vertex>
2830	#include <worldpos_vertex>
2831	#include <envmap_vertex>
2832	#include <fog_vertex>
2833}`,i_=`uniform vec3 diffuse;
2834uniform float opacity;
2835#ifndef FLAT_SHADED
2836	varying vec3 vNormal;
2837#endif
2838#include <common>
2839#include <dithering_pars_fragment>
2840#include <color_pars_fragment>
2841#include <uv_pars_fragment>
2842#include <map_pars_fragment>
2843#include <alphamap_pars_fragment>
2844#include <alphatest_pars_fragment>
2845#include <alphahash_pars_fragment>
2846#include <aomap_pars_fragment>
2847#include <lightmap_pars_fragment>
2848#include <envmap_common_pars_fragment>
2849#include <envmap_pars_fragment>
2850#include <fog_pars_fragment>
2851#include <specularmap_pars_fragment>
2852#include <logdepthbuf_pars_fragment>
2853#include <clipping_planes_pars_fragment>
2854void main() {
2855	vec4 diffuseColor = vec4( diffuse, opacity );
2856	#include <clipping_planes_fragment>
2857	#include <logdepthbuf_fragment>
2858	#include <map_fragment>
2859	#include <color_fragment>
2860	#include <alphamap_fragment>
2861	#include <alphatest_fragment>
2862	#include <alphahash_fragment>
2863	#include <specularmap_fragment>
2864	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2865	#ifdef USE_LIGHTMAP
2866		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
2867		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
2868	#else
2869		reflectedLight.indirectDiffuse += vec3( 1.0 );
2870	#endif
2871	#include <aomap_fragment>
2872	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
2873	vec3 outgoingLight = reflectedLight.indirectDiffuse;
2874	#include <envmap_fragment>
2875	#include <opaque_fragment>
2876	#include <tonemapping_fragment>
2877	#include <colorspace_fragment>
2878	#include <fog_fragment>
2879	#include <premultiplied_alpha_fragment>
2880	#include <dithering_fragment>
2881}`,s_=`#define LAMBERT
2882varying vec3 vViewPosition;
2883#include <common>
2884#include <batching_pars_vertex>
2885#include <uv_pars_vertex>
2886#include <displacementmap_pars_vertex>
2887#include <envmap_pars_vertex>
2888#include <color_pars_vertex>
2889#include <fog_pars_vertex>
2890#include <normal_pars_vertex>
2891#include <morphtarget_pars_vertex>
2892#include <skinning_pars_vertex>
2893#include <shadowmap_pars_vertex>
2894#include <logdepthbuf_pars_vertex>
2895#include <clipping_planes_pars_vertex>
2896void main() {
2897	#include <uv_vertex>
2898	#include <color_vertex>
2899	#include <morphinstance_vertex>
2900	#include <morphcolor_vertex>
2901	#include <batching_vertex>
2902	#include <beginnormal_vertex>
2903	#include <morphnormal_vertex>
2904	#include <skinbase_vertex>
2905	#include <skinnormal_vertex>
2906	#include <defaultnormal_vertex>
2907	#include <normal_vertex>
2908	#include <begin_vertex>
2909	#include <morphtarget_vertex>
2910	#include <skinning_vertex>
2911	#include <displacementmap_vertex>
2912	#include <project_vertex>
2913	#include <logdepthbuf_vertex>
2914	#include <clipping_planes_vertex>
2915	vViewPosition = - mvPosition.xyz;
2916	#include <worldpos_vertex>
2917	#include <envmap_vertex>
2918	#include <shadowmap_vertex>
2919	#include <fog_vertex>
2920}`,r_=`#define LAMBERT
2921uniform vec3 diffuse;
2922uniform vec3 emissive;
2923uniform float opacity;
2924#include <common>
2925#include <dithering_pars_fragment>
2926#include <color_pars_fragment>
2927#include <uv_pars_fragment>
2928#include <map_pars_fragment>
2929#include <alphamap_pars_fragment>
2930#include <alphatest_pars_fragment>
2931#include <alphahash_pars_fragment>
2932#include <aomap_pars_fragment>
2933#include <lightmap_pars_fragment>
2934#include <emissivemap_pars_fragment>
2935#include <cube_uv_reflection_fragment>
2936#include <envmap_common_pars_fragment>
2937#include <envmap_pars_fragment>
2938#include <envmap_physical_pars_fragment>
2939#include <fog_pars_fragment>
2940#include <bsdfs>
2941#include <lights_pars_begin>
2942#include <normal_pars_fragment>
2943#include <lights_lambert_pars_fragment>
2944#include <shadowmap_pars_fragment>
2945#include <bumpmap_pars_fragment>
2946#include <normalmap_pars_fragment>
2947#include <specularmap_pars_fragment>
2948#include <logdepthbuf_pars_fragment>
2949#include <clipping_planes_pars_fragment>
2950void main() {
2951	vec4 diffuseColor = vec4( diffuse, opacity );
2952	#include <clipping_planes_fragment>
2953	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2954	vec3 totalEmissiveRadiance = emissive;
2955	#include <logdepthbuf_fragment>
2956	#include <map_fragment>
2957	#include <color_fragment>
2958	#include <alphamap_fragment>
2959	#include <alphatest_fragment>
2960	#include <alphahash_fragment>
2961	#include <specularmap_fragment>
2962	#include <normal_fragment_begin>
2963	#include <normal_fragment_maps>
2964	#include <emissivemap_fragment>
2965	#include <lights_lambert_fragment>
2966	#include <lights_fragment_begin>
2967	#include <lights_fragment_maps>
2968	#include <lights_fragment_end>
2969	#include <aomap_fragment>
2970	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
2971	#include <envmap_fragment>
2972	#include <opaque_fragment>
2973	#include <tonemapping_fragment>
2974	#include <colorspace_fragment>
2975	#include <fog_fragment>
2976	#include <premultiplied_alpha_fragment>
2977	#include <dithering_fragment>
2978}`,a_=`#define MATCAP
2979varying vec3 vViewPosition;
2980#include <common>
2981#include <batching_pars_vertex>
2982#include <uv_pars_vertex>
2983#include <color_pars_vertex>
2984#include <displacementmap_pars_vertex>
2985#include <fog_pars_vertex>
2986#include <normal_pars_vertex>
2987#include <morphtarget_pars_vertex>
2988#include <skinning_pars_vertex>
2989#include <logdepthbuf_pars_vertex>
2990#include <clipping_planes_pars_vertex>
2991void main() {
2992	#include <uv_vertex>
2993	#include <color_vertex>
2994	#include <morphinstance_vertex>
2995	#include <morphcolor_vertex>
2996	#include <batching_vertex>
2997	#include <beginnormal_vertex>
2998	#include <morphnormal_vertex>
2999	#include <skinbase_vertex>
3000	#include <skinnormal_vertex>
3001	#include <defaultnormal_vertex>
3002	#include <normal_vertex>
3003	#include <begin_vertex>
3004	#include <morphtarget_vertex>
3005	#include <skinning_vertex>
3006	#include <displacementmap_vertex>
3007	#include <project_vertex>
3008	#include <logdepthbuf_vertex>
3009	#include <clipping_planes_vertex>
3010	#include <fog_vertex>
3011	vViewPosition = - mvPosition.xyz;
3012}`,o_=`#define MATCAP
3013uniform vec3 diffuse;
3014uniform float opacity;
3015uniform sampler2D matcap;
3016varying vec3 vViewPosition;
3017#include <common>
3018#include <dithering_pars_fragment>
3019#include <color_pars_fragment>
3020#include <uv_pars_fragment>
3021#include <map_pars_fragment>
3022#include <alphamap_pars_fragment>
3023#include <alphatest_pars_fragment>
3024#include <alphahash_pars_fragment>
3025#include <fog_pars_fragment>
3026#include <normal_pars_fragm
3026ent>
3027#include <bumpmap_pars_fragment>
3028#include <normalmap_pars_fragment>
3029#include <logdepthbuf_pars_fragment>
3030#include <clipping_planes_pars_fragment>
3031void main() {
3032	vec4 diffuseColor = vec4( diffuse, opacity );
3033	#include <clipping_planes_fragment>
3034	#include <logdepthbuf_fragment>
3035	#include <map_fragment>
3036	#include <color_fragment>
3037	#include <alphamap_fragment>
3038	#include <alphatest_fragment>
3039	#include <alphahash_fragment>
3040	#include <normal_fragment_begin>
3041	#include <normal_fragment_maps>
3042	vec3 viewDir = normalize( vViewPosition );
3043	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
3044	vec3 y = cross( viewDir, x );
3045	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
3046	#ifdef USE_MATCAP
3047		vec4 matcapColor = texture2D( matcap, uv );
3048	#else
3049		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
3050	#endif
3051	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
3052	#include <opaque_fragment>
3053	#include <tonemapping_fragment>
3054	#include <colorspace_fragment>
3055	#include <fog_fragment>
3056	#include <premultiplied_alpha_fragment>
3057	#include <dithering_fragment>
3058}`,l_=`#define NORMAL
3059#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3060	varying vec3 vViewPosition;
3061#endif
3062#include <common>
3063#include <batching_pars_vertex>
3064#include <uv_pars_vertex>
3065#include <displacementmap_pars_vertex>
3066#include <normal_pars_vertex>
3067#include <morphtarget_pars_vertex>
3068#include <skinning_pars_vertex>
3069#include <logdepthbuf_pars_vertex>
3070#include <clipping_planes_pars_vertex>
3071void main() {
3072	#include <uv_vertex>
3073	#include <batching_vertex>
3074	#include <beginnormal_vertex>
3075	#include <morphinstance_vertex>
3076	#include <morphnormal_vertex>
3077	#include <skinbase_vertex>
3078	#include <skinnormal_vertex>
3079	#include <defaultnormal_vertex>
3080	#include <normal_vertex>
3081	#include <begin_vertex>
3082	#include <morphtarget_vertex>
3083	#include <skinning_vertex>
3084	#include <displacementmap_vertex>
3085	#include <project_vertex>
3086	#include <logdepthbuf_vertex>
3087	#include <clipping_planes_vertex>
3088#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3089	vViewPosition = - mvPosition.xyz;
3090#endif
3091}`,c_=`#define NORMAL
3092uniform float opacity;
3093#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3094	varying vec3 vViewPosition;
3095#endif
3096#include <uv_pars_fragment>
3097#include <normal_pars_fragment>
3098#include <bumpmap_pars_fragment>
3099#include <normalmap_pars_fragment>
3100#include <logdepthbuf_pars_fragment>
3101#include <clipping_planes_pars_fragment>
3102void main() {
3103	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
3104	#include <clipping_planes_fragment>
3105	#include <logdepthbuf_fragment>
3106	#include <normal_fragment_begin>
3107	#include <normal_fragment_maps>
3108	gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );
3109	#ifdef OPAQUE
3110		gl_FragColor.a = 1.0;
3111	#endif
3112}`,h_=`#define PHONG
3113varying vec3 vViewPosition;
3114#include <common>
3115#include <batching_pars_vertex>
3116#include <uv_pars_vertex>
3117#include <displacementmap_pars_vertex>
3118#include <envmap_pars_vertex>
3119#include <color_pars_vertex>
3120#include <fog_pars_vertex>
3121#include <normal_pars_vertex>
3122#include <morphtarget_pars_vertex>
3123#include <skinning_pars_vertex>
3124#include <shadowmap_pars_vertex>
3125#include <logdepthbuf_pars_vertex>
3126#include <clipping_planes_pars_vertex>
3127void main() {
3128	#include <uv_vertex>
3129	#include <color_vertex>
3130	#include <morphcolor_vertex>
3131	#include <batching_vertex>
3132	#include <beginnormal_vertex>
3133	#include <morphinstance_vertex>
3134	#include <morphnormal_vertex>
3135	#include <skinbase_vertex>
3136	#include <skinnormal_vertex>
3137	#include <defaultnormal_vertex>
3138	#include <normal_vertex>
3139	#include <begin_vertex>
3140	#include <morphtarget_vertex>
3141	#include <skinning_vertex>
3142	#include <displacementmap_vertex>
3143	#include <project_vertex>
3144	#include <logdepthbuf_vertex>
3145	#include <clipping_planes_vertex>
3146	vViewPosition = - mvPosition.xyz;
3147	#include <worldpos_vertex>
3148	#include <envmap_vertex>
3149	#include <shadowmap_vertex>
3150	#include <fog_vertex>
3151}`,u_=`#define PHONG
3152uniform vec3 diffuse;
3153uniform vec3 emissive;
3154uniform vec3 specular;
3155uniform float shininess;
3156uniform float opacity;
3157#include <common>
3158#include <dithering_pars_fragment>
3159#include <color_pars_fragment>
3160#include <uv_pars_fragment>
3161#include <map_pars_fragment>
3162#include <alphamap_pars_fragment>
3163#include <alphatest_pars_fragment>
3164#include <alphahash_pars_fragment>
3165#include <aomap_pars_fragment>
3166#include <lightmap_pars_fragment>
3167#include <emissivemap_pars_fragment>
3168#include <cube_uv_reflection_fragment>
3169#include <envmap_common_pars_fragment>
3170#include <envmap_pars_fragment>
3171#include <envmap_physical_pars_fragment>
3172#include <fog_pars_fragment>
3173#include <bsdfs>
3174#include <lights_pars_begin>
3175#include <normal_pars_fragment>
3176#include <lights_phong_pars_fragment>
3177#include <shadowmap_pars_fragment>
3178#include <bumpmap_pars_fragment>
3179#include <normalmap_pars_fragment>
3180#include <specularmap_pars_fragment>
3181#include <logdepthbuf_pars_fragment>
3182#include <clipping_planes_pars_fragment>
3183void main() {
3184	vec4 diffuseColor = vec4( diffuse, opacity );
3185	#include <clipping_planes_fragment>
3186	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3187	vec3 totalEmissiveRadiance = emissive;
3188	#include <logdepthbuf_fragment>
3189	#include <map_fragment>
3190	#include <color_fragment>
3191	#include <alphamap_fragment>
3192	#include <alphatest_fragment>
3193	#include <alphahash_fragment>
3194	#include <specularmap_fragment>
3195	#include <normal_fragment_begin>
3196	#include <normal_fragment_maps>
3197	#include <emissivemap_fragment>
3198	#include <lights_phong_fragment>
3199	#include <lights_fragment_begin>
3200	#include <lights_fragment_maps>
3201	#include <lights_fragment_end>
3202	#include <aomap_fragment>
3203	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
3204	#include <envmap_fragment>
3205	#include <opaque_fragment>
3206	#include <tonemapping_fragment>
3207	#include <colorspace_fragment>
3208	#include <fog_fragment>
3209	#include <premultiplied_alpha_fragment>
3210	#include <dithering_fragment>
3211}`,d_=`#define STANDARD
3212varying vec3 vViewPosition;
3213#ifdef USE_TRANSMISSION
3214	varying vec3 vWorldPosition;
3215#endif
3216#include <common>
3217#include <batching_pars_vertex>
3218#include <uv_pars_vertex>
3219#include <displacementmap_pars_vertex>
3220#include <color_pars_vertex>
3221#include <fog_pars_vertex>
3222#include <normal_pars_vertex>
3223#include <morphtarget_pars_vertex>
3224#include <skinning_pars_vertex>
3225#include <shadowmap_pars_vertex>
3226#include <logdepthbuf_pars_vertex>
3227#include <clipping_planes_pars_vertex>
3228void main() {
3229	#include <uv_vertex>
3230	#include <color_vertex>
3231	#include <morphinstance_vertex>
3232	#include <morphcolor_vertex>
3233	#include <batching_vertex>
3234	#include <beginnormal_vertex>
3235	#include <morphnormal_vertex>
3236	#include <skinbase_vertex>
3237	#include <skinnormal_vertex>
3238	#include <defaultnormal_vertex>
3239	#include <normal_vertex>
3240	#include <begin_vertex>
3241	#include <morphtarget_vertex>
3242	#include <skinning_vertex>
3243	#include <displacementmap_vertex>
3244	#include <project_vertex>
3245	#include <logdepthbuf_vertex>
3246	#include <clipping_planes_vertex>
3247	vViewPosition = - mvPosition.xyz;
3248	#include <worldpos_vertex>
3249	#include <shadowmap_vertex>
3250	#include <fog_vertex>
3251#ifdef USE_TRANSMISSION
3252	vWorldPosition = worldPosition.xyz;
3253#endif
3254}`,f_=`#define STANDARD
3255#ifdef PHYSICAL
3256	#define IOR
3257	#define USE_SPECULAR
3258#endif
3259uniform vec3 diffuse;
3260uniform vec3 emissive;
3261uniform float roughness;
3262uniform float metalness;
3263uniform float opacity;
3264#ifdef IOR
3265	uniform float ior;
3266#endif
3267#ifdef USE_SPECULAR
3268	uniform float specularIntensity;
3269	uniform vec3 specularColor;
3270	#ifdef USE_SPECULAR_COLORMAP
3271		uniform sampler2D specularColorMap;
3272	#endif
3273	#ifdef USE_SPECULAR_INTENSITYMAP
3274		uniform sampler2D specularIntensityMap;
3275	#endif
3276#endif
3277#ifdef USE_CLEARCOAT
3278	uniform float clearcoat;
3279	uniform float clearcoatRoughness;
3280#endif
3281#ifdef USE_DISPERSION
3282	uniform float dispersion;
3283#endif
3284#ifdef USE_IRIDESCENCE
3285	uniform float iridescence;
3286	uniform float iridescenceIOR;
3287	uniform float iridescenceThicknessMinimum;
3288	uniform float iridescenceThicknessMaximum;
3289#endif
3290#ifdef USE_SHEEN
3291	uniform vec3 sheenColor;
3292	uniform float sheenRoughness;
3293	#ifdef USE_SHEEN_COLORMAP
3294		uniform sampler2D sheenColorMap;
3295	#endif
3296	#ifdef USE_SHEEN_ROUGHNESSMAP
3297		uniform sampler2D sheenRoughnessMap;
3298	#endif
3299#endif
3300#ifdef USE_ANISOTROPY
3301	uniform vec2 anisotropyVector;
3302	#ifdef USE_ANISOTROPYMAP
3303		uniform sampler2D anisotropyMap;
3304	#endif
3305#endif
3306varying vec3 vViewPosition;
3307#include <common>
3308#include <dithering_pars_fragment>
3309#include <color_pars_fragment>
3310#include <uv_pars_fragment>
3311#include <map_pars_fragment>
3312#include <alphamap_pars_fragment>
3313#include <alphatest_pars_fragment>
3314#include <alphahash_pars_fragment>
3315#include <aomap_pars_fragment>
3316#include <lightmap_pars_fragment>
3317#include <emissivemap_pars_fragment>
3318#include <iridescence_fragment>
3319#include <cube_uv_reflection_fragment>
3320#include <envmap_common_pars_fragment>
3321#include <envmap_physical_pars_fragment>
3322#include <fog_pars_fragment>
3323#include <lights_pars_begin>
3324#include <normal_pars_fragment>
3325#include <lights_physical_pars_fragment>
3326#include <transmission_pars_fragment>
3327#include <shadowmap_pars_fragment>
3328#include <bumpmap_pars_fragment>
3329#include <normalmap_pars_fragment>
3330#include <clearcoat_pars_fragment>
3331#include <iridescence_pars_fragment>
3332#include <roughnessmap_pars_fragment>
3333#include <metalnessmap_pars_fragment>
3334#include <logdepthbuf_pars_fragment>
3335#include <clipping_planes_pars_fragment>
3336void main() {
3337	vec4 diffuseColor = vec4( diffuse, opacity );
3338	#include <clipping_planes_fragment>
3339	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3340	vec3 totalEmissiveRadiance = emissive;
3341	#include <logdepthbuf_fragment>
3342	#include <map_fragment>
3343	#include <color_fragment>
3344	#include <alphamap_fragment>
3345	#include <alphatest_fragment>
3346	#include <alphahash_fragment>
3347	#include <roughnessmap_fragment>
3348	#include <metalnessmap_fragment>
3349	#include <normal_fragment_begin>
3350	#include <normal_fragment_maps>
3351	#include <clearcoat_normal_fragment_begin>
3352	#include <clearcoat_normal_fragment_maps>
3353	#include <emissivemap_fragment>
3354	#include <lights_physical_fragment>
3355	#include <lights_fragment_begin>
3356	#include <lights_fragment_maps>
3357	#include <lights_fragment_end>
3358	#include <aomap_fragment>
3359	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
3360	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
3361	#include <transmission_fragment>
3362	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
3363	#ifdef USE_SHEEN
3364 
3365		outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;
3366 
3367 	#endif
3368	#ifdef USE_CLEARCOAT
3369		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
3370		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
3371		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
3372	#endif
3373	#include <opaque_fragment>
3374	#include <tonemapping_fragment>
3375	#include <colorspace_fragment>
3376	#include <fog_fragment>
3377	#include <premultiplied_alpha_fragment>
3378	#include <dithering_fragment>
3379}`,p_=`#define TOON
3380varying vec3 vViewPosition;
3381#include <common>
3382#include <batching_pars_vertex>
3383#include <uv_pars_vertex>
3384#include <displacementmap_pars_vertex>
3385#include <color_pars_vertex>
3386#include <fog_pars_vertex>
3387#include <normal_pars_vertex>
3388#include <morphtarget_pars_vertex>
3389#include <skinning_pars_vertex>
3390#include <shadowmap_pars_vertex>
3391#include <logdepthbuf_pars_vertex>
3392#include <clipping_planes_pars_vertex>
3393void main() {
3394	#include <uv_vertex>
3395	#include <color_vertex>
3396	#include <morphinstance_vertex>
3397	#include <morphcolor_vertex>
3398	#include <batching_vertex>
3399	#include <beginnormal_vertex>
3400	#include <morphnormal_vertex>
3401	#include <skinbase_vertex>
3402	#include <skinnormal_vertex>
3403	#include <defaultnormal_vertex>
3404	#include <normal_vertex>
3405	#include <begin_vertex>
3406	#include <morphtarget_vertex>
3407	#include <skinning_vertex>
3408	#include <displacementmap_vertex>
3409	#include <project_vertex>
3410	#include <logdepthbuf_vertex>
3411	#include <clipping_planes_vertex>
3412	vViewPosition = - mvPosition.xyz;
3413	#include <worldpos_vertex>
3414	#include <shadowmap_vertex>
3415	#include <fog_vertex>
3416}`,m_=`#define TOON
3417uniform vec3 diffuse;
3418uniform vec3 emissive;
3419uniform float opacity;
3420#include <common>
3421#include <dithering_pars_fragment>
3422#include <color_pars_fragment>
3423#include <uv_pars_fragment>
3424#include <map_pars_fragment>
3425#include <alphamap_pars_fragment>
3426#include <alphatest_pars_fragment>
3427#include <alphahash_pars_fragment>
3428#include <aomap_pars_fragment>
3429#include <lightmap_pars_fragment>
3430#include <emissivemap_pars_fragment>
3431#include <gradientmap_pars_fragment>
3432#include <fog_pars_fragment>
3433#include <bsdfs>
3434#include <lights_pars_begin>
3435#include <normal_pars_fragment>
3436#include <lights_toon_pars_fragment>
3437#include <shadowmap_pars_fragment>
3438#include <bumpmap_pars_fragment>
3439#include <normalmap_pars_fragment>
3440#include <logdepthbuf_pars_fragment>
3441#include <clipping_planes_pars_fragment>
3442void main() {
3443	vec4 diffuseColor = vec4( diffuse, opacity );
3444	#include <clipping_planes_fragment>
3445	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3446	vec3 totalEmissiveRadiance = emissive;
3447	#include <logdepthbuf_fragment>
3448	#include <map_fragment>
3449	#include <color_fragment>
3450	#include <alphamap_fragment>
3451	#include <alphatest_fragment>
3452	#include <alphahash_fragment>
3453	#include <normal_fragment_begin>
3454	#include <normal_fragment_maps>
3455	#include <emissivemap_fragment>
3456	#include <lights_toon_fragment>
3457	#include <lights_fragment_begin>
3458	#include <lights_fragment_maps>
3459	#include <lights_fragment_end>
3460	#include <aomap_fragment>
3461	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3462	#include <opaque_fragment>
3463	#include <tonemapping_fragment>
3464	#include <colorspace_fragment>
3465	#include <fog_fragment>
3466	#include <premultiplied_alpha_fragment>
3467	#include <dithering_fragment>
3468}`,g_=`uniform float size;
3469uniform float scale;
3470#include <common>
3471#include <color_pars_vertex>
3472#include <fog_pars_vertex>
3473#include <morphtarget_pars_vertex>
3474#include <logdepthbuf_pars_vertex>
3475#include <clipping_planes_pars_vertex>
3476#ifdef USE_POINTS_UV
3477	varying vec2 vUv;
3478	uniform mat3 uvTransform;
3479#endif
3480void main() {
3481	#ifdef USE_POINTS_UV
3482		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
3483	#endif
3484	#include <color_vertex>
3485	#include <morphinstance_vertex>
3486	#include <morphcolor_vertex>
3487	#include <begin_vertex>
3488	#include <morphtarget_vertex>
3489	#include <project_vertex>
3490	gl_PointSize = size;
3491	#ifdef USE_SIZEATTENUATION
3492		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3493		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
3494	#endif
3495	#include <logdepthbuf_vertex>
3496	#include <clipping_planes_vertex>
3497	#include <worldpos_vertex>
3498	#include <fog_vertex>
3499}`,__=`uniform vec3 diffuse;
3500uniform float opacity;
3501#include <common>
3502#include <color_pars_fragment>
3503#include <map_particle_pars_fragment>
3504#include <alphatest_pars_fragment>
3505#include <alphahash_pars_fragment>
3506#include <fog_pars_fragment>
3507#include <logdepthbuf_pars_fragment>
3508#include <clipping_planes_pars_fragment>
3509void main() {
3510	vec4 diffuseColor = vec4( diffuse, opacity );
3511	#include <clipping_planes_fragment>
3512	vec3 outgoingLight = vec3( 0.0 );
3513	#include <logdepthbuf_fragment>
3514	#include <map_particle_fragment>
3515	#include <color_fragment>
3516	#include <alphatest_fragment>
3517	#include <alphahash_fragment>
3518	outgoingLight = diffuseColor.rgb;
3519	#include <opaque_fragment>
3520	#include <tonemapping_fragment>
3521	#include <colorspace_fragment>
3522	#include <fog_fragment>
3523	#include <premultiplied_alpha_fragment>
3524}`,x_=`#include <common>
3525#include <batching_pars_vertex>
3526#include <fog_pars_vertex>
3527#include <morphtarget_pars_vertex>
3528#include <skinning_pars_vertex>
3529#include <logdepthbuf_pars_vertex>
3530#include <shadowmap_pars_vertex>
3531void main() {
3532	#include <batching_vertex>
3533	#include <beginnormal_vertex>
3534	#include <morphinstance_vertex>
3535	#include <morphnormal_vertex>
3536	#include <skinbase_vertex>
3537	#include <skinnormal_vertex>
3538	#include <defaultnormal_vertex>
3539	#include <begin_vertex>
3540	#include <morphtarget_vertex>
3541	#include <skinning_vertex>
3542	#include <project_vertex>
3543	#include <logdepthbuf_vertex>
3544	#include <worldpos_vertex>
3545	#include <shadowmap_vertex>
3546	#include <fog_vertex>
3547}`,v_=`uniform vec3 color;
3548uniform float opacity;
3549#include <common>
3550#include <fog_pars_fragment>
3551#include <bsdfs>
3552#include <lights_pars_begin>
3553#include <logdepthbuf_pars_fragment>
3554#include <shadowmap_pars_fragment>
3555#include <shadowmask_pars_fragment>
3556void main() {
3557	#include <logdepthbuf_fragment>
3558	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
3559	#include <tonemapping_fragment>
3560	#include <colorspace_fragment>
3561	#include <fog_fragment>
3562	#include <premultiplied_alpha_fragment>
3563}`,y_=`uniform float rotation;
3564uniform vec2 center;
3565#include <common>
3566#include <uv_pars_vertex>
3567#include <fog_pars_vertex>
3568#include <logdepthbuf_pars_vertex>
3569#include <clipping_planes_pars_vertex>
3570void main() {
3571	#include <uv_vertex>
3572	vec4 mvPosition = modelViewMatrix[ 3 ];
3573	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
3574	#ifndef USE_SIZEATTENUATION
3575		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3576		if ( isPerspective ) scale *= - mvPosition.z;
3577	#endif
3578	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
3579	vec2 rotatedPosition;
3580	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
3581	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
3582	mvPosition.xy += rotatedPosition;
3583	gl_Position = projectionMatrix * mvPosition;
3584	#include <logdepthbuf_vertex>
3585	#include <clipping_planes_vertex>
3586	#include <fog_vertex>
3587}`,M_=`uniform vec3 diffuse;
3588uniform float opacity;
3589#include <common>
3590#include <uv_pars_fragment>
3591#include <map_pars_fragment>
3592#include <alphamap_pars_fragment>
3593#include <alphatest_pars_fragment>
3594#include <alphahash_pars_fragment>
3595#include <fog_pars_fragment>
3596#include <logdepthbuf_pars_fragment>
3597#include <clipping_planes_pars_fragment>
3598void main() {
3599	vec4 diffuseColor = vec4( diffuse, opacity );
3600	#include <clipping_planes_fragment>
3601	vec3 outgoingLight = vec3( 0.0 );
3602	#include <logdepthbuf_fragment>
3603	#include <map_fragment>
3604	#include <alphamap_fragment>
3605	#include <alphatest_fragment>
3606	#include <alphahash_fragment>
3607	outgoingLight = diffuseColor.rgb;
3608	#include <opaque_fragment>
3609	#include <tonemapping_fragment>
3610	#include <colorspace_fragment>
3611	#include <fog_fragment>
3612}`,$e={alphahash_fragment:Hm,alphahash_pars_fragment:Wm,alphamap_fragment:Xm,alphamap_pars_fragment:qm,alphatest_fragment:Ym,alphatest_pars_fragment:Zm,aomap_fragment:Jm,aomap_pars_fragment:$m,batching_pars_vertex:Km,batching_vertex:Qm,begin_vertex:jm,beginnormal_vertex:eg,bsdfs:tg,iridescence_fragment:ng,bumpmap_pars_fragment:ig,clipping_planes_fragment:sg,clipping_planes_pars_fragment:rg,clipping_planes_pars_vertex:ag,clipping_planes_vertex:og,color_fragment:lg,color_pars_fragment:cg,color_pars_vertex:hg,color_vertex:ug,common:dg,cube_uv_reflection_fragment:fg,defaultnormal_vertex:pg,displacementmap_pars_vertex:mg,displacementmap_vertex:gg,emissivemap_fragment:_g,emissivemap_pars_fragment:xg,colorspace_fragment:vg,colorspace_pars_fragment:yg,envmap_fragment:Mg,envmap_common_pars_fragment:Sg,envmap_pars_fragment:bg,envmap_pars_vertex:Tg,envmap_physical_pars_fragment:Ng,envmap_vertex:Ag,fog_vertex:Eg,fog_pars_vertex:wg,fog_fragment:Cg,fog_pars_fragment:Rg,gradientmap_pars_fragment:Ig,lightmap_pars_fragment:Pg,lights_lambert_fragment:Lg,lights_lambert_pars_fragment:Dg,lights_pars_begin:Ug,lights_toon_fragment:Fg,lights_toon_pars_fragment:Og,lights_phong_fragment:Bg,lights_phong_pars_fragment:zg,lights_physical_fragment:Vg,lights_physical_pars_fragment:kg,lights_fragment_begin:Gg,lights_fragment_maps:
vendor: 6,065 bytes, line 3612
3612Hg,lights_fragment_end:Wg,logdepthbuf_fragment:Xg,logdepthbuf_pars_fragment:qg,logdepthbuf_pars_vertex:Yg,logdepthbuf_vertex:Zg,map_fragment:Jg,map_pars_fragment:$g,map_particle_fragment:Kg,map_particle_pars_fragment:Qg,metalnessmap_fragment:jg,metalnessmap_pars_fragment:e0,morphinstance_vertex:t0,morphcolor_vertex:n0,morphnormal_vertex:i0,morphtarget_pars_vertex:s0,morphtarget_vertex:r0,normal_fragment_begin:a0,normal_fragment_maps:o0,normal_pars_fragment:l0,normal_pars_vertex:c0,normal_vertex:h0,normalmap_pars_fragment:u0,clearcoat_normal_fragment_begin:d0,clearcoat_normal_fragment_maps:f0,clearcoat_pars_fragment:p0,iridescence_pars_fragment:m0,opaque_fragment:g0,packing:_0,premultiplied_alpha_fragment:x0,project_vertex:v0,dithering_fragment:y0,dithering_pars_fragment:M0,roughnessmap_fragment:S0,roughnessmap_pars_fragment:b0,shadowmap_pars_fragment:T0,shadowmap_pars_vertex:A0,shadowmap_vertex:E0,shadowmask_pars_fragment:w0,skinbase_vertex:C0,skinning_pars_vertex:R0,skinning_vertex:I0,skinnormal_vertex:P0,specularmap_fragment:L0,specularmap_pars_fragment:D0,tonemapping_fragment:U0,tonemapping_pars_fragment:N0,transmission_fragment:F0,transmission_pars_fragment:O0,uv_pars_fragment:B0,uv_pars_vertex:z0,uv_vertex:V0,worldpos_vertex:k0,background_vert:G0,background_frag:H0,backgroundCube_vert:W0,backgroundCube_frag:X0,cube_vert:q0,cube_frag:Y0,depth_vert:Z0,depth_frag:J0,distance_vert:$0,distance_frag:K0,equirect_vert:Q0,equirect_frag:j0,linedashed_vert:e_,linedashed_frag:t_,meshbasic_vert:n_,meshbasic_frag:i_,meshlambert_vert:s_,meshlambert_frag:r_,meshmatcap_vert:a_,meshmatcap_frag:o_,meshnormal_vert:l_,meshnormal_frag:c_,meshphong_vert:h_,meshphong_frag:u_,meshphysical_vert:d_,meshphysical_frag:f_,meshtoon_vert:p_,meshtoon_frag:m_,points_vert:g_,points_frag:__,shadow_vert:x_,shadow_frag:v_,sprite_vert:y_,sprite_frag:M_},fe={common:{diffuse:{value:new Me(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ze},alphaMap:{value:null},alphaMapTransform:{value:new Ze},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ze}},envmap:{envMap:{value:null},envMapRotation:{value:new Ze},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 Ze}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ze}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ze},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ze},normalScale:{value:new K(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ze},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ze}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ze}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ze}},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:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},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 Ze},alphaTest:{value:0},uvTransform:{value:new Ze}},sprite:{diffuse:{value:new Me(16777215)},opacity:{value:1},center:{value:new K(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ze},alphaMap:{value:null},alphaMapTransform:{value:new Ze},alphaTest:{value:0}}},vn={basic:{uniforms:Ft([fe.common,fe.specularmap,fe.envmap,fe.aomap,fe.lightmap,fe.fog]),vertexShader:$e.meshbasic_vert,fragmentShader:$e.meshbasic_frag},lambert:{uniforms:Ft([fe.common,fe.specularmap,fe.envmap,fe.aomap,fe.lightmap,fe.emissivemap,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.fog,fe.lights,{emissive:{value:new Me(0)},envMapIntensity:{value:1}}]),vertexShader:$e.meshlambert_vert,fragmentShader:$e.meshlambert_frag},phong:{uniforms:Ft([fe.common,fe.specularmap,fe.envmap,fe.aomap,fe.lightmap,fe.emissivemap,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.fog,fe.lights,{emissive:{value:new Me(0)},specular:{value:new Me(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:$e.meshphong_vert,fragmentShader:$e.meshphong_frag},standard:{uniforms:Ft([fe.common,fe.envmap,fe.aomap,fe.lightmap,fe.emissivemap,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.roughnessmap,fe.metalnessmap,fe.fog,fe.lights,{emissive:{value:new Me(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:$e.meshphysical_vert,fragmentShader:$e.meshphysical_frag},toon:{uniforms:Ft([fe.common,fe.aomap,fe.lightmap,fe.emissivemap,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.gradientmap,fe.fog,fe.lights,{emissive:{value:new Me(0)}}]),vertexShader:$e.meshtoon_vert,fragmentShader:$e.meshtoon_frag},matcap:{uniforms:Ft([fe.common,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.fog,{matc
vendor: 5,270 bytes, line 3612
3612ap:{value:null}}]),vertexShader:$e.meshmatcap_vert,fragmentShader:$e.meshmatcap_frag},points:{uniforms:Ft([fe.points,fe.fog]),vertexShader:$e.points_vert,fragmentShader:$e.points_frag},dashed:{uniforms:Ft([fe.common,fe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:$e.linedashed_vert,fragmentShader:$e.linedashed_frag},depth:{uniforms:Ft([fe.common,fe.displacementmap]),vertexShader:$e.depth_vert,fragmentShader:$e.depth_frag},normal:{uniforms:Ft([fe.common,fe.bumpmap,fe.normalmap,fe.displacementmap,{opacity:{value:1}}]),vertexShader:$e.meshnormal_vert,fragmentShader:$e.meshnormal_frag},sprite:{uniforms:Ft([fe.sprite,fe.fog]),vertexShader:$e.sprite_vert,fragmentShader:$e.sprite_frag},background:{uniforms:{uvTransform:{value:new Ze},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:$e.background_vert,fragmentShader:$e.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ze}},vertexShader:$e.backgroundCube_vert,fragmentShader:$e.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:$e.cube_vert,fragmentShader:$e.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:$e.equirect_vert,fragmentShader:$e.equirect_frag},distance:{uniforms:Ft([fe.common,fe.displacementmap,{referencePosition:{value:new C},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:$e.distance_vert,fragmentShader:$e.distance_frag},shadow:{uniforms:Ft([fe.lights,fe.fog,{color:{value:new Me(0)},opacity:{value:1}}]),vertexShader:$e.shadow_vert,fragmentShader:$e.shadow_frag}};vn.physical={uniforms:Ft([vn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ze},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ze},clearcoatNormalScale:{value:new K(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ze},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ze},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ze},sheen:{value:0},sheenColor:{value:new Me(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ze},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ze},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ze},transmissionSamplerSize:{value:new K},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ze},attenuationDistance:{value:0},attenuationColor:{value:new Me(0)},specularColor:{value:new Me(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ze},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ze},anisotropyVector:{value:new K},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ze}}]),vertexShader:$e.meshphysical_vert,fragmentShader:$e.meshphysical_frag};const Zr={r:0,b:0,g:0},_i=new an,S_=new He;function b_(r,e,t,n,i,s){const a=new Me(0);let o=i===!0?0:1,l,c,h=null,d=0,u=null;function f(x){let y=x.isScene===!0?x.background:null;if(y&&y.isTexture){const M=x.backgroundBlurriness>0;y=e.get(y,M)}return y}function p(x){let y=!1;const M=f(x);M===null?g(a,o):M&&M.isColor&&(g(M,1),y=!0);const E=r.xr.getEnvironmentBlendMode();E==="additive"?t.buffers.color.setClear(0,0,0,1,s):E==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(r.autoClear||y)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function _(x,y){const M=f(y);M&&(M.isCubeTexture||M.mapping===Ks)?(c===void 0&&(c=new bt(new _s(1,1,1),new dn({name:"BackgroundCubeMaterial",uniforms:gs(vn.backgroundCube.uniforms),vertexShader:vn.backgroundCube.vertexShader,fragmentShader:vn.backgroundCube.fragmentShader,side:Wt,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(E,A,I){this.matrixWorld.copyPosition(I.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),_i.copy(y.backgroundRotation),_i.x*=-1,_i.y*=-1,_i.z*=-1,M.isCubeTexture&&M.isRenderTargetTexture===!1&&(_i.y*=-1,_i.z*=-1),c.material.uniforms.envMap.value=M,c.material.uniforms.flipEnvMap.value=M.isCubeTexture&&M.isRenderTargetTexture===!1?-1:1,c.material.uniforms.backgroundBlurriness.value=y.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(S_.makeRotationFromEuler(_i)),c.material.toneMapped=je.getTransfer(M.colorSpace)!==rt,(h!==M||d!==M.version||u!==r.toneMapping)&&(c.material.needsUpdate=!0,h=M,d=M.version,u=r.toneMapping),c.layers.enableAll(),x.unshift(c,c.geometry,c.material,0,0,null)):M&&M.isTexture&&(l===void 0&&(l=new bt(new er(2,2),new dn({name:"Backgroun
3612dMaterial",uniforms:gs(vn.background.uniforms),vertexShader:vn.background.vertexShader,fragmentShader:vn.background.fragmentShader,side:ei,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(l)),l.material.uniforms.t2D.value=M,l.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,l.material.toneMapped=je.getTransfer(M.colorSpace)!==rt,M.matrixAutoUpdate===!0&&M.updateMatrix(),l.material.uniforms.uvTransform.value.copy(M.matrix),(h!==M||d!==M.version||u!==r.toneMapping)&&(l.material.needsUpdate=!0,h=M,d=M.version,u=r.toneMapping),l.layers.enableAll(),x.unshift(l,l.geometry,l.material,0,0,null))}function g(x,y){x.getRGB(Zr,Ou(r)),t.buffers.color.setClear(Zr.r,Zr.g,Zr.b,y,s)}function m(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return a},setClearColor:function(x,y=1){a.set(x),o=y,g(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(x){o=x,g(a,o)},render:p,addToRenderList:_,dispose:m}}function T_(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=u(null);let s=i,a=!1;function o(P,N,O,G,z){let B=!1;const V=d(P,G,O,N);s!==V&&(s=V,c(s.object)),B=f(P,G,O,z),B&&p(P,G,O,z),z!==null&&e.update(z,r.ELEMENT_ARRAY_BUFFER),(B||a)&&(a=!1,M(P,N,O,G),z!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(z).buffer))}function l(){return r.createVertexArray()}function c(P){return r.bindVertexArray(P)}function h(P){return r.deleteVertexArray(P)}function d(P,N,O,G){const z=G.wireframe===!0;let B=n[N.id];B===void 0&&(B={},n[N.id]=B);const V=P.isInstancedMesh===!0?P.id:0;let ie=B[V];ie===void 0&&(ie={},B[V]=ie);let j=ie[O.id];j===void 0&&(j={},ie[O.id]=j);let ge=j[z];return ge===void 0&&(ge=u(l()),j[z]=ge),ge}function u(P){const N=[],O=[],G=[];for(let z=0;z<t;z++)N[z]=0,O[z]=0,G[z]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:N,enabledAttributes:O,attributeDivisors:G,object:P,attributes:{},index:null}}function f(P,N,O,G){const z=s.attributes,B=N.attributes;let V=0;const ie=O.getAttributes();for(const j in ie)if(ie[j].location>=0){const xe=z[j];let _e=B[j];if(_e===void 0&&(j==="instanceMatrix"&&P.instanceMatrix&&(_e=P.instanceMatrix),j==="instanceColor"&&P.instanceColor&&(_e=P.instanceColor)),xe===void 0||xe.attribute!==_e||_e&&xe.data!==_e.data)return!0;V++}return s.attributesNum!==V||s.index!==G}function p(P,N,O,G){const z={},B=N.attributes;let V=0;const ie=O.getAttributes();for(const j in ie)if(ie[j].location>=0){let xe=B[j];xe===void 0&&(j==="instanceMatrix"&&P.instanceMatrix&&(xe=P.instanceMatrix),j==="instanceColor"&&P.instanceColor&&(xe=P.instanceColor));const _e={};_e.attribute=xe,xe&&xe.data&&(_e.data=xe.data),z[j]=_e,V++}s.attributes=z,s.attributesNum=V,s.index=G}function _(){const P=s.newAttributes;for(let N=0,O=P.length;N<O;N++)P[N]=0}function g(P){m(P,0)}function m(P,N){const O=s.newAttributes,G=s.enabledAttributes,z=s.attributeDivisors;O[P]=1,G[P]===0&&(r.enableVertexAttribArray(P),G[P]=1),z[P]!==N&&(r.vertexAttribDivisor(P,N),z[P]=N)}function x(){const P=s.newAttributes,N=s.enabledAttributes;for(let O=0,G=N.length;O<G;O++)N[O]!==P[O]&&(r.disableVertexAttribArray(O),N[O]=0)}function y(P,N,O,G,z,B,V){V===!0?r.vertexAttribIPointer(P,N,O,z,B):r.vertexAttribPointer(P,N,O,G,z,B)}function M(P,N,O,G){_();const z=G.attributes,B=O.getAttributes(),V=N.defaultAttributeValues;for(const ie in B){const j=B[ie];if(j.location>=0){let ge=z[ie];if(ge===void 0&&(ie==="instanceMatrix"&&P.instanceMatrix&&(ge=P.instanceMatrix),ie==="instanceColor"&&P.instanceColor&&(ge=P.instanceColor)),ge!==void 0){const xe=ge.normalized,_e=ge.itemSize,ke=e.get(ge);if(ke===void 0)continue;const it=ke.buffer,at=ke.type,Z=ke.bytesPerElement,ae=at===r.INT||at===r.UNSIGNED_INT||ge.gpuType===bl;if(ge.isInterleavedBufferAttribute){const oe=ge.data,Oe=oe.stride,Ne=ge.offset;if(oe.isInstancedInterleavedBuffer){for(let Ge=0;Ge<j.locationSize;Ge++)m(j.location+Ge,oe.meshPerAttribute);P.isInstancedMesh!==!0&&G._maxInstanceCount===void 0&&(G._maxInstanceCount=oe.meshPerAttribute*oe.count)}else for(let Ge=0;Ge<j.locationSize;Ge++)g(j.location+Ge);r.bindBuffer(r.ARRAY_BUFFER,it);for(let Ge=0;Ge<j.locationSize;Ge++)y(j.location+Ge,_e/j.locationSize,at,xe,Oe*Z,(Ne+_e/j.locationSize*Ge)*Z,ae)}else{if(ge.isInstancedBufferAttribute){for(let oe=0;oe<j.locationSize;oe++)m(j.location+oe,ge.meshPerAttribute);P.isInstancedMesh!==!0&&G._maxInstanceCount===void 0&&(G._maxInstanceCount=ge.meshPerAttribute*ge.count)}else for(let oe=0;oe<j.locationSize;oe++)g(j.location+oe);r.bindBuffer(r.ARRAY_BUFFER,it);for(let oe=0;oe<j.locationSize;oe++)y(j.location+oe,_e/j.locationSize,at,xe,_e*Z,_e/j.locationSize*oe*Z,ae)}}else if(V!==void 0){const xe=V[ie];if(xe!==void 0)switch(xe.length){case 2:r.vertexAttrib2fv(j.location,xe);break;case 3:r.vertexAttrib3fv(j.location,xe);break;case 4:r.vertexAttrib4fv(j.location,xe);break;default:r.vertexAttrib1fv(j.location,xe)}}}}x()}function E(){b();for(const P in n){const N=n[P];for(const O in N){const G=N[O];for(const z in G){const B=G[z];for(const V in B)h(B[V].object),delete B[V];delete G[z]}}delete n[P]}}function A(P){if(n[P.id]===void 0)return;const N=n[P.id];for(const O in N){const G=N[O];for(const z in G){const B=G[z];for(const V in B)h(B[V].object),delete B[V];delete G[z]}}delete n[P.id]}function I(P){for(const N in n){const O=n[N];for(const G in O){const z=O[G];if(z[P.id]===void 0)continue;const B=z[P.id];for(const V in B)h(B[V].object),delete B[V];delete z[P.id]}}}function v(P){for(const N in n){const O=n[N],G=P.isInstancedMesh===!0?P.id:0,z=O[G];if(z!==void 0){for(const B in z){const V=z[B];for(const ie in V)h(V[ie].object),delete V[ie];delete z[B]}delete O[G],Object.keys(O).length===0&&delete n[N]}}}function b(){L(),a=!0,s!==i&&(s=i,c(s.object))}function L(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:o,reset:b,resetDefaultState:L,dispose:E,releaseStatesOfGeometry:A,releaseStatesOfObject:v,releaseStatesOfProgram:I,initAttributes:_,enableAttribute:g,disableUnusedAttributes:x}}function A_(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,d){d!==0&&(r.drawArraysInstanced(n,c,h,d),t.update(h,n,d))}function o(c,h,d){if(d===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,c,0,h,0,d);let f=0;for(let p=0;p<d;p++)f+=h[p];t.update(f,n,1)}function l(c,h,d,u){if(d===0)return;const f=e.get("WEBGL_multi_draw");if(f===null)for(let p=0;p<c.length;p++)a(c[p],h[p],u[p]);
vendor: 13,052 bytes, lines 3612-3685
3612else{f.multiDrawArraysInstancedWEBGL(n,c,0,h,0,u,0,d);let p=0;for(let _=0;_<d;_++)p+=h[_]*u[_];t.update(p,n,1)}}this.setMode=i,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function E_(r,e,t,n){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const I=e.get("EXT_texture_filter_anisotropic");i=r.getParameter(I.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(I){return!(I!==Ht&&n.convert(I)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(I){const v=I===zn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(I!==Kt&&n.convert(I)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_TYPE)&&I!==Gt&&!v)}function l(I){if(I==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";I="mediump"}return I==="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&&(ue("WebGLRenderer:",c,"not supported, using",h,"instead."),c=h);const d=t.logarithmicDepthBuffer===!0,u=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),f=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),p=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=r.getParameter(r.MAX_TEXTURE_SIZE),g=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),m=r.getParameter(r.MAX_VERTEX_ATTRIBS),x=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),y=r.getParameter(r.MAX_VARYING_VECTORS),M=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),E=r.getParameter(r.MAX_SAMPLES),A=r.getParameter(r.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:d,reversedDepthBuffer:u,maxTextures:f,maxVertexTextures:p,maxTextureSize:_,maxCubemapSize:g,maxAttributes:m,maxVertexUniforms:x,maxVaryings:y,maxFragmentUniforms:M,maxSamples:E,samples:A}}function w_(r){const e=this;let t=null,n=0,i=!1,s=!1;const a=new vi,o=new Ze,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,u){const f=d.length!==0||u||n!==0||i;return i=u,n=d.length,f},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(d,u){t=h(d,u,0)},this.setState=function(d,u,f){const p=d.clippingPlanes,_=d.clipIntersection,g=d.clipShadows,m=r.get(d);if(!i||p===null||p.length===0||s&&!g)s?h(null):c();else{const x=s?0:n,y=x*4;let M=m.clippingState||null;l.value=M,M=h(p,u,y,f);for(let E=0;E!==y;++E)M[E]=t[E];m.clippingState=M,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=x}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(d,u,f,p){const _=d!==null?d.length:0;let g=null;if(_!==0){if(g=l.value,p!==!0||g===null){const m=f+_*4,x=u.matrixWorldInverse;o.getNormalMatrix(x),(g===null||g.length<m)&&(g=new Float32Array(m));for(let y=0,M=f;y!==_;++y,M+=4)a.copy(d[y]).applyMatrix4(x,o),a.normal.toArray(g,M),g[M+3]=a.constant}l.value=g,l.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,g}}const jn=4,Dh=[.125,.215,.35,.446,.526,.582],Mi=20,C_=256,Ls=new Ca,Uh=new Me;let vo=null,yo=0,Mo=0,So=!1;const R_=new C;class Nh{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=R_}=s;vo=this._renderer.getRenderTarget(),yo=this._renderer.getActiveCubeFace(),Mo=this._renderer.getActiveMipmapLevel(),So=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=Bh(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Oh(),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(vo,yo,Mo),this._renderer.xr.enabled=So,e.scissorTest=!1,ns(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Bn||e.mapping===Ei?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),vo=this._renderer.getRenderTarget(),yo=this._renderer.getActiveCubeFace(),Mo=this._renderer.getActiveMipmapLevel(),So=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:pt,minFilter:pt,generateMipmaps:!1,type:zn,format:Ht,colorSpace:us,depthBuffer:!1},i=Fh(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Fh(e,t,n);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=I_(s)),this._blurMaterial=L_(s,e,t),this._ggxMaterial=P_(s,e,t)}return i}_compileMaterial(e){const t=new bt(new qe,e);this._renderer.compile(t,Ls)}_sceneToCubeUV(e,t,n,i,s){const l=new Dt(90,1,t,n),c=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],d=this._renderer,u=d.autoClear,f=d.toneMapping;d.getClearColor(Uh),d.toneMapping=Mn,d.autoClear=!1,d.state.buffers.depth.getReversed()&&(d.setRenderTarget(i),d.clearDepth(),d.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new bt(new _s,new Ii({name:"PMREM.Background",side:Wt,depthWrite:!1,depthTest:!1})));const _=this._backgroundBox,g=_.material;let m=!1;const x=e.background;x?x.isColor&&(g.color.copy(x),e.background=null,m=!0):(g.color.copy(Uh),m=!0);for(let y=0;y<6;y++){const M=y%3;M===0?(l.up.set(0,c[y],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+h[y],s.y,s.z)):M===1?(l.up.set(0,0,c[y]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+h[y],s.z)):(l.up.set(0,c[y],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+h[y]));const E=this._cubeSize;ns(i,M*E,y>2?E:0,E,E),d.setRenderTarget(i),m&&d.render(_,l),d.render(e,l)}d.toneMapping=f,d.autoClear=u,e.background=x}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Bn||e.mapping===Ei;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=Bh()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Oh());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;ns(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,Ls)}_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),d=Math.sqrt(c*c-h*h),u=0+c*1.25,f=d*u,{_lodMax:p}=this,_=this._sizeLods[n],g=3*_*(n>p-jn?n-p+jn:0),m=4*(this._cubeSize-_);l.envMap.value=e.texture,l.roughness.value=f,l.mipInt.value=p-t,ns(s,g,m,3*_,2*_),i.setRenderTarget(s),i.render(o,Ls),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=p-n,ns(e,g,m,3*_,2*_),i.setRenderTarget(e),i.render(o,Ls)}_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,d=this._lodMeshes[i];d.material=c;const u=c.uniforms,f=this._sizeLods[n]-1,p=isFinite(s)?Math.PI/(2*f):2*Math.PI/(2*Mi-1),_=s/p,g=isFinite(s)?1+Math.floor(h*_):Mi;g>Mi&&ue(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${Mi}`);const m=[];let x=0;for(let I=0;I<Mi;++I){const v=I/_,b=Math.exp(-v*v/2);m.push(b),I===0?x+=b:I<g&&(x+=2*b)}for(let I=0;I<m.length;I++)m[I]=m[I]/x;u.envMap.value=e.texture,u.samples.value=g,u.weights.value=m,u.latitudinal.value=a==="latitudinal",o&&(u.poleAxis.value=o);const{_lodMax:y}=this;u.dTheta.value=p,u.mipInt.value=y-n;const M=this._sizeLods[i],E=3*M*(i>y-jn?i-y+jn:0),A=4*(this._cubeSize-M);ns(t,E,A,3*M,2*M),l.setRenderTarget(t),l.render(d,Ls)}}function I_(r){const e=[],t=[],n=[];let i=r;const s=r-jn+1+Dh.length;for(let a=0;a<s;a++){const o=Math.pow(2,i);e.push(o);let l=1/o;a>r-jn?l=Dh[a-r+jn-1]:a===0&&(l=0),t.push(l);const c=1/(o-2),h=-c,d=1+c,u=[h,h,d,h,d,d,h,h,d,d,h,d],f=6,p=6,_=3,g=2,m=1,x=new Float32Array(_*p*f),y=new Float32Array(g*p*f),M=new Float32Array(m*p*f);for(let A=0;A<f;A++){const I=A%3*2/3-1,v=A>2?0:-1,b=[I,v,0,I+2/3,v,0,I+2/3,v+1,0,I,v,0,I+2/3,v+1,0,I,v+1,0];x.set(b,_*p*A),y.set(u,g*p*A);const L=[A,A,A,A,A,A];M.set(L,m*p*A)}const E=new qe;E.setAttribute("position",new ut(x,_)),E.setAttribute("uv",new ut(y,g)),E.setAttribute("faceIndex",new ut(M,m)),n.push(new bt(E,null)),i>jn&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function Fh(r,e,t){const n=new rn(r,e,t);return n.texture.mapping=Ks,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function ns(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function P_(r,e,t){return new dn({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:C_,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:Ra(),fragmentShader:`
3613
3614			precision highp float;
3615			precision highp int;
3616
3617			varying vec3 vOutputDirection;
3618
3619			uniform sampler2D envMap;
3620			uniform float roughness;
3621			uniform float mipInt;
3622
3623			#define ENVMAP_TYPE_CUBE_UV
3624			#include <cube_uv_reflection_fragment>
3625
3626			#define PI 3.14159265359
3627
3628			// Van der Corput radical inverse
3629			float radicalInverse_VdC(uint bits) {
3630				bits = (bits << 16u) | (bits >> 16u);
3631				bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
3632				bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
3633				bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
3634				bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
3635				return float(bits) * 2.3283064365386963e-10; // / 0x100000000
3636			}
3637
3638			// Hammersley sequence
3639			vec2 hammersley(uint i, uint N) {
3640				return vec2(float(i) / float(N), radicalInverse_VdC(i));
3641			}
3642
3643			// GGX VNDF importance sampling (Eric Heitz 2018)
3644			// "Sampling the GGX Distribution of Visible Normals"
3645			// https://jcgt.org/published/0007/04/01/
3646			vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
3647				float alpha = roughness * roughness;
3648
3649				// Section 4.1: Orthonormal basis
3650				vec3 T1 = vec3(1.0, 0.0, 0.0);
3651				vec3 T2 = cross(V, T1);
3652
3653				// Section 4.2: Parameterization of projected area
3654				float r = sqrt(Xi.x);
3655				float phi = 2.0 * PI * Xi.y;
3656				float t1 = r * cos(phi);
3657				float t2 = r * sin(phi);
3658				float s = 0.5 * (1.0 + V.z);
3659				t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
3660
3661				// Section 4.3: Reprojection onto hemisphere
3662				vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;
3663
3664				// Section 3.4: Transform back to ellipsoid configuration
3665				return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
3666			}
3667
3668			void main() {
3669				vec3 N = normalize(vOutputDirection);
3670				vec3 V = N; // Assume view direction equals normal for pre-filtering
3671
3672				vec3 prefilteredColor = vec3(0.0);
3673				float totalWeight = 0.0;
3674
3675				// For very low roughness, just sample the environment directly
3676				if (roughness < 0.001) {
3677					gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
3678					return;
3679				}
3680
3681				// Tangent space basis for VNDF sampling
3682				vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
3683				vec3 tangent = normalize(cross(up, N));
3684				vec3 bitangent = cross(N, tangent);
3685
3686				for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
3687					vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
3688
3689					// For PMREM, V = N, so in tangent space V is always (0, 0, 1)
3690					vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
3691
3692					// Transform H back to world space
3693					vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
3694					vec3 L = normalize(2.0 * dot(V, H) * H - V);
3695
3696					float NdotL = max(dot(N, L), 0.0);
3697
3698					if(NdotL > 0.0) {
3699						// Sample environment at fixed mip level
3700						// VNDF importance sampling handles the distribution filtering
3701						vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
3702
3703						// Weight by NdotL for the split-sum approximation
3704						// VNDF PDF naturally accounts for the visible microfacet distribution
3705						prefilteredColor += sampleColor * NdotL;
3706						totalWeight += NdotL;
3707					}
3708				}
3709
3710				if (totalWeight > 0.0) {
3711					prefilteredColor = prefilteredColor / totalWeight;
3712				}
3713
3714				gl_FragColor = vec4(prefilteredColor, 1.0);
3715			}
3716		`,blending:Fn,depthTest:!1,depthWrite:!1})}function L_(r,e,t){const n=new Float32Array(Mi),i=new C(0,1,0);return new dn({name:"SphericalGaussianBlur",defines:{n:Mi,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:Ra(),fragmentShader:`
3717
3718			precision mediump float;
3719			precision mediump int;
3720
3721			varying vec3 vOutputDirection;
3722
3723			uniform sampler2D envMap;
3724			uniform int samples;
3725			uniform float weights[ n ];
3726			uniform bool latitudinal;
3727			uniform float dTheta;
3728			uniform float mipInt;
3729			uniform vec3 poleAxis;
3730
3731			#define ENVMAP_TYPE_CUBE_UV
3732			#include <cube_uv_reflection_fragment>
3733
3734			vec3 getSample( float theta, vec3 axis ) {
3735
3736				float cosTheta = cos( theta );
3737				// Rodrigues' axis-angle rotation
3738				vec3 sampleDirection = vOutputDirection * cosTheta
3739					+ cross( axis, vOutputDirection ) * sin( theta )
3740					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
3741
3742				return bilinearCubeUV( envMap, sampleDirection, mipInt );
3743
3744			}
3745
3746			void main() {
3747
3748				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
3749
3750				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
3751
3752					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
3753
3754				}
3755
3756				axis = normalize( axis );
3757
3758				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
3759				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
3760
3761				for ( int i = 1; i < n; i++ ) {
3762
3763					if ( i >= samples ) {
3764
3765						break;
3766
3767					}
3768
3769					float theta = dTheta * float( i );
3770					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
3771					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
3772
3773				}
3774
3775			}
3776		`,blending:Fn,depthTest:!1,depthWrite:!1})}function Oh(){return new dn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Ra(),fragmentShader:`
3777
3778			precision mediump float;
3779			precision mediump int;
3780
3781			varying vec3 vOutputDirection;
3782
3783			uniform sampler2D envMap;
3784
3785			#include <common>
3786
3787			void main() {
3788
3789				vec3 outputDirection = normalize( vOutputDirection );
3790				vec2 uv = equirectUv( outputDirection );
3791
3792				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3793
3794			}
3795		`,blending:Fn,depthTest:!1,depthWrite:!1})}function Bh(){return new dn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Ra(),fragmentShader:`
3796
3797			precision mediump float;
3798			precision mediump int;
3799
3800			uniform float flipEnvMap;
3801
3802			varying vec3 vOutputDirection;
3803
3804			uniform samplerCube envMap;
3805
3806			void main() {
3807
3808				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3809
3810			}
3811		`,blending:Fn,depthTest:!1,depthWrite:!1})}function Ra(){return`
3812
3813		precision mediump float;
3814		precision mediump int;
3815
3816		attribute float faceIndex;
3817
3818		varying vec3 vOutputDirection;
3819
3820		// RH coordinate system; PMREM face-indexing convention
3821		vec3 getDirection( vec2 uv, float face ) {
3822
3823			uv = 2.0 * uv - 1.0;
3824
3825			vec3 direction = vec3( uv, 1.0 );
3826
3827			if ( face == 0.0 ) {
3828
3829				direction = direction.zyx; // ( 1, v, u ) pos x
3830
3831			} else if ( face == 1.0 ) {
3832
3833				direction = direction.xzy;
3834				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
3835
3836			} else if ( face == 2.0 ) {
3837
3838				direction.x *= -1.0; // ( -u, v, 1 ) pos z
3839
3840			} else if ( face == 3.0 ) {
3841
3842				direction = direction.zyx;
3843				direction.xz *= -1.0; // ( -1, v, -u ) neg x
3844
3845			} else if ( face == 4.0 ) {
3846
3847				direction = direction.xzy;
3848				direction.xy *= -1.0; // ( -u, -1, v ) neg y
3849
3850			} else if ( face == 5.0 ) {
3851
3852				direction.z *= -1.0; // ( u, v, -1 ) neg z
3853
3854			}
3855
3856			return direction;
3857
3858		}
3859
3860		void main() {
3861
3862			vOutputDirection = getDirection( uv, faceIndex );
3863			gl_Position = vec4( position, 1.0 );
3864
3865		}
3866	`}class Qu extends rn{constructor(e=1,t={}
vendor: 25,954 bytes, lines 3866-3982
3866){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 Sa(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:`
3867
3868				varying vec3 vWorldDirection;
3869
3870				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
3871
3872					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
3873
3874				}
3875
3876				void main() {
3877
3878					vWorldDirection = transformDirection( position, modelMatrix );
3879
3880					#include <begin_vertex>
3881					#include <project_vertex>
3882
3883				}
3884			`,fragmentShader:`
3885
3886				uniform sampler2D tEquirect;
3887
3888				varying vec3 vWorldDirection;
3889
3890				#include <common>
3891
3892				void main() {
3893
3894					vec3 direction = normalize( vWorldDirection );
3895
3896					vec2 sampleUV = equirectUv( direction );
3897
3898					gl_FragColor = texture2D( tEquirect, sampleUV );
3899
3900				}
3901			`},i=new _s(5,5,5),s=new dn({name:"CubemapFromEquirect",uniforms:gs(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Wt,blending:Fn});s.uniforms.tEquirect.value=t;const a=new bt(i,s),o=t.minFilter;return t.minFilter===Un&&(t.minFilter=pt),new mm(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)}}function D_(r){let e=new WeakMap,t=new WeakMap,n=null;function i(u,f=!1){return u==null?null:f?a(u):s(u)}function s(u){if(u&&u.isTexture){const f=u.mapping;if(f===Kr||f===Qr)if(e.has(u)){const p=e.get(u).texture;return o(p,u.mapping)}else{const p=u.image;if(p&&p.height>0){const _=new Qu(p.height);return _.fromEquirectangularTexture(r,u),e.set(u,_),u.addEventListener("dispose",c),o(_.texture,u.mapping)}else return null}}return u}function a(u){if(u&&u.isTexture){const f=u.mapping,p=f===Kr||f===Qr,_=f===Bn||f===Ei;if(p||_){let g=t.get(u);const m=g!==void 0?g.texture.pmremVersion:0;if(u.isRenderTargetTexture&&u.pmremVersion!==m)return n===null&&(n=new Nh(r)),g=p?n.fromEquirectangular(u,g):n.fromCubemap(u,g),g.texture.pmremVersion=u.pmremVersion,t.set(u,g),g.texture;if(g!==void 0)return g.texture;{const x=u.image;return p&&x&&x.height>0||_&&x&&l(x)?(n===null&&(n=new Nh(r)),g=p?n.fromEquirectangular(u):n.fromCubemap(u),g.texture.pmremVersion=u.pmremVersion,t.set(u,g),u.addEventListener("dispose",h),g.texture):null}}}return u}function o(u,f){return f===Kr?u.mapping=Bn:f===Qr&&(u.mapping=Ei),u}function l(u){let f=0;const p=6;for(let _=0;_<p;_++)u[_]!==void 0&&f++;return f===p}function c(u){const f=u.target;f.removeEventListener("dispose",c);const p=e.get(f);p!==void 0&&(e.delete(f),p.dispose())}function h(u){const f=u.target;f.removeEventListener("dispose",h);const p=t.get(f);p!==void 0&&(t.delete(f),p.dispose())}function d(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:d}}function U_(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&&da("WebGLRenderer: "+n+" extension not supported."),i}}}function N_(r,e,t,n){const i={},s=new WeakMap;function a(d){const u=d.target;u.index!==null&&e.remove(u.index);for(const p in u.attributes)e.remove(u.attributes[p]);u.removeEventListener("dispose",a),delete i[u.id];const f=s.get(u);f&&(e.remove(f),s.delete(u)),n.releaseStatesOfGeometry(u),u.isInstancedBufferGeometry===!0&&delete u._maxInstanceCount,t.memory.geometries--}function o(d,u){return i[u.id]===!0||(u.addEventListener("dispose",a),i[u.id]=!0,t.memory.geometries++),u}function l(d){const u=d.attributes;for(const f in u)e.update(u[f],r.ARRAY_BUFFER)}function c(d){const u=[],f=d.index,p=d.attributes.position;let _=0;if(p===void 0)return;if(f!==null){const x=f.array;_=f.version;for(let y=0,M=x.length;y<M;y+=3){const E=x[y+0],A=x[y+1],I=x[y+2];u.push(E,A,A,I,I,E)}}else{const x=p.array;_=p.version;for(let y=0,M=x.length/3-1;y<M;y+=3){const E=y+0,A=y+1,I=y+2;u.push(E,A,A,I,I,E)}}const g=new(p.count>=65535?Su:Mu)(u,1);g.version=_;const m=s.get(d);m&&e.remove(m),s.set(d,g)}function h(d){const u=s.get(d);if(u){const f=d.index;f!==null&&u.version<f.version&&c(d)}else c(d);return s.get(d)}return{get:o,update:l,getWireframeAttribute:h}}function F_(r,e,t){let n;function i(u){n=u}let s,a;function o(u){s=u.type,a=u.bytesPerElement}function l(u,f){r.drawElements(n,f,s,u*a),t.update(f,n,1)}function c(u,f,p){p!==0&&(r.drawElementsInstanced(n,f,s,u*a,p),t.update(f,n,p))}function h(u,f,p){if(p===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,f,0,s,u,0,p);let g=0;for(let m=0;m<p;m++)g+=f[m];t.update(g,n,1)}function d(u,f,p,_){if(p===0)return;const g=e.get("WEBGL_multi_draw");if(g===null)for(let m=0;m<u.length;m++)c(u[m]/a,f[m],_[m]);else{g.multiDrawElementsInstancedWEBGL(n,f,0,s,u,0,_,0,p);let m=0;for(let x=0;x<p;x++)m+=f[x]*_[x];t.update(m,n,1)}}this.setMode=i,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=h,this.renderMultiDrawInstances=d}function O_(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 B_(r,e,t){const n=new WeakMap,i=new ft;function s(a,o,l){const c=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,d=h!==void 0?h.length:0;let u=n.get(o);if(u===void 0||u.count!==d){let b=function(){I.dispose(),n.delete(o),o.removeEventListener("dispose",b)};u!==void 0&&u.texture.dispose();const f=o.morphAttributes.position!==void 0,p=o.morphAttributes.normal!==void 0,_=o.morphAttributes.color!==void 0,g=o.morphAttributes.position||[],m=o.morphAttributes.normal||[],x=o.morphAttributes.color||[];let y=0;f===!0&&(y=1),p===!0&&(y=2),_===!0&&(y=3);let M=o.attributes.position.count*y,E=1;M>e.maxTextureSize&&(E=Math.ceil(M/e.maxTextureSize),M=e.maxTextureSize);const A=new Float32Array(M*E*4*d),I=new Dl(A,M,E,d);I.type=Gt,I.needsUpdate=!0;const v=y*4;for(let L=0;L<d;L++){const P=g[L],N=m[L],O=x[L],G=M*E*4*L;for(let z=0;z<P.count;z++){const B=z*v;f===!0&&(i.fromBufferAttribute(P,z),A[G+B+0]=i.x,A[G+B+1]=i.y,A[G+B+2]=i.z,A[G+B+3]=0),p===!0&&(i.fromBufferAttribute(N,z),A[G+B+4]=i.x,A[G+B+5]=i.y,A[G+B+6]=i.z,A[G+B+7]=0),_===!0&&(i.fromBufferAttribute(O,z),A[G+B+8]=i.x,A[G+B+9]=i.y,A[G+B+10]=i.z,A[G+B+11]=O.itemSize===4?i.w:1)}}u={count:d,texture:I,size:new K(M,E)},n.set(o,u),o.addEventListener("dispose",b)}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 p=o.morphTargetsRelative?1:1-f;l.getUniforms().setValue(r,"morphTargetBaseInfluence",p),l.getUniforms().setValue(r,"morphTargetInfluences",c)}l.getUniforms().setValue(r,"morphTargetsTexture",u.texture,t),l.getUniforms().setValue(r,"morphTargetsTextureSize",u.size)}return{update:s}}function z_(r,e,t,n,i){let s=new WeakMap;function a(c){const h=i.render.frame,d=c.geometry,u=e.get(c,d);if(s.get(u)!==h&&(e.update(u),s.set(u,h)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),s.get(c)!==h&&(t.update(c.instanceMatrix,r.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,r.ARRAY_BUFFER),s.set(c,h))),c.isSkinnedMesh){const f=c.skeleton;s.get(f)!==h&&(f.update(),s.set(f,h))}return u}function o(){s=new WeakMap}function l(c){const h=c.target;h.removeEventListener("dispose",l),n.releaseStatesOfObject(h),t.remove(h.instanceMatrix),h.instanceColor!==null&&t.remove(h.instanceColor)}return{update:a,dispose:o}}const V_={[nu]:"LINEAR_TONE_MAPPING",[iu]:"REINHARD_TONE_MAPPING",[su]:"CINEON_TONE_MAPPING",[ru]:"ACES_FILMIC_TONE_MAPPING",[ou]:"AGX_TONE_MAPPING",[lu]:"NEUTRAL_TONE_MAPPING",[au]:"CUSTOM_TONE_MAPPING"};function k_(r,e,t,n,i){const s=new rn(e,t,{type:r,depthBuffer:n,stencilBuffer:i}),a=new rn(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 Bu({uniforms:{tDiffuse:{value:null}},vertexShader:`
3902			precision highp float;
3903
3904			uniform mat4 modelViewMatrix;
3905			uniform mat4 projectionMatrix;
3906
3907			attribute vec3 position;
3908			attribute vec2 uv;
3909
3910			varying vec2 vUv;
3911
3912			void main() {
3913				vUv = uv;
3914				gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3915			}`,fragmentShader:`
3916			precision highp float;
3917
3918			uniform sampler2D tDiffuse;
3919
3920			varying vec2 vUv;
3921
3922			#include <tonemapping_pars_fragment>
3923			#include <colorspace_pars_fragment>
3924
3925			void main() {
3926				gl_FragColor = texture2D( tDiffuse, vUv );
3927
3928				#ifdef LINEAR_TONE_MAPPING
3929					gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
3930				#elif defined( REINHARD_TONE_MAPPING )
3931					gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
3932				#elif defined( CINEON_TONE_MAPPING )
3933					gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
3934				#elif defined( ACES_FILMIC_TONE_MAPPING )
3935					gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
3936				#elif defined( AGX_TONE_MAPPING )
3937					gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
3938				#elif defined( NEUTRAL_TONE_MAPPING )
3939					gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
3940				#elif defined( CUSTOM_TONE_MAPPING )
3941					gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
3942				#endif
3943
3944				#ifdef SRGB_TRANSFER
3945					gl_FragColor = sRGBTransferOETF( gl_FragColor );
3946				#endif
3947			}`,depthTest:!1,depthWrite:!1}),c=new bt(o,l),h=new Ca(-1,1,1,-1,0,1);let d=null,u=null,f=!1,p,_=null,g=[],m=!1;this.setSize=function(x,y){s.setSize(x,y),a.setSize(x,y);for(let M=0;M<g.length;M++){const E=g[M];E.setSize&&E.setSize(x,y)}},this.setEffects=function(x){g=x,m=g.length>0&&g[0].isRenderPass===!0;const y=s.width,M=s.height;for(let E=0;E<g.length;E++){const A=g[E];A.setSize&&A.setSize(y,M)}},this.begin=function(x,y){if(f||x.toneMapping===Mn&&g.length===0)return!1;if(_=y,y!==null){const M=y.width,E=y.height;(s.width!==M||s.height!==E)&&this.setSize(M,E)}return m===!1&&x.setRenderTarget(s),p=x.toneMapping,x.toneMapping=Mn,!0},this.hasRenderPass=function(){return m},this.end=function(x,y){x.toneMapping=p,f=!0;let M=s,E=a;for(let A=0;A<g.length;A++){const I=g[A];if(I.enabled!==!1&&(I.render(x,E,M,y),I.needsSwap!==!1)){const v=M;M=E,E=v}}if(d!==x.outputColorSpace||u!==x.toneMapping){d=x.outputColorSpace,u=x.toneMapping,l.defines={},je.getTransfer(d)===rt&&(l.defines.SRGB_TRANSFER="");const A=V_[u];A&&(l.defines[A]=""),l.needsUpdate=!0}l.uniforms.tDiffuse.value=M.texture,x.setRenderTarget(_),x.render(c,h),_=null,f=!1},this.isCompositing=function(){return f},this.dispose=function(){s.dispose(),a.dispose(),o.dispose(),l.dispose()}}const ju=new yt,yl=new Ys(1,1),ed=new Dl,td=new Ul,nd=new Sa,zh=[],Vh=[],kh=new Float32Array(16),Gh=new Float32Array(9),Hh=new Float32Array(4);function ys(r,e,t){const n=r[0];if(n<=0||n>0)return r;const i=e*t;let s=zh[i];if(s===void 0&&(s=new Float32Array(i),zh[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 At(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function Ia(r,e){let t=Vh[e];t===void 0&&(t=new Int32Array(e),Vh[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function G_(r,e){const t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function H_(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),At(t,e)}}function W_(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),At(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||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),At(t,e)}}function q_(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(Tt(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),At(t,e)}else{if(Tt(t,n))return;Hh.set(n),r.uniformMatrix2fv(this.addr,!1,Hh),At(t,n)}}function Y_(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(Tt(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),At(t,e)}else{if(Tt(t,n))return;Gh.set(n),r.uniformMatrix3fv(this.addr,!1,Gh),At(t,n)}}function Z_(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(Tt(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),At(t,e)}else{if(Tt(t,n))return;kh.set(n),r.uniformMatrix4fv(this.addr,!1,kh),At(t,n)}}function J_(r,e){const t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function $_(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),At(t,e)}}function K_(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),At(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),At(t,e)}}function j_(r,e){const t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function ex(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),At(t,e)}}function tx(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),At(t,e)}}function nx(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),At(t,e)}}function ix(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?(yl.compareFunction=t.isReversedDepthBuffer()?Pl:Il,s=yl):s=ju,t.setTexture2D(e||s,i)}function sx(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||td,i)}function rx(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||nd,i)}function ax(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||ed,i)}function ox(r){switch(r){case 5126:return G_;case 35664:return H_;case 35665:return W_;case 35666:return X_;case 35674:return q_;case 35675:return Y_;case 35676:return Z_;case 5124:case 35670:return J_;case 35667:case 35671:return $_;case 35668:case 35672:return K_;case 35669:case 35673:return Q_;case 5125:return j_;case 36294:return ex;case 36295:return tx;case 36296:return nx;case 35678:case 36198:case 36298:case 36306:case 35682:return ix;case 35679:case 36299:case 36307:return sx;case 35680:case 36300:case 36308:case 36293:return rx;case 36289:case 36303:case 36311:case 36292:return ax}}function lx(r,e){r.uniform1fv(this.addr,e)}function cx(r,e){const t=ys(e,this.size,2);r.uniform2fv(this.addr,t)}function hx(r,e){const t=ys(e,this.size,3);r.uniform3fv(this.addr,t)}function ux(r,e){const t=ys(e,this.size,4);r.uniform4fv(this.addr,t)}function dx(r,e){const t=ys(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function fx(r,e){const t=ys(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function px(r,e){const t=ys(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function mx(r,e){r.uniform1iv(this.addr,e)}function gx(r,e){r.uniform2iv(this.addr,e)}function _x(r,e){r.uniform3iv(this.addr,e)}function xx(r,e){r.uniform4iv(this.addr,e)}function vx(r,e){r.uniform1uiv(this.addr,e)}function yx(r,e){r.uniform2uiv(this.addr,e)}function Mx(r,e){r.uniform3uiv(this.addr,e)}function Sx(r,e){r.uniform4uiv(this.addr,e)}function bx(r,e,t){const n=this.cache,i=e.length,s=Ia(t,i);Tt(n,s)||(r.uniform1iv(this.addr,s),At(n,s));let a;this.type===r.SAMPLER_2D_SHADOW?a=yl:a=ju;for(let o=0;o!==i;++o)t.setTexture2D(e[o]||a,s[o])}function Tx(r,e,t){const n=this.cache,i=e.length,s=Ia(t,i);Tt(n,s)||(r.uniform1iv(this.addr,s),At(n,s));for(let a=0;a!==i;++a)t.setTexture3D(e[a]||td,s[a])}function Ax(r,e,t){const n=this.cache,i=e.length,s=Ia(t,i);Tt(n,s)||(r.uniform1iv(this.addr,s),At(n,s));for(let a=0;a!==i;++a)t.setTextureCube(e[a]||nd,s[a])}function Ex(r,e,t){const n=this.cache,i=e.length,s=Ia(t,i);Tt(n,s)||(r.uniform1iv(this.addr,s),At(n,s));for(let a=0;a!==i;++a)t.setTexture2DArray(e[a]||ed,s[a])}function wx(r){switch(r){case 5126:return lx;case 35664:return cx;case 35665:return hx;case 35666:return ux;case 35674:return dx;case 35675:return fx;case 35676:return px;case 5124:case 35670:return mx;case 35667:case 35671:return gx;case 35668:case 35672:return _x;case 35669:case 35673:return xx;case 5125:return vx;case 36294:return yx;case 36295:return Mx;case 36296:return Sx;case 35678:case 36198:case 36298:case 36306:case 35682:return bx;case 35679:case 36299:case 36307:return Tx;case 35680:case 36300:case 36308:case 36293:return Ax;case 36289:case 36303:case 36311:case 36292:return Ex}}class Cx{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=ox(t.type)}}class Rx{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=wx(t.type)}}class Ix{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 bo=/(\w+)(\])?(\[|\.)?/g;function Wh(r,e){r.seq.push(e),r.map[e.id]=e}function Px(r,e,t){const n=r.name,i=n.length;for(bo.lastIndex=0;;){const s=bo.exec(n),a=bo.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===i){Wh(t,c===void 0?new Cx(o,r,e):new Rx(o,r,e));break}else{let d=t.map[o];d===void 0&&(d=new Ix(o),Wh(t,d)),t=d}}}class sa{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);Px(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 Xh(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const Lx=37297;let Dx=0;function Ux(r,e){const t=r.split(`
3948`),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(`
3949`)}const qh=new Ze;function Nx(r){je._getMatrix(qh,je.workingColorSpace,r);const e=`mat3( ${qh.elements.map(t=>t.toFixed(4))} )`;switch(je.getTransfer(r)){case ca:return[e,"LinearTransferOETF"];case rt:return[e,"sRGBTransferOETF"];default:return ue("WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function Yh(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()+`
3950
3951`+s+`
3952
3953`+Ux(r.getShaderSource(e),o)}else return s}function Fx(r,e){const t=Nx(e);return[`vec4 ${r}( vec4 value ) {`,`	return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
3954`)}const Ox={[nu]:"Linear",[iu]:"Reinhard",[su]:"Cineon",[ru]:"ACESFilmic",[ou]:"AgX",[lu]:"Neutral",[au]:"Custom"};function Bx(r,e){const t=Ox[e];return t===void 0?(ue("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+r+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Jr=new C;function zx(){je.getLuminanceCoefficients(Jr);const r=Jr.x.toFixed(4),e=Jr.y.toFixed(4),t=Jr.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${r}, ${e}, ${t} );`,"	return dot( weights, rgb );","}"].join(`
3955`)}function Vx(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(zs).join(`
3956`)}function kx(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
3957`)}function Gx(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 zs(r){return r!==""}function Zh(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 Jh(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Hx=/^[ \t]*#include +<([\w\d./]+)>/gm;function Ml(r){return r.replace(Hx,Xx)}const Wx=new Map;function Xx(r,e){let t=$e[e];if(t===void 0){const n=Wx.get(e);if(n!==void 0)t=$e[n],ue('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return Ml(t)}const qx=/#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 $h(r){return r.replace(qx,Yx)}function Yx(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 Kh(r){let e=`precision ${r.precision} float;
3958	precision ${r.precision} int;
3959	precision ${r.precision} sampler2D;
3960	precision ${r.precision} samplerCube;
3961	precision ${r.precision} sampler3D;
3962	precision ${r.precision} sampler2DArray;
3963	precision ${r.precision} sampler2DShadow;
3964	precision ${r.precision} samplerCubeShadow;
3965	precision ${r.precision} sampler2DArrayShadow;
3966	precision ${r.precision} isampler2D;
3967	precision ${r.precision} isampler3D;
3968	precision ${r.precision} isamplerCube;
3969	precision ${r.precision} isampler2DArray;
3970	precision ${r.precision} usampler2D;
3971	precision ${r.precision} usampler3D;
3972	precision ${r.precision} usamplerCube;
3973	precision ${r.precision} usampler2DArray;
3974	`;return r.precision==="highp"?e+=`
3975#define HIGH_PRECISION`:r.precision==="mediump"?e+=`
3976#define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=`
3977#define LOW_PRECISION`),e}const Zx={[$r]:"SHADOWMAP_TYPE_PCF",[Us]:"SHADOWMAP_TYPE_VSM"};function Jx(r){return Zx[r.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const $x={[Bn]:"ENVMAP_TYPE_CUBE",[Ei]:"ENVMAP_TYPE_CUBE",[Ks]:"ENVMAP_TYPE_CUBE_UV"};function Kx(r){return r.envMap===!1?"ENVMAP_TYPE_CUBE":$x[r.envMapMode]||"ENVMAP_TYPE_CUBE"}const Qx={[Ei]:"ENVMAP_MODE_REFRACTION"};function jx(r){return r.envMap===!1?"ENVMAP_MODE_REFLECTION":Qx[r.envMapMode]||"ENVMAP_MODE_REFLECTION"}const ev={[ya]:"ENVMAP_BLENDING_MULTIPLY",[Pd]:"ENVMAP_BLENDING_MIX",[Ld]:"ENVMAP_BLENDING_ADD"};function tv(r){return r.envMap===!1?"ENVMAP_BLENDING_NONE":ev[r.combine]||"ENVMAP_BLENDING_NONE"}function nv(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),112)),texelHeight:n,maxMip:t}}function iv(r,e,t,n){const i=r.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=Jx(t),c=Kx(t),h=jx(t),d=tv(t),u=nv(t),f=Vx(t),p=kx(s),_=i.createProgram();let g,m,x=t.glslVersion?"#version "+t.glslVersion+`
3978`:"";t.isRawShaderMaterial?(g=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p].filter(zs).join(`
3979`),g.length>0&&(g+=`
3980`),m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p].filter(zs).join(`
3981`),m.length>0&&(m+=`
3982`)):(g=[Kh(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p,t.extensionCl
vendor: 6,474 bytes, lines 3982-3984
3982ipCullDistance?"#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_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.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",`
3983`].filter(zs).join(`
3984`),m=[Kh(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p,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 "+d:"",u?"#define CUBEUV_TEXEL_WIDTH "+u.texelWidth:"",u?"#define CUBEUV_TEXEL_HEIGHT "+u.texelHeight:"",u?"#define CUBEUV_MAX_MIP "+u.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
3984IDESCENCE":"",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?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#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!==Mn?"#define TONE_MAPPING":"",t.toneMapping!==Mn?$e.tonemapping_pars_fragment:"",t.toneMapping!==Mn?Bx("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",$e.colorspace_pars_fragment,Fx("linearToOutputTexel",t.outputColorSpace),zx(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
3985`].filter(zs).join(`
3986`)),a=Ml(a),a=Zh(a,t),a=Jh(a,t),o=Ml(o),o=Zh(o,t),o=Jh(o,t),a=$h(a),o=$h(o),t.isRawShaderMaterial!==!0&&(x=`#version 300 es
3987`,g=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(`
3988`)+`
3989`+g,m=["#define varying in",t.glslVersion===Tc?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Tc?"":"#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(`
3990`)+`
3991`+m);const y=x+g+a,M=x+m+o,E=Xh(i,i.VERTEX_SHADER,y),A=Xh(i,i.FRAGMENT_SHADER,M);i.attachShader(_,E),i.attachShader(_,A),t.index0AttributeName!==void 0?i.bindAttribLocation(_,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(_,0,"position"),i.linkProgram(_);function I(P){if(r.debug.checkShaderErrors){const N=i.getProgramInfoLog(_)||"",O=i.getShaderInfoLog(E)||"",G=i.getShaderInfoLog(A)||"",z=N.trim(),B=O.trim(),V=G.trim();let ie=!0,j=!0;if(i.getProgramParameter(_,i.LINK_STATUS)===!1)if(ie=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,_,E,A);else{const ge=Yh(i,E,"vertex"),xe=Yh(i,A,"fragment");Le("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,i.VALIDATE_STATUS)+`
3992
3993Material Name: `+P.name+`
3994Material Type: `+P.type+`
3995
3996Program Info Log: `+z+`
3997`+ge+`
3998`+xe)}else z!==""?ue("WebGLProgram: Program Info Log:",z):(B===""||V==="")&&(j=!1);j&&(P.diagnostics={runnable:ie,programLog:z,vertexShader:{log:B,prefix:g},fragmentShader:{log:V,prefix:m}})}i.deleteShader(E),i.deleteShader(A),v=new sa(i,_),b=Gx(i,_)}let v;this.getUniforms=function(){return v===void 0&&I(this),v};let b;this.getAttributes=function(){return b===void 0&&I(this),b};let L=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return L===!1&&(L=i.getProgramParameter(_,Lx)),L},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Dx++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=E,this.fragmentShader=A,this}let sv=0;class rv{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 av(e),t.set(e,n)),n}}class av{constructor(e){this.id=sv++,this.code=e,this.usedTimes=0}}
vendor: 20,500 bytes, lines 3998-4025
3998function ov(r,e,t,n,i,s){const a=new Nl,o=new rv,l=new Set,c=[],h=new Map,d=n.logarithmicDepthBuffer;let u=n.precision;const f={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 p(v){return l.add(v),v===0?"uv":`uv${v}`}function _(v,b,L,P,N){const O=P.fog,G=N.geometry,z=v.isMeshStandardMaterial||v.isMeshLambertMaterial||v.isMeshPhongMaterial?P.environment:null,B=v.isMeshStandardMaterial||v.isMeshLambertMaterial&&!v.envMap||v.isMeshPhongMaterial&&!v.envMap,V=e.get(v.envMap||z,B),ie=V&&V.mapping===Ks?V.image.height:null,j=f[v.type];v.precision!==null&&(u=n.getMaxPrecision(v.precision),u!==v.precision&&ue("WebGLProgram.getParameters:",v.precision,"not supported, using",u,"instead."));const ge=G.morphAttributes.position||G.morphAttributes.normal||G.morphAttributes.color,xe=ge!==void 0?ge.length:0;let _e=0;G.morphAttributes.position!==void 0&&(_e=1),G.morphAttributes.normal!==void 0&&(_e=2),G.morphAttributes.color!==void 0&&(_e=3);let ke,it,at,Z;if(j){const st=vn[j];ke=st.vertexShader,it=st.fragmentShader}else ke=v.vertexShader,it=v.fragmentShader,o.update(v),at=o.getVertexShaderID(v),Z=o.getFragmentShaderID(v);const ae=r.getRenderTarget(),oe=r.state.buffers.depth.getReversed(),Oe=N.isInstancedMesh===!0,Ne=N.isBatchedMesh===!0,Ge=!!v.map,ot=!!v.matcap,Xe=!!V,$=!!v.aoMap,te=!!v.lightMap,Q=!!v.bumpMap,de=!!v.normalMap,R=!!v.displacementMap,Fe=!!v.emissiveMap,ve=!!v.metalnessMap,Be=!!v.roughnessMap,le=v.anisotropy>0,w=v.clearcoat>0,S=v.dispersion>0,U=v.iridescence>0,X=v.sheen>0,J=v.transmission>0,q=le&&!!v.anisotropyMap,Ae=w&&!!v.clearcoatMap,ce=w&&!!v.clearcoatNormalMap,De=w&&!!v.clearcoatRoughnessMap,ze=U&&!!v.iridescenceMap,ee=U&&!!v.iridescenceThicknessMap,se=X&&!!v.sheenColorMap,Ee=X&&!!v.sheenRoughnessMap,Ce=!!v.specularMap,ye=!!v.specularColorMap,Ke=!!v.specularIntensityMap,D=J&&!!v.transmissionMap,he=J&&!!v.thicknessMap,re=!!v.gradientMap,be=!!v.alphaMap,ne=v.alphaTest>0,Y=!!v.alphaHash,we=!!v.extensions;let We=Mn;v.toneMapped&&(ae===null||ae.isXRRenderTarget===!0)&&(We=r.toneMapping);const dt={shaderID:j,shaderType:v.type,shaderName:v.name,vertexShader:ke,fragmentShader:it,defines:v.defines,customVertexShaderID:at,customFragmentShaderID:Z,isRawShaderMaterial:v.isRawShaderMaterial===!0,glslVersion:v.glslVersion,precision:u,batching:Ne,batchingColor:Ne&&N._colorsTexture!==null,instancing:Oe,instancingColor:Oe&&N.instanceColor!==null,instancingMorph:Oe&&N.morphTexture!==null,outputColorSpace:ae===null?r.outputColorSpace:ae.isXRRenderTarget===!0?ae.texture.colorSpace:us,alphaToCoverage:!!v.alphaToCoverage,map:Ge,matcap:ot,envMap:Xe,envMapMode:Xe&&V.mapping,envMapCubeUVHeight:ie,aoMap:$,lightMap:te,bumpMap:Q,normalMap:de,displacementMap:R,emissiveMap:Fe,normalMapObjectSpace:de&&v.normalMapType===Bd,normalMapTangentSpace:de&&v.normalMapType===Ri,metalnessMap:ve,roughnessMap:Be,anisotropy:le,anisotropyMap:q,clearcoat:w,clearcoatMap:Ae,clearcoatNormalMap:ce,clearcoatRoughnessMap:De,dispersion:S,iridescence:U,iridescenceMap:ze,iridescenceThicknessMap:ee,sheen:X,sheenColorMap:se,sheenRoughnessMap:Ee,specularMap:Ce,specularColorMap:ye,specularIntensityMap:Ke,transmission:J,transmissionMap:D,thicknessMap:he,gradientMap:re,opaque:v.transparent===!1&&v.blending===as&&v.alphaToCoverage===!1,alphaMap:be,alphaTest:ne,alphaHash:Y,combine:v.combine,mapUv:Ge&&p(v.map.channel),aoMapUv:$&&p(v.aoMap.channel),lightMapUv:te&&p(v.lightMap.channel),bumpMapUv:Q&&p(v.bumpMap.channel),normalMapUv:de&&p(v.normalMap.channel),displacementMapUv:R&&p(v.displacementMap.channel),emissiveMapUv:Fe&&p(v.emissiveMap.channel),metalnessMapUv:ve&&p(v.metalnessMap.channel),roughnessMapUv:Be&&p(v.roughnessMap.channel),anisotropyMapUv:q&&p(v.anisotropyMap.channel),clearcoatMapUv:Ae&&p(v.clearcoatMap.channel),clearcoatNormalMapUv:ce&&p(v.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:De&&p(v.clearcoatRoughnessMap.channel),iridescenceMapUv:ze&&p(v.iridescenceMap.channel),iridescenceThicknessMapUv:ee&&p(v.iridescenceThicknessMap.channel),sheenColorMapUv:se&&p(v.sheenColorMap.channel),sheenRoughnessMapUv:Ee&&p(v.sheenRoughnessMap.channel),specularMapUv:Ce&&p(v.specularMap.channel),specularColorMapUv:ye&&p(v.specularColorMap.channel),specularIntensityMapUv:Ke&&p(v.specularIntensityMap.channel),transmissionMapUv:D&&p(v.transmissionMap.channel),thicknessMapUv:he&&p(v.thicknessMap.channel),alphaMapUv:be&&p(v.alphaMap.channel),vertexTangents:!!G.attributes.tangent&&(de||le),vertexColors:v.vertexColors,vertexAlphas:v.vertexColors===!0&&!!G.attributes.color&&G.attributes.color.itemSize===4,pointsUvs:N.isPoints===!0&&!!G.attributes.uv&&(Ge||be),fog:!!O,useFog:v.fog===!0,fogExp2:!!O&&O.isFogExp2,flatShading:v.wireframe===!1&&(v.flatShading===!0||G.attributes.normal===void 0&&de===!1&&(v.isMeshLambertMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isMeshPhysicalMaterial)),sizeAttenuation:v.sizeAttenuation===!0,logarithmicDepthBuffer:d,reversedDepthBuffer:oe,skinning:N.isSkinnedMesh===!0,morphTargets:G.morphAttributes.position!==void 0,morphNormals:G.morphAttributes.normal!==void 0,morphColors:G.morphAttributes.color!==void 0,morphTargetsCount:xe,morphTextureStride:_e,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:s.numPlanes,numClipIntersection:s.numIntersection,dithering:v.dithering,shadowMapEnabled:r.shadowMap.enabled&&L.length>0,shadowMapType:r.shadowMap.type,toneMapping:We,decodeVideoTexture:Ge&&v.map.isVideoTexture===!0&&je.getTransfer(v.map.colorSpace)===rt,decodeVideoTextureEmissive:Fe&&v.emissiveMap.isVideoTexture===!0&&je.getTransfer(v.emissiveMap.colorSpace)===rt,premultipliedAlpha:v.premultipliedAlpha,doubleSided:v.side===Ln,flipSided:v.side===Wt,useDepthPacking:v.depthPacking>=0,depthPacking:v.depthPacking||0,index0AttributeName:v.index0AttributeName,extensionClipCullDistance:we&&v.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(we&&v.extensions.multiDraw===!0||Ne)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:v.customProgramCacheKey()};return dt.vertexUv1s=l.has(1),dt.vertexUv2s=l.has(2),dt.vertexUv3s=l.has(3),l.clear(),dt}function g(v){const b=[];if(v.shaderID?b.push(v.shaderID):(b.push(v.customVertexShaderID),b.push(v.customFragmentShaderID)),v.defines!==void 0)for(const L in v.defines)b.push(L),b.push(v.defines[L]);return v.isRawShaderMaterial===!1&&(m(b,v),x(b,v),b.push(r.outputColorSpace)),b.push(v.customProgramCacheKey),b.join()}function m(v,b){v.push(b.precision),v.push(b.outputColorSpace),v.push(b.envMapMode),v.push(b.envMapCubeUVHeight),v.push(b.mapUv),v.push(b.alphaMapUv),v.push(b.lightMapUv),v.push(b.aoMapUv),v.push(b.bumpMapUv),v.push(b.normalMapUv),v.push(b.displacementMapUv),v.push(b.emissiveMapUv),v.push(b.metalnessMapUv),v.push(b.roughnessMapUv),v.push(b.anisotropyMapUv),v.push(b.clearcoatMapUv),v.push(b.clearcoatNormalMapUv),v.push(b.clearcoatRoughnessMapUv),v.push(b.iridescenceMapUv),v.push(b.iridescenceThicknessMapUv),v.push(b.sheenColorMapUv),v.push(b.sheenRoughnessMapUv),v.push(b.specularMapUv),v.push(b.specularColorMapUv),v.push(b.specularIntensityMapUv),v.push(b.transmissionMapUv),v.push(b.thicknessMapUv),v.push(b.combine),v.push(b.fogExp2),v.push(b.sizeAttenuation),v.push(b.morphTargetsCount),v.push(b.morphAttributeCount),v.push(b.numDirLights),v.push(b.numPointLights),v.push(b.numSpotLights),v.push(b.numSpotLightMaps),v.push(b.numHemiLights),v.push(b.numRectAreaLights),v.push(b.numDirLightShadows),v.push(b.numPointLightShadows),v.push(b.numSpotLightShadows),v.push(b.numSpotLightShadowsWithMaps),v.push(b.numLightProbes),v.push(b.shadowMapType),v.push(b.toneMapping),v.push(b.numClippingPlanes),v.push(b.numClipIntersection),v.push(b.depthPacking)}function x(v,b){a.disableAll(),b.instancing&&a.enable(0),b.instancingColor&&a.enable(1),b.instancingMorph&&a.enable(2),b.matcap&&a.enable(3),b.envMap&&a.enable(4),b.normalMapObjectSpace&&a.enable(5),b.normalMapTangentSpace&&a.enable(6),b.clearcoat&&a.enable(7),b.iridescence&&a.enable(8),b.alphaTest&&a.enable(9),b.vertexColors&&a.enable(10),b.vertexAlphas&&a.enable(11),b.vertexUv1s&&a.enable(12),b.vertexUv2s&&a.enable(13),b.vertexUv3s&&a.enable(14),b.vertexTangents&&a.enable(15),b.anisotropy&&a.enable(16),b.alphaHash&&a.enable(17),b.batching&&a.enable(18),b.dispersion&&a.enable(19),b.batchingColor&&a.enable(20),b.gradientMap&&a.enable(21),v.push(a.mask),a.disableAll(),b.fog&&a.enable(0),b.useFog&&a.enable(1),b.flatShading&&a.enable(2),b.logarithmicDepthBuffer&&a.enable(3),b.reversedDepthBuffer&&a.enable(4),b.skinning&&a.enable(5),b.morphTargets&&a.enable(6),b.morphNormals&&a.enable(7),b.morphColors&&a.enable(8),b.premultipliedAlpha&&a.enable(9),b.shadowMapEnabled&&a.enable(10),b.doubleSided&&a.enable(11),b.flipSided&&a.enable(12),b.useDepthPacking&&a.enable(13),b.dithering&&a.enable(14),b.transmission&&a.enable(15),b.sheen&&a.enable(16),b.opaque&&a.enable(17),b.pointsUvs&&a.enable(18),b.decodeVideoTexture&&a.enable(19),b.decodeVideoTextureEmissive&&a.enable(20),b.alphaToCoverage&&a.enable(21),v.push(a.mask)}function y(v){const b=f[v.type];let L;if(b){const P=vn[b];L=Fp.clone(P.uniforms)}else L=v.uniforms;return L}function M(v,b){let L=h.get(b);return L!==void 0?++L.usedTimes:(L=new iv(r,b,v,i),c.push(L),h.set(b,L)),L}function E(v){if(--v.usedTimes===0){const b=c.indexOf(v);c[b]=c[c.length-1],c.pop(),h.delete(v.cacheKey),v.destroy()}}function A(v){o.remove(v)}function I(){o.dispose()}return{getParameters:_,getProgramCacheKey:g,getUniforms:y,acquireProgram:M,releaseProgram:E,releaseShaderCache:A,programs:c,dispose:I}}function lv(){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 cv(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.materialVariant!==e.materialVariant?r.materialVariant-e.materialVariant:r.z!==e.z?r.z-e.z:r.id-e.id}function Qh(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 jh(){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){let f=0;return u.isInstancedMesh&&(f+=2),u.isSkinnedMesh&&(f+=1),f}function o(u,f,p,_,g,m){let x=r[e];return x===void 0?(x={id:u.id,object:u,geometry:f,material:p,materialVariant:a(u),groupOrder:_,renderOrder:u.renderOrder,z:g,group:m},r[e]=x):(x.id=u.id,x.object=u,x.geometry=f,x.material=p,x.materialVariant=a(u),x.groupOrder=_,x.renderOrder=u.renderOrder,x.z=g,x.group=m),e++,x}function l(u,f,p,_,g,m){const x=o(u,f,p,_,g,m);p.transmission>0?n.push(x):p.transparent===!0?i.push(x):t.push(x)}function c(u,f,p,_,g,m){const x=o(u,f,p,_,g,m);p.transmission>0?n.unshift(x):p.transparent===!0?i.unshift(x):t.unshift(x)}function h(u,f){t.length>1&&t.sort(u||cv),n.length>1&&n.sort(f||Qh),i.length>1&&i.sort(f||Qh)}function d(){for(let u=e,f=r.length;u<f;u++){const p=r[u];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:t,transmissive:n,transparent:i,init:s,push:l,unshift:c,finish:d,sort:h}}function hv(){let r=new WeakMap;function e(n,i){const s=r.get(n);let a;return s===void 0?(a=new jh,r.set(n,[a])):i>=s.length?(a=new jh,s.push(a)):a=s[i],a}function t(){r=new WeakMap}return{get:e,dispose:t}}function uv(){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 C,color:new Me};break;case"SpotLight":t={position:new C,direction:new C,color:new Me,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new C,color:new Me,distance:0,decay:0};break;case"HemisphereLight":t={direction:new C,skyColor:new Me,groundColor:new Me};break;case"RectAreaLight":t={color:new Me,position:new C,halfWidth:new C,halfHeight:new C};break}return r[e.id]=t,t}}}function dv(){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 fv=0;function pv(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function mv(r){const e=new uv,t=dv(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)n.probe.push(new C);const i=new C,s=new He,a=new He;function o(c){let h=0,d=0,u=0;for(let b=0;b<9;b++)n.probe[b].set(0,0,0);let f=0,p=0,_=0,g=0,m=0,x=0,y=0,M=0,E=0,A=0,I=0;c.sort(pv);for(let b=0,L=c.length;b<L;b++){const P=c[b],N=P.color,O=P.intensity,G=P.distance;let z=null;if(P.shadow&&P.shadow.map&&(P.shadow.map.texture.format===hs?z=P.shadow.map.texture:z=P.shadow.map.depthTexture||P.shadow.map.texture),P.isAmbientLight)h+=N.r*O,d+=N.g*O,u+=N.b*O;else if(P.isLightProbe){for(let B=0;B<9;B++)n.probe[B].addScaledVector(P.sh.coefficients[B],O);I++}else if(P.isDirectionalLight){const B=e.get(P);if(B.color.copy(P.color).multiplyScalar(P.intensity),P.castShadow){const V=P.shadow,ie=t.get(P);ie.shadowIntensity=V.intensity,ie.shadowBias=V.bias,ie.shadowNormalBias=V.normalBias,ie.shadowRadius=V.radius,ie.shadowMapSize=V.mapSize,n.directionalShadow[f]=ie,n.directionalShadowMap[f]=z,n.directionalShadowMatrix[f]=P.shadow.matrix,x++}n.directional[f]=B,f++}else if(P.isSpotLight){const B=e.get(P);B.position.setFromMatrixPosition(P.matrixWorld),B.color.copy(N).multiplyScalar(O),B.distance=G,B.coneCos=Math.cos(P.angle),B.penumbraCos=Math.cos(P.angle*(1-P.penumbra)),B.decay=P.decay,n.spot[_]=B;const V=P.shadow;if(P.map&&(n.spotLightMap[E]=P.map,E++,V.updateMatrices(P),P.castShadow&&A++),n.spotLightMatrix[_]=V.matrix,P.castShadow){const ie=t.get(P);ie.shadowIntensity=V.intensity,ie.shadowBias=V.bias,ie.shadowNormalBias=V.normalBias,ie.shadowRadius=V.radius,ie.shadowMapSize=V.mapSize,n.spotShadow[_]=ie,n.spotShadowMap[_]=z,M++}_++}else if(P.isRectAreaLight){const B=e.get(P);B.color.copy(N).multiplyScalar(O),B.halfWidth.set(P.width*.5,0,0),B.halfHeight.set(0,P.height*.5,0),n.rectArea[g]=B,g++}else if(P.isPointLight){const B=e.get(P);if(B.color.copy(P.color).multiplyScalar(P.intensity),B.distance=P.distance,B.decay=P.decay,P.castShadow){const V=P.shadow,ie=t.get(P);ie.shadowIntensity=V.intensity,ie.shadowBias=V.bias,ie.shadowNormalBias=V.normalBias,ie.shadowRadius=V.radius,ie.shadowMapSize=V.mapSize,ie.shadowCameraNear=V.camera.near,ie.shadowCameraFar=V.camera.far,n.pointShadow[p]=ie,n.pointShadowMap[p]=z,n.pointShadowMatrix[p]=P.shadow.matrix,y++}n.point[p]=B,p++}else if(P.isHemisphereLight){const B=e.get(P);B.skyColor.copy(P.color).multiplyScalar(O),B.groundColor.copy(P.groundColor).multiplyScalar(O),n.hemi[m]=B,m++}}g>0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=fe.LTC_FLOAT_1,n.rectAreaLTC2=fe.LTC_FLOAT_2):(n.rectAreaLTC1=fe.LTC_HALF_1,n.rectAreaLTC2=fe.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=d,n.ambient[2]=u;const v=n.hash;(v.directionalLength!==f||v.pointLength!==p||v.spotLength!==_||v.rectAreaLength!==g||v.hemiLength!==m||v.numDirectionalShadows!==x||v.numPointShadows!==y||v.numSpotShadows!==M||v.numSpotMaps!==E||v.numLightProbes!==I)&&(n.directional.length=f,n.spot.length=_,n.rectArea.length=g,n.point.length=p,n.hemi.length=m,n.directionalShadow.length=x,n.directionalShadowMap.length=x,n.pointShadow.length=y,n.pointShadowMap.length=y,n.spotShadow.length=M,n.spotShadowMap.length=M,n.directionalShadowMatrix.length=x,n.pointShadowMatrix.length=y,n.spotLightMatrix.length=M+E-A,n.spotLightMap.length=E,n.numSpotLightShadowsWithMaps=A,n.numLightProbes=I,v.directionalLength=f,v.pointLength=p,v.spotLength=_,v.rectAreaLength=g,v.hemiLength=m,v.numDirectionalShadows=x,v.numPointShadows=y,v.numSpotShadows=M,v.numSpotMaps=E,v.numLightProbes=I,n.version=fv++)}function l(c,h){let d=0,u=0,f=0,p=0,_=0;const g=h.matrixWorldInverse;for(let m=0,x=c.length;m<x;m++){const y=c[m];if(y.isDirectionalLight){const M=n.directional[d];M.direction.setFromMatrixPosition(y.matrixWorld),i.setFromMatrixPosition(y.target.matrixWorld),M.direction.sub(i),M.direction.transformDirection(g),d++}else if(y.isSpotLight){const M=n.spot[f];M.position.setFromMatrixPosition(y.matrixWorld),M.position.applyMatrix4(g),M.direction.setFromMatrixPosition(y.matrixWorld),i.setFromMatrixPosition(y.target.matrixWorld),M.direction.sub(i),M.direction.transformDirection(g),f++}else if(y.isRectAreaLight){const M=n.rectArea[p];M.position.setFromMatrixPosition(y.matrixWorld),M.position.applyMatrix4(g),a.identity(),s.copy(y.matrixWorld),s.premultiply(g),a.extractRotation(s),M.halfWidth.set(y.width*.5,0,0),M.halfHeight.set(0,y.height*.5,0),M.halfWidth.applyMatrix4(a),M.halfHeight.applyMatrix4(a),p++}else if(y.isPointLight){const M=n.point[u];M.position.setFromMatrixPosition(y.matrixWorld),M.position.applyMatrix4(g),u++}else if(y.isHemisphereLight){const M=n.hemi[_];M.direction.setFromMatrixPosition(y.matrixWorld),M.direction.transformDirection(g),_++}}}return{setup:o,setupView:l,state:n}}function eu(r){const e=new mv(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 gv(r){let e=new WeakMap;function t(i,s=0){const a=e.get(i);let o;return a===void 0?(o=new eu(r),e.set(i,[o])):s>=a.length?(o=new eu(r),a.push(o)):o=a[s],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const _v=`void main() {
3999	gl_Position = vec4( position, 1.0 );
4000}`,xv=`uniform sampler2D shadow_pass;
4001uniform vec2 resolution;
4002uniform float radius;
4003void main() {
4004	const float samples = float( VSM_SAMPLES );
4005	float mean = 0.0;
4006	float squared_mean = 0.0;
4007	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
4008	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
4009	for ( float i = 0.0; i < samples; i ++ ) {
4010		float uvOffset = uvStart + i * uvStride;
4011		#ifdef HORIZONTAL_PASS
4012			vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;
4013			mean += distribution.x;
4014			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
4015		#else
4016			float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;
4017			mean += depth;
4018			squared_mean += depth * depth;
4019		#endif
4020	}
4021	mean = mean / samples;
4022	squared_mean = squared_mean / samples;
4023	float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
4024	gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
4025}`,vv=[new C(1,0,0),new C(-1,0,0),new C(0,1,0),new C(0,-1,0),new C(0,0,1),new C(0,0,-1)],yv=[new C(0,-1,0),new C(0,-1,0),new C(0,0,1),new C(0,0,-1),new C(0,-1,0),new C(0,-1,0)],tu=ne
vendor: 4,248 bytes, line 4025
4025w He,Ds=new C,To=new C;function Mv(r,e,t){let n=new js;const i=new K,s=new K,a=new ft,o=new Vu,l=new ku,c={},h=t.maxTextureSize,d={[ei]:Wt,[Wt]:ei,[Ln]:Ln},u=new dn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new K},radius:{value:4}},vertexShader:_v,fragmentShader:xv}),f=u.clone();f.defines.HORIZONTAL_PASS=1;const p=new qe;p.setAttribute("position",new ut(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new bt(p,u),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=$r;let m=this.type;this.render=function(A,I,v){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||A.length===0)return;this.type===dd&&(ue("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=$r);const b=r.getRenderTarget(),L=r.getActiveCubeFace(),P=r.getActiveMipmapLevel(),N=r.state;N.setBlending(Fn),N.buffers.depth.getReversed()===!0?N.buffers.color.setClear(0,0,0,0):N.buffers.color.setClear(1,1,1,1),N.buffers.depth.setTest(!0),N.setScissorTest(!1);const O=m!==this.type;O&&I.traverse(function(G){G.material&&(Array.isArray(G.material)?G.material.forEach(z=>z.needsUpdate=!0):G.material.needsUpdate=!0)});for(let G=0,z=A.length;G<z;G++){const B=A[G],V=B.shadow;if(V===void 0){ue("WebGLShadowMap:",B,"has no shadow.");continue}if(V.autoUpdate===!1&&V.needsUpdate===!1)continue;i.copy(V.mapSize);const ie=V.getFrameExtents();i.multiply(ie),s.copy(V.mapSize),(i.x>h||i.y>h)&&(i.x>h&&(s.x=Math.floor(h/ie.x),i.x=s.x*ie.x,V.mapSize.x=s.x),i.y>h&&(s.y=Math.floor(h/ie.y),i.y=s.y*ie.y,V.mapSize.y=s.y));const j=r.state.buffers.depth.getReversed();if(V.camera._reversedDepth=j,V.map===null||O===!0){if(V.map!==null&&(V.map.depthTexture!==null&&(V.map.depthTexture.dispose(),V.map.depthTexture=null),V.map.dispose()),this.type===Us){if(B.isPointLight){ue("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}V.map=new rn(i.x,i.y,{format:hs,type:zn,minFilter:pt,magFilter:pt,generateMipmaps:!1}),V.map.texture.name=B.name+".shadowMap",V.map.depthTexture=new Ys(i.x,i.y,Gt),V.map.depthTexture.name=B.name+".shadowMapDepth",V.map.depthTexture.format=Vn,V.map.depthTexture.compareFunction=null,V.map.depthTexture.minFilter=St,V.map.depthTexture.magFilter=St}else B.isPointLight?(V.map=new Qu(i.x),V.map.depthTexture=new Qf(i.x,un)):(V.map=new rn(i.x,i.y),V.map.depthTexture=new Ys(i.x,i.y,un)),V.map.depthTexture.name=B.name+".shadowMap",V.map.depthTexture.format=Vn,this.type===$r?(V.map.depthTexture.compareFunction=j?Pl:Il,V.map.depthTexture.minFilter=pt,V.map.depthTexture.magFilter=pt):(V.map.depthTexture.compareFunction=null,V.map.depthTexture.minFilter=St,V.map.depthTexture.magFilter=St);V.camera.updateProjectionMatrix()}const ge=V.map.isWebGLCubeRenderTarget?6:1;for(let xe=0;xe<ge;xe++){if(V.map.isWebGLCubeRenderTarget)r.setRenderTarget(V.map,xe),r.clear();else{xe===0&&(r.setRenderTarget(V.map),r.clear());const _e=V.getViewport(xe);a.set(s.x*_e.x,s.y*_e.y,s.x*_e.z,s.y*_e.w),N.viewport(a)}if(B.isPointLight){const _e=V.camera,ke=V.matrix,it=B.distance||_e.far;it!==_e.far&&(_e.far=it,_e.updateProjectionMatrix()),Ds.setFromMatrixPosition(B.matrixWorld),_e.position.copy(Ds),To.copy(_e.position),To.add(vv[xe]),_e.up.copy(yv[xe]),_e.lookAt(To),_e.updateMatrixWorld(),ke.makeTranslation(-Ds.x,-Ds.y,-Ds.z),tu.multiplyMatrices(_e.projectionMatrix,_e.matrixWorldInverse),V._frustum.setFromProjectionMatrix(tu,_e.coordinateSystem,_e.reversedDepth)}else V.updateMatrices(B);n=V.getFrustum(),M(I,v,V.camera,B,this.type)}V.isPointLightShadow!==!0&&this.type===Us&&x(V,v),V.needsUpdate=!1}m=this.type,g.needsUpdate=!1,r.setRenderTarget(b,L,P)};function x(A,I){const v=e.update(_);u.defines.VSM_SAMPLES!==A.blurSamples&&(u.defines.VSM_SAMPLES=A.blurSamples,f.defines.VSM_SAMPLES=A.blurSamples,u.needsUpdate=!0,f.needsUpdate=!0),A.mapPass===null&&(A.mapPass=new rn(i.x,i.y,{format:hs,type:zn})),u.uniforms.shadow_pass.value=A.map.depthTexture,u.uniforms.resolution.value=A.mapSize,u.uniforms.radius.value=A.radius,r.setRenderTarget(A.mapPass),r.clear(),r.renderBufferDirect(I,null,v,u,_,null),f.uniforms.shadow_pass.value=A.mapPass.texture,f.uniforms.resolution.value=A.mapSize,f.uniforms.radius.value=A.radiu
vendor: 102,059 bytes, lines 4025-4049
4025s,r.setRenderTarget(A.map),r.clear(),r.renderBufferDirect(I,null,v,f,_,null)}function y(A,I,v,b){let L=null;const P=v.isPointLight===!0?A.customDistanceMaterial:A.customDepthMaterial;if(P!==void 0)L=P;else if(L=v.isPointLight===!0?l:o,r.localClippingEnabled&&I.clipShadows===!0&&Array.isArray(I.clippingPlanes)&&I.clippingPlanes.length!==0||I.displacementMap&&I.displacementScale!==0||I.alphaMap&&I.alphaTest>0||I.map&&I.alphaTest>0||I.alphaToCoverage===!0){const N=L.uuid,O=I.uuid;let G=c[N];G===void 0&&(G={},c[N]=G);let z=G[O];z===void 0&&(z=L.clone(),G[O]=z,I.addEventListener("dispose",E)),L=z}if(L.visible=I.visible,L.wireframe=I.wireframe,b===Us?L.side=I.shadowSide!==null?I.shadowSide:I.side:L.side=I.shadowSide!==null?I.shadowSide:d[I.side],L.alphaMap=I.alphaMap,L.alphaTest=I.alphaToCoverage===!0?.5:I.alphaTest,L.map=I.map,L.clipShadows=I.clipShadows,L.clippingPlanes=I.clippingPlanes,L.clipIntersection=I.clipIntersection,L.displacementMap=I.displacementMap,L.displacementScale=I.displacementScale,L.displacementBias=I.displacementBias,L.wireframeLinewidth=I.wireframeLinewidth,L.linewidth=I.linewidth,v.isPointLight===!0&&L.isMeshDistanceMaterial===!0){const N=r.properties.get(L);N.light=v}return L}function M(A,I,v,b,L){if(A.visible===!1)return;if(A.layers.test(I.layers)&&(A.isMesh||A.isLine||A.isPoints)&&(A.castShadow||A.receiveShadow&&L===Us)&&(!A.frustumCulled||n.intersectsObject(A))){A.modelViewMatrix.multiplyMatrices(v.matrixWorldInverse,A.matrixWorld);const O=e.update(A),G=A.material;if(Array.isArray(G)){const z=O.groups;for(let B=0,V=z.length;B<V;B++){const ie=z[B],j=G[ie.materialIndex];if(j&&j.visible){const ge=y(A,j,b,L);A.onBeforeShadow(r,A,I,v,O,ge,ie),r.renderBufferDirect(v,null,O,ge,A,ie),A.onAfterShadow(r,A,I,v,O,ge,ie)}}}else if(G.visible){const z=y(A,G,b,L);A.onBeforeShadow(r,A,I,v,O,z,null),r.renderBufferDirect(v,null,O,z,A,null),A.onAfterShadow(r,A,I,v,O,z,null)}}const N=A.children;for(let O=0,G=N.length;O<G;O++)M(N[O],I,v,b,L)}function E(A){A.target.removeEventListener("dispose",E);for(const v in c){const b=c[v],L=A.target.uuid;L in b&&(b[L].dispose(),delete b[L])}}}function Sv(r,e){function t(){let D=!1;const he=new ft;let re=null;const be=new ft(0,0,0,0);return{setMask:function(ne){re!==ne&&!D&&(r.colorMask(ne,ne,ne,ne),re=ne)},setLocked:function(ne){D=ne},setClear:function(ne,Y,we,We,dt){dt===!0&&(ne*=We,Y*=We,we*=We),he.set(ne,Y,we,We),be.equals(he)===!1&&(r.clearColor(ne,Y,we,We),be.copy(he))},reset:function(){D=!1,re=null,be.set(-1,0,0,0)}}}function n(){let D=!1,he=!1,re=null,be=null,ne=null;return{setReversed:function(Y){if(he!==Y){const we=e.get("EXT_clip_control");Y?we.clipControlEXT(we.LOWER_LEFT_EXT,we.ZERO_TO_ONE_EXT):we.clipControlEXT(we.LOWER_LEFT_EXT,we.NEGATIVE_ONE_TO_ONE_EXT),he=Y;const We=ne;ne=null,this.setClear(We)}},getReversed:function(){return he},setTest:function(Y){Y?ae(r.DEPTH_TEST):oe(r.DEPTH_TEST)},setMask:function(Y){re!==Y&&!D&&(r.depthMask(Y),re=Y)},setFunc:function(Y){if(he&&(Y=Jd[Y]),be!==Y){switch(Y){case wo:r.depthFunc(r.NEVER);break;case Co:r.depthFunc(r.ALWAYS);break;case Ro:r.depthFunc(r.LESS);break;case cs:r.depthFunc(r.LEQUAL);break;case Io:r.depthFunc(r.EQUAL);break;case Po:r.depthFunc(r.GEQUAL);break;case Lo:r.depthFunc(r.GREATER);break;case Do:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}be=Y}},setLocked:function(Y){D=Y},setClear:function(Y){ne!==Y&&(ne=Y,he&&(Y=1-Y),r.clearDepth(Y))},reset:function(){D=!1,re=null,be=null,ne=null,he=!1}}}function i(){let D=!1,he=null,re=null,be=null,ne=null,Y=null,we=null,We=null,dt=null;return{setTest:function(st){D||(st?ae(r.STENCIL_TEST):oe(r.STENCIL_TEST))},setMask:function(st){he!==st&&!D&&(r.stencilMask(st),he=st)},setFunc:function(st,Tn,An){(re!==st||be!==Tn||ne!==An)&&(r.stencilFunc(st,Tn,An),re=st,be=Tn,ne=An)},setOp:function(st,Tn,An){(Y!==st||we!==Tn||We!==An)&&(r.stencilOp(st,Tn,An),Y=st,we=Tn,We=An)},setLocked:function(st){D=st},setClear:function(st){dt!==st&&(r.clearStencil(st),dt=st)},reset:function(){D=!1,he=null,re=null,be=null,ne=null,Y=null,we=null,We=null,dt=null}}}const s=new t,a=new n,o=new i,l=new WeakMap,c=new WeakMap;let h={},d={},u=new WeakMap,f=[],p=null,_=!1,g=null,m=null,x=null,y=null,M=null,E=null,A=null,I=new Me(0,0,0),v=0,b=!1,L=null,P=null,N=null,O=null,G=null;const z=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let B=!1,V=0;const ie=r.getParameter(r.VERSION);ie.indexOf("WebGL")!==-1?(V=parseFloat(/^WebGL (\d)/.exec(ie)[1]),B=V>=1):ie.indexOf("OpenGL ES")!==-1&&(V=parseFloat(/^OpenGL ES (\d)/.exec(ie)[1]),B=V>=2);let j=null,ge={};const xe=r.getParameter(r.SCISSOR_BOX),_e=r.getParameter(r.VIEWPORT),ke=new ft().fromArray(xe),it=new ft().fromArray(_e);function at(D,he,re,be){const ne=new Uint8Array(4),Y=r.createTexture();r.bindTexture(D,Y),r.texParameteri(D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(D,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let we=0;we<re;we++)D===r.TEXTURE_3D||D===r.TEXTURE_2D_ARRAY?r.texImage3D(he,0,r.RGBA,1,1,be,0,r.RGBA,r.UNSIGNED_BYTE,ne):r.texImage2D(he+we,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,ne);return Y}const Z={};Z[r.TEXTURE_2D]=at(r.TEXTURE_2D,r.TEXTURE_2D,1),Z[r.TEXTURE_CUBE_MAP]=at(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),Z[r.TEXTURE_2D_ARRAY]=at(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),Z[r.TEXTURE_3D]=at(r.TEXTURE_3D,r.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ae(r.DEPTH_TEST),a.setFunc(cs),Q(!1),de(_c),ae(r.CULL_FACE),$(Fn);function ae(D){h[D]!==!0&&(r.enable(D),h[D]=!0)}function oe(D){h[D]!==!1&&(r.disable(D),h[D]=!1)}function Oe(D,he){return d[D]!==he?(r.bindFramebuffer(D,he),d[D]=he,D===r.DRAW_FRAMEBUFFER&&(d[r.FRAMEBUFFER]=he),D===r.FRAMEBUFFER&&(d[r.DRAW_FRAMEBUFFER]=he),!0):!1}function Ne(D,he){let re=f,be=!1;if(D){re=u.get(he),re===void 0&&(re=[],u.set(he,re));const ne=D.textures;if(re.length!==ne.length||re[0]!==r.COLOR_ATTACHMENT0){for(let Y=0,we=ne.length;Y<we;Y++)re[Y]=r.COLOR_ATTACHMENT0+Y;re.length=ne.length,be=!0}}else re[0]!==r.BACK&&(re[0]=r.BACK,be=!0);be&&r.drawBuffers(re)}function Ge(D){return p!==D?(r.useProgram(D),p=D,!0):!1}const ot={[yi]:r.FUNC_ADD,[pd]:r.FUNC_SUBTRACT,[md]:r.FUNC_REVERSE_SUBTRACT};ot[gd]=r.MIN,ot[_d]=r.MAX;const Xe={[xd]:r.ZERO,[vd]:r.ONE,[yd]:r.SRC_COLOR,[Ao]:r.SRC_ALPHA,[Ed]:r.SRC_ALPHA_SATURATE,[Td]:r.DST_COLOR,[Sd]:r.DST_ALPHA,[Md]:r.ONE_MINUS_SRC_COLOR,[Eo]:r.ONE_MINUS_SRC_ALPHA,[Ad]:r.ONE_MINUS_DST_COLOR,[bd]:r.ONE_MINUS_DST_ALPHA,[wd]:r.CONSTANT_COLOR,[Cd]:r.ONE_MINUS_CONSTANT_COLOR,[Rd]:r.CONSTANT_ALPHA,[Id]:r.ONE_MINUS_CONSTANT_ALPHA};function $(D,he,re,be,ne,Y,we,We,dt,st){if(D===Fn){_===!0&&(oe(r.BLEND),_=!1);return}if(_===!1&&(ae(r.BLEND),_=!0),D!==fd){if(D!==g||st!==b){if((m!==yi||M!==yi)&&(r.blendEquation(r.FUNC_ADD),m=yi,M=yi),st)switch(D){case as:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case xc:r.blendFunc(r.ONE,r.ONE);break;case vc:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case yc: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 as:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case xc:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE,r.ONE,r.ONE);break;case vc:Le("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case yc:Le("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Le("WebGLState: Invalid blending: ",D);break}x=null,y=null,E=null,A=null,I.set(0,0,0),v=0,g=D,b=st}return}ne=ne||he,Y=Y||re,we=we||be,(he!==m||ne!==M)&&(r.blendEquationSeparate(ot[he],ot[ne]),m=he,M=ne),(re!==x||be!==y||Y!==E||we!==A)&&(r.blendFuncSeparate(Xe[re],Xe[be],Xe[Y],Xe[we]),x=re,y=be,E=Y,A=we),(We.equals(I)===!1||dt!==v)&&(r.blendColor(We.r,We.g,We.b,dt),I.copy(We),v=dt),g=D,b=!1}function te(D,he){D.side===Ln?oe(r.CULL_FACE):ae(r.CULL_FACE);let re=D.side===Wt;he&&(re=!re),Q(re),D.blending===as&&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 be=D.stencilWrite;o.setTest(be),be&&(o.setMask(D.stencilWriteMask),o.setFunc(D.stencilFunc,D.stencilRef,D.stencilFuncMask),o.setOp(D.stencilFail,D.stencilZFail,D.stencilZPass)),Fe(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),D.alphaToCoverage===!0?ae(r.SAMPLE_ALPHA_TO_COVERAGE):oe(r.SAMPLE_ALPHA_TO_COVERAGE)}function Q(D){L!==D&&(D?r.frontFace(r.CW):r.frontFace(r.CCW),L=D)}function de(D){D!==hd?(ae(r.CULL_FACE),D!==P&&(D===_c?r.cullFace(r.BACK):D===ud?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):oe(r.CULL_FACE),P=D}function R(D){D!==N&&(B&&r.lineWidth(D),N=D)}function Fe(D,he,re){D?(ae(r.POLYGON_OFFSET_FILL),(O!==he||G!==re)&&(O=he,G=re,a.getReversed()&&(he=-he),r.polygonOffset(he,re))):oe(r.POLYGON_OFFSET_FILL)}function ve(D){D?ae(r.SCISSOR_TEST):oe(r.SCISSOR_TEST)}function Be(D){D===void 0&&(D=r.TEXTURE0+z-1),j!==D&&(r.activeTexture(D),j=D)}function le(D,he,re){re===void 0&&(j===null?re=r.TEXTURE0+z-1:re=j);let be=ge[re];be===void 0&&(be={type:void 0,texture:void 0},ge[re]=be),(be.type!==D||be.texture!==he)&&(j!==re&&(r.activeTexture(re),j=re),r.bindTexture(D,he||Z[D]),be.type=D,be.texture=he)}function w(){const D=ge[j];D!==void 0&&D.type!==void 0&&(r.bindTexture(D.type,null),D.type=void 0,D.texture=void 0)}function S(){try{r.compressedTexImage2D(...arguments)}catch(D){Le("WebGLState:",D)}}function U(){try{r.compressedTexImage3D(...arguments)}catch(D){Le("WebGLState:",D)}}function X(){try{r.texSubImage2D(...arguments)}catch(D){Le("WebGLState:",D)}}function J(){try{r.texSubImage3D(...arguments)}catch(D){Le("WebGLState:",D)}}function q(){try{r.compressedTexSubImage2D(...arguments)}catch(D){Le("WebGLState:",D)}}function Ae(){try{r.compressedTexSubImage3D(...arguments)}catch(D){Le("WebGLState:",D)}}function ce(){try{r.texStorage2D(...arguments)}catch(D){Le("WebGLState:",D)}}function De(){try{r.texStorage3D(...arguments)}catch(D){Le("WebGLState:",D)}}function ze(){try{r.texImage2D(...arguments)}catch(D){Le("WebGLState:",D)}}function ee(){try{r.texImage3D(...arguments)}catch(D){Le("WebGLState:",D)}}function se(D){ke.equals(D)===!1&&(r.scissor(D.x,D.y,D.z,D.w),ke.copy(D))}function Ee(D){it.equals(D)===!1&&(r.viewport(D.x,D.y,D.z,D.w),it.copy(D))}function Ce(D,he){let re=c.get(he);re===void 0&&(re=new WeakMap,c.set(he,re));let be=re.get(D);be===void 0&&(be=r.getUniformBlockIndex(he,D.name),re.set(D,be))}function ye(D,he){const be=c.get(he).get(D);l.get(he)!==be&&(r.uniformBlockBinding(he,be,D.__bindingPointIndex),l.set(he,be))}function Ke(){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={},j=null,ge={},d={},u=new WeakMap,f=[],p=null,_=!1,g=null,m=null,x=null,y=null,M=null,E=null,A=null,I=new Me(0,0,0),v=0,b=!1,L=null,P=null,N=null,O=null,G=null,ke.set(0,0,r.canvas.width,r.canvas.height),it.set(0,0,r.canvas.width,r.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:ae,disable:oe,bindFramebuffer:Oe,drawBuffers:Ne,useProgram:Ge,setBlending:$,setMaterial:te,setFlipSided:Q,setCullFace:de,setLineWidth:R,setPolygonOffset:Fe,setScissorTest:ve,activeTexture:Be,bindTexture:le,unbindTexture:w,compressedTexImage2D:S,compressedTexImage3D:U,texImage2D:ze,texImage3D:ee,updateUBOMapping:Ce,uniformBlockBinding:ye,texStorage2D:ce,texStorage3D:De,texSubImage2D:X,texSubImage3D:J,compressedTexSubImage2D:q,compressedTexSubImage3D:Ae,scissor:se,viewport:Ee,reset:Ke}}function bv(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>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new K,h=new WeakMap;let d;const u=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function p(w,S){return f?new OffscreenCanvas(w,S):Xs("canvas")}function _(w,S,U){let X=1;const J=le(w);if((J.width>U||J.height>U)&&(X=U/Math.max(J.width,J.height)),X<1)if(typeof HTMLImageElement<"u"&&w instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&w instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&w instanceof ImageBitmap||typeof VideoFrame<"u"&&w instanceof VideoFrame){const q=Math.floor(X*J.width),Ae=Math.floor(X*J.height);d===void 0&&(d=p(q,Ae));const ce=S?p(q,Ae):d;return ce.width=q,ce.height=Ae,ce.getContext("2d").drawImage(w,0,0,q,Ae),ue("WebGLRenderer: Texture has been resized from ("+J.width+"x"+J.height+") to ("+q+"x"+Ae+")."),ce}else return"data"in w&&ue("WebGLRenderer: Image in DataTexture is too big ("+J.width+"x"+J.height+")."),w;return w}function g(w){return w.generateMipmaps}function m(w){r.generateMipmap(w)}function x(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 y(w,S,U,X,J=!1){if(w!==null){if(r[w]!==void 0)return r[w];ue("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+w+"'")}let q=S;if(S===r.RED&&(U===r.FLOAT&&(q=r.R32F),U===r.HALF_FLOAT&&(q=r.R16F),U===r.UNSIGNED_BYTE&&(q=r.R8)),S===r.RED_INTEGER&&(U===r.UNSIGNED_BYTE&&(q=r.R8UI),U===r.UNSIGNED_SHORT&&(q=r.R16UI),U===r.UNSIGNED_INT&&(q=r.R32UI),U===r.BYTE&&(q=r.R8I),U===r.SHORT&&(q=r.R16I),U===r.INT&&(q=r.R32I)),S===r.RG&&(U===r.FLOAT&&(q=r.RG32F),U===r.HALF_FLOAT&&(q=r.RG16F),U===r.UNSIGNED_BYTE&&(q=r.RG8)),S===r.RG_INTEGER&&(U===r.UNSIGNED_BYTE&&(q=r.RG8UI),U===r.UNSIGNED_SHORT&&(q=r.RG16UI),U===r.UNSIGNED_INT&&(q=r.RG32UI),U===r.BYTE&&(q=r.RG8I),U===r.SHORT&&(q=r.RG16I),U===r.INT&&(q=r.RG32I)),S===r.RGB_INTEGER&&(U===r.UNSIGNED_BYTE&&(q=r.RGB8UI),U===r.UNSIGNED_SHORT&&(q=r.RGB16UI),U===r.UNSIGNED_INT&&(q=r.RGB32UI),U===r.BYTE&&(q=r.RGB8I),U===r.SHORT&&(q=r.RGB16I),U===r.INT&&(q=r.RGB32I)),S===r.RGBA_INTEGER&&(U===r.UNSIGNED_BYTE&&(q=r.RGBA8UI),U===r.UNSIGNED_SHORT&&(q=r.RGBA16UI),U===r.UNSIGNED_INT&&(q=r.RGBA32UI),U===r.BYTE&&(q=r.RGBA8I),U===r.SHORT&&(q=r.RGBA16I),U===r.INT&&(q=r.RGBA32I)),S===r.RGB&&(U===r.UNSIGNED_INT_5_9_9_9_REV&&(q=r.RGB9_E5),U===r.UNSIGNED_INT_10F_11F_11F_REV&&(q=r.R11F_G11F_B10F)),S===r.RGBA){const Ae=J?ca:je.getTransfer(X);U===r.FLOAT&&(q=r.RGBA32F),U===r.HALF_FLOAT&&(q=r.RGBA16F),U===r.UNSIGNED_BYTE&&(q=Ae===rt?r.SRGB8_ALPHA8:r.RGBA8),U===r.UNSIGNED_SHORT_4_4_4_4&&(q=r.RGBA4),U===r.UNSIGNED_SHORT_5_5_5_1&&(q=r.RGB5_A1)}return(q===r.R16F||q===r.R32F||q===r.RG16F||q===r.RG32F||q===r.RGBA16F||q===r.RGBA32F)&&e.get("EXT_color_buffer_float"),q}function M(w,S){let U;return w?S===null||S===un||S===Ws?U=r.DEPTH24_STENCIL8:S===Gt?U=r.DEPTH32F_STENCIL8:S===Hs&&(U=r.DEPTH24_STENCIL8,ue("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):S===null||S===un||S===Ws?U=r.DEPTH_COMPONENT24:S===Gt?U=r.DEPTH_COMPONENT32F:S===Hs&&(U=r.DEPTH_COMPONENT16),U}function E(w,S){return g(w)===!0||w.isFramebufferTexture&&w.minFilter!==St&&w.minFilter!==pt?Math.log2(Math.max(S.width,S.height))+1:w.mipmaps!==void 0&&w.mipmaps.length>0?w.mipmaps.length:w.isCompressedTexture&&Array.isArray(w.image)?S.mipmaps.length:1}function A(w){const S=w.target;S.removeEventListener("dispose",A),v(S),S.isVideoTexture&&h.delete(S)}function I(w){const S=w.target;S.removeEventListener("dispose",I),L(S)}function v(w){const S=n.get(w);if(S.__webglInit===void 0)return;const U=w.source,X=u.get(U);if(X){const J=X[S.__cacheKey];J.usedTimes--,J.usedTimes===0&&b(w),Object.keys(X).length===0&&u.delete(U)}n.remove(w)}function b(w){const S=n.get(w);r.deleteTexture(S.__webglTexture);const U=w.source,X=u.get(U);delete X[S.__cacheKey],a.memory.textures--}function L(w){const S=n.get(w);if(w.depthTexture&&(w.depthTexture.dispose(),n.remove(w.depthTexture)),w.isWebGLCubeRenderTarget)for(let X=0;X<6;X++){if(Array.isArray(S.__webglFramebuffer[X]))for(let J=0;J<S.__webglFramebuffer[X].length;J++)r.deleteFramebuffer(S.__webglFramebuffer[X][J]);else r.deleteFramebuffer(S.__webglFramebuffer[X]);S.__webglDepthbuffer&&r.deleteRenderbuffer(S.__webglDepthbuffer[X])}else{if(Array.isArray(S.__webglFramebuffer))for(let X=0;X<S.__webglFramebuffer.length;X++)r.deleteFramebuffer(S.__webglFramebuffer[X]);else r.deleteFramebuffer(S.__webglFramebuffer);if(S.__webglDepthbuffer&&r.deleteRenderbuffer(S.__webglDepthbuffer),S.__webglMultisampledFramebuffer&&r.deleteFramebuffer(S.__webglMultisampledFramebuffer),S.__webglColorRenderbuffer)for(let X=0;X<S.__webglColorRenderbuffer.length;X++)S.__webglColorRenderbuffer[X]&&r.deleteRenderbuffer(S.__webglColorRenderbuffer[X]);S.__webglDepthRenderbuffer&&r.deleteRenderbuffer(S.__webglDepthRenderbuffer)}const U=w.textures;for(let X=0,J=U.length;X<J;X++){const q=n.get(U[X]);q.__webglTexture&&(r.deleteTexture(q.__webglTexture),a.memory.textures--),n.remove(U[X])}n.remove(w)}let P=0;function N(){P=0}function O(){const w=P;return w>=i.maxTextures&&ue("WebGLTextures: Trying to use "+w+" texture units while this GPU supports only "+i.maxTextures),P+=1,w}function G(w){const S=[];return S.push(w.wrapS),S.push(w.wrapT),S.push(w.wrapR||0),S.push(w.magFilter),S.push(w.minFilter),S.push(w.anisotropy),S.push(w.internalFormat),S.push(w.format),S.push(w.type),S.push(w.generateMipmaps),S.push(w.premultiplyAlpha),S.push(w.flipY),S.push(w.unpackAlignment),S.push(w.colorSpace),S.join()}function z(w,S){const U=n.get(w);if(w.isVideoTexture&&ve(w),w.isRenderTargetTexture===!1&&w.isExternalTexture!==!0&&w.version>0&&U.__version!==w.version){const X=w.image;if(X===null)ue("WebGLRenderer: Texture marked for update but no image data found.");else if(X.complete===!1)ue("WebGLRenderer: Texture marked for update but image is incomplete");else{Z(U,w,S);return}}else w.isExternalTexture&&(U.__webglTexture=w.sourceTexture?w.sourceTexture:null);t.bindTexture(r.TEXTURE_2D,U.__webglTexture,r.TEXTURE0+S)}function B(w,S){const U=n.get(w);if(w.isRenderTargetTexture===!1&&w.version>0&&U.__version!==w.version){Z(U,w,S);return}else w.isExternalTexture&&(U.__webglTexture=w.sourceTexture?w.sourceTexture:null);t.bindTexture(r.TEXTURE_2D_ARRAY,U.__webglTexture,r.TEXTURE0+S)}function V(w,S){const U=n.get(w);if(w.isRenderTargetTexture===!1&&w.version>0&&U.__version!==w.version){Z(U,w,S);return}t.bindTexture(r.TEXTURE_3D,U.__webglTexture,r.TEXTURE0+S)}function ie(w,S){const U=n.get(w);if(w.isCubeDepthTexture!==!0&&w.version>0&&U.__version!==w.version){ae(U,w,S);return}t.bindTexture(r.TEXTURE_CUBE_MAP,U.__webglTexture,r.TEXTURE0+S)}const j={[ra]:r.REPEAT,[jt]:r.CLAMP_TO_EDGE,[aa]:r.MIRRORED_REPEAT},ge={[St]:r.NEAREST,[cu]:r.NEAREST_MIPMAP_NEAREST,[Ns]:r.NEAREST_MIPMAP_LINEAR,[pt]:r.LINEAR,[jr]:r.LINEAR_MIPMAP_NEAREST,[Un]:r.LINEAR_MIPMAP_LINEAR},xe={[zd]:r.NEVER,[Wd]:r.ALWAYS,[Vd]:r.LESS,[Il]:r.LEQUAL,[kd]:r.EQUAL,[Pl]:r.GEQUAL,[Gd]:r.GREATER,[Hd]:r.NOTEQUAL};function _e(w,S){if(S.type===Gt&&e.has("OES_texture_float_linear")===!1&&(S.magFilter===pt||S.magFilter===jr||S.magFilter===Ns||S.magFilter===Un||S.minFilter===pt||S.minFilter===jr||S.minFilter===Ns||S.minFilter===Un)&&ue("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,j[S.wrapS]),r.texParameteri(w,r.TEXTURE_WRAP_T,j[S.wrapT]),(w===r.TEXTURE_3D||w===r.TEXTURE_2D_ARRAY)&&r.texParameteri(w,r.TEXTURE_WRAP_R,j[S.wrapR]),r.texParameteri(w,r.TEXTURE_MAG_FILTER,ge[S.magFilter]),r.texParameteri(w,r.TEXTURE_MIN_FILTER,ge[S.minFilter]),S.compareFunction&&(r.texParameteri(w,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(w,r.TEXTURE_COMPARE_FUNC,xe[S.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(S.magFilter===St||S.minFilter!==Ns&&S.minFilter!==Un||S.type===Gt&&e.has("OES_texture_float_linear")===!1)return;if(S.anisotropy>1||n.get(S).__currentAnisotropy){const U=e.get("EXT_texture_filter_anisotropic");r.texParameterf(w,U.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(S.anisotropy,i.getMaxAnisotropy())),n.get(S).__currentAnisotropy=S.anisotropy}}}function ke(w,S){let U=!1;w.__webglInit===void 0&&(w.__webglInit=!0,S.addEventListener("dispose",A));const X=S.source;let J=u.get(X);J===void 0&&(J={},u.set(X,J));const q=G(S);if(q!==w.__cacheKey){J[q]===void 0&&(J[q]={texture:r.createTexture(),usedTimes:0},a.memory.textures++,U=!0),J[q].usedTimes++;const Ae=J[w.__cacheKey];Ae!==void 0&&(J[w.__cacheKey].usedTimes--,Ae.usedTimes===0&&b(S)),w.__cacheKey=q,w.__webglTexture=J[q].texture}return U}function it(w,S,U){return Math.floor(Math.floor(w/U)/S)}function at(w,S,U,X){const q=w.updateRanges;if(q.length===0)t.texSubImage2D(r.TEXTURE_2D,0,0,0,S.width,S.height,U,X,S.data);else{q.sort((ee,se)=>ee.start-se.start);let Ae=0;for(let ee=1;ee<q.length;ee++){const se=q[Ae],Ee=q[ee],Ce=se.start+se.count,ye=it(Ee.start,S.width,4),Ke=it(se.start,S.width,4);Ee.start<=Ce+1&&ye===Ke&&it(Ee.start+Ee.count-1,S.width,4)===ye?se.count=Math.max(se.count,Ee.start+Ee.count-se.start):(++Ae,q[Ae]=Ee)}q.length=Ae+1;const ce=r.getParameter(r.UNPACK_ROW_LENGTH),De=r.getParameter(r.UNPACK_SKIP_PIXELS),ze=r.getParameter(r.UNPACK_SKIP_ROWS);r.pixelStorei(r.UNPACK_ROW_LENGTH,S.width);for(let ee=0,se=q.length;ee<se;ee++){const Ee=q[ee],Ce=Math.floor(Ee.start/4),ye=Math.ceil(Ee.count/4),Ke=Ce%S.width,D=Math.floor(Ce/S.width),he=ye,re=1;r.pixelStorei(r.UNPACK_SKIP_PIXELS,Ke),r.pixelStorei(r.UNPACK_SKIP_ROWS,D),t.texSubImage2D(r.TEXTURE_2D,0,Ke,D,he,re,U,X,S.data)}w.clearUpdateRanges(),r.pixelStorei(r.UNPACK_ROW_LENGTH,ce),r.pixelStorei(r.UNPACK_SKIP_PIXELS,De),r.pixelStorei(r.UNPACK_SKIP_ROWS,ze)}}function Z(w,S,U){let X=r.TEXTURE_2D;(S.isDataArrayTexture||S.isCompressedArrayTexture)&&(X=r.TEXTURE_2D_ARRAY),S.isData3DTexture&&(X=r.TEXTURE_3D);const J=ke(w,S),q=S.source;t.bindTexture(X,w.__webglTexture,r.TEXTURE0+U);const Ae=n.get(q);if(q.version!==Ae.__version||J===!0){t.activeTexture(r.TEXTURE0+U);const ce=je.getPrimaries(je.workingColorSpace),De=S.colorSpace===Qn?null:je.getPrimaries(S.colorSpace),ze=S.colorSpace===Qn||ce===De?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,S.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,S.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,ze);let ee=_(S.image,!1,i.maxTextureSize);ee=Be(S,ee);const se=s.convert(S.format,S.colorSpace),Ee=s.convert(S.type);let Ce=y(S.internalFormat,se,Ee,S.colorSpace,S.isVideoTexture);_e(X,S);let ye;const Ke=S.mipmaps,D=S.isVideoTexture!==!0,he=Ae.__version===void 0||J===!0,re=q.dataReady,be=E(S,ee);if(S.isDepthTexture)Ce=M(S.format===Si,S.type),he&&(D?t.texStorage2D(r.TEXTURE_2D,1,Ce,ee.width,ee.height):t.texImage2D(r.TEXTURE_2D,0,Ce,ee.width,ee.height,0,se,Ee,null));else if(S.isDataTexture)if(Ke.length>0){D&&he&&t.texStorage2D(r.TEXTURE_2D,be,Ce,Ke[0].width,Ke[0].height);for(let ne=0,Y=Ke.length;ne<Y;ne++)ye=Ke[ne],D?re&&t.texSubImage2D(r.TEXTURE_2D,ne,0,0,ye.width,ye.height,se,Ee,ye.data):t.texImage2D(r.TEXTURE_2D,ne,Ce,ye.width,ye.height,0,se,Ee,ye.data);S.generateMipmaps=!1}else D?(he&&t.texStorage2D(r.TEXTURE_2D,be,Ce,ee.width,ee.height),re&&at(S,ee,se,Ee)):t.texImage2D(r.TEXTURE_2D,0,Ce,ee.width,ee.height,0,se,Ee,ee.data);else if(S.isCompressedTexture)if(S.isCompressedArrayTexture){D&&he&&t.texStorage3D(r.TEXTURE_2D_ARRAY,be,Ce,Ke[0].width,Ke[0].height,ee.depth);for(let ne=0,Y=Ke.length;ne<Y;ne++)if(ye=Ke[ne],S.format!==Ht)if(se!==null)if(D){if(re)if(S.layerUpdates.size>0){const we=vl(ye.width,ye.height,S.format,S.type);for(const We of S.layerUpdates){const dt=ye.data.subarray(We*we/ye.data.BYTES_PER_ELEMENT,(We+1)*we/ye.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,ne,0,0,We,ye.width,ye.height,1,se,dt)}S.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,ne,0,0,0,ye.width,ye.height,ee.depth,se,ye.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,ne,Ce,ye.width,ye.height,ee.depth,0,ye.data,0,0);else ue("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else D?re&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,ne,0,0,0,ye.width,ye.height,ee.depth,se,Ee,ye.data):t.texImage3D(r.TEXTURE_2D_ARRAY,ne,Ce,ye.width,ye.height,ee.depth,0,se,Ee,ye.data)}else{D&&he&&t.texStorage2D(r.TEXTURE_2D,be,Ce,Ke[0].width,Ke[0].height);for(let ne=0,Y=Ke.length;ne<Y;ne++)ye=Ke[ne],S.format!==Ht?se!==null?D?re&&t.compressedTexSubImage2D(r.TEXTURE_2D,ne,0,0,ye.width,ye.height,se,ye.data):t.compressedTexImage2D(r.TEXTURE_2D,ne,Ce,ye.width,ye.height,0,ye.data):ue("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):D?re&&t.texSubImage2D(r.TEXTURE_2D,ne,0,0,ye.width,ye.height,se,Ee,ye.data):t.texImage2D(r.TEXTURE_2D,ne,Ce,ye.width,ye.height,0,se,Ee,ye.data)}else if(S.isDataArrayTexture)if(D){if(he&&t.texStorage3D(r.TEXTURE_2D_ARRAY,be,Ce,ee.width,ee.height,ee.depth),re)if(S.layerUpdates.size>0){const ne=vl(ee.width,ee.height,S.format,S.type);for(const Y of S.layerUpdates){const we=ee.data.subarray(Y*ne/ee.data.BYTES_PER_ELEMENT,(Y+1)*ne/ee.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,Y,ee.width,ee.height,1,se,Ee,we)}S.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,ee.width,ee.height,ee.depth,se,Ee,ee.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,Ce,ee.width,ee.height,ee.depth,0,se,Ee,ee.data);else if(S.isData3DTexture)D?(he&&t.texStorage3D(r.TEXTURE_3D,be,Ce,ee.width,ee.height,ee.depth),re&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,ee.width,ee.height,ee.depth,se,Ee,ee.data)):t.texImage3D(r.TEXTURE_3D,0,Ce,ee.width,ee.height,ee.depth,0,se,Ee,ee.data);else if(S.isFramebufferTexture){if(he)if(D)t.texStorage2D(r.TEXTURE_2D,be,Ce,ee.width,ee.height);else{let ne=ee.width,Y=ee.height;for(let we=0;we<be;we++)t.texImage2D(r.TEXTURE_2D,we,Ce,ne,Y,0,se,Ee,null),ne>>=1,Y>>=1}}else if(Ke.length>0){if(D&&he){const ne=le(Ke[0]);t.texStorage2D(r.TEXTURE_2D,be,Ce,ne.width,ne.height)}for(let ne=0,Y=Ke.length;ne<Y;ne++)ye=Ke[ne],D?re&&t.texSubImage2D(r.TEXTURE_2D,ne,0,0,se,Ee,ye):t.texImage2D(r.TEXTURE_2D,ne,Ce,se,Ee,ye);S.generateMipmaps=!1}else if(D){if(he){const ne=le(ee);t.texStorage2D(r.TEXTURE_2D,be,Ce,ne.width,ne.height)}re&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,se,Ee,ee)}else t.texImage2D(r.TEXTURE_2D,0,Ce,se,Ee,ee);g(S)&&m(X),Ae.__version=q.version,S.onUpdate&&S.onUpdate(S)}w.__version=S.version}function ae(w,S,U){if(S.image.length!==6)return;const X=ke(w,S),J=S.source;t.bindTexture(r.TEXTURE_CUBE_MAP,w.__webglTexture,r.TEXTURE0+U);const q=n.get(J);if(J.version!==q.__version||X===!0){t.activeTexture(r.TEXTURE0+U);const Ae=je.getPrimaries(je.workingColorSpace),ce=S.colorSpace===Qn?null:je.getPrimaries(S.colorSpace),De=S.colorSpace===Qn||Ae===ce?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,S.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,S.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,De);const ze=S.isCompressedTexture||S.image[0].isCompressedTexture,ee=S.image[0]&&S.image[0].isDataTexture,se=[];for(let Y=0;Y<6;Y++)!ze&&!ee?se[Y]=_(S.image[Y],!0,i.maxCubemapSize):se[Y]=ee?S.image[Y].image:S.image[Y],se[Y]=Be(S,se[Y]);const Ee=se[0],Ce=s.convert(S.format,S.colorSpace),ye=s.convert(S.type),Ke=y(S.internalFormat,Ce,ye,S.colorSpace),D=S.isVideoTexture!==!0,he=q.__version===void 0||X===!0,re=J.dataReady;let be=E(S,Ee);_e(r.TEXTURE_CUBE_MAP,S);let ne;if(ze){D&&he&&t.texStorage2D(r.TEXTURE_CUBE_MAP,be,Ke,Ee.width,Ee.height);for(let Y=0;Y<6;Y++){ne=se[Y].mipmaps;for(let we=0;we<ne.length;we++){const We=ne[we];S.format!==Ht?Ce!==null?D?re&&t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Y,we,0,0,We.width,We.height,Ce,We.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Y,we,Ke,We.width,We.height,0,We.data):ue("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):D?re&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Y,we,0,0,We.width,We.height,Ce,ye,We.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Y,we,Ke,We.width,We.height,0,Ce,ye,We.data)}}}else{if(ne=S.mipmaps,D&&he){ne.length>0&&be++;const Y=le(se[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,be,Ke,Y.width,Y.height)}for(let Y=0;Y<6;Y++)if(ee){D?re&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Y,0,0,0,se[Y].width,se[Y].height,Ce,ye,se[Y].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Y,0,Ke,se[Y].width,se[Y].height,0,Ce,ye,se[Y].data);for(let we=0;we<ne.length;we++){const dt=ne[we].image[Y].image;D?re&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Y,we+1,0,0,dt.width,dt.height,Ce,ye,dt.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Y,we+1,Ke,dt.width,dt.height,0,Ce,ye,dt.data)}}else{D?re&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Y,0,0,0,Ce,ye,se[Y]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Y,0,Ke,Ce,ye,se[Y]);for(let we=0;we<ne.length;we++){const We=ne[we];D?re&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Y,we+1,0,0,Ce,ye,We.image[Y]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Y,we+1,Ke,Ce,ye,We.image[Y])}}}g(S)&&m(r.TEXTURE_CUBE_MAP),q.__version=J.version,S.onUpdate&&S.onUpdate(S)}w.__version=S.version}function oe(w,S,U,X,J,q){const Ae=s.convert(U.format,U.colorSpace),ce=s.convert(U.type),De=y(U.internalFormat,Ae,ce,U.colorSpace),ze=n.get(S),ee=n.get(U);if(ee.__renderTarget=S,!ze.__hasExternalTextures){const se=Math.max(1,S.width>>q),Ee=Math.max(1,S.height>>q);J===r.TEXTURE_3D||J===r.TEXTURE_2D_ARRAY?t.texImage3D(J,q,De,se,Ee,S.depth,0,Ae,ce,null):t.texImage2D(J,q,De,se,Ee,0,Ae,ce,null)}t.bindFramebuffer(r.FRAMEBUFFER,w),Fe(S)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,X,J,ee.__webglTexture,0,R(S)):(J===r.TEXTURE_2D||J>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&J<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,X,J,ee.__webglTexture,q),t.bindFramebuffer(r.FRAMEBUFFER,null)}function Oe(w,S,U){if(r.bindRenderbuffer(r.RENDERBUFFER,w),S.depthBuffer){const X=S.depthTexture,J=X&&X.isDepthTexture?X.type:null,q=M(S.stencilBuffer,J),Ae=S.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;Fe(S)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,R(S),q,S.width,S.height):U?r.renderbufferStorageMultisample(r.RENDERBUFFER,R(S),q,S.width,S.height):r.renderbufferStorage(r.RENDERBUFFER,q,S.width,S.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,Ae,r.RENDERBUFFER,w)}else{const X=S.textures;for(let J=0;J<X.length;J++){const q=X[J],Ae=s.convert(q.format,q.colorSpace),ce=s.convert(q.type),De=y(q.internalFormat,Ae,ce,q.colorSpace);Fe(S)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,R(S),De,S.width,S.height):U?r.renderbufferStorageMultisample(r.RENDERBUFFER,R(S),De,S.width,S.height):r.renderbufferStorage(r.RENDERBUFFER,De,S.width,S.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function Ne(w,S,U){const X=S.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(r.FRAMEBUFFER,w),!(S.depthTexture&&S.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const J=n.get(S.depthTexture);if(J.__renderTarget=S,(!J.__webglTexture||S.depthTexture.image.width!==S.width||S.depthTexture.image.height!==S.height)&&(S.depthTexture.image.width=S.width,S.depthTexture.image.height=S.height,S.depthTexture.needsUpdate=!0),X){if(J.__webglInit===void 0&&(J.__webglInit=!0,S.depthTexture.addEventListener("dispose",A)),J.__webglTexture===void 0){J.__webglTexture=r.createTexture(),t.bindTexture(r.TEXTURE_CUBE_MAP,J.__webglTexture),_e(r.TEXTURE_CUBE_MAP,S.depthTexture);const ze=s.convert(S.depthTexture.format),ee=s.convert(S.depthTexture.type);let se;S.depthTexture.format===Vn?se=r.DEPTH_COMPONENT24:S.depthTexture.format===Si&&(se=r.DEPTH24_STENCIL8);for(let Ee=0;Ee<6;Ee++)r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ee,0,se,S.width,S.height,0,ze,ee,null)}}else z(S.depthTexture,0);const q=J.__webglTexture,Ae=R(S),ce=X?r.TEXTURE_CUBE_MAP_POSITIVE_X+U:r.TEXTURE_2D,De=S.depthTexture.format===Si?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;if(S.depthTexture.format===Vn)Fe(S)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,De,ce,q,0,Ae):r.framebufferTexture2D(r.FRAMEBUFFER,De,ce,q,0);else if(S.depthTexture.format===Si)Fe(S)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,De,ce,q,0,Ae):r.framebufferTexture2D(r.FRAMEBUFFER,De,ce,q,0);else throw new Error("Unknown depthTexture format")}function Ge(w){const S=n.get(w),U=w.isWebGLCubeRenderTarget===!0;if(S.__boundDepthTexture!==w.depthTexture){const X=w.depthTexture;if(S.__depthDisposeCallback&&S.__depthDisposeCallback(),X){const J=()=>{delete S.__boundDepthTexture,delete S.__depthDisposeCallback,X.removeEventListener("dispose",J)};X.addEventListener("dispose",J),S.__depthDisposeCallback=J}S.__boundDepthTexture=X}if(w.depthTexture&&!S.__autoAllocateDepthBuffer)if(U)for(let X=0;X<6;X++)Ne(S.__webglFramebuffer[X],w,X);else{const X=w.texture.mipmaps;X&&X.length>0?Ne(S.__webglFramebuffer[0],w,0):Ne(S.__webglFramebuffer,w,0)}else if(U){S.__webglDepthbuffer=[];for(let X=0;X<6;X++)if(t.bindFramebuffer(r.FRAMEBUFFER,S.__webglFramebuffer[X]),S.__webglDepthbuffer[X]===void 0)S.__webglDepthbuffer[X]=r.createRenderbuffer(),Oe(S.__webglDepthbuffer[X],w,!1);else{const J=w.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,q=S.__webglDepthbuffer[X];r.bindRenderbuffer(r.RENDERBUFFER,q),r.framebufferRenderbuffer(r.FRAMEBUFFER,J,r.RENDERBUFFER,q)}}else{const X=w.texture.mipmaps;if(X&&X.length>0?t.bindFramebuffer(r.FRAMEBUFFER,S.__webglFramebuffer[0]):t.bindFramebuffer(r.FRAMEBUFFER,S.__webglFramebuffer),S.__webglDepthbuffer===void 0)S.__webglDepthbuffer=r.createRenderbuffer(),Oe(S.__webglDepthbuffer,w,!1);else{const J=w.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,q=S.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,q),r.framebufferRenderbuffer(r.FRAMEBUFFER,J,r.RENDERBUFFER,q)}}t.bindFramebuffer(r.FRAMEBUFFER,null)}function ot(w,S,U){const X=n.get(w);S!==void 0&&oe(X.__webglFramebuffer,w,w.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),U!==void 0&&Ge(w)}function Xe(w){const S=w.texture,U=n.get(w),X=n.get(S);w.addEventListener("dispose",I);const J=w.textures,q=w.isWebGLCubeRenderTarget===!0,Ae=J.length>1;if(Ae||(X.__webglTexture===void 0&&(X.__webglTexture=r.createTexture()),X.__version=S.version,a.memory.textures++),q){U.__webglFramebuffer=[];for(let ce=0;ce<6;ce++)if(S.mipmaps&&S.mipmaps.length>0){U.__webglFramebuffer[ce]=[];for(let De=0;De<S.mipmaps.length;De++)U.__webglFramebuffer[ce][De]=r.createFramebuffer()}else U.__webglFramebuffer[ce]=r.createFramebuffer()}else{if(S.mipmaps&&S.mipmaps.length>0){U.__webglFramebuffer=[];for(let ce=0;ce<S.mipmaps.length;ce++)U.__webglFramebuffer[ce]=r.createFramebuffer()}else U.__webglFramebuffer=r.createFramebuffer();if(Ae)for(let ce=0,De=J.length;ce<De;ce++){const ze=n.get(J[ce]);ze.__webglTexture===void 0&&(ze.__webglTexture=r.createTexture(),a.memory.textures++)}if(w.samples>0&&Fe(w)===!1){U.__webglMultisampledFramebuffer=r.createFramebuffer(),U.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,U.__webglMultisampledFramebuffer);for(let ce=0;ce<J.length;ce++){const De=J[ce];U.__webglColorRenderbuffer[ce]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,U.__webglColorRenderbuffer[ce]);const ze=s.convert(De.format,De.colorSpace),ee=s.convert(De.type),se=y(De.internalFormat,ze,ee,De.colorSpace,w.isXRRenderTarget===!0),Ee=R(w);r.renderbufferStorageMultisample(r.RENDERBUFFER,Ee,se,w.width,w.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+ce,r.RENDERBUFFER,U.__webglColorRenderbuffer[ce])}r.bindRenderbuffer(r.RENDERBUFFER,null),w.depthBuffer&&(U.__webglDepthRenderbuffer=r.createRenderbuffer(),Oe(U.__webglDepthRenderbuffer,w,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(q){t.bindTexture(r.TEXTURE_CUBE_MAP,X.__webglTexture),_e(r.TEXTURE_CUBE_MAP,S);for(let ce=0;ce<6;ce++)if(S.mipmaps&&S.mipmaps.length>0)for(let De=0;De<S.mipmaps.length;De++)oe(U.__webglFramebuffer[ce][De],w,S,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+ce,De);else oe(U.__webglFramebuffer[ce],w,S,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+ce,0);g(S)&&m(r.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Ae){for(let ce=0,De=J.length;ce<De;ce++){const ze=J[ce],ee=n.get(ze);let se=r.TEXTURE_2D;(w.isWebGL3DRenderTarget||w.isWebGLArrayRenderTarget)&&(se=w.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(se,ee.__webglTexture),_e(se,ze),oe(U.__webglFramebuffer,w,ze,r.COLOR_ATTACHMENT0+ce,se,0),g(ze)&&m(se)}t.unbindTexture()}else{let ce=r.TEXTURE_2D;if((w.isWebGL3DRenderTarget||w.isWebGLArrayRenderTarget)&&(ce=w.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(ce,X.__webglTexture),_e(ce,S),S.mipmaps&&S.mipmaps.length>0)for(let De=0;De<S.mipmaps.length;De++)oe(U.__webglFramebuffer[De],w,S,r.COLOR_ATTACHMENT0,ce,De);else oe(U.__webglFramebuffer,w,S,r.COLOR_ATTACHMENT0,ce,0);g(S)&&m(ce),t.unbindTexture()}w.depthBuffer&&Ge(w)}function $(w){const S=w.textures;for(let U=0,X=S.length;U<X;U++){const J=S[U];if(g(J)){const q=x(w),Ae=n.get(J).__webglTexture;t.bindTexture(q,Ae),m(q),t.unbindTexture()}}}const te=[],Q=[];function de(w){if(w.samples>0){if(Fe(w)===!1){const S=w.textures,U=w.width,X=w.height;let J=r.COLOR_BUFFER_BIT;const q=w.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Ae=n.get(w),ce=S.length>1;if(ce)for(let ze=0;ze<S.length;ze++)t.bindFramebuffer(r.FRAMEBUFFER,Ae.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+ze,r.RENDERBUFFER,null),t.bindFramebuffer(r.FRAMEBUFFER,Ae.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+ze,r.TEXTURE_2D,null,0);t.bindFramebuffer(r.READ_FRAMEBUFFER,Ae.__webglMultisampledFramebuffer);const De=w.texture.mipmaps;De&&De.length>0?t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ae.__webglFramebuffer[0]):t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ae.__webglFramebuffer);for(let ze=0;ze<S.length;ze++){if(w.resolveDepthBuffer&&(w.depthBuffer&&(J|=r.DEPTH_BUFFER_BIT),w.stencilBuffer&&w.resolveStencilBuffer&&(J|=r.STENCIL_BUFFER_BIT)),ce){r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,Ae.__webglColorRenderbuffer[ze]);const ee=n.get(S[ze]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,ee,0)}r.blitFramebuffer(0,0,U,X,0,0,U,X,J,r.NEAREST),l===!0&&(te.length=0,Q.length=0,te.push(r.COLOR_ATTACHMENT0+ze),w.depthBuffer&&w.resolveDepthBuffer===!1&&(te.push(q),Q.push(q),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,Q)),r.invalidateFramebuffer(r.READ_FRAMEBUFFER,te))}if(t.bindFramebuffer(r.READ_FRAMEBUFFER,null),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),ce)for(let ze=0;ze<S.length;ze++){t.bindFramebuffer(r.FRAMEBUFFER,Ae.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+ze,r.RENDERBUFFER,Ae.__webglColorRenderbuffer[ze]);const ee=n.get(S[ze]).__webglTexture;t.bindFramebuffer(r.FRAMEBUFFER,Ae.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+ze,r.TEXTURE_2D,ee,0)}t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ae.__webglMultisampledFramebuffer)}else if(w.depthBuffer&&w.resolveDepthBuffer===!1&&l){const S=w.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[S])}}}function R(w){return Math.min(i.maxSamples,w.samples)}function Fe(w){const S=n.get(w);return w.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&S.__useRenderToTexture!==!1}function ve(w){const S=a.render.frame;h.get(w)!==S&&(h.set(w,S),w.update())}function Be(w,S){const U=w.colorSpace,X=w.format,J=w.type;return w.isCompressedTexture===!0||w.isVideoTexture===!0||U!==us&&U!==Qn&&(je.getTransfer(U)===rt?(X!==Ht||J!==Kt)&&ue("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Le("WebGLTextures: Unsupported texture color space:",U)),S}function le(w){return typeof HTMLImageElement<"u"&&w instanceof HTMLImageElement?(c.width=w.naturalWidth||w.width,c.height=w.naturalHeight||w.height):typeof VideoFrame<"u"&&w instanceof VideoFrame?(c.width=w.displayWidth,c.height=w.displayHeight):(c.width=w.width,c.height=w.height),c}this.allocateTextureUnit=O,this.resetTextureUnits=N,this.setTexture2D=z,this.setTexture2DArray=B,this.setTexture3D=V,this.setTextureCube=ie,this.rebindTextures=ot,this.setupRenderTarget=Xe,this.updateRenderTargetMipmap=$,this.updateMultisampleRenderTarget=de,this.setupDepthRenderbuffer=Ge,this.setupFrameBufferTexture=oe,this.useMultisampledRTT=Fe,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function Tv(r,e){function t(n,i=Qn){let s;const a=je.getTransfer(i);if(n===Kt)return r.UNSIGNED_BYTE;if(n===Tl)return r.UNSIGNED_SHORT_4_4_4_4;if(n===Al)return r.UNSIGNED_SHORT_5_5_5_1;if(n===du)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===fu)return r.UNSIGNED_INT_10F_11F_11F_REV;if(n===hu)return r.BYTE;if(n===uu)return r.SHORT;if(n===Hs)return r.UNSIGNED_SHORT;if(n===bl)return r.INT;if(n===un)return r.UNSIGNED_INT;if(n===Gt)return r.FLOAT;if(n===zn)return r.HALF_FLOAT;if(n===pu)return r.ALPHA;if(n===mu)return r.RGB;if(n===Ht)return r.RGBA;if(n===Vn)return r.DEPTH_COMPONENT;if(n===Si)return r.DEPTH_STENCIL;if(n===El)return r.RED;if(n===Ma)return r.RED_INTEGER;if(n===hs)return r.RG;if(n===wl)return r.RG_INTEGER;if(n===Cl)return r.RGBA_INTEGER;if(n===ea||n===ta||n===na||n===ia)if(a===rt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===ea)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===ta)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===na)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===ia)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===ea)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===ta)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===na)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===ia)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Uo||n===No||n===Fo||n===Oo)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===Uo)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===No)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Fo)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Oo)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Bo||n===zo||n===Vo||n===ko||n===Go||n===Ho||n===Wo)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===Bo||n===zo)return a===rt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===Vo)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===ko)return s.COMPRESSED_R11_EAC;if(n===Go)return s.COMPRESSED_SIGNED_R11_EAC;if(n===Ho)return s.COMPRESSED_RG11_EAC;if(n===Wo)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===Xo||n===qo||n===Yo||n===Zo||n===Jo||n===$o||n===Ko||n===Qo||n===jo||n===el||n===tl||n===nl||n===il||n===sl)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===Xo)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===qo)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Yo)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Zo)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Jo)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===$o)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Ko)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Qo)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===jo)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===el)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===tl)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===nl)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===il)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===sl)return a===rt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===rl||n===al||n===ol)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===rl)return a===rt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===al)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===ol)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===ll||n===cl||n===hl||n===ul)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===ll)return s.COMPRESSED_RED_RGTC1_EXT;if(n===cl)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===hl)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===ul)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Ws?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const Av=`
4026void main() {
4027
4028	gl_Position = vec4( position, 1.0 );
4029
4030}`,Ev=`
4031uniform sampler2DArray depthColor;
4032uniform float depthWidth;
4033uniform float depthHeight;
4034
4035void main() {
4036
4037	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
4038
4039	if ( coord.x >= 1.0 ) {
4040
4041		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
4042
4043	} else {
4044
4045		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
4046
4047	}
4048
4049}`;class wv{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new wu(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 dn({vertexShader:Av,fragmentShader:Ev,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new bt(new er(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Cv 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,d=null,u=null,f=null,p=null;const _=typeof XRWebGLBinding<"u",g=new wv,m={},x=t.getContextAttributes();let y=null,M=null;const E=[],A=[],I=new K;let v=null;const b=new Dt;b.viewport=new ft;const L=new Dt;L.viewport=new ft;const P=[b,L],N=new gm;let O=null,G=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Z){let ae=E[Z];return ae===void 0&&(ae=new za,E[Z]=ae),ae.getTargetRaySpace()},this.getControllerGrip=function(Z){let ae=E[Z];return ae===void 0&&(ae=new za,E[Z]=ae),ae.getGripSpace()},this.getHand=function(Z){let ae=E[Z];return ae===void 0&&(ae=new za,E[Z]=ae),ae.getHandSpace()};function z(Z){const ae=A.indexOf(Z.inputSource);if(ae===-1)return;const oe=E[ae];oe!==void 0&&(oe.update(Z.inputSource,Z.frame,c||a),oe.dispatchEvent({type:Z.type,data:Z.inputSource}))}function B(){i.removeEventListener("select",z),i.removeEventListener("selectstart",z),i.removeEventListener("selectend",z),i.removeEventListener("squeeze",z),i.removeEventListener("squeezestart",z),i.removeEventListener("squeezeend",z),i.removeEventListener("end",B),i.removeEventListener("inputsourceschange",V);for(let Z=0;Z<E.length;Z++){const ae=A[Z];ae!==null&&(A[Z]=null,E[Z].disconnect(ae))}O=null,G=null,g.reset();for(const Z in m)delete m[Z];e.setRenderTarget(y),f=null,u=null,d=null,i=null,M=null,at.stop(),n.isPresenting=!1,e.setPixelRatio(v),e.setSize(I.width,I.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Z){s=Z,n.isPresenting===!0&&ue("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Z){o=Z,n.isPresenting===!0&&ue("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(Z){c=Z},this.getBaseLayer=function(){return u!==null?u:f},this.getBinding=function(){return d===null&&_&&(d=new XRWebGLBinding(i,t)),d},this.getFrame=function(){return p},this.getSession=function(){return i},this.setSession=async function(Z){if(i=Z,i!==null){if(y=e.getRenderTarget(),i.addEventListener("select",z),i.addEventListener("selectstart",z),i.addEventListener("selectend",z),i.addEventListener("squeeze",z),i.addEventListener("squeezestart",z),i.addEventListener("squeezeend",z),i.addEventListener("end",B),i.addEventListener("inputsourceschange",V),x.xrCompatible!==!0&&await t.makeXRCompatible(),v=e.getPixelRatio(),e.getSize(I),_&&"createProjectionLayer"in XRWebGLBinding.prototype){let oe=null,Oe=null,Ne=null;x.depth&&(Ne=x.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,oe=x.stencil?Si:Vn,Oe=x.stencil?Ws:un);const Ge={colorFormat:t.RGBA8,depthFormat:Ne,scaleFactor:s};d=this.getBinding(),u=d.createProjectionLayer(Ge),i.updateRenderState({layers:[u]}),e.setPixelRatio(1),e.setSize(u.textureWidth,u.textureHeight,!1),M=new rn(u.textureWidth,u.textureHeight,{format:Ht,type:Kt,depthTexture:new Ys(u.textureWidth,u.textureHeight,Oe,void 0,void 0,void 0,void 0,void 0,void 0,oe),stencilBuffer:x.stencil,colorSpace:e.outputColorSpace,samples:x.antialias?4:0,resolveDepthBuffer:u.ignoreDepthValues===!1,resolveStencilBuffer:u.ignoreDepthValues===!1})}else{const oe={antialias:x.antialias,alpha:!0,depth:x.depth,stencil:x.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(i,t,oe),i.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),M=new rn(f.framebufferWidth,f.framebufferHeight,{format:Ht,type:Kt,colorSpace:e.outputColorSpace,stencilBuffer:x.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}M.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await i.requestReferenceSpace(o),at.setContext(i),at.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return g.getDepthTexture()};function V(Z){for(let ae=0;ae<Z.removed.length;ae++){const oe=Z.removed[ae],Oe=A.indexOf(oe);Oe>=0&&(A[Oe]=null,E[Oe].disconnect(oe))}for(let ae=0;ae<Z.added.length;ae++){const oe=Z.added[ae];let Oe=A.indexOf(oe);if(Oe===-1){for(let Ge=0;Ge<E.length;Ge++)if(Ge>=A.length){A.push(oe),Oe=Ge;break}else if(A[Ge]===null){A[Ge]=oe,Oe=Ge;break}if(Oe===-1)break}const Ne=E[Oe];Ne&&Ne.connect(oe)}}const ie=new C,j=new C;function ge(Z,ae,oe){ie.setFromMatrixPosition(ae.matrixWorld),j.setFromMatrixPosition(oe.matrixWorld);const Oe=ie.distanceTo(j),Ne=ae.projectionMatrix.elements,Ge=oe.projectionMatrix.elements,ot=Ne[14]/(Ne[10]-1),Xe=Ne[14]/(Ne[10]+1),$=(Ne[9]+1)/Ne[5],te=(Ne[9]-1)/Ne[5],Q=(Ne[8]-1)/Ne[0],de=(Ge[8]+1)/Ge[0],R=ot*Q,Fe=ot*de,ve=Oe/(-Q+de),Be=ve*-Q;if(ae.matrixWorld.decompose(Z.position,Z.quaternion,Z.scale),Z.translateX(Be),Z.translateZ(ve),Z.matrixWorld.compose(Z.position,Z.quaternion,Z.scale),Z.matrixWorldInverse.copy(Z.matrixWorld).invert(),Ne[10]===-1)Z.projectionMatrix.copy(ae.projectionMatrix),Z.projectionMatrixInverse.copy(ae.projectionMatrixInverse);else{const le=ot+ve,w=Xe+ve,S=R-Be,U=Fe+(Oe-Be),X=$*Xe/w*le,J=te*Xe/w*le;Z.projectionMatrix.makePerspective(S,U,X,J,le,w),Z.projectionMatrixInverse.copy(Z.projectionMatrix).invert()}}function xe(Z,ae){ae===null?Z.matrixWorld.copy(Z.matrix):Z.matrixWorld.multiplyMatrices(ae.matrixWorld,Z.matrix),Z.matrixWorldInverse.copy(Z.matrixWorld).invert()}this.updateCamera=function(Z){if(i===null)return;let ae=Z.near,oe=Z.far;g.texture!==null&&(g.depthNear>0&&(ae=g.depthNear),g.depthFar>0&&(oe=g.depthFar)),N.near=L.near=b.near=ae,N.far=L.far=b.far=oe,(O!==N.near||G!==N.far)&&(i.updateRenderState({depthNear:N.near,depthFar:N.far}),O=N.near,G=N.far),N.layers.mask=Z.layers.mask|6,b.layers.mask=N.layers.mask&-5,L.layers.mask=N.layers.mask&-3;const Oe=Z.parent,Ne=N.cameras;xe(N,Oe);for(let Ge=0;Ge<Ne.length;Ge++)xe(Ne[Ge],Oe);Ne.length===2?ge(N,b,L):N.projectionMatrix.copy(b.projectionMatrix),_e(Z,N,Oe)};function _e(Z,ae,oe){oe===null?Z.matrix.copy(ae.matrixWorld):(Z.matrix.copy(oe.matrixWorld),Z.matrix.invert(),Z.matrix.multiply(ae.matrixWorld)),Z.matrix.decompose(Z.position,Z.quaternion,Z.scale),Z.updateMatrixWorld(!0),Z.projectionMatrix.copy(ae.projectionMatrix),Z.projectionMatrixInverse.copy(ae.projectionMatrixInverse),Z.isPerspectiveCamera&&(Z.fov=fs*2*Math.atan(1/Z.projectionMatrix.elements[5]),Z.zoom=1)}this.getCamera=function(){return N},this.getFoveation=function(){if(!(u===null&&f===null))return l},this.setFoveation=function(Z){l=Z,u!==null&&(u.fixedFoveation=Z),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=Z)},this.hasDepthSensing=function(){return g.texture!==null},this.getDepthSensingMesh=function(){return g.getMesh(N)},this.getCameraTexture=function(Z){return m[Z]};let ke=null;function it(Z,ae){if(h=ae.getViewerPose(c||a),p=ae,h!==null){const oe=h.views;f!==null&&(e.setRenderTargetFramebuffer(M,f.framebuffer),e.setRenderTarget(M));let Oe=!1;oe.length!==N.cameras.length&&(N.cameras.length=0,Oe=!0);for(let Xe=0;Xe<oe.length;Xe++){const $=oe[Xe];let te=null;if(f!==null)te=f.getViewport($);else{const de=d.getViewSubImage(u,$);te=de.viewport,Xe===0&&(e.setRenderTargetTextures(M,de.colorTexture,de.depthStencilTexture),e.setRenderTarget(M))}let Q=P[Xe];Q===void 0&&(Q=new Dt,Q.layers.enable(Xe),Q.viewport=new ft,P[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(te.x,te.y,te.width,te.height),Xe===0&&(N.matrix.copy(Q.matrix),N.matrix.decompose(N.position,N.quaternion,N.scale)),Oe===!0&&N.cameras.push(Q)}const Ne=i.enabledFeatures;if(Ne&&Ne.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&_){d=n.getBinding();const Xe=d.getDepthInformation(oe[0]);Xe&&Xe.isValid&&Xe.texture&&g.init(Xe,i.renderState)}if(Ne&&Ne.includes("camera-access")&&_){e.state.unbindTexture(),d=n.getBinding();for(let Xe=0;Xe<oe.length;Xe++){const $=oe[Xe].camera;if($){let te=m[$];te||(te=new wu,m[$]=te);const Q=d.getCameraImage($);te.sourceTexture=Q}}}}for(let oe=0;oe<E.length;oe++){const Oe=A[oe],Ne=E[oe];Oe!==null&&Ne!==void 0&&Ne.update(Oe,ae,c||a)}ke&&ke(Z,ae),ae.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ae}),p=null}const at=new Ku;at.setAnimationLoop(it),this.setAnimationLoop=function(Z){ke=Z},this.dispose=function(){}}}const xi=new an,Rv=new He;function Iv(r,e){function t(g,m){g.matrixAutoUpdate===!0&&g.updateMatrix(),m.value.copy(g.matrix)}function n(g,m){m.color.getRGB(g.fogColor.value,Ou(r)),m.isFog?(g.fogNear.value=m.near,g.fogFar.value=m.far):m.isFogExp2&&(g.fogDensity.value=m.density)}function i(g,m,x,y,M){m.isMeshBasicMaterial?s(g,m):m.isMeshLambertMaterial?(s(g,m),m.envMap&&(g.envMapIntensity.value=m.envMapIntensity)):m.isMeshToonMaterial?(s(g,m),d(g,m)):m.isMeshPhongMaterial?(s(g,m),h(g,m),m.envMap&&(g.envMapIntensity.value=m.envMapIntensity)):m.isMeshStandardMaterial?(s(g,m),u(g,m),m.isMeshPhysicalMaterial&&f(g,m,M)):m.isMeshMatcapMaterial?(s(g,m),p(g,m)):m.isMeshDepthMaterial?s(g,m):m.isMeshDistanceMaterial?(s(g,m),_(g,m)):m.isMeshNormalMaterial?s(g,m):m.isLineBasicMaterial?(a(g,m),m.isLineDashedMaterial&&o(g,m)):m.isPointsMaterial?l(g,m,x,y):m.isSpriteMaterial?c(g,m):m.isShadowMaterial?(g.color.value.copy(m.color),g.opacity.value=m.opacity):m.isShaderMaterial&&(m.uniformsNeedUpdate=!1)}function s(g,m){g.opacity.value=m.opacity,m.color&&g.diffuse.value.copy(m.color),m.emissive&&g.emissive.value.copy(m.emissive).multiplyScalar(m.emissiveIntensity),m.map&&(g.map.value=m.map,t(m.map,g.mapTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.bumpMap&&(g.bumpMap.value=m.bumpMap,t(m.bumpMap,g.bumpMapTransform),g.bumpScale.value=m.bumpScale,m.side===Wt&&(g.bumpScale.value*=-1)),m.normalMap&&(g.normalMap.value=m.normalMap,t(m.normalMap,g.normalMapTransform),g.normalScale.value.copy(m.normalScale),m.side===Wt&&g.normalScale.value.negate()),m.displacementMap&&(g.displacementMap.value=m.displacementMap,t(m.displacementMap,g.displacementMapTransform),g.displacementScale.value=m.displacementScale,g.displacementBias.value=m.displacementBias),m.emissiveMap&&(g.emissiveMap.value=m.emissiveMap,t(m.emissiveMap,g.emissiveMapTransform)),m.specularMap&&(g.specularMap.value=m.specularMap,t(m.specularMap,g.specularMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest);const x=e.get(m),y=x.envMap,M=x.envMapRotation;y&&(g.envMap.value=y,xi.copy(M),xi.x*=-1,xi.y*=-1,xi.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(xi.y*=-1,xi.z*=-1),g.envMapRotation.value.setFromMatrix4(Rv.makeRotationFromEuler(xi)),g.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=m.reflectivity,g.ior.value=m.ior,g.refractionRatio.value=m.refractionRatio),m.lightMap&&(g.lightMap.value=m.lightMap,g.lightMapIntensity.value=m.lightMapIntensity,t(m.lightMap,g.lightMapTransform)),m.aoMap&&(g.aoMap.value=m.aoMap,g.aoMapIntensity.value=m.aoMapIntensity,t(m.aoMap,g.aoMapTransform))}function a(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,m.map&&(g.map.value=m.map,t(m.map,g.mapTransform))}function o(g,m){g.dashSize.value=m.dashSize,g.totalSize.value=m.dashSize+m.gapSize,g.scale.value=m.scale}function l(g,m,x,y){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.size.value=m.size*x,g.scale.value=y*.5,m.map&&(g.map.value=m.map,t(m.map,g.uvTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest)}function c(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.rotation.value=m.rotation,m.map&&(g.map.value=m.map,t(m.map,g.mapTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest)}function h(g,m){g.specular.value.copy(m.specular),g.shininess.value=Math.max(m.shininess,1e-4)}function d(g,m){m.gradientMap&&(g.gradientMap.value=m.gradientMap)}function u(g,m){g.metalness.value=m.metalness,m.metalnessMap&&(g.metalnessMap.value=m.metalnessMap,t(m.metalnessMap,g.metalnessMapTransform)),g.roughness.value=m.roughness,m.roughnessMap&&(g.roughnessMap.value=m.roughnessMap,t(m.roughnessMap,g.roughnessMapTransform)),m.envMap&&(g.envMapIntensity.value=m.envMapIntensity)}function f(g,m,x){g.ior.value=m.ior,m.sheen>0&&(g.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),g.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(g.sheenColorMap.value=m.sheenColorMap,t(m.sheenColorMap,g.sheenColorMapTransform)),m.sheenRoughnessMap&&(g.sheenRoughnessMap.value=m.sheenRoughnessMap,t(m.sheenRoughnessMap,g.sheenRoughnessMapTransform))),m.clearcoat>0&&(g.clearcoat.value=m.clearcoat,g.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(g.clearcoatMap.value=m.clearcoatMap,t(m.clearcoatMap,g.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,t(m.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(g.clearcoatNormalMap.value=m.clearcoatNormalMap,t(m.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===Wt&&g.clearcoatNormalScale.value.negate())),m.dispersion>0&&(g.dispersion.value=m.dispersion),m.iridescence>0&&(g.iridescence.value=m.iridescence,g.iridescenceIOR.value=m.iridescenceIOR,g.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(g.iridescenceMap.value=m.iridescenceMap,t(m.iridescenceMap,g.iridescenceMapTransform)),m.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=m.iridescenceThicknessMap,t(m.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),m.transmission>0&&(g.transmission.value=m.transmission,g.transmissionSamplerMap.value=x.texture,g.transmissionSamplerSize.value.set(x.width,x.height),m.transmissionMap&&(g.transmissionMap.value=m.transmissionMap,t(m.transmissionMap,g.transmissionMapTransform)),g.thickness.value=m.thickness,m.thicknessMap&&(g.thicknessMap.value=m.thicknessMap,t(m.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=m.attenuationDistance,g.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(g.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(g.anisotropyMap.value=m.anisotropyMap,t(m.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=m.specularIntensity,g.specularColor.value.copy(m.specularColor),m.specularColorMap&&(g.specularColorMap.value=m.specularColorMap,t(m.specularColorMap,g.specularColorMapTransform)),m.specularIntensityMap&&(g.specularIntensityMap.value=m.specularIntensityMap,t(m.specularIntensityMap,g.specularIntensityMapTransform))}function p(g,m){m.matcap&&(g.matcap.value=m.matcap)}function _(g,m){const x=e.get(m).light;g.referencePosition.value.setFromMatrixPosition(x.matrixWorld),g.nearDistance.value=x.shadow.camera.near,g.farDistance.value=x.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function Pv(r,e,t,n){let i={},s={},a=[];const o=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function l(x,y){const M=y.program;n.uniformBlockBinding(x,M)}function c(x,y){let M=i[x.id];M===void 0&&(p(x),M=h(x),i[x.id]=M,x.addEventListener("dispose",g));const E=y.program;n.updateUBOMapping(x,E);const A=e.render.frame;s[x.id]!==A&&(u(x),s[x.id]=A)}function h(x){const y=d();x.__bindingPointIndex=y;const M=r.createBuffer(),E=x.__size,A=x.usage;return r.bindBuffer(r.UNIFORM_BUFFER,M),r.bufferData(r.UNIFORM_BUFFER,E,A),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,y,M),M}function d(){for(let x=0;x<o;x++)if(a.indexOf(x)===-1)return a.push(x),x;return Le("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function u(x){const y=i[x.id],M=x.uniforms,E=x.__cache;r.bindBuffer(r.UNIFORM_BUFFER,y);for(let A=0,I=M.length;A<I;A++){const v=Array.isArray(M[A])?M[A]:[M[A]];for(let b=0,L=v.length;b<L;b++){const P=v[b];if(f(P,A,b,E)===!0){const N=P.__offset,O=Array.isArray(P.value)?P.value:[P.value];let G=0;for(let z=0;z<O.length;z++){const B=O[z],V=_(B);typeof B=="number"||typeof B=="boolean"?(P.__data[0]=B,r.bufferSubData(r.UNIFORM_BUFFER,N+G,P.__data)):B.isMatrix3?(P.__data[0]=B.elements[0],P.__data[1]=B.elements[1],P.__data[2]=B.elements[2],P.__data[3]=0,P.__data[4]=B.elements[3],P.__data[5]=B.elements[4],P.__data[6]=B.elements[5],P.__data[7]=0,P.__data[8]=B.elements[6],P.__data[9]=B.elements[7],P.__data[10]=B.elements[8],P.__data[11]=0):(B.toArray(P.__data,G),G+=V.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,N,P.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function f(x,y,M,E){const A=x.value,I=y+"_"+M;if(E[I]===void 0)return typeof A=="number"||typeof A=="boolean"?E[I]=A:E[I]=A.clone(),!0;{const v=E[I];if(typeof A=="number"||typeof A=="boolean"){if(v!==A)return E[I]=A,!0}else if(v.equals(A)===!1)return v.copy(A),!0}return!1}function p(x){const y=x.uniforms;let M=0;const E=16;for(let I=0,v=y.length;I<v;I++){const b=Array.isArray(y[I])?y[I]:[y[I]];for(let L=0,P=b.length;L<P;L++){const N=b[L],O=Array.isArray(N.value)?N.value:[N.value];for(let G=0,z=O.length;G<z;G++){const B=O[G],V=_(B),ie=M%E,j=ie%V.boundary,ge=ie+j;M+=j,ge!==0&&E-ge<V.storage&&(M+=E-ge),N.__data=new Float32Array(V.storage/Float32Array.BYTES_PER_ELEMENT),N.__offset=M,M+=V.storage}}}const A=M%E;return A>0&&(M+=E-A),x.__size=M,x.__cache={},this}function _(x){const y={boundary:0,storage:0};return typeof x=="number"||typeof x=="boolean"?(y.boundary=4,y.storage=4):x.isVector2?(y.boundary=8,y.storage=8):x.isVector3||x.isColor?(y.boundary=16,y.storage=12):x.isVector4?(y.boundary=16,y.storage=16):x.isMatrix3?(y.boundary=48,y.storage=48):x.isMatrix4?(y.boundary=64,y.storage=64):x.isTexture?ue("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ue("WebGLRenderer: Unsupported uniform value type.",x),y}function g(x){const y=x.target;y.removeEventListener("dispose",g);const M=a.indexOf(y.__bindingPointIndex);a.splice(M,1),r.deleteBuffer(i[y.id]),delete i[y.id],delete s[y.id]}function m(){for(const x in i)r.deleteBuffer(i[x]);a=[],i={},s={}}return{bind:l,update:c,dispose:m}}const Lv=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 xn=null;function Dv(){return xn===null&&(xn=new Sn(Lv,16,16,hs,zn),xn.name="DFG_LUT",xn.minFilter=pt,xn.magFilter=pt,xn.wrapS=jt,xn.wrapT=jt,xn.generateMipmaps=!1,xn.needsUpdate=!0),xn}class PM{constructor(e={}){const{canvas:t=Yd(),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:d=!1,reversedDepthBuffer:u=!1,outputBufferType:f=Kt}=e;this.isWebGLRenderer=!0;let p;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=n.getContextAttributes().alpha}else p=a;const _=f,g=new Set([Cl,wl,Ma]),m=new Set([Kt,un,Hs,Ws,Tl,Al]),x=new Uint32Array(4),y=new Int32Array(4);let M=null,E=null;const A=[],I=[];let v=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=Mn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const b=this;let L=!1;this._outputColorSpace=$t;let P=0,N=0,O=null,G=-1,z=null;const B=new ft,V=new ft;let ie=null;const j=new Me(0);let ge=0,xe=t.width,_e=t.height,ke=1,it=null,at=null;const Z=new ft(0,0,xe,_e),ae=new ft(0,0,xe,_e);let oe=!1;const Oe=new js;let Ne=!1,Ge=!1;const ot=new He,Xe=new C,$=new ft,te={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Q=!1;function de(){return O===null?ke:1}let R=n;function Fe(T,F){return t.getContext(T,F)}try{const T={alpha:!0,depth:i,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine","three.js r183"),t.addEventListener("webglcontextlost",we,!1),t.addEventListener("webglcontextrestored",We,!1),t.addEventListener("webglcontextcreationerror",dt,!1),R===null){const F="webgl2";if(R=Fe(F,T),R===null)throw Fe(F)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(T){throw Le("WebGLRenderer: "+T.message),T}let ve,Be,le,w,S,U,X,J,q,Ae,ce,De,ze,ee,se,Ee,Ce,ye,Ke,D,he,re,be;function ne(){ve=new U_(R),ve.init(),he=new Tv(R,ve),Be=new E_(R,ve,e,he),le=new Sv(R,ve),Be.reversedDepthBuffer&&u&&le.buffers.depth.setReversed(!0),w=new O_(R),S=new lv,U=new bv(R,ve,le,S,Be,he,w),X=new D_(b),J=new Gm(R),re=new T_(R,J),q=new N_(R,J,w,re),Ae=new z_(R,q,J,re,w),ye=new B_(R,Be,U),se=new w_(S),ce=new ov(b,X,ve,Be,re,se),De=new Iv(b,S),ze=new hv,ee=new gv(ve),Ce=new b_(b,X,le,Ae,p,l),Ee=new Mv(b,Ae,Be),be=new Pv(R,w,Be,le),Ke=new A_(R,ve,w),D=new F_(R,ve,w),w.programs=ce.programs,b.capabilities=Be,b.extensions=ve,b.properties=S,b.renderLists=ze,b.shadowMap=Ee,b.state=le,b.info=w}ne(),_!==Kt&&(v=new k_(_,t.width,t.height,i,s));const Y=new Cv(b,R);this.xr=Y,this.getContext=function(){return R},this.getContextAttributes=function(){return R.getContextAttributes()},this.forceContextLoss=function(){const T=ve.get("WEBGL_lose_context");T&&T.loseContext()},this.forceContextRestore=function(){const T=ve.get("WEBGL_lose_context");T&&T.restoreContext()},this.getPixelRatio=function(){return ke},this.setPixelRatio=function(T){T!==void 0&&(ke=T,this.setSize(xe,_e,!1))},this.getSize=function(T){return T.set(xe,_e)},this.setSize=function(T,F,W=!0){if(Y.isPresenting){ue("WebGLRenderer: Can't change size while VR device is presenting.");return}xe=T,_e=F,t.width=Math.floor(T*ke),t.height=Math.floor(F*ke),W===!0&&(t.style.width=T+"px",t.style.height=F+"px"),v!==null&&v.setSize(t.width,t.height),this.setViewport(0,0,T,F)},this.getDrawingBufferSize=function(T){return T.set(xe*ke,_e*ke).floor()},this.setDrawingBufferSize=function(T,F,W){xe=T,_e=F,ke=W,t.width=Math.floor(T*W),t.height=Math.floor(F*W),this.setViewport(0,0,T,F)},this.setEffects=function(T){if(_===Kt){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(T){for(let F=0;F<T.length;F++)if(T[F].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}v.setEffects(T||[])},this.getCurrentViewport=function(T){return T.copy(B)},this.getViewport=function(T){return T.copy(Z)},this.setViewport=function(T,F,W,H){T.isVector4?Z.set(T.x,T.y,T.z,T.w):Z.set(T,F,W,H),le.viewport(B.copy(Z).multiplyScalar(ke).round())},this.getScissor=function(T){return T.copy(ae)},this.setScissor=function(T,F,W,H){T.isVector4?ae.set(T.x,T.y,T.z,T.w):ae.set(T,F,W,H),le.scissor(V.copy(ae).multiplyScalar(ke).round())},this.getScissorTest=function(){return oe},this.setScissorTest=function(T){le.setScissorTest(oe=T)},this.setOpaqueSort=function(T){it=T},this.setTransparentSort=function(T){at=T},this.getClearColor=function(T){return T.copy(Ce.getClearColor())},this.setClearColor=function(){Ce.setClearColor(...arguments)},this.getClearAlpha=function(){return Ce.getClearAlpha()},this.setClearAlpha=function(){Ce.setClearAlpha(...arguments)},this.clear=function(T=!0,F=!0,W=!0){let H=0;if(T){let k=!1;if(O!==null){const pe=O.texture.format;k=g.has(pe)}if(k){const pe=O.texture.type,Se=m.has(pe),me=Ce.getClearColor(),Re=Ce.getClearAlpha(),Pe=me.r,Ye=me.g,Qe=me.b;Se?(x[0]=Pe,x[1]=Ye,x[2]=Qe,x[3]=Re,R.clearBufferuiv(R.COLOR,0,x)):(y[0]=Pe,y[1]=Ye,y[2]=Qe,y[3]=Re,R.clearBufferiv(R.COLOR,0,y))}else H|=R.COLOR_BUFFER_BIT}F&&(H|=R.DEPTH_BUFFER_BIT),W&&(H|=R.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),H!==0&&R.clear(H)},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",we,!1),t.removeEventListener("webglcontextrestored",We,!1),t.removeEventListener("webglcontextcreationerror",dt,!1),Ce.dispose(),ze.dispose(),ee.dispose(),S.dispose(),X.dispose(),Ae.dispose(),re.dispose(),be.dispose(),ce.dispose(),Y.dispose(),Y.removeEventListener("sessionstart",cc),Y.removeEventListener("sessionend",hc),ii.stop()};function we(T){T.preventDefault(),ua("WebGLRenderer: Context Lost."),L=!0}function We(){ua("WebGLRenderer: Context Restored."),L=!1;const T=w.autoReset,F=Ee.enabled,W=Ee.autoUpdate,H=Ee.needsUpdate,k=Ee.type;ne(),w.autoReset=T,Ee.enabled=F,Ee.autoUpdate=W,Ee.needsUpdate=H,Ee.type=k}function dt(T){Le("WebGLRenderer: A WebGL context could not be created. Reason: ",T.statusMessage)}function st(T){const F=T.target;F.removeEventListener("dispose",st),Tn(F)}function Tn(T){An(T),S.remove(T)}function An(T){const F=S.get(T).programs;F!==void 0&&(F.forEach(function(W){ce.releaseProgram(W)}),T.isShaderMaterial&&ce.releaseShaderCache(T))}this.renderBufferDirect=function(T,F,W,H,k,pe){F===null&&(F=te);const Se=k.isMesh&&k.matrixWorld.determinant()<0,me=sd(T,F,W,H,k);le.setMaterial(H,Se);let Re=W.index,Pe=1;if(H.wireframe===!0){if(Re=q.getWireframeAttribute(W),Re===void 0)return;Pe=2}const Ye=W.drawRange,Qe=W.attributes.position;let Ue=Ye.start*Pe,lt=(Ye.start+Ye.count)*Pe;pe!==null&&(Ue=Math.max(Ue,pe.start*Pe),lt=Math.min(lt,(pe.start+pe.count)*Pe)),Re!==null?(Ue=Math.max(Ue,0),lt=Math.min(lt,Re.count)):Qe!=null&&(Ue=Math.max(Ue,0),lt=Math.min(lt,Qe.count));const xt=lt-Ue;if(xt<0||xt===1/0)return;re.setup(k,H,me,W,Re);let gt,ct=Ke;if(Re!==null&&(gt=J.get(Re),ct=D,ct.setIndex(gt)),k.isMesh)H.wireframe===!0?(le.setLineWidth(H.wireframeLinewidth*de()),ct.setMode(R.LINES)):ct.setMode(R.TRIANGLES);else if(k.isLine){let Rt=H.linewidth;Rt===void 0&&(Rt=1),le.setLineWidth(Rt*de()),k.isLineSegments?ct.setMode(R.LINES):k.isLineLoop?ct.setMode(R.LINE_LOOP):ct.setMode(R.LINE_STRIP)}else k.isPoints?ct.setMode(R.POINTS):k.isSprite&&ct.setMode(R.TRIANGLES);if(k.isBatchedMesh)if(k._multiDrawInstances!==null)da("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),ct.renderMultiDrawInstances(k._multiDrawStarts,k._multiDrawCounts,k._multiDrawCount,k._multiDrawInstances);else if(ve.get("WEBGL_multi_draw"))ct.renderMultiDraw(k._multiDrawStarts,k._multiDrawCounts,k._multiDrawCount);else{const Rt=k._multiDrawStarts,Ie=k._multiDrawCounts,Yt=k._multiDrawCount,et=Re?J.get(Re).bytesPerElement:1,on=S.get(H).currentProgram.getUniforms();for(let pn=0;pn<Yt;pn++)on.setValue(R,"_gl_DrawID",pn),ct.render(Rt[pn]/et,Ie[pn])}else if(k.isInstancedMesh)ct.renderInstances(Ue,xt,k.count);else if(W.isInstancedBufferGeometry){const Rt=W._maxInstanceCount!==void 0?W._maxInstanceCount:1/0,Ie=Math.min(W.instanceCount,Rt);ct.renderInstances(Ue,xt,Ie)}else ct.render(Ue,xt)};function lc(T,F,W){T.transparent===!0&&T.side===Ln&&T.forceSinglePass===!1?(T.side=Wt,T.needsUpdate=!0,ir(T,F,W),T.side=ei,T.needsUpdate=!0,ir(T,F,W),T.side=Ln):ir(T,F,W)}this.compile=function(T,F,W=null){W===null&&(W=T),E=ee.get(W),E.init(F),I.push(E),W.traverseVisible(function(k){k.isLight&&k.layers.test(F.layers)&&(E.pushLight(k),k.castShadow&&E.pushShadow(k))}),T!==W&&T.traverseVisible(function(k){k.isLight&&k.layers.test(F.layers)&&(E.pushLight(k),k.castShadow&&E.pushShadow(k))}),E.setupLights();const H=new Set;return T.traverse(function(k){if(!(k.isMesh||k.isPoints||k.isLine||k.isSprite))return;const pe=k.material;if(pe)if(Array.isArray(pe))for(let Se=0;Se<pe.length;Se++){const me=pe[Se];lc(me,W,k),H.add(me)}else lc(pe,W,k),H.add(pe)}),E=I.pop(),H},this.compileAsync=function(T,F,W=null){const H=this.compile(T,F,W);return new Promise(k=>{function pe(){if(H.forEach(function(Se){S.get(Se).currentProgram.isReady()&&H.delete(Se)}),H.size===0){k(T);return}setTimeout(pe,10)}ve.get("KHR_parallel_shader_compile")!==null?pe():setTimeout(pe,10)})};let Pa=null;function id(T){Pa&&Pa(T)}function cc(){ii.stop()}function hc(){ii.start()}const ii=new Ku;ii.setAnimationLoop(id),typeof self<"u"&&ii.setContext(self),this.setAnimationLoop=function(T){Pa=T,Y.setAnimationLoop(T),T===null?ii.stop():ii.start()},Y.addEventListener("sessionstart",cc),Y.addEventListener("sessionend",hc),this.render=function(T,F){if(F!==void 0&&F.isCamera!==!0){Le("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(L===!0)return;const W=Y.enabled===!0&&Y.isPresenting===!0,H=v!==null&&(O===null||W)&&v.begin(b,O);if(T.matrixWorldAutoUpdate===!0&&T.updateMatrixWorld(),F.parent===null&&F.matrixWorldAutoUpdate===!0&&F.updateMatrixWorld(),Y.enabled===!0&&Y.isPresenting===!0&&(v===null||v.isCompositing()===!1)&&(Y.cameraAutoUpdate===!0&&Y.updateCamera(F),F=Y.getCamera()),T.isScene===!0&&T.onBeforeRender(b,T,F,O),E=ee.get(T,I.length),E.init(F),I.push(E),ot.multiplyMatrices(F.projectionMatrix,F.matrixWorldInverse),Oe.setFromProjectionMatrix(ot,sn,F.reversedDepth),Ge=this.localClippingEnabled,Ne=se.init(this.clippingPlanes,Ge),M=ze.get(T,A.length),M.init(),A.push(M),Y.enabled===!0&&Y.isPresenting===!0){const Se=b.xr.getDepthSensingMesh();Se!==null&&La(Se,F,-1/0,b.sortObjects)}La(T,F,0,b.sortObjects),M.finish(),b.sortObjects===!0&&M.sort(it,at),Q=Y.enabled===!1||Y.isPresenting===!1||Y.hasDepthSensing()===!1,Q&&Ce.addToRenderList(M,T),this.info.render.frame++,Ne===!0&&se.beginShadows();const k=E.state.shadowsArray;if(Ee.render(k,T,F),Ne===!0&&se.endShadows(),this.info.autoReset===!0&&this.info.reset(),(H&&v.hasRenderPass())===!1){const Se=M.opaque,me=M.transmissive;if(E.setupLights(),F.isArrayCamera){const Re=F.cameras;if(me.length>0)for(let Pe=0,Ye=Re.length;Pe<Ye;Pe++){const Qe=Re[Pe];dc(Se,me,T,Qe)}Q&&Ce.render(T);for(let Pe=0,Ye=Re.length;Pe<Ye;Pe++){const Qe=Re[Pe];uc(M,T,Qe,Qe.viewport)}}else me.length>0&&dc(Se,me,T,F),Q&&Ce.render(T),uc(M,T,F)}O!==null&&N===0&&(U.updateMultisampleRenderTarget(O),U.updateRenderTargetMipmap(O)),H&&v.end(b),T.isScene===!0&&T.onAfterRender(b,T,F),re.resetDefaultState(),G=-1,z=null,I.pop(),I.length>0?(E=I[I.length-1],Ne===!0&&se.setGlobalState(b.clippingPlanes,E.state.camera)):E=null,A.pop(),A.length>0?M=A[A.length-1]:M=null};function La(T,F,W,H){if(T.visible===!1)return;if(T.layers.test(F.layers)){if(T.isGroup)W=T.renderOrder;else if(T.isLOD)T.autoUpdate===!0&&T.update(F);else if(T.isLight)E.pushLight(T),T.castShadow&&E.pushShadow(T);else if(T.isSprite){if(!T.frustumCulled||Oe.intersectsSprite(T)){H&&$.setFromMatrixPosition(T.matrixWorld).applyMatrix4(ot);const Se=Ae.update(T),me=T.material;me.visible&&M.push(T,Se,me,W,$.z,null)}}else if((T.isMesh||T.isLine||T.isPoints)&&(!T.frustumCulled||Oe.intersectsObject(T))){const Se=Ae.update(T),me=T.material;if(H&&(T.boundingSphere!==void 0?(T.boundingSphere===null&&T.computeBoundingSphere(),$.copy(T.boundingSphere.center)):(Se.boundingSphere===null&&Se.computeBoundingSphere(),$.copy(Se.boundingSphere.center)),$.applyMatrix4(T.matrixWorld).applyMatrix4(ot)),Array.isArray(me)){const Re=Se.groups;for(let Pe=0,Ye=Re.length;Pe<Ye;Pe++){const Qe=Re[Pe],Ue=me[Qe.materialIndex];Ue&&Ue.visible&&M.push(T,Se,Ue,W,$.z,Qe)}}else me.visible&&M.push(T,Se,me,W,$.z,null)}}const pe=T.children;for(let Se=0,me=pe.length;Se<me;Se++)La(pe[Se],F,W,H)}function uc(T,F,W,H){const{opaque:k,transmissive:pe,transparent:Se}=T;E.setupLightsView(W),Ne===!0&&se.setGlobalState(b.clippingPlanes,W),H&&le.viewport(B.copy(H)),k.length>0&&nr(k,F,W),pe.length>0&&nr(pe,F,W),Se.length>0&&nr(Se,F,W),le.buffers.depth.setTest(!0),le.buffers.depth.setMask(!0),le.buffers.color.setMask(!0),le.setPolygonOffset(!1)}function dc(T,F,W,H){if((W.isScene===!0?W.overrideMaterial:null)!==null)return;if(E.state.transmissionRenderTarget[H.id]===void 0){const Ue=ve.has("EXT_color_buffer_half_float")||ve.has("EXT_color_buffer_float");E.state.transmissionRenderTarget[H.id]=new rn(1,1,{generateMipmaps:!0,type:Ue?zn:Kt,minFilter:Un,samples:Be.samples,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:je.workingColorSpace})}const pe=E.state.transmissionRenderTarget[H.id],Se=H.viewport||B;pe.setSize(Se.z*b.transmissionResolutionScale,Se.w*b.transmissionResolutionScale);const me=b.getRenderTarget(),Re=b.getActiveCubeFace(),Pe=b.getActiveMipmapLevel();b.setRenderTarget(pe),b.getClearColor(j),ge=b.getClearAlpha(),ge<1&&b.setClearColor(16777215,.5),b.clear(),Q&&Ce.render(W);const Ye=b.toneMapping;b.toneMapping=Mn;const Qe=H.viewport;if(H.viewport!==void 0&&(H.viewport=void 0),E.setupLightsView(H),Ne===!0&&se.setGlobalState(b.clippingPlanes,H),nr(T,W,H),U.updateMultisampleRenderTarget(pe),U.updateRenderTargetMipmap(pe),ve.has("WEBGL_multisampled_render_to_texture")===!1){let Ue=!1;for(let lt=0,xt=F.length;lt<xt;lt++){const gt=F[lt],{object:ct,geometry:Rt,material:Ie,group:Yt}=gt;if(Ie.side===Ln&&ct.layers.test(H.layers)){const et=Ie.side;Ie.side=Wt,Ie.needsUpdate=!0,fc(ct,W,H,Rt,Ie,Yt),Ie.side=et,Ie.needsUpdate=!0,Ue=!0}}Ue===!0&&(U.updateMultisampleRenderTarget(pe),U.updateRenderTargetMipmap(pe))}b.setRenderTarget(me,Re,Pe),b.setClearColor(j,ge),Qe!==void 0&&(H.viewport=Qe),b.toneMapping=Ye}function nr(T,F,W){const H=F.isScene===!0?F.overrideMaterial:null;for(let k=0,pe=T.length;k<pe;k++){const Se=T[k],{object:me,geometry:Re,group:Pe}=Se;let Ye=Se.material;Ye.allowOverride===!0&&H!==null&&(Ye=H),me.layers.test(W.layers)&&fc(me,F,W,Re,Ye,Pe)}}function fc(T,F,W,H,k,pe){T.onBeforeRender(b,F,W,H,k,pe),T.modelViewMatrix.multiplyMatrices(W.matrixWorldInverse,T.matrixWorld),T.normalMatrix.getNormalMatrix(T.modelViewMatrix),k.onBeforeRender(b,F,W,H,T,pe),k.transparent===!0&&k.side===Ln&&k.forceSinglePass===!1?(k.side=Wt,k.needsUpdate=!0,b.renderBufferDirect(W,F,H,k,T,pe),k.side=ei,k.needsUpdate=!0,b.renderBufferDirect(W,F,H,k,T,pe),k.side=Ln):b.renderBufferDirect(W,F,H,k,T,pe),T.onAfterRender(b,F,W,H,k,pe)}function ir(T,F,W){F.isScene!==!0&&(F=te);const H=S.get(T),k=E.state.lights,pe=E.state.shadowsArray,Se=k.state.version,me=ce.getParameters(T,k.state,pe,F,W),Re=ce.getProgramCacheKey(me);let Pe=H.programs;H.environment=T.isMeshStandardMaterial||T.isMeshLambertMaterial||T.isMeshPhongMaterial?F.environment:null,H.fog=F.fog;const Ye=T.isMeshStandardMaterial||T.isMeshLambertMaterial&&!T.envMap||T.isMeshPhongMaterial&&!T.envMap;H.envMap=X.get(T.envMap||H.environment,Ye),H.envMapRotation=H.environment!==null&&T.envMap===null?F.environmentRotation:T.envMapRotation,Pe===void 0&&(T.addEventListener("dispose",st),Pe=new Map,H.programs=Pe);let Qe=Pe.get(Re);if(Qe!==void 0){if(H.currentProgram===Qe&&H.lightsStateVersion===Se)return mc(T,me),Qe}else me.uniforms=ce.getUniforms(T),T.onBeforeCompile(me,b),Qe=ce.acquireProgram(me,Re),Pe.set(Re,Qe),H.uniforms=me.uniforms;const Ue=H.uniforms;return(!T.isShaderMaterial&&!T.isRawShaderMaterial||T.clipping===!0)&&(Ue.clippingPlanes=se.uniform),mc(T,me),H.needsLights=ad(T),H.lightsStateVersion=Se,H.needsLights&&(Ue.ambientLightColor.value=k.state.ambient,Ue.lightProbe.value=k.state.probe,Ue.directionalLights.value=k.state.directional,Ue.directionalLightShadows.value=k.state.directionalShadow,Ue.spotLights.value=k.state.spot,Ue.spotLightShadows.value=k.state.spotShadow,Ue.rectAreaLights.value=k.state.rectArea,Ue.ltc_1.value=k.state.rectAreaLTC1,Ue.ltc_2.value=k.state.rectAreaLTC2,Ue.pointLights.value=k.state.point,Ue.pointLightShadows.value=k.state.pointShadow,Ue.hemisphereLights.value=k.state.hemi,Ue.directionalShadowMatrix.value=k.state.directionalShadowMatrix,Ue.spotLightMatrix.value=k.state.spotLightMatrix,Ue.spotLightMap.value=k.state.spotLightMap,Ue.pointShadowMatrix.value=k.state.pointShadowMatrix),H.currentProgram=Qe,H.uniformsList=null,Qe}function pc(T){if(T.uniformsList===null){const F=T.currentProgram.getUniforms();T.uniformsList=sa.seqWithValue(F.seq,T.uniforms)}return T.uniformsList}function mc(T,F){const W=S.get(T);W.outputColorSpace=F.outputColorSpace,W.batching=F.batching,W.batchingColor=F.batchingColor,W.instancing=F.instancing,W.instancingColor=F.instancingColor,W.instancingMorph=F.instancingMorph,W.skinning=F.skinning,W.morphTargets=F.morphTargets,W.morphNormals=F.morphNormals,W.morphColors=F.morphColors,W.morphTargetsCount=F.morphTargetsCount,W.numClippingPlanes=F.numClippingPlanes,W.numIntersection=F.numClipIntersection,W.vertexAlphas=F.vertexAlphas,W.vertexTangents=F.vertexTangents,W.toneMapping=F.toneMapping}function sd(T,F,W,H,k){F.isScene!==!0&&(F=te),U.resetTextureUnits();const pe=F.fog,Se=H.isMeshStandardMaterial||H.isMeshLambertMaterial||H.isMeshPhongMaterial?F.environment:null,me=O===null?b.outputColorSpace:O.isXRRenderTarget===!0?O.texture.colorSpace:us,Re=H.isMeshStandardMaterial||H.isMeshLambertMaterial&&!H.envMap||H.isMeshPhongMaterial&&!H.envMap,Pe=X.get(H.envMap||Se,Re),Ye=H.vertexColors===!0&&!!W.attributes.color&&W.attributes.color.itemSize===4,Qe=!!W.attributes.tangent&&(!!H.normalMap||H.anisotropy>0),Ue=!!W.morphAttributes.position,lt=!!W.morphAttributes.normal,xt=!!W.morphAttributes.color;let gt=Mn;H.toneMapped&&(O===null||O.isXRRenderTarget===!0)&&(gt=b.toneMapping);const ct=W.morphAttributes.position||W.morphAttributes.normal||W.morphAttributes.color,Rt=ct!==void 0?ct.length:0,Ie=S.get(H),Yt=E.state.lights;if(Ne===!0&&(Ge===!0||T!==z)){const Et=T===z&&H.id===G;se.setState(H,T,Et)}let et=!1;H.version===Ie.__version?(Ie.needsLights&&Ie.lightsStateVersion!==Yt.state.version||Ie.outputColorSpace!==me||k.isBatchedMesh&&Ie.batching===!1||!k.isBatchedMesh&&Ie.batching===!0||k.isBatchedMesh&&Ie.batchingColor===!0&&k.colorTexture===null||k.isBatchedMesh&&Ie.batchingColor===!1&&k.colorTexture!==null||k.isInstancedMesh&&Ie.instancing===!1||!k.isInstancedMesh&&Ie.instancing===!0||k.isSkinnedMesh&&Ie.skinning===!1||!k.isSkinnedMesh&&Ie.skinning===!0||k.isInstancedMesh&&Ie.instancingColor===!0&&k.instanceColor===null||k.isInstancedMesh&&Ie.instancingColor===!1&&k.instanceColor!==null||k.isInstancedMesh&&Ie.instancingMorph===!0&&k.morphTexture===null||k.isInstancedMesh&&Ie.instancingMorph===!1&&k.morphTexture!==null||Ie.envMap!==Pe||H.fog===!0&&Ie.fog!==pe||Ie.numClippingPlanes!==void 0&&(Ie.numClippingPlanes!==se.numPlanes||Ie.numIntersection!==se.numIntersection)||Ie.vertexAlphas!==Ye||Ie.vertexTangents!==Qe||Ie.morphTargets!==Ue||Ie.morphNormals!==lt||Ie.morphColors!==xt||Ie.toneMapping!==gt||Ie.morphTargetsCount!==Rt)&&(et=!0):(et=!0,Ie.__version=H.version);let on=Ie.currentProgram;et===!0&&(on=ir(H,F,k));let pn=!1,si=!1,Di=!1;const ht=on.getUniforms(),Ct=Ie.uniforms;if(le.useProgram(on.program)&&(pn=!0,si=!0,Di=!0),H.id!==G&&(G=H.id,si=!0),pn||z!==T){le.buffers.depth.getReversed()&&T.reversedDepth!==!0&&(T._reversedDepth=!0,T.updateProjectionMatrix()),ht.setValue(R,"projectionMatrix",T.projectionMatrix),ht.setValue(R,"viewMatrix",T.matrixWorldInverse);const Wn=ht.map.cameraPosition;Wn!==void 0&&Wn.setValue(R,Xe.setFromMatrixPosition(T.matrixWorld)),Be.logarithmicDepthBuffer&&ht.setValue(R,"logDepthBufFC",2/(Math.log(T.far+1)/Math.LN2)),(H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshLambertMaterial||H.isMeshBasicMaterial||H.isMeshStandardMaterial||H.isShaderMaterial)&&ht.setValue(R,"isOrthographic",T.isOrthographicCamera===!0),z!==T&&(z=T,si=!0,Di=!0)}if(Ie.needsLights&&(Yt.state.directionalShadowMap.length>0&&ht.setValue(R,"directionalShadowMap",Yt.state.directionalShadowMap,U),Yt.state.spotShadowMap.length>0&&ht.setValue(R,"spotShadowMap",Yt.state.spotShadowMap,U),Yt.state.pointShadowMap.length>0&&ht.setValue(R,"pointShadowMap",Yt.state.pointShadowMap,U)),k.isSkinnedMesh){ht.setOptional(R,k,"bindMatrix"),ht.setOptional(R,k,"bindMatrixInverse");const Et=k.skeleton;Et&&(Et.boneTexture===null&&Et.computeBoneTexture(),ht.setValue(R,"boneTexture",Et.boneTexture,U))}k.isBatchedMesh&&(ht.setOptional(R,k,"batchingTexture"),ht.setValue(R,"batchingTexture",k._matricesTexture,U),ht.setOptional(R,k,"batchingIdTexture"),ht.setValue(R,"batchingIdTexture",k._indirectTexture,U),ht.setOptional(R,k,"batchingColorTexture"),k._colorsTexture!==null&&ht.setValue(R,"batchingColorTexture",k._colorsTexture,U));const Hn=W.morphAttributes;if((Hn.position!==void 0||Hn.normal!==void 0||Hn.color!==void 0)&&ye.update(k,W,on),(si||Ie.receiveShadow!==k.receiveShadow)&&(Ie.receiveShadow=k.receiveShadow,ht.setValue(R,"receiveShadow",k.receiveShadow)),(H.isMeshStandardMaterial||H.isMeshLambertMaterial||H.isMeshPhongMaterial)&&H.envMap===null&&F.environment!==null&&(Ct.envMapIntensity.value=F.environmentIntensity),Ct.dfgLUT!==void 0&&(Ct.dfgLUT.value=Dv()),si&&(ht.setValue(R,"toneMappingExposure",b.toneMappingExposure),Ie.needsLights&&rd(Ct,Di),pe&&H.fog===!0&&De.refreshFogUniforms(Ct,pe),De.refreshMaterialUniforms(Ct,H,ke,_e,E.state.transmissionRenderTarget[T.id]),sa.upload(R,pc(Ie),Ct,U)),H.isShaderMaterial&&H.uniformsNeedUpdate===!0&&(sa.upload(R,pc(Ie),Ct,U),H.uniformsNeedUpdate=!1),H.isSpriteMaterial&&ht.setValue(R,"center",k.center),ht.setValue(R,"modelViewMatrix",k.modelViewMatrix),ht.setValue(R,"normalMatrix",k.normalMatrix),ht.setValue(R,"modelMatrix",k.matrixWorld),H.isShaderMaterial||H.isRawShaderMaterial){const Et=H.uniformsGroups;for(let Wn=0,Ui=Et.length;Wn<Ui;Wn++){const gc=Et[Wn];be.update(gc,on),be.bind(gc,on)}}return on}function rd(T,F){T.ambientLightColor.needsUpdate=F,T.lightProbe.needsUpdate=F,T.directionalLights.needsUpdate=F,T.directionalLightShadows.needsUpdate=F,T.pointLights.needsUpdate=F,T.pointLightShadows.needsUpdate=F,T.spotLights.needsUpdate=F,T.spotLightShadows.needsUpdate=F,T.rectAreaLights.needsUpdate=F,T.hemisphereLights.needsUpdate=F}function ad(T){return T.isMeshLambertMaterial||T.isMeshToonMaterial||T.isMeshPhongMaterial||T.isMeshStandardMaterial||T.isShadowMaterial||T.isShaderMaterial&&T.lights===!0}this.getActiveCubeFace=function(){return P},this.getActiveMipmapLevel=function(){return N},this.getRenderTarget=function(){return O},this.setRenderTargetTextures=function(T,F,W){const H=S.get(T);H.__autoAllocateDepthBuffer=T.resolveDepthBuffer===!1,H.__autoAllocateDepthBuffer===!1&&(H.__useRenderToTexture=!1),S.get(T.texture).__webglTexture=F,S.get(T.depthTexture).__webglTexture=H.__autoAllocateDepthBuffer?void 0:W,H.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(T,F){const W=S.get(T);W.__webglFramebuffer=F,W.__useDefaultFramebuffer=F===void 0};const od=R.createFramebuffer();this.setRenderTarget=function(T,F=0,W=0){O=T,P=F,N=W;let H=null,k=!1,pe=!1;if(T){const me=S.get(T);if(me.__useDefaultFramebuffer!==void 0){le.bindFramebuffer(R.FRAMEBUFFER,me.__webglFramebuffer),B.copy(T.viewport),V.copy(T.scissor),ie=T.scissorTest,le.viewport(B),le.scissor(V),le.setScissorTest(ie),G=-1;return}else if(me.__webglFramebuffer===void 0)U.setupRenderTarget(T);else if(me.__hasExternalTextures)U.rebindTextures(T,S.get(T.texture).__webglTexture,S.get(T.depthTexture).__webglTexture);else if(T.depthBuffer){const Ye=T.depthTexture;if(me.__boundDepthTexture!==Ye){if(Ye!==null&&S.has(Ye)&&(T.width!==Ye.image.width||T.height!==Ye.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");U.setupDepthRenderbuffer(T)}}const Re=T.texture;(Re.isData3DTexture||Re.isDataArrayTexture||Re.isCompressedArrayTexture)&&(pe=!0);const Pe=S.get(T).__webglFramebuffer;T.isWebGLCubeRenderTarget?(Array.isArray(Pe[F])?H=Pe[F][W]:H=Pe[F],k=!0):T.samples>0&&U.useMultisampledRTT(T)===!1?H=S.get(T).__webglMultisampledFramebuffer:Array.isArray(Pe)?H=Pe[W]:H=Pe,B.copy(T.viewport),V.copy(T.scissor),ie=T.scissorTest}else B.copy(Z).multiplyScalar(ke).floor(),V.copy(ae).multiplyScalar(ke).floor(),ie=oe;if(W!==0&&(H=od),le.bindFramebuffer(R.FRAMEBUFFER,H)&&le.drawBuffers(T,H),le.viewport(B),le.scissor(V),le.setScissorTest(ie),k){const me=S.get(T.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_CUBE_MAP_POSITIVE_X+F,me.__webglTexture,W)}else if(pe){const me=F;for(let Re=0;Re<T.textures.length;Re++){const Pe=S.get(T.textures[Re]);R.framebufferTextureLayer(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0+Re,Pe.__webglTexture,W,me)}}else if(T!==null&&W!==0){const me=S.get(T.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,me.__webglTexture,W)}G=-1},this.readRenderTargetPixels=function(T,F,W,H,k,pe,Se,me=0){if(!(T&&T.isWebGLRenderTarget)){Le("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Re=S.get(T).__webglFramebuffer;if(T.isWebGLCubeRenderTarget&&Se!==void 0&&(Re=Re[Se]),Re){le.bindFramebuffer(R.FRAMEBUFFER,Re);try{const Pe=T.textures[me],Ye=Pe.format,Qe=Pe.type;if(T.textures.length>1&&R.readBuffer(R.COLOR_ATTACHMENT0+me),!Be.textureFormatReadable(Ye)){Le("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Be.textureTypeReadable(Qe)){Le("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}F>=0&&F<=T.width-H&&W>=0&&W<=T.height-k&&R.readPixels(F,W,H,k,he.convert(Ye),he.convert(Qe),pe)}finally{const Pe=O!==null?S.get(O).__webglFramebuffer:null;le.bindFramebuffer(R.FRAMEBUFFER,Pe)}}},this.readRenderTargetPixelsAsync=async function(T,F,W,H,k,pe,Se,me=0){if(!(T&&T.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Re=S.get(T).__webglFramebuffer;if(T.isWebGLCubeRenderTarget&&Se!==void 0&&(Re=Re[Se]),Re)if(F>=0&&F<=T.width-H&&W>=0&&W<=T.height-k){le.bindFramebuffer(R.FRAMEBUFFER,Re);const Pe=T.textures[me],Ye=Pe.format,Qe=Pe.type;if(T.textures.length>1&&R.readBuffer(R.COLOR_ATTACHMENT0+me),!Be.textureFormatReadable(Ye))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Be.textureTypeReadable(Qe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Ue=R.createBuffer();R.bindBuffer(R.PIXEL_PACK_BUFFER,Ue),R.bufferData(R.PIXEL_PACK_BUFFER,pe.byteLength,R.STREAM_READ),R.readPixels(F,W,H,k,he.convert(Ye),he.convert(Qe),0);const lt=O!==null?S.get(O).__webglFramebuffer:null;le.bindFramebuffer(R.FRAMEBUFFER,lt);const xt=R.fenceSync(R.SYNC_GPU_COMMANDS_COMPLETE,0);return R.flush(),await Zd(R,xt,4),R.bindBuffer(R.PIXEL_PACK_BUFFER,Ue),R.getBufferSubData(R.PIXEL_PACK_BUFFER,0,pe),R.deleteBuffer(Ue),R.deleteSync(xt),pe}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(T,F=null,W=0){const H=Math.pow(2,-W),k=Math.floor(T.image.width*H),pe=Math.floor(T.image.height*H),Se=F!==null?F.x:0,me=F!==null?F.y:0;U.setTexture2D(T,0),R.copyTexSubImage2D(R.TEXTURE_2D,W,0,0,Se,me,k,pe),le.unbindTexture()};const ld=R.createFramebuffer(),cd=R.createFramebuffer();this.copyTextureToTexture=function(T,F,W=null,H=null,k=0,pe=0){let Se,me,Re,Pe,Ye,Qe,Ue,lt,xt;const gt=T.isCompressedTexture?T.mipmaps[pe]:T.image;if(W!==null)Se=W.max.x-W.min.x,me=W.max.y-W.min.y,Re=W.isBox3?W.max.z-W.min.z:1,Pe=W.min.x,Ye=W.min.y,Qe=W.isBox3?W.min.z:0;else{const Ct=Math.pow(2,-k);Se=Math.floor(gt.width*Ct),me=Math.floor(gt.height*Ct),T.isDataArrayTexture?Re=gt.depth:T.isData3DTexture?Re=Math.floor(gt.depth*Ct):Re=1,Pe=0,Ye=0,Qe=0}H!==null?(Ue=H.x,lt=H.y,xt=H.z):(Ue=0,lt=0,xt=0);const ct=he.convert(F.format),Rt=he.convert(F.type);let Ie;F.isData3DTexture?(U.setTexture3D(F,0),Ie=R.TEXTURE_3D):F.isDataArrayTexture||F.isCompressedArrayTexture?(U.setTexture2DArray(F,0),Ie=R.TEXTURE_2D_ARRAY):(U.setTexture2D(F,0),Ie=R.TEXTURE_2D),R.pixelStorei(R.UNPACK_FLIP_Y_WEBGL,F.flipY),R.pixelStorei(R.UNPACK_PREMULTIPLY_ALPHA_WEBGL,F.premultiplyAlpha),R.pixelStorei(R.UNPACK_ALIGNMENT,F.unpackAlignment);const Yt=R.getParameter(R.UNPACK_ROW_LENGTH),et=R.getParameter(R.UNPACK_IMAGE_HEIGHT),on=R.getParameter(R.UNPACK_SKIP_PIXELS),pn=R.getParameter(R.UNPACK_SKIP_ROWS),si=R.getParameter(R.UNPACK_SKIP_IMAGES);R.pixelStorei(R.UNPACK_ROW_LENGTH,gt.width),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,gt.height),R.pixelStorei(R.UNPACK_SKIP_PIXELS,Pe),R.pixelStorei(R.UNPACK_SKIP_ROWS,Ye),R.pixelStorei(R.UNPACK_SKIP_IMAGES,Qe);const Di=T.isDataArrayTexture||T.isData3DTexture,ht=F.isDataArrayTexture||F.isData3DTexture;if(T.isDepthTexture){const Ct=S.get(T),Hn=S.get(F),Et=S.get(Ct.__renderTarget),Wn=S.get(Hn.__renderTarget);le.bindFramebuffer(R.READ_FRAMEBUFFER,Et.__webglFramebuffer),le.bindFramebuffer(R.DRAW_FRAMEBUFFER,Wn.__webglFramebuffer);for(let Ui=0;Ui<Re;Ui++)Di&&(R.framebufferTextureLayer(R.READ_FRAMEBUFFER,R.COLOR_ATTACHMENT0,S.get(T).__webglTexture,k,Qe+Ui),R.framebufferTextureLayer(R.DRAW_FRAMEBUFFER,R.COLOR_ATTACHMENT0,S.get(F).__webglTexture,pe,xt+Ui)),R.blitFramebuffer(Pe,Ye,Se,me,Ue,lt,Se,me,R.DEPTH_BUFFER_BIT,R.NEAREST);le.bindFramebuffer(R.READ_FRAMEBUFFER,null),le.bindFramebuffer(R.DRAW_FRAMEBUFFER,null)}else if(k!==0||T.isRenderTargetTexture||S.has(T)){const Ct=S.get(T),Hn=S.get(F);le.bindFramebuffer(R.READ_FRAMEBUFFER,ld),le.bindFramebuffer(R.DRAW_FRAMEBUFFER,cd);for(let Et=0;Et<Re;Et++)Di?R.framebufferTextureLayer(R.READ_FRAMEBUFFER,R.COLOR_ATTACHMENT0,Ct.__webglTexture,k,Qe+Et):R.framebufferTexture2D(R.READ_FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,Ct.__webglTexture,k),ht?R.framebufferTextureLayer(R.DRAW_FRAMEBUFFER,R.COLOR_ATTACHMENT0,Hn.__webglTexture,pe,xt+Et):R.framebufferTexture2D(R.DRAW_FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,Hn.__webglTexture,pe),k!==0?R.blitFramebuffer(Pe,Ye,Se,me,Ue,lt,Se,me,R.COLOR_BUFFER_BIT,R.NEAREST):ht?R.copyTexSubImage3D(Ie,pe,Ue,lt,xt+Et,Pe,Ye,Se,me):R.copyTexSubImage2D(Ie,pe,Ue,lt,Pe,Ye,Se,me);le.bindFramebuffer(R.READ_FRAMEBUFFER,null),le.bindFramebuffer(R.DRAW_FRAMEBUFFER,null)}else ht?T.isDataTexture||T.isData3DTexture?R.texSubImage3D(Ie,pe,Ue,lt,xt,Se,me,Re,ct,Rt,gt.data):F.isCompressedArrayTexture?R.compressedTexSubImage3D(Ie,pe,Ue,lt,xt,Se,me,Re,ct,gt.data):R.texSubImage3D(Ie,pe,Ue,lt,xt,Se,me,Re,ct,Rt,gt):T.isDataTexture?R.texSubImage2D(R.TEXTURE_2D,pe,Ue,lt,Se,me,ct,Rt,gt.data):T.isCompressedTexture?R.compressedTexSubImage2D(R.TEXTURE_2D,pe,Ue,lt,gt.width,gt.height,ct,gt.data):R.texSubImage2D(R.TEXTURE_2D,pe,Ue,lt,Se,me,ct,Rt,gt);R.pixelStorei(R.UNPACK_ROW_LENGTH,Yt),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,et),R.pixelStorei(R.UNPACK_SKIP_PIXELS,on),R.pixelStorei(R.UNPACK_SKIP_ROWS,pn),R.pixelStorei(R.UNPACK_SKIP_IMAGES,si),pe===0&&F.generateMipmaps&&R.generateMipmap(Ie),le.unbindTexture()},this.initRenderTarget=function(T){S.get(T).__webglFramebuffer===void 0&&U.setupRenderTarget(T)},this.initTexture=function(T){T.isCubeTexture?U.setTextureCube(T,0):T.isData3DTexture?U.setTexture3D(T,0):T.isDataArrayTexture||T.isCompressedArrayTexture?U.setTexture2DArray(T,0):U.setTexture2D(T,0),le.unbindTexture()},this.resetState=function(){P=0,N=0,O=null,le.reset(),re.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return sn}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{ru as ACESFilmicToneMapping,yi as AddEquation,Ld as AddOperation,gu as AdditiveAnimationBlendMode,xc as AdditiveBlending,ou as AgXToneMapping,pu as AlphaFormat,Wd as AlwaysCompare,Co as AlwaysDepth,bc as AlwaysStencilFunc,cm as AmbientLight,Lm as AnimationAction,xa as AnimationClip,Xy as AnimationLoader,sM as AnimationMixer,iM as AnimationObjectGroup,Wy as AnimationUtils,ep as ArcCurve,gm as ArrayCamera,EM as ArrowHelper,Mc as AttachedBindMode,ym as Audio,nM as AudioAnalyser,Yu as AudioContext,eM as AudioListener,Qy as AudioLoader,wM as AxesHelper,Wt as BackSide,Od as BasicDepthPacking,Bv as BasicShadowMap,Zf as BatchedMesh,$p as BezierInterpolant,Au as Bone,xs as BooleanKeyframeTrack,fM as Box2,Bt as Box3,TM as Box3Helper,_s as BoxGeometry,bM as BoxHelper,ut as BufferAttribute,qe as BufferGeometry,fm as BufferGeometryLoader,hu as ByteType,Nn as Cache,sc as Camera,SM as CameraHelper,Hy as CanvasTexture,Gl as CapsuleGeometry,tp as CatmullRomCurve3,su as CineonToneMapping,Hl as Cir
4049cleGeometry,jt as ClampToEdgeWrapping,hM as Clock,Me as Color,Wu as ColorKeyframeTrack,je as ColorManagement,Ey as Compatibility,ky as CompressedArrayTexture,Gy as CompressedCubeTexture,kl as CompressedTexture,qy as CompressedTextureLoader,Ta as ConeGeometry,Rd as ConstantAlphaFactor,wd as ConstantColorFactor,RM as Controls,mm as CubeCamera,Qf as CubeDepthTexture,Bn as CubeReflectionMapping,Ei as CubeRefractionMapping,Sa as CubeTexture,Yy as CubeTextureLoader,Ks as CubeUVReflectionMapping,Cu as CubicBezierCurve,cp as CubicBezierCurve3,Zp as CubicInterpolant,_c as CullFaceBack,ud as CullFaceFront,Ov as CullFaceFrontBack,hd as CullFaceNone,bn as Curve,up as CurvePath,fd as CustomBlending,au as CustomToneMapping,ba as CylinderGeometry,dM as Cylindrical,Ul as Data3DTexture,Dl as DataArrayTexture,Sn as DataTexture,Zy as DataTextureLoader,Ly as DataUtils,iy as DecrementStencilOp,ry as DecrementWrapStencilOp,em as DefaultLoadingManager,Vn as DepthFormat,Si as DepthStencilFormat,Ys as DepthTexture,Dd as DetachedBindMode,lm as DirectionalLight,MM as DirectionalLightHelper,Jp as DiscreteInterpolant,Wl as DodecahedronGeometry,Ln as DoubleSide,Sd as DstAlphaFactor,Td as DstColorFactor,yy as DynamicCopyUsage,py as DynamicDrawUsage,_y as DynamicReadUsage,jf as EdgesGeometry,Xl as EllipseCurve,kd as EqualCompare,Io as EqualDepth,cy as EqualStencilFunc,Kr as EquirectangularReflectionMapping,Qr as EquirectangularRefractionMapping,an as Euler,kn as EventDispatcher,wu as ExternalTexture,Yl as ExtrudeGeometry,ni as FileLoader,By as Float16BufferAttribute,Te as Float32BufferAttribute,Gt as FloatType,Ol as Fog,Fl as FogExp2,Vy as FramebufferTexture,ei as FrontSide,js as Frustum,Vl as FrustumArray,lM as GLBufferAttribute,Sy as GLSL1,Tc as GLSL3,Gd as GreaterCompare,Lo as GreaterDepth,Pl as GreaterEqualCompare,Po as GreaterEqualDepth,fy as GreaterEqualStencilFunc,uy as GreaterStencilFunc,vM as GridHelper,Fs as Group,zn as HalfFloatType,nm as HemisphereLight,xM as HemisphereLightHelper,Zl as IcosahedronGeometry,Ky as ImageBitmapLoader,va as ImageLoader,pf as ImageUtils,ny as IncrementStencilOp,sy as IncrementWrapStencilOp,qs as InstancedBufferAttribute,dm as InstancedBufferGeometry,oM as InstancedInterleavedBuffer,Of as InstancedMesh,Fy as Int16BufferAttribute,Oy as Int32BufferAttribute,Dy as Int8BufferAttribute,bl as IntType,Bl as InterleavedBuffer,ps as InterleavedBufferAttribute,tr as Interpolant,Sc as InterpolateBezier,oa as InterpolateDiscrete,dl as InterpolateLinear,Da as InterpolateSmooth,Ay as InterpolationSamplingMode,Ty as InterpolationSamplingType,ay as InvertStencilOp,Ni as KeepStencilOp,fn as KeyframeTrack,Pf as LOD,Jl as LatheGeometry,Nl as Layers,Vd as LessCompare,Ro as LessDepth,Il as LessEqualCompare,cs as LessEqualDepth,hy as LessEqualStencilFunc,ly as LessStencilFunc,Li as Light,um as LightProbe,wi as Line,pM as Line3,qt as LineBasicMaterial,Ru as LineCurve,hp as LineCurve3,Xp as LineDashedMaterial,Jf as LineLoop,Gn as LineSegments,pt as LinearFilter,Hu as LinearInterpolant,Hv as LinearMipMapLinearFilter,Gv as LinearMipMapNearestFilter,Un as LinearMipmapLinearFilter,jr as LinearMipmapNearestFilter,us as LinearSRGBColorSpace,nu as LinearToneMapping,ca as LinearTransfer,tn as Loader,_h as LoaderUtils,Xu as LoadingManager,Ud as LoopOnce,Fd as LoopPingPong,Nd as LoopRepeat,Nv as MOUSE,zt as Material,zv as MaterialBlending,rc as MaterialLoader,Ry as MathUtils,Ju as Matrix2,Ze as Matrix3,He as Matrix4,_d as MaxEquation,bt as Mesh,Ii as MeshBasicMaterial,Vu as MeshDepthMaterial,ku as MeshDistanceMaterial,Hp as MeshLambertMaterial,Wp as MeshMatcapMaterial,Gp as MeshNormalMaterial,Vp as MeshPhongMaterial,zp as MeshPhysicalMaterial,zu as MeshStandardMaterial,kp as MeshToonMaterial,gd as MinEquation,aa as MirroredRepeatWrapping,Pd as MixOperation,yc as MultiplyBlending,ya as MultiplyOperation,St as NearestFilter,kv as NearestMipMapLinearFilter,Vv as NearestMipMapNearestFilter,Ns as NearestMipmapLinearFilter,cu as NearestMipmapNearestFilter,lu as NeutralToneMapping,zd as NeverCompare,wo as NeverDepth,oy as NeverStencilFunc,Fn as NoBlending,Qn as NoColorSpace,Kv as N
4049oNormalPacking,Mn as NoToneMapping,Rl as NormalAnimationBlendMode,as as NormalBlending,jv as NormalGAPacking,Qv as NormalRGPacking,Hd as NotEqualCompare,Do as NotEqualDepth,dy as NotEqualStencilFunc,ga as NumberKeyframeTrack,nt as Object3D,$y as ObjectLoader,Bd as ObjectSpaceNormalMap,Aa as OctahedronGeometry,vd as OneFactor,Id as OneMinusConstantAlphaFactor,Cd as OneMinusConstantColorFactor,bd as OneMinusDstAlphaFactor,Ad as OneMinusDstColorFactor,Eo as OneMinusSrcAlphaFactor,Md as OneMinusSrcColorFactor,Ca as OrthographicCamera,$r as PCFShadowMap,dd as PCFSoftShadowMap,Nh as PMREMGenerator,pl as Path,Dt as PerspectiveCamera,vi as Plane,er as PlaneGeometry,AM as PlaneHelper,am as PointLight,_M as PointLightHelper,$f as Points,Eu as PointsMaterial,yM as PolarGridHelper,Pi as PolyhedronGeometry,tM as PositionalAudio,tt as PropertyBinding,Sm as PropertyMixer,Iu as QuadraticBezierCurve,Pu as QuadraticBezierCurve3,Xt as Quaternion,wa as QuaternionKeyframeTrack,Kp as QuaternionLinearInterpolant,ko as R11_EAC_Format,hl as RED_GREEN_RGTC2_Format,ll as RED_RGTC1_Format,Uv as REVISION,Ho as RG11_EAC_Format,Zv as RGBADepthPacking,Ht as RGBAFormat,Cl as RGBAIntegerFormat,nl as RGBA_ASTC_10x10_Format,jo as RGBA_ASTC_10x5_Format,el as RGBA_ASTC_10x6_Format,tl as RGBA_ASTC_10x8_Format,il as RGBA_ASTC_12x10_Format,sl as RGBA_ASTC_12x12_Format,Xo as RGBA_ASTC_4x4_Format,qo as RGBA_ASTC_5x4_Format,Yo as RGBA_ASTC_5x5_Format,Zo as RGBA_ASTC_6x5_Format,Jo as RGBA_ASTC_6x6_Format,$o as RGBA_ASTC_8x5_Format,Ko as RGBA_ASTC_8x6_Format,Qo as RGBA_ASTC_8x8_Format,rl as RGBA_BPTC_Format,Vo as RGBA_ETC2_EAC_Format,Oo as RGBA_PVRTC_2BPPV1_Format,Fo as RGBA_PVRTC_4BPPV1_Format,ta as RGBA_S3TC_DXT1_Format,na as RGBA_S3TC_DXT3_Format,ia as RGBA_S3TC_DXT5_Format,Jv as RGBDepthPacking,mu as RGBFormat,Wv as RGBIntegerFormat,al as RGB_BPTC_SIGNED_Format,ol as RGB_BPTC_UNSIGNED_Format,Bo as RGB_ETC1_Format,zo as RGB_ETC2_Format,No as RGB_PVRTC_2BPPV1_Format,Uo as RGB_PVRTC_4BPPV1_Format,ea as RGB_S3TC_DXT1_Format,$v as RGDepthPacking,hs as RGFormat,wl as RGIntegerFormat,Bu as RawShaderMaterial,Qs as Ray,cM as Raycaster,hm as RectAreaLight,El as RedFormat,Ma as RedIntegerFormat,iu as ReinhardToneMapping,vu as RenderTarget,rM as RenderTarget3D,ra as RepeatWrapping,ty as ReplaceStencilOp,md as ReverseSubtractEquation,$l as RingGeometry,Go as SIGNED_R11_EAC_Format,ul as SIGNED_RED_GREEN_RGTC2_Format,cl as SIGNED_RED_RGTC1_Format,Wo as SIGNED_RG11_EAC_Format,$t as SRGBColorSpace,rt as SRGBTransfer,Tf as Scene,$e as ShaderChunk,vn as ShaderLib,dn as ShaderMaterial,Up as ShadowMaterial,ls as Shape,Kl as ShapeGeometry,CM as ShapePath,yn as ShapeUtils,uu as ShortType,zl as Skeleton,gM as SkeletonHelper,Uf as SkinnedMesh,bi as Source,Ut as Sphere,Ea as SphereGeometry,uM as Spherical,qu as SphericalHarmonics3,Lu as SplineCurve,sm as SpotLight,mM as SpotLightHelper,If as Sprite,bu as SpriteMaterial,Ao as SrcAlphaFactor,Ed as SrcAlphaSaturateFactor,yd as SrcColorFactor,vy as StaticCopyUsage,ha as StaticDrawUsage,gy as StaticReadUsage,jy as StereoCamera,My as StreamCopyUsage,my as StreamDrawUsage,xy as StreamReadUsage,vs as StringKeyframeTrack,pd as SubtractEquation,vc as SubtractiveBlending,Fv as TOUCH,Ri as TangentSpaceNormalMap,Ql as TetrahedronGeometry,yt as Texture,Jy as TextureLoader,IM as TextureUtils,_m as Timer,by as TimestampQuery,jl as TorusGeometry,ec as TorusKnotGeometry,Qt as Triangle,Yv as TriangleFanDrawMode,qv as TriangleStripDrawMode,Xv as TrianglesDrawMode,tc as TubeGeometry,Sl as UVMapping,Mu as Uint16BufferAttribute,Su as Uint32BufferAttribute,Uy as Uint8BufferAttribute,Ny as Uint8ClampedBufferAttribute,Zu as Uniform,aM as UniformsGroup,fe as UniformsLib,Fp as UniformsUtils,Kt as UnsignedByteType,fu as UnsignedInt101111Type,Ws as UnsignedInt248Type,du as UnsignedInt5999Type,un as UnsignedIntType,Tl as UnsignedShort4444Type,Al as UnsignedShort5551Type,Hs as UnsignedShortType,Us as VSMShadowMap,K as Vector2,C as Vector3,ft as Vector4,_a as VectorKeyframeTrack,zy as VideoFrameTexture,Kf as VideoTexture,Py as WebGL3DRenderTarget,Iy as WebGLArrayRenderTarget,sn as WebGLCoordinateSystem,Qu as WebGLCubeRen
4049derTarget,rn as WebGLRenderTarget,PM as WebGLRenderer,Tv as WebGLUtils,ds as WebGPUCoordinateSystem,za as WebXRController,Dp as WireframeGeometry,la as WrapAroundEnding,is as ZeroCurvatureEnding,xd as ZeroFactor,ss as ZeroSlopeEnding,ey as ZeroStencilOp,Yd as createCanvasElement,Le as error,Cy as getConsoleFunction,ua as log,wy as setConsoleFunction,ue as warn,da 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.