PageSourceSearch

https://twinforgefit.ai/assets/three.module-Dvpzs4Jl.js

js twinforgefit.ai collected 2026-10-05 14:32:07 UTC 733,124 bytes, 4,112 lines download raw bytes

1/**
2 * @license
3 * Copyright 2010-2026 Three.js Authors
4 * SPDX-License-Identifier: MIT
5 */(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};s.SENTRY_RELEASE={id:"19ca80bcc68db376b793c8a886be03b6d5ea8a5c"};var e=new s.Error().stack;e&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[e]="fc894021-d6f1-4a28-89d4-c3ac2139590b",s._sentryDebugIdIdentifier="sentry-dbid-fc894021-d6f1-4a28-89d4-c3ac2139590b")}catch{}})();const Al="184",Jv={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},$v={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},bd=0,Ac=1,Td=2,Kv=3,Qv=0,$r=1,Ad=2,Fs=3,si=0,Yt=1,Fn=2,Vn=0,ls=1,Ec=2,wc=3,Cc=4,Ed=5,jv=6,Si=100,wd=101,Cd=102,Rd=103,Id=104,Pd=200,Ld=201,Dd=202,Ud=203,Ro=204,Io=205,Nd=206,Fd=207,Od=208,Bd=209,zd=210,Vd=211,kd=212,Gd=213,Hd=214,Po=0,Lo=1,Do=2,us=3,Uo=4,No=5,Fo=6,Oo=7,ba=0,Wd=1,Xd=2,Tn=0,fu=1,pu=2,mu=3,gu=4,_u=5,xu=6,vu=7,Rc="attached",qd="detached",El=300,Gn=301,Ci=302,Kr=303,Qr=304,Qs=306,ra=1e3,nn=1001,aa=1002,wt=1003,yu=1004,ey=1004,Os=1005,ty=1005,_t=1006,jr=1007,ny=1007,Bn=1008,iy=1008,en=1009,Mu=1010,Su=1011,Xs=1012,wl=1013,fn=1014,Xt=1015,Hn=1016,Cl=1017,Rl=1018,qs=1020,bu=35902,Tu=35899,Au=1021,Eu=1022,qt=1023,Wn=1026,Ti=1027,Il=1028,Ta=1029,Ri=1030,Pl=1031,sy=1032,Ll=1033,ea=33776,ta=33777,na=33778,ia=33779,Bo=35840,zo=35841,Vo=35842,ko=35843,Go=36196,Ho=37492,Wo=37496,Xo=37488,qo=37489,oa=37490,Yo=37491,Zo=37808,Jo=37809,$o=37810,Ko=37811,Qo=37812,jo=37813,el=37814,tl=37815,nl=37816,il=37817,sl=37818,rl=37819,al=37820,ol=37821,ll=36492,cl=36494,hl=36495,ul=36283,dl=36284,la=36285,fl=36286,Yd=2200,Zd=2201,Jd=2202,ca=2300,pl=2301,Fa=2302,Ic=2303,rs=2400,as=2401,ha=2402,Dl=2500,wu=2501,ry=0,ay=1,oy=2,$d=3200,ly=3201,cy=3202,hy=3203,ri=0,Kd=1,ni="",jt="srgb",ua="srgb-linear",da="linear",ct="srgb",uy="",dy="rg",fy="ga",py=0,Oi=7680,my=7681,gy=7682,_y=7683,xy=34055,vy=34056,yy=5386,My=512,Sy=513,by=514,Ty=
5515,Ay=516,Ey=517,wy=518,Pc=519,Qd=512,jd=513,ef=514,Ul=515,tf=516,nf=517,Nl=518,sf=519,fa=35044,Cy=35048,Ry=35040,Iy=35045,Py=35049,Ly=35041,Dy=35046,Uy=35050,Ny=35042,Fy="100",Lc="300 es",ln=2e3,ds=2001,Oy={COMPUTE:"compute",RENDER:"render"},By={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},zy={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},Vy={TEXTURE_COMPARE:"depthTextureCompare"};function rf(s){for(let e=s.length-1;e>=0;--e)if(s[e]>=65535)return!0;return!1}const af={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function os(s,e){return new af[s](e)}function Cu(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)}function Ys(s){return document.createElementNS("http://www.w3.org/1999/xhtml",s)}function of(){const s=Ys("canvas");return s.style.display="block",s}const Dc={};let ai=null;function ky(s){ai=s}function Gy(){return ai}function pa(...s){const e="THREE."+s.shift();ai&&ai("log",e,...s)}function Ru(s){const e=s[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=s[1];t&&t.isStackTrace?s[0]+=" "+t.getLocation():s[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return s}function de(...s){s=Ru(s);const e="THREE."+s.shift();if(ai)ai("warn",e,...s);else{const t=s[0];t&&t.isStackTrace}}function Pe(...s){s=Ru(s);const e="THREE."+s.shift();if(ai)ai("error",e,...s);else{const t=s[0];t&&t.isStackTrace}}function ml(...s){const e=s.join(" ");e in Dc||(Dc[e]=!0,de(...s))}function lf(s,e,t){return new Promise(function(n,i){function r(){switch(s.clientWaitSync(e,s.SYNC_FLUSH_COMMANDS_BIT,0)){case s.WAIT_FAILED:i();break;case s.TIMEOUT_EXPIRED:setTimeout(r,t);break;default:n()}}setTimeout(r,t)})}const cf={[Po]:Lo,[Do]:Fo,[Uo]:Oo,[us]:No,[Lo]:Po,[Fo]:Do,[Oo]:Uo,[No]:us};class wn{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 r=i.indexOf(t);r!==-1&&i.splice(r,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 r=0,a=i.length;r<a;r++)i[r].call(this,e);e.target=null}}}const Dt=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let Uc=1234567;const wi=Math.PI/180,fs=180/Math.PI;function sn(){const s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Dt[s&255]+Dt[s>>8&255]+Dt[s>>16&255]+Dt[s>>24&255]+"-"+Dt[e&255]+Dt[e>>8&255]+"-"+Dt[e>>16&15|64]+Dt[e>>24&255]+"-"+Dt[t&63|128]+Dt[t>>8&255]+"-"+Dt[t>>16&255]+Dt[t>>24&255]+Dt[n&255]+Dt[n>>8&255]+Dt[n>>16&255]+Dt[n>>24&255]).toLowerCase()}function Oe(s,e,t){return Math.max(e,Math.min(t,s))}function Fl(s,e){return(s%e+e)%e}function hf(s,e,t,n,i){return n+(s-e)*(i-n)/(t-e)}
vendor: 4,265 bytes, line 5
5function uf(s,e,t){return s!==e?(t-s)/(e-s):0}function Gs(s,e,t){return(1-t)*s+t*e}function df(s,e,t,n){return Gs(s,e,1-Math.exp(-t*n))}function ff(s,e=1){return e-Math.abs(Fl(s,e*2)-e)}function pf(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*(3-2*s))}function mf(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*s*(s*(s*6-15)+10))}function gf(s,e){return s+Math.floor(Math.random()*(e-s+1))}function _f(s,e){return s+Math.random()*(e-s)}function xf(s){return s*(.5-Math.random())}function vf(s){s!==void 0&&(Uc=s);let e=Uc+=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 yf(s){return s*wi}function Mf(s){return s*fs}function Sf(s){return(s&s-1)===0&&s!==0}function bf(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function Tf(s){return Math.pow(2,Math.floor(Math.log(s)/Math.LN2))}function Af(s,e,t,n,i){const r=Math.cos,a=Math.sin,o=r(t/2),l=a(t/2),c=r((e+n)/2),h=a((e+n)/2),d=r((e-n)/2),u=a((e-n)/2),f=r((n-e)/2),p=a((n-e)/2);switch(i){case"XYX":s.set(o*h,l*d,l*u,o*c);break;case"YZY":s.set(l*u,o*h,l*d,o*c);break;case"ZXZ":s.set(l*d,l*u,o*h,o*c);break;case"XZX":s.set(o*h,l*p,l*f,o*c);break;case"YXY":s.set(l*f,o*h,l*p,o*c);break;case"ZYZ":s.set(l*p,l*f,o*h,o*c);break;default:de("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Vt(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return s/4294967295;case Uint16Array:return s/65535;case Uint8Array:return s/255;case Int32Array:return Math.max(s/2147483647,-1);case Int16Array:return Math.max(s/32767,-1);case Int8Array:return Math.max(s/127,-1);default:throw new Error("Invalid component type.")}}function $e(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return Math.round(s*4294967295);case Uint16Array:return Math.round(s*65535);case Uint8Array:return Math.round(s*255);case Int32Array:return Math.round(s*2147483647);case Int16Array:return Math.round(s*32767);case Int8Array:return Math.round(s*127);default:throw new Error("Invalid component type.")}}const Hy={DEG2RAD:wi,RAD2DEG:fs,generateUUID:sn,clamp:Oe,euclideanModulo:Fl,mapLinear:hf,inverseLerp:uf,lerp:Gs,damp:df,pingpong:ff,smoothstep:pf,smootherstep:mf,randInt:gf,randFloat:_f,randFloatSpread:xf,seededRandom:vf,degToRad:yf,radToDeg:Mf,isPowerOfTwo:Sf,ceilPowerOfTwo:bf,floorPowerOfTwo:Tf,setQuaternionFromProperEuler:Af,normalize:$e,denormalize:Vt},dc=class dc{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Oe(this.x,e.x,t.x),this.y=Oe(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Oe(this.x,e,t),this.y=Oe(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Oe(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}
vendor: 68,763 bytes, line 5
5round(){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(Oe(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),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*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}};dc.prototype.isVector2=!0;let K=dc;class Zt{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,r,a,o){let l=n[i+0],c=n[i+1],h=n[i+2],d=n[i+3],u=r[a+0],f=r[a+1],p=r[a+2],_=r[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,r,a){const o=n[i],l=n[i+1],c=n[i+2],h=n[i+3],d=r[a],u=r[a+1],f=r[a+2],p=r[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,r=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(n/2),h=o(i/2),d=o(r/2),u=l(n/2),f=l(i/2),p=l(r/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:de("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=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=(r-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=(r+c)/f}else if(o>d){const f=2*Math.sqrt(1+o-n-d);this._w=(r-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=(r+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(Oe(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,r=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-r*l,this._y=i*h+a*l+r*o-n*c,this._z=r*h+a*c+n*l-i*o,this._w=a*h-n*o-i*l-r*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,i=e._y,r=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,i=-i,r=-r,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+r*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+r*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),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*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}}const fc=class fc{constructor(e=0,t=0,n=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(Nc.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Nc.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*i-o*n),h=2*(o*t-r*i),d=2*(r*n-a*t);return this.x=t+l*c+a*d-o*h,this.y=n+l*h+o*c-r*d,this.z=i+l*d+r*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,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[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=Oe(this.x,e.x,t.x),this.y=Oe(this.y,e.y,t.y),this.z=Oe(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Oe(this.x,e,t),this.y=Oe(this.y,e,t),this.z=Oe(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Oe(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,r=e.z,a=t.x,o=t.y,l=t.z;return this.x=i*l-r*o,this.y=r*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 Oa.copy(this).projectOnVector(e),this.sub(Oa)}reflect(e){return this.sub(Oa.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(Oe(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}};fc.prototype.isVector3=!0;let C=fc;const Oa=new C,Nc=new Zt,pc=class pc{constructor(e,t,n,i,r,a,o,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,a,o,l,c)}set(e,t,n,i,r,a,o,l,c){const h=this.elements;return h[0]=e,h[1]=i,h[2]=o,h[3]=t,h[4]=r,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,r=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],w=i[2],b=i[5],R=i[8];return r[0]=a*_+o*x+l*w,r[3]=a*g+o*y+l*b,r[6]=a*m+o*M+l*R,r[1]=c*_+h*x+d*w,r[4]=c*g+h*y+d*b,r[7]=c*m+h*M+d*R,r[2]=u*_+f*x+p*w,r[5]=u*g+f*y+p*b,r[8]=u*m+f*M+p*R,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],r=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*r*h+n*o*l+i*r*c-i*a*l}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=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*r,f=c*r-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*r-o*t)*_,e[6]=f*_,e[7]=(n*l-c*t)*_,e[8]=(a*t-n*r)*_,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,r,a,o){const l=Math.cos(r),c=Math.sin(r);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(Ba.makeScale(e,t)),this}rotate(e){return this.premultiply(Ba.makeRotation(-e)),this}translate(e,t){return this.premultiply(Ba.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)}};pc.prototype.isMatrix3=!0;let qe=pc;const Ba=new qe,Fc=new qe().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Oc=new qe().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Ef(){const s={enabled:!0,workingColorSpace:ua,spaces:{},convert:function(i,r,a){return this.enabled===!1||r===a||!r||!a||(this.spaces[r].transfer===ct&&(i.r=kn(i.r),i.g=kn(i.g),i.b=kn(i.b)),this.spaces[r].primaries!==this.spaces[a].primaries&&(i.applyMatrix3(this.spaces[r].toXYZ),i.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===ct&&(i.r=cs(i.r),i.g=cs(i.g),i.b=cs(i.b))),i},workingToColorSpace:function(i,r){return this.convert(i,this.workingColorSpace,r)},colorSpaceToWorking:function(i,r){return this.convert(i,r,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===ni?da:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,r=this.workingColorSpace){return i.fromArray(this.spaces[r].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,r,a){return i.copy(this.spaces[r].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,r){return ml("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),s.workingToColorSpace(i,r)},toWorkingColorSpace:function(i,r){return ml("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),s.colorSpaceToWorking(i,r)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return s.define({[ua]:{primaries:e,whitePoint:n,transfer:da,toXYZ:Fc,fromXYZ:Oc,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:jt},outputColorSpaceConfig:{drawingBufferColorSpace:jt}},[jt]:{primaries:e,whitePoint:n,transfer:ct,toXYZ:Fc,fromXYZ:Oc,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:jt}}}),s}const tt=Ef();function kn(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function cs(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}let Bi;class wf{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{Bi===void 0&&(Bi=Ys("canvas")),Bi.width=e.width,Bi.height=e.height;const i=Bi.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=Bi}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=Ys("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),r=i.data;for(let a=0;a<r.length;a++)r[a]=kn(r[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(kn(t[n]/255)*255):t[n]=kn(t[n]);return{data:t,width:e.width,height:e.height}}else return de("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Cf=0;class Ai{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Cf++}),this.uuid=sn(),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.displayWidth,t.displayHeight,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 r;if(Array.isArray(i)){r=[];for(let a=0,o=i.length;a<o;a++)i[a].isDataTexture?r.push(za(i[a].image)):r.push(za(i[a]))}else r=za(i);n.url=r}return t||(e.images[this.uuid]=n),n}}function za(s){return typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&s instanceof ImageBitmap?wf.getDataURL(s):s.data?{data:Array.from(s.data),width:s.width,height:s.height,type:s.data.constructor.name}:(de("Texture: Unable to serialize Texture."),{})}let Rf=0;const Va=new C;class Mt extends wn{constructor(e=Mt.DEFAULT_IMAGE,t=Mt.DEFAULT_MAPPING,n=nn,i=nn,r=_t,a=Bn,o=qt,l=en,c=Mt.DEFAULT_ANISOTROPY,h=ni){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Rf++}),this.uuid=sn(),this.name="",this.source=new Ai(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,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 qe,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,this.normalized=!1}get width(){return this.source.getSize(Va).x}get height(){return this.source.getSize(Va).y}get depth(){return this.source.getSize(Va).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}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.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){de(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){de(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,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!==El)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 nn: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 nn: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++}}Mt.DEFAULT_IMAGE=null;Mt.DEFAULT_MAPPING=El;Mt.DEFAULT_ANISOTROPY=1;const mc=class mc{constructor(e=0,t=0,n=0,i=1){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,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,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,r;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,w=(m+1)/2,b=(h+u)/4,R=(d+_)/4,v=(p+g)/4;return y>M&&y>w?y<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(y),i=b/n,r=R/n):M>w?M<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(M),n=b/i,r=v/i):w<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(w),n=R/r,i=v/r),this.set(n,i,r,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=Oe(this.x,e.x,t.x),this.y=Oe(this.y,e.y,t.y),this.z=Oe(this.z,e.z,t.z),this.w=Oe(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Oe(this.x,e,t),this.y=Oe(this.y,e,t),this.z=Oe(this.z,e,t),this.w=Oe(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Oe(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}};mc.prototype.isVector4=!0;let dt=mc;class Iu extends wn{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:_t,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 dt(0,0,e,t),this.scissorTest=!1,this.viewport=new dt(0,0,e,t),this.textures=[];const i={width:e,height:t,depth:n.depth},r=new Mt(i),a=n.count;for(let o=0;o<a;o++)this.textures[o]=r.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:_t,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,r=this.textures.length;i<r;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 Ai(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.multiview=e.multiview,this}dispose(){this.dispatchEvent({type:"dispose"})}}class cn extends Iu{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Ol extends Mt{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=wt,this.minFilter=wt,this.wrapR=nn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Wy extends cn{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new Ol(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class Bl extends Mt{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=wt,this.minFilter=wt,this.wrapR=nn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Xy extends cn{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new Bl(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}const Sa=class Sa{constructor(e,t,n,i,r,a,o,l,c,h,d,u,f,p,_,g){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,r,a,o,l,c,h,d,u,f,p,_,g)}set(e,t,n,i,r,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]=r,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 Sa().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/zi.setFromMatrixColumn(e,0).length(),r=1/zi.setFromMatrixColumn(e,1).length(),a=1/zi.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]*r,t[5]=n[5]*r,t[6]=n[6]*r,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,r=e.z,a=Math.cos(n),o=Math.sin(n),l=Math.cos(i),c=Math.sin(i),h=Math.cos(r),d=Math.sin(r);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(If,e,Pf)}lookAt(e,t,n){const i=this.elements;return Kt.subVectors(e,t),Kt.lengthSq()===0&&(Kt.z=1),Kt.normalize(),Jn.crossVectors(n,Kt),Jn.lengthSq()===0&&(Math.abs(n.z)===1?Kt.x+=1e-4:Kt.z+=1e-4,Kt.normalize(),Jn.crossVectors(n,Kt)),Jn.normalize(),rr.crossVectors(Kt,Jn),i[0]=Jn.x,i[4]=rr.x,i[8]=Kt.x,i[1]=Jn.y,i[5]=rr.y,i[9]=Kt.y,i[2]=Jn.z,i[6]=rr.z,i[10]=Kt.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,r=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],w=n[15],b=i[0],R=i[4],v=i[8],A=i[12],P=i[1],I=i[5],N=i[9],H=i[13],W=i[2],U=i[6],B=i[10],k=i[14],te=i[3],ne=i[7],pe=i[11],Me=i[15];return r[0]=a*b+o*P+l*W+c*te,r[4]=a*R+o*I+l*U+c*ne,r[8]=a*v+o*N+l*B+c*pe,r[12]=a*A+o*H+l*k+c*Me,r[1]=h*b+d*P+u*W+f*te,r[5]=h*R+d*I+u*U+f*ne,r[9]=h*v+d*N+u*B+f*pe,r[13]=h*A+d*H+u*k+f*Me,r[2]=p*b+_*P+g*W+m*te,r[6]=p*R+_*I+g*U+m*ne,r[10]=p*v+_*N+g*B+m*pe,r[14]=p*A+_*H+g*k+m*Me,r[3]=x*b+y*P+M*W+w*te,r[7]=x*R+y*I+M*U+w*ne,r[11]=x*v+y*N+M*B+w*pe,r[15]=x*A+y*H+M*k+w*Me,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],r=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,w=a*f-c*h,b=a*u-l*h,R=a*d-o*h;return t*(_*x-g*y+m*M)-n*(p*x-g*w+m*b)+i*(p*y-_*w+m*R)-r*(p*M-_*b+g*R)}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],r=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-r*a,w=n*l-i*o,b=n*c-r*o,R=i*c-r*l,v=h*_-d*p,A=h*g-u*p,P=h*m-f*p,I=d*g-u*_,N=d*m-f*_,H=u*m-f*g,W=x*H-y*N+M*I+w*P-b*A+R*v;if(W===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const U=1/W;return e[0]=(o*H-l*N+c*I)*U,e[1]=(i*N-n*H-r*I)*U,e[2]=(_*R-g*b+m*w)*U,e[3]=(u*b-d*R-f*w)*U,e[4]=(l*P-a*H-c*A)*U,e[5]=(t*H-i*P+r*A)*U,e[6]=(g*M-p*R-m*y)*U,e[7]=(h*R-u*M+f*y)*U,e[8]=(a*N-o*P+c*v)*U,e[9]=(n*P-t*N-r*v)*U,e[10]=(p*b-_*M+m*x)*U,e[11]=(d*M-h*b-f*x)*U,e[12]=(o*A-a*I-l*v)*U,e[13]=(t*I-n*A+i*v)*U,e[14]=(_*y-p*w-g*x)*U,e[15]=(h*w-d*y+u*x)*U,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,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),r=1-n,a=e.x,o=e.y,l=e.z,c=r*a,h=r*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,r*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,r,a){return this.set(1,n,r,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,a=t._y,o=t._z,l=t._w,c=r+r,h=a+a,d=o+o,u=r*c,f=r*h,p=r*d,_=a*h,g=a*d,m=o*d,x=l*c,y=l*h,M=l*d,w=n.x,b=n.y,R=n.z;return i[0]=(1-(_+m))*w,i[1]=(f+M)*w,i[2]=(p-y)*w,i[3]=0,i[4]=(f-M)*b,i[5]=(1-(u+m))*b,i[6]=(g+x)*b,i[7]=0,i[8]=(p+y)*R,i[9]=(g-x)*R,i[10]=(1-(u+_))*R,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 r=this.determinant();if(r===0)return n.set(1,1,1),t.identity(),this;let a=zi.set(i[0],i[1],i[2]).length();const o=zi.set(i[4],i[5],i[6]).length(),l=zi.set(i[8],i[9],i[10]).length();r<0&&(a=-a),hn.copy(this);const c=1/a,h=1/o,d=1/l;return hn.elements[0]*=c,hn.elements[1]*=c,hn.elements[2]*=c,hn.elements[4]*=h,hn.elements[5]*=h,hn.elements[6]*=h,hn.elements[8]*=d,hn.elements[9]*=d,hn.elements[10]*=d,t.setFromRotationMatrix(hn),n.x=a,n.y=o,n.z=l,this}makePerspective(e,t,n,i,r,a,o=ln,l=!1){const c=this.elements,h=2*r/(t-e),d=2*r/(n-i),u=(t+e)/(t-e),f=(n+i)/(n-i);let p,_;if(l)p=r/(a-r),_=a*r/(a-r);else if(o===ln)p=-(a+r)/(a-r),_=-2*a*r/(a-r);else if(o===ds)p=-a/(a-r),_=-a*r/(a-r);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,r,a,o=ln,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-r),_=a/(a-r);else if(o===ln)p=-2/(a-r),_=-(a+r)/(a-r);else if(o===ds)p=-1/(a-r),_=-r/(a-r);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}};Sa.prototype.isMatrix4=!0;let Ge=Sa;const zi=new C,hn=new Ge,If=new C(0,0,0),Pf=new C(1,1,1),Jn=new C,rr=new C,Kt=new C,Bc=new Ge,zc=new Zt;class En{constructor(e=0,t=0,n=0,i=En.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,r=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(Oe(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,f),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(u,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Oe(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,r),this._z=0);break;case"ZXY":this._x=Math.asin(Oe(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,r));break;case"ZYX":this._y=Math.asin(-Oe(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(u,f),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(Oe(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-d,r)):(this._x=0,this._y=Math.atan2(o,f));break;case"XZY":this._z=Math.asin(-Oe(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(u,c),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-h,f),this._y=0);break;default:de("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Bc.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Bc,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return zc.setFromEuler(this),this.setFromQuaternion(zc,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}}En.DEFAULT_ORDER="XYZ";class zl{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 Lf=0;const Vc=new C,Vi=new Zt,In=new Ge,ar=new C,Ss=new C,Df=new C,Uf=new Zt,kc=new C(1,0,0),Gc=new C(0,1,0),Hc=new C(0,0,1),Wc={type:"added"},Nf={type:"removed"},ki={type:"childadded",child:null},ka={type:"childremoved",child:null};class ot extends wn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Lf++}),this.uuid=sn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ot.DEFAULT_UP.clone();const e=new C,t=new En,n=new Zt,i=new C(1,1,1);function r(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(r),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Ge},normalMatrix:{value:new qe}}),this.matrix=new Ge,this.matrixWorld=new Ge,this.matrixAutoUpdate=ot.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=ot.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new zl,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 Vi.setFromAxisAngle(e,t),this.quaternion.multiply(Vi),this}rotateOnWorldAxis(e,t){return Vi.setFromAxisAngle(e,t),this.quaternion.premultiply(Vi),this}rotateX(e){return this.rotateOnAxis(kc,e)}rotateY(e){return this.rotateOnAxis(Gc,e)}rotateZ(e){return this.rotateOnAxis(Hc,e)}translateOnAxis(e,t){return Vc.copy(e).applyQuaternion(this.quaternion),this.position.add(Vc.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(kc,e)}translateY(e){return this.translateOnAxis(Gc,e)}translateZ(e){return this.translateOnAxis(Hc,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(In.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?ar.copy(e):ar.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Ss.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?In.lookAt(Ss,ar,this.up):In.lookAt(ar,Ss,this.up),this.quaternion.setFromRotationMatrix(In),i&&(In.extractRotation(i.matrixWorld),Vi.setFromRotationMatrix(In),this.quaternion.premultiply(Vi.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Pe("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(Wc),ki.child=e,this.dispatchEvent(ki),ki.child=null):Pe("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(Nf),ka.child=e,this.dispatchEvent(ka),ka.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),In.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),In.multiply(e.parent.matrixWorld)),e.applyMatrix4(In),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Wc),ki.child=e,this.dispatchEvent(ki),ki.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 r=0,a=i.length;r<a;r++)i[r].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(Ss,e,Df),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ss,Uf,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,r=this.matrix.elements;r[12]+=t-r[0]*t-r[4]*n-r[8]*i,r[13]+=n-r[1]*t-r[5]*n-r[9]*i,r[14]+=i-r[2]*t-r[6]*n-r[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 r=0,a=i.length;r<a;r++)i[r].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 r(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=r(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];r(e.shapes,d)}else r(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(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(r(e.materials,this.material[l]));i.material=o}else i.material=r(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(r(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),this.pivot=e.pivot!==null?e.pivot.clone():null,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}}ot.DEFAULT_UP=new C(0,1,0);ot.DEFAULT_MATRIX_AUTO_UPDATE=!0;ot.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class Bs extends ot{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Ff={type:"move"};class Ga{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Bs,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 Bs,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 Bs,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.eventsEnabled=!1),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,r=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&&(r=t.getPose(e.gripSpace,n),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));o!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&r!==null&&(i=r),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(Ff)))}return o!==null&&(o.visible=i!==null),l!==null&&(l.visible=r!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Bs;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const Pu={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},$n={h:0,s:0,l:0},or={h:0,s:0,l:0};function Ha(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?s+(e-s)*6*t:t<1/2?e:t<2/3?s+(e-s)*6*(2/3-t):s}class be{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=jt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,tt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=tt.workingColorSpace){return this.r=e,this.g=t,this.b=n,tt.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=tt.workingColorSpace){if(e=Fl(e,1),t=Oe(t,0,1),n=Oe(n,0,1),t===0)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+t):n+t-n*t,a=2*n-r;this.r=Ha(a,r,e+1/3),this.g=Ha(a,r,e),this.b=Ha(a,r,e-1/3)}return tt.colorSpaceToWorking(this,i),this}setStyle(e,t=jt){function n(r){r!==void 0&&parseFloat(r)<1&&de("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:de("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=i[1],a=r.length;if(a===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(r,16),t);de("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=jt){const n=Pu[e.toLowerCase()];return n!==void 0?this.setHex(n,t):de("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=kn(e.r),this.g=kn(e.g),this.b=kn(e.b),this}copyLinearToSRGB(e){return this.r=cs(e.r),this.g=cs(e.g),this.b=cs(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=jt){return tt.workingToColorSpace(Ut.copy(this),e),Math.round(Oe(Ut.r*255,0,255))*65536+Math.round(Oe(Ut.g*255,0,255))*256+Math.round(Oe(Ut.b*255,0,255))}getHexString(e=jt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=tt.workingColorSpace){tt.workingToColorSpace(Ut.copy(this),t);const n=Ut.r,i=Ut.g,r=Ut.b,a=Math.max(n,i,r),o=Math.min(n,i,r);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-r)/d+(i<r?6:0);break;case i:l=(r-n)/d+2;break;case r:l=(n-i)/d+4;break}l/=6}return e.h=l,e.s=c,e.l=h,e}getRGB(e,t=tt.workingColorSpace){return tt.workingToColorSpace(Ut.copy(this),t),e.r=Ut.r,e.g=Ut.g,e.b=Ut.b,e}getStyle(e=jt){tt.workingToColorSpace(Ut.copy(this),e);const t=Ut.r,n=Ut.g,i=Ut.b;return e!==jt?`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($n),this.setHSL($n.h+e,$n.s+t,$n.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}
vendor: 7,895 bytes, line 5
5lerpColors(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($n),e.getHSL(or);const n=Gs($n.h,or.h,t),i=Gs($n.s,or.s,t),r=Gs($n.l,or.l,t);return this.setHSL(n,i,r),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,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[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 Ut=new be;be.NAMES=Pu;class Vl{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new be(e),this.density=t}clone(){return new Vl(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class kl{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new be(e),this.near=t,this.far=n}clone(){return new kl(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Of extends ot{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 En,this.environmentIntensity=1,this.environmentRotation=new En,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 un=new C,Pn=new C,Wa=new C,Ln=new C,Gi=new C,Hi=new C,Xc=new C,Xa=new C,qa=new C,Ya=new C,Za=new dt,Ja=new dt,$a=new dt;class tn{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),un.subVectors(e,t),i.cross(un);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){un.subVectors(i,t),Pn.subVectors(n,t),Wa.subVectors(e,t);const a=un.dot(un),o=un.dot(Pn),l=un.dot(Wa),c=Pn.dot(Pn),h=Pn.dot(Wa),d=a*c-o*o;if(d===0)return r.set(0,0,0),null;const u=1/d,f=(c*l-o*h)*u,p=(a*h-o*l)*u;return r.set(1-f-p,p,f)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Ln)===null?!1:Ln.x>=0&&Ln.y>=0&&Ln.x+Ln.y<=1}static getInterpolation(e,t,n,i,r,a,o,l){return this.getBarycoord(e,t,n,i,Ln)===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(r,Ln.x),l.addScaledVector(a,Ln.y),l.addScaledVector(o,Ln.z),l)}static getInterpolatedAttribute(e,t,n,i,r,a){return Za.setScalar(0),Ja.setScalar(0),$a.setScalar(0),Za.fromBufferAttribute(e,t),Ja.fromBufferAttribute(e,n),$a.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(Za,r.x),a.addScaledVector(Ja,r.y),a.addScaledVector($a,r.z),a}static isFrontFacing(e,t,n,i){return un.subVectors(n,t),Pn.subVectors(e,t),un.cross(Pn).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 un.subVectors(this.c,this.b),Pn.subVectors(this.a,this.b),un.cross(Pn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return tn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return tn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return tn.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return tn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return tn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let a,o;Gi.subVectors(i,n),Hi.subVectors(r,n),Xa.subVectors(e,n);const l=Gi.dot(Xa),c=Hi.dot(Xa);if(l<=0&&c<=0)return t.copy(n);qa.subVectors(e,i);const h=Gi.dot(qa),d=Hi.dot(qa);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(Gi,a);Ya.subVectors(e,r);const f=Gi.dot(Ya),p=Hi.dot(Ya);if(p>=0&&f<=p)return t.copy(r);const _=f*c-l*p;if(_<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(Hi,o);const g=h*p-f*d;if(g<=0&&d-h>=0&&f-p>=0)return Xc.subVectors(r,i),o=(d-h)/(d-h+(f-p)),t.copy(i).addScaledVector(Xc,o);const m=1/(g+_+u);return a=_*m,o=u*m,t.copy(n).addScaledVector(Gi,a).addScaledVector(Hi,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class kt{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(dn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(dn.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=dn.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 r=n.getAttribute("position");if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=r.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,dn):dn.fromBufferAttribute(r,a),dn.applyMatrix4(e.matrixWorld),this.expandByPoint(dn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),lr.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),lr.copy(n.boundingBox)),lr.applyM
vendor: 5,617 bytes, line 5
5atrix4(e.matrixWorld),this.union(lr)}const i=e.children;for(let r=0,a=i.length;r<a;r++)this.expandByObject(i[r],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,dn),dn.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(bs),cr.subVectors(this.max,bs),Wi.subVectors(e.a,bs),Xi.subVectors(e.b,bs),qi.subVectors(e.c,bs),Kn.subVectors(Xi,Wi),Qn.subVectors(qi,Xi),ci.subVectors(Wi,qi);let t=[0,-Kn.z,Kn.y,0,-Qn.z,Qn.y,0,-ci.z,ci.y,Kn.z,0,-Kn.x,Qn.z,0,-Qn.x,ci.z,0,-ci.x,-Kn.y,Kn.x,0,-Qn.y,Qn.x,0,-ci.y,ci.x,0];return!Ka(t,Wi,Xi,qi,cr)||(t=[1,0,0,0,1,0,0,0,1],!Ka(t,Wi,Xi,qi,cr))?!1:(hr.crossVectors(Kn,Qn),t=[hr.x,hr.y,hr.z],Ka(t,Wi,Xi,qi,cr))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,dn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(dn).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:(Dn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Dn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Dn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Dn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Dn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Dn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Dn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Dn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Dn),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 Dn=[new C,new C,new C,new C,new C,new C,new C,new C],dn=new C,lr=new kt,Wi=new C,Xi=new C,qi=new C,Kn=new C,Qn=new C,ci=new C,bs=new C,cr=new C,hr=new C,hi=new C;function Ka(s,e,t,n,i){for(let r=0,a=s.length-3;r<=a;r+=3){hi.fromArray(s,r);const o=i.x*Math.abs(hi.x)+i.y*Math.abs(hi.y)+i.z*Math.abs(hi.z),l=e.dot(hi),c=t.dot(hi),h=n.dot(hi);if(Math.max(-Math.max(l,c,h),Math.min(l,c,h))>o)return!1}return!0}const On=Bf();function Bf(){const s=new ArrayBuffer(4),e=new Float32Array(s),t=new Uint32Array(s),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 r=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);)c<<=1,h-=8388608;c&=-8388609,h+=947912704,r[l]=c|h}for(let l=1024;l<2048;++l)r[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:r,exponentTable:a,offsetTable:o}}function Wt(s){Math.abs(s)>65504&&de("DataUtils.toHalfFloat(): Value out of range."),s=Oe(s,-65504,65504),On.floatView[0]=s;const e=On.uint32View[0],t=e>>23&511;return On.baseTable[t]+((e&8388607)>>On.shiftTable[t])}function zs(s){const e=s>>10;return On.uint32View[0]=On.mantissaTable[On.offsetTable[e]+(s&1023)]+On.exponentTable[e],On.floatView[0]}class qy{static toHalfFloat(e){return Wt(e)}static fromHalfFloat(e){return zs(e)}}const Et=new C,ur=new K;let zf=0;class mt extends wn{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:zf++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=fa,this.updateRanges=[],this.gpuType=Xt,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,948 bytes, line 5
5for(let i=0,r=this.itemSize;i<r;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++)ur.fromBufferAttribute(this,t),ur.applyMatrix3(e),this.setXY(t,ur.x,ur.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Et.fromBufferAttribute(this,t),Et.applyMatrix3(e),this.setXYZ(t,Et.x,Et.y,Et.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Et.fromBufferAttribute(this,t),Et.applyMatrix4(e),this.setXYZ(t,Et.x,Et.y,Et.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Et.fromBufferAttribute(this,t),Et.applyNormalMatrix(e),this.setXYZ(t,Et.x,Et.y,Et.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Et.fromBufferAttribute(this,t),Et.transformDirection(e),this.setXYZ(t,Et.x,Et.y,Et.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=Vt(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=$e(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Vt(t,this.array)),t}setX(e,t){return this.normalized&&(t=$e(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Vt(t,this.array)),t}setY(e,t){return this.normalized&&(t=$e(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=Vt(t,this.array)),t}setZ(e,t){return this.normalized&&(t=$e(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=Vt(t,this.array)),t}setW(e,t){return this.normalized&&(t=$e(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=$e(t,this.array),n=$e(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=$e(t,this.array),n=$e(n,this.array),i=$e(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=$e(t,this.array),n=$e(n,this.array),i=$e(i,this.array),r=$e(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,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!==fa&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class Yy extends mt{constructor(e,t,n){super(new Int8Array(e),t,n)}}class Zy extends mt{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class Jy extends mt{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class $y extends mt{constructor(e,t,n){super(new Int16Array(e),t,n)}}class Lu extends mt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Ky extends mt{constructor(e,t,n){super(new Int32Array(e),t,n)}}class Du extends mt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Qy extends mt{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=zs(this.array[e*this.itemSize]);return this.normalized&&(t=Vt(t,this.array)),t}setX(e,t){return this.normalized&&(t=$e(t,this.array)),this.array[e*this.itemSize]=Wt(t),this}getY(e){let t=zs(this.array[e*this.itemSize+1]);return this.normalized&&(t=Vt(t,this.array)),t}setY(e,t){return this.normalized&&(t=$e(t,this.array)),this.array[e*this.itemSize+1]=Wt(t),this}getZ(e){let t=zs(this.array[e*this.itemSize+2]);return this.normalized&&(t=Vt(t,this.array)),t}setZ(e,t){return this.normalized&&(t=$e(t,this.array)),this.array[e*this.itemSize+2]=Wt(t),this}getW(e){let t=zs(this.array[e*this.itemSize+3]);return this.normalized&&(t=Vt(t,this.array)),t}setW(e,t){return this.normalized&&(t=$e(t,this.array)),this.array[e*this.itemSize+3]=Wt(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=$e(t,this.array),n=$e(n,this.array)),this.array[e+0]=Wt(t),this.array[e+1]=Wt(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=$e(t,this.array),n=$e(n,this.array),i=$e(i,this.array)),this.array[e+0]=Wt(t),this.array[e+1]=Wt(n),this.array[e+2]=Wt(i),this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=$e(t,this.array),n=$e(n,this.array),i=$e(i,this.array),r=$e(r,this.array)),this.array[e+0]=Wt(t),this.array[e+1]=Wt(n),this.array[e+2]=Wt(i),this.array[e+3]=Wt(r),this}}class we extends mt{constructor(e,t,n){super(new Float32Array(e),t,n)}}const Vf=new kt,Ts=new C,Qa=new C;class Ot{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):Vf.setFromPoints(e).getCenter(n);let i=0;for(let r=0,a=e.length;r<a;r++)i=Math.max(i,n.distanceToSquared(e[r]));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 5
5applyMatrix4(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;Ts.subVectors(e,this.center);const t=Ts.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Ts,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):(Qa.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ts.copy(e.center).add(Qa)),this.expandByPoint(Ts.copy(e.center).sub(Qa))),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 kf=0;const on=new Ge,ja=new ot,Yi=new C,Qt=new kt,As=new kt,Pt=new C;class Ye extends wn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:kf++}),this.uuid=sn(),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(rf(e)?Du:Lu)(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 r=new qe().getNormalMatrix(e);n.applyNormalMatrix(r),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 on.makeRotationFromQuaternion(e),this.applyMatrix4(on),this}rotateX(e){return on.makeRotationX(e),this.applyMatrix4(on),this}rotateY(e){return on.makeRotationY(e),this.applyMatrix4(on),this}rotateZ(e){return on.makeRotationZ(e),this.applyMatrix4(on),this}translate(e,t,n){return on.makeTranslation(e,t,n),this.applyMatrix4(on),this}scale(e,t,n){return on.makeScale(e,t,n),this.applyMatrix4(on),this}lookAt(e){return ja.lookAt(e),ja.updateMatrix(),this.applyMatrix4(ja.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Yi).negate(),this.translate(Yi.x,Yi.y,Yi.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,r=e.length;i<r;i++){const a=e[i];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new we(n,3))}else{const n=Math.min(e.length,t.count);for(let i=0;i<n;i++){const r=e[i];t.setXYZ(i,r.x,r.y,r.z||0)}e.length>t.count&&de("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new kt);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Pe("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 r=t[n];Qt.setFromBufferAttribute(r),this.morphTargetsRelative?(Pt.addVectors(this.boundingBox.min,Qt.min),this.boundingBox.expandByPoint(Pt),Pt.addVectors(this.boundingBox.max,Qt.max),this.boundingBox.expandByPoint(Pt)):(this.boundingBox.expandByPoint(Qt.min),this.boundingBox.expandByPoint(Qt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Pe('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 Ot);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Pe("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(Qt.setFromBufferAttribute(e),t)for(let r=0,a=t.length;r<a;r++){const o=t[r];As.setFromBufferAttribute(o),this.morphTargetsRelative?(Pt.addVectors(Qt.min,As.min),Qt.expandByPoint(Pt),Pt.addVectors(Qt.max,As.max),Qt.expandByPoint(Pt)):(Qt.expandByPoint(As.min),Qt.expandByPoint(As.max))}Qt.getCenter(n);let i=0;for(let r=0,a=e.count;r<a;r++)Pt.fromBufferAttribute(e,r),i=Math.max(i,n.distanceToSquared(Pt));if(t)for(let r=0,a=t.length;r<a;r++){const o=t[r],l=this.morphTargetsRelative;for(let c=0,h=o.count;c<h;c++)Pt.fromBufferAttribute(o,c),l&&(Yi.fromBufferAttribute(e,c),Pt.add(Yi)),i=Math.max(i,n.distanceToSquared(Pt))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&Pe('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){Pe("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,i=t.normal,r=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new mt(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,A,P){c.fromBufferAttribute(n,v),h.fromBufferAttribute(n,A),d.fromBufferAttribute(n,P),u.fromBufferAttribute(r,v),f.fromBufferAttribute(r,A),p.fromBufferAttribute(r,P),h.sub(c),d.sub(c),f.sub(u),p.sub(u);const I=1/(f.x*p.y-p.x*f.y);isFinite(I)&&(_.copy(h).multiplyScalar(p.y).addScaledVector(d,-f.y).multiplyScalar(I),g.copy(d).multiplyScalar(f.x).addScaledVector(h,-p.x).multiplyScalar(I),o[v].add(_),o[A].add(_),o[P].add(_),l[v].add(g),l[A].add(g),l[P].add(g))}let x=this.groups;x.length===0&&(x=[{start:0,count:e.count}]);for(let v=0,A=x.length;v<A;++v){const P=x[v],I=P.start,N=P.count;for(let H=I,W=I+N;H<W;H+=3)m(e.getX(H+0),e.getX(H+1),e.getX(H+2))}const y=new C,M=new C,w=new C,b=new C;function R(v){w.fromBufferAttribute(i,v),b.copy(w);const A=o[v];y.copy(A),y.sub(w.multiplyScalar(w.dot(A))).normalize(),M.crossVectors(b,A);const I=M.dot(l[v])<0?-1:1;a.setXYZW(v,y.x,y.y,y.z,I)}for(let v=0,A=x.length;v<A;++v){const P=x[v],I=P.start,N=P.count;for(let H=I,W=I+N;H<W;H+=3)R(e.getX(H+0)),R(e.getX(H+1)),R(e.getX(H+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 mt(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,r=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),r.fromBufferAttribute(t,_),a.fromBufferAttribute(t,g),h.subVectors(a,r),d.subVectors(i,r),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),r.fromBufferAttribute(t,u+1),a.fromBufferAttribute(t,u+2),h.subVectors(a,r),d.subVectors(i,r),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++)Pt.fromBufferAttribute(e,t),Pt.normalize(),e.setXYZ(t,Pt.x,Pt.y,Pt.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 mt(u,h,d)}if(this.index===null)return de("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Ye,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 r=this.morphAttributes;for(const o in r){const l=[],c=r[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 r=!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,r=!0)}r&&(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 r=e.morphAttributes;for(const c in r){const h=[],d=r[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 Gl{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=fa,this.updateRanges=[],this.version=0,this.uuid=sn()}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,r=this.stride;i<r;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=sn()),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=sn()),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 Bt=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++)Bt.fromBufferAttribute(this,t),Bt.applyMatrix4(e),this.setXYZ(t,Bt.x,Bt.y,Bt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Bt.fromBufferAttribute(this,t),Bt.applyNormalMatrix(e),this.setXYZ(t,Bt.x,Bt.y,Bt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Bt.fromBufferAttribute(this,t),Bt.transformDirection(e),this.setXYZ(t,Bt.x,Bt.y,Bt.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Vt(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=$e(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=$e(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=$e(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=$e(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=$e(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=Vt(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Vt(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Vt(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Vt(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=$e(t,this.array),n=$e(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=$e(t,this.array),n=$e(n,this.array),i=$e(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,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=$e(t,this.array),n=$e(n,this.array),i=$e(i,this.array),r=$e(r,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]=r,this}clone(e){if(e===void 0){pa("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 r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}return new mt(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){pa("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 r=0;r<this.itemSize;r++)t.push(this.data.array[i+r])}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 Gf=0;class Gt extends wn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Gf++}),this.uuid=sn(),this.name="",this.type="Material",this.blending=ls,this.side=si,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Ro,this.blendDst=Io,this.blendEquation=Si,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new be(0,0,0),this.blendAlpha=0,this.depthFunc=us,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Pc,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Oi,this.stencilZFail=Oi,this.stencilZPass=Oi,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){de(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){de(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};
vendor: 21,823 bytes, line 5
5n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==ls&&(n.blending=this.blending),this.side!==si&&(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!==Ro&&(n.blendSrc=this.blendSrc),this.blendDst!==Io&&(n.blendDst=this.blendDst),this.blendEquation!==Si&&(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!==us&&(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!==Pc&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Oi&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Oi&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Oi&&(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(r){const a=[];for(const o in r){const l=r[o];delete l.metadata,a.push(l)}return a}if(t){const r=i(e.textures),a=i(e.images);r.length>0&&(n.textures=r),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 r=0;r!==i;++r)n[r]=t[r].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 Uu extends Gt{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new be(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 Zi;const Es=new C,Ji=new C,$i=new C,Ki=new K,ws=new K,Nu=new Ge,dr=new C,Cs=new C,fr=new C,qc=new K,eo=new K,Yc=new K;class Hf extends ot{constructor(e=new Uu){if(super(),this.isSprite=!0,this.type="Sprite",Zi===void 0){Zi=new Ye;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 Gl(t,5);Zi.setIndex([0,1,2,0,2,3]),Zi.setAttribute("position",new ps(n,3,0,!1)),Zi.setAttribute("uv",new ps(n,2,3,!1))}this.geometry=Zi,this.material=e,this.center=new K(.5,.5),this.count=1}raycast(e,t){e.camera===null&&Pe('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Ji.setFromMatrixScale(this.matrixWorld),Nu.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),$i.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Ji.multiplyScalar(-$i.z);const n=this.material.rotation;let i,r;n!==0&&(r=Math.cos(n),i=Math.sin(n));const a=this.center;pr(dr.set(-.5,-.5,0),$i,a,Ji,i,r),pr(Cs.set(.5,-.5,0),$i,a,Ji,i,r),pr(fr.set(.5,.5,0),$i,a,Ji,i,r),qc.set(0,0),eo.set(1,0),Yc.set(1,1);let o=e.ray.intersectTriangle(dr,Cs,fr,!1,Es);if(o===null&&(pr(Cs.set(-.5,.5,0),$i,a,Ji,i,r),eo.set(0,1),o=e.ray.intersectTriangle(dr,fr,Cs,!1,Es),o===null))return;const l=e.ray.origin.distanceTo(Es);l<e.near||l>e.far||t.push({distance:l,point:Es.clone(),uv:tn.getInterpolation(Es,dr,Cs,fr,qc,eo,Yc,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 pr(s,e,t,n,i,r){Ki.subVectors(s,t).addScalar(.5).multiply(n),i!==void 0?(ws.x=r*Ki.x-i*Ki.y,ws.y=i*Ki.x+r*Ki.y):ws.copy(Ki),s.copy(e),s.x+=ws.x,s.y+=ws.y,s.applyMatrix4(Nu)}const mr=new C,Zc=new C;class Wf extends ot{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 r=t[n];this.addLevel(r.object.clone(),r.distance,r.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let r;for(r=0;r<i.length&&!(t<i[r].distance);r++);return i.splice(r,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 r=t[n].distance;if(t[n].object.visible&&(r-=r*t[n].hysteresis),e<r)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){mr.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(mr);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){mr.setFromMatrixPosition(e.matrixWorld),Zc.setFromMatrixPosition(this.matrixWorld);const n=mr.distanceTo(Zc)/e.zoom;t[0].object.visible=!0;let i,r;for(i=1,r=t.length;i<r;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<r;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,r=n.length;i<r;i++){const a=n[i];t.object.levels.push({object:a.object.uuid,distance:a.distance,hysteresis:a.hysteresis})}return t}}const Un=new C,to=new C,gr=new C,jn=new C,no=new C,_r=new C,io=new C;class js{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,Un)),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=Un.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Un.copy(this.origin).addScaledVector(this.direction,t),Un.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){to.copy(e).add(t).multiplyScalar(.5),gr.copy(t).sub(e).normalize(),jn.copy(this.origin).sub(to);const r=e.distanceTo(t)*.5,a=-this.direction.dot(gr),o=jn.dot(this.direction),l=-jn.dot(gr),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=r*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=r,d=Math.max(0,-(a*u+o)),f=-d*d+u*(u+2*l)+c;else u=-r,d=Math.max(0,-(a*u+o)),f=-d*d+u*(u+2*l)+c;else u<=-p?(d=Math.max(0,-(-a*r+o)),u=d>0?-r:Math.min(Math.max(-r,-l),r),f=-d*d+u*(u+2*l)+c):u<=p?(d=0,u=Math.min(Math.max(-r,-l),r),f=u*(u+2*l)+c):(d=Math.max(0,-(a*r+o)),u=d>0?r:Math.min(Math.max(-r,-l),r),f=-d*d+u*(u+2*l)+c);else u=a>0?-r:r,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(to).addScaledVector(gr,u),f}intersectSphere(e,t){Un.subVectors(e.center,this.origin);const n=Un.dot(this.direction),i=Un.dot(Un)-n*n,r=e.radius*e.radius;if(i>r)return null;const a=Math.sqrt(r-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,r,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?(r=(e.min.y-u.y)*h,a=(e.max.y-u.y)*h):(r=(e.max.y-u.y)*h,a=(e.min.y-u.y)*h),n>a||r>i||((r>n||isNaN(n))&&(n=r),(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,Un)!==null}intersectTriangle(e,t,n,i,r){no.subVectors(t,e),_r.subVectors(n,e),io.crossVectors(no,_r);let a=this.direction.dot(io),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(_r.crossVectors(jn,_r));if(l<0)return null;const c=o*this.direction.dot(no.cross(jn));if(c<0||l+c>a)return null;const h=-o*jn.dot(io);return h<0?null:this.at(h/a,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Li extends Gt{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new be(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 En,this.combine=ba,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Jc=new Ge,ui=new js,xr=new Ot,$c=new C,vr=new C,yr=new C,Mr=new C,so=new C,Sr=new C,Kc=new C,br=new C;class Ct extends ot{constructor(e=new Ye,t=new Li){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 r=0,a=i.length;r<a;r++){const o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(r&&o){Sr.set(0,0,0);for(let l=0,c=r.length;l<c;l++){const h=o[l],d=r[l];h!==0&&(so.fromBufferAttribute(d,e),a?Sr.addScaledVector(so,h):Sr.addScaledVector(so.sub(t),h))}t.add(Sr)}return t}raycast(e,t){const n=this.geometry,i=this.material,r=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),xr.copy(n.boundingSphere),xr.applyMatrix4(r),ui.copy(e.ray).recast(e.near),!(xr.containsPoint(ui.origin)===!1&&(ui.intersectSphere(xr,$c)===null||ui.origin.distanceToSquared($c)>(e.far-e.near)**2))&&(Jc.copy(r).invert(),ui.copy(e.ray).applyMatrix4(Jc),!(n.boundingBox!==null&&ui.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,ui)))}_computeIntersections(e,t,n){let i;const r=this.geometry,a=this.material,o=r.index,l=r.attributes.position,c=r.attributes.uv,h=r.attributes.uv1,d=r.attributes.normal,u=r.groups,f=r.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,w=y;M<w;M+=3){const b=o.getX(M),R=o.getX(M+1),v=o.getX(M+2);i=Tr(this,m,e,n,c,h,d,b,R,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=Tr(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,w=y;M<w;M+=3){const b=M,R=M+1,v=M+2;i=Tr(this,m,e,n,c,h,d,b,R,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=Tr(this,a,e,n,c,h,d,x,y,M),i&&(i.faceIndex=Math.floor(g/3),t.push(i))}}}}function Xf(s,e,t,n,i,r,a,o){let l;if(e.side===Yt?l=n.intersectTriangle(a,r,i,!0,o):l=n.intersectTriangle(i,r,a,e.side===si,o),l===null)return null;
vendor: 9,815 bytes, line 5
5br.copy(o),br.applyMatrix4(s.matrixWorld);const c=t.ray.origin.distanceTo(br);return c<t.near||c>t.far?null:{distance:c,point:br.clone(),object:s}}function Tr(s,e,t,n,i,r,a,o,l,c){s.getVertexPosition(o,vr),s.getVertexPosition(l,yr),s.getVertexPosition(c,Mr);const h=Xf(s,e,t,n,vr,yr,Mr,Kc);if(h){const d=new C;tn.getBarycoord(Kc,vr,yr,Mr,d),i&&(h.uv=tn.getInterpolatedAttribute(i,o,l,c,d,new K)),r&&(h.uv1=tn.getInterpolatedAttribute(r,o,l,c,d,new K)),a&&(h.normal=tn.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};tn.getNormal(vr,yr,Mr,u.normal),h.face=u,h.barycoord=d}return h}const Rs=new dt,Qc=new dt,jc=new dt,qf=new dt,eh=new Ge,Ar=new C,ro=new Ot,th=new Ge,ao=new js;class Yf extends Ct{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Rc,this.bindMatrix=new Ge,this.bindMatrixInverse=new Ge,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new kt),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Ar),this.boundingBox.expandByPoint(Ar)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Ot),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Ar),this.boundingSphere.expandByPoint(Ar)}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(),ro.copy(this.boundingSphere),ro.applyMatrix4(i),e.ray.intersectsSphere(ro)!==!1&&(th.copy(i).invert(),ao.copy(e.ray).applyMatrix4(th),!(this.boundingBox!==null&&ao.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,ao)))}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 dt,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Rc?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===qd?this.bindMatrixInverse.copy(this.bindMatrix).invert():de("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;Qc.fromBufferAttribute(i.attributes.skinIndex,e),jc.fromBufferAttribute(i.attributes.skinWeight,e),t.isVector4?(Rs.copy(t),t.set(0,0,0,0)):(Rs.set(...t,1),t.set(0,0,0)),Rs.applyMatrix4(this.bindMatrix);for(let r=0;r<4;r++){const a=jc.getComponent(r);if(a!==0){const o=Qc.getComponent(r);eh.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(qf.copy(Rs).applyMatrix4(eh),a)}}return t.isVector4&&(t.w=Rs.w),t.applyMatrix4(this.bindMatrixInverse)}}class Fu extends ot{constructor(){super(),this.isBone=!0,this.type="Bone"}}class An extends Mt{constructor(e=null,t=1,n=1,i,r,a,o,l,c=wt,h=wt,d,u){super(null,a,o,l,c,h,i,r,d,u),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const nh=new Ge,Zf=new Ge;class Hl{constructor(e=[],t=[]){this.uuid=sn(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){de("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Ge)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new Ge;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let r=0,a=e.length;r<a;r++){const o=e[r]?e[r].matrixWorld:Zf;nh.multiplyMatrices(o,t[r]),nh.toArray(n,r*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Hl(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 An(t,e,e,qt,Xt);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 r=e.bones[n];let a=t[r];a===void 0&&(de("Skeleton: No bone found with UUID:",r),a=new Fu),this.bones.push(a),this.boneInverses.push(new Ge().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){const a=t[i];e.bones.push(a.uuid);const o=n[i];e.boneInverses.push(o.toArray())}return e}}class Zs extends mt{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 Qi=new Ge,ih=new Ge,Er=[],sh=new kt,Jf=new Ge,Is=new Ct,Ps=new Ot;class $f extends Ct{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Zs(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,Jf)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new kt),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Qi),sh.copy(e.boundingBox).applyMatrix4(Qi),this.boundingBox.union(sh)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Ot),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Qi),Ps.copy(e.boundingSphere).applyMatrix4(Qi),this.boundingSphere.union(Ps)}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){return this.instanceColor===null?t.setRGB(1,1,1):t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=n.length+1,a=e*r+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(Is.geometry=this.geometry,Is.material=this.material,Is.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Ps.copy(this.boundingSphere),Ps.applyMatrix4(n),e.ray.intersectsSphere(Ps)!==!1))for(let r=0;r<i;r++){this.getMatrixAt(r,Qi),ih.multiplyMatrices(n,Qi),Is.matrixWorld=ih,Is.raycast(e,Er);for(let a=0,o=Er.length;a<o;a++){const l=Er[a];l.instanceId=r,l.object=this,t.push(l)}Er.length=0}}setColorAt(e,t){return this.instanceColor===null&&(this.instanceColor=new Zs(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,e*16),this}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new An(new Float32Array(i*this.count),i,this.count,Il,Xt));const r=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;return r[l]=o,r.set(n,l+1),this}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const oo=new C,Kf=new C,Qf=new qe;class Mi{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}
vendor: 7,620 bytes, line 5
5setFromCoplanarPoints(e,t,n){const i=oo.subVectors(n,t).cross(Kf.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,n=!0){const i=e.delta(oo),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const a=-(e.start.dot(this.normal)+this.constant)/r;return n===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(i,a)}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||Qf.getNormalMatrix(e),i=this.coplanarPoint(oo).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const di=new Ot,jf=new K(.5,.5),wr=new C;class er{constructor(e=new Mi,t=new Mi,n=new Mi,i=new Mi,r=new Mi,a=new Mi){this.planes=[e,t,n,i,r,a]}set(e,t,n,i,r,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(r),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=ln,n=!1){const i=this.planes,r=e.elements,a=r[0],o=r[1],l=r[2],c=r[3],h=r[4],d=r[5],u=r[6],f=r[7],p=r[8],_=r[9],g=r[10],m=r[11],x=r[12],y=r[13],M=r[14],w=r[15];if(i[0].setComponents(c-a,f-h,m-p,w-x).normalize(),i[1].setComponents(c+a,f+h,m+p,w+x).normalize(),i[2].setComponents(c+o,f+d,m+_,w+y).normalize(),i[3].setComponents(c-o,f-d,m-_,w-y).normalize(),n)i[4].setComponents(l,u,g,M).normalize(),i[5].setComponents(c-l,f-u,m-g,w-M).normalize();else if(i[4].setComponents(c-l,f-u,m-g,w-M).normalize(),t===ln)i[5].setComponents(c+l,f+u,m+g,w+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(),di.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),di.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(di)}intersectsSprite(e){di.center.set(0,0,0);const t=jf.distanceTo(e.center);return di.radius=.7071067811865476+t,di.applyMatrix4(e.matrixWorld),this.intersectsSphere(di)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let r=0;r<6;r++)if(t[r].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(wr.x=i.normal.x>0?e.max.x:e.min.x,wr.y=i.normal.y>0?e.max.y:e.min.y,wr.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(wr)<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 xn=new Ge,vn=new er;class Wl{constructor(){this.coordinateSystem=ln}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(xn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),vn.setFromProjectionMatrix(xn,i.coordinateSystem,i.reversedDepth),vn.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(xn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),vn.setFromProjectionMatrix(xn,i.coordinateSystem,i.reversedDepth),vn.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(xn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),vn.setFromProjectionMatrix(xn,i.coordinateSystem,i.reversedDepth),vn.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(xn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),vn.setFromProjectionMatrix(xn,i.coordinateSystem,i.reversedDepth),vn.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(xn.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),vn.setFromProjectionMatrix(xn,i.coordinateSystem,i.reversedDepth),vn.containsPoint(e))return!0}return!1}clone(){return new Wl}}function lo(s,e){return s-e}function ep(s,e){return s.z-e.z}function tp(s,e){return e.z-s.z}class np{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,i){const r=this.pool,a=this.list;this.index>=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});const o=r[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 Ht=new Ge,ip=new be(1,1,1),rh=new er,sp=new Wl,Cr=new kt,fi=new Ot,Ls=new C,ah=new C,rp=new C,co=new np,Nt=new Ct,Rr=[];function ap(s,e,t=0){const n=e.itemSize;if(s.isInterleavedBufferAttribute||s.array.constructor!==e.array.constructor){const i=s.count;for(let r=0;r<i;r++)for(let a=0;a<n;a++)e.setComponent(r+t,a,s.getComponent(r,a))}else e.array.set(s.array,t*n);e.needsUpdate=!0}function pi(s,e){if(s.constructor!==e.constructor){const t=Math.min(s.length,e.length);for(let n=0;n<t;n++)e[n]=s[n]}else{const t=Math.min(s.length,e.length);e.set(new s.constructor(s.buffer,0,t))}}class op extends Ct{constructor(e,t,n=t*2,i){super(new Ye,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._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 An(t,e,e,qt,Xt);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new An(t,e,e,Ta,fn);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),n=new An(t,e,e,qt,Xt);
5n.colorSpace=tt.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(this._geometryInitialized===!1){for(const r in e.attributes){const a=e.getAttribute(r),{array:o,itemSize:l,normalized:c}=a,h=new o.constructor(n*l),d=new mt(h,l,c);t.setAttribute(r,d)}if(e.getIndex()!==null){const r=n>65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new mt(r,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),r=t.getAttribute(n);if(i.itemSize!==r.itemSize||i.normalized!==r.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 kt);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 r=t[n].geometryIndex;this.getMatrixAt(n,Ht),this.getBoundingBoxAt(r,Cr).applyMatrix4(Ht),e.union(Cr)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Ot);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 r=t[n].geometryIndex;this.getMatrixAt(n,Ht),this.getBoundingSphereAt(r,fi).applyMatrix4(Ht),e.union(fi)}}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(lo),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const r=this._matricesTexture;Ht.identity().toArray(r.image.data,i*16),r.needsUpdate=!0;const a=this._colorsTexture;return a&&(ip.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},r=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(lo),l=this._availableGeometryIds.shift(),r[l]=i):(l=this._geometryCount,this._geometryCount++,r.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,r=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);ap(d,u,l);const f=d.itemSize;
vendor: 4,834 bytes, line 5
5for(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++)r.setX(h+u,l+a.getX(u));for(let u=a.count,f=d;u<f;u++)r.setX(h+u,l);r.needsUpdate=!0,r.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,r=n.length;i<r;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),r=this.geometry;for(let a=0,o=n.length;a<o;a++){const l=i[a],c=n[l];if(c.active!==!1){if(r.index!==null){if(c.indexStart!==t){const{indexStart:h,vertexStart:d,reservedIndexCount:u}=c,f=r.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=r.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=r.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 r=new kt,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)),r.expandByPoint(Ls.fromBufferAttribute(o,h))}i.boundingBox=r}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 r=new Ot;this.getBoundingBoxAt(e,Cr),Cr.getCenter(r.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)),Ls.fromBufferAttribute(o,d),l=Math.max(l,r.center.distanceToSquared(Ls))}r.radius=Math.sqrt(l),i.boundingSphere=r}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),this._colorsTexture===null?t.isVector4?t.set(1,1,1,1):t.setRGB(1,1,1):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(lo);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),r=new Int32Array(e);pi(this._multiDrawCounts,i),pi(this._multiDrawStarts,r),this._multiDrawCounts=i,this._multiDrawStarts=r,this._maxInstanceCount=e;const a=this._indirectTexture,o=this._matricesTexture,l=this._colorsTexture;a.dispose(),this._initIndirectTexture(),pi(a.image.data,this._indirectTexture.image.data),o.dispose(),this._initMatricesTexture(),pi(o.image.data,this._matricesTexture.image.data),l&&(l.dis
5pose(),this._initColorsTexture(),pi(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 r=this.geometry;r.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new Ye,this._initializeGeometry(r));const a=this.geometry;r.index&&pi(r.index.array,a.index.array);for(const o in r.attributes)pi(r.attributes[o].array,a.attributes[o].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,r=this.matrixWorld,a=this.geometry;Nt.material=this.material,Nt.geometry.index=a.index,Nt.geometry.attributes=a.attributes,Nt.geometry.boundingBox===null&&(Nt.geometry.boundingBox=new kt),Nt.geometry.boundingSphere===null&&(Nt.geometry.boundingSphere=new Ot);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];Nt.geometry.setDrawRange(h.start,h.count),this.getMatrixAt(o,Nt.matrixWorld).premultiply(r),this.getBoundingBoxAt(c,Nt.geometry.boundingBox),this.getBoundingSphereAt(c,Nt.geometry.boundingSphere),Nt.raycast(e,Rr);for(let d=0,u=Rr.length;d<u;d++){const f=Rr[d];f.object=this,f.batchId=o,t.push(f)}Rr.length=0}Nt.material=null,Nt.geometry.index=null,Nt.geometry.attributes={},Nt.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,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const a=i.getIndex();let o=a===null?1:a.array.BYTES_PER_ELEMENT,l=1;r.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?sp:rh;f&&!n.isArrayCamera&&(Ht.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),rh.setFromProjectionMatrix(Ht,n.coordinateSystem,n.reversedDepth));let m=0;if(this.sortObjects){Ht.copy(this.matrixWorld).invert(),Ls.setFromMatrixPosition(n.matrixWorld).applyMatrix4(Ht),ah.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(Ht);for(let M=0,w=c.length;M<w;M++)if(c[M].visible&&c[M].active){const b=c[M].geometryIndex;this.getMatrixAt(M,Ht),this.getBoundingSphereAt(b,fi).applyMatrix4(Ht);let R=!1;if(f&&(R=!g.intersectsSphere(fi,n)),!R){const v=u[b],A=rp.subVectors(fi.center,Ls).dot(ah);co.push(v.start,v.count,A,M)}}const x=co.list,y=this.customSort;y===null?x.sort(r.transparent?tp:ep):y.call(this,x,n);for(let M=0,w=x.length;M<w;M++){const b=x[M];h[m]=b.start*o*l,d[m]=b.count*l,_[m]=b.index,m++}co.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 w=!1;
vendor: 10,627 bytes, line 5
5if(f&&(this.getMatrixAt(x,Ht),this.getBoundingSphereAt(M,fi).applyMatrix4(Ht),w=!g.intersectsSphere(fi,n)),!w){const b=u[M];h[m]=b.start*o*l,d[m]=b.count*l,_[m]=x,m++}}p.needsUpdate=!0,this._multiDrawCount=m,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,r,a){this.onBeforeRender(e,null,i,r,a)}}class Jt extends Gt{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new be(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 ma=new C,ga=new C,oh=new Ge,Ds=new js,Ir=new Ot,ho=new C,lh=new C;class Ii extends ot{constructor(e=new Ye,t=new Jt){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,r=t.count;i<r;i++)ma.fromBufferAttribute(t,i-1),ga.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=ma.distanceTo(ga);e.setAttribute("lineDistance",new we(n,1))}else de("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Ir.copy(n.boundingSphere),Ir.applyMatrix4(i),Ir.radius+=r,e.ray.intersectsSphere(Ir)===!1)return;oh.copy(i).invert(),Ds.copy(e.ray).applyMatrix4(oh);const o=r/((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=Pr(this,e,Ds,l,m,x,_);y&&t.push(y)}if(this.isLineLoop){const _=h.getX(p-1),g=h.getX(f),m=Pr(this,e,Ds,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=Pr(this,e,Ds,l,_,_+1,_);m&&t.push(m)}if(this.isLineLoop){const _=Pr(this,e,Ds,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 r=0,a=i.length;r<a;r++){const o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}}function Pr(s,e,t,n,i,r,a){const o=s.geometry.attributes.position;if(ma.fromBufferAttribute(o,i),ga.fromBufferAttribute(o,r),t.distanceSqToSegment(ma,ga,ho,lh)>n)return;ho.applyMatrix4(s.matrixWorld);const c=e.ray.origin.distanceTo(ho);if(!(c<e.near||c>e.far))return{distance:c,point:lh.clone().applyMatrix4(s.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:s}}const ch=new C,hh=new C;class Xn extends Ii{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,r=t.count;i<r;i+=2)ch.fromBufferAttribute(t,i),hh.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+ch.distanceTo(hh);e.setAttribute("lineDistance",new we(n,1))}else de("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class lp extends Ii{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Ou extends Gt{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new be(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 uh=new Ge,gl=new js,Lr=new Ot,Dr=new C;class cp extends ot{constructor(e=new Ye,t=new Ou){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,r=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Lr.copy(n.boundingSphere),Lr.applyMatrix4(i),Lr.radius+=r,e.ray.intersectsSphere(Lr)===!1)return;uh.copy(i).invert(),gl.copy(e.ray).applyMatrix4(uh);const o=r/((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);Dr.fromBufferAttribute(d,g),dh(Dr,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++)Dr.fromBufferAttribute(d,p),dh(Dr,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 r=0,a=i.length;r<a;r++){const o=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=r}}}}}function dh(s,e,t,n,i,r,a){const o=gl.distanceSqToPoint(s);if(o<t){const l=new C;gl.closestPointToPoint(s,l),l.applyMatrix4(n);const c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;r.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class hp extends Mt{constructor(e,t,n,i,r=_t,a=_t,o,l,c){super(e,t,n,i,r,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 jy extends hp{constructor(e,t,n,i,r,a,o,l){super({},e,t,n,i,r,a,o,l),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class eM extends Mt{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=wt,this.minFilter=wt,this.generateMipmaps=!1,this.needsUpdate=!0}}class Xl extends Mt{constructor(e,t,n,i,r,a,o,l,c,h,d,u){super(null,a,o,l,c,h,i,r,d,u),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class tM extends Xl{constructor(e,t,n,i,r,a){super(e,t,n,r,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=nn,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class nM extends Xl{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,Gn),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class Aa extends Mt{constructor(e=[],t=Gn,n,i,r,a,o,l,c,h){super(e,t,n,i,r,a,o,l,c,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class iM extends Mt{constructor(e,t,n,i,r,a,o,l,c){super(e,t,n,i,r,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class sM extends Mt{constructor(e,t,n,i,r,a,o,l,c){super(e,t,n,i,r,a,o,l,c),this.isHTMLTexture=!0,this.generateMipmaps=!1,this.needsUpdate=!0;const h=e?e.parentNode:null;h!==null&&"requestPaint"in h&&(h.onpaint=()=>{this.needsUpdate=!0},h.requestPaint())}dispose(){const e=this.image?this.image.parentNode:null;e!==null&&"onpaint"in e&&(e.onpaint=null),super.dispose()}}class ms extends Mt{constructor(e,t,n=fn,i,r,a,o=wt,l=wt,c,h=Wn,d=1){if(h!==Wn&&h!==Ti)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const u={width:e,height:t,depth:d};super(u,i,r,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 Ai(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 up extends ms{constructor(e,t=fn,n=Gn,i,r,a=wt,o=wt,l,c=Wn){const h={width:e,height:e,depth:1},d=[h,h,h,h,h,h];super(e,e,t,n,i,r,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 Bu extends Mt{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class xs extends Ye{constructor(e=1,t=1,n=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};const o=this;i=Math.floor(i),r=Math.floor(r),a=Math.floor(a);const l=[],c=[],h=[],d=[];let u=0,f=0;p("z","y","x",-1,-1,n,t,e,a,r,0),p("z","y","x",1,-1,n,t,-e,a,r,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,r,4),p("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(l),this.setAttribute("position",new we(c,3)),this.setAttribute("normal",new we(h,3)),this.setAttribute("uv",new we(d,2));function p(_,g,m,x,y,M,w,b,R,v,A){const P=M/R,I=w/v,N=M/2,H=w/2,W=b/2,U=R+1,B=v+1;let k=0,te=0;const ne=new C;for(let pe=0;pe<B;pe++){const Me=pe*I-H;for(let Ce=0;Ce<U;Ce++){const Ke=Ce*P-N;ne[_]=Ke*x,ne[g]=Me*y,ne[m]=W,c.push(ne.x,ne.y,ne.z),ne[_]=0,ne[g]=0,ne[m]=b>0?1:-1,h.push(ne.x,ne.y,ne.z),d.push(Ce/R),d.push(1-pe/v),k+=1}}for(let pe=0;pe<v;pe++)for(let Me=0;Me<R;Me++){const Ce=u+Me+U*pe,Ke=u+Me+U*(pe+1),nt=u+(Me+1)+U*(pe+1),He=u+(Me+1)+U*pe;l.push(Ce,Ke,He),l.push(Ke,nt,He),te+=6}o.addGroup(f,te,A),f+=te,u+=k}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new xs(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class ql extends Ye{constructor(e=1,t=1,n=4,i=8,r=1){super(),this.type="CapsuleGeometry",this.parameters={radiu
vendor: 3,779 bytes, line 5
5s:e,height:t,capSegments:n,radialSegments:i,heightSegments:r},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),i=Math.max(3,Math.floor(i)),r=Math.max(1,Math.floor(r));const a=[],o=[],l=[],c=[],h=t/2,d=Math.PI/2*e,u=t,f=2*d+u,p=n*2+r,_=i+1,g=new C,m=new C;for(let x=0;x<=p;x++){let y=0,M=0,w=0,b=0;if(x<=n){const A=x/n,P=A*Math.PI/2;M=-h-e*Math.cos(P),w=e*Math.sin(P),b=-e*Math.cos(P),y=A*d}else if(x<=n+r){const A=(x-n)/r;M=-h+A*t,w=e,b=0,y=d+A*u}else{const A=(x-n-r)/n,P=A*Math.PI/2;M=h+e*Math.sin(P),w=e*Math.cos(P),b=e*Math.sin(P),y=d+u+A*d}const R=Math.max(0,Math.min(1,y/f));let v=0;x===0?v=.5/i:x===p&&(v=-.5/i);for(let A=0;A<=i;A++){const P=A/i,I=P*Math.PI*2,N=Math.sin(I),H=Math.cos(I);m.x=-w*H,m.y=M,m.z=w*N,o.push(m.x,m.y,m.z),g.set(-w*H,b,w*N),g.normalize(),l.push(g.x,g.y,g.z),c.push(P+v,R)}if(x>0){const A=(x-1)*_;for(let P=0;P<i;P++){const I=A+P,N=A+P+1,H=x*_+P,W=x*_+P+1;a.push(I,N,H),a.push(N,W,H)}}}this.setIndex(a),this.setAttribute("position",new we(o,3)),this.setAttribute("normal",new we(l,3)),this.setAttribute("uv",new we(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ql(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class Yl extends Ye{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 r=[],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++)r.push(d,d+1,0);this.setIndex(r),this.setAttribute("position",new we(a,3)),this.setAttribute("normal",new we(o,3)),this.setAttribute("uv",new we(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Yl(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Ea extends Ye{constructor(e=1,t=1,n=1,i=32,r=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:l};const c=this;i=Math.floor(i),r=Math.floor(r);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 we(d,3)),this.setAttribute("normal",new we(u,3)),this.setAttribute("uv",new we(f,2));function x(){const M=new C,w=new C;let b=0;const R=(t-e)/n;for(let v=0;v<=r;v++){const A=[],P=v/r,I=P*(t-e)+e;for(let N=0;N<=i;N++){const H=N/i,W=H*l+o,U=Math.sin(W),B=Math.cos(W);w.x=I*U,w.y=-P*n+g,w.z=I*B,d.push(w.x,w.y,w.z),M.set(U,R,B).normalize(),u.push(M.x,M.y,M.z),f.push(H,1-P),A.push(p++)}_.push(A)}for(let v=0;v<i;v++)for(let A=0;A<r;A++){const P=_[A][v],I=_[A+1][v],N=_[A+1][v+1],H=_[A][v+1];(e>0||A!==0)&&(h.push(P,I,H),b+=3),(t>0||A!==r-1)&&(h.push(I,N,H),b+=3)}c.addGroup(m,b,0),m+=b}function y(M){const w=p,b=new K,R=new C;let v=0;const A=M===!0?e:t,P=M===!0?1:-1;for(let N=1;N<=i;N++)d.push(0,g*P,0),u.push(0,P,0),f.push(.5,.5),p++;const I=p;for(let N=0;N<=i;N++){const W=N/i*l+o,U=Math.cos(W),B=Math.sin(W);R.x=A*B,R.y=g*P,R.z=A*U,d.push(R.x,R.y,R.z),u.push(0,P,0),b.x=U*.5+.5,b.y=B*.5*P+.5,f.push(b.x,b.y),p++}for(let N=0;N<i;N++){const H=w+N,W=I+N;M===!0?h.push(W,W+1,H):h.push(W+1,W,H),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 Ea(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class wa extends Ea{constructor(e=1,t=1,n=32,i=1,r=!1,a=0,o=Math.PI*2){super(0,e,t,n,i,r,a,o),this.type="C
5oneGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:o}}static fromJSON(e){return new wa(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Di extends Ye{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const r=[],a=[];o(i),c(n),h(),this.setAttribute("position",new we(r,3)),this.setAttribute("normal",new we(r.slice(),3)),this.setAttribute("uv",new we(a,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function o(x){const y=new C,M=new C,w=new C;for(let b=0;b<t.length;b+=3)f(t[b+0],y),f(t[b+1],M),f(t[b+2],w),l(y,M,w,x)}function l(x,y,M,w){const b=w+1,R=[];for(let v=0;v<=b;v++){R[v]=[];const A=x.clone().lerp(M,v/b),P=y.clone().lerp(M,v/b),I=b-v;for(let N=0;N<=I;N++)N===0&&v===b?R[v][N]=A:R[v][N]=A.clone().lerp(P,N/I)}for(let v=0;v<b;v++)for(let A=0;A<2*(b-v)-1;A++){const P=Math.floor(A/2);A%2===0?(u(R[v][P+1]),u(R[v+1][P]),u(R[v][P])):(u(R[v][P+1]),u(R[v+1][P+1]),u(R[v+1][P]))}}function c(x){const y=new C;for(let M=0;M<r.length;M+=3)y.x=r[M+0],y.y=r[M+1],y.z=r[M+2],y.normalize().multiplyScalar(x),r[M+0]=y.x,r[M+1]=y.y,r[M+2]=y.z}function h(){const x=new C;for(let y=0;y<r.length;y+=3){x.x=r[y+0],x.y=r[y+1],x.z=r[y+2];const M=g(x)/2/Math.PI+.5,w=m(x)/Math.PI+.5;a.push(M,1-w)}p(),d()}function d(){for(let x=0;x<a.length;x+=6){const y=a[x+0],M=a[x+2],w=a[x+4],b=Math.max(y,M,w),R=Math.min(y,M,w);b>.9&&R<.1&&(y<.2&&(a[x+0]+=1),M<.2&&(a[x+2]+=1),w<.2&&(a[x+4]+=1))}}function u(x){r.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,w=new C,b=new K,R=new K,v=new K;for(let A=0,P=0;A<r.length;A+=9,P+=6){x.set(r[A+0],r[A+1],r[A+2]),y.set(r[A+3],r[A+4],r[A+5]),M.set(r[A+6],r[A+7],r[A+8]),b.set(a[P+0],a[P+1]),R.set(a[P+2],a[P+3]),v.set(a[P+4],a[P+5]),w.copy(x).add(y).add(M).divideScalar(3);const I=g(w);_(b,P+0,x,I),_(R,P+2,y,I),_(v,P+4,M,I)}}function _(x,y,M,w){w<0&&x.x===1&&(a[y]=x.x-1),M.x===0&&M.z===0&&(a[y]=w/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 Di(e.vertices,e.indices,e.radius,e.detail)}}class Zl extends Di{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,r=[-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,111 bytes, line 5
519,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(r,a,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Zl(e.radius,e.detail)}}const Ur=new C,Nr=new C,uo=new C,Fr=new tn;class dp extends Ye{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),r=Math.cos(wi*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}=Fr;if(_.fromBufferAttribute(o,c[0]),g.fromBufferAttribute(o,c[1]),m.fromBufferAttribute(o,c[2]),Fr.getNormal(uo),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],w=d[y],b=Fr[h[x]],R=Fr[h[y]],v=`${M}_${w}`,A=`${w}_${M}`;A in u&&u[A]?(uo.dot(u[A].normal)<=r&&(f.push(b.x,b.y,b.z),f.push(R.x,R.y,R.z)),u[A]=null):v in u||(u[v]={index0:c[x],index1:c[y],normal:uo.clone()})}}for(const p in u)if(u[p]){const{index0:_,index1:g}=u[p];Ur.fromBufferAttribute(o,_),Nr.fromBufferAttribute(o,g),f.push(Ur.x,Ur.y,Ur.z),f.push(Nr.x,Nr.y,Nr.z)}this.setAttribute("position",new we(f,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Cn{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){de("Curve: .getPoint() not implemented.")}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),r=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),r+=n.distanceTo(i),t.push(r),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 r=n.length;let a;t?a=t:a=e*n[r-1];let o=0,l=r-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/(r-1);const h=n[i],u=n[i+1]-h,f=(a-h)/u;return(i+f)/(r-1)}getTangent(e,t){let i=e-1e-4,r=e+1e-4;i<0&&(i=0),r>1&&(r=1);const a=this.getPoint(i),o=this.getPoint(r),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=[],r=[],a=[],o=new C,l=new Ge;for(let f=0;f<=e;f++){const p=f/e;i[f]=this.getTangentAt(p,new C)}r[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(),r[0].crossVectors(i[0],o),a[0].crossVectors(i[0],r[0]);for(let f=1;f<=e;f++){if(r[f]=r[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(Oe(i[f-1].dot(i[f]),-1,1));r[f].applyMatrix4(l.makeRotationAxis(o,p))}a[f].crossVectors(i[f],r[f])}if(t===!0){let f=Math.acos(Oe(r[0].dot(r[e]),-1,1));f/=e,i[0].dot(o.crossVectors(r[0],r[e]))>0&&(f=-f);for(let p=1;p<=e;p++)r[p].applyMatrix4(l.makeRotationAxis(i[p],f*p)),a[p].crossVectors(i[p],r[p])}return{tangents:i,normals:r,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 Jl extends Cn{constructor(e=0,t=0,n=1,i=1,r=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=r,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(e,t=new K){const n=t,i=Math.PI*2;let r=this.aEndAngle-this.aStartAngle;const a=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(a?r=0:r=i),this.aClockwise===!0&&!a&&(r===i?r=-i:r=r-i);const o=this.aStartAngle+e*r;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 fp extends Jl{constructor(e,t,n,i,r,a){super(e,t,n,n,i,r,a),this.isArcCurve=!0,this.type="ArcCurve"}}function $l(){let s=0,e=0,t=0,n=0;function i(r,a,o,l){s=r,e=o,t=-3*r+3*a-2*o-l,n=2*r-2*a+o+l}return{initCatmullRom:function(r,a,o,l,c){i(a,o,c*(o-r),c*(l-a))},initNonuniformCatmullRom:function(r,a,o,l,c,h,d){let u=(a-r)/c-(o-r)/(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(r){const a=r*r,o=a*r;return s+e*r+t*a+n*o}}}const fh=new C,ph=new C,fo=new $l,po=new $l,mo=new $l;class pp extends Cn{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,r=i.length,a=(r-(this.closed?0:1))*e;let o=Math.floor(a),l=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/r)+1)*r:l===0&&o===r-1&&(o=r-2,l=1);let c,h;this.closed||o>0?c=i[(o-1)%r]:(ph.subVectors(i[0],i[1]).add(i[0]),c=ph);const d=i[o%r],u=i[(o+1)%r];if(this.closed||o+2<r?h=i[(o+2)%r]:(fh.subVectors(i[r-1],i[r-2]).add(i[r-1]),h=fh),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=_),fo.initNonuniformCatmullRom(c.x,d.x,u.x,h.x,p,_,g),po.initNonuniformCatmullRom(c.y,d.y,u.y,h.y,p,_,g),mo.initNonuniformCatmullRom(c.z,d.z,u.z,h.z,p,_,g)}else this.curveType==="catmullrom"&&(fo.initCatmullRom(c.x,d.x,u.x,h.x,this.tension),po.initCatmullRom(c.y,d.y,u.y,h.y,this.tension),mo.initCatmullRom(c.z,d.z,u.z,h.z,this.tension));return n.set(fo.calc(l),po.calc(l),mo.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 mh(s,e,t,n,i){const r=(n-e)*.5,a=(i-t)*.5,o=s*s,l=s*o;return(2*t-2*n+r+a)*l+(-3*t+3*n-2*r-a)*o+r*s+t}function mp(s,e){const t=1-s;return t*t*e}function gp(s,e){return 2*(1-s)*s*e}function _p(s,e){return s*s*e}function Hs(s,e,t,n){return mp(s,e)+gp(s,t)+_p(s,n)}function xp(s,e){const t=1-s;return t*t*t*e}function vp(s,e){const t=1-s;return 3*t*t*s*e}function yp(s,e){return 3*(1-s)*s*s*e}function Mp(s,e){return s*s*s*e}function Ws(s,e,t,n,i){return xp(s,e)+vp(s,t)+yp(s,n)+Mp(s,i)}class zu extends Cn{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,r=this.v1,a=this.v2,o=this.v3;return n.set(Ws(e,i.x,r.x,a.x,o.x),Ws(e,i.y,r.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 Sp extends Cn{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,r=this.v1,a=this.v2,o=this.v3;return n.set(Ws(e,i.x,r.x,a.x,o.x),Ws(e,i.y,r.y,a.y,o.y),Ws(e,i.z,r.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 Vu extends Cn{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 5
5getTangent(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 bp extends Cn{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 ku extends Cn{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,r=this.v1,a=this.v2;return n.set(Hs(e,i.x,r.x,a.x),Hs(e,i.y,r.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 Gu extends Cn{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,r=this.v1,a=this.v2;return n.set(Hs(e,i.x,r.x,a.x),Hs(e,i.y,r.y,a.y),Hs(e,i.z,r.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 Hu extends Cn{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new K){const n=t,i=this.points,r=(i.length-1)*e,a=Math.floor(r),o=r-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(mh(o,l.x,c.x,h.x,d.x),mh(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 _a=Object.freeze({__proto__:null,ArcCurve:fp,CatmullRomCurve3:pp,CubicBezierCurve:zu,CubicBezierCurve3:Sp,EllipseCurve:Jl,LineCurve:Vu,LineCurve3:bp,QuadraticBezierCurve:ku,QuadraticBezierCurve3:Gu,SplineCurve:Hu});class Tp extends Cn{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 _a[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=n){const a=i[r]-n,o=this.curves[r],l=o.getLength(),c=l===0?0:1-a/l;return o.getPointAt(c,t)}r++}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,r=this.curves;i<r.length;i++){const a=r[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 _a[i.type]().fromJSON(i))}return this}}class _l extends Tp{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 Vu(this.currentPoint.clone(),new K(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const r=new ku(this.currentPoint.clone(),new K(e,t),new K(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,r,a){const o=new zu(this.currentPoint.clone(),new K(e,t),new K(n,i),new K(r,a));return this.curves.push(o),this.currentPoint.set(r,a),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new Hu(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,r,a){const o=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+o,t+l,n,i,r,a),this}absarc(e,t,n,i,r,a){return this.absellipse(e,t,n,n,i,r,a),this}ellipse(e,t,n,i,r,a,o,l){const c=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+c,t+h,n,i,r,a,o,l),this}absellipse(e,t,n,i,r,a,o,l){const c=new Jl(e,t,n,i,r,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 hs extends _l{constructor(e){super(e),this.uuid=sn(),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 _l().fromJSON(i))}return this}}function Ap(s,e,t=2){const n=e&&e.length,i=n?e[0]*t:s.length;let r=Wu(s,0,i,t,!0);const a=[];if(!r||r.next===r.prev)return a;let o,l,c;if(n&&(r=Ip(s,e,r,t)),s.length>80*t){o=s[0],l=s[1];let h=o,d=l;for(let u=t;u<i;u+=t){const f=s[u],p=s[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 Js(r,a,t,o,l,c,0),a}function Wu(s,e,t,n,i){let r;if(i===kp(s,e,t,n)>0)for(let a=e;a<t;a+=n)r=gh(a/n|0,s[a],s[a+1],r);else for(let a=t-n;a>=e;a-=n)r=gh(a/n|0,s[a],s[a+1],r);return r&&gs(r,r.next)&&(Ks(r),r=r.next),r}function Pi(s,e){if(!s)return s;e||(e=s);let t=s,n;do if(n=!1,!t.steiner&&(gs(t,t.next)||xt(t.prev,t,t.next)===0)){if(Ks(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Js(s,e,t,n,i,r,a){if(!s)return;!a&&r&&Np(s,n,i,r);let o=s;for(;s.prev!==s.next;){const l=s.prev,c=s.next;if(r?wp(s,n,i,r):Ep(s)){e.push(l.i,s.i,c.i),Ks(s),s=c.next,o=c.next;continue}if(s=c,s===o){a?a===1?(s=Cp(Pi(s),e),Js(s,e,t,n,i,r,2)):a===2&&Rp(s,e,t,n,i,r):Js(Pi(s),e,t,n,i,r,1);break}}}function Ep(s){const e=s.prev,t=s,n=s.next;if(xt(e,t,n)>=0)return!1;const i=e.x,r=t.x,a=n.x,o=e.y,l=t.y,c=n.y,h=Math.min(i,r,a),d=Math.min(o,l,c),u=Math.max(i,r,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&&Vs(i,o,r,l,a,c,p.x,p.y)&&xt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function wp(s,e,t,n){const i=s.prev,r=s,a=s.next;if(xt(i,r,a)>=0)return!1;const o=i.x,l=r.x,c=a.x,h=i.y,d=r.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=xl(f,p,e,t,n),x=xl(_,g,e,t,n);let y=s.prevZ,M=s.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&&Vs(o,h,l,d,c,u,y.x,y.y)&&xt(y.prev,y,y.next)>=0||(y=y.prevZ,M.x>=f&&M.x<=_&&M.y>=p&&M.y<=g&&M!==i&&M!==a&&Vs(o,h,l,d,c,u,M.x,M.y)&&xt(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&&Vs(o,h,l,d,c,u,y.x,y.y)&&xt(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&&Vs(o,h,l,d,c,u,M.x,M.y)&&xt(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function Cp(s,e){let t=s;do{const n=t.prev,i=t.next.next;!gs(n,i)&&qu(n,t,t.next,i)&&$s(n,i)&&$s(i,n)&&(e.push(n.i,t.i,i.i),Ks(t),Ks(t.next),t=s=i),t=t.next}while(t!==s);return Pi(t)}function Rp(s,e,t,n,i,r){let a=s;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&Bp(a,o)){let l=Yu(a,o);a=Pi(a,a.next),l=Pi(l,l.next),Js(a,e,t,n,i,r,0),Js(l,e,t,n,i,r,0);return}o=o.next}a=a.next}while(a!==s)}function Ip(s,e,t,n){const i=[];for(let r=0,a=e.length;r<a;r++){const o=e[r]*n,l=r<a-1?e[r+1]*n:s.length,c=Wu(s,o,l,n,!1);c===c.next&&(c.steiner=!0),i.push(Op(c))}i.sort(Pp);for(let r=0;r<i.length;r++)t=Lp(i[r],t);return t}function Pp(s,e){let t=s.x-e.x;if(t===0&&(t=s.y-e.y,t===0)){const n=(s.next.y-s.y)/(s.next.x-s.x),i=(e.next.y-e.y)/(e.next.x-e.x);t=n-i}return t}function Lp(s,e){const t=Dp(s,e);if(!t)return e;const n=Yu(t,s);return Pi(n,n.next),Pi(t,t.next)}function Dp(s,e){let t=e;const n=s.x,i=s.y;let r=-1/0,a;if(gs(s,t))return t;do{if(gs(s,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>r&&(r=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&&Xu(i<c?n:r,i,l,c,i<c?r:n,i,t.x,t.y)){const d=Math.abs(i-t.y)/(n-t.x);$s(t,s)&&(d<h||d===h&&(t.x>a.x||t.x===a.x&&Up(a,t)))&&(a=t,h=d)}t=t.next}while(t!==o);return a}function Up(s,e){return xt(s.prev,s,e.prev)<0&&xt(e.next,s,s.next)<0}function Np(s,e,t,n){let i=s;do i.z===0&&(i.z=xl(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==s);i.prevZ.nextZ=null,i.prevZ=null,Fp(i)}function Fp(s){let e,t=1;do{let n=s,i;s=null;let r=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--),r?r.nextZ=i:s=i,i.prevZ=r,r=i;n=a}r.nextZ=null,t*=2}while(e>1);return s}function xl(s,e,t,n,i){return s=(s-t)*i|0,e=(e-n)*i|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,s|e<<1}function Op(s){let e=s,t=s;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==s);return t}function Xu(s,e,t,n,i,r,a,o){return(i-a)*(e-o)>=(s-a)*(r-o)&&(s-a)*(n-o)>=(t-a)*(e-o)&&(t-a)*(r-o)>=(i-a)*(n-o)}function Vs(s,e,t,n,i,r,a,o){return!(s===a&&e===o)&&Xu(s,e,t,n,i,r,a,o)}function Bp(s,e){return s.next.i!==e.i&&s.prev.i!==e.i&&!zp(s,e)&&($s(s,e)&&$s(e,s)&&Vp(s,e)&&(xt(s.prev,s,e.prev)||xt(s,e.prev,e))||gs(s,e)&&xt(s.prev,s,s.next)>0&&xt(e.prev,e,e.next)>0)}function xt(s,e,t){return(e.y-s.y)*(t.x-e.x)-(e.x-s.x)*(t.y-e.y)}function gs(s,e){return s.x===e.x&&s.y===e.y}function qu(s,e,t,n){const i=Br(xt(s,e,t)),r=Br(xt(s,e,n)),a=Br(xt(t,n,s)),o=Br(xt(t,n,e));return!!(i!==r&&a!==o||i===0&&Or(s,t,e)||r===0&&Or(s,n,e)||a===0&&Or(t,s,n)||o===0&&Or(t,e,n))}function Or(s,e,t){return e.x<=Math.max(s.x,t.x)&&e.x>=Math.min(s.x,t.x)&&e.y<=Math.max(s.y,t.y)&&e.y>=Math.min(s.y,t.y)}function Br(s){return s>0?1:s<0?-1:0}function zp(s,e){let t=s;do{if(t.i!==s.i&&t.next.i!==s.i&&t.i!==e.i&&t.next.i!==e.i&&qu(t,t.next,s,e))return!0;t=t.next}while(t!==s);return!1}function $s(s,e){return xt(s.prev,s,s.next)<0?xt(s,e,s.next)>=0&&xt(s,s.prev,e)>=0:xt(s,e,s.prev)<0||xt(s,s.next,e)<0}function Vp(s,e){let t=s,n=!1;const i=(s.x+e.x)/2,r=(s.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&i<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==s);return n}function Yu(s,e){const t=vl(s.i,s.x,s.y),n=vl(e.i,e.x,e.y),i=s.next,r=e.prev;return s.next=e,e.prev=s,t.next=i,i.prev=t,n.next=t,t.prev=n,r.next=n,n.prev=r,n}function gh(s,e,t,n){const i=vl(s,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 Ks(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function vl(s,e,t){return{i:s,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function kp(s,e,t,n){let i=0;for(let r=e,a=t-n;r<t;r+=n)i+=(s[a]-s[r])*(s[r+1]+s[a+1]),a=r;return i}class Gp{static triangulate(e,t,n=2){return Ap(e,t,n)}}class bn{static area(e){const t=e.length;let n=0;for(let i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return n*.5}static isClockWise(e){return bn.area(e)<0}
vendor: 43,871 bytes, lines 5-9
5static triangulateShape(e,t){const n=[],i=[],r=[];_h(e),xh(n,e);let a=e.length;t.forEach(_h);for(let l=0;l<t.length;l++)i.push(a),a+=t[l].length,xh(n,t[l]);const o=Gp.triangulate(n,i);for(let l=0;l<o.length;l+=3)r.push(o.slice(l,l+3));return r}}function _h(s){const e=s.length;e>2&&s[e-1].equals(s[0])&&s.pop()}function xh(s,e){for(let t=0;t<e.length;t++)s.push(e[t].x),s.push(e[t].y)}class Kl extends Ye{constructor(e=new hs([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=[],r=[];for(let o=0,l=e.length;o<l;o++){const c=e[o];a(c)}this.setAttribute("position",new we(i,3)),this.setAttribute("uv",new we(r,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:Hp;let y,M=!1,w,b,R,v;if(m){y=m.getSpacedPoints(h),M=!0,u=!1;const $=m.isCatmullRomCurve3?m.closed:!1;w=m.computeFrenetFrames(h,$),b=new C,R=new C,v=new C}u||(g=0,f=0,p=0,_=0);const A=o.extractPoints(c);let P=A.shape;const I=A.holes;if(!bn.isClockWise(P)){P=P.reverse();for(let $=0,ie=I.length;$<ie;$++){const Q=I[$];bn.isClockWise(Q)&&(I[$]=Q.reverse())}}function H($){const Q=10000000000000001e-36;let xe=$[0];for(let fe=1;fe<=$.length;fe++){const Ve=fe%$.length,L=$[Ve],We=L.x-xe.x,Re=L.y-xe.y,ke=We*We+Re*Re,se=Math.max(Math.abs(L.x),Math.abs(L.y),Math.abs(xe.x),Math.abs(xe.y)),lt=Q*se*se;if(ke<=lt){$.splice(Ve,1),fe--;continue}xe=L}}H(P),I.forEach(H);const W=I.length,U=P;for(let $=0;$<W;$++){const ie=I[$];P=P.concat(ie)}function B($,ie,Q){return ie||Pe("ExtrudeGeometry: vec does not exist"),$.clone().addScaledVector(ie,Q)}const k=P.length;function te($,ie,Q){let xe,fe,Ve;const L=$.x-ie.x,We=$.y-ie.y,Re=Q.x-$.x,ke=Q.y-$.y,se=L*L+We*We,lt=L*ke-We*Re;if(Math.abs(lt)>Number.EPSILON){const E=Math.sqrt(se),S=Math.sqrt(Re*Re+ke*ke),O=ie.x-We/E,Y=ie.y+L/E,j=Q.x-ke/S,re=Q.y+Re/S,ce=((j-O)*ke-(re-Y)*Re)/(L*ke-We*Re);xe=O+L*ce-$.x,fe=Y+We*ce-$.y;const X=xe*xe+fe*fe;if(X<=2)return new K(xe,fe);Ve=Math.sqrt(X/2)}else{let E=!1;L>Number.EPSILON?Re>Number.EPSILON&&(E=!0):L<-Number.EPSILON?Re<-Number.EPSILON&&(E=!0):Math.sign(We)===Math.sign(ke)&&(E=!0),E?(xe=-We,fe=L,Ve=Math.sqrt(se)):(xe=L,fe=We,Ve=Math.sqrt(se/2))}return new K(xe/Ve,fe/Ve)}const ne=[];for(let $=0,ie=U.length,Q=ie-1,xe=$+1;$<ie;$++,Q++,xe++)Q===ie&&(Q=0),xe===ie&&(xe=0),ne[$]=te(U[$],U[Q],U[xe]);const pe=[];let Me,Ce=ne.concat();for(let $=0,ie=W;$<ie;$++){const Q=I[$];Me=[];for(let xe=0,fe=Q.length,Ve=fe-1,L=xe+1;xe<fe;xe++,Ve++,L++)Ve===fe&&(Ve=0),L===fe&&(L=0),Me[xe]=te(Q[xe],Q[Ve],Q[L]);pe.push(Me),Ce=Ce.concat(Me)}let Ke;if(g===0)Ke=bn.triangulateShape(U,I);else{const $=[],ie=[];for(let Q=0;Q<g;Q++){const xe=Q/g,fe=f*Math.cos(xe*Math.PI/2),Ve=p*Math.sin(xe*Math.PI/2)+_;for(let L=0,We=U.length;L<We;L++){const Re=B(U[L],ne[L],Ve);Le(Re.x,Re.y,-fe),xe===0&&$.push(Re)}for(let L=0,We=W;L<We;L++){const Re=I[L];Me=pe[L];const ke=[];for(let se=0,lt=Re.length;se<lt;se++){const E=B(Re[se],Me[se],Ve);Le(E.x,E.y,-fe),xe===0&&ke.push(E)}xe===0&&ie.push(ke)}}Ke=bn.triangulateShape($,ie)}const nt=Ke.length,He=p+_;for(let $=0;$<k;$++){const ie=u?B(P[$],Ce[$],He):P[$];M?(R.copy(w.normals[0]).multiplyScalar(ie.x),b.copy(w.binormals[0]).multiplyScalar(ie.y),v.copy(y[0]).add(R).add(b),Le(v.x,v.y,v.z)):Le(ie.x,ie.y,0)}for(let $=1;$<=h;$++)for(let ie=0;ie<k;ie++){const Q=u?B(P[ie],Ce[ie],He):P[ie];M?(R.copy(w.normals[$]).multiplyScalar(Q.x),b.copy(w.binormals[$]).multiplyScalar(Q.y),v.copy(y[$]).add(R).add(b),Le(v.x,v.y,v.z)):Le(Q.x,Q.y,d/h*$)}for(let $=g-1;$>=0;$--){const ie=$/g,Q=f*Math.cos(ie*Math.PI/2),xe=p*Math.sin(ie*Math.PI/2)+_;for(let fe=0,Ve=U.length;fe<Ve;fe++){const L=B(U[fe],ne[fe],xe);Le(L.x,L.y,d+Q)}for(let fe=0,Ve=I.length;fe<Ve;fe++){const L=I[fe];Me=pe[fe];for(let We=0,Re=L.length;We<Re;We++){const ke=B(L[We],Me[We],xe);M?Le(ke.x,ke.y+y[h-1].y,y[h-1].x+Q):Le(ke.x,ke.y,d+Q)}}}J(),ge();function J(){const $=i.length/3;if(u){let ie=0,Q=k*ie;for(let xe=0;xe<nt;xe++){const fe=Ke[xe];Be(fe[2]+Q,fe[1]+Q,fe[0]+Q)}ie=h+g*2,Q=k*ie;for(let xe=0;xe<nt;xe++){const fe=Ke[xe];Be(fe[0]+Q,fe[1]+Q,fe[2]+Q)}}else{for(let ie=0;ie<nt;ie++){const Q=Ke[ie];Be(Q[2],Q[1],Q[0])}for(let ie=0;ie<nt;ie++){const Q=Ke[ie];Be(Q[0]+k*h,Q[1]+k*h,Q[2]+k*h)}}n.addGroup($,i.length/3-$,0)}function ge(){const $=i.length/3;let ie=0;ae(U,ie),ie+=U.length;for(let Q=0,xe=I.length;Q<xe;Q++){const fe=I[Q];ae(fe,ie),ie+=fe.length}n.addGroup($,i.length/3-$,1)}function ae($,ie){let Q=$.length;for(;--Q>=0;){const xe=Q;let fe=Q-1;fe<0&&(fe=$.length-1);for(let Ve=0,L=h+g*2;Ve<L;Ve++){const We=k*Ve,Re=k*(Ve+1),ke=ie+xe+We,se=ie+fe+We,lt=ie+fe+Re,E=ie+xe+Re;Fe(ke,se,lt,E)}}}function Le($,ie,Q){l.push($),l.push(ie),l.push(Q)}function Be($,ie,Q){it($),it(ie),it(Q);const xe=i.length/3,fe=x.generateTopUV(n,i,xe-3,xe-2,xe-1);ze(fe[0]),ze(fe[1]),ze(fe[2])}function Fe($,ie,Q,xe){it($),it(ie),it(xe),it(ie),it(Q),it(xe);const fe=i.length/3,Ve=x.generateSideWallUV(n,i,fe-6,fe-3,fe-2,fe-1);ze(Ve[0]),ze(Ve[1]),ze(Ve[3]),ze(Ve[1]),ze(Ve[2]),ze(Ve[3])}function it($){i.push(l[$*3+0]),i.push(l[$*3+1]),i.push(l[$*3+2])}function ze($){r.push($.x),r.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 Wp(t,n,e)}static fromJSON(e,t){const n=[];for(let r=0,a=e.shapes.length;r<a;r++){const o=t[e.shapes[r]];n.push(o)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new _a[i.type]().fromJSON(i)),new Kl(n,e.options)}}const Hp={generateTopUV:function(s,e,t,n,i){const r=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(r,a),new K(o,l),new K(c,h)]},generateSideWallUV:function(s,e,t,n,i,r){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[r*3],g=e[r*3+1],m=e[r*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 Wp(s,e,t){if(t.shapes=[],Array.isArray(s))for(let n=0,i=s.length;n<i;n++){const r=s[n];t.shapes.push(r.uuid)}else t.shapes.push(s.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class Ql extends Di{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],r=[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,r,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Ql(e.radius,e.detail)}}class jl extends Ye{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=Oe(i,0,Math.PI*2);const r=[],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),w=Math.cos(y);for(let b=0;b<=e.length-1;b++){d.x=e[b].x*M,d.y=e[b].y,d.z=e[b].x*w,a.push(d.x,d.y,d.z),u.x=x/t,u.y=b/(e.length-1),o.push(u.x,u.y);const R=l[3*b+0]*M,v=l[3*b+1],A=l[3*b+0]*w;c.push(R,v,A)}}for(let x=0;x<t;x++)for(let y=0;y<e.length-1;y++){const M=y+x*e.length,w=M,b=M+e.length,R=M+e.length+1,v=M+1;r.push(w,b,v),r.push(R,v,b)}this.setIndex(r),this.setAttribute("position",new we(a,3)),this.setAttribute("uv",new we(o,2)),this.setAttribute("normal",new we(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 Ca extends Di{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 Ca(e.radius,e.detail)}}class tr extends Ye{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const r=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-r;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),w=x+1+c*(m+1),b=x+1+c*m;f.push(y,M,b),f.push(M,w,b)}this.setIndex(f),this.setAttribute("position",new we(p,3)),this.setAttribute("normal",new we(_,3)),this.setAttribute("uv",new we(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new tr(e.width,e.height,e.widthSegments,e.heightSegments)}}class ec extends Ye{constructor(e=.5,t=1,n=32,i=1,r=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,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=r+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,w=x+n+2,b=x+1;o.push(y,M,b),o.push(M,w,b)}}this.setIndex(o),this.setAttribute("position",new we(l,3)),this.setAttribute("normal",new we(c,3)),this.setAttribute("uv",new we(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ec(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class tc extends Ye{constructor(e=new hs([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=[],r=[],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 we(i,3)),this.setAttribute("normal",new we(r,3)),this.setAttribute("uv",new we(a,2));function c(h){const d=i.length/3,u=h.extractPoints(t);let f=u.shape;const p=u.holes;bn.isClockWise(f)===!1&&(f=f.reverse());for(let g=0,m=p.length;g<m;g++){const x=p[g];bn.isClockWise(x)===!0&&(p[g]=x.reverse())}const _=bn.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),r.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,w=x[2]+d;n.push(y,M,w),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 Xp(t,e)}static fromJSON(e,t){const n=[];for(let i=0,r=e.shapes.length;i<r;i++){const a=t[e.shapes[i]];n.push(a)}return new tc(n,e.curveSegments)}}function Xp(s,e){if(e.shapes=[],Array.isArray(s))for(let t=0,n=s.length;t<n;t++){const i=s[t];e.shapes.push(i.uuid)}else e.shapes.push(s.uuid);return e}class Ra extends Ye{constructor(e=1,t=32,n=16,i=0,r=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,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 w=0;w<=t;w++){const b=w/t;d.x=-e*Math.cos(i+b*r)*Math.sin(a+y*o),d.y=e*Math.cos(a+y*o),d.z=e*Math.sin(i+b*r)*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(b+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],w=h[m+1][x],b=h[m+1][x+1];(m!==0||a>0)&&f.push(y,M,b),(m!==n-1||l<Math.PI)&&f.push(M,w,b)}this.setIndex(f),this.setAttribute("position",new we(p,3)),this.setAttribute("normal",new we(_,3)),this.setAttribute("uv",new we(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ra(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class nc extends Di{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 nc(e.radius,e.detail)}}class ic extends Ye{constructor(e=1,t=.4,n=12,i=48,r=Math.PI*2,a=0,o=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r,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*r;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 we(c,3)),this.setAttribute("normal",new we(h,3)),this.setAttribute("uv",new we(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ic(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class sc extends Ye{constructor(e=1,t=.4,n=64,i=8,r=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,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*r*Math.PI*2;x(M,r,a,e,f),x(M+.01,r,a,e,p),g.subVectors(p,f),m.addVectors(p,f),_.crossVectors(g,m),m.crossVectors(_,g),_.normalize(),m.normalize();for(let w=0;w<=i;++w){const b=w/i*Math.PI*2,R=-t*Math.cos(b),v=t*Math.sin(b);d.x=f.x+(R*m.x+v*_.x),d.y=f.y+(R*m.y+v*_.y),d.z=f.z+(R*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(w/i)}}for(let y=1;y<=n;y++)for(let M=1;M<=i;M++){const w=(i+1)*(y-1)+(M-1),b=(i+1)*y+(M-1),R=(i+1)*y+M,v=(i+1)*(y-1)+M;o.push(w,b,v),o.push(b,R,v)}this.setIndex(o),this.setAttribute("position",new we(l,3)),this.setAttribute("normal",new we(c,3)),this.setAttribute("uv",new we(h,2));function x(y,M,w,b,R){const v=Math.cos(y),A=Math.sin(y),P=w/M*y,I=Math.cos(P);R.x=b*(2+I)*.5*v,R.y=b*(2+I)*A*.5,R.z=b*Math.sin(P)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new sc(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class rc extends Ye{constructor(e=new Gu(new C(-1,-1,0),new C(-1,1,0),new C(1,1,0)),t=64,n=1,i=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r};const a=e.computeFrenetFrames(t,r);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 we(d,3)),this.setAttribute("normal",new we(u,3)),this.setAttribute("uv",new we(f,2));function _(){for(let y=0;y<t;y++)g(y);g(r===!1?t:0),x(),m()}function g(y){h=e.getPointAt(y/t,h);const M=a.normals[y],w=a.binormals[y];for(let b=0;b<=i;b++){const R=b/i*Math.PI*2,v=Math.sin(R),A=-Math.cos(R);l.x=A*M.x+v*w.x,l.y=A*M.y+v*w.y,l.z=A*M.z+v*w.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 w=(i+1)*(y-1)+(M-1),b=(i+1)*y+(M-1),R=(i+1)*y+M,v=(i+1)*(y-1)+M;p.push(w,b,v),p.push(b,R,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 rc(new _a[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class qp extends Ye{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new C,r=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),r.fromBufferAttribute(a,x),vh(i,r,n)===!0&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.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),r.fromBufferAttribute(a,d),vh(i,r,n)===!0&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}this.setAttribute("position",new we(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function vh(s,e,t){const n=`${s.x},${s.y},${s.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${s.x},${s.y},${s.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n),t.add(i),!0)}var yh=Object.freeze({__proto__:null,BoxGeometry:xs,CapsuleGeometry:ql,CircleGeometry:Yl,ConeGeometry:wa,CylinderGeometry:Ea,DodecahedronGeometry:Zl,EdgesGeometry:dp,ExtrudeGeometry:Kl,IcosahedronGeometry:Ql,LatheGeometry:jl,OctahedronGeometry:Ca,PlaneGeometry:tr,PolyhedronGeometry:Di,RingGeometry:ec,ShapeGeometry:tc,SphereGeometry:Ra,TetrahedronGeometry:nc,TorusGeometry:ic,TorusKnotGeometry:sc,TubeGeometry:rc,WireframeGeometry:qp});class Yp extends Gt{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new be(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 _s(s){const e={};for(const t in s){e[t]={};for(const n in s[t]){const i=s[t][n];if(Mh(i))i.isRenderTargetTexture?(de("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone();else if(Array.isArray(i))if(Mh(i[0])){const r=[];for(let a=0,o=i.length;a<o;a++)r[a]=i[a].clone();e[t][n]=r}else e[t][n]=i.slice();else e[t][n]=i}}return e}function zt(s){const e={};for(let t=0;t<s.length;t++){const n=_s(s[t]);for(const i in n)e[i]=n[i]}return e}function Mh(s){return s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)}function Zp(s){const e=[];for(let t=0;t<s.length;t++)e.push(s[t].clone());return e}function Zu(s){const e=s.getRenderTarget();return e===null?s.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:tt.workingColorSpace}const Jp={clone:_s,merge:zt};var $p=`void main() {
6	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
7}`,Kp=`void main() {
8	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
9}`;class pn extends Gt{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=$p,this.fragmentShader=Kp,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=_s(e.uniforms),this.uniformsGroups=Zp(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 Ju extends pn{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class $u extends Gt{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new be(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 be(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 En,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 Qp extends $u{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 Oe(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 be(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 be(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new be(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 jp extends Gt{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new be(16777215),this.specular=new be(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new be(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 En,this.combine=ba,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 em extends Gt{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new be(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new be(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 tm extends Gt{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 nm extends Gt{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new be(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new be(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 En,this.combine=ba,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 Ku extends Gt{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=$d,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 Qu extends Gt{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 im extends Gt{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new be(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 sm extends Jt{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 Ei(s,e){return!s||s.constructor===e?s:typeof e.BYTES_PER_ELEMENT=="number"?new e(s):Array.prototype.slice.call(s)}function ju(s){function e(i,r){return s[i]-s[r]}const t=s.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function yl(s,e,t){const n=s.length,i=new s.constructor(n);for(let r=0,a=0;a!==n;++r){const o=t[r]*e;for(let l=0;l!==e;++l)i[a++]=s[o+l]}return i}function ac(s,e,t,n){let i=1,r=s[0];for(;r!==void 0&&r[n]===void 0;)r=s[i++];if(r===void 0)return;let a=r[n];if(a!==void 0)if(Array.isArray(a))do a=r[n],a!==void 0&&(e.push(r.time),t.push(...a)),r=s[i++];while(r!==void 0);else if(a.toArray!==void 0)do a=r[n],a!==void 0&&(e.push(r.time),a.toArray(t,t.length)),r=s[i++];while(r!==void 0);else do a=r[n],a!==void 0&&(e.push(r.time),t.push(a)),r=s[i++];while(r!==void 0)}function rm(s,e,t,n,i=30){const r=s.clone();r.name=e;const a=[];for(let l=0;l<r.tracks.length;++l){const c=r.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=Ei(d,c.times.constructor),c.values=Ei(u,c.values.constructor),a.push(c))}r.tracks=a;let o=1/0;for(let l=0;l<r.tracks.length;++l)o>r.tracks[l].times[0]&&(o=r.tracks[l].times[0]);for(let l=0;l<r.tracks.length;++l)r.tracks[l].shift(-1*o);return r.resetDuration(),r}function am(s,e=0,t=s,n=30){n<=0&&(n=30);const i=t.tracks.length,r=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=s.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(r<=o.times[0]){const m=h,x=d-h;_=o.values.slice(m,x)}else if(r>=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(r),_=m.resultBuffer.slice(x,y)}l==="quaternion"&&new Zt().fromArray(_).normalize().conjugate().toArray(_);const g=c.times.length;for(let m=0;m<g;++m){const x=m*f+u;if(l==="quaternion")Zt.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 s.blendMode=wu,s}class rM{static convertArray(e,t){return Ei(e,t)}static isTypedArray(e){return Cu(e)}static getKeyframeOrder(e){return ju(e)}static sortedArray(e,t,n){return yl(e,t,n)}static flattenJSON(e,t,n,i){ac(e,t,n,i)}static subclip(e,t,n,i,r=30){return rm(e,t,n,i,r)}static makeClipAdditive(e,t=0,n=e,i=30){return am(e,t,n,i)}}class nr{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],r=t[n-1];e:{t:{let a;n:{i:if(!(e<i)){for(let o=n+2;;){if(i===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(r=i,i=t[++n],e<i)break t}a=t.length;break n}if(!(e>=r)){const o=t[1];e<o&&(n=2,r=o);for(let l=n-2;;){if(r===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(i=r,r=t[--n-1],e>=r)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],r=t[n-1],r===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,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let a=0;a!==i;++a)t[a]=n[r+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class om extends nr{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:rs,endingEnd:rs}}intervalChanged_(e,t,n){const i=this.parameterPositions;let r=e-2,a=e+1,o=i[r],l=i[a];if(o===void 0)switch(this.getSettings_().endingStart){case as:r=e,o=2*t-n;break;case ha:r=i.length-2,o=t+i[r]-i[r+1];break;default:r=e,o=n}if(l===void 0)switch(this.getSettings_().endingEnd){case as:a=e,l=2*n-t;break;case ha: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=r*h,this._offsetNext=a*h}interpolate_(e,t,n,i){const r=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 w=0;w!==o;++w)r[w]=m*a[h+w]+x*a[c+w]+y*a[l+w]+M*a[d+w];return r}}class ed extends nr{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=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)r[u]=a[c+u]*d+a[l+u]*h;return r}}class lm extends nr{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class cm extends nr{interpolate_(e,t,n,i){const r=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)r[m]=a[c+m]*g+a[l+m]*_;return r}const f=o*2,p=e-1;for(let _=0;_!==o;++_){const g=a[c+_],m=a[l+_],x=p*f+_*2,y=u[x],M=u[x+1],w=e*f+_*2,b=d[w],R=d[w+1];let v=(n-t)/(i-t),A,P,I,N,H;for(let W=0;W<8;W++){A=v*v,P=A*v,I=1-v,N=I*I,H=N*I;const B=H*t+3*N*v*y+3*I*A*b+P*i-n;if(Math.abs(B)<1e-10)break;const k=3*N*(y-t)+6*I*v*(b-y)+3*A*(i-b);if(Math.abs(k)<1e-10)break;v=v-B/k,v=Math.max(0,Math.min(1,v))}r[_]=H*g+3*N*v*M+3*I*A*R+P*m}return r}}class mn{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Ei(t,this.TimeBufferType),this.values=Ei(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:Ei(e.times,Array),values:Ei(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new lm(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new ed(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new om(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){const t=new cm(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.settings=this.settings),t}setInterpolation(e){let t;switch(e){case ca:t=this.InterpolantFactoryMethodDiscrete;break;case pl:t=this.InterpolantFactoryMethodLinear;break;case Fa:t=this.InterpolantFactoryMethodSmooth;break;case Ic: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 de("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ca;case this.InterpolantFactoryMethodLinear:return pl;case this.InterpolantFactoryMethodSmooth:return Fa;case this.InterpolantFactoryMethodBezier:return Ic}}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 r=0,a=i-1;for(;r!==i&&n[r]<e;)++r;for(;a!==-1&&n[a]>t;)--a;if(++a,r!==0||a!==i){r>=a&&(a=Math.max(a,1),r=a-1);const o=this.getValueSize();this.times=n.slice(r,a),this.values=this.values.slice(r*o,a*o)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(Pe("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,r=n.length;r===0&&(Pe("KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==r;o++){const l=n[o];
vendor: 13,386 bytes, line 9
9if(typeof l=="number"&&isNaN(l)){Pe("KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){Pe("KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(i!==void 0&&Cu(i))for(let o=0,l=i.length;o!==l;++o){const c=i[o];if(isNaN(c)){Pe("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()===Fa,r=e.length-1;let a=1;for(let o=1;o<r;++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(r>0){e[a]=e[r];for(let o=r*n,l=a*n,c=0;c!==n;++c)t[l+c]=t[o+c];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}mn.prototype.ValueTypeName="";mn.prototype.TimeBufferType=Float32Array;mn.prototype.ValueBufferType=Float32Array;mn.prototype.DefaultInterpolation=pl;class vs extends mn{constructor(e,t,n){super(e,t,n)}}vs.prototype.ValueTypeName="bool";vs.prototype.ValueBufferType=Array;vs.prototype.DefaultInterpolation=ca;vs.prototype.InterpolantFactoryMethodLinear=void 0;vs.prototype.InterpolantFactoryMethodSmooth=void 0;class td extends mn{constructor(e,t,n,i){super(e,t,n,i)}}td.prototype.ValueTypeName="color";class xa extends mn{constructor(e,t,n,i){super(e,t,n,i)}}xa.prototype.ValueTypeName="number";class hm extends nr{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(n-t)/(i-t);let c=e*o;for(let h=c+o;c!==h;c+=4)Zt.slerpFlat(r,0,a,c-o,a,c,l);return r}}class Ia extends mn{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new hm(this.times,this.values,this.getValueSize(),e)}}Ia.prototype.ValueTypeName="quaternion";Ia.prototype.InterpolantFactoryMethodSmooth=void 0;class ys extends mn{constructor(e,t,n){super(e,t,n)}}ys.prototype.ValueTypeName="string";ys.prototype.ValueBufferType=Array;ys.prototype.DefaultInterpolation=ca;ys.prototype.InterpolantFactoryMethodLinear=void 0;ys.prototype.InterpolantFactoryMethodSmooth=void 0;class va extends mn{constructor(e,t,n,i){super(e,t,n,i)}}va.prototype.ValueTypeName="vector";class ya{constructor(e="",t=-1,n=[],i=Dl){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=sn(),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(dm(n[a]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r.userData=JSON.parse(e.userData||"{}"),r}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 r=0,a=n.length;r!==a;++r)t.push(mn.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,a=[];for(let o=0;o<r;o++){let l=[],c=[];l.push((o+r-1)%r,o,(o+1)%r),c.push(0,1,0);const h=ju(l);l=yl(l,1,h),c=yl(c,1,h),!i&&l[0]===0&&(l.push(r),c.push(c[0])),a.push(new xa(".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={},r=/^([\w-]*?)([\d]+)$/;for(let o=0,l=e.length;o<l;o++){const c=e[o],h=c.name.match(r);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(de("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return Pe("AnimationClip: No animation in JSONLoader data."),null;const n=function(d,u,f,p,_){if(f.length!==0){const g=[],m=[];ac(f,g,m,p),g.length!==0&&_.push(new d(u,g,m))}},i=[],r=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 xa(".morphTargetInfluence["+_+"]",g,m))}l=f.length*a}else{const f=".bones["+t[d].name+"]";n(va,f+".position",u,"pos",i),n(Ia,f+".quaternion",u,"rot",i),n(va,f+".scale",u,"scl",i)}}return i.length===0?null:new this(r,l,i,o)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const r=this.tracks[n];t=Math.max(t,r.times[r.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){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 um(s){switch(s.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return xa;case"vector":case"vector2":case"vector3":case"vector4":return va;case"color":return td;case"quaternion":return Ia;case"bool":case"boolean":return vs;case"string":return ys}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+s)}function dm(s){if(s.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=um(s.type);if(s.times===void 0){const t=[],n=[];ac(s.keys,t,n,"value"),s.times=t,s.values=n}return e.parse!==void 0?e.parse(s):new e(s.name,s.times,s.values,s.interpolation)}const zn={enabled:!1,files:{},add:function(s,e){this.enabled!==!1&&(Sh(s)||(this.files[s]=e))},get:function(s){if(this.enabled!==!1&&!Sh(s))return this.files[s]},remove:function(s){delete this.files[s]},clear:function(){this.files={}}};function Sh(s){try{const e=s.slice(s.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}class nd{constructor(e,t,n){const i=this;let r=!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++,r===!1&&i.onStart!==void 0&&i.onStart(h,a,o),r=!0},this.itemEnd=function(h){a++,i.onProgress!==void 0&&i.onProgress(h,a,o),a===o&&(r=!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 fm=new nd;class rn{constructor(e){this.manager=e!==void 0?e:fm,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,r){n.load(e,i,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}rn.DEFAULT_MATERIAL_NAME="__DEFAULT";const Nn={};class pm extends Error{constructor(e,t){super(e),this.response=t}}class oi extends rn{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 r=zn.get(`file:${e}`);if(r!==void 0){this.manager.itemStart(e),setTimeout(()=>{t&&t(r),this.manager.itemEnd(e)},0);return}if(Nn[e]!==void 0){Nn[e].push({onLoad:t,onProgress:n,onError:i});return}Nn[e]=[],Nn[e].push({onLoad:t,onProgress:n,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&de("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const h=Nn[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 w=new ProgressEvent("progress",{lengthComputable:p,loaded:_,total:f});for(let b=0,R=h.length;b<R;b++){const v=h[b];v.onProgress&&v.onProgress(w)}m.enqueue(M),x()}},y=>{m.error(y)})}}});return new Response(g)}else throw new pm(`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=>{zn.add(`file:${e}`,c);const h=Nn[e];delete Nn[e];for(let d=0,u=h.length;d<u;d++){const f=h[d];f.onLoad&&f.onLoad(c)}}).catch(c=>{const h=Nn[e];if(h===void 0)throw this.manager.itemError(e),c;delete Nn[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 aM extends rn{constructor(e){super(e)}load(e,t,n,i){const r=this,a=new oi(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{t(r.parse(JSON.parse(o)))}catch(l){i?i(l):Pe(l),r.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=ya.parse(e[n]);t.push(i)}return t}}class oM extends rn{constructor(e){super(e)}load(e,t,n,i){const r=this,a=[],o=new Xl,l=new oi(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(r.withCredentials);let c=0;function h(d){l.load(e[d],function(u){const f=r.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=_t),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=r.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=_t),o.format=u.format,o.needsUpdate=!0,t&&t(o)},n,i);return o}}const ji=new WeakMap;class Ma extends rn{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=zn.get(`image:${e}`);if(a!==void 0){if(a.complete===!0)r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0);else{let d=ji.get(a);d===void 0&&(d=[],ji.set(a,d)),d.push({onLoad:t,onError:i})}return a}const o=Ys("img");function l(){h(),t&&t(this);const d=ji.get(this)||[];for(let u=0;u<d.length;u++){const f=d[u];f.onLoad&&f.onLoad(this)}ji.delete(this),r.manager.itemEnd(e)}function c(d){h(),i&&i(d),zn.remove(`image:${e}`);const u=ji.get(this)||[];for(let f=0;f<u.length;f++){const p=u[f];p.onError&&p.onError(d)}ji.delete(this),r.manager.itemError(e),r.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),zn.add(`image:${e}`,o),r.manager.itemStart(e),o.src=e,o}}class lM extends rn{constructor(e){super(e)}load(e,t,n,i){const r=new Aa;
vendor: 5,908 bytes, line 9
9r.colorSpace=jt;const a=new Ma(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let o=0;function l(c){a.load(e[c],function(h){r.images[c]=h,o++,o===6&&(r.needsUpdate=!0,t&&t(r))},void 0,i)}for(let c=0;c<e.length;++c)l(c);return r}}class cM extends rn{constructor(e){super(e)}load(e,t,n,i){const r=this,a=new An,o=new oi(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(r.withCredentials),o.load(e,function(l){let c;try{c=r.parse(l)}catch(h){i!==void 0?i(h):Pe(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:nn,a.wrapT=c.wrapT!==void 0?c.wrapT:nn,a.magFilter=c.magFilter!==void 0?c.magFilter:_t,a.minFilter=c.minFilter!==void 0?c.minFilter:_t,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=Bn),c.mipmapCount===1&&(a.minFilter=_t),c.generateMipmaps!==void 0&&(a.generateMipmaps=c.generateMipmaps),a.needsUpdate=!0,t&&t(a,c)},n,i),a}}class hM extends rn{constructor(e){super(e)}load(e,t,n,i){const r=new Mt,a=new Ma(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){r.image=o,r.needsUpdate=!0,t!==void 0&&t(r)},n,i),r}}class Ui extends ot{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new be(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 mm extends Ui{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(ot.DEFAULT_UP),this.updateMatrix(),this.groundColor=new be(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 go=new Ge,bh=new C,Th=new C;class oc{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=en,this.map=null,this.mapPass=null,this.matrix=new Ge,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new er,this._frameExtents=new K(1,1),this._viewportCount=1,this._viewports=[new dt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;bh.setFromMatrixPosition(e.matrixWorld),t.position.copy(bh),Th.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Th),t.updateMatrixWorld(),go.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(go,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(go)}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 Zt,yn=new C;class lc extends ot{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ge,this.projectionMatrix=new Ge,this.projectionMatrixInverse=new Ge,this.coordinateSystem=ln,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,yn),yn.x===1&&yn.y===1&&yn.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(zr,Vr,yn.set(1,1,1)).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorld.decompose(zr,Vr,yn),yn.x===1&&yn.y===1&&yn.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(zr,Vr,yn.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const ei=new C,Ah=new K,Eh=new K;class Ft extends lc{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(wi*.5*this.fov);return .5*this.getFilmHeight()/e}
vendor: 4,977 bytes, line 9
9getEffectiveFOV(){return fs*2*Math.atan(Math.tan(wi*.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){ei.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(ei.x,ei.y).multiplyScalar(-e/ei.z),ei.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(ei.x,ei.y).multiplyScalar(-e/ei.z)}getViewSize(e,t){return this.getViewBounds(e,Ah,Eh),t.subVectors(Eh,Ah)}setViewOffset(e,t,n,i,r,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=r,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(wi*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;r+=a.offsetX*i/l,t-=a.offsetY*n/c,i*=a.width/l,n*=a.height/c}const o=this.filmOffset;o!==0&&(r+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+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 gm extends oc{constructor(){super(new Ft(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,r=e.distance||t.far;(n!==t.fov||i!==t.aspect||r!==t.far)&&(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class _m extends Ui{constructor(e,t,n=0,i=Math.PI/3,r=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(ot.DEFAULT_UP),this.updateMatrix(),this.target=new ot,this.distance=n,this.angle=i,this.penumbra=r,this.decay=a,this.map=null,this.shadow=new gm}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 xm extends oc{constructor(){super(new Ft(90,1,.5,500)),this.isPointLightShadow=!0}}class vm extends Ui{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 xm}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 Pa extends lc{constructor(e=-1,t=1,n=1,i=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,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=r,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 r=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;r+=c*this.view.offsetX,a=r+c*this.view.width,o-=h*this.view.offsetY,l=o-h*this.view.height}
vendor: 20,960 bytes, line 9
9this.projectionMatrix.makeOrthographic(r,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 ym extends oc{constructor(){super(new Pa(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Mm extends Ui{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ot.DEFAULT_UP),this.updateMatrix(),this.target=new ot,this.shadow=new ym}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 Sm extends Ui{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class bm extends Ui{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 id{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,r=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*r),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],1.092548*(n*i)),t.addScaledVector(a[5],1.092548*(i*r)),t.addScaledVector(a[6],.315392*(3*r*r-1)),t.addScaledVector(a[7],1.092548*(n*r)),t.addScaledVector(a[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,r=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*r),t.addScaledVector(a[3],2*.511664*n),t.addScaledVector(a[4],2*.429043*n*i),t.addScaledVector(a[5],2*.429043*i*r),t.addScaledVector(a[6],.743125*r*r-.247708),t.addScaledVector(a[7],2*.429043*n*r),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,r=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*r,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*n*r,t[8]=.546274*(n*n-i*i)}}class Tm extends Ui{constructor(e=new id,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 cc extends rn{constructor(e){super(e),this.textures={}}load(e,t,n,i){const r=this,a=new oi(r.manager);a.setPath(r.path),a.setRequestHeader(r.requestHeader),a.setWithCredentials(r.withCredentials),a.load(e,function(o){try{t(r.parse(JSON.parse(o)))}catch(l){i?i(l):Pe(l),r.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(r){return t[r]===void 0&&de("MaterialLoader: Undefined texture",r),t[r]}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 be().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 r in e.uniforms){const a=e.uniforms[r];switch(i.uniforms[r]={},a.type){case"t":i.uniforms[r].value=n(a.value);break;case"c":i.uniforms[r].value=new be().setHex(a.value);break;case"v2":i.uniforms[r].value=new K().fromArray(a.value);break;case"v3":i.uniforms[r].value=new C().fromArray(a.value);break;case"v4":i.uniforms[r].value=new dt().fromArray(a.value);break;case"m3":i.uniforms[r].value=new qe().fromArray(a.value);break;case"m4":i.uniforms[r].value=new Ge().fromArray(a.value);break;default:i.uniforms[r].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 r in e.extensions)i.extensions[r]=e.extensions[r];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 r=e.normalScale;Array.isArray(r)===!1&&(r=[r,r]),i.normalScale=new K().fromArray(r)}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 cc.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:Yp,SpriteMaterial:Uu,RawShaderMaterial:Ju,ShaderMaterial:pn,PointsMaterial:Ou,MeshPhysicalMaterial:Qp,MeshStandardMaterial:$u,MeshPhongMaterial:jp,MeshToonMaterial:em,MeshNormalMaterial:tm,MeshLambertMaterial:nm,MeshDepthMaterial:Ku,MeshDistanceMaterial:Qu,MeshBasicMaterial:Li,MeshMatcapMaterial:im,LineDashedMaterial:sm,LineBasicMaterial:Jt,Material:Gt};return new t[e]}}class wh{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Am extends Ye{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 Em extends rn{constructor(e){super(e)}load(e,t,n,i){const r=this,a=new oi(r.manager);a.setPath(r.path),a.setRequestHeader(r.requestHeader),a.setWithCredentials(r.withCredentials),a.load(e,function(o){try{t(r.parse(JSON.parse(o)))}catch(l){i?i(l):Pe(l),r.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=r(f,g.buffer),x=os(g.type,m),y=new Gl(x,g.stride);return y.uuid=g.uuid,t[p]=y,y}function r(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 Am:new Ye,o=e.data.index;if(o!==void 0){const f=os(o.type,o.array);a.setIndex(new mt(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=os(p.type,p.array),m=p.isInstancedBufferAttribute?Zs:mt;_=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=os(x.type,x.array);y=new mt(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 Ot().fromJSON(u)),e.name&&(a.name=e.name),e.userData&&(a.userData=e.userData),a}}const _o={};class uM extends rn{constructor(e){super(e)}load(e,t,n,i){const r=this,a=this.path===""?wh.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;const o=new oi(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),Pe("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)),Pe("ObjectLoader: Can't load "+e);return}r.parse(c,t)},n,i)}async loadAsync(e,t){const n=this,i=this.path===""?wh.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const r=new oi(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials);const a=await r.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),r=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,r,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),r=await this.parseImagesAsync(e.images),a=this.parseTextures(e.textures,r),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}static registerGeometry(e,t){_o[e]=t}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const r=new hs().fromJSON(e[n]);t[r.uuid]=r}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(r){r.isBone&&(i[r.uuid]=r)}),e!==void 0)for(let r=0,a=e.length;r<a;r++){const o=new Hl().fromJSON(e[r],i);n[o.uuid]=o}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new Em;for(let r=0,a=e.length;r<a;r++){let o;const l=e[r];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":o=i.parse(l);break;default:l.type in yh?o=yh[l.type].fromJSON(l,t):l.type in _o?o=_o[l.type].fromJSON(l,t):de(`ObjectLoader: Unknown geometry type "${l.type}". Use .registerGeometry() before starting the deserialization process.`)}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 r=new cc;r.setTextures(t);for(let a=0,o=e.length;a<o;a++){const l=e[a];n[l.uuid]===void 0&&(n[l.uuid]=r.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],r=ya.parse(i);t[r.uuid]=r}return t}parseImages(e,t){const n=this,i={};let r;function a(l){return n.manager.itemStart(l),r.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:os(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new nd(t);r=new Ma(l),r.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 An(m.data,m.width,m.height)))}i[d.uuid]=new Ai(f)}else{const f=o(d.url);i[d.uuid]=new Ai(f)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function r(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:os(a.type,a.data),width:a.width,height:a.height}:null}if(e!==void 0&&e.length>0){i=new Ma(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 r(f);p!==null&&(p instanceof HTMLImageElement?h.push(p):h.push(new An(p.data,p.width,p.height)))}n[l.uuid]=new Ai(h)}else{const h=await r(l.url);n[l.uuid]=new Ai(h)}}}return n}parseTextures(e,t){function n(r,a){return typeof r=="number"?r:(de("ObjectLoader.parseTexture: Constant should be in numeric form.",r),a[r])}const i={};if(e!==void 0)for(let r=0,a=e.length;r<a;r++){const o=e[r];o.image===void 0&&de('ObjectLoader: No "image" specified for',o.uuid),t[o.image]===void 0&&de("ObjectLoader: Undefined image",o.image);const l=t[o.image],c=l.data;let h;Array.isArray(c)?(h=new Aa,c.length===6&&(h.needsUpdate=!0)):(c&&c.data?h=new An:h=new Mt,c&&(h.needsUpdate=!0)),h.source=l,h.uuid=o.uuid,o.name!==void 0&&(h.name=o.name),o.mapping!==void 0&&(h.mapping=n(o.mapping,wm)),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],Ch),h.wrapT=n(o.wrap[1],Ch)),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,548 bytes, line 9
9=o.colorSpace),o.minFilter!==void 0&&(h.minFilter=n(o.minFilter,Rh)),o.magFilter!==void 0&&(h.magFilter=n(o.magFilter,Rh)),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.normalized!==void 0&&(h.normalized=o.normalized),o.userData!==void 0&&(h.userData=o.userData),i[o.uuid]=h}return i}parseObject(e,t,n,i,r){let a;function o(u){return t[u]===void 0&&de("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&&de("ObjectLoader: Undefined material",g),f.push(n[g])}return f}return n[u]===void 0&&de("ObjectLoader: Undefined material",u),n[u]}}function c(u){return i[u]===void 0&&de("ObjectLoader: Undefined texture",u),i[u]}let h,d;switch(e.type){case"Scene":a=new Of,e.background!==void 0&&(Number.isInteger(e.background)?a.background=new be(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 kl(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(a.fog=new Vl(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 Ft(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 Pa(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 Sm(e.color,e.intensity);break;case"DirectionalLight":a=new Mm(e.color,e.intensity),a.target=e.target||"";break;case"PointLight":a=new vm(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new bm(e.color,e.intensity,e.width,e.height);break;case"SpotLight":a=new _m(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),a.target=e.target||"";break;case"HemisphereLight":a=new mm(e.color,e.groundColor,e.intensity);break;case"LightProbe":const u=new id().fromArray(e.sh);a=new Tm(u,e.intensity);break;case"SkinnedMesh":h=o(e.geometry),d=l(e.material),a=new Yf(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 Ct(h,d);break;case"InstancedMesh":h=o(e.geometry),d=l(e.material);const f=e.count,p=e.instanceMatrix,_=e.instanceColor;a=new $f(h,d,f),a.instanceMatrix=new Zs(new Float32Array(p.array),16),_!==void 0&&(a.instanceColor=new Zs(new Float32Array(_.array),_.itemSize));break;case"BatchedMesh":h=o(e.geometry),d=l(e.material),a=new op(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 kt().fromJSON(g.boundingBox)),g.boundingSphere!==void 0&&(x=new Ot().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 Ot().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(a.boundingBox=new kt().fromJSON(e.boundingBox));break;case"LOD":a=new Wf;break;case"Line":a=new Ii(o(e.geometry),l(e.material));break;case"LineLoop":a=new lp(o(e.geometry),l(e.material));break;case"LineSegments":a=new Xn(o(e.geometry),l(e.material));break;case"PointCloud":case"Points":a=new cp(o(e.geometry),l(e.material));break;case"Sprite":a=new Hf(l(e.material));break;case"Group":a=new Bs;break;case"Bone":a=new Fu;break;default:a=new ot}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
9),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,r))}if(e.animations!==void 0){const u=e.animations;for(let f=0;f<u.length;f++){const p=u[f];a.animations.push(r[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?de("ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(i,n.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const n=t.target,i=e.getObjectByProperty("uuid",n);i!==void 0?t.target=i:t.target=new ot}})}}const wm={UVMapping:El,CubeReflectionMapping:Gn,CubeRefractionMapping:Ci,EquirectangularReflectionMapping:Kr,EquirectangularRefractionMapping:Qr,CubeUVReflectionMapping:Qs},Ch={RepeatWrapping:ra,ClampToEdgeWrapping:nn,MirroredRepeatWrapping:aa},Rh={NearestFilter:wt,NearestMipmapNearestFilter:yu,NearestMipmapLinearFilter:Os,LinearFilter:_t,LinearMipmapNearestFilter:jr,LinearMipmapLinearFilter:Bn},xo=new WeakMap;class dM extends rn{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&de("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&de("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,a=zn.get(`image-bitmap:${e}`);if(a!==void 0){if(r.manager.itemStart(e),a.then){a.then(c=>{xo.has(a)===!0?(i&&i(xo.get(a)),r.manager.itemError(e),r.manager.itemEnd(e)):(t&&t(c),r.manager.itemEnd(e))});return}setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0);return}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(r.options,{colorSpaceConversion:"none"}))}).then(function(c){zn.add(`image-bitmap:${e}`,c),t&&t(c),r.manager.itemEnd(e)}).catch(function(c){i&&i(c),xo.set(l,c),zn.remove(`image-bitmap:${e}`),r.manager.itemError(e),r.manager.itemEnd(e)});zn.add(`image-bitmap:${e}`,l),r.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let kr;class sd{static getContext(){return kr===void 0&&(kr=new(window.AudioContext||window.webkitAudioContext)),kr}static setContext(e){kr=e}}class fM extends rn{constructor(e){super(e)}load(e,t,n,i){const r=this,a=new oi(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),h=sd.getContext(),d=e+"#decode";r.manager.itemStart(d),h.decodeAudioData(c,function(u){t(u),r.manager.itemEnd(d)}).catch(function(u){o(u),r.manager.itemEnd(d)})}catch(c){o(c)}},n,i);function o(l){i?i(l):Pe(l),r.manager.itemError(e)}}}const Ih=new Ge,Ph=new Ge,mi=new Ge;class pM{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Ft,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Ft,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,mi.copy(e.projectionMatrix);const i=t.eyeSep/2,r=i*t.near/t.focus,a=t.near*Math.tan(wi*t.fov*.5)/t.zoom;let o,l;Ph.elements[12]=-i,Ih.elements[12]=i,o=-a*t.aspect+r,l=a*t.aspect+r,mi.elements[0]=2*t.near/(l-o),mi.elements[8]=(l+o)/(l-o),this.cameraL.projectionMatrix.copy(mi),o=-a*t.aspect-r,l=a*t.aspect-r,mi.elements[0]=2*t.near/(l-o),mi.elements[8]=(l+o)/(l-o),this.cameraR.projectionMatrix.copy(mi)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Ph),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Ih)}}const es=-90,ts=1;class Cm extends ot{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Ft(es,ts,e,t);i.layers=this.layers,this.add(i);const r=new Ft(es,ts,e,t);r.layers=this.layers,this.add(r);const a=new Ft(es,ts,e,t);a.layers=this.layers,this.add(a);const o=new Ft(es,ts,e,t);o.layers=this.layers,this.add(o);const l=new Ft(es,ts,e,t);l.layers=this.layers,this.add(l);const c=new Ft(es,ts,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,r,a,o,l]=t;for(const c of t)this.remove(c);if(e===ln)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.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),r.up.set(0,0,1),r.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[r,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,r),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 Rm extends Ft{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Im{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=Pm.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 Pm(){this._document.hidden===!1&&this.reset()}const gi=new C,vo=new Zt,Lm=new C,_i=new C,xi=new C;class mM extends ot{constructor(){super(),this.type="AudioListener",this.context=sd.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new Im}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 9
9);const t=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(gi,vo,Lm),_i.set(0,0,-1).applyQuaternion(vo),xi.set(0,1,0).applyQuaternion(vo),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(gi.x,n),t.positionY.linearRampToValueAtTime(gi.y,n),t.positionZ.linearRampToValueAtTime(gi.z,n),t.forwardX.linearRampToValueAtTime(_i.x,n),t.forwardY.linearRampToValueAtTime(_i.y,n),t.forwardZ.linearRampToValueAtTime(_i.z,n),t.upX.linearRampToValueAtTime(xi.x,n),t.upY.linearRampToValueAtTime(xi.y,n),t.upZ.linearRampToValueAtTime(xi.z,n)}else t.setPosition(gi.x,gi.y,gi.z),t.setOrientation(_i.x,_i.y,_i.z,xi.x,xi.y,xi.z)}}class Dm extends ot{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){de("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){de("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){de("Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){de("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){de("Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}
vendor: 29,621 bytes, line 9
9getLoop(){return this.hasPlaybackControl===!1?(de("Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){de("Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}copy(e,t){return super.copy(e,t),e.sourceType!=="buffer"?(de("Audio: Audio source type cannot be copied."),this):(this.autoplay=e.autoplay,this.buffer=e.buffer,this.detune=e.detune,this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.offset=e.offset,this.duration=e.duration,this.playbackRate=e.playbackRate,this.hasPlaybackControl=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice(),this)}clone(e){return new this.constructor(this.listener).copy(this,e)}}const vi=new C,Lh=new Zt,Um=new C,yi=new C;class gM extends Dm{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(vi,Lh,Um),yi.set(0,0,1).applyQuaternion(Lh);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(vi.x,n),t.positionY.linearRampToValueAtTime(vi.y,n),t.positionZ.linearRampToValueAtTime(vi.z,n),t.orientationX.linearRampToValueAtTime(yi.x,n),t.orientationY.linearRampToValueAtTime(yi.y,n),t.orientationZ.linearRampToValueAtTime(yi.z,n)}else t.setPosition(vi.x,vi.y,vi.z),t.setOrientation(yi.x,yi.y,yi.z)}}class _M{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 Nm{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,r,a;switch(t){case"quaternion":i=this._slerp,r=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,r=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,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,r=e*i+i;let a=this.cumulativeWeight;if(a===0){for(let o=0;o!==i;++o)n[r+o]=n[o];a=t}else{a+=t;const o=t/a;this._mixBufferRegion(n,r,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,r=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const l=t*this._origIndex;this._mixBufferRegion(n,i,l,1-r,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 r=n,a=i;r!==a;++r)t[r]=t[i+r%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,r){if(i>=.5)for(let a=0;a!==r;++a)e[t+a]=e[n+a]}_slerp(e,t,n,i){Zt.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){const a=this._workIndex*r;Zt.multiplyQuaternionsFlat(e,a,e,t,e,n),Zt.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,n,i,r){const a=1-i;for(let o=0;o!==r;++o){const l=t+o;e[l]=e[l]*a+e[n+o]*i}}_lerpAdditive(e,t,n,i,r){for(let a=0;a!==r;++a){const o=t+a;e[o]=e[o]+e[n+a]*i}}}const hc="\\[\\]\\.:\\/",Fm=new RegExp("["+hc+"]","g"),uc="[^"+hc+"]",Om="[^"+hc.replace("\\.","")+"]",Bm=/((?:WC+[\/:])*)/.source.replace("WC",uc),zm=/(WCOD+)?/.source.replace("WCOD",Om),Vm=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",uc),km=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",uc),Gm=new RegExp("^"+Bm+zm+Vm+km+"$"),Hm=["material","materials","bones","map"];class Wm{constructor(e,t,n){const i=n||at.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_,r=n.length;i!==r;++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 at{constructor(e,t,n){this.path=t,this.parsedPath=n||at.parseTrackName(t),this.node=at.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 at.Composite(e,t,n):new at(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Fm,"")}static parseTrackName(e){const t=Gm.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 r=n.nodeName.substring(i+1);Hm.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}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(r){for(let a=0;a<r.length;a++){const o=r[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,r=n.length;i!==r;++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,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let r=t.propertyIndex;if(e||(e=at.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){de("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){Pe("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Pe("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){Pe("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){Pe("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Pe("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){Pe("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){Pe("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;Pe("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(r!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){Pe("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Pe("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[r]!==void 0&&(r=e.morphTargetDictionary[r])}l=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}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}}at.Composite=Wm;at.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};at.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};at.prototype.GetterByBindingType=[at.prototype._getValue_direct,at.prototype._getValue_array,at.prototype._getValue_arrayElement,at.prototype._getValue_toArray];at.prototype.SetterByBindingTypeAndVersioning=[[at.prototype._setValue_direct,at.prototype._setValue_direct_setNeedsUpdate,at.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[at.prototype._setValue_array,at.prototype._setValue_array_setNeedsUpdate,at.prototype._setValue_array_setMatrixWorldNeedsUpdate],[at.prototype._setValue_arrayElement,at.prototype._setValue_arrayElement_setNeedsUpdate,at.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[at.prototype._setValue_fromArray,at.prototype._setValue_fromArray_setNeedsUpdate,at.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class xM{constructor(){this.isAnimationObjectGroup=!0,this.uuid=sn(),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,r=this._bindings,a=r.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;++_)r[_].push(new at(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;m!==x;++m){const y=r[m],M=y[_];let w=y[p];y[p]=M,w===void 0&&(w=new at(u,n[m],i[m])),y[_]=w}}else e[p]!==o&&Pe("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 r=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>=r){const d=r++,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_=r}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=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<r){const u=--r,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_=r}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const r=this._bindings;if(i!==void 0)return r[i];const a=this._paths,o=this._parsedPaths,l=this._objects,c=l.length,h=this.nCachedObjects_,d=new Array(c);i=r.length,n[e]=i,a.push(e),o.push(t),r.push(d);for(let u=h,f=l.length;u!==f;++u){const p=l[u];d[u]=new at(p,e,t)}return d}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,r=this._parsedPaths,a=this._bindings,o=a.length-1,l=a[o],c=e[o];t[c]=n,a[n]=l,a.pop(),r[n]=r[o],r.pop(),i[n]=i[o],i.pop()}}}class Xm{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const r=t.tracks,a=r.length,o=new Array(a),l={endingStart:rs,endingEnd:rs};for(let c=0;c!==a;++c){const h=r[c].createInterpolant(null);o[c]=h,h.settings&&Object.assign(l,h.settings),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=Zd,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,r=e._clip.duration,a=r/i,o=i/r;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,r=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]=r,l[1]=r+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 r=this._startTime;if(r!==null){const l=(e-r)*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 wu:for(let h=0,d=l.length;h!==d;++h)l[h].evaluate(a),c[h].accumulateAdditive(o);break;case Dl: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,r=this._loopCount;const a=n===Jd;if(e===0)return r===-1?i:a&&(r&1)===1?t-i:i;if(n===Yd){r===-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(r===-1&&(e>=0?(r=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,r+=Math.abs(o);const l=this.repetitions-r;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=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this._loopCount=r,this.time=i;if(a&&(r&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=as,i.endingEnd=as):(e?i.endingStart=this.zeroSlopeAtStart?as:rs:i.endingStart=ha,t?i.endingEnd=this.zeroSlopeAtEnd?as:rs:i.endingEnd=ha)}_scheduleFading(e,t,n){const i=this._mixer,r=i.time;let a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=r,l[0]=t,o[1]=r+e,l[1]=n,this}}const qm=new Float32Array(1);class vM extends wn{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,r=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!==r;++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 Nm(at.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,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];r.useCount++===0&&(this._lendBinding(r),r.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 r=t[n];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}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,r=this._actionsByClip;let a=r[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[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 r=e._clip.uuid,a=this._actionsByClip,o=a[r],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[r],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];--r.referenceCount===0&&this._removeInactiveBinding(r)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,r=this._bindings;let a=i[t];a===void 0&&(a={},i[t]=a),a[n]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=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[r],Object.keys(o).length===0&&delete a[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new ed(new Float32Array(2),new Float32Array(2),1,qm),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r}clipAction(e,t,n){const i=t||this._root,r=i.uuid;let a=typeof e=="string"?ya.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=Dl),l!==void 0){const d=l.actionByRoot[r];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 Xm(this,a,t,n);return this._bindAction(h,c),this._addInactiveAction(h,o,r),h}existingAction(e,t){const n=t||this._root,i=n.uuid,r=typeof e=="string"?ya.findByName(n,e):e,a=r?r.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,r=Math.sign(e),a=this._accuIndex^=1;for(let c=0;c!==n;++c)t[c]._update(i,e,r,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,r=i[n];if(r!==void 0){const a=r.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,r=i[t];if(r!==void 0)for(const a in r){const o=r[a];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class yM extends Iu{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isRenderTarget3D=!0,this.depth=n,this.texture=new Bl(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class rd{constructor(e){this.value=e}clone(){return new rd(this.value.clone===void 0?this.value:this.value.clone())}}let Ym=0;class MM extends wn{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:Ym++}),this.name="",this.usage=fa,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 r=Array.isArray(t[n])?t[n]:[t[n]];for(let a=0;a<r.length;a++)this.uniforms.push(r[a].clone())}return this}clone(){return new this.constructor().copy(this)}}class SM extends Gl{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 bM{constructor(e,t,n,i,r,a=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=r,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 Dh=new Ge;class TM{constructor(e,t,n=0,i=1/0){this.ray=new js(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new zl,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):Pe("Raycaster: 
9Unsupported camera type: "+t.type)}setFromXRController(e){return Dh.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Dh),this}intersectObject(e,t=!0,n=[]){return Ml(e,this,n,t),n.sort(Uh),n}intersectObjects(e,t=!0,n=[]){for(let i=0,r=e.length;i<r;i++)Ml(e[i],this,n,t);return n.sort(Uh),n}}function Uh(s,e){return s.distance-e.distance}function Ml(s,e,t,n){let i=!0;if(s.layers.test(e.layers)&&s.raycast(e,t)===!1&&(i=!1),i===!0&&n===!0){const r=s.children;for(let a=0,o=r.length;a<o;a++)Ml(r[a],e,t,!0)}}class AM{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,de("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 EM{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=Oe(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(Oe(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class wM{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)}}const gc=class gc{constructor(e,t,n,i){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 r=this.elements;return r[0]=e,r[2]=t,r[1]=n,r[3]=i,this}};gc.prototype.isMatrix2=!0;let Nh=gc;const Fh=new K;class CM{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=Fh.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,Fh).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 Oh=new C,Gr=new C,ns=new C,is=new C,yo=new C,Zm=new C,Jm=new C;class RM{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){Oh.subVectors(e,this.start),Gr.subVectors(this.end,this.start);const n=Gr.dot(Gr);if(n===0)return 0;let r=Gr.dot(Oh)/n;return t&&(r=Oe(r,0,1)),r}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}
vendor: 4,916 bytes, line 9
9distanceSqToLine3(e,t=Zm,n=Jm){const i=10000000000000001e-32;let r,a;const o=this.start,l=e.start,c=this.end,h=e.end;ns.subVectors(c,o),is.subVectors(h,l),yo.subVectors(o,l);const d=ns.dot(ns),u=is.dot(is),f=is.dot(yo);if(d<=i&&u<=i)return t.copy(o),n.copy(l),t.sub(n),t.dot(t);if(d<=i)r=0,a=f/u,a=Oe(a,0,1);else{const p=ns.dot(yo);if(u<=i)a=0,r=Oe(-p/d,0,1);else{const _=ns.dot(is),g=d*u-_*_;g!==0?r=Oe((_*f-p*u)/g,0,1):r=0,a=(_*r+f)/u,a<0?(a=0,r=Oe(-p/d,0,1)):a>1&&(a=1,r=Oe((_-p)/d,0,1))}}return t.copy(o).addScaledVector(ns,r),n.copy(l).addScaledVector(is,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 Bh=new C;class IM extends ot{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new Ye,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 we(i,3));const r=new Jt({fog:!1,toneMapped:!1});this.cone=new Xn(n,r),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),Bh.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Bh),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const ti=new C,Hr=new Ge,Mo=new Ge;class PM extends Xn{constructor(e){const t=ad(e),n=new Ye,i=[],r=[];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),r.push(0,0,0),r.push(0,0,0))}n.setAttribute("position",new we(i,3)),n.setAttribute("color",new we(r,3));const a=new Jt({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 be(255),l=new be(65280);this.setColors(o,l)}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");Mo.copy(this.root.matrixWorld).invert();for(let r=0,a=0;r<t.length;r++){const o=t[r];o.parent&&o.parent.isBone&&(Hr.multiplyMatrices(Mo,o.matrixWorld),ti.setFromMatrixPosition(Hr),i.setXYZ(a,ti.x,ti.y,ti.z),Hr.multiplyMatrices(Mo,o.parent.matrixWorld),ti.setFromMatrixPosition(Hr),i.setXYZ(a+1,ti.x,ti.y,ti.z),a+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}setColors(e,t){const i=this.geometry.getAttribute("color");for(let r=0;r<i.count;r+=2)i.setXYZ(r,e.r,e.g,e.b),i.setXYZ(r+1,t.r,t.g,t.b);return i.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}function ad(s){const e=[];s.isBone===!0&&e.push(s);for(let t=0;t<s.children.length;t++)e.push(...ad(s.children[t]));return e}class LM extends Ct{constructor(e,t,n){const i=new Ra(t,4,2),r=new Li({wireframe:!0,fog:!1,toneMapped:!1});super(i,r),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 $m=new C,zh=new be,Vh=new be;class DM extends ot{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new Ca(t);i.rotateY(Math.PI*.5),this.material=new Li({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),a=new Float32Array(r.count*3);i.setAttribute("color",new mt(a,3)),this.add(new Ct(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");zh.copy(this.light.color),Vh.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const r=n<i/2?zh:Vh;t.setXYZ(n,r.r,r.g,r.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt($m.setFromMatrixPosition(this.light.matrixWorld).negate())}}class UM extends Xn{constructor(e=10,t=10,n=4473924,i=8947848){n=new be(n),i=new be(i);const r=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 9
9u++,p+=a){l.push(-o,0,p,o,0,p),l.push(p,0,-o,p,0,o);const _=u===r?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 Ye;h.setAttribute("position",new we(l,3)),h.setAttribute("color",new we(c,3));const d=new Jt({vertexColors:!0,toneMapped:!1});super(h,d),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class NM extends Xn{constructor(e=10,t=16,n=8,i=64,r=4473924,a=8947848){r=new be(r),a=new be(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?r:a;l.push(_.r,_.g,_.b),l.push(_.r,_.g,_.b)}for(let d=0;d<n;d++){const u=d&1?r: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 Ye;c.setAttribute("position",new we(o,3)),c.setAttribute("color",new we(l,3));const h=new Jt({vertexColors:!0,toneMapped:!1});super(c,h),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const kh=new C,Wr=new C,Gh=new C;class FM extends ot{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 Ye;i.setAttribute("position",new we([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const r=new Jt({fog:!1,toneMapped:!1});this.lightPlane=new Ii(i,r),this.add(this.lightPlane),i=new Ye,i.setAttribute("position",new we([0,0,0,0,0,1],3)),this.targetLine=new Ii(i,r),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),kh.setFromMatrixPosition(this.light.matrixWorld),Wr.setFromMatrixPosition(this.light.target.matrixWorld),Gh.subVectors(Wr,kh),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=Gh.length()}}const Xr=new C,yt=new lc;class OM extends Xn{constructor(e){const t=new Ye,n=new Jt({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],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(_)}
vendor: 11,810 bytes, line 9
9function l(p){i.push(0,0,0),r.push(0,0,0),a[p]===void 0&&(a[p]=[]),a[p].push(i.length/3-1)}t.setAttribute("position",new we(i,3)),t.setAttribute("color",new we(r,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 be(16755200),h=new be(16711680),d=new be(43775),u=new be(16777215),f=new be(3355443);this.setColors(c,h,d,u,f)}setColors(e,t,n,i,r){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,r.r,r.g,r.b),o.setXYZ(41,r.r,r.g,r.b),o.setXYZ(42,r.r,r.g,r.b),o.setXYZ(43,r.r,r.g,r.b),o.setXYZ(44,r.r,r.g,r.b),o.setXYZ(45,r.r,r.g,r.b),o.setXYZ(46,r.r,r.g,r.b),o.setXYZ(47,r.r,r.g,r.b),o.setXYZ(48,r.r,r.g,r.b),o.setXYZ(49,r.r,r.g,r.b),o.needsUpdate=!0,this}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;let r,a;if(yt.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)r=1,a=0;else if(this.camera.coordinateSystem===ln)r=-1,a=1;else if(this.camera.coordinateSystem===ds)r=0,a=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);At("c",t,e,yt,0,0,r),At("t",t,e,yt,0,0,a),At("n1",t,e,yt,-n,-i,r),At("n2",t,e,yt,n,-i,r),At("n3",t,e,yt,-n,i,r),At("n4",t,e,yt,n,i,r),At("f1",t,e,yt,-n,-i,a),At("f2",t,e,yt,n,-i,a),At("f3",t,e,yt,-n,i,a),At("f4",t,e,yt,n,i,a),At("u1",t,e,yt,n*.7,i*1.1,r),At("u2",t,e,yt,-n*.7,i*1.1,r),At("u3",t,e,yt,0,i*2,r),At("cf1",t,e,yt,-n,0,a),At("cf2",t,e,yt,n,0,a),At("cf3",t,e,yt,0,-i,a),At("cf4",t,e,yt,0,i,a),At("cn1",t,e,yt,-n,0,r),At("cn2",t,e,yt,n,0,r),At("cn3",t,e,yt,0,-i,r),At("cn4",t,e,yt,0,i,r),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function At(s,e,t,n,i,r,a){Xr.set(i,r,a).unproject(n);const o=e[s];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 kt;class BM extends Xn{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(8*3),r=new Ye;r.setIndex(new mt(n,1)),r.setAttribute("position",new mt(i,3)),super(r,new Jt({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 zM extends Xn{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],r=new Ye;r.setIndex(new mt(n,1)),r.setAttribute("position",new we(i,3)),super(r,new Jt({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 VM extends Ii{constructor(e,t=1,n=16776960){const i=n,r=[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 Ye;a.setAttribute("position",new we(r,3)),a.computeBoundingSphere(),super(a,new Jt({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 Ye;l.setAttribute("position",new we(o,3)),l.computeBoundingSphere(),this.add(new Ct(l,new Li({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 Hh=new C;let Yr,So;class kM extends ot{constructor(e=new C(0,0,1),t=new C(0,0,0),n=1,i=16776960,r=n*.2,a=r*.2){super(),this.type="ArrowHelper",Yr===void 0&&(Yr=new Ye,Yr.setAttribute("position",new we([0,0,0,0,1,0],3)),So=new wa(.5,1,5,1),So.translate(0,-.5,0)),this.position.copy(t),this.line=new Ii(Yr,new Jt({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Ct(So,new Li({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,r,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{Hh.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Hh,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 GM extends Xn{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 Ye;i.setAttribute("position",new we(t,3)),i.setAttribute("color",new we(n,3));const r=new Jt({vertexColors:!0,toneMapped:!1});super(i,r),this.type="AxesHelper"}setColors(e,t,n){const i=new be,r=this.geometry.attributes.color.array;return i.set(e),i.toArray(r,0),i.toArray(r,3),i.set(t),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class HM{constructor(){this.type="ShapePath",this.color=new be,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new _l,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,r,a){return this.currentPath.bezierCurveTo(e,t,n,i,r,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 w=m[y],b=new hs;b.curves=w.curves,x.push(b)}return x}function n(m,x){const y=x.length;let M=!1;for(let w=y-1,b=0;b<y;w=b++){let R=x[w],v=x[b],A=v.x-R.x,P=v.y-R.y;if(Math.abs(P)>Number.EPSILON){if(P<0&&(R=x[b],A=-A,v=x[w],P=-P),m.y<R.y||m.y>v.y)continue;if(m.y===R.y){if(m.x===R.x)return!0}else{const I=P*(m.x-R.x)-A*(m.y-R.y);if(I===0)return!0;if(I<0)continue;M=!M}}else{if(m.y!==R.y)continue;if(v.x<=m.x&&m.x<=R.x||R.x<=m.x&&m.x<=v.x)return!0}}return M}const i=bn.isClockWise,r=this.subPaths;if(r.length===0)return[];let a,o,l;const c=[];if(r.length===1)return o=r[0],l=new hs,l.curves=o.curves,c.push(l),c;let h=!i(r[0].getPoints());h=e?!h:h;const d=[],u=[];let f=[],p=0,_;u[p]=void 0,f[p]=[];for(let m=0,x=r.length;m<x;m++)o=r[m],_=o.getPoints(),a=i(_),a=e?!a:a,a?(!h&&u[p]&&p++,u[p]={s:new hs,p:_},u[p].s.curves=o.curves,h&&p++,f[p]=[]):f[p].push({h:o,p:_[0]});if(!u[0])return t(r);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 w=f[y];for(let b=0;b<w.length;b++){const R=w[b];let v=!0;for(let A=0;A<u.length;A++)n(R.p,u[A].p)&&(y!==A&&x++,v?(v=!1,d[A].push(R)):m=!0);v&&d[y].push(R)}}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 WM extends wn{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){de("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function Km(s,e){const t=s.image&&s.image.width?s.image.width/s.image.height:1;return t>e?(s.repeat.x=1,s.repeat.y=t/e,s.offset.x=0,s.offset.y=(1-s.repeat.y)/2):(s.repeat.x=e/t,s.repeat.y=1,s.offset.x=(1-s.repeat.x)/2,s.offset.y=0),s}function Qm(s,e){const t=s.image&&s.image.width?s.image.width/s.image.height:1;return t>e?(s.repeat.x=e/t,s.repeat.y=1,s.offset.x=(1-s.repeat.x)/2,s.offset.y=0):(s.repeat.x=1,s.repeat.y=t/e,s.offset.x=0,s.offset.y=(1-s.repeat.y)/2),s}function jm(s){return s.repeat.x=1,s.repeat.y=1,s.offset.x=0,s.offset.y=0,s}function Sl(s,e,t,n){const i=eg(n);switch(t){case Au:return s*e;case Il:return s*e/i.components*i.byteLength;case Ta:return s*e/i.components*i.byteLength;case Ri:return s*e*2/i.components*i.byteLength;case Pl:return s*e*2/i.components*i.byteLength;case Eu:return s*e*3/i.components*i.byteLength;case qt:return s*e*4/i.components*i.byteLength;case Ll:return s*e*4/i.components*i.byteLength;case ea:case ta:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*8;case na:case ia:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case zo:case ko:return Math.max(s,16)*Math.max(e,8)/4;case Bo:case Vo:return Math.max(s,8)*Math.max(e,8)/2;case Go:case Ho:case Xo:case qo:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*8;case Wo:case oa:case Yo:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case Zo:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case Jo:return Math.floor((s+4)/5)*Math.floor((e+3)/4)*16;case $o:return Math.floor((s+4)/5)*Math.floor((e+4)/5)*16;case Ko:return Math.floor((s+5)/6)*Math.floor((e+4)/5)*16;case Qo:return Math.floor((s+5)/6)*Math.floor((e+5)/6)*16;case jo:return Math.floor((s+7)/8)*Math.floor((e+4)/5)*16;case el:return Math.floor((s+7)/8)*Math.floor((e+5)/6)*16;case tl:return Math.floor((s+7)/8)*Math.floor((e+7)/8)*16;case nl:return Math.floor((s+9)/10)*Math.floor((e+4)/5)*16;case il:return Math.floor((s+9)/10)*Math.floor((e+5)/6)*16;case sl:return Math.floor((s+9)/10)*Math.floor((e+7)/8)*16;case rl:return Math.floor((s+9)/10)*Math.floor((e+9)/10)*16;case al:return Math.floor((s+11)/12)*Math.floor((e+9)/10)*16;case ol:return Math.floor((s+11)/12)*Math.floor((e+11)/12)*16;case ll:case cl:case hl:return Math.ceil(s/4)*Math.ceil(e/4)*16;case ul:case dl:return Math.ceil(s/4)*Math.ceil(e/4)*8;case la:case fl:return Math.ceil(s/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}
vendor: 5,329 bytes, lines 9-72
9function eg(s){switch(s){case en:case Mu:return{byteLength:1,components:1};case Xs:case Su:case Hn:return{byteLength:2,components:1};case Cl:case Rl:return{byteLength:2,components:4};case fn:case wl:case Xt:return{byteLength:4,components:1};case bu:case Tu:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${s}.`)}class XM{static contain(e,t){return Km(e,t)}static cover(e,t){return Qm(e,t)}static fill(e){return jm(e)}static getByteLength(e,t,n,i){return Sl(e,t,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Al}}));typeof window<"u"&&(window.__THREE__?de("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Al);/**
10 * @license
11 * Copyright 2010-2026 Three.js Authors
12 * SPDX-License-Identifier: MIT
13 */function od(){let s=null,e=!1,t=null,n=null;function i(r,a){t(r,a),n=s.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&s!==null&&(n=s.requestAnimationFrame(i),e=!0)},stop:function(){s!==null&&s.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){s=r}}}function tg(s){const e=new WeakMap;function t(o,l){const c=o.array,h=o.usage,d=c.byteLength,u=s.createBuffer();s.bindBuffer(l,u),s.bufferData(l,c,h),o.onUploadCallback();let f;if(c instanceof Float32Array)f=s.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)f=s.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?f=s.HALF_FLOAT:f=s.UNSIGNED_SHORT;else if(c instanceof Int16Array)f=s.SHORT;else if(c instanceof Uint32Array)f=s.UNSIGNED_INT;else if(c instanceof Int32Array)f=s.INT;else if(c instanceof Int8Array)f=s.BYTE;else if(c instanceof Uint8Array)f=s.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)f=s.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(s.bindBuffer(c,o),d.length===0)s.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];s.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 r(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(s.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:r,update:a}}var ng=`#ifdef USE_ALPHAHASH
14	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
15#endif`,ig=`#ifdef USE_ALPHAHASH
16	const float ALPHA_HASH_SCALE = 0.05;
17	float hash2D( vec2 value ) {
18		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
19	}
20	float hash3D( vec3 value ) {
21		return hash2D( vec2( hash2D( value.xy ), value.z ) );
22	}
23	float getAlphaHashThreshold( vec3 position ) {
24		float maxDeriv = max(
25			length( dFdx( position.xyz ) ),
26			length( dFdy( position.xyz ) )
27		);
28		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
29		vec2 pixScales = vec2(
30			exp2( floor( log2( pixScale ) ) ),
31			exp2( ceil( log2( pixScale ) ) )
32		);
33		vec2 alpha = vec2(
34			hash3D( floor( pixScales.x * position.xyz ) ),
35			hash3D( floor( pixScales.y * position.xyz ) )
36		);
37		float lerpFactor = fract( log2( pixScale ) );
38		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
39		float a = min( lerpFactor, 1.0 - lerpFactor );
40		vec3 cases = vec3(
41			x * x / ( 2.0 * a * ( 1.0 - a ) ),
42			( x - 0.5 * a ) / ( 1.0 - a ),
43			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
44		);
45		float threshold = ( x < ( 1.0 - a ) )
46			? ( ( x < a ) ? cases.x : cases.y )
47			: cases.z;
48		return clamp( threshold , 1.0e-6, 1.0 );
49	}
50#endif`,sg=`#ifdef USE_ALPHAMAP
51	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
52#endif`,rg=`#ifdef USE_ALPHAMAP
53	uniform sampler2D alphaMap;
54#endif`,ag=`#ifdef USE_ALPHATEST
55	#ifdef ALPHA_TO_COVERAGE
56	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
57	if ( diffuseColor.a == 0.0 ) discard;
58	#else
59	if ( diffuseColor.a < alphaTest ) discard;
60	#endif
61#endif`,og=`#ifdef USE_ALPHATEST
62	uniform float alphaTest;
63#endif`,lg=`#ifdef USE_AOMAP
64	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
65	reflectedLight.indirectDiffuse *= ambientOcclusion;
66	#if defined( USE_CLEARCOAT ) 
67		clearcoatSpecularIndirect *= ambientOcclusion;
68	#endif
69	#if defined( USE_SHEEN ) 
70		sheenSpecularIndirect *= ambientOcclusion;
71	#endif
72	#if defined( USE_ENVMAP ) && defined( STANDARD )
73		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
74		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
75	#endif
76#endif`,cg=`#ifdef USE_AOMAP
77	uniform sampler2D aoMap;
78	uniform float aoMapIntensity;
79#endif`,hg=`#ifdef USE_BATCHING
80	#if ! defined( GL_ANGLE_multi_draw )
81	#define gl_DrawID _gl_DrawID
82	uniform int _gl_DrawID;
83	#endif
84	uniform highp sampler2D batchingTexture;
85	uniform highp usampler2D batchingIdTexture;
86	mat4 getBatchingMatrix( const in float i ) {
87		int size = textureSize( batchingTexture, 0 ).x;
88		int j = int( i ) * 4;
89		int x = j % size;
90		int y = j / size;
91		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
92		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
93		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
94		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
95		return mat4( v1, v2, v3, v4 );
96	}
97	float getIndirectIndex( const in int i ) {
98		int size = textureSize( batchingIdTexture, 0 ).x;
99		int x = i % size;
100		int y = i / size;
101		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
102	}
103#endif
104#ifdef USE_BATCHING_COLOR
105	uniform sampler2D batchingColorTexture;
106	vec4 getBatchingColor( const in float i ) {
107		int size = textureSize( batchingColorTexture, 0 ).x;
108		int j = int( i );
109		int x = j % size;
110		int y = j / size;
111		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
112	}
113#endif`,ug=`#ifdef USE_BATCHING
114	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
115#endif`,dg=`vec3 transformed = vec3( position );
116#ifdef USE_ALPHAHASH
117	vPosition = vec3( position );
118#endif`,fg=`vec3 objectNormal = vec3( normal );
119#ifdef USE_TANGENT
120	vec3 objectTangent = vec3( tangent.xyz );
121#endif`,pg=`float G_BlinnPhong_Implicit( ) {
122	return 0.25;
123}
124float D_BlinnPhong( const in float shininess, const in float dotNH ) {
125	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
126}
127vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
128	vec3 halfDir = normalize( lightDir + viewDir );
129	float dotNH = saturate( dot( normal, halfDir ) );
130	float dotVH = saturate( dot( viewDir, halfDir ) );
131	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
132	float G = G_BlinnPhong_Implicit( );
133	float D = D_BlinnPhong( shininess, dotNH );
134	return F * ( G * D );
135} // validated`,mg=`#ifdef USE_IRIDESCENCE
136	const mat3 XYZ_TO_REC709 = mat3(
137		 3.2404542, -0.9692660,  0.0556434,
138		-1.5371385,  1.8760108, -0.2040259,
139		-0.4985314,  0.0415560,  1.0572252
140	);
141	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
142		vec3 sqrtF0 = sqrt( fresnel0 );
143		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
144	}
145	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
146		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
147	}
148	float IorToFresnel0( float transmittedIor, float incidentIor ) {
149		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
150	}
151	vec3 evalSensitivity( float OPD, vec3 shift ) {
152		float phase = 2.0 * PI * OPD * 1.0e-9;
153		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
154		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
155		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
156		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
157		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 ) );
158		xyz /= 1.0685e-7;
159		vec3 rgb = XYZ_TO_REC709 * xyz;
160		return rgb;
161	}
162	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
163		vec3 I;
164		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
165		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
166		float cosTheta2Sq = 1.0 - sinTheta2Sq;
167		if ( cosTheta2Sq < 0.0 ) {
168			return vec3( 1.0 );
169		}
170		float cosTheta2 = sqrt( cosTheta2Sq );
171		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
172		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
173		float T121 = 1.0 - R12;
174		float phi12 = 0.0;
175		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
176		float phi21 = PI - phi12;
177		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
178		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
179		vec3 phi23 = vec3( 0.0 );
180		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
181		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
182		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
183		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
184		vec3 phi = vec3( phi21 ) + phi23;
185		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
186		vec3 r123 = sqrt( R123 );
187		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
188		vec3 C0 = R12 + Rs;
189		I = C0;
190		vec3 Cm = Rs - T121;
191		for ( int m = 1; m <= 2; ++ m ) {
192			Cm *= r123;
193			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
194			I += Cm * Sm;
195		}
196		return max( I, vec3( 0.0 ) );
197	}
198#endif`,gg=`#ifdef USE_BUMPMAP
199	uniform sampler2D bumpMap;
200	uniform float bumpScale;
201	vec2 dHdxy_fwd() {
202		vec2 dSTdx = dFdx( vBumpMapUv );
203		vec2 dSTdy = dFdy( vBumpMapUv );
204		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
205		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
206		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
207		return vec2( dBx, dBy );
208	}
209	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
210		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
211		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
212		vec3 vN = surf_norm;
213		vec3 R1 = cross( vSigmaY, vN );
214		vec3 R2 = cross( vN, vSigmaX );
215		float fDet = dot( vSigmaX, R1 ) * faceDirection;
216		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
217		return normalize( abs( fDet ) * surf_norm - vGrad );
218	}
219#endif`,_g=`#if NUM_CLIPPING_PLANES > 0
220	vec4 plane;
221	#ifdef ALPHA_TO_COVERAGE
222		float distanceToPlane, distanceGradient;
223		float clipOpacity = 1.0;
224		#pragma unroll_loop_start
225		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
226			plane = clippingPlanes[ i ];
227			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
228			distanceGradient = fwidth( distanceToPlane ) / 2.0;
229			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
230			if ( clipOpacity == 0.0 ) discard;
231		}
232		#pragma unroll_loop_end
233		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
234			float unionClipOpacity = 1.0;
235			#pragma unroll_loop_start
236			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
237				plane = clippingPlanes[ i ];
238				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
239				distanceGradient = fwidth( distanceToPlane ) / 2.0;
240				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
241			}
242			#pragma unroll_loop_end
243			clipOpacity *= 1.0 - unionClipOpacity;
244		#endif
245		diffuseColor.a *= clipOpacity;
246		if ( diffuseColor.a == 0.0 ) discard;
247	#else
248		#pragma unroll_loop_start
249		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
250			plane = clippingPlanes[ i ];
251			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
252		}
253		#pragma unroll_loop_end
254		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
255			bool clipped = true;
256			#pragma unroll_loop_start
257			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
258				plane = clippingPlanes[ i ];
259				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
260			}
261			#pragma unroll_loop_end
262			if ( clipped ) discard;
263		#endif
264	#endif
265#endif`,xg=`#if NUM_CLIPPING_PLANES > 0
266	varying vec3 vClipPosition;
267	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
268#endif`,vg=`#if NUM_CLIPPING_PLANES > 0
269	varying vec3 vClipPosition;
270#endif`,yg=`#if NUM_CLIPPING_PLANES > 0
271	vClipPosition = - mvPosition.xyz;
272#endif`,Mg=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
273	diffuseColor *= vColor;
274#endif`,Sg=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
275	varying vec4 vColor;
276#endif`,bg=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
277	varying vec4 vColor;
278#endif`,Tg=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
279	vColor = vec4( 1.0 );
280#endif
281#ifdef USE_COLOR_ALPHA
282	vColor *= color;
283#elif defined( USE_COLOR )
284	vColor.rgb *= color;
285#endif
286#ifdef USE_INSTANCING_COLOR
287	vColor.rgb *= instanceColor.rgb;
288#endif
289#ifdef USE_BATCHING_COLOR
290	vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
291#endif`,Ag=`#define PI 3.141592653589793
292#define PI2 6.283185307179586
293#define PI_HALF 1.5707963267948966
294#define RECIPROCAL_PI 0.3183098861837907
295#define RECIPROCAL_PI2 0.15915494309189535
296#define EPSILON 1e-6
297#ifndef saturate
298#define saturate( a ) clamp( a, 0.0, 1.0 )
299#endif
300#define whiteComplement( a ) ( 1.0 - saturate( a ) )
301float pow2( const in float x ) { return x*x; }
302vec3 pow2( const in vec3 x ) { return x*x; }
303float pow3( const in float x ) { return x*x*x; }
304float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
305float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
306float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
307highp float rand( const in vec2 uv ) {
308	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
309	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
310	return fract( sin( sn ) * c );
311}
312#ifdef HIGH_PRECISION
313	float precisionSafeLength( vec3 v ) { return length( v ); }
314#else
315	float precisionSafeLength( vec3 v ) {
316		float maxComponent = max3( abs( v ) );
317		return length( v / maxComponent ) * maxComponent;
318	}
319#endif
320struct IncidentLight {
321	vec3 color;
322	vec3 direction;
323	bool visible;
324};
325struct ReflectedLight {
326	vec3 directDiffuse;
327	vec3 directSpecular;
328	vec3 indirectDiffuse;
329	vec3 indirectSpecular;
330};
331#ifdef USE_ALPHAHASH
332	varying vec3 vPosition;
333#endif
334vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
335	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
336}
337vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
338	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
339}
340bool isPerspectiveMatrix( mat4 m ) {
341	return m[ 2 ][ 3 ] == - 1.0;
342}
343vec2 equirectUv( in vec3 dir ) {
344	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
345	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
346	return vec2( u, v );
347}
348vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
349	return RECIPROCAL_PI * diffuseColor;
350}
351vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
352	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
353	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
354}
355float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
356	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
357	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
358} // validated`,Eg=`#ifdef ENVMAP_TYPE_CUBE_UV
359	#define cubeUV_minMipLevel 4.0
360	#define cubeUV_minTileSize 16.0
361	float getFace( vec3 direction ) {
362		vec3 absDirection = abs( direction );
363		float face = - 1.0;
364		if ( absDirection.x > absDirection.z ) {
365			if ( absDirection.x > absDirection.y )
366				face = direction.x > 0.0 ? 0.0 : 3.0;
367			else
368				face = direction.y > 0.0 ? 1.0 : 4.0;
369		} else {
370			if ( absDirection.z > absDirection.y )
371				face = direction.z > 0.0 ? 2.0 : 5.0;
372			else
373				face = direction.y > 0.0 ? 1.0 : 4.0;
374		}
375		return face;
376	}
377	vec2 getUV( vec3 direction, float face ) {
378		vec2 uv;
379		if ( face == 0.0 ) {
380			uv = vec2( direction.z, direction.y ) / abs( direction.x );
381		} else if ( face == 1.0 ) {
382			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
383		} else if ( face == 2.0 ) {
384			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
385		} else if ( face == 3.0 ) {
386			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
387		} else if ( face == 4.0 ) {
388			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
389		} else {
390			uv = vec2( direction.x, direction.y ) / abs( direction.z );
391		}
392		return 0.5 * ( uv + 1.0 );
393	}
394	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
395		float face = getFace( direction );
396		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
397		mipInt = max( mipInt, cubeUV_minMipLevel );
398		float faceSize = exp2( mipInt );
399		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
400		if ( face > 2.0 ) {
401			uv.y += faceSize;
402			face -= 3.0;
403		}
404		uv.x += face * faceSize;
405		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
406		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
407		uv.x *= CUBEUV_TEXEL_WIDTH;
408		uv.y *= CUBEUV_TEXEL_HEIGHT;
409		#ifdef texture2DGradEXT
410			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
411		#else
412			return texture2D( envMap, uv ).rgb;
413		#endif
414	}
415	#define cubeUV_r0 1.0
416	#define cubeUV_m0 - 2.0
417	#define cubeUV_r1 0.8
418	#define cubeUV_m1 - 1.0
419	#define cubeUV_r4 0.4
420	#define cubeUV_m4 2.0
421	#define cubeUV_r5 0.305
422	#define cubeUV_m5 3.0
423	#define cubeUV_r6 0.21
424	#define cubeUV_m6 4.0
425	float roughnessToMip( float roughness ) {
426		float mip = 0.0;
427		if ( roughness >= cubeUV_r1 ) {
428			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
429		} else if ( roughness >= cubeUV_r4 ) {
430			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
431		} else if ( roughness >= cubeUV_r5 ) {
432			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
433		} else if ( roughness >= cubeUV_r6 ) {
434			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
435		} else {
436			mip = - 2.0 * log2( 1.16 * roughness );		}
437		return mip;
438	}
439	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
440		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
441		float mipF = fract( mip );
442		float mipInt = floor( mip );
443		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
444		if ( mipF == 0.0 ) {
445			return vec4( color0, 1.0 );
446		} else {
447			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
448			return vec4( mix( color0, color1, mipF ), 1.0 );
449		}
450	}
451#endif`,wg=`vec3 transformedNormal = objectNormal;
452#ifdef USE_TANGENT
453	vec3 transformedTangent = objectTangent;
454#endif
455#ifdef USE_BATCHING
456	mat3 bm = mat3( batchingMatrix );
457	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
458	transformedNormal = bm * transformedNormal;
459	#ifdef USE_TANGENT
460		transformedTangent = bm * transformedTangent;
461	#endif
462#endif
463#ifdef USE_INSTANCING
464	mat3 im = mat3( instanceMatrix );
465	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
466	transformedNormal = im * transformedNormal;
467	#ifdef USE_TANGENT
468		transformedTangent = im * transformedTangent;
469	#endif
470#endif
471transformedNormal = normalMatrix * transformedNormal;
472#ifdef FLIP_SIDED
473	transformedNormal = - transformedNormal;
474#endif
475#ifdef USE_TANGENT
476	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
477	#ifdef FLIP_SIDED
478		transformedTangent = - transformedTangent;
479	#endif
480#endif`,Cg=`#ifdef USE_DISPLACEMENTMAP
481	uniform sampler2D displacementMap;
482	uniform float displacementScale;
483	uniform float displacementBias;
484#endif`,Rg=`#ifdef USE_DISPLACEMENTMAP
485	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
485placementBias );
486#endif`,Ig=`#ifdef USE_EMISSIVEMAP
487	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
488	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
489		emissiveColor = sRGBTransferEOTF( emissiveColor );
490	#endif
491	totalEmissiveRadiance *= emissiveColor.rgb;
492#endif`,Pg=`#ifdef USE_EMISSIVEMAP
493	uniform sampler2D emissiveMap;
494#endif`,Lg="gl_FragColor = linearToOutputTexel( gl_FragColor );",Dg=`vec4 LinearTransferOETF( in vec4 value ) {
495	return value;
496}
497vec4 sRGBTransferEOTF( in vec4 value ) {
498	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 );
499}
500vec4 sRGBTransferOETF( in vec4 value ) {
501	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 );
502}`,Ug=`#ifdef USE_ENVMAP
503	#ifdef ENV_WORLDPOS
504		vec3 cameraToFrag;
505		if ( isOrthographic ) {
506			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
507		} else {
508			cameraToFrag = normalize( vWorldPosition - cameraPosition );
509		}
510		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
511		#ifdef ENVMAP_MODE_REFLECTION
512			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
513		#else
514			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
515		#endif
516	#else
517		vec3 reflectVec = vReflect;
518	#endif
519	#ifdef ENVMAP_TYPE_CUBE
520		vec4 envColor = textureCube( envMap, envMapRotation * reflectVec );
521		#ifdef ENVMAP_BLENDING_MULTIPLY
522			outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
523		#elif defined( ENVMAP_BLENDING_MIX )
524			outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
525		#elif defined( ENVMAP_BLENDING_ADD )
526			outgoingLight += envColor.xyz * specularStrength * reflectivity;
527		#endif
528	#endif
529#endif`,Ng=`#ifdef USE_ENVMAP
530	uniform float envMapIntensity;
531	uniform mat3 envMapRotation;
532	#ifdef ENVMAP_TYPE_CUBE
533		uniform samplerCube envMap;
534	#else
535		uniform sampler2D envMap;
536	#endif
537#endif`,Fg=`#ifdef USE_ENVMAP
538	uniform float reflectivity;
539	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
540		#define ENV_WORLDPOS
541	#endif
542	#ifdef ENV_WORLDPOS
543		varying vec3 vWorldPosition;
544		uniform float refractionRatio;
545	#else
546		varying vec3 vReflect;
547	#endif
548#endif`,Og=`#ifdef USE_ENVMAP
549	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
550		#define ENV_WORLDPOS
551	#endif
552	#ifdef ENV_WORLDPOS
553		
554		varying vec3 vWorldPosition;
555	#else
556		varying vec3 vReflect;
557		uniform float refractionRatio;
558	#endif
559#endif`,Bg=`#ifdef USE_ENVMAP
560	#ifdef ENV_WORLDPOS
561		vWorldPosition = worldPosition.xyz;
562	#else
563		vec3 cameraToVertex;
564		if ( isOrthographic ) {
565			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
566		} else {
567			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
568		}
569		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
570		#ifdef ENVMAP_MODE_REFLECTION
571			vReflect = reflect( cameraToVertex, worldNormal );
572		#else
573			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
574		#endif
575	#endif
576#endif`,zg=`#ifdef USE_FOG
577	vFogDepth = - mvPosition.z;
578#endif`,Vg=`#ifdef USE_FOG
579	varying float vFogDepth;
580#endif`,kg=`#ifdef USE_FOG
581	#ifdef FOG_EXP2
582		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
583	#else
584		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
585	#endif
586	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
587#endif`,Gg=`#ifdef USE_FOG
588	uniform vec3 fogColor;
589	varying float vFogDepth;
590	#ifdef FOG_EXP2
591		uniform float fogDensity;
592	#else
593		uniform float fogNear;
594		uniform float fogFar;
595	#endif
596#endif`,Hg=`#ifdef USE_GRADIENTMAP
597	uniform sampler2D gradientMap;
598#endif
599vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
600	float dotNL = dot( normal, lightDirection );
601	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
602	#ifdef USE_GRADIENTMAP
603		return vec3( texture2D( gradientMap, coord ).r );
604	#else
605		vec2 fw = fwidth( coord ) * 0.5;
606		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
607	#endif
608}`,Wg=`#ifdef USE_LIGHTMAP
609	uniform sampler2D lightMap;
610	uniform float lightMapIntensity;
611#endif`,Xg=`LambertMaterial material;
612material.diffuseColor = diffuseColor.rgb;
613material.specularStrength = specularStrength;`,qg=`varying vec3 vViewPosition;
614struct LambertMaterial {
615	vec3 diffuseColor;
616	float specularStrength;
617};
618void 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 ) {
619	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
620	vec3 irradiance = dotNL * directLight.color;
621	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
622}
623void 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 ) {
624	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
625}
626#define RE_Direct				RE_Direct_Lambert
627#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,Yg=`uniform bool receiveShadow;
628uniform vec3 ambientLightColor;
629#if defined( USE_LIGHT_PROBES )
630	uniform vec3 lightProbe[ 9 ];
631#endif
632vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
633	float x = normal.x, y = normal.y, z = normal.z;
634	vec3 result = shCoefficients[ 0 ] * 0.886227;
635	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
636	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
637	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
638	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
639	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
640	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
641	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
642	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
643	return result;
644}
645vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
646	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
647	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
648	return irradiance;
649}
650vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
651	vec3 irradiance = ambientLightColor;
652	return irradiance;
653}
654float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
655	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
656	if ( cutoffDistance > 0.0 ) {
657		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
658	}
659	return distanceFalloff;
660}
661float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
662	return smoothstep( coneCosine, penumbraCosine, angleCosine );
663}
664#if NUM_DIR_LIGHTS > 0
665	struct DirectionalLight {
666		vec3 direction;
667		vec3 color;
668	};
669	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
670	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
671		light.color = directionalLight.color;
672		light.direction = directionalLight.direction;
673		light.visible = true;
674	}
675#endif
676#if NUM_POINT_LIGHTS > 0
677	struct PointLight {
678		vec3 position;
679		vec3 color;
680		float distance;
681		float decay;
682	};
683	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
684	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
685		vec3 lVector = pointLight.position - geometryPosition;
686		light.direction = normalize( lVector );
687		float lightDistance = length( lVector );
688		light.color = pointLight.color;
689		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
690		light.visible = ( light.color != vec3( 0.0 ) );
691	}
692#endif
693#if NUM_SPOT_LIGHTS > 0
694	struct SpotLight {
695		vec3 position;
696		vec3 direction;
697		vec3 color;
698		float distance;
699		float decay;
700		float coneCos;
701		float penumbraCos;
702	};
703	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
704	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
705		vec3 lVector = spotLight.position - geometryPosition;
706		light.direction = normalize( lVector );
707		float angleCos = dot( light.direction, spotLight.direction );
708		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
709		if ( spotAttenuation > 0.0 ) {
710			float lightDistance = length( lVector );
711			light.color = spotLight.color * spotAttenuation;
712			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
713			light.visible = ( light.color != vec3( 0.0 ) );
714		} else {
715			light.color = vec3( 0.0 );
716			light.visible = false;
717		}
718	}
719#endif
720#if NUM_RECT_AREA_LIGHTS > 0
721	struct RectAreaLight {
722		vec3 color;
723		vec3 position;
724		vec3 halfWidth;
725		vec3 halfHeight;
726	};
727	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
728	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
729#endif
730#if NUM_HEMI_LIGHTS > 0
731	struct HemisphereLight {
732		vec3 direction;
733		vec3 skyColor;
734		vec3 groundColor;
735	};
736	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
737	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
738		float dotNL = dot( normal, hemiLight.direction );
739		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
740		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
741		return irradiance;
742	}
743#endif
744#include <lightprobes_pars_fragment>`,Zg=`#ifdef USE_ENVMAP
745	vec3 getIBLIrradiance( const in vec3 normal ) {
746		#ifdef ENVMAP_TYPE_CUBE_UV
747			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
748			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
749			return PI * envMapColor.rgb * envMapIntensity;
750		#else
751			return vec3( 0.0 );
752		#endif
753	}
754	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
755		#ifdef ENVMAP_TYPE_CUBE_UV
756			vec3 reflectVec = reflect( - viewDir, normal );
757			reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
758			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
759			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
760			return envMapColor.rgb * envMapIntensity;
761		#else
762			return vec3( 0.0 );
763		#endif
764	}
765	#ifdef USE_ANISOTROPY
766		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
767			#ifdef ENVMAP_TYPE_CUBE_UV
768				vec3 bentNormal = cross( bitangent, viewDir );
769				bentNormal = normalize( cross( bentNormal, bitangent ) );
770				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
771				return getIBLRadiance( viewDir, bentNormal, roughness );
772			#else
773				return vec3( 0.0 );
774			#endif
775		}
776	#endif
777#endif`,Jg=`ToonMaterial material;
778material.diffuseColor = diffuseColor.rgb;`,$g=`varying vec3 vViewPosition;
779struct ToonMaterial {
780	vec3 diffuseColor;
781};
782void 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 ) {
783	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
784	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
785}
786void 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 ) {
787	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
788}
789#define RE_Direct				RE_Direct_Toon
790#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,Kg=`BlinnPhongMaterial material;
791material.diffuseColor = diffuseColor.rgb;
792material.specularColor = specular;
793material.specularShininess = shininess;
794material.specularStrength = specularStrength;`,Qg=`varying vec3 vViewPosition;
795struct BlinnPhongMaterial {
796	vec3 diffuseColor;
797	vec3 specularColor;
798	float specularShininess;
799	float specularStrength;
800};
801void 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 ) {
802	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
803	vec3 irradiance = dotNL * directLight.color;
804	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
805	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
806}
807void 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 ) {
808	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
809}
810#define RE_Direct				RE_Direct_BlinnPhong
811#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,jg=`PhysicalMaterial material;
812material.diffuseColor = diffuseColor.rgb;
813material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
814material.metalness = metalnessFactor;
815vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
816float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
817material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
818material.roughness = min( material.roughness, 1.0 );
819#ifdef IOR
820	material.ior = ior;
821	#ifdef USE_SPECULAR
822		float specularIntensityFactor = specularIntensity;
823		vec3 specularColorFactor = specularColor;
824		#ifdef USE_SPECULAR_COLORMAP
825			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
826		#endif
827		#ifdef USE_SPECULAR_INTENSITYMAP
828			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
829		#endif
830		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
831	#else
832		float specularIntensityFactor = 1.0;
833		vec3 specularColorFactor = vec3( 1.0 );
834		material.specularF90 = 1.0;
835	#endif
836	material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;
837	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
838#else
839	material.specularColor = vec3( 0.04 );
840	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
841	material.specularF90 = 1.0;
842#endif
843#ifdef USE_CLEARCOAT
844	material.clearcoat = clearcoat;
845	material.clearcoatRoughness = clearcoatRoughness;
846	material.clearcoatF0 = vec3( 0.04 );
847	material.clearcoatF90 = 1.0;
848	#ifdef USE_CLEARCOATMAP
849		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
850	#endif
851	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
852		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
853	#endif
854	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
855	material.clearcoatRoughness += geometryRoughness;
856	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
857#endif
858#ifdef USE_DISPERSION
859	material.dispersion = dispersion;
860#endif
861#ifdef USE_IRIDESCENCE
862	material.iridescence = iridescence;
863	material.iridescenceIOR = iridescenceIOR;
864	#ifdef USE_IRIDESCENCEMAP
865		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
866	#endif
867	#ifdef USE_IRIDESCENCE_THICKNESSMAP
868		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
869	#else
870		material.iridescenceThickness = iridescenceThicknessMaximum;
871	#endif
872#endif
873#ifdef USE_SHEEN
874	material.sheenColor = sheenColor;
875	#ifdef USE_SHEEN_COLORMAP
876		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
877	#endif
878	material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );
879	#ifdef USE_SHEEN_ROUGHNESSMAP
880		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
881	#endif
882#endif
883#ifdef USE_ANISOTROPY
884	#ifdef USE_ANISOTROPYMAP
885		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
886		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
887		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
888	#else
889		vec2 anisotropyV = anisotropyVector;
890	#endif
891	material.anisotropy = length( anisotropyV );
892	if( material.anisotropy == 0.0 ) {
893		anisotropyV = vec2( 1.0, 0.0 );
894	} else {
895		anisotropyV /= material.anisotropy;
896		material.anisotropy = saturate( material.anisotropy );
897	}
898	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
899	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
900	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
901#endif`,e0=`uniform sampler2D dfgLUT;
902struct PhysicalMaterial {
903	vec3 diffuseColor;
904	vec3 diffuseContribution;
905	vec3 specularColor;
906	vec3 specularColorBlended;
907	float roughness;
908	float metalness;
909	float specularF90;
910	float dispersion;
911	#ifdef USE_CLEARCOAT
912		float clearcoat;
913		float clearcoatRoughness;
914		vec3 clearcoatF0;
915		float clearcoatF90;
916	#endif
917	#ifdef USE_IRIDESCENCE
918		float iridescence;
919		float iridescenceIOR;
920		float iridescenceThickness;
921		vec3 iridescenceFresnel;
922		vec3 iridescenceF0;
923		vec3 iridescenceFresnelDielectric;
924		vec3 iridescenceFresnelMetallic;
925	#endif
926	#ifdef USE_SHEEN
927		vec3 sheenColor;
928		float sheenRoughness;
929	#endif
930	#ifdef IOR
931		float ior;
932	#endif
933	#ifdef USE_TRANSMISSION
934		float transmission;
935		float transmissionAlpha;
936		float thickness;
937		float attenuationDistance;
938		vec3 attenuationColor;
939	#endif
940	#ifdef USE_ANISOTROPY
941		float anisotropy;
942		float alphaT;
943		vec3 anisotropyT;
944		vec3 anisotropyB;
945	#endif
946};
947vec3 clearcoatSpecularDirect = vec3( 0.0 );
948vec3 clearcoatSpecularIndirect = vec3( 0.0 );
949vec3 sheenSpecularDirect = vec3( 0.0 );
950vec3 sheenSpecularIndirect = vec3(0.0 );
951vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
952    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
953    float x2 = x * x;
954    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
955    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
956}
957float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
958	float a2 = pow2( alpha );
959	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
960	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
961	return 0.5 / max( gv + gl, EPSILON );
962}
963float D_GGX( const in float alpha, const in float dotNH ) {
964	float a2 = pow2( alpha );
965	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
966	return RECIPROCAL_PI * a2 / pow2( denom );
967}
968#ifdef USE_ANISOTROPY
969	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 ) {
970		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
971		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
972		return 0.5 / max( gv + gl, EPSILON )
vendor: 7,372 bytes, lines 972-1131
972;
973	}
974	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
975		float a2 = alphaT * alphaB;
976		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
977		highp float v2 = dot( v, v );
978		float w2 = a2 / v2;
979		return RECIPROCAL_PI * a2 * pow2 ( w2 );
980	}
981#endif
982#ifdef USE_CLEARCOAT
983	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
984		vec3 f0 = material.clearcoatF0;
985		float f90 = material.clearcoatF90;
986		float roughness = material.clearcoatRoughness;
987		float alpha = pow2( roughness );
988		vec3 halfDir = normalize( lightDir + viewDir );
989		float dotNL = saturate( dot( normal, lightDir ) );
990		float dotNV = saturate( dot( normal, viewDir ) );
991		float dotNH = saturate( dot( normal, halfDir ) );
992		float dotVH = saturate( dot( viewDir, halfDir ) );
993		vec3 F = F_Schlick( f0, f90, dotVH );
994		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
995		float D = D_GGX( alpha, dotNH );
996		return F * ( V * D );
997	}
998#endif
999vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1000	vec3 f0 = material.specularColorBlended;
1001	float f90 = material.specularF90;
1002	float roughness = material.roughness;
1003	float alpha = pow2( roughness );
1004	vec3 halfDir = normalize( lightDir + viewDir );
1005	float dotNL = saturate( dot( normal, lightDir ) );
1006	float dotNV = saturate( dot( normal, viewDir ) );
1007	float dotNH = saturate( dot( normal, halfDir ) );
1008	float dotVH = saturate( dot( viewDir, halfDir ) );
1009	vec3 F = F_Schlick( f0, f90, dotVH );
1010	#ifdef USE_IRIDESCENCE
1011		F = mix( F, material.iridescenceFresnel, material.iridescence );
1012	#endif
1013	#ifdef USE_ANISOTROPY
1014		float dotTL = dot( material.anisotropyT, lightDir );
1015		float dotTV = dot( material.anisotropyT, viewDir );
1016		float dotTH = dot( material.anisotropyT, halfDir );
1017		float dotBL = dot( material.anisotropyB, lightDir );
1018		float dotBV = dot( material.anisotropyB, viewDir );
1019		float dotBH = dot( material.anisotropyB, halfDir );
1020		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1021		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
1022	#else
1023		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1024		float D = D_GGX( alpha, dotNH );
1025	#endif
1026	return F * ( V * D );
1027}
1028vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
1029	const float LUT_SIZE = 64.0;
1030	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
1031	const float LUT_BIAS = 0.5 / LUT_SIZE;
1032	float dotNV = saturate( dot( N, V ) );
1033	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
1034	uv = uv * LUT_SCALE + LUT_BIAS;
1035	return uv;
1036}
1037float LTC_ClippedSphereFormFactor( const in vec3 f ) {
1038	float l = length( f );
1039	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
1040}
1041vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
1042	float x = dot( v1, v2 );
1043	float y = abs( x );
1044	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
1045	float b = 3.4175940 + ( 4.1616724 + y ) * y;
1046	float v = a / b;
1047	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
1048	return cross( v1, v2 ) * theta_sintheta;
1049}
1050vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
1051	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
1052	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
1053	vec3 lightNormal = cross( v1, v2 );
1054	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
1055	vec3 T1, T2;
1056	T1 = normalize( V - N * dot( V, N ) );
1057	T2 = - cross( N, T1 );
1058	mat3 mat = mInv * transpose( mat3( T1, T2, N ) );
1059	vec3 coords[ 4 ];
1060	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
1061	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
1062	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
1063	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
1064	coords[ 0 ] = normalize( coords[ 0 ] );
1065	coords[ 1 ] = normalize( coords[ 1 ] );
1066	coords[ 2 ] = normalize( coords[ 2 ] );
1067	coords[ 3 ] = normalize( coords[ 3 ] );
1068	vec3 vectorFormFactor = vec3( 0.0 );
1069	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
1070	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
1071	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
1072	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
1073	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
1074	return vec3( result );
1075}
1076#if defined( USE_SHEEN )
1077float D_Charlie( float roughness, float dotNH ) {
1078	float alpha = pow2( roughness );
1079	float invAlpha = 1.0 / alpha;
1080	float cos2h = dotNH * dotNH;
1081	float sin2h = max( 1.0 - cos2h, 0.0078125 );
1082	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
1083}
1084float V_Neubelt( float dotNV, float dotNL ) {
1085	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
1086}
1087vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
1088	vec3 halfDir = normalize( lightDir + viewDir );
1089	float dotNL = saturate( dot( normal, lightDir ) );
1090	float dotNV = saturate( dot( normal, viewDir ) );
1091	float dotNH = saturate( dot( normal, halfDir ) );
1092	float D = D_Charlie( sheenRoughness, dotNH );
1093	float V = V_Neubelt( dotNV, dotNL );
1094	return sheenColor * ( D * V );
1095}
1096#endif
1097float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1098	float dotNV = saturate( dot( normal, viewDir ) );
1099	float r2 = roughness * roughness;
1100	float rInv = 1.0 / ( roughness + 0.1 );
1101	float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;
1102	float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;
1103	float DG = exp( a * dotNV + b );
1104	return saturate( DG );
1105}
1106vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
1107	float dotNV = saturate( dot( normal, viewDir ) );
1108	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
1109	return specularColor * fab.x + specularF90 * fab.y;
1110}
1111#ifdef USE_IRIDESCENCE
1112void 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 ) {
1113#else
1114void 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 ) {
1115#endif
1116	float dotNV = saturate( dot( normal, viewDir ) );
1117	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
1118	#ifdef USE_IRIDESCENCE
1119		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
1120	#else
1121		vec3 Fr = specularColor;
1122	#endif
1123	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
1124	float Ess = fab.x + fab.y;
1125	float Ems = 1.0 - Ess;
1126	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
1127	singleScatter += FssEss;
1128	multiScatter += Fms * Ems;
1129}
1130vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1131	vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
vendor: 8,354 bytes, lines 1132-1261
1132	float dotNL = saturate( dot( normal, lightDir ) );
1133	float dotNV = saturate( dot( normal, viewDir ) );
1134	vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;
1135	vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;
1136	vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;
1137	vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;
1138	float Ess_V = dfgV.x + dfgV.y;
1139	float Ess_L = dfgL.x + dfgL.y;
1140	float Ems_V = 1.0 - Ess_V;
1141	float Ems_L = 1.0 - Ess_L;
1142	vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;
1143	vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );
1144	float compensationFactor = Ems_V * Ems_L;
1145	vec3 multiScatter = Fms * compensationFactor;
1146	return singleScatter + multiScatter;
1147}
1148#if NUM_RECT_AREA_LIGHTS > 0
1149	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 ) {
1150		vec3 normal = geometryNormal;
1151		vec3 viewDir = geometryViewDir;
1152		vec3 position = geometryPosition;
1153		vec3 lightPos = rectAreaLight.position;
1154		vec3 halfWidth = rectAreaLight.halfWidth;
1155		vec3 halfHeight = rectAreaLight.halfHeight;
1156		vec3 lightColor = rectAreaLight.color;
1157		float roughness = material.roughness;
1158		vec3 rectCoords[ 4 ];
1159		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
1160		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
1161		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
1162		vec2 uv = LTC_Uv( normal, viewDir, roughness );
1163		vec4 t1 = texture2D( ltc_1, uv );
1164		vec4 t2 = texture2D( ltc_2, uv );
1165		mat3 mInv = mat3(
1166			vec3( t1.x, 0, t1.y ),
1167			vec3(    0, 1,    0 ),
1168			vec3( t1.z, 0, t1.w )
1169		);
1170		vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );
1171		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1172		reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1173		#ifdef USE_CLEARCOAT
1174			vec3 Ncc = geometryClearcoatNormal;
1175			vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );
1176			vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );
1177			vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );
1178			mat3 mInvClearcoat = mat3(
1179				vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),
1180				vec3(             0, 1,             0 ),
1181				vec3( t1Clearcoat.z, 0, t1Clearcoat.w )
1182			);
1183			vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;
1184			clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );
1185		#endif
1186	}
1187#endif
1188void 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 ) {
1189	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1190	vec3 irradiance = dotNL * directLight.color;
1191	#ifdef USE_CLEARCOAT
1192		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
1193		vec3 ccIrradiance = dotNLcc * directLight.color;
1194		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
1195	#endif
1196	#ifdef USE_SHEEN
1197 
1198 		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
1199 
1200 		float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1201 		float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );
1202 
1203 		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );
1204 
1205 		irradiance *= sheenEnergyComp;
1206 
1207 	#endif
1208	reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );
1209	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );
1210}
1211void 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 ) {
1212	vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );
1213	#ifdef USE_SHEEN
1214		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1215		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
1216		diffuse *= sheenEnergyComp;
1217	#endif
1218	reflectedLight.indirectDiffuse += diffuse;
1219}
1220void 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) {
1221	#ifdef USE_CLEARCOAT
1222		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1223	#endif
1224	#ifdef USE_SHEEN
1225		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;
1226 	#endif
1227	vec3 singleScatteringDielectric = vec3( 0.0 );
1228	vec3 multiScatteringDielectric = vec3( 0.0 );
1229	vec3 singleScatteringMetallic = vec3( 0.0 );
1230	vec3 multiScatteringMetallic = vec3( 0.0 );
1231	#ifdef USE_IRIDESCENCE
1232		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
1233		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
1234	#else
1235		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
1236		computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
1237	#endif
1238	vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );
1239	vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );
1240	vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;
1241	vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
1242	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1243	vec3 indirectSpecular = radiance * singleScattering;
1244	indirectSpecular += multiScattering * cosineWeightedIrradiance;
1245	vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;
1246	#ifdef USE_SHEEN
1247		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1248		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
1249		indirectSpecular *= sheenEnergyComp;
1250		indirectDiffuse *= sheenEnergyComp;
1251	#endif
1252	reflectedLight.indirectSpecular += indirectSpecular;
1253	reflectedLight.indirectDiffuse += indirectDiffuse;
1254}
1255#define RE_Direct				RE_Direct_Physical
1256#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
1257#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
1258#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
1259float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1260	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1261}`,
1261t0=`
1262vec3 geometryPosition = - vViewPosition;
1263vec3 geometryNormal = normal;
1264vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1265vec3 geometryClearcoatNormal = vec3( 0.0 );
1266#ifdef USE_CLEARCOAT
1267	geometryClearcoatNormal = clearcoatNormal;
1268#endif
1269#ifdef USE_IRIDESCENCE
1270	float dotNVi = saturate( dot( normal, geometryViewDir ) );
1271	if ( material.iridescenceThickness == 0.0 ) {
1272		material.iridescence = 0.0;
1273	} else {
1274		material.iridescence = saturate( material.iridescence );
1275	}
1276	if ( material.iridescence > 0.0 ) {
1277		material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
1278		material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );
1279		material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );
1280		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
1281	}
1282#endif
1283IncidentLight directLight;
1284#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1285	PointLight pointLight;
1286	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1287	PointLightShadow pointLightShadow;
1288	#endif
1289	#pragma unroll_loop_start
1290	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1291		pointLight = pointLights[ i ];
1292		getPointLightInfo( pointLight, geometryPosition, directLight );
1293		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
1294		pointLightShadow = pointLightShadows[ i ];
1295		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1296		#endif
1297		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1298	}
1299	#pragma unroll_loop_end
1300#endif
1301#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1302	SpotLight spotLight;
1303	vec4 spotColor;
1304	vec3 spotLightCoord;
1305	bool inSpotLightMap;
1306	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1307	SpotLightShadow spotLightShadow;
1308	#endif
1309	#pragma unroll_loop_start
1310	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1311		spotLight = spotLights[ i ];
1312		getSpotLightInfo( spotLight, geometryPosition, directLight );
1313		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1314		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
1315		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1316		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
1317		#else
1318		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1319		#endif
1320		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
1321			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
1322			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
1323			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
1324			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
1325		#endif
1326		#undef SPOT_LIGHT_MAP_INDEX
1327		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1328		spotLightShadow = spotLightShadows[ i ];
1329		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1330		#endif
1331		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1332	}
1333	#pragma unroll_loop_end
1334#endif
1335#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1336	DirectionalLight directionalLight;
1337	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1338	DirectionalLightShadow directionalLightShadow;
1339	#endif
1340	#pragma unroll_loop_start
1341	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1342		directionalLight = directionalLights[ i ];
1343		getDirectionalLightInfo( directionalLight, directLight );
1344		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1345		directionalLightShadow = directionalLightShadows[ i ];
1346		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1347		#endif
1348		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1349	}
1350	#pragma unroll_loop_end
1351#endif
1352#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1353	RectAreaLight rectAreaLight;
1354	#pragma unroll_loop_start
1355	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1356		rectAreaLight = rectAreaLights[ i ];
1357		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1358	}
1359	#pragma unroll_loop_end
1360#endif
1361#if defined( RE_IndirectDiffuse )
1362	vec3 iblIrradiance = vec3( 0.0 );
1363	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1364	#if defined( USE_LIGHT_PROBES )
1365		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
1366	#endif
1367	#if ( NUM_HEMI_LIGHTS > 0 )
1368		#pragma unroll_loop_start
1369		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1370			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
1371		}
1372		#pragma unroll_loop_end
1373	#endif
1374	#ifdef USE_LIGHT_PROBES_GRID
1375		vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;
1376		vec3 probeWorldNormal = inverseTransformDirection( geometryNormal, viewMatrix );
1377		irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );
1378	#endif
1379#endif
1380#if defined( RE_IndirectSpecular )
1381	vec3 radiance = vec3( 0.0 );
1382	vec3 clearcoatRadiance = vec3( 0.0 );
1383#endif`,n0=`#if defined( RE_IndirectDiffuse )
1384	#ifdef USE_LIGHTMAP
1385		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1386		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1387		irradiance += lightMapIrradiance;
1388	#endif
1389	#if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )
1390		#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )
1391			iblIrradiance += getIBLIrradiance( geometryNormal );
1392		#endif
1393	#endif
1394#endif
1395#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1396	#ifdef USE_ANISOTROPY
1397		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
1398	#else
1399		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
1400	#endif
1401	#ifdef USE_CLEARCOAT
1402		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1403	#endif
1404#endif`,i0=`#if defined( RE_IndirectDiffuse )
1405	#if defined( LAMBERT ) || defined( PHONG )
1406		irradiance += iblIrradiance;
1407	#endif
1408	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1409#endif
1410#if defined( RE_IndirectSpecular )
1411	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1412#endif`,s0=`#ifdef USE_LIGHT_PROBES_GRID
1413uniform highp sampler3D probesSH;
1414uniform vec3 probesMin;
1415uniform vec3 probesMax;
1416uniform vec3 probesResolution;
1417vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1418	vec3 res = probesResolution;
1419	vec3 gridRange = probesMax - probesMin;
1420	vec3 resMinusOne = res - 1.0;
1421	vec3 probeSpacing = gridRange / resMinusOne;
1422	vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;
1423	vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );
1424	uvw = uvw * resMinusOne / res + 0.5 / res;
1425	float nz          = res.z;
1426	float paddedSlices = nz + 2.0;
1427	float atlasDepth  = 7.0 * paddedSlices;
1428	float uvZBase     = uvw.z * nz + 1.0;
1429	vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase                       ) / atlasDepth ) );
1430	vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase +       paddedSlices   ) / atlasDepth ) );
1431	vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices   ) / atlasDepth ) );
1432	vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices   ) / atlasDepth ) );
1433	vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices   ) / atlasDepth ) );
1434	vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices   ) / atlasDepth ) );
1435	vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices   ) / atlasDepth ) );
1436	vec3 c0 = s0.xyz;
1437	vec3 c1 = vec3( s0.w, s1.xy );
1438	vec3 c2 = vec3( s1.zw, s2.x );
1439	vec3 c3 = s2.yzw;
1440	vec3 c4 = s3.xyz;
1441	vec3 c5 = vec3( s3.w, s4.xy );
1442	vec3 c6 = vec3( s4.zw, s5.x );
1443	vec3 c7 = s5.yzw;
1444	vec3 c8 = s6.xyz;
1445	float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;
1446	vec3 result = c0 * 0.886227;
1447	result += c1 * 2.0 * 0.511664 * y;
1448	result += c2 * 2.0 * 0.511664 * z;
1449	result += c3 * 2.0 * 0.511664 * x;
1450	result += c4 * 2.0 * 0.429043 * x * y;
1451	result += c5 * 2.0 * 0.429043 * y * z;
1452	result += c6 * ( 0.743125 * z * z - 0.247708 );
1453	result += c7 * 2.0 * 0.429043 * x * z;
1454	result += c8 * 0.429043 * ( x * x - y * y );
1455	return max( result, vec3( 0.0 ) );
1456}
1457#endif`,r0=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1458	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1459#endif`,a0=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1460	uniform float logDepthBufFC;
1461	varying float vFragDepth;
1462	varying float vIsPerspective;
1463#endif`,o0=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1464	varying float vFragDepth;
1465	varying float vIsPerspective;
1466#endif`,l0=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1467	vFragDepth = 1.0 + gl_Position.w;
1468	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1469#endif`,c0=`#ifdef USE_MAP
1470	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1471	#ifdef DECODE_VIDEO_TEXTURE
1472		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1473	#endif
1474	diffuseColor *= sampledDiffuseColor;
1475#endif`,h0=`#ifdef USE_MAP
1476	uniform sampler2D map;
1477#endif`,u0=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1478	#if defined( USE_POINTS_UV )
1479		vec2 uv = vUv;
1480	#else
1481		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1482	#endif
1483#endif
1484#ifdef USE_MAP
1485	diffuseColor *= texture2D( map, uv );
1486#endif
1487#ifdef USE_ALPHAMAP
1488	diffuseColor.a *= texture2D( alphaMap, uv ).g;
1489#endif`,d0=`#if defined( USE_POINTS_UV )
1490	varying vec2 vUv;
1491#else
1492	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1493		uniform mat3 uvTransform;
1494	#endif
1495#endif
1496#ifdef USE_MAP
1497	uniform sampler2D map;
1498#endif
1499#ifdef USE_ALPHAMAP
1500	uniform sampler2D alphaMap;
1501#endif`,f0=`float metalnessFactor = metalness;
1502#ifdef USE_METALNESSMAP
1503	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1504	metalnessFactor *= texelMetalness.b;
1505#endif`,p0=`#ifdef USE_METALNESSMAP
1506	uniform sampler2D metalnessMap;
1507#endif`,m0=`#ifdef USE_INSTANCING_MORPH
1508	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1509	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1510	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1511		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1512	}
1513#endif`,g0=`#if defined( USE_MORPHCOLORS )
1514	vColor *= morphTargetBaseInfluence;
1515	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1516		#if defined( USE_COLOR_ALPHA )
1517			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1518		#elif defined( USE_COLOR )
1519			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1520		#endif
1521	}
1522#endif`,_0=`#ifdef USE_MORPHNORMALS
1523	objectNormal *= morphTargetBaseInfluence;
1524	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1525		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1526	}
1527#endif`,x0=`#ifdef USE_MORPHTARGETS
1528	#ifndef USE_INSTANCING_MORPH
1529		uniform float morphTargetBaseInfluence;
1530		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1531	#endif
1532	uniform sampler2DArray morphTargetsTexture;
1533	uniform ivec2 morphTargetsTextureSize;
1534	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
1535		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
1536		int y = texelIndex / morphTargetsTextureSize.x;
1537		int x = texelIndex - y * morphTargetsTextureSize.x;
1538		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1539		return texelFetch( morphTargetsTexture, morphUV, 0 );
1540	}
1541#endif`,v0=`#ifdef USE_MORPHTARGETS
1542	transformed *= morphTargetBaseInfluence;
1543	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1544		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1545	}
1546#endif`,y0=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1547#ifdef FLAT_SHADED
1548	vec3 fdx = dFdx( vViewPosition );
1549	vec3 fdy = dFdy( vViewPosition );
1550	vec3 normal = normalize( cross( fdx, fdy ) );
1551#else
1552	vec3 normal = normalize( vNormal );
1553	#ifdef DOUBLE_SIDED
1554		normal *= faceDirection;
1555	#endif
1556#endif
1557#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
1558	#ifdef USE_TANGENT
1559		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1560	#else
1561		mat3 tbn = getTangentFrame( - vViewPosition, normal,
1562		#if defined( USE_NORMALMAP )
1563			vNormalMapUv
1564		#elif defined( USE_CLEARCOAT_NORMALMAP )
1565			vClearcoatNormalMapUv
1566		#else
1567			vUv
1568		#endif
1569		);
1570	#endif
1571	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1572		tbn[0] *= faceDirection;
1573		tbn[1] *= faceDirection;
1574	#endif
1575#endif
1576#ifdef USE_CLEARCOAT_NORMALMAP
1577	#ifdef USE_TANGENT
1578		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1579	#else
1580		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
1581	#endif
1582	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1583		tbn2[0] *= faceDirection;
1584		tbn2[1] *= faceDirection;
1585	#endif
1586#endif
1587vec3 nonPerturbedNormal = normal;`,M0=`#ifdef USE_NORMALMAP_OBJECTSPACE
1588	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1589	#ifdef FLIP_SIDED
1590		normal = - normal;
1591	#endif
1592	#ifdef DOUBLE_SIDED
1593		normal = normal * faceDirection;
1594	#endif
1595	normal = normalize( normalMatrix * normal );
1596#elif defined( USE_NORMALMAP_TANGENTSPACE )
1597	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1598	#if defined( USE_PACKED_NORMALMAP )
1599		mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );
1600	#endif
1601	mapN.xy *= normalScale;
1602	normal = normalize( tbn * mapN );
1603#elif defined( USE_BUMPMAP )
1604	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1605#endif`,S0=`#ifndef FLAT_SHADED
1606	varying vec3 vNormal;
1607	#ifdef USE_TANGENT
1608		varying vec3 vTangent;
1609		varying vec3 vBitangent;
1610	#endif
1611#endif`,b0=`#ifndef FLAT_SHADED
1612	varying vec3 vNormal;
1613	#ifdef USE_TANGENT
1614		varying vec3 vTangent;
1615		varying vec3 vBitangent;
1616	#endif
1617#endif`,T0=`#ifndef FLAT_SHADED
1618	vNormal = normalize( transformedNormal );
1619	#ifdef USE_TANGENT
1620		vTangent = normalize( transformedTangent );
1621		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1622	#endif
1623#endif`,A0=`#ifdef USE_NORMALMAP
1624	uniform sampler2D normalMap;
1625	uniform vec2 normalScale;
1626#endif
1627#ifdef USE_NORMALMAP_OBJECTSPACE
1628	uniform mat3 normalMatrix;
1629#endif
1630#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
1631	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
1632		vec3 q0 = dFdx( eye_pos.xyz );
1633		vec3 q1 = dFdy( eye_pos.xyz );
1634		vec2 st0 = dFdx( uv.st );
1635		vec2 st1 = dFdy( uv.st );
1636		vec3 N = surf_norm;
1637		vec3 q1perp = cross( q1, N );
1638		vec3 q0perp = cross( N, q0 );
1639		vec3 T = q1perp * st0.x + q0perp * st1.x;
1640		vec3 B = q1perp * st0.y + q0perp * st1.y;
1641		float det = max( dot( T, T ), dot( B, B ) );
1642		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1643		return mat3( T * scale, B * scale, N );
1644	}
1645#endif`,E0=`#ifdef USE_CLEARCOAT
1646	vec3 clearcoatNormal = nonPerturbedNormal;
1647#endif`,w0=`#ifdef USE_CLEARCOAT_NORMALMAP
1648	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1649	clearcoatMapN.xy *= clearcoatNormalScale;
1650	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1651#endif`,C0=`#ifdef USE_CLEARCOATMAP
1652	uniform sampler2D clearcoatMap;
1653#endif
1654#ifdef USE_CLEARCOAT_NORMALMAP
1655	uniform sampler2D clearcoatNormalMap;
1656	uniform vec2 clearcoatNormalScale;
1657#endif
1658#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1659	uniform sampler2D clearcoatRoughnessMap;
1660#endif`,R0=`#ifdef USE_IRIDESCENCEMAP
1661	uniform sampler2D iridescenceMap;
1662#endif
1663#ifdef USE_IRIDESCENCE_THICKNESSMAP
1664	uniform sampler2D iridescenceThicknessMap;
1665#endif`,I0=`#ifdef OPAQUE
1666diffuseColor.a = 1.0;
1667#endif
1668#ifdef USE_TRANSMISSION
1669diffuseColor.a *= material.transmissionAlpha;
1670#endif
1671gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,P0=`vec3 packNormalToRGB( const in vec3 normal ) {
1672	return normalize( normal ) * 0.5 + 0.5;
1673}
1674vec3 unpackRGBToNormal( const in vec3 rgb ) {
1675	return 2.0 * rgb.xyz - 1.0;
1676}
1677const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
1678const float Inv255 = 1. / 255.;
1679const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
1680const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
1681const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
1682const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
1683vec4 packDepthToRGBA( const in float v ) {
1684	if( v <= 0.0 )
1685		return vec4( 0., 0., 0., 0. );
1686	if( v >= 1.0 )
1687		return vec4( 1., 1., 1., 1. );
1688	float vuf;
1689	float af = modf( v * PackFactors.a, vuf );
1690	float bf = modf( vuf * ShiftRight8, vuf );
1691	float gf = modf( vuf * ShiftRight8, vuf );
1692	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
1693}
1694vec3 packDepthToRGB( const in float v ) {
1695	if( v <= 0.0 )
1696		return vec3( 0., 0., 0. );
1697	if( v >= 1.0 )
1698		return vec3( 1., 1., 1. );
1699	float vuf;
1700	float bf = modf( v * PackFactors.b, vuf );
1701	float gf = modf( vuf * ShiftRight8, vuf );
1702	return vec3( vuf * Inv255, gf * PackUpscale, bf );
1703}
1704vec2 packDepthToRG( const in float v ) {
1705	if( v <= 0.0 )
1706		return vec2( 0., 0. );
1707	if( v >= 1.0 )
1708		return vec2( 1., 1. );
1709	float vuf;
1710	float gf = modf( v * 256., vuf );
1711	return vec2( vuf * Inv255, gf );
1712}
1713float unpackRGBAToDepth( const in vec4 v ) {
1714	return dot( v, UnpackFactors4 );
1715}
1716float unpackRGBToDepth( const in vec3 v ) {
1717	return dot( v, UnpackFactors3 );
1718}
1719float unpackRGToDepth( const in vec2 v ) {
1720	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
1721}
1722vec4 pack2HalfToRGBA( const in vec2 v ) {
1723	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
1724	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
1725}
1726vec2 unpackRGBATo2Half( const in vec4 v ) {
1727	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
1728}
1729float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
1730	return ( viewZ + near ) / ( near - far );
1731}
1732float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
1733	#ifdef USE_REVERSED_DEPTH_BUFFER
1734	
1735		return depth * ( far - near ) - far;
1736	#else
1737		return depth * ( near - far ) - near;
1738	#endif
1739}
1740float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1741	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
1742}
1743float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
1744	
1745	#ifdef USE_REVERSED_DEPTH_BUFFER
1746		return ( near * far ) / ( ( near - far ) * depth - near );
1747	#else
1748		return ( near * far ) / ( ( far - near ) * depth - far );
1749	#endif
1750}`,L0=`#ifdef PREMULTIPLIED_ALPHA
1751	gl_FragColor.rgb *= gl_FragColor.a;
1752#endif`,D0=`vec4 mvPosition = vec4( transformed, 1.0 );
1753#ifdef USE_BATCHING
1754	mvPosition = batchingMatrix * mvPosition;
1755#endif
1756#ifdef USE_INSTANCING
1757	mvPosition = instanceMatrix * mvPosition;
1758#endif
1759mvPosition = modelViewMatrix * mvPosition;
1760gl_Position = projectionMatrix * mvPosition;`,U0=`#ifdef DITHERING
1761	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1762#endif`,N0=`#ifdef DITHERING
1763	vec3 dithering( vec3 color ) {
1764		float grid_position = rand( gl_FragCoord.xy );
1765		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1766		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1767		return color + dither_shift_RGB;
1768	}
1769#endif`,F0=`float roughnessFactor = roughness;
1770#ifdef USE_ROUGHNESSMAP
1771	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1772	roughnessFactor *= texelRoughness.g;
1773#endif`,O0=`#ifdef USE_ROUGHNESSMAP
1774	uniform sampler2D roughnessMap;
1775#endif`,B0=`#if NUM_SPOT_LIGHT_COORDS > 0
1776	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1777#endif
1778#if NUM_SPOT_LIGHT_MAPS > 0
1779	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
1780#endif
1781#ifdef USE_SHADOWMAP
1782	#if NUM_DIR_LIGHT_SHADOWS > 0
1783		#if defined( SHADOWMAP_TYPE_PCF )
1784			uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1785		#else
1786			uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1787		#endif
1788		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1789		struct DirectionalLightShadow {
1790			float shadowIntensity;
1791			float shadowBias;
1792			float shadowNormalBias;
1793			float shadowRadius;
1794			vec2 shadowMapSize;
1795		};
1796		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1797	#endif
1798	#if NUM_SPOT_LIGHT_SHADOWS > 0
1799		#if defined( SHADOWMAP_TYPE_PCF )
1800			uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1801		#else
1802			uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1803		#endif
1804		struct SpotLightShadow {
1805			float shadowIntensity;
1806			float shadowBias;
1807			float shadowNormalBias;
1808			float shadowRadius;
1809			vec2 shadowMapSize;
1810		};
1811		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1812	#endif
1813	#if NUM_POINT_LIGHT_SHADOWS > 0
1814		#if defined( SHADOWMAP_TYPE_PCF )
1815			uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1816		#elif defined( SHADOWMAP_TYPE_BASIC )
1817			uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1818		#endif
1819		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1820		struct PointLightShadow {
1821			float shadowIntensity;
1822			float shadowBias;
1823			float shadowNormalBias;
1824			float shadowRadius;
1825			vec2 shadowMapSize;
1826			float shadowCameraNear;
1827			float shadowCameraFar;
1828		};
1829		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1830	#endif
1831	#if defined( SHADOWMAP_TYPE_PCF )
1832		float interleavedGradientNoise( vec2 position ) {
1833			return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );
1834		}
1835		vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {
1836			const float goldenAngle = 2.399963229728653;
1837			float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );
1838			float theta = float( sampleIndex ) * goldenAngle + phi;
1839			return vec2( cos( theta ), sin( theta ) ) * r;
1840		}
1841	#endif
1842	#if defined( SHADOWMAP_TYPE_PCF )
1843		float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1844			float shadow = 1.0;
1845			shadowCoord.xyz /= shadowCoord.w;
1846			shadowCoord.z += shadowBias;
1847			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1848			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1849			if ( frustumTest ) {
1850				vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1851				float radius = shadowRadius * texelSize.x;
1852				float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
1853				shadow = (
1854					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +
1855					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +
1856					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +
1857					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +
1858					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )
1859				) * 0.2;
1860			}
1861			return mix( 1.0, shadow, shadowIntensity );
1862		}
1863	#elif defined( SHADOWMAP_TYPE_VSM )
1864		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1865			float shadow = 1.0;
1866			shadowCoord.xyz /= shadowCoord.w;
1867			#ifdef USE_REVERSED_DEPTH_BUFFER
1868				shadowCoord.z -= shadowBias;
1869			#else
1870				shadowCoord.z += shadowBias;
1871			#endif
1872			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1873			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1874			if ( frustumTest ) {
1875				vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;
1876				float mean = distribution.x;
1877				float variance = distribution.y * distribution.y;
1878				#ifdef USE_REVERSED_DEPTH_BUFFER
1879					float hard_shadow = step( mean, shadowCoord.z );
1880				#else
1881					float hard_shadow = step( shadowCoord.z, mean );
1882				#endif
1883				
1884				if ( hard_shadow == 1.0 ) {
1885					shadow = 1.0;
1886				} else {
1887					variance = max( variance, 0.0000001 );
1888					float d = shadowCoord.z - mean;
1889					float p_max = variance / ( variance + d * d );
1890					p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );
1891					shadow = max( hard_shadow, p_max );
1892				}
1893			}
1894			return mix( 1.0, shadow, shadowIntensity );
1895		}
1896	#else
1897		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1898			float shadow = 1.0;
1899			shadowCoord.xyz /= shadowCoord.w;
1900			#ifdef USE_REVERSED_DEPTH_BUFFER
1901				shadowCoord.z -= shadowBias;
1902			#else
1903				shadowCoord.z += shadowBias;
1904			#endif
1905			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1906			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1907			if ( frustumTest ) {
1908				float depth = texture2D( shadowMap, shadowCoord.xy ).r;
1909				#ifdef USE_REVERSED_DEPTH_BUFFER
1910					shadow = step( depth, shadowCoord.z );
1911				#else
1912					shadow = step( shadowCoord.z, depth );
1913				#endif
1914			}
1915			return mix( 1.0, shadow, shadowIntensity );
1916		}
1917	#endif
1918	#if NUM_POINT_LIGHT_SHADOWS > 0
1919	#if defined( SHADOWMAP_TYPE_PCF )
1920	float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1921		float shadow = 1.0;
1922		vec3 lightToPosition = shadowCoord.xyz;
1923		vec3 bd3D = normalize( lightToPosition );
1924		vec3 absVec = abs( lightToPosition );
1925		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
1926		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
1927			#ifdef USE_REVERSED_DEPTH_BUFFER
1928				float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1929				dp -= shadowBias;
1930			#else
1931				float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1932				dp += shadowBias;
1933			#endif
1934			float texelSize = shadowRadius / shadowMapSize.x;
1935			vec3 absDir = abs( bd3D );
1936			vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );
1937			tangent = normalize( cross( bd3D, tangent ) );
1938			vec3 bitangent = cross( bd3D, tangent );
1939			float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
1940			vec2 sample0 = vogelDiskSample( 0, 5, phi );
1941			vec2 sample1 = vogelDiskSample( 1, 5, phi );
1942			vec2 sample2 = vogelDiskSample( 2, 5, phi );
1943			vec2 sample3 = vogelDiskSample( 3, 5, phi );
1944			vec2 sample4 = vogelDiskSample( 4, 5, phi );
1945			shadow = (
1946				texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +
1947				texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +
1948				texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +
1949				texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +
1950				texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )
1951			) * 0.2;
1952		}
1953		return mix( 1.0, shadow, shadowIntensity );
1954	}
1955	#elif defined( SHADOWMAP_TYPE_BASIC )
1956	float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1957		float shadow = 1.0;
1958		vec3 lightToPosition = shadowCoord.xyz;
1959		vec3 absVec = abs( lightToPosition );
1960		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
1961		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
1962			float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1963			dp += shadowBias;
1964			vec3 bd3D = normalize( lightToPosition );
1965			float depth = textureCube( shadowMap, bd3D ).r;
1966			#ifdef USE_REVERSED_DEPTH_BUFFER
1967				depth = 1.0 - depth;
1968			#endif
1969			shadow = step( dp, depth );
1970		}
1971		return mix( 1.0, shadow, shadowIntensity );
1972	}
1973	#endif
1974	#endif
1975#endif`,z0=`#if NUM_SPOT_LIGHT_COORDS > 0
1976	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1977	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1978#endif
1979#ifdef USE_SHADOWMAP
1980	#if NUM_DIR_LIGHT_SHADOWS > 0
1981		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
1982		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1983		struct DirectionalLightShadow {
1984			float shadowIntensity;
1985			float shadowBias;
1986			float shadowNormalBias;
1987			float shadowRadius;
1988			vec2 shadowMapSize;
1989		};
1990		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1991	#endif
1992	#if NUM_SPOT_LIGHT_SHADOWS > 0
1993		struct SpotLightShadow {
1994			float shadowIntensity;
1995			float shadowBias;
1996			float shadowNormalBias;
1997			float shadowRadius;
1998			vec2 shadowMapSize;
1999		};
2000		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
2001	#endif
2002	#if NUM_POINT_LIGHT_SHADOWS > 0
2003		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
2004		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
2005		struct PointLightShadow {
2006			float shadowIntensity;
2007			float shadowBias;
2008			float shadowNormalBias;
2009			float shadowRadius;
2010			vec2 shadowMapSize;
2011			float shadowCameraNear;
2012			float shadowCameraFar;
2013		};
2014		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
2015	#endif
2016#endif`,V0=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
2017	#ifdef HAS_NORMAL
2018		vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
2019	#else
2020		vec3 shadowWorldNormal = vec3( 0.0 );
2021	#endif
2022	vec4 shadowWorldPosition;
2023#endif
2024#if defined( USE_SHADOWMAP )
2025	#if NUM_DIR_LIGHT_SHADOWS > 0
2026		#pragma unroll_loop_start
2027		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
2028			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
2029			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
2030		}
2031		#pragma unroll_loop_end
2032	#endif
2033	#if NUM_POINT_LIGHT_SHADOWS > 0
2034		#pragma unroll_loop_start
2035		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2036			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
2037			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
2038		}
2039		#pragma unroll_loop_end
2040	#endif
2041#endif
2042#if NUM_SPOT_LIGHT_COORDS > 0
2043	#pragma unroll_loop_start
2044	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
2045		shadowWorldPosition = worldPosition;
2046		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
2047			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
2048		#endif
2049		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
2050	}
2051	#pragma unroll_loop_end
2052#endif`,k0=`float getShadowMask() {
2053	float shadow = 1.0;
2054	#ifdef USE_SHADOWMAP
2055	#if NUM_DIR_LIGHT_SHADOWS > 0
2056	DirectionalLightShadow directionalLight;
2057	#pragma unroll_loop_start
2058	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
2059		directionalLight = directionalLightShadows[ i ];
2060		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
2061	}
2062	#pragma unroll_loop_end
2063	#endif
2064	#if NUM_SPOT_LIGHT_SHADOWS > 0
2065	SpotLightShadow spotLight;
2066	#pragma unroll_loop_start
2067	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
2068		spotLight = spotLightShadows[ i ];
2069		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
2070	}
2071	#pragma unroll_loop_end
2072	#endif
2073	#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
2074	PointLightShadow pointLight;
2075	#pragma unroll_loop_start
2076	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2077		pointLight = pointLightShadows[ i ];
2078		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
2079	}
2080	#pragma unroll_loop_end
2081	#endif
2082	#endif
2083	return shadow;
2084}`,G0=`#ifdef USE_SKINNING
2085	mat4 boneMatX = getBoneMatrix( skinIndex.x );
2086	mat4 boneMatY = getBoneMatrix( skinIndex.y );
2087	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
2088	mat4 boneMatW = getBoneMatrix( skinIndex.w );
2089#endif`,H0=`#ifdef USE_SKINNING
2090	uniform mat4 bindMatrix;
2091	uniform mat4 bindMatrixInverse;
2092	uniform highp sampler2D boneTexture;
2093	mat4 getBoneMatrix( const in float i ) {
2094		int size = textureSize( boneTexture, 0 ).x;
2095		int j = int( i ) * 4;
2096		int x = j % size;
2097		int y = j / size;
2098		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
2099		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
2100		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
2101		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2102		return mat4( v1, v2, v3, v4 );
2103	}
2104#endif`,W0=`#ifdef USE_SKINNING
2105	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2106	vec4 skinned = vec4( 0.0 );
2107	skinned += boneMatX * skinVertex * skinWeight.x;
2108	skinned += boneMatY * skinVertex * skinWeight.y;
2109	skinned += boneMatZ * skinVertex * skinWeight.z;
2110	skinned += boneMatW * skinVertex * skinWeight.w;
2111	transformed = ( bindMatrixInverse * skinned ).xyz;
2112#endif`,X0=`#ifdef USE_SKINNING
2113	mat4 skinMatrix = mat4( 0.0 );
2114	skinMatrix += skinWeight.x * boneMatX;
2115	skinMatrix += skinWeight.y * boneMatY;
2116	skinMatrix += skinWeight.z * boneMatZ;
2117	skinMatrix += skinWeight.w * boneMatW;
2118	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
2119	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
2120	#ifdef USE_TANGENT
2121		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2122	#endif
2123#endif`,q0=`float specularStrength;
2124#ifdef USE_SPECULARMAP
2125	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2126	specularStrength = texelSpecular.r;
2127#else
2128	specularStrength = 1.0;
2129#endif`,Y0=`#ifdef USE_SPECULARMAP
2130	uniform sampler2D specularMap;
2131#endif`,Z0=`#if defined( TONE_MAPPING )
2132	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2133#endif`,J0=`#ifndef saturate
2134#define saturate( a ) clamp( a, 0.0, 1.0 )
2135#endif
2136uniform float toneMappingExposure;
2137vec3 LinearToneMapping( vec3 color ) {
2138	return saturate( toneMappingExposure * color );
2139}
2140vec3 ReinhardToneMapping( vec3 color ) {
2141	color *= toneMappingExposure;
2142	return saturate( color / ( vec3( 1.0 ) + color ) );
2143}
2144vec3 CineonToneMapping( vec3 color ) {
2145	color *= toneMappingExposure;
2146	color = max( vec3( 0.0 ), color - 0.004 );
2147	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
2148}
2149vec3 RRTAndODTFit( vec3 v ) {
2150	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
2151	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
2152	return a / b;
2153}
2154vec3 ACESFilmicToneMapping( vec3 color ) {
2155	const mat3 ACESInputMat = mat3(
2156		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
2157		vec3( 0.04823, 0.01566, 0.83777 )
2158	);
2159	const mat3 ACESOutputMat = mat3(
2160		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
2161		vec3( -0.07367, -0.00605,  1.07602 )
2162	);
2163	color *= toneMappingExposure / 0.6;
2164	color = ACESInputMat * color;
2165	color = RRTAndODTFit( color );
2166	color = ACESOutputMat * color;
2167	return saturate( color );
2168}
2169const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
2170	vec3( 1.6605, - 0.1246, - 0.0182 ),
2171	vec3( - 0.5876, 1.1329, - 0.1006 ),
2172	vec3( - 0.0728, - 0.0083, 1.1187 )
2173);
2174const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
2175	vec3( 0.6274, 0.0691, 0.0164 ),
2176	vec3( 0.3293, 0.9195, 0.0880 ),
2177	vec3( 0.0433, 0.0113, 0.8956 )
2178);
2179vec3 agxDefaultContrastApprox( vec3 x ) {
2180	vec3 x2 = x * x;
2181	vec3 x4 = x2 * x2;
2182	return + 15.5 * x4 * x2
2183		- 40.14 * x4 * x
2184		+ 31.96 * x4
2185		- 6.868 * x2 * x
2186		+ 0.4298 * x2
2187		+ 0.1191 * x
2188		- 0.00232;
2189}
2190vec3 AgXToneMapping( vec3 color ) {
2191	const mat3 AgXInsetMatrix = mat3(
2192		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
2193		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
2194		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
2195	);
2196	const mat3 AgXOutsetMatrix = mat3(
2197		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
2198		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
2199		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
2200	);
2201	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
2202	color *= toneMappingExposure;
2203	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
2204	color = AgXInsetMatrix * color;
2205	color = max( color, 1e-10 );	color = log2( color );
2206	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
2207	color = clamp( color, 0.0, 1.0 );
2208	color = agxDefaultContrastApprox( color );
2209	color = AgXOutsetMatrix * color;
2210	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
2211	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
2212	color = clamp( color, 0.0, 1.0 );
2213	return color;
2214}
2215vec3 NeutralToneMapping( vec3 color ) {
2216	const float StartCompression = 0.8 - 0.04;
2217	const float Desaturation = 0.15;
2218	color *= toneMappingExposure;
2219	float x = min( color.r, min( color.g, color.b ) );
2220	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
2221	color -= offset;
2222	float peak = max( color.r, max( color.g, color.b ) );
2223	if ( peak < StartCompression ) return color;
2224	float d = 1. - StartCompression;
2225	float newPeak = 1. - d * d / ( peak + d - StartCompression );
2226	color *= newPeak / peak;
2227	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2228	return mix( color, vec3( newPeak ), g );
2229}
2230vec3 CustomToneMapping( vec3 color ) { return color; }`,$0=`#ifdef USE_TRANSMISSION
2231	material.transmission = transmission;
2232	material.transmissionAlpha = 1.0;
2233	material.thickness = thickness;
2234	material.attenuationDistance = attenuationDistance;
2235	material.attenuationColor = attenuationColor;
2236	#ifdef USE_TRANSMISSIONMAP
2237		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
2238	#endif
2239	#ifdef USE_THICKNESSMAP
2240		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
2241	#endif
2242	vec3 pos = vWorldPosition;
2243	vec3 v = normalize( cameraPosition - pos );
2244	vec3 n = inverseTransformDirection( normal, viewMatrix );
2245	vec4 transmitted = getIBLVolumeRefraction(
2246		n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,
2247		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
2248		material.attenuationColor, material.attenuationDistance );
2249	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2250	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2251#endif`,K0=`#ifdef USE_TRANSMISSION
2252	uniform float transmission;
2253	uniform float thickness;
2254	uniform float attenuationDistance;
2255	uniform vec3 attenuationColor;
2256	#ifdef USE_TRANSMISSIONMAP
2257		uniform sampler2D transmissionMap;
2258	#endif
2259	#ifdef USE_THICKNESSMAP
2260		uniform sampler2D thicknessMap;
2261	#endif
2262	uniform vec2 transmissionSamplerSize;
2263	uniform sampler2D transmissionSamplerMap;
2264	uniform mat4 modelMatrix;
2265	uniform mat4 projectionMatrix;
2266	varying vec3 vWorldPosition;
2267	float w0( float a ) {
2268		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
2269	}
2270	float w1( float a ) {
2271		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
2272	}
2273	float w2( float a ){
2274		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
2275	}
2276	float w3( float a ) {
2277		return ( 1.0 / 6.0 ) * ( a * a * a );
2278	}
2279	float g0( float a ) {
2280		return w0( a ) + w1( a );
2281	}
2282	float g1( float a ) {
2283		return w2( a ) + w3( a );
2284	}
2285	float h0( float a ) {
2286		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
2287	}
2288	float h1( float a ) {
2289		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
2290	}
2291	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
2292		uv = uv * texelSize.zw + 0.5;
2293		vec2 iuv = floor( uv );
2294		vec2 fuv = fract( uv );
2295		float g0x = g0( fuv.x );
2296		float g1x = g1( fuv.x );
2297		float h0x = h0( fuv.x );
2298		float h1x = h1( fuv.x );
2299		float h0y = h0( fuv.y );
2300		float h1y = h1( fuv.y );
2301		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2302		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2303		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2304		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2305		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
2306			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
2307	}
2308	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
2309		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
2310		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
2311		vec2 fLodSizeInv = 1.0 / fLodSize;
2312		vec2 cLodSizeInv = 1.0 / cLodSize;
2313		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
2314		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
2315		return mix( fSample, cSample, fract( lod ) );
2316	}
2317	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
2318		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
2319		vec3 modelScale;
2320		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
2321		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
2322		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
2323		return normalize( refractionVector ) * thickness * modelScale;
2324	}
2325	float applyIorToRoughness( const in float roughness, const in float ior ) {
2326		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
2327	}
2328	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
2329		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
2330		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
2331	}
2332	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
2333		if ( isinf( attenuationDistance ) ) {
2334			return vec3( 1.0 );
2335		} else {
2336			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
2337			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
2338		}
2339	}
2340	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
2341		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
2342		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
2343		const in vec3 attenuationColor, const in float attenuationDistance ) {
2344		vec4 transmittedLight;
2345		vec3 transmittance;
2346		#ifdef USE_DISPERSION
2347			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
2348			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
2349			for ( int i = 0; i < 3; i ++ ) {
2350				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
2351				vec3 refractedRayExit = position + transmissionRay;
2352				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2353				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2354				refractionCoords += 1.0;
2355				refractionCoords /= 2.0;
2356				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
2357				transmittedLight[ i ] = transmissionSample[ i ];
2358				transmittedLight.a += transmissionSample.a;
2359				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
2360			}
2361			transmittedLight.a /= 3.0;
2362		#else
2363			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
2364			vec3 refractedRayExit = position + transmissionRay;
2365			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2366			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2367			refractionCoords += 1.0;
2368			refractionCoords /= 2.0;
2369			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
2370			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
2371		#endif
2372		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
2373		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
2374		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2375		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2376	}
2377#endif`,Q0=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2378	varying vec2 vUv;
2379#endif
2380#ifdef USE_MAP
2381	varying vec2 vMapUv;
2382#endif
2383#ifdef USE_ALPHAMAP
2384	varying vec2 vAlphaMapUv;
2385#endif
2386#ifdef USE_LIGHTMAP
2387	varying vec2 vLightMapUv;
2388#endif
2389#ifdef USE_AOMAP
2390	varying vec2 vAoMapUv;
2391#endif
2392#ifdef USE_BUMPMAP
2393	varying vec2 vBumpMapUv;
2394#endif
2395#ifdef USE_NORMALMAP
2396	varying vec2 vNormalMapUv;
2397#endif
2398#ifdef USE_EMISSIVEMAP
2399	varying vec2 vEmissiveMapUv;
2400#endif
2401#ifdef USE_METALNESSMAP
2402	varying vec2 vMetalnessMapUv;
2403#endif
2404#ifdef USE_ROUGHNESSMAP
2405	varying vec2 vRoughnessMapUv;
2406#endif
2407#ifdef USE_ANISOTROPYMAP
2408	varying vec2 vAnisotropyMapUv;
2409#endif
2410#ifdef USE_CLEARCOATMAP
2411	varying vec2 vClearcoatMapUv;
2412#endif
2413#ifdef USE_CLEARCOAT_NORMALMAP
2414	varying vec2 vClearcoatNormalMapUv;
2415#endif
2416#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2417	varying vec2 vClearcoatRoughnessMapUv;
2418#endif
2419#ifdef USE_IRIDESCENCEMAP
2420	varying vec2 vIridescenceMapUv;
2421#endif
2422#ifdef USE_IRIDESCENCE_THICKNESSMAP
2423	varying vec2 vIridescenceThicknessMapUv;
2424#endif
2425#ifdef USE_SHEEN_COLORMAP
2426	varying vec2 vSheenColorMapUv;
2427#endif
2428#ifdef USE_SHEEN_ROUGHNESSMAP
2429	varying vec2 vSheenRoughnessMapUv;
2430#endif
2431#ifdef USE_SPECULARMAP
2432	varying vec2 vSpecularMapUv;
2433#endif
2434#ifdef USE_SPECULAR_COLORMAP
2435	varying vec2 vSpecularColorMapUv;
2436#endif
2437#ifdef USE_SPECULAR_INTENSITYMAP
2438	varying vec2 vSpecularIntensityMapUv;
2439#endif
2440#ifdef USE_TRANSMISSIONMAP
2441	uniform mat3 transmissionMapTransform;
2442	varying vec2 vTransmissionMapUv;
2443#endif
2444#ifdef USE_THICKNESSMAP
2445	uniform mat3 thicknessMapTransform;
2446	varying vec2 vThicknessMapUv;
2447#endif`,j0=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2448	varying vec2 vUv;
2449#endif
2450#ifdef USE_MAP
2451	uniform mat3 mapTransform;
2452	varying vec2 vMapUv;
2453#endif
2454#ifdef USE_ALPHAMAP
2455	uniform mat3 alphaMapTransform;
2456	varying vec2 vAlphaMapUv;
2457#endif
2458#ifdef USE_LIGHTMAP
2459	uniform mat3 lightMapTransform;
2460	varying vec2 vLightMapUv;
2461#endif
2462#ifdef USE_AOMAP
2463	uniform mat3 aoMapTransform;
2464	varying vec2 vAoMapUv;
2465#endif
2466#ifdef USE_BUMPMAP
2467	uniform mat3 bumpMapTransform;
2468	varying vec2 vBumpMapUv;
2469#endif
2470#ifdef USE_NORMALMAP
2471	uniform mat3 normalMapTransform;
2472	varying vec2 vNormalMapUv;
2473#endif
2474#ifdef USE_DISPLACEMENTMAP
2475	uniform mat3 displacementMapTransform;
2476	varying vec2 vDisplacementMapUv;
2477#endif
2478#ifdef USE_EMISSIVEMAP
2479	uniform mat3 emissiveMapTransform;
2480	varying vec2 vEmissiveMapUv;
2481#endif
2482#ifdef USE_METALNESSMAP
2483	uniform mat3 metalnessMapTransform;
2484	varying vec2 vMetalnessMapUv;
2485#endif
2486#ifdef USE_ROUGHNESSMAP
2487	uniform mat3 roughnessMapTransform;
2488	varying vec2 vRoughnessMapUv;
2489#endif
2490#ifdef USE_ANISOTROPYMAP
2491	uniform mat3 anisotropyMapTransform;
2492	varying vec2 vAnisotropyMapUv;
2493#endif
2494#ifdef USE_CLEARCOATMAP
2495	uniform mat3 clearcoatMapTransform;
2496	varying vec2 vClearcoatMapUv;
2497#endif
2498#ifdef USE_CLEARCOAT_NORMALMAP
2499	uniform mat3 clearcoatNormalMapTransform;
2500	varying vec2 vClearcoatNormalMapUv;
2501#endif
2502#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2503	uniform mat3 clearcoatRoughnessMapTransform;
2504	varying vec2 vClearcoatRoughnessMapUv;
2505#endif
2506#ifdef USE_SHEEN_COLORMAP
2507	uniform mat3 sheenColorMapTransform;
2508	varying vec2 vSheenColorMapUv;
2509#endif
2510#ifdef USE_SHEEN_ROUGHNESSMAP
2511	uniform mat3 sheenRoughnessMapTransform;
2512	varying vec2 vSheenRoughnessMapUv;
2513#endif
2514#ifdef USE_IRIDESCENCEMAP
2515	uniform mat3 iridescenceMapTransform;
2516	varying vec2 vIridescenceMapUv;
2517#endif
2518#ifdef USE_IRIDESCENCE_THICKNESSMAP
2519	uniform mat3 iridescenceThicknessMapTransform;
2520	varying vec2 vIridescenceThicknessMapUv;
2521#endif
2522#ifdef USE_SPECULARMAP
2523	uniform mat3 specularMapTransform;
2524	varying vec2 vSpecularMapUv;
2525#endif
2526#ifdef USE_SPECULAR_COLORMAP
2527	uniform mat3 specularColorMapTransform;
2528	varying vec2 vSpecularColorMapUv;
2529#endif
2530#ifdef USE_SPECULAR_INTENSITYMAP
2531	uniform mat3 specularIntensityMapTransform;
2532	varying vec2 vSpecularIntensityMapUv;
2533#endif
2534#ifdef USE_TRANSMISSIONMAP
2535	uniform mat3 transmissionMapTransform;
2536	varying vec2 vTransmissionMapUv;
2537#endif
2538#ifdef USE_THICKNESSMAP
2539	uniform mat3 thicknessMapTransform;
2540	varying vec2 vThicknessMapUv;
2541#endif`,e_=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2542	vUv = vec3( uv, 1 ).xy;
2543#endif
2544#ifdef USE_MAP
2545	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
2546#endif
2547#ifdef USE_ALPHAMAP
2548	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
2549#endif
2550#ifdef USE_LIGHTMAP
2551	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
2552#endif
2553#ifdef USE_AOMAP
2554	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
2555#endif
2556#ifdef USE_BUMPMAP
2557	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
2558#endif
2559#ifdef USE_NORMALMAP
2560	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
2561#endif
2562#ifdef USE_DISPLACEMENTMAP
2563	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
2564#endif
2565#ifdef USE_EMISSIVEMAP
2566	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
2567#endif
2568#ifdef USE_METALNESSMAP
2569	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
2570#endif
2571#ifdef USE_ROUGHNESSMAP
2572	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
2573#endif
2574#ifdef USE_ANISOTROPYMAP
2575	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
2576#endif
2577#ifdef USE_CLEARCOATMAP
2578	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
2579#endif
2580#ifdef USE_CLEARCOAT_NORMALMAP
2581	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
2582#endif
2583#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2584	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
2585#endif
2586#ifdef USE_IRIDESCENCEMAP
2587	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
2588#endif
2589#ifdef USE_IRIDESCENCE_THICKNESSMAP
2590	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
2591#endif
2592#ifdef USE_SHEEN_COLORMAP
2593	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
2594#endif
2595#ifdef USE_SHEEN_ROUGHNESSMAP
2596	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
2597#endif
2598#ifdef USE_SPECULARMAP
2599	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
2600#endif
2601#ifdef USE_SPECULAR_COLORMAP
2602	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
2603#endif
2604#ifdef USE_SPECULAR_INTENSITYMAP
2605	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
2606#endif
2607#ifdef USE_TRANSMISSIONMAP
2608	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
2609#endif
2610#ifdef USE_THICKNESSMAP
2611	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2612#endif`,t_=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2613	vec4 worldPosition = vec4( transformed, 1.0 );
2614	#ifdef USE_BATCHING
2615		worldPosition = batchingMatrix * worldPosition;
2616	#endif
2617	#ifdef USE_INSTANCING
2618		worldPosition = instanceMatrix * worldPosition;
2619	#endif
2620	worldPosition = modelMatrix * worldPosition;
2621#endif`;const n_=`varying vec2 vUv;
2622uniform mat3 uvTransform;
2623void main() {
2624	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2625	gl_Position = vec4( position.xy, 1.0, 1.0 );
2626}`,i_=`uniform sampler2D t2D;
2627uniform float backgroundIntensity;
2628varying vec2 vUv;
2629void main() {
2630	vec4 texColor = texture2D( t2D, vUv );
2631	#ifdef DECODE_VIDEO_TEXTURE
2632		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 );
2633	#endif
2634	texColor.rgb *= backgroundIntensity;
2635	gl_FragColor = texColor;
2636	#include <tonemapping_fragment>
2637	#include <colorspace_fragment>
2638}`,s_=`varying vec3 vWorldDirection;
2639#include <common>
2640void main() {
2641	vWorldDirection = transformDirection( position, modelMatrix );
2642	#include <begin_vertex>
2643	#include <project_vertex>
2644	gl_Position.z = gl_Position.w;
2645}`,r_=`#ifdef ENVMAP_TYPE_CUBE
2646	uniform samplerCube envMap;
2647#elif defined( ENVMAP_TYPE_CUBE_UV )
2648	uniform sampler2D envMap;
2649#endif
2650uniform float backgroundBlurriness;
2651uniform float backgroundIntensity;
2652uniform mat3 backgroundRotation;
2653varying vec3 vWorldDirection;
2654#include <cube_uv_reflection_fragment>
2655void main() {
2656	#ifdef ENVMAP_TYPE_CUBE
2657		vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );
2658	#elif defined( ENVMAP_TYPE_CUBE_UV )
2659		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
2660	#else
2661		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2662	#endif
2663	texColor.rgb *= backgroundIntensity;
2664	gl_FragColor = texColor;
2665	#include <tonemapping_fragment>
2666	#include <colorspace_fragment>
2667}`,a_=`varying vec3 vWorldDirection;
2668#include <common>
2669void main() {
2670	vWorldDirection = transformDirection( position, modelMatrix );
2671	#include <begin_vertex>
2672	#include <project_vertex>
2673	gl_Position.z = gl_Position.w;
2674}`,o_=`uniform samplerCube tCube;
2675uniform float tFlip;
2676uniform float opacity;
2677varying vec3 vWorldDirection;
2678void main() {
2679	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
2680	gl_FragColor = texColor;
2681	gl_FragColor.a *= opacity;
2682	#include <tonemapping_fragment>
2683	#include <colorspace_fragment>
2684}`,l_=`#include <common>
2685#include <batching_pars_vertex>
2686#include <uv_pars_vertex>
2687#include <displacementmap_pars_vertex>
2688#include <morphtarget_pars_vertex>
2689#include <skinning_pars_vertex>
2690#include <logdepthbuf_pars_vertex>
2691#include <clipping_planes_pars_vertex>
2692varying vec2 vHighPrecisionZW;
2693void main() {
2694	#include <uv_vertex>
2695	#include <batching_vertex>
2696	#include <skinbase_vertex>
2697	#include <morphinstance_vertex>
2698	#ifdef USE_DISPLACEMENTMAP
2699		#include <beginnormal_vertex>
2700		#include <morphnormal_vertex>
2701		#include <skinnormal_vertex>
2702	#endif
2703	#include <begin_vertex>
2704	#include <morphtarget_vertex>
2705	#include <skinning_vertex>
2706	#include <displacementmap_vertex>
2707	#include <project_vertex>
2708	#include <logdepthbuf_vertex>
2709	#include <clipping_planes_vertex>
2710	vHighPrecisionZW = gl_Position.zw;
2711}`,c_=`#if DEPTH_PACKING == 3200
2712	uniform float opacity;
2713#endif
2714#include <common>
2715#include <packing>
2716#include <uv_pars_fragment>
2717#include <map_pars_fragment>
2718#include <alphamap_pars_fragment>
2719#include <alphatest_pars_fragment>
2720#include <alphahash_pars_fragment>
2721#include <logdepthbuf_pars_fragment>
2722#include <clipping_planes_pars_fragment>
2723varying vec2 vHighPrecisionZW;
2724void main() {
2725	vec4 diffuseColor = vec4( 1.0 );
2726	#include <clipping_planes_fragment>
2727	#if DEPTH_PACKING == 3200
2728		diffuseColor.a = opacity;
2729	#endif
2730	#include <map_fragment>
2731	#include <alphamap_fragment>
2732	#include <alphatest_fragment>
2733	#include <alphahash_fragment>
2734	#include <logdepthbuf_fragment>
2735	#ifdef USE_REVERSED_DEPTH_BUFFER
2736		float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
2737	#else
2738		float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
2739	#endif
2740	#if DEPTH_PACKING == 3200
2741		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
2742	#elif DEPTH_PACKING == 3201
2743		gl_FragColor = packDepthToRGBA( fragCoordZ );
2744	#elif DEPTH_PACKING == 3202
2745		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
2746	#elif DEPTH_PACKING == 3203
2747		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
2748	#endif
2749}`,h_=`#define DISTANCE
2750varying vec3 vWorldPosition;
2751#include <common>
2752#include <batching_pars_vertex>
2753#include <uv_pars_vertex>
2754#include <displacementmap_pars_vertex>
2755#include <morphtarget_pars_vertex>
2756#include <skinning_pars_vertex>
2757#include <clipping_planes_pars_vertex>
2758void main() {
2759	#include <uv_vertex>
2760	#include <batching_vertex>
2761	#include <skinbase_vertex>
2762	#include <morphinstance_vertex>
2763	#ifdef USE_DISPLACEMENTMAP
2764		#include <beginnormal_vertex>
2765		#include <morphnormal_vertex>
2766		#include <skinnormal_vertex>
2767	#endif
2768	#include <begin_vertex>
2769	#include <morphtarget_vertex>
2770	#include <skinning_vertex>
2771	#include <displacementmap_vertex>
2772	#include <project_vertex>
2773	#include <worldpos_vertex>
2774	#include <clipping_planes_vertex>
2775	vWorldPosition = worldPosition.xyz;
2776}`,u_=`#define DISTANCE
2777uniform vec3 referencePosition;
2778uniform float nearDistance;
2779uniform float farDistance;
2780varying vec3 vWorldPosition;
2781#include <common>
2782#include <uv_pars_fragment>
2783#include <map_pars_fragment>
2784#include <alphamap_pars_fragment>
2785#include <alphatest_pars_fragment>
2786#include <alphahash_pars_fragment>
2787#include <clipping_planes_pars_fragment>
2788void main () {
2789	vec4 diffuseColor = vec4( 1.0 );
2790	#include <clipping_planes_fragment>
2791	#include <map_fragment>
2792	#include <alphamap_fragment>
2793	#include <alphatest_fragment>
2794	#include <alphahash_fragment>
2795	float dist = length( vWorldPosition - referencePosition );
2796	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2797	dist = saturate( dist );
2798	gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
2799}`,d_=`varying vec3 vWorldDirection;
2800#include <common>
2801void main() {
2802	vWorldDirection = transformDirection( position, modelMatrix );
2803	#include <begin_vertex>
2804	#include <project_vertex>
2805}`,f_=`uniform sampler2D tEquirect;
2806varying vec3 vWorldDirection;
2807#include <common>
2808void main() {
2809	vec3 direction = normalize( vWorldDirection );
2810	vec2 sampleUV = equirectUv( direction );
2811	gl_FragColor = texture2D( tEquirect, sampleUV );
2812	#include <tonemapping_fragment>
2813	#include <colorspace_fragment>
2814}`,p_=`uniform float scale;
2815attribute float lineDistance;
2816varying float vLineDistance;
2817#include <common>
2818#include <uv_pars_vertex>
2819#include <color_pars_vertex>
2820#include <fog_pars_vertex>
2821#include <morphtarget_pars_vertex>
2822#include <logdepthbuf_pars_vertex>
2823#include <clipping_planes_pars_vertex>
2824void main() {
2825	vLineDistance = scale * lineDistance;
2826	#include <uv_vertex>
2827	#include <color_vertex>
2828	#include <morphinstance_vertex>
2829	#include <morphcolor_vertex>
2830	#include <begin_vertex>
2831	#include <morphtarget_vertex>
2832	#include <project_vertex>
2833	#include <logdepthbuf_vertex>
2834	#include <clipping_planes_vertex>
2835	#include <fog_vertex>
2836}`,m_=`uniform vec3 diffuse;
2837uniform float opacity;
2838uniform float dashSize;
2839uniform float totalSize;
2840varying float vLineDistance;
2841#include <common>
2842#include <color_pars_fragment>
2843#include <uv_pars_fragment>
2844#include <map_pars_fragment>
2845#include <fog_pars_fragment>
2846#include <logdepthbuf_pars_fragment>
2847#include <clipping_planes_pars_fragment>
2848void main() {
2849	vec4 diffuseColor = vec4( diffuse, opacity );
2850	#include <clipping_planes_fragment>
2851	if ( mod( vLineDistance, totalSize ) > dashSize ) {
2852		discard;
2853	}
2854	vec3 outgoingLight = vec3( 0.0 );
2855	#include <logdepthbuf_fragment>
2856	#include <map_fragment>
2857	#include <color_fragment>
2858	outgoingLight = diffuseColor.rgb;
2859	#include <opaque_fragment>
2860	#include <tonemapping_fragment>
2861	#include <colorspace_fragment>
2862	#include <fog_fragment>
2863	#include <premultiplied_alpha_fragment>
2864}`,g_=`#include <common>
2865#include <batching_pars_vertex>
2866#include <uv_pars_vertex>
2867#include <envmap_pars_vertex>
2868#include <color_pars_vertex>
2869#include <fog_pars_vertex>
2870#include <morphtarget_pars_vertex>
2871#include <skinning_pars_vertex>
2872#include <logdepthbuf_pars_vertex>
2873#include <clipping_planes_pars_vertex>
2874void main() {
2875	#include <uv_vertex>
2876	#include <color_vertex>
2877	#include <morphinstance_vertex>
2878	#include <morphcolor_vertex>
2879	#include <batching_vertex>
2880	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
2881		#include <beginnormal_vertex>
2882		#include <morphnormal_vertex>
2883		#include <skinbase_vertex>
2884		#include <skinnormal_vertex>
2885		#include <defaultnormal_vertex>
2886	#endif
2887	#include <begin_vertex>
2888	#include <morphtarget_vertex>
2889	#include <skinning_vertex>
2890	#include <project_vertex>
2891	#include <logdepthbuf_vertex>
2892	#include <clipping_planes_vertex>
2893	#include <worldpos_vertex>
2894	#include <envmap_vertex>
2895	#include <fog_vertex>
2896}`,__=`uniform vec3 diffuse;
2897uniform float opacity;
2898#ifndef FLAT_SHADED
2899	varying vec3 vNormal;
2900#endif
2901#include <common>
2902#include <dithering_pars_fragment>
2903#include <color_pars_fragment>
2904#include <uv_pars_fragment>
2905#include <map_pars_fragment>
2906#include <alphamap_pars_fragment>
2907#include <alphatest_pars_fragment>
2908#include <alphahash_pars_fragment>
2909#include <aomap_pars_fragment>
2910#include <lightmap_pars_fragment>
2911#include <envmap_common_pars_fragment>
2912#include <envmap_pars_fragment>
2913#include <fog_pars_fragment>
2914#include <specularmap_pars_fragment>
2915#include <logdepthbuf_pars_fragment>
2916#include <clipping_planes_pars_fragment>
2917void main() {
2918	vec4 diffuseColor = vec4( diffuse, opacity );
2919	#include <clipping_planes_fragment>
2920	#include <logdepthbuf_fragment>
2921	#include <map_fragment>
2922	#include <color_fragment>
2923	#include <alphamap_fragment>
2924	#include <alphatest_fragment>
2925	#include <alphahash_fragment>
2926	#include <specularmap_fragment>
2927	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2928	#ifdef USE_LIGHTMAP
2929		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
2930		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
2931	#else
2932		reflectedLight.indirectDiffuse += vec3( 1.0 );
2933	#endif
2934	#include <aomap_fragment>
2935	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
2936	vec3 outgoingLight = reflectedLight.indirectDiffuse;
2937	#include <envmap_fragment>
2938	#include <opaque_fragment>
2939	#include <tonemapping_fragment>
2940	#include <colorspace_fragment>
2941	#include <fog_fragment>
2942	#include <premultiplied_alpha_fragment>
2943	#include <dithering_fragment>
2944}`,x_=`#define LAMBERT
2945varying vec3 vViewPosition;
2946#include <common>
2947#include <batching_pars_vertex>
2948#include <uv_pars_vertex>
2949#include <displacementmap_pars_vertex>
2950#include <envmap_pars_vertex>
2951#include <color_pars_vertex>
2952#include <fog_pars_vertex>
2953#include <normal_pars_vertex>
2954#include <morphtarget_pars_vertex>
2955#include <skinning_pars_vertex>
2956#include <shadowmap_pars_vertex>
2957#include <logdepthbuf_pars_vertex>
2958#include <clipping_planes_pars_vertex>
2959void main() {
2960	#include <uv_vertex>
2961	#include <color_vertex>
2962	#include <morphinstance_vertex>
2963	#include <morphcolor_vertex>
2964	#include <batching_vertex>
2965	#include <beginnormal_vertex>
2966	#include <morphnormal_vertex>
2967	#include <skinbase_vertex>
2968	#include <skinnormal_vertex>
2969	#include <defaultnormal_vertex>
2970	#include <normal_vertex>
2971	#include <begin_vertex>
2972	#include <morphtarget_vertex>
2973	#include <skinning_vertex>
2974	#include <displacementmap_vertex>
2975	#include <project_vertex>
2976	#include <logdepthbuf_vertex>
2977	#include <clipping_planes_vertex>
2978	vViewPosition = - mvPosition.xyz;
2979	#include <worldpos_vertex>
2980	#include <envmap_vertex>
2981	#include <shadowmap_vertex>
2982	#include <fog_vertex>
2983}`,v_=`#define LAMBERT
2984uniform vec3 diffuse;
2985uniform vec3 emissive;
2986uniform float opacity;
2987#include <common>
2988#include <dithering_pars_fragment>
2989#include <color_pars_fragment>
2990#include <uv_pars_fragment>
2991#include <map_pars_fragment>
2992#include <alphamap_pars_fragment>
2993#include <alphatest_pars_fragment>
2994#include <alphahash_pars_fragment>
2995#include <aomap_pars_fragment>
2996#include <lightmap_pars_fragment>
2997#include <emissivemap_pars_fragment>
2998#include <cube_uv_reflection_fragment>
2999#include <envmap_common_pars_fragment>
3000#include <envmap_pars_fragment>
3001#include <envmap_physical_pars_fragment>
3002#include <fog_pars_fragment>
3003#include <bsdfs>
3004#include <lights_pars_begin>
3005#include <normal_pars_fragment>
3006#include <lights_lambert_pars_fragment>
3007#include <shadowmap_pars_fragment>
3008#include <bumpmap_pars_fragment>
3009#include <normalmap_pars_fragment>
3010#include <specularmap_pars_fragment>
3011#include <logdepthbuf_pars_fragment>
3012#include <clipping_planes_pars_fragment>
3013void main() {
3014	vec4 diffuseColor = vec4( diffuse, opacity );
3015	#include <clipping_planes_fragment>
3016	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3017	vec3 totalEmissiveRadiance = emissive;
3018	#include <logdepthbuf_fragment>
3019	#include <map_fragment>
3020	#include <color_fragment>
3021	#include <alphamap_fragment>
3022	#include <alphatest_fragment>
3023	#include <alphahash_fragment>
3024	#include <specularmap_fragment>
3025	#include <normal_fragment_begin>
3026	#include <normal_fragment_maps>
3027	#include <emissivemap_fragment>
3028	#include <lights_lambert_fragment>
3029	#include <lights_fragment_begin>
3030	#include <lights_fragment_maps>
3031	#include <lights_fragment_end>
3032	#include <aomap_fragment>
3033	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3034	#include <envmap_fragment>
3035	#include <opaque_fragment>
3036	#include <tonemapping_fragment>
3037	#include <colorspace_fragment>
3038	#include <fog_fragment>
3039	#include <premultiplied_alpha_fragment>
3040	#include <dithering_fragment>
3041}`,y_=`#define MATCAP
3042varying vec3 vViewPosition;
3043#include <common>
3044#include <batching_pars_vertex>
3045#include <uv_pars_vertex>
3046#include <color_pars_vertex>
3047#include <displacementmap_pars_vertex>
3048#include <fog_pars_vertex>
3049#include <normal_pars_vertex>
3050#include <morphtarget_pars_vertex>
3051#include <skinning_pars_vertex>
3052#include <logdepthbuf_pars_vertex>
3053#include <clipping_planes_pars_vertex>
3054void main() {
3055	#include <uv_vertex>
3056	#include <color_vertex>
3057	#include <morphinstance_vertex>
3058	#include <morphcolor_vertex>
3059	#include <batching_vertex>
3060	#include <beginnormal_vertex>
3061	#include <morphnormal_vertex>
3062	#include <skinbase_vertex>
3063	#include <skinnormal_vertex>
3064	#include <defaultnormal_vertex>
3065	#include <normal_vertex>
3066	#include <begin_vertex>
3067	#include <morphtarget_vertex>
3068	#include <skinning_vertex>
3069	#include <displacementmap_vertex>
3070	#include <project_vertex>
3071	#include <logdepthbuf_vertex>
3072	#include <clipping_planes_vertex>
3073	#include <fog_vertex>
3074	vViewPosition = - mvPosition.xyz;
3075}`,M_=`#define MATCAP
3076uniform vec3 diffuse;
3077uniform float opacity;
3078uniform sampler2D matcap;
3079varying vec3 vViewPosition;
3080#include <common>
3081#include <dithering_pars_fragment>
3082#include <color_pars_fragment>
3083#include <uv_pars_fragment>
3084#include <map_pars_fragment>
3085#include <alphamap_pars_fragment>
3086#include <alphatest_pars_fragment>
3087#include <alphahash_pars_fragment>
3088#include <fog_pars_fragment>
3089#include <normal_pars_fragment>
3090#include <bumpmap_pars_fragment>
3091#include <normalmap_pars_fragme
3091nt>
3092#include <logdepthbuf_pars_fragment>
3093#include <clipping_planes_pars_fragment>
3094void main() {
3095	vec4 diffuseColor = vec4( diffuse, opacity );
3096	#include <clipping_planes_fragment>
3097	#include <logdepthbuf_fragment>
3098	#include <map_fragment>
3099	#include <color_fragment>
3100	#include <alphamap_fragment>
3101	#include <alphatest_fragment>
3102	#include <alphahash_fragment>
3103	#include <normal_fragment_begin>
3104	#include <normal_fragment_maps>
3105	vec3 viewDir = normalize( vViewPosition );
3106	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
3107	vec3 y = cross( viewDir, x );
3108	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
3109	#ifdef USE_MATCAP
3110		vec4 matcapColor = texture2D( matcap, uv );
3111	#else
3112		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
3113	#endif
3114	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
3115	#include <opaque_fragment>
3116	#include <tonemapping_fragment>
3117	#include <colorspace_fragment>
3118	#include <fog_fragment>
3119	#include <premultiplied_alpha_fragment>
3120	#include <dithering_fragment>
3121}`,S_=`#define NORMAL
3122#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3123	varying vec3 vViewPosition;
3124#endif
3125#include <common>
3126#include <batching_pars_vertex>
3127#include <uv_pars_vertex>
3128#include <displacementmap_pars_vertex>
3129#include <normal_pars_vertex>
3130#include <morphtarget_pars_vertex>
3131#include <skinning_pars_vertex>
3132#include <logdepthbuf_pars_vertex>
3133#include <clipping_planes_pars_vertex>
3134void main() {
3135	#include <uv_vertex>
3136	#include <batching_vertex>
3137	#include <beginnormal_vertex>
3138	#include <morphinstance_vertex>
3139	#include <morphnormal_vertex>
3140	#include <skinbase_vertex>
3141	#include <skinnormal_vertex>
3142	#include <defaultnormal_vertex>
3143	#include <normal_vertex>
3144	#include <begin_vertex>
3145	#include <morphtarget_vertex>
3146	#include <skinning_vertex>
3147	#include <displacementmap_vertex>
3148	#include <project_vertex>
3149	#include <logdepthbuf_vertex>
3150	#include <clipping_planes_vertex>
3151#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3152	vViewPosition = - mvPosition.xyz;
3153#endif
3154}`,b_=`#define NORMAL
3155uniform float opacity;
3156#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3157	varying vec3 vViewPosition;
3158#endif
3159#include <uv_pars_fragment>
3160#include <normal_pars_fragment>
3161#include <bumpmap_pars_fragment>
3162#include <normalmap_pars_fragment>
3163#include <logdepthbuf_pars_fragment>
3164#include <clipping_planes_pars_fragment>
3165void main() {
3166	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
3167	#include <clipping_planes_fragment>
3168	#include <logdepthbuf_fragment>
3169	#include <normal_fragment_begin>
3170	#include <normal_fragment_maps>
3171	gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );
3172	#ifdef OPAQUE
3173		gl_FragColor.a = 1.0;
3174	#endif
3175}`,T_=`#define PHONG
3176varying vec3 vViewPosition;
3177#include <common>
3178#include <batching_pars_vertex>
3179#include <uv_pars_vertex>
3180#include <displacementmap_pars_vertex>
3181#include <envmap_pars_vertex>
3182#include <color_pars_vertex>
3183#include <fog_pars_vertex>
3184#include <normal_pars_vertex>
3185#include <morphtarget_pars_vertex>
3186#include <skinning_pars_vertex>
3187#include <shadowmap_pars_vertex>
3188#include <logdepthbuf_pars_vertex>
3189#include <clipping_planes_pars_vertex>
3190void main() {
3191	#include <uv_vertex>
3192	#include <color_vertex>
3193	#include <morphcolor_vertex>
3194	#include <batching_vertex>
3195	#include <beginnormal_vertex>
3196	#include <morphinstance_vertex>
3197	#include <morphnormal_vertex>
3198	#include <skinbase_vertex>
3199	#include <skinnormal_vertex>
3200	#include <defaultnormal_vertex>
3201	#include <normal_vertex>
3202	#include <begin_vertex>
3203	#include <morphtarget_vertex>
3204	#include <skinning_vertex>
3205	#include <displacementmap_vertex>
3206	#include <project_vertex>
3207	#include <logdepthbuf_vertex>
3208	#include <clipping_planes_vertex>
3209	vViewPosition = - mvPosition.xyz;
3210	#include <worldpos_vertex>
3211	#include <envmap_vertex>
3212	#include <shadowmap_vertex>
3213	#include <fog_vertex>
3214}`,A_=`#define PHONG
3215uniform vec3 diffuse;
3216uniform vec3 emissive;
3217uniform vec3 specular;
3218uniform float shininess;
3219uniform float opacity;
3220#include <common>
3221#include <dithering_pars_fragment>
3222#include <color_pars_fragment>
3223#include <uv_pars_fragment>
3224#include <map_pars_fragment>
3225#include <alphamap_pars_fragment>
3226#include <alphatest_pars_fragment>
3227#include <alphahash_pars_fragment>
3228#include <aomap_pars_fragment>
3229#include <lightmap_pars_fragment>
3230#include <emissivemap_pars_fragment>
3231#include <cube_uv_reflection_fragment>
3232#include <envmap_common_pars_fragment>
3233#include <envmap_pars_fragment>
3234#include <envmap_physical_pars_fragment>
3235#include <fog_pars_fragment>
3236#include <bsdfs>
3237#include <lights_pars_begin>
3238#include <normal_pars_fragment>
3239#include <lights_phong_pars_fragment>
3240#include <shadowmap_pars_fragment>
3241#include <bumpmap_pars_fragment>
3242#include <normalmap_pars_fragment>
3243#include <specularmap_pars_fragment>
3244#include <logdepthbuf_pars_fragment>
3245#include <clipping_planes_pars_fragment>
3246void main() {
3247	vec4 diffuseColor = vec4( diffuse, opacity );
3248	#include <clipping_planes_fragment>
3249	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3250	vec3 totalEmissiveRadiance = emissive;
3251	#include <logdepthbuf_fragment>
3252	#include <map_fragment>
3253	#include <color_fragment>
3254	#include <alphamap_fragment>
3255	#include <alphatest_fragment>
3256	#include <alphahash_fragment>
3257	#include <specularmap_fragment>
3258	#include <normal_fragment_begin>
3259	#include <normal_fragment_maps>
3260	#include <emissivemap_fragment>
3261	#include <lights_phong_fragment>
3262	#include <lights_fragment_begin>
3263	#include <lights_fragment_maps>
3264	#include <lights_fragment_end>
3265	#include <aomap_fragment>
3266	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
3267	#include <envmap_fragment>
3268	#include <opaque_fragment>
3269	#include <tonemapping_fragment>
3270	#include <colorspace_fragment>
3271	#include <fog_fragment>
3272	#include <premultiplied_alpha_fragment>
3273	#include <dithering_fragment>
3274}`,E_=`#define STANDARD
3275varying vec3 vViewPosition;
3276#ifdef USE_TRANSMISSION
3277	varying vec3 vWorldPosition;
3278#endif
3279#include <common>
3280#include <batching_pars_vertex>
3281#include <uv_pars_vertex>
3282#include <displacementmap_pars_vertex>
3283#include <color_pars_vertex>
3284#include <fog_pars_vertex>
3285#include <normal_pars_vertex>
3286#include <morphtarget_pars_vertex>
3287#include <skinning_pars_vertex>
3288#include <shadowmap_pars_vertex>
3289#include <logdepthbuf_pars_vertex>
3290#include <clipping_planes_pars_vertex>
3291void main() {
3292	#include <uv_vertex>
3293	#include <color_vertex>
3294	#include <morphinstance_vertex>
3295	#include <morphcolor_vertex>
3296	#include <batching_vertex>
3297	#include <beginnormal_vertex>
3298	#include <morphnormal_vertex>
3299	#include <skinbase_vertex>
3300	#include <skinnormal_vertex>
3301	#include <defaultnormal_vertex>
3302	#include <normal_vertex>
3303	#include <begin_vertex>
3304	#include <morphtarget_vertex>
3305	#include <skinning_vertex>
3306	#include <displacementmap_vertex>
3307	#include <project_vertex>
3308	#include <logdepthbuf_vertex>
3309	#include <clipping_planes_vertex>
3310	vViewPosition = - mvPosition.xyz;
3311	#include <worldpos_vertex>
3312	#include <shadowmap_vertex>
3313	#include <fog_vertex>
3314#ifdef USE_TRANSMISSION
3315	vWorldPosition = worldPosition.xyz;
3316#endif
3317}`,w_=`#define STANDARD
3318#ifdef PHYSICAL
3319	#define IOR
3320	#define USE_SPECULAR
3321#endif
3322uniform vec3 diffuse;
3323uniform vec3 emissive;
3324uniform float roughness;
3325uniform float metalness;
3326uniform float opacity;
3327#ifdef IOR
3328	uniform float ior;
3329#endif
3330#ifdef USE_SPECULAR
3331	uniform float specularIntensity;
3332	uniform vec3 specularColor;
3333	#ifdef USE_SPECULAR_COLORMAP
3334		uniform sampler2D specularColorMap;
3335	#endif
3336	#ifdef USE_SPECULAR_INTENSITYMAP
3337		uniform sampler2D specularIntensityMap;
3338	#endif
3339#endif
3340#ifdef USE_CLEARCOAT
3341	uniform float clearcoat;
3342	uniform float clearcoatRoughness;
3343#endif
3344#ifdef USE_DISPERSION
3345	uniform float dispersion;
3346#endif
3347#ifdef USE_IRIDESCENCE
3348	uniform float iridescence;
3349	uniform float iridescenceIOR;
3350	uniform float iridescenceThicknessMinimum;
3351	uniform float iridescenceThicknessMaximum;
3352#endif
3353#ifdef USE_SHEEN
3354	uniform vec3 sheenColor;
3355	uniform float sheenRoughness;
3356	#ifdef USE_SHEEN_COLORMAP
3357		uniform sampler2D sheenColorMap;
3358	#endif
3359	#ifdef USE_SHEEN_ROUGHNESSMAP
3360		uniform sampler2D sheenRoughnessMap;
3361	#endif
3362#endif
3363#ifdef USE_ANISOTROPY
3364	uniform vec2 anisotropyVector;
3365	#ifdef USE_ANISOTROPYMAP
3366		uniform sampler2D anisotropyMap;
3367	#endif
3368#endif
3369varying vec3 vViewPosition;
3370#include <common>
3371#include <dithering_pars_fragment>
3372#include <color_pars_fragment>
3373#include <uv_pars_fragment>
3374#include <map_pars_fragment>
3375#include <alphamap_pars_fragment>
3376#include <alphatest_pars_fragment>
3377#include <alphahash_pars_fragment>
3378#include <aomap_pars_fragment>
3379#include <lightmap_pars_fragment>
3380#include <emissivemap_pars_fragment>
3381#include <iridescence_fragment>
3382#include <cube_uv_reflection_fragment>
3383#include <envmap_common_pars_fragment>
3384#include <envmap_physical_pars_fragment>
3385#include <fog_pars_fragment>
3386#include <lights_pars_begin>
3387#include <normal_pars_fragment>
3388#include <lights_physical_pars_fragment>
3389#include <transmission_pars_fragment>
3390#include <shadowmap_pars_fragment>
3391#include <bumpmap_pars_fragment>
3392#include <normalmap_pars_fragment>
3393#include <clearcoat_pars_fragment>
3394#include <iridescence_pars_fragment>
3395#include <roughnessmap_pars_fragment>
3396#include <metalnessmap_pars_fragment>
3397#include <logdepthbuf_pars_fragment>
3398#include <clipping_planes_pars_fragment>
3399void main() {
3400	vec4 diffuseColor = vec4( diffuse, opacity );
3401	#include <clipping_planes_fragment>
3402	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3403	vec3 totalEmissiveRadiance = emissive;
3404	#include <logdepthbuf_fragment>
3405	#include <map_fragment>
3406	#include <color_fragment>
3407	#include <alphamap_fragment>
3408	#include <alphatest_fragment>
3409	#include <alphahash_fragment>
3410	#include <roughnessmap_fragment>
3411	#include <metalnessmap_fragment>
3412	#include <normal_fragment_begin>
3413	#include <normal_fragment_maps>
3414	#include <clearcoat_normal_fragment_begin>
3415	#include <clearcoat_normal_fragment_maps>
3416	#include <emissivemap_fragment>
3417	#include <lights_physical_fragment>
3418	#include <lights_fragment_begin>
3419	#include <lights_fragment_maps>
3420	#include <lights_fragment_end>
3421	#include <aomap_fragment>
3422	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
3423	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
3424	#include <transmission_fragment>
3425	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
3426	#ifdef USE_SHEEN
3427 
3428		outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;
3429 
3430 	#endif
3431	#ifdef USE_CLEARCOAT
3432		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
3433		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
3434		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
3435	#endif
3436	#include <opaque_fragment>
3437	#include <tonemapping_fragment>
3438	#include <colorspace_fragment>
3439	#include <fog_fragment>
3440	#include <premultiplied_alpha_fragment>
3441	#include <dithering_fragment>
3442}`,C_=`#define TOON
3443varying vec3 vViewPosition;
3444#include <common>
3445#include <batching_pars_vertex>
3446#include <uv_pars_vertex>
3447#include <displacementmap_pars_vertex>
3448#include <color_pars_vertex>
3449#include <fog_pars_vertex>
3450#include <normal_pars_vertex>
3451#include <morphtarget_pars_vertex>
3452#include <skinning_pars_vertex>
3453#include <shadowmap_pars_vertex>
3454#include <logdepthbuf_pars_vertex>
3455#include <clipping_planes_pars_vertex>
3456void main() {
3457	#include <uv_vertex>
3458	#include <color_vertex>
3459	#include <morphinstance_vertex>
3460	#include <morphcolor_vertex>
3461	#include <batching_vertex>
3462	#include <beginnormal_vertex>
3463	#include <morphnormal_vertex>
3464	#include <skinbase_vertex>
3465	#include <skinnormal_vertex>
3466	#include <defaultnormal_vertex>
3467	#include <normal_vertex>
3468	#include <begin_vertex>
3469	#include <morphtarget_vertex>
3470	#include <skinning_vertex>
3471	#include <displacementmap_vertex>
3472	#include <project_vertex>
3473	#include <logdepthbuf_vertex>
3474	#include <clipping_planes_vertex>
3475	vViewPosition = - mvPosition.xyz;
3476	#include <worldpos_vertex>
3477	#include <shadowmap_vertex>
3478	#include <fog_vertex>
3479}`,R_=`#define TOON
3480uniform vec3 diffuse;
3481uniform vec3 emissive;
3482uniform float opacity;
3483#include <common>
3484#include <dithering_pars_fragment>
3485#include <color_pars_fragment>
3486#include <uv_pars_fragment>
3487#include <map_pars_fragment>
3488#include <alphamap_pars_fragment>
3489#include <alphatest_pars_fragment>
3490#include <alphahash_pars_fragment>
3491#include <aomap_pars_fragment>
3492#include <lightmap_pars_fragment>
3493#include <emissivemap_pars_fragment>
3494#include <gradientmap_pars_fragment>
3495#include <fog_pars_fragment>
3496#include <bsdfs>
3497#include <lights_pars_begin>
3498#include <normal_pars_fragment>
3499#include <lights_toon_pars_fragment>
3500#include <shadowmap_pars_fragment>
3501#include <bumpmap_pars_fragment>
3502#include <normalmap_pars_fragment>
3503#include <logdepthbuf_pars_fragment>
3504#include <clipping_planes_pars_fragment>
3505void main() {
3506	vec4 diffuseColor = vec4( diffuse, opacity );
3507	#include <clipping_planes_fragment>
3508	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3509	vec3 totalEmissiveRadiance = emissive;
3510	#include <logdepthbuf_fragment>
3511	#include <map_fragment>
3512	#include <color_fragment>
3513	#include <alphamap_fragment>
3514	#include <alphatest_fragment>
3515	#include <alphahash_fragment>
3516	#include <normal_fragment_begin>
3517	#include <normal_fragment_maps>
3518	#include <emissivemap_fragment>
3519	#include <lights_toon_fragment>
3520	#include <lights_fragment_begin>
3521	#include <lights_fragment_maps>
3522	#include <lights_fragment_end>
3523	#include <aomap_fragment>
3524	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3525	#include <opaque_fragment>
3526	#include <tonemapping_fragment>
3527	#include <colorspace_fragment>
3528	#include <fog_fragment>
3529	#include <premultiplied_alpha_fragment>
3530	#include <dithering_fragment>
3531}`,I_=`uniform float size;
3532uniform float scale;
3533#include <common>
3534#include <color_pars_vertex>
3535#include <fog_pars_vertex>
3536#include <morphtarget_pars_vertex>
3537#include <logdepthbuf_pars_vertex>
3538#include <clipping_planes_pars_vertex>
3539#ifdef USE_POINTS_UV
3540	varying vec2 vUv;
3541	uniform mat3 uvTransform;
3542#endif
3543void main() {
3544	#ifdef USE_POINTS_UV
3545		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
3546	#endif
3547	#include <color_vertex>
3548	#include <morphinstance_vertex>
3549	#include <morphcolor_vertex>
3550	#include <begin_vertex>
3551	#include <morphtarget_vertex>
3552	#include <project_vertex>
3553	gl_PointSize = size;
3554	#ifdef USE_SIZEATTENUATION
3555		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3556		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
3557	#endif
3558	#include <logdepthbuf_vertex>
3559	#include <clipping_planes_vertex>
3560	#include <worldpos_vertex>
3561	#include <fog_vertex>
3562}`,P_=`uniform vec3 diffuse;
3563uniform float opacity;
3564#include <common>
3565#include <color_pars_fragment>
3566#include <map_particle_pars_fragment>
3567#include <alphatest_pars_fragment>
3568#include <alphahash_pars_fragment>
3569#include <fog_pars_fragment>
3570#include <logdepthbuf_pars_fragment>
3571#include <clipping_planes_pars_fragment>
3572void main() {
3573	vec4 diffuseColor = vec4( diffuse, opacity );
3574	#include <clipping_planes_fragment>
3575	vec3 outgoingLight = vec3( 0.0 );
3576	#include <logdepthbuf_fragment>
3577	#include <map_particle_fragment>
3578	#include <color_fragment>
3579	#include <alphatest_fragment>
3580	#include <alphahash_fragment>
3581	outgoingLight = diffuseColor.rgb;
3582	#include <opaque_fragment>
3583	#include <tonemapping_fragment>
3584	#include <colorspace_fragment>
3585	#include <fog_fragment>
3586	#include <premultiplied_alpha_fragment>
3587}`,L_=`#include <common>
3588#include <batching_pars_vertex>
3589#include <fog_pars_vertex>
3590#include <morphtarget_pars_vertex>
3591#include <skinning_pars_vertex>
3592#include <logdepthbuf_pars_vertex>
3593#include <shadowmap_pars_vertex>
3594void main() {
3595	#include <batching_vertex>
3596	#include <beginnormal_vertex>
3597	#include <morphinstance_vertex>
3598	#include <morphnormal_vertex>
3599	#include <skinbase_vertex>
3600	#include <skinnormal_vertex>
3601	#include <defaultnormal_vertex>
3602	#include <begin_vertex>
3603	#include <morphtarget_vertex>
3604	#include <skinning_vertex>
3605	#include <project_vertex>
3606	#include <logdepthbuf_vertex>
3607	#include <worldpos_vertex>
3608	#include <shadowmap_vertex>
3609	#include <fog_vertex>
3610}`,D_=`uniform vec3 color;
3611uniform float opacity;
3612#include <common>
3613#include <fog_pars_fragment>
3614#include <bsdfs>
3615#include <lights_pars_begin>
3616#include <logdepthbuf_pars_fragment>
3617#include <shadowmap_pars_fragment>
3618#include <shadowmask_pars_fragment>
3619void main() {
3620	#include <logdepthbuf_fragment>
3621	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
3622	#include <tonemapping_fragment>
3623	#include <colorspace_fragment>
3624	#include <fog_fragment>
3625	#include <premultiplied_alpha_fragment>
3626}`,U_=`uniform float rotation;
3627uniform vec2 center;
3628#include <common>
3629#include <uv_pars_vertex>
3630#include <fog_pars_vertex>
3631#include <logdepthbuf_pars_vertex>
3632#include <clipping_planes_pars_vertex>
3633void main() {
3634	#include <uv_vertex>
3635	vec4 mvPosition = modelViewMatrix[ 3 ];
3636	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
3637	#ifndef USE_SIZEATTENUATION
3638		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3639		if ( isPerspective ) scale *= - mvPosition.z;
3640	#endif
3641	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
3642	vec2 rotatedPosition;
3643	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
3644	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
3645	mvPosition.xy += rotatedPosition;
3646	gl_Position = projectionMatrix * mvPosition;
3647	#include <logdepthbuf_vertex>
3648	#include <clipping_planes_vertex>
3649	#include <fog_vertex>
3650}`,N_=`uniform vec3 diffuse;
3651uniform float opacity;
3652#include <common>
3653#include <uv_pars_fragment>
3654#include <map_pars_fragment>
3655#include <alphamap_pars_fragment>
3656#include <alphatest_pars_fragment>
3657#include <alphahash_pars_fragment>
3658#include <fog_pars_fragment>
3659#include <logdepthbuf_pars_fragment>
3660#include <clipping_planes_pars_fragment>
3661void main() {
3662	vec4 diffuseColor = vec4( diffuse, opacity );
3663	#include <clipping_planes_fragment>
3664	vec3 outgoingLight = vec3( 0.0 );
3665	#include <logdepthbuf_fragment>
3666	#include <map_fragment>
3667	#include <alphamap_fragment>
3668	#include <alphatest_fragment>
3669	#include <alphahash_fragment>
3670	outgoingLight = diffuseColor.rgb;
3671	#include <opaque_fragment>
3672	#include <tonemapping_fragment>
3673	#include <colorspace_fragment>
3674	#include <fog_fragment>
3675}`,je={alphahash_fragment:ng,alphahash_pars_fragment:ig,alphamap_fragment:sg,alphamap_pars_fragment:rg,alphatest_fragment:ag,alphatest_pars_fragment:og,aomap_fragment:lg,aomap_pars_fragment:cg,batching_pars_vertex:hg,batching_vertex:ug,begin_vertex:dg,beginnormal_vertex:fg,bsdfs:pg,iridescence_fragment:mg,bumpmap_pars_fragment:gg,clipping_planes_fragment:_g,clipping_planes_pars_fragment:xg,clipping_planes_pars_vertex:vg,clipping_planes_vertex:yg,color_fragment:Mg,color_pars_fragment:Sg,color_pars_vertex:bg,color_vertex:Tg,common:Ag,cube_uv_reflection_fragment:Eg,defaultnormal_vertex:wg,displacementmap_pars_vertex:Cg,displacementmap_vertex:Rg,emissivemap_fragment:Ig,emissivemap_pars_fragment:Pg,colorspace_fragment:Lg,colorspace_pars_fragment:Dg,envmap_fragment:Ug,envmap_common_pars_fragment:Ng,envmap_pars_fragment:Fg,envmap_pars_vertex:Og,envmap_physical_pars_fragment:Zg,envmap_vertex:Bg,fog_vertex:zg,fog_pars_vertex:Vg,fog_fragment:kg,fog_pars_fragment:Gg,gradientmap_pars_fragment:Hg,lightmap_pars_fragment:Wg,lights_lambert_fragment:Xg,lights_lambert_pars_fragment:qg,lights_pars_begin:Yg,lights_toon_fragment:Jg,lights_toon_pars_fragment:$g,lights_phong_fragment:Kg,lights_phong_pars_fragment:Qg,lights_physical_fragment:jg,lights_physical_pars_fragment:e0,lights_fragment_begin:t0,lights_fragment_maps:n0,lights_fragment_end:i0,lightprobes_pars_fragment:s0,logdepthbuf_fragment:r0,logdepthbuf_pars_fragment:a0,logdepthbuf_pars_vertex:o0,logdepthbuf_vertex:l0,map_fragment:c0,map_pars_fragment:h0,map_particle_fragment:u0,map_particle_pars_fragment:d0,metalnessmap_fragment:f0,metalnessmap_pars_fragment:p0,morphinstance_vertex:m0,morphcolor_vertex:g0,morphnormal_vertex:_0,morphtarget_pars_vertex:x0,morphtarget_vertex:v0,normal_fragment_begin:y0,normal_fragment_maps:M0,normal_pars_fragment:S0,normal_pars_vertex:b0,normal_vertex:T0,normalmap_pars_fragment:A0,clearcoat_normal_fragment_begin:E0,clearcoat_normal_fragment_maps:w0,clearcoat_pars_fragment:C0,iridescence_pars_fragment:R0,opaque_fragment:I0,packing:P0,premultiplied_alpha_fragment:L0,project_vertex:D0,dithering_fragment:U0,dithering_pars_fragment:N0,roughnessmap_fragment:F0,roughnessmap_pars_fragment:O0,shadowmap_pars_fragment:B0,shadowmap_pars_vertex:z0,shadowmap_vertex:V0,shadowmask_pars_fragment:k0,skinbase_vertex:G0,skinning_pars_vertex:H0,skinning_vertex:W0,skinnormal_vertex:X0,specularmap_fragment:q0,specularmap_pars_fragment:Y0,tonemapping_fragment:Z0,tonemapping_pars_fragment:J0,transmission_fragment:$0,transmission_pars_fragment:K0,uv_pars_fragment:Q0,uv_pars_vertex:j0,uv_vertex:e_,worldpos_vertex:t_,background_vert:n_,background_frag:i_,backgroundCube_vert:s_,backgroundCube_frag:r_,cube_vert:a_,cube_frag:o_,depth_vert:l_,depth_frag:c_,distance_vert:h_,distance_frag:u_,equirect_vert:d_,equirect_frag:f_,linedashed_vert:p_,linedashed_frag:m_,meshbasic_vert:g_,meshbasic_frag:__,meshlambert_vert:x_,meshlambert_frag:v_,meshmatcap_vert:y_,meshmatcap_frag:M_,meshnormal_vert:S_,meshnormal_frag:b_,meshphong_vert:T_,meshphong_frag:A_,meshphysical_vert:E_,meshphysical_frag:w_,meshtoon_vert:C_,meshtoon_frag:R_,points_vert:I_,points_frag:P_,shadow_vert:L_,shadow_frag:D_,sprite_vert:U_,sprite_frag:N_},me={common:{diffuse:{value:new be(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new qe},alphaMap:{value:null},alphaMapTransform:{value:new qe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new qe}},envmap:{envMap:{value:null},envMapRotation:{value:new qe},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new qe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new qe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new qe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new qe},normalScale:{value:new K(1,1)}}
vendor: 7,564 bytes, line 3675
3675,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new qe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new qe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new qe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new qe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new be(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},probesSH:{value:null},probesMin:{value:new C},probesMax:{value:new C},probesResolution:{value:new C}},points:{diffuse:{value:new be(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new qe},alphaTest:{value:0},uvTransform:{value:new qe}},sprite:{diffuse:{value:new be(16777215)},opacity:{value:1},center:{value:new K(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new qe},alphaMap:{value:null},alphaMapTransform:{value:new qe},alphaTest:{value:0}}},Sn={basic:{uniforms:zt([me.common,me.specularmap,me.envmap,me.aomap,me.lightmap,me.fog]),vertexShader:je.meshbasic_vert,fragmentShader:je.meshbasic_frag},lambert:{uniforms:zt([me.common,me.specularmap,me.envmap,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.fog,me.lights,{emissive:{value:new be(0)},envMapIntensity:{value:1}}]),vertexShader:je.meshlambert_vert,fragmentShader:je.meshlambert_frag},phong:{uniforms:zt([me.common,me.specularmap,me.envmap,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.fog,me.lights,{emissive:{value:new be(0)},specular:{value:new be(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:je.meshphong_vert,fragmentShader:je.meshphong_frag},standard:{uniforms:zt([me.common,me.envmap,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.roughnessmap,me.metalnessmap,me.fog,me.lights,{emissive:{value:new be(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:je.meshphysical_vert,fragmentShader:je.meshphysical_frag},toon:{uniforms:zt([me.common,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.gradientmap,me.fog,me.lights,{emissive:{value:new be(0)}}]),vertexShader:je.meshtoon_vert,fragmentShader:je.meshtoon_frag},matcap:{uniforms:zt([me.common,me.bumpmap,me.normalmap,me.displacementmap,me.fog,{matcap:{value:null}}]),vertexShader:je.meshmatcap_vert,fragmentShader:je.meshmatcap_frag},points:{uniforms:zt([me.points,me.fog]),vertexShader:je.points_vert,fragmentShader:je.points_frag},dashed:{uniforms:zt([me.common,me.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:je.linedashed_vert,fragmentShader:je.linedashed_frag},depth:{uniforms:zt([me.common,me.displacementmap]),vertexShader:je.depth_vert,fragmentShader:je.depth_frag},normal:{uniforms:zt([me.common,me.bumpmap,me.normalmap,me.displacementmap,{opacity:{value:1}}]),vertexShader:je.meshnormal_vert,fragmentShader:je.meshnormal_frag},sprite:{uniforms:zt([me.sprite,me.fog]),vertexShader:je.sprite_vert,fragmentShader:je.sprite_frag},background:{uniforms:{uvTransform:{value:new qe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:je.background_vert,fragmentShader:je.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new qe}},vertexShader:je.backgroundCube_vert,fragmentShader:je.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:je.cube_vert,fragmentShader:je.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:je.equirect_vert,fragmentShader:je.equirect_frag},distance:{uniforms:zt([me.common,me.displacementmap,{referencePosition:{value:new C},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:je.distance_vert,fragmentShader:je.distance_frag},shadow:{uniforms:zt([me.lights,me.fog,{color:{value:new be(0)},opacity:{value:1}}]),vertexShader:je.shadow_vert,fragmentShader:je.shadow_frag}};Sn.physical={uniforms:zt([Sn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new qe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new qe},clearcoatNormalScale:{value:new K(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new qe},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new qe},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new qe},sheen:{value:0},sheenColor:{value:new be(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new qe},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new qe},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new qe},transmissionSamplerSize:{value:new K},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new qe},attenuationDistance:{value:0},attenuationColor:{value:new be(0)},specularColor:{value:new be(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new qe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new qe},anisotropyVector:{value:new K},anisotropyMap:{value:null},anisotropyMapTransform:{value:new qe}}]),vertexShader:je.meshphysical_vert,fragmentShader:je.meshphysical_frag};const Zr={r:0,b:0,g:0},F_=new Ge,ld=new qe;ld.set(-1,0,0,0,1,0,0,0,1);function O_(s,e,t,n,i,r){const a=new be(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 w=s.xr.getEnvironmentBlendMode();w==="additive"?t.buffers.color.setClear(0,0,0,1,r):w==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,r),(s.autoClear||y)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),s.clear(s.autoClearColor,s.autoClearDepth,s.autoClearStencil))}function _(x,y){const M=f(y);M&&(M.isCubeTexture||M.mapping===Qs)?(c===void 0&&(c=new Ct(new xs(1,1,1),new pn({name:"Backgroun
3675dCubeMaterial",uniforms:_s(Sn.backgroundCube.uniforms),vertexShader:Sn.backgroundCube.vertexShader,fragmentShader:Sn.backgroundCube.fragmentShader,side:Yt,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(w,b,R){this.matrixWorld.copyPosition(R.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),c.material.uniforms.envMap.value=M,c.material.uniforms.backgroundBlurriness.value=y.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(F_.makeRotationFromEuler(y.backgroundRotation)).transpose(),M.isCubeTexture&&M.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(ld),c.material.toneMapped=tt.getTransfer(M.colorSpace)!==ct,(h!==M||d!==M.version||u!==s.toneMapping)&&(c.material.needsUpdate=!0,h=M,d=M.version,u=s.toneMapping),c.layers.enableAll(),x.unshift(c,c.geometry,c.material,0,0,null)):M&&M.isTexture&&(l===void 0&&(l=new Ct(new tr(2,2),new pn({name:"BackgroundMaterial",uniforms:_s(Sn.background.uniforms),vertexShader:Sn.background.vertexShader,fragmentShader:Sn.background.fragmentShader,side:si,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=tt.getTransfer(M.colorSpace)!==ct,M.matrixAutoUpdate===!0&&M.updateMatrix(),l.material.uniforms.uvTransform.value.copy(M.matrix),(h!==M||d!==M.version||u!==s.toneMapping)&&(l.material.needsUpdate=!0,h=M,d=M.version,u=s.toneMapping),l.layers.enableAll(),x.unshift(l,l.geometry,l.material,0,0,null))}function g(x,y){x.getRGB(Zr,Zu(s)),t.buffers.color.setClear(Zr.r,Zr.g,Zr.b,y,r)}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 B_(s,e){const t=s.getParameter(s.MAX_VERTEX_ATTRIBS),n={},i=u(null);let r=i,a=!1;function o(I,N,H,W,U){let B=!1;const k=d(I,W,H,N);r!==k&&(r=k,c(r.object)),B=f(I,W,H,U),B&&p(I,W,H,U),U!==null&&e.update(U,s.ELEMENT_ARRAY_BUFFER),(B||a)&&(a=!1,M(I,N,H,W),U!==null&&s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,e.get(U).buffer))}function l(){return s.createVertexArray()}function c(I){return s.bindVertexArray(I)}function h(I){return s.deleteVertexArray(I)}function d(I,N,H,W){const U=W.wireframe===!0;let B=n[N.id];B===void 0&&(B={},n[N.id]=B);const k=I.isInstancedMesh===!0?I.id:0;let te=B[k];te===void 0&&(te={},B[k]=te);let ne=te[H.id];ne===void 0&&(ne={},te[H.id]=ne);let pe=ne[U];return pe===void 0&&(pe=u(l()),ne[U]=pe),pe}function u(I){const N=[],H=[],W=[];for(let U=0;U<t;U++)N[U]=0,H[U]=0,W[U]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:N,enabledAttributes:H,attributeDivisors:W,object:I,attributes:{},index:null}}function f(I,N,H,W){const U=r.attributes,B=N.attributes;let k=0;const te=H.getAttributes();for(const ne in te)if(te[ne].location>=0){const Me=U[ne];let Ce=B[ne];if(Ce===void 0&&(ne==="instanceMatrix"&&I.instanceMatrix&&(Ce=I.instanceMatrix),ne==="instanceColor"&&I.instanceColor&&(Ce=I.instanceColor)),Me===void 0||Me.attribute!==Ce||Ce&&Me.data!==Ce.data)return!0;k++}return r.attributesNum!==k||r.index!==W}function p(I,N,H,W){const U={},B=N.attributes;let k=0;const te=H.getAttributes();for(const ne in te)if(te[ne].location>=0){let Me=B[ne];Me===void 0&&(ne==="instanceMatrix"&&I.instanceMatrix&&(Me=I.instanceMatrix),ne==="instanceColor"&&I.instanceColor&&(Me=I.instanceColor));const Ce={};Ce.attribute=Me,Me&&Me.data&&(Ce.data=Me.data),U[ne]=Ce,k++}r.attributes=U,r.attributesNum=k,r.index=W}function _(){const I=r.newAttributes;for(let N=0,H=I.length;N<H;N++)I[N]=0}function g(I){m(I,0)}function m(I,N){const H=r.newAttributes,W=r.enabledAttributes,U=r.attributeDivisors;H[I]=1,W[I]===0&&(s.enableVertexAttribArray(I),W[I]=1),U[I]!==N&&(s.vertexAttribDivisor(I,N),U[I]=N)}function x(){const I=r.newAttributes,N=r.enabledAttributes;for(let H=0,W=N.length;H<W;
vendor: 4,280 bytes, line 3675
3675H++)N[H]!==I[H]&&(s.disableVertexAttribArray(H),N[H]=0)}function y(I,N,H,W,U,B,k){k===!0?s.vertexAttribIPointer(I,N,H,U,B):s.vertexAttribPointer(I,N,H,W,U,B)}function M(I,N,H,W){_();const U=W.attributes,B=H.getAttributes(),k=N.defaultAttributeValues;for(const te in B){const ne=B[te];if(ne.location>=0){let pe=U[te];if(pe===void 0&&(te==="instanceMatrix"&&I.instanceMatrix&&(pe=I.instanceMatrix),te==="instanceColor"&&I.instanceColor&&(pe=I.instanceColor)),pe!==void 0){const Me=pe.normalized,Ce=pe.itemSize,Ke=e.get(pe);if(Ke===void 0)continue;const nt=Ke.buffer,He=Ke.type,J=Ke.bytesPerElement,ge=He===s.INT||He===s.UNSIGNED_INT||pe.gpuType===wl;if(pe.isInterleavedBufferAttribute){const ae=pe.data,Le=ae.stride,Be=pe.offset;if(ae.isInstancedInterleavedBuffer){for(let Fe=0;Fe<ne.locationSize;Fe++)m(ne.location+Fe,ae.meshPerAttribute);I.isInstancedMesh!==!0&&W._maxInstanceCount===void 0&&(W._maxInstanceCount=ae.meshPerAttribute*ae.count)}else for(let Fe=0;Fe<ne.locationSize;Fe++)g(ne.location+Fe);s.bindBuffer(s.ARRAY_BUFFER,nt);for(let Fe=0;Fe<ne.locationSize;Fe++)y(ne.location+Fe,Ce/ne.locationSize,He,Me,Le*J,(Be+Ce/ne.locationSize*Fe)*J,ge)}else{if(pe.isInstancedBufferAttribute){for(let ae=0;ae<ne.locationSize;ae++)m(ne.location+ae,pe.meshPerAttribute);I.isInstancedMesh!==!0&&W._maxInstanceCount===void 0&&(W._maxInstanceCount=pe.meshPerAttribute*pe.count)}else for(let ae=0;ae<ne.locationSize;ae++)g(ne.location+ae);s.bindBuffer(s.ARRAY_BUFFER,nt);for(let ae=0;ae<ne.locationSize;ae++)y(ne.location+ae,Ce/ne.locationSize,He,Me,Ce*J,Ce/ne.locationSize*ae*J,ge)}}else if(k!==void 0){const Me=k[te];if(Me!==void 0)switch(Me.length){case 2:s.vertexAttrib2fv(ne.location,Me);break;case 3:s.vertexAttrib3fv(ne.location,Me);break;case 4:s.vertexAttrib4fv(ne.location,Me);break;default:s.vertexAttrib1fv(ne.location,Me)}}}}x()}function w(){A();for(const I in n){const N=n[I];for(const H in N){const W=N[H];for(const U in W){const B=W[U];for(const k in B)h(B[k].object),delete B[k];delete W[U]}}delete n[I]}}function b(I){if(n[I.id]===void 0)return;const N=n[I.id];for(const H in N){const W=N[H];for(const U in W){const B=W[U];for(const k in B)h(B[k].object),delete B[k];delete W[U]}}delete n[I.id]}function R(I){for(const N in n){const H=n[N];for(const W in H){const U=H[W];if(U[I.id]===void 0)continue;const B=U[I.id];for(const k in B)h(B[k].object),delete B[k];delete U[I.id]}}}function v(I){for(const N in n){const H=n[N],W=I.isInstancedMesh===!0?I.id:0,U=H[W];if(U!==void 0){for(const B in U){const k=U[B];for(const te in k)h(k[te].object),delete k[te];delete U[B]}delete H[W],Object.keys(H).length===0&&delete n[N]}}}function A(){P(),a=!0,r!==i&&(r=i,c(r.object))}function P(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:o,reset:A,resetDefaultState:P,dispose:w,releaseStatesOfGeometry:b,releaseStatesOfObject:v,releaseStatesOfProgram:R,initAttributes:_,enableAttribute:g,disableUnusedAttributes:x}}function z_(s,e,t){let n;function i(l){n=l}function r(l,c){s.drawArrays(n,l,c),t.update(c,n,1)}function a(l,c,h){h!==0&&(s.drawArraysInstanced(n,l,c,h),t.update(c,n,h))}function o(l,c,h){if(h===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,l,0,c,0,h);let u=0;for(let f=0;f<h;f++)u+=c[f];t.update(u,n,1)}this.setMode=i,this.render=r,this.renderInstances=a,this.renderMultiDraw=o}function V_(s,e,t,n){let i;function r(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const R=e.get("EXT_texture_filter_anisotropic");i=s.getParameter(R.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(R){return!(R!==qt&&n.convert(R)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(R){const v=R===Hn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(R!==en&&n.convert(R)!==s.getParameter(s.IMPLEMENTATION_COLOR_READ_TYPE)&&R!==Xt&&!v)}function l(R){if(R==="highp"){if(s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.HIGH_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT).precision>0)return"highp";R="mediump"}return R==="mediump"&&s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.MEDIUM_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const h=l(c);
vendor: 12,044 bytes, lines 3675-3748
3675h!==c&&(de("WebGLRenderer:",c,"not supported, using",h,"instead."),c=h);const d=t.logarithmicDepthBuffer===!0,u=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&u===!1&&de("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");const f=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),p=s.getParameter(s.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=s.getParameter(s.MAX_TEXTURE_SIZE),g=s.getParameter(s.MAX_CUBE_MAP_TEXTURE_SIZE),m=s.getParameter(s.MAX_VERTEX_ATTRIBS),x=s.getParameter(s.MAX_VERTEX_UNIFORM_VECTORS),y=s.getParameter(s.MAX_VARYING_VECTORS),M=s.getParameter(s.MAX_FRAGMENT_UNIFORM_VECTORS),w=s.getParameter(s.MAX_SAMPLES),b=s.getParameter(s.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,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:w,samples:b}}function k_(s){const e=this;let t=null,n=0,i=!1,r=!1;const a=new Mi,o=new qe,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(){r=!0,h(null)},this.endShadows=function(){r=!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=s.get(d);if(!i||p===null||p.length===0||r&&!g)r?h(null):c();else{const x=r?0:n,y=x*4;let M=m.clippingState||null;l.value=M,M=h(p,u,y,f);for(let w=0;w!==y;++w)M[w]=t[w];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 ii=4,Wh=[.125,.215,.35,.446,.526,.582],bi=20,G_=256,Us=new Pa,Xh=new be;let bo=null,To=0,Ao=0,Eo=!1;const H_=new C;class qh{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,r={}){const{size:a=256,position:o=H_}=r;bo=this._renderer.getRenderTarget(),To=this._renderer.getActiveCubeFace(),Ao=this._renderer.getActiveMipmapLevel(),Eo=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=Jh(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Zh(),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(bo,To,Ao),this._renderer.xr.enabled=Eo,e.scissorTest=!1,ss(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Gn||e.mapping===Ci?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),bo=this._renderer.getRenderTarget(),To=this._renderer.getActiveCubeFace(),Ao=this._renderer.getActiveMipmapLevel(),Eo=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:_t,minFilter:_t,generateMipmaps:!1,type:Hn,format:qt,colorSpace:ua,depthBuffer:!1},i=Yh(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Yh(e,t,n);const{_lodMax:r}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=W_(r)),this._blurMaterial=q_(r,e,t),this._ggxMaterial=X_(r,e,t)}return i}_compileMaterial(e){const t=new Ct(new Ye,e);this._renderer.compile(t,Us)}_sceneToCubeUV(e,t,n,i,r){const l=new Ft(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(Xh),d.toneMapping=Tn,d.autoClear=!1,d.state.buffers.depth.getReversed()&&(d.setRenderTarget(i),d.clearDepth(),d.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Ct(new xs,new Li({name:"PMREM.Background",side:Yt,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(Xh),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(r.x,r.y,r.z),l.lookAt(r.x+h[y],r.y,r.z)):M===1?(l.up.set(0,0,c[y]),l.position.set(r.x,r.y,r.z),l.lookAt(r.x,r.y+h[y],r.z)):(l.up.set(0,c[y],0),l.position.set(r.x,r.y,r.z),l.lookAt(r.x,r.y,r.z+h[y]));const w=this._cubeSize;ss(i,M*w,y>2?w:0,w,w),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===Gn||e.mapping===Ci;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=Jh()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Zh());const r=i?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=r;const o=r.uniforms;o.envMap.value=e;const l=this._cubeSize;ss(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(a,Us)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let r=1;r<i;r++)this._applyGGXFilter(e,r-1,r);t.autoClear=n}_applyGGXFilter(e,t,n){const i=this._renderer,r=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-ii?n-p+ii:0),m=4*(this._cubeSize-_);l.envMap.value=e.texture,l.roughness.value=f,l.mipInt.value=p-t,ss(r,g,m,3*_,2*_),i.setRenderTarget(r),i.render(o,Us),l.envMap.value=r.texture,l.roughness.value=0,l.mipInt.value=p-n,ss(e,g,m,3*_,2*_),i.setRenderTarget(e),i.render(o,Us)}_blur(e,t,n,i,r){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",r),this._halfBlur(a,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&Pe("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(r)?Math.PI/(2*f):2*Math.PI/(2*bi-1),_=r/p,g=isFinite(r)?1+Math.floor(h*_):bi;g>bi&&de(`sigmaRadians, ${r}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${bi}`);const m=[];let x=0;for(let R=0;R<bi;++R){const v=R/_,A=Math.exp(-v*v/2);m.push(A),R===0?x+=A:R<g&&(x+=2*A)}for(let R=0;R<m.length;R++)m[R]=m[R]/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],w=3*M*(i>y-ii?i-y+ii:0),b=4*(this._cubeSize-M);ss(t,w,b,3*M,2*M),l.setRenderTarget(t),l.render(d,Us)}}function W_(s){const e=[],t=[],n=[];let i=s;const r=s-ii+1+Wh.length;for(let a=0;a<r;a++){const o=Math.pow(2,i);e.push(o);let l=1/o;a>s-ii?l=Wh[a-s+ii-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 b=0;b<f;b++){const R=b%3*2/3-1,v=b>2?0:-1,A=[R,v,0,R+2/3,v,0,R+2/3,v+1,0,R,v,0,R+2/3,v+1,0,R,v+1,0];x.set(A,_*p*b),y.set(u,g*p*b);const P=[b,b,b,b,b,b];M.set(P,m*p*b)}const w=new Ye;w.setAttribute("position",new mt(x,_)),w.setAttribute("uv",new mt(y,g)),w.setAttribute("faceIndex",new mt(M,m)),n.push(new Ct(w,null)),i>ii&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function Yh(s,e,t){const n=new cn(s,e,t);return n.texture.mapping=Qs,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function ss(s,e,t,n,i){s.viewport.set(e,t,n,i),s.scissor.set(e,t,n,i)}function X_(s,e,t){return new pn({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:G_,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${s}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:La(),fragmentShader:`
3676
3677			precision highp float;
3678			precision highp int;
3679
3680			varying vec3 vOutputDirection;
3681
3682			uniform sampler2D envMap;
3683			uniform float roughness;
3684			uniform float mipInt;
3685
3686			#define ENVMAP_TYPE_CUBE_UV
3687			#include <cube_uv_reflection_fragment>
3688
3689			#define PI 3.14159265359
3690
3691			// Van der Corput radical inverse
3692			float radicalInverse_VdC(uint bits) {
3693				bits = (bits << 16u) | (bits >> 16u);
3694				bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
3695				bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
3696				bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
3697				bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
3698				return float(bits) * 2.3283064365386963e-10; // / 0x100000000
3699			}
3700
3701			// Hammersley sequence
3702			vec2 hammersley(uint i, uint N) {
3703				return vec2(float(i) / float(N), radicalInverse_VdC(i));
3704			}
3705
3706			// GGX VNDF importance sampling (Eric Heitz 2018)
3707			// "Sampling the GGX Distribution of Visible Normals"
3708			// https://jcgt.org/published/0007/04/01/
3709			vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
3710				float alpha = roughness * roughness;
3711
3712				// Section 4.1: Orthonormal basis
3713				vec3 T1 = vec3(1.0, 0.0, 0.0);
3714				vec3 T2 = cross(V, T1);
3715
3716				// Section 4.2: Parameterization of projected area
3717				float r = sqrt(Xi.x);
3718				float phi = 2.0 * PI * Xi.y;
3719				float t1 = r * cos(phi);
3720				float t2 = r * sin(phi);
3721				float s = 0.5 * (1.0 + V.z);
3722				t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
3723
3724				// Section 4.3: Reprojection onto hemisphere
3725				vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;
3726
3727				// Section 3.4: Transform back to ellipsoid configuration
3728				return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
3729			}
3730
3731			void main() {
3732				vec3 N = normalize(vOutputDirection);
3733				vec3 V = N; // Assume view direction equals normal for pre-filtering
3734
3735				vec3 prefilteredColor = vec3(0.0);
3736				float totalWeight = 0.0;
3737
3738				// For very low roughness, just sample the environment directly
3739				if (roughness < 0.001) {
3740					gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
3741					return;
3742				}
3743
3744				// Tangent space basis for VNDF sampling
3745				vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
3746				vec3 tangent = normalize(cross(up, N));
3747				vec3 bitangent = cross(N, tangent);
3748
3749				for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
3750					vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
3751
3752					// For PMREM, V = N, so in tangent space V is always (0, 0, 1)
3753					vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
3754
3755					// Transform H back to world space
3756					vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
3757					vec3 L = normalize(2.0 * dot(V, H) * H - V);
3758
3759					float NdotL = max(dot(N, L), 0.0);
3760
3761					if(NdotL > 0.0) {
3762						// Sample environment at fixed mip level
3763						// VNDF importance sampling handles the distribution filtering
3764						vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
3765
3766						// Weight by NdotL for the split-sum approximation
3767						// VNDF PDF naturally accounts for the visible microfacet distribution
3768						prefilteredColor += sampleColor * NdotL;
3769						totalWeight += NdotL;
3770					}
3771				}
3772
3773				if (totalWeight > 0.0) {
3774					prefilteredColor = prefilteredColor / totalWeight;
3775				}
3776
3777				gl_FragColor = vec4(prefilteredColor, 1.0);
3778			}
3779		`,blending:Vn,depthTest:!1,depthWrite:!1})}function q_(s,e,t){const n=new Float32Array(bi),i=new C(0,1,0);return new pn({name:"SphericalGaussianBlur",defines:{n:bi,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${s}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:La(),fragmentShader:`
3780
3781			precision mediump float;
3782			precision mediump int;
3783
3784			varying vec3 vOutputDirection;
3785
3786			uniform sampler2D envMap;
3787			uniform int samples;
3788			uniform float weights[ n ];
3789			uniform bool latitudinal;
3790			uniform float dTheta;
3791			uniform float mipInt;
3792			uniform vec3 poleAxis;
3793
3794			#define ENVMAP_TYPE_CUBE_UV
3795			#include <cube_uv_reflection_fragment>
3796
3797			vec3 getSample( float theta, vec3 axis ) {
3798
3799				float cosTheta = cos( theta );
3800				// Rodrigues' axis-angle rotation
3801				vec3 sampleDirection = vOutputDirection * cosTheta
3802					+ cross( axis, vOutputDirection ) * sin( theta )
3803					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
3804
3805				return bilinearCubeUV( envMap, sampleDirection, mipInt );
3806
3807			}
3808
3809			void main() {
3810
3811				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
3812
3813				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
3814
3815					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
3816
3817				}
3818
3819				axis = normalize( axis );
3820
3821				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
3822				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
3823
3824				for ( int i = 1; i < n; i++ ) {
3825
3826					if ( i >= samples ) {
3827
3828						break;
3829
3830					}
3831
3832					float theta = dTheta * float( i );
3833					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
3834					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
3835
3836				}
3837
3838			}
3839		`,blending:Vn,depthTest:!1,depthWrite:!1})}function Zh(){return new pn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:La(),fragmentShader:`
3840
3841			precision mediump float;
3842			precision mediump int;
3843
3844			varying vec3 vOutputDirection;
3845
3846			uniform sampler2D envMap;
3847
3848			#include <common>
3849
3850			void main() {
3851
3852				vec3 outputDirection = normalize( vOutputDirection );
3853				vec2 uv = equirectUv( outputDirection );
3854
3855				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3856
3857			}
3858		`,blending:Vn,depthTest:!1,depthWrite:!1})}function Jh(){return new pn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:La(),fragmentShader:`
3859
3860			precision mediump float;
3861			precision mediump int;
3862
3863			uniform float flipEnvMap;
3864
3865			varying vec3 vOutputDirection;
3866
3867			uniform samplerCube envMap;
3868
3869			void main() {
3870
3871				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3872
3873			}
3874		`,blending:Vn,depthTest:!1,depthWrite:!1})}function La(){return`
3875
3876		precision mediump float;
3877		precision mediump int;
3878
3879		attribute float faceIndex;
3880
3881		varying vec3 vOutputDirection;
3882
3883		// RH coordinate system; PMREM face-indexing convention
3884		vec3 getDirection( vec2 uv, float face ) {
3885
3886			uv = 2.0 * uv - 1.0;
3887
3888			vec3 direction = vec3( uv, 1.0 );
3889
3890			if ( face == 0.0 ) {
3891
3892				direction = direction.zyx; // ( 1, v, u ) pos x
3893
3894			} else if ( face == 1.0 ) {
3895
3896				direction = direction.xzy;
3897				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
3898
3899			} else if ( face == 2.0 ) {
3900
3901				direction.x *= -1.0; // ( -u, v, 1 ) pos z
3902
3903			} else if ( face == 3.0 ) {
3904
3905				direction = direction.zyx;
3906				direction.xz *= -1.0; // ( -1, v, -u ) neg x
3907
3908			} else if ( face == 4.0 ) {
3909
3910				direction = direction.xzy;
3911				direction.xy *= -1.0; // ( -u, -1, v ) neg y
3912
3913			} else if ( face == 5.0 ) {
3914
3915				direction.z *= -1.0; // ( u, v, -1 ) neg z
3916
3917			}
3918
3919			return direction;
3920
3921		}
3922
3923		void main() {
3924
3925			vOutputDirection = getDirection( uv, faceIndex );
3926			gl_Position = vec4( position, 1.0 );
3927
3928		}
3929	`}class cd extends cn{constructor(e=1,t={}
vendor: 25,753 bytes, lines 3929-4045
3929){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 Aa(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:`
3930
3931				varying vec3 vWorldDirection;
3932
3933				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
3934
3935					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
3936
3937				}
3938
3939				void main() {
3940
3941					vWorldDirection = transformDirection( position, modelMatrix );
3942
3943					#include <begin_vertex>
3944					#include <project_vertex>
3945
3946				}
3947			`,fragmentShader:`
3948
3949				uniform sampler2D tEquirect;
3950
3951				varying vec3 vWorldDirection;
3952
3953				#include <common>
3954
3955				void main() {
3956
3957					vec3 direction = normalize( vWorldDirection );
3958
3959					vec2 sampleUV = equirectUv( direction );
3960
3961					gl_FragColor = texture2D( tEquirect, sampleUV );
3962
3963				}
3964			`},i=new xs(5,5,5),r=new pn({name:"CubemapFromEquirect",uniforms:_s(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Yt,blending:Vn});r.uniforms.tEquirect.value=t;const a=new Ct(i,r),o=t.minFilter;return t.minFilter===Bn&&(t.minFilter=_t),new Cm(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 r=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(r)}}function Y_(s){let e=new WeakMap,t=new WeakMap,n=null;function i(u,f=!1){return u==null?null:f?a(u):r(u)}function r(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 cd(p.height);return _.fromEquirectangularTexture(s,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===Gn||f===Ci;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 qh(s)),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 qh(s)),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=Gn:f===Qr&&(u.mapping=Ci),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 Z_(s){const e={};function t(n){if(e[n]!==void 0)return e[n];const i=s.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&&ml("WebGLRenderer: "+n+" extension not supported."),i}}}function J_(s,e,t,n){const i={},r=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=r.get(u);f&&(e.remove(f),r.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],s.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 w=x[y+0],b=x[y+1],R=x[y+2];u.push(w,b,b,R,R,w)}}else{const x=p.array;_=p.version;for(let y=0,M=x.length/3-1;y<M;y+=3){const w=y+0,b=y+1,R=y+2;u.push(w,b,b,R,R,w)}}const g=new(p.count>=65535?Du:Lu)(u,1);g.version=_;const m=r.get(d);m&&e.remove(m),r.set(d,g)}function h(d){const u=r.get(d);if(u){const f=d.index;f!==null&&u.version<f.version&&c(d)}else c(d);return r.get(d)}return{get:o,update:l,getWireframeAttribute:h}}function $_(s,e,t){let n;function i(d){n=d}let r,a;function o(d){r=d.type,a=d.bytesPerElement}function l(d,u){s.drawElements(n,u,r,d*a),t.update(u,n,1)}function c(d,u,f){f!==0&&(s.drawElementsInstanced(n,u,r,d*a,f),t.update(u,n,f))}function h(d,u,f){if(f===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,u,0,r,d,0,f);let _=0;for(let g=0;g<f;g++)_+=u[g];t.update(_,n,1)}this.setMode=i,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=h}function K_(s){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(r,a,o){switch(t.calls++,a){case s.TRIANGLES:t.triangles+=o*(r/3);break;case s.LINES:t.lines+=o*(r/2);break;case s.LINE_STRIP:t.lines+=o*(r-1);break;case s.LINE_LOOP:t.lines+=o*r;break;case s.POINTS:t.points+=o*r;break;default:Pe("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 Q_(s,e,t){const n=new WeakMap,i=new dt;function r(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 A=function(){R.dispose(),n.delete(o),o.removeEventListener("dispose",A)};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,w=1;M>e.maxTextureSize&&(w=Math.ceil(M/e.maxTextureSize),M=e.maxTextureSize);const b=new Float32Array(M*w*4*d),R=new Ol(b,M,w,d);R.type=Xt,R.needsUpdate=!0;const v=y*4;for(let P=0;P<d;P++){const I=g[P],N=m[P],H=x[P],W=M*w*4*P;for(let U=0;U<I.count;U++){const B=U*v;f===!0&&(i.fromBufferAttribute(I,U),b[W+B+0]=i.x,b[W+B+1]=i.y,b[W+B+2]=i.z,b[W+B+3]=0),p===!0&&(i.fromBufferAttribute(N,U),b[W+B+4]=i.x,b[W+B+5]=i.y,b[W+B+6]=i.z,b[W+B+7]=0),_===!0&&(i.fromBufferAttribute(H,U),b[W+B+8]=i.x,b[W+B+9]=i.y,b[W+B+10]=i.z,b[W+B+11]=H.itemSize===4?i.w:1)}}u={count:d,texture:R,size:new K(M,w)},n.set(o,u),o.addEventListener("dispose",A)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(s,"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(s,"morphTargetBaseInfluence",p),l.getUniforms().setValue(s,"morphTargetInfluences",c)}l.getUniforms().setValue(s,"morphTargetsTexture",u.texture,t),l.getUniforms().setValue(s,"morphTargetsTextureSize",u.size)}return{update:r}}function j_(s,e,t,n,i){let r=new WeakMap;function a(c){const h=i.render.frame,d=c.geometry,u=e.get(c,d);if(r.get(u)!==h&&(e.update(u),r.set(u,h)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),r.get(c)!==h&&(t.update(c.instanceMatrix,s.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,s.ARRAY_BUFFER),r.set(c,h))),c.isSkinnedMesh){const f=c.skeleton;r.get(f)!==h&&(f.update(),r.set(f,h))}return u}function o(){r=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 ex={[fu]:"LINEAR_TONE_MAPPING",[pu]:"REINHARD_TONE_MAPPING",[mu]:"CINEON_TONE_MAPPING",[gu]:"ACES_FILMIC_TONE_MAPPING",[xu]:"AGX_TONE_MAPPING",[vu]:"NEUTRAL_TONE_MAPPING",[_u]:"CUSTOM_TONE_MAPPING"};function tx(s,e,t,n,i){const r=new cn(e,t,{type:s,depthBuffer:n,stencilBuffer:i,depthTexture:n?new ms(e,t):void 0}),a=new cn(e,t,{type:Hn,depthBuffer:!1,stencilBuffer:!1}),o=new Ye;o.setAttribute("position",new we([-1,3,0,-1,-1,0,3,-1,0],3)),o.setAttribute("uv",new we([0,2,0,0,2,0],2));const l=new Ju({uniforms:{tDiffuse:{value:null}},vertexShader:`
3965			precision highp float;
3966
3967			uniform mat4 modelViewMatrix;
3968			uniform mat4 projectionMatrix;
3969
3970			attribute vec3 position;
3971			attribute vec2 uv;
3972
3973			varying vec2 vUv;
3974
3975			void main() {
3976				vUv = uv;
3977				gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3978			}`,fragmentShader:`
3979			precision highp float;
3980
3981			uniform sampler2D tDiffuse;
3982
3983			varying vec2 vUv;
3984
3985			#include <tonemapping_pars_fragment>
3986			#include <colorspace_pars_fragment>
3987
3988			void main() {
3989				gl_FragColor = texture2D( tDiffuse, vUv );
3990
3991				#ifdef LINEAR_TONE_MAPPING
3992					gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
3993				#elif defined( REINHARD_TONE_MAPPING )
3994					gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
3995				#elif defined( CINEON_TONE_MAPPING )
3996					gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
3997				#elif defined( ACES_FILMIC_TONE_MAPPING )
3998					gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
3999				#elif defined( AGX_TONE_MAPPING )
4000					gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
4001				#elif defined( NEUTRAL_TONE_MAPPING )
4002					gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
4003				#elif defined( CUSTOM_TONE_MAPPING )
4004					gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
4005				#endif
4006
4007				#ifdef SRGB_TRANSFER
4008					gl_FragColor = sRGBTransferOETF( gl_FragColor );
4009				#endif
4010			}`,depthTest:!1,depthWrite:!1}),c=new Ct(o,l),h=new Pa(-1,1,1,-1,0,1);let d=null,u=null,f=!1,p,_=null,g=[],m=!1;this.setSize=function(x,y){r.setSize(x,y),a.setSize(x,y);for(let M=0;M<g.length;M++){const w=g[M];w.setSize&&w.setSize(x,y)}},this.setEffects=function(x){g=x,m=g.length>0&&g[0].isRenderPass===!0;const y=r.width,M=r.height;for(let w=0;w<g.length;w++){const b=g[w];b.setSize&&b.setSize(y,M)}},this.begin=function(x,y){if(f||x.toneMapping===Tn&&g.length===0)return!1;if(_=y,y!==null){const M=y.width,w=y.height;(r.width!==M||r.height!==w)&&this.setSize(M,w)}return m===!1&&x.setRenderTarget(r),p=x.toneMapping,x.toneMapping=Tn,!0},this.hasRenderPass=function(){return m},this.end=function(x,y){x.toneMapping=p,f=!0;let M=r,w=a;for(let b=0;b<g.length;b++){const R=g[b];if(R.enabled!==!1&&(R.render(x,w,M,y),R.needsSwap!==!1)){const v=M;M=w,w=v}}if(d!==x.outputColorSpace||u!==x.toneMapping){d=x.outputColorSpace,u=x.toneMapping,l.defines={},tt.getTransfer(d)===ct&&(l.defines.SRGB_TRANSFER="");const b=ex[u];b&&(l.defines[b]=""),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(){r.depthTexture&&r.depthTexture.dispose(),r.dispose(),a.dispose(),o.dispose(),l.dispose()}}const hd=new Mt,bl=new ms(1,1),ud=new Ol,dd=new Bl,fd=new Aa,$h=[],Kh=[],Qh=new Float32Array(16),jh=new Float32Array(9),eu=new Float32Array(4);function Ms(s,e,t){const n=s[0];if(n<=0||n>0)return s;const i=e*t;let r=$h[i];if(r===void 0&&(r=new Float32Array(i),$h[i]=r),e!==0){n.toArray(r,0);for(let a=1,o=0;a!==e;++a)o+=t,s[a].toArray(r,o)}return r}function Rt(s,e){if(s.length!==e.length)return!1;for(let t=0,n=s.length;t<n;t++)if(s[t]!==e[t])return!1;return!0}function It(s,e){for(let t=0,n=e.length;t<n;t++)s[t]=e[t]}function Da(s,e){let t=Kh[e];t===void 0&&(t=new Int32Array(e),Kh[e]=t);for(let n=0;n!==e;++n)t[n]=s.allocateTextureUnit();return t}function nx(s,e){const t=this.cache;t[0]!==e&&(s.uniform1f(this.addr,e),t[0]=e)}function ix(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Rt(t,e))return;s.uniform2fv(this.addr,e),It(t,e)}}function sx(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.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)&&(s.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Rt(t,e))return;s.uniform3fv(this.addr,e),It(t,e)}}function rx(s,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)&&(s.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(Rt(t,e))return;s.uniform4fv(this.addr,e),It(t,e)}}function ax(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(Rt(t,e))return;s.uniformMatrix2fv(this.addr,!1,e),It(t,e)}else{if(Rt(t,n))return;eu.set(n),s.uniformMatrix2fv(this.addr,!1,eu),It(t,n)}}function ox(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(Rt(t,e))return;s.uniformMatrix3fv(this.addr,!1,e),It(t,e)}else{if(Rt(t,n))return;jh.set(n),s.uniformMatrix3fv(this.addr,!1,jh),It(t,n)}}function lx(s,e){const t=this.cache,n=e.elements;if(n===void 0){if(Rt(t,e))return;s.uniformMatrix4fv(this.addr,!1,e),It(t,e)}else{if(Rt(t,n))return;Qh.set(n),s.uniformMatrix4fv(this.addr,!1,Qh),It(t,n)}}function cx(s,e){const t=this.cache;t[0]!==e&&(s.uniform1i(this.addr,e),t[0]=e)}function hx(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Rt(t,e))return;s.uniform2iv(this.addr,e),It(t,e)}}function ux(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Rt(t,e))return;s.uniform3iv(this.addr,e),It(t,e)}}function dx(s,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)&&(s.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(Rt(t,e))return;s.uniform4iv(this.addr,e),It(t,e)}}function fx(s,e){const t=this.cache;t[0]!==e&&(s.uniform1ui(this.addr,e),t[0]=e)}function px(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(s.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Rt(t,e))return;s.uniform2uiv(this.addr,e),It(t,e)}}function mx(s,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(s.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Rt(t,e))return;s.uniform3uiv(this.addr,e),It(t,e)}}function gx(s,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)&&(s.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(Rt(t,e))return;s.uniform4uiv(this.addr,e),It(t,e)}}function _x(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i);let r;this.type===s.SAMPLER_2D_SHADOW?(bl.compareFunction=t.isReversedDepthBuffer()?Nl:Ul,r=bl):r=hd,t.setTexture2D(e||r,i)}function xx(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||dd,i)}function vx(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||fd,i)}function yx(s,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(s.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||ud,i)}function Mx(s){switch(s){case 5126:return nx;case 35664:return ix;case 35665:return sx;case 35666:return rx;case 35674:return ax;case 35675:return ox;case 35676:return lx;case 5124:case 35670:return cx;case 35667:case 35671:return hx;case 35668:case 35672:return ux;case 35669:case 35673:return dx;case 5125:return fx;case 36294:return px;case 36295:return mx;case 36296:return gx;case 35678:case 36198:case 36298:case 36306:case 35682:return _x;case 35679:case 36299:case 36307:return xx;case 35680:case 36300:case 36308:case 36293:return vx;case 36289:case 36303:case 36311:case 36292:return yx}}function Sx(s,e){s.uniform1fv(this.addr,e)}function bx(s,e){const t=Ms(e,this.size,2);s.uniform2fv(this.addr,t)}function Tx(s,e){const t=Ms(e,this.size,3);s.uniform3fv(this.addr,t)}function Ax(s,e){const t=Ms(e,this.size,4);s.uniform4fv(this.addr,t)}function Ex(s,e){const t=Ms(e,this.size,4);s.uniformMatrix2fv(this.addr,!1,t)}function wx(s,e){const t=Ms(e,this.size,9);s.uniformMatrix3fv(this.addr,!1,t)}function Cx(s,e){const t=Ms(e,this.size,16);s.uniformMatrix4fv(this.addr,!1,t)}function Rx(s,e){s.uniform1iv(this.addr,e)}function Ix(s,e){s.uniform2iv(this.addr,e)}function Px(s,e){s.uniform3iv(this.addr,e)}function Lx(s,e){s.uniform4iv(this.addr,e)}function Dx(s,e){s.uniform1uiv(this.addr,e)}function Ux(s,e){s.uniform2uiv(this.addr,e)}function Nx(s,e){s.uniform3uiv(this.addr,e)}function Fx(s,e){s.uniform4uiv(this.addr,e)}function Ox(s,e,t){const n=this.cache,i=e.length,r=Da(t,i);Rt(n,r)||(s.uniform1iv(this.addr,r),It(n,r));let a;this.type===s.SAMPLER_2D_SHADOW?a=bl:a=hd;for(let o=0;o!==i;++o)t.setTexture2D(e[o]||a,r[o])}function Bx(s,e,t){const n=this.cache,i=e.length,r=Da(t,i);Rt(n,r)||(s.uniform1iv(this.addr,r),It(n,r));for(let a=0;a!==i;++a)t.setTexture3D(e[a]||dd,r[a])}function zx(s,e,t){const n=this.cache,i=e.length,r=Da(t,i);Rt(n,r)||(s.uniform1iv(this.addr,r),It(n,r));for(let a=0;a!==i;++a)t.setTextureCube(e[a]||fd,r[a])}function Vx(s,e,t){const n=this.cache,i=e.length,r=Da(t,i);Rt(n,r)||(s.uniform1iv(this.addr,r),It(n,r));for(let a=0;a!==i;++a)t.setTexture2DArray(e[a]||ud,r[a])}function kx(s){switch(s){case 5126:return Sx;case 35664:return bx;case 35665:return Tx;case 35666:return Ax;case 35674:return Ex;case 35675:return wx;case 35676:return Cx;case 5124:case 35670:return Rx;case 35667:case 35671:return Ix;case 35668:case 35672:return Px;case 35669:case 35673:return Lx;case 5125:return Dx;case 36294:return Ux;case 36295:return Nx;case 36296:return Fx;case 35678:case 36198:case 36298:case 36306:case 35682:return Ox;case 35679:case 36299:case 36307:return Bx;case 35680:case 36300:case 36308:case 36293:return zx;case 36289:case 36303:case 36311:case 36292:return Vx}}class Gx{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=Mx(t.type)}}class Hx{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=kx(t.type)}}class Wx{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let r=0,a=i.length;r!==a;++r){const o=i[r];o.setValue(e,t[o.id],n)}}}const wo=/(\w+)(\])?(\[|\.)?/g;function tu(s,e){s.seq.push(e),s.map[e.id]=e}function Xx(s,e,t){const n=s.name,i=n.length;for(wo.lastIndex=0;;){const r=wo.exec(n),a=wo.lastIndex;let o=r[1];const l=r[2]==="]",c=r[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===i){tu(t,c===void 0?new Gx(o,s,e):new Hx(o,s,e));break}else{let d=t.map[o];d===void 0&&(d=new Wx(o),tu(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);Xx(o,l,this)}const i=[],r=[];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):r.push(a);i.length>0&&(this.seq=i.concat(r))}setValue(e,t,n,i){const r=this.map[t];r!==void 0&&r.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 r=0,a=t.length;r!==a;++r){const o=t[r],l=n[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,r=e.length;i!==r;++i){const a=e[i];a.id in t&&n.push(a)}return n}}function nu(s,e,t){const n=s.createShader(e);return s.shaderSource(n,t),s.compileShader(n),n}const qx=37297;let Yx=0;function Zx(s,e){const t=s.split(`
4011`),n=[],i=Math.max(e-6,0),r=Math.min(e+6,t.length);for(let a=i;a<r;a++){const o=a+1;n.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return n.join(`
4012`)}const iu=new qe;function Jx(s){tt._getMatrix(iu,tt.workingColorSpace,s);const e=`mat3( ${iu.elements.map(t=>t.toFixed(4))} )`;switch(tt.getTransfer(s)){case da:return[e,"LinearTransferOETF"];case ct:return[e,"sRGBTransferOETF"];default:return de("WebGLProgram: Unsupported color space: ",s),[e,"LinearTransferOETF"]}}function su(s,e,t){const n=s.getShaderParameter(e,s.COMPILE_STATUS),r=(s.getShaderInfoLog(e)||"").trim();if(n&&r==="")return"";const a=/ERROR: 0:(\d+)/.exec(r);if(a){const o=parseInt(a[1]);return t.toUpperCase()+`
4013
4014`+r+`
4015
4016`+Zx(s.getShaderSource(e),o)}else return r}function $x(s,e){const t=Jx(e);return[`vec4 ${s}( vec4 value ) {`,`	return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
4017`)}const Kx={[fu]:"Linear",[pu]:"Reinhard",[mu]:"Cineon",[gu]:"ACESFilmic",[xu]:"AgX",[vu]:"Neutral",[_u]:"Custom"};function Qx(s,e){const t=Kx[e];return t===void 0?(de("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+s+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+s+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Jr=new C;function jx(){tt.getLuminanceCoefficients(Jr);const s=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( ${s}, ${e}, ${t} );`,"	return dot( weights, rgb );","}"].join(`
4018`)}function ev(s){return[s.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",s.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(ks).join(`
4019`)}function tv(s){const e=[];for(const t in s){const n=s[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
4020`)}function nv(s,e){const t={},n=s.getProgramParameter(e,s.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const r=s.getActiveAttrib(e,i),a=r.name;let o=1;r.type===s.FLOAT_MAT2&&(o=2),r.type===s.FLOAT_MAT3&&(o=3),r.type===s.FLOAT_MAT4&&(o=4),t[a]={type:r.type,location:s.getAttribLocation(e,a),locationSize:o}}return t}function ks(s){return s!==""}function ru(s,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return s.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 au(s,e){return s.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const iv=/^[ \t]*#include +<([\w\d./]+)>/gm;function Tl(s){return s.replace(iv,rv)}const sv=new Map;function rv(s,e){let t=je[e];if(t===void 0){const n=sv.get(e);if(n!==void 0)t=je[n],de('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return Tl(t)}const av=/#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 ou(s){return s.replace(av,ov)}function ov(s,e,t,n){let i="";for(let r=parseInt(e);r<parseInt(t);r++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return i}function lu(s){let e=`precision ${s.precision} float;
4021	precision ${s.precision} int;
4022	precision ${s.precision} sampler2D;
4023	precision ${s.precision} samplerCube;
4024	precision ${s.precision} sampler3D;
4025	precision ${s.precision} sampler2DArray;
4026	precision ${s.precision} sampler2DShadow;
4027	precision ${s.precision} samplerCubeShadow;
4028	precision ${s.precision} sampler2DArrayShadow;
4029	precision ${s.precision} isampler2D;
4030	precision ${s.precision} isampler3D;
4031	precision ${s.precision} isamplerCube;
4032	precision ${s.precision} isampler2DArray;
4033	precision ${s.precision} usampler2D;
4034	precision ${s.precision} usampler3D;
4035	precision ${s.precision} usamplerCube;
4036	precision ${s.precision} usampler2DArray;
4037	`;return s.precision==="highp"?e+=`
4038#define HIGH_PRECISION`:s.precision==="mediump"?e+=`
4039#define MEDIUM_PRECISION`:s.precision==="lowp"&&(e+=`
4040#define LOW_PRECISION`),e}const lv={[$r]:"SHADOWMAP_TYPE_PCF",[Fs]:"SHADOWMAP_TYPE_VSM"};function cv(s){return lv[s.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const hv={[Gn]:"ENVMAP_TYPE_CUBE",[Ci]:"ENVMAP_TYPE_CUBE",[Qs]:"ENVMAP_TYPE_CUBE_UV"};function uv(s){return s.envMap===!1?"ENVMAP_TYPE_CUBE":hv[s.envMapMode]||"ENVMAP_TYPE_CUBE"}const dv={[Ci]:"ENVMAP_MODE_REFRACTION"};function fv(s){return s.envMap===!1?"ENVMAP_MODE_REFLECTION":dv[s.envMapMode]||"ENVMAP_MODE_REFLECTION"}const pv={[ba]:"ENVMAP_BLENDING_MULTIPLY",[Wd]:"ENVMAP_BLENDING_MIX",[Xd]:"ENVMAP_BLENDING_ADD"};function mv(s){return s.envMap===!1?"ENVMAP_BLENDING_NONE":pv[s.combine]||"ENVMAP_BLENDING_NONE"}function gv(s){const e=s.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:n,maxMip:t}}function _v(s,e,t,n){const i=s.getContext(),r=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=cv(t),c=uv(t),h=fv(t),d=mv(t),u=gv(t),f=ev(t),p=tv(r),_=i.createProgram();let g,m,x=t.glslVersion?"#version "+t.glslVersion+`
4041`:"";t.isRawShaderMaterial?(g=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p].filter(ks).join(`
4042`),g.length>0&&(g+=`
4043`),m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p].filter(ks).join(`
4044`),m.length>0&&(m+=`
4045`)):(g=[lu(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p,t.extensionCl
vendor: 6,566 bytes, lines 4045-4047
4045ipCullDistance?"#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.vertexNormals?"#define HAS_NORMAL":"",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",`
4046`].filter(ks).join(`
4047`),m=[lu(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.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",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
4047IDESCENCE":"",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.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",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!==Tn?"#define TONE_MAPPING":"",t.toneMapping!==Tn?je.tonemapping_pars_fragment:"",t.toneMapping!==Tn?Qx("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",je.colorspace_pars_fragment,$x("linearToOutputTexel",t.outputColorSpace),jx(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
4048`].filter(ks).join(`
4049`)),a=Tl(a),a=ru(a,t),a=au(a,t),o=Tl(o),o=ru(o,t),o=au(o,t),a=ou(a),o=ou(o),t.isRawShaderMaterial!==!0&&(x=`#version 300 es
4050`,g=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(`
4051`)+`
4052`+g,m=["#define varying in",t.glslVersion===Lc?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Lc?"":"#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(`
4053`)+`
4054`+m);const y=x+g+a,M=x+m+o,w=nu(i,i.VERTEX_SHADER,y),b=nu(i,i.FRAGMENT_SHADER,M);i.attachShader(_,w),i.attachShader(_,b),t.index0AttributeName!==void 0?i.bindAttribLocation(_,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(_,0,"position"),i.linkProgram(_);function R(I){if(s.debug.checkShaderErrors){const N=i.getProgramInfoLog(_)||"",H=i.getShaderInfoLog(w)||"",W=i.getShaderInfoLog(b)||"",U=N.trim(),B=H.trim(),k=W.trim();let te=!0,ne=!0;if(i.getProgramParameter(_,i.LINK_STATUS)===!1)if(te=!1,typeof s.debug.onShaderError=="function")s.debug.onShaderError(i,_,w,b);else{const pe=su(i,w,"vertex"),Me=su(i,b,"fragment");Pe("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,i.VALIDATE_STATUS)+`
4055
4056Material Name: `+I.name+`
4057Material Type: `+I.type+`
4058
4059Program Info Log: `+U+`
4060`+pe+`
4061`+Me)}else U!==""?de("WebGLProgram: Program Info Log:",U):(B===""||k==="")&&(ne=!1);ne&&(I.diagnostics={runnable:te,programLog:U,vertexShader:{log:B,prefix:g},fragmentShader:{log:k,prefix:m}})}i.deleteShader(w),i.deleteShader(b),v=new sa(i,_),A=nv(i,_)}let v;this.getUniforms=function(){return v===void 0&&R(this),v};let A;this.getAttributes=function(){return A===void 0&&R(this),A};let P=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return P===!1&&(P=i.getProgramParameter(_,qx)),P},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Yx++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=w,this.fragmentShader=b,this}let xv=0;class vv{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(r)===!1&&(a.add(r),r.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 yv(e),t.set(e,n)),n}}class yv{constructor(e){this.id=xv++,this.code=e,this.usedTimes=0}}function Mv(s){return s===Ri||s===oa||s===la}function Sv(s,e,t,n,i,r){const a=new zl,o=new vv,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,A,P,I,N,H){const W=I.fog,U=N.geometry,B=v.isMeshStandardMaterial||v.isMeshLambertMaterial||v.isMeshPhongMaterial?I.environment:null,k=v.isMeshStandardMaterial||v.isMeshLambertMaterial&&!v.envMap||v.isMeshPhongMaterial&&!v.envMap,te=e.get(v.envMap||B,k),ne=te&&te.mapping===Qs?te.image.height:null,pe=f[v.type];v.precision!==null&&(u=n.getMaxPrecision(v.precision),u!==v.precision&&de("WebGLProgram.getParameters:",v.precision,"not supported, using",u,"instead."));const Me=U.morphAttributes.position||U.morphAttributes.normal||U.morphAttributes.color,Ce=Me!==void 0?Me.length:0;let Ke=0;U.morphAttributes.position!==void 0&&(Ke=1),U.morphAttributes.normal!==void 0&&(Ke=2),U.morphAttributes.color!==void 0&&(Ke=3);let nt,He,J,ge;if(pe){const Ze=Sn[pe];nt=Ze.vertexShader,He=Ze.fragmentShader}else nt=v.vertexShader,He=v.fragmentShader,o.update(v),J=o.getVertexShaderID(v),ge=o.getFragmentShaderID(v);const ae=s.getRenderTarget(),Le=s.state.buffers.depth.getReversed(),Be=N.isInstancedMesh===!0,Fe=N.isBatchedMesh===!0,it=!!v.map,ze=!!v.matcap,$=!!te,ie=!!v.aoMap,Q=!!v.lightMap,xe=!!v.bumpMap,fe=!!v.normalMap,Ve=!!v.displacementMap,L=!!v.emissiveMap,We=!!v.metalnessMap,Re=!!v.roughnessMap,ke=v.anisotropy>0,se=v.clearcoat>
vendor: 4,833 bytes, line 4061
40610,lt=v.dispersion>0,E=v.iridescence>0,S=v.sheen>0,O=v.transmission>0,Y=ke&&!!v.anisotropyMap,j=se&&!!v.clearcoatMap,re=se&&!!v.clearcoatNormalMap,ce=se&&!!v.clearcoatRoughnessMap,X=E&&!!v.iridescenceMap,Z=E&&!!v.iridescenceThicknessMap,ye=S&&!!v.sheenColorMap,Ae=S&&!!v.sheenRoughnessMap,he=!!v.specularMap,oe=!!v.specularColorMap,Xe=!!v.specularIntensityMap,Qe=O&&!!v.transmissionMap,rt=O&&!!v.thicknessMap,D=!!v.gradientMap,le=!!v.alphaMap,q=v.alphaTest>0,Se=!!v.alphaHash,ue=!!v.extensions;let ee=Tn;v.toneMapped&&(ae===null||ae.isXRRenderTarget===!0)&&(ee=s.toneMapping);const De={shaderID:pe,shaderType:v.type,shaderName:v.name,vertexShader:nt,fragmentShader:He,defines:v.defines,customVertexShaderID:J,customFragmentShaderID:ge,isRawShaderMaterial:v.isRawShaderMaterial===!0,glslVersion:v.glslVersion,precision:u,batching:Fe,batchingColor:Fe&&N._colorsTexture!==null,instancing:Be,instancingColor:Be&&N.instanceColor!==null,instancingMorph:Be&&N.morphTexture!==null,outputColorSpace:ae===null?s.outputColorSpace:ae.isXRRenderTarget===!0?ae.texture.colorSpace:tt.workingColorSpace,alphaToCoverage:!!v.alphaToCoverage,map:it,matcap:ze,envMap:$,envMapMode:$&&te.mapping,envMapCubeUVHeight:ne,aoMap:ie,lightMap:Q,bumpMap:xe,normalMap:fe,displacementMap:Ve,emissiveMap:L,normalMapObjectSpace:fe&&v.normalMapType===Kd,normalMapTangentSpace:fe&&v.normalMapType===ri,packedNormalMap:fe&&v.normalMapType===ri&&Mv(v.normalMap.format),metalnessMap:We,roughnessMap:Re,anisotropy:ke,anisotropyMap:Y,clearcoat:se,clearcoatMap:j,clearcoatNormalMap:re,clearcoatRoughnessMap:ce,dispersion:lt,iridescence:E,iridescenceMap:X,iridescenceThicknessMap:Z,sheen:S,sheenColorMap:ye,sheenRoughnessMap:Ae,specularMap:he,specularColorMap:oe,specularIntensityMap:Xe,transmission:O,transmissionMap:Qe,thicknessMap:rt,gradientMap:D,opaque:v.transparent===!1&&v.blending===ls&&v.alphaToCoverage===!1,alphaMap:le,alphaTest:q,alphaHash:Se,combine:v.combine,mapUv:it&&p(v.map.channel),aoMapUv:ie&&p(v.aoMap.channel),lightMapUv:Q&&p(v.lightMap.channel),bumpMapUv:xe&&p(v.bumpMap.channel),normalMapUv:fe&&p(v.normalMap.channel),displacementMapUv:Ve&&p(v.displacementMap.channel),emissiveMapUv:L&&p(v.emissiveMap.channel),metalnessMapUv:We&&p(v.metalnessMap.channel),roughnessMapUv:Re&&p(v.roughnessMap.channel),anisotropyMapUv:Y&&p(v.anisotropyMap.channel),clearcoatMapUv:j&&p(v.clearcoatMap.channel),clearcoatNormalMapUv:re&&p(v.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ce&&p(v.clearcoatRoughnessMap.channel),iridescenceMapUv:X&&p(v.iridescenceMap.channel),iridescenceThicknessMapUv:Z&&p(v.iridescenceThicknessMap.channel),sheenColorMapUv:ye&&p(v.sheenColorMap.channel),sheenRoughnessMapUv:Ae&&p(v.sheenRoughnessMap.channel),specularMapUv:he&&p(v.specularMap.channel),specularColorMapUv:oe&&p(v.specularColorMap.channel),specularIntensityMapUv:Xe&&p(v.specularIntensityMap.channel),transmissionMapUv:Qe&&p(v.transmissionMap.channel),thicknessMapUv:rt&&p(v.thicknessMap.channel),alphaMapUv:le&&p(v.alphaMap.channel),vertexTangents:!!U.attributes.tangent&&(fe||ke),vertexNormals:!!U.attributes.normal,vertexColors:v.vertexColors,vertexAlphas:v.vertexColors===!0&&!!U.attributes.color&&U.attributes.color.itemSize===4,pointsUvs:N.isPoints===!0&&!!U.attributes.uv&&(it||le),fog:!!W,useFog:v.fog===!0,fogExp2:!!W&&W.isFogExp2,flatShading:v.wireframe===!1&&(v.flatShading===!0||U.attributes.normal===void 0&&fe===!1&&(v.isMeshLambertMaterial||v.isMeshPhongMaterial||v.isMeshStandardMaterial||v.isMeshPhysicalMaterial)),sizeAttenuation:v.sizeAttenuation===!0,logarithmicDepthBuffer:d,reversedDepthBuffer:Le,skinning:N.isSkinnedMesh===!0,morphTargets:U.morphAttributes.position!==void 0,morphNormals:U.morphAttributes.normal!==void 0,morphColors:U.morphAttributes.color!==void 0,morphTargetsCount:Ce,morphTextureStride:Ke,numDirLights:A.directional.length,numPointLights:A.point.length,numSpotLights:A.spot.length,numSpotLightMaps:A.spotLightMap.length,numRectAreaLights:A.rectArea.length,numHemiLights:A.hemi.length,numDirLightShadows:A.directionalShadowMap.length,numPointLightShadows:A.pointShadowMap.length,numSpotLightShadows:A.spotShadowMap.length,numSpotLightShadowsWithMaps:A.numSpotLightShadowsWithMaps,numLightProbes:A.numLightProbes,numLightProbeGrids:H.length,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:v.dithering,shadowMapEnabled:s.shadowMap.enabled&&P.length>0,shadowMapType:s.shadowMap.type,toneMapping:ee,decodeVideoTexture:it&&v.map.isVideoTexture===!0&&tt.getTransfer(v.map.colorSpace)===ct,decodeVideoTextureEmissive:L&&v.emissiveMap.isVideoTexture===!0&&tt.getTransfer(v.emissiveMap.colorSpace)===ct,premultipliedAlpha:v.premultipliedAlpha,doubleSided:v.side===Fn,flipSided:v.side===Yt,useDepthPacking:v.depthPacking>=0,depthPacking:v.depthPacking||0,index0AttributeName:v.index0AttributeName,extensionCl
vendor: 14,350 bytes, lines 4061-4088
4061ipCullDistance:ue&&v.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ue&&v.extensions.multiDraw===!0||Fe)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:v.customProgramCacheKey()};return De.vertexUv1s=l.has(1),De.vertexUv2s=l.has(2),De.vertexUv3s=l.has(3),l.clear(),De}function g(v){const A=[];if(v.shaderID?A.push(v.shaderID):(A.push(v.customVertexShaderID),A.push(v.customFragmentShaderID)),v.defines!==void 0)for(const P in v.defines)A.push(P),A.push(v.defines[P]);return v.isRawShaderMaterial===!1&&(m(A,v),x(A,v),A.push(s.outputColorSpace)),A.push(v.customProgramCacheKey),A.join()}function m(v,A){v.push(A.precision),v.push(A.outputColorSpace),v.push(A.envMapMode),v.push(A.envMapCubeUVHeight),v.push(A.mapUv),v.push(A.alphaMapUv),v.push(A.lightMapUv),v.push(A.aoMapUv),v.push(A.bumpMapUv),v.push(A.normalMapUv),v.push(A.displacementMapUv),v.push(A.emissiveMapUv),v.push(A.metalnessMapUv),v.push(A.roughnessMapUv),v.push(A.anisotropyMapUv),v.push(A.clearcoatMapUv),v.push(A.clearcoatNormalMapUv),v.push(A.clearcoatRoughnessMapUv),v.push(A.iridescenceMapUv),v.push(A.iridescenceThicknessMapUv),v.push(A.sheenColorMapUv),v.push(A.sheenRoughnessMapUv),v.push(A.specularMapUv),v.push(A.specularColorMapUv),v.push(A.specularIntensityMapUv),v.push(A.transmissionMapUv),v.push(A.thicknessMapUv),v.push(A.combine),v.push(A.fogExp2),v.push(A.sizeAttenuation),v.push(A.morphTargetsCount),v.push(A.morphAttributeCount),v.push(A.numDirLights),v.push(A.numPointLights),v.push(A.numSpotLights),v.push(A.numSpotLightMaps),v.push(A.numHemiLights),v.push(A.numRectAreaLights),v.push(A.numDirLightShadows),v.push(A.numPointLightShadows),v.push(A.numSpotLightShadows),v.push(A.numSpotLightShadowsWithMaps),v.push(A.numLightProbes),v.push(A.shadowMapType),v.push(A.toneMapping),v.push(A.numClippingPlanes),v.push(A.numClipIntersection),v.push(A.depthPacking)}function x(v,A){a.disableAll(),A.instancing&&a.enable(0),A.instancingColor&&a.enable(1),A.instancingMorph&&a.enable(2),A.matcap&&a.enable(3),A.envMap&&a.enable(4),A.normalMapObjectSpace&&a.enable(5),A.normalMapTangentSpace&&a.enable(6),A.clearcoat&&a.enable(7),A.iridescence&&a.enable(8),A.alphaTest&&a.enable(9),A.vertexColors&&a.enable(10),A.vertexAlphas&&a.enable(11),A.vertexUv1s&&a.enable(12),A.vertexUv2s&&a.enable(13),A.vertexUv3s&&a.enable(14),A.vertexTangents&&a.enable(15),A.anisotropy&&a.enable(16),A.alphaHash&&a.enable(17),A.batching&&a.enable(18),A.dispersion&&a.enable(19),A.batchingColor&&a.enable(20),A.gradientMap&&a.enable(21),A.packedNormalMap&&a.enable(22),A.vertexNormals&&a.enable(23),v.push(a.mask),a.disableAll(),A.fog&&a.enable(0),A.useFog&&a.enable(1),A.flatShading&&a.enable(2),A.logarithmicDepthBuffer&&a.enable(3),A.reversedDepthBuffer&&a.enable(4),A.skinning&&a.enable(5),A.morphTargets&&a.enable(6),A.morphNormals&&a.enable(7),A.morphColors&&a.enable(8),A.premultipliedAlpha&&a.enable(9),A.shadowMapEnabled&&a.enable(10),A.doubleSided&&a.enable(11),A.flipSided&&a.enable(12),A.useDepthPacking&&a.enable(13),A.dithering&&a.enable(14),A.transmission&&a.enable(15),A.sheen&&a.enable(16),A.opaque&&a.enable(17),A.pointsUvs&&a.enable(18),A.decodeVideoTexture&&a.enable(19),A.decodeVideoTextureEmissive&&a.enable(20),A.alphaToCoverage&&a.enable(21),A.numLightProbeGrids>0&&a.enable(22),v.push(a.mask)}function y(v){const A=f[v.type];let P;if(A){const I=Sn[A];P=Jp.clone(I.uniforms)}else P=v.uniforms;return P}function M(v,A){let P=h.get(A);return P!==void 0?++P.usedTimes:(P=new _v(s,A,v,i),c.push(P),h.set(A,P)),P}function w(v){if(--v.usedTimes===0){const A=c.indexOf(v);c[A]=c[c.length-1],c.pop(),h.delete(v.cacheKey),v.destroy()}}function b(v){o.remove(v)}function R(){o.dispose()}return{getParameters:_,getProgramCacheKey:g,getUniforms:y,acquireProgram:M,releaseProgram:w,releaseShaderCache:b,programs:c,dispose:R}}function bv(){let s=new WeakMap;function e(a){return s.has(a)}function t(a){let o=s.get(a);return o===void 0&&(o={},s.set(a,o)),o}function n(a){s.delete(a)}function i(a,o,l){s.get(a)[o]=l}function r(){s=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:r}}function Tv(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.material.id!==e.material.id?s.material.id-e.material.id:s.materialVariant!==e.materialVariant?s.materialVariant-e.materialVariant:s.z!==e.z?s.z-e.z:s.id-e.id}function cu(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.z!==e.z?e.z-s.z:s.id-e.id}function hu(){const s=[];let e=0;const t=[],n=[],i=[];function r(){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=s[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},s[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||Tv),n.length>1&&n.sort(f||cu),i.length>1&&i.sort(f||cu)}function d(){for(let u=e,f=s.length;u<f;u++){const p=s[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:r,push:l,unshift:c,finish:d,sort:h}}function Av(){let s=new WeakMap;function e(n,i){const r=s.get(n);let a;return r===void 0?(a=new hu,s.set(n,[a])):i>=r.length?(a=new hu,r.push(a)):a=r[i],a}function t(){s=new WeakMap}return{get:e,dispose:t}}function Ev(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new C,color:new be};break;case"SpotLight":t={position:new C,direction:new C,color:new be,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new C,color:new be,distance:0,decay:0};break;case"HemisphereLight":t={direction:new C,skyColor:new be,groundColor:new be};break;case"RectAreaLight":t={color:new be,position:new C,halfWidth:new C,halfHeight:new C};break}return s[e.id]=t,t}}}function wv(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[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 s[e.id]=t,t}}}let Cv=0;function Rv(s,e){return(e.castShadow?2:0)-(s.castShadow?2:0)+(e.map?1:0)-(s.map?1:0)}function Iv(s){const e=new Ev,t=wv(),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,r=new Ge,a=new Ge;function o(c){let h=0,d=0,u=0;for(let A=0;A<9;A++)n.probe[A].set(0,0,0);let f=0,p=0,_=0,g=0,m=0,x=0,y=0,M=0,w=0,b=0,R=0;c.sort(Rv);for(let A=0,P=c.length;A<P;A++){const I=c[A],N=I.color,H=I.intensity,W=I.distance;let U=null;if(I.shadow&&I.shadow.map&&(I.shadow.map.texture.format===Ri?U=I.shadow.map.texture:U=I.shadow.map.depthTexture||I.shadow.map.texture),I.isAmbientLight)h+=N.r*H,d+=N.g*H,u+=N.b*H;else if(I.isLightProbe){for(let B=0;B<9;B++)n.probe[B].addScaledVector(I.sh.coefficients[B],H);R++}else if(I.isDirectionalLight){const B=e.get(I);if(B.color.copy(I.color).multiplyScalar(I.intensity),I.castShadow){const k=I.shadow,te=t.get(I);te.shadowIntensity=k.intensity,te.shadowBias=k.bias,te.shadowNormalBias=k.normalBias,te.shadowRadius=k.radius,te.shadowMapSize=k.mapSize,n.directionalShadow[f]=te,n.directionalShadowMap[f]=U,n.directionalShadowMatrix[f]=I.shadow.matrix,x++}n.directional[f]=B,f++}else if(I.isSpotLight){const B=e.get(I);B.position.setFromMatrixPosition(I.matrixWorld),B.color.copy(N).multiplyScalar(H),B.distance=W,B.coneCos=Math.cos(I.angle),B.penumbraCos=Math.cos(I.angle*(1-I.penumbra)),B.decay=I.decay,n.spot[_]=B;const k=I.shadow;if(I.map&&(n.spotLightMap[w]=I.map,w++,k.updateMatrices(I),I.castShadow&&b++),n.spotLightMatrix[_]=k.matrix,I.castShadow){const te=t.get(I);te.shadowIntensity=k.intensity,te.shadowBias=k.bias,te.shadowNormalBias=k.normalBias,te.shadowRadius=k.radius,te.shadowMapSize=k.mapSize,n.spotShadow[_]=te,n.spotShadowMap[_]=U,M++}_++}else if(I.isRectAreaLight){const B=e.get(I);B.color.copy(N).multiplyScalar(H),B.halfWidth.set(I.width*.5,0,0),B.halfHeight.set(0,I.height*.5,0),n.rectArea[g]=B,g++}else if(I.isPointLight){const B=e.get(I);if(B.color.copy(I.color).multiplyScalar(I.intensity),B.distance=I.distance,B.decay=I.decay,I.castShadow){const k=I.shadow,te=t.get(I);te.shadowIntensity=k.intensity,te.shadowBias=k.bias,te.shadowNormalBias=k.normalBias,te.shadowRadius=k.radius,te.shadowMapSize=k.mapSize,te.shadowCameraNear=k.camera.near,te.shadowCameraFar=k.camera.far,n.pointShadow[p]=te,n.pointShadowMap[p]=U,n.pointShadowMatrix[p]=I.shadow.matrix,y++}n.point[p]=B,p++}else if(I.isHemisphereLight){const B=e.get(I);B.skyColor.copy(I.color).multiplyScalar(H),B.groundColor.copy(I.groundColor).multiplyScalar(H),n.hemi[m]=B,m++}}g>0&&(s.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=me.LTC_FLOAT_1,n.rectAreaLTC2=me.LTC_FLOAT_2):(n.rectAreaLTC1=me.LTC_HALF_1,n.rectAreaLTC2=me.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=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!==w||v.numLightProbes!==R)&&(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+w-b,n.spotLightMap.length=w,n.numSpotLightShadowsWithMaps=b,n.numLightProbes=R,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=w,v.numLightProbes=R,n.version=Cv++)}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(),r.copy(y.matrixWorld),r.premultiply(g),a.extractRotation(r),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 uu(s){const e=new Iv(s),t=[],n=[],i=[];function r(u){d.camera=u,t.length=0,n.length=0,i.length=0}function a(u){t.push(u)}function o(u){n.push(u)}function l(u){i.push(u)}function c(){e.setup(t)}function h(u){e.setupView(t,u)}const d={lightsArray:t,shadowsArray:n,lightProbeGridArray:i,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:r,state:d,setupLights:c,setupLightsView:h,pushLight:a,pushShadow:o,pushLightProbeGrid:l}}function Pv(s){let e=new WeakMap;function t(i,r=0){const a=e.get(i);let o;return a===void 0?(o=new uu(s),e.set(i,[o])):r>=a.length?(o=new uu(s),a.push(o)):o=a[r],o}function n(){e=new WeakMap}return{get:t,dispose:n}}const Lv=`void main() {
4062	gl_Position = vec4( position, 1.0 );
4063}`,Dv=`uniform sampler2D shadow_pass;
4064uniform vec2 resolution;
4065uniform float radius;
4066void main() {
4067	const float samples = float( VSM_SAMPLES );
4068	float mean = 0.0;
4069	float squared_mean = 0.0;
4070	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
4071	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
4072	for ( float i = 0.0; i < samples; i ++ ) {
4073		float uvOffset = uvStart + i * uvStride;
4074		#ifdef HORIZONTAL_PASS
4075			vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;
4076			mean += distribution.x;
4077			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
4078		#else
4079			float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;
4080			mean += depth;
4081			squared_mean += depth * depth;
4082		#endif
4083	}
4084	mean = mean / samples;
4085	squared_mean = squared_mean / samples;
4086	float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
4087	gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
4088}`,Uv=[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)],Nv=[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)],du=new Ge,Ns=new C,Co=new C;function Fv(s,e,t){let n=new er;const i=new K,r=new K,a=new dt,o=new Ku,l=new Qu,c={},h=t.maxTextureSize,d={[si]:Yt,[Yt]:si,[Fn]:Fn}
vendor: 4,886 bytes, line 4088
4088,u=new pn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new K},radius:{value:4}},vertexShader:Lv,fragmentShader:Dv}),f=u.clone();f.defines.HORIZONTAL_PASS=1;const p=new Ye;p.setAttribute("position",new mt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new Ct(p,u),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=$r;let m=this.type;this.render=function(b,R,v){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||b.length===0)return;this.type===Ad&&(de("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=$r);const A=s.getRenderTarget(),P=s.getActiveCubeFace(),I=s.getActiveMipmapLevel(),N=s.state;N.setBlending(Vn),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 H=m!==this.type;H&&R.traverse(function(W){W.material&&(Array.isArray(W.material)?W.material.forEach(U=>U.needsUpdate=!0):W.material.needsUpdate=!0)});for(let W=0,U=b.length;W<U;W++){const B=b[W],k=B.shadow;if(k===void 0){de("WebGLShadowMap:",B,"has no shadow.");continue}if(k.autoUpdate===!1&&k.needsUpdate===!1)continue;i.copy(k.mapSize);const te=k.getFrameExtents();i.multiply(te),r.copy(k.mapSize),(i.x>h||i.y>h)&&(i.x>h&&(r.x=Math.floor(h/te.x),i.x=r.x*te.x,k.mapSize.x=r.x),i.y>h&&(r.y=Math.floor(h/te.y),i.y=r.y*te.y,k.mapSize.y=r.y));const ne=s.state.buffers.depth.getReversed();if(k.camera._reversedDepth=ne,k.map===null||H===!0){if(k.map!==null&&(k.map.depthTexture!==null&&(k.map.depthTexture.dispose(),k.map.depthTexture=null),k.map.dispose()),this.type===Fs){if(B.isPointLight){de("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}k.map=new cn(i.x,i.y,{format:Ri,type:Hn,minFilter:_t,magFilter:_t,generateMipmaps:!1}),k.map.texture.name=B.name+".shadowMap",k.map.depthTexture=new ms(i.x,i.y,Xt),k.map.depthTexture.name=B.name+".shadowMapDepth",k.map.depthTexture.format=Wn,k.map.depthTexture.compareFunction=null,k.map.depthTexture.minFilter=wt,k.map.depthTexture.magFilter=wt}else B.isPointLight?(k.map=new cd(i.x),k.map.depthTexture=new up(i.x,fn)):(k.map=new cn(i.x,i.y),k.map.depthTexture=new ms(i.x,i.y,fn)),k.map.depthTexture.name=B.name+".shadowMap",k.map.depthTexture.format=Wn,this.type===$r?(k.map.depthTexture.compareFunction=ne?Nl:Ul,k.map.depthTexture.minFilter=_t,k.map.depthTexture.magFilter=_t):(k.map.depthTexture.compareFunction=null,k.map.depthTexture.minFilter=wt,k.map.depthTexture.magFilter=wt);k.camera.updateProjectionMatrix()}const pe=k.map.isWebGLCubeRenderTarget?6:1;for(let Me=0;Me<pe;Me++){if(k.map.isWebGLCubeRenderTarget)s.setRenderTarget(k.map,Me),s.clear();else{Me===0&&(s.setRenderTarget(k.map),s.clear());const Ce=k.getViewport(Me);a.set(r.x*Ce.x,r.y*Ce.y,r.x*Ce.z,r.y*Ce.w),N.viewport(a)}if(B.isPointLight){const Ce=k.camera,Ke=k.matrix,nt=B.distance||Ce.far;nt!==Ce.far&&(Ce.far=nt,Ce.updateProjectionMatrix()),Ns.setFromMatrixPosition(B.matrixWorld),Ce.position.copy(Ns),Co.copy(Ce.position),Co.add(Uv[Me]),Ce.up.copy(Nv[Me]),Ce.lookAt(Co),Ce.updateMatrixWorld(),Ke.makeTranslation(-Ns.x,-Ns.y,-Ns.z),du.multiplyMatrices(Ce.projectionMatrix,Ce.matrixWorldInverse),k._frustum.setFromProjectionMatrix(du,Ce.coordinateSystem,Ce.reversedDepth)}else k.updateMatrices(B);n=k.getFrustum(),M(R,v,k.camera,B,this.type)}k.isPointLightShadow!==!0&&this.type===Fs&&x(k,v),k.needsUpdate=!1}m=this.type,g.needsUpdate=!1,s.setRenderTarget(A,P,I)};function x(b,R){const v=e.update(_);u.defines.VSM_SAMPLES!==b.blurSamples&&(u.defines.VSM_SAMPLES=b.blurSamples,f.defines.VSM_SAMPLES=b.blurSamples,u.needsUpdate=!0,f.needsUpdate=!0),b.mapPass===null&&(b.mapPass=new cn(i.x,i.y,{format:Ri,type:Hn})),u.uniforms.shadow_pass.value=b.map.depthTexture,u.uniforms.resolution.value=b.mapSize,u.uniforms.radius.value=b.radius,s.setRenderTarget(b.mapPass),s.clear(),s.renderBufferDirect(R,null,v,u,_,null),f.uniforms.shadow_pass.value=b.mapPass.texture,f.uniforms.resolution.value=b.mapSize,f.uniforms.radius.value=b.radius,s.setRenderTarget(b.map),s.clear(),s.renderBufferDirect(R,null,v,f,_,null)}function y(b,R,v,A){let P=null;const I=v.isPointLight===!0?b.customDistanceMaterial:b.customDepthMaterial;if(I!==void 0)P=I;else if(P=v.isPointLight===!0?l:o,s.localClippingEnabled&&R.clipShadows===!0&&Array.isArray(R.clippingPlanes)&&R.clippingPlanes.length!==0||R.displacementMap&&R.displacementScale!==0||R.alphaMap&&R.alphaTest>0||R.map&&R.alphaTest>0||R.alphaToCoverage===!0){const N=P.uuid,H=R.uuid;let W=c[N];W===void 0&&(W={},c[N]=W);let U=W[H];U===void 0&&(U=P.clone(),W[H]=U,R.addEventListener("dispose",w)),P=U}if(P.visible=R.visible,P.wireframe=R.wireframe,A===Fs?P.side=R.shadowSide!==null?R.shadowSide:R.side:P.side=R.shadowSide!==null?R.shadowSide:d[R.side],P.alphaMap=R.alphaMap,P.alphaTest=R.alph
vendor: 8,055 bytes, line 4088
4088aToCoverage===!0?.5:R.alphaTest,P.map=R.map,P.clipShadows=R.clipShadows,P.clippingPlanes=R.clippingPlanes,P.clipIntersection=R.clipIntersection,P.displacementMap=R.displacementMap,P.displacementScale=R.displacementScale,P.displacementBias=R.displacementBias,P.wireframeLinewidth=R.wireframeLinewidth,P.linewidth=R.linewidth,v.isPointLight===!0&&P.isMeshDistanceMaterial===!0){const N=s.properties.get(P);N.light=v}return P}function M(b,R,v,A,P){if(b.visible===!1)return;if(b.layers.test(R.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&P===Fs)&&(!b.frustumCulled||n.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(v.matrixWorldInverse,b.matrixWorld);const H=e.update(b),W=b.material;if(Array.isArray(W)){const U=H.groups;for(let B=0,k=U.length;B<k;B++){const te=U[B],ne=W[te.materialIndex];if(ne&&ne.visible){const pe=y(b,ne,A,P);b.onBeforeShadow(s,b,R,v,H,pe,te),s.renderBufferDirect(v,null,H,pe,b,te),b.onAfterShadow(s,b,R,v,H,pe,te)}}}else if(W.visible){const U=y(b,W,A,P);b.onBeforeShadow(s,b,R,v,H,U,null),s.renderBufferDirect(v,null,H,U,b,null),b.onAfterShadow(s,b,R,v,H,U,null)}}const N=b.children;for(let H=0,W=N.length;H<W;H++)M(N[H],R,v,A,P)}function w(b){b.target.removeEventListener("dispose",w);for(const v in c){const A=c[v],P=b.target.uuid;P in A&&(A[P].dispose(),delete A[P])}}}function Ov(s,e){function t(){let D=!1;const le=new dt;let q=null;const Se=new dt(0,0,0,0);return{setMask:function(ue){q!==ue&&!D&&(s.colorMask(ue,ue,ue,ue),q=ue)},setLocked:function(ue){D=ue},setClear:function(ue,ee,De,Ze,St){St===!0&&(ue*=Ze,ee*=Ze,De*=Ze),le.set(ue,ee,De,Ze),Se.equals(le)===!1&&(s.clearColor(ue,ee,De,Ze),Se.copy(le))},reset:function(){D=!1,q=null,Se.set(-1,0,0,0)}}}function n(){let D=!1,le=!1,q=null,Se=null,ue=null;return{setReversed:function(ee){if(le!==ee){const De=e.get("EXT_clip_control");ee?De.clipControlEXT(De.LOWER_LEFT_EXT,De.ZERO_TO_ONE_EXT):De.clipControlEXT(De.LOWER_LEFT_EXT,De.NEGATIVE_ONE_TO_ONE_EXT),le=ee;const Ze=ue;ue=null,this.setClear(Ze)}},getReversed:function(){return le},setTest:function(ee){ee?ae(s.DEPTH_TEST):Le(s.DEPTH_TEST)},setMask:function(ee){q!==ee&&!D&&(s.depthMask(ee),q=ee)},setFunc:function(ee){if(le&&(ee=cf[ee]),Se!==ee){switch(ee){case Po:s.depthFunc(s.NEVER);break;case Lo:s.depthFunc(s.ALWAYS);break;case Do:s.depthFunc(s.LESS);break;case us:s.depthFunc(s.LEQUAL);break;case Uo:s.depthFunc(s.EQUAL);break;case No:s.depthFunc(s.GEQUAL);break;case Fo:s.depthFunc(s.GREATER);break;case Oo:s.depthFunc(s.NOTEQUAL);break;default:s.depthFunc(s.LEQUAL)}Se=ee}},setLocked:function(ee){D=ee},setClear:function(ee){ue!==ee&&(ue=ee,le&&(ee=1-ee),s.clearDepth(ee))},reset:function(){D=!1,q=null,Se=null,ue=null,le=!1}}}function i(){let D=!1,le=null,q=null,Se=null,ue=null,ee=null,De=null,Ze=null,St=null;return{setTest:function(ht){D||(ht?ae(s.STENCIL_TEST):Le(s.STENCIL_TEST))},setMask:function(ht){le!==ht&&!D&&(s.stencilMask(ht),le=ht)},setFunc:function(ht,Rn,gn){(q!==ht||Se!==Rn||ue!==gn)&&(s.stencilFunc(ht,Rn,gn),q=ht,Se=Rn,ue=gn)},setOp:function(ht,Rn,gn){(ee!==ht||De!==Rn||Ze!==gn)&&(s.stencilOp(ht,Rn,gn),ee=ht,De=Rn,Ze=gn)},setLocked:function(ht){D=ht},setClear:function(ht){St!==ht&&(s.clearStencil(ht),St=ht)},reset:function(){D=!1,le=null,q=null,Se=null,ue=null,ee=null,De=null,Ze=null,St=null}}}const r=new t,a=new n,o=new i,l=new WeakMap,c=new WeakMap;let h={},d={},u={},f=new WeakMap,p=[],_=null,g=!1,m=null,x=null,y=null,M=null,w=null,b=null,R=null,v=new be(0,0,0),A=0,P=!1,I=null,N=null,H=null,W=null,U=null;const B=s.getParameter(s.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let k=!1,te=0;const ne=s.getParameter(s.VERSION);ne.indexOf("WebGL")!==-1?(te=parseFloat(/^WebGL (\d)/.exec(ne)[1]),k=te>=1):ne.indexOf("OpenGL ES")!==-1&&(te=parseFloat(/^OpenGL ES (\d)/.exec(ne)[1]),k=te>=2);let pe=null,Me={};const Ce=s.getParameter(s.SCISSOR_BOX),Ke=s.getParameter(s.VIEWPORT),nt=new dt().fromArray(Ce),He=new dt().fromArray(Ke);function J(D,le,q,Se){const ue=new Uint8Array(4),ee=s.createTexture();s.bindTexture(D,ee),s.texParameteri(D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(D,s.TEXTURE_MAG_FILTER,s.NEAREST);for(let De=0;De<q;De++)D===s.TEXTURE_3D||D===s.TEXTURE_2D_ARRAY?s.texImage3D(le,0,s.RGBA,1,1,Se,0,s.RGBA,s.UNSIGNED_BYTE,ue):s.texImage2D(le+De,0,s.RGBA,1,1,0,s.RGBA,s.UNSIGNED_BYTE,ue);return ee}const ge={};ge[s.TEXTURE_2D]=J(s.TEXTURE_2D,s.TEXTURE_2D,1),ge[s.TEXTURE_CUBE_MAP]=J(s.TEXTURE_CUBE_MAP,s.TEXTURE_CUBE_MAP_POSITIVE_X,6),ge[s.TEXTURE_2D_ARRAY]=J(s.TEXTURE_2D_ARRAY,s.TEXTURE_2D_ARRAY,1,1),ge[s.TEXTURE_3D]=J(s.TEXTURE_3D,s.TEXTURE_3D,1,1),r.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ae(s.DEPTH_TEST),a.setFunc(us),xe(!1),fe(Ac),ae(s.CULL_FACE),ie(Vn);function ae(D){h[D]!==!0&&(s.enable(D),h[D]=!0)}function Le(D){h[D]!==!1&&(s.disable(D),h[D]=!1)}function Be(D,le){return u[D]!==le?(s.bindFramebuffer(D,le),u[D]=le,D===s.DRAW_FRAMEBUFFER&&(u[s.FRAMEBUFFER]=le),D===s.FRAMEBUFFER&&(u[s.DRAW_FRAMEBUFFER]=le),!0):!1}function Fe(D,le){let q=p,Se=!1;if(D){q=f.get(le),q===void 0&&(q=[],f.set(le,q));const ue=D.textures;if(q.length!==ue.length||q[0]!==s.COLOR_ATTACHMENT0){for(let ee=0,De=ue.length;ee<De;ee++)q[ee]=s.COLOR_ATTACHMENT0+ee;q.length=ue.length,Se=!0}}else q[0]!==s.BACK&&(q[0]=s.BACK,Se=!0);Se&&s.drawBuffers(q)}function it(D){return _!==D?(s.useProgram(D),_=D,!0):!1}const ze={[Si]:s.FUNC_ADD,[wd]:s.FUNC_SUBTRACT,[Cd]:s.FUNC_REVERSE_SUBTRACT};ze[Rd]=s.MIN,ze[Id]=s.MAX;const $={[Pd]:s.ZERO,[Ld]:s.ONE,[Dd]:s.SRC_COLOR,[Ro]:s.SRC_ALPHA,[zd]:s.SRC_ALPHA_SATURATE,[Od]:s.DST_COLOR,[Nd]:s.DST_ALPHA,[Ud]:s.ONE_MINUS_SRC_COLOR,[Io]:s.ONE_MINUS_SRC_ALPHA,[Bd]:s.ONE_MINUS_DST_COLOR,[Fd]:s.ONE_MINUS_DST_ALPHA,[Vd]:s.CONSTANT_COLOR,[kd]:s.ONE_MINUS_CONSTANT_COLOR,[Gd]:s.CONSTANT_ALPHA,[Hd]:s.ONE_MINUS_CONSTANT_ALPHA};function ie(D,le,q,Se,ue,ee,De,Ze,St,ht){if(D===Vn){g===!0&&(Le(s.BLEND),g=!1);return}if(g===!1&&(ae(s.BLEND),g=!0),D!==Ed){if(D!==m||ht!==P){if((x!==Si||w!==Si)&&(s.blendEquation(s.FUNC_ADD),x=Si,w=Si),ht)switch(D){case ls:s.blendFuncSeparate(s.ONE,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case Ec:s.blendFunc(s.ONE,s.ONE);break;case wc:s.blendFuncSeparate(s.ZERO,s.ONE_MINUS_SRC_COLOR,s.ZERO,s.ONE);break;case Cc:s.blendFuncSeparate(s.DST_COLOR,s.ONE_MINUS_SRC_ALPHA,s.ZERO,s.ONE);break;default:Pe("WebGLState: Invalid blending: ",D);break}else switch(D){case ls:s.blendFuncSeparate(s.SRC_ALPHA,s.ONE_MINUS_SRC_ALPHA,s.ONE,s.ONE_MINUS_SRC_ALPHA);break;case Ec:s.blendFuncSeparate(s.SRC_ALPHA,s.ONE,s.ONE,s.ONE);break;case wc:Pe("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Cc:Pe("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Pe("WebGLState: Invalid blending: ",D);break}y=null,M=null,b=null,R=null,v.set(0,0,0),A=0,m=D,P=ht}return}ue=ue||le,ee=ee||q,De=De||Se,(le!==x||ue!==w)&&(s.blendEquationSeparate(ze[le],ze[ue]),x=le,w=ue),(q!==y||Se!==M||ee!==b||De!==R)&&(s.blendFuncSeparate($[q],$[Se],$[ee],$[De]),y=q,M=Se,b=ee,R=De),(Ze.equals(v)===!1||St!==A)&&(s.blendColor(Ze.r,Ze.g,Ze.b,St),v.copy(Ze),A=St),m=D,P=!1}function Q(D,le){D.side===Fn?Le(s.CULL_FACE):ae(s.CULL_FACE);let q=D.side===Yt;le&&(q=!q),xe(q),D.blending===ls&&D.transparent===!1?ie(Vn):ie(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),r.setMask(D.colorWrite);const Se=D.stencilWrite;o.setTest(Se),Se&&(o.setMask(D.stencilWriteMask),o.setFunc(D.stencilFunc,D.stencilRef,D.stencilFuncMask),o.setOp(D.stencilFail,D.stencilZFail,D.stencilZPass)),L(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),D.alphaToCoverage===!0?ae(s.SAMPLE_ALPHA_TO_COVERAGE):Le(s.SAMPLE_ALPHA_TO_COVERAGE)}function xe(D){I!==D&&(D?s.frontFace(s.CW):s.frontFace(s.CCW),I=D)}function fe(D){D!==bd?(ae(s.CULL_FACE),D!==N&&(D===Ac?s.cullFace(s.BACK):D===Td?s.cullFace(s.FRONT):s.cullFace(s.FRONT_AND_BACK))):Le(s.CULL_FACE),N=D}function Ve(D){D!==H&&(k&&s.lineWidth(D),H=D)}
vendor: 2,320 bytes, line 4088
4088function L(D,le,q){D?(ae(s.POLYGON_OFFSET_FILL),(W!==le||U!==q)&&(W=le,U=q,a.getReversed()&&(le=-le),s.polygonOffset(le,q))):Le(s.POLYGON_OFFSET_FILL)}function We(D){D?ae(s.SCISSOR_TEST):Le(s.SCISSOR_TEST)}function Re(D){D===void 0&&(D=s.TEXTURE0+B-1),pe!==D&&(s.activeTexture(D),pe=D)}function ke(D,le,q){q===void 0&&(pe===null?q=s.TEXTURE0+B-1:q=pe);let Se=Me[q];Se===void 0&&(Se={type:void 0,texture:void 0},Me[q]=Se),(Se.type!==D||Se.texture!==le)&&(pe!==q&&(s.activeTexture(q),pe=q),s.bindTexture(D,le||ge[D]),Se.type=D,Se.texture=le)}function se(){const D=Me[pe];D!==void 0&&D.type!==void 0&&(s.bindTexture(D.type,null),D.type=void 0,D.texture=void 0)}function lt(){try{s.compressedTexImage2D(...arguments)}catch(D){Pe("WebGLState:",D)}}function E(){try{s.compressedTexImage3D(...arguments)}catch(D){Pe("WebGLState:",D)}}function S(){try{s.texSubImage2D(...arguments)}catch(D){Pe("WebGLState:",D)}}function O(){try{s.texSubImage3D(...arguments)}catch(D){Pe("WebGLState:",D)}}function Y(){try{s.compressedTexSubImage2D(...arguments)}catch(D){Pe("WebGLState:",D)}}function j(){try{s.compressedTexSubImage3D(...arguments)}catch(D){Pe("WebGLState:",D)}}function re(){try{s.texStorage2D(...arguments)}catch(D){Pe("WebGLState:",D)}}function ce(){try{s.texStorage3D(...arguments)}catch(D){Pe("WebGLState:",D)}}function X(){try{s.texImage2D(...arguments)}catch(D){Pe("WebGLState:",D)}}function Z(){try{s.texImage3D(...arguments)}catch(D){Pe("WebGLState:",D)}}function ye(D){return d[D]!==void 0?d[D]:s.getParameter(D)}function Ae(D,le){d[D]!==le&&(s.pixelStorei(D,le),d[D]=le)}function he(D){nt.equals(D)===!1&&(s.scissor(D.x,D.y,D.z,D.w),nt.copy(D))}function oe(D){He.equals(D)===!1&&(s.viewport(D.x,D.y,D.z,D.w),He.copy(D))}function Xe(D,le){let q=c.get(le);q===void 0&&(q=new WeakMap,c.set(le,q));let Se=q.get(D);Se===void 0&&(Se=s.getUniformBlockIndex(le,D.name),q.set(D,Se))}function Qe(D,le){const Se=c.get(le).get(D);l.get(le)!==Se&&(s.uniformBlockBinding(le,Se,D.__bindingPointIndex),l.set(le,Se))}function rt(){s.disable(s.BLEND),s.disable(s.CULL_FACE),s.disable(s.DEPTH_TEST),s.disable(s.POLYGON_OFFSET_FILL),s.disable(s.SCISSOR_TEST),s.disable(s.STENCIL_TEST),s.disable(s.SAMPLE_ALPHA_TO_COVERAGE),s.blendEquation(s.FUNC_ADD),s.blendFunc(s.ONE,s.ZERO),s.blendFuncSeparate(s.ONE,s.ZERO,s.ONE,s.ZERO),s.blendColor
vendor: 3,251 bytes, line 4088
4088(0,0,0,0),s.colorMask(!0,!0,!0,!0),s.clearColor(0,0,0,0),s.depthMask(!0),s.depthFunc(s.LESS),a.setReversed(!1),s.clearDepth(1),s.stencilMask(4294967295),s.stencilFunc(s.ALWAYS,0,4294967295),s.stencilOp(s.KEEP,s.KEEP,s.KEEP),s.clearStencil(0),s.cullFace(s.BACK),s.frontFace(s.CCW),s.polygonOffset(0,0),s.activeTexture(s.TEXTURE0),s.bindFramebuffer(s.FRAMEBUFFER,null),s.bindFramebuffer(s.DRAW_FRAMEBUFFER,null),s.bindFramebuffer(s.READ_FRAMEBUFFER,null),s.useProgram(null),s.lineWidth(1),s.scissor(0,0,s.canvas.width,s.canvas.height),s.viewport(0,0,s.canvas.width,s.canvas.height),s.pixelStorei(s.PACK_ALIGNMENT,4),s.pixelStorei(s.UNPACK_ALIGNMENT,4),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,!1),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,s.BROWSER_DEFAULT_WEBGL),s.pixelStorei(s.PACK_ROW_LENGTH,0),s.pixelStorei(s.PACK_SKIP_PIXELS,0),s.pixelStorei(s.PACK_SKIP_ROWS,0),s.pixelStorei(s.UNPACK_ROW_LENGTH,0),s.pixelStorei(s.UNPACK_IMAGE_HEIGHT,0),s.pixelStorei(s.UNPACK_SKIP_PIXELS,0),s.pixelStorei(s.UNPACK_SKIP_ROWS,0),s.pixelStorei(s.UNPACK_SKIP_IMAGES,0),h={},d={},pe=null,Me={},u={},f=new WeakMap,p=[],_=null,g=!1,m=null,x=null,y=null,M=null,w=null,b=null,R=null,v=new be(0,0,0),A=0,P=!1,I=null,N=null,H=null,W=null,U=null,nt.set(0,0,s.canvas.width,s.canvas.height),He.set(0,0,s.canvas.width,s.canvas.height),r.reset(),a.reset(),o.reset()}return{buffers:{color:r,depth:a,stencil:o},enable:ae,disable:Le,bindFramebuffer:Be,drawBuffers:Fe,useProgram:it,setBlending:ie,setMaterial:Q,setFlipSided:xe,setCullFace:fe,setLineWidth:Ve,setPolygonOffset:L,setScissorTest:We,activeTexture:Re,bindTexture:ke,unbindTexture:se,compressedTexImage2D:lt,compressedTexImage3D:E,texImage2D:X,texImage3D:Z,pixelStorei:Ae,getParameter:ye,updateUBOMapping:Xe,uniformBlockBinding:Qe,texStorage2D:re,texStorage3D:ce,texSubImage2D:S,texSubImage3D:O,compressedTexSubImage2D:Y,compressedTexSubImage3D:j,scissor:he,viewport:oe,reset:rt}}function Bv(s,e,t,n,i,r,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,d=new Set;let u;const f=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(E,S){return p?new OffscreenCanvas(E,S):Ys("canvas")}function g(E,S,O){let Y=1;const j=lt(E);if((j.width>O||j.height>O)&&(Y=O/Math.max(j.width,j.height)),Y<1)if(typeof HTMLImageElement<"u"&&E instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&E instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&E instanceof ImageBitmap||typeof VideoFrame<"u"&&E instanceof VideoFrame){const re=Math.floor(Y*j.width),ce=Math.floor(Y*j.height);u===void 0&&(u=_(re,ce));const X=S?_(re,ce):u;return X.width=re,X.height=ce,X.getContext("2d").drawImage(E,0,0,re,ce),de("WebGLRenderer: Texture has been resized from ("+j.width+"x"+j.height+") to ("+re+"x"+ce+")."),X}else return"data"in E&&de("WebGLRenderer: Image in DataTexture is too big ("+j.width+"x"+j.height+")."),E;return E}function m(E){return E.generateMipmaps}function x(E){s.generateMipmap(E)}function y(E){return E.isWebGLCubeRenderTarget?s.TEXTURE_CUBE_MAP:E.isWebG
vendor: 4,112 bytes, line 4088
4088L3DRenderTarget?s.TEXTURE_3D:E.isWebGLArrayRenderTarget||E.isCompressedArrayTexture?s.TEXTURE_2D_ARRAY:s.TEXTURE_2D}function M(E,S,O,Y,j,re=!1){if(E!==null){if(s[E]!==void 0)return s[E];de("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+E+"'")}let ce;Y&&(ce=e.get("EXT_texture_norm16"),ce||de("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let X=S;if(S===s.RED&&(O===s.FLOAT&&(X=s.R32F),O===s.HALF_FLOAT&&(X=s.R16F),O===s.UNSIGNED_BYTE&&(X=s.R8),O===s.UNSIGNED_SHORT&&ce&&(X=ce.R16_EXT),O===s.SHORT&&ce&&(X=ce.R16_SNORM_EXT)),S===s.RED_INTEGER&&(O===s.UNSIGNED_BYTE&&(X=s.R8UI),O===s.UNSIGNED_SHORT&&(X=s.R16UI),O===s.UNSIGNED_INT&&(X=s.R32UI),O===s.BYTE&&(X=s.R8I),O===s.SHORT&&(X=s.R16I),O===s.INT&&(X=s.R32I)),S===s.RG&&(O===s.FLOAT&&(X=s.RG32F),O===s.HALF_FLOAT&&(X=s.RG16F),O===s.UNSIGNED_BYTE&&(X=s.RG8),O===s.UNSIGNED_SHORT&&ce&&(X=ce.RG16_EXT),O===s.SHORT&&ce&&(X=ce.RG16_SNORM_EXT)),S===s.RG_INTEGER&&(O===s.UNSIGNED_BYTE&&(X=s.RG8UI),O===s.UNSIGNED_SHORT&&(X=s.RG16UI),O===s.UNSIGNED_INT&&(X=s.RG32UI),O===s.BYTE&&(X=s.RG8I),O===s.SHORT&&(X=s.RG16I),O===s.INT&&(X=s.RG32I)),S===s.RGB_INTEGER&&(O===s.UNSIGNED_BYTE&&(X=s.RGB8UI),O===s.UNSIGNED_SHORT&&(X=s.RGB16UI),O===s.UNSIGNED_INT&&(X=s.RGB32UI),O===s.BYTE&&(X=s.RGB8I),O===s.SHORT&&(X=s.RGB16I),O===s.INT&&(X=s.RGB32I)),S===s.RGBA_INTEGER&&(O===s.UNSIGNED_BYTE&&(X=s.RGBA8UI),O===s.UNSIGNED_SHORT&&(X=s.RGBA16UI),O===s.UNSIGNED_INT&&(X=s.RGBA32UI),O===s.BYTE&&(X=s.RGBA8I),O===s.SHORT&&(X=s.RGBA16I),O===s.INT&&(X=s.RGBA32I)),S===s.RGB&&(O===s.UNSIGNED_SHORT&&ce&&(X=ce.RGB16_EXT),O===s.SHORT&&ce&&(X=ce.RGB16_SNORM_EXT),O===s.UNSIGNED_INT_5_9_9_9_REV&&(X=s.RGB9_E5),O===s.UNSIGNED_INT_10F_11F_11F_REV&&(X=s.R11F_G11F_B10F)),S===s.RGBA){const Z=re?da:tt.getTransfer(j);O===s.FLOAT&&(X=s.RGBA32F),O===s.HALF_FLOAT&&(X=s.RGBA16F),O===s.UNSIGNED_BYTE&&(X=Z===ct?s.SRGB8_ALPHA8:s.RGBA8),O===s.UNSIGNED_SHORT&&ce&&(X=ce.RGBA16_EXT),O===s.SHORT&&ce&&(X=ce.RGBA16_SNORM_EXT),O===s.UNSIGNED_SHORT_4_4_4_4&&(X=s.RGBA4),O===s.UNSIGNED_SHORT_5_5_5_1&&(X=s.RGB5_A1)}return(X===s.R16F||X===s.R32F||X===s.RG16F||X===s.RG32F||X===s.RGBA16F||X===s.RGBA32F)&&e.get("EXT_color_buffer_float"),X}function w(E,S){let O;return E?S===null||S===fn||S===qs?O=s.DEPTH24_STENCIL8:S===Xt?O=s.DEPTH32F_STENCIL8:S===Xs&&(O=s.DEPTH24_STENCIL8,de("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):S===null||S===fn||S===qs?O=s.DEPTH_COMPONENT24:S===Xt?O=s.DEPTH_COMPONENT32F:S===Xs&&(O=s.DEPTH_COMPONENT16),O}function b(E,S){return m(E)===!0||E.isFramebufferTexture&&E.minFilter!==wt&&E.minFilter!==_t?Math.log2(Math.max(S.width,S.height))+1:E.mipmaps!==void 0&&E.mipmaps.length>0?E.mipmaps.length:E.isCompressedTexture&&Array.isArray(E.image)?S.mipmaps.length:1}function R(E){const S=E.target;S.removeEventListener("dispose",R),A(S),S.isVideoTexture&&h.delete(S),S.isHTMLTexture&&d.delete(S)}function v(E){const S=E.target;S.removeEventListener("dispose",v),I(S)}function A(E){const S=n.get(E);if(S.__webglInit===void 0)return;const O=E.source,Y=f.get(O);if(Y){const j=Y[S.__cacheKey];j.usedTimes--,j.usedTimes===0&&P(E),Object.keys(Y).length===0&&f.delete(O)}n.remove(E)}function P(E){const S=n.get(E);s.deleteTexture(S.__webglTexture);const O=E.source,Y=f.get(O);delete Y[S.__cacheKey],a.memory.textures--}function I(E){const S=n.get(E);if(E.depthTexture&&(E.depthTexture.dispose(),n.remove(E.depthTexture)),E.isWebGLCubeRenderTarget)for(let Y=0;Y<6;Y++){if(Array.isArray(S.__webglFramebuffer[Y]))for(let j=0;j<S.__webglFramebuffer[Y].length;j++)s.deleteFramebuffer(S.__webglFramebuffer[Y][j]);else s.deleteFramebuffer(S.__webglFramebuffer[Y]);S.__webglDepthbuffer&&s.deleteRenderbuffer(S.__webglDepthbuffer[Y])}else{if(Array.isArray(S.__webglFramebuffer))for(let Y=0;Y<S.__webglFramebuffer.length;Y++)s.deleteFramebuffer(S.__webglFramebuffer[Y]);else s.deleteFramebuffer(S.__webglFramebuffer);if(S.__webglDepthbuffer&&s.deleteRenderbuffer(S.__webglDepthbuffer),S.__webglMultisampledFramebuffer&&s.deleteFramebuffer(S.__webglMultisampledFramebuffer),S.__webglColorRen
vendor: 5,608 bytes, line 4088
4088derbuffer)for(let Y=0;Y<S.__webglColorRenderbuffer.length;Y++)S.__webglColorRenderbuffer[Y]&&s.deleteRenderbuffer(S.__webglColorRenderbuffer[Y]);S.__webglDepthRenderbuffer&&s.deleteRenderbuffer(S.__webglDepthRenderbuffer)}const O=E.textures;for(let Y=0,j=O.length;Y<j;Y++){const re=n.get(O[Y]);re.__webglTexture&&(s.deleteTexture(re.__webglTexture),a.memory.textures--),n.remove(O[Y])}n.remove(E)}let N=0;function H(){N=0}function W(){return N}function U(E){N=E}function B(){const E=N;return E>=i.maxTextures&&de("WebGLTextures: Trying to use "+E+" texture units while this GPU supports only "+i.maxTextures),N+=1,E}function k(E){const S=[];return S.push(E.wrapS),S.push(E.wrapT),S.push(E.wrapR||0),S.push(E.magFilter),S.push(E.minFilter),S.push(E.anisotropy),S.push(E.internalFormat),S.push(E.format),S.push(E.type),S.push(E.generateMipmaps),S.push(E.premultiplyAlpha),S.push(E.flipY),S.push(E.unpackAlignment),S.push(E.colorSpace),S.join()}function te(E,S){const O=n.get(E);if(E.isVideoTexture&&ke(E),E.isRenderTargetTexture===!1&&E.isExternalTexture!==!0&&E.version>0&&O.__version!==E.version){const Y=E.image;if(Y===null)de("WebGLRenderer: Texture marked for update but no image data found.");else if(Y.complete===!1)de("WebGLRenderer: Texture marked for update but image is incomplete");else{Le(O,E,S);return}}else E.isExternalTexture&&(O.__webglTexture=E.sourceTexture?E.sourceTexture:null);t.bindTexture(s.TEXTURE_2D,O.__webglTexture,s.TEXTURE0+S)}function ne(E,S){const O=n.get(E);if(E.isRenderTargetTexture===!1&&E.version>0&&O.__version!==E.version){Le(O,E,S);return}else E.isExternalTexture&&(O.__webglTexture=E.sourceTexture?E.sourceTexture:null);t.bindTexture(s.TEXTURE_2D_ARRAY,O.__webglTexture,s.TEXTURE0+S)}function pe(E,S){const O=n.get(E);if(E.isRenderTargetTexture===!1&&E.version>0&&O.__version!==E.version){Le(O,E,S);return}t.bindTexture(s.TEXTURE_3D,O.__webglTexture,s.TEXTURE0+S)}function Me(E,S){const O=n.get(E);if(E.isCubeDepthTexture!==!0&&E.version>0&&O.__version!==E.version){Be(O,E,S);return}t.bindTexture(s.TEXTURE_CUBE_MAP,O.__webglTexture,s.TEXTURE0+S)}const Ce={[ra]:s.REPEAT,[nn]:s.CLAMP_TO_EDGE,[aa]:s.MIRRORED_REPEAT},Ke={[wt]:s.NEAREST,[yu]:s.NEAREST_MIPMAP_NEAREST,[Os]:s.NEAREST_MIPMAP_LINEAR,[_t]:s.LINEAR,[jr]:s.LINEAR_MIPMAP_NEAREST,[Bn]:s.LINEAR_MIPMAP_LINEAR},nt={[Qd]:s.NEVER,[sf]:s.ALWAYS,[jd]:s.LESS,[Ul]:s.LEQUAL,[ef]:s.EQUAL,[Nl]:s.GEQUAL,[tf]:s.GREATER,[nf]:s.NOTEQUAL};function He(E,S){if(S.type===Xt&&e.has("OES_texture_float_linear")===!1&&(S.magFilter===_t||S.magFilter===jr||S.magFilter===Os||S.magFilter===Bn||S.minFilter===_t||S.minFilter===jr||S.minFilter===Os||S.minFilter===Bn)&&de("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),s.texParameteri(E,s.TEXTURE_WRAP_S,Ce[S.wrapS]),s.texParameteri(E,s.TEXTURE_WRAP_T,Ce[S.wrapT]),(E===s.TEXTURE_3D||E===s.TEXTURE_2D_ARRAY)&&s.texParameteri(E,s.TEXTURE_WRAP_R,Ce[S.wrapR]),s.texParameteri(E,s.TEXTURE_MAG_FILTER,Ke[S.magFilter]),s.texParameteri(E,s.TEXTURE_MIN_FILTER,Ke[S.minFilter]),S.compareFunction&&(s.texParameteri(E,s.TEXTURE_COMPARE_MODE,s.COMPARE_REF_TO_TEXTURE),s.texParameteri(E,s.TEXTURE_COMPARE_FUNC,nt[S.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(S.magFilter===wt||S.minFilter!==Os&&S.minFilter!==Bn||S.type===Xt&&e.has("OES_texture_float_linear")===!1)return;if(S.anisotropy>1||n.get(S).__currentAnisotropy){const O=e.get("EXT_texture_filter_anisotropic");s.texParameterf(E,O.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(S.anisotropy,i.getMaxAnisotropy())),n.get(S).__currentAnisotropy=S.anisotropy}}}function J(E,S){let O=!1;E.__webglInit===void 0&&(E.__webglInit=!0,S.addEventListener("dispose",R));const Y=S.source;let j=f.get(Y);j===void 0&&(j={},f.set(Y,j));const re=k(S);if(re!==E.__cacheKey){j[re]===void 0&&(j[re]={texture:s.createTexture(),usedTimes:0},a.memory.textures++,O=!0),j[re].usedTimes++;const ce=j[E.__cacheKey];ce!==void 0&&(j[E.__cacheKey].usedTimes--,ce.usedTimes===0&&P(S)),E.__cacheKey=re,E.__webglTexture=j[re].texture}return O}function ge(E,S,O){return Math.floor(Math.floor(E/O)/S)}function ae(E,S,O,Y){const re=E.updateRanges;if(re.length===0)t.texSubImage2D(s.TEXTURE_2D,0,0,0,S.width,S.height,O,Y,S.data);else{re.sort((Ae,he)=>Ae.start-he.start);let ce=0;for(let Ae=1;Ae<re.length;Ae++){const he=re[ce],oe=re[Ae],Xe=he.start+he.count,Qe=ge(oe.start,S.width,4),rt=ge(he.start,S.width,4);oe.start<=Xe+1&&Qe===rt&&ge(oe.start+oe.count-1,S.width,4)===Qe?he.count=Math.max(he.count,oe.start+oe.count-he.start):(++ce,re[ce]=oe)}re.length=ce+1;const X=t.getParameter(s.UNPACK_ROW_LENGTH),Z=t.getParameter(s.UNPACK_SKIP_PIXELS),ye=t.getParameter(s.UNPACK_SKIP_ROWS);t.pixelStorei(s.UNPACK_ROW_LENGTH,S.width);for(let Ae=0,he=re.length;Ae<he;Ae++){const oe=re[Ae],Xe=Math.floor(oe.start/4),Qe=Math.ceil(oe.count/4),rt=Xe%S.width,D=Math.floor(Xe/S.width),le=Qe,q=1;t.pixelStorei(s.UNPACK_SKIP_PIXELS,rt),t.pixelStorei(s.UNPACK_SKIP_ROWS,D),t.texSubImage2D(s.TEXTURE_2D,0,rt,D,le,q,O,Y,S.data)}E.clearUpdateRanges(),t.pixelStorei(s.UNPACK_ROW_LENGTH,X),t.pixelStorei(s.UNPACK_SKIP_PIXELS,Z),t.pixelStorei(s.UNPACK_SKIP_ROWS,ye)}}function Le(E,S,O){let Y=s.TEXTURE_2D;(S.isDataArrayTexture||S.isCompressedArrayTexture)&&(Y=s.TEXTURE_2D_ARRAY),S.isData3DTexture&&(Y=s.TEXTURE_3D);const j=J(E,S),re=S.source;t.bindTexture(Y,E.__webglTexture,s.TEXTURE0+O);const ce=n.get(re);if(re.version!==ce.__version||j===!0){if(t.activeTexture(s.TEXTURE0+O),(typeof ImageBitmap<"u"&&S.image instanceof ImageBitmap)===!1){const q=tt.getPrimaries(tt.workingColorSpace),Se=S.colorSpace
vendor: 4,853 bytes, line 4088
4088===ni?null:tt.getPrimaries(S.colorSpace),ue=S.colorSpace===ni||q===Se?s.NONE:s.BROWSER_DEFAULT_WEBGL;t.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,S.flipY),t.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),t.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,ue)}t.pixelStorei(s.UNPACK_ALIGNMENT,S.unpackAlignment);let Z=g(S.image,!1,i.maxTextureSize);Z=se(S,Z);const ye=r.convert(S.format,S.colorSpace),Ae=r.convert(S.type);let he=M(S.internalFormat,ye,Ae,S.normalized,S.colorSpace,S.isVideoTexture);He(Y,S);let oe;const Xe=S.mipmaps,Qe=S.isVideoTexture!==!0,rt=ce.__version===void 0||j===!0,D=re.dataReady,le=b(S,Z);if(S.isDepthTexture)he=w(S.format===Ti,S.type),rt&&(Qe?t.texStorage2D(s.TEXTURE_2D,1,he,Z.width,Z.height):t.texImage2D(s.TEXTURE_2D,0,he,Z.width,Z.height,0,ye,Ae,null));else if(S.isDataTexture)if(Xe.length>0){Qe&&rt&&t.texStorage2D(s.TEXTURE_2D,le,he,Xe[0].width,Xe[0].height);for(let q=0,Se=Xe.length;q<Se;q++)oe=Xe[q],Qe?D&&t.texSubImage2D(s.TEXTURE_2D,q,0,0,oe.width,oe.height,ye,Ae,oe.data):t.texImage2D(s.TEXTURE_2D,q,he,oe.width,oe.height,0,ye,Ae,oe.data);S.generateMipmaps=!1}else Qe?(rt&&t.texStorage2D(s.TEXTURE_2D,le,he,Z.width,Z.height),D&&ae(S,Z,ye,Ae)):t.texImage2D(s.TEXTURE_2D,0,he,Z.width,Z.height,0,ye,Ae,Z.data);else if(S.isCompressedTexture)if(S.isCompressedArrayTexture){Qe&&rt&&t.texStorage3D(s.TEXTURE_2D_ARRAY,le,he,Xe[0].width,Xe[0].height,Z.depth);for(let q=0,Se=Xe.length;q<Se;q++)if(oe=Xe[q],S.format!==qt)if(ye!==null)if(Qe){if(D)if(S.layerUpdates.size>0){const ue=Sl(oe.width,oe.height,S.format,S.type);for(const ee of S.layerUpdates){const De=oe.data.subarray(ee*ue/oe.data.BYTES_PER_ELEMENT,(ee+1)*ue/oe.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,q,0,0,ee,oe.width,oe.height,1,ye,De)}S.clearLayerUpdates()}else t.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,q,0,0,0,oe.width,oe.height,Z.depth,ye,oe.data)}else t.compressedTexImage3D(s.TEXTURE_2D_ARRAY,q,he,oe.width,oe.height,Z.depth,0,oe.data,0,0);else de("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Qe?D&&t.texSubImage3D(s.TEXTURE_2D_ARRAY,q,0,0,0,oe.width,oe.height,Z.depth,ye,Ae,oe.data):t.texImage3D(s.TEXTURE_2D_ARRAY,q,he,oe.width,oe.height,Z.depth,0,ye,Ae,oe.data)}else{Qe&&rt&&t.texStorage2D(s.TEXTURE_2D,le,he,Xe[0].width,Xe[0].height);for(let q=0,Se=Xe.length;q<Se;q++)oe=Xe[q],S.format!==qt?ye!==null?Qe?D&&t.compressedTexSubImage2D(s.TEXTURE_2D,q,0,0,oe.width,oe.height,ye,oe.data):t.compressedTexImage2D(s.TEXTURE_2D,q,he,oe.width,oe.height,0,oe.data):de("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Qe?D&&t.texSubImage2D(s.TEXTURE_2D,q,0,0,oe.width,oe.height,ye,Ae,oe.data):t.texImage2D(s.TEXTURE_2D,q,he,oe.width,oe.height,0,ye,Ae,oe.data)}else if(S.isDataArrayTexture)if(Qe){if(rt&&t.texStorage3D(s.TEXTURE_2D_ARRAY,le,he,Z.width,Z.height,Z.depth),D)if(S.layerUpdates.size>0){const q=Sl(Z.width,Z.height,S.format,S.type);for(const Se of S.layerUpdates){const ue=Z.data.subarray(Se*q/Z.data.BYTES_PER_ELEMENT,(Se+1)*q/Z.data.BYTES_PER_ELEMENT);t.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,Se,Z.width,Z.height,1,ye,Ae,ue)}S.clearLayerUpdates()}else t.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,0,Z.width,Z.height,Z.depth,ye,Ae,Z.data)}else t.texImage3D(s.TEXTURE_2D_ARRAY,0,he,Z.width,Z.height,Z.depth,0,ye,Ae,Z.data);else if(S.isData3DTexture)Qe?(rt&&t.texStorage3D(s.TEXTURE_3D,le,he,Z.width,Z.height,Z.depth),D&&t.texSubImage3D(s.TEXTURE_3D,0,0,0,0,Z.width,Z.height,Z.depth,ye,Ae,Z.data)):t.texImage3D(s.TEXTURE_3D,0,he,Z.width,Z.height,Z.depth,0,ye,Ae,Z.data);else if(S.isFramebufferTexture){if(rt)if(Qe)t.texStorage2D(s.TEXTURE_2D,le,he,Z.width,Z.height);else{let q=Z.width,Se=Z.height;for(let ue=0;ue<le;ue++)t.texImage2D(s.TEXTURE_2D,ue,he,q,Se,0,ye,Ae,null),q>>=1,Se>>=1}}else if(S.isHTMLTexture){if("texElementImage2D"in s){const q=s.canvas;if(q.hasAttribute("layoutsubtree")||q.setAttribute("layoutsubtree","true"),Z.parentNode!==q){q.appendChild(Z),d.add(S),q.onpaint=Ze=>{const St=Ze.changedElements;for(const ht of d)St.includes(ht.image)&&(ht.needsUpdate=!0)},q.requestPaint();return}const Se=0,ue=s.RGBA,ee=s.RGBA,De=s.UNSIGNED_BYTE;s.texElementImage2D(s.TEXTURE_2D,Se,ue,ee,De,Z),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE)}}else if(Xe.length>0){if(Qe&&rt){const q=lt(Xe[0]);t.texStorage2D(s.TEXTURE_2D,le,he,q.width,q.height)}for(let q=0,Se=Xe.length;q<Se;q++)oe=Xe[q],Qe?D&&t.texSubImage2D(s.TEXTURE_2D,q,0,0,ye,Ae,oe):t.texImage2D(s.TEXTURE_2D,q,he,ye,Ae,oe);S.generateMipmaps=!1}else if(Qe){if(rt){const q=lt(Z);t.texStorage2D(s.TEXTURE_2D,le,he,q.width,q.height)}D&&t.texSubImage2D(s.TEXTURE_2D,0,0,0,ye,Ae,Z)}else t.texImage2D(s.TEXTURE_2D,0,he,ye,Ae,Z);
vendor: 28,850 bytes, lines 4088-4112
4088m(S)&&x(Y),ce.__version=re.version,S.onUpdate&&S.onUpdate(S)}E.__version=S.version}function Be(E,S,O){if(S.image.length!==6)return;const Y=J(E,S),j=S.source;t.bindTexture(s.TEXTURE_CUBE_MAP,E.__webglTexture,s.TEXTURE0+O);const re=n.get(j);if(j.version!==re.__version||Y===!0){t.activeTexture(s.TEXTURE0+O);const ce=tt.getPrimaries(tt.workingColorSpace),X=S.colorSpace===ni?null:tt.getPrimaries(S.colorSpace),Z=S.colorSpace===ni||ce===X?s.NONE:s.BROWSER_DEFAULT_WEBGL;t.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,S.flipY),t.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),t.pixelStorei(s.UNPACK_ALIGNMENT,S.unpackAlignment),t.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,Z);const ye=S.isCompressedTexture||S.image[0].isCompressedTexture,Ae=S.image[0]&&S.image[0].isDataTexture,he=[];for(let ee=0;ee<6;ee++)!ye&&!Ae?he[ee]=g(S.image[ee],!0,i.maxCubemapSize):he[ee]=Ae?S.image[ee].image:S.image[ee],he[ee]=se(S,he[ee]);const oe=he[0],Xe=r.convert(S.format,S.colorSpace),Qe=r.convert(S.type),rt=M(S.internalFormat,Xe,Qe,S.normalized,S.colorSpace),D=S.isVideoTexture!==!0,le=re.__version===void 0||Y===!0,q=j.dataReady;let Se=b(S,oe);He(s.TEXTURE_CUBE_MAP,S);let ue;if(ye){D&&le&&t.texStorage2D(s.TEXTURE_CUBE_MAP,Se,rt,oe.width,oe.height);for(let ee=0;ee<6;ee++){ue=he[ee].mipmaps;for(let De=0;De<ue.length;De++){const Ze=ue[De];S.format!==qt?Xe!==null?D?q&&t.compressedTexSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ee,De,0,0,Ze.width,Ze.height,Xe,Ze.data):t.compressedTexImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ee,De,rt,Ze.width,Ze.height,0,Ze.data):de("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):D?q&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ee,De,0,0,Ze.width,Ze.height,Xe,Qe,Ze.data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ee,De,rt,Ze.width,Ze.height,0,Xe,Qe,Ze.data)}}}else{if(ue=S.mipmaps,D&&le){ue.length>0&&Se++;const ee=lt(he[0]);t.texStorage2D(s.TEXTURE_CUBE_MAP,Se,rt,ee.width,ee.height)}for(let ee=0;ee<6;ee++)if(Ae){D?q&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,0,0,he[ee].width,he[ee].height,Xe,Qe,he[ee].data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,rt,he[ee].width,he[ee].height,0,Xe,Qe,he[ee].data);for(let De=0;De<ue.length;De++){const St=ue[De].image[ee].image;D?q&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ee,De+1,0,0,St.width,St.height,Xe,Qe,St.data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ee,De+1,rt,St.width,St.height,0,Xe,Qe,St.data)}}else{D?q&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,0,0,Xe,Qe,he[ee]):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,rt,Xe,Qe,he[ee]);for(let De=0;De<ue.length;De++){const Ze=ue[De];D?q&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ee,De+1,0,0,Xe,Qe,Ze.image[ee]):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+ee,De+1,rt,Xe,Qe,Ze.image[ee])}}}m(S)&&x(s.TEXTURE_CUBE_MAP),re.__version=j.version,S.onUpdate&&S.onUpdate(S)}E.__version=S.version}function Fe(E,S,O,Y,j,re){const ce=r.convert(O.format,O.colorSpace),X=r.convert(O.type),Z=M(O.internalFormat,ce,X,O.normalized,O.colorSpace),ye=n.get(S),Ae=n.get(O);if(Ae.__renderTarget=S,!ye.__hasExternalTextures){const he=Math.max(1,S.width>>re),oe=Math.max(1,S.height>>re);j===s.TEXTURE_3D||j===s.TEXTURE_2D_ARRAY?t.texImage3D(j,re,Z,he,oe,S.depth,0,ce,X,null):t.texImage2D(j,re,Z,he,oe,0,ce,X,null)}t.bindFramebuffer(s.FRAMEBUFFER,E),Re(S)?o.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,Y,j,Ae.__webglTexture,0,We(S)):(j===s.TEXTURE_2D||j>=s.TEXTURE_CUBE_MAP_POSITIVE_X&&j<=s.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&s.framebufferTexture2D(s.FRAMEBUFFER,Y,j,Ae.__webglTexture,re),t.bindFramebuffer(s.FRAMEBUFFER,null)}function it(E,S,O){if(s.bindRenderbuffer(s.RENDERBUFFER,E),S.depthBuffer){const Y=S.depthTexture,j=Y&&Y.isDepthTexture?Y.type:null,re=w(S.stencilBuffer,j),ce=S.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT;Re(S)?o.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,We(S),re,S.width,S.height):O?s.renderbufferStorageMultisample(s.RENDERBUFFER,We(S),re,S.width,S.height):s.renderbufferStorage(s.RENDERBUFFER,re,S.width,S.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,ce,s.RENDERBUFFER,E)}else{const Y=S.textures;for(let j=0;j<Y.length;j++){const re=Y[j],ce=r.convert(re.format,re.colorSpace),X=r.convert(re.type),Z=M(re.internalFormat,ce,X,re.normalized,re.colorSpace);Re(S)?o.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,We(S),Z,S.width,S.height):O?s.renderbufferStorageMultisample(s.RENDERBUFFER,We(S),Z,S.width,S.height):s.renderbufferStorage(s.RENDERBUFFER,Z,S.width,S.height)}}s.bindRenderbuffer(s.RENDERBUFFER,null)}function ze(E,S,O){const Y=S.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(s.FRAMEBUFFER,E),!(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),Y){if(j.__webglInit===void 0&&(j.__webglInit=!0,S.depthTexture.addEventListener("dispose",R)),j.__webglTexture===void 0){j.__webglTexture=s.createTexture(),t.bindTexture(s.TEXTURE_CUBE_MAP,j.__webglTexture),He(s.TEXTURE_CUBE_MAP,S.depthTexture);const ye=r.convert(S.depthTexture.format),Ae=r.convert(S.depthTexture.type);let he;S.depthTexture.format===Wn?he=s.DEPTH_COMPONENT24:S.depthTexture.format===Ti&&(he=s.DEPTH24_STENCIL8);for(let oe=0;oe<6;oe++)s.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+oe,0,he,S.width,S.height,0,ye,Ae,null)}}else te(S.depthTexture,0);const re=j.__webglTexture,ce=We(S),X=Y?s.TEXTURE_CUBE_MAP_POSITIVE_X+O:s.TEXTURE_2D,Z=S.depthTexture.format===Ti?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT;if(S.depthTexture.format===Wn)Re(S)?o.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,Z,X,re,0,ce):s.framebufferTexture2D(s.FRAMEBUFFER,Z,X,re,0);else if(S.depthTexture.format===Ti)Re(S)?o.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,Z,X,re,0,ce):s.framebufferTexture2D(s.FRAMEBUFFER,Z,X,re,0);else throw new Error("Unknown depthTexture format")}function $(E){const S=n.get(E),O=E.isWebGLCubeRenderTarget===!0;if(S.__boundDepthTexture!==E.depthTexture){const Y=E.depthTexture;if(S.__depthDisposeCallback&&S.__depthDisposeCallback(),Y){const j=()=>{delete S.__boundDepthTexture,delete S.__depthDisposeCallback,Y.removeEventListener("dispose",j)};Y.addEventListener("dispose",j),S.__depthDisposeCallback=j}S.__boundDepthTexture=Y}if(E.depthTexture&&!S.__autoAllocateDepthBuffer)if(O)for(let Y=0;Y<6;Y++)ze(S.__webglFramebuffer[Y],E,Y);else{const Y=E.texture.mipmaps;Y&&Y.length>0?ze(S.__webglFramebuffer[0],E,0):ze(S.__webglFramebuffer,E,0)}else if(O){S.__webglDepthbuffer=[];for(let Y=0;Y<6;Y++)if(t.bindFramebuffer(s.FRAMEBUFFER,S.__webglFramebuffer[Y]),S.__webglDepthbuffer[Y]===void 0)S.__webglDepthbuffer[Y]=s.createRenderbuffer(),it(S.__webglDepthbuffer[Y],E,!1);else{const j=E.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,re=S.__webglDepthbuffer[Y];s.bindRenderbuffer(s.RENDERBUFFER,re),s.framebufferRenderbuffer(s.FRAMEBUFFER,j,s.RENDERBUFFER,re)}}else{const Y=E.texture.mipmaps;if(Y&&Y.length>0?t.bindFramebuffer(s.FRAMEBUFFER,S.__webglFramebuffer[0]):t.bindFramebuffer(s.FRAMEBUFFER,S.__webglFramebuffer),S.__webglDepthbuffer===void 0)S.__webglDepthbuffer=s.createRenderbuffer(),it(S.__webglDepthbuffer,E,!1);else{const j=E.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,re=S.__webglDepthbuffer;s.bindRenderbuffer(s.RENDERBUFFER,re),s.framebufferRenderbuffer(s.FRAMEBUFFER,j,s.RENDERBUFFER,re)}}t.bindFramebuffer(s.FRAMEBUFFER,null)}function ie(E,S,O){const Y=n.get(E);S!==void 0&&Fe(Y.__webglFramebuffer,E,E.texture,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,0),O!==void 0&&$(E)}function Q(E){const S=E.texture,O=n.get(E),Y=n.get(S);E.addEventListener("dispose",v);const j=E.textures,re=E.isWebGLCubeRenderTarget===!0,ce=j.length>1;if(ce||(Y.__webglTexture===void 0&&(Y.__webglTexture=s.createTexture()),Y.__version=S.version,a.memory.textures++),re){O.__webglFramebuffer=[];for(let X=0;X<6;X++)if(S.mipmaps&&S.mipmaps.length>0){O.__webglFramebuffer[X]=[];for(let Z=0;Z<S.mipmaps.length;Z++)O.__webglFramebuffer[X][Z]=s.createFramebuffer()}else O.__webglFramebuffer[X]=s.createFramebuffer()}else{if(S.mipmaps&&S.mipmaps.length>0){O.__webglFramebuffer=[];for(let X=0;X<S.mipmaps.length;X++)O.__webglFramebuffer[X]=s.createFramebuffer()}else O.__webglFramebuffer=s.createFramebuffer();if(ce)for(let X=0,Z=j.length;X<Z;X++){const ye=n.get(j[X]);ye.__webglTexture===void 0&&(ye.__webglTexture=s.createTexture(),a.memory.textures++)}if(E.samples>0&&Re(E)===!1){O.__webglMultisampledFramebuffer=s.createFramebuffer(),O.__webglColorRenderbuffer=[],t.bindFramebuffer(s.FRAMEBUFFER,O.__webglMultisampledFramebuffer);for(let X=0;X<j.length;X++){const Z=j[X];O.__webglColorRenderbuffer[X]=s.createRenderbuffer(),s.bindRenderbuffer(s.RENDERBUFFER,O.__webglColorRenderbuffer[X]);const ye=r.convert(Z.format,Z.colorSpace),Ae=r.convert(Z.type),he=M(Z.internalFormat,ye,Ae,Z.normalized,Z.colorSpace,E.isXRRenderTarget===!0),oe=We(E);s.renderbufferStorageMultisample(s.RENDERBUFFER,oe,he,E.width,E.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+X,s.RENDERBUFFER,O.__webglColorRenderbuffer[X])}s.bindRenderbuffer(s.RENDERBUFFER,null),E.depthBuffer&&(O.__webglDepthRenderbuffer=s.createRenderbuffer(),it(O.__webglDepthRenderbuffer,E,!0)),t.bindFramebuffer(s.FRAMEBUFFER,null)}}if(re){t.bindTexture(s.TEXTURE_CUBE_MAP,Y.__webglTexture),He(s.TEXTURE_CUBE_MAP,S);for(let X=0;X<6;X++)if(S.mipmaps&&S.mipmaps.length>0)for(let Z=0;Z<S.mipmaps.length;Z++)Fe(O.__webglFramebuffer[X][Z],E,S,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+X,Z);else Fe(O.__webglFramebuffer[X],E,S,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+X,0);m(S)&&x(s.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(ce){for(let X=0,Z=j.length;X<Z;X++){const ye=j[X],Ae=n.get(ye);let he=s.TEXTURE_2D;(E.isWebGL3DRenderTarget||E.isWebGLArrayRenderTarget)&&(he=E.isWebGL3DRenderTarget?s.TEXTURE_3D:s.TEXTURE_2D_ARRAY),t.bindTexture(he,Ae.__webglTexture),He(he,ye),Fe(O.__webglFramebuffer,E,ye,s.COLOR_ATTACHMENT0+X,he,0),m(ye)&&x(he)}t.unbindTexture()}else{let X=s.TEXTURE_2D;if((E.isWebGL3DRenderTarget||E.isWebGLArrayRenderTarget)&&(X=E.isWebGL3DRenderTarget?s.TEXTURE_3D:s.TEXTURE_2D_ARRAY),t.bindTexture(X,Y.__webglTexture),He(X,S),S.mipmaps&&S.mipmaps.length>0)for(let Z=0;Z<S.mipmaps.length;Z++)Fe(O.__webglFramebuffer[Z],E,S,s.COLOR_ATTACHMENT0,X,Z);else Fe(O.__webglFramebuffer,E,S,s.COLOR_ATTACHMENT0,X,0);m(S)&&x(X),t.unbindTexture()}E.depthBuffer&&$(E)}function xe(E){const S=E.textures;for(let O=0,Y=S.length;O<Y;O++){const j=S[O];if(m(j)){const re=y(E),ce=n.get(j).__webglTexture;t.bindTexture(re,ce),x(re),t.unbindTexture()}}}const fe=[],Ve=[];function L(E){if(E.samples>0){if(Re(E)===!1){const S=E.textures,O=E.width,Y=E.height;let j=s.COLOR_BUFFER_BIT;const re=E.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,ce=n.get(E),X=S.length>1;if(X)for(let ye=0;ye<S.length;ye++)t.bindFramebuffer(s.FRAMEBUFFER,ce.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+ye,s.RENDERBUFFER,null),t.bindFramebuffer(s.FRAMEBUFFER,ce.__webglFramebuffer),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0+ye,s.TEXTURE_2D,null,0);t.bindFramebuffer(s.READ_FRAMEBUFFER,ce.__webglMultisampledFramebuffer);const Z=E.texture.mipmaps;Z&&Z.length>0?t.bindFramebuffer(s.DRAW_FRAMEBUFFER,ce.__webglFramebuffer[0]):t.bindFramebuffer(s.DRAW_FRAMEBUFFER,ce.__webglFramebuffer);for(let ye=0;ye<S.length;ye++){if(E.resolveDepthBuffer&&(E.depthBuffer&&(j|=s.DEPTH_BUFFER_BIT),E.stencilBuffer&&E.resolveStencilBuffer&&(j|=s.STENCIL_BUFFER_BIT)),X){s.framebufferRenderbuffer(s.READ_FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.RENDERBUFFER,ce.__webglColorRenderbuffer[ye]);const Ae=n.get(S[ye]).__webglTexture;s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,Ae,0)}s.blitFramebuffer(0,0,O,Y,0,0,O,Y,j,s.NEAREST),l===!0&&(fe.length=0,Ve.length=0,fe.push(s.COLOR_ATTACHMENT0+ye),E.depthBuffer&&E.resolveDepthBuffer===!1&&(fe.push(re),Ve.push(re),s.invalidateFramebuffer(s.DRAW_FRAMEBUFFER,Ve)),s.invalidateFramebuffer(s.READ_FRAMEBUFFER,fe))}if(t.bindFramebuffer(s.READ_FRAMEBUFFER,null),t.bindFramebuffer(s.DRAW_FRAMEBUFFER,null),X)for(let ye=0;ye<S.length;ye++){t.bindFramebuffer(s.FRAMEBUFFER,ce.__webglMultisampledFramebuffer),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+ye,s.RENDERBUFFER,ce.__webglColorRenderbuffer[ye]);const Ae=n.get(S[ye]).__webglTexture;t.bindFramebuffer(s.FRAMEBUFFER,ce.__webglFramebuffer),s.framebufferTexture2D(s.DRAW_FRAMEBUFFER,s.COLOR_ATTACHMENT0+ye,s.TEXTURE_2D,Ae,0)}t.bindFramebuffer(s.DRAW_FRAMEBUFFER,ce.__webglMultisampledFramebuffer)}else if(E.depthBuffer&&E.resolveDepthBuffer===!1&&l){const S=E.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT;s.invalidateFramebuffer(s.DRAW_FRAMEBUFFER,[S])}}}function We(E){return Math.min(i.maxSamples,E.samples)}function Re(E){const S=n.get(E);return E.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&S.__useRenderToTexture!==!1}function ke(E){const S=a.render.frame;h.get(E)!==S&&(h.set(E,S),E.update())}function se(E,S){const O=E.colorSpace,Y=E.format,j=E.type;return E.isCompressedTexture===!0||E.isVideoTexture===!0||O!==ua&&O!==ni&&(tt.getTransfer(O)===ct?(Y!==qt||j!==en)&&de("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Pe("WebGLTextures: Unsupported texture color space:",O)),S}function lt(E){return typeof HTMLImageElement<"u"&&E instanceof HTMLImageElement?(c.width=E.naturalWidth||E.width,c.height=E.naturalHeight||E.height):typeof VideoFrame<"u"&&E instanceof VideoFrame?(c.width=E.displayWidth,c.height=E.displayHeight):(c.width=E.width,c.height=E.height),c}this.allocateTextureUnit=B,this.resetTextureUnits=H,this.getTextureUnits=W,this.setTextureUnits=U,this.setTexture2D=te,this.setTexture2DArray=ne,this.setTexture3D=pe,this.setTextureCube=Me,this.rebindTextures=ie,this.setupRenderTarget=Q,this.updateRenderTargetMipmap=xe,this.updateMultisampleRenderTarget=L,this.setupDepthRenderbuffer=$,this.setupFrameBufferTexture=Fe,this.useMultisampledRTT=Re,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function zv(s,e){function t(n,i=ni){let r;const a=tt.getTransfer(i);if(n===en)return s.UNSIGNED_BYTE;if(n===Cl)return s.UNSIGNED_SHORT_4_4_4_4;if(n===Rl)return s.UNSIGNED_SHORT_5_5_5_1;if(n===bu)return s.UNSIGNED_INT_5_9_9_9_REV;if(n===Tu)return s.UNSIGNED_INT_10F_11F_11F_REV;if(n===Mu)return s.BYTE;if(n===Su)return s.SHORT;if(n===Xs)return s.UNSIGNED_SHORT;if(n===wl)return s.INT;if(n===fn)return s.UNSIGNED_INT;if(n===Xt)return s.FLOAT;if(n===Hn)return s.HALF_FLOAT;if(n===Au)return s.ALPHA;if(n===Eu)return s.RGB;if(n===qt)return s.RGBA;if(n===Wn)return s.DEPTH_COMPONENT;if(n===Ti)return s.DEPTH_STENCIL;if(n===Il)return s.RED;if(n===Ta)return s.RED_INTEGER;if(n===Ri)return s.RG;if(n===Pl)return s.RG_INTEGER;if(n===Ll)return s.RGBA_INTEGER;if(n===ea||n===ta||n===na||n===ia)if(a===ct)if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(n===ea)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===ta)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===na)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===ia)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=e.get("WEBGL_compressed_texture_s3tc"),r!==null){if(n===ea)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===ta)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===na)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===ia)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Bo||n===zo||n===Vo||n===ko)if(r=e.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(n===Bo)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===zo)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Vo)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===ko)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Go||n===Ho||n===Wo||n===Xo||n===qo||n===oa||n===Yo)if(r=e.get("WEBGL_compressed_texture_etc"),r!==null){if(n===Go||n===Ho)return a===ct?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===Wo)return a===ct?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(n===Xo)return r.COMPRESSED_R11_EAC;if(n===qo)return r.COMPRESSED_SIGNED_R11_EAC;if(n===oa)return r.COMPRESSED_RG11_EAC;if(n===Yo)return r.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===Zo||n===Jo||n===$o||n===Ko||n===Qo||n===jo||n===el||n===tl||n===nl||n===il||n===sl||n===rl||n===al||n===ol)if(r=e.get("WEBGL_compressed_texture_astc"),r!==null){if(n===Zo)return a===ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Jo)return a===ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===$o)return a===ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Ko)return a===ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Qo)return a===ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===jo)return a===ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===el)return a===ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===tl)return a===ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===nl)return a===ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===il)return a===ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===sl)return a===ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===rl)return a===ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===al)return a===ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===ol)return a===ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===ll||n===cl||n===hl)if(r=e.get("EXT_texture_compression_bptc"),r!==null){if(n===ll)return a===ct?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===cl)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===hl)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===ul||n===dl||n===la||n===fl)if(r=e.get("EXT_texture_compression_rgtc"),r!==null){if(n===ul)return r.COMPRESSED_RED_RGTC1_EXT;if(n===dl)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===la)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===fl)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===qs?s.UNSIGNED_INT_24_8:s[n]!==void 0?s[n]:null}return{convert:t}}const Vv=`
4089void main() {
4090
4091	gl_Position = vec4( position, 1.0 );
4092
4093}`,kv=`
4094uniform sampler2DArray depthColor;
4095uniform float depthWidth;
4096uniform float depthHeight;
4097
4098void main() {
4099
4100	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
4101
4102	if ( coord.x >= 1.0 ) {
4103
4104		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
4105
4106	} else {
4107
4108		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
4109
4110	}
4111
4112}`;class Gv{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new Bu(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new pn({vertexShader:Vv,fragmentShader:kv,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Ct(new tr(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Hv extends wn{constructor(e,t){super();const n=this;let i=null,r=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 Gv,m={},x=t.getContextAttributes();let y=null,M=null;const w=[],b=[],R=new K;let v=null;const A=new Ft;A.viewport=new dt;const P=new Ft;P.viewport=new dt;const I=[A,P],N=new Rm;let H=null,W=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(J){let ge=w[J];return ge===void 0&&(ge=new Ga,w[J]=ge),ge.getTargetRaySpace()},this.getControllerGrip=function(J){let ge=w[J];return ge===void 0&&(ge=new Ga,w[J]=ge),ge.getGripSpace()},this.getHand=function(J){let ge=w[J];return ge===void 0&&(ge=new Ga,w[J]=ge),ge.getHandSpace()};function U(J){const ge=b.indexOf(J.inputSource);if(ge===-1)return;const ae=w[ge];ae!==void 0&&(ae.update(J.inputSource,J.frame,c||a),ae.dispatchEvent({type:J.type,data:J.inputSource}))}function B(){i.removeEventListener("select",U),i.removeEventListener("selectstart",U),i.removeEventListener("selectend",U),i.removeEventListener("squeeze",U),i.removeEventListener("squeezestart",U),i.removeEventListener("squeezeend",U),i.removeEventListener("end",B),i.removeEventListener("inputsourceschange",k);for(let J=0;J<w.length;J++){const ge=b[J];ge!==null&&(b[J]=null,w[J].disconnect(ge))}H=null,W=null,g.reset();for(const J in m)delete m[J];e.setRenderTarget(y),f=null,u=null,d=null,i=null,M=null,He.stop(),n.isPresenting=!1,e.setPixelRatio(v),e.setSize(R.width,R.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(J){r=J,n.isPresenting===!0&&de("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(J){o=J,n.isPresenting===!0&&de("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(J){c=J},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(J){if(i=J,i!==null){if(y=e.getRenderTarget(),i.addEventListener("select",U),i.addEventListener("selectstart",U),i.addEventListener("selectend",U),i.addEventListener("squeeze",U),i.addEventListener("squeezestart",U),i.addEventListener("squeezeend",U),i.addEventListener("end",B),i.addEventListener("inputsourceschange",k),x.xrCompatible!==!0&&await t.makeXRCompatible(),v=e.getPixelRatio(),e.getSize(R),_&&"createProjectionLayer"in XRWebGLBinding.prototype){let ae=null,Le=null,Be=null;x.depth&&(Be=x.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,ae=x.stencil?Ti:Wn,Le=x.stencil?qs:fn);const Fe={colorFormat:t.RGBA8,depthFormat:Be,scaleFactor:r};d=this.getBinding(),u=d.createProjectionLayer(Fe),i.updateRenderState({layers:[u]}),e.setPixelRatio(1),e.setSize(u.textureWidth,u.textureHeight,!1),M=new cn(u.textureWidth,u.textureHeight,{format:qt,type:en,depthTexture:new ms(u.textureWidth,u.textureHeight,Le,void 0,void 0,void 0,void 0,void 0,void 0,ae),stencilBuffer:x.stencil,colorSpace:e.outputColorSpace,samples:x.antialias?4:0,resolveDepthBuffer:u.ignoreDepthValues===!1,resolveStencilBuffer:u.ignoreDepthValues===!1})}else{const ae={antialias:x.antialias,alpha:!0,depth:x.depth,stencil:x.stencil,framebufferScaleFactor:r};f=new XRWebGLLayer(i,t,ae),i.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),M=new cn(f.framebufferWidth,f.framebufferHeight,{format:qt,type:en,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),He.setContext(i),He.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return g.getDepthTexture()};function k(J){for(let ge=0;ge<J.removed.length;ge++){const ae=J.removed[ge],Le=b.indexOf(ae);Le>=0&&(b[Le]=null,w[Le].disconnect(ae))}for(let ge=0;ge<J.added.length;ge++){const ae=J.added[ge];let Le=b.indexOf(ae);if(Le===-1){for(let Fe=0;Fe<w.length;Fe++)if(Fe>=b.length){b.push(ae),Le=Fe;break}else if(b[Fe]===null){b[Fe]=ae,Le=Fe;break}if(Le===-1)break}const Be=w[Le];Be&&Be.connect(ae)}}const te=new C,ne=new C;function pe(J,ge,ae){te.setFromMatrixPosition(ge.matrixWorld),ne.setFromMatrixPosition(ae.matrixWorld);const Le=te.distanceTo(ne),Be=ge.projectionMatrix.elements,Fe=ae.projectionMatrix.elements,it=Be[14]/(Be[10]-1),ze=Be[14]/(Be[10]+1),$=(Be[9]+1)/Be[5],ie=(Be[9]-1)/Be[5],Q=(Be[8]-1)/Be[0],xe=(Fe[8]+1)/Fe[0],fe=it*Q,Ve=it*xe,L=Le/(-Q+xe),We=L*-Q;if(ge.matrixWorld.decompose(J.position,J.quaternion,J.scale),J.translateX(We),J.translateZ(L),J.matrixWorld.compose(J.position,J.quaternion,J.scale),J.matrixWorldInverse.copy(J.matrixWorld).invert(),Be[10]===-1)J.projectionMatrix.copy(ge.projectionMatrix),J.projectionMatrixInverse.copy(ge.projectionMatrixInverse);else{const Re=it+L,ke=ze+L,se=fe-We,lt=Ve+(Le-We),E=$*ze/ke*Re,S=ie*ze/ke*Re;J.projectionMatrix.makePerspective(se,lt,E,S,Re,ke),J.projectionMatrixInverse.copy(J.projectionMatrix).invert()}}function Me(J,ge){ge===null?J.matrixWorld.copy(J.matrix):J.matrixWorld.multiplyMatrices(ge.matrixWorld,J.matrix),J.matrixWorldInverse.copy(J.matrixWorld).invert()}this.updateCamera=function(J){if(i===null)return;let ge=J.near,ae=J.far;g.texture!==null&&(g.depthNear>0&&(ge=g.depthNear),g.depthFar>0&&(ae=g.depthFar)),N.near=P.near=A.near=ge,N.far=P.far=A.far=ae,(H!==N.near||W!==N.far)&&(i.updateRenderState({depthNear:N.near,depthFar:N.far}),H=N.near,W=N.far),N.layers.mask=J.layers.mask|6,A.layers.mask=N.layers.mask&-5,P.layers.mask=N.layers.mask&-3;const Le=J.parent,Be=N.cameras;Me(N,Le);for(let Fe=0;Fe<Be.length;Fe++)Me(Be[Fe],Le);Be.length===2?pe(N,A,P):N.projectionMatrix.copy(A.projectionMatrix),Ce(J,N,Le)};function Ce(J,ge,ae){ae===null?J.matrix.copy(ge.matrixWorld):(J.matrix.copy(ae.matrixWorld),J.matrix.invert(),J.matrix.multiply(ge.matrixWorld)),J.matrix.decompose(J.position,J.quaternion,J.scale),J.updateMatrixWorld(!0),J.projectionMatrix.copy(ge.projectionMatrix),J.projectionMatrixInverse.copy(ge.projectionMatrixInverse),J.isPerspectiveCamera&&(J.fov=fs*2*Math.atan(1/J.projectionMatrix.elements[5]),J.zoom=1)}this.getCamera=function(){return N},this.getFoveation=function(){if(!(u===null&&f===null))return l},this.setFoveation=function(J){l=J,u!==null&&(u.fixedFoveation=J),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=J)},this.hasDepthSensing=function(){return g.texture!==null},this.getDepthSensingMesh=function(){return g.getMesh(N)},this.getCameraTexture=function(J){return m[J]};let Ke=null;function nt(J,ge){if(h=ge.getViewerPose(c||a),p=ge,h!==null){const ae=h.views;f!==null&&(e.setRenderTargetFramebuffer(M,f.framebuffer),e.setRenderTarget(M));let Le=!1;ae.length!==N.cameras.length&&(N.cameras.length=0,Le=!0);for(let ze=0;ze<ae.length;ze++){const $=ae[ze];let ie=null;if(f!==null)ie=f.getViewport($);else{const xe=d.getViewSubImage(u,$);ie=xe.viewport,ze===0&&(e.setRenderTargetTextures(M,xe.colorTexture,xe.depthStencilTexture),e.setRenderTarget(M))}let Q=I[ze];Q===void 0&&(Q=new Ft,Q.layers.enable(ze),Q.viewport=new dt,I[ze]=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(ie.x,ie.y,ie.width,ie.height),ze===0&&(N.matrix.copy(Q.matrix),N.matrix.decompose(N.position,N.quaternion,N.scale)),Le===!0&&N.cameras.push(Q)}const Be=i.enabledFeatures;if(Be&&Be.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&_){d=n.getBinding();const ze=d.getDepthInformation(ae[0]);ze&&ze.isValid&&ze.texture&&g.init(ze,i.renderState)}if(Be&&Be.includes("camera-access")&&_){e.state.unbindTexture(),d=n.getBinding();for(let ze=0;ze<ae.length;ze++){const $=ae[ze].camera;if($){let ie=m[$];ie||(ie=new Bu,m[$]=ie);const Q=d.getCameraImage($);ie.sourceTexture=Q}}}}for(let ae=0;ae<w.length;ae++){const Le=b[ae],Be=w[ae];Le!==null&&Be!==void 0&&Be.update(Le,ge,c||a)}Ke&&Ke(J,ge),ge.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ge}),p=null}const He=new od;He.setAnimationLoop(nt),this.setAnimationLoop=function(J){Ke=J},this.dispose=function(){}}}const Wv=new Ge,pd=new qe;pd.set(-1,0,0,0,1,0,0,0,1);function Xv(s,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,Zu(s)),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.isNodeMaterial?m.uniformsNeedUpdate=!1:m.isMeshBasicMaterial?r(g,m):m.isMeshLambertMaterial?(r(g,m),m.envMap&&(g.envMapIntensity.value=m.envMapIntensity)):m.isMeshToonMaterial?(r(g,m),d(g,m)):m.isMeshPhongMaterial?(r(g,m),h(g,m),m.envMap&&(g.envMapIntensity.value=m.envMapIntensity)):m.isMeshStandardMaterial?(r(g,m),u(g,m),m.
vendor: 1,662 bytes, line 4112
4112isMeshPhysicalMaterial&&f(g,m,M)):m.isMeshMatcapMaterial?(r(g,m),p(g,m)):m.isMeshDepthMaterial?r(g,m):m.isMeshDistanceMaterial?(r(g,m),_(g,m)):m.isMeshNormalMaterial?r(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 r(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===Yt&&(g.bumpScale.value*=-1)),m.normalMap&&(g.normalMap.value=m.normalMap,t(m.normalMap,g.normalMapTransform),g.normalScale.value.copy(m.normalScale),m.side===Yt&&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,g.envMapRotation.value.setFromMatrix4(Wv.makeRotationFromEuler(M)).transpose(),y.isCubeTexture&&y.isRenderTargetTexture===!1&&g.envMapRotation.value.premultiply(
vendor: 13,075 bytes, line 4112
4112pd),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===Yt&&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 qv(s,e,t,n){let i={},r={},a=[];const o=s.getParameter(s.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 w=y.program;n.updateUBOMapping(x,w);const b=e.render.frame;r[x.id]!==b&&(u(x),r[x.id]=b)}function h(x){const y=d();x.__bindingPointIndex=y;const M=s.createBuffer(),w=x.__size,b=x.usage;return s.bindBuffer(s.UNIFORM_BUFFER,M),s.bufferData(s.UNIFORM_BUFFER,w,b),s.bindBuffer(s.UNIFORM_BUFFER,null),s.bindBufferBase(s.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 Pe("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function u(x){const y=i[x.id],M=x.uniforms,w=x.__cache;s.bindBuffer(s.UNIFORM_BUFFER,y);for(let b=0,R=M.length;b<R;b++){const v=Array.isArray(M[b])?M[b]:[M[b]];for(let A=0,P=v.length;A<P;A++){const I=v[A];if(f(I,b,A,w)===!0){const N=I.__offset,H=Array.isArray(I.value)?I.value:[I.value];let W=0;for(let U=0;U<H.length;U++){const B=H[U],k=_(B);typeof B=="number"||typeof B=="boolean"?(I.__data[0]=B,s.bufferSubData(s.UNIFORM_BUFFER,N+W,I.__data)):B.isMatrix3?(I.__data[0]=B.elements[0],I.__data[1]=B.elements[1],I.__data[2]=B.elements[2],I.__data[3]=0,I.__data[4]=B.elements[3],I.__data[5]=B.elements[4],I.__data[6]=B.elements[5],I.__data[7]=0,I.__data[8]=B.elements[6],I.__data[9]=B.elements[7],I.__data[10]=B.elements[8],I.__data[11]=0):ArrayBuffer.isView(B)?I.__data.set(new B.constructor(B.buffer,B.byteOffset,I.__data.length)):(B.toArray(I.__data,W),W+=k.storage/Float32Array.BYTES_PER_ELEMENT)}s.bufferSubData(s.UNIFORM_BUFFER,N,I.__data)}}}s.bindBuffer(s.UNIFORM_BUFFER,null)}function f(x,y,M,w){const b=x.value,R=y+"_"+M;if(w[R]===void 0)return typeof b=="number"||typeof b=="boolean"?w[R]=b:ArrayBuffer.isView(b)?w[R]=b.slice():w[R]=b.clone(),!0;{const v=w[R];if(typeof b=="number"||typeof b=="boolean"){if(v!==b)return w[R]=b,!0}else{if(ArrayBuffer.isView(b))return!0;if(v.equals(b)===!1)return v.copy(b),!0}}return!1}function p(x){const y=x.uniforms;let M=0;const w=16;for(let R=0,v=y.length;R<v;R++){const A=Array.isArray(y[R])?y[R]:[y[R]];for(let P=0,I=A.length;P<I;P++){const N=A[P],H=Array.isArray(N.value)?N.value:[N.value];for(let W=0,U=H.length;W<U;W++){const B=H[W],k=_(B),te=M%w,ne=te%k.boundary,pe=te+ne;M+=ne,pe!==0&&w-pe<k.storage&&(M+=w-pe),N.__data=new Float32Array(k.storage/Float32Array.BYTES_PER_ELEMENT),N.__offset=M,M+=k.storage}}}const b=M%w;return b>0&&(M+=w-b),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?de("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(x)?(y.boundary=16,y.storage=x.byteLength):de("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),s.deleteBuffer(i[y.id]),delete i[y.id],delete r[y.id]}function m(){for(const x in i)s.deleteBuffer(i[x]);a=[],i={},r={}}return{bind:l,update:c,dispose:m}}const Yv=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 Mn=null;function Zv(){return Mn===null&&(Mn=new An(Yv,16,16,Ri,Hn),Mn.name="DFG_LUT",Mn.minFilter=_t,Mn.magFilter=_t,Mn.wrapS=nn,Mn.wrapT=nn,Mn.generateMipmaps=!1,Mn.needsUpdate=!0),Mn}class qM{constructor(e={}){const{canvas:t=of(),context:n=null,depth:i=!0,stencil:r=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1,reversedDepthBuffer:u=!1,outputBufferType:f=en}=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([Ll,Pl,Ta]),m=new Set([en,fn,Xs,qs,Cl,Rl]),x=new Uint32Array(4),y=new Int32Array(4),M=new C;let w=null,b=null;const R=[],v=[];let A=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=Tn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const P=this;let I=!1,N=null;this._outputColorSpace=jt;let H=0,W=0,U=null,B=-1,k=null;const te=new dt,ne=new dt;let pe=null;const Me=new be(0);let Ce=0,Ke=t.width,nt=t.height,He=1,J=null,ge=null;const ae=new dt(0,0,Ke,nt),Le=new dt(0,0,Ke,nt);let Be=!1;const Fe=new er;let it=!1,ze=!1;const $=new Ge,ie=new C,Q=new dt,xe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let fe=!1;function Ve(){return U===null?He:1}let L=n;function We(T,F){return t.getContext(T,F)}try{const T={alpha:!0,depth:i,stencil:r,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Al}`),t.addEventListener("webglcontextlost",ee,!1),t.addEventListener("webglcontextrestored",De,!1),t.addEventListener("webglcontextcreationerror",Ze,!1),L===null){const F="webgl2";if(L=We(F,T),L===null)throw We(F)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(T){throw Pe("WebGLRenderer: "+T.message),T}let Re,ke,se,lt,E,S,O,Y,j,re,ce,X,Z,ye,Ae,he,oe,Xe,Qe,rt,D,le,q;
vendor: 4,550 bytes, line 4112
4112function Se(){Re=new Z_(L),Re.init(),D=new zv(L,Re),ke=new V_(L,Re,e,D),se=new Ov(L,Re),ke.reversedDepthBuffer&&u&&se.buffers.depth.setReversed(!0),lt=new K_(L),E=new bv,S=new Bv(L,Re,se,E,ke,D,lt),O=new Y_(P),Y=new tg(L),le=new B_(L,Y),j=new J_(L,Y,lt,le),re=new j_(L,j,Y,le,lt),Xe=new Q_(L,ke,S),Ae=new k_(E),ce=new Sv(P,O,Re,ke,le,Ae),X=new Xv(P,E),Z=new Av,ye=new Pv(Re),oe=new O_(P,O,se,re,p,l),he=new Fv(P,re,ke),q=new qv(L,lt,ke,se),Qe=new z_(L,Re,lt),rt=new $_(L,Re,lt),lt.programs=ce.programs,P.capabilities=ke,P.extensions=Re,P.properties=E,P.renderLists=Z,P.shadowMap=he,P.state=se,P.info=lt}Se(),_!==en&&(A=new tx(_,t.width,t.height,i,r));const ue=new Hv(P,L);this.xr=ue,this.getContext=function(){return L},this.getContextAttributes=function(){return L.getContextAttributes()},this.forceContextLoss=function(){const T=Re.get("WEBGL_lose_context");T&&T.loseContext()},this.forceContextRestore=function(){const T=Re.get("WEBGL_lose_context");T&&T.restoreContext()},this.getPixelRatio=function(){return He},this.setPixelRatio=function(T){T!==void 0&&(He=T,this.setSize(Ke,nt,!1))},this.getSize=function(T){return T.set(Ke,nt)},this.setSize=function(T,F,G=!0){if(ue.isPresenting){de("WebGLRenderer: Can't change size while VR device is presenting.");return}Ke=T,nt=F,t.width=Math.floor(T*He),t.height=Math.floor(F*He),G===!0&&(t.style.width=T+"px",t.style.height=F+"px"),A!==null&&A.setSize(t.width,t.height),this.setViewport(0,0,T,F)},this.getDrawingBufferSize=function(T){return T.set(Ke*He,nt*He).floor()},this.setDrawingBufferSize=function(T,F,G){Ke=T,nt=F,He=G,t.width=Math.floor(T*G),t.height=Math.floor(F*G),this.setViewport(0,0,T,F)},this.setEffects=function(T){if(_===en){Pe("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){de("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}A.setEffects(T||[])},this.getCurrentViewport=function(T){return T.copy(te)},this.getViewport=function(T){return T.copy(ae)},this.setViewport=function(T,F,G,z){T.isVector4?ae.set(T.x,T.y,T.z,T.w):ae.set(T,F,G,z),se.viewport(te.copy(ae).multiplyScalar(He).round())},this.getScissor=function(T){return T.copy(Le)},this.setScissor=function(T,F,G,z){T.isVector4?Le.set(T.x,T.y,T.z,T.w):Le.set(T,F,G,z),se.scissor(ne.copy(Le).multiplyScalar(He).round())},this.getScissorTest=function(){return Be},this.setScissorTest=function(T){se.setScissorTest(Be=T)},this.setOpaqueSort=function(T){J=T},this.setTransparentSort=function(T){ge=T},this.getClearColor=function(T){return T.copy(oe.getClearColor())},this.setClearColor=function(){oe.setClearColor(...arguments)},this.getClearAlpha=function(){return oe.getClearAlpha()},this.setClearAlpha=function(){oe.setClearAlpha(...arguments)},this.clear=function(T=!0,F=!0,G=!0){let z=0;if(T){let V=!1;if(U!==null){const ve=U.texture.format;V=g.has(ve)}if(V){const ve=U.texture.type,Ee=m.has(ve),_e=oe.getClearColor(),Ie=oe.getClearAlpha(),Ue=_e.r,Je=_e.g,et=_e.b;Ee?(x[0]=Ue,x[1]=Je,x[2]=et,x[3]=Ie,L.clearBufferuiv(L.COLOR,0,x)):(y[0]=Ue,y[1]=Je,y[2]=et,y[3]=Ie,L.clearBufferiv(L.COLOR,0,y))}else z|=L.COLOR_BUFFER_BIT}F&&(z|=L.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),G&&(z|=L.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),z!==0&&L.clear(z)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(T){T.setRenderer(this),N=T},this.dispose=function(){t.removeEventListener("webglcontextlost",ee,!1),t.removeEventListener("webglcontextrestored",De,!1),t.removeEventListener("webglcontextcreationerror",Ze,!1),oe.dispose(),Z.dispose(),ye.dispose(),E.dispose(),O.dispose(),re.dispose(),le.dispose(),q.dispose(),ce.dispose(),ue.dispose(),ue.removeEventListener("sessionstart",_c),ue.removeEventListener("sessionend",xc),li.stop()};function ee(T){T.preventDefault(),pa("WebGLRenderer: Context Lost."),I=!0}function De(){pa("WebGLRenderer: Context Restored."),I=!1;const T=lt.autoReset,F=he.enabled,G=he.autoUpdate,z=he.needsUpdate,V=he.type;Se(),lt.autoReset=T,he.enabled=F,he.autoUpdate=G,he.needsUpdate=z,he.type=V}function Ze(T){Pe("WebGLRenderer: A WebGL context could not be created. Reason: ",T.statusMessage)}function St(T){const F=T.target;F.removeEventListener("dispose",St),ht(F)}function ht(T){Rn(T),E.remove(T)}function Rn(T){const F=E.get(T).programs;
vendor: 8,996 bytes, line 4112
4112F!==void 0&&(F.forEach(function(G){ce.releaseProgram(G)}),T.isShaderMaterial&&ce.releaseShaderCache(T))}this.renderBufferDirect=function(T,F,G,z,V,ve){F===null&&(F=xe);const Ee=V.isMesh&&V.matrixWorld.determinant()<0,_e=_d(T,F,G,z,V);se.setMaterial(z,Ee);let Ie=G.index,Ue=1;if(z.wireframe===!0){if(Ie=j.getWireframeAttribute(G),Ie===void 0)return;Ue=2}const Je=G.drawRange,et=G.attributes.position;let Ne=Je.start*Ue,ut=(Je.start+Je.count)*Ue;ve!==null&&(Ne=Math.max(Ne,ve.start*Ue),ut=Math.min(ut,(ve.start+ve.count)*Ue)),Ie!==null?(Ne=Math.max(Ne,0),ut=Math.min(ut,Ie.count)):et!=null&&(Ne=Math.max(Ne,0),ut=Math.min(ut,et.count));const bt=ut-Ne;if(bt<0||bt===1/0)return;le.setup(V,z,_e,G,Ie);let vt,ft=Qe;if(Ie!==null&&(vt=Y.get(Ie),ft=rt,ft.setIndex(vt)),V.isMesh)z.wireframe===!0?(se.setLineWidth(z.wireframeLinewidth*Ve()),ft.setMode(L.LINES)):ft.setMode(L.TRIANGLES);else if(V.isLine){let Lt=z.linewidth;Lt===void 0&&(Lt=1),se.setLineWidth(Lt*Ve()),V.isLineSegments?ft.setMode(L.LINES):V.isLineLoop?ft.setMode(L.LINE_LOOP):ft.setMode(L.LINE_STRIP)}else V.isPoints?ft.setMode(L.POINTS):V.isSprite&&ft.setMode(L.TRIANGLES);if(V.isBatchedMesh)if(Re.get("WEBGL_multi_draw"))ft.renderMultiDraw(V._multiDrawStarts,V._multiDrawCounts,V._multiDrawCount);else{const Lt=V._multiDrawStarts,Te=V._multiDrawCounts,$t=V._multiDrawCount,st=Ie?Y.get(Ie).bytesPerElement:1,an=E.get(z).currentProgram.getUniforms();for(let _n=0;_n<$t;_n++)an.setValue(L,"_gl_DrawID",_n),ft.render(Lt[_n]/st,Te[_n])}else if(V.isInstancedMesh)ft.renderInstances(Ne,bt,V.count);else if(G.isInstancedBufferGeometry){const Lt=G._maxInstanceCount!==void 0?G._maxInstanceCount:1/0,Te=Math.min(G.instanceCount,Lt);ft.renderInstances(Ne,bt,Te)}else ft.render(Ne,bt)};function gn(T,F,G){T.transparent===!0&&T.side===Fn&&T.forceSinglePass===!1?(T.side=Yt,T.needsUpdate=!0,sr(T,F,G),T.side=si,T.needsUpdate=!0,sr(T,F,G),T.side=Fn):sr(T,F,G)}this.compile=function(T,F,G=null){G===null&&(G=T),b=ye.get(G),b.init(F),v.push(b),G.traverseVisible(function(V){V.isLight&&V.layers.test(F.layers)&&(b.pushLight(V),V.castShadow&&b.pushShadow(V))}),T!==G&&T.traverseVisible(function(V){V.isLight&&V.layers.test(F.layers)&&(b.pushLight(V),V.castShadow&&b.pushShadow(V))}),b.setupLights();const z=new Set;return T.traverse(function(V){if(!(V.isMesh||V.isPoints||V.isLine||V.isSprite))return;const ve=V.material;if(ve)if(Array.isArray(ve))for(let Ee=0;Ee<ve.length;Ee++){const _e=ve[Ee];gn(_e,G,V),z.add(_e)}else gn(ve,G,V),z.add(ve)}),b=v.pop(),z},this.compileAsync=function(T,F,G=null){const z=this.compile(T,F,G);return new Promise(V=>{function ve(){if(z.forEach(function(Ee){E.get(Ee).currentProgram.isReady()&&z.delete(Ee)}),z.size===0){V(T);return}setTimeout(ve,10)}Re.get("KHR_parallel_shader_compile")!==null?ve():setTimeout(ve,10)})};let Ua=null;function md(T){Ua&&Ua(T)}function _c(){li.stop()}function xc(){li.start()}const li=new od;li.setAnimationLoop(md),typeof self<"u"&&li.setContext(self),this.setAnimationLoop=function(T){Ua=T,ue.setAnimationLoop(T),T===null?li.stop():li.start()},ue.addEventListener("sessionstart",_c),ue.addEventListener("sessionend",xc),this.render=function(T,F){if(F!==void 0&&F.isCamera!==!0){Pe("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(I===!0)return;N!==null&&N.renderStart(T,F);const G=ue.enabled===!0&&ue.isPresenting===!0,z=A!==null&&(U===null||G)&&A.begin(P,U);if(T.matrixWorldAutoUpdate===!0&&T.updateMatrixWorld(),F.parent===null&&F.matrixWorldAutoUpdate===!0&&F.updateMatrixWorld(),ue.enabled===!0&&ue.isPresenting===!0&&(A===null||A.isCompositing()===!1)&&(ue.cameraAutoUpdate===!0&&ue.updateCamera(F),F=ue.getCamera()),T.isScene===!0&&T.onBeforeRender(P,T,F,U),b=ye.get(T,v.length),b.init(F),b.state.textureUnits=S.getTextureUnits(),v.push(b),$.multiplyMatrices(F.projectionMatrix,F.matrixWorldInverse),Fe.setFromProjectionMatrix($,ln,F.reversedDepth),ze=this.localClippingEnabled,it=Ae.init(this.clippingPlanes,ze),w=Z.get(T,R.length),w.init(),R.push(w),ue.enabled===!0&&ue.isPresenting===!0){const Ee=P.xr.getDepthSensingMesh();Ee!==null&&Na(Ee,F,-1/0,P.sortObjects)}Na(T,F,0,P.sortObjects),w.finish(),P.sortObjects===!0&&w.sort(J,ge),fe=ue.enabled===!1||ue.isPresenting===!1||ue.hasDepthSensing()===!1,fe&&oe.addToRenderList(w,T),this.info.render.frame++,it===!0&&Ae.beginShadows();const V=b.state.shadowsArray;if(he.render(V,T,F),it===!0&&Ae.endShadows(),this.info.autoReset===!0&&this.info.reset(),(z&&A.hasRenderPass())===!1){const Ee=w.opaque,_e=w.transmissive;if(b.setupLights(),F.isArrayCamera){const Ie=F.cameras;if(_e.length>0)for(let Ue=0,Je=Ie.length;Ue<Je;Ue++){const et=Ie[Ue];yc(Ee,_e,T,et)}fe&&oe.render(T);for(let Ue=0,Je=Ie.length;Ue<Je;Ue++){const et=Ie[Ue];vc(w,T,et,et.viewport)}}else _e.length>0&&yc(Ee,_e,T,F),fe&&oe.render(T),vc(w,T,F)}U!==null&&W===0&&(S.updateMultisampleRenderTarget(U),S.updateRenderTargetMipmap(U)),z&&A.end(P),T.isScene===!0&&T.onAfterRender(P,T,F),le.resetDefaultState(),B=-1,k=null,v.pop(),v.length>0?(b=v[v.length-1],S.setTextureUnits(b.state.textureUnits),it===!0&&Ae.setGlobalState(P.clippingPlanes,b.state.camera)):b=null,R.pop(),R.length>0?w=R[R.length-1]:w=null,N!==null&&N.renderEnd()};function Na(T,F,G,z){if(T.visible===!1)return;if(T.layers.test(F.layers)){if(T.isGroup)G=T.renderOrder;else if(T.isLOD)T.autoUpdate===!0&&T.update(F);else if(T.isLightProbeGrid)b.pushLightProbeGrid(T);else if(T.isLight)b.pushLight(T),T.castShadow&&b.pushShadow(T);else if(T.isSprite){if(!T.frustumCulled||Fe.intersectsSprite(T)){z&&Q.setFromMatrixPosition(T.matrixWorld).applyMatrix4($);const Ee=re.update(T),_e=T.material;_e.visible&&w.push(T,Ee,_e,G,Q.z,null)}}else if((T.isMesh||T.isLine||T.isPoints)&&(!T.frustumCulled||Fe.intersectsObject(T))){const Ee=re.update(T),_e=T.material;if(z&&(T.boundingSphere!==void 0?(T.boundingSphere===null&&T.computeBoundingSphere(),Q.copy(T.boundingSphere.center)):(Ee.boundingSphere===null&&Ee.computeBoundingSphere(),Q.copy(Ee.boundingSphere.center)),Q.applyMatrix4(T.matrixWorld).applyMatrix4($)),Array.isArray(_e)){const Ie=Ee.groups;for(let Ue=0,Je=Ie.length;Ue<Je;Ue++){const et=Ie[Ue],Ne=_e[et.materialIndex];Ne&&Ne.visible&&w.push(T,Ee,Ne,G,Q.z,et)}}else _e.visible&&w.push(T,Ee,_e,G,Q.z,null)}}const ve=T.children;for(let Ee=0,_e=ve.length;Ee<_e;Ee++)Na(ve[Ee],F,G,z)}function vc(T,F,G,z){const{opaque:V,transmissive:ve,transparent:Ee}=T;b.setupLightsView(G),it===!0&&Ae.setGlobalState(P.clippingPlanes,G),z&&se.viewport(te.copy(z)),V.length>0&&ir(V,F,G),ve.length>0&&ir(ve,F,G),Ee.length>0&&ir(Ee,F,G),se.buffers.depth.setTest(!0),se.buffers.depth.setMask(!0),se.buffers.color.setMask(!0),se.setPolygonOffset(!1)}function yc(T,F,G,z){if((G.isScene===!0?G.overrideMaterial:null)!==null)return;if(b.state.transmissionRenderTarget[z.id]===void 0){const Ne=Re.has("EXT_color_buffer_half_float")||Re.has("EXT_color_buffer_float");b.state.transmissionRenderTarget[z.id]=new cn(1,1,{generateMipmaps:!0,type:Ne?Hn:en,minFilter:Bn,samples:Math.max(4,ke.samples),stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:tt.workingColorSpace})}const ve=b.state.transmissionRenderTarget[z.id],Ee=z.viewport||te;ve.setSize(Ee.z*P.transmissionResolutionScale,Ee.w*P.transmissionResolutionScale);const _e=P.getRenderTarget(),Ie=P.getActiveCubeFace(),Ue=P.getActiveMipmapLevel();P.setRenderTarget(ve),P.getClearColor(Me),Ce=P.getClearAlpha(),Ce<1&&P.setClearColor(16777215,.5),P.clear(),fe&&oe.render(G);const Je=P.toneMapping;P.toneMapping=Tn;const et=z.viewport;if(z.viewport!==void 0&&(z.viewport=void 0),b.setupLightsView(z),it===!0&&Ae.setGlobalState(P.clippingPlanes,z),ir(T,G,z),S.updateMultisampleRenderTarget(ve),S.updateRenderTargetMipmap(ve),Re.has("WEBGL_multisampled_render_to_texture")===!1){let Ne=!1;for(let ut=0,bt=F.length;ut<bt;ut++){const vt=F[ut],{object:ft,geometry:Lt,material:Te,group:$t}=vt;if(Te.side===Fn&&ft.layers.test(z.layers)){const st=Te.side;Te.side=Yt,Te.needsUpdate=!0,Mc(ft,G,z,Lt,Te,$t),Te.side=st,Te.needsUpdate=!0,Ne=!0}}Ne===!0&&(S.updateMultisampleRenderTarget(ve),S.updateRenderTargetMipmap(ve))}P.setRenderTarget(_e,Ie,Ue),P.setClearColor(Me,Ce),et!==void 0&&(z.viewport=et),P.toneMapping=Je}function ir(T,F,G){const z=F.isScene===!0?F.overrideMaterial:null;for(let V=0,ve=T.length;V<ve;V++){const Ee=T[V],{object:_e,geometry:Ie,group:Ue}=Ee;let Je=Ee.material;Je.allowOverride===!0&&z!==null&&(Je=z),_e.layers.test(G.layers)&&Mc(_e,F,G,Ie,Je,Ue)}}function Mc(T,F,G,z,V,ve){T.onBeforeRender(P,F,G,z,V,ve),T.modelViewMatrix.multiplyMatrices(G.matrixWorldInverse,T.matrixWorld),T.normalMatrix.getNormalMatrix(T.modelViewMatrix),V.onBeforeRender(P,F,G,z,T,ve),V.transparent===!0&&V.side===Fn&&V.forceSinglePass===!1?(V.side=Yt,V.needsUpdate=!0,P.renderBufferDirect(G,F,z,V,T,ve),V.side=si,V.needsUpdate=!0,P.renderBufferDirect(G,F,z,V,T,ve),V.side=Fn):P.renderBufferDirect(G,F,z,V,T,ve),T.onAfterRender(P,F,G,z,V,ve)}function sr(T,F,G){F.isScene!==!0&&(F=xe);const z=E.get(T),V=b.state.lights,ve=b.state.shadowsArray,Ee=V.state.ver
vendor: 10,057 bytes, line 4112
4112sion,_e=ce.getParameters(T,V.state,ve,F,G,b.state.lightProbeGridArray),Ie=ce.getProgramCacheKey(_e);let Ue=z.programs;z.environment=T.isMeshStandardMaterial||T.isMeshLambertMaterial||T.isMeshPhongMaterial?F.environment:null,z.fog=F.fog;const Je=T.isMeshStandardMaterial||T.isMeshLambertMaterial&&!T.envMap||T.isMeshPhongMaterial&&!T.envMap;z.envMap=O.get(T.envMap||z.environment,Je),z.envMapRotation=z.environment!==null&&T.envMap===null?F.environmentRotation:T.envMapRotation,Ue===void 0&&(T.addEventListener("dispose",St),Ue=new Map,z.programs=Ue);let et=Ue.get(Ie);if(et!==void 0){if(z.currentProgram===et&&z.lightsStateVersion===Ee)return bc(T,_e),et}else _e.uniforms=ce.getUniforms(T),N!==null&&T.isNodeMaterial&&N.build(T,G,_e),T.onBeforeCompile(_e,P),et=ce.acquireProgram(_e,Ie),Ue.set(Ie,et),z.uniforms=_e.uniforms;const Ne=z.uniforms;return(!T.isShaderMaterial&&!T.isRawShaderMaterial||T.clipping===!0)&&(Ne.clippingPlanes=Ae.uniform),bc(T,_e),z.needsLights=vd(T),z.lightsStateVersion=Ee,z.needsLights&&(Ne.ambientLightColor.value=V.state.ambient,Ne.lightProbe.value=V.state.probe,Ne.directionalLights.value=V.state.directional,Ne.directionalLightShadows.value=V.state.directionalShadow,Ne.spotLights.value=V.state.spot,Ne.spotLightShadows.value=V.state.spotShadow,Ne.rectAreaLights.value=V.state.rectArea,Ne.ltc_1.value=V.state.rectAreaLTC1,Ne.ltc_2.value=V.state.rectAreaLTC2,Ne.pointLights.value=V.state.point,Ne.pointLightShadows.value=V.state.pointShadow,Ne.hemisphereLights.value=V.state.hemi,Ne.directionalShadowMatrix.value=V.state.directionalShadowMatrix,Ne.spotLightMatrix.value=V.state.spotLightMatrix,Ne.spotLightMap.value=V.state.spotLightMap,Ne.pointShadowMatrix.value=V.state.pointShadowMatrix),z.lightProbeGrid=b.state.lightProbeGridArray.length>0,z.currentProgram=et,z.uniformsList=null,et}function Sc(T){if(T.uniformsList===null){const F=T.currentProgram.getUniforms();T.uniformsList=sa.seqWithValue(F.seq,T.uniforms)}return T.uniformsList}function bc(T,F){const G=E.get(T);G.outputColorSpace=F.outputColorSpace,G.batching=F.batching,G.batchingColor=F.batchingColor,G.instancing=F.instancing,G.instancingColor=F.instancingColor,G.instancingMorph=F.instancingMorph,G.skinning=F.skinning,G.morphTargets=F.morphTargets,G.morphNormals=F.morphNormals,G.morphColors=F.morphColors,G.morphTargetsCount=F.morphTargetsCount,G.numClippingPlanes=F.numClippingPlanes,G.numIntersection=F.numClipIntersection,G.vertexAlphas=F.vertexAlphas,G.vertexTangents=F.vertexTangents,G.toneMapping=F.toneMapping}function gd(T,F){if(T.length===0)return null;if(T.length===1)return T[0].texture!==null?T[0]:null;M.setFromMatrixPosition(F.matrixWorld);for(let G=0,z=T.length;G<z;G++){const V=T[G];if(V.texture!==null&&V.boundingBox.containsPoint(M))return V}return null}function _d(T,F,G,z,V){F.isScene!==!0&&(F=xe),S.resetTextureUnits();const ve=F.fog,Ee=z.isMeshStandardMaterial||z.isMeshLambertMaterial||z.isMeshPhongMaterial?F.environment:null,_e=U===null?P.outputColorSpace:U.isXRRenderTarget===!0?U.texture.colorSpace:tt.workingColorSpace,Ie=z.isMeshStandardMaterial||z.isMeshLambertMaterial&&!z.envMap||z.isMeshPhongMaterial&&!z.envMap,Ue=O.get(z.envMap||Ee,Ie),Je=z.vertexColors===!0&&!!G.attributes.color&&G.attributes.color.itemSize===4,et=!!G.attributes.tangent&&(!!z.normalMap||z.anisotropy>0),Ne=!!G.morphAttributes.position,ut=!!G.morphAttributes.normal,bt=!!G.morphAttributes.color;let vt=Tn;z.toneMapped&&(U===null||U.isXRRenderTarget===!0)&&(vt=P.toneMapping);const ft=G.morphAttributes.position||G.morphAttributes.normal||G.morphAttributes.color,Lt=ft!==void 0?ft.length:0,Te=E.get(z),$t=b.state.lights;if(it===!0&&(ze===!0||T!==k)){const gt=T===k&&z.id===B;Ae.setState(z,T,gt)}let st=!1;z.version===Te.__version?(Te.needsLights&&Te.lightsStateVersion!==$t.state.version||Te.outputColorSpace!==_e||V.isBatchedMesh&&Te.batching===!1||!V.isBatchedMesh&&Te.batching===!0||V.isBatchedMesh&&Te.batchingColor===!0&&V.colorTexture===null||V.isBatchedMesh&&Te.batchingColor===!1&&V.colorTexture!==null||V.isInstancedMesh&&Te.instancing===!1||!V.isInstancedMesh&&Te.instancing===!0||V.isSkinnedMesh&&Te.skinning===!1||!V.isSkinnedMesh&&Te.skinning===!0||V.isInstancedMesh&&Te.instancingColor===!0&&V.instanceColor===null||V.isInstancedMesh&&Te.instancingColor===!1&&V.instanceColor!==null||V.isInstancedMesh&&Te.instancingMorph===!0&&V.morphTexture===null||V.isInstancedMesh&&Te.instancingMorph===!1&&V.morphTexture!==null||Te.envMap!==Ue||z.fog===!0&&Te.fog!==ve||Te.numClippingPlanes!==void 0&&(Te.numClippingPlanes!==Ae.numPlanes||Te.numIntersection!==Ae.numIntersection)||Te.vertexAlphas!==Je||Te.vertexTangents!==et||Te.morphTargets!==Ne||Te.morphNormals!==ut||Te.morphColors!==bt||Te.toneMapping!==vt||Te.morphTargetsCount!==Lt||!!Te.lightProbeGrid!=b.state.lightProbeGridArray.length>0)&&(st=!0):(st=!0,Te.__version=z.version);let an=Te.currentProgram;st===!0&&(an=sr(z,F,V),N&&z.isNodeMaterial&&N.onUpdateProgram(z,an,Te));let _n=!1,qn=!1,Ni=!1;const pt=an.getUniforms(),Tt=Te.uniforms;if(se.useProgram(an.program)&&(_n=!0,qn=!0,Ni=!0),z.id!==B&&(B=z.id,qn=!0),Te.needsLights){const gt=gd(b.state.lightProbeGridArray,V);Te.lightProbeGrid!==gt&&(Te.lightProbeGrid=gt,qn=!0)}if(_n||k!==T){se.buffers.depth.getReversed()&&T.reversedDepth!==!0&&(T._reversedDepth=!0,T.updateProjectionMatrix()),pt.setValue(L,"projectionMatrix",T.projectionMatrix),pt.setValue(L,"viewMatrix",T.matrixWorldInverse);const Zn=pt.map.cameraPosition;Zn!==void 0&&Zn.setValue(L,ie.setFromMatrixPosition(T.matrixWorld)),ke.logarithmicDepthBuffer&&pt.setValue(L,"logDepthBufFC",2/(Math.log(T.far+1)/Math.LN2)),(z.isMeshPhongMaterial||z.isMeshToonMaterial||z.isMeshLambertMaterial||z.isMeshBasicMaterial||z.isMeshStandardMaterial||z.isShaderMaterial)&&pt.setValue(L,"isOrthographic",T.isOrthographicCamera===!0),k!==T&&(k=T,qn=!0,Ni=!0)}if(Te.needsLights&&($t.state.directionalShadowMap.length>0&&pt.setValue(L,"directionalShadowMap",$t.state.directionalShadowMap,S),$t.state.spotShadowMap.length>0&&pt.setValue(L,"spotShadowMap",$t.state.spotShadowMap,S),$t.state.pointShadowMap.length>0&&pt.setValue(L,"pointShadowMap",$t.state.pointShadowMap,S)),V.isSkinnedMesh){pt.setOptional(L,V,"bindMatrix"),pt.setOptional(L,V,"bindMatrixInverse");const gt=V.skeleton;gt&&(gt.boneTexture===null&&gt.computeBoneTexture(),pt.setValue(L,"boneTexture",gt.boneTexture,S))}V.isBatchedMesh&&(pt.setOptional(L,V,"batchingTexture"),pt.setValue(L,"batchingTexture",V._matricesTexture,S),pt.setOptional(L,V,"batchingIdTexture"),pt.setValue(L,"batchingIdTexture",V._indirectTexture,S),pt.setOptional(L,V,"batchingColorTexture"),V._colorsTexture!==null&&pt.setValue(L,"batchingColorTexture",V._colorsTexture,S));const Yn=G.morphAttributes;if((Yn.position!==void 0||Yn.normal!==void 0||Yn.color!==void 0)&&Xe.update(V,G,an),(qn||Te.receiveShadow!==V.receiveShadow)&&(Te.receiveShadow=V.receiveShadow,pt.setValue(L,"receiveShadow",V.receiveShadow)),(z.isMeshStandardMaterial||z.isMeshLambertMaterial||z.isMeshPhongMaterial)&&z.envMap===null&&F.environment!==null&&(Tt.envMapIntensity.value=F.environmentIntensity),Tt.dfgLUT!==void 0&&(Tt.dfgLUT.value=Zv()),qn){if(pt.setValue(L,"toneMappingExposure",P.toneMappingExposure),Te.needsLights&&xd(Tt,Ni),ve&&z.fog===!0&&X.refreshFogUniforms(Tt,ve),X.refreshMaterialUniforms(Tt,z,He,nt,b.state.transmissionRenderTarget[T.id]),Te.needsLights&&Te.lightProbeGrid){const gt=Te.lightProbeGrid;Tt.probesSH.value=gt.texture,Tt.probesMin.value.copy(gt.boundingBox.min),Tt.probesMax.value.copy(gt.boundingBox.max),Tt.probesResolution.value.copy(gt.resolution)}sa.upload(L,Sc(Te),Tt,S)}if(z.isShaderMaterial&&z.uniformsNeedUpdate===!0&&(sa.upload(L,Sc(Te),Tt,S),z.uniformsNeedUpdate=!1),z.isSpriteMaterial&&pt.setValue(L,"center",V.center),pt.setValue(L,"modelViewMatrix",V.modelViewMatrix),pt.setValue(L,"normalMatrix",V.normalMatrix),pt.setValue(L,"modelMatrix",V.matrixWorld),z.uniformsGroups!==void 0){const gt=z.uniformsGroups;for(let Zn=0,Fi=gt.length;Zn<Fi;Zn++){const Tc=gt[Zn];q.update(Tc,an),q.bind(Tc,an)}}return an}function xd(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 vd(T){return T.isMeshLambertMaterial||T.isMeshToonMaterial||T.isMeshPhongMaterial||T.isMeshStandardMaterial||T.isShadowMaterial||T.isShaderMaterial&&T.lights===!0}this.getActiveCubeFace=function(){return H},this.getActiveMipmapLevel=function(){return W},this.getRenderTarget=function(){return U},this.setRenderTargetTextures=function(T,F,G){const z=E.get(T);z.__autoAllocateDepthBuffer=T.resolveDepthBuffer===!1,z.__autoAllocateDepthBuffer===!1&&(z.__useRenderToTexture=!1),E.get(T.texture).__webglTexture=F,E.get(T.depthTexture).__webglTexture=z.__autoAllocateDepthBuffer?void 0:G,z.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(T,F){const G=E.get(T);G.__webglFramebuffer=F,G.__useDefaultFramebuffer=F===void 0};const yd=L.createFramebuffer();this.setRenderTarget=function(T,F=0,G=0){U=T,H=F,W=G;let z=null,V=!1,ve=!1;if(T){const _e=E.get(T);if(_e.__useDefaultFramebuffer!==void 0){se.bindFramebuffer(L.FRAMEBUFFER,_e.__webglFramebuffer),te.copy(T.viewport),ne.copy(T.scissor),pe=T.scissorTest,se.viewport(te),se.scissor(ne),se.setScissorTest(pe),B=-1;return}else if(_e.__webglFramebuffer===void 0)S.setupRenderTarget(T);else if(_e.__hasExternalTextures)S.rebindTextures(T,E.get(T.texture).__webglTexture,E.get(T.depthTexture).__webglTexture);else if(T.depthBuffer){const Je=T.depthTexture;if(_e.__boundDepthTexture!==Je){if(Je!==null&&E.has(Je)&&(T.width!==Je.image.width||T.height!==Je.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");S.setupDepthRenderbuffer(T)}}const Ie=T.texture;(Ie.isData3DTexture||Ie.isDataArrayTexture||Ie.isCompressedArrayTexture)&&(ve=!0);const Ue=E.get(T).__webglFramebuffer;
vendor: 12,230 bytes, line 4112
4112T.isWebGLCubeRenderTarget?(Array.isArray(Ue[F])?z=Ue[F][G]:z=Ue[F],V=!0):T.samples>0&&S.useMultisampledRTT(T)===!1?z=E.get(T).__webglMultisampledFramebuffer:Array.isArray(Ue)?z=Ue[G]:z=Ue,te.copy(T.viewport),ne.copy(T.scissor),pe=T.scissorTest}else te.copy(ae).multiplyScalar(He).floor(),ne.copy(Le).multiplyScalar(He).floor(),pe=Be;if(G!==0&&(z=yd),se.bindFramebuffer(L.FRAMEBUFFER,z)&&se.drawBuffers(T,z),se.viewport(te),se.scissor(ne),se.setScissorTest(pe),V){const _e=E.get(T.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_CUBE_MAP_POSITIVE_X+F,_e.__webglTexture,G)}else if(ve){const _e=F;for(let Ie=0;Ie<T.textures.length;Ie++){const Ue=E.get(T.textures[Ie]);L.framebufferTextureLayer(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0+Ie,Ue.__webglTexture,G,_e)}}else if(T!==null&&G!==0){const _e=E.get(T.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,_e.__webglTexture,G)}B=-1},this.readRenderTargetPixels=function(T,F,G,z,V,ve,Ee,_e=0){if(!(T&&T.isWebGLRenderTarget)){Pe("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ie=E.get(T).__webglFramebuffer;if(T.isWebGLCubeRenderTarget&&Ee!==void 0&&(Ie=Ie[Ee]),Ie){se.bindFramebuffer(L.FRAMEBUFFER,Ie);try{const Ue=T.textures[_e],Je=Ue.format,et=Ue.type;if(T.textures.length>1&&L.readBuffer(L.COLOR_ATTACHMENT0+_e),!ke.textureFormatReadable(Je)){Pe("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ke.textureTypeReadable(et)){Pe("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}F>=0&&F<=T.width-z&&G>=0&&G<=T.height-V&&L.readPixels(F,G,z,V,D.convert(Je),D.convert(et),ve)}finally{const Ue=U!==null?E.get(U).__webglFramebuffer:null;se.bindFramebuffer(L.FRAMEBUFFER,Ue)}}},this.readRenderTargetPixelsAsync=async function(T,F,G,z,V,ve,Ee,_e=0){if(!(T&&T.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Ie=E.get(T).__webglFramebuffer;if(T.isWebGLCubeRenderTarget&&Ee!==void 0&&(Ie=Ie[Ee]),Ie)if(F>=0&&F<=T.width-z&&G>=0&&G<=T.height-V){se.bindFramebuffer(L.FRAMEBUFFER,Ie);const Ue=T.textures[_e],Je=Ue.format,et=Ue.type;if(T.textures.length>1&&L.readBuffer(L.COLOR_ATTACHMENT0+_e),!ke.textureFormatReadable(Je))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ke.textureTypeReadable(et))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Ne=L.createBuffer();L.bindBuffer(L.PIXEL_PACK_BUFFER,Ne),L.bufferData(L.PIXEL_PACK_BUFFER,ve.byteLength,L.STREAM_READ),L.readPixels(F,G,z,V,D.convert(Je),D.convert(et),0);const ut=U!==null?E.get(U).__webglFramebuffer:null;se.bindFramebuffer(L.FRAMEBUFFER,ut);const bt=L.fenceSync(L.SYNC_GPU_COMMANDS_COMPLETE,0);return L.flush(),await lf(L,bt,4),L.bindBuffer(L.PIXEL_PACK_BUFFER,Ne),L.getBufferSubData(L.PIXEL_PACK_BUFFER,0,ve),L.deleteBuffer(Ne),L.deleteSync(bt),ve}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(T,F=null,G=0){const z=Math.pow(2,-G),V=Math.floor(T.image.width*z),ve=Math.floor(T.image.height*z),Ee=F!==null?F.x:0,_e=F!==null?F.y:0;S.setTexture2D(T,0),L.copyTexSubImage2D(L.TEXTURE_2D,G,0,0,Ee,_e,V,ve),se.unbindTexture()};const Md=L.createFramebuffer(),Sd=L.createFramebuffer();this.copyTextureToTexture=function(T,F,G=null,z=null,V=0,ve=0){let Ee,_e,Ie,Ue,Je,et,Ne,ut,bt;const vt=T.isCompressedTexture?T.mipmaps[ve]:T.image;if(G!==null)Ee=G.max.x-G.min.x,_e=G.max.y-G.min.y,Ie=G.isBox3?G.max.z-G.min.z:1,Ue=G.min.x,Je=G.min.y,et=G.isBox3?G.min.z:0;else{const Tt=Math.pow(2,-V);Ee=Math.floor(vt.width*Tt),_e=Math.floor(vt.height*Tt),T.isDataArrayTexture?Ie=vt.depth:T.isData3DTexture?Ie=Math.floor(vt.depth*Tt):Ie=1,Ue=0,Je=0,et=0}z!==null?(Ne=z.x,ut=z.y,bt=z.z):(Ne=0,ut=0,bt=0);const ft=D.convert(F.format),Lt=D.convert(F.type);let Te;F.isData3DTexture?(S.setTexture3D(F,0),Te=L.TEXTURE_3D):F.isDataArrayTexture||F.isCompressedArrayTexture?(S.setTexture2DArray(F,0),Te=L.TEXTURE_2D_ARRAY):(S.setTexture2D(F,0),Te=L.TEXTURE_2D),se.activeTexture(L.TEXTURE0),se.pixelStorei(L.UNPACK_FLIP_Y_WEBGL,F.flipY),se.pixelStorei(L.UNPACK_PREMULTIPLY_ALPHA_WEBGL,F.premultiplyAlpha),se.pixelStorei(L.UNPACK_ALIGNMENT,F.unpackAlignment);const $t=se.getParameter(L.UNPACK_ROW_LENGTH),st=se.getParameter(L.UNPACK_IMAGE_HEIGHT),an=se.getParameter(L.UNPACK_SKIP_PIXELS),_n=se.getParameter(L.UNPACK_SKIP_ROWS),qn=se.getParameter(L.UNPACK_SKIP_IMAGES);se.pixelStorei(L.UNPACK_ROW_LENGTH,vt.width),se.pixelStorei(L.UNPACK_IMAGE_HEIGHT,vt.height),se.pixelStorei(L.UNPACK_SKIP_PIXELS,Ue),se.pixelStorei(L.UNPACK_SKIP_ROWS,Je),se.pixelStorei(L.UNPACK_SKIP_IMAGES,et);const Ni=T.isDataArrayTexture||T.isData3DTexture,pt=F.isDataArrayTexture||F.isData3DTexture;if(T.isDepthTexture){const Tt=E.get(T),Yn=E.get(F),gt=E.get(Tt.__renderTarget),Zn=E.get(Yn.__renderTarget);se.bindFramebuffer(L.READ_FRAMEBUFFER,gt.__webglFramebuffer),se.bindFramebuffer(L.DRAW_FRAMEBUFFER,Zn.__webglFramebuffer);for(let Fi=0;Fi<Ie;Fi++)Ni&&(L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,E.get(T).__webglTexture,V,et+Fi),L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,E.get(F).__webglTexture,ve,bt+Fi)),L.blitFramebuffer(Ue,Je,Ee,_e,Ne,ut,Ee,_e,L.DEPTH_BUFFER_BIT,L.NEAREST);se.bindFramebuffer(L.READ_FRAMEBUFFER,null),se.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else if(V!==0||T.isRenderTargetTexture||E.has(T)){const Tt=E.get(T),Yn=E.get(F);se.bindFramebuffer(L.READ_FRAMEBUFFER,Md),se.bindFramebuffer(L.DRAW_FRAMEBUFFER,Sd);for(let gt=0;gt<Ie;gt++)Ni?L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,Tt.__webglTexture,V,et+gt):L.framebufferTexture2D(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,Tt.__webglTexture,V),pt?L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,Yn.__webglTexture,ve,bt+gt):L.framebufferTexture2D(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,Yn.__webglTexture,ve),V!==0?L.blitFramebuffer(Ue,Je,Ee,_e,Ne,ut,Ee,_e,L.COLOR_BUFFER_BIT,L.NEAREST):pt?L.copyTexSubImage3D(Te,ve,Ne,ut,bt+gt,Ue,Je,Ee,_e):L.copyTexSubImage2D(Te,ve,Ne,ut,Ue,Je,Ee,_e);se.bindFramebuffer(L.READ_FRAMEBUFFER,null),se.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else pt?T.isDataTexture||T.isData3DTexture?L.texSubImage3D(Te,ve,Ne,ut,bt,Ee,_e,Ie,ft,Lt,vt.data):F.isCompressedArrayTexture?L.compressedTexSubImage3D(Te,ve,Ne,ut,bt,Ee,_e,Ie,ft,vt.data):L.texSubImage3D(Te,ve,Ne,ut,bt,Ee,_e,Ie,ft,Lt,vt):T.isDataTexture?L.texSubImage2D(L.TEXTURE_2D,ve,Ne,ut,Ee,_e,ft,Lt,vt.data):T.isCompressedTexture?L.compressedTexSubImage2D(L.TEXTURE_2D,ve,Ne,ut,vt.width,vt.height,ft,vt.data):L.texSubImage2D(L.TEXTURE_2D,ve,Ne,ut,Ee,_e,ft,Lt,vt);se.pixelStorei(L.UNPACK_ROW_LENGTH,$t),se.pixelStorei(L.UNPACK_IMAGE_HEIGHT,st),se.pixelStorei(L.UNPACK_SKIP_PIXELS,an),se.pixelStorei(L.UNPACK_SKIP_ROWS,_n),se.pixelStorei(L.UNPACK_SKIP_IMAGES,qn),ve===0&&F.generateMipmaps&&L.generateMipmap(Te),se.unbindTexture()},this.initRenderTarget=function(T){E.get(T).__webglFramebuffer===void 0&&S.setupRenderTarget(T)},this.initTexture=function(T){T.isCubeTexture?S.setTextureCube(T,0):T.isData3DTexture?S.setTexture3D(T,0):T.isDataArrayTexture||T.isCompressedArrayTexture?S.setTexture2DArray(T,0):S.setTexture2D(T,0),se.unbindTexture()},this.resetState=function(){H=0,W=0,U=null,se.reset(),le.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return ln}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=tt._getDrawingBufferColorSpace(e),t.unpackColorSpace=tt._getUnpackColorSpace()}}export{gu as ACESFilmicToneMapping,Si as AddEquation,Xd as AddOperation,wu as AdditiveAnimationBlendMode,Ec as AdditiveBlending,xu as AgXToneMapping,Au as AlphaFormat,sf as AlwaysCompare,Lo as AlwaysDepth,Pc as AlwaysStencilFunc,Sm as AmbientLight,Xm as AnimationAction,ya as AnimationClip,aM as AnimationLoader,vM as AnimationMixer,xM as AnimationObjectGroup,rM as AnimationUtils,fp as ArcCurve,Rm as ArrayCamera,kM as ArrowHelper,Rc as AttachedBindMode,Dm as Audio,_M as AudioAnalyser,sd as AudioContext,mM as AudioListener,fM as AudioLoader,GM as AxesHelper,Yt as BackSide,$d as BasicDepthPacking,Qv as BasicShadowMap,op as BatchedMesh,cm as BezierInterpolant,Fu as Bone,vs as BooleanKeyframeTrack,CM as Box2,kt as Box3,zM as Box3Helper,xs as BoxGeometry,BM as BoxHelper,mt as BufferAttribute,Ye as BufferGeometry,Em as BufferGeometryLoader,Mu as ByteType,zn as Cache,lc as Camera,OM as CameraHelper,iM as CanvasTexture,ql as CapsuleGeometry,pp as CatmullRomCurve3,mu as CineonToneMapping,Yl as CircleGeometry,nn as ClampToEdgeWrapping,AM as Clock,be as Color,td as ColorKeyframeTrack,tt as ColorManagement,Vy as Compatibility,tM as CompressedArrayTexture,nM as CompressedCubeTexture,Xl as CompressedTexture,oM as CompressedTextureLoader,wa as ConeGeometry,Gd as ConstantAlphaFactor,Vd as ConstantColorFactor,WM as Controls,Cm as CubeCamera,up as CubeDepthTexture,Gn as CubeReflectionMapping,Ci as CubeRefractionMapping,Aa as CubeTexture,lM as CubeTextureLoader,Qs as CubeUVReflectionMapping,zu as CubicBezierCurve,Sp as CubicBezierCurve3,om as CubicInterpolant,Ac as CullFaceBack,Td as CullFaceFront,Kv as CullFaceFrontBack,bd as CullFaceNone,Cn as Curve,Tp as CurvePath,Ed as CustomBlending,_u as CustomToneMapping,Ea as CylinderGeometry,wM as Cylindrical,Bl as Data3DTexture,Ol as DataArrayTexture,An as DataTexture,cM as DataTextureLoader,qy as DataUtils,_y as DecrementStencilOp,vy as DecrementWrapStencilOp,fm as DefaultLoadingManager,Wn as DepthFormat,Ti as DepthStencilFormat,ms as DepthTexture,qd as DetachedBindMode,Mm as DirectionalLight,FM as DirectionalLightHelper,lm as DiscreteInterpolant,Zl as DodecahedronGeometry,Fn as DoubleSide,Nd as DstAlphaFactor,Od as DstColorFactor,Uy as DynamicCopyUsage,Cy as DynamicDrawUsage,Py as DynamicReadUsage,dp as EdgesGeometry,Jl as EllipseCurve,ef as EqualCompare,Uo as EqualDepth,by as EqualStencilFunc,Kr as EquirectangularReflectionMapping,Qr as EquirectangularRefractionMapping,En as Euler,wn as EventDispatcher,Bu as ExternalTexture,Kl as ExtrudeGeometry,oi as FileLoader,Qy as Float16BufferAttribute,we as Float32BufferAttribute,Xt as FloatType,kl as Fog,Vl as FogExp2,eM as FramebufferTexture,si as FrontSide,er as Frustum,Wl as FrustumArray,bM as GLBufferAttribute,Fy as GLSL1,Lc as GLSL3,tf as GreaterCompare,Fo as GreaterDepth,Nl as GreaterEqualCompare,No as GreaterEqualDepth,wy as GreaterEqualStencilFunc,Ay as GreaterStencilFunc,UM as GridHelper,Bs as Group,sM as HTMLTexture,Hn as HalfFloatType,mm as HemisphereLight,DM as HemisphereLightHelper,Ql as IcosahedronGeometry,dM as ImageBitmapLoader,Ma as ImageLoader,wf as ImageUtils,gy as IncrementStencilOp,xy as IncrementWrapStencilOp,Zs as InstancedBufferAttribute,Am as InstancedBufferGeometry,SM as InstancedInterleavedBuffer,$f as InstancedMesh,$y as Int16BufferAttribute,Ky as Int32BufferAttribute,Yy as Int8BufferAttribute,wl as IntType,Gl as InterleavedBuffer,ps as InterleavedBufferAttribute,nr as Interpolant,Ic as InterpolateBezier,ca as InterpolateDiscrete,pl as InterpolateLinear,Fa as InterpolateSmooth,zy as InterpolationSamplingMode,By as InterpolationSamplingType,yy as InvertStencilOp,Oi as KeepStencilOp,mn as KeyframeTrack,Wf as LOD,jl as LatheGeometry,zl as Layers,jd as LessCompare,Do as LessDepth,Ul as LessEqualCompare,us as LessEqualDepth,Ty as LessEqualStencilFunc,Sy as LessStencilFunc,Ui as Light,Tm as LightProbe,Ii as Line,RM as Line3,Jt as LineBasicMaterial,Vu as LineCurve,bp as LineCurve3,sm as LineDashedMaterial,lp as LineLoop,Xn as LineSegments,_t as LinearFilter,ed as LinearInterpolant,iy as LinearMipMapLinearFilter,ny as LinearMipMapNearestFilter,Bn as LinearMipmapLinearFilter,jr as LinearMipmapNearestFilter,ua as LinearSRGBColorSpace,fu as LinearToneMapping,da as LinearTransfer,rn as Loa
4112der,wh as LoaderUtils,nd as LoadingManager,Yd as LoopOnce,Jd as LoopPingPong,Zd as LoopRepeat,Jv as MOUSE,Gt as Material,jv as MaterialBlending,cc as MaterialLoader,Hy as MathUtils,Nh as Matrix2,qe as Matrix3,Ge as Matrix4,Id as MaxEquation,Ct as Mesh,Li as MeshBasicMaterial,Ku as MeshDepthMaterial,Qu as MeshDistanceMaterial,nm as MeshLambertMaterial,im as MeshMatcapMaterial,tm as MeshNormalMaterial,jp as MeshPhongMaterial,Qp as MeshPhysicalMaterial,$u as MeshStandardMaterial,em as MeshToonMaterial,Rd as MinEquation,aa as MirroredRepeatWrapping,Wd as MixOperation,Cc as MultiplyBlending,ba as MultiplyOperation,wt as NearestFilter,ty as NearestMipMapLinearFilter,ey as NearestMipMapNearestFilter,Os as NearestMipmapLinearFilter,yu as NearestMipmapNearestFilter,vu as NeutralToneMapping,Qd as NeverCompare,Po as NeverDepth,My as NeverStencilFunc,Vn as NoBlending,ni as NoColorSpace,uy as NoNormalPacking,Tn as NoToneMapping,Dl as NormalAnimationBlendMode,ls as NormalBlending,fy as NormalGAPacking,dy as NormalRGPacking,nf as NotEqualCompare,Oo as NotEqualDepth,Ey as NotEqualStencilFunc,xa as NumberKeyframeTrack,ot as Object3D,uM as ObjectLoader,Kd as ObjectSpaceNormalMap,Ca as OctahedronGeometry,Ld as OneFactor,Hd as OneMinusConstantAlphaFactor,kd as OneMinusConstantColorFactor,Fd as OneMinusDstAlphaFactor,Bd as OneMinusDstColorFactor,Io as OneMinusSrcAlphaFactor,Ud as OneMinusSrcColorFactor,Pa as OrthographicCamera,$r as PCFShadowMap,Ad as PCFSoftShadowMap,qh as PMREMGenerator,_l as Path,Ft as PerspectiveCamera,Mi as Plane,tr as PlaneGeometry,VM as PlaneHelper,vm as PointLight,LM as PointLightHelper,cp as Points,Ou as PointsMaterial,NM as PolarGridHelper,Di as PolyhedronGeometry,gM as PositionalAudio,at as PropertyBinding,Nm as PropertyMixer,ku as QuadraticBezierCurve,Gu as QuadraticBezierCurve3,Zt as Quaternion,Ia as QuaternionKeyframeTrack,hm as QuaternionLinearInterpolant,Xo as R11_EAC_Format,la as RED_GREEN_RGTC2_Format,ul as RED_RGTC1_Format,Al as REVISION,oa as RG11_EAC_Format,ly as RGBADepthPacking,qt as RGBAFormat,Ll as RGBAIntegerFormat,rl as RGBA_ASTC_10x10_Format,nl as RGBA_ASTC_10x5_Format,il as RGBA_ASTC_10x6_Format,sl as RGBA_ASTC_10x8_Format,al as RGBA_ASTC_12x10_Format,ol as RGBA_ASTC_12x12_Format,Zo as RGBA_ASTC_4x4_Format,Jo as RGBA_ASTC_5x4_Format,$o as RGBA_ASTC_5x5_Format,Ko as RGBA_ASTC_6x5_Format,Qo as RGBA_ASTC_6x6_Format,jo as RGBA_ASTC_8x5_Format,el as RGBA_ASTC_8x6_Format,tl as RGBA_ASTC_8x8_Format,ll as RGBA_BPTC_Format,Wo as RGBA_ETC2_EAC_Format,ko as RGBA_PVRTC_2BPPV1_Format,Vo as RGBA_PVRTC_4BPPV1_Format,ta as RGBA_S3TC_DXT1_Format,na as RGBA_S3TC_DXT3_Format,ia as RGBA_S3TC_DXT5_Format,cy as RGBDepthPacking,Eu as RGBFormat,sy as RGBIntegerFormat,cl as RGB_BPTC_SIGNED_Format,hl as RGB_BPTC_UNSIGNED_Format,Go as RGB_ETC1_Format,Ho as RGB_ETC2_Format,zo as RGB_PVRTC_2BPPV1_Format,Bo as RGB_PVRTC_4BPPV1_Format,ea as RGB_S3TC_DXT1_Format,hy as RGDepthPacking,Ri as RGFormat,Pl as RGIntegerFormat,Ju as RawShaderMaterial,js as Ray,TM as Raycaster,bm as RectAreaLight,Il as RedFormat,Ta as RedIntegerFormat,pu as ReinhardToneMapping,Iu as RenderTarget,yM as RenderTarget3D,ra as RepeatWrapping,my as ReplaceStencilOp,Cd as ReverseSubtractEquation,ec as RingGeometry,qo as SIGNED_R11_EAC_Format,fl as SIGNED_RED_GREEN_RGTC2_Format,dl as SIGNED_RED_RGTC1_Format,Yo as SIGNED_RG11_EAC_Format,jt as SRGBColorSpace,ct as SRGBTransfer,Of as Scene,je as ShaderChunk,Sn as ShaderLib,pn as ShaderMaterial,Yp as ShadowMaterial,hs as Shape,tc as ShapeGeometry,HM as ShapePath,bn as ShapeUtils,Su as ShortType,Hl as Skeleton,PM as SkeletonHelper,Yf as SkinnedMesh,Ai as Source,Ot as Sphere,Ra as SphereGeometry,EM as Spherical,id as SphericalHarmonics3,Hu as SplineCurve,_m as SpotLight,IM as SpotLightHelper,Hf as Sprite,Uu as SpriteMaterial,Ro as SrcAlphaFactor,zd as SrcAlphaSaturateFactor,Dd as SrcColorFactor,Dy as StaticCopyUsage,fa as StaticDrawUsage,Iy as StaticReadUsage,pM as StereoCamera,Ny as StreamCopyUsage,Ry as StreamDrawUsage,Ly as StreamReadUsage,ys as StringKeyframeTrack,wd as SubtractEquation,wc as SubtractiveBlending,$v as TOUCH,ri as TangentSpaceNormalMap,nc as TetrahedronGeometry,Mt as Texture,hM as TextureLoader,XM as TextureUtils,Im as Timer,Oy as TimestampQuery,ic as TorusGeometry,sc as TorusKnotGeometry,tn as Triangle,oy as TriangleFanDrawMode,ay as TriangleStripDrawMode,ry as TrianglesDrawMode,rc as TubeGeometry,El as UVMapping,Lu as Uint16BufferAttribute,Du as Uint32BufferAttribute,Zy as Uint8BufferAttribute,Jy as Uint8ClampedBufferAttribute,rd as Uniform,MM as UniformsGroup,me as UniformsLib,Jp as UniformsUtils,en as UnsignedByteType,Tu as UnsignedInt101111Type,qs as UnsignedInt248Type,bu as UnsignedInt5999Type,fn as UnsignedIntType,Cl as UnsignedShort4444Type,Rl as UnsignedShort5551Type,Xs as UnsignedShortType,Fs as VSMShadowMap,K as Vector2,C as Vector3,dt as Vector4,va as VectorKeyframeTrack,jy as VideoFrameTexture,hp as VideoTexture,Xy as WebGL3DRenderTarget,Wy as WebGLArrayRenderTarget,ln as WebGLCoordinateSystem,cd as WebGLCubeRen
4112derTarget,cn as WebGLRenderTarget,qM as WebGLRenderer,zv as WebGLUtils,ds as WebGPUCoordinateSystem,Ga as WebXRController,qp as WireframeGeometry,ha as WrapAroundEnding,rs as ZeroCurvatureEnding,Pd as ZeroFactor,as as ZeroSlopeEnding,py as ZeroStencilOp,of as createCanvasElement,Pe as error,Gy as getConsoleFunction,pa as log,ky as setConsoleFunction,de as warn,ml 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.