(()=>{var $F=Object.create;var{getPrototypeOf:ZF,defineProperty:WZ,getOwnPropertyNames:tU,getOwnPropertyDescriptor:WF}=Object,eU=Object.prototype.hasOwnProperty;var KF=(J,Q,$)=>{$=J!=null?$F(ZF(J)):{};let Z=Q||!J||!J.__esModule?WZ($,"default",{value:J,enumerable:!0}):$;for(let W of tU(J))if(!eU.call(Z,W))WZ(Z,W,{get:()=>J[W],enumerable:!0});return Z},rU=new WeakMap,HF=(J)=>{var Q=rU.get(J),$;if(Q)return Q;if(Q=WZ({},"__esModule",{value:!0}),J&&typeof J==="object"||typeof J==="function")tU(J).map((Z)=>!eU.call(Q,Z)&&WZ(Q,Z,{get:()=>J[Z],enumerable:!($=WF(J,Z))||$.enumerable}));return rU.set(J,Q),Q},KZ=(J,Q)=>()=>(Q||J((Q={exports:{}}).exports,Q),Q.exports);var x7=(J,Q)=>{for(var $ in Q)WZ(J,$,{get:Q[$],enumerable:!0,configurable:!0,set:(Z)=>Q[$]=()=>Z})};var qR=KZ((J2,GR)=>{var KR=!1,aQ,PU,AU,bK,yK,HR,hK,wU,SU,TU,XR,jU,_U,YR,UR;function W8(){if(KR)return;KR=!0;var J=navigator.userAgent,Q=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(J),$=/(Mac OS X)|(Windows)|(Linux)/.exec(J);if(jU=/\b(iPhone|iP[ao]d)/.exec(J),_U=/\b(iP[ao]d)/.exec(J),TU=/Android/i.exec(J),YR=/FBAN\/\w+;/i.exec(J),UR=/Mobile/i.exec(J),XR=!!/Win64/.exec(J),Q){if(aQ=Q[1]?parseFloat(Q[1]):Q[5]?parseFloat(Q[5]):NaN,aQ&&document&&document.documentMode)aQ=document.documentMode;var Z=/(?:Trident\/(\d+.\d+))/.exec(J);if(HR=Z?parseFloat(Z[1])+4:aQ,PU=Q[2]?parseFloat(Q[2]):NaN,AU=Q[3]?parseFloat(Q[3]):NaN,bK=Q[4]?parseFloat(Q[4]):NaN,bK)Q=/(?:Chrome\/(\d+\.\d+))/.exec(J),yK=Q&&Q[1]?parseFloat(Q[1]):NaN;else yK=NaN}else aQ=PU=AU=yK=bK=NaN;if($){if($[1]){var W=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(J);hK=W?parseFloat(W[1].replace("_",".")):!0}else hK=!1;wU=!!$[2],SU=!!$[3]}else hK=wU=SU=!1}var xU={ie:function(){return W8()||aQ},ieCompatibilityMode:function(){return W8()||HR>aQ},ie64:function(){return xU.ie()&&XR},firefox:function(){return W8()||PU},opera:function(){return W8()||AU},webkit:function(){return W8()||bK},safari:function(){return xU.webkit()},chrome:function(){return W8()||yK},windows:function(){return W8()||wU},osx:function(){return W8()||hK},linux:function(){return W8()||SU},iphone:function(){return W8()||jU},mobile:function(){return W8()||(jU||_U||TU||UR)},nativeApp:function(){return W8()||YR},android:function(){return W8()||TU},ipad:function(){return W8()||_U}};GR.exports=xU});var RR=KZ((Q2,NR)=>{var fK=!!(typeof window!=="undefined"&&window.document&&window.document.createElement),VV={canUseDOM:fK,canUseWorkers:typeof Worker!=="undefined",canUseEventListeners:fK&&!!(window.addEventListener||window.attachEvent),canUseViewport:fK&&!!window.screen,isInWorker:!fK};NR.exports=VV});var MR=KZ(($2,OR)=>{var FR=RR(),ER;if(FR.canUseDOM)ER=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0;function kV(J,Q){if(!FR.canUseDOM||Q&&!("addEventListener"in document))return!1;var $="on"+J,Z=$ in document;if(!Z){var W=document.createElement("div");W.setAttribute($,"return;"),Z=typeof W[$]==="function"}if(!Z&&ER&&J==="wheel")Z=document.implementation.hasFeature("Events.wheel","3.0");return Z}OR.exports=kV});var kR=KZ((Z2,VR)=>{var CV=qR(),IV=MR(),LR=10,BR=40,DR=800;function zR(J){var Q=0,$=0,Z=0,W=0;if("detail"in J)$=J.detail;if("wheelDelta"in J)$=-J.wheelDelta/120;if("wheelDeltaY"in J)$=-J.wheelDeltaY/120;if("wheelDeltaX"in J)Q=-J.wheelDeltaX/120;if("axis"in J&&J.axis===J.HORIZONTAL_AXIS)Q=$,$=0;if(Z=Q*LR,W=$*LR,"deltaY"in J)W=J.deltaY;if("deltaX"in J)Z=J.deltaX;if((Z||W)&&J.deltaMode)if(J.deltaMode==1)Z*=BR,W*=BR;else Z*=DR,W*=DR;if(Z&&!Q)Q=Z<1?-1:1;if(W&&!$)$=W<1?-1:1;return{spinX:Q,spinY:$,pixelX:Z,pixelY:W}}zR.getEventType=function(){return CV.firefox()?"DOMMouseScroll":IV("wheel")?"wheel":"mousewheel"};VR.exports=zR});var IR=KZ((W2,CR)=>{CR.exports=kR()});var lV={};x7(lV,{App:()=>uV});var y1="182",p7={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},m7={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},h1=0,OH=1,f1=2;var OZ=1,v1=2,L$=3,d7=0,U8=1,oJ=2,p8=0,MZ=1,MH=2,LH=3,BH=4,g1=5,B$=100,p1=101,m1=102,d1=103,u1=104,l1=200,c1=201,s1=202,n1=203,o1=204,i1=205,a1=206,r1=207,t1=208,e1=209,JG=210,QG=211,$G=212,ZG=213,WG=214,t6=0,e6=1,JW=2,LZ=3,QW=4,$W=5,ZW=6,WW=7,KG=0,HG=1,XG=2,m8=0,DH=1,zH=2,VH=3,kH=4,CH=5,IH=6,PH=7;var D$=301,MQ=302,KW=303,HW=304,BZ=306,z$=1000,V$=1001,XW=1002,d8=1003,YW=1004;var LQ=1005;var OJ=1006,k$=1007;var M7=1008;var u8=1009,YG=1010,UG=1011,DZ=1012,AH=1013,u7=1014,L7=1015,l8=1016,wH=1017,SH=1018,C$=1020,GG=35902,qG=35899,NG=1021,RG=1022,i8=1023,BQ=1026,DQ=1027,FG=1028,TH=1029,I$=1030,jH=1031;var _H=1033,UW=33776,GW=33777,qW=33778,NW=33779,xH=35840,bH=35841,yH=35842,hH=35843,fH=36196,vH=37492,gH=37496,pH=37488,mH=37489,dH=37490,uH=37491,lH=37808,cH=37809,sH=37810,nH=37811,oH=37812,iH=37813,aH=37814,rH=37815,tH=37816,eH=37817,JX=37818,QX=37819,$X=37820,ZX=37821,WX=36492,KX=36494,HX=36495,XX=36283,YX=36284,UX=36285,GX=36286;var qX=2300,RW=2301;var NX=0,zZ=1,P$=2;var EG=0,OG=1,zQ="",l7="srgb",hJ="srgb-linear",RX="linear",A9="srgb";var MG=512,LG=513,BG=514,FW=515,DG=516,zG=517,EW=518,VG=519;var FX="300 es",EX=2000;function OX(J){for(let Q=J.length-1;Q>=0;--Q)if(J[Q]>=65535)return!0;return!1}function XF(J){return ArrayBuffer.isView(J)&&!(J instanceof DataView)}function E$(J){return document.createElementNS("http://www.w3.org/1999/xhtml",J)}function kG(){let J=E$("canvas");return J.style.display="block",J}var J1={},O$=null;function EZ(...J){let Q="THREE."+J.shift();if(O$)O$("log",Q,...J);else console.log(Q,...J)}function j0(...J){let Q="THREE."+J.shift();if(O$)O$("warn",Q,...J);else console.warn(Q,...J)}function d0(...J){let Q="THREE."+J.shift();if(O$)O$("error",Q,...J);else console.error(Q,...J)}function M$(...J){let Q=J.join(" ");if(Q in J1)return;J1[Q]=!0,j0(...J)}function CG(J,Q,$){return new Promise(function(Z,W){function K(){switch(J.clientWaitSync(Q,J.SYNC_FLUSH_COMMANDS_BIT,0)){case J.WAIT_FAILED:W();break;case J.TIMEOUT_EXPIRED:setTimeout(K,$);break;default:Z()}}setTimeout(K,$)})}class B7{addEventListener(J,Q){if(this._listeners===void 0)this._listeners={};let $=this._listeners;if($[J]===void 0)$[J]=[];if($[J].indexOf(Q)===-1)$[J].push(Q)}hasEventListener(J,Q){let $=this._listeners;if($===void 0)return!1;return $[J]!==void 0&&$[J].indexOf(Q)!==-1}removeEventListener(J,Q){let $=this._listeners;if($===void 0)return;let Z=$[J];if(Z!==void 0){let W=Z.indexOf(Q);if(W!==-1)Z.splice(W,1)}}dispatchEvent(J){let Q=this._listeners;if(Q===void 0)return;let $=Q[J.type];if($!==void 0){J.target=this;let Z=$.slice(0);for(let W=0,K=Z.length;W>8&255]+CJ[J>>16&255]+CJ[J>>24&255]+"-"+CJ[Q&255]+CJ[Q>>8&255]+"-"+CJ[Q>>16&15|64]+CJ[Q>>24&255]+"-"+CJ[$&63|128]+CJ[$>>8&255]+"-"+CJ[$>>16&255]+CJ[$>>24&255]+CJ[Z&255]+CJ[Z>>8&255]+CJ[Z>>16&255]+CJ[Z>>24&255]).toLowerCase()}function Q9(J,Q,$){return Math.max(Q,Math.min($,J))}function MX(J,Q){return(J%Q+Q)%Q}function YF(J,Q,$,Z,W){return Z+(J-Q)*(W-Z)/($-Q)}function UF(J,Q,$){if(J!==Q)return($-J)/(Q-J);else return 0}function FZ(J,Q,$){return(1-$)*J+$*Q}function GF(J,Q,$,Z){return FZ(J,Q,1-Math.exp(-$*Z))}function qF(J,Q=1){return Q-Math.abs(MX(J,Q*2)-Q)}function NF(J,Q,$){if(J<=Q)return 0;if(J>=$)return 1;return J=(J-Q)/($-Q),J*J*(3-2*J)}function RF(J,Q,$){if(J<=Q)return 0;if(J>=$)return 1;return J=(J-Q)/($-Q),J*J*J*(J*(J*6-15)+10)}function FF(J,Q){return J+Math.floor(Math.random()*(Q-J+1))}function EF(J,Q){return J+Math.random()*(Q-J)}function OF(J){return J*(0.5-Math.random())}function MF(J){if(J!==void 0)Q1=J;let Q=Q1+=1831565813;return Q=Math.imul(Q^Q>>>15,Q|1),Q^=Q+Math.imul(Q^Q>>>7,Q|61),((Q^Q>>>14)>>>0)/4294967296}function LF(J){return J*RZ}function BF(J){return J*EQ}function DF(J){return(J&J-1)===0&&J!==0}function zF(J){return Math.pow(2,Math.ceil(Math.log(J)/Math.LN2))}function VF(J){return Math.pow(2,Math.floor(Math.log(J)/Math.LN2))}function kF(J,Q,$,Z,W){let{cos:K,sin:H}=Math,X=K($/2),Y=H($/2),U=K((Q+Z)/2),G=H((Q+Z)/2),q=K((Q-Z)/2),N=H((Q-Z)/2),R=K((Z-Q)/2),M=H((Z-Q)/2);switch(W){case"XYX":J.set(X*G,Y*q,Y*N,X*U);break;case"YZY":J.set(Y*N,X*G,Y*q,X*U);break;case"ZXZ":J.set(Y*q,Y*N,X*G,X*U);break;case"XZX":J.set(X*G,Y*M,Y*R,X*U);break;case"YXY":J.set(Y*R,X*G,Y*M,X*U);break;case"ZYZ":J.set(Y*M,Y*R,X*G,X*U);break;default:j0("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+W)}}function f8(J,Q){switch(Q.constructor){case Float32Array:return J;case Uint32Array:return J/4294967295;case Uint16Array:return J/65535;case Uint8Array:return J/255;case Int32Array:return Math.max(J/2147483647,-1);case Int16Array:return Math.max(J/32767,-1);case Int8Array:return Math.max(J/127,-1);default:throw new Error("Invalid component type.")}}function V9(J,Q){switch(Q.constructor){case Float32Array:return J;case Uint32Array:return Math.round(J*4294967295);case Uint16Array:return Math.round(J*65535);case Uint8Array:return Math.round(J*255);case Int32Array:return Math.round(J*2147483647);case Int16Array:return Math.round(J*32767);case Int8Array:return Math.round(J*127);default:throw new Error("Invalid component type.")}}var VZ={DEG2RAD:RZ,RAD2DEG:EQ,generateUUID:v8,clamp:Q9,euclideanModulo:MX,mapLinear:YF,inverseLerp:UF,lerp:FZ,damp:GF,pingpong:qF,smoothstep:NF,smootherstep:RF,randInt:FF,randFloat:EF,randFloatSpread:OF,seededRandom:MF,degToRad:LF,radToDeg:BF,isPowerOfTwo:DF,ceilPowerOfTwo:zF,floorPowerOfTwo:VF,setQuaternionFromProperEuler:kF,normalize:V9,denormalize:f8};class g0{constructor(J=0,Q=0){g0.prototype.isVector2=!0,this.x=J,this.y=Q}get width(){return this.x}set width(J){this.x=J}get height(){return this.y}set height(J){this.y=J}set(J,Q){return this.x=J,this.y=Q,this}setScalar(J){return this.x=J,this.y=J,this}setX(J){return this.x=J,this}setY(J){return this.y=J,this}setComponent(J,Q){switch(J){case 0:this.x=Q;break;case 1:this.y=Q;break;default:throw new Error("index is out of range: "+J)}return this}getComponent(J){switch(J){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+J)}}clone(){return new this.constructor(this.x,this.y)}copy(J){return this.x=J.x,this.y=J.y,this}add(J){return this.x+=J.x,this.y+=J.y,this}addScalar(J){return this.x+=J,this.y+=J,this}addVectors(J,Q){return this.x=J.x+Q.x,this.y=J.y+Q.y,this}addScaledVector(J,Q){return this.x+=J.x*Q,this.y+=J.y*Q,this}sub(J){return this.x-=J.x,this.y-=J.y,this}subScalar(J){return this.x-=J,this.y-=J,this}subVectors(J,Q){return this.x=J.x-Q.x,this.y=J.y-Q.y,this}multiply(J){return this.x*=J.x,this.y*=J.y,this}multiplyScalar(J){return this.x*=J,this.y*=J,this}divide(J){return this.x/=J.x,this.y/=J.y,this}divideScalar(J){return this.multiplyScalar(1/J)}applyMatrix3(J){let Q=this.x,$=this.y,Z=J.elements;return this.x=Z[0]*Q+Z[3]*$+Z[6],this.y=Z[1]*Q+Z[4]*$+Z[7],this}min(J){return this.x=Math.min(this.x,J.x),this.y=Math.min(this.y,J.y),this}max(J){return this.x=Math.max(this.x,J.x),this.y=Math.max(this.y,J.y),this}clamp(J,Q){return this.x=Q9(this.x,J.x,Q.x),this.y=Q9(this.y,J.y,Q.y),this}clampScalar(J,Q){return this.x=Q9(this.x,J,Q),this.y=Q9(this.y,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(Q9($,J,Q))}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(J){return this.x*J.x+this.y*J.y}cross(J){return this.x*J.y-this.y*J.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(J){let Q=Math.sqrt(this.lengthSq()*J.lengthSq());if(Q===0)return Math.PI/2;let $=this.dot(J)/Q;return Math.acos(Q9($,-1,1))}distanceTo(J){return Math.sqrt(this.distanceToSquared(J))}distanceToSquared(J){let Q=this.x-J.x,$=this.y-J.y;return Q*Q+$*$}manhattanDistanceTo(J){return Math.abs(this.x-J.x)+Math.abs(this.y-J.y)}setLength(J){return this.normalize().multiplyScalar(J)}lerp(J,Q){return this.x+=(J.x-this.x)*Q,this.y+=(J.y-this.y)*Q,this}lerpVectors(J,Q,$){return this.x=J.x+(Q.x-J.x)*$,this.y=J.y+(Q.y-J.y)*$,this}equals(J){return J.x===this.x&&J.y===this.y}fromArray(J,Q=0){return this.x=J[Q],this.y=J[Q+1],this}toArray(J=[],Q=0){return J[Q]=this.x,J[Q+1]=this.y,J}fromBufferAttribute(J,Q){return this.x=J.getX(Q),this.y=J.getY(Q),this}rotateAround(J,Q){let $=Math.cos(Q),Z=Math.sin(Q),W=this.x-J.x,K=this.y-J.y;return this.x=W*$-K*Z+J.x,this.y=W*Z+K*$+J.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class iJ{constructor(J=0,Q=0,$=0,Z=1){this.isQuaternion=!0,this._x=J,this._y=Q,this._z=$,this._w=Z}static slerpFlat(J,Q,$,Z,W,K,H){let X=$[Z+0],Y=$[Z+1],U=$[Z+2],G=$[Z+3],q=W[K+0],N=W[K+1],R=W[K+2],M=W[K+3];if(H<=0){J[Q+0]=X,J[Q+1]=Y,J[Q+2]=U,J[Q+3]=G;return}if(H>=1){J[Q+0]=q,J[Q+1]=N,J[Q+2]=R,J[Q+3]=M;return}if(G!==M||X!==q||Y!==N||U!==R){let E=X*q+Y*N+U*R+G*M;if(E<0)q=-q,N=-N,R=-R,M=-M,E=-E;let F=1-H;if(E<0.9995){let O=Math.acos(E),k=Math.sin(O);F=Math.sin(F*O)/k,H=Math.sin(H*O)/k,X=X*F+q*H,Y=Y*F+N*H,U=U*F+R*H,G=G*F+M*H}else{X=X*F+q*H,Y=Y*F+N*H,U=U*F+R*H,G=G*F+M*H;let O=1/Math.sqrt(X*X+Y*Y+U*U+G*G);X*=O,Y*=O,U*=O,G*=O}}J[Q]=X,J[Q+1]=Y,J[Q+2]=U,J[Q+3]=G}static multiplyQuaternionsFlat(J,Q,$,Z,W,K){let H=$[Z],X=$[Z+1],Y=$[Z+2],U=$[Z+3],G=W[K],q=W[K+1],N=W[K+2],R=W[K+3];return J[Q]=H*R+U*G+X*N-Y*q,J[Q+1]=X*R+U*q+Y*G-H*N,J[Q+2]=Y*R+U*N+H*q-X*G,J[Q+3]=U*R-H*G-X*q-Y*N,J}get x(){return this._x}set x(J){this._x=J,this._onChangeCallback()}get y(){return this._y}set y(J){this._y=J,this._onChangeCallback()}get z(){return this._z}set z(J){this._z=J,this._onChangeCallback()}get w(){return this._w}set w(J){this._w=J,this._onChangeCallback()}set(J,Q,$,Z){return this._x=J,this._y=Q,this._z=$,this._w=Z,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(J){return this._x=J.x,this._y=J.y,this._z=J.z,this._w=J.w,this._onChangeCallback(),this}setFromEuler(J,Q=!0){let{_x:$,_y:Z,_z:W,_order:K}=J,H=Math.cos,X=Math.sin,Y=H($/2),U=H(Z/2),G=H(W/2),q=X($/2),N=X(Z/2),R=X(W/2);switch(K){case"XYZ":this._x=q*U*G+Y*N*R,this._y=Y*N*G-q*U*R,this._z=Y*U*R+q*N*G,this._w=Y*U*G-q*N*R;break;case"YXZ":this._x=q*U*G+Y*N*R,this._y=Y*N*G-q*U*R,this._z=Y*U*R-q*N*G,this._w=Y*U*G+q*N*R;break;case"ZXY":this._x=q*U*G-Y*N*R,this._y=Y*N*G+q*U*R,this._z=Y*U*R+q*N*G,this._w=Y*U*G-q*N*R;break;case"ZYX":this._x=q*U*G-Y*N*R,this._y=Y*N*G+q*U*R,this._z=Y*U*R-q*N*G,this._w=Y*U*G+q*N*R;break;case"YZX":this._x=q*U*G+Y*N*R,this._y=Y*N*G+q*U*R,this._z=Y*U*R-q*N*G,this._w=Y*U*G-q*N*R;break;case"XZY":this._x=q*U*G-Y*N*R,this._y=Y*N*G-q*U*R,this._z=Y*U*R+q*N*G,this._w=Y*U*G+q*N*R;break;default:j0("Quaternion: .setFromEuler() encountered an unknown order: "+K)}if(Q===!0)this._onChangeCallback();return this}setFromAxisAngle(J,Q){let $=Q/2,Z=Math.sin($);return this._x=J.x*Z,this._y=J.y*Z,this._z=J.z*Z,this._w=Math.cos($),this._onChangeCallback(),this}setFromRotationMatrix(J){let Q=J.elements,$=Q[0],Z=Q[4],W=Q[8],K=Q[1],H=Q[5],X=Q[9],Y=Q[2],U=Q[6],G=Q[10],q=$+H+G;if(q>0){let N=0.5/Math.sqrt(q+1);this._w=0.25/N,this._x=(U-X)*N,this._y=(W-Y)*N,this._z=(K-Z)*N}else if($>H&&$>G){let N=2*Math.sqrt(1+$-H-G);this._w=(U-X)/N,this._x=0.25*N,this._y=(Z+K)/N,this._z=(W+Y)/N}else if(H>G){let N=2*Math.sqrt(1+H-$-G);this._w=(W-Y)/N,this._x=(Z+K)/N,this._y=0.25*N,this._z=(X+U)/N}else{let N=2*Math.sqrt(1+G-$-H);this._w=(K-Z)/N,this._x=(W+Y)/N,this._y=(X+U)/N,this._z=0.25*N}return this._onChangeCallback(),this}setFromUnitVectors(J,Q){let $=J.dot(Q)+1;if($<0.00000001)if($=0,Math.abs(J.x)>Math.abs(J.z))this._x=-J.y,this._y=J.x,this._z=0,this._w=$;else this._x=0,this._y=-J.z,this._z=J.y,this._w=$;else this._x=J.y*Q.z-J.z*Q.y,this._y=J.z*Q.x-J.x*Q.z,this._z=J.x*Q.y-J.y*Q.x,this._w=$;return this.normalize()}angleTo(J){return 2*Math.acos(Math.abs(Q9(this.dot(J),-1,1)))}rotateTowards(J,Q){let $=this.angleTo(J);if($===0)return this;let Z=Math.min(1,Q/$);return this.slerp(J,Z),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(J){return this._x*J._x+this._y*J._y+this._z*J._z+this._w*J._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 J=this.length();if(J===0)this._x=0,this._y=0,this._z=0,this._w=1;else J=1/J,this._x=this._x*J,this._y=this._y*J,this._z=this._z*J,this._w=this._w*J;return this._onChangeCallback(),this}multiply(J){return this.multiplyQuaternions(this,J)}premultiply(J){return this.multiplyQuaternions(J,this)}multiplyQuaternions(J,Q){let{_x:$,_y:Z,_z:W,_w:K}=J,H=Q._x,X=Q._y,Y=Q._z,U=Q._w;return this._x=$*U+K*H+Z*Y-W*X,this._y=Z*U+K*X+W*H-$*Y,this._z=W*U+K*Y+$*X-Z*H,this._w=K*U-$*H-Z*X-W*Y,this._onChangeCallback(),this}slerp(J,Q){if(Q<=0)return this;if(Q>=1)return this.copy(J);let{_x:$,_y:Z,_z:W,_w:K}=J,H=this.dot(J);if(H<0)$=-$,Z=-Z,W=-W,K=-K,H=-H;let X=1-Q;if(H<0.9995){let Y=Math.acos(H),U=Math.sin(Y);X=Math.sin(X*Y)/U,Q=Math.sin(Q*Y)/U,this._x=this._x*X+$*Q,this._y=this._y*X+Z*Q,this._z=this._z*X+W*Q,this._w=this._w*X+K*Q,this._onChangeCallback()}else this._x=this._x*X+$*Q,this._y=this._y*X+Z*Q,this._z=this._z*X+W*Q,this._w=this._w*X+K*Q,this.normalize();return this}slerpQuaternions(J,Q,$){return this.copy(J).slerp(Q,$)}random(){let J=2*Math.PI*Math.random(),Q=2*Math.PI*Math.random(),$=Math.random(),Z=Math.sqrt(1-$),W=Math.sqrt($);return this.set(Z*Math.sin(J),Z*Math.cos(J),W*Math.sin(Q),W*Math.cos(Q))}equals(J){return J._x===this._x&&J._y===this._y&&J._z===this._z&&J._w===this._w}fromArray(J,Q=0){return this._x=J[Q],this._y=J[Q+1],this._z=J[Q+2],this._w=J[Q+3],this._onChangeCallback(),this}toArray(J=[],Q=0){return J[Q]=this._x,J[Q+1]=this._y,J[Q+2]=this._z,J[Q+3]=this._w,J}fromBufferAttribute(J,Q){return this._x=J.getX(Q),this._y=J.getY(Q),this._z=J.getZ(Q),this._w=J.getW(Q),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(J){return this._onChangeCallback=J,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class f{constructor(J=0,Q=0,$=0){f.prototype.isVector3=!0,this.x=J,this.y=Q,this.z=$}set(J,Q,$){if($===void 0)$=this.z;return this.x=J,this.y=Q,this.z=$,this}setScalar(J){return this.x=J,this.y=J,this.z=J,this}setX(J){return this.x=J,this}setY(J){return this.y=J,this}setZ(J){return this.z=J,this}setComponent(J,Q){switch(J){case 0:this.x=Q;break;case 1:this.y=Q;break;case 2:this.z=Q;break;default:throw new Error("index is out of range: "+J)}return this}getComponent(J){switch(J){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+J)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(J){return this.x=J.x,this.y=J.y,this.z=J.z,this}add(J){return this.x+=J.x,this.y+=J.y,this.z+=J.z,this}addScalar(J){return this.x+=J,this.y+=J,this.z+=J,this}addVectors(J,Q){return this.x=J.x+Q.x,this.y=J.y+Q.y,this.z=J.z+Q.z,this}addScaledVector(J,Q){return this.x+=J.x*Q,this.y+=J.y*Q,this.z+=J.z*Q,this}sub(J){return this.x-=J.x,this.y-=J.y,this.z-=J.z,this}subScalar(J){return this.x-=J,this.y-=J,this.z-=J,this}subVectors(J,Q){return this.x=J.x-Q.x,this.y=J.y-Q.y,this.z=J.z-Q.z,this}multiply(J){return this.x*=J.x,this.y*=J.y,this.z*=J.z,this}multiplyScalar(J){return this.x*=J,this.y*=J,this.z*=J,this}multiplyVectors(J,Q){return this.x=J.x*Q.x,this.y=J.y*Q.y,this.z=J.z*Q.z,this}applyEuler(J){return this.applyQuaternion($1.setFromEuler(J))}applyAxisAngle(J,Q){return this.applyQuaternion($1.setFromAxisAngle(J,Q))}applyMatrix3(J){let Q=this.x,$=this.y,Z=this.z,W=J.elements;return this.x=W[0]*Q+W[3]*$+W[6]*Z,this.y=W[1]*Q+W[4]*$+W[7]*Z,this.z=W[2]*Q+W[5]*$+W[8]*Z,this}applyNormalMatrix(J){return this.applyMatrix3(J).normalize()}applyMatrix4(J){let Q=this.x,$=this.y,Z=this.z,W=J.elements,K=1/(W[3]*Q+W[7]*$+W[11]*Z+W[15]);return this.x=(W[0]*Q+W[4]*$+W[8]*Z+W[12])*K,this.y=(W[1]*Q+W[5]*$+W[9]*Z+W[13])*K,this.z=(W[2]*Q+W[6]*$+W[10]*Z+W[14])*K,this}applyQuaternion(J){let Q=this.x,$=this.y,Z=this.z,W=J.x,K=J.y,H=J.z,X=J.w,Y=2*(K*Z-H*$),U=2*(H*Q-W*Z),G=2*(W*$-K*Q);return this.x=Q+X*Y+K*G-H*U,this.y=$+X*U+H*Y-W*G,this.z=Z+X*G+W*U-K*Y,this}project(J){return this.applyMatrix4(J.matrixWorldInverse).applyMatrix4(J.projectionMatrix)}unproject(J){return this.applyMatrix4(J.projectionMatrixInverse).applyMatrix4(J.matrixWorld)}transformDirection(J){let Q=this.x,$=this.y,Z=this.z,W=J.elements;return this.x=W[0]*Q+W[4]*$+W[8]*Z,this.y=W[1]*Q+W[5]*$+W[9]*Z,this.z=W[2]*Q+W[6]*$+W[10]*Z,this.normalize()}divide(J){return this.x/=J.x,this.y/=J.y,this.z/=J.z,this}divideScalar(J){return this.multiplyScalar(1/J)}min(J){return this.x=Math.min(this.x,J.x),this.y=Math.min(this.y,J.y),this.z=Math.min(this.z,J.z),this}max(J){return this.x=Math.max(this.x,J.x),this.y=Math.max(this.y,J.y),this.z=Math.max(this.z,J.z),this}clamp(J,Q){return this.x=Q9(this.x,J.x,Q.x),this.y=Q9(this.y,J.y,Q.y),this.z=Q9(this.z,J.z,Q.z),this}clampScalar(J,Q){return this.x=Q9(this.x,J,Q),this.y=Q9(this.y,J,Q),this.z=Q9(this.z,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(Q9($,J,Q))}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(J){return this.x*J.x+this.y*J.y+this.z*J.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(J){return this.normalize().multiplyScalar(J)}lerp(J,Q){return this.x+=(J.x-this.x)*Q,this.y+=(J.y-this.y)*Q,this.z+=(J.z-this.z)*Q,this}lerpVectors(J,Q,$){return this.x=J.x+(Q.x-J.x)*$,this.y=J.y+(Q.y-J.y)*$,this.z=J.z+(Q.z-J.z)*$,this}cross(J){return this.crossVectors(this,J)}crossVectors(J,Q){let{x:$,y:Z,z:W}=J,K=Q.x,H=Q.y,X=Q.z;return this.x=Z*X-W*H,this.y=W*K-$*X,this.z=$*H-Z*K,this}projectOnVector(J){let Q=J.lengthSq();if(Q===0)return this.set(0,0,0);let $=J.dot(this)/Q;return this.copy(J).multiplyScalar($)}projectOnPlane(J){return uK.copy(this).projectOnVector(J),this.sub(uK)}reflect(J){return this.sub(uK.copy(J).multiplyScalar(2*this.dot(J)))}angleTo(J){let Q=Math.sqrt(this.lengthSq()*J.lengthSq());if(Q===0)return Math.PI/2;let $=this.dot(J)/Q;return Math.acos(Q9($,-1,1))}distanceTo(J){return Math.sqrt(this.distanceToSquared(J))}distanceToSquared(J){let Q=this.x-J.x,$=this.y-J.y,Z=this.z-J.z;return Q*Q+$*$+Z*Z}manhattanDistanceTo(J){return Math.abs(this.x-J.x)+Math.abs(this.y-J.y)+Math.abs(this.z-J.z)}setFromSpherical(J){return this.setFromSphericalCoords(J.radius,J.phi,J.theta)}setFromSphericalCoords(J,Q,$){let Z=Math.sin(Q)*J;return this.x=Z*Math.sin($),this.y=Math.cos(Q)*J,this.z=Z*Math.cos($),this}setFromCylindrical(J){return this.setFromCylindricalCoords(J.radius,J.theta,J.y)}setFromCylindricalCoords(J,Q,$){return this.x=J*Math.sin(Q),this.y=$,this.z=J*Math.cos(Q),this}setFromMatrixPosition(J){let Q=J.elements;return this.x=Q[12],this.y=Q[13],this.z=Q[14],this}setFromMatrixScale(J){let Q=this.setFromMatrixColumn(J,0).length(),$=this.setFromMatrixColumn(J,1).length(),Z=this.setFromMatrixColumn(J,2).length();return this.x=Q,this.y=$,this.z=Z,this}setFromMatrixColumn(J,Q){return this.fromArray(J.elements,Q*4)}setFromMatrix3Column(J,Q){return this.fromArray(J.elements,Q*3)}setFromEuler(J){return this.x=J._x,this.y=J._y,this.z=J._z,this}setFromColor(J){return this.x=J.r,this.y=J.g,this.z=J.b,this}equals(J){return J.x===this.x&&J.y===this.y&&J.z===this.z}fromArray(J,Q=0){return this.x=J[Q],this.y=J[Q+1],this.z=J[Q+2],this}toArray(J=[],Q=0){return J[Q]=this.x,J[Q+1]=this.y,J[Q+2]=this.z,J}fromBufferAttribute(J,Q){return this.x=J.getX(Q),this.y=J.getY(Q),this.z=J.getZ(Q),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let J=Math.random()*Math.PI*2,Q=Math.random()*2-1,$=Math.sqrt(1-Q*Q);return this.x=$*Math.cos(J),this.y=Q,this.z=$*Math.sin(J),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}var uK=new f,$1=new iJ;class t0{constructor(J,Q,$,Z,W,K,H,X,Y){if(t0.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],J!==void 0)this.set(J,Q,$,Z,W,K,H,X,Y)}set(J,Q,$,Z,W,K,H,X,Y){let U=this.elements;return U[0]=J,U[1]=Z,U[2]=H,U[3]=Q,U[4]=W,U[5]=X,U[6]=$,U[7]=K,U[8]=Y,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(J){let Q=this.elements,$=J.elements;return Q[0]=$[0],Q[1]=$[1],Q[2]=$[2],Q[3]=$[3],Q[4]=$[4],Q[5]=$[5],Q[6]=$[6],Q[7]=$[7],Q[8]=$[8],this}extractBasis(J,Q,$){return J.setFromMatrix3Column(this,0),Q.setFromMatrix3Column(this,1),$.setFromMatrix3Column(this,2),this}setFromMatrix4(J){let Q=J.elements;return this.set(Q[0],Q[4],Q[8],Q[1],Q[5],Q[9],Q[2],Q[6],Q[10]),this}multiply(J){return this.multiplyMatrices(this,J)}premultiply(J){return this.multiplyMatrices(J,this)}multiplyMatrices(J,Q){let $=J.elements,Z=Q.elements,W=this.elements,K=$[0],H=$[3],X=$[6],Y=$[1],U=$[4],G=$[7],q=$[2],N=$[5],R=$[8],M=Z[0],E=Z[3],F=Z[6],O=Z[1],k=Z[4],D=Z[7],B=Z[2],A=Z[5],C=Z[8];return W[0]=K*M+H*O+X*B,W[3]=K*E+H*k+X*A,W[6]=K*F+H*D+X*C,W[1]=Y*M+U*O+G*B,W[4]=Y*E+U*k+G*A,W[7]=Y*F+U*D+G*C,W[2]=q*M+N*O+R*B,W[5]=q*E+N*k+R*A,W[8]=q*F+N*D+R*C,this}multiplyScalar(J){let Q=this.elements;return Q[0]*=J,Q[3]*=J,Q[6]*=J,Q[1]*=J,Q[4]*=J,Q[7]*=J,Q[2]*=J,Q[5]*=J,Q[8]*=J,this}determinant(){let J=this.elements,Q=J[0],$=J[1],Z=J[2],W=J[3],K=J[4],H=J[5],X=J[6],Y=J[7],U=J[8];return Q*K*U-Q*H*Y-$*W*U+$*H*X+Z*W*Y-Z*K*X}invert(){let J=this.elements,Q=J[0],$=J[1],Z=J[2],W=J[3],K=J[4],H=J[5],X=J[6],Y=J[7],U=J[8],G=U*K-H*Y,q=H*X-U*W,N=Y*W-K*X,R=Q*G+$*q+Z*N;if(R===0)return this.set(0,0,0,0,0,0,0,0,0);let M=1/R;return J[0]=G*M,J[1]=(Z*Y-U*$)*M,J[2]=(H*$-Z*K)*M,J[3]=q*M,J[4]=(U*Q-Z*X)*M,J[5]=(Z*W-H*Q)*M,J[6]=N*M,J[7]=($*X-Y*Q)*M,J[8]=(K*Q-$*W)*M,this}transpose(){let J,Q=this.elements;return J=Q[1],Q[1]=Q[3],Q[3]=J,J=Q[2],Q[2]=Q[6],Q[6]=J,J=Q[5],Q[5]=Q[7],Q[7]=J,this}getNormalMatrix(J){return this.setFromMatrix4(J).invert().transpose()}transposeIntoArray(J){let Q=this.elements;return J[0]=Q[0],J[1]=Q[3],J[2]=Q[6],J[3]=Q[1],J[4]=Q[4],J[5]=Q[7],J[6]=Q[2],J[7]=Q[5],J[8]=Q[8],this}setUvTransform(J,Q,$,Z,W,K,H){let X=Math.cos(W),Y=Math.sin(W);return this.set($*X,$*Y,-$*(X*K+Y*H)+K+J,-Z*Y,Z*X,-Z*(-Y*K+X*H)+H+Q,0,0,1),this}scale(J,Q){return this.premultiply(lK.makeScale(J,Q)),this}rotate(J){return this.premultiply(lK.makeRotation(-J)),this}translate(J,Q){return this.premultiply(lK.makeTranslation(J,Q)),this}makeTranslation(J,Q){if(J.isVector2)this.set(1,0,J.x,0,1,J.y,0,0,1);else this.set(1,0,J,0,1,Q,0,0,1);return this}makeRotation(J){let Q=Math.cos(J),$=Math.sin(J);return this.set(Q,-$,0,$,Q,0,0,0,1),this}makeScale(J,Q){return this.set(J,0,0,0,Q,0,0,0,1),this}equals(J){let Q=this.elements,$=J.elements;for(let Z=0;Z<9;Z++)if(Q[Z]!==$[Z])return!1;return!0}fromArray(J,Q=0){for(let $=0;$<9;$++)this.elements[$]=J[$+Q];return this}toArray(J=[],Q=0){let $=this.elements;return J[Q]=$[0],J[Q+1]=$[1],J[Q+2]=$[2],J[Q+3]=$[3],J[Q+4]=$[4],J[Q+5]=$[5],J[Q+6]=$[6],J[Q+7]=$[7],J[Q+8]=$[8],J}clone(){return new this.constructor().fromArray(this.elements)}}var lK=new t0,Z1=new t0().set(0.4123908,0.3575843,0.1804808,0.212639,0.7151687,0.0721923,0.0193308,0.1191948,0.9505322),W1=new t0().set(3.2409699,-1.5373832,-0.4986108,-0.9692436,1.8759675,0.0415551,0.0556301,-0.203977,1.0569715);function CF(){let J={enabled:!0,workingColorSpace:"srgb-linear",spaces:{},convert:function(W,K,H){if(this.enabled===!1||K===H||!K||!H)return W;if(this.spaces[K].transfer==="srgb")W.r=F7(W.r),W.g=F7(W.g),W.b=F7(W.b);if(this.spaces[K].primaries!==this.spaces[H].primaries)W.applyMatrix3(this.spaces[K].toXYZ),W.applyMatrix3(this.spaces[H].fromXYZ);if(this.spaces[H].transfer==="srgb")W.r=F$(W.r),W.g=F$(W.g),W.b=F$(W.b);return W},workingToColorSpace:function(W,K){return this.convert(W,this.workingColorSpace,K)},colorSpaceToWorking:function(W,K){return this.convert(W,K,this.workingColorSpace)},getPrimaries:function(W){return this.spaces[W].primaries},getTransfer:function(W){if(W==="")return"linear";return this.spaces[W].transfer},getToneMappingMode:function(W){return this.spaces[W].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(W,K=this.workingColorSpace){return W.fromArray(this.spaces[K].luminanceCoefficients)},define:function(W){Object.assign(this.spaces,W)},_getMatrix:function(W,K,H){return W.copy(this.spaces[K].toXYZ).multiply(this.spaces[H].fromXYZ)},_getDrawingBufferColorSpace:function(W){return this.spaces[W].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(W=this.workingColorSpace){return this.spaces[W].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(W,K){return M$("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),J.workingToColorSpace(W,K)},toWorkingColorSpace:function(W,K){return M$("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),J.colorSpaceToWorking(W,K)}},Q=[0.64,0.33,0.3,0.6,0.15,0.06],$=[0.2126,0.7152,0.0722],Z=[0.3127,0.329];return J.define({["srgb-linear"]:{primaries:Q,whitePoint:Z,transfer:"linear",toXYZ:Z1,fromXYZ:W1,luminanceCoefficients:$,workingColorSpaceConfig:{unpackColorSpace:"srgb"},outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}},["srgb"]:{primaries:Q,whitePoint:Z,transfer:"srgb",toXYZ:Z1,fromXYZ:W1,luminanceCoefficients:$,outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}}}),J}var X9=CF();function F7(J){return J<0.04045?J*0.0773993808:Math.pow(J*0.9478672986+0.0521327014,2.4)}function F$(J){return J<0.0031308?J*12.92:1.055*Math.pow(J,0.41666)-0.055}var J$;class LX{static getDataURL(J,Q="image/png"){if(/^data:/i.test(J.src))return J.src;if(typeof HTMLCanvasElement==="undefined")return J.src;let $;if(J instanceof HTMLCanvasElement)$=J;else{if(J$===void 0)J$=E$("canvas");J$.width=J.width,J$.height=J.height;let Z=J$.getContext("2d");if(J instanceof ImageData)Z.putImageData(J,0,0);else Z.drawImage(J,0,0,J.width,J.height);$=J$}return $.toDataURL(Q)}static sRGBToLinear(J){if(typeof HTMLImageElement!=="undefined"&&J instanceof HTMLImageElement||typeof HTMLCanvasElement!=="undefined"&&J instanceof HTMLCanvasElement||typeof ImageBitmap!=="undefined"&&J instanceof ImageBitmap){let Q=E$("canvas");Q.width=J.width,Q.height=J.height;let $=Q.getContext("2d");$.drawImage(J,0,0,J.width,J.height);let Z=$.getImageData(0,0,J.width,J.height),W=Z.data;for(let K=0;K1?!0:!1,this.pmremVersion=0}get width(){return this.source.getSize(sK).x}get height(){return this.source.getSize(sK).y}get depth(){return this.source.getSize(sK).z}get image(){return this.source.data}set image(J=null){this.source.data=J}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(J,Q){this.updateRanges.push({start:J,count:Q})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(J){return this.name=J.name,this.source=J.source,this.mipmaps=J.mipmaps.slice(0),this.mapping=J.mapping,this.channel=J.channel,this.wrapS=J.wrapS,this.wrapT=J.wrapT,this.magFilter=J.magFilter,this.minFilter=J.minFilter,this.anisotropy=J.anisotropy,this.format=J.format,this.internalFormat=J.internalFormat,this.type=J.type,this.offset.copy(J.offset),this.repeat.copy(J.repeat),this.center.copy(J.center),this.rotation=J.rotation,this.matrixAutoUpdate=J.matrixAutoUpdate,this.matrix.copy(J.matrix),this.generateMipmaps=J.generateMipmaps,this.premultiplyAlpha=J.premultiplyAlpha,this.flipY=J.flipY,this.unpackAlignment=J.unpackAlignment,this.colorSpace=J.colorSpace,this.renderTarget=J.renderTarget,this.isRenderTargetTexture=J.isRenderTargetTexture,this.isArrayTexture=J.isArrayTexture,this.userData=JSON.parse(JSON.stringify(J.userData)),this.needsUpdate=!0,this}setValues(J){for(let Q in J){let $=J[Q];if($===void 0){j0(`Texture.setValues(): parameter '${Q}' has value of undefined.`);continue}let Z=this[Q];if(Z===void 0){j0(`Texture.setValues(): property '${Q}' does not exist.`);continue}if(Z&&$&&(Z.isVector2&&$.isVector2))Z.copy($);else if(Z&&$&&(Z.isVector3&&$.isVector3))Z.copy($);else if(Z&&$&&(Z.isMatrix3&&$.isMatrix3))Z.copy($);else this[Q]=$}}toJSON(J){let Q=J===void 0||typeof J==="string";if(!Q&&J.textures[this.uuid]!==void 0)return J.textures[this.uuid];let $={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(J).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};if(Object.keys(this.userData).length>0)$.userData=this.userData;if(!Q)J.textures[this.uuid]=$;return $}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(J){if(this.mapping!==300)return J;if(J.applyMatrix3(this.matrix),J.x<0||J.x>1)switch(this.wrapS){case 1000:J.x=J.x-Math.floor(J.x);break;case 1001:J.x=J.x<0?0:1;break;case 1002:if(Math.abs(Math.floor(J.x)%2)===1)J.x=Math.ceil(J.x)-J.x;else J.x=J.x-Math.floor(J.x);break}if(J.y<0||J.y>1)switch(this.wrapT){case 1000:J.y=J.y-Math.floor(J.y);break;case 1001:J.y=J.y<0?0:1;break;case 1002:if(Math.abs(Math.floor(J.y)%2)===1)J.y=Math.ceil(J.y)-J.y;else J.y=J.y-Math.floor(J.y);break}if(this.flipY)J.y=1-J.y;return J}set needsUpdate(J){if(J===!0)this.version++,this.source.needsUpdate=!0}set needsPMREMUpdate(J){if(J===!0)this.pmremVersion++}}o9.DEFAULT_IMAGE=null;o9.DEFAULT_MAPPING=300;o9.DEFAULT_ANISOTROPY=1;class _9{constructor(J=0,Q=0,$=0,Z=1){_9.prototype.isVector4=!0,this.x=J,this.y=Q,this.z=$,this.w=Z}get width(){return this.z}set width(J){this.z=J}get height(){return this.w}set height(J){this.w=J}set(J,Q,$,Z){return this.x=J,this.y=Q,this.z=$,this.w=Z,this}setScalar(J){return this.x=J,this.y=J,this.z=J,this.w=J,this}setX(J){return this.x=J,this}setY(J){return this.y=J,this}setZ(J){return this.z=J,this}setW(J){return this.w=J,this}setComponent(J,Q){switch(J){case 0:this.x=Q;break;case 1:this.y=Q;break;case 2:this.z=Q;break;case 3:this.w=Q;break;default:throw new Error("index is out of range: "+J)}return this}getComponent(J){switch(J){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: "+J)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(J){return this.x=J.x,this.y=J.y,this.z=J.z,this.w=J.w!==void 0?J.w:1,this}add(J){return this.x+=J.x,this.y+=J.y,this.z+=J.z,this.w+=J.w,this}addScalar(J){return this.x+=J,this.y+=J,this.z+=J,this.w+=J,this}addVectors(J,Q){return this.x=J.x+Q.x,this.y=J.y+Q.y,this.z=J.z+Q.z,this.w=J.w+Q.w,this}addScaledVector(J,Q){return this.x+=J.x*Q,this.y+=J.y*Q,this.z+=J.z*Q,this.w+=J.w*Q,this}sub(J){return this.x-=J.x,this.y-=J.y,this.z-=J.z,this.w-=J.w,this}subScalar(J){return this.x-=J,this.y-=J,this.z-=J,this.w-=J,this}subVectors(J,Q){return this.x=J.x-Q.x,this.y=J.y-Q.y,this.z=J.z-Q.z,this.w=J.w-Q.w,this}multiply(J){return this.x*=J.x,this.y*=J.y,this.z*=J.z,this.w*=J.w,this}multiplyScalar(J){return this.x*=J,this.y*=J,this.z*=J,this.w*=J,this}applyMatrix4(J){let Q=this.x,$=this.y,Z=this.z,W=this.w,K=J.elements;return this.x=K[0]*Q+K[4]*$+K[8]*Z+K[12]*W,this.y=K[1]*Q+K[5]*$+K[9]*Z+K[13]*W,this.z=K[2]*Q+K[6]*$+K[10]*Z+K[14]*W,this.w=K[3]*Q+K[7]*$+K[11]*Z+K[15]*W,this}divide(J){return this.x/=J.x,this.y/=J.y,this.z/=J.z,this.w/=J.w,this}divideScalar(J){return this.multiplyScalar(1/J)}setAxisAngleFromQuaternion(J){this.w=2*Math.acos(J.w);let Q=Math.sqrt(1-J.w*J.w);if(Q<0.0001)this.x=1,this.y=0,this.z=0;else this.x=J.x/Q,this.y=J.y/Q,this.z=J.z/Q;return this}setAxisAngleFromRotationMatrix(J){let Q,$,Z,W,K=0.01,H=0.1,X=J.elements,Y=X[0],U=X[4],G=X[8],q=X[1],N=X[5],R=X[9],M=X[2],E=X[6],F=X[10];if(Math.abs(U-q)<0.01&&Math.abs(G-M)<0.01&&Math.abs(R-E)<0.01){if(Math.abs(U+q)<0.1&&Math.abs(G+M)<0.1&&Math.abs(R+E)<0.1&&Math.abs(Y+N+F-3)<0.1)return this.set(1,0,0,0),this;Q=Math.PI;let k=(Y+1)/2,D=(N+1)/2,B=(F+1)/2,A=(U+q)/4,C=(G+M)/4,w=(R+E)/4;if(k>D&&k>B)if(k<0.01)$=0,Z=0.707106781,W=0.707106781;else $=Math.sqrt(k),Z=A/$,W=C/$;else if(D>B)if(D<0.01)$=0.707106781,Z=0,W=0.707106781;else Z=Math.sqrt(D),$=A/Z,W=w/Z;else if(B<0.01)$=0.707106781,Z=0.707106781,W=0;else W=Math.sqrt(B),$=C/W,Z=w/W;return this.set($,Z,W,Q),this}let O=Math.sqrt((E-R)*(E-R)+(G-M)*(G-M)+(q-U)*(q-U));if(Math.abs(O)<0.001)O=1;return this.x=(E-R)/O,this.y=(G-M)/O,this.z=(q-U)/O,this.w=Math.acos((Y+N+F-1)/2),this}setFromMatrixPosition(J){let Q=J.elements;return this.x=Q[12],this.y=Q[13],this.z=Q[14],this.w=Q[15],this}min(J){return this.x=Math.min(this.x,J.x),this.y=Math.min(this.y,J.y),this.z=Math.min(this.z,J.z),this.w=Math.min(this.w,J.w),this}max(J){return this.x=Math.max(this.x,J.x),this.y=Math.max(this.y,J.y),this.z=Math.max(this.z,J.z),this.w=Math.max(this.w,J.w),this}clamp(J,Q){return this.x=Q9(this.x,J.x,Q.x),this.y=Q9(this.y,J.y,Q.y),this.z=Q9(this.z,J.z,Q.z),this.w=Q9(this.w,J.w,Q.w),this}clampScalar(J,Q){return this.x=Q9(this.x,J,Q),this.y=Q9(this.y,J,Q),this.z=Q9(this.z,J,Q),this.w=Q9(this.w,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(Q9($,J,Q))}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(J){return this.x*J.x+this.y*J.y+this.z*J.z+this.w*J.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(J){return this.normalize().multiplyScalar(J)}lerp(J,Q){return this.x+=(J.x-this.x)*Q,this.y+=(J.y-this.y)*Q,this.z+=(J.z-this.z)*Q,this.w+=(J.w-this.w)*Q,this}lerpVectors(J,Q,$){return this.x=J.x+(Q.x-J.x)*$,this.y=J.y+(Q.y-J.y)*$,this.z=J.z+(Q.z-J.z)*$,this.w=J.w+(Q.w-J.w)*$,this}equals(J){return J.x===this.x&&J.y===this.y&&J.z===this.z&&J.w===this.w}fromArray(J,Q=0){return this.x=J[Q],this.y=J[Q+1],this.z=J[Q+2],this.w=J[Q+3],this}toArray(J=[],Q=0){return J[Q]=this.x,J[Q+1]=this.y,J[Q+2]=this.z,J[Q+3]=this.w,J}fromBufferAttribute(J,Q){return this.x=J.getX(Q),this.y=J.getY(Q),this.z=J.getZ(Q),this.w=J.getW(Q),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 BX extends B7{constructor(J=1,Q=1,$={}){super();$=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},$),this.isRenderTarget=!0,this.width=J,this.height=Q,this.depth=$.depth,this.scissor=new _9(0,0,J,Q),this.scissorTest=!1,this.viewport=new _9(0,0,J,Q);let Z={width:J,height:Q,depth:$.depth},W=new o9(Z);this.textures=[];let K=$.count;for(let H=0;H1;this.dispose()}this.viewport.set(0,0,J,Q),this.scissor.set(0,0,J,Q)}clone(){return new this.constructor().copy(this)}copy(J){this.width=J.width,this.height=J.height,this.depth=J.depth,this.scissor.copy(J.scissor),this.scissorTest=J.scissorTest,this.viewport.copy(J.viewport),this.textures.length=0;for(let Q=0,$=J.textures.length;Q<$;Q++){this.textures[Q]=J.textures[Q].clone(),this.textures[Q].isRenderTargetTexture=!0,this.textures[Q].renderTarget=this;let Z=Object.assign({},J.textures[Q].image);this.textures[Q].source=new kZ(Z)}if(this.depthBuffer=J.depthBuffer,this.stencilBuffer=J.stencilBuffer,this.resolveDepthBuffer=J.resolveDepthBuffer,this.resolveStencilBuffer=J.resolveStencilBuffer,J.depthTexture!==null)this.depthTexture=J.depthTexture.clone();return this.samples=J.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class aJ extends BX{constructor(J=1,Q=1,$={}){super(J,Q,$);this.isWebGLRenderTarget=!0}}class OW extends o9{constructor(J=null,Q=1,$=1,Z=1){super(null);this.isDataArrayTexture=!0,this.image={data:J,width:Q,height:$,depth:Z},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(J){this.layerUpdates.add(J)}clearLayerUpdates(){this.layerUpdates.clear()}}class DX extends o9{constructor(J=null,Q=1,$=1,Z=1){super(null);this.isData3DTexture=!0,this.image={data:J,width:Q,height:$,depth:Z},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class C8{constructor(J=new f(1/0,1/0,1/0),Q=new f(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=J,this.max=Q}set(J,Q){return this.min.copy(J),this.max.copy(Q),this}setFromArray(J){this.makeEmpty();for(let Q=0,$=J.length;Q<$;Q+=3)this.expandByPoint(x8.fromArray(J,Q));return this}setFromBufferAttribute(J){this.makeEmpty();for(let Q=0,$=J.count;Q<$;Q++)this.expandByPoint(x8.fromBufferAttribute(J,Q));return this}setFromPoints(J){this.makeEmpty();for(let Q=0,$=J.length;Q<$;Q++)this.expandByPoint(J[Q]);return this}setFromCenterAndSize(J,Q){let $=x8.copy(Q).multiplyScalar(0.5);return this.min.copy(J).sub($),this.max.copy(J).add($),this}setFromObject(J,Q=!1){return this.makeEmpty(),this.expandByObject(J,Q)}clone(){return new this.constructor().copy(this)}copy(J){return this.min.copy(J.min),this.max.copy(J.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&&J.x<=this.max.x&&J.y>=this.min.y&&J.y<=this.max.y&&J.z>=this.min.z&&J.z<=this.max.z}containsBox(J){return this.min.x<=J.min.x&&J.max.x<=this.max.x&&this.min.y<=J.min.y&&J.max.y<=this.max.y&&this.min.z<=J.min.z&&J.max.z<=this.max.z}getParameter(J,Q){return Q.set((J.x-this.min.x)/(this.max.x-this.min.x),(J.y-this.min.y)/(this.max.y-this.min.y),(J.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(J){return J.max.x>=this.min.x&&J.min.x<=this.max.x&&J.max.y>=this.min.y&&J.min.y<=this.max.y&&J.max.z>=this.min.z&&J.min.z<=this.max.z}intersectsSphere(J){return this.clampPoint(J.center,x8),x8.distanceToSquared(J.center)<=J.radius*J.radius}intersectsPlane(J){let Q,$;if(J.normal.x>0)Q=J.normal.x*this.min.x,$=J.normal.x*this.max.x;else Q=J.normal.x*this.max.x,$=J.normal.x*this.min.x;if(J.normal.y>0)Q+=J.normal.y*this.min.y,$+=J.normal.y*this.max.y;else Q+=J.normal.y*this.max.y,$+=J.normal.y*this.min.y;if(J.normal.z>0)Q+=J.normal.z*this.min.z,$+=J.normal.z*this.max.z;else Q+=J.normal.z*this.max.z,$+=J.normal.z*this.min.z;return Q<=-J.constant&&$>=-J.constant}intersectsTriangle(J){if(this.isEmpty())return!1;this.getCenter(HZ),A6.subVectors(this.max,HZ),Q$.subVectors(J.a,HZ),$$.subVectors(J.b,HZ),Z$.subVectors(J.c,HZ),b7.subVectors($$,Q$),y7.subVectors(Z$,$$),qQ.subVectors(Q$,Z$);let Q=[0,-b7.z,b7.y,0,-y7.z,y7.y,0,-qQ.z,qQ.y,b7.z,0,-b7.x,y7.z,0,-y7.x,qQ.z,0,-qQ.x,-b7.y,b7.x,0,-y7.y,y7.x,0,-qQ.y,qQ.x,0];if(!nK(Q,Q$,$$,Z$,A6))return!1;if(Q=[1,0,0,0,1,0,0,0,1],!nK(Q,Q$,$$,Z$,A6))return!1;return w6.crossVectors(b7,y7),Q=[w6.x,w6.y,w6.z],nK(Q,Q$,$$,Z$,A6)}clampPoint(J,Q){return Q.copy(J).clamp(this.min,this.max)}distanceToPoint(J){return this.clampPoint(J,x8).distanceTo(J)}getBoundingSphere(J){if(this.isEmpty())J.makeEmpty();else this.getCenter(J.center),J.radius=this.getSize(x8).length()*0.5;return J}intersect(J){if(this.min.max(J.min),this.max.min(J.max),this.isEmpty())this.makeEmpty();return this}union(J){return this.min.min(J.min),this.max.max(J.max),this}applyMatrix4(J){if(this.isEmpty())return this;return Y7[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(J),Y7[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(J),Y7[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(J),Y7[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(J),Y7[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(J),Y7[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(J),Y7[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(J),Y7[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(J),this.setFromPoints(Y7),this}translate(J){return this.min.add(J),this.max.add(J),this}equals(J){return J.min.equals(this.min)&&J.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(J){return this.min.fromArray(J.min),this.max.fromArray(J.max),this}}var Y7=[new f,new f,new f,new f,new f,new f,new f,new f],x8=new f,P6=new C8,Q$=new f,$$=new f,Z$=new f,b7=new f,y7=new f,qQ=new f,HZ=new f,A6=new f,w6=new f,NQ=new f;function nK(J,Q,$,Z,W){for(let K=0,H=J.length-3;K<=H;K+=3){NQ.fromArray(J,K);let X=W.x*Math.abs(NQ.x)+W.y*Math.abs(NQ.y)+W.z*Math.abs(NQ.z),Y=Q.dot(NQ),U=$.dot(NQ),G=Z.dot(NQ);if(Math.max(-Math.max(Y,U,G),Math.min(Y,U,G))>X)return!1}return!0}var AF=new C8,XZ=new f,oK=new f;class G8{constructor(J=new f,Q=-1){this.isSphere=!0,this.center=J,this.radius=Q}set(J,Q){return this.center.copy(J),this.radius=Q,this}setFromPoints(J,Q){let $=this.center;if(Q!==void 0)$.copy(Q);else AF.setFromPoints(J).getCenter($);let Z=0;for(let W=0,K=J.length;Wthis.radius*this.radius)Q.sub(this.center).normalize(),Q.multiplyScalar(this.radius).add(this.center);return Q}getBoundingBox(J){if(this.isEmpty())return J.makeEmpty(),J;return J.set(this.center,this.center),J.expandByScalar(this.radius),J}applyMatrix4(J){return this.center.applyMatrix4(J),this.radius=this.radius*J.getMaxScaleOnAxis(),this}translate(J){return this.center.add(J),this}expandByPoint(J){if(this.isEmpty())return this.center.copy(J),this.radius=0,this;XZ.subVectors(J,this.center);let Q=XZ.lengthSq();if(Q>this.radius*this.radius){let $=Math.sqrt(Q),Z=($-this.radius)*0.5;this.center.addScaledVector(XZ,Z/$),this.radius+=Z}return this}union(J){if(J.isEmpty())return this;if(this.isEmpty())return this.copy(J),this;if(this.center.equals(J.center)===!0)this.radius=Math.max(this.radius,J.radius);else oK.subVectors(J.center,this.center).setLength(J.radius),this.expandByPoint(XZ.copy(J.center).add(oK)),this.expandByPoint(XZ.copy(J.center).sub(oK));return this}equals(J){return J.center.equals(this.center)&&J.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(J){return this.radius=J.radius,this.center.fromArray(J.center),this}}var U7=new f,iK=new f,S6=new f,h7=new f,aK=new f,T6=new f,rK=new f;class c7{constructor(J=new f,Q=new f(0,0,-1)){this.origin=J,this.direction=Q}set(J,Q){return this.origin.copy(J),this.direction.copy(Q),this}copy(J){return this.origin.copy(J.origin),this.direction.copy(J.direction),this}at(J,Q){return Q.copy(this.origin).addScaledVector(this.direction,J)}lookAt(J){return this.direction.copy(J).sub(this.origin).normalize(),this}recast(J){return this.origin.copy(this.at(J,U7)),this}closestPointToPoint(J,Q){Q.subVectors(J,this.origin);let $=Q.dot(this.direction);if($<0)return Q.copy(this.origin);return Q.copy(this.origin).addScaledVector(this.direction,$)}distanceToPoint(J){return Math.sqrt(this.distanceSqToPoint(J))}distanceSqToPoint(J){let Q=U7.subVectors(J,this.origin).dot(this.direction);if(Q<0)return this.origin.distanceToSquared(J);return U7.copy(this.origin).addScaledVector(this.direction,Q),U7.distanceToSquared(J)}distanceSqToSegment(J,Q,$,Z){iK.copy(J).add(Q).multiplyScalar(0.5),S6.copy(Q).sub(J).normalize(),h7.copy(this.origin).sub(iK);let W=J.distanceTo(Q)*0.5,K=-this.direction.dot(S6),H=h7.dot(this.direction),X=-h7.dot(S6),Y=h7.lengthSq(),U=Math.abs(1-K*K),G,q,N,R;if(U>0)if(G=K*X-H,q=K*H-X,R=W*U,G>=0)if(q>=-R)if(q<=R){let M=1/U;G*=M,q*=M,N=G*(G+K*q+2*H)+q*(K*G+q+2*X)+Y}else q=W,G=Math.max(0,-(K*q+H)),N=-G*G+q*(q+2*X)+Y;else q=-W,G=Math.max(0,-(K*q+H)),N=-G*G+q*(q+2*X)+Y;else if(q<=-R)G=Math.max(0,-(-K*W+H)),q=G>0?-W:Math.min(Math.max(-W,-X),W),N=-G*G+q*(q+2*X)+Y;else if(q<=R)G=0,q=Math.min(Math.max(-W,-X),W),N=q*(q+2*X)+Y;else G=Math.max(0,-(K*W+H)),q=G>0?W:Math.min(Math.max(-W,-X),W),N=-G*G+q*(q+2*X)+Y;else q=K>0?-W:W,G=Math.max(0,-(K*q+H)),N=-G*G+q*(q+2*X)+Y;if($)$.copy(this.origin).addScaledVector(this.direction,G);if(Z)Z.copy(iK).addScaledVector(S6,q);return N}intersectSphere(J,Q){U7.subVectors(J.center,this.origin);let $=U7.dot(this.direction),Z=U7.dot(U7)-$*$,W=J.radius*J.radius;if(Z>W)return null;let K=Math.sqrt(W-Z),H=$-K,X=$+K;if(X<0)return null;if(H<0)return this.at(X,Q);return this.at(H,Q)}intersectsSphere(J){if(J.radius<0)return!1;return this.distanceSqToPoint(J.center)<=J.radius*J.radius}distanceToPlane(J){let Q=J.normal.dot(this.direction);if(Q===0){if(J.distanceToPoint(this.origin)===0)return 0;return null}let $=-(this.origin.dot(J.normal)+J.constant)/Q;return $>=0?$:null}intersectPlane(J,Q){let $=this.distanceToPlane(J);if($===null)return null;return this.at($,Q)}intersectsPlane(J){let Q=J.distanceToPoint(this.origin);if(Q===0)return!0;if(J.normal.dot(this.direction)*Q<0)return!0;return!1}intersectBox(J,Q){let $,Z,W,K,H,X,Y=1/this.direction.x,U=1/this.direction.y,G=1/this.direction.z,q=this.origin;if(Y>=0)$=(J.min.x-q.x)*Y,Z=(J.max.x-q.x)*Y;else $=(J.max.x-q.x)*Y,Z=(J.min.x-q.x)*Y;if(U>=0)W=(J.min.y-q.y)*U,K=(J.max.y-q.y)*U;else W=(J.max.y-q.y)*U,K=(J.min.y-q.y)*U;if($>K||W>Z)return null;if(W>$||isNaN($))$=W;if(K=0)H=(J.min.z-q.z)*G,X=(J.max.z-q.z)*G;else H=(J.max.z-q.z)*G,X=(J.min.z-q.z)*G;if($>X||H>Z)return null;if(H>$||$!==$)$=H;if(X=0?$:Z,Q)}intersectsBox(J){return this.intersectBox(J,U7)!==null}intersectTriangle(J,Q,$,Z,W){aK.subVectors(Q,J),T6.subVectors($,J),rK.crossVectors(aK,T6);let K=this.direction.dot(rK),H;if(K>0){if(Z)return null;H=1}else if(K<0)H=-1,K=-K;else return null;h7.subVectors(this.origin,J);let X=H*this.direction.dot(T6.crossVectors(h7,T6));if(X<0)return null;let Y=H*this.direction.dot(aK.cross(h7));if(Y<0)return null;if(X+Y>K)return null;let U=-H*h7.dot(rK);if(U<0)return null;return this.at(U/K,W)}applyMatrix4(J){return this.origin.applyMatrix4(J),this.direction.transformDirection(J),this}equals(J){return J.origin.equals(this.origin)&&J.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class r0{constructor(J,Q,$,Z,W,K,H,X,Y,U,G,q,N,R,M,E){if(r0.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],J!==void 0)this.set(J,Q,$,Z,W,K,H,X,Y,U,G,q,N,R,M,E)}set(J,Q,$,Z,W,K,H,X,Y,U,G,q,N,R,M,E){let F=this.elements;return F[0]=J,F[4]=Q,F[8]=$,F[12]=Z,F[1]=W,F[5]=K,F[9]=H,F[13]=X,F[2]=Y,F[6]=U,F[10]=G,F[14]=q,F[3]=N,F[7]=R,F[11]=M,F[15]=E,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 r0().fromArray(this.elements)}copy(J){let Q=this.elements,$=J.elements;return Q[0]=$[0],Q[1]=$[1],Q[2]=$[2],Q[3]=$[3],Q[4]=$[4],Q[5]=$[5],Q[6]=$[6],Q[7]=$[7],Q[8]=$[8],Q[9]=$[9],Q[10]=$[10],Q[11]=$[11],Q[12]=$[12],Q[13]=$[13],Q[14]=$[14],Q[15]=$[15],this}copyPosition(J){let Q=this.elements,$=J.elements;return Q[12]=$[12],Q[13]=$[13],Q[14]=$[14],this}setFromMatrix3(J){let Q=J.elements;return this.set(Q[0],Q[3],Q[6],0,Q[1],Q[4],Q[7],0,Q[2],Q[5],Q[8],0,0,0,0,1),this}extractBasis(J,Q,$){if(this.determinant()===0)return J.set(1,0,0),Q.set(0,1,0),$.set(0,0,1),this;return J.setFromMatrixColumn(this,0),Q.setFromMatrixColumn(this,1),$.setFromMatrixColumn(this,2),this}makeBasis(J,Q,$){return this.set(J.x,Q.x,$.x,0,J.y,Q.y,$.y,0,J.z,Q.z,$.z,0,0,0,0,1),this}extractRotation(J){if(J.determinant()===0)return this.identity();let Q=this.elements,$=J.elements,Z=1/W$.setFromMatrixColumn(J,0).length(),W=1/W$.setFromMatrixColumn(J,1).length(),K=1/W$.setFromMatrixColumn(J,2).length();return Q[0]=$[0]*Z,Q[1]=$[1]*Z,Q[2]=$[2]*Z,Q[3]=0,Q[4]=$[4]*W,Q[5]=$[5]*W,Q[6]=$[6]*W,Q[7]=0,Q[8]=$[8]*K,Q[9]=$[9]*K,Q[10]=$[10]*K,Q[11]=0,Q[12]=0,Q[13]=0,Q[14]=0,Q[15]=1,this}makeRotationFromEuler(J){let Q=this.elements,$=J.x,Z=J.y,W=J.z,K=Math.cos($),H=Math.sin($),X=Math.cos(Z),Y=Math.sin(Z),U=Math.cos(W),G=Math.sin(W);if(J.order==="XYZ"){let q=K*U,N=K*G,R=H*U,M=H*G;Q[0]=X*U,Q[4]=-X*G,Q[8]=Y,Q[1]=N+R*Y,Q[5]=q-M*Y,Q[9]=-H*X,Q[2]=M-q*Y,Q[6]=R+N*Y,Q[10]=K*X}else if(J.order==="YXZ"){let q=X*U,N=X*G,R=Y*U,M=Y*G;Q[0]=q+M*H,Q[4]=R*H-N,Q[8]=K*Y,Q[1]=K*G,Q[5]=K*U,Q[9]=-H,Q[2]=N*H-R,Q[6]=M+q*H,Q[10]=K*X}else if(J.order==="ZXY"){let q=X*U,N=X*G,R=Y*U,M=Y*G;Q[0]=q-M*H,Q[4]=-K*G,Q[8]=R+N*H,Q[1]=N+R*H,Q[5]=K*U,Q[9]=M-q*H,Q[2]=-K*Y,Q[6]=H,Q[10]=K*X}else if(J.order==="ZYX"){let q=K*U,N=K*G,R=H*U,M=H*G;Q[0]=X*U,Q[4]=R*Y-N,Q[8]=q*Y+M,Q[1]=X*G,Q[5]=M*Y+q,Q[9]=N*Y-R,Q[2]=-Y,Q[6]=H*X,Q[10]=K*X}else if(J.order==="YZX"){let q=K*X,N=K*Y,R=H*X,M=H*Y;Q[0]=X*U,Q[4]=M-q*G,Q[8]=R*G+N,Q[1]=G,Q[5]=K*U,Q[9]=-H*U,Q[2]=-Y*U,Q[6]=N*G+R,Q[10]=q-M*G}else if(J.order==="XZY"){let q=K*X,N=K*Y,R=H*X,M=H*Y;Q[0]=X*U,Q[4]=-G,Q[8]=Y*U,Q[1]=q*G+M,Q[5]=K*U,Q[9]=N*G-R,Q[2]=R*G-N,Q[6]=H*U,Q[10]=M*G+q}return Q[3]=0,Q[7]=0,Q[11]=0,Q[12]=0,Q[13]=0,Q[14]=0,Q[15]=1,this}makeRotationFromQuaternion(J){return this.compose(wF,J,SF)}lookAt(J,Q,$){let Z=this.elements;if(X8.subVectors(J,Q),X8.lengthSq()===0)X8.z=1;if(X8.normalize(),f7.crossVectors($,X8),f7.lengthSq()===0){if(Math.abs($.z)===1)X8.x+=0.0001;else X8.z+=0.0001;X8.normalize(),f7.crossVectors($,X8)}return f7.normalize(),j6.crossVectors(X8,f7),Z[0]=f7.x,Z[4]=j6.x,Z[8]=X8.x,Z[1]=f7.y,Z[5]=j6.y,Z[9]=X8.y,Z[2]=f7.z,Z[6]=j6.z,Z[10]=X8.z,this}multiply(J){return this.multiplyMatrices(this,J)}premultiply(J){return this.multiplyMatrices(J,this)}multiplyMatrices(J,Q){let $=J.elements,Z=Q.elements,W=this.elements,K=$[0],H=$[4],X=$[8],Y=$[12],U=$[1],G=$[5],q=$[9],N=$[13],R=$[2],M=$[6],E=$[10],F=$[14],O=$[3],k=$[7],D=$[11],B=$[15],A=Z[0],C=Z[4],w=Z[8],T=Z[12],z=Z[1],V=Z[5],_=Z[9],b=Z[13],p=Z[2],v=Z[6],s=Z[10],m=Z[14],h=Z[3],c=Z[7],t=Z[11],j=Z[15];return W[0]=K*A+H*z+X*p+Y*h,W[4]=K*C+H*V+X*v+Y*c,W[8]=K*w+H*_+X*s+Y*t,W[12]=K*T+H*b+X*m+Y*j,W[1]=U*A+G*z+q*p+N*h,W[5]=U*C+G*V+q*v+N*c,W[9]=U*w+G*_+q*s+N*t,W[13]=U*T+G*b+q*m+N*j,W[2]=R*A+M*z+E*p+F*h,W[6]=R*C+M*V+E*v+F*c,W[10]=R*w+M*_+E*s+F*t,W[14]=R*T+M*b+E*m+F*j,W[3]=O*A+k*z+D*p+B*h,W[7]=O*C+k*V+D*v+B*c,W[11]=O*w+k*_+D*s+B*t,W[15]=O*T+k*b+D*m+B*j,this}multiplyScalar(J){let Q=this.elements;return Q[0]*=J,Q[4]*=J,Q[8]*=J,Q[12]*=J,Q[1]*=J,Q[5]*=J,Q[9]*=J,Q[13]*=J,Q[2]*=J,Q[6]*=J,Q[10]*=J,Q[14]*=J,Q[3]*=J,Q[7]*=J,Q[11]*=J,Q[15]*=J,this}determinant(){let J=this.elements,Q=J[0],$=J[4],Z=J[8],W=J[12],K=J[1],H=J[5],X=J[9],Y=J[13],U=J[2],G=J[6],q=J[10],N=J[14],R=J[3],M=J[7],E=J[11],F=J[15],O=X*N-Y*q,k=H*N-Y*G,D=H*q-X*G,B=K*N-Y*U,A=K*q-X*U,C=K*G-H*U;return Q*(M*O-E*k+F*D)-$*(R*O-E*B+F*A)+Z*(R*k-M*B+F*C)-W*(R*D-M*A+E*C)}transpose(){let J=this.elements,Q;return Q=J[1],J[1]=J[4],J[4]=Q,Q=J[2],J[2]=J[8],J[8]=Q,Q=J[6],J[6]=J[9],J[9]=Q,Q=J[3],J[3]=J[12],J[12]=Q,Q=J[7],J[7]=J[13],J[13]=Q,Q=J[11],J[11]=J[14],J[14]=Q,this}setPosition(J,Q,$){let Z=this.elements;if(J.isVector3)Z[12]=J.x,Z[13]=J.y,Z[14]=J.z;else Z[12]=J,Z[13]=Q,Z[14]=$;return this}invert(){let J=this.elements,Q=J[0],$=J[1],Z=J[2],W=J[3],K=J[4],H=J[5],X=J[6],Y=J[7],U=J[8],G=J[9],q=J[10],N=J[11],R=J[12],M=J[13],E=J[14],F=J[15],O=G*E*Y-M*q*Y+M*X*N-H*E*N-G*X*F+H*q*F,k=R*q*Y-U*E*Y-R*X*N+K*E*N+U*X*F-K*q*F,D=U*M*Y-R*G*Y+R*H*N-K*M*N-U*H*F+K*G*F,B=R*G*X-U*M*X-R*H*q+K*M*q+U*H*E-K*G*E,A=Q*O+$*k+Z*D+W*B;if(A===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let C=1/A;return J[0]=O*C,J[1]=(M*q*W-G*E*W-M*Z*N+$*E*N+G*Z*F-$*q*F)*C,J[2]=(H*E*W-M*X*W+M*Z*Y-$*E*Y-H*Z*F+$*X*F)*C,J[3]=(G*X*W-H*q*W-G*Z*Y+$*q*Y+H*Z*N-$*X*N)*C,J[4]=k*C,J[5]=(U*E*W-R*q*W+R*Z*N-Q*E*N-U*Z*F+Q*q*F)*C,J[6]=(R*X*W-K*E*W-R*Z*Y+Q*E*Y+K*Z*F-Q*X*F)*C,J[7]=(K*q*W-U*X*W+U*Z*Y-Q*q*Y-K*Z*N+Q*X*N)*C,J[8]=D*C,J[9]=(R*G*W-U*M*W-R*$*N+Q*M*N+U*$*F-Q*G*F)*C,J[10]=(K*M*W-R*H*W+R*$*Y-Q*M*Y-K*$*F+Q*H*F)*C,J[11]=(U*H*W-K*G*W-U*$*Y+Q*G*Y+K*$*N-Q*H*N)*C,J[12]=B*C,J[13]=(U*M*Z-R*G*Z+R*$*q-Q*M*q-U*$*E+Q*G*E)*C,J[14]=(R*H*Z-K*M*Z-R*$*X+Q*M*X+K*$*E-Q*H*E)*C,J[15]=(K*G*Z-U*H*Z+U*$*X-Q*G*X-K*$*q+Q*H*q)*C,this}scale(J){let Q=this.elements,$=J.x,Z=J.y,W=J.z;return Q[0]*=$,Q[4]*=Z,Q[8]*=W,Q[1]*=$,Q[5]*=Z,Q[9]*=W,Q[2]*=$,Q[6]*=Z,Q[10]*=W,Q[3]*=$,Q[7]*=Z,Q[11]*=W,this}getMaxScaleOnAxis(){let J=this.elements,Q=J[0]*J[0]+J[1]*J[1]+J[2]*J[2],$=J[4]*J[4]+J[5]*J[5]+J[6]*J[6],Z=J[8]*J[8]+J[9]*J[9]+J[10]*J[10];return Math.sqrt(Math.max(Q,$,Z))}makeTranslation(J,Q,$){if(J.isVector3)this.set(1,0,0,J.x,0,1,0,J.y,0,0,1,J.z,0,0,0,1);else this.set(1,0,0,J,0,1,0,Q,0,0,1,$,0,0,0,1);return this}makeRotationX(J){let Q=Math.cos(J),$=Math.sin(J);return this.set(1,0,0,0,0,Q,-$,0,0,$,Q,0,0,0,0,1),this}makeRotationY(J){let Q=Math.cos(J),$=Math.sin(J);return this.set(Q,0,$,0,0,1,0,0,-$,0,Q,0,0,0,0,1),this}makeRotationZ(J){let Q=Math.cos(J),$=Math.sin(J);return this.set(Q,-$,0,0,$,Q,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(J,Q){let $=Math.cos(Q),Z=Math.sin(Q),W=1-$,K=J.x,H=J.y,X=J.z,Y=W*K,U=W*H;return this.set(Y*K+$,Y*H-Z*X,Y*X+Z*H,0,Y*H+Z*X,U*H+$,U*X-Z*K,0,Y*X-Z*H,U*X+Z*K,W*X*X+$,0,0,0,0,1),this}makeScale(J,Q,$){return this.set(J,0,0,0,0,Q,0,0,0,0,$,0,0,0,0,1),this}makeShear(J,Q,$,Z,W,K){return this.set(1,$,W,0,J,1,K,0,Q,Z,1,0,0,0,0,1),this}compose(J,Q,$){let Z=this.elements,W=Q._x,K=Q._y,H=Q._z,X=Q._w,Y=W+W,U=K+K,G=H+H,q=W*Y,N=W*U,R=W*G,M=K*U,E=K*G,F=H*G,O=X*Y,k=X*U,D=X*G,B=$.x,A=$.y,C=$.z;return Z[0]=(1-(M+F))*B,Z[1]=(N+D)*B,Z[2]=(R-k)*B,Z[3]=0,Z[4]=(N-D)*A,Z[5]=(1-(q+F))*A,Z[6]=(E+O)*A,Z[7]=0,Z[8]=(R+k)*C,Z[9]=(E-O)*C,Z[10]=(1-(q+M))*C,Z[11]=0,Z[12]=J.x,Z[13]=J.y,Z[14]=J.z,Z[15]=1,this}decompose(J,Q,$){let Z=this.elements;if(J.x=Z[12],J.y=Z[13],J.z=Z[14],this.determinant()===0)return $.set(1,1,1),Q.identity(),this;let W=W$.set(Z[0],Z[1],Z[2]).length(),K=W$.set(Z[4],Z[5],Z[6]).length(),H=W$.set(Z[8],Z[9],Z[10]).length();if(this.determinant()<0)W=-W;b8.copy(this);let Y=1/W,U=1/K,G=1/H;return b8.elements[0]*=Y,b8.elements[1]*=Y,b8.elements[2]*=Y,b8.elements[4]*=U,b8.elements[5]*=U,b8.elements[6]*=U,b8.elements[8]*=G,b8.elements[9]*=G,b8.elements[10]*=G,Q.setFromRotationMatrix(b8),$.x=W,$.y=K,$.z=H,this}makePerspective(J,Q,$,Z,W,K,H=2000,X=!1){let Y=this.elements,U=2*W/(Q-J),G=2*W/($-Z),q=(Q+J)/(Q-J),N=($+Z)/($-Z),R,M;if(X)R=W/(K-W),M=K*W/(K-W);else if(H===2000)R=-(K+W)/(K-W),M=-2*K*W/(K-W);else if(H===2001)R=-K/(K-W),M=-K*W/(K-W);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+H);return Y[0]=U,Y[4]=0,Y[8]=q,Y[12]=0,Y[1]=0,Y[5]=G,Y[9]=N,Y[13]=0,Y[2]=0,Y[6]=0,Y[10]=R,Y[14]=M,Y[3]=0,Y[7]=0,Y[11]=-1,Y[15]=0,this}makeOrthographic(J,Q,$,Z,W,K,H=2000,X=!1){let Y=this.elements,U=2/(Q-J),G=2/($-Z),q=-(Q+J)/(Q-J),N=-($+Z)/($-Z),R,M;if(X)R=1/(K-W),M=K/(K-W);else if(H===2000)R=-2/(K-W),M=-(K+W)/(K-W);else if(H===2001)R=-1/(K-W),M=-W/(K-W);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+H);return Y[0]=U,Y[4]=0,Y[8]=0,Y[12]=q,Y[1]=0,Y[5]=G,Y[9]=0,Y[13]=N,Y[2]=0,Y[6]=0,Y[10]=R,Y[14]=M,Y[3]=0,Y[7]=0,Y[11]=0,Y[15]=1,this}equals(J){let Q=this.elements,$=J.elements;for(let Z=0;Z<16;Z++)if(Q[Z]!==$[Z])return!1;return!0}fromArray(J,Q=0){for(let $=0;$<16;$++)this.elements[$]=J[$+Q];return this}toArray(J=[],Q=0){let $=this.elements;return J[Q]=$[0],J[Q+1]=$[1],J[Q+2]=$[2],J[Q+3]=$[3],J[Q+4]=$[4],J[Q+5]=$[5],J[Q+6]=$[6],J[Q+7]=$[7],J[Q+8]=$[8],J[Q+9]=$[9],J[Q+10]=$[10],J[Q+11]=$[11],J[Q+12]=$[12],J[Q+13]=$[13],J[Q+14]=$[14],J[Q+15]=$[15],J}}var W$=new f,b8=new r0,wF=new f(0,0,0),SF=new f(1,1,1),f7=new f,j6=new f,X8=new f,K1=new r0,H1=new iJ;class g8{constructor(J=0,Q=0,$=0,Z=g8.DEFAULT_ORDER){this.isEuler=!0,this._x=J,this._y=Q,this._z=$,this._order=Z}get x(){return this._x}set x(J){this._x=J,this._onChangeCallback()}get y(){return this._y}set y(J){this._y=J,this._onChangeCallback()}get z(){return this._z}set z(J){this._z=J,this._onChangeCallback()}get order(){return this._order}set order(J){this._order=J,this._onChangeCallback()}set(J,Q,$,Z=this._order){return this._x=J,this._y=Q,this._z=$,this._order=Z,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(J){return this._x=J._x,this._y=J._y,this._z=J._z,this._order=J._order,this._onChangeCallback(),this}setFromRotationMatrix(J,Q=this._order,$=!0){let Z=J.elements,W=Z[0],K=Z[4],H=Z[8],X=Z[1],Y=Z[5],U=Z[9],G=Z[2],q=Z[6],N=Z[10];switch(Q){case"XYZ":if(this._y=Math.asin(Q9(H,-1,1)),Math.abs(H)<0.9999999)this._x=Math.atan2(-U,N),this._z=Math.atan2(-K,W);else this._x=Math.atan2(q,Y),this._z=0;break;case"YXZ":if(this._x=Math.asin(-Q9(U,-1,1)),Math.abs(U)<0.9999999)this._y=Math.atan2(H,N),this._z=Math.atan2(X,Y);else this._y=Math.atan2(-G,W),this._z=0;break;case"ZXY":if(this._x=Math.asin(Q9(q,-1,1)),Math.abs(q)<0.9999999)this._y=Math.atan2(-G,N),this._z=Math.atan2(-K,Y);else this._y=0,this._z=Math.atan2(X,W);break;case"ZYX":if(this._y=Math.asin(-Q9(G,-1,1)),Math.abs(G)<0.9999999)this._x=Math.atan2(q,N),this._z=Math.atan2(X,W);else this._x=0,this._z=Math.atan2(-K,Y);break;case"YZX":if(this._z=Math.asin(Q9(X,-1,1)),Math.abs(X)<0.9999999)this._x=Math.atan2(-U,Y),this._y=Math.atan2(-G,W);else this._x=0,this._y=Math.atan2(H,N);break;case"XZY":if(this._z=Math.asin(-Q9(K,-1,1)),Math.abs(K)<0.9999999)this._x=Math.atan2(q,Y),this._y=Math.atan2(H,W);else this._x=Math.atan2(-U,N),this._y=0;break;default:j0("Euler: .setFromRotationMatrix() encountered an unknown order: "+Q)}if(this._order=Q,$===!0)this._onChangeCallback();return this}setFromQuaternion(J,Q,$){return K1.makeRotationFromQuaternion(J),this.setFromRotationMatrix(K1,Q,$)}setFromVector3(J,Q=this._order){return this.set(J.x,J.y,J.z,Q)}reorder(J){return H1.setFromEuler(this),this.setFromQuaternion(H1,J)}equals(J){return J._x===this._x&&J._y===this._y&&J._z===this._z&&J._order===this._order}fromArray(J){if(this._x=J[0],this._y=J[1],this._z=J[2],J[3]!==void 0)this._order=J[3];return this._onChangeCallback(),this}toArray(J=[],Q=0){return J[Q]=this._x,J[Q+1]=this._y,J[Q+2]=this._z,J[Q+3]=this._order,J}_onChange(J){return this._onChangeCallback=J,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}g8.DEFAULT_ORDER="XYZ";class MW{constructor(){this.mask=1}set(J){this.mask=(1<>>0}enable(J){this.mask|=1<1){for(let Q=0;Q1){for(let $=0;$0)Z.userData=this.userData;if(Z.layers=this.layers.mask,Z.matrix=this.matrix.toArray(),Z.up=this.up.toArray(),this.matrixAutoUpdate===!1)Z.matrixAutoUpdate=!1;if(this.isInstancedMesh){if(Z.type="InstancedMesh",Z.count=this.count,Z.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null)Z.instanceColor=this.instanceColor.toJSON()}if(this.isBatchedMesh){if(Z.type="BatchedMesh",Z.perObjectFrustumCulled=this.perObjectFrustumCulled,Z.sortObjects=this.sortObjects,Z.drawRanges=this._drawRanges,Z.reservedRanges=this._reservedRanges,Z.geometryInfo=this._geometryInfo.map((H)=>({...H,boundingBox:H.boundingBox?H.boundingBox.toJSON():void 0,boundingSphere:H.boundingSphere?H.boundingSphere.toJSON():void 0})),Z.instanceInfo=this._instanceInfo.map((H)=>({...H})),Z.availableInstanceIds=this._availableInstanceIds.slice(),Z.availableGeometryIds=this._availableGeometryIds.slice(),Z.nextIndexStart=this._nextIndexStart,Z.nextVertexStart=this._nextVertexStart,Z.geometryCount=this._geometryCount,Z.maxInstanceCount=this._maxInstanceCount,Z.maxVertexCount=this._maxVertexCount,Z.maxIndexCount=this._maxIndexCount,Z.geometryInitialized=this._geometryInitialized,Z.matricesTexture=this._matricesTexture.toJSON(J),Z.indirectTexture=this._indirectTexture.toJSON(J),this._colorsTexture!==null)Z.colorsTexture=this._colorsTexture.toJSON(J);if(this.boundingSphere!==null)Z.boundingSphere=this.boundingSphere.toJSON();if(this.boundingBox!==null)Z.boundingBox=this.boundingBox.toJSON()}function W(H,X){if(H[X.uuid]===void 0)H[X.uuid]=X.toJSON(J);return X.uuid}if(this.isScene){if(this.background){if(this.background.isColor)Z.background=this.background.toJSON();else if(this.background.isTexture)Z.background=this.background.toJSON(J).uuid}if(this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0)Z.environment=this.environment.toJSON(J).uuid}else if(this.isMesh||this.isLine||this.isPoints){Z.geometry=W(J.geometries,this.geometry);let H=this.geometry.parameters;if(H!==void 0&&H.shapes!==void 0){let X=H.shapes;if(Array.isArray(X))for(let Y=0,U=X.length;Y0){Z.children=[];for(let H=0;H0){Z.animations=[];for(let H=0;H0)$.geometries=H;if(X.length>0)$.materials=X;if(Y.length>0)$.textures=Y;if(U.length>0)$.images=U;if(G.length>0)$.shapes=G;if(q.length>0)$.skeletons=q;if(N.length>0)$.animations=N;if(R.length>0)$.nodes=R}return $.object=Z,$;function K(H){let X=[];for(let Y in H){let U=H[Y];delete U.metadata,X.push(U)}return X}}clone(J){return new this.constructor().copy(this,J)}copy(J,Q=!0){if(this.name=J.name,this.up.copy(J.up),this.position.copy(J.position),this.rotation.order=J.rotation.order,this.quaternion.copy(J.quaternion),this.scale.copy(J.scale),this.matrix.copy(J.matrix),this.matrixWorld.copy(J.matrixWorld),this.matrixAutoUpdate=J.matrixAutoUpdate,this.matrixWorldAutoUpdate=J.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=J.matrixWorldNeedsUpdate,this.layers.mask=J.layers.mask,this.visible=J.visible,this.castShadow=J.castShadow,this.receiveShadow=J.receiveShadow,this.frustumCulled=J.frustumCulled,this.renderOrder=J.renderOrder,this.animations=J.animations.slice(),this.userData=JSON.parse(JSON.stringify(J.userData)),Q===!0)for(let $=0;$0)return Z.multiplyScalar(1/Math.sqrt(W));return Z.set(0,0,0)}static getBarycoord(J,Q,$,Z,W){y8.subVectors(Z,Q),q7.subVectors($,Q),eK.subVectors(J,Q);let K=y8.dot(y8),H=y8.dot(q7),X=y8.dot(eK),Y=q7.dot(q7),U=q7.dot(eK),G=K*Y-H*H;if(G===0)return W.set(0,0,0),null;let q=1/G,N=(Y*X-H*U)*q,R=(K*U-H*X)*q;return W.set(1-N-R,R,N)}static containsPoint(J,Q,$,Z){if(this.getBarycoord(J,Q,$,Z,N7)===null)return!1;return N7.x>=0&&N7.y>=0&&N7.x+N7.y<=1}static getInterpolation(J,Q,$,Z,W,K,H,X){if(this.getBarycoord(J,Q,$,Z,N7)===null){if(X.x=0,X.y=0,"z"in X)X.z=0;if("w"in X)X.w=0;return null}return X.setScalar(0),X.addScaledVector(W,N7.x),X.addScaledVector(K,N7.y),X.addScaledVector(H,N7.z),X}static getInterpolatedAttribute(J,Q,$,Z,W,K){return ZH.setScalar(0),WH.setScalar(0),KH.setScalar(0),ZH.fromBufferAttribute(J,Q),WH.fromBufferAttribute(J,$),KH.fromBufferAttribute(J,Z),K.setScalar(0),K.addScaledVector(ZH,W.x),K.addScaledVector(WH,W.y),K.addScaledVector(KH,W.z),K}static isFrontFacing(J,Q,$,Z){return y8.subVectors($,Q),q7.subVectors(J,Q),y8.cross(q7).dot(Z)<0?!0:!1}set(J,Q,$){return this.a.copy(J),this.b.copy(Q),this.c.copy($),this}setFromPointsAndIndices(J,Q,$,Z){return this.a.copy(J[Q]),this.b.copy(J[$]),this.c.copy(J[Z]),this}setFromAttributeAndIndices(J,Q,$,Z){return this.a.fromBufferAttribute(J,Q),this.b.fromBufferAttribute(J,$),this.c.fromBufferAttribute(J,Z),this}clone(){return new this.constructor().copy(this)}copy(J){return this.a.copy(J.a),this.b.copy(J.b),this.c.copy(J.c),this}getArea(){return y8.subVectors(this.c,this.b),q7.subVectors(this.a,this.b),y8.cross(q7).length()*0.5}getMidpoint(J){return J.addVectors(this.a,this.b).add(this.c).multiplyScalar(0.3333333333333333)}getNormal(J){return k8.getNormal(this.a,this.b,this.c,J)}getPlane(J){return J.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(J,Q){return k8.getBarycoord(J,this.a,this.b,this.c,Q)}getInterpolation(J,Q,$,Z,W){return k8.getInterpolation(J,this.a,this.b,this.c,Q,$,Z,W)}containsPoint(J){return k8.containsPoint(J,this.a,this.b,this.c)}isFrontFacing(J){return k8.isFrontFacing(this.a,this.b,this.c,J)}intersectsBox(J){return J.intersectsTriangle(this)}closestPointToPoint(J,Q){let $=this.a,Z=this.b,W=this.c,K,H;X$.subVectors(Z,$),Y$.subVectors(W,$),JH.subVectors(J,$);let X=X$.dot(JH),Y=Y$.dot(JH);if(X<=0&&Y<=0)return Q.copy($);QH.subVectors(J,Z);let U=X$.dot(QH),G=Y$.dot(QH);if(U>=0&&G<=U)return Q.copy(Z);let q=X*G-U*Y;if(q<=0&&X>=0&&U<=0)return K=X/(X-U),Q.copy($).addScaledVector(X$,K);$H.subVectors(J,W);let N=X$.dot($H),R=Y$.dot($H);if(R>=0&&N<=R)return Q.copy(W);let M=N*Y-X*R;if(M<=0&&Y>=0&&R<=0)return H=Y/(Y-R),Q.copy($).addScaledVector(Y$,H);let E=U*R-N*G;if(E<=0&&G-U>=0&&N-R>=0)return N1.subVectors(W,Z),H=(G-U)/(G-U+(N-R)),Q.copy(Z).addScaledVector(N1,H);let F=1/(E+M+q);return K=M*F,H=q*F,Q.copy($).addScaledVector(X$,K).addScaledVector(Y$,H)}equals(J){return J.a.equals(this.a)&&J.b.equals(this.b)&&J.c.equals(this.c)}}var IG={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},v7={h:0,s:0,l:0},x6={h:0,s:0,l:0};function HH(J,Q,$){if($<0)$+=1;if($>1)$-=1;if($<0.16666666666666666)return J+(Q-J)*6*$;if($<0.5)return Q;if($<0.6666666666666666)return J+(Q-J)*6*(0.6666666666666666-$);return J}class l0{constructor(J,Q,$){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(J,Q,$)}set(J,Q,$){if(Q===void 0&&$===void 0){let Z=J;if(Z&&Z.isColor)this.copy(Z);else if(typeof Z==="number")this.setHex(Z);else if(typeof Z==="string")this.setStyle(Z)}else this.setRGB(J,Q,$);return this}setScalar(J){return this.r=J,this.g=J,this.b=J,this}setHex(J,Q="srgb"){return J=Math.floor(J),this.r=(J>>16&255)/255,this.g=(J>>8&255)/255,this.b=(J&255)/255,X9.colorSpaceToWorking(this,Q),this}setRGB(J,Q,$,Z=X9.workingColorSpace){return this.r=J,this.g=Q,this.b=$,X9.colorSpaceToWorking(this,Z),this}setHSL(J,Q,$,Z=X9.workingColorSpace){if(J=MX(J,1),Q=Q9(Q,0,1),$=Q9($,0,1),Q===0)this.r=this.g=this.b=$;else{let W=$<=0.5?$*(1+Q):$+Q-$*Q,K=2*$-W;this.r=HH(K,W,J+0.3333333333333333),this.g=HH(K,W,J),this.b=HH(K,W,J-0.3333333333333333)}return X9.colorSpaceToWorking(this,Z),this}setStyle(J,Q="srgb"){function $(W){if(W===void 0)return;if(parseFloat(W)<1)j0("Color: Alpha component of "+J+" will be ignored.")}let Z;if(Z=/^(\w+)\(([^\)]*)\)/.exec(J)){let W,K=Z[1],H=Z[2];switch(K){case"rgb":case"rgba":if(W=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(H))return $(W[4]),this.setRGB(Math.min(255,parseInt(W[1],10))/255,Math.min(255,parseInt(W[2],10))/255,Math.min(255,parseInt(W[3],10))/255,Q);if(W=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(H))return $(W[4]),this.setRGB(Math.min(100,parseInt(W[1],10))/100,Math.min(100,parseInt(W[2],10))/100,Math.min(100,parseInt(W[3],10))/100,Q);break;case"hsl":case"hsla":if(W=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(H))return $(W[4]),this.setHSL(parseFloat(W[1])/360,parseFloat(W[2])/100,parseFloat(W[3])/100,Q);break;default:j0("Color: Unknown color model "+J)}}else if(Z=/^\#([A-Fa-f\d]+)$/.exec(J)){let W=Z[1],K=W.length;if(K===3)return this.setRGB(parseInt(W.charAt(0),16)/15,parseInt(W.charAt(1),16)/15,parseInt(W.charAt(2),16)/15,Q);else if(K===6)return this.setHex(parseInt(W,16),Q);else j0("Color: Invalid hex color "+J)}else if(J&&J.length>0)return this.setColorName(J,Q);return this}setColorName(J,Q="srgb"){let $=IG[J.toLowerCase()];if($!==void 0)this.setHex($,Q);else j0("Color: Unknown color "+J);return this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(J){return this.r=J.r,this.g=J.g,this.b=J.b,this}copySRGBToLinear(J){return this.r=F7(J.r),this.g=F7(J.g),this.b=F7(J.b),this}copyLinearToSRGB(J){return this.r=F$(J.r),this.g=F$(J.g),this.b=F$(J.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(J="srgb"){return X9.workingToColorSpace(IJ.copy(this),J),Math.round(Q9(IJ.r*255,0,255))*65536+Math.round(Q9(IJ.g*255,0,255))*256+Math.round(Q9(IJ.b*255,0,255))}getHexString(J="srgb"){return("000000"+this.getHex(J).toString(16)).slice(-6)}getHSL(J,Q=X9.workingColorSpace){X9.workingToColorSpace(IJ.copy(this),Q);let{r:$,g:Z,b:W}=IJ,K=Math.max($,Z,W),H=Math.min($,Z,W),X,Y,U=(H+K)/2;if(H===K)X=0,Y=0;else{let G=K-H;switch(Y=U<=0.5?G/(K+H):G/(2-K-H),K){case $:X=(Z-W)/G+(Z0!==J>0)this.version++;this._alphaTest=J}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(J){if(J===void 0)return;for(let Q in J){let $=J[Q];if($===void 0){j0(`Material: parameter '${Q}' has value of undefined.`);continue}let Z=this[Q];if(Z===void 0){j0(`Material: '${Q}' is not a property of THREE.${this.type}.`);continue}if(Z&&Z.isColor)Z.set($);else if(Z&&Z.isVector3&&($&&$.isVector3))Z.copy($);else this[Q]=$}}toJSON(J){let Q=J===void 0||typeof J==="string";if(Q)J={textures:{},images:{}};let $={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};if($.uuid=this.uuid,$.type=this.type,this.name!=="")$.name=this.name;if(this.color&&this.color.isColor)$.color=this.color.getHex();if(this.roughness!==void 0)$.roughness=this.roughness;if(this.metalness!==void 0)$.metalness=this.metalness;if(this.sheen!==void 0)$.sheen=this.sheen;if(this.sheenColor&&this.sheenColor.isColor)$.sheenColor=this.sheenColor.getHex();if(this.sheenRoughness!==void 0)$.sheenRoughness=this.sheenRoughness;if(this.emissive&&this.emissive.isColor)$.emissive=this.emissive.getHex();if(this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1)$.emissiveIntensity=this.emissiveIntensity;if(this.specular&&this.specular.isColor)$.specular=this.specular.getHex();if(this.specularIntensity!==void 0)$.specularIntensity=this.specularIntensity;if(this.specularColor&&this.specularColor.isColor)$.specularColor=this.specularColor.getHex();if(this.shininess!==void 0)$.shininess=this.shininess;if(this.clearcoat!==void 0)$.clearcoat=this.clearcoat;if(this.clearcoatRoughness!==void 0)$.clearcoatRoughness=this.clearcoatRoughness;if(this.clearcoatMap&&this.clearcoatMap.isTexture)$.clearcoatMap=this.clearcoatMap.toJSON(J).uuid;if(this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture)$.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(J).uuid;if(this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture)$.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(J).uuid,$.clearcoatNormalScale=this.clearcoatNormalScale.toArray();if(this.sheenColorMap&&this.sheenColorMap.isTexture)$.sheenColorMap=this.sheenColorMap.toJSON(J).uuid;if(this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture)$.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(J).uuid;if(this.dispersion!==void 0)$.dispersion=this.dispersion;if(this.iridescence!==void 0)$.iridescence=this.iridescence;if(this.iridescenceIOR!==void 0)$.iridescenceIOR=this.iridescenceIOR;if(this.iridescenceThicknessRange!==void 0)$.iridescenceThicknessRange=this.iridescenceThicknessRange;if(this.iridescenceMap&&this.iridescenceMap.isTexture)$.iridescenceMap=this.iridescenceMap.toJSON(J).uuid;if(this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture)$.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(J).uuid;if(this.anisotropy!==void 0)$.anisotropy=this.anisotropy;if(this.anisotropyRotation!==void 0)$.anisotropyRotation=this.anisotropyRotation;if(this.anisotropyMap&&this.anisotropyMap.isTexture)$.anisotropyMap=this.anisotropyMap.toJSON(J).uuid;if(this.map&&this.map.isTexture)$.map=this.map.toJSON(J).uuid;if(this.matcap&&this.matcap.isTexture)$.matcap=this.matcap.toJSON(J).uuid;if(this.alphaMap&&this.alphaMap.isTexture)$.alphaMap=this.alphaMap.toJSON(J).uuid;if(this.lightMap&&this.lightMap.isTexture)$.lightMap=this.lightMap.toJSON(J).uuid,$.lightMapIntensity=this.lightMapIntensity;if(this.aoMap&&this.aoMap.isTexture)$.aoMap=this.aoMap.toJSON(J).uuid,$.aoMapIntensity=this.aoMapIntensity;if(this.bumpMap&&this.bumpMap.isTexture)$.bumpMap=this.bumpMap.toJSON(J).uuid,$.bumpScale=this.bumpScale;if(this.normalMap&&this.normalMap.isTexture)$.normalMap=this.normalMap.toJSON(J).uuid,$.normalMapType=this.normalMapType,$.normalScale=this.normalScale.toArray();if(this.displacementMap&&this.displacementMap.isTexture)$.displacementMap=this.displacementMap.toJSON(J).uuid,$.displacementScale=this.displacementScale,$.displacementBias=this.displacementBias;if(this.roughnessMap&&this.roughnessMap.isTexture)$.roughnessMap=this.roughnessMap.toJSON(J).uuid;if(this.metalnessMap&&this.metalnessMap.isTexture)$.metalnessMap=this.metalnessMap.toJSON(J).uuid;if(this.emissiveMap&&this.emissiveMap.isTexture)$.emissiveMap=this.emissiveMap.toJSON(J).uuid;if(this.specularMap&&this.specularMap.isTexture)$.specularMap=this.specularMap.toJSON(J).uuid;if(this.specularIntensityMap&&this.specularIntensityMap.isTexture)$.specularIntensityMap=this.specularIntensityMap.toJSON(J).uuid;if(this.specularColorMap&&this.specularColorMap.isTexture)$.specularColorMap=this.specularColorMap.toJSON(J).uuid;if(this.envMap&&this.envMap.isTexture){if($.envMap=this.envMap.toJSON(J).uuid,this.combine!==void 0)$.combine=this.combine}if(this.envMapRotation!==void 0)$.envMapRotation=this.envMapRotation.toArray();if(this.envMapIntensity!==void 0)$.envMapIntensity=this.envMapIntensity;if(this.reflectivity!==void 0)$.reflectivity=this.reflectivity;if(this.refractionRatio!==void 0)$.refractionRatio=this.refractionRatio;if(this.gradientMap&&this.gradientMap.isTexture)$.gradientMap=this.gradientMap.toJSON(J).uuid;if(this.transmission!==void 0)$.transmission=this.transmission;if(this.transmissionMap&&this.transmissionMap.isTexture)$.transmissionMap=this.transmissionMap.toJSON(J).uuid;if(this.thickness!==void 0)$.thickness=this.thickness;if(this.thicknessMap&&this.thicknessMap.isTexture)$.thicknessMap=this.thicknessMap.toJSON(J).uuid;if(this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0)$.attenuationDistance=this.attenuationDistance;if(this.attenuationColor!==void 0)$.attenuationColor=this.attenuationColor.getHex();if(this.size!==void 0)$.size=this.size;if(this.shadowSide!==null)$.shadowSide=this.shadowSide;if(this.sizeAttenuation!==void 0)$.sizeAttenuation=this.sizeAttenuation;if(this.blending!==1)$.blending=this.blending;if(this.side!==0)$.side=this.side;if(this.vertexColors===!0)$.vertexColors=!0;if(this.opacity<1)$.opacity=this.opacity;if(this.transparent===!0)$.transparent=!0;if(this.blendSrc!==204)$.blendSrc=this.blendSrc;if(this.blendDst!==205)$.blendDst=this.blendDst;if(this.blendEquation!==100)$.blendEquation=this.blendEquation;if(this.blendSrcAlpha!==null)$.blendSrcAlpha=this.blendSrcAlpha;if(this.blendDstAlpha!==null)$.blendDstAlpha=this.blendDstAlpha;if(this.blendEquationAlpha!==null)$.blendEquationAlpha=this.blendEquationAlpha;if(this.blendColor&&this.blendColor.isColor)$.blendColor=this.blendColor.getHex();if(this.blendAlpha!==0)$.blendAlpha=this.blendAlpha;if(this.depthFunc!==3)$.depthFunc=this.depthFunc;if(this.depthTest===!1)$.depthTest=this.depthTest;if(this.depthWrite===!1)$.depthWrite=this.depthWrite;if(this.colorWrite===!1)$.colorWrite=this.colorWrite;if(this.stencilWriteMask!==255)$.stencilWriteMask=this.stencilWriteMask;if(this.stencilFunc!==519)$.stencilFunc=this.stencilFunc;if(this.stencilRef!==0)$.stencilRef=this.stencilRef;if(this.stencilFuncMask!==255)$.stencilFuncMask=this.stencilFuncMask;if(this.stencilFail!==7680)$.stencilFail=this.stencilFail;if(this.stencilZFail!==7680)$.stencilZFail=this.stencilZFail;if(this.stencilZPass!==7680)$.stencilZPass=this.stencilZPass;if(this.stencilWrite===!0)$.stencilWrite=this.stencilWrite;if(this.rotation!==void 0&&this.rotation!==0)$.rotation=this.rotation;if(this.polygonOffset===!0)$.polygonOffset=!0;if(this.polygonOffsetFactor!==0)$.polygonOffsetFactor=this.polygonOffsetFactor;if(this.polygonOffsetUnits!==0)$.polygonOffsetUnits=this.polygonOffsetUnits;if(this.linewidth!==void 0&&this.linewidth!==1)$.linewidth=this.linewidth;if(this.dashSize!==void 0)$.dashSize=this.dashSize;if(this.gapSize!==void 0)$.gapSize=this.gapSize;if(this.scale!==void 0)$.scale=this.scale;if(this.dithering===!0)$.dithering=!0;if(this.alphaTest>0)$.alphaTest=this.alphaTest;if(this.alphaHash===!0)$.alphaHash=!0;if(this.alphaToCoverage===!0)$.alphaToCoverage=!0;if(this.premultipliedAlpha===!0)$.premultipliedAlpha=!0;if(this.forceSinglePass===!0)$.forceSinglePass=!0;if(this.allowOverride===!1)$.allowOverride=!1;if(this.wireframe===!0)$.wireframe=!0;if(this.wireframeLinewidth>1)$.wireframeLinewidth=this.wireframeLinewidth;if(this.wireframeLinecap!=="round")$.wireframeLinecap=this.wireframeLinecap;if(this.wireframeLinejoin!=="round")$.wireframeLinejoin=this.wireframeLinejoin;if(this.flatShading===!0)$.flatShading=!0;if(this.visible===!1)$.visible=!1;if(this.toneMapped===!1)$.toneMapped=!1;if(this.fog===!1)$.fog=!1;if(Object.keys(this.userData).length>0)$.userData=this.userData;function Z(W){let K=[];for(let H in W){let X=W[H];delete X.metadata,K.push(X)}return K}if(Q){let W=Z(J.textures),K=Z(J.images);if(W.length>0)$.textures=W;if(K.length>0)$.images=K}return $}clone(){return new this.constructor().copy(this)}copy(J){this.name=J.name,this.blending=J.blending,this.side=J.side,this.vertexColors=J.vertexColors,this.opacity=J.opacity,this.transparent=J.transparent,this.blendSrc=J.blendSrc,this.blendDst=J.blendDst,this.blendEquation=J.blendEquation,this.blendSrcAlpha=J.blendSrcAlpha,this.blendDstAlpha=J.blendDstAlpha,this.blendEquationAlpha=J.blendEquationAlpha,this.blendColor.copy(J.blendColor),this.blendAlpha=J.blendAlpha,this.depthFunc=J.depthFunc,this.depthTest=J.depthTest,this.depthWrite=J.depthWrite,this.stencilWriteMask=J.stencilWriteMask,this.stencilFunc=J.stencilFunc,this.stencilRef=J.stencilRef,this.stencilFuncMask=J.stencilFuncMask,this.stencilFail=J.stencilFail,this.stencilZFail=J.stencilZFail,this.stencilZPass=J.stencilZPass,this.stencilWrite=J.stencilWrite;let Q=J.clippingPlanes,$=null;if(Q!==null){let Z=Q.length;$=new Array(Z);for(let W=0;W!==Z;++W)$[W]=Q[W].clone()}return this.clippingPlanes=$,this.clipIntersection=J.clipIntersection,this.clipShadows=J.clipShadows,this.shadowSide=J.shadowSide,this.colorWrite=J.colorWrite,this.precision=J.precision,this.polygonOffset=J.polygonOffset,this.polygonOffsetFactor=J.polygonOffsetFactor,this.polygonOffsetUnits=J.polygonOffsetUnits,this.dithering=J.dithering,this.alphaTest=J.alphaTest,this.alphaHash=J.alphaHash,this.alphaToCoverage=J.alphaToCoverage,this.premultipliedAlpha=J.premultipliedAlpha,this.forceSinglePass=J.forceSinglePass,this.allowOverride=J.allowOverride,this.visible=J.visible,this.toneMapped=J.toneMapped,this.userData=JSON.parse(JSON.stringify(J.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(J){if(J===!0)this.version++}}class a8 extends q8{constructor(J){super();this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new l0(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 g8,this.combine=0,this.reflectivity=1,this.refractionRatio=0.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.lightMap=J.lightMap,this.lightMapIntensity=J.lightMapIntensity,this.aoMap=J.aoMap,this.aoMapIntensity=J.aoMapIntensity,this.specularMap=J.specularMap,this.alphaMap=J.alphaMap,this.envMap=J.envMap,this.envMapRotation.copy(J.envMapRotation),this.combine=J.combine,this.reflectivity=J.reflectivity,this.refractionRatio=J.refractionRatio,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.wireframeLinecap=J.wireframeLinecap,this.wireframeLinejoin=J.wireframeLinejoin,this.fog=J.fog,this}}var n9=new f,b6=new g0,yF=0;class WJ{constructor(J,Q,$=!1){if(Array.isArray(J))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:yF++}),this.name="",this.array=J,this.itemSize=Q,this.count=J!==void 0?J.length/Q:0,this.normalized=$,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(J){if(J===!0)this.version++}setUsage(J){return this.usage=J,this}addUpdateRange(J,Q){this.updateRanges.push({start:J,count:Q})}clearUpdateRanges(){this.updateRanges.length=0}copy(J){return this.name=J.name,this.array=new J.array.constructor(J.array),this.itemSize=J.itemSize,this.count=J.count,this.normalized=J.normalized,this.usage=J.usage,this.gpuType=J.gpuType,this}copyAt(J,Q,$){J*=this.itemSize,$*=Q.itemSize;for(let Z=0,W=this.itemSize;ZQ.count)j0("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.");Q.needsUpdate=!0}return this}computeBoundingBox(){if(this.boundingBox===null)this.boundingBox=new C8;let J=this.attributes.position,Q=this.morphAttributes.position;if(J&&J.isGLBufferAttribute){d0("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new f(-1/0,-1/0,-1/0),new f(1/0,1/0,1/0));return}if(J!==void 0){if(this.boundingBox.setFromBufferAttribute(J),Q)for(let $=0,Z=Q.length;$0)J.userData=this.userData;if(this.parameters!==void 0){let X=this.parameters;for(let Y in X)if(X[Y]!==void 0)J[Y]=X[Y];return J}J.data={attributes:{}};let Q=this.index;if(Q!==null)J.data.index={type:Q.array.constructor.name,array:Array.prototype.slice.call(Q.array)};let $=this.attributes;for(let X in $){let Y=$[X];J.data.attributes[X]=Y.toJSON(J.data)}let Z={},W=!1;for(let X in this.morphAttributes){let Y=this.morphAttributes[X],U=[];for(let G=0,q=Y.length;G0)Z[X]=U,W=!0}if(W)J.data.morphAttributes=Z,J.data.morphTargetsRelative=this.morphTargetsRelative;let K=this.groups;if(K.length>0)J.data.groups=JSON.parse(JSON.stringify(K));let H=this.boundingSphere;if(H!==null)J.data.boundingSphere=H.toJSON();return J}clone(){return new this.constructor().copy(this)}copy(J){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let Q={};this.name=J.name;let $=J.index;if($!==null)this.setIndex($.clone());let Z=J.attributes;for(let Y in Z){let U=Z[Y];this.setAttribute(Y,U.clone(Q))}let W=J.morphAttributes;for(let Y in W){let U=[],G=W[Y];for(let q=0,N=G.length;q0){let Z=Q[$[0]];if(Z!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let W=0,K=Z.length;W(J.far-J.near)**2)return}if(R1.copy(W).invert(),RQ.copy(J.ray).applyMatrix4(R1),$.boundingBox!==null){if(RQ.intersectsBox($.boundingBox)===!1)return}this._computeIntersections(J,Q,RQ)}_computeIntersections(J,Q,$){let Z,W=this.geometry,K=this.material,H=W.index,X=W.attributes.position,Y=W.attributes.uv,U=W.attributes.uv1,G=W.attributes.normal,q=W.groups,N=W.drawRange;if(H!==null)if(Array.isArray(K))for(let R=0,M=q.length;R$.far)return null;return{distance:U,point:p6.clone(),object:J}}function m6(J,Q,$,Z,W,K,H,X,Y,U){J.getVertexPosition(X,h6),J.getVertexPosition(Y,f6),J.getVertexPosition(U,v6);let G=fF(J,Q,$,Z,h6,f6,v6,E1);if(G){let q=new f;if(k8.getBarycoord(E1,h6,f6,v6,q),W)G.uv=k8.getInterpolatedAttribute(W,X,Y,U,q,new g0);if(K)G.uv1=k8.getInterpolatedAttribute(K,X,Y,U,q,new g0);if(H){if(G.normal=k8.getInterpolatedAttribute(H,X,Y,U,q,new f),G.normal.dot(Z.direction)>0)G.normal.multiplyScalar(-1)}let N={a:X,b:Y,c:U,normal:new f,materialIndex:0};k8.getNormal(h6,f6,v6,N.normal),G.face=N,G.barycoord=q}return G}class A$ extends MJ{constructor(J=1,Q=1,$=1,Z=1,W=1,K=1){super();this.type="BoxGeometry",this.parameters={width:J,height:Q,depth:$,widthSegments:Z,heightSegments:W,depthSegments:K};let H=this;Z=Math.floor(Z),W=Math.floor(W),K=Math.floor(K);let X=[],Y=[],U=[],G=[],q=0,N=0;R("z","y","x",-1,-1,$,Q,J,K,W,0),R("z","y","x",1,-1,$,Q,-J,K,W,1),R("x","z","y",1,1,J,$,Q,Z,K,2),R("x","z","y",1,-1,J,$,-Q,Z,K,3),R("x","y","z",1,-1,J,Q,$,Z,W,4),R("x","y","z",-1,-1,J,Q,-$,Z,W,5),this.setIndex(X),this.setAttribute("position",new EJ(Y,3)),this.setAttribute("normal",new EJ(U,3)),this.setAttribute("uv",new EJ(G,2));function R(M,E,F,O,k,D,B,A,C,w,T){let z=D/C,V=B/w,_=D/2,b=B/2,p=A/2,v=C+1,s=w+1,m=0,h=0,c=new f;for(let t=0;t0?1:-1,U.push(c.x,c.y,c.z),G.push(Q0/C),G.push(1-t/w),m+=1}}for(let t=0;t0)Q.defines=this.defines;Q.vertexShader=this.vertexShader,Q.fragmentShader=this.fragmentShader,Q.lights=this.lights,Q.clipping=this.clipping;let $={};for(let Z in this.extensions)if(this.extensions[Z]===!0)$[Z]=!0;if(Object.keys($).length>0)Q.extensions=$;return Q}}class zW extends h9{constructor(){super();this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new r0,this.projectionMatrix=new r0,this.projectionMatrixInverse=new r0,this.coordinateSystem=2000,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(J,Q){return super.copy(J,Q),this.matrixWorldInverse.copy(J.matrixWorldInverse),this.projectionMatrix.copy(J.projectionMatrix),this.projectionMatrixInverse.copy(J.projectionMatrixInverse),this.coordinateSystem=J.coordinateSystem,this}getWorldDirection(J){return super.getWorldDirection(J).negate()}updateMatrixWorld(J){super.updateMatrixWorld(J),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(J,Q){super.updateWorldMatrix(J,Q),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}var g7=new f,O1=new g0,M1=new g0;class ZJ extends zW{constructor(J=50,Q=1,$=0.1,Z=2000){super();this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=J,this.zoom=1,this.near=$,this.far=Z,this.focus=10,this.aspect=Q,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(J,Q){return super.copy(J,Q),this.fov=J.fov,this.zoom=J.zoom,this.near=J.near,this.far=J.far,this.focus=J.focus,this.aspect=J.aspect,this.view=J.view===null?null:Object.assign({},J.view),this.filmGauge=J.filmGauge,this.filmOffset=J.filmOffset,this}setFocalLength(J){let Q=0.5*this.getFilmHeight()/J;this.fov=EQ*2*Math.atan(Q),this.updateProjectionMatrix()}getFocalLength(){let J=Math.tan(RZ*0.5*this.fov);return 0.5*this.getFilmHeight()/J}getEffectiveFOV(){return EQ*2*Math.atan(Math.tan(RZ*0.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(J,Q,$){g7.set(-1,-1,0.5).applyMatrix4(this.projectionMatrixInverse),Q.set(g7.x,g7.y).multiplyScalar(-J/g7.z),g7.set(1,1,0.5).applyMatrix4(this.projectionMatrixInverse),$.set(g7.x,g7.y).multiplyScalar(-J/g7.z)}getViewSize(J,Q){return this.getViewBounds(J,O1,M1),Q.subVectors(M1,O1)}setViewOffset(J,Q,$,Z,W,K){if(this.aspect=J/Q,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=J,this.view.fullHeight=Q,this.view.offsetX=$,this.view.offsetY=Z,this.view.width=W,this.view.height=K,this.updateProjectionMatrix()}clearViewOffset(){if(this.view!==null)this.view.enabled=!1;this.updateProjectionMatrix()}updateProjectionMatrix(){let J=this.near,Q=J*Math.tan(RZ*0.5*this.fov)/this.zoom,$=2*Q,Z=this.aspect*$,W=-0.5*Z,K=this.view;if(this.view!==null&&this.view.enabled){let{fullWidth:X,fullHeight:Y}=K;W+=K.offsetX*Z/X,Q-=K.offsetY*$/Y,Z*=K.width/X,$*=K.height/Y}let H=this.filmOffset;if(H!==0)W+=J*H/this.getFilmWidth();this.projectionMatrix.makePerspective(W,W+Z,Q,Q-$,J,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(J){let Q=super.toJSON(J);if(Q.object.fov=this.fov,Q.object.zoom=this.zoom,Q.object.near=this.near,Q.object.far=this.far,Q.object.focus=this.focus,Q.object.aspect=this.aspect,this.view!==null)Q.object.view=Object.assign({},this.view);return Q.object.filmGauge=this.filmGauge,Q.object.filmOffset=this.filmOffset,Q}}var G$=-90,q$=1;class VX extends h9{constructor(J,Q,$){super();this.type="CubeCamera",this.renderTarget=$,this.coordinateSystem=null,this.activeMipmapLevel=0;let Z=new ZJ(G$,q$,J,Q);Z.layers=this.layers,this.add(Z);let W=new ZJ(G$,q$,J,Q);W.layers=this.layers,this.add(W);let K=new ZJ(G$,q$,J,Q);K.layers=this.layers,this.add(K);let H=new ZJ(G$,q$,J,Q);H.layers=this.layers,this.add(H);let X=new ZJ(G$,q$,J,Q);X.layers=this.layers,this.add(X);let Y=new ZJ(G$,q$,J,Q);Y.layers=this.layers,this.add(Y)}updateCoordinateSystem(){let J=this.coordinateSystem,Q=this.children.concat(),[$,Z,W,K,H,X]=Q;for(let Y of Q)this.remove(Y);if(J===2000)$.up.set(0,1,0),$.lookAt(1,0,0),Z.up.set(0,1,0),Z.lookAt(-1,0,0),W.up.set(0,0,-1),W.lookAt(0,1,0),K.up.set(0,0,1),K.lookAt(0,-1,0),H.up.set(0,1,0),H.lookAt(0,0,1),X.up.set(0,1,0),X.lookAt(0,0,-1);else if(J===2001)$.up.set(0,-1,0),$.lookAt(-1,0,0),Z.up.set(0,-1,0),Z.lookAt(1,0,0),W.up.set(0,0,1),W.lookAt(0,1,0),K.up.set(0,0,-1),K.lookAt(0,-1,0),H.up.set(0,-1,0),H.lookAt(0,0,1),X.up.set(0,-1,0),X.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+J);for(let Y of Q)this.add(Y),Y.updateMatrixWorld()}update(J,Q){if(this.parent===null)this.updateMatrixWorld();let{renderTarget:$,activeMipmapLevel:Z}=this;if(this.coordinateSystem!==J.coordinateSystem)this.coordinateSystem=J.coordinateSystem,this.updateCoordinateSystem();let[W,K,H,X,Y,U]=this.children,G=J.getRenderTarget(),q=J.getActiveCubeFace(),N=J.getActiveMipmapLevel(),R=J.xr.enabled;J.xr.enabled=!1;let M=$.texture.generateMipmaps;$.texture.generateMipmaps=!1,J.setRenderTarget($,0,Z),J.render(Q,W),J.setRenderTarget($,1,Z),J.render(Q,K),J.setRenderTarget($,2,Z),J.render(Q,H),J.setRenderTarget($,3,Z),J.render(Q,X),J.setRenderTarget($,4,Z),J.render(Q,Y),$.texture.generateMipmaps=M,J.setRenderTarget($,5,Z),J.render(Q,U),J.setRenderTarget(G,q,N),J.xr.enabled=R,$.texture.needsPMREMUpdate=!0}}class VW extends o9{constructor(J=[],Q=301,$,Z,W,K,H,X,Y,U){super(J,Q,$,Z,W,K,H,X,Y,U);this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(J){this.image=J}}class kW extends aJ{constructor(J=1,Q={}){super(J,J,Q);this.isWebGLCubeRenderTarget=!0;let $={width:J,height:J,depth:1},Z=[$,$,$,$,$,$];this.texture=new VW(Z),this._setTextureOptions(Q),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(J,Q){this.texture.type=Q.type,this.texture.colorSpace=Q.colorSpace,this.texture.generateMipmaps=Q.generateMipmaps,this.texture.minFilter=Q.minFilter,this.texture.magFilter=Q.magFilter;let $={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; vec3 transformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include } `,fragmentShader:` uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); } `},Z=new A$(5,5,5),W=new fJ({name:"CubemapFromEquirect",uniforms:VQ($.uniforms),vertexShader:$.vertexShader,fragmentShader:$.fragmentShader,side:1,blending:0});W.uniforms.tEquirect.value=Q;let K=new i9(Z,W),H=Q.minFilter;if(Q.minFilter===1008)Q.minFilter=1006;return new VX(1,10,this).update(J,K),Q.minFilter=H,K.geometry.dispose(),K.material.dispose(),this}clear(J,Q=!0,$=!0,Z=!0){let W=J.getRenderTarget();for(let K=0;K<6;K++)J.setRenderTarget(this,K),J.clear(Q,$,Z);J.setRenderTarget(W)}}class n8 extends h9{constructor(){super();this.isGroup=!0,this.type="Group"}}var mF={type:"move"};class CZ{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){if(this._hand===null)this._hand=new n8,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1};return this._hand}getTargetRaySpace(){if(this._targetRay===null)this._targetRay=new n8,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new f,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new f;return this._targetRay}getGripSpace(){if(this._grip===null)this._grip=new n8,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new f,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new f;return this._grip}dispatchEvent(J){if(this._targetRay!==null)this._targetRay.dispatchEvent(J);if(this._grip!==null)this._grip.dispatchEvent(J);if(this._hand!==null)this._hand.dispatchEvent(J);return this}connect(J){if(J&&J.hand){let Q=this._hand;if(Q)for(let $ of J.hand.values())this._getHandJoint(Q,$)}return this.dispatchEvent({type:"connected",data:J}),this}disconnect(J){if(this.dispatchEvent({type:"disconnected",data:J}),this._targetRay!==null)this._targetRay.visible=!1;if(this._grip!==null)this._grip.visible=!1;if(this._hand!==null)this._hand.visible=!1;return this}update(J,Q,$){let Z=null,W=null,K=null,H=this._targetRay,X=this._grip,Y=this._hand;if(J&&Q.session.visibilityState!=="visible-blurred"){if(Y&&J.hand){K=!0;for(let M of J.hand.values()){let E=Q.getJointPose(M,$),F=this._getHandJoint(Y,M);if(E!==null)F.matrix.fromArray(E.transform.matrix),F.matrix.decompose(F.position,F.rotation,F.scale),F.matrixWorldNeedsUpdate=!0,F.jointRadius=E.radius;F.visible=E!==null}let U=Y.joints["index-finger-tip"],G=Y.joints["thumb-tip"],q=U.position.distanceTo(G.position),N=0.02,R=0.005;if(Y.inputState.pinching&&q>N+R)Y.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:J.handedness,target:this});else if(!Y.inputState.pinching&&q<=N-R)Y.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:J.handedness,target:this})}else if(X!==null&&J.gripSpace){if(W=Q.getPose(J.gripSpace,$),W!==null){if(X.matrix.fromArray(W.transform.matrix),X.matrix.decompose(X.position,X.rotation,X.scale),X.matrixWorldNeedsUpdate=!0,W.linearVelocity)X.hasLinearVelocity=!0,X.linearVelocity.copy(W.linearVelocity);else X.hasLinearVelocity=!1;if(W.angularVelocity)X.hasAngularVelocity=!0,X.angularVelocity.copy(W.angularVelocity);else X.hasAngularVelocity=!1}}if(H!==null){if(Z=Q.getPose(J.targetRaySpace,$),Z===null&&W!==null)Z=W;if(Z!==null){if(H.matrix.fromArray(Z.transform.matrix),H.matrix.decompose(H.position,H.rotation,H.scale),H.matrixWorldNeedsUpdate=!0,Z.linearVelocity)H.hasLinearVelocity=!0,H.linearVelocity.copy(Z.linearVelocity);else H.hasLinearVelocity=!1;if(Z.angularVelocity)H.hasAngularVelocity=!0,H.angularVelocity.copy(Z.angularVelocity);else H.hasAngularVelocity=!1;this.dispatchEvent(mF)}}}if(H!==null)H.visible=Z!==null;if(X!==null)X.visible=W!==null;if(Y!==null)Y.visible=K!==null;return this}_getHandJoint(J,Q){if(J.joints[Q.jointName]===void 0){let $=new n8;$.matrixAutoUpdate=!1,$.visible=!1,J.joints[Q.jointName]=$,J.add($)}return J.joints[Q.jointName]}}class CW extends h9{constructor(){super();if(this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new g8,this.environmentIntensity=1,this.environmentRotation=new g8,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__!=="undefined")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(J,Q){if(super.copy(J,Q),J.background!==null)this.background=J.background.clone();if(J.environment!==null)this.environment=J.environment.clone();if(J.fog!==null)this.fog=J.fog.clone();if(this.backgroundBlurriness=J.backgroundBlurriness,this.backgroundIntensity=J.backgroundIntensity,this.backgroundRotation.copy(J.backgroundRotation),this.environmentIntensity=J.environmentIntensity,this.environmentRotation.copy(J.environmentRotation),J.overrideMaterial!==null)this.overrideMaterial=J.overrideMaterial.clone();return this.matrixAutoUpdate=J.matrixAutoUpdate,this}toJSON(J){let Q=super.toJSON(J);if(this.fog!==null)Q.object.fog=this.fog.toJSON();if(this.backgroundBlurriness>0)Q.object.backgroundBlurriness=this.backgroundBlurriness;if(this.backgroundIntensity!==1)Q.object.backgroundIntensity=this.backgroundIntensity;if(Q.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1)Q.object.environmentIntensity=this.environmentIntensity;return Q.object.environmentRotation=this.environmentRotation.toArray(),Q}}class IZ{constructor(J,Q){this.isInterleavedBuffer=!0,this.array=J,this.stride=Q,this.count=J!==void 0?J.length/Q:0,this.usage=35044,this.updateRanges=[],this.version=0,this.uuid=v8()}onUploadCallback(){}set needsUpdate(J){if(J===!0)this.version++}setUsage(J){return this.usage=J,this}addUpdateRange(J,Q){this.updateRanges.push({start:J,count:Q})}clearUpdateRanges(){this.updateRanges.length=0}copy(J){return this.array=new J.array.constructor(J.array),this.count=J.count,this.stride=J.stride,this.usage=J.usage,this}copyAt(J,Q,$){J*=this.stride,$*=Q.stride;for(let Z=0,W=this.stride;Z1)return null;return Q.copy(J.start).addScaledVector($,W)}intersectsLine(J){let Q=this.distanceToPoint(J.start),$=this.distanceToPoint(J.end);return Q<0&&$>0||$<0&&Q>0}intersectsBox(J){return J.intersectsPlane(this)}intersectsSphere(J){return J.intersectsPlane(this)}coplanarPoint(J){return J.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(J,Q){let $=Q||sF.getNormalMatrix(J),Z=this.coplanarPoint(qH).applyMatrix4(J),W=this.normal.applyMatrix3($).normalize();return this.constant=-Z.dot(W),this}translate(J){return this.constant-=J.dot(this.normal),this}equals(J){return J.normal.equals(this.normal)&&J.constant===this.constant}clone(){return new this.constructor().copy(this)}}var FQ=new G8,nF=new g0(0.5,0.5),l6=new f;class SZ{constructor(J=new h8,Q=new h8,$=new h8,Z=new h8,W=new h8,K=new h8){this.planes=[J,Q,$,Z,W,K]}set(J,Q,$,Z,W,K){let H=this.planes;return H[0].copy(J),H[1].copy(Q),H[2].copy($),H[3].copy(Z),H[4].copy(W),H[5].copy(K),this}copy(J){let Q=this.planes;for(let $=0;$<6;$++)Q[$].copy(J.planes[$]);return this}setFromProjectionMatrix(J,Q=2000,$=!1){let Z=this.planes,W=J.elements,K=W[0],H=W[1],X=W[2],Y=W[3],U=W[4],G=W[5],q=W[6],N=W[7],R=W[8],M=W[9],E=W[10],F=W[11],O=W[12],k=W[13],D=W[14],B=W[15];if(Z[0].setComponents(Y-K,N-U,F-R,B-O).normalize(),Z[1].setComponents(Y+K,N+U,F+R,B+O).normalize(),Z[2].setComponents(Y+H,N+G,F+M,B+k).normalize(),Z[3].setComponents(Y-H,N-G,F-M,B-k).normalize(),$)Z[4].setComponents(X,q,E,D).normalize(),Z[5].setComponents(Y-X,N-q,F-E,B-D).normalize();else if(Z[4].setComponents(Y-X,N-q,F-E,B-D).normalize(),Q===2000)Z[5].setComponents(Y+X,N+q,F+E,B+D).normalize();else if(Q===2001)Z[5].setComponents(X,q,E,D).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+Q);return this}intersectsObject(J){if(J.boundingSphere!==void 0){if(J.boundingSphere===null)J.computeBoundingSphere();FQ.copy(J.boundingSphere).applyMatrix4(J.matrixWorld)}else{let Q=J.geometry;if(Q.boundingSphere===null)Q.computeBoundingSphere();FQ.copy(Q.boundingSphere).applyMatrix4(J.matrixWorld)}return this.intersectsSphere(FQ)}intersectsSprite(J){FQ.center.set(0,0,0);let Q=nF.distanceTo(J.center);return FQ.radius=0.7071067811865476+Q,FQ.applyMatrix4(J.matrixWorld),this.intersectsSphere(FQ)}intersectsSphere(J){let Q=this.planes,$=J.center,Z=-J.radius;for(let W=0;W<6;W++)if(Q[W].distanceToPoint($)0?J.max.x:J.min.x,l6.y=Z.normal.y>0?J.max.y:J.min.y,l6.z=Z.normal.z>0?J.max.z:J.min.z,Z.distanceToPoint(l6)<0)return!1}return!0}containsPoint(J){let Q=this.planes;for(let $=0;$<6;$++)if(Q[$].distanceToPoint(J)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class TZ extends q8{constructor(J){super();this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new l0(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.linewidth=J.linewidth,this.linecap=J.linecap,this.linejoin=J.linejoin,this.fog=J.fog,this}}var a6=new f,r6=new f,P1=new r0,NZ=new c7,c6=new G8,NH=new f,A1=new f;class S$ extends h9{constructor(J=new MJ,Q=new TZ){super();this.isLine=!0,this.type="Line",this.geometry=J,this.material=Q,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(J,Q){return super.copy(J,Q),this.material=Array.isArray(J.material)?J.material.slice():J.material,this.geometry=J.geometry,this}computeLineDistances(){let J=this.geometry;if(J.index===null){let Q=J.attributes.position,$=[0];for(let Z=1,W=Q.count;Z0){let Z=Q[$[0]];if(Z!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let W=0,K=Z.length;WZ)return;NH.applyMatrix4(J.matrixWorld);let U=Q.ray.origin.distanceTo(NH);if(UQ.far)return;return{distance:U,point:A1.clone().applyMatrix4(J.matrixWorld),index:H,face:null,faceIndex:null,barycoord:null,object:J}}var w1=new f,S1=new f;class AW extends S${constructor(J,Q){super(J,Q);this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let J=this.geometry;if(J.index===null){let Q=J.attributes.position,$=[];for(let Z=0,W=Q.count;Z0){let Z=Q[$[0]];if(Z!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let W=0,K=Z.length;WW.far)return;K.push({distance:U,distanceToRay:Math.sqrt(X),point:Y,index:Q,face:null,faceIndex:null,barycoord:null,object:H})}}class kQ extends o9{constructor(J,Q,$=1014,Z,W,K,H=1003,X=1003,Y,U=1026,G=1){if(U!==1026&&U!==1027)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let q={width:J,height:Q,depth:G};super(q,Z,W,K,H,X,U,$,Y);this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(J){return super.copy(J),this.source=new kZ(Object.assign({},J.image)),this.compareFunction=J.compareFunction,this}toJSON(J){let Q=super.toJSON(J);if(this.compareFunction!==null)Q.compareFunction=this.compareFunction;return Q}}class kX extends kQ{constructor(J,Q=1014,$=301,Z,W,K=1003,H=1003,X,Y=1026){let U={width:J,height:J,depth:1},G=[U,U,U,U,U,U];super(J,J,Q,$,Z,W,K,H,X,Y);this.image=G,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(J){this.image=J}}class TW extends o9{constructor(J=null){super();this.sourceTexture=J,this.isExternalTexture=!0}copy(J){return super.copy(J),this.sourceTexture=J.sourceTexture,this}}class CQ extends MJ{constructor(J=1,Q=1,$=1,Z=1){super();this.type="PlaneGeometry",this.parameters={width:J,height:Q,widthSegments:$,heightSegments:Z};let W=J/2,K=Q/2,H=Math.floor($),X=Math.floor(Z),Y=H+1,U=X+1,G=J/H,q=Q/X,N=[],R=[],M=[],E=[];for(let F=0;F0!==J>0)this.version++;this._anisotropy=J}get clearcoat(){return this._clearcoat}set clearcoat(J){if(this._clearcoat>0!==J>0)this.version++;this._clearcoat=J}get iridescence(){return this._iridescence}set iridescence(J){if(this._iridescence>0!==J>0)this.version++;this._iridescence=J}get dispersion(){return this._dispersion}set dispersion(J){if(this._dispersion>0!==J>0)this.version++;this._dispersion=J}get sheen(){return this._sheen}set sheen(J){if(this._sheen>0!==J>0)this.version++;this._sheen=J}get transmission(){return this._transmission}set transmission(J){if(this._transmission>0!==J>0)this.version++;this._transmission=J}copy(J){return super.copy(J),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=J.anisotropy,this.anisotropyRotation=J.anisotropyRotation,this.anisotropyMap=J.anisotropyMap,this.clearcoat=J.clearcoat,this.clearcoatMap=J.clearcoatMap,this.clearcoatRoughness=J.clearcoatRoughness,this.clearcoatRoughnessMap=J.clearcoatRoughnessMap,this.clearcoatNormalMap=J.clearcoatNormalMap,this.clearcoatNormalScale.copy(J.clearcoatNormalScale),this.dispersion=J.dispersion,this.ior=J.ior,this.iridescence=J.iridescence,this.iridescenceMap=J.iridescenceMap,this.iridescenceIOR=J.iridescenceIOR,this.iridescenceThicknessRange=[...J.iridescenceThicknessRange],this.iridescenceThicknessMap=J.iridescenceThicknessMap,this.sheen=J.sheen,this.sheenColor.copy(J.sheenColor),this.sheenColorMap=J.sheenColorMap,this.sheenRoughness=J.sheenRoughness,this.sheenRoughnessMap=J.sheenRoughnessMap,this.transmission=J.transmission,this.transmissionMap=J.transmissionMap,this.thickness=J.thickness,this.thicknessMap=J.thicknessMap,this.attenuationDistance=J.attenuationDistance,this.attenuationColor.copy(J.attenuationColor),this.specularIntensity=J.specularIntensity,this.specularIntensityMap=J.specularIntensityMap,this.specularColor.copy(J.specularColor),this.specularColorMap=J.specularColorMap,this}}class CX extends q8{constructor(J){super();this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(J)}copy(J){return super.copy(J),this.depthPacking=J.depthPacking,this.map=J.map,this.alphaMap=J.alphaMap,this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this}}class IX extends q8{constructor(J){super();this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(J)}copy(J){return super.copy(J),this.map=J.map,this.alphaMap=J.alphaMap,this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this}}function i6(J,Q){if(!J||J.constructor===Q)return J;if(typeof Q.BYTES_PER_ELEMENT==="number")return new Q(J);return Array.prototype.slice.call(J)}function oF(J){function Q(W,K){return J[W]-J[K]}let $=J.length,Z=new Array($);for(let W=0;W!==$;++W)Z[W]=W;return Z.sort(Q),Z}function _1(J,Q,$){let Z=J.length,W=new J.constructor(Z);for(let K=0,H=0;H!==Z;++K){let X=$[K]*Q;for(let Y=0;Y!==Q;++Y)W[H++]=J[X+Y]}return W}function PG(J,Q,$,Z){let W=1,K=J[0];while(K!==void 0&&K[Z]===void 0)K=J[W++];if(K===void 0)return;let H=K[Z];if(H===void 0)return;if(Array.isArray(H))do{if(H=K[Z],H!==void 0)Q.push(K.time),$.push(...H);K=J[W++]}while(K!==void 0);else if(H.toArray!==void 0)do{if(H=K[Z],H!==void 0)Q.push(K.time),H.toArray($,$.length);K=J[W++]}while(K!==void 0);else do{if(H=K[Z],H!==void 0)Q.push(K.time),$.push(H);K=J[W++]}while(K!==void 0)}class s7{constructor(J,Q,$,Z){this.parameterPositions=J,this._cachedIndex=0,this.resultBuffer=Z!==void 0?Z:new Q.constructor($),this.sampleValues=Q,this.valueSize=$,this.settings=null,this.DefaultSettings_={}}evaluate(J){let Q=this.parameterPositions,$=this._cachedIndex,Z=Q[$],W=Q[$-1];$:{J:{let K;Q:{Z:if(!(J=W)){let H=Q[1];if(J=W)break J}K=$,$=0;break Q}break $}while($>>1;if(JQ)--K;if(++K,W!==0||K!==Z){if(W>=K)K=Math.max(K,1),W=K-1;let H=this.getValueSize();this.times=$.slice(W,K),this.values=this.values.slice(W*H,K*H)}return this}validate(){let J=!0,Q=this.getValueSize();if(Q-Math.floor(Q)!==0)d0("KeyframeTrack: Invalid value size in track.",this),J=!1;let $=this.times,Z=this.values,W=$.length;if(W===0)d0("KeyframeTrack: Track is empty.",this),J=!1;let K=null;for(let H=0;H!==W;H++){let X=$[H];if(typeof X==="number"&&isNaN(X)){d0("KeyframeTrack: Time is not a valid number.",this,H,X),J=!1;break}if(K!==null&&K>X){d0("KeyframeTrack: Out of order keys.",this,H,X,K),J=!1;break}K=X}if(Z!==void 0){if(XF(Z))for(let H=0,X=Z.length;H!==X;++H){let Y=Z[H];if(isNaN(Y)){d0("KeyframeTrack: Value is not a valid number.",this,H,Y),J=!1;break}}}return J}optimize(){let J=this.times.slice(),Q=this.values.slice(),$=this.getValueSize(),Z=this.getInterpolation()===2302,W=J.length-1,K=1;for(let H=1;H0){J[K]=J[W];for(let H=W*$,X=K*$,Y=0;Y!==$;++Y)Q[X+Y]=Q[H+Y];++K}if(K!==J.length)this.times=J.slice(0,K),this.values=Q.slice(0,K*$);else this.times=J,this.values=Q;return this}clone(){let J=this.times.slice(),Q=this.values.slice(),Z=new this.constructor(this.name,J,Q);return Z.createInterpolant=this.createInterpolant,Z}}R8.prototype.ValueTypeName="";R8.prototype.TimeBufferType=Float32Array;R8.prototype.ValueBufferType=Float32Array;R8.prototype.DefaultInterpolation=2301;class n7 extends R8{constructor(J,Q,$){super(J,Q,$)}}n7.prototype.ValueTypeName="bool";n7.prototype.ValueBufferType=Array;n7.prototype.DefaultInterpolation=2300;n7.prototype.InterpolantFactoryMethodLinear=void 0;n7.prototype.InterpolantFactoryMethodSmooth=void 0;class jW extends R8{constructor(J,Q,$,Z){super(J,Q,$,Z)}}jW.prototype.ValueTypeName="color";class E7 extends R8{constructor(J,Q,$,Z){super(J,Q,$,Z)}}E7.prototype.ValueTypeName="number";class SX extends s7{constructor(J,Q,$,Z){super(J,Q,$,Z)}interpolate_(J,Q,$,Z){let W=this.resultBuffer,K=this.sampleValues,H=this.valueSize,X=($-Q)/(Z-Q),Y=J*H;for(let U=Y+H;Y!==U;Y+=4)iJ.slerpFlat(W,0,K,Y-H,K,Y,X);return W}}class D7 extends R8{constructor(J,Q,$,Z){super(J,Q,$,Z)}InterpolantFactoryMethodLinear(J){return new SX(this.times,this.values,this.getValueSize(),J)}}D7.prototype.ValueTypeName="quaternion";D7.prototype.InterpolantFactoryMethodSmooth=void 0;class o7 extends R8{constructor(J,Q,$){super(J,Q,$)}}o7.prototype.ValueTypeName="string";o7.prototype.ValueBufferType=Array;o7.prototype.DefaultInterpolation=2300;o7.prototype.InterpolantFactoryMethodLinear=void 0;o7.prototype.InterpolantFactoryMethodSmooth=void 0;class O7 extends R8{constructor(J,Q,$,Z){super(J,Q,$,Z)}}O7.prototype.ValueTypeName="vector";class _W{constructor(J="",Q=-1,$=[],Z=2500){if(this.name=J,this.tracks=$,this.duration=Q,this.blendMode=Z,this.uuid=v8(),this.userData={},this.duration<0)this.resetDuration()}static parse(J){let Q=[],$=J.tracks,Z=1/(J.fps||1);for(let K=0,H=$.length;K!==H;++K)Q.push(aF($[K]).scale(Z));let W=new this(J.name,J.duration,Q,J.blendMode);return W.uuid=J.uuid,W.userData=JSON.parse(J.userData||"{}"),W}static toJSON(J){let Q=[],$=J.tracks,Z={name:J.name,duration:J.duration,tracks:Q,uuid:J.uuid,blendMode:J.blendMode,userData:JSON.stringify(J.userData)};for(let W=0,K=$.length;W!==K;++W)Q.push(R8.toJSON($[W]));return Z}static CreateFromMorphTargetSequence(J,Q,$,Z){let W=Q.length,K=[];for(let H=0;H1){let G=U[1],q=Z[G];if(!q)Z[G]=q=[];q.push(Y)}}let K=[];for(let H in Z)K.push(this.CreateFromMorphTargetSequence(H,Z[H],Q,$));return K}static parseAnimation(J,Q){if(j0("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!J)return d0("AnimationClip: No animation in JSONLoader data."),null;let $=function(G,q,N,R,M){if(N.length!==0){let E=[],F=[];if(PG(N,E,F,R),E.length!==0)M.push(new G(q,E,F))}},Z=[],W=J.name||"default",K=J.fps||30,H=J.blendMode,X=J.length||-1,Y=J.hierarchy||[];for(let G=0;G{if(Q)Q(W);this.manager.itemEnd(J)},0),W;if(R7[J]!==void 0){R7[J].push({onLoad:Q,onProgress:$,onError:Z});return}R7[J]=[],R7[J].push({onLoad:Q,onProgress:$,onError:Z});let K=new Request(J,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any==="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),H=this.mimeType,X=this.responseType;fetch(K).then((Y)=>{if(Y.status===200||Y.status===0){if(Y.status===0)j0("FileLoader: HTTP Status 0 received.");if(typeof ReadableStream==="undefined"||Y.body===void 0||Y.body.getReader===void 0)return Y;let U=R7[J],G=Y.body.getReader(),q=Y.headers.get("X-File-Size")||Y.headers.get("Content-Length"),N=q?parseInt(q):0,R=N!==0,M=0,E=new ReadableStream({start(F){O();function O(){G.read().then(({done:k,value:D})=>{if(k)F.close();else{M+=D.byteLength;let B=new ProgressEvent("progress",{lengthComputable:R,loaded:M,total:N});for(let A=0,C=U.length;A{F.error(k)})}}});return new Response(E)}else throw new wG(`fetch for "${Y.url}" responded with ${Y.status}: ${Y.statusText}`,Y)}).then((Y)=>{switch(X){case"arraybuffer":return Y.arrayBuffer();case"blob":return Y.blob();case"document":return Y.text().then((U)=>{return new DOMParser().parseFromString(U,H)});case"json":return Y.json();default:if(H==="")return Y.text();else{let G=/charset="?([^;"\s]*)"?/i.exec(H),q=G&&G[1]?G[1].toLowerCase():void 0,N=new TextDecoder(q);return Y.arrayBuffer().then((R)=>N.decode(R))}}}).then((Y)=>{o8.add(`file:${J}`,Y);let U=R7[J];delete R7[J];for(let G=0,q=U.length;G{let U=R7[J];if(U===void 0)throw this.manager.itemError(J),Y;delete R7[J];for(let G=0,q=U.length;G{this.manager.itemEnd(J)}),this.manager.itemStart(J)}setResponseType(J){return this.responseType=J,this}setMimeType(J){return this.mimeType=J,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}var R$=new WeakMap;class jX extends z7{constructor(J){super(J)}load(J,Q,$,Z){if(this.path!==void 0)J=this.path+J;J=this.manager.resolveURL(J);let W=this,K=o8.get(`image:${J}`);if(K!==void 0){if(K.complete===!0)W.manager.itemStart(J),setTimeout(function(){if(Q)Q(K);W.manager.itemEnd(J)},0);else{let G=R$.get(K);if(G===void 0)G=[],R$.set(K,G);G.push({onLoad:Q,onError:Z})}return K}let H=E$("img");function X(){if(U(),Q)Q(this);let G=R$.get(this)||[];for(let q=0;q{if(FH.has(K)===!0){if(Z)Z(FH.get(K));W.manager.itemError(J),W.manager.itemEnd(J)}else{if(Q)Q(Y);return W.manager.itemEnd(J),Y}});return}return setTimeout(function(){if(Q)Q(K);W.manager.itemEnd(J)},0),K}let H={};H.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",H.headers=this.requestHeader,H.signal=typeof AbortSignal.any==="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let X=fetch(J,H).then(function(Y){return Y.blob()}).then(function(Y){return createImageBitmap(Y,Object.assign(W.options,{colorSpaceConversion:"none"}))}).then(function(Y){if(o8.add(`image-bitmap:${J}`,Y),Q)Q(Y);return W.manager.itemEnd(J),Y}).catch(function(Y){if(Z)Z(Y);FH.set(X,Y),o8.remove(`image-bitmap:${J}`),W.manager.itemError(J),W.manager.itemEnd(J)});o8.add(`image-bitmap:${J}`,X),W.manager.itemStart(J)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class _X extends ZJ{constructor(J=[]){super();this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=J}}class vW{constructor(J=!0){this.autoStart=J,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let J=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let Q=performance.now();J=(Q-this.oldTime)/1000,this.oldTime=Q,this.elapsedTime+=J}return J}}var xX="\\[\\]\\.:\\/",rF=new RegExp("["+xX+"]","g"),bX="[^"+xX+"]",tF="[^"+xX.replace("\\.","")+"]",eF=/((?:WC+[\/:])*)/.source.replace("WC",bX),JE=/(WCOD+)?/.source.replace("WCOD",tF),QE=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",bX),$E=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",bX),ZE=new RegExp("^"+eF+JE+QE+$E+"$"),WE=["material","materials","bones","map"];class _G{constructor(J,Q,$){let Z=$||M9.parseTrackName(Q);this._targetGroup=J,this._bindings=J.subscribe_(Q,Z)}getValue(J,Q){this.bind();let $=this._targetGroup.nCachedObjects_,Z=this._bindings[$];if(Z!==void 0)Z.getValue(J,Q)}setValue(J,Q){let $=this._bindings;for(let Z=this._targetGroup.nCachedObjects_,W=$.length;Z!==W;++Z)$[Z].setValue(J,Q)}bind(){let J=this._bindings;for(let Q=this._targetGroup.nCachedObjects_,$=J.length;Q!==$;++Q)J[Q].bind()}unbind(){let J=this._bindings;for(let Q=this._targetGroup.nCachedObjects_,$=J.length;Q!==$;++Q)J[Q].unbind()}}class M9{constructor(J,Q,$){this.path=Q,this.parsedPath=$||M9.parseTrackName(Q),this.node=M9.findNode(J,this.parsedPath.nodeName),this.rootNode=J,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(J,Q,$){if(!(J&&J.isAnimationObjectGroup))return new M9(J,Q,$);else return new M9.Composite(J,Q,$)}static sanitizeNodeName(J){return J.replace(/\s/g,"_").replace(rF,"")}static parseTrackName(J){let Q=ZE.exec(J);if(Q===null)throw new Error("PropertyBinding: Cannot parse trackName: "+J);let $={nodeName:Q[2],objectName:Q[3],objectIndex:Q[4],propertyName:Q[5],propertyIndex:Q[6]},Z=$.nodeName&&$.nodeName.lastIndexOf(".");if(Z!==void 0&&Z!==-1){let W=$.nodeName.substring(Z+1);if(WE.indexOf(W)!==-1)$.nodeName=$.nodeName.substring(0,Z),$.objectName=W}if($.propertyName===null||$.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+J);return $}static findNode(J,Q){if(Q===void 0||Q===""||Q==="."||Q===-1||Q===J.name||Q===J.uuid)return J;if(J.skeleton){let $=J.skeleton.getBoneByName(Q);if($!==void 0)return $}if(J.children){let $=function(W){for(let K=0;KR.start-M.start);let N=0;for(let R=1;R 0 vec4 plane; #ifdef ALPHA_TO_COVERAGE float distanceToPlane, distanceGradient; float clipOpacity = 1.0; #pragma unroll_loop_start for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; distanceGradient = fwidth( distanceToPlane ) / 2.0; clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); if ( clipOpacity == 0.0 ) discard; } #pragma unroll_loop_end #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES float unionClipOpacity = 1.0; #pragma unroll_loop_start for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; distanceGradient = fwidth( distanceToPlane ) / 2.0; unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); } #pragma unroll_loop_end clipOpacity *= 1.0 - unionClipOpacity; #endif diffuseColor.a *= clipOpacity; if ( diffuseColor.a == 0.0 ) discard; #else #pragma unroll_loop_start for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; } #pragma unroll_loop_end #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES bool clipped = true; #pragma unroll_loop_start for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; } #pragma unroll_loop_end if ( clipped ) discard; #endif #endif #endif`,kE=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`,CE=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; #endif`,IE=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; #endif`,PE=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; #endif`,AE=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; #endif`,wE=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) varying vec3 vColor; #endif`,SE=`#if defined( USE_COLOR_ALPHA ) vColor = vec4( 1.0 ); #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) vColor = vec3( 1.0 ); #endif #ifdef USE_COLOR vColor *= color; #endif #ifdef USE_INSTANCING_COLOR vColor.xyz *= instanceColor.xyz; #endif #ifdef USE_BATCHING_COLOR vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); vColor.xyz *= batchingColor.xyz; #endif`,TE=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 #define RECIPROCAL_PI2 0.15915494309189535 #define EPSILON 1e-6 #ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif #define whiteComplement( a ) ( 1.0 - saturate( a ) ) float pow2( const in float x ) { return x*x; } vec3 pow2( const in vec3 x ) { return x*x; } float pow3( const in float x ) { return x*x*x; } float pow4( const in float x ) { float x2 = x*x; return x2*x2; } float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } highp float rand( const in vec2 uv ) { const highp float a = 12.9898, b = 78.233, c = 43758.5453; highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); return fract( sin( sn ) * c ); } #ifdef HIGH_PRECISION float precisionSafeLength( vec3 v ) { return length( v ); } #else float precisionSafeLength( vec3 v ) { float maxComponent = max3( abs( v ) ); return length( v / maxComponent ) * maxComponent; } #endif struct IncidentLight { vec3 color; vec3 direction; bool visible; }; struct ReflectedLight { vec3 directDiffuse; vec3 directSpecular; vec3 indirectDiffuse; vec3 indirectSpecular; }; #ifdef USE_ALPHAHASH varying vec3 vPosition; #endif vec3 transformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); } bool isPerspectiveMatrix( mat4 m ) { return m[ 2 ][ 3 ] == - 1.0; } vec2 equirectUv( in vec3 dir ) { float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; return vec2( u, v ); } vec3 BRDF_Lambert( const in vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor; } vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); } float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); } // validated`,jE=`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_minMipLevel 4.0 #define cubeUV_minTileSize 16.0 float getFace( vec3 direction ) { vec3 absDirection = abs( direction ); float face = - 1.0; if ( absDirection.x > absDirection.z ) { if ( absDirection.x > absDirection.y ) face = direction.x > 0.0 ? 0.0 : 3.0; else face = direction.y > 0.0 ? 1.0 : 4.0; } else { if ( absDirection.z > absDirection.y ) face = direction.z > 0.0 ? 2.0 : 5.0; else face = direction.y > 0.0 ? 1.0 : 4.0; } return face; } vec2 getUV( vec3 direction, float face ) { vec2 uv; if ( face == 0.0 ) { uv = vec2( direction.z, direction.y ) / abs( direction.x ); } else if ( face == 1.0 ) { uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); } else if ( face == 2.0 ) { uv = vec2( - direction.x, direction.y ) / abs( direction.z ); } else if ( face == 3.0 ) { uv = vec2( - direction.z, direction.y ) / abs( direction.x ); } else if ( face == 4.0 ) { uv = vec2( - direction.x, direction.z ) / abs( direction.y ); } else { uv = vec2( direction.x, direction.y ) / abs( direction.z ); } return 0.5 * ( uv + 1.0 ); } vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { float face = getFace( direction ); float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); mipInt = max( mipInt, cubeUV_minMipLevel ); float faceSize = exp2( mipInt ); highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; if ( face > 2.0 ) { uv.y += faceSize; face -= 3.0; } uv.x += face * faceSize; uv.x += filterInt * 3.0 * cubeUV_minTileSize; uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); uv.x *= CUBEUV_TEXEL_WIDTH; uv.y *= CUBEUV_TEXEL_HEIGHT; #ifdef texture2DGradEXT return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; #else return texture2D( envMap, uv ).rgb; #endif } #define cubeUV_r0 1.0 #define cubeUV_m0 - 2.0 #define cubeUV_r1 0.8 #define cubeUV_m1 - 1.0 #define cubeUV_r4 0.4 #define cubeUV_m4 2.0 #define cubeUV_r5 0.305 #define cubeUV_m5 3.0 #define cubeUV_r6 0.21 #define cubeUV_m6 4.0 float roughnessToMip( float roughness ) { float mip = 0.0; if ( roughness >= cubeUV_r1 ) { mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; } else if ( roughness >= cubeUV_r4 ) { mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; } else if ( roughness >= cubeUV_r5 ) { mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; } else if ( roughness >= cubeUV_r6 ) { mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; } else { mip = - 2.0 * log2( 1.16 * roughness ); } return mip; } vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); float mipF = fract( mip ); float mipInt = floor( mip ); vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); if ( mipF == 0.0 ) { return vec4( color0, 1.0 ); } else { vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); return vec4( mix( color0, color1, mipF ), 1.0 ); } } #endif`,_E=`vec3 transformedNormal = objectNormal; #ifdef USE_TANGENT vec3 transformedTangent = objectTangent; #endif #ifdef USE_BATCHING mat3 bm = mat3( batchingMatrix ); transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); transformedNormal = bm * transformedNormal; #ifdef USE_TANGENT transformedTangent = bm * transformedTangent; #endif #endif #ifdef USE_INSTANCING mat3 im = mat3( instanceMatrix ); transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); transformedNormal = im * transformedNormal; #ifdef USE_TANGENT transformedTangent = im * transformedTangent; #endif #endif transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedNormal = - transformedNormal; #endif #ifdef USE_TANGENT transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif #endif`,xE=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; #endif`,bE=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); #endif`,yE=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE emissiveColor = sRGBTransferEOTF( emissiveColor ); #endif totalEmissiveRadiance *= emissiveColor.rgb; #endif`,hE=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; #endif`,fE="gl_FragColor = linearToOutputTexel( gl_FragColor );",vE=`vec4 LinearTransferOETF( in vec4 value ) { return value; } vec4 sRGBTransferEOTF( in vec4 value ) { 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 ); } vec4 sRGBTransferOETF( in vec4 value ) { 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 ); }`,gE=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); } else { cameraToFrag = normalize( vWorldPosition - cameraPosition ); } vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); #ifdef ENVMAP_MODE_REFLECTION vec3 reflectVec = reflect( cameraToFrag, worldNormal ); #else vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); #endif #else vec3 reflectVec = vReflect; #endif #ifdef ENVMAP_TYPE_CUBE vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); #else vec4 envColor = vec4( 0.0 ); #endif #ifdef ENVMAP_BLENDING_MULTIPLY outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); #elif defined( ENVMAP_BLENDING_MIX ) outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif #endif`,pE=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; uniform mat3 envMapRotation; #ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #else uniform sampler2D envMap; #endif #endif`,mE=`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif #ifdef ENV_WORLDPOS varying vec3 vWorldPosition; uniform float refractionRatio; #else varying vec3 vReflect; #endif #endif`,dE=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif #ifdef ENV_WORLDPOS varying vec3 vWorldPosition; #else varying vec3 vReflect; uniform float refractionRatio; #endif #endif`,uE=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else vec3 cameraToVertex; if ( isOrthographic ) { cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); } else { cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); } vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); #ifdef ENVMAP_MODE_REFLECTION vReflect = reflect( cameraToVertex, worldNormal ); #else vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif #endif`,lE=`#ifdef USE_FOG vFogDepth = - mvPosition.z; #endif`,cE=`#ifdef USE_FOG varying float vFogDepth; #endif`,sE=`#ifdef USE_FOG #ifdef FOG_EXP2 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); #else float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); #endif gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); #endif`,nE=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 uniform float fogDensity; #else uniform float fogNear; uniform float fogFar; #endif #endif`,oE=`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { float dotNL = dot( normal, lightDirection ); vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); #ifdef USE_GRADIENTMAP return vec3( texture2D( gradientMap, coord ).r ); #else vec2 fw = fwidth( coord ) * 0.5; return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); #endif }`,iE=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; #endif`,aE=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularStrength = specularStrength;`,rE=`varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; }; void 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 ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void 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 ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Lambert #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,tE=`uniform bool receiveShadow; uniform vec3 ambientLightColor; #if defined( USE_LIGHT_PROBES ) uniform vec3 lightProbe[ 9 ]; #endif vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { float x = normal.x, y = normal.y, z = normal.z; vec3 result = shCoefficients[ 0 ] * 0.886227; result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); return result; } vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); return irradiance; } vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { vec3 irradiance = ambientLightColor; return irradiance; } float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); if ( cutoffDistance > 0.0 ) { distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); } return distanceFalloff; } float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { return smoothstep( coneCosine, penumbraCosine, angleCosine ); } #if NUM_DIR_LIGHTS > 0 struct DirectionalLight { vec3 direction; vec3 color; }; uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { light.color = directionalLight.color; light.direction = directionalLight.direction; light.visible = true; } #endif #if NUM_POINT_LIGHTS > 0 struct PointLight { vec3 position; vec3 color; float distance; float decay; }; uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { vec3 lVector = pointLight.position - geometryPosition; light.direction = normalize( lVector ); float lightDistance = length( lVector ); light.color = pointLight.color; light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); light.visible = ( light.color != vec3( 0.0 ) ); } #endif #if NUM_SPOT_LIGHTS > 0 struct SpotLight { vec3 position; vec3 direction; vec3 color; float distance; float decay; float coneCos; float penumbraCos; }; uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { vec3 lVector = spotLight.position - geometryPosition; light.direction = normalize( lVector ); float angleCos = dot( light.direction, spotLight.direction ); float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); if ( spotAttenuation > 0.0 ) { float lightDistance = length( lVector ); light.color = spotLight.color * spotAttenuation; light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); light.visible = ( light.color != vec3( 0.0 ) ); } else { light.color = vec3( 0.0 ); light.visible = false; } } #endif #if NUM_RECT_AREA_LIGHTS > 0 struct RectAreaLight { vec3 color; vec3 position; vec3 halfWidth; vec3 halfHeight; }; uniform sampler2D ltc_1; uniform sampler2D ltc_2; uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; #endif #if NUM_HEMI_LIGHTS > 0 struct HemisphereLight { vec3 direction; vec3 skyColor; vec3 groundColor; }; uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { float dotNL = dot( normal, hemiLight.direction ); float hemiDiffuseWeight = 0.5 * dotNL + 0.5; vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); return irradiance; } #endif`,eE=`#ifdef USE_ENVMAP vec3 getIBLIrradiance( const in vec3 normal ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); return PI * envMapColor.rgb * envMapIntensity; #else return vec3( 0.0 ); #endif } vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 reflectVec = reflect( - viewDir, normal ); reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) ); reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); return envMapColor.rgb * envMapIntensity; #else return vec3( 0.0 ); #endif } #ifdef USE_ANISOTROPY vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 bentNormal = cross( bitangent, viewDir ); bentNormal = normalize( cross( bentNormal, bitangent ) ); bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); return getIBLRadiance( viewDir, bentNormal, roughness ); #else return vec3( 0.0 ); #endif } #endif #endif`,JO=`ToonMaterial material; material.diffuseColor = diffuseColor.rgb;`,QO=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; void 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 ) { vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void 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 ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,$O=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; material.specularStrength = specularStrength;`,ZO=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; float specularShininess; float specularStrength; }; void 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 ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; } void 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 ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,WO=`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb; material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); material.metalness = metalnessFactor; vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; material.roughness = min( material.roughness, 1.0 ); #ifdef IOR material.ior = ior; #ifdef USE_SPECULAR float specularIntensityFactor = specularIntensity; vec3 specularColorFactor = specularColor; #ifdef USE_SPECULAR_COLORMAP specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; #endif #ifdef USE_SPECULAR_INTENSITYMAP specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; #endif material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); #else float specularIntensityFactor = 1.0; vec3 specularColorFactor = vec3( 1.0 ); material.specularF90 = 1.0; #endif material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor; material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); #else material.specularColor = vec3( 0.04 ); material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); material.specularF90 = 1.0; #endif #ifdef USE_CLEARCOAT material.clearcoat = clearcoat; material.clearcoatRoughness = clearcoatRoughness; material.clearcoatF0 = vec3( 0.04 ); material.clearcoatF90 = 1.0; #ifdef USE_CLEARCOATMAP material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; #endif material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); material.clearcoatRoughness += geometryRoughness; material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); #endif #ifdef USE_DISPERSION material.dispersion = dispersion; #endif #ifdef USE_IRIDESCENCE material.iridescence = iridescence; material.iridescenceIOR = iridescenceIOR; #ifdef USE_IRIDESCENCEMAP material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; #else material.iridescenceThickness = iridescenceThicknessMaximum; #endif #endif #ifdef USE_SHEEN material.sheenColor = sheenColor; #ifdef USE_SHEEN_COLORMAP material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; #endif material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 ); #ifdef USE_SHEEN_ROUGHNESSMAP material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; #endif #endif #ifdef USE_ANISOTROPY #ifdef USE_ANISOTROPYMAP mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; #else vec2 anisotropyV = anisotropyVector; #endif material.anisotropy = length( anisotropyV ); if( material.anisotropy == 0.0 ) { anisotropyV = vec2( 1.0, 0.0 ); } else { anisotropyV /= material.anisotropy; material.anisotropy = saturate( material.anisotropy ); } material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; #endif`,KO=`uniform sampler2D dfgLUT; struct PhysicalMaterial { vec3 diffuseColor; vec3 diffuseContribution; vec3 specularColor; vec3 specularColorBlended; float roughness; float metalness; float specularF90; float dispersion; #ifdef USE_CLEARCOAT float clearcoat; float clearcoatRoughness; vec3 clearcoatF0; float clearcoatF90; #endif #ifdef USE_IRIDESCENCE float iridescence; float iridescenceIOR; float iridescenceThickness; vec3 iridescenceFresnel; vec3 iridescenceF0; vec3 iridescenceFresnelDielectric; vec3 iridescenceFresnelMetallic; #endif #ifdef USE_SHEEN vec3 sheenColor; float sheenRoughness; #endif #ifdef IOR float ior; #endif #ifdef USE_TRANSMISSION float transmission; float transmissionAlpha; float thickness; float attenuationDistance; vec3 attenuationColor; #endif #ifdef USE_ANISOTROPY float anisotropy; float alphaT; vec3 anisotropyT; vec3 anisotropyB; #endif }; vec3 clearcoatSpecularDirect = vec3( 0.0 ); vec3 clearcoatSpecularIndirect = vec3( 0.0 ); vec3 sheenSpecularDirect = vec3( 0.0 ); vec3 sheenSpecularIndirect = vec3(0.0 ); vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); float x2 = x * x; float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); } float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { float a2 = pow2( alpha ); float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); return 0.5 / max( gv + gl, EPSILON ); } float D_GGX( const in float alpha, const in float dotNH ) { float a2 = pow2( alpha ); float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; return RECIPROCAL_PI * a2 / pow2( denom ); } #ifdef USE_ANISOTROPY 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 ) { float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); float v = 0.5 / ( gv + gl ); return v; } float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { float a2 = alphaT * alphaB; highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); highp float v2 = dot( v, v ); float w2 = a2 / v2; return RECIPROCAL_PI * a2 * pow2 ( w2 ); } #endif #ifdef USE_CLEARCOAT vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { vec3 f0 = material.clearcoatF0; float f90 = material.clearcoatF90; float roughness = material.clearcoatRoughness; float alpha = pow2( roughness ); vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float dotVH = saturate( dot( viewDir, halfDir ) ); vec3 F = F_Schlick( f0, f90, dotVH ); float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); float D = D_GGX( alpha, dotNH ); return F * ( V * D ); } #endif vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { vec3 f0 = material.specularColorBlended; float f90 = material.specularF90; float roughness = material.roughness; float alpha = pow2( roughness ); vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float dotVH = saturate( dot( viewDir, halfDir ) ); vec3 F = F_Schlick( f0, f90, dotVH ); #ifdef USE_IRIDESCENCE F = mix( F, material.iridescenceFresnel, material.iridescence ); #endif #ifdef USE_ANISOTROPY float dotTL = dot( material.anisotropyT, lightDir ); float dotTV = dot( material.anisotropyT, viewDir ); float dotTH = dot( material.anisotropyT, halfDir ); float dotBL = dot( material.anisotropyB, lightDir ); float dotBV = dot( material.anisotropyB, viewDir ); float dotBH = dot( material.anisotropyB, halfDir ); float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); #else float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); float D = D_GGX( alpha, dotNH ); #endif return F * ( V * D ); } vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { const float LUT_SIZE = 64.0; const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; const float LUT_BIAS = 0.5 / LUT_SIZE; float dotNV = saturate( dot( N, V ) ); vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); uv = uv * LUT_SCALE + LUT_BIAS; return uv; } float LTC_ClippedSphereFormFactor( const in vec3 f ) { float l = length( f ); return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); } vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { float x = dot( v1, v2 ); float y = abs( x ); float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; float b = 3.4175940 + ( 4.1616724 + y ) * y; float v = a / b; float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; return cross( v1, v2 ) * theta_sintheta; } vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; vec3 lightNormal = cross( v1, v2 ); if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); vec3 T1, T2; T1 = normalize( V - N * dot( V, N ) ); T2 = - cross( N, T1 ); mat3 mat = mInv * transpose( mat3( T1, T2, N ) ); vec3 coords[ 4 ]; coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); coords[ 0 ] = normalize( coords[ 0 ] ); coords[ 1 ] = normalize( coords[ 1 ] ); coords[ 2 ] = normalize( coords[ 2 ] ); coords[ 3 ] = normalize( coords[ 3 ] ); vec3 vectorFormFactor = vec3( 0.0 ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); return vec3( result ); } #if defined( USE_SHEEN ) float D_Charlie( float roughness, float dotNH ) { float alpha = pow2( roughness ); float invAlpha = 1.0 / alpha; float cos2h = dotNH * dotNH; float sin2h = max( 1.0 - cos2h, 0.0078125 ); return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); } float V_Neubelt( float dotNV, float dotNL ) { return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); } vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float D = D_Charlie( sheenRoughness, dotNH ); float V = V_Neubelt( dotNV, dotNL ); return sheenColor * ( D * V ); } #endif float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { float dotNV = saturate( dot( normal, viewDir ) ); float r2 = roughness * roughness; float rInv = 1.0 / ( roughness + 0.1 ); float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv; float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv; float DG = exp( a * dotNV + b ); return saturate( DG ); } vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { float dotNV = saturate( dot( normal, viewDir ) ); vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; return specularColor * fab.x + specularF90 * fab.y; } #ifdef USE_IRIDESCENCE void 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 ) { #else void 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 ) { #endif float dotNV = saturate( dot( normal, viewDir ) ); vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; #ifdef USE_IRIDESCENCE vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); #else vec3 Fr = specularColor; #endif vec3 FssEss = Fr * fab.x + specularF90 * fab.y; float Ess = fab.x + fab.y; float Ems = 1.0 - Ess; vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); singleScatter += FssEss; multiScatter += Fms * Ems; } vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg; vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg; vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y; vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y; float Ess_V = dfgV.x + dfgV.y; float Ess_L = dfgL.x + dfgL.y; float Ems_V = 1.0 - Ess_V; float Ems_L = 1.0 - Ess_L; vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON ); float compensationFactor = Ems_V * Ems_L; vec3 multiScatter = Fms * compensationFactor; return singleScatter + multiScatter; } #if NUM_RECT_AREA_LIGHTS > 0 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 ) { vec3 normal = geometryNormal; vec3 viewDir = geometryViewDir; vec3 position = geometryPosition; vec3 lightPos = rectAreaLight.position; vec3 halfWidth = rectAreaLight.halfWidth; vec3 halfHeight = rectAreaLight.halfHeight; vec3 lightColor = rectAreaLight.color; float roughness = material.roughness; vec3 rectCoords[ 4 ]; rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; vec2 uv = LTC_Uv( normal, viewDir, roughness ); vec4 t1 = texture2D( ltc_1, uv ); vec4 t2 = texture2D( ltc_2, uv ); mat3 mInv = mat3( vec3( t1.x, 0, t1.y ), vec3( 0, 1, 0 ), vec3( t1.z, 0, t1.w ) ); vec3 fresnel = ( material.specularColorBlended * t2.x + ( vec3( 1.0 ) - material.specularColorBlended ) * t2.y ); reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); } #endif void 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 ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; #ifdef USE_CLEARCOAT float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); vec3 ccIrradiance = dotNLcc * directLight.color; clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); #endif #ifdef USE_SHEEN sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness ); float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL ); irradiance *= sheenEnergyComp; #endif reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material ); reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ); } void 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 ) { vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ); #ifdef USE_SHEEN float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; diffuse *= sheenEnergyComp; #endif reflectedLight.indirectDiffuse += diffuse; } void 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) { #ifdef USE_CLEARCOAT clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); #endif #ifdef USE_SHEEN sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI; #endif vec3 singleScatteringDielectric = vec3( 0.0 ); vec3 multiScatteringDielectric = vec3( 0.0 ); vec3 singleScatteringMetallic = vec3( 0.0 ); vec3 multiScatteringMetallic = vec3( 0.0 ); #ifdef USE_IRIDESCENCE computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); #else computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); #endif vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness ); vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness ); vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric; vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric ); vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; vec3 indirectSpecular = radiance * singleScattering; indirectSpecular += multiScattering * cosineWeightedIrradiance; vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance; #ifdef USE_SHEEN float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; indirectSpecular *= sheenEnergyComp; indirectDiffuse *= sheenEnergyComp; #endif reflectedLight.indirectSpecular += indirectSpecular; reflectedLight.indirectDiffuse += indirectDiffuse; } #define RE_Direct RE_Direct_Physical #define RE_Direct_RectArea RE_Direct_RectArea_Physical #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical #define RE_IndirectSpecular RE_IndirectSpecular_Physical float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); }`,HO=` vec3 geometryPosition = - vViewPosition; vec3 geometryNormal = normal; vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); vec3 geometryClearcoatNormal = vec3( 0.0 ); #ifdef USE_CLEARCOAT geometryClearcoatNormal = clearcoatNormal; #endif #ifdef USE_IRIDESCENCE float dotNVi = saturate( dot( normal, geometryViewDir ) ); if ( material.iridescenceThickness == 0.0 ) { material.iridescence = 0.0; } else { material.iridescence = saturate( material.iridescence ); } if ( material.iridescence > 0.0 ) { material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor ); material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness ); material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); } #endif IncidentLight directLight; #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) PointLight pointLight; #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 PointLightShadow pointLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { pointLight = pointLights[ i ]; getPointLightInfo( pointLight, geometryPosition, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) pointLightShadow = pointLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) SpotLight spotLight; vec4 spotColor; vec3 spotLightCoord; bool inSpotLightMap; #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 SpotLightShadow spotLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { spotLight = spotLights[ i ]; getSpotLightInfo( spotLight, geometryPosition, directLight ); #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS #else #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) #endif #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; #endif #undef SPOT_LIGHT_MAP_INDEX #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) spotLightShadow = spotLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) DirectionalLight directionalLight; #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 DirectionalLightShadow directionalLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { directionalLight = directionalLights[ i ]; getDirectionalLightInfo( directionalLight, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) directionalLightShadow = directionalLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) RectAreaLight rectAreaLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { rectAreaLight = rectAreaLights[ i ]; RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if defined( RE_IndirectDiffuse ) vec3 iblIrradiance = vec3( 0.0 ); vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); #if defined( USE_LIGHT_PROBES ) irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); #endif #if ( NUM_HEMI_LIGHTS > 0 ) #pragma unroll_loop_start for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); } #pragma unroll_loop_end #endif #endif #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); #endif`,XO=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; irradiance += lightMapIrradiance; #endif #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) iblIrradiance += getIBLIrradiance( geometryNormal ); #endif #endif #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) #ifdef USE_ANISOTROPY radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); #else radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); #endif #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); #endif #endif`,YO=`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif`,UO=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; #endif`,GO=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; #endif`,qO=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER varying float vFragDepth; varying float vIsPerspective; #endif`,NO=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); #endif`,RO=`#ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vMapUv ); #ifdef DECODE_VIDEO_TEXTURE sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); #endif diffuseColor *= sampledDiffuseColor; #endif`,FO=`#ifdef USE_MAP uniform sampler2D map; #endif`,EO=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) #if defined( USE_POINTS_UV ) vec2 uv = vUv; #else vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; #endif #endif #ifdef USE_MAP diffuseColor *= texture2D( map, uv ); #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; #endif`,OO=`#if defined( USE_POINTS_UV ) varying vec2 vUv; #else #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) uniform mat3 uvTransform; #endif #endif #ifdef USE_MAP uniform sampler2D map; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; #endif`,MO=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; #endif`,LO=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; #endif`,BO=`#ifdef USE_INSTANCING_MORPH float morphTargetInfluences[ MORPHTARGETS_COUNT ]; float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; } #endif`,DO=`#if defined( USE_MORPHCOLORS ) vColor *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { #if defined( USE_COLOR_ALPHA ) if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; #elif defined( USE_COLOR ) if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } #endif`,zO=`#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; } #endif`,VO=`#ifdef USE_MORPHTARGETS #ifndef USE_INSTANCING_MORPH uniform float morphTargetBaseInfluence; uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; #endif uniform sampler2DArray morphTargetsTexture; uniform ivec2 morphTargetsTextureSize; vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; int y = texelIndex / morphTargetsTextureSize.x; int x = texelIndex - y * morphTargetsTextureSize.x; ivec3 morphUV = ivec3( x, y, morphTargetIndex ); return texelFetch( morphTargetsTexture, morphUV, 0 ); } #endif`,kO=`#ifdef USE_MORPHTARGETS transformed *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; } #endif`,CO=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = dFdx( vViewPosition ); vec3 fdy = dFdy( vViewPosition ); vec3 normal = normalize( cross( fdx, fdy ) ); #else vec3 normal = normalize( vNormal ); #ifdef DOUBLE_SIDED normal *= faceDirection; #endif #endif #if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) #ifdef USE_TANGENT mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); #else mat3 tbn = getTangentFrame( - vViewPosition, normal, #if defined( USE_NORMALMAP ) vNormalMapUv #elif defined( USE_CLEARCOAT_NORMALMAP ) vClearcoatNormalMapUv #else vUv #endif ); #endif #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) tbn[0] *= faceDirection; tbn[1] *= faceDirection; #endif #endif #ifdef USE_CLEARCOAT_NORMALMAP #ifdef USE_TANGENT mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); #else mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); #endif #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) tbn2[0] *= faceDirection; tbn2[1] *= faceDirection; #endif #endif vec3 nonPerturbedNormal = normal;`,IO=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; #endif #ifdef DOUBLE_SIDED normal = normal * faceDirection; #endif normal = normalize( normalMatrix * normal ); #elif defined( USE_NORMALMAP_TANGENTSPACE ) vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; mapN.xy *= normalScale; normal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); #endif`,PO=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,AO=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,wO=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif #endif`,SO=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif #ifdef USE_NORMALMAP_OBJECTSPACE uniform mat3 normalMatrix; #endif #if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { vec3 q0 = dFdx( eye_pos.xyz ); vec3 q1 = dFdy( eye_pos.xyz ); vec2 st0 = dFdx( uv.st ); vec2 st1 = dFdy( uv.st ); vec3 N = surf_norm; vec3 q1perp = cross( q1, N ); vec3 q0perp = cross( N, q0 ); vec3 T = q1perp * st0.x + q0perp * st1.x; vec3 B = q1perp * st0.y + q0perp * st1.y; float det = max( dot( T, T ), dot( B, B ) ); float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); return mat3( T * scale, B * scale, N ); } #endif`,TO=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = nonPerturbedNormal; #endif`,jO=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); #endif`,_O=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP uniform sampler2D clearcoatNormalMap; uniform vec2 clearcoatNormalScale; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; #endif`,xO=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; #endif`,bO=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,yO=`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { return 2.0 * rgb.xyz - 1.0; } const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; const float Inv255 = 1. / 255.; const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); vec4 packDepthToRGBA( const in float v ) { if( v <= 0.0 ) return vec4( 0., 0., 0., 0. ); if( v >= 1.0 ) return vec4( 1., 1., 1., 1. ); float vuf; float af = modf( v * PackFactors.a, vuf ); float bf = modf( vuf * ShiftRight8, vuf ); float gf = modf( vuf * ShiftRight8, vuf ); return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); } vec3 packDepthToRGB( const in float v ) { if( v <= 0.0 ) return vec3( 0., 0., 0. ); if( v >= 1.0 ) return vec3( 1., 1., 1. ); float vuf; float bf = modf( v * PackFactors.b, vuf ); float gf = modf( vuf * ShiftRight8, vuf ); return vec3( vuf * Inv255, gf * PackUpscale, bf ); } vec2 packDepthToRG( const in float v ) { if( v <= 0.0 ) return vec2( 0., 0. ); if( v >= 1.0 ) return vec2( 1., 1. ); float vuf; float gf = modf( v * 256., vuf ); return vec2( vuf * Inv255, gf ); } float unpackRGBAToDepth( const in vec4 v ) { return dot( v, UnpackFactors4 ); } float unpackRGBToDepth( const in vec3 v ) { return dot( v, UnpackFactors3 ); } float unpackRGToDepth( const in vec2 v ) { return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; } vec4 pack2HalfToRGBA( const in vec2 v ) { vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); } vec2 unpackRGBATo2Half( const in vec4 v ) { return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); } float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { return ( viewZ + near ) / ( near - far ); } float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { return depth * ( near - far ) - near; } float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); } float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { return ( near * far ) / ( ( far - near ) * depth - far ); }`,hO=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; #endif`,fO=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING mvPosition = batchingMatrix * mvPosition; #endif #ifdef USE_INSTANCING mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; gl_Position = projectionMatrix * mvPosition;`,vO=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); #endif`,gO=`#ifdef DITHERING vec3 dithering( vec3 color ) { float grid_position = rand( gl_FragCoord.xy ); vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); return color + dither_shift_RGB; } #endif`,pO=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; #endif`,mO=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; #endif`,dO=`#if NUM_SPOT_LIGHT_COORDS > 0 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #if NUM_SPOT_LIGHT_MAPS > 0 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; #endif #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 #if defined( SHADOWMAP_TYPE_PCF ) uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; #else uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; #endif varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; struct DirectionalLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 #if defined( SHADOWMAP_TYPE_PCF ) uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; #else uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; #endif struct SpotLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; #endif #if NUM_POINT_LIGHT_SHADOWS > 0 #if defined( SHADOWMAP_TYPE_PCF ) uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; #elif defined( SHADOWMAP_TYPE_BASIC ) uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; #endif varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; struct PointLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif #if defined( SHADOWMAP_TYPE_PCF ) float interleavedGradientNoise( vec2 position ) { return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) ); } vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) { const float goldenAngle = 2.399963229728653; float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) ); float theta = float( sampleIndex ) * goldenAngle + phi; return vec2( cos( theta ), sin( theta ) ) * r; } #endif #if defined( SHADOWMAP_TYPE_PCF ) float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { float shadow = 1.0; shadowCoord.xyz /= shadowCoord.w; shadowCoord.z += shadowBias; bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; bool frustumTest = inFrustum && shadowCoord.z <= 1.0; if ( frustumTest ) { vec2 texelSize = vec2( 1.0 ) / shadowMapSize; float radius = shadowRadius * texelSize.x; float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718; shadow = ( texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) ) ) * 0.2; } return mix( 1.0, shadow, shadowIntensity ); } #elif defined( SHADOWMAP_TYPE_VSM ) float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { float shadow = 1.0; shadowCoord.xyz /= shadowCoord.w; shadowCoord.z += shadowBias; bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; bool frustumTest = inFrustum && shadowCoord.z <= 1.0; if ( frustumTest ) { vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg; float mean = distribution.x; float variance = distribution.y * distribution.y; #ifdef USE_REVERSED_DEPTH_BUFFER float hard_shadow = step( mean, shadowCoord.z ); #else float hard_shadow = step( shadowCoord.z, mean ); #endif if ( hard_shadow == 1.0 ) { shadow = 1.0; } else { variance = max( variance, 0.0000001 ); float d = shadowCoord.z - mean; float p_max = variance / ( variance + d * d ); p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 ); shadow = max( hard_shadow, p_max ); } } return mix( 1.0, shadow, shadowIntensity ); } #else float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { float shadow = 1.0; shadowCoord.xyz /= shadowCoord.w; shadowCoord.z += shadowBias; bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; bool frustumTest = inFrustum && shadowCoord.z <= 1.0; if ( frustumTest ) { float depth = texture2D( shadowMap, shadowCoord.xy ).r; #ifdef USE_REVERSED_DEPTH_BUFFER shadow = step( depth, shadowCoord.z ); #else shadow = step( shadowCoord.z, depth ); #endif } return mix( 1.0, shadow, shadowIntensity ); } #endif #if NUM_POINT_LIGHT_SHADOWS > 0 #if defined( SHADOWMAP_TYPE_PCF ) float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { float shadow = 1.0; vec3 lightToPosition = shadowCoord.xyz; vec3 bd3D = normalize( lightToPosition ); vec3 absVec = abs( lightToPosition ); float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); dp += shadowBias; float texelSize = shadowRadius / shadowMapSize.x; vec3 absDir = abs( bd3D ); vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 ); tangent = normalize( cross( bd3D, tangent ) ); vec3 bitangent = cross( bd3D, tangent ); float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718; shadow = ( texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 0, 5, phi ).x + bitangent * vogelDiskSample( 0, 5, phi ).y ) * texelSize, dp ) ) + texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 1, 5, phi ).x + bitangent * vogelDiskSample( 1, 5, phi ).y ) * texelSize, dp ) ) + texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 2, 5, phi ).x + bitangent * vogelDiskSample( 2, 5, phi ).y ) * texelSize, dp ) ) + texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 3, 5, phi ).x + bitangent * vogelDiskSample( 3, 5, phi ).y ) * texelSize, dp ) ) + texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 4, 5, phi ).x + bitangent * vogelDiskSample( 4, 5, phi ).y ) * texelSize, dp ) ) ) * 0.2; } return mix( 1.0, shadow, shadowIntensity ); } #elif defined( SHADOWMAP_TYPE_BASIC ) float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { float shadow = 1.0; vec3 lightToPosition = shadowCoord.xyz; vec3 bd3D = normalize( lightToPosition ); vec3 absVec = abs( lightToPosition ); float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); dp += shadowBias; float depth = textureCube( shadowMap, bd3D ).r; #ifdef USE_REVERSED_DEPTH_BUFFER shadow = step( depth, dp ); #else shadow = step( dp, depth ); #endif } return mix( 1.0, shadow, shadowIntensity ); } #endif #endif #endif`,uO=`#if NUM_SPOT_LIGHT_COORDS > 0 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; struct DirectionalLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 struct SpotLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; #endif #if NUM_POINT_LIGHT_SHADOWS > 0 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; struct PointLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif #endif`,lO=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); vec4 shadowWorldPosition; #endif #if defined( USE_SHADOWMAP ) #if NUM_DIR_LIGHT_SHADOWS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif #if NUM_POINT_LIGHT_SHADOWS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif #endif #if NUM_SPOT_LIGHT_COORDS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { shadowWorldPosition = worldPosition; #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; #endif vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif`,cO=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 DirectionalLightShadow directionalLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { directionalLight = directionalLightShadows[ i ]; shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; } #pragma unroll_loop_end #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 SpotLightShadow spotLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { spotLight = spotLightShadows[ i ]; shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; } #pragma unroll_loop_end #endif #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) PointLightShadow pointLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { pointLight = pointLightShadows[ i ]; shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; } #pragma unroll_loop_end #endif #endif return shadow; }`,sO=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); #endif`,nO=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; mat4 getBoneMatrix( const in float i ) { int size = textureSize( boneTexture, 0 ).x; int j = int( i ) * 4; int x = j % size; int y = j / size; vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); return mat4( v1, v2, v3, v4 ); } #endif`,oO=`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; skinned += boneMatY * skinVertex * skinWeight.y; skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; #endif`,iO=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; skinMatrix += skinWeight.z * boneMatZ; skinMatrix += skinWeight.w * boneMatW; skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif #endif`,aO=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; #endif`,rO=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; #endif`,tO=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); #endif`,eO=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; vec3 LinearToneMapping( vec3 color ) { return saturate( toneMappingExposure * color ); } vec3 ReinhardToneMapping( vec3 color ) { color *= toneMappingExposure; return saturate( color / ( vec3( 1.0 ) + color ) ); } vec3 CineonToneMapping( vec3 color ) { color *= toneMappingExposure; color = max( vec3( 0.0 ), color - 0.004 ); return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); } vec3 RRTAndODTFit( vec3 v ) { vec3 a = v * ( v + 0.0245786 ) - 0.000090537; vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; return a / b; } vec3 ACESFilmicToneMapping( vec3 color ) { const mat3 ACESInputMat = mat3( vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), vec3( 0.04823, 0.01566, 0.83777 ) ); const mat3 ACESOutputMat = mat3( vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), vec3( -0.07367, -0.00605, 1.07602 ) ); color *= toneMappingExposure / 0.6; color = ACESInputMat * color; color = RRTAndODTFit( color ); color = ACESOutputMat * color; return saturate( color ); } const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( vec3( 1.6605, - 0.1246, - 0.0182 ), vec3( - 0.5876, 1.1329, - 0.1006 ), vec3( - 0.0728, - 0.0083, 1.1187 ) ); const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( vec3( 0.6274, 0.0691, 0.0164 ), vec3( 0.3293, 0.9195, 0.0880 ), vec3( 0.0433, 0.0113, 0.8956 ) ); vec3 agxDefaultContrastApprox( vec3 x ) { vec3 x2 = x * x; vec3 x4 = x2 * x2; return + 15.5 * x4 * x2 - 40.14 * x4 * x + 31.96 * x4 - 6.868 * x2 * x + 0.4298 * x2 + 0.1191 * x - 0.00232; } vec3 AgXToneMapping( vec3 color ) { const mat3 AgXInsetMatrix = mat3( vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) ); const mat3 AgXOutsetMatrix = mat3( vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) ); const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; color *= toneMappingExposure; color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; color = AgXInsetMatrix * color; color = max( color, 1e-10 ); color = log2( color ); color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); color = clamp( color, 0.0, 1.0 ); color = agxDefaultContrastApprox( color ); color = AgXOutsetMatrix * color; color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); color = LINEAR_REC2020_TO_LINEAR_SRGB * color; color = clamp( color, 0.0, 1.0 ); return color; } vec3 NeutralToneMapping( vec3 color ) { const float StartCompression = 0.8 - 0.04; const float Desaturation = 0.15; color *= toneMappingExposure; float x = min( color.r, min( color.g, color.b ) ); float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; color -= offset; float peak = max( color.r, max( color.g, color.b ) ); if ( peak < StartCompression ) return color; float d = 1. - StartCompression; float newPeak = 1. - d * d / ( peak + d - StartCompression ); color *= newPeak / peak; float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); return mix( color, vec3( newPeak ), g ); } vec3 CustomToneMapping( vec3 color ) { return color; }`,JM=`#ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; material.attenuationDistance = attenuationDistance; material.attenuationColor = attenuationColor; #ifdef USE_TRANSMISSIONMAP material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; #endif #ifdef USE_THICKNESSMAP material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; #endif vec3 pos = vWorldPosition; vec3 v = normalize( cameraPosition - pos ); vec3 n = inverseTransformDirection( normal, viewMatrix ); vec4 transmitted = getIBLVolumeRefraction( n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90, pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); #endif`,QM=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; uniform vec3 attenuationColor; #ifdef USE_TRANSMISSIONMAP uniform sampler2D transmissionMap; #endif #ifdef USE_THICKNESSMAP uniform sampler2D thicknessMap; #endif uniform vec2 transmissionSamplerSize; uniform sampler2D transmissionSamplerMap; uniform mat4 modelMatrix; uniform mat4 projectionMatrix; varying vec3 vWorldPosition; float w0( float a ) { return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); } float w1( float a ) { return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); } float w2( float a ){ return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); } float w3( float a ) { return ( 1.0 / 6.0 ) * ( a * a * a ); } float g0( float a ) { return w0( a ) + w1( a ); } float g1( float a ) { return w2( a ) + w3( a ); } float h0( float a ) { return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); } float h1( float a ) { return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); } vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { uv = uv * texelSize.zw + 0.5; vec2 iuv = floor( uv ); vec2 fuv = fract( uv ); float g0x = g0( fuv.x ); float g1x = g1( fuv.x ); float h0x = h0( fuv.x ); float h1x = h1( fuv.x ); float h0y = h0( fuv.y ); float h1y = h1( fuv.y ); vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); } vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); vec2 fLodSizeInv = 1.0 / fLodSize; vec2 cLodSizeInv = 1.0 / cLodSize; vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); return mix( fSample, cSample, fract( lod ) ); } vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); vec3 modelScale; modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); return normalize( refractionVector ) * thickness * modelScale; } float applyIorToRoughness( const in float roughness, const in float ior ) { return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); } vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); } vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { if ( isinf( attenuationDistance ) ) { return vec3( 1.0 ); } else { vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; } } vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, const in vec3 attenuationColor, const in float attenuationDistance ) { vec4 transmittedLight; vec3 transmittance; #ifdef USE_DISPERSION float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); for ( int i = 0; i < 3; i ++ ) { vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); vec3 refractedRayExit = position + transmissionRay; vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); vec2 refractionCoords = ndcPos.xy / ndcPos.w; refractionCoords += 1.0; refractionCoords /= 2.0; vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); transmittedLight[ i ] = transmissionSample[ i ]; transmittedLight.a += transmissionSample.a; transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; } transmittedLight.a /= 3.0; #else vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); vec3 refractedRayExit = position + transmissionRay; vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); vec2 refractionCoords = ndcPos.xy / ndcPos.w; refractionCoords += 1.0; refractionCoords /= 2.0; transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); #endif vec3 attenuatedColor = transmittance * transmittedLight.rgb; vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); } #endif`,$M=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP varying vec2 vMapUv; #endif #ifdef USE_ALPHAMAP varying vec2 vAlphaMapUv; #endif #ifdef USE_LIGHTMAP varying vec2 vLightMapUv; #endif #ifdef USE_AOMAP varying vec2 vAoMapUv; #endif #ifdef USE_BUMPMAP varying vec2 vBumpMapUv; #endif #ifdef USE_NORMALMAP varying vec2 vNormalMapUv; #endif #ifdef USE_EMISSIVEMAP varying vec2 vEmissiveMapUv; #endif #ifdef USE_METALNESSMAP varying vec2 vMetalnessMapUv; #endif #ifdef USE_ROUGHNESSMAP varying vec2 vRoughnessMapUv; #endif #ifdef USE_ANISOTROPYMAP varying vec2 vAnisotropyMapUv; #endif #ifdef USE_CLEARCOATMAP varying vec2 vClearcoatMapUv; #endif #ifdef USE_CLEARCOAT_NORMALMAP varying vec2 vClearcoatNormalMapUv; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP varying vec2 vClearcoatRoughnessMapUv; #endif #ifdef USE_IRIDESCENCEMAP varying vec2 vIridescenceMapUv; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP varying vec2 vIridescenceThicknessMapUv; #endif #ifdef USE_SHEEN_COLORMAP varying vec2 vSheenColorMapUv; #endif #ifdef USE_SHEEN_ROUGHNESSMAP varying vec2 vSheenRoughnessMapUv; #endif #ifdef USE_SPECULARMAP varying vec2 vSpecularMapUv; #endif #ifdef USE_SPECULAR_COLORMAP varying vec2 vSpecularColorMapUv; #endif #ifdef USE_SPECULAR_INTENSITYMAP varying vec2 vSpecularIntensityMapUv; #endif #ifdef USE_TRANSMISSIONMAP uniform mat3 transmissionMapTransform; varying vec2 vTransmissionMapUv; #endif #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; #endif`,ZM=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP uniform mat3 mapTransform; varying vec2 vMapUv; #endif #ifdef USE_ALPHAMAP uniform mat3 alphaMapTransform; varying vec2 vAlphaMapUv; #endif #ifdef USE_LIGHTMAP uniform mat3 lightMapTransform; varying vec2 vLightMapUv; #endif #ifdef USE_AOMAP uniform mat3 aoMapTransform; varying vec2 vAoMapUv; #endif #ifdef USE_BUMPMAP uniform mat3 bumpMapTransform; varying vec2 vBumpMapUv; #endif #ifdef USE_NORMALMAP uniform mat3 normalMapTransform; varying vec2 vNormalMapUv; #endif #ifdef USE_DISPLACEMENTMAP uniform mat3 displacementMapTransform; varying vec2 vDisplacementMapUv; #endif #ifdef USE_EMISSIVEMAP uniform mat3 emissiveMapTransform; varying vec2 vEmissiveMapUv; #endif #ifdef USE_METALNESSMAP uniform mat3 metalnessMapTransform; varying vec2 vMetalnessMapUv; #endif #ifdef USE_ROUGHNESSMAP uniform mat3 roughnessMapTransform; varying vec2 vRoughnessMapUv; #endif #ifdef USE_ANISOTROPYMAP uniform mat3 anisotropyMapTransform; varying vec2 vAnisotropyMapUv; #endif #ifdef USE_CLEARCOATMAP uniform mat3 clearcoatMapTransform; varying vec2 vClearcoatMapUv; #endif #ifdef USE_CLEARCOAT_NORMALMAP uniform mat3 clearcoatNormalMapTransform; varying vec2 vClearcoatNormalMapUv; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform mat3 clearcoatRoughnessMapTransform; varying vec2 vClearcoatRoughnessMapUv; #endif #ifdef USE_SHEEN_COLORMAP uniform mat3 sheenColorMapTransform; varying vec2 vSheenColorMapUv; #endif #ifdef USE_SHEEN_ROUGHNESSMAP uniform mat3 sheenRoughnessMapTransform; varying vec2 vSheenRoughnessMapUv; #endif #ifdef USE_IRIDESCENCEMAP uniform mat3 iridescenceMapTransform; varying vec2 vIridescenceMapUv; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform mat3 iridescenceThicknessMapTransform; varying vec2 vIridescenceThicknessMapUv; #endif #ifdef USE_SPECULARMAP uniform mat3 specularMapTransform; varying vec2 vSpecularMapUv; #endif #ifdef USE_SPECULAR_COLORMAP uniform mat3 specularColorMapTransform; varying vec2 vSpecularColorMapUv; #endif #ifdef USE_SPECULAR_INTENSITYMAP uniform mat3 specularIntensityMapTransform; varying vec2 vSpecularIntensityMapUv; #endif #ifdef USE_TRANSMISSIONMAP uniform mat3 transmissionMapTransform; varying vec2 vTransmissionMapUv; #endif #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; #endif`,WM=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) vUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; #endif #ifdef USE_ALPHAMAP vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; #endif #ifdef USE_LIGHTMAP vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; #endif #ifdef USE_AOMAP vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; #endif #ifdef USE_BUMPMAP vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; #endif #ifdef USE_NORMALMAP vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; #endif #ifdef USE_DISPLACEMENTMAP vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; #endif #ifdef USE_EMISSIVEMAP vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; #endif #ifdef USE_METALNESSMAP vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_ROUGHNESSMAP vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_ANISOTROPYMAP vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOATMAP vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOAT_NORMALMAP vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_IRIDESCENCEMAP vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_SHEEN_COLORMAP vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; #endif #ifdef USE_SHEEN_ROUGHNESSMAP vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULARMAP vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULAR_COLORMAP vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULAR_INTENSITYMAP vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; #endif #ifdef USE_TRANSMISSIONMAP vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; #endif`,KM=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 vec4 worldPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING worldPosition = batchingMatrix * worldPosition; #endif #ifdef USE_INSTANCING worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; #endif`,HM=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); }`,XM=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { vec4 texColor = texture2D( t2D, vUv ); #ifdef DECODE_VIDEO_TEXTURE 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 ); #endif texColor.rgb *= backgroundIntensity; gl_FragColor = texColor; #include #include }`,YM=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,UM=`#ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #elif defined( ENVMAP_TYPE_CUBE_UV ) uniform sampler2D envMap; #endif uniform float flipEnvMap; uniform float backgroundBlurriness; uniform float backgroundIntensity; uniform mat3 backgroundRotation; varying vec3 vWorldDirection; #include void main() { #ifdef ENVMAP_TYPE_CUBE vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); #elif defined( ENVMAP_TYPE_CUBE_UV ) vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); #else vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); #endif texColor.rgb *= backgroundIntensity; gl_FragColor = texColor; #include #include }`,GM=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,qM=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; void main() { vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); gl_FragColor = texColor; gl_FragColor.a *= opacity; #include #include }`,NM=`#include #include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { #include #include #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vHighPrecisionZW = gl_Position.zw; }`,RM=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include #include #include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { vec4 diffuseColor = vec4( 1.0 ); #include #if DEPTH_PACKING == 3200 diffuseColor.a = opacity; #endif #include #include #include #include #include #ifdef USE_REVERSED_DEPTH_BUFFER float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; #else float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; #endif #if DEPTH_PACKING == 3200 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); #elif DEPTH_PACKING == 3201 gl_FragColor = packDepthToRGBA( fragCoordZ ); #elif DEPTH_PACKING == 3202 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); #elif DEPTH_PACKING == 3203 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); #endif }`,FM=`#define DISTANCE varying vec3 vWorldPosition; #include #include #include #include #include #include #include void main() { #include #include #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vWorldPosition = worldPosition.xyz; }`,EM=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; varying vec3 vWorldPosition; #include #include #include #include #include #include #include void main () { vec4 diffuseColor = vec4( 1.0 ); #include #include #include #include #include float dist = length( vWorldPosition - referencePosition ); dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); }`,OM=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include }`,MM=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include }`,LM=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include #include #include #include #include #include #include void main() { vLineDistance = scale * lineDistance; #include #include #include #include #include #include #include #include #include #include }`,BM=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; varying float vLineDistance; #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include if ( mod( vLineDistance, totalSize ) > dashSize ) { discard; } vec3 outgoingLight = vec3( 0.0 ); #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include #include }`,DM=`#include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) #include #include #include #include #include #endif #include #include #include #include #include #include #include #include #include }`,zM=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include #include #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; #else reflectedLight.indirectDiffuse += vec3( 1.0 ); #endif #include reflectedLight.indirectDiffuse *= diffuseColor.rgb; vec3 outgoingLight = reflectedLight.indirectDiffuse; #include #include #include #include #include #include #include }`,VM=`#define LAMBERT varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #include }`,kM=`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include #include #include #include #include #include #include }`,CM=`#define MATCAP varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; }`,IM=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include #include #include #include vec3 viewDir = normalize( vViewPosition ); vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); vec3 y = cross( viewDir, x ); vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; #ifdef USE_MATCAP vec4 matcapColor = texture2D( matcap, uv ); #else vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); #endif vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; #include #include #include #include #include #include }`,PM=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) vViewPosition = - mvPosition.xyz; #endif }`,AM=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); #include #include #include #include gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a ); #ifdef OPAQUE gl_FragColor.a = 1.0; #endif }`,wM=`#define PHONG varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #include }`,SM=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; uniform float shininess; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; #include #include #include #include #include #include #include }`,TM=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; #endif #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif }`,jM=`#define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR #endif uniform vec3 diffuse; uniform vec3 emissive; uniform float roughness; uniform float metalness; uniform float opacity; #ifdef IOR uniform float ior; #endif #ifdef USE_SPECULAR uniform float specularIntensity; uniform vec3 specularColor; #ifdef USE_SPECULAR_COLORMAP uniform sampler2D specularColorMap; #endif #ifdef USE_SPECULAR_INTENSITYMAP uniform sampler2D specularIntensityMap; #endif #endif #ifdef USE_CLEARCOAT uniform float clearcoat; uniform float clearcoatRoughness; #endif #ifdef USE_DISPERSION uniform float dispersion; #endif #ifdef USE_IRIDESCENCE uniform float iridescence; uniform float iridescenceIOR; uniform float iridescenceThicknessMinimum; uniform float iridescenceThicknessMaximum; #endif #ifdef USE_SHEEN uniform vec3 sheenColor; uniform float sheenRoughness; #ifdef USE_SHEEN_COLORMAP uniform sampler2D sheenColorMap; #endif #ifdef USE_SHEEN_ROUGHNESSMAP uniform sampler2D sheenRoughnessMap; #endif #endif #ifdef USE_ANISOTROPY uniform vec2 anisotropyVector; #ifdef USE_ANISOTROPYMAP uniform sampler2D anisotropyMap; #endif #endif varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; #include vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; #ifdef USE_SHEEN outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect; #endif #ifdef USE_CLEARCOAT float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; #endif #include #include #include #include #include #include }`,_M=`#define TOON varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include }`,xM=`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include #include #include #include #include #include }`,bM=`uniform float size; uniform float scale; #include #include #include #include #include #include #ifdef USE_POINTS_UV varying vec2 vUv; uniform mat3 uvTransform; #endif void main() { #ifdef USE_POINTS_UV vUv = ( uvTransform * vec3( uv, 1 ) ).xy; #endif #include #include #include #include #include #include gl_PointSize = size; #ifdef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); #endif #include #include #include #include }`,yM=`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include vec3 outgoingLight = vec3( 0.0 ); #include #include #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include #include }`,hM=`#include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include }`,fM=`uniform vec3 color; uniform float opacity; #include #include #include #include #include #include #include void main() { #include gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); #include #include #include }`,vM=`uniform float rotation; uniform vec2 center; #include #include #include #include #include void main() { #include vec4 mvPosition = modelViewMatrix[ 3 ]; vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); #ifndef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) scale *= - mvPosition.z; #endif vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; vec2 rotatedPosition; rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; mvPosition.xy += rotatedPosition; gl_Position = projectionMatrix * mvPosition; #include #include #include }`,gM=`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include vec3 outgoingLight = vec3( 0.0 ); #include #include #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include }`,J9={alphahash_fragment:XE,alphahash_pars_fragment:YE,alphamap_fragment:UE,alphamap_pars_fragment:GE,alphatest_fragment:qE,alphatest_pars_fragment:NE,aomap_fragment:RE,aomap_pars_fragment:FE,batching_pars_vertex:EE,batching_vertex:OE,begin_vertex:ME,beginnormal_vertex:LE,bsdfs:BE,iridescence_fragment:DE,bumpmap_pars_fragment:zE,clipping_planes_fragment:VE,clipping_planes_pars_fragment:kE,clipping_planes_pars_vertex:CE,clipping_planes_vertex:IE,color_fragment:PE,color_pars_fragment:AE,color_pars_vertex:wE,color_vertex:SE,common:TE,cube_uv_reflection_fragment:jE,defaultnormal_vertex:_E,displacementmap_pars_vertex:xE,displacementmap_vertex:bE,emissivemap_fragment:yE,emissivemap_pars_fragment:hE,colorspace_fragment:fE,colorspace_pars_fragment:vE,envmap_fragment:gE,envmap_common_pars_fragment:pE,envmap_pars_fragment:mE,envmap_pars_vertex:dE,envmap_physical_pars_fragment:eE,envmap_vertex:uE,fog_vertex:lE,fog_pars_vertex:cE,fog_fragment:sE,fog_pars_fragment:nE,gradientmap_pars_fragment:oE,lightmap_pars_fragment:iE,lights_lambert_fragment:aE,lights_lambert_pars_fragment:rE,lights_pars_begin:tE,lights_toon_fragment:JO,lights_toon_pars_fragment:QO,lights_phong_fragment:$O,lights_phong_pars_fragment:ZO,lights_physical_fragment:WO,lights_physical_pars_fragment:KO,lights_fragment_begin:HO,lights_fragment_maps:XO,lights_fragment_end:YO,logdepthbuf_fragment:UO,logdepthbuf_pars_fragment:GO,logdepthbuf_pars_vertex:qO,logdepthbuf_vertex:NO,map_fragment:RO,map_pars_fragment:FO,map_particle_fragment:EO,map_particle_pars_fragment:OO,metalnessmap_fragment:MO,metalnessmap_pars_fragment:LO,morphinstance_vertex:BO,morphcolor_vertex:DO,morphnormal_vertex:zO,morphtarget_pars_vertex:VO,morphtarget_vertex:kO,normal_fragment_begin:CO,normal_fragment_maps:IO,normal_pars_fragment:PO,normal_pars_vertex:AO,normal_vertex:wO,normalmap_pars_fragment:SO,clearcoat_normal_fragment_begin:TO,clearcoat_normal_fragment_maps:jO,clearcoat_pars_fragment:_O,iridescence_pars_fragment:xO,opaque_fragment:bO,packing:yO,premultiplied_alpha_fragment:hO,project_vertex:fO,dithering_fragment:vO,dithering_pars_fragment:gO,roughnessmap_fragment:pO,roughnessmap_pars_fragment:mO,shadowmap_pars_fragment:dO,shadowmap_pars_vertex:uO,shadowmap_vertex:lO,shadowmask_pars_fragment:cO,skinbase_vertex:sO,skinning_pars_vertex:nO,skinning_vertex:oO,skinnormal_vertex:iO,specularmap_fragment:aO,specularmap_pars_fragment:rO,tonemapping_fragment:tO,tonemapping_pars_fragment:eO,transmission_fragment:JM,transmission_pars_fragment:QM,uv_pars_fragment:$M,uv_pars_vertex:ZM,uv_vertex:WM,worldpos_vertex:KM,background_vert:HM,background_frag:XM,backgroundCube_vert:YM,backgroundCube_frag:UM,cube_vert:GM,cube_frag:qM,depth_vert:NM,depth_frag:RM,distance_vert:FM,distance_frag:EM,equirect_vert:OM,equirect_frag:MM,linedashed_vert:LM,linedashed_frag:BM,meshbasic_vert:DM,meshbasic_frag:zM,meshlambert_vert:VM,meshlambert_frag:kM,meshmatcap_vert:CM,meshmatcap_frag:IM,meshnormal_vert:PM,meshnormal_frag:AM,meshphong_vert:wM,meshphong_frag:SM,meshphysical_vert:TM,meshphysical_frag:jM,meshtoon_vert:_M,meshtoon_frag:xM,points_vert:bM,points_frag:yM,shadow_vert:hM,shadow_frag:fM,sprite_vert:vM,sprite_frag:gM},E0={common:{diffuse:{value:new l0(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new t0},alphaMap:{value:null},alphaMapTransform:{value:new t0},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new t0}},envmap:{envMap:{value:null},envMapRotation:{value:new t0},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:0.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new t0}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new t0}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new t0},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new t0},normalScale:{value:new g0(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new t0},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new t0}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new t0}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new t0}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:0.00025},fogNear:{value:1},fogFar:{value:2000},fogColor:{value:new l0(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 l0(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new t0},alphaTest:{value:0},uvTransform:{value:new t0}},sprite:{diffuse:{value:new l0(16777215)},opacity:{value:1},center:{value:new g0(0.5,0.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new t0},alphaMap:{value:null},alphaMapTransform:{value:new t0},alphaTest:{value:0}}},t8={basic:{uniforms:PJ([E0.common,E0.specularmap,E0.envmap,E0.aomap,E0.lightmap,E0.fog]),vertexShader:J9.meshbasic_vert,fragmentShader:J9.meshbasic_frag},lambert:{uniforms:PJ([E0.common,E0.specularmap,E0.envmap,E0.aomap,E0.lightmap,E0.emissivemap,E0.bumpmap,E0.normalmap,E0.displacementmap,E0.fog,E0.lights,{emissive:{value:new l0(0)}}]),vertexShader:J9.meshlambert_vert,fragmentShader:J9.meshlambert_frag},phong:{uniforms:PJ([E0.common,E0.specularmap,E0.envmap,E0.aomap,E0.lightmap,E0.emissivemap,E0.bumpmap,E0.normalmap,E0.displacementmap,E0.fog,E0.lights,{emissive:{value:new l0(0)},specular:{value:new l0(1118481)},shininess:{value:30}}]),vertexShader:J9.meshphong_vert,fragmentShader:J9.meshphong_frag},standard:{uniforms:PJ([E0.common,E0.envmap,E0.aomap,E0.lightmap,E0.emissivemap,E0.bumpmap,E0.normalmap,E0.displacementmap,E0.roughnessmap,E0.metalnessmap,E0.fog,E0.lights,{emissive:{value:new l0(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:J9.meshphysical_vert,fragmentShader:J9.meshphysical_frag},toon:{uniforms:PJ([E0.common,E0.aomap,E0.lightmap,E0.emissivemap,E0.bumpmap,E0.normalmap,E0.displacementmap,E0.gradientmap,E0.fog,E0.lights,{emissive:{value:new l0(0)}}]),vertexShader:J9.meshtoon_vert,fragmentShader:J9.meshtoon_frag},matcap:{uniforms:PJ([E0.common,E0.bumpmap,E0.normalmap,E0.displacementmap,E0.fog,{matcap:{value:null}}]),vertexShader:J9.meshmatcap_vert,fragmentShader:J9.meshmatcap_frag},points:{uniforms:PJ([E0.points,E0.fog]),vertexShader:J9.points_vert,fragmentShader:J9.points_frag},dashed:{uniforms:PJ([E0.common,E0.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:J9.linedashed_vert,fragmentShader:J9.linedashed_frag},depth:{uniforms:PJ([E0.common,E0.displacementmap]),vertexShader:J9.depth_vert,fragmentShader:J9.depth_frag},normal:{uniforms:PJ([E0.common,E0.bumpmap,E0.normalmap,E0.displacementmap,{opacity:{value:1}}]),vertexShader:J9.meshnormal_vert,fragmentShader:J9.meshnormal_frag},sprite:{uniforms:PJ([E0.sprite,E0.fog]),vertexShader:J9.sprite_vert,fragmentShader:J9.sprite_frag},background:{uniforms:{uvTransform:{value:new t0},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:J9.background_vert,fragmentShader:J9.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new t0}},vertexShader:J9.backgroundCube_vert,fragmentShader:J9.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:J9.cube_vert,fragmentShader:J9.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:J9.equirect_vert,fragmentShader:J9.equirect_frag},distance:{uniforms:PJ([E0.common,E0.displacementmap,{referencePosition:{value:new f},nearDistance:{value:1},farDistance:{value:1000}}]),vertexShader:J9.distance_vert,fragmentShader:J9.distance_frag},shadow:{uniforms:PJ([E0.lights,E0.fog,{color:{value:new l0(0)},opacity:{value:1}}]),vertexShader:J9.shadow_vert,fragmentShader:J9.shadow_frag}};t8.physical={uniforms:PJ([t8.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new t0},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new t0},clearcoatNormalScale:{value:new g0(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new t0},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new t0},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new t0},sheen:{value:0},sheenColor:{value:new l0(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new t0},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new t0},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new t0},transmissionSamplerSize:{value:new g0},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new t0},attenuationDistance:{value:0},attenuationColor:{value:new l0(0)},specularColor:{value:new l0(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new t0},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new t0},anisotropyVector:{value:new g0},anisotropyMap:{value:null},anisotropyMapTransform:{value:new t0}}]),vertexShader:J9.meshphysical_vert,fragmentShader:J9.meshphysical_frag};var pW={r:0,b:0,g:0},IQ=new g8,pM=new r0;function mM(J,Q,$,Z,W,K,H){let X=new l0(0),Y=K===!0?0:1,U,G,q=null,N=0,R=null;function M(D){let B=D.isScene===!0?D.background:null;if(B&&B.isTexture)B=(D.backgroundBlurriness>0?$:Q).get(B);return B}function E(D){let B=!1,A=M(D);if(A===null)O(X,Y);else if(A&&A.isColor)O(A,1),B=!0;let C=J.xr.getEnvironmentBlendMode();if(C==="additive")Z.buffers.color.setClear(0,0,0,1,H);else if(C==="alpha-blend")Z.buffers.color.setClear(0,0,0,0,H);if(J.autoClear||B)Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),J.clear(J.autoClearColor,J.autoClearDepth,J.autoClearStencil)}function F(D,B){let A=M(B);if(A&&(A.isCubeTexture||A.mapping===BZ)){if(G===void 0)G=new i9(new A$(1,1,1),new fJ({name:"BackgroundCubeMaterial",uniforms:VQ(t8.backgroundCube.uniforms),vertexShader:t8.backgroundCube.vertexShader,fragmentShader:t8.backgroundCube.fragmentShader,side:U8,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),G.geometry.deleteAttribute("normal"),G.geometry.deleteAttribute("uv"),G.onBeforeRender=function(C,w,T){this.matrixWorld.copyPosition(T.matrixWorld)},Object.defineProperty(G.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),W.update(G);if(IQ.copy(B.backgroundRotation),IQ.x*=-1,IQ.y*=-1,IQ.z*=-1,A.isCubeTexture&&A.isRenderTargetTexture===!1)IQ.y*=-1,IQ.z*=-1;if(G.material.uniforms.envMap.value=A,G.material.uniforms.flipEnvMap.value=A.isCubeTexture&&A.isRenderTargetTexture===!1?-1:1,G.material.uniforms.backgroundBlurriness.value=B.backgroundBlurriness,G.material.uniforms.backgroundIntensity.value=B.backgroundIntensity,G.material.uniforms.backgroundRotation.value.setFromMatrix4(pM.makeRotationFromEuler(IQ)),G.material.toneMapped=X9.getTransfer(A.colorSpace)!==A9,q!==A||N!==A.version||R!==J.toneMapping)G.material.needsUpdate=!0,q=A,N=A.version,R=J.toneMapping;G.layers.enableAll(),D.unshift(G,G.geometry,G.material,0,0,null)}else if(A&&A.isTexture){if(U===void 0)U=new i9(new CQ(2,2),new fJ({name:"BackgroundMaterial",uniforms:VQ(t8.background.uniforms),vertexShader:t8.background.vertexShader,fragmentShader:t8.background.fragmentShader,side:d7,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),U.geometry.deleteAttribute("normal"),Object.defineProperty(U.material,"map",{get:function(){return this.uniforms.t2D.value}}),W.update(U);if(U.material.uniforms.t2D.value=A,U.material.uniforms.backgroundIntensity.value=B.backgroundIntensity,U.material.toneMapped=X9.getTransfer(A.colorSpace)!==A9,A.matrixAutoUpdate===!0)A.updateMatrix();if(U.material.uniforms.uvTransform.value.copy(A.matrix),q!==A||N!==A.version||R!==J.toneMapping)U.material.needsUpdate=!0,q=A,N=A.version,R=J.toneMapping;U.layers.enableAll(),D.unshift(U,U.geometry,U.material,0,0,null)}}function O(D,B){D.getRGB(pW,zX(J)),Z.buffers.color.setClear(pW.r,pW.g,pW.b,B,H)}function k(){if(G!==void 0)G.geometry.dispose(),G.material.dispose(),G=void 0;if(U!==void 0)U.geometry.dispose(),U.material.dispose(),U=void 0}return{getClearColor:function(){return X},setClearColor:function(D,B=1){X.set(D),Y=B,O(X,Y)},getClearAlpha:function(){return Y},setClearAlpha:function(D){Y=D,O(X,Y)},render:E,addToRenderList:F,dispose:k}}function dM(J,Q){let $=J.getParameter(J.MAX_VERTEX_ATTRIBS),Z={},W=N(null),K=W,H=!1;function X(V,_,b,p,v){let s=!1,m=q(p,b,_);if(K!==m)K=m,U(K.object);if(s=R(V,p,b,v),s)M(V,p,b,v);if(v!==null)Q.update(v,J.ELEMENT_ARRAY_BUFFER);if(s||H){if(H=!1,B(V,_,b,p),v!==null)J.bindBuffer(J.ELEMENT_ARRAY_BUFFER,Q.get(v).buffer)}}function Y(){return J.createVertexArray()}function U(V){return J.bindVertexArray(V)}function G(V){return J.deleteVertexArray(V)}function q(V,_,b){let p=b.wireframe===!0,v=Z[V.id];if(v===void 0)v={},Z[V.id]=v;let s=v[_.id];if(s===void 0)s={},v[_.id]=s;let m=s[p];if(m===void 0)m=N(Y()),s[p]=m;return m}function N(V){let _=[],b=[],p=[];for(let v=0;v<$;v++)_[v]=0,b[v]=0,p[v]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:_,enabledAttributes:b,attributeDivisors:p,object:V,attributes:{},index:null}}function R(V,_,b,p){let v=K.attributes,s=_.attributes,m=0,h=b.getAttributes();for(let c in h)if(h[c].location>=0){let j=v[c],Q0=s[c];if(Q0===void 0){if(c==="instanceMatrix"&&V.instanceMatrix)Q0=V.instanceMatrix;if(c==="instanceColor"&&V.instanceColor)Q0=V.instanceColor}if(j===void 0)return!0;if(j.attribute!==Q0)return!0;if(Q0&&j.data!==Q0.data)return!0;m++}if(K.attributesNum!==m)return!0;if(K.index!==p)return!0;return!1}function M(V,_,b,p){let v={},s=_.attributes,m=0,h=b.getAttributes();for(let c in h)if(h[c].location>=0){let j=s[c];if(j===void 0){if(c==="instanceMatrix"&&V.instanceMatrix)j=V.instanceMatrix;if(c==="instanceColor"&&V.instanceColor)j=V.instanceColor}let Q0={};if(Q0.attribute=j,j&&j.data)Q0.data=j.data;v[c]=Q0,m++}K.attributes=v,K.attributesNum=m,K.index=p}function E(){let V=K.newAttributes;for(let _=0,b=V.length;_=0){let t=v[h];if(t===void 0){if(h==="instanceMatrix"&&V.instanceMatrix)t=V.instanceMatrix;if(h==="instanceColor"&&V.instanceColor)t=V.instanceColor}if(t!==void 0){let{normalized:j,itemSize:Q0}=t,L0=Q.get(t);if(L0===void 0)continue;let{buffer:i0,type:b0,bytesPerElement:i}=L0,K0=b0===J.INT||b0===J.UNSIGNED_INT||t.gpuType===AH;if(t.isInterleavedBufferAttribute){let J0=t.data,k0=J0.stride,I0=t.offset;if(J0.isInstancedInterleavedBuffer){for(let y0=0;y00&&J.getShaderPrecisionFormat(J.FRAGMENT_SHADER,J.HIGH_FLOAT).precision>0)return"highp";w="mediump"}if(w==="mediump"){if(J.getShaderPrecisionFormat(J.VERTEX_SHADER,J.MEDIUM_FLOAT).precision>0&&J.getShaderPrecisionFormat(J.FRAGMENT_SHADER,J.MEDIUM_FLOAT).precision>0)return"mediump"}return"lowp"}let U=$.precision!==void 0?$.precision:"highp",G=Y(U);if(G!==U)j0("WebGLRenderer:",U,"not supported, using",G,"instead."),U=G;let q=$.logarithmicDepthBuffer===!0,N=$.reversedDepthBuffer===!0&&Q.has("EXT_clip_control"),R=J.getParameter(J.MAX_TEXTURE_IMAGE_UNITS),M=J.getParameter(J.MAX_VERTEX_TEXTURE_IMAGE_UNITS),E=J.getParameter(J.MAX_TEXTURE_SIZE),F=J.getParameter(J.MAX_CUBE_MAP_TEXTURE_SIZE),O=J.getParameter(J.MAX_VERTEX_ATTRIBS),k=J.getParameter(J.MAX_VERTEX_UNIFORM_VECTORS),D=J.getParameter(J.MAX_VARYING_VECTORS),B=J.getParameter(J.MAX_FRAGMENT_UNIFORM_VECTORS),A=J.getParameter(J.MAX_SAMPLES),C=J.getParameter(J.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:K,getMaxPrecision:Y,textureFormatReadable:H,textureTypeReadable:X,precision:U,logarithmicDepthBuffer:q,reversedDepthBuffer:N,maxTextures:R,maxVertexTextures:M,maxTextureSize:E,maxCubemapSize:F,maxAttributes:O,maxVertexUniforms:k,maxVaryings:D,maxFragmentUniforms:B,maxSamples:A,samples:C}}function cM(J){let Q=this,$=null,Z=0,W=!1,K=!1,H=new h8,X=new t0,Y={value:null,needsUpdate:!1};this.uniform=Y,this.numPlanes=0,this.numIntersection=0,this.init=function(q,N){let R=q.length!==0||N||Z!==0||W;return W=N,Z=q.length,R},this.beginShadows=function(){K=!0,G(null)},this.endShadows=function(){K=!1},this.setGlobalState=function(q,N){$=G(q,N,0)},this.setState=function(q,N,R){let{clippingPlanes:M,clipIntersection:E,clipShadows:F}=q,O=J.get(q);if(!W||M===null||M.length===0||K&&!F)if(K)G(null);else U();else{let k=K?0:Z,D=k*4,B=O.clippingState||null;Y.value=B,B=G(M,N,D,R);for(let A=0;A!==D;++A)B[A]=$[A];O.clippingState=B,this.numIntersection=E?this.numPlanes:0,this.numPlanes+=k}};function U(){if(Y.value!==$)Y.value=$,Y.needsUpdate=Z>0;Q.numPlanes=Z,Q.numIntersection=0}function G(q,N,R,M){let E=q!==null?q.length:0,F=null;if(E!==0){if(F=Y.value,M!==!0||F===null){let O=R+E*4,k=N.matrixWorldInverse;if(X.getNormalMatrix(k),F===null||F.length0){let U=new kW(Y.height);return U.fromEquirectangularTexture(J,H),Q.set(H,U),H.addEventListener("dispose",W),$(U.texture,H.mapping)}else return null}}return H}function W(H){let X=H.target;X.removeEventListener("dispose",W);let Y=Q.get(X);if(Y!==void 0)Q.delete(X),Y.dispose()}function K(){Q=new WeakMap}return{get:Z,dispose:K}}var a7=4,xG=[0.125,0.215,0.35,0.446,0.526,0.582],AQ=20,nM=256,hZ=new V7,bG=new l0,hX=null,fX=0,vX=0,gX=!1,oM=new f;class dX{constructor(J){this._renderer=J,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(J,Q=0,$=0.1,Z=100,W={}){let{size:K=256,position:H=oM}=W;hX=this._renderer.getRenderTarget(),fX=this._renderer.getActiveCubeFace(),vX=this._renderer.getActiveMipmapLevel(),gX=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(K);let X=this._allocateTargets();if(X.depthBuffer=!0,this._sceneToCubeUV(J,$,Z,X,H),Q>0)this._blur(X,0,0,Q);return this._applyPMREM(X),this._cleanup(X),X}fromEquirectangular(J,Q=null){return this._fromTexture(J,Q)}fromCubemap(J,Q=null){return this._fromTexture(J,Q)}compileCubemapShader(){if(this._cubemapMaterial===null)this._cubemapMaterial=fG(),this._compileMaterial(this._cubemapMaterial)}compileEquirectangularShader(){if(this._equirectMaterial===null)this._equirectMaterial=hG(),this._compileMaterial(this._equirectMaterial)}dispose(){if(this._dispose(),this._cubemapMaterial!==null)this._cubemapMaterial.dispose();if(this._equirectMaterial!==null)this._equirectMaterial.dispose();if(this._backgroundBox!==null)this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose()}_setSize(J){this._lodMax=Math.floor(Math.log2(J)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){if(this._blurMaterial!==null)this._blurMaterial.dispose();if(this._ggxMaterial!==null)this._ggxMaterial.dispose();if(this._pingPongRenderTarget!==null)this._pingPongRenderTarget.dispose();for(let J=0;J2?B:0,B,B),G.setRenderTarget(Z),F)G.render(M,X);G.render(J,X)}G.toneMapping=N,G.autoClear=q,J.background=O}_textureToCubeUV(J,Q){let $=this._renderer,Z=J.mapping===D$||J.mapping===MQ;if(Z){if(this._cubemapMaterial===null)this._cubemapMaterial=fG();this._cubemapMaterial.uniforms.flipEnvMap.value=J.isRenderTargetTexture===!1?-1:1}else if(this._equirectMaterial===null)this._equirectMaterial=hG();let W=Z?this._cubemapMaterial:this._equirectMaterial,K=this._lodMeshes[0];K.material=W;let H=W.uniforms;H.envMap.value=J;let X=this._cubeSize;_$(Q,0,0,3*X,2*X),$.setRenderTarget(Q),$.render(K,hZ)}_applyPMREM(J){let Q=this._renderer,$=Q.autoClear;Q.autoClear=!1;let Z=this._lodMeshes.length;for(let W=1;WR-a7?$-R+a7:0),F=4*(this._cubeSize-M);X.envMap.value=J.texture,X.roughness.value=N,X.mipInt.value=R-Q,_$(W,E,F,3*M,2*M),Z.setRenderTarget(W),Z.render(H,hZ),X.envMap.value=W.texture,X.roughness.value=0,X.mipInt.value=R-$,_$(J,E,F,3*M,2*M),Z.setRenderTarget(J),Z.render(H,hZ)}_blur(J,Q,$,Z,W){let K=this._pingPongRenderTarget;this._halfBlur(J,K,Q,$,Z,"latitudinal",W),this._halfBlur(K,J,$,$,Z,"longitudinal",W)}_halfBlur(J,Q,$,Z,W,K,H){let X=this._renderer,Y=this._blurMaterial;if(K!=="latitudinal"&&K!=="longitudinal")d0("blur direction must be either latitudinal or longitudinal!");let U=3,G=this._lodMeshes[Z];G.material=Y;let q=Y.uniforms,N=this._sizeLods[$]-1,R=isFinite(W)?Math.PI/(2*N):2*Math.PI/(2*AQ-1),M=W/R,E=isFinite(W)?1+Math.floor(U*M):AQ;if(E>AQ)j0(`sigmaRadians, ${W}, is too large and will clip, as it requested ${E} samples when the maximum is set to ${AQ}`);let F=[],O=0;for(let C=0;Ck-a7?Z-k+a7:0),A=4*(this._cubeSize-D);_$(Q,B,A,3*D,2*D),X.setRenderTarget(Q),X.render(G,hZ)}}function iM(J){let Q=[],$=[],Z=[],W=J,K=J-a7+1+xG.length;for(let H=0;HJ-a7)Y=xG[H-J+a7-1];else if(H===0)Y=0;$.push(Y);let U=1/(X-2),G=-U,q=1+U,N=[G,G,q,G,q,q,G,G,q,q,G,q],R=6,M=6,E=3,F=2,O=1,k=new Float32Array(E*M*R),D=new Float32Array(F*M*R),B=new Float32Array(O*M*R);for(let C=0;C2?0:-1,z=[w,T,0,w+0.6666666666666666,T,0,w+0.6666666666666666,T+1,0,w,T,0,w+0.6666666666666666,T+1,0,w,T+1,0];k.set(z,E*M*C),D.set(N,F*M*C);let V=[C,C,C,C,C,C];B.set(V,O*M*C)}let A=new MJ;if(A.setAttribute("position",new WJ(k,E)),A.setAttribute("uv",new WJ(D,F)),A.setAttribute("faceIndex",new WJ(B,O)),Z.push(new i9(A,null)),W>a7)W--}return{lodMeshes:Z,sizeLods:Q,sigmas:$}}function yG(J,Q,$){let Z=new aJ(J,Q,$);return Z.texture.mapping=BZ,Z.texture.name="PMREM.cubeUv",Z.scissorTest=!0,Z}function _$(J,Q,$,Z,W){J.viewport.set(Q,$,Z,W),J.scissor.set(Q,$,Z,W)}function aM(J,Q,$){return new fJ({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:nM,CUBEUV_TEXEL_WIDTH:1/Q,CUBEUV_TEXEL_HEIGHT:1/$,CUBEUV_MAX_MIP:`${J}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:dW(),fragmentShader:` precision highp float; precision highp int; varying vec3 vOutputDirection; uniform sampler2D envMap; uniform float roughness; uniform float mipInt; #define ENVMAP_TYPE_CUBE_UV #include #define PI 3.14159265359 // Van der Corput radical inverse float radicalInverse_VdC(uint bits) { bits = (bits << 16u) | (bits >> 16u); bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); return float(bits) * 2.3283064365386963e-10; // / 0x100000000 } // Hammersley sequence vec2 hammersley(uint i, uint N) { return vec2(float(i) / float(N), radicalInverse_VdC(i)); } // GGX VNDF importance sampling (Eric Heitz 2018) // "Sampling the GGX Distribution of Visible Normals" // https://jcgt.org/published/0007/04/01/ vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { float alpha = roughness * roughness; // Section 3.2: Transform view direction to hemisphere configuration vec3 Vh = normalize(vec3(alpha * V.x, alpha * V.y, V.z)); // Section 4.1: Orthonormal basis float lensq = Vh.x * Vh.x + Vh.y * Vh.y; vec3 T1 = lensq > 0.0 ? vec3(-Vh.y, Vh.x, 0.0) / sqrt(lensq) : vec3(1.0, 0.0, 0.0); vec3 T2 = cross(Vh, T1); // Section 4.2: Parameterization of projected area float r = sqrt(Xi.x); float phi = 2.0 * PI * Xi.y; float t1 = r * cos(phi); float t2 = r * sin(phi); float s = 0.5 * (1.0 + Vh.z); t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; // Section 4.3: Reprojection onto hemisphere vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * Vh; // Section 3.4: Transform back to ellipsoid configuration return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); } void main() { vec3 N = normalize(vOutputDirection); vec3 V = N; // Assume view direction equals normal for pre-filtering vec3 prefilteredColor = vec3(0.0); float totalWeight = 0.0; // For very low roughness, just sample the environment directly if (roughness < 0.001) { gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); return; } // Tangent space basis for VNDF sampling vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); vec3 tangent = normalize(cross(up, N)); vec3 bitangent = cross(N, tangent); for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); // For PMREM, V = N, so in tangent space V is always (0, 0, 1) vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); // Transform H back to world space vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); vec3 L = normalize(2.0 * dot(V, H) * H - V); float NdotL = max(dot(N, L), 0.0); if(NdotL > 0.0) { // Sample environment at fixed mip level // VNDF importance sampling handles the distribution filtering vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); // Weight by NdotL for the split-sum approximation // VNDF PDF naturally accounts for the visible microfacet distribution prefilteredColor += sampleColor * NdotL; totalWeight += NdotL; } } if (totalWeight > 0.0) { prefilteredColor = prefilteredColor / totalWeight; } gl_FragColor = vec4(prefilteredColor, 1.0); } `,blending:p8,depthTest:!1,depthWrite:!1})}function rM(J,Q,$){let Z=new Float32Array(AQ),W=new f(0,1,0);return new fJ({name:"SphericalGaussianBlur",defines:{n:AQ,CUBEUV_TEXEL_WIDTH:1/Q,CUBEUV_TEXEL_HEIGHT:1/$,CUBEUV_MAX_MIP:`${J}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:Z},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:W}},vertexShader:dW(),fragmentShader:` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform sampler2D envMap; uniform int samples; uniform float weights[ n ]; uniform bool latitudinal; uniform float dTheta; uniform float mipInt; uniform vec3 poleAxis; #define ENVMAP_TYPE_CUBE_UV #include vec3 getSample( float theta, vec3 axis ) { float cosTheta = cos( theta ); // Rodrigues' axis-angle rotation vec3 sampleDirection = vOutputDirection * cosTheta + cross( axis, vOutputDirection ) * sin( theta ) + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); return bilinearCubeUV( envMap, sampleDirection, mipInt ); } void main() { vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); if ( all( equal( axis, vec3( 0.0 ) ) ) ) { axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); } axis = normalize( axis ); gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); for ( int i = 1; i < n; i++ ) { if ( i >= samples ) { break; } float theta = dTheta * float( i ); gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); } } `,blending:p8,depthTest:!1,depthWrite:!1})}function hG(){return new fJ({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:dW(),fragmentShader:` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform sampler2D envMap; #include void main() { vec3 outputDirection = normalize( vOutputDirection ); vec2 uv = equirectUv( outputDirection ); gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); } `,blending:p8,depthTest:!1,depthWrite:!1})}function fG(){return new fJ({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:dW(),fragmentShader:` precision mediump float; precision mediump int; uniform float flipEnvMap; varying vec3 vOutputDirection; uniform samplerCube envMap; void main() { gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); } `,blending:p8,depthTest:!1,depthWrite:!1})}function dW(){return` precision mediump float; precision mediump int; attribute float faceIndex; varying vec3 vOutputDirection; // RH coordinate system; PMREM face-indexing convention vec3 getDirection( vec2 uv, float face ) { uv = 2.0 * uv - 1.0; vec3 direction = vec3( uv, 1.0 ); if ( face == 0.0 ) { direction = direction.zyx; // ( 1, v, u ) pos x } else if ( face == 1.0 ) { direction = direction.xzy; direction.xz *= -1.0; // ( -u, 1, -v ) pos y } else if ( face == 2.0 ) { direction.x *= -1.0; // ( -u, v, 1 ) pos z } else if ( face == 3.0 ) { direction = direction.zyx; direction.xz *= -1.0; // ( -1, v, -u ) neg x } else if ( face == 4.0 ) { direction = direction.xzy; direction.xy *= -1.0; // ( -u, -1, v ) neg y } else if ( face == 5.0 ) { direction.z *= -1.0; // ( u, v, -1 ) neg z } return direction; } void main() { vOutputDirection = getDirection( uv, faceIndex ); gl_Position = vec4( position, 1.0 ); } `}function tM(J){let Q=new WeakMap,$=null;function Z(X){if(X&&X.isTexture){let Y=X.mapping,U=Y===KW||Y===HW,G=Y===D$||Y===MQ;if(U||G){let q=Q.get(X),N=q!==void 0?q.texture.pmremVersion:0;if(X.isRenderTargetTexture&&X.pmremVersion!==N){if($===null)$=new dX(J);return q=U?$.fromEquirectangular(X,q):$.fromCubemap(X,q),q.texture.pmremVersion=X.pmremVersion,Q.set(X,q),q.texture}else if(q!==void 0)return q.texture;else{let R=X.image;if(U&&R&&R.height>0||G&&R&&W(R)){if($===null)$=new dX(J);return q=U?$.fromEquirectangular(X):$.fromCubemap(X),q.texture.pmremVersion=X.pmremVersion,Q.set(X,q),X.addEventListener("dispose",K),q.texture}else return null}}}return X}function W(X){let Y=0,U=6;for(let G=0;GQ.maxTextureSize)A=Math.ceil(B/Q.maxTextureSize),B=Q.maxTextureSize;let C=new Float32Array(B*A*4*q),w=new OW(C,B,A,q);w.type=L7,w.needsUpdate=!0;let T=D*4;for(let V=0;V #include void main() { gl_FragColor = texture2D( tDiffuse, vUv ); #ifdef LINEAR_TONE_MAPPING gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); #elif defined( REINHARD_TONE_MAPPING ) gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); #elif defined( CINEON_TONE_MAPPING ) gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); #elif defined( ACES_FILMIC_TONE_MAPPING ) gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); #elif defined( AGX_TONE_MAPPING ) gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); #elif defined( NEUTRAL_TONE_MAPPING ) gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); #elif defined( CUSTOM_TONE_MAPPING ) gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); #endif #ifdef SRGB_TRANSFER gl_FragColor = sRGBTransferOETF( gl_FragColor ); #endif }`,depthTest:!1,depthWrite:!1}),U=new i9(X,Y),G=new V7(-1,1,1,-1,0,1),q=null,N=null,R=!1,M,E=null,F=[],O=!1;this.setSize=function(k,D){K.setSize(k,D),H.setSize(k,D);for(let B=0;B0&&F[0].isRenderPass===!0;let{width:D,height:B}=K;for(let A=0;A0)return J;let W=Q*$,K=vG[W];if(K===void 0)K=new Float32Array(W),vG[W]=K;if(Q!==0){Z.toArray(K,0);for(let H=1,X=0;H!==Q;++H)X+=$,J[H].toArray(K,X)}return K}function KJ(J,Q){if(J.length!==Q.length)return!1;for(let $=0,Z=J.length;$0)this.seq=Z.concat(W)}setValue(J,Q,$,Z){let W=this.map[Q];if(W!==void 0)W.setValue(J,$,Z)}setOptional(J,Q,$){let Z=Q[$];if(Z!==void 0)this.setValue(J,$,Z)}static upload(J,Q,$,Z){for(let W=0,K=Q.length;W!==K;++W){let H=Q[W],X=$[H.id];if(X.needsUpdate!==!1)H.setValue(J,X.value,Z)}}static seqWithValue(J,Q){let $=[];for(let Z=0,W=J.length;Z!==W;++Z){let K=J[Z];if(K.id in Q)$.push(K)}return $}}function lG(J,Q,$){let Z=J.createShader(Q);return J.shaderSource(Z,$),J.compileShader(Z),Z}var oL=37297,iL=0;function aL(J,Q){let $=J.split(` `),Z=[],W=Math.max(Q-6,0),K=Math.min(Q+6,$.length);for(let H=W;H":" "} ${X}: ${$[H]}`)}return Z.join(` `)}var cG=new t0;function rL(J){X9._getMatrix(cG,X9.workingColorSpace,J);let Q=`mat3( ${cG.elements.map(($)=>$.toFixed(4))} )`;switch(X9.getTransfer(J)){case RX:return[Q,"LinearTransferOETF"];case A9:return[Q,"sRGBTransferOETF"];default:return j0("WebGLProgram: Unsupported color space: ",J),[Q,"LinearTransferOETF"]}}function sG(J,Q,$){let Z=J.getShaderParameter(Q,J.COMPILE_STATUS),K=(J.getShaderInfoLog(Q)||"").trim();if(Z&&K==="")return"";let H=/ERROR: 0:(\d+)/.exec(K);if(H){let X=parseInt(H[1]);return $.toUpperCase()+` `+K+` `+aL(J.getShaderSource(Q),X)}else return K}function tL(J,Q){let $=rL(Q);return[`vec4 ${J}( vec4 value ) {`,` return ${$[1]}( vec4( value.rgb * ${$[0]}, value.a ) );`,"}"].join(` `)}var eL={[DH]:"Linear",[zH]:"Reinhard",[VH]:"Cineon",[kH]:"ACESFilmic",[IH]:"AgX",[PH]:"Neutral",[CH]:"Custom"};function JB(J,Q){let $=eL[Q];if($===void 0)return j0("WebGLProgram: Unsupported toneMapping:",Q),"vec3 "+J+"( vec3 color ) { return LinearToneMapping( color ); }";return"vec3 "+J+"( vec3 color ) { return "+$+"ToneMapping( color ); }"}var mW=new f;function QB(){X9.getLuminanceCoefficients(mW);let J=mW.x.toFixed(4),Q=mW.y.toFixed(4),$=mW.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${J}, ${Q}, ${$} );`,"\treturn dot( weights, rgb );","}"].join(` `)}function $B(J){return[J.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",J.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(vZ).join(` `)}function ZB(J){let Q=[];for(let $ in J){let Z=J[$];if(Z===!1)continue;Q.push("#define "+$+" "+Z)}return Q.join(` `)}function WB(J,Q){let $={},Z=J.getProgramParameter(Q,J.ACTIVE_ATTRIBUTES);for(let W=0;W/gm;function lX(J){return J.replace(KB,XB)}var HB=new Map;function XB(J,Q){let $=J9[Q];if($===void 0){let Z=HB.get(Q);if(Z!==void 0)$=J9[Z],j0('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',Q,Z);else throw new Error("Can not resolve #include <"+Q+">")}return lX($)}var YB=/#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 iG(J){return J.replace(YB,UB)}function UB(J,Q,$,Z){let W="";for(let K=parseInt(Q);K0)F+=` `;if(O=["#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,M].filter(vZ).join(` `),O.length>0)O+=` `}else F=[aG($),"#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,M,$.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",$.batching?"#define USE_BATCHING":"",$.batchingColor?"#define USE_BATCHING_COLOR":"",$.instancing?"#define USE_INSTANCING":"",$.instancingColor?"#define USE_INSTANCING_COLOR":"",$.instancingMorph?"#define USE_INSTANCING_MORPH":"",$.useFog&&$.fog?"#define USE_FOG":"",$.useFog&&$.fogExp2?"#define FOG_EXP2":"",$.map?"#define USE_MAP":"",$.envMap?"#define USE_ENVMAP":"",$.envMap?"#define "+G:"",$.lightMap?"#define USE_LIGHTMAP":"",$.aoMap?"#define USE_AOMAP":"",$.bumpMap?"#define USE_BUMPMAP":"",$.normalMap?"#define USE_NORMALMAP":"",$.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",$.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",$.displacementMap?"#define USE_DISPLACEMENTMAP":"",$.emissiveMap?"#define USE_EMISSIVEMAP":"",$.anisotropy?"#define USE_ANISOTROPY":"",$.anisotropyMap?"#define USE_ANISOTROPYMAP":"",$.clearcoatMap?"#define USE_CLEARCOATMAP":"",$.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",$.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",$.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",$.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",$.specularMap?"#define USE_SPECULARMAP":"",$.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",$.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",$.roughnessMap?"#define USE_ROUGHNESSMAP":"",$.metalnessMap?"#define USE_METALNESSMAP":"",$.alphaMap?"#define USE_ALPHAMAP":"",$.alphaHash?"#define USE_ALPHAHASH":"",$.transmission?"#define USE_TRANSMISSION":"",$.transmissionMap?"#define USE_TRANSMISSIONMAP":"",$.thicknessMap?"#define USE_THICKNESSMAP":"",$.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",$.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",$.mapUv?"#define MAP_UV "+$.mapUv:"",$.alphaMapUv?"#define ALPHAMAP_UV "+$.alphaMapUv:"",$.lightMapUv?"#define LIGHTMAP_UV "+$.lightMapUv:"",$.aoMapUv?"#define AOMAP_UV "+$.aoMapUv:"",$.emissiveMapUv?"#define EMISSIVEMAP_UV "+$.emissiveMapUv:"",$.bumpMapUv?"#define BUMPMAP_UV "+$.bumpMapUv:"",$.normalMapUv?"#define NORMALMAP_UV "+$.normalMapUv:"",$.displacementMapUv?"#define DISPLACEMENTMAP_UV "+$.displacementMapUv:"",$.metalnessMapUv?"#define METALNESSMAP_UV "+$.metalnessMapUv:"",$.roughnessMapUv?"#define ROUGHNESSMAP_UV "+$.roughnessMapUv:"",$.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+$.anisotropyMapUv:"",$.clearcoatMapUv?"#define CLEARCOATMAP_UV "+$.clearcoatMapUv:"",$.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+$.clearcoatNormalMapUv:"",$.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+$.clearcoatRoughnessMapUv:"",$.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+$.iridescenceMapUv:"",$.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+$.iridescenceThicknessMapUv:"",$.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+$.sheenColorMapUv:"",$.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+$.sheenRoughnessMapUv:"",$.specularMapUv?"#define SPECULARMAP_UV "+$.specularMapUv:"",$.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+$.specularColorMapUv:"",$.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+$.specularIntensityMapUv:"",$.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+$.transmissionMapUv:"",$.thicknessMapUv?"#define THICKNESSMAP_UV "+$.thicknessMapUv:"",$.vertexTangents&&$.flatShading===!1?"#define USE_TANGENT":"",$.vertexColors?"#define USE_COLOR":"",$.vertexAlphas?"#define USE_COLOR_ALPHA":"",$.vertexUv1s?"#define USE_UV1":"",$.vertexUv2s?"#define USE_UV2":"",$.vertexUv3s?"#define USE_UV3":"",$.pointsUvs?"#define USE_POINTS_UV":"",$.flatShading?"#define FLAT_SHADED":"",$.skinning?"#define USE_SKINNING":"",$.morphTargets?"#define USE_MORPHTARGETS":"",$.morphNormals&&$.flatShading===!1?"#define USE_MORPHNORMALS":"",$.morphColors?"#define USE_MORPHCOLORS":"",$.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+$.morphTextureStride:"",$.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+$.morphTargetsCount:"",$.doubleSided?"#define DOUBLE_SIDED":"",$.flipSided?"#define FLIP_SIDED":"",$.shadowMapEnabled?"#define USE_SHADOWMAP":"",$.shadowMapEnabled?"#define "+Y:"",$.sizeAttenuation?"#define USE_SIZEATTENUATION":"",$.numLightProbes>0?"#define USE_LIGHT_PROBES":"",$.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",$.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif",` `].filter(vZ).join(` `),O=[aG($),"#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,M,$.useFog&&$.fog?"#define USE_FOG":"",$.useFog&&$.fogExp2?"#define FOG_EXP2":"",$.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",$.map?"#define USE_MAP":"",$.matcap?"#define USE_MATCAP":"",$.envMap?"#define USE_ENVMAP":"",$.envMap?"#define "+U:"",$.envMap?"#define "+G:"",$.envMap?"#define "+q:"",N?"#define CUBEUV_TEXEL_WIDTH "+N.texelWidth:"",N?"#define CUBEUV_TEXEL_HEIGHT "+N.texelHeight:"",N?"#define CUBEUV_MAX_MIP "+N.maxMip+".0":"",$.lightMap?"#define USE_LIGHTMAP":"",$.aoMap?"#define USE_AOMAP":"",$.bumpMap?"#define USE_BUMPMAP":"",$.normalMap?"#define USE_NORMALMAP":"",$.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",$.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",$.emissiveMap?"#define USE_EMISSIVEMAP":"",$.anisotropy?"#define USE_ANISOTROPY":"",$.anisotropyMap?"#define USE_ANISOTROPYMAP":"",$.clearcoat?"#define USE_CLEARCOAT":"",$.clearcoatMap?"#define USE_CLEARCOATMAP":"",$.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",$.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",$.dispersion?"#define USE_DISPERSION":"",$.iridescence?"#define USE_IRIDESCENCE":"",$.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",$.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",$.specularMap?"#define USE_SPECULARMAP":"",$.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",$.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",$.roughnessMap?"#define USE_ROUGHNESSMAP":"",$.metalnessMap?"#define USE_METALNESSMAP":"",$.alphaMap?"#define USE_ALPHAMAP":"",$.alphaTest?"#define USE_ALPHATEST":"",$.alphaHash?"#define USE_ALPHAHASH":"",$.sheen?"#define USE_SHEEN":"",$.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",$.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",$.transmission?"#define USE_TRANSMISSION":"",$.transmissionMap?"#define USE_TRANSMISSIONMAP":"",$.thicknessMap?"#define USE_THICKNESSMAP":"",$.vertexTangents&&$.flatShading===!1?"#define USE_TANGENT":"",$.vertexColors||$.instancingColor||$.batchingColor?"#define USE_COLOR":"",$.vertexAlphas?"#define USE_COLOR_ALPHA":"",$.vertexUv1s?"#define USE_UV1":"",$.vertexUv2s?"#define USE_UV2":"",$.vertexUv3s?"#define USE_UV3":"",$.pointsUvs?"#define USE_POINTS_UV":"",$.gradientMap?"#define USE_GRADIENTMAP":"",$.flatShading?"#define FLAT_SHADED":"",$.doubleSided?"#define DOUBLE_SIDED":"",$.flipSided?"#define FLIP_SIDED":"",$.shadowMapEnabled?"#define USE_SHADOWMAP":"",$.shadowMapEnabled?"#define "+Y:"",$.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",$.numLightProbes>0?"#define USE_LIGHT_PROBES":"",$.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",$.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",$.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",$.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",$.toneMapping!==m8?"#define TONE_MAPPING":"",$.toneMapping!==m8?J9.tonemapping_pars_fragment:"",$.toneMapping!==m8?JB("toneMapping",$.toneMapping):"",$.dithering?"#define DITHERING":"",$.opaque?"#define OPAQUE":"",J9.colorspace_pars_fragment,tL("linearToOutputTexel",$.outputColorSpace),QB(),$.useDepthPacking?"#define DEPTH_PACKING "+$.depthPacking:"",` `].filter(vZ).join(` `);if(H=lX(H),H=nG(H,$),H=oG(H,$),X=lX(X),X=nG(X,$),X=oG(X,$),H=iG(H),X=iG(X),$.isRawShaderMaterial!==!0)k=`#version 300 es `,F=[R,"#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` `+F,O=["#define varying in",$.glslVersion===FX?"":"layout(location = 0) out highp vec4 pc_fragColor;",$.glslVersion===FX?"":"#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(` `)+` `+O;let D=k+F+H,B=k+O+X,A=lG(W,W.VERTEX_SHADER,D),C=lG(W,W.FRAGMENT_SHADER,B);if(W.attachShader(E,A),W.attachShader(E,C),$.index0AttributeName!==void 0)W.bindAttribLocation(E,0,$.index0AttributeName);else if($.morphTargets===!0)W.bindAttribLocation(E,0,"position");W.linkProgram(E);function w(_){if(J.debug.checkShaderErrors){let b=W.getProgramInfoLog(E)||"",p=W.getShaderInfoLog(A)||"",v=W.getShaderInfoLog(C)||"",s=b.trim(),m=p.trim(),h=v.trim(),c=!0,t=!0;if(W.getProgramParameter(E,W.LINK_STATUS)===!1)if(c=!1,typeof J.debug.onShaderError==="function")J.debug.onShaderError(W,E,A,C);else{let j=sG(W,A,"vertex"),Q0=sG(W,C,"fragment");d0("THREE.WebGLProgram: Shader Error "+W.getError()+" - VALIDATE_STATUS "+W.getProgramParameter(E,W.VALIDATE_STATUS)+` Material Name: `+_.name+` Material Type: `+_.type+` Program Info Log: `+s+` `+j+` `+Q0)}else if(s!=="")j0("WebGLProgram: Program Info Log:",s);else if(m===""||h==="")t=!1;if(t)_.diagnostics={runnable:c,programLog:s,vertexShader:{log:m,prefix:F},fragmentShader:{log:h,prefix:O}}}W.deleteShader(A),W.deleteShader(C),T=new gZ(W,E),z=WB(W,E)}let T;this.getUniforms=function(){if(T===void 0)w(this);return T};let z;this.getAttributes=function(){if(z===void 0)w(this);return z};let V=$.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){if(V===!1)V=W.getProgramParameter(E,oL);return V},this.destroy=function(){Z.releaseStatesOfProgram(this),W.deleteProgram(E),this.program=void 0},this.type=$.shaderType,this.name=$.shaderName,this.id=iL++,this.cacheKey=Q,this.usedTimes=1,this.program=E,this.vertexShader=A,this.fragmentShader=C,this}var DB=0;class Uq{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(J){let{vertexShader:Q,fragmentShader:$}=J,Z=this._getShaderStage(Q),W=this._getShaderStage($),K=this._getShaderCacheForMaterial(J);if(K.has(Z)===!1)K.add(Z),Z.usedTimes++;if(K.has(W)===!1)K.add(W),W.usedTimes++;return this}remove(J){let Q=this.materialCache.get(J);for(let $ of Q)if($.usedTimes--,$.usedTimes===0)this.shaderCache.delete($.code);return this.materialCache.delete(J),this}getVertexShaderID(J){return this._getShaderStage(J.vertexShader).id}getFragmentShaderID(J){return this._getShaderStage(J.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(J){let Q=this.materialCache,$=Q.get(J);if($===void 0)$=new Set,Q.set(J,$);return $}_getShaderStage(J){let Q=this.shaderCache,$=Q.get(J);if($===void 0)$=new Gq(J),Q.set(J,$);return $}}class Gq{constructor(J){this.id=DB++,this.code=J,this.usedTimes=0}}function zB(J,Q,$,Z,W,K,H){let X=new MW,Y=new Uq,U=new Set,G=[],q=new Map,N=W.logarithmicDepthBuffer,R=W.precision,M={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function E(z){if(U.add(z),z===0)return"uv";return`uv${z}`}function F(z,V,_,b,p){let v=b.fog,s=p.geometry,m=z.isMeshStandardMaterial?b.environment:null,h=(z.isMeshStandardMaterial?$:Q).get(z.envMap||m),c=!!h&&h.mapping===BZ?h.image.height:null,t=M[z.type];if(z.precision!==null){if(R=W.getMaxPrecision(z.precision),R!==z.precision)j0("WebGLProgram.getParameters:",z.precision,"not supported, using",R,"instead.")}let j=s.morphAttributes.position||s.morphAttributes.normal||s.morphAttributes.color,Q0=j!==void 0?j.length:0,L0=0;if(s.morphAttributes.position!==void 0)L0=1;if(s.morphAttributes.normal!==void 0)L0=2;if(s.morphAttributes.color!==void 0)L0=3;let i0,b0,i,K0;if(t){let M0=t8[t];i0=M0.vertexShader,b0=M0.fragmentShader}else i0=z.vertexShader,b0=z.fragmentShader,Y.update(z),i=Y.getVertexShaderID(z),K0=Y.getFragmentShaderID(z);let J0=J.getRenderTarget(),k0=J.state.buffers.depth.getReversed(),I0=p.isInstancedMesh===!0,y0=p.isBatchedMesh===!0,U9=!!z.map,c0=!!z.matcap,w0=!!h,p0=!!z.aoMap,h0=!!z.lightMap,N9=!!z.bumpMap,P=!!z.normalMap,O9=!!z.displacementMap,m0=!!z.emissiveMap,R9=!!z.metalnessMap,U0=!!z.roughnessMap,G9=z.anisotropy>0,S=z.clearcoat>0,L=z.dispersion>0,g=z.iridescence>0,a=z.sheen>0,r=z.transmission>0,n=G9&&!!z.anisotropyMap,O0=S&&!!z.clearcoatMap,H0=S&&!!z.clearcoatNormalMap,S0=S&&!!z.clearcoatRoughnessMap,B0=g&&!!z.iridescenceMap,$0=g&&!!z.iridescenceThicknessMap,Z0=a&&!!z.sheenColorMap,D0=a&&!!z.sheenRoughnessMap,C0=!!z.specularMap,q0=!!z.specularColorMap,s0=!!z.specularIntensityMap,x=r&&!!z.transmissionMap,X0=r&&!!z.thicknessMap,W0=!!z.gradientMap,N0=!!z.alphaMap,e=z.alphaTest>0,o=!!z.alphaHash,z0=!!z.extensions,_0=m8;if(z.toneMapped){if(J0===null||J0.isXRRenderTarget===!0)_0=J.toneMapping}let F9={shaderID:t,shaderType:z.type,shaderName:z.name,vertexShader:i0,fragmentShader:b0,defines:z.defines,customVertexShaderID:i,customFragmentShaderID:K0,isRawShaderMaterial:z.isRawShaderMaterial===!0,glslVersion:z.glslVersion,precision:R,batching:y0,batchingColor:y0&&p._colorsTexture!==null,instancing:I0,instancingColor:I0&&p.instanceColor!==null,instancingMorph:I0&&p.morphTexture!==null,outputColorSpace:J0===null?J.outputColorSpace:J0.isXRRenderTarget===!0?J0.texture.colorSpace:hJ,alphaToCoverage:!!z.alphaToCoverage,map:U9,matcap:c0,envMap:w0,envMapMode:w0&&h.mapping,envMapCubeUVHeight:c,aoMap:p0,lightMap:h0,bumpMap:N9,normalMap:P,displacementMap:O9,emissiveMap:m0,normalMapObjectSpace:P&&z.normalMapType===OG,normalMapTangentSpace:P&&z.normalMapType===EG,metalnessMap:R9,roughnessMap:U0,anisotropy:G9,anisotropyMap:n,clearcoat:S,clearcoatMap:O0,clearcoatNormalMap:H0,clearcoatRoughnessMap:S0,dispersion:L,iridescence:g,iridescenceMap:B0,iridescenceThicknessMap:$0,sheen:a,sheenColorMap:Z0,sheenRoughnessMap:D0,specularMap:C0,specularColorMap:q0,specularIntensityMap:s0,transmission:r,transmissionMap:x,thicknessMap:X0,gradientMap:W0,opaque:z.transparent===!1&&z.blending===MZ&&z.alphaToCoverage===!1,alphaMap:N0,alphaTest:e,alphaHash:o,combine:z.combine,mapUv:U9&&E(z.map.channel),aoMapUv:p0&&E(z.aoMap.channel),lightMapUv:h0&&E(z.lightMap.channel),bumpMapUv:N9&&E(z.bumpMap.channel),normalMapUv:P&&E(z.normalMap.channel),displacementMapUv:O9&&E(z.displacementMap.channel),emissiveMapUv:m0&&E(z.emissiveMap.channel),metalnessMapUv:R9&&E(z.metalnessMap.channel),roughnessMapUv:U0&&E(z.roughnessMap.channel),anisotropyMapUv:n&&E(z.anisotropyMap.channel),clearcoatMapUv:O0&&E(z.clearcoatMap.channel),clearcoatNormalMapUv:H0&&E(z.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:S0&&E(z.clearcoatRoughnessMap.channel),iridescenceMapUv:B0&&E(z.iridescenceMap.channel),iridescenceThicknessMapUv:$0&&E(z.iridescenceThicknessMap.channel),sheenColorMapUv:Z0&&E(z.sheenColorMap.channel),sheenRoughnessMapUv:D0&&E(z.sheenRoughnessMap.channel),specularMapUv:C0&&E(z.specularMap.channel),specularColorMapUv:q0&&E(z.specularColorMap.channel),specularIntensityMapUv:s0&&E(z.specularIntensityMap.channel),transmissionMapUv:x&&E(z.transmissionMap.channel),thicknessMapUv:X0&&E(z.thicknessMap.channel),alphaMapUv:N0&&E(z.alphaMap.channel),vertexTangents:!!s.attributes.tangent&&(P||G9),vertexColors:z.vertexColors,vertexAlphas:z.vertexColors===!0&&!!s.attributes.color&&s.attributes.color.itemSize===4,pointsUvs:p.isPoints===!0&&!!s.attributes.uv&&(U9||N0),fog:!!v,useFog:z.fog===!0,fogExp2:!!v&&v.isFogExp2,flatShading:z.flatShading===!0&&z.wireframe===!1,sizeAttenuation:z.sizeAttenuation===!0,logarithmicDepthBuffer:N,reversedDepthBuffer:k0,skinning:p.isSkinnedMesh===!0,morphTargets:s.morphAttributes.position!==void 0,morphNormals:s.morphAttributes.normal!==void 0,morphColors:s.morphAttributes.color!==void 0,morphTargetsCount:Q0,morphTextureStride:L0,numDirLights:V.directional.length,numPointLights:V.point.length,numSpotLights:V.spot.length,numSpotLightMaps:V.spotLightMap.length,numRectAreaLights:V.rectArea.length,numHemiLights:V.hemi.length,numDirLightShadows:V.directionalShadowMap.length,numPointLightShadows:V.pointShadowMap.length,numSpotLightShadows:V.spotShadowMap.length,numSpotLightShadowsWithMaps:V.numSpotLightShadowsWithMaps,numLightProbes:V.numLightProbes,numClippingPlanes:H.numPlanes,numClipIntersection:H.numIntersection,dithering:z.dithering,shadowMapEnabled:J.shadowMap.enabled&&_.length>0,shadowMapType:J.shadowMap.type,toneMapping:_0,decodeVideoTexture:U9&&z.map.isVideoTexture===!0&&X9.getTransfer(z.map.colorSpace)===A9,decodeVideoTextureEmissive:m0&&z.emissiveMap.isVideoTexture===!0&&X9.getTransfer(z.emissiveMap.colorSpace)===A9,premultipliedAlpha:z.premultipliedAlpha,doubleSided:z.side===oJ,flipSided:z.side===U8,useDepthPacking:z.depthPacking>=0,depthPacking:z.depthPacking||0,index0AttributeName:z.index0AttributeName,extensionClipCullDistance:z0&&z.extensions.clipCullDistance===!0&&Z.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(z0&&z.extensions.multiDraw===!0||y0)&&Z.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:Z.has("KHR_parallel_shader_compile"),customProgramCacheKey:z.customProgramCacheKey()};return F9.vertexUv1s=U.has(1),F9.vertexUv2s=U.has(2),F9.vertexUv3s=U.has(3),U.clear(),F9}function O(z){let V=[];if(z.shaderID)V.push(z.shaderID);else V.push(z.customVertexShaderID),V.push(z.customFragmentShaderID);if(z.defines!==void 0)for(let _ in z.defines)V.push(_),V.push(z.defines[_]);if(z.isRawShaderMaterial===!1)k(V,z),D(V,z),V.push(J.outputColorSpace);return V.push(z.customProgramCacheKey),V.join()}function k(z,V){z.push(V.precision),z.push(V.outputColorSpace),z.push(V.envMapMode),z.push(V.envMapCubeUVHeight),z.push(V.mapUv),z.push(V.alphaMapUv),z.push(V.lightMapUv),z.push(V.aoMapUv),z.push(V.bumpMapUv),z.push(V.normalMapUv),z.push(V.displacementMapUv),z.push(V.emissiveMapUv),z.push(V.metalnessMapUv),z.push(V.roughnessMapUv),z.push(V.anisotropyMapUv),z.push(V.clearcoatMapUv),z.push(V.clearcoatNormalMapUv),z.push(V.clearcoatRoughnessMapUv),z.push(V.iridescenceMapUv),z.push(V.iridescenceThicknessMapUv),z.push(V.sheenColorMapUv),z.push(V.sheenRoughnessMapUv),z.push(V.specularMapUv),z.push(V.specularColorMapUv),z.push(V.specularIntensityMapUv),z.push(V.transmissionMapUv),z.push(V.thicknessMapUv),z.push(V.combine),z.push(V.fogExp2),z.push(V.sizeAttenuation),z.push(V.morphTargetsCount),z.push(V.morphAttributeCount),z.push(V.numDirLights),z.push(V.numPointLights),z.push(V.numSpotLights),z.push(V.numSpotLightMaps),z.push(V.numHemiLights),z.push(V.numRectAreaLights),z.push(V.numDirLightShadows),z.push(V.numPointLightShadows),z.push(V.numSpotLightShadows),z.push(V.numSpotLightShadowsWithMaps),z.push(V.numLightProbes),z.push(V.shadowMapType),z.push(V.toneMapping),z.push(V.numClippingPlanes),z.push(V.numClipIntersection),z.push(V.depthPacking)}function D(z,V){if(X.disableAll(),V.instancing)X.enable(0);if(V.instancingColor)X.enable(1);if(V.instancingMorph)X.enable(2);if(V.matcap)X.enable(3);if(V.envMap)X.enable(4);if(V.normalMapObjectSpace)X.enable(5);if(V.normalMapTangentSpace)X.enable(6);if(V.clearcoat)X.enable(7);if(V.iridescence)X.enable(8);if(V.alphaTest)X.enable(9);if(V.vertexColors)X.enable(10);if(V.vertexAlphas)X.enable(11);if(V.vertexUv1s)X.enable(12);if(V.vertexUv2s)X.enable(13);if(V.vertexUv3s)X.enable(14);if(V.vertexTangents)X.enable(15);if(V.anisotropy)X.enable(16);if(V.alphaHash)X.enable(17);if(V.batching)X.enable(18);if(V.dispersion)X.enable(19);if(V.batchingColor)X.enable(20);if(V.gradientMap)X.enable(21);if(z.push(X.mask),X.disableAll(),V.fog)X.enable(0);if(V.useFog)X.enable(1);if(V.flatShading)X.enable(2);if(V.logarithmicDepthBuffer)X.enable(3);if(V.reversedDepthBuffer)X.enable(4);if(V.skinning)X.enable(5);if(V.morphTargets)X.enable(6);if(V.morphNormals)X.enable(7);if(V.morphColors)X.enable(8);if(V.premultipliedAlpha)X.enable(9);if(V.shadowMapEnabled)X.enable(10);if(V.doubleSided)X.enable(11);if(V.flipSided)X.enable(12);if(V.useDepthPacking)X.enable(13);if(V.dithering)X.enable(14);if(V.transmission)X.enable(15);if(V.sheen)X.enable(16);if(V.opaque)X.enable(17);if(V.pointsUvs)X.enable(18);if(V.decodeVideoTexture)X.enable(19);if(V.decodeVideoTextureEmissive)X.enable(20);if(V.alphaToCoverage)X.enable(21);z.push(X.mask)}function B(z){let V=M[z.type],_;if(V){let b=t8[V];_=DW.clone(b.uniforms)}else _=z.uniforms;return _}function A(z,V){let _=q.get(V);if(_!==void 0)++_.usedTimes;else _=new BB(J,V,z,K),G.push(_),q.set(V,_);return _}function C(z){if(--z.usedTimes===0){let V=G.indexOf(z);G[V]=G[G.length-1],G.pop(),q.delete(z.cacheKey),z.destroy()}}function w(z){Y.remove(z)}function T(){Y.dispose()}return{getParameters:F,getProgramCacheKey:O,getUniforms:B,acquireProgram:A,releaseProgram:C,releaseShaderCache:w,programs:G,dispose:T}}function VB(){let J=new WeakMap;function Q(H){return J.has(H)}function $(H){let X=J.get(H);if(X===void 0)X={},J.set(H,X);return X}function Z(H){J.delete(H)}function W(H,X,Y){J.get(H)[X]=Y}function K(){J=new WeakMap}return{has:Q,get:$,remove:Z,update:W,dispose:K}}function kB(J,Q){if(J.groupOrder!==Q.groupOrder)return J.groupOrder-Q.groupOrder;else if(J.renderOrder!==Q.renderOrder)return J.renderOrder-Q.renderOrder;else if(J.material.id!==Q.material.id)return J.material.id-Q.material.id;else if(J.z!==Q.z)return J.z-Q.z;else return J.id-Q.id}function rG(J,Q){if(J.groupOrder!==Q.groupOrder)return J.groupOrder-Q.groupOrder;else if(J.renderOrder!==Q.renderOrder)return J.renderOrder-Q.renderOrder;else if(J.z!==Q.z)return Q.z-J.z;else return J.id-Q.id}function tG(){let J=[],Q=0,$=[],Z=[],W=[];function K(){Q=0,$.length=0,Z.length=0,W.length=0}function H(q,N,R,M,E,F){let O=J[Q];if(O===void 0)O={id:q.id,object:q,geometry:N,material:R,groupOrder:M,renderOrder:q.renderOrder,z:E,group:F},J[Q]=O;else O.id=q.id,O.object=q,O.geometry=N,O.material=R,O.groupOrder=M,O.renderOrder=q.renderOrder,O.z=E,O.group=F;return Q++,O}function X(q,N,R,M,E,F){let O=H(q,N,R,M,E,F);if(R.transmission>0)Z.push(O);else if(R.transparent===!0)W.push(O);else $.push(O)}function Y(q,N,R,M,E,F){let O=H(q,N,R,M,E,F);if(R.transmission>0)Z.unshift(O);else if(R.transparent===!0)W.unshift(O);else $.unshift(O)}function U(q,N){if($.length>1)$.sort(q||kB);if(Z.length>1)Z.sort(N||rG);if(W.length>1)W.sort(N||rG)}function G(){for(let q=Q,N=J.length;q=K.length)H=new tG,K.push(H);else H=K[W];return H}function $(){J=new WeakMap}return{get:Q,dispose:$}}function IB(){let J={};return{get:function(Q){if(J[Q.id]!==void 0)return J[Q.id];let $;switch(Q.type){case"DirectionalLight":$={direction:new f,color:new l0};break;case"SpotLight":$={position:new f,direction:new f,color:new l0,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":$={position:new f,color:new l0,distance:0,decay:0};break;case"HemisphereLight":$={direction:new f,skyColor:new l0,groundColor:new l0};break;case"RectAreaLight":$={color:new l0,position:new f,halfWidth:new f,halfHeight:new f};break}return J[Q.id]=$,$}}}function PB(){let J={};return{get:function(Q){if(J[Q.id]!==void 0)return J[Q.id];let $;switch(Q.type){case"DirectionalLight":$={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new g0};break;case"SpotLight":$={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new g0};break;case"PointLight":$={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new g0,shadowCameraNear:1,shadowCameraFar:1000};break}return J[Q.id]=$,$}}}var AB=0;function wB(J,Q){return(Q.castShadow?2:0)-(J.castShadow?2:0)+(Q.map?1:0)-(J.map?1:0)}function SB(J){let Q=new IB,$=PB(),Z={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 U=0;U<9;U++)Z.probe.push(new f);let W=new f,K=new r0,H=new r0;function X(U){let G=0,q=0,N=0;for(let z=0;z<9;z++)Z.probe[z].set(0,0,0);let R=0,M=0,E=0,F=0,O=0,k=0,D=0,B=0,A=0,C=0,w=0;U.sort(wB);for(let z=0,V=U.length;z0)if(J.has("OES_texture_float_linear")===!0)Z.rectAreaLTC1=E0.LTC_FLOAT_1,Z.rectAreaLTC2=E0.LTC_FLOAT_2;else Z.rectAreaLTC1=E0.LTC_HALF_1,Z.rectAreaLTC2=E0.LTC_HALF_2;Z.ambient[0]=G,Z.ambient[1]=q,Z.ambient[2]=N;let T=Z.hash;if(T.directionalLength!==R||T.pointLength!==M||T.spotLength!==E||T.rectAreaLength!==F||T.hemiLength!==O||T.numDirectionalShadows!==k||T.numPointShadows!==D||T.numSpotShadows!==B||T.numSpotMaps!==A||T.numLightProbes!==w)Z.directional.length=R,Z.spot.length=E,Z.rectArea.length=F,Z.point.length=M,Z.hemi.length=O,Z.directionalShadow.length=k,Z.directionalShadowMap.length=k,Z.pointShadow.length=D,Z.pointShadowMap.length=D,Z.spotShadow.length=B,Z.spotShadowMap.length=B,Z.directionalShadowMatrix.length=k,Z.pointShadowMatrix.length=D,Z.spotLightMatrix.length=B+A-C,Z.spotLightMap.length=A,Z.numSpotLightShadowsWithMaps=C,Z.numLightProbes=w,T.directionalLength=R,T.pointLength=M,T.spotLength=E,T.rectAreaLength=F,T.hemiLength=O,T.numDirectionalShadows=k,T.numPointShadows=D,T.numSpotShadows=B,T.numSpotMaps=A,T.numLightProbes=w,Z.version=AB++}function Y(U,G){let q=0,N=0,R=0,M=0,E=0,F=G.matrixWorldInverse;for(let O=0,k=U.length;O=H.length)X=new eG(J),H.push(X);else X=H[K];return X}function Z(){Q=new WeakMap}return{get:$,dispose:Z}}var jB=`void main() { gl_Position = vec4( position, 1.0 ); }`,_B=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; void main() { const float samples = float( VSM_SAMPLES ); float mean = 0.0; float squared_mean = 0.0; float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); float uvStart = samples <= 1.0 ? 0.0 : - 1.0; for ( float i = 0.0; i < samples; i ++ ) { float uvOffset = uvStart + i * uvStride; #ifdef HORIZONTAL_PASS vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg; mean += distribution.x; squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; #else float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r; mean += depth; squared_mean += depth * depth; #endif } mean = mean / samples; squared_mean = squared_mean / samples; float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); }`,xB=[new f(1,0,0),new f(-1,0,0),new f(0,1,0),new f(0,-1,0),new f(0,0,1),new f(0,0,-1)],bB=[new f(0,-1,0),new f(0,-1,0),new f(0,0,1),new f(0,0,-1),new f(0,-1,0),new f(0,-1,0)],Jq=new r0,fZ=new f,mX=new f;function yB(J,Q,$){let Z=new SZ,W=new g0,K=new g0,H=new _9,X=new CX,Y=new IX,U={},G=$.maxTextureSize,q={[d7]:U8,[U8]:d7,[oJ]:oJ},N=new fJ({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new g0},radius:{value:4}},vertexShader:jB,fragmentShader:_B}),R=N.clone();R.defines.HORIZONTAL_PASS=1;let M=new MJ;M.setAttribute("position",new WJ(new Float32Array([-1,-1,0.5,3,-1,0.5,-1,3,0.5]),3));let E=new i9(M,N),F=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=OZ;let O=this.type;this.render=function(C,w,T){if(F.enabled===!1)return;if(F.autoUpdate===!1&&F.needsUpdate===!1)return;if(C.length===0)return;if(C.type===v1)j0("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),C.type=OZ;let z=J.getRenderTarget(),V=J.getActiveCubeFace(),_=J.getActiveMipmapLevel(),b=J.state;if(b.setBlending(p8),b.buffers.depth.getReversed()===!0)b.buffers.color.setClear(0,0,0,0);else b.buffers.color.setClear(1,1,1,1);b.buffers.depth.setTest(!0),b.setScissorTest(!1);let p=O!==this.type;if(p)w.traverse(function(v){if(v.material)if(Array.isArray(v.material))v.material.forEach((s)=>s.needsUpdate=!0);else v.material.needsUpdate=!0});for(let v=0,s=C.length;vG||W.y>G){if(W.x>G)K.x=Math.floor(G/c.x),W.x=K.x*c.x,h.mapSize.x=K.x;if(W.y>G)K.y=Math.floor(G/c.y),W.y=K.y*c.y,h.mapSize.y=K.y}if(h.map===null||p===!0){if(h.map!==null){if(h.map.depthTexture!==null)h.map.depthTexture.dispose(),h.map.depthTexture=null;h.map.dispose()}if(this.type===L$){if(m.isPointLight){j0("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}h.map=new aJ(W.x,W.y,{format:I$,type:l8,minFilter:OJ,magFilter:OJ,generateMipmaps:!1}),h.map.texture.name=m.name+".shadowMap",h.map.depthTexture=new kQ(W.x,W.y,L7),h.map.depthTexture.name=m.name+".shadowMapDepth",h.map.depthTexture.format=BQ,h.map.depthTexture.compareFunction=null,h.map.depthTexture.minFilter=d8,h.map.depthTexture.magFilter=d8}else{if(m.isPointLight)h.map=new kW(W.x),h.map.depthTexture=new kX(W.x,u7);else h.map=new aJ(W.x,W.y),h.map.depthTexture=new kQ(W.x,W.y,u7);h.map.depthTexture.name=m.name+".shadowMap",h.map.depthTexture.format=BQ;let j=J.state.buffers.depth.getReversed();if(this.type===OZ)h.map.depthTexture.compareFunction=j?EW:FW,h.map.depthTexture.minFilter=OJ,h.map.depthTexture.magFilter=OJ;else h.map.depthTexture.compareFunction=null,h.map.depthTexture.minFilter=d8,h.map.depthTexture.magFilter=d8}h.camera.updateProjectionMatrix()}let t=h.map.isWebGLCubeRenderTarget?6:1;for(let j=0;j0||w.map&&w.alphaTest>0||w.alphaToCoverage===!0){let b=V.uuid,p=w.uuid,v=U[b];if(v===void 0)v={},U[b]=v;let s=v[p];if(s===void 0)s=V.clone(),v[p]=s,w.addEventListener("dispose",A);V=s}if(V.visible=w.visible,V.wireframe=w.wireframe,z===L$)V.side=w.shadowSide!==null?w.shadowSide:w.side;else V.side=w.shadowSide!==null?w.shadowSide:q[w.side];if(V.alphaMap=w.alphaMap,V.alphaTest=w.alphaToCoverage===!0?0.5:w.alphaTest,V.map=w.map,V.clipShadows=w.clipShadows,V.clippingPlanes=w.clippingPlanes,V.clipIntersection=w.clipIntersection,V.displacementMap=w.displacementMap,V.displacementScale=w.displacementScale,V.displacementBias=w.displacementBias,V.wireframeLinewidth=w.wireframeLinewidth,V.linewidth=w.linewidth,T.isPointLight===!0&&V.isMeshDistanceMaterial===!0){let b=J.properties.get(V);b.light=T}return V}function B(C,w,T,z,V){if(C.visible===!1)return;if(C.layers.test(w.layers)&&(C.isMesh||C.isLine||C.isPoints)){if((C.castShadow||C.receiveShadow&&V===L$)&&(!C.frustumCulled||Z.intersectsObject(C))){C.modelViewMatrix.multiplyMatrices(T.matrixWorldInverse,C.matrixWorld);let p=Q.update(C),v=C.material;if(Array.isArray(v)){let s=p.groups;for(let m=0,h=s.length;m=1;else if(c.indexOf("OpenGL ES")!==-1)h=parseFloat(/^OpenGL ES (\d)/.exec(c)[1]),m=h>=2;let t=null,j={},Q0=J.getParameter(J.SCISSOR_BOX),L0=J.getParameter(J.VIEWPORT),i0=new _9().fromArray(Q0),b0=new _9().fromArray(L0);function i(x,X0,W0,N0){let e=new Uint8Array(4),o=J.createTexture();J.bindTexture(x,o),J.texParameteri(x,J.TEXTURE_MIN_FILTER,J.NEAREST),J.texParameteri(x,J.TEXTURE_MAG_FILTER,J.NEAREST);for(let z0=0;z0g||r.height>g)a=g/Math.max(r.width,r.height);if(a<1)if(typeof HTMLImageElement!=="undefined"&&S instanceof HTMLImageElement||typeof HTMLCanvasElement!=="undefined"&&S instanceof HTMLCanvasElement||typeof ImageBitmap!=="undefined"&&S instanceof ImageBitmap||typeof VideoFrame!=="undefined"&&S instanceof VideoFrame){let n=Math.floor(a*r.width),O0=Math.floor(a*r.height);if(q===void 0)q=M(n,O0);let H0=L?M(n,O0):q;return H0.width=n,H0.height=O0,H0.getContext("2d").drawImage(S,0,0,n,O0),j0("WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+n+"x"+O0+")."),H0}else{if("data"in S)j0("WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+").");return S}return S}function F(S){return S.generateMipmaps}function O(S){J.generateMipmap(S)}function k(S){if(S.isWebGLCubeRenderTarget)return J.TEXTURE_CUBE_MAP;if(S.isWebGL3DRenderTarget)return J.TEXTURE_3D;if(S.isWebGLArrayRenderTarget||S.isCompressedArrayTexture)return J.TEXTURE_2D_ARRAY;return J.TEXTURE_2D}function D(S,L,g,a,r=!1){if(S!==null){if(J[S]!==void 0)return J[S];j0("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+S+"'")}let n=L;if(L===J.RED){if(g===J.FLOAT)n=J.R32F;if(g===J.HALF_FLOAT)n=J.R16F;if(g===J.UNSIGNED_BYTE)n=J.R8}if(L===J.RED_INTEGER){if(g===J.UNSIGNED_BYTE)n=J.R8UI;if(g===J.UNSIGNED_SHORT)n=J.R16UI;if(g===J.UNSIGNED_INT)n=J.R32UI;if(g===J.BYTE)n=J.R8I;if(g===J.SHORT)n=J.R16I;if(g===J.INT)n=J.R32I}if(L===J.RG){if(g===J.FLOAT)n=J.RG32F;if(g===J.HALF_FLOAT)n=J.RG16F;if(g===J.UNSIGNED_BYTE)n=J.RG8}if(L===J.RG_INTEGER){if(g===J.UNSIGNED_BYTE)n=J.RG8UI;if(g===J.UNSIGNED_SHORT)n=J.RG16UI;if(g===J.UNSIGNED_INT)n=J.RG32UI;if(g===J.BYTE)n=J.RG8I;if(g===J.SHORT)n=J.RG16I;if(g===J.INT)n=J.RG32I}if(L===J.RGB_INTEGER){if(g===J.UNSIGNED_BYTE)n=J.RGB8UI;if(g===J.UNSIGNED_SHORT)n=J.RGB16UI;if(g===J.UNSIGNED_INT)n=J.RGB32UI;if(g===J.BYTE)n=J.RGB8I;if(g===J.SHORT)n=J.RGB16I;if(g===J.INT)n=J.RGB32I}if(L===J.RGBA_INTEGER){if(g===J.UNSIGNED_BYTE)n=J.RGBA8UI;if(g===J.UNSIGNED_SHORT)n=J.RGBA16UI;if(g===J.UNSIGNED_INT)n=J.RGBA32UI;if(g===J.BYTE)n=J.RGBA8I;if(g===J.SHORT)n=J.RGBA16I;if(g===J.INT)n=J.RGBA32I}if(L===J.RGB){if(g===J.UNSIGNED_INT_5_9_9_9_REV)n=J.RGB9_E5;if(g===J.UNSIGNED_INT_10F_11F_11F_REV)n=J.R11F_G11F_B10F}if(L===J.RGBA){let O0=r?RX:X9.getTransfer(a);if(g===J.FLOAT)n=J.RGBA32F;if(g===J.HALF_FLOAT)n=J.RGBA16F;if(g===J.UNSIGNED_BYTE)n=O0===A9?J.SRGB8_ALPHA8:J.RGBA8;if(g===J.UNSIGNED_SHORT_4_4_4_4)n=J.RGBA4;if(g===J.UNSIGNED_SHORT_5_5_5_1)n=J.RGB5_A1}if(n===J.R16F||n===J.R32F||n===J.RG16F||n===J.RG32F||n===J.RGBA16F||n===J.RGBA32F)Q.get("EXT_color_buffer_float");return n}function B(S,L){let g;if(S){if(L===null||L===u7||L===C$)g=J.DEPTH24_STENCIL8;else if(L===L7)g=J.DEPTH32F_STENCIL8;else if(L===DZ)g=J.DEPTH24_STENCIL8,j0("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")}else if(L===null||L===u7||L===C$)g=J.DEPTH_COMPONENT24;else if(L===L7)g=J.DEPTH_COMPONENT32F;else if(L===DZ)g=J.DEPTH_COMPONENT16;return g}function A(S,L){if(F(S)===!0||S.isFramebufferTexture&&S.minFilter!==d8&&S.minFilter!==OJ)return Math.log2(Math.max(L.width,L.height))+1;else if(S.mipmaps!==void 0&&S.mipmaps.length>0)return S.mipmaps.length;else if(S.isCompressedTexture&&Array.isArray(S.image))return L.mipmaps.length;else return 1}function C(S){let L=S.target;if(L.removeEventListener("dispose",C),T(L),L.isVideoTexture)G.delete(L)}function w(S){let L=S.target;L.removeEventListener("dispose",w),V(L)}function T(S){let L=Z.get(S);if(L.__webglInit===void 0)return;let g=S.source,a=N.get(g);if(a){let r=a[L.__cacheKey];if(r.usedTimes--,r.usedTimes===0)z(S);if(Object.keys(a).length===0)N.delete(g)}Z.remove(S)}function z(S){let L=Z.get(S);J.deleteTexture(L.__webglTexture);let g=S.source,a=N.get(g);delete a[L.__cacheKey],H.memory.textures--}function V(S){let L=Z.get(S);if(S.depthTexture)S.depthTexture.dispose(),Z.remove(S.depthTexture);if(S.isWebGLCubeRenderTarget)for(let a=0;a<6;a++){if(Array.isArray(L.__webglFramebuffer[a]))for(let r=0;r=W.maxTextures)j0("WebGLTextures: Trying to use "+S+" texture units while this GPU supports only "+W.maxTextures);return _+=1,S}function v(S){let L=[];return L.push(S.wrapS),L.push(S.wrapT),L.push(S.wrapR||0),L.push(S.magFilter),L.push(S.minFilter),L.push(S.anisotropy),L.push(S.internalFormat),L.push(S.format),L.push(S.type),L.push(S.generateMipmaps),L.push(S.premultiplyAlpha),L.push(S.flipY),L.push(S.unpackAlignment),L.push(S.colorSpace),L.join()}function s(S,L){let g=Z.get(S);if(S.isVideoTexture)R9(S);if(S.isRenderTargetTexture===!1&&S.isExternalTexture!==!0&&S.version>0&&g.__version!==S.version){let a=S.image;if(a===null)j0("WebGLRenderer: Texture marked for update but no image data found.");else if(a.complete===!1)j0("WebGLRenderer: Texture marked for update but image is incomplete");else{K0(g,S,L);return}}else if(S.isExternalTexture)g.__webglTexture=S.sourceTexture?S.sourceTexture:null;$.bindTexture(J.TEXTURE_2D,g.__webglTexture,J.TEXTURE0+L)}function m(S,L){let g=Z.get(S);if(S.isRenderTargetTexture===!1&&S.version>0&&g.__version!==S.version){K0(g,S,L);return}else if(S.isExternalTexture)g.__webglTexture=S.sourceTexture?S.sourceTexture:null;$.bindTexture(J.TEXTURE_2D_ARRAY,g.__webglTexture,J.TEXTURE0+L)}function h(S,L){let g=Z.get(S);if(S.isRenderTargetTexture===!1&&S.version>0&&g.__version!==S.version){K0(g,S,L);return}$.bindTexture(J.TEXTURE_3D,g.__webglTexture,J.TEXTURE0+L)}function c(S,L){let g=Z.get(S);if(S.isCubeDepthTexture!==!0&&S.version>0&&g.__version!==S.version){J0(g,S,L);return}$.bindTexture(J.TEXTURE_CUBE_MAP,g.__webglTexture,J.TEXTURE0+L)}let t={[z$]:J.REPEAT,[V$]:J.CLAMP_TO_EDGE,[XW]:J.MIRRORED_REPEAT},j={[d8]:J.NEAREST,[YW]:J.NEAREST_MIPMAP_NEAREST,[LQ]:J.NEAREST_MIPMAP_LINEAR,[OJ]:J.LINEAR,[k$]:J.LINEAR_MIPMAP_NEAREST,[M7]:J.LINEAR_MIPMAP_LINEAR},Q0={[MG]:J.NEVER,[VG]:J.ALWAYS,[LG]:J.LESS,[FW]:J.LEQUAL,[BG]:J.EQUAL,[EW]:J.GEQUAL,[DG]:J.GREATER,[zG]:J.NOTEQUAL};function L0(S,L){if(L.type===L7&&Q.has("OES_texture_float_linear")===!1&&(L.magFilter===OJ||L.magFilter===k$||L.magFilter===LQ||L.magFilter===M7||L.minFilter===OJ||L.minFilter===k$||L.minFilter===LQ||L.minFilter===M7))j0("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.");if(J.texParameteri(S,J.TEXTURE_WRAP_S,t[L.wrapS]),J.texParameteri(S,J.TEXTURE_WRAP_T,t[L.wrapT]),S===J.TEXTURE_3D||S===J.TEXTURE_2D_ARRAY)J.texParameteri(S,J.TEXTURE_WRAP_R,t[L.wrapR]);if(J.texParameteri(S,J.TEXTURE_MAG_FILTER,j[L.magFilter]),J.texParameteri(S,J.TEXTURE_MIN_FILTER,j[L.minFilter]),L.compareFunction)J.texParameteri(S,J.TEXTURE_COMPARE_MODE,J.COMPARE_REF_TO_TEXTURE),J.texParameteri(S,J.TEXTURE_COMPARE_FUNC,Q0[L.compareFunction]);if(Q.has("EXT_texture_filter_anisotropic")===!0){if(L.magFilter===d8)return;if(L.minFilter!==LQ&&L.minFilter!==M7)return;if(L.type===L7&&Q.has("OES_texture_float_linear")===!1)return;if(L.anisotropy>1||Z.get(L).__currentAnisotropy){let g=Q.get("EXT_texture_filter_anisotropic");J.texParameterf(S,g.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(L.anisotropy,W.getMaxAnisotropy())),Z.get(L).__currentAnisotropy=L.anisotropy}}}function i0(S,L){let g=!1;if(S.__webglInit===void 0)S.__webglInit=!0,L.addEventListener("dispose",C);let a=L.source,r=N.get(a);if(r===void 0)r={},N.set(a,r);let n=v(L);if(n!==S.__cacheKey){if(r[n]===void 0)r[n]={texture:J.createTexture(),usedTimes:0},H.memory.textures++,g=!0;r[n].usedTimes++;let O0=r[S.__cacheKey];if(O0!==void 0){if(r[S.__cacheKey].usedTimes--,O0.usedTimes===0)z(L)}S.__cacheKey=n,S.__webglTexture=r[n].texture}return g}function b0(S,L,g){return Math.floor(Math.floor(S/g)/L)}function i(S,L,g,a){let n=S.updateRanges;if(n.length===0)$.texSubImage2D(J.TEXTURE_2D,0,0,0,L.width,L.height,g,a,L.data);else{n.sort(($0,Z0)=>$0.start-Z0.start);let O0=0;for(let $0=1;$00){if(x&&X0)$.texStorage2D(J.TEXTURE_2D,N0,C0,s0[0].width,s0[0].height);for(let e=0,o=s0.length;e0){let z0=yX(q0.width,q0.height,L.format,L.type);for(let _0 of L.layerUpdates){let F9=q0.data.subarray(_0*z0/q0.data.BYTES_PER_ELEMENT,(_0+1)*z0/q0.data.BYTES_PER_ELEMENT);$.compressedTexSubImage3D(J.TEXTURE_2D_ARRAY,e,0,0,_0,q0.width,q0.height,1,Z0,F9)}L.clearLayerUpdates()}else $.compressedTexSubImage3D(J.TEXTURE_2D_ARRAY,e,0,0,0,q0.width,q0.height,$0.depth,Z0,q0.data)}else $.compressedTexImage3D(J.TEXTURE_2D_ARRAY,e,C0,q0.width,q0.height,$0.depth,0,q0.data,0,0);else j0("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if(x){if(W0)$.texSubImage3D(J.TEXTURE_2D_ARRAY,e,0,0,0,q0.width,q0.height,$0.depth,Z0,D0,q0.data)}else $.texImage3D(J.TEXTURE_2D_ARRAY,e,C0,q0.width,q0.height,$0.depth,0,Z0,D0,q0.data)}else{if(x&&X0)$.texStorage2D(J.TEXTURE_2D,N0,C0,s0[0].width,s0[0].height);for(let e=0,o=s0.length;e0){let e=yX($0.width,$0.height,L.format,L.type);for(let o of L.layerUpdates){let z0=$0.data.subarray(o*e/$0.data.BYTES_PER_ELEMENT,(o+1)*e/$0.data.BYTES_PER_ELEMENT);$.texSubImage3D(J.TEXTURE_2D_ARRAY,0,0,0,o,$0.width,$0.height,1,Z0,D0,z0)}L.clearLayerUpdates()}else $.texSubImage3D(J.TEXTURE_2D_ARRAY,0,0,0,0,$0.width,$0.height,$0.depth,Z0,D0,$0.data)}else $.texImage3D(J.TEXTURE_2D_ARRAY,0,C0,$0.width,$0.height,$0.depth,0,Z0,D0,$0.data);else if(L.isData3DTexture)if(x){if(X0)$.texStorage3D(J.TEXTURE_3D,N0,C0,$0.width,$0.height,$0.depth);if(W0)$.texSubImage3D(J.TEXTURE_3D,0,0,0,0,$0.width,$0.height,$0.depth,Z0,D0,$0.data)}else $.texImage3D(J.TEXTURE_3D,0,C0,$0.width,$0.height,$0.depth,0,Z0,D0,$0.data);else if(L.isFramebufferTexture){if(X0)if(x)$.texStorage2D(J.TEXTURE_2D,N0,C0,$0.width,$0.height);else{let{width:e,height:o}=$0;for(let z0=0;z0>=1,o>>=1}}else if(s0.length>0){if(x&&X0){let e=G9(s0[0]);$.texStorage2D(J.TEXTURE_2D,N0,C0,e.width,e.height)}for(let e=0,o=s0.length;e0)N0++;let o=G9(Z0[0]);$.texStorage2D(J.TEXTURE_CUBE_MAP,N0,s0,o.width,o.height)}for(let o=0;o<6;o++)if($0){if(x){if(W0)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,0,0,Z0[o].width,Z0[o].height,C0,q0,Z0[o].data)}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,s0,Z0[o].width,Z0[o].height,0,C0,q0,Z0[o].data);for(let z0=0;z0>n),D0=Math.max(1,L.height>>n);if(r===J.TEXTURE_3D||r===J.TEXTURE_2D_ARRAY)$.texImage3D(r,n,S0,Z0,D0,L.depth,0,O0,H0,null);else $.texImage2D(r,n,S0,Z0,D0,0,O0,H0,null)}if($.bindFramebuffer(J.FRAMEBUFFER,S),m0(L))X.framebufferTexture2DMultisampleEXT(J.FRAMEBUFFER,a,r,$0.__webglTexture,0,O9(L));else if(r===J.TEXTURE_2D||r>=J.TEXTURE_CUBE_MAP_POSITIVE_X&&r<=J.TEXTURE_CUBE_MAP_NEGATIVE_Z)J.framebufferTexture2D(J.FRAMEBUFFER,a,r,$0.__webglTexture,n);$.bindFramebuffer(J.FRAMEBUFFER,null)}function I0(S,L,g){if(J.bindRenderbuffer(J.RENDERBUFFER,S),L.depthBuffer){let a=L.depthTexture,r=a&&a.isDepthTexture?a.type:null,n=B(L.stencilBuffer,r),O0=L.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT;if(m0(L))X.renderbufferStorageMultisampleEXT(J.RENDERBUFFER,O9(L),n,L.width,L.height);else if(g)J.renderbufferStorageMultisample(J.RENDERBUFFER,O9(L),n,L.width,L.height);else J.renderbufferStorage(J.RENDERBUFFER,n,L.width,L.height);J.framebufferRenderbuffer(J.FRAMEBUFFER,O0,J.RENDERBUFFER,S)}else{let a=L.textures;for(let r=0;r{delete L.__boundDepthTexture,delete L.__depthDisposeCallback,a.removeEventListener("dispose",r)};a.addEventListener("dispose",r),L.__depthDisposeCallback=r}L.__boundDepthTexture=a}if(S.depthTexture&&!L.__autoAllocateDepthBuffer)if(g)for(let a=0;a<6;a++)y0(L.__webglFramebuffer[a],S,a);else{let a=S.texture.mipmaps;if(a&&a.length>0)y0(L.__webglFramebuffer[0],S,0);else y0(L.__webglFramebuffer,S,0)}else if(g){L.__webglDepthbuffer=[];for(let a=0;a<6;a++)if($.bindFramebuffer(J.FRAMEBUFFER,L.__webglFramebuffer[a]),L.__webglDepthbuffer[a]===void 0)L.__webglDepthbuffer[a]=J.createRenderbuffer(),I0(L.__webglDepthbuffer[a],S,!1);else{let r=S.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT,n=L.__webglDepthbuffer[a];J.bindRenderbuffer(J.RENDERBUFFER,n),J.framebufferRenderbuffer(J.FRAMEBUFFER,r,J.RENDERBUFFER,n)}}else{let a=S.texture.mipmaps;if(a&&a.length>0)$.bindFramebuffer(J.FRAMEBUFFER,L.__webglFramebuffer[0]);else $.bindFramebuffer(J.FRAMEBUFFER,L.__webglFramebuffer);if(L.__webglDepthbuffer===void 0)L.__webglDepthbuffer=J.createRenderbuffer(),I0(L.__webglDepthbuffer,S,!1);else{let r=S.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT,n=L.__webglDepthbuffer;J.bindRenderbuffer(J.RENDERBUFFER,n),J.framebufferRenderbuffer(J.FRAMEBUFFER,r,J.RENDERBUFFER,n)}}$.bindFramebuffer(J.FRAMEBUFFER,null)}function c0(S,L,g){let a=Z.get(S);if(L!==void 0)k0(a.__webglFramebuffer,S,S.texture,J.COLOR_ATTACHMENT0,J.TEXTURE_2D,0);if(g!==void 0)U9(S)}function w0(S){let L=S.texture,g=Z.get(S),a=Z.get(L);S.addEventListener("dispose",w);let r=S.textures,n=S.isWebGLCubeRenderTarget===!0,O0=r.length>1;if(!O0){if(a.__webglTexture===void 0)a.__webglTexture=J.createTexture();a.__version=L.version,H.memory.textures++}if(n){g.__webglFramebuffer=[];for(let H0=0;H0<6;H0++)if(L.mipmaps&&L.mipmaps.length>0){g.__webglFramebuffer[H0]=[];for(let S0=0;S00){g.__webglFramebuffer=[];for(let H0=0;H00&&m0(S)===!1){g.__webglMultisampledFramebuffer=J.createFramebuffer(),g.__webglColorRenderbuffer=[],$.bindFramebuffer(J.FRAMEBUFFER,g.__webglMultisampledFramebuffer);for(let H0=0;H00)for(let S0=0;S00)for(let S0=0;S00){if(m0(S)===!1){let{textures:L,width:g,height:a}=S,r=J.COLOR_BUFFER_BIT,n=S.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT,O0=Z.get(S),H0=L.length>1;if(H0)for(let B0=0;B00)$.bindFramebuffer(J.DRAW_FRAMEBUFFER,O0.__webglFramebuffer[0]);else $.bindFramebuffer(J.DRAW_FRAMEBUFFER,O0.__webglFramebuffer);for(let B0=0;B00&&Q.has("WEBGL_multisampled_render_to_texture")===!0&&L.__useRenderToTexture!==!1}function R9(S){let L=H.render.frame;if(G.get(S)!==L)G.set(S,L),S.update()}function U0(S,L){let{colorSpace:g,format:a,type:r}=S;if(S.isCompressedTexture===!0||S.isVideoTexture===!0)return L;if(g!==hJ&&g!==zQ)if(X9.getTransfer(g)===A9){if(a!==i8||r!==u8)j0("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.")}else d0("WebGLTextures: Unsupported texture color space:",g);return L}function G9(S){if(typeof HTMLImageElement!=="undefined"&&S instanceof HTMLImageElement)U.width=S.naturalWidth||S.width,U.height=S.naturalHeight||S.height;else if(typeof VideoFrame!=="undefined"&&S instanceof VideoFrame)U.width=S.displayWidth,U.height=S.displayHeight;else U.width=S.width,U.height=S.height;return U}this.allocateTextureUnit=p,this.resetTextureUnits=b,this.setTexture2D=s,this.setTexture2DArray=m,this.setTexture3D=h,this.setTextureCube=c,this.rebindTextures=c0,this.setupRenderTarget=w0,this.updateRenderTargetMipmap=p0,this.updateMultisampleRenderTarget=P,this.setupDepthRenderbuffer=U9,this.setupFrameBufferTexture=k0,this.useMultisampledRTT=m0,this.isReversedDepthBuffer=function(){return $.buffers.depth.getReversed()}}function gB(J,Q){function $(Z,W=zQ){let K,H=X9.getTransfer(W);if(Z===u8)return J.UNSIGNED_BYTE;if(Z===wH)return J.UNSIGNED_SHORT_4_4_4_4;if(Z===SH)return J.UNSIGNED_SHORT_5_5_5_1;if(Z===GG)return J.UNSIGNED_INT_5_9_9_9_REV;if(Z===qG)return J.UNSIGNED_INT_10F_11F_11F_REV;if(Z===YG)return J.BYTE;if(Z===UG)return J.SHORT;if(Z===DZ)return J.UNSIGNED_SHORT;if(Z===AH)return J.INT;if(Z===u7)return J.UNSIGNED_INT;if(Z===L7)return J.FLOAT;if(Z===l8)return J.HALF_FLOAT;if(Z===NG)return J.ALPHA;if(Z===RG)return J.RGB;if(Z===i8)return J.RGBA;if(Z===BQ)return J.DEPTH_COMPONENT;if(Z===DQ)return J.DEPTH_STENCIL;if(Z===FG)return J.RED;if(Z===TH)return J.RED_INTEGER;if(Z===I$)return J.RG;if(Z===jH)return J.RG_INTEGER;if(Z===_H)return J.RGBA_INTEGER;if(Z===UW||Z===GW||Z===qW||Z===NW)if(H===A9)if(K=Q.get("WEBGL_compressed_texture_s3tc_srgb"),K!==null){if(Z===UW)return K.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(Z===GW)return K.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(Z===qW)return K.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(Z===NW)return K.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(K=Q.get("WEBGL_compressed_texture_s3tc"),K!==null){if(Z===UW)return K.COMPRESSED_RGB_S3TC_DXT1_EXT;if(Z===GW)return K.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(Z===qW)return K.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(Z===NW)return K.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(Z===xH||Z===bH||Z===yH||Z===hH)if(K=Q.get("WEBGL_compressed_texture_pvrtc"),K!==null){if(Z===xH)return K.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(Z===bH)return K.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(Z===yH)return K.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(Z===hH)return K.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(Z===fH||Z===vH||Z===gH||Z===pH||Z===mH||Z===dH||Z===uH)if(K=Q.get("WEBGL_compressed_texture_etc"),K!==null){if(Z===fH||Z===vH)return H===A9?K.COMPRESSED_SRGB8_ETC2:K.COMPRESSED_RGB8_ETC2;if(Z===gH)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:K.COMPRESSED_RGBA8_ETC2_EAC;if(Z===pH)return K.COMPRESSED_R11_EAC;if(Z===mH)return K.COMPRESSED_SIGNED_R11_EAC;if(Z===dH)return K.COMPRESSED_RG11_EAC;if(Z===uH)return K.COMPRESSED_SIGNED_RG11_EAC}else return null;if(Z===lH||Z===cH||Z===sH||Z===nH||Z===oH||Z===iH||Z===aH||Z===rH||Z===tH||Z===eH||Z===JX||Z===QX||Z===$X||Z===ZX)if(K=Q.get("WEBGL_compressed_texture_astc"),K!==null){if(Z===lH)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:K.COMPRESSED_RGBA_ASTC_4x4_KHR;if(Z===cH)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:K.COMPRESSED_RGBA_ASTC_5x4_KHR;if(Z===sH)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:K.COMPRESSED_RGBA_ASTC_5x5_KHR;if(Z===nH)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:K.COMPRESSED_RGBA_ASTC_6x5_KHR;if(Z===oH)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:K.COMPRESSED_RGBA_ASTC_6x6_KHR;if(Z===iH)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:K.COMPRESSED_RGBA_ASTC_8x5_KHR;if(Z===aH)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:K.COMPRESSED_RGBA_ASTC_8x6_KHR;if(Z===rH)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:K.COMPRESSED_RGBA_ASTC_8x8_KHR;if(Z===tH)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:K.COMPRESSED_RGBA_ASTC_10x5_KHR;if(Z===eH)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:K.COMPRESSED_RGBA_ASTC_10x6_KHR;if(Z===JX)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:K.COMPRESSED_RGBA_ASTC_10x8_KHR;if(Z===QX)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:K.COMPRESSED_RGBA_ASTC_10x10_KHR;if(Z===$X)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:K.COMPRESSED_RGBA_ASTC_12x10_KHR;if(Z===ZX)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:K.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(Z===WX||Z===KX||Z===HX)if(K=Q.get("EXT_texture_compression_bptc"),K!==null){if(Z===WX)return H===A9?K.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:K.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(Z===KX)return K.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(Z===HX)return K.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(Z===XX||Z===YX||Z===UX||Z===GX)if(K=Q.get("EXT_texture_compression_rgtc"),K!==null){if(Z===XX)return K.COMPRESSED_RED_RGTC1_EXT;if(Z===YX)return K.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(Z===UX)return K.COMPRESSED_RED_GREEN_RGTC2_EXT;if(Z===GX)return K.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;if(Z===C$)return J.UNSIGNED_INT_24_8;return J[Z]!==void 0?J[Z]:null}return{convert:$}}var pB=` void main() { gl_Position = vec4( position, 1.0 ); }`,mB=` uniform sampler2DArray depthColor; uniform float depthWidth; uniform float depthHeight; void main() { vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); if ( coord.x >= 1.0 ) { gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; } else { gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; } }`;class qq{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(J,Q){if(this.texture===null){let $=new TW(J.texture);if(J.depthNear!==Q.depthNear||J.depthFar!==Q.depthFar)this.depthNear=J.depthNear,this.depthFar=J.depthFar;this.texture=$}}getMesh(J){if(this.texture!==null){if(this.mesh===null){let Q=J.cameras[0].viewport,$=new fJ({vertexShader:pB,fragmentShader:mB,uniforms:{depthColor:{value:this.texture},depthWidth:{value:Q.z},depthHeight:{value:Q.w}}});this.mesh=new i9(new CQ(20,20),$)}}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Nq extends B7{constructor(J,Q){super();let $=this,Z=null,W=1,K=null,H="local-floor",X=1,Y=null,U=null,G=null,q=null,N=null,R=null,M=typeof XRWebGLBinding!=="undefined",E=new qq,F={},O=Q.getContextAttributes(),k=null,D=null,B=[],A=[],C=new g0,w=null,T=new ZJ;T.viewport=new _9;let z=new ZJ;z.viewport=new _9;let V=[T,z],_=new _X,b=null,p=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(i){let K0=B[i];if(K0===void 0)K0=new CZ,B[i]=K0;return K0.getTargetRaySpace()},this.getControllerGrip=function(i){let K0=B[i];if(K0===void 0)K0=new CZ,B[i]=K0;return K0.getGripSpace()},this.getHand=function(i){let K0=B[i];if(K0===void 0)K0=new CZ,B[i]=K0;return K0.getHandSpace()};function v(i){let K0=A.indexOf(i.inputSource);if(K0===-1)return;let J0=B[K0];if(J0!==void 0)J0.update(i.inputSource,i.frame,Y||K),J0.dispatchEvent({type:i.type,data:i.inputSource})}function s(){Z.removeEventListener("select",v),Z.removeEventListener("selectstart",v),Z.removeEventListener("selectend",v),Z.removeEventListener("squeeze",v),Z.removeEventListener("squeezestart",v),Z.removeEventListener("squeezeend",v),Z.removeEventListener("end",s),Z.removeEventListener("inputsourceschange",m);for(let i=0;i=0)A[k0]=null,B[k0].disconnect(J0)}for(let K0=0;K0=A.length){A.push(J0),k0=y0;break}else if(A[y0]===null){A[y0]=J0,k0=y0;break}if(k0===-1)break}let I0=B[k0];if(I0)I0.connect(J0)}}let h=new f,c=new f;function t(i,K0,J0){h.setFromMatrixPosition(K0.matrixWorld),c.setFromMatrixPosition(J0.matrixWorld);let k0=h.distanceTo(c),I0=K0.projectionMatrix.elements,y0=J0.projectionMatrix.elements,U9=I0[14]/(I0[10]-1),c0=I0[14]/(I0[10]+1),w0=(I0[9]+1)/I0[5],p0=(I0[9]-1)/I0[5],h0=(I0[8]-1)/I0[0],N9=(y0[8]+1)/y0[0],P=U9*h0,O9=U9*N9,m0=k0/(-h0+N9),R9=m0*-h0;if(K0.matrixWorld.decompose(i.position,i.quaternion,i.scale),i.translateX(R9),i.translateZ(m0),i.matrixWorld.compose(i.position,i.quaternion,i.scale),i.matrixWorldInverse.copy(i.matrixWorld).invert(),I0[10]===-1)i.projectionMatrix.copy(K0.projectionMatrix),i.projectionMatrixInverse.copy(K0.projectionMatrixInverse);else{let U0=U9+m0,G9=c0+m0,S=P-R9,L=O9+(k0-R9),g=w0*c0/G9*U0,a=p0*c0/G9*U0;i.projectionMatrix.makePerspective(S,L,g,a,U0,G9),i.projectionMatrixInverse.copy(i.projectionMatrix).invert()}}function j(i,K0){if(K0===null)i.matrixWorld.copy(i.matrix);else i.matrixWorld.multiplyMatrices(K0.matrixWorld,i.matrix);i.matrixWorldInverse.copy(i.matrixWorld).invert()}this.updateCamera=function(i){if(Z===null)return;let{near:K0,far:J0}=i;if(E.texture!==null){if(E.depthNear>0)K0=E.depthNear;if(E.depthFar>0)J0=E.depthFar}if(_.near=z.near=T.near=K0,_.far=z.far=T.far=J0,b!==_.near||p!==_.far)Z.updateRenderState({depthNear:_.near,depthFar:_.far}),b=_.near,p=_.far;_.layers.mask=i.layers.mask|6,T.layers.mask=_.layers.mask&3,z.layers.mask=_.layers.mask&5;let k0=i.parent,I0=_.cameras;j(_,k0);for(let y0=0;y00)F.alphaTest.value=O.alphaTest;let k=Q.get(O),D=k.envMap,B=k.envMapRotation;if(D){if(F.envMap.value=D,PQ.copy(B),PQ.x*=-1,PQ.y*=-1,PQ.z*=-1,D.isCubeTexture&&D.isRenderTargetTexture===!1)PQ.y*=-1,PQ.z*=-1;F.envMapRotation.value.setFromMatrix4(dB.makeRotationFromEuler(PQ)),F.flipEnvMap.value=D.isCubeTexture&&D.isRenderTargetTexture===!1?-1:1,F.reflectivity.value=O.reflectivity,F.ior.value=O.ior,F.refractionRatio.value=O.refractionRatio}if(O.lightMap)F.lightMap.value=O.lightMap,F.lightMapIntensity.value=O.lightMapIntensity,$(O.lightMap,F.lightMapTransform);if(O.aoMap)F.aoMap.value=O.aoMap,F.aoMapIntensity.value=O.aoMapIntensity,$(O.aoMap,F.aoMapTransform)}function H(F,O){if(F.diffuse.value.copy(O.color),F.opacity.value=O.opacity,O.map)F.map.value=O.map,$(O.map,F.mapTransform)}function X(F,O){F.dashSize.value=O.dashSize,F.totalSize.value=O.dashSize+O.gapSize,F.scale.value=O.scale}function Y(F,O,k,D){if(F.diffuse.value.copy(O.color),F.opacity.value=O.opacity,F.size.value=O.size*k,F.scale.value=D*0.5,O.map)F.map.value=O.map,$(O.map,F.uvTransform);if(O.alphaMap)F.alphaMap.value=O.alphaMap,$(O.alphaMap,F.alphaMapTransform);if(O.alphaTest>0)F.alphaTest.value=O.alphaTest}function U(F,O){if(F.diffuse.value.copy(O.color),F.opacity.value=O.opacity,F.rotation.value=O.rotation,O.map)F.map.value=O.map,$(O.map,F.mapTransform);if(O.alphaMap)F.alphaMap.value=O.alphaMap,$(O.alphaMap,F.alphaMapTransform);if(O.alphaTest>0)F.alphaTest.value=O.alphaTest}function G(F,O){F.specular.value.copy(O.specular),F.shininess.value=Math.max(O.shininess,0.0001)}function q(F,O){if(O.gradientMap)F.gradientMap.value=O.gradientMap}function N(F,O){if(F.metalness.value=O.metalness,O.metalnessMap)F.metalnessMap.value=O.metalnessMap,$(O.metalnessMap,F.metalnessMapTransform);if(F.roughness.value=O.roughness,O.roughnessMap)F.roughnessMap.value=O.roughnessMap,$(O.roughnessMap,F.roughnessMapTransform);if(O.envMap)F.envMapIntensity.value=O.envMapIntensity}function R(F,O,k){if(F.ior.value=O.ior,O.sheen>0){if(F.sheenColor.value.copy(O.sheenColor).multiplyScalar(O.sheen),F.sheenRoughness.value=O.sheenRoughness,O.sheenColorMap)F.sheenColorMap.value=O.sheenColorMap,$(O.sheenColorMap,F.sheenColorMapTransform);if(O.sheenRoughnessMap)F.sheenRoughnessMap.value=O.sheenRoughnessMap,$(O.sheenRoughnessMap,F.sheenRoughnessMapTransform)}if(O.clearcoat>0){if(F.clearcoat.value=O.clearcoat,F.clearcoatRoughness.value=O.clearcoatRoughness,O.clearcoatMap)F.clearcoatMap.value=O.clearcoatMap,$(O.clearcoatMap,F.clearcoatMapTransform);if(O.clearcoatRoughnessMap)F.clearcoatRoughnessMap.value=O.clearcoatRoughnessMap,$(O.clearcoatRoughnessMap,F.clearcoatRoughnessMapTransform);if(O.clearcoatNormalMap){if(F.clearcoatNormalMap.value=O.clearcoatNormalMap,$(O.clearcoatNormalMap,F.clearcoatNormalMapTransform),F.clearcoatNormalScale.value.copy(O.clearcoatNormalScale),O.side===U8)F.clearcoatNormalScale.value.negate()}}if(O.dispersion>0)F.dispersion.value=O.dispersion;if(O.iridescence>0){if(F.iridescence.value=O.iridescence,F.iridescenceIOR.value=O.iridescenceIOR,F.iridescenceThicknessMinimum.value=O.iridescenceThicknessRange[0],F.iridescenceThicknessMaximum.value=O.iridescenceThicknessRange[1],O.iridescenceMap)F.iridescenceMap.value=O.iridescenceMap,$(O.iridescenceMap,F.iridescenceMapTransform);if(O.iridescenceThicknessMap)F.iridescenceThicknessMap.value=O.iridescenceThicknessMap,$(O.iridescenceThicknessMap,F.iridescenceThicknessMapTransform)}if(O.transmission>0){if(F.transmission.value=O.transmission,F.transmissionSamplerMap.value=k.texture,F.transmissionSamplerSize.value.set(k.width,k.height),O.transmissionMap)F.transmissionMap.value=O.transmissionMap,$(O.transmissionMap,F.transmissionMapTransform);if(F.thickness.value=O.thickness,O.thicknessMap)F.thicknessMap.value=O.thicknessMap,$(O.thicknessMap,F.thicknessMapTransform);F.attenuationDistance.value=O.attenuationDistance,F.attenuationColor.value.copy(O.attenuationColor)}if(O.anisotropy>0){if(F.anisotropyVector.value.set(O.anisotropy*Math.cos(O.anisotropyRotation),O.anisotropy*Math.sin(O.anisotropyRotation)),O.anisotropyMap)F.anisotropyMap.value=O.anisotropyMap,$(O.anisotropyMap,F.anisotropyMapTransform)}if(F.specularIntensity.value=O.specularIntensity,F.specularColor.value.copy(O.specularColor),O.specularColorMap)F.specularColorMap.value=O.specularColorMap,$(O.specularColorMap,F.specularColorMapTransform);if(O.specularIntensityMap)F.specularIntensityMap.value=O.specularIntensityMap,$(O.specularIntensityMap,F.specularIntensityMapTransform)}function M(F,O){if(O.matcap)F.matcap.value=O.matcap}function E(F,O){let k=Q.get(O).light;F.referencePosition.value.setFromMatrixPosition(k.matrixWorld),F.nearDistance.value=k.shadow.camera.near,F.farDistance.value=k.shadow.camera.far}return{refreshFogUniforms:Z,refreshMaterialUniforms:W}}function lB(J,Q,$,Z){let W={},K={},H=[],X=J.getParameter(J.MAX_UNIFORM_BUFFER_BINDINGS);function Y(k,D){let B=D.program;Z.uniformBlockBinding(k,B)}function U(k,D){let B=W[k.id];if(B===void 0)M(k),B=G(k),W[k.id]=B,k.addEventListener("dispose",F);let A=D.program;Z.updateUBOMapping(k,A);let C=Q.render.frame;if(K[k.id]!==C)N(k),K[k.id]=C}function G(k){let D=q();k.__bindingPointIndex=D;let B=J.createBuffer(),A=k.__size,C=k.usage;return J.bindBuffer(J.UNIFORM_BUFFER,B),J.bufferData(J.UNIFORM_BUFFER,A,C),J.bindBuffer(J.UNIFORM_BUFFER,null),J.bindBufferBase(J.UNIFORM_BUFFER,D,B),B}function q(){for(let k=0;k0)B+=A-C;return k.__size=B,k.__cache={},this}function E(k){let D={boundary:0,storage:0};if(typeof k==="number"||typeof k==="boolean")D.boundary=4,D.storage=4;else if(k.isVector2)D.boundary=8,D.storage=8;else if(k.isVector3||k.isColor)D.boundary=16,D.storage=12;else if(k.isVector4)D.boundary=16,D.storage=16;else if(k.isMatrix3)D.boundary=48,D.storage=48;else if(k.isMatrix4)D.boundary=64,D.storage=64;else if(k.isTexture)j0("WebGLRenderer: Texture samplers can not be part of an uniforms group.");else j0("WebGLRenderer: Unsupported uniform value type.",k);return D}function F(k){let D=k.target;D.removeEventListener("dispose",F);let B=H.indexOf(D.__bindingPointIndex);H.splice(B,1),J.deleteBuffer(W[D.id]),delete W[D.id],delete K[D.id]}function O(){for(let k in W)J.deleteBuffer(W[k]);H=[],W={},K={}}return{bind:Y,update:U,dispose:O}}var cB=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),r8=null;function sB(){if(r8===null)r8=new AZ(cB,16,16,I$,l8),r8.name="DFG_LUT",r8.minFilter=OJ,r8.magFilter=OJ,r8.wrapS=V$,r8.wrapT=V$,r8.generateMipmaps=!1,r8.needsUpdate=!0;return r8}class cX{constructor(J={}){let{canvas:Q=kG(),context:$=null,depth:Z=!0,stencil:W=!1,alpha:K=!1,antialias:H=!1,premultipliedAlpha:X=!0,preserveDrawingBuffer:Y=!1,powerPreference:U="default",failIfMajorPerformanceCaveat:G=!1,reversedDepthBuffer:q=!1,outputBufferType:N=u8}=J;this.isWebGLRenderer=!0;let R;if($!==null){if(typeof WebGLRenderingContext!=="undefined"&&$ instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");R=$.getContextAttributes().alpha}else R=K;let M=N,E=new Set([_H,jH,TH]),F=new Set([u8,u7,DZ,C$,wH,SH]),O=new Uint32Array(4),k=new Int32Array(4),D=null,B=null,A=[],C=[],w=null;this.domElement=Q,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=m8,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let T=this,z=!1;this._outputColorSpace=l7;let V=0,_=0,b=null,p=-1,v=null,s=new _9,m=new _9,h=null,c=new l0(0),t=0,j=Q.width,Q0=Q.height,L0=1,i0=null,b0=null,i=new _9(0,0,j,Q0),K0=new _9(0,0,j,Q0),J0=!1,k0=new SZ,I0=!1,y0=!1,U9=new r0,c0=new f,w0=new _9,p0={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},h0=!1;function N9(){return b===null?L0:1}let P=$;function O9(I,y){return Q.getContext(I,y)}try{let I={alpha:!0,depth:Z,stencil:W,antialias:H,premultipliedAlpha:X,preserveDrawingBuffer:Y,powerPreference:U,failIfMajorPerformanceCaveat:G};if("setAttribute"in Q)Q.setAttribute("data-engine",`three.js r${y1}`);if(Q.addEventListener("webglcontextlost",z0,!1),Q.addEventListener("webglcontextrestored",_0,!1),Q.addEventListener("webglcontextcreationerror",F9,!1),P===null){if(P=O9("webgl2",I),P===null)if(O9("webgl2"))throw new Error("Error creating WebGL context with your selected attributes.");else throw new Error("Error creating WebGL context.")}}catch(I){throw d0("WebGLRenderer: "+I.message),I}let m0,R9,U0,G9,S,L,g,a,r,n,O0,H0,S0,B0,$0,Z0,D0,C0,q0,s0,x,X0,W0,N0;function e(){if(m0=new eM(P),m0.init(),X0=new gB(P,m0),R9=new lM(P,m0,J,X0),U0=new fB(P,m0),R9.reversedDepthBuffer&&q)U0.buffers.depth.setReversed(!0);G9=new $L(P),S=new VB,L=new vB(P,m0,U0,S,R9,X0,G9),g=new sM(T),a=new tM(T),r=new HE(P),W0=new dM(P,r),n=new JL(P,r,G9,W0),O0=new WL(P,n,r,G9),q0=new ZL(P,R9,L),Z0=new cM(S),H0=new zB(T,g,a,m0,R9,W0,Z0),S0=new uB(T,S),B0=new CB,$0=new TB(m0),C0=new mM(T,g,a,U0,O0,R,X),D0=new yB(T,O0,R9),N0=new lB(P,G9,R9,U0),s0=new uM(P,m0,G9),x=new QL(P,m0,G9),G9.programs=H0.programs,T.capabilities=R9,T.extensions=m0,T.properties=S,T.renderLists=B0,T.shadowMap=D0,T.state=U0,T.info=G9}if(e(),M!==u8)w=new HL(M,Q.width,Q.height,Z,W);let o=new Nq(T,P);this.xr=o,this.getContext=function(){return P},this.getContextAttributes=function(){return P.getContextAttributes()},this.forceContextLoss=function(){let I=m0.get("WEBGL_lose_context");if(I)I.loseContext()},this.forceContextRestore=function(){let I=m0.get("WEBGL_lose_context");if(I)I.restoreContext()},this.getPixelRatio=function(){return L0},this.setPixelRatio=function(I){if(I===void 0)return;L0=I,this.setSize(j,Q0,!1)},this.getSize=function(I){return I.set(j,Q0)},this.setSize=function(I,y,u=!0){if(o.isPresenting){j0("WebGLRenderer: Can't change size while VR device is presenting.");return}if(j=I,Q0=y,Q.width=Math.floor(I*L0),Q.height=Math.floor(y*L0),u===!0)Q.style.width=I+"px",Q.style.height=y+"px";if(w!==null)w.setSize(Q.width,Q.height);this.setViewport(0,0,I,y)},this.getDrawingBufferSize=function(I){return I.set(j*L0,Q0*L0).floor()},this.setDrawingBufferSize=function(I,y,u){j=I,Q0=y,L0=u,Q.width=Math.floor(I*u),Q.height=Math.floor(y*u),this.setViewport(0,0,I,y)},this.setEffects=function(I){if(M===u8){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(I){for(let y=0;y{function Y0(){if(l.forEach(function(R0){if(S.get(R0).currentProgram.isReady())l.delete(R0)}),l.size===0){d(I);return}setTimeout(Y0,10)}if(m0.get("KHR_parallel_shader_compile")!==null)Y0();else setTimeout(Y0,10)})};let n0=null;function x0(I){if(n0)n0(I)}function o0(){a0.stop()}function c9(){a0.start()}let a0=new Qq;if(a0.setAnimationLoop(x0),typeof self!=="undefined")a0.setContext(self);this.setAnimationLoop=function(I){n0=I,o.setAnimationLoop(I),I===null?a0.stop():a0.start()},o.addEventListener("sessionstart",o0),o.addEventListener("sessionend",c9),this.render=function(I,y){if(y!==void 0&&y.isCamera!==!0){d0("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(z===!0)return;let u=o.enabled===!0&&o.isPresenting===!0,l=w!==null&&(b===null||u)&&w.begin(T,b);if(I.matrixWorldAutoUpdate===!0)I.updateMatrixWorld();if(y.parent===null&&y.matrixWorldAutoUpdate===!0)y.updateMatrixWorld();if(o.enabled===!0&&o.isPresenting===!0&&(w===null||w.isCompositing()===!1)){if(o.cameraAutoUpdate===!0)o.updateCamera(y);y=o.getCamera()}if(I.isScene===!0)I.onBeforeRender(T,I,y,b);if(B=$0.get(I,C.length),B.init(y),C.push(B),U9.multiplyMatrices(y.projectionMatrix,y.matrixWorldInverse),k0.setFromProjectionMatrix(U9,EX,y.reversedDepth),y0=this.localClippingEnabled,I0=Z0.init(this.clippingPlanes,y0),D=B0.get(I,A.length),D.init(),A.push(D),o.enabled===!0&&o.isPresenting===!0){let R0=T.xr.getDepthSensingMesh();if(R0!==null)b9(R0,y,-1/0,T.sortObjects)}if(b9(I,y,0,T.sortObjects),D.finish(),T.sortObjects===!0)D.sort(i0,b0);if(h0=o.enabled===!1||o.isPresenting===!1||o.hasDepthSensing()===!1,h0)C0.addToRenderList(D,I);if(this.info.render.frame++,I0===!0)Z0.beginShadows();let d=B.state.shadowsArray;if(D0.render(d,I,y),I0===!0)Z0.endShadows();if(this.info.autoReset===!0)this.info.reset();if((l&&w.hasRenderPass())===!1){let{opaque:R0,transmissive:G0}=D;if(B.setupLights(),y.isArrayCamera){let V0=y.cameras;if(G0.length>0)for(let P0=0,u0=V0.length;P00)y9(R0,G0,I,y);if(h0)C0.render(I);JJ(D,I,y)}}if(b!==null&&_===0)L.updateMultisampleRenderTarget(b),L.updateRenderTargetMipmap(b);if(l)w.end(T);if(I.isScene===!0)I.onAfterRender(T,I,y);if(W0.resetDefaultState(),p=-1,v=null,C.pop(),C.length>0){if(B=C[C.length-1],I0===!0)Z0.setGlobalState(T.clippingPlanes,B.state.camera)}else B=null;if(A.pop(),A.length>0)D=A[A.length-1];else D=null};function b9(I,y,u,l){if(I.visible===!1)return;if(I.layers.test(y.layers)){if(I.isGroup)u=I.renderOrder;else if(I.isLOD){if(I.autoUpdate===!0)I.update(y)}else if(I.isLight){if(B.pushLight(I),I.castShadow)B.pushShadow(I)}else if(I.isSprite){if(!I.frustumCulled||k0.intersectsSprite(I)){if(l)w0.setFromMatrixPosition(I.matrixWorld).applyMatrix4(U9);let R0=O0.update(I),G0=I.material;if(G0.visible)D.push(I,R0,G0,u,w0.z,null)}}else if(I.isMesh||I.isLine||I.isPoints){if(!I.frustumCulled||k0.intersectsObject(I)){let R0=O0.update(I),G0=I.material;if(l){if(I.boundingSphere!==void 0){if(I.boundingSphere===null)I.computeBoundingSphere();w0.copy(I.boundingSphere.center)}else{if(R0.boundingSphere===null)R0.computeBoundingSphere();w0.copy(R0.boundingSphere.center)}w0.applyMatrix4(I.matrixWorld).applyMatrix4(U9)}if(Array.isArray(G0)){let V0=R0.groups;for(let P0=0,u0=V0.length;P00)D9(d,y,u);if(Y0.length>0)D9(Y0,y,u);if(R0.length>0)D9(R0,y,u);U0.buffers.depth.setTest(!0),U0.buffers.depth.setMask(!0),U0.buffers.color.setMask(!0),U0.setPolygonOffset(!1)}function y9(I,y,u,l){if((u.isScene===!0?u.overrideMaterial:null)!==null)return;if(B.state.transmissionRenderTarget[l.id]===void 0){let W9=m0.has("EXT_color_buffer_half_float")||m0.has("EXT_color_buffer_float");B.state.transmissionRenderTarget[l.id]=new aJ(1,1,{generateMipmaps:!0,type:W9?l8:u8,minFilter:M7,samples:R9.samples,stencilBuffer:W,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:X9.workingColorSpace})}let Y0=B.state.transmissionRenderTarget[l.id],R0=l.viewport||s;Y0.setSize(R0.z*T.transmissionResolutionScale,R0.w*T.transmissionResolutionScale);let G0=T.getRenderTarget(),V0=T.getActiveCubeFace(),P0=T.getActiveMipmapLevel();if(T.setRenderTarget(Y0),T.getClearColor(c),t=T.getClearAlpha(),t<1)T.setClearColor(16777215,0.5);if(T.clear(),h0)C0.render(u);let u0=T.toneMapping;T.toneMapping=m8;let f0=l.viewport;if(l.viewport!==void 0)l.viewport=void 0;if(B.setupLightsView(l),I0===!0)Z0.setGlobalState(T.clippingPlanes,l);if(D9(I,u,l),L.updateMultisampleRenderTarget(Y0),L.updateRenderTargetMipmap(Y0),m0.has("WEBGL_multisampled_render_to_texture")===!1){let W9=!1;for(let C9=0,p9=y.length;C90),f0=!!u.morphAttributes.position,W9=!!u.morphAttributes.normal,C9=!!u.morphAttributes.color,p9=m8;if(l.toneMapped){if(b===null||b.isXRRenderTarget===!0)p9=T.toneMapping}let m9=u.morphAttributes.position||u.morphAttributes.normal||u.morphAttributes.color,P9=m9!==void 0?m9.length:0,v0=S.get(l),z9=B.state.lights;if(I0===!0){if(y0===!0||I!==v){let bJ=I===v&&l.id===p;Z0.setState(l,I,bJ)}}let E9=!1;if(l.version===v0.__version){if(v0.needsLights&&v0.lightsStateVersion!==z9.state.version)E9=!0;else if(v0.outputColorSpace!==G0)E9=!0;else if(d.isBatchedMesh&&v0.batching===!1)E9=!0;else if(!d.isBatchedMesh&&v0.batching===!0)E9=!0;else if(d.isBatchedMesh&&v0.batchingColor===!0&&d.colorTexture===null)E9=!0;else if(d.isBatchedMesh&&v0.batchingColor===!1&&d.colorTexture!==null)E9=!0;else if(d.isInstancedMesh&&v0.instancing===!1)E9=!0;else if(!d.isInstancedMesh&&v0.instancing===!0)E9=!0;else if(d.isSkinnedMesh&&v0.skinning===!1)E9=!0;else if(!d.isSkinnedMesh&&v0.skinning===!0)E9=!0;else if(d.isInstancedMesh&&v0.instancingColor===!0&&d.instanceColor===null)E9=!0;else if(d.isInstancedMesh&&v0.instancingColor===!1&&d.instanceColor!==null)E9=!0;else if(d.isInstancedMesh&&v0.instancingMorph===!0&&d.morphTexture===null)E9=!0;else if(d.isInstancedMesh&&v0.instancingMorph===!1&&d.morphTexture!==null)E9=!0;else if(v0.envMap!==V0)E9=!0;else if(l.fog===!0&&v0.fog!==Y0)E9=!0;else if(v0.numClippingPlanes!==void 0&&(v0.numClippingPlanes!==Z0.numPlanes||v0.numIntersection!==Z0.numIntersection))E9=!0;else if(v0.vertexAlphas!==P0)E9=!0;else if(v0.vertexTangents!==u0)E9=!0;else if(v0.morphTargets!==f0)E9=!0;else if(v0.morphNormals!==W9)E9=!0;else if(v0.morphColors!==C9)E9=!0;else if(v0.toneMapping!==p9)E9=!0;else if(v0.morphTargetsCount!==P9)E9=!0}else E9=!0,v0.__version=l.version;let K8=v0.currentProgram;if(E9===!0)K8=VJ(l,y,d);let eQ=!1,H8=!1,ZZ=!1,j9=K8.getUniforms(),sJ=v0.uniforms;if(U0.useProgram(K8.program))eQ=!0,H8=!0,ZZ=!0;if(l.id!==p)p=l.id,H8=!0;if(eQ||v!==I){if(U0.buffers.depth.getReversed()&&I.reversedDepth!==!0)I._reversedDepth=!0,I.updateProjectionMatrix();j9.setValue(P,"projectionMatrix",I.projectionMatrix),j9.setValue(P,"viewMatrix",I.matrixWorldInverse);let nJ=j9.map.cameraPosition;if(nJ!==void 0)nJ.setValue(P,c0.setFromMatrixPosition(I.matrixWorld));if(R9.logarithmicDepthBuffer)j9.setValue(P,"logDepthBufFC",2/(Math.log(I.far+1)/Math.LN2));if(l.isMeshPhongMaterial||l.isMeshToonMaterial||l.isMeshLambertMaterial||l.isMeshBasicMaterial||l.isMeshStandardMaterial||l.isShaderMaterial)j9.setValue(P,"isOrthographic",I.isOrthographicCamera===!0);if(v!==I)v=I,H8=!0,ZZ=!0}if(v0.needsLights){if(z9.state.directionalShadowMap.length>0)j9.setValue(P,"directionalShadowMap",z9.state.directionalShadowMap,L);if(z9.state.spotShadowMap.length>0)j9.setValue(P,"spotShadowMap",z9.state.spotShadowMap,L);if(z9.state.pointShadowMap.length>0)j9.setValue(P,"pointShadowMap",z9.state.pointShadowMap,L)}if(d.isSkinnedMesh){j9.setOptional(P,d,"bindMatrix"),j9.setOptional(P,d,"bindMatrixInverse");let bJ=d.skeleton;if(bJ){if(bJ.boneTexture===null)bJ.computeBoneTexture();j9.setValue(P,"boneTexture",bJ.boneTexture,L)}}if(d.isBatchedMesh){if(j9.setOptional(P,d,"batchingTexture"),j9.setValue(P,"batchingTexture",d._matricesTexture,L),j9.setOptional(P,d,"batchingIdTexture"),j9.setValue(P,"batchingIdTexture",d._indirectTexture,L),j9.setOptional(P,d,"batchingColorTexture"),d._colorsTexture!==null)j9.setValue(P,"batchingColorTexture",d._colorsTexture,L)}let z8=u.morphAttributes;if(z8.position!==void 0||z8.normal!==void 0||z8.color!==void 0)q0.update(d,u,K8);if(H8||v0.receiveShadow!==d.receiveShadow)v0.receiveShadow=d.receiveShadow,j9.setValue(P,"receiveShadow",d.receiveShadow);if(l.isMeshGouraudMaterial&&l.envMap!==null)sJ.envMap.value=V0,sJ.flipEnvMap.value=V0.isCubeTexture&&V0.isRenderTargetTexture===!1?-1:1;if(l.isMeshStandardMaterial&&l.envMap===null&&y.environment!==null)sJ.envMapIntensity.value=y.environmentIntensity;if(sJ.dfgLUT!==void 0)sJ.dfgLUT.value=sB();if(H8){if(j9.setValue(P,"toneMappingExposure",T.toneMappingExposure),v0.needsLights)QJ(sJ,ZZ);if(Y0&&l.fog===!0)S0.refreshFogUniforms(sJ,Y0);S0.refreshMaterialUniforms(sJ,l,L0,Q0,B.state.transmissionRenderTarget[I.id]),gZ.upload(P,T9(v0),sJ,L)}if(l.isShaderMaterial&&l.uniformsNeedUpdate===!0)gZ.upload(P,T9(v0),sJ,L),l.uniformsNeedUpdate=!1;if(l.isSpriteMaterial)j9.setValue(P,"center",d.center);if(j9.setValue(P,"modelViewMatrix",d.modelViewMatrix),j9.setValue(P,"normalMatrix",d.normalMatrix),j9.setValue(P,"modelMatrix",d.matrixWorld),l.isShaderMaterial||l.isRawShaderMaterial){let bJ=l.uniformsGroups;for(let nJ=0,dK=bJ.length;nJ0&&L.useMultisampledRTT(I)===!1)l=S.get(I).__webglMultisampledFramebuffer;else if(Array.isArray(P0))l=P0[u];else l=P0;s.copy(I.viewport),m.copy(I.scissor),h=I.scissorTest}else s.copy(i).multiplyScalar(L0).floor(),m.copy(K0).multiplyScalar(L0).floor(),h=J0;if(u!==0)l=GJ;if(U0.bindFramebuffer(P.FRAMEBUFFER,l))U0.drawBuffers(I,l);if(U0.viewport(s),U0.scissor(m),U0.setScissorTest(h),d){let G0=S.get(I.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_CUBE_MAP_POSITIVE_X+y,G0.__webglTexture,u)}else if(Y0){let G0=y;for(let V0=0;V0=0&&y<=I.width-l&&(u>=0&&u<=I.height-d)){if(I.textures.length>1)P.readBuffer(P.COLOR_ATTACHMENT0+G0);P.readPixels(y,u,l,d,X0.convert(u0),X0.convert(f0),Y0)}}finally{let P0=b!==null?S.get(b).__webglFramebuffer:null;U0.bindFramebuffer(P.FRAMEBUFFER,P0)}}},this.readRenderTargetPixelsAsync=async function(I,y,u,l,d,Y0,R0,G0=0){if(!(I&&I.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let V0=S.get(I).__webglFramebuffer;if(I.isWebGLCubeRenderTarget&&R0!==void 0)V0=V0[R0];if(V0)if(y>=0&&y<=I.width-l&&(u>=0&&u<=I.height-d)){U0.bindFramebuffer(P.FRAMEBUFFER,V0);let P0=I.textures[G0],u0=P0.format,f0=P0.type;if(!R9.textureFormatReadable(u0))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!R9.textureTypeReadable(f0))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let W9=P.createBuffer();if(P.bindBuffer(P.PIXEL_PACK_BUFFER,W9),P.bufferData(P.PIXEL_PACK_BUFFER,Y0.byteLength,P.STREAM_READ),I.textures.length>1)P.readBuffer(P.COLOR_ATTACHMENT0+G0);P.readPixels(y,u,l,d,X0.convert(u0),X0.convert(f0),0);let C9=b!==null?S.get(b).__webglFramebuffer:null;U0.bindFramebuffer(P.FRAMEBUFFER,C9);let p9=P.fenceSync(P.SYNC_GPU_COMMANDS_COMPLETE,0);return P.flush(),await CG(P,p9,4),P.bindBuffer(P.PIXEL_PACK_BUFFER,W9),P.getBufferSubData(P.PIXEL_PACK_BUFFER,0,Y0),P.deleteBuffer(W9),P.deleteSync(p9),Y0}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(I,y=null,u=0){let l=Math.pow(2,-u),d=Math.floor(I.image.width*l),Y0=Math.floor(I.image.height*l),R0=y!==null?y.x:0,G0=y!==null?y.y:0;L.setTexture2D(I,0),P.copyTexSubImage2D(P.TEXTURE_2D,u,0,0,R0,G0,d,Y0),U0.unbindTexture()};let X7=P.createFramebuffer(),tQ=P.createFramebuffer();if(this.copyTextureToTexture=function(I,y,u=null,l=null,d=0,Y0=null){if(Y0===null)if(d!==0)M$("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),Y0=d,d=0;else Y0=0;let R0,G0,V0,P0,u0,f0,W9,C9,p9,m9=I.isCompressedTexture?I.mipmaps[Y0]:I.image;if(u!==null)R0=u.max.x-u.min.x,G0=u.max.y-u.min.y,V0=u.isBox3?u.max.z-u.min.z:1,P0=u.min.x,u0=u.min.y,f0=u.isBox3?u.min.z:0;else{let z8=Math.pow(2,-d);if(R0=Math.floor(m9.width*z8),G0=Math.floor(m9.height*z8),I.isDataArrayTexture)V0=m9.depth;else if(I.isData3DTexture)V0=Math.floor(m9.depth*z8);else V0=1;P0=0,u0=0,f0=0}if(l!==null)W9=l.x,C9=l.y,p9=l.z;else W9=0,C9=0,p9=0;let P9=X0.convert(y.format),v0=X0.convert(y.type),z9;if(y.isData3DTexture)L.setTexture3D(y,0),z9=P.TEXTURE_3D;else if(y.isDataArrayTexture||y.isCompressedArrayTexture)L.setTexture2DArray(y,0),z9=P.TEXTURE_2D_ARRAY;else L.setTexture2D(y,0),z9=P.TEXTURE_2D;P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,y.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,y.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,y.unpackAlignment);let E9=P.getParameter(P.UNPACK_ROW_LENGTH),K8=P.getParameter(P.UNPACK_IMAGE_HEIGHT),eQ=P.getParameter(P.UNPACK_SKIP_PIXELS),H8=P.getParameter(P.UNPACK_SKIP_ROWS),ZZ=P.getParameter(P.UNPACK_SKIP_IMAGES);P.pixelStorei(P.UNPACK_ROW_LENGTH,m9.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,m9.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,P0),P.pixelStorei(P.UNPACK_SKIP_ROWS,u0),P.pixelStorei(P.UNPACK_SKIP_IMAGES,f0);let j9=I.isDataArrayTexture||I.isData3DTexture,sJ=y.isDataArrayTexture||y.isData3DTexture;if(I.isDepthTexture){let z8=S.get(I),bJ=S.get(y),nJ=S.get(z8.__renderTarget),dK=S.get(bJ.__renderTarget);U0.bindFramebuffer(P.READ_FRAMEBUFFER,nJ.__webglFramebuffer),U0.bindFramebuffer(P.DRAW_FRAMEBUFFER,dK.__webglFramebuffer);for(let GQ=0;GQMath.PI)$-=rJ;if(Z<-Math.PI)Z+=rJ;else if(Z>Math.PI)Z-=rJ;if($<=Z)this._spherical.theta=Math.max($,Math.min(Z,this._spherical.theta));else this._spherical.theta=this._spherical.theta>($+Z)/2?Math.max($,this._spherical.theta):Math.min(Z,this._spherical.theta)}if(this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0)this.target.addScaledVector(this._panOffset,this.dampingFactor);else this.target.add(this._panOffset);this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let W=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{let K=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),W=K!=this._spherical.radius}if(XJ.setFromSpherical(this._spherical),XJ.applyQuaternion(this._quatInverse),Q.copy(this.target).add(XJ),this.object.lookAt(this.target),this.enableDamping===!0)this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor);else this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0);if(this.zoomToCursor&&this._performCursorZoom){let K=null;if(this.object.isPerspectiveCamera){let H=XJ.length();K=this._clampDistance(H*this._scale);let X=H-K;this.object.position.addScaledVector(this._dollyDirection,X),this.object.updateMatrixWorld(),W=!!X}else if(this.object.isOrthographicCamera){let H=new f(this._mouse.x,this._mouse.y,0);H.unproject(this.object);let X=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),W=X!==this.object.zoom;let Y=new f(this._mouse.x,this._mouse.y,0);Y.unproject(this.object),this.object.position.sub(Y).add(H),this.object.updateMatrixWorld(),K=XJ.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;if(K!==null)if(this.screenSpacePanning)this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(K).add(this.object.position);else if(lW.origin.copy(this.object.position),lW.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(lW.direction))sX||8*(1-this._lastQuaternion.dot(this.object.quaternion))>sX||this._lastTargetPosition.distanceToSquared(this.target)>sX)return this.dispatchEvent(Rq),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0;return!1}_getAutoRotationAngle(J){if(J!==null)return rJ/60*this.autoRotateSpeed*J;else return rJ/60/60*this.autoRotateSpeed}_getZoomScale(J){let Q=Math.abs(J*0.01);return Math.pow(0.95,this.zoomSpeed*Q)}_rotateLeft(J){this._sphericalDelta.theta-=J}_rotateUp(J){this._sphericalDelta.phi-=J}_panLeft(J,Q){XJ.setFromMatrixColumn(Q,0),XJ.multiplyScalar(-J),this._panOffset.add(XJ)}_panUp(J,Q){if(this.screenSpacePanning===!0)XJ.setFromMatrixColumn(Q,1);else XJ.setFromMatrixColumn(Q,0),XJ.crossVectors(this.object.up,XJ);XJ.multiplyScalar(J),this._panOffset.add(XJ)}_pan(J,Q){let $=this.domElement;if(this.object.isPerspectiveCamera){let Z=this.object.position;XJ.copy(Z).sub(this.target);let W=XJ.length();W*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*J*W/$.clientHeight,this.object.matrix),this._panUp(2*Q*W/$.clientHeight,this.object.matrix)}else if(this.object.isOrthographicCamera)this._panLeft(J*(this.object.right-this.object.left)/this.object.zoom/$.clientWidth,this.object.matrix),this._panUp(Q*(this.object.top-this.object.bottom)/this.object.zoom/$.clientHeight,this.object.matrix);else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1}_dollyOut(J){if(this.object.isPerspectiveCamera||this.object.isOrthographicCamera)this._scale/=J;else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1}_dollyIn(J){if(this.object.isPerspectiveCamera||this.object.isOrthographicCamera)this._scale*=J;else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1}_updateZoomParameters(J,Q){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let $=this.domElement.getBoundingClientRect(),Z=J-$.left,W=Q-$.top,K=$.width,H=$.height;this._mouse.x=Z/K*2-1,this._mouse.y=-(W/H)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(J){return Math.max(this.minDistance,Math.min(this.maxDistance,J))}_handleMouseDownRotate(J){this._rotateStart.set(J.clientX,J.clientY)}_handleMouseDownDolly(J){this._updateZoomParameters(J.clientX,J.clientX),this._dollyStart.set(J.clientX,J.clientY)}_handleMouseDownPan(J){this._panStart.set(J.clientX,J.clientY)}_handleMouseMoveRotate(J){this._rotateEnd.set(J.clientX,J.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let Q=this.domElement;this._rotateLeft(rJ*this._rotateDelta.x/Q.clientHeight),this._rotateUp(rJ*this._rotateDelta.y/Q.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(J){if(this._dollyEnd.set(J.clientX,J.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0)this._dollyOut(this._getZoomScale(this._dollyDelta.y));else if(this._dollyDelta.y<0)this._dollyIn(this._getZoomScale(this._dollyDelta.y));this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(J){this._panEnd.set(J.clientX,J.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(J){if(this._updateZoomParameters(J.clientX,J.clientY),J.deltaY<0)this._dollyIn(this._getZoomScale(J.deltaY));else if(J.deltaY>0)this._dollyOut(this._getZoomScale(J.deltaY));this.update()}_handleKeyDown(J){let Q=!1;switch(J.code){case this.keys.UP:if(J.ctrlKey||J.metaKey||J.shiftKey){if(this.enableRotate)this._rotateUp(rJ*this.keyRotateSpeed/this.domElement.clientHeight)}else if(this.enablePan)this._pan(0,this.keyPanSpeed);Q=!0;break;case this.keys.BOTTOM:if(J.ctrlKey||J.metaKey||J.shiftKey){if(this.enableRotate)this._rotateUp(-rJ*this.keyRotateSpeed/this.domElement.clientHeight)}else if(this.enablePan)this._pan(0,-this.keyPanSpeed);Q=!0;break;case this.keys.LEFT:if(J.ctrlKey||J.metaKey||J.shiftKey){if(this.enableRotate)this._rotateLeft(rJ*this.keyRotateSpeed/this.domElement.clientHeight)}else if(this.enablePan)this._pan(this.keyPanSpeed,0);Q=!0;break;case this.keys.RIGHT:if(J.ctrlKey||J.metaKey||J.shiftKey){if(this.enableRotate)this._rotateLeft(-rJ*this.keyRotateSpeed/this.domElement.clientHeight)}else if(this.enablePan)this._pan(-this.keyPanSpeed,0);Q=!0;break}if(Q)J.preventDefault(),this.update()}_handleTouchStartRotate(J){if(this._pointers.length===1)this._rotateStart.set(J.pageX,J.pageY);else{let Q=this._getSecondPointerPosition(J),$=0.5*(J.pageX+Q.x),Z=0.5*(J.pageY+Q.y);this._rotateStart.set($,Z)}}_handleTouchStartPan(J){if(this._pointers.length===1)this._panStart.set(J.pageX,J.pageY);else{let Q=this._getSecondPointerPosition(J),$=0.5*(J.pageX+Q.x),Z=0.5*(J.pageY+Q.y);this._panStart.set($,Z)}}_handleTouchStartDolly(J){let Q=this._getSecondPointerPosition(J),$=J.pageX-Q.x,Z=J.pageY-Q.y,W=Math.sqrt($*$+Z*Z);this._dollyStart.set(0,W)}_handleTouchStartDollyPan(J){if(this.enableZoom)this._handleTouchStartDolly(J);if(this.enablePan)this._handleTouchStartPan(J)}_handleTouchStartDollyRotate(J){if(this.enableZoom)this._handleTouchStartDolly(J);if(this.enableRotate)this._handleTouchStartRotate(J)}_handleTouchMoveRotate(J){if(this._pointers.length==1)this._rotateEnd.set(J.pageX,J.pageY);else{let $=this._getSecondPointerPosition(J),Z=0.5*(J.pageX+$.x),W=0.5*(J.pageY+$.y);this._rotateEnd.set(Z,W)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let Q=this.domElement;this._rotateLeft(rJ*this._rotateDelta.x/Q.clientHeight),this._rotateUp(rJ*this._rotateDelta.y/Q.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(J){if(this._pointers.length===1)this._panEnd.set(J.pageX,J.pageY);else{let Q=this._getSecondPointerPosition(J),$=0.5*(J.pageX+Q.x),Z=0.5*(J.pageY+Q.y);this._panEnd.set($,Z)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(J){let Q=this._getSecondPointerPosition(J),$=J.pageX-Q.x,Z=J.pageY-Q.y,W=Math.sqrt($*$+Z*Z);this._dollyEnd.set(0,W),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);let K=(J.pageX+Q.x)*0.5,H=(J.pageY+Q.y)*0.5;this._updateZoomParameters(K,H)}_handleTouchMoveDollyPan(J){if(this.enableZoom)this._handleTouchMoveDolly(J);if(this.enablePan)this._handleTouchMovePan(J)}_handleTouchMoveDollyRotate(J){if(this.enableZoom)this._handleTouchMoveDolly(J);if(this.enableRotate)this._handleTouchMoveRotate(J)}_addPointer(J){this._pointers.push(J.pointerId)}_removePointer(J){delete this._pointerPositions[J.pointerId];for(let Q=0;QX)H=H._prev}if(H)$._next=H._next,H._next=$;else $._next=Q[Z],Q[Z]=$;if($._next)$._next._prev=$;else Q[W]=$;return $._prev=H,$.parent=$._dp=Q,$},iZ=function J(Q,$,Z,W){if(Z===void 0)Z="_first";if(W===void 0)W="_last";var{_prev:K,_next:H}=$;if(K)K._next=H;else if(Q[Z]===$)Q[Z]=H;if(H)H._prev=K;else if(Q[W]===$)Q[W]=K;$._next=$._prev=$.parent=null},JQ=function J(Q,$){Q.parent&&(!$||Q.parent.autoRemoveChildren)&&Q.parent.remove&&Q.parent.remove(Q),Q._act=0},wQ=function J(Q,$){if(Q&&(!$||$._end>Q._dur||$._start<0)){var Z=Q;while(Z)Z._dirty=1,Z=Z.parent}return Q},OD=function J(Q){var $=Q.parent;while($&&$.parent)$._dirty=1,$.totalDuration(),$=$.parent;return Q},HY=function J(Q,$,Z,W){return Q._startAt&&(BJ?Q._startAt.revert(sW):Q.vars.immediateRender&&!Q.vars.autoRevert||Q._startAt.render($,!0,W))},MD=function J(Q){return!Q||Q._ts&&J(Q.parent)},Lq=function J(Q){return Q._repeat?f$(Q._tTime,Q=Q.duration()+Q._rDelay)*Q:0},f$=function J(Q,$){var Z=Math.floor(Q=a9(Q/$));return Q&&Z===Q?Z-1:Z},tW=function J(Q,$){return(Q-$._start)*$._ts+($._ts>=0?0:$._dirty?$.totalDuration():$._tDur)},$K=function J(Q){return Q._end=a9(Q._start+(Q._tDur/Math.abs(Q._ts||Q._rts||S9)||0))},ZK=function J(Q,$){var Z=Q._dp;if(Z&&Z.smoothChildTiming&&Q._ts)Q._start=a9(Z._time-(Q._ts>0?$/Q._ts:((Q._dirty?Q.totalDuration():Q._tDur)-$)/-Q._ts)),$K(Q),Z._dirty||wQ(Z,Q);return Q},yq=function J(Q,$){var Z;if($._time||!$._dur&&$._initted||$._startS9)$.render(Z,!0)}if(wQ(Q,$)._dp&&Q._initted&&Q._time>=Q._dur&&Q._ts){if(Q._dur=0&&Z.totalTime(Z._tTime),Z=Z._dp}Q._zTime=-S9}},J7=function J(Q,$,Z,W){return $.parent&&JQ($),$._start=a9((I7(Z)?Z:Z||Q!==v9?I8(Q,Z,$):Q._time)+$._delay),$._end=a9($._start+($.totalDuration()/Math.abs($.timeScale())||0)),bq(Q,$,"_first","_last",Q._sort?"_start":0),XY($)||(Q._recent=$),W||yq(Q,$),Q._ts<0&&ZK(Q,Q._tTime),Q},hq=function J(Q,$){return(E8.ScrollTrigger||QK("scrollTrigger",$))&&E8.ScrollTrigger.create($,Q)},fq=function J(Q,$,Z,W,K){if(AY(Q,$,K),!Q._initted)return 1;if(!Z&&Q._pt&&!BJ&&(Q._dur&&Q.vars.lazy!==!1||!Q._dur&&Q.vars.lazy)&&Tq!==eJ.frame)return t7.push(Q),Q._lazy=[K,W],1},LD=function J(Q){var $=Q.parent;return $&&$._ts&&$._initted&&!$._lock&&($.rawTime()<0||J($))},XY=function J(Q){var $=Q.data;return $==="isFromStart"||$==="isStart"},BD=function J(Q,$,Z,W){var K=Q.ratio,H=$<0||!$&&(!Q._start&&LD(Q)&&!(!Q._initted&&XY(Q))||(Q._ts<0||Q._dp._ts<0)&&!XY(Q))?0:1,X=Q._rDelay,Y=0,U,G,q;if(X&&Q._repeat){if(Y=aZ(0,Q._tDur,$),G=f$(Y,X),Q._yoyo&&G&1&&(H=1-H),G!==f$(Q._tTime,X))K=1-H,Q.vars.repeatRefresh&&Q._initted&&Q.invalidate()}if(H!==K||BJ||W||Q._zTime===S9||!$&&Q._zTime){if(!Q._initted&&fq(Q,$,W,Z,Y))return;q=Q._zTime,Q._zTime=$||(Z?S9:0),Z||(Z=$&&!q),Q.ratio=H,Q._from&&(H=1-H),Q._time=0,Q._tTime=Y,U=Q._pt;while(U)U.r(H,U.d),U=U._next;if($<0&&HY(Q,$,Z,!0),Q._onUpdate&&!Z&&F8(Q,"onUpdate"),Y&&Q._repeat&&!Z&&Q.parent&&F8(Q,"onRepeat"),($>=Q._tDur||$<0)&&Q.ratio===H){if(H&&JQ(Q,1),!Z&&!BJ)F8(Q,H?"onComplete":"onReverseComplete",!0),Q._prom&&Q._prom()}}else if(!Q._zTime)Q._zTime=$},DD=function J(Q,$,Z){var W;if(Z>$){W=Q._first;while(W&&W._start<=Z){if(W.data==="isPause"&&W._start>$)return W;W=W._next}}else{W=Q._last;while(W&&W._start>=Z){if(W.data==="isPause"&&W._start<$)return W;W=W._prev}}},v$=function J(Q,$,Z,W){var K=Q._repeat,H=a9($)||0,X=Q._tTime/Q._tDur;return X&&!W&&(Q._time*=H/Q._dur),Q._dur=H,Q._tDur=!K?H:K<0?10000000000:a9(H*(K+1)+Q._rDelay*K),X>0&&!W&&ZK(Q,Q._tTime=Q._tDur*X),Q.parent&&$K(Q),Z||wQ(Q.parent,Q),Q},Bq=function J(Q){return Q instanceof LJ?wQ(Q):v$(Q,Q._dur)},zD={_start:0,endTime:sZ,totalDuration:sZ},I8=function J(Q,$,Z){var W=Q.labels,K=Q._recent||zD,H=Q.duration()>=P8?K.endTime(!1):Q._dur,X,Y,U;if(YJ($)&&(isNaN($)||($ in W))){if(Y=$.charAt(0),U=$.substr(-1)==="%",X=$.indexOf("="),Y==="<"||Y===">")return X>=0&&($=$.replace(/=/,"")),(Y==="<"?K._start:K.endTime(K._repeat>=0))+(parseFloat($.substr(1))||0)*(U?(X<0?K:Z).totalDuration()/100:1);if(X<0)return $ in W||(W[$]=H),W[$];if(Y=parseFloat($.charAt(X-1)+$.substr(X+1)),U&&Z)Y=Y/100*(AJ(Z)?Z[0]:Z).totalDuration();return X>1?J(Q,$.substr(0,X-1),Z)+Y:H+Y}return $==null?H:+$},uZ=function J(Q,$,Z){var W=I7($[1]),K=(W?2:1)+(Q<2?0:1),H=$[K],X,Y;if(W&&(H.duration=$[1]),H.parent=Z,Q){X=H,Y=Z;while(Y&&!("immediateRender"in X))X=Y.vars.defaults||{},Y=J8(Y.vars.inherit)&&Y.parent;H.immediateRender=J8(X.immediateRender),Q<2?H.runBackwards=1:H.startAt=$[K-1]}return new s9($[0],H,$[K+1])},QQ=function J(Q,$){return Q||Q===0?$(Q):$},aZ=function J(Q,$,Z){return Z$?$:Z},DJ=function J(Q,$){return!YJ(Q)||!($=GD.exec(Q))?"":$[1]},VD=function J(Q,$,Z){return QQ(Z,function(W){return aZ(Q,$,W)})},YY=[].slice,vq=function J(Q,$){return Q&&Q7(Q)&&"length"in Q&&(!$&&!Q.length||(Q.length-1 in Q)&&Q7(Q[0]))&&!Q.nodeType&&Q!==e8},kD=function J(Q,$,Z){if(Z===void 0)Z=[];return Q.forEach(function(W){var K;return YJ(W)&&!$||vq(W,1)?(K=Z).push.apply(K,A8(W)):Z.push(W)})||Z},A8=function J(Q,$,Z){return f9&&!$&&f9.selector?f9.selector(Q):YJ(Q)&&!Z&&(WY||!g$())?YY.call(($||MY).querySelectorAll(Q),0):AJ(Q)?kD(Q,Z):vq(Q)?YY.call(Q,0):Q?[Q]:[]},UY=function J(Q){return Q=A8(Q)[0]||cZ("Invalid scope")||{},function($){var Z=Q.current||Q.nativeElement||Q;return A8($,Z.querySelectorAll?Z:Z===Q?cZ("Invalid scope")||MY.createElement("div"):Q)}},gq=function J(Q){return Q.sort(function(){return 0.5-Math.random()})},pq=function J(Q){if(d9(Q))return Q;var $=Q7(Q)?Q:{each:Q},Z=SQ($.ease),W=$.from||0,K=parseFloat($.base)||0,H={},X=W>0&&W<1,Y=isNaN(W)||X,U=$.axis,G=W,q=W;if(YJ(W))G=q={center:0.5,edges:0.5,end:1}[W]||0;else if(!X&&Y)G=W[0],q=W[1];return function(N,R,M){var E=(M||$).length,F=H[E],O,k,D,B,A,C,w,T,z;if(!F){if(z=$.grid==="auto"?0:($.grid||[1,P8])[1],!z){w=-P8;while(w<(w=M[z++].getBoundingClientRect().left)&&zw&&(w=A),AE?E-1:!U?Math.max(z,E/z):U==="y"?E/z:z)||0)*(W==="edges"?-1:1),F.b=E<0?K-E:K,F.u=DJ($.amount||$.each)||0,Z=Z&&E<0?iq(Z):Z}return E=(F[N]-F.min)/F.max||0,a9(F.b+(Z?Z(E):E)*F.v)+F.u}},GY=function J(Q){var $=Math.pow(10,((Q+"").split(".")[1]||"").length);return function(Z){var W=a9(Math.round(parseFloat(Z)/Q)*Q*$);return(W-W%1)/$+(I7(Z)?0:DJ(Z))}},mq=function J(Q,$){var Z=AJ(Q),W,K;if(!Z&&Q7(Q))if(W=Z=Q.radius||P8,Q.values){if(Q=A8(Q.values),K=!I7(Q[0]))W*=W}else Q=GY(Q.increment);return QQ($,!Z?GY(Q):d9(Q)?function(H){return K=Q(H),Math.abs(K-H)<=W?K:H}:function(H){var X=parseFloat(K?H.x:H),Y=parseFloat(K?H.y:0),U=P8,G=0,q=Q.length,N,R;while(q--){if(K)N=Q[q].x-X,R=Q[q].y-Y,N=N*N+R*R;else N=Math.abs(Q[q]-X);if(NW?K-H:H)})},p$=function J(Q){var $=0,Z="",W,K,H,X;while(~(W=Q.indexOf("random(",$)))H=Q.indexOf(")",W),X=Q.charAt(W+7)==="[",K=Q.substr(W+7,H-W-7).match(X?Pq:ZY),Z+=Q.substr($,W-$)+dq(X?K:+K[0],X?0:+K[1],+K[2]||0.00001),$=H+1;return Z+Q.substr($,Q.length-$)},lq=function J(Q,$,Z,W,K){var H=$-Q,X=W-Z;return QQ(K,function(Y){return Z+((Y-Q)/H*X||0)})},SD=function J(Q,$,Z,W){var K=isNaN(Q+$)?0:function(R){return(1-R)*Q+R*$};if(!K){var H=YJ(Q),X={},Y,U,G,q,N;if(Z===!0&&(W=1)&&(Z=null),H)Q={p:Q},$={p:$};else if(AJ(Q)&&!AJ($)){G=[],q=Q.length,N=q-2;for(U=1;U(X=Math.abs(X)))Y=H,K=X;return Y},F8=function J(Q,$,Z){var W=Q.vars,K=W[$],H=f9,X=Q._ctx,Y,U,G;if(!K)return;return Y=W[$+"Params"],U=W.callbackScope||Q,Z&&t7.length&&aW(),X&&(f9=X),G=Y?K.apply(U,Y):K.call(U),f9=H,G},pZ=function J(Q){return JQ(Q),Q.scrollTrigger&&Q.scrollTrigger.kill(!!BJ),Q.progress()<1&&F8(Q,"onInterrupt"),Q},b$,cq=[],sq=function J(Q){if(!Q)return;if(Q=!Q.name&&Q.default||Q,FY()||Q.headless){var $=Q.name,Z=d9(Q),W=$&&!Z&&Q.init?function(){this._props=[]}:Q,K={init:sZ,render:TY,add:IY,kill:cD,modifier:lD,rawVars:0},H={targetTest:0,get:0,getSetter:WK,aliases:{},register:0};if(g$(),Q!==W){if(tJ[$])return;if($8(W,$8(rW(Q,K),H)),h$(W.prototype,h$(K,rW(Q,H))),tJ[W.prop=$]=W,Q.targetTest)nW.push(W),LY[$]=1;$=($==="css"?"CSS":$.charAt(0).toUpperCase()+$.substr(1))+"Plugin"}Sq($,W),Q.register&&Q.register(wJ,W,gJ)}else cq.push(Q)},w9=255,mZ={aqua:[0,w9,w9],lime:[0,w9,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,w9],navy:[0,0,128],white:[w9,w9,w9],olive:[128,128,0],yellow:[w9,w9,0],orange:[w9,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[w9,0,0],pink:[w9,192,203],cyan:[0,w9,w9],transparent:[w9,w9,w9,0]},rX=function J(Q,$,Z){return Q+=Q<0?1:Q>1?-1:0,(Q*6<1?$+(Z-$)*Q*6:Q<0.5?Z:Q*3<2?$+(Z-$)*(0.6666666666666666-Q)*6:$)*w9+0.5|0},nq=function J(Q,$,Z){var W=!Q?mZ.black:I7(Q)?[Q>>16,Q>>8&w9,Q&w9]:0,K,H,X,Y,U,G,q,N,R,M;if(!W){if(Q.substr(-1)===",")Q=Q.substr(0,Q.length-1);if(mZ[Q])W=mZ[Q];else if(Q.charAt(0)==="#"){if(Q.length<6)K=Q.charAt(1),H=Q.charAt(2),X=Q.charAt(3),Q="#"+K+K+H+H+X+X+(Q.length===5?Q.charAt(4)+Q.charAt(4):"");if(Q.length===9)return W=parseInt(Q.substr(1,6),16),[W>>16,W>>8&w9,W&w9,parseInt(Q.substr(7),16)/255];Q=parseInt(Q.substr(1),16),W=[Q>>16,Q>>8&w9,Q&w9]}else if(Q.substr(0,3)==="hsl"){if(W=M=Q.match(ZY),!$)Y=+W[0]%360/360,U=+W[1]/100,G=+W[2]/100,H=G<=0.5?G*(U+1):G+U-G*U,K=G*2-H,W.length>3&&(W[3]*=1),W[0]=rX(Y+0.3333333333333333,K,H),W[1]=rX(Y,K,H),W[2]=rX(Y-0.3333333333333333,K,H);else if(~Q.indexOf("="))return W=Q.match(EY),Z&&W.length<4&&(W[3]=1),W}else W=Q.match(ZY)||mZ.transparent;W=W.map(Number)}if($&&!M){if(K=W[0]/w9,H=W[1]/w9,X=W[2]/w9,q=Math.max(K,H,X),N=Math.min(K,H,X),G=(q+N)/2,q===N)Y=U=0;else R=q-N,U=G>0.5?R/(2-q-N):R/(q+N),Y=q===K?(H-X)/R+(HQ||O<0)&&(Z+=O-$),W+=O,A=W-Z,D=A-H,D>0||k)C=++q.frame,N=A-q.time*1000,q.time=A=A/1000,H+=D+(D>=K?4:K-D),B=1;if(k||(Y=U(E)),B)for(R=0;R=O&&R--},_listeners:X},q}(),g$=function J(){return!nZ&&eJ.wake()},q9={},jD=/^[\d.\-M][\d.\-,\s]/,_D=/["']/g,xD=function J(Q){var $={},Z=Q.substr(1,Q.length-3).split(":"),W=Z[0],K=1,H=Z.length,X,Y,U;for(;K1&&Z.config?Z.config.apply(null,~Q.indexOf("{")?[xD($[1])]:bD(Q).split(",").map(_q)):q9._CE&&jD.test(Q)?q9._CE("",Q):Z},iq=function J(Q){return function($){return 1-Q(1-$)}},aq=function J(Q,$){var Z=Q._first,W;while(Z){if(Z instanceof LJ)J(Z,$);else if(Z.vars.yoyoEase&&(!Z._yoyo||!Z._repeat)&&Z._yoyo!==$)if(Z.timeline)J(Z.timeline,$);else W=Z._ease,Z._ease=Z._yEase,Z._yEase=W,Z._yoyo=$;Z=Z._next}},SQ=function J(Q,$){return!Q?$:(d9(Q)?Q:q9[Q]||yD(Q))||$},xQ=function J(Q,$,Z,W){if(Z===void 0)Z=function X(Y){return 1-$(1-Y)};if(W===void 0)W=function X(Y){return Y<0.5?$(Y*2)/2:1-$((1-Y)*2)/2};var K={easeIn:$,easeOut:Z,easeInOut:W},H;return vJ(Q,function(X){q9[X]=E8[X]=K,q9[H=X.toLowerCase()]=Z;for(var Y in K)q9[H+(Y==="easeIn"?".in":Y==="easeOut"?".out":".inOut")]=q9[X+"."+Y]=K[Y]}),K},rq=function J(Q){return function($){return $<0.5?(1-Q(1-$*2))/2:0.5+Q(($-0.5)*2)/2}},tX=function J(Q,$,Z){var W=$>=1?$:1,K=(Z||(Q?0.3:0.45))/($<1?$:1),H=K/$Y*(Math.asin(1/W)||0),X=function U(G){return G===1?1:W*Math.pow(2,-10*G)*UD((G-H)*K)+1},Y=Q==="out"?X:Q==="in"?function(U){return 1-X(1-U)}:rq(X);return K=$Y/K,Y.config=function(U,G){return J(Q,U,G)},Y},eX=function J(Q,$){if($===void 0)$=1.70158;var Z=function K(H){return H?--H*H*(($+1)*H+$)+1:0},W=Q==="out"?Z:Q==="in"?function(K){return 1-Z(1-K)}:rq(Z);return W.config=function(K){return J(Q,K)},W};vJ("Linear,Quad,Cubic,Quart,Quint,Strong",function(J,Q){var $=Q<5?Q+1:Q;xQ(J+",Power"+($-1),Q?function(Z){return Math.pow(Z,$)}:function(Z){return Z},function(Z){return 1-Math.pow(1-Z,$)},function(Z){return Z<0.5?Math.pow(Z*2,$)/2:1-Math.pow((1-Z)*2,$)/2})});q9.Linear.easeNone=q9.none=q9.Linear.easeIn;xQ("Elastic",tX("in"),tX("out"),tX());(function(J,Q){var $=1/Q,Z=2*$,W=2.5*$,K=function H(X){return X<$?J*X*X:X0?Z+(Z+this._rDelay)*this._repeat:Z):this.totalDuration()&&this._dur},Q.totalDuration=function $(Z){if(!arguments.length)return this._tDur;return this._dirty=0,v$(this,this._repeat<0?Z:(Z-this._repeat*this._rDelay)/(this._repeat+1))},Q.totalTime=function $(Z,W){if(g$(),!arguments.length)return this._tTime;var K=this._dp;if(K&&K.smoothChildTiming&&this._ts){ZK(this,Z),!K._dp||K.parent||yq(K,this);while(K&&K.parent){if(K.parent._time!==K._start+(K._ts>=0?K._tTime/K._ts:(K.totalDuration()-K._tTime)/-K._ts))K.totalTime(K._tTime,!0);K=K.parent}if(!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&Z0||!this._tDur&&!Z))J7(this._dp,this,this._start-this._delay)}if(this._tTime!==Z||!this._dur&&!W||this._initted&&Math.abs(this._zTime)===S9||!Z&&!this._initted&&(this.add||this._ptLookup))this._ts||(this._pTime=Z),jq(this,Z,W);return this},Q.time=function $(Z,W){return arguments.length?this.totalTime(Math.min(this.totalDuration(),Z+Lq(this))%(this._dur+this._rDelay)||(Z?this._dur:0),W):this._time},Q.totalProgress=function $(Z,W){return arguments.length?this.totalTime(this.totalDuration()*Z,W):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>=0&&this._initted?1:0},Q.progress=function $(Z,W){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-Z:Z)+Lq(this),W):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},Q.iteration=function $(Z,W){var K=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(Z-1)*K,W):this._repeat?f$(this._tTime,K)+1:1},Q.timeScale=function $(Z,W){if(!arguments.length)return this._rts===-S9?0:this._rts;if(this._rts===Z)return this;var K=this.parent&&this._ts?tW(this.parent._time,this):this._tTime;return this._rts=+Z||0,this._ts=this._ps||Z===-S9?0:this._rts,this.totalTime(aZ(-Math.abs(this._delay),this.totalDuration(),K),W!==!1),$K(this),OD(this)},Q.paused=function $(Z){if(!arguments.length)return this._ps;if(this._ps!==Z)if(this._ps=Z,Z)this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0;else g$(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==S9&&(this._tTime-=S9));return this},Q.startTime=function $(Z){if(arguments.length){this._start=Z;var W=this.parent||this._dp;return W&&(W._sort||!this.parent)&&J7(W,this,Z-this._delay),this}return this._start},Q.endTime=function $(Z){return this._start+(J8(Z)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},Q.rawTime=function $(Z){var W=this.parent||this._dp;return!W?this._tTime:Z&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):!this._ts?this._tTime:tW(W.rawTime(Z),this)},Q.revert=function $(Z){if(Z===void 0)Z=ND;var W=BJ;if(BJ=Z,VY(this))this.timeline&&this.timeline.revert(Z),this.totalTime(-0.01,Z.suppressEvents);return this.data!=="nested"&&Z.kill!==!1&&this.kill(),BJ=W,this},Q.globalTime=function $(Z){var W=this,K=arguments.length?Z:W.rawTime();while(W)K=W._start+K/(Math.abs(W._ts)||1),W=W._dp;return!this.parent&&this._sat?this._sat.globalTime(Z):K},Q.repeat=function $(Z){if(arguments.length)return this._repeat=Z===1/0?-2:Z,Bq(this);return this._repeat===-2?1/0:this._repeat},Q.repeatDelay=function $(Z){if(arguments.length){var W=this._time;return this._rDelay=Z,Bq(this),W?this.time(W):this}return this._rDelay},Q.yoyo=function $(Z){if(arguments.length)return this._yoyo=Z,this;return this._yoyo},Q.seek=function $(Z,W){return this.totalTime(I8(this,Z),J8(W))},Q.restart=function $(Z,W){return this.play().totalTime(Z?-this._delay:0,J8(W)),this._dur||(this._zTime=-S9),this},Q.play=function $(Z,W){return Z!=null&&this.seek(Z,W),this.reversed(!1).paused(!1)},Q.reverse=function $(Z,W){return Z!=null&&this.seek(Z||this.totalDuration(),W),this.reversed(!0).paused(!1)},Q.pause=function $(Z,W){return Z!=null&&this.seek(Z,W),this.paused(!0)},Q.resume=function $(){return this.paused(!1)},Q.reversed=function $(Z){if(arguments.length)return!!Z!==this.reversed()&&this.timeScale(-this._rts||(Z?-S9:0)),this;return this._rts<0},Q.invalidate=function $(){return this._initted=this._act=0,this._zTime=-S9,this},Q.isActive=function $(){var Z=this.parent||this._dp,W=this._start,K;return!!(!Z||this._ts&&this._initted&&Z.isActive()&&(K=Z.rawTime(!0))>=W&&K1){if(!W)delete H[Z];else H[Z]=W,K&&(H[Z+"Params"]=K),Z==="onUpdate"&&(this._onUpdate=W);return this}return H[Z]},Q.then=function $(Z){var W=this;return new Promise(function(K){var H=d9(Z)?Z:xq,X=function Y(){var U=W.then;W.then=null,d9(H)&&(H=H(W))&&(H.then||H===W)&&(W.then=U),K(H),W.then=U};if(W._initted&&W.totalProgress()===1&&W._ts>=0||!W._tTime&&W._ts<0)X();else W._prom=X})},Q.kill=function $(){pZ(this)},J}();$8(oZ.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-S9,_prom:0,_ps:!1,_rts:1});var LJ=function(J){kq(Q,J);function Q(Z,W){var K;if(Z===void 0)Z={};return K=J.call(this,Z)||this,K.labels={},K.smoothChildTiming=!!Z.smoothChildTiming,K.autoRemoveChildren=!!Z.autoRemoveChildren,K._sort=J8(Z.sortChildren),v9&&J7(Z.parent||v9,k7(K),W),Z.reversed&&K.reverse(),Z.paused&&K.paused(!0),Z.scrollTrigger&&hq(k7(K),Z.scrollTrigger),K}var $=Q.prototype;return $.to=function Z(W,K,H){return uZ(0,arguments,this),this},$.from=function Z(W,K,H){return uZ(1,arguments,this),this},$.fromTo=function Z(W,K,H,X){return uZ(2,arguments,this),this},$.set=function Z(W,K,H){return K.duration=0,K.parent=this,dZ(K).repeatDelay||(K.repeat=0),K.immediateRender=!!K.immediateRender,new s9(W,K,I8(this,H),1),this},$.call=function Z(W,K,H){return J7(this,s9.delayedCall(0,W,K),H)},$.staggerTo=function Z(W,K,H,X,Y,U,G){return H.duration=K,H.stagger=H.stagger||X,H.onComplete=U,H.onCompleteParams=G,H.parent=this,new s9(W,H,I8(this,Y)),this},$.staggerFrom=function Z(W,K,H,X,Y,U,G){return H.runBackwards=1,dZ(H).immediateRender=J8(H.immediateRender),this.staggerTo(W,K,H,X,Y,U,G)},$.staggerFromTo=function Z(W,K,H,X,Y,U,G,q){return X.startAt=H,dZ(X).immediateRender=J8(X.immediateRender),this.staggerTo(W,K,X,Y,U,G,q)},$.render=function Z(W,K,H){var X=this._time,Y=this._dirty?this.totalDuration():this._tDur,U=this._dur,G=W<=0?0:a9(W),q=this._zTime<0!==W<0&&(this._initted||!U),N,R,M,E,F,O,k,D,B,A,C,w;if(this!==v9&&G>Y&&W>=0&&(G=Y),G!==this._tTime||H||q){if(X!==this._time&&U)G+=this._time-X,W+=this._time-X;if(N=G,B=this._start,D=this._ts,O=!D,q)U||(X=this._zTime),(W||!K)&&(this._zTime=W);if(this._repeat){if(C=this._yoyo,F=U+this._rDelay,this._repeat<-1&&W<0)return this.totalTime(F*100+W,K,H);if(N=a9(G%F),G===Y)E=this._repeat,N=U;else{if(A=a9(G/F),E=~~A,E&&E===A)N=U,E--;N>U&&(N=U)}if(A=f$(this._tTime,F),!X&&this._tTime&&A!==E&&this._tTime-A*F-this._dur<=0&&(A=E),C&&E&1)N=U-N,w=1;if(E!==A&&!this._lock){var T=C&&A&1,z=T===(C&&E&1);if(E=X&&W>=0){R=this._first;while(R){if(M=R._next,(R._act||N>=R._start)&&R._ts&&k!==R){if(R.parent!==this)return this.render(W,K,H);if(R.render(R._ts>0?(N-R._start)*R._ts:(R._dirty?R.totalDuration():R._tDur)+(N-R._start)*R._ts,K,H),N!==this._time||!this._ts&&!O){k=0,M&&(G+=this._zTime=-S9);break}}R=M}}else{R=this._last;var V=W<0?W:N;while(R){if(M=R._prev,(R._act||V<=R._end)&&R._ts&&k!==R){if(R.parent!==this)return this.render(W,K,H);if(R.render(R._ts>0?(V-R._start)*R._ts:(R._dirty?R.totalDuration():R._tDur)+(V-R._start)*R._ts,K,H||BJ&&VY(R)),N!==this._time||!this._ts&&!O){k=0,M&&(G+=this._zTime=V?-S9:S9);break}}R=M}}if(k&&!K){if(this.pause(),k.render(N>=X?0:-S9)._zTime=N>=X?1:-1,this._ts)return this._start=B,$K(this),this.render(W,K,H)}if(this._onUpdate&&!K&&F8(this,"onUpdate",!0),G===Y&&this._tTime>=this.totalDuration()||!G&&X){if(B===this._start||Math.abs(D)!==Math.abs(this._ts)){if(!this._lock){if((W||!U)&&(G===Y&&this._ts>0||!G&&this._ts<0)&&JQ(this,1),!K&&!(W<0&&!X)&&(G||X||!Y))F8(this,G===Y&&W>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(G0)&&this._prom()}}}}return this},$.add=function Z(W,K){var H=this;if(I7(K)||(K=I8(this,K,W)),!(W instanceof oZ)){if(AJ(W))return W.forEach(function(X){return H.add(X,K)}),this;if(YJ(W))return this.addLabel(W,K);if(d9(W))W=s9.delayedCall(0,W);else return this}return this!==W?J7(this,W,K):this},$.getChildren=function Z(W,K,H,X){if(W===void 0)W=!0;if(K===void 0)K=!0;if(H===void 0)H=!0;if(X===void 0)X=-P8;var Y=[],U=this._first;while(U){if(U._start>=X)if(U instanceof s9)K&&Y.push(U);else H&&Y.push(U),W&&Y.push.apply(Y,U.getChildren(!0,K,H));U=U._next}return Y},$.getById=function Z(W){var K=this.getChildren(1,1,1),H=K.length;while(H--)if(K[H].vars.id===W)return K[H]},$.remove=function Z(W){if(YJ(W))return this.removeLabel(W);if(d9(W))return this.killTweensOf(W);if(W.parent===this&&iZ(this,W),W===this._recent)this._recent=this._last;return wQ(this)},$.totalTime=function Z(W,K){if(!arguments.length)return this._tTime;if(this._forcing=1,!this._dp&&this._ts)this._start=a9(eJ.time-(this._ts>0?W/this._ts:(this.totalDuration()-W)/-this._ts));return J.prototype.totalTime.call(this,W,K),this._forcing=0,this},$.addLabel=function Z(W,K){return this.labels[W]=I8(this,K),this},$.removeLabel=function Z(W){return delete this.labels[W],this},$.addPause=function Z(W,K,H){var X=s9.delayedCall(0,K||sZ,H);return X.data="isPause",this._hasPause=1,J7(this,X,I8(this,W))},$.removePause=function Z(W){var K=this._first;W=I8(this,W);while(K){if(K._start===W&&K.data==="isPause")JQ(K);K=K._next}},$.killTweensOf=function Z(W,K,H){var X=this.getTweensOf(W,H),Y=X.length;while(Y--)r7!==X[Y]&&X[Y].kill(W,K);return this},$.getTweensOf=function Z(W,K){var H=[],X=A8(W),Y=this._first,U=I7(K),G;while(Y){if(Y instanceof s9){if(RD(Y._targets,X)&&(U?(!r7||Y._initted&&Y._ts)&&Y.globalTime(0)<=K&&Y.globalTime(Y.totalDuration())>K:!K||Y.isActive()))H.push(Y)}else if((G=Y.getTweensOf(X,K)).length)H.push.apply(H,G);Y=Y._next}return H},$.tweenTo=function Z(W,K){K=K||{};var H=this,X=I8(H,W),Y=K,U=Y.startAt,G=Y.onStart,q=Y.onStartParams,N=Y.immediateRender,R,M=s9.to(H,$8({ease:K.ease||"none",lazy:!1,immediateRender:!1,time:X,overwrite:"auto",duration:K.duration||Math.abs((X-(U&&"time"in U?U.time:H._time))/H.timeScale())||S9,onStart:function E(){if(H.pause(),!R){var F=K.duration||Math.abs((X-(U&&"time"in U?U.time:H._time))/H.timeScale());M._dur!==F&&v$(M,F,0,1).render(M._time,!0,!0),R=1}G&&G.apply(M,q||[])}},K));return N?M.render(0):M},$.tweenFromTo=function Z(W,K,H){return this.tweenTo(K,$8({startAt:{time:I8(this,W)}},H))},$.recent=function Z(){return this._recent},$.nextLabel=function Z(W){if(W===void 0)W=this._time;return Dq(this,I8(this,W))},$.previousLabel=function Z(W){if(W===void 0)W=this._time;return Dq(this,I8(this,W),1)},$.currentLabel=function Z(W){return arguments.length?this.seek(W,!0):this.previousLabel(this._time+S9)},$.shiftChildren=function Z(W,K,H){if(H===void 0)H=0;var X=this._first,Y=this.labels,U;while(X){if(X._start>=H)X._start+=W,X._end+=W;X=X._next}if(K){for(U in Y)if(Y[U]>=H)Y[U]+=W}return wQ(this)},$.invalidate=function Z(W){var K=this._first;this._lock=0;while(K)K.invalidate(W),K=K._next;return J.prototype.invalidate.call(this,W)},$.clear=function Z(W){if(W===void 0)W=!0;var K=this._first,H;while(K)H=K._next,this.remove(K),K=H;return this._dp&&(this._time=this._tTime=this._pTime=0),W&&(this.labels={}),wQ(this)},$.totalDuration=function Z(W){var K=0,H=this,X=H._last,Y=P8,U,G,q;if(arguments.length)return H.timeScale((H._repeat<0?H.duration():H.totalDuration())/(H.reversed()?-W:W));if(H._dirty){q=H.parent;while(X){if(U=X._prev,X._dirty&&X.totalDuration(),G=X._start,G>Y&&H._sort&&X._ts&&!H._lock)H._lock=1,J7(H,X,G-X._delay,1)._lock=0;else Y=G;if(G<0&&X._ts){if(K-=G,!q&&!H._dp||q&&q.smoothChildTiming)H._start+=G/H._ts,H._time-=G,H._tTime-=G;H.shiftChildren(-G,!1,-1/0),Y=0}X._end>K&&X._ts&&(K=X._end),X=U}v$(H,H===v9&&H._time>K?H._time:K,1,1),H._dirty=0}return H._tDur},Q.updateRoot=function Z(W){if(v9._ts)jq(v9,tW(W,v9)),Tq=eJ.frame;if(eJ.frame>=Oq){Oq+=Q8.autoSleep||120;var K=v9._first;if(!K||!K._ts){if(Q8.autoSleep&&eJ._listeners.length<2){while(K&&!K._ts)K=K._next;K||eJ.sleep()}}}},Q}(oZ);$8(LJ.prototype,{_lock:0,_hasPause:0,_forcing:0});var hD=function J(Q,$,Z,W,K,H,X){var Y=new gJ(this._pt,Q,$,0,1,SY,null,K),U=0,G=0,q,N,R,M,E,F,O,k;if(Y.b=Z,Y.e=W,Z+="",W+="",O=~W.indexOf("random("))W=p$(W);if(H)k=[Z,W],H(k,Q,$),Z=k[0],W=k[1];N=Z.match(iX)||[];while(q=iX.exec(W)){if(M=q[0],E=W.substring(U,q.index),R)R=(R+1)%5;else if(E.substr(-5)==="rgba(")R=1;if(M!==N[G++])F=parseFloat(N[G-1])||0,Y._pt={_next:Y._pt,p:E||G===1?E:",",s:F,c:M.charAt(1)==="="?_Q(F,M)-F:parseFloat(M)-F,m:R&&R<4?Math.round:0},U=iX.lastIndex}if(Y.c=U")}),B.duration();else{C={};for(T in M)T==="ease"||T==="easeEach"||pD(T,M[T],C,M.easeEach);for(T in C){p=C[T].sort(function(m,h){return m.t-h.t}),b=0;for(A=0;AY-S9&&!G?Y:WU)N=U;if(O=this._yoyo&&M&1,O)B=this._yEase,N=U-N;if(F=f$(this._tTime,E),N===X&&!H&&this._initted&&M===F)return this._tTime=q,this;if(M!==F){if(D&&this._yEase&&aq(D,O),this.vars.repeatRefresh&&!O&&!this._lock&&N!==E&&this._initted)this._lock=H=1,this.render(a9(E*M),!0).invalidate()._lock=0}}if(!this._initted){if(fq(this,G?W:N,H,K,q))return this._tTime=0,this;if(X!==this._time&&!(H&&this.vars.repeatRefresh&&M!==F))return this;if(U!==this._dur)return this.render(W,K,H)}if(this._tTime=q,this._time=N,!this._act&&this._ts)this._act=1,this._lazy=0;if(this.ratio=k=(B||this._ease)(N/U),this._from)this.ratio=k=1-k;if(!X&&q&&!K&&!F){if(F8(this,"onStart"),this._tTime!==q)return this}R=this._pt;while(R)R.r(k,R.d),R=R._next;if(D&&D.render(W<0?W:D._dur*D._ease(N/this._dur),K,H)||this._startAt&&(this._zTime=W),this._onUpdate&&!K)G&&HY(this,W,K,H),F8(this,"onUpdate");if(this._repeat&&M!==F&&this.vars.onRepeat&&!K&&this.parent&&F8(this,"onRepeat"),(q===this._tDur||!q)&&this._tTime===q){if(G&&!this._onUpdate&&HY(this,W,!0,!0),(W||!U)&&(q===this._tDur&&this._ts>0||!q&&this._ts<0)&&JQ(this,1),!K&&!(G&&!X)&&(q||X||O))F8(this,q===Y?"onComplete":"onReverseComplete",!0),this._prom&&!(q0)&&this._prom()}}return this},$.targets=function Z(){return this._targets},$.invalidate=function Z(W){return(!W||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(W),J.prototype.invalidate.call(this,W)},$.resetTo=function Z(W,K,H,X,Y){nZ||eJ.wake(),this._ts||this.play();var U=Math.min(this._dur,(this._dp._time-this._start)*this._ts),G;if(this._initted||AY(this,U),G=this._ease(U/this._dur),vD(this,W,K,H,X,G,U,Y))return this.resetTo(W,K,H,X,1);return ZK(this,0),this.parent||bq(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0)},$.kill=function Z(W,K){if(K===void 0)K="all";if(!W&&(!K||K==="all"))return this._lazy=this._pt=0,this.parent?pZ(this):this.scrollTrigger&&this.scrollTrigger.kill(!!BJ),this;if(this.timeline){var H=this.timeline.totalDuration();return this.timeline.killTweensOf(W,K,r7&&r7.vars.overwrite!==!0)._first||pZ(this),this.parent&&H!==this.timeline.totalDuration()&&v$(this,this._dur*this.timeline._tDur/H,0,1),this}var X=this._targets,Y=W?A8(W):X,U=this._ptLookup,G=this._pt,q,N,R,M,E,F,O;if((!K||K==="all")&&ED(X,Y))return K==="all"&&(this._pt=0),pZ(this);if(q=this._op=this._op||[],K!=="all"){if(YJ(K))E={},vJ(K,function(k){return E[k]=1}),K=E;K=gD(X,K)}O=X.length;while(O--)if(~Y.indexOf(X[O])){if(N=U[O],K==="all")q[O]=K,M=N,R={};else R=q[O]=q[O]||{},M=K;for(E in M){if(F=N&&N[E],F){if(!("kill"in F.d)||F.d.kill(E)===!0)iZ(this,F,"_pt");delete N[E]}if(R!=="all")R[E]=1}}return this._initted&&!this._pt&&G&&pZ(this),this},Q.to=function Z(W,K){return new Q(W,K,arguments[2])},Q.from=function Z(W,K){return uZ(1,arguments)},Q.delayedCall=function Z(W,K,H,X){return new Q(K,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:W,onComplete:K,onReverseComplete:K,onCompleteParams:H,onReverseCompleteParams:H,callbackScope:X})},Q.fromTo=function Z(W,K,H){return uZ(2,arguments)},Q.set=function Z(W,K){return K.duration=0,K.repeatDelay||(K.repeat=0),new Q(W,K)},Q.killTweensOf=function Z(W,K,H){return v9.killTweensOf(W,K,H)},Q}(oZ);$8(s9.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0});vJ("staggerTo,staggerFrom,staggerFromTo",function(J){s9[J]=function(){var Q=new LJ,$=YY.call(arguments,0);return $.splice(J==="staggerFromTo"?5:4,0,0),Q[J].apply(Q,$)}});var wY=function J(Q,$,Z){return Q[$]=Z},J5=function J(Q,$,Z){return Q[$](Z)},mD=function J(Q,$,Z,W){return Q[$](W.fp,Z)},dD=function J(Q,$,Z){return Q.setAttribute($,Z)},WK=function J(Q,$){return d9(Q[$])?J5:JK(Q[$])&&Q.setAttribute?dD:wY},Q5=function J(Q,$){return $.set($.t,$.p,Math.round(($.s+$.c*Q)*1e6)/1e6,$)},uD=function J(Q,$){return $.set($.t,$.p,!!($.s+$.c*Q),$)},SY=function J(Q,$){var Z=$._pt,W="";if(!Q&&$.b)W=$.b;else if(Q===1&&$.e)W=$.e;else{while(Z)W=Z.p+(Z.m?Z.m(Z.s+Z.c*Q):Math.round((Z.s+Z.c*Q)*1e4)/1e4)+W,Z=Z._next;W+=$.c}$.set($.t,$.p,W,$)},TY=function J(Q,$){var Z=$._pt;while(Z)Z.r(Q,Z.d),Z=Z._next},lD=function J(Q,$,Z,W){var K=this._pt,H;while(K)H=K._next,K.p===W&&K.modifier(Q,$,Z),K=H},cD=function J(Q){var $=this._pt,Z,W;while($){if(W=$._next,$.p===Q&&!$.op||$.op===Q)iZ(this,$,"_pt");else if(!$.dep)Z=1;$=W}return!Z},sD=function J(Q,$,Z,W){W.mSet(Q,$,W.m.call(W.tween,Z,W.mt),W)},jY=function J(Q){var $=Q._pt,Z,W,K,H;while($){Z=$._next,W=K;while(W&&W.pr>$.pr)W=W._next;if($._prev=W?W._prev:H)$._prev._next=$;else K=$;if($._next=W)W._prev=$;else H=$;$=Z}Q._pt=K},gJ=function(){function J($,Z,W,K,H,X,Y,U,G){if(this.t=Z,this.s=K,this.c=H,this.p=W,this.r=X||Q5,this.d=Y||this,this.set=U||wY,this.pr=G||0,this._next=$,$)$._prev=this}var Q=J.prototype;return Q.modifier=function $(Z,W,K){this.mSet=this.mSet||this.set,this.set=sD,this.m=Z,this.mt=K,this.tween=W},J}();vJ(BY+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",function(J){return LY[J]=1});E8.TweenMax=E8.TweenLite=s9;E8.TimelineLite=E8.TimelineMax=LJ;v9=new LJ({sortChildren:!1,defaults:y$,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0});Q8.stringFilter=kY;var TQ=[],oW={},nD=[],Vq=0,oD=0,JY=function J(Q){return(oW[Q]||nD).map(function($){return $()})},NY=function J(){var Q=Date.now(),$=[];if(Q-Vq>2)JY("matchMediaInit"),TQ.forEach(function(Z){var{queries:W,conditions:K}=Z,H,X,Y,U;for(X in W)if(H=e8.matchMedia(W[X]).matches,H&&(Y=1),H!==K[X])K[X]=H,U=1;if(U)Z.revert(),Y&&$.push(Z)}),JY("matchMediaRevert"),$.forEach(function(Z){return Z.onMatch(Z,function(W){return Z.add(null,W)})}),Vq=Q,JY("matchMedia")},$5=function(){function J($,Z){this.selector=Z&&UY(Z),this.data=[],this._r=[],this.isReverted=!1,this.id=oD++,$&&this.add($)}var Q=J.prototype;return Q.add=function $(Z,W,K){if(d9(Z))K=W,W=Z,Z=d9;var H=this,X=function Y(){var U=f9,G=H.selector,q;return U&&U!==H&&U.data.push(H),K&&(H.selector=UY(K)),f9=H,q=W.apply(H,arguments),d9(q)&&H._r.push(q),f9=U,H.selector=G,H.isReverted=!1,q};return H.last=X,Z===d9?X(H,function(Y){return H.add(null,Y)}):Z?H[Z]=X:X},Q.ignore=function $(Z){var W=f9;f9=null,Z(this),f9=W},Q.getTweens=function $(){var Z=[];return this.data.forEach(function(W){return W instanceof J?Z.push.apply(Z,W.getTweens()):W instanceof s9&&!(W.parent&&W.parent.data==="nested")&&Z.push(W)}),Z},Q.clear=function $(){this._r.length=this.data.length=0},Q.kill=function $(Z,W){var K=this;if(Z)(function(){var X=K.getTweens(),Y=K.data.length,U;while(Y--)if(U=K.data[Y],U.data==="isFlip")U.revert(),U.getChildren(!0,!0,!1).forEach(function(G){return X.splice(X.indexOf(G),1)});X.map(function(G){return{g:G._dur||G._delay||G._sat&&!G._sat.vars.immediateRender?G.globalTime(0):-1/0,t:G}}).sort(function(G,q){return q.g-G.g||-1/0}).forEach(function(G){return G.t.revert(Z)}),Y=K.data.length;while(Y--)if(U=K.data[Y],U instanceof LJ){if(U.data!=="nested")U.scrollTrigger&&U.scrollTrigger.revert(),U.kill()}else!(U instanceof s9)&&U.revert&&U.revert(Z);K._r.forEach(function(G){return G(Z,K)}),K.isReverted=!0})();else this.data.forEach(function(X){return X.kill&&X.kill()});if(this.clear(),W){var H=TQ.length;while(H--)TQ[H].id===this.id&&TQ.splice(H,1)}},Q.revert=function $(Z){this.kill(Z||{})},J}(),iD=function(){function J($){this.contexts=[],this.scope=$,f9&&f9.data.push(this)}var Q=J.prototype;return Q.add=function $(Z,W,K){Q7(Z)||(Z={matches:Z});var H=new $5(0,K||this.scope),X=H.conditions={},Y,U,G;f9&&!H.selector&&(H.selector=f9.selector),this.contexts.push(H),W=H.add("onMatch",W),H.queries=Z;for(U in Z)if(U==="all")G=1;else if(Y=e8.matchMedia(Z[U]),Y)TQ.indexOf(H)<0&&TQ.push(H),(X[U]=Y.matches)&&(G=1),Y.addListener?Y.addListener(NY):Y.addEventListener("change",NY);return G&&W(H,function(q){return H.add(null,q)}),this},Q.revert=function $(Z){this.kill(Z||{})},Q.kill=function $(Z){this.contexts.forEach(function(W){return W.kill(Z,!0)})},J}(),eW={registerPlugin:function J(){for(var Q=arguments.length,$=new Array(Q),Z=0;Z1){var W=Q.map(function(G){return wJ.quickSetter(G,$,Z)}),K=W.length;return function(G){var q=K;while(q--)W[q](G)}}Q=Q[0]||{};var H=tJ[$],X=e7(Q),Y=X.harness&&(X.harness.aliases||{})[$]||$,U=H?function(G){var q=new H;b$._pt=0,q.init(Q,Z?G+Z:G,b$,0,[Q]),q.render(1,q),b$._pt&&TY(1,b$)}:X.set(Q,Y);return H?U:function(G){return U(Q,Y,Z?G+Z:G,X,1)}},quickTo:function J(Q,$,Z){var W,K=wJ.to(Q,$8((W={},W[$]="+=0.1",W.paused=!0,W.stagger=0,W),Z||{})),H=function X(Y,U,G){return K.resetTo($,Y,U,G)};return H.tween=K,H},isTweening:function J(Q){return v9.getTweensOf(Q,!0).length>0},defaults:function J(Q){return Q&&Q.ease&&(Q.ease=SQ(Q.ease,y$.ease)),Mq(y$,Q||{})},config:function J(Q){return Mq(Q8,Q||{})},registerEffect:function J(Q){var{name:$,effect:Z,plugins:W,defaults:K,extendTimeline:H}=Q;if((W||"").split(",").forEach(function(X){return X&&!tJ[X]&&!E8[X]&&cZ($+" effect requires "+X+" plugin.")}),aX[$]=function(X,Y,U){return Z(A8(X),$8(Y||{},K),U)},H)LJ.prototype[$]=function(X,Y,U){return this.add(aX[$](X,Q7(Y)?Y:(U=Y)&&{},this),U)}},registerEase:function J(Q,$){q9[Q]=SQ($)},parseEase:function J(Q,$){return arguments.length?SQ(Q,$):q9},getById:function J(Q){return v9.getById(Q)},exportRoot:function J(Q,$){if(Q===void 0)Q={};var Z=new LJ(Q),W,K;Z.smoothChildTiming=J8(Q.smoothChildTiming),v9.remove(Z),Z._dp=0,Z._time=Z._tTime=v9._time,W=v9._first;while(W){if(K=W._next,$||!(!W._dur&&W instanceof s9&&W.vars.onComplete===W._targets[0]))J7(Z,W,W._start-W._delay);W=K}return J7(v9,Z,0),Z},context:function J(Q,$){return Q?new $5(Q,$):f9},matchMedia:function J(Q){return new iD(Q)},matchMediaRefresh:function J(){return TQ.forEach(function(Q){var $=Q.conditions,Z,W;for(W in $)if($[W])$[W]=!1,Z=1;Z&&Q.revert()})||NY()},addEventListener:function J(Q,$){var Z=oW[Q]||(oW[Q]=[]);~Z.indexOf($)||Z.push($)},removeEventListener:function J(Q,$){var Z=oW[Q],W=Z&&Z.indexOf($);W>=0&&Z.splice(W,1)},utils:{wrap:AD,wrapYoyo:wD,distribute:pq,random:dq,snap:mq,normalize:PD,getUnit:DJ,clamp:VD,splitColor:nq,toArray:A8,selector:UY,mapRange:lq,pipe:CD,unitize:ID,interpolate:SD,shuffle:gq},install:wq,effects:aX,ticker:eJ,updateRoot:LJ.updateRoot,plugins:tJ,globalTimeline:v9,core:{PropTween:gJ,globals:Sq,Tween:s9,Timeline:LJ,Animation:oZ,getCache:e7,_removeLinkedListItem:iZ,reverting:function J(){return BJ},context:function J(Q){if(Q&&f9)f9.data.push(Q),Q._ctx=f9;return f9},suppressOverwrites:function J(Q){return RY=Q}}};vJ("to,from,fromTo,delayedCall,set,killTweensOf",function(J){return eW[J]=s9[J]});eJ.add(LJ.updateRoot);b$=eW.to({},{duration:0});var aD=function J(Q,$){var Z=Q._pt;while(Z&&Z.p!==$&&Z.op!==$&&Z.fp!==$)Z=Z._next;return Z},rD=function J(Q,$){var Z=Q._targets,W,K,H;for(W in $){K=Z.length;while(K--)if(H=Q._ptLookup[K][W],H&&(H=H.d)){if(H._pt)H=aD(H,W);H&&H.modifier&&H.modifier($[W],Q,Z[K],W)}}},QY=function J(Q,$){return{name:Q,headless:1,rawVars:1,init:function Z(W,K,H){H._onInit=function(X){var Y,U;if(YJ(K))Y={},vJ(K,function(G){return Y[G]=1}),K=Y;if($){Y={};for(U in K)Y[U]=$(K[U]);K=Y}rD(X,K)}}}},wJ=eW.registerPlugin({name:"attr",init:function J(Q,$,Z,W,K){var H,X,Y;this.tween=Z;for(H in $)Y=Q.getAttribute(H)||"",X=this.add(Q,"setAttribute",(Y||0)+"",$[H],W,K,0,0,H),X.op=H,X.b=Y,this._props.push(H)},render:function J(Q,$){var Z=$._pt;while(Z)BJ?Z.set(Z.t,Z.p,Z.b,Z):Z.r(Q,Z.d),Z=Z._next}},{name:"endArray",headless:1,init:function J(Q,$){var Z=$.length;while(Z--)this.add(Q,Z,Q[Z]||0,$[Z],0,0,0,0,0,1)}},QY("roundProps",GY),QY("modifiers"),QY("snap",mq))||eW;s9.version=LJ.version=wJ.version="3.13.0";Aq=1;FY()&&g$();var{Power0:tD,Power1:eD,Power2:Jz,Power3:Qz,Power4:$z,Linear:Zz,Quad:Wz,Cubic:Kz,Quart:Hz,Quint:Xz,Strong:Yz,Elastic:Uz,Back:Gz,SteppedEase:qz,Bounce:Nz,Sine:Rz,Expo:Fz,Circ:Ez}=q9;/*! * CSSPlugin 3.13.0 * https://gsap.com * * Copyright 2008-2025, GreenSock. All rights reserved. * Subject to the terms at https://gsap.com/standard-license * @author: Jack Doyle, jack@greensock.com */var Z5,$Q,d$,fY,fQ,Oz,W5,vY,Mz=function J(){return typeof window!=="undefined"},A7={},hQ=180/Math.PI,u$=Math.PI/180,m$=Math.atan2,K5=1e8,gY=/([A-Z])/g,Lz=/(left|right|width|margin|padding|x)/i,Bz=/[\s,\(]\S/,$7={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},xY=function J(Q,$){return $.set($.t,$.p,Math.round(($.s+$.c*Q)*1e4)/1e4+$.u,$)},Dz=function J(Q,$){return $.set($.t,$.p,Q===1?$.e:Math.round(($.s+$.c*Q)*1e4)/1e4+$.u,$)},zz=function J(Q,$){return $.set($.t,$.p,Q?Math.round(($.s+$.c*Q)*1e4)/1e4+$.u:$.b,$)},Vz=function J(Q,$){var Z=$.s+$.c*Q;$.set($.t,$.p,~~(Z+(Z<0?-0.5:0.5))+$.u,$)},R5=function J(Q,$){return $.set($.t,$.p,Q?$.e:$.b,$)},F5=function J(Q,$){return $.set($.t,$.p,Q!==1?$.b:$.e,$)},kz=function J(Q,$,Z){return Q.style[$]=Z},Cz=function J(Q,$,Z){return Q.style.setProperty($,Z)},Iz=function J(Q,$,Z){return Q._gsap[$]=Z},Pz=function J(Q,$,Z){return Q._gsap.scaleX=Q._gsap.scaleY=Z},Az=function J(Q,$,Z,W,K){var H=Q._gsap;H.scaleX=H.scaleY=Z,H.renderTransform(K,H)},wz=function J(Q,$,Z,W,K){var H=Q._gsap;H[$]=Z,H.renderTransform(K,H)},g9="transform",Z8=g9+"Origin",Sz=function J(Q,$){var Z=this,W=this.target,K=W.style,H=W._gsap;if(Q in A7&&K){if(this.tfm=this.tfm||{},Q!=="transform")Q=$7[Q]||Q,~Q.indexOf(",")?Q.split(",").forEach(function(X){return Z.tfm[X]=P7(W,X)}):this.tfm[Q]=H.x?H[Q]:P7(W,Q),Q===Z8&&(this.tfm.zOrigin=H.zOrigin);else return $7.transform.split(",").forEach(function(X){return J.call(Z,X,$)});if(this.props.indexOf(g9)>=0)return;if(H.svg)this.svgo=W.getAttribute("data-svg-origin"),this.props.push(Z8,$,"");Q=g9}(K||$)&&this.props.push(Q,$,K[Q])},E5=function J(Q){if(Q.translate)Q.removeProperty("translate"),Q.removeProperty("scale"),Q.removeProperty("rotate")},Tz=function J(){var Q=this.props,$=this.target,Z=$.style,W=$._gsap,K,H;for(K=0;K=0?H5[H]:"")+Q},yY=function J(){if(Mz()&&window.document)Z5=window,$Q=Z5.document,d$=$Q.documentElement,fQ=bY("div")||{style:{}},Oz=bY("div"),g9=l$(g9),Z8=g9+"Origin",fQ.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",M5=!!l$("perspective"),vY=wJ.core.reverting,fY=1},X5=function J(Q){var $=Q.ownerSVGElement,Z=bY("svg",$&&$.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),W=Q.cloneNode(!0),K;W.style.display="block",Z.appendChild(W),d$.appendChild(Z);try{K=W.getBBox()}catch(H){}return Z.removeChild(W),d$.removeChild(Z),K},Y5=function J(Q,$){var Z=$.length;while(Z--)if(Q.hasAttribute($[Z]))return Q.getAttribute($[Z])},L5=function J(Q){var $,Z;try{$=Q.getBBox()}catch(W){$=X5(Q),Z=1}return $&&($.width||$.height)||Z||($=X5(Q)),$&&!$.width&&!$.x&&!$.y?{x:+Y5(Q,["x","cx","x1"])||0,y:+Y5(Q,["y","cy","y1"])||0,width:0,height:0}:$},B5=function J(Q){return!!(Q.getCTM&&(!Q.parentNode||Q.ownerSVGElement)&&L5(Q))},vQ=function J(Q,$){if($){var Z=Q.style,W;if($ in A7&&$!==Z8)$=g9;if(Z.removeProperty){if(W=$.substr(0,2),W==="ms"||$.substr(0,6)==="webkit")$="-"+$;Z.removeProperty(W==="--"?$:$.replace(gY,"-$1").toLowerCase())}else Z.removeAttribute($)}},ZQ=function J(Q,$,Z,W,K,H){var X=new gJ(Q._pt,$,Z,0,1,H?F5:R5);return Q._pt=X,X.b=W,X.e=K,Q._props.push(Z),X},U5={deg:1,rad:1,turn:1},jz={grid:1,flex:1},WQ=function J(Q,$,Z,W){var K=parseFloat(Z)||0,H=(Z+"").trim().substr((K+"").length)||"px",X=fQ.style,Y=Lz.test($),U=Q.tagName.toLowerCase()==="svg",G=(U?"client":"offset")+(Y?"Width":"Height"),q=100,N=W==="px",R=W==="%",M,E,F,O;if(W===H||!K||U5[W]||U5[H])return K;if(H!=="px"&&!N&&(K=J(Q,$,Z,"px")),O=Q.getCTM&&B5(Q),(R||H==="%")&&(A7[$]||~$.indexOf("adius")))return M=O?Q.getBBox()[Y?"width":"height"]:Q[G],u9(R?K/M*q:K/100*M);if(X[Y?"width":"height"]=q+(N?H:W),E=W!=="rem"&&~$.indexOf("adius")||W==="em"&&Q.appendChild&&!U?Q:Q.parentNode,O)E=(Q.ownerSVGElement||{}).parentNode;if(!E||E===$Q||!E.appendChild)E=$Q.body;if(F=E._gsap,F&&R&&F.width&&Y&&F.time===eJ.time&&!F.uncache)return u9(K/F.width*q);else{if(R&&($==="height"||$==="width")){var k=Q.style[$];Q.style[$]=q+W,M=Q[G],k?Q.style[$]=k:vQ(Q,$)}else(R||H==="%")&&!jz[w8(E,"display")]&&(X.position=w8(Q,"position")),E===Q&&(X.position="static"),E.appendChild(fQ),M=fQ[G],E.removeChild(fQ),X.position="absolute";if(Y&&R)F=e7(E),F.time=eJ.time,F.width=E[G]}return u9(N?M*K/q:M&&K?q/M*K:0)},P7=function J(Q,$,Z,W){var K;if(fY||yY(),$ in $7&&$!=="transform"){if($=$7[$],~$.indexOf(","))$=$.split(",")[0]}if(A7[$]&&$!=="transform")K=eZ(Q,W),K=$!=="transformOrigin"?K[$]:K.svg?K.origin:HK(w8(Q,Z8))+" "+K.zOrigin+"px";else if(K=Q.style[$],!K||K==="auto"||W||~(K+"").indexOf("calc("))K=KK[$]&&KK[$](Q,$,Z)||w8(Q,$)||zY(Q,$)||($==="opacity"?1:0);return Z&&!~(K+"").trim().indexOf(" ")?WQ(Q,$,K,Z)+Z:K},_z=function J(Q,$,Z,W){if(!Z||Z==="none"){var K=l$($,Q,1),H=K&&w8(Q,K,1);if(H&&H!==Z)$=K,Z=H;else if($==="borderColor")Z=w8(Q,"borderTopColor")}var X=new gJ(this._pt,Q.style,$,0,1,SY),Y=0,U=0,G,q,N,R,M,E,F,O,k,D,B,A;if(X.b=Z,X.e=W,Z+="",W+="",W.substring(0,6)==="var(--")W=w8(Q,W.substring(4,W.indexOf(")")));if(W==="auto")E=Q.style[$],Q.style[$]=W,W=w8(Q,$)||W,E?Q.style[$]=E:vQ(Q,$);if(G=[Z,W],kY(G),Z=G[0],W=G[1],N=Z.match(jQ)||[],A=W.match(jQ)||[],A.length){while(q=jQ.exec(W)){if(F=q[0],k=W.substring(Y,q.index),M)M=(M+1)%5;else if(k.substr(-5)==="rgba("||k.substr(-5)==="hsla(")M=1;if(F!==(E=N[U++]||"")){if(R=parseFloat(E)||0,B=E.substr((R+"").length),F.charAt(1)==="="&&(F=_Q(R,F)+B),O=parseFloat(F),D=F.substr((O+"").length),Y=jQ.lastIndex-D.length,!D){if(D=D||Q8.units[$]||B,Y===W.length)W+=D,X.e+=D}if(B!==D)R=WQ(Q,$,E,D)||0;X._pt={_next:X._pt,p:k||U===1?k:",",s:R,c:O-R,m:M&&M<4||$==="zIndex"?Math.round:0}}}X.c=Y-1){if(X=K[U],A7[X])Y=1,X=X==="transformOrigin"?Z8:g9;vQ(Z,X)}}if(Y){if(vQ(Z,g9),H)H.svg&&Z.removeAttribute("transform"),W.scale=W.rotate=W.translate="none",eZ(Z,1),H.uncache=1,E5(W)}}},KK={clearProps:function J(Q,$,Z,W,K){if(K.data!=="isFromStart"){var H=Q._pt=new gJ(Q._pt,$,Z,0,0,bz);return H.u=W,H.pr=-10,H.tween=K,Q._props.push(Z),1}}},tZ=[1,0,0,1,0,0],D5={},z5=function J(Q){return Q==="matrix(1, 0, 0, 1, 0, 0)"||Q==="none"||!Q},q5=function J(Q){var $=w8(Q,g9);return z5($)?tZ:$.substr(7).match(EY).map(u9)},pY=function J(Q,$){var Z=Q._gsap||e7(Q),W=Q.style,K=q5(Q),H,X,Y,U;if(Z.svg&&Q.getAttribute("transform"))return Y=Q.transform.baseVal.consolidate().matrix,K=[Y.a,Y.b,Y.c,Y.d,Y.e,Y.f],K.join(",")==="1,0,0,1,0,0"?tZ:K;else if(K===tZ&&!Q.offsetParent&&Q!==d$&&!Z.svg){if(Y=W.display,W.display="block",H=Q.parentNode,!H||!Q.offsetParent&&!Q.getBoundingClientRect().width)U=1,X=Q.nextElementSibling,d$.appendChild(Q);if(K=q5(Q),Y?W.display=Y:vQ(Q,"display"),U)X?H.insertBefore(Q,X):H?H.appendChild(Q):d$.removeChild(Q)}return $&&K.length>6?[K[0],K[1],K[4],K[5],K[12],K[13]]:K},hY=function J(Q,$,Z,W,K,H){var X=Q._gsap,Y=K||pY(Q,!0),U=X.xOrigin||0,G=X.yOrigin||0,q=X.xOffset||0,N=X.yOffset||0,R=Y[0],M=Y[1],E=Y[2],F=Y[3],O=Y[4],k=Y[5],D=$.split(" "),B=parseFloat(D[0])||0,A=parseFloat(D[1])||0,C,w,T,z;if(!Z)C=L5(Q),B=C.x+(~D[0].indexOf("%")?B/100*C.width:B),A=C.y+(~(D[1]||D[0]).indexOf("%")?A/100*C.height:A);else if(Y!==tZ&&(w=R*F-M*E))T=B*(F/w)+A*(-E/w)+(E*k-F*O)/w,z=B*(-M/w)+A*(R/w)-(R*k-M*O)/w,B=T,A=z;if(W||W!==!1&&X.smooth)O=B-U,k=A-G,X.xOffset=q+(O*R+k*E)-O,X.yOffset=N+(O*M+k*F)-k;else X.xOffset=X.yOffset=0;if(X.xOrigin=B,X.yOrigin=A,X.smooth=!!W,X.origin=$,X.originIsAbsolute=!!Z,Q.style[Z8]="0px 0px",H)ZQ(H,X,"xOrigin",U,B),ZQ(H,X,"yOrigin",G,A),ZQ(H,X,"xOffset",q,X.xOffset),ZQ(H,X,"yOffset",N,X.yOffset);Q.setAttribute("data-svg-origin",B+" "+A)},eZ=function J(Q,$){var Z=Q._gsap||new CY(Q);if("x"in Z&&!$&&!Z.uncache)return Z;var W=Q.style,K=Z.scaleX<0,H="px",X="deg",Y=getComputedStyle(Q),U=w8(Q,Z8)||"0",G,q,N,R,M,E,F,O,k,D,B,A,C,w,T,z,V,_,b,p,v,s,m,h,c,t,j,Q0,L0,i0,b0,i;if(G=q=N=E=F=O=k=D=B=0,R=M=1,Z.svg=!!(Q.getCTM&&B5(Q)),Y.translate){if(Y.translate!=="none"||Y.scale!=="none"||Y.rotate!=="none")W[g9]=(Y.translate!=="none"?"translate3d("+(Y.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(Y.rotate!=="none"?"rotate("+Y.rotate+") ":"")+(Y.scale!=="none"?"scale("+Y.scale.split(" ").join(",")+") ":"")+(Y[g9]!=="none"?Y[g9]:"");W.scale=W.rotate=W.translate="none"}if(w=pY(Q,Z.svg),Z.svg){if(Z.uncache)c=Q.getBBox(),U=Z.xOrigin-c.x+"px "+(Z.yOrigin-c.y)+"px",h="";else h=!$&&Q.getAttribute("data-svg-origin");hY(Q,h||U,!!h||Z.originIsAbsolute,Z.smooth!==!1,w)}if(A=Z.xOrigin||0,C=Z.yOrigin||0,w!==tZ){if(_=w[0],b=w[1],p=w[2],v=w[3],G=s=w[4],q=m=w[5],w.length===6){if(R=Math.sqrt(_*_+b*b),M=Math.sqrt(v*v+p*p),E=_||b?m$(b,_)*hQ:0,k=p||v?m$(p,v)*hQ+E:0,k&&(M*=Math.abs(Math.cos(k*u$))),Z.svg)G-=A-(A*_+C*p),q-=C-(A*b+C*v)}else{if(i=w[6],i0=w[7],j=w[8],Q0=w[9],L0=w[10],b0=w[11],G=w[12],q=w[13],N=w[14],T=m$(i,L0),F=T*hQ,T)z=Math.cos(-T),V=Math.sin(-T),h=s*z+j*V,c=m*z+Q0*V,t=i*z+L0*V,j=s*-V+j*z,Q0=m*-V+Q0*z,L0=i*-V+L0*z,b0=i0*-V+b0*z,s=h,m=c,i=t;if(T=m$(-p,L0),O=T*hQ,T)z=Math.cos(-T),V=Math.sin(-T),h=_*z-j*V,c=b*z-Q0*V,t=p*z-L0*V,b0=v*V+b0*z,_=h,b=c,p=t;if(T=m$(b,_),E=T*hQ,T)z=Math.cos(T),V=Math.sin(T),h=_*z+b*V,c=s*z+m*V,b=b*z-_*V,m=m*z-s*V,_=h,s=c;if(F&&Math.abs(F)+Math.abs(E)>359.9)F=E=0,O=180-O;R=u9(Math.sqrt(_*_+b*b+p*p)),M=u9(Math.sqrt(m*m+i*i)),T=m$(s,m),k=Math.abs(T)>0.0002?T*hQ:0,B=b0?1/(b0<0?-b0:b0):0}if(Z.svg)h=Q.getAttribute("transform"),Z.forceCSS=Q.setAttribute("transform","")||!z5(w8(Q,g9)),h&&Q.setAttribute("transform",h)}if(Math.abs(k)>90&&Math.abs(k)<270)if(K)R*=-1,k+=E<=0?180:-180,E+=E<=0?180:-180;else M*=-1,k+=k<=0?180:-180;if($=$||Z.uncache,Z.x=G-((Z.xPercent=G&&(!$&&Z.xPercent||(Math.round(Q.offsetWidth/2)===Math.round(-G)?-50:0)))?Q.offsetWidth*Z.xPercent/100:0)+H,Z.y=q-((Z.yPercent=q&&(!$&&Z.yPercent||(Math.round(Q.offsetHeight/2)===Math.round(-q)?-50:0)))?Q.offsetHeight*Z.yPercent/100:0)+H,Z.z=N+H,Z.scaleX=u9(R),Z.scaleY=u9(M),Z.rotation=u9(E)+X,Z.rotationX=u9(F)+X,Z.rotationY=u9(O)+X,Z.skewX=k+X,Z.skewY=D+X,Z.transformPerspective=B+H,Z.zOrigin=parseFloat(U.split(" ")[2])||!$&&Z.zOrigin||0)W[Z8]=HK(U);return Z.xOffset=Z.yOffset=0,Z.force3D=Q8.force3D,Z.renderTransform=Z.svg?hz:M5?V5:yz,Z.uncache=0,Z},HK=function J(Q){return(Q=Q.split(" "))[0]+" "+Q[1]},_Y=function J(Q,$,Z){var W=DJ($);return u9(parseFloat($)+parseFloat(WQ(Q,"x",Z+"px",W)))+W},yz=function J(Q,$){$.z="0px",$.rotationY=$.rotationX="0deg",$.force3D=0,V5(Q,$)},bQ="0deg",rZ="0px",yQ=") ",V5=function J(Q,$){var Z=$||this,W=Z.xPercent,K=Z.yPercent,H=Z.x,X=Z.y,Y=Z.z,U=Z.rotation,G=Z.rotationY,q=Z.rotationX,N=Z.skewX,R=Z.skewY,M=Z.scaleX,E=Z.scaleY,F=Z.transformPerspective,O=Z.force3D,k=Z.target,D=Z.zOrigin,B="",A=O==="auto"&&Q&&Q!==1||O===!0;if(D&&(q!==bQ||G!==bQ)){var C=parseFloat(G)*u$,w=Math.sin(C),T=Math.cos(C),z;C=parseFloat(q)*u$,z=Math.cos(C),H=_Y(k,H,w*z*-D),X=_Y(k,X,-Math.sin(C)*-D),Y=_Y(k,Y,T*z*-D+D)}if(F!==rZ)B+="perspective("+F+yQ;if(W||K)B+="translate("+W+"%, "+K+"%) ";if(A||H!==rZ||X!==rZ||Y!==rZ)B+=Y!==rZ||A?"translate3d("+H+", "+X+", "+Y+") ":"translate("+H+", "+X+yQ;if(U!==bQ)B+="rotate("+U+yQ;if(G!==bQ)B+="rotateY("+G+yQ;if(q!==bQ)B+="rotateX("+q+yQ;if(N!==bQ||R!==bQ)B+="skew("+N+", "+R+yQ;if(M!==1||E!==1)B+="scale("+M+", "+E+yQ;k.style[g9]=B||"translate(0, 0)"},hz=function J(Q,$){var Z=$||this,W=Z.xPercent,K=Z.yPercent,H=Z.x,X=Z.y,Y=Z.rotation,U=Z.skewX,G=Z.skewY,q=Z.scaleX,N=Z.scaleY,R=Z.target,M=Z.xOrigin,E=Z.yOrigin,F=Z.xOffset,O=Z.yOffset,k=Z.forceCSS,D=parseFloat(H),B=parseFloat(X),A,C,w,T,z;if(Y=parseFloat(Y),U=parseFloat(U),G=parseFloat(G),G)G=parseFloat(G),U+=G,Y+=G;if(Y||U){if(Y*=u$,U*=u$,A=Math.cos(Y)*q,C=Math.sin(Y)*q,w=Math.sin(Y-U)*-N,T=Math.cos(Y-U)*N,U){if(G*=u$,z=Math.tan(U-G),z=Math.sqrt(1+z*z),w*=z,T*=z,G)z=Math.tan(G),z=Math.sqrt(1+z*z),A*=z,C*=z}A=u9(A),C=u9(C),w=u9(w),T=u9(T)}else A=q,T=N,C=w=0;if(D&&!~(H+"").indexOf("px")||B&&!~(X+"").indexOf("px"))D=WQ(R,"x",H,"px"),B=WQ(R,"y",X,"px");if(M||E||F||O)D=u9(D+M-(M*A+E*w)+F),B=u9(B+E-(M*C+E*T)+O);if(W||K)z=R.getBBox(),D=u9(D+W/100*z.width),B=u9(B+K/100*z.height);z="matrix("+A+","+C+","+w+","+T+","+D+","+B+")",R.setAttribute("transform",z),k&&(R.style[g9]=z)},fz=function J(Q,$,Z,W,K){var H=360,X=YJ(K),Y=parseFloat(K)*(X&&~K.indexOf("rad")?hQ:1),U=Y-W,G=W+U+"deg",q,N;if(X){if(q=K.split("_")[1],q==="short"){if(U%=H,U!==U%(H/2))U+=U<0?H:-H}if(q==="cw"&&U<0)U=(U+H*K5)%H-~~(U/H)*H;else if(q==="ccw"&&U>0)U=(U-H*K5)%H-~~(U/H)*H}return Q._pt=N=new gJ(Q._pt,$,Z,W,U,Dz),N.e=G,N.u="deg",Q._props.push(Z),N},N5=function J(Q,$){for(var Z in $)Q[Z]=$[Z];return Q},vz=function J(Q,$,Z){var W=N5({},Z._gsap),K="perspective,force3D,transformOrigin,svgOrigin",H=Z.style,X,Y,U,G,q,N,R,M;if(W.svg)U=Z.getAttribute("transform"),Z.setAttribute("transform",""),H[g9]=$,X=eZ(Z,1),vQ(Z,g9),Z.setAttribute("transform",U);else U=getComputedStyle(Z)[g9],H[g9]=$,X=eZ(Z,1),H[g9]=U;for(Y in A7)if(U=W[Y],G=X[Y],U!==G&&K.indexOf(Y)<0)R=DJ(U),M=DJ(G),q=R!==M?WQ(Z,Y,U,M):parseFloat(U),N=parseFloat(G),Q._pt=new gJ(Q._pt,X,Y,q,N-q,xY),Q._pt.u=M||0,Q._props.push(Y);N5(X,W)};vJ("padding,margin,Width,Radius",function(J,Q){var $="Top",Z="Right",W="Bottom",K="Left",H=(Q<3?[$,Z,W,K]:[$+K,$+Z,W+Z,W+K]).map(function(X){return Q<2?J+X:"border"+X+J});KK[Q>1?"border"+J:J]=function(X,Y,U,G,q){var N,R;if(arguments.length<4)return N=H.map(function(M){return P7(X,M,U)}),R=N.join(" "),R.split(N[0]).length===5?N[0]:R;N=(G+"").split(" "),R={},H.forEach(function(M,E){return R[M]=N[E]=N[E]||N[(E-1)/2|0]}),X.init(Y,R,q)}});var mY={name:"css",register:yY,targetTest:function J(Q){return Q.style&&Q.nodeType},init:function J(Q,$,Z,W,K){var H=this._props,X=Q.style,Y=Z.vars.startAt,U,G,q,N,R,M,E,F,O,k,D,B,A,C,w,T;fY||yY(),this.styles=this.styles||O5(Q),T=this.styles.props,this.tween=Z;for(E in $){if(E==="autoRound")continue;if(G=$[E],tJ[E]&&PY(E,$,Z,W,Q,K))continue;if(R=typeof G,M=KK[E],R==="function")G=G.call(Z,W,Q,K),R=typeof G;if(R==="string"&&~G.indexOf("random("))G=p$(G);if(M)M(this,Q,E,G,Z)&&(w=1);else if(E.substr(0,2)==="--"){if(U=(getComputedStyle(Q).getPropertyValue(E)+"").trim(),G+="",C7.lastIndex=0,!C7.test(U))F=DJ(U),O=DJ(G);O?F!==O&&(U=WQ(Q,E,U,O)+O):F&&(G+=F),this.add(X,"setProperty",U,G,W,K,0,0,E),H.push(E),T.push(E,0,X[E])}else if(R!=="undefined"){if(Y&&E in Y)U=typeof Y[E]==="function"?Y[E].call(Z,W,Q,K):Y[E],YJ(U)&&~U.indexOf("random(")&&(U=p$(U)),DJ(U+"")||U==="auto"||(U+=Q8.units[E]||DJ(P7(Q,E))||""),(U+"").charAt(1)==="="&&(U=P7(Q,E));else U=P7(Q,E);if(N=parseFloat(U),k=R==="string"&&G.charAt(1)==="="&&G.substr(0,2),k&&(G=G.substr(2)),q=parseFloat(G),E in $7){if(E==="autoAlpha"){if(N===1&&P7(Q,"visibility")==="hidden"&&q)N=0;T.push("visibility",0,X.visibility),ZQ(this,X,"visibility",N?"inherit":"hidden",q?"inherit":"hidden",!q)}if(E!=="scale"&&E!=="transform")E=$7[E],~E.indexOf(",")&&(E=E.split(",")[0])}if(D=E in A7,D){if(this.styles.save(E),R==="string"&&G.substring(0,6)==="var(--")G=w8(Q,G.substring(4,G.indexOf(")"))),q=parseFloat(G);if(!B)A=Q._gsap,A.renderTransform&&!$.parseTransform||eZ(Q,$.parseTransform),C=$.smoothOrigin!==!1&&A.smooth,B=this._pt=new gJ(this._pt,X,g9,0,1,A.renderTransform,A,0,-1),B.dep=1;if(E==="scale")this._pt=new gJ(this._pt,A,"scaleY",A.scaleY,(k?_Q(A.scaleY,k+q):q)-A.scaleY||0,xY),this._pt.u=0,H.push("scaleY",E),E+="X";else if(E==="transformOrigin"){if(T.push(Z8,0,X[Z8]),G=xz(G),A.svg)hY(Q,G,0,C,0,this);else O=parseFloat(G.split(" ")[2])||0,O!==A.zOrigin&&ZQ(this,A,"zOrigin",A.zOrigin,O),ZQ(this,X,E,HK(U),HK(G));continue}else if(E==="svgOrigin"){hY(Q,G,1,C,0,this);continue}else if(E in D5){fz(this,A,E,N,k?_Q(N,k+G):G);continue}else if(E==="smoothOrigin"){ZQ(this,A,"smooth",A.smooth,G);continue}else if(E==="force3D"){A[E]=G;continue}else if(E==="transform"){vz(this,G,Q);continue}}else if(!(E in X))E=l$(E)||E;if(D||(q||q===0)&&(N||N===0)&&!Bz.test(G)&&E in X){if(F=(U+"").substr((N+"").length),q||(q=0),O=DJ(G)||(E in Q8.units?Q8.units[E]:F),F!==O&&(N=WQ(Q,E,U,O)),this._pt=new gJ(this._pt,D?A:X,E,N,(k?_Q(N,k+q):q)-N,!D&&(O==="px"||E==="zIndex")&&$.autoRound!==!1?Vz:xY),this._pt.u=O||0,F!==O&&O!=="%")this._pt.b=U,this._pt.r=zz}else if(!(E in X)){if(E in Q)this.add(Q,E,U||Q[E],k?k+G:G,W,K);else if(E!=="parseTransform"){QK(E,G);continue}}else _z.call(this,Q,E,U,k?k+G:G);D||(E in X?T.push(E,0,X[E]):typeof Q[E]==="function"?T.push(E,2,Q[E]()):T.push(E,1,U||Q[E])),H.push(E)}}w&&jY(this)},render:function J(Q,$){if($.tween._time||!vY()){var Z=$._pt;while(Z)Z.r(Q,Z.d),Z=Z._next}else $.styles.revert()},get:P7,aliases:$7,getSetter:function J(Q,$,Z){var W=$7[$];return W&&W.indexOf(",")<0&&($=W),$ in A7&&$!==Z8&&(Q._gsap.x||P7(Q,"x"))?Z&&W5===Z?$==="scale"?Pz:Iz:(W5=Z||{})&&($==="scale"?Az:wz):Q.style&&!JK(Q.style[$])?kz:~$.indexOf("-")?Cz:WK(Q,$)},core:{_removeProperty:vQ,_getMatrix:pY}};wJ.utils.checkPrefix=l$;wJ.core.getStyleSaver=O5;(function(J,Q,$,Z){var W=vJ(J+","+Q+","+$,function(K){A7[K]=1});vJ(Q,function(K){Q8.units[K]="deg",D5[K]=1}),$7[W[13]]=J+","+Q,vJ(Z,function(K){var H=K.split(":");$7[H[1]]=W[H[0]]})})("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY");vJ("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(J){Q8.units[J]="px"});wJ.registerPlugin(mY);var J6=wJ.registerPlugin(mY)||wJ,O4=J6.core.Tween;function k5(J,Q){for(var $=0;$Y)K=W,W=M,X=H,H=F;else if(Z)W+=M;else W=K+(M-K)/(F-X)*(H-X)},q=function R(){K=W=Z?0:W,X=H=0},N=function R(M){var E=X,F=K,O=Z6();return(M||M===0)&&M!==W&&G(M),H===X||O-X>U?0:(W+(Z?F:-F))/((Z?O:H)-E)*1000};return{update:G,reset:q,getVelocity:N}},Q6=function J(Q,$){return $&&!Q._gsapAllow&&Q.preventDefault(),Q.changedTouches?Q.changedTouches[0]:Q},C5=function J(Q){var $=Math.max.apply(Math,Q),Z=Math.min.apply(Math,Q);return Math.abs($)>=Math.abs(Z)?$:Z},T5=function J(){$6=zJ.core.globals().ScrollTrigger,$6&&$6.core&&mz()},j5=function J(Q){if(zJ=Q||w5(),!UK&&zJ&&typeof document!=="undefined"&&document.body)O8=window,KQ=document,HQ=KQ.documentElement,s$=KQ.body,P5=[O8,KQ,HQ,s$],pz=zJ.utils.clamp,A5=zJ.core.context||function(){},gQ="onpointerenter"in s$?"pointer":"mouse",I5=l9.isTouch=O8.matchMedia&&O8.matchMedia("(hover: none), (pointer: coarse)").matches?1:("ontouchstart"in O8)||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0?2:0,c8=l9.eventTypes=("ontouchstart"in HQ?"touchstart,touchmove,touchcancel,touchend":!("onpointerdown"in HQ)?"mousedown,mousemove,mouseup,mouseup":"pointerdown,pointermove,pointercancel,pointerup").split(","),setTimeout(function(){return S5=0},500),T5(),UK=1;return UK};SJ.op=r9;$9.cache=0;var l9=function(){function J($){this.init($)}var Q=J.prototype;return Q.init=function $(Z){UK||j5(zJ)||console.warn("Please gsap.registerPlugin(Observer)"),$6||T5();var{tolerance:W,dragMinimum:K,type:H,target:X,lineHeight:Y,debounce:U,preventDefault:G,onStop:q,onStopDelay:N,ignore:R,wheelSpeed:M,event:E,onDragStart:F,onDragEnd:O,onDrag:k,onPress:D,onRelease:B,onRight:A,onLeft:C,onUp:w,onDown:T,onChangeX:z,onChangeY:V,onChange:_,onToggleX:b,onToggleY:p,onHover:v,onHoverEnd:s,onMove:m,ignoreCheck:h,isNormalizer:c,onGestureStart:t,onGestureEnd:j,onWheel:Q0,onEnable:L0,onDisable:i0,onClick:b0,scrollSpeed:i,capture:K0,allowClicks:J0,lockAxis:k0,onLockAxis:I0}=Z;this.target=X=dJ(X)||HQ,this.vars=Z,R&&(R=zJ.utils.toArray(R)),W=W||0.000000001,K=K||0,M=M||1,i=i||1,H=H||"wheel,touch,pointer",U=U!==!1,Y||(Y=parseFloat(O8.getComputedStyle(s$).lineHeight)||22);var y0,U9,c0,w0,p0,h0,N9,P=this,O9=0,m0=0,R9=Z.passive||!G&&Z.passive!==!1,U0=S7(X,SJ),G9=S7(X,r9),S=U0(),L=G9(),g=~H.indexOf("touch")&&!~H.indexOf("pointer")&&c8[0]==="pointerdown",a=W6(X),r=X.ownerDocument||KQ,n=[0,0,0],O0=[0,0,0],H0=0,S0=function M0(){return H0=Z6()},B0=function M0(T0,e0){return(P.event=T0)&&R&&dz(T0.target,R)||e0&&g&&T0.pointerType!=="touch"||h&&h(T0,e0)},$0=function M0(){P._vx.reset(),P._vy.reset(),U9.pause(),q&&q(P)},Z0=function M0(){var T0=P.deltaX=C5(n),e0=P.deltaY=C5(O0),F0=Math.abs(T0)>=W,n0=Math.abs(e0)>=W;if(_&&(F0||n0)&&_(P,T0,e0,n,O0),F0)A&&P.deltaX>0&&A(P),C&&P.deltaX<0&&C(P),z&&z(P),b&&P.deltaX<0!==O9<0&&b(P),O9=P.deltaX,n[0]=n[1]=n[2]=0;if(n0)T&&P.deltaY>0&&T(P),w&&P.deltaY<0&&w(P),V&&V(P),p&&P.deltaY<0!==m0<0&&p(P),m0=P.deltaY,O0[0]=O0[1]=O0[2]=0;if(w0||c0){if(m&&m(P),c0)F&&c0===1&&F(P),k&&k(P),c0=0;w0=!1}if(h0&&!(h0=!1)&&I0&&I0(P),p0)Q0(P),p0=!1;y0=0},D0=function M0(T0,e0,F0){n[F0]+=T0,O0[F0]+=e0,P._vx.update(T0),P._vy.update(e0),U?y0||(y0=requestAnimationFrame(Z0)):Z0()},C0=function M0(T0,e0){if(k0&&!N9)P.axis=N9=Math.abs(T0)>Math.abs(e0)?"x":"y",h0=!0;if(N9!=="y")n[2]+=T0,P._vx.update(T0,!0);if(N9!=="x")O0[2]+=e0,P._vy.update(e0,!0);U?y0||(y0=requestAnimationFrame(Z0)):Z0()},q0=function M0(T0){if(B0(T0,1))return;T0=Q6(T0,G);var{clientX:e0,clientY:F0}=T0,n0=e0-P.x,x0=F0-P.y,o0=P.isDragging;if(P.x=e0,P.y=F0,o0||(n0||x0)&&(Math.abs(P.startX-e0)>=K||Math.abs(P.startY-F0)>=K))c0=o0?2:1,o0||(P.isDragging=!0),C0(n0,x0)},s0=P.onPress=function(M0){if(B0(M0,1)||M0&&M0.button)return;P.axis=N9=null,U9.pause(),P.isPressed=!0,M0=Q6(M0),O9=m0=0,P.startX=P.x=M0.clientX,P.startY=P.y=M0.clientY,P._vx.reset(),P._vy.reset(),mJ(c?X:r,c8[1],q0,R9,!0),P.deltaX=P.deltaY=0,D&&D(P)},x=P.onRelease=function(M0){if(B0(M0,1))return;pJ(c?X:r,c8[1],q0,!0);var T0=!isNaN(P.y-P.startY),e0=P.isDragging,F0=e0&&(Math.abs(P.x-P.startX)>3||Math.abs(P.y-P.startY)>3),n0=Q6(M0);if(!F0&&T0){if(P._vx.reset(),P._vy.reset(),G&&J0)zJ.delayedCall(0.08,function(){if(Z6()-H0>300&&!M0.defaultPrevented){if(M0.target.click)M0.target.click();else if(r.createEvent){var x0=r.createEvent("MouseEvents");x0.initMouseEvent("click",!0,!0,O8,1,n0.screenX,n0.screenY,n0.clientX,n0.clientY,!1,!1,!1,!1,0,null),M0.target.dispatchEvent(x0)}}})}P.isDragging=P.isGesturing=P.isPressed=!1,q&&e0&&!c&&U9.restart(!0),c0&&Z0(),O&&e0&&O(P),B&&B(P,F0)},X0=function M0(T0){return T0.touches&&T0.touches.length>1&&(P.isGesturing=!0)&&t(T0,P.isDragging)},W0=function M0(){return(P.isGesturing=!1)||j(P)},N0=function M0(T0){if(B0(T0))return;var e0=U0(),F0=G9();D0((e0-S)*i,(F0-L)*i,1),S=e0,L=F0,q&&U9.restart(!0)},e=function M0(T0){if(B0(T0))return;T0=Q6(T0,G),Q0&&(p0=!0);var e0=(T0.deltaMode===1?Y:T0.deltaMode===2?O8.innerHeight:1)*M;D0(T0.deltaX*e0,T0.deltaY*e0,0),q&&!c&&U9.restart(!0)},o=function M0(T0){if(B0(T0))return;var{clientX:e0,clientY:F0}=T0,n0=e0-P.x,x0=F0-P.y;P.x=e0,P.y=F0,w0=!0,q&&U9.restart(!0),(n0||x0)&&C0(n0,x0)},z0=function M0(T0){P.event=T0,v(P)},_0=function M0(T0){P.event=T0,s(P)},F9=function M0(T0){return B0(T0)||Q6(T0,G)&&b0(P)};U9=P._dc=zJ.delayedCall(N||0.25,$0).pause(),P.deltaX=P.deltaY=0,P._vx=qK(0,50,!0),P._vy=qK(0,50,!0),P.scrollX=U0,P.scrollY=G9,P.isDragging=P.isGesturing=P.isPressed=!1,A5(this),P.enable=function(M0){if(!P.isEnabled){if(mJ(a?r:X,"scroll",uY),H.indexOf("scroll")>=0&&mJ(a?r:X,"scroll",N0,R9,K0),H.indexOf("wheel")>=0&&mJ(X,"wheel",e,R9,K0),H.indexOf("touch")>=0&&I5||H.indexOf("pointer")>=0)mJ(X,c8[0],s0,R9,K0),mJ(r,c8[2],x),mJ(r,c8[3],x),J0&&mJ(X,"click",S0,!0,!0),b0&&mJ(X,"click",F9),t&&mJ(r,"gesturestart",X0),j&&mJ(r,"gestureend",W0),v&&mJ(X,gQ+"enter",z0),s&&mJ(X,gQ+"leave",_0),m&&mJ(X,gQ+"move",o);P.isEnabled=!0,P.isDragging=P.isGesturing=P.isPressed=w0=c0=!1,P._vx.reset(),P._vy.reset(),S=U0(),L=G9(),M0&&M0.type&&s0(M0),L0&&L0(P)}return P},P.disable=function(){if(P.isEnabled){if(c$.filter(function(M0){return M0!==P&&W6(M0.target)}).length||pJ(a?r:X,"scroll",uY),P.isPressed)P._vx.reset(),P._vy.reset(),pJ(c?X:r,c8[1],q0,!0);pJ(a?r:X,"scroll",N0,K0),pJ(X,"wheel",e,K0),pJ(X,c8[0],s0,K0),pJ(r,c8[2],x),pJ(r,c8[3],x),pJ(X,"click",S0,!0),pJ(X,"click",F9),pJ(r,"gesturestart",X0),pJ(r,"gestureend",W0),pJ(X,gQ+"enter",z0),pJ(X,gQ+"leave",_0),pJ(X,gQ+"move",o),P.isEnabled=P.isPressed=P.isDragging=!1,i0&&i0(P)}},P.kill=P.revert=function(){P.disable();var M0=c$.indexOf(P);M0>=0&&c$.splice(M0,1),w7===P&&(w7=0)},c$.push(P),c&&W6(X)&&(w7=P),P.enable(E)},gz(J,[{key:"velocityX",get:function $(){return this._vx.getVelocity()}},{key:"velocityY",get:function $(){return this._vy.getVelocity()}}]),J}();l9.version="3.13.0";l9.create=function(J){return new l9(J)};l9.register=j5;l9.getAll=function(){return c$.slice()};l9.getById=function(J){return c$.filter(function(Q){return Q.vars.id===J})[0]};w5()&&zJ.registerPlugin(l9);/*! * ScrollTrigger 3.13.0 * https://gsap.com * * @license Copyright 2008-2025, GreenSock. All rights reserved. * Subject to the terms at https://gsap.com/standard-license * @author: Jack Doyle, jack@greensock.com */var A0,i$,K9,x9,B8,B9,WU,AK,M6,q6,H6,NK,TJ,jK,rY,lJ,_5,x5,a$,i5,lY,a5,uJ,tY,r5,t5,XQ,eY,KU,r$,HU,wK,JU,cY,RK=1,jJ=Date.now,sY=jJ(),j8=0,X6=0,b5=function J(Q,$,Z){var W=L8(Q)&&(Q.substr(0,6)==="clamp("||Q.indexOf("max")>-1);return Z["_"+$+"Clamp"]=W,W?Q.substr(6,Q.length-7):Q},y5=function J(Q,$){return $&&(!L8(Q)||Q.substr(0,6)!=="clamp(")?"clamp("+Q+")":Q},uz=function J(){return X6&&requestAnimationFrame(J)},h5=function J(){return jK=1},f5=function J(){return jK=0},Z7=function J(Q){return Q},Y6=function J(Q){return Math.round(Q*1e5)/1e5||0},e5=function J(){return typeof window!=="undefined"},JN=function J(){return A0||e5()&&(A0=window.gsap)&&A0.registerPlugin&&A0},cQ=function J(Q){return!!~WU.indexOf(Q)},QN=function J(Q){return(Q==="Height"?HU:K9["inner"+Q])||B8["client"+Q]||B9["client"+Q]},$N=function J(Q){return T7(Q,"getBoundingClientRect")||(cQ(Q)?function(){return PK.width=K9.innerWidth,PK.height=HU,PK}:function(){return j7(Q)})},lz=function J(Q,$,Z){var{d:W,d2:K,a:H}=Z;return(H=T7(Q,"getBoundingClientRect"))?function(){return H()[W]}:function(){return($?QN(K):Q["client"+K])||0}},cz=function J(Q,$){return!$||~s8.indexOf(Q)?$N(Q):function(){return PK}},W7=function J(Q,$){var{s:Z,d2:W,d:K,a:H}=$;return Math.max(0,(Z="scroll"+W)&&(H=T7(Q,Z))?H()-$N(Q)()[K]:cQ(Q)?(B8[Z]||B9[Z])-QN(W):Q[Z]-Q["offset"+W])},FK=function J(Q,$){for(var Z=0;Z0){W-=H;for(X=0;X=W)return Z[X];return Z[X-1]}else{X=Z.length,W+=H;while(X--)if(Z[X]<=W)return Z[X]}return Z[0]}:function(W,K,H){if(H===void 0)H=0.001;var X=$(W);return!K||Math.abs(X-W)Z&&(W*=$/100),Q=Q.substr(0,Z-1);Q=W+(Q in TK?TK[Q]*$:~Q.indexOf("%")?parseFloat(Q)*$/100:parseFloat(Q)||0)}return Q},LK=function J(Q,$,Z,W,K,H,X,Y){var{startColor:U,endColor:G,fontSize:q,indent:N,fontWeight:R}=K,M=x9.createElement("div"),E=cQ(Z)||T7(Z,"pinType")==="fixed",F=Q.indexOf("scroller")!==-1,O=E?B9:Z,k=Q.indexOf("start")!==-1,D=k?U:G,B="border-color:"+D+";font-size:"+q+";color:"+D+";font-weight:"+R+";pointer-events:none;white-space:nowrap;font-family:sans-serif,Arial;z-index:1000;padding:4px 8px;border-width:0;border-style:solid;";return B+="position:"+((F||Y)&&E?"fixed;":"absolute;"),(F||Y||!E)&&(B+=(W===r9?XU:YU)+":"+(H+parseFloat(N))+"px;"),X&&(B+="box-sizing:border-box;text-align:left;width:"+X.offsetWidth+"px;"),M._isStart=k,M.setAttribute("class","gsap-marker-"+Q+($?" marker-"+$:"")),M.style.cssText=B,M.innerText=$||$===0?Q+"-"+$:Q,O.children[0]?O.insertBefore(M,O.children[0]):O.appendChild(M),M._offset=M["offset"+W.op.d2],kK(M,0,W,k),M},kK=function J(Q,$,Z,W){var K={display:"block"},H=Z[W?"os2":"p2"],X=Z[W?"p2":"os2"];Q._isFlipped=W,K[Z.a+"Percent"]=W?-100:0,K[Z.a]=W?"1px":0,K["border"+H+e$]=1,K["border"+X+e$]=0,K[Z.p]=$+"px",A0.set(Q,K)},Z9=[],QU={},L6,p5=function J(){return jJ()-j8>34&&(L6||(L6=requestAnimationFrame(_7)))},o$=function J(){if(!uJ||!uJ.isPressed||uJ.startX>B9.clientWidth){if($9.cache++,uJ)L6||(L6=requestAnimationFrame(_7));else _7();j8||nQ("scrollStart"),j8=jJ()}},oY=function J(){t5=K9.innerWidth,r5=K9.innerHeight},G6=function J(Q){$9.cache++,(Q===!0||!TJ&&!a5&&!x9.fullscreenElement&&!x9.webkitFullscreenElement&&(!tY||t5!==K9.innerWidth||Math.abs(K9.innerHeight-r5)>K9.innerHeight*0.25))&&AK.restart(!0)},sQ={},iz=[],HN=function J(){return NJ(H9,"scrollEnd",J)||mQ(!0)},nQ=function J(Q){return sQ[Q]&&sQ[Q].map(function($){return $()})||iz},M8=[],XN=function J(Q){for(var $=0;$K,X=W._startClamp&&W.start>=K;(H||X)&&W.setPositions(X?K-1:W.start,H?Math.max(X?K:W.start+1,K):W.end,!0)}),d5(!1),JU=0,Z.forEach(function(W){return W&&W.render&&W.render(-1)}),$9.forEach(function(W){if(_J(W))W.smooth&&requestAnimationFrame(function(){return W.target.style.scrollBehavior="smooth"}),W.rec&&W(W.rec)}),YN(KU,1),AK.pause(),lQ++,cJ=2,_7(2),Z9.forEach(function(W){return _J(W.vars.onRefresh)&&W.vars.onRefresh(W)}),cJ=H9.isRefreshing=!1,nQ("refresh")},$U=0,CK=1,O6,_7=function J(Q){if(Q===2||!cJ&&!wK){H9.isUpdating=!0,O6&&O6.update(0);var $=Z9.length,Z=jJ(),W=Z-sY>=50,K=$&&Z9[0].scroll();if(CK=$U>K?-1:1,cJ||($U=K),W){if(j8&&!jK&&Z-j8>200)j8=0,nQ("scrollEnd");H6=sY,sY=Z}if(CK<0){lJ=$;while(lJ-- >0)Z9[lJ]&&Z9[lJ].update(0,W);CK=1}else for(lJ=0;lJ<$;lJ++)Z9[lJ]&&Z9[lJ].update(0,W);H9.isUpdating=!1}L6=0},ZU=[ZN,WN,YU,XU,S8+E6,S8+N6,S8+F6,S8+R6,"display","flexShrink","float","zIndex","gridColumnStart","gridColumnEnd","gridRowStart","gridRowEnd","gridArea","justifySelf","alignSelf","placeSelf","order"],IK=ZU.concat([dQ,uQ,"boxSizing","max"+e$,"max"+UU,"position",S8,t9,t9+F6,t9+N6,t9+E6,t9+R6]),rz=function J(Q,$,Z){t$(Z);var W=Q._gsap;if(W.spacerIsNative)t$(W.spacerState);else if(Q._gsap.swappedIn){var K=$.parentNode;if(K)K.insertBefore(Q,$),K.removeChild($)}Q._gsap.swappedIn=!1},iY=function J(Q,$,Z,W){if(!Q._gsap.swappedIn){var K=ZU.length,H=$.style,X=Q.style,Y;while(K--)Y=ZU[K],H[Y]=Z[Y];if(H.position=Z.position==="absolute"?"absolute":"relative",Z.display==="inline"&&(H.display="inline-block"),X[YU]=X[XU]="auto",H.flexBasis=Z.flexBasis||"auto",H.overflow="visible",H.boxSizing="border-box",H[dQ]=SK(Q,SJ)+UJ,H[uQ]=SK(Q,r9)+UJ,H[t9]=X[S8]=X[WN]=X[ZN]="0",t$(W),X[dQ]=X["max"+e$]=Z[dQ],X[uQ]=X["max"+UU]=Z[uQ],X[t9]=Z[t9],Q.parentNode!==$)Q.parentNode.insertBefore($,Q),$.appendChild(Q);Q._gsap.swappedIn=!0}},tz=/([A-Z])/g,t$=function J(Q){if(Q){var $=Q.t.style,Z=Q.length,W=0,K,H;(Q.t._gsap||A0.core.getCache(Q.t)).uncache=1;for(;W20),Z-=Z-C}else R&&(Q=A0.utils.mapRange(R.scrollTrigger.start,R.scrollTrigger.end,0,N,Q)),X&&kK(X,Z,W,!0);if(M)Y[M]=Q||-0.001,Q<0&&(Q=0);if(H){var T=Q+Z,z=H._isStart;if(F="scroll"+W.d2,kK(H,T,W,z&&T>20||!z&&(q?Math.max(B9[F],B8[F]):H.parentNode[F])<=T+1),q)U=j7(X),q&&(H.style[W.op.p]=U[W.op.p]-W.op.m-H._offset+UJ)}if(R&&k)F=j7(k),R.seek(N),O=j7(k),R._caScrollDist=F[W.p]-O[W.p],Q=Q/R._caScrollDist*N;return R&&R.seek(E),R?Q:Math.round(Q)},JV=/(webkit|moz|length|cssText|inset)/i,l5=function J(Q,$,Z,W){if(Q.parentNode!==$){var K=Q.style,H,X;if($===B9){Q._stOrig=K.cssText,X=T8(Q);for(H in X)if(!+H&&!JV.test(H)&&X[H]&&typeof K[H]==="string"&&H!=="0")K[H]=X[H];K.top=Z,K.left=W}else K.cssText=Q._stOrig;A0.core.getCache(Q).uncache=1,$.appendChild(Q)}},GN=function J(Q,$,Z){var W=$,K=W;return function(H){var X=Math.round(Q());if(X!==W&&X!==K&&Math.abs(X-W)>3&&Math.abs(X-K)>3)H=X,Z&&Z();return K=W,W=Math.round(H),W}},DK=function J(Q,$,Z){var W={};W[$.p]="+="+Z,A0.set(Q,W)},c5=function J(Q,$){var Z=S7(Q,$),W="_scroll"+$.p2,K=function H(X,Y,U,G,q){var N=H.tween,R=Y.onComplete,M={};U=U||Z();var E=GN(Z,U,function(){N.kill(),H.tween=0});return q=G&&q||0,G=G||X-U,N&&N.kill(),Y[W]=X,Y.inherit=!1,Y.modifiers=M,M[W]=function(){return E(U+G*N.ratio+q*N.ratio*N.ratio)},Y.onUpdate=function(){$9.cache++,H.tween&&_7()},Y.onComplete=function(){H.tween=0,R&&R.call(N)},N=H.tween=A0.to(Q,Y),N};return Q[W]=Z,Z.wheelHandler=function(){return K.tween&&K.tween.kill()&&(K.tween=0)},RJ(Q,"wheel",Z.wheelHandler),H9.isTouch&&RJ(Q,"touchmove",Z.wheelHandler),K},H9=function(){function J($,Z){i$||J.register(A0)||console.warn("Please gsap.registerPlugin(ScrollTrigger)"),eY(this),this.init($,Z)}var Q=J.prototype;return Q.init=function $(Z,W){if(this.progress=this.start=0,this.vars&&this.kill(!0,!0),!X6){this.update=this.refresh=this.kill=Z7;return}Z=v5(L8(Z)||U6(Z)||Z.nodeType?{trigger:Z}:Z,MK);var K=Z,H=K.onUpdate,X=K.toggleClass,Y=K.id,U=K.onToggle,G=K.onRefresh,q=K.scrub,N=K.trigger,R=K.pin,M=K.pinSpacing,E=K.invalidateOnRefresh,F=K.anticipatePin,O=K.onScrubComplete,k=K.onSnapComplete,D=K.once,B=K.snap,A=K.pinReparent,C=K.pinSpacer,w=K.containerAnimation,T=K.fastScrollEnd,z=K.preventOverlaps,V=Z.horizontal||Z.containerAnimation&&Z.horizontal!==!1?SJ:r9,_=!q&&q!==0,b=dJ(Z.scroller||K9),p=A0.core.getCache(b),v=cQ(b),s=("pinType"in Z?Z.pinType:T7(b,"pinType")||v&&"fixed")==="fixed",m=[Z.onEnter,Z.onLeave,Z.onEnterBack,Z.onLeaveBack],h=_&&Z.toggleActions.split(" "),c="markers"in Z?Z.markers:MK.markers,t=v?0:parseFloat(T8(b)["border"+V.p2+e$])||0,j=this,Q0=Z.onRefreshInit&&function(){return Z.onRefreshInit(j)},L0=lz(b,v,V),i0=cz(b,v),b0=0,i=0,K0=0,J0=S7(b,V),k0,I0,y0,U9,c0,w0,p0,h0,N9,P,O9,m0,R9,U0,G9,S,L,g,a,r,n,O0,H0,S0,B0,$0,Z0,D0,C0,q0,s0,x,X0,W0,N0,e,o,z0,_0;if(j._startClamp=j._endClamp=!1,j._dir=V,F*=45,j.scroller=b,j.scroll=w?w.time.bind(w):J0,U9=J0(),j.vars=Z,W=W||Z.animation,"refreshPriority"in Z)i5=1,Z.refreshPriority===-9999&&(O6=j);if(p.tweenScroll=p.tweenScroll||{top:c5(b,r9),left:c5(b,SJ)},j.tweenTo=k0=p.tweenScroll[V.p],j.scrubDuration=function(F0){if(X0=U6(F0)&&F0,!X0)x&&x.progress(1).kill(),x=0;else x?x.duration(F0):x=A0.to(W,{ease:"expo",totalProgress:"+=0",inherit:!1,duration:X0,paused:!0,onComplete:function n0(){return O&&O(j)}})},W)W.vars.lazy=!1,W._initted&&!j.isReverted||W.vars.immediateRender!==!1&&Z.immediateRender!==!1&&W.duration()&&W.render(0,!0,!0),j.animation=W.pause(),W.scrollTrigger=j,j.scrubDuration(q),q0=0,Y||(Y=W.vars.id);if(B){if(!pQ(B)||B.push)B={snapTo:B};"scrollBehavior"in B9.style&&A0.set(v?[B9,B8]:b,{scrollBehavior:"auto"}),$9.forEach(function(F0){return _J(F0)&&F0.target===(v?x9.scrollingElement||B8:b)&&(F0.smooth=!1)}),y0=_J(B.snapTo)?B.snapTo:B.snapTo==="labels"?nz(W):B.snapTo==="labelsDirectional"?oz(W):B.directional!==!1?function(F0,n0){return GU(B.snapTo)(F0,jJ()-i<500?0:n0.direction)}:A0.utils.snap(B.snapTo),W0=B.duration||{min:0.1,max:2},W0=pQ(W0)?q6(W0.min,W0.max):q6(W0,W0),N0=A0.delayedCall(B.delay||X0/2||0.1,function(){var F0=J0(),n0=jJ()-i<500,x0=k0.tween;if((n0||Math.abs(j.getVelocity())<10)&&!x0&&!jK&&b0!==F0){var o0=(F0-w0)/U0,c9=W&&!_?W.totalProgress():o0,a0=n0?0:(c9-s0)/(jJ()-H6)*1000||0,b9=A0.utils.clamp(-o0,1-o0,n$(a0/2)*a0/0.185),JJ=o0+(B.inertia===!1?0:b9),y9,D9,L9=B,VJ=L9.onStart,T9=L9.onInterrupt,kJ=L9.onComplete;if(y9=y0(JJ,j),U6(y9)||(y9=JJ),D9=Math.max(0,Math.round(w0+y9*U0)),F0<=p0&&F0>=w0&&D9!==F0){if(x0&&!x0._initted&&x0.data<=n$(D9-F0))return;if(B.inertia===!1)b9=y9-o0;k0(D9,{duration:W0(n$(Math.max(n$(JJ-c9),n$(y9-c9))*0.185/a0/0.05||0)),ease:B.ease||"power3",data:n$(D9-F0),onInterrupt:function D8(){return N0.restart(!0)&&T9&&T9(j)},onComplete:function D8(){if(j.update(),b0=J0(),W&&!_)x?x.resetTo("totalProgress",y9,W._tTime/W._tDur):W.progress(y9);q0=s0=W&&!_?W.totalProgress():j.progress,k&&k(j),kJ&&kJ(j)}},F0,b9*U0,D9-F0-b9*U0),VJ&&VJ(j,k0.tween)}}else if(j.isActive&&b0!==F0)N0.restart(!0)}).pause()}if(Y&&(QU[Y]=j),N=j.trigger=dJ(N||R!==!0&&R),_0=N&&N._gsap&&N._gsap.stRevert,_0&&(_0=_0(j)),R=R===!0?N:dJ(R),L8(X)&&(X={targets:N,className:X}),R){if(M===!1||M===S8||(M=!M&&R.parentNode&&R.parentNode.style&&T8(R.parentNode).display==="flex"?!1:t9),j.pin=R,I0=A0.core.getCache(R),!I0.spacer){if(C)C=dJ(C),C&&!C.nodeType&&(C=C.current||C.nativeElement),I0.spacerIsNative=!!C,C&&(I0.spacerState=BK(C));I0.spacer=g=C||x9.createElement("div"),g.classList.add("pin-spacer"),Y&&g.classList.add("pin-spacer-"+Y),I0.pinState=G9=BK(R)}else G9=I0.pinState;Z.force3D!==!1&&A0.set(R,{force3D:!0}),j.spacer=g=I0.spacer,C0=T8(R),S0=C0[M+V.os2],r=A0.getProperty(R),n=A0.quickSetter(R,V.a,UJ),iY(R,g,C0),L=BK(R)}if(c){m0=pQ(c)?v5(c,g5):g5,P=LK("scroller-start",Y,b,V,m0,0),O9=LK("scroller-end",Y,b,V,m0,0,P),a=P["offset"+V.op.d2];var F9=dJ(T7(b,"content")||b);if(h0=this.markerStart=LK("start",Y,F9,V,m0,a,0,w),N9=this.markerEnd=LK("end",Y,F9,V,m0,a,0,w),w&&(z0=A0.quickSetter([h0,N9],V.a,UJ)),!s&&!(s8.length&&T7(b,"fixedMarkers")===!0))sz(v?B9:b),A0.set([P,O9],{force3D:!0}),$0=A0.quickSetter(P,V.a,UJ),D0=A0.quickSetter(O9,V.a,UJ)}if(w){var M0=w.vars.onUpdate,T0=w.vars.onUpdateParams;w.eventCallback("onUpdate",function(){j.update(0,0,1),M0&&M0.apply(w,T0||[])})}if(j.previous=function(){return Z9[Z9.indexOf(j)-1]},j.next=function(){return Z9[Z9.indexOf(j)+1]},j.revert=function(F0,n0){if(!n0)return j.kill(!0);var x0=F0!==!1||!j.enabled,o0=TJ;if(x0!==j.isReverted){if(x0)e=Math.max(J0(),j.scroll.rec||0),K0=j.progress,o=W&&W.progress();if(h0&&[h0,N9,P,O9].forEach(function(c9){return c9.style.display=x0?"none":"block"}),x0)TJ=j,j.update(x0);if(R&&(!A||!j.isActive))if(x0)rz(R,g,G9);else iY(R,g,T8(R),B0);x0||j.update(x0),TJ=o0,j.isReverted=x0}},j.refresh=function(F0,n0,x0,o0){if((TJ||!j.enabled)&&!n0)return;if(R&&F0&&j8){RJ(J,"scrollEnd",HN);return}if(!cJ&&Q0&&Q0(j),TJ=j,k0.tween&&!x0)k0.tween.kill(),k0.tween=0;if(x&&x.pause(),E&&W)W.revert({kill:!1}).invalidate(),W.getChildren&&W.getChildren(!0,!0,!1).forEach(function(P0){return P0.vars.immediateRender&&P0.render(0,!0,!0)});j.isReverted||j.revert(!0,!0),j._subPinOffset=!1;var c9=L0(),a0=i0(),b9=w?w.duration():W7(b,V),JJ=U0<=0.01||!U0,y9=0,D9=o0||0,L9=pQ(x0)?x0.end:Z.end,VJ=Z.endTrigger||N,T9=pQ(x0)?x0.start:Z.start||(Z.start===0||!N?0:R?"0 0":"0 100%"),kJ=j.pinnedContainer=Z.pinnedContainer&&dJ(Z.pinnedContainer,j),D8=N&&Math.max(0,Z9.indexOf(j))||0,QJ=D8,$J,GJ,X7,tQ,I,y,u,l,d,Y0,R0,G0,V0;if(c&&pQ(x0))G0=A0.getProperty(P,V.p),V0=A0.getProperty(O9,V.p);while(QJ-- >0){if(y=Z9[QJ],y.end||y.refresh(0,1)||(TJ=j),u=y.pin,u&&(u===N||u===R||u===kJ)&&!y.isReverted)Y0||(Y0=[]),Y0.unshift(y),y.revert(!0,!0);if(y!==Z9[QJ])D8--,QJ--}if(_J(T9)&&(T9=T9(j)),T9=b5(T9,"start",j),w0=u5(T9,N,c9,V,J0(),h0,P,j,a0,t,s,b9,w,j._startClamp&&"_startClamp")||(R?-0.001:0),_J(L9)&&(L9=L9(j)),L8(L9)&&!L9.indexOf("+="))if(~L9.indexOf(" "))L9=(L8(T9)?T9.split(" ")[0]:"")+L9;else y9=VK(L9.substr(2),c9),L9=L8(T9)?T9:(w?A0.utils.mapRange(0,w.duration(),w.scrollTrigger.start,w.scrollTrigger.end,w0):w0)+y9,VJ=N;L9=b5(L9,"end",j),p0=Math.max(w0,u5(L9||(VJ?"100% 0":b9),VJ,c9,V,J0()+y9,N9,O9,j,a0,t,s,b9,w,j._endClamp&&"_endClamp"))||-0.001,y9=0,QJ=D8;while(QJ--)if(y=Z9[QJ],u=y.pin,u&&y.start-y._pinPush<=w0&&!w&&y.end>0){if($J=y.end-(j._startClamp?Math.max(0,y.start):y.start),(u===N&&y.start-y._pinPush=W7(b,V))){if($J=T8(R),tQ=V===r9,X7=J0(),O0=parseFloat(r(V.a))+D9,!b9&&p0>1){if(R0=(v?x9.scrollingElement||B8:b).style,R0={style:R0,value:R0["overflow"+V.a.toUpperCase()]},v&&T8(B9)["overflow"+V.a.toUpperCase()]!=="scroll")R0.style["overflow"+V.a.toUpperCase()]="scroll"}if(iY(R,g,$J),L=BK(R),GJ=j7(R,!0),l=s&&S7(b,tQ?SJ:r9)(),M){if(B0=[M+V.os2,U0+D9+UJ],B0.t=g,QJ=M===t9?SK(R,V)+U0+D9:0,QJ)B0.push(V.d,QJ+UJ),g.style.flexBasis!=="auto"&&(g.style.flexBasis=QJ+UJ);if(t$(B0),kJ)Z9.forEach(function(P0){if(P0.pin===kJ&&P0.vars.pinSpacing!==!1)P0._subPinOffset=!0});s&&J0(e)}else QJ=SK(R,V),QJ&&g.style.flexBasis!=="auto"&&(g.style.flexBasis=QJ+UJ);if(s)I={top:GJ.top+(tQ?X7-w0:l)+UJ,left:GJ.left+(tQ?l:X7-w0)+UJ,boxSizing:"border-box",position:"fixed"},I[dQ]=I["max"+e$]=Math.ceil(GJ.width)+UJ,I[uQ]=I["max"+UU]=Math.ceil(GJ.height)+UJ,I[S8]=I[S8+F6]=I[S8+N6]=I[S8+E6]=I[S8+R6]="0",I[t9]=$J[t9],I[t9+F6]=$J[t9+F6],I[t9+N6]=$J[t9+N6],I[t9+E6]=$J[t9+E6],I[t9+R6]=$J[t9+R6],S=ez(G9,I,A),cJ&&J0(0);if(W)d=W._initted,lY(1),W.render(W.duration(),!0,!0),H0=r(V.a)-O0+U0+D9,Z0=Math.abs(U0-H0)>1,s&&Z0&&S.splice(S.length-2,2),W.render(0,!0,!0),d||W.invalidate(!0),W.parent||W.totalTime(W.totalTime()),lY(0);else H0=U0;R0&&(R0.value?R0.style["overflow"+V.a.toUpperCase()]=R0.value:R0.style.removeProperty("overflow-"+V.a))}else if(N&&J0()&&!w){GJ=N.parentNode;while(GJ&&GJ!==B9){if(GJ._pinOffset)w0-=GJ._pinOffset,p0-=GJ._pinOffset;GJ=GJ.parentNode}}if(Y0&&Y0.forEach(function(P0){return P0.revert(!1,!0)}),j.start=w0,j.end=p0,U9=c0=cJ?e:J0(),!w&&!cJ)U90?Z9.slice(0,n0).reverse():Z9.slice(n0+1);return(L8(F0)?x0.filter(function(o0){return o0.vars.preventOverlaps===F0}):x0).filter(function(o0){return j.direction>0?o0.end<=w0:o0.start>=p0})},j.update=function(F0,n0,x0){if(w&&!x0&&!F0)return;var o0=cJ===!0?e:j.scroll(),c9=F0?0:(o0-w0)/U0,a0=c9<0?0:c9>1?1:c9||0,b9=j.progress,JJ,y9,D9,L9,VJ,T9,kJ,D8;if(n0){if(c0=U9,U9=w?J0():o0,B)s0=q0,q0=W&&!_?W.totalProgress():a0}if(F&&R&&!TJ&&!RK&&j8){if(!a0&&w0o0+(o0-c0)/(jJ()-H6)*F)a0=0.9999}if(a0!==b9&&j.enabled){if(JJ=j.isActive=!!a0&&a0<1,y9=!!b9&&b9<1,T9=JJ!==y9,VJ=T9||!!a0!==!!b9,j.direction=a0>b9?1:-1,j.progress=a0,VJ&&!TJ){if(D9=a0&&!b9?0:a0===1?1:b9===1?2:3,_)L9=!T9&&h[D9+1]!=="none"&&h[D9+1]||h[D9],D8=W&&(L9==="complete"||L9==="reset"||(L9 in W))}if(z&&(T9||D8)&&(D8||q||!W)&&(_J(z)?z(j):j.getTrailing(z).forEach(function(X7){return X7.endAnimation()})),!_){if(x&&!TJ&&!RK)if(x._dp._time-x._start!==x._time&&x.render(x._dp._time-x._start),x.resetTo)x.resetTo("totalProgress",a0,W._tTime/W._tDur);else x.vars.totalProgress=a0,x.invalidate().restart();else if(W)W.totalProgress(a0,!!(TJ&&(i||F0)))}if(R){if(F0&&M&&(g.style[M+V.os2]=S0),!s)n(Y6(O0+H0*a0));else if(VJ){if(kJ=!F0&&a0>b9&&p0+1>o0&&o0+1>=W7(b,V),A)if(!F0&&(JJ||kJ)){var QJ=j7(R,!0),$J=o0-w0;l5(R,B9,QJ.top+(V===r9?$J:0)+UJ,QJ.left+(V===r9?0:$J)+UJ)}else l5(R,g);t$(JJ||kJ?S:L),Z0&&a0<1&&JJ||n(O0+(a0===1&&!kJ?H0:0))}}if(B&&!k0.tween&&!TJ&&!RK&&N0.restart(!0),X&&(T9||D&&a0&&(a0<1||!cY))&&M6(X.targets).forEach(function(X7){return X7.classList[JJ||D?"add":"remove"](X.className)}),H&&!_&&!F0&&H(j),VJ&&!TJ){if(_){if(D8)if(L9==="complete")W.pause().totalProgress(1);else if(L9==="reset")W.restart(!0).pause();else if(L9==="restart")W.restart(!0);else W[L9]();H&&H(j)}if(T9||!cY){if(U&&T9&&nY(j,U),m[D9]&&nY(j,m[D9]),D&&(a0===1?j.kill(!1,1):m[D9]=0),!T9)D9=a0===1?1:3,m[D9]&&nY(j,m[D9])}if(T&&!JJ&&Math.abs(j.getVelocity())>(U6(T)?T:2500))K6(j.callbackAnimation),x?x.progress(1):K6(W,L9==="reverse"?1:!a0,1)}else if(_&&H&&!TJ)H(j)}if(D0){var GJ=w?o0/w.duration()*(w._caScrollDist||0):o0;$0(GJ+(P._isFlipped?1:0)),D0(GJ)}z0&&z0(-o0/w.duration()*(w._caScrollDist||0))},j.enable=function(F0,n0){if(!j.enabled){if(j.enabled=!0,RJ(b,"resize",G6),v||RJ(b,"scroll",o$),Q0&&RJ(J,"refreshInit",Q0),F0!==!1)j.progress=K0=0,U9=c0=b0=J0();n0!==!1&&j.refresh()}},j.getTween=function(F0){return F0&&k0?k0.tween:x},j.setPositions=function(F0,n0,x0,o0){if(w){var c9=w.scrollTrigger,a0=w.duration(),b9=c9.end-c9.start;F0=c9.start+b9*F0/a0,n0=c9.start+b9*n0/a0}j.refresh(!1,!1,{start:y5(F0,x0&&!!j._startClamp),end:y5(n0,x0&&!!j._endClamp)},o0),j.update()},j.adjustPinSpacing=function(F0){if(B0&&F0){var n0=B0.indexOf(V.d)+1;B0[n0]=parseFloat(B0[n0])+F0+UJ,B0[1]=parseFloat(B0[1])+F0+UJ,t$(B0)}},j.disable=function(F0,n0){if(j.enabled){if(F0!==!1&&j.revert(!0,!0),j.enabled=j.isActive=!1,n0||x&&x.pause(),e=0,I0&&(I0.uncache=1),Q0&&NJ(J,"refreshInit",Q0),N0)N0.pause(),k0.tween&&k0.tween.kill()&&(k0.tween=0);if(!v){var x0=Z9.length;while(x0--)if(Z9[x0].scroller===b&&Z9[x0]!==j)return;NJ(b,"resize",G6),v||NJ(b,"scroll",o$)}}},j.kill=function(F0,n0){j.disable(F0,n0),x&&!n0&&x.kill(),Y&&delete QU[Y];var x0=Z9.indexOf(j);if(x0>=0&&Z9.splice(x0,1),x0===lJ&&CK>0&&lJ--,x0=0,Z9.forEach(function(o0){return o0.scroller===j.scroller&&(x0=1)}),x0||cJ||(j.scroll.rec=0),W)W.scrollTrigger=null,F0&&W.revert({kill:!1}),n0||W.kill();if(h0&&[h0,N9,P,O9].forEach(function(o0){return o0.parentNode&&o0.parentNode.removeChild(o0)}),O6===j&&(O6=0),R)I0&&(I0.uncache=1),x0=0,Z9.forEach(function(o0){return o0.pin===R&&x0++}),x0||(I0.spacer=0);Z.onKill&&Z.onKill(j)},Z9.push(j),j.enable(!1,!1),_0&&_0(j),W&&W.add&&!U0){var e0=j.update;j.update=function(){j.update=e0,$9.cache++,w0||p0||j.refresh()},A0.delayedCall(0.01,j.update),U0=0.01,w0=p0=0}else j.refresh();R&&az()},J.register=function $(Z){if(!i$)A0=Z||JN(),e5()&&window.document&&J.enable(),i$=X6;return i$},J.defaults=function $(Z){if(Z)for(var W in Z)MK[W]=Z[W];return MK},J.disable=function $(Z,W){X6=0,Z9.forEach(function(H){return H[W?"kill":"disable"](Z)}),NJ(K9,"wheel",o$),NJ(x9,"scroll",o$),clearInterval(NK),NJ(x9,"touchcancel",Z7),NJ(B9,"touchstart",Z7),EK(NJ,x9,"pointerdown,touchstart,mousedown",h5),EK(NJ,x9,"pointerup,touchend,mouseup",f5),AK.kill(),FK(NJ);for(var K=0;K<$9.length;K+=3)OK(NJ,$9[K],$9[K+1]),OK(NJ,$9[K],$9[K+2])},J.enable=function $(){if(K9=window,x9=document,B8=x9.documentElement,B9=x9.body,A0){if(M6=A0.utils.toArray,q6=A0.utils.clamp,eY=A0.core.context||Z7,lY=A0.core.suppressOverwrites||Z7,KU=K9.history.scrollRestoration||"auto",$U=K9.pageYOffset||0,A0.core.globals("ScrollTrigger",J),B9){if(X6=1,r$=document.createElement("div"),r$.style.height="100vh",r$.style.position="absolute",UN(),uz(),l9.register(A0),J.isTouch=l9.isTouch,XQ=l9.isTouch&&/(iPad|iPhone|iPod|Mac)/g.test(navigator.userAgent),tY=l9.isTouch===1,RJ(K9,"wheel",o$),WU=[K9,x9,B8,B9],A0.matchMedia)J.matchMedia=function(U){var G=A0.matchMedia(),q;for(q in U)G.add(q,U[q]);return G},A0.addEventListener("matchMediaInit",function(){return qU()}),A0.addEventListener("matchMediaRevert",function(){return XN()}),A0.addEventListener("matchMedia",function(){mQ(0,1),nQ("matchMedia")}),A0.matchMedia().add("(orientation: portrait)",function(){return oY(),oY});else console.warn("Requires GSAP 3.11.0 or later");oY(),RJ(x9,"scroll",o$);var Z=B9.hasAttribute("style"),W=B9.style,K=W.borderTopStyle,H=A0.core.Animation.prototype,X,Y;if(H.revert||Object.defineProperty(H,"revert",{value:function U(){return this.time(-0.01,!0)}}),W.borderTopStyle="solid",X=j7(B9),r9.m=Math.round(X.top+r9.sc())||0,SJ.m=Math.round(X.left+SJ.sc())||0,K?W.borderTopStyle=K:W.removeProperty("border-top-style"),!Z)B9.setAttribute("style",""),B9.removeAttribute("style");NK=setInterval(p5,250),A0.delayedCall(0.5,function(){return RK=0}),RJ(x9,"touchcancel",Z7),RJ(B9,"touchstart",Z7),EK(RJ,x9,"pointerdown,touchstart,mousedown",h5),EK(RJ,x9,"pointerup,touchend,mouseup",f5),rY=A0.utils.checkPrefix("transform"),IK.push(rY),i$=jJ(),AK=A0.delayedCall(0.2,mQ).pause(),a$=[x9,"visibilitychange",function(){var{innerWidth:U,innerHeight:G}=K9;if(x9.hidden)_5=U,x5=G;else if(_5!==U||x5!==G)G6()},x9,"DOMContentLoaded",mQ,K9,"load",mQ,K9,"resize",G6],FK(RJ),Z9.forEach(function(U){return U.enable(0,1)});for(Y=0;Y<$9.length;Y+=3)OK(NJ,$9[Y],$9[Y+1]),OK(NJ,$9[Y],$9[Y+2])}}},J.config=function $(Z){"limitCallbacks"in Z&&(cY=!!Z.limitCallbacks);var W=Z.syncInterval;if(W&&clearInterval(NK)||(NK=W)&&setInterval(p5,W),"ignoreMobileResize"in Z&&(tY=J.isTouch===1&&Z.ignoreMobileResize),"autoRefreshEvents"in Z)FK(NJ)||FK(RJ,Z.autoRefreshEvents||"none"),a5=(Z.autoRefreshEvents+"").indexOf("resize")===-1},J.scrollerProxy=function $(Z,W){var K=dJ(Z),H=$9.indexOf(K),X=cQ(K);if(~H)$9.splice(H,X?6:2);if(W)X?s8.unshift(K9,W,B9,W,B8,W):s8.unshift(K,W)},J.clearMatchMedia=function $(Z){Z9.forEach(function(W){return W._ctx&&W._ctx.query===Z&&W._ctx.kill(!0,!0)})},J.isInViewport=function $(Z,W,K){var H=(L8(Z)?dJ(Z):Z).getBoundingClientRect(),X=H[K?dQ:uQ]*W||0;return K?H.right-X>0&&H.left+X0&&H.top+X=0&&M8.splice($,5),M8.push(Q,Q.style.cssText,Q.getBBox&&Q.getAttribute("transform"),A0.core.getCache(Q),eY())}}):M8};H9.revert=function(J,Q){return qU(!J,Q)};H9.create=function(J,Q){return new H9(J,Q)};H9.refresh=function(J){return J?G6(!0):(i$||H9.register())&&mQ(!0)};H9.update=function(J){return++$9.cache&&_7(J===!0?2:0)};H9.clearScrollMemory=YN;H9.maxScroll=function(J,Q){return W7(J,Q?SJ:r9)};H9.getScrollFunc=function(J,Q){return S7(dJ(J),Q?SJ:r9)};H9.getById=function(J){return QU[J]};H9.getAll=function(){return Z9.filter(function(J){return J.vars.id!=="ScrollSmoother"})};H9.isScrolling=function(){return!!j8};H9.snapDirectional=GU;H9.addEventListener=function(J,Q){var $=sQ[J]||(sQ[J]=[]);~$.indexOf(Q)||$.push(Q)};H9.removeEventListener=function(J,Q){var $=sQ[J],Z=$&&$.indexOf(Q);Z>=0&&$.splice(Z,1)};H9.batch=function(J,Q){var $=[],Z={},W=Q.interval||0.016,K=Q.batchMax||1e9,H=function Y(U,G){var q=[],N=[],R=A0.delayedCall(W,function(){G(q,N),q=[],N=[]}).pause();return function(M){q.length||R.restart(!0),q.push(M.trigger),N.push(M),K<=q.length&&R.progress(1)}},X;for(X in Q)Z[X]=X.substr(0,2)==="on"&&_J(Q[X])&&X!=="onRefreshInit"?H(X,Q[X]):Q[X];if(_J(K))K=K(),RJ(H9,"refresh",function(){return K=Q.batchMax()});return M6(J).forEach(function(Y){var U={};for(X in Z)U[X]=Z[X];U.trigger=Y,$.push(H9.create(U))}),$};var s5=function J(Q,$,Z,W){return $>W?Q(W):$<0&&Q(0),Z>W?(W-$)/(Z-$):Z<0?$/($-Z):1},aY=function J(Q,$){if($===!0)Q.style.removeProperty("touch-action");else Q.style.touchAction=$===!0?"auto":$?"pan-"+$+(l9.isTouch?" pinch-zoom":""):"none";Q===B8&&J(B9,$)},zK={auto:1,scroll:1},QV=function J(Q){var{event:$,target:Z,axis:W}=Q,K=($.changedTouches?$.changedTouches[0]:$).target,H=K._gsap||A0.core.getCache(K),X=jJ(),Y;if(!H._isScrollT||X-H._isScrollT>2000){while(K&&K!==B9&&(K.scrollHeight<=K.clientHeight&&K.scrollWidth<=K.clientWidth||!(zK[(Y=T8(K)).overflowY]||zK[Y.overflowX])))K=K.parentNode;H._isScroll=K&&K!==Z&&!cQ(K)&&(zK[(Y=T8(K)).overflowY]||zK[Y.overflowX]),H._isScrollT=X}if(H._isScroll||W==="x")$.stopPropagation(),$._gsapAllow=!0},qN=function J(Q,$,Z,W){return l9.create({target:Q,capture:!0,debounce:!1,lockAxis:!0,type:$,onWheel:W=W&&QV,onPress:W,onDrag:W,onScroll:W,onEnable:function K(){return Z&&RJ(x9,l9.eventTypes[0],o5,!1,!0)},onDisable:function K(){return NJ(x9,l9.eventTypes[0],o5,!0)}})},$V=/(input|label|select|textarea)/i,n5,o5=function J(Q){var $=$V.test(Q.target.tagName);if($||n5)Q._gsapAllow=!0,n5=$},ZV=function J(Q){pQ(Q)||(Q={}),Q.preventDefault=Q.isNormalizer=Q.allowClicks=!0,Q.type||(Q.type="wheel,touch"),Q.debounce=!!Q.debounce,Q.id=Q.id||"normalizer";var $=Q,Z=$.normalizeScrollX,W=$.momentum,K=$.allowNestedScroll,H=$.onRelease,X,Y,U=dJ(Q.target)||B8,G=A0.core.globals().ScrollSmoother,q=G&&G.get(),N=XQ&&(Q.content&&dJ(Q.content)||q&&Q.content!==!1&&!q.smooth()&&q.content()),R=S7(U,r9),M=S7(U,SJ),E=1,F=(l9.isTouch&&K9.visualViewport?K9.visualViewport.scale*K9.visualViewport.width:K9.outerWidth)/K9.innerWidth,O=0,k=_J(W)?function(){return W(X)}:function(){return W||2.8},D,B,A=qN(U,Q.type,!0,K),C=function h(){return B=!1},w=Z7,T=Z7,z=function h(){Y=W7(U,r9),T=q6(XQ?1:0,Y),Z&&(w=q6(0,W7(U,SJ))),D=lQ},V=function h(){N._gsap.y=Y6(parseFloat(N._gsap.y)+R.offset)+"px",N.style.transform="matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, "+parseFloat(N._gsap.y)+", 0, 1)",R.offset=R.cacheID=0},_=function h(){if(B){requestAnimationFrame(C);var c=Y6(X.deltaY/2),t=T(R.v-c);if(N&&t!==R.v+R.offset){R.offset=t-R.v;var j=Y6((parseFloat(N&&N._gsap.y)||0)-R.offset);N.style.transform="matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, "+j+", 0, 1)",N._gsap.y=j+"px",R.cacheID=$9.cache,_7()}return!0}R.offset&&V(),B=!0},b,p,v,s,m=function h(){if(z(),b.isActive()&&b.vars.scrollY>Y)R()>Y?b.progress(1)&&R(Y):b.resetTo("scrollY",Y)};return N&&A0.set(N,{y:"+=0"}),Q.ignoreCheck=function(h){return XQ&&h.type==="touchmove"&&_(h)||E>1.05&&h.type!=="touchstart"||X.isGesturing||h.touches&&h.touches.length>1},Q.onPress=function(){B=!1;var h=E;E=Y6((K9.visualViewport&&K9.visualViewport.scale||1)/F),b.pause(),h!==E&&aY(U,E>1.01?!0:Z?!1:"x"),p=M(),v=R(),z(),D=lQ},Q.onRelease=Q.onGestureStart=function(h,c){if(R.offset&&V(),!c)s.restart(!0);else{$9.cache++;var t=k(),j,Q0;if(Z)j=M(),Q0=j+t*0.05*-h.velocityX/0.227,t*=s5(M,j,Q0,W7(U,SJ)),b.vars.scrollX=w(Q0);if(j=R(),Q0=j+t*0.05*-h.velocityY/0.227,t*=s5(R,j,Q0,W7(U,r9)),b.vars.scrollY=T(Q0),b.invalidate().duration(t).play(0.01),XQ&&b.vars.scrollY>=Y||j>=Y-1)A0.to({},{onUpdate:m,duration:t})}H&&H(h)},Q.onWheel=function(){if(b._ts&&b.pause(),jJ()-O>1000)D=0,O=jJ()},Q.onChange=function(h,c,t,j,Q0){if(lQ!==D&&z(),c&&Z&&M(w(j[2]===c?p+(h.startX-h.x):M()+c-j[1])),t){R.offset&&V();var L0=Q0[2]===t,i0=L0?v+h.startY-h.y:R()+t-Q0[1],b0=T(i0);L0&&i0!==b0&&(v+=b0-i0),R(b0)}(t||c)&&_7()},Q.onEnable=function(){if(aY(U,Z?!1:"x"),H9.addEventListener("refresh",m),RJ(K9,"resize",m),R.smooth)R.target.style.scrollBehavior="auto",R.smooth=M.smooth=!1;A.enable()},Q.onDisable=function(){aY(U,!0),NJ(K9,"resize",m),H9.removeEventListener("refresh",m),A.kill()},Q.lockAxis=Q.lockAxis!==!1,X=new l9(Q),X.iOS=XQ,XQ&&!R()&&R(1),XQ&&A0.ticker.add(Z7),s=X._dc,b=A0.to(X,{ease:"power4",paused:!0,inherit:!1,scrollX:Z?"+=0.1":"+=0",scrollY:"+=0.1",modifiers:{scrollY:GN(R,R(),function(){return b.pause()})},onUpdate:_7,onComplete:s.vars.onComplete}),X};H9.sort=function(J){if(_J(J))return Z9.sort(J);var Q=K9.pageYOffset||0;return H9.getAll().forEach(function($){return $._sortY=$.trigger?Q+$.trigger.getBoundingClientRect().top:$.start+K9.innerHeight}),Z9.sort(J||function($,Z){return($.vars.refreshPriority||0)*-1e6+($.vars.containerAnimation?1e6:$._sortY)-((Z.vars.containerAnimation?1e6:Z._sortY)+(Z.vars.refreshPriority||0)*-1e6)})};H9.observe=function(J){return new l9(J)};H9.normalizeScroll=function(J){if(typeof J==="undefined")return uJ;if(J===!0&&uJ)return uJ.enable();if(J===!1){uJ&&uJ.kill(),uJ=J;return}var Q=J instanceof l9?J:ZV(J);return uJ&&uJ.target===Q.target&&uJ.kill(),cQ(Q.target)&&(uJ=Q),Q};H9.core={_getVelocityProp:qK,_inputObserver:qN,_scrollers:$9,_proxies:s8,bridge:{ss:function J(){j8||nQ("scrollStart"),j8=jJ()},ref:function J(){return TJ}}};JN()&&A0.registerPlugin(H9);/*! * SplitText 3.13.0 * https://gsap.com * * @license Copyright 2025, GreenSock. All rights reserved. Subject to the terms at https://gsap.com/standard-license. * @author: Jack Doyle */var B6,JZ,RU,WV=()=>RU||xK.register(window.gsap),NN=typeof Intl!=="undefined"?new Intl.Segmenter:0,_K=(J)=>typeof J==="string"?_K(document.querySelectorAll(J)):("length"in J)?Array.from(J):[J],RN=(J)=>_K(J).filter((Q)=>Q instanceof HTMLElement),FU=[],NU=function(){},KV=/\s+/g,FN=new RegExp("\\p{RI}\\p{RI}|\\p{Emoji}(\\p{EMod}|\\u{FE0F}\\u{20E3}?|[\\u{E0020}-\\u{E007E}]+\\u{E007F})?(\\u{200D}\\p{Emoji}(\\p{EMod}|\\u{FE0F}\\u{20E3}?|[\\u{E0020}-\\u{E007E}]+\\u{E007F})?)*|.","gu"),EN={left:0,top:0,width:0,height:0},ON=(J,Q)=>{if(Q){let $=new Set(J.join("").match(Q)||FU),Z=J.length,W,K,H,X;if($.size)while(--Z>-1){K=J[Z];for(H of $)if(H.startsWith(K)&&H.length>K.length){W=0,X=K;while(H.startsWith(X+=J[Z+ ++W])&&X.lengthwindow.getComputedStyle(J).display==="inline"&&(J.style.display="inline-block"),QZ=(J,Q,$)=>Q.insertBefore(typeof J==="string"?document.createTextNode(J):J,$),EU=(J,Q,$)=>{let Z=Q[J+"sClass"]||"",{tag:W="div",aria:K="auto",propIndex:H=!1}=Q,X=J==="line"?"block":"inline-block",Y=Z.indexOf("++")>-1,U=(G)=>{let q=document.createElement(W),N=$.length+1;if(Z&&(q.className=Z+(Y?" "+Z+N:"")),H&&q.style.setProperty("--"+J,N+""),K!=="none"&&q.setAttribute("aria-hidden","true"),W!=="span")q.style.position="relative",q.style.display=X;return q.textContent=G,$.push(q),q};return Y&&(Z=Z.replace("++","")),U.collection=$,U},HV=(J,Q,$,Z)=>{let W=EU("line",$,Z),K=window.getComputedStyle(J).textAlign||"left";return(H,X)=>{let Y=W("");Y.style.textAlign=K,J.insertBefore(Y,Q[H]);for(;H{var G;let q=Array.from(J.childNodes),N=0,{wordDelimiter:R,reduceWhiteSpace:M=!0,prepareText:E}=Q,F=J.getBoundingClientRect(),O=F,k=!M&&window.getComputedStyle(J).whiteSpace.substring(0,3)==="pre",D=0,B=$.collection,A,C,w,T,z,V,_,b,p,v,s,m,h,c,t,j,Q0,L0;if(typeof R==="object")w=R.delimiter||R,C=R.replaceWith||"";else C=R===""?"":R||" ";A=C!==" ";for(;N-1)V=B[B.length-1],V.appendChild(document.createTextNode(Z?"":j));else V=$(Z?"":j),QZ(V,J,T),D&&p===1&&!_&&V.insertBefore(D,V.firstChild);if(Z){s=NN?ON([...NN.segment(j)].map((i0)=>i0.segment),Y):j.match(X)||FU;for(L0=0;L0O.top&&v.left<=O.left){m=J.cloneNode(),h=J.childNodes[0];while(h&&h!==V)c=h,h=h.nextSibling,m.appendChild(c);J.parentNode.insertBefore(m,J),W&&MN(m)}O=v}if(p=z.length?" ":A&&j.slice(-1)===" "?" "+C:C,J,T)}}J.removeChild(T),D=0}else if(T.nodeType===1){if(H&&H.indexOf(T)>-1)B.indexOf(T.previousSibling)>-1&&B[B.length-1].appendChild(T),D=T;else LN(T,Q,$,Z,W,K,H,X,Y,!0),D=0;W&&MN(T)}},BN=class J{constructor(Q,$){this.isSplit=!1,WV(),this.elements=RN(Q),this.chars=[],this.words=[],this.lines=[],this.masks=[],this.vars=$,this._split=()=>this.isSplit&&this.split(this.vars);let Z=[],W,K=()=>{let H=Z.length,X;while(H--){X=Z[H];let Y=X.element.offsetWidth;if(Y!==X.width){X.width=Y,this._split();return}}};this._data={orig:Z,obs:typeof ResizeObserver!=="undefined"&&new ResizeObserver(()=>{clearTimeout(W),W=setTimeout(K,200)})},NU(this),this.split($)}split(Q){this.isSplit&&this.revert(),this.vars=Q=Q||this.vars||{};let{type:$="chars,words,lines",aria:Z="auto",deepSlice:W=!0,smartWrap:K,onSplit:H,autoSplit:X=!1,specialChars:Y,mask:U}=this.vars,G=$.indexOf("lines")>-1,q=$.indexOf("chars")>-1,N=$.indexOf("words")>-1,R=q&&!N&&!G,M=Y&&("push"in Y?new RegExp("(?:"+Y.join("|")+")","gu"):Y),E=M?new RegExp(M.source+"|"+FN.source,"gu"):FN,F=!!Q.ignore&&RN(Q.ignore),{orig:O,animTime:k,obs:D}=this._data,B;if(q||N||G)this.elements.forEach((A,C)=>{O[C]={element:A,html:A.innerHTML,ariaL:A.getAttribute("aria-label"),ariaH:A.getAttribute("aria-hidden")},Z==="auto"?A.setAttribute("aria-label",(A.textContent||"").trim()):Z==="hidden"&&A.setAttribute("aria-hidden","true");let w=[],T=[],z=[],V=q?EU("char",Q,w):null,_=EU("word",Q,T),b,p,v,s;if(LN(A,Q,_,V,R,W&&(G||R),F,E,M,!1),G){let m=_K(A.childNodes),h=HV(A,m,Q,z),c,t=[],j=0,Q0=m.map((i0)=>i0.nodeType===1?i0.getBoundingClientRect():EN),L0=EN;for(b=0;bL0.top&&Q0[b].left<=L0.left)h(j,b),j=b;L0=Q0[b]}j{var b0;return(b0=i0.parentNode)==null?void 0:b0.removeChild(i0)})}if(!N){for(b=0;b{let C=A.cloneNode();return A.replaceWith(C),C.appendChild(A),A.className&&(C.className=A.className.replace(/(\b\w+\b)/g,"$1-mask")),C.style.overflow="clip",C}));if(this.isSplit=!0,JZ&&(X?JZ.addEventListener("loadingdone",this._split):JZ.status==="loading"&&console.warn("SplitText called before fonts loaded")),(B=H&&H(this))&&B.totalTime)this._data.anim=k?B.totalTime(k):B;return G&&X&&this.elements.forEach((A,C)=>{O[C].width=A.offsetWidth,D&&D.observe(A)}),this}revert(){var Q,$;let{orig:Z,anim:W,obs:K}=this._data;if(K&&K.disconnect(),Z.forEach(({element:H,html:X,ariaL:Y,ariaH:U})=>{H.innerHTML=X,Y?H.setAttribute("aria-label",Y):H.removeAttribute("aria-label"),U?H.setAttribute("aria-hidden",U):H.removeAttribute("aria-hidden")}),this.chars.length=this.words.length=this.lines.length=Z.length=this.masks.length=0,this.isSplit=!1,JZ==null||JZ.removeEventListener("loadingdone",this._split),W)this._data.animTime=W.totalTime(),W.revert();return($=(Q=this.vars).onRevert)==null||$.call(Q,this),this}static create(Q,$){return new J(Q,$)}static register(Q){if(B6=B6||Q||window.gsap,B6)_K=B6.utils.toArray,NU=B6.core.context||NU;if(!RU&&window.innerWidth>0)JZ=document.fonts,RU=!0}};BN.version="3.13.0";var xK=BN;var DN=()=>{return window.matchMedia("(prefers-reduced-motion: reduce)").matches};var e9=()=>{let J=!1;return function(Q){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(Q)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(Q.substr(0,4)))J=!0}(navigator.userAgent||navigator.vendor||window.opera),J};J6.registerPlugin(H9);var XV={ease:"expo.out",duration:1.2};J6.defaults(XV);var A4=DN(),FJ=J6;class OU{#J=[];add(J,Q=0,$=Symbol()){let Z=this.#J.findIndex((W)=>W.priority>Q);if(Z===-1)this.#J.push({fn:J,priority:Q,id:$});else this.#J.splice(Z,0,{fn:J,priority:Q,id:$});return()=>this.remove($)}remove(J){this.#J=this.#J.filter((Q)=>Q.id!==J)}notify(J){if(this.#J.length<1)return;this.#J.forEach((Q)=>Q.fn(J))}}class zN extends OU{constructor(){super();FJ.ticker.add(this.update.bind(this))}update(J,Q){this.notify({deltaTime:J,time:Q*0.01})}}class VN extends OU{width=window.innerWidth;height=window.innerHeight;timeoutId=null;debounceDelay=100;constructor(){super();window.addEventListener("resize",this.update.bind(this))}update(){if(this.timeoutId)window.clearTimeout(this.timeoutId);this.timeoutId=window.setTimeout(()=>{let{innerWidth:J,innerHeight:Q}=window;if(J!==this.width||Q!==this.height)this.width=J,this.height=Q,this.notify({width:this.width,height:this.height});this.timeoutId=null},this.debounceDelay)}}var D6=new zN,xJ=new VN;var kN=`#define MPI 3.1415926535897932384626433832795 #define MTAU 6.283185307179586476925286766559 precision highp float; attribute vec3 position; attribute vec2 uv; uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform float u_time; varying vec2 v_uv; uniform vec4 u_resolution; vec2 imageuv(vec2 uv, vec2 size, vec2 resolution) { vec2 ratio = vec2( min((resolution.x / resolution.y) / (size.x / size.y), 1.0), min((resolution.y / resolution.x) / (size.y / size.x), 1.0) ); return vec2( uv.x * ratio.x + (1.0 - ratio.x) * 0.5, uv.y * ratio.y + (1.0 - ratio.y) * 0.5 ); } void main() { vec3 pos = position; gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0); v_uv = uv; } `;var CN=`precision highp float; uniform float u_time; uniform sampler2D u_img; uniform sampler2D u_depth; uniform float u_distortionIntensity; uniform vec2 u_distortionDirection; uniform vec2 u_mouse; uniform float u_distortionStrength; uniform float u_mouseXStrength; uniform float u_mouseYStrength; uniform float u_scroll; uniform vec4 u_resolution; uniform float u_blurRadius; varying vec2 v_uv; float sampleDepthBlur(sampler2D depthTex, vec2 uv, float radius) { vec2 texelSize = 1.0 / vec2(u_resolution.z, u_resolution.w); float total = 0.0; float count = 0.0; for (float x = -2.0; x <= 2.0; x += 1.0) { for (float y = -2.0; y <= 2.0; y += 1.0) { vec2 offset = vec2(x, y) * texelSize * radius; vec4 sample = texture2D(depthTex, uv + offset); total += sample.r; count += 1.0; } } return total / count; } void main() { float depth = sampleDepthBlur(u_depth, v_uv, u_blurRadius * 2.); float depthCentered = depth - 0.5; float scroll = u_scroll * 2.0 - 1.0; float directionLength = max(length(u_distortionDirection), 0.0001); vec2 direction = u_distortionDirection / directionLength; vec2 scrollOffset = direction * depthCentered * scroll * u_distortionIntensity; vec2 mouseOffset = vec2(u_mouse.x * u_mouseXStrength, u_mouse.y * u_mouseYStrength) * depthCentered * u_distortionIntensity; vec2 distortionOffset = (scrollOffset + mouseOffset) * 2.0 * u_distortionStrength; vec2 distortedUv = clamp(v_uv + distortionOffset, 0.0, 1.0); vec4 img = texture2D(u_img, distortedUv); gl_FragColor = img; } `;class oQ extends i9{geometry;material;alignX="center";alignT=0;#J=xJ.add(()=>{this.resize()});constructor(J,Q=null,$=0){super();this.imgAsset=J,this.depthAsset=Q,this.zPosition=$,this.basePosition={x:0,y:0},this.currentParallaxX=0,this.currentParallaxY=0,this.currentMouseX=0,this.currentMouseY=0,this.scrollT=0,this.lerpFactor=0.05;let Z=Math.min(1,Math.max(0,($-0.1)/0.4));this.depthFactor=Z,this.parallaxFactor=0.2+0.8*Z,this.scrollDepthStrength=0.04,this.scrollParallaxScale=0.5,this.alignParallaxScale=1,this.scrollYOffsetFactor=0,this.baseYOffsetFactor=0,this.baseXOffsetFactor=0,this.distortionIntensityMultiplier=1.3-($+0.1)/0.2*0.6,this.geometry=new CQ(J.source.r,1,1,1),this.material=new IN(J,Q,{distortionIntensityMultiplier:this.distortionIntensityMultiplier,distortionStrength:1,mouseXStrength:1,mouseYStrength:0.5}),this.position.z=$,this.resize(),k9.scene.add(this)}resize(){setTimeout(()=>{if(!this.imgAsset?.source)return;this.material.uniforms.u_resolution.value=[k9.vp.w,k9.vp.h,this.imgAsset.source.w,this.imgAsset.source.h];let J=k9.camera.fov*Math.PI/180,Q=k9.camera.position.z-this.position.z,$=Math.abs(Math.max(Q,0.0001)*Math.tan(J/2)*2);this.viewHeightAtPlane=$;let Z=$*(k9.vp.w/k9.vp.h);this.viewWidthAtPlane=Z;let W=$,K=W*this.imgAsset.source.r;this.scale.set(W,W,1),this.leftX=-Z/2+K/2,this.rightX=Z/2-K/2,this.updateBasePositionFromAlign(),this.basePosition.y=0,this.currentParallaxX=0,this.currentParallaxY=0,this.position.x=this.getBaseX(),this.position.y=this.basePosition.y},100)}getBaseX(){let J=(this.viewWidthAtPlane||1)*(this.baseXOffsetFactor||0);return(this.basePosition.x||0)+J}updateBasePositionFromAlign(){if(this.alignX==="left")this.basePosition.x=this.leftX??0;else if(this.alignX==="right")this.basePosition.x=this.rightX??0;else if(this.alignX==="lerp"){let J=this.leftX??0,Q=this.rightX??0,$=0.5+(this.alignT-0.5)*this.alignParallaxScale;this.basePosition.x=J+(Q-J)*$}else this.basePosition.x=0}render(J){let Q=k9?.mouse?.normalized?.x||0,$=k9?.mouse?.normalized?.y||0;if(this.currentMouseX+=(Q-this.currentMouseX)*this.lerpFactor,this.currentMouseY+=($-this.currentMouseY)*this.lerpFactor,this.material?.uniforms?.u_mouse)this.material.uniforms.u_mouse.value=[this.currentMouseX,this.currentMouseY];let Z=0,W=0;this.currentParallaxX+=(Z-this.currentParallaxX)*this.lerpFactor,this.currentParallaxY+=(W-this.currentParallaxY)*this.lerpFactor;let H=(this.scrollT-0.5)*2*(this.viewWidthAtPlane||1)*this.scrollDepthStrength*this.scrollParallaxScale,X=Math.sin(this.scrollT*Math.PI)*(this.viewHeightAtPlane||1)*this.scrollYOffsetFactor,Y=(this.viewHeightAtPlane||1)*this.baseYOffsetFactor;if(this.position.x=this.getBaseX()+this.currentParallaxX+H,this.position.y=this.basePosition.y+this.currentParallaxY+Y+X,this.material?.uniforms?.u_scroll)this.material.uniforms.u_scroll.value=this.scrollT}alignLeft(){this.alignX="left",this.resize()}alignRight(){this.alignX="right",this.resize()}alignLerp(J){this.alignX="lerp",this.alignT=Math.max(0,Math.min(1,J)),this.updateBasePositionFromAlign(),this.position.x=this.getBaseX()+this.currentParallaxX,this.position.y=this.basePosition.y+this.currentParallaxY}setScrollT(J){if(this.scrollT=Math.max(0,Math.min(1,J)),this.material?.uniforms?.u_scroll)this.material.uniforms.u_scroll.value=this.scrollT}setScrollParallaxScale(J){this.scrollParallaxScale=Math.max(0,J)}setAlignParallaxScale(J){this.alignParallaxScale=Math.max(0,J)}setScrollYOffsetFactor(J){this.scrollYOffsetFactor=J}setBaseYOffsetFactor(J){this.baseYOffsetFactor=J}setBaseXOffsetFactor(J){this.baseXOffsetFactor=J}setDistortionStrength(J){let Q=Math.max(0,J);if(this.material?.uniforms?.u_distortionStrength)this.material.uniforms.u_distortionStrength.value=Q}setMouseYStrength(J){let Q=Math.max(0,J);if(this.material?.uniforms?.u_mouseYStrength)this.material.uniforms.u_mouseYStrength.value=Q}setMouseXStrength(J){let Q=Math.max(0,J);if(this.material?.uniforms?.u_mouseXStrength)this.material.uniforms.u_mouseXStrength.value=Q}}class IN extends _Z{constructor(J,Q=null,$={}){let Z=Q||J,K=($?.u_distortionIntensity||0.006)*($?.distortionIntensityMultiplier||1);super({vertexShader:kN,fragmentShader:CN,uniforms:{u_time:{value:$?.u_time||0},u_img:{value:J},u_depth:{value:Z},u_resolution:{value:[k9.vp.w,k9.vp.h,J.source.w,J.source.h]},u_distortionIntensity:{value:K},u_distortionDirection:{value:$?.u_distortionDirection||[1,0]},u_mouse:{value:[0,0]},u_mouseXStrength:{value:Math.max(0,$?.mouseXStrength??1)},u_mouseYStrength:{value:Math.max(0,$?.mouseYStrength??0.5)},u_distortionStrength:{value:Math.max(0,$?.distortionStrength??1)},u_scroll:{value:0},u_blurRadius:{value:$?.u_blurRadius||10}},side:oJ,wireframe:!1,transparent:!0})}set time(J){this.uniforms.u_time.value=J}set distortionIntensity(J){this.uniforms.u_distortionIntensity.value=J}setDistortionDirection(J,Q){this.uniforms.u_distortionDirection.value=[J,Q]}set blurRadius(J){this.uniforms.u_blurRadius.value=J}}function MU(J,Q){if(Q===NX)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),J;if(Q===P$||Q===zZ){let $=J.getIndex();if($===null){let H=[],X=J.getAttribute("position");if(X!==void 0){for(let Y=0;Y=2.0 are supported."));return}let Y=new JR(W,{path:Q||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});Y.fileLoader.setRequestHeader(this.requestHeader);for(let U=0;U=0&&H[G]===void 0)console.warn('THREE.GLTFLoader: Unknown extension "'+G+'".')}}Y.setExtensions(K),Y.setPlugins(H),Y.parse($,Z)}parseAsync(J,Q){let $=this;return new Promise(function(Z,W){$.parse(J,Q,Z,W)})}}function GV(){let J={};return{get:function(Q){return J[Q]},add:function(Q,$){J[Q]=$},remove:function(Q){delete J[Q]},removeAll:function(){J={}}}}var Y9={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class TN{constructor(J){this.parser=J,this.name=Y9.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let J=this.parser,Q=this.parser.json.nodes||[];for(let $=0,Z=Q.length;$=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");else return null;return Q.loadTextureImage(J,W.source,K)}}class lN{constructor(J){this.parser=J,this.name=Y9.EXT_TEXTURE_WEBP}loadTexture(J){let Q=this.name,$=this.parser,Z=$.json,W=Z.textures[J];if(!W.extensions||!W.extensions[Q])return null;let K=W.extensions[Q],H=Z.images[K.source],X=$.textureLoader;if(H.uri){let Y=$.options.manager.getHandler(H.uri);if(Y!==null)X=Y}return $.loadTextureImage(J,K.source,X)}}class cN{constructor(J){this.parser=J,this.name=Y9.EXT_TEXTURE_AVIF}loadTexture(J){let Q=this.name,$=this.parser,Z=$.json,W=Z.textures[J];if(!W.extensions||!W.extensions[Q])return null;let K=W.extensions[Q],H=Z.images[K.source],X=$.textureLoader;if(H.uri){let Y=$.options.manager.getHandler(H.uri);if(Y!==null)X=Y}return $.loadTextureImage(J,K.source,X)}}class sN{constructor(J){this.name=Y9.EXT_MESHOPT_COMPRESSION,this.parser=J}loadBufferView(J){let Q=this.parser.json,$=Q.bufferViews[J];if($.extensions&&$.extensions[this.name]){let Z=$.extensions[this.name],W=this.parser.getDependency("buffer",Z.buffer),K=this.parser.options.meshoptDecoder;if(!K||!K.supported)if(Q.extensionsRequired&&Q.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");else return null;return W.then(function(H){let X=Z.byteOffset||0,Y=Z.byteLength||0,U=Z.count,G=Z.byteStride,q=new Uint8Array(H,X,Y);if(K.decodeGltfBufferAsync)return K.decodeGltfBufferAsync(U,G,q,Z.mode,Z.filter).then(function(N){return N.buffer});else return K.ready.then(function(){let N=new ArrayBuffer(U*G);return K.decodeGltfBuffer(new Uint8Array(N),U,G,q,Z.mode,Z.filter),N})})}else return null}}class nN{constructor(J){this.name=Y9.EXT_MESH_GPU_INSTANCING,this.parser=J}createNodeMesh(J){let Q=this.parser.json,$=Q.nodes[J];if(!$.extensions||!$.extensions[this.name]||$.mesh===void 0)return null;let Z=Q.meshes[$.mesh];for(let Y of Z.primitives)if(Y.mode!==_8.TRIANGLES&&Y.mode!==_8.TRIANGLE_STRIP&&Y.mode!==_8.TRIANGLE_FAN&&Y.mode!==void 0)return null;let K=$.extensions[this.name].attributes,H=[],X={};for(let Y in K)H.push(this.parser.getDependency("accessor",K[Y]).then((U)=>{return X[Y]=U,X[Y]}));if(H.length<1)return null;return H.push(this.parser.createNodeMesh(J)),Promise.all(H).then((Y)=>{let U=Y.pop(),G=U.isGroup?U.children:[U],q=Y[0].count,N=[];for(let R of G){let M=new r0,E=new f,F=new iJ,O=new f(1,1,1),k=new PW(R.geometry,R.material,q);for(let D=0;D0||J.search(/^data\:image\/jpeg/)===0)return"image/jpeg";if(J.search(/\.webp($|\?)/i)>0||J.search(/^data\:image\/webp/)===0)return"image/webp";if(J.search(/\.ktx2($|\?)/i)>0||J.search(/^data\:image\/ktx2/)===0)return"image/ktx2";return"image/png"}var LV=new r0;class JR{constructor(J={},Q={}){this.json=J,this.extensions={},this.plugins={},this.options=Q,this.cache=new GV,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let $=!1,Z=-1,W=!1,K=-1;if(typeof navigator!=="undefined"){let H=navigator.userAgent;$=/^((?!chrome|android).)*safari/i.test(H)===!0;let X=H.match(/Version\/(\d+)/);Z=$&&X?parseInt(X[1],10):-1,W=H.indexOf("Firefox")>-1,K=W?H.match(/Firefox\/([0-9]+)\./)[1]:-1}if(typeof createImageBitmap==="undefined"||$&&Z<17||W&&K<98)this.textureLoader=new j$(this.options.manager);else this.textureLoader=new fW(this.options.manager);if(this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new xZ(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials")this.fileLoader.setWithCredentials(!0)}setExtensions(J){this.extensions=J}setPlugins(J){this.plugins=J}parse(J,Q){let $=this,Z=this.json,W=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(K){return K._markDefs&&K._markDefs()}),Promise.all(this._invokeAll(function(K){return K.beforeRoot&&K.beforeRoot()})).then(function(){return Promise.all([$.getDependencies("scene"),$.getDependencies("animation"),$.getDependencies("camera")])}).then(function(K){let H={scene:K[0][Z.scene||0],scenes:K[0],animations:K[1],cameras:K[2],asset:Z.asset,parser:$,userData:{}};return iQ(W,H,Z),K7(H,Z),Promise.all($._invokeAll(function(X){return X.afterRoot&&X.afterRoot(H)})).then(function(){for(let X of H.scenes)X.updateMatrixWorld();J(H)})}).catch(Q)}_markDefs(){let J=this.json.nodes||[],Q=this.json.skins||[],$=this.json.meshes||[];for(let Z=0,W=Q.length;Z{let X=this.associations.get(K);if(X!=null)this.associations.set(H,X);for(let[Y,U]of K.children.entries())W(U,H.children[Y])};return W($,Z),Z.name+="_instance_"+J.uses[Q]++,Z}_invokeOne(J){let Q=Object.values(this.plugins);Q.push(this);for(let $=0;$=2)E.setY(T,A[C*X+1]);if(X>=3)E.setZ(T,A[C*X+2]);if(X>=4)E.setW(T,A[C*X+3]);if(X>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}E.normalized=R}return E})}loadTexture(J){let Q=this.json,$=this.options,W=Q.textures[J].source,K=Q.images[W],H=this.textureLoader;if(K.uri){let X=$.manager.getHandler(K.uri);if(X!==null)H=X}return this.loadTextureImage(J,W,H)}loadTextureImage(J,Q,$){let Z=this,W=this.json,K=W.textures[J],H=W.images[Q],X=(H.uri||H.bufferView)+":"+K.sampler;if(this.textureCache[X])return this.textureCache[X];let Y=this.loadImageSource(Q,$).then(function(U){if(U.flipY=!1,U.name=K.name||H.name||"",U.name===""&&typeof H.uri==="string"&&H.uri.startsWith("data:image/")===!1)U.name=H.uri;let q=(W.samplers||{})[K.sampler]||{};return U.magFilter=AN[q.magFilter]||OJ,U.minFilter=AN[q.minFilter]||M7,U.wrapS=wN[q.wrapS]||z$,U.wrapT=wN[q.wrapT]||z$,U.generateMipmaps=!U.isCompressedTexture&&U.minFilter!==d8&&U.minFilter!==OJ,Z.associations.set(U,{textures:J}),U}).catch(function(){return null});return this.textureCache[X]=Y,Y}loadImageSource(J,Q){let $=this,Z=this.json,W=this.options;if(this.sourceCache[J]!==void 0)return this.sourceCache[J].then((G)=>G.clone());let K=Z.images[J],H=self.URL||self.webkitURL,X=K.uri||"",Y=!1;if(K.bufferView!==void 0)X=$.getDependency("bufferView",K.bufferView).then(function(G){Y=!0;let q=new Blob([G],{type:K.mimeType});return X=H.createObjectURL(q),X});else if(K.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+J+" is missing URI and bufferView");let U=Promise.resolve(X).then(function(G){return new Promise(function(q,N){let R=q;if(Q.isImageBitmapLoader===!0)R=function(M){let E=new o9(M);E.needsUpdate=!0,q(E)};Q.load(i7.resolveURL(G,W.path),R,void 0,N)})}).then(function(G){if(Y===!0)H.revokeObjectURL(X);return K7(G,K),G.userData.mimeType=K.mimeType||MV(K.uri),G}).catch(function(G){throw console.error("THREE.GLTFLoader: Couldn't load texture",X),G});return this.sourceCache[J]=U,U}assignTexture(J,Q,$,Z){let W=this;return this.getDependency("texture",$.index).then(function(K){if(!K)return null;if($.texCoord!==void 0&&$.texCoord>0)K=K.clone(),K.channel=$.texCoord;if(W.extensions[Y9.KHR_TEXTURE_TRANSFORM]){let H=$.extensions!==void 0?$.extensions[Y9.KHR_TEXTURE_TRANSFORM]:void 0;if(H){let X=W.associations.get(K);K=W.extensions[Y9.KHR_TEXTURE_TRANSFORM].extendTexture(K,H),W.associations.set(K,X)}}if(Z!==void 0)K.colorSpace=Z;return J[Q]=K,K})}assignFinalMaterial(J){let{geometry:Q,material:$}=J,Z=Q.attributes.tangent===void 0,W=Q.attributes.color!==void 0,K=Q.attributes.normal===void 0;if(J.isPoints){let H="PointsMaterial:"+$.uuid,X=this.cache.get(H);if(!X)X=new jZ,q8.prototype.copy.call(X,$),X.color.copy($.color),X.map=$.map,X.sizeAttenuation=!1,this.cache.add(H,X);$=X}else if(J.isLine){let H="LineBasicMaterial:"+$.uuid,X=this.cache.get(H);if(!X)X=new TZ,q8.prototype.copy.call(X,$),X.color.copy($.color),X.map=$.map,this.cache.add(H,X);$=X}if(Z||W||K){let H="ClonedMaterial:"+$.uuid+":";if(Z)H+="derivative-tangents:";if(W)H+="vertex-colors:";if(K)H+="flat-shading:";let X=this.cache.get(H);if(!X){if(X=$.clone(),W)X.vertexColors=!0;if(K)X.flatShading=!0;if(Z){if(X.normalScale)X.normalScale.y*=-1;if(X.clearcoatNormalScale)X.clearcoatNormalScale.y*=-1}this.cache.add(H,X),this.associations.set(X,this.associations.get($))}$=X}J.material=$}getMaterialType(){return T$}loadMaterial(J){let Q=this,$=this.json,Z=this.extensions,W=$.materials[J],K,H={},X=W.extensions||{},Y=[];if(X[Y9.KHR_MATERIALS_UNLIT]){let G=Z[Y9.KHR_MATERIALS_UNLIT];K=G.getMaterialType(),Y.push(G.extendParams(H,W,Q))}else{let G=W.pbrMetallicRoughness||{};if(H.color=new l0(1,1,1),H.opacity=1,Array.isArray(G.baseColorFactor)){let q=G.baseColorFactor;H.color.setRGB(q[0],q[1],q[2],hJ),H.opacity=q[3]}if(G.baseColorTexture!==void 0)Y.push(Q.assignTexture(H,"map",G.baseColorTexture,l7));if(H.metalness=G.metallicFactor!==void 0?G.metallicFactor:1,H.roughness=G.roughnessFactor!==void 0?G.roughnessFactor:1,G.metallicRoughnessTexture!==void 0)Y.push(Q.assignTexture(H,"metalnessMap",G.metallicRoughnessTexture)),Y.push(Q.assignTexture(H,"roughnessMap",G.metallicRoughnessTexture));K=this._invokeOne(function(q){return q.getMaterialType&&q.getMaterialType(J)}),Y.push(Promise.all(this._invokeAll(function(q){return q.extendMaterialParams&&q.extendMaterialParams(J,H)})))}if(W.doubleSided===!0)H.side=oJ;let U=W.alphaMode||BU.OPAQUE;if(U===BU.BLEND)H.transparent=!0,H.depthWrite=!1;else if(H.transparent=!1,U===BU.MASK)H.alphaTest=W.alphaCutoff!==void 0?W.alphaCutoff:0.5;if(W.normalTexture!==void 0&&K!==a8){if(Y.push(Q.assignTexture(H,"normalMap",W.normalTexture)),H.normalScale=new g0(1,1),W.normalTexture.scale!==void 0){let G=W.normalTexture.scale;H.normalScale.set(G,G)}}if(W.occlusionTexture!==void 0&&K!==a8){if(Y.push(Q.assignTexture(H,"aoMap",W.occlusionTexture)),W.occlusionTexture.strength!==void 0)H.aoMapIntensity=W.occlusionTexture.strength}if(W.emissiveFactor!==void 0&&K!==a8){let G=W.emissiveFactor;H.emissive=new l0().setRGB(G[0],G[1],G[2],hJ)}if(W.emissiveTexture!==void 0&&K!==a8)Y.push(Q.assignTexture(H,"emissiveMap",W.emissiveTexture,l7));return Promise.all(Y).then(function(){let G=new K(H);if(W.name)G.name=W.name;if(K7(G,W),Q.associations.set(G,{materials:J}),W.extensions)iQ(Z,G,W);return G})}createUniqueName(J){let Q=M9.sanitizeNodeName(J||"");if(Q in this.nodeNamesUsed)return Q+"_"+ ++this.nodeNamesUsed[Q];else return this.nodeNamesUsed[Q]=0,Q}loadGeometries(J){let Q=this,$=this.extensions,Z=this.primitiveCache;function W(H){return $[Y9.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(H,Q).then(function(X){return SN(X,H,Q)})}let K=[];for(let H=0,X=J.length;H0)EV(F,W);if(F.name=Q.createUniqueName(W.name||"mesh_"+J),K7(F,W),E.extensions)iQ(Z,F,E);Q.assignFinalMaterial(F),G.push(F)}for(let N=0,R=G.length;N1)U=new n8;else if(Y.length===1)U=Y[0];else U=new h9;if(U!==Y[0])for(let G=0,q=Y.length;G1){let G=Z.associations.get(U);Z.associations.set(U,{...G})}return Z.associations.get(U).nodes=J,U}),this.nodeCache[J]}loadScene(J){let Q=this.extensions,$=this.json.scenes[J],Z=this,W=new n8;if($.name)W.name=Z.createUniqueName($.name);if(K7(W,$),$.extensions)iQ(Q,W,$);let K=$.nodes||[],H=[];for(let X=0,Y=K.length;X{let G=new Map;for(let[q,N]of Z.associations)if(q instanceof q8||q instanceof o9)G.set(q,N);return U.traverse((q)=>{let N=Z.associations.get(q);if(N!=null)G.set(q,N)}),G};return Z.associations=Y(W),W})}_createAnimationTracks(J,Q,$,Z,W){let K=[],H=J.name?J.name:J.uuid,X=[];if(YQ[W.path]===YQ.weights)J.traverse(function(q){if(q.morphTargetInfluences)X.push(q.name?q.name:q.uuid)});else X.push(H);let Y;switch(YQ[W.path]){case YQ.weights:Y=E7;break;case YQ.rotation:Y=D7;break;case YQ.translation:case YQ.scale:Y=O7;break;default:switch($.itemSize){case 1:Y=E7;break;case 2:case 3:default:Y=O7;break}break}let U=Z.interpolation!==void 0?NV[Z.interpolation]:RW,G=this._getArrayFromAccessor($);for(let q=0,N=X.length;q{return new Promise(($,Z)=>{DV.load(J,(W)=>{let K={model:W.scene};$(K)})})};var zV=new j$;function IU(J){return new Promise((Q)=>{zV.load(J,($)=>{$.needsUpdate=!0,$.source.w=$.source.data.width,$.source.h=$.source.data.height,$.source.r=$.source.data.width/$.source.data.height,Q($)})})}var $R={first:"https://decagon-alpha.vercel.app/public/2_img.png",first_depth:"https://decagon-alpha.vercel.app/public/2_depth.png",second:"https://decagon-alpha.vercel.app/public/2_img.png",second_depth:"https://decagon-alpha.vercel.app/public/2_depth.png",fg:"https://decagon-alpha.vercel.app/public/fg.png",bg:"https://decagon-alpha.vercel.app/public/bg.png",mg:"https://decagon-alpha.vercel.app/public/mg.png"},ZR={depth:"https://cdn.prod.website-files.com/683e5da0b6d8a19de4875ae7/69788c36d479d8e7dc169cf5_depth.webp",bg:"https://cdn.prod.website-files.com/683e5da0b6d8a19de4875ae7/69788c6adc1f9f3f235f69a9_main.webp",house:"https://cdn.prod.website-files.com/683e5da0b6d8a19de4875ae7/69788c37f84e8b3692571442_house.webp",moon:"https://cdn.prod.website-files.com/683e5da0b6d8a19de4875ae7/69788c3647f317f51de33be2_moon.webp",car:"https://cdn.prod.website-files.com/683e5da0b6d8a19de4875ae7/69788cda2e5d73587aca2b7a_car.webp",ppls:"https://cdn.prod.website-files.com/683e5da0b6d8a19de4875ae7/69788c3680ca4bd4ee6b7ce1_ppls.webp"};async function WR(J=null){let Q=J||$R,$=[],Z=[];for(let H in Q){let X=Q[H],Y=X.split(".").pop();if(Y==="glb"||Y==="gltf")$.push(QR(X));else if(Y==="jpg"||Y==="png"||Y==="webp"||Y==="jpeg")$.push(IU(X));Z.push(H)}let W=await Promise.all($);return Z.reduce((H,X,Y)=>{return H[X]=W[Y],H},{})}var PR=KF(IR());var PV=0.0002,AV=0.0008,wV=0.1,bU=1,AR=1,vK=0;function wR({scrollSpeed:J,scrollEase:Q}={}){if(typeof J==="number"&&J>0)bU=J;if(typeof Q==="number"&&Q>0)AR=Q}class SR extends CW{isOn=!0;scrollT=0;currentScrollT=0;lerpFactor=wV;moonBaseYOffsetFactor=-0.1;moonOscillationAmplitude=0.01;moonOscillationSpeed=0.0001;#J;#$;#Z;#Q;#W=null;constructor(J){super();this.create()}async create(){this.assets=await WR(ZR),console.log(this.assets);let{container:J}=k9.vp||{};if(J)k9.resize({width:J.clientWidth,height:J.clientHeight});k9.post?.startInitialTransition?.();let Q=this.assets.depth;this.quadFg=new oQ(this.assets.bg,Q,0.1),this.quadHouse=new oQ(this.assets.house,Q,0.2),this.quadMoon=new oQ(this.assets.moon,Q,0.15),this.quadCar=new oQ(this.assets.car,Q,0.4),this.quadPpls=new oQ(this.assets.ppls,Q,0.5),this.quadMoon.setMouseYStrength(5.5),this.quadMoon.setMouseXStrength(3.5),this.quadHouse.setDistortionStrength(0.5),this.quadCar.setDistortionStrength(0.5),this.quadPpls.setDistortionStrength(0.25),this.quadFg.setScrollParallaxScale(1),this.quadHouse.setScrollParallaxScale(1.15),this.quadMoon.setScrollParallaxScale(0),this.quadCar.setScrollParallaxScale(1.35),this.quadPpls.setScrollParallaxScale(1.35),this.quadFg.setAlignParallaxScale(1),this.quadHouse.setAlignParallaxScale(1.08),this.quadMoon.setAlignParallaxScale(1),this.quadMoon.setScrollYOffsetFactor(0.2),this.quadMoon.setBaseYOffsetFactor(this.moonBaseYOffsetFactor),this.quadMoon.setBaseXOffsetFactor(0.12),this.quadCar.setAlignParallaxScale(1.2),this.quadPpls.setAlignParallaxScale(1.2),this.quadFg.alignLerp(this.currentScrollT),this.quadHouse.alignLerp(this.currentScrollT),this.quadMoon.alignLerp(this.currentScrollT*0.06),this.quadCar.alignLerp(this.currentScrollT),this.quadPpls.alignLerp(this.currentScrollT),this.#J=(Z)=>{if(e9())return;let W=document.querySelector("[wrapped-header]")||k9.vp.container?.parentElement;if(!W)return;let K=W.contains(Z.target)||W===Z.target,X=(window.scrollY||document.documentElement.scrollTop||0)<=1;if(K&&X){let U=PR.default(Z).pixelY*PV*bU,G=U<0&&this.scrollT<=0,q=U>0&&this.scrollT>=1;if(G||q)return;Z.preventDefault(),Z.stopPropagation(),this.scrollT=Math.min(1,Math.max(0,this.scrollT+U))}};let $=(Z,W)=>W.contains(Z.target)||W===Z.target;if(this.#$=(Z)=>{if(e9())return;let W=document.querySelector("[wrapped-header]")||k9.vp.container?.parentElement;if(!W)return;if(!$(Z,W))return;let K=Z.touches[0];if(!K)return;this.#W=K.clientY},this.#Z=(Z)=>{if(e9())return;let W=document.querySelector("[wrapped-header]")||k9.vp.container?.parentElement;if(!W)return;if(!$(Z,W))return;if(!((window.scrollY||document.documentElement.scrollTop||0)<=1))return;let X=Z.touches[0];if(!X||this.#W===null)return;let U=(this.#W-X.clientY)*AV*bU,G=U<0&&this.scrollT<=0,q=U>0&&this.scrollT>=1;if(G||q){this.#W=X.clientY;return}Z.preventDefault(),Z.stopPropagation(),this.scrollT=Math.min(1,Math.max(0,this.scrollT+U)),this.#W=X.clientY},this.#Q=()=>{this.#W=null},!e9())document.addEventListener("wheel",this.#J,{passive:!1,capture:!0}),document.addEventListener("touchstart",this.#$,{passive:!1,capture:!0}),document.addEventListener("touchmove",this.#Z,{passive:!1,capture:!0}),document.addEventListener("touchend",this.#Q,{passive:!0,capture:!0}),document.addEventListener("touchcancel",this.#Q,{passive:!0,capture:!0})}render(J){this.currentScrollT+=(this.scrollT-this.currentScrollT)*(this.lerpFactor*AR),vK=this.currentScrollT;let Q=Math.sin((J||0)*this.moonOscillationSpeed)*this.moonOscillationAmplitude;this.quadMoon?.setBaseYOffsetFactor(this.moonBaseYOffsetFactor+Q),this.quadFg?.alignLerp(this.currentScrollT),this.quadHouse?.alignLerp(this.currentScrollT),this.quadMoon?.alignLerp(this.currentScrollT*0.06),this.quadCar?.alignLerp(this.currentScrollT),this.quadPpls?.alignLerp(this.currentScrollT),this.quadFg?.setScrollT(this.currentScrollT),this.quadHouse?.setScrollT(this.currentScrollT),this.quadMoon?.setScrollT(this.currentScrollT),this.quadCar?.setScrollT(this.currentScrollT),this.quadPpls?.setScrollT(this.currentScrollT),this.quadFg?.render(J),this.quadHouse?.render(J),this.quadMoon?.render(J),this.quadCar?.render(J),this.quadPpls?.render(J)}resize(J){}}var TR={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); }`,fragmentShader:` uniform float opacity; uniform sampler2D tDiffuse; varying vec2 vUv; void main() { vec4 texel = texture2D( tDiffuse, vUv ); gl_FragColor = opacity * texel; }`};class UQ{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}var SV=new V7(-1,1,1,-1,0,1);class jR extends MJ{constructor(){super();this.setAttribute("position",new EJ([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new EJ([0,2,0,0,2,0],2))}}var TV=new jR;class yU{constructor(J){this._mesh=new i9(TV,J)}dispose(){this._mesh.geometry.dispose()}render(J){J.render(this._mesh,SV)}get material(){return this._mesh.material}set material(J){this._mesh.material=J}}class V6 extends UQ{constructor(J,Q="tDiffuse"){super();if(this.textureID=Q,this.uniforms=null,this.material=null,J instanceof fJ)this.uniforms=J.uniforms,this.material=J;else if(J)this.uniforms=DW.clone(J.uniforms),this.material=new fJ({name:J.name!==void 0?J.name:"unspecified",defines:Object.assign({},J.defines),uniforms:this.uniforms,vertexShader:J.vertexShader,fragmentShader:J.fragmentShader});this._fsQuad=new yU(this.material)}render(J,Q,$){if(this.uniforms[this.textureID])this.uniforms[this.textureID].value=$.texture;if(this._fsQuad.material=this.material,this.renderToScreen)J.setRenderTarget(null),this._fsQuad.render(J);else{if(J.setRenderTarget(Q),this.clear)J.clear(J.autoClearColor,J.autoClearDepth,J.autoClearStencil);this._fsQuad.render(J)}}dispose(){this.material.dispose(),this._fsQuad.dispose()}}class gK extends UQ{constructor(J,Q){super();this.scene=J,this.camera=Q,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(J,Q,$){let Z=J.getContext(),W=J.state;W.buffers.color.setMask(!1),W.buffers.depth.setMask(!1),W.buffers.color.setLocked(!0),W.buffers.depth.setLocked(!0);let K,H;if(this.inverse)K=0,H=1;else K=1,H=0;if(W.buffers.stencil.setTest(!0),W.buffers.stencil.setOp(Z.REPLACE,Z.REPLACE,Z.REPLACE),W.buffers.stencil.setFunc(Z.ALWAYS,K,4294967295),W.buffers.stencil.setClear(H),W.buffers.stencil.setLocked(!0),J.setRenderTarget($),this.clear)J.clear();if(J.render(this.scene,this.camera),J.setRenderTarget(Q),this.clear)J.clear();J.render(this.scene,this.camera),W.buffers.color.setLocked(!1),W.buffers.depth.setLocked(!1),W.buffers.color.setMask(!0),W.buffers.depth.setMask(!0),W.buffers.stencil.setLocked(!1),W.buffers.stencil.setFunc(Z.EQUAL,1,4294967295),W.buffers.stencil.setOp(Z.KEEP,Z.KEEP,Z.KEEP),W.buffers.stencil.setLocked(!0)}}class hU extends UQ{constructor(){super();this.needsSwap=!1}render(J){J.state.buffers.stencil.setLocked(!1),J.state.buffers.stencil.setTest(!1)}}class fU{constructor(J,Q){if(this.renderer=J,this._pixelRatio=J.getPixelRatio(),Q===void 0){let $=J.getSize(new g0);this._width=$.width,this._height=$.height,Q=new aJ(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:l8}),Q.texture.name="EffectComposer.rt1"}else this._width=Q.width,this._height=Q.height;this.renderTarget1=Q,this.renderTarget2=Q.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new V6(TR),this.copyPass.material.blending=p8,this.clock=new vW}swapBuffers(){let J=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=J}addPass(J){this.passes.push(J),J.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(J,Q){this.passes.splice(Q,0,J),J.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(J){let Q=this.passes.indexOf(J);if(Q!==-1)this.passes.splice(Q,1)}isLastEnabledPass(J){for(let Q=J+1;Q{this.render()});constructor(){if(!this.wasMobile)this.initializeWebGL();this.resizeUnsubscribe=xJ.add(()=>{this.handleResizeTransition()})}initializeWebGL(){if(this.renderer)return;this.renderer=new cX({});let J=document.querySelector('[data-gl="c"]');if(!J)return;this.vp={container:J,w:window.innerWidth,h:window.innerHeight,aspect:()=>{return this.vp.w/this.vp.h},dpr:()=>{return Math.min(window.devicePixelRatio,2)}},this.renderer.setPixelRatio(this.vp.dpr()),this.renderer.setSize(this.vp.w,this.vp.h),this.renderer.setClearColor(bV.clearColor,1),this.vp.container.appendChild(this.renderer.domElement),this.camera=new ZJ(70,this.vp.aspect(),0.1,1000),this.vp.camera=this.camera,this.vp.renderer=this.renderer,this.camera.position.set(0,0,2),this.controls=new oX(this.camera,this.renderer.domElement),this.controls.enabled=!1;let Q=this.resize.bind(this);this.resizeObserver=new ResizeObserver(($)=>Q($[0].contentRect)),this.resizeObserver.observe(this.vp.container),this.setupMouseTracking(),this.init()}destroyWebGL(){if(this.paused=!0,this.resizeObserver&&this.vp?.container)this.resizeObserver.unobserve(this.vp.container),this.resizeObserver.disconnect(),this.resizeObserver=null;if(this.mouseMoveHandler)document.removeEventListener("mousemove",this.mouseMoveHandler),this.mouseMoveHandler=null;if(this.scene)this.scene=null;if(this.post)this.post=null;if(this.renderer){if(this.renderer.domElement&&this.renderer.domElement.parentNode)this.renderer.domElement.parentNode.removeChild(this.renderer.domElement);this.renderer.dispose(),this.renderer=null}if(this.controls)this.controls.dispose(),this.controls=null;this.vp=null,this.camera=null,this.sceneKey=null}handleResizeTransition(){let J=e9();if(this.wasMobile&&!J)this.wasMobile=!1,this.initializeWebGL();else if(!this.wasMobile&&J)this.wasMobile=!0,this.destroyWebGL()}setupMouseTracking(){if(e9())return;this.mouseMoveHandler=(J)=>{if(!this.vp)return;this.mouse.x=J.clientX,this.mouse.y=J.clientY,this.mouse.normalized.x=J.clientX/this.vp.w*2-1,this.mouse.normalized.y=-(J.clientY/this.vp.h)*2+1},document.addEventListener("mousemove",this.mouseMoveHandler)}async init(){if(e9())return;queueMicrotask(()=>{this.setSceneForPathname(window.location.pathname),this.post=new pU,this.paused=!1})}render(){if(this.paused||!this.renderer||e9())return;this.time+=0.05,this.controls?.update(),this.ensureSceneForPathname(window.location.pathname),this.scene?.render(this.time),this.post?.renderPost()}resize({width:J,height:Q}){if(e9()||!this.renderer||!this.vp||!this.camera)return;this.vp.w=J,this.vp.h=Q,this.vp.vs=this.viewSize,this.vp.px=this.pixel,this.renderer.setSize(this.vp.w,this.vp.h),this.camera.aspect=this.vp.w/this.vp.h,this.camera.updateProjectionMatrix(),this.scene?.resize(this.vp),console.log(this.vp.vs,this.vp.px)}getSceneKey(J){return"home-v2"}setScene(J){if(this.scene=J,this.post?.renderPass)this.post.renderPass.scene=J}setSceneForPathname(J){if(e9()||!this.vp)return;let Q=this.getSceneKey(J);this.sceneKey=Q;let $=new SR(this.vp);this.setScene($)}ensureSceneForPathname(J){if(this.getSceneKey(J)!==this.sceneKey)this.setSceneForPathname(J)}get viewSize(){if(!this.camera||!this.vp)return{w:0,h:0};let J=this.camera.fov*Math.PI/180,Q=Math.abs(this.camera.position.z*Math.tan(J/2)*2);return{w:Q*(this.vp.w/this.vp.h),h:Q}}get pixel(){if(!this.vp||!this.vp.vs)return 1;return this.vp.vs.w/this.vp.w}}var k9=new bR;var yV=[],mU=[];function pK(J){mU.push(J)}function k6(J){yV.push(J)}function hR(){mU.forEach((J)=>J()),mU.length=0}var yR=[],dU=[];function fR(J,{element:Q}={}){if(Q)yR.push(async()=>{let $=Q.getBoundingClientRect();return $.top0?await J():Promise.resolve()});else yR.push(J)}function vR(J){dU.push(J)}async function gR(){await Promise.allSettled(dU.map((J)=>J())),dU.length=0}function C6(J,{root:Q,rootMargin:$,threshold:Z,autoStart:W,once:K,callback:H}){let X=new I6(J,{root:Q,rootMargin:$,threshold:Z,autoStart:W,once:K,callback:H});return k6(()=>{X.destroy()}),X}var uU={};x7(uU,{default:()=>dR});class mR{events;constructor(){this.events={}}on(J,Q){if(!this.events[J])this.events[J]=[];this.events[J].push(Q)}once(J,Q){let $=(Z)=>{Q(Z),this.off(J,$)};this.on(J,$)}off(J,Q){if(!this.events[J])return;this.events[J]=this.events[J].filter(($)=>$!==Q)}emit(J,Q){if(!this.events[J])return;this.events[J].forEach(($)=>$(Q))}}class H7{static emitter=new mR;static state={};static createProxy(J){return new Proxy(J,{set:function(Q,$,Z,W){return H7.emitter.emit($.toString(),Z),Reflect.set(Q,$,Z,W)}})}static proxy=new Proxy(H7.state,{set:function(J,Q,$,Z){if(typeof $==="object"&&$!==null)$=H7.createProxy($);return H7.emitter.emit(Q.toString(),$),Reflect.set(J,Q,$,Z)}});static on(J,Q){this.emitter.on(J,Q)}static once(J,Q){this.emitter.once(J,Q)}static off(J,Q){this.emitter.off(J,Q)}}var hV={get(J,Q){if(typeof Q==="string"&&Q in H7)return H7[Q].bind(H7);return J[Q]},set(J,Q,$,Z){return Reflect.set(H7.proxy,Q,$,Z)}},mK=new Proxy(H7.proxy,hV);function dR(J,Q){if(mK.on("SOMETHING",($)=>{console.log("something",$)}),e9())return;vR(async()=>{await FJ.to(J,{duration:0.2,backgroundColor:"green"})}),fR(async()=>{await FJ.to(J,{duration:1,backgroundColor:"blue"}),await FJ.to(J,{duration:1,autoAlpha:0})},{element:J}),pK(()=>{}),k6(()=>{})}var lU={};x7(lU,{default:()=>lR});function uR(){let J=window.Webflow||[];if(J.length>0)J.forEach((Q)=>{Q.destroy(),Q.ready()});console.log(J)}function lR(J,Q){console.log("form",J),pK(()=>{setTimeout(()=>{uR()},500)})}var cU={};x7(cU,{default:()=>sR});var fV=1,cR="linear",vV=(J,Q,$,Z)=>{if(e9())return;let H=Z.offsetWidth;Q.to(J,{scale:1,duration:0.3333333333333333,ease:"back.out"}),Q.to(J,{x:-H,duration:1,ease:cR}),Q.to(J,{scale:0,duration:0.5,ease:"back.in"}),Q.to(J,{duration:0.25,ease:cR})};function sR(J,Q){console.log("hero-content",J,Q);let $=null,Z=null,W=null,K=null,H=null,X=[],Y=null,U=()=>{if($?.kill(),$=null,Z?.kill(),Z=null,W?.(),W=null,K?.destroy(),K=null,X.length>0)FJ.set(X,{clearProps:"all"})},G=()=>{let q=J.children[0],N=q?Array.from(q.children):[];if(!q||N.length===0){console.warn("hero-content: wrapper or notifications not found");return}let R=q.offsetWidth;if(Y!==null&&Y===R)return;if(Y=R,X=N,U(),e9()){FJ.set(N,{visibility:"visible",scale:0}),$=FJ.timeline({repeat:-1});let M=3;N.forEach((E,F)=>{$.to(E,{scale:1,duration:0.3,ease:"back.out"}),$.to(E,{duration:M-0.6}),$.to(E,{scale:0,duration:0.3,ease:"back.in"})}),K=C6(J,{autoStart:!0,callback:({isIn:E})=>{if(E)$?.play();else $?.pause()}})}else FJ.set(N,{visibility:"visible",opacity:1,x:0,clearProps:"xPercent"}),console.log(vK),Z=FJ.timeline({paused:!0}),N.forEach((M,E)=>{vV(M,Z,E,q)}),K=C6(J,{autoStart:!0,callback:({isIn:M})=>{if(M)console.log("in view"),W=D6.add(({time:E})=>{Z.progress(vK*fV)});else W?.(),W=null}})};G(),H=xJ.add(()=>{G()}),k6(()=>{H?.(),U()})}var sU={};x7(sU,{default:()=>nR});function nR(J,Q){mK.on("PAGE",($)=>{console.log("page changed")})}var nU={};x7(nU,{default:()=>oR});function gV(J){J.setAttribute("aria-hidden","true"),J.style.position="absolute",J.style.left="-9999px",J.style.top="-9999px",J.style.width="1px"}var pV=(J)=>{let Q=J.textContent;J.textContent="";let $=document.createElement("span");$.textContent=Q,J.appendChild($),gV($);let Z=document.createElement("span");return Z.setAttribute("data-css","overflow-clip"),Z.textContent=Q,Z.setAttribute("aria-hidden","true"),J.appendChild(Z),new xK(Z,{type:"chars"})};function oR(J){if(e9())return;let Q=pV(J);C6(J,{autoStart:!0,callback:({isIn:$})=>{if($)FJ.to(Q.chars,{yPercent:0,stagger:0.02});else FJ.killTweensOf(Q.chars),FJ.set(Q.chars,{yPercent:100})}})}var oU={};x7(oU,{default:()=>iR});function iR(J,Q){}var iU={};x7(iU,{default:()=>aR});function aR(J,Q){console.log("WebGL",J,Q);let{scrollSpeed:$,scrollEase:Z}=Q,W=$?parseFloat($):void 0,K=Z?parseFloat(Z):void 0;if(typeof W==="number"&&!Number.isNaN(W)||typeof K==="number"&&!Number.isNaN(K))wR({scrollSpeed:!Number.isNaN(W)?W:void 0,scrollEase:!Number.isNaN(K)?K:void 0})}var aU={"./../cycle.ts":uU,"./../form.ts":lU,"./../hero-content.ts":cU,"./../nav.ts":sU,"./../split.ts":nU,"./../test.ts":oU,"./../webgl.ts":iU};function rR(J="module"){return Array.from(document.querySelectorAll(`[data-${J}]`)).map((Q)=>{let $=Q,Z=$.dataset[J];if($._moduleInitialized)return null;let W=aU[`./../${Z}.ts`]?`./../${Z}.ts`:`./../${Z}.js`;if(aU[W]){let K=aU[W].default;if(typeof K==="function")try{return $._moduleInitialized=!0,K($,$.dataset)}catch(H){return delete $._moduleInitialized,console.warn(`Failed to call default function for ${J} "${Z}":`,H),null}else return console.warn(`Default export is not a function for ${J} "${Z}"`),null}else return console.warn(`${J} not found: "${Z}"`),null}).filter((Q)=>Q!==null)}class rQ{static instance;groups=[];constructor(){}static getInstance(){if(!rQ.instance)rQ.instance=new rQ;return rQ.instance}configsMatch(J,Q){return J.root===Q.root&&J.rootMargin===Q.rootMargin}handleIntersection(J){J.forEach((Q)=>{let $=this.groups.find((U)=>{return Array.from(U.elements.keys()).includes(Q.target)});if(!$)return;let Z=Q.target,W=$.elements.get(Z);if(!W)return;let{isIntersecting:K,intersectionRatio:H,boundingClientRect:X}=Q,Y=-1;if(W.lastDirection!==void 0)Y=K?X.top>0?1:-1:X.top>0?-1:1;if(W.lastDirection=Y,K){if(W.callbacks.isIn?.({entry:Q,direction:Y}),W.callbacks.callback?.({entry:Q,direction:Y,isIn:!0}),W.once)this.removeElement(Z)}else W.callbacks.isOut?.({entry:Q,direction:Y}),W.callbacks.callback?.({entry:Q,direction:Y,isIn:!1})})}addElement(J,Q,$){this.removeElement(J);let Z=this.groups.find((W)=>this.configsMatch(W.config,Q));if(!Z){let W=new IntersectionObserver((K)=>this.handleIntersection(K),{...Q,threshold:[0]});Z={config:Q,observer:W,elements:new Map},this.groups.push(Z)}return Z.elements.set(J,{callbacks:$,once:Q.once||!1,lastDirection:void 0}),Z.observer.observe(J),Z}removeElement(J){let Q=this.groups.find(($)=>$.elements.has(J));if(!Q)return;if(Q.observer.unobserve(J),Q.elements.delete(J),Q.elements.size===0)Q.observer.disconnect(),this.groups=this.groups.filter(($)=>$!==Q)}}class I6{element;#J;#$;isIn(J){}isOut(J){}inView;callback;#Z=null;#Q=null;constructor(J,Q={root:null,rootMargin:"0px",threshold:0,autoStart:!1,once:!1,callback:void 0}){if(this.element=J,this.#J=Q,this.inView=!1,this.callback=Q.callback||(()=>{}),Q.autoStart)this.start()}start(){this.#$=rQ.getInstance().addElement(this.element,this.#J,{isIn:(J)=>{this.inView=!0,this.isIn?.(J)},isOut:(J)=>{this.inView=!1,this.isOut?.(J)},callback:this.callback})}stop(){rQ.getInstance().removeElement(this.element)}destroy(){this.stop(),this.#Z=null,this.#Q=null}}var tR=(J)=>{let Q=J.getBoundingClientRect();return{top:Q.top+Scroll.scroll,bottom:Q.bottom+Scroll.scroll,width:Q.width,height:Q.height,left:Q.left,right:Q.right,wh:xJ.height,ww:xJ.width,offset:Q.top+Scroll.scroll,centery:xJ.height/2-Q.height/2-Q.top-Scroll.scroll,centerx:-xJ.width/2+Q.left+Q.width/2}};function eR(J,Q,$,Z,W){return Z+(W-Z)*(J-Q)/($-Q)}function JF(J,Q,$){return Math.min(Math.max($,J),Q)}var mV={bounds:[0,1],top:"bottom",bottom:"top",callback:void 0};class pR extends I6{value=0;init=!1;isIn(J){this.#Q()}isOut(J){}bounds;config;resize;handleScroll;#J;#$;constructor(J,Q={}){super(J,{autoStart:!0,once:!1,threshold:0});this.element=J,this.config={...mV,...Q},this.#Z(),this.#J=Scroll.add(this.#Q.bind(this)),this.#$=xJ.add(this.#Z.bind(this)),this.init=!0,this.#Q()}#Z=()=>{this.bounds=dV(this.element,this.config),this.resize?.(this.bounds),this.#Q()};#Q(){if(!this.inView||!this.init)return;this.value=JF(0,1,eR(Scroll.scroll,this.bounds.top,this.bounds.bottom,this.config.bounds[0],this.config.bounds[1])),this.handleScroll?.(this.value),this.config.callback?.(this.value)}destroy(){this.config.callback=void 0,this.#J(),this.#$(),super.destroy()}}function dV(J,Q){let $=tR(J),{top:Z,bottom:W,wh:K}=$,H=K/2;return $.top=Z-(Q.top==="center"?H:Q.top==="bottom"?K:0),$.bottom=W-(Q.bottom==="center"?H:Q.bottom==="bottom"?K:0),$}class QF{gl=k9;constructor(){console.log("App",performance.now().toFixed(2)),rR(),gR(),hR()}}var uV=new QF;})(); //# debugId=A19BD1AC71EE854264756E2164756E21