vendor: 6,989 bytes, lines 1-5
1var SS=Object.defineProperty;var MS=(r,e,t)=>e in r?SS(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var yn=(r,e,t)=>MS(r,typeof e!="symbol"?e+"":e,t);import{r as De,b8 as wS,j as Ct}from"./index-IxvR3ybE.js";/** 2 * @license 3 * Copyright 2010-2025 Three.js Authors 4 * SPDX-License-Identifier: MIT 5 */const wl="177",zs={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ks={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},K0=0,ep=1,Q0=2,ES=3,$0=0,gh=1,qa=2,qi=3,Or=0,si=1,ji=2,hr=0,js=1,tp=2,np=3,ip=4,e_=5,rs=100,t_=101,n_=102,i_=103,r_=104,s_=200,o_=201,a_=202,l_=203,Iu=204,Pu=205,c_=206,u_=207,h_=208,f_=209,d_=210,p_=211,m_=212,g_=213,v_=214,Lu=0,Du=1,Uu=2,Qs=3,Nu=4,Fu=5,Ou=6,Bu=7,El=0,__=1,y_=2,fr=0,x_=1,S_=2,M_=3,Mp=4,w_=5,E_=6,T_=7,rp="attached",b_="detached",ls=300,dr=301,cs=302,Jo=303,rl=304,aa=306,sl=1e3,Cn=1001,ol=1002,kn=1003,wp=1004,TS=1004,Vo=1005,bS=1005,tn=1006,Za=1007,AS=1007,ur=1008,sp=1008,oi=1009,vh=1010,_h=1011,Ko=1012,Tl=1013,pr=1014,pn=1015,Bn=1016,yh=1017,xh=1018,Qo=1020,Ep=35902,Tp=1021,bp=1022,En=1023,$o=1026,ea=1027,bl=1028,Al=1029,Ap=1030,Sh=1031,CS=1032,Mh=1033,ja=33776,Ja=33777,Ka=33778,Qa=33779,zu=35840,ku=35841,Hu=35842,Vu=35843,Gu=36196,Wu=37492,Xu=37496,Yu=37808,qu=37809,Zu=37810,ju=37811,Ju=37812,Ku=37813,Qu=37814,$u=37815,eh=37816,th=37817,nh=37818,ih=37819,rh=37820,sh=37821,$a=36492,oh=36494,ah=36495,Cp=36283,lh=36284,ch=36285,uh=36286,A_=2200,C_=2201,R_=2202,al=2300,hh=2301,bu=2302,Ws=2400,Xs=2401,ll=2402,wh=2500,Rp=2501,RS=0,IS=1,PS=2,I_=3200,P_=3201,LS=3202,DS=3203,hs=0,L_=1,Lr="",ii="srgb",mr="srgb-linear",cl="linear",en="srgb",US=0,Hs=7680,NS=7681,FS=7682,OS=7683,BS=34055,zS=34056,kS=5386,HS=512,VS=513,GS=514,WS=515,XS=516,YS=517,qS=518,op=519,D_=512,U_=513,N_=514,Ip=515,F_=516,O_=517,B_=518,z_=519,ul=35044,ZS=35048,jS=35040,JS=35045,KS=35049,QS=35041,$S=35046,eM=35050,tM=35042,nM="100",ap="300 es",Bi=2e3,hl=2001,iM={COMPUTE:"compute",RENDER:"render"},rM={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},sM={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FLAT_FIRST:"flat first",FLAT_EITHER:"flat either"};let gr=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,o=i.length;s<o;s++)i[s].call(this,e);e.target=null}}};const Yn=["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 Qg=1234567;const Js=Math.PI/180,ta=180/Math.PI;function Ti(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Yn[r&255]+Yn[r>>8&255]+Yn[r>>16&255]+Yn[r>>24&255]+"-"+Yn[e&255]+Yn[e>>8&255]+"-"+Yn[e>>16&15|64]+Yn[e>>24&255]+"-"+Yn[t&63|128]+Yn[t>>8&255]+"-"+Yn[t>>16&255]+Yn[t>>24&255]+Yn[n&255]+Yn[n>>8&255]+Yn[n>>16&255]+Yn[n>>24&255]).toLowerCase()}function Rt(r,e,t){return Math.max(e,Math.min(t,r))}function Pp(r,e){return(r%e+e)%e}function oM(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function aM(r,e,t){return r!==e?(t-r)/(e-r):0}function el(r,e,t){return(1-t)*r+t*e}function lM(r,e,t,n){return el(r,e,1-Math.exp(-t*n))}function cM(r,e=1){return e-Math.abs(Pp(r,e*2)-e)}function uM(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function hM(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function fM(r,e){return r+Math.floor(Math.random()*(e-r+1))}function dM(r,e){return r+Math.random()*(e-r)}function pM(r){return r*(.5-Math.random())}function mM(r){r!==void 0&&(Qg=r);let e=Qg+=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 gM(r){return r*Js}function vM(r){return r*ta}function _M(r){return(r&r-1)===0&&r!==0}function yM(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function xM(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function SM(r,e,t,n,i){const s=Math.cos,o=Math.sin,c=s(t/2),u=o(t/2),h=s((e+n)/2),f=o((e+n)/2),d=s((e-n)/2),m=o((e-n)/2),g=s((n-e)/2),y=o((n-e)/2);switch(i){case"XYX":r.set(c*f,u*d,u*m,c*h);break;case"YZY":r.set(u*m,c*f,u*d,c*h);break;case"ZXZ":r.set(u*d,u*m,c*f,c*h);break;case"XZX":r.set(c*f,u*y,u*g,c*h);break;case"YXY":r.set(u*g,c*f,u*y,c*h);break;case"ZYZ":r.set(u*y,u*g,c*f,c*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function ri(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function Bt(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const MM={DEG2RAD:Js,RAD2DEG:ta,generateUUID:Ti,clamp:Rt,euclideanModulo:Pp,mapLinear:oM,inverseLerp:aM,lerp:el,damp:lM,pingpong:cM,smoothstep:uM,smootherstep:hM,randInt:fM,randFloat:dM,randFloatSpread:pM,seededRandom:mM,degToRad:gM,radToDeg:vM,isPowerOfTwo:_M,ceilPowerOfTwo:yM,floorPowerOfTwo:xM,setQuaternionFromProperEuler:SM,normalize:Bt,de
vendor: 6,070 bytes, line 5
5normalize:ri};class we{constructor(e=0,t=0){we.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Rt(this.x,e.x,t.x),this.y=Rt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Rt(this.x,e,t),this.y=Rt(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Rt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Rt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*i+e.x,this.y=s*i+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class jn{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,s,o,c){let u=n[i+0],h=n[i+1],f=n[i+2],d=n[i+3];const m=s[o+0],g=s[o+1],y=s[o+2],M=s[o+3];if(c===0){e[t+0]=u,e[t+1]=h,e[t+2]=f,e[t+3]=d;return}if(c===1){e[t+0]=m,e[t+1]=g,e[t+2]=y,e[t+3]=M;return}if(d!==M||u!==m||h!==g||f!==y){let x=1-c;const v=u*m+h*g+f*y+d*M,w=v>=0?1:-1,E=1-v*v;if(E>Number.EPSILON){const U=Math.sqrt(E),I=Math.atan2(U,v*w);x=Math.sin(x*I)/U,c=Math.sin(c*I)/U}const T=c*w;if(u=u*x+m*T,h=h*x+g*T,f=f*x+y*T,d=d*x+M*T,x===1-c){const U=1/Math.sqrt(u*u+h*h+f*f+d*d);u*=U,h*=U,f*=U,d*=U}}e[t]=u,e[t+1]=h,e[t+2]=f,e[t+3]=d}static multiplyQuaternionsFlat(e,t,n,i,s,o){const c=n[i],u=n[i+1],h=n[i+2],f=n[i+3],d=s[o],m=s[o+1],g=s[o+2],y=s[o+3];return e[t]=c*y+f*d+u*g-h*m,e[t+1]=u*y+f*m+h*d-c*g,e[t+2]=h*y+f*g+c*m-u*d,e[t+3]=f*y-c*d-u*m-h*g,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,s=e._z,o=e._order,c=Math.cos,u=Math.sin,h=c(n/2),f=c(i/2),d=c(s/2),m=u(n/2),g=u(i/2),y=u(s/2);switch(o){case"XYZ":this._x=m*f*d+h*g*y,this._y=h*g*d-m*f*y,this._z=h*f*y+m*g*d,this._w=h*f*d-m*g*y;break;case"YXZ":this._x=m*f*d+h*g*y,this._y=h*g*d-m*f*y,this._z=h*f*y-m*g*d,this._w=h*f*d+m*g*y;break;case"ZXY":this._x=m*f*d-h*g*y,this._y=h*g*d+m*f*y,this._z=h*f*y+m*g*d,this._w=h*f*d-m*g*y;break;case"ZYX":this._x=m*f*d-h*g*y,this._y=h*g*d+m*f*y,this._z=h*f*y-m*g*d,this._w=h*f*d+m*g*y;break;case"YZX":this._x=m*f*d+h*g*y,this._y=h*g*d+m*f*y,this._z=h*f*y-m*g*d,this._w=h*f*d-m*g*y;break;case"XZY":this._x=m*f*d-h*g*y,this._y=h*g*d-m*f*y,this._z=h*f*y+m*g*d,this._w=h*f*d+m*g*y;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],o=t[1],c=t[5],u=t[9],h=t[2],f=t[6],d=t[10],m=n+c+d;if(m>0){const g=.5/Math.sqrt(m+1);this._w=.25/g,this._x=(f-u)*g,this._y=(s-h)*g,this._z=(o-i)*g}else if(n>c&&n>d){const g=2*Math.sqrt(1+n-c-d);
vendor: 4,140 bytes, line 5
5this._w=(f-u)/g,this._x=.25*g,this._y=(i+o)/g,this._z=(s+h)/g}else if(c>d){const g=2*Math.sqrt(1+c-n-d);this._w=(s-h)/g,this._x=(i+o)/g,this._y=.25*g,this._z=(u+f)/g}else{const g=2*Math.sqrt(1+d-n-c);this._w=(o-i)/g,this._x=(s+h)/g,this._y=(u+f)/g,this._z=.25*g}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(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(Rt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,s=e._z,o=e._w,c=t._x,u=t._y,h=t._z,f=t._w;return this._x=n*f+o*c+i*h-s*u,this._y=i*f+o*u+s*c-n*h,this._z=s*f+o*h+n*u-i*c,this._w=o*f-n*c-i*u-s*h,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,s=this._z,o=this._w;let c=o*e._w+n*e._x+i*e._y+s*e._z;if(c<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,c=-c):this.copy(e),c>=1)return this._w=o,this._x=n,this._y=i,this._z=s,this;const u=1-c*c;if(u<=Number.EPSILON){const g=1-t;return this._w=g*o+t*this._w,this._x=g*n+t*this._x,this._y=g*i+t*this._y,this._z=g*s+t*this._z,this.normalize(),this}const h=Math.sqrt(u),f=Math.atan2(h,c),d=Math.sin((1-t)*f)/h,m=Math.sin(t*f)/h;return this._w=o*d+this._w*m,this._x=n*d+this._x*m,this._y=i*d+this._y*m,this._z=s*d+this._z*m,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class B{constructor(e=0,t=0,n=0){B.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}
vendor: 9,633 bytes, line 5
5sub(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($g.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion($g.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,o=e.y,c=e.z,u=e.w,h=2*(o*i-c*n),f=2*(c*t-s*i),d=2*(s*n-o*t);return this.x=t+u*h+o*d-c*f,this.y=n+u*f+c*h-s*d,this.z=i+u*d+s*f-o*h,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Rt(this.x,e.x,t.x),this.y=Rt(this.y,e.y,t.y),this.z=Rt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Rt(this.x,e,t),this.y=Rt(this.y,e,t),this.z=Rt(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Rt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,o=t.x,c=t.y,u=t.z;return this.x=i*u-s*c,this.y=s*o-n*u,this.z=n*c-i*o,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 $f.copy(this).projectOnVector(e),this.sub($f)}reflect(e){return this.sub($f.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(Rt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const $f=new B,$g=new jn;class Ut{constructor(e,t,n,i,s,o,c,u,h){Ut.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,o,c,u,h)}set(e,t,n,i,s,o,c,u,h){const f=this.elements;return f[0]=e,f[1]=i,f[2]=c,f[3]=t,f[4]=s,f[5]=u,f[6]=n,f[7]=o,f[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,o=n[0],c=n[3],u=n[6],h=n[1],f=n[4],d=n[7],m=n[2],g=n[5],y=n[8],M=i[0],x=i[3],v=i[6],w=i[1],E=i[4],T=i[7],U=i[2],I=i[5],N=i[8];return s[0]=o*M+c*w+u*U,s[3]=o*x+c*E+u*I,s[6]=o*v+c*T+u*N,s[1]=h*M+f*w+d*U,s[4]=h*x+f*E+d*I,s[7]=h*v+f*T+d*N,s[2]=m*M+g*w+y*U,s[5]=m*x+g*E+y*I,s[8]=m*v+g*T+y*N,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],c=e[5],u=e[6],h=e[7],f=e[8];return t*o*f-t*c*h-n*s*f+n*c*u+i*s*h-i*o*u}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],c=e[5],u=e[6],h=e[7],f=e[8],d=f*o-c*h,m=c*u-f*s,g=h*s-o*u,y=t*d+n*m+i*g;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const M=1/y;return e[0]=d*M,e[1]=(i*h-f*n)*M,e[2]=(c*n-i*o)*M,e[3]=m*M,e[4]=(f*t-i*u)*M,e[5]=(i*s-c*t)*M,e[6]=g*M,e[7]=(n*u-h*t)*M,e[8]=(o*t-n*s)*M,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,o,c){const u=Math.cos(s),h=Math.sin(s);return this.set(n*u,n*h,-n*(u*o+h*c)+o+e,-i*h,i*u,-i*(-h*o+u*c)+c+t,0,0,1),this}scale(e,t){return this.premultiply(ed.makeScale(e,t)),this}rotate(e){return this.premultiply(ed.makeRotation(-e)),this}translate(e,t){return this.premultiply(ed.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const ed=new Ut;function k_(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const wM={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Go(r,e){return new wM[r](e)}function fl(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function H_(){const r=fl("canvas");return r.style.display="block",r}const ev={};function qo(r){r in ev||(ev[r]=!0,console.warn(r))}function EM(r,e,t){return new Promise(function(n,i){function s(){switch(r.clientWaitSync(e,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}function TM(r){const e=r.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function bM(r){const e=r.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const tv=new Ut().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),nv=new Ut().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.20397
vendor: 24,550 bytes, line 5
57,1.0569715);function AM(){const r={enabled:!0,workingColorSpace:mr,spaces:{},convert:function(i,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===en&&(i.r=Nr(i.r),i.g=Nr(i.g),i.b=Nr(i.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===en&&(i.r=Zo(i.r),i.g=Zo(i.g),i.b=Zo(i.b))),i},workingToColorSpace:function(i,s){return this.convert(i,this.workingColorSpace,s)},colorSpaceToWorking:function(i,s){return this.convert(i,s,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===Lr?cl:this.spaces[i].transfer},getLuminanceCoefficients:function(i,s=this.workingColorSpace){return i.fromArray(this.spaces[s].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,s,o){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,s){return qo("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return qo("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(i,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[mr]:{primaries:e,whitePoint:n,transfer:cl,toXYZ:tv,fromXYZ:nv,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:ii},outputColorSpaceConfig:{drawingBufferColorSpace:ii}},[ii]:{primaries:e,whitePoint:n,transfer:en,toXYZ:tv,fromXYZ:nv,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:ii}}}),r}const qt=AM();function Nr(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Zo(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let So;class V_{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{So===void 0&&(So=fl("canvas")),So.width=e.width,So.height=e.height;const i=So.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=So}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=fl("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let o=0;o<s.length;o++)s[o]=Nr(s[o]/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(Nr(t[n]/255)*255):t[n]=Nr(t[n]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let CM=0;class ss{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:CM++}),this.uuid=Ti(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let o=0,c=i.length;o<c;o++)i[o].isDataTexture?s.push(td(i[o].image)):s.push(td(i[o]))}else s=td(i);n.url=s}return t||(e.images[this.uuid]=n),n}}function td(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?V_.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let RM=0;const nd=new B;class sn extends gr{constructor(e=sn.DEFAULT_IMAGE,t=sn.DEFAULT_MAPPING,n=Cn,i=Cn,s=tn,o=ur,c=En,u=oi,h=sn.DEFAULT_ANISOTROPY,f=Lr){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:RM++}),this.uuid=Ti(),this.name="",this.source=new ss(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=o,this.anisotropy=h,this.format=c,this.internalFormat=null,this.type=u,this.offset=new we(0,0),this.repeat=new we(1,1),this.center=new we(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ut,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=f,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(nd).x}get height(){return this.source.getSize(nd).y}get depth(){return this.source.getSize(nd).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==ls)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case sl:e.x=e.x-Math.floor(e.x);break;case Cn:e.x=e.x<0?0:1;break;case ol: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 sl:e.y=e.y-Math.floor(e.y);break;case Cn:e.y=e.y<0?0:1;break;case ol: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++}}sn.DEFAULT_IMAGE=null;sn.DEFAULT_MAPPING=ls;sn.DEFAULT_ANISOTROPY=1;class jt{constructor(e=0,t=0,n=0,i=1){jt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*i+o[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,s;const u=e.elements,h=u[0],f=u[4],d=u[8],m=u[1],g=u[5],y=u[9],M=u[2],x=u[6],v=u[10];if(Math.abs(f-m)<.01&&Math.abs(d-M)<.01&&Math.abs(y-x)<.01){if(Math.abs(f+m)<.1&&Math.abs(d+M)<.1&&Math.abs(y+x)<.1&&Math.abs(h+g+v-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const E=(h+1)/2,T=(g+1)/2,U=(v+1)/2,I=(f+m)/4,N=(d+M)/4,D=(y+x)/4;return E>T&&E>U?E<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(E),i=I/n,s=N/n):T>U?T<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(T),n=I/i,s=D/i):U<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(U),n=N/s,i=D/s),this.set(n,i,s,t),this}let w=Math.sqrt((x-y)*(x-y)+(d-M)*(d-M)+(m-f)*(m-f));return Math.abs(w)<.001&&(w=1),this.x=(x-y)/w,this.y=(d-M)/w,this.z=(m-f)/w,this.w=Math.acos((h+g+v-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=Rt(this.x,e.x,t.x),this.y=Rt(this.y,e.y,t.y),this.z=Rt(this.z,e.z,t.z),this.w=Rt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Rt(this.x,e,t),this.y=Rt(this.y,e,t),this.z=Rt(this.z,e,t),this.w=Rt(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Rt(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Lp extends gr{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:tn,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 jt(0,0,e,t),this.scissorTest=!1,this.viewport=new jt(0,0,e,t);const i={width:e,height:t,depth:n.depth},s=new sn(i);this.textures=[];const o=n.count;for(let c=0;c<o;c++)this.textures[c]=s.clone(),this.textures[c].isRenderTargetTexture=!0,this.textures[c].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:tn,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,s=this.textures.length;i<s;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,this.textures[i].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 ss(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class zi extends Lp{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Eh extends sn{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=kn,this.minFilter=kn,this.wrapR=Cn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class IM extends zi{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new Eh(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class Th extends sn{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=kn,this.minFilter=kn,this.wrapR=Cn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class PM extends zi{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new Th(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class Jn{constructor(e=new B(1/0,1/0,1/0),t=new B(-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(Gi.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Gi.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=Gi.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,c=s.count;o<c;o++)e.isMesh===!0?e.getVertexPosition(o,Gi):Gi.fromBufferAttribute(s,o),Gi.applyMatrix4(e.matrixWorld),this.expandByPoint(Gi);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Ic.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),Ic.copy(n.boundingBox)),Ic.applyMatrix4(e.matrixWorld),this.union(Ic)}const i=e.children;for(let s=0,o=i.length;s<o;s++)this.expandByObject(i[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Gi),Gi.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(Ca),Pc.subVectors(this.max,Ca),Mo.subVectors(e.a,Ca),wo.subVectors(e.b,Ca),Eo.subVectors(e.c,Ca),jr.subVectors(wo,Mo),Jr.subVectors(Eo,wo),Ts.subVectors(Mo,Eo);let t=[0,-jr.z,jr.y,0,-Jr.z,Jr.y,0,-Ts.z,Ts.y,jr.z,0,-jr.x,Jr.z,0,-Jr.x,Ts.z,0,-Ts.x,-jr.y,jr.x,0,-Jr.y,Jr.x,0,-Ts.y,Ts.x,0];return!id(t,Mo,wo,Eo,Pc)||(t=[1,0,0,0,1,0,0,0,1],!id(t,Mo,wo,Eo,Pc))?!1:(Lc.crossVectors(jr,Jr),t=[Lc.x,Lc.y,Lc.z],id(t,Mo,wo,Eo,Pc))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Gi).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Gi).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:(Tr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Tr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Tr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Tr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Tr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Tr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Tr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Tr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Tr),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 Tr=[new B,new B,new B,new B,new B,new B,new B,new B],Gi=new B,Ic=new Jn,Mo=new B,wo=new B,Eo=new B,jr=new B,Jr=new B,Ts=new B,Ca=new B,Pc=new B,Lc=new B,bs=new B;function id(r,e,t,n,i){for(let s=0,o=r.length-3;s<=o;s+=3){bs.fromArray(r,s);const c=i.x*Math.abs(bs.x)+i.y*Math.abs(bs.y)+i.z*Math.abs(bs.z),u=e.dot(bs),h=t.dot(bs),f=n.dot(bs);if(Math.max(-Math.max(u,h,f),Math.min(u,h,f))>c)return!1}return!0}const LM=new Jn,Ra=new B,rd=new B;class Hn{constructor(e=new B,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):LM.setFromPoints(e).getCenter(n);let i=0;for(let s=0,o=e.length;s<o;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}
vendor: 18,155 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;Ra.subVectors(e,this.center);const t=Ra.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Ra,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):(rd.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ra.copy(e.center).add(rd)),this.expandByPoint(Ra.copy(e.center).sub(rd))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}const br=new B,sd=new B,Dc=new B,Kr=new B,od=new B,Uc=new B,ad=new B;class to{constructor(e=new B,t=new B(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,br)),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=br.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(br.copy(this.origin).addScaledVector(this.direction,t),br.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){sd.copy(e).add(t).multiplyScalar(.5),Dc.copy(t).sub(e).normalize(),Kr.copy(this.origin).sub(sd);const s=e.distanceTo(t)*.5,o=-this.direction.dot(Dc),c=Kr.dot(this.direction),u=-Kr.dot(Dc),h=Kr.lengthSq(),f=Math.abs(1-o*o);let d,m,g,y;if(f>0)if(d=o*u-c,m=o*c-u,y=s*f,d>=0)if(m>=-y)if(m<=y){const M=1/f;d*=M,m*=M,g=d*(d+o*m+2*c)+m*(o*d+m+2*u)+h}else m=s,d=Math.max(0,-(o*m+c)),g=-d*d+m*(m+2*u)+h;else m=-s,d=Math.max(0,-(o*m+c)),g=-d*d+m*(m+2*u)+h;else m<=-y?(d=Math.max(0,-(-o*s+c)),m=d>0?-s:Math.min(Math.max(-s,-u),s),g=-d*d+m*(m+2*u)+h):m<=y?(d=0,m=Math.min(Math.max(-s,-u),s),g=m*(m+2*u)+h):(d=Math.max(0,-(o*s+c)),m=d>0?s:Math.min(Math.max(-s,-u),s),g=-d*d+m*(m+2*u)+h);else m=o>0?-s:s,d=Math.max(0,-(o*m+c)),g=-d*d+m*(m+2*u)+h;return n&&n.copy(this.origin).addScaledVector(this.direction,d),i&&i.copy(sd).addScaledVector(Dc,m),g}intersectSphere(e,t){br.subVectors(e.center,this.origin);const n=br.dot(this.direction),i=br.dot(br)-n*n,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),c=n-o,u=n+o;return u<0?null:c<0?this.at(u,t):this.at(c,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,o,c,u;const h=1/this.direction.x,f=1/this.direction.y,d=1/this.direction.z,m=this.origin;return h>=0?(n=(e.min.x-m.x)*h,i=(e.max.x-m.x)*h):(n=(e.max.x-m.x)*h,i=(e.min.x-m.x)*h),f>=0?(s=(e.min.y-m.y)*f,o=(e.max.y-m.y)*f):(s=(e.max.y-m.y)*f,o=(e.min.y-m.y)*f),n>o||s>i||((s>n||isNaN(n))&&(n=s),(o<i||isNaN(i))&&(i=o),d>=0?(c=(e.min.z-m.z)*d,u=(e.max.z-m.z)*d):(c=(e.max.z-m.z)*d,u=(e.min.z-m.z)*d),n>u||c>i)||((c>n||n!==n)&&(n=c),(u<i||i!==i)&&(i=u),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,br)!==null}intersectTriangle(e,t,n,i,s){od.subVectors(t,e),Uc.subVectors(n,e),ad.crossVectors(od,Uc);let o=this.direction.dot(ad),c;if(o>0){if(i)return null;c=1}else if(o<0)c=-1,o=-o;else return null;Kr.subVectors(this.origin,e);const u=c*this.direction.dot(Uc.crossVectors(Kr,Uc));if(u<0)return null;const h=c*this.direction.dot(od.cross(Kr));if(h<0||u+h>o)return null;const f=-c*Kr.dot(ad);return f<0?null:this.at(f/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class bt{constructor(e,t,n,i,s,o,c,u,h,f,d,m,g,y,M,x){bt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,o,c,u,h,f,d,m,g,y,M,x)}set(e,t,n,i,s,o,c,u,h,f,d,m,g,y,M,x){const v=this.elements;return v[0]=e,v[4]=t,v[8]=n,v[12]=i,v[1]=s,v[5]=o,v[9]=c,v[13]=u,v[2]=h,v[6]=f,v[10]=d,v[14]=m,v[3]=g,v[7]=y,v[11]=M,v[15]=x,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 bt().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 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){const t=this.elements,n=e.elements,i=1/To.setFromMatrixColumn(e,0).length(),s=1/To.setFromMatrixColumn(e,1).length(),o=1/To.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,s=e.z,o=Math.cos(n),c=Math.sin(n),u=Math.cos(i),h=Math.sin(i),f=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){const m=o*f,g=o*d,y=c*f,M=c*d;t[0]=u*f,t[4]=-u*d,t[8]=h,t[1]=g+y*h,t[5]=m-M*h,t[9]=-c*u,t[2]=M-m*h,t[6]=y+g*h,t[10]=o*u}else if(e.order==="YXZ"){const m=u*f,g=u*d,y=h*f,M=h*d;t[0]=m+M*c,t[4]=y*c-g,t[8]=o*h,t[1]=o*d,t[5]=o*f,t[9]=-c,t[2]=g*c-y,t[6]=M+m*c,t[10]=o*u}else if(e.order==="ZXY"){const m=u*f,g=u*d,y=h*f,M=h*d;t[0]=m-M*c,t[4]=-o*d,t[8]=y+g*c,t[1]=g+y*c,t[5]=o*f,t[9]=M-m*c,t[2]=-o*h,t[6]=c,t[10]=o*u}else if(e.order==="ZYX"){const m=o*f,g=o*d,y=c*f,M=c*d;t[0]=u*f,t[4]=y*h-g,t[8]=m*h+M,t[1]=u*d,t[5]=M*h+m,t[9]=g*h-y,t[2]=-h,t[6]=c*u,t[10]=o*u}else if(e.order==="YZX"){const m=o*u,g=o*h,y=c*u,M=c*h;t[0]=u*f,t[4]=M-m*d,t[8]=y*d+g,t[1]=d,t[5]=o*f,t[9]=-c*f,t[2]=-h*f,t[6]=g*d+y,t[10]=m-M*d}else if(e.order==="XZY"){const m=o*u,g=o*h,y=c*u,M=c*h;t[0]=u*f,t[4]=-d,t[8]=h*f,t[1]=m*d+M,t[5]=o*f,t[9]=g*d-y,t[2]=y*d-g,t[6]=c*f,t[10]=M*d+m}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(DM,e,UM)}lookAt(e,t,n){const i=this.elements;return Mi.subVectors(e,t),Mi.lengthSq()===0&&(Mi.z=1),Mi.normalize(),Qr.crossVectors(n,Mi),Qr.lengthSq()===0&&(Math.abs(n.z)===1?Mi.x+=1e-4:Mi.z+=1e-4,Mi.normalize(),Qr.crossVectors(n,Mi)),Qr.normalize(),Nc.crossVectors(Mi,Qr),i[0]=Qr.x,i[4]=Nc.x,i[8]=Mi.x,i[1]=Qr.y,i[5]=Nc.y,i[9]=Mi.y,i[2]=Qr.z,i[6]=Nc.z,i[10]=Mi.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,o=n[0],c=n[4],u=n[8],h=n[12],f=n[1],d=n[5],m=n[9],g=n[13],y=n[2],M=n[6],x=n[10],v=n[14],w=n[3],E=n[7],T=n[11],U=n[15],I=i[0],N=i[4],D=i[8],C=i[12],A=i[1],F=i[5],j=i[9],Z=i[13],$=i[2],ae=i[6],ne=i[10],xe=i[14],k=i[3],ee=i[7],Q=i[11],fe=i[15];return s[0]=o*I+c*A+u*$+h*k,s[4]=o*N+c*F+u*ae+h*ee,s[8]=o*D+c*j+u*ne+h*Q,s[12]=o*C+c*Z+u*xe+h*fe,s[1]=f*I+d*A+m*$+g*k,s[5]=f*N+d*F+m*ae+g*ee,s[9]=f*D+d*j+m*ne+g*Q,s[13]=f*C+d*Z+m*xe+g*fe,s[2]=y*I+M*A+x*$+v*k,s[6]=y*N+M*F+x*ae+v*ee,s[10]=y*D+M*j+x*ne+v*Q,s[14]=y*C+M*Z+x*xe+v*fe,s[3]=w*I+E*A+T*$+U*k,s[7]=w*N+E*F+T*ae+U*ee,s[11]=w*D+E*j+T*ne+U*Q,s[15]=w*C+E*Z+T*xe+U*fe,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],o=e[1],c=e[5],u=e[9],h=e[13],f=e[2],d=e[6],m=e[10],g=e[14],y=e[3],M=e[7],x=e[11],v=e[15];return y*(+s*u*d-i*h*d-s*c*m+n*h*m+i*c*g-n*u*g)+M*(+t*u*g-t*h*m+s*o*m-i*o*g+i*h*f-s*u*f)+x*(+t*h*d-t*c*g-s*o*d+n*o*g+s*c*f-n*h*f)+v*(-i*c*f-t*u*d+t*c*m+i*o*d-n*o*m+n*u*f)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],c=e[5],u=e[6],h=e[7],f=e[8],d=e[9],m=e[10],g=e[11],y=e[12],M=e[13],x=e[14],v=e[15],w=d*x*h-M*m*h+M*u*g-c*x*g-d*u*v+c*m*v,E=y*m*h-f*x*h-y*u*g+o*x*g+f*u*v-o*m*v,T=f*M*h-y*d*h+y*c*g-o*M*g-f*c*v+o*d*v,U=y*d*u-f*M*u-y*c*m+o*M*m+f*c*x-o*d*x,I=t*w+n*E+i*T+s*U;if(I===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const N=1/I;return e[0]=w*N,e[1]=(M*m*s-d*x*s-M*i*g+n*x*g+d*i*v-n*m*v)*N,e[2]=(c*x*s-M*u*s+M*i*h-n*x*h-c*i*v+n*u*v)*N,e[3]=(d*u*s-c*m*s-d*i*h+n*m*h+c*i*g-n*u*g)*N,e[4]=E*N,e[5]=(f*x*s-y*m*s+y*i*g-t*x*g-f*i*v+t*m*v)*N,e[6]=(y*u*s-o*x*s-y*i*h+t*x*h+o*i*v-t*u*v)*N,e[7]=(o*m*s-f*u*s+f*i*h-t*m*h-o*i*g+t*u*g)*N,e[8]=T*N,e[9]=(y*d*s-f*M*s-y*n*g+t*M*g+f*n*v-t*d*v)*N,e[10]=(o*M*s-y*c*s+y*n*h-t*M*h-o*n*v+t*c*v)*N,e[11]=(f*c*s-o*d*s-f*n*h+t*d*h+o*n*g-t*c*g)*N,e[12]=U*N,e[13]=(f*M*i-y*d*i+y*n*m-t*M*m-f*n*x+t*d*x)*N,e[14]=(y*c*i-o*M*i-y*n*u+t*M*u+o*n*x-t*c*x)*N,e[15]=(o*d*i-f*c*i+f*n*u-t*d*u-o*n*m+t*c*m)*N,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,o=e.x,c=e.y,u=e.z,h=s*o,f=s*c;return this.set(h*o+n,h*c-i*u,h*u+i*c,0,h*c+i*u,f*c+n,f*u-i*o,0,h*u-i*c,f*u+i*o,s*u*u+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,o){return this.set(1,n,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,o=t._y,c=t._z,u=t._w,h=s+s,f=o+o,d=c+c,m=s*h,g=s*f,y=s*d,M=o*f,x=o*d,v=c*d,w=u*h,E=u*f,T=u*d,U=n.x,I=n.y,N=n.z;return i[0]=(1-(M+v))*U,i[1]=(g+T)*U,i[2]=(y-E)*U,i[3]=0,i[4]=(g-T)*I,i[5]=(1-(m+v))*I,i[6]=(x+w)*I,i[7]=0,i[8]=(y+E)*N,i[9]=(x-w)*N,i[10]=(1-(m+M))*N,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;let s=To.set(i[0],i[1],i[2]).length();const o=To.set(i[4],i[5],i[6]).length(),c=To.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],Wi.copy(this);const h=1/s,f=1/o,d=1/c;return Wi.elements[0]*=h,Wi.elements[1]*=h,Wi.elements[2]*=h,Wi.elements[4]*=f,Wi.elements[5]*=f,Wi.elements[6]*=f,Wi.elements[8]*=d,Wi.elements[9]*=d,Wi.elements[10]*=d,t.setFromRotationMatrix(Wi),n.x=s,n.y=o,n.z=c,this}makePerspective(e,t,n,i,s,o,c=Bi){const u=this.elements,h=2*s/(t-e),f=2*s/(n-i),d=(t+e)/(t-e),m=(n+i)/(n-i);let g,y;if(c===Bi)g=-(o+s)/(o-s),y=-2*o*s/(o-s);else if(c===hl)g=-o/(o-s),y=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+c);return u[0]=h,u[4]=0,u[8]=d,u[12]=0,u[1]=0,u[5]=f,u[9]=m,u[13]=0,u[2]=0,u[6]=0,u[10]=g,u[14]=y,u[3]=0,u[7]=0,u[11]=-1,u[15]=0,this}makeOrthographic(e,t,n,i,s,o,c=Bi){const u=this.elements,h=1/(t-e),f=1/(n-i),d=1/(o-s),m=(t+e)*h,g=(n+i)*f;let y,M;if(c===Bi)y=(o+s)*d,M=-2*d;else if(c===hl)y=s*d,M=-1*d;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+c);return u[0]=2*h,u[4]=0,u[8]=0,u[12]=-m,u[1]=0,u[5]=2*f,u[9]=0,u[13]=-g,u[2]=0,u[6]=0,u[10]=M,u[14]=-y,u[3]=0,u[7]=0,u[11]=0,u[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const To=new B,Wi=new bt,DM=new B(0,0,0),UM=new B(1,1,1),Qr=new B,Nc=new B,Mi=new B,iv=new bt,rv=new jn;class Ai{constructor(e=0,t=0,n=0,i=Ai.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,s=i[0],o=i[4],c=i[8],u=i[1],h=i[5],f=i[9],d=i[2],m=i[6],g=i[10];switch(t){case"XYZ":this._y=Math.asin(Rt(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-f,g),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(m,h),this._z=0);break;case"YXZ":this._x=Math.asin(-Rt(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(c,g),this._z=Math.atan2(u,h)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(Rt(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-d,g),this._z=Math.atan2(-o,h)):(this._y=0,this._z=Math.atan2(u,s));break;case"ZYX":this._y=Math.asin(-Rt(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(m,g),this._z=Math.atan2(u,s)):(this._x=0,this._z=Math.atan2(-o,h));break;case"YZX":this._z=Math.asin(Rt(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-f,h),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(c,g));break;case"XZY":this._z=Math.asin(-Rt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(m,h),this._y=Math.atan2(c,s)):(this._x=Math.atan2(-f,g),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return iv.makeRotationFromQuaternion(e),this.setFromRotationMatrix(iv,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return rv.setFromEuler(this),this.setFromQuaternion(rv,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}}Ai.DEFAULT_ORDER="XYZ";class Ks{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 NM=0;const sv=new B,bo=new jn,Ar=new bt,Fc=new B,Ia=new B,FM=new B,OM=new jn,ov=new B(1,0,0),av=new B(0,1,0),lv=new B(0,0,1),cv={type:"added"},BM={type:"removed"},Ao={type:"childadded",child:null},ld={type:"childremoved",child:null};class Jt extends gr{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:NM++}),this.uuid=Ti(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Jt.DEFAULT_UP.clone();const e=new B,t=new Ai,n=new jn,i=new B(1,1,1);function s(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(o),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 bt},normalMatrix:{value:new Ut}}),this.matrix=new bt,this.matrixWorld=new bt,this.matrixAutoUpdate=Jt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Jt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Ks,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}
vendor: 4,289 bytes, line 5
5setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return bo.setFromAxisAngle(e,t),this.quaternion.multiply(bo),this}rotateOnWorldAxis(e,t){return bo.setFromAxisAngle(e,t),this.quaternion.premultiply(bo),this}rotateX(e){return this.rotateOnAxis(ov,e)}rotateY(e){return this.rotateOnAxis(av,e)}rotateZ(e){return this.rotateOnAxis(lv,e)}translateOnAxis(e,t){return sv.copy(e).applyQuaternion(this.quaternion),this.position.add(sv.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(ov,e)}translateY(e){return this.translateOnAxis(av,e)}translateZ(e){return this.translateOnAxis(lv,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Ar.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Fc.copy(e):Fc.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Ia.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ar.lookAt(Ia,Fc,this.up):Ar.lookAt(Fc,Ia,this.up),this.quaternion.setFromRotationMatrix(Ar),i&&(Ar.extractRotation(i.matrixWorld),bo.setFromRotationMatrix(Ar),this.quaternion.premultiply(bo.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(cv),Ao.child=e,this.dispatchEvent(Ao),Ao.child=null):console.error("THREE.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(BM),ld.child=e,this.dispatchEvent(ld),ld.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),Ar.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Ar.multiply(e.parent.matrixWorld)),e.applyMatrix4(Ar),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(cv),Ao.child=e,this.dispatchEvent(Ao),Ao.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 o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let s=0,o=i.length;s<o;s++)i[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ia,e,FM),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ia,OM,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix
vendor: 5,837 bytes, line 5
5):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const i=this.children;for(let s=0,o=i.length;s<o;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(c=>({...c,boundingBox:c.boundingBox?c.boundingBox.toJSON():void 0,boundingSphere:c.boundingSphere?c.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(c=>({...c})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function s(c,u){return c[u.uuid]===void 0&&(c[u.uuid]=u.toJSON(e)),u.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){const u=c.shapes;if(Array.isArray(u))for(let h=0,f=u.length;h<f;h++){const d=u[h];s(e.shapes,d)}else s(e.shapes,u)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const c=[];for(let u=0,h=this.material.length;u<h;u++)c.push(s(e.materials,this.material[u]));i.material=c}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let c=0;c<this.children.length;c++)i.children.push(this.children[c].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let c=0;c<this.animations.length;c++){const u=this.animations[c];i.animations.push(s(e.animations,u))}}if(t){const c=o(e.geometries),u=o(e.materials),h=o(e.textures),f=o(e.images),d=o(e.shapes),m=o(e.skeletons),g=o(e.animations),y=o(e.nodes);c.length>0&&(n.geometries=c),u.length>0&&(n.materials=u),h.length>0&&(n.textures=h),f.length>0&&(n.images=f),d.length>0&&(n.shapes=d),m.length>0&&(n.skeletons=m),g.length>0&&(n.animations=g),y.length>0&&(n.nodes=y)}return n.object=i,n;function o(c){const u=[];for(const h in c){const f=c[h];delete f.metadata,u.push(f)}return u}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}Jt.DEFAULT_UP=new B(0,1,0);Jt.DEFAULT_MATRIX_AUTO_UPDATE=!0;Jt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Xi=new B,Cr=new B,cd=new B,Rr=new B,Co=new B,Ro=new B,uv=new B,ud=new B,hd=new B,fd=new B,dd=new jt,pd=new jt,md=new jt;class mi{constructor(e=new B,t=new B,n=new B){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Xi.subVectors(e,t),i.cross(Xi);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){Xi.subVectors(i,t),Cr.subVectors(n,t),cd.subVectors(e,t);const o=Xi.dot(Xi),c=Xi.dot(Cr),u=Xi.dot(cd),h=Cr.dot(Cr),f=Cr.dot(cd),d=o*h-c*c;if(d===0)return s.set(0,0,0),null;const m=1/d,g=(h*u-c*f)*m,y=(o*f-c*u)*m;return s.set(1-g-y,y,g)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Rr)===null?!1:Rr.x>=0&&Rr.y>=0&&Rr.x+Rr.y<=1}static getInterpolation(e,t,n,i,s,o,c,u){return this.getBarycoord(e,t,n,i,Rr)===null?(u.x=0,u.y=0,"z"in u&&(u.z=0),"w"in u&&(u.w=0),null):(u.setScalar(0),u.addScaledVector(s,Rr.x),u.addScaledVector(o,Rr.y
vendor: 5,843 bytes, line 5
5),u.addScaledVector(c,Rr.z),u)}static getInterpolatedAttribute(e,t,n,i,s,o){return dd.setScalar(0),pd.setScalar(0),md.setScalar(0),dd.fromBufferAttribute(e,t),pd.fromBufferAttribute(e,n),md.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(dd,s.x),o.addScaledVector(pd,s.y),o.addScaledVector(md,s.z),o}static isFrontFacing(e,t,n,i){return Xi.subVectors(n,t),Cr.subVectors(e,t),Xi.cross(Cr).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 Xi.subVectors(this.c,this.b),Cr.subVectors(this.a,this.b),Xi.cross(Cr).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return mi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return mi.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,s){return mi.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return mi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return mi.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let o,c;Co.subVectors(i,n),Ro.subVectors(s,n),ud.subVectors(e,n);const u=Co.dot(ud),h=Ro.dot(ud);if(u<=0&&h<=0)return t.copy(n);hd.subVectors(e,i);const f=Co.dot(hd),d=Ro.dot(hd);if(f>=0&&d<=f)return t.copy(i);const m=u*d-f*h;if(m<=0&&u>=0&&f<=0)return o=u/(u-f),t.copy(n).addScaledVector(Co,o);fd.subVectors(e,s);const g=Co.dot(fd),y=Ro.dot(fd);if(y>=0&&g<=y)return t.copy(s);const M=g*h-u*y;if(M<=0&&h>=0&&y<=0)return c=h/(h-y),t.copy(n).addScaledVector(Ro,c);const x=f*y-g*d;if(x<=0&&d-f>=0&&g-y>=0)return uv.subVectors(s,i),c=(d-f)/(d-f+(g-y)),t.copy(i).addScaledVector(uv,c);const v=1/(x+M+m);return o=M*v,c=m*v,t.copy(n).addScaledVector(Co,o).addScaledVector(Ro,c)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const G_={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},$r={h:0,s:0,l:0},Oc={h:0,s:0,l:0};function gd(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class rt{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=ii){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,qt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=qt.workingColorSpace){return this.r=e,this.g=t,this.b=n,qt.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=qt.workingColorSpace){if(e=Pp(e,1),t=Rt(t,0,1),n=Rt(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;
vendor: 6,062 bytes, line 5
5this.r=gd(o,s,e+1/3),this.g=gd(o,s,e),this.b=gd(o,s,e-1/3)}return qt.colorSpaceToWorking(this,i),this}setStyle(e,t=ii){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],c=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=ii){const n=G_[e.toLowerCase()];return n!==void 0?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Nr(e.r),this.g=Nr(e.g),this.b=Nr(e.b),this}copyLinearToSRGB(e){return this.r=Zo(e.r),this.g=Zo(e.g),this.b=Zo(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ii){return qt.workingToColorSpace(qn.copy(this),e),Math.round(Rt(qn.r*255,0,255))*65536+Math.round(Rt(qn.g*255,0,255))*256+Math.round(Rt(qn.b*255,0,255))}getHexString(e=ii){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=qt.workingColorSpace){qt.workingToColorSpace(qn.copy(this),t);const n=qn.r,i=qn.g,s=qn.b,o=Math.max(n,i,s),c=Math.min(n,i,s);let u,h;const f=(c+o)/2;if(c===o)u=0,h=0;else{const d=o-c;switch(h=f<=.5?d/(o+c):d/(2-o-c),o){case n:u=(i-s)/d+(i<s?6:0);break;case i:u=(s-n)/d+2;break;case s:u=(n-i)/d+4;break}u/=6}return e.h=u,e.s=h,e.l=f,e}getRGB(e,t=qt.workingColorSpace){return qt.workingToColorSpace(qn.copy(this),t),e.r=qn.r,e.g=qn.g,e.b=qn.b,e}getStyle(e=ii){qt.workingToColorSpace(qn.copy(this),e);const t=qn.r,n=qn.g,i=qn.b;return e!==ii?`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($r),this.setHSL($r.h+e,$r.s+t,$r.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL($r),e.getHSL(Oc);const n=el($r.h,Oc.h,t),i=el($r.s,Oc.s,t),s=el($r.l,Oc.l,t);return this.setHSL(n,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*i,this.g=s[1]*t+s[4]*n+s[7]*i,this.b=s[2]*t+s[5]*n+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const qn=new rt;rt.NAMES=G_;let zM=0;class Kn extends gr{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:zM++}),this.uuid=Ti(),this.name="",this.type="Material",this.blending=js,this.side=Or,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Iu,this.blendDst=Pu,this.blendEquation=rs,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new rt(0,0,0),this.blendAlpha=0,this.depthFunc=Qs,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=op,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Hs,this.stencilZFail=Hs,this.stencilZPass=Hs,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){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.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: 8,832 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.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!==js&&(n.blending=this.blending),this.side!==Or&&(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!==Iu&&(n.blendSrc=this.blendSrc),this.blendDst!==Pu&&(n.blendDst=this.blendDst),this.blendEquation!==rs&&(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!==Qs&&(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!==op&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Hs&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Hs&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Hs&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const o=[];for(const c in s){const u=s[c];delete u.metadata,o.push(u)}return o}if(t){const s=i(e.textures),o=i(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
vendor: 5,907 bytes, line 5
5adows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.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 Br extends Kn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new rt(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 Ai,this.combine=El,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 Dr=kM();function kM(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let u=0;u<256;++u){const h=u-127;h<-27?(n[u]=0,n[u|256]=32768,i[u]=24,i[u|256]=24):h<-14?(n[u]=1024>>-h-14,n[u|256]=1024>>-h-14|32768,i[u]=-h-1,i[u|256]=-h-1):h<=15?(n[u]=h+15<<10,n[u|256]=h+15<<10|32768,i[u]=13,i[u|256]=13):h<128?(n[u]=31744,n[u|256]=64512,i[u]=24,i[u|256]=24):(n[u]=31744,n[u|256]=64512,i[u]=13,i[u|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),c=new Uint32Array(64);for(let u=1;u<1024;++u){let h=u<<13,f=0;for(;!(h&8388608);)h<<=1,f-=8388608;h&=-8388609,f+=947912704,s[u]=h|f}for(let u=1024;u<2048;++u)s[u]=939524096+(u-1024<<13);for(let u=1;u<31;++u)o[u]=u<<23;o[31]=1199570944,o[32]=2147483648;for(let u=33;u<63;++u)o[u]=2147483648+(u-32<<23);o[63]=3347054592;for(let u=1;u<64;++u)u!==32&&(c[u]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:s,exponentTable:o,offsetTable:c}}function pi(r){Math.abs(r)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),r=Rt(r,-65504,65504),Dr.floatView[0]=r;const e=Dr.uint32View[0],t=e>>23&511;return Dr.baseTable[t]+((e&8388607)>>Dr.shiftTable[t])}function Wa(r){const e=r>>10;return Dr.uint32View[0]=Dr.mantissaTable[Dr.offsetTable[e]+(r&1023)]+Dr.exponentTable[e],Dr.floatView[0]}class Ys{static toHalfFloat(e){return pi(e)}static fromHalfFloat(e){return Wa(e)}}const An=new B,Bc=new we;let HM=0;class nn{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:HM++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ul,this.updateRanges=[],this.gpuType=pn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)Bc.fromBufferAttribute(this,t),Bc.applyMatrix3(e),this.setXY(t,Bc.x,Bc.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)An.fromBufferAttribute(this,t),An.applyMatrix3(e),this.setXYZ(t,An.x,An.y,An.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)An.fromBufferAttribute(this,t),An.applyMatrix4(e),this.setXYZ(t,An.x,An.y,An.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)An.fromBufferAttribute(this,t),An.applyNormalMatrix(e),this.setXYZ(t,An.x,An.y,An.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)An.fromBufferAttribute(this,t),An.transformDirection(e),this.setXYZ(t,An.x,An.y,An.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=ri(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Bt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=ri(t,this.array)),t}setX(e,t){return this.normalized&&(t=Bt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=ri(t,this.array)),t}setY(e,t){return this.normalized&&(t=Bt(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=ri(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Bt(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=ri(t,this.array)),t}setW(e,t){return this.normalized&&(t=Bt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Bt(t,this.array),n=Bt
vendor: 4,715 bytes, line 5
5(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=Bt(t,this.array),n=Bt(n,this.array),i=Bt(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=Bt(t,this.array),n=Bt(n,this.array),i=Bt(i,this.array),s=Bt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==ul&&(e.usage=this.usage),e}}class VM extends nn{constructor(e,t,n){super(new Int8Array(e),t,n)}}class GM extends nn{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class WM extends nn{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class XM extends nn{constructor(e,t,n){super(new Int16Array(e),t,n)}}class Dp extends nn{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class YM extends nn{constructor(e,t,n){super(new Int32Array(e),t,n)}}class Up extends nn{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class qM extends nn{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=Wa(this.array[e*this.itemSize]);return this.normalized&&(t=ri(t,this.array)),t}setX(e,t){return this.normalized&&(t=Bt(t,this.array)),this.array[e*this.itemSize]=pi(t),this}getY(e){let t=Wa(this.array[e*this.itemSize+1]);return this.normalized&&(t=ri(t,this.array)),t}setY(e,t){return this.normalized&&(t=Bt(t,this.array)),this.array[e*this.itemSize+1]=pi(t),this}getZ(e){let t=Wa(this.array[e*this.itemSize+2]);return this.normalized&&(t=ri(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Bt(t,this.array)),this.array[e*this.itemSize+2]=pi(t),this}getW(e){let t=Wa(this.array[e*this.itemSize+3]);return this.normalized&&(t=ri(t,this.array)),t}setW(e,t){return this.normalized&&(t=Bt(t,this.array)),this.array[e*this.itemSize+3]=pi(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Bt(t,this.array),n=Bt(n,this.array)),this.array[e+0]=pi(t),this.array[e+1]=pi(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=Bt(t,this.array),n=Bt(n,this.array),i=Bt(i,this.array)),this.array[e+0]=pi(t),this.array[e+1]=pi(n),this.array[e+2]=pi(i),this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=Bt(t,this.array),n=Bt(n,this.array),i=Bt(i,this.array),s=Bt(s,this.array)),this.array[e+0]=pi(t),this.array[e+1]=pi(n),this.array[e+2]=pi(i),this.array[e+3]=pi(s),this}}class ht extends nn{constructor(e,t,n){super(new Float32Array(e),t,n)}}let ZM=0;const Fi=new bt,vd=new Jt,Io=new B,wi=new Jn,Pa=new Jn,On=new B;class zt extends gr{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:ZM++}),this.uuid=Ti(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(k_(e)?Up:Dp)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new Ut().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Fi.makeRotationFromQuaternion(e),this.applyMatrix4(Fi),this}rotateX(e){return Fi.makeRotationX(e),this.applyMatrix4(Fi),this}rotateY(e){return Fi.makeRotationY(e),this.applyMatrix4(Fi),this}rotateZ(e){return Fi.makeRotationZ(e),this.applyMatrix4(Fi),this}translate(e,t,n){return Fi.makeTranslation(e,t,n),this.applyMatrix4(Fi),this}scale(e,t,n){return Fi.makeScale(e,t,n),this.applyMatrix4(Fi),this}lookAt(e){return vd.lookAt(e),vd.updateMatrix(),this.applyMatrix4(vd.matrix
vendor: 4,653 bytes, line 5
5),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Io).negate(),this.translate(Io.x,Io.y,Io.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,s=e.length;i<s;i++){const o=e[i];n.push(o.x,o.y,o.z||0)}this.setAttribute("position",new ht(n,3))}else{const n=Math.min(e.length,t.count);for(let i=0;i<n;i++){const s=e[i];t.setXYZ(i,s.x,s.y,s.z||0)}e.length>t.count&&console.warn("THREE.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 Jn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new B(-1/0,-1/0,-1/0),new B(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const s=t[n];wi.setFromBufferAttribute(s),this.morphTargetsRelative?(On.addVectors(this.boundingBox.min,wi.min),this.boundingBox.expandByPoint(On),On.addVectors(this.boundingBox.max,wi.max),this.boundingBox.expandByPoint(On)):(this.boundingBox.expandByPoint(wi.min),this.boundingBox.expandByPoint(wi.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Hn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new B,1/0);return}if(e){const n=this.boundingSphere.center;if(wi.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const c=t[s];Pa.setFromBufferAttribute(c),this.morphTargetsRelative?(On.addVectors(wi.min,Pa.min),wi.expandByPoint(On),On.addVectors(wi.max,Pa.max),wi.expandByPoint(On)):(wi.expandByPoint(Pa.min),wi.expandByPoint(Pa.max))}wi.getCenter(n);let i=0;for(let s=0,o=e.count;s<o;s++)On.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(On));if(t)for(let s=0,o=t.length;s<o;s++){const c=t[s],u=this.morphTargetsRelative;for(let h=0,f=c.count;h<f;h++)On.fromBufferAttribute(c,h),u&&(Io.fromBufferAttribute(e,h),On.add(Io)),i=Math.max(i,n.distanceToSquared(On))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,i=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new nn(new Float32Array(4*n.count),4));const o=this.getAttribute("tangent"),c=[],u=[];for(let D=0;D<n.count;D++)c[D]=new B,u[D]=new B;const h=new B,f=new B,d=new B,m=new we,g=new we,y=new we,M=new B,x=new B;function v(D,C,A){h.fromBufferAttribute(n,D),f.fromBufferAttribute(n,C),d.fromBufferAttribute(n,A),m.fromBufferAttribute(s,D),g.fromBufferAttribute(s,C),y.fromBufferAttribute(s,A),f.sub(h),d.sub(h),g.sub(m),y.sub(m);const F=1/(g.x*y.y-y.x*g.y);isFinite(F)&&(M.copy(f).multiplyScalar(y.y).addScaledVector(d,-g.y).multiplyScalar(F),x.copy(d).multiplyScalar(g.x).addScaledVector(f,-y.x).multiplyScalar(F),c[D].add(M),c[C].add(M),c[A].add(M),u[D].add(x),u[C].add(x),u[A].add(x))}let w=this.groups;w.length===0&&(w=[{start:0,count:e.count}]);for(let D=0,C=w.length;D<C;++D){const A=w[D],F=A.start,j=A.count;for(let Z=F,$=F+j;Z<$;Z+=3)v(e.getX(Z+0),e.getX(Z+1),e.getX(Z+2))}const E=new B,T=new B,U=new B,I=new B;function N(D){U.fromBufferAttribute(i,D),I.copy(U);const C=c[D];E.copy(C),E.sub(U.multiplyScalar(U.dot(C))).normalize(),T.crossVectors(I,C);const F=T.dot(u[D])<0?-1:1;o.setXYZW(D,E.x,E.y,E.z,F)}for(let D=0,C=w.length;D<C;++D){const A=w[D],F=A.start,j=A.count;for(let Z=F,$=F+j;Z<$;Z+=3)N(e.getX(Z+0)),N(e.getX(Z+1)),N(e.getX(Z+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 nn(new Float32Array(t.count*3),3),this.setAttribute("normal",n
vendor: 5,697 bytes, line 5
5);else for(let m=0,g=n.count;m<g;m++)n.setXYZ(m,0,0,0);const i=new B,s=new B,o=new B,c=new B,u=new B,h=new B,f=new B,d=new B;if(e)for(let m=0,g=e.count;m<g;m+=3){const y=e.getX(m+0),M=e.getX(m+1),x=e.getX(m+2);i.fromBufferAttribute(t,y),s.fromBufferAttribute(t,M),o.fromBufferAttribute(t,x),f.subVectors(o,s),d.subVectors(i,s),f.cross(d),c.fromBufferAttribute(n,y),u.fromBufferAttribute(n,M),h.fromBufferAttribute(n,x),c.add(f),u.add(f),h.add(f),n.setXYZ(y,c.x,c.y,c.z),n.setXYZ(M,u.x,u.y,u.z),n.setXYZ(x,h.x,h.y,h.z)}else for(let m=0,g=t.count;m<g;m+=3)i.fromBufferAttribute(t,m+0),s.fromBufferAttribute(t,m+1),o.fromBufferAttribute(t,m+2),f.subVectors(o,s),d.subVectors(i,s),f.cross(d),n.setXYZ(m+0,f.x,f.y,f.z),n.setXYZ(m+1,f.x,f.y,f.z),n.setXYZ(m+2,f.x,f.y,f.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)On.fromBufferAttribute(e,t),On.normalize(),e.setXYZ(t,On.x,On.y,On.z)}toNonIndexed(){function e(c,u){const h=c.array,f=c.itemSize,d=c.normalized,m=new h.constructor(u.length*f);let g=0,y=0;for(let M=0,x=u.length;M<x;M++){c.isInterleavedBufferAttribute?g=u[M]*c.data.stride+c.offset:g=u[M]*f;for(let v=0;v<f;v++)m[y++]=h[g++]}return new nn(m,f,d)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new zt,n=this.index.array,i=this.attributes;for(const c in i){const u=i[c],h=e(u,n);t.setAttribute(c,h)}const s=this.morphAttributes;for(const c in s){const u=[],h=s[c];for(let f=0,d=h.length;f<d;f++){const m=h[f],g=e(m,n);u.push(g)}t.morphAttributes[c]=u}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let c=0,u=o.length;c<u;c++){const h=o[c];t.addGroup(h.start,h.count,h.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 u=this.parameters;for(const h in u)u[h]!==void 0&&(e[h]=u[h]);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 u in n){const h=n[u];e.data.attributes[u]=h.toJSON(e.data)}const i={};let s=!1;for(const u in this.morphAttributes){const h=this.morphAttributes[u],f=[];for(let d=0,m=h.length;d<m;d++){const g=h[d];f.push(g.toJSON(e.data))}f.length>0&&(i[u]=f,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const c=this.boundingSphere;return c!==null&&(e.data.boundingSphere=c.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 h in i){const f=i[h];this.setAttribute(h,f.clone(t))}const s=e.morphAttributes;for(const h in s){const f=[],d=s[h];for(let m=0,g=d.length;m<g;m++)f.push(d[m].clone(t));this.morphAttributes[h]=f}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let h=0,f=o.length;h<f;h++){const d=o[h];this.addGroup(d.start,d.count,d.materialIndex)}const c=e.boundingBox;c!==null&&(this.boundingBox=c.clone());const u=e.boundingSphere;return u!==null&&(this.boundingSphere=u.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const hv=new bt,As=new to,zc=new Hn,fv=new B,kc=new B,Hc=new B,Vc=new B,_d=new B,Gc=new B,dv=new B,Wc=new B;class mn extends Jt{constructor(e=new zt,t=new Br){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const c=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=s}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,s=n.morphAttributes.position,o=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const c=this.morphTargetInfluences;if(s&&c){Gc.set(0,0,0);for(let u=0,h=s.length;u<h;u++){const f=c[u],d=s[u];f!==0&&(_d.fromBufferAttribute(d,e),o?Gc.addScaledVector(_d,f):Gc.addScaledVector(_d.sub(t),f))}t.add(Gc)}return t}raycast(e,t){const n=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),zc.copy(n.boundingSphere),zc.applyMatrix4(s),As.copy(e.ray).recast(e.near),!(zc.containsPoint(As.origin)===!1&&(As.intersectSphere(zc,fv)===null||As.origin.distanceToSquared(fv)>(e.far-e.near)**2))&&(hv.copy(s).invert(),As.copy(e.ray).applyMatrix4(hv),!(n.boundingBox!==null&&As.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,As)))}_computeIntersections(e,t,n){let i;const s=this.geometry,o=this.material,c=s.index,u=s.attributes.position,h=s.attributes.uv,f
vendor: 4,492 bytes, lines 5-9
5=s.attributes.uv1,d=s.attributes.normal,m=s.groups,g=s.drawRange;if(c!==null)if(Array.isArray(o))for(let y=0,M=m.length;y<M;y++){const x=m[y],v=o[x.materialIndex],w=Math.max(x.start,g.start),E=Math.min(c.count,Math.min(x.start+x.count,g.start+g.count));for(let T=w,U=E;T<U;T+=3){const I=c.getX(T),N=c.getX(T+1),D=c.getX(T+2);i=Xc(this,v,e,n,h,f,d,I,N,D),i&&(i.faceIndex=Math.floor(T/3),i.face.materialIndex=x.materialIndex,t.push(i))}}else{const y=Math.max(0,g.start),M=Math.min(c.count,g.start+g.count);for(let x=y,v=M;x<v;x+=3){const w=c.getX(x),E=c.getX(x+1),T=c.getX(x+2);i=Xc(this,o,e,n,h,f,d,w,E,T),i&&(i.faceIndex=Math.floor(x/3),t.push(i))}}else if(u!==void 0)if(Array.isArray(o))for(let y=0,M=m.length;y<M;y++){const x=m[y],v=o[x.materialIndex],w=Math.max(x.start,g.start),E=Math.min(u.count,Math.min(x.start+x.count,g.start+g.count));for(let T=w,U=E;T<U;T+=3){const I=T,N=T+1,D=T+2;i=Xc(this,v,e,n,h,f,d,I,N,D),i&&(i.faceIndex=Math.floor(T/3),i.face.materialIndex=x.materialIndex,t.push(i))}}else{const y=Math.max(0,g.start),M=Math.min(u.count,g.start+g.count);for(let x=y,v=M;x<v;x+=3){const w=x,E=x+1,T=x+2;i=Xc(this,o,e,n,h,f,d,w,E,T),i&&(i.faceIndex=Math.floor(x/3),t.push(i))}}}}function jM(r,e,t,n,i,s,o,c){let u;if(e.side===si?u=n.intersectTriangle(o,s,i,!0,c):u=n.intersectTriangle(i,s,o,e.side===Or,c),u===null)return null;Wc.copy(c),Wc.applyMatrix4(r.matrixWorld);const h=t.ray.origin.distanceTo(Wc);return h<t.near||h>t.far?null:{distance:h,point:Wc.clone(),object:r}}function Xc(r,e,t,n,i,s,o,c,u,h){r.getVertexPosition(c,kc),r.getVertexPosition(u,Hc),r.getVertexPosition(h,Vc);const f=jM(r,e,t,n,kc,Hc,Vc,dv);if(f){const d=new B;mi.getBarycoord(dv,kc,Hc,Vc,d),i&&(f.uv=mi.getInterpolatedAttribute(i,c,u,h,d,new we)),s&&(f.uv1=mi.getInterpolatedAttribute(s,c,u,h,d,new we)),o&&(f.normal=mi.getInterpolatedAttribute(o,c,u,h,d,new B),f.normal.dot(n.direction)>0&&f.normal.multiplyScalar(-1));const m={a:c,b:u,c:h,normal:new B,materialIndex:0};mi.getNormal(kc,Hc,Vc,m.normal),f.face=m,f.barycoord=d}return f}class no extends zt{constructor(e=1,t=1,n=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:o};const c=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const u=[],h=[],f=[],d=[];let m=0,g=0;y("z","y","x",-1,-1,n,t,e,o,s,0),y("z","y","x",1,-1,n,t,-e,o,s,1),y("x","z","y",1,1,e,n,t,i,o,2),y("x","z","y",1,-1,e,n,-t,i,o,3),y("x","y","z",1,-1,e,t,n,i,s,4),y("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(u),this.setAttribute("position",new ht(h,3)),this.setAttribute("normal",new ht(f,3)),this.setAttribute("uv",new ht(d,2));function y(M,x,v,w,E,T,U,I,N,D,C){const A=T/N,F=U/D,j=T/2,Z=U/2,$=I/2,ae=N+1,ne=D+1;let xe=0,k=0;const ee=new B;for(let Q=0;Q<ne;Q++){const fe=Q*F-Z;for(let Se=0;Se<ae;Se++){const ke=Se*A-j;ee[M]=ke*w,ee[x]=fe*E,ee[v]=$,h.push(ee.x,ee.y,ee.z),ee[M]=0,ee[x]=0,ee[v]=I>0?1:-1,f.push(ee.x,ee.y,ee.z),d.push(Se/N),d.push(1-Q/D),xe+=1}}for(let Q=0;Q<D;Q++)for(let fe=0;fe<N;fe++){const Se=m+fe+ae*Q,ke=m+fe+ae*(Q+1),le=m+(fe+1)+ae*(Q+1),Ie=m+(fe+1)+ae*Q;u.push(Se,ke,Ie),u.push(ke,le,Ie),k+=6}c.addGroup(g,k,C),g+=k,m+=xe}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new no(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function na(r){const e={};for(const t in r){e[t]={};for(const n in r[t]){const i=r[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function ni(r){const e={};for(let t=0;t<r.length;t++){const n=na(r[t]);for(const i in n)e[i]=n[i]}return e}function JM(r){const e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function W_(r){const e=r.getRenderTarget();return e===null?r.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:qt.workingColorSpace}const X_={clone:na,merge:ni};var KM=`void main() { 6 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 7}`,QM=`void main() { 8 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 9}`;class gi extends Kn{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=KM,this.fragmentShader=Q
vendor: 28,283 bytes, lines 9-44
9M,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=na(e.uniforms),this.uniformsGroups=JM(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const o=this.uniforms[i].value;o&&o.isTexture?t.uniforms[i]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[i]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[i]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[i]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[i]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[i]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[i]={type:"m4",value:o.toArray()}:t.uniforms[i]={value:o}}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 Cl extends Jt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new bt,this.projectionMatrix=new bt,this.projectionMatrixInverse=new bt,this.coordinateSystem=Bi}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const es=new B,pv=new we,mv=new we;class wn extends Cl{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=ta*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Js*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return ta*2*Math.atan(Math.tan(Js*.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){es.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(es.x,es.y).multiplyScalar(-e/es.z),es.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(es.x,es.y).multiplyScalar(-e/es.z)}getViewSize(e,t){return this.getViewBounds(e,pv,mv),t.subVectors(mv,pv)}setViewOffset(e,t,n,i,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Js*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const u=o.fullWidth,h=o.fullHeight;s+=o.offsetX*i/u,t-=o.offsetY*n/h,i*=o.width/u,n*=o.height/h}const c=this.filmOffset;c!==0&&(s+=e*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Po=-90,Lo=1;class Y_ extends Jt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new wn(Po,Lo,e,t);i.layers=this.layers,this.add(i);const s=new wn(Po,Lo,e,t);s.layers=this.layers,this.add(s);const o=new wn(Po,Lo,e,t);o.layers=this.layers,this.add(o);const c=new wn(Po,Lo,e,t);c.layers=this.layers,this.add(c);const u=new wn(Po,Lo,e,t);u.layers=this.layers,this.add(u);const h=new wn(Po,Lo,e,t);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,s,o,c,u]=t;for(const h of t)this.remove(h);if(e===Bi)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),c.up.set(0,1,0),c.lookAt(0,0,1),u.up.set(0,1,0),u.lookAt(0,0,-1);else if(e===hl)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),c.up.set(0,-1,0),c.lookAt(0,0,1),u.up.set(0,-1,0),u.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const h of t)this.add(h),h.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,c,u,h,f]=this.children,d=e.getRenderTarget(),m=e.getActiveCubeFace(),g=e.getActiveMipmapLevel(),y=e.xr.enabled;e.xr.enabled=!1;const M=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,s),e.setRenderTarget(n,1,i),e.render(t,o),e.setRenderTarget(n,2,i),e.render(t,c),e.setRenderTarget(n,3,i),e.render(t,u),e.setRenderTarget(n,4,i),e.render(t,h),n.texture.generateMipmaps=M,e.setRenderTarget(n,5,i),e.render(t,f),e.setRenderTarget(d,m,g),e.xr.enabled=y,n.texture.needsPMREMUpdate=!0}}class Rl extends sn{constructor(e=[],t=dr,n,i,s,o,c,u,h,f){super(e,t,n,i,s,o,c,u,h,f),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Np extends zi{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new Rl(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:` 10 11 varying vec3 vWorldDirection; 12 13 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 14 15 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 16 17 } 18 19 void main() { 20 21 vWorldDirection = transformDirection( position, modelMatrix ); 22 23 #include <begin_vertex> 24 #include <project_vertex> 25 26 } 27 `,fragmentShader:` 28 29 uniform sampler2D tEquirect; 30 31 varying vec3 vWorldDirection; 32 33 #include <common> 34 35 void main() { 36 37 vec3 direction = normalize( vWorldDirection ); 38 39 vec2 sampleUV = equirectUv( direction ); 40 41 gl_FragColor = texture2D( tEquirect, sampleUV ); 42 43 } 44 `},i=new no(5,5,5),s=new gi({name:"CubemapFromEquirect",uniforms:na(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:si,blending:hr});s.uniforms.tEquirect.value=t;const o=new mn(i,s),c=t.minFilter;return t.minFilter===ur&&(t.minFilter=tn),new Y_(1,10,this).update(e,o),t.minFilter=c,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,i);e.setRenderTarget(s)}}class Wo extends Jt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const $M={type:"move"};class Au{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Wo,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 Wo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new B,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new B),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Wo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new B,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new B),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,o=null;const c=this._targetRay,u=this._grip,h=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(h&&e.hand){o=!0;for(const M of e.hand.values()){const x=t.getJointPose(M,n),v=this._getHandJoint(h,M);x!==null&&(v.matrix.fromArray(x.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.matrixWorldNeedsUpdate=!0,v.jointRadius=x.radius),v.visible=x!==null}const f=h.joints["index-finger-tip"],d=h.joints["thumb-tip"],m=f.position.distanceTo(d.position),g=.02,y=.005;h.inputState.pinching&&m>g+y?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!h.inputState.pinching&&m<=g-y&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else u!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(u.matrix.fromArray(s.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,s.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(s.linearVelocity)):u.hasLinearVelocity=!1,s.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(s.angularVelocity)):u.hasAngularVelocity=!1));c!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(c.matrix.fromArray(i.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,i.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(i.linearVelocity)):c.hasLinearVelocity=!1,i.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(i.angularVelocity)):c.hasAngularVelocity=!1,this.dispatchEvent($M)))}return c!==null&&(c.visible=i!==null),u!==null&&(u.visible=s!==null),h!==null&&(h.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Wo;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class bh{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new rt(e),this.density=t}clone(){return new bh(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Ah{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new rt(e),this.near=t,this.far=n}clone(){return new Ah(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}let Il=class extends Jt{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 Ai,this.environmentIntensity=1,this.environmentRotation=new Ai,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}};class Ch{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=ul,this.updateRanges=[],this.version=0,this.uuid=Ti()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Ti()),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=Ti()),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 ti=new B;class $s{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++)ti.fromBufferAttribute(this,t),ti.applyMatrix4(e),this.setXYZ(t,ti.x,ti.y,ti.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ti.fromBufferAttribute(this,t),ti.applyNormalMatrix(e),this.setXYZ(t,ti.x,ti.y,ti.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ti.fromBufferAttribute(this,t),ti.transformDirection(e),this.setXYZ(t,ti.x,ti.y,ti.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=ri(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Bt(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Bt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Bt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Bt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Bt(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=ri(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=ri(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=ri(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=ri(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Bt(t,this.array),n=Bt(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=Bt(t,this.array),n=Bt(n,this.array),i=Bt(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Bt(t,this.array),n=Bt(n,this.array),i=Bt(i,this.array),s=Bt(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return new nn(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 $s(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Fp extends Kn{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new rt(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 Do;const La=new B,Uo=new B,No=new B,Fo=new we,Da=new we,q_=new bt,Yc=new B,Ua=new B,qc=new B,gv=new we,yd=new we,vv=new we;class Z_ extends Jt{constructor(e=new Fp){if(super(),this.isSprite=!0,this.type="Sprite",Do===void 0){Do=new zt;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 Ch(t,5);Do.setIndex([0,1,2,0,2,3]),Do.setAttribute("position",new $s(n,3,0,!1)),Do.setAttribute("uv",new $s(n,2,3,!1))}this.geometry=Do,this.material=e,this.center=new we(.5,.5),this.count=1}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Uo.setFromMatrixScale(this.matrixWorld),q_.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),No.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Uo.multiplyScalar(-No.z);const n=this.material.rotation;let i,s;n!==0&&(s=Math.cos(n),i=Math.sin(n));const o=this.center;Zc(Yc.set(-.5,-.5,0),No,o,Uo,i,s),Zc(Ua.set(.5,-.5,0),No,o,Uo,i,s),Zc(qc.set(.5,.5,0),No,o,Uo,i,s),gv.set(0,0),yd.set(1,0),vv.set(1,1);let c=e.ray.intersectTriangle(Yc,Ua,qc,!1,La);if(c===null&&(Zc(Ua.set(-.5,.5,0),No,o,Uo,i,s),yd.set(0,1),c=e.ray.intersectTriangle(Yc,qc,Ua,!1,La),c===null))return;const u=e.ray.origin.distanceTo(La);u<e.near||u>e.far||t.push({distance:u,point:La.clone(),uv:mi.getInterpolation(La,Yc,Ua,qc,gv,yd,vv,new we),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 Zc(r,e,t,n,i,s){Fo.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(Da.x=s*Fo.x-i*Fo.y,Da.y=i*Fo.x+s*Fo.y):Da.copy(Fo),r.copy(e),r.x+=Da.x,r.y+=Da.y,r.applyMatrix4(q_)}const jc=new B,_v=new B;class j_ extends Jt{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n<i;n++){const s=t[n];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let s;for(s=0;s<i.length&&!(t<i[s].distance);s++);return i.splice(s,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){const i=t.splice(n,1);return this.remove(i[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let s=t[n].distance;if(t[n].object.visible&&(s-=s*t[n].hysteresis),e<s)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){jc.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(jc);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){jc.setFromMatrixPosition(e.matrixWorld),_v.setFromMatrixPosition(this.matrixWorld);const n=jc.distanceTo(_v)/e.zoom;t[0].object.visible=!0;let i,s;for(i=1,s=t.length;i<s;i++){let o=t[i].distance;if(t[i].object.visible&&(o-=o*t[i].hysteresis),n>=o)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<s;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let i=0,s=n.length;i<s;i++){const o=n[i];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}const yv=new B,xv=new jt,Sv=new jt,e1=new B,Mv=new bt,Jc=new B,xd=new Hn,wv=new bt,Sd=new to;class J_ extends mn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=rp,this.bindMatrix=new bt,this.bindMatrixInverse=new bt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Jn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Jc),this.boundingBox.expandByPoint(Jc)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Hn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Jc),this.boundingSphere.expandByPoint(Jc)}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(),xd.copy(this.boundingSphere),xd.applyMatrix4(i),e.ray.intersectsSphere(xd)!==!1&&(wv.copy(i).invert(),Sd.copy(e.ray).applyMatrix4(wv),!(this.boundingBox!==null&&Sd.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,Sd)))}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 jt,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===rp?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===b_?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;xv.fromBufferAttribute(i.attributes.skinIndex,e),Sv.fromBufferAttribute(i.attributes.skinWeight,e),yv.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const o=Sv.getComponent(s);if(o!==0){const c=xv.getComponent(s);Mv.multiplyMatrices(n.bones[c].matrixWorld,n.boneInverses[c]),t.addScaledVector(e1.copy(yv).applyMatrix4(Mv),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}class Op extends Jt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Ki extends sn{constructor(e=null,t=1,n=1,i,s,o,c,u,h=kn,f=kn,d,m){super(null,o,c,u,h,f,i,s,d,m),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Ev=new bt,t1=new bt;class Rh{constructor(e=[],t=[]){this.uuid=Ti(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=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){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new bt)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new bt;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let s=0,o=e.length;s<o;s++){const c=e[s]?e[s].matrixWorld:t1;Ev.multiplyMatrices(c,t[s]),Ev.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Rh(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 Ki(t,e,e,En,pn);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const s=e.bones[n];let o=t[s];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",
vendor: 4,554 bytes, line 44
44s),o=new Op),this.bones.push(o),this.boneInverses.push(new bt().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,s=t.length;i<s;i++){const o=t[i];e.bones.push(o.uuid);const c=n[i];e.boneInverses.push(c.toArray())}return e}}class ia extends nn{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 Oo=new bt,Tv=new bt,Kc=[],bv=new Jn,n1=new bt,Na=new mn,Fa=new Hn;class K_ extends mn{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new ia(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,n1)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Jn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Oo),bv.copy(e.boundingBox).applyMatrix4(Oo),this.boundingBox.union(bv)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Hn),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Oo),Fa.copy(e.boundingSphere).applyMatrix4(Oo),this.boundingSphere.union(Fa)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,s=n.length+1,o=e*s+1;for(let c=0;c<n.length;c++)n[c]=i[o+c]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Na.geometry=this.geometry,Na.material=this.material,Na.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Fa.copy(this.boundingSphere),Fa.applyMatrix4(n),e.ray.intersectsSphere(Fa)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,Oo),Tv.multiplyMatrices(n,Oo),Na.matrixWorld=Tv,Na.raycast(e,Kc);for(let o=0,c=Kc.length;o<c;o++){const u=Kc[o];u.instanceId=s,u.object=this,t.push(u)}Kc.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new ia(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new Ki(new Float32Array(i*this.count),i,this.count,bl,pn));const s=this.morphTexture.source.data.data;let o=0;for(let h=0;h<n.length;h++)o+=n[h];const c=this.geometry.morphTargetsRelative?1:1-o,u=i*e;s[u]=c,s.set(n,u+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const Md=new B,i1=new B,r1=new Ut;class Pr{constructor(e=new B(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=Md.subVectors(n,t).cross(i1.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(Md),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;
44const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||r1.getNormalMatrix(e),i=this.coplanarPoint(Md).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Cs=new Hn,Qc=new B;class la{constructor(e=new Pr,t=new Pr,n=new Pr,i=new Pr,s=new Pr,o=new Pr){this.planes=[e,t,n,i,s,o]}set(e,t,n,i,s,o){const c=this.planes;return c[0].copy(e),c[1].copy(t),c[2].copy(n),c[3].copy(i),c[4].copy(s),c[5].copy(o),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=Bi){const n=this.planes,i=e.elements,s=i[0],o=i[1],c=i[2],u=i[3],h=i[4],f=i[5],d=i[6],m=i[7],g=i[8],y=i[9],M=i[10],x=i[11],v=i[12],w=i[13],E=i[14],T=i[15];if(n[0].setComponents(u-s,m-h,x-g,T-v).normalize(),n[1].setComponents(u+s,m+h,x+g,T+v).normalize(),n[2].setComponents(u+o,m+f,x+y,T+w).normalize(),n[3].setComponents(u-o,m-f,x-y,T-w).normalize(),n[4].setComponents(u-c,m-d,x-M,T-E).normalize(),t===Bi)n[5].setComponents(u+c,m+d,x+M,T+E).normalize();else if(t===hl)n[5].setComponents(c,d,M,E).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(),Cs.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Cs.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Cs)}intersectsSprite(e){return Cs.center.set(0,0,0),Cs.radius=.7071067811865476,Cs.applyMatrix4(e.matrixWorld),this.intersectsSphere(Cs)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(Qc.x=i.normal.x>0?e.max.x:e.min.x,Qc.y=i.normal.y>0?e.max.y:e.min.y,Qc.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Qc)<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 ar=new bt,lr=new la;class Ih{constructor(){this.coordinateSystem=Bi}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(ar.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),lr.setFromProjectionMatrix(ar,this.coordinateSystem),lr.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(ar.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),lr.setFromProjectionMatrix(ar,this.coordinateSystem),lr.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(ar.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),lr.setFromProjectionMatrix(ar,this.coordinateSystem),lr.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(ar.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),lr.setFromProjectionMatrix(ar,this.coordinateSystem),lr.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(ar.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),lr.setFromProjectionMatrix(ar,this.coordinateSystem),lr.containsPoint(e))return!0}return!1}clone(){return new Ih}}function wd(r,e){return r-e}function s1(r,e){return r.z-e.z}function o1(r,e){return e.z-r.z}class a1{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,i){const s=this.pool,o=this.list;this.index>=s.length&&s.push({start:-1,count:-1,z:-1,index:-1});const c=s[this.index];o.push(c),this.index++,c.start=e,c.count=t,c.z=n,c.index=i}reset(){this.list.length=0,this.index=0}}const di=new bt,l1=new rt(1,1,1),Av=new la,c1=new Ih,$c=new Jn,Rs=new Hn,Oa=new B,Cv=new B,u1=new B,Ed=new a1,Zn=new mn,eu=[];function h1(r,e,t=0){const n=e.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==e.array.constructor){const i=r.count;for(let s=0;s<i;s++)for(let o=0;o<n;o++)e.setComponent(s+t,o,r.getComponent(s,o))}else e.array.set(r.array,t*n);e.needsUpdate=!0}function Is(r,e){if(r.constructor!==e.constructor){const t=Math.min(r.length,e.length);for(let n=0;n<t;n++)e[n]=r[n]}else{const t=Math.min(r.length,e.length);e.set(new r.constructor(r.buffer,0,t))}}class Q_ extends mn{constructor(e,t,n=t*2,i){super(new zt,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new Ki(t,e,e,En,pn);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new Ki(t,e,e,Al,pr);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 Ki(t,e,e,En,pn);
44n.colorSpace=qt.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(this._geometryInitialized===!1){for(const s in e.attributes){const o=e.getAttribute(s),{array:c,itemSize:u,normalized:h}=o,f=new c.constructor(n*u),d=new nn(f,u,h);t.setAttribute(s,d)}if(e.getIndex()!==null){const s=n>65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new nn(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),s=t.getAttribute(n);if(i.itemSize!==s.itemSize||i.normalized!==s.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Jn);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const s=t[n].geometryIndex;this.getMatrixAt(n,di),this.getBoundingBoxAt(s,$c).applyMatrix4(di),e.union($c)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Hn);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(t[n].active===!1)continue;const s=t[n].geometryIndex;this.getMatrixAt(n,di),this.getBoundingSphereAt(s,Rs).applyMatrix4(di),e.union(Rs)}}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(wd),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const s=this._matricesTexture;di.identity().toArray(s.image.data,i*16),s.needsUpdate=!0;const o=this._colorsTexture;return o&&(l1.toArray(o.image.data,i*4),o.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},s=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const o=e.getIndex();if(o!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?o.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 u;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(wd),u=this._availableGeometryIds.shift(),s[u]=i):(u=this._geometryCount,this._geometryCount++,s.push(i)),this.setGeometryAt(u,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,u}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,s=n.getIndex(),o=t.getIndex(),c=this._geometryInfo[e];if(i&&o.count>c.reservedIndexCount||t.attributes.position.count>c.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const u=c.vertexStart,h=c.reservedVertexCount;c.vertexCount=t.getAttribute("position").count;for(const f in n.attributes){const d=t.getAttribute(f),m=n.getAttribute(f);h1(d,m,u);const g=d.itemSize;
44for(let y=d.count,M=h;y<M;y++){const x=u+y;for(let v=0;v<g;v++)m.setComponent(x,v,0)}m.needsUpdate=!0,m.addUpdateRange(u*g,h*g)}if(i){const f=c.indexStart,d=c.reservedIndexCount;c.indexCount=t.getIndex().count;for(let m=0;m<o.count;m++)s.setX(f+m,u+o.getX(m));for(let m=o.count,g=d;m<g;m++)s.setX(f+m,u);s.needsUpdate=!0,s.addUpdateRange(f,c.reservedIndexCount)}return c.start=i?c.indexStart:c.vertexStart,c.count=i?c.indexCount:c.vertexCount,c.boundingBox=null,t.boundingBox!==null&&(c.boundingBox=t.boundingBox.clone()),c.boundingSphere=null,t.boundingSphere!==null&&(c.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._geometryInfo;if(e>=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let i=0,s=n.length;i<s;i++)n[i].active&&n[i].geometryIndex===e&&this.deleteInstance(i);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0;const n=this._geometryInfo,i=n.map((o,c)=>c).sort((o,c)=>n[o].vertexStart-n[c].vertexStart),s=this.geometry;for(let o=0,c=n.length;o<c;o++){const u=i[o],h=n[u];if(h.active!==!1){if(s.index!==null){if(h.indexStart!==t){const{indexStart:f,vertexStart:d,reservedIndexCount:m}=h,g=s.index,y=g.array,M=e-d;for(let x=f;x<f+m;x++)y[x]=y[x]+M;g.array.copyWithin(t,f,f+m),g.addUpdateRange(t,m),h.indexStart=t}t+=h.reservedIndexCount}if(h.vertexStart!==e){const{vertexStart:f,reservedVertexCount:d}=h,m=s.attributes;for(const g in m){const y=m[g],{array:M,itemSize:x}=y;M.copyWithin(e*x,f*x,(f+d)*x),y.addUpdateRange(e*x,d*x)}h.vertexStart=e}e+=h.reservedVertexCount,h.start=s.index?h.indexStart:h.vertexStart,this._nextIndexStart=s.index?h.indexStart+h.reservedIndexCount:0,this._nextVertexStart=h.vertexStart+h.reservedVertexCount}}return this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const s=new Jn,o=n.index,c=n.attributes.position;for(let u=i.start,h=i.start+i.count;u<h;u++){let f=u;o&&(f=o.getX(f)),s.expandByPoint(Oa.fromBufferAttribute(c,f))}i.boundingBox=s}return t.copy(i.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const s=new Hn;this.getBoundingBoxAt(e,$c),$c.getCenter(s.center);const o=n.index,c=n.attributes.position;let u=0;for(let h=i.start,f=i.start+i.count;h<f;h++){let d=h;o&&(d=o.getX(d)),Oa.fromBufferAttribute(c,d),u=Math.max(u,s.center.distanceToSquared(Oa))}s.radius=Math.sqrt(u),i.boundingSphere=s}return t.copy(i.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);const n=this._matricesTexture,i=this._matricesTexture.image.data;return t.toArray(i,e*16),n.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,e*16)}setColorAt(e,t){return this.validateInstanceId(e),this._colorsTexture===null&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,e*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return this.validateInstanceId(e),t.fromArray(this._colorsTexture.image.data,e*4)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t?this:(this._instanceInfo[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,t){return this.validateInstanceId(e),this.validateGeometryId(t),this._instanceInfo[e].geometryIndex=t,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,t={}){this.validateGeometryId(e);const n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){const t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(wd);t[t.length-1]===n.length;)n.pop(),t.pop();if(e<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const i=new Int32Array(e),s=new Int32Array(e);Is(this._multiDrawCounts,i),Is(this._multiDrawStarts,s),this._multiDrawCounts=i,this._multiDrawStarts=s,this._maxInstanceCount=e;const o=this._indirectTexture,c=this._matricesTexture,u=this._colorsTexture;o.dispose(),this._initIndirectTexture(),Is(o.image.data,this._indirectTexture.image.data),c.dispose(),this._initMatricesTexture(),Is(c.image.data,this._matricesTexture.image.data),u&&(u.dispose(),this._initColorsTexture(),Is(u.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const n=[...this._geometryInfo].filter(c=>c.active);if(Math.max(...n.map(c=>c.vertexStart+c.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(u=>u.indexStart+u.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const s=this.geometry;s.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new zt,this._initializeGeometry(s));const o=this.geometry;s.index&&Is(s.index.array,o.index.array);for(const c in s.attributes)Is(s.attributes[c].array,o.attributes[c].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,s=this.matrixWorld,o=this.geometry;Zn.material=this.material,Zn.geometry.index=o.index,Zn.geometry.attributes=o.attributes,Zn.geometry.boundingBox===null&&(Zn.geometry.boundingBox=new Jn),Zn.geometry.boundingSphere===null&&(Zn.geometry.boundingSphere=new Hn);for(let c=0,u=n.length;c<u;c++){if(!n[c].visible||!n[c].active)continue;const h=n[c].geometryIndex,f=i[h];Zn.geometry.setDrawRange(f.start,f.count),this.getMatrixAt(c,Zn.matrixWorld).premultiply(s),this.getBoundingBoxAt(h,Zn.geometry.boundingBox),this.getBoundingSphereAt(h,Zn.geometry.boundingSphere),Zn.raycast(e,eu);for(let d=0,m=eu.length;d<m;d++){const g=eu[d];g.object=this,g.batchId=c,t.push(g)}eu.length=0}Zn.material=null,Zn.geometry.index=null,Zn.geometry.attributes={},Zn.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map(t=>({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,i,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=i.getIndex(),c=o===null?1:o.array.BYTES_PER_ELEMENT,u=this._instanceInfo,h=this._multiDrawStarts,f=this._multiDrawCounts,d=this._geometryInfo,m=this.perObjectFrustumCulled,g=this._indirectTexture,y=g.image.data,M=n.isArrayCamera?c1:Av;m&&!n.isArrayCamera&&(di.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),Av.setFromProjectionMatrix(di,e.coordinateSystem));let x=0;if(this.sortObjects){di.copy(this.matrixWorld).invert(),Oa.setFromMatrixPosition(n.matrixWorld).applyMatrix4(di),Cv.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(di);for(let E=0,T=u.length;E<T;E++)if(u[E].visible&&u[E].active){const U=u[E].geometryIndex;this.getMatrixAt(E,di),this.getBoundingSphereAt(U,Rs).applyMatrix4(di);let I=!1;if(m&&(I=!M.intersectsSphere(Rs,n)),!I){const N=d[U],D=u1.subVectors(Rs.center,Oa).dot(Cv);Ed.push(N.start,N.count,D,E)}}const v=Ed.list,w=this.customSort;w===null?v.sort(s.transparent?o1:s1):w.call(this,v,n);for(let E=0,T=v.length;E<T;E++){const U=v[E];h[x]=U.start*c,f[x]=U.count,y[x]=U.index,x++}Ed.reset()}else for(let v=0,w=u.length;v<w;v++)if(u[v].visible&&u[v].active){const E=u[v].geometryIndex;let T=!1;if(m&&(this.getMatrixAt(v,di),this.getBoundingSphereAt(E,Rs).applyMatrix4(di),T=!M.intersectsSphere(Rs,n)),!T){const U=d[E];h[x]=U.start*c,f[x]=U.count,y[x]=v,x++}}g.needsUpdate=!0,this._multiDrawCount=x,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,s,o){this.onBeforeRender(e,null,i,s,o)}}class ai extends Kn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new rt(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 fh=new B,dh=new B,Rv=new bt,Ba=new to,tu=new Hn,Td=new B,Iv=new B;class us extends Jt{constructor(e=new zt,t=new ai){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,s=t.count;i<s;i++)fh.fromBufferAttribute(t,i-1),dh.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=fh.distanceTo(dh);e.setAttribute("lineDistance",new ht(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),tu.copy(n.boundingSphere),tu.applyMatrix4(i),tu.radius+=s,e.ray.intersectsSphere(tu)===!1)return;Rv.copy(i).invert(),Ba.copy(e.ray).applyMatrix4(Rv);const c=s/((this.scale.x+this.scale.y+this.scale.z)/3),u=c*c,h=this.isLineSegments?2:1,f=n.index,m=n.attributes.position;if(f!==null){const g=Math.max(0,o.start),y=Math.min(f.count,o.start+o.count);for(let M=g,x=y-1;M<x;M+=h){const v=f.getX(M),w=f.getX(M+1),E=nu(this,e,Ba,u,v,w,M);
vendor: 5,980 bytes, line 44
44E&&t.push(E)}if(this.isLineLoop){const M=f.getX(y-1),x=f.getX(g),v=nu(this,e,Ba,u,M,x,y-1);v&&t.push(v)}}else{const g=Math.max(0,o.start),y=Math.min(m.count,o.start+o.count);for(let M=g,x=y-1;M<x;M+=h){const v=nu(this,e,Ba,u,M,M+1,M);v&&t.push(v)}if(this.isLineLoop){const M=nu(this,e,Ba,u,y-1,g,y-1);M&&t.push(M)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const c=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=s}}}}}function nu(r,e,t,n,i,s,o){const c=r.geometry.attributes.position;if(fh.fromBufferAttribute(c,i),dh.fromBufferAttribute(c,s),t.distanceSqToSegment(fh,dh,Td,Iv)>n)return;Td.applyMatrix4(r.matrixWorld);const h=e.ray.origin.distanceTo(Td);if(!(h<e.near||h>e.far))return{distance:h,point:Iv.clone().applyMatrix4(r.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:r}}const Pv=new B,Lv=new B;class vr extends us{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,s=t.count;i<s;i+=2)Pv.fromBufferAttribute(t,i),Lv.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+Pv.distanceTo(Lv);e.setAttribute("lineDistance",new ht(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class $_ extends us{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Bp extends Kn{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new rt(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 Dv=new bt,lp=new to,iu=new Hn,ru=new B;class ey extends Jt{constructor(e=new zt,t=new Bp){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),iu.copy(n.boundingSphere),iu.applyMatrix4(i),iu.radius+=s,e.ray.intersectsSphere(iu)===!1)return;Dv.copy(i).invert(),lp.copy(e.ray).applyMatrix4(Dv);const c=s/((this.scale.x+this.scale.y+this.scale.z)/3),u=c*c,h=n.index,d=n.attributes.position;if(h!==null){const m=Math.max(0,o.start),g=Math.min(h.count,o.start+o.count);for(let y=m,M=g;y<M;y++){const x=h.getX(y);ru.fromBufferAttribute(d,x),Uv(ru,x,u,i,e,t,this)}}else{const m=Math.max(0,o.start),g=Math.min(d.count,o.start+o.count);for(let y=m,M=g;y<M;y++)ru.fromBufferAttribute(d,y),Uv(ru,y,u,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s<o;s++){const c=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=s}}}}}function Uv(r,e,t,n,i,s,o){const c=lp.distanceSqToPoint(r);if(c<t){const u=new B;lp.closestPointToPoint(r,u),u.applyMatrix4(n);const h=i.ray.origin.distanceTo(u);if(h<i.near||h>i.far)return;s.push({distance:h,distanceToRay:Math.sqrt(c),point:u,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class ty extends sn{constructor(e,t,n,i,s=tn,o=tn,c,u,h){super(e,t,n,i,s,o,c,u,h),this.isVideoTexture=!0,this.generateMipmaps=!1;const f=this;function d(){f.needsUpdate=!0,e.requestVideoFrameCallback(d)}"requestVideoFrameCallback"in e&&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)}}class f1 extends ty{constructor(e,t,n,i,s,o,c,u){super({},e,t,n,i,s,o,c,u),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class d1 extends sn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=kn,this.minFilter=kn,this.generateMipmaps=!1,this.needsUpdate=!0}}class Ph extends sn{constructor(e,t,n,i,s,o,c,u,h,f,d,m){super(null,o,c,u,h,f,i,s,d,m),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class p1 extends Ph{constructor(e,t,n,i,s,o){super(e,t,n,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Cn,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class m1 extends Ph{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,dr),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class g1 extends sn{constructor(e,t,n,i,s,o,c,u,h){super(e,t,n,i,s,o,c,u,h),this.isCanvasTexture=!0,this.needsUpdate=!0}}class zp extends sn{constructor(e,t,n=pr,i,s,o,c=kn,u=kn,h,f=$o,d=1){if(f!==$o&&f!==ea)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const m={width:e,height:t,depth:d};super(m,i,s,o,c,u,f,n,h),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new ss(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 Lh extends zt{constructor(e=1,t=1,n=4,i=8,s=1){super(),this.type="CapsuleGeometry",this.parameters={radiu
44s:e,height:t,capSegments:n,radialSegments:i,heightSegments:s},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),i=Math.max(3,Math.floor(i)),s=Math.max(1,Math.floor(s));const o=[],c=[],u=[],h=[],f=t/2,d=Math.PI/2*e,m=t,g=2*d+m,y=n*2+s,M=i+1,x=new B,v=new B;for(let w=0;w<=y;w++){let E=0,T=0,U=0,I=0;if(w<=n){const C=w/n,A=C*Math.PI/2;T=-f-e*Math.cos(A),U=e*Math.sin(A),I=-e*Math.cos(A),E=C*d}else if(w<=n+s){const C=(w-n)/s;T=-f+C*t,U=e,I=0,E=d+C*m}else{const C=(w-n-s)/n,A=C*Math.PI/2;T=f+e*Math.sin(A),U=e*Math.cos(A),I=e*Math.sin(A),E=d+m+C*d}const N=Math.max(0,Math.min(1,E/g));let D=0;w===0?D=.5/i:w===y&&(D=-.5/i);for(let C=0;C<=i;C++){const A=C/i,F=A*Math.PI*2,j=Math.sin(F),Z=Math.cos(F);v.x=-U*Z,v.y=T,v.z=U*j,c.push(v.x,v.y,v.z),x.set(-U*Z,I,U*j),x.normalize(),u.push(x.x,x.y,x.z),h.push(A+D,N)}if(w>0){const C=(w-1)*M;for(let A=0;A<i;A++){const F=C+A,j=C+A+1,Z=w*M+A,$=w*M+A+1;o.push(F,j,Z),o.push(j,$,Z)}}}this.setIndex(o),this.setAttribute("position",new ht(c,3)),this.setAttribute("normal",new ht(u,3)),this.setAttribute("uv",new ht(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Lh(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class Dh extends zt{constructor(e=1,t=32,n=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const s=[],o=[],c=[],u=[],h=new B,f=new we;o.push(0,0,0),c.push(0,0,1),u.push(.5,.5);for(let d=0,m=3;d<=t;d++,m+=3){const g=n+d/t*i;h.x=e*Math.cos(g),h.y=e*Math.sin(g),o.push(h.x,h.y,h.z),c.push(0,0,1),f.x=(o[m]/e+1)/2,f.y=(o[m+1]/e+1)/2,u.push(f.x,f.y)}for(let d=1;d<=t;d++)s.push(d,d+1,0);this.setIndex(s),this.setAttribute("position",new ht(o,3)),this.setAttribute("normal",new ht(c,3)),this.setAttribute("uv",new ht(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Dh(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Pl extends zt{constructor(e=1,t=1,n=1,i=32,s=1,o=!1,c=0,u=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:c,thetaLength:u};const h=this;i=Math.floor(i),s=Math.floor(s);const f=[],d=[],m=[],g=[];let y=0;const M=[],x=n/2;let v=0;w(),o===!1&&(e>0&&E(!0),t>0&&E(!1)),this.setIndex(f),this.setAttribute("position",new ht(d,3)),this.setAttribute("normal",new ht(m,3)),this.setAttribute("uv",new ht(g,2));function w(){const T=new B,U=new B;let I=0;const N=(t-e)/n;for(let D=0;D<=s;D++){const C=[],A=D/s,F=A*(t-e)+e;for(let j=0;j<=i;j++){const Z=j/i,$=Z*u+c,ae=Math.sin($),ne=Math.cos($);U.x=F*ae,U.y=-A*n+x,U.z=F*ne,d.push(U.x,U.y,U.z),T.set(ae,N,ne).normalize(),m.push(T.x,T.y,T.z),g.push(Z,1-A),C.push(y++)}M.push(C)}for(let D=0;D<i;D++)for(let C=0;C<s;C++){const A=M[C][D],F=M[C+1][D],j=M[C+1][D+1],Z=M[C][D+1];(e>0||C!==0)&&(f.push(A,F,Z),I+=3),(t>0||C!==s-1)&&(f.push(F,j,Z),I+=3)}h.addGroup(v,I,0),v+=I}function E(T){const U=y,I=new we,N=new B;let D=0;const C=T===!0?e:t,A=T===!0?1:-1;for(let j=1;j<=i;j++)d.push(0,x*A,0),m.push(0,A,0),g.push(.5,.5),y++;const F=y;for(let j=0;j<=i;j++){const $=j/i*u+c,ae=Math.cos($),ne=Math.sin($);N.x=C*ne,N.y=x*A,N.z=C*ae,d.push(N.x,N.y,N.z),m.push(0,A,0),I.x=ae*.5+.5,I.y=ne*.5*A+.5,g.push(I.x,I.y),y++}for(let j=0;j<i;j++){const Z=U+j,$=F+j;T===!0?f.push($,$+1,Z):f.push($+1,$,Z),D+=3}h.addGroup(v,D,T===!0?1:2),v+=D}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Pl(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Ll extends Pl{constructor(e=1,t=1,n=32,i=1,s=!1,o=0,c=Math.PI*2){super(0,e,t,n,i,s,o,c),this.type="C
44oneGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:s,thetaStart:o,thetaLength:c}}static fromJSON(e){return new Ll(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class fs extends zt{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const s=[],o=[];c(i),h(n),f(),this.setAttribute("position",new ht(s,3)),this.setAttribute("normal",new ht(s.slice(),3)),this.setAttribute("uv",new ht(o,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function c(w){const E=new B,T=new B,U=new B;for(let I=0;I<t.length;I+=3)g(t[I+0],E),g(t[I+1],T),g(t[I+2],U),u(E,T,U,w)}function u(w,E,T,U){const I=U+1,N=[];for(let D=0;D<=I;D++){N[D]=[];const C=w.clone().lerp(T,D/I),A=E.clone().lerp(T,D/I),F=I-D;for(let j=0;j<=F;j++)j===0&&D===I?N[D][j]=C:N[D][j]=C.clone().lerp(A,j/F)}for(let D=0;D<I;D++)for(let C=0;C<2*(I-D)-1;C++){const A=Math.floor(C/2);C%2===0?(m(N[D][A+1]),m(N[D+1][A]),m(N[D][A])):(m(N[D][A+1]),m(N[D+1][A+1]),m(N[D+1][A]))}}function h(w){const E=new B;for(let T=0;T<s.length;T+=3)E.x=s[T+0],E.y=s[T+1],E.z=s[T+2],E.normalize().multiplyScalar(w),s[T+0]=E.x,s[T+1]=E.y,s[T+2]=E.z}function f(){const w=new B;for(let E=0;E<s.length;E+=3){w.x=s[E+0],w.y=s[E+1],w.z=s[E+2];const T=x(w)/2/Math.PI+.5,U=v(w)/Math.PI+.5;o.push(T,1-U)}y(),d()}function d(){for(let w=0;w<o.length;w+=6){const E=o[w+0],T=o[w+2],U=o[w+4],I=Math.max(E,T,U),N=Math.min(E,T,U);I>.9&&N<.1&&(E<.2&&(o[w+0]+=1),T<.2&&(o[w+2]+=1),U<.2&&(o[w+4]+=1))}}function m(w){s.push(w.x,w.y,w.z)}function g(w,E){const T=w*3;E.x=e[T+0],E.y=e[T+1],E.z=e[T+2]}function y(){const w=new B,E=new B,T=new B,U=new B,I=new we,N=new we,D=new we;for(let C=0,A=0;C<s.length;C+=9,A+=6){w.set(s[C+0],s[C+1],s[C+2]),E.set(s[C+3],s[C+4],s[C+5]),T.set(s[C+6],s[C+7],s[C+8]),I.set(o[A+0],o[A+1]),N.set(o[A+2],o[A+3]),D.set(o[A+4],o[A+5]),U.copy(w).add(E).add(T).divideScalar(3);const F=x(U);M(I,A+0,w,F),M(N,A+2,E,F),M(D,A+4,T,F)}}function M(w,E,T,U){U<0&&w.x===1&&(o[E]=w.x-1),T.x===0&&T.z===0&&(o[E]=U/2/Math.PI+.5)}function x(w){return Math.atan2(w.z,-w.x)}function v(w){return Math.atan2(-w.y,Math.sqrt(w.x*w.x+w.z*w.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new fs(e.vertices,e.indices,e.radius,e.details)}}class Uh extends fs{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=1/n,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],o=[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,128 bytes, line 44
4419,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Uh(e.radius,e.detail)}}const su=new B,ou=new B,bd=new B,au=new mi;class ny extends zt{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const i=Math.pow(10,4),s=Math.cos(Js*t),o=e.getIndex(),c=e.getAttribute("position"),u=o?o.count:c.count,h=[0,0,0],f=["a","b","c"],d=new Array(3),m={},g=[];for(let y=0;y<u;y+=3){o?(h[0]=o.getX(y),h[1]=o.getX(y+1),h[2]=o.getX(y+2)):(h[0]=y,h[1]=y+1,h[2]=y+2);const{a:M,b:x,c:v}=au;if(M.fromBufferAttribute(c,h[0]),x.fromBufferAttribute(c,h[1]),v.fromBufferAttribute(c,h[2]),au.getNormal(bd),d[0]=`${Math.round(M.x*i)},${Math.round(M.y*i)},${Math.round(M.z*i)}`,d[1]=`${Math.round(x.x*i)},${Math.round(x.y*i)},${Math.round(x.z*i)}`,d[2]=`${Math.round(v.x*i)},${Math.round(v.y*i)},${Math.round(v.z*i)}`,!(d[0]===d[1]||d[1]===d[2]||d[2]===d[0]))for(let w=0;w<3;w++){const E=(w+1)%3,T=d[w],U=d[E],I=au[f[w]],N=au[f[E]],D=`${T}_${U}`,C=`${U}_${T}`;C in m&&m[C]?(bd.dot(m[C].normal)<=s&&(g.push(I.x,I.y,I.z),g.push(N.x,N.y,N.z)),m[C]=null):D in m||(m[D]={index0:h[w],index1:h[E],normal:bd.clone()})}}for(const y in m)if(m[y]){const{index0:M,index1:x}=m[y];su.fromBufferAttribute(c,M),ou.fromBufferAttribute(c,x),g.push(su.x,su.y,su.z),g.push(ou.x,ou.y,ou.z)}this.setAttribute("position",new ht(g,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Qi{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){console.warn("THREE.Curve: .getPoint() not implemented.")}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let i=0;const s=n.length;let o;t?o=t:o=e*n[s-1];let c=0,u=s-1,h;for(;c<=u;)if(i=Math.floor(c+(u-c)/2),h=n[i]-o,h<0)c=i+1;else if(h>0)u=i-1;else{u=i;break}if(i=u,n[i]===o)return i/(s-1);const f=n[i],m=n[i+1]-f,g=(o-f)/m;return(i+g)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),c=this.getPoint(s),u=t||(o.isVector2?new we:new B);return u.copy(c).sub(o).normalize(),u}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new B,i=[],s=[],o=[],c=new B,u=new bt;for(let g=0;g<=e;g++){const y=g/e;i[g]=this.getTangentAt(y,new B)}s[0]=new B,o[0]=new B;let h=Number.MAX_VALUE;const f=Math.abs(i[0].x),d=Math.abs(i[0].y),m=Math.abs(i[0].z);f<=h&&(h=f,n.set(1,0,0)),d<=h&&(h=d,n.set(0,1,0)),m<=h&&n.set(0,0,1),c.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],c),o[0].crossVectors(i[0],s[0]);for(let g=1;g<=e;g++){if(s[g]=s[g-1].clone(),o[g]=o[g-1].clone(),c.crossVectors(i[g-1],i[g]),c.length()>Number.EPSILON){c.normalize();const y=Math.acos(Rt(i[g-1].dot(i[g]),-1,1));s[g].applyMatrix4(u.makeRotationAxis(c,y))}o[g].crossVectors(i[g],s[g])}if(t===!0){let g=Math.acos(Rt(s[0].dot(s[e]),-1,1));g/=e,i[0].dot(c.crossVectors(s[0],s[e]))>0&&(g=-g);for(let y=1;y<=e;y++)s[y].applyMatrix4(u.makeRotationAxis(i[y],g*y)),o[y].crossVectors(i[y],s[y])}return{tangents:i,normals:s,binormals:o}}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 Nh extends Qi{constructor(e=0,t=0,n=1,i=1,s=0,o=Math.PI*2,c=!1,u=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=c,this.aRotation=u}getPoint(e,t=new we){const n=t,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(o?s=0:s=i),this.aClockwise===!0&&!o&&(s===i?s=-i:s=s-i);const c=this.aStartAngle+e*s;let u=this.aX+this.xRadius*Math.cos(c),h=this.aY+this.yRadius*Math.sin(c);if(this.aRotation!==0){const f=Math.cos(this.aRotation),d=Math.sin(this.aRotation),m=u-this.aX,g=h-this.aY;u=m*f-g*d+this.aX,h=m*d+g*f+this.aY}return n.set(u,h)}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 iy extends Nh{constructor(e,t,n,i,s,o){super(e,t,n,n,i,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function kp(){let r=0,e=0,t=0,n=0;function i(s,o,c,u){r=s,e=c,t=-3*s+3*o-2*c-u,n=2*s-2*o+c+u}return{initCatmullRom:function(s,o,c,u,h){i(o,c,h*(c-s),h*(u-o))},initNonuniformCatmullRom:function(s,o,c,u,h,f,d){let m=(o-s)/h-(c-s)/(h+f)+(c-o)/f,g=(c-o)/f-(u-o)/(f+d)+(u-c)/d;m*=f,g*=f,i(o,c,m,g)},calc:function(s){const o=s*s,c=o*s;return r+e*s+t*o+n*c}}}const lu=new B,Ad=new kp,Cd=new kp,Rd=new kp;class ry extends Qi{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 B){const n=t,i=this.points,s=i.length,o=(s-(this.closed?0:1))*e;let c=Math.floor(o),u=o-c;this.closed?c+=c>0?0:(Math.floor(Math.abs(c)/s)+1)*s:u===0&&c===s-1&&(c=s-2,u=1);let h,f;this.closed||c>0?h=i[(c-1)%s]:(lu.subVectors(i[0],i[1]).add(i[0]),h=lu);const d=i[c%s],m=i[(c+1)%s];if(this.closed||c+2<s?f=i[(c+2)%s]:(lu.subVectors(i[s-1],i[s-2]).add(i[s-1]),f=lu),this.curveType==="centripetal"||this.curveType==="chordal"){const g=this.curveType==="chordal"?.5:.25;let y=Math.pow(h.distanceToSquared(d),g),M=Math.pow(d.distanceToSquared(m),g),x=Math.pow(m.distanceToSquared(f),g);M<1e-4&&(M=1),y<1e-4&&(y=M),x<1e-4&&(x=M),Ad.initNonuniformCatmullRom(h.x,d.x,m.x,f.x,y,M,x),Cd.initNonuniformCatmullRom(h.y,d.y,m.y,f.y,y,M,x),Rd.initNonuniformCatmullRom(h.z,d.z,m.z,f.z,y,M,x)}else this.curveType==="catmullrom"&&(Ad.initCatmullRom(h.x,d.x,m.x,f.x,this.tension),Cd.initCatmullRom(h.y,d.y,m.y,f.y,this.tension),Rd.initCatmullRom(h.z,d.z,m.z,f.z,this.tension));return n.set(Ad.calc(u),Cd.calc(u),Rd.calc(u)),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 B().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function Nv(r,e,t,n,i){const s=(n-e)*.5,o=(i-t)*.5,c=r*r,u=r*c;return(2*t-2*n+s+o)*u+(-3*t+3*n-2*s-o)*c+s*r+t}function v1(r,e){const t=1-r;return t*t*e}function _1(r,e){return 2*(1-r)*r*e}function y1(r,e){return r*r*e}function tl(r,e,t,n){return v1(r,e)+_1(r,t)+y1(r,n)}function x1(r,e){const t=1-r;return t*t*t*e}function S1(r,e){const t=1-r;return 3*t*t*r*e}function M1(r,e){return 3*(1-r)*r*r*e}function w1(r,e){return r*r*r*e}function nl(r,e,t,n,i){return x1(r,e)+S1(r,t)+M1(r,n)+w1(r,i)}class Hp extends Qi{constructor(e=new we,t=new we,n=new we,i=new we){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new we){const n=t,i=this.v0,s=this.v1,o=this.v2,c=this.v3;return n.set(nl(e,i.x,s.x,o.x,c.x),nl(e,i.y,s.y,o.y,c.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 sy extends Qi{constructor(e=new B,t=new B,n=new B,i=new B){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new B){const n=t,i=this.v0,s=this.v1,o=this.v2,c=this.v3;return n.set(nl(e,i.x,s.x,o.x,c.x),nl(e,i.y,s.y,o.y,c.y),nl(e,i.z,s.z,o.z,c.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 Vp extends Qi{constructor(e=new we,t=new we){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new we){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: 9,801 bytes, line 44
44getTangent(e,t=new we){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 oy extends Qi{constructor(e=new B,t=new B){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new B){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 B){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 Gp extends Qi{constructor(e=new we,t=new we,n=new we){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new we){const n=t,i=this.v0,s=this.v1,o=this.v2;return n.set(tl(e,i.x,s.x,o.x),tl(e,i.y,s.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}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 Wp extends Qi{constructor(e=new B,t=new B,n=new B){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new B){const n=t,i=this.v0,s=this.v1,o=this.v2;return n.set(tl(e,i.x,s.x,o.x),tl(e,i.y,s.y,o.y),tl(e,i.z,s.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}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 Xp extends Qi{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new we){const n=t,i=this.points,s=(i.length-1)*e,o=Math.floor(s),c=s-o,u=i[o===0?o:o-1],h=i[o],f=i[o>i.length-2?i.length-1:o+1],d=i[o>i.length-3?i.length-1:o+2];return n.set(Nv(c,u.x,h.x,f.x,d.x),Nv(c,u.y,h.y,f.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 we().fromArray(i))}return this}}var ph=Object.freeze({__proto__:null,ArcCurve:iy,CatmullRomCurve3:ry,CubicBezierCurve:Hp,CubicBezierCurve3:sy,EllipseCurve:Nh,LineCurve:Vp,LineCurve3:oy,QuadraticBezierCurve:Gp,QuadraticBezierCurve3:Wp,SplineCurve:Xp});class ay extends Qi{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 ph[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=n){const o=i[s]-n,c=this.curves[s],u=c.getLength(),h=u===0?0:1-o/u;return c.getPointAt(h,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,s=this.curves;i<s.length;i++){const o=s[i],c=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,u=o.getPoints(c);for(let h=0;h<u.length;h++){const f=u[h];n&&n.equals(f)||(t.push(f),n=f)}}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 ph[i.type]().fromJSON(i))}return this}}class mh extends ay{constructor(e){super(),this.type="Path",this.currentPoint=new we,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 Vp(this.currentPoint.clone(),new we(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const s=new Gp(this.currentPoint.clone(),new we(e,t),new we(n,i));return this.curves.push(s),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,s,o){const c=new Hp(this.currentPoint.clone(),new we(e,t),new we(n,i),new we(s,o));return this.curves.push(c),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new Xp(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,s,o){const c=this.currentPoint.x,u=this.currentPoint.y;return this.absarc(e+c,t+u,n,i,s,o),this}absarc(e,t,n,i,s,o){return this.absellipse(e,t,n,n,i,s,o),this}ellipse(e,t,n,i,s,o,c,u){const h=this.currentPoint.x,f=this.currentPoint.y;return this.absellipse(e+h,t+f,n,i,s,o,c,u),this}absellipse(e,t,n,i,s,o,c,u){const h=new Nh(e,t,n,i,s,o,c,u);if(this.curves.length>0){const d=h.getPoint(0);d.equals(this.currentPoint)||this.lineTo(d.x,d.y)}this.curves.push(h);const f=h.getPoint(1);return this.currentPoint.copy(f),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 as extends mh{constructor(e){super(e),this.uuid=Ti(),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 mh().fromJSON(i))}return this}}function E1(r,e,t=2){const n=e&&e.length,i=n?e[0]*t:r.length;let s=ly(r,0,i,t,!0);const o=[];if(!s||s.next===s.prev)return o;let c,u,h;if(n&&(s=R1(r,e,s,t)),r.length>80*t){c=1/0,u=1/0;let f=-1/0,d=-1/0;for(let m=t;m<i;m+=t){const g=r[m],y=r[m+1];g<c&&(c=g),y<u&&(u=y),g>f&&(f=g),y>d&&(d=y)}h=Math.max(f-c,d-u),h=h!==0?32767/h:0}return dl(s,o,t,c,u,h,0),o}function ly(r,e,t,n,i){let s;if(i===k1(r,e,t,n)>0)for(let o=e;o<t;o+=n)s=Fv(o/n|0,r[o],r[o+1],s);else for(let o=t-n;o>=e;o-=n)s=Fv(o/n|0,r[o],r[o+1],s);return s&&ra(s,s.next)&&(ml(s),s=s.next),s}function eo(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(ra(t,t.next)||dn(t.prev,t,t.next)===0)){if(ml(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function dl(r,e,t,n,i,s,o){if(!r)return;!o&&s&&U1(r,n,i,s);let c=r;for(;r.prev!==r.next;){const u=r.prev,h=r.next;if(s?b1(r,n,i,s):T1(r)){e.push(u.i,r.i,h.i),ml(r),r=h.next,c=h.next;continue}if(r=h,r===c){o?o===1?(r=A1(eo(r),e),dl(r,e,t,n,i,s,2)):o===2&&C1(r,e,t,n,i,s):dl(eo(r),e,t,n,i,s,1);break}}}function T1(r){const e=r.prev,t=r,n=r.next;if(dn(e,t,n)>=0)return!1;const i=e.x,s=t.x,o=n.x,c=e.y,u=t.y,h=n.y,f=Math.min(i,s,o),d=Math.min(c,u,h),m=Math.max(i,s,o),g=Math.max(c,u,h);let y=n.next;for(;y!==e;){if(y.x>=f&&y.x<=m&&y.y>=d&&y.y<=g&&Xa(i,c,s,u,o,h,y.x,y.y)&&dn(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function b1(r,e,t,n){const i=r.prev,s=r,o=r.next;if(dn(i,s,o)>=0)return!1;const c=i.x,u=s.x,h=o.x,f=i.y,d=s.y,m=o.y,g=Math.min(c,u,h),y=Math.min(f,d,m),M=Math.max(c,u,h),x=Math.max(f,d,m),v=cp(g,y,e,t,n),w=cp(M,x,e,t,n);let E=r.prevZ,T=r.nextZ;for(;E&&E.z>=v&&T&&T.z<=w;){if(E.x>=g&&E.x<=M&&E.y>=y&&E.y<=x&&E!==i&&E!==o&&Xa(c,f,u,d,h,m,E.x,E.y)&&dn(E.prev,E,E.next)>=0||(E=E.prevZ,T.x>=g&&T.x<=M&&T.y>=y&&T.y<=x&&T!==i&&T!==o&&Xa(c,f,u,d,h,m,T.x,T.y)&&dn(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;E&&E.z>=v;){if(E.x>=g&&E.x<=M&&E.y>=y&&E.y<=x&&E!==i&&E!==o&&Xa(c,f,u,d,h,m,E.x,E.y)&&dn(E.prev,E,E.next)>=0)return!1;E=E.prevZ}for(;T&&T.z<=w;){if(T.x>=g&&T.x<=M&&T.y>=y&&T.y<=x&&T!==i&&T!==o&&Xa(c,f,u,d,h,m,T.x,T.y)&&dn(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function A1(r,e){let t=r;do{const n=t.prev,i=t.next.next;!ra(n,i)&&uy(n,t,t.next,i)&&pl(n,i)&&pl(i,n)&&(e.push(n.i,t.i,i.i),ml(t),ml(t.next),t=r=i),t=t.next}
vendor: 2,715 bytes, line 44
44while(t!==r);return eo(t)}function C1(r,e,t,n,i,s){let o=r;do{let c=o.next.next;for(;c!==o.prev;){if(o.i!==c.i&&O1(o,c)){let u=hy(o,c);o=eo(o,o.next),u=eo(u,u.next),dl(o,e,t,n,i,s,0),dl(u,e,t,n,i,s,0);return}c=c.next}o=o.next}while(o!==r)}function R1(r,e,t,n){const i=[];for(let s=0,o=e.length;s<o;s++){const c=e[s]*n,u=s<o-1?e[s+1]*n:r.length,h=ly(r,c,u,n,!1);h===h.next&&(h.steiner=!0),i.push(F1(h))}i.sort(I1);for(let s=0;s<i.length;s++)t=P1(i[s],t);return t}function I1(r,e){let t=r.x-e.x;if(t===0&&(t=r.y-e.y,t===0)){const n=(r.next.y-r.y)/(r.next.x-r.x),i=(e.next.y-e.y)/(e.next.x-e.x);t=n-i}return t}function P1(r,e){const t=L1(r,e);if(!t)return e;const n=hy(t,r);return eo(n,n.next),eo(t,t.next)}function L1(r,e){let t=e;const n=r.x,i=r.y;let s=-1/0,o;if(ra(r,t))return t;do{if(ra(r,t.next))return t.next;if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const d=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=n&&d>s&&(s=d,o=t.x<t.next.x?t:t.next,d===n))return o}t=t.next}while(t!==e);if(!o)return null;const c=o,u=o.x,h=o.y;let f=1/0;t=o;do{if(n>=t.x&&t.x>=u&&n!==t.x&&cy(i<h?n:s,i,u,h,i<h?s:n,i,t.x,t.y)){const d=Math.abs(i-t.y)/(n-t.x);pl(t,r)&&(d<f||d===f&&(t.x>o.x||t.x===o.x&&D1(o,t)))&&(o=t,f=d)}t=t.next}while(t!==c);return o}function D1(r,e){return dn(r.prev,r,e.prev)<0&&dn(e.next,r,r.next)<0}function U1(r,e,t,n){let i=r;do i.z===0&&(i.z=cp(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,N1(i)}function N1(r){let e,t=1;do{let n=r,i;r=null;let s=null;for(e=0;n;){e++;let o=n,c=0;for(let h=0;h<t&&(c++,o=o.nextZ,!!o);h++);let u=t;for(;c>0||u>0&&o;)c!==0&&(u===0||!o||n.z<=o.z)?(i=n,n=n.nextZ,c--):(i=o,o=o.nextZ,u--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;n=o}s.nextZ=null,t*=2}while(e>1);return r}function cp(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function F1(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function cy(r,e,t,n,i,s,o,c){return(i-o)*(e-c)>=(r-o)*(s-c)&&(r-o)*(n-c)>=(t-o)*(e-c)&&(t-o)*(s-c)>=(i-o)*(n-c)}function Xa(r,e,t,n,i,s,o,c){return!(r===o&&e===c)&&cy(r,e,t,n,i,s,o,c)}function O1(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!B1(r,e)&&(pl(r,e)&&pl(e,r)&&z1(r,e)&&(dn(r.prev,r,e.prev)||dn(r,e.prev,e))||ra(r,e)&&dn(r.prev,r,r.next)>0&&dn(e.prev,e,e.next)>0)}function dn(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function ra(r,e){return r.x===e.x&&r.y===e.y}function uy(r,e,t,n){const i=uu(dn(r,e,t)),s=uu(dn(r,e,n)),o=uu(dn(t,n,r)),c=uu(dn(t,n,e));return!!(i!==s&&o!==c||i===0&&cu(r,t,e)||s===0&&cu(r,n,e)||o===0&&
vendor: 60,023 bytes, line 44
44cu(t,r,n)||c===0&&cu(t,e,n))}function cu(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function uu(r){return r>0?1:r<0?-1:0}function B1(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&uy(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function pl(r,e){return dn(r.prev,r,r.next)<0?dn(r,e,r.next)>=0&&dn(r,r.prev,e)>=0:dn(r,e,r.prev)<0||dn(r,r.next,e)<0}function z1(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function hy(r,e){const t=up(r.i,r.x,r.y),n=up(e.i,e.x,e.y),i=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function Fv(r,e,t,n){const i=up(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function ml(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function up(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function k1(r,e,t,n){let i=0;for(let s=e,o=t-n;s<t;s+=n)i+=(r[o]-r[s])*(r[s+1]+r[o+1]),o=s;return i}class H1{static triangulate(e,t,n=2){return E1(e,t,n)}}class Ji{static area(e){const t=e.length;let n=0;for(let i=t-1,s=0;s<t;i=s++)n+=e[i].x*e[s].y-e[s].x*e[i].y;return n*.5}static isClockWise(e){return Ji.area(e)<0}static triangulateShape(e,t){const n=[],i=[],s=[];Ov(e),Bv(n,e);let o=e.length;t.forEach(Ov);for(let u=0;u<t.length;u++)i.push(o),o+=t[u].length,Bv(n,t[u]);const c=H1.triangulate(n,i);for(let u=0;u<c.length;u+=3)s.push(c.slice(u,u+3));return s}}function Ov(r){const e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function Bv(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}class Fh extends zt{constructor(e=new as([new we(.5,.5),new we(-.5,.5),new we(-.5,-.5),new we(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],s=[];for(let c=0,u=e.length;c<u;c++){const h=e[c];o(h)}this.setAttribute("position",new ht(i,3)),this.setAttribute("uv",new ht(s,2)),this.computeVertexNormals();function o(c){const u=[],h=t.curveSegments!==void 0?t.curveSegments:12,f=t.steps!==void 0?t.steps:1,d=t.depth!==void 0?t.depth:1;let m=t.bevelEnabled!==void 0?t.bevelEnabled:!0,g=t.bevelThickness!==void 0?t.bevelThickness:.2,y=t.bevelSize!==void 0?t.bevelSize:g-.1,M=t.bevelOffset!==void 0?t.bevelOffset:0,x=t.bevelSegments!==void 0?t.bevelSegments:3;const v=t.extrudePath,w=t.UVGenerator!==void 0?t.UVGenerator:V1;let E,T=!1,U,I,N,D;v&&(E=v.getSpacedPoints(f),T=!0,m=!1,U=v.computeFrenetFrames(f,!1),I=new B,N=new B,D=new B),m||(x=0,g=0,y=0,M=0);const C=c.extractPoints(h);let A=C.shape;const F=C.holes;if(!Ji.isClockWise(A)){A=A.reverse();for(let z=0,Ve=F.length;z<Ve;z++){const Ue=F[z];Ji.isClockWise(Ue)&&(F[z]=Ue.reverse())}}function Z(z){const Ue=10000000000000001e-36;let We=z[0];for(let Me=1;Me<=z.length;Me++){const et=Me%z.length,Ne=z[et],it=Ne.x-We.x,wt=Ne.y-We.y,H=it*it+wt*wt,L=Math.max(Math.abs(Ne.x),Math.abs(Ne.y),Math.abs(We.x),Math.abs(We.y)),se=Ue*L*L;if(H<=se){z.splice(et,1),Me--;continue}We=Ne}}Z(A),F.forEach(Z);const $=F.length,ae=A;for(let z=0;z<$;z++){const Ve=F[z];A=A.concat(Ve)}function ne(z,Ve,Ue){return Ve||console.error("THREE.ExtrudeGeometry: vec does not exist"),z.clone().addScaledVector(Ve,Ue)}const xe=A.length;function k(z,Ve,Ue){let We,Me,et;const Ne=z.x-Ve.x,it=z.y-Ve.y,wt=Ue.x-z.x,H=Ue.y-z.y,L=Ne*Ne+it*it,se=Ne*H-it*wt;if(Math.abs(se)>Number.EPSILON){const me=Math.sqrt(L),be=Math.sqrt(wt*wt+H*H),ge=Ve.x-it/me,st=Ve.y+Ne/me,Ye=Ue.x-H/be,ot=Ue.y+wt/be,lt=((Ye-ge)*H-(ot-st)*wt)/(Ne*H-it*wt);We=ge+Ne*lt-z.x,Me=st+it*lt-z.y;const Ae=We*We+Me*Me;if(Ae<=2)return new we(We,Me);et=Math.sqrt(Ae/2)}else{let me=!1;Ne>Number.EPSILON?wt>Number.EPSILON&&(me=!0):Ne<-Number.EPSILON?wt<-Number.EPSILON&&(me=!0):Math.sign(it)===Math.sign(H)&&(me=!0),me?(We=-it,Me=Ne,et=Math.sqrt(L)):(We=Ne,Me=it,et=Math.sqrt(L/2))}return new we(We/et,Me/et)}const ee=[];for(let z=0,Ve=ae.length,Ue=Ve-1,We=z+1;z<Ve;z++,Ue++,We++)Ue===Ve&&(Ue=0),We===Ve&&(We=0),ee[z]=k(ae[z],ae[Ue],ae[We]);const Q=[];let fe,Se=ee.concat();for(let z=0,Ve=$;z<Ve;z++){const Ue=F[z];fe=[];for(let We=0,Me=Ue.length,et=Me-1,Ne=We+1;We<Me;We++,et++,Ne++)et===Me&&(et=0),Ne===Me&&(Ne=0),fe[We]=k(Ue[We],Ue[et],Ue[Ne]);Q.push(fe),Se=Se.concat(fe)}let ke;if(x===0)ke=Ji.triangulateShape(ae,F);else{const z=[],Ve=[];for(let Ue=0;Ue<x;Ue++){const We=Ue/x,Me=g*Math.cos(We*Math.PI/2),et=y*Math.sin(We*Math.PI/2)+M;for(let Ne=0,it=ae.length;Ne<it;Ne++){const wt=ne(ae[Ne],ee[Ne],et);Et(wt.x,wt.y,-Me),We===0&&z.push(wt)}for(let Ne=0,it=$;Ne<it;Ne++){const wt=F[Ne];fe=Q[Ne];const H=[];for(let L=0,se=wt.length;L<se;L++){const me=ne(wt[L],fe[L],et);Et(me.x,me.y,-Me),We===0&&H.push(me)}We===0&&Ve.push(H)}}ke=Ji.triangulateShape(z,Ve)}const le=ke.length,Ie=y+M;for(let z=0;z<xe;z++){const Ve=m?ne(A[z],Se[z],Ie):A[z];T?(N.copy(U.normals[0]).multiplyScalar(Ve.x),I.copy(U.binormals[0]).multiplyScalar(Ve.y),D.copy(E[0]).add(N).add(I),Et(D.x,D.y,D.z)):Et(Ve.x,Ve.y,0)}for(let z=1;z<=f;z++)for(let Ve=0;Ve<xe;Ve++){const Ue=m?ne(A[Ve],Se[Ve],Ie):A[Ve];T?(N.copy(U.normals[z]).multiplyScalar(Ue.x),I.copy(U.binormals[z]).multiplyScalar(Ue.y),D.copy(E[z]).add(N).add(I),Et(D.x,D.y,D.z)):Et(Ue.x,Ue.y,d/f*z)}for(let z=x-1;z>=0;z--){const Ve=z/x,Ue=g*Math.cos(Ve*Math.PI/2),We=y*Math.sin(Ve*Math.PI/2)+M;for(let Me=0,et=ae.length;Me<et;Me++){const Ne=ne(ae[Me],ee[Me],We);Et(Ne.x,Ne.y,d+Ue)}for(let Me=0,et=F.length;Me<et;Me++){const Ne=F[Me];fe=Q[Me];for(let it=0,wt=Ne.length;it<wt;it++){const H=ne(Ne[it],fe[it],We);T?Et(H.x,H.y+E[f-1].y,E[f-1].x+Ue):Et(H.x,H.y,d+Ue)}}}Pe(),Be();function Pe(){const z=i.length/3;if(m){let Ve=0,Ue=xe*Ve;for(let We=0;We<le;We++){const Me=ke[We];dt(Me[2]+Ue,Me[1]+Ue,Me[0]+Ue)}Ve=f+x*2,Ue=xe*Ve;for(let We=0;We<le;We++){const Me=ke[We];dt(Me[0]+Ue,Me[1]+Ue,Me[2]+Ue)}}else{for(let Ve=0;Ve<le;Ve++){const Ue=ke[Ve];dt(Ue[2],Ue[1],Ue[0])}for(let Ve=0;Ve<le;Ve++){const Ue=ke[Ve];dt(Ue[0]+xe*f,Ue[1]+xe*f,Ue[2]+xe*f)}}n.addGroup(z,i.length/3-z,0)}function Be(){const z=i.length/3;let Ve=0;nt(ae,Ve),Ve+=ae.length;for(let Ue=0,We=F.length;Ue<We;Ue++){const Me=F[Ue];nt(Me,Ve),Ve+=Me.length}n.addGroup(z,i.length/3-z,1)}function nt(z,Ve){let Ue=z.length;for(;--Ue>=0;){const We=Ue;let Me=Ue-1;Me<0&&(Me=z.length-1);for(let et=0,Ne=f+x*2;et<Ne;et++){const it=xe*et,wt=xe*(et+1),H=Ve+We+it,L=Ve+Me+it,se=Ve+Me+wt,me=Ve+We+wt;Nt(H,L,se,me)}}}function Et(z,Ve,Ue){u.push(z),u.push(Ve),u.push(Ue)}function dt(z,Ve,Ue){It(z),It(Ve),It(Ue);const We=i.length/3,Me=w.generateTopUV(n,i,We-3,We-2,We-1);pt(Me[0]),pt(Me[1]),pt(Me[2])}function Nt(z,Ve,Ue,We){It(z),It(Ve),It(We),It(Ve),It(Ue),It(We);const Me=i.length/3,et=w.generateSideWallUV(n,i,Me-6,Me-3,Me-2,Me-1);pt(et[0]),pt(et[1]),pt(et[3]),pt(et[1]),pt(et[2]),pt(et[3])}function It(z){i.push(u[z*3+0]),i.push(u[z*3+1]),i.push(u[z*3+2])}function pt(z){s.push(z.x),s.push(z.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 G1(t,n,e)}static fromJSON(e,t){const n=[];for(let s=0,o=e.shapes.length;s<o;s++){const c=t[e.shapes[s]];n.push(c)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new ph[i.type]().fromJSON(i)),new Fh(n,e.options)}}const V1={generateTopUV:function(r,e,t,n,i){const s=e[t*3],o=e[t*3+1],c=e[n*3],u=e[n*3+1],h=e[i*3],f=e[i*3+1];return[new we(s,o),new we(c,u),new we(h,f)]},generateSideWallUV:function(r,e,t,n,i,s){const o=e[t*3],c=e[t*3+1],u=e[t*3+2],h=e[n*3],f=e[n*3+1],d=e[n*3+2],m=e[i*3],g=e[i*3+1],y=e[i*3+2],M=e[s*3],x=e[s*3+1],v=e[s*3+2];return Math.abs(c-f)<Math.abs(o-h)?[new we(o,1-u),new we(h,1-d),new we(m,1-y),new we(M,1-v)]:[new we(c,1-u),new we(f,1-d),new we(g,1-y),new we(x,1-v)]}};function G1(r,e,t){if(t.shapes=[],Array.isArray(r))for(let n=0,i=r.length;n<i;n++){const s=r[n];t.shapes.push(s.uuid)}else t.shapes.push(r.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class Dl extends fs{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Dl(e.radius,e.detail)}}class Oh extends zt{constructor(e=[new we(0,-.5),new we(.5,0),new we(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=Rt(i,0,Math.PI*2);const s=[],o=[],c=[],u=[],h=[],f=1/t,d=new B,m=new we,g=new B,y=new B,M=new B;let x=0,v=0;for(let w=0;w<=e.length-1;w++)switch(w){case 0:x=e[w+1].x-e[w].x,v=e[w+1].y-e[w].y,g.x=v*1,g.y=-x,g.z=v*0,M.copy(g),g.normalize(),u.push(g.x,g.y,g.z);break;case e.length-1:u.push(M.x,M.y,M.z);break;default:x=e[w+1].x-e[w].x,v=e[w+1].y-e[w].y,g.x=v*1,g.y=-x,g.z=v*0,y.copy(g),g.x+=M.x,g.y+=M.y,g.z+=M.z,g.normalize(),u.push(g.x,g.y,g.z),M.copy(y)}for(let w=0;w<=t;w++){const E=n+w*f*i,T=Math.sin(E),U=Math.cos(E);for(let I=0;I<=e.length-1;I++){d.x=e[I].x*T,d.y=e[I].y,d.z=e[I].x*U,o.push(d.x,d.y,d.z),m.x=w/t,m.y=I/(e.length-1),c.push(m.x,m.y);const N=u[3*I+0]*T,D=u[3*I+1],C=u[3*I+0]*U;h.push(N,D,C)}}for(let w=0;w<t;w++)for(let E=0;E<e.length-1;E++){const T=E+w*e.length,U=T,I=T+e.length,N=T+e.length+1,D=T+1;s.push(U,I,D),s.push(N,D,I)}this.setIndex(s),this.setAttribute("position",new ht(o,3)),this.setAttribute("uv",new ht(c,2)),this.setAttribute("normal",new ht(h,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Oh(e.points,e.segments,e.phiStart,e.phiLength)}}class Ul extends fs{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 Ul(e.radius,e.detail)}}class ds extends zt{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const s=e/2,o=t/2,c=Math.floor(n),u=Math.floor(i),h=c+1,f=u+1,d=e/c,m=t/u,g=[],y=[],M=[],x=[];for(let v=0;v<f;v++){const w=v*m-o;for(let E=0;E<h;E++){const T=E*d-s;y.push(T,-w,0),M.push(0,0,1),x.push(E/c),x.push(1-v/u)}}for(let v=0;v<u;v++)for(let w=0;w<c;w++){const E=w+h*v,T=w+h*(v+1),U=w+1+h*(v+1),I=w+1+h*v;g.push(E,T,I),g.push(T,U,I)}this.setIndex(g),this.setAttribute("position",new ht(y,3)),this.setAttribute("normal",new ht(M,3)),this.setAttribute("uv",new ht(x,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ds(e.width,e.height,e.widthSegments,e.heightSegments)}}class Bh extends zt{constructor(e=.5,t=1,n=32,i=1,s=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:s,thetaLength:o},n=Math.max(3,n),i=Math.max(1,i);const c=[],u=[],h=[],f=[];let d=e;const m=(t-e)/i,g=new B,y=new we;for(let M=0;M<=i;M++){for(let x=0;x<=n;x++){const v=s+x/n*o;g.x=d*Math.cos(v),g.y=d*Math.sin(v),u.push(g.x,g.y,g.z),h.push(0,0,1),y.x=(g.x/t+1)/2,y.y=(g.y/t+1)/2,f.push(y.x,y.y)}d+=m}for(let M=0;M<i;M++){const x=M*(n+1);for(let v=0;v<n;v++){const w=v+x,E=w,T=w+n+1,U=w+n+2,I=w+1;c.push(E,T,I),c.push(T,U,I)}}this.setIndex(c),this.setAttribute("position",new ht(u,3)),this.setAttribute("normal",new ht(h,3)),this.setAttribute("uv",new ht(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Bh(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class zh extends zt{constructor(e=new as([new we(0,.5),new we(-.5,-.5),new we(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],s=[],o=[];let c=0,u=0;if(Array.isArray(e)===!1)h(e);else for(let f=0;f<e.length;f++)h(e[f]),this.addGroup(c,u,f),c+=u,u=0;this.setIndex(n),this.setAttribute("position",new ht(i,3)),this.setAttribute("normal",new ht(s,3)),this.setAttribute("uv",new ht(o,2));function h(f){const d=i.length/3,m=f.extractPoints(t);let g=m.shape;const y=m.holes;Ji.isClockWise(g)===!1&&(g=g.reverse());for(let x=0,v=y.length;x<v;x++){const w=y[x];Ji.isClockWise(w)===!0&&(y[x]=w.reverse())}const M=Ji.triangulateShape(g,y);for(let x=0,v=y.length;x<v;x++){const w=y[x];g=g.concat(w)}for(let x=0,v=g.length;x<v;x++){const w=g[x];i.push(w.x,w.y,0),s.push(0,0,1),o.push(w.x,w.y)}for(let x=0,v=M.length;x<v;x++){const w=M[x],E=w[0]+d,T=w[1]+d,U=w[2]+d;n.push(E,T,U),u+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return W1(t,e)}static fromJSON(e,t){const n=[];for(let i=0,s=e.shapes.length;i<s;i++){const o=t[e.shapes[i]];n.push(o)}return new zh(n,e.curveSegments)}}function W1(r,e){if(e.shapes=[],Array.isArray(r))for(let t=0,n=r.length;t<n;t++){const i=r[t];e.shapes.push(i.uuid)}else e.shapes.push(r.uuid);return e}class Nl extends zt{constructor(e=1,t=32,n=16,i=0,s=Math.PI*2,o=0,c=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:s,thetaStart:o,thetaLength:c},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const u=Math.min(o+c,Math.PI);let h=0;const f=[],d=new B,m=new B,g=[],y=[],M=[],x=[];for(let v=0;v<=n;v++){const w=[],E=v/n;let T=0;v===0&&o===0?T=.5/t:v===n&&u===Math.PI&&(T=-.5/t);for(let U=0;U<=t;U++){const I=U/t;d.x=-e*Math.cos(i+I*s)*Math.sin(o+E*c),d.y=e*Math.cos(o+E*c),d.z=e*Math.sin(i+I*s)*Math.sin(o+E*c),y.push(d.x,d.y,d.z),m.copy(d).normalize(),M.push(m.x,m.y,m.z),x.push(I+T,1-E),w.push(h++)}f.push(w)}for(let v=0;v<n;v++)for(let w=0;w<t;w++){const E=f[v][w+1],T=f[v][w],U=f[v+1][w],I=f[v+1][w+1];(v!==0||o>0)&&g.push(E,T,I),(v!==n-1||u<Math.PI)&&g.push(T,U,I)}this.setIndex(g),this.setAttribute("position",new ht(y,3)),this.setAttribute("normal",new ht(M,3)),this.setAttribute("uv",new ht(x,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Nl(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class kh extends fs{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 kh(e.radius,e.detail)}}class Hh extends zt{constructor(e=1,t=.4,n=12,i=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:s},n=Math.floor(n),i=Math.floor(i);const o=[],c=[],u=[],h=[],f=new B,d=new B,m=new B;for(let g=0;g<=n;g++)for(let y=0;y<=i;y++){const M=y/i*s,x=g/n*Math.PI*2;d.x=(e+t*Math.cos(x))*Math.cos(M),d.y=(e+t*Math.cos(x))*Math.sin(M),d.z=t*Math.sin(x),c.push(d.x,d.y,d.z),f.x=e*Math.cos(M),f.y=e*Math.sin(M),m.subVectors(d,f).normalize(),u.push(m.x,m.y,m.z),h.push(y/i),h.push(g/n)}for(let g=1;g<=n;g++)for(let y=1;y<=i;y++){const M=(i+1)*g+y-1,x=(i+1)*(g-1)+y-1,v=(i+1)*(g-1)+y,w=(i+1)*g+y;o.push(M,x,w),o.push(x,v,w)}this.setIndex(o),this.setAttribute("position",new ht(c,3)),this.setAttribute("normal",new ht(u,3)),this.setAttribute("uv",new ht(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Hh(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class Vh extends zt{constructor(e=1,t=.4,n=64,i=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:s,q:o},n=Math.floor(n),i=Math.floor(i);const c=[],u=[],h=[],f=[],d=new B,m=new B,g=new B,y=new B,M=new B,x=new B,v=new B;for(let E=0;E<=n;++E){const T=E/n*s*Math.PI*2;w(T,s,o,e,g),w(T+.01,s,o,e,y),x.subVectors(y,g),v.addVectors(y,g),M.crossVectors(x,v),v.crossVectors(M,x),M.normalize(),v.normalize();for(let U=0;U<=i;++U){const I=U/i*Math.PI*2,N=-t*Math.cos(I),D=t*Math.sin(I);d.x=g.x+(N*v.x+D*M.x),d.y=g.y+(N*v.y+D*M.y),d.z=g.z+(N*v.z+D*M.z),u.push(d.x,d.y,d.z),m.subVectors(d,g).normalize(),h.push(m.x,m.y,m.z),f.push(E/n),f.push(U/i)}}for(let E=1;E<=n;E++)for(let T=1;T<=i;T++){const U=(i+1)*(E-1)+(T-1),I=(i+1)*E+(T-1),N=(i+1)*E+T,D=(i+1)*(E-1)+T;c.push(U,I,D),c.push(I,N,D)}this.setIndex(c),this.setAttribute("position",new ht(u,3)),this.setAttribute("normal",new ht(h,3)),this.setAttribute("uv",new ht(f,2));function w(E,T,U,I,N){const D=Math.cos(E),C=Math.sin(E),A=U/T*E,F=Math.cos(A);N.x=I*(2+F)*.5*D,N.y=I*(2+F)*C*.5,N.z=I*Math.sin(A)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Vh(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class Gh extends zt{constructor(e=new Wp(new B(-1,-1,0),new B(-1,1,0),new B(1,1,0)),t=64,n=1,i=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:s};const o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const c=new B,u=new B,h=new we;let f=new B;const d=[],m=[],g=[],y=[];M(),this.setIndex(y),this.setAttribute("position",new ht(d,3)),this.setAttribute("normal",new ht(m,3)),this.setAttribute("uv",new ht(g,2));function M(){for(let E=0;E<t;E++)x(E);x(s===!1?t:0),w(),v()}function x(E){f=e.getPointAt(E/t,f);const T=o.normals[E],U=o.binormals[E];for(let I=0;I<=i;I++){const N=I/i*Math.PI*2,D=Math.sin(N),C=-Math.cos(N);u.x=C*T.x+D*U.x,u.y=C*T.y+D*U.y,u.z=C*T.z+D*U.z,u.normalize(),m.push(u.x,u.y,u.z),c.x=f.x+n*u.x,c.y=f.y+n*u.y,c.z=f.z+n*u.z,d.push(c.x,c.y,c.z)}}function v(){for(let E=1;E<=t;E++)for(let T=1;T<=i;T++){const U=(i+1)*(E-1)+(T-1),I=(i+1)*E+(T-1),N=(i+1)*E+T,D=(i+1)*(E-1)+T;y.push(U,I,D),y.push(I,N,D)}}function w(){for(let E=0;E<=t;E++)for(let T=0;T<=i;T++)h.x=E/t,h.y=T/i,g.push(h.x,h.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 Gh(new ph[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class fy extends zt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,i=new B,s=new B;if(e.index!==null){const o=e.attributes.position,c=e.index;let u=e.groups;u.length===0&&(u=[{start:0,count:c.count,materialIndex:0}]);for(let h=0,f=u.length;h<f;++h){const d=u[h],m=d.start,g=d.count;for(let y=m,M=m+g;y<M;y+=3)for(let x=0;x<3;x++){const v=c.getX(y+x),w=c.getX(y+(x+1)%3);i.fromBufferAttribute(o,v),s.fromBufferAttribute(o,w),zv(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}}else{const o=e.attributes.position;for(let c=0,u=o.count/3;c<u;c++)for(let h=0;h<3;h++){const f=3*c+h,d=3*c+(h+1)%3;i.fromBufferAttribute(o,f),s.fromBufferAttribute(o,d),zv(i,s,n)===!0&&(t.push(i.x,i.y,i.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new ht(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function zv(r,e,t){const n=`${r.x},${r.y},${r.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${r.x},${r.y},${r.z}`;return t.has(n)===!0||t.has(i)===!0?!1:(t.add(n),t.add(i),!0)}var kv=Object.freeze({__proto__:null,BoxGeometry:no,CapsuleGeometry:Lh,CircleGeometry:Dh,ConeGeometry:Ll,CylinderGeometry:Pl,DodecahedronGeometry:Uh,EdgesGeometry:ny,ExtrudeGeometry:Fh,IcosahedronGeometry:Dl,LatheGeometry:Oh,OctahedronGeometry:Ul,PlaneGeometry:ds,PolyhedronGeometry:fs,RingGeometry:Bh,ShapeGeometry:zh,SphereGeometry:Nl,TetrahedronGeometry:kh,TorusGeometry:Hh,TorusKnotGeometry:Vh,TubeGeometry:Gh,WireframeGeometry:fy});class dy extends Kn{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new rt(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class py extends gi{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Yp extends Kn{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new rt(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 rt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=hs,this.normalScale=new we(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 Ai,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 my extends Yp{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 we(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Rt(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 rt(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 rt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new rt(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 gy extends Kn{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new rt(16777215),this.specular=new rt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new rt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=hs,this.normalScale=new we(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ai,this.combine=El,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class vy extends Kn{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new rt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new rt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=hs,this.normalScale=new we(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 _y extends Kn{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=hs,this.normalScale=new we(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 yy extends Kn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new rt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new rt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=hs,this.normalScale=new we(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ai,this.combine=El,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class qp extends Kn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=I_,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 Zp extends Kn{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 xy extends Kn{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new rt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=hs,this.normalScale=new we(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,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.flatShading=e.flatShading,this.fog=e.fog,this}}class Sy extends ai{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 qs(r,e){return!r||r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function My(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function wy(r){function e(i,s){return r[i]-r[s]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function hp(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,o=0;o!==n;++s){const c=t[s]*e;for(let u=0;u!==e;++u)i[o++]=r[c+u]}return i}function jp(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let o=s[n];if(o!==void 0)if(Array.isArray(o))do o=s[n],o!==void 0&&(e.push(s.time),t.push(...o)),s=r[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[n],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do o=s[n],o!==void 0&&(e.push(s.time),t.push(o)),s=r[i++];while(s!==void 0)}function X1(r,e,t,n,i=30){const s=r.clone();s.name=e;const o=[];for(let u=0;u<s.tracks.length;++u){const h=s.tracks[u],f=h.getValueSize(),d=[],m=[];for(let g=0;g<h.times.length;++g){const y=h.times[g]*i;if(!(y<t||y>=n)){d.push(h.times[g]);for(let M=0;M<f;++M)m.push(h.values[g*f+M])}}d.length!==0&&(h.times=qs(d,h.times.constructor),h.values=qs(m,h.values.constructor),o.push(h))}s.tracks=o;let c=1/0;for(let u=0;u<s.tracks.length;++u)c>s.tracks[u].times[0]&&(c=s.tracks[u].times[0]);for(let u=0;u<s.tracks.length;++u)s.tracks[u].shift(-1*c);return s.resetDuration(),s}function Y1(r,e=0,t=r,n=30){n<=0&&(n=30);const i=t.tracks.length,s=e/n;for(let o=0;o<i;++o){const c=t.tracks[o],u=c.ValueTypeName;if(u==="bool"||u==="string")continue;const h=r.tracks.find(function(v){return v.name===c.name&&v.ValueTypeName===u});if(h===void 0)continue;let f=0;const d=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=d/3);let m=0;const g=h.getValueSize();h.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(m=g/3);const y=c.times.length-1;let M;if(s<=c.times[0]){const v=f,w=d-f;M=c.values.slice(v,w)}else if(s>=c.times[y]){const v=y*d+f,w=v+d-f;M=c.values.slice(v,w)}else{const v=c.createInterpolant(),w=f,E=d-f;v.evaluate(s),M=v.resultBuffer.slice(w,E)}u==="quaternion"&&new jn().fromArray(M).normalize().conjugate().toArray(M);const x=h.times.length;for(let v=0;v<x;++v){const w=v*g+m;if(u==="quaternion")jn.multiplyQuaternionsFlat(h.values,w,M,0,h.values,w);else{const E=g-m*2;for(let T=0;T<E;++T)h.values[w+T]-=M[T]}}}return r.blendMode=Rp,r}class q1{static convertArray(e,t){return qs(e,t)}static isTypedArray(e){return My(e)}static getKeyframeOrder(e){return wy(e)}static sortedArray(e,t,n){return hp(e,t,n)}static flattenJSON(e,t,n,i){jp(e,t,n,i)}static subclip(e,t,n,i,s=30){return X1(e,t,n,i,s)}static makeClipAdditive(e,t=0,n=e,i=30){return Y1(e,t,n,i)}}class Fl{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],s=t[n-1];e:{t:{let o;n:{i:if(!(e<i)){for(let c=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===c)break;if(s=i,i=t[++n],e<i)break t}o=t.length;break n}if(!(e>=s)){const c=t[1];e<c&&(n=2,s=c);for(let u=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===u)break;if(i=s,s=t[--n-1],e>=s)break t}o=n,n=0;break n}break e}for(;n<o;){const c=n+o>>>1;e<t[c]?o=c:n=c+1}if(i=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let o=0;o!==i;++o)t[o]=n[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Ey extends Fl{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:Ws,endingEnd:Ws}}intervalChanged_(e,t,n){const i=this.parameterPositions;let s=e-2,o=e+1,c=i[s],u=i[o];if(c===void 0)switch(this.getSettings_().endingStart){case Xs:s=e,c=2*t-n;break;case ll:s=i.length-2,c=t+i[s]-i[s+1];break;default:s=e,c=n}if(u===void 0)switch(this.getSettings_().endingEnd){case Xs:o=e,u=2*n-t;break;case ll:o=1,u=n+i[1]-i[0];break;default:o=e-1,u=t}const h=(n-t)*.5,f=this.valueSize;this._weightPrev=h/(t-c),this._weightNext=h/(u-n),this._offsetPrev=s*f,this._offsetNext=o*f}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,c=this.valueSize,u=e*c,h=u-c,f=this._offsetPrev,d=this._offsetNext,m=this._weightPrev,g=this._weightNext,y=(n-t)/(i-t),M=y*y,x=M*y,v=-m*x+2*m*M-m*y,w=(1+m)*x+(-1.5-2*m)*M+(-.5+m)*y+1,E=(-1-g)*x+(1.5+g)*M+.5*y,T=g*x-g*M;for(let U=0;U!==c;++U)s[U]=v*o[f+U]+w*o[h+U]+E*o[u+U]+T*o[d+U];return s}}class Jp extends Fl{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,c=this.valueSize,u=e*c,h=u-c,f=(n-t)/(i-t),d=1-f;for(let m=0;m!==c;++m)s[m]=o[h+m]*d+o[u+m]*f;return s}}class Ty extends Fl{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class ki{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=qs(t,this.TimeBufferType),this.values=qs(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:qs(e.times,Array),values:qs(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Ty(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Jp(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Ey(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case al:t=this.InterpolantFactoryMethodDiscrete;break;case hh:t=this.InterpolantFactoryMethodLinear;break;case bu:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return al;case this.InterpolantFactoryMethodLinear:return hh;case this.InterpolantFactoryMethodSmooth:return bu}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let s=0,o=i-1;for(;s!==i&&n[s]<e;)++s;for(;o!==-1&&n[o]>t;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const c=this.getValueSize();this.times=n.slice(s,o),this.values=this.values.slice(s*c,o*c)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let c=0;c!==s;c++){const u=n[c];if(typeof u=="number"&&isNaN(u)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,c,u),e=!1;break}if(o!==null&&o>u){console.error("THREE.KeyframeTrack: Out of order keys.",this,c,u,o),e=!1;break}o=u}if(i!==void 0&&My(i))for(let c=0,u=i.length;c!==u;++c){const h=i[c];if(isNaN(h)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,c,h),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===bu,s=e.length-1;let o=1;for(let c=1;c<s;++c){let u=!1;const h=e[c],f=e[c+1];if(h!==f&&(c!==1||h!==e[0]))if(i)u=!0;else{const d=c*n,m=d-n,g=d+n;for(let y=0;y!==n;++y){const M=t[d+y];if(M!==t[m+y]||M!==t[g+y]){u=!0;break}}}if(u){if(c!==o){e[o]=e[c];const d=c*n,m=o*n;for(let g=0;g!==n;++g)t[m+g]=t[d+g]}++o}}if(s>0){e[o]=e[s];for(let c=s*n,u=o*n,h=0;h!==n;++h)t[u+h]=t[c+h];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*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}}ki.prototype.ValueTypeName="";ki.prototype.TimeBufferType=Float32Array;ki.prototype.ValueBufferType=Float32Array;ki.prototype.DefaultInterpolation=hh;class io extends ki{constructor(e,t,n){super(e,t,n)}}io.prototype.ValueTypeName="bool";io.prototype.ValueBufferType=Array;io.prototype.DefaultInterpolation=al;io.prototype.InterpolantFactoryMethodLinear=void 0;io.prototype.InterpolantFactoryMethodSmooth=void 0;class Kp extends ki{constructor(e,t,n,i){super(e,t,n,i)}}Kp.prototype.ValueTypeName="color";class gl extends ki{constructor(e,t,n,i){super(e,t,n,i)}}gl.prototype.ValueTypeName="number";class by extends Fl{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,c=this.valueSize,u=(n-t)/(i-t);let h=e*c;for(let f=h+c;h!==f;h+=4)jn.slerpFlat(s,0,o,h-c,o,h,u);return s}}class Ol extends ki{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new by(this.times,this.values,this.getValueSize(),e)}}Ol.prototype.ValueTypeName="quaternion";Ol.prototype.InterpolantFactoryMethodSmooth=void 0;class ro extends ki{constructor(e,t,n){super(e,t,n)}}ro.prototype.ValueTypeName="string";ro.prototype.ValueBufferType=Array;ro.prototype.DefaultInterpolation=al;ro.prototype.InterpolantFactoryMethodLinear=void 0;ro.prototype.InterpolantFactoryMethodSmooth=void 0;class vl extends ki{constructor(e,t,n,i){super(e,t,n,i)}}vl.prototype.ValueTypeName="vector";class _l{constructor(e="",t=-1,n=[],i=wh){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Ti(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let o=0,c=n.length;o!==c;++o)t.push(j1(n[o]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=n.length;s!==o;++s)t.push(ki.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,o=[];for(let c=0;c<s;c++){let u=[],h=[];u.push((c+s-1)%s,c,(c+1)%s),h.push(0,1,0);const f=wy(u);u=hp(u,1,f),h=hp(h,1,f),!i&&u[0]===0&&(u.push(s),h.push(h[0])),o.push(new gl(".morphTargetInfluences["+t[c].name+"]",u,h).scale(1/n))}return new this(e,-1,o)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},s=/^([\w-]*?)([\d]+)$/;for(let c=0,u=e.length;c<u;c++){const h=e[c],f=h.name.match(s);if(f&&f.length>1){const d=f[1];let m=i[d];m||(i[d]=m=[]),m.push(h)}}const o=[];for(const c in i)o.push(this.CreateFromMorphTargetSequence(c,i[c],t,n));return o}static parseAnimation(e,t){if(console.warn("THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(d,m,g,y,M){if(g.length!==0){const x=[],v=[];jp(g,x,v,y),x.length!==0&&M.push(new d(m,x,v))}},i=[],s=e.name||"default",o=e.fps||30,c=e.blendMode;let u=e.length||-1;const h=e.hierarchy||[];for(let d=0;d<h.length;d++){const m=h[d].keys;if(!(!m||m.length===0))if(m[0].morphTargets){const g={};let y;for(y=0;y<m.length;y++)if(m[y].morphTargets)for(let M=0;M<m[y].morphTargets.length;M++)g[m[y].morphTargets[M]]=-1;for(const M in g){const x=[],v=[];for(let w=0;w!==m[y].morphTargets.length;++w){const E=m[y];x.push(E.time),v.push(E.morphTarget===M?1:0)}i.push(new gl(".morphTargetInfluence["+M+"]",x,v))}u=g.length*o}else{const g=".bones["+t[d].name+"]";n(vl,g+".position",m,"pos",i),n(Ol,g+".quaternion",m,"rot",i),n(vl,g+".scale",m,"scl",i)}}return i.length===0?null:new this(s,u,i,c)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Z1(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return gl;case"vector":case"vector2":case"vector3":case"vector4":return vl;case"color":return Kp;case"quaternion":return Ol;case"bool":case"boolean":return io;case"string":return ro}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function j1(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=Z1(r.type);if(r.times===void 0){const t=[],n=[];jp(r.keys,t,n,"value"),r.times=t,r.values=n}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}const Ur={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(this.files[r]=e)},get:function(r){if(this.enabled!==!1)return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};class Wh{constructor(e,t,n){const i=this;let s=!1,o=0,c=0,u;const h=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(f){c++,s===!1&&i.onStart!==void 0&&i.onStart(f,o,c),s=!0},this.itemEnd=function(f){o++,i.onProgress!==void 0&&i.onProgress(f,o,c),o===c&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(f){i.onError!==void 0&&i.onError(f)},this.resolveURL=function(f){return u?u(f):f},this.setURLModifier=function(f){return u=f,this},this.addHandler=function(f,d){return h.push(f,d),this},this.removeHandler=function(f){const d=h.indexOf(f);return d!==-1&&h.splice(d,2),this},this.getHandler=function(f){for(let d=0,m=h.length;d<m;d+=2){const g=h[d],y=h[d+1];if(g.global&&(g.lastIndex=0),g.test(f))return y}return null}}}const Ay=new Wh;class li{constructor(e){this.manager=e!==void 0?e:Ay,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}li.DEFAULT_MATERIAL_NAME="__DEFAULT";const Ir={};class J1 extends Error{constructor(e,t){super(e),this.response=t}}class bi extends li{constructor(e){super(e),this.mimeType="",this.responseType=""}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Ur.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Ir[e]!==void 0){Ir[e].push({onLoad:t,onProgress:n,onError:i});return}Ir[e]=[],Ir[e].push({onLoad:t,onProgress:n,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),c=this.mimeType,u=this.responseType;fetch(o).then(h=>{if(h.status===200||h.status===0){if(h.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||h.body===void 0||h.body.getReader===void 0)return h;const f=Ir[e],d=h.body.getReader(),m=h.headers.get("X-File-Size")||h.headers.get("Content-Length"),g=m?parseInt(m):0,y=g!==0;let M=0;const x=new ReadableStream({start(v){w();function w(){d.read().then(({done:E,value:T})=>{if(E)v.close();else{M+=T.byteLength;const U=new ProgressEvent("progress",{lengthComputable:y,loaded:M,total:g});for(let I=0,N=f.length;I<N;I++){const D=f[I];D.onProgress&&D.onProgress(U)}v.enqueue(T),w()}},E=>{v.error(E)})}}});return new Response(x)}else throw new J1(`fetch for "${h.url}" responded with ${h.status}: ${h.statusText}`,h)}).then(h=>{switch(u){case"arraybuffer":return h.arrayBuffer();case"blob":return h.blob();case"document":return h.text().then(f=>new DOMParser().parseFromString(f,c));case"json":return h.json();default:if(c==="")return h.text();{const d=/charset="?([^;"\s]*)"?/i.exec(c),m=d&&d[1]?d[1].toLowerCase():void 0,g=new TextDecoder(m);return h.arrayBuffer().then(y=>g.decode(y))}}}).then(h=>{Ur.add(e,h);const f=Ir[e];delete Ir[e];for(let d=0,m=f.length;d<m;d++){const g=f[d];g.onLoad&&g.onLoad(h)}}).catch(h=>{const f=Ir[e];if(f===void 0)throw this.manager.itemError(e),h;delete Ir[e];for(let d=0,m=f.length;d<m;d++){const g=f[d];g.onError&&g.onError(h)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class K1 extends li{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new bi(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(c){try{t(s.parse(JSON.parse(c)))}catch(u){i?i(u):console.error(u),s.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=_l.parse(e[n]);t.push(i)}return t}}class Q1 extends li{constructor(e){super(e)}load(e,t,n,i){const s=this,o=[],c=new Ph,u=new bi(this.manager);u.setPath(this.path),u.setResponseType("arraybuffer"),u.setRequestHeader(this.requestHeader),u.setWithCredentials(s.withCredentials);let h=0;function f(d){u.load(e[d],function(m){const g=s.parse(m,!0);o[d]={width:g.width,height:g.height,format:g.format,mipmaps:g.mipmaps},h+=1,h===6&&(g.mipmapCount===1&&(c.minFilter=tn),c.image=o,c.format=g.format,c.needsUpdate=!0,t&&t(c))},n,i)}if(Array.isArray(e))for(let d=0,m=e.length;d<m;++d)f(d);else u.load(e,function(d){const m=s.parse(d,!0);if(m.isCubemap){const g=m.mipmaps.length/m.mipmapCount;for(let y=0;y<g;y++){o[y]={mipmaps:[]};for(let M=0;M<m.mipmapCount;M++)o[y].mipmaps.push(m.mipmaps[y*m.mipmapCount+M]),o[y].format=m.format,o[y].width=m.width,o[y].height=m.height}c.image=o}else c.image.width=m.width,c.image.height=m.height,c.mipmaps=m.mipmaps;m.mipmapCount===1&&(c.minFilter=tn),c.format=m.format,c.needsUpdate=!0,t&&t(c)},n,i);return c}}class yl extends li{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Ur.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const c=fl("img");function u(){f(),Ur.add(e,this),t&&t(this),s.manager.itemEnd(e)}function h(d){f(),i&&i(d),s.manager.itemError(e),s.manager.itemEnd(e)}function f(){c.removeEventListener("load",u,!1),c.removeEventListener("error",h,!1)}return c.addEventListener("load",u,!1),c.addEventListener("error",h,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(c.crossOrigin=this.crossOrigin),s.manager.itemStart(e),c.src=e,c}}class Cy extends li{constructor(e){super(e)}load(e,t,n,i){const s=new Rl;s.colorSpace=ii;const o=new yl(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let c=0;function u(h){o.load(e[h],function(f){s.images[h]=f,c++,c===6&&(s.needsUpdate=!0,t&&t(s))},void 0,i)}for(let h=0;h<e.length;++h)u(h);return s}}class Qp extends li{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new Ki,c=new bi(this.manager);return c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setPath(this.path),c.setWithCredentials(s.withCredentials),c.load(e,function(u){let h;try{h=s.parse(u)}catch(f){if(i!==void 0)i(f);else{console.error(f);return}}h.image!==void 0?o.image=h.image:h.data!==void 0&&(o.image.width=h.width,o.image.height=h.height,o.image.data=h.data),o.wrapS=h.wrapS!==void 0?h.wrapS:Cn,o.wrapT=h.wrapT!==void 0?h.wrapT:Cn,o.magFilter=h.magFilter!==void 0?h.magFilter:tn,o.minFilter=h.minFilter!==void 0?h.minFilter:tn,o.anisotropy=h.anisotropy!==void 0?h.anisotropy:1,h.colorSpace!==void 0&&(o.colorSpace=h.colorSpace),h.flipY!==void 0&&(o.flipY=h.flipY),h.format!==void 0&&(o.format=h.format),h.type!==void 0&&(o.type=h.type),h.mipmaps!==void 0&&(o.mipmaps=h.mipmaps,o.minFilter=ur),h.mipmapCount===1&&(o.minFilter=tn),h.generateMipmaps!==void 0&&(o.generateMipmaps=h.generateMipmaps),o.needsUpdate=!0,t&&t(o,h)},n,i),o}}class $1 extends li{constructor(e){super(e)}load(e,t,n,i){const s=new sn,o=new yl(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(c){s.image=c,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class ps extends Jt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new rt(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}class Ry extends ps{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Jt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new rt(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const Id=new bt,Hv=new B,Vv=new B;class $p{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new we(512,512),this.mapType=oi,this.map=null,this.mapPass=null,this.matrix=new bt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new la,this._frameExtents=new we(1,1),this._viewportCount=1,this._viewports=[new jt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;Hv.setFromMatrixPosition(e.matrixWorld),t.position.copy(Hv),Vv.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Vv),t.updateMatrixWorld(),Id.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Id),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Id)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class ew extends $p{constructor(){super(new wn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=ta*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Iy extends ps{constructor(e,t,n=0,i=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Jt.DEFAULT_UP),this.updateMatrix(),this.target=new Jt,this.distance=n,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new ew}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const Gv=new bt,za=new B,Pd=new B;class tw extends $p{constructor(){super(new wn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new we(4,2),this._viewportCount=6,this._viewports=[new jt(2,1,1,1),new jt(0,1,1,1),new jt(3,1,1,1),new jt(1,1,1,1),new jt(3,0,1,1),new jt(1,0,1,1)],this._cubeDirections=[new B(1,0,0),new B(-1,0,0),new B(0,0,1),new B(0,0,-1),new B(0,1,0),new B(0,-1,0)],this._cubeUps=[new B(0,1,0),new B(0,1,0),new B(0,1,0),new B(0,1,0),new B(0,0,1),new B(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,s=e.distance||n.far;s!==n.far&&(n.far=s,n.updateProjectionMatrix()),za.setFromMatrixPosition(e.matrixWorld),n.position.copy(za),Pd.copy(n.position),Pd.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(Pd),n.updateMatrixWorld(),i.makeTranslation(-za.x,-za.y,-za.z),Gv.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Gv)}}class Py extends ps{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 tw}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class Fr extends Cl{constructor(e=-1,t=1,n=1,i=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="Orthogra
44phicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,o=n+e,c=i+t,u=i-t;if(this.view!==null&&this.view.enabled){const h=(this.right-this.left)/this.view.fullWidth/this.zoom,f=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=h*this.view.offsetX,o=s+h*this.view.width,c-=f*this.view.offsetY,u=c-f*this.view.height}this.projectionMatrix.makeOrthographic(s,o,c,u,this.near,this.far,this.coordinateSystem),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 nw extends $p{constructor(){super(new Fr(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Ly extends ps{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Jt.DEFAULT_UP),this.updateMatrix(),this.target=new Jt,this.shadow=new nw}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Dy extends ps{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Uy extends ps{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 Ny{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new B)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*i),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*i)),t.addScaledVector(o[5],1.092548*(i*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(n*s)),t.addScaledVector(o[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*i),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*i),t.addScaledVector(o[5],2*.429043*i*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*n*s),t.addScaledVector(o[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,s=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-i*i)}}class Fy extends ps{constructor(e=new Ny,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class Xh extends li{constructor(e){super(e),this.textures={}}load(e,t,n,i){const s=this,o=new bi(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(c){try{t(s.parse(JSON.parse(c)))}catch(u){i?i(u):console.error(u),s.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const i=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new rt().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
vendor: 15,540 bytes, line 44
44!==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.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(i.uniforms[s]={},o.type){case"t":i.uniforms[s].value=n(o.value);break;case"c":i.uniforms[s].value=new rt().setHex(o.value);break;case"v2":i.uniforms[s].value=new we().fromArray(o.value);break;case"v3":i.uniforms[s].value=new B().fromArray(o.value);break;case"v4":i.uniforms[s].value=new jt().fromArray(o.value);break;case"m3":i.uniforms[s].value=new Ut().fromArray(o.value);break;case"m4":i.uniforms[s].value=new bt().fromArray(o.value);break;default:i.uniforms[s].value=o.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new we().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new we().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 Xh.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:dy,SpriteMaterial:Fp,RawShaderMaterial:py,ShaderMaterial:gi,PointsMaterial:Bp,MeshPhysicalMaterial:my,MeshStandardMaterial:Yp,MeshPhongMaterial:gy,MeshToonMaterial:vy,MeshNormalMaterial:_y,MeshLambertMaterial:yy,MeshDepthMaterial:qp,MeshDistanceMaterial:Zp,MeshBasicMaterial:Br,MeshMatcapMaterial:xy,LineDashedMaterial:Sy,LineBasicMaterial:ai,Material:Kn};return new t[e]}}class fp{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 Oy extends zt{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 By extends li{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new bi(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(c){try{t(s.parse(JSON.parse(c)))}catch(u){i?i(u):console.error(u),s.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(g,y){if(t[y]!==void 0)return t[y];const x=g.interleavedBuffers[y],v=s(g,x.buffer),w=Go(x.type,v),E=new Ch(w,x.stride);return E.uuid=x.uuid,t[y]=E,E}function s(g,y){if(n[y]!==void 0)return n[y];const x=g.arrayBuffers[y],v=new Uint32Array(x).buffer;return n[y]=v,v}const o=e.isInstancedBufferGeometry?new Oy:new zt,c=e.data.index;if(c!==void 0){const g=Go(c.type,c.array);o.setIndex(new nn(g,1))}const u=e.data.attributes;for(const g in u){const y=u[g];let M;if(y.isInterleavedBufferAttribute){const x=i(e.data,y.data);M=new $s(x,y.itemSize,y.offset,y.normalized)}else{const x=Go(y.type,y.array),v=y.isInstancedBufferAttribute?ia:nn;M=new v(x,y.itemSize,y.normalized)}y.name!==void 0&&(M.name=y.name),y.usage!==void 0&&M.setUsage(y.usage),o.setAttribute(g,M)}const h=e.data.morphAttributes;if(h)for(const g in h){const y=h[g],M=[];for(let x=0,v=y.length;x<v;x++){const w=y[x];let E;if(w.isInterleavedBufferAttribute){const T=i(e.data,w.data);E=new $s(T,w.itemSize,w.offset,w.normalized)}else{const T=Go(w.type,w.array);E=new nn(T,w.itemSize,w.normalized)}w.name!==void 0&&(E.name=w.name),M.push(E)}o.morphAttributes[g]=M}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const d=e.data.groups||e.data.drawcalls||e.data.offsets;if(d!==void 0)for(let g=0,y=d.length;g!==y;++g){const M=d[g];o.addGroup(M.start,M.count,M.materialIndex)}const m=e.data.boundingSphere;return m!==void 0&&(o.boundingSphere=new Hn().fromJSON(m)),e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class iw extends li{constructor(e){super(e)}load(e,t,n,i){const s=this,o=this.path===""?fp.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const c=new bi(this.manager);c.setPath(this.path),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(u){let h=null;try{h=JSON.parse(u)}catch(d){i!==void 0&&i(d),console.error("THREE:ObjectLoader: Can't parse "+e+".",d.message);return}const f=h.metadata;if(f===void 0||f.type===void 0||f.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(h,t)},n,i)}async loadAsync(e,t){const n=this,i=this.path===""?fp.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new bi(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const o=await s.loadAsync(e,t),c=JSON.parse(o),u=c.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(c)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,i),o=this.parseImages(e.images,function(){t!==void 0&&t(h)}),c=this.parseTextures(e.textures,o),u=this.parseMaterials(e.materials,c),h=this.parseObject(e.object,s,u,c,n),f=this.parseSkeletons(e.skeletons,h);if(this.bindSkeletons(h,f),this.bindLightTargets(h),t!==void 0){let d=!1;for(const m in o)if(o[m].data instanceof HTMLImageElement){d=!0;break}d===!1&&t(h)}return h}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),s=await this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,s),c=this.parseMaterials(e.materials,o),u=this.parseObject(e.object,i,c,o,t),h=this.parseSkeletons(e.skeletons,u);return this.bindSkeletons(u,h),this.bindLightTargets(u),u}parseShapes(e){const t={};if(e!==void 0)for(let n=0,i=e.length;n<i;n++){const s=new as().fromJSON(e[n]);t[s.uuid]=s}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse(function(s){s.isBone&&(i[s.uuid]=s)}),e!==void 0)for(let s=0,o=e.length;s<o;s++){const c=new Rh().fromJSON(e[s],i);n[c.uuid]=c}return n}parseGeometries(e,t){const n={};if(e!==void 0){const i=new By;for(let s=0,o=e.length;s<o;s++){let c;const u=e[s];switch(u.type){case"BufferGeometry":case"InstancedBufferGeometry":c=i.parse(u);break;default:u.type in kv?c=kv[u.type].fromJSON(u,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${u.type}"`)}c.uuid=u.uuid,u.name!==void 0&&(c.name=u.name),u.userData!==void 0&&(c.userData=u.userData),n[u.uuid]=c}}return n}parseMaterials(e,t){const n={},i={};if(e!==void 0){const s=new Xh;s.setTextures(t);for(let o=0,c=e.length;o<c;o++){const u=e[o];n[u.uuid]===void 0&&(n[u.uuid]=s.parse(u)),i[u.uuid]=n[u.uuid]}}return i}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const i=e[n],s=_l.parse(i);t[s.uuid]=s}return t}parseImages(e,t){const n=this,i={};let s;function o(u){return n.manager.itemStart(u),s.load(u,function(){n.manager.itemEnd(u)},void 0,function(){n.manager.itemError(u),n.manager.itemEnd(u)})}function c(u){if(typeof u=="string"){const h=u,f=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(h)?h:n.resourcePath+h;return o(f)}else return u.data?{data:Go(u.type,u.data),width:u.width,height:u.height}:null}if(e!==void 0&&e.length>0){const u=new Wh(t);s=new yl(u),s.setCrossOrigin(this.crossOrigin);for(let h=0,f=e.length;h<f;h++){const d=e[h],m=d.url;if(Array.isArray(m)){const g=[];for(let y=0,M=m.length;y<M;y++){const x=m[y],v=c(x);v!==null&&(v instanceof HTMLImageElement?g.push(v):g.push(new Ki(v.data,v.width,v.height)))}i[d.uuid]=new ss(g)}else{const g=c(d.url);i[d.uuid]=new ss(g)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function s(o){if(typeof o=="string"){const c=o,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:t.resourcePath+c;return await i.loadAsync(u)}else return o.data?{data:Go(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){i=new yl(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,c=e.length;o<c;o++){const u=e[o],h=u.url;if(Array.isArray(h)){const f=[];for(let d=0,m=h.length;d<m;d++){const g=h[d],y=await s(g);y!==null&&(y instanceof HTMLImageElement?f.push(y):f.push(new Ki(y.data,y.width,y.height)))}n[u.uuid]=new ss(f)}else{const f=await s(u.url);n[u.uuid]=new ss(f)}}}return n}parseTextures(e,t){function n(s,o){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),o[s])}const i={};if(e!==void 0)for(let s=0,o=e.length;s<o;s++){const c=e[s];c.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',c.uuid),t[c.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",c.image);const u=t[c.image],h=u.data;let f;Array.isArray(h)?(f=new Rl,h.length===6&&(f.needsUpdate=!0)):(h&&h.data?f=new Ki:f=new sn,h&&(f.needsUpdate=!0)),f.source=u,f.uuid=c.uuid,c.name!==void 0&&(f.name=c.name),c.mapping!==void 0&&(f.mapping=n(c.mapping,rw)),c.channel!==void 0&&(f.channel=c.channel),c.offset!==void 0&&f.offset.fromArray(c.offset),c.repeat!==void 0&&f.repeat.fromArray(c.repeat),c.center!==void 0&&f.center.fromArray(c.center),c.rotation!==void 0&&(f.rotation=c.rotation),c.wrap!==void 0&&(f.wrapS=n(c.wrap[0],Wv),f.wrapT=n(c.wrap[1],Wv)),c.format!==void 0&&(f.format=c.format),c.internalFormat!==void 0&&(f.internalFormat=c.internalFormat),c.type!==void 0&&(f.type=c.type),c.colorSpace!==void 0&&(f.colorSpace=c.colorSpace),c.minFilter!==void 0&&(f.minFilter=n(c.minFilter,Xv)),c.magFilter!==void 0&&(f.magFilter=n(c.magFilter,Xv)),c.anisotropy!==void 0&&(f.anisotropy=c.anisotropy),c.flipY!==void 0&&(f.flipY=c.flipY),c.generateMipmaps!==void 0&&(f.generateMipmaps=c.generateMipmaps),c.premultiplyAlpha!==void 0&&(f.premultiplyAlpha=c.premultiplyAlpha),c.unpackAlignment!==void 0&&(f.unpackAlignment=c.unpackAlignment),c.compareFunction!==void 0&&(f.compareFunction=c.compareFunction),c.userData!==void 0&&(f.userData=c.userData),i[c.uuid]=f}return i}parseObject(e,t,n,i,s){let o;function c(m){return t[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",m),t[m]}function u(m){if(m!==void 0){if(Array.isArray(m)){const g=[];for(let y=0,M=m.length;y<M;y++){const x=m[y];n[x]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",x),g.push(n[x])}return g}return n[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",m),n[m]}}function h(m){return i[m]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",m),i[m]}let f,d;switch(e.type){case"Scene":o=new Il,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new rt(e.background):o.background=h(e.background)),e.environment!==void 0&&(o.environment=h(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new Ah(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new bh(e.fog.color,e.fog.density)),e.fog.name!==""&&(o.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(o.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&o.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(o.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&o.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":o=new wn(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;
44case"OrthographicCamera":o=new Fr(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new Dy(e.color,e.intensity);break;case"DirectionalLight":o=new Ly(e.color,e.intensity),o.target=e.target||"";break;case"PointLight":o=new Py(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new Uy(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new Iy(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),o.target=e.target||"";break;case"HemisphereLight":o=new Ry(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new Fy().fromJSON(e);break;case"SkinnedMesh":f=c(e.geometry),d=u(e.material),o=new J_(f,d),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":f=c(e.geometry),d=u(e.material),o=new mn(f,d);break;case"InstancedMesh":f=c(e.geometry),d=u(e.material);const m=e.count,g=e.instanceMatrix,y=e.instanceColor;o=new K_(f,d,m),o.instanceMatrix=new ia(new Float32Array(g.array),16),y!==void 0&&(o.instanceColor=new ia(new Float32Array(y.array),y.itemSize));break;case"BatchedMesh":f=c(e.geometry),d=u(e.material),o=new Q_(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,d),o.geometry=f,o.perObjectFrustumCulled=e.perObjectFrustumCulled,o.sortObjects=e.sortObjects,o._drawRanges=e.drawRanges,o._reservedRanges=e.reservedRanges,o._geometryInfo=e.geometryInfo.map(M=>{let x=null,v=null;return M.boundingBox!==void 0&&(x=new Jn().fromJSON(M.boundingBox)),M.boundingSphere!==void 0&&(v=new Hn().fromJSON(M.boundingSphere)),{...M,boundingBox:x,boundingSphere:v}}),o._instanceInfo=e.instanceInfo,o._availableInstanceIds=e._availableInstanceIds,o._availableGeometryIds=e._availableGeometryIds,o._nextIndexStart=e.nextIndexStart,o._nextVertexStart=e.nextVertexStart,o._geometryCount=e.geometryCount,o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._matricesTexture=h(e.matricesTexture.uuid),o._indirectTexture=h(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=h(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(o.boundingSphere=new Hn().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(o.boundingBox=new Jn().fromJSON(e.boundingBox));break;case"LOD":o=new j_;break;case"Line":o=new us(c(e.geometry),u(e.material));break;case"LineLoop":o=new $_(c(e.geometry),u(e.material));break;case"LineSegments":o=new vr(c(e.geometry),u(e.material));break;case"PointCloud":case"Points":o=new ey(c(e.geometry),u(e.material));break;case"Sprite":o=new Z_(u(e.material));break;case"Group":o=new Wo;break;case"Bone":o=new Op;break;default:o=new Jt}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(o.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const m=e.children;for(let g=0;g<m.length;g++)o.add(this.parseObject(m[g],t,n,i,s))}if(e.animations!==void 0){const m=e.animations;for(let g=0;g<m.length;g++){const y=m[g];o.animations.push(s[y])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const m=e.levels;for(let g=0;g<m.length;g++){const y=m[g],M=o.getObjectByProperty("uuid",y.object);M!==void 0&&o.addLevel(M,y.distance,y.hysteresis)}}return o}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?console.warn("THREE.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 Jt}})}}const rw={UVMapping:ls,CubeReflectionMapping:dr,CubeRefractionMapping:cs,EquirectangularReflectionMapping:Jo,EquirectangularRefractionMapping:rl,CubeUVReflectionMapping:aa},Wv={RepeatWrapping:sl,ClampToEdgeWrapping:Cn,MirroredRepeatWrapping:ol},Xv={NearestFilter:kn,NearestMipmapNearestFilter:wp,NearestMipmapLinearFilter:Vo,LinearFilter:tn,LinearMipmapNearestFilter:Za,LinearMipmapLinearFilter:ur},Ld=new WeakMap;class sw extends li{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Ur.get(e);
vendor: 22,984 bytes, line 44
44if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(h=>{if(Ld.has(o)===!0)i&&i(Ld.get(o)),s.manager.itemError(e),s.manager.itemEnd(e);else return t&&t(h),s.manager.itemEnd(e),h});return}return setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o}const c={};c.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",c.headers=this.requestHeader;const u=fetch(e,c).then(function(h){return h.blob()}).then(function(h){return createImageBitmap(h,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(h){return Ur.add(e,h),t&&t(h),s.manager.itemEnd(e),h}).catch(function(h){i&&i(h),Ld.set(u,h),Ur.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Ur.add(e,u),s.manager.itemStart(e)}}let hu;class em{static getContext(){return hu===void 0&&(hu=new(window.AudioContext||window.webkitAudioContext)),hu}static setContext(e){hu=e}}class ow extends li{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new bi(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(u){try{const h=u.slice(0);em.getContext().decodeAudioData(h,function(d){t(d)}).catch(c)}catch(h){c(h)}},n,i);function c(u){i?i(u):console.error(u),s.manager.itemError(e)}}}const Yv=new bt,qv=new bt,Ps=new bt;class aw{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new wn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new wn,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,Ps.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,o=t.near*Math.tan(Js*t.fov*.5)/t.zoom;let c,u;qv.elements[12]=-i,Yv.elements[12]=i,c=-o*t.aspect+s,u=o*t.aspect+s,Ps.elements[0]=2*t.near/(u-c),Ps.elements[8]=(u+c)/(u-c),this.cameraL.projectionMatrix.copy(Ps),c=-o*t.aspect-s,u=o*t.aspect-s,Ps.elements[0]=2*t.near/(u-c),Ps.elements[8]=(u+c)/(u-c),this.cameraR.projectionMatrix.copy(Ps)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(qv),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Yv)}}class zy extends wn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class tm{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Zv(),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=Zv();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Zv(){return performance.now()}const Ls=new B,Dd=new jn,lw=new B,Ds=new B,Us=new B;class cw extends Jt{constructor(){super(),this.type="AudioListener",this.context=em.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new tm}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Ls,Dd,lw),Ds.set(0,0,-1).applyQuaternion(Dd),Us.set(0,1,0).applyQuaternion(Dd),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Ls.x,n),t.positionY.linearRampToValueAtTime(Ls.y,n),t.positionZ.linearRampToValueAtTime(Ls.z,n),t.forwardX.linearRampToValueAtTime(Ds.x,n),t.forwardY.linearRampToValueAtTime(Ds.y,n),t.forwardZ.linearRampToValueAtTime(Ds.z,n),t.upX.linearRampToValueAtTime(Us.x,n),t.upY.linearRampToValueAtTime(Us.y,n),t.upZ.linearRampToValueAtTime(Us.z,n)}else t.setPosition(Ls.x,Ls.y,Ls.z),t.setOrientation(Ds.x,Ds.y,Ds.z,Us.x,Us.y,Us.z)}}class ky extends Jt{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){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+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){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+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){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.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"?(console.warn("THREE.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 Ns=new B,jv=new jn,uw=new B,Fs=new B;class hw extends ky{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(Ns,jv,uw),Fs.set(0,0,1).applyQuaternion(jv);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Ns.x,n),t.positionY.linearRampToValueAtTime(Ns.y,n),t.positionZ.linearRampToValueAtTime(Ns.z,n),t.orientationX.linearRampToValueAtTime(Fs.x,n),t.orientationY.linearRampToValueAtTime(Fs.y,n),t.orientationZ.linearRampToValueAtTime(Fs.z,n)}else t.setPosition(Ns.x,Ns.y,Ns.z),t.setOrientation(Fs.x,Fs.y,Fs.z)}}class fw{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 Hy{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,s,o;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,s=e*i+i;let o=this.cumulativeWeight;if(o===0){for(let c=0;c!==i;++c)n[s+c]=n[c];o=t}else{o+=t;const c=t/o;this._mixBufferRegion(n,s,0,c,i)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,c=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const u=t*this._origIndex;this._mixBufferRegion(n,i,u,1-s,t)}o>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let u=t,h=t+t;u!==h;++u)if(n[u]!==n[u+t]){c.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let s=n,o=i;s!==o;++s)t[s]=t[i+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,s){if(i>=.5)for(let o=0;o!==s;++o)e[t+o]=e[n+o]}_slerp(e,t,n,i){jn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const o=this._workIndex*s;jn.multiplyQuaternionsFlat(e,o,e,t,e,n),jn.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,n,i,s){const o=1-i;for(let c=0;c!==s;++c){const u=t+c;e[u]=e[u]*o+e[n+c]*i}}_lerpAdditive(e,t,n,i,s){for(let o=0;o!==s;++o){const c=t+o;e[c]=e[c]+e[n+o]*i}}}const nm="\\[\\]\\.:\\/",dw=new RegExp("["+nm+"]","g"),im="[^"+nm+"]",pw="[^"+nm.replace("\\.","")+"]",mw=/((?:WC+[\/:])*)/.source.replace("WC",im),gw=/(WCOD+)?/.source.replace("WCOD",pw),vw=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",im),_w=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",im),yw=new RegExp("^"+mw+gw+vw+_w+"$"),xw=["material","materials","bones","map"];class Sw{constructor(e,t,n){const i=n||Zt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class Zt{constructor(e,t,n){this.path=t,this.parsedPath=n||Zt.parseTrackName(t),this.node=Zt.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 Zt.Composite(e,t,n):new Zt(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(dw,"")}static parseTrackName(e){const t=yw.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=n.nodeName.substring(i+1);xw.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let o=0;o<s.length;o++){const c=s[o];if(c.name===t||c.uuid===t)return c;const u=n(c.children);if(u)return u}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let s=t.propertyIndex;if(e||(e=Zt.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let h=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let f=0;f<e.length;f++)if(e[f].name===h){h=f;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.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){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(h!==void 0){if(e[h]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[h]}}const o=e[i];if(o===void 0){const h=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+h+"."+i+" but it wasn't found.",e);return}let c=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?c=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(c=this.Versioning.MatrixWorldNeedsUpdate);let u=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}u=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(u=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(u=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][c]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Zt.Composite=Sw;Zt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Zt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Zt.prototype.GetterByBindingType=[Zt.prototype._getValue_direct,Zt.prototype._getValue_array,Zt.prototype._getValue_arrayElement,Zt.prototype._getValue_toArray];Zt.prototype.SetterByBindingTypeAndVersioning=[[Zt.prototype._setValue_direct,Zt.prototype._setValue_direct_setNeedsUpdate,Zt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Zt.prototype._setValue_array,Zt.prototype._setValue_array_setNeedsUpdate,Zt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Zt.prototype._setValue_arrayElement,Zt.prototype._setValue_arrayElement_setNeedsUpdate,Zt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Zt.prototype._setValue_fromArray,Zt.prototype._setValue_fromArray_setNeedsUpdate,Zt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Mw{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Ti(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,i=arguments.length;n!==i;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,s=this._bindings,o=s.length;let c,u=e.length,h=this.nCachedObjects_;for(let f=0,d=arguments.length;f!==d;++f){const m=arguments[f],g=m.uuid;let y=t[g];if(y===void 0){y=u++,t[g]=y,e.push(m);for(let M=0,x=o;M!==x;++M)s[M].push(new Zt(m,n[M],i[M]))}else if(y<h){c=e[y];const M=--h,x=e[M];t[x.uuid]=y,e[y]=x,t[g]=M,e[M]=m;for(let v=0,w=o;v!==w;++v){const E=s[v],T=E[M];let U=E[y];E[y]=T,U===void 0&&(U=new Zt(m,n[v],i[v])),E[M]=U}}else e[y]!==c&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastru
44cture when reloading scenes.")}this.nCachedObjects_=h}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_;for(let o=0,c=arguments.length;o!==c;++o){const u=arguments[o],h=u.uuid,f=t[h];if(f!==void 0&&f>=s){const d=s++,m=e[d];t[m.uuid]=f,e[f]=m,t[h]=d,e[d]=u;for(let g=0,y=i;g!==y;++g){const M=n[g],x=M[d],v=M[f];M[f]=x,M[d]=v}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_,o=e.length;for(let c=0,u=arguments.length;c!==u;++c){const h=arguments[c],f=h.uuid,d=t[f];if(d!==void 0)if(delete t[f],d<s){const m=--s,g=e[m],y=--o,M=e[y];t[g.uuid]=d,e[d]=g,t[M.uuid]=m,e[m]=M,e.pop();for(let x=0,v=i;x!==v;++x){const w=n[x],E=w[m],T=w[y];w[d]=E,w[m]=T,w.pop()}}else{const m=--o,g=e[m];m>0&&(t[g.uuid]=d),e[d]=g,e.pop();for(let y=0,M=i;y!==M;++y){const x=n[y];x[d]=x[m],x.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const s=this._bindings;if(i!==void 0)return s[i];const o=this._paths,c=this._parsedPaths,u=this._objects,h=u.length,f=this.nCachedObjects_,d=new Array(h);i=s.length,n[e]=i,o.push(e),c.push(t),s.push(d);for(let m=f,g=u.length;m!==g;++m){const y=u[m];d[m]=new Zt(y,e,t)}return d}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,s=this._parsedPaths,o=this._bindings,c=o.length-1,u=o[c],h=e[c];t[h]=n,o[n]=u,o.pop(),s[n]=s[c],s.pop(),i[n]=i[c],i.pop()}}}class Vy{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const s=t.tracks,o=s.length,c=new Array(o),u={endingStart:Ws,endingEnd:Ws};for(let h=0;h!==o;++h){const f=s[h].createInterpolant(null);c[h]=f,f.settings=u}this._interpolantSettings=u,this._interpolants=c,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=C_,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const i=this._clip.duration,s=e._clip.duration,o=s/i,c=i/s;e.warp(1,o,t),this.warp(c,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,s=i.time,o=this.timeScale;let c=this._timeScaleInterpolant;c===null&&(c=i._lendControlInterpolant(),this._timeScaleInterpolant=c);const u=c.parameterPositions,h=c.sampleValues;return u[0]=s,u[1]=s+n,h[0]=e/o,h[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const u=(e-s)*n;u<0||n===0?t=0:(this._startTime=null,t=n*u)}t*=this._updateTimeScale(e);const o=this._updateTime(t),c=this._updateWeight(e);if(c>0){const u=this._interpolants,h=this._propertyBindings;switch(this.blendMode){case Rp:for(let f=0,d=u.length;f!==d;++f)u[f].evaluate(o),h[f].accumulateAdditive(c);break;case wh:default:for(let f=0,d=u.length;f!==d;++f)u[f].evaluate(o),h[f].accumulate(i,c)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,s=this._loopCount;const o=n===R_;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(n===A_){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){const c=Math.floor(i/t);i-=t*c,s+=Math.abs(c);const u=this.repetitions-s;if(u<=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(u===1){const h=e<0;this._setEndings(h,!h,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:c})}}else this.time=i;if(o&&(s&1)===1)return t-i}return i}
vendor: 8,954 bytes, line 44
44_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Xs,i.endingEnd=Xs):(e?i.endingStart=this.zeroSlopeAtStart?Xs:Ws:i.endingStart=ll,t?i.endingEnd=this.zeroSlopeAtEnd?Xs:Ws:i.endingEnd=ll)}_scheduleFading(e,t,n){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const c=o.parameterPositions,u=o.sampleValues;return c[0]=s,u[0]=t,c[1]=s+e,u[1]=n,this}}const ww=new Float32Array(1);class Ew extends gr{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,c=e._interpolants,u=n.uuid,h=this._bindingsByRootAndName;let f=h[u];f===void 0&&(f={},h[u]=f);for(let d=0;d!==s;++d){const m=i[d],g=m.name;let y=f[g];if(y!==void 0)++y.referenceCount,o[d]=y;else{if(y=o[d],y!==void 0){y._cacheIndex===null&&(++y.referenceCount,this._addInactiveBinding(y,u,g));continue}const M=t&&t._propertyBindings[d].binding.parsedPath;y=new Hy(Zt.create(n,g,M),m.ValueTypeName,m.getValueSize()),++y.referenceCount,this._addInactiveBinding(y,u,g),o[d]=y}c[d].resultBuffer=y.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,s=this._actionsByClip;let o=s[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=o;else{const c=o.knownActions;e._byClipCacheIndex=c.length,c.push(e)}e._cacheIndex=i.length,i.push(e),o.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,o=this._actionsByClip,c=o[s],u=c.knownActions,h=u[u.length-1],f=e._byClipCacheIndex;h._byClipCacheIndex=f,u[f]=h,u.pop(),e._byClipCacheIndex=null;const d=c.actionByRoot,m=(e._localRoot||this._root).uuid;delete d[m],u.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,s=this._bindings;let o=i[t];o===void 0&&(o={},i[t]=o),o[n]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,s=n.path,o=this._bindingsByRootAndName,c=o[i],u=t[t.length-1],h=e._cacheIndex;u._cacheIndex=h,t[h]=u,t.pop(),delete c[s],Object.keys(c).length===0&&delete o[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new Jp(new Float32Array(2),new Float32Array(2),1,ww),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,s=t[i];e.__cacheIndex=i,t[i]=e,s.__cacheIndex=n,t[n]=s}clipAction(e,t,n){const i=t||this._root,s=i.uuid;let o=typeof e=="string"?_l.findByName(i,e):e;const c=o!==null?o.uuid:e,u=this._actionsByClip[c];let h=null;if(n===void 0&&(o!==null?n=o.blendMode:n=wh),u!==void 0){const d=u.actionByRoot[s];if(d!==void 0&&d.blendMode===n)return d;h=u.knownActions[0],o===null&&(o=h._clip)}if(o===null)return null;const f=new Vy(this,o,t,n);return this._bindAction(f,h),this._addInactiveAction(f,c,s),f}existingAction(e,t){const n=t||this._root,i=n.uuid,s=typeof e=="string"?_l.findByName(n,e):e,o=s?s.uuid:e,c=this._actionsByClip[o];return c!==void 0&&c.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let h=0;h!==n;++h)t[h]._update(i,e,s,o);const c=this._bindings,u=this._nActiveBindings;for(let h=0;h!==u;++h)c[h].apply(o);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,s=i[n];if(s!==void 0){const o=s.knownActions;for(let c=0,u=o.length;c!==u;++c){const h=o[c];this._deactivateAction(h);const f=h._cacheIndex,d=t[t.length-1];h._cacheIndex=null,h._byClipCacheIndex=null,d._cacheIndex=f,t[f]=d,t.pop(),this._removeInactiveBindingsForAction(h)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const o in n){const c=n[o].actionByRoot,u=c[t];u!==void 0&&(this._deactivateAction(u),this._removeInactiveAction(u))}const i=this._bindingsByRootAndName,s=i[t];if(s!==void 0)for(const o in s){const c=s[o];c.restoreOriginalState(),this._removeInactiveBinding(c)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class Tw extends Lp{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isRenderTarget3D=!0,this.depth=n,this.texture=new Th(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class rm{constructor(e){this.value=e}clone(){return new rm(this.value.clone===void 0?this.value:this.value.clone())}}let bw=0;class Aw extends gr{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:bw++}),this.name="",this.usage=ul,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let n=0,i=t.length;n<i;n++){const s=Array.isArray(t[n])?t[n]:[t[n]];for(let o=0;o<s.length;o++)this.uniforms.push(s[o].clone())}return this}clone(){return new this.constructor().copy(this)}}class Cw extends Ch{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 Rw{constructor(e,t,n,i,s){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=s,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 Jv=new bt;class sm{constructor(e,t,n=0,i=1/0){this.ray=new to(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new Ks,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster:
44Unsupported camera type: "+t.type)}setFromXRController(e){return Jv.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Jv),this}intersectObject(e,t=!0,n=[]){return dp(e,this,n,t),n.sort(Kv),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i<s;i++)dp(e[i],this,n,t);return n.sort(Kv),n}}function Kv(r,e){return r.distance-e.distance}function dp(r,e,t,n){let i=!0;if(r.layers.test(e.layers)&&r.raycast(e,t)===!1&&(i=!1),i===!0&&n===!0){const s=r.children;for(let o=0,c=s.length;o<c;o++)dp(s[o],e,t,!0)}}class pp{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=Rt(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(Rt(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class Iw{constructor(e=1,t=0,n=0){this.radius=e,this.theta=t,this.y=n}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}class om{constructor(e,t,n,i){om.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){const s=this.elements;return s[0]=e,s[2]=t,s[1]=n,s[3]=i,this}}const Qv=new we;class Pw{constructor(e=new we(1/0,1/0),t=new we(-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=Qv.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,Qv).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 $v=new B,fu=new B;class Lw{constructor(e=new B,t=new B){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){$v.subVectors(e,this.start),fu.subVectors(this.end,this.start);const n=fu.dot(fu);let s=fu.dot($v)/n;return t&&(s=Rt(s,0,1)),s}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}
vendor: 12,293 bytes, line 44
44applyMatrix4(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 e0=new B;class Dw extends Jt{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new zt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,c=1,u=32;o<u;o++,c++){const h=o/u*Math.PI*2,f=c/u*Math.PI*2;i.push(Math.cos(h),Math.sin(h),1,Math.cos(f),Math.sin(f),1)}n.setAttribute("position",new ht(i,3));const s=new ai({fog:!1,toneMapped:!1});this.cone=new vr(n,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),e0.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(e0),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const ts=new B,du=new bt,Ud=new bt;class Uw extends vr{constructor(e){const t=Gy(e),n=new zt,i=[],s=[],o=new rt(0,0,1),c=new rt(0,1,0);for(let h=0;h<t.length;h++){const f=t[h];f.parent&&f.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),s.push(o.r,o.g,o.b),s.push(c.r,c.g,c.b))}n.setAttribute("position",new ht(i,3)),n.setAttribute("color",new ht(s,3));const u=new ai({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,u),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");Ud.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){const c=t[s];c.parent&&c.parent.isBone&&(du.multiplyMatrices(Ud,c.matrixWorld),ts.setFromMatrixPosition(du),i.setXYZ(o,ts.x,ts.y,ts.z),du.multiplyMatrices(Ud,c.parent.matrixWorld),ts.setFromMatrixPosition(du),i.setXYZ(o+1,ts.x,ts.y,ts.z),o+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function Gy(r){const e=[];r.isBone===!0&&e.push(r);for(let t=0;t<r.children.length;t++)e.push(...Gy(r.children[t]));return e}class Nw extends mn{constructor(e,t,n){const i=new Nl(t,4,2),s=new Br({wireframe:!0,fog:!1,toneMapped:!1});super(i,s),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const Fw=new B,t0=new rt,n0=new rt;class Ow extends Jt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new Ul(t);i.rotateY(Math.PI*.5),this.material=new Br({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=i.getAttribute("position"),o=new Float32Array(s.count*3);i.setAttribute("color",new nn(o,3)),this.add(new mn(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");t0.copy(this.light.color),n0.copy(this.light.groundColor);for(let n=0,i=t.count;n<i;n++){const s=n<i/2?t0:n0;t.setXYZ(n,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(Fw.setFromMatrixPosition(this.light.matrixWorld).negate())}}class Bw extends vr{constructor(e=10,t=10,n=4473924,i=8947848){n=new rt(n),i=new rt(i);const s=t/2,o=e/t,c=e/2,u=[],h=[];for(let m=0,g=0,y=-c;m<=t;m++,y+=o){u.push(-c,0,y,c,0,y),u.push(y,0,-c,y,0,c);const M=m===s?n:i;M.toArray(h,g),g+=3,M.toArray(h,g),g+=3,M.toArray(h,g),g+=3,M.toArray(h,g),g+=3}const f=new zt;f.setAttribute("position",new ht(u,3)),f.setAttribute("color",new ht(h,3));const d=new ai({vertexColors:!0,toneMapped:!1});super(f,d),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class zw extends vr{constructor(e=10,t=16,n=8,i=64,s=4473924,o=8947848){s=new rt(s),o=new rt(o);const c=[],u=[];if(t>1)for(let d=0;d<t;d++){const m=d/t*(Math.PI*2),g=Math.sin(m)*e,y=Math.cos(m)*e;c.push(0,0,0),c.push(g,0,y);const M=d&1?s:o;u.push(M.r,M.g,M.b),u.push(M.r,M.g,M.b)}for(let d=0;d<n;d++){const m=d&1?s:o,g=e-e/n*d;for(let y=0;y<i;y++){let M=y/i*(Math.PI*2),x=Math.sin(M)*g,v=Math.cos(M)*g;c.push(x,0,v),u.push(m.r,m.g,m.b),M=(y+1)/i*(Math.PI*2),x=Math.sin(M)*g,v=Math.cos(M)*g,c.push(x,0,v),u.push(m.r,m.g,m.b)}}const h=new zt;h.setAttribute("position",new ht(c,3)),h.setAttribute("color",new ht(u,3));const f=new ai({vertexColors:!0,toneMapped:!1});super(h,f),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const i0=new B,pu=new B,r0=new B;class kw extends Jt{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 zt;i.setAttribute("position",new ht([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new ai({fog:!1,toneMapped:!1});this.lightPlane=new us(i,s),this.add(this.lightPlane),i=new zt,i.setAttribute("position",new ht([0,0,0,0,0,1],3)),this.targetLine=new us(i,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),i0.setFromMatrixPosition(this.light.matrixWorld),pu.setFromMatrixPosition(this.light.target.matrixWorld),r0.subVectors(pu,i0),this.lightPlane.lookAt(pu),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(pu),this.targetLine.scale.z=r0.length()}}const mu=new B,xn=new Cl;class Hw extends vr{constructor(e){const t=new zt,n=new ai({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],o={};c("n1","n2"),c("n2","n4"),c("n4","n3"),c("n3","n1"),c("f1","f2"),c("f2","f4"),c("f4","f3"),c("f3","f1"),c("n1","f1"),c("n2","f2"),c("n3","f3"),c("n4","f4"),c("p","n1"),c("p","n2"),c("p","n3"),c("p","n4"),c("u1","u2"),c("u2","u3"),c("u3","u1"),c("c","t"),c("p","c"),c("cn1","cn2"),c("cn3","cn4"),c("cf1","cf2"),c("cf3","cf4");function c(y,M){u(y),u(M)}function u(y){i.push(0,0,0),s.push(0,0,0),o[y]===void 0&&(o[y]=[]),o[y].push(i.length/3-1)}t.setAttribute("position",new ht(i,3)),t.setAttribute("color",new ht(s,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update();const h=new rt(16755200),f=new rt(16711680),d=new rt(43775),m=new rt(16777215),g=new rt(3355443);this.setColors(h,f,d,m,g)}setColors(e,t,n,i,s){const c=this.geometry.getAttribute("color");c.setXYZ(0,e.r,e.g,e.b),c.setXYZ(1,e.r,e.g,e.b),c.setXYZ(2,e.r,e.g,e.b),c.setXYZ(3,e.r,e.g,e.b),c.setXYZ(4,e.r,e.g,e.b),c.setXYZ(5,e.r,e.g,e.b),c.setXYZ(6,e.r,e.g,e.b),c.setXYZ(7,e.r,e.g,e.b),c.setXYZ(8,e.r,e.g,e.b),c.setXYZ(9,e.r,e.g,e.b),c.setXYZ(10,e.r,e.g,e.b),c.setXYZ(11,e.r,e.g,e.b),c.setXYZ(12,e.r,e.g,e.b),c.setXYZ(13,e.r,e.g,e.b),c.setXYZ(14,e.r,e.g,e.b),c.setXYZ(15,e.r,e.g,e.b),c.setXYZ(16,e.r,e.g,e.b),c.setXYZ(17,e.r,e.g,e.b),c.setXYZ(18,e.r,e.g,e.b),c.setXYZ(19,e.r,e.g,e.b),c.setXYZ(20,e.r,e.g,e.b),c.setXYZ(21,e.r,e.g,e.b),c.setXYZ(22,e.r,e.g,e.b),c.setXYZ(23,e.r,e.g,e.b),c.setXYZ(24,t.r,t.g,t.b),c.setXYZ(25,t.r,t.g,t.b),c.setXYZ(26,t.r,t.g,t.b),c.setXYZ(27,t.r,t.g,t.b),c.setXYZ(28,t.r,t.g,t.b),c.setXYZ(29,t.r,t.g,t.b),c.setXYZ(30,t.r,t.g,t.b),c.setXYZ(31,t.r,t.g,t.b),c.setXYZ(32,n.r,n.g,n.b),c.setXYZ(33,n.r,n.g,n.b),c.setXYZ(34,n.r,n.g,n.b),c.setXYZ(35,n.r,n.g,n.b),c.setXYZ(36,n.r,n.g,n.b),c.setXYZ(37,n.r,n.g,n.b),c.setXYZ(38,i.r,i.g,i.b),c.setXYZ(39,i.r,i.g,i.b),c.setXYZ(40,s.r,s.g,s.b),c.setXYZ(41,s.r,s.g,s.b),c.setXYZ(42,s.r,s.g,s.b),c.setXYZ(43,s.r,s.g,s.b),c.setXYZ(44,s.r,s.g,s.b),c.setXYZ(45,s.r,s.g,s.b),c.setXYZ(46,s.r,s.g,s.b),c.setXYZ(47,s.r,s.g,s.b),c.setXYZ(48,s.r,s.g,s.b),c.setXYZ(49,s.r,s.g,s.b),c.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,n=1,i=1;xn.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse);const s=this.camera.coordinateSystem===Bi?-1:0;Mn("c",t,e,xn,0,0,s),Mn("t",t,e,xn,0,0,1),Mn("n1",t,e,xn,-1,-1,s),Mn("n2",t,e,xn,n,-1,s),Mn("n3",t,e,xn,-1,i,s),Mn("n4",t,e,xn,n,i,s),Mn("f1",t,e,xn,-1,-1,1),Mn("f2",t,e,xn,n,-1,1),Mn("f3",t,e,xn,-1,i,1),Mn("f4",t,e,xn,n,i,1),Mn("u1",t,e,xn,n*.7,i*1.1,s),Mn("u2",t,e,xn,-1*.7,i*1.1,s),Mn("u3",t,e,xn,0,i*2,s),Mn("cf1",t,e,xn,-1,0,1),Mn("cf2",t,e,xn,n,0,1),Mn("cf3",t,e,xn,0,-1,1),Mn("cf4",t,e,xn,0,i,1),Mn("cn1",t,e,xn,-1,0,s),Mn("cn2",t,e,xn,n,0,s),Mn("cn3",t,e,xn,0,-1,s),Mn("cn4",t,e,xn,0,i,s),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Mn(r,e,t,n,i,s,o){mu.set(i,s,o).unproject(n);const c=e[r];if(c!==void 0){const u=t.getAttribute("position");for(let h=0,f=c.length;h<f;h++)u.setXYZ(c[h],mu.x,mu.y,mu.z)}}const gu=new Jn;class Vw extends vr{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(8*3),s=new zt;s.setIndex(new nn(n,1)),s.setAttribute("position",new nn(i,3)),super(s,new ai({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&gu.setFromObject(this.object),gu.isEmpty())return;const e=gu.min,t=gu.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 Gw extends vr{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new zt;s.setIndex(new nn(n,1)),s.setAttribute("position",new ht(i,3)),super(s,new ai({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 Ww extends us{constructor(e,t=1,n=16776960){const i=n,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],o=new zt;o.setAttribute("position",new ht(s,3)),o.computeBoundingSphere(),super(o,new ai({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const c=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],u=new zt;u.setAttribute("position",new ht(c,3)),u.computeBoundingSphere(),this.add(new mn(u,new Br({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 s0=new B;let vu,Nd;class Xw extends Jt{constructor(e=new B(0,0,1),t=new B(0,0,0),n=1,i=16776960,s=n*.2,o=s*.2){super(),this.type="ArrowHelper",vu===void 0&&(vu=ne
vendor: 11,504 bytes, lines 44-107
44w zt,vu.setAttribute("position",new ht([0,0,0,0,1,0],3)),Nd=new Ll(.5,1,5,1),Nd.translate(0,-.5,0)),this.position.copy(t),this.line=new us(vu,new ai({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new mn(Nd,new Br({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,s,o)}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{s0.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(s0,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 Yw extends vr{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 zt;i.setAttribute("position",new ht(t,3)),i.setAttribute("color",new ht(n,3));const s=new ai({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,t,n){const i=new rt,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(t),i.toArray(s,6),i.toArray(s,9),i.set(n),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class qw{constructor(){this.type="ShapePath",this.color=new rt,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new mh,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,s,o){return this.currentPath.bezierCurveTo(e,t,n,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(v){const w=[];for(let E=0,T=v.length;E<T;E++){const U=v[E],I=new as;I.curves=U.curves,w.push(I)}return w}function n(v,w){const E=w.length;let T=!1;for(let U=E-1,I=0;I<E;U=I++){let N=w[U],D=w[I],C=D.x-N.x,A=D.y-N.y;if(Math.abs(A)>Number.EPSILON){if(A<0&&(N=w[I],C=-C,D=w[U],A=-A),v.y<N.y||v.y>D.y)continue;if(v.y===N.y){if(v.x===N.x)return!0}else{const F=A*(v.x-N.x)-C*(v.y-N.y);if(F===0)return!0;if(F<0)continue;T=!T}}else{if(v.y!==N.y)continue;if(D.x<=v.x&&v.x<=N.x||N.x<=v.x&&v.x<=D.x)return!0}}return T}const i=Ji.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,c,u;const h=[];if(s.length===1)return c=s[0],u=new as,u.curves=c.curves,h.push(u),h;let f=!i(s[0].getPoints());f=e?!f:f;const d=[],m=[];let g=[],y=0,M;m[y]=void 0,g[y]=[];for(let v=0,w=s.length;v<w;v++)c=s[v],M=c.getPoints(),o=i(M),o=e?!o:o,o?(!f&&m[y]&&y++,m[y]={s:new as,p:M},m[y].s.curves=c.curves,f&&y++,g[y]=[]):g[y].push({h:c,p:M[0]});if(!m[0])return t(s);if(m.length>1){let v=!1,w=0;for(let E=0,T=m.length;E<T;E++)d[E]=[];for(let E=0,T=m.length;E<T;E++){const U=g[E];for(let I=0;I<U.length;I++){const N=U[I];let D=!0;for(let C=0;C<m.length;C++)n(N.p,m[C].p)&&(E!==C&&w++,D?(D=!1,d[C].push(N)):v=!0);D&&d[E].push(N)}}w>0&&v===!1&&(g=d)}let x;for(let v=0,w=m.length;v<w;v++){u=m[v].s,h.push(u),x=g[v];for(let E=0,T=x.length;E<T;E++)u.holes.push(x[E].h)}return h}}class Zw extends gr{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){console.warn("THREE.Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function jw(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2):(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0),r}function Jw(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0):(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2),r}function Kw(r){return r.repeat.x=1,r.repeat.y=1,r.offset.x=0,r.offset.y=0,r}function mp(r,e,t,n){const i=Qw(n);switch(t){case Tp:return r*e;case bl:return r*e/i.components*i.byteLength;case Al:return r*e/i.components*i.byteLength;case Ap:return r*e*2/i.components*i.byteLength;case Sh:return r*e*2/i.components*i.byteLength;case bp:return r*e*3/i.components*i.byteLength;case En:return r*e*4/i.components*i.byteLength;case Mh:return r*e*4/i.components*i.byteLength;case ja:case Ja:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Ka:case Qa:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case ku:case Vu:return Math.max(r,16)*Math.max(e,8)/4;case zu:case Hu:return Math.max(r,8)*Math.max(e,8)/2;case Gu:case Wu:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Xu:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Yu:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case qu:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case Zu:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case ju:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case Ju:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case Ku:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case Qu:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case $u:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case eh:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case th:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case nh:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case ih:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case rh:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case sh:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case $a:case oh:case ah:return Math.ceil(r/4)*Math.ceil(e/4)*16;case Cp:case lh:return Math.ceil(r/4)*Math.ceil(e/4)*8;case ch:case uh:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Qw(r){switch(r){case oi:case vh:return{byteLength:1,components:1};case Ko:case _h:case Bn:return{byteLength:2,components:1};case yh:case xh:return{byteLength:2,components:4};case pr:case Tl:case pn:return{byteLength:4,components:1};case Ep:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}class $w{static contain(e,t){return jw(e,t)}static cover(e,t){return Jw(e,t)}static fill(e){return Kw(e)}static getByteLength(e,t,n,i){return mp(e,t,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:wl}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=wl);/** 45 * @license 46 * Copyright 2010-2025 Three.js Authors 47 * SPDX-License-Identifier: MIT 48 */function Wy(){let r=null,e=!1,t=null,n=null;function i(s,o){t(s,o),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function eE(r){const e=new WeakMap;function t(c,u){const h=c.array,f=c.usage,d=h.byteLength,m=r.createBuffer();r.bindBuffer(u,m),r.bufferData(u,h,f),c.onUploadCallback();let g;if(h instanceof Float32Array)g=r.FLOAT;else if(h instanceof Uint16Array)c.isFloat16BufferAttribute?g=r.HALF_FLOAT:g=r.UNSIGNED_SHORT;else if(h instanceof Int16Array)g=r.SHORT;else if(h instanceof Uint32Array)g=r.UNSIGNED_INT;else if(h instanceof Int32Array)g=r.INT;else if(h instanceof Int8Array)g=r.BYTE;else if(h instanceof Uint8Array)g=r.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)g=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:m,type:g,bytesPerElement:h.BYTES_PER_ELEMENT,version:c.version,size:d}}function n(c,u,h){const f=u.array,d=u.updateRanges;if(r.bindBuffer(h,c),d.length===0)r.bufferSubData(h,0,f);else{d.sort((g,y)=>g.start-y.start);let m=0;for(let g=1;g<d.length;g++){const y=d[m],M=d[g];M.start<=y.start+y.count+1?y.count=Math.max(y.count,M.start+M.count-y.start):(++m,d[m]=M)}d.length=m+1;for(let g=0,y=d.length;g<y;g++){const M=d[g];r.bufferSubData(h,M.start*f.BYTES_PER_ELEMENT,f,M.start,M.count)}u.clearUpdateRanges()}u.onUploadCallback()}function i(c){return c.isInterleavedBufferAttribute&&(c=c.data),e.get(c)}function s(c){c.isInterleavedBufferAttribute&&(c=c.data);const u=e.get(c);u&&(r.deleteBuffer(u.buffer),e.delete(c))}function o(c,u){if(c.isInterleavedBufferAttribute&&(c=c.data),c.isGLBufferAttribute){const f=e.get(c);(!f||f.version<c.version)&&e.set(c,{buffer:c.buffer,type:c.type,bytesPerElement:c.elementSize,version:c.version});return}const h=e.get(c);if(h===void 0)e.set(c,t(c,u));else if(h.version<c.version){if(h.size!==c.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(h.buffer,c,u),h.version=c.version}}return{get:i,remove:s,update:o}}var tE=`#ifdef USE_ALPHAHASH 49 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard; 50#endif`,nE=`#ifdef USE_ALPHAHASH 51 const float ALPHA_HASH_SCALE = 0.05; 52 float hash2D( vec2 value ) { 53 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) ); 54 } 55 float hash3D( vec3 value ) { 56 return hash2D( vec2( hash2D( value.xy ), value.z ) ); 57 } 58 float getAlphaHashThreshold( vec3 position ) { 59 float maxDeriv = max( 60 length( dFdx( position.xyz ) ), 61 length( dFdy( position.xyz ) ) 62 ); 63 float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv ); 64 vec2 pixScales = vec2( 65 exp2( floor( log2( pixScale ) ) ), 66 exp2( ceil( log2( pixScale ) ) ) 67 ); 68 vec2 alpha = vec2( 69 hash3D( floor( pixScales.x * position.xyz ) ), 70 hash3D( floor( pixScales.y * position.xyz ) ) 71 ); 72 float lerpFactor = fract( log2( pixScale ) ); 73 float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y; 74 float a = min( lerpFactor, 1.0 - lerpFactor ); 75 vec3 cases = vec3( 76 x * x / ( 2.0 * a * ( 1.0 - a ) ), 77 ( x - 0.5 * a ) / ( 1.0 - a ), 78 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) ) 79 ); 80 float threshold = ( x < ( 1.0 - a ) ) 81 ? ( ( x < a ) ? cases.x : cases.y ) 82 : cases.z; 83 return clamp( threshold , 1.0e-6, 1.0 ); 84 } 85#endif`,iE=`#ifdef USE_ALPHAMAP 86 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g; 87#endif`,rE=`#ifdef USE_ALPHAMAP 88 uniform sampler2D alphaMap; 89#endif`,sE=`#ifdef USE_ALPHATEST 90 #ifdef ALPHA_TO_COVERAGE 91 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a ); 92 if ( diffuseColor.a == 0.0 ) discard; 93 #else 94 if ( diffuseColor.a < alphaTest ) discard; 95 #endif 96#endif`,oE=`#ifdef USE_ALPHATEST 97 uniform float alphaTest; 98#endif`,aE=`#ifdef USE_AOMAP 99 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0; 100 reflectedLight.indirectDiffuse *= ambientOcclusion; 101 #if defined( USE_CLEARCOAT ) 102 clearcoatSpecularIndirect *= ambientOcclusion; 103 #endif 104 #if defined( USE_SHEEN ) 105 sheenSpecularIndirect *= ambientOcclusion; 106 #endif 107 #if defined( USE_ENVMAP ) && defined( STANDARD )
108 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) ); 109 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 110 #endif 111#endif`,lE=`#ifdef USE_AOMAP 112 uniform sampler2D aoMap; 113 uniform float aoMapIntensity; 114#endif`,cE=`#ifdef USE_BATCHING 115 #if ! defined( GL_ANGLE_multi_draw ) 116 #define gl_DrawID _gl_DrawID 117 uniform int _gl_DrawID; 118 #endif 119 uniform highp sampler2D batchingTexture; 120 uniform highp usampler2D batchingIdTexture; 121 mat4 getBatchingMatrix( const in float i ) { 122 int size = textureSize( batchingTexture, 0 ).x; 123 int j = int( i ) * 4; 124 int x = j % size; 125 int y = j / size; 126 vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 ); 127 vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 ); 128 vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 ); 129 vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 ); 130 return mat4( v1, v2, v3, v4 ); 131 } 132 float getIndirectIndex( const in int i ) { 133 int size = textureSize( batchingIdTexture, 0 ).x; 134 int x = i % size; 135 int y = i / size; 136 return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r ); 137 } 138#endif 139#ifdef USE_BATCHING_COLOR 140 uniform sampler2D batchingColorTexture; 141 vec3 getBatchingColor( const in float i ) { 142 int size = textureSize( batchingColorTexture, 0 ).x; 143 int j = int( i ); 144 int x = j % size; 145 int y = j / size; 146 return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb; 147 } 148#endif`,uE=`#ifdef USE_BATCHING 149 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) ); 150#endif`,hE=`vec3 transformed = vec3( position ); 151#ifdef USE_ALPHAHASH 152 vPosition = vec3( position ); 153#endif`,fE=`vec3 objectNormal = vec3( normal ); 154#ifdef USE_TANGENT 155 vec3 objectTangent = vec3( tangent.xyz ); 156#endif`,dE=`float G_BlinnPhong_Implicit( ) { 157 return 0.25; 158} 159float D_BlinnPhong( const in float shininess, const in float dotNH ) { 160 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 161} 162vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 163 vec3 halfDir = normalize( lightDir + viewDir ); 164 float dotNH = saturate( dot( normal, halfDir ) ); 165 float dotVH = saturate( dot( viewDir, halfDir ) ); 166 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 167 float G = G_BlinnPhong_Implicit( ); 168 float D = D_BlinnPhong( shininess, dotNH ); 169 return F * ( G * D ); 170} // validated`,pE=`#ifdef USE_IRIDESCENCE 171 const mat3 XYZ_TO_REC709 = mat3( 172 3.2404542, -0.9692660, 0.0556434, 173 -1.5371385, 1.8760108, -0.2040259, 174 -0.4985314, 0.0415560, 1.0572252 175 ); 176 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 177 vec3 sqrtF0 = sqrt( fresnel0 ); 178 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 179 } 180 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 181 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 182 } 183 float IorToFresnel0( float transmittedIor, float incidentIor ) { 184 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 185 } 186 vec3 evalSensitivity( float OPD, vec3 shift ) { 187 float phase = 2.0 * PI * OPD * 1.0e-9; 188 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 189 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 190 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 191 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 192 xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) ); 193 xyz /= 1.0685e-7; 194 vec3 rgb = XYZ_TO_REC709 * xyz; 195 return rgb; 196 } 197 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 198 vec3 I; 199 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 200 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 201 float cosTheta2Sq = 1.0 - sinTheta2Sq; 202 if ( cosTheta2Sq < 0.0 ) { 203 return vec3( 1.0 ); 204 } 205 float cosTheta2 = sqrt( cosTheta2Sq ); 206 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
207 float R12 = F_Schlick( R0, 1.0, cosTheta1 ); 208 float T121 = 1.0 - R12; 209 float phi12 = 0.0; 210 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 211 float phi21 = PI - phi12; 212 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 213 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 214 vec3 phi23 = vec3( 0.0 ); 215 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 216 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 217 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 218 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 219 vec3 phi = vec3( phi21 ) + phi23; 220 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 221 vec3 r123 = sqrt( R123 ); 222 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 223 vec3 C0 = R12 + Rs; 224 I = C0; 225 vec3 Cm = Rs - T121; 226 for ( int m = 1; m <= 2; ++ m ) { 227 Cm *= r123; 228 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 229 I += Cm * Sm; 230 } 231 return max( I, vec3( 0.0 ) ); 232 } 233#endif`,mE=`#ifdef USE_BUMPMAP 234 uniform sampler2D bumpMap; 235 uniform float bumpScale; 236 vec2 dHdxy_fwd() { 237 vec2 dSTdx = dFdx( vBumpMapUv ); 238 vec2 dSTdy = dFdy( vBumpMapUv ); 239 float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x; 240 float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll; 241 float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll; 242 return vec2( dBx, dBy ); 243 } 244 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 245 vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) ); 246 vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) ); 247 vec3 vN = surf_norm; 248 vec3 R1 = cross( vSigmaY, vN ); 249 vec3 R2 = cross( vN, vSigmaX ); 250 float fDet = dot( vSigmaX, R1 ) * faceDirection; 251 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 252 return normalize( abs( fDet ) * surf_norm - vGrad ); 253 } 254#endif`,gE=`#if NUM_CLIPPING_PLANES > 0 255 vec4 plane; 256 #ifdef ALPHA_TO_COVERAGE 257 float distanceToPlane, distanceGradient; 258 float clipOpacity = 1.0; 259 #pragma unroll_loop_start 260 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 261 plane = clippingPlanes[ i ]; 262 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 263 distanceGradient = fwidth( distanceToPlane ) / 2.0; 264 clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 265 if ( clipOpacity == 0.0 ) discard; 266 } 267 #pragma unroll_loop_end 268 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 269 float unionClipOpacity = 1.0; 270 #pragma unroll_loop_start 271 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 272 plane = clippingPlanes[ i ]; 273 distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; 274 distanceGradient = fwidth( distanceToPlane ) / 2.0; 275 unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); 276 } 277 #pragma unroll_loop_end 278 clipOpacity *= 1.0 - unionClipOpacity; 279 #endif 280 diffuseColor.a *= clipOpacity; 281 if ( diffuseColor.a == 0.0 ) discard; 282 #else 283 #pragma unroll_loop_start 284 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 285 plane = clippingPlanes[ i ]; 286 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 287 } 288 #pragma unroll_loop_end 289 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 290 bool clipped = true; 291 #pragma unroll_loop_start 292 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 293 plane = clippingPlanes[ i ]; 294 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 295 } 296 #pragma unroll_loop_end 297 if ( clipped ) discard; 298 #endif 299 #endif 300#endif`,vE=`#if NUM_CLIPPING_PLANES > 0 301 varying vec3 vClipPosition; 302 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 303#endif`,_E=`#if NUM_CLIPPING_PLANES > 0 304 varying vec3 vClipPosition; 305#endif`,yE=`#if NUM_CLIPPING_PLANES > 0 306 vClipPosition = - mvPosition.xyz; 307#endif`,xE=`#if defined( USE_COLOR_ALPHA ) 308 diffuseColor *= vColor; 309#elif defined( USE_COLOR ) 310 diffuseColor.rgb *= vColor; 311#endif`,SE=`#if defined( USE_COLOR_ALPHA ) 312 varying vec4 vColor; 313#elif defined( USE_COLOR ) 314 varying vec3 vColor; 315#endif`,ME=`#if defined( USE_COLOR_ALPHA ) 316 varying vec4 vColor; 317#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 318 varying vec3 vColor; 319#endif`,wE=`#if defined( USE_COLOR_ALPHA ) 320 vColor = vec4( 1.0 ); 321#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) 322 vColor = vec3( 1.0 ); 323#endif 324#ifdef USE_COLOR 325 vColor *= color; 326#endif 327#ifdef USE_INSTANCING_COLOR 328 vColor.xyz *= instanceColor.xyz; 329#endif 330#ifdef USE_BATCHING_COLOR 331 vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); 332 vColor.xyz *= batchingColor.xyz; 333#endif`,EE=`#define PI 3.141592653589793 334#define PI2 6.283185307179586 335#define PI_HALF 1.5707963267948966 336#define RECIPROCAL_PI 0.3183098861837907 337#define RECIPROCAL_PI2 0.15915494309189535 338#define EPSILON 1e-6 339#ifndef saturate 340#define saturate( a ) clamp( a, 0.0, 1.0 ) 341#endif 342#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 343float pow2( const in float x ) { return x*x; } 344vec3 pow2( const in vec3 x ) { return x*x; } 345float pow3( const in float x ) { return x*x*x; } 346float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 347float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 348float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 349highp float rand( const in vec2 uv ) { 350 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 351 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 352 return fract( sin( sn ) * c ); 353} 354#ifdef HIGH_PRECISION 355 float precisionSafeLength( vec3 v ) { return length( v ); } 356#else 357 float precisionSafeLength( vec3 v ) { 358 float maxComponent = max3( abs( v ) ); 359 return length( v / maxComponent ) * maxComponent; 360 } 361#endif 362struct IncidentLight { 363 vec3 color; 364 vec3 direction; 365 bool visible; 366}; 367struct ReflectedLight { 368 vec3 directDiffuse; 369 vec3 directSpecular; 370 vec3 indirectDiffuse; 371 vec3 indirectSpecular; 372}; 373#ifdef USE_ALPHAHASH 374 varying vec3 vPosition; 375#endif 376vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 377 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 378} 379vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { 380 return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); 381} 382mat3 transposeMat3( const in mat3 m ) { 383 mat3 tmp; 384 tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); 385 tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); 386 tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); 387 return tmp; 388} 389bool isPerspectiveMatrix( mat4 m ) { 390 return m[ 2 ][ 3 ] == - 1.0; 391} 392vec2 equirectUv( in vec3 dir ) { 393 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 394 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 395 return vec2( u, v ); 396}
397vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 398 return RECIPROCAL_PI * diffuseColor; 399} 400vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 401 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 402 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 403} 404float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 405 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 406 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 407} // validated`,TE=`#ifdef ENVMAP_TYPE_CUBE_UV 408 #define cubeUV_minMipLevel 4.0 409 #define cubeUV_minTileSize 16.0 410 float getFace( vec3 direction ) { 411 vec3 absDirection = abs( direction ); 412 float face = - 1.0; 413 if ( absDirection.x > absDirection.z ) { 414 if ( absDirection.x > absDirection.y ) 415 face = direction.x > 0.0 ? 0.0 : 3.0; 416 else 417 face = direction.y > 0.0 ? 1.0 : 4.0; 418 } else { 419 if ( absDirection.z > absDirection.y ) 420 face = direction.z > 0.0 ? 2.0 : 5.0; 421 else 422 face = direction.y > 0.0 ? 1.0 : 4.0; 423 } 424 return face; 425 } 426 vec2 getUV( vec3 direction, float face ) { 427 vec2 uv; 428 if ( face == 0.0 ) { 429 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 430 } else if ( face == 1.0 ) { 431 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 432 } else if ( face == 2.0 ) { 433 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 434 } else if ( face == 3.0 ) { 435 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 436 } else if ( face == 4.0 ) { 437 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 438 } else { 439 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 440 } 441 return 0.5 * ( uv + 1.0 ); 442 } 443 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 444 float face = getFace( direction ); 445 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 446 mipInt = max( mipInt, cubeUV_minMipLevel ); 447 float faceSize = exp2( mipInt ); 448 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 449 if ( face > 2.0 ) { 450 uv.y += faceSize; 451 face -= 3.0; 452 } 453 uv.x += face * faceSize; 454 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 455 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 456 uv.x *= CUBEUV_TEXEL_WIDTH; 457 uv.y *= CUBEUV_TEXEL_HEIGHT; 458 #ifdef texture2DGradEXT 459 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 460 #else 461 return texture2D( envMap, uv ).rgb; 462 #endif 463 } 464 #define cubeUV_r0 1.0 465 #define cubeUV_m0 - 2.0 466 #define cubeUV_r1 0.8 467 #define cubeUV_m1 - 1.0 468 #define cubeUV_r4 0.4 469 #define cubeUV_m4 2.0 470 #define cubeUV_r5 0.305 471 #define cubeUV_m5 3.0 472 #define cubeUV_r6 0.21 473 #define cubeUV_m6 4.0 474 float roughnessToMip( float roughness ) { 475 float mip = 0.0; 476 if ( roughness >= cubeUV_r1 ) { 477 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 478 } else if ( roughness >= cubeUV_r4 ) { 479 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 480 } else if ( roughness >= cubeUV_r5 ) { 481 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 482 } else if ( roughness >= cubeUV_r6 ) { 483 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 484 } else { 485 mip = - 2.0 * log2( 1.16 * roughness ); } 486 return mip; 487 } 488 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 489 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 490 float mipF = fract( mip ); 491 float mipInt = floor( mip ); 492 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 493 if ( mipF == 0.0 ) { 494 return vec4( color0, 1.0 ); 495 } else { 496 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 497 return vec4( mix( color0, color1, mipF ), 1.0 ); 498 } 499 } 500#endif`,bE=`vec3 transformedNormal = objectNormal; 501#ifdef USE_TANGENT 502 vec3 transformedTangent = objectTangent; 503#endif 504#ifdef USE_BATCHING 505 mat3 bm = mat3( batchingMatrix ); 506 transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); 507 transformedNormal = bm * transformedNormal; 508 #ifdef USE_TANGENT 509 transformedTangent = bm * transformedTangent; 510 #endif 511#endif 512#ifdef USE_INSTANCING 513 mat3 im = mat3( instanceMatrix ); 514 transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); 515 transformedNormal = im * transformedNormal; 516 #ifdef USE_TANGENT 517 transformedTangent = im * transformedTangent; 518 #endif 519#endif 520transformedNormal = normalMatrix * transformedNormal; 521#ifdef FLIP_SIDED 522 transformedNormal = - transformedNormal; 523#endif 524#ifdef USE_TANGENT 525 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; 526 #ifdef FLIP_SIDED 527 transformedTangent = - transformedTangent; 528 #endif 529#endif`,AE=`#ifdef USE_DISPLACEMENTMAP 530 uniform sampler2D displacementMap; 531 uniform float displacementScale; 532 uniform float displacementBias; 533#endif`,CE=`#ifdef USE_DISPLACEMENTMAP 534 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
534placementBias ); 535#endif`,RE=`#ifdef USE_EMISSIVEMAP 536 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); 537 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE 538 emissiveColor = sRGBTransferEOTF( emissiveColor ); 539 #endif 540 totalEmissiveRadiance *= emissiveColor.rgb; 541#endif`,IE=`#ifdef USE_EMISSIVEMAP 542 uniform sampler2D emissiveMap; 543#endif`,PE="gl_FragColor = linearToOutputTexel( gl_FragColor );",LE=`vec4 LinearTransferOETF( in vec4 value ) { 544 return value; 545} 546vec4 sRGBTransferEOTF( in vec4 value ) { 547 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 ); 548} 549vec4 sRGBTransferOETF( in vec4 value ) { 550 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 ); 551}`,DE=`#ifdef USE_ENVMAP 552 #ifdef ENV_WORLDPOS 553 vec3 cameraToFrag; 554 if ( isOrthographic ) { 555 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 556 } else { 557 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 558 } 559 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 560 #ifdef ENVMAP_MODE_REFLECTION 561 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 562 #else 563 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 564 #endif 565 #else 566 vec3 reflectVec = vReflect; 567 #endif 568 #ifdef ENVMAP_TYPE_CUBE 569 vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); 570 #else 571 vec4 envColor = vec4( 0.0 ); 572 #endif 573 #ifdef ENVMAP_BLENDING_MULTIPLY 574 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 575 #elif defined( ENVMAP_BLENDING_MIX ) 576 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 577 #elif defined( ENVMAP_BLENDING_ADD ) 578 outgoingLight += envColor.xyz * specularStrength * reflectivity; 579 #endif 580#endif`,UE=`#ifdef USE_ENVMAP 581 uniform float envMapIntensity; 582 uniform float flipEnvMap; 583 uniform mat3 envMapRotation; 584 #ifdef ENVMAP_TYPE_CUBE 585 uniform samplerCube envMap; 586 #else 587 uniform sampler2D envMap; 588 #endif 589 590#endif`,NE=`#ifdef USE_ENVMAP 591 uniform float reflectivity; 592 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 593 #define ENV_WORLDPOS 594 #endif 595 #ifdef ENV_WORLDPOS 596 varying vec3 vWorldPosition; 597 uniform float refractionRatio; 598 #else 599 varying vec3 vReflect; 600 #endif 601#endif`,FE=`#ifdef USE_ENVMAP 602 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 603 #define ENV_WORLDPOS 604 #endif 605 #ifdef ENV_WORLDPOS 606 607 varying vec3 vWorldPosition; 608 #else 609 varying vec3 vReflect; 610 uniform float refractionRatio; 611 #endif 612#endif`,OE=`#ifdef USE_ENVMAP 613 #ifdef ENV_WORLDPOS 614 vWorldPosition = worldPosition.xyz; 615 #else 616 vec3 cameraToVertex; 617 if ( isOrthographic ) { 618 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 619 } else {
620 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 621 } 622 vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 623 #ifdef ENVMAP_MODE_REFLECTION 624 vReflect = reflect( cameraToVertex, worldNormal ); 625 #else 626 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 627 #endif 628 #endif 629#endif`,BE=`#ifdef USE_FOG 630 vFogDepth = - mvPosition.z; 631#endif`,zE=`#ifdef USE_FOG 632 varying float vFogDepth; 633#endif`,kE=`#ifdef USE_FOG 634 #ifdef FOG_EXP2 635 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 636 #else 637 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 638 #endif 639 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 640#endif`,HE=`#ifdef USE_FOG 641 uniform vec3 fogColor; 642 varying float vFogDepth; 643 #ifdef FOG_EXP2 644 uniform float fogDensity; 645 #else 646 uniform float fogNear; 647 uniform float fogFar; 648 #endif 649#endif`,VE=`#ifdef USE_GRADIENTMAP 650 uniform sampler2D gradientMap; 651#endif 652vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 653 float dotNL = dot( normal, lightDirection ); 654 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 655 #ifdef USE_GRADIENTMAP 656 return vec3( texture2D( gradientMap, coord ).r ); 657 #else 658 vec2 fw = fwidth( coord ) * 0.5; 659 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 660 #endif 661}`,GE=`#ifdef USE_LIGHTMAP 662 uniform sampler2D lightMap; 663 uniform float lightMapIntensity; 664#endif`,WE=`LambertMaterial material; 665material.diffuseColor = diffuseColor.rgb; 666material.specularStrength = specularStrength;`,XE=`varying vec3 vViewPosition; 667struct LambertMaterial { 668 vec3 diffuseColor; 669 float specularStrength; 670}; 671void 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 ) { 672 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 673 vec3 irradiance = dotNL * directLight.color; 674 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 675} 676void 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 ) { 677 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 678} 679#define RE_Direct RE_Direct_Lambert 680#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,YE=`uniform bool receiveShadow; 681uniform vec3 ambientLightColor; 682#if defined( USE_LIGHT_PROBES ) 683 uniform vec3 lightProbe[ 9 ]; 684#endif 685vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 686 float x = normal.x, y = normal.y, z = normal.z; 687 vec3 result = shCoefficients[ 0 ] * 0.886227; 688 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 689 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 690 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 691 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 692 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 693 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 694 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 695 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 696 return result; 697} 698vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 699 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 700 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 701 return irradiance; 702} 703vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 704 vec3 irradiance = ambientLightColor; 705 return irradiance; 706} 707float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 708 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 709 if ( cutoffDistance > 0.0 ) { 710 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 711 } 712 return distanceFalloff; 713} 714float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 715 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 716} 717#if NUM_DIR_LIGHTS > 0 718 struct DirectionalLight { 719 vec3 direction; 720 vec3 color; 721 }; 722 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 723 void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { 724 light.color = directionalLight.color; 725 light.direction = directionalLight.direction; 726 light.visible = true; 727 } 728#endif 729#if NUM_POINT_LIGHTS > 0 730 struct PointLight { 731 vec3 position; 732 vec3 color; 733 float distance; 734 float decay; 735 }; 736 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 737 void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { 738 vec3 lVector = pointLight.position - geometryPosition; 739 light.direction = normalize( lVector ); 740 float lightDistance = length( lVector ); 741 light.color = pointLight.color; 742 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 743 light.visible = ( light.color != vec3( 0.0 ) ); 744 } 745#endif
746#if NUM_SPOT_LIGHTS > 0 747 struct SpotLight { 748 vec3 position; 749 vec3 direction; 750 vec3 color; 751 float distance; 752 float decay; 753 float coneCos; 754 float penumbraCos; 755 }; 756 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 757 void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { 758 vec3 lVector = spotLight.position - geometryPosition; 759 light.direction = normalize( lVector ); 760 float angleCos = dot( light.direction, spotLight.direction ); 761 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 762 if ( spotAttenuation > 0.0 ) { 763 float lightDistance = length( lVector ); 764 light.color = spotLight.color * spotAttenuation; 765 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 766 light.visible = ( light.color != vec3( 0.0 ) ); 767 } else { 768 light.color = vec3( 0.0 ); 769 light.visible = false; 770 } 771 } 772#endif 773#if NUM_RECT_AREA_LIGHTS > 0 774 struct RectAreaLight { 775 vec3 color; 776 vec3 position; 777 vec3 halfWidth; 778 vec3 halfHeight; 779 }; 780 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 781 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 782#endif 783#if NUM_HEMI_LIGHTS > 0 784 struct HemisphereLight { 785 vec3 direction; 786 vec3 skyColor; 787 vec3 groundColor; 788 }; 789 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 790 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 791 float dotNL = dot( normal, hemiLight.direction ); 792 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 793 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 794 return irradiance; 795 } 796#endif`,qE=`#ifdef USE_ENVMAP 797 vec3 getIBLIrradiance( const in vec3 normal ) { 798 #ifdef ENVMAP_TYPE_CUBE_UV 799 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 800 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); 801 return PI * envMapColor.rgb * envMapIntensity; 802 #else 803 return vec3( 0.0 ); 804 #endif 805 } 806 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 807 #ifdef ENVMAP_TYPE_CUBE_UV 808 vec3 reflectVec = reflect( - viewDir, normal ); 809 reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); 810 reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); 811 vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); 812 return envMapColor.rgb * envMapIntensity; 813 #else 814 return vec3( 0.0 ); 815 #endif 816 } 817 #ifdef USE_ANISOTROPY 818 vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { 819 #ifdef ENVMAP_TYPE_CUBE_UV 820 vec3 bentNormal = cross( bitangent, viewDir ); 821 bentNormal = normalize( cross( bentNormal, bitangent ) ); 822 bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); 823 return getIBLRadiance( viewDir, bentNormal, roughness ); 824 #else 825 return vec3( 0.0 ); 826 #endif 827 } 828 #endif 829#endif`,ZE=`ToonMaterial material; 830material.diffuseColor = diffuseColor.rgb;`,jE=`varying vec3 vViewPosition; 831struct ToonMaterial { 832 vec3 diffuseColor; 833}; 834void 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 ) { 835 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; 836 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 837} 838void 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 ) { 839 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 840} 841#define RE_Direct RE_Direct_Toon 842#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,JE=`BlinnPhongMaterial material; 843material.diffuseColor = diffuseColor.rgb; 844material.specularColor = specular; 845material.specularShininess = shininess; 846material.specularStrength = specularStrength;`,KE=`varying vec3 vViewPosition; 847struct BlinnPhongMaterial { 848 vec3 diffuseColor; 849 vec3 specularColor; 850 float specularShininess; 851 float specularStrength; 852}; 853void 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 ) {
854 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 855 vec3 irradiance = dotNL * directLight.color; 856 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 857 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; 858} 859void 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 ) { 860 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 861} 862#define RE_Direct RE_Direct_BlinnPhong 863#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,QE=`PhysicalMaterial material; 864material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 865vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); 866float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 867material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 868material.roughness = min( material.roughness, 1.0 ); 869#ifdef IOR 870 material.ior = ior; 871 #ifdef USE_SPECULAR 872 float specularIntensityFactor = specularIntensity; 873 vec3 specularColorFactor = specularColor; 874 #ifdef USE_SPECULAR_COLORMAP 875 specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; 876 #endif 877 #ifdef USE_SPECULAR_INTENSITYMAP 878 specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; 879 #endif 880 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 881 #else 882 float specularIntensityFactor = 1.0; 883 vec3 specularColorFactor = vec3( 1.0 ); 884 material.specularF90 = 1.0; 885 #endif 886 material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); 887#else 888 material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); 889 material.specularF90 = 1.0; 890#endif 891#ifdef USE_CLEARCOAT 892 material.clearcoat = clearcoat; 893 material.clearcoatRoughness = clearcoatRoughness; 894 material.clearcoatF0 = vec3( 0.04 ); 895 material.clearcoatF90 = 1.0; 896 #ifdef USE_CLEARCOATMAP 897 material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; 898 #endif 899 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 900 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; 901 #endif 902 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 903 material.clearcoatRoughness += geometryRoughness; 904 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 905#endif 906#ifdef USE_DISPERSION 907 material.dispersion = dispersion; 908#endif 909#ifdef USE_IRIDESCENCE 910 material.iridescence = iridescence; 911 material.iridescenceIOR = iridescenceIOR; 912 #ifdef USE_IRIDESCENCEMAP 913 material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; 914 #endif 915 #ifdef USE_IRIDESCENCE_THICKNESSMAP 916 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; 917 #else 918 material.iridescenceThickness = iridescenceThicknessMaximum; 919 #endif 920#endif 921#ifdef USE_SHEEN 922 material.sheenColor = sheenColor; 923 #ifdef USE_SHEEN_COLORMAP 924 material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; 925 #endif 926 material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); 927 #ifdef USE_SHEEN_ROUGHNESSMAP 928 material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; 929 #endif 930#endif 931#ifdef USE_ANISOTROPY 932 #ifdef USE_ANISOTROPYMAP 933 mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); 934 vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; 935 vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; 936 #else 937 vec2 anisotropyV = anisotropyVector; 938 #endif 939 material.anisotropy = length( anisotropyV ); 940 if( material.anisotropy == 0.0 ) { 941 anisotropyV = vec2( 1.0, 0.0 ); 942 } else { 943 anisotropyV /= material.anisotropy; 944 material.anisotropy = saturate( material.anisotropy ); 945 } 946 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
947 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; 948 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; 949#endif`,$E
vendor: 14,687 bytes, lines 949-1250
949=`struct PhysicalMaterial { 950 vec3 diffuseColor; 951 float roughness; 952 vec3 specularColor; 953 float specularF90; 954 float dispersion; 955 #ifdef USE_CLEARCOAT 956 float clearcoat; 957 float clearcoatRoughness; 958 vec3 clearcoatF0; 959 float clearcoatF90; 960 #endif 961 #ifdef USE_IRIDESCENCE 962 float iridescence; 963 float iridescenceIOR; 964 float iridescenceThickness; 965 vec3 iridescenceFresnel; 966 vec3 iridescenceF0; 967 #endif 968 #ifdef USE_SHEEN 969 vec3 sheenColor; 970 float sheenRoughness; 971 #endif 972 #ifdef IOR 973 float ior; 974 #endif 975 #ifdef USE_TRANSMISSION 976 float transmission; 977 float transmissionAlpha; 978 float thickness; 979 float attenuationDistance; 980 vec3 attenuationColor; 981 #endif 982 #ifdef USE_ANISOTROPY 983 float anisotropy; 984 float alphaT; 985 vec3 anisotropyT; 986 vec3 anisotropyB; 987 #endif 988}; 989vec3 clearcoatSpecularDirect = vec3( 0.0 ); 990vec3 clearcoatSpecularIndirect = vec3( 0.0 ); 991vec3 sheenSpecularDirect = vec3( 0.0 ); 992vec3 sheenSpecularIndirect = vec3(0.0 ); 993vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 994 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 995 float x2 = x * x; 996 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 997 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 998} 999float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 1000 float a2 = pow2( alpha ); 1001 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 1002 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 1003 return 0.5 / max( gv + gl, EPSILON ); 1004} 1005float D_GGX( const in float alpha, const in float dotNH ) { 1006 float a2 = pow2( alpha ); 1007 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 1008 return RECIPROCAL_PI * a2 / pow2( denom ); 1009} 1010#ifdef USE_ANISOTROPY 1011 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 ) { 1012 float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); 1013 float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); 1014 float v = 0.5 / ( gv + gl ); 1015 return saturate(v); 1016 } 1017 float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { 1018 float a2 = alphaT * alphaB; 1019 highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); 1020 highp float v2 = dot( v, v ); 1021 float w2 = a2 / v2; 1022 return RECIPROCAL_PI * a2 * pow2 ( w2 ); 1023 } 1024#endif 1025#ifdef USE_CLEARCOAT 1026 vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { 1027 vec3 f0 = material.clearcoatF0; 1028 float f90 = material.clearcoatF90; 1029 float roughness = material.clearcoatRoughness; 1030 float alpha = pow2( roughness ); 1031 vec3 halfDir = normalize( lightDir + viewDir ); 1032 float dotNL = saturate( dot( normal, lightDir ) ); 1033 float dotNV = saturate( dot( normal, viewDir ) ); 1034 float dotNH = saturate( dot( normal, halfDir ) ); 1035 float dotVH = saturate( dot( viewDir, halfDir ) ); 1036 vec3 F = F_Schlick( f0, f90, dotVH ); 1037 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1038 float D = D_GGX( alpha, dotNH ); 1039 return F * ( V * D ); 1040 } 1041#endif 1042vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { 1043 vec3 f0 = material.specularColor; 1044 float f90 = material.specularF90; 1045 float roughness = material.roughness; 1046 float alpha = pow2( roughness ); 1047 vec3 halfDir = normalize( lightDir + viewDir ); 1048 float dotNL = saturate( dot( normal, lightDir ) ); 1049 float dotNV = saturate( dot( normal, viewDir ) ); 1050 float dotNH = saturate( dot( normal, halfDir ) ); 1051 float dotVH = saturate( dot( viewDir, halfDir ) ); 1052 vec3 F = F_Schlick( f0, f90, dotVH ); 1053 #ifdef USE_IRIDESCENCE 1054 F = mix( F, material.iridescenceFresnel, material.iridescence ); 1055 #endif 1056 #ifdef USE_ANISOTROPY 1057 float dotTL = dot( material.anisotropyT, lightDir ); 1058 float dotTV = dot( material.anisotropyT, viewDir ); 1059 float dotTH = dot( material.anisotropyT, halfDir ); 1060 float dotBL = dot( material.anisotropyB, lightDir ); 1061 float dotBV = dot( material.anisotropyB, viewDir ); 1062 float dotBH = dot( material.anisotropyB, halfDir ); 1063 float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); 1064 float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); 1065 #else 1066 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 1067 float D = D_GGX( alpha, dotNH ); 1068 #endif 1069 return F * ( V * D ); 1070} 1071vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 1072 const float LUT_SIZE = 64.0; 1073 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 1074 const float LUT_BIAS = 0.5 / LUT_SIZE; 1075 float dotNV = saturate( dot( N, V ) ); 1076 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 1077 uv = uv * LUT_SCALE + LUT_BIAS; 1078 return uv; 1079} 1080float LTC_ClippedSphereFormFactor( const in vec3 f ) { 1081 float l = length( f ); 1082 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 1083} 1084vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 1085 float x = dot( v1, v2 ); 1086 float y = abs( x ); 1087 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 1088 float b = 3.4175940 + ( 4.1616724 + y ) * y; 1089 float v = a / b; 1090 float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 1091 return cross( v1, v2 ) * theta_sintheta; 1092} 1093vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 1094 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 1095 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 1096 vec3 lightNormal = cross( v1, v2 ); 1097 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 1098 vec3 T1, T2; 1099 T1 = normalize( V - N * dot( V, N ) ); 1100 T2 = - cross( N, T1 ); 1101 mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); 1102 vec3 coords[ 4 ]; 1103 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 1104 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 1105 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 1106 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 1107 coords[ 0 ] = normalize( coords[ 0 ] ); 1108 coords[ 1 ] = normalize( coords[ 1 ] ); 1109 coords[ 2 ] = normalize( coords[ 2 ] ); 1110 coords[ 3 ] = normalize( coords[ 3 ] ); 1111 vec3 vectorFormFactor = vec3( 0.0 ); 1112 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 1113 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 1114 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 1115 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 1116 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 1117 return vec3( result ); 1118} 1119#if defined( USE_SHEEN ) 1120float D_Charlie( float roughness, float dotNH ) { 1121 float alpha = pow2( roughness ); 1122 float invAlpha = 1.0 / alpha; 1123 float cos2h = dotNH * dotNH; 1124 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 1125 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 1126} 1127float V_Neubelt( float dotNV, float dotNL ) { 1128 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 1129} 1130vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 1131 vec3 halfDir = normalize( lightDir + viewDir ); 1132 float dotNL = saturate( dot( normal, lightDir ) ); 1133 float dotNV = saturate( dot( normal, viewDir ) ); 1134 float dotNH = saturate( dot( normal, halfDir ) ); 1135 float D = D_Charlie( sheenRoughness, dotNH ); 1136 float V = V_Neubelt( dotNV, dotNL ); 1137 return sheenColor * ( D * V ); 1138} 1139#endif 1140float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1141 float dotNV = saturate( dot( normal, viewDir ) ); 1142 float r2 = roughness * roughness; 1143 float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; 1144 float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; 1145 float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); 1146 return saturate( DG * RECIPROCAL_PI ); 1147} 1148vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 1149 float dotNV = saturate( dot( normal, viewDir ) ); 1150 const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); 1151 const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); 1152 vec4 r = roughness * c0 + c1; 1153 float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; 1154 vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; 1155 return fab; 1156} 1157vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 1158 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1159 return specularColor * fab.x + specularF90 * fab.y; 1160} 1161#ifdef USE_IRIDESCENCE 1162void 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 ) { 1163#else 1164void 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 ) { 1165#endif 1166 vec2 fab = DFGApprox( normal, viewDir, roughness ); 1167 #ifdef USE_IRIDESCENCE 1168 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 1169 #else 1170 vec3 Fr = specularColor; 1171 #endif 1172 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 1173 float Ess = fab.x + fab.y; 1174 float Ems = 1.0 - Ess; 1175 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 1176 singleScatter += FssEss; 1177 multiScatter += Fms * Ems; 1178} 1179#if NUM_RECT_AREA_LIGHTS > 0 1180 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 ) { 1181 vec3 normal = geometryNormal; 1182 vec3 viewDir = geometryViewDir; 1183 vec3 position = geometryPosition; 1184 vec3 lightPos = rectAreaLight.position; 1185 vec3 halfWidth = rectAreaLight.halfWidth; 1186 vec3 halfHeight = rectAreaLight.halfHeight; 1187 vec3 lightColor = rectAreaLight.color; 1188 float roughness = material.roughness; 1189 vec3 rectCoords[ 4 ]; 1190 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 1191 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 1192 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 1193 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 1194 vec4 t1 = texture2D( ltc_1, uv ); 1195 vec4 t2 = texture2D( ltc_2, uv ); 1196 mat3 mInv = mat3( 1197 vec3( t1.x, 0, t1.y ), 1198 vec3( 0, 1, 0 ), 1199 vec3( t1.z, 0, t1.w ) 1200 ); 1201 vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); 1202 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1203 reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1204 } 1205#endif 1206void 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 ) { 1207 float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); 1208 vec3 irradiance = dotNL * directLight.color; 1209 #ifdef USE_CLEARCOAT 1210 float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); 1211 vec3 ccIrradiance = dotNLcc * directLight.color; 1212 clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); 1213 #endif 1214 #ifdef USE_SHEEN 1215 sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); 1216 #endif 1217 reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); 1218 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1219} 1220void 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 ) { 1221 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1222} 1223void 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) { 1224 #ifdef USE_CLEARCOAT 1225 clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1226 #endif 1227 #ifdef USE_SHEEN 1228 sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); 1229 #endif 1230 vec3 singleScattering = vec3( 0.0 ); 1231 vec3 multiScattering = vec3( 0.0 ); 1232 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1233 #ifdef USE_IRIDESCENCE 1234 computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); 1235 #else 1236 computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); 1237 #endif 1238 vec3 totalScattering = singleScattering + multiScattering; 1239 vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); 1240 reflectedLight.indirectSpecular += radiance * singleScattering; 1241 reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; 1242 reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; 1243} 1244#define RE_Direct RE_Direct_Physical 1245#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1246#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1247#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1248float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1249 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1250}`,
1250eT=` 1251vec3 geometryPosition = - vViewPosition; 1252vec3 geometryNormal = normal; 1253vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1254vec3 geometryClearcoatNormal = vec3( 0.0 ); 1255#ifdef USE_CLEARCOAT 1256 geometryClearcoatNormal = clearcoatNormal; 1257#endif 1258#ifdef USE_IRIDESCENCE 1259 float dotNVi = saturate( dot( normal, geometryViewDir ) ); 1260 if ( material.iridescenceThickness == 0.0 ) { 1261 material.iridescence = 0.0; 1262 } else { 1263 material.iridescence = saturate( material.iridescence ); 1264 } 1265 if ( material.iridescence > 0.0 ) { 1266 material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1267 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1268 } 1269#endif 1270IncidentLight directLight; 1271#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1272 PointLight pointLight; 1273 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1274 PointLightShadow pointLightShadow; 1275 #endif 1276 #pragma unroll_loop_start 1277 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1278 pointLight = pointLights[ i ]; 1279 getPointLightInfo( pointLight, geometryPosition, directLight ); 1280 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) 1281 pointLightShadow = pointLightShadows[ i ]; 1282 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1283 #endif 1284 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1285 } 1286 #pragma unroll_loop_end 1287#endif 1288#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1289 SpotLight spotLight; 1290 vec4 spotColor; 1291 vec3 spotLightCoord; 1292 bool inSpotLightMap; 1293 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1294 SpotLightShadow spotLightShadow; 1295 #endif 1296 #pragma unroll_loop_start 1297 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1298 spotLight = spotLights[ i ]; 1299 getSpotLightInfo( spotLight, geometryPosition, directLight ); 1300 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1301 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1302 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1303 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1304 #else 1305 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1306 #endif 1307 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1308 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1309 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1310 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1311 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1312 #endif 1313 #undef SPOT_LIGHT_MAP_INDEX 1314 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1315 spotLightShadow = spotLightShadows[ i ]; 1316 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1317 #endif 1318 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1319 } 1320 #pragma unroll_loop_end 1321#endif 1322#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1323 DirectionalLight directionalLight; 1324 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1325 DirectionalLightShadow directionalLightShadow; 1326 #endif 1327 #pragma unroll_loop_start 1328 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1329 directionalLight = directionalLights[ i ]; 1330 getDirectionalLightInfo( directionalLight, directLight ); 1331 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1332 directionalLightShadow = directionalLightShadows[ i ]; 1333 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1334 #endif 1335 RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1336 } 1337 #pragma unroll_loop_end 1338#endif 1339#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1340 RectAreaLight rectAreaLight; 1341 #pragma unroll_loop_start 1342 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1343 rectAreaLight = rectAreaLights[ i ]; 1344 RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1345 } 1346 #pragma unroll_loop_end 1347#endif 1348#if defined( RE_IndirectDiffuse ) 1349 vec3 iblIrradiance = vec3( 0.0 ); 1350 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1351 #if defined( USE_LIGHT_PROBES ) 1352 irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); 1353 #endif 1354 #if ( NUM_HEMI_LIGHTS > 0 ) 1355 #pragma unroll_loop_start 1356 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1357 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); 1358 } 1359 #pragma unroll_loop_end 1360 #endif 1361#endif 1362#if defined( RE_IndirectSpecular ) 1363 vec3 radiance = vec3( 0.0 ); 1364 vec3 clearcoatRadiance = vec3( 0.0 ); 1365#endif`,tT=`#if defined( RE_IndirectDiffuse ) 1366 #ifdef USE_LIGHTMAP 1367 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 1368 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1369 irradiance += lightMapIrradiance; 1370 #endif 1371 #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) 1372 iblIrradiance += getIBLIrradiance( geometryNormal ); 1373 #endif 1374#endif 1375#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1376 #ifdef USE_ANISOTROPY 1377 radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); 1378 #else 1379 radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); 1380 #endif 1381 #ifdef USE_CLEARCOAT 1382 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); 1383 #endif 1384#endif`,nT=`#if defined( RE_IndirectDiffuse ) 1385 RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1386#endif 1387#if defined( RE_IndirectSpecular ) 1388 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); 1389#endif`,iT=`#if defined( USE_LOGDEPTHBUF ) 1390 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1391#endif`,rT=`#if defined( USE_LOGDEPTHBUF ) 1392 uniform float logDepthBufFC; 1393 varying float vFragDepth; 1394 varying float vIsPerspective; 1395#endif`,sT=`#ifdef USE_LOGDEPTHBUF 1396 varying float vFragDepth; 1397 varying float vIsPerspective; 1398#endif`,oT=`#ifdef USE_LOGDEPTHBUF 1399 vFragDepth = 1.0 + gl_Position.w; 1400 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1401#endif`,aT=`#ifdef USE_MAP 1402 vec4 sampledDiffuseColor = texture2D( map, vMapUv ); 1403 #ifdef DECODE_VIDEO_TEXTURE 1404 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); 1405 #endif 1406 diffuseColor *= sampledDiffuseColor; 1407#endif`,lT=`#ifdef USE_MAP 1408 uniform sampler2D map; 1409#endif`,cT=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1410 #if defined( USE_POINTS_UV ) 1411 vec2 uv = vUv; 1412 #else 1413 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1414 #endif 1415#endif 1416#ifdef USE_MAP 1417 diffuseColor *= texture2D( map, uv ); 1418#endif 1419#ifdef USE_ALPHAMAP 1420 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1421#endif`,uT=`#if defined( USE_POINTS_UV ) 1422 varying vec2 vUv; 1423#else 1424 #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1425 uniform mat3 uvTransform; 1426 #endif 1427#endif 1428#ifdef USE_MAP 1429 uniform sampler2D map; 1430#endif 1431#ifdef USE_ALPHAMAP 1432 uniform sampler2D alphaMap; 1433#endif`,hT=`float metalnessFactor = metalness; 1434#ifdef USE_METALNESSMAP 1435 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); 1436 metalnessFactor *= texelMetalness.b; 1437#endif`,fT=`#ifdef USE_METALNESSMAP 1438 uniform sampler2D metalnessMap; 1439#endif`,dT=`#ifdef USE_INSTANCING_MORPH 1440 float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1441 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; 1442 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1443 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; 1444 } 1445#endif`,pT=`#if defined( USE_MORPHCOLORS ) 1446 vColor *= morphTargetBaseInfluence; 1447 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1448 #if defined( USE_COLOR_ALPHA ) 1449 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1450 #elif defined( USE_COLOR ) 1451 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1452 #endif 1453 } 1454#endif`,mT=`#ifdef USE_MORPHNORMALS 1455 objectNormal *= morphTargetBaseInfluence; 1456 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1457 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1458 } 1459#endif`,gT=`#ifdef USE_MORPHTARGETS 1460 #ifndef USE_INSTANCING_MORPH 1461 uniform float morphTargetBaseInfluence; 1462 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1463 #endif 1464 uniform sampler2DArray morphTargetsTexture; 1465 uniform ivec2 morphTargetsTextureSize; 1466 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1467 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1468 int y = texelIndex / morphTargetsTextureSize.x; 1469 int x = texelIndex - y * morphTargetsTextureSize.x; 1470 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1471 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1472 } 1473#endif`,vT=`#ifdef USE_MORPHTARGETS 1474 transformed *= morphTargetBaseInfluence; 1475 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1476 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1477 } 1478#endif`,_T=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1479#ifdef FLAT_SHADED 1480 vec3 fdx = dFdx( vViewPosition ); 1481 vec3 fdy = dFdy( vViewPosition ); 1482 vec3 normal = normalize( cross( fdx, fdy ) ); 1483#else 1484 vec3 normal = normalize( vNormal ); 1485 #ifdef DOUBLE_SIDED 1486 normal *= faceDirection; 1487 #endif 1488#endif 1489#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) 1490 #ifdef USE_TANGENT 1491 mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1492 #else 1493 mat3 tbn = getTangentFrame( - vViewPosition, normal, 1494 #if defined( USE_NORMALMAP ) 1495 vNormalMapUv 1496 #elif defined( USE_CLEARCOAT_NORMALMAP ) 1497 vClearcoatNormalMapUv 1498 #else 1499 vUv 1500 #endif 1501 ); 1502 #endif 1503 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1504 tbn[0] *= faceDirection; 1505 tbn[1] *= faceDirection; 1506 #endif 1507#endif 1508#ifdef USE_CLEARCOAT_NORMALMAP 1509 #ifdef USE_TANGENT 1510 mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); 1511 #else 1512 mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); 1513 #endif 1514 #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) 1515 tbn2[0] *= faceDirection; 1516 tbn2[1] *= faceDirection; 1517 #endif 1518#endif 1519vec3 nonPerturbedNormal = normal;`,yT=`#ifdef USE_NORMALMAP_OBJECTSPACE 1520 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1521 #ifdef FLIP_SIDED 1522 normal = - normal; 1523 #endif 1524 #ifdef DOUBLE_SIDED 1525 normal = normal * faceDirection; 1526 #endif 1527 normal = normalize( normalMatrix * normal ); 1528#elif defined( USE_NORMALMAP_TANGENTSPACE ) 1529 vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; 1530 mapN.xy *= normalScale; 1531 normal = normalize( tbn * mapN ); 1532#elif defined( USE_BUMPMAP )
1533 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1534#endif`,xT=`#ifndef FLAT_SHADED 1535 varying vec3 vNormal; 1536 #ifdef USE_TANGENT 1537 varying vec3 vTangent; 1538 varying vec3 vBitangent; 1539 #endif 1540#endif`,ST=`#ifndef FLAT_SHADED 1541 varying vec3 vNormal; 1542 #ifdef USE_TANGENT 1543 varying vec3 vTangent; 1544 varying vec3 vBitangent; 1545 #endif 1546#endif`,MT=`#ifndef FLAT_SHADED 1547 vNormal = normalize( transformedNormal ); 1548 #ifdef USE_TANGENT 1549 vTangent = normalize( transformedTangent ); 1550 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1551 #endif 1552#endif`,wT=`#ifdef USE_NORMALMAP 1553 uniform sampler2D normalMap; 1554 uniform vec2 normalScale; 1555#endif 1556#ifdef USE_NORMALMAP_OBJECTSPACE 1557 uniform mat3 normalMatrix; 1558#endif 1559#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) 1560 mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { 1561 vec3 q0 = dFdx( eye_pos.xyz ); 1562 vec3 q1 = dFdy( eye_pos.xyz ); 1563 vec2 st0 = dFdx( uv.st ); 1564 vec2 st1 = dFdy( uv.st ); 1565 vec3 N = surf_norm; 1566 vec3 q1perp = cross( q1, N ); 1567 vec3 q0perp = cross( N, q0 ); 1568 vec3 T = q1perp * st0.x + q0perp * st1.x; 1569 vec3 B = q1perp * st0.y + q0perp * st1.y; 1570 float det = max( dot( T, T ), dot( B, B ) ); 1571 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); 1572 return mat3( T * scale, B * scale, N ); 1573 } 1574#endif`,ET=`#ifdef USE_CLEARCOAT 1575 vec3 clearcoatNormal = nonPerturbedNormal; 1576#endif`,TT=`#ifdef USE_CLEARCOAT_NORMALMAP 1577 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; 1578 clearcoatMapN.xy *= clearcoatNormalScale; 1579 clearcoatNormal = normalize( tbn2 * clearcoatMapN ); 1580#endif`,bT=`#ifdef USE_CLEARCOATMAP 1581 uniform sampler2D clearcoatMap; 1582#endif 1583#ifdef USE_CLEARCOAT_NORMALMAP 1584 uniform sampler2D clearcoatNormalMap; 1585 uniform vec2 clearcoatNormalScale; 1586#endif 1587#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1588 uniform sampler2D clearcoatRoughnessMap; 1589#endif`,AT=`#ifdef USE_IRIDESCENCEMAP 1590 uniform sampler2D iridescenceMap; 1591#endif 1592#ifdef USE_IRIDESCENCE_THICKNESSMAP 1593 uniform sampler2D iridescenceThicknessMap; 1594#endif`,CT=`#ifdef OPAQUE 1595diffuseColor.a = 1.0; 1596#endif 1597#ifdef USE_TRANSMISSION 1598diffuseColor.a *= material.transmissionAlpha; 1599#endif 1600gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,RT=`vec3 packNormalToRGB( const in vec3 normal ) { 1601 return normalize( normal ) * 0.5 + 0.5; 1602} 1603vec3 unpackRGBToNormal( const in vec3 rgb ) { 1604 return 2.0 * rgb.xyz - 1.0; 1605} 1606const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; 1607const float Inv255 = 1. / 255.; 1608const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); 1609const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); 1610const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); 1611const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); 1612vec4 packDepthToRGBA( const in float v ) { 1613 if( v <= 0.0 ) 1614 return vec4( 0., 0., 0., 0. ); 1615 if( v >= 1.0 ) 1616 return vec4( 1., 1., 1., 1. ); 1617 float vuf; 1618 float af = modf( v * PackFactors.a, vuf ); 1619 float bf = modf( vuf * ShiftRight8, vuf ); 1620 float gf = modf( vuf * ShiftRight8, vuf ); 1621 return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); 1622} 1623vec3 packDepthToRGB( const in float v ) { 1624 if( v <= 0.0 ) 1625 return vec3( 0., 0., 0. ); 1626 if( v >= 1.0 ) 1627 return vec3( 1., 1., 1. ); 1628 float vuf; 1629 float bf = modf( v * PackFactors.b, vuf ); 1630 float gf = modf( vuf * ShiftRight8, vuf ); 1631 return vec3( vuf * Inv255, gf * PackUpscale, bf ); 1632} 1633vec2 packDepthToRG( const in float v ) { 1634 if( v <= 0.0 ) 1635 return vec2( 0., 0. ); 1636 if( v >= 1.0 ) 1637 return vec2( 1., 1. ); 1638 float vuf; 1639 float gf = modf( v * 256., vuf ); 1640 return vec2( vuf * Inv255, gf ); 1641} 1642float unpackRGBAToDepth( const in vec4 v ) { 1643 return dot( v, UnpackFactors4 ); 1644} 1645float unpackRGBToDepth( const in vec3 v ) { 1646 return dot( v, UnpackFactors3 ); 1647} 1648float unpackRGToDepth( const in vec2 v ) { 1649 return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; 1650} 1651vec4 pack2HalfToRGBA( const in vec2 v ) {
1652 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1653 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1654} 1655vec2 unpackRGBATo2Half( const in vec4 v ) { 1656 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1657} 1658float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1659 return ( viewZ + near ) / ( near - far ); 1660} 1661float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { 1662 return depth * ( near - far ) - near; 1663} 1664float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1665 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1666} 1667float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { 1668 return ( near * far ) / ( ( far - near ) * depth - far ); 1669}`,IT=`#ifdef PREMULTIPLIED_ALPHA 1670 gl_FragColor.rgb *= gl_FragColor.a; 1671#endif`,PT=`vec4 mvPosition = vec4( transformed, 1.0 ); 1672#ifdef USE_BATCHING 1673 mvPosition = batchingMatrix * mvPosition; 1674#endif 1675#ifdef USE_INSTANCING 1676 mvPosition = instanceMatrix * mvPosition; 1677#endif 1678mvPosition = modelViewMatrix * mvPosition; 1679gl_Position = projectionMatrix * mvPosition;`,LT=`#ifdef DITHERING 1680 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1681#endif`,DT=`#ifdef DITHERING 1682 vec3 dithering( vec3 color ) { 1683 float grid_position = rand( gl_FragCoord.xy ); 1684 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1685 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1686 return color + dither_shift_RGB; 1687 } 1688#endif`,UT=`float roughnessFactor = roughness; 1689#ifdef USE_ROUGHNESSMAP 1690 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); 1691 roughnessFactor *= texelRoughness.g; 1692#endif`,NT=`#ifdef USE_ROUGHNESSMAP 1693 uniform sampler2D roughnessMap; 1694#endif`,FT=
vendor: 8,887 bytes, lines 1694-1880
1694`#if NUM_SPOT_LIGHT_COORDS > 0 1695 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1696#endif 1697#if NUM_SPOT_LIGHT_MAPS > 0 1698 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1699#endif 1700#ifdef USE_SHADOWMAP 1701 #if NUM_DIR_LIGHT_SHADOWS > 0 1702 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1703 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1704 struct DirectionalLightShadow { 1705 float shadowIntensity; 1706 float shadowBias; 1707 float shadowNormalBias; 1708 float shadowRadius; 1709 vec2 shadowMapSize; 1710 }; 1711 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1712 #endif 1713 #if NUM_SPOT_LIGHT_SHADOWS > 0 1714 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1715 struct SpotLightShadow { 1716 float shadowIntensity; 1717 float shadowBias; 1718 float shadowNormalBias; 1719 float shadowRadius; 1720 vec2 shadowMapSize; 1721 }; 1722 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1723 #endif 1724 #if NUM_POINT_LIGHT_SHADOWS > 0 1725 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1726 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1727 struct PointLightShadow { 1728 float shadowIntensity; 1729 float shadowBias; 1730 float shadowNormalBias; 1731 float shadowRadius; 1732 vec2 shadowMapSize; 1733 float shadowCameraNear; 1734 float shadowCameraFar; 1735 }; 1736 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1737 #endif 1738 float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { 1739 return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); 1740 } 1741 vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { 1742 return unpackRGBATo2Half( texture2D( shadow, uv ) ); 1743 } 1744 float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ 1745 float occlusion = 1.0; 1746 vec2 distribution = texture2DDistribution( shadow, uv ); 1747 float hard_shadow = step( compare , distribution.x ); 1748 if (hard_shadow != 1.0 ) { 1749 float distance = compare - distribution.x ; 1750 float variance = max( 0.00000, distribution.y * distribution.y ); 1751 float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); 1752 } 1753 return occlusion; 1754 } 1755 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1756 float shadow = 1.0; 1757 shadowCoord.xyz /= shadowCoord.w; 1758 shadowCoord.z += shadowBias; 1759 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1760 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1761 if ( frustumTest ) { 1762 #if defined( SHADOWMAP_TYPE_PCF ) 1763 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1764 float dx0 = - texelSize.x * shadowRadius; 1765 float dy0 = - texelSize.y * shadowRadius; 1766 float dx1 = + texelSize.x * shadowRadius; 1767 float dy1 = + texelSize.y * shadowRadius; 1768 float dx2 = dx0 / 2.0; 1769 float dy2 = dy0 / 2.0; 1770 float dx3 = dx1 / 2.0; 1771 float dy3 = dy1 / 2.0; 1772 shadow = ( 1773 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + 1774 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + 1775 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + 1776 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + 1777 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + 1778 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + 1779 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + 1780 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + 1781 texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + 1782 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + 1783 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + 1784 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + 1785 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + 1786 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + 1787 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + 1788 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + 1789 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) 1790 ) * ( 1.0 / 17.0 ); 1791 #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) 1792 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1793 float dx = texelSize.x; 1794 float dy = texelSize.y; 1795 vec2 uv = shadowCoord.xy; 1796 vec2 f = fract( uv * shadowMapSize + 0.5 ); 1797 uv -= f * texelSize; 1798 shadow = ( 1799 texture2DCompare( shadowMap, uv, shadowCoord.z ) + 1800 texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + 1801 texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + 1802 texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + 1803 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), 1804 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), 1805 f.x ) + 1806 mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), 1807 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), 1808 f.x ) + 1809 mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), 1810 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), 1811 f.y ) + 1812 mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), 1813 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), 1814 f.y ) + 1815 mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), 1816 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), 1817 f.x ), 1818 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), 1819 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), 1820 f.x ), 1821 f.y ) 1822 ) * ( 1.0 / 9.0 ); 1823 #elif defined( SHADOWMAP_TYPE_VSM ) 1824 shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); 1825 #else 1826 shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); 1827 #endif 1828 } 1829 return mix( 1.0, shadow, shadowIntensity ); 1830 } 1831 vec2 cubeToUV( vec3 v, float texelSizeY ) { 1832 vec3 absV = abs( v ); 1833 float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); 1834 absV *= scaleToCube; 1835 v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); 1836 vec2 planar = v.xy; 1837 float almostATexel = 1.5 * texelSizeY; 1838 float almostOne = 1.0 - almostATexel; 1839 if ( absV.z >= almostOne ) { 1840 if ( v.z > 0.0 ) 1841 planar.x = 4.0 - v.x; 1842 } else if ( absV.x >= almostOne ) { 1843 float signX = sign( v.x ); 1844 planar.x = v.z * signX + 2.0 * signX; 1845 } else if ( absV.y >= almostOne ) { 1846 float signY = sign( v.y ); 1847 planar.x = v.x + 2.0 * signY + 2.0; 1848 planar.y = v.z * signY - 2.0; 1849 } 1850 return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); 1851 } 1852 float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1853 float shadow = 1.0; 1854 vec3 lightToPosition = shadowCoord.xyz; 1855 1856 float lightToPositionLength = length( lightToPosition ); 1857 if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { 1858 float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; 1859 vec3 bd3D = normalize( lightToPosition ); 1860 vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); 1861 #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) 1862 vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; 1863 shadow = ( 1864 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + 1865 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + 1866 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + 1867 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + 1868 texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + 1869 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + 1870 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + 1871 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + 1872 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) 1873 ) * ( 1.0 / 9.0 ); 1874 #else 1875 shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); 1876 #endif 1877 } 1878 return mix( 1.0, shadow, shadowIntensity ); 1879 } 1880#endif`,
1880OT=`#if NUM_SPOT_LIGHT_COORDS > 0 1881 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1882 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1883#endif 1884#ifdef USE_SHADOWMAP 1885 #if NUM_DIR_LIGHT_SHADOWS > 0 1886 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 1887 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1888 struct DirectionalLightShadow { 1889 float shadowIntensity; 1890 float shadowBias; 1891 float shadowNormalBias; 1892 float shadowRadius; 1893 vec2 shadowMapSize; 1894 }; 1895 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1896 #endif 1897 #if NUM_SPOT_LIGHT_SHADOWS > 0 1898 struct SpotLightShadow { 1899 float shadowIntensity; 1900 float shadowBias; 1901 float shadowNormalBias; 1902 float shadowRadius; 1903 vec2 shadowMapSize; 1904 }; 1905 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1906 #endif 1907 #if NUM_POINT_LIGHT_SHADOWS > 0 1908 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 1909 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1910 struct PointLightShadow { 1911 float shadowIntensity; 1912 float shadowBias; 1913 float shadowNormalBias; 1914 float shadowRadius; 1915 vec2 shadowMapSize; 1916 float shadowCameraNear; 1917 float shadowCameraFar; 1918 }; 1919 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1920 #endif 1921#endif`,BT=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 1922 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 1923 vec4 shadowWorldPosition; 1924#endif 1925#if defined( USE_SHADOWMAP ) 1926 #if NUM_DIR_LIGHT_SHADOWS > 0 1927 #pragma unroll_loop_start 1928 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1929 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 1930 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 1931 } 1932 #pragma unroll_loop_end 1933 #endif 1934 #if NUM_POINT_LIGHT_SHADOWS > 0 1935 #pragma unroll_loop_start 1936 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1937 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 1938 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 1939 } 1940 #pragma unroll_loop_end 1941 #endif 1942#endif 1943#if NUM_SPOT_LIGHT_COORDS > 0 1944 #pragma unroll_loop_start 1945 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 1946 shadowWorldPosition = worldPosition; 1947 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1948 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 1949 #endif 1950 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 1951 } 1952 #pragma unroll_loop_end 1953#endif`,zT=`float getShadowMask() { 1954 float shadow = 1.0; 1955 #ifdef USE_SHADOWMAP 1956 #if NUM_DIR_LIGHT_SHADOWS > 0 1957 DirectionalLightShadow directionalLight; 1958 #pragma unroll_loop_start 1959 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1960 directionalLight = directionalLightShadows[ i ]; 1961 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1962 } 1963 #pragma unroll_loop_end 1964 #endif 1965 #if NUM_SPOT_LIGHT_SHADOWS > 0 1966 SpotLightShadow spotLight; 1967 #pragma unroll_loop_start 1968 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 1969 spotLight = spotLightShadows[ i ]; 1970 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1971 } 1972 #pragma unroll_loop_end 1973 #endif 1974 #if NUM_POINT_LIGHT_SHADOWS > 0 1975 PointLightShadow pointLight; 1976 #pragma unroll_loop_start 1977 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1978 pointLight = pointLightShadows[ i ]; 1979 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 1980 } 1981 #pragma unroll_loop_end 1982 #endif 1983 #endif 1984 return shadow; 1985}`,kT=`#ifdef USE_SKINNING 1986 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 1987 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 1988 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 1989 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 1990#endif`,HT=`#ifdef USE_SKINNING 1991 uniform mat4 bindMatrix; 1992 uniform mat4 bindMatrixInverse; 1993 uniform highp sampler2D boneTexture; 1994 mat4 getBoneMatrix( const in float i ) { 1995 int size = textureSize( boneTexture, 0 ).x; 1996 int j = int( i ) * 4; 1997 int x = j % size; 1998 int y = j / size; 1999 vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); 2000 vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); 2001 vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); 2002 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); 2003 return mat4( v1, v2, v3, v4 ); 2004 } 2005#endif`,VT=`#ifdef USE_SKINNING 2006 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 2007 vec4 skinned = vec4( 0.0 ); 2008 skinned += boneMatX * skinVertex * skinWeight.x; 2009 skinned += boneMatY * skinVertex * skinWeight.y; 2010 skinned += boneMatZ * skinVertex * skinWeight.z; 2011 skinned += boneMatW * skinVertex * skinWeight.w; 2012 transformed = ( bindMatrixInverse * skinned ).xyz; 2013#endif`,GT=`#ifdef USE_SKINNING 2014 mat4 skinMatrix = mat4( 0.0 ); 2015 skinMatrix += skinWeight.x * boneMatX; 2016 skinMatrix += skinWeight.y * boneMatY; 2017 skinMatrix += skinWeight.z * boneMatZ; 2018 skinMatrix += skinWeight.w * boneMatW; 2019 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 2020 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 2021 #ifdef USE_TANGENT 2022 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 2023 #endif 2024#endif`,WT=`float specularStrength; 2025#ifdef USE_SPECULARMAP 2026 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); 2027 specularStrength = texelSpecular.r; 2028#else 2029 specularStrength = 1.0; 2030#endif`,XT=`#ifdef USE_SPECULARMAP 2031 uniform sampler2D specularMap; 2032#endif`,YT=`#if defined( TONE_MAPPING ) 2033 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 2034#endif`,qT=`#ifndef saturate 2035#define saturate( a ) clamp( a, 0.0, 1.0 ) 2036#endif 2037uniform float toneMappingExposure; 2038vec3 LinearToneMapping( vec3 color ) { 2039 return saturate( toneMappingExposure * color ); 2040} 2041vec3 ReinhardToneMapping( vec3 color ) { 2042 color *= toneMappingExposure; 2043 return saturate( color / ( vec3( 1.0 ) + color ) ); 2044} 2045vec3 CineonToneMapping( vec3 color ) { 2046 color *= toneMappingExposure; 2047 color = max( vec3( 0.0 ), color - 0.004 ); 2048 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 2049} 2050vec3 RRTAndODTFit( vec3 v ) { 2051 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 2052 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 2053 return a / b; 2054} 2055vec3 ACESFilmicToneMapping( vec3 color ) { 2056 const mat3 ACESInputMat = mat3( 2057 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 2058 vec3( 0.04823, 0.01566, 0.83777 ) 2059 ); 2060 const mat3 ACESOutputMat = mat3( 2061 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 2062 vec3( -0.07367, -0.00605, 1.07602 ) 2063 ); 2064 color *= toneMappingExposure / 0.6; 2065 color = ACESInputMat * color; 2066 color = RRTAndODTFit( color ); 2067 color = ACESOutputMat * color; 2068 return saturate( color ); 2069} 2070const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( 2071 vec3( 1.6605, - 0.1246, - 0.0182 ), 2072 vec3( - 0.5876, 1.1329, - 0.1006 ), 2073 vec3( - 0.0728, - 0.0083, 1.1187 ) 2074); 2075const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( 2076 vec3( 0.6274, 0.0691, 0.0164 ), 2077 vec3( 0.3293, 0.9195, 0.0880 ), 2078 vec3( 0.0433, 0.0113, 0.8956 ) 2079); 2080vec3 agxDefaultContrastApprox( vec3 x ) { 2081 vec3 x2 = x * x; 2082 vec3 x4 = x2 * x2; 2083 return + 15.5 * x4 * x2 2084 - 40.14 * x4 * x 2085 + 31.96 * x4 2086 - 6.868 * x2 * x 2087 + 0.4298 * x2 2088 + 0.1191 * x 2089 - 0.00232; 2090} 2091vec3 AgXToneMapping( vec3 color ) { 2092 const mat3 AgXInsetMatrix = mat3( 2093 vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), 2094 vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), 2095 vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) 2096 );
2097 const mat3 AgXOutsetMatrix = mat3( 2098 vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), 2099 vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), 2100 vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) 2101 ); 2102 const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; 2103 color *= toneMappingExposure; 2104 color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; 2105 color = AgXInsetMatrix * color; 2106 color = max( color, 1e-10 ); color = log2( color ); 2107 color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); 2108 color = clamp( color, 0.0, 1.0 ); 2109 color = agxDefaultContrastApprox( color ); 2110 color = AgXOutsetMatrix * color; 2111 color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); 2112 color = LINEAR_REC2020_TO_LINEAR_SRGB * color; 2113 color = clamp( color, 0.0, 1.0 ); 2114 return color; 2115} 2116vec3 NeutralToneMapping( vec3 color ) { 2117 const float StartCompression = 0.8 - 0.04; 2118 const float Desaturation = 0.15; 2119 color *= toneMappingExposure; 2120 float x = min( color.r, min( color.g, color.b ) ); 2121 float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; 2122 color -= offset; 2123 float peak = max( color.r, max( color.g, color.b ) ); 2124 if ( peak < StartCompression ) return color; 2125 float d = 1. - StartCompression; 2126 float newPeak = 1. - d * d / ( peak + d - StartCompression ); 2127 color *= newPeak / peak; 2128 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); 2129 return mix( color, vec3( newPeak ), g ); 2130} 2131vec3 CustomToneMapping( vec3 color ) { return color; }`,ZT=`#ifdef USE_TRANSMISSION 2132 material.transmission = transmission; 2133 material.transmissionAlpha = 1.0; 2134 material.thickness = thickness; 2135 material.attenuationDistance = attenuationDistance; 2136 material.attenuationColor = attenuationColor; 2137 #ifdef USE_TRANSMISSIONMAP 2138 material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; 2139 #endif 2140 #ifdef USE_THICKNESSMAP 2141 material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; 2142 #endif 2143 vec3 pos = vWorldPosition; 2144 vec3 v = normalize( cameraPosition - pos ); 2145 vec3 n = inverseTransformDirection( normal, viewMatrix ); 2146 vec4 transmitted = getIBLVolumeRefraction( 2147 n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, 2148 pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, 2149 material.attenuationColor, material.attenuationDistance ); 2150 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); 2151 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); 2152#endif`,jT=`#ifdef USE_TRANSMISSION 2153 uniform float transmission; 2154 uniform float thickness; 2155 uniform float attenuationDistance; 2156 uniform vec3 attenuationColor; 2157 #ifdef USE_TRANSMISSIONMAP 2158 uniform sampler2D transmissionMap; 2159 #endif 2160 #ifdef USE_THICKNESSMAP 2161 uniform sampler2D thicknessMap; 2162 #endif 2163 uniform vec2 transmissionSamplerSize; 2164 uniform sampler2D transmissionSamplerMap; 2165 uniform mat4 modelMatrix; 2166 uniform mat4 projectionMatrix; 2167 varying vec3 vWorldPosition; 2168 float w0( float a ) { 2169 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 2170 } 2171 float w1( float a ) { 2172 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 2173 } 2174 float w2( float a ){ 2175 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 2176 } 2177 float w3( float a ) { 2178 return ( 1.0 / 6.0 ) * ( a * a * a ); 2179 } 2180 float g0( float a ) { 2181 return w0( a ) + w1( a ); 2182 } 2183 float g1( float a ) { 2184 return w2( a ) + w3( a ); 2185 } 2186 float h0( float a ) { 2187 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 2188 } 2189 float h1( float a ) { 2190 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 2191 } 2192 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 2193 uv = uv * texelSize.zw + 0.5; 2194 vec2 iuv = floor( uv ); 2195 vec2 fuv = fract( uv ); 2196 float g0x = g0( fuv.x ); 2197 float g1x = g1( fuv.x ); 2198 float h0x = h0( fuv.x ); 2199 float h1x = h1( fuv.x ); 2200 float h0y = h0( fuv.y ); 2201 float h1y = h1( fuv.y ); 2202 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2203 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 2204 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2205 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 2206 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 2207 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 2208 } 2209 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 2210 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 2211 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 2212 vec2 fLodSizeInv = 1.0 / fLodSize; 2213 vec2 cLodSizeInv = 1.0 / cLodSize; 2214 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 2215 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 2216 return mix( fSample, cSample, fract( lod ) ); 2217 } 2218 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 2219 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 2220 vec3 modelScale; 2221 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 2222 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 2223 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 2224 return normalize( refractionVector ) * thickness * modelScale; 2225 } 2226 float applyIorToRoughness( const in float roughness, const in float ior ) { 2227 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 2228 } 2229 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 2230 float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 2231 return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); 2232 } 2233 vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 2234 if ( isinf( attenuationDistance ) ) { 2235 return vec3( 1.0 ); 2236 } else { 2237 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 2238 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; 2239 } 2240 } 2241 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 2242 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 2243 const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, 2244 const in vec3 attenuationColor, const in float attenuationDistance ) { 2245 vec4 transmittedLight; 2246 vec3 transmittance; 2247 #ifdef USE_DISPERSION 2248 float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; 2249 vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); 2250 for ( int i = 0; i < 3; i ++ ) { 2251 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); 2252 vec3 refractedRayExit = position + transmissionRay; 2253 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2254 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2255 refractionCoords += 1.0; 2256 refractionCoords /= 2.0; 2257 vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); 2258 transmittedLight[ i ] = transmissionSample[ i ]; 2259 transmittedLight.a += transmissionSample.a; 2260 transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; 2261 } 2262 transmittedLight.a /= 3.0; 2263 #else 2264 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 2265 vec3 refractedRayExit = position + transmissionRay; 2266 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 2267 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 2268 refractionCoords += 1.0; 2269 refractionCoords /= 2.0; 2270 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 2271 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); 2272 #endif 2273 vec3 attenuatedColor = transmittance * transmittedLight.rgb; 2274 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 2275 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; 2276 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); 2277 } 2278#endif`,JT=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2279 varying vec2 vUv; 2280#endif 2281#ifdef USE_MAP 2282 varying vec2 vMapUv; 2283#endif 2284#ifdef USE_ALPHAMAP
2285 varying vec2 vAlphaMapUv; 2286#endif 2287#ifdef USE_LIGHTMAP 2288 varying vec2 vLightMapUv; 2289#endif 2290#ifdef USE_AOMAP 2291 varying vec2 vAoMapUv; 2292#endif 2293#ifdef USE_BUMPMAP 2294 varying vec2 vBumpMapUv; 2295#endif 2296#ifdef USE_NORMALMAP 2297 varying vec2 vNormalMapUv; 2298#endif 2299#ifdef USE_EMISSIVEMAP 2300 varying vec2 vEmissiveMapUv; 2301#endif 2302#ifdef USE_METALNESSMAP 2303 varying vec2 vMetalnessMapUv; 2304#endif 2305#ifdef USE_ROUGHNESSMAP 2306 varying vec2 vRoughnessMapUv; 2307#endif 2308#ifdef USE_ANISOTROPYMAP 2309 varying vec2 vAnisotropyMapUv; 2310#endif 2311#ifdef USE_CLEARCOATMAP 2312 varying vec2 vClearcoatMapUv; 2313#endif 2314#ifdef USE_CLEARCOAT_NORMALMAP 2315 varying vec2 vClearcoatNormalMapUv; 2316#endif 2317#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2318 varying vec2 vClearcoatRoughnessMapUv; 2319#endif 2320#ifdef USE_IRIDESCENCEMAP 2321 varying vec2 vIridescenceMapUv; 2322#endif 2323#ifdef USE_IRIDESCENCE_THICKNESSMAP 2324 varying vec2 vIridescenceThicknessMapUv; 2325#endif 2326#ifdef USE_SHEEN_COLORMAP 2327 varying vec2 vSheenColorMapUv; 2328#endif 2329#ifdef USE_SHEEN_ROUGHNESSMAP 2330 varying vec2 vSheenRoughnessMapUv; 2331#endif 2332#ifdef USE_SPECULARMAP 2333 varying vec2 vSpecularMapUv; 2334#endif 2335#ifdef USE_SPECULAR_COLORMAP 2336 varying vec2 vSpecularColorMapUv; 2337#endif 2338#ifdef USE_SPECULAR_INTENSITYMAP 2339 varying vec2 vSpecularIntensityMapUv; 2340#endif 2341#ifdef USE_TRANSMISSIONMAP 2342 uniform mat3 transmissionMapTransform; 2343 varying vec2 vTransmissionMapUv; 2344#endif 2345#ifdef USE_THICKNESSMAP 2346 uniform mat3 thicknessMapTransform; 2347 varying vec2 vThicknessMapUv; 2348#endif`,KT=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2349 varying vec2 vUv; 2350#endif 2351#ifdef USE_MAP 2352 uniform mat3 mapTransform; 2353 varying vec2 vMapUv; 2354#endif 2355#ifdef USE_ALPHAMAP 2356 uniform mat3 alphaMapTransform; 2357 varying vec2 vAlphaMapUv; 2358#endif 2359#ifdef USE_LIGHTMAP 2360 uniform mat3 lightMapTransform; 2361 varying vec2 vLightMapUv; 2362#endif 2363#ifdef USE_AOMAP 2364 uniform mat3 aoMapTransform; 2365 varying vec2 vAoMapUv; 2366#endif 2367#ifdef USE_BUMPMAP 2368 uniform mat3 bumpMapTransform; 2369 varying vec2 vBumpMapUv; 2370#endif 2371#ifdef USE_NORMALMAP 2372 uniform mat3 normalMapTransform; 2373 varying vec2 vNormalMapUv; 2374#endif 2375#ifdef USE_DISPLACEMENTMAP 2376 uniform mat3 displacementMapTransform; 2377 varying vec2 vDisplacementMapUv; 2378#endif 2379#ifdef USE_EMISSIVEMAP 2380 uniform mat3 emissiveMapTransform; 2381 varying vec2 vEmissiveMapUv; 2382#endif 2383#ifdef USE_METALNESSMAP 2384 uniform mat3 metalnessMapTransform; 2385 varying vec2 vMetalnessMapUv; 2386#endif 2387#ifdef USE_ROUGHNESSMAP 2388 uniform mat3 roughnessMapTransform; 2389 varying vec2 vRoughnessMapUv; 2390#endif 2391#ifdef USE_ANISOTROPYMAP 2392 uniform mat3 anisotropyMapTransform; 2393 varying vec2 vAnisotropyMapUv; 2394#endif 2395#ifdef USE_CLEARCOATMAP 2396 uniform mat3 clearcoatMapTransform; 2397 varying vec2 vClearcoatMapUv; 2398#endif 2399#ifdef USE_CLEARCOAT_NORMALMAP 2400 uniform mat3 clearcoatNormalMapTransform; 2401 varying vec2 vClearcoatNormalMapUv; 2402#endif 2403#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2404 uniform mat3 clearcoatRoughnessMapTransform; 2405 varying vec2 vClearcoatRoughnessMapUv; 2406#endif 2407#ifdef USE_SHEEN_COLORMAP 2408 uniform mat3 sheenColorMapTransform; 2409 varying vec2 vSheenColorMapUv; 2410#endif 2411#ifdef USE_SHEEN_ROUGHNESSMAP 2412 uniform mat3 sheenRoughnessMapTransform; 2413 varying vec2 vSheenRoughnessMapUv; 2414#endif 2415#ifdef USE_IRIDESCENCEMAP 2416 uniform mat3 iridescenceMapTransform; 2417 varying vec2 vIridescenceMapUv; 2418#endif 2419#ifdef USE_IRIDESCENCE_THICKNESSMAP 2420 uniform mat3 iridescenceThicknessMapTransform; 2421 varying vec2 vIridescenceThicknessMapUv; 2422#endif 2423#ifdef USE_SPECULARMAP 2424 uniform mat3 specularMapTransform; 2425 varying vec2 vSpecularMapUv; 2426#endif 2427#ifdef USE_SPECULAR_COLORMAP 2428 uniform mat3 specularColorMapTransform; 2429 varying vec2 vSpecularColorMapUv; 2430#endif 2431#ifdef USE_SPECULAR_INTENSITYMAP 2432 uniform mat3 specularIntensityMapTransform; 2433 varying vec2 vSpecularIntensityMapUv; 2434#endif 2435#ifdef USE_TRANSMISSIONMAP 2436 uniform mat3 transmissionMapTransform; 2437 varying vec2 vTransmissionMapUv; 2438#endif 2439#ifdef USE_THICKNESSMAP 2440 uniform mat3 thicknessMapTransform; 2441 varying vec2 vThicknessMapUv; 2442#endif`,QT=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) 2443 vUv = vec3( uv, 1 ).xy; 2444#endif 2445#ifdef USE_MAP 2446 vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; 2447#endif 2448#ifdef USE_ALPHAMAP 2449 vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; 2450#endif 2451#ifdef USE_LIGHTMAP 2452 vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; 2453#endif 2454#ifdef USE_AOMAP 2455 vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; 2456#endif 2457#ifdef USE_BUMPMAP 2458 vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; 2459#endif 2460#ifdef USE_NORMALMAP 2461 vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; 2462#endif 2463#ifdef USE_DISPLACEMENTMAP 2464 vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; 2465#endif 2466#ifdef USE_EMISSIVEMAP 2467 vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; 2468#endif 2469#ifdef USE_METALNESSMAP 2470 vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; 2471#endif 2472#ifdef USE_ROUGHNESSMAP 2473 vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; 2474#endif 2475#ifdef USE_ANISOTROPYMAP 2476 vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; 2477#endif 2478#ifdef USE_CLEARCOATMAP 2479 vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; 2480#endif 2481#ifdef USE_CLEARCOAT_NORMALMAP 2482 vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; 2483#endif 2484#ifdef USE_CLEARCOAT_ROUGHNESSMAP 2485 vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; 2486#endif
2487#ifdef USE_IRIDESCENCEMAP 2488 vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; 2489#endif 2490#ifdef USE_IRIDESCENCE_THICKNESSMAP 2491 vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; 2492#endif 2493#ifdef USE_SHEEN_COLORMAP 2494 vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; 2495#endif 2496#ifdef USE_SHEEN_ROUGHNESSMAP 2497 vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; 2498#endif 2499#ifdef USE_SPECULARMAP 2500 vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; 2501#endif 2502#ifdef USE_SPECULAR_COLORMAP 2503 vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; 2504#endif 2505#ifdef USE_SPECULAR_INTENSITYMAP 2506 vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; 2507#endif 2508#ifdef USE_TRANSMISSIONMAP 2509 vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; 2510#endif 2511#ifdef USE_THICKNESSMAP 2512 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; 2513#endif`,$T=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 2514 vec4 worldPosition = vec4( transformed, 1.0 ); 2515 #ifdef USE_BATCHING 2516 worldPosition = batchingMatrix * worldPosition; 2517 #endif 2518 #ifdef USE_INSTANCING 2519 worldPosition = instanceMatrix * worldPosition; 2520 #endif 2521 worldPosition = modelMatrix * worldPosition; 2522#endif`;const eb=`varying vec2 vUv; 2523uniform mat3 uvTransform; 2524void main() { 2525 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 2526 gl_Position = vec4( position.xy, 1.0, 1.0 ); 2527}`,tb=`uniform sampler2D t2D; 2528uniform float backgroundIntensity; 2529varying vec2 vUv; 2530void main() { 2531 vec4 texColor = texture2D( t2D, vUv ); 2532 #ifdef DECODE_VIDEO_TEXTURE 2533 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 ); 2534 #endif 2535 texColor.rgb *= backgroundIntensity; 2536 gl_FragColor = texColor; 2537 #include <tonemapping_fragment> 2538 #include <colorspace_fragment> 2539}`,nb=`varying vec3 vWorldDirection; 2540#include <common> 2541void main() { 2542 vWorldDirection = transformDirection( position, modelMatrix ); 2543 #include <begin_vertex> 2544 #include <project_vertex> 2545 gl_Position.z = gl_Position.w; 2546}`,ib=`#ifdef ENVMAP_TYPE_CUBE 2547 uniform samplerCube envMap; 2548#elif defined( ENVMAP_TYPE_CUBE_UV ) 2549 uniform sampler2D envMap; 2550#endif 2551uniform float flipEnvMap; 2552uniform float backgroundBlurriness; 2553uniform float backgroundIntensity; 2554uniform mat3 backgroundRotation; 2555varying vec3 vWorldDirection; 2556#include <cube_uv_reflection_fragment> 2557void main() { 2558 #ifdef ENVMAP_TYPE_CUBE 2559 vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); 2560 #elif defined( ENVMAP_TYPE_CUBE_UV ) 2561 vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); 2562 #else 2563 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2564 #endif 2565 texColor.rgb *= backgroundIntensity; 2566 gl_FragColor = texColor; 2567 #include <tonemapping_fragment> 2568 #include <colorspace_fragment> 2569}`,rb=`varying vec3 vWorldDirection; 2570#include <common> 2571void main() { 2572 vWorldDirection = transformDirection( position, modelMatrix ); 2573 #include <begin_vertex> 2574 #include <project_vertex> 2575 gl_Position.z = gl_Position.w; 2576}`,sb=`uniform samplerCube tCube; 2577uniform float tFlip; 2578uniform float opacity; 2579varying vec3 vWorldDirection; 2580void main() { 2581 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2582 gl_FragColor = texColor; 2583 gl_FragColor.a *= opacity; 2584 #include <tonemapping_fragment> 2585 #include <colorspace_fragment> 2586}`,ob=`#include <common> 2587#include <batching_pars_vertex> 2588#include <uv_pars_vertex> 2589#include <displacementmap_pars_vertex> 2590#include <morphtarget_pars_vertex> 2591#include <skinning_pars_vertex> 2592#include <logdepthbuf_pars_vertex> 2593#include <clipping_planes_pars_vertex> 2594varying vec2 vHighPrecisionZW; 2595void main() { 2596 #include <uv_vertex> 2597 #include <batching_vertex> 2598 #include <skinbase_vertex> 2599 #include <morphinstance_vertex> 2600 #ifdef USE_DISPLACEMENTMAP 2601 #include <beginnormal_vertex> 2602 #include <morphnormal_vertex> 2603 #include <skinnormal_vertex> 2604 #endif 2605 #include <begin_vertex> 2606 #include <morphtarget_vertex> 2607 #include <skinning_vertex> 2608 #include <displacementmap_vertex> 2609 #include <project_vertex> 2610 #include <logdepthbuf_vertex> 2611 #include <clipping_planes_vertex> 2612 vHighPrecisionZW = gl_Position.zw; 2613}`,ab=`#if DEPTH_PACKING == 3200 2614 uniform float opacity; 2615#endif 2616#include <common> 2617#include <packing> 2618#include <uv_pars_fragment> 2619#include <map_pars_fragment> 2620#include <alphamap_pars_fragment> 2621#include <alphatest_pars_fragment> 2622#include <alphahash_pars_fragment> 2623#include <logdepthbuf_pars_fragment> 2624#include <clipping_planes_pars_fragment> 2625varying vec2 vHighPrecisionZW; 2626void main() { 2627 vec4 diffuseColor = vec4( 1.0 ); 2628 #include <clipping_planes_fragment> 2629 #if DEPTH_PACKING == 3200 2630 diffuseColor.a = opacity; 2631 #endif 2632 #include <map_fragment> 2633 #include <alphamap_fragment> 2634 #include <alphatest_fragment> 2635 #include <alphahash_fragment> 2636 #include <logdepthbuf_fragment> 2637 float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; 2638 #if DEPTH_PACKING == 3200 2639 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2640 #elif DEPTH_PACKING == 3201 2641 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2642 #elif DEPTH_PACKING == 3202 2643 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); 2644 #elif DEPTH_PACKING == 3203 2645 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); 2646 #endif 2647}`,lb=`#define DISTANCE 2648varying vec3 vWorldPosition; 2649#include <common> 2650#include <batching_pars_vertex> 2651#include <uv_pars_vertex> 2652#include <displacementmap_pars_vertex> 2653#include <morphtarget_pars_vertex> 2654#include <skinning_pars_vertex> 2655#include <clipping_planes_pars_vertex> 2656void main() { 2657 #include <uv_vertex> 2658 #include <batching_vertex> 2659 #include <skinbase_vertex> 2660 #include <morphinstance_vertex> 2661 #ifdef USE_DISPLACEMENTMAP 2662 #include <beginnormal_vertex> 2663 #include <morphnormal_vertex> 2664 #include <skinnormal_vertex> 2665 #endif 2666 #include <begin_vertex> 2667 #include <morphtarget_vertex> 2668 #include <skinning_vertex> 2669 #include <displacementmap_vertex> 2670 #include <project_vertex> 2671 #include <worldpos_vertex> 2672 #include <clipping_planes_vertex> 2673 vWorldPosition = worldPosition.xyz; 2674}`,cb=`#define DISTANCE 2675uniform vec3 referencePosition; 2676uniform float nearDistance; 2677uniform float farDistance; 2678varying vec3 vWorldPosition; 2679#include <common> 2680#include <packing> 2681#include <uv_pars_fragment> 2682#include <map_pars_fragment> 2683#include <alphamap_pars_fragment> 2684#include <alphatest_pars_fragment> 2685#include <alphahash_pars_fragment> 2686#include <clipping_planes_pars_fragment> 2687void main () { 2688 vec4 diffuseColor = vec4( 1.0 ); 2689 #include <clipping_planes_fragment> 2690 #include <map_fragment> 2691 #include <alphamap_fragment> 2692 #include <alphatest_fragment> 2693 #include <alphahash_fragment> 2694 float dist = length( vWorldPosition - referencePosition ); 2695 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2696 dist = saturate( dist ); 2697 gl_FragColor = packDepthToRGBA( dist ); 2698}`,ub=`varying vec3 vWorldDirection; 2699#include <common> 2700void main() { 2701 vWorldDirection = transformDirection( position, modelMatrix ); 2702 #include <begin_vertex> 2703 #include <project_vertex> 2704}`,hb=`uniform sampler2D tEquirect; 2705varying vec3 vWorldDirection; 2706#include <common> 2707void main() { 2708 vec3 direction = normalize( vWorldDirection ); 2709 vec2 sampleUV = equirectUv( direction ); 2710 gl_FragColor = texture2D( tEquirect, sampleUV ); 2711 #include <tonemapping_fragment> 2712 #include <colorspace_fragment> 2713}`,fb=`uniform float scale; 2714attribute float lineDistance; 2715varying float vLineDistance; 2716#include <common> 2717#include <uv_pars_vertex> 2718#include <color_pars_vertex> 2719#include <fog_pars_vertex> 2720#include <morphtarget_pars_vertex> 2721#include <logdepthbuf_pars_vertex> 2722#include <clipping_planes_pars_vertex> 2723void main() { 2724 vLineDistance = scale * lineDistance; 2725 #include <uv_vertex> 2726 #include <color_vertex> 2727 #include <morphinstance_vertex> 2728 #include <morphcolor_vertex> 2729 #include <begin_vertex> 2730 #include <morphtarget_vertex> 2731 #include <project_vertex> 2732 #include <logdepthbuf_vertex> 2733 #include <clipping_planes_vertex> 2734 #include <fog_vertex> 2735}`,db=`uniform vec3 diffuse; 2736uniform float opacity; 2737uniform float dashSize; 2738uniform float totalSize; 2739varying float vLineDistance; 2740#include <common> 2741#include <color_pars_fragment> 2742#include <uv_pars_fragment> 2743#include <map_pars_fragment> 2744#include <fog_pars_fragment> 2745#include <logdepthbuf_pars_fragment> 2746#include <clipping_planes_pars_fragment> 2747void main() { 2748 vec4 diffuseColor = vec4( diffuse, opacity ); 2749 #include <clipping_planes_fragment> 2750 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2751 discard; 2752 } 2753 vec3 outgoingLight = vec3( 0.0 ); 2754 #include <logdepthbuf_fragment> 2755 #include <map_fragment> 2756 #include <color_fragment> 2757 outgoingLight = diffuseColor.rgb; 2758 #include <opaque_fragment> 2759 #include <tonemapping_fragment> 2760 #include <colorspace_fragment> 2761 #include <fog_fragment> 2762 #include <premultiplied_alpha_fragment> 2763}`,pb=`#include <common> 2764#include <batching_pars_vertex> 2765#include <uv_pars_vertex> 2766#include <envmap_pars_vertex> 2767#include <color_pars_vertex> 2768#include <fog_pars_vertex> 2769#include <morphtarget_pars_vertex> 2770#include <skinning_pars_vertex> 2771#include <logdepthbuf_pars_vertex> 2772#include <clipping_planes_pars_vertex> 2773void main() { 2774 #include <uv_vertex> 2775 #include <color_vertex> 2776 #include <morphinstance_vertex> 2777 #include <morphcolor_vertex> 2778 #include <batching_vertex> 2779 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2780 #include <beginnormal_vertex> 2781 #include <morphnormal_vertex> 2782 #include <skinbase_vertex> 2783 #include <skinnormal_vertex> 2784 #include <defaultnormal_vertex> 2785 #endif 2786 #include <begin_vertex> 2787 #include <morphtarget_vertex> 2788 #include <skinning_vertex> 2789 #include <project_vertex> 2790 #include <logdepthbuf_vertex> 2791 #include <clipping_planes_vertex> 2792 #include <worldpos_vertex> 2793 #include <envmap_vertex> 2794 #include <fog_vertex> 2795}`,mb=`uniform vec3 diffuse; 2796uniform float opacity; 2797#ifndef FLAT_SHADED 2798 varying vec3 vNormal; 2799#endif 2800#include <common> 2801#include <dithering_pars_fragment> 2802#include <color_pars_fragment> 2803#include <uv_pars_fragment> 2804#include <map_pars_fragment> 2805#include <alphamap_pars_fragment> 2806#include <alphatest_pars_fragment> 2807#include <alphahash_pars_fragment> 2808#include <aomap_pars_fragment> 2809#include <lightmap_pars_fragment> 2810#include <envmap_common_pars_fragment> 2811#include <envmap_pars_fragment> 2812#include <fog_pars_fragment> 2813#include <specularmap_pars_fragment> 2814#include <logdepthbuf_pars_fragment> 2815#include <clipping_planes_pars_fragment> 2816void main() { 2817 vec4 diffuseColor = vec4( diffuse, opacity ); 2818 #include <clipping_planes_fragment> 2819 #include <logdepthbuf_fragment> 2820 #include <map_fragment> 2821 #include <color_fragment> 2822 #include <alphamap_fragment> 2823 #include <alphatest_fragment> 2824 #include <alphahash_fragment> 2825 #include <specularmap_fragment> 2826 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2827 #ifdef USE_LIGHTMAP 2828 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); 2829 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2830 #else 2831 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2832 #endif 2833 #include <aomap_fragment> 2834 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2835 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2836 #include <envmap_fragment> 2837 #include <opaque_fragment> 2838 #include <tonemapping_fragment> 2839 #include <colorspace_fragment> 2840 #include <fog_fragment> 2841 #include <premultiplied_alpha_fragment> 2842 #include <dithering_fragment> 2843}`,gb=`#define LAMBERT 2844varying vec3 vViewPosition; 2845#include <common> 2846#include <batching_pars_vertex> 2847#include <uv_pars_vertex> 2848#include <displacementmap_pars_vertex> 2849#include <envmap_pars_vertex> 2850#include <color_pars_vertex> 2851#include <fog_pars_vertex> 2852#include <normal_pars_vertex> 2853#include <morphtarget_pars_vertex> 2854#include <skinning_pars_vertex> 2855#include <shadowmap_pars_vertex> 2856#include <logdepthbuf_pars_vertex> 2857#include <clipping_planes_pars_vertex> 2858void main() { 2859 #include <uv_vertex> 2860 #include <color_vertex> 2861 #include <morphinstance_vertex> 2862 #include <morphcolor_vertex> 2863 #include <batching_vertex> 2864 #include <beginnormal_vertex> 2865 #include <morphnormal_vertex> 2866 #include <skinbase_vertex> 2867 #include <skinnormal_vertex> 2868 #include <defaultnormal_vertex> 2869 #include <normal_vertex> 2870 #include <begin_vertex> 2871 #include <morphtarget_vertex> 2872 #include <skinning_vertex> 2873 #include <displacementmap_vertex> 2874 #include <project_vertex> 2875 #include <logdepthbuf_vertex> 2876 #include <clipping_planes_vertex> 2877 vViewPosition = - mvPosition.xyz; 2878 #include <worldpos_vertex> 2879 #include <envmap_vertex> 2880 #include <shadowmap_vertex> 2881 #include <fog_vertex> 2882}`,vb=`#define LAMBERT 2883uniform vec3 diffuse; 2884uniform vec3 emissive; 2885uniform float opacity; 2886#include <common> 2887#include <packing> 2888#include <dithering_pars_fragment> 2889#include <color_pars_fragment> 2890#include <uv_pars_fragment> 2891#include <map_pars_fragment> 2892#include <alphamap_pars_fragment> 2893#include <alphatest_pars_fragment> 2894#include <alphahash_pars_fragment> 2895#include <aomap_pars_fragment> 2896#include <lightmap_pars_fragment> 2897#include <emissivemap_pars_fragment> 2898#include <envmap_common_pars_fragment> 2899#include <envmap_pars_fragment> 2900#include <fog_pars_fragment> 2901#include <bsdfs> 2902#include <lights_pars_begin> 2903#include <normal_pars_fragment> 2904#include <lights_lambert_pars_fragment> 2905#include <shadowmap_pars_fragment> 2906#include <bumpmap_pars_fragment> 2907#include <normalmap_pars_fragment> 2908#include <specularmap_pars_fragment> 2909#include <logdepthbuf_pars_fragment> 2910#include <clipping_planes_pars_fragment> 2911void main() { 2912 vec4 diffuseColor = vec4( diffuse, opacity ); 2913 #include <clipping_planes_fragment> 2914 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2915 vec3 totalEmissiveRadiance = emissive; 2916 #include <logdepthbuf_fragment> 2917 #include <map_fragment> 2918 #include <color_fragment> 2919 #include <alphamap_fragment> 2920 #include <alphatest_fragment> 2921 #include <alphahash_fragment> 2922 #include <specularmap_fragment> 2923 #include <normal_fragment_begin> 2924 #include <normal_fragment_maps> 2925 #include <emissivemap_fragment> 2926 #include <lights_lambert_fragment> 2927 #include <lights_fragment_begin> 2928 #include <lights_fragment_maps> 2929 #include <lights_fragment_end> 2930 #include <aomap_fragment> 2931 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 2932 #include <envmap_fragment> 2933 #include <opaque_fragment> 2934 #include <tonemapping_fragment> 2935 #include <colorspace_fragment> 2936 #include <fog_fragment> 2937 #include <premultiplied_alpha_fragment> 2938 #include <dithering_fragment> 2939}`,_b=`#define MATCAP 2940varying vec3 vViewPosition; 2941#include <common> 2942#include <batching_pars_vertex> 2943#include <uv_pars_vertex> 2944#include <color_pars_vertex> 2945#include <displacementmap_pars_vertex> 2946#include <fog_pars_vertex> 2947#include <normal_pars_vertex> 2948#include <morphtarget_pars_vertex> 2949#include <skinning_pars_vertex> 2950#include <logdepthbuf_pars_vertex> 2951#include <clipping_planes_pars_vertex> 2952void main() { 2953 #include <uv_vertex> 2954 #include <color_vertex> 2955 #include <morphinstance_vertex> 2956 #include <morphcolor_vertex> 2957 #include <batching_vertex> 2958 #include <beginnormal_vertex> 2959 #include <morphnormal_vertex> 2960 #include <skinbase_vertex> 2961 #include <skinnormal_vertex> 2962 #include <defaultnormal_vertex> 2963 #include <normal_vertex> 2964 #include <begin_vertex> 2965 #include <morphtarget_vertex> 2966 #include <skinning_vertex> 2967 #include <displacementmap_vertex> 2968 #include <project_vertex> 2969 #include <logdepthbuf_vertex> 2970 #include <clipping_planes_vertex> 2971 #include <fog_vertex> 2972 vViewPosition = - mvPosition.xyz; 2973}`,yb=`#define MATCAP 2974uniform vec3 diffuse; 2975uniform float opacity; 2976uniform sampler2D matcap; 2977varying vec3 vViewPosition; 2978#include <common> 2979#include <dithering_pars_fragment> 2980#include <color_pars_fragment> 2981#include <uv_pars_fragment> 2982#include <map_pars_fragment> 2983#include <alphamap_pars_fragment> 2984#include <alphatest_pars_fragment> 2985#include <alphahash_pars_fragment> 2986#include <fog_pars_fragment> 2987#include <normal_pars_fragment> 2988#include <bumpmap_pars_fragment> 2989#include <normalmap_pars_fragment> 2990#include <logdepthbuf_pars_fragment> 2991#include <clipping_planes_pars_fragment> 2992void main() { 2993 ve
2993c4 diffuseColor = vec4( diffuse, opacity ); 2994 #include <clipping_planes_fragment> 2995 #include <logdepthbuf_fragment> 2996 #include <map_fragment> 2997 #include <color_fragment> 2998 #include <alphamap_fragment> 2999 #include <alphatest_fragment> 3000 #include <alphahash_fragment> 3001 #include <normal_fragment_begin> 3002 #include <normal_fragment_maps> 3003 vec3 viewDir = normalize( vViewPosition ); 3004 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 3005 vec3 y = cross( viewDir, x ); 3006 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 3007 #ifdef USE_MATCAP 3008 vec4 matcapColor = texture2D( matcap, uv ); 3009 #else 3010 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 3011 #endif 3012 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 3013 #include <opaque_fragment> 3014 #include <tonemapping_fragment> 3015 #include <colorspace_fragment> 3016 #include <fog_fragment> 3017 #include <premultiplied_alpha_fragment> 3018 #include <dithering_fragment> 3019}`,xb=`#define NORMAL 3020#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3021 varying vec3 vViewPosition; 3022#endif 3023#include <common> 3024#include <batching_pars_vertex> 3025#include <uv_pars_vertex> 3026#include <displacementmap_pars_vertex> 3027#include <normal_pars_vertex> 3028#include <morphtarget_pars_vertex> 3029#include <skinning_pars_vertex> 3030#include <logdepthbuf_pars_vertex> 3031#include <clipping_planes_pars_vertex> 3032void main() { 3033 #include <uv_vertex> 3034 #include <batching_vertex> 3035 #include <beginnormal_vertex> 3036 #include <morphinstance_vertex> 3037 #include <morphnormal_vertex> 3038 #include <skinbase_vertex> 3039 #include <skinnormal_vertex> 3040 #include <defaultnormal_vertex> 3041 #include <normal_vertex> 3042 #include <begin_vertex> 3043 #include <morphtarget_vertex> 3044 #include <skinning_vertex> 3045 #include <displacementmap_vertex> 3046 #include <project_vertex> 3047 #include <logdepthbuf_vertex> 3048 #include <clipping_planes_vertex> 3049#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3050 vViewPosition = - mvPosition.xyz; 3051#endif 3052}`,Sb=`#define NORMAL 3053uniform float opacity; 3054#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) 3055 varying vec3 vViewPosition; 3056#endif 3057#include <packing> 3058#include <uv_pars_fragment> 3059#include <normal_pars_fragment> 3060#include <bumpmap_pars_fragment> 3061#include <normalmap_pars_fragment> 3062#include <logdepthbuf_pars_fragment> 3063#include <clipping_planes_pars_fragment> 3064void main() { 3065 vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); 3066 #include <clipping_planes_fragment> 3067 #include <logdepthbuf_fragment> 3068 #include <normal_fragment_begin> 3069 #include <normal_fragment_maps> 3070 gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); 3071 #ifdef OPAQUE 3072 gl_FragColor.a = 1.0; 3073 #endif 3074}`,Mb=`#define PHONG 3075varying vec3 vViewPosition; 3076#include <common> 3077#include <batching_pars_vertex> 3078#include <uv_pars_vertex> 3079#include <displacementmap_pars_vertex> 3080#include <envmap_pars_vertex> 3081#include <color_pars_vertex> 3082#include <fog_pars_vertex> 3083#include <normal_pars_vertex> 3084#include <morphtarget_pars_vertex> 3085#include <skinning_pars_vertex> 3086#include <shadowmap_pars_vertex> 3087#include <logdepthbuf_pars_vertex> 3088#include <clipping_planes_pars_vertex> 3089void main() { 3090 #include <uv_vertex> 3091 #include <color_vertex> 3092 #include <morphcolor_vertex> 3093 #include <batching_vertex> 3094 #include <beginnormal_vertex> 3095 #include <morphinstance_vertex> 3096 #include <morphnormal_vertex> 3097 #include <skinbase_vertex> 3098 #include <skinnormal_vertex> 3099 #include <defaultnormal_vertex> 3100 #include <normal_vertex> 3101 #include <begin_vertex> 3102 #include <morphtarget_vertex> 3103 #include <skinning_vertex> 3104 #include <displacementmap_vertex> 3105 #include <project_vertex> 3106 #include <logdepthbuf_vertex> 3107 #include <clipping_planes_vertex> 3108 vViewPosition = - mvPosition.xyz; 3109 #include <worldpos_vertex> 3110 #include <envmap_vertex> 3111 #include <shadowmap_vertex> 3112 #include <fog_vertex> 3113}`,wb=`#define PHONG 3114uniform vec3 diffuse; 3115uniform vec3 emissive; 3116uniform vec3 specular; 3117uniform float shininess; 3118uniform float opacity; 3119#include <common> 3120#include <packing> 3121#include <dithering_pars_fragment> 3122#include <color_pars_fragment> 3123#include <uv_pars_fragment> 3124#include <map_pars_fragment> 3125#include <alphamap_pars_fragment> 3126#include <alphatest_pars_fragment> 3127#include <alphahash_pars_fragment> 3128#include <aomap_pars_fragment> 3129#include <lightmap_pars_fragment> 3130#include <emissivemap_pars_fragment> 3131#include <envmap_common_pars_fragment> 3132#include <envmap_pars_fragment> 3133#include <fog_pars_fragment> 3134#include <bsdfs> 3135#include <lights_pars_begin> 3136#include <normal_pars_fragment> 3137#include <lights_phong_pars_fragment> 3138#include <shadowmap_pars_fragment> 3139#include <bumpmap_pars_fragment> 3140#include <normalmap_pars_fragment> 3141#include <specularmap_pars_fragment> 3142#include <logdepthbuf_pars_fragment> 3143#include <clipping_planes_pars_fragment> 3144void main() { 3145 vec4 diffuseColor = vec4( diffuse, opacity ); 3146 #include <clipping_planes_fragment> 3147 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3148 vec3 totalEmissiveRadiance = emissive; 3149 #include <logdepthbuf_fragment> 3150 #include <map_fragment> 3151 #include <color_fragment> 3152 #include <alphamap_fragment> 3153 #include <alphatest_fragment> 3154 #include <alphahash_fragment> 3155 #include <specularmap_fragment> 3156 #include <normal_fragment_begin> 3157 #include <normal_fragment_maps> 3158 #include <emissivemap_fragment> 3159 #include <lights_phong_fragment> 3160 #include <lights_fragment_begin> 3161 #include <lights_fragment_maps> 3162 #include <lights_fragment_end> 3163 #include <aomap_fragment> 3164 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 3165 #include <envmap_fragment> 3166 #include <opaque_fragment> 3167 #include <tonemapping_fragment> 3168 #include <colorspace_fragment> 3169 #include <fog_fragment> 3170 #include <premultiplied_alpha_fragment> 3171 #include <dithering_fragment> 3172}`,Eb=`#define STANDARD 3173varying vec3 vViewPosition; 3174#ifdef USE_TRANSMISSION 3175 varying vec3 vWorldPosition; 3176#endif 3177#include <common> 3178#include <batching_pars_vertex> 3179#include <uv_pars_vertex> 3180#include <displacementmap_pars_vertex> 3181#include <color_pars_vertex> 3182#include <fog_pars_vertex> 3183#include <normal_pars_vertex> 3184#include <morphtarget_pars_vertex> 3185#include <skinning_pars_vertex> 3186#include <shadowmap_pars_vertex> 3187#include <logdepthbuf_pars_vertex> 3188#include <clipping_planes_pars_vertex> 3189void main() { 3190 #include <uv_vertex> 3191 #include <color_vertex> 3192 #include <morphinstance_vertex> 3193 #include <morphcolor_vertex> 3194 #include <batching_vertex> 3195 #include <beginnormal_vertex> 3196 #include <morphnormal_vertex> 3197 #include <skinbase_vertex> 3198 #include <skinnormal_vertex> 3199 #include <defaultnormal_vertex> 3200 #include <normal_vertex> 3201 #include <begin_vertex> 3202 #include <morphtarget_vertex> 3203 #include <skinning_vertex> 3204 #include <displacementmap_vertex> 3205 #include <project_vertex> 3206 #include <logdepthbuf_vertex> 3207 #include <clipping_planes_vertex> 3208 vViewPosition = - mvPosition.xyz; 3209 #include <worldpos_vertex> 3210 #include <shadowmap_vertex> 3211 #include <fog_vertex> 3212#ifdef USE_TRANSMISSION 3213 vWorldPosition = worldPosition.xyz; 3214#endif 3215}`,Tb=`#define STANDARD 3216#ifdef PHYSICAL 3217 #define IOR 3218 #define USE_SPECULAR 3219#endif 3220uniform vec3 diffuse; 3221uniform vec3 emissive; 3222uniform float roughness; 3223uniform float metalness; 3224uniform float opacity; 3225#ifdef IOR 3226 uniform float ior; 3227#endif 3228#ifdef USE_SPECULAR 3229 uniform float specularIntensity; 3230 uniform vec3 specularColor; 3231 #ifdef USE_SPECULAR_COLORMAP 3232 uniform sampler2D specularColorMap; 3233 #endif 3234 #ifdef USE_SPECULAR_INTENSITYMAP 3235 uniform sampler2D specularIntensityMap; 3236 #endif 3237#endif 3238#ifdef USE_CLEARCOAT 3239 uniform float clearcoat; 3240 uniform float clearcoatRoughness; 3241#endif 3242#ifdef USE_DISPERSION 3243 uniform float dispersion; 3244#endif
3245#ifdef USE_IRIDESCENCE 3246 uniform float iridescence; 3247 uniform float iridescenceIOR; 3248 uniform float iridescenceThicknessMinimum; 3249 uniform float iridescenceThicknessMaximum; 3250#endif 3251#ifdef USE_SHEEN 3252 uniform vec3 sheenColor; 3253 uniform float sheenRoughness; 3254 #ifdef USE_SHEEN_COLORMAP 3255 uniform sampler2D sheenColorMap; 3256 #endif 3257 #ifdef USE_SHEEN_ROUGHNESSMAP 3258 uniform sampler2D sheenRoughnessMap; 3259 #endif 3260#endif 3261#ifdef USE_ANISOTROPY 3262 uniform vec2 anisotropyVector; 3263 #ifdef USE_ANISOTROPYMAP 3264 uniform sampler2D anisotropyMap; 3265 #endif 3266#endif 3267varying vec3 vViewPosition; 3268#include <common> 3269#include <packing> 3270#include <dithering_pars_fragment> 3271#include <color_pars_fragment> 3272#include <uv_pars_fragment> 3273#include <map_pars_fragment> 3274#include <alphamap_pars_fragment> 3275#include <alphatest_pars_fragment> 3276#include <alphahash_pars_fragment> 3277#include <aomap_pars_fragment> 3278#include <lightmap_pars_fragment> 3279#include <emissivemap_pars_fragment> 3280#include <iridescence_fragment> 3281#include <cube_uv_reflection_fragment> 3282#include <envmap_common_pars_fragment> 3283#include <envmap_physical_pars_fragment> 3284#include <fog_pars_fragment> 3285#include <lights_pars_begin> 3286#include <normal_pars_fragment> 3287#include <lights_physical_pars_fragment> 3288#include <transmission_pars_fragment> 3289#include <shadowmap_pars_fragment> 3290#include <bumpmap_pars_fragment> 3291#include <normalmap_pars_fragment> 3292#include <clearcoat_pars_fragment> 3293#include <iridescence_pars_fragment> 3294#include <roughnessmap_pars_fragment> 3295#include <metalnessmap_pars_fragment> 3296#include <logdepthbuf_pars_fragment> 3297#include <clipping_planes_pars_fragment> 3298void main() { 3299 vec4 diffuseColor = vec4( diffuse, opacity ); 3300 #include <clipping_planes_fragment> 3301 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3302 vec3 totalEmissiveRadiance = emissive; 3303 #include <logdepthbuf_fragment> 3304 #include <map_fragment> 3305 #include <color_fragment> 3306 #include <alphamap_fragment> 3307 #include <alphatest_fragment> 3308 #include <alphahash_fragment> 3309 #include <roughnessmap_fragment> 3310 #include <metalnessmap_fragment> 3311 #include <normal_fragment_begin> 3312 #include <normal_fragment_maps> 3313 #include <clearcoat_normal_fragment_begin> 3314 #include <clearcoat_normal_fragment_maps> 3315 #include <emissivemap_fragment> 3316 #include <lights_physical_fragment> 3317 #include <lights_fragment_begin> 3318 #include <lights_fragment_maps> 3319 #include <lights_fragment_end> 3320 #include <aomap_fragment> 3321 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 3322 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 3323 #include <transmission_fragment> 3324 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 3325 #ifdef USE_SHEEN 3326 float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); 3327 outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; 3328 #endif 3329 #ifdef USE_CLEARCOAT 3330 float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); 3331 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 3332 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; 3333 #endif 3334 #include <opaque_fragment> 3335 #include <tonemapping_fragment> 3336 #include <colorspace_fragment> 3337 #include <fog_fragment> 3338 #include <premultiplied_alpha_fragment> 3339 #include <dithering_fragment> 3340}`,bb=`#define TOON 3341varying vec3 vViewPosition; 3342#include <common> 3343#include <batching_pars_vertex> 3344#include <uv_pars_vertex> 3345#include <displacementmap_pars_vertex> 3346#include <color_pars_vertex> 3347#include <fog_pars_vertex> 3348#include <normal_pars_vertex> 3349#include <morphtarget_pars_vertex> 3350#include <skinning_pars_vertex> 3351#include <shadowmap_pars_vertex> 3352#include <logdepthbuf_pars_vertex> 3353#include <clipping_planes_pars_vertex> 3354void main() { 3355 #include <uv_vertex> 3356 #include <color_vertex> 3357 #include <morphinstance_vertex> 3358 #include <morphcolor_vertex> 3359 #include <batching_vertex> 3360 #include <beginnormal_vertex> 3361 #include <morphnormal_vertex> 3362 #include <skinbase_vertex> 3363 #include <skinnormal_vertex> 3364 #include <defaultnormal_vertex> 3365 #include <normal_vertex> 3366 #include <begin_vertex> 3367 #include <morphtarget_vertex> 3368 #include <skinning_vertex> 3369 #include <displacementmap_vertex> 3370 #include <project_vertex> 3371 #include <logdepthbuf_vertex> 3372 #include <clipping_planes_vertex> 3373 vViewPosition = - mvPosition.xyz; 3374 #include <worldpos_vertex> 3375 #include <shadowmap_vertex> 3376 #include <fog_vertex> 3377}`,Ab=`#define TOON 3378uniform vec3 diffuse; 3379uniform vec3 emissive; 3380uniform float opacity; 3381#include <common> 3382#include <packing> 3383#include <dithering_pars_fragment> 3384#include <color_pars_fragment> 3385#include <uv_pars_fragment> 3386#include <map_pars_fragment> 3387#include <alphamap_pars_fragment> 3388#include <alphatest_pars_fragment> 3389#include <alphahash_pars_fragment> 3390#include <aomap_pars_fragment> 3391#include <lightmap_pars_fragment> 3392#include <emissivemap_pars_fragment> 3393#include <gradientmap_pars_fragment> 3394#include <fog_pars_fragment> 3395#include <bsdfs> 3396#include <lights_pars_begin> 3397#include <normal_pars_fragment> 3398#include <lights_toon_pars_fragment> 3399#include <shadowmap_pars_fragment> 3400#include <bumpmap_pars_fragment> 3401#include <normalmap_pars_fragment> 3402#include <logdepthbuf_pars_fragment> 3403#include <clipping_planes_pars_fragment> 3404void main() { 3405 vec4 diffuseColor = vec4( diffuse, opacity ); 3406 #include <clipping_planes_fragment> 3407 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 3408 vec3 totalEmissiveRadiance = emissive; 3409 #include <logdepthbuf_fragment> 3410 #include <map_fragment> 3411 #include <color_fragment> 3412 #include <alphamap_fragment> 3413 #include <alphatest_fragment> 3414 #include <alphahash_fragment> 3415 #include <normal_fragment_begin> 3416 #include <normal_fragment_maps> 3417 #include <emissivemap_fragment> 3418 #include <lights_toon_fragment> 3419 #include <lights_fragment_begin> 3420 #include <lights_fragment_maps> 3421 #include <lights_fragment_end> 3422 #include <aomap_fragment> 3423 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 3424 #include <opaque_fragment> 3425 #include <tonemapping_fragment> 3426 #include <colorspace_fragment> 3427 #include <fog_fragment> 3428 #include <premultiplied_alpha_fragment> 3429 #include <dithering_fragment> 3430}`,Cb=`uniform float size; 3431uniform float scale; 3432#include <common> 3433#include <color_pars_vertex> 3434#include <fog_pars_vertex> 3435#include <morphtarget_pars_vertex> 3436#include <logdepthbuf_pars_vertex> 3437#include <clipping_planes_pars_vertex> 3438#ifdef USE_POINTS_UV 3439 varying vec2 vUv; 3440 uniform mat3 uvTransform; 3441#endif 3442void main() { 3443 #ifdef USE_POINTS_UV 3444 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 3445 #endif 3446 #include <color_vertex> 3447 #include <morphinstance_vertex> 3448 #include <morphcolor_vertex> 3449 #include <begin_vertex> 3450 #include <morphtarget_vertex> 3451 #include <project_vertex> 3452 gl_PointSize = size; 3453 #ifdef USE_SIZEATTENUATION 3454 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3455 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 3456 #endif 3457 #include <logdepthbuf_vertex> 3458 #include <clipping_planes_vertex> 3459 #include <worldpos_vertex> 3460 #include <fog_vertex> 3461}`,Rb=`uniform vec3 diffuse; 3462uniform float opacity; 3463#include <common> 3464#include <color_pars_fragment> 3465#include <map_particle_pars_fragment> 3466#include <alphatest_pars_fragment> 3467#include <alphahash_pars_fragment> 3468#include <fog_pars_fragment> 3469#include <logdepthbuf_pars_fragment> 3470#include <clipping_planes_pars_fragment> 3471void main() { 3472 vec4 diffuseColor = vec4( diffuse, opacity ); 3473 #include <clipping_planes_fragment> 3474 vec3 outgoingLight = vec3( 0.0 ); 3475 #include <logdepthbuf_fragment> 3476 #include <map_particle_fragment> 3477 #include <color_fragment> 3478 #include <alphatest_fragment> 3479 #include <alphahash_fragment> 3480 outgoingLight = diffuseColor.rgb; 3481 #include <opaque_fragment> 3482 #include <tonemapping_fragment> 3483 #include <colorspace_fragment> 3484 #include <fog_fragment> 3485 #include <premultiplied_alpha_fragment> 3486}`,Ib=`#include <common> 3487#include <batching_pars_vertex> 3488#include <fog_pars_vertex> 3489#include <morphtarget_pars_vertex> 3490#include <skinning_pars_vertex> 3491#include <logdepthbuf_pars_vertex> 3492#include <shadowmap_pars_vertex> 3493void main() { 3494 #include <batching_vertex> 3495 #include <beginnormal_vertex> 3496 #include <morphinstance_vertex> 3497 #include <morphnormal_vertex> 3498 #include <skinbase_vertex> 3499 #include <skinnormal_vertex> 3500 #include <defaultnormal_vertex> 3501 #include <begin_vertex> 3502 #include <morphtarget_vertex> 3503 #include <skinning_vertex> 3504 #include <project_vertex> 3505 #include <logdepthbuf_vertex> 3506 #include <worldpos_vertex> 3507 #include <shadowmap_vertex> 3508 #include <fog_vertex> 3509}`,Pb=`uniform vec3 color; 3510uniform float opacity; 3511#include <common> 3512#include <packing> 3513#include <fog_pars_fragment> 3514#include <bsdfs> 3515#include <lights_pars_begin> 3516#include <logdepthbuf_pars_fragment> 3517#include <shadowmap_pars_fragment> 3518#include <shadowmask_pars_fragment> 3519void main() { 3520 #include <logdepthbuf_fragment> 3521 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 3522 #include <tonemapping_fragment> 3523 #include <colorspace_fragment> 3524 #include <fog_fragment> 3525}`,Lb=`uniform float rotation; 3526uniform vec2 center; 3527#include <common> 3528#include <uv_pars_vertex> 3529#include <fog_pars_vertex> 3530#include <logdepthbuf_pars_vertex> 3531#include <clipping_planes_pars_vertex> 3532void main() { 3533 #include <uv_vertex> 3534 vec4 mvPosition = modelViewMatrix[ 3 ]; 3535 vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); 3536 #ifndef USE_SIZEATTENUATION 3537 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 3538 if ( isPerspective ) scale *= - mvPosition.z; 3539 #endif 3540 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 3541 vec2 rotatedPosition; 3542 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 3543 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 3544 mvPosition.xy += rotatedPosition; 3545 gl_Position = projectionMatrix * mvPosition; 3546 #include <logdepthbuf_vertex> 3547 #include <clipping_planes_vertex> 3548 #include <fog_vertex> 3549}`,Db=`uniform vec3 diffuse; 3550uniform float opacity; 3551#include <common> 3552#include <uv_pars_fragment> 3553#include <map_pars_fragment> 3554#include <alphamap_pars_fragment> 3555#include <alphatest_pars_fragment> 3556#include <alphahash_pars_fragment> 3557#include <fog_pars_fragment> 3558#include <logdepthbuf_pars_fragment> 3559#include <clipping_planes_pars_fragment> 3560void main() { 3561 vec4 diffuseColor = vec4( diffuse, opacity ); 3562 #include <clipping_planes_fragment> 3563 vec3 outgoingLight = vec3( 0.0 ); 3564 #include <logdepthbuf_fragment> 3565 #include <map_fragment> 3566 #include <alphamap_fragment> 3567 #include <alphatest_fragment> 3568 #include <alphahash_fragment> 3569 outgoingLight = diffuseColor.rgb; 3570 #include <opaque_fragment> 3571 #include <tonemapping_fragment> 3572 #include <colorspace_fragment> 3573 #include <fog_fragment> 3574}`,kt={alphahash_fragment:tE,alphahash_pars_fragment:nE,alphamap_fragment:iE,alphamap_pars_fragment:rE,alph
vendor: 7,299 bytes, line 3574
3574atest_fragment:sE,alphatest_pars_fragment:oE,aomap_fragment:aE,aomap_pars_fragment:lE,batching_pars_vertex:cE,batching_vertex:uE,begin_vertex:hE,beginnormal_vertex:fE,bsdfs:dE,iridescence_fragment:pE,bumpmap_pars_fragment:mE,clipping_planes_fragment:gE,clipping_planes_pars_fragment:vE,clipping_planes_pars_vertex:_E,clipping_planes_vertex:yE,color_fragment:xE,color_pars_fragment:SE,color_pars_vertex:ME,color_vertex:wE,common:EE,cube_uv_reflection_fragment:TE,defaultnormal_vertex:bE,displacementmap_pars_vertex:AE,displacementmap_vertex:CE,emissivemap_fragment:RE,emissivemap_pars_fragment:IE,colorspace_fragment:PE,colorspace_pars_fragment:LE,envmap_fragment:DE,envmap_common_pars_fragment:UE,envmap_pars_fragment:NE,envmap_pars_vertex:FE,envmap_physical_pars_fragment:qE,envmap_vertex:OE,fog_vertex:BE,fog_pars_vertex:zE,fog_fragment:kE,fog_pars_fragment:HE,gradientmap_pars_fragment:VE,lightmap_pars_fragment:GE,lights_lambert_fragment:WE,lights_lambert_pars_fragment:XE,lights_pars_begin:YE,lights_toon_fragment:ZE,lights_toon_pars_fragment:jE,lights_phong_fragment:JE,lights_phong_pars_fragment:KE,lights_physical_fragment:QE,lights_physical_pars_fragment:$E,lights_fragment_begin:eT,lights_fragment_maps:tT,lights_fragment_end:nT,logdepthbuf_fragment:iT,logdepthbuf_pars_fragment:rT,logdepthbuf_pars_vertex:sT,logdepthbuf_vertex:oT,map_fragment:aT,map_pars_fragment:lT,map_particle_fragment:cT,map_particle_pars_fragment:uT,metalnessmap_fragment:hT,metalnessmap_pars_fragment:fT,morphinstance_vertex:dT,morphcolor_vertex:pT,morphnormal_vertex:mT,morphtarget_pars_vertex:gT,morphtarget_vertex:vT,normal_fragment_begin:_T,normal_fragment_maps:yT,normal_pars_fragment:xT,normal_pars_vertex:ST,normal_vertex:MT,normalmap_pars_fragment:wT,clearcoat_normal_fragment_begin:ET,clearcoat_normal_fragment_maps:TT,clearcoat_pars_fragment:bT,iridescence_pars_fragment:AT,opaque_fragment:CT,packing:RT,premultiplied_alpha_fragment:IT,project_vertex:PT,dithering_fragment:LT,dithering_pars_fragment:DT,roughnessmap_fragment:UT,roughnessmap_pars_fragment:NT,shadowmap_pars_fragment:FT,shadowmap_pars_vertex:OT,shadowmap_vertex:BT,shadowmask_pars_fragment:zT,skinbase_vertex:kT,skinning_pars_vertex:HT,skinning_vertex:VT,skinnormal_vertex:GT,specularmap_fragment:WT,specularmap_pars_fragment:XT,tonemapping_fragment:YT,tonemapping_pars_fragment:qT,transmission_fragment:ZT,transmission_pars_fragment:jT,uv_pars_fragment:JT,uv_pars_vertex:KT,uv_vertex:QT,worldpos_vertex:$T,background_vert:eb,background_frag:tb,backgroundCube_vert:nb,backgroundCube_frag:ib,cube_vert:rb,cube_frag:sb,depth_vert:ob,depth_frag:ab,distanceRGBA_vert:lb,distanceRGBA_frag:cb,equirect_vert:ub,equirect_frag:hb,linedashed_vert:fb,linedashed_frag:db,meshbasic_vert:pb,meshbasic_frag:mb,meshlambert_vert:gb,meshlambert_frag:vb,meshmatcap_vert:_b,meshmatcap_frag:yb,meshnormal_vert:xb,meshnormal_frag:Sb,meshphong_vert:Mb,meshphong_frag:wb,meshphysical_vert:Eb,meshphysical_frag:Tb,meshtoon_vert:bb,meshtoon_frag:Ab,points_vert:Cb,points_frag:Rb,shadow_vert:Ib,shadow_frag:Pb,sprite_vert:Lb,sprite_frag:Db},Qe={common:{diffuse:{value:new rt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ut},alphaMap:{value:null},alphaMapTransform:{value:new Ut},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ut}},envmap:{envMap:{value:null},envMapRotation:{value:new Ut},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ut}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ut}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ut},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ut},normalScale:{value:new we(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ut},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ut}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ut}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ut}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new rt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new rt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ut},alphaTest:{value:0},uvTransform:{value:new Ut}},sprite:{diffuse:{value:new rt(16777215)},opacity:{value:1},center:{value:new we(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ut},alphaMap:{value:null},alphaMapTransform:{value:new Ut},alphaTest:{value:0}}},Zi={basic:{uniforms:ni([Qe.common,Qe.specularmap,Qe.envmap,Qe.aomap,Qe.lightmap,Qe.fog]),vertexShader:kt.meshbasic_vert,fragmentShader:kt.meshbasic_frag},lambert:{uniforms:ni([Qe.common,Qe.specularmap,Qe.envmap,Qe.aomap,Qe.lightmap,Qe.emissivemap,Qe.bumpmap,Qe.normalmap,Qe.displacementmap,Qe.fog,Qe.lights,{emissive:{value:new rt(0)}}]),vertexShader:kt.meshlambert_vert,fragmentShader:kt.meshlambert_frag},phong:{uniforms:ni([Qe.common,Qe.specularmap,Qe.envmap,Qe.aomap,Qe.lightmap,Qe.emissivemap,Qe.bumpmap,Qe.normalmap,Qe.displacementmap,Qe.fog,Qe.lights,{emissive:{value:new rt(0)},specular:{value:new rt(1118481)},shininess:{value:30}}]),vertexShader:kt.meshphong_vert,fragmentShader:kt.meshphong_frag},standard:{uniforms:ni([Qe.common,Qe.envmap,Qe.aomap,Qe.lightmap,Qe.emissivemap,Qe.bumpmap,Qe.normalmap,Qe.displacementmap,Qe.roughnessmap,Qe.metalnessmap,Qe.fog,Qe.lights,{emissive:{value:new rt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:kt.meshphysical_vert,fragmentShader:kt.meshphysical_frag},toon:{uniforms:ni([Qe.common,Qe.aomap,Qe.lightmap,Qe.emissivemap,Qe.bumpmap,Qe.normalmap,Qe.displacementmap,Qe.gradientmap,Qe.fog,Qe.lights,{emissive:{value:new rt(0)}}]),vertexShader:kt.meshtoon_vert,fragmentShader:kt.meshtoon_frag},matcap:{uniforms:ni([Qe.common,Qe.bumpmap,Qe.normalmap,Qe.displacementmap,Qe.fog,{matc
vendor: 4,491 bytes, line 3574
3574ap:{value:null}}]),vertexShader:kt.meshmatcap_vert,fragmentShader:kt.meshmatcap_frag},points:{uniforms:ni([Qe.points,Qe.fog]),vertexShader:kt.points_vert,fragmentShader:kt.points_frag},dashed:{uniforms:ni([Qe.common,Qe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:kt.linedashed_vert,fragmentShader:kt.linedashed_frag},depth:{uniforms:ni([Qe.common,Qe.displacementmap]),vertexShader:kt.depth_vert,fragmentShader:kt.depth_frag},normal:{uniforms:ni([Qe.common,Qe.bumpmap,Qe.normalmap,Qe.displacementmap,{opacity:{value:1}}]),vertexShader:kt.meshnormal_vert,fragmentShader:kt.meshnormal_frag},sprite:{uniforms:ni([Qe.sprite,Qe.fog]),vertexShader:kt.sprite_vert,fragmentShader:kt.sprite_frag},background:{uniforms:{uvTransform:{value:new Ut},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:kt.background_vert,fragmentShader:kt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ut}},vertexShader:kt.backgroundCube_vert,fragmentShader:kt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:kt.cube_vert,fragmentShader:kt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:kt.equirect_vert,fragmentShader:kt.equirect_frag},distanceRGBA:{uniforms:ni([Qe.common,Qe.displacementmap,{referencePosition:{value:new B},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:kt.distanceRGBA_vert,fragmentShader:kt.distanceRGBA_frag},shadow:{uniforms:ni([Qe.lights,Qe.fog,{color:{value:new rt(0)},opacity:{value:1}}]),vertexShader:kt.shadow_vert,fragmentShader:kt.shadow_frag}};Zi.physical={uniforms:ni([Zi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ut},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ut},clearcoatNormalScale:{value:new we(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ut},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ut},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ut},sheen:{value:0},sheenColor:{value:new rt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ut},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ut},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ut},transmissionSamplerSize:{value:new we},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ut},attenuationDistance:{value:0},attenuationColor:{value:new rt(0)},specularColor:{value:new rt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ut},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ut},anisotropyVector:{value:new we},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ut}}]),vertexShader:kt.meshphysical_vert,fragmentShader:kt.meshphysical_frag};const _u={r:0,b:0,g:0},Os=new Ai,Ub=new bt;function Nb(r,e,t,n,i,s,o){const c=new rt(0);let u=s===!0?0:1,h,f,d=null,m=0,g=null;function y(E){let T=E.isScene===!0?E.background:null;return T&&T.isTexture&&(T=(E.backgroundBlurriness>0?t:e).get(T)),T}function M(E){let T=!1;const U=y(E);U===null?v(c,u):U&&U.isColor&&(v(U,1),T=!0);const I=r.xr.getEnvironmentBlendMode();I==="additive"?n.buffers.color.setClear(0,0,0,1,o):I==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,o),(r.autoClear||T)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function x(E,T){const U=y(T);U&&(U.isCubeTexture||U.mapping===aa)?(f===void 0&&(f=new mn(new no(1,1,1),new gi({name:"BackgroundCubeMaterial",uniforms:na(Zi.backgroundCube.uniforms),vertexShader:Zi.backgroundCube.vertexShader,fragmentShader:Zi.backgroundCube.fragmentShader,side:si,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),f.geometry.deleteAttribute("normal"),f.geometry.deleteAttribute("uv"),f.onBeforeRender=function(I,N,D){this.matrixWorld.copyPosition(D.matrixWorld)},Object.defineProperty(f.material,"envMap",{get:function(){return this.uniforms.envMap.value}}
vendor: 4,533 bytes, line 3574
3574),i.update(f)),Os.copy(T.backgroundRotation),Os.x*=-1,Os.y*=-1,Os.z*=-1,U.isCubeTexture&&U.isRenderTargetTexture===!1&&(Os.y*=-1,Os.z*=-1),f.material.uniforms.envMap.value=U,f.material.uniforms.flipEnvMap.value=U.isCubeTexture&&U.isRenderTargetTexture===!1?-1:1,f.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,f.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,f.material.uniforms.backgroundRotation.value.setFromMatrix4(Ub.makeRotationFromEuler(Os)),f.material.toneMapped=qt.getTransfer(U.colorSpace)!==en,(d!==U||m!==U.version||g!==r.toneMapping)&&(f.material.needsUpdate=!0,d=U,m=U.version,g=r.toneMapping),f.layers.enableAll(),E.unshift(f,f.geometry,f.material,0,0,null)):U&&U.isTexture&&(h===void 0&&(h=new mn(new ds(2,2),new gi({name:"BackgroundMaterial",uniforms:na(Zi.background.uniforms),vertexShader:Zi.background.vertexShader,fragmentShader:Zi.background.fragmentShader,side:Or,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(h)),h.material.uniforms.t2D.value=U,h.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,h.material.toneMapped=qt.getTransfer(U.colorSpace)!==en,U.matrixAutoUpdate===!0&&U.updateMatrix(),h.material.uniforms.uvTransform.value.copy(U.matrix),(d!==U||m!==U.version||g!==r.toneMapping)&&(h.material.needsUpdate=!0,d=U,m=U.version,g=r.toneMapping),h.layers.enableAll(),E.unshift(h,h.geometry,h.material,0,0,null))}function v(E,T){E.getRGB(_u,W_(r)),n.buffers.color.setClear(_u.r,_u.g,_u.b,T,o)}function w(){f!==void 0&&(f.geometry.dispose(),f.material.dispose(),f=void 0),h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0)}return{getClearColor:function(){return c},setClearColor:function(E,T=1){c.set(E),u=T,v(c,u)},getClearAlpha:function(){return u},setClearAlpha:function(E){u=E,v(c,u)},render:M,addToRenderList:x,dispose:w}}function Fb(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=m(null);let s=i,o=!1;function c(A,F,j,Z,$){let ae=!1;const ne=d(Z,j,F);s!==ne&&(s=ne,h(s.object)),ae=g(A,Z,j,$),ae&&y(A,Z,j,$),$!==null&&e.update($,r.ELEMENT_ARRAY_BUFFER),(ae||o)&&(o=!1,T(A,F,j,Z),$!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get($).buffer))}function u(){return r.createVertexArray()}function h(A){return r.bindVertexArray(A)}function f(A){return r.deleteVertexArray(A)}function d(A,F,j){const Z=j.wireframe===!0;let $=n[A.id];$===void 0&&($={},n[A.id]=$);let ae=$[F.id];ae===void 0&&(ae={},$[F.id]=ae);let ne=ae[Z];return ne===void 0&&(ne=m(u()),ae[Z]=ne),ne}function m(A){const F=[],j=[],Z=[];for(let $=0;$<t;$++)F[$]=0,j[$]=0,Z[$]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:F,enabledAttributes:j,attributeDivisors:Z,object:A,attributes:{},index:null}}function g(A,F,j,Z){const $=s.attributes,ae=F.attributes;let ne=0;const xe=j.getAttributes();for(const k in xe)if(xe[k].location>=0){const Q=$[k];let fe=ae[k];if(fe===void 0&&(k==="instanceMatrix"&&A.instanceMatrix&&(fe=A.instanceMatrix),k==="instanceColor"&&A.instanceColor&&(fe=A.instanceColor)),Q===void 0||Q.attribute!==fe||fe&&Q.data!==fe.data)return!0;ne++}return s.attributesNum!==ne||s.index!==Z}function y(A,F,j,Z){const $={},ae=F.attributes;let ne=0;const xe=j.getAttributes();for(const k in xe)if(xe[k].location>=0){let Q=ae[k];Q===void 0&&(k==="instanceMatrix"&&A.instanceMatrix&&(Q=A.instanceMatrix),k==="instanceColor"&&A.instanceColor&&(Q=A.instanceColor));const fe={};fe.attribute=Q,Q&&Q.data&&(fe.data=Q.data),$[k]=fe,ne++}s.attributes=$,s.attributesNum=ne,s.index=Z}function M(){const A=s.newAttributes;for(let F=0,j=A.length;F<j;F++)A[F]=0}function x(A){v(A,0)}function v(A,F){const j=s.newAttributes,Z=s.enabledAttributes,$=s.attributeDivisors;j[A]=1,Z[A]===0&&(r.enableVertexAttribArray(A),Z[A]=1),$[A]!==F&&(r.vertexAttribDivisor(A,F),$[A]=F)}function w(){const A=s.newAttributes,F=s.enabledAttributes;for(let j=0,Z=F.length;j<Z;j++)F[j]!==A[j]&&(r.disableVertexAttribArray(j),F[j]=0)}function E(A,F,j,Z,$,ae,ne){ne===!0?r.vertexAttribIPointer(A,F,j,$,ae):r.vertexAttribPointer(A,F,j,Z,$,ae)}function T(A,F,j,Z){M();const $=Z.attributes,ae=j.getAttributes(),ne=F.defaultAttributeValues;for(const xe in ae){const k=ae[xe];if(k.location>=0){let ee=$[xe];if(ee===void 0&&(xe==="instanceMatrix"&&A.instanceMatrix&&(ee=A.instanceMatrix),xe==="instanceColor"&&A.instanceColor&&(ee=A.instanceColor)),ee!==void 0){const Q=ee.normalized,fe=ee.itemSize,Se=e.get(ee);if(Se===void 0)continue;
vendor: 6,542 bytes, line 3574
3574const ke=Se.buffer,le=Se.type,Ie=Se.bytesPerElement,Pe=le===r.INT||le===r.UNSIGNED_INT||ee.gpuType===Tl;if(ee.isInterleavedBufferAttribute){const Be=ee.data,nt=Be.stride,Et=ee.offset;if(Be.isInstancedInterleavedBuffer){for(let dt=0;dt<k.locationSize;dt++)v(k.location+dt,Be.meshPerAttribute);A.isInstancedMesh!==!0&&Z._maxInstanceCount===void 0&&(Z._maxInstanceCount=Be.meshPerAttribute*Be.count)}else for(let dt=0;dt<k.locationSize;dt++)x(k.location+dt);r.bindBuffer(r.ARRAY_BUFFER,ke);for(let dt=0;dt<k.locationSize;dt++)E(k.location+dt,fe/k.locationSize,le,Q,nt*Ie,(Et+fe/k.locationSize*dt)*Ie,Pe)}else{if(ee.isInstancedBufferAttribute){for(let Be=0;Be<k.locationSize;Be++)v(k.location+Be,ee.meshPerAttribute);A.isInstancedMesh!==!0&&Z._maxInstanceCount===void 0&&(Z._maxInstanceCount=ee.meshPerAttribute*ee.count)}else for(let Be=0;Be<k.locationSize;Be++)x(k.location+Be);r.bindBuffer(r.ARRAY_BUFFER,ke);for(let Be=0;Be<k.locationSize;Be++)E(k.location+Be,fe/k.locationSize,le,Q,fe*Ie,fe/k.locationSize*Be*Ie,Pe)}}else if(ne!==void 0){const Q=ne[xe];if(Q!==void 0)switch(Q.length){case 2:r.vertexAttrib2fv(k.location,Q);break;case 3:r.vertexAttrib3fv(k.location,Q);break;case 4:r.vertexAttrib4fv(k.location,Q);break;default:r.vertexAttrib1fv(k.location,Q)}}}}w()}function U(){D();for(const A in n){const F=n[A];for(const j in F){const Z=F[j];for(const $ in Z)f(Z[$].object),delete Z[$];delete F[j]}delete n[A]}}function I(A){if(n[A.id]===void 0)return;const F=n[A.id];for(const j in F){const Z=F[j];for(const $ in Z)f(Z[$].object),delete Z[$];delete F[j]}delete n[A.id]}function N(A){for(const F in n){const j=n[F];if(j[A.id]===void 0)continue;const Z=j[A.id];for(const $ in Z)f(Z[$].object),delete Z[$];delete j[A.id]}}function D(){C(),o=!0,s!==i&&(s=i,h(s.object))}function C(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:c,reset:D,resetDefaultState:C,dispose:U,releaseStatesOfGeometry:I,releaseStatesOfProgram:N,initAttributes:M,enableAttribute:x,disableUnusedAttributes:w}}function Ob(r,e,t){let n;function i(h){n=h}function s(h,f){r.drawArrays(n,h,f),t.update(f,n,1)}function o(h,f,d){d!==0&&(r.drawArraysInstanced(n,h,f,d),t.update(f,n,d))}function c(h,f,d){if(d===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,h,0,f,0,d);let g=0;for(let y=0;y<d;y++)g+=f[y];t.update(g,n,1)}function u(h,f,d,m){if(d===0)return;const g=e.get("WEBGL_multi_draw");if(g===null)for(let y=0;y<h.length;y++)o(h[y],f[y],m[y]);else{g.multiDrawArraysInstancedWEBGL(n,h,0,f,0,m,0,d);let y=0;for(let M=0;M<d;M++)y+=f[M]*m[M];t.update(y,n,1)}}this.setMode=i,this.render=s,this.renderInstances=o,this.renderMultiDraw=c,this.renderMultiDrawInstances=u}function Bb(r,e,t,n){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const N=e.get("EXT_texture_filter_anisotropic");i=r.getParameter(N.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function o(N){return!(N!==En&&n.convert(N)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_FORMAT))}function c(N){const D=N===Bn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(N!==oi&&n.convert(N)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_TYPE)&&N!==pn&&!D)}function u(N){if(N==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";N="mediump"}return N==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let h=t.precision!==void 0?t.precision:"highp";const f=u(h);f!==h&&(console.warn("THREE.WebGLRenderer:",h,"not supported, using",f,"instead."),h=f);const d=t.logarithmicDepthBuffer===!0,m=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),g=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),y=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),M=r.getParameter(r.MAX_TEXTURE_SIZE),x=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),v=r.getParameter(r.MAX_VERTEX_ATTRIBS),w=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),E=r.getParameter(r.MAX_VARYING_VECTORS),T=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),U=y>0,I=r.getParameter(r.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:u,textureFormatReadable:o,textureTypeReadable:c,precision:h,logarithmicDepthBuffer:d,reverseDepthBuffer:m,maxTextures:g,maxVertexTextures:y,maxTextureSize:M,maxCubemapSize:x,maxAttributes:v,maxVertexUniforms:w,maxVaryings:E,maxFragmentUniforms:T,vertexTextures:U,maxSamples:I}}function zb(r){const e=this;let t=null,n=0,i=!1,s=!1;const o=new Pr,c=new Ut,u={value:null,needsUpdate:!1};this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(d,m){const g=d.length!==0||m||n!==0||i;return i=m,n=d.length,g},this.beginShadows=function(){s=!0,f(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(d,m){t=f(d,m,0)},this.setState=function(d,m,g){const y=d.clippingPlanes,M=d.clipIntersection,x=d.clipShadows,v=r.get(d);if(!i||y===null||y.length===0||s&&!x)s?f(null):h();else{const w=s?0:n,E=w*4;let T=v.clippingState||null;u.value=T,T=f(y,m,E,g);for(let U=0;U!==E;++U)T[U]=t[U];v.clippingState=T,this.numIntersection=M?this.numPlanes:0,this.numPlanes+=w}};function h(){u.value!==t&&(u.value=t,u.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function f(d,m,g,y){const M=d!==null?d.length:0;let x=null;if(M!==0){if(x=u.value,y!==!0||x===null){const v=g+M*4,w=m.matrixWorldInverse;c.getNormalMatrix(w),(x===null||x.length<v)&&(x=new Float32Array(v));for(let E=0,T=g;E!==M;++E,T+=4)o.copy(d[E]).applyMatrix4(w,c),o.normal.toArray(x,T),x[T+3]=o.constant}u.value=x,u.needsUpdate=!0}return e.numPlanes=M,e.numIntersection=0,x}}function kb(r){let e=new WeakMap;function t(o,c){return c===Jo?o.mapping=dr:c===rl&&(o.mapping=cs),o}function n(o){if(o&&o.isTexture){const c=o.mapping;if(c===Jo||c===rl)if(e.has(o)){const u=e.get(o).texture;return t(u,o.mapping)}else{const u=o.image;if(u&&u.height>0){const h=new Np(u.height);return h.fromEquirectangularTexture(r,o),e.set(o,h),o.addEventListener("dispose",i),t(h.texture,o.mapping)}else return null}}return o}function i(o){const c=o.target;c.removeEventListener("dispose",i);const u=e.get(c);u!==void 0&&(e.delete(c),u.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}const Xo=4,o0=[.125,.215,.35,.446,.526,.582],Gs=20,Fd=new Fr,a0=new rt;let Od=null,Bd=0,zd=0,kd=!1;const Vs=(1+Math.sqrt(5))/2,Bo=1/Vs,l0=[new B(-Vs,Bo,0),new B(Vs,Bo,0),new B(-Bo,0,Vs),new B(Bo,0,Vs),new B(0,Vs,-Bo),new B(0,Vs,Bo),new B(-1,
vendor: 8,463 bytes, lines 3574-3649
35741,-1),new B(1,1,-1),new B(-1,1,1),new B(1,1,1)],Hb=new B;class gp{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100,s={}){const{size:o=256,position:c=Hb}=s;Od=this._renderer.getRenderTarget(),Bd=this._renderer.getActiveCubeFace(),zd=this._renderer.getActiveMipmapLevel(),kd=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);const u=this._allocateTargets();return u.depthBuffer=!0,this._sceneToCubeUV(e,n,i,u,c),t>0&&this._blur(u,0,0,t),this._applyPMREM(u),this._cleanup(u),u}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=h0(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=u0(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.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._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Od,Bd,zd),this._renderer.xr.enabled=kd,e.scissorTest=!1,yu(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===dr||e.mapping===cs?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Od=this._renderer.getRenderTarget(),Bd=this._renderer.getActiveCubeFace(),zd=this._renderer.getActiveMipmapLevel(),kd=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:tn,minFilter:tn,generateMipmaps:!1,type:Bn,format:En,colorSpace:mr,depthBuffer:!1},i=c0(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=c0(e,t,n);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=Vb(s)),this._blurMaterial=Gb(s,e,t)}return i}_compileMaterial(e){const t=new mn(this._lodPlanes[0],e);this._renderer.compile(t,Fd)}_sceneToCubeUV(e,t,n,i,s){const u=new wn(90,1,t,n),h=[1,-1,1,1,1,1],f=[1,1,1,-1,-1,-1],d=this._renderer,m=d.autoClear,g=d.toneMapping;d.getClearColor(a0),d.toneMapping=fr,d.autoClear=!1;const y=new Br({name:"PMREM.Background",side:si,depthWrite:!1,depthTest:!1}),M=new mn(new no,y);let x=!1;const v=e.background;v?v.isColor&&(y.color.copy(v),e.background=null,x=!0):(y.color.copy(a0),x=!0);for(let w=0;w<6;w++){const E=w%3;E===0?(u.up.set(0,h[w],0),u.position.set(s.x,s.y,s.z),u.lookAt(s.x+f[w],s.y,s.z)):E===1?(u.up.set(0,0,h[w]),u.position.set(s.x,s.y,s.z),u.lookAt(s.x,s.y+f[w],s.z)):(u.up.set(0,h[w],0),u.position.set(s.x,s.y,s.z),u.lookAt(s.x,s.y,s.z+f[w]));const T=this._cubeSize;yu(i,E*T,w>2?T:0,T,T),d.setRenderTarget(i),x&&d.render(M,u),d.render(e,u)}M.geometry.dispose(),M.material.dispose(),d.toneMapping=g,d.autoClear=m,e.background=v}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===dr||e.mapping===cs;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=h0()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=u0());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new mn(this._lodPlanes[0],s),c=s.uniforms;c.envMap.value=e;const u=this._cubeSize;yu(t,0,0,3*u,2*u),n.setRenderTarget(t),n.render(o,Fd)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;s<i;s++){const o=Math.sqrt(this._sigmas[s]*this._sigmas[s]-this._sigmas[s-1]*this._sigmas[s-1]),c=l0[(i-s-1)%l0.length];this._blur(e,s-1,s,o,c)}t.autoClear=n}_blur(e,t,n,i,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,n,i,"latitudinal",s),this._halfBlur(o,e,n,n,i,"longitudinal",s)}_halfBlur(e,t,n,i,s,o,c){const u=this._renderer,h=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const f=3,d=new mn(this._lodPlanes[i],h),m=h.uniforms,g=this._sizeLods[n]-1,y=isFinite(s)?Math.PI/(2*g):2*Math.PI/(2*Gs-1),M=s/y,x=isFinite(s)?1+Math.floor(f*M):Gs;x>Gs&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${x} samples when the maximum is set to ${Gs}`);const v=[];let w=0;for(let N=0;N<Gs;++N){const D=N/M,C=Math.exp(-D*D/2);v.push(C),N===0?w+=C:N<x&&(w+=2*C)}for(let N=0;N<v.length;N++)v[N]=v[N]/w;m.envMap.value=e.texture,m.samples.value=x,m.weights.value=v,m.latitudinal.value=o==="latitudinal",c&&(m.poleAxis.value=c);const{_lodMax:E}=this;m.dTheta.value=y,m.mipInt.value=E-n;const T=this._sizeLods[i],U=3*T*(i>E-Xo?i-E+Xo:0),I=4*(this._cubeSize-T);yu(t,U,I,3*T,2*T),u.setRenderTarget(t),u.render(d,Fd)}}function Vb(r){const e=[],t=[],n=[];let i=r;const s=r-Xo+1+o0.length;for(let o=0;o<s;o++){const c=Math.pow(2,i);t.push(c);let u=1/c;o>r-Xo?u=o0[o-r+Xo-1]:o===0&&(u=0),n.push(u);const h=1/(c-2),f=-h,d=1+h,m=[f,f,d,f,d,d,f,f,d,d,f,d],g=6,y=6,M=3,x=2,v=1,w=new Float32Array(M*y*g),E=new Float32Array(x*y*g),T=new Float32Array(v*y*g);for(let I=0;I<g;I++){const N=I%3*2/3-1,D=I>2?0:-1,C=[N,D,0,N+2/3,D,0,N+2/3,D+1,0,N,D,0,N+2/3,D+1,0,N,D+1,0];w.set(C,M*y*I),E.set(m,x*y*I);const A=[I,I,I,I,I,I];T.set(A,v*y*I)}const U=new zt;U.setAttribute("position",new nn(w,M)),U.setAttribute("uv",new nn(E,x)),U.setAttribute("faceIndex",new nn(T,v)),e.push(U),i>Xo&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function c0(r,e,t){const n=new zi(r,e,t);return n.texture.mapping=aa,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function yu(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function Gb(r,e,t){const n=new Float32Array(Gs),i=new B(0,1,0);return new gi({name:"SphericalGaussianBlur",defines:{n:Gs,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:am(),fragmentShader:` 3575 3576 precision mediump float; 3577 precision mediump int; 3578 3579 varying vec3 vOutputDirection; 3580 3581 uniform sampler2D envMap; 3582 uniform int samples; 3583 uniform float weights[ n ]; 3584 uniform bool latitudinal; 3585 uniform float dTheta; 3586 uniform float mipInt; 3587 uniform vec3 poleAxis; 3588 3589 #define ENVMAP_TYPE_CUBE_UV 3590 #include <cube_uv_reflection_fragment> 3591 3592 vec3 getSample( float theta, vec3 axis ) { 3593 3594 float cosTheta = cos( theta ); 3595 // Rodrigues' axis-angle rotation 3596 vec3 sampleDirection = vOutputDirection * cosTheta 3597 + cross( axis, vOutputDirection ) * sin( theta ) 3598 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 3599 3600 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 3601 3602 } 3603 3604 void main() { 3605 3606 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 3607 3608 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 3609 3610 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 3611 3612 } 3613 3614 axis = normalize( axis ); 3615 3616 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 3617 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 3618 3619 for ( int i = 1; i < n; i++ ) { 3620 3621 if ( i >= samples ) { 3622 3623 break; 3624 3625 } 3626 3627 float theta = dTheta * float( i ); 3628 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 3629 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 3630 3631 } 3632 3633 } 3634 `,blending:hr,depthTest:!1,depthWrite:!1})}function u0(){return new gi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:am(),fragmentShader:` 3635 3636 precision mediump float; 3637 precision mediump int; 3638 3639 varying vec3 vOutputDirection; 3640 3641 uniform sampler2D envMap; 3642 3643 #include <common> 3644 3645 void main() { 3646 3647 vec3 outputDirection = normalize( vOutputDirection ); 3648 vec2 uv = equirectUv( outputDirection ); 3649
3650 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3651 3652 } 3653 `,blending:hr,depthTest:!1,depthWrite:!1})}function h0(){return new gi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:am(),fragmentShader:` 3654 3655 precision mediump float; 3656 precision mediump int; 3657 3658 uniform float flipEnvMap; 3659 3660 varying vec3 vOutputDirection; 3661 3662 uniform samplerCube envMap; 3663 3664 void main() { 3665 3666 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3667 3668 } 3669 `,blending:hr,depthTest:!1,depthWrite:!1})}function am(){return` 3670 3671 precision mediump float; 3672 precision mediump int; 3673 3674 attribute float faceIndex; 3675 3676 varying vec3 vOutputDirection; 3677 3678 // RH coordinate system; PMREM face-indexing convention 3679 vec3 getDirection( vec2 uv, float face ) { 3680 3681 uv = 2.0 * uv - 1.0; 3682 3683 vec3 direction = vec3( uv, 1.0 ); 3684 3685 if ( face == 0.0 ) { 3686 3687 direction = direction.zyx; // ( 1, v, u ) pos x 3688 3689 } else if ( face == 1.0 ) { 3690 3691 direction = direction.xzy; 3692 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3693 3694 } else if ( face == 2.0 ) { 3695 3696 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3697 3698 } else if ( face == 3.0 ) { 3699 3700 direction = direction.zyx; 3701 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3702 3703 } else if ( face == 4.0 ) { 3704 3705 direction = direction.xzy; 3706 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3707 3708 } else if ( face == 5.0 ) { 3709 3710 direction.z *= -1.0; // ( u, v, -1 ) neg z 3711 3712 } 3713 3714 return direction; 3715 3716 } 3717 3718 void main() { 3719 3720 vOutputDirection = getDirection( uv, faceIndex ); 3721 gl_Position = vec4( position, 1.0 ); 3722 3723 } 3724 `}function Wb(r){let e=new WeakMap,t=null;function n(c){if(c&&c.isTexture){const u=c.mapping,h=u===Jo||u===rl,f=u===dr||u===cs;if(h||f){let d=e.get(c);const m=d!==void 0?d.texture.pmremVersion:0;if(c.isRenderTargetTexture&&c.pmremVersion!==m)return t===null&&(t=new gp(r)),d=h?t.fromEquirectangular(c,d):t.fromCubemap(c,d),d.texture.pmremVersion=c.pmremVersion,e.set(c,d),d.texture;if(d!==void 0)return d.texture;{const g=c.image;return h&&g&&g.height>0||f&&g&&i(g)?(t===null&&(t=new gp(r)),d=h?t.fromEquirectangular(c):t.fromCubemap(c),d.texture.pmremVersion=c.pmremVersion,e.set(c,d),c.addEventListener("dispose",s),d.texture):null}}}return c}function i(c){let u=0;const h=6;for(let f=0;f<h;f++)c[f]!==void 0&&u++;return u===h}function s(c){const u=c.target;u.removeEventListener("dispose",s);const h=e.get(u);h!==void 0&&(e.delete(u),h.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:n,dispose:o}}function Xb(r){const e={};function t(n){if(e[n]!==void 0)return e[n];let i;switch(n){case"WEBGL_depth_texture":i=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=r.getExtension(n)}return 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&&qo("THREE.WebGLRenderer: "+n+" extension not supported."),i}}}function Yb(r,e,t,n){const i={},s=new WeakMap;function o(d){const m=d.target;m.index!==null&&e.remove(m.index);for(const y in m.attributes)e.remove(m.attributes[y]);m.removeEventListener("dispose",o),delete i[m.id];const g=s.get(m);g&&(e.remove(g),s.delete(m)),n.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,t.memory.geometries--}function c(d,m){return i[m.id]===!0||(m.addEventListener("dispose",o),i[m.id]=!0,t.memory.geometries++),m}function u(d){const m=d.attributes;for(const g in m)e.update(m[g],r.ARRAY_BUFFER)}function h(d){const m=[],g=d.index,y=d.attributes.position;let M=0;if(g!==null){const w=g.array;
vendor: 18,434 bytes, lines 3724-3759
3724M=g.version;for(let E=0,T=w.length;E<T;E+=3){const U=w[E+0],I=w[E+1],N=w[E+2];m.push(U,I,I,N,N,U)}}else if(y!==void 0){const w=y.array;M=y.version;for(let E=0,T=w.length/3-1;E<T;E+=3){const U=E+0,I=E+1,N=E+2;m.push(U,I,I,N,N,U)}}else return;const x=new(k_(m)?Up:Dp)(m,1);x.version=M;const v=s.get(d);v&&e.remove(v),s.set(d,x)}function f(d){const m=s.get(d);if(m){const g=d.index;g!==null&&m.version<g.version&&h(d)}else h(d);return s.get(d)}return{get:c,update:u,getWireframeAttribute:f}}function qb(r,e,t){let n;function i(m){n=m}let s,o;function c(m){s=m.type,o=m.bytesPerElement}function u(m,g){r.drawElements(n,g,s,m*o),t.update(g,n,1)}function h(m,g,y){y!==0&&(r.drawElementsInstanced(n,g,s,m*o,y),t.update(g,n,y))}function f(m,g,y){if(y===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,g,0,s,m,0,y);let x=0;for(let v=0;v<y;v++)x+=g[v];t.update(x,n,1)}function d(m,g,y,M){if(y===0)return;const x=e.get("WEBGL_multi_draw");if(x===null)for(let v=0;v<m.length;v++)h(m[v]/o,g[v],M[v]);else{x.multiDrawElementsInstancedWEBGL(n,g,0,s,m,0,M,0,y);let v=0;for(let w=0;w<y;w++)v+=g[w]*M[w];t.update(v,n,1)}}this.setMode=i,this.setIndex=c,this.render=u,this.renderInstances=h,this.renderMultiDraw=f,this.renderMultiDrawInstances=d}function Zb(r){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,o,c){switch(t.calls++,o){case r.TRIANGLES:t.triangles+=c*(s/3);break;case r.LINES:t.lines+=c*(s/2);break;case r.LINE_STRIP:t.lines+=c*(s-1);break;case r.LINE_LOOP:t.lines+=c*s;break;case r.POINTS:t.points+=c*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);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 jb(r,e,t){const n=new WeakMap,i=new jt;function s(o,c,u){const h=o.morphTargetInfluences,f=c.morphAttributes.position||c.morphAttributes.normal||c.morphAttributes.color,d=f!==void 0?f.length:0;let m=n.get(c);if(m===void 0||m.count!==d){let C=function(){N.dispose(),n.delete(c),c.removeEventListener("dispose",C)};m!==void 0&&m.texture.dispose();const g=c.morphAttributes.position!==void 0,y=c.morphAttributes.normal!==void 0,M=c.morphAttributes.color!==void 0,x=c.morphAttributes.position||[],v=c.morphAttributes.normal||[],w=c.morphAttributes.color||[];let E=0;g===!0&&(E=1),y===!0&&(E=2),M===!0&&(E=3);let T=c.attributes.position.count*E,U=1;T>e.maxTextureSize&&(U=Math.ceil(T/e.maxTextureSize),T=e.maxTextureSize);const I=new Float32Array(T*U*4*d),N=new Eh(I,T,U,d);N.type=pn,N.needsUpdate=!0;const D=E*4;for(let A=0;A<d;A++){const F=x[A],j=v[A],Z=w[A],$=T*U*4*A;for(let ae=0;ae<F.count;ae++){const ne=ae*D;g===!0&&(i.fromBufferAttribute(F,ae),I[$+ne+0]=i.x,I[$+ne+1]=i.y,I[$+ne+2]=i.z,I[$+ne+3]=0),y===!0&&(i.fromBufferAttribute(j,ae),I[$+ne+4]=i.x,I[$+ne+5]=i.y,I[$+ne+6]=i.z,I[$+ne+7]=0),M===!0&&(i.fromBufferAttribute(Z,ae),I[$+ne+8]=i.x,I[$+ne+9]=i.y,I[$+ne+10]=i.z,I[$+ne+11]=Z.itemSize===4?i.w:1)}}m={count:d,texture:N,size:new we(T,U)},n.set(c,m),c.addEventListener("dispose",C)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)u.getUniforms().setValue(r,"morphTexture",o.morphTexture,t);else{let g=0;for(let M=0;M<h.length;M++)g+=h[M];const y=c.morphTargetsRelative?1:1-g;u.getUniforms().setValue(r,"morphTargetBaseInfluence",y),u.getUniforms().setValue(r,"morphTargetInfluences",h)}u.getUniforms().setValue(r,"morphTargetsTexture",m.texture,t),u.getUniforms().setValue(r,"morphTargetsTextureSize",m.size)}return{update:s}}function Jb(r,e,t,n){let i=new WeakMap;function s(u){const h=n.render.frame,f=u.geometry,d=e.get(u,f);if(i.get(d)!==h&&(e.update(d),i.set(d,h)),u.isInstancedMesh&&(u.hasEventListener("dispose",c)===!1&&u.addEventListener("dispose",c),i.get(u)!==h&&(t.update(u.instanceMatrix,r.ARRAY_BUFFER),u.instanceColor!==null&&t.update(u.instanceColor,r.ARRAY_BUFFER),i.set(u,h))),u.isSkinnedMesh){const m=u.skeleton;i.get(m)!==h&&(m.update(),i.set(m,h))}return d}function o(){i=new WeakMap}function c(u){const h=u.target;h.removeEventListener("dispose",c),t.remove(h.instanceMatrix),h.instanceColor!==null&&t.remove(h.instanceColor)}return{update:s,dispose:o}}const Xy=new sn,f0=new zp(1,1),Yy=new Eh,qy=new Th,Zy=new Rl,d0=[],p0=[],m0=new Float32Array(16),g0=new Float32Array(9),v0=new Float32Array(4);function ca(r,e,t){const n=r[0];if(n<=0||n>0)return r;const i=e*t;let s=d0[i];if(s===void 0&&(s=new Float32Array(i),d0[i]=s),e!==0){n.toArray(s,0);for(let o=1,c=0;o!==e;++o)c+=t,r[o].toArray(s,c)}return s}function Pn(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t<n;t++)if(r[t]!==e[t])return!1;return!0}function Ln(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function Yh(r,e){let t=p0[e];t===void 0&&(t=new Int32Array(e),p0[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function Kb(r,e){const t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function Qb(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Pn(t,e))return;r.uniform2fv(this.addr,e),Ln(t,e)}}function $b(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Pn(t,e))return;r.uniform3fv(this.addr,e),Ln(t,e)}}function eA(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Pn(t,e))return;r.uniform4fv(this.addr,e),Ln(t,e)}}function tA(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(Pn(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),Ln(t,e)}else{if(Pn(t,n))return;v0.set(n),r.uniformMatrix2fv(this.addr,!1,v0),Ln(t,n)}}function nA(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(Pn(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),Ln(t,e)}else{if(Pn(t,n))return;g0.set(n),r.uniformMatrix3fv(this.addr,!1,g0),Ln(t,n)}}function iA(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(Pn(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),Ln(t,e)}else{if(Pn(t,n))return;m0.set(n),r.uniformMatrix4fv(this.addr,!1,m0),Ln(t,n)}}function rA(r,e){const t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function sA(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Pn(t,e))return;r.uniform2iv(this.addr,e),Ln(t,e)}}function oA(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Pn(t,e))return;r.uniform3iv(this.addr,e),Ln(t,e)}}function aA(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Pn(t,e))return;r.uniform4iv(this.addr,e),Ln(t,e)}}function lA(r,e){const t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function cA(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Pn(t,e))return;r.uniform2uiv(this.addr,e),Ln(t,e)}}function uA(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Pn(t,e))return;r.uniform3uiv(this.addr,e),Ln(t,e)}}function hA(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Pn(t,e))return;r.uniform4uiv(this.addr,e),Ln(t,e)}}function fA(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i);let s;this.type===r.SAMPLER_2D_SHADOW?(f0.compareFunction=Ip,s=f0):s=Xy,t.setTexture2D(e||s,i)}function dA(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||qy,i)}function pA(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||Zy,i)}function mA(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||Yy,i)}function gA(r){switch(r){case 5126:return Kb;case 35664:return Qb;case 35665:return $b;case 35666:return eA;case 35674:return tA;case 35675:return nA;case 35676:return iA;case 5124:case 35670:return rA;case 35667:case 35671:return sA;case 35668:case 35672:return oA;case 35669:case 35673:return aA;case 5125:return lA;case 36294:return cA;case 36295:return uA;case 36296:return hA;case 35678:case 36198:case 36298:case 36306:case 35682:return fA;case 35679:case 36299:case 36307:return dA;case 35680:case 36300:case 36308:case 36293:return pA;case 36289:case 36303:case 36311:case 36292:return mA}}function vA(r,e){r.uniform1fv(this.addr,e)}function _A(r,e){const t=ca(e,this.size,2);r.uniform2fv(this.addr,t)}function yA(r,e){const t=ca(e,this.size,3);r.uniform3fv(this.addr,t)}function xA(r,e){const t=ca(e,this.size,4);r.uniform4fv(this.addr,t)}function SA(r,e){const t=ca(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function MA(r,e){const t=ca(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function wA(r,e){const t=ca(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function EA(r,e){r.uniform1iv(this.addr,e)}function TA(r,e){r.uniform2iv(this.addr,e)}function bA(r,e){r.uniform3iv(this.addr,e)}function AA(r,e){r.uniform4iv(this.addr,e)}function CA(r,e){r.uniform1uiv(this.addr,e)}function RA(r,e){r.uniform2uiv(this.addr,e)}function IA(r,e){r.uniform3uiv(this.addr,e)}function PA(r,e){r.uniform4uiv(this.addr,e)}function LA(r,e,t){const n=this.cache,i=e.length,s=Yh(t,i);Pn(n,s)||(r.uniform1iv(this.addr,s),Ln(n,s));for(let o=0;o!==i;++o)t.setTexture2D(e[o]||Xy,s[o])}function DA(r,e,t){const n=this.cache,i=e.length,s=Yh(t,i);Pn(n,s)||(r.uniform1iv(this.addr,s),Ln(n,s));for(let o=0;o!==i;++o)t.setTexture3D(e[o]||qy,s[o])}function UA(r,e,t){const n=this.cache,i=e.length,s=Yh(t,i);Pn(n,s)||(r.uniform1iv(this.addr,s),Ln(n,s));for(let o=0;o!==i;++o)t.setTextureCube(e[o]||Zy,s[o])}function NA(r,e,t){const n=this.cache,i=e.length,s=Yh(t,i);Pn(n,s)||(r.uniform1iv(this.addr,s),Ln(n,s));for(let o=0;o!==i;++o)t.setTexture2DArray(e[o]||Yy,s[o])}function FA(r){switch(r){case 5126:return vA;case 35664:return _A;case 35665:return yA;case 35666:return xA;case 35674:return SA;case 35675:return MA;case 35676:return wA;case 5124:case 35670:return EA;case 35667:case 35671:return TA;case 35668:case 35672:return bA;case 35669:case 35673:return AA;case 5125:return CA;case 36294:return RA;case 36295:return IA;case 36296:return PA;case 35678:case 36198:case 36298:case 36306:case 35682:return LA;case 35679:case 36299:case 36307:return DA;case 35680:case 36300:case 36308:case 36293:return UA;case 36289:case 36303:case 36311:case 36292:return NA}}class OA{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=gA(t.type)}}class BA{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=FA(t.type)}}class zA{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let s=0,o=i.length;s!==o;++s){const c=i[s];c.setValue(e,t[c.id],n)}}}const Hd=/(\w+)(\])?(\[|\.)?/g;function _0(r,e){r.seq.push(e),r.map[e.id]=e}function kA(r,e,t){const n=r.name,i=n.length;for(Hd.lastIndex=0;;){const s=Hd.exec(n),o=Hd.lastIndex;let c=s[1];const u=s[2]==="]",h=s[3];if(u&&(c=c|0),h===void 0||h==="["&&o+2===i){_0(t,h===void 0?new OA(c,r,e):new BA(c,r,e));break}else{let d=t.map[c];d===void 0&&(d=new zA(c),_0(t,d)),t=d}}}class Cu{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const s=e.getActiveUniform(t,i),o=e.getUniformLocation(t,s.name);kA(s,o,this)}}setValue(e,t,n,i){const s=this.map[t];s!==void 0&&s.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let s=0,o=t.length;s!==o;++s){const c=t[s],u=n[c.id];u.needsUpdate!==!1&&c.setValue(e,u.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,s=e.length;i!==s;++i){const o=e[i];o.id in t&&n.push(o)}return n}}function y0(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const HA=37297;let VA=0;function GA(r,e){const t=r.split(` 3725`),n=[],i=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=i;o<s;o++){const c=o+1;n.push(`${c===e?">":" "} ${c}: ${t[o]}`)}return n.join(` 3726`)}const x0=new Ut;function WA(r){qt._getMatrix(x0,qt.workingColorSpace,r);const e=`mat3( ${x0.elements.map(t=>t.toFixed(4))} )`;switch(qt.getTransfer(r)){case cl:return[e,"LinearTransferOETF"];case en:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function S0(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),i=r.getShaderInfoLog(e).trim();if(n&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` 3727 3728`+i+` 3729 3730`+GA(r.getShaderSource(e),o)}else return i}function XA(r,e){const t=WA(e);return[`vec4 ${r}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` 3731`)}function YA(r,e){let t;switch(e){case x_:t="Linear";break;case S_:t="Reinhard";break;case M_:t="Cineon";break;case Mp:t="ACESFilmic";break;case E_:t="AgX";break;case T_:t="Neutral";break;case w_:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const xu=new B;function qA(){qt.getLuminanceCoefficients(xu);const r=xu.x.toFixed(4),e=xu.y.toFixed(4),t=xu.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${r}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` 3732`)}function ZA(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Ya).join(` 3733`)}function jA(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` 3734`)}function JA(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const s=r.getActiveAttrib(e,i),o=s.name;let c=1;s.type===r.FLOAT_MAT2&&(c=2),s.type===r.FLOAT_MAT3&&(c=3),s.type===r.FLOAT_MAT4&&(c=4),t[o]={type:s.type,location:r.getAttribLocation(e,o),locationSize:c}}return t}function Ya(r){return r!==""}function M0(r,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return r.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function w0(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const KA=/^[ \t]*#include +<([\w\d./]+)>/gm;function vp(r){return r.replace(KA,$A)}const QA=new Map;function $A(r,e){let t=kt[e];if(t===void 0){const n=QA.get(e);if(n!==void 0)t=kt[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return vp(t)}const eC=/#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 E0(r){return r.replace(eC,tC)}function tC(r,e,t,n){let i="";for(let s=parseInt(e);s<parseInt(t);s++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function T0(r){let e=`precision ${r.precision} float; 3735 precision ${r.precision} int; 3736 precision ${r.precision} sampler2D; 3737 precision ${r.precision} samplerCube; 3738 precision ${r.precision} sampler3D; 3739 precision ${r.precision} sampler2DArray; 3740 precision ${r.precision} sampler2DShadow; 3741 precision ${r.precision} samplerCubeShadow; 3742 precision ${r.precision} sampler2DArrayShadow; 3743 precision ${r.precision} isampler2D; 3744 precision ${r.precision} isampler3D; 3745 precision ${r.precision} isamplerCube; 3746 precision ${r.precision} isampler2DArray; 3747 precision ${r.precision} usampler2D; 3748 precision ${r.precision} usampler3D; 3749 precision ${r.precision} usamplerCube; 3750 precision ${r.precision} usampler2DArray; 3751 `;return r.precision==="highp"?e+=` 3752#define HIGH_PRECISION`:r.precision==="mediump"?e+=` 3753#define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=` 3754#define LOW_PRECISION`),e}function nC(r){let e="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===gh?e="SHADOWMAP_TYPE_PCF":r.shadowMapType===qa?e="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===qi&&(e="SHADOWMAP_TYPE_VSM"),e}function iC(r){let e="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case dr:case cs:e="ENVMAP_TYPE_CUBE";break;case aa:e="ENVMAP_TYPE_CUBE_UV";break}return e}function rC(r){let e="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case cs:e="ENVMAP_MODE_REFRACTION";break}return e}function sC(r){let e="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case El:e="ENVMAP_BLENDING_MULTIPLY";break;case __:e="ENVMAP_BLENDING_MIX";break;case y_:e="ENVMAP_BLENDING_ADD";break}return e}function oC(r){const e=r.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:n,maxMip:t}}function aC(r,e,t,n){const i=r.getContext(),s=t.defines;let o=t.vertexShader,c=t.fragmentShader;const u=nC(t),h=iC(t),f=rC(t),d=sC(t),m=oC(t),g=ZA(t),y=jA(s),M=i.createProgram();let x,v,w=t.glslVersion?"#version "+t.glslVersion+` 3755`:"";t.isRawShaderMaterial?(x=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y].filter(Ya).join(` 3756`),x.length>0&&(x+=` 3757`),v=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y].filter(Ya).join(` 3758`),v.length>0&&(v+=` 3759`)):(x=[T0(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y,t.extensionCl
vendor: 6,454 bytes, lines 3759-3761
3759ipCullDistance?"#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 "+f:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+u:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` 3760`].filter(Ya).join(` 3761`),v=[T0(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,y,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 "+h:"",t.envMap?"#define "+f:"",t.envMap?"#define "+d:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IR
3761IDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+u:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==fr?"#define TONE_MAPPING":"",t.toneMapping!==fr?kt.tonemapping_pars_fragment:"",t.toneMapping!==fr?YA("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",kt.colorspace_pars_fragment,XA("linearToOutputTexel",t.outputColorSpace),qA(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` 3762`].filter(Ya).join(` 3763`)),o=vp(o),o=M0(o,t),o=w0(o,t),c=vp(c),c=M0(c,t),c=w0(c,t),o=E0(o),c=E0(c),t.isRawShaderMaterial!==!0&&(w=`#version 300 es 3764`,x=[g,"#define attribute in","#define varying out","#define texture2D texture"].join(` 3765`)+` 3766`+x,v=["#define varying in",t.glslVersion===ap?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===ap?"":"#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(` 3767`)+` 3768`+v);const E=w+x+o,T=w+v+c,U=y0(i,i.VERTEX_SHADER,E),I=y0(i,i.FRAGMENT_SHADER,T);i.attachShader(M,U),i.attachShader(M,I),t.index0AttributeName!==void 0?i.bindAttribLocation(M,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(M,0,"position"),i.linkProgram(M);function N(F){if(r.debug.checkShaderErrors){const j=i.getProgramInfoLog(M).trim(),Z=i.getShaderInfoLog(U).trim(),$=i.getShaderInfoLog(I).trim();let ae=!0,ne=!0;if(i.getProgramParameter(M,i.LINK_STATUS)===!1)if(ae=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,M,U,I);else{const xe=S0(i,U,"vertex"),k=S0(i,I,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(M,i.VALIDATE_STATUS)+` 3769 3770Material Name: `+F.name+` 3771Material Type: `+F.type+` 3772 3773Program Info Log: `+j+` 3774`+xe+` 3775`+k)}else j!==""?console.warn("THREE.WebGLProgram: Program Info Log:",j):(Z===""||$==="")&&(ne=!1);ne&&(F.diagnostics={runnable:ae,programLog:j,vertexShader:{log:Z,prefix:x},fragmentShader:{log:$,prefix:v}})}i.deleteShader(U),i.deleteShader(I),D=new Cu(i,M),C=JA(i,M)}let D;this.getUniforms=function(){return D===void 0&&N(this),D};let C;this.getAttributes=function(){return C===void 0&&N(this),C};let A=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return A===!1&&(A=i.getProgramParameter(
vendor: 8,982 bytes, line 3775
3775M,HA)),A},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(M),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=VA++,this.cacheKey=e,this.usedTimes=1,this.program=M,this.vertexShader=U,this.fragmentShader=I,this}let lC=0;class cC{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new uC(e),t.set(e,n)),n}}class uC{constructor(e){this.id=lC++,this.code=e,this.usedTimes=0}}function hC(r,e,t,n,i,s,o){const c=new Ks,u=new cC,h=new Set,f=[],d=i.logarithmicDepthBuffer,m=i.vertexTextures;let g=i.precision;const y={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function M(C){return h.add(C),C===0?"uv":`uv${C}`}function x(C,A,F,j,Z){const $=j.fog,ae=Z.geometry,ne=C.isMeshStandardMaterial?j.environment:null,xe=(C.isMeshStandardMaterial?t:e).get(C.envMap||ne),k=xe&&xe.mapping===aa?xe.image.height:null,ee=y[C.type];C.precision!==null&&(g=i.getMaxPrecision(C.precision),g!==C.precision&&console.warn("THREE.WebGLProgram.getParameters:",C.precision,"not supported, using",g,"instead."));const Q=ae.morphAttributes.position||ae.morphAttributes.normal||ae.morphAttributes.color,fe=Q!==void 0?Q.length:0;let Se=0;ae.morphAttributes.position!==void 0&&(Se=1),ae.morphAttributes.normal!==void 0&&(Se=2),ae.morphAttributes.color!==void 0&&(Se=3);let ke,le,Ie,Pe;if(ee){const Ht=Zi[ee];ke=Ht.vertexShader,le=Ht.fragmentShader}else ke=C.vertexShader,le=C.fragmentShader,u.update(C),Ie=u.getVertexShaderID(C),Pe=u.getFragmentShaderID(C);const Be=r.getRenderTarget(),nt=r.state.buffers.depth.getReversed(),Et=Z.isInstancedMesh===!0,dt=Z.isBatchedMesh===!0,Nt=!!C.map,It=!!C.matcap,pt=!!xe,z=!!C.aoMap,Ve=!!C.lightMap,Ue=!!C.bumpMap,We=!!C.normalMap,Me=!!C.displacementMap,et=!!C.emissiveMap,Ne=!!C.metalnessMap,it=!!C.roughnessMap,wt=C.anisotropy>0,H=C.clearcoat>0,L=C.dispersion>0,se=C.iridescence>0,me=C.sheen>0,be=C.transmission>0,ge=wt&&!!C.anisotropyMap,st=H&&!!C.clearcoatMap,Ye=H&&!!C.clearcoatNormalMap,ot=H&&!!C.clearcoatRoughnessMap,lt=se&&!!C.iridescenceMap,Ae=se&&!!C.iridescenceThicknessMap,Xe=me&&!!C.sheenColorMap,vt=me&&!!C.sheenRoughnessMap,X=!!C.specularMap,re=!!C.specularColorMap,Ce=!!C.specularIntensityMap,W=be&&!!C.transmissionMap,oe=be&&!!C.thicknessMap,Te=!!C.gradientMap,Je=!!C.alphaMap,ze=C.alphaTest>0,Ee=!!C.alphaHash,Ke=!!C.extensions;let _t=fr;C.toneMapped&&(Be===null||Be.isXRRenderTarget===!0)&&(_t=r.toneMapping);const Yt={shaderID:ee,shaderType:C.type,shaderName:C.name,vertexShader:ke,fragmentShader:le,defines:C.defines,customVertexShaderID:Ie,customFragmentShaderID:Pe,isRawShaderMaterial:C.isRawShaderMaterial===!0,glslVersion:C.glslVersion,precision:g,batching:dt,batchingColor:dt&&Z._colorsTexture!==null,instancing:Et,instancingColor:Et&&Z.instanceColor!==null,instancingMorph:Et&&Z.morphTexture!==null,supportsVertexTextures:m,outputColorSpace:Be===null?r.outputColorSpace:Be.isXRRenderTarget===!0?Be.texture.colorSpace:mr,alphaToCoverage:!!C.alphaToCoverage,map:Nt,matcap:It,envMap:pt,envMapMode:pt&&xe.mapping,envMapCubeUVHeight:k,aoMap:z,lightMap:Ve,bumpMap:Ue,normalMap:We,displacementMap:m&&Me,emissiveMap:et,normalMapObjectSpace:We&&C.normalMapType===L_,normalMapTangentSpace:We&&C.normalMapType===hs,metalnessMap:Ne,roughnessMap:it,anisotropy:wt,anisotropyMap:ge,clearcoat:H,clearcoatMap:st,clearcoatNormalMap:Ye,clearcoatRoughnessMap:ot,dispersion:L,iridescence:se,iridescenceMap:lt,iridescenceThicknessMap:Ae,sheen:me,sheenColorMap:Xe,sheenRoughnessMap:vt,specularMap:X,specularColorMap:re,specularIntensityMap:Ce,transmission:be,transmissionMap:W,thicknessMap:oe,gradientMap:Te,opaque:C.transparent===!1&&C.blending===js&&C.alphaToCoverage===!1,alphaMap:Je,alphaTest:ze,alphaHash:Ee,combine:C.combine,mapUv:Nt&&M(C.map.channel),aoMapUv:z&&M(C.aoMap.channel),lightMapUv:Ve&&M(C.lightMap.channel),bumpMapUv:Ue&&M(C.bumpMap.channel),normalMapUv:We&&M(C.normalMap.channel),displacementMapUv:Me&&M(C.displacementMap.channel),emissiveMapUv:et&&M(C.emissiveMap.channel),metalnessMapUv:Ne&&M(C.metalnessMap.channel),roughnessMapUv:it&&M(C.roughnessMap.channel),anisotropyMapUv:ge&&M(C.anisotropyMap.channel),clearcoatMapUv:st&&M(C.clearcoatMap.channel),clearcoatNormalMapUv:Ye&&M(C.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ot&&M(C.clearcoatRoughnessMap.channel),iridescenceMapUv:lt&&M(C.iridescenceMap.channel),iridescenceThicknessMapUv:Ae&&M(C.iridescenceThicknessMap.channel),sheenColorMapUv:Xe&&M(C.sheenColorMap.channel),sheenRoughnessMapUv:vt&&M(C.sheenRoughnessMap.channel),specularMapUv:X&&M(C.specularMap.channel),specularColorMapUv:re&&M(C.specularColorMap.channel),specularIntensityMapUv:Ce&&M(C.specularIntensityMap.channel),transmissionMapUv:W&&M(C.transmissionMap.channel),thicknessMapUv:oe&&M(C.thicknessMap.channel),alphaMapUv:Je&&M(C.alphaMap.channel),vertexTangents:!!ae.attributes.tangent&&(We||wt),vertexColors:C.vertexColors,vertexAlphas:C.vertexColors===!0&&!!ae.attributes.color&&ae.attributes.color.itemSize===4,pointsUvs:Z.isPoints===!0&&!!ae.attributes.uv&&(Nt||Je),fog:!!$,useFog:C.fog===!0,fogExp2:!!$&&$.isFogExp2,flatShading:C.flatShading===!0,sizeAttenuation:C.sizeAttenuation===!0,logarithmicDepthBuffer:d,reverseDepthBuffer:nt,skinning:Z.isSkinnedMesh===!0,morphTargets:ae.morphAttributes.position!==void 0,morphNormals:ae.morphAttributes.normal!==void 0,morphColors:ae.morphAttributes.color!==void 0,morphTargetsCount:fe,morphTextureStride:Se,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,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:C.dithering,shadowMapEnabled:r.shadowMap.enabled&&F.length>0,shadowMapType:r.shadowMap.type,toneMapping:_t,decodeVideoTexture:Nt&&C.map.isVideoTexture===!0&&qt.getTransfer(C.map.colorSpace)===en,decodeVideoTextureEmissive:et&&C.emissiveMap.isVideoTexture===!0&&qt.getTransfer(C.emissiveMap.colorSpace)===en,premultipliedAlpha:C.premultipliedAlpha,doubleSided:C.side===ji,flipSided:C.side===si,useDepthPacking:C.depthPacking>=0,depthPacking:C.depthPacking||0,index0AttributeName:C.index0AttributeName,extensionClipCullDistance:Ke&&C.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ke&&C.extensions.multiDraw===!0||dt)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:C.customProgramCacheKey()};return Yt.vertexUv1s=h.has(1),Yt.vertexUv2s=h.has(2),Yt.vertexUv3s=h.has(3),h.clear(),Yt}function v(C){const A=[];if(C.shaderID?A.push(C.shaderID):(A.push(C.customVertexShaderID),A.push(C.customFragmentShaderID)),C.defines!==void 0)for(const F in C.defines)A.push(F),A.push(C.defines[F]);return C.isRawShaderMaterial===!1&&(w(A,C),E(A,C),A.push(r.outputColorSpace)),A.push(C.customProgramCacheKey),A.join()}function w(C,A){C.push(A.precision),C.push(A.outputColorSpace),C.push(A.envMapMode),C.push(A.envMapCubeUVHeight),C.push(A.mapUv),C.push(A.alphaMapUv),C.push(A.lightMapUv),C.push(A.aoMapUv),C.push(A.bumpMapUv),C.push(A.normalMapUv),C.push(A.displacementMapUv),C.push(A.emissiveMapUv),C.push(A.metalnessMapUv),C.push(A.roughnessMapUv),C.push(A.anisotropyMapUv),C.push(A.clearcoatMapUv),C.push(A.clearcoatNormalMapUv),C.push(A.clearcoatRoughnessMapUv),C.push(A.iridescenceMapUv),C.push(A.iridescenceThicknessMapUv),C.push(A.sheenColorMapUv),C.push(A.sheenRoughnessMapUv),C.push(A.specularMapUv),C.push(A.specularColorMapUv),C.push(A.specularIntensityMapUv),C.push(A.transmissionMapUv),C.push(A.thicknessMapUv),C.push(A.comb
3775ine),C.push(A.fogExp2),C.push(A.sizeAttenuation),C.push(A.morphTargetsCount),C.push(A.morphAttributeCount),C.push(A.numDirLights),C.push(A.numPointLights),C.push(A.numSpotLights),C.push(A.numSpotLightMaps),C.push(A.numHemiLights),C.push(A.numRectAreaLights),C.push(A.numDirLightShadows),C.push(A.numPointLightShadows),C.push(A.numSpotLightShadows),C.push(A.numSpotLightShadowsWithMaps),C.push(A.numLightProbes),C.push(A.shadowMapType),C.push(A.toneMapping),C.push(A.numClippingPlanes),C.push(A.numClipIntersection),C.push(A.depthPacking)}function E(C,A){c.disableAll(),A.supportsVertexTextures&&c.enable(0),A.instancing&&c.enable(1),A.instancingColor&&c.enable(2),A.instancingMorph&&c.enable(3),A.matcap&&c.enable(4),A.envMap&&c.enable(5),A.normalMapObjectSpace&&c.enable(6),A.normalMapTangentSpace&&c.enable(7),A.clearcoat&&c.enable(8),A.iridescence&&c.enable(9),A.alphaTest&&c.enable(10),A.vertexColors&&c.enable(11),A.vertexAlphas&&c.enable(12),A.vertexUv1s&&c.enable(13),A.vertexUv2s&&c.enable(14),A.vertexUv3s&&c.enable(15),A.vertexTangents&&c.enable(16),A.anisotropy&&
vendor: 13,099 bytes, lines 3775-3803
3775c.enable(17),A.alphaHash&&c.enable(18),A.batching&&c.enable(19),A.dispersion&&c.enable(20),A.batchingColor&&c.enable(21),C.push(c.mask),c.disableAll(),A.fog&&c.enable(0),A.useFog&&c.enable(1),A.flatShading&&c.enable(2),A.logarithmicDepthBuffer&&c.enable(3),A.reverseDepthBuffer&&c.enable(4),A.skinning&&c.enable(5),A.morphTargets&&c.enable(6),A.morphNormals&&c.enable(7),A.morphColors&&c.enable(8),A.premultipliedAlpha&&c.enable(9),A.shadowMapEnabled&&c.enable(10),A.doubleSided&&c.enable(11),A.flipSided&&c.enable(12),A.useDepthPacking&&c.enable(13),A.dithering&&c.enable(14),A.transmission&&c.enable(15),A.sheen&&c.enable(16),A.opaque&&c.enable(17),A.pointsUvs&&c.enable(18),A.decodeVideoTexture&&c.enable(19),A.decodeVideoTextureEmissive&&c.enable(20),A.alphaToCoverage&&c.enable(21),C.push(c.mask)}function T(C){const A=y[C.type];let F;if(A){const j=Zi[A];F=X_.clone(j.uniforms)}else F=C.uniforms;return F}function U(C,A){let F;for(let j=0,Z=f.length;j<Z;j++){const $=f[j];if($.cacheKey===A){F=$,++F.usedTimes;break}}return F===void 0&&(F=new aC(r,A,C,s),f.push(F)),F}function I(C){if(--C.usedTimes===0){const A=f.indexOf(C);f[A]=f[f.length-1],f.pop(),C.destroy()}}function N(C){u.remove(C)}function D(){u.dispose()}return{getParameters:x,getProgramCacheKey:v,getUniforms:T,acquireProgram:U,releaseProgram:I,releaseShaderCache:N,programs:f,dispose:D}}function fC(){let r=new WeakMap;function e(o){return r.has(o)}function t(o){let c=r.get(o);return c===void 0&&(c={},r.set(o,c)),c}function n(o){r.delete(o)}function i(o,c,u){r.get(o)[c]=u}function s(){r=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:s}}function dC(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.z!==e.z?r.z-e.z:r.id-e.id}function b0(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function A0(){const r=[];let e=0;const t=[],n=[],i=[];function s(){e=0,t.length=0,n.length=0,i.length=0}function o(d,m,g,y,M,x){let v=r[e];return v===void 0?(v={id:d.id,object:d,geometry:m,material:g,groupOrder:y,renderOrder:d.renderOrder,z:M,group:x},r[e]=v):(v.id=d.id,v.object=d,v.geometry=m,v.material=g,v.groupOrder=y,v.renderOrder=d.renderOrder,v.z=M,v.group=x),e++,v}function c(d,m,g,y,M,x){const v=o(d,m,g,y,M,x);g.transmission>0?n.push(v):g.transparent===!0?i.push(v):t.push(v)}function u(d,m,g,y,M,x){const v=o(d,m,g,y,M,x);g.transmission>0?n.unshift(v):g.transparent===!0?i.unshift(v):t.unshift(v)}function h(d,m){t.length>1&&t.sort(d||dC),n.length>1&&n.sort(m||b0),i.length>1&&i.sort(m||b0)}function f(){for(let d=e,m=r.length;d<m;d++){const g=r[d];if(g.id===null)break;g.id=null,g.object=null,g.geometry=null,g.material=null,g.group=null}}return{opaque:t,transmissive:n,transparent:i,init:s,push:c,unshift:u,finish:f,sort:h}}function pC(){let r=new WeakMap;function e(n,i){const s=r.get(n);let o;return s===void 0?(o=new A0,r.set(n,[o])):i>=s.length?(o=new A0,s.push(o)):o=s[i],o}function t(){r=new WeakMap}return{get:e,dispose:t}}function mC(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new B,color:new rt};break;case"SpotLight":t={position:new B,direction:new B,color:new rt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new B,color:new rt,distance:0,decay:0};break;case"HemisphereLight":t={direction:new B,skyColor:new rt,groundColor:new rt};break;case"RectAreaLight":t={color:new rt,position:new B,halfWidth:new B,halfHeight:new B};break}return r[e.id]=t,t}}}function gC(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new we};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new we};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new we,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let vC=0;function _C(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function yC(r){const e=new mC,t=gC(),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 h=0;h<9;h++)n.probe.push(new B);const i=new B,s=new bt,o=new bt;function c(h){let f=0,d=0,m=0;for(let C=0;C<9;C++)n.probe[C].set(0,0,0);let g=0,y=0,M=0,x=0,v=0,w=0,E=0,T=0,U=0,I=0,N=0;h.sort(_C);for(let C=0,A=h.length;C<A;C++){const F=h[C],j=F.color,Z=F.intensity,$=F.distance,ae=F.shadow&&F.shadow.map?F.shadow.map.texture:null;if(F.isAmbientLight)f+=j.r*Z,d+=j.g*Z,m+=j.b*Z;else if(F.isLightProbe){for(let ne=0;ne<9;ne++)n.probe[ne].addScaledVector(F.sh.coefficients[ne],Z);N++}else if(F.isDirectionalLight){const ne=e.get(F);if(ne.color.copy(F.color).multiplyScalar(F.intensity),F.castShadow){const xe=F.shadow,k=t.get(F);k.shadowIntensity=xe.intensity,k.shadowBias=xe.bias,k.shadowNormalBias=xe.normalBias,k.shadowRadius=xe.radius,k.shadowMapSize=xe.mapSize,n.directionalShadow[g]=k,n.directionalShadowMap[g]=ae,n.directionalShadowMatrix[g]=F.shadow.matrix,w++}n.directional[g]=ne,g++}else if(F.isSpotLight){const ne=e.get(F);ne.position.setFromMatrixPosition(F.matrixWorld),ne.color.copy(j).multiplyScalar(Z),ne.distance=$,ne.coneCos=Math.cos(F.angle),ne.penumbraCos=Math.cos(F.angle*(1-F.penumbra)),ne.decay=F.decay,n.spot[M]=ne;const xe=F.shadow;if(F.map&&(n.spotLightMap[U]=F.map,U++,xe.updateMatrices(F),F.castShadow&&I++),n.spotLightMatrix[M]=xe.matrix,F.castShadow){const k=t.get(F);k.shadowIntensity=xe.intensity,k.shadowBias=xe.bias,k.shadowNormalBias=xe.normalBias,k.shadowRadius=xe.radius,k.shadowMapSize=xe.mapSize,n.spotShadow[M]=k,n.spotShadowMap[M]=ae,T++}M++}else if(F.isRectAreaLight){const ne=e.get(F);ne.color.copy(j).multiplyScalar(Z),ne.halfWidth.set(F.width*.5,0,0),ne.halfHeight.set(0,F.height*.5,0),n.rectArea[x]=ne,x++}else if(F.isPointLight){const ne=e.get(F);if(ne.color.copy(F.color).multiplyScalar(F.intensity),ne.distance=F.distance,ne.decay=F.decay,F.castShadow){const xe=F.shadow,k=t.get(F);k.shadowIntensity=xe.intensity,k.shadowBias=xe.bias,k.shadowNormalBias=xe.normalBias,k.shadowRadius=xe.radius,k.shadowMapSize=xe.mapSize,k.shadowCameraNear=xe.camera.near,k.shadowCameraFar=xe.camera.far,n.pointShadow[y]=k,n.pointShadowMap[y]=ae,n.pointShadowMatrix[y]=F.shadow.matrix,E++}n.point[y]=ne,y++}else if(F.isHemisphereLight){const ne=e.get(F);ne.skyColor.copy(F.color).multiplyScalar(Z),ne.groundColor.copy(F.groundColor).multiplyScalar(Z),n.hemi[v]=ne,v++}}x>0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Qe.LTC_FLOAT_1,n.rectAreaLTC2=Qe.LTC_FLOAT_2):(n.rectAreaLTC1=Qe.LTC_HALF_1,n.rectAreaLTC2=Qe.LTC_HALF_2)),n.ambient[0]=f,n.ambient[1]=d,n.ambient[2]=m;const D=n.hash;(D.directionalLength!==g||D.pointLength!==y||D.spotLength!==M||D.rectAreaLength!==x||D.hemiLength!==v||D.numDirectionalShadows!==w||D.numPointShadows!==E||D.numSpotShadows!==T||D.numSpotMaps!==U||D.numLightProbes!==N)&&(n.directional.length=g,n.spot.length=M,n.rectArea.length=x,n.point.length=y,n.hemi.length=v,n.directionalShadow.length=w,n.directionalShadowMap.length=w,n.pointShadow.length=E,n.pointShadowMap.length=E,n.spotShadow.length=T,n.spotShadowMap.length=T,n.directionalShadowMatrix.length=w,n.pointShadowMatrix.length=E,n.spotLightMatrix.length=T+U-I,n.spotLightMap.length=U,n.numSpotLightShadowsWithMaps=I,n.numLightProbes=N,D.directionalLength=g,D.pointLength=y,D.spotLength=M,D.rectAreaLength=x,D.hemiLength=v,D.numDirectionalShadows=w,D.numPointShadows=E,D.numSpotShadows=T,D.numSpotMaps=U,D.numLightProbes=N,n.version=vC++)}function u(h,f){let d=0,m=0,g=0,y=0,M=0;const x=f.matrixWorldInverse;for(let v=0,w=h.length;v<w;v++){const E=h[v];if(E.isDirectionalLight){const T=n.directional[d];T.direction.setFromMatrixPosition(E.matrixWorld),i.setFromMatrixPosition(E.target.matrixWorld),T.direction.sub(i),T.direction.transformDirection(x),d++}else if(E.isSpotLight){const T=n.spot[g];T.position.setFromMatrixPosition(E.matrixWorld),T.position.applyMatrix4(x),T.direction.setFromMatrixPosition(E.matrixWorld),i.setFromMatrixPosition(E.target.matrixWorld),T.direction.sub(i),T.direction.transformDirection(x),g++}else if(E.isRectAreaLight){const T=n.rectArea[y];T.position.setFromMatrixPosition(E.matrixWorld),T.position.applyMatrix4(x),o.identity(),s.copy(E.matrixWorld),s.premultiply(x),o.extractRotation(s),T.halfWidth.set(E.width*.5,0,0),T.halfHeight.set(0,E.height*.5,0),T.halfWidth.applyMatrix4(o),T.halfHeight.applyMatrix4(o),y++}else if(E.isPointLight){const T=n.point[m];T.position.setFromMatrixPosition(E.matrixWorld),T.position.applyMatrix4(x),m++}else if(E.isHemisphereLight){const T=n.hemi[M];T.direction.setFromMatrixPosition(E.matrixWorld),T.direction.transformDirection(x),M++}}}return{setup:c,setupView:u,state:n}}function C0(r){const e=new yC(r),t=[],n=[];function i(f){h.camera=f,t.length=0,n.length=0}function s(f){t.push(f)}function o(f){n.push(f)}function c(){e.setup(t)}function u(f){e.setupView(t,f)}const h={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:h,setupLights:c,setupLightsView:u,pushLight:s,pushShadow:o}}function xC(r){let e=new WeakMap;function t(i,s=0){const o=e.get(i);let c;return o===void 0?(c=new C0(r),e.set(i,[c])):s>=o.length?(c=new C0(r),o.push(c)):c=o[s],c}function n(){e=new WeakMap}return{get:t,dispose:n}}const SC=`void main() { 3776 gl_Position = vec4( position, 1.0 ); 3777}`,MC=`uniform sampler2D shadow_pass; 3778uniform vec2 resolution; 3779uniform float radius; 3780#include <packing> 3781void main() { 3782 const float samples = float( VSM_SAMPLES ); 3783 float mean = 0.0; 3784 float squared_mean = 0.0; 3785 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 3786 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 3787 for ( float i = 0.0; i < samples; i ++ ) { 3788 float uvOffset = uvStart + i * uvStride; 3789 #ifdef HORIZONTAL_PASS 3790 vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); 3791 mean += distribution.x; 3792 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 3793 #else 3794 float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); 3795 mean += depth; 3796 squared_mean += depth * depth; 3797 #endif 3798 } 3799 mean = mean / samples; 3800 squared_mean = squared_mean / samples; 3801 float std_dev = sqrt( squared_mean - mean * mean ); 3802 gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); 3803}`;function wC(r,e,t){let n=new la;const i=new we,s=new we,o=new jt,c=new qp({depthPacking:P_}),u=new Zp,h={},f=t.maxTextureSize,d={[Or]:si,[si]:Or,[ji]:ji},m=new gi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new we},radius:{value:4}},vertexShader:SC,fragmentShader:MC}),g=m.clone();g.defines.HORIZONTAL_PASS=1;const y=new zt;y.setAttribute("position",new nn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const M=new mn(y,m),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=gh;let v=this.type;this.render=function(I,N,D){if(x.enabled===!1||x.autoUpdate===!1&&x.needsUpdate===!1||I.length===0)return;const C=r.getRenderTarget(),A=r.getActiveCubeFace(),F=r.getActiveMipmapLevel(),j=r.state;j.setBlending(hr),j.buffers.color.setClear(1,1,1,1),j.buffers.depth.setTest(!0),j.setScissorTest(!1);const Z=v!==qi&&this.type===qi,$=v===qi&&this.type!==qi;for(let ae=0,ne=I.length;ae<ne;ae++){const xe=I[ae],k=xe.shadow;if(k===void 0){console.warn("THREE.WebGLShadowMap:",xe,"has no shadow.");continue}if(k.autoUpdate===!1&&k.needsUpdate===!1)continue;i.copy(k.mapSize);const ee=k.getFrameExtents();if(i.multiply(ee),s.copy(k.mapSize),(i.x>f||i.y>f)&&(i.x>f&&(s.x=Math.floor(f/ee.x),i.x=s.x*ee.x,k.mapSize.x=s.x),i.y>f&&(s.y=Math.floor(f/ee.y),i.y=s.y*ee.y,k.mapSize.y=s.y)),k.map===null||Z===!0||$===!0){const fe=this.type!==qi?{minFilter:kn,magFilter:kn}:{};k.map!==null&&k.map.dispose(),k.map=new zi(i.x,i.y,fe),k.map.texture.name=xe.name+".shadowMap",k.camera.updateProjectionMatrix()}r.setRenderTarget(k.map),r.clear();const Q=k.getViewportCount();for(let fe=0;fe<Q;fe++){const Se=k.getViewport(fe);o.set(s.x*Se.x,s.y*Se.y,s.x*Se.z,s.y*Se.w),j.viewport(o),k.updateMatrices(xe,fe),n=k.getFrustum(),T(N,D,k.camera,xe,this.type)}k.isPointLightShadow!==!0&&this.type===qi&&w(k,D),k.needsUpdate=!1}v=this.type,x.needsUpdate=!1,r.setRenderTarget(C,A,F)};function w(I,N){const D=e.update(M);
vendor: 8,376 bytes, line 3803
3803m.defines.VSM_SAMPLES!==I.blurSamples&&(m.defines.VSM_SAMPLES=I.blurSamples,g.defines.VSM_SAMPLES=I.blurSamples,m.needsUpdate=!0,g.needsUpdate=!0),I.mapPass===null&&(I.mapPass=new zi(i.x,i.y)),m.uniforms.shadow_pass.value=I.map.texture,m.uniforms.resolution.value=I.mapSize,m.uniforms.radius.value=I.radius,r.setRenderTarget(I.mapPass),r.clear(),r.renderBufferDirect(N,null,D,m,M,null),g.uniforms.shadow_pass.value=I.mapPass.texture,g.uniforms.resolution.value=I.mapSize,g.uniforms.radius.value=I.radius,r.setRenderTarget(I.map),r.clear(),r.renderBufferDirect(N,null,D,g,M,null)}function E(I,N,D,C){let A=null;const F=D.isPointLight===!0?I.customDistanceMaterial:I.customDepthMaterial;if(F!==void 0)A=F;else if(A=D.isPointLight===!0?u:c,r.localClippingEnabled&&N.clipShadows===!0&&Array.isArray(N.clippingPlanes)&&N.clippingPlanes.length!==0||N.displacementMap&&N.displacementScale!==0||N.alphaMap&&N.alphaTest>0||N.map&&N.alphaTest>0||N.alphaToCoverage===!0){const j=A.uuid,Z=N.uuid;let $=h[j];$===void 0&&($={},h[j]=$);let ae=$[Z];ae===void 0&&(ae=A.clone(),$[Z]=ae,N.addEventListener("dispose",U)),A=ae}if(A.visible=N.visible,A.wireframe=N.wireframe,C===qi?A.side=N.shadowSide!==null?N.shadowSide:N.side:A.side=N.shadowSide!==null?N.shadowSide:d[N.side],A.alphaMap=N.alphaMap,A.alphaTest=N.alphaToCoverage===!0?.5:N.alphaTest,A.map=N.map,A.clipShadows=N.clipShadows,A.clippingPlanes=N.clippingPlanes,A.clipIntersection=N.clipIntersection,A.displacementMap=N.displacementMap,A.displacementScale=N.displacementScale,A.displacementBias=N.displacementBias,A.wireframeLinewidth=N.wireframeLinewidth,A.linewidth=N.linewidth,D.isPointLight===!0&&A.isMeshDistanceMaterial===!0){const j=r.properties.get(A);j.light=D}return A}function T(I,N,D,C,A){if(I.visible===!1)return;if(I.layers.test(N.layers)&&(I.isMesh||I.isLine||I.isPoints)&&(I.castShadow||I.receiveShadow&&A===qi)&&(!I.frustumCulled||n.intersectsObject(I))){I.modelViewMatrix.multiplyMatrices(D.matrixWorldInverse,I.matrixWorld);const Z=e.update(I),$=I.material;if(Array.isArray($)){const ae=Z.groups;for(let ne=0,xe=ae.length;ne<xe;ne++){const k=ae[ne],ee=$[k.materialIndex];if(ee&&ee.visible){const Q=E(I,ee,C,A);I.onBeforeShadow(r,I,N,D,Z,Q,k),r.renderBufferDirect(D,null,Z,Q,I,k),I.onAfterShadow(r,I,N,D,Z,Q,k)}}}else if($.visible){const ae=E(I,$,C,A);I.onBeforeShadow(r,I,N,D,Z,ae,null),r.renderBufferDirect(D,null,Z,ae,I,null),I.onAfterShadow(r,I,N,D,Z,ae,null)}}const j=I.children;for(let Z=0,$=j.length;Z<$;Z++)T(j[Z],N,D,C,A)}function U(I){I.target.removeEventListener("dispose",U);for(const D in h){const C=h[D],A=I.target.uuid;A in C&&(C[A].dispose(),delete C[A])}}}const EC={[Lu]:Du,[Uu]:Ou,[Nu]:Bu,[Qs]:Fu,[Du]:Lu,[Ou]:Uu,[Bu]:Nu,[Fu]:Qs};function TC(r,e){function t(){let W=!1;const oe=new jt;let Te=null;const Je=new jt(0,0,0,0);return{setMask:function(ze){Te!==ze&&!W&&(r.colorMask(ze,ze,ze,ze),Te=ze)},setLocked:function(ze){W=ze},setClear:function(ze,Ee,Ke,_t,Yt){Yt===!0&&(ze*=_t,Ee*=_t,Ke*=_t),oe.set(ze,Ee,Ke,_t),Je.equals(oe)===!1&&(r.clearColor(ze,Ee,Ke,_t),Je.copy(oe))},reset:function(){W=!1,Te=null,Je.set(-1,0,0,0)}}}function n(){let W=!1,oe=!1,Te=null,Je=null,ze=null;return{setReversed:function(Ee){if(oe!==Ee){const Ke=e.get("EXT_clip_control");Ee?Ke.clipControlEXT(Ke.LOWER_LEFT_EXT,Ke.ZERO_TO_ONE_EXT):Ke.clipControlEXT(Ke.LOWER_LEFT_EXT,Ke.NEGATIVE_ONE_TO_ONE_EXT),oe=Ee;const _t=ze;ze=null,this.setClear(_t)}},getReversed:function(){return oe},setTest:function(Ee){Ee?Be(r.DEPTH_TEST):nt(r.DEPTH_TEST)},setMask:function(Ee){Te!==Ee&&!W&&(r.depthMask(Ee),Te=Ee)},setFunc:function(Ee){if(oe&&(Ee=EC[Ee]),Je!==Ee){switch(Ee){case Lu:r.depthFunc(r.NEVER);break;case Du:r.depthFunc(r.ALWAYS);break;case Uu:r.depthFunc(r.LESS);break;case Qs:r.depthFunc(r.LEQUAL);break;case Nu:r.depthFunc(r.EQUAL);break;case Fu:r.depthFunc(r.GEQUAL);break;case Ou:r.depthFunc(r.GREATER);break;case Bu:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}Je=Ee}},setLocked:function(Ee){W=Ee},setClear:function(Ee){ze!==Ee&&(oe&&(Ee=1-Ee),r.clearDepth(Ee),ze=Ee)},reset:function(){W=!1,Te=null,Je=null,ze=null,oe=!1}}}function i(){let W=!1,oe=null,Te=null,Je=null,ze=null,Ee=null,Ke=null,_t=null,Yt=null;return{setTest:function(Ht){W||(Ht?Be(r.STENCIL_TEST):nt(r.STENCIL_TEST))},setMask:function(Ht){oe!==Ht&&!W&&(r.stencilMask(Ht),oe=Ht)},setFunc:function(Ht,gn,Dn){(Te!==Ht||Je!==gn||ze!==Dn)&&(r.stencilFunc(Ht,gn,Dn),Te=Ht,Je=gn,ze=Dn)},setOp:function(Ht,gn,Dn){(Ee!==Ht||Ke!==gn||_t!==Dn)&&(r.stencilOp(Ht,gn,Dn),Ee=Ht,Ke=gn,_t=Dn)},setLocked:function(Ht){W=Ht},setClear:function(Ht){Yt!==Ht&&(r.clearStencil(Ht),Yt=Ht)},reset:function(){W=!1,oe=null,Te=null,Je=null,ze=null,Ee=null,Ke=null,_t=null,Yt=null}}}const s=new t,o=new n,c=new i,u=new WeakMap,h=new WeakMap;let f={},d={},m=new WeakMap,g=[],y=null,M=!1,x=null,v=null,w=null,E=null,T=null,U=null,I=null,N=new rt(0,0,0),D=0,C=!1,A=null,F=null,j=null,Z=null,$=null;const ae=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let ne=!1,xe=0;const k=r.getParameter(r.VERSION);k.indexOf("WebGL")!==-1?(xe=parseFloat(/^WebGL (\d)/.exec(k)[1]),ne=xe>=1):k.indexOf("OpenGL ES")!==-1&&(xe=parseFloat(/^OpenGL ES (\d)/.exec(k)[1]),ne=xe>=2);let ee=null,Q={};const fe=r.getParameter(r.SCISSOR_BOX),Se=r.getParameter(r.VIEWPORT),ke=new jt().fromArray(fe),le=new jt().fromArray(Se);function Ie(W,oe,Te,Je){const ze=new Uint8Array(4),Ee=r.createTexture();r.bindTexture(W,Ee),r.texParameteri(W,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(W,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let Ke=0;Ke<Te;Ke++)W===r.TEXTURE_3D||W===r.TEXTURE_2D_ARRAY?r.texImage3D(oe,0,r.RGBA,1,1,Je,0,r.RGBA,r.UNSIGNED_BYTE,ze):r.texImage2D(oe+Ke,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,ze);return Ee}const Pe={};Pe[r.TEXTURE_2D]=Ie(r.TEXTURE_2D,r.TEXTURE_2D,1),Pe[r.TEXTURE_CUBE_MAP]=Ie(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),Pe[r.TEXTURE_2D_ARRAY]=Ie(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),Pe[r.TEXTURE_3D]=Ie(r.TEXTURE_3D,r.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),c.setClear(0),Be(r.DEPTH_TEST),o.setFunc(Qs),Ue(!1),We(ep),Be(r.CULL_FACE),z(hr);function Be(W){f[W]!==!0&&(r.enable(W),f[W]=!0)}function nt(W){f[W]!==!1&&(r.disable(W),f[W]=!1)}function Et(W,oe){return d[W]!==oe?(r.bindFramebuffer(W,oe),d[W]=oe,W===r.DRAW_FRAMEBUFFER&&(d[r.FRAMEBUFFER]=oe),W===r.FRAMEBUFFER&&(d[r.DRAW_FRAMEBUFFER]=oe),!0):!1}function dt(W,oe){let Te=g,Je=!1;if(W){Te=m.get(oe),Te===void 0&&(Te=[],m.set(oe,Te));const ze=W.textures;if(Te.length!==ze.length||Te[0]!==r.COLOR_ATTACHMENT0){for(let Ee=0,Ke=ze.length;Ee<Ke;Ee++)Te[Ee]=r.COLOR_ATTACHMENT0+Ee;Te.length=ze.length,Je=!0}}else Te[0]!==r.BACK&&(Te[0]=r.BACK,Je=!0);Je&&r.drawBuffers(Te)}function Nt(W){return y!==W?(r.useProgram(W),y=W,!0):!1}const It={[rs]:r.FUNC_ADD,[t_]:r.FUNC_SUBTRACT,[n_]:r.FUNC_REVERSE_SUBTRACT};It[i_]=r.MIN,It[r_]=r.MAX;const pt={[s_]:r.ZERO,[o_]:r.ONE,[a_]:r.SRC_COLOR,[Iu]:r.SRC_ALPHA,[d_]:r.SRC_ALPHA_SATURATE,[h_]:r.DST_COLOR,[c_]:r.DST_ALPHA,[l_]:r.ONE_MINUS_SRC_COLOR,[Pu]:r.ONE_MINUS_SRC_ALPHA,[f_]:r.ONE_MINUS_DST_COLOR,[u_]:r.ONE_MINUS_DST_ALPHA,[p_]:r.CONSTANT_COLOR,[m_]:r.ONE_MINUS_CONSTANT_COLOR,[g_]:r.CONSTANT_ALPHA,[v_]:r.ONE_MINUS_CONSTANT_ALPHA};function z(W,oe,Te,Je,ze,Ee,Ke,_t,Yt,Ht){if(W===hr){M===!0&&(nt(r.BLEND),M=!1);return}if(M===!1&&(Be(r.BLEND),M=!0),W!==e_){if(W!==x||Ht!==C){if((v!==rs||T!==rs)&&(r.blendEquation(r.FUNC_ADD),v=rs,T=rs),Ht)switch(W){case js:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case tp:r.blendFunc(r.ONE,r.ONE);break;case np:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case ip:r.blendFuncSeparate(r.ZERO,r.SRC_COLOR,r.ZERO,r.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",W);break}else switch(W){case js:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case tp:r.blendFunc(r.SRC_ALPHA,r.ONE);break;case np:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case ip:r.blendFunc(r.ZERO,r.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",W);break}w=null,E=null,U=null,I=null,N.set(0,0,0),D=0,x=W,C=Ht}return}ze=ze||oe,Ee=Ee||Te,Ke=Ke||Je,(oe!==v||ze!==T)&&(r.blendEquationSeparate(It[oe],It[ze]),v=oe,T=ze),(Te!==w||Je!==E||Ee!==U||Ke!==I)&&(r.blendFuncSeparate(pt[Te],pt[Je],pt[Ee],pt[Ke]),w=Te,E=Je,U=Ee,I=Ke),(_t.equals(N)===!1||Yt!==D)&&(r.blendColor
vendor: 6,063 bytes, line 3803
3803(_t.r,_t.g,_t.b,Yt),N.copy(_t),D=Yt),x=W,C=!1}function Ve(W,oe){W.side===ji?nt(r.CULL_FACE):Be(r.CULL_FACE);let Te=W.side===si;oe&&(Te=!Te),Ue(Te),W.blending===js&&W.transparent===!1?z(hr):z(W.blending,W.blendEquation,W.blendSrc,W.blendDst,W.blendEquationAlpha,W.blendSrcAlpha,W.blendDstAlpha,W.blendColor,W.blendAlpha,W.premultipliedAlpha),o.setFunc(W.depthFunc),o.setTest(W.depthTest),o.setMask(W.depthWrite),s.setMask(W.colorWrite);const Je=W.stencilWrite;c.setTest(Je),Je&&(c.setMask(W.stencilWriteMask),c.setFunc(W.stencilFunc,W.stencilRef,W.stencilFuncMask),c.setOp(W.stencilFail,W.stencilZFail,W.stencilZPass)),et(W.polygonOffset,W.polygonOffsetFactor,W.polygonOffsetUnits),W.alphaToCoverage===!0?Be(r.SAMPLE_ALPHA_TO_COVERAGE):nt(r.SAMPLE_ALPHA_TO_COVERAGE)}function Ue(W){A!==W&&(W?r.frontFace(r.CW):r.frontFace(r.CCW),A=W)}function We(W){W!==K0?(Be(r.CULL_FACE),W!==F&&(W===ep?r.cullFace(r.BACK):W===Q0?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):nt(r.CULL_FACE),F=W}function Me(W){W!==j&&(ne&&r.lineWidth(W),j=W)}function et(W,oe,Te){W?(Be(r.POLYGON_OFFSET_FILL),(Z!==oe||$!==Te)&&(r.polygonOffset(oe,Te),Z=oe,$=Te)):nt(r.POLYGON_OFFSET_FILL)}function Ne(W){W?Be(r.SCISSOR_TEST):nt(r.SCISSOR_TEST)}function it(W){W===void 0&&(W=r.TEXTURE0+ae-1),ee!==W&&(r.activeTexture(W),ee=W)}function wt(W,oe,Te){Te===void 0&&(ee===null?Te=r.TEXTURE0+ae-1:Te=ee);let Je=Q[Te];Je===void 0&&(Je={type:void 0,texture:void 0},Q[Te]=Je),(Je.type!==W||Je.texture!==oe)&&(ee!==Te&&(r.activeTexture(Te),ee=Te),r.bindTexture(W,oe||Pe[W]),Je.type=W,Je.texture=oe)}function H(){const W=Q[ee];W!==void 0&&W.type!==void 0&&(r.bindTexture(W.type,null),W.type=void 0,W.texture=void 0)}function L(){try{r.compressedTexImage2D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function se(){try{r.compressedTexImage3D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function me(){try{r.texSubImage2D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function be(){try{r.texSubImage3D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function ge(){try{r.compressedTexSubImage2D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function st(){try{r.compressedTexSubImage3D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function Ye(){try{r.texStorage2D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function ot(){try{r.texStorage3D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function lt(){try{r.texImage2D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function Ae(){try{r.texImage3D(...arguments)}catch(W){console.error("THREE.WebGLState:",W)}}function Xe(W){ke.equals(W)===!1&&(r.scissor(W.x,W.y,W.z,W.w),ke.copy(W))}function vt(W){le.equals(W)===!1&&(r.viewport(W.x,W.y,W.z,W.w),le.copy(W))}function X(W,oe){let Te=h.get(oe);Te===void 0&&(Te=new WeakMap,h.set(oe,Te));let Je=Te.get(W);Je===void 0&&(Je=r.getUniformBlockIndex(oe,W.name),Te.set(W,Je))}function re(W,oe){const Je=h.get(oe).get(W);u.get(oe)!==Je&&(r.uniformBlockBinding(oe,Je,W.__bindingPointIndex),u.set(oe,Je))}function Ce(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),o.setReversed(!1),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),f={},ee=null,Q={},d={},m=new WeakMap,g=[],y=null,M=!1,x=null,v=null,w=null,E=null,T=null,U=null,I=null,N=new rt(0,0,0),D=0,C=!1,A=null,F=null,j=null,Z=null,$=null,ke.set(0,0,r.canvas.width,r.canvas.height),le.set(0,0,r.canvas.width,r.canvas.height),s.reset(),o.reset(),c.reset()}return{buffers:{color:s,depth:o,stencil:c},enable:Be,disable:nt,bindFramebuffer:Et,drawBuffers:dt,useProgram:Nt,setBlending:z,setMaterial:Ve,setFlipSided:Ue,setCullFace:We,setLineWidth:Me,setPolygonOffset:et,setScissorTest:Ne,activeTexture:it,bindTexture:wt,unbindTexture:H,compressedTexImage2D:L,compressedTexImage3D:se,texImage2D:lt,texImage3D:Ae,updateUBOMapping:X,uniformBlockBinding:re,texStorage2D:Ye,texStorage3D:ot,texSubImage2D:me,texSubImage3D:be,compressedTexSubImage2D:ge,compressedTexSubImage3D:st,scissor:Xe,viewport:vt,reset:Ce}}function bC(r,e,t,n,i,s,o){const c=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,u=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),h=new we,f=new WeakMap;let d;const m=new WeakMap;let g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(H,L){return g?new OffscreenCanvas(H,L):fl("canvas")}function M(H,L,se){let me=1;const be=wt(H);if((be.width>se||be.height>se)&&(me=se/Math.max(be.width,be.height)),me<1)if(typeof HTMLImageElement<"u"&&H instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&H instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&H instanceof ImageBitmap||typeof VideoFrame<"u"&&H instanceof VideoFrame){const ge=Math.floor(me*be.width),st=Math.floor(me*be.height);d===void 0&&(d=y(ge,st));const Ye=L?y(ge,st):d;return Ye.width=ge,Ye.height=st,Ye.getContext("2d").drawImage(H,0,0,ge,st),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+be.width+"x"+be.height+") to ("+ge+"x"+st+")."),Ye}else return"data"in H&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+be.width+"x"+be.height+")."),H;return H}function x(H){return H.generateMipmaps}function v(H){r.generateMipmap(H)}
vendor: 5,470 bytes, line 3803
3803function w(H){return H.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:H.isWebGL3DRenderTarget?r.TEXTURE_3D:H.isWebGLArrayRenderTarget||H.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function E(H,L,se,me,be=!1){if(H!==null){if(r[H]!==void 0)return r[H];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+H+"'")}let ge=L;if(L===r.RED&&(se===r.FLOAT&&(ge=r.R32F),se===r.HALF_FLOAT&&(ge=r.R16F),se===r.UNSIGNED_BYTE&&(ge=r.R8)),L===r.RED_INTEGER&&(se===r.UNSIGNED_BYTE&&(ge=r.R8UI),se===r.UNSIGNED_SHORT&&(ge=r.R16UI),se===r.UNSIGNED_INT&&(ge=r.R32UI),se===r.BYTE&&(ge=r.R8I),se===r.SHORT&&(ge=r.R16I),se===r.INT&&(ge=r.R32I)),L===r.RG&&(se===r.FLOAT&&(ge=r.RG32F),se===r.HALF_FLOAT&&(ge=r.RG16F),se===r.UNSIGNED_BYTE&&(ge=r.RG8)),L===r.RG_INTEGER&&(se===r.UNSIGNED_BYTE&&(ge=r.RG8UI),se===r.UNSIGNED_SHORT&&(ge=r.RG16UI),se===r.UNSIGNED_INT&&(ge=r.RG32UI),se===r.BYTE&&(ge=r.RG8I),se===r.SHORT&&(ge=r.RG16I),se===r.INT&&(ge=r.RG32I)),L===r.RGB_INTEGER&&(se===r.UNSIGNED_BYTE&&(ge=r.RGB8UI),se===r.UNSIGNED_SHORT&&(ge=r.RGB16UI),se===r.UNSIGNED_INT&&(ge=r.RGB32UI),se===r.BYTE&&(ge=r.RGB8I),se===r.SHORT&&(ge=r.RGB16I),se===r.INT&&(ge=r.RGB32I)),L===r.RGBA_INTEGER&&(se===r.UNSIGNED_BYTE&&(ge=r.RGBA8UI),se===r.UNSIGNED_SHORT&&(ge=r.RGBA16UI),se===r.UNSIGNED_INT&&(ge=r.RGBA32UI),se===r.BYTE&&(ge=r.RGBA8I),se===r.SHORT&&(ge=r.RGBA16I),se===r.INT&&(ge=r.RGBA32I)),L===r.RGB&&se===r.UNSIGNED_INT_5_9_9_9_REV&&(ge=r.RGB9_E5),L===r.RGBA){const st=be?cl:qt.getTransfer(me);se===r.FLOAT&&(ge=r.RGBA32F),se===r.HALF_FLOAT&&(ge=r.RGBA16F),se===r.UNSIGNED_BYTE&&(ge=st===en?r.SRGB8_ALPHA8:r.RGBA8),se===r.UNSIGNED_SHORT_4_4_4_4&&(ge=r.RGBA4),se===r.UNSIGNED_SHORT_5_5_5_1&&(ge=r.RGB5_A1)}return(ge===r.R16F||ge===r.R32F||ge===r.RG16F||ge===r.RG32F||ge===r.RGBA16F||ge===r.RGBA32F)&&e.get("EXT_color_buffer_float"),ge}function T(H,L){let se;return H?L===null||L===pr||L===Qo?se=r.DEPTH24_STENCIL8:L===pn?se=r.DEPTH32F_STENCIL8:L===Ko&&(se=r.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):L===null||L===pr||L===Qo?se=r.DEPTH_COMPONENT24:L===pn?se=r.DEPTH_COMPONENT32F:L===Ko&&(se=r.DEPTH_COMPONENT16),se}function U(H,L){return x(H)===!0||H.isFramebufferTexture&&H.minFilter!==kn&&H.minFilter!==tn?Math.log2(Math.max(L.width,L.height))+1:H.mipmaps!==void 0&&H.mipmaps.length>0?H.mipmaps.length:H.isCompressedTexture&&Array.isArray(H.image)?L.mipmaps.length:1}function I(H){const L=H.target;L.removeEventListener("dispose",I),D(L),L.isVideoTexture&&f.delete(L)}function N(H){const L=H.target;L.removeEventListener("dispose",N),A(L)}function D(H){const L=n.get(H);if(L.__webglInit===void 0)return;const se=H.source,me=m.get(se);if(me){const be=me[L.__cacheKey];be.usedTimes--,be.usedTimes===0&&C(H),Object.keys(me).length===0&&m.delete(se)}n.remove(H)}function C(H){const L=n.get(H);r.deleteTexture(L.__webglTexture);const se=H.source,me=m.get(se);delete me[L.__cacheKey],o.memory.textures--}function A(H){const L=n.get(H);if(H.depthTexture&&(H.depthTexture.dispose(),n.remove(H.depthTexture)),H.isWebGLCubeRenderTarget)for(let me=0;me<6;me++){if(Array.isArray(L.__webglFramebuffer[me]))for(let be=0;be<L.__webglFramebuffer[me].length;be++)r.deleteFramebuffer(L.__webglFramebuffer[me][be]);else r.deleteFramebuffer(L.__webglFramebuffer[me]);L.__webglDepthbuffer&&r.deleteRenderbuffer(L.__webglDepthbuffer[me])}else{if(Array.isArray(L.__webglFramebuffer))for(let me=0;me<L.__webglFramebuffer.length;me++)r.deleteFramebuffer(L.__webglFramebuffer[me]);else r.deleteFramebuffer(L.__webglFramebuffer);if(L.__webglDepthbuffer&&r.deleteRenderbuffer(L.__webglDepthbuffer),L.__webglMultisampledFramebuffer&&r.deleteFramebuffer(L.__webglMultisampledFramebuffer),L.__webglColorRenderbuffer)for(let me=0;me<L.__webglColorRenderbuffer.length;me++)L.__webglColorRenderbuffer[me]&&r.deleteRenderbuffer(L.__webglColorRenderbuffer[me]);L.__webglDepthRenderbuffer&&r.deleteRenderbuffer(L.__webglDepthRenderbuffer)}const se=H.textures;for(let me=0,be=se.length;me<be;me++){const ge=n.get(se[me]);ge.__webglTexture&&(r.deleteTexture(ge.__webglTexture),o.memory.textures--),n.remove(se[me])}n.remove(H)}let F=0;function j(){F=0}function Z(){const H=F;return H>=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+H+" texture units while this GPU supports only "+i.maxTextures),F+=1,H}function $(H){const L=[];return L.push(H.wrapS),L.push(H.wrapT),L.push(H.wrapR||0),L.push(H.magFilter),L.push(H.minFilter),L.push(H.anisotropy),L.push(H.internalFormat),L.push(H.format),L.push(H.type),L.push(H.generateMipmaps),L.push(H.premultiplyAlpha),L.push(H.flipY),L.push(H.unpackAlignment),L.push(H.colorSpace),L.join()}function ae(H,L){const se=n.get(H);if(H.isVideoTexture&&Ne(H),H.isRenderTargetTexture===!1&&H.version>0&&se.__version!==H.version){const me=H.image;if(me===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(me.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Pe(se,H,L);return}}t.bindTexture(r.TEXTURE_2D,se.__webglTexture,r.TEXTURE0+L)}function ne(H,L){const se=n.get(H);if(H.version>0&&se.__version!==H.version){Pe(se,H,L);return}t.bindTexture(r.TEXTURE_2D_ARRAY,se.__webglTexture,r.TEXTURE0+L)}function xe(H,L){const se=n.get(H);if(H.version>0&&se.__version!==H.version){Pe(se,H,L);return}t.bindTexture(r.TEXTURE_3D,se.__webglTexture,r.TEXTURE0+L)}
vendor: 4,179 bytes, line 3803
3803function k(H,L){const se=n.get(H);if(H.version>0&&se.__version!==H.version){Be(se,H,L);return}t.bindTexture(r.TEXTURE_CUBE_MAP,se.__webglTexture,r.TEXTURE0+L)}const ee={[sl]:r.REPEAT,[Cn]:r.CLAMP_TO_EDGE,[ol]:r.MIRRORED_REPEAT},Q={[kn]:r.NEAREST,[wp]:r.NEAREST_MIPMAP_NEAREST,[Vo]:r.NEAREST_MIPMAP_LINEAR,[tn]:r.LINEAR,[Za]:r.LINEAR_MIPMAP_NEAREST,[ur]:r.LINEAR_MIPMAP_LINEAR},fe={[D_]:r.NEVER,[z_]:r.ALWAYS,[U_]:r.LESS,[Ip]:r.LEQUAL,[N_]:r.EQUAL,[B_]:r.GEQUAL,[F_]:r.GREATER,[O_]:r.NOTEQUAL};function Se(H,L){if(L.type===pn&&e.has("OES_texture_float_linear")===!1&&(L.magFilter===tn||L.magFilter===Za||L.magFilter===Vo||L.magFilter===ur||L.minFilter===tn||L.minFilter===Za||L.minFilter===Vo||L.minFilter===ur)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(H,r.TEXTURE_WRAP_S,ee[L.wrapS]),r.texParameteri(H,r.TEXTURE_WRAP_T,ee[L.wrapT]),(H===r.TEXTURE_3D||H===r.TEXTURE_2D_ARRAY)&&r.texParameteri(H,r.TEXTURE_WRAP_R,ee[L.wrapR]),r.texParameteri(H,r.TEXTURE_MAG_FILTER,Q[L.magFilter]),r.texParameteri(H,r.TEXTURE_MIN_FILTER,Q[L.minFilter]),L.compareFunction&&(r.texParameteri(H,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(H,r.TEXTURE_COMPARE_FUNC,fe[L.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(L.magFilter===kn||L.minFilter!==Vo&&L.minFilter!==ur||L.type===pn&&e.has("OES_texture_float_linear")===!1)return;if(L.anisotropy>1||n.get(L).__currentAnisotropy){const se=e.get("EXT_texture_filter_anisotropic");r.texParameterf(H,se.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(L.anisotropy,i.getMaxAnisotropy())),n.get(L).__currentAnisotropy=L.anisotropy}}}function ke(H,L){let se=!1;H.__webglInit===void 0&&(H.__webglInit=!0,L.addEventListener("dispose",I));const me=L.source;let be=m.get(me);be===void 0&&(be={},m.set(me,be));const ge=$(L);if(ge!==H.__cacheKey){be[ge]===void 0&&(be[ge]={texture:r.createTexture(),usedTimes:0},o.memory.textures++,se=!0),be[ge].usedTimes++;const st=be[H.__cacheKey];st!==void 0&&(be[H.__cacheKey].usedTimes--,st.usedTimes===0&&C(L)),H.__cacheKey=ge,H.__webglTexture=be[ge].texture}return se}function le(H,L,se){return Math.floor(Math.floor(H/se)/L)}function Ie(H,L,se,me){const ge=H.updateRanges;if(ge.length===0)t.texSubImage2D(r.TEXTURE_2D,0,0,0,L.width,L.height,se,me,L.data);else{ge.sort((Ae,Xe)=>Ae.start-Xe.start);let st=0;for(let Ae=1;Ae<ge.length;Ae++){const Xe=ge[st],vt=ge[Ae],X=Xe.start+Xe.count,re=le(vt.start,L.width,4),Ce=le(Xe.start,L.width,4);vt.start<=X+1&&re===Ce&&le(vt.start+vt.count-1,L.width,4)===re?Xe.count=Math.max(Xe.count,vt.start+vt.count-Xe.start):(++st,ge[st]=vt)}ge.length=st+1;const Ye=r.getParameter(r.UNPACK_ROW_LENGTH),ot=r.getParameter(r.UNPACK_SKIP_PIXELS),lt=r.getParameter(r.UNPACK_SKIP_ROWS);r.pixelStorei(r.UNPACK_ROW_LENGTH,L.width);for(let Ae=0,Xe=ge.length;Ae<Xe;Ae++){const vt=ge[Ae],X=Math.floor(vt.start/4),re=Math.ceil(vt.count/4),Ce=X%L.width,W=Math.floor(X/L.width),oe=re,Te=1;r.pixelStorei(r.UNPACK_SKIP_PIXELS,Ce),r.pixelStorei(r.UNPACK_SKIP_ROWS,W),t.texSubImage2D(r.TEXTURE_2D,0,Ce,W,oe,Te,se,me,L.data)}H.clearUpdateRanges(),r.pixelStorei(r.UNPACK_ROW_LENGTH,Ye),r.pixelStorei(r.UNPACK_SKIP_PIXELS,ot),r.pixelStorei(r.UNPACK_SKIP_ROWS,lt)}}function Pe(H,L,se){let me=r.TEXTURE_2D;(L.isDataArrayTexture||L.isCompressedArrayTexture)&&(me=r.TEXTURE_2D_ARRAY),L.isData3DTexture&&(me=r.TEXTURE_3D);const be=ke(H,L),ge=L.source;t.bindTexture(me,H.__webglTexture,r.TEXTURE0+se);const st=n.get(ge);if(ge.version!==st.__version||be===!0){t.activeTexture(r.TEXTURE0+se);const Ye=qt.getPrimaries(qt.workingColorSpace),ot=L.colorSpace===Lr?null:qt.getPrimaries(L.colorSpace),lt=L.colorSpace===Lr||Ye===ot?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,L.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,L.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,L.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,lt);let Ae=M(L.image,!1,i.maxTextureSize);Ae=it(L,Ae);const Xe=s.convert(L.format,L.colorSpace),vt=s.convert(L.type);let X=E(L.internalFormat,Xe,vt,L.colorSpace,L.isVideoTexture);Se(me,L);let re;
vendor: 21,546 bytes, line 3803
3803const Ce=L.mipmaps,W=L.isVideoTexture!==!0,oe=st.__version===void 0||be===!0,Te=ge.dataReady,Je=U(L,Ae);if(L.isDepthTexture)X=T(L.format===ea,L.type),oe&&(W?t.texStorage2D(r.TEXTURE_2D,1,X,Ae.width,Ae.height):t.texImage2D(r.TEXTURE_2D,0,X,Ae.width,Ae.height,0,Xe,vt,null));else if(L.isDataTexture)if(Ce.length>0){W&&oe&&t.texStorage2D(r.TEXTURE_2D,Je,X,Ce[0].width,Ce[0].height);for(let ze=0,Ee=Ce.length;ze<Ee;ze++)re=Ce[ze],W?Te&&t.texSubImage2D(r.TEXTURE_2D,ze,0,0,re.width,re.height,Xe,vt,re.data):t.texImage2D(r.TEXTURE_2D,ze,X,re.width,re.height,0,Xe,vt,re.data);L.generateMipmaps=!1}else W?(oe&&t.texStorage2D(r.TEXTURE_2D,Je,X,Ae.width,Ae.height),Te&&Ie(L,Ae,Xe,vt)):t.texImage2D(r.TEXTURE_2D,0,X,Ae.width,Ae.height,0,Xe,vt,Ae.data);else if(L.isCompressedTexture)if(L.isCompressedArrayTexture){W&&oe&&t.texStorage3D(r.TEXTURE_2D_ARRAY,Je,X,Ce[0].width,Ce[0].height,Ae.depth);for(let ze=0,Ee=Ce.length;ze<Ee;ze++)if(re=Ce[ze],L.format!==En)if(Xe!==null)if(W){if(Te)if(L.layerUpdates.size>0){const Ke=mp(re.width,re.height,L.format,L.type);for(const _t of L.layerUpdates){const Yt=re.data.subarray(_t*Ke/re.data.BYTES_PER_ELEMENT,(_t+1)*Ke/re.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,ze,0,0,_t,re.width,re.height,1,Xe,Yt)}L.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,ze,0,0,0,re.width,re.height,Ae.depth,Xe,re.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,ze,X,re.width,re.height,Ae.depth,0,re.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else W?Te&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,ze,0,0,0,re.width,re.height,Ae.depth,Xe,vt,re.data):t.texImage3D(r.TEXTURE_2D_ARRAY,ze,X,re.width,re.height,Ae.depth,0,Xe,vt,re.data)}else{W&&oe&&t.texStorage2D(r.TEXTURE_2D,Je,X,Ce[0].width,Ce[0].height);for(let ze=0,Ee=Ce.length;ze<Ee;ze++)re=Ce[ze],L.format!==En?Xe!==null?W?Te&&t.compressedTexSubImage2D(r.TEXTURE_2D,ze,0,0,re.width,re.height,Xe,re.data):t.compressedTexImage2D(r.TEXTURE_2D,ze,X,re.width,re.height,0,re.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):W?Te&&t.texSubImage2D(r.TEXTURE_2D,ze,0,0,re.width,re.height,Xe,vt,re.data):t.texImage2D(r.TEXTURE_2D,ze,X,re.width,re.height,0,Xe,vt,re.data)}else if(L.isDataArrayTexture)if(W){if(oe&&t.texStorage3D(r.TEXTURE_2D_ARRAY,Je,X,Ae.width,Ae.height,Ae.depth),Te)if(L.layerUpdates.size>0){const ze=mp(Ae.width,Ae.height,L.format,L.type);for(const Ee of L.layerUpdates){const Ke=Ae.data.subarray(Ee*ze/Ae.data.BYTES_PER_ELEMENT,(Ee+1)*ze/Ae.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,Ee,Ae.width,Ae.height,1,Xe,vt,Ke)}L.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,Ae.width,Ae.height,Ae.depth,Xe,vt,Ae.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,X,Ae.width,Ae.height,Ae.depth,0,Xe,vt,Ae.data);else if(L.isData3DTexture)W?(oe&&t.texStorage3D(r.TEXTURE_3D,Je,X,Ae.width,Ae.height,Ae.depth),Te&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,Ae.width,Ae.height,Ae.depth,Xe,vt,Ae.data)):t.texImage3D(r.TEXTURE_3D,0,X,Ae.width,Ae.height,Ae.depth,0,Xe,vt,Ae.data);else if(L.isFramebufferTexture){if(oe)if(W)t.texStorage2D(r.TEXTURE_2D,Je,X,Ae.width,Ae.height);else{let ze=Ae.width,Ee=Ae.height;for(let Ke=0;Ke<Je;Ke++)t.texImage2D(r.TEXTURE_2D,Ke,X,ze,Ee,0,Xe,vt,null),ze>>=1,Ee>>=1}}else if(Ce.length>0){if(W&&oe){const ze=wt(Ce[0]);t.texStorage2D(r.TEXTURE_2D,Je,X,ze.width,ze.height)}for(let ze=0,Ee=Ce.length;ze<Ee;ze++)re=Ce[ze],W?Te&&t.texSubImage2D(r.TEXTURE_2D,ze,0,0,Xe,vt,re):t.texImage2D(r.TEXTURE_2D,ze,X,Xe,vt,re);L.generateMipmaps=!1}else if(W){if(oe){const ze=wt(Ae);t.texStorage2D(r.TEXTURE_2D,Je,X,ze.width,ze.height)}Te&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,Xe,vt,Ae)}else t.texImage2D(r.TEXTURE_2D,0,X,Xe,vt,Ae);x(L)&&v(me),st.__version=ge.version,L.onUpdate&&L.onUpdate(L)}H.__version=L.version}function Be(H,L,se){if(L.image.length!==6)return;const me=ke(H,L),be=L.source;t.bindTexture(r.TEXTURE_CUBE_MAP,H.__webglTexture,r.TEXTURE0+se);const ge=n.get(be);if(be.version!==ge.__version||me===!0){t.activeTexture(r.TEXTURE0+se);const st=qt.getPrimaries(qt.workingColorSpace),Ye=L.colorSpace===Lr?null:qt.getPrimaries(L.colorSpace),ot=L.colorSpace===Lr||st===Ye?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,L.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,L.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,L.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,ot);const lt=L.isCompressedTexture||L.image[0].isCompressedTexture,Ae=L.image[0]&&L.image[0].isDataTexture,Xe=[];for(let Ee=0;Ee<6;Ee++)!lt&&!Ae?Xe[Ee]=M(L.image[Ee],!0,i.maxCubemapSize):Xe[Ee]=Ae?L.image[Ee].image:L.image[Ee],Xe[Ee]=it(L,Xe[Ee]);const vt=Xe[0],X=s.convert(L.format,L.colorSpace),re=s.convert(L.type),Ce=E(L.internalFormat,X,re,L.colorSpace),W=L.isVideoTexture!==!0,oe=ge.__version===void 0||me===!0,Te=be.dataReady;let Je=U(L,vt);Se(r.TEXTURE_CUBE_MAP,L);let ze;if(lt){W&&oe&&t.texStorage2D(r.TEXTURE_CUBE_MAP,Je,Ce,vt.width,vt.height);for(let Ee=0;Ee<6;Ee++){ze=Xe[Ee].mipmaps;for(let Ke=0;Ke<ze.length;Ke++){const _t=ze[Ke];L.format!==En?X!==null?W?Te&&t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ee,Ke,0,0,_t.width,_t.height,X,_t.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ee,Ke,Ce,_t.width,_t.height,0,_t.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):W?Te&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ee,Ke,0,0,_t.width,_t.height,X,re,_t.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ee,Ke,Ce,_t.width,_t.height,0,X,re,_t.data)}}}else{if(ze=L.mipmaps,W&&oe){ze.length>0&&Je++;const Ee=wt(Xe[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,Je,Ce,Ee.width,Ee.height)}for(let Ee=0;Ee<6;Ee++)if(Ae){W?Te&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ee,0,0,0,Xe[Ee].width,Xe[Ee].height,X,re,Xe[Ee].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ee,0,Ce,Xe[Ee].width,Xe[Ee].height,0,X,re,Xe[Ee].data);for(let Ke=0;Ke<ze.length;Ke++){const Yt=ze[Ke].image[Ee].image;W?Te&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ee,Ke+1,0,0,Yt.width,Yt.height,X,re,Yt.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ee,Ke+1,Ce,Yt.width,Yt.height,0,X,re,Yt.data)}}else{W?Te&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ee,0,0,0,X,re,Xe[Ee]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ee,0,Ce,X,re,Xe[Ee]);for(let Ke=0;Ke<ze.length;Ke++){const _t=ze[Ke];W?Te&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ee,Ke+1,0,0,X,re,_t.image[Ee]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ee,Ke+1,Ce,X,re,_t.image[Ee])}}}x(L)&&v(r.TEXTURE_CUBE_MAP),ge.__version=be.version,L.onUpdate&&L.onUpdate(L)}H.__version=L.version}function nt(H,L,se,me,be,ge){const st=s.convert(se.format,se.colorSpace),Ye=s.convert(se.type),ot=E(se.internalFormat,st,Ye,se.colorSpace),lt=n.get(L),Ae=n.get(se);if(Ae.__renderTarget=L,!lt.__hasExternalTextures){const Xe=Math.max(1,L.width>>ge),vt=Math.max(1,L.height>>ge);be===r.TEXTURE_3D||be===r.TEXTURE_2D_ARRAY?t.texImage3D(be,ge,ot,Xe,vt,L.depth,0,st,Ye,null):t.texImage2D(be,ge,ot,Xe,vt,0,st,Ye,null)}t.bindFramebuffer(r.FRAMEBUFFER,H),et(L)?c.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,me,be,Ae.__webglTexture,0,Me(L)):(be===r.TEXTURE_2D||be>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&be<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,me,be,Ae.__webglTexture,ge),t.bindFramebuffer(r.FRAMEBUFFER,null)}function Et(H,L,se){if(r.bindRenderbuffer(r.RENDERBUFFER,H),L.depthBuffer){const me=L.depthTexture,be=me&&me.isDepthTexture?me.type:null,ge=T(L.stencilBuffer,be),st=L.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Ye=Me(L);et(L)?c.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,Ye,ge,L.width,L.height):se?r.renderbufferStorageMultisample(r.RENDERBUFFER,Ye,ge,L.width,L.height):r.renderbufferStorage(r.RENDERBUFFER,ge,L.width,L.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,st,r.RENDERBUFFER,H)}else{const me=L.textures;for(let be=0;be<me.length;be++){const ge=me[be],st=s.convert(ge.format,ge.colorSpace),Ye=s.convert(ge.type),ot=E(ge.internalFormat,st,Ye,ge.colorSpace),lt=Me(L);se&&et(L)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,lt,ot,L.width,L.height):et(L)?c.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,lt,ot,L.width,L.height):r.renderbufferStorage(r.RENDERBUFFER,ot,L.width,L.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function dt(H,L){if(L&&L.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(r.FRAMEBUFFER,H),!(L.depthTexture&&L.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const me=n.get(L.depthTexture);me.__renderTarget=L,(!me.__webglTexture||L.depthTexture.image.width!==L.width||L.depthTexture.image.height!==L.height)&&(L.depthTexture.image.width=L.width,L.depthTexture.image.height=L.height,L.depthTexture.needsUpdate=!0),ae(L.depthTexture,0);const be=me.__webglTexture,ge=Me(L);if(L.depthTexture.format===$o)et(L)?c.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,be,0,ge):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,be,0);else if(L.depthTexture.format===ea)et(L)?c.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,be,0,ge):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,be,0);else throw new Error("Unknown depthTexture format")}function Nt(H){const L=n.get(H),se=H.isWebGLCubeRenderTarget===!0;if(L.__boundDepthTexture!==H.depthTexture){const me=H.depthTexture;if(L.__depthDisposeCallback&&L.__depthDisposeCallback(),me){const be=()=>{delete L.__boundDepthTexture,delete L.__depthDisposeCallback,me.removeEventListener("dispose",be)};me.addEventListener("dispose",be),L.__depthDisposeCallback=be}L.__boundDepthTexture=me}if(H.depthTexture&&!L.__autoAllocateDepthBuffer){if(se)throw new Error("target.depthTexture not supported in Cube render targets");const me=H.texture.mipmaps;me&&me.length>0?dt(L.__webglFramebuffer[0],H):dt(L.__webglFramebuffer,H)}else if(se){L.__webglDepthbuffer=[];for(let me=0;me<6;me++)if(t.bindFramebuffer(r.FRAMEBUFFER,L.__webglFramebuffer[me]),L.__webglDepthbuffer[me]===void 0)L.__webglDepthbuffer[me]=r.createRenderbuffer(),Et(L.__webglDepthbuffer[me],H,!1);else{const be=H.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,ge=L.__webglDepthbuffer[me];r.bindRenderbuffer(r.RENDERBUFFER,ge),r.framebufferRenderbuffer(r.FRAMEBUFFER,be,r.RENDERBUFFER,ge)}}else{const me=H.texture.mipmaps;if(me&&me.length>0?t.bindFramebuffer(r.FRAMEBUFFER,L.__webglFramebuffer[0]):t.bindFramebuffer(r.FRAMEBUFFER,L.__webglFramebuffer),L.__webglDepthbuffer===void 0)L.__webglDepthbuffer=r.createRenderbuffer(),Et(L.__webglDepthbuffer,H,!1);else{const be=H.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,ge=L.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,ge),r.framebufferRenderbuffer(r.FRAMEBUFFER,be,r.RENDERBUFFER,ge)}}t.bindFramebuffer(r.FRAMEBUFFER,null)}function It(H,L,se){const me=n.get(H);L!==void 0&&nt(me.__webglFramebuffer,H,H.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),se!==void 0&&Nt(H)}function pt(H){const L=H.texture,se=n.get(H),me=n.get(L);H.addEventListener("dispose",N);const be=H.textures,ge=H.isWebGLCubeRenderTarget===!0,st=be.length>1;if(st||(me.__webglTexture===void 0&&(me.__webglTexture=r.createTexture()),me.__version=L.version,o.memory.textures++),ge){se.__webglFramebuffer=[];for(let Ye=0;Ye<6;Ye++)if(L.mipmaps&&L.mipmaps.length>0){se.__webglFramebuffer[Ye]=[];for(let ot=0;ot<L.mipmaps.length;ot++)se.__webglFramebuffer[Ye][ot]=r.createFramebuffer()}else se.__webglFramebuffer[Ye]=r.createFramebuffer()}else{if(L.mipmaps&&L.mipmaps.length>0){se.__webglFramebuffer=[];for(let Ye=0;Ye<L.mipmaps.length;Ye++)se.__webglFramebuffer[Ye]=r.createFramebuffer()}else se.__webglFramebuffer=r.createFramebuffer();if(st)for(let Ye=0,ot=be.length;Ye<ot;Ye++){const lt=n.get(be[Ye]);lt.__webglTexture===void 0&&(lt.__webglTexture=r.createTexture(),o.memory.textures++)}if(H.samples>0&&et(H)===!1){se.__webglMultisampledFramebuffer=r.createFramebuffer(),se.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,se.__webglMultisampledFramebuffer);for(let Ye=0;Ye<be.length;Ye++){const ot=be[Ye];se.__webglColorRenderbuffer[Ye]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,se.__webglColorRenderbuffer[Ye]);const lt=s.convert(ot.format,ot.colorSpace),Ae=s.convert(ot.type),Xe=E(ot.internalFormat,lt,Ae,ot.colorSpace,H.isXRRenderTarget===!0),vt=Me(H);r.renderbufferStorageMultisample(r.RENDERBUFFER,vt,Xe,H.width,H.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ye,r.RENDERBUFFER,se.__webglColorRenderbuffer[Ye])}r.bindRenderbuffer(r.RENDERBUFFER,null),H.depthBuffer&&(se.__webglDepthRenderbuffer=r.createRenderbuffer(),Et(se.__webglDepthRenderbuffer,H,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(ge){t.bindTexture(r.TEXTURE_CUBE_MAP,me.__webglTexture),Se(r.TEXTURE_CUBE_MAP,L);for(let Ye=0;Ye<6;Ye++)if(L.mipmaps&&L.mipmaps.length>0)for(let ot=0;ot<L.mipmaps.length;ot++)nt(se.__webglFramebuffer[Ye][ot],H,L,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Ye,ot);else nt(se.__webglFramebuffer[Ye],H,L,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Ye,0);x(L)&&v(r.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(st){for(let Ye=0,ot=be.length;Ye<ot;Ye++){const lt=be[Ye],Ae=n.get(lt);t.bindTexture(r.TEXTURE_2D,Ae.__webglTexture),Se(r.TEXTURE_2D,lt),nt(se.__webglFramebuffer,H,lt,r.COLOR_ATTACHMENT0+Ye,r.TEXTURE_2D,0),x(lt)&&v(r.TEXTURE_2D)}t.unbindTexture()}else{let Ye=r.TEXTURE_2D;if((H.isWebGL3DRenderTarget||H.isWebGLArrayRenderTarget)&&(Ye=H.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(Ye,me.__webglTexture),Se(Ye,L),L.mipmaps&&L.mipmaps.length>0)for(let ot=0;ot<L.mipmaps.length;ot++)nt(se.__webglFramebuffer[ot],H,L,r.COLOR_ATTACHMENT0,Ye,ot);else nt(se.__webglFramebuffer,H,L,r.COLOR_ATTACHMENT0,Ye,0);x(L)&&v(Ye),t.unbindTexture()}H.depthBuffer&&Nt(H)}function z(H){const L=H.textures;for(let se=0,me=L.length;se<me;se++){const be=L[se];if(x(be)){const ge=w(H),st=n.get(be).__webglTexture;t.bindTexture(ge,st),v(ge),t.unbindTexture()}}}const Ve=[],Ue=[];function We(H){if(H.samples>0){if(et(H)===!1){const L=H.textures,se=H.width,me=H.height;let be=r.COLOR_BUFFER_BIT;const ge=H.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,st=n.get(H),Ye=L.length>1;if(Ye)for(let lt=0;lt<L.length;lt++)t.bindFramebuffer(r.FRAMEBUFFER,st.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+lt,r.RENDERBUFFER,null),t.bindFramebuffer(r.FRAMEBUFFER,st.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+lt,r.TEXTURE_2D,null,0);t.bindFramebuffer(r.READ_FRAMEBUFFER,st.__webglMultisampledFramebuffer);const ot=H.texture.mipmaps;ot&&ot.length>0?t.bindFramebuffer(r.DRAW_FRAMEBUFFER,st.__webglFramebuffer[0]):t.bindFramebuffer(r.DRAW_FRAMEBUFFER,st.__webglFramebuffer);for(let lt=0;lt<L.length;lt++){if(H.resolveDepthBuffer&&(H.depthBuffer&&(be|=r.DEPTH_BUFFER_BIT),H.stencilBuffer&&H.resolveStencilBuffer&&(be|=r.STENCIL_BUFFER_BIT)),Ye){r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,st.__webglColorRenderbuffer[lt]);const Ae=n.get(L[lt]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,Ae,0)}r.blitFramebuffer(0,0,se,me,0,0,se,me,be,r.NEAREST),u===!0&&(Ve.length=0,Ue.length=0,Ve.push(r.COLOR_ATTACHMENT0+lt),H.depthBuffer&&H.resolveDepthBuffer===!1&&(Ve.push(ge),Ue.push(ge),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,Ue)),r.invalidateFramebuffer(r.READ_FRAMEBUFFER,Ve))}if(t.bindFramebuffer(r.READ_FRAMEBUFFER,null),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),Ye)for(let lt=0;lt<L.length;lt++){t.bindFramebuffer(r.FRAMEBUFFER,st.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+lt,r.RENDERBUFFER,st.__webglColorRenderbuffer[lt]);const Ae=n.get(L[lt]).__webglTexture;t.bindFramebuffer(r.FRAMEBUFFER,st.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+lt,r.TEXTURE_2D,Ae,0)}t.bindFramebuffer(r.DRAW_FRAMEBUFFER,st.__webglMultisampledFramebuffer)}else if(H.depthBuffer&&H.resolveDepthBuffer===!1&&u){const L=H.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[L])}}}function Me(H){return Math.min(i.maxSamples,H.samples)}function et(H){const L=n.get(H);return H.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&L.__useRenderToTexture!==!1}function Ne(H){const L=o.render.frame;f.get(H)!==L&&(f.set(H,L),H.update())}function it(H,L){const se=H.colorSpace,me=H.format,be=H.type;return H.isCompressedTexture===!0||H.isVideoTexture===!0||se!==mr&&se!==Lr&&(qt.getTransfer(se)===en?(me!==En||be!==oi)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",se)),L}function wt(H){return typeof HTMLImageElement<"u"&&H instanceof HTMLImageElement?(h.width=H.naturalWidth||H.width,h.height=H.naturalHeight||H.height):typeof VideoFrame<"u"&&H instanceof VideoFrame?(h.width=H.displayWidth,h.height=H.displayHeight):(h.width=H.width,h.height=H.height),h}this.allocateTextureUnit=Z,this.resetTextureUnits=j,this.setTexture2D=ae,this.setTexture2DArray=ne,this.setTexture3D=xe,this.setTextureCube=k,this.rebindTextures=It,this.setupRenderTarget=pt,this.updateRenderTargetMipmap=z,this.updateMultisampleRenderTarget=We,this.setupDepthRenderbuffer=Nt,this.setupFrameBufferTexture=nt,this.useMultisampledRTT=et}function jy(r,e){function t(n,i=Lr){let s;const o=qt.getTransfer(i);if(n===oi)return r.UNSIGNED_BYTE;if(n===yh)return r.UNSIGNED_SHORT_4_4_4_4;if(n===xh)return r.UNSIGNED_SHORT_5_5_5_1;if(n===Ep)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===vh)return r.BYTE;if(n===_h)return r.SHORT;if(n===Ko)return r.UNSIGNED_SHORT;if(n===Tl)return r.INT;if(n===pr)return r.UNSIGNED_INT;if(n===pn)return r.FLOAT;if(n===Bn)return r.HALF_FLOAT;if(n===Tp)return r.ALPHA;if(n===bp)return r.RGB;if(n===En)return r.RGBA;if(n===$o)return r.DEPTH_COMPONENT;if(n===ea)return r.DEPTH_STENCIL;if(n===bl)return r.RED;if(n===Al)return r.RED_INTEGER;if(n===Ap)return r.RG;if(n===Sh)return r.RG_INTEGER;if(n===Mh)return r.RGBA_INTEGER;if(n===ja||n===Ja||n===Ka||n===Qa)if(o===en)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===ja)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Ja)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Ka)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Qa)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===ja)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Ja)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Ka)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Qa)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===zu||n===ku||n===Hu||n===Vu)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===zu)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===ku)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Hu)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Vu)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Gu||n===Wu||n===Xu)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===Gu||n===Wu)return o===en?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===Xu)return o===en?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===Yu||n===qu||n===Zu||n===ju||n===Ju||n===Ku||n===Qu||n===$u||n===eh||n===th||n===nh||n===ih||n===rh||n===sh)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===Yu)return o===en?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===qu)return o===en?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Zu)return o===en?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===ju)return o===en?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Ju)return o===en?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Ku)return o===en?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Qu)return o===en?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===$u)return o===en?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===eh)return o===en?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===th)return o===en?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===nh)return o===en?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===ih)return o===en?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===rh)return o===en?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===sh)return o===en?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===$a||n===oh||n===ah)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===$a)return o===en?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===oh)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===ah)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Cp||n===lh||n===ch||n===uh)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===$a)return s.COMPRESSED_RED_RGT
vendor: 10,153 bytes, lines 3803-3827
3803C1_EXT;if(n===lh)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===ch)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===uh)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Qo?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const AC=` 3804void main() { 3805 3806 gl_Position = vec4( position, 1.0 ); 3807 3808}`,CC=` 3809uniform sampler2DArray depthColor; 3810uniform float depthWidth; 3811uniform float depthHeight; 3812 3813void main() { 3814 3815 vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); 3816 3817 if ( coord.x >= 1.0 ) { 3818 3819 gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; 3820 3821 } else { 3822 3823 gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; 3824 3825 } 3826 3827}`;class RC{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const i=new sn,s=e.properties.get(i);s.__webglTexture=t.texture,(t.depthNear!==n.depthNear||t.depthFar!==n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new gi({vertexShader:AC,fragmentShader:CC,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new mn(new ds(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class IC extends gr{constructor(e,t){super();const n=this;let i=null,s=1,o=null,c="local-floor",u=1,h=null,f=null,d=null,m=null,g=null,y=null;const M=new RC,x=t.getContextAttributes();let v=null,w=null;const E=[],T=[],U=new we;let I=null;const N=new wn;N.viewport=new jt;const D=new wn;D.viewport=new jt;const C=[N,D],A=new zy;let F=null,j=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(le){let Ie=E[le];return Ie===void 0&&(Ie=new Au,E[le]=Ie),Ie.getTargetRaySpace()},this.getControllerGrip=function(le){let Ie=E[le];return Ie===void 0&&(Ie=new Au,E[le]=Ie),Ie.getGripSpace()},this.getHand=function(le){let Ie=E[le];return Ie===void 0&&(Ie=new Au,E[le]=Ie),Ie.getHandSpace()};function Z(le){const Ie=T.indexOf(le.inputSource);if(Ie===-1)return;const Pe=E[Ie];Pe!==void 0&&(Pe.update(le.inputSource,le.frame,h||o),Pe.dispatchEvent({type:le.type,data:le.inputSource}))}function $(){i.removeEventListener("select",Z),i.removeEventListener("selectstart",Z),i.removeEventListener("selectend",Z),i.removeEventListener("squeeze",Z),i.removeEventListener("squeezestart",Z),i.removeEventListener("squeezeend",Z),i.removeEventListener("end",$),i.removeEventListener("inputsourceschange",ae);for(let le=0;le<E.length;le++){const Ie=T[le];Ie!==null&&(T[le]=null,E[le].disconnect(Ie))}F=null,j=null,M.reset(),e.setRenderTarget(v),g=null,m=null,d=null,i=null,w=null,ke.stop(),n.isPresenting=!1,e.setPixelRatio(I),e.setSize(U.width,U.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(le){s=le,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(le){c=le,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return h||o},this.setReferenceSpace=function(le){h=le},this.getBaseLayer=function(){return m!==null?m:g},this.getBinding=function(){return d},this.getFrame=function(){return y},this.getSession=function(){return i},this.setSession=async function(le){if(i=le,i!==null){if(v=e.getRenderTarget(),i.addEventListener("select",Z),i.addEventListener("selectstart",Z),i.addEventListener("selectend",Z),i.addEventListener("squeeze",Z),i.addEventListener("squeezestart",Z),i.addEventListener("squeezeend",Z),i.addEventListener("end",$),i.addEventListener("inputsourceschange",ae),x.xrCompatible!==!0&&await t.makeXRCompatible(),I=e.getPixelRatio(),e.getSize(U),typeof XRWebGLBinding<"u"&&"createProjectionLayer"in XRWebGLBinding.prototype){let Pe=null,Be=null,nt=null;x.depth&&(nt=x.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Pe=x.stencil?ea:$o,Be=x.stencil?Qo:pr);const Et={colorFormat:t.RGBA8,depthFormat:nt,scaleFactor:s};d=new XRWebGLBinding(i,t),m=d.createProjectionLayer(Et),i.updateRenderState({layers:[m]}),e.setPixelRatio(1),e.setSize(m.textureWidth,m.textureHeight,!1),w=new zi(m.textureWidth,m.textureHeight,{format:En,type:oi,depthTexture:new zp(m.textureWidth,m.textureHeight,Be,void 0,void 0,void 0,void 0,void 0,void 0,Pe),stencilBuffer:x.stencil,colorSpace:e.outputColorSpace,samples:x.antialias?4:0,resolveDepthBuffer:m.ignoreDepthValues===!1,resolveStencilBuffer:m.ignoreDepthValues===!1})}else{const Pe={antialias:x.antialias,alpha:!0,depth:x.depth,stencil:x.stencil,framebufferScaleFactor:s};g=new XRWebGLLayer(i,t,Pe),i.updateRenderState({baseLayer:g}),e.setPixelRatio(1),e.setSize(g.framebufferWidth,g.framebufferHeight,!1),w=new zi(g.framebufferWidth,g.framebufferHeight,{format:En,type:oi,colorSpace:e.outputColorSpace,stencilBuffer:x.stencil,resolveDepthBuffer:g.ignoreDepthValues===!1,resolveStencilBuffer:g.ignoreDepthValues===!1})}w.isXRRenderTarget=!0,this.setFoveation(u),h=null,o=await i.requestReferenceSpace(c),ke.setContext(i),ke.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return M.getDepthTexture()};function ae(le){for(let Ie=0;Ie<le.removed.length;Ie++){const Pe=le.removed[Ie],Be=T.indexOf(Pe);Be>=0&&(T[Be]=null,E[Be].disconnect(Pe))}for(let Ie=0;Ie<le.added.length;Ie++){const Pe=le.added[Ie];let Be=T.indexOf(Pe);if(Be===-1){for(let Et=0;Et<E.length;Et++)if(Et>=T.length){T.push(Pe),Be=Et;break}else if(T[Et]===null){T[Et]=Pe,Be=Et;break}if(Be===-1)break}const nt=E[Be];nt&&nt.connect(Pe)}}const ne=new B,xe=new B;function k(le,Ie,Pe){ne.setFromMatrixPosition(Ie.matrixWorld),xe.setFromMatrixPosition(Pe.matrixWorld);const Be=ne.distanceTo(xe),nt=Ie.projectionMatrix.elements,Et=Pe.projectionMatrix.elements,dt=nt[14]/(nt[10]-1),Nt=nt[14]/(nt[10]+1),It=(nt[9]+1)/nt[5],pt=(nt[9]-1)/nt[5],z=(nt[8]-1)/nt[0],Ve=(Et[8]+1)/Et[0],Ue=dt*z,We=dt*Ve,Me=Be/(-z+Ve),et=Me*-z;if(Ie.matrixWorld.decompose(le.position,le.quaternion,le.scale),le.translateX(et),le.translateZ(Me),le.matrixWorld.compose(le.position,le.quaternion,le.scale),le.matrixWorldInverse.copy(le.matrixWorld).invert(),nt[10]===-1)le.projectionMatrix.copy(Ie.projectionMatrix),le.projectionMatrixInverse.copy(Ie.projectionMatrixInverse);else{const Ne=dt+Me,it=Nt+Me,wt=Ue-et,H=We+(Be-et),L=It*Nt/it*Ne,se=pt*Nt/it*Ne;le.projectionMatrix.makePerspective(wt,H,L,se,Ne,it),le.projectionMatrixInverse.copy(le.projectionMatrix).invert()}}function ee(le,Ie){Ie===null?le.matrixWorld.copy(le.matrix):le.matrixWorld.multiplyMatrices(Ie.matrixWorld,le.matrix),le.matrixWorldInverse.copy(le.matrixWorld).invert()}this.updateCamera=function(le){if(i===null)return;let Ie=le.near,Pe=le.far;M.texture!==null&&(M.depthNear>0&&(Ie=M.depthNear),M.depthFar>0&&(Pe=M.depthFar)),A.near=D.near=N.near=Ie,A.far=D.far=N.far=Pe,(F!==A.near||j!==A.far)&&(i.updateRenderState({depthNear:A.near,depthFar:A.far}),F=A.near,j=A.far),N.layers.mask=le.layers.mask|2,D.layers.mask=le.layers.mask|4,A.layers.mask=N.layers.mask|D.layers.mask;const Be=le.parent,nt=A.cameras;ee(A,Be);for(let Et=0;Et<nt.length;Et++)ee(nt[Et],Be);nt.length===2?k(A,N,D):A.projectionMatrix.copy(N.projectionMatrix),Q(le,A,Be)};function Q(le,Ie,Pe){Pe===null?le.matrix.copy(Ie.matrixWorld):(le.matrix.copy(Pe.matrixWorld),le.matrix.invert(),le.matrix.multiply(Ie.matrixWorld)),le.matrix.decompose(le.position,le.quaternion,le.scale),le.updateMatrixWorld(!0),le.projectionMatrix.copy(Ie.projectionMatrix),le.projectionMatrixInverse.copy(Ie.projectionMatrixInverse),le.isPerspectiveCamera&&(le.fov=ta*2*Math.atan(1/le.projectionMatrix.elements[5]),le.zoom=1)}this.getCamera=function(){return A},this.getFoveation=function(){if(!(m===null&&g===null))return u},this.setFoveation=function(le){u=le,m!==null&&(m.fixedFoveation=le),g!==null&&g.fixedFoveation!==void 0&&(g.fixedFoveation=le)},this.hasDepthSensing=function(){return M.texture!==null},this.getDepthSensingMesh=function(){return M.getMesh(A)};let fe=null;function Se(le,Ie){if(f=Ie.getViewerPose(h||o),y=Ie,f!==null){const Pe=f.views;g!==null&&(e.setRenderTargetFramebuffer(w,g.framebuffer),e.setRenderTarget(w));let Be=!1;Pe.length!==A.cameras.length&&(A.cameras.length=0,Be=!0);for(let dt=0;dt<Pe.length;dt++){const Nt=Pe[dt];let It=null;if(g!==null)It=g.getViewport(Nt);else{const z=d.getViewSubImage(m,Nt);It=z.viewport,dt===0&&(e.setRenderTargetTextures(w,z.colorTexture,z.depthStencilTexture),e.setRenderTarget(w))}let pt=C[dt];pt===void 0&&(pt=new wn,pt.layers.enable(dt),pt.viewport=new jt,C[dt]=pt),pt.matrix.fromArray(Nt.transform.matrix),pt.matrix.decompose(pt.position,pt.quaternion,pt.scale),pt.projectionMatrix.fromArray(Nt.projectionMatrix),pt.projectionMatrixInverse.copy(pt.projectionMatrix).invert(),pt.viewport.set(It.x,It.y,It.width,It.height),dt===0&&(A.matrix.copy(pt.matrix),A.matrix.decompose(A.position,A.quaternion,A.scale)),Be===!0&&A.cameras.push(pt)}const nt=i.enabledFeatures;if(nt&&nt.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&d){const dt=d.getDepthInformation(Pe[0]);dt&&dt.isValid&&dt.texture&&M.init(e,dt,i.renderState)}}for(let Pe=0;Pe<E.length;Pe++){const Be=T[Pe],nt=E[Pe];Be!==null&&nt!==void 0&&nt.update(Be,Ie,h||o)}fe&&fe(le,Ie),Ie.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:Ie}),y=null}const ke=new Wy;ke.setAnimationLoop(Se),this.setAnimationLoop=function(le){fe=le},this.dispose=function(){}}}const Bs=new Ai,PC=new bt;function LC(r,e){function t(x,v){x.matrixAutoUpdate===!0&&x.updateMatrix(),v.value.copy(x.matrix)}function n(x,v){v.color.getRGB(x.fogColor.value,W_(r)),v.isFog?(x.fogNear.value=v.near,x.fogFar.value=v.far):v.isFogExp2&&(x.fogDensity.value=v.density)}function i(x,v,w,E,T){v.isMeshBasicMaterial||v.isMeshLambertMaterial?s(x,v):v.isMeshToonMaterial?(s(x,v),d(x,v)):v.isMeshPhongMaterial?(s(x,v),f(x,v)):v.isMeshStandardMaterial?(s(x,v),m(x,v),v.isMeshPhysicalMaterial&&g(x,v,T)):v.isMeshMat
vendor: 13,276 bytes, line 3827
3827capMaterial?(s(x,v),y(x,v)):v.isMeshDepthMaterial?s(x,v):v.isMeshDistanceMaterial?(s(x,v),M(x,v)):v.isMeshNormalMaterial?s(x,v):v.isLineBasicMaterial?(o(x,v),v.isLineDashedMaterial&&c(x,v)):v.isPointsMaterial?u(x,v,w,E):v.isSpriteMaterial?h(x,v):v.isShadowMaterial?(x.color.value.copy(v.color),x.opacity.value=v.opacity):v.isShaderMaterial&&(v.uniformsNeedUpdate=!1)}function s(x,v){x.opacity.value=v.opacity,v.color&&x.diffuse.value.copy(v.color),v.emissive&&x.emissive.value.copy(v.emissive).multiplyScalar(v.emissiveIntensity),v.map&&(x.map.value=v.map,t(v.map,x.mapTransform)),v.alphaMap&&(x.alphaMap.value=v.alphaMap,t(v.alphaMap,x.alphaMapTransform)),v.bumpMap&&(x.bumpMap.value=v.bumpMap,t(v.bumpMap,x.bumpMapTransform),x.bumpScale.value=v.bumpScale,v.side===si&&(x.bumpScale.value*=-1)),v.normalMap&&(x.normalMap.value=v.normalMap,t(v.normalMap,x.normalMapTransform),x.normalScale.value.copy(v.normalScale),v.side===si&&x.normalScale.value.negate()),v.displacementMap&&(x.displacementMap.value=v.displacementMap,t(v.displacementMap,x.displacementMapTransform),x.displacementScale.value=v.displacementScale,x.displacementBias.value=v.displacementBias),v.emissiveMap&&(x.emissiveMap.value=v.emissiveMap,t(v.emissiveMap,x.emissiveMapTransform)),v.specularMap&&(x.specularMap.value=v.specularMap,t(v.specularMap,x.specularMapTransform)),v.alphaTest>0&&(x.alphaTest.value=v.alphaTest);const w=e.get(v),E=w.envMap,T=w.envMapRotation;E&&(x.envMap.value=E,Bs.copy(T),Bs.x*=-1,Bs.y*=-1,Bs.z*=-1,E.isCubeTexture&&E.isRenderTargetTexture===!1&&(Bs.y*=-1,Bs.z*=-1),x.envMapRotation.value.setFromMatrix4(PC.makeRotationFromEuler(Bs)),x.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,x.reflectivity.value=v.reflectivity,x.ior.value=v.ior,x.refractionRatio.value=v.refractionRatio),v.lightMap&&(x.lightMap.value=v.lightMap,x.lightMapIntensity.value=v.lightMapIntensity,t(v.lightMap,x.lightMapTransform)),v.aoMap&&(x.aoMap.value=v.aoMap,x.aoMapIntensity.value=v.aoMapIntensity,t(v.aoMap,x.aoMapTransform))}function o(x,v){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,v.map&&(x.map.value=v.map,t(v.map,x.mapTransform))}function c(x,v){x.dashSize.value=v.dashSize,x.totalSize.value=v.dashSize+v.gapSize,x.scale.value=v.scale}function u(x,v,w,E){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,x.size.value=v.size*w,x.scale.value=E*.5,v.map&&(x.map.value=v.map,t(v.map,x.uvTransform)),v.alphaMap&&(x.alphaMap.value=v.alphaMap,t(v.alphaMap,x.alphaMapTransform)),v.alphaTest>0&&(x.alphaTest.value=v.alphaTest)}function h(x,v){x.diffuse.value.copy(v.color),x.opacity.value=v.opacity,x.rotation.value=v.rotation,v.map&&(x.map.value=v.map,t(v.map,x.mapTransform)),v.alphaMap&&(x.alphaMap.value=v.alphaMap,t(v.alphaMap,x.alphaMapTransform)),v.alphaTest>0&&(x.alphaTest.value=v.alphaTest)}function f(x,v){x.specular.value.copy(v.specular),x.shininess.value=Math.max(v.shininess,1e-4)}function d(x,v){v.gradientMap&&(x.gradientMap.value=v.gradientMap)}function m(x,v){x.metalness.value=v.metalness,v.metalnessMap&&(x.metalnessMap.value=v.metalnessMap,t(v.metalnessMap,x.metalnessMapTransform)),x.roughness.value=v.roughness,v.roughnessMap&&(x.roughnessMap.value=v.roughnessMap,t(v.roughnessMap,x.roughnessMapTransform)),v.envMap&&(x.envMapIntensity.value=v.envMapIntensity)}function g(x,v,w){x.ior.value=v.ior,v.sheen>0&&(x.sheenColor.value.copy(v.sheenColor).multiplyScalar(v.sheen),x.sheenRoughness.value=v.sheenRoughness,v.sheenColorMap&&(x.sheenColorMap.value=v.sheenColorMap,t(v.sheenColorMap,x.sheenColorMapTransform)),v.sheenRoughnessMap&&(x.sheenRoughnessMap.value=v.sheenRoughnessMap,t(v.sheenRoughnessMap,x.sheenRoughnessMapTransform))),v.clearcoat>0&&(x.clearcoat.value=v.clearcoat,x.clearcoatRoughness.value=v.clearcoatRoughness,v.clearcoatMap&&(x.clearcoatMap.value=v.clearcoatMap,t(v.clearcoatMap,x.clearcoatMapTransform)),v.clearcoatRoughnessMap&&(x.clearcoatRoughnessMap.value=v.clearcoatRoughnessMap,t(v.clearcoatRoughnessMap,x.clearcoatRoughnessMapTransform)),v.clearcoatNormalMap&&(x.clearcoatNormalMap.value=v.clearcoatNormalMap,t(v.clearcoatNormalMap,x.clearcoatNormalMapTransform),x.clearcoatNormalScale.value.copy(v.clearcoatNormalScale),v.side===si&&x.clearcoatNormalScale.value.negate())),v.dispersion>0&&(x.dispersion.value=v.dispersion),v.iridescence>0&&(x.iridescence.value=v.iridescence,x.iridescenceIOR.value=v.iridescenceIOR,x.iridescenceThicknessMinimum.value=v.iridescenceThicknessRange[0],x.iridescenceThicknessMaximum.value=v.iridescenceThicknessRange[1],v.iridescenceMap&&(x.iridescenceMap.value=v.iridescenceMap,t(v.iridescenceMap,x.iridescenceMapTransform)),v.iridescenceThicknessMap&&(x.iridescenceThicknessMap.value=v.iridescenceThicknessMap,t(v.iridescenceThicknessMap,x.iridescenceThicknessMapTransform))),v.transmission>0&&(x.transmission.value=v.transmission,x.transmissionSamplerMap.value=w.texture,x.transmissionSamplerSize.value.set(w.width,w.height),v.transmissionMap&&(x.transmissionMap.value=v.transmissionMap,t(v.transmissionMap,x.transmissionMapTransform)),x.thickness.value=v.thickness,v.thicknessMap&&(x.thicknessMap.value=v.thicknessMap,t(v.thicknessMap,x.thicknessMapTransform)),x.attenuationDistance.value=v.attenuationDistance,x.attenuationColor.value.copy(v.attenuationColor)),v.anisotropy>0&&(x.anisotropyVector.value.set(v.anisotropy*Math.cos(v.anisotropyRotation),v.anisotropy*Math.sin(v.anisotropyRotation)),v.anisotropyMap&&(x.anisotropyMap.value=v.anisotropyMap,t(v.anisotropyMap,x.anisotropyMapTransform))),x.specularIntensity.value=v.specularIntensity,x.specularColor.value.copy(v.specularColor),v.specularColorMap&&(x.specularColorMap.value=v.specularColorMap,t(v.specularColorMap,x.specularColorMapTransform)),v.specularIntensityMap&&(x.specularIntensityMap.value=v.specularIntensityMap,t(v.specularIntensityMap,x.specularIntensityMapTransform))}function y(x,v){v.matcap&&(x.matcap.value=v.matcap)}function M(x,v){const w=e.get(v).light;x.referencePosition.value.setFromMatrixPosition(w.matrixWorld),x.nearDistance.value=w.shadow.camera.near,x.farDistance.value=w.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function DC(r,e,t,n){let i={},s={},o=[];const c=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function u(w,E){const T=E.program;n.uniformBlockBinding(w,T)}function h(w,E){let T=i[w.id];T===void 0&&(y(w),T=f(w),i[w.id]=T,w.addEventListener("dispose",x));const U=E.program;n.updateUBOMapping(w,U);const I=e.render.frame;s[w.id]!==I&&(m(w),s[w.id]=I)}function f(w){const E=d();w.__bindingPointIndex=E;const T=r.createBuffer(),U=w.__size,I=w.usage;return r.bindBuffer(r.UNIFORM_BUFFER,T),r.bufferData(r.UNIFORM_BUFFER,U,I),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,E,T),T}function d(){for(let w=0;w<c;w++)if(o.indexOf(w)===-1)return o.push(w),w;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function m(w){const E=i[w.id],T=w.uniforms,U=w.__cache;r.bindBuffer(r.UNIFORM_BUFFER,E);for(let I=0,N=T.length;I<N;I++){const D=Array.isArray(T[I])?T[I]:[T[I]];for(let C=0,A=D.length;C<A;C++){const F=D[C];if(g(F,I,C,U)===!0){const j=F.__offset,Z=Array.isArray(F.value)?F.value:[F.value];let $=0;for(let ae=0;ae<Z.length;ae++){const ne=Z[ae],xe=M(ne);typeof ne=="number"||typeof ne=="boolean"?(F.__data[0]=ne,r.bufferSubData(r.UNIFORM_BUFFER,j+$,F.__data)):ne.isMatrix3?(F.__data[0]=ne.elements[0],F.__data[1]=ne.elements[1],F.__data[2]=ne.elements[2],F.__data[3]=0,F.__data[4]=ne.elements[3],F.__data[5]=ne.elements[4],F.__data[6]=ne.elements[5],F.__data[7]=0,F.__data[8]=ne.elements[6],F.__data[9]=ne.elements[7],F.__data[10]=ne.elements[8],F.__data[11]=0):(ne.toArray(F.__data,$),$+=xe.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,j,F.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function g(w,E,T,U){const I=w.value,N=E+"_"+T;if(U[N]===void 0)return typeof I=="number"||typeof I=="boolean"?U[N]=I:U[N]=I.clone(),!0;{const D=U[N];if(typeof I=="number"||typeof I=="boolean"){if(D!==I)return U[N]=I,!0}else if(D.equals(I)===!1)return D.copy(I),!0}return!1}function y(w){const E=w.uniforms;let T=0;const U=16;for(let N=0,D=E.length;N<D;N++){const C=Array.isArray(E[N])?E[N]:[E[N]];for(let A=0,F=C.length;A<F;A++){const j=C[A],Z=Array.isArray(j.value)?j.value:[j.value];for(let $=0,ae=Z.length;$<ae;$++){const ne=Z[$],xe=M(ne),k=T%U,ee=k%xe.boundary,Q=k+ee;T+=ee,Q!==0&&U-Q<xe.storage&&(T+=U-Q),j.__data=new Float32Array(xe.storage/Float32Array.BYTES_PER_ELEMENT),j.__offset=T,T+=xe.storage}}}const I=T%U;return I>0&&(T+=U-I),w.__size=T,w.__cache={},this}function M(w){const E={boundary:0,storage:0};return typeof w=="number"||typeof w=="boolean"?(E.boundary=4,E.storage=4):w.isVector2?(E.boundary=8,E.storage=8):w.isVector3||w.isColor?(E.boundary=16,E.storage=12):w.isVector4?(E.boundary=16,E.storage=16):w.isMatrix3?(E.boundary=48,E.storage=48):w.isMatrix4?(E.boundary=64,E.storage=64):w.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",w),E}function x(w){const E=w.target;E.removeEventListener("dispose",x);const T=o.indexOf(E.__bindingPointIndex);o.splice(T,1),r.deleteBuffer(i[E.id]),delete i[E.id],delete s[E.id]}function v(){for(const w in i)r.deleteBuffer(i[w]);o=[],i={},s={}}return{bind:u,update:h,dispose:v}}class lm{constructor(e={}){const{canvas:t=H_(),context:n=null,depth:i=!0,stencil:s=!1,alpha:o=!1,antialias:c=!1,premultipliedAlpha:u=!0,preserveDrawingBuffer:h=!1,powerPreference:f="default",failIfMajorPerformanceCaveat:d=!1,reverseDepthBuffer:m=!1}=e;this.isWebGLRenderer=!0;let g;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");g=n.getContextAttributes().alpha}else g=o;const y=new Uint32Array(4),M=new Int32Array(4);let x=null,v=null;const w=[],E=[];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=fr,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const T=this;let U=!1;this._outputColorSpace=ii;let I=0,N=0,D=null,C=-1,A=null;const F=new jt,j=new jt;let Z=null;const $=new rt(0);let ae=0,ne=t.width,xe=t.height,k=1,ee=null,Q=null;const fe=new jt(0,0,ne,xe),Se=new jt(0,0,ne,xe);let ke=!1;const le=new la;let Ie=!1,Pe=!1;const Be=new bt,nt=new bt,Et=new B,dt=new jt,Nt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let It=!1;function pt(){return D===null?k:1}let z=n;function Ve(P,G){return t.getContext(P,G)}try{const P={alpha:!0,depth:i,stencil:s,antialias:c,premultipliedAlpha:u,preserveDrawingBuffer:h,powerPreference:f,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${wl}`),t.addEventListener("webglcontextlost",Je,!1),t.addEventListener("webglcontextrestored",ze,!1),t.addEventListener("webglcontextcreationerror",Ee,!1),z===null){const G="webgl2";if(z=Ve(G,P),z===null)throw Ve(G)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(P){throw console.error("THREE.WebGLRenderer: "+P.message),P}let Ue,We,Me,et,Ne,it,wt,H,L,se,me,be,ge,st,Ye,ot,lt,Ae,Xe,vt,X,re,Ce,W;function oe(){Ue=new Xb(z),Ue.init(),re=new jy(z,Ue),We=new Bb(z,Ue,e,re),Me=new TC(z,Ue),We.reverseDepthBuffer&&m&&Me.buffers.depth.setReversed(!0),et=new Zb(z),Ne=new fC,it=new bC(z,Ue,Me,Ne,We,re,et),wt=new kb(T),H=new Wb(T),L=new eE(z),Ce=new Fb(z,L),se=new Yb(z,L,et,Ce),me=new Jb(z,se,L,et),Xe=new jb(z,We,it),ot=new zb(Ne),be=new hC(T,wt,H,Ue,We,Ce,ot),ge=new LC(T,Ne),st=new pC,Ye=new xC(Ue),Ae=new Nb(T,wt,H,Me,me,g,u),lt=new wC(T,me,We),W=new DC(z,et,We,Me),vt=new Ob(z,Ue,et),X=new qb(z,Ue,et),et.programs=be.programs,T.capabilities=We,T.extensions=Ue,T.properties=Ne,T.renderLists=st,T.shadowMap=lt,T.state=Me,T.info=et}oe();const Te=new IC(T,z);this.xr=Te,this.getContext=function(){return z},this.getContextAttributes=function(){return z.getContextAttributes()},this.forceContextLoss=function(){const P=Ue.get("WEBGL_lose_context");P&&P.loseContext()},this.forceContextRestore=function(){const P=Ue.get("WEBGL_lose_context");P&&P.restoreContext()},this.getPixelRatio=function(){return k},this.setPixelRatio=function(P){P!==void 0&&(k=P,this.setSize(ne,xe,!1))},this.getSize=function(P){return P.set(ne,xe)},this.setSize=function(P,G,q=!0){if(Te.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}ne=P,xe=G,t.width=Math.floor(P*k),t.height=Math.floor(G*k),q===!0&&(t.style.width=P+"px",t.style.height=G+"px"),this.setViewport(0,0,P,G)},this.getDrawingBufferSize=function(P){return P.set(ne*k,xe*k).floor()},this.setDrawingBufferSize=function(P,G,q){ne=P,xe=G,k=q,t.width=Math.floor(P*q),t.height=Math.floor(G*q),this.setViewport(0,0,P,G)},this.getCurrentViewport=function(P){return P.copy(F)},this.getViewport=function(P){return P.copy(fe)},this.setViewport=function(P,G,q,Y){P.isVector4?fe.set(P.x,P.y,P.z,P.w):fe.set(P,G,q,Y),Me.viewport(F.copy(fe).multiplyScalar(k).round())}
vendor: 10,023 bytes, line 3827
3827,this.getScissor=function(P){return P.copy(Se)},this.setScissor=function(P,G,q,Y){P.isVector4?Se.set(P.x,P.y,P.z,P.w):Se.set(P,G,q,Y),Me.scissor(j.copy(Se).multiplyScalar(k).round())},this.getScissorTest=function(){return ke},this.setScissorTest=function(P){Me.setScissorTest(ke=P)},this.setOpaqueSort=function(P){ee=P},this.setTransparentSort=function(P){Q=P},this.getClearColor=function(P){return P.copy(Ae.getClearColor())},this.setClearColor=function(){Ae.setClearColor(...arguments)},this.getClearAlpha=function(){return Ae.getClearAlpha()},this.setClearAlpha=function(){Ae.setClearAlpha(...arguments)},this.clear=function(P=!0,G=!0,q=!0){let Y=0;if(P){let K=!1;if(D!==null){const ce=D.texture.format;K=ce===Mh||ce===Sh||ce===Al}if(K){const ce=D.texture.type,_e=ce===oi||ce===pr||ce===Ko||ce===Qo||ce===yh||ce===xh,Le=Ae.getClearColor(),Re=Ae.getClearAlpha(),qe=Le.r,Ze=Le.g,Fe=Le.b;_e?(y[0]=qe,y[1]=Ze,y[2]=Fe,y[3]=Re,z.clearBufferuiv(z.COLOR,0,y)):(M[0]=qe,M[1]=Ze,M[2]=Fe,M[3]=Re,z.clearBufferiv(z.COLOR,0,M))}else Y|=z.COLOR_BUFFER_BIT}G&&(Y|=z.DEPTH_BUFFER_BIT),q&&(Y|=z.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),z.clear(Y)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Je,!1),t.removeEventListener("webglcontextrestored",ze,!1),t.removeEventListener("webglcontextcreationerror",Ee,!1),Ae.dispose(),st.dispose(),Ye.dispose(),Ne.dispose(),wt.dispose(),H.dispose(),me.dispose(),Ce.dispose(),W.dispose(),be.dispose(),Te.dispose(),Te.removeEventListener("sessionstart",oo),Te.removeEventListener("sessionend",ao),Qn.stop()};function Je(P){P.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),U=!0}function ze(){console.log("THREE.WebGLRenderer: Context Restored."),U=!1;const P=et.autoReset,G=lt.enabled,q=lt.autoUpdate,Y=lt.needsUpdate,K=lt.type;oe(),et.autoReset=P,lt.enabled=G,lt.autoUpdate=q,lt.needsUpdate=Y,lt.type=K}function Ee(P){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",P.statusMessage)}function Ke(P){const G=P.target;G.removeEventListener("dispose",Ke),_t(G)}function _t(P){Yt(P),Ne.remove(P)}function Yt(P){const G=Ne.get(P).programs;G!==void 0&&(G.forEach(function(q){be.releaseProgram(q)}),P.isShaderMaterial&&be.releaseShaderCache(P))}this.renderBufferDirect=function(P,G,q,Y,K,ce){G===null&&(G=Nt);const _e=K.isMesh&&K.matrixWorld.determinant()<0,Le=J(P,G,q,Y,K);Me.setMaterial(Y,_e);let Re=q.index,qe=1;if(Y.wireframe===!0){if(Re=se.getWireframeAttribute(q),Re===void 0)return;qe=2}const Ze=q.drawRange,Fe=q.attributes.position;let je=Ze.start*qe,ct=(Ze.start+Ze.count)*qe;ce!==null&&(je=Math.max(je,ce.start*qe),ct=Math.min(ct,(ce.start+ce.count)*qe)),Re!==null?(je=Math.max(je,0),ct=Math.min(ct,Re.count)):Fe!=null&&(je=Math.max(je,0),ct=Math.min(ct,Fe.count));const Mt=ct-je;if(Mt<0||Mt===1/0)return;Ce.setup(K,Y,Le,q,Re);let ft,mt=vt;if(Re!==null&&(ft=L.get(Re),mt=X,mt.setIndex(ft)),K.isMesh)Y.wireframe===!0?(Me.setLineWidth(Y.wireframeLinewidth*pt()),mt.setMode(z.LINES)):mt.setMode(z.TRIANGLES);else if(K.isLine){let at=Y.linewidth;at===void 0&&(at=1),Me.setLineWidth(at*pt()),K.isLineSegments?mt.setMode(z.LINES):K.isLineLoop?mt.setMode(z.LINE_LOOP):mt.setMode(z.LINE_STRIP)}else K.isPoints?mt.setMode(z.POINTS):K.isSprite&&mt.setMode(z.TRIANGLES);if(K.isBatchedMesh)if(K._multiDrawInstances!==null)qo("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),mt.renderMultiDrawInstances(K._multiDrawStarts,K._multiDrawCounts,K._multiDrawCount,K._multiDrawInstances);else if(Ue.get("WEBGL_multi_draw"))mt.renderMultiDraw(K._multiDrawStarts,K._multiDrawCounts,K._multiDrawCount);else{const at=K._multiDrawStarts,Wt=K._multiDrawCounts,At=K._multiDrawCount,Ot=Re?L.get(Re).bytesPerElement:1,an=Ne.get(Y).currentProgram.getUniforms();for(let Pt=0;Pt<At;Pt++)an.setValue(z,"_gl_DrawID",Pt),mt.render(at[Pt]/Ot,Wt[Pt])}else if(K.isInstancedMesh)mt.renderInstances(je,Mt,K.count);else if(q.isInstancedBufferGeometry){const at=q._maxInstanceCount!==void 0?q._maxInstanceCount:1/0,Wt=Math.min(q.instanceCount,at);mt.renderInstances(je,Mt,Wt)}else mt.render(je,Mt)};function Ht(P,G,q){P.transparent===!0&&P.side===ji&&P.forceSinglePass===!1?(P.side=si,P.needsUpdate=!0,zr(P,G,q),P.side=Or,P.needsUpdate=!0,zr(P,G,q),P.side=ji):zr(P,G,q)}this.compile=function(P,G,q=null){q===null&&(q=P),v=Ye.get(q),v.init(G),E.push(v),q.traverseVisible(function(K){K.isLight&&K.layers.test(G.layers)&&(v.pushLight(K),K.castShadow&&v.pushShadow(K))}),P!==q&&P.traverseVisible(function(K){K.isLight&&K.layers.test(G.layers)&&(v.pushLight(K),K.castShadow&&v.pushShadow(K))}),v.setupLights();const Y=new Set;return P.traverse(function(K){if(!(K.isMesh||K.isPoints||K.isLine||K.isSprite))return;const ce=K.material;if(ce)if(Array.isArray(ce))for(let _e=0;_e<ce.length;_e++){const Le=ce[_e];Ht(Le,q,K),Y.add(Le)}else Ht(ce,q,K),Y.add(ce)}),v=E.pop(),Y},this.compileAsync=function(P,G,q=null){const Y=this.compile(P,G,q);return new Promise(K=>{function ce(){if(Y.forEach(function(_e){Ne.get(_e).currentProgram.isReady()&&Y.delete(_e)}),Y.size===0){K(P);return}setTimeout(ce,10)}Ue.get("KHR_parallel_shader_compile")!==null?ce():setTimeout(ce,10)})};let gn=null;function Dn(P){gn&&gn(P)}function oo(){Qn.stop()}function ao(){Qn.start()}const Qn=new Wy;Qn.setAnimationLoop(Dn),typeof self<"u"&&Qn.setContext(self),this.setAnimationLoop=function(P){gn=P,Te.setAnimationLoop(P),P===null?Qn.stop():Qn.start()},Te.addEventListener("sessionstart",oo),Te.addEventListener("sessionend",ao),this.render=function(P,G){if(G!==void 0&&G.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(U===!0)return;if(P.matrixWorldAutoUpdate===!0&&P.updateMatrixWorld(),G.parent===null&&G.matrixWorldAutoUpdate===!0&&G.updateMatrixWorld(),Te.enabled===!0&&Te.isPresenting===!0&&(Te.cameraAutoUpdate===!0&&Te.updateCamera(G),G=Te.getCamera()),P.isScene===!0&&P.onBeforeRender(T,P,G,D),v=Ye.get(P,E.length),v.init(G),E.push(v),nt.multiplyMatrices(G.projectionMatrix,G.matrixWorldInverse),le.setFromProjectionMatrix(nt),Pe=this.localClippingEnabled,Ie=ot.init(this.clippingPlanes,Pe),x=st.get(P,w.length),x.init(),w.push(x),Te.enabled===!0&&Te.isPresenting===!0){const ce=T.xr.getDepthSensingMesh();ce!==null&&_r(ce,G,-1/0,T.sortObjects)}_r(P,G,0,T.sortObjects),x.finish(),T.sortObjects===!0&&x.sort(ee,Q),It=Te.enabled===!1||Te.isPresenting===!1||Te.hasDepthSensing()===!1,It&&Ae.addToRenderList(x,P),this.info.render.frame++,Ie===!0&&ot.beginShadows();const q=v.state.shadowsArray;lt.render(q,P,G),Ie===!0&&ot.endShadows(),this.info.autoReset===!0&&this.info.reset();const Y=x.opaque,K=x.transmissive;if(v.setupLights(),G.isArrayCamera){const ce=G.cameras;if(K.length>0)for(let _e=0,Le=ce.length;_e<Le;_e++){const Re=ce[_e];ci(Y,K,P,Re)}It&&Ae.render(P);for(let _e=0,Le=ce.length;_e<Le;_e++){const Re=ce[_e];$i(x,P,Re,Re.viewport)}}else K.length>0&&ci(Y,K,P,G),It&&Ae.render(P),$i(x,P,G);D!==null&&N===0&&(it.updateMultisampleRenderTarget(D),it.updateRenderTargetMipmap(D)),P.isScene===!0&&P.onAfterRender(T,P,G),Ce.resetDefaultState(),C=-1,A=null,E.pop(),E.length>0?(v=E[E.length-1],Ie===!0&&ot.setGlobalState(T.clippingPlanes,v.state.camera)):v=null,w.pop(),w.length>0?x=w[w.length-1]:x=null};function _r(P,G,q,Y){if(P.visible===!1)return;if(P.layers.test(G.layers)){if(P.isGroup)q=P.renderOrder;else if(P.isLOD)P.autoUpdate===!0&&P.update(G);else if(P.isLight)v.pushLight(P),P.castShadow&&v.pushShadow(P);else if(P.isSprite){if(!P.frustumCulled||le.intersectsSprite(P)){Y&&dt.setFromMatrixPosition(P.matrixWorld).applyMatrix4(nt);const _e=me.update(P),Le=P.material;Le.visible&&x.push(P,_e,Le,q,dt.z,null)}}else if((P.isMesh||P.isLine||P.isPoints)&&(!P.frustumCulled||le.intersectsObject(P))){const _e=me.update(P),Le=P.material;if(Y&&(P.boundingSphere!==void 0?(P.boundingSphere===null&&P.computeBoundingSphere(),dt.copy(P.boundingSphere.center)):(_e.boundingSphere===null&&_e.computeBoundingSphere(),dt.copy(_e.boundingSphere.center)),dt.applyMatrix4(P.matrixWorld).applyMatrix4(nt)),Array.isArray(Le)){const Re=_e.groups;for(let qe=0,Ze=Re.length;qe<Ze;qe++){const Fe=Re[qe],je=Le[Fe.materialIndex];je&&je.visible&&x.push(P,_e,je,q,dt.z,Fe)}}else Le.visible&&x.push(P,_e,Le,q,dt.z,null)}}const ce=P.children;for(let _e=0,Le=ce.length;_e<Le;_e++)_r(ce[_e],G,q,Y)}function $i(P,G,q,Y){const K=P.opaque,ce=P.transmissive,_e=P.transparent;v.setupLightsView(q),Ie===!0&&ot.setGlobalState(T.clippingPlanes,q),Y&&Me.viewport(F.copy(Y)),K.length>0&&Ft(K,G,q),ce.length>0&&Ft(ce,G,q),_e.length>0&&Ft(_e,G,q),Me.buffers.depth.setTest(!0),Me.buffers.depth.setMask(!0),Me.buffers.color.setMask(!0),Me.setPolygonOffset(!1)}function ci(P,G,q,Y){if((q.isScene===!0?q.overrideMaterial:null)!==null)return;v.state.transmissionRenderTarget[Y.id]===void 0&&(v.state.transmissionRenderTarget[Y.id]=new zi(1,1,{generateMipmaps:!0,type:Ue.has("EXT_color_buffer_half_float")||Ue.has("EXT_color_buffer_float")?Bn:oi,minFilter:ur,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:qt.workingColorSpace}));const ce=v.state.transmissionRenderTarget[Y.id],_e=Y.viewport||F;ce.setSize(_e.z*T.transmissionResolutionScale,_e.w*T.transmissionResolutionScale);const Le=T.getRenderTarget();T.setRenderTarget(ce),T.getClearColor($),ae=T.getClearAlpha(),ae<1&&T.setClearColor(16777215,.5),T.clear(),It&&Ae.render(q);const Re=T.toneMapping;T.toneMapping=fr;const qe=Y.viewport;if(Y.viewport!==void 0&&(Y.viewport=void 0),v.setupLightsView(Y),Ie===!0&&ot.setGlobalState(T.clippingPlanes,Y),Ft(P,q,Y),it.updateMultisampleRenderTarget(ce),it.updateRenderTargetMipmap(ce),Ue.has("WEBGL_multisampled_render_to_texture")===!1){let Ze=!1;for(let Fe=0,je=G.length;Fe<je;Fe++){const ct=G[Fe],Mt=ct.object,ft=ct.geometry,mt=ct.material,at=ct.group;
vendor: 4,136 bytes, line 3827
3827if(mt.side===ji&&Mt.layers.test(Y.layers)){const Wt=mt.side;mt.side=si,mt.needsUpdate=!0,ms(Mt,q,Y,ft,mt,at),mt.side=Wt,mt.needsUpdate=!0,Ze=!0}}Ze===!0&&(it.updateMultisampleRenderTarget(ce),it.updateRenderTargetMipmap(ce))}T.setRenderTarget(Le),T.setClearColor($,ae),qe!==void 0&&(Y.viewport=qe),T.toneMapping=Re}function Ft(P,G,q){const Y=G.isScene===!0?G.overrideMaterial:null;for(let K=0,ce=P.length;K<ce;K++){const _e=P[K],Le=_e.object,Re=_e.geometry,qe=_e.group;let Ze=_e.material;Ze.allowOverride===!0&&Y!==null&&(Ze=Y),Le.layers.test(q.layers)&&ms(Le,G,q,Re,Ze,qe)}}function ms(P,G,q,Y,K,ce){P.onBeforeRender(T,G,q,Y,K,ce),P.modelViewMatrix.multiplyMatrices(q.matrixWorldInverse,P.matrixWorld),P.normalMatrix.getNormalMatrix(P.modelViewMatrix),K.onBeforeRender(T,G,q,Y,P,ce),K.transparent===!0&&K.side===ji&&K.forceSinglePass===!1?(K.side=si,K.needsUpdate=!0,T.renderBufferDirect(q,G,Y,K,P,ce),K.side=Or,K.needsUpdate=!0,T.renderBufferDirect(q,G,Y,K,P,ce),K.side=ji):T.renderBufferDirect(q,G,Y,K,P,ce),P.onAfterRender(T,G,q,Y,K,ce)}function zr(P,G,q){G.isScene!==!0&&(G=Nt);const Y=Ne.get(P),K=v.state.lights,ce=v.state.shadowsArray,_e=K.state.version,Le=be.getParameters(P,K.state,ce,G,q),Re=be.getProgramCacheKey(Le);let qe=Y.programs;Y.environment=P.isMeshStandardMaterial?G.environment:null,Y.fog=G.fog,Y.envMap=(P.isMeshStandardMaterial?H:wt).get(P.envMap||Y.environment),Y.envMapRotation=Y.environment!==null&&P.envMap===null?G.environmentRotation:P.envMapRotation,qe===void 0&&(P.addEventListener("dispose",Ke),qe=new Map,Y.programs=qe);let Ze=qe.get(Re);if(Ze!==void 0){if(Y.currentProgram===Ze&&Y.lightsStateVersion===_e)return O(P,Le),Ze}else Le.uniforms=be.getUniforms(P),P.onBeforeCompile(Le,T),Ze=be.acquireProgram(Le,Re),qe.set(Re,Ze),Y.uniforms=Le.uniforms;const Fe=Y.uniforms;return(!P.isShaderMaterial&&!P.isRawShaderMaterial||P.clipping===!0)&&(Fe.clippingPlanes=ot.uniform),O(P,Le),Y.needsLights=pe(P),Y.lightsStateVersion=_e,Y.needsLights&&(Fe.ambientLightColor.value=K.state.ambient,Fe.lightProbe.value=K.state.probe,Fe.directionalLights.value=K.state.directional,Fe.directionalLightShadows.value=K.state.directionalShadow,Fe.spotLights.value=K.state.spot,Fe.spotLightShadows.value=K.state.spotShadow,Fe.rectAreaLights.value=K.state.rectArea,Fe.ltc_1.value=K.state.rectAreaLTC1,Fe.ltc_2.value=K.state.rectAreaLTC2,Fe.pointLights.value=K.state.point,Fe.pointLightShadows.value=K.state.pointShadow,Fe.hemisphereLights.value=K.state.hemi,Fe.directionalShadowMap.value=K.state.directionalShadowMap,Fe.directionalShadowMatrix.value=K.state.directionalShadowMatrix,Fe.spotShadowMap.value=K.state.spotShadowMap,Fe.spotLightMatrix.value=K.state.spotLightMatrix,Fe.spotLightMap.value=K.state.spotLightMap,Fe.pointShadowMap.value=K.state.pointShadowMap,Fe.pointShadowMatrix.value=K.state.pointShadowMatrix),Y.currentProgram=Ze,Y.uniformsList=null,Ze}function R(P){if(P.uniformsList===null){const G=P.currentProgram.getUniforms();P.uniformsList=Cu.seqWithValue(G.seq,P.uniforms)}return P.uniformsList}function O(P,G){const q=Ne.get(P);q.outputColorSpace=G.outputColorSpace,q.batching=G.batching,q.batchingColor=G.batchingColor,q.instancing=G.instancing,q.instancingColor=G.instancingColor,q.instancingMorph=G.instancingMorph,q.skinning=G.skinning,q.morphTargets=G.morphTargets,q.morphNormals=G.morphNormals,q.morphColors=G.morphColors,q.morphTargetsCount=G.morphTargetsCount,q.numClippingPlanes=G.numClippingPlanes,q.numIntersection=G.numClipIntersection,q.vertexAlphas=G.vertexAlphas,q.vertexTangents=G.vertexTangents,q.toneMapping=G.toneMapping}function J(P,G,q,Y,K){G.isScene!==!0&&(G=Nt),it.resetTextureUnits();const ce=G.fog,_e=Y.isMeshStandardMaterial?G.environment:null,Le=D===null?T.outputColorSpace:D.isXRRenderTarget===!0?D.texture.colorSpace:mr,Re=(Y.isMeshStandardMaterial?H:wt).get(Y.envMap||_e),qe=Y.vertexColors===!0&&!!q.attributes.color&&q.attributes.color.itemSize===4,Ze=!!q.attributes.tangent&&(!!Y.normalMap||Y.anisotropy>0),Fe=!!q.morphAttributes.position,je=!!q.morphAttributes.normal,ct=!!q.morphAttributes.color;let Mt=fr;Y.toneMapped&&(D===null||D.isXRRenderTarget===!0)&&(Mt=T.toneMapping);
vendor: 5,780 bytes, line 3827
3827const ft=q.morphAttributes.position||q.morphAttributes.normal||q.morphAttributes.color,mt=ft!==void 0?ft.length:0,at=Ne.get(Y),Wt=v.state.lights;if(Ie===!0&&(Pe===!0||P!==A)){const ln=P===A&&Y.id===C;ot.setState(Y,P,ln)}let At=!1;Y.version===at.__version?(at.needsLights&&at.lightsStateVersion!==Wt.state.version||at.outputColorSpace!==Le||K.isBatchedMesh&&at.batching===!1||!K.isBatchedMesh&&at.batching===!0||K.isBatchedMesh&&at.batchingColor===!0&&K.colorTexture===null||K.isBatchedMesh&&at.batchingColor===!1&&K.colorTexture!==null||K.isInstancedMesh&&at.instancing===!1||!K.isInstancedMesh&&at.instancing===!0||K.isSkinnedMesh&&at.skinning===!1||!K.isSkinnedMesh&&at.skinning===!0||K.isInstancedMesh&&at.instancingColor===!0&&K.instanceColor===null||K.isInstancedMesh&&at.instancingColor===!1&&K.instanceColor!==null||K.isInstancedMesh&&at.instancingMorph===!0&&K.morphTexture===null||K.isInstancedMesh&&at.instancingMorph===!1&&K.morphTexture!==null||at.envMap!==Re||Y.fog===!0&&at.fog!==ce||at.numClippingPlanes!==void 0&&(at.numClippingPlanes!==ot.numPlanes||at.numIntersection!==ot.numIntersection)||at.vertexAlphas!==qe||at.vertexTangents!==Ze||at.morphTargets!==Fe||at.morphNormals!==je||at.morphColors!==ct||at.toneMapping!==Mt||at.morphTargetsCount!==mt)&&(At=!0):(At=!0,at.__version=Y.version);let Ot=at.currentProgram;At===!0&&(Ot=zr(Y,G,K));let an=!1,Pt=!1,Xt=!1;const Tt=Ot.getUniforms(),vn=at.uniforms;if(Me.useProgram(Ot.program)&&(an=!0,Pt=!0,Xt=!0),Y.id!==C&&(C=Y.id,Pt=!0),an||A!==P){Me.buffers.depth.getReversed()?(Be.copy(P.projectionMatrix),TM(Be),bM(Be),Tt.setValue(z,"projectionMatrix",Be)):Tt.setValue(z,"projectionMatrix",P.projectionMatrix),Tt.setValue(z,"viewMatrix",P.matrixWorldInverse);const Rn=Tt.map.cameraPosition;Rn!==void 0&&Rn.setValue(z,Et.setFromMatrixPosition(P.matrixWorld)),We.logarithmicDepthBuffer&&Tt.setValue(z,"logDepthBufFC",2/(Math.log(P.far+1)/Math.LN2)),(Y.isMeshPhongMaterial||Y.isMeshToonMaterial||Y.isMeshLambertMaterial||Y.isMeshBasicMaterial||Y.isMeshStandardMaterial||Y.isShaderMaterial)&&Tt.setValue(z,"isOrthographic",P.isOrthographicCamera===!0),A!==P&&(A=P,Pt=!0,Xt=!0)}if(K.isSkinnedMesh){Tt.setOptional(z,K,"bindMatrix"),Tt.setOptional(z,K,"bindMatrixInverse");const ln=K.skeleton;ln&&(ln.boneTexture===null&&ln.computeBoneTexture(),Tt.setValue(z,"boneTexture",ln.boneTexture,it))}K.isBatchedMesh&&(Tt.setOptional(z,K,"batchingTexture"),Tt.setValue(z,"batchingTexture",K._matricesTexture,it),Tt.setOptional(z,K,"batchingIdTexture"),Tt.setValue(z,"batchingIdTexture",K._indirectTexture,it),Tt.setOptional(z,K,"batchingColorTexture"),K._colorsTexture!==null&&Tt.setValue(z,"batchingColorTexture",K._colorsTexture,it));const rn=q.morphAttributes;if((rn.position!==void 0||rn.normal!==void 0||rn.color!==void 0)&&Xe.update(K,q,Ot),(Pt||at.receiveShadow!==K.receiveShadow)&&(at.receiveShadow=K.receiveShadow,Tt.setValue(z,"receiveShadow",K.receiveShadow)),Y.isMeshGouraudMaterial&&Y.envMap!==null&&(vn.envMap.value=Re,vn.flipEnvMap.value=Re.isCubeTexture&&Re.isRenderTargetTexture===!1?-1:1),Y.isMeshStandardMaterial&&Y.envMap===null&&G.environment!==null&&(vn.envMapIntensity.value=G.environmentIntensity),Pt&&(Tt.setValue(z,"toneMappingExposure",T.toneMappingExposure),at.needsLights&&he(vn,Xt),ce&&Y.fog===!0&&ge.refreshFogUniforms(vn,ce),ge.refreshMaterialUniforms(vn,Y,k,xe,v.state.transmissionRenderTarget[P.id]),Cu.upload(z,R(at),vn,it)),Y.isShaderMaterial&&Y.uniformsNeedUpdate===!0&&(Cu.upload(z,R(at),vn,it),Y.uniformsNeedUpdate=!1),Y.isSpriteMaterial&&Tt.setValue(z,"center",K.center),Tt.setValue(z,"modelViewMatrix",K.modelViewMatrix),Tt.setValue(z,"normalMatrix",K.normalMatrix),Tt.setValue(z,"modelMatrix",K.matrixWorld),Y.isShaderMaterial||Y.isRawShaderMaterial){const ln=Y.uniformsGroups;for(let Rn=0,kr=ln.length;Rn<kr;Rn++){const vi=ln[Rn];W.update(vi,Ot),W.bind(vi,Ot)}}return Ot}function he(P,G){P.ambientLightColor.needsUpdate=G,P.lightProbe.needsUpdate=G,P.directionalLights.needsUpdate=G,P.directionalLightShadows.needsUpdate=G,P.pointLights.needsUpdate=G,P.pointLightShadows.needsUpdate=G,P.spotLights.needsUpdate=G,P.spotLightShadows.needsUpdate=G,P.rectAreaLights.needsUpdate=G,P.hemisphereLights.needsUpdate=G}function pe(P){return P.isMeshLambertMaterial||P.isMeshToonMaterial||P.isMeshPhongMaterial||P.isMeshStandardMaterial||P.isShadowMaterial||P.isShaderMaterial&&P.lights===!0}this.getActiveCubeFace=function(){return I},this.getActiveMipmapLevel=function(){return N},this.getRenderTarget=function(){return D},this.setRenderTargetTextures=function(P,G,q){const Y=Ne.get(P);Y.__autoAllocateDepthBuffer=P.resolveDepthBuffer===!1,Y.__autoAllocateDepthBuffer===!1&&(Y.__useRenderToTexture=!1),Ne.get(P.texture).__webglTexture=G,Ne.get(P.depthTexture).__webglTexture=Y.__autoAllocateDepthBuffer?void 0:q,Y.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(P,G){const q=Ne.get(P);q.__webglFramebuffer=G,q.__useDefaultFramebuffer=G===void 0};const ve=z.createFramebuffer();this.setRenderTarget=function(P,G=0,q=0){D=P,I=G,N=q;let Y=!0,K=null,ce=!1,_e=!1;if(P){const Re=Ne.get(P);if(Re.__useDefaultFramebuffer!==void 0)Me.bindFramebuffer(z.FRAMEBUFFER,null),Y=!1;else if(Re.__webglFramebuffer===void 0)it.setupRenderTarget(P);else if(Re.__hasExternalTextures)it.rebindTextures(P,Ne.get(P.texture).__webglTexture,Ne.get(P.depthTexture).__webglTexture);else if(P.depthBuffer){const Fe=P.depthTexture;if(Re.__boundDepthTexture!==Fe){if(Fe!==null&&Ne.has(Fe)&&(P.width!==Fe.image.width||P.height!==Fe.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");it.setupDepthRenderbuffer(P)}}const qe=P.texture;(qe.isData3DTexture||qe.isDataArrayTexture||qe.isCompressedArrayTexture)&&(_e=!0);const Ze=Ne.get(P).__webglFramebuffer;
vendor: 12,049 bytes, line 3827
3827P.isWebGLCubeRenderTarget?(Array.isArray(Ze[G])?K=Ze[G][q]:K=Ze[G],ce=!0):P.samples>0&&it.useMultisampledRTT(P)===!1?K=Ne.get(P).__webglMultisampledFramebuffer:Array.isArray(Ze)?K=Ze[q]:K=Ze,F.copy(P.viewport),j.copy(P.scissor),Z=P.scissorTest}else F.copy(fe).multiplyScalar(k).floor(),j.copy(Se).multiplyScalar(k).floor(),Z=ke;if(q!==0&&(K=ve),Me.bindFramebuffer(z.FRAMEBUFFER,K)&&Y&&Me.drawBuffers(P,K),Me.viewport(F),Me.scissor(j),Me.setScissorTest(Z),ce){const Re=Ne.get(P.texture);z.framebufferTexture2D(z.FRAMEBUFFER,z.COLOR_ATTACHMENT0,z.TEXTURE_CUBE_MAP_POSITIVE_X+G,Re.__webglTexture,q)}else if(_e){const Re=Ne.get(P.texture),qe=G;z.framebufferTextureLayer(z.FRAMEBUFFER,z.COLOR_ATTACHMENT0,Re.__webglTexture,q,qe)}else if(P!==null&&q!==0){const Re=Ne.get(P.texture);z.framebufferTexture2D(z.FRAMEBUFFER,z.COLOR_ATTACHMENT0,z.TEXTURE_2D,Re.__webglTexture,q)}C=-1},this.readRenderTargetPixels=function(P,G,q,Y,K,ce,_e,Le=0){if(!(P&&P.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Re=Ne.get(P).__webglFramebuffer;if(P.isWebGLCubeRenderTarget&&_e!==void 0&&(Re=Re[_e]),Re){Me.bindFramebuffer(z.FRAMEBUFFER,Re);try{const qe=P.textures[Le],Ze=qe.format,Fe=qe.type;if(!We.textureFormatReadable(Ze)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!We.textureTypeReadable(Fe)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}G>=0&&G<=P.width-Y&&q>=0&&q<=P.height-K&&(P.textures.length>1&&z.readBuffer(z.COLOR_ATTACHMENT0+Le),z.readPixels(G,q,Y,K,re.convert(Ze),re.convert(Fe),ce))}finally{const qe=D!==null?Ne.get(D).__webglFramebuffer:null;Me.bindFramebuffer(z.FRAMEBUFFER,qe)}}},this.readRenderTargetPixelsAsync=async function(P,G,q,Y,K,ce,_e,Le=0){if(!(P&&P.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Re=Ne.get(P).__webglFramebuffer;if(P.isWebGLCubeRenderTarget&&_e!==void 0&&(Re=Re[_e]),Re)if(G>=0&&G<=P.width-Y&&q>=0&&q<=P.height-K){Me.bindFramebuffer(z.FRAMEBUFFER,Re);const qe=P.textures[Le],Ze=qe.format,Fe=qe.type;if(!We.textureFormatReadable(Ze))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!We.textureTypeReadable(Fe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const je=z.createBuffer();z.bindBuffer(z.PIXEL_PACK_BUFFER,je),z.bufferData(z.PIXEL_PACK_BUFFER,ce.byteLength,z.STREAM_READ),P.textures.length>1&&z.readBuffer(z.COLOR_ATTACHMENT0+Le),z.readPixels(G,q,Y,K,re.convert(Ze),re.convert(Fe),0);const ct=D!==null?Ne.get(D).__webglFramebuffer:null;Me.bindFramebuffer(z.FRAMEBUFFER,ct);const Mt=z.fenceSync(z.SYNC_GPU_COMMANDS_COMPLETE,0);return z.flush(),await EM(z,Mt,4),z.bindBuffer(z.PIXEL_PACK_BUFFER,je),z.getBufferSubData(z.PIXEL_PACK_BUFFER,0,ce),z.deleteBuffer(je),z.deleteSync(Mt),ce}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(P,G=null,q=0){const Y=Math.pow(2,-q),K=Math.floor(P.image.width*Y),ce=Math.floor(P.image.height*Y),_e=G!==null?G.x:0,Le=G!==null?G.y:0;it.setTexture2D(P,0),z.copyTexSubImage2D(z.TEXTURE_2D,q,0,0,_e,Le,K,ce),Me.unbindTexture()};const He=z.createFramebuffer(),Oe=z.createFramebuffer();this.copyTextureToTexture=function(P,G,q=null,Y=null,K=0,ce=null){ce===null&&(K!==0?(qo("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),ce=K,K=0):ce=0);let _e,Le,Re,qe,Ze,Fe,je,ct,Mt;const ft=P.isCompressedTexture?P.mipmaps[ce]:P.image;if(q!==null)_e=q.max.x-q.min.x,Le=q.max.y-q.min.y,Re=q.isBox3?q.max.z-q.min.z:1,qe=q.min.x,Ze=q.min.y,Fe=q.isBox3?q.min.z:0;else{const rn=Math.pow(2,-K);_e=Math.floor(ft.width*rn),Le=Math.floor(ft.height*rn),P.isDataArrayTexture?Re=ft.depth:P.isData3DTexture?Re=Math.floor(ft.depth*rn):Re=1,qe=0,Ze=0,Fe=0}Y!==null?(je=Y.x,ct=Y.y,Mt=Y.z):(je=0,ct=0,Mt=0);const mt=re.convert(G.format),at=re.convert(G.type);let Wt;G.isData3DTexture?(it.setTexture3D(G,0),Wt=z.TEXTURE_3D):G.isDataArrayTexture||G.isCompressedArrayTexture?(it.setTexture2DArray(G,0),Wt=z.TEXTURE_2D_ARRAY):(it.setTexture2D(G,0),Wt=z.TEXTURE_2D),z.pixelStorei(z.UNPACK_FLIP_Y_WEBGL,G.flipY),z.pixelStorei(z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,G.premultiplyAlpha),z.pixelStorei(z.UNPACK_ALIGNMENT,G.unpackAlignment);const At=z.getParameter(z.UNPACK_ROW_LENGTH),Ot=z.getParameter(z.UNPACK_IMAGE_HEIGHT),an=z.getParameter(z.UNPACK_SKIP_PIXELS),Pt=z.getParameter(z.UNPACK_SKIP_ROWS),Xt=z.getParameter(z.UNPACK_SKIP_IMAGES);z.pixelStorei(z.UNPACK_ROW_LENGTH,ft.width),z.pixelStorei(z.UNPACK_IMAGE_HEIGHT,ft.height),z.pixelStorei(z.UNPACK_SKIP_PIXELS,qe),z.pixelStorei(z.UNPACK_SKIP_ROWS,Ze),z.pixelStorei(z.UNPACK_SKIP_IMAGES,Fe);const Tt=P.isDataArrayTexture||P.isData3DTexture,vn=G.isDataArrayTexture||G.isData3DTexture;if(P.isDepthTexture){const rn=Ne.get(P),ln=Ne.get(G),Rn=Ne.get(rn.__renderTarget),kr=Ne.get(ln.__renderTarget);Me.bindFramebuffer(z.READ_FRAMEBUFFER,Rn.__webglFramebuffer),Me.bindFramebuffer(z.DRAW_FRAMEBUFFER,kr.__webglFramebuffer);for(let vi=0;vi<Re;vi++)Tt&&(z.framebufferTextureLayer(z.READ_FRAMEBUFFER,z.COLOR_ATTACHMENT0,Ne.get(P).__webglTexture,K,Fe+vi),z.framebufferTextureLayer(z.DRAW_FRAMEBUFFER,z.COLOR_ATTACHMENT0,Ne.get(G).__webglTexture,ce,Mt+vi)),z.blitFramebuffer(qe,Ze,_e,Le,je,ct,_e,Le,z.DEPTH_BUFFER_BIT,z.NEAREST);Me.bindFramebuffer(z.READ_FRAMEBUFFER,null),Me.bindFramebuffer(z.DRAW_FRAMEBUFFER,null)}else if(K!==0||P.isRenderTargetTexture||Ne.has(P)){const rn=Ne.get(P),ln=Ne.get(G);Me.bindFramebuffer(z.READ_FRAMEBUFFER,He),Me.bindFramebuffer(z.DRAW_FRAMEBUFFER,Oe);for(let Rn=0;Rn<Re;Rn++)Tt?z.framebufferTextureLayer(z.READ_FRAMEBUFFER,z.COLOR_ATTACHMENT0,rn.__webglTexture,K,Fe+Rn):z.framebufferTexture2D(z.READ_FRAMEBUFFER,z.COLOR_ATTACHMENT0,z.TEXTURE_2D,rn.__webglTexture,K),vn?z.framebufferTextureLayer(z.DRAW_FRAMEBUFFER,z.COLOR_ATTACHMENT0,ln.__webglTexture,ce,Mt+Rn):z.framebufferTexture2D(z.DRAW_FRAMEBUFFER,z.COLOR_ATTACHMENT0,z.TEXTURE_2D,ln.__webglTexture,ce),K!==0?z.blitFramebuffer(qe,Ze,_e,Le,je,ct,_e,Le,z.COLOR_BUFFER_BIT,z.NEAREST):vn?z.copyTexSubImage3D(Wt,ce,je,ct,Mt+Rn,qe,Ze,_e,Le):z.copyTexSubImage2D(Wt,ce,je,ct,qe,Ze,_e,Le);Me.bindFramebuffer(z.READ_FRAMEBUFFER,null),Me.bindFramebuffer(z.DRAW_FRAMEBUFFER,null)}else vn?P.isDataTexture||P.isData3DTexture?z.texSubImage3D(Wt,ce,je,ct,Mt,_e,Le,Re,mt,at,ft.data):G.isCompressedArrayTexture?z.compressedTexSubImage3D(Wt,ce,je,ct,Mt,_e,Le,Re,mt,ft.data):z.texSubImage3D(Wt,ce,je,ct,Mt,_e,Le,Re,mt,at,ft):P.isDataTexture?z.texSubImage2D(z.TEXTURE_2D,ce,je,ct,_e,Le,mt,at,ft.data):P.isCompressedTexture?z.compressedTexSubImage2D(z.TEXTURE_2D,ce,je,ct,ft.width,ft.height,mt,ft.data):z.texSubImage2D(z.TEXTURE_2D,ce,je,ct,_e,Le,mt,at,ft);z.pixelStorei(z.UNPACK_ROW_LENGTH,At),z.pixelStorei(z.UNPACK_IMAGE_HEIGHT,Ot),z.pixelStorei(z.UNPACK_SKIP_PIXELS,an),z.pixelStorei(z.UNPACK_SKIP_ROWS,Pt),z.pixelStorei(z.UNPACK_SKIP_IMAGES,Xt),ce===0&&G.generateMipmaps&&z.generateMipmap(Wt),Me.unbindTexture()},this.copyTextureToTexture3D=function(P,G,q=null,Y=null,K=0){return qo('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(P,G,q,Y,K)},this.initRenderTarget=function(P){Ne.get(P).__webglFramebuffer===void 0&&it.setupRenderTarget(P)},this.initTexture=function(P){P.isCubeTexture?it.setTextureCube(P,0):P.isData3DTexture?it.setTexture3D(P,0):P.isDataArrayTexture||P.isCompressedArrayTexture?it.setTexture2DArray(P,0):it.setTexture2D(P,0),Me.unbindTexture()},this.resetState=function(){I=0,N=0,D=null,Me.reset(),Ce.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Bi}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=qt._getDrawingBufferColorSpace(e),t.unpackColorSpace=qt._getUnpackColorSpace()}}const UC=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:Mp,AddEquation:rs,AddOperation:y_,AdditiveAnimationBlendMode:Rp,AdditiveBlending:tp,AgXToneMapping:E_,AlphaFormat:Tp,AlwaysCompare:z_,AlwaysDepth:Du,AlwaysStencilFunc:op,AmbientLight:Dy,AnimationAction:Vy,AnimationClip:_l,AnimationLoader:K1,AnimationMixer:Ew,AnimationObjectGroup:Mw,AnimationUtils:q1,ArcCurve:iy,ArrayCamera:zy,ArrowHelper:Xw,AttachedBindMode:rp,Audio:ky,AudioAnalyser:fw,AudioContext:em,AudioListener:cw,AudioLoader:ow,AxesHelper:Yw,BackSide:si,BasicDepthPacking:I_,BasicShadowMap:$0,BatchedMesh:Q_,Bone:Op,BooleanKeyframeTrack:io,Box2:Pw,Box3:Jn,Box3Helper:Gw,BoxGeometry:no,BoxHelper:Vw,BufferAttribute:nn,BufferGeometry:zt,BufferGeometryLoader:By,ByteType:vh,Cache:Ur,Camera:Cl,CameraHelper:Hw,CanvasTexture:g1,CapsuleGeometry:Lh,CatmullRomCurve3:ry,CineonToneMapping:M_,CircleGeometry:Dh,ClampToEdgeWrapping:Cn,Clock:tm,Color:rt,ColorKeyframeTrack:Kp,ColorManagement:qt,CompressedArrayTexture:p1,CompressedCubeTexture:m1,CompressedTexture:Ph,CompressedTextureLoader:Q1,ConeGeometry:Ll,ConstantAlphaFactor:g_,ConstantColorFactor:p_,Controls:Zw,CubeCamera:Y_,CubeReflectionMapping:dr,CubeRefractionMapping:cs,CubeTexture:Rl,CubeTextureLoader:Cy,CubeUVReflectionMapping:aa,CubicBezierCurve:Hp,CubicBezierCurve3:sy,CubicInterpolant:Ey,CullFaceBack:ep,CullFaceFront:Q0,CullFaceFrontBack:ES,CullFaceNone:K0,Curve:Qi,CurvePath:ay,CustomBlending:e_,CustomToneMapping:w_,CylinderGeometry:Pl,Cylindrical:Iw,Data3DTexture:Th,DataArrayTexture:Eh,DataTexture:Ki,DataTextureLoader:Qp,DataUtils:Ys,DecrementStencilOp:OS,DecrementWrapStencilOp:zS,DefaultLoadingManager:Ay,DepthFormat:$o,DepthStencilFormat:ea,DepthTexture:zp,DetachedBindMode:b_,DirectionalLight:Ly,DirectionalLightHelper:kw,DiscreteInterpolant:Ty,DodecahedronGeometry:Uh,DoubleSide:ji,DstAlphaFactor:c_,DstColorFactor:h_,DynamicCopyUsage:eM,DynamicDrawUsage:ZS,DynamicReadUsage:KS,EdgesGeometry:ny,EllipseCurve:Nh,EqualCompare:N_,EqualDepth:Nu,EqualStencilFunc:GS,EquirectangularReflectionMapping:Jo,EquirectangularRefractionMapping:rl,Euler:Ai,EventDispatcher:gr,ExtrudeGeometry:Fh,FileLoader:bi,Float16BufferAttribute:qM,Float32BufferAttribute:ht,FloatType:pn,Fog:Ah,FogExp2:bh,FramebufferTexture:d1,FrontSide:Or,Frustum:la,FrustumArray:Ih,GLBufferAttribute:Rw,GLSL1:nM,GLSL3:ap,GreaterCompare:F_,GreaterDepth:Ou,GreaterEqualCompare:B_,GreaterEqualDepth:Fu,GreaterEqualStencilFunc:qS,GreaterStencilFunc:XS,GridHelper:Bw,Group:Wo,HalfFloatType:Bn,HemisphereLight:Ry,HemisphereLightHelper:Ow,IcosahedronGeometry:Dl,ImageBitmapLoader:sw,ImageLoader:yl,ImageUtils:V_,IncrementStencilOp:FS,IncrementWrapStencilOp:BS,InstancedBufferAttribute:ia,InstancedBufferGeometry:Oy,InstancedInterleavedBuffer:Cw,InstancedMesh:K_,Int16BufferAttribute:XM,Int32BufferAttribute:YM,Int8BufferAttribute:VM,IntType:Tl,InterleavedBuffer:Ch,InterleavedBufferAttribute:$s,Interpolant:Fl,InterpolateDiscrete:al,InterpolateLinear:hh,InterpolateSmooth:bu,InterpolationSamplingMode:sM,InterpolationSamplingType:rM,InvertStencilOp:kS,KeepStencilOp:Hs,KeyframeTrack:ki,LOD:j_,LatheGeometry:Oh,Layers:Ks,LessCompare:U_,LessDepth:Uu,LessEqualCompare:Ip,LessEqualDepth:Qs,LessEqualStencilFunc:WS,LessStencilFunc:VS,Light:ps,LightProbe:Fy,Line:us,Line3:Lw,LineBasicMaterial:ai,LineCurve:Vp,LineCurve3:oy,LineDashedMaterial:Sy,LineLoop:$_,LineSegments:vr,LinearFilter:tn,LinearInterpolant:Jp,LinearMipMapLinearFilter:sp,LinearMipMapNearestFilter:AS,LinearMipmapLinearFilter:ur,LinearMipmapNearestFilter:Za,LinearSRGBColorSpace:mr,LinearToneMapping:x_,LinearTransfer:cl,Loader:li,LoaderUtils:fp,LoadingManager:Wh,LoopOnce:A_,LoopPingPong:R_,LoopRepeat:C_,MOUSE:zs,Material:Kn,MaterialLoader:Xh,MathUtils:M
vendor: 79,087 bytes, lines 3827-3857
3827M,Matrix2:om,Matrix3:Ut,Matrix4:bt,MaxEquation:r_,Mesh:mn,MeshBasicMaterial:Br,MeshDepthMaterial:qp,MeshDistanceMaterial:Zp,MeshLambertMaterial:yy,MeshMatcapMaterial:xy,MeshNormalMaterial:_y,MeshPhongMaterial:gy,MeshPhysicalMaterial:my,MeshStandardMaterial:Yp,MeshToonMaterial:vy,MinEquation:i_,MirroredRepeatWrapping:ol,MixOperation:__,MultiplyBlending:ip,MultiplyOperation:El,NearestFilter:kn,NearestMipMapLinearFilter:bS,NearestMipMapNearestFilter:TS,NearestMipmapLinearFilter:Vo,NearestMipmapNearestFilter:wp,NeutralToneMapping:T_,NeverCompare:D_,NeverDepth:Lu,NeverStencilFunc:HS,NoBlending:hr,NoColorSpace:Lr,NoToneMapping:fr,NormalAnimationBlendMode:wh,NormalBlending:js,NotEqualCompare:O_,NotEqualDepth:Bu,NotEqualStencilFunc:YS,NumberKeyframeTrack:gl,Object3D:Jt,ObjectLoader:iw,ObjectSpaceNormalMap:L_,OctahedronGeometry:Ul,OneFactor:o_,OneMinusConstantAlphaFactor:v_,OneMinusConstantColorFactor:m_,OneMinusDstAlphaFactor:u_,OneMinusDstColorFactor:f_,OneMinusSrcAlphaFactor:Pu,OneMinusSrcColorFactor:l_,OrthographicCamera:Fr,PCFShadowMap:gh,PCFSoftShadowMap:qa,PMREMGenerator:gp,Path:mh,PerspectiveCamera:wn,Plane:Pr,PlaneGeometry:ds,PlaneHelper:Ww,PointLight:Py,PointLightHelper:Nw,Points:ey,PointsMaterial:Bp,PolarGridHelper:zw,PolyhedronGeometry:fs,PositionalAudio:hw,PropertyBinding:Zt,PropertyMixer:Hy,QuadraticBezierCurve:Gp,QuadraticBezierCurve3:Wp,Quaternion:jn,QuaternionKeyframeTrack:Ol,QuaternionLinearInterpolant:by,RED_GREEN_RGTC2_Format:ch,RED_RGTC1_Format:Cp,REVISION:wl,RGBADepthPacking:P_,RGBAFormat:En,RGBAIntegerFormat:Mh,RGBA_ASTC_10x10_Format:ih,RGBA_ASTC_10x5_Format:eh,RGBA_ASTC_10x6_Format:th,RGBA_ASTC_10x8_Format:nh,RGBA_ASTC_12x10_Format:rh,RGBA_ASTC_12x12_Format:sh,RGBA_ASTC_4x4_Format:Yu,RGBA_ASTC_5x4_Format:qu,RGBA_ASTC_5x5_Format:Zu,RGBA_ASTC_6x5_Format:ju,RGBA_ASTC_6x6_Format:Ju,RGBA_ASTC_8x5_Format:Ku,RGBA_ASTC_8x6_Format:Qu,RGBA_ASTC_8x8_Format:$u,RGBA_BPTC_Format:$a,RGBA_ETC2_EAC_Format:Xu,RGBA_PVRTC_2BPPV1_Format:Vu,RGBA_PVRTC_4BPPV1_Format:Hu,RGBA_S3TC_DXT1_Format:Ja,RGBA_S3TC_DXT3_Format:Ka,RGBA_S3TC_DXT5_Format:Qa,RGBDepthPacking:LS,RGBFormat:bp,RGBIntegerFormat:CS,RGB_BPTC_SIGNED_Format:oh,RGB_BPTC_UNSIGNED_Format:ah,RGB_ETC1_Format:Gu,RGB_ETC2_Format:Wu,RGB_PVRTC_2BPPV1_Format:ku,RGB_PVRTC_4BPPV1_Format:zu,RGB_S3TC_DXT1_Format:ja,RGDepthPacking:DS,RGFormat:Ap,RGIntegerFormat:Sh,RawShaderMaterial:py,Ray:to,Raycaster:sm,RectAreaLight:Uy,RedFormat:bl,RedIntegerFormat:Al,ReinhardToneMapping:S_,RenderTarget:Lp,RenderTarget3D:Tw,RepeatWrapping:sl,ReplaceStencilOp:NS,ReverseSubtractEquation:n_,RingGeometry:Bh,SIGNED_RED_GREEN_RGTC2_Format:uh,SIGNED_RED_RGTC1_Format:lh,SRGBColorSpace:ii,SRGBTransfer:en,Scene:Il,ShaderChunk:kt,ShaderLib:Zi,ShaderMaterial:gi,ShadowMaterial:dy,Shape:as,ShapeGeometry:zh,ShapePath:qw,ShapeUtils:Ji,ShortType:_h,Skeleton:Rh,SkeletonHelper:Uw,SkinnedMesh:J_,Source:ss,Sphere:Hn,SphereGeometry:Nl,Spherical:pp,SphericalHarmonics3:Ny,SplineCurve:Xp,SpotLight:Iy,SpotLightHelper:Dw,Sprite:Z_,SpriteMaterial:Fp,SrcAlphaFactor:Iu,SrcAlphaSaturateFactor:d_,SrcColorFactor:a_,StaticCopyUsage:$S,StaticDrawUsage:ul,StaticReadUsage:JS,StereoCamera:aw,StreamCopyUsage:tM,StreamDrawUsage:jS,StreamReadUsage:QS,StringKeyframeTrack:ro,SubtractEquation:t_,SubtractiveBlending:np,TOUCH:ks,TangentSpaceNormalMap:hs,TetrahedronGeometry:kh,Texture:sn,TextureLoader:$1,TextureUtils:$w,TimestampQuery:iM,TorusGeometry:Hh,TorusKnotGeometry:Vh,Triangle:mi,TriangleFanDrawMode:PS,TriangleStripDrawMode:IS,TrianglesDrawMode:RS,TubeGeometry:Gh,UVMapping:ls,Uint16BufferAttribute:Dp,Uint32BufferAttribute:Up,Uint8BufferAttribute:GM,Uint8ClampedBufferAttribute:WM,Uniform:rm,UniformsGroup:Aw,UniformsLib:Qe,UniformsUtils:X_,UnsignedByteType:oi,UnsignedInt248Type:Qo,UnsignedInt5999Type:Ep,UnsignedIntType:pr,UnsignedShort4444Type:yh,UnsignedShort5551Type:xh,UnsignedShortType:Ko,VSMShadowMap:qi,Vector2:we,Vector3:B,Vector4:jt,VectorKeyframeTrack:vl,VideoFrameTexture:f1,VideoTexture:ty,WebGL3DRenderTarget:PM,WebGLArrayRenderTarget:IM,WebGLCoordinateSystem:Bi,WebGLCubeRenderTarget:Np,WebGLRenderTarget:zi,WebGLRenderer:lm,WebGLUtils:jy,WebGPUCoordinateSystem:hl,WebXRController:Au,WireframeGeometry:fy,WrapAroundEnding:ll,ZeroCurvatureEnding:Ws,ZeroFactor:s_,ZeroSlopeEnding:Xs,ZeroStencilOp:US,createCanvasElement:H_},Symbol.toStringTag,{value:"Module"}));var Jy={exports:{}},so={};/** 3828 * @license React 3829 * react-reconciler-constants.production.min.js 3830 * 3831 * Copyright (c) Facebook, Inc. and its affiliates. 3832 * 3833 * This source code is licensed under the MIT license found in the 3834 * LICENSE file in the root directory of this source tree. 3835 */so.ConcurrentRoot=1;so.ContinuousEventPriority=4;so.DefaultEventPriority=16;so.DiscreteEventPriority=1;so.IdleEventPriority=536870912;so.LegacyRoot=0;Jy.exports=so;var Yo=Jy.exports;function NC(r){let e;const t=new Set,n=(h,f)=>{const d=typeof h=="function"?h(e):h;if(d!==e){const m=e;e=f?d:Object.assign({},e,d),t.forEach(g=>g(e,m))}},i=()=>e,s=(h,f=i,d=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let m=f(e);function g(){const y=f(e);if(!d(m,y)){const M=m;h(m=y,M)}}return t.add(g),()=>t.delete(g)},u={setState:n,getState:i,subscribe:(h,f,d)=>f||d?s(h,f,d):(t.add(h),()=>t.delete(h)),destroy:()=>t.clear()};return e=r(n,i,u),u}const FC=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),R0=FC?De.useEffect:De.useLayoutEffect;function Ky(r){const e=typeof r=="function"?NC(r):r,t=(n=e.getState,i=Object.is)=>{const[,s]=De.useReducer(x=>x+1,0),o=e.getState(),c=De.useRef(o),u=De.useRef(n),h=De.useRef(i),f=De.useRef(!1),d=De.useRef();d.current===void 0&&(d.current=n(o));let m,g=!1;(c.current!==o||u.current!==n||h.current!==i||f.current)&&(m=n(o),g=!i(d.current,m)),R0(()=>{g&&(d.current=m),c.current=o,u.current=n,h.current=i,f.current=!1});const y=De.useRef(o);R0(()=>{const x=()=>{try{const w=e.getState(),E=u.current(w);h.current(d.current,E)||(c.current=w,d.current=E,s())}catch{f.current=!0,s()}},v=e.subscribe(x);return e.getState()!==y.current&&x(),v},[]);const M=g?m:d.current;return De.useDebugValue(M),M};return Object.assign(t,e),t[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const n=[t,e];return{next(){const i=n.length<=0;return{value:n.shift(),done:i}}}},t}const OC=r=>typeof r=="object"&&typeof r.then=="function",Zs=[];function Qy(r,e,t=(n,i)=>n===i){if(r===e)return!0;if(!r||!e)return!1;const n=r.length;if(e.length!==n)return!1;for(let i=0;i<n;i++)if(!t(r[i],e[i]))return!1;return!0}function $y(r,e=null,t=!1,n={}){e===null&&(e=[r]);for(const s of Zs)if(Qy(e,s.keys,s.equal)){if(t)return;if(Object.prototype.hasOwnProperty.call(s,"error"))throw s.error;if(Object.prototype.hasOwnProperty.call(s,"response"))return n.lifespan&&n.lifespan>0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,n.lifespan)),s.response;if(!t)throw s.promise}const i={keys:e,equal:n.equal,remove:()=>{const s=Zs.indexOf(i);s!==-1&&Zs.splice(s,1)},promise:(OC(r)?r:r(...e)).then(s=>{i.response=s,n.lifespan&&n.lifespan>0&&(i.timeout=setTimeout(i.remove,n.lifespan))}).catch(s=>i.error=s)};if(Zs.push(i),!t)throw i.promise}const BC=(r,e,t)=>$y(r,e,!1,t),zC=(r,e,t)=>void $y(r,e,!0,t),kC=r=>{if(r===void 0||r.length===0)Zs.splice(0,Zs.length);else{const e=Zs.find(t=>Qy(r,t.keys,t.equal));e&&e.remove()}};var ex={exports:{}},Vd={exports:{}},Gd={};/** 3836 * @license React 3837 * scheduler.production.min.js 3838 * 3839 * Copyright (c) Facebook, Inc. and its affiliates. 3840 * 3841 * This source code is licensed under the MIT license found in the 3842 * LICENSE file in the root directory of this source tree. 3843 */var I0;function HC(){return I0||(I0=1,function(r){function e(k,ee){var Q=k.length;k.push(ee);e:for(;0<Q;){var fe=Q-1>>>1,Se=k[fe];if(0<i(Se,ee))k[fe]=ee,k[Q]=Se,Q=fe;else break e}}function t(k){return k.length===0?null:k[0]}function n(k){if(k.length===0)return null;var ee=k[0],Q=k.pop();if(Q!==ee){k[0]=Q;e:for(var fe=0,Se=k.length,ke=Se>>>1;fe<ke;){var le=2*(fe+1)-1,Ie=k[le],Pe=le+1,Be=k[Pe];if(0>i(Ie,Q))Pe<Se&&0>i(Be,Ie)?(k[fe]=Be,k[Pe]=Q,fe=Pe):(k[fe]=Ie,k[le]=Q,fe=le);else if(Pe<Se&&0>i(Be,Q))k[fe]=Be,k[Pe]=Q,fe=Pe;else break e}}return ee}function i(k,ee){var Q=k.sortIndex-ee.sortIndex;return Q!==0?Q:k.id-ee.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;r.unstable_now=function(){return s.now()}}else{var o=Date,c=o.now();r.unstable_now=function(){return o.now()-c}}var u=[],h=[],f=1,d=null,m=3,g=!1,y=!1,M=!1,x=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(k){for(var ee=t(h);ee!==null;){if(ee.callback===null)n(h);else if(ee.startTime<=k)n(h),ee.sortIndex=ee.expirationTime,e(u,ee);else break;ee=t(h)}}function T(k){if(M=!1,E(k),!y)if(t(u)!==null)y=!0,ne(U);else{var ee=t(h);ee!==null&&xe(T,ee.startTime-k)}}function U(k,ee){y=!1,M&&(M=!1,v(D),D=-1),g=!0;var Q=m;try{for(E(ee),d=t(u);d!==null&&(!(d.expirationTime>ee)||k&&!F());){var fe=d.callback;if(typeof fe=="function"){d.callback=null,m=d.priorityLevel;var Se=fe(d.expirationTime<=ee);ee=r.unstable_now(),typeof Se=="function"?d.callback=Se:d===t(u)&&n(u),E(ee)}else n(u);d=t(u)}if(d!==null)var ke=!0;else{var le=t(h);le!==null&&xe(T,le.startTime-ee),ke=!1}return ke}finally{d=null,m=Q,g=!1}}var I=!1,N=null,D=-1,C=5,A=-1;function F(){return!(r.unstable_now()-A<C)}function j(){if(N!==null){var k=r.unstable_now();A=k;var ee=!0;try{ee=N(!0,k)}finally{ee?Z():(I=!1,N=null)}}else I=!1}var Z;if(typeof w=="function")Z=function(){w(j)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,ae=$.port2;$.port1.onmessage=j,Z=function(){ae.postMessage(null)}}else Z=function(){x(j,0)};function ne(k){N=k,I||(I=!0,Z())}function xe(k,ee){D=x(function(){k(r.unstable_now())},ee)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(k){k.callback=null},r.unstable_continueExecution=function(){y||g||(y=!0,ne(U))},r.unstable_forceFrameRate=function(k){0>k||125<k?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):C=0<k?Math.floor(1e3/k):5},r.unstable_getCurrentPriorityLevel=function(){return m},r.unstable_getFirstCallbackNode=function(){return t(u)},r.unstable_next=function(k){switch(m){case 1:case 2:case 3:var ee=3;break;default:ee=m}var Q=m;m=ee;try{return k()}finally{m=Q}},r.unstable_pauseExecution=function(){},r.unstable_requestPaint=function(){},r.unstable_runWithPriority=function(k,ee){switch(k){case 1:case 2:case 3:case 4:case 5:break;default:k=3}var Q=m;m=k;try{return ee()}finally{m=Q}},r.unstable_scheduleCallback=function(k,ee,Q){var fe=r.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?fe+Q:fe):Q=fe,k){case 1:var Se=-1;break;case 2:Se=250;break;case 5:Se=1073741823;break;case 4:Se=1e4;break;default:Se=5e3}return Se=Q+Se,k={id:f++,callback:ee,priorityLevel:k,startTime:Q,expirationTime:Se,sortIndex:-1},Q>fe?(k.sortIndex=Q,e(h,k),t(u)===null&&k===t(h)&&(M?(v(D),D=-1):M=!0,xe(T,Q-fe))):(k.sortIndex=Se,e(u,k),y||g||(y=!0,ne(U))),k},r.unstable_shouldYield=F,r.unstable_wrapCallback=function(k){var ee=m;return function(){var Q=m;m=ee;try{return k.apply(this,arguments)}finally{m=Q}}}}(Gd)),Gd}var P0;function VC(){return P0||(P0=1,Vd.exports=HC()),Vd.exports}/** 3844 * @license React 3845 * react-reconciler.production.min.js 3846 * 3847 * Copyright (c) Facebook, Inc. and its affiliates. 3848 * 3849 * This source code is licensed under the MIT license found in the 3850 * LICENSE file in the root directory of this source tree. 3851 */var GC=function(e){var t={},n=De,i=VC(),s=Object.assign;function o(a){for(var l="https://reactjs.org/docs/error-decoder.html?invariant="+a,p=1;p<arguments.length;p++)l+="&args[]="+encodeURIComponent(arguments[p]);return"Minified React error #"+a+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var c=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,u=Symbol.for("react.element"),h=Symbol.for("react.portal"),f=Symbol.for("react.fragment"),d=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),y=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),v=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),E=Symbol.for("react.lazy"),T=Symbol.for("react.offscreen"),U=Symbol.iterator;function I(a){return a===null||typeof a!="object"?null:(a=U&&a[U]||a["@@iterator"],typeof a=="function"?a:null)}function N(a){if(a==null)return null;if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case f:return"Fragment";case h:return"Portal";case m:return"Profiler";case d:return"StrictMode";case x:return"Suspense";case v:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case y:return(a.displayName||"Context")+".Consumer";case g:return(a._context.displayName||"Context")+".Provider";case M:var l=a.render;return a=a.displayName,a||(a=l.displayName||l.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case w:return l=a.displayName||null,l!==null?l:N(a.type)||"Memo";case E:l=a._payload,a=a._init;try{return N(a(l))}catch{}}return null}function D(a){var l=a.type;switch(a.tag){case 24:return"Cache";case 9:return(l.displayName||"Context")+".Consumer";case 10:return(l._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return a=l.render,a=a.displayName||a.name||"",l.displayName||(a!==""?"ForwardRef("+a+")":"ForwardRef");case 7:return"Fragment";case 5:return l;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return N(l);case 8:return l===d?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l}return null}function C(a){var l=a,p=a;if(a.alternate)for(;l.return;)l=l.return;else{a=l;do l=a,l.flags&4098&&(p=l.return),a=l.return;while(a)}return l.tag===3?p:null}function A(a){if(C(a)!==a)throw Error(o(188))}function F(a){var l=a.alternate;if(!l){if(l=C(a),l===null)throw Error(o(188));return l!==a?null:a}for(var p=a,_=l;;){var S=p.return;if(S===null)break;var b=S.alternate;if(b===null){if(_=S.return,_!==null){p=_;continue}break}if(S.child===b.child){for(b=S.child;b;){if(b===p)return A(S),a;if(b===_)return A(S),l;b=b.sibling}throw Error(o(188))}if(p.return!==_.return)p=S,_=b;else{for(var V=!1,te=S.child;te;){if(te===p){V=!0,p=S,_=b;break}if(te===_){V=!0,_=S,p=b;break}te=te.sibling}if(!V){for(te=b.child;te;){if(te===p){V=!0,p=b,_=S;break}if(te===_){V=!0,_=b,p=S;break}te=te.sibling}if(!V)throw Error(o(189))}}if(p.alternate!==_)throw Error(o(190))}if(p.tag!==3)throw Error(o(188));return p.stateNode.current===p?a:l}function j(a){return a=F(a),a!==null?Z(a):null}function Z(a){if(a.tag===5||a.tag===6)return a;for(a=a.child;a!==null;){var l=Z(a);if(l!==null)return l;a=a.sibling}return null}function $(a){if(a.tag===5||a.tag===6)return a;for(a=a.child;a!==null;){if(a.tag!==4){var l=$(a);if(l!==null)return l}a=a.sibling}return null}var ae=Array.isArray,ne=e.getPublicInstance,xe=e.getRootHostContext,k=e.getChildHostContext,ee=e.prepareForCommit,Q=e.resetAfterCommit,fe=e.createInstance,Se=e.appendInitialChild,ke=e.finalizeInitialChildren,le=e.prepareUpdate,Ie=e.shouldSetTextContent,Pe=e.createTextInstance,Be=e.scheduleTimeout,nt=e.cancelTimeout,Et=e.noTimeout,dt=e.isPrimaryRenderer,Nt=e.supportsMutation,It=e.supportsPersistence,pt=e.supportsHydration,z=e.getInstanceFromNode,Ve=e.preparePortalMount,Ue=e.getCurrentEventPriority,We=e.detachDeletedInstance,Me=e.supportsMicrotasks,et=e.scheduleMicrotask,Ne=e.supportsTestSelectors,it=e.findFiberRoot,wt=e.getBoundingRect,H=e.getTextContent,L=e.isHiddenSubtree,se=e.matchAccessibilityRole,me=e.setFocusIfFocusable,be=e.setupIntersectionObserver,ge=e.appendChild,st=e.appendChildToContainer,Ye=e.commitTextUpdate,ot=e.commitMount,lt=e.commitUpdate,Ae=e.insertBefore,Xe=e.insertInContainerBefore,vt=e.removeChild,X=e.removeChildFromContainer,re=e.resetTextContent,Ce=e.hideInstance,W=e.hideTextInstance,oe=e.unhideInstance,Te=e.unhideTextInstance,Je=e.clearContainer,ze=e.cloneInstance,Ee=e.createContainerChildSet,Ke=e.appendChildToContainerChildSet,_t=e.finalizeContainerChildren,Yt=e.replaceContainerChildren,Ht=e.cloneHiddenInstance,gn=e.cloneHiddenTextInstance,Dn=e.canHydrateInstance,oo=e.canHydrateTextInstance,ao=e.canHydrateSuspenseInstance,Qn=e.isSuspenseInstancePending,_r=e.isSuspenseInstanceFallback,$i=e.registerSuspenseInstanceRetry,ci=e.getNextHydratableSibling,Ft=e.getFirstHydratableChild,ms=e.getFirstHydratableChildWithinContainer,zr=e.getFirstHydratableChildWithinSuspenseInstance,R=e.hydrateInstance,O=e.hydrateTextInstance,J=e.hydrateSuspenseInstance,he=e.getNextHydratableInstanceAfterSuspenseInstance,pe=e.commitHydratedContainer,ve=e.commitHydratedSuspenseInstance,He=e.clearSuspenseBoundary,Oe=e.clearSuspenseBoundaryFromContainer,P=e.shouldDeleteUnhydratedTailInstances,G=e.didNotMatchHydratedContainerTextInstance,q=e.didNotMatchHydratedTextInstance,Y;function K(a){if(Y===void 0)try{throw Error()}catch(p){var l=p.stack.trim().match(/\n( *(at )?)/);Y=l&&l[1]||""}return` 3852`+Y+a}var ce=!1;function _e(a,l){if(!a||ce)return"";ce=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(l)if(l=function(){throw Error()},Object.defineProperty(l.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(l,[])}catch(Ge){var _=Ge}Reflect.construct(a,[],l)}else{try{l.call()}catch(Ge){_=Ge}a.call(l.prototype)}else{try{throw Error()}catch(Ge){_=Ge}a()}}catch(Ge){if(Ge&&_&&typeof Ge.stack=="string"){for(var S=Ge.stack.split(` 3853`),b=_.stack.split(` 3854`),V=S.length-1,te=b.length-1;1<=V&&0<=te&&S[V]!==b[te];)te--;for(;1<=V&&0<=te;V--,te--)if(S[V]!==b[te]){if(V!==1||te!==1)do if(V--,te--,0>te||S[V]!==b[te]){var ye=` 3855`+S[V].replace(" at new "," at ");return a.displayName&&ye.includes("<anonymous>")&&(ye=ye.replace("<anonymous>",a.displayName)),ye}while(1<=V&&0<=te);break}}}finally{ce=!1,Error.prepareStackTrace=p}return(a=a?a.displayName||a.name:"")?K(a):""}var Le=Object.prototype.hasOwnProperty,Re=[],qe=-1;function Ze(a){return{current:a}}function Fe(a){0>qe||(a.current=Re[qe],Re[qe]=null,qe--)}function je(a,l){qe++,Re[qe]=a.current,a.current=l}var ct={},Mt=Ze(ct),ft=Ze(!1),mt=ct;function at(a,l){var p=a.type.contextTypes;if(!p)return ct;var _=a.stateNode;if(_&&_.__reactInternalMemoizedUnmaskedChildContext===l)return _.__reactInternalMemoizedMaskedChildContext;var S={},b;for(b in p)S[b]=l[b];return _&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=l,a.__reactInternalMemoizedMaskedChildContext=S),S}function Wt(a){return a=a.childContextTypes,a!=null}function At(){Fe(ft),Fe(Mt)}function Ot(a,l,p){if(Mt.current!==ct)throw Error(o(168));je(Mt,l),je(ft,p)}function an(a,l,p){var _=a.stateNode;if(l=l.childContextTypes,typeof _.getChildContext!="function")return p;_=_.getChildContext();for(var S in _)if(!(S in l))throw Error(o(108,D(a)||"Unknown",S));return s({},p,_)}function Pt(a){return a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||ct,mt=Mt.current,je(Mt,a),je(ft,ft.current),!0}function Xt(a,l,p){var _=a.stateNode;if(!_)throw Error(o(169));p?(a=an(a,l,mt),_.__reactInternalMemoizedMergedChildContext=a,Fe(ft),Fe(Mt),je(Mt,a)):Fe(ft),je(ft,p)}var Tt=Math.clz32?Math.clz32:ln,vn=Math.log,rn=Math.LN2;function ln(a){return a>>>=0,a===0?32:31-(vn(a)/rn|0)|0}var Rn=64,kr=4194304;function vi(a){switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return a}}function kl(a,l){var p=a.pendingLanes;if(p===0)return 0;var _=0,S=a.suspendedLanes,b=a.pingedLanes,V=p&268435455;if(V!==0){var te=V&~S;te!==0?_=vi(te):(b&=V,b!==0&&(_=vi(b)))}else V=p&~S,V!==0?_=vi(V):b!==0&&(_=vi(b));if(_===0)return 0;if(l!==0&&l!==_&&!(l&S)&&(S=_&-_,b=l&-l,S>=b||S===16&&(b&4194240)!==0))return l;if(_&4&&(_|=p&16),l=a.entangledLanes,l!==0)for(a=a.entanglements,l&=_;0<l;)p=31-Tt(l),S=1<<p,_|=a[p],l&=~S;return _}function Dx(a,l){switch(a){case 1:case 2:case 4:return l+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ux(a,l){for(var p=a.suspendedLanes,_=a.pingedLanes,S=a.expirationTimes,b=a.pendingLanes;0<b;){var V=31-Tt(b),te=1<<V,ye=S[V];ye===-1?(!(te&p)||te&_)&&(S[V]=Dx(te,l)):ye<=l&&(a.expiredLanes|=te),b&=~te}}function Zh(a){return a=a.pendingLanes&-1073741825,a!==0?a:a&1073741824?1073741824:0}function jh(a){for(var l=[],p=0;31>p;p++)l.push(a);return l}function ua(a,l,p){a.pendingLanes|=l,l!==536870912&&(a.suspendedLanes=0,a.pingedLanes=0),a=a.eventTimes,l=31-Tt(l),a[l]=p}function Nx(a,l){var p=a.pendingLanes&~l;a.pendingLanes=l,a.suspendedLanes=0,a.pingedLanes=0,a.expiredLanes&=l,a.mutableReadLanes&=l,a.entangledLanes&=l,l=a.entanglements;var _=a.eventTimes;for(a=a.expirationTimes;0<p;){var S=31-Tt(p),b=1<<S;l[S]=0,_[S]=-1,a[S]=-1,p&=~b}}function Jh(a,l){var p=a.entangledLanes|=l;for(a=a.entanglements;p;){var _=31-Tt(p),S=1<<_;S&l|a[_]&l&&(a[_]|=l),p&=~S}}var Kt=0;function Sm(a){return a&=-a,1<a?4<a?a&268435455?16:536870912:4:1}var Kh=i.unstable_scheduleCallback,Mm=i.unstable_cancelCallback,Fx=i.unstable_shouldYield,Ox=i.unstable_requestPaint,Un=i.unstable_now,Qh=i.unstable_ImmediatePriority,Bx=i.unstable_UserBlockingPriority,$h=i.unstable_NormalPriority,zx=i.unstable_IdlePriority,Hl=null,er=null;function kx(a){if(er&&typeof er.onCommitFiberRoot=="function")try{er.onCommitFiberRoot(Hl,a,void 0,(a.current.flags&128)===128)}catch{}}function Hx(a,l){return a===l&&(a!==0||1/a===1/l)||a!==a&&l!==l}var tr=typeof Object.is=="function"?Object.is:Hx,yr=null,Vl=!1,ef=!1;function wm(a){yr===null?yr=[a]:yr.push(a)}function Vx(a){Vl=!0,wm(a)}function nr(){if(!ef&&yr!==null){ef=!0;var a=0,l=Kt;try{var p=yr;for(Kt=1;a<p.length;a++){var _=p[a];do _=_(!0);while(_!==null)}yr=null,Vl=!1}catch(S){throw yr!==null&&(yr=yr.slice(a+1)),Kh(Qh,nr),S}finally{Kt=l,ef=!1}}return null}var Gx=c.ReactCurrentBatchConfig;function Gl(a,l){if(tr(a,l))return!0;if(typeof a!="object"||a===null||typeof l!="object"||l===null)return!1;var p=Object.keys(a),_=Object.keys(l);if(p.length!==_.length)return!1;for(_=0;_<p.length;_++){var S=p[_];if(!Le.call(l,S)||!tr(a[S],l[S]))return!1}return!0}function Wx(a){switch(a.tag){case 5:return K(a.type);case 16:return K("Lazy");case 13:return K("Suspense");case 19:return K("SuspenseList");case 0:case 2:case 15:return a=_e(a.type,!1),a;case 11:return a=_e(a.type.render,!1),a;case 1:return a=_e(a.type,!0),a;default:return""}}function Hi(a,l){if(a&&a.defaultProps){l=s({},l),a=a.defaultProps;for(var p in a)l[p]===void 0&&(l[p]=a[p]);return l}return l}var Wl=Ze(null),Xl=null,lo=null,tf=null;function nf(){tf=lo=Xl=null}function Em(a,l,p){dt?(je(Wl,l._currentValue),l._currentValue=p):(je(Wl,l._currentValue2),l._currentValue2=p)}function rf(a){var l=Wl.current;Fe(Wl),dt?a._currentValue=l:a._currentValue2=l}function sf(a,l,p){for(;a!==null;){var _=a.alternate;if((a.childLanes&l)!==l?(a.childLanes|=l,_!==null&&(_.childLanes|=l)):_!==null&&(_.childLanes&l)!==l&&(_.childLanes|=l),a===p)break;a=a.return}}function co(a,l){Xl=a,tf=lo=null,a=a.dependencies,a!==null&&a.firstContext!==null&&(a.lanes&l&&(xi=!0),a.firstContext=null)}function Ci(a){var l=dt?a._currentValue:a._currentValue2;if(tf!==a)if(a={context:a,memoizedValue:l,next:null},lo===null){if(Xl===null)throw Error(o(308));lo=a,Xl.dependencies={lanes:0,firstContext:a}}else lo=lo.next=a;return l}var ir=null,Hr=!1;function of(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Tm(a,l){a=a.updateQueue,l.updateQueue===a&&(l.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,effects:a.effects})}function xr(a,l){return{eventTime:a,lane:l,tag:0,payload:null,callback:null,next:null}}function Vr(a,l){var p=a.updateQueue;p!==null&&(p=p.shared,Tn!==null&&a.mode&1&&!(Gt&2)?(a=p.interleaved,a===null?(l.next=l,ir===null?ir=[p]:ir.push(p)):(l.next=a.next,a.next=l),p.interleaved=l):(a=p.pending,a===null?l.next=l:(l.next=a.next,a.next=l),p.pending=l))}function Yl(a,l,p){if(l=l.updateQueue,l!==null&&(l=l.shared,(p&4194240)!==0)){var _=l.lanes;_&=a.pendingLanes,p|=_,l.lanes=p,Jh(a,p)}}function bm(a,l){var p=a.updateQueue,_=a.alternate;if(_!==null&&(_=_.updateQueue,p===_)){var S=null,b=null;if(p=p.firstBaseUpdate,p!==null){do{var V={eventTime:p.eventTime,lane:p.lane,tag:p.tag,payload:p.payload,callback:p.callback,next:null};b===null?S=b=V:b=b.next=V,p=p.next}while(p!==null);b===null?S=b=l:b=b.next=l}else S=b=l;p={baseState:_.baseState,firstBaseUpdate:S,lastBaseUpdate:b,shared:_.shared,effects:_.effects},a.updateQueue=p;return}a=p.lastBaseUpdate,a===null?p.firstBaseUpdate=l:a.next=l,p.lastBaseUpdate=l}function ql(a,l,p,_){var S=a.updateQueue;Hr=!1;var b=S.firstBaseUpdate,V=S.lastBaseUpdate,te=S.shared.pending;if(te!==null){S.shared.pending=null;var ye=te,Ge=ye.next;ye.next=null,V===null?b=Ge:V.next=Ge,V=ye;var ut=a.alternate;ut!==null&&(ut=ut.updateQueue,te=ut.lastBaseUpdate,te!==V&&(te===null?ut.firstBaseUpdate=Ge:te.next=Ge,ut.lastBaseUpdate=ye))}if(b!==null){var Lt=S.baseState;V=0,ut=Ge=ye=null,te=b;do{var xt=te.lane,on=te.eventTime;if((_&xt)===xt){ut!==null&&(ut=ut.next={eventTime:on,lane:0,tag:te.tag,payload:te.payload,callback:te.callback,next:null});e:{var yt=a,Xn=te;switch(xt=l,on=p,Xn.tag){case 1:if(yt=Xn.payload,typeof yt=="function"){Lt=yt.call(on,Lt,xt);break e}Lt=yt;break e;case 3:yt.flags=yt.flags&-65537|128;case 0:if(yt=Xn.payload,xt=typeof yt=="function"?yt.call(on,Lt,xt):yt,xt==null)break e;Lt=s({},Lt,xt);break e;case 2:Hr=!0}}te.callback!==null&&te.lane!==0&&(a.flags|=64,xt=S.effects,xt===null?S.effects=[te]:xt.push(te))}else on={eventTime:on,lane:xt,tag:te.tag,payload:te.payload,callback:te.callback,next:null},ut===null?(Ge=ut=on,ye=Lt):ut=ut.next=on,V|=xt;if(te=te.next,te===null){if(te=S.shared.pending,te===null)break;xt=te,te=xt.next,xt.next=null,S.lastBaseUpdate=xt,S.shared.pending=null}}while(!0);if(ut===null&&(ye=Lt),S.baseState=ye,S.firstBaseUpdate=Ge,S.lastBaseUpdate=ut,l=S.shared.interleaved,l!==null){S=l;do V|=S.lane,S=S.next;while(S!==l)}else b===null&&(S.shared.lanes=0);yo|=V,a.lanes=V,a.memoizedState=Lt}}function Am(a,l,p){if(a=l.effects,l.effects=null,a!==null)for(l=0;l<a.length;l++){var _=a[l],S=_.callback;if(S!==null){if(_.callback=null,_=p,typeof S!="function")throw Error(o(191,S));S.call(_)}}}var Cm=new n.Component().refs;function af(a,l,p,_){l=a.memoizedState,p=p(_,l),p=p==null?l:s({},l,p),a.memoizedState=p,a.lanes===0&&(a.updateQueue.baseState=p)}var Zl={isMounted:function(a){return(a=a._reactInternals)?C(a)===a:!1},enqueueSetState:function(a,l,p){a=a._reactInternals;var _=ei(),S=Xr(a),b=xr(_,S);b.payload=l,p!=null&&(b.callback=p),Vr(a,b),l=Di(a,S,_),l!==null&&Yl(l,a,S)},enqueueReplaceState:function(a,l,p){a=a._reactInternals;var _=ei(),S=Xr(a),b=xr(_,S);b.tag=1,b.payload=l,p!=null&&(b.callback=p),Vr(a,b),l=Di(a,S,_),l!==null&&Yl(l,a,S)},enqueueForceUpdate:function(a,l){a=a._reactInternals;var p=ei(),_=Xr(a),S=xr(p,_);S.tag=2,l!=null&&(S.callback=l),Vr(a,S),l=Di(a,_,p),l!==null&&Yl(l,a,_)}};function Rm(a,l,p,_,S,b,V){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(_,b,V):l.prototype&&l.prototype.isPureReactComponent?!Gl(p,_)||!Gl(S,b):!0}function Im(a,l,p){var _=!1,S=ct,b=l.contextType;return typeof b=="object"&&b!==null?b=Ci(b):(S=Wt(l)?mt:Mt.current,_=l.contextTypes,b=(_=_!=null)?at(a,S):ct),l=new l(p,b),a.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,l.updater=Zl,a.stateNode=l,l._reactInternals=a,_&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=S,a.__reactInternalMemoizedMaskedChildContext=b),l}function Pm(a,l,p,_){a=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(p,_),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(p,_),l.state!==a&&Zl.enqueueReplaceState(l,l.state,null)}function lf(a,l,p,_){var S=a.stateNode;S.props=p,S.state=a.memoizedState,S.refs=Cm,of(a);var b=l.contextType;typeof b=="object"&&b!==null?S.context=Ci(b):(b=Wt(l)?mt:Mt.current,S.context=at(a,b)),S.state=a.memoizedState,b=l.getDerivedStateFromProps,typeof b=="function"&&(af(a,l,b,p),S.state=a.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(l=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),l!==S.state&&Zl.enqueueReplaceState(S,S.state,null),ql(a,p,S,_),S.state=a.memoizedState),typeof S.componentDidMount=="function"&&(a.flags|=4194308)}var uo=[],ho=0,jl=null,Jl=0,Ri=[],Ii=0,gs=null,Sr=1,Mr="";function vs(a,l){uo[ho++]=Jl,uo[ho++]=jl,jl=a,Jl=l}function Lm(a,l,p){Ri[Ii++]=Sr,Ri[Ii++]=Mr,Ri[Ii++]=gs,gs=a;var _=Sr;a=Mr;var S=32-Tt(_)-1;_&=~(1<<S),p+=1;var b=32-Tt(l)+S;if(30<b){var V=S-S%5;b=(_&(1<<V)-1).toString(32),_>>=V,S-=V,Sr=1<<32-Tt(l)+S|p<<S|_,Mr=b+a}else Sr=1<<b|p<<S|_,Mr=a}function cf(a){a.return!==null&&(vs(a,1),Lm(a,1,0))}function uf(a){for(;a===jl;)jl=uo[--ho],uo[ho]=null,Jl=uo[--ho],uo[ho]=null;for(;a===gs;)gs=Ri[--Ii],Ri[Ii]=null,Mr=Ri[--Ii],Ri[Ii]=null,Sr=Ri[--Ii],Ri[Ii]=null}var _i=null,yi=null,hn=!1,ha=!1,Vi=null;function Dm(a,l){var p=Ui(5,null,null,0);p.elementType="DELETED",p.stateNode=l,p.return=a,l=a.deletions,l===null?(a.deletions=[p],a.flags|=16):l.push(p)}function Um(a,l){switch(a.tag){case 5:return l=Dn(l,a.type,a.pendingProps),l!==null?(a.stateNode=l,_i=a,yi=Ft(l),!0):!1;case 6:return l=oo(l,a.pendingProps),l!==null?(a.stateNode=l,_i=a,yi=null,!0):!1;case 13:if(l=ao(l),l!==null){var p=gs!==null?{id:Sr,overflow:Mr}:null;return a.memoizedState={dehydrated:l,treeContext:p,retryLane:1073741824},p=Ui(18,null,null,0),p.stateNode=l,p.return=a,a.child=p,_i=a,yi=null,!0}return!1;default:return!1}}function hf(a){return(a.mode&1)!==0&&(a.flags&128)===0}function ff(a){if(hn){var l=yi;if(l){var p=l;if(!Um(a,l)){if(hf(a))throw Error(o(418));l=ci(p);var _=_i;l&&Um(a,l)?Dm(_,p):(a.flags=a.flags&-4097|2,hn=!1,_i=a)}}else{if(hf(a))throw Error(o(418));a.flags=a.flags&-4097|2,hn=!1,_i=a}}}function Nm(a){for(a=a.return;a!==null&&a.tag!==5&&a.tag!==3&&a.tag!==13;)a=a.return;_i=a}function fa(a){if(!pt||a!==_i)return!1;if(!hn)return Nm(a),hn=!0,!1;if(a.tag!==3&&(a.tag!==5||P(a.type)&&!Ie(a.type,a.memoizedProps))){var l=yi;if(l){if(hf(a)){for(a=yi;a;)a=ci(a);throw Error(o(418))}for(;l;)Dm(a,l),l=ci(l)}}if(Nm(a),a.tag===13){if(!pt)throw Error(o(316));if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(o(317));yi=he(a)}else yi=_i?ci(a.stateNode):null;return!0}function fo(){pt&&(yi=_i=null,ha=hn=!1)}function df(a){Vi===null?Vi=[a]:Vi.push(a)}function da(a,l,p){if(a=p.ref,a!==null&&typeof a!="function"&&typeof a!="object"){if(p._owner){if(p=p._owner,p){if(p.tag!==1)throw Error(o(309));var _=p.stateNode}if(!_)throw Error(o(147,a));var S=_,b=""+a;return l!==null&&l.ref!==null&&typeof l.ref=="function"&&l.ref._stringRef===b?l.ref:(l=function(V){var te=S.refs;te===Cm&&(te=S.refs={}),V===null?delete te[b]:te[b]=V},l._stringRef=b,l)}if(typeof a!="string")throw Error(o(284));if(!p._owner)throw Error(o(290,a))}return a}function Kl(a,l){throw a=Object.prototype.toString.call(l),Error(o(31,a==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":a))}function Fm(a){var l=a._init;return l(a._payload)}function Om(a){function l(ue,ie){if(a){var de=ue.deletions;de===null?(ue.deletions=[ie],ue.flags|=16):de.push(ie)}}function p(ue,ie){if(!a)return null;for(;ie!==null;)l(ue,ie),ie=ie.sibling;return null}function _(ue,ie){for(ue=new Map;ie!==null;)ie.key!==null?ue.set(ie.key,ie):ue.set(ie.index,ie),ie=ie.sibling;return ue}function S(ue,ie){return ue=qr(ue,ie),ue.index=0,ue.sibling=null,ue}function b(ue,ie,de){return ue.index=de,a?(de=ue.alternate,de!==null?(de=de.index,de<ie?(ue.flags|=2,ie):de):(ue.flags|=2,ie)):(ue.flags|=1048576,ie)}function V(ue){return a&&ue.alternate===null&&(ue.flags|=2),ue}function te(ue,ie,de,tt){return ie===null||ie.tag!==6?(ie=Jf(de,ue.mode,tt),ie.return=ue,ie):(ie=S(ie,de),ie.return=ue,ie)}function ye(ue,ie,de,tt){var gt=de.type;return gt===f?ut(ue,ie,de.props.children,tt,de.key):ie!==null&&(ie.elementType===gt||typeof gt=="object"&>!==null&>.$$typeof===E&&Fm(gt)===ie.type)?(tt=S(ie,de.props),tt.ref=da(ue,ie,de),tt.return=ue,tt):(tt=Cc(de.type,de.key,de.props,null,ue.mode,tt),tt.ref=da(ue,ie,de),tt.return=ue,tt)}function Ge(ue,ie,de,tt){return ie===null||ie.tag!==4||ie.stateNode.containerInfo!==de.containerInfo||ie.stateNode.implementation!==de.implementation?(ie=Kf(de,ue.mode,tt),ie.return=ue,ie):(ie=S(ie,de.children||[]),ie.return=ue,ie)}function ut(ue,ie,de,tt,gt){return ie===null||ie.tag!==7?(ie=Es(de,ue.mode,tt,gt),ie.return=ue,ie):(ie=S(ie,de),ie.return=ue,ie)}function Lt(ue,ie,de){if(typeof ie=="string"&&ie!==""||typeof ie=="number")return ie=Jf(""+ie,ue.mode,de),ie.return=ue,ie;if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case u:return de=Cc(ie.type,ie.key,ie.props,null,ue.mode,de),de.ref=da(ue,null,ie),de.return=ue,de;case h:return ie=Kf(ie,ue.mode,de),ie.return=ue,ie;case E:var tt=ie._init;return Lt(ue,tt(ie._payload),de)}if(ae(ie)||I(ie))return ie=Es(ie,ue.mode,de,null),ie.return=ue,ie;Kl(ue,ie)}return null}function xt(ue,ie,de,tt){var gt=ie!==null?ie.key:null;if(typeof de=="string"&&de!==""||typeof de=="number")return gt!==null?null:te(ue,ie,""+de,tt);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case u:return de.key===gt?ye(ue,ie,de,tt):null;case h:return de.key===gt?Ge(ue,ie,de,tt):null;case E:return gt=de._init,xt(ue,ie,gt(de._payload),tt)}if(ae(de)||I(de))return gt!==null?null:ut(ue,ie,de,tt,null);Kl(ue,de)}return null}function on(ue,ie,de,tt,gt){if(typeof tt=="string"&&tt!==""||typeof tt=="number")return ue=ue.get(de)||null,te(ie,ue,""+tt,gt);if(typeof tt=="object"&&tt!==null){switch(tt.$$typeof){case u:return ue=ue.get(tt.key===null?de:tt.key)||null,ye(ie,ue,tt,gt);case h:return ue=ue.get(tt.key===null?de:tt.key)||null,Ge(ie,ue,tt,gt);case E:var Vt=tt._init;return on(ue,ie,de,Vt(tt._payload),gt)}if(ae(tt)||I(tt))return ue=ue.get(de)||null,ut(ie,ue,tt,gt,null);Kl(ie,tt)}return null}function yt(ue,ie,de,tt){for(var gt=null,Vt=null,Dt=ie,Qt=ie=0,Fn=null;Dt!==null&&Qt<de.length;Qt++){Dt.index>Qt?(Fn=Dt,Dt=null):Fn=Dt.sibling;var $t=xt(ue,Dt,de[Qt],tt);if($t===null){Dt===null&&(Dt=Fn);break}a&&Dt&&$t.alternate===null&&l(ue,Dt),ie=b($t,ie,Qt),Vt===null?gt=$t:Vt.sibling=$t,Vt=$t,Dt=Fn}if(Qt===de.length)return p(ue,Dt),hn&&vs(ue,Qt),gt;if(Dt===null){for(;Qt<de.length;Qt++)Dt=Lt(ue,de[Qt],tt),Dt!==null&&(ie=b(Dt,ie,Qt),Vt===null?gt=Dt:Vt.sibling=Dt,Vt=Dt);return hn&&vs(ue,Qt),gt}for(Dt=_(ue,Dt);Qt<de.length;Qt++)Fn=on(Dt,ue,Qt,de[Qt],tt),Fn!==null&&(a&&Fn.alternate!==null&&Dt.delete(Fn.key===null?Qt:Fn.key),ie=b(Fn,ie,Qt),Vt===null?gt=Fn:Vt.sibling=Fn,Vt=Fn);return a&&Dt.forEach(function(Zr){return l(ue,Zr)}),hn&&vs(ue,Qt),gt}function Xn(ue,ie,de,tt){var gt=I(de);if(typeof gt!="function")throw Error(o(150));if(de=gt.call(de),de==null)throw Error(o(151));for(var Vt=gt=null,Dt=ie,Qt=ie=0,Fn=null,$t=de.next();Dt!==null&&!$t.done;Qt++,$t=de.next()){Dt.index>Qt?(Fn=Dt,Dt=null):Fn=Dt.sibling;var Zr=xt(ue,Dt,$t.value,tt);if(Zr===null){Dt===null&&(Dt=Fn);break}a&&Dt&&Zr.alternate===null&&l(ue,Dt),ie=b(Zr,ie,Qt),Vt===null?gt=Zr:Vt.sibling=Zr,Vt=Zr,Dt=Fn}if($t.done)return p(ue,Dt),hn&&vs(ue,Qt),gt;if(Dt===null){for(;!$t.done;Qt++,$t=de.next())$t=Lt(ue,$t.value,tt),$t!==null&&(ie=b($t,ie,Qt),Vt===null?gt=$t:Vt.sibling=$t,Vt=$t);return hn&&vs(ue,Qt),gt}for(Dt=_(ue,Dt);!$t.done;Qt++,$t=de.next())$t=on(Dt,ue,Qt,$t.value,tt),$t!==null&&(a&&$t.alternate!==null&&Dt.delete($t.key===null?Qt:$t.key),ie=b($t,ie,Qt),Vt===null?gt=$t:Vt.sibling=$t,Vt=$t);return a&&Dt.forEach(function(xS){return l(ue,xS)}),hn&&vs(ue,Qt),gt}function Ni(ue,ie,de,tt){if(typeof de=="object"&&de!==null&&de.type===f&&de.key===null&&(de=de.props.children),typeof de=="object"&&de!==null){switch(de.$$typeof){case u:e:{for(var gt=de.key,Vt=ie;Vt!==null;){if(Vt.key===gt){if(gt=de.type,gt===f){if(Vt.tag===7){p(ue,Vt.sibling),ie=S(Vt,de.props.children),ie.return=ue,ue=ie;break e}}else if(Vt.elementType===gt||typeof gt=="object"&>!==null&>.$$typeof===E&&Fm(gt)===Vt.type){p(ue,Vt.sibling),ie=S(Vt,de.props),ie.ref=da(ue,Vt,de),ie.return=ue,ue=ie;break e}p(ue,Vt);break}else l(ue,Vt);Vt=Vt.sibling}de.type===f?(ie=Es(de.props.children,ue.mode,tt,de.key),ie.return=ue,ue=ie):(tt=Cc(de.type,de.key,de.props,null,ue.mode,tt),tt.ref=da(ue,ie,de),tt.return=ue,ue=tt)}return V(ue);case h:e:{for(Vt=de.key;ie!==null;){if(ie.key===Vt)if(ie.tag===4&&ie.stateNode.containerInfo===de.containerInfo&&ie.stateNode.implementation===de.implementation){p(ue,ie.sibling),ie=S(ie,de.children||[]),ie.return=ue,ue=ie;break e}else{p(ue,ie);break}else l(ue,ie);ie=ie.sibling}ie=Kf(de,ue.mode,tt),ie.return=ue,ue=ie}return V(ue);case E:return Vt=de._init,Ni(ue,ie,Vt(de._payload),tt)}if(ae(de))return yt(ue,ie,de,tt);if(I(de))return Xn(ue,ie,de,tt);Kl(ue,de)}return typeof de=="string"&&de!==""||typeof de=="number"?(de=""+de,ie!==null&&ie.tag===6?(p(ue,ie.sibling),ie=S(ie,de),ie.return=ue,ue=ie):(p(ue,ie),ie=Jf(de,ue.mode,tt),ie.return=ue,ue=ie),V(ue)):p(ue,ie)}return Ni}var po=Om(!0),Bm=Om(!1),pa={},Pi=Ze(pa),ma=Ze(pa),mo=Ze(pa);function rr(a){if(a===pa)throw Error(o(174));return a}function pf(a,l){je(mo,l),je(ma,a),je(Pi,pa),a=xe(l),Fe(Pi),je(Pi,a)}function go(){Fe(Pi),Fe(ma),Fe(mo)}function zm(a){var l=rr(mo.current),p=rr(Pi.current);l=k(p,a.type,l),p!==l&&(je(ma,a),je(Pi,l))}function mf(a){ma.current===a&&(Fe(Pi),Fe(ma))}var fn=Ze(0);function Ql(a){for(var l=a;l!==null;){if(l.tag===13){var p=l.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||Qn(p)||_r(p)))return l}else if(l.tag===19&&l.memoizedProps.revealOrder!==void 0){if(l.flags&128)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===a)break;for(;l.sibling===null;){if(l.return===null||l.return===a)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var gf=[];function vf(){for(var a=0;a<gf.length;a++){var l=gf[a];dt?l._workInProgressVersionPrimary=null:l._workInProgressVersionSecondary=null}gf.length=0}var $l=c.ReactCurrentDispatcher,Li=c.ReactCurrentBatchConfig,vo=0,_n=null,Vn=null,Nn=null,ec=!1,ga=!1,va=0,Xx=0;function Gn(){throw Error(o(321))}function _f(a,l){if(l===null)return!1;for(var p=0;p<l.length&&p<a.length;p++)if(!tr(a[p],l[p]))return!1;return!0}function yf(a,l,p,_,S,b){if(vo=b,_n=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,$l.current=a===null||a.memoizedState===null?jx:Jx,a=p(_,S),ga){b=0;do{if(ga=!1,va=0,25<=b)throw Error(o(301));b+=1,Nn=Vn=null,l.updateQueue=null,$l.current=Kx,a=p(_,S)}while(ga)}if($l.current=sc,l=Vn!==null&&Vn.next!==null,vo=0,Nn=Vn=_n=null,ec=!1,l)throw Error(o(300));return a}function xf(){var a=va!==0;return va=0,a}function wr(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Nn===null?_n.memoizedState=Nn=a:Nn=Nn.next=a,Nn}function sr(){if(Vn===null){var a=_n.alternate;a=a!==null?a.memoizedState:null}else a=Vn.next;var l=Nn===null?_n.memoizedState:Nn.next;if(l!==null)Nn=l,Vn=a;else{if(a===null)throw Error(o(310));Vn=a,a={memoizedState:Vn.memoizedState,baseState:Vn.baseState,baseQueue:Vn.baseQueue,queue:Vn.queue,next:null},Nn===null?_n.memoizedState=Nn=a:Nn=Nn.next=a}return Nn}function _s(a,l){return typeof l=="function"?l(a):l}function tc(a){var l=sr(),p=l.queue;if(p===null)throw Error(o(311));p.lastRenderedReducer=a;var _=Vn,S=_.baseQueue,b=p.pending;if(b!==null){if(S!==null){var V=S.next;S.next=b.next,b.next=V}_.baseQueue=S=b,p.pending=null}if(S!==null){b=S.next,_=_.baseState;var te=V=null,ye=null,Ge=b;do{var ut=Ge.lane;if((vo&ut)===ut)ye!==null&&(ye=ye.next={lane:0,action:Ge.action,hasEagerState:Ge.hasEagerState,eagerState:Ge.eagerState,next:null}),_=Ge.hasEagerState?Ge.eagerState:a(_,Ge.action);else{var Lt={lane:ut,action:Ge.action,hasEagerState:Ge.hasEagerState,eagerState:Ge.eagerState,next:null};ye===null?(te=ye=Lt,V=_):ye=ye.next=Lt,_n.lanes|=ut,yo|=ut}Ge=Ge.next}while(Ge!==null&&Ge!==b);ye===null?V=_:ye.next=te,tr(_,l.memoizedState)||(xi=!0),l.memoizedState=_,l.baseState=V,l.baseQueue=ye,p.lastRenderedState=_}if(a=p.interleaved,a!==null){S=a;do b=S.lane,_n.lanes|=b,yo|=b,S=S.next;while(S!==a)}else S===null&&(p.lanes=0);return[l.memoizedState,p.dispatch]}function nc(a){var l=sr(),p=l.queue;if(p===null)throw Error(o(311));p.lastRenderedReducer=a;var _=p.dispatch,S=p.pending,b=l.memoizedState;if(S!==null){p.pending=null;var V=S=S.next;do b=a(b,V.action),V=V.next;while(V!==S);tr(b,l.memoizedState)||(xi=!0),l.memoizedState=b,l.baseQueue===null&&(l.baseState=b),p.lastRenderedState=b}return[b,_]}function km(){}function Hm(a,l){var p=_n,_=sr(),S=l(),b=!tr(_.memoizedState,S);if(b&&(_.memoizedState=S,xi=!0),_=_.queue,ya(Wm.bind(null,p,_,a),[a]),_.getSnapshot!==l||b||Nn!==null&&Nn.memoizedState.tag&1){if(p.flags|=2048,_a(9,Gm.bind(null,p,_,S,l),void 0,null),Tn===null)throw Error(o(349));vo&30||Vm(p,l,S)}return S}function Vm(a,l,p){a.flags|=16384,a={getSnapshot:l,value:p},l=_n.updateQueue,l===null?(l={lastEffect:null,stores:null},_n.updateQueue=l,l.stores=[a]):(p=l.stores,p===null?l.stores=[a]:p.push(a))}function Gm(a,l,p,_){l.value=p,l.getSnapshot=_,Xm(l)&&Di(a,1,-1)}function Wm(a,l,p){return p(function(){Xm(l)&&Di(a,1,-1)})}function Xm(a){var l=a.getSnapshot;a=a.value;try{var p=l();return!tr(a,p)}catch{return!0}}function Sf(a){var l=wr();return typeof a=="function"&&(a=a()),l.memoizedState=l.baseState=a,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:_s,lastRenderedState:a},l.queue=a,a=a.dispatch=Zx.bind(null,_n,a),[l.memoizedState,a]}function _a(a,l,p,_){return a={tag:a,create:l,destroy:p,deps:_,next:null},l=_n.updateQueue,l===null?(l={lastEffect:null,stores:null},_n.updateQueue=l,l.lastEffect=a.next=a):(p=l.lastEffect,p===null?l.lastEffect=a.next=a:(_=p.next,p.next=a,a.next=_,l.lastEffect=a)),a}function Ym(){return sr().memoizedState}function ic(a,l,p,_){var S=wr();_n.flags|=a,S.memoizedState=_a(1|l,p,void 0,_===void 0?null:_)}function rc(a,l,p,_){var S=sr();_=_===void 0?null:_;var b=void 0;if(Vn!==null){var V=Vn.memoizedState;if(b=V.destroy,_!==null&&_f(_,V.deps)){S.memoizedState=_a(l,p,b,_);return}}_n.flags|=a,S.memoizedState=_a(1|l,p,b,_)}function Mf(a,l){return ic(8390656,8,a,l)}function ya(a,l){return rc(2048,8,a,l)}function qm(a,l){return rc(4,2,a,l)}function Zm(a,l){return rc(4,4,a,l)}function jm(a,l){if(typeof l=="function")return a=a(),l(a),function(){l(null)};if(l!=null)return a=a(),l.current=a,function(){l.current=null}}function Jm(a,l,p){return p=p!=null?p.concat([a]):null,rc(4,4,jm.bind(null,l,a),p)}function wf(){}function Km(a,l){var p=sr();l=l===void 0?null:l;var _=p.memoizedState;return _!==null&&l!==null&&_f(l,_[1])?_[0]:(p.memoizedState=[a,l],a)}function Qm(a,l){var p=sr();l=l===void 0?null:l;var _=p.memoizedState;return _!==null&&l!==null&&_f(l,_[1])?_[0]:(a=a(),p.memoizedState=[a,l],a)}function Yx(a,l){var p=Kt;Kt=p!==0&&4>p?p:4,a(!0);var _=Li.transition;Li.transition={};try{a(!1),l()}finally{Kt=p,Li.transition=_}}function $m(){return sr().memoizedState}function qx(a,l,p){var _=Xr(a);p={lane:_,action:p,hasEagerState:!1,eagerState:null,next:null},eg(a)?tg(l,p):(ng(a,l,p),p=ei(),a=Di(a,_,p),a!==null&&ig(a,l,_))}function Zx(a,l,p){var _=Xr(a),S={lane:_,action:p,hasEagerState:!1,eagerState:null,next:null};if(eg(a))tg(l,S);else{ng(a,l,S);var b=a.alternate;if(a.lanes===0&&(b===null||b.lanes===0)&&(b=l.lastRenderedReducer,b!==null))try{var V=l.lastRenderedState,te=b(V,p);if(S.hasEagerState=!0,S.eagerState=te,tr(te,V))return}catch{}finally{}p=ei(),a=Di(a,_,p),a!==null&&ig(a,l,_)}}function eg(a){var l=a.alternate;return a===_n||l!==null&&l===_n}function tg(a,l){ga=ec=!0;var p=a.pending;p===null?l.next=l:(l.next=p.next,p.next=l),a.pending=l}function ng(a,l,p){Tn!==null&&a.mode&1&&!(Gt&2)?(a=l.interleaved,a===null?(p.next=p,ir===null?ir=[l]:ir.push(l)):(p.next=a.next,a.next=p),l.interleaved=p):(a=l.pending,a===null?p.next=p:(p.next=a.next,a.next=p),l.pending=p)}function ig(a,l,p){if(p&4194240){var _=l.lanes;_&=a.pendingLanes,p|=_,l.lanes=p,Jh(a,p)}}var sc={readContext:Ci,useCallback:Gn,useContext:Gn,useEffect:Gn,useImperativeHandle:Gn,useInsertionEffect:Gn,useLayoutEffect:Gn,useMemo:Gn,useReducer:Gn,useRef:Gn,useState:Gn,useDebugValue:Gn,useDeferredValue:Gn,useTransition:Gn,useMutableSource:Gn,useSyncExternalStore:Gn,useId:Gn,unstable_isNewReconciler:!1},jx={readContext:Ci,useCallback:function(a,l){return wr().memoizedState=[a,l===void 0?null:l],a},useContext:Ci,useEffect:Mf,useImperativeHandle:function(a,l,p){return p=p!=null?p.concat([a]):null,ic(4194308,4,jm.bind(null,l,a),p)},useLayoutEffect:function(a,l){return ic(4194308,4,a,l)},useInsertionEffect:function(a,l){return ic(4,2,a,l)},useMemo:function(a,l){var p=wr();return l=l===void 0?null:l,a=a(),p.memoizedState=[a,l],a},useReducer:function(a,l,p){var _=wr();return l=p!==void 0?p(l):l,_.memoizedState=_.baseState=l,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:l},_.queue=a,a=a.dispatch=qx.bind(null,_n,a),[_.memoizedState,a]},useRef:function(a){var l=wr();return a={current:a},l.memoizedState=a},useState:Sf,useDebugValue:wf,useDeferredValue:function(a){var l=Sf(a),p=l[0],_=l[1];return Mf(function(){var S=Li.transition;Li.transition={};try{_(a)}finally{Li.transition=S}},[a]),p},useTransition:function(){var a=Sf(!1),l=a[0];return a=Yx.bind(null,a[1]),wr().memoizedState=a,[l,a]},useMutableSource:function(){},useSyncExternalStore:function(a,l,p){var _=_n,S=wr();if(hn){if(p===void 0)throw Error(o(407));p=p()}else{if(p=l(),Tn===null)throw Error(o(349));vo&30||Vm(_,l,p)}S.memoizedState=p;var b={value:p,getSnapshot:l};return S.queue=b,Mf(Wm.bind(null,_,b,a),[a]),_.flags|=2048,_a(9,Gm.bind(null,_,b,p,l),void 0,null),p},useId:function(){var a=wr(),l=Tn.identifierPrefix;if(hn){var p=Mr,_=Sr;p=(_&~(1<<32-Tt(_)-1)).toString(32)+p,l=":"+l+"R"+p,p=va++,0<p&&(l+="H"+p.toString(32)),l+=":"}else p=Xx++,l=":"+l+"r"+p.toString(32)+":";return a.memoizedState=l},unstable_isNewReconciler:!1},Jx={readContext:Ci,useCallback:Km,useContext:Ci,useEffect:ya,useImperativeHandle:Jm,useInsertionEffect:qm,useLayoutEffect:Zm,useMemo:Qm,useReducer:tc,useRef:Ym,useState:function(){return tc(_s)},useDebugValue:wf,useDeferredValue:function(a){var l=tc(_s),p=l[0],_=l[1];return ya(function(){var S=Li.transition;Li.transition={};try{_(a)}finally{Li.transition=S}},[a]),p},useTransition:function(){var a=tc(_s)[0],l=sr().memoizedState;return[a,l]},useMutableSource:km,useSyncExternalStore:Hm,useId:$m,unstable_isNewReconciler:!1},Kx={readContext:Ci,useCallback:Km,useContext:Ci,useEffect:ya,useImperativeHandle:Jm,useInsertionEffect:qm,useLayoutEffect:Zm,useMemo:Qm,useReducer:nc,useRef:Ym,useState:function(){return nc(_s)},useDebugValue:wf,useDeferredValue:function(a){var l=nc(_s),p=l[0],_=l[1];return ya(function(){var S=Li.transition;Li.transition={};try{_(a)}finally{Li.transition=S}},[a]),p},useTransition:function(){var a=nc(_s)[0],l=sr().memoizedState;return[a,l]},useMutableSource:km,useSyncExternalStore:Hm,useId:$m,unstable_isNewReconciler:!1};function Ef(a,l){try{var p="",_=l;do p+=Wx(_),_=_.return;while(_);var S=p}catch(b){S=` 3856Error generating stack: `+b.message+` 3857`+b.stack}return{value:a,source:l,stack:S}}function Tf(a,l){try{console.error(l.value)}catch(p){setTimeout(function(){throw p})}}var Qx=typeof WeakMap=="function"?WeakMap:Map;function rg(a,l,p){p=xr(-1,p),p.tag=3,p.payload={element:null};var _=l.value;return p.callback=function(){Sc||(Sc=!0,Gf=_),Tf(a,l)},p}function sg(a,l,p){p=xr(-1,p),p.tag=3;var _=a.type.getDerivedStateFromError;if(typeof _=="function"){var S=l.value;p.payload=function(){return _(S)},p.callback=function(){Tf(a,l)}}var b=a.stateNode;return b!==null&&typeof b.componentDidCatch=="function"&&(p.callback=function(){Tf(a,l),typeof _!="function"&&(Gr===null?Gr=new Set([this]):Gr.add(this));var V=l.stack;this.componentDidCatch(l.value,{componentStack:V!==null?V:""})}),p}function og(a,l,p){var _=a.pingCache;if(_===null){_=a.pingCache=new Qx;var S=new Set;_.set(l,S)}else S=_.get(l),S===void 0&&(S=new Set,_.set(l,S));S.has(p)||(S.add(p),a=fS.bind(null,a,l,p),l.then(a,a))}function ag(a){do{var l;if((l=a.tag===13)&&(l=a.memoizedState,l=l!==null?l.dehydrated!==null:!0),l)return a;a=a.return}while(a!==null);return null}function lg(a,l,p,_,S){return a.mode&1?(a.flags|=65536,a.lanes=S,a):(a===l?a.flags|=65536:(a.flags|=128,p.flags|=131072,p.flags&=-52805,p.tag===1&&(p.alternate===null?p.tag=17:(l=xr(-1,1),l.tag=2,Vr(p,l))),p.lanes|=1),a)}function or(a){a.flags|=4}function cg(a,l){if(a!==null&&a.child===l.child)return!0;if(l.flags&16)return!1;for(a=l.child;a!==null;){if(a.flags&12854||a.subtreeFlags&12854)return!1;a=a.sibling}return!0}var xa,Sa,oc,ac;if(Nt)xa=function(a,l){for(var p=l.child;p!==null;){if(p.tag===5||p.tag===6)Se(a,p.stateNode);else if(p.tag!==4&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===l)break;for(;p.sibling===null;){if(p.return===null||p.return===l)return;p=p.return}p.sibling.return=p.return,p=p.sibling}},Sa=function(){},oc=function(a,l,p,_,S){if(a=a.memoizedProps,a!==_){var b=l.stateNode,V=rr(Pi.current);p=le(b,p,a,_,S,V),(l.updateQueue=p)&&or(l)}},ac=function(a,l,p,_){p!==_&&or(l)};else if(It){xa=function(a,l,p,_){for(var S=l.child;S!==null;){if(S.tag===5){var b=S.stateNode;p&&_&&(b=Ht(b,S.type,S.memoizedProps,S)),Se(a,b)}else if(S.tag===6)b=S.stateNode,p&&_&&(b=gn(b,S.memoizedProps,S)),Se(a,b);else if(S.tag!==4){if(S.tag===22&&S.memoizedState!==null)b=S.child,b!==null&&(b.return=S),xa(a,S,!0,!0);else if(S.child!==null){S.child.return=S,S=S.child;continue}}if(S===l)break;for(;S.sibling===null;){if(S.return===null||S.return===l)return;S=S.return}S.sibling.return=S.return,S=S.sibling}};var ug=function(a,l,p,_){for(var S=l.child;S!==null;){if(S.tag===5){var b=S.stateNode;p&&_&&(b=Ht(b,S.type,S.memoizedProps,S)),Ke(a,b)}else if(S.tag===6)b=S.stateNode,p&&_&&(b=gn(b,S.memoizedProps,S)),Ke(a,b);else if(S.tag!==4){if(S.tag===22&&S.memoizedState!==null)b=S.child,b!==null&&(b.return=S),ug(a,S,!0,!0);else if(S.child!==null){S.child.return=S,S=S.child;continue}}if(S===l)break;for(;S.sibling===null;){if(S.return===null||S.return===l)return;S=S.return}S.sibling.return=S.return,S=S.sibling}};Sa=function(a,l){var p=l.stateNode;if(!cg(a,l)){a=p.containerInfo;var _=Ee(a);ug(_,l,!1,!1),p.pendingChildren=_,or(l),_t(a,_)}},oc=function(a,l,p,_,S){var b=a.stateNode,V=a.memoizedProps;if((a=cg(a,l))&&V===_)l.stateNode=b;else{var te=l.stateNode,ye=rr(Pi.current),Ge=null;V!==_&&(Ge=le(te,p,V,_,S,ye)),a&&Ge===null?l.stateNode=b:(b=ze(b,Ge,p,V,_,l,a,te),ke(b,p,_,S,ye)&&or(l),l.stateNode=b,a?or(l):xa(b,l,!1,!1))}},ac=function(a,l,p,_){p!==_?(a=rr(mo.current),p=rr(Pi.current),l.stateNode=Pe(_,a,p,l),or(l)):l.stateNode=a.stateNode}}else Sa=function(){},oc=function(){},ac=function(){};function Ma(a,l){if(!hn)switch(a.tailMode){case"hidden":l=a.tail;for(var p=null;l!==null;)l.alternate!==null&&(p=l),l=l.sibling;p===null?a.tail=null:p.sibling=null;break;case"collapsed":p=a.tail;for(var _=null;p!==null;)p.alternate!==null&&(_=p),p=p.sibling;_===null?l||a.tail===null?a.tail=null:a.tail.sibling=null:_.sibling=null}}function Wn(a){var l=a.alternate!==null&&a.alternate.child===a.child,p=0,_=0;if(l)for(var S=a.child;S!==null;)p|=S.lanes|S.childLanes,_|=S.subtreeFlags&14680064,_|=S.flags&14680064,S.return=a,S=S.sibling;else for(S=a.child;S!==null;)p|=S.lanes|S.childLanes,_|=S.subtreeFlags,_|=S.flags,S.return=a,S=S.sibling;return a.subtreeFlags|=_,a.childLanes=p,l}function $x(a,l,p){var _=l.pendingProps;switch(uf(l),l.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wn(l),null;case 1:return Wt(l.type)&&At(),Wn(l),null;case 3:return _=l.stateNode,go(),Fe(ft),Fe(Mt),vf(),_.pendingContext&&(_.context=_.pendingContext,_.pendingContext=null),(a===null||a.child===null)&&(fa(l)?or(l):a===null||a.memoizedState.isDehydrated&&!(l.flags&256)||(l.flags|=1024,Vi!==null&&(Yf(Vi),Vi=null))),Sa(a,l),Wn(l),null;case 5:mf(l),p=rr(mo.current);var S=l.type;if(a!==null&&l.stateNode!=null)oc(a,l,S,_,p),a.ref!==l.ref&&(l.flags|=512,l.flags|=2097152);else{if(!_){if(l.stateNode===null)throw Error(o(166));return Wn(l),null}if(a=rr(Pi.current),fa(l)){if(!pt)throw Error(o(175));a=R(l.stateNode,l.type,l.memoizedProps,p,a,l,!ha),l.updateQueue=a,a!==null&&or(l)}else{var b=fe(S,_,p,a,l);xa(b,l,!1,!1),l.stateNode=b,ke(b,S,_,p,a)&&or(l)}l.ref!==null&&(l.flags|=512,l.flags|=2097152)}return Wn(l),null;case 6:if(a&&l.stateNode!=null)ac(a,l,a.memoizedProps,_);else{if(typeof _!="string"&&l.stateNode===null)throw Error(o(166));if(a=rr(mo.current),p=rr(Pi.current),fa(l)){if(!pt)throw Error(o(176));if(a=l.stateNode,_=l.memoizedProps,(p=O(a,_,l,!ha))&&(S=_i,S!==null))switch(b=(S.mode&1)!==0,S.tag){case 3:G(S.stateNode.containerInfo,a,_,b);break;case 5:q(S.type,S.memoizedProps,S.stateNode,a,_,b)}p&&or(l)}else l.stateNode=Pe(_,a,p,l)}return Wn(l),null;case 13:if(Fe(fn),_=l.memoizedState,hn&&yi!==null&&l.mode&1&&!(l.flags&128)){for(a=yi;a;)a=ci(a);return fo(),l.flags|=98560,l}if(_!==null&&_.dehydrated!==null){if(_=fa(l),a===null){if(!_)throw Error(o(318));if(!pt)throw Error(o(344));if(a=l.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(o(317));J(a,l)}else fo(),!(l.flags&128)&&(l.memoizedState=null),l.flags|=4;return Wn(l),null}return Vi!==null&&(Yf(Vi),Vi=null),l.flags&128?(l.lanes=p,l):(_=_!==null,p=!1,a===null?fa(l):p=a.memoizedState!==null,_&&!p&&(l.child.flags|=8192,l.mode&1&&(a===null||fn.current&1?In===0&&(In=3):Zf())),l.updateQueue!==null&&(l.flags|=4),Wn(l),null);case 4:return go(),Sa(a,l),a===null&&Ve(l.stateNode.containerInfo),Wn(l),null;case 10:return rf(l.type._context),Wn(l),null;case 17:return Wt(l.type)&&At(),Wn(l),null;case 19:if(Fe(fn),S=l.memoizedState,S===null)return Wn(l),null;if(_=(l.flags&128)!==0,b=S.rendering,b===null)if(_)Ma(S,!1);else{if(In!==0||a!==null&&a.flags&128)for(a=l.child;a!==null;){if(b=Ql(a),b!==null){for(l.flags|=128,Ma(S,!1),a=b.updateQueue,a!==null&&(l.updateQueue=a,l.flags|=4),l.subtreeFlags=0,a=p,_=l.child;_!==null;)p=_,S=a,p.flags&=14680066,b=p.alternate,b===null?(p.childLanes=0,p.lanes=S,p.child=null,p.subtreeFlags=0,p.memoizedProps=null,p.memoizedState=null,p.updateQueue=null,p.dependencies=null,p.stateNode=null):(p.childLanes=b.childLanes,p.lanes=b.lanes,p.child=b.child,p.subtreeFlags=0,p.deletions=null,p.memoizedProps=b.memoizedProps,p.memoizedState=b.memoizedState,p.updateQueue=b.updateQueue,p.type=b.type,S=b.dependencies,p.dependencies=S===null?null:{lanes:S.lanes,firstContext:S.firstContext}),_=_.sibling;return je(fn,fn.current&1|2),l.child}a=a.sibling}S.tail!==null&&Un()>Vf&&(l.flags|=128,_=!0,Ma(S,!1),l.lanes=4194304)}else{if(!_)if(a=Ql(b),a!==null){if(l.flags|=128,_=!0,a=a.updateQueue,a!==null&&(l.updateQueue=a,l.flags|=4),Ma(S,!0),S.tail===null&&S.tailMode==="hidden"&&!b.alternate&&!hn)return Wn(l),null}else 2*Un()-S.renderingStartTime>Vf&&p!==1073741824&&(l.flags|=128,_=!0,Ma(S,!1),l.lanes=4194304);S.isBackwards?(b.sibling=l.child,l.child=b):(a=S.last,a!==null?a.sibling=b:l.child=b,S.last=b)}return S.tail!==null?(l=S.tail,S.rendering=l,S.tail=l.sibling,S.renderingStartTime=Un(),l.sibling=null,a=fn.current,je(fn,_?a&1|2:a&1),l):(Wn(l),null);case 22:case 23:return qf(),_=l.memoizedState!==null,a!==null&&a.memoizedState!==null!==_&&(l.flags|=8192),_&&l.mode&1?Si&1073741824&&(Wn(l),Nt&&l.subtreeFlags&6&&(l.flags|=8192)):Wn(l),null;case 24:return null;case 25:return null}throw Error(o(156,l.tag))}var eS=c.ReactCurrentOwner,xi=!1;function $n(a,l,p,_){l.child=a===null?Bm(l,null,p,_):po(l,a.child,p,_)}function hg(a,l,p,_,S){p=p.render;var b=l.ref;return co(l,S),_=yf(a,l,p,_,b,S),p=xf(),a!==null&&!xi?(l.updateQueue=a.updateQueue,l.flags&=-2053,a.lanes&=~S,Er(a,l,S)):(hn&&p&&cf(l),l.flags|=1,$n(a,l,_,S),l.child)}function fg(a,l,p,_,S){if(a===null){var b=p.type;return typeof b=="function"&&!jf(b)&&b.defaultProps===void 0&&p.compare===null&&p.defaultProps===void 0?(l.tag=15,l.type=b,dg(a,l,b,_,S)):(a=Cc(p.type,null,_,l,l.mode,S),a.ref=l.ref,a.return=l,l.child=a)}if(b=a.child,!(a.lanes&S)){var V=b.memoizedProps;if(p=p.compare,p=p!==null?p:Gl,p(V,_)&&a.ref===l.ref)return Er(a,l,S)}return l.flags|=1,a=qr(b,_),a.ref=l.ref,a.return=l,l.child=a}function dg(a,l,p,_,S){if(a!==null&&Gl(a.memoizedProps,_)&&a.ref===l.ref)if(xi=!1,(a.lanes&S)!==0)a.flags&131072&&(xi=!0);else return l.lanes=a.lanes,Er(a,l,S);return bf(a,l,p,_,S)}function pg(a,l,p){var _=l.pendingProps,S=_.children,b=a!==null?a.memoizedState:null;if(_.mode==="hidden")if(!(l.mode&1))l.memoizedState={baseLanes:0,cachePool:null},je(_o,Si),Si|=p;else if(p&1073741824)l.memoizedState={baseLanes:0,cachePool:null},_=b!==null?b.baseLanes:p,je(_o,Si),Si|=_;else return a=b!==null?b.baseLanes|p:p,l.lanes=l.childLanes=1073741824,l.memoizedState={baseLanes:a,cachePool:null},l.updateQueue=null,je(_o,Si),Si|=a,null;else b!==null?(_=b.baseLanes|p,l.memoizedState=null):_=p,je(_o,Si),Si|=_;return $n(a,l,S,p),l.child}function mg(a,l){var p=l.ref;(a===null&&p!==null||a!==null&&a.ref!==p)&&(l.flags|=512,l.flags|=2097152)}function bf(a,l,p,_,S){var b=Wt(p)?mt:Mt.current;return b=at(l,b),co(l,S),p=yf(a,l,p,_,b,S),_=xf(),a!==null&&!xi?(l.updateQueue=a.updateQueue,l.flags&=-2053,a.lanes&=~S,Er(a,l,S)):(hn&&_&&cf(l),l.flags|=1,$n(a,l,p,S),l.child)}function gg(a,l,p,_,S){if(Wt(p)){var b=!0;Pt(l)}else b=!1;if(co(l,S),l.stateNode===null)a!==null&&(a.alternate=null,l.alternate=null,l.flags|=2),Im(l,p,_),lf(l,p,_,S),_=!0;else if(a===null){var V=l.stateNode,te=l.memoizedProps;V.props=te;var ye=V.context,Ge=p.contextType;typeof Ge=="object"&&Ge!==null?Ge=Ci(Ge):(Ge=Wt(p)?mt:Mt.current,Ge=at(l,Ge));var ut=p.getDerivedStateFromProps,Lt=typeof ut=="function"||typeof V.getSnapshotBeforeUpdate=="function";Lt||typeof V.UNSAFE_componentWillReceiveProps!="function"&&typeof V.componentWillReceiveProps!="function"||(te!==_||ye!==Ge)&&Pm(l,V,_,Ge),Hr=!1;var xt=l.memoizedState;V.state=xt,ql(l,_,V,S),ye=l.memoizedState,te!==_||xt!==ye||ft.current||Hr?(typeof ut=="function"&&(af(l,p,ut,_),ye=l.memoizedState),(te=Hr||Rm(l,p,te,_,xt,ye,Ge))?(Lt||typeof V.UNSAFE_componentWillMount!="function"&&typeof V.componentWillMount!="function"||(typeof V.componentWillMount=="function"&&V.componentWillMount(),typeof V.UNSAFE_componentWillMount=="function"&&V.UNSAFE_componentWillMount()),typeof V.componentDidMount=="function"&&(l.flags|=4194308)):(typeof V.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=_,l.memoizedState=ye),V.props=_,V.state=ye,V.context=Ge,_=te):(typeof V.componentDidMount=="function"&&(l.flags|=4194308),_=!1)}else{V=l.stateNode,Tm(a,l),te=l.memoizedProps,Ge=l.type===l.elementType?te:Hi(l.type,te),V.props=Ge,Lt=l.pendingProps,xt=V.context,ye=p.contextType,typeof ye=="object"&&ye!==null?ye=Ci(ye):(ye=Wt(p)?mt:Mt.current,ye=at(l,ye));var on=p.getDerivedStateFromProps;(ut=typeof on=="function"||typeof V.getSnapshotBeforeUpdate=="function")||typeof V.UNSAFE_componentWillReceiveProps!="function"&&typeof V.componentWillReceiveProps!="function"||(te!==Lt||xt!==ye)&&Pm(l,V,_,ye),Hr=!1,xt=l.memoizedState,V.state=xt,ql(l,_,V,S);var yt=l.memoizedState;te!==Lt||xt!==yt||ft.current||Hr?(typeof on=="function"&&(af(l,p,on,_),yt=l.memoizedState),(Ge=Hr||Rm(l,p,Ge,_,xt,yt,ye)||!1)?(ut||typeof V.UNSAFE_componentWillUpdate!="function"&&typeof V.componentWillUpdate!="function"||(typeof V.componentWillUpdate=="function"&&V.componentWillUpdate(_,yt,ye),typeof V.UNSAFE_componentWillUpdate=="function"&&V.UNSAFE_componentWillUpdate(_,yt,ye)),typeof V.componentDidUpdate=="function"&&(l.flags|=4),typeof V.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof V.componentDidUpdate!="function"||te===a.memoizedProps&&xt===a.memoizedState||(l.flags|=4),typeof V.getSnapshotBeforeUpdate!="function"||te===a.memoizedProps&&xt===a.memoizedState||(l.flags|=1024),l.memoizedProps=_,l.memoizedState=yt),V.props=_,V.state=yt,V.context=ye,_=Ge):(typeof V.componentDidUpdate!="function"||te===a.memoizedProps&&xt===a.memoizedState||(l.flags|=4),typeof V.getSnapshotBeforeUpdate!="function"||te===a.memoizedProps&&xt===a.memoizedState||(l.flags|=1024),_=!1)}return Af(a,l,p,_,b,S)}function Af(a,l,p,_,S,b){mg(a,l);var V=(l.flags&128)!==0;if(!_&&!V)return S&&Xt(l,p,!1),Er(a,l,b);_=l.stateNode,eS.current=l;var te=V&&typeof p.getDerivedStateFromError!="function"?null:_.render();return l.flags|=1,a!==null&&V?(l.child=po(l,a.child,null,b),l.child=po(l,null,te,b)):$n(a,l,te,b),l.memoizedState=_.state,S&&Xt(l,p,!0),l.child}function vg(a){var l=a.stateNode;l.pendingContext?Ot(a,l.pendingContext,l.pendingContext!==l.context):l.context&&Ot(a,l.context,!1),pf(a,l.containerInfo)}function _g(a,l,p,_,S){return fo(),df(S),l.flags|=256,$n(a,l,p,_),l.child}var lc={dehydrated:null,treeContext:null,retryLane:0};function cc(a){return{baseLanes:a,cachePool:null}}function yg(a,l,p){var _=l.pendingProps,S=fn.current,b=!1,V=(l.flags&128)!==0,te;if((te=V)||(te=a!==null&&a.memoizedState===null?!1:(S&2)!==0),te?(b=!0,l.flags&=-129):(a===null||a.memoizedState!==null)&&(S|=1),je(fn,S&1),a===null)return ff(l),a=l.memoizedState,a!==null&&(a=a.dehydrated,a!==null)?(l.mode&1?_r(a)?l.lanes=8:l.lanes=1073741824:l.lanes=1,null):(S=_.children,a=_.fallback,b?(_=l.mode,b=l.child,S={mode:"hidden",children:S},!(_&1)&&b!==null?(b.childLanes=0,b.pendingProps=S):b=Rc(S,_,0,null),a=Es(a,_,p,null),b.return=l,a.return=l,b.sibling=a,l.child=b,l.child.memoizedState=cc(p),l.memoizedState=lc,a):Cf(l,S));if(S=a.memoizedState,S!==null){if(te=S.dehydrated,te!==null){if(V)return l.flags&256?(l.flags&=-257,uc(a,l,p,Error(o(422)))):l.memoizedState!==null?(l.child=a.child,l.flags|=128,null):(b=_.fallback,S=l.mode,_=Rc({mode:"visible",children:_.children},S,0,null),b=Es(b,S,p,null),b.flags|=2,_.return=l,b.return=l,_.sibling=b,l.child=_,l.mode&1&&po(l,a.child,null,p),l.child.memoizedState=cc(p),l.memoizedState=lc,b);if(!(l.mode&1))l=uc(a,l,p,null);else if(_r(te))l=uc(a,l,p,Error(o(419)));else if(_=(p&a.childLanes)!==0,xi||_){if(_=Tn,_!==null){switch(p&-p){case 4:b=2;break;case 16:b=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:b=32;break;case 536870912:b=268435456;break;default:b=0}_=b&(_.suspendedLanes|p)?0:b,_!==0&&_!==S.retryLane&&(S.retryLane=_,Di(a,_,-1))}Zf(),l=uc(a,l,p,Error(o(421)))}else Qn(te)?(l.flags|=128,l.child=a.child,l=dS.bind(null,a),$i(te,l),l=null):(p=S.treeContext,pt&&(yi=zr(te),_i=l,hn=!0,Vi=null,ha=!1,p!==null&&(Ri[Ii++]=Sr,Ri[Ii++]=Mr,Ri[Ii++]=gs,Sr=p.id,Mr=p.overflow,gs=l)),l=Cf(l,l.pendingProps.children),l.flags|=4096);return l}return b?(_=Sg(a,l,_.children,_.fallback,p),b=l.child,S=a.child.memoizedState,b.memoizedState=S===null?cc(p):{baseLanes:S.baseLanes|p,cachePool:null},b.childLanes=a.childLanes&~p,l.memoizedState=lc,_):(p=xg(a,l,_.children,p),l.memoizedState=null,p)}return b?(_=Sg(a,l,_.children,_.fallback,p),b=l.child,S=a.child.memoizedState,b.memoizedState=S===null?cc(p):{baseLanes:S.baseLanes|p,cachePool:null},b.childLanes=a.childLanes&~p,l.memoizedState=lc,_):(p=xg(a,l,_.children,p),l.memoizedState=null,p)}function Cf(a,l){return l=Rc({mode:"visible",children:l},a.mode,0,null),l.return=a,a.child=l}function xg(a,l,p,_){var S=a.child;return a=S.sibling,p=qr(S,{mode:"visible",children:p}),!(l.mode&1)&&(p.lanes=_),p.return=l,p.sibling=null,a!==null&&(_=l.deletions,_===null?(l.deletions=[a],l.flags|=16):_.push(a)),l.child=p}function Sg(a,l,p,_,S){var b=l.mode;a=a.child;var V=a.sibling,te={mode:"hidden",children:p};return!(b&1)&&l.child!==a?(p=l.child,p.childLanes=0,p.pendingProps=te,l.deletions=null):(p=qr(a,te),p.subtreeFlags=a.subtreeFlags&14680064),V!==null?_=qr(V,_):(_=Es(_,b,S,null),_.flags|=2),_.return=l,p.return=l,p.sibling=_,l.child=p,_}function uc(a,l,p,_){return _!==null&&df(_),po(l,a.child,null,p),a=Cf(l,l.pendingProps.children),a.flags|=2,l.memoizedState=null,a}function Mg(a,l,p){a.lanes|=l;var _=a.alternate;_!==null&&(_.lanes|=l),sf(a.return,l,p)}function Rf(a,l,p,_,S){var b=a.memoizedState;b===null?a.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:_,tail:p,tailMode:S}:(b.isBackwards=l,b.rendering=null,b.renderingStartTime=0,b.last=_,b.tail=p,b.tailMode=S)}function wg(a,l,p){var _=l.pendingProps,S=_.revealOrder,b=_.tail;if($n(a,l,_.children,p),_=fn.current,_&2)_=_&1|2,l.flags|=128;else{if(a!==null&&a.flags&128)e:for(a=l.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&Mg(a,p,l);else if(a.tag===19)Mg(a,p,l);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===l)break e;for(;a.sibling===null;){if(a.return===null||a.return===l)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}_&=1}if(je(fn,_),!(l.mode&1))l.memoizedState=null;else switch(S){case"forwards":for(p=l.child,S=null;p!==null;)a=p.alternate,a!==null&&Ql(a)===null&&(S=p),p=p.sibling;p=S,p===null?(S=l.child,l.child=null):(S=p.sibling,p.sibling=null),Rf(l,!1,S,p,b);break;case"backwards":for(p=null,S=l.child,l.child=null;S!==null;){if(a=S.alternate,a!==null&&Ql(a)===null){l.child=S;break}a=S.sibling,S.sibling=p,p=S,S=a}Rf(l,!0,p,null,b);break;case"together":Rf(l,!1,null,null,void 0);break;default:l.memoizedState=null}return l.child}function Er(a,l,p){if(a!==null&&(l.dependencies=a.dependencies),yo|=l.lanes,!(p&l.childLanes))return null;if(a!==null&&l.child!==a.child)throw Error(o(153));if(l.child!==null){for(a=l.child,p=qr(a,a.pendingProps),l.child=p,p.return=l;a.sibling!==null;)a=a.sibling,p=p.sibling=qr(a,a.pendingProps),p.return=l;p.sibling=null}return l.child}function tS(a,l,p){switch(l.tag){case 3:vg(l),fo();break;case 5:zm(l);break;case 1:Wt(l.type)&&Pt(l);break;case 4:pf(l,l.stateNode.containerInfo);break;case 10:Em(l,l.type._context,l.memoizedProps.value);break;case 13:var _=l.memoizedState;if(_!==null)return _.dehydrated!==null?(je(fn,fn.current&1),l.flags|=128,null):p&l.child.childLanes?yg(a,l,p):(je(fn,fn.current&1),a=Er(a,l,p),a!==null?a.sibling:null);je(fn,fn.current&1);break;case 19:if(_=(p&l.childLanes)!==0,a.flags&128){if(_)return wg(a,l,p);l.flags|=128}var S=l.memoizedState;if(S!==null&&(S.rendering=null,S.tail=null,S.lastEffect=null),je(fn,fn.current),_)break;return null;case 22:case 23:return l.lanes=0,pg(a,l,p)}return Er(a,l,p)}function nS(a,l){switch(uf(l),l.tag){case 1:return Wt(l.type)&&At(),a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 3:return go(),Fe(ft),Fe(Mt),vf(),a=l.flags,a&65536&&!(a&128)?(l.flags=a&-65537|128,l):null;case 5:return mf(l),null;case 13:if(Fe(fn),a=l.memoizedState,a!==null&&a.dehydrated!==null){if(l.alternate===null)throw Error(o(340));fo()}return a=l.flags,a&65536?(l.flags=a&-65537|128,l):null;case 19:return Fe(fn),null;case 4:return go(),null;case 10:return rf(l.type._context),null;case 22:case 23:return qf(),null;case 24:return null;default:return null}}var hc=!1,ys=!1,iS=typeof WeakSet=="function"?WeakSet:Set,$e=null;function fc(a,l){var p=a.ref;if(p!==null)if(typeof p=="function")try{p(null)}catch(_){fi(a,l,_)}else p.current=null}function If(a,l,p){try{p()}catch(_){fi(a,l,_)}}var Eg=!1;function rS(a,l){for(ee(a.containerInfo),$e=l;$e!==null;)if(a=$e,l=a.child,(a.subtreeFlags&1028)!==0&&l!==null)l.return=a,$e=l;else for(;$e!==null;){a=$e;try{var p=a.alternate;if(a.flags&1024)switch(a.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var _=p.memoizedProps,S=p.memoizedState,b=a.stateNode,V=b.getSnapshotBeforeUpdate(a.elementType===a.type?_:Hi(a.type,_),S);b.__reactInternalSnapshotBeforeUpdate=V}break;case 3:Nt&&Je(a.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(te){fi(a,a.return,te)}if(l=a.sibling,l!==null){l.return=a.return,$e=l;break}$e=a.return}return p=Eg,Eg=!1,p}function xs(a,l,p){var _=l.updateQueue;if(_=_!==null?_.lastEffect:null,_!==null){var S=_=_.next;do{if((S.tag&a)===a){var b=S.destroy;S.destroy=void 0,b!==void 0&&If(l,p,b)}S=S.next}while(S!==_)}}function wa(a,l){if(l=l.updateQueue,l=l!==null?l.lastEffect:null,l!==null){var p=l=l.next;do{if((p.tag&a)===a){var _=p.create;p.destroy=_()}p=p.next}while(p!==l)}}function Pf(a){var l=a.ref;if(l!==null){var p=a.stateNode;switch(a.tag){case 5:a=ne(p);break;default:a=p}typeof l=="function"?l(a):l.current=a}}function Tg(a,l,p){if(er&&typeof er.onCommitFiberUnmount=="function")try{er.onCommitFiberUnmount(Hl,l)}catch{}switch(l.tag){case 0:case 11:case 14:case 15:if(a=l.updateQueue,a!==null&&(a=a.lastEffect,a!==null)){var _=a=a.next;do{var S=_,b=S.destroy;S=S.tag,b!==void 0&&(S&2||S&4)&&If(l,p,b),_=_.next}while(_!==a)}break;case 1:if(fc(l,p),a=l.stateNode,typeof a.componentWillUnmount=="function")try{a.props=l.memoizedProps,a.state=l.memoizedState,a.componentWillUnmount()}catch(V){fi(l,p,V)}break;case 5:fc(l,p);break;case 4:Nt?Pg(a,l,p):It&&It&&(l=l.stateNode.containerInfo,p=Ee(l),Yt(l,p))}}function bg(a,l,p){for(var _=l;;)if(Tg(a,_,p),_.child===null||Nt&&_.tag===4){if(_===l)break;for(;_.sibling===null;){if(_.return===null||_.return===l)return;_=_.return}_.sibling.return=_.return,_=_.sibling}else _.child.return=_,_=_.child}function Ag(a){var l=a.alternate;l!==null&&(a.alternate=null,Ag(l)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(l=a.stateNode,l!==null&&We(l)),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}function Cg(a){return a.tag===5||a.tag===3||a.tag===4}function Rg(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||Cg(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function Ig(a){if(Nt){e:{for(var l=a.return;l!==null;){if(Cg(l))break e;l=l.return}throw Error(o(160))}var p=l;switch(p.tag){case 5:l=p.stateNode,p.flags&32&&(re(l),p.flags&=-33),p=Rg(a),Df(a,p,l);break;case 3:case 4:l=p.stateNode.containerInfo,p=Rg(a),Lf(a,p,l);break;default:throw Error(o(161))}}}function Lf(a,l,p){var _=a.tag;if(_===5||_===6)a=a.stateNode,l?Xe(p,a,l):st(p,a);else if(_!==4&&(a=a.child,a!==null))for(Lf(a,l,p),a=a.sibling;a!==null;)Lf(a,l,p),a=a.sibling}function Df(a,l,p){var _=a.tag;if(_===5||_===6)a=a.stateNode,l?Ae(p,a,l):ge(p,a);else if(_!==4&&(a=a.child,a!==null))for(Df(a,l,p),a=a.sibling;a!==null;)Df(a,l,p),a=a.sibling}function Pg(a,l,p){for(var _=l,S=!1,b,V;;){if(!S){S=_.return;e:for(;;){if(S===null)throw Error(o(160));switch(b=S.stateNode,S.tag){case 5:V=!1;break e;case 3:b=b.containerInfo,V=!0;break e;case 4:b=b.containerInfo,V=!0;break e}S=S.return}S=!0}if(_.tag===5||_.tag===6)bg(a,_,p),V?X(b,_.stateNode):vt(b,_.stateNode);else if(_.tag===18)V?Oe(b,_.stateNode):He(b,_.stateNode);else if(_.tag===4){if(_.child!==null){b=_.stateNode.containerInfo,V=!0,_.child.return=_,_=_.child;continue}}else if(Tg(a,_,p),_.child!==null){_.child.return=_,_=_.child;continue}if(_===l)break;for(;_.sibling===null;){if(_.return===null||_.return===l)return;_=_.return,_.tag===4&&(S=!1)}_.sibling.return=_.return,_=_.sibling}}function Uf(a,l){if(Nt){switch(l.tag){case 0:case 11:case 14:case 15:xs(3,l,l.return),wa(3,l),xs(5,l,l.return);return;case 1:return;case 5:var p=l.stateNode;if(p!=null){var _=l.memoizedProps;a=a!==null?a.memoizedProps:_;var S=l.type,b=l.updateQueue;l.updateQueue=null,b!==null&<(p,b,S,a,_,l)}return;case 6:if(l.stateNode===null)throw Error(o(162));p=l.memoizedProps,Ye(l.stateNode,a!==null?a.memoizedProps:p,p);return;case 3:pt&&a!==null&&a.memoizedState.isDehydrated&&pe(l.stateNode.containerInfo);return;case 12:return;case 13:dc(l);return;case 19:dc(l);return;case 17:return}throw Error(o(163))}switch(l.tag){case 0:case 11:case 14:case 15:xs(3,l,l.return),wa(3,l),xs(5,l,l.return);return;case 12:return;case 13:dc(l);return;case 19:dc(l);return;case 3:pt&&a!==null&&a.memoizedState.isDehydrated&&pe(l.stateNode.containerInfo);break;case 22:case 23:return}e:if(It){switch(l.tag){case 1:case 5:case 6:break e;case 3:case 4:l=l.stateNode,Yt(l.containerInfo,l.pendingChildren);break e}throw Error(o(163))}}function dc(a){var l=a.updateQueue;if(l!==null){a.updateQueue=null;var p=a.stateNode;p===null&&(p=a.stateNode=new iS),l.forEach(function(_){var S=pS.bind(null,a,_);p.has(_)||(p.add(_),_.then(S,S))})}}function sS(a,l){for($e=l;$e!==null;){l=$e;var p=l.deletions;if(p!==null)for(var _=0;_<p.length;_++){var S=p[_];try{var b=a;Nt?Pg(b,S,l):bg(b,S,l);var V=S.alternate;V!==null&&(V.return=null),S.return=null}catch(gt){fi(S,l,gt)}}if(p=l.child,l.subtreeFlags&12854&&p!==null)p.return=l,$e=p;else for(;$e!==null;){l=$e;try{var te=l.flags;if(te&32&&Nt&&re(l.stateNode),te&512){var ye=l.alternate;if(ye!==null){var Ge=ye.ref;Ge!==null&&(typeof Ge=="function"?Ge(null):Ge.current=null)}}if(te&8192)switch(l.tag){case 13:if(l.memoizedState!==null){var ut=l.alternate;(ut===null||ut.memoizedState===null)&&(Hf=Un())}break;case 22:var Lt=l.memoizedState!==null,xt=l.alternate,on=xt!==null&&xt.memoizedState!==null;if(p=l,Nt){e:if(_=p,S=Lt,b=null,Nt)for(var yt=_;;){if(yt.tag===5){if(b===null){b=yt;var Xn=yt.stateNode;S?Ce(Xn):oe(yt.stateNode,yt.memoizedProps)}}else if(yt.tag===6){if(b===null){var Ni=yt.stateNode;S?W(Ni):Te(Ni,yt.memoizedProps)}}else if((yt.tag!==22&&yt.tag!==23||yt.memoizedState===null||yt===_)&&yt.child!==null){yt.child.return=yt,yt=yt.child;continue}if(yt===_)break;for(;yt.sibling===null;){if(yt.return===null||yt.return===_)break e;b===yt&&(b=null),yt=yt.return}b===yt&&(b=null),yt.sibling.return=yt.return,yt=yt.sibling}}if(Lt&&!on&&p.mode&1){$e=p;for(var ue=p.child;ue!==null;){for(p=$e=ue;$e!==null;){_=$e;var ie=_.child;switch(_.tag){case 0:case 11:case 14:case 15:xs(4,_,_.return);break;case 1:fc(_,_.return);var de=_.stateNode;if(typeof de.componentWillUnmount=="function"){var tt=_.return;try{de.props=_.memoizedProps,de.state=_.memoizedState,de.componentWillUnmount()}catch(gt){fi(_,tt,gt)}}break;case 5:fc(_,_.return);break;case 22:if(_.memoizedState!==null){Ug(p);continue}}ie!==null?(ie.return=_,$e=ie):Ug(p)}ue=ue.sibling}}}switch(te&4102){case 2:Ig(l),l.flags&=-3;break;case 6:Ig(l),l.flags&=-3,Uf(l.alternate,l);break;case 4096:l.flags&=-4097;break;case 4100:l.flags&=-4097,Uf(l.alternate,l);break;case 4:Uf(l.alternate,l)}}catch(gt){fi(l,l.return,gt)}if(p=l.sibling,p!==null){p.return=l.return,$e=p;break}$e=l.return}}}function oS(a,l,p){$e=a,Lg(a)}function Lg(a,l,p){for(var _=(a.mode&1)!==0;$e!==null;){var S=$e,b=S.child;if(S.tag===22&&_){var V=S.memoizedState!==null||hc;if(!V){var te=S.alternate,ye=te!==null&&te.memoizedState!==null||ys;te=hc;var Ge=ys;if(hc=V,(ys=ye)&&!Ge)for($e=S;$e!==null;)V=$e,ye=V.child,V.tag===22&&V.memoizedState!==null?Ng(S):ye!==null?(ye.return=V,$e=ye):Ng(S);for(;b!==null;)$e=b,Lg(b),b=b.sibling;$e=S,hc=te,ys=Ge}Dg(a)}else S.subtreeFlags&8772&&b!==null?(b.return=S,$e=b):Dg(a)}}function Dg(a){for(;$e!==null;){var l=$e;if(l.flags&8772){var p=l.alternate;try{if(l.flags&8772)switch(l.tag){case 0:case 11:case 15:ys||wa(5,l);break;case 1:var _=l.stateNode;if(l.flags&4&&!ys)if(p===null)_.componentDidMount();else{var S=l.elementType===l.type?p.memoizedProps:Hi(l.type,p.memoizedProps);_.componentDidUpdate(S,p.memoizedState,_.__reactInternalSnapshotBeforeUpdate)}var b=l.updateQueue;b!==null&&Am(l,b,_);break;case 3:var V=l.updateQueue;if(V!==null){if(p=null,l.child!==null)switch(l.child.tag){case 5:p=ne(l.child.stateNode);break;case 1:p=l.child.stateNode}Am(l,V,p)}break;case 5:var te=l.stateNode;p===null&&l.flags&4&&ot(te,l.type,l.memoizedProps,l);break;case 6:break;case 4:break;case 12:break;case 13:if(pt&&l.memoizedState===null){var ye=l.alternate;if(ye!==null){var Ge=ye.memoizedState;if(Ge!==null){var ut=Ge.dehydrated;ut!==null&&ve(ut)}}}break;case 19:case 17:case 21:case 22:case 23:break;default:throw Error(o(163))}ys||l.flags&512&&Pf(l)}catch(Lt){fi(l,l.return,Lt)}}if(l===a){$e=null;break}if(p=l.sibling,p!==null){p.return=l.return,$e=p;break}$e=l.return}}function Ug(a){for(;$e!==null;){var l=$e;if(l===a){$e=null;break}var p=l.sibling;if(p!==null){p.return=l.return,$e=p;break}$e=l.return}}function Ng(a){for(;$e!==null;){var l=$e;try{switch(l.tag){case 0:case 11:case 15:var p=l.return;try{wa(4,l)}catch(ye){fi(l,p,ye)}break;case 1:var _=l.stateNode;if(typeof _.componentDidMount=="function"){var S=l.return;try{_.componentDidMount()}catch(ye){fi(l,S,ye)}}var b=l.return;try{Pf(l)}catch(ye){fi(l,b,ye)}break;case 5:var V=l.return;try{Pf(l)}catch(ye){fi(l,V,ye)}}}catch(ye){fi(l,l.return,ye)}if(l===a){$e=null;break}var te=l.sibling;if(te!==null){te.return=l.return,$e=te;break}$e=l.return}}var pc=0,mc=1,gc=2,vc=3,_c=4;if(typeof Symbol=="function"&&Symbol.for){var Ea=Symbol.for;pc=Ea("selector.component"),mc=Ea("selector.has_pseudo_class"),gc=Ea("selector.role"),vc=Ea("selector.test_id"),_c=Ea("selector.text")}function Nf(a){var l=z(a);if(l!=null){if(typeof l.memoizedProps["data-testname"]!="string")throw Error(o(364));return l}if(a=it(a),a===null)throw Error(o(362));return a.stateNode.current}function Ff(a,l){switch(l.$$typeof){case pc:if(a.type===l.value)return!0;break;case mc:e:{l=l.value,a=[a,0];for(var p=0;p<a.length;){var _=a[p++],S=a[p++],b=l[S];if(_.tag!==5||!L(_)){for(;b!=null&&Ff(_,b);)S++,b=l[S];if(S===l.length){l=!0;break e}else for(_=_.child;_!==null;)a.push(_,S),_=_.sibling}}l=!1}return l;case gc:if(a.tag===5&&se(a.stateNode,l.value))return!0;break;case _c:if((a.tag===5||a.tag===6)&&(a=H(a),a!==null&&0<=a.indexOf(l.value)))return!0;break;case vc:if(a.tag===5&&(a=a.memoizedProps["data-testname"],typeof a=="str
3857ing"&&a.toLowerCase()===l.value.toLowerCase()))return!0;break;default:throw Error(o(365))}return!1}function Of(a){switch(a.$$typeof){case pc:return"<"+(N(a.value)||"Unknown")+">";case mc:return":has("+(Of(a)||"")+")";case gc:return'[role="'+a.value+'"]';case _c:return'"'+a.value+'"';case vc:return'[data-testname="'+a.value+'"]';default:throw Error(o(365))}}function Fg(a,l){var p=[];a=[a,0];for(var _=0;_<a.length;){var S=a[_++],b=a[_++],V=l[b];if(S.tag!==5||!L(S)){for(;V!=null&&Ff(S,V);)b++,V=l[b];if(b===l.length)p.push(S);else for(S=S.child;S!==null;)a.push(S,b),S=S.sibling}}return p}function Bf(a,l){if(!Ne)throw Error(o(363));a=Nf(a),a=Fg(a,l),l=[],a=Array.from(a);for(var p=0;p<a.length;){var _=a[p++];if(_.tag===5)L(_)||l.push(_.stateNode);else for(_=_.child;_!==null;)a.push(_),_=_.sibling}return l}var aS=Math.ceil,yc=c.ReactCurrentDispatcher,zf=c.ReactCurrentOwner,Sn=c.ReactCurrentBatchConfig,Gt=0,Tn=null,bn=null,zn=0,Si=0,_o=Ze(0),In=0,Ta=null,yo=0,xc=0,kf=0,ba=null,ui=null,Hf=0,Vf=1/0;function xo(){Vf=Un()+500}var Sc=!1,Gf=null,Gr=null,Mc=!1,Wr=null,wc=0,Aa=0,Wf=null,Ec=-1,Tc=0;function ei(){return Gt&6?Un():Ec!==-1?Ec:Ec=Un()}function Xr(a){return a.mode&1?Gt&2&&zn!==0?zn&-zn:Gx.transition!==null?(Tc===0&&(a=Rn,Rn<<=1,!(Rn&4194240)&&(Rn=64),Tc=a),Tc):(a=Kt,a!==0?a:Ue()):1}function Di(a,l,p){if(50<Aa)throw Aa=0,Wf=null,Error(o(185));var _=bc(a,l);return _===null?null:(ua(_,l,p),(!(Gt&2)||_!==Tn)&&(_===Tn&&(!(Gt&2)&&(xc|=l),In===4&&Yr(_,zn)),hi(_,p),l===1&&Gt===0&&!(a.mode&1)&&(xo(),Vl&&nr())),_)}function bc(a,l){a.lanes|=l;var p=a.alternate;for(p!==null&&(p.lanes|=l),p=a,a=a.return;a!==null;)a.childLanes|=l,p=a.alternate,p!==null&&(p.childLanes|=l),p=a,a=a.return;return p.tag===3?p.stateNode:null}function hi(a,l){var p=a.callbackNode;Ux(a,l);var _=kl(a,a===Tn?zn:0);if(_===0)p!==null&&Mm(p),a.callbackNode=null,a.callbackPriority=0;else if(l=_&-_,a.callbackPriority!==l){if(p!=null&&Mm(p),l===1)a.tag===0?Vx(Bg.bind(null,a)):wm(Bg.bind(null,a)),Me?et(function(){Gt===0&&nr()}):Kh(Qh,nr),p=null;else{switch(Sm(_)){case 1:p=Qh;break;case 4:p=Bx;break;case 16:p=$h;break;case 536870912:p=zx;break;default:p=$h}p=qg(p,Og.bind(null,a))}a.callbackPriority=l,a.callbackNode=p}}function Og(a,l){if(Ec=-1,Tc=0,Gt&6)throw Error(o(327));var p=a.callbackNode;if(ws()&&a.callbackNode!==p)return null;var _=kl(a,a===Tn?zn:0);if(_===0)return null;if(_&30||_&a.expiredLanes||l)l=Ac(a,_);else{l=_;var S=Gt;Gt|=2;var b=Hg();(Tn!==a||zn!==l)&&(xo(),Ss(a,l));do try{uS();break}catch(te){kg(a,te)}while(!0);nf(),yc.current=b,Gt=S,bn!==null?l=0:(Tn=null,zn=0,l=In)}if(l!==0){if(l===2&&(S=Zh(a),S!==0&&(_=S,l=Xf(a,S))),l===1)throw p=Ta,Ss(a,0),Yr(a,_),hi(a,Un()),p;if(l===6)Yr(a,_);else{if(S=a.current.alternate,!(_&30)&&!lS(S)&&(l=Ac(a,_),l===2&&(b=Zh(a),b!==0&&(_=b,l=Xf(a,b))),l===1))throw p=Ta,Ss(a,0),Yr(a,_),hi(a,Un()),p;switch(a.finishedWork=S,a.finishedLanes=_,l){case 0:case 1:throw Error(o(345));case 2:Ms(a,ui);break;case 3:if(Yr(a,_),(_&130023424)===_&&(l=Hf+500-Un(),10<l)){if(kl(a,0)!==0)break;if(S=a.suspendedLanes,(S&_)!==_){ei(),a.pingedLanes|=a.suspendedLanes&S;break}a.timeoutHandle=Be(Ms.bind(null,a,ui),l);break}Ms(a,ui);break;case 4:if(Yr(a,_),(_&4194240)===_)break;for(l=a.eventTimes,S=-1;0<_;){var V=31-Tt(_);b=1<<V,V=l[V],V>S&&(S=V),_&=~b}if(_=S,_=Un()-_,_=(120>_?120:480>_?480:1080>_?1080:1920>_?1920:3e3>_?3e3:4320>_?4320:1960*aS(_/1960))-_,10<_){a.timeoutHandle=Be(Ms.bind(null,a,ui),_);break}Ms(a,ui);break;case 5:Ms(a,ui);break;default:throw Error(o(329))}}}return hi(a,Un()),a.callbackNode===p?Og.bind(null,a):null}function Xf(a,l){var p=ba;return a.current.memoizedState.isDehydrated&&(Ss(a,l).flags|=256),a=Ac(a,l),a!==2&&(l=ui,ui=p,l!==null&&Yf(l)),a}function Yf(a){ui===null?ui=a:ui.push.apply(ui,a)}function lS(a){for(var l=a;;){if(l.flags&16384){var p=l.updateQueue;if(p!==null&&(p=p.stores,p!==null))for(var _=0;_<p.length;_++){var S=p[_],b=S.getSnapshot;S=S.value;try{if(!tr(b(),S))return!1}catch{return!1}}}if(p=l.child,l.subtreeFlags&16384&&p!==null)p.return=l,l=p;else{if(l===a)break;for(;l.sibling===null;){if(l.return===null||l.return===a)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function Yr(a,l){for(l&=~kf,l&=~xc,a.suspendedLanes|=l,a.pingedLanes&=~l,a=a.expirationTimes;0<l;){var p=31-Tt(l),_=1<<p;a[p]=-1,l&=~_}}function Bg(a){if(Gt&6)throw Error(o(327));ws();var l=kl(a,0);if(!(l&1))return hi(a,Un()),null;var p=Ac(a,l);if(a.tag!==0&&p===2){var _=Zh(a);
vendor: 26,620 bytes, lines 3857-3869
3857_!==0&&(l=_,p=Xf(a,_))}if(p===1)throw p=Ta,Ss(a,0),Yr(a,l),hi(a,Un()),p;if(p===6)throw Error(o(345));return a.finishedWork=a.current.alternate,a.finishedLanes=l,Ms(a,ui),hi(a,Un()),null}function zg(a){Wr!==null&&Wr.tag===0&&!(Gt&6)&&ws();var l=Gt;Gt|=1;var p=Sn.transition,_=Kt;try{if(Sn.transition=null,Kt=1,a)return a()}finally{Kt=_,Sn.transition=p,Gt=l,!(Gt&6)&&nr()}}function qf(){Si=_o.current,Fe(_o)}function Ss(a,l){a.finishedWork=null,a.finishedLanes=0;var p=a.timeoutHandle;if(p!==Et&&(a.timeoutHandle=Et,nt(p)),bn!==null)for(p=bn.return;p!==null;){var _=p;switch(uf(_),_.tag){case 1:_=_.type.childContextTypes,_!=null&&At();break;case 3:go(),Fe(ft),Fe(Mt),vf();break;case 5:mf(_);break;case 4:go();break;case 13:Fe(fn);break;case 19:Fe(fn);break;case 10:rf(_.type._context);break;case 22:case 23:qf()}p=p.return}if(Tn=a,bn=a=qr(a.current,null),zn=Si=l,In=0,Ta=null,kf=xc=yo=0,ui=ba=null,ir!==null){for(l=0;l<ir.length;l++)if(p=ir[l],_=p.interleaved,_!==null){p.interleaved=null;var S=_.next,b=p.pending;if(b!==null){var V=b.next;b.next=S,_.next=V}p.pending=_}ir=null}return a}function kg(a,l){do{var p=bn;try{if(nf(),$l.current=sc,ec){for(var _=_n.memoizedState;_!==null;){var S=_.queue;S!==null&&(S.pending=null),_=_.next}ec=!1}if(vo=0,Nn=Vn=_n=null,ga=!1,va=0,zf.current=null,p===null||p.return===null){In=1,Ta=l,bn=null;break}e:{var b=a,V=p.return,te=p,ye=l;if(l=zn,te.flags|=32768,ye!==null&&typeof ye=="object"&&typeof ye.then=="function"){var Ge=ye,ut=te,Lt=ut.tag;if(!(ut.mode&1)&&(Lt===0||Lt===11||Lt===15)){var xt=ut.alternate;xt?(ut.updateQueue=xt.updateQueue,ut.memoizedState=xt.memoizedState,ut.lanes=xt.lanes):(ut.updateQueue=null,ut.memoizedState=null)}var on=ag(V);if(on!==null){on.flags&=-257,lg(on,V,te,b,l),on.mode&1&&og(b,Ge,l),l=on,ye=Ge;var yt=l.updateQueue;if(yt===null){var Xn=new Set;Xn.add(ye),l.updateQueue=Xn}else yt.add(ye);break e}else{if(!(l&1)){og(b,Ge,l),Zf();break e}ye=Error(o(426))}}else if(hn&&te.mode&1){var Ni=ag(V);if(Ni!==null){!(Ni.flags&65536)&&(Ni.flags|=256),lg(Ni,V,te,b,l),df(ye);break e}}b=ye,In!==4&&(In=2),ba===null?ba=[b]:ba.push(b),ye=Ef(ye,te),te=V;do{switch(te.tag){case 3:te.flags|=65536,l&=-l,te.lanes|=l;var ue=rg(te,ye,l);bm(te,ue);break e;case 1:b=ye;var ie=te.type,de=te.stateNode;if(!(te.flags&128)&&(typeof ie.getDerivedStateFromError=="function"||de!==null&&typeof de.componentDidCatch=="function"&&(Gr===null||!Gr.has(de)))){te.flags|=65536,l&=-l,te.lanes|=l;var tt=sg(te,b,l);bm(te,tt);break e}}te=te.return}while(te!==null)}Gg(p)}catch(gt){l=gt,bn===p&&p!==null&&(bn=p=p.return);continue}break}while(!0)}function Hg(){var a=yc.current;return yc.current=sc,a===null?sc:a}function Zf(){(In===0||In===3||In===2)&&(In=4),Tn===null||!(yo&268435455)&&!(xc&268435455)||Yr(Tn,zn)}function Ac(a,l){var p=Gt;Gt|=2;var _=Hg();Tn===a&&zn===l||Ss(a,l);do try{cS();break}catch(S){kg(a,S)}while(!0);if(nf(),Gt=p,yc.current=_,bn!==null)throw Error(o(261));return Tn=null,zn=0,In}function cS(){for(;bn!==null;)Vg(bn)}function uS(){for(;bn!==null&&!Fx();)Vg(bn)}function Vg(a){var l=Yg(a.alternate,a,Si);a.memoizedProps=a.pendingProps,l===null?Gg(a):bn=l,zf.current=null}function Gg(a){var l=a;do{var p=l.alternate;if(a=l.return,l.flags&32768){if(p=nS(p,l),p!==null){p.flags&=32767,bn=p;return}if(a!==null)a.flags|=32768,a.subtreeFlags=0,a.deletions=null;else{In=6,bn=null;return}}else if(p=$x(p,l,Si),p!==null){bn=p;return}if(l=l.sibling,l!==null){bn=l;return}bn=l=a}while(l!==null);In===0&&(In=5)}function Ms(a,l){var p=Kt,_=Sn.transition;try{Sn.transition=null,Kt=1,hS(a,l,p)}finally{Sn.transition=_,Kt=p}return null}function hS(a,l,p){do ws();while(Wr!==null);if(Gt&6)throw Error(o(327));var _=a.finishedWork,S=a.finishedLanes;if(_===null)return null;if(a.finishedWork=null,a.finishedLanes=0,_===a.current)throw Error(o(177));a.callbackNode=null,a.callbackPriority=0;var b=_.lanes|_.childLanes;if(Nx(a,b),a===Tn&&(bn=Tn=null,zn=0),!(_.subtreeFlags&2064)&&!(_.flags&2064)||Mc||(Mc=!0,qg($h,function(){return ws(),null})),b=(_.flags&15990)!==0,_.subtreeFlags&15990||b){b=Sn.transition,Sn.transition=null;var V=Kt;Kt=1;var te=Gt;Gt|=4,zf.current=null,rS(a,_),sS(a,_),Q(a.containerInfo),a.current=_,oS(_),Ox(),Gt=te,Kt=V,Sn.transition=b}else a.current=_;if(Mc&&(Mc=!1,Wr=a,wc=S),b=a.pendingLanes,b===0&&(Gr=null),kx(_.stateNode),hi(a,Un()),l!==null)for(p=a.onRecoverableError,_=0;_<l.length;_++)p(l[_]);if(Sc)throw Sc=!1,a=Gf,Gf=null,a;return wc&1&&a.tag!==0&&ws(),b=a.pendingLanes,b&1?a===Wf?Aa++:(Aa=0,Wf=a):Aa=0,nr(),null}function ws(){if(Wr!==null){var a=Sm(wc),l=Sn.transition,p=Kt;try{if(Sn.transition=null,Kt=16>a?16:a,Wr===null)var _=!1;else{if(a=Wr,Wr=null,wc=0,Gt&6)throw Error(o(331));var S=Gt;for(Gt|=4,$e=a.current;$e!==null;){var b=$e,V=b.child;if($e.flags&16){var te=b.deletions;if(te!==null){for(var ye=0;ye<te.length;ye++){var Ge=te[ye];for($e=Ge;$e!==null;){var ut=$e;switch(ut.tag){case 0:case 11:case 15:xs(8,ut,b)}var Lt=ut.child;if(Lt!==null)Lt.return=ut,$e=Lt;else for(;$e!==null;){ut=$e;var xt=ut.sibling,on=ut.return;if(Ag(ut),ut===Ge){$e=null;break}if(xt!==null){xt.return=on,$e=xt;break}$e=on}}}var yt=b.alternate;if(yt!==null){var Xn=yt.child;if(Xn!==null){yt.child=null;do{var Ni=Xn.sibling;Xn.sibling=null,Xn=Ni}while(Xn!==null)}}$e=b}}if(b.subtreeFlags&2064&&V!==null)V.return=b,$e=V;else e:for(;$e!==null;){if(b=$e,b.flags&2048)switch(b.tag){case 0:case 11:case 15:xs(9,b,b.return)}var ue=b.sibling;if(ue!==null){ue.return=b.return,$e=ue;break e}$e=b.return}}var ie=a.current;for($e=ie;$e!==null;){V=$e;var de=V.child;if(V.subtreeFlags&2064&&de!==null)de.return=V,$e=de;else e:for(V=ie;$e!==null;){if(te=$e,te.flags&2048)try{switch(te.tag){case 0:case 11:case 15:wa(9,te)}}catch(gt){fi(te,te.return,gt)}if(te===V){$e=null;break e}var tt=te.sibling;if(tt!==null){tt.return=te.return,$e=tt;break e}$e=te.return}}if(Gt=S,nr(),er&&typeof er.onPostCommitFiberRoot=="function")try{er.onPostCommitFiberRoot(Hl,a)}catch{}_=!0}return _}finally{Kt=p,Sn.transition=l}}return!1}function Wg(a,l,p){l=Ef(p,l),l=rg(a,l,1),Vr(a,l),l=ei(),a=bc(a,1),a!==null&&(ua(a,1,l),hi(a,l))}function fi(a,l,p){if(a.tag===3)Wg(a,a,p);else for(;l!==null;){if(l.tag===3){Wg(l,a,p);break}else if(l.tag===1){var _=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof _.componentDidCatch=="function"&&(Gr===null||!Gr.has(_))){a=Ef(p,a),a=sg(l,a,1),Vr(l,a),a=ei(),l=bc(l,1),l!==null&&(ua(l,1,a),hi(l,a));break}}l=l.return}}function fS(a,l,p){var _=a.pingCache;_!==null&&_.delete(l),l=ei(),a.pingedLanes|=a.suspendedLanes&p,Tn===a&&(zn&p)===p&&(In===4||In===3&&(zn&130023424)===zn&&500>Un()-Hf?Ss(a,0):kf|=p),hi(a,l)}function Xg(a,l){l===0&&(a.mode&1?(l=kr,kr<<=1,!(kr&130023424)&&(kr=4194304)):l=1);var p=ei();a=bc(a,l),a!==null&&(ua(a,l,p),hi(a,p))}function dS(a){var l=a.memoizedState,p=0;l!==null&&(p=l.retryLane),Xg(a,p)}function pS(a,l){var p=0;switch(a.tag){case 13:var _=a.stateNode,S=a.memoizedState;S!==null&&(p=S.retryLane);break;case 19:_=a.stateNode;break;default:throw Error(o(314))}_!==null&&_.delete(l),Xg(a,p)}var Yg;Yg=function(a,l,p){if(a!==null)if(a.memoizedProps!==l.pendingProps||ft.current)xi=!0;else{if(!(a.lanes&p)&&!(l.flags&128))return xi=!1,tS(a,l,p);xi=!!(a.flags&131072)}else xi=!1,hn&&l.flags&1048576&&Lm(l,Jl,l.index);switch(l.lanes=0,l.tag){case 2:var _=l.type;a!==null&&(a.alternate=null,l.alternate=null,l.flags|=2),a=l.pendingProps;var S=at(l,Mt.current);co(l,p),S=yf(null,l,_,a,S,p);var b=xf();return l.flags|=1,typeof S=="object"&&S!==null&&typeof S.render=="function"&&S.$$typeof===void 0?(l.tag=1,l.memoizedState=null,l.updateQueue=null,Wt(_)?(b=!0,Pt(l)):b=!1,l.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,of(l),S.updater=Zl,l.stateNode=S,S._reactInternals=l,lf(l,_,a,p),l=Af(null,l,_,!0,b,p)):(l.tag=0,hn&&b&&cf(l),$n(null,l,S,p),l=l.child),l;case 16:_=l.elementType;e:{switch(a!==null&&(a.alternate=null,l.alternate=null,l.flags|=2),a=l.pendingProps,S=_._init,_=S(_._payload),l.type=_,S=l.tag=gS(_),a=Hi(_,a),S){case 0:l=bf(null,l,_,a,p);break e;case 1:l=gg(null,l,_,a,p);break e;case 11:l=hg(null,l,_,a,p);break e;case 14:l=fg(null,l,_,Hi(_.type,a),p);break e}throw Error(o(306,_,""))}return l;case 0:return _=l.type,S=l.pendingProps,S=l.elementType===_?S:Hi(_,S),bf(a,l,_,S,p);case 1:return _=l.type,S=l.pendingProps,S=l.elementType===_?S:Hi(_,S),gg(a,l,_,S,p);case 3:e:{if(vg(l),a===null)throw Error(o(387));_=l.pendingProps,b=l.memoizedState,S=b.element,Tm(a,l),ql(l,_,null,p);var V=l.memoizedState;if(_=V.element,pt&&b.isDehydrated)if(b={element:_,isDehydrated:!1,cache:V.cache,transitions:V.transitions},l.updateQueue.baseState=b,l.memoizedState=b,l.flags&256){S=Error(o(423)),l=_g(a,l,_,p,S);break e}else if(_!==S){S=Error(o(424)),l=_g(a,l,_,p,S);break e}else for(pt&&(yi=ms(l.stateNode.containerInfo),_i=l,hn=!0,Vi=null,ha=!1),p=Bm(l,null,_,p),l.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling;else{if(fo(),_===S){l=Er(a,l,p);break e}$n(a,l,_,p)}l=l.child}return l;case 5:return zm(l),a===null&&ff(l),_=l.type,S=l.pendingProps,b=a!==null?a.memoizedProps:null,V=S.children,Ie(_,S)?V=null:b!==null&&Ie(_,b)&&(l.flags|=32),mg(a,l),$n(a,l,V,p),l.child;case 6:return a===null&&ff(l),null;case 13:return yg(a,l,p);case 4:return pf(l,l.stateNode.containerInfo),_=l.pendingProps,a===null?l.child=po(l,null,_,p):$n(a,l,_,p),l.child;case 11:return _=l.type,S=l.pendingProps,S=l.elementType===_?S:Hi(_,S),hg(a,l,_,S,p);case 7:return $n(a,l,l.pendingProps,p),l.child;case 8:return $n(a,l,l.pendingProps.children,p),l.child;case 12:return $n(a,l,l.pendingProps.children,p),l.child;case 10:e:{if(_=l.type._context,S=l.pendingProps,b=l.memoizedProps,V=S.value,Em(l,_,V),b!==null)if(tr(b.value,V)){if(b.children===S.children&&!ft.current){l=Er(a,l,p);break e}}else for(b=l.child,b!==null&&(b.return=l);b!==null;){var te=b.dependencies;if(te!==null){V=b.child;for(var ye=te.firstContext;ye!==null;){if(ye.context===_){if(b.tag===1){ye=xr(-1,p&-p),ye.tag=2;var Ge=b.updateQueue;if(Ge!==null){Ge=Ge.shared;var ut=Ge.pending;ut===null?ye.next=ye:(ye.next=ut.next,ut.next=ye),Ge.pending=ye}}b.lanes|=p,ye=b.alternate,ye!==null&&(ye.lanes|=p),sf(b.return,p,l),te.lanes|=p;break}ye=ye.next}}else if(b.tag===10)V=b.type===l.type?null:b.child;else if(b.tag===18){if(V=b.return,V===null)throw Error(o(341));V.lanes|=p,te=V.alternate,te!==null&&(te.lanes|=p),sf(V,p,l),V=b.sibling}else V=b.child;if(V!==null)V.return=b;else for(V=b;V!==null;){if(V===l){V=null;break}if(b=V.sibling,b!==null){b.return=V.return,V=b;break}V=V.return}b=V}$n(a,l,S.children,p),l=l.child}return l;case 9:return S=l.type,_=l.pendingProps.children,co(l,p),S=Ci(S),_=_(S),l.flags|=1,$n(a,l,_,p),l.child;case 14:return _=l.type,S=Hi(_,l.pendingProps),S=Hi(_.type,S),fg(a,l,_,S,p);case 15:return dg(a,l,l.type,l.pendingProps,p);case 17:return _=l.type,S=l.pendingProps,S=l.elementType===_?S:Hi(_,S),a!==null&&(a.alternate=null,l.alternate=null,l.flags|=2),l.tag=1,Wt(_)?(a=!0,Pt(l)):a=!1,co(l,p),Im(l,_,S),lf(l,_,S,p),Af(null,l,_,!0,a,p);case 19:return wg(a,l,p);case 22:return pg(a,l,p)}throw Error(o(156,l.tag))};function qg(a,l){return Kh(a,l)}function mS(a,l,p,_){this.tag=a,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=_,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ui(a,l,p,_){return new mS(a,l,p,_)}function jf(a){return a=a.prototype,!(!a||!a.isReactComponent)}function gS(a){if(typeof a=="function")return jf(a)?1:0;if(a!=null){if(a=a.$$typeof,a===M)return 11;if(a===w)return 14}return 2}function qr(a,l){var p=a.alternate;return p===null?(p=Ui(a.tag,l,a.key,a.mode),p.elementType=a.elementType,p.type=a.type,p.stateNode=a.stateNode,p.alternate=a,a.alternate=p):(p.pendingProps=l,p.type=a.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=a.flags&14680064,p.childLanes=a.childLanes,p.lanes=a.lanes,p.child=a.child,p.memoizedProps=a.memoizedProps,p.memoizedState=a.memoizedState,p.updateQueue=a.updateQueue,l=a.dependencies,p.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},p.sibling=a.sibling,p.index=a.index,p.ref=a.ref,p}function Cc(a,l,p,_,S,b){var V=2;if(_=a,typeof a=="function")jf(a)&&(V=1);else if(typeof a=="string")V=5;else e:switch(a){case f:return Es(p.children,S,b,l);case d:V=8,S|=8;break;case m:return a=Ui(12,p,l,S|2),a.elementType=m,a.lanes=b,a;case x:return a=Ui(13,p,l,S),a.elementType=x,a.lanes=b,a;case v:return a=Ui(19,p,l,S),a.elementType=v,a.lanes=b,a;case T:return Rc(p,S,b,l);default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case g:V=10;break e;case y:V=9;break e;case M:V=11;break e;case w:V=14;break e;case E:V=16,_=null;break e}throw Error(o(130,a==null?a:typeof a,""))}return l=Ui(V,p,l,S),l.elementType=a,l.type=_,l.lanes=b,l}function Es(a,l,p,_){return a=Ui(7,a,_,l),a.lanes=p,a}function Rc(a,l,p,_){return a=Ui(22,a,_,l),a.elementType=T,a.lanes=p,a.stateNode={},a}function Jf(a,l,p){return a=Ui(6,a,null,l),a.lanes=p,a}function Kf(a,l,p){return l=Ui(4,a.children!==null?a.children:[],a.key,l),l.lanes=p,l.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},l}function vS(a,l,p,_,S){this.tag=l,this.containerInfo=a,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Et,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=jh(0),this.expirationTimes=jh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=jh(0),this.identifierPrefix=_,this.onRecoverableError=S,pt&&(this.mutableSourceEagerHydrationData=null)}function Zg(a,l,p,_,S,b,V,te,ye){return a=new vS(a,l,p,te,ye),l===1?(l=1,b===!0&&(l|=8)):l=0,b=Ui(3,null,null,l),a.current=b,b.stateNode=a,b.memoizedState={element:_,isDehydrated:p,cache:null,transitions:null},of(b),a}function jg(a){if(!a)return ct;a=a._reactInternals;e:{if(C(a)!==a||a.tag!==1)throw Error(o(170));var l=a;do{switch(l.tag){case 3:l=l.stateNode.context;break e;case 1:if(Wt(l.type)){l=l.stateNode.__reactInternalMemoizedMergedChildContext;break e}}l=l.return}while(l!==null);throw Error(o(171))}if(a.tag===1){var p=a.type;if(Wt(p))return an(a,p,l)}return l}function Jg(a){var l=a._reactInternals;if(l===void 0)throw typeof a.render=="function"?Error(o(188)):(a=Object.keys(a).join(","),Error(o(268,a)));return a=j(l),a===null?null:a.stateNode}function Kg(a,l){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var p=a.retryLane;a.retryLane=p!==0&&p<l?p:l}}function Qf(a,l){Kg(a,l),(a=a.alternate)&&Kg(a,l)}function _S(a){return a=j(a),a===null?null:a.stateNode}function yS(){return null}return t.attemptContinuousHydration=function(a){if(a.tag===13){var l=ei();Di(a,134217728,l),Qf(a,134217728)}},t.attemptHydrationAtCurrentPriority=function(a){if(a.tag===13){var l=ei(),p=Xr(a);Di(a,p,l),Qf(a,p)}},t.attemptSynchronousHydration=function(a){switch(a.tag){case 3:var l=a.stateNode;if(l.current.memoizedState.isDehydrated){var p=vi(l.pendingLanes);p!==0&&(Jh(l,p|1),hi(l,Un()),!(Gt&6)&&(xo(),nr()))}break;case 13:var _=ei();zg(function(){return Di(a,1,_)}),Qf(a,1)}},t.batchedUpdates=function(a,l){var p=Gt;Gt|=1;try{return a(l)}finally{Gt=p,Gt===0&&(xo(),Vl&&nr())}},t.createComponentSelector=function(a){return{$$typeof:pc,value:a}},t.createContainer=function(a,l,p,_,S,b,V){return Zg(a,l,!1,null,p,_,S,b,V)},t.createHasPseudoClassSelector=function(a){return{$$typeof:mc,value:a}},t.createHydrationContainer=function(a,l,p,_,S,b,V,te,ye){return a=Zg(p,_,!0,a,S,b,V,te,ye),a.context=jg(null),p=a.current,_=ei(),S=Xr(p),b=xr(_,S),b.callback=l??null,Vr(p,b),a.current.lanes=S,ua(a,S,_),hi(a,_),a},t.createPortal=function(a,l,p){var _=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:h,key:_==null?null:""+_,children:a,containerInfo:l,implementation:p}},t.createRoleSelector=function(a){return{$$typeof:gc,value:a}},t.createTestNameSelector=function(a){return{$$typeof:vc,value:a}},t.createTextSelector=function(a){return{$$typeof:_c,value:a}},t.deferredUpdates=function(a){var l=Kt,p=Sn.transition;try{return Sn.transition=null,Kt=16,a()}finally{Kt=l,Sn.transition=p}},t.discreteUpdates=function(a,l,p,_,S){var b=Kt,V=Sn.transition;try{return Sn.transition=null,Kt=1,a(l,p,_,S)}finally{Kt=b,Sn.transition=V,Gt===0&&xo()}},t.findAllNodes=Bf,t.findBoundingRects=function(a,l){if(!Ne)throw Error(o(363));l=Bf(a,l),a=[];for(var p=0;p<l.length;p++)a.push(wt(l[p]));for(l=a.length-1;0<l;l--){p=a[l];for(var _=p.x,S=_+p.width,b=p.y,V=b+p.height,te=l-1;0<=te;te--)if(l!==te){var ye=a[te],Ge=ye.x,ut=Ge+ye.width,Lt=ye.y,xt=Lt+ye.height;if(_>=Ge&&b>=Lt&&S<=ut&&V<=xt){a.splice(l,1);break}else if(_!==Ge||p.width!==ye.width||xt<b||Lt>V){if(!(b!==Lt||p.height!==ye.height||ut<_||Ge>S)){Ge>_&&(ye.width+=Ge-_,ye.x=_),ut<S&&(ye.width=S-Ge),a.splice(l,1);break}}else{Lt>b&&(ye.height+=Lt-b,ye.y=b),xt<V&&(ye.height=V-Lt),a.splice(l,1);break}}}return a},t.findHostInstance=Jg,t.findHostInstanceWithNoPortals=function(a){return a=F(a),a=a!==null?$(a):null,a===null?null:a.stateNode},t.findHostInstanceWithWarning=function(a){return Jg(a)},t.flushControlled=function(a){var l=Gt;Gt|=1;var p=Sn.transition,_=Kt;try{Sn.transition=null,Kt=1,a()}finally{Kt=_,Sn.transition=p,Gt=l,Gt===0&&(xo(),nr())}},t.flushPassiveEffects=ws,t.flushSync=zg,t.focusWithin=function(a,l){if(!Ne)throw Error(o(363));for(a=Nf(a),l=Fg(a,l),l=Array.from(l),a=0;a<l.length;){var p=l[a++];if(!L(p)){if(p.tag===5&&me(p.stateNode))return!0;for(p=p.child;p!==null;)l.push(p),p=p.sibling}}return!1},t.getCurrentUpdatePriority=function(){return Kt},t.getFindAllNodesFailureDescription=function(a,l){if(!Ne)throw Error(o(363));var p=0,_=[];a=[Nf(a),0];for(var S=0;S<a.length;){var b=a[S++],V=a[S++],te=l[V];if((b.tag!==5||!L(b))&&(Ff(b,te)&&(_.push(Of(te)),V++,V>p&&(p=V)),V<l.length))for(b=b.child;b!==null;)a.push(b,V),b=b.sibling}if(p<l.length){for(a=[];p<l.length;p++)a.push(Of(l[p]));return`findAllNodes was able to match part of the selector: 3858 `+(_.join(" > ")+` 3859 3860No matching component was found for: 3861 `)+a.join(" > ")}return null},t.getPublicRootInstance=function(a){if(a=a.current,!a.child)return null;switch(a.child.tag){case 5:return ne(a.child.stateNode);default:return a.child.stateNode}},t.injectIntoDevTools=function(a){if(a={bundleType:a.bundleType,version:a.version,rendererPackageName:a.rendererPackageName,rendererConfig:a.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:c.ReactCurrentDispatcher,findHostInstanceByFiber:_S,findFiberByHostInstance:a.findFiberByHostInstance||yS,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")a=!1;else{var l=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(l.isDisabled||!l.supportsFiber)a=!0;else{try{Hl=l.inject(a),er=l}catch{}a=!!l.checkDCE}}return a},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(a,l,p,_){if(!Ne)throw Error(o(363));a=Bf(a,l);var S=be(a,p,_).disconnect;return{disconnect:function(){S()}}},t.registerMutableSourceForHydration=function(a,l){var p=l._getVersion;p=p(l._source),a.mutableSourceEagerHydrationData==null?a.mutableSourceEagerHydrationData=[l,p]:a.mutableSourceEagerHydrationData.push(l,p)},t.runWithPriority=function(a,l){var p=Kt;try{return Kt=a,l()}finally{Kt=p}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(a,l,p,_){var S=l.current,b=ei(),V=Xr(S);return p=jg(p),l.context===null?l.context=p:l.pendingContext=p,l=xr(b,V),l.payload={element:a},_=_===void 0?null:_,_!==null&&(l.callback=_),Vr(S,l),a=Di(S,V,b),a!==null&&Yl(a,S,V),V},t};ex.exports=GC;var WC=ex.exports;const XC=wS(WC);var tx={exports:{}},nx={};/** 3862 * @license React 3863 * scheduler.production.min.js 3864 * 3865 * Copyright (c) Facebook, Inc. and its affiliates. 3866 * 3867 * This source code is licensed under the MIT license found in the 3868 * LICENSE file in the root directory of this source tree. 3869 */(function(r){function e(k,ee){var Q=k.length;k.push(ee);e:for(;0<Q;){var fe=Q-1>>>1,Se=k[fe];if(0<i(Se,ee))k[fe]=ee,k[Q]=Se,Q=fe;else break e}}function t(k){return k.length===0?null:k[0]}function n(k){if(k.length===0)return null;var ee=k[0],Q=k.pop();if(Q!==ee){k[0]=Q;e:for(var fe=0,Se=k.length,ke=Se>>>1;fe<ke;){var le=2*(fe+1)-1,Ie=k[le],Pe=le+1,Be=k[Pe];if(0>i(Ie,Q))Pe<Se&&0>i(Be,Ie)?(k[fe]=Be,k[Pe]=Q,fe=Pe):(k[fe]=Ie,k[le]=Q,fe=le);else if(Pe<Se&&0>i(Be,Q))k[fe]=Be,k[Pe]=Q,fe=Pe;else break e}}return ee}function i(k,ee){var Q=k.sortIndex-ee.sortIndex;return Q!==0?Q:k.id-ee.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;r.unstable_now=function(){return s.now()}}else{var o=Date,c=o.now();r.unstable_now=function(){return o.now()-c}}var u=[],h=[],f=1,d=null,m=3,g=!1,y=!1,M=!1,x=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(k){for(var ee=t(h);ee!==null;){if(ee.callback===null)n(h);else if(ee.startTime<=k)n(h),ee.sortIndex=ee.expirationTime,e(u,ee);else break;ee=t(h)}}function T(k){if(M=!1,E(k),!y)if(t(u)!==null)y=!0,ne(U);else{var ee=t(h);ee!==null&&xe(T,ee.startTime-k)}}function U(k,ee){y=!1,M&&(M=!1,v(D),D=-1),g=!0;var Q=m;try{for(E(ee),d=t(u);d!==null&&(!(d.expirationTime>ee)||k&&!F());){var fe=d.callback;if(typeof fe=="function"){d.callback=null,m=d.priorityLevel;var Se=fe(d.expirationTime<=ee);ee=r.unstable_now(),typeof Se=="function"?d.callback=Se:d===t(u)&&n(u),E(ee)}else n(u);d=t(u)}if(d!==null)var ke=!0;else{var le=t(h);le!==null&&xe(T,le.startTime-ee),ke=!1}return ke}finally{d=null,m=Q,g=!1}}var I=!1,N=null,D=-1,C=5,A=-1;function F(){return!(r.unstable_now()-A<C)}function j(){if(N!==null){var k=r.unstable_now();A=k;var ee=!0;try{ee=N(!0,k)}finally{ee?Z():(I=!1,N=null)}}else I=!1}var Z;if(typeof w=="function")Z=function(){w(j)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,ae=$.port2;$.port1.onmessage=j,Z=function(){ae.postMessage(null)}}else Z=function(){x(j,0)};function ne(k){N=k,I||(I=!0,Z())}function xe(k,ee){D=x(function(){k(r.unstable_now())},ee)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(k){k.callback=null},r.unstable_continueExecution=function(){y||g||(y=!0,ne(U))},r.unstable_forceFrameRate=function(k){0>k||125<k?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):C=0<k?Math.floor(1e3/k):5},r.unstable_getCurrentPriorityLevel=function(){return m},r.unstable_getFirstCallbackNode=function(){return t(u)},r.unstable_next=function(k){switch(m){case 1:case 2:case 3:var ee=3;break;default:ee=m}var Q=m;m=ee;try{return k()}finally{m=Q}},r.unstable_pauseExecution=function(){},r.unstable_requestPaint=function(){},r.unstable_runWithPriority=function(k,ee){switch(k){case 1:case 2:case 3:case 4:case 5:break;default:k=3}var Q=m;m=k;try{return ee()}finally{m=Q}},r.unstable_scheduleCallback=function(k,ee,Q){var fe=r.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?fe+Q:fe):Q=fe,k){case 1:var Se=-1;break;case 2:Se=250;break;case 5:Se=1073741823;break;case 4:Se=1e4;break;default:Se=5e3}return Se=Q+Se,k={id:f++,callback:ee,priorityLevel:k,startTime:Q,expirationTime:Se,sortIndex:-1},Q>fe?(k.sortIndex=Q,e(h,k),t(u)===null&&k===t(h)&&(M?(v(D),D=-1):M=!0,xe(T,Q-fe))):(k.sortIndex=Se,e(u,k),y||g||(y=!0,ne(U))),k},r.unstable_shouldYield=F,r.unstable_wrapCallback=function(k){var ee=m;return function(){var Q=m;m=ee;try{return k.apply(this,arguments)}finally{m=Q}}}})(nx);tx.exports=nx;var L0=tx.exports;const cm={},ix=r=>void Object.assign(cm,r);function YC(r,e){function t(f,{args:d=[],attach:m,...g},y){let M=`${f[0].toUpperCase()}${f.slice(1)}`,x;if(f==="primitive"){if(g.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const v=g.object;x=ko(v,{type:f,root:y,attach:m,primitive:!0})}else{const v=cm[M];if(!v)throw new Error(`R3F: ${M} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(d))throw new Error("R3F: The args prop must be an array!");x=ko(new v(...d),{type:f,root:y,attach:m,memoizedProps:{args:d}})}return x.__r3f.attach===void 0&&(x.isBufferGeometry?x.__r3f.attach="geometry":x.isMaterial&&(x.__r3f.attach="material")),M!=="inject"&&Yd(x,g),x}function n(f,d){let m=!1;if(d){var g,y;(g=d.__r3f)!=null&&g.attach?Xd(f,d,d.__r3f.attach):d.isObject3D&&f.isObject3D&&(f.add(d),m=!0),m||(y=f.__r3f)==null||y.objects.push(d),d.__r3f||ko(d,{}),d.__r3f.parent=f,yp(d),Ho(d)}}function i(f,d,m){let g=!1;if(d){var y,M;if((y=d.__r3f)!=null&&y.attach)Xd(f,d,d.__r3f.attach);else if(d.isObject3D&&f.isObject3D){d.parent=f,d.dispatchEvent({type:"added"}),f.dispatchEvent({type:"childadded",child:d});const x=f.children.filter(w=>w!==d),v=x.indexOf(m);f.children=[...x.slice(0,v),d,...x.slice(v)],g=!0}g||(M=f.__r3f)==null||M.objects.push(d),d.__r3f||ko(d,{}),d.__r3f.parent=f,yp(d),Ho(d)}}function s(f,d,m=!1){f&&[...f].forEach(g=>o(d,g,m))}function o(f,d,m){if(d){var g,y,M;if(d.__r3f&&(d.__r3f.parent=null),(g=f.__r3f)!=null&&g.objects&&(f.__r3f.objects=f.__r3f.objects.filter(T=>T!==d)),(y=d.__r3f)!=null&&y.attach)O0(f,d,d.__r3f.attach);else if(d.isObject3D&&f.isObject3D){var x;f.remove(d),(x=d.__r3f)!=null&&x.root&&$C(Ru(d),d)}const w=(M=d.__r3f)==null?void 0:M.primitive,E=!w&&(m===void 0?d.dispose!==null:m);if(!w){var v;s((v=d.__r3f)==null?void 0:v.objects,d,E),s(d.children,d,E)}if(delete d.__r3f,E&&d.dispose&&d.type!=="Scene"){const T=()=>{try{d.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?L0.unstable_scheduleCallback(L0.unstable_IdlePriority,T):T()}Ho(f)}}function c(f,d,m,g){var y;const M=(y=f.__r3f)==null?void 0:y.parent;if(!M)return;const x=t(d,m,f.__r3f.root);if(f.children){for(const v of f.children)v.__r3f&&n(x,v);f.children=f.children.filter(v=>!v.__r3f)}
3869f.__r3f.objects.forEach(v=>n(x,v)),f.__r3f.objects=[],f.__r3f.autoRemovedBeforeAppend||o(M,f),x.parent&&(x.__r3f.autoRemovedBeforeAppend=!0),n(M,x),x.raycast&&x.__r3f.eventCount&&Ru(x).getState().internal.interaction.push(x),[g,g.alternate].forEach(v=>{v!==null&&(v.stateNode=x,v.ref&&(typeof v.ref=="function"?v.ref(x):v.ref.current=x))})}const u=()=>{};return{reconciler:XC({createInstance:t,removeChild:o,appendChild:n,appendInitialChild:n,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(f,d)=>{if(!d)return;const m=f.getState().scene;m.__r3f&&(m.__r3f.root=f,n(m,d))},removeChildFromContainer:(f,d)=>{d&&o(f.getState().scene,d)},insertInContainerBefore:(f,d,m)=>{if(!d||!m)return;const g=f.getState().scene;g.__r3f&&i(g,d,m)},getRootHostContext:()=>null,getChildHostContext:f=>f,finalizeInitialChildren(f){var d;return!!((d=f==null?void 0:f.__r3f)!=null?d:{}).handlers},prepareUpdate(f,d,m,g){var y;if(((y=f==null?void 0:f.__r3f)!=null?y:{}
vendor: 4,543 bytes, line 3869
3869).primitive&&g.object&&g.object!==f)return[!0];{const{args:x=[],children:v,...w}=g,{args:E=[],children:T,...U}=m;if(!Array.isArray(x))throw new Error("R3F: the args prop must be an array!");if(x.some((N,D)=>N!==E[D]))return[!0];const I=ux(f,w,U,!0);return I.changes.length?[!1,I]:null}},commitUpdate(f,[d,m],g,y,M,x){d?c(f,g,M,x):Yd(f,m)},commitMount(f,d,m,g){var y;const M=(y=f.__r3f)!=null?y:{};f.raycast&&M.handlers&&M.eventCount&&Ru(f).getState().internal.interaction.push(f)},getPublicInstance:f=>f,prepareForCommit:()=>null,preparePortalMount:f=>ko(f.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(f){var d;const{attach:m,parent:g}=(d=f.__r3f)!=null?d:{};m&&g&&O0(g,f,m),f.isObject3D&&(f.visible=!1),Ho(f)},unhideInstance(f,d){var m;const{attach:g,parent:y}=(m=f.__r3f)!=null?m:{};g&&y&&Xd(y,f,g),(f.isObject3D&&d.visible==null||d.visible)&&(f.visible=!0),Ho(f)},createTextInstance:u,hideTextInstance:u,unhideTextInstance:u,getCurrentEventPriority:()=>e?e():Yo.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&cn.fun(performance.now)?performance.now:cn.fun(Date.now)?Date.now:()=>0,scheduleTimeout:cn.fun(setTimeout)?setTimeout:void 0,cancelTimeout:cn.fun(clearTimeout)?clearTimeout:void 0}),applyProps:Yd}}var D0,U0;const Wd=r=>"colorSpace"in r||"outputColorSpace"in r,rx=()=>{var r;return(r=cm.ColorManagement)!=null?r:null},sx=r=>r&&r.isOrthographicCamera,qC=r=>r&&r.hasOwnProperty("current"),Bl=typeof window<"u"&&((D0=window.document)!=null&&D0.createElement||((U0=window.navigator)==null?void 0:U0.product)==="ReactNative")?De.useLayoutEffect:De.useEffect;function ox(r){const e=De.useRef(r);return Bl(()=>void(e.current=r),[r]),e}function ZC({set:r}){return Bl(()=>(r(new Promise(()=>null)),()=>r(!1)),[r]),null}class ax extends De.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}ax.getDerivedStateFromError=()=>({error:!0});const lx="__default",N0=new Map,jC=r=>r&&!!r.memoized&&!!r.changes;function cx(r){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(r)?Math.min(Math.max(r[0],t),r[1]):r}const ka=r=>{var e;return(e=r.__r3f)==null?void 0:e.root.getState()};function Ru(r){let e=r.__r3f.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const cn={obj:r=>r===Object(r)&&!cn.arr(r)&&typeof r!="function",fun:r=>typeof r=="function",str:r=>typeof r=="string",num:r=>typeof r=="number",boo:r=>typeof r=="boolean",und:r=>r===void 0,arr:r=>Array.isArray(r),equ(r,e,{arrays:t="shallow",objects:n="reference",strict:i=!0}={}){if(typeof r!=typeof e||!!r!=!!e)return!1;if(cn.str(r)||cn.num(r)||cn.boo(r))return r===e;const s=cn.obj(r);if(s&&n==="reference")return r===e;const o=cn.arr(r);if(o&&t==="reference")return r===e;if((o||s)&&r===e)return!0;let c;for(c in r)if(!(c in e))return!1;if(s&&t==="shallow"&&n==="shallow"){for(c in i?e:r)if(!cn.equ(r[c],e[c],{strict:i,objects:"reference"}))return!1}else for(c in i?e:r)if(r[c]!==e[c])return!1;if(cn.und(c)){if(o&&r.length===0&&e.length===0||s&&Object.keys(r).length===0&&Object.keys(e).length===0)return!0;if(r!==e)return!1}return!0}};function JC(r){const e={nodes:{},materials:{}};return r&&r.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material)}),e}function KC(r){r.dispose&&r.type!=="Scene"&&r.dispose();for(const e in r)e.dispose==null||e.dispose(),delete r[e]}function ko(r,e){const t=r;return t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},r}function _p(r,e){let t=r;if(e.includes("-")){const n=e.split("-"),i=n.pop();return t=n.reduce((s,o)=>s[o],r),{target:t,key:i}}else return{target:t,key:e}}const F0=/-\d+$/;function Xd(r,e,t){if(cn.str(t)){if(F0.test(t)){const s=t.replace(F0,""),{target:o,key:c}=_p(r,s);Array.isArray(o[c])||(o[c]=[])}const{target:n,key:i}=_p(r,t);e.__r3f.previousAttach=n[i],n[i]=e}else e.__r3f.previousAttach=t(r,e)}function O0(r,e,t){var n,i;if(cn.str(t)){const{target:s,key:o}=_p(r,t),c=e.__r3f.previousAttach;c===void 0?delete s[o]:s[o]=c}else(n=e.__r3f)==null||n.previousAttach==null||n.previousAttach(r,e);(i=e.__r3f)==null||delete i.previousAttach}function ux(r,{children:e,key:t,ref:n,...i},{children:s,key:o,ref:c,...u}={},h=!1){const f=r.__r3f,d=Object.entries(i),m=[];
3869if(h){const y=Object.keys(u);for(let M=0;M<y.length;M++)i.hasOwnProperty(y[M])||d.unshift([y[M],lx+"remove"])}d.forEach(([y,M])=>{var x;if((x=r.__r3f)!=null&&x.primitive&&y==="object"||cn.equ(M,u[y]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(y))return m.push([y,M,!0,[]]);let v=[];y.includes("-")&&(v=y.split("-")),m.push([y,M,!1,v]);for(const w in i){const E=i[w];w.startsWith(`${y}-`)&&m.push([w,E,!1,w.split("-")])}});const g={...i};return f!=null&&f.memoizedProps&&f!=null&&f.memoizedProps.args&&(g.args=f.memoizedProps.args),f!=null&&f.memoizedProps&&f!=null&&f.memoizedProps.attach&&(g.attach=f.memoizedProps.attach),{memoized:g,changes:m}}function Yd(r,e){var t;const n=r.__r3f,i=n==null?void 0:n.root,s=i==null||i.getState==null?void 0:i.getState(),{memoized:o,changes:c}=jC(e)?e:ux(r,e),u=n==null?void 0:n.eventCount;r.__r3f&&(r.__r3f.memoizedProps=o);for(let m=0;m<c.length;m++){let[g,y,M,x]=c[m];if(Wd(r)){const T="srgb",U="srgb-linear";g==="encoding"?(g="colorSpace",y=y===3001?T:U):g==="outputEncoding"&&(g="outputColorSpace",y=y===3001?T:U)}let v=r,w=v[g];if(x.length&&(w=x.reduce((E,T)=>E[T],r),!(w&&w.set))){const[E,...T]=x.reverse();v=T.reverse().reduce((U,I)=>U[I],r),g=E}if(y===lx+"remove")if(v.constructor){let E=N0.get(v.constructor);E||(E=new v.constructor,N0.set(v.constructor,E)),y=E[g]}else y=0;if(M&&n)y?n.handlers[g]=y:delete n.handlers[g],n.eventCount=Object.keys(n.handlers).length;else if(w&&w.set&&(w.copy||w instanceof Ks)){if(Array.isArray(y))w.fromArray?w.fromArray(y):w.set(...y);else if(w.copy&&y&&y.constructor&&w.constructor===y.constructor)w.copy(y);else if(y!==void 0){var h;const E=(h=w)==null?void 0:h.isColor;!E&&w.setScalar?w.setScalar(y):w instanceof Ks&&y instanceof Ks?w.mask=y.mask:w.set(y),!rx()&&s&&!s.linear&&E&&w.convertSRGBToLinear()}}else{var f;if(v[g]=y,(f=v[g])!=null&&f.isTexture&&v[g].format===En&&v[g].type===oi&&s){const E=v[g];
vendor: 6,221 bytes, line 3869
3869Wd(E)&&Wd(s.gl)?E.colorSpace=s.gl.outputColorSpace:E.encoding=s.gl.outputEncoding}}Ho(r)}if(n&&n.parent&&r.raycast&&u!==n.eventCount){const m=Ru(r).getState().internal,g=m.interaction.indexOf(r);g>-1&&m.interaction.splice(g,1),n.eventCount&&m.interaction.push(r)}return!(c.length===1&&c[0][0]==="onUpdate")&&c.length&&(t=r.__r3f)!=null&&t.parent&&yp(r),r}function Ho(r){var e,t;const n=(e=r.__r3f)==null||(t=e.root)==null||t.getState==null?void 0:t.getState();n&&n.internal.frames===0&&n.invalidate()}function yp(r){r.onUpdate==null||r.onUpdate(r)}function hx(r,e){r.manual||(sx(r)?(r.left=e.width/-2,r.right=e.width/2,r.top=e.height/2,r.bottom=e.height/-2):r.aspect=e.width/e.height,r.updateProjectionMatrix(),r.updateMatrixWorld())}function Su(r){return(r.eventObject||r.object).uuid+"/"+r.index+r.instanceId}function QC(){var r;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Yo.DefaultEventPriority;switch((r=e.event)==null?void 0:r.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Yo.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Yo.ContinuousEventPriority;default:return Yo.DefaultEventPriority}}function fx(r,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(r.delete(n),i.target.releasePointerCapture(n)))}function $C(r,e){const{internal:t}=r.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,i)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((n,i)=>{fx(t.capturedMap,e,n,i)})}function eR(r){function e(u){const{internal:h}=r.getState(),f=u.offsetX-h.initialClick[0],d=u.offsetY-h.initialClick[1];return Math.round(Math.sqrt(f*f+d*d))}function t(u){return u.filter(h=>["Move","Over","Enter","Out","Leave"].some(f=>{var d;return(d=h.__r3f)==null?void 0:d.handlers["onPointer"+f]}))}function n(u,h){const f=r.getState(),d=new Set,m=[],g=h?h(f.internal.interaction):f.internal.interaction;for(let v=0;v<g.length;v++){const w=ka(g[v]);w&&(w.raycaster.camera=void 0)}f.previousRoot||f.events.compute==null||f.events.compute(u,f);function y(v){const w=ka(v);if(!w||!w.events.enabled||w.raycaster.camera===null)return[];if(w.raycaster.camera===void 0){var E;w.events.compute==null||w.events.compute(u,w,(E=w.previousRoot)==null?void 0:E.getState()),w.raycaster.camera===void 0&&(w.raycaster.camera=null)}return w.raycaster.camera?w.raycaster.intersectObject(v,!0):[]}let M=g.flatMap(y).sort((v,w)=>{const E=ka(v.object),T=ka(w.object);return!E||!T?v.distance-w.distance:T.events.priority-E.events.priority||v.distance-w.distance}).filter(v=>{const w=Su(v);return d.has(w)?!1:(d.add(w),!0)});f.events.filter&&(M=f.events.filter(M,f));for(const v of M){let w=v.object;for(;w;){var x;(x=w.__r3f)!=null&&x.eventCount&&m.push({...v,eventObject:w}),w=w.parent}}if("pointerId"in u&&f.internal.capturedMap.has(u.pointerId))for(let v of f.internal.capturedMap.get(u.pointerId).values())d.has(Su(v.intersection))||m.push(v.intersection);return m}function i(u,h,f,d){const m=r.getState();if(u.length){const g={stopped:!1};for(const y of u){const M=ka(y.object)||m,{raycaster:x,pointer:v,camera:w,internal:E}=M,T=new B(v.x,v.y,0).unproject(w),U=A=>{var F,j;return(F=(j=E.capturedMap.get(A))==null?void 0:j.has(y.eventObject))!=null?F:!1},I=A=>{const F={intersection:y,target:h.target};E.capturedMap.has(A)?E.capturedMap.get(A).set(y.eventObject,F):E.capturedMap.set(A,new Map([[y.eventObject,F]])),h.target.setPointerCapture(A)},N=A=>{const F=E.capturedMap.get(A);F&&fx(E.capturedMap,y.eventObject,F,A)};let D={};for(let A in h){let F=h[A];typeof F!="function"&&(D[A]=F)}let C={...y,...D,pointer:v,intersections:u,stopped:g.stopped,delta:f,unprojectedPoint:T,ray:x.ray,camera:w,stopPropagation(){const A="pointerId"in h&&E.capturedMap.get(h.pointerId);if((!A||A.has(y.eventObject))&&(C.stopped=g.stopped=!0,E.hovered.size&&Array.from(E.hovered.values()).find(F=>F.eventObject===y.eventObject))){const F=u.slice(0,u.indexOf(y));s([...F,y])}},target:{hasPointerCapture:U,setPointerCapture:I,releasePointerCapture:N},currentTarget:{hasPointerCapture:U,setPointerCapture:I,releasePointerCapture:N},nativeEvent:h};if(d(C),g.stopped===!0)break}}return u}function s(u){const{internal:h}=r.getState();for(const f of h.hovered.values())if(!u.length||!u.find(d=>d.object===f.object&&d.index===f.index&&d.instanceId===f.instanceId)){const m=f.eventObject.__r3f,g=m==null?void 0:m.handlers;if(h.hovered.delete(Su(f)),m!=null&&m.eventCount){const y={...f,intersections:u};g.onPointerOut==null||g.onPointerOut(y),g.onPointerLeave==null||g.onPointerLeave(y)}}}function o(u,h){for(let f=0;f<h.length;f++){const d=h[f].__r3f;d==null||d.handlers.onPointerMissed==null||d.handlers.onPointerMissed(u)}}function c(u){switch(u){case"onPointerLeave":case"onPointerCancel":return()=>s([]);case"onLostPointerCapture":return h=>{const{internal:f}=r.getState();"pointerId"in h&&f.capturedMap.has(h.pointerId)&&requestAnimationFrame(()=>{f.capturedMap.has(h.pointerId)&&(f.capturedMap.delete(h.pointerId),s([]))})}}return function(f){const{onPointerMissed:d,internal:m}=r.getState();m.lastEvent.current=f;const g=u==="onPointerMove",y=u==="onClick"||u==="onContextMenu"||u==="onDoubleClick",x=n(f,g?t:void 0),v=y?e(f):0;u==="onPointerDown"&&(m.initialClick=[f.offsetX,f.offsetY],m.initialHits=x.map(E=>E.eventObject)),y&&!x.length&&v<=2&&(o(f,m.interaction),d&&d(f)),g&&s(x);function w(E){const T=E.eventObject,U=T.__r3f,I=U==null?void 0:U.handlers;if(U!=null&&U.eventCount)if(g){if(I.onPointerOver||I.onPointerEnter||I.onPointerOut||I.onPointerLeave){const N=Su(E),D=m.hovered.get(N);D?D.stopped&&E.stopPropagation():(m.hovered.set(N,E),I.onPointerOver==null||I.onPointerOver(E),I.onPointerEnter==null||I.onPointerEnter(E))}I.onPointerMove==null||I.onPointerMove(E)}else{const N=I[u];N?(!y||m.initialHits.includes(T))&&(o(f,m.interaction.filter(D=>!m.initialHits.includes(D))),N(E)):y&&m.initialHits.includes(T)&&o(f,m.interaction.filter(D=>!m.initialHits.includes(D)))}}i(x,f,v,w)}}return{handlePointer:c}}const tR=["set","get","setSize","setFrameloop","setDpr","events","invali
3869date","advance","size","viewport"],dx=r=>!!(r!=null&&r.render),um=De.createContext(null),nR=(r,e)=>{const t=Ky((c,u)=>{const h=new B,f=new B,d=new B;function m(v=u().camera,w=f,E=u().size){const{width:T,height:U,top:I,left:N}=E,D=T/U;w.isVector3?d.copy(w):d.set(...w);const C=v.getWorldPosition(h).distanceTo(d);if(sx(v))return{width:T/v.zoom,height:U/v.zoom,top:I,left:N,factor:1,distance:C,aspect:D};{const A=v.fov*Math.PI/180,F=2*Math.tan(A/2)*C,j=F*(T/U);return{width:j,height:F,top:I,left:N,factor:T/j,distance:C,aspect:D}}}let g;const y=v=>c(w=>({performance:{...w.performance,current:v}})),M=new we;return{set:c,get:u,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(v=1)=>r(u(),v),advance:(v,w)=>e(v,w,u()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new tm,pointer:M,mouse:M,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const v=u();g&&clearTimeout(g),v.performance.current!==v.performance.min&&y(v.performance.min),g=setTimeout(()=>y(u().performance.max),v.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:m},setEvents:v=>c(w=>({...w,events:{...w.events,...v}})),setSize:(v,w,E,T,U)=>{const I=u().camera,N={width:v,height:w,top:T||0,left:U||0,updateStyle:E};c(D=>({size:N,viewport:{...D.viewport,...m(I,f,N)}}))},setDpr:v=>c(w=>{const E=cx(v);return{viewport:{...w.viewport,dpr:E,initialDpr:w.viewport.initialDpr||E}}}),setFrameloop:(v="always")=>{const w=u().clock;w.stop(),w.elapsedTime=0,v!=="never"&&(w.start(),w.elapsedTime=0),c(()=>({frameloop:v}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:De.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(v,w,E)=>{const T=u().internal;return T.priority=T.priority+(w>0?1:0),T.subscribers.push({ref:v,priority:w,store:E}),T.subscribers=T.subscribers.sort((U,I)=>U.priority-I.priority),()=>{const U=u().internal;U!=null&&U.subscribers&&(U.priority=U.priority-(w>0?1:0),U.subscribers=U.subscribers.filter(I=>I.ref!==v))}}}}}),n=t.getState();let i=n.size,s=n.viewport.dpr,o=n.camera;return t.subscribe(()=>{const{camera:c,size:u,viewport:h,gl:f,set:d}=t.getState();if(u.width!==i.width||u.height!==i.height||h.dpr!==s){var m;i=u,s=h.dpr,hx(c,u),f.setPixelRatio(h.dpr);const g=(m=u.updateStyle)!=null?m:typeof HTMLCanvasElement<"u"&&f.domElement instanceof HTMLCanvasElement;f.setSize(u.width,u.height,g)}c!==o&&(o=c,d(g=>({viewport:{...g.viewport,...g.viewport.getCurrentViewport(c)}})))}),t.subscribe(c=>r(c)),t};let Mu,iR=new Set,rR=new Set,sR=new Set;function qd(r,e){if(r.size)for(const{callback:t}of r.values())t(e)}function Ha(r,e){switch(r){case"before":return qd(iR,e);case"after":return qd(rR,e);case"tail":return qd(sR,e)}}let Zd,jd;function Jd(r,e,t){let n=e.clock.getDelta();for(e.frameloop==="never"&&typeof r=="number"&&(n=r-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=r),Zd=e.internal.subscribers,Mu=0;Mu<Zd.length;Mu++)jd=Zd[Mu],jd.ref.current(jd.store.getState(),n,t);return!e.internal.priority&&e.gl.render&&e.gl.render(e.scene,e.camera),e.internal.frames=Math.max(0,e.internal.frames-1),e.frameloop==="always"?1:e.internal.frames}function oR(r){let e=!1,t=!1,n,i,s;function o(h){i=requestAnimationFrame(o),e=!0,n=0,Ha("before",h),t=!0;for(const d of r.values()){var f;s=d.store.getState(),s.internal.active&&(s.frameloop==="always"||s.internal.frames>0)&&!((f=s.gl.xr)!=null&&f.isPresenting)&&(n+=Jd(h,s))}if(t=!1,Ha("after",h),n===0)return Ha("tail",h),e=!1,cancelAnimationFrame(i)}function c(h,f=1){var d;if(!h)return r.forEach(m=>c(m.store.getState(),f));(d=h.gl.xr)!=null&&d.isPresenting||!h.internal.active||h.frameloop==="never"||(f>1?h.internal.frames=Math.min(60,h.internal.frames+f):t?h.internal.frames=2:h.internal.frames=1,e||(e=!0,requestAnimationFrame(o)))}function u(h,f=!0,d,m){if(f&&Ha("before",h),d)Jd(h,d,m);else for(const g of r.values())Jd(h,g.store.getState());f&&Ha("after",h)}return{loop:o,invalidate:c,advance:u}}function hm(){const r=De.useContext(um);if(!r)throw new Error("R3F: Hooks can only be used within the Canvas component!");return r}function Ei(r=t=>t,e){return hm()(r,e)}function fm(r,e=0){const t=hm(),n=t.getState().internal.subscribe,i=ox(r);return Bl(()=>n(i,e,t),[e,n,t]),null}const B0=new WeakMap;function px(r,e){return function(t,...n){let i=B0.get(t);
vendor: 5,324 bytes, line 3869
3869return i||(i=new t,B0.set(t,i)),r&&r(i),Promise.all(n.map(s=>new Promise((o,c)=>i.load(s,u=>{u.scene&&Object.assign(u,JC(u.scene)),o(u)},e,u=>c(new Error(`Could not load ${s}: ${u==null?void 0:u.message}`))))))}}function sa(r,e,t,n){const i=Array.isArray(e)?e:[e],s=BC(px(t,n),[r,...i],{equal:cn.equ});return Array.isArray(e)?s:s[0]}sa.preload=function(r,e,t){const n=Array.isArray(e)?e:[e];return zC(px(t),[r,...n])};sa.clear=function(r,e){const t=Array.isArray(e)?e:[e];return kC([r,...t])};const oa=new Map,{invalidate:z0,advance:k0}=oR(oa),{reconciler:xl,applyProps:is}=YC(oa,QC),zo={objects:"shallow",strict:!1},aR=(r,e)=>{const t=typeof r=="function"?r(e):r;return dx(t)?t:new lm({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...r})};function lR(r,e){const t=typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement;if(e){const{width:n,height:i,top:s,left:o,updateStyle:c=t}=e;return{width:n,height:i,top:s,left:o,updateStyle:c}}else if(typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&r.parentElement){const{width:n,height:i,top:s,left:o}=r.parentElement.getBoundingClientRect();return{width:n,height:i,top:s,left:o,updateStyle:t}}else if(typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height,top:0,left:0,updateStyle:t};return{width:0,height:0,top:0,left:0}}function cR(r){const e=oa.get(r),t=e==null?void 0:e.fiber,n=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,s=n||nR(z0,k0),o=t||xl.createContainer(s,Yo.ConcurrentRoot,null,!1,null,"",i,null);e||oa.set(r,{fiber:o,store:s});let c,u=!1,h;return{configure(f={}){let{gl:d,size:m,scene:g,events:y,onCreated:M,shadows:x=!1,linear:v=!1,flat:w=!1,legacy:E=!1,orthographic:T=!1,frameloop:U="always",dpr:I=[1,2],performance:N,raycaster:D,camera:C,onPointerMissed:A}=f,F=s.getState(),j=F.gl;F.gl||F.set({gl:j=aR(d,r)});let Z=F.raycaster;Z||F.set({raycaster:Z=new sm});const{params:$,...ae}=D||{};if(cn.equ(ae,Z,zo)||is(Z,{...ae}),cn.equ($,Z.params,zo)||is(Z,{params:{...Z.params,...$}}),!F.camera||F.camera===h&&!cn.equ(h,C,zo)){h=C;const Q=C instanceof Cl,fe=Q?C:T?new Fr(0,0,0,0,.1,1e3):new wn(75,0,.1,1e3);Q||(fe.position.z=5,C&&(is(fe,C),("aspect"in C||"left"in C||"right"in C||"bottom"in C||"top"in C)&&(fe.manual=!0,fe.updateProjectionMatrix())),!F.camera&&!(C!=null&&C.rotation)&&fe.lookAt(0,0,0)),F.set({camera:fe}),Z.camera=fe}if(!F.scene){let Q;g!=null&&g.isScene?Q=g:(Q=new Il,g&&is(Q,g)),F.set({scene:ko(Q)})}if(!F.xr){var ne;const Q=(ke,le)=>{const Ie=s.getState();Ie.frameloop!=="never"&&k0(ke,!0,Ie,le)},fe=()=>{const ke=s.getState();ke.gl.xr.enabled=ke.gl.xr.isPresenting,ke.gl.xr.setAnimationLoop(ke.gl.xr.isPresenting?Q:null),ke.gl.xr.isPresenting||z0(ke)},Se={connect(){const ke=s.getState().gl;ke.xr.addEventListener("sessionstart",fe),ke.xr.addEventListener("sessionend",fe)},disconnect(){const ke=s.getState().gl;ke.xr.removeEventListener("sessionstart",fe),ke.xr.removeEventListener("sessionend",fe)}};typeof((ne=j.xr)==null?void 0:ne.addEventListener)=="function"&&Se.connect(),F.set({xr:Se})}if(j.shadowMap){const Q=j.shadowMap.enabled,fe=j.shadowMap.type;if(j.shadowMap.enabled=!!x,cn.boo(x))j.shadowMap.type=qa;else if(cn.str(x)){var xe;const Se={basic:$0,percentage:gh,soft:qa,variance:qi};j.shadowMap.type=(xe=Se[x])!=null?xe:qa}else cn.obj(x)&&Object.assign(j.shadowMap,x);(Q!==j.shadowMap.enabled||fe!==j.shadowMap.type)&&(j.shadowMap.needsUpdate=!0)}const k=rx();k&&("enabled"in k?k.enabled=!E:"legacyMode"in k&&(k.legacyMode=E)),u||is(j,{outputEncoding:v?3e3:3001,toneMapping:w?fr:Mp}),F.legacy!==E&&F.set(()=>({legacy:E})),F.linear!==v&&F.set(()=>({linear:v})),F.flat!==w&&F.set(()=>({flat:w})),d&&!cn.fun(d)&&!dx(d)&&!cn.equ(d,j,zo)&&is(j,d),y&&!F.events.handlers&&F.set({events:y(s)});const ee=lR(r,m);return cn.equ(ee,F.size,zo)||F.setSize(ee.width,ee.height,ee.updateStyle,ee.top,ee.left),I&&F.viewport.dpr!==cx(I)&&F.setDpr(I),F.frameloop!==U&&F.setFrameloop(U),F.onPointerMissed||F.set({onPointerMissed:A}),N&&!cn.equ(N,F.performance,zo)&&F.set(Q=>({performance:{...Q.performance,...N}})),c=M,u=!0,this},render(f){return u||this.configure(),xl.updateContainer(Ct.jsx(uR,{store:s,children:f,onCreated:c,rootElement:r}),o,null,()=>{}),s},unmount(){mx(r)}}}function uR({store:r,children:e,onCreated:t,rootElement:n}){return Bl(()=>{const i=r.getState();i.set(s=>({internal:{...s.internal,active:!0}})),t&&t(i),r.getState().events.connected||i.events.connect==null||i.events.connect(n)},[]),Ct.jsx(um.Provider,{value:r,children:e})}function mx(r,e){const t=oa.get(r),n=t==null?void 0:t.fiber;if(n){const i=t==null?void 0:t.store.getState();i&&(i.internal.active=!1),xl.updateContainer(null,n,null,()=>{i&&setTimeout(()=>{try{var s,o,c,u;i.events.disconnect==null||i.events.disconnect(),(s=i.gl)==null||(o=s.renderLists)==null||o.dispose==null||o.dispose(),(c=i.gl)==null||c.forceContextLoss==null||c.forceContextLoss(),(u=i.gl)!=null&&u.xr&&i.xr.disconnect(),KC(i),oa.delete(r)}catch{}},500)})}}function hR(r,e,t){return Ct.jsx(fR,{children:r,container:e,state:t},e.uuid)}function fR({state:r={},children:e,container:t}){const{events:n,size:i,...s}=r,o=hm(),[c]=De.useState(()=>new sm),[u]=De.useState(()=>new we),h=De.useCallback((d,m)=>{const g={...d};
3869Object.keys(d).forEach(M=>{(tR.includes(M)||d[M]!==m[M]&&m[M])&&delete g[M]});let y;if(m&&i){const M=m.camera;y=d.viewport.getCurrentViewport(M,new B,i),M!==d.camera&&hx(M,i)}return{...g,scene:t,raycaster:c,pointer:u,mouse:u,previousRoot:o,events:{...d.events,...m==null?void 0:m.events,...n},size:{...d.size,...i},viewport:{...d.viewport,...y},...s}},[r]),[f]=De.useState(()=>{const d=o.getState();return Ky((g,y)=>({...d,scene:t,raycaster:c,pointer:u,mouse:u,previousRoot:o,events:{...d.events,...n},size:{...d.size,...i},...s,set:g,get:y,setEvents:M=>g(x=>({...x,events:{...x.events,...M}}))}))});return De.useEffect(()=>{const d=o.subscribe(m=>f.setState(g=>h(m,g)));return()=>{d()}},[h]),De.useEffect(()=>{f.setState(d=>h(o.getState(),d))},[h]),De.useEffect(()=>()=>{f.destroy()},[]),Ct.jsx(Ct.Fragment,{children:xl.createPortal(Ct.jsx(um.Provider,{value:f,children:e}),f,null)})}xl.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:De.version});const Kd={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function dR(r){const{handlePointer:e}=eR(r);return{priority:1,enabled:!0,compute(t,n,i){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(Kd).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:i}=r.getState();(t=i.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{var n;const{set:i,events:s}=r.getState();s.disconnect==null||s.disconnect(),i(o=>({events:{...o.events,connected:t}})),Object.entries((n=s.handlers)!=null?n:[]).forEach(([o,c])=>{const[u,h]=Kd[o];t.addEventListener(u,c,{passive:h})})},disconnect:()=>{const{set:t,events:n}=r.getState();if(n.connected){var i;Object.entries((i=n.handlers)!=null?i:[]).forEach(([s,o])=>{if(n&&n.connected instanceof HTMLElement){const[c]=Kd[s];n.connected.removeEventListener(c,o)}}),t(s=>({events:{...s.events,connected:void 0}}))}}}}function H0(r,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>r(...n),e)}}function pR({debounce:r,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const i=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,o]=De.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),c=De.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),u=r?typeof r=="number"?r:r.scroll:null,h=r?typeof r=="number"?r:r.resize:null,f=De.useRef(!1);De.useEffect(()=>(f.current=!0,()=>void(f.current=!1)));const[d,m,g]=De.useMemo(()=>{const v=()=>{if(!c.current.element)return;const{left:w,top:E,width:T,height:U,bottom:I,right:N,x:D,y:C}=c.current.element.getBoundingClientRect(),A={left:w,top:E,width:T,height:U,bottom:I,right:N,x:D,y:C};c.current.element instanceof HTMLElement&&n&&(A.height=c.current.element.offsetHeight,A.width=c.current.element.offsetWidth),Object.freeze(A),f.current&&!_R(c.current.lastBounds,A)&&o(c.current.lastBounds=A)};return[v,h?H0(v,h):v,u?H0(v,u):v]},[o,n,u,h]);function y(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(v=>v.removeEventListener("scroll",g,!0)),c.current.scrollContainers=null),c.current.resizeObserver&&(c.current.resizeObserver.disconnect(),c.current.resizeObserver=null),c.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",c.current.orientationHandler))}function M(){c.current.element&&(c.current.resizeObserver=new i(g),c.current.resizeObserver.observe(c.current.element),e&&c.current.scrollC
vendor: 9,502 bytes, line 3869
3869ontainers&&c.current.scrollContainers.forEach(v=>v.addEventListener("scroll",g,{capture:!0,passive:!0})),c.current.orientationHandler=()=>{g()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",c.current.orientationHandler))}const x=v=>{!v||v===c.current.element||(y(),c.current.element=v,c.current.scrollContainers=gx(v),M())};return gR(g,!!e),mR(m),De.useEffect(()=>{y(),M()},[e,g,m]),De.useEffect(()=>y,[]),[x,s,d]}function mR(r){De.useEffect(()=>{const e=r;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[r])}function gR(r,e){De.useEffect(()=>{if(e){const t=r;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[r,e])}function gx(r){const e=[];if(!r||r===document.body)return e;const{overflow:t,overflowX:n,overflowY:i}=window.getComputedStyle(r);return[t,n,i].some(s=>s==="auto"||s==="scroll")&&e.push(r),[...e,...gx(r.parentElement)]}const vR=["x","y","top","bottom","left","right","width","height"],_R=(r,e)=>vR.every(t=>r[t]===e[t]);var yR=Object.defineProperty,xR=Object.defineProperties,SR=Object.getOwnPropertyDescriptors,V0=Object.getOwnPropertySymbols,MR=Object.prototype.hasOwnProperty,wR=Object.prototype.propertyIsEnumerable,G0=(r,e,t)=>e in r?yR(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,W0=(r,e)=>{for(var t in e||(e={}))MR.call(e,t)&&G0(r,t,e[t]);if(V0)for(var t of V0(e))wR.call(e,t)&&G0(r,t,e[t]);return r},ER=(r,e)=>xR(r,SR(e)),X0,Y0;typeof window<"u"&&((X0=window.document)!=null&&X0.createElement||((Y0=window.navigator)==null?void 0:Y0.product)==="ReactNative")?De.useLayoutEffect:De.useEffect;function vx(r,e,t){if(!r)return;if(t(r)===!0)return r;let n=r.child;for(;n;){const i=vx(n,e,t);if(i)return i;n=n.sibling}}function _x(r){try{return Object.defineProperties(r,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return r}}const q0=console.error;console.error=function(){const r=[...arguments].join("");if(r!=null&&r.startsWith("Warning:")&&r.includes("useContext")){console.error=q0;return}return q0.apply(this,arguments)};const dm=_x(De.createContext(null));class yx extends De.Component{render(){return De.createElement(dm.Provider,{value:this._reactInternals},this.props.children)}}function TR(){const r=De.useContext(dm);if(r===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=De.useId();return De.useMemo(()=>{for(const n of[r,r==null?void 0:r.alternate]){if(!n)continue;const i=vx(n,!1,s=>{let o=s.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(i)return i}},[r,e])}function bR(){const r=TR(),[e]=De.useState(()=>new Map);e.clear();let t=r;for(;t;){if(t.type&&typeof t.type=="object"){const i=t.type._context===void 0&&t.type.Provider===t.type?t.type:t.type._context;i&&i!==dm&&!e.has(i)&&e.set(i,De.useContext(_x(i)))}t=t.return}return e}function AR(){const r=bR();return De.useMemo(()=>Array.from(r.keys()).reduce((e,t)=>n=>De.createElement(e,null,De.createElement(t.Provider,ER(W0({},n),{value:r.get(t)}))),e=>De.createElement(yx,W0({},e))),[r])}const CR=De.forwardRef(function({children:e,fallback:t,resize:n,style:i,gl:s,events:o=dR,eventSource:c,eventPrefix:u,shadows:h,linear:f,flat:d,legacy:m,orthographic:g,frameloop:y,dpr:M,performance:x,raycaster:v,camera:w,scene:E,onPointerMissed:T,onCreated:U,...I},N){De.useMemo(()=>ix(UC),[]);const D=AR(),[C,A]=pR({scroll:!0,debounce:{scroll:50,resize:0},...n}),F=De.useRef(null),j=De.useRef(null);De.useImperativeHandle(N,()=>F.current);const Z=ox(T),[$,ae]=De.useState(!1),[ne,xe]=De.useState(!1);if($)throw $;if(ne)throw ne;const k=De.useRef(null);Bl(()=>{const Q=F.current;A.width>0&&A.height>0&&Q&&(k.current||(k.current=cR(Q)),k.current.configure({gl:s,events:o,shadows:h,linear:f,flat:d,legacy:m,orthographic:g,frameloop:y,dpr:M,performance:x,raycaster:v,camera:w,scene:E,size:A,onPointerMissed:(...fe)=>Z.current==null?void 0:Z.current(...fe),onCreated:fe=>{fe.events.connect==null||fe.events.connect(c?qC(c)?c.current:c:j.current),u&&fe.setEvents({compute:(Se,ke)=>{const le=Se[u+"X"],Ie=Se[u+"Y"];ke.pointer.set(le/ke.size.width*2-1,-(Ie/ke.size.height)*2+1),ke.raycaster.setFromCamera(ke.pointer,ke.camera)}}),U==null||U(fe)}}),k.current.render(Ct.jsx(D,{children:Ct.jsx(ax,{set:xe,children:Ct.jsx(De.Suspense,{fallback:Ct.jsx(ZC,{set:ae}),children:e??null})})})))}),De.useEffect(()=>{const Q=F.current;if(Q)return()=>mx(Q)},[]);const ee=c?"none":"auto";return Ct.jsx("div",{ref:j,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:ee,...i},...I,children:Ct.jsx("div",{ref:C,style:{width:"100%",height:"100%"},children:Ct.jsx("canvas",{ref:F,style:{display:"block"},children:t})})})}),RR=De.forwardRef(function(e,t){return Ct.jsx(yx,{children:Ct.jsx(CR,{...e,ref:t})})});function Sl(){return Sl=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},Sl.apply(null,arguments)}const xx=parseInt(wl.replace(/\D+/g,""));function IR(r,e=Math.PI/3){const t=Math.cos(e),n=(1+1e-10)*100,i=[new B,new B,new B],s=new B,o=new B,c=new B,u=new B;function h(M){const x=~~(M.x*n),v=~~(M.y*n),w=~~(M.z*n);return`${x},${v},${w}`}const f=r.index?r.toNonIndexed():r,d=f.attributes.position,m={};for(let M=0,x=d.count/3;M<x;M++){const v=3*M,w=i[0].fromBufferAttribute(d,v+0),E=i[1].fromBufferAttribute(d,v+1),T=i[2].fromBufferAttribute(d,v+2);s.subVectors(T,E),o.subVectors(w,E);const U=new B().crossVectors(s,o).normalize();for(let I=0;I<3;I++){const N=i[I],D=h(N);D in m||(m[D]=[]),m[D].push(U)}}const g=new Float32Array(d.count*3),y=new nn(g,3,!1);for(let M=0,x=d.count/3;M<x;M++){const v=3*M,w=i[0].fromBufferAttribute(d,v+0),E=i[1].fromBufferAttribute(d,v+1),T=i[2].fromBufferAttribute(d,v+2);s.subVectors(T,E),o.subVectors(w,E),c.crossVectors(s,o).normalize();for(let U=0;U<3;U++){const I=i[U],N=h(I),D=m[N];u.set(0,0,0);for(let C=0,A=D.length;C<A;C++){const F=D[C];c.dot(F)>t&&u.add(F)}u.normalize(),y.setXYZ(v+U,u.x,u.y,u.z)}}return f.setAttribute("normal",y),f}var Oi=Uint8Array,os=Uint16Array,xp=Uint32Array,Sx=new Oi([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Mx=new Oi([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),PR=new Oi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),wx=function(r,e){for(var t=new os(31),n=0;n<31;++n)t[n]=e+=1<<r[n-1];for(var i=new xp(t[30]),n=1;n<30;++n)for(var s=t[n];s<t[n+1];++s)i[s]=s-t[n]<<5|n;return[t,i]},Ex=wx(Sx,2),Tx=Ex[0],LR=Ex[1];Tx[28]=258,LR[258]=28;var DR=wx(Mx,0),UR=DR[0],Sp=new os(32768);for(var un=0;un<32768;++un){var ns=(un&43690)>>>1|(un&21845)<<1;ns=(ns&52428)>>>2|(ns&13107)<<2,ns=(ns&61680)>>>4|(ns&3855)<<4,Sp[un]=((ns&65280)>>>8|(ns&255)<<8)>>>1}var il=function(r,e,t){for(var n=r.length,i=0,s=new os(e);i<n;++i)++s[r[i]-1];var o=new os(e);for(i=0;i<e;++i)o[i]=o[i-1]+s[i-1]<<1;var c;if(t){c=new os(1<<e);var u=15-e;for(i=0;i<n;++i)if(r[i])for(var h=i<<4|r[i],f=e-r[i],d=o[r[i]-1]++<<f,m=d|(1<<f)-1;d<=m;++d)c[Sp[d]>>>u]=h}else for(c=new os(n),i=0;i<n;++i)r[i]&&(c[i]=Sp[o[r[i]-1]++]>>>15-r[i]);return c},zl=new Oi(288);for(var un=0;un<144;++un)zl[un]=8;for(var un=144;un<256;++un)zl[un]=9;for(var un=256;un<280;++un)zl[un]=7;for(var un=280;un<288;++un)zl[un]=8;var bx=new Oi(32);for(var un=0;un<32;++un)bx[un]=5;var NR=il(zl,9,1),FR=il(bx,5,1),Qd=function(r){for(var e=r[0],t=1;t<r.length;++t)r[t]>e&&(e=r[t]);return e},Yi=function(r,e,t){var n=e/8|0;return(r[n]|r[n+1]<<8)>>(e&7)&t},$d=function(r,e){var t=e/8|0;return(r[t]|r[t+1]<<8|r[t+2]<<16)>>(e&7)},OR=function(r){return(r/8|0)+(r&7&&1)},BR=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var n=new(r instanceof os?os:r instanceof xp?xp:Oi)(t-e);return n.set(r.subarray(e,t)),n},zR=function(r,e,t){var n=r.length;if(!n||t&&!t.l&&n<5)return e||new Oi(0);var i=!e||t,s=!t||t.i;t||(t={}),e||(e=new Oi(n*3));var o=function(Pe){var Be=e.length;if(Pe>Be){var nt=new Oi(Math.max(Be*2,Pe));nt.set(e),e=nt}},c=t.f||0,u=t.p||0,h=t.b||0,f=t.l,d=t.d,m=t.m,g=t.n,y=n*8;do{if(!f){t.f=c=Yi(r,u,1);var M=Yi(r,u+1,3);if(u+=3,M)if(M==1)f=NR,d=FR,m=9,g=5;else if(M==2){var E=Yi(r,u,31)+257,T=Yi(r,u+10,15)+4,U=E+Yi(r,u+5,31)+1;u+=14;for(var I=new Oi(U),N=new Oi(19),D=0;D<T;++D)N[PR[D]]=Yi(r,u+D*3,7);u+=T*3;for(var C=Qd(N),A=(1<<C)-1,F=il(N,C,1),D=0;D<U;){var j=F[Yi(r,u,A)];u+=j&15;var x=j>>>4;if(x<16)I[D++]=x;else{var Z=0,$=0;for(x==16?($=3+Yi(r,u,3),u+=2,Z=I[D-1]):x==17?($=3+Yi(r,u,7),u+=3):x==18&&($=11+Yi(r,u,127),u+=7);$--;)I[D++]=Z}}var ae=I.subarray(0,E),ne=I.subarray(E);m=Qd(ae),g=Qd(ne),f=il(ae,m,1),d=il(ne,g,1)}else throw"invalid block type";else{var x=OR(u)+4,v=r[x-4]|r[x-3]<<8,w=x+v;if(w>n){if(s)throw"unexpected EOF";break}i&&o(h+v),e.set(r.subarray(x,w),h),t.b=h+=v,t.p=u=w*8;continue}if(u>y){if(s)throw"unexpected EOF";break}}i&&o(h+131072);for(var xe=(1<<m)-1,k=(1<<g)-1,ee=u;;ee=u){var Z=f[$d(r,u)&xe],Q=Z>>>4;if(u+=Z&15,u>y){if(s)throw"unexpected EOF";break}if(!Z)throw"invalid length/literal";if(Q<256)e[h++]=Q;else if(Q==256){ee=u,f=null;break}else{var fe=Q-254;if(Q>264){var D=Q-257,Se=Sx[D];fe=Yi(r,u,(1<<Se)-1)+Tx[D],u+=Se}var ke=d[$d(r,u)&k],le=ke>>>4;if(!ke)throw"invalid distance";u+=ke&15;var ne=UR[le];if(le>3){var Se=Mx[le];ne+=$d(r,u)&(1<<Se)-1,u+=Se}if(u>
3869y){if(s)throw"unexpected EOF";break}i&&o(h+131072);for(var Ie=h+fe;h<Ie;h+=4)e[h]=e[h-ne],e[h+1]=e[h+1-ne],e[h+2]=e[h+2-ne],e[h+3]=e[h+3-ne];h=Ie}}t.l=f,t.p=ee,t.b=h,f&&(c=1,t.m=m,t.d=d,t.n=g)}while(!c);return h==e.length?e:BR(e,0,h)},kR=new Oi(0),HR=function(r){if((r[0]&15)!=8||r[0]>>>4>7||(r[0]<<8|r[1])%31)throw"invalid zlib data";if(r[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function wu(r,e){return zR((HR(r),r.subarray(2,-4)),e)}var VR=typeof TextDecoder<"u"&&new TextDecoder,GR=0;try{VR.decode(kR,{stream:!0}),GR=1}catch{}const WR=r=>r&&r.isCubeTexture;class XR extends mn{constructor(e,t){var n,i;const s=WR(e),c=((i=s?(n=e.image[0])==null?void 0:n.width:e.image.width)!=null?i:1024)/4,u=Math.floor(Math.log2(c)),h=Math.pow(2,u),f=3*Math.max(h,16*7),d=4*h,m=[s?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/f}`,`#define CUBEUV_TEXEL_HEIGHT ${1/d}`,`#define CUBEUV_MAX_MIP ${u}.0`],g=` 3870 varying vec3 vWorldPosition; 3871 void main() 3872 { 3873 vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) ); 3874 vWorldPosition = worldPosition.xyz; 3875 3876 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 3877 } 3878 `,y=m.join(` 3879`)+` 3880 #define ENVMAP_TYPE_CUBE_UV 3881 varying vec3 vWorldPosition; 3882 uniform float radius; 3883 uniform float height; 3884 uniform float angle; 3885 #ifdef ENVMAP_TYPE_CUBE 3886 uniform samplerCube map; 3887 #else 3888 uniform sampler2D map; 3889 #endif 3890 // From: https://www.shadertoy.com/view/4tsBD7 3891 float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) 3892 { 3893 float d = dot ( rd, n ); 3894 3895 if( d > 0.0 ) { return 1e6; } 3896 3897 vec3 o = ro - c; 3898 float t = - dot( n, o ) / d; 3899 vec3 q = o + rd * t; 3900 3901 return ( dot( q, q ) < r * r ) ? t : 1e6; 3902 } 3903 // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm 3904 float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) 3905 { 3906 vec3 oc = ro - ce; 3907 float b = dot( oc, rd ); 3908 float c = dot( oc, oc ) - ra * ra; 3909 float h = b * b - c; 3910 3911 if( h < 0.0 ) { return -1.0; } 3912 3913 h = sqrt( h ); 3914 3915 return - b + h; 3916 } 3917 vec3 project() 3918 { 3919 vec3 p = normalize( vWorldPosition ); 3920 vec3 camPos = cameraPosition; 3921 camPos.y -= height; 3922 float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius ); 3923 if( intersection > 0.0 ) { 3924 3925 vec3 h = vec3( 0.0, - height, 0.0 ); 3926 float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius ); 3927 p = ( camPos + min( intersection, intersection2 ) * p ) / radius; 3928 } else { 3929 p = vec3( 0.0, 1.0, 0.0 ); 3930 } 3931 return p; 3932 } 3933 #include <common> 3934 #include <cube_uv_reflection_fragment> 3935 void main() 3936 { 3937 vec3 projectedWorldPosition = project(); 3938 3939 #ifdef ENVMAP_TYPE_CUBE 3940 vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb; 3941 #else 3942 vec3 direction = normalize( projectedWorldPosition ); 3943 vec2 uv = equirectUv( direction ); 3944 vec3 outcolor = texture2D( map, uv ).rgb; 3945 #endif 3946 gl_FragColor = vec4( outcolor, 1.0 ); 3947 #include <tonemapping_fragment> 3948 #include <${xx>=154?"colorspace_fragment":"encodings_fragment"}> 3949 } 3950 `,M={map:{value:e},height:{value:(t==null?void 0:t.height)||15},radius:{value:(t==null?void 0:t.radius)||100}},x=new Dl(1,16),v=new gi({uniforms:M,fragmentShader:y,vertexShader:g,side:ji});super(x,v)}set radius(e){this.material.uniforms.radius.value=e}get radius(){return this.material.uniforms.radius.value}set height(e){this.material.uniforms.height.value=e}get height(){return this.material.uniforms.height.value}}var YR=Object.defineProperty,qR=(r,e,t)=>e in r?YR(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ZR=(r,e,t)=>(qR(r,e+"",t),t);class jR{constructor(){ZR(this,"_listeners")}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){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,o=i.length;s<o;s++)i[s].call(this,e);e.target=null}}}var JR=Object.defineProperty,KR=(r,e,t)=>e in r?JR(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,St=(r,e,t)=>(KR(r,typeof e!="symbol"?e+"":e,t),t);
3950const Eu=new to,Z0=new Pr,QR=Math.cos(70*(Math.PI/180)),j0=(r,e)=>(r%e+e)%e;let $R=class extends jR{constructor(e,t){super(),St(this,"object"),St(this,"domElement"),St(this,"enabled",!0),St(this,"target",new B),St(this,"minDistance",0),St(this,"maxDistance",1/0),St(this,"minZoom",0),St(this,"maxZoom",1/0),St(this,"minPolarAngle",0),St(this,"maxPolarAngle",Math.PI),St(this,"minAzimuthAngle",-1/0),St(this,"maxAzimuthAngle",1/0),St(this,"enableDamping",!1),St(this,"dampingFactor",.05),St(this,"enableZoom",!0),St(this,"zoomSpeed",1),St(this,"enableRotate",!0),St(this,"rotateSpeed",1),St(this,"enablePan",!0),St(this,"panSpeed",1),St(this,"screenSpacePanning",!0),St(this,"keyPanSpeed",7),St(this,"zoomToCursor",!1),St(this,"autoRotate",!1),St(this,"autoRotateSpeed",2),St(this,"reverseOrbit",!1),St(this,"reverseHorizontalOrbit",!1),St(this,"reverseVerticalOrbit",!1),St(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),St(this,"mouseButtons",{LEFT:zs.ROTATE,MIDDLE:zs.DOLLY,RIGHT:zs.PAN}),St(this,"touches",{ONE:ks.ROTATE,TWO:ks.DOLLY_PAN}),St(this,"target0"),St(this,"position0"),St(this,"zoom0"),St(this,"_domElementKeyEvents",null),St(this,"getPolarAngle"),St(this,"getAzimuthalAngle"),St(this,"setPolarAngle"),St(this,"setAzimuthalAngle"),St(this,"getDistance"),St(this,"getZoomScale"),St(this,"listenToKeyEvents"),St(this,"stopListenToKeyEvents"),St(this,"saveState"),St(this,"reset"),St(this,"update"),St(this,"connect"),St(this,"dispose"),St(this,"dollyIn"),St(this,"dollyOut"),St(this,"getScale"),St(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>f.phi,this.getAzimuthalAngle=()=>f.theta,this.setPolarAngle=X=>{let re=j0(X,2*Math.PI),Ce=f.phi;Ce<0&&(Ce+=2*Math.PI),re<0&&(re+=2*Math.PI);let W=Math.abs(re-Ce);2*Math.PI-W<W&&(re<Ce?re+=2*Math.PI:Ce+=2*Math.PI),d.phi=re-Ce,n.update()},this.setAzimuthalAngle=X=>{let re=j0(X,2*Math.PI),Ce=f.theta;Ce<0&&(Ce+=2*Math.PI),re<0&&(re+=2*Math.PI);let W=Math.abs(re-Ce);2*Math.PI-W<W&&(re<Ce?re+=2*Math.PI:Ce+=2*Math.PI),d.theta=re-Ce,n.update()},this.getDistance=()=>n.object.position.distanceTo(n.target),this.listenToKeyEvents=X=>{X.addEventListener("keydown",ge),this._domElementKeyEvents=X},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",ge),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(i),n.update(),u=c.NONE},this.update=(()=>{const X=new B,re=new B(0,1,0),Ce=new jn().setFromUnitVectors(e.up,re),W=Ce.clone().invert(),oe=new B,Te=new jn,Je=2*Math.PI;return function(){const Ee=n.object.position;Ce.setFromUnitVectors(e.up,re),W.copy(Ce).invert(),X.copy(Ee).sub(n.target),X.applyQuaternion(Ce),f.setFromVector3(X),n.autoRotate&&u===c.NONE&&$(j()),n.enableDamping?(f.theta+=d.theta*n.dampingFactor,f.phi+=d.phi*n.dampingFactor):(f.theta+=d.theta,f.phi+=d.phi);let Ke=n.minAzimuthAngle,_t=n.maxAzimuthAngle;isFinite(Ke)&&isFinite(_t)&&(Ke<-Math.PI?Ke+=Je:Ke>Math.PI&&(Ke-=Je),_t<-Math.PI?_t+=Je:_t>Math.PI&&(_t-=Je),Ke<=_t?f.theta=Math.max(Ke,Math.min(_t,f.theta)):f.theta=f.theta>(Ke+_t)/2?Math.max(Ke,f.theta):Math.min(_t,f.theta)),f.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,f.phi)),f.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(g,n.dampingFactor):n.target.add(g),n.zoomToCursor&&C||n.object.isOrthographicCamera?f.radius=ke(f.radius):f.radius=ke(f.radius*m),X.setFromSpherical(f),X.applyQuaternion(W),Ee.copy(n.target).add(X),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(d.theta*=1-n.dampingFactor,d.phi*=1-n.dampingFactor,g.multiplyScalar(1-n.dampingFactor)):(d.set(0,0,0),g.set(0,0,0));let Yt=!1;if(n.zoomToCursor&&C){let Ht=null;if(n.object instanceof wn&&n.object.isPerspectiveCamera){const gn=X.length();Ht=ke(gn*m);const Dn=gn-Ht;n.object.position.addScaledVector(N,Dn),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const gn=new B(D.x,D.y,0);gn.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/m)),n.object.updateProjectionMatrix(),Yt=!0;const Dn=new B(D.x,D.y,0);Dn.unproject(n.object),n.object.position.sub(Dn).add(gn),n.object.updateMatrixWorld(),Ht=X.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Ht!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Ht).add(n.object.position):(Eu.origin.copy(n.object.position),Eu.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(Eu.direction))<QR?e.lookAt(n.target):(Z0.setFromNormalAndCoplanarPoint(n.object.up,n.target),Eu.intersectPlane(Z0,n.target))))}else n.object instanceof Fr&&n.object.isOrthographicCamera&&(Yt=m!==1,Yt&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/m)),n.object.updateProjectionMatrix()));return m=1,C=!1,Yt||oe.distanceToSquared(n.object.position)>h||8*(1-Te.dot(n.object.quaternion))>h?(n.dispatchEvent(i),oe.copy(n.object.position),Te.copy(n.object.quaternion),Yt=!1,!0):!1}})(),this.connect=X=>{n.domElement=X,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",ot),n.domElement.addEventListener("pointerdown",wt),n.domElement.addEventListener("pointercancel",L),n.domElement.addEventListener("wheel",be)},this.dispose=()=>{var X,re,Ce,W,oe,Te;n.domElement&&(n.domElement.style.touchAction="auto"),(X=n.domElement)==null||X.removeEventListener("contextmenu",ot),(re=n.domElement)==null||re.removeEventListener("pointerdown",wt),(Ce=n.domElement)==null||Ce.removeEventListener("pointercancel",L),(W=n.domElement)==null||W.removeEventListener("wheel",be),(oe=n.domElement)==null||oe.ownerDocument.removeEventListener("pointermove",H),(Te=n.domElement)==null||Te.ownerDocument.removeEventListener("pointerup",L),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",ge)};const n=this,i={type:"change"},s={type:"start"},o={type:"end"},c={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let u=c.NONE;const h=1e-6,f=new pp,d=new pp;let m=1;const g=new B,y=new we,M=new we,x=new we,v=new we,w=new we,E=new we,T=new we,U=new we,I=new we,N=new B,D=new we;let C=!1;const A=[],F={};function j(){return 2*Math.PI/60/60*n.autoRotateSpeed}function Z(){return Math.pow(.95,n.zoomSpeed)}function $(X){n.reverseOrbit||n.reverseHorizontalOrbit?d.theta+=X:d.theta-=X}function ae(X){n.reverseOrbit||n.reverseVerticalOrbit?d.phi+=X:d.phi-=X}const ne=(()=>{const X=new B;return function(Ce,W){X.setFromMatrixColumn(W,0),X.multiplyScalar(-Ce),g.add(X)}})(),xe=(()=>{const X=new B;return function(Ce,W){n.screenSpacePanning===!0?X.setFromMatrixColumn(W,1):(X.setFromMatrixColumn(W,0),X.crossVectors(n.object.up,X)),X.multiplyScalar(Ce),g.add(X)}})(),k=(()=>{const X=new B;return function(Ce,W){const oe=n.domElement;if(oe&&n.object instanceof wn&&n.object.isPerspectiveCamera){const Te=n.object.position;X.copy(Te).sub(n.target);let Je=X.length();Je*=Math.tan(n.object.fov/2*Math.PI/180),ne(2*Ce*Je/oe.clientHeight,n.object.matrix),xe(2*W*Je/oe.clientHeight,n.object.matrix)}else oe&&n.object instanceof Fr&&n.object.isOrthographicCamera?(ne(Ce*(n.object.right-n.object.left)/n.object.zoom/oe.clientWidth,n.object.matrix),xe(W*(n.object.top-n.object.bottom)/n.object.zoom/oe.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function ee(X){n.object instanceof wn&&n.object.isPerspectiveCamera||n.object instanceof Fr&&n.object.isOrthographicCamera?m=X:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Q(X){ee(m/X)}function fe(X){ee(m*X)}function Se(X){if(!n.zoomToCursor||!n.domElement)return;C=!0;const re=n.domElement.getBoundingClientRect(),Ce=X.clientX-re.left,W=X.clientY-re.top,oe=re.width,Te=re.height;D.x=Ce/oe*2-1,D.y=-(W/Te)*2+1,N.set(D.x,D.y,1).unproject(n.object).sub(n.object.position).normalize()}function ke(X){return Math.max(n.minDistance,Math.min(n.maxDistance,X))}function le(X){y.set(X.clientX,X.clientY)}
3950function Ie(X){Se(X),T.set(X.clientX,X.clientY)}function Pe(X){v.set(X.clientX,X.clientY)}function Be(X){M.set(X.clientX,X.clientY),x.subVectors(M,y).multiplyScalar(n.rotateSpeed);const re=n.domElement;re&&($(2*Math.PI*x.x/re.clientHeight),ae(2*Math.PI*x.y/re.clientHeight)),y.copy(M),n.update()}function nt(X){U.set(X.clientX,X.clientY),I.subVectors(U,T),I.y>0?Q(Z()):I.y<0&&fe(Z()),T.copy(U),n.update()}function Et(X){w.set(X.clientX,X.clientY),E.subVectors(w,v).multiplyScalar(n.panSpeed),k(E.x,E.y),v.copy(w),n.update()}function dt(X){Se(X),X.deltaY<0?fe(Z()):X.deltaY>0&&Q(Z()),n.update()}function Nt(X){let re=!1;switch(X.code){case n.keys.UP:k(0,n.keyPanSpeed),re=!0;break;case n.keys.BOTTOM:k(0,-n.keyPanSpeed),re=!0;break;case n.keys.LEFT:k(n.keyPanSpeed,0),re=!0;break;case n.keys.RIGHT:k(-n.keyPanSpeed,0),re=!0;break}re&&(X.preventDefault(),n.update())}function It(){if(A.length==1)y.set(A[0].pageX,A[0].pageY);else{const X=.5*(A[0].pageX+A[1].pageX),re=.5*(A[0].pageY+A[1].pageY);y.set(X,re)}}function pt(){if(A.length==1)v.set(A[0].pageX,A[0].pageY);else{const X=.5*(A[0].pageX+A[1].pageX),re=.5*(A[0].pageY+A[1].pageY);
3950v.set(X,re)}}function z(){const X=A[0].pageX-A[1].pageX,re=A[0].pageY-A[1].pageY,Ce=Math.sqrt(X*X+re*re);T.set(0,Ce)}function Ve(){n.enableZoom&&z(),n.enablePan&&pt()}function Ue(){n.enableZoom&&z(),n.enableRotate&&It()}function We(X){if(A.length==1)M.set(X.pageX,X.pageY);else{const Ce=vt(X),W=.5*(X.pageX+Ce.x),oe=.5*(X.pageY+Ce.y);M.set(W,oe)}x.subVectors(M,y).multiplyScalar(n.rotateSpeed);const re=n.domElement;re&&($(2*Math.PI*x.x/re.clientHeight),ae(2*Math.PI*x.y/re.clientHeight)),y.copy(M)}function Me(X){if(A.length==1)w.set(X.pageX,X.pageY);else{const re=vt(X),Ce=.5*(X.pageX+re.x),W=.5*(X.pageY+re.y);w.set(Ce,W)}E.subVectors(w,v).multiplyScalar(n.panSpeed),k(E.x,E.y),v.copy(w)}function et(X){const re=vt(X),Ce=X.pageX-re.x,W=X.pageY-re.y,oe=Math.sqrt(Ce*Ce+W*W);U.set(0,oe),I.set(0,Math.pow(U.y/T.y,n.zoomSpeed)),Q(I.y),T.copy(U)}function Ne(X){n.enableZoom&&et(X),n.enablePan&&Me(X)}function it(X){n.enableZoom&&et(X),n.enableRotate&&We(X)}function wt(X){var re,Ce;n.enabled!==!1&&(A.length===0&&((re=n.domElement)==null||re.ownerDocument.addEventListener("pointermove",H),(Ce=n.domElement)==null||Ce.ownerDocument.addEventListener("pointerup",L)),lt(X),X.pointerType==="touch"?st(X):se(X))}function H(X){n.enabled!==!1&&(X.pointerType==="touch"?Ye(X):me(X))}function L(X){var re,Ce,W;Ae(X),A.length===0&&((re=n.domElement)==null||re.releasePointerCapture(X.pointerId),(Ce=n.domElement)==null||Ce.ownerDocument.removeEventListener("pointermove",H),(W=n.domElement)==null||W.ownerDocument.removeEventListener("pointerup",L)),n.dispatchEvent(o),u=c.NONE}function se(X){let re;switch(X.button){case 0:re=n.mouseButtons.LEFT;break;case 1:re=n.mouseButtons.MIDDLE;break;case 2:re=n.mouseButtons.RIGHT;break;default:re=-1}switch(re){case zs.DOLLY:if(n.enableZoom===!1)return;Ie(X),u=c.DOLLY;break;case zs.ROTATE:if(X.ctrlKey||X.metaKey||X.shiftKey){if(n.enablePan===!1)return;Pe(X),u=c.PAN}else{if(n.enableRotate===!1)return;le(X),u=c.ROTATE}break;case zs.PAN:if(X.ctrlKey||X.metaKey||X.shiftKey){if(n.enableRotate===!1)return;le(X),u=c.ROTATE}else{if(n.enablePan===!1)return;Pe(X),u=c.PAN}break;default:u=c.NONE}u!==c.NONE&&n.dispatchEvent(s)}function me(X){if(n.enabled!==!1)switch(u){case c.ROTATE:if(n.enableRotate===!1)return;Be(X);break;case c.DOLLY:if(n.enableZoom===!1)return;nt(X);break;case c.PAN:if(n.enablePan===!1)return;Et(X);break}}function be(X){n.enabled===!1||n.enableZoom===!1||u!==c.NONE&&u!==c.ROTATE||(X.preventDefault(),n.dispatchEvent(s),dt(X),n.dispatchEvent(o))}function ge(X){n.enabled===!1||n.enablePan===!1||Nt(X)}function st(X){switch(Xe(X),A.length){case 1:switch(n.touches.ONE){case ks.ROTATE:if(n.enableRotate===!1)return;It(),u=c.TOUCH_ROTATE;break;case ks.PAN:if(n.enablePan===!1)return;pt(),u=c.TOUCH_PAN;break;default:u=c.NONE}break;case 2:switch(n.touches.TWO){case ks.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Ve(),u=c.TOUCH_DOLLY_PAN;break;case ks.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;Ue(),u=c.TOUCH_DOLLY_ROTATE;break;default:u=c.NONE}break;default:u=c.NONE}u!==c.NONE&&n.dispatchEvent(s)}function Ye(X){switch(Xe(X),u){case c.TOUCH_ROTATE:if(n.enableRotate===!1)return;We(X),n.update();break;case c.TOUCH_PAN:if(n.enablePan===!1)return;Me(X),n.update();break;case c.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Ne(X),n.update();break;case c.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;it(X),n.update();break;default:u=c.NONE}}function ot(X){n.enabled!==!1&&X.preventDefault()}function lt(X){A.push(X)}function Ae(X){delete F[X.pointerId];for(let re=0;re<A.length;re++)if(A[re].pointerId==X.pointerId){A.splice(re,1);return}}function Xe(X){let re=F[X.pointerId];re===void 0&&(re=new we,F[X.pointerId]=re),re.set(X.pageX,X.pageY)}function vt(X){const re=X.pointerId===A[0].pointerId?A[1]:A[0];return F[re.pointerId]}this.dollyIn=(X=Z())=>{fe(X),n.update()},this.dollyOut=(X=Z())=>{Q(X),n.update()},this.getScale=()=>m,this.setScale=X=>{ee(X),n.update()},this.getZoomScale=()=>Z(),t!==void 0&&this.connect(t),this.update()}};class eI extends Qp{constructor(e){super(e),this.type=Bn}parse(e){const o=function(D,C){switch(D){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(C||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(C||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(C||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(C||""))}},f=` 3951`,d=function(D,C,A){C=C||1024;let j=D.pos,Z=-1,$=0,ae="",ne=String.fromCharCode.apply(null,new Uint16Array(D.subarray(j,j+128)));for(;0>(Z=ne.indexOf(f))&&$<C&&j<D.byteLength;)ae+=ne,$+=ne.length,j+=128,ne+=String.fromCharCode.apply(null,new Uint16Array(D.subarray(j,j+128)));return-1<Z?(D.pos+=$+Z+1,ae+ne.slice(0,Z)):!1},m=function(D){const C=/^#\?(\S+)/,A=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,F=/^\s*EXPOSURE\s*=\s
vendor: 22,287 bytes, lines 3951-3954
3951*(\d+(\.\d+)?)\s*$/,j=/^\s*FORMAT=(\S+)\s*$/,Z=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,$={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let ae,ne;for((D.pos>=D.byteLength||!(ae=d(D)))&&o(1,"no header found"),(ne=ae.match(C))||o(3,"bad initial token"),$.valid|=1,$.programtype=ne[1],$.string+=ae+` 3952`;ae=d(D),ae!==!1;){if($.string+=ae+` 3953`,ae.charAt(0)==="#"){$.comments+=ae+` 3954`;continue}if((ne=ae.match(A))&&($.gamma=parseFloat(ne[1])),(ne=ae.match(F))&&($.exposure=parseFloat(ne[1])),(ne=ae.match(j))&&($.valid|=2,$.format=ne[1]),(ne=ae.match(Z))&&($.valid|=4,$.height=parseInt(ne[1],10),$.width=parseInt(ne[2],10)),$.valid&2&&$.valid&4)break}return $.valid&2||o(3,"missing format specifier"),$.valid&4||o(3,"missing image size specifier"),$},g=function(D,C,A){const F=C;if(F<8||F>32767||D[0]!==2||D[1]!==2||D[2]&128)return new Uint8Array(D);F!==(D[2]<<8|D[3])&&o(3,"wrong scanline width");const j=new Uint8Array(4*C*A);j.length||o(4,"unable to allocate buffer space");let Z=0,$=0;const ae=4*F,ne=new Uint8Array(4),xe=new Uint8Array(ae);let k=A;for(;k>0&&$<D.byteLength;){$+4>D.byteLength&&o(1),ne[0]=D[$++],ne[1]=D[$++],ne[2]=D[$++],ne[3]=D[$++],(ne[0]!=2||ne[1]!=2||(ne[2]<<8|ne[3])!=F)&&o(3,"bad rgbe scanline format");let ee=0,Q;for(;ee<ae&&$<D.byteLength;){Q=D[$++];const Se=Q>128;if(Se&&(Q-=128),(Q===0||ee+Q>ae)&&o(3,"bad scanline data"),Se){const ke=D[$++];for(let le=0;le<Q;le++)xe[ee++]=ke}else xe.set(D.subarray($,$+Q),ee),ee+=Q,$+=Q}const fe=F;for(let Se=0;Se<fe;Se++){let ke=0;j[Z]=xe[Se+ke],ke+=F,j[Z+1]=xe[Se+ke],ke+=F,j[Z+2]=xe[Se+ke],ke+=F,j[Z+3]=xe[Se+ke],Z+=4}k--}return j},y=function(D,C,A,F){const j=D[C+3],Z=Math.pow(2,j-128)/255;A[F+0]=D[C+0]*Z,A[F+1]=D[C+1]*Z,A[F+2]=D[C+2]*Z,A[F+3]=1},M=function(D,C,A,F){const j=D[C+3],Z=Math.pow(2,j-128)/255;A[F+0]=Ys.toHalfFloat(Math.min(D[C+0]*Z,65504)),A[F+1]=Ys.toHalfFloat(Math.min(D[C+1]*Z,65504)),A[F+2]=Ys.toHalfFloat(Math.min(D[C+2]*Z,65504)),A[F+3]=Ys.toHalfFloat(1)},x=new Uint8Array(e);x.pos=0;const v=m(x),w=v.width,E=v.height,T=g(x.subarray(x.pos),w,E);let U,I,N;switch(this.type){case pn:N=T.length/4;const D=new Float32Array(N*4);for(let A=0;A<N;A++)y(T,A*4,D,A*4);U=D,I=pn;break;case Bn:N=T.length/4;const C=new Uint16Array(N*4);for(let A=0;A<N;A++)M(T,A*4,C,A*4);U=C,I=Bn;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:w,height:E,data:U,header:v.string,gamma:v.gamma,exposure:v.exposure,type:I}}setDataType(e){return this.type=e,this}load(e,t,n,i){function s(o,c){switch(o.type){case pn:case Bn:"colorSpace"in o?o.colorSpace="srgb-linear":o.encoding=3e3,o.minFilter=tn,o.magFilter=tn,o.generateMipmaps=!1,o.flipY=!0;break}t&&t(o,c)}return super.load(e,s,n,i)}}const Va=xx>=152;class tI extends Qp{constructor(e){super(e),this.type=Bn}parse(e){const C=Math.pow(2.7182818,2.2);function A(R,O){for(var J=0,he=0;he<65536;++he)(he==0||R[he>>3]&1<<(he&7))&&(O[J++]=he);for(var pe=J-1;J<65536;)O[J++]=0;return pe}function F(R){for(var O=0;O<16384;O++)R[O]={},R[O].len=0,R[O].lit=0,R[O].p=null}const j={l:0,c:0,lc:0};function Z(R,O,J,he,pe){for(;J<R;)O=O<<8|vt(he,pe),J+=8;J-=R,j.l=O>>J&(1<<R)-1,j.c=O,j.lc=J}const $=new Array(59);function ae(R){for(var O=0;O<=58;++O)$[O]=0;for(var O=0;O<65537;++O)$[R[O]]+=1;for(var J=0,O=58;O>0;--O){var he=J+$[O]>>1;$[O]=J,J=he}for(var O=0;O<65537;++O){var pe=R[O];pe>0&&(R[O]=pe|$[pe]++<<6)}}function ne(R,O,J,he,pe,ve,He){for(var Oe=J,P=0,G=0;pe<=ve;pe++){if(Oe.value-J.value>he)return!1;Z(6,P,G,R,Oe);var q=j.l;if(P=j.c,G=j.lc,He[pe]=q,q==63){if(Oe.value-J.value>he)throw"Something wrong with hufUnpackEncTable";Z(8,P,G,R,Oe);var Y=j.l+6;if(P=j.c,G=j.lc,pe+Y>ve+1)throw"Something wrong with hufUnpackEncTable";for(;Y--;)He[pe++]=0;pe--}else if(q>=59){var Y=q-59+2;if(pe+Y>ve+1)throw"Something wrong with hufUnpackEncTable";for(;Y--;)He[pe++]=0;pe--}}ae(He)}function xe(R){return R&63}function k(R){return R>>6}function ee(R,O,J,he){for(;O<=J;O++){var pe=k(R[O]),ve=xe(R[O]);if(pe>>ve)throw"Invalid table entry";if(ve>14){var He=he[pe>>ve-14];if(He.len)throw"Invalid table entry";if(He.lit++,He.p){var Oe=He.p;He.p=new Array(He.lit);for(var P=0;P<He.lit-1;++P)He.p[P]=Oe[P]}else He.p=new Array(1);He.p[He.lit-1]=O}else if(ve)for(var G=0,P=1<<14-ve;P>0;P--){var He=he[(pe<<14-ve)+G];if(He.len||He.p)throw"Invalid table entry";He.len=ve,He.lit=O,G++}}return!0}const Q={c:0,lc:0};function fe(R,O,J,he){R=R<<8|vt(J,he),O+=8,Q.c=R,Q.lc=O}const Se={c:0,lc:0};function ke(R,O,J,he,pe,ve,He,Oe,P,G){if(R==O){he<8&&(fe(J,he,pe,He),J=Q.c,he=Q.lc),he-=8;var q=J>>he,q=new Uint8Array([q])[0];if(P.value+q>G)return!1;for(var Y=Oe[P.value-1];q-- >0;)Oe[P.value++]=Y}else if(P.value<G)Oe[P.value++]=R;else return!1;Se.c=J,Se.lc=he}function le(R){return R&65535}function Ie(R){var O=le(R);return O>32767?O-65536:O}const Pe={a:0,b:0};function Be(R,O){var J=Ie(R),he=Ie(O),pe=he,ve=J+(pe&1)+(pe>>1),He=ve,Oe=ve-pe;Pe.a=He,Pe.b=Oe}function nt(R,O){var J=le(R),he=le(O),pe=J-(he>>1)&65535,ve=he+pe-32768&65535;Pe.a=ve,Pe.b=pe}function Et(R,O,J,he,pe,ve,He){for(var Oe=He<16384,P=J>pe?pe:J,G=1,q;G<=P;)G<<=1;for(G>>=1,q=G,G>>=1;G>=1;){for(var Y=0,K=Y+ve*(pe-q),ce=ve*G,_e=ve*q,Le=he*G,Re=he*q,qe,Ze,Fe,je;Y<=K;Y+=_e){for(var ct=Y,Mt=Y+he*(J-q);ct<=Mt;ct+=Re){var ft=ct+Le,mt=ct+ce,at=mt+Le;Oe?(Be(R[ct+O],R[mt+O]),qe=Pe.a,Fe=Pe.b,Be(R[ft+O],R[at+O]),Ze=Pe.a,je=Pe.b,Be(qe,Ze),R[ct+O]=Pe.a,R[ft+O]=Pe.b,Be(Fe,je),R[mt+O]=Pe.a,R[at+O]=Pe.b):(nt(R[ct+O],R[mt+O]),qe=Pe.a,Fe=Pe.b,nt(R[ft+O],R[at+O]),Ze=Pe.a,je=Pe.b,nt(qe,Ze),R[ct+O]=Pe.a,R[ft+O]=Pe.b,nt(Fe,je),R[mt+O]=Pe.a,R[at+O]=Pe.b)}if(J&G){var mt=ct+ce;Oe?Be(R[ct+O],R[mt+O]):nt(R[ct+O],R[mt+O]),qe=Pe.a,R[mt+O]=Pe.b,R[ct+O]=qe}}if(pe&G)for(var ct=Y,Mt=Y+he*(J-q);ct<=Mt;ct+=Re){var ft=ct+Le;Oe?Be(R[ct+O],R[ft+O]):nt(R[ct+O],R[ft+O]),qe=Pe.a,R[ft+O]=Pe.b,R[ct+O]=qe}q=G,G>>=1}return Y}function dt(R,O,J,he,pe,ve,He,Oe,P,G){for(var q=0,Y=0,K=Oe,ce=Math.trunc(pe.value+(ve+7)/8);pe.value<ce;)for(fe(q,Y,J,pe),q=Q.c,Y=Q.lc;Y>=14;){var _e=q>>Y-14&16383,Le=O[_e];if(Le.len)Y-=Le.len,ke(Le.lit,He,q,Y,J,he,pe,P,G,K),q=Se.c,Y=Se.lc;else{if(!Le.p)throw"hufDecode issues";var Re;for(Re=0;Re<Le.lit;Re++){for(var qe=xe(R[Le.p[Re]]);Y<qe&&pe.value<ce;)fe(q,Y,J,pe),q=Q.c,Y=Q.lc;if(Y>=qe&&k(R[Le.p[Re]])==(q>>Y-qe&(1<<qe)-1)){Y-=qe,ke(Le.p[Re],He,q,Y,J,he,pe,P,G,K),q=Se.c,Y=Se.lc;break}}if(Re==Le.lit)throw"hufDecode issues"}}var Ze=8-ve&7;for(q>>=Ze,Y-=Ze;Y>0;){var Le=O[q<<14-Y&16383];if(Le.len)Y-=Le.len,ke(Le.lit,He,q,Y,J,he,pe,P,G,K),q=Se.c,Y=Se.lc;else throw"hufDecode issues"}return!0}function Nt(R,O,J,he,pe,ve){var He={value:0},Oe=J.value,P=Xe(O,J),G=Xe(O,J);J.value+=4;var q=Xe(O,J);if(J.value+=4,P<0||P>=65537||G<0||G>=65537)throw"Something wrong with HUF_ENCSIZE";var Y=new Array(65537),K=new Array(16384);F(K);var ce=he-(J.value-Oe);if(ne(R,O,J,ce,P,G,Y),q>8*(he-(J.value-Oe)))throw"Something wrong with hufUncompress";ee(Y,P,G,K),dt(Y,K,R,O,J,q,G,ve,pe,He)}function It(R,O,J){for(var he=0;he<J;++he)O[he]=R[O[he]]}function pt(R){for(var O=1;O<R.length;O++){var J=R[O-1]+R[O]-128;R[O]=J}}function z(R,O){for(var J=0,he=Math.floor((R.length+1)/2),pe=0,ve=R.length-1;!(pe>ve||(O[pe++]=R[J++],pe>ve));)O[pe++]=R[he++]}function Ve(R){for(var O=R.byteLength,J=new Array,he=0,pe=new DataView(R);O>0;){var ve=pe.getInt8(he++);if(ve<0){var He=-ve;O-=He+1;for(var Oe=0;Oe<He;Oe++)J.push(pe.getUint8(he++))}else{var He=ve;O-=2;for(var P=pe.getUint8(he++),Oe=0;Oe<He+1;Oe++)J.push(P)}}return J}function Ue(R,O,J,he,pe,ve){var ft=new DataView(ve.buffer),He=J[R.idx[0]].width,Oe=J[R.idx[0]].height,P=3,G=Math.floor(He/8),q=Math.ceil(He/8),Y=Math.ceil(Oe/8),K=He-(q-1)*8,ce=Oe-(Y-1)*8,_e={value:0},Le=new Array(P),Re=new Array(P),qe=new Array(P),Ze=new Array(P),Fe=new Array(P);for(let Ot=0;Ot<P;++Ot)Fe[Ot]=O[R.idx[Ot]],Le[Ot]=Ot<1?0:Le[Ot-1]+q*Y,Re[Ot]=new Float32Array(64),qe[Ot]=new Uint16Array(64),Ze[Ot]=new Uint16Array(q*64);for(let Ot=0;Ot<Y;++Ot){var je=8;Ot==Y-1&&(je=ce);var ct=8;for(let Pt=0;Pt<q;++Pt){Pt==q-1&&(ct=K);for(let Xt=0;Xt<P;++Xt)qe[Xt].fill(0),qe[Xt][0]=pe[Le[Xt]++],We(_e,he,qe[Xt]),Me(qe[Xt],Re[Xt]),et(Re[Xt]);Ne(Re);for(let Xt=0;Xt<P;++Xt)it(Re[Xt],Ze[Xt],Pt*64)}let an=0;for(let Pt=0;Pt<P;++Pt){const Xt=J[R.idx[Pt]].type;for(let Tt=8*Ot;Tt<8*Ot+je;++Tt){an=Fe[Pt][Tt];for(let vn=0;vn<G;++vn){const rn=vn*64+(Tt&7)*8;ft.setUint16(an+0*2*Xt,Ze[Pt][rn+0],!0),ft.setUint16(an+1*2*Xt,Ze[Pt][rn+1],!0),ft.setUint16(an+2*2*Xt,Ze[Pt][rn+2],!0),ft.setUint16(an+3*2*Xt,Ze[Pt][rn+3],!0),ft.setUint16(an+4*2*Xt,Ze[Pt][rn+4],!0),ft.setUint16(an+5*2*Xt,Ze[Pt][rn+5],!0),ft.setUint16(an+6*2*Xt,Ze[Pt][rn+6],!0),ft.setUint16(an+7*2*Xt,Ze[Pt][rn+7],!0),an+=8*2*Xt}}if(G!=q)for(let Tt=8*Ot;Tt<8*Ot+je;++Tt){const vn=Fe[Pt][Tt]+8*G*2*Xt,rn=G*64+(Tt&7)*8;for(let ln=0;ln<ct;++ln)ft.setUint16(vn+ln*2*Xt,Ze[Pt][rn+ln],!0)}}}for(var Mt=new Uint16Array(He),ft=new DataView(ve.buffer),mt=0;mt<P;++mt){J[R.idx[mt]].decoded=!0;var at=J[R.idx[mt]].type;if(J[mt].type==2)for(var Wt=0;Wt<Oe;++Wt){const Ot=Fe[mt][Wt];for(var At=0;At<He;++At)Mt[At]=ft.getUint16(Ot+At*2*at,!0);for(var At=0;At<He;++At)ft.setFloat32(Ot+At*2*at,oe(Mt[At]),!0)}}}function We(R,O,J){for(var he,pe=1;pe<64;)he=O[R.value],he==65280?pe=64:he>>8==255?pe+=he&255:(J[pe]=he,pe++),R.value++}function Me(R,O){O[0]=oe(R[0]),O[1]=oe(R[1]),O[2]=oe(R[5]),O[3]=oe(R[6]),O[4]=oe(R[14]),O[5]=oe(R[15]),O[6]=oe(R[27]),O[7]=oe(R[28]),O[8]=oe(R[2]),O[9]=oe(R[4]),O[10]=oe(R[7]),O[11]=oe(R[13]),O[12]=oe(R[16]),O[13]=oe(R[26]),O[14]=oe(R[29]),O[15]=oe(R[42]),O[16]=oe(R[3]),O[17]=oe(R[8]),O[18]=oe(R[12]),O[19]=oe(R[17]),O[20]=oe(R[25]),O[21]=oe(R[30]),O[22]=oe(R[41]),O[23]=oe(R[43]),O[24]=oe(R[9]),O[25]=oe(R[11]),O[26]=oe(R[18]),O[27]=oe(R[24]),O[28]=oe(R[31]),O[29]=oe(R[40]),O[30]=oe(R[44]),O[31]=oe(R[53]),O[32]=oe(R[10]),O[33]=oe(R[19]),O[34]=oe(R[23]),O[35]=oe(R[32]),O[36]=oe(R[39]),O[37]=oe(R[45]),O[38]=oe(R[52]),O[39]=oe(R[54]),O[40]=oe(R[20]),O[41]=oe(R[22]),O[42]=oe(R[33]),O[43]=oe(R[38]),O[44]=oe(R[46]),O[45]=oe(R[51]),O[46]=oe(R[55]),O[47]=oe(R[60]),O[48]=oe(R[21]),O[49]=oe(R[34]),O[50]=oe(R[37]),O[51]=oe(R[47]),O[52]=oe(R[50]),O[53]=oe(R[56]),O[54]=oe(R[59]),O[55]=oe(R[61]),O[56]=oe(R[35]),O[57]=oe(R[36]),O[58]=oe(R[48]),O[59]=oe(R[49]),O[60]=oe(R[57]),O[61]=oe(R[58]),O[62]=oe(R[62]),O[63]=oe(R[63])}function et(R){const O=.5*Math.cos(.7853975),J=.5*Math.cos(3.14159/16),he=.5*Math.cos(3.14159/8),pe=.5*Math.cos(3*3.14159/16),ve=.5*Math.cos(5*3.14159/16),He=.5*Math.cos(3*3.14159/8),Oe=.5*Math.cos(7*3.14159/16);for(var P=new Array(4),G=new Array(4),q=new Array(4),Y=new Array(4),K=0;K<8;++K){var ce=K*8;P[0]=he*R[ce+2],P[1]=He*R[ce+2],P[2]=he*R[ce+6],P[3]=He*R[ce+6],G[0]=J*R[ce+1]+pe*R[ce+3]+ve*R[ce+5]+Oe*R[ce+7],G[1]=pe*R[ce+1]-Oe*R[ce+3]-J*R[ce+5]-ve*R[ce+7],G[2]=ve*R[ce+1]-J*R[ce+3]+Oe*R[ce+5]+pe*R[ce+7],G[3]=Oe*R[ce+1]-ve*R[ce+3]+pe*R[ce+5]-J*R[ce+7],q[0]=O*(R[ce+0]+R[ce+4]),q[3]=O*(R[ce+0]-R[ce+4]),q[1]=P[0]+P[3],q[2]=P[1]-P[2],Y[0]=q[0]+q[1],Y[1]=q[3]+q[2],Y[2]=q[3]-q[2],Y[3]=q[0]-q[1],R[ce+0]=Y[0]+G[0],R[ce+1]=Y[1]+G[1],R[ce+2]=Y[2]+G[2],R[ce+3]=Y[3]+G[3],R[ce+4]=Y[3]-G[3],R[ce+5]=Y[2]-G[2],R[ce+6]=Y[1]-G[1],R[ce+7]=Y[0]-G[0]}for(var _e=0;_e<8;++_e)P[0]=he*R[16+_e],P[1]=He*R[16+_e],P[2]=he*R[48+_e],P[3]=He*R[48+_e],G[0]=J*R[8+_e]+pe*R[24+_e]+ve*R[40+_e]+Oe*R[56+_e],G[1]=pe*R[8+_e]-Oe*R[24+_e]-J*R[40+_e]-ve*R[56+_e],G[2]=ve*R[8+_e]-J*R[24+_e]+Oe*R[40+_e]+pe*R[56+_e],G[3]=Oe*R[8+_e]-ve*R[24+_e]+pe*R[40+_e]-J*R[56+_e],q[0]=O*(R[_e]+R[32+_e]),q[3]=O*(R[_e]-R[32+_e]),q[1]=P[0]+P[3],q[2]=P[1]-P[2],Y[0]=q[0]+q[1],Y[1]=q[3]+q[2],Y[2]=q[3]-q[2],Y[3]=q[0]-q[1],R[0+_e]=Y[0]+G[0],R[8+_e]=Y[1]+G[1],R[16+_e]=Y[2]+G[2],R[24+_e]=Y[3]+G[3],R[32+_e]=Y[3]-G[3],R[40+_e]=Y[2]-G[2],R[48+_e]=Y[1]-G[1],R[56+_e]=Y[0]-G[0]}function Ne(R){for(var O=0;O<64;++O){var J=R[0][O],he=R[1][O],pe=R[2][O];R[0][O]=J+1.5747*pe,R[1][O]=J-.1873*he-.4682*pe,R[2][O]=J+1.8556*he}}function it(R,O,J){for(var he=0;he<64;++he)O[J+he]=Ys.toHalfFloat(wt(R[he]))}function wt(R){return R<=1?Math.sign(R)*Math.pow(Math.abs(R),2.2):Math.sign(R)*Math.pow(C,Math.abs(R)-1)}function H(R){return new DataView(R.array.buffer,R.offset.value,R.size)}function L(R){var O=R.viewer.buffer.slice(R.offset.value,R.offset.value+R.size),J=new Uint8Array(Ve(O)),he=new Uint8Array(J.length);return pt(J),z(J,he),new DataView(he.buffer)}function se(R){var O=R.array.slice(R.offset.value,R.offset.value+R.size),J=wu(O),he=new Uint8Array(J.length);return pt(J),z(J,he),new DataView(he.buffer)}function me(R){for(var O=R.viewer,J={value:R.offset.value},he=new Uint16Array(R.width*R.scanlineBlockSize*(R.channels*R.type)),pe=new Uint8Array(8192),ve=0,He=new Array(R.channels),Oe=0;Oe<R.channels;Oe++)He[Oe]={},He[Oe].start=ve,He[Oe].end=He[Oe].start,He[Oe].nx=R.width,He[Oe].ny=R.lines,He[Oe].size=R.type,ve+=He[Oe].nx*He[Oe].ny*He[Oe].size;var P=Te(O,J),G=Te(O,J);if(G>=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if(P<=G)for(var Oe=0;Oe<G-P+1;Oe++)pe[Oe+P]=X(O,J);var q=new Uint16Array(65536),Y=A(pe,q),K=Xe(O,J);Nt(R.array,O,J,K,he,ve);for(var Oe=0;Oe<R.channels;++Oe)for(var ce=He[Oe],_e=0;_e<He[Oe].size;++_e)Et(he,ce.start+_e,ce.nx,ce.size,ce.ny,ce.nx*ce.size,Y);It(q,he,ve);for(var Le=0,Re=new Uint8Array(he.buffer.byteLength),qe=0;qe<R.lines;qe++)for(var Ze=0;Ze<R.channels;Ze++){var ce=He[Ze],Fe=ce.nx*ce.size,je=new Uint8Array(he.buffer,ce.end*2,Fe*2);Re.set(je,Le),Le+=Fe*2,ce.end+=Fe}return new DataView(Re.buffer)}function be(R){var O=R.array.slice(R.offset.value,R.offset.value+R.size),J=wu(O);const he=R.lines*R.channels*R.width,pe=R.type==1?new Uint16Array(he):new Uint32Array(he);let ve=0,He=0;const Oe=new Array(4);for(let P=0;P<R.lines;P++)for(let G=0;G<R.channels;G++){let q=0;switch(R.type){case 1:Oe[0]=ve,Oe[1]=Oe[0]+R.width,ve=Oe[1]+R.width;for(let Y=0;Y<R.width;++Y){const K=J[Oe[0]++]<<8|J[Oe[1]++];q+=K,pe[He]=q,He++}break;case 2:Oe[0]=ve,Oe[1]=Oe[0]+R.width,Oe[2]=Oe[1]+R.width,ve=Oe[2]+R.width;for(let Y=0;Y<R.width;++Y){const K=J[Oe[0]++]<<24|J[Oe[1]++]<<16|J[Oe[2]++]<<8;q+=K,pe[He]=q,He++}break}}return new DataView(pe.buffer)}function ge(R){var O=R.viewer,J={value:R.offset.value},he=new Uint8Array(R.width*R.lines*(R.channels*R.type*2)),pe={version:re(O,J),unknownUncompressedSize:re(O,J),unknownCompressedSize:re(O,J),acCompressedSize:re(O,J),dcCompressedSize:re(O,J),rleCompressedSize:re(O,J),rleUncompressedSize:re(O,J),rleRawSize:re(O,J),totalAcUncompressedCount:re(O,J),totalDcUncompressedCount:re(O,J),acCompression:re(O,J)};if(pe.version<2)throw"EXRLoader.parse: "+ci.compression+" version "+pe.version+" is unsupported";for(var ve=new Array,He=Te(O,J)-2;He>0;){var Oe=st(O.buffer,J),P=X(O,J),G=P>>2&3,q=(P>>4)-1,Y=new Int8Array([q])[0],K=X(O,J);ve.push({name:Oe,index:Y,type:K,compression:G}),He-=Oe.length+3}for(var ce=ci.channels,_e=new Array(R.channels),Le=0;Le<R.channels;++Le){var Re=_e[Le]={},qe=ce[Le];Re.name=qe.name,Re.compression=0,Re.decoded=!1,Re.type=qe.pixelType,Re.pLinear=qe.pLinear,Re.width=R.width,Re.height=R.lines}for(var Ze={idx:new Array(3)},Fe=0;Fe<R.channels;++Fe)for(var Re=_e[Fe],Le=0;Le<ve.length;++Le){var je=ve[Le];Re.name==je.name&&(Re.compression=je.compression,je.index>=0&&(Ze.idx[je.index]=Fe),Re.offset=Fe)}if(pe.acCompressedSize>0)switch(pe.acCompression){case 0:var ft=new Uint16Array(pe.totalAcUncompressedCount);Nt(R.array,O,J,pe.acCompressedSize,ft,pe.totalAcUncompressedCount);break;case 1:var ct=R.array.slice(J.value,J.value+pe.totalAcUncompressedCount),Mt=wu(ct),ft=new Uint16Array(Mt.buffer);J.value+=pe.totalAcUncompressedCount;break}if(pe.dcCompressedSize>0){var mt={array:R.array,offset:J,size:pe.dcCompressedSize},at=new Uint16Array(se(mt).buffer);J.value+=pe.dcCompressedSize}if(pe.rleRawSize>0){var ct=R.array.slice(J.value,J.value+pe.rleCompressedSize),Mt=wu(ct),Wt=Ve(Mt.buffer);J.value+=pe.rleCompressedSize}for(var At=0,Ot=new Array(_e.length),Le=0;Le<Ot.length;++Le)Ot[Le]=new Array;for(var an=0;an<R.lines;++an)for(var Pt=0;Pt<_e.length;++Pt)Ot[Pt].push(At),At+=_e[Pt].width*R.type*2;Ue(Ze,Ot,_e,ft,at,he);for(var Le=0;Le<_e.length;++Le){var Re=_e[Le];if(!Re.decoded)switch(Re.compression){case 2:for(var Xt=0,Tt=0,an=0;an<R.lines;++an){for(var vn=Ot[Le][Xt],rn=0;rn<Re.width;++rn){for(var ln=0;ln<2*Re.type;++ln)he[vn++]=Wt[Tt+ln*Re.width*Re.height];Tt++}Xt++}break;case 1:default:throw"EXRLoader.parse: unsupported channel compression"}}return new DataView(he.buffer)}function st(R,O){for(var J=new Uint8Array(R),he=0;J[O.value+he]!=0;)he+=1;var pe=new TextDecoder().decode(J.slice(O.value,O.value+he));return O.value=O.value+he+1,pe}function Ye(R,O,J){var he=new TextDecoder().decode(new Uint8Array(R).slice(O.value,O.value+J));return O.value=O.value+J,he}function ot(R,O){var J=Ae(R,O),he=Xe(R,O);return[J,he]}function lt(R,O){var J=Xe(R,O),he=Xe(R,O);return[J,he]}function Ae(R,O){var J=R.getInt32(O.value,!0);return O.value=O.value+4,J}function Xe(R,O){var J=R.getUint32(O.value,!0);return O.value=O.value+4,J}function vt(R,O){var J=R[O.value];return O.value=O.value+1,J}function X(R,O){var J=R.getUint8(O.value);return O.value=O.value+1,J}const re=function(R,O){let J;return"getBigInt64"in DataView.prototype?J=Number(R.getBigInt64(O.value,!0)):J=R.getUint32(O.value+4,!0)+Number(R.getUint32(O.value,!0)<<32),O.value+=8,J};function Ce(R,O){var J=R.getFloat32(O.value,!0);return O.value+=4,J}function W(R,O){return Ys.toHalfFloat(Ce(R,O))}function oe(R){var O=(R&31744)>>10,J=R&1023;return(R>>15?-1:1)*(O?O===31?J?NaN:1/0:Math.pow(2,O-15)*(1+J/1024):6103515625e-14*(J/1024))}function Te(R,O){var J=R.getUint16(O.value,!0);return O.value+=2,J}function Je(R,O){return oe(Te(R,O))}function ze(R,O,J,he){for(var pe=J.value,ve=[];J.value<pe+he-1;){var He=st(O,J),Oe=Ae(R,J),P=X(R,J);J.value+=3;var G=Ae(R,J),q=Ae(R,J);ve.push({name:He,pixelType:Oe,pLinear:P,xSampling:G,ySampling:q})}return J.value+=1,ve}function Ee(R,O){var J=Ce(R,O),he=Ce(R,O),pe=Ce(R,O),ve=Ce(R,O),He=Ce(R,O),Oe=Ce(R,O),P=Ce(R,O),G=Ce(R,O);return{redX:J,redY:he,greenX:pe,greenY:ve,blueX:He,blueY:Oe,whiteX:P,whiteY:G}}function Ke(R,O){var J=["NO_COMPRESSION","RLE_COMPRESSION","ZIPS_COMPRESSION","ZIP_COMPRESSION","PIZ_COMPRESSION","PXR24_COMPRESSION","B44_COMPRESSION","B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"],he=X(R,O);return J[he]}function _t(R,O){var J=Xe(R,O),he=Xe(R,O),pe=Xe(R,O),ve=Xe(R,O);return{xMin:J,yMin:he,xMax:pe,yMax:ve}}function Yt(R,O){var J=["INCREASING_Y"],he=X(R,O);return J[he]}function Ht(R,O){var J=Ce(R,O),he=Ce(R,O);return[J,he]}function gn(R,O){var J=Ce(R,O),he=Ce(R,O),pe=Ce(R,O);return[J,he,pe]}function Dn(R,O,J,he,pe){if(he==="string"||he==="stringvector"||he==="iccProfile")return Ye(O,J,pe);if(he==="chlist")return ze(R,O,J,pe);if(he==="chromaticities")return Ee(R,J);if(he==="compression")return Ke(R,J);if(he==="box2i")return _t(R,J);if(he==="lineOrder")return Yt(R,J);if(he==="float")return Ce(R,J);if(he==="v2f")return Ht(R,J);if(he==="v3f")return gn(R,J);if(he==="int")return Ae(R,J);if(he==="rational")return ot(R,J);if(he==="timecode")return lt(R,J);if(he==="preview")return J.value+=pe,"skipped";J.value+=pe}function oo(R,O,J){const he={};if(R.getUint32(0,!0)!=20000630)throw"THREE.EXRLoader: provided file doesn't appear to be in OpenEXR format.";he.version=R.getUint8(4);const pe=R.getUint8(5);he.spec={singleTile:!!(pe&2),longName:!!(pe&4),deepFormat:!!(pe&8),multiPart:!!(pe&16)},J.value=8;for(var ve=!0;ve;){var He=st(O,J);if(He==0)ve=!1;else{var Oe=st(O,J),P=Xe(R,J),G=Dn(R,O,J,Oe,P);G===void 0?console.warn(`EXRLoader.parse: skipped unknown header attribute type '${Oe}'.`):he[He]=G}}if(pe&-5)throw console.error("EXRHeader:",he),"THREE.EXRLoader: provided file is currently unsupported.";return he}function ao(R,O,J,he,pe){const ve={size:0,viewer:O,array:J,offset:he,width:R.dataWindow.xMax-R.dataWindow.xMin+1,height:R.dataWindow.yMax-R.dataWindow.yMin+1,channels:R.channels.length,bytesPerLine:null,lines:null,inputSize:null,type:R.channels[0].pixelType,uncompress:null,getter:null,format:null,[Va?"colorSpace":"encoding"]:null};switch(R.compression){case"NO_COMPRESSION":ve.lines=1,ve.uncompress=H;break;case"RLE_COMPRESSION":ve.lines=1,ve.uncompress=L;break;case"ZIPS_COMPRESSION":ve.lines=1,ve.uncompress=se;break;case"ZIP_COMPRESSION":ve.lines=16,ve.uncompress=se;break;case"PIZ_COMPRESSION":ve.lines=32,ve.uncompress=me;break;case"PXR24_COMPRESSION":ve.lines=16,ve.uncompress=be;break;case"DWAA_COMPRESSION":ve.lines=32,ve.uncompress=ge;break;case"DWAB_COMPRESSION":ve.lines=256,ve.uncompress=ge;break;default:throw"EXRLoader.parse: "+R.compression+" is unsupported"}if(ve.scanlineBlockSize=ve.lines,ve.type==1)switch(pe){case pn:ve.getter=Je,ve.inputSize=2;break;case Bn:ve.getter=Te,ve.inputSize=2;break}else if(ve.type==2)switch(pe){case pn:ve.getter=Ce,ve.inputSize=4;break;case Bn:ve.getter=W,ve.inputSize=4}else throw"EXRLoader.parse: unsupported pixelType "+ve.type+" for "+R.compression+".";ve.blockCount=(R.dataWindow.yMax+1)/ve.scanlineBlockSize;for(var He=0;He<ve.blockCount;He++)re(O,he);ve.outputChannels=ve.channels==3?4:ve.channels;const Oe=ve.width*ve.height*ve.outputChannels;switch(pe){case pn:ve.byteArray=new Float32Array(Oe),ve.channels<ve.outputChannels&&ve.byteArray.fill(1,0,Oe);break;case Bn:ve.byteArray=new Uint16Array(Oe),ve.channels<ve.outputChannels&&ve.byteArray.fill(15360,0,Oe);break;default:console.error("THREE.EXRLoader: unsupported type: ",pe);break}return ve.bytesPerLine=ve.width*ve.inputSize*ve.channels,ve.outputChannels==4?ve.format=En:ve.format=bl,Va?ve.colorSpace="srgb-linear":ve.encoding=3e3,ve}const Qn=new DataView(e),_r=new Uint8Array(e),$i={value:0},ci=oo(Qn,e,$i),Ft=ao(ci,Qn,_r,$i,this.type),ms={value:0},zr={R:0,G:1,B:2,A:3,Y:0};for(let R=0;R<Ft.height/Ft.scanlineBlockSize;R++){const O=Xe(Qn,$i);Ft.size=Xe(Qn,$i),Ft.lines=O+Ft.scanlineBlockSize>Ft.height?Ft.height-O:Ft.scanlineBlockSize;const he=Ft.size<Ft.lines*Ft.bytesPerLine?Ft.uncompress(Ft):H(Ft);$i.value+=Ft.size;for(let pe=0;pe<Ft.scanlineBlockSize;pe++){const ve=pe+R*Ft.scanlineBlockSize;if(ve>=Ft.height)break;for(let He=0;He<Ft.channels;He++){const Oe=zr[ci.channels[He].name];for(let P=0;P<Ft.width;P++){ms.value=(pe*(Ft.channels*Ft.width)+He*Ft.width+P)*Ft.inputSize;const G=(Ft.height-1-ve)*(Ft.width*Ft.outputChannels)+P*Ft.outputChannels+Oe;Ft.byteArray[G]=Ft.getter(he,ms)}}}}return{header:ci,width:Ft.width,height:Ft.height,data:Ft.byteArray,format:Ft.format,[Va?"colorSpace":"encoding"]:Ft[Va?"colorSpace":"encoding"],type:this.t
3954ype}}setDataType(e){return this.type=e,this}load(e,t,n,i){function s(o,c){Va?o.colorSpace=c.colorSpace:o.encoding=c.encoding,o.minFilter=tn,o.magFilter=tn,o.generateMipmaps=!1,o.flipY=!1,t&&t(o,c)}return super.load(e,s,n,i)}}const nI=De.forwardRef(({makeDefault:r,camera:e,regress:t,domElement:n,enableDamping:i=!0,keyEvents:s=!1,onChange:o,onStart:c,onEnd:u,...h},f)=>{const d=Ei(I=>I.invalidate),m=Ei(I=>I.camera),g=Ei(I=>I.gl),y=Ei(I=>I.events),M=Ei(I=>I.setEvents),x=Ei(I=>I.set),v=Ei(I=>I.get),w=Ei(I=>I.performance),E=e||m,T=n||y.connected||g.domElement,U=De.useMemo(()=>new $R(E),[E]);return fm(()=>{U.enabled&&U.update()},-1),De.useEffect(()=>(s&&U.connect(s===!0?T:s),U.connect(T),()=>void U.dispose()),[s,T,t,U,d]),De.useEffect(()=>{const I=C=>{d(),t&&w.regress(),o&&o(C)},N=C=>{c&&c(C)},D=C=>{u&&u(C)};return U.addEventListener("change",I),U.addEventListener("start",N),U.addEventListener("end",D),()=>{U.removeEventListener("start",N),U.removeEventListener("end",D),U.removeEventListener("change",I)}},[o,c,u,U,d,M]),De.useEffect(()=>{if(r){const I=v().controls;return x({controls:U}),()=>x({controls:I})}},[r,U]),De.createElement("primitive",Sl({ref:f,object:U,enableDamping:i},h))}),iI=3e3,rI=3001,cr=1e-5;function sI(r,e,t){const n=new as,i=t-cr;return n.absarc(cr,cr,cr,-Math.PI/2,-Math.PI,!0),n.absarc(cr,e-i*2,cr,Math.PI,Math.PI/2,!0),n.absarc(r-i*2,e-i*2,cr,Math.PI/2,0,!0),n.absarc(r-i*2,cr,cr,0,-Math.PI/2,!0),n}const oI=De.forwardRef(function({args:[e=1,t=1,n=1]=[],radius:i=.05,steps:s=1,smoothness:o=4,bevelSegments:c=4,creaseAngle:u=.4,children:h,...f},d){const m=De.useMemo(()=>sI(e,t,i),[e,t,i]),g=De.useMemo(()=>({depth:n-i*2,bevelEnabled:!0,bevelSegments:c*2,steps:s,bevelSize:i-cr,bevelThickness:i,curveSegments:o}),[n,i,o]),y=De.useRef(null);return De.useLayoutEffect(()=>{y.current&&(y.current.center(),IR(y.current,u))},[m,g]),De.createElement("mesh",Sl({ref:d},f),De.createElement("extrudeGeometry",{ref:y,args:[m,g]}),h)}),Ax=(r,e,t)=>{let n;switch(r){case oi:n=new Uint8ClampedArray(e*t*4);break;case Bn:n=new Uint16Array(e*t*4);break;case pr:n=new Uint32Array(e*t*4);break;case vh:n=new Int8Array(e*t*4);break;case _h:n=new Int16Array(e*t*4);break;case Tl:n=new Int32Array(e*t*4);break;case pn:n=new Float32Array(e*t*4);break;default:throw new Error("Unsupported data type")}return n};let Tu;const aI=(r,e,t,n)=>{if(Tu!==void 0)return Tu;const i=new zi(1,1,n);e.setRenderTarget(i);const s=new mn(new ds,new Br({color:16777215}));e.render(s,t),e.setRenderTarget(null);const o=Ax(r,i.width,i.height);return e.readRenderTargetPixels(i,0,0,i.width,i.height,o),i.dispose(),s.geometry.dispose(),s.material.dispose(),Tu=o[0]!==0,Tu};class pm{constructor(e){yn(this,"_renderer");yn(this,"_rendererIsDisposable",!1);yn(this,"_material");yn(this,"_scene");yn(this,"_camera");yn(this,"_quad");yn(this,"_renderTarget");yn(this,"_width");yn(this,"_height");yn(this,"_type");yn(this,"_colorSpace");yn(this,"_supportsReadPixels",!0);yn(this,"render",()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)});var n,i,s,o,c,u,h,f,d,m,g,y,M,x,v,w;this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace
vendor: 5,187 bytes, line 3954
3954=e.colorSpace;const t={format:En,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:((n=e.renderTargetOptions)==null?void 0:n.anisotropy)!==void 0?(i=e.renderTargetOptions)==null?void 0:i.anisotropy:1,generateMipmaps:((s=e.renderTargetOptions)==null?void 0:s.generateMipmaps)!==void 0?(o=e.renderTargetOptions)==null?void 0:o.generateMipmaps:!1,magFilter:((c=e.renderTargetOptions)==null?void 0:c.magFilter)!==void 0?(u=e.renderTargetOptions)==null?void 0:u.magFilter:tn,minFilter:((h=e.renderTargetOptions)==null?void 0:h.minFilter)!==void 0?(f=e.renderTargetOptions)==null?void 0:f.minFilter:tn,samples:((d=e.renderTargetOptions)==null?void 0:d.samples)!==void 0?(m=e.renderTargetOptions)==null?void 0:m.samples:void 0,wrapS:((g=e.renderTargetOptions)==null?void 0:g.wrapS)!==void 0?(y=e.renderTargetOptions)==null?void 0:y.wrapS:Cn,wrapT:((M=e.renderTargetOptions)==null?void 0:M.wrapT)!==void 0?(x=e.renderTargetOptions)==null?void 0:x.wrapT:Cn};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=pm.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new Il,this._camera=new Fr,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!aI(this._type,this._renderer,this._camera,t)){let E;switch(this._type){case Bn:E=this._renderer.extensions.has("EXT_color_buffer_float")?pn:void 0;break}E!==void 0?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${pn}`),this._type=E):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new mn(new ds,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new zi(this.width,this.height,t),this._renderTarget.texture.mapping=((v=e.renderTargetOptions)==null?void 0:v.mapping)!==void 0?(w=e.renderTargetOptions)==null?void 0:w.mapping:ls}static instantiateRenderer(){const e=new lm;return e.setSize(128,128),e}toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=Ax(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){const t=new Ki(this.toArray(),this.width,this.height,En,this._type,(e==null?void 0:e.mapping)||ls,(e==null?void 0:e.wrapS)||Cn,(e==null?void 0:e.wrapT)||Cn,(e==null?void 0:e.magFilter)||tn,(e==null?void 0:e.minFilter)||tn,(e==null?void 0:e.anisotropy)||1,mr);return t.generateMipmaps=(e==null?void 0:e.generateMipmaps)!==void 0?e==null?void 0:e.generateMipmaps:!1,t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof gi&&Object.values(this.material.uniforms).forEach(t=>{t.value instanceof sn&&t.value.dispose()}),Object.values(this.material).forEach(t=>{t instanceof sn&&t.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}class Cx extends Error{}class Rx extends Error{}const Ga=(r,e,t)=>{const n=new RegExp(`${e}="([^"]*)"`,"i").exec(r);if(n)return n[1];const i=new RegExp(`<${e}[^>]*>([\\s\\S]*?)</${e}>`,"i").exec(r);if(i){const s=i[1].match(/<rdf:li>([^<]*)<\/rdf:li>/g);return s&&s.length===3?s.map(o=>o.replace(/<\/?rdf:li>/g,"")):i[1].trim()}if(t!==void 0)return t;throw new Error(`Can't find ${e} in gainmap metadata`)},lI=r=>{let e;typeof TextDecoder<"u"?e=new TextDecoder().decode(r):e=r.toString();let t=e.indexOf("<x:xmpmeta");for(;t!==-1;){const n=e.indexOf("x:xmpmeta>",t),i=e.slice(t,n+10);try{const s=Ga(i,"hdrgm:GainMapMin","0"),o=Ga(i,"hdrgm:GainMapMax"),c=Ga(i,"hdrgm:Gamma","1"),u=Ga(i,"hdrgm:OffsetSDR","0.015625"),h=Ga(i,"hdrgm:OffsetHDR","0.015625"),f=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(i),d=f?f[1]:"0",m=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(i);if(!m)throw new Error("Incomplete gainmap metadata");const g=m[1];return{gainMapMin:Array.isArray(s)?s.map(y=>parseFloat(y)):[parseFloat(s),parseFloat(s),parseFloat(s)],gainMapMax:Array.isArray(o)?o.map(y=>parseFloat(y)):[parseFloat(o),parseFloat(o),parseFloat(o)],gamma:Array.isArray(c)?c.map(y=>parseFloat(y)):[parseFloat(c),parseFloat(c),parseFloat(c)],offsetSdr:Array.isArray(u)?u.map(y=>parseFloat(y)):[parseFloat(u),parseFloat(u),parseFloat(u)],offsetHdr:Array.isArray(h)?h.map(y=>parseFloat(y)):[parseFloat(h),parseFloat(h),parseFloat(h)],hdrCapacityMin:parseFloat(d),hdrCapacityMax:p
vendor: 4,549 bytes, lines 3954-3959
3954arseFloat(g)}}catch{}t=e.indexOf("<x:xmpmeta",n)}};class cI{constructor(e){yn(this,"options");this.options={debug:e&&e.debug!==void 0?e.debug:!1,extractFII:e&&e.extractFII!==void 0?e.extractFII:!0,extractNonFII:e&&e.extractNonFII!==void 0?e.extractNonFII:!0}}extract(e){return new Promise((t,n)=>{const i=this.options.debug,s=new DataView(e.buffer);if(s.getUint16(0)!==65496){n(new Error("Not a valid jpeg"));return}const o=s.byteLength;let c=2,u=0,h;for(;c<o;){if(++u>250){n(new Error(`Found no marker after ${u} loops ðµ`));return}if(s.getUint8(c)!==255){n(new Error(`Not a valid marker at offset 0x${c.toString(16)}, found: 0x${s.getUint8(c).toString(16)}`));return}if(h=s.getUint8(c+1),i&&console.log(`Marker: ${h.toString(16)}`),h===226){i&&console.log("Found APP2 marker (0xffe2)");const f=c+4;if(s.getUint32(f)===1297106432){const d=f+4;let m;if(s.getUint16(d)===18761)m=!1;else if(s.getUint16(d)===19789)m=!0;else{n(new Error("No valid endianness marker found in TIFF header"));return}if(s.getUint16(d+2,!m)!==42){n(new Error("Not valid TIFF data! (no 0x002A marker)"));return}const g=s.getUint32(d+4,!m);if(g<8){n(new Error("Not valid TIFF data! (First offset less than 8)"));return}const y=d+g,M=s.getUint16(y,!m),x=y+2;let v=0;for(let U=x;U<x+12*M;U+=12)s.getUint16(U,!m)===45057&&(v=s.getUint32(U+8,!m));const E=y+2+M*12+4,T=[];for(let U=E;U<E+v*16;U+=16){const I={MPType:s.getUint32(U,!m),size:s.getUint32(U+4,!m),dataOffset:s.getUint32(U+8,!m),dependantImages:s.getUint32(U+12,!m),start:-1,end:-1,isFII:!1};I.dataOffset?(I.start=d+I.dataOffset,I.isFII=!1):(I.start=0,I.isFII=!0),I.end=I.start+I.size,T.push(I)}if(this.options.extractNonFII&&T.length){const U=new Blob([s]),I=[];for(const N of T){if(N.isFII&&!this.options.extractFII)continue;const D=U.slice(N.start,N.end+1,"image/jpeg");I.push(D)}t(I)}}}c+=2+s.getUint16(c+2)}})}}const uI=async r=>{const e=lI(r);if(!e)throw new Rx("Gain map XMP metadata not found");const n=await new cI({extractFII:!0,extractNonFII:!0}).extract(r);if(n.length!==2)throw new Cx("Gain map recovery image not found");return{sdr:new Uint8Array(await n[0].arrayBuffer()),gainMap:new Uint8Array(await n[1].arrayBuffer()),metadata:e}},J0=r=>new Promise((e,t)=>{const n=document.createElement("img");n.onload=()=>{e(n)},n.onerror=i=>{t(i)},n.src=URL.createObjectURL(r)});class hI extends li{constructor(t,n){super(n);yn(this,"_renderer");yn(this,"_renderTargetOptions");yn(this,"_internalLoadingManager");yn(this,"_config");this._config=t,t.renderer&&(this._renderer=t.renderer),this._internalLoadingManager=new Wh}setRenderer(t){return this._renderer=t,this}setRenderTargetOptions(t){return this._renderTargetOptions=t,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: A Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");const t=this._config.createMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new sn,sdr:new sn});return this._config.createQuadRenderer({width:16,height:16,type:Bn,colorSpace:mr,material:t,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async processImages(t,n,i){const s=n?new Blob([n],{type:"image/jpeg"}):void 0,o=new Blob([t],{type:"image/jpeg"});let c,u,h=!1;if(typeof createImageBitmap>"u"){const f=await Promise.all([s?J0(s):Promise.resolve(void 0),J0(o)]);u=f[0],c=f[1],h=i==="flipY"}else{const f=await Promise.all([s?createImageBitmap(s,{imageOrientation:i||"flipY"}):Promise.resolve(void 0),createImageBitmap(o,{imageOrientation:i||"flipY"})]);u=f[0],c=f[1]}return{sdrImage:c,gainMapImage:u,needsFlip:h}}createTextures(t,n,i){const s=new sn(n||new ImageData(2,2),ls,Cn,Cn,tn,sp,En,oi,1,mr);s.flipY=i,s.needsUpdate=!0;const o=new sn(t,ls,Cn,Cn,tn,sp,En,oi,1,ii);return o.flipY=i,o.needsUpdate=!0,{gainMap:s,sdr:o}}updateQuadRenderer(t,n,i,s,o){t.width=n.width,t.height=n.height,t.material.gainMap=i,t.material.sdr=s,t.material.gainMapMin=o.gainMapMin,t.material.gainMapMax=o.gainMapMax,t.material.offsetHdr=o.offsetHdr,t.material.offsetSdr=o.offsetSdr,t.material.gamma=o.gamma,t.material.hdrCapacityMin=o.hdrCapacityMin,t.material.hdrCapacityMax=o.hdrCapacityMax,t.material.maxDisplayBoost=Math.pow(2,o.hdrCapacityMax),t.material.needsUpdate=!0}}const fI=` 3955varying vec2 vUv; 3956 3957void main() { 3958 vUv = uv; 3959 gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0
3959); 3960} 3961`,dI=` 3962// min half float value 3963#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 ) 3964// max half float value 3965#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 ) 3966 3967uniform sampler2D sdr; 3968uniform sampler2D gainMap; 3969uniform vec3 gamma; 3970uniform vec3 offsetHdr; 3971uniform vec3 offsetSdr; 3972uniform vec3 gainMapMin; 3973uniform vec3 gainMapMax; 3974uniform float weightFactor; 3975 3976varying vec2 vUv; 3977 3978void main() { 3979 vec3 rgb = texture2D( sdr, vUv ).rgb; 3980 vec3 recovery = texture2D( gainMap, vUv ).rgb; 3981 vec3 logRecovery = pow( recovery, gamma ); 3982 vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery; 3983 vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr; 3984 vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor )); 3985 gl_FragColor = vec4( clampedHdrColor , 1.0 ); 3986} 3987`;class pI extends gi{constructor({gamma:t,offsetHdr:n,offsetSdr:i,gainMapMin:s,gainMapMax:o,maxDisplayBoost:c,hdrCapacityMin:u,hdrCapacityMax:h,sdr:f,gainMap:d}){super({name:"GainMapDecoderMaterial",vertexShader:fI,fragmentShader:dI,uniforms:{sdr:{value:f},gainMap:{value:d},gamma:{value:new B(1/t[0],1/t[1],1/t[2])},offsetHdr:{value:new B().fromArray(n)},offsetSdr:{value:new B().fromArray(i)},gainMapMin:{value:new B().fromArray(s)},gainMapMax:{value:new B().fromArray(o)},weightFactor:{value:(Math.log2(c)-u)/(h-u)}},blending:hr,depthTest:!1,depthWrite:!1});yn(this,"_maxDisplayBoost");yn(this,"_hdrCapacityMin");yn(this,"_hdrCapacityMax");this._maxDisplayBoost=c,this._hdrCapacityMin=u,this._hdrCapacityMax=h,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(t){this.uniforms.sdr.value=t}get gainMap(){return this.uniforms.gainMap.value}set gainMap(t){this.uniforms.gainMap.value=t}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(t){this.uniforms.offsetHdr.value.fromArray(t)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(t){this.uniforms.offsetSdr.value.fromArray(t)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(t){this.uniforms.gainMapMin.value.fromArray(t)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(t){this.uniforms.gainMapMax.value.fromArray(t)}get gamma(){const t=this.uniforms.gamma.value;return[1/t.x,1/t.y,1/t.z]}set gamma(t){const n=this.uniforms.gamma.value;n.x=1/t[0],n.y=1/t[1],n.z=1/t[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(t){this._hdrCapacityMin=t,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(t){this._hdrCapacityMax=t,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(t){this._maxDisplayBoost=Math.max(1,Math.min(65504,t)),this.calculateWeight()}calculateWeight(){const t=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,t))}}class Ix extends hI{constructor(e,t){super({renderer:e,createMaterial:n=>new pI(n),createQuadRenderer:n=>new pm(n)},t)}async render(e,t,n,i){const{sdrImage:s,gainMapImage:o,needsFlip:c}=await this.processImages(n,i,"flipY"),{gainMap:u,sdr:h}=this.createTextures(s,o,c);this.updateQuadRenderer(e,s,u,h,t),e.render()}}class mI extends Ix{load([e,t,n],i,s,o){const c=this.prepareQuadRenderer();let u,h,f;const d=async()=>{if(u&&h&&f){try{await this.render(c,f,u,h)}catch(C){this.manager.itemError(e),this.manager.itemError(t),this.manager.itemError(n),typeof o=="function"&&o(C),c.disposeOnDemandRenderer();return}typeof i=="function"&&i(c),this.manager.itemEnd(e),this.manager.itemEnd(t),this.manager.itemEnd(n),c.disposeOnDemandRenderer()}};let m=!0,g=0,y=0,M=!0,x=0,v=0,w=!0,E=0,T=0;const U=()=>{if(typeof s=="function"){const C=g+x+E,A=y+v+T,F=m&&M&&w;s(new ProgressEvent("progress",{lengthComputable:F,loaded:A,total:C}))}};this.manager.itemStart(e),this.manager.itemStart(t),this.manager.itemStart(n);const I=new bi(this._internalLoadingManager);I.setResponseType("arraybuffer"),I.setRequestHeader(this.requestHeader),I.setPath(this.path),I.setWithCredentials(this.withCredentials),I.load(e,async C=>
3987{if(typeof C=="string")throw new Error("Invalid sdr buffer");u=C,await d()},C=>{m=C.lengthComputable,y=C.loaded,g=C.total,U()},C=>{this.manager.itemError(e),typeof o=="function"&&o(C)});const N=new bi(this._internalLoadingManager);N.setResponseType("arraybuffer"),N.setRequestHeader(this.requestHeader),N.setPath(this.path),N.setWithCredentials(this.withCredentials),N.load(t,async C=>{if(typeof C=="string")throw new Error("Invalid gainmap buffer");h=C,await d()},C=>{M=C.lengthComputable,v=C.loaded,x=C.total,U()},C=>{this.manager.itemError(t),typeof o=="function"&&o(C)});const D=new bi(this._internalLoadingManager);return D.setRequestHeader(this.requestHeader),D.setPath(this.path),D.setWithCredentials(this.withCredentials),D.load(n,async C=>{if(typeof C!="string")throw new Error("Invalid metadata string");f=JSON.parse(C),await d()},C=>{w=C.lengthComputable,T=C.loaded,E=C.total,U()},C=>{this.manager.itemError(n),typeof o=="function"&&o(C)}),c}}class gI extends Ix{load(e,t,n,i){const s=this.prepareQuadRenderer(),o=new bi(this._internalLoadingManager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(this.withCredentials),this.manager.itemStart(e),o.load(e,async c=>{if(typeof c=="string")throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const u=new Uint8Array(c);let h,f,d;try{const m=await uI(u);h=m.sdr,f=m.gainMap,d=m.metadata}catch(m){if(m instanceof Rx||m instanceof Cx)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),d={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},h=u;else throw m}try{await this.render(s,d,h.buffer,f==null?void 0:f.buffer)}catch(m){this.manager.itemError(e),typeof i=="function"&&i(m),s.disposeOnDemandRenderer();return}typeof t=="function"&&t(s),this.manager.itemEnd(e),s.disposeOnDemandRenderer()},n,c=>{this.manager.itemError(e),typeof i=="function"&&i(c)}),s}}const Ml={apartment:"lebombo_1k.hdr",city:"potsdamer_platz_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",forest:"forest_slope_1k.hdr",lobby:"st_fagans_interior_1k.hdr",night:"dikhololo_night_1k.hdr",park:"rooitou_park_1k.hdr",studio:"studio_small_03_1k.hdr",sunset:"venice_sunset_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr"},Px="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",jo=r=>Array.isArray(r),mm=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"];function qh({files:r=mm,path:e="",preset:t=void 0,encoding:n=void 0,extensions:i}={}){let s=null,o=!1;t&&(gm(t),r=Ml[t],e=Px),o=jo(r);const{extension:c,isCubemap:u}=vm(r);if(s=_m(c),!s)throw new Error("useEnvironment: Unrecognized file extension: "+r);const h=Ei(g=>g.gl);De.useLayoutEffect(()=>{if(c!=="webp"&&c!=="jpg"&&c!=="jpeg")return;function g(){sa.clear(s,o?[r]:r)}h.domElement.addEventListener("webglcontextlost",g,{once:!0})},[r,h.domElement]);const f=sa(s,o?[r]:r,g=>{(c==="webp"||c==="jpg"||c==="jpeg")&&g.setRenderer(h),g.setPath==null||g.setPath(e),i&&i(g)});let d=o?f[0]:f;if(c==="jpg"||c==="jpeg"||c==="webp"){var m;d=(m=d.renderTarget)==null?void 0:m.texture}return d.mapping=u?dr:Jo,"colorSpace"in d?d.colorSpace=n??u?"srgb":"srgb-linear":d.encoding=n??u?rI:iI,d}const vI={files:mm,path:"",preset:void 0,extensions:void 0};qh.preload=r=>{const e={...vI,...r};let{files:t,path:n=""}=e;
3987const{preset:i,extensions:s}=e;i&&(gm(i),t=Ml[i],n=Px);const{extension:o}=vm(t);if(o==="webp"||o==="jpg"||o==="jpeg")throw new Error("useEnvironment: Preloading gainmaps is not supported");const c=_m(o);if(!c)throw new Error("useEnvironment: Unrecognized file extension: "+t);sa.preload(c,jo(t)?[t]:t,u=>{u.setPath==null||u.setPath(n),s&&s(u)})};const _I={files:mm,preset:void 0};qh.clear=r=>{const e={..._I,...r};let{files:t}=e;const{preset:n}=e;n&&(gm(n),t=Ml[n]);const{extension:i}=vm(t),s=_m(i);if(!s)throw new Error("useEnvironment: Unrecognized file extension: "+t);sa.clear(s,jo(t)?[t]:t)};function gm(r){if(!(r in Ml))throw new Error("Preset must be one of: "+Object.keys(Ml).join(", "))}function vm(r){var e;const t=jo(r)&&r.length===6,n=jo(r)&&r.length===3&&r.some(o=>o.endsWith("json")),i=jo(r)?r[0]:r;return{extension:t?"cube":n?"webp":i.startsWith("data:application/exr")?"exr":i.startsWith("data:application/hdr")?"hdr":i.startsWith("data:image/jpeg")?"jpg":(e=i.split(".").pop())==null||(e=e.split("?"))==null||(e=e.shift())==null?void 0:e.toLowerCase(),isCubemap:t,isGainmap:n}}function _m(r){return r==="cube"?Cy:r==="hdr"?eI:r==="exr"?tI:r==="jpg"||r==="jpeg"?gI:r==="webp"?mI:null}const yI=r=>r.current&&r.current.isScene,xI=r=>yI(r)?r.current:r;function ym(r,e,t,n,i={}){var s,o,c,u;i={backgroundBlurriness:0,backgroundIntensity:1,backgroundRotation:[0,0,0],environmentIntensity:1,environmentRotation:[0,0,0],...i};const h=xI(e||t),f=h.background,d=h.environment,m={backgroundBlurriness:h.backgroundBlurriness,backgroundIntensity:h.backgroundIntensity,backgroundRotation:(s=(o=h.backgroundRotation)==null||o.clone==null?void 0:o.clone())!==null&&s!==void 0?s:[0,0,0],environmentIntensity:h.environmentIntensity,environmentRotation:(c=(u=h.environmentRotation)==null||u.clone==null?void 0:u.clone())!==null&&c!==void 0?c:[0,0,0]};return r!=="only"&&(h.environment=n),r&&(h.background=n),is(h,i),()=>{r!=="only"&&(h.environment=d),r&&(h.background=f),is(h,m)}}function xm({scene:r,background:e=!1,map:t,...n}){const i=Ei(s=>s.scene);return De.useLayoutEffect(()=>{if(t)return ym(e,r,i,t,n)}),null}function Lx({background:r=!1,scene:e,blur:t,backgroundBlurriness:n,backgroundIntensity:i,backgroundRotation:s,environmentIntensity:o,environmentRotation:c,...u}){const h=qh(u),f=Ei(d=>d.scene);return De.useLayoutEffect(()=>ym(r,e,f,h,{backgroundBlurriness:t??n,backgroundIntensity:i,backgroundRotation:s,environmentIntensity:o,environmentRotation:c})),De.useEffect(()=>()=>{h.dispose()},[h]),null}function SI({children:r,near:e=.1,far:t=1e3,resolution:n=256,frames:i=1,map:s,background:o=!1,blur:c,backgroundBlurriness:u,backgroundIntensity:h,backgroundRotation:f,environmentIntensity:d,environmentRotation:m,scene:g,files:y,path:M,preset:x=void 0,extensions:v}){const w=Ei(D=>D.gl),E=Ei(D=>D.scene),T=De.useRef(null),[U]=De.useState(()=>new Il),I=De.useMemo(()=>{const D=new Np(n);return D.texture.type=Bn,D},[n]);De.useEffect(()=>()=>{I.dispose()},[I]),De.useLayoutEffect(()=>{if(i===1){const D=w.autoClear;w.autoClear=!0,T.current.update(w,U),w.autoClear=D}return ym(o,g,E,I.texture,{backgroundBlurriness:c??u,backgroundIntensity:h,backgroundRotation:f,environmentIntensity:d,environmentRotation:m})},[r,U,I.texture,g,E,o,i,w]);let N=1;return fm(()=>{if(i===1/0||N<i){const D=w.autoClear;w.autoClear=!0,T.current.update(w,U),w.autoClear=D,N++}}),De.createElement(De.Fragment,null,hR(De.createElement(De.Fragment,null,r,De.createElement("cubeCamera",{ref:T,args:[e,t,I]}),y||x?De.createElement(Lx,{background:!0,files:y,preset:x,path:M,extensions:v}):s?De.createElement(xm,{background:!0,map:s,extensions:v}):null),U))}function MI(r){var e,t,n,i;const s=qh(r),o=r.map||s;De.useMemo(()=>ix({GroundProjectedEnvImpl:XR}),[]),De.useEffect(()=>()=>{s.dispose()},[s]);const c=De.useMemo(()=>[o],[o]),u=(e=r.ground)==null?void 0:e.height,h=(t=r.ground)==null?void 0:t.radius,f=(n=(i=r.ground)==null?void 0:i.scale)!==null&&n!==void 0?n:1e3;return De.createElement(De.Fragment,null,De.createElement(xm,Sl({},r,{map:o})),De.createElement("groundProjectedEnvImpl",{args:c,scale:f,height:u,radius:h}))}function wI(r){return r.ground?De.createElement(MI,r):r.map?De.createElement(xm,r):r.children?De.createElement(SI,r):De.createElement(Lx,r)}const EI=()=>{const r=De.useRef(null),e=De.useRef(null);return fm(t=>{if(r.current&&(r.current.rotation.y=Math.sin(t.clock.elapsedTime*.3)*.15),e.current){const n=e.current.material;n.emissiveIntensity=.5+Math.sin(t.clock.elapsedTime*2)*.1}}),Ct.jsxs("group",{ref:r,position:[0,0,0],children:[Ct.jsx(oI,{args:[4.2,2.6,.15],radius:.08,smoothness:4,position:[0,.3,0],children:Ct.jsx("meshStandardMaterial",{color:"#1d1d1f",metalness:.9,roughness:.1})}),Ct.jsxs("mesh",{ref:e,position:[0,.3,.08],children:[Ct.jsx("planeGeometry",{args:[3.9,2.3]}),Ct.jsx("meshStandardMaterial",{color:"#0071e3",emissive:"#0071e3",emissiveIntensity:.5,metalness:.1,roughness:.2})]}),Ct.jsxs("mesh",{position:[0,.5,.09],children:[Ct.jsx("planeGeometry",{args:[2.5,.4]}),Ct.jsx("meshStandardMaterial",{color:"#ffffff",emissive:"#ffffff",emissiveIntensity:.3})]}),Ct.jsxs("mesh",{position:[0,0,.09],children:[Ct.jsx("planeGeometry",{args:[1.8,.25]}),Ct.jsx("meshStandardMaterial",{color:"#ffffff",emissive:"#ffffff",emissiveIntensity:.2,opacity:.7,transparent:!0})]}),Ct.jsxs("mesh",{position:[0,-1.2,0],children:[Ct.jsx("cylinderGeometry",{args:[.08,.08,1.8,32]}),Ct.jsx("meshStandardMaterial",{color:"#1d1d1f",metalness:.9,roughness:.1})]}),Ct.jsxs("mesh",{position:[0,-2.1,0],rotation:[-Math.PI/2,0,0],children:[Ct.jsx("cylinderGeometry",{args:[.8,.8,.05,64]}),Ct.jsx("meshStandardMaterial",{color:"#1d1d1f",metalness:.9,roughness:.1})]})]})},TI=()=>Ct.jsxs(Ct.Fragment,{children:[Ct.jsx("ambientLight",{intensity:.6}),Ct.jsx("directionalLight",{position:[5,5,5],intensity:1}),Ct.jsx("directionalLight",{position:[-5,3,-5],intensity:.4}),Ct.jsx("spotLight",{position:[0,10,0],intensity:.5,angle:.5,penumbra:1}),Ct.jsx(EI,{}
3987),Ct.jsx(wI,{preset:"studio"})]}),PI=()=>Ct.jsx("div",{className:"w-full h-full rounded-3xl overflow-hidden bg-gradient-to-b from-white to-[#f5f5f7]",children:Ct.jsx(De.Suspense,{fallback:Ct.jsx("div",{className:"w-full h-full flex items-center justify-center",children:Ct.jsx("div",{className:"w-12 h-12 border-3 border-gray-200 border-t-[#0071e3] rounded-full animate-spin"})}),children:Ct.jsxs(RR,{camera:{position:[0,0,6],fov:45},dpr:[1,2],gl:{antialias:!0,alpha:!0},children:[Ct.jsx(TI,{}),Ct.jsx(nI,{enablePan:!1,enableZoom:!1,autoRotate:!0,autoRotateSpeed:.5,minPolarAngle:Math.PI/3,maxPolarAngle:Math.PI/2})]})})});export{PI as default};
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.