(()=>{var KE=Object.create;var{getPrototypeOf:HE,defineProperty:KZ,getOwnPropertyNames:eU,getOwnPropertyDescriptor:XE}=Object,J1=Object.prototype.hasOwnProperty;var YE=(J,Q,$)=>{$=J!=null?KE(HE(J)):{};let Z=Q||!J||!J.__esModule?KZ($,"default",{value:J,enumerable:!0}):$;for(let W of eU(J))if(!J1.call(Z,W))KZ(Z,W,{get:()=>J[W],enumerable:!0});return Z},tU=new WeakMap,UE=(J)=>{var Q=tU.get(J),$;if(Q)return Q;if(Q=KZ({},"__esModule",{value:!0}),J&&typeof J==="object"||typeof J==="function")eU(J).map((Z)=>!J1.call(Q,Z)&&KZ(Q,Z,{get:()=>J[Z],enumerable:!($=XE(J,Z))||$.enumerable}));return tU.set(J,Q),Q},HZ=(J,Q)=>()=>(Q||J((Q={exports:{}}).exports,Q),Q.exports);var x7=(J,Q)=>{for(var $ in Q)KZ(J,$,{get:Q[$],enumerable:!0,configurable:!0,set:(Z)=>Q[$]=()=>Z})};var ER=HZ((N2,RR)=>{var YR=!1,aQ,PU,AU,hK,fK,UR,vK,wU,SU,TU,GR,jU,_U,qR,NR;function W8(){if(YR)return;YR=!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),qR=/FBAN\/\w+;/i.exec(J),NR=/Mobile/i.exec(J),GR=!!/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(UR=Z?parseFloat(Z[1])+4:aQ,PU=Q[2]?parseFloat(Q[2]):NaN,AU=Q[3]?parseFloat(Q[3]):NaN,hK=Q[4]?parseFloat(Q[4]):NaN,hK)Q=/(?:Chrome\/(\d+\.\d+))/.exec(J),fK=Q&&Q[1]?parseFloat(Q[1]):NaN;else fK=NaN}else aQ=PU=AU=fK=hK=NaN;if($){if($[1]){var W=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(J);vK=W?parseFloat(W[1].replace("_",".")):!0}else vK=!1;wU=!!$[2],SU=!!$[3]}else vK=wU=SU=!1}var xU={ie:function(){return W8()||aQ},ieCompatibilityMode:function(){return W8()||UR>aQ},ie64:function(){return xU.ie()&&GR},firefox:function(){return W8()||PU},opera:function(){return W8()||AU},webkit:function(){return W8()||hK},safari:function(){return xU.webkit()},chrome:function(){return W8()||fK},windows:function(){return W8()||wU},osx:function(){return W8()||vK},linux:function(){return W8()||SU},iphone:function(){return W8()||jU},mobile:function(){return W8()||(jU||_U||TU||NR)},nativeApp:function(){return W8()||qR},android:function(){return W8()||TU},ipad:function(){return W8()||_U}};RR.exports=xU});var OR=HZ((R2,FR)=>{var gK=!!(typeof window!=="undefined"&&window.document&&window.document.createElement),xV={canUseDOM:gK,canUseWorkers:typeof Worker!=="undefined",canUseEventListeners:gK&&!!(window.addEventListener||window.attachEvent),canUseViewport:gK&&!!window.screen,isInWorker:!gK};FR.exports=xV});var DR=HZ((E2,BR)=>{var MR=OR(),LR;if(MR.canUseDOM)LR=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0;function bV(J,Q){if(!MR.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&&LR&&J==="wheel")Z=document.implementation.hasFeature("Events.wheel","3.0");return Z}BR.exports=bV});var PR=HZ((F2,IR)=>{var yV=ER(),hV=DR(),zR=10,VR=40,kR=800;function CR(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*zR,W=$*zR,"deltaY"in J)W=J.deltaY;if("deltaX"in J)Z=J.deltaX;if((Z||W)&&J.deltaMode)if(J.deltaMode==1)Z*=VR,W*=VR;else Z*=kR,W*=kR;if(Z&&!Q)Q=Z<1?-1:1;if(W&&!$)$=W<1?-1:1;return{spinX:Q,spinY:$,pixelX:Z,pixelY:W}}CR.getEventType=function(){return yV.firefox()?"DOMMouseScroll":hV("wheel")?"wheel":"mousewheel"};IR.exports=CR});var wR=HZ((O2,AR)=>{AR.exports=PR()});var $k={};x7($k,{App:()=>Qk});var h1="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},f1=0,MH=1,v1=2;var MZ=1,g1=2,L$=3,d7=0,U8=1,oJ=2,p8=0,LZ=1,LH=2,BH=3,DH=4,p1=5,B$=100,m1=101,d1=102,u1=103,l1=104,c1=200,s1=201,n1=202,o1=203,i1=204,a1=205,r1=206,t1=207,e1=208,JG=209,QG=210,$G=211,ZG=212,WG=213,KG=214,QW=0,$W=1,ZW=2,BZ=3,WW=4,KW=5,HW=6,XW=7,HG=0,XG=1,YG=2,m8=0,zH=1,VH=2,kH=3,CH=4,IH=5,PH=6,AH=7;var D$=301,LQ=302,YW=303,UW=304,DZ=306,z$=1000,V$=1001,GW=1002,d8=1003,qW=1004;var BQ=1005;var FJ=1006,k$=1007;var M7=1008;var u8=1009,UG=1010,GG=1011,zZ=1012,wH=1013,u7=1014,L7=1015,l8=1016,SH=1017,TH=1018,C$=1020,qG=35902,NG=35899,RG=1021,EG=1022,i8=1023,DQ=1026,zQ=1027,FG=1028,jH=1029,I$=1030,_H=1031;var xH=1033,NW=33776,RW=33777,EW=33778,FW=33779,bH=35840,yH=35841,hH=35842,fH=35843,vH=36196,gH=37492,pH=37496,mH=37488,dH=37489,uH=37490,lH=37491,cH=37808,sH=37809,nH=37810,oH=37811,iH=37812,aH=37813,rH=37814,tH=37815,eH=37816,JX=37817,QX=37818,$X=37819,ZX=37820,WX=37821,KX=36492,HX=36494,XX=36495,YX=36283,UX=36284,GX=36285,qX=36286;var NX=2300,OW=2301;var RX=0,VZ=1,P$=2;var OG=0,MG=1,VQ="",l7="srgb",hJ="srgb-linear",EX="linear",A9="srgb";var LG=512,BG=513,DG=514,MW=515,zG=516,VG=517,LW=518,kG=519;var FX="300 es",OX=2000;function MX(J){for(let Q=J.length-1;Q>=0;--Q)if(J[Q]>=65535)return!0;return!1}function GE(J){return ArrayBuffer.isView(J)&&!(J instanceof DataView)}function F$(J){return document.createElementNS("http://www.w3.org/1999/xhtml",J)}function CG(){let J=F$("canvas");return J.style.display="block",J}var Q1={},O$=null;function OZ(...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 Q1)return;Q1[Q]=!0,j0(...J)}function IG(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 LX(J,Q){return(J%Q+Q)%Q}function qE(J,Q,$,Z,W){return Z+(J-Q)*(W-Z)/($-Q)}function NE(J,Q,$){if(J!==Q)return($-J)/(Q-J);else return 0}function FZ(J,Q,$){return(1-$)*J+$*Q}function RE(J,Q,$,Z){return FZ(J,Q,1-Math.exp(-$*Z))}function EE(J,Q=1){return Q-Math.abs(LX(J,Q*2)-Q)}function FE(J,Q,$){if(J<=Q)return 0;if(J>=$)return 1;return J=(J-Q)/($-Q),J*J*(3-2*J)}function OE(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 ME(J,Q){return J+Math.floor(Math.random()*(Q-J+1))}function LE(J,Q){return J+Math.random()*(Q-J)}function BE(J){return J*(0.5-Math.random())}function DE(J){if(J!==void 0)$1=J;let Q=$1+=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 zE(J){return J*EZ}function VE(J){return J*OQ}function kE(J){return(J&J-1)===0&&J!==0}function CE(J){return Math.pow(2,Math.ceil(Math.log(J)/Math.LN2))}function IE(J){return Math.pow(2,Math.floor(Math.log(J)/Math.LN2))}function PE(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 kZ={DEG2RAD:EZ,RAD2DEG:OQ,generateUUID:v8,clamp:Q9,euclideanModulo:LX,mapLinear:qE,inverseLerp:NE,lerp:FZ,damp:RE,pingpong:EE,smoothstep:FE,smootherstep:OE,randInt:ME,randFloat:LE,randFloatSpread:BE,seededRandom:DE,degToRad:zE,radToDeg:VE,isPowerOfTwo:kE,ceilPowerOfTwo:CE,floorPowerOfTwo:IE,setQuaternionFromProperEuler:PE,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 F=X*q+Y*N+U*R+G*M;if(F<0)q=-q,N=-N,R=-R,M=-M,F=-F;let E=1-H;if(F<0.9995){let O=Math.acos(F),k=Math.sin(O);E=Math.sin(E*O)/k,H=Math.sin(H*O)/k,X=X*E+q*H,Y=Y*E+N*H,U=U*E+R*H,G=G*E+M*H}else{X=X*E+q*H,Y=Y*E+N*H,U=U*E+R*H,G=G*E+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(Z1.setFromEuler(J))}applyAxisAngle(J,Q){return this.applyQuaternion(Z1.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 lK.copy(this).projectOnVector(J),this.sub(lK)}reflect(J){return this.sub(lK.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 lK=new f,Z1=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],F=Z[3],E=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*F+H*k+X*A,W[6]=K*E+H*D+X*C,W[1]=Y*M+U*O+G*B,W[4]=Y*F+U*k+G*A,W[7]=Y*E+U*D+G*C,W[2]=q*M+N*O+R*B,W[5]=q*F+N*k+R*A,W[8]=q*E+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(cK.makeScale(J,Q)),this}rotate(J){return this.premultiply(cK.makeRotation(-J)),this}translate(J,Q){return this.premultiply(cK.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 cK=new t0,W1=new t0().set(0.4123908,0.3575843,0.1804808,0.212639,0.7151687,0.0721923,0.0193308,0.1191948,0.9505322),K1=new t0().set(3.2409699,-1.5373832,-0.4986108,-0.9692436,1.8759675,0.0415551,0.0556301,-0.203977,1.0569715);function AE(){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=E7(W.r),W.g=E7(W.g),W.b=E7(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=E$(W.r),W.g=E$(W.g),W.b=E$(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:W1,fromXYZ:K1,luminanceCoefficients:$,workingColorSpaceConfig:{unpackColorSpace:"srgb"},outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}},["srgb"]:{primaries:Q,whitePoint:Z,transfer:"srgb",toXYZ:W1,fromXYZ:K1,luminanceCoefficients:$,outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}}}),J}var X9=AE();function E7(J){return J<0.04045?J*0.0773993808:Math.pow(J*0.9478672986+0.0521327014,2.4)}function E$(J){return J<0.0031308?J*12.92:1.055*Math.pow(J,0.41666)-0.055}var J$;class BX{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$=F$("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=F$("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(nK).x}get height(){return this.source.getSize(nK).y}get depth(){return this.source.getSize(nK).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++}}i9.DEFAULT_IMAGE=null;i9.DEFAULT_MAPPING=300;i9.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],F=X[6],E=X[10];if(Math.abs(U-q)<0.01&&Math.abs(G-M)<0.01&&Math.abs(R-F)<0.01){if(Math.abs(U+q)<0.1&&Math.abs(G+M)<0.1&&Math.abs(R+F)<0.1&&Math.abs(Y+N+E-3)<0.1)return this.set(1,0,0,0),this;Q=Math.PI;let k=(Y+1)/2,D=(N+1)/2,B=(E+1)/2,A=(U+q)/4,C=(G+M)/4,w=(R+F)/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((F-R)*(F-R)+(G-M)*(G-M)+(q-U)*(q-U));if(Math.abs(O)<0.001)O=1;return this.x=(F-R)/O,this.y=(G-M)/O,this.z=(q-U)/O,this.w=Math.acos((Y+N+E-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 DX 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 i9(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 CZ(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 DX{constructor(J=1,Q=1,$={}){super(J,Q,$);this.isWebGLRenderTarget=!0}}class BW extends i9{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 zX extends i9{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 I8{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(XZ),T6.subVectors(this.max,XZ),Q$.subVectors(J.a,XZ),$$.subVectors(J.b,XZ),Z$.subVectors(J.c,XZ),b7.subVectors($$,Q$),y7.subVectors(Z$,$$),NQ.subVectors(Q$,Z$);let Q=[0,-b7.z,b7.y,0,-y7.z,y7.y,0,-NQ.z,NQ.y,b7.z,0,-b7.x,y7.z,0,-y7.x,NQ.z,0,-NQ.x,-b7.y,b7.x,0,-y7.y,y7.x,0,-NQ.y,NQ.x,0];if(!oK(Q,Q$,$$,Z$,T6))return!1;if(Q=[1,0,0,0,1,0,0,0,1],!oK(Q,Q$,$$,Z$,T6))return!1;return j6.crossVectors(b7,y7),Q=[j6.x,j6.y,j6.z],oK(Q,Q$,$$,Z$,T6)}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,S6=new I8,Q$=new f,$$=new f,Z$=new f,b7=new f,y7=new f,NQ=new f,XZ=new f,T6=new f,j6=new f,RQ=new f;function oK(J,Q,$,Z,W){for(let K=0,H=J.length-3;K<=H;K+=3){RQ.fromArray(J,K);let X=W.x*Math.abs(RQ.x)+W.y*Math.abs(RQ.y)+W.z*Math.abs(RQ.z),Y=Q.dot(RQ),U=$.dot(RQ),G=Z.dot(RQ);if(Math.max(-Math.max(Y,U,G),Math.min(Y,U,G))>X)return!1}return!0}var TE=new I8,YZ=new f,iK=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 TE.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;YZ.subVectors(J,this.center);let Q=YZ.lengthSq();if(Q>this.radius*this.radius){let $=Math.sqrt(Q),Z=($-this.radius)*0.5;this.center.addScaledVector(YZ,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 iK.subVectors(J.center,this.center).setLength(J.radius),this.expandByPoint(YZ.copy(J.center).add(iK)),this.expandByPoint(YZ.copy(J.center).sub(iK));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,aK=new f,_6=new f,h7=new f,rK=new f,x6=new f,tK=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){aK.copy(J).add(Q).multiplyScalar(0.5),_6.copy(Q).sub(J).normalize(),h7.copy(this.origin).sub(aK);let W=J.distanceTo(Q)*0.5,K=-this.direction.dot(_6),H=h7.dot(this.direction),X=-h7.dot(_6),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(aK).addScaledVector(_6,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){rK.subVectors(Q,J),x6.subVectors($,J),tK.crossVectors(rK,x6);let K=this.direction.dot(tK),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(x6.crossVectors(h7,x6));if(X<0)return null;let Y=H*this.direction.dot(rK.cross(h7));if(Y<0)return null;if(X+Y>K)return null;let U=-H*h7.dot(tK);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,F){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,F)}set(J,Q,$,Z,W,K,H,X,Y,U,G,q,N,R,M,F){let E=this.elements;return E[0]=J,E[4]=Q,E[8]=$,E[12]=Z,E[1]=W,E[5]=K,E[9]=H,E[13]=X,E[2]=Y,E[6]=U,E[10]=G,E[14]=q,E[3]=N,E[7]=R,E[11]=M,E[15]=F,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(jE,J,_E)}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(),b6.crossVectors(X8,f7),Z[0]=f7.x,Z[4]=b6.x,Z[8]=X8.x,Z[1]=f7.y,Z[5]=b6.y,Z[9]=X8.y,Z[2]=f7.z,Z[6]=b6.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],F=$[10],E=$[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],m=Z[2],v=Z[6],s=Z[10],p=Z[14],h=Z[3],c=Z[7],t=Z[11],j=Z[15];return W[0]=K*A+H*z+X*m+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*p+Y*j,W[1]=U*A+G*z+q*m+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*p+N*j,W[2]=R*A+M*z+F*m+E*h,W[6]=R*C+M*V+F*v+E*c,W[10]=R*w+M*_+F*s+E*t,W[14]=R*T+M*b+F*p+E*j,W[3]=O*A+k*z+D*m+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*p+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],F=J[11],E=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-F*k+E*D)-$*(R*O-F*B+E*A)+Z*(R*k-M*B+E*C)-W*(R*D-M*A+F*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],F=J[14],E=J[15],O=G*F*Y-M*q*Y+M*X*N-H*F*N-G*X*E+H*q*E,k=R*q*Y-U*F*Y-R*X*N+K*F*N+U*X*E-K*q*E,D=U*M*Y-R*G*Y+R*H*N-K*M*N-U*H*E+K*G*E,B=R*G*X-U*M*X-R*H*q+K*M*q+U*H*F-K*G*F,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*F*W-M*Z*N+$*F*N+G*Z*E-$*q*E)*C,J[2]=(H*F*W-M*X*W+M*Z*Y-$*F*Y-H*Z*E+$*X*E)*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*F*W-R*q*W+R*Z*N-Q*F*N-U*Z*E+Q*q*E)*C,J[6]=(R*X*W-K*F*W-R*Z*Y+Q*F*Y+K*Z*E-Q*X*E)*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*$*E-Q*G*E)*C,J[10]=(K*M*W-R*H*W+R*$*Y-Q*M*Y-K*$*E+Q*H*E)*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*$*F+Q*G*F)*C,J[14]=(R*H*Z-K*M*Z-R*$*X+Q*M*X+K*$*F-Q*H*F)*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,F=K*G,E=H*G,O=X*Y,k=X*U,D=X*G,B=$.x,A=$.y,C=$.z;return Z[0]=(1-(M+E))*B,Z[1]=(N+D)*B,Z[2]=(R-k)*B,Z[3]=0,Z[4]=(N-D)*A,Z[5]=(1-(q+E))*A,Z[6]=(F+O)*A,Z[7]=0,Z[8]=(R+k)*C,Z[9]=(F-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,jE=new f(0,0,0),_E=new f(1,1,1),f7=new f,b6=new f,X8=new f,H1=new r0,X1=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 H1.makeRotationFromQuaternion(J),this.setFromRotationMatrix(H1,Q,$)}setFromVector3(J,Q=this._order){return this.set(J.x,J.y,J.z,Q)}reorder(J){return X1.setFromEuler(this),this.setFromQuaternion(X1,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 DW{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),JH.subVectors(J,Q);let K=y8.dot(y8),H=y8.dot(q7),X=y8.dot(JH),Y=q7.dot(q7),U=q7.dot(JH),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 WH.setScalar(0),KH.setScalar(0),HH.setScalar(0),WH.fromBufferAttribute(J,Q),KH.fromBufferAttribute(J,$),HH.fromBufferAttribute(J,Z),K.setScalar(0),K.addScaledVector(WH,W.x),K.addScaledVector(KH,W.y),K.addScaledVector(HH,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 C8.getNormal(this.a,this.b,this.c,J)}getPlane(J){return J.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(J,Q){return C8.getBarycoord(J,this.a,this.b,this.c,Q)}getInterpolation(J,Q,$,Z,W){return C8.getInterpolation(J,this.a,this.b,this.c,Q,$,Z,W)}containsPoint(J){return C8.containsPoint(J,this.a,this.b,this.c)}isFrontFacing(J){return C8.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,$),QH.subVectors(J,$);let X=X$.dot(QH),Y=Y$.dot(QH);if(X<=0&&Y<=0)return Q.copy($);$H.subVectors(J,Z);let U=X$.dot($H),G=Y$.dot($H);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);ZH.subVectors(J,W);let N=X$.dot(ZH),R=Y$.dot(ZH);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 F=U*R-N*G;if(F<=0&&G-U>=0&&N-R>=0)return R1.subVectors(W,Z),H=(G-U)/(G-U+(N-R)),Q.copy(Z).addScaledVector(R1,H);let E=1/(F+M+q);return K=M*E,H=q*E,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 PG={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},h6={h:0,s:0,l:0};function XH(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 c0{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=LX(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=XH(K,W,J+0.3333333333333333),this.g=XH(K,W,J),this.b=XH(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 $=PG[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=E7(J.r),this.g=E7(J.g),this.b=E7(J.b),this}copyLinearToSRGB(J){return this.r=E$(J.r),this.g=E$(J.g),this.b=E$(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 c0(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 o9=new f,f6=new g0,vE=0;class ZJ{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:vE++}),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 I8;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(E1.copy(W).invert(),EQ.copy(J.ray).applyMatrix4(E1),$.boundingBox!==null){if(EQ.intersectsBox($.boundingBox)===!1)return}this._computeIntersections(J,Q,EQ)}_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:u6.clone(),object:J}}function l6(J,Q,$,Z,W,K,H,X,Y,U){J.getVertexPosition(X,g6),J.getVertexPosition(Y,p6),J.getVertexPosition(U,m6);let G=pE(J,Q,$,Z,g6,p6,m6,O1);if(G){let q=new f;if(C8.getBarycoord(O1,g6,p6,m6,q),W)G.uv=C8.getInterpolatedAttribute(W,X,Y,U,q,new g0);if(K)G.uv1=C8.getInterpolatedAttribute(K,X,Y,U,q,new g0);if(H){if(G.normal=C8.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};C8.getNormal(g6,p6,m6,N.normal),G.face=N,G.barycoord=q}return G}class A$ extends OJ{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,F,E,O,k,D,B,A,C,w,T){let z=D/C,V=B/w,_=D/2,b=B/2,m=A/2,v=C+1,s=w+1,p=0,h=0,c=new f;for(let t=0;t0?1:-1,U.push(c.x,c.y,c.z),G.push($0/C),G.push(1-t/w),p+=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 CW 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,M1=new g0,L1=new g0;class $J extends CW{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=OQ*2*Math.atan(Q),this.updateProjectionMatrix()}getFocalLength(){let J=Math.tan(EZ*0.5*this.fov);return 0.5*this.getFilmHeight()/J}getEffectiveFOV(){return OQ*2*Math.atan(Math.tan(EZ*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,M1,L1),Q.subVectors(L1,M1)}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(EZ*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 kX extends h9{constructor(J,Q,$){super();this.type="CubeCamera",this.renderTarget=$,this.coordinateSystem=null,this.activeMipmapLevel=0;let Z=new $J(G$,q$,J,Q);Z.layers=this.layers,this.add(Z);let W=new $J(G$,q$,J,Q);W.layers=this.layers,this.add(W);let K=new $J(G$,q$,J,Q);K.layers=this.layers,this.add(K);let H=new $J(G$,q$,J,Q);H.layers=this.layers,this.add(H);let X=new $J(G$,q$,J,Q);X.layers=this.layers,this.add(X);let Y=new $J(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 IW extends i9{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 PW extends aJ{constructor(J=1,Q={}){super(J,J,Q);this.isWebGLCubeRenderTarget=!0;let $={width:J,height:J,depth:1},Z=[$,$,$,$,$,$];this.texture=new IW(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:` \t\t\t\tvarying vec3 vWorldDirection; \t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) { \t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); \t\t\t\t} \t\t\t\tvoid main() { \t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix ); \t\t\t\t\t#include \t\t\t\t\t#include \t\t\t\t} \t\t\t`,fragmentShader:` \t\t\t\tuniform sampler2D tEquirect; \t\t\t\tvarying vec3 vWorldDirection; \t\t\t\t#include \t\t\t\tvoid main() { \t\t\t\t\tvec3 direction = normalize( vWorldDirection ); \t\t\t\t\tvec2 sampleUV = equirectUv( direction ); \t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV ); \t\t\t\t} \t\t\t`},Z=new A$(5,5,5),W=new fJ({name:"CubemapFromEquirect",uniforms:kQ($.uniforms),vertexShader:$.vertexShader,fragmentShader:$.fragmentShader,side:1,blending:0});W.uniforms.tEquirect.value=Q;let K=new a9(Z,W),H=Q.minFilter;if(Q.minFilter===1008)Q.minFilter=1006;return new kX(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 lE={type:"move"};class IZ{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 F=Q.getJointPose(M,$),E=this._getHandJoint(Y,M);if(F!==null)E.matrix.fromArray(F.transform.matrix),E.matrix.decompose(E.position,E.rotation,E.scale),E.matrixWorldNeedsUpdate=!0,E.jointRadius=F.radius;E.visible=F!==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(lE)}}}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 AW 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 PZ{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||iE.getNormalMatrix(J),Z=this.coplanarPoint(NH).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,aE=new g0(0.5,0.5),n6=new f;class TZ{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],F=W[10],E=W[11],O=W[12],k=W[13],D=W[14],B=W[15];if(Z[0].setComponents(Y-K,N-U,E-R,B-O).normalize(),Z[1].setComponents(Y+K,N+U,E+R,B+O).normalize(),Z[2].setComponents(Y+H,N+G,E+M,B+k).normalize(),Z[3].setComponents(Y-H,N-G,E-M,B-k).normalize(),$)Z[4].setComponents(X,q,F,D).normalize(),Z[5].setComponents(Y-X,N-q,E-F,B-D).normalize();else if(Z[4].setComponents(Y-X,N-q,E-F,B-D).normalize(),Q===2000)Z[5].setComponents(Y+X,N+q,E+F,B+D).normalize();else if(Q===2001)Z[5].setComponents(X,q,F,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=aE.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,n6.y=Z.normal.y>0?J.max.y:J.min.y,n6.z=Z.normal.z>0?J.max.z:J.min.z,Z.distanceToPoint(n6)<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 jZ extends q8{constructor(J){super();this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new c0(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 e6=new f,JW=new f,A1=new r0,RZ=new c7,o6=new G8,RH=new f,w1=new f;class S$ extends h9{constructor(J=new OJ,Q=new jZ){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;RH.applyMatrix4(J.matrixWorld);let U=Q.ray.origin.distanceTo(RH);if(UQ.far)return;return{distance:U,point:w1.clone().applyMatrix4(J.matrixWorld),index:H,face:null,faceIndex:null,barycoord:null,object:J}}var S1=new f,T1=new f;class TW 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 CQ extends i9{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 CZ(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 CX extends CQ{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 xW extends i9{constructor(J=null){super();this.sourceTexture=J,this.isExternalTexture=!0}copy(J){return super.copy(J),this.sourceTexture=J.sourceTexture,this}}class IQ extends OJ{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=[],F=[];for(let E=0;E0!==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 IX 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 PX 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 t6(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 rE(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 x1(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 AG(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(GE(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 bW extends R8{constructor(J,Q,$,Z){super(J,Q,$,Z)}}bW.prototype.ValueTypeName="color";class F7 extends R8{constructor(J,Q,$,Z){super(J,Q,$,Z)}}F7.prototype.ValueTypeName="number";class TX 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 TX(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 yW{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(eE($[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 F=[],E=[];if(AG(N,F,E,R),F.length!==0)M.push(new G(q,F,E))}},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,F=new ReadableStream({start(E){O();function O(){G.read().then(({done:k,value:D})=>{if(k)E.close();else{M+=D.byteLength;let B=new ProgressEvent("progress",{lengthComputable:R,loaded:M,total:N});for(let A=0,C=U.length;A{E.error(k)})}}});return new Response(F)}else throw new SG(`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 _X 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=F$("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 xX extends $J{constructor(J=[]){super();this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=J}}class mW{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 bX="\\[\\]\\.:\\/",JF=new RegExp("["+bX+"]","g"),yX="[^"+bX+"]",QF="[^"+bX.replace("\\.","")+"]",$F=/((?:WC+[\/:])*)/.source.replace("WC",yX),ZF=/(WCOD+)?/.source.replace("WCOD",QF),WF=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",yX),KF=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",yX),HF=new RegExp("^"+$F+ZF+WF+KF+"$"),XF=["material","materials","bones","map"];class xG{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(JF,"")}static parseTrackName(J){let Q=HF.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(XF.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 \tvec4 plane; \t#ifdef ALPHA_TO_COVERAGE \t\tfloat distanceToPlane, distanceGradient; \t\tfloat clipOpacity = 1.0; \t\t#pragma unroll_loop_start \t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { \t\t\tplane = clippingPlanes[ i ]; \t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; \t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0; \t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); \t\t\tif ( clipOpacity == 0.0 ) discard; \t\t} \t\t#pragma unroll_loop_end \t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES \t\t\tfloat unionClipOpacity = 1.0; \t\t\t#pragma unroll_loop_start \t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { \t\t\t\tplane = clippingPlanes[ i ]; \t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; \t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0; \t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); \t\t\t} \t\t\t#pragma unroll_loop_end \t\t\tclipOpacity *= 1.0 - unionClipOpacity; \t\t#endif \t\tdiffuseColor.a *= clipOpacity; \t\tif ( diffuseColor.a == 0.0 ) discard; \t#else \t\t#pragma unroll_loop_start \t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { \t\t\tplane = clippingPlanes[ i ]; \t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; \t\t} \t\t#pragma unroll_loop_end \t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES \t\t\tbool clipped = true; \t\t\t#pragma unroll_loop_start \t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { \t\t\t\tplane = clippingPlanes[ i ]; \t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; \t\t\t} \t\t\t#pragma unroll_loop_end \t\t\tif ( clipped ) discard; \t\t#endif \t#endif #endif`,PF=`#if NUM_CLIPPING_PLANES > 0 \tvarying vec3 vClipPosition; \tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`,AF=`#if NUM_CLIPPING_PLANES > 0 \tvarying vec3 vClipPosition; #endif`,wF=`#if NUM_CLIPPING_PLANES > 0 \tvClipPosition = - mvPosition.xyz; #endif`,SF=`#if defined( USE_COLOR_ALPHA ) \tdiffuseColor *= vColor; #elif defined( USE_COLOR ) \tdiffuseColor.rgb *= vColor; #endif`,TF=`#if defined( USE_COLOR_ALPHA ) \tvarying vec4 vColor; #elif defined( USE_COLOR ) \tvarying vec3 vColor; #endif`,jF=`#if defined( USE_COLOR_ALPHA ) \tvarying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) \tvarying vec3 vColor; #endif`,_F=`#if defined( USE_COLOR_ALPHA ) \tvColor = vec4( 1.0 ); #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) \tvColor = vec3( 1.0 ); #endif #ifdef USE_COLOR \tvColor *= color; #endif #ifdef USE_INSTANCING_COLOR \tvColor.xyz *= instanceColor.xyz; #endif #ifdef USE_BATCHING_COLOR \tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); \tvColor.xyz *= batchingColor.xyz; #endif`,xF=`#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 ) { \tconst highp float a = 12.9898, b = 78.233, c = 43758.5453; \thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); \treturn fract( sin( sn ) * c ); } #ifdef HIGH_PRECISION \tfloat precisionSafeLength( vec3 v ) { return length( v ); } #else \tfloat precisionSafeLength( vec3 v ) { \t\tfloat maxComponent = max3( abs( v ) ); \t\treturn length( v / maxComponent ) * maxComponent; \t} #endif struct IncidentLight { \tvec3 color; \tvec3 direction; \tbool visible; }; struct ReflectedLight { \tvec3 directDiffuse; \tvec3 directSpecular; \tvec3 indirectDiffuse; \tvec3 indirectSpecular; }; #ifdef USE_ALPHAHASH \tvarying vec3 vPosition; #endif vec3 transformDirection( in vec3 dir, in mat4 matrix ) { \treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { \treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); } bool isPerspectiveMatrix( mat4 m ) { \treturn m[ 2 ][ 3 ] == - 1.0; } vec2 equirectUv( in vec3 dir ) { \tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; \tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; \treturn vec2( u, v ); } vec3 BRDF_Lambert( const in vec3 diffuseColor ) { \treturn RECIPROCAL_PI * diffuseColor; } vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { \tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); \treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); } float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { \tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); \treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); } // validated`,bF=`#ifdef ENVMAP_TYPE_CUBE_UV \t#define cubeUV_minMipLevel 4.0 \t#define cubeUV_minTileSize 16.0 \tfloat getFace( vec3 direction ) { \t\tvec3 absDirection = abs( direction ); \t\tfloat face = - 1.0; \t\tif ( absDirection.x > absDirection.z ) { \t\t\tif ( absDirection.x > absDirection.y ) \t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0; \t\t\telse \t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0; \t\t} else { \t\t\tif ( absDirection.z > absDirection.y ) \t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0; \t\t\telse \t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0; \t\t} \t\treturn face; \t} \tvec2 getUV( vec3 direction, float face ) { \t\tvec2 uv; \t\tif ( face == 0.0 ) { \t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x ); \t\t} else if ( face == 1.0 ) { \t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y ); \t\t} else if ( face == 2.0 ) { \t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z ); \t\t} else if ( face == 3.0 ) { \t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x ); \t\t} else if ( face == 4.0 ) { \t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y ); \t\t} else { \t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z ); \t\t} \t\treturn 0.5 * ( uv + 1.0 ); \t} \tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { \t\tfloat face = getFace( direction ); \t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); \t\tmipInt = max( mipInt, cubeUV_minMipLevel ); \t\tfloat faceSize = exp2( mipInt ); \t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; \t\tif ( face > 2.0 ) { \t\t\tuv.y += faceSize; \t\t\tface -= 3.0; \t\t} \t\tuv.x += face * faceSize; \t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize; \t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); \t\tuv.x *= CUBEUV_TEXEL_WIDTH; \t\tuv.y *= CUBEUV_TEXEL_HEIGHT; \t\t#ifdef texture2DGradEXT \t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; \t\t#else \t\t\treturn texture2D( envMap, uv ).rgb; \t\t#endif \t} \t#define cubeUV_r0 1.0 \t#define cubeUV_m0 - 2.0 \t#define cubeUV_r1 0.8 \t#define cubeUV_m1 - 1.0 \t#define cubeUV_r4 0.4 \t#define cubeUV_m4 2.0 \t#define cubeUV_r5 0.305 \t#define cubeUV_m5 3.0 \t#define cubeUV_r6 0.21 \t#define cubeUV_m6 4.0 \tfloat roughnessToMip( float roughness ) { \t\tfloat mip = 0.0; \t\tif ( roughness >= cubeUV_r1 ) { \t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; \t\t} else if ( roughness >= cubeUV_r4 ) { \t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; \t\t} else if ( roughness >= cubeUV_r5 ) { \t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; \t\t} else if ( roughness >= cubeUV_r6 ) { \t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; \t\t} else { \t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t} \t\treturn mip; \t} \tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { \t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); \t\tfloat mipF = fract( mip ); \t\tfloat mipInt = floor( mip ); \t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); \t\tif ( mipF == 0.0 ) { \t\t\treturn vec4( color0, 1.0 ); \t\t} else { \t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); \t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 ); \t\t} \t} #endif`,yF=`vec3 transformedNormal = objectNormal; #ifdef USE_TANGENT \tvec3 transformedTangent = objectTangent; #endif #ifdef USE_BATCHING \tmat3 bm = mat3( batchingMatrix ); \ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); \ttransformedNormal = bm * transformedNormal; \t#ifdef USE_TANGENT \t\ttransformedTangent = bm * transformedTangent; \t#endif #endif #ifdef USE_INSTANCING \tmat3 im = mat3( instanceMatrix ); \ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); \ttransformedNormal = im * transformedNormal; \t#ifdef USE_TANGENT \t\ttransformedTangent = im * transformedTangent; \t#endif #endif transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED \ttransformedNormal = - transformedNormal; #endif #ifdef USE_TANGENT \ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; \t#ifdef FLIP_SIDED \t\ttransformedTangent = - transformedTangent; \t#endif #endif`,hF=`#ifdef USE_DISPLACEMENTMAP \tuniform sampler2D displacementMap; \tuniform float displacementScale; \tuniform float displacementBias; #endif`,fF=`#ifdef USE_DISPLACEMENTMAP \ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); #endif`,vF=`#ifdef USE_EMISSIVEMAP \tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); \t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE \t\temissiveColor = sRGBTransferEOTF( emissiveColor ); \t#endif \ttotalEmissiveRadiance *= emissiveColor.rgb; #endif`,gF=`#ifdef USE_EMISSIVEMAP \tuniform sampler2D emissiveMap; #endif`,pF="gl_FragColor = linearToOutputTexel( gl_FragColor );",mF=`vec4 LinearTransferOETF( in vec4 value ) { \treturn value; } vec4 sRGBTransferEOTF( in vec4 value ) { \treturn 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 ) { \treturn 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 ); }`,dF=`#ifdef USE_ENVMAP \t#ifdef ENV_WORLDPOS \t\tvec3 cameraToFrag; \t\tif ( isOrthographic ) { \t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); \t\t} else { \t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition ); \t\t} \t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); \t\t#ifdef ENVMAP_MODE_REFLECTION \t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal ); \t\t#else \t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); \t\t#endif \t#else \t\tvec3 reflectVec = vReflect; \t#endif \t#ifdef ENVMAP_TYPE_CUBE \t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); \t#else \t\tvec4 envColor = vec4( 0.0 ); \t#endif \t#ifdef ENVMAP_BLENDING_MULTIPLY \t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); \t#elif defined( ENVMAP_BLENDING_MIX ) \t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); \t#elif defined( ENVMAP_BLENDING_ADD ) \t\toutgoingLight += envColor.xyz * specularStrength * reflectivity; \t#endif #endif`,uF=`#ifdef USE_ENVMAP \tuniform float envMapIntensity; \tuniform float flipEnvMap; \tuniform mat3 envMapRotation; \t#ifdef ENVMAP_TYPE_CUBE \t\tuniform samplerCube envMap; \t#else \t\tuniform sampler2D envMap; \t#endif #endif`,lF=`#ifdef USE_ENVMAP \tuniform float reflectivity; \t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) \t\t#define ENV_WORLDPOS \t#endif \t#ifdef ENV_WORLDPOS \t\tvarying vec3 vWorldPosition; \t\tuniform float refractionRatio; \t#else \t\tvarying vec3 vReflect; \t#endif #endif`,cF=`#ifdef USE_ENVMAP \t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) \t\t#define ENV_WORLDPOS \t#endif \t#ifdef ENV_WORLDPOS \t\t \t\tvarying vec3 vWorldPosition; \t#else \t\tvarying vec3 vReflect; \t\tuniform float refractionRatio; \t#endif #endif`,sF=`#ifdef USE_ENVMAP \t#ifdef ENV_WORLDPOS \t\tvWorldPosition = worldPosition.xyz; \t#else \t\tvec3 cameraToVertex; \t\tif ( isOrthographic ) { \t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); \t\t} else { \t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition ); \t\t} \t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); \t\t#ifdef ENVMAP_MODE_REFLECTION \t\t\tvReflect = reflect( cameraToVertex, worldNormal ); \t\t#else \t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio ); \t\t#endif \t#endif #endif`,nF=`#ifdef USE_FOG \tvFogDepth = - mvPosition.z; #endif`,oF=`#ifdef USE_FOG \tvarying float vFogDepth; #endif`,iF=`#ifdef USE_FOG \t#ifdef FOG_EXP2 \t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); \t#else \t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); \t#endif \tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); #endif`,aF=`#ifdef USE_FOG \tuniform vec3 fogColor; \tvarying float vFogDepth; \t#ifdef FOG_EXP2 \t\tuniform float fogDensity; \t#else \t\tuniform float fogNear; \t\tuniform float fogFar; \t#endif #endif`,rF=`#ifdef USE_GRADIENTMAP \tuniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { \tfloat dotNL = dot( normal, lightDirection ); \tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); \t#ifdef USE_GRADIENTMAP \t\treturn vec3( texture2D( gradientMap, coord ).r ); \t#else \t\tvec2 fw = fwidth( coord ) * 0.5; \t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); \t#endif }`,tF=`#ifdef USE_LIGHTMAP \tuniform sampler2D lightMap; \tuniform float lightMapIntensity; #endif`,eF=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularStrength = specularStrength;`,JO=`varying vec3 vViewPosition; struct LambertMaterial { \tvec3 diffuseColor; \tfloat 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 ) { \tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) ); \tvec3 irradiance = dotNL * directLight.color; \treflectedLight.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 ) { \treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct\t\t\t\tRE_Direct_Lambert #define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert`,QO=`uniform bool receiveShadow; uniform vec3 ambientLightColor; #if defined( USE_LIGHT_PROBES ) \tuniform vec3 lightProbe[ 9 ]; #endif vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { \tfloat x = normal.x, y = normal.y, z = normal.z; \tvec3 result = shCoefficients[ 0 ] * 0.886227; \tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; \tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; \tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; \tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; \tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; \tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); \tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; \tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); \treturn result; } vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { \tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); \tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); \treturn irradiance; } vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { \tvec3 irradiance = ambientLightColor; \treturn irradiance; } float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { \tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); \tif ( cutoffDistance > 0.0 ) { \t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); \t} \treturn distanceFalloff; } float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { \treturn smoothstep( coneCosine, penumbraCosine, angleCosine ); } #if NUM_DIR_LIGHTS > 0 \tstruct DirectionalLight { \t\tvec3 direction; \t\tvec3 color; \t}; \tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; \tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { \t\tlight.color = directionalLight.color; \t\tlight.direction = directionalLight.direction; \t\tlight.visible = true; \t} #endif #if NUM_POINT_LIGHTS > 0 \tstruct PointLight { \t\tvec3 position; \t\tvec3 color; \t\tfloat distance; \t\tfloat decay; \t}; \tuniform PointLight pointLights[ NUM_POINT_LIGHTS ]; \tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { \t\tvec3 lVector = pointLight.position - geometryPosition; \t\tlight.direction = normalize( lVector ); \t\tfloat lightDistance = length( lVector ); \t\tlight.color = pointLight.color; \t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); \t\tlight.visible = ( light.color != vec3( 0.0 ) ); \t} #endif #if NUM_SPOT_LIGHTS > 0 \tstruct SpotLight { \t\tvec3 position; \t\tvec3 direction; \t\tvec3 color; \t\tfloat distance; \t\tfloat decay; \t\tfloat coneCos; \t\tfloat penumbraCos; \t}; \tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; \tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { \t\tvec3 lVector = spotLight.position - geometryPosition; \t\tlight.direction = normalize( lVector ); \t\tfloat angleCos = dot( light.direction, spotLight.direction ); \t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); \t\tif ( spotAttenuation > 0.0 ) { \t\t\tfloat lightDistance = length( lVector ); \t\t\tlight.color = spotLight.color * spotAttenuation; \t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); \t\t\tlight.visible = ( light.color != vec3( 0.0 ) ); \t\t} else { \t\t\tlight.color = vec3( 0.0 ); \t\t\tlight.visible = false; \t\t} \t} #endif #if NUM_RECT_AREA_LIGHTS > 0 \tstruct RectAreaLight { \t\tvec3 color; \t\tvec3 position; \t\tvec3 halfWidth; \t\tvec3 halfHeight; \t}; \tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2; \tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; #endif #if NUM_HEMI_LIGHTS > 0 \tstruct HemisphereLight { \t\tvec3 direction; \t\tvec3 skyColor; \t\tvec3 groundColor; \t}; \tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; \tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { \t\tfloat dotNL = dot( normal, hemiLight.direction ); \t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5; \t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); \t\treturn irradiance; \t} #endif`,$O=`#ifdef USE_ENVMAP \tvec3 getIBLIrradiance( const in vec3 normal ) { \t\t#ifdef ENVMAP_TYPE_CUBE_UV \t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); \t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); \t\t\treturn PI * envMapColor.rgb * envMapIntensity; \t\t#else \t\t\treturn vec3( 0.0 ); \t\t#endif \t} \tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { \t\t#ifdef ENVMAP_TYPE_CUBE_UV \t\t\tvec3 reflectVec = reflect( - viewDir, normal ); \t\t\treflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) ); \t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix ); \t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); \t\t\treturn envMapColor.rgb * envMapIntensity; \t\t#else \t\t\treturn vec3( 0.0 ); \t\t#endif \t} \t#ifdef USE_ANISOTROPY \t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { \t\t\t#ifdef ENVMAP_TYPE_CUBE_UV \t\t\t\tvec3 bentNormal = cross( bitangent, viewDir ); \t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) ); \t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); \t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness ); \t\t\t#else \t\t\t\treturn vec3( 0.0 ); \t\t\t#endif \t\t} \t#endif #endif`,ZO=`ToonMaterial material; material.diffuseColor = diffuseColor.rgb;`,WO=`varying vec3 vViewPosition; struct ToonMaterial { \tvec3 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 ) { \tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; \treflectedLight.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 ) { \treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct\t\t\t\tRE_Direct_Toon #define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon`,KO=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; material.specularStrength = specularStrength;`,HO=`varying vec3 vViewPosition; struct BlinnPhongMaterial { \tvec3 diffuseColor; \tvec3 specularColor; \tfloat specularShininess; \tfloat 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 ) { \tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) ); \tvec3 irradiance = dotNL * directLight.color; \treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); \treflectedLight.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 ) { \treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct\t\t\t\tRE_Direct_BlinnPhong #define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong`,XO=`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 \tmaterial.ior = ior; \t#ifdef USE_SPECULAR \t\tfloat specularIntensityFactor = specularIntensity; \t\tvec3 specularColorFactor = specularColor; \t\t#ifdef USE_SPECULAR_COLORMAP \t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; \t\t#endif \t\t#ifdef USE_SPECULAR_INTENSITYMAP \t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; \t\t#endif \t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); \t#else \t\tfloat specularIntensityFactor = 1.0; \t\tvec3 specularColorFactor = vec3( 1.0 ); \t\tmaterial.specularF90 = 1.0; \t#endif \tmaterial.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor; \tmaterial.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); #else \tmaterial.specularColor = vec3( 0.04 ); \tmaterial.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); \tmaterial.specularF90 = 1.0; #endif #ifdef USE_CLEARCOAT \tmaterial.clearcoat = clearcoat; \tmaterial.clearcoatRoughness = clearcoatRoughness; \tmaterial.clearcoatF0 = vec3( 0.04 ); \tmaterial.clearcoatF90 = 1.0; \t#ifdef USE_CLEARCOATMAP \t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; \t#endif \t#ifdef USE_CLEARCOAT_ROUGHNESSMAP \t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; \t#endif \tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); \tmaterial.clearcoatRoughness += geometryRoughness; \tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); #endif #ifdef USE_DISPERSION \tmaterial.dispersion = dispersion; #endif #ifdef USE_IRIDESCENCE \tmaterial.iridescence = iridescence; \tmaterial.iridescenceIOR = iridescenceIOR; \t#ifdef USE_IRIDESCENCEMAP \t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; \t#endif \t#ifdef USE_IRIDESCENCE_THICKNESSMAP \t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; \t#else \t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum; \t#endif #endif #ifdef USE_SHEEN \tmaterial.sheenColor = sheenColor; \t#ifdef USE_SHEEN_COLORMAP \t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; \t#endif \tmaterial.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 ); \t#ifdef USE_SHEEN_ROUGHNESSMAP \t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; \t#endif #endif #ifdef USE_ANISOTROPY \t#ifdef USE_ANISOTROPYMAP \t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); \t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; \t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; \t#else \t\tvec2 anisotropyV = anisotropyVector; \t#endif \tmaterial.anisotropy = length( anisotropyV ); \tif( material.anisotropy == 0.0 ) { \t\tanisotropyV = vec2( 1.0, 0.0 ); \t} else { \t\tanisotropyV /= material.anisotropy; \t\tmaterial.anisotropy = saturate( material.anisotropy ); \t} \tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); \tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; \tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; #endif`,YO=`uniform sampler2D dfgLUT; struct PhysicalMaterial { \tvec3 diffuseColor; \tvec3 diffuseContribution; \tvec3 specularColor; \tvec3 specularColorBlended; \tfloat roughness; \tfloat metalness; \tfloat specularF90; \tfloat dispersion; \t#ifdef USE_CLEARCOAT \t\tfloat clearcoat; \t\tfloat clearcoatRoughness; \t\tvec3 clearcoatF0; \t\tfloat clearcoatF90; \t#endif \t#ifdef USE_IRIDESCENCE \t\tfloat iridescence; \t\tfloat iridescenceIOR; \t\tfloat iridescenceThickness; \t\tvec3 iridescenceFresnel; \t\tvec3 iridescenceF0; \t\tvec3 iridescenceFresnelDielectric; \t\tvec3 iridescenceFresnelMetallic; \t#endif \t#ifdef USE_SHEEN \t\tvec3 sheenColor; \t\tfloat sheenRoughness; \t#endif \t#ifdef IOR \t\tfloat ior; \t#endif \t#ifdef USE_TRANSMISSION \t\tfloat transmission; \t\tfloat transmissionAlpha; \t\tfloat thickness; \t\tfloat attenuationDistance; \t\tvec3 attenuationColor; \t#endif \t#ifdef USE_ANISOTROPY \t\tfloat anisotropy; \t\tfloat alphaT; \t\tvec3 anisotropyT; \t\tvec3 anisotropyB; \t#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 ) { \tfloat a2 = pow2( alpha ); \tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); \tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); \treturn 0.5 / max( gv + gl, EPSILON ); } float D_GGX( const in float alpha, const in float dotNH ) { \tfloat a2 = pow2( alpha ); \tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; \treturn RECIPROCAL_PI * a2 / pow2( denom ); } #ifdef USE_ANISOTROPY \tfloat 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 ) { \t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); \t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); \t\tfloat v = 0.5 / ( gv + gl ); \t\treturn v; \t} \tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { \t\tfloat a2 = alphaT * alphaB; \t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); \t\thighp float v2 = dot( v, v ); \t\tfloat w2 = a2 / v2; \t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 ); \t} #endif #ifdef USE_CLEARCOAT \tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { \t\tvec3 f0 = material.clearcoatF0; \t\tfloat f90 = material.clearcoatF90; \t\tfloat roughness = material.clearcoatRoughness; \t\tfloat alpha = pow2( roughness ); \t\tvec3 halfDir = normalize( lightDir + viewDir ); \t\tfloat dotNL = saturate( dot( normal, lightDir ) ); \t\tfloat dotNV = saturate( dot( normal, viewDir ) ); \t\tfloat dotNH = saturate( dot( normal, halfDir ) ); \t\tfloat dotVH = saturate( dot( viewDir, halfDir ) ); \t\tvec3 F = F_Schlick( f0, f90, dotVH ); \t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); \t\tfloat D = D_GGX( alpha, dotNH ); \t\treturn F * ( V * D ); \t} #endif vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { \tvec3 f0 = material.specularColorBlended; \tfloat f90 = material.specularF90; \tfloat roughness = material.roughness; \tfloat alpha = pow2( roughness ); \tvec3 halfDir = normalize( lightDir + viewDir ); \tfloat dotNL = saturate( dot( normal, lightDir ) ); \tfloat dotNV = saturate( dot( normal, viewDir ) ); \tfloat dotNH = saturate( dot( normal, halfDir ) ); \tfloat dotVH = saturate( dot( viewDir, halfDir ) ); \tvec3 F = F_Schlick( f0, f90, dotVH ); \t#ifdef USE_IRIDESCENCE \t\tF = mix( F, material.iridescenceFresnel, material.iridescence ); \t#endif \t#ifdef USE_ANISOTROPY \t\tfloat dotTL = dot( material.anisotropyT, lightDir ); \t\tfloat dotTV = dot( material.anisotropyT, viewDir ); \t\tfloat dotTH = dot( material.anisotropyT, halfDir ); \t\tfloat dotBL = dot( material.anisotropyB, lightDir ); \t\tfloat dotBV = dot( material.anisotropyB, viewDir ); \t\tfloat dotBH = dot( material.anisotropyB, halfDir ); \t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); \t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); \t#else \t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); \t\tfloat D = D_GGX( alpha, dotNH ); \t#endif \treturn F * ( V * D ); } vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { \tconst float LUT_SIZE = 64.0; \tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; \tconst float LUT_BIAS = 0.5 / LUT_SIZE; \tfloat dotNV = saturate( dot( N, V ) ); \tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); \tuv = uv * LUT_SCALE + LUT_BIAS; \treturn uv; } float LTC_ClippedSphereFormFactor( const in vec3 f ) { \tfloat l = length( f ); \treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); } vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { \tfloat x = dot( v1, v2 ); \tfloat y = abs( x ); \tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; \tfloat b = 3.4175940 + ( 4.1616724 + y ) * y; \tfloat v = a / b; \tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; \treturn 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 ] ) { \tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; \tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; \tvec3 lightNormal = cross( v1, v2 ); \tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); \tvec3 T1, T2; \tT1 = normalize( V - N * dot( V, N ) ); \tT2 = - cross( N, T1 ); \tmat3 mat = mInv * transpose( mat3( T1, T2, N ) ); \tvec3 coords[ 4 ]; \tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); \tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); \tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); \tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); \tcoords[ 0 ] = normalize( coords[ 0 ] ); \tcoords[ 1 ] = normalize( coords[ 1 ] ); \tcoords[ 2 ] = normalize( coords[ 2 ] ); \tcoords[ 3 ] = normalize( coords[ 3 ] ); \tvec3 vectorFormFactor = vec3( 0.0 ); \tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); \tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); \tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); \tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); \tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor ); \treturn vec3( result ); } #if defined( USE_SHEEN ) float D_Charlie( float roughness, float dotNH ) { \tfloat alpha = pow2( roughness ); \tfloat invAlpha = 1.0 / alpha; \tfloat cos2h = dotNH * dotNH; \tfloat sin2h = max( 1.0 - cos2h, 0.0078125 ); \treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); } float V_Neubelt( float dotNV, float dotNL ) { \treturn 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 ) { \tvec3 halfDir = normalize( lightDir + viewDir ); \tfloat dotNL = saturate( dot( normal, lightDir ) ); \tfloat dotNV = saturate( dot( normal, viewDir ) ); \tfloat dotNH = saturate( dot( normal, halfDir ) ); \tfloat D = D_Charlie( sheenRoughness, dotNH ); \tfloat V = V_Neubelt( dotNV, dotNL ); \treturn sheenColor * ( D * V ); } #endif float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { \tfloat dotNV = saturate( dot( normal, viewDir ) ); \tfloat r2 = roughness * roughness; \tfloat rInv = 1.0 / ( roughness + 0.1 ); \tfloat a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv; \tfloat b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv; \tfloat DG = exp( a * dotNV + b ); \treturn saturate( DG ); } vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { \tfloat dotNV = saturate( dot( normal, viewDir ) ); \tvec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; \treturn 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 \tfloat dotNV = saturate( dot( normal, viewDir ) ); \tvec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; \t#ifdef USE_IRIDESCENCE \t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence ); \t#else \t\tvec3 Fr = specularColor; \t#endif \tvec3 FssEss = Fr * fab.x + specularF90 * fab.y; \tfloat Ess = fab.x + fab.y; \tfloat Ems = 1.0 - Ess; \tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); \tsingleScatter += FssEss; \tmultiScatter += Fms * Ems; } vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { \tvec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material ); \tfloat dotNL = saturate( dot( normal, lightDir ) ); \tfloat dotNV = saturate( dot( normal, viewDir ) ); \tvec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg; \tvec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg; \tvec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y; \tvec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y; \tfloat Ess_V = dfgV.x + dfgV.y; \tfloat Ess_L = dfgL.x + dfgL.y; \tfloat Ems_V = 1.0 - Ess_V; \tfloat Ems_L = 1.0 - Ess_L; \tvec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; \tvec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON ); \tfloat compensationFactor = Ems_V * Ems_L; \tvec3 multiScatter = Fms * compensationFactor; \treturn singleScatter + multiScatter; } #if NUM_RECT_AREA_LIGHTS > 0 \tvoid 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 ) { \t\tvec3 normal = geometryNormal; \t\tvec3 viewDir = geometryViewDir; \t\tvec3 position = geometryPosition; \t\tvec3 lightPos = rectAreaLight.position; \t\tvec3 halfWidth = rectAreaLight.halfWidth; \t\tvec3 halfHeight = rectAreaLight.halfHeight; \t\tvec3 lightColor = rectAreaLight.color; \t\tfloat roughness = material.roughness; \t\tvec3 rectCoords[ 4 ]; \t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight; \t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight; \t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight; \t\tvec2 uv = LTC_Uv( normal, viewDir, roughness ); \t\tvec4 t1 = texture2D( ltc_1, uv ); \t\tvec4 t2 = texture2D( ltc_2, uv ); \t\tmat3 mInv = mat3( \t\t\tvec3( t1.x, 0, t1.y ), \t\t\tvec3( 0, 1, 0 ), \t\t\tvec3( t1.z, 0, t1.w ) \t\t); \t\tvec3 fresnel = ( material.specularColorBlended * t2.x + ( vec3( 1.0 ) - material.specularColorBlended ) * t2.y ); \t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); \t\treflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); \t} #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 ) { \tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) ); \tvec3 irradiance = dotNL * directLight.color; \t#ifdef USE_CLEARCOAT \t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); \t\tvec3 ccIrradiance = dotNLcc * directLight.color; \t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); \t#endif \t#ifdef USE_SHEEN \t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); \t\tfloat sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); \t\tfloat sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness ); \t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL ); \t\tirradiance *= sheenEnergyComp; \t#endif \treflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material ); \treflectedLight.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 ) { \tvec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ); \t#ifdef USE_SHEEN \t\tfloat sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); \t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; \t\tdiffuse *= sheenEnergyComp; \t#endif \treflectedLight.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) { \t#ifdef USE_CLEARCOAT \t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); \t#endif \t#ifdef USE_SHEEN \t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI; \t#endif \tvec3 singleScatteringDielectric = vec3( 0.0 ); \tvec3 multiScatteringDielectric = vec3( 0.0 ); \tvec3 singleScatteringMetallic = vec3( 0.0 ); \tvec3 multiScatteringMetallic = vec3( 0.0 ); \t#ifdef USE_IRIDESCENCE \t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); \t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); \t#else \t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); \t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); \t#endif \tvec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness ); \tvec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness ); \tvec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric; \tvec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric ); \tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; \tvec3 indirectSpecular = radiance * singleScattering; \tindirectSpecular += multiScattering * cosineWeightedIrradiance; \tvec3 indirectDiffuse = diffuse * cosineWeightedIrradiance; \t#ifdef USE_SHEEN \t\tfloat sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); \t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; \t\tindirectSpecular *= sheenEnergyComp; \t\tindirectDiffuse *= sheenEnergyComp; \t#endif \treflectedLight.indirectSpecular += indirectSpecular; \treflectedLight.indirectDiffuse += indirectDiffuse; } #define RE_Direct\t\t\t\tRE_Direct_Physical #define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical #define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical #define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { \treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); }`,UO=` vec3 geometryPosition = - vViewPosition; vec3 geometryNormal = normal; vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); vec3 geometryClearcoatNormal = vec3( 0.0 ); #ifdef USE_CLEARCOAT \tgeometryClearcoatNormal = clearcoatNormal; #endif #ifdef USE_IRIDESCENCE \tfloat dotNVi = saturate( dot( normal, geometryViewDir ) ); \tif ( material.iridescenceThickness == 0.0 ) { \t\tmaterial.iridescence = 0.0; \t} else { \t\tmaterial.iridescence = saturate( material.iridescence ); \t} \tif ( material.iridescence > 0.0 ) { \t\tmaterial.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); \t\tmaterial.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor ); \t\tmaterial.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness ); \t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); \t} #endif IncidentLight directLight; #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) \tPointLight pointLight; \t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 \tPointLightShadow pointLightShadow; \t#endif \t#pragma unroll_loop_start \tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { \t\tpointLight = pointLights[ i ]; \t\tgetPointLightInfo( pointLight, geometryPosition, directLight ); \t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) \t\tpointLightShadow = pointLightShadows[ i ]; \t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; \t\t#endif \t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); \t} \t#pragma unroll_loop_end #endif #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) \tSpotLight spotLight; \tvec4 spotColor; \tvec3 spotLightCoord; \tbool inSpotLightMap; \t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 \tSpotLightShadow spotLightShadow; \t#endif \t#pragma unroll_loop_start \tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { \t\tspotLight = spotLights[ i ]; \t\tgetSpotLightInfo( spotLight, geometryPosition, directLight ); \t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) \t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX \t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) \t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS \t\t#else \t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) \t\t#endif \t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) \t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; \t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); \t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); \t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; \t\t#endif \t\t#undef SPOT_LIGHT_MAP_INDEX \t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) \t\tspotLightShadow = spotLightShadows[ i ]; \t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; \t\t#endif \t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); \t} \t#pragma unroll_loop_end #endif #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) \tDirectionalLight directionalLight; \t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 \tDirectionalLightShadow directionalLightShadow; \t#endif \t#pragma unroll_loop_start \tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { \t\tdirectionalLight = directionalLights[ i ]; \t\tgetDirectionalLightInfo( directionalLight, directLight ); \t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) \t\tdirectionalLightShadow = directionalLightShadows[ i ]; \t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; \t\t#endif \t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); \t} \t#pragma unroll_loop_end #endif #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) \tRectAreaLight rectAreaLight; \t#pragma unroll_loop_start \tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { \t\trectAreaLight = rectAreaLights[ i ]; \t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); \t} \t#pragma unroll_loop_end #endif #if defined( RE_IndirectDiffuse ) \tvec3 iblIrradiance = vec3( 0.0 ); \tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); \t#if defined( USE_LIGHT_PROBES ) \t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); \t#endif \t#if ( NUM_HEMI_LIGHTS > 0 ) \t\t#pragma unroll_loop_start \t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { \t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); \t\t} \t\t#pragma unroll_loop_end \t#endif #endif #if defined( RE_IndirectSpecular ) \tvec3 radiance = vec3( 0.0 ); \tvec3 clearcoatRadiance = vec3( 0.0 ); #endif`,GO=`#if defined( RE_IndirectDiffuse ) \t#ifdef USE_LIGHTMAP \t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); \t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; \t\tirradiance += lightMapIrradiance; \t#endif \t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) \t\tiblIrradiance += getIBLIrradiance( geometryNormal ); \t#endif #endif #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) \t#ifdef USE_ANISOTROPY \t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); \t#else \t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); \t#endif \t#ifdef USE_CLEARCOAT \t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); \t#endif #endif`,qO=`#if defined( RE_IndirectDiffuse ) \tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) \tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif`,NO=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) \tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; #endif`,RO=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) \tuniform float logDepthBufFC; \tvarying float vFragDepth; \tvarying float vIsPerspective; #endif`,EO=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER \tvarying float vFragDepth; \tvarying float vIsPerspective; #endif`,FO=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER \tvFragDepth = 1.0 + gl_Position.w; \tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); #endif`,OO=`#ifdef USE_MAP \tvec4 sampledDiffuseColor = texture2D( map, vMapUv ); \t#ifdef DECODE_VIDEO_TEXTURE \t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); \t#endif \tdiffuseColor *= sampledDiffuseColor; #endif`,MO=`#ifdef USE_MAP \tuniform sampler2D map; #endif`,LO=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) \t#if defined( USE_POINTS_UV ) \t\tvec2 uv = vUv; \t#else \t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; \t#endif #endif #ifdef USE_MAP \tdiffuseColor *= texture2D( map, uv ); #endif #ifdef USE_ALPHAMAP \tdiffuseColor.a *= texture2D( alphaMap, uv ).g; #endif`,BO=`#if defined( USE_POINTS_UV ) \tvarying vec2 vUv; #else \t#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) \t\tuniform mat3 uvTransform; \t#endif #endif #ifdef USE_MAP \tuniform sampler2D map; #endif #ifdef USE_ALPHAMAP \tuniform sampler2D alphaMap; #endif`,DO=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP \tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); \tmetalnessFactor *= texelMetalness.b; #endif`,zO=`#ifdef USE_METALNESSMAP \tuniform sampler2D metalnessMap; #endif`,VO=`#ifdef USE_INSTANCING_MORPH \tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ]; \tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; \tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { \t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; \t} #endif`,kO=`#if defined( USE_MORPHCOLORS ) \tvColor *= morphTargetBaseInfluence; \tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { \t\t#if defined( USE_COLOR_ALPHA ) \t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; \t\t#elif defined( USE_COLOR ) \t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; \t\t#endif \t} #endif`,CO=`#ifdef USE_MORPHNORMALS \tobjectNormal *= morphTargetBaseInfluence; \tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { \t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; \t} #endif`,IO=`#ifdef USE_MORPHTARGETS \t#ifndef USE_INSTANCING_MORPH \t\tuniform float morphTargetBaseInfluence; \t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; \t#endif \tuniform sampler2DArray morphTargetsTexture; \tuniform ivec2 morphTargetsTextureSize; \tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { \t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; \t\tint y = texelIndex / morphTargetsTextureSize.x; \t\tint x = texelIndex - y * morphTargetsTextureSize.x; \t\tivec3 morphUV = ivec3( x, y, morphTargetIndex ); \t\treturn texelFetch( morphTargetsTexture, morphUV, 0 ); \t} #endif`,PO=`#ifdef USE_MORPHTARGETS \ttransformed *= morphTargetBaseInfluence; \tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { \t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; \t} #endif`,AO=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED \tvec3 fdx = dFdx( vViewPosition ); \tvec3 fdy = dFdy( vViewPosition ); \tvec3 normal = normalize( cross( fdx, fdy ) ); #else \tvec3 normal = normalize( vNormal ); \t#ifdef DOUBLE_SIDED \t\tnormal *= faceDirection; \t#endif #endif #if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) \t#ifdef USE_TANGENT \t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); \t#else \t\tmat3 tbn = getTangentFrame( - vViewPosition, normal, \t\t#if defined( USE_NORMALMAP ) \t\t\tvNormalMapUv \t\t#elif defined( USE_CLEARCOAT_NORMALMAP ) \t\t\tvClearcoatNormalMapUv \t\t#else \t\t\tvUv \t\t#endif \t\t); \t#endif \t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) \t\ttbn[0] *= faceDirection; \t\ttbn[1] *= faceDirection; \t#endif #endif #ifdef USE_CLEARCOAT_NORMALMAP \t#ifdef USE_TANGENT \t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); \t#else \t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); \t#endif \t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) \t\ttbn2[0] *= faceDirection; \t\ttbn2[1] *= faceDirection; \t#endif #endif vec3 nonPerturbedNormal = normal;`,wO=`#ifdef USE_NORMALMAP_OBJECTSPACE \tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; \t#ifdef FLIP_SIDED \t\tnormal = - normal; \t#endif \t#ifdef DOUBLE_SIDED \t\tnormal = normal * faceDirection; \t#endif \tnormal = normalize( normalMatrix * normal ); #elif defined( USE_NORMALMAP_TANGENTSPACE ) \tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; \tmapN.xy *= normalScale; \tnormal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) \tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); #endif`,SO=`#ifndef FLAT_SHADED \tvarying vec3 vNormal; \t#ifdef USE_TANGENT \t\tvarying vec3 vTangent; \t\tvarying vec3 vBitangent; \t#endif #endif`,TO=`#ifndef FLAT_SHADED \tvarying vec3 vNormal; \t#ifdef USE_TANGENT \t\tvarying vec3 vTangent; \t\tvarying vec3 vBitangent; \t#endif #endif`,jO=`#ifndef FLAT_SHADED \tvNormal = normalize( transformedNormal ); \t#ifdef USE_TANGENT \t\tvTangent = normalize( transformedTangent ); \t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); \t#endif #endif`,_O=`#ifdef USE_NORMALMAP \tuniform sampler2D normalMap; \tuniform vec2 normalScale; #endif #ifdef USE_NORMALMAP_OBJECTSPACE \tuniform mat3 normalMatrix; #endif #if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) \tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { \t\tvec3 q0 = dFdx( eye_pos.xyz ); \t\tvec3 q1 = dFdy( eye_pos.xyz ); \t\tvec2 st0 = dFdx( uv.st ); \t\tvec2 st1 = dFdy( uv.st ); \t\tvec3 N = surf_norm; \t\tvec3 q1perp = cross( q1, N ); \t\tvec3 q0perp = cross( N, q0 ); \t\tvec3 T = q1perp * st0.x + q0perp * st1.x; \t\tvec3 B = q1perp * st0.y + q0perp * st1.y; \t\tfloat det = max( dot( T, T ), dot( B, B ) ); \t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); \t\treturn mat3( T * scale, B * scale, N ); \t} #endif`,xO=`#ifdef USE_CLEARCOAT \tvec3 clearcoatNormal = nonPerturbedNormal; #endif`,bO=`#ifdef USE_CLEARCOAT_NORMALMAP \tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; \tclearcoatMapN.xy *= clearcoatNormalScale; \tclearcoatNormal = normalize( tbn2 * clearcoatMapN ); #endif`,yO=`#ifdef USE_CLEARCOATMAP \tuniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP \tuniform sampler2D clearcoatNormalMap; \tuniform vec2 clearcoatNormalScale; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP \tuniform sampler2D clearcoatRoughnessMap; #endif`,hO=`#ifdef USE_IRIDESCENCEMAP \tuniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP \tuniform sampler2D iridescenceThicknessMap; #endif`,fO=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,vO=`vec3 packNormalToRGB( const in vec3 normal ) { \treturn normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { \treturn 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 ) { \tif( v <= 0.0 ) \t\treturn vec4( 0., 0., 0., 0. ); \tif( v >= 1.0 ) \t\treturn vec4( 1., 1., 1., 1. ); \tfloat vuf; \tfloat af = modf( v * PackFactors.a, vuf ); \tfloat bf = modf( vuf * ShiftRight8, vuf ); \tfloat gf = modf( vuf * ShiftRight8, vuf ); \treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); } vec3 packDepthToRGB( const in float v ) { \tif( v <= 0.0 ) \t\treturn vec3( 0., 0., 0. ); \tif( v >= 1.0 ) \t\treturn vec3( 1., 1., 1. ); \tfloat vuf; \tfloat bf = modf( v * PackFactors.b, vuf ); \tfloat gf = modf( vuf * ShiftRight8, vuf ); \treturn vec3( vuf * Inv255, gf * PackUpscale, bf ); } vec2 packDepthToRG( const in float v ) { \tif( v <= 0.0 ) \t\treturn vec2( 0., 0. ); \tif( v >= 1.0 ) \t\treturn vec2( 1., 1. ); \tfloat vuf; \tfloat gf = modf( v * 256., vuf ); \treturn vec2( vuf * Inv255, gf ); } float unpackRGBAToDepth( const in vec4 v ) { \treturn dot( v, UnpackFactors4 ); } float unpackRGBToDepth( const in vec3 v ) { \treturn dot( v, UnpackFactors3 ); } float unpackRGToDepth( const in vec2 v ) { \treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; } vec4 pack2HalfToRGBA( const in vec2 v ) { \tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); \treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); } vec2 unpackRGBATo2Half( const in vec4 v ) { \treturn 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 ) { \treturn ( viewZ + near ) / ( near - far ); } float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { \treturn depth * ( near - far ) - near; } float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { \treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); } float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { \treturn ( near * far ) / ( ( far - near ) * depth - far ); }`,gO=`#ifdef PREMULTIPLIED_ALPHA \tgl_FragColor.rgb *= gl_FragColor.a; #endif`,pO=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING \tmvPosition = batchingMatrix * mvPosition; #endif #ifdef USE_INSTANCING \tmvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; gl_Position = projectionMatrix * mvPosition;`,mO=`#ifdef DITHERING \tgl_FragColor.rgb = dithering( gl_FragColor.rgb ); #endif`,dO=`#ifdef DITHERING \tvec3 dithering( vec3 color ) { \t\tfloat grid_position = rand( gl_FragCoord.xy ); \t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); \t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); \t\treturn color + dither_shift_RGB; \t} #endif`,uO=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP \tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); \troughnessFactor *= texelRoughness.g; #endif`,lO=`#ifdef USE_ROUGHNESSMAP \tuniform sampler2D roughnessMap; #endif`,cO=`#if NUM_SPOT_LIGHT_COORDS > 0 \tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #if NUM_SPOT_LIGHT_MAPS > 0 \tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; #endif #ifdef USE_SHADOWMAP \t#if NUM_DIR_LIGHT_SHADOWS > 0 \t\t#if defined( SHADOWMAP_TYPE_PCF ) \t\t\tuniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; \t\t#else \t\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; \t\t#endif \t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; \t\tstruct DirectionalLightShadow { \t\t\tfloat shadowIntensity; \t\t\tfloat shadowBias; \t\t\tfloat shadowNormalBias; \t\t\tfloat shadowRadius; \t\t\tvec2 shadowMapSize; \t\t}; \t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; \t#endif \t#if NUM_SPOT_LIGHT_SHADOWS > 0 \t\t#if defined( SHADOWMAP_TYPE_PCF ) \t\t\tuniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; \t\t#else \t\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; \t\t#endif \t\tstruct SpotLightShadow { \t\t\tfloat shadowIntensity; \t\t\tfloat shadowBias; \t\t\tfloat shadowNormalBias; \t\t\tfloat shadowRadius; \t\t\tvec2 shadowMapSize; \t\t}; \t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; \t#endif \t#if NUM_POINT_LIGHT_SHADOWS > 0 \t\t#if defined( SHADOWMAP_TYPE_PCF ) \t\t\tuniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; \t\t#elif defined( SHADOWMAP_TYPE_BASIC ) \t\t\tuniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; \t\t#endif \t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; \t\tstruct PointLightShadow { \t\t\tfloat shadowIntensity; \t\t\tfloat shadowBias; \t\t\tfloat shadowNormalBias; \t\t\tfloat shadowRadius; \t\t\tvec2 shadowMapSize; \t\t\tfloat shadowCameraNear; \t\t\tfloat shadowCameraFar; \t\t}; \t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; \t#endif \t#if defined( SHADOWMAP_TYPE_PCF ) \t\tfloat interleavedGradientNoise( vec2 position ) { \t\t\treturn fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) ); \t\t} \t\tvec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) { \t\t\tconst float goldenAngle = 2.399963229728653; \t\t\tfloat r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) ); \t\t\tfloat theta = float( sampleIndex ) * goldenAngle + phi; \t\t\treturn vec2( cos( theta ), sin( theta ) ) * r; \t\t} \t#endif \t#if defined( SHADOWMAP_TYPE_PCF ) \t\tfloat getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { \t\t\tfloat shadow = 1.0; \t\t\tshadowCoord.xyz /= shadowCoord.w; \t\t\tshadowCoord.z += shadowBias; \t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; \t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0; \t\t\tif ( frustumTest ) { \t\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize; \t\t\t\tfloat radius = shadowRadius * texelSize.x; \t\t\t\tfloat phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718; \t\t\t\tshadow = ( \t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) + \t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) + \t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) + \t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) + \t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) ) \t\t\t\t) * 0.2; \t\t\t} \t\t\treturn mix( 1.0, shadow, shadowIntensity ); \t\t} \t#elif defined( SHADOWMAP_TYPE_VSM ) \t\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { \t\t\tfloat shadow = 1.0; \t\t\tshadowCoord.xyz /= shadowCoord.w; \t\t\tshadowCoord.z += shadowBias; \t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; \t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0; \t\t\tif ( frustumTest ) { \t\t\t\tvec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg; \t\t\t\tfloat mean = distribution.x; \t\t\t\tfloat variance = distribution.y * distribution.y; \t\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER \t\t\t\t\tfloat hard_shadow = step( mean, shadowCoord.z ); \t\t\t\t#else \t\t\t\t\tfloat hard_shadow = step( shadowCoord.z, mean ); \t\t\t\t#endif \t\t\t\tif ( hard_shadow == 1.0 ) { \t\t\t\t\tshadow = 1.0; \t\t\t\t} else { \t\t\t\t\tvariance = max( variance, 0.0000001 ); \t\t\t\t\tfloat d = shadowCoord.z - mean; \t\t\t\t\tfloat p_max = variance / ( variance + d * d ); \t\t\t\t\tp_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 ); \t\t\t\t\tshadow = max( hard_shadow, p_max ); \t\t\t\t} \t\t\t} \t\t\treturn mix( 1.0, shadow, shadowIntensity ); \t\t} \t#else \t\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { \t\t\tfloat shadow = 1.0; \t\t\tshadowCoord.xyz /= shadowCoord.w; \t\t\tshadowCoord.z += shadowBias; \t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; \t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0; \t\t\tif ( frustumTest ) { \t\t\t\tfloat depth = texture2D( shadowMap, shadowCoord.xy ).r; \t\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER \t\t\t\t\tshadow = step( depth, shadowCoord.z ); \t\t\t\t#else \t\t\t\t\tshadow = step( shadowCoord.z, depth ); \t\t\t\t#endif \t\t\t} \t\t\treturn mix( 1.0, shadow, shadowIntensity ); \t\t} \t#endif \t#if NUM_POINT_LIGHT_SHADOWS > 0 \t#if defined( SHADOWMAP_TYPE_PCF ) \tfloat getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { \t\tfloat shadow = 1.0; \t\tvec3 lightToPosition = shadowCoord.xyz; \t\tvec3 bd3D = normalize( lightToPosition ); \t\tvec3 absVec = abs( lightToPosition ); \t\tfloat viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); \t\tif ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { \t\t\tfloat dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); \t\t\tdp += shadowBias; \t\t\tfloat texelSize = shadowRadius / shadowMapSize.x; \t\t\tvec3 absDir = abs( bd3D ); \t\t\tvec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 ); \t\t\ttangent = normalize( cross( bd3D, tangent ) ); \t\t\tvec3 bitangent = cross( bd3D, tangent ); \t\t\tfloat phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718; \t\t\tshadow = ( \t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 0, 5, phi ).x + bitangent * vogelDiskSample( 0, 5, phi ).y ) * texelSize, dp ) ) + \t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 1, 5, phi ).x + bitangent * vogelDiskSample( 1, 5, phi ).y ) * texelSize, dp ) ) + \t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 2, 5, phi ).x + bitangent * vogelDiskSample( 2, 5, phi ).y ) * texelSize, dp ) ) + \t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 3, 5, phi ).x + bitangent * vogelDiskSample( 3, 5, phi ).y ) * texelSize, dp ) ) + \t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 4, 5, phi ).x + bitangent * vogelDiskSample( 4, 5, phi ).y ) * texelSize, dp ) ) \t\t\t) * 0.2; \t\t} \t\treturn mix( 1.0, shadow, shadowIntensity ); \t} \t#elif defined( SHADOWMAP_TYPE_BASIC ) \tfloat getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { \t\tfloat shadow = 1.0; \t\tvec3 lightToPosition = shadowCoord.xyz; \t\tvec3 bd3D = normalize( lightToPosition ); \t\tvec3 absVec = abs( lightToPosition ); \t\tfloat viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); \t\tif ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { \t\t\tfloat dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); \t\t\tdp += shadowBias; \t\t\tfloat depth = textureCube( shadowMap, bd3D ).r; \t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER \t\t\t\tshadow = step( depth, dp ); \t\t\t#else \t\t\t\tshadow = step( dp, depth ); \t\t\t#endif \t\t} \t\treturn mix( 1.0, shadow, shadowIntensity ); \t} \t#endif \t#endif #endif`,sO=`#if NUM_SPOT_LIGHT_COORDS > 0 \tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; \tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #ifdef USE_SHADOWMAP \t#if NUM_DIR_LIGHT_SHADOWS > 0 \t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; \t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; \t\tstruct DirectionalLightShadow { \t\t\tfloat shadowIntensity; \t\t\tfloat shadowBias; \t\t\tfloat shadowNormalBias; \t\t\tfloat shadowRadius; \t\t\tvec2 shadowMapSize; \t\t}; \t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; \t#endif \t#if NUM_SPOT_LIGHT_SHADOWS > 0 \t\tstruct SpotLightShadow { \t\t\tfloat shadowIntensity; \t\t\tfloat shadowBias; \t\t\tfloat shadowNormalBias; \t\t\tfloat shadowRadius; \t\t\tvec2 shadowMapSize; \t\t}; \t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; \t#endif \t#if NUM_POINT_LIGHT_SHADOWS > 0 \t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; \t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; \t\tstruct PointLightShadow { \t\t\tfloat shadowIntensity; \t\t\tfloat shadowBias; \t\t\tfloat shadowNormalBias; \t\t\tfloat shadowRadius; \t\t\tvec2 shadowMapSize; \t\t\tfloat shadowCameraNear; \t\t\tfloat shadowCameraFar; \t\t}; \t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; \t#endif #endif`,nO=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) \tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); \tvec4 shadowWorldPosition; #endif #if defined( USE_SHADOWMAP ) \t#if NUM_DIR_LIGHT_SHADOWS > 0 \t\t#pragma unroll_loop_start \t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { \t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); \t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; \t\t} \t\t#pragma unroll_loop_end \t#endif \t#if NUM_POINT_LIGHT_SHADOWS > 0 \t\t#pragma unroll_loop_start \t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { \t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); \t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; \t\t} \t\t#pragma unroll_loop_end \t#endif #endif #if NUM_SPOT_LIGHT_COORDS > 0 \t#pragma unroll_loop_start \tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { \t\tshadowWorldPosition = worldPosition; \t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) \t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; \t\t#endif \t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; \t} \t#pragma unroll_loop_end #endif`,oO=`float getShadowMask() { \tfloat shadow = 1.0; \t#ifdef USE_SHADOWMAP \t#if NUM_DIR_LIGHT_SHADOWS > 0 \tDirectionalLightShadow directionalLight; \t#pragma unroll_loop_start \tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { \t\tdirectionalLight = directionalLightShadows[ i ]; \t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; \t} \t#pragma unroll_loop_end \t#endif \t#if NUM_SPOT_LIGHT_SHADOWS > 0 \tSpotLightShadow spotLight; \t#pragma unroll_loop_start \tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { \t\tspotLight = spotLightShadows[ i ]; \t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; \t} \t#pragma unroll_loop_end \t#endif \t#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) \tPointLightShadow pointLight; \t#pragma unroll_loop_start \tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { \t\tpointLight = pointLightShadows[ i ]; \t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; \t} \t#pragma unroll_loop_end \t#endif \t#endif \treturn shadow; }`,iO=`#ifdef USE_SKINNING \tmat4 boneMatX = getBoneMatrix( skinIndex.x ); \tmat4 boneMatY = getBoneMatrix( skinIndex.y ); \tmat4 boneMatZ = getBoneMatrix( skinIndex.z ); \tmat4 boneMatW = getBoneMatrix( skinIndex.w ); #endif`,aO=`#ifdef USE_SKINNING \tuniform mat4 bindMatrix; \tuniform mat4 bindMatrixInverse; \tuniform highp sampler2D boneTexture; \tmat4 getBoneMatrix( const in float i ) { \t\tint size = textureSize( boneTexture, 0 ).x; \t\tint j = int( i ) * 4; \t\tint x = j % size; \t\tint y = j / size; \t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); \t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); \t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); \t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); \t\treturn mat4( v1, v2, v3, v4 ); \t} #endif`,rO=`#ifdef USE_SKINNING \tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); \tvec4 skinned = vec4( 0.0 ); \tskinned += boneMatX * skinVertex * skinWeight.x; \tskinned += boneMatY * skinVertex * skinWeight.y; \tskinned += boneMatZ * skinVertex * skinWeight.z; \tskinned += boneMatW * skinVertex * skinWeight.w; \ttransformed = ( bindMatrixInverse * skinned ).xyz; #endif`,tO=`#ifdef USE_SKINNING \tmat4 skinMatrix = mat4( 0.0 ); \tskinMatrix += skinWeight.x * boneMatX; \tskinMatrix += skinWeight.y * boneMatY; \tskinMatrix += skinWeight.z * boneMatZ; \tskinMatrix += skinWeight.w * boneMatW; \tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; \tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; \t#ifdef USE_TANGENT \t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; \t#endif #endif`,eO=`float specularStrength; #ifdef USE_SPECULARMAP \tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); \tspecularStrength = texelSpecular.r; #else \tspecularStrength = 1.0; #endif`,JM=`#ifdef USE_SPECULARMAP \tuniform sampler2D specularMap; #endif`,QM=`#if defined( TONE_MAPPING ) \tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); #endif`,$M=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; vec3 LinearToneMapping( vec3 color ) { \treturn saturate( toneMappingExposure * color ); } vec3 ReinhardToneMapping( vec3 color ) { \tcolor *= toneMappingExposure; \treturn saturate( color / ( vec3( 1.0 ) + color ) ); } vec3 CineonToneMapping( vec3 color ) { \tcolor *= toneMappingExposure; \tcolor = max( vec3( 0.0 ), color - 0.004 ); \treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); } vec3 RRTAndODTFit( vec3 v ) { \tvec3 a = v * ( v + 0.0245786 ) - 0.000090537; \tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; \treturn a / b; } vec3 ACESFilmicToneMapping( vec3 color ) { \tconst mat3 ACESInputMat = mat3( \t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ), \t\tvec3( 0.04823, 0.01566, 0.83777 ) \t); \tconst mat3 ACESOutputMat = mat3( \t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ), \t\tvec3( -0.07367, -0.00605, 1.07602 ) \t); \tcolor *= toneMappingExposure / 0.6; \tcolor = ACESInputMat * color; \tcolor = RRTAndODTFit( color ); \tcolor = ACESOutputMat * color; \treturn saturate( color ); } const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( \tvec3( 1.6605, - 0.1246, - 0.0182 ), \tvec3( - 0.5876, 1.1329, - 0.1006 ), \tvec3( - 0.0728, - 0.0083, 1.1187 ) ); const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( \tvec3( 0.6274, 0.0691, 0.0164 ), \tvec3( 0.3293, 0.9195, 0.0880 ), \tvec3( 0.0433, 0.0113, 0.8956 ) ); vec3 agxDefaultContrastApprox( vec3 x ) { \tvec3 x2 = x * x; \tvec3 x4 = x2 * x2; \treturn + 15.5 * x4 * x2 \t\t- 40.14 * x4 * x \t\t+ 31.96 * x4 \t\t- 6.868 * x2 * x \t\t+ 0.4298 * x2 \t\t+ 0.1191 * x \t\t- 0.00232; } vec3 AgXToneMapping( vec3 color ) { \tconst mat3 AgXInsetMatrix = mat3( \t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), \t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), \t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) \t); \tconst mat3 AgXOutsetMatrix = mat3( \t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), \t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), \t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) \t); \tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069; \tcolor *= toneMappingExposure; \tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color; \tcolor = AgXInsetMatrix * color; \tcolor = max( color, 1e-10 );\tcolor = log2( color ); \tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); \tcolor = clamp( color, 0.0, 1.0 ); \tcolor = agxDefaultContrastApprox( color ); \tcolor = AgXOutsetMatrix * color; \tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); \tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color; \tcolor = clamp( color, 0.0, 1.0 ); \treturn color; } vec3 NeutralToneMapping( vec3 color ) { \tconst float StartCompression = 0.8 - 0.04; \tconst float Desaturation = 0.15; \tcolor *= toneMappingExposure; \tfloat x = min( color.r, min( color.g, color.b ) ); \tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04; \tcolor -= offset; \tfloat peak = max( color.r, max( color.g, color.b ) ); \tif ( peak < StartCompression ) return color; \tfloat d = 1. - StartCompression; \tfloat newPeak = 1. - d * d / ( peak + d - StartCompression ); \tcolor *= newPeak / peak; \tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); \treturn mix( color, vec3( newPeak ), g ); } vec3 CustomToneMapping( vec3 color ) { return color; }`,ZM=`#ifdef USE_TRANSMISSION \tmaterial.transmission = transmission; \tmaterial.transmissionAlpha = 1.0; \tmaterial.thickness = thickness; \tmaterial.attenuationDistance = attenuationDistance; \tmaterial.attenuationColor = attenuationColor; \t#ifdef USE_TRANSMISSIONMAP \t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; \t#endif \t#ifdef USE_THICKNESSMAP \t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; \t#endif \tvec3 pos = vWorldPosition; \tvec3 v = normalize( cameraPosition - pos ); \tvec3 n = inverseTransformDirection( normal, viewMatrix ); \tvec4 transmitted = getIBLVolumeRefraction( \t\tn, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90, \t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, \t\tmaterial.attenuationColor, material.attenuationDistance ); \tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); \ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); #endif`,WM=`#ifdef USE_TRANSMISSION \tuniform float transmission; \tuniform float thickness; \tuniform float attenuationDistance; \tuniform vec3 attenuationColor; \t#ifdef USE_TRANSMISSIONMAP \t\tuniform sampler2D transmissionMap; \t#endif \t#ifdef USE_THICKNESSMAP \t\tuniform sampler2D thicknessMap; \t#endif \tuniform vec2 transmissionSamplerSize; \tuniform sampler2D transmissionSamplerMap; \tuniform mat4 modelMatrix; \tuniform mat4 projectionMatrix; \tvarying vec3 vWorldPosition; \tfloat w0( float a ) { \t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); \t} \tfloat w1( float a ) { \t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); \t} \tfloat w2( float a ){ \t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); \t} \tfloat w3( float a ) { \t\treturn ( 1.0 / 6.0 ) * ( a * a * a ); \t} \tfloat g0( float a ) { \t\treturn w0( a ) + w1( a ); \t} \tfloat g1( float a ) { \t\treturn w2( a ) + w3( a ); \t} \tfloat h0( float a ) { \t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); \t} \tfloat h1( float a ) { \t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); \t} \tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { \t\tuv = uv * texelSize.zw + 0.5; \t\tvec2 iuv = floor( uv ); \t\tvec2 fuv = fract( uv ); \t\tfloat g0x = g0( fuv.x ); \t\tfloat g1x = g1( fuv.x ); \t\tfloat h0x = h0( fuv.x ); \t\tfloat h1x = h1( fuv.x ); \t\tfloat h0y = h0( fuv.y ); \t\tfloat h1y = h1( fuv.y ); \t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; \t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; \t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; \t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; \t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + \t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); \t} \tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { \t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); \t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); \t\tvec2 fLodSizeInv = 1.0 / fLodSize; \t\tvec2 cLodSizeInv = 1.0 / cLodSize; \t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); \t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); \t\treturn mix( fSample, cSample, fract( lod ) ); \t} \tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { \t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); \t\tvec3 modelScale; \t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); \t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); \t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); \t\treturn normalize( refractionVector ) * thickness * modelScale; \t} \tfloat applyIorToRoughness( const in float roughness, const in float ior ) { \t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); \t} \tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { \t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); \t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); \t} \tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { \t\tif ( isinf( attenuationDistance ) ) { \t\t\treturn vec3( 1.0 ); \t\t} else { \t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; \t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance; \t\t} \t} \tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, \t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, \t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, \t\tconst in vec3 attenuationColor, const in float attenuationDistance ) { \t\tvec4 transmittedLight; \t\tvec3 transmittance; \t\t#ifdef USE_DISPERSION \t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; \t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); \t\t\tfor ( int i = 0; i < 3; i ++ ) { \t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); \t\t\t\tvec3 refractedRayExit = position + transmissionRay; \t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); \t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w; \t\t\t\trefractionCoords += 1.0; \t\t\t\trefractionCoords /= 2.0; \t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); \t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ]; \t\t\t\ttransmittedLight.a += transmissionSample.a; \t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; \t\t\t} \t\t\ttransmittedLight.a /= 3.0; \t\t#else \t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); \t\t\tvec3 refractedRayExit = position + transmissionRay; \t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); \t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w; \t\t\trefractionCoords += 1.0; \t\t\trefractionCoords /= 2.0; \t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); \t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); \t\t#endif \t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb; \t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); \t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; \t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); \t} #endif`,KM=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) \tvarying vec2 vUv; #endif #ifdef USE_MAP \tvarying vec2 vMapUv; #endif #ifdef USE_ALPHAMAP \tvarying vec2 vAlphaMapUv; #endif #ifdef USE_LIGHTMAP \tvarying vec2 vLightMapUv; #endif #ifdef USE_AOMAP \tvarying vec2 vAoMapUv; #endif #ifdef USE_BUMPMAP \tvarying vec2 vBumpMapUv; #endif #ifdef USE_NORMALMAP \tvarying vec2 vNormalMapUv; #endif #ifdef USE_EMISSIVEMAP \tvarying vec2 vEmissiveMapUv; #endif #ifdef USE_METALNESSMAP \tvarying vec2 vMetalnessMapUv; #endif #ifdef USE_ROUGHNESSMAP \tvarying vec2 vRoughnessMapUv; #endif #ifdef USE_ANISOTROPYMAP \tvarying vec2 vAnisotropyMapUv; #endif #ifdef USE_CLEARCOATMAP \tvarying vec2 vClearcoatMapUv; #endif #ifdef USE_CLEARCOAT_NORMALMAP \tvarying vec2 vClearcoatNormalMapUv; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP \tvarying vec2 vClearcoatRoughnessMapUv; #endif #ifdef USE_IRIDESCENCEMAP \tvarying vec2 vIridescenceMapUv; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP \tvarying vec2 vIridescenceThicknessMapUv; #endif #ifdef USE_SHEEN_COLORMAP \tvarying vec2 vSheenColorMapUv; #endif #ifdef USE_SHEEN_ROUGHNESSMAP \tvarying vec2 vSheenRoughnessMapUv; #endif #ifdef USE_SPECULARMAP \tvarying vec2 vSpecularMapUv; #endif #ifdef USE_SPECULAR_COLORMAP \tvarying vec2 vSpecularColorMapUv; #endif #ifdef USE_SPECULAR_INTENSITYMAP \tvarying vec2 vSpecularIntensityMapUv; #endif #ifdef USE_TRANSMISSIONMAP \tuniform mat3 transmissionMapTransform; \tvarying vec2 vTransmissionMapUv; #endif #ifdef USE_THICKNESSMAP \tuniform mat3 thicknessMapTransform; \tvarying vec2 vThicknessMapUv; #endif`,HM=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) \tvarying vec2 vUv; #endif #ifdef USE_MAP \tuniform mat3 mapTransform; \tvarying vec2 vMapUv; #endif #ifdef USE_ALPHAMAP \tuniform mat3 alphaMapTransform; \tvarying vec2 vAlphaMapUv; #endif #ifdef USE_LIGHTMAP \tuniform mat3 lightMapTransform; \tvarying vec2 vLightMapUv; #endif #ifdef USE_AOMAP \tuniform mat3 aoMapTransform; \tvarying vec2 vAoMapUv; #endif #ifdef USE_BUMPMAP \tuniform mat3 bumpMapTransform; \tvarying vec2 vBumpMapUv; #endif #ifdef USE_NORMALMAP \tuniform mat3 normalMapTransform; \tvarying vec2 vNormalMapUv; #endif #ifdef USE_DISPLACEMENTMAP \tuniform mat3 displacementMapTransform; \tvarying vec2 vDisplacementMapUv; #endif #ifdef USE_EMISSIVEMAP \tuniform mat3 emissiveMapTransform; \tvarying vec2 vEmissiveMapUv; #endif #ifdef USE_METALNESSMAP \tuniform mat3 metalnessMapTransform; \tvarying vec2 vMetalnessMapUv; #endif #ifdef USE_ROUGHNESSMAP \tuniform mat3 roughnessMapTransform; \tvarying vec2 vRoughnessMapUv; #endif #ifdef USE_ANISOTROPYMAP \tuniform mat3 anisotropyMapTransform; \tvarying vec2 vAnisotropyMapUv; #endif #ifdef USE_CLEARCOATMAP \tuniform mat3 clearcoatMapTransform; \tvarying vec2 vClearcoatMapUv; #endif #ifdef USE_CLEARCOAT_NORMALMAP \tuniform mat3 clearcoatNormalMapTransform; \tvarying vec2 vClearcoatNormalMapUv; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP \tuniform mat3 clearcoatRoughnessMapTransform; \tvarying vec2 vClearcoatRoughnessMapUv; #endif #ifdef USE_SHEEN_COLORMAP \tuniform mat3 sheenColorMapTransform; \tvarying vec2 vSheenColorMapUv; #endif #ifdef USE_SHEEN_ROUGHNESSMAP \tuniform mat3 sheenRoughnessMapTransform; \tvarying vec2 vSheenRoughnessMapUv; #endif #ifdef USE_IRIDESCENCEMAP \tuniform mat3 iridescenceMapTransform; \tvarying vec2 vIridescenceMapUv; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP \tuniform mat3 iridescenceThicknessMapTransform; \tvarying vec2 vIridescenceThicknessMapUv; #endif #ifdef USE_SPECULARMAP \tuniform mat3 specularMapTransform; \tvarying vec2 vSpecularMapUv; #endif #ifdef USE_SPECULAR_COLORMAP \tuniform mat3 specularColorMapTransform; \tvarying vec2 vSpecularColorMapUv; #endif #ifdef USE_SPECULAR_INTENSITYMAP \tuniform mat3 specularIntensityMapTransform; \tvarying vec2 vSpecularIntensityMapUv; #endif #ifdef USE_TRANSMISSIONMAP \tuniform mat3 transmissionMapTransform; \tvarying vec2 vTransmissionMapUv; #endif #ifdef USE_THICKNESSMAP \tuniform mat3 thicknessMapTransform; \tvarying vec2 vThicknessMapUv; #endif`,XM=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) \tvUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP \tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; #endif #ifdef USE_ALPHAMAP \tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; #endif #ifdef USE_LIGHTMAP \tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; #endif #ifdef USE_AOMAP \tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; #endif #ifdef USE_BUMPMAP \tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; #endif #ifdef USE_NORMALMAP \tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; #endif #ifdef USE_DISPLACEMENTMAP \tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; #endif #ifdef USE_EMISSIVEMAP \tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; #endif #ifdef USE_METALNESSMAP \tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_ROUGHNESSMAP \tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_ANISOTROPYMAP \tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOATMAP \tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOAT_NORMALMAP \tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP \tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_IRIDESCENCEMAP \tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP \tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_SHEEN_COLORMAP \tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; #endif #ifdef USE_SHEEN_ROUGHNESSMAP \tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULARMAP \tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULAR_COLORMAP \tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULAR_INTENSITYMAP \tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; #endif #ifdef USE_TRANSMISSIONMAP \tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; #endif #ifdef USE_THICKNESSMAP \tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; #endif`,YM=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 \tvec4 worldPosition = vec4( transformed, 1.0 ); \t#ifdef USE_BATCHING \t\tworldPosition = batchingMatrix * worldPosition; \t#endif \t#ifdef USE_INSTANCING \t\tworldPosition = instanceMatrix * worldPosition; \t#endif \tworldPosition = modelMatrix * worldPosition; #endif`,UM=`varying vec2 vUv; uniform mat3 uvTransform; void main() { \tvUv = ( uvTransform * vec3( uv, 1 ) ).xy; \tgl_Position = vec4( position.xy, 1.0, 1.0 ); }`,GM=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { \tvec4 texColor = texture2D( t2D, vUv ); \t#ifdef DECODE_VIDEO_TEXTURE \t\ttexColor = 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 ); \t#endif \ttexColor.rgb *= backgroundIntensity; \tgl_FragColor = texColor; \t#include \t#include }`,qM=`varying vec3 vWorldDirection; #include void main() { \tvWorldDirection = transformDirection( position, modelMatrix ); \t#include \t#include \tgl_Position.z = gl_Position.w; }`,NM=`#ifdef ENVMAP_TYPE_CUBE \tuniform samplerCube envMap; #elif defined( ENVMAP_TYPE_CUBE_UV ) \tuniform sampler2D envMap; #endif uniform float flipEnvMap; uniform float backgroundBlurriness; uniform float backgroundIntensity; uniform mat3 backgroundRotation; varying vec3 vWorldDirection; #include void main() { \t#ifdef ENVMAP_TYPE_CUBE \t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); \t#elif defined( ENVMAP_TYPE_CUBE_UV ) \t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); \t#else \t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); \t#endif \ttexColor.rgb *= backgroundIntensity; \tgl_FragColor = texColor; \t#include \t#include }`,RM=`varying vec3 vWorldDirection; #include void main() { \tvWorldDirection = transformDirection( position, modelMatrix ); \t#include \t#include \tgl_Position.z = gl_Position.w; }`,EM=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; void main() { \tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); \tgl_FragColor = texColor; \tgl_FragColor.a *= opacity; \t#include \t#include }`,FM=`#include #include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { \t#include \t#include \t#include \t#include \t#ifdef USE_DISPLACEMENTMAP \t\t#include \t\t#include \t\t#include \t#endif \t#include \t#include \t#include \t#include \t#include \t#include \t#include \tvHighPrecisionZW = gl_Position.zw; }`,OM=`#if DEPTH_PACKING == 3200 \tuniform float opacity; #endif #include #include #include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { \tvec4 diffuseColor = vec4( 1.0 ); \t#include \t#if DEPTH_PACKING == 3200 \t\tdiffuseColor.a = opacity; \t#endif \t#include \t#include \t#include \t#include \t#include \t#ifdef USE_REVERSED_DEPTH_BUFFER \t\tfloat fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; \t#else \t\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; \t#endif \t#if DEPTH_PACKING == 3200 \t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); \t#elif DEPTH_PACKING == 3201 \t\tgl_FragColor = packDepthToRGBA( fragCoordZ ); \t#elif DEPTH_PACKING == 3202 \t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); \t#elif DEPTH_PACKING == 3203 \t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); \t#endif }`,MM=`#define DISTANCE varying vec3 vWorldPosition; #include #include #include #include #include #include #include void main() { \t#include \t#include \t#include \t#include \t#ifdef USE_DISPLACEMENTMAP \t\t#include \t\t#include \t\t#include \t#endif \t#include \t#include \t#include \t#include \t#include \t#include \t#include \tvWorldPosition = worldPosition.xyz; }`,LM=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; varying vec3 vWorldPosition; #include #include #include #include #include #include #include void main () { \tvec4 diffuseColor = vec4( 1.0 ); \t#include \t#include \t#include \t#include \t#include \tfloat dist = length( vWorldPosition - referencePosition ); \tdist = ( dist - nearDistance ) / ( farDistance - nearDistance ); \tdist = saturate( dist ); \tgl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); }`,BM=`varying vec3 vWorldDirection; #include void main() { \tvWorldDirection = transformDirection( position, modelMatrix ); \t#include \t#include }`,DM=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { \tvec3 direction = normalize( vWorldDirection ); \tvec2 sampleUV = equirectUv( direction ); \tgl_FragColor = texture2D( tEquirect, sampleUV ); \t#include \t#include }`,zM=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include #include #include #include #include #include #include void main() { \tvLineDistance = scale * lineDistance; \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include }`,VM=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; varying float vLineDistance; #include #include #include #include #include #include #include void main() { \tvec4 diffuseColor = vec4( diffuse, opacity ); \t#include \tif ( mod( vLineDistance, totalSize ) > dashSize ) { \t\tdiscard; \t} \tvec3 outgoingLight = vec3( 0.0 ); \t#include \t#include \t#include \toutgoingLight = diffuseColor.rgb; \t#include \t#include \t#include \t#include \t#include }`,kM=`#include #include #include #include #include #include #include #include #include #include void main() { \t#include \t#include \t#include \t#include \t#include \t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) \t\t#include \t\t#include \t\t#include \t\t#include \t\t#include \t#endif \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include }`,CM=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED \tvarying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { \tvec4 diffuseColor = vec4( diffuse, opacity ); \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); \t#ifdef USE_LIGHTMAP \t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); \t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; \t#else \t\treflectedLight.indirectDiffuse += vec3( 1.0 ); \t#endif \t#include \treflectedLight.indirectDiffuse *= diffuseColor.rgb; \tvec3 outgoingLight = reflectedLight.indirectDiffuse; \t#include \t#include \t#include \t#include \t#include \t#include \t#include }`,IM=`#define LAMBERT varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \tvViewPosition = - mvPosition.xyz; \t#include \t#include \t#include \t#include }`,PM=`#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() { \tvec4 diffuseColor = vec4( diffuse, opacity ); \t#include \tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); \tvec3 totalEmissiveRadiance = emissive; \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; \t#include \t#include \t#include \t#include \t#include \t#include \t#include }`,AM=`#define MATCAP varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include void main() { \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \tvViewPosition = - mvPosition.xyz; }`,wM=`#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() { \tvec4 diffuseColor = vec4( diffuse, opacity ); \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \tvec3 viewDir = normalize( vViewPosition ); \tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); \tvec3 y = cross( viewDir, x ); \tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; \t#ifdef USE_MATCAP \t\tvec4 matcapColor = texture2D( matcap, uv ); \t#else \t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); \t#endif \tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; \t#include \t#include \t#include \t#include \t#include \t#include }`,SM=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) \tvarying vec3 vViewPosition; #endif #include #include #include #include #include #include #include #include #include void main() { \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) \tvViewPosition = - mvPosition.xyz; #endif }`,TM=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) \tvarying vec3 vViewPosition; #endif #include #include #include #include #include #include void main() { \tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); \t#include \t#include \t#include \t#include \tgl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a ); \t#ifdef OPAQUE \t\tgl_FragColor.a = 1.0; \t#endif }`,jM=`#define PHONG varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \tvViewPosition = - mvPosition.xyz; \t#include \t#include \t#include \t#include }`,_M=`#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() { \tvec4 diffuseColor = vec4( diffuse, opacity ); \t#include \tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); \tvec3 totalEmissiveRadiance = emissive; \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; \t#include \t#include \t#include \t#include \t#include \t#include \t#include }`,xM=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION \tvarying vec3 vWorldPosition; #endif #include #include #include #include #include #include #include #include #include #include #include #include void main() { \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \tvViewPosition = - mvPosition.xyz; \t#include \t#include \t#include #ifdef USE_TRANSMISSION \tvWorldPosition = worldPosition.xyz; #endif }`,bM=`#define STANDARD #ifdef PHYSICAL \t#define IOR \t#define USE_SPECULAR #endif uniform vec3 diffuse; uniform vec3 emissive; uniform float roughness; uniform float metalness; uniform float opacity; #ifdef IOR \tuniform float ior; #endif #ifdef USE_SPECULAR \tuniform float specularIntensity; \tuniform vec3 specularColor; \t#ifdef USE_SPECULAR_COLORMAP \t\tuniform sampler2D specularColorMap; \t#endif \t#ifdef USE_SPECULAR_INTENSITYMAP \t\tuniform sampler2D specularIntensityMap; \t#endif #endif #ifdef USE_CLEARCOAT \tuniform float clearcoat; \tuniform float clearcoatRoughness; #endif #ifdef USE_DISPERSION \tuniform float dispersion; #endif #ifdef USE_IRIDESCENCE \tuniform float iridescence; \tuniform float iridescenceIOR; \tuniform float iridescenceThicknessMinimum; \tuniform float iridescenceThicknessMaximum; #endif #ifdef USE_SHEEN \tuniform vec3 sheenColor; \tuniform float sheenRoughness; \t#ifdef USE_SHEEN_COLORMAP \t\tuniform sampler2D sheenColorMap; \t#endif \t#ifdef USE_SHEEN_ROUGHNESSMAP \t\tuniform sampler2D sheenRoughnessMap; \t#endif #endif #ifdef USE_ANISOTROPY \tuniform vec2 anisotropyVector; \t#ifdef USE_ANISOTROPYMAP \t\tuniform sampler2D anisotropyMap; \t#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() { \tvec4 diffuseColor = vec4( diffuse, opacity ); \t#include \tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); \tvec3 totalEmissiveRadiance = emissive; \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; \tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; \t#include \tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; \t#ifdef USE_SHEEN \t\toutgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect; \t#endif \t#ifdef USE_CLEARCOAT \t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); \t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); \t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; \t#endif \t#include \t#include \t#include \t#include \t#include \t#include }`,yM=`#define TOON varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include void main() { \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \tvViewPosition = - mvPosition.xyz; \t#include \t#include \t#include }`,hM=`#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() { \tvec4 diffuseColor = vec4( diffuse, opacity ); \t#include \tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); \tvec3 totalEmissiveRadiance = emissive; \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; \t#include \t#include \t#include \t#include \t#include \t#include }`,fM=`uniform float size; uniform float scale; #include #include #include #include #include #include #ifdef USE_POINTS_UV \tvarying vec2 vUv; \tuniform mat3 uvTransform; #endif void main() { \t#ifdef USE_POINTS_UV \t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy; \t#endif \t#include \t#include \t#include \t#include \t#include \t#include \tgl_PointSize = size; \t#ifdef USE_SIZEATTENUATION \t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix ); \t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); \t#endif \t#include \t#include \t#include \t#include }`,vM=`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include #include void main() { \tvec4 diffuseColor = vec4( diffuse, opacity ); \t#include \tvec3 outgoingLight = vec3( 0.0 ); \t#include \t#include \t#include \t#include \t#include \toutgoingLight = diffuseColor.rgb; \t#include \t#include \t#include \t#include \t#include }`,gM=`#include #include #include #include #include #include #include void main() { \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include \t#include }`,pM=`uniform vec3 color; uniform float opacity; #include #include #include #include #include #include #include void main() { \t#include \tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); \t#include \t#include \t#include }`,mM=`uniform float rotation; uniform vec2 center; #include #include #include #include #include void main() { \t#include \tvec4 mvPosition = modelViewMatrix[ 3 ]; \tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); \t#ifndef USE_SIZEATTENUATION \t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix ); \t\tif ( isPerspective ) scale *= - mvPosition.z; \t#endif \tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; \tvec2 rotatedPosition; \trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; \trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; \tmvPosition.xy += rotatedPosition; \tgl_Position = projectionMatrix * mvPosition; \t#include \t#include \t#include }`,dM=`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include #include #include void main() { \tvec4 diffuseColor = vec4( diffuse, opacity ); \t#include \tvec3 outgoingLight = vec3( 0.0 ); \t#include \t#include \t#include \t#include \t#include \toutgoingLight = diffuseColor.rgb; \t#include \t#include \t#include \t#include }`,J9={alphahash_fragment:GF,alphahash_pars_fragment:qF,alphamap_fragment:NF,alphamap_pars_fragment:RF,alphatest_fragment:EF,alphatest_pars_fragment:FF,aomap_fragment:OF,aomap_pars_fragment:MF,batching_pars_vertex:LF,batching_vertex:BF,begin_vertex:DF,beginnormal_vertex:zF,bsdfs:VF,iridescence_fragment:kF,bumpmap_pars_fragment:CF,clipping_planes_fragment:IF,clipping_planes_pars_fragment:PF,clipping_planes_pars_vertex:AF,clipping_planes_vertex:wF,color_fragment:SF,color_pars_fragment:TF,color_pars_vertex:jF,color_vertex:_F,common:xF,cube_uv_reflection_fragment:bF,defaultnormal_vertex:yF,displacementmap_pars_vertex:hF,displacementmap_vertex:fF,emissivemap_fragment:vF,emissivemap_pars_fragment:gF,colorspace_fragment:pF,colorspace_pars_fragment:mF,envmap_fragment:dF,envmap_common_pars_fragment:uF,envmap_pars_fragment:lF,envmap_pars_vertex:cF,envmap_physical_pars_fragment:$O,envmap_vertex:sF,fog_vertex:nF,fog_pars_vertex:oF,fog_fragment:iF,fog_pars_fragment:aF,gradientmap_pars_fragment:rF,lightmap_pars_fragment:tF,lights_lambert_fragment:eF,lights_lambert_pars_fragment:JO,lights_pars_begin:QO,lights_toon_fragment:ZO,lights_toon_pars_fragment:WO,lights_phong_fragment:KO,lights_phong_pars_fragment:HO,lights_physical_fragment:XO,lights_physical_pars_fragment:YO,lights_fragment_begin:UO,lights_fragment_maps:GO,lights_fragment_end:qO,logdepthbuf_fragment:NO,logdepthbuf_pars_fragment:RO,logdepthbuf_pars_vertex:EO,logdepthbuf_vertex:FO,map_fragment:OO,map_pars_fragment:MO,map_particle_fragment:LO,map_particle_pars_fragment:BO,metalnessmap_fragment:DO,metalnessmap_pars_fragment:zO,morphinstance_vertex:VO,morphcolor_vertex:kO,morphnormal_vertex:CO,morphtarget_pars_vertex:IO,morphtarget_vertex:PO,normal_fragment_begin:AO,normal_fragment_maps:wO,normal_pars_fragment:SO,normal_pars_vertex:TO,normal_vertex:jO,normalmap_pars_fragment:_O,clearcoat_normal_fragment_begin:xO,clearcoat_normal_fragment_maps:bO,clearcoat_pars_fragment:yO,iridescence_pars_fragment:hO,opaque_fragment:fO,packing:vO,premultiplied_alpha_fragment:gO,project_vertex:pO,dithering_fragment:mO,dithering_pars_fragment:dO,roughnessmap_fragment:uO,roughnessmap_pars_fragment:lO,shadowmap_pars_fragment:cO,shadowmap_pars_vertex:sO,shadowmap_vertex:nO,shadowmask_pars_fragment:oO,skinbase_vertex:iO,skinning_pars_vertex:aO,skinning_vertex:rO,skinnormal_vertex:tO,specularmap_fragment:eO,specularmap_pars_fragment:JM,tonemapping_fragment:QM,tonemapping_pars_fragment:$M,transmission_fragment:ZM,transmission_pars_fragment:WM,uv_pars_fragment:KM,uv_pars_vertex:HM,uv_vertex:XM,worldpos_vertex:YM,background_vert:UM,background_frag:GM,backgroundCube_vert:qM,backgroundCube_frag:NM,cube_vert:RM,cube_frag:EM,depth_vert:FM,depth_frag:OM,distance_vert:MM,distance_frag:LM,equirect_vert:BM,equirect_frag:DM,linedashed_vert:zM,linedashed_frag:VM,meshbasic_vert:kM,meshbasic_frag:CM,meshlambert_vert:IM,meshlambert_frag:PM,meshmatcap_vert:AM,meshmatcap_frag:wM,meshnormal_vert:SM,meshnormal_frag:TM,meshphong_vert:jM,meshphong_frag:_M,meshphysical_vert:xM,meshphysical_frag:bM,meshtoon_vert:yM,meshtoon_frag:hM,points_vert:fM,points_frag:vM,shadow_vert:gM,shadow_frag:pM,sprite_vert:mM,sprite_frag:dM},F0={common:{diffuse:{value:new c0(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 c0(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 c0(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 c0(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([F0.common,F0.specularmap,F0.envmap,F0.aomap,F0.lightmap,F0.fog]),vertexShader:J9.meshbasic_vert,fragmentShader:J9.meshbasic_frag},lambert:{uniforms:PJ([F0.common,F0.specularmap,F0.envmap,F0.aomap,F0.lightmap,F0.emissivemap,F0.bumpmap,F0.normalmap,F0.displacementmap,F0.fog,F0.lights,{emissive:{value:new c0(0)}}]),vertexShader:J9.meshlambert_vert,fragmentShader:J9.meshlambert_frag},phong:{uniforms:PJ([F0.common,F0.specularmap,F0.envmap,F0.aomap,F0.lightmap,F0.emissivemap,F0.bumpmap,F0.normalmap,F0.displacementmap,F0.fog,F0.lights,{emissive:{value:new c0(0)},specular:{value:new c0(1118481)},shininess:{value:30}}]),vertexShader:J9.meshphong_vert,fragmentShader:J9.meshphong_frag},standard:{uniforms:PJ([F0.common,F0.envmap,F0.aomap,F0.lightmap,F0.emissivemap,F0.bumpmap,F0.normalmap,F0.displacementmap,F0.roughnessmap,F0.metalnessmap,F0.fog,F0.lights,{emissive:{value:new c0(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:J9.meshphysical_vert,fragmentShader:J9.meshphysical_frag},toon:{uniforms:PJ([F0.common,F0.aomap,F0.lightmap,F0.emissivemap,F0.bumpmap,F0.normalmap,F0.displacementmap,F0.gradientmap,F0.fog,F0.lights,{emissive:{value:new c0(0)}}]),vertexShader:J9.meshtoon_vert,fragmentShader:J9.meshtoon_frag},matcap:{uniforms:PJ([F0.common,F0.bumpmap,F0.normalmap,F0.displacementmap,F0.fog,{matcap:{value:null}}]),vertexShader:J9.meshmatcap_vert,fragmentShader:J9.meshmatcap_frag},points:{uniforms:PJ([F0.points,F0.fog]),vertexShader:J9.points_vert,fragmentShader:J9.points_frag},dashed:{uniforms:PJ([F0.common,F0.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:J9.linedashed_vert,fragmentShader:J9.linedashed_frag},depth:{uniforms:PJ([F0.common,F0.displacementmap]),vertexShader:J9.depth_vert,fragmentShader:J9.depth_frag},normal:{uniforms:PJ([F0.common,F0.bumpmap,F0.normalmap,F0.displacementmap,{opacity:{value:1}}]),vertexShader:J9.meshnormal_vert,fragmentShader:J9.meshnormal_frag},sprite:{uniforms:PJ([F0.sprite,F0.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([F0.common,F0.displacementmap,{referencePosition:{value:new f},nearDistance:{value:1},farDistance:{value:1000}}]),vertexShader:J9.distance_vert,fragmentShader:J9.distance_frag},shadow:{uniforms:PJ([F0.lights,F0.fog,{color:{value:new c0(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 c0(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 c0(0)},specularColor:{value:new c0(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 uW={r:0,b:0,g:0},PQ=new g8,uM=new r0;function lM(J,Q,$,Z,W,K,H){let X=new c0(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 F(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 E(D,B){let A=M(B);if(A&&(A.isCubeTexture||A.mapping===DZ)){if(G===void 0)G=new a9(new A$(1,1,1),new fJ({name:"BackgroundCubeMaterial",uniforms:kQ(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(PQ.copy(B.backgroundRotation),PQ.x*=-1,PQ.y*=-1,PQ.z*=-1,A.isCubeTexture&&A.isRenderTargetTexture===!1)PQ.y*=-1,PQ.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(uM.makeRotationFromEuler(PQ)),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 a9(new IQ(2,2),new fJ({name:"BackgroundMaterial",uniforms:kQ(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(uW,VX(J)),Z.buffers.color.setClear(uW.r,uW.g,uW.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:F,addToRenderList:E,dispose:k}}function cM(J,Q){let $=J.getParameter(J.MAX_VERTEX_ATTRIBS),Z={},W=N(null),K=W,H=!1;function X(V,_,b,m,v){let s=!1,p=q(m,b,_);if(K!==p)K=p,U(K.object);if(s=R(V,m,b,v),s)M(V,m,b,v);if(v!==null)Q.update(v,J.ELEMENT_ARRAY_BUFFER);if(s||H){if(H=!1,B(V,_,b,m),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 m=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 p=s[m];if(p===void 0)p=N(Y()),s[m]=p;return p}function N(V){let _=[],b=[],m=[];for(let v=0;v<$;v++)_[v]=0,b[v]=0,m[v]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:_,enabledAttributes:b,attributeDivisors:m,object:V,attributes:{},index:null}}function R(V,_,b,m){let v=K.attributes,s=_.attributes,p=0,h=b.getAttributes();for(let c in h)if(h[c].location>=0){let j=v[c],$0=s[c];if($0===void 0){if(c==="instanceMatrix"&&V.instanceMatrix)$0=V.instanceMatrix;if(c==="instanceColor"&&V.instanceColor)$0=V.instanceColor}if(j===void 0)return!0;if(j.attribute!==$0)return!0;if($0&&j.data!==$0.data)return!0;p++}if(K.attributesNum!==p)return!0;if(K.index!==m)return!0;return!1}function M(V,_,b,m){let v={},s=_.attributes,p=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 $0={};if($0.attribute=j,j&&j.data)$0.data=j.data;v[c]=$0,p++}K.attributes=v,K.attributesNum=p,K.index=m}function F(){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:$0}=t,L0=Q.get(t);if(L0===void 0)continue;let{buffer:a0,type:_0,bytesPerElement:i}=L0,K0=_0===J.INT||_0===J.UNSIGNED_INT||t.gpuType===wH;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),F=J.getParameter(J.MAX_TEXTURE_SIZE),E=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:F,maxCubemapSize:E,maxAttributes:O,maxVertexUniforms:k,maxVaryings:D,maxFragmentUniforms:B,maxSamples:A,samples:C}}function oM(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:F,clipShadows:E}=q,O=J.get(q);if(!W||M===null||M.length===0||K&&!E)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=F?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 F=q!==null?q.length:0,E=null;if(F!==0){if(E=Y.value,M!==!0||E===null){let O=R+F*4,k=N.matrixWorldInverse;if(X.getNormalMatrix(k),E===null||E.length0){let U=new PW(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,bG=[0.125,0.215,0.35,0.446,0.526,0.582],wQ=20,aM=256,fZ=new V7,yG=new c0,fX=null,vX=0,gX=0,pX=!1,rM=new f;class uX{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=rM}=W;fX=this._renderer.getRenderTarget(),vX=this._renderer.getActiveCubeFace(),gX=this._renderer.getActiveMipmapLevel(),pX=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=vG(),this._compileMaterial(this._cubemapMaterial)}compileEquirectangularShader(){if(this._equirectMaterial===null)this._equirectMaterial=fG(),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),E)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===LQ;if(Z){if(this._cubemapMaterial===null)this._cubemapMaterial=vG();this._cubemapMaterial.uniforms.flipEnvMap.value=J.isRenderTargetTexture===!1?-1:1}else if(this._equirectMaterial===null)this._equirectMaterial=fG();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,fZ)}_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),E=4*(this._cubeSize-M);X.envMap.value=J.texture,X.roughness.value=N,X.mipInt.value=R-Q,_$(W,F,E,3*M,2*M),Z.setRenderTarget(W),Z.render(H,fZ),X.envMap.value=W.texture,X.roughness.value=0,X.mipInt.value=R-$,_$(J,F,E,3*M,2*M),Z.setRenderTarget(J),Z.render(H,fZ)}_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*wQ-1),M=W/R,F=isFinite(W)?1+Math.floor(U*M):wQ;if(F>wQ)j0(`sigmaRadians, ${W}, is too large and will clip, as it requested ${F} samples when the maximum is set to ${wQ}`);let E=[],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,fZ)}}function tM(J){let Q=[],$=[],Z=[],W=J,K=J-a7+1+bG.length;for(let H=0;HJ-a7)Y=bG[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,F=3,E=2,O=1,k=new Float32Array(F*M*R),D=new Float32Array(E*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,F*M*C),D.set(N,E*M*C);let V=[C,C,C,C,C,C];B.set(V,O*M*C)}let A=new OJ;if(A.setAttribute("position",new ZJ(k,F)),A.setAttribute("uv",new ZJ(D,E)),A.setAttribute("faceIndex",new ZJ(B,O)),Z.push(new a9(A,null)),W>a7)W--}return{lodMeshes:Z,sizeLods:Q,sigmas:$}}function hG(J,Q,$){let Z=new aJ(J,Q,$);return Z.texture.mapping=DZ,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 eM(J,Q,$){return new fJ({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:aM,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:cW(),fragmentShader:` \t\t\tprecision highp float; \t\t\tprecision highp int; \t\t\tvarying vec3 vOutputDirection; \t\t\tuniform sampler2D envMap; \t\t\tuniform float roughness; \t\t\tuniform float mipInt; \t\t\t#define ENVMAP_TYPE_CUBE_UV \t\t\t#include \t\t\t#define PI 3.14159265359 \t\t\t// Van der Corput radical inverse \t\t\tfloat radicalInverse_VdC(uint bits) { \t\t\t\tbits = (bits << 16u) | (bits >> 16u); \t\t\t\tbits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); \t\t\t\tbits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); \t\t\t\tbits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); \t\t\t\tbits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); \t\t\t\treturn float(bits) * 2.3283064365386963e-10; // / 0x100000000 \t\t\t} \t\t\t// Hammersley sequence \t\t\tvec2 hammersley(uint i, uint N) { \t\t\t\treturn vec2(float(i) / float(N), radicalInverse_VdC(i)); \t\t\t} \t\t\t// GGX VNDF importance sampling (Eric Heitz 2018) \t\t\t// "Sampling the GGX Distribution of Visible Normals" \t\t\t// https://jcgt.org/published/0007/04/01/ \t\t\tvec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { \t\t\t\tfloat alpha = roughness * roughness; \t\t\t\t// Section 3.2: Transform view direction to hemisphere configuration \t\t\t\tvec3 Vh = normalize(vec3(alpha * V.x, alpha * V.y, V.z)); \t\t\t\t// Section 4.1: Orthonormal basis \t\t\t\tfloat lensq = Vh.x * Vh.x + Vh.y * Vh.y; \t\t\t\tvec3 T1 = lensq > 0.0 ? vec3(-Vh.y, Vh.x, 0.0) / sqrt(lensq) : vec3(1.0, 0.0, 0.0); \t\t\t\tvec3 T2 = cross(Vh, T1); \t\t\t\t// Section 4.2: Parameterization of projected area \t\t\t\tfloat r = sqrt(Xi.x); \t\t\t\tfloat phi = 2.0 * PI * Xi.y; \t\t\t\tfloat t1 = r * cos(phi); \t\t\t\tfloat t2 = r * sin(phi); \t\t\t\tfloat s = 0.5 * (1.0 + Vh.z); \t\t\t\tt2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; \t\t\t\t// Section 4.3: Reprojection onto hemisphere \t\t\t\tvec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * Vh; \t\t\t\t// Section 3.4: Transform back to ellipsoid configuration \t\t\t\treturn normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); \t\t\t} \t\t\tvoid main() { \t\t\t\tvec3 N = normalize(vOutputDirection); \t\t\t\tvec3 V = N; // Assume view direction equals normal for pre-filtering \t\t\t\tvec3 prefilteredColor = vec3(0.0); \t\t\t\tfloat totalWeight = 0.0; \t\t\t\t// For very low roughness, just sample the environment directly \t\t\t\tif (roughness < 0.001) { \t\t\t\t\tgl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); \t\t\t\t\treturn; \t\t\t\t} \t\t\t\t// Tangent space basis for VNDF sampling \t\t\t\tvec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); \t\t\t\tvec3 tangent = normalize(cross(up, N)); \t\t\t\tvec3 bitangent = cross(N, tangent); \t\t\t\tfor(uint i = 0u; i < uint(GGX_SAMPLES); i++) { \t\t\t\t\tvec2 Xi = hammersley(i, uint(GGX_SAMPLES)); \t\t\t\t\t// For PMREM, V = N, so in tangent space V is always (0, 0, 1) \t\t\t\t\tvec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); \t\t\t\t\t// Transform H back to world space \t\t\t\t\tvec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); \t\t\t\t\tvec3 L = normalize(2.0 * dot(V, H) * H - V); \t\t\t\t\tfloat NdotL = max(dot(N, L), 0.0); \t\t\t\t\tif(NdotL > 0.0) { \t\t\t\t\t\t// Sample environment at fixed mip level \t\t\t\t\t\t// VNDF importance sampling handles the distribution filtering \t\t\t\t\t\tvec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); \t\t\t\t\t\t// Weight by NdotL for the split-sum approximation \t\t\t\t\t\t// VNDF PDF naturally accounts for the visible microfacet distribution \t\t\t\t\t\tprefilteredColor += sampleColor * NdotL; \t\t\t\t\t\ttotalWeight += NdotL; \t\t\t\t\t} \t\t\t\t} \t\t\t\tif (totalWeight > 0.0) { \t\t\t\t\tprefilteredColor = prefilteredColor / totalWeight; \t\t\t\t} \t\t\t\tgl_FragColor = vec4(prefilteredColor, 1.0); \t\t\t} \t\t`,blending:p8,depthTest:!1,depthWrite:!1})}function JL(J,Q,$){let Z=new Float32Array(wQ),W=new f(0,1,0);return new fJ({name:"SphericalGaussianBlur",defines:{n:wQ,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:cW(),fragmentShader:` \t\t\tprecision mediump float; \t\t\tprecision mediump int; \t\t\tvarying vec3 vOutputDirection; \t\t\tuniform sampler2D envMap; \t\t\tuniform int samples; \t\t\tuniform float weights[ n ]; \t\t\tuniform bool latitudinal; \t\t\tuniform float dTheta; \t\t\tuniform float mipInt; \t\t\tuniform vec3 poleAxis; \t\t\t#define ENVMAP_TYPE_CUBE_UV \t\t\t#include \t\t\tvec3 getSample( float theta, vec3 axis ) { \t\t\t\tfloat cosTheta = cos( theta ); \t\t\t\t// Rodrigues' axis-angle rotation \t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta \t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta ) \t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); \t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt ); \t\t\t} \t\t\tvoid main() { \t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); \t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) { \t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); \t\t\t\t} \t\t\t\taxis = normalize( axis ); \t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); \t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); \t\t\t\tfor ( int i = 1; i < n; i++ ) { \t\t\t\t\tif ( i >= samples ) { \t\t\t\t\t\tbreak; \t\t\t\t\t} \t\t\t\t\tfloat theta = dTheta * float( i ); \t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); \t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); \t\t\t\t} \t\t\t} \t\t`,blending:p8,depthTest:!1,depthWrite:!1})}function fG(){return new fJ({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:cW(),fragmentShader:` \t\t\tprecision mediump float; \t\t\tprecision mediump int; \t\t\tvarying vec3 vOutputDirection; \t\t\tuniform sampler2D envMap; \t\t\t#include \t\t\tvoid main() { \t\t\t\tvec3 outputDirection = normalize( vOutputDirection ); \t\t\t\tvec2 uv = equirectUv( outputDirection ); \t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); \t\t\t} \t\t`,blending:p8,depthTest:!1,depthWrite:!1})}function vG(){return new fJ({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:cW(),fragmentShader:` \t\t\tprecision mediump float; \t\t\tprecision mediump int; \t\t\tuniform float flipEnvMap; \t\t\tvarying vec3 vOutputDirection; \t\t\tuniform samplerCube envMap; \t\t\tvoid main() { \t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); \t\t\t} \t\t`,blending:p8,depthTest:!1,depthWrite:!1})}function cW(){return` \t\tprecision mediump float; \t\tprecision mediump int; \t\tattribute float faceIndex; \t\tvarying vec3 vOutputDirection; \t\t// RH coordinate system; PMREM face-indexing convention \t\tvec3 getDirection( vec2 uv, float face ) { \t\t\tuv = 2.0 * uv - 1.0; \t\t\tvec3 direction = vec3( uv, 1.0 ); \t\t\tif ( face == 0.0 ) { \t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x \t\t\t} else if ( face == 1.0 ) { \t\t\t\tdirection = direction.xzy; \t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y \t\t\t} else if ( face == 2.0 ) { \t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z \t\t\t} else if ( face == 3.0 ) { \t\t\t\tdirection = direction.zyx; \t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x \t\t\t} else if ( face == 4.0 ) { \t\t\t\tdirection = direction.xzy; \t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y \t\t\t} else if ( face == 5.0 ) { \t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z \t\t\t} \t\t\treturn direction; \t\t} \t\tvoid main() { \t\t\tvOutputDirection = getDirection( uv, faceIndex ); \t\t\tgl_Position = vec4( position, 1.0 ); \t\t} \t`}function QL(J){let Q=new WeakMap,$=null;function Z(X){if(X&&X.isTexture){let Y=X.mapping,U=Y===YW||Y===UW,G=Y===D$||Y===LQ;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 uX(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 uX(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 BW(C,B,A,q);w.type=L7,w.needsUpdate=!0;let T=D*4;for(let V=0;V \t\t\t#include \t\t\tvoid main() { \t\t\t\tgl_FragColor = texture2D( tDiffuse, vUv ); \t\t\t\t#ifdef LINEAR_TONE_MAPPING \t\t\t\t\tgl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); \t\t\t\t#elif defined( REINHARD_TONE_MAPPING ) \t\t\t\t\tgl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); \t\t\t\t#elif defined( CINEON_TONE_MAPPING ) \t\t\t\t\tgl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); \t\t\t\t#elif defined( ACES_FILMIC_TONE_MAPPING ) \t\t\t\t\tgl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); \t\t\t\t#elif defined( AGX_TONE_MAPPING ) \t\t\t\t\tgl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); \t\t\t\t#elif defined( NEUTRAL_TONE_MAPPING ) \t\t\t\t\tgl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); \t\t\t\t#elif defined( CUSTOM_TONE_MAPPING ) \t\t\t\t\tgl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); \t\t\t\t#endif \t\t\t\t#ifdef SRGB_TRANSFER \t\t\t\t\tgl_FragColor = sRGBTransferOETF( gl_FragColor ); \t\t\t\t#endif \t\t\t}`,depthTest:!1,depthWrite:!1}),U=new a9(X,Y),G=new V7(-1,1,1,-1,0,1),q=null,N=null,R=!1,M,F=null,E=[],O=!1;this.setSize=function(k,D){K.setSize(k,D),H.setSize(k,D);for(let B=0;B0&&E[0].isRenderPass===!0;let{width:D,height:B}=K;for(let A=0;A0)return J;let W=Q*$,K=gG[W];if(K===void 0)K=new Float32Array(W),gG[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 WJ(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 cG(J,Q,$){let Z=J.createShader(Q);return J.shaderSource(Z,$),J.compileShader(Z),Z}var rL=37297,tL=0;function eL(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 sG=new t0;function JB(J){X9._getMatrix(sG,X9.workingColorSpace,J);let Q=`mat3( ${sG.elements.map(($)=>$.toFixed(4))} )`;switch(X9.getTransfer(J)){case EX:return[Q,"LinearTransferOETF"];case A9:return[Q,"sRGBTransferOETF"];default:return j0("WebGLProgram: Unsupported color space: ",J),[Q,"LinearTransferOETF"]}}function nG(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+` `+eL(J.getShaderSource(Q),X)}else return K}function QB(J,Q){let $=JB(Q);return[`vec4 ${J}( vec4 value ) {`,`\treturn ${$[1]}( vec4( value.rgb * ${$[0]}, value.a ) );`,"}"].join(` `)}var $B={[zH]:"Linear",[VH]:"Reinhard",[kH]:"Cineon",[CH]:"ACESFilmic",[PH]:"AgX",[AH]:"Neutral",[IH]:"Custom"};function ZB(J,Q){let $=$B[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 lW=new f;function WB(){X9.getLuminanceCoefficients(lW);let J=lW.x.toFixed(4),Q=lW.y.toFixed(4),$=lW.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`\tconst vec3 weights = vec3( ${J}, ${Q}, ${$} );`,"\treturn dot( weights, rgb );","}"].join(` `)}function KB(J){return[J.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",J.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(gZ).join(` `)}function HB(J){let Q=[];for(let $ in J){let Z=J[$];if(Z===!1)continue;Q.push("#define "+$+" "+Z)}return Q.join(` `)}function XB(J,Q){let $={},Z=J.getProgramParameter(Q,J.ACTIVE_ATTRIBUTES);for(let W=0;W/gm;function cX(J){return J.replace(YB,GB)}var UB=new Map;function GB(J,Q){let $=J9[Q];if($===void 0){let Z=UB.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 cX($)}var qB=/#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 aG(J){return J.replace(qB,NB)}function NB(J,Q,$,Z){let W="";for(let K=parseInt(Q);K0)E+=` `;if(O=["#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,M].filter(gZ).join(` `),O.length>0)O+=` `}else E=[rG($),"#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(gZ).join(` `),O=[rG($),"#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?ZB("toneMapping",$.toneMapping):"",$.dithering?"#define DITHERING":"",$.opaque?"#define OPAQUE":"",J9.colorspace_pars_fragment,QB("linearToOutputTexel",$.outputColorSpace),WB(),$.useDepthPacking?"#define DEPTH_PACKING "+$.depthPacking:"",` `].filter(gZ).join(` `);if(H=cX(H),H=oG(H,$),H=iG(H,$),X=cX(X),X=oG(X,$),X=iG(X,$),H=aG(H),X=aG(X),$.isRawShaderMaterial!==!0)k=`#version 300 es `,E=[R,"#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` `+E,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+E+H,B=k+O+X,A=cG(W,W.VERTEX_SHADER,D),C=cG(W,W.FRAGMENT_SHADER,B);if(W.attachShader(F,A),W.attachShader(F,C),$.index0AttributeName!==void 0)W.bindAttribLocation(F,0,$.index0AttributeName);else if($.morphTargets===!0)W.bindAttribLocation(F,0,"position");W.linkProgram(F);function w(_){if(J.debug.checkShaderErrors){let b=W.getProgramInfoLog(F)||"",m=W.getShaderInfoLog(A)||"",v=W.getShaderInfoLog(C)||"",s=b.trim(),p=m.trim(),h=v.trim(),c=!0,t=!0;if(W.getProgramParameter(F,W.LINK_STATUS)===!1)if(c=!1,typeof J.debug.onShaderError==="function")J.debug.onShaderError(W,F,A,C);else{let j=nG(W,A,"vertex"),$0=nG(W,C,"fragment");d0("THREE.WebGLProgram: Shader Error "+W.getError()+" - VALIDATE_STATUS "+W.getProgramParameter(F,W.VALIDATE_STATUS)+` Material Name: `+_.name+` Material Type: `+_.type+` Program Info Log: `+s+` `+j+` `+$0)}else if(s!=="")j0("WebGLProgram: Program Info Log:",s);else if(p===""||h==="")t=!1;if(t)_.diagnostics={runnable:c,programLog:s,vertexShader:{log:p,prefix:E},fragmentShader:{log:h,prefix:O}}}W.deleteShader(A),W.deleteShader(C),T=new pZ(W,F),z=XB(W,F)}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(F,rL);return V},this.destroy=function(){Z.releaseStatesOfProgram(this),W.deleteProgram(F),this.program=void 0},this.type=$.shaderType,this.name=$.shaderName,this.id=tL++,this.cacheKey=Q,this.usedTimes=1,this.program=F,this.vertexShader=A,this.fragmentShader=C,this}var kB=0;class Gq{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 qq(J),Q.set(J,$);return $}}class qq{constructor(J){this.id=kB++,this.code=J,this.usedTimes=0}}function CB(J,Q,$,Z,W,K,H){let X=new DW,Y=new Gq,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 F(z){if(U.add(z),z===0)return"uv";return`uv${z}`}function E(z,V,_,b,m){let v=b.fog,s=m.geometry,p=z.isMeshStandardMaterial?b.environment:null,h=(z.isMeshStandardMaterial?$:Q).get(z.envMap||p),c=!!h&&h.mapping===DZ?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,$0=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 a0,_0,i,K0;if(t){let M0=t8[t];a0=M0.vertexShader,_0=M0.fragmentShader}else a0=z.vertexShader,_0=z.fragmentShader,Y.update(z),i=Y.getVertexShaderID(z),K0=Y.getFragmentShaderID(z);let J0=J.getRenderTarget(),k0=J.state.buffers.depth.getReversed(),I0=m.isInstancedMesh===!0,y0=m.isBatchedMesh===!0,U9=!!z.map,u0=!!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,Q0=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,x0=m8;if(z.toneMapped){if(J0===null||J0.isXRRenderTarget===!0)x0=J.toneMapping}let E9={shaderID:t,shaderType:z.type,shaderName:z.name,vertexShader:a0,fragmentShader:_0,defines:z.defines,customVertexShaderID:i,customFragmentShaderID:K0,isRawShaderMaterial:z.isRawShaderMaterial===!0,glslVersion:z.glslVersion,precision:R,batching:y0,batchingColor:y0&&m._colorsTexture!==null,instancing:I0,instancingColor:I0&&m.instanceColor!==null,instancingMorph:I0&&m.morphTexture!==null,outputColorSpace:J0===null?J.outputColorSpace:J0.isXRRenderTarget===!0?J0.texture.colorSpace:hJ,alphaToCoverage:!!z.alphaToCoverage,map:U9,matcap:u0,envMap:w0,envMapMode:w0&&h.mapping,envMapCubeUVHeight:c,aoMap:p0,lightMap:h0,bumpMap:N9,normalMap:P,displacementMap:O9,emissiveMap:m0,normalMapObjectSpace:P&&z.normalMapType===MG,normalMapTangentSpace:P&&z.normalMapType===OG,metalnessMap:R9,roughnessMap:U0,anisotropy:G9,anisotropyMap:n,clearcoat:S,clearcoatMap:O0,clearcoatNormalMap:H0,clearcoatRoughnessMap:S0,dispersion:L,iridescence:g,iridescenceMap:B0,iridescenceThicknessMap:Q0,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===LZ&&z.alphaToCoverage===!1,alphaMap:N0,alphaTest:e,alphaHash:o,combine:z.combine,mapUv:U9&&F(z.map.channel),aoMapUv:p0&&F(z.aoMap.channel),lightMapUv:h0&&F(z.lightMap.channel),bumpMapUv:N9&&F(z.bumpMap.channel),normalMapUv:P&&F(z.normalMap.channel),displacementMapUv:O9&&F(z.displacementMap.channel),emissiveMapUv:m0&&F(z.emissiveMap.channel),metalnessMapUv:R9&&F(z.metalnessMap.channel),roughnessMapUv:U0&&F(z.roughnessMap.channel),anisotropyMapUv:n&&F(z.anisotropyMap.channel),clearcoatMapUv:O0&&F(z.clearcoatMap.channel),clearcoatNormalMapUv:H0&&F(z.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:S0&&F(z.clearcoatRoughnessMap.channel),iridescenceMapUv:B0&&F(z.iridescenceMap.channel),iridescenceThicknessMapUv:Q0&&F(z.iridescenceThicknessMap.channel),sheenColorMapUv:Z0&&F(z.sheenColorMap.channel),sheenRoughnessMapUv:D0&&F(z.sheenRoughnessMap.channel),specularMapUv:C0&&F(z.specularMap.channel),specularColorMapUv:q0&&F(z.specularColorMap.channel),specularIntensityMapUv:s0&&F(z.specularIntensityMap.channel),transmissionMapUv:x&&F(z.transmissionMap.channel),thicknessMapUv:X0&&F(z.thicknessMap.channel),alphaMapUv:N0&&F(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:m.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:m.isSkinnedMesh===!0,morphTargets:s.morphAttributes.position!==void 0,morphNormals:s.morphAttributes.normal!==void 0,morphColors:s.morphAttributes.color!==void 0,morphTargetsCount:$0,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:x0,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 E9.vertexUv1s=U.has(1),E9.vertexUv2s=U.has(2),E9.vertexUv3s=U.has(3),U.clear(),E9}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];_=kW.clone(b.uniforms)}else _=z.uniforms;return _}function A(z,V){let _=q.get(V);if(_!==void 0)++_.usedTimes;else _=new VB(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:E,getProgramCacheKey:O,getUniforms:B,acquireProgram:A,releaseProgram:C,releaseShaderCache:w,programs:G,dispose:T}}function IB(){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 PB(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 tG(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 eG(){let J=[],Q=0,$=[],Z=[],W=[];function K(){Q=0,$.length=0,Z.length=0,W.length=0}function H(q,N,R,M,F,E){let O=J[Q];if(O===void 0)O={id:q.id,object:q,geometry:N,material:R,groupOrder:M,renderOrder:q.renderOrder,z:F,group:E},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=F,O.group=E;return Q++,O}function X(q,N,R,M,F,E){let O=H(q,N,R,M,F,E);if(R.transmission>0)Z.push(O);else if(R.transparent===!0)W.push(O);else $.push(O)}function Y(q,N,R,M,F,E){let O=H(q,N,R,M,F,E);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||PB);if(Z.length>1)Z.sort(N||tG);if(W.length>1)W.sort(N||tG)}function G(){for(let q=Q,N=J.length;q=K.length)H=new eG,K.push(H);else H=K[W];return H}function $(){J=new WeakMap}return{get:Q,dispose:$}}function wB(){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 c0};break;case"SpotLight":$={position:new f,direction:new f,color:new c0,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":$={position:new f,color:new c0,distance:0,decay:0};break;case"HemisphereLight":$={direction:new f,skyColor:new c0,groundColor:new c0};break;case"RectAreaLight":$={color:new c0,position:new f,halfWidth:new f,halfHeight:new f};break}return J[Q.id]=$,$}}}function SB(){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 TB=0;function jB(J,Q){return(Q.castShadow?2:0)-(J.castShadow?2:0)+(Q.map?1:0)-(J.map?1:0)}function _B(J){let Q=new wB,$=SB(),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,F=0,E=0,O=0,k=0,D=0,B=0,A=0,C=0,w=0;U.sort(jB);for(let z=0,V=U.length;z0)if(J.has("OES_texture_float_linear")===!0)Z.rectAreaLTC1=F0.LTC_FLOAT_1,Z.rectAreaLTC2=F0.LTC_FLOAT_2;else Z.rectAreaLTC1=F0.LTC_HALF_1,Z.rectAreaLTC2=F0.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!==F||T.rectAreaLength!==E||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=F,Z.rectArea.length=E,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=F,T.rectAreaLength=E,T.hemiLength=O,T.numDirectionalShadows=k,T.numPointShadows=D,T.numSpotShadows=B,T.numSpotMaps=A,T.numLightProbes=w,Z.version=TB++}function Y(U,G){let q=0,N=0,R=0,M=0,F=0,E=G.matrixWorldInverse;for(let O=0,k=U.length;O=H.length)X=new Jq(J),H.push(X);else X=H[K];return X}function Z(){Q=new WeakMap}return{get:$,dispose:Z}}var bB=`void main() { \tgl_Position = vec4( position, 1.0 ); }`,yB=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; void main() { \tconst float samples = float( VSM_SAMPLES ); \tfloat mean = 0.0; \tfloat squared_mean = 0.0; \tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); \tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0; \tfor ( float i = 0.0; i < samples; i ++ ) { \t\tfloat uvOffset = uvStart + i * uvStride; \t\t#ifdef HORIZONTAL_PASS \t\t\tvec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg; \t\t\tmean += distribution.x; \t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x; \t\t#else \t\t\tfloat depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r; \t\t\tmean += depth; \t\t\tsquared_mean += depth * depth; \t\t#endif \t} \tmean = mean / samples; \tsquared_mean = squared_mean / samples; \tfloat std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); \tgl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); }`,hB=[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)],fB=[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)],Qq=new r0,vZ=new f,dX=new f;function vB(J,Q,$){let Z=new TZ,W=new g0,K=new g0,H=new _9,X=new IX,Y=new PX,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:bB,fragmentShader:yB}),R=N.clone();R.defines.HORIZONTAL_PASS=1;let M=new OJ;M.setAttribute("position",new ZJ(new Float32Array([-1,-1,0.5,3,-1,0.5,-1,3,0.5]),3));let F=new a9(M,N),E=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=MZ;let O=this.type;this.render=function(C,w,T){if(E.enabled===!1)return;if(E.autoUpdate===!1&&E.needsUpdate===!1)return;if(C.length===0)return;if(C.type===g1)j0("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),C.type=MZ;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 m=O!==this.type;if(m)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||m===!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(p.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:FJ,magFilter:FJ,generateMipmaps:!1}),h.map.texture.name=p.name+".shadowMap",h.map.depthTexture=new CQ(W.x,W.y,L7),h.map.depthTexture.name=p.name+".shadowMapDepth",h.map.depthTexture.format=DQ,h.map.depthTexture.compareFunction=null,h.map.depthTexture.minFilter=d8,h.map.depthTexture.magFilter=d8}else{if(p.isPointLight)h.map=new PW(W.x),h.map.depthTexture=new CX(W.x,u7);else h.map=new aJ(W.x,W.y),h.map.depthTexture=new CQ(W.x,W.y,u7);h.map.depthTexture.name=p.name+".shadowMap",h.map.depthTexture.format=DQ;let j=J.state.buffers.depth.getReversed();if(this.type===MZ)h.map.depthTexture.compareFunction=j?LW:MW,h.map.depthTexture.minFilter=FJ,h.map.depthTexture.magFilter=FJ;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,m=w.uuid,v=U[b];if(v===void 0)v={},U[b]=v;let s=v[m];if(s===void 0)s=V.clone(),v[m]=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 m=Q.update(C),v=C.material;if(Array.isArray(v)){let s=m.groups;for(let p=0,h=s.length;p=1;else if(c.indexOf("OpenGL ES")!==-1)h=parseFloat(/^OpenGL ES (\d)/.exec(c)[1]),p=h>=2;let t=null,j={},$0=J.getParameter(J.SCISSOR_BOX),L0=J.getParameter(J.VIEWPORT),a0=new _9().fromArray($0),_0=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 E(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?EX: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===zZ)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===zZ)g=J.DEPTH_COMPONENT16;return g}function A(S,L){if(E(S)===!0||S.isFramebufferTexture&&S.minFilter!==d8&&S.minFilter!==FJ)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 p(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,[GW]:J.MIRRORED_REPEAT},j={[d8]:J.NEAREST,[qW]:J.NEAREST_MIPMAP_NEAREST,[BQ]:J.NEAREST_MIPMAP_LINEAR,[FJ]:J.LINEAR,[k$]:J.LINEAR_MIPMAP_NEAREST,[M7]:J.LINEAR_MIPMAP_LINEAR},$0={[LG]:J.NEVER,[kG]:J.ALWAYS,[BG]:J.LESS,[MW]:J.LEQUAL,[DG]:J.EQUAL,[LW]:J.GEQUAL,[zG]:J.GREATER,[VG]:J.NOTEQUAL};function L0(S,L){if(L.type===L7&&Q.has("OES_texture_float_linear")===!1&&(L.magFilter===FJ||L.magFilter===k$||L.magFilter===BQ||L.magFilter===M7||L.minFilter===FJ||L.minFilter===k$||L.minFilter===BQ||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,$0[L.compareFunction]);if(Q.has("EXT_texture_filter_anisotropic")===!0){if(L.magFilter===d8)return;if(L.minFilter!==BQ&&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 a0(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 _0(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((Q0,Z0)=>Q0.start-Z0.start);let O0=0;for(let Q0=1;Q00){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=hX(q0.width,q0.height,L.format,L.type);for(let x0 of L.layerUpdates){let E9=q0.data.subarray(x0*z0/q0.data.BYTES_PER_ELEMENT,(x0+1)*z0/q0.data.BYTES_PER_ELEMENT);$.compressedTexSubImage3D(J.TEXTURE_2D_ARRAY,e,0,0,x0,q0.width,q0.height,1,Z0,E9)}L.clearLayerUpdates()}else $.compressedTexSubImage3D(J.TEXTURE_2D_ARRAY,e,0,0,0,q0.width,q0.height,Q0.depth,Z0,q0.data)}else $.compressedTexImage3D(J.TEXTURE_2D_ARRAY,e,C0,q0.width,q0.height,Q0.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,Q0.depth,Z0,D0,q0.data)}else $.texImage3D(J.TEXTURE_2D_ARRAY,e,C0,q0.width,q0.height,Q0.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=hX(Q0.width,Q0.height,L.format,L.type);for(let o of L.layerUpdates){let z0=Q0.data.subarray(o*e/Q0.data.BYTES_PER_ELEMENT,(o+1)*e/Q0.data.BYTES_PER_ELEMENT);$.texSubImage3D(J.TEXTURE_2D_ARRAY,0,0,0,o,Q0.width,Q0.height,1,Z0,D0,z0)}L.clearLayerUpdates()}else $.texSubImage3D(J.TEXTURE_2D_ARRAY,0,0,0,0,Q0.width,Q0.height,Q0.depth,Z0,D0,Q0.data)}else $.texImage3D(J.TEXTURE_2D_ARRAY,0,C0,Q0.width,Q0.height,Q0.depth,0,Z0,D0,Q0.data);else if(L.isData3DTexture)if(x){if(X0)$.texStorage3D(J.TEXTURE_3D,N0,C0,Q0.width,Q0.height,Q0.depth);if(W0)$.texSubImage3D(J.TEXTURE_3D,0,0,0,0,Q0.width,Q0.height,Q0.depth,Z0,D0,Q0.data)}else $.texImage3D(J.TEXTURE_3D,0,C0,Q0.width,Q0.height,Q0.depth,0,Z0,D0,Q0.data);else if(L.isFramebufferTexture){if(X0)if(x)$.texStorage2D(J.TEXTURE_2D,N0,C0,Q0.width,Q0.height);else{let{width:e,height:o}=Q0;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(Q0){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,Q0.__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,Q0.__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 u0(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!==VQ)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=m,this.resetTextureUnits=b,this.setTexture2D=s,this.setTexture2DArray=p,this.setTexture3D=h,this.setTextureCube=c,this.rebindTextures=u0,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 dB(J,Q){function $(Z,W=VQ){let K,H=X9.getTransfer(W);if(Z===u8)return J.UNSIGNED_BYTE;if(Z===SH)return J.UNSIGNED_SHORT_4_4_4_4;if(Z===TH)return J.UNSIGNED_SHORT_5_5_5_1;if(Z===qG)return J.UNSIGNED_INT_5_9_9_9_REV;if(Z===NG)return J.UNSIGNED_INT_10F_11F_11F_REV;if(Z===UG)return J.BYTE;if(Z===GG)return J.SHORT;if(Z===zZ)return J.UNSIGNED_SHORT;if(Z===wH)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===RG)return J.ALPHA;if(Z===EG)return J.RGB;if(Z===i8)return J.RGBA;if(Z===DQ)return J.DEPTH_COMPONENT;if(Z===zQ)return J.DEPTH_STENCIL;if(Z===FG)return J.RED;if(Z===jH)return J.RED_INTEGER;if(Z===I$)return J.RG;if(Z===_H)return J.RG_INTEGER;if(Z===xH)return J.RGBA_INTEGER;if(Z===NW||Z===RW||Z===EW||Z===FW)if(H===A9)if(K=Q.get("WEBGL_compressed_texture_s3tc_srgb"),K!==null){if(Z===NW)return K.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(Z===RW)return K.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(Z===EW)return K.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(Z===FW)return K.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(K=Q.get("WEBGL_compressed_texture_s3tc"),K!==null){if(Z===NW)return K.COMPRESSED_RGB_S3TC_DXT1_EXT;if(Z===RW)return K.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(Z===EW)return K.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(Z===FW)return K.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(Z===bH||Z===yH||Z===hH||Z===fH)if(K=Q.get("WEBGL_compressed_texture_pvrtc"),K!==null){if(Z===bH)return K.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(Z===yH)return K.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(Z===hH)return K.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(Z===fH)return K.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(Z===vH||Z===gH||Z===pH||Z===mH||Z===dH||Z===uH||Z===lH)if(K=Q.get("WEBGL_compressed_texture_etc"),K!==null){if(Z===vH||Z===gH)return H===A9?K.COMPRESSED_SRGB8_ETC2:K.COMPRESSED_RGB8_ETC2;if(Z===pH)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:K.COMPRESSED_RGBA8_ETC2_EAC;if(Z===mH)return K.COMPRESSED_R11_EAC;if(Z===dH)return K.COMPRESSED_SIGNED_R11_EAC;if(Z===uH)return K.COMPRESSED_RG11_EAC;if(Z===lH)return K.COMPRESSED_SIGNED_RG11_EAC}else return null;if(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||Z===WX)if(K=Q.get("WEBGL_compressed_texture_astc"),K!==null){if(Z===cH)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:K.COMPRESSED_RGBA_ASTC_4x4_KHR;if(Z===sH)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:K.COMPRESSED_RGBA_ASTC_5x4_KHR;if(Z===nH)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:K.COMPRESSED_RGBA_ASTC_5x5_KHR;if(Z===oH)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:K.COMPRESSED_RGBA_ASTC_6x5_KHR;if(Z===iH)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:K.COMPRESSED_RGBA_ASTC_6x6_KHR;if(Z===aH)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:K.COMPRESSED_RGBA_ASTC_8x5_KHR;if(Z===rH)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:K.COMPRESSED_RGBA_ASTC_8x6_KHR;if(Z===tH)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:K.COMPRESSED_RGBA_ASTC_8x8_KHR;if(Z===eH)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:K.COMPRESSED_RGBA_ASTC_10x5_KHR;if(Z===JX)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:K.COMPRESSED_RGBA_ASTC_10x6_KHR;if(Z===QX)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:K.COMPRESSED_RGBA_ASTC_10x8_KHR;if(Z===$X)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:K.COMPRESSED_RGBA_ASTC_10x10_KHR;if(Z===ZX)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:K.COMPRESSED_RGBA_ASTC_12x10_KHR;if(Z===WX)return H===A9?K.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:K.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(Z===KX||Z===HX||Z===XX)if(K=Q.get("EXT_texture_compression_bptc"),K!==null){if(Z===KX)return H===A9?K.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:K.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(Z===HX)return K.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(Z===XX)return K.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(Z===YX||Z===UX||Z===GX||Z===qX)if(K=Q.get("EXT_texture_compression_rgtc"),K!==null){if(Z===YX)return K.COMPRESSED_RED_RGTC1_EXT;if(Z===UX)return K.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(Z===GX)return K.COMPRESSED_RED_GREEN_RGTC2_EXT;if(Z===qX)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 uB=` void main() { \tgl_Position = vec4( position, 1.0 ); }`,lB=` uniform sampler2DArray depthColor; uniform float depthWidth; uniform float depthHeight; void main() { \tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); \tif ( coord.x >= 1.0 ) { \t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; \t} else { \t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; \t} }`;class Nq{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(J,Q){if(this.texture===null){let $=new xW(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:uB,fragmentShader:lB,uniforms:{depthColor:{value:this.texture},depthWidth:{value:Q.z},depthHeight:{value:Q.w}}});this.mesh=new a9(new IQ(20,20),$)}}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Rq 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",F=new Nq,E={},O=Q.getContextAttributes(),k=null,D=null,B=[],A=[],C=new g0,w=null,T=new $J;T.viewport=new _9;let z=new $J;z.viewport=new _9;let V=[T,z],_=new xX,b=null,m=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(i){let K0=B[i];if(K0===void 0)K0=new IZ,B[i]=K0;return K0.getTargetRaySpace()},this.getControllerGrip=function(i){let K0=B[i];if(K0===void 0)K0=new IZ,B[i]=K0;return K0.getGripSpace()},this.getHand=function(i){let K0=B[i];if(K0===void 0)K0=new IZ,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",p);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),u0=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=u0+m0,S=P-R9,L=O9+(k0-R9),g=w0*u0/G9*U0,a=p0*u0/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(F.texture!==null){if(F.depthNear>0)K0=F.depthNear;if(F.depthFar>0)J0=F.depthFar}if(_.near=z.near=T.near=K0,_.far=z.far=T.far=J0,b!==_.near||m!==_.far)Z.updateRenderState({depthNear:_.near,depthFar:_.far}),b=_.near,m=_.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)E.alphaTest.value=O.alphaTest;let k=Q.get(O),D=k.envMap,B=k.envMapRotation;if(D){if(E.envMap.value=D,AQ.copy(B),AQ.x*=-1,AQ.y*=-1,AQ.z*=-1,D.isCubeTexture&&D.isRenderTargetTexture===!1)AQ.y*=-1,AQ.z*=-1;E.envMapRotation.value.setFromMatrix4(cB.makeRotationFromEuler(AQ)),E.flipEnvMap.value=D.isCubeTexture&&D.isRenderTargetTexture===!1?-1:1,E.reflectivity.value=O.reflectivity,E.ior.value=O.ior,E.refractionRatio.value=O.refractionRatio}if(O.lightMap)E.lightMap.value=O.lightMap,E.lightMapIntensity.value=O.lightMapIntensity,$(O.lightMap,E.lightMapTransform);if(O.aoMap)E.aoMap.value=O.aoMap,E.aoMapIntensity.value=O.aoMapIntensity,$(O.aoMap,E.aoMapTransform)}function H(E,O){if(E.diffuse.value.copy(O.color),E.opacity.value=O.opacity,O.map)E.map.value=O.map,$(O.map,E.mapTransform)}function X(E,O){E.dashSize.value=O.dashSize,E.totalSize.value=O.dashSize+O.gapSize,E.scale.value=O.scale}function Y(E,O,k,D){if(E.diffuse.value.copy(O.color),E.opacity.value=O.opacity,E.size.value=O.size*k,E.scale.value=D*0.5,O.map)E.map.value=O.map,$(O.map,E.uvTransform);if(O.alphaMap)E.alphaMap.value=O.alphaMap,$(O.alphaMap,E.alphaMapTransform);if(O.alphaTest>0)E.alphaTest.value=O.alphaTest}function U(E,O){if(E.diffuse.value.copy(O.color),E.opacity.value=O.opacity,E.rotation.value=O.rotation,O.map)E.map.value=O.map,$(O.map,E.mapTransform);if(O.alphaMap)E.alphaMap.value=O.alphaMap,$(O.alphaMap,E.alphaMapTransform);if(O.alphaTest>0)E.alphaTest.value=O.alphaTest}function G(E,O){E.specular.value.copy(O.specular),E.shininess.value=Math.max(O.shininess,0.0001)}function q(E,O){if(O.gradientMap)E.gradientMap.value=O.gradientMap}function N(E,O){if(E.metalness.value=O.metalness,O.metalnessMap)E.metalnessMap.value=O.metalnessMap,$(O.metalnessMap,E.metalnessMapTransform);if(E.roughness.value=O.roughness,O.roughnessMap)E.roughnessMap.value=O.roughnessMap,$(O.roughnessMap,E.roughnessMapTransform);if(O.envMap)E.envMapIntensity.value=O.envMapIntensity}function R(E,O,k){if(E.ior.value=O.ior,O.sheen>0){if(E.sheenColor.value.copy(O.sheenColor).multiplyScalar(O.sheen),E.sheenRoughness.value=O.sheenRoughness,O.sheenColorMap)E.sheenColorMap.value=O.sheenColorMap,$(O.sheenColorMap,E.sheenColorMapTransform);if(O.sheenRoughnessMap)E.sheenRoughnessMap.value=O.sheenRoughnessMap,$(O.sheenRoughnessMap,E.sheenRoughnessMapTransform)}if(O.clearcoat>0){if(E.clearcoat.value=O.clearcoat,E.clearcoatRoughness.value=O.clearcoatRoughness,O.clearcoatMap)E.clearcoatMap.value=O.clearcoatMap,$(O.clearcoatMap,E.clearcoatMapTransform);if(O.clearcoatRoughnessMap)E.clearcoatRoughnessMap.value=O.clearcoatRoughnessMap,$(O.clearcoatRoughnessMap,E.clearcoatRoughnessMapTransform);if(O.clearcoatNormalMap){if(E.clearcoatNormalMap.value=O.clearcoatNormalMap,$(O.clearcoatNormalMap,E.clearcoatNormalMapTransform),E.clearcoatNormalScale.value.copy(O.clearcoatNormalScale),O.side===U8)E.clearcoatNormalScale.value.negate()}}if(O.dispersion>0)E.dispersion.value=O.dispersion;if(O.iridescence>0){if(E.iridescence.value=O.iridescence,E.iridescenceIOR.value=O.iridescenceIOR,E.iridescenceThicknessMinimum.value=O.iridescenceThicknessRange[0],E.iridescenceThicknessMaximum.value=O.iridescenceThicknessRange[1],O.iridescenceMap)E.iridescenceMap.value=O.iridescenceMap,$(O.iridescenceMap,E.iridescenceMapTransform);if(O.iridescenceThicknessMap)E.iridescenceThicknessMap.value=O.iridescenceThicknessMap,$(O.iridescenceThicknessMap,E.iridescenceThicknessMapTransform)}if(O.transmission>0){if(E.transmission.value=O.transmission,E.transmissionSamplerMap.value=k.texture,E.transmissionSamplerSize.value.set(k.width,k.height),O.transmissionMap)E.transmissionMap.value=O.transmissionMap,$(O.transmissionMap,E.transmissionMapTransform);if(E.thickness.value=O.thickness,O.thicknessMap)E.thicknessMap.value=O.thicknessMap,$(O.thicknessMap,E.thicknessMapTransform);E.attenuationDistance.value=O.attenuationDistance,E.attenuationColor.value.copy(O.attenuationColor)}if(O.anisotropy>0){if(E.anisotropyVector.value.set(O.anisotropy*Math.cos(O.anisotropyRotation),O.anisotropy*Math.sin(O.anisotropyRotation)),O.anisotropyMap)E.anisotropyMap.value=O.anisotropyMap,$(O.anisotropyMap,E.anisotropyMapTransform)}if(E.specularIntensity.value=O.specularIntensity,E.specularColor.value.copy(O.specularColor),O.specularColorMap)E.specularColorMap.value=O.specularColorMap,$(O.specularColorMap,E.specularColorMapTransform);if(O.specularIntensityMap)E.specularIntensityMap.value=O.specularIntensityMap,$(O.specularIntensityMap,E.specularIntensityMapTransform)}function M(E,O){if(O.matcap)E.matcap.value=O.matcap}function F(E,O){let k=Q.get(O).light;E.referencePosition.value.setFromMatrixPosition(k.matrixWorld),E.nearDistance.value=k.shadow.camera.near,E.farDistance.value=k.shadow.camera.far}return{refreshFogUniforms:Z,refreshMaterialUniforms:W}}function nB(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",E);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 F(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 E(k){let D=k.target;D.removeEventListener("dispose",E);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 oB=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 iB(){if(r8===null)r8=new wZ(oB,16,16,I$,l8),r8.name="DFG_LUT",r8.minFilter=FJ,r8.magFilter=FJ,r8.wrapS=V$,r8.wrapT=V$,r8.generateMipmaps=!1,r8.needsUpdate=!0;return r8}class sX{constructor(J={}){let{canvas:Q=CG(),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,F=new Set([xH,_H,jH]),E=new Set([u8,u7,zZ,C$,SH,TH]),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,m=-1,v=null,s=new _9,p=new _9,h=null,c=new c0(0),t=0,j=Q.width,$0=Q.height,L0=1,a0=null,_0=null,i=new _9(0,0,j,$0),K0=new _9(0,0,j,$0),J0=!1,k0=new TZ,I0=!1,y0=!1,U9=new r0,u0=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${h1}`);if(Q.addEventListener("webglcontextlost",z0,!1),Q.addEventListener("webglcontextrestored",x0,!1),Q.addEventListener("webglcontextcreationerror",E9,!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,Q0,Z0,D0,C0,q0,s0,x,X0,W0,N0;function e(){if(m0=new $L(P),m0.init(),X0=new dB(P,m0),R9=new nM(P,m0,J,X0),U0=new pB(P,m0),R9.reversedDepthBuffer&&q)U0.buffers.depth.setReversed(!0);G9=new KL(P),S=new IB,L=new mB(P,m0,U0,S,R9,X0,G9),g=new iM(T),a=new QL(T),r=new UF(P),W0=new cM(P,r),n=new ZL(P,r,G9,W0),O0=new XL(P,n,r,G9),q0=new HL(P,R9,L),Z0=new oM(S),H0=new CB(T,g,a,m0,R9,W0,Z0),S0=new sB(T,S),B0=new AB,Q0=new xB(m0),C0=new lM(T,g,a,U0,O0,R,X),D0=new vB(T,O0,R9),N0=new nB(P,G9,R9,U0),s0=new sM(P,m0,G9),x=new WL(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 UL(M,Q.width,Q.height,Z,W);let o=new Rq(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,$0,!1)},this.getSize=function(I){return I.set(j,$0)},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,$0=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,$0*L0).floor()},this.setDrawingBufferSize=function(I,y,u){j=I,$0=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 b0(I){if(n0)n0(I)}function o0(){i0.stop()}function s9(){i0.start()}let i0=new $q;if(i0.setAnimationLoop(b0),typeof self!=="undefined")i0.setContext(self);this.setAnimationLoop=function(I){n0=I,o.setAnimationLoop(I),I===null?i0.stop():i0.start()},o.addEventListener("sessionstart",o0),o.addEventListener("sessionend",s9),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=Q0.get(I,C.length),B.init(y),C.push(B),U9.multiplyMatrices(y.projectionMatrix,y.matrixWorldInverse),k0.setFromProjectionMatrix(U9,OX,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(a0,_0);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,l0=V0.length;P00)y9(R0,G0,I,y);if(h0)C0.render(I);e9(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(),m=-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,l0=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 l0=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,m9=y.length;C90),f0=!!u.morphAttributes.position,W9=!!u.morphAttributes.normal,C9=!!u.morphAttributes.color,m9=m8;if(l.toneMapped){if(b===null||b.isXRRenderTarget===!0)m9=T.toneMapping}let d9=u.morphAttributes.position||u.morphAttributes.normal||u.morphAttributes.color,P9=d9!==void 0?d9.length:0,v0=S.get(l),z9=B.state.lights;if(I0===!0){if(y0===!0||I!==v){let bJ=I===v&&l.id===m;Z0.setState(l,I,bJ)}}let F9=!1;if(l.version===v0.__version){if(v0.needsLights&&v0.lightsStateVersion!==z9.state.version)F9=!0;else if(v0.outputColorSpace!==G0)F9=!0;else if(d.isBatchedMesh&&v0.batching===!1)F9=!0;else if(!d.isBatchedMesh&&v0.batching===!0)F9=!0;else if(d.isBatchedMesh&&v0.batchingColor===!0&&d.colorTexture===null)F9=!0;else if(d.isBatchedMesh&&v0.batchingColor===!1&&d.colorTexture!==null)F9=!0;else if(d.isInstancedMesh&&v0.instancing===!1)F9=!0;else if(!d.isInstancedMesh&&v0.instancing===!0)F9=!0;else if(d.isSkinnedMesh&&v0.skinning===!1)F9=!0;else if(!d.isSkinnedMesh&&v0.skinning===!0)F9=!0;else if(d.isInstancedMesh&&v0.instancingColor===!0&&d.instanceColor===null)F9=!0;else if(d.isInstancedMesh&&v0.instancingColor===!1&&d.instanceColor!==null)F9=!0;else if(d.isInstancedMesh&&v0.instancingMorph===!0&&d.morphTexture===null)F9=!0;else if(d.isInstancedMesh&&v0.instancingMorph===!1&&d.morphTexture!==null)F9=!0;else if(v0.envMap!==V0)F9=!0;else if(l.fog===!0&&v0.fog!==Y0)F9=!0;else if(v0.numClippingPlanes!==void 0&&(v0.numClippingPlanes!==Z0.numPlanes||v0.numIntersection!==Z0.numIntersection))F9=!0;else if(v0.vertexAlphas!==P0)F9=!0;else if(v0.vertexTangents!==l0)F9=!0;else if(v0.morphTargets!==f0)F9=!0;else if(v0.morphNormals!==W9)F9=!0;else if(v0.morphColors!==C9)F9=!0;else if(v0.toneMapping!==m9)F9=!0;else if(v0.morphTargetsCount!==P9)F9=!0}else F9=!0,v0.__version=l.version;let K8=v0.currentProgram;if(F9===!0)K8=VJ(l,y,d);let eQ=!1,H8=!1,WZ=!1,j9=K8.getUniforms(),sJ=v0.uniforms;if(U0.useProgram(K8.program))eQ=!0,H8=!0,WZ=!0;if(l.id!==m)m=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,u0.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,WZ=!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 V8=u.morphAttributes;if(V8.position!==void 0||V8.normal!==void 0||V8.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=iB();if(H8){if(j9.setValue(P,"toneMappingExposure",T.toneMappingExposure),v0.needsLights)JJ(sJ,WZ);if(Y0&&l.fog===!0)S0.refreshFogUniforms(sJ,Y0);S0.refreshMaterialUniforms(sJ,l,L0,$0,B.state.transmissionRenderTarget[I.id]),pZ.upload(P,T9(v0),sJ,L)}if(l.isShaderMaterial&&l.uniformsNeedUpdate===!0)pZ.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,uK=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),p.copy(I.scissor),h=I.scissorTest}else s.copy(i).multiplyScalar(L0).floor(),p.copy(K0).multiplyScalar(L0).floor(),h=J0;if(u!==0)l=UJ;if(U0.bindFramebuffer(P.FRAMEBUFFER,l))U0.drawBuffers(I,l);if(U0.viewport(s),U0.scissor(p),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(l0),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],l0=P0.format,f0=P0.type;if(!R9.textureFormatReadable(l0))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(l0),X0.convert(f0),0);let C9=b!==null?S.get(b).__webglFramebuffer:null;U0.bindFramebuffer(P.FRAMEBUFFER,C9);let m9=P.fenceSync(P.SYNC_GPU_COMMANDS_COMPLETE,0);return P.flush(),await IG(P,m9,4),P.bindBuffer(P.PIXEL_PACK_BUFFER,W9),P.getBufferSubData(P.PIXEL_PACK_BUFFER,0,Y0),P.deleteBuffer(W9),P.deleteSync(m9),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,l0,f0,W9,C9,m9,d9=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,l0=u.min.y,f0=u.isBox3?u.min.z:0;else{let V8=Math.pow(2,-d);if(R0=Math.floor(d9.width*V8),G0=Math.floor(d9.height*V8),I.isDataArrayTexture)V0=d9.depth;else if(I.isData3DTexture)V0=Math.floor(d9.depth*V8);else V0=1;P0=0,l0=0,f0=0}if(l!==null)W9=l.x,C9=l.y,m9=l.z;else W9=0,C9=0,m9=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 F9=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),WZ=P.getParameter(P.UNPACK_SKIP_IMAGES);P.pixelStorei(P.UNPACK_ROW_LENGTH,d9.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,d9.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,P0),P.pixelStorei(P.UNPACK_SKIP_ROWS,l0),P.pixelStorei(P.UNPACK_SKIP_IMAGES,f0);let j9=I.isDataArrayTexture||I.isData3DTexture,sJ=y.isDataArrayTexture||y.isData3DTexture;if(I.isDepthTexture){let V8=S.get(I),bJ=S.get(y),nJ=S.get(V8.__renderTarget),uK=S.get(bJ.__renderTarget);U0.bindFramebuffer(P.READ_FRAMEBUFFER,nJ.__webglFramebuffer),U0.bindFramebuffer(P.DRAW_FRAMEBUFFER,uK.__webglFramebuffer);for(let qQ=0;qQMath.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(HJ.setFromSpherical(this._spherical),HJ.applyQuaternion(this._quatInverse),Q.copy(this.target).add(HJ),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=HJ.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=HJ.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(nW.origin.copy(this.object.position),nW.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(nW.direction))nX||8*(1-this._lastQuaternion.dot(this.object.quaternion))>nX||this._lastTargetPosition.distanceToSquared(this.target)>nX)return this.dispatchEvent(Eq),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){HJ.setFromMatrixColumn(Q,0),HJ.multiplyScalar(-J),this._panOffset.add(HJ)}_panUp(J,Q){if(this.screenSpacePanning===!0)HJ.setFromMatrixColumn(Q,1);else HJ.setFromMatrixColumn(Q,0),HJ.crossVectors(this.object.up,HJ);HJ.multiplyScalar(J),this._panOffset.add(HJ)}_pan(J,Q){let $=this.domElement;if(this.object.isPerspectiveCamera){let Z=this.object.position;HJ.copy(Z).sub(this.target);let W=HJ.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,$},aZ=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},SQ=function J(Q,$){if(Q&&(!$||$._end>Q._dur||$._start<0)){var Z=Q;while(Z)Z._dirty=1,Z=Z.parent}return Q},VD=function J(Q){var $=Q.parent;while($&&$.parent)$._dirty=1,$.totalDuration(),$=$.parent;return Q},HY=function J(Q,$,Z,W){return Q._startAt&&(LJ?Q._startAt.revert(iW):Q.vars.immediateRender&&!Q.vars.autoRevert||Q._startAt.render($,!0,W))},kD=function J(Q){return!Q||Q._ts&&J(Q.parent)},Dq=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=v9(Q/$));return Q&&Z===Q?Z-1:Z},QK=function J(Q,$){return(Q-$._start)*$._ts+($._ts>=0?0:$._dirty?$.totalDuration():$._tDur)},KK=function J(Q){return Q._end=v9(Q._start+(Q._tDur/Math.abs(Q._ts||Q._rts||S9)||0))},HK=function J(Q,$){var Z=Q._dp;if(Z&&Z.smoothChildTiming&&Q._ts)Q._start=v9(Z._time-(Q._ts>0?$/Q._ts:((Q._dirty?Q.totalDuration():Q._tDur)-$)/-Q._ts)),KK(Q),Z._dirty||SQ(Z,Q);return Q},hq=function J(Q,$){var Z;if($._time||!$._dur&&$._initted||$._startS9)$.render(Z,!0)}if(SQ(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=v9((I7(Z)?Z:Z||Q!==g9?P8(Q,Z,$):Q._time)+$._delay),$._end=v9($._start+($.totalDuration()/Math.abs($.timeScale())||0)),yq(Q,$,"_first","_last",Q._sort?"_start":0),XY($)||(Q._recent=$),W||hq(Q,$),Q._ts<0&&HK(Q,Q._tTime),Q},fq=function J(Q,$){return(F8.ScrollTrigger||WK("scrollTrigger",$))&&F8.ScrollTrigger.create($,Q)},vq=function J(Q,$,Z,W,K){if(AY(Q,$,K),!Q._initted)return 1;if(!Z&&Q._pt&&!LJ&&(Q._dur&&Q.vars.lazy!==!1||!Q._dur&&Q.vars.lazy)&&jq!==eJ.frame)return t7.push(Q),Q._lazy=[K,W],1},CD=function J(Q){var $=Q.parent;return $&&$._ts&&$._initted&&!$._lock&&($.rawTime()<0||J($))},XY=function J(Q){var $=Q.data;return $==="isFromStart"||$==="isStart"},ID=function J(Q,$,Z,W){var K=Q.ratio,H=$<0||!$&&(!Q._start&&CD(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=rZ(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||LJ||W||Q._zTime===S9||!$&&Q._zTime){if(!Q._initted&&vq(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&&E8(Q,"onUpdate"),Y&&Q._repeat&&!Z&&Q.parent&&E8(Q,"onRepeat"),($>=Q._tDur||$<0)&&Q.ratio===H){if(H&&JQ(Q,1),!Z&&!LJ)E8(Q,H?"onComplete":"onReverseComplete",!0),Q._prom&&Q._prom()}}else if(!Q._zTime)Q._zTime=$},PD=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=v9($)||0,X=Q._tTime/Q._tDur;return X&&!W&&(Q._time*=H/Q._dur),Q._dur=H,Q._tDur=!K?H:K<0?10000000000:v9(H*(K+1)+Q._rDelay*K),X>0&&!W&&HK(Q,Q._tTime=Q._tDur*X),Q.parent&&KK(Q),Z||SQ(Q.parent,Q),Q},zq=function J(Q){return Q instanceof MJ?SQ(Q):v$(Q,Q._dur)},AD={_start:0,endTime:nZ,totalDuration:nZ},P8=function J(Q,$,Z){var W=Q.labels,K=Q._recent||AD,H=Q.duration()>=A8?K.endTime(!1):Q._dur,X,Y,U;if(XJ($)&&(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:+$},lZ=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 n9($[0],H,$[K+1])},QQ=function J(Q,$){return Q||Q===0?$(Q):$},rZ=function J(Q,$,Z){return Z$?$:Z},BJ=function J(Q,$){return!XJ(Q)||!($=OD.exec(Q))?"":$[1]},wD=function J(Q,$,Z){return QQ(Z,function(W){return rZ(Q,$,W)})},YY=[].slice,gq=function J(Q,$){return Q&&Q7(Q)&&"length"in Q&&(!$&&!Q.length||(Q.length-1 in Q)&&Q7(Q[0]))&&!Q.nodeType&&Q!==e8},SD=function J(Q,$,Z){if(Z===void 0)Z=[];return Q.forEach(function(W){var K;return XJ(W)&&!$||gq(W,1)?(K=Z).push.apply(K,w8(W)):Z.push(W)})||Z},w8=function J(Q,$,Z){return f9&&!$&&f9.selector?f9.selector(Q):XJ(Q)&&!Z&&(WY||!g$())?YY.call(($||MY).querySelectorAll(Q),0):AJ(Q)?SD(Q,Z):gq(Q)?YY.call(Q,0):Q?[Q]:[]},UY=function J(Q){return Q=w8(Q)[0]||sZ("Invalid scope")||{},function($){var Z=Q.current||Q.nativeElement||Q;return w8($,Z.querySelectorAll?Z:Z===Q?sZ("Invalid scope")||MY.createElement("div"):Q)}},pq=function J(Q){return Q.sort(function(){return 0.5-Math.random()})},mq=function J(Q){if(u9(Q))return Q;var $=Q7(Q)?Q:{each:Q},Z=TQ($.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(XJ(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 F=(M||$).length,E=H[F],O,k,D,B,A,C,w,T,z;if(!E){if(z=$.grid==="auto"?0:($.grid||[1,A8])[1],!z){w=-A8;while(w<(w=M[z++].getBoundingClientRect().left)&&zw&&(w=A),AF?F-1:!U?Math.max(z,F/z):U==="y"?F/z:z)||0)*(W==="edges"?-1:1),E.b=F<0?K-F:K,E.u=BJ($.amount||$.each)||0,Z=Z&&F<0?aq(Z):Z}return F=(E[N]-E.min)/E.max||0,v9(E.b+(Z?Z(F):F)*E.v)+E.u}},GY=function J(Q){var $=Math.pow(10,((Q+"").split(".")[1]||"").length);return function(Z){var W=v9(Math.round(parseFloat(Z)/Q)*Q*$);return(W-W%1)/$+(I7(Z)?0:BJ(Z))}},dq=function J(Q,$){var Z=AJ(Q),W,K;if(!Z&&Q7(Q))if(W=Z=Q.radius||A8,Q.values){if(Q=w8(Q.values),K=!I7(Q[0]))W*=W}else Q=GY(Q.increment);return QQ($,!Z?GY(Q):u9(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=A8,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){return Q.replace(RD,function($){var Z=$.indexOf("[")+1,W=$.substring(Z||7,Z?$.indexOf("]"):$.length-1).split(ED);return uq(Z?W:+W[0],Z?0:+W[1],+W[2]||0.00001)})},cq=function J(Q,$,Z,W,K){var H=$-Q,X=W-Z;return QQ(K,function(Y){return Z+((Y-Q)/H*X||0)})},yD=function J(Q,$,Z,W){var K=isNaN(Q+$)?0:function(R){return(1-R)*Q+R*$};if(!K){var H=XJ(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},E8=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&&eW(),X&&(f9=X),G=Y?K.apply(U,Y):K.call(U),f9=H,G},mZ=function J(Q){return JQ(Q),Q.scrollTrigger&&Q.scrollTrigger.kill(!!LJ),Q.progress()<1&&E8(Q,"onInterrupt"),Q},b$,sq=[],nq=function J(Q){if(!Q)return;if(Q=!Q.name&&Q.default||Q,EY()||Q.headless){var $=Q.name,Z=u9(Q),W=$&&!Z&&Q.init?function(){this._props=[]}:Q,K={init:nZ,render:TY,add:IY,kill:rD,modifier:aD,rawVars:0},H={targetTest:0,get:0,getSetter:XK,aliases:{},register:0};if(g$(),Q!==W){if(tJ[$])return;if($8(W,$8(JK(Q,K),H)),h$(W.prototype,h$(K,JK(Q,H))),tJ[W.prop=$]=W,Q.targetTest)aW.push(W),LY[$]=1;$=($==="css"?"CSS":$.charAt(0).toUpperCase()+$.substr(1))+"Plugin"}Tq($,W),Q.register&&Q.register(wJ,W,gJ)}else sq.push(Q)},w9=255,dZ={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]},tX=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},oq=function J(Q,$,Z){var W=!Q?dZ.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(dZ[Q])W=dZ[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(Mq),!$)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]=tX(Y+0.3333333333333333,K,H),W[1]=tX(Y,K,H),W[2]=tX(Y-0.3333333333333333,K,H);else if(~Q.indexOf("="))return W=Q.match(FY),Z&&W.length<4&&(W[3]=1),W}else W=Q.match(Mq)||dZ.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(F)),B)for(R=0;R=O&&R--},_listeners:X},q}(),g$=function J(){return!oZ&&eJ.wake()},q9={},fD=/^[\d.\-M][\d.\-,\s]/,vD=/["']/g,gD=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("{")?[gD($[1])]:pD(Q).split(",").map(xq)):q9._CE&&fD.test(Q)?q9._CE("",Q):Z},aq=function J(Q){return function($){return 1-Q(1-$)}},rq=function J(Q,$){var Z=Q._first,W;while(Z){if(Z instanceof MJ)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}},TQ=function J(Q,$){return!Q?$:(u9(Q)?Q:q9[Q]||mD(Q))||$},bQ=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]=F8[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},tq=function J(Q){return function($){return $<0.5?(1-Q(1-$*2))/2:0.5+Q(($-0.5)*2)/2}},eX=function J(Q,$,Z){var W=$>=1?$:1,K=(Z||(Q?0.3:0.45))/($<1?$:1),H=K/ZY*(Math.asin(1/W)||0),X=function U(G){return G===1?1:W*Math.pow(2,-10*G)*ND((G-H)*K)+1},Y=Q==="out"?X:Q==="in"?function(U){return 1-X(1-U)}:tq(X);return K=ZY/K,Y.config=function(U,G){return J(Q,U,G)},Y},JY=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)}:tq(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;bQ(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;bQ("Elastic",eX("in"),eX("out"),eX());(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){HK(this,Z),!K._dp||K.parent||hq(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||!this._initted&&this._dur&&Z||!Z&&!this._initted&&(this.add||this._ptLookup))this._ts||(this._pTime=Z),_q(this,Z,W);return this},Q.time=function $(Z,W){return arguments.length?this.totalTime(Math.min(this.totalDuration(),Z+Dq(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)+Dq(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?QK(this.parent._time,this):this._tTime;return this._rts=+Z||0,this._ts=this._ps||Z===-S9?0:this._rts,this.totalTime(rZ(-Math.abs(this._delay),this.totalDuration(),K),W!==!1),KK(this),VD(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=v9(Z);var W=this.parent||this._dp;return W&&(W._sort||!this.parent)&&J7(W,this,this._start-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:QK(W.rawTime(Z),this)},Q.revert=function $(Z){if(Z===void 0)Z=LD;var W=LJ;if(LJ=Z,VY(this))this.timeline&&this.timeline.revert(Z),this.totalTime(-0.01,Z.suppressEvents);return this.data!=="nested"&&Z.kill!==!1&&this.kill(),LJ=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,zq(this);return this._repeat===-2?1/0:this._repeat},Q.repeatDelay=function $(Z){if(arguments.length){var W=this._time;return this._rDelay=Z,zq(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(P8(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,K=W._prom;return new Promise(function(H){var X=u9(Z)?Z:bq,Y=function U(){var G=W.then;W.then=null,K&&K(),u9(X)&&(X=X(W))&&(X.then||X===W)&&(W.then=G),H(X),W.then=G};if(W._initted&&W.totalProgress()===1&&W._ts>=0||!W._tTime&&W._ts<0)Y();else W._prom=Y})},Q.kill=function $(){mZ(this)},J}();$8(iZ.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 MJ=function(J){Iq(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),g9&&J7(Z.parent||g9,k7(K),W),Z.reversed&&K.reverse(),Z.paused&&K.paused(!0),Z.scrollTrigger&&fq(k7(K),Z.scrollTrigger),K}var $=Q.prototype;return $.to=function Z(W,K,H){return lZ(0,arguments,this),this},$.from=function Z(W,K,H){return lZ(1,arguments,this),this},$.fromTo=function Z(W,K,H,X){return lZ(2,arguments,this),this},$.set=function Z(W,K,H){return K.duration=0,K.parent=this,uZ(K).repeatDelay||(K.repeat=0),K.immediateRender=!!K.immediateRender,new n9(W,K,P8(this,H),1),this},$.call=function Z(W,K,H){return J7(this,n9.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 n9(W,H,P8(this,Y)),this},$.staggerFrom=function Z(W,K,H,X,Y,U,G){return H.runBackwards=1,uZ(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,uZ(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:v9(W),q=this._zTime<0!==W<0&&(this._initted||!U),N,R,M,F,E,O,k,D,B,A,C,w;if(this!==g9&&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,E=U+this._rDelay,this._repeat<-1&&W<0)return this.totalTime(E*100+W,K,H);if(N=v9(G%E),G===Y)F=this._repeat,N=U;else{if(A=v9(G/E),F=~~A,F&&F===A)N=U,F--;N>U&&(N=U)}if(A=f$(this._tTime,E),!X&&this._tTime&&A!==F&&this._tTime-A*E-this._dur<=0&&(A=F),C&&F&1)N=U-N,w=1;if(F!==A&&!this._lock){var T=C&&A&1,z=T===(C&&F&1);if(F=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||LJ&&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,KK(this),this.render(W,K,H)}if(this._onUpdate&&!K&&E8(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))E8(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=P8(this,K,W)),!(W instanceof iZ)){if(AJ(W))return W.forEach(function(X){return H.add(X,K)}),this;if(XJ(W))return this.addLabel(W,K);if(u9(W))W=n9.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=-A8;var Y=[],U=this._first;while(U){if(U._start>=X)if(U instanceof n9)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(XJ(W))return this.removeLabel(W);if(u9(W))return this.killTweensOf(W);if(W.parent===this&&aZ(this,W),W===this._recent)this._recent=this._last;return SQ(this)},$.totalTime=function Z(W,K){if(!arguments.length)return this._tTime;if(this._forcing=1,!this._dp&&this._ts)this._start=v9(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]=P8(this,K),this},$.removeLabel=function Z(W){return delete this.labels[W],this},$.addPause=function Z(W,K,H){var X=n9.delayedCall(0,K||nZ,H);return X.data="isPause",this._hasPause=1,J7(this,X,P8(this,W))},$.removePause=function Z(W){var K=this._first;W=P8(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=w8(W),Y=this._first,U=I7(K),G;while(Y){if(Y instanceof n9){if(BD(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=P8(H,W),Y=K,U=Y.startAt,G=Y.onStart,q=Y.onStartParams,N=Y.immediateRender,R,M=n9.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 F(){if(H.pause(),!R){var E=K.duration||Math.abs((X-(U&&"time"in U?U.time:H._time))/H.timeScale());M._dur!==E&&v$(M,E,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:P8(this,W)}},H))},$.recent=function Z(){return this._recent},$.nextLabel=function Z(W){if(W===void 0)W=this._time;return Vq(this,P8(this,W))},$.previousLabel=function Z(W){if(W===void 0)W=this._time;return Vq(this,P8(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;W=v9(W);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 SQ(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={}),SQ(this)},$.totalDuration=function Z(W){var K=0,H=this,X=H._last,Y=A8,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+=v9(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===g9&&H._time>K?H._time:K,1,1),H._dirty=0}return H._tDur},Q.updateRoot=function Z(W){if(g9._ts)_q(g9,QK(W,g9)),jq=eJ.frame;if(eJ.frame>=Lq){Lq+=Q8.autoSleep||120;var K=g9._first;if(!K||!K._ts){if(Q8.autoSleep&&eJ._listeners.length<2){while(K&&!K._ts)K=K._next;K||eJ.sleep()}}}},Q}(iZ);$8(MJ.prototype,{_lock:0,_hasPause:0,_forcing:0});var dD=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,F,E,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(aX)||[];while(q=aX.exec(W)){if(M=q[0],F=W.substring(U,q.index),R)R=(R+1)%5;else if(F.substr(-5)==="rgba(")R=1;if(M!==N[G++])E=parseFloat(N[G-1])||0,Y._pt={_next:Y._pt,p:F||G===1?F:",",s:E,c:M.charAt(1)==="="?xQ(E,M)-E:parseFloat(M)-E,m:R&&R<4?Math.round:0},U=aX.lastIndex}if(Y.c=U")}),B.duration();else{C={};for(T in M)T==="ease"||T==="easeEach"||sD(T,M[T],C,M.easeEach);for(T in C){m=C[T].sort(function(p,h){return p.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(E=f$(this._tTime,F),N===X&&!H&&this._initted&&M===E)return this._tTime=q,this;if(M!==E){if(D&&this._yEase&&rq(D,O),this.vars.repeatRefresh&&!O&&!this._lock&&N!==F&&this._initted)this._lock=H=1,this.render(v9(F*M),!0).invalidate()._lock=0}}if(!this._initted){if(vq(this,G?W:N,H,K,q))return this._tTime=0,this;if(X!==this._time&&!(H&&this.vars.repeatRefresh&&M!==E))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&&!E){if(E8(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),E8(this,"onUpdate");if(this._repeat&&M!==E&&this.vars.onRepeat&&!K&&this.parent&&E8(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))E8(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){oZ||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),lD(this,W,K,H,X,G,U,Y))return this.resetTo(W,K,H,X,1);return HK(this,0),this.parent||yq(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?mZ(this):this.scrollTrigger&&this.scrollTrigger.kill(!!LJ),this;if(this.timeline){var H=this.timeline.totalDuration();return this.timeline.killTweensOf(W,K,r7&&r7.vars.overwrite!==!0)._first||mZ(this),this.parent&&H!==this.timeline.totalDuration()&&v$(this,this._dur*this.timeline._tDur/H,0,1),this}var X=this._targets,Y=W?w8(W):X,U=this._ptLookup,G=this._pt,q,N,R,M,F,E,O;if((!K||K==="all")&&zD(X,Y))return K==="all"&&(this._pt=0),mZ(this);if(q=this._op=this._op||[],K!=="all"){if(XJ(K))F={},vJ(K,function(k){return F[k]=1}),K=F;K=cD(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(F in M){if(E=N&&N[F],E){if(!("kill"in E.d)||E.d.kill(F)===!0)aZ(this,E,"_pt");delete N[F]}if(R!=="all")R[F]=1}}return this._initted&&!this._pt&&G&&mZ(this),this},Q.to=function Z(W,K){return new Q(W,K,arguments[2])},Q.from=function Z(W,K){return lZ(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 lZ(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 g9.killTweensOf(W,K,H)},Q}(iZ);$8(n9.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0});vJ("staggerTo,staggerFrom,staggerFromTo",function(J){n9[J]=function(){var Q=new MJ,$=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},Q5=function J(Q,$,Z){return Q[$](Z)},nD=function J(Q,$,Z,W){return Q[$](W.fp,Z)},oD=function J(Q,$,Z){return Q.setAttribute($,Z)},XK=function J(Q,$){return u9(Q[$])?Q5:ZK(Q[$])&&Q.setAttribute?oD:wY},$5=function J(Q,$){return $.set($.t,$.p,Math.round(($.s+$.c*Q)*1e6)/1e6,$)},iD=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},aD=function J(Q,$,Z,W){var K=this._pt,H;while(K)H=K._next,K.p===W&&K.modifier(Q,$,Z),K=H},rD=function J(Q){var $=this._pt,Z,W;while($){if(W=$._next,$.p===Q&&!$.op||$.op===Q)aZ(this,$,"_pt");else if(!$.dep)Z=1;$=W}return!Z},tD=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||$5,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=tD,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});F8.TweenMax=F8.TweenLite=n9;F8.TimelineLite=F8.TimelineMax=MJ;g9=new MJ({sortChildren:!1,defaults:y$,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0});Q8.stringFilter=kY;var jQ=[],rW={},eD=[],Cq=0,Jz=0,QY=function J(Q){return(rW[Q]||eD).map(function($){return $()})},NY=function J(){var Q=Date.now(),$=[];if(Q-Cq>2)QY("matchMediaInit"),jQ.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)}),QY("matchMediaRevert"),$.forEach(function(Z){return Z.onMatch(Z,function(W){return Z.add(null,W)})}),Cq=Q,QY("matchMedia")},Z5=function(){function J($,Z){this.selector=Z&&UY(Z),this.data=[],this._r=[],this.isReverted=!1,this.id=Jz++,$&&this.add($)}var Q=J.prototype;return Q.add=function $(Z,W,K){if(u9(Z))K=W,W=Z,Z=u9;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),u9(q)&&H._r.push(q),f9=U,H.selector=G,H.isReverted=!1,q};return H.last=X,Z===u9?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 n9&&!(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 MJ){if(U.data!=="nested")U.scrollTrigger&&U.scrollTrigger.revert(),U.kill()}else!(U instanceof n9)&&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=jQ.length;while(H--)jQ[H].id===this.id&&jQ.splice(H,1)}},Q.revert=function $(Z){this.kill(Z||{})},J}(),Qz=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 Z5(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)jQ.indexOf(H)<0&&jQ.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}(),$K={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 g9.getTweensOf(Q,!0).length>0},defaults:function J(Q){return Q&&Q.ease&&(Q.ease=TQ(Q.ease,y$.ease)),Bq(y$,Q||{})},config:function J(Q){return Bq(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]&&!F8[X]&&sZ($+" effect requires "+X+" plugin.")}),rX[$]=function(X,Y,U){return Z(w8(X),$8(Y||{},K),U)},H)MJ.prototype[$]=function(X,Y,U){return this.add(rX[$](X,Q7(Y)?Y:(U=Y)&&{},this),U)}},registerEase:function J(Q,$){q9[Q]=TQ($)},parseEase:function J(Q,$){return arguments.length?TQ(Q,$):q9},getById:function J(Q){return g9.getById(Q)},exportRoot:function J(Q,$){if(Q===void 0)Q={};var Z=new MJ(Q),W,K;Z.smoothChildTiming=J8(Q.smoothChildTiming),g9.remove(Z),Z._dp=0,Z._time=Z._tTime=g9._time,W=g9._first;while(W){if(K=W._next,$||!(!W._dur&&W instanceof n9&&W.vars.onComplete===W._targets[0]))J7(Z,W,W._start-W._delay);W=K}return J7(g9,Z,0),Z},context:function J(Q,$){return Q?new Z5(Q,$):f9},matchMedia:function J(Q){return new Qz(Q)},matchMediaRefresh:function J(){return jQ.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=rW[Q]||(rW[Q]=[]);~Z.indexOf($)||Z.push($)},removeEventListener:function J(Q,$){var Z=rW[Q],W=Z&&Z.indexOf($);W>=0&&Z.splice(W,1)},utils:{wrap:xD,wrapYoyo:bD,distribute:mq,random:uq,snap:dq,normalize:_D,getUnit:BJ,clamp:wD,splitColor:oq,toArray:w8,selector:UY,mapRange:cq,pipe:TD,unitize:jD,interpolate:yD,shuffle:pq},install:Sq,effects:rX,ticker:eJ,updateRoot:MJ.updateRoot,plugins:tJ,globalTimeline:g9,core:{PropTween:gJ,globals:Tq,Tween:n9,Timeline:MJ,Animation:iZ,getCache:e7,_removeLinkedListItem:aZ,reverting:function J(){return LJ},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 $K[J]=n9[J]});eJ.add(MJ.updateRoot);b$=$K.to({},{duration:0});var $z=function J(Q,$){var Z=Q._pt;while(Z&&Z.p!==$&&Z.op!==$&&Z.fp!==$)Z=Z._next;return Z},Zz=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=$z(H,W);H&&H.modifier&&H.modifier($[W],Q,Z[K],W)}}},$Y=function J(Q,$){return{name:Q,headless:1,rawVars:1,init:function Z(W,K,H){H._onInit=function(X){var Y,U;if(XJ(K))Y={},vJ(K,function(G){return Y[G]=1}),K=Y;if($){Y={};for(U in K)Y[U]=$(K[U]);K=Y}Zz(X,K)}}}},wJ=$K.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)LJ?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)}},$Y("roundProps",GY),$Y("modifiers"),$Y("snap",dq))||$K;n9.version=MJ.version=wJ.version="3.14.2";wq=1;EY()&&g$();var{Power0:Wz,Power1:Kz,Power2:Hz,Power3:Xz,Power4:Yz,Linear:Uz,Quad:Gz,Cubic:qz,Quart:Nz,Quint:Rz,Strong:Ez,Elastic:Fz,Back:Oz,SteppedEase:Mz,Bounce:Lz,Sine:Bz,Expo:Dz,Circ:zz}=q9;/*! * CSSPlugin 3.14.2 * 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 W5,$Q,d$,fY,vQ,Vz,K5,vY,kz=function J(){return typeof window!=="undefined"},A7={},fQ=180/Math.PI,u$=Math.PI/180,m$=Math.atan2,H5=1e8,gY=/([A-Z])/g,Cz=/(left|right|width|margin|padding|x)/i,Iz=/[\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,$)},Pz=function J(Q,$){return $.set($.t,$.p,Q===1?$.e:Math.round(($.s+$.c*Q)*1e4)/1e4+$.u,$)},Az=function J(Q,$){return $.set($.t,$.p,Q?Math.round(($.s+$.c*Q)*1e4)/1e4+$.u:$.b,$)},wz=function J(Q,$){return $.set($.t,$.p,Q===1?$.e:Q?Math.round(($.s+$.c*Q)*1e4)/1e4+$.u:$.b,$)},Sz=function J(Q,$){var Z=$.s+$.c*Q;$.set($.t,$.p,~~(Z+(Z<0?-0.5:0.5))+$.u,$)},E5=function J(Q,$){return $.set($.t,$.p,Q?$.e:$.b,$)},F5=function J(Q,$){return $.set($.t,$.p,Q!==1?$.b:$.e,$)},Tz=function J(Q,$,Z){return Q.style[$]=Z},jz=function J(Q,$,Z){return Q.style.setProperty($,Z)},_z=function J(Q,$,Z){return Q._gsap[$]=Z},xz=function J(Q,$,Z){return Q._gsap.scaleX=Q._gsap.scaleY=Z},bz=function J(Q,$,Z,W,K){var H=Q._gsap;H.scaleX=H.scaleY=Z,H.renderTransform(K,H)},yz=function J(Q,$,Z,W,K){var H=Q._gsap;H[$]=Z,H.renderTransform(K,H)},p9="transform",Z8=p9+"Origin",hz=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(p9)>=0)return;if(H.svg)this.svgo=W.getAttribute("data-svg-origin"),this.props.push(Z8,$,"");Q=p9}(K||$)&&this.props.push(Q,$,K[Q])},O5=function J(Q){if(Q.translate)Q.removeProperty("translate"),Q.removeProperty("scale"),Q.removeProperty("rotate")},fz=function J(){var Q=this.props,$=this.target,Z=$.style,W=$._gsap,K,H;for(K=0;K=0?X5[H]:"")+Q},yY=function J(){if(kz()&&window.document)W5=window,$Q=W5.document,d$=$Q.documentElement,vQ=bY("div")||{style:{}},Vz=bY("div"),p9=l$(p9),Z8=p9+"Origin",vQ.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",L5=!!l$("perspective"),vY=wJ.core.reverting,fY=1},Y5=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},U5=function J(Q,$){var Z=$.length;while(Z--)if(Q.hasAttribute($[Z]))return Q.getAttribute($[Z])},B5=function J(Q){var $,Z;try{$=Q.getBBox()}catch(W){$=Y5(Q),Z=1}return $&&($.width||$.height)||Z||($=Y5(Q)),$&&!$.width&&!$.x&&!$.y?{x:+U5(Q,["x","cx","x1"])||0,y:+U5(Q,["y","cy","y1"])||0,width:0,height:0}:$},D5=function J(Q){return!!(Q.getCTM&&(!Q.parentNode||Q.ownerSVGElement)&&B5(Q))},WQ=function J(Q,$){if($){var Z=Q.style,W;if($ in A7&&$!==Z8)$=p9;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:E5);return Q._pt=X,X.b=W,X.e=K,Q._props.push(Z),X},G5={deg:1,rad:1,turn:1},vz={grid:1,flex:1},KQ=function J(Q,$,Z,W){var K=parseFloat(Z)||0,H=(Z+"").trim().substr((K+"").length)||"px",X=vQ.style,Y=Cz.test($),U=Q.tagName.toLowerCase()==="svg",G=(U?"client":"offset")+(Y?"Width":"Height"),q=100,N=W==="px",R=W==="%",M,F,E,O;if(W===H||!K||G5[W]||G5[H])return K;if(H!=="px"&&!N&&(K=J(Q,$,Z,"px")),O=Q.getCTM&&D5(Q),(R||H==="%")&&(A7[$]||~$.indexOf("adius")))return M=O?Q.getBBox()[Y?"width":"height"]:Q[G],l9(R?K/M*q:K/100*M);if(X[Y?"width":"height"]=q+(N?H:W),F=W!=="rem"&&~$.indexOf("adius")||W==="em"&&Q.appendChild&&!U?Q:Q.parentNode,O)F=(Q.ownerSVGElement||{}).parentNode;if(!F||F===$Q||!F.appendChild)F=$Q.body;if(E=F._gsap,E&&R&&E.width&&Y&&E.time===eJ.time&&!E.uncache)return l9(K/E.width*q);else{if(R&&($==="height"||$==="width")){var k=Q.style[$];Q.style[$]=q+W,M=Q[G],k?Q.style[$]=k:WQ(Q,$)}else(R||H==="%")&&!vz[O8(F,"display")]&&(X.position=O8(Q,"position")),F===Q&&(X.position="static"),F.appendChild(vQ),M=vQ[G],F.removeChild(vQ),X.position="absolute";if(Y&&R)E=e7(F),E.time=eJ.time,E.width=F[G]}return l9(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=J6(Q,W),K=$!=="transformOrigin"?K[$]:K.svg?K.origin:UK(O8(Q,Z8))+" "+K.zOrigin+"px";else if(K=Q.style[$],!K||K==="auto"||W||~(K+"").indexOf("calc("))K=YK[$]&&YK[$](Q,$,Z)||O8(Q,$)||zY(Q,$)||($==="opacity"?1:0);return Z&&!~(K+"").trim().indexOf(" ")?KQ(Q,$,K,Z)+Z:K},gz=function J(Q,$,Z,W){if(!Z||Z==="none"){var K=l$($,Q,1),H=K&&O8(Q,K,1);if(H&&H!==Z)$=K,Z=H;else if($==="borderColor")Z=O8(Q,"borderTopColor")}var X=new gJ(this._pt,Q.style,$,0,1,SY),Y=0,U=0,G,q,N,R,M,F,E,O,k,D,B,A;if(X.b=Z,X.e=W,Z+="",W+="",W.substring(0,6)==="var(--")W=O8(Q,W.substring(4,W.indexOf(")")));if(W==="auto")F=Q.style[$],Q.style[$]=W,W=O8(Q,$)||W,F?Q.style[$]=F:WQ(Q,$);if(G=[Z,W],kY(G),Z=G[0],W=G[1],N=Z.match(_Q)||[],A=W.match(_Q)||[],A.length){while(q=_Q.exec(W)){if(E=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(E!==(F=N[U++]||"")){if(R=parseFloat(F)||0,B=F.substr((R+"").length),E.charAt(1)==="="&&(E=xQ(R,E)+B),O=parseFloat(E),D=E.substr((O+"").length),Y=_Q.lastIndex-D.length,!D){if(D=D||Q8.units[$]||B,Y===W.length)W+=D,X.e+=D}if(B!==D)R=KQ(Q,$,F,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:p9;WQ(Z,X)}}if(Y){if(WQ(Z,p9),H)H.svg&&Z.removeAttribute("transform"),W.scale=W.rotate=W.translate="none",J6(Z,1),H.uncache=1,O5(W)}}},YK={clearProps:function J(Q,$,Z,W,K){if(K.data!=="isFromStart"){var H=Q._pt=new gJ(Q._pt,$,Z,0,0,mz);return H.u=W,H.pr=-10,H.tween=K,Q._props.push(Z),1}}},eZ=[1,0,0,1,0,0],z5={},V5=function J(Q){return Q==="matrix(1, 0, 0, 1, 0, 0)"||Q==="none"||!Q},N5=function J(Q){var $=O8(Q,p9);return V5($)?eZ:$.substr(7).match(FY).map(l9)},pY=function J(Q,$){var Z=Q._gsap||e7(Q),W=Q.style,K=N5(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"?eZ:K;else if(K===eZ&&!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=N5(Q),Y?W.display=Y:WQ(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],F=Y[2],E=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=B5(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!==eZ&&(w=R*E-M*F))T=B*(E/w)+A*(-F/w)+(F*k-E*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*F)-O,X.yOffset=N+(O*M+k*E)-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)},J6=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=O8(Q,Z8)||"0",G,q,N,R,M,F,E,O,k,D,B,A,C,w,T,z,V,_,b,m,v,s,p,h,c,t,j,$0,L0,a0,_0,i;if(G=q=N=F=E=O=k=D=B=0,R=M=1,Z.svg=!!(Q.getCTM&&D5(Q)),Y.translate){if(Y.translate!=="none"||Y.scale!=="none"||Y.rotate!=="none")W[p9]=(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[p9]!=="none"?Y[p9]:"");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!==eZ){if(_=w[0],b=w[1],m=w[2],v=w[3],G=s=w[4],q=p=w[5],w.length===6){if(R=Math.sqrt(_*_+b*b),M=Math.sqrt(v*v+m*m),F=_||b?m$(b,_)*fQ:0,k=m||v?m$(m,v)*fQ+F:0,k&&(M*=Math.abs(Math.cos(k*u$))),Z.svg)G-=A-(A*_+C*m),q-=C-(A*b+C*v)}else{if(i=w[6],a0=w[7],j=w[8],$0=w[9],L0=w[10],_0=w[11],G=w[12],q=w[13],N=w[14],T=m$(i,L0),E=T*fQ,T)z=Math.cos(-T),V=Math.sin(-T),h=s*z+j*V,c=p*z+$0*V,t=i*z+L0*V,j=s*-V+j*z,$0=p*-V+$0*z,L0=i*-V+L0*z,_0=a0*-V+_0*z,s=h,p=c,i=t;if(T=m$(-m,L0),O=T*fQ,T)z=Math.cos(-T),V=Math.sin(-T),h=_*z-j*V,c=b*z-$0*V,t=m*z-L0*V,_0=v*V+_0*z,_=h,b=c,m=t;if(T=m$(b,_),F=T*fQ,T)z=Math.cos(T),V=Math.sin(T),h=_*z+b*V,c=s*z+p*V,b=b*z-_*V,p=p*z-s*V,_=h,s=c;if(E&&Math.abs(E)+Math.abs(F)>359.9)E=F=0,O=180-O;R=l9(Math.sqrt(_*_+b*b+m*m)),M=l9(Math.sqrt(p*p+i*i)),T=m$(s,p),k=Math.abs(T)>0.0002?T*fQ:0,B=_0?1/(_0<0?-_0:_0):0}if(Z.svg)h=Q.getAttribute("transform"),Z.forceCSS=Q.setAttribute("transform","")||!V5(O8(Q,p9)),h&&Q.setAttribute("transform",h)}if(Math.abs(k)>90&&Math.abs(k)<270)if(K)R*=-1,k+=F<=0?180:-180,F+=F<=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=l9(R),Z.scaleY=l9(M),Z.rotation=l9(F)+X,Z.rotationX=l9(E)+X,Z.rotationY=l9(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]=UK(U);return Z.xOffset=Z.yOffset=0,Z.force3D=Q8.force3D,Z.renderTransform=Z.svg?uz:L5?k5:dz,Z.uncache=0,Z},UK=function J(Q){return(Q=Q.split(" "))[0]+" "+Q[1]},_Y=function J(Q,$,Z){var W=BJ($);return l9(parseFloat($)+parseFloat(KQ(Q,"x",Z+"px",W)))+W},dz=function J(Q,$){$.z="0px",$.rotationY=$.rotationX="0deg",$.force3D=0,k5(Q,$)},yQ="0deg",tZ="0px",hQ=") ",k5=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,F=Z.scaleY,E=Z.transformPerspective,O=Z.force3D,k=Z.target,D=Z.zOrigin,B="",A=O==="auto"&&Q&&Q!==1||O===!0;if(D&&(q!==yQ||G!==yQ)){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(E!==tZ)B+="perspective("+E+hQ;if(W||K)B+="translate("+W+"%, "+K+"%) ";if(A||H!==tZ||X!==tZ||Y!==tZ)B+=Y!==tZ||A?"translate3d("+H+", "+X+", "+Y+") ":"translate("+H+", "+X+hQ;if(U!==yQ)B+="rotate("+U+hQ;if(G!==yQ)B+="rotateY("+G+hQ;if(q!==yQ)B+="rotateX("+q+hQ;if(N!==yQ||R!==yQ)B+="skew("+N+", "+R+hQ;if(M!==1||F!==1)B+="scale("+M+", "+F+hQ;k.style[p9]=B||"translate(0, 0)"},uz=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,F=Z.yOrigin,E=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=l9(A),C=l9(C),w=l9(w),T=l9(T)}else A=q,T=N,C=w=0;if(D&&!~(H+"").indexOf("px")||B&&!~(X+"").indexOf("px"))D=KQ(R,"x",H,"px"),B=KQ(R,"y",X,"px");if(M||F||E||O)D=l9(D+M-(M*A+F*w)+E),B=l9(B+F-(M*C+F*T)+O);if(W||K)z=R.getBBox(),D=l9(D+W/100*z.width),B=l9(B+K/100*z.height);z="matrix("+A+","+C+","+w+","+T+","+D+","+B+")",R.setAttribute("transform",z),k&&(R.style[p9]=z)},lz=function J(Q,$,Z,W,K){var H=360,X=XJ(K),Y=parseFloat(K)*(X&&~K.indexOf("rad")?fQ: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*H5)%H-~~(U/H)*H;else if(q==="ccw"&&U>0)U=(U-H*H5)%H-~~(U/H)*H}return Q._pt=N=new gJ(Q._pt,$,Z,W,U,Pz),N.e=G,N.u="deg",Q._props.push(Z),N},R5=function J(Q,$){for(var Z in $)Q[Z]=$[Z];return Q},cz=function J(Q,$,Z){var W=R5({},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[p9]=$,X=J6(Z,1),WQ(Z,p9),Z.setAttribute("transform",U);else U=getComputedStyle(Z)[p9],H[p9]=$,X=J6(Z,1),H[p9]=U;for(Y in A7)if(U=W[Y],G=X[Y],U!==G&&K.indexOf(Y)<0)R=BJ(U),M=BJ(G),q=R!==M?KQ(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);R5(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});YK[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,F){return R[M]=N[F]=N[F]||N[(F-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,F,E,O,k,D,B,A,C,w,T,z;fY||yY(),this.styles=this.styles||M5(Q),T=this.styles.props,this.tween=Z;for(F in $){if(F==="autoRound")continue;if(G=$[F],tJ[F]&&PY(F,$,Z,W,Q,K))continue;if(R=typeof G,M=YK[F],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,F,G,Z)&&(w=1);else if(F.substr(0,2)==="--"){if(U=(getComputedStyle(Q).getPropertyValue(F)+"").trim(),G+="",C7.lastIndex=0,!C7.test(U))E=BJ(U),O=BJ(G),O?E!==O&&(U=KQ(Q,F,U,O)+O):E&&(G+=E);this.add(X,"setProperty",U,G,W,K,0,0,F),H.push(F),T.push(F,0,X[F])}else if(R!=="undefined"){if(Y&&F in Y)U=typeof Y[F]==="function"?Y[F].call(Z,W,Q,K):Y[F],XJ(U)&&~U.indexOf("random(")&&(U=p$(U)),BJ(U+"")||U==="auto"||(U+=Q8.units[F]||BJ(P7(Q,F))||""),(U+"").charAt(1)==="="&&(U=P7(Q,F));else U=P7(Q,F);if(N=parseFloat(U),k=R==="string"&&G.charAt(1)==="="&&G.substr(0,2),k&&(G=G.substr(2)),q=parseFloat(G),F in $7){if(F==="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(F!=="scale"&&F!=="transform")F=$7[F],~F.indexOf(",")&&(F=F.split(",")[0])}if(D=F in A7,D){if(this.styles.save(F),z=G,R==="string"&&G.substring(0,6)==="var(--"){if(G=O8(Q,G.substring(4,G.indexOf(")"))),G.substring(0,5)==="calc("){var V=Q.style.perspective;Q.style.perspective=G,G=O8(Q,"perspective"),V?Q.style.perspective=V:WQ(Q,"perspective")}q=parseFloat(G)}if(!B)A=Q._gsap,A.renderTransform&&!$.parseTransform||J6(Q,$.parseTransform),C=$.smoothOrigin!==!1&&A.smooth,B=this._pt=new gJ(this._pt,X,p9,0,1,A.renderTransform,A,0,-1),B.dep=1;if(F==="scale")this._pt=new gJ(this._pt,A,"scaleY",A.scaleY,(k?xQ(A.scaleY,k+q):q)-A.scaleY||0,xY),this._pt.u=0,H.push("scaleY",F),F+="X";else if(F==="transformOrigin"){if(T.push(Z8,0,X[Z8]),G=pz(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,F,UK(U),UK(G));continue}else if(F==="svgOrigin"){hY(Q,G,1,C,0,this);continue}else if(F in z5){lz(this,A,F,N,k?xQ(N,k+G):G);continue}else if(F==="smoothOrigin"){ZQ(this,A,"smooth",A.smooth,G);continue}else if(F==="force3D"){A[F]=G;continue}else if(F==="transform"){cz(this,G,Q);continue}}else if(!(F in X))F=l$(F)||F;if(D||(q||q===0)&&(N||N===0)&&!Iz.test(G)&&F in X){if(E=(U+"").substr((N+"").length),q||(q=0),O=BJ(G)||(F in Q8.units?Q8.units[F]:E),E!==O&&(N=KQ(Q,F,U,O)),this._pt=new gJ(this._pt,D?A:X,F,N,(k?xQ(N,k+q):q)-N,!D&&(O==="px"||F==="zIndex")&&$.autoRound!==!1?Sz:xY),this._pt.u=O||0,D&&z!==G)this._pt.b=U,this._pt.e=z,this._pt.r=wz;else if(E!==O&&O!=="%")this._pt.b=U,this._pt.r=Az}else if(!(F in X)){if(F in Q)this.add(Q,F,U||Q[F],k?k+G:G,W,K);else if(F!=="parseTransform"){WK(F,G);continue}}else gz.call(this,Q,F,U,k?k+G:G);D||(F in X?T.push(F,0,X[F]):typeof Q[F]==="function"?T.push(F,2,Q[F]()):T.push(F,1,U||Q[F])),H.push(F)}}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&&K5===Z?$==="scale"?xz:_z:(K5=Z||{})&&($==="scale"?bz:yz):Q.style&&!ZK(Q.style[$])?Tz:~$.indexOf("-")?jz:XK(Q,$)},core:{_removeProperty:WQ,_getMatrix:pY}};wJ.utils.checkPrefix=l$;wJ.core.getStyleSaver=M5;(function(J,Q,$,Z){var W=vJ(J+","+Q+","+$,function(K){A7[K]=1});vJ(Q,function(K){Q8.units[K]="deg",z5[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 Q6=wJ.registerPlugin(mY)||wJ,w4=Q6.core.Tween;function C5(J,Q){for(var $=0;$Y)K=W,W=M,X=H,H=E;else if(Z)W+=M;else W=K+(M-K)/(E-X)*(H-X)},q=function R(){K=W=Z?0:W,X=H=0},N=function R(M){var F=X,E=K,O=W6();return(M||M===0)&&M!==W&&G(M),H===X||O-X>U?0:(W+(Z?E:-E))/((Z?O:H)-F)*1000};return{update:G,reset:q,getVelocity:N}},$6=function J(Q,$){return $&&!Q._gsapAllow&&Q.preventDefault(),Q.changedTouches?Q.changedTouches[0]:Q},I5=function J(Q){var $=Math.max.apply(Math,Q),Z=Math.min.apply(Math,Q);return Math.abs($)>=Math.abs(Z)?$:Z},j5=function J(){Z6=DJ.core.globals().ScrollTrigger,Z6&&Z6.core&&oz()},_5=function J(Q){if(DJ=Q||S5(),!NK&&DJ&&typeof document!=="undefined"&&document.body)M8=window,HQ=document,XQ=HQ.documentElement,s$=HQ.body,A5=[M8,HQ,XQ,s$],nz=DJ.utils.clamp,w5=DJ.core.context||function(){},gQ="onpointerenter"in s$?"pointer":"mouse",P5=c9.isTouch=M8.matchMedia&&M8.matchMedia("(hover: none), (pointer: coarse)").matches?1:("ontouchstart"in M8)||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0?2:0,c8=c9.eventTypes=("ontouchstart"in XQ?"touchstart,touchmove,touchcancel,touchend":!("onpointerdown"in XQ)?"mousedown,mousemove,mouseup,mouseup":"pointerdown,pointermove,pointercancel,pointerup").split(","),setTimeout(function(){return T5=0},500),j5(),NK=1;return NK};SJ.op=r9;$9.cache=0;var c9=function(){function J($){this.init($)}var Q=J.prototype;return Q.init=function $(Z){NK||_5(DJ)||console.warn("Please gsap.registerPlugin(Observer)"),Z6||j5();var{tolerance:W,dragMinimum:K,type:H,target:X,lineHeight:Y,debounce:U,preventDefault:G,onStop:q,onStopDelay:N,ignore:R,wheelSpeed:M,event:F,onDragStart:E,onDragEnd:O,onDrag:k,onPress:D,onRelease:B,onRight:A,onLeft:C,onUp:w,onDown:T,onChangeX:z,onChangeY:V,onChange:_,onToggleX:b,onToggleY:m,onHover:v,onHoverEnd:s,onMove:p,ignoreCheck:h,isNormalizer:c,onGestureStart:t,onGestureEnd:j,onWheel:$0,onEnable:L0,onDisable:a0,onClick:_0,scrollSpeed:i,capture:K0,allowClicks:J0,lockAxis:k0,onLockAxis:I0}=Z;this.target=X=dJ(X)||XQ,this.vars=Z,R&&(R=DJ.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(M8.getComputedStyle(s$).lineHeight)||22);var y0,U9,u0,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=K6(X),r=X.ownerDocument||HQ,n=[0,0,0],O0=[0,0,0],H0=0,S0=function M0(){return H0=W6()},B0=function M0(T0,e0){return(P.event=T0)&&R&&iz(T0.target,R)||e0&&g&&T0.pointerType!=="touch"||h&&h(T0,e0)},Q0=function M0(){P._vx.reset(),P._vy.reset(),U9.pause(),q&&q(P)},Z0=function M0(){var T0=P.deltaX=I5(n),e0=P.deltaY=I5(O0),E0=Math.abs(T0)>=W,n0=Math.abs(e0)>=W;if(_&&(E0||n0)&&_(P,T0,e0,n,O0),E0)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),m&&P.deltaY<0!==m0<0&&m(P),m0=P.deltaY,O0[0]=O0[1]=O0[2]=0;if(w0||u0){if(p&&p(P),u0)E&&u0===1&&E(P),k&&k(P),u0=0;w0=!1}if(h0&&!(h0=!1)&&I0&&I0(P),p0)$0(P),p0=!1;y0=0},D0=function M0(T0,e0,E0){n[E0]+=T0,O0[E0]+=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=$6(T0,G);var{clientX:e0,clientY:E0}=T0,n0=e0-P.x,b0=E0-P.y,o0=P.isDragging;if(P.x=e0,P.y=E0,o0||(n0||b0)&&(Math.abs(P.startX-e0)>=K||Math.abs(P.startY-E0)>=K))u0||(u0=o0?2:1),o0||(P.isDragging=!0),C0(n0,b0)},s0=P.onPress=function(M0){if(B0(M0,1)||M0&&M0.button)return;P.axis=N9=null,U9.pause(),P.isPressed=!0,M0=$6(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,E0=e0&&(Math.abs(P.x-P.startX)>3||Math.abs(P.y-P.startY)>3),n0=$6(M0);if(!E0&&T0){if(P._vx.reset(),P._vy.reset(),G&&J0)DJ.delayedCall(0.08,function(){if(W6()-H0>300&&!M0.defaultPrevented){if(M0.target.click)M0.target.click();else if(r.createEvent){var b0=r.createEvent("MouseEvents");b0.initMouseEvent("click",!0,!0,M8,1,n0.screenX,n0.screenY,n0.clientX,n0.clientY,!1,!1,!1,!1,0,null),M0.target.dispatchEvent(b0)}}})}P.isDragging=P.isGesturing=P.isPressed=!1,q&&e0&&!c&&U9.restart(!0),u0&&Z0(),O&&e0&&O(P),B&&B(P,E0)},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(),E0=G9();D0((e0-S)*i,(E0-L)*i,1),S=e0,L=E0,q&&U9.restart(!0)},e=function M0(T0){if(B0(T0))return;T0=$6(T0,G),$0&&(p0=!0);var e0=(T0.deltaMode===1?Y:T0.deltaMode===2?M8.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:E0}=T0,n0=e0-P.x,b0=E0-P.y;P.x=e0,P.y=E0,w0=!0,q&&U9.restart(!0),(n0||b0)&&C0(n0,b0)},z0=function M0(T0){P.event=T0,v(P)},x0=function M0(T0){P.event=T0,s(P)},E9=function M0(T0){return B0(T0)||$6(T0,G)&&_0(P)};U9=P._dc=DJ.delayedCall(N||0.25,Q0).pause(),P.deltaX=P.deltaY=0,P._vx=EK(0,50,!0),P._vy=EK(0,50,!0),P.scrollX=U0,P.scrollY=G9,P.isDragging=P.isGesturing=P.isPressed=!1,w5(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&&P5||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),_0&&mJ(X,"click",E9),t&&mJ(r,"gesturestart",X0),j&&mJ(r,"gestureend",W0),v&&mJ(X,gQ+"enter",z0),s&&mJ(X,gQ+"leave",x0),p&&mJ(X,gQ+"move",o);P.isEnabled=!0,P.isDragging=P.isGesturing=P.isPressed=w0=u0=!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&&K6(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",E9),pJ(r,"gesturestart",X0),pJ(r,"gestureend",W0),pJ(X,gQ+"enter",z0),pJ(X,gQ+"leave",x0),pJ(X,gQ+"move",o),P.isEnabled=P.isPressed=P.isDragging=!1,a0&&a0(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&&K6(X)&&(w7=P),P.enable(F)},sz(J,[{key:"velocityX",get:function $(){return this._vx.getVelocity()}},{key:"velocityY",get:function $(){return this._vy.getVelocity()}}]),J}();c9.version="3.14.2";c9.create=function(J){return new c9(J)};c9.register=_5;c9.getAll=function(){return c$.slice()};c9.getById=function(J){return c$.filter(function(Q){return Q.vars.id===J})[0]};S5()&&DJ.registerPlugin(c9);/*! * ScrollTrigger 3.14.2 * 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,D8,B9,WU,TK,B6,N6,X6,FK,TJ,xK,rY,lJ,x5,b5,a$,a5,lY,r5,uJ,tY,t5,e5,YQ,eY,KU,r$,HU,R6,JU,cY,OK=1,jJ=Date.now,sY=jJ(),j8=0,Y6=0,y5=function J(Q,$,Z){var W=B8(Q)&&(Q.substr(0,6)==="clamp("||Q.indexOf("max")>-1);return Z["_"+$+"Clamp"]=W,W?Q.substr(6,Q.length-7):Q},h5=function J(Q,$){return $&&(!B8(Q)||Q.substr(0,6)!=="clamp(")?"clamp("+Q+")":Q},az=function J(){return Y6&&requestAnimationFrame(J)},f5=function J(){return xK=1},v5=function J(){return xK=0},Z7=function J(Q){return Q},U6=function J(Q){return Math.round(Q*1e5)/1e5||0},JN=function J(){return typeof window!=="undefined"},QN=function J(){return A0||JN()&&(A0=window.gsap)&&A0.registerPlugin&&A0},cQ=function J(Q){return!!~WU.indexOf(Q)},$N=function J(Q){return(Q==="Height"?HU:K9["inner"+Q])||D8["client"+Q]||B9["client"+Q]},ZN=function J(Q){return T7(Q,"getBoundingClientRect")||(cQ(Q)?function(){return SK.width=K9.innerWidth,SK.height=HU,SK}:function(){return j7(Q)})},rz=function J(Q,$,Z){var{d:W,d2:K,a:H}=Z;return(H=T7(Q,"getBoundingClientRect"))?function(){return H()[W]}:function(){return($?$N(K):Q["client"+K])||0}},tz=function J(Q,$){return!$||~s8.indexOf(Q)?ZN(Q):function(){return SK}},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()-ZN(Q)()[K]:cQ(Q)?(D8[Z]||B9[Z])-$N(W):Q[Z]-Q["offset"+W])},MK=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 _K?_K[Q]*$:~Q.indexOf("%")?parseFloat(Q)*$/100:parseFloat(Q)||0)}return Q},zK=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"),F=cQ(Z)||T7(Z,"pinType")==="fixed",E=Q.indexOf("scroller")!==-1,O=F?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:"+((E||Y)&&F?"fixed;":"absolute;"),(E||Y||!F)&&(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],PK(M,0,W,k),M},PK=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={},D6,m5=function J(){return jJ()-j8>34&&(D6||(D6=requestAnimationFrame(_7)))},o$=function J(){if(!uJ||!uJ.isPressed||uJ.startX>B9.clientWidth){if($9.cache++,uJ)D6||(D6=requestAnimationFrame(_7));else _7();j8||nQ("scrollStart"),j8=jJ()}},oY=function J(){e5=K9.innerWidth,t5=K9.innerHeight},q6=function J(Q){$9.cache++,(Q===!0||!TJ&&!r5&&!x9.fullscreenElement&&!x9.webkitFullscreenElement&&(!tY||e5!==K9.innerWidth||Math.abs(K9.innerHeight-t5)>K9.innerHeight*0.25))&&TK.restart(!0)},sQ={},$V=[],XN=function J(){return qJ(H9,"scrollEnd",J)||mQ(!0)},nQ=function J(Q){return sQ[Q]&&sQ[Q].map(function($){return $()})||$V},L8=[],YN=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)}),u5(!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)}),GN(KU,1),TK.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,AK=1,L6,_7=function J(Q){if(Q===2||!cJ&&!R6){H9.isUpdating=!0,L6&&L6.update(0);var $=Z9.length,Z=jJ(),W=Z-sY>=50,K=$&&Z9[0].scroll();if(AK=$U>K?-1:1,cJ||($U=K),W){if(j8&&!xK&&Z-j8>200)j8=0,nQ("scrollEnd");X6=sY,sY=Z}if(AK<0){lJ=$;while(lJ-- >0)Z9[lJ]&&Z9[lJ].update(0,W);AK=1}else for(lJ=0;lJ<$;lJ++)Z9[lJ]&&Z9[lJ].update(0,W);H9.isUpdating=!1}D6=0},ZU=[WN,KN,YU,XU,S8+M6,S8+E6,S8+O6,S8+F6,"display","flexShrink","float","zIndex","gridColumnStart","gridColumnEnd","gridRowStart","gridRowEnd","gridArea","justifySelf","alignSelf","placeSelf","order"],wK=ZU.concat([dQ,uQ,"boxSizing","max"+e$,"max"+UU,"position",S8,t9,t9+O6,t9+E6,t9+M6,t9+F6]),WV=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]=jK(Q,SJ)+YJ,H[uQ]=jK(Q,r9)+YJ,H[t9]=X[S8]=X[KN]=X[WN]="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}},KV=/([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&&PK(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(E="scroll"+W.d2,PK(H,T,W,z&&T>20||!z&&(q?Math.max(B9[E],D8[E]):H.parentNode[E])<=T+1),q)U=j7(X),q&&(H.style[W.op.p]=U[W.op.p]-W.op.m-H._offset+YJ)}if(R&&k)E=j7(k),R.seek(N),O=j7(k),R._caScrollDist=E[W.p]-O[W.p],Q=Q/R._caScrollDist*N;return R&&R.seek(F),R?Q:Math.round(Q)},XV=/(webkit|moz|length|cssText|inset)/i,c5=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&&!XV.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)}},NN=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}},kK=function J(Q,$,Z){var W={};W[$.p]="+="+Z,A0.set(Q,W)},s5=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 F=NN(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 F(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)},NJ(Q,"wheel",Z.wheelHandler),H9.isTouch&&NJ(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),!Y6){this.update=this.refresh=this.kill=Z7;return}Z=g5(B8(Z)||G6(Z)||Z.nodeType?{trigger:Z}:Z,DK);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,F=K.invalidateOnRefresh,E=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),m=A0.core.getCache(b),v=cQ(b),s=("pinType"in Z?Z.pinType:T7(b,"pinType")||v&&"fixed")==="fixed",p=[Z.onEnter,Z.onLeave,Z.onEnterBack,Z.onLeaveBack],h=_&&Z.toggleActions.split(" "),c="markers"in Z?Z.markers:DK.markers,t=v?0:parseFloat(T8(b)["border"+V.p2+e$])||0,j=this,$0=Z.onRefreshInit&&function(){return Z.onRefreshInit(j)},L0=rz(b,v,V),a0=tz(b,v),_0=0,i=0,K0=0,J0=S7(b,V),k0,I0,y0,U9,u0,w0,p0,h0,N9,P,O9,m0,R9,U0,G9,S,L,g,a,r,n,O0,H0,S0,B0,Q0,Z0,D0,C0,q0,s0,x,X0,W0,N0,e,o,z0,x0;if(j._startClamp=j._endClamp=!1,j._dir=V,E*=45,j.scroller=b,j.scroll=w?w.time.bind(w):J0,U9=J0(),j.vars=Z,W=W||Z.animation,"refreshPriority"in Z)a5=1,Z.refreshPriority===-9999&&(L6=j);if(m.tweenScroll=m.tweenScroll||{top:s5(b,r9),left:s5(b,SJ)},j.tweenTo=k0=m.tweenScroll[V.p],j.scrubDuration=function(E0){if(X0=G6(E0)&&E0,!X0)x&&x.progress(1).kill(),x=0;else x?x.duration(E0):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,D8]:b,{scrollBehavior:"auto"}),$9.forEach(function(E0){return _J(E0)&&E0.target===(v?x9.scrollingElement||D8:b)&&(E0.smooth=!1)}),y0=_J(B.snapTo)?B.snapTo:B.snapTo==="labels"?JV(W):B.snapTo==="labelsDirectional"?QV(W):B.directional!==!1?function(E0,n0){return GU(B.snapTo)(E0,jJ()-i<500?0:n0.direction)}:A0.utils.snap(B.snapTo),W0=B.duration||{min:0.1,max:2},W0=pQ(W0)?N6(W0.min,W0.max):N6(W0,W0),N0=A0.delayedCall(B.delay||X0/2||0.1,function(){var E0=J0(),n0=jJ()-i<500,b0=k0.tween;if((n0||Math.abs(j.getVelocity())<10)&&!b0&&!xK&&_0!==E0){var o0=(E0-w0)/U0,s9=W&&!_?W.totalProgress():o0,i0=n0?0:(s9-s0)/(jJ()-X6)*1000||0,b9=A0.utils.clamp(-o0,1-o0,n$(i0/2)*i0/0.185),e9=o0+(B.inertia===!1?0:b9),y9,D9,L9=B,VJ=L9.onStart,T9=L9.onInterrupt,kJ=L9.onComplete;if(y9=y0(e9,j),G6(y9)||(y9=e9),D9=Math.max(0,Math.round(w0+y9*U0)),E0<=p0&&E0>=w0&&D9!==E0){if(b0&&!b0._initted&&b0.data<=n$(D9-E0))return;if(B.inertia===!1)b9=y9-o0;k0(D9,{duration:W0(n$(Math.max(n$(e9-s9),n$(y9-s9))*0.185/i0/0.05||0)),ease:B.ease||"power3",data:n$(D9-E0),onInterrupt:function z8(){return N0.restart(!0)&&T9&&T9(j)},onComplete:function z8(){if(j.update(),_0=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)}},E0,b9*U0,D9-E0-b9*U0),VJ&&VJ(j,k0.tween)}}else if(j.isActive&&_0!==E0)N0.restart(!0)}).pause()}if(Y&&(QU[Y]=j),N=j.trigger=dJ(N||R!==!0&&R),x0=N&&N._gsap&&N._gsap.stRevert,x0&&(x0=x0(j)),R=R===!0?N:dJ(R),B8(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=VK(C));I0.spacer=g=C||x9.createElement("div"),g.classList.add("pin-spacer"),Y&&g.classList.add("pin-spacer-"+Y),I0.pinState=G9=VK(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,YJ),iY(R,g,C0),L=VK(R)}if(c){m0=pQ(c)?g5(c,p5):p5,P=zK("scroller-start",Y,b,V,m0,0),O9=zK("scroller-end",Y,b,V,m0,0,P),a=P["offset"+V.op.d2];var E9=dJ(T7(b,"content")||b);if(h0=this.markerStart=zK("start",Y,E9,V,m0,a,0,w),N9=this.markerEnd=zK("end",Y,E9,V,m0,a,0,w),w&&(z0=A0.quickSetter([h0,N9],V.a,YJ)),!s&&!(s8.length&&T7(b,"fixedMarkers")===!0))ez(v?B9:b),A0.set([P,O9],{force3D:!0}),Q0=A0.quickSetter(P,V.a,YJ),D0=A0.quickSetter(O9,V.a,YJ)}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(E0,n0){if(!n0)return j.kill(!0);var b0=E0!==!1||!j.enabled,o0=TJ;if(b0!==j.isReverted){if(b0)e=Math.max(J0(),j.scroll.rec||0),K0=j.progress,o=W&&W.progress();if(h0&&[h0,N9,P,O9].forEach(function(s9){return s9.style.display=b0?"none":"block"}),b0)TJ=j,j.update(b0);if(R&&(!A||!j.isActive))if(b0)WV(R,g,G9);else iY(R,g,T8(R),B0);b0||j.update(b0),TJ=o0,j.isReverted=b0}},j.refresh=function(E0,n0,b0,o0){if((TJ||!j.enabled)&&!n0)return;if(R&&E0&&j8){NJ(J,"scrollEnd",XN);return}if(!cJ&&$0&&$0(j),TJ=j,k0.tween&&!b0)k0.tween.kill(),k0.tween=0;if(x&&x.pause(),F&&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)}):W.vars.immediateRender&&W.render(0,!0,!0);j.isReverted||j.revert(!0,!0),j._subPinOffset=!1;var s9=L0(),i0=a0(),b9=w?w.duration():W7(b,V),e9=U0<=0.01||!U0,y9=0,D9=o0||0,L9=pQ(b0)?b0.end:Z.end,VJ=Z.endTrigger||N,T9=pQ(b0)?b0.start:Z.start||(Z.start===0||!N?0:R?"0 0":"0 100%"),kJ=j.pinnedContainer=Z.pinnedContainer&&dJ(Z.pinnedContainer,j),z8=N&&Math.max(0,Z9.indexOf(j))||0,JJ=z8,QJ,UJ,X7,tQ,I,y,u,l,d,Y0,R0,G0,V0;if(c&&pQ(b0))G0=A0.getProperty(P,V.p),V0=A0.getProperty(O9,V.p);while(JJ-- >0){if(y=Z9[JJ],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[JJ])z8--,JJ--}if(_J(T9)&&(T9=T9(j)),T9=y5(T9,"start",j),w0=l5(T9,N,s9,V,J0(),h0,P,j,i0,t,s,b9,w,j._startClamp&&"_startClamp")||(R?-0.001:0),_J(L9)&&(L9=L9(j)),B8(L9)&&!L9.indexOf("+="))if(~L9.indexOf(" "))L9=(B8(T9)?T9.split(" ")[0]:"")+L9;else y9=IK(L9.substr(2),s9),L9=B8(T9)?T9:(w?A0.utils.mapRange(0,w.duration(),w.scrollTrigger.start,w.scrollTrigger.end,w0):w0)+y9,VJ=N;L9=y5(L9,"end",j),p0=Math.max(w0,l5(L9||(VJ?"100% 0":b9),VJ,s9,V,J0()+y9,N9,O9,j,i0,t,s,b9,w,j._endClamp&&"_endClamp"))||-0.001,y9=0,JJ=z8;while(JJ--)if(y=Z9[JJ]||{},u=y.pin,u&&y.start-y._pinPush<=w0&&!w&&y.end>0){if(QJ=y.end-(j._startClamp?Math.max(0,y.start):y.start),(u===N&&y.start-y._pinPush=W7(b,V))){if(QJ=T8(R),tQ=V===r9,X7=J0(),O0=parseFloat(r(V.a))+D9,!b9&&p0>1){if(R0=(v?x9.scrollingElement||D8: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,QJ),L=VK(R),UJ=j7(R,!0),l=s&&S7(b,tQ?SJ:r9)(),M){if(B0=[M+V.os2,U0+D9+YJ],B0.t=g,JJ=M===t9?jK(R,V)+U0+D9:0,JJ)B0.push(V.d,JJ+YJ),g.style.flexBasis!=="auto"&&(g.style.flexBasis=JJ+YJ);if(t$(B0),kJ)Z9.forEach(function(P0){if(P0.pin===kJ&&P0.vars.pinSpacing!==!1)P0._subPinOffset=!0});s&&J0(e)}else JJ=jK(R,V),JJ&&g.style.flexBasis!=="auto"&&(g.style.flexBasis=JJ+YJ);if(s)I={top:UJ.top+(tQ?X7-w0:l)+YJ,left:UJ.left+(tQ?l:X7-w0)+YJ,boxSizing:"border-box",position:"fixed"},I[dQ]=I["max"+e$]=Math.ceil(UJ.width)+YJ,I[uQ]=I["max"+UU]=Math.ceil(UJ.height)+YJ,I[S8]=I[S8+O6]=I[S8+E6]=I[S8+M6]=I[S8+F6]="0",I[t9]=QJ[t9],I[t9+O6]=QJ[t9+O6],I[t9+E6]=QJ[t9+E6],I[t9+M6]=QJ[t9+M6],I[t9+F6]=QJ[t9+F6],S=HV(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){UJ=N.parentNode;while(UJ&&UJ!==B9){if(UJ._pinOffset)w0-=UJ._pinOffset,p0-=UJ._pinOffset;UJ=UJ.parentNode}}if(Y0&&Y0.forEach(function(P0){return P0.revert(!1,!0)}),j.start=w0,j.end=p0,U9=u0=cJ?e:J0(),!w&&!cJ)U90?Z9.slice(0,n0).reverse():Z9.slice(n0+1);return(B8(E0)?b0.filter(function(o0){return o0.vars.preventOverlaps===E0}):b0).filter(function(o0){return j.direction>0?o0.end<=w0:o0.start>=p0})},j.update=function(E0,n0,b0){if(w&&!b0&&!E0)return;var o0=cJ===!0?e:j.scroll(),s9=E0?0:(o0-w0)/U0,i0=s9<0?0:s9>1?1:s9||0,b9=j.progress,e9,y9,D9,L9,VJ,T9,kJ,z8;if(n0){if(u0=U9,U9=w?J0():o0,B)s0=q0,q0=W&&!_?W.totalProgress():i0}if(E&&R&&!TJ&&!OK&&j8){if(!i0&&w0o0+(o0-u0)/(jJ()-X6)*E)i0=0.9999}if(i0!==b9&&j.enabled){if(e9=j.isActive=!!i0&&i0<1,y9=!!b9&&b9<1,T9=e9!==y9,VJ=T9||!!i0!==!!b9,j.direction=i0>b9?1:-1,j.progress=i0,VJ&&!TJ){if(D9=i0&&!b9?0:i0===1?1:b9===1?2:3,_)L9=!T9&&h[D9+1]!=="none"&&h[D9+1]||h[D9],z8=W&&(L9==="complete"||L9==="reset"||(L9 in W))}if(z&&(T9||z8)&&(z8||q||!W)&&(_J(z)?z(j):j.getTrailing(z).forEach(function(X7){return X7.endAnimation()})),!_){if(x&&!TJ&&!OK)if(x._dp._time-x._start!==x._time&&x.render(x._dp._time-x._start),x.resetTo)x.resetTo("totalProgress",i0,W._tTime/W._tDur);else x.vars.totalProgress=i0,x.invalidate().restart();else if(W)W.totalProgress(i0,!!(TJ&&(i||E0)))}if(R){if(E0&&M&&(g.style[M+V.os2]=S0),!s)n(U6(O0+H0*i0));else if(VJ){if(kJ=!E0&&i0>b9&&p0+1>o0&&o0+1>=W7(b,V),A)if(!E0&&(e9||kJ)){var JJ=j7(R,!0),QJ=o0-w0;c5(R,B9,JJ.top+(V===r9?QJ:0)+YJ,JJ.left+(V===r9?0:QJ)+YJ)}else c5(R,g);t$(e9||kJ?S:L),Z0&&i0<1&&e9||n(O0+(i0===1&&!kJ?H0:0))}}if(B&&!k0.tween&&!TJ&&!OK&&N0.restart(!0),X&&(T9||D&&i0&&(i0<1||!cY))&&B6(X.targets).forEach(function(X7){return X7.classList[e9||D?"add":"remove"](X.className)}),H&&!_&&!E0&&H(j),VJ&&!TJ){if(_){if(z8)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),p[D9]&&nY(j,p[D9]),D&&(i0===1?j.kill(!1,1):p[D9]=0),!T9)D9=i0===1?1:3,p[D9]&&nY(j,p[D9])}if(T&&!e9&&Math.abs(j.getVelocity())>(G6(T)?T:2500))H6(j.callbackAnimation),x?x.progress(1):H6(W,L9==="reverse"?1:!i0,1)}else if(_&&H&&!TJ)H(j)}if(D0){var UJ=w?o0/w.duration()*(w._caScrollDist||0):o0;Q0(UJ+(P._isFlipped?1:0)),D0(UJ)}z0&&z0(-o0/w.duration()*(w._caScrollDist||0))},j.enable=function(E0,n0){if(!j.enabled){if(j.enabled=!0,NJ(b,"resize",q6),v||NJ(b,"scroll",o$),$0&&NJ(J,"refreshInit",$0),E0!==!1)j.progress=K0=0,U9=u0=_0=J0();n0!==!1&&j.refresh()}},j.getTween=function(E0){return E0&&k0?k0.tween:x},j.setPositions=function(E0,n0,b0,o0){if(w){var s9=w.scrollTrigger,i0=w.duration(),b9=s9.end-s9.start;E0=s9.start+b9*E0/i0,n0=s9.start+b9*n0/i0}j.refresh(!1,!1,{start:h5(E0,b0&&!!j._startClamp),end:h5(n0,b0&&!!j._endClamp)},o0),j.update()},j.adjustPinSpacing=function(E0){if(B0&&E0){var n0=B0.indexOf(V.d)+1;B0[n0]=parseFloat(B0[n0])+E0+YJ,B0[1]=parseFloat(B0[1])+E0+YJ,t$(B0)}},j.disable=function(E0,n0){if(E0!==!1&&j.revert(!0,!0),j.enabled){if(j.enabled=j.isActive=!1,n0||x&&x.pause(),e=0,I0&&(I0.uncache=1),$0&&qJ(J,"refreshInit",$0),N0)N0.pause(),k0.tween&&k0.tween.kill()&&(k0.tween=0);if(!v){var b0=Z9.length;while(b0--)if(Z9[b0].scroller===b&&Z9[b0]!==j)return;qJ(b,"resize",q6),v||qJ(b,"scroll",o$)}}},j.kill=function(E0,n0){j.disable(E0,n0),x&&!n0&&x.kill(),Y&&delete QU[Y];var b0=Z9.indexOf(j);if(b0>=0&&Z9.splice(b0,1),b0===lJ&&AK>0&&lJ--,b0=0,Z9.forEach(function(o0){return o0.scroller===j.scroller&&(b0=1)}),b0||cJ||(j.scroll.rec=0),W)W.scrollTrigger=null,E0&&W.revert({kill:!1}),n0||W.kill();if(h0&&[h0,N9,P,O9].forEach(function(o0){return o0.parentNode&&o0.parentNode.removeChild(o0)}),L6===j&&(L6=0),R)I0&&(I0.uncache=1),b0=0,Z9.forEach(function(o0){return o0.pin===R&&b0++}),b0||(I0.spacer=0);Z.onKill&&Z.onKill(j)},Z9.push(j),j.enable(!1,!1),x0&&x0(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&&ZV()},J.register=function $(Z){if(!i$)A0=Z||QN(),JN()&&window.document&&J.enable(),i$=Y6;return i$},J.defaults=function $(Z){if(Z)for(var W in Z)DK[W]=Z[W];return DK},J.disable=function $(Z,W){Y6=0,Z9.forEach(function(H){return H[W?"kill":"disable"](Z)}),qJ(K9,"wheel",o$),qJ(x9,"scroll",o$),clearInterval(FK),qJ(x9,"touchcancel",Z7),qJ(B9,"touchstart",Z7),LK(qJ,x9,"pointerdown,touchstart,mousedown",f5),LK(qJ,x9,"pointerup,touchend,mouseup",v5),TK.kill(),MK(qJ);for(var K=0;K<$9.length;K+=3)BK(qJ,$9[K],$9[K+1]),BK(qJ,$9[K],$9[K+2])},J.enable=function $(){if(K9=window,x9=document,D8=x9.documentElement,B9=x9.body,A0){if(B6=A0.utils.toArray,N6=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(Y6=1,r$=document.createElement("div"),r$.style.height="100vh",r$.style.position="absolute",qN(),az(),c9.register(A0),J.isTouch=c9.isTouch,YQ=c9.isTouch&&/(iPad|iPhone|iPod|Mac)/g.test(navigator.userAgent),tY=c9.isTouch===1,NJ(K9,"wheel",o$),WU=[K9,x9,D8,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(){UN(),qU()}),A0.addEventListener("matchMediaRevert",function(){return YN()}),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(),NJ(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");FK=setInterval(m5,250),A0.delayedCall(0.5,function(){return OK=0}),NJ(x9,"touchcancel",Z7),NJ(B9,"touchstart",Z7),LK(NJ,x9,"pointerdown,touchstart,mousedown",f5),LK(NJ,x9,"pointerup,touchend,mouseup",v5),rY=A0.utils.checkPrefix("transform"),wK.push(rY),i$=jJ(),TK=A0.delayedCall(0.2,mQ).pause(),a$=[x9,"visibilitychange",function(){var{innerWidth:U,innerHeight:G}=K9;if(x9.hidden)x5=U,b5=G;else if(x5!==U||b5!==G)q6()},x9,"DOMContentLoaded",mQ,K9,"load",mQ,K9,"resize",q6],MK(NJ),Z9.forEach(function(U){return U.enable(0,1)});for(Y=0;Y<$9.length;Y+=3)BK(qJ,$9[Y],$9[Y+1]),BK(qJ,$9[Y],$9[Y+2])}}},J.config=function $(Z){"limitCallbacks"in Z&&(cY=!!Z.limitCallbacks);var W=Z.syncInterval;if(W&&clearInterval(FK)||(FK=W)&&setInterval(m5,W),"ignoreMobileResize"in Z&&(tY=J.isTouch===1&&Z.ignoreMobileResize),"autoRefreshEvents"in Z)MK(qJ)||MK(NJ,Z.autoRefreshEvents||"none"),r5=(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,D8,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=(B8(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&&L8.splice($,5),L8.push(Q,Q.style.cssText,Q.getBBox&&Q.getAttribute("transform"),A0.core.getCache(Q),eY())}}):L8};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?q6(!0):(i$||H9.register())&&mQ(!0)};H9.update=function(J){return++$9.cache&&_7(J===!0?2:0)};H9.clearScrollMemory=GN;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(),NJ(H9,"refresh",function(){return K=Q.batchMax()});return B6(J).forEach(function(Y){var U={};for(X in Z)U[X]=Z[X];U.trigger=Y,$.push(H9.create(U))}),$};var n5=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-"+$+(c9.isTouch?" pinch-zoom":""):"none";Q===D8&&J(B9,$)},CK={auto:1,scroll:1},YV=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||!(CK[(Y=T8(K)).overflowY]||CK[Y.overflowX])))K=K.parentNode;H._isScroll=K&&K!==Z&&!cQ(K)&&(CK[(Y=T8(K)).overflowY]||CK[Y.overflowX]),H._isScrollT=X}if(H._isScroll||W==="x")$.stopPropagation(),$._gsapAllow=!0},RN=function J(Q,$,Z,W){return c9.create({target:Q,capture:!0,debounce:!1,lockAxis:!0,type:$,onWheel:W=W&&YV,onPress:W,onDrag:W,onScroll:W,onEnable:function K(){return Z&&NJ(x9,c9.eventTypes[0],i5,!1,!0)},onDisable:function K(){return qJ(x9,c9.eventTypes[0],i5,!0)}})},UV=/(input|label|select|textarea)/i,o5,i5=function J(Q){var $=UV.test(Q.target.tagName);if($||o5)Q._gsapAllow=!0,o5=$},GV=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)||D8,G=A0.core.globals().ScrollSmoother,q=G&&G.get(),N=YQ&&(Q.content&&dJ(Q.content)||q&&Q.content!==!1&&!q.smooth()&&q.content()),R=S7(U,r9),M=S7(U,SJ),F=1,E=(c9.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=RN(U,Q.type,!0,K),C=function h(){return B=!1},w=Z7,T=Z7,z=function h(){Y=W7(U,r9),T=N6(YQ?1:0,Y),Z&&(w=N6(0,W7(U,SJ))),D=lQ},V=function h(){N._gsap.y=U6(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=U6(X.deltaY/2),t=T(R.v-c);if(N&&t!==R.v+R.offset){R.offset=t-R.v;var j=U6((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,m,v,s,p=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 YQ&&h.type==="touchmove"&&_(h)||F>1.05&&h.type!=="touchstart"||X.isGesturing||h.touches&&h.touches.length>1},Q.onPress=function(){B=!1;var h=F;F=U6((K9.visualViewport&&K9.visualViewport.scale||1)/E),b.pause(),h!==F&&aY(U,F>1.01?!0:Z?!1:"x"),m=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,$0;if(Z)j=M(),$0=j+t*0.05*-h.velocityX/0.227,t*=n5(M,j,$0,W7(U,SJ)),b.vars.scrollX=w($0);if(j=R(),$0=j+t*0.05*-h.velocityY/0.227,t*=n5(R,j,$0,W7(U,r9)),b.vars.scrollY=T($0),b.invalidate().duration(t).play(0.01),YQ&&b.vars.scrollY>=Y||j>=Y-1)A0.to({},{onUpdate:p,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,$0){if(lQ!==D&&z(),c&&Z&&M(w(j[2]===c?m+(h.startX-h.x):M()+c-j[1])),t){R.offset&&V();var L0=$0[2]===t,a0=L0?v+h.startY-h.y:R()+t-$0[1],_0=T(a0);L0&&a0!==_0&&(v+=_0-a0),R(_0)}(t||c)&&_7()},Q.onEnable=function(){if(aY(U,Z?!1:"x"),H9.addEventListener("refresh",p),NJ(K9,"resize",p),R.smooth)R.target.style.scrollBehavior="auto",R.smooth=M.smooth=!1;A.enable()},Q.onDisable=function(){aY(U,!0),qJ(K9,"resize",p),H9.removeEventListener("refresh",p),A.kill()},Q.lockAxis=Q.lockAxis!==!1,X=new c9(Q),X.iOS=YQ,YQ&&!R()&&R(1),YQ&&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:NN(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 c9(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 c9?J:GV(J);return uJ&&uJ.target===Q.target&&uJ.kill(),cQ(Q.target)&&(uJ=Q),Q};H9.core={_getVelocityProp:EK,_inputObserver:RN,_scrollers:$9,_proxies:s8,bridge:{ss:function J(){j8||nQ("scrollStart"),j8=jJ()},ref:function J(){return TJ}}};QN()&&A0.registerPlugin(H9);/*! * SplitText 3.14.2 * https://gsap.com * * @license Copyright 2025, GreenSock. All rights reserved. Subject to the terms at https://gsap.com/standard-license. * @author: Jack Doyle */var z6,JZ,EN=typeof Symbol==="function"?Symbol():"_split",RU,qV=()=>RU||yK.register(window.gsap),FN=typeof Intl!=="undefined"&&"Segmenter"in Intl?new Intl.Segmenter:0,V6=(J)=>typeof J==="string"?V6(document.querySelectorAll(J)):("length"in J)?Array.from(J).reduce((Q,$)=>{return typeof $==="string"?Q.push(...V6($)):Q.push($),Q},[]):[J],ON=(J)=>V6(J).filter((Q)=>Q instanceof HTMLElement),EU=[],NU=function(){},NV={add:(J)=>J()},RV=/\s+/g,MN=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"),bK={left:0,top:0,width:0,height:0},EV=(J,Q)=>{while(++Q{J.innerHTML=Q,$?J.setAttribute("aria-label",$):J.removeAttribute("aria-label"),Z?J.setAttribute("aria-hidden",Z):J.removeAttribute("aria-hidden")},BN=(J,Q)=>{if(Q){let $=new Set(J.join("").match(Q)||EU),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,$),FU=(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},FV=(J,Q,$,Z)=>{let W=FU("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:F}=Q,E=J.getBoundingClientRect(),O=E,k=!M&&window.getComputedStyle(J).whiteSpace.substring(0,3)==="pre",D=0,B=$.collection,A,C,w,T,z,V,_,b,m,v,s,p,h,c,t,j,$0,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&&m===1&&!_&&V.insertBefore(D,V.firstChild);if(Z){s=FN?BN([...FN.segment(j)].map((a0)=>a0.segment),Y):j.match(X)||EU;for(L0=0;L0O.top&&v.left<=O.left){p=J.cloneNode(),h=J.childNodes[0];while(h&&h!==V)c=h,h=h.nextSibling,p.appendChild(c);J.parentNode.insertBefore(p,J),W&&DN(p)}O=v}if(m=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 zN(T,Q,$,Z,W,K,H,X,Y,!0),D=0;W&&DN(T)}},VN=class J{constructor(Q,$){this.isSplit=!1,qV(),this.elements=ON(Q),this.chars=[],this.words=[],this.lines=[],this.masks=[],this.vars=$,this.elements.forEach((H)=>{var X;$.overwrite!==!1&&((X=H[EN])==null||X._data.orig.filter(({element:Y})=>Y===H).forEach(LN)),H[EN]=this}),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){return(this._ctx||NV).add(()=>{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),F=M?new RegExp(M.source+"|"+MN.source,"gu"):MN,E=!!Q.ignore&&ON(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?FU("char",Q,w):null,_=FU("word",Q,T),b,m,v,s;if(zN(A,Q,_,V,R,W&&(G||R),E,F,M,!1),G){let p=V6(A.childNodes),h=FV(A,p,Q,z),c,t=[],j=0,$0=p.map((_0)=>_0.nodeType===1?_0.getBoundingClientRect():bK),L0=bK,a0;for(b=0;bL0.top&&a0.left{var i;return(i=_0.parentNode)==null?void 0:i.removeChild(_0)})}if(!N){for(b=0;b{let C=A.cloneNode();return A.replaceWith(C),C.appendChild(A),A.className&&(C.className=A.className.trim()+"-mask"),C.style.overflow="clip",C}));if(this.isSplit=!0,JZ&&G&&(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;G&&X&&this.elements.forEach((A,C)=>{O[C].width=A.offsetWidth,D&&D.observe(A)})}),this}kill(){let{obs:Q}=this._data;Q&&Q.disconnect(),JZ==null||JZ.removeEventListener("loadingdone",this._split)}revert(){var Q,$;if(this.isSplit){let{orig:Z,anim:W}=this._data;if(this.kill(),Z.forEach(LN),this.chars.length=this.words.length=this.lines.length=Z.length=this.masks.length=0,this.isSplit=!1,W)this._data.animTime=W.totalTime(),W.revert();($=(Q=this.vars).onRevert)==null||$.call(Q,this)}return this}static create(Q,$){return new J(Q,$)}static register(Q){if(z6=z6||Q||window.gsap,z6)V6=z6.utils.toArray,NU=z6.core.context||NU;if(!RU&&window.innerWidth>0)JZ=document.fonts,RU=!0}};VN.version="3.14.2";var yK=VN;var kN=()=>{return window.matchMedia("(prefers-reduced-motion: reduce)").matches};var OV=/(ipad|tablet|(android(?!.*mobile))|playbook|silk|kindle|nexus 7|nexus 9|nexus 10|sm-t|tab)/i,$Z=()=>{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},MV=()=>{let J=navigator.userAgent||navigator.vendor||window.opera,Q=navigator.platform||"",$=/\biPad\b/i.test(J),Z=/Macintosh/i.test(J)&&navigator.maxTouchPoints>1&&Q==="MacIntel";if($||Z)return!0;let W=OV.test(J),K=window.matchMedia("(pointer: coarse)").matches,H=Math.min(window.screen.width,window.screen.height),X=Math.max(window.screen.width,window.screen.height),Y=K&&H>=600&&H<=1100&&X<=1400;return(W||Y)&&!$Z()},zJ=()=>{if($Z()||MV())return!0;let J=Math.min(window.innerWidth,window.innerHeight),Q=Math.max(window.innerWidth,window.innerHeight);return(window.devicePixelRatio||1)>=2&&J>=800&&J<=1100&&Q>=1200&&Q<=1400};Q6.registerPlugin(H9);var LV={ease:"expo.out",duration:1.2};Q6.defaults(LV);var g4=kN(),RJ=Q6;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 CN extends OU{constructor(){super();RJ.ticker.add(this.update.bind(this))}update(J,Q){this.notify({deltaTime:J,time:Q*0.01})}}class IN 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 k6=new CN,xJ=new IN;var PN=`#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 AN=`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 a9{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 IQ(J.source.r,1,1,1),this.material=new wN(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 wN extends xZ{constructor(J,Q=null,$={}){let Z=Q||J,K=($?.u_distortionIntensity||0.006)*($?.distortionIntensityMultiplier||1);super({vertexShader:PN,fragmentShader:AN,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===RX)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),J;if(Q===P$||Q===VZ){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 ZR(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 zV(){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 xN{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 nN{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 oN{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 iN{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 aN{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,F=new f,E=new iJ,O=new f(1,1,1),k=new SW(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 SV=new r0;class ZR{constructor(J={},Q={}){this.json=J,this.extensions={},this.plugins={},this.options=Q,this.cache=new zV,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 pW(this.options.manager);if(this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new bZ(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)F.setY(T,A[C*X+1]);if(X>=3)F.setZ(T,A[C*X+2]);if(X>=4)F.setW(T,A[C*X+3]);if(X>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}F.normalized=R}return F})}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=TN[q.magFilter]||FJ,U.minFilter=TN[q.minFilter]||M7,U.wrapS=jN[q.wrapS]||z$,U.wrapT=jN[q.wrapT]||z$,U.generateMipmaps=!U.isCompressedTexture&&U.minFilter!==d8&&U.minFilter!==FJ,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 F=new i9(M);F.needsUpdate=!0,q(F)};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||wV(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 _Z,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 jZ,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 c0(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 c0().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 _N(X,H,Q)})}let K=[];for(let H=0,X=J.length;H0)PV(E,W);if(E.name=Q.createUniqueName(W.name||"mesh_"+J),K7(E,W),F.extensions)iQ(Z,E,F);Q.assignFinalMaterial(E),G.push(E)}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 i9)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(UQ[W.path]===UQ.weights)J.traverse(function(q){if(q.morphTargetInfluences)X.push(q.name?q.name:q.uuid)});else X.push(H);let Y;switch(UQ[W.path]){case UQ.weights:Y=F7;break;case UQ.rotation:Y=D7;break;case UQ.translation:case UQ.scale:Y=O7;break;default:switch($.itemSize){case 1:Y=F7;break;case 2:case 3:default:Y=O7;break}break}let U=Z.interpolation!==void 0?kV[Z.interpolation]:OW,G=this._getArrayFromAccessor($);for(let q=0,N=X.length;q{return new Promise(($,Z)=>{jV.load(J,(W)=>{let K={model:W.scene};$(K)})})};var _V=new j$;function IU(J){return new Promise((Q)=>{_V.load(J,($)=>{$.needsUpdate=!0,$.source.w=$.source.data.width,$.source.h=$.source.data.height,$.source.r=$.source.data.width/$.source.data.height,Q($)})})}var KR={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"},HR={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 XR(J=null){let Q=J||KR,$=[],Z=[];for(let H in Q){let X=Q[H],Y=X.split(".").pop();if(Y==="glb"||Y==="gltf")$.push(WR(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 SR=YE(wR());var fV=0.0002,vV=0.0008,gV=0.1,bU=1,TR=1,yU=0;function jR({scrollSpeed:J,scrollEase:Q}={}){if(typeof J==="number"&&J>0)bU=J;if(typeof Q==="number"&&Q>0)TR=Q}class _R extends AW{isOn=!0;scrollT=0;currentScrollT=0;lerpFactor=gV;moonBaseYOffsetFactor=-0.1;moonOscillationAmplitude=0.01;moonOscillationSpeed=0.0001;#J;#$;#Z;#Q;#W=null;constructor(J){super();this.create()}async create(){this.assets=await XR(HR);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(zJ())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=SR.default(Z).pixelY*fV*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(zJ())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(zJ())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)*vV*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},!zJ())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*TR),yU=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 xR={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` \t\tvarying vec2 vUv; \t\tvoid main() { \t\t\tvUv = uv; \t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); \t\t}`,fragmentShader:` \t\tuniform float opacity; \t\tuniform sampler2D tDiffuse; \t\tvarying vec2 vUv; \t\tvoid main() { \t\t\tvec4 texel = texture2D( tDiffuse, vUv ); \t\t\tgl_FragColor = opacity * texel; \t\t}`};class GQ{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 pV=new V7(-1,1,1,-1,0,1);class bR extends OJ{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 mV=new bR;class hU{constructor(J){this._mesh=new a9(mV,J)}dispose(){this._mesh.geometry.dispose()}render(J){J.render(this._mesh,pV)}get material(){return this._mesh.material}set material(J){this._mesh.material=J}}class I6 extends GQ{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=kW.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 hU(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 pK extends GQ{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 fU extends GQ{constructor(){super();this.needsSwap=!1}render(J){J.state.buffers.stencil.setLocked(!1),J.state.buffers.stencil.setTest(!1)}}class vU{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 I6(xR),this.copyPass.material.blending=p8,this.clock=new mW}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 sX({});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(cV.clearColor,1),this.vp.container.appendChild(this.renderer.domElement),this.camera=new $J(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 iX(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=zJ();if(this.wasMobile&&!J)this.wasMobile=!1,this.initializeWebGL();else if(!this.wasMobile&&J)this.wasMobile=!0,this.destroyWebGL()}setupMouseTracking(){if(zJ())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(zJ())return;queueMicrotask(()=>{this.setSceneForPathname(window.location.pathname),this.post=new mU,this.paused=!1})}render(){if(this.paused||!this.renderer||zJ())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(zJ()||!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)}getSceneKey(J){return"home-v2"}setScene(J){if(this.scene=J,this.post?.renderPass)this.post.renderPass.scene=J}setSceneForPathname(J){if(zJ()||!this.vp)return;let Q=this.getSceneKey(J);this.sceneKey=Q;let $=new _R(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 fR;var sV=[],dU=[];function mK(J){dU.push(J)}function P6(J){sV.push(J)}function gR(){dU.forEach((J)=>J()),dU.length=0}var vR=[],uU=[];function pR(J,{element:Q}={}){if(Q)vR.push(async()=>{let $=Q.getBoundingClientRect();return $.top0?await J():Promise.resolve()});else vR.push(J)}function mR(J){uU.push(J)}async function dR(){await Promise.allSettled(uU.map((J)=>J())),uU.length=0}function A6(J,{root:Q,rootMargin:$,threshold:Z,autoStart:W,once:K,callback:H}){let X=new w6(J,{root:Q,rootMargin:$,threshold:Z,autoStart:W,once:K,callback:H});return P6(()=>{X.destroy()}),X}var lU={};x7(lU,{default:()=>cR});class lR{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 lR;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 nV={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)}},dK=new Proxy(H7.proxy,nV);function cR(J,Q){if(dK.on("SOMETHING",($)=>{}),$Z())return;mR(async()=>{await RJ.to(J,{duration:0.2,backgroundColor:"green"})}),pR(async()=>{await RJ.to(J,{duration:1,backgroundColor:"blue"}),await RJ.to(J,{duration:1,autoAlpha:0})},{element:J}),mK(()=>{}),P6(()=>{})}var cU={};x7(cU,{default:()=>nR});function sR(){let J=window.Webflow||[];if(J.length>0)J.forEach((Q)=>{Q.destroy(),Q.ready()})}function nR(J,Q){mK(()=>{setTimeout(()=>{sR()},500)})}var sU={};x7(sU,{default:()=>iR});var oV=1,oR="linear",iV=(J,Q,$,Z)=>{let K=Z.offsetWidth;Q.to(J,{scale:1,duration:0.3333333333333333,ease:"back.out"}),Q.to(J,{x:-K,duration:1,ease:oR}),Q.to(J,{scale:0,duration:0.5,ease:"back.in"}),Q.to(J,{duration:0.25,ease:oR})};function iR(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)RJ.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(),!!zJ()){RJ.set(N,{visibility:"visible",scale:0}),$=RJ.timeline({repeat:-1});let F=3;N.forEach((E,O)=>{$.to(E,{scale:1,duration:0.3,ease:"back.out"}),$.to(E,{duration:F-0.6}),$.to(E,{scale:0,duration:0.3,ease:"back.in"})}),K=A6(J,{autoStart:!0,callback:({isIn:E})=>{if(E)$?.play();else $?.pause()}})}else RJ.set(N,{visibility:"visible",opacity:1,x:0,clearProps:"xPercent"}),Z=RJ.timeline({paused:!0}),N.forEach((F,E)=>{iV(F,Z,E,q)}),K=A6(J,{autoStart:!0,callback:({isIn:F})=>{if(F)W=k6.add(({time:E})=>{Z.progress(yU*oV)});else W?.(),W=null}})};G(),H=xJ.add(()=>{G()}),P6(()=>{H?.(),U()})}var nU={};x7(nU,{default:()=>aR});function aR(J,Q){dK.on("PAGE",($)=>{})}var oU={};x7(oU,{default:()=>rR});function aV(J){J.setAttribute("aria-hidden","true"),J.style.position="absolute",J.style.left="-9999px",J.style.top="-9999px",J.style.width="1px"}var rV=(J)=>{let Q=J.textContent;J.textContent="";let $=document.createElement("span");$.textContent=Q,J.appendChild($),aV($);let Z=document.createElement("span");return Z.setAttribute("data-css","overflow-clip"),Z.textContent=Q,Z.setAttribute("aria-hidden","true"),J.appendChild(Z),new yK(Z,{type:"chars"})};function rR(J){if($Z())return;let Q=rV(J);A6(J,{autoStart:!0,callback:({isIn:$})=>{if($)RJ.to(Q.chars,{yPercent:0,stagger:0.02});else RJ.killTweensOf(Q.chars),RJ.set(Q.chars,{yPercent:100})}})}var iU={};x7(iU,{default:()=>tR});function tR(J,Q){}var aU={};x7(aU,{default:()=>eR});var tV="https://cdn.prod.website-files.com/683e5da0b6d8a19de4875ae7/697a4d654f82d4c07fa1aff6_Frame%202147228493.avif";function eR(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))jR({scrollSpeed:!Number.isNaN(W)?W:void 0,scrollEase:!Number.isNaN(K)?K:void 0});if(zJ())J.style.backgroundImage=`url("${tV}")`,J.style.backgroundPosition="center center",J.style.backgroundSize="cover",J.style.backgroundRepeat="no-repeat";else J.style.backgroundImage="",J.style.backgroundPosition="",J.style.backgroundSize="",J.style.backgroundRepeat=""}var rU={"./../cycle.ts":lU,"./../form.ts":cU,"./../hero-content.ts":sU,"./../nav.ts":nU,"./../split.ts":oU,"./../test.ts":iU,"./../webgl.ts":aU};function JE(J="module"){return Array.from(document.querySelectorAll(`[data-${J}]`)).map((Q)=>{let $=Q,Z=$.dataset[J];if($._moduleInitialized)return null;let W=rU[`./../${Z}.ts`]?`./../${Z}.ts`:`./../${Z}.js`;if(rU[W]){let K=rU[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 w6{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 QE=(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 $E(J,Q,$,Z,W){return Z+(W-Z)*(J-Q)/($-Q)}function ZE(J,Q,$){return Math.min(Math.max($,J),Q)}var eV={bounds:[0,1],top:"bottom",bottom:"top",callback:void 0};class uR extends w6{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={...eV,...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=Jk(this.element,this.config),this.resize?.(this.bounds),this.#Q()};#Q(){if(!this.inView||!this.init)return;this.value=ZE(0,1,$E(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 Jk(J,Q){let $=QE(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 WE{gl=k9;constructor(){JE(),dR(),gR()}}var Qk=new WE;})(); //# debugId=5E9182FB8BA2C3CF64756E2164756E21