"use strict";(()=>{var pA=Object.create;var H0=Object.defineProperty;var mA=Object.getOwnPropertyDescriptor;var gA=Object.getOwnPropertyNames;var _A=Object.getPrototypeOf,vA=Object.prototype.hasOwnProperty;var xA=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var yA=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of gA(t))!vA.call(r,i)&&i!==e&&H0(r,i,{get:()=>t[i],enumerable:!(n=mA(t,i))||n.enumerable});return r};var MA=(r,t,e)=>(e=r!=null?pA(_A(r)):{},yA(t||!r||!r.__esModule?H0(e,"default",{value:r,enumerable:!0}):e,r));var fM=xA((ml,wc)=>{(function(){var r,t="4.17.21",e=200,n="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",i="Expected a function",o="Invalid `variable` option passed into `_.template`",l="__lodash_hash_undefined__",c=500,u="__lodash_placeholder__",f=1,d=2,g=4,p=1,m=2,M=1,y=2,v=4,x=8,E=16,b=32,T=64,U=128,L=256,I=512,N=30,A="...",w=800,B=16,V=1,Z=2,j=3,rt=1/0,$=9007199254740991,nt=17976931348623157e292,K=NaN,gt=4294967295,z=gt-1,bt=gt>>>1,jt=[["ary",U],["bind",M],["bindKey",y],["curry",x],["curryRight",E],["flip",I],["partial",b],["partialRight",T],["rearg",L]],fe="[object Arguments]",ot="[object Array]",_t="[object AsyncFunction]",Et="[object Boolean]",wt="[object Date]",kt="[object DOMException]",Ht="[object Error]",ae="[object Function]",_e="[object GeneratorFunction]",k="[object Map]",Jt="[object Number]",re="[object Null]",se="[object Object]",Ut="[object Promise]",et="[object Proxy]",Vt="[object RegExp]",Gt="[object Set]",O="[object String]",C="[object Symbol]",it="[object Undefined]",ft="[object WeakMap]",mt="[object WeakSet]",at="[object ArrayBuffer]",zt="[object DataView]",yt="[object Float32Array]",Ct="[object Float64Array]",Qt="[object Int8Array]",Mt="[object Int16Array]",It="[object Int32Array]",Kt="[object Uint8Array]",ee="[object Uint8ClampedArray]",Pt="[object Uint16Array]",ne="[object Uint32Array]",de=/\b__p \+= '';/g,ze=/\b(__p \+=) '' \+/g,X=/(__e\(.*?\)|\b__t\)) \+\n'';/g,lt=/&(?:amp|lt|gt|quot|#39);/g,ut=/[&<>"']/g,ht=RegExp(lt.source),St=RegExp(ut.source),Yt=/<%-([\s\S]+?)%>/g,me=/<%([\s\S]+?)%>/g,Ge=/<%=([\s\S]+?)%>/g,Ye=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,be=/^\w*$/,ie=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Wt=/[\\^$.*+?()[\]{}|]/g,Ie=RegExp(Wt.source),Tt=/^\s+/,ue=/\s/,te=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,he=/\{\n\/\* \[wrapped with (.+)\] \*/,nn=/,? & /,xe=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Je=/[()=,{}\[\]\/\s]/,xn=/\\(\\)?/g,Ke=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ze=/\w*$/,He=/^[-+]0x[0-9a-f]+$/i,ri=/^0b[01]+$/i,P=/^\[object .+?Constructor\]$/,G=/^0o[0-7]+$/i,Q=/^(?:0|[1-9]\d*)$/,J=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,W=/($^)/,vt=/['\n\r\u2028\u2029\\]/g,At="\\ud800-\\udfff",Ot="\\u0300-\\u036f",Rt="\\ufe20-\\ufe2f",Nt="\\u20d0-\\u20ff",Zt=Ot+Rt+Nt,qt="\\u2700-\\u27bf",Le="a-z\\xdf-\\xf6\\xf8-\\xff",We="\\xac\\xb1\\xd7\\xf7",Ue="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",yn="\\u2000-\\u206f",Ce=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Xt="A-Z\\xc0-\\xd6\\xd8-\\xde",bn="\\ufe0e\\ufe0f",Be=We+Ue+yn+Ce,si="['\u2019]",Ms="["+At+"]",Yn="["+Be+"]",Ss="["+Zt+"]",un="\\d+",Cr="["+qt+"]",Qo="["+Le+"]",oi="[^"+At+Be+un+qt+Le+Xt+"]",ro="\\ud83c[\\udffb-\\udfff]",tf="(?:"+Ss+"|"+ro+")",gl="[^"+At+"]",ef="(?:\\ud83c[\\udde6-\\uddff]){2}",nf="[\\ud800-\\udbff][\\udc00-\\udfff]",jo="["+Xt+"]",Ag="\\u200d",Cg="(?:"+Qo+"|"+oi+")",_M="(?:"+jo+"|"+oi+")",Rg="(?:"+si+"(?:d|ll|m|re|s|t|ve))?",Pg="(?:"+si+"(?:D|LL|M|RE|S|T|VE))?",Ig=tf+"?",Lg="["+bn+"]?",vM="(?:"+Ag+"(?:"+[gl,ef,nf].join("|")+")"+Lg+Ig+")*",xM="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",yM="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Dg=Lg+Ig+vM,MM="(?:"+[Cr,ef,nf].join("|")+")"+Dg,SM="(?:"+[gl+Ss+"?",Ss,ef,nf,Ms].join("|")+")",wM=RegExp(si,"g"),bM=RegExp(Ss,"g"),rf=RegExp(ro+"(?="+ro+")|"+SM+Dg,"g"),TM=RegExp([jo+"?"+Qo+"+"+Rg+"(?="+[Yn,jo,"$"].join("|")+")",_M+"+"+Pg+"(?="+[Yn,jo+Cg,"$"].join("|")+")",jo+"?"+Cg+"+"+Rg,jo+"+"+Pg,yM,xM,un,MM].join("|"),"g"),EM=RegExp("["+Ag+At+Zt+bn+"]"),AM=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,CM=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],RM=-1,rn={};rn[yt]=rn[Ct]=rn[Qt]=rn[Mt]=rn[It]=rn[Kt]=rn[ee]=rn[Pt]=rn[ne]=!0,rn[fe]=rn[ot]=rn[at]=rn[Et]=rn[zt]=rn[wt]=rn[Ht]=rn[ae]=rn[k]=rn[Jt]=rn[se]=rn[Vt]=rn[Gt]=rn[O]=rn[ft]=!1;var tn={};tn[fe]=tn[ot]=tn[at]=tn[zt]=tn[Et]=tn[wt]=tn[yt]=tn[Ct]=tn[Qt]=tn[Mt]=tn[It]=tn[k]=tn[Jt]=tn[se]=tn[Vt]=tn[Gt]=tn[O]=tn[C]=tn[Kt]=tn[ee]=tn[Pt]=tn[ne]=!0,tn[Ht]=tn[ae]=tn[ft]=!1;var PM={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},IM={"&":"&","<":"<",">":">",'"':""","'":"'"},LM={"&":"&","<":"<",">":">",""":'"',"'":"'"},DM={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},UM=parseFloat,NM=parseInt,Ug=typeof global=="object"&&global&&global.Object===Object&&global,OM=typeof self=="object"&&self&&self.Object===Object&&self,Nn=Ug||OM||Function("return this")(),sf=typeof ml=="object"&&ml&&!ml.nodeType&&ml,so=sf&&typeof wc=="object"&&wc&&!wc.nodeType&&wc,Ng=so&&so.exports===sf,of=Ng&&Ug.process,$i=function(){try{var q=so&&so.require&&so.require("util").types;return q||of&&of.binding&&of.binding("util")}catch{}}(),Og=$i&&$i.isArrayBuffer,Fg=$i&&$i.isDate,zg=$i&&$i.isMap,Bg=$i&&$i.isRegExp,kg=$i&&$i.isSet,Hg=$i&&$i.isTypedArray;function Ni(q,ct,st){switch(st.length){case 0:return q.call(ct);case 1:return q.call(ct,st[0]);case 2:return q.call(ct,st[0],st[1]);case 3:return q.call(ct,st[0],st[1],st[2])}return q.apply(ct,st)}function FM(q,ct,st,Ft){for(var pe=-1,Ve=q==null?0:q.length;++pe-1}function af(q,ct,st){for(var Ft=-1,pe=q==null?0:q.length;++Ft-1;);return st}function $g(q,ct){for(var st=q.length;st--&&ta(ct,q[st],0)>-1;);return st}function qM(q,ct){for(var st=q.length,Ft=0;st--;)q[st]===ct&&++Ft;return Ft}var YM=hf(PM),ZM=hf(IM);function $M(q){return"\\"+DM[q]}function JM(q,ct){return q==null?r:q[ct]}function ea(q){return EM.test(q)}function KM(q){return AM.test(q)}function QM(q){for(var ct,st=[];!(ct=q.next()).done;)st.push(ct.value);return st}function mf(q){var ct=-1,st=Array(q.size);return q.forEach(function(Ft,pe){st[++ct]=[pe,Ft]}),st}function Jg(q,ct){return function(st){return q(ct(st))}}function Ts(q,ct){for(var st=-1,Ft=q.length,pe=0,Ve=[];++st-1}function BS(s,a){var h=this.__data__,_=Hc(h,s);return _<0?(++this.size,h.push([s,a])):h[_][1]=a,this}Vr.prototype.clear=NS,Vr.prototype.delete=OS,Vr.prototype.get=FS,Vr.prototype.has=zS,Vr.prototype.set=BS;function Gr(s){var a=-1,h=s==null?0:s.length;for(this.clear();++a=a?s:a)),s}function ji(s,a,h,_,S,D){var F,H=a&f,Y=a&d,dt=a&g;if(h&&(F=S?h(s,_,S,D):h(s)),F!==r)return F;if(!hn(s))return s;var pt=ge(s);if(pt){if(F=G1(s),!H)return yi(s,F)}else{var xt=$n(s),Lt=xt==ae||xt==_e;if(Ls(s))return L_(s,H);if(xt==se||xt==fe||Lt&&!S){if(F=Y||Lt?{}:K_(s),!H)return Y?L1(s,e1(F,s)):I1(s,l_(F,s))}else{if(!tn[xt])return S?s:{};F=W1(s,xt,H)}}D||(D=new mr);var $t=D.get(s);if($t)return $t;D.set(s,F),E0(s)?s.forEach(function(ce){F.add(ji(ce,a,h,ce,s,D))}):b0(s)&&s.forEach(function(ce,Re){F.set(Re,ji(ce,a,h,Re,s,D))});var le=dt?Y?Hf:kf:Y?Si:On,ye=pt?r:le(s);return Ji(ye||s,function(ce,Re){ye&&(Re=ce,ce=s[Re]),wl(F,Re,ji(ce,a,h,Re,s,D))}),F}function n1(s){var a=On(s);return function(h){return c_(h,s,a)}}function c_(s,a,h){var _=h.length;if(s==null)return!_;for(s=Qe(s);_--;){var S=h[_],D=a[S],F=s[S];if(F===r&&!(S in s)||!D(F))return!1}return!0}function u_(s,a,h){if(typeof s!="function")throw new Ki(i);return Pl(function(){s.apply(r,h)},a)}function bl(s,a,h,_){var S=-1,D=bc,F=!0,H=s.length,Y=[],dt=a.length;if(!H)return Y;h&&(a=an(a,Oi(h))),_?(D=af,F=!1):a.length>=e&&(D=_l,F=!1,a=new lo(a));t:for(;++SS?0:S+h),_=_===r||_>S?S:ve(_),_<0&&(_+=S),_=h>_?0:C0(_);h<_;)s[h++]=a;return s}function f_(s,a){var h=[];return Cs(s,function(_,S,D){a(_,S,D)&&h.push(_)}),h}function Vn(s,a,h,_,S){var D=-1,F=s.length;for(h||(h=q1),S||(S=[]);++D0&&h(H)?a>1?Vn(H,a-1,h,_,S):bs(S,H):_||(S[S.length]=H)}return S}var Sf=z_(),d_=z_(!0);function Rr(s,a){return s&&Sf(s,a,On)}function wf(s,a){return s&&d_(s,a,On)}function Gc(s,a){return ws(a,function(h){return Zr(s[h])})}function uo(s,a){a=Ps(a,s);for(var h=0,_=a.length;s!=null&&h<_;)s=s[Ir(a[h++])];return h&&h==_?s:r}function p_(s,a,h){var _=a(s);return ge(s)?_:bs(_,h(s))}function ai(s){return s==null?s===r?it:re:oo&&oo in Qe(s)?k1(s):j1(s)}function bf(s,a){return s>a}function s1(s,a){return s!=null&&$e.call(s,a)}function o1(s,a){return s!=null&&a in Qe(s)}function a1(s,a,h){return s>=Zn(a,h)&&s=120&&pt.length>=120)?new lo(F&&pt):r}pt=s[0];var xt=-1,Lt=H[0];t:for(;++xt-1;)H!==s&&Uc.call(H,Y,1),Uc.call(s,Y,1);return s}function b_(s,a){for(var h=s?a.length:0,_=h-1;h--;){var S=a[h];if(h==_||S!==D){var D=S;Yr(S)?Uc.call(s,S,1):Df(s,S)}}return s}function Pf(s,a){return s+Fc(r_()*(a-s+1))}function y1(s,a,h,_){for(var S=-1,D=Rn(Oc((a-s)/(h||1)),0),F=st(D);D--;)F[_?D:++S]=s,s+=h;return F}function If(s,a){var h="";if(!s||a<1||a>$)return h;do a%2&&(h+=s),a=Fc(a/2),a&&(s+=s);while(a);return h}function we(s,a){return Zf(t0(s,a,wi),s+"")}function M1(s){return a_(ha(s))}function S1(s,a){var h=ha(s);return tu(h,co(a,0,h.length))}function Al(s,a,h,_){if(!hn(s))return s;a=Ps(a,s);for(var S=-1,D=a.length,F=D-1,H=s;H!=null&&++SS?0:S+a),h=h>S?S:h,h<0&&(h+=S),S=a>h?0:h-a>>>0,a>>>=0;for(var D=st(S);++_>>1,F=s[D];F!==null&&!zi(F)&&(h?F<=a:F=e){var dt=a?null:O1(s);if(dt)return Ec(dt);F=!1,S=_l,Y=new lo}else Y=a?[]:H;t:for(;++_=_?s:tr(s,a,h)}var I_=dS||function(s){return Nn.clearTimeout(s)};function L_(s,a){if(a)return s.slice();var h=s.length,_=jg?jg(h):new s.constructor(h);return s.copy(_),_}function Ff(s){var a=new s.constructor(s.byteLength);return new Lc(a).set(new Lc(s)),a}function A1(s,a){var h=a?Ff(s.buffer):s.buffer;return new s.constructor(h,s.byteOffset,s.byteLength)}function C1(s){var a=new s.constructor(s.source,Ze.exec(s));return a.lastIndex=s.lastIndex,a}function R1(s){return Sl?Qe(Sl.call(s)):{}}function D_(s,a){var h=a?Ff(s.buffer):s.buffer;return new s.constructor(h,s.byteOffset,s.length)}function U_(s,a){if(s!==a){var h=s!==r,_=s===null,S=s===s,D=zi(s),F=a!==r,H=a===null,Y=a===a,dt=zi(a);if(!H&&!dt&&!D&&s>a||D&&F&&Y&&!H&&!dt||_&&F&&Y||!h&&Y||!S)return 1;if(!_&&!D&&!dt&&s=H)return Y;var dt=h[_];return Y*(dt=="desc"?-1:1)}}return s.index-a.index}function N_(s,a,h,_){for(var S=-1,D=s.length,F=h.length,H=-1,Y=a.length,dt=Rn(D-F,0),pt=st(Y+dt),xt=!_;++H1?h[S-1]:r,F=S>2?h[2]:r;for(D=s.length>3&&typeof D=="function"?(S--,D):r,F&&li(h[0],h[1],F)&&(D=S<3?r:D,S=1),a=Qe(a);++_-1?S[D?a[F]:F]:r}}function H_(s){return qr(function(a){var h=a.length,_=h,S=Qi.prototype.thru;for(s&&a.reverse();_--;){var D=a[_];if(typeof D!="function")throw new Ki(i);if(S&&!F&&Qc(D)=="wrapper")var F=new Qi([],!0)}for(_=F?_:h;++_1&&Ne.reverse(),pt&&YH))return!1;var dt=D.get(s),pt=D.get(a);if(dt&&pt)return dt==a&&pt==s;var xt=-1,Lt=!0,$t=h&m?new lo:r;for(D.set(s,a),D.set(a,s);++xt1?"& ":"")+a[_],a=a.join(h>2?", ":" "),s.replace(te,`{ /* [wrapped with `+a+`] */ `)}function q1(s){return ge(s)||po(s)||!!(n_&&s&&s[n_])}function Yr(s,a){var h=typeof s;return a=a??$,!!a&&(h=="number"||h!="symbol"&&Q.test(s))&&s>-1&&s%1==0&&s0){if(++a>=w)return arguments[0]}else a=0;return s.apply(r,arguments)}}function tu(s,a){var h=-1,_=s.length,S=_-1;for(a=a===r?_:a;++h1?s[a-1]:r;return h=typeof h=="function"?(s.pop(),h):r,f0(s,h)});function d0(s){var a=R(s);return a.__chain__=!0,a}function ib(s,a){return a(s),s}function eu(s,a){return a(s)}var rb=qr(function(s){var a=s.length,h=a?s[0]:0,_=this.__wrapped__,S=function(D){return Mf(D,s)};return a>1||this.__actions__.length||!(_ instanceof De)||!Yr(h)?this.thru(S):(_=_.slice(h,+h+(a?1:0)),_.__actions__.push({func:eu,args:[S],thisArg:r}),new Qi(_,this.__chain__).thru(function(D){return a&&!D.length&&D.push(r),D}))});function sb(){return d0(this)}function ob(){return new Qi(this.value(),this.__chain__)}function ab(){this.__values__===r&&(this.__values__=A0(this.value()));var s=this.__index__>=this.__values__.length,a=s?r:this.__values__[this.__index__++];return{done:s,value:a}}function lb(){return this}function cb(s){for(var a,h=this;h instanceof kc;){var _=o0(h);_.__index__=0,_.__values__=r,a?S.__wrapped__=_:a=_;var S=_;h=h.__wrapped__}return S.__wrapped__=s,a}function ub(){var s=this.__wrapped__;if(s instanceof De){var a=s;return this.__actions__.length&&(a=new De(this)),a=a.reverse(),a.__actions__.push({func:eu,args:[$f],thisArg:r}),new Qi(a,this.__chain__)}return this.thru($f)}function hb(){return R_(this.__wrapped__,this.__actions__)}var fb=Yc(function(s,a,h){$e.call(s,h)?++s[h]:Wr(s,h,1)});function db(s,a,h){var _=ge(s)?Vg:i1;return h&&li(s,a,h)&&(a=r),_(s,oe(a,3))}function pb(s,a){var h=ge(s)?ws:f_;return h(s,oe(a,3))}var mb=k_(a0),gb=k_(l0);function _b(s,a){return Vn(nu(s,a),1)}function vb(s,a){return Vn(nu(s,a),rt)}function xb(s,a,h){return h=h===r?1:ve(h),Vn(nu(s,a),h)}function p0(s,a){var h=ge(s)?Ji:Cs;return h(s,oe(a,3))}function m0(s,a){var h=ge(s)?zM:h_;return h(s,oe(a,3))}var yb=Yc(function(s,a,h){$e.call(s,h)?s[h].push(a):Wr(s,h,[a])});function Mb(s,a,h,_){s=Mi(s)?s:ha(s),h=h&&!_?ve(h):0;var S=s.length;return h<0&&(h=Rn(S+h,0)),au(s)?h<=S&&s.indexOf(a,h)>-1:!!S&&ta(s,a,h)>-1}var Sb=we(function(s,a,h){var _=-1,S=typeof a=="function",D=Mi(s)?st(s.length):[];return Cs(s,function(F){D[++_]=S?Ni(a,F,h):Tl(F,a,h)}),D}),wb=Yc(function(s,a,h){Wr(s,h,a)});function nu(s,a){var h=ge(s)?an:v_;return h(s,oe(a,3))}function bb(s,a,h,_){return s==null?[]:(ge(a)||(a=a==null?[]:[a]),h=_?r:h,ge(h)||(h=h==null?[]:[h]),S_(s,a,h))}var Tb=Yc(function(s,a,h){s[h?0:1].push(a)},function(){return[[],[]]});function Eb(s,a,h){var _=ge(s)?lf:qg,S=arguments.length<3;return _(s,oe(a,4),h,S,Cs)}function Ab(s,a,h){var _=ge(s)?BM:qg,S=arguments.length<3;return _(s,oe(a,4),h,S,h_)}function Cb(s,a){var h=ge(s)?ws:f_;return h(s,su(oe(a,3)))}function Rb(s){var a=ge(s)?a_:M1;return a(s)}function Pb(s,a,h){(h?li(s,a,h):a===r)?a=1:a=ve(a);var _=ge(s)?QS:S1;return _(s,a)}function Ib(s){var a=ge(s)?jS:b1;return a(s)}function Lb(s){if(s==null)return 0;if(Mi(s))return au(s)?na(s):s.length;var a=$n(s);return a==k||a==Gt?s.size:Af(s).length}function Db(s,a,h){var _=ge(s)?cf:T1;return h&&li(s,a,h)&&(a=r),_(s,oe(a,3))}var Ub=we(function(s,a){if(s==null)return[];var h=a.length;return h>1&&li(s,a[0],a[1])?a=[]:h>2&&li(a[0],a[1],a[2])&&(a=[a[0]]),S_(s,Vn(a,1),[])}),iu=pS||function(){return Nn.Date.now()};function Nb(s,a){if(typeof a!="function")throw new Ki(i);return s=ve(s),function(){if(--s<1)return a.apply(this,arguments)}}function g0(s,a,h){return a=h?r:a,a=s&&a==null?s.length:a,Xr(s,U,r,r,r,r,a)}function _0(s,a){var h;if(typeof a!="function")throw new Ki(i);return s=ve(s),function(){return--s>0&&(h=a.apply(this,arguments)),s<=1&&(a=r),h}}var Kf=we(function(s,a,h){var _=M;if(h.length){var S=Ts(h,ca(Kf));_|=b}return Xr(s,_,a,h,S)}),v0=we(function(s,a,h){var _=M|y;if(h.length){var S=Ts(h,ca(v0));_|=b}return Xr(a,_,s,h,S)});function x0(s,a,h){a=h?r:a;var _=Xr(s,x,r,r,r,r,r,a);return _.placeholder=x0.placeholder,_}function y0(s,a,h){a=h?r:a;var _=Xr(s,E,r,r,r,r,r,a);return _.placeholder=y0.placeholder,_}function M0(s,a,h){var _,S,D,F,H,Y,dt=0,pt=!1,xt=!1,Lt=!0;if(typeof s!="function")throw new Ki(i);a=nr(a)||0,hn(h)&&(pt=!!h.leading,xt="maxWait"in h,D=xt?Rn(nr(h.maxWait)||0,a):D,Lt="trailing"in h?!!h.trailing:Lt);function $t(Sn){var _r=_,Jr=S;return _=S=r,dt=Sn,F=s.apply(Jr,_r),F}function le(Sn){return dt=Sn,H=Pl(Re,a),pt?$t(Sn):F}function ye(Sn){var _r=Sn-Y,Jr=Sn-dt,k0=a-_r;return xt?Zn(k0,D-Jr):k0}function ce(Sn){var _r=Sn-Y,Jr=Sn-dt;return Y===r||_r>=a||_r<0||xt&&Jr>=D}function Re(){var Sn=iu();if(ce(Sn))return Ne(Sn);H=Pl(Re,ye(Sn))}function Ne(Sn){return H=r,Lt&&_?$t(Sn):(_=S=r,F)}function Bi(){H!==r&&I_(H),dt=0,_=Y=S=H=r}function ci(){return H===r?F:Ne(iu())}function ki(){var Sn=iu(),_r=ce(Sn);if(_=arguments,S=this,Y=Sn,_r){if(H===r)return le(Y);if(xt)return I_(H),H=Pl(Re,a),$t(Y)}return H===r&&(H=Pl(Re,a)),F}return ki.cancel=Bi,ki.flush=ci,ki}var Ob=we(function(s,a){return u_(s,1,a)}),Fb=we(function(s,a,h){return u_(s,nr(a)||0,h)});function zb(s){return Xr(s,I)}function ru(s,a){if(typeof s!="function"||a!=null&&typeof a!="function")throw new Ki(i);var h=function(){var _=arguments,S=a?a.apply(this,_):_[0],D=h.cache;if(D.has(S))return D.get(S);var F=s.apply(this,_);return h.cache=D.set(S,F)||D,F};return h.cache=new(ru.Cache||Gr),h}ru.Cache=Gr;function su(s){if(typeof s!="function")throw new Ki(i);return function(){var a=arguments;switch(a.length){case 0:return!s.call(this);case 1:return!s.call(this,a[0]);case 2:return!s.call(this,a[0],a[1]);case 3:return!s.call(this,a[0],a[1],a[2])}return!s.apply(this,a)}}function Bb(s){return _0(2,s)}var kb=E1(function(s,a){a=a.length==1&&ge(a[0])?an(a[0],Oi(oe())):an(Vn(a,1),Oi(oe()));var h=a.length;return we(function(_){for(var S=-1,D=Zn(_.length,h);++S=a}),po=m_(function(){return arguments}())?m_:function(s){return mn(s)&&$e.call(s,"callee")&&!e_.call(s,"callee")},ge=st.isArray,eT=Og?Oi(Og):c1;function Mi(s){return s!=null&&ou(s.length)&&!Zr(s)}function Mn(s){return mn(s)&&Mi(s)}function nT(s){return s===!0||s===!1||mn(s)&&ai(s)==Et}var Ls=gS||cd,iT=Fg?Oi(Fg):u1;function rT(s){return mn(s)&&s.nodeType===1&&!Il(s)}function sT(s){if(s==null)return!0;if(Mi(s)&&(ge(s)||typeof s=="string"||typeof s.splice=="function"||Ls(s)||ua(s)||po(s)))return!s.length;var a=$n(s);if(a==k||a==Gt)return!s.size;if(Rl(s))return!Af(s).length;for(var h in s)if($e.call(s,h))return!1;return!0}function oT(s,a){return El(s,a)}function aT(s,a,h){h=typeof h=="function"?h:r;var _=h?h(s,a):r;return _===r?El(s,a,r,h):!!_}function jf(s){if(!mn(s))return!1;var a=ai(s);return a==Ht||a==kt||typeof s.message=="string"&&typeof s.name=="string"&&!Il(s)}function lT(s){return typeof s=="number"&&i_(s)}function Zr(s){if(!hn(s))return!1;var a=ai(s);return a==ae||a==_e||a==_t||a==et}function w0(s){return typeof s=="number"&&s==ve(s)}function ou(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=$}function hn(s){var a=typeof s;return s!=null&&(a=="object"||a=="function")}function mn(s){return s!=null&&typeof s=="object"}var b0=zg?Oi(zg):f1;function cT(s,a){return s===a||Ef(s,a,Gf(a))}function uT(s,a,h){return h=typeof h=="function"?h:r,Ef(s,a,Gf(a),h)}function hT(s){return T0(s)&&s!=+s}function fT(s){if($1(s))throw new pe(n);return g_(s)}function dT(s){return s===null}function pT(s){return s==null}function T0(s){return typeof s=="number"||mn(s)&&ai(s)==Jt}function Il(s){if(!mn(s)||ai(s)!=se)return!1;var a=Dc(s);if(a===null)return!0;var h=$e.call(a,"constructor")&&a.constructor;return typeof h=="function"&&h instanceof h&&Rc.call(h)==uS}var td=Bg?Oi(Bg):d1;function mT(s){return w0(s)&&s>=-$&&s<=$}var E0=kg?Oi(kg):p1;function au(s){return typeof s=="string"||!ge(s)&&mn(s)&&ai(s)==O}function zi(s){return typeof s=="symbol"||mn(s)&&ai(s)==C}var ua=Hg?Oi(Hg):m1;function gT(s){return s===r}function _T(s){return mn(s)&&$n(s)==ft}function vT(s){return mn(s)&&ai(s)==mt}var xT=Kc(Cf),yT=Kc(function(s,a){return s<=a});function A0(s){if(!s)return[];if(Mi(s))return au(s)?pr(s):yi(s);if(vl&&s[vl])return QM(s[vl]());var a=$n(s),h=a==k?mf:a==Gt?Ec:ha;return h(s)}function $r(s){if(!s)return s===0?s:0;if(s=nr(s),s===rt||s===-rt){var a=s<0?-1:1;return a*nt}return s===s?s:0}function ve(s){var a=$r(s),h=a%1;return a===a?h?a-h:a:0}function C0(s){return s?co(ve(s),0,gt):0}function nr(s){if(typeof s=="number")return s;if(zi(s))return K;if(hn(s)){var a=typeof s.valueOf=="function"?s.valueOf():s;s=hn(a)?a+"":a}if(typeof s!="string")return s===0?s:+s;s=Yg(s);var h=ri.test(s);return h||G.test(s)?NM(s.slice(2),h?2:8):He.test(s)?K:+s}function R0(s){return Pr(s,Si(s))}function MT(s){return s?co(ve(s),-$,$):s===0?s:0}function Xe(s){return s==null?"":Fi(s)}var ST=aa(function(s,a){if(Rl(a)||Mi(a)){Pr(a,On(a),s);return}for(var h in a)$e.call(a,h)&&wl(s,h,a[h])}),P0=aa(function(s,a){Pr(a,Si(a),s)}),lu=aa(function(s,a,h,_){Pr(a,Si(a),s,_)}),wT=aa(function(s,a,h,_){Pr(a,On(a),s,_)}),bT=qr(Mf);function TT(s,a){var h=oa(s);return a==null?h:l_(h,a)}var ET=we(function(s,a){s=Qe(s);var h=-1,_=a.length,S=_>2?a[2]:r;for(S&&li(a[0],a[1],S)&&(_=1);++h<_;)for(var D=a[h],F=Si(D),H=-1,Y=F.length;++H1),D}),Pr(s,Hf(s),h),_&&(h=ji(h,f|d|g,F1));for(var S=a.length;S--;)Df(h,a[S]);return h});function WT(s,a){return L0(s,su(oe(a)))}var XT=qr(function(s,a){return s==null?{}:v1(s,a)});function L0(s,a){if(s==null)return{};var h=an(Hf(s),function(_){return[_]});return a=oe(a),w_(s,h,function(_,S){return a(_,S[0])})}function qT(s,a,h){a=Ps(a,s);var _=-1,S=a.length;for(S||(S=1,s=r);++_a){var _=s;s=a,a=_}if(h||s%1||a%1){var S=r_();return Zn(s+S*(a-s+UM("1e-"+((S+"").length-1))),a)}return Pf(s,a)}var iE=la(function(s,a,h){return a=a.toLowerCase(),s+(h?N0(a):a)});function N0(s){return id(Xe(s).toLowerCase())}function O0(s){return s=Xe(s),s&&s.replace(J,YM).replace(bM,"")}function rE(s,a,h){s=Xe(s),a=Fi(a);var _=s.length;h=h===r?_:co(ve(h),0,_);var S=h;return h-=a.length,h>=0&&s.slice(h,S)==a}function sE(s){return s=Xe(s),s&&St.test(s)?s.replace(ut,ZM):s}function oE(s){return s=Xe(s),s&&Ie.test(s)?s.replace(Wt,"\\$&"):s}var aE=la(function(s,a,h){return s+(h?"-":"")+a.toLowerCase()}),lE=la(function(s,a,h){return s+(h?" ":"")+a.toLowerCase()}),cE=B_("toLowerCase");function uE(s,a,h){s=Xe(s),a=ve(a);var _=a?na(s):0;if(!a||_>=a)return s;var S=(a-_)/2;return Jc(Fc(S),h)+s+Jc(Oc(S),h)}function hE(s,a,h){s=Xe(s),a=ve(a);var _=a?na(s):0;return a&&_>>0,h?(s=Xe(s),s&&(typeof a=="string"||a!=null&&!td(a))&&(a=Fi(a),!a&&ea(s))?Is(pr(s),0,h):s.split(a,h)):[]}var vE=la(function(s,a,h){return s+(h?" ":"")+id(a)});function xE(s,a,h){return s=Xe(s),h=h==null?0:co(ve(h),0,s.length),a=Fi(a),s.slice(h,h+a.length)==a}function yE(s,a,h){var _=R.templateSettings;h&&li(s,a,h)&&(a=r),s=Xe(s),a=lu({},a,_,q_);var S=lu({},a.imports,_.imports,q_),D=On(S),F=pf(S,D),H,Y,dt=0,pt=a.interpolate||W,xt="__p += '",Lt=gf((a.escape||W).source+"|"+pt.source+"|"+(pt===Ge?Ke:W).source+"|"+(a.evaluate||W).source+"|$","g"),$t="//# sourceURL="+($e.call(a,"sourceURL")?(a.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++RM+"]")+` `;s.replace(Lt,function(ce,Re,Ne,Bi,ci,ki){return Ne||(Ne=Bi),xt+=s.slice(dt,ki).replace(vt,$M),Re&&(H=!0,xt+=`' + __e(`+Re+`) + '`),ci&&(Y=!0,xt+=`'; `+ci+`; __p += '`),Ne&&(xt+=`' + ((__t = (`+Ne+`)) == null ? '' : __t) + '`),dt=ki+ce.length,ce}),xt+=`'; `;var le=$e.call(a,"variable")&&a.variable;if(!le)xt=`with (obj) { `+xt+` } `;else if(Je.test(le))throw new pe(o);xt=(Y?xt.replace(de,""):xt).replace(ze,"$1").replace(X,"$1;"),xt="function("+(le||"obj")+`) { `+(le?"":`obj || (obj = {}); `)+"var __t, __p = ''"+(H?", __e = _.escape":"")+(Y?`, __j = Array.prototype.join; function print() { __p += __j.call(arguments, '') } `:`; `)+xt+`return __p }`;var ye=z0(function(){return Ve(D,$t+"return "+xt).apply(r,F)});if(ye.source=xt,jf(ye))throw ye;return ye}function ME(s){return Xe(s).toLowerCase()}function SE(s){return Xe(s).toUpperCase()}function wE(s,a,h){if(s=Xe(s),s&&(h||a===r))return Yg(s);if(!s||!(a=Fi(a)))return s;var _=pr(s),S=pr(a),D=Zg(_,S),F=$g(_,S)+1;return Is(_,D,F).join("")}function bE(s,a,h){if(s=Xe(s),s&&(h||a===r))return s.slice(0,Kg(s)+1);if(!s||!(a=Fi(a)))return s;var _=pr(s),S=$g(_,pr(a))+1;return Is(_,0,S).join("")}function TE(s,a,h){if(s=Xe(s),s&&(h||a===r))return s.replace(Tt,"");if(!s||!(a=Fi(a)))return s;var _=pr(s),S=Zg(_,pr(a));return Is(_,S).join("")}function EE(s,a){var h=N,_=A;if(hn(a)){var S="separator"in a?a.separator:S;h="length"in a?ve(a.length):h,_="omission"in a?Fi(a.omission):_}s=Xe(s);var D=s.length;if(ea(s)){var F=pr(s);D=F.length}if(h>=D)return s;var H=h-na(_);if(H<1)return _;var Y=F?Is(F,0,H).join(""):s.slice(0,H);if(S===r)return Y+_;if(F&&(H+=Y.length-H),td(S)){if(s.slice(H).search(S)){var dt,pt=Y;for(S.global||(S=gf(S.source,Xe(Ze.exec(S))+"g")),S.lastIndex=0;dt=S.exec(pt);)var xt=dt.index;Y=Y.slice(0,xt===r?H:xt)}}else if(s.indexOf(Fi(S),H)!=H){var Lt=Y.lastIndexOf(S);Lt>-1&&(Y=Y.slice(0,Lt))}return Y+_}function AE(s){return s=Xe(s),s&&ht.test(s)?s.replace(lt,nS):s}var CE=la(function(s,a,h){return s+(h?" ":"")+a.toUpperCase()}),id=B_("toUpperCase");function F0(s,a,h){return s=Xe(s),a=h?r:a,a===r?KM(s)?sS(s):VM(s):s.match(a)||[]}var z0=we(function(s,a){try{return Ni(s,r,a)}catch(h){return jf(h)?h:new pe(h)}}),RE=qr(function(s,a){return Ji(a,function(h){h=Ir(h),Wr(s,h,Kf(s[h],s))}),s});function PE(s){var a=s==null?0:s.length,h=oe();return s=a?an(s,function(_){if(typeof _[1]!="function")throw new Ki(i);return[h(_[0]),_[1]]}):[],we(function(_){for(var S=-1;++S$)return[];var h=gt,_=Zn(s,gt);a=oe(a),s-=gt;for(var S=df(_,a);++h0||a<0)?new De(h):(s<0?h=h.takeRight(-s):s&&(h=h.drop(s)),a!==r&&(a=ve(a),h=a<0?h.dropRight(-a):h.take(a-s)),h)},De.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},De.prototype.toArray=function(){return this.take(gt)},Rr(De.prototype,function(s,a){var h=/^(?:filter|find|map|reject)|While$/.test(a),_=/^(?:head|last)$/.test(a),S=R[_?"take"+(a=="last"?"Right":""):a],D=_||/^find/.test(a);S&&(R.prototype[a]=function(){var F=this.__wrapped__,H=_?[1]:arguments,Y=F instanceof De,dt=H[0],pt=Y||ge(F),xt=function(Re){var Ne=S.apply(R,bs([Re],H));return _&&Lt?Ne[0]:Ne};pt&&h&&typeof dt=="function"&&dt.length!=1&&(Y=pt=!1);var Lt=this.__chain__,$t=!!this.__actions__.length,le=D&&!Lt,ye=Y&&!$t;if(!D&&pt){F=ye?F:new De(this);var ce=s.apply(F,H);return ce.__actions__.push({func:eu,args:[xt],thisArg:r}),new Qi(ce,Lt)}return le&&ye?s.apply(this,H):(ce=this.thru(xt),le?_?ce.value()[0]:ce.value():ce)})}),Ji(["pop","push","shift","sort","splice","unshift"],function(s){var a=Ac[s],h=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",_=/^(?:pop|shift)$/.test(s);R.prototype[s]=function(){var S=arguments;if(_&&!this.__chain__){var D=this.value();return a.apply(ge(D)?D:[],S)}return this[h](function(F){return a.apply(ge(F)?F:[],S)})}}),Rr(De.prototype,function(s,a){var h=R[a];if(h){var _=h.name+"";$e.call(sa,_)||(sa[_]=[]),sa[_].push({name:a,func:h})}}),sa[Zc(r,y).name]=[{name:"wrapper",func:r}],De.prototype.clone=AS,De.prototype.reverse=CS,De.prototype.value=RS,R.prototype.at=rb,R.prototype.chain=sb,R.prototype.commit=ob,R.prototype.next=ab,R.prototype.plant=cb,R.prototype.reverse=ub,R.prototype.toJSON=R.prototype.valueOf=R.prototype.value=hb,R.prototype.first=R.prototype.head,vl&&(R.prototype[vl]=lb),R},Es=oS();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Nn._=Es,define(function(){return Es})):so?((so.exports=Es)._=Es,sf._=Es):Nn._=Es}).call(ml)});function Kr(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function $0(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,r.__proto__=t}var Ai={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},da={duration:.5,overwrite:!1,delay:0},Cd,Jn,ln,rr=1e8,en=1/rr,_d=Math.PI*2,SA=_d/4,wA=0,J0=Math.sqrt,bA=Math.cos,TA=Math.sin,Pn=function(t){return typeof t=="string"},gn=function(t){return typeof t=="function"},jr=function(t){return typeof t=="number"},vu=function(t){return typeof t>"u"},Ur=function(t){return typeof t=="object"},Ei=function(t){return t!==!1},Rd=function(){return typeof window<"u"},cu=function(t){return gn(t)||Pn(t)},K0=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},Kn=Array.isArray,vd=/(?:-?\.?\d|\.)+/gi,Pd=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,xo=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,ud=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,Id=/[+-]=-?[.\d]+/,Q0=/[^,'"\[\]\s]+/gi,EA=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,fn,Lr,xd,Ld,Vi={},du={},j0,tv=function(t){return(du=vo(t,Vi))&&Qn},xu=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},Fl=function(t,e){return!e&&console.warn(t)},ev=function(t,e){return t&&(Vi[t]=e)&&du&&(du[t]=e)||Vi},zl=function(){return 0},AA={suppressEvents:!0,isStart:!0,kill:!1},uu={suppressEvents:!0,kill:!1},CA={suppressEvents:!0},Dd={},Us=[],yd={},nv,bi={},hd={},V0=30,hu=[],Ud="",Nd=function(t){var e=t[0],n,i;if(Ur(e)||gn(e)||(t=[t]),!(n=(e._gsap||{}).harness)){for(i=hu.length;i--&&!hu[i].targetTest(e););n=hu[i]}for(i=t.length;i--;)t[i]&&(t[i]._gsap||(t[i]._gsap=new zd(t[i],n)))||t.splice(i,1);return t},Ns=function(t){return t._gsap||Nd(sr(t))[0]._gsap},Od=function(t,e,n){return(n=t[e])&&gn(n)?t[e]():vu(n)&&t.getAttribute&&t.getAttribute(e)||n},ui=function(t,e){return(t=t.split(",")).forEach(e)||t},_n=function(t){return Math.round(t*1e5)/1e5||0},Fn=function(t){return Math.round(t*1e7)/1e7||0},yo=function(t,e){var n=e.charAt(0),i=parseFloat(e.substr(2));return t=parseFloat(t),n==="+"?t+i:n==="-"?t-i:n==="*"?t*i:t/i},RA=function(t,e){for(var n=e.length,i=0;t.indexOf(e[i])<0&&++ic;)l=l._prev;return l?(e._next=l._next,l._next=e):(e._next=t[n],t[n]=e),e._next?e._next._prev=e:t[i]=e,e._prev=l,e.parent=e._dp=t,e},yu=function(t,e,n,i){n===void 0&&(n="_first"),i===void 0&&(i="_last");var o=e._prev,l=e._next;o?o._next=l:t[n]===e&&(t[n]=l),l?l._prev=o:t[i]===e&&(t[i]=o),e._next=e._prev=e.parent=null},Os=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},mo=function(t,e){if(t&&(!e||e._end>t._dur||e._start<0))for(var n=t;n;)n._dirty=1,n=n.parent;return t},LA=function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t},Md=function(t,e,n,i){return t._startAt&&(Jn?t._startAt.revert(uu):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,i))},DA=function r(t){return!t||t._ts&&r(t.parent)},W0=function(t){return t._repeat?pa(t._tTime,t=t.duration()+t._rDelay)*t:0},pa=function(t,e){var n=Math.floor(t/=e);return t&&n===t?n-1:n},gu=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},Mu=function(t){return t._end=Fn(t._start+(t._tDur/Math.abs(t._ts||t._rts||en)||0))},Su=function(t,e){var n=t._dp;return n&&n.smoothChildTiming&&t._ts&&(t._start=Fn(n._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),Mu(t),n._dirty||mo(n,t)),t},av=function(t,e){var n;if((e._time||!e._dur&&e._initted||e._starten)&&e.render(n,!0)),mo(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur=0&&n.totalTime(n._tTime),n=n._dp;t._zTime=-en}},Dr=function(t,e,n,i){return e.parent&&Os(e),e._start=Fn((jr(n)?n:n||t!==fn?ir(t,n,e):t._time)+e._delay),e._end=Fn(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),ov(t,e,"_first","_last",t._sort?"_start":0),Sd(e)||(t._recent=e),i||av(t,e),t._ts<0&&Su(t,t._tTime),t},lv=function(t,e){return(Vi.ScrollTrigger||xu("scrollTrigger",e))&&Vi.ScrollTrigger.create(e,t)},cv=function(t,e,n,i,o){if(Hd(t,e,o),!t._initted)return 1;if(!n&&t._pt&&!Jn&&(t._dur&&t.vars.lazy!==!1||!t._dur&&t.vars.lazy)&&nv!==Ti.frame)return Us.push(t),t._lazy=[o,i],1},UA=function r(t){var e=t.parent;return e&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||r(e))},Sd=function(t){var e=t.data;return e==="isFromStart"||e==="isStart"},NA=function(t,e,n,i){var o=t.ratio,l=e<0||!e&&(!t._start&&UA(t)&&!(!t._initted&&Sd(t))||(t._ts<0||t._dp._ts<0)&&!Sd(t))?0:1,c=t._rDelay,u=0,f,d,g;if(c&&t._repeat&&(u=Hl(0,t._tDur,e),d=pa(u,c),t._yoyo&&d&1&&(l=1-l),d!==pa(t._tTime,c)&&(o=1-l,t.vars.repeatRefresh&&t._initted&&t.invalidate())),l!==o||Jn||i||t._zTime===en||!e&&t._zTime){if(!t._initted&&cv(t,e,i,n,u))return;for(g=t._zTime,t._zTime=e||(n?en:0),n||(n=e&&!g),t.ratio=l,t._from&&(l=1-l),t._time=0,t._tTime=u,f=t._pt;f;)f.r(l,f.d),f=f._next;e<0&&Md(t,e,n,!0),t._onUpdate&&!n&&Hi(t,"onUpdate"),u&&t._repeat&&!n&&t.parent&&Hi(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===l&&(l&&Os(t,1),!n&&!Jn&&(Hi(t,l?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)},OA=function(t,e,n){var i;if(n>e)for(i=t._first;i&&i._start<=n;){if(i.data==="isPause"&&i._start>e)return i;i=i._next}else for(i=t._last;i&&i._start>=n;){if(i.data==="isPause"&&i._start0&&!i&&Su(t,t._tTime=t._tDur*c),t.parent&&Mu(t),n||mo(t.parent,t),t},X0=function(t){return t instanceof Gn?mo(t):ma(t,t._dur)},FA={_start:0,endTime:zl,totalDuration:zl},ir=function r(t,e,n){var i=t.labels,o=t._recent||FA,l=t.duration()>=rr?o.endTime(!1):t._dur,c,u,f;return Pn(e)&&(isNaN(e)||e in i)?(u=e.charAt(0),f=e.substr(-1)==="%",c=e.indexOf("="),u==="<"||u===">"?(c>=0&&(e=e.replace(/=/,"")),(u==="<"?o._start:o.endTime(o._repeat>=0))+(parseFloat(e.substr(1))||0)*(f?(c<0?o:n).totalDuration()/100:1)):c<0?(e in i||(i[e]=l),i[e]):(u=parseFloat(e.charAt(c-1)+e.substr(c+1)),f&&n&&(u=u/100*(Kn(n)?n[0]:n).totalDuration()),c>1?r(t,e.substr(0,c-1),n)+u:l+u)):e==null?l:+e},Nl=function(t,e,n){var i=jr(e[1]),o=(i?2:1)+(t<2?0:1),l=e[o],c,u;if(i&&(l.duration=e[1]),l.parent=n,t){for(c=l,u=n;u&&!("immediateRender"in c);)c=u.vars.defaults||{},u=Ei(u.vars.inherit)&&u.parent;l.immediateRender=Ei(c.immediateRender),t<2?l.runBackwards=1:l.startAt=e[o-1]}return new wn(e[0],l,e[o+1])},Fs=function(t,e){return t||t===0?e(t):e},Hl=function(t,e,n){return ne?e:n},Wn=function(t,e){return!Pn(t)||!(e=EA.exec(t))?"":e[1]},zA=function(t,e,n){return Fs(n,function(i){return Hl(t,e,i)})},wd=[].slice,uv=function(t,e){return t&&Ur(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&Ur(t[0]))&&!t.nodeType&&t!==Lr},BA=function(t,e,n){return n===void 0&&(n=[]),t.forEach(function(i){var o;return Pn(i)&&!e||uv(i,1)?(o=n).push.apply(o,sr(i)):n.push(i)})||n},sr=function(t,e,n){return ln&&!e&&ln.selector?ln.selector(t):Pn(t)&&!n&&(xd||!ga())?wd.call((e||Ld).querySelectorAll(t),0):Kn(t)?BA(t,n):uv(t)?wd.call(t,0):t?[t]:[]},bd=function(t){return t=sr(t)[0]||Fl("Invalid scope")||{},function(e){var n=t.current||t.nativeElement||t;return sr(e,n.querySelectorAll?n:n===t?Fl("Invalid scope")||Ld.createElement("div"):t)}},hv=function(t){return t.sort(function(){return .5-Math.random()})},fv=function(t){if(gn(t))return t;var e=Ur(t)?t:{each:t},n=go(e.ease),i=e.from||0,o=parseFloat(e.base)||0,l={},c=i>0&&i<1,u=isNaN(i)||c,f=e.axis,d=i,g=i;return Pn(i)?d=g={center:.5,edges:.5,end:1}[i]||0:!c&&u&&(d=i[0],g=i[1]),function(p,m,M){var y=(M||e).length,v=l[y],x,E,b,T,U,L,I,N,A;if(!v){if(A=e.grid==="auto"?0:(e.grid||[1,rr])[1],!A){for(I=-rr;I<(I=M[A++].getBoundingClientRect().left)&&AI&&(I=U),Uy?y-1:f?f==="y"?y/A:A:Math.max(A,y/A))||0)*(i==="edges"?-1:1),v.b=y<0?o-y:o,v.u=Wn(e.amount||e.each)||0,n=n&&y<0?Mv(n):n}return y=(v[p]-v.min)/v.max||0,Fn(v.b+(n?n(y):y)*v.v)+v.u}},Td=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(n){var i=Fn(Math.round(parseFloat(n)/t)*t*e);return(i-i%1)/e+(jr(n)?0:Wn(n))}},dv=function(t,e){var n=Kn(t),i,o;return!n&&Ur(t)&&(i=n=t.radius||rr,t.values?(t=sr(t.values),(o=!jr(t[0]))&&(i*=i)):t=Td(t.increment)),Fs(e,n?gn(t)?function(l){return o=t(l),Math.abs(o-l)<=i?o:l}:function(l){for(var c=parseFloat(o?l.x:l),u=parseFloat(o?l.y:0),f=rr,d=0,g=t.length,p,m;g--;)o?(p=t[g].x-c,m=t[g].y-u,p=p*p+m*m):p=Math.abs(t[g]-c),pi?o-l:l)})},_a=function(t){for(var e=0,n="",i,o,l,c;~(i=t.indexOf("random(",e));)l=t.indexOf(")",i),c=t.charAt(i+7)==="[",o=t.substr(i+7,l-i-7).match(c?Q0:vd),n+=t.substr(e,i-e)+pv(c?o:+o[0],c?0:+o[1],+o[2]||1e-5),e=l+1;return n+t.substr(e,t.length-e)},gv=function(t,e,n,i,o){var l=e-t,c=i-n;return Fs(o,function(u){return n+((u-t)/l*c||0)})},XA=function r(t,e,n,i){var o=isNaN(t+e)?0:function(m){return(1-m)*t+m*e};if(!o){var l=Pn(t),c={},u,f,d,g,p;if(n===!0&&(i=1)&&(n=null),l)t={p:t},e={p:e};else if(Kn(t)&&!Kn(e)){for(d=[],g=t.length,p=g-2,f=1;f(c=Math.abs(c))&&(u=l,o=c);return u},Hi=function(t,e,n){var i=t.vars,o=i[e],l=ln,c=t._ctx,u,f,d;if(o)return u=i[e+"Params"],f=i.callbackScope||t,n&&Us.length&&pu(),c&&(ln=c),d=u?o.apply(f,u):o.call(f),ln=l,d},Ll=function(t){return Os(t),t.scrollTrigger&&t.scrollTrigger.kill(!!Jn),t.progress()<1&&Hi(t,"onInterrupt"),t},fa,_v=[],vv=function(t){if(t)if(t=!t.name&&t.default||t,Rd()||t.headless){var e=t.name,n=gn(t),i=e&&!n&&t.init?function(){this._props=[]}:t,o={init:zl,render:Wd,add:Bd,kill:aC,modifier:oC,rawVars:0},l={targetTest:0,get:0,getSetter:wu,aliases:{},register:0};if(ga(),t!==i){if(bi[e])return;or(i,or(mu(t,o),l)),vo(i.prototype,vo(o,mu(t,l))),bi[i.prop=e]=i,t.targetTest&&(hu.push(i),Dd[e]=1),e=(e==="css"?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}ev(e,i),t.register&&t.register(Qn,i,hi)}else _v.push(t)},je=255,Dl={aqua:[0,je,je],lime:[0,je,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,je],navy:[0,0,128],white:[je,je,je],olive:[128,128,0],yellow:[je,je,0],orange:[je,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[je,0,0],pink:[je,192,203],cyan:[0,je,je],transparent:[je,je,je,0]},fd=function(t,e,n){return t+=t<0?1:t>1?-1:0,(t*6<1?e+(n-e)*t*6:t<.5?n:t*3<2?e+(n-e)*(2/3-t)*6:e)*je+.5|0},xv=function(t,e,n){var i=t?jr(t)?[t>>16,t>>8&je,t&je]:0:Dl.black,o,l,c,u,f,d,g,p,m,M;if(!i){if(t.substr(-1)===","&&(t=t.substr(0,t.length-1)),Dl[t])i=Dl[t];else if(t.charAt(0)==="#"){if(t.length<6&&(o=t.charAt(1),l=t.charAt(2),c=t.charAt(3),t="#"+o+o+l+l+c+c+(t.length===5?t.charAt(4)+t.charAt(4):"")),t.length===9)return i=parseInt(t.substr(1,6),16),[i>>16,i>>8&je,i&je,parseInt(t.substr(7),16)/255];t=parseInt(t.substr(1),16),i=[t>>16,t>>8&je,t&je]}else if(t.substr(0,3)==="hsl"){if(i=M=t.match(vd),!e)u=+i[0]%360/360,f=+i[1]/100,d=+i[2]/100,l=d<=.5?d*(f+1):d+f-d*f,o=d*2-l,i.length>3&&(i[3]*=1),i[0]=fd(u+1/3,o,l),i[1]=fd(u,o,l),i[2]=fd(u-1/3,o,l);else if(~t.indexOf("="))return i=t.match(Pd),n&&i.length<4&&(i[3]=1),i}else i=t.match(vd)||Dl.transparent;i=i.map(Number)}return e&&!M&&(o=i[0]/je,l=i[1]/je,c=i[2]/je,g=Math.max(o,l,c),p=Math.min(o,l,c),d=(g+p)/2,g===p?u=f=0:(m=g-p,f=d>.5?m/(2-g-p):m/(g+p),u=g===o?(l-c)/m+(lt||x<0)&&(n+=x-e),i+=x,U=i-n,b=U-l,(b>0||E)&&(L=++g.frame,p=U-g.time*1e3,g.time=U=U/1e3,l+=b+(b>=o?4:o-b),T=1),E||(u=f(y)),T)for(m=0;m=x&&m--},_listeners:c},g}(),ga=function(){return!Bl&&Ti.wake()},Oe={},YA=/^[\d.\-M][\d.\-,\s]/,ZA=/["']/g,$A=function(t){for(var e={},n=t.substr(1,t.length-3).split(":"),i=n[0],o=1,l=n.length,c,u,f;o1&&n.config?n.config.apply(null,~t.indexOf("{")?[$A(e[1])]:JA(t).split(",").map(rv)):Oe._CE&&YA.test(t)?Oe._CE("",t):n},Mv=function(t){return function(e){return 1-t(1-e)}},Sv=function r(t,e){for(var n=t._first,i;n;)n instanceof Gn?r(n,e):n.vars.yoyoEase&&(!n._yoyo||!n._repeat)&&n._yoyo!==e&&(n.timeline?r(n.timeline,e):(i=n._ease,n._ease=n._yEase,n._yEase=i,n._yoyo=e)),n=n._next},go=function(t,e){return t&&(gn(t)?t:Oe[t]||KA(t))||e},Mo=function(t,e,n,i){n===void 0&&(n=function(u){return 1-e(1-u)}),i===void 0&&(i=function(u){return u<.5?e(u*2)/2:1-e((1-u)*2)/2});var o={easeIn:e,easeOut:n,easeInOut:i},l;return ui(t,function(c){Oe[c]=Vi[c]=o,Oe[l=c.toLowerCase()]=n;for(var u in o)Oe[l+(u==="easeIn"?".in":u==="easeOut"?".out":".inOut")]=Oe[c+"."+u]=o[u]}),o},wv=function(t){return function(e){return e<.5?(1-t(1-e*2))/2:.5+t((e-.5)*2)/2}},dd=function r(t,e,n){var i=e>=1?e:1,o=(n||(t?.3:.45))/(e<1?e:1),l=o/_d*(Math.asin(1/i)||0),c=function(d){return d===1?1:i*Math.pow(2,-10*d)*TA((d-l)*o)+1},u=t==="out"?c:t==="in"?function(f){return 1-c(1-f)}:wv(c);return o=_d/o,u.config=function(f,d){return r(t,f,d)},u},pd=function r(t,e){e===void 0&&(e=1.70158);var n=function(l){return l?--l*l*((e+1)*l+e)+1:0},i=t==="out"?n:t==="in"?function(o){return 1-n(1-o)}:wv(n);return i.config=function(o){return r(t,o)},i};ui("Linear,Quad,Cubic,Quart,Quint,Strong",function(r,t){var e=t<5?t+1:t;Mo(r+",Power"+(e-1),t?function(n){return Math.pow(n,e)}:function(n){return n},function(n){return 1-Math.pow(1-n,e)},function(n){return n<.5?Math.pow(n*2,e)/2:1-Math.pow((1-n)*2,e)/2})});Oe.Linear.easeNone=Oe.none=Oe.Linear.easeIn;Mo("Elastic",dd("in"),dd("out"),dd());(function(r,t){var e=1/t,n=2*e,i=2.5*e,o=function(c){return c0?n+(n+this._rDelay)*this._repeat:n):this.totalDuration()&&this._dur},t.totalDuration=function(n){return arguments.length?(this._dirty=0,ma(this,this._repeat<0?n:(n-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(n,i){if(ga(),!arguments.length)return this._tTime;var o=this._dp;if(o&&o.smoothChildTiming&&this._ts){for(Su(this,n),!o._dp||o.parent||av(o,this);o&&o.parent;)o.parent._time!==o._start+(o._ts>=0?o._tTime/o._ts:(o.totalDuration()-o._tTime)/-o._ts)&&o.totalTime(o._tTime,!0),o=o.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&n0||!this._tDur&&!n)&&Dr(this._dp,this,this._start-this._delay)}return(this._tTime!==n||!this._dur&&!i||this._initted&&Math.abs(this._zTime)===en||!n&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=n),iv(this,n,i)),this},t.time=function(n,i){return arguments.length?this.totalTime(Math.min(this.totalDuration(),n+W0(this))%(this._dur+this._rDelay)||(n?this._dur:0),i):this._time},t.totalProgress=function(n,i){return arguments.length?this.totalTime(this.totalDuration()*n,i):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>0?1:0},t.progress=function(n,i){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-n:n)+W0(this),i):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},t.iteration=function(n,i){var o=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(n-1)*o,i):this._repeat?pa(this._tTime,o)+1:1},t.timeScale=function(n,i){if(!arguments.length)return this._rts===-en?0:this._rts;if(this._rts===n)return this;var o=this.parent&&this._ts?gu(this.parent._time,this):this._tTime;return this._rts=+n||0,this._ts=this._ps||n===-en?0:this._rts,this.totalTime(Hl(-Math.abs(this._delay),this._tDur,o),i!==!1),Mu(this),LA(this)},t.paused=function(n){return arguments.length?(this._ps!==n&&(this._ps=n,n?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(ga(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==en&&(this._tTime-=en)))),this):this._ps},t.startTime=function(n){if(arguments.length){this._start=n;var i=this.parent||this._dp;return i&&(i._sort||!this.parent)&&Dr(i,this,n-this._delay),this}return this._start},t.endTime=function(n){return this._start+(Ei(n)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},t.rawTime=function(n){var i=this.parent||this._dp;return i?n&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?gu(i.rawTime(n),this):this._tTime:this._tTime},t.revert=function(n){n===void 0&&(n=CA);var i=Jn;return Jn=n,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(n),this.totalTime(-.01,n.suppressEvents)),this.data!=="nested"&&n.kill!==!1&&this.kill(),Jn=i,this},t.globalTime=function(n){for(var i=this,o=arguments.length?n:i.rawTime();i;)o=i._start+o/(Math.abs(i._ts)||1),i=i._dp;return!this.parent&&this._sat?this._sat.globalTime(n):o},t.repeat=function(n){return arguments.length?(this._repeat=n===1/0?-2:n,X0(this)):this._repeat===-2?1/0:this._repeat},t.repeatDelay=function(n){if(arguments.length){var i=this._time;return this._rDelay=n,X0(this),i?this.time(i):this}return this._rDelay},t.yoyo=function(n){return arguments.length?(this._yoyo=n,this):this._yoyo},t.seek=function(n,i){return this.totalTime(ir(this,n),Ei(i))},t.restart=function(n,i){return this.play().totalTime(n?-this._delay:0,Ei(i))},t.play=function(n,i){return n!=null&&this.seek(n,i),this.reversed(!1).paused(!1)},t.reverse=function(n,i){return n!=null&&this.seek(n||this.totalDuration(),i),this.reversed(!0).paused(!1)},t.pause=function(n,i){return n!=null&&this.seek(n,i),this.paused(!0)},t.resume=function(){return this.paused(!1)},t.reversed=function(n){return arguments.length?(!!n!==this.reversed()&&this.timeScale(-this._rts||(n?-en:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-en,this},t.isActive=function(){var n=this.parent||this._dp,i=this._start,o;return!!(!n||this._ts&&this._initted&&n.isActive()&&(o=n.rawTime(!0))>=i&&o1?(i?(l[n]=i,o&&(l[n+"Params"]=o),n==="onUpdate"&&(this._onUpdate=i)):delete l[n],this):l[n]},t.then=function(n){var i=this;return new Promise(function(o){var l=gn(n)?n:sv,c=function(){var f=i.then;i.then=null,gn(l)&&(l=l(i))&&(l.then||l===i)&&(i.then=f),o(l),i.then=f};i._initted&&i.totalProgress()===1&&i._ts>=0||!i._tTime&&i._ts<0?c():i._prom=c})},t.kill=function(){Ll(this)},r}();or(kl.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:-en,_prom:0,_ps:!1,_rts:1});var Gn=function(r){$0(t,r);function t(n,i){var o;return n===void 0&&(n={}),o=r.call(this,n)||this,o.labels={},o.smoothChildTiming=!!n.smoothChildTiming,o.autoRemoveChildren=!!n.autoRemoveChildren,o._sort=Ei(n.sortChildren),fn&&Dr(n.parent||fn,Kr(o),i),n.reversed&&o.reverse(),n.paused&&o.paused(!0),n.scrollTrigger&&lv(Kr(o),n.scrollTrigger),o}var e=t.prototype;return e.to=function(i,o,l){return Nl(0,arguments,this),this},e.from=function(i,o,l){return Nl(1,arguments,this),this},e.fromTo=function(i,o,l,c){return Nl(2,arguments,this),this},e.set=function(i,o,l){return o.duration=0,o.parent=this,Ul(o).repeatDelay||(o.repeat=0),o.immediateRender=!!o.immediateRender,new wn(i,o,ir(this,l),1),this},e.call=function(i,o,l){return Dr(this,wn.delayedCall(0,i,o),l)},e.staggerTo=function(i,o,l,c,u,f,d){return l.duration=o,l.stagger=l.stagger||c,l.onComplete=f,l.onCompleteParams=d,l.parent=this,new wn(i,l,ir(this,u)),this},e.staggerFrom=function(i,o,l,c,u,f,d){return l.runBackwards=1,Ul(l).immediateRender=Ei(l.immediateRender),this.staggerTo(i,o,l,c,u,f,d)},e.staggerFromTo=function(i,o,l,c,u,f,d,g){return c.startAt=l,Ul(c).immediateRender=Ei(c.immediateRender),this.staggerTo(i,o,c,u,f,d,g)},e.render=function(i,o,l){var c=this._time,u=this._dirty?this.totalDuration():this._tDur,f=this._dur,d=i<=0?0:Fn(i),g=this._zTime<0!=i<0&&(this._initted||!f),p,m,M,y,v,x,E,b,T,U,L,I;if(this!==fn&&d>u&&i>=0&&(d=u),d!==this._tTime||l||g){if(c!==this._time&&f&&(d+=this._time-c,i+=this._time-c),p=d,T=this._start,b=this._ts,x=!b,g&&(f||(c=this._zTime),(i||!o)&&(this._zTime=i)),this._repeat){if(L=this._yoyo,v=f+this._rDelay,this._repeat<-1&&i<0)return this.totalTime(v*100+i,o,l);if(p=Fn(d%v),d===u?(y=this._repeat,p=f):(y=~~(d/v),y&&y===d/v&&(p=f,y--),p>f&&(p=f)),U=pa(this._tTime,v),!c&&this._tTime&&U!==y&&this._tTime-U*v-this._dur<=0&&(U=y),L&&y&1&&(p=f-p,I=1),y!==U&&!this._lock){var N=L&&U&1,A=N===(L&&y&1);if(y=c&&i>=0)for(m=this._first;m;){if(M=m._next,(m._act||p>=m._start)&&m._ts&&E!==m){if(m.parent!==this)return this.render(i,o,l);if(m.render(m._ts>0?(p-m._start)*m._ts:(m._dirty?m.totalDuration():m._tDur)+(p-m._start)*m._ts,o,l),p!==this._time||!this._ts&&!x){E=0,M&&(d+=this._zTime=-en);break}}m=M}else{m=this._last;for(var w=i<0?i:p;m;){if(M=m._prev,(m._act||w<=m._end)&&m._ts&&E!==m){if(m.parent!==this)return this.render(i,o,l);if(m.render(m._ts>0?(w-m._start)*m._ts:(m._dirty?m.totalDuration():m._tDur)+(w-m._start)*m._ts,o,l||Jn&&(m._initted||m._startAt)),p!==this._time||!this._ts&&!x){E=0,M&&(d+=this._zTime=w?-en:en);break}}m=M}}if(E&&!o&&(this.pause(),E.render(p>=c?0:-en)._zTime=p>=c?1:-1,this._ts))return this._start=T,Mu(this),this.render(i,o,l);this._onUpdate&&!o&&Hi(this,"onUpdate",!0),(d===u&&this._tTime>=this.totalDuration()||!d&&c)&&(T===this._start||Math.abs(b)!==Math.abs(this._ts))&&(this._lock||((i||!f)&&(d===u&&this._ts>0||!d&&this._ts<0)&&Os(this,1),!o&&!(i<0&&!c)&&(d||c||!u)&&(Hi(this,d===u&&i>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(d0)&&this._prom())))}return this},e.add=function(i,o){var l=this;if(jr(o)||(o=ir(this,o,i)),!(i instanceof kl)){if(Kn(i))return i.forEach(function(c){return l.add(c,o)}),this;if(Pn(i))return this.addLabel(i,o);if(gn(i))i=wn.delayedCall(0,i);else return this}return this!==i?Dr(this,i,o):this},e.getChildren=function(i,o,l,c){i===void 0&&(i=!0),o===void 0&&(o=!0),l===void 0&&(l=!0),c===void 0&&(c=-rr);for(var u=[],f=this._first;f;)f._start>=c&&(f instanceof wn?o&&u.push(f):(l&&u.push(f),i&&u.push.apply(u,f.getChildren(!0,o,l)))),f=f._next;return u},e.getById=function(i){for(var o=this.getChildren(1,1,1),l=o.length;l--;)if(o[l].vars.id===i)return o[l]},e.remove=function(i){return Pn(i)?this.removeLabel(i):gn(i)?this.killTweensOf(i):(yu(this,i),i===this._recent&&(this._recent=this._last),mo(this))},e.totalTime=function(i,o){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=Fn(Ti.time-(this._ts>0?i/this._ts:(this.totalDuration()-i)/-this._ts))),r.prototype.totalTime.call(this,i,o),this._forcing=0,this):this._tTime},e.addLabel=function(i,o){return this.labels[i]=ir(this,o),this},e.removeLabel=function(i){return delete this.labels[i],this},e.addPause=function(i,o,l){var c=wn.delayedCall(0,o||zl,l);return c.data="isPause",this._hasPause=1,Dr(this,c,ir(this,i))},e.removePause=function(i){var o=this._first;for(i=ir(this,i);o;)o._start===i&&o.data==="isPause"&&Os(o),o=o._next},e.killTweensOf=function(i,o,l){for(var c=this.getTweensOf(i,l),u=c.length;u--;)Ds!==c[u]&&c[u].kill(i,o);return this},e.getTweensOf=function(i,o){for(var l=[],c=sr(i),u=this._first,f=jr(o),d;u;)u instanceof wn?RA(u._targets,c)&&(f?(!Ds||u._initted&&u._ts)&&u.globalTime(0)<=o&&u.globalTime(u.totalDuration())>o:!o||u.isActive())&&l.push(u):(d=u.getTweensOf(c,o)).length&&l.push.apply(l,d),u=u._next;return l},e.tweenTo=function(i,o){o=o||{};var l=this,c=ir(l,i),u=o,f=u.startAt,d=u.onStart,g=u.onStartParams,p=u.immediateRender,m,M=wn.to(l,or({ease:o.ease||"none",lazy:!1,immediateRender:!1,time:c,overwrite:"auto",duration:o.duration||Math.abs((c-(f&&"time"in f?f.time:l._time))/l.timeScale())||en,onStart:function(){if(l.pause(),!m){var v=o.duration||Math.abs((c-(f&&"time"in f?f.time:l._time))/l.timeScale());M._dur!==v&&ma(M,v,0,1).render(M._time,!0,!0),m=1}d&&d.apply(M,g||[])}},o));return p?M.render(0):M},e.tweenFromTo=function(i,o,l){return this.tweenTo(o,or({startAt:{time:ir(this,i)}},l))},e.recent=function(){return this._recent},e.nextLabel=function(i){return i===void 0&&(i=this._time),q0(this,ir(this,i))},e.previousLabel=function(i){return i===void 0&&(i=this._time),q0(this,ir(this,i),1)},e.currentLabel=function(i){return arguments.length?this.seek(i,!0):this.previousLabel(this._time+en)},e.shiftChildren=function(i,o,l){l===void 0&&(l=0);for(var c=this._first,u=this.labels,f;c;)c._start>=l&&(c._start+=i,c._end+=i),c=c._next;if(o)for(f in u)u[f]>=l&&(u[f]+=i);return mo(this)},e.invalidate=function(i){var o=this._first;for(this._lock=0;o;)o.invalidate(i),o=o._next;return r.prototype.invalidate.call(this,i)},e.clear=function(i){i===void 0&&(i=!0);for(var o=this._first,l;o;)l=o._next,this.remove(o),o=l;return this._dp&&(this._time=this._tTime=this._pTime=0),i&&(this.labels={}),mo(this)},e.totalDuration=function(i){var o=0,l=this,c=l._last,u=rr,f,d,g;if(arguments.length)return l.timeScale((l._repeat<0?l.duration():l.totalDuration())/(l.reversed()?-i:i));if(l._dirty){for(g=l.parent;c;)f=c._prev,c._dirty&&c.totalDuration(),d=c._start,d>u&&l._sort&&c._ts&&!l._lock?(l._lock=1,Dr(l,c,d-c._delay,1)._lock=0):u=d,d<0&&c._ts&&(o-=d,(!g&&!l._dp||g&&g.smoothChildTiming)&&(l._start+=d/l._ts,l._time-=d,l._tTime-=d),l.shiftChildren(-d,!1,-1/0),u=0),c._end>o&&c._ts&&(o=c._end),c=f;ma(l,l===fn&&l._time>o?l._time:o,1,1),l._dirty=0}return l._tDur},t.updateRoot=function(i){if(fn._ts&&(iv(fn,gu(i,fn)),nv=Ti.frame),Ti.frame>=V0){V0+=Ai.autoSleep||120;var o=fn._first;if((!o||!o._ts)&&Ai.autoSleep&&Ti._listeners.length<2){for(;o&&!o._ts;)o=o._next;o||Ti.sleep()}}},t}(kl);or(Gn.prototype,{_lock:0,_hasPause:0,_forcing:0});var QA=function(t,e,n,i,o,l,c){var u=new hi(this._pt,t,e,0,1,Gd,null,o),f=0,d=0,g,p,m,M,y,v,x,E;for(u.b=n,u.e=i,n+="",i+="",(x=~i.indexOf("random("))&&(i=_a(i)),l&&(E=[n,i],l(E,t,e),n=E[0],i=E[1]),p=n.match(ud)||[];g=ud.exec(i);)M=g[0],y=i.substring(f,g.index),m?m=(m+1)%5:y.substr(-5)==="rgba("&&(m=1),M!==p[d++]&&(v=parseFloat(p[d-1])||0,u._pt={_next:u._pt,p:y||d===1?y:",",s:v,c:M.charAt(1)==="="?yo(v,M)-v:parseFloat(M)-v,m:m&&m<4?Math.round:0},f=ud.lastIndex);return u.c=f")}),T.duration();else{L={};for(N in M)N==="ease"||N==="easeEach"||nC(N,M[N],L,M.easeEach);for(N in L)for(Z=L[N].sort(function($,nt){return $.t-nt.t}),V=0,U=0;Uu-en&&!d?u:if&&(p=f)),x=this._yoyo&&M&1,x&&(T=this._yEase,p=f-p),v=pa(this._tTime,y),p===c&&!l&&this._initted&&M===v)return this._tTime=g,this;M!==v&&(b&&this._yEase&&Sv(b,x),this.vars.repeatRefresh&&!x&&!this._lock&&this._time!==y&&this._initted&&(this._lock=l=1,this.render(Fn(y*M),!0).invalidate()._lock=0))}if(!this._initted){if(cv(this,d?i:p,l,o,g))return this._tTime=0,this;if(c!==this._time&&!(l&&this.vars.repeatRefresh&&M!==v))return this;if(f!==this._dur)return this.render(i,o,l)}if(this._tTime=g,this._time=p,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=E=(T||this._ease)(p/f),this._from&&(this.ratio=E=1-E),p&&!c&&!o&&!M&&(Hi(this,"onStart"),this._tTime!==g))return this;for(m=this._pt;m;)m.r(E,m.d),m=m._next;b&&b.render(i<0?i:b._dur*b._ease(p/this._dur),o,l)||this._startAt&&(this._zTime=i),this._onUpdate&&!o&&(d&&Md(this,i,o,l),Hi(this,"onUpdate")),this._repeat&&M!==v&&this.vars.onRepeat&&!o&&this.parent&&Hi(this,"onRepeat"),(g===this._tDur||!g)&&this._tTime===g&&(d&&!this._onUpdate&&Md(this,i,!0,!0),(i||!f)&&(g===this._tDur&&this._ts>0||!g&&this._ts<0)&&Os(this,1),!o&&!(d&&!c)&&(g||c||x)&&(Hi(this,g===u?"onComplete":"onReverseComplete",!0),this._prom&&!(g0)&&this._prom()))}return this},e.targets=function(){return this._targets},e.invalidate=function(i){return(!i||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(i),r.prototype.invalidate.call(this,i)},e.resetTo=function(i,o,l,c,u){Bl||Ti.wake(),this._ts||this.play();var f=Math.min(this._dur,(this._dp._time-this._start)*this._ts),d;return this._initted||Hd(this,f),d=this._ease(f/this._dur),tC(this,i,o,l,c,d,f,u)?this.resetTo(i,o,l,c,1):(Su(this,0),this.parent||ov(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},e.kill=function(i,o){if(o===void 0&&(o="all"),!i&&(!o||o==="all"))return this._lazy=this._pt=0,this.parent?Ll(this):this;if(this.timeline){var l=this.timeline.totalDuration();return this.timeline.killTweensOf(i,o,Ds&&Ds.vars.overwrite!==!0)._first||Ll(this),this.parent&&l!==this.timeline.totalDuration()&&ma(this,this._dur*this.timeline._tDur/l,0,1),this}var c=this._targets,u=i?sr(i):c,f=this._ptLookup,d=this._pt,g,p,m,M,y,v,x;if((!o||o==="all")&&IA(c,u))return o==="all"&&(this._pt=0),Ll(this);for(g=this._op=this._op||[],o!=="all"&&(Pn(o)&&(y={},ui(o,function(E){return y[E]=1}),o=y),o=eC(c,o)),x=c.length;x--;)if(~u.indexOf(c[x])){p=f[x],o==="all"?(g[x]=o,M=p,m={}):(m=g[x]=g[x]||{},M=o);for(y in M)v=p&&p[y],v&&((!("kill"in v.d)||v.d.kill(y)===!0)&&yu(this,v,"_pt"),delete p[y]),m!=="all"&&(m[y]=1)}return this._initted&&!this._pt&&d&&Ll(this),this},t.to=function(i,o){return new t(i,o,arguments[2])},t.from=function(i,o){return Nl(1,arguments)},t.delayedCall=function(i,o,l,c){return new t(o,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:i,onComplete:o,onReverseComplete:o,onCompleteParams:l,onReverseCompleteParams:l,callbackScope:c})},t.fromTo=function(i,o,l){return Nl(2,arguments)},t.set=function(i,o){return o.duration=0,o.repeatDelay||(o.repeat=0),new t(i,o)},t.killTweensOf=function(i,o,l){return fn.killTweensOf(i,o,l)},t}(kl);or(wn.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0});ui("staggerTo,staggerFrom,staggerFromTo",function(r){wn[r]=function(){var t=new Gn,e=wd.call(arguments,0);return e.splice(r==="staggerFromTo"?5:4,0,0),t[r].apply(t,e)}});var Vd=function(t,e,n){return t[e]=n},Ev=function(t,e,n){return t[e](n)},iC=function(t,e,n,i){return t[e](i.fp,n)},rC=function(t,e,n){return t.setAttribute(e,n)},wu=function(t,e){return gn(t[e])?Ev:vu(t[e])&&t.setAttribute?rC:Vd},Av=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e6)/1e6,e)},sC=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},Gd=function(t,e){var n=e._pt,i="";if(!t&&e.b)i=e.b;else if(t===1&&e.e)i=e.e;else{for(;n;)i=n.p+(n.m?n.m(n.s+n.c*t):Math.round((n.s+n.c*t)*1e4)/1e4)+i,n=n._next;i+=e.c}e.set(e.t,e.p,i,e)},Wd=function(t,e){for(var n=e._pt;n;)n.r(t,n.d),n=n._next},oC=function(t,e,n,i){for(var o=this._pt,l;o;)l=o._next,o.p===i&&o.modifier(t,e,n),o=l},aC=function(t){for(var e=this._pt,n,i;e;)i=e._next,e.p===t&&!e.op||e.op===t?yu(this,e,"_pt"):e.dep||(n=1),e=i;return!n},lC=function(t,e,n,i){i.mSet(t,e,i.m.call(i.tween,n,i.mt),i)},Xd=function(t){for(var e=t._pt,n,i,o,l;e;){for(n=e._next,i=o;i&&i.pr>e.pr;)i=i._next;(e._prev=i?i._prev:l)?e._prev._next=e:o=e,(e._next=i)?i._prev=e:l=e,e=n}t._pt=o},hi=function(){function r(e,n,i,o,l,c,u,f,d){this.t=n,this.s=o,this.c=l,this.p=i,this.r=c||Av,this.d=u||this,this.set=f||Vd,this.pr=d||0,this._next=e,e&&(e._prev=this)}var t=r.prototype;return t.modifier=function(n,i,o){this.mSet=this.mSet||this.set,this.set=lC,this.m=n,this.mt=o,this.tween=i},r}();ui(Ud+"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(r){return Dd[r]=1});Vi.TweenMax=Vi.TweenLite=wn;Vi.TimelineLite=Vi.TimelineMax=Gn;fn=new Gn({sortChildren:!1,defaults:da,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0});Ai.stringFilter=Fd;var _o=[],fu={},cC=[],Z0=0,uC=0,md=function(t){return(fu[t]||cC).map(function(e){return e()})},Ad=function(){var t=Date.now(),e=[];t-Z0>2&&(md("matchMediaInit"),_o.forEach(function(n){var i=n.queries,o=n.conditions,l,c,u,f;for(c in i)l=Lr.matchMedia(i[c]).matches,l&&(u=1),l!==o[c]&&(o[c]=l,f=1);f&&(n.revert(),u&&e.push(n))}),md("matchMediaRevert"),e.forEach(function(n){return n.onMatch(n,function(i){return n.add(null,i)})}),Z0=t,md("matchMedia"))},Cv=function(){function r(e,n){this.selector=n&&bd(n),this.data=[],this._r=[],this.isReverted=!1,this.id=uC++,e&&this.add(e)}var t=r.prototype;return t.add=function(n,i,o){gn(n)&&(o=i,i=n,n=gn);var l=this,c=function(){var f=ln,d=l.selector,g;return f&&f!==l&&f.data.push(l),o&&(l.selector=bd(o)),ln=l,g=i.apply(l,arguments),gn(g)&&l._r.push(g),ln=f,l.selector=d,l.isReverted=!1,g};return l.last=c,n===gn?c(l,function(u){return l.add(null,u)}):n?l[n]=c:c},t.ignore=function(n){var i=ln;ln=null,n(this),ln=i},t.getTweens=function(){var n=[];return this.data.forEach(function(i){return i instanceof r?n.push.apply(n,i.getTweens()):i instanceof wn&&!(i.parent&&i.parent.data==="nested")&&n.push(i)}),n},t.clear=function(){this._r.length=this.data.length=0},t.kill=function(n,i){var o=this;if(n?function(){for(var c=o.getTweens(),u=o.data.length,f;u--;)f=o.data[u],f.data==="isFlip"&&(f.revert(),f.getChildren(!0,!0,!1).forEach(function(d){return c.splice(c.indexOf(d),1)}));for(c.map(function(d){return{g:d._dur||d._delay||d._sat&&!d._sat.vars.immediateRender?d.globalTime(0):-1/0,t:d}}).sort(function(d,g){return g.g-d.g||-1/0}).forEach(function(d){return d.t.revert(n)}),u=o.data.length;u--;)f=o.data[u],f instanceof Gn?f.data!=="nested"&&(f.scrollTrigger&&f.scrollTrigger.revert(),f.kill()):!(f instanceof wn)&&f.revert&&f.revert(n);o._r.forEach(function(d){return d(n,o)}),o.isReverted=!0}():this.data.forEach(function(c){return c.kill&&c.kill()}),this.clear(),i)for(var l=_o.length;l--;)_o[l].id===this.id&&_o.splice(l,1)},t.revert=function(n){this.kill(n||{})},r}(),hC=function(){function r(e){this.contexts=[],this.scope=e,ln&&ln.data.push(this)}var t=r.prototype;return t.add=function(n,i,o){Ur(n)||(n={matches:n});var l=new Cv(0,o||this.scope),c=l.conditions={},u,f,d;ln&&!l.selector&&(l.selector=ln.selector),this.contexts.push(l),i=l.add("onMatch",i),l.queries=n;for(f in n)f==="all"?d=1:(u=Lr.matchMedia(n[f]),u&&(_o.indexOf(l)<0&&_o.push(l),(c[f]=u.matches)&&(d=1),u.addListener?u.addListener(Ad):u.addEventListener("change",Ad)));return d&&i(l,function(g){return l.add(null,g)}),this},t.revert=function(n){this.kill(n||{})},t.kill=function(n){this.contexts.forEach(function(i){return i.kill(n,!0)})},r}(),_u={registerPlugin:function(){for(var t=arguments.length,e=new Array(t),n=0;n1){var i=t.map(function(d){return Qn.quickSetter(d,e,n)}),o=i.length;return function(d){for(var g=o;g--;)i[g](d)}}t=t[0]||{};var l=bi[e],c=Ns(t),u=c.harness&&(c.harness.aliases||{})[e]||e,f=l?function(d){var g=new l;fa._pt=0,g.init(t,n?d+n:d,fa,0,[t]),g.render(1,g),fa._pt&&Wd(1,fa)}:c.set(t,u);return l?f:function(d){return f(t,u,n?d+n:d,c,1)}},quickTo:function(t,e,n){var i,o=Qn.to(t,vo((i={},i[e]="+=0.1",i.paused=!0,i),n||{})),l=function(u,f,d){return o.resetTo(e,u,f,d)};return l.tween=o,l},isTweening:function(t){return fn.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=go(t.ease,da.ease)),G0(da,t||{})},config:function(t){return G0(Ai,t||{})},registerEffect:function(t){var e=t.name,n=t.effect,i=t.plugins,o=t.defaults,l=t.extendTimeline;(i||"").split(",").forEach(function(c){return c&&!bi[c]&&!Vi[c]&&Fl(e+" effect requires "+c+" plugin.")}),hd[e]=function(c,u,f){return n(sr(c),or(u||{},o),f)},l&&(Gn.prototype[e]=function(c,u,f){return this.add(hd[e](c,Ur(u)?u:(f=u)&&{},this),f)})},registerEase:function(t,e){Oe[t]=go(e)},parseEase:function(t,e){return arguments.length?go(t,e):Oe},getById:function(t){return fn.getById(t)},exportRoot:function(t,e){t===void 0&&(t={});var n=new Gn(t),i,o;for(n.smoothChildTiming=Ei(t.smoothChildTiming),fn.remove(n),n._dp=0,n._time=n._tTime=fn._time,i=fn._first;i;)o=i._next,(e||!(!i._dur&&i instanceof wn&&i.vars.onComplete===i._targets[0]))&&Dr(n,i,i._start-i._delay),i=o;return Dr(fn,n,0),n},context:function(t,e){return t?new Cv(t,e):ln},matchMedia:function(t){return new hC(t)},matchMediaRefresh:function(){return _o.forEach(function(t){var e=t.conditions,n,i;for(i in e)e[i]&&(e[i]=!1,n=1);n&&t.revert()})||Ad()},addEventListener:function(t,e){var n=fu[t]||(fu[t]=[]);~n.indexOf(e)||n.push(e)},removeEventListener:function(t,e){var n=fu[t],i=n&&n.indexOf(e);i>=0&&n.splice(i,1)},utils:{wrap:GA,wrapYoyo:WA,distribute:fv,random:pv,snap:dv,normalize:VA,getUnit:Wn,clamp:zA,splitColor:xv,toArray:sr,selector:bd,mapRange:gv,pipe:kA,unitize:HA,interpolate:XA,shuffle:hv},install:tv,effects:hd,ticker:Ti,updateRoot:Gn.updateRoot,plugins:bi,globalTimeline:fn,core:{PropTween:hi,globals:ev,Tween:wn,Timeline:Gn,Animation:kl,getCache:Ns,_removeLinkedListItem:yu,reverting:function(){return Jn},context:function(t){return t&&ln&&(ln.data.push(t),t._ctx=ln),ln},suppressOverwrites:function(t){return Cd=t}}};ui("to,from,fromTo,delayedCall,set,killTweensOf",function(r){return _u[r]=wn[r]});Ti.add(Gn.updateRoot);fa=_u.to({},{duration:0});var fC=function(t,e){for(var n=t._pt;n&&n.p!==e&&n.op!==e&&n.fp!==e;)n=n._next;return n},dC=function(t,e){var n=t._targets,i,o,l;for(i in e)for(o=n.length;o--;)l=t._ptLookup[o][i],l&&(l=l.d)&&(l._pt&&(l=fC(l,i)),l&&l.modifier&&l.modifier(e[i],t,n[o],i))},gd=function(t,e){return{name:t,rawVars:1,init:function(i,o,l){l._onInit=function(c){var u,f;if(Pn(o)&&(u={},ui(o,function(d){return u[d]=1}),o=u),e){u={};for(f in o)u[f]=e(o[f]);o=u}dC(c,o)}}}},Qn=_u.registerPlugin({name:"attr",init:function(t,e,n,i,o){var l,c,u;this.tween=n;for(l in e)u=t.getAttribute(l)||"",c=this.add(t,"setAttribute",(u||0)+"",e[l],i,o,0,0,l),c.op=l,c.b=u,this._props.push(l)},render:function(t,e){for(var n=e._pt;n;)Jn?n.set(n.t,n.p,n.b,n):n.r(t,n.d),n=n._next}},{name:"endArray",init:function(t,e){for(var n=e.length;n--;)this.add(t,n,t[n]||0,e[n],0,0,0,0,0,1)}},gd("roundProps",Td),gd("modifiers"),gd("snap",dv))||_u;wn.version=Gn.version=Qn.version="3.12.5";j0=1;Rd()&&ga();var pC=Oe.Power0,mC=Oe.Power1,gC=Oe.Power2,_C=Oe.Power3,vC=Oe.Power4,xC=Oe.Linear,yC=Oe.Quad,MC=Oe.Cubic,SC=Oe.Quart,wC=Oe.Quint,bC=Oe.Strong,TC=Oe.Elastic,EC=Oe.Back,AC=Oe.SteppedEase,CC=Oe.Bounce,RC=Oe.Sine,PC=Oe.Expo,IC=Oe.Circ;var Rv,zs,xa,Qd,To,LC,Pv,jd,DC=function(){return typeof window<"u"},es={},bo=180/Math.PI,ya=Math.PI/180,va=Math.atan2,Iv=1e8,tp=/([A-Z])/g,UC=/(left|right|width|margin|padding|x)/i,NC=/[\s,\(]\S/,Nr={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},Zd=function(t,e){return e.set(e.t,e.p,Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},OC=function(t,e){return e.set(e.t,e.p,t===1?e.e:Math.round((e.s+e.c*t)*1e4)/1e4+e.u,e)},FC=function(t,e){return e.set(e.t,e.p,t?Math.round((e.s+e.c*t)*1e4)/1e4+e.u:e.b,e)},zC=function(t,e){var n=e.s+e.c*t;e.set(e.t,e.p,~~(n+(n<0?-.5:.5))+e.u,e)},zv=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},Bv=function(t,e){return e.set(e.t,e.p,t!==1?e.b:e.e,e)},BC=function(t,e,n){return t.style[e]=n},kC=function(t,e,n){return t.style.setProperty(e,n)},HC=function(t,e,n){return t._gsap[e]=n},VC=function(t,e,n){return t._gsap.scaleX=t._gsap.scaleY=n},GC=function(t,e,n,i,o){var l=t._gsap;l.scaleX=l.scaleY=n,l.renderTransform(o,l)},WC=function(t,e,n,i,o){var l=t._gsap;l[e]=n,l.renderTransform(o,l)},dn="transform",Ci=dn+"Origin",XC=function r(t,e){var n=this,i=this.target,o=i.style,l=i._gsap;if(t in es&&o){if(this.tfm=this.tfm||{},t!=="transform")t=Nr[t]||t,~t.indexOf(",")?t.split(",").forEach(function(c){return n.tfm[c]=ts(i,c)}):this.tfm[t]=l.x?l[t]:ts(i,t),t===Ci&&(this.tfm.zOrigin=l.zOrigin);else return Nr.transform.split(",").forEach(function(c){return r.call(n,c,e)});if(this.props.indexOf(dn)>=0)return;l.svg&&(this.svgo=i.getAttribute("data-svg-origin"),this.props.push(Ci,e,"")),t=dn}(o||e)&&this.props.push(t,e,o[t])},kv=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},qC=function(){var t=this.props,e=this.target,n=e.style,i=e._gsap,o,l;for(o=0;o=0?Lv[l]:"")+t},Jd=function(){DC()&&window.document&&(Rv=window,zs=Rv.document,xa=zs.documentElement,To=$d("div")||{style:{}},LC=$d("div"),dn=Ma(dn),Ci=dn+"Origin",To.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",Vv=!!Ma("perspective"),jd=Qn.core.reverting,Qd=1)},qd=function r(t){var e=$d("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),n=this.parentNode,i=this.nextSibling,o=this.style.cssText,l;if(xa.appendChild(e),e.appendChild(this),this.style.display="block",t)try{l=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=r}catch{}else this._gsapBBox&&(l=this._gsapBBox());return n&&(i?n.insertBefore(this,i):n.appendChild(this)),xa.removeChild(e),this.style.cssText=o,l},Dv=function(t,e){for(var n=e.length;n--;)if(t.hasAttribute(e[n]))return t.getAttribute(e[n])},Gv=function(t){var e;try{e=t.getBBox()}catch{e=qd.call(t,!0)}return e&&(e.width||e.height)||t.getBBox===qd||(e=qd.call(t,!0)),e&&!e.width&&!e.x&&!e.y?{x:+Dv(t,["x","cx","x1"])||0,y:+Dv(t,["y","cy","y1"])||0,width:0,height:0}:e},Wv=function(t){return!!(t.getCTM&&(!t.parentNode||t.ownerSVGElement)&&Gv(t))},Eo=function(t,e){if(e){var n=t.style,i;e in es&&e!==Ci&&(e=dn),n.removeProperty?(i=e.substr(0,2),(i==="ms"||e.substr(0,6)==="webkit")&&(e="-"+e),n.removeProperty(i==="--"?e:e.replace(tp,"-$1").toLowerCase())):n.removeAttribute(e)}},Bs=function(t,e,n,i,o,l){var c=new hi(t._pt,e,n,0,1,l?Bv:zv);return t._pt=c,c.b=i,c.e=o,t._props.push(n),c},Uv={deg:1,rad:1,turn:1},YC={grid:1,flex:1},ks=function r(t,e,n,i){var o=parseFloat(n)||0,l=(n+"").trim().substr((o+"").length)||"px",c=To.style,u=UC.test(e),f=t.tagName.toLowerCase()==="svg",d=(f?"client":"offset")+(u?"Width":"Height"),g=100,p=i==="px",m=i==="%",M,y,v,x;if(i===l||!o||Uv[i]||Uv[l])return o;if(l!=="px"&&!p&&(o=r(t,e,n,"px")),x=t.getCTM&&Wv(t),(m||l==="%")&&(es[e]||~e.indexOf("adius")))return M=x?t.getBBox()[u?"width":"height"]:t[d],_n(m?o/M*g:o/100*M);if(c[u?"width":"height"]=g+(p?l:i),y=~e.indexOf("adius")||i==="em"&&t.appendChild&&!f?t:t.parentNode,x&&(y=(t.ownerSVGElement||{}).parentNode),(!y||y===zs||!y.appendChild)&&(y=zs.body),v=y._gsap,v&&m&&v.width&&u&&v.time===Ti.time&&!v.uncache)return _n(o/v.width*g);if(m&&(e==="height"||e==="width")){var E=t.style[e];t.style[e]=g+i,M=t[d],E?t.style[e]=E:Eo(t,e)}else(m||l==="%")&&!YC[Or(y,"display")]&&(c.position=Or(t,"position")),y===t&&(c.position="static"),y.appendChild(To),M=To[d],y.removeChild(To),c.position="absolute";return u&&m&&(v=Ns(y),v.time=Ti.time,v.width=y[d]),_n(p?M*o/g:M&&o?g/M*o:0)},ts=function(t,e,n,i){var o;return Qd||Jd(),e in Nr&&e!=="transform"&&(e=Nr[e],~e.indexOf(",")&&(e=e.split(",")[0])),es[e]&&e!=="transform"?(o=Wl(t,i),o=e!=="transformOrigin"?o[e]:o.svg?o.origin:Tu(Or(t,Ci))+" "+o.zOrigin+"px"):(o=t.style[e],(!o||o==="auto"||i||~(o+"").indexOf("calc("))&&(o=bu[e]&&bu[e](t,e,n)||Or(t,e)||Od(t,e)||(e==="opacity"?1:0))),n&&!~(o+"").trim().indexOf(" ")?ks(t,e,o,n)+n:o},ZC=function(t,e,n,i){if(!n||n==="none"){var o=Ma(e,t,1),l=o&&Or(t,o,1);l&&l!==n?(e=o,n=l):e==="borderColor"&&(n=Or(t,"borderTopColor"))}var c=new hi(this._pt,t.style,e,0,1,Gd),u=0,f=0,d,g,p,m,M,y,v,x,E,b,T,U;if(c.b=n,c.e=i,n+="",i+="",i==="auto"&&(y=t.style[e],t.style[e]=i,i=Or(t,e)||i,y?t.style[e]=y:Eo(t,e)),d=[n,i],Fd(d),n=d[0],i=d[1],p=n.match(xo)||[],U=i.match(xo)||[],U.length){for(;g=xo.exec(i);)v=g[0],E=i.substring(u,g.index),M?M=(M+1)%5:(E.substr(-5)==="rgba("||E.substr(-5)==="hsla(")&&(M=1),v!==(y=p[f++]||"")&&(m=parseFloat(y)||0,T=y.substr((m+"").length),v.charAt(1)==="="&&(v=yo(m,v)+T),x=parseFloat(v),b=v.substr((x+"").length),u=xo.lastIndex-b.length,b||(b=b||Ai.units[e]||T,u===i.length&&(i+=b,c.e+=b)),T!==b&&(m=ks(t,e,y,b)||0),c._pt={_next:c._pt,p:E||f===1?E:",",s:m,c:x-m,m:M&&M<4||e==="zIndex"?Math.round:0});c.c=u-1;)c=o[f],es[c]&&(u=1,c=c==="transformOrigin"?Ci:dn),Eo(n,c);u&&(Eo(n,dn),l&&(l.svg&&n.removeAttribute("transform"),Wl(n,1),l.uncache=1,kv(i)))}},bu={clearProps:function(t,e,n,i,o){if(o.data!=="isFromStart"){var l=t._pt=new hi(t._pt,e,n,0,0,JC);return l.u=i,l.pr=-10,l.tween=o,t._props.push(n),1}}},Gl=[1,0,0,1,0,0],Xv={},qv=function(t){return t==="matrix(1, 0, 0, 1, 0, 0)"||t==="none"||!t},Ov=function(t){var e=Or(t,dn);return qv(e)?Gl:e.substr(7).match(Pd).map(_n)},ep=function(t,e){var n=t._gsap||Ns(t),i=t.style,o=Ov(t),l,c,u,f;return n.svg&&t.getAttribute("transform")?(u=t.transform.baseVal.consolidate().matrix,o=[u.a,u.b,u.c,u.d,u.e,u.f],o.join(",")==="1,0,0,1,0,0"?Gl:o):(o===Gl&&!t.offsetParent&&t!==xa&&!n.svg&&(u=i.display,i.display="block",l=t.parentNode,(!l||!t.offsetParent)&&(f=1,c=t.nextElementSibling,xa.appendChild(t)),o=Ov(t),u?i.display=u:Eo(t,"display"),f&&(c?l.insertBefore(t,c):l?l.appendChild(t):xa.removeChild(t))),e&&o.length>6?[o[0],o[1],o[4],o[5],o[12],o[13]]:o)},Kd=function(t,e,n,i,o,l){var c=t._gsap,u=o||ep(t,!0),f=c.xOrigin||0,d=c.yOrigin||0,g=c.xOffset||0,p=c.yOffset||0,m=u[0],M=u[1],y=u[2],v=u[3],x=u[4],E=u[5],b=e.split(" "),T=parseFloat(b[0])||0,U=parseFloat(b[1])||0,L,I,N,A;n?u!==Gl&&(I=m*v-M*y)&&(N=T*(v/I)+U*(-y/I)+(y*E-v*x)/I,A=T*(-M/I)+U*(m/I)-(m*E-M*x)/I,T=N,U=A):(L=Gv(t),T=L.x+(~b[0].indexOf("%")?T/100*L.width:T),U=L.y+(~(b[1]||b[0]).indexOf("%")?U/100*L.height:U)),i||i!==!1&&c.smooth?(x=T-f,E=U-d,c.xOffset=g+(x*m+E*y)-x,c.yOffset=p+(x*M+E*v)-E):c.xOffset=c.yOffset=0,c.xOrigin=T,c.yOrigin=U,c.smooth=!!i,c.origin=e,c.originIsAbsolute=!!n,t.style[Ci]="0px 0px",l&&(Bs(l,c,"xOrigin",f,T),Bs(l,c,"yOrigin",d,U),Bs(l,c,"xOffset",g,c.xOffset),Bs(l,c,"yOffset",p,c.yOffset)),t.setAttribute("data-svg-origin",T+" "+U)},Wl=function(t,e){var n=t._gsap||new zd(t);if("x"in n&&!e&&!n.uncache)return n;var i=t.style,o=n.scaleX<0,l="px",c="deg",u=getComputedStyle(t),f=Or(t,Ci)||"0",d,g,p,m,M,y,v,x,E,b,T,U,L,I,N,A,w,B,V,Z,j,rt,$,nt,K,gt,z,bt,jt,fe,ot,_t;return d=g=p=y=v=x=E=b=T=0,m=M=1,n.svg=!!(t.getCTM&&Wv(t)),u.translate&&((u.translate!=="none"||u.scale!=="none"||u.rotate!=="none")&&(i[dn]=(u.translate!=="none"?"translate3d("+(u.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(u.rotate!=="none"?"rotate("+u.rotate+") ":"")+(u.scale!=="none"?"scale("+u.scale.split(" ").join(",")+") ":"")+(u[dn]!=="none"?u[dn]:"")),i.scale=i.rotate=i.translate="none"),I=ep(t,n.svg),n.svg&&(n.uncache?(K=t.getBBox(),f=n.xOrigin-K.x+"px "+(n.yOrigin-K.y)+"px",nt=""):nt=!e&&t.getAttribute("data-svg-origin"),Kd(t,nt||f,!!nt||n.originIsAbsolute,n.smooth!==!1,I)),U=n.xOrigin||0,L=n.yOrigin||0,I!==Gl&&(B=I[0],V=I[1],Z=I[2],j=I[3],d=rt=I[4],g=$=I[5],I.length===6?(m=Math.sqrt(B*B+V*V),M=Math.sqrt(j*j+Z*Z),y=B||V?va(V,B)*bo:0,E=Z||j?va(Z,j)*bo+y:0,E&&(M*=Math.abs(Math.cos(E*ya))),n.svg&&(d-=U-(U*B+L*Z),g-=L-(U*V+L*j))):(_t=I[6],fe=I[7],z=I[8],bt=I[9],jt=I[10],ot=I[11],d=I[12],g=I[13],p=I[14],N=va(_t,jt),v=N*bo,N&&(A=Math.cos(-N),w=Math.sin(-N),nt=rt*A+z*w,K=$*A+bt*w,gt=_t*A+jt*w,z=rt*-w+z*A,bt=$*-w+bt*A,jt=_t*-w+jt*A,ot=fe*-w+ot*A,rt=nt,$=K,_t=gt),N=va(-Z,jt),x=N*bo,N&&(A=Math.cos(-N),w=Math.sin(-N),nt=B*A-z*w,K=V*A-bt*w,gt=Z*A-jt*w,ot=j*w+ot*A,B=nt,V=K,Z=gt),N=va(V,B),y=N*bo,N&&(A=Math.cos(N),w=Math.sin(N),nt=B*A+V*w,K=rt*A+$*w,V=V*A-B*w,$=$*A-rt*w,B=nt,rt=K),v&&Math.abs(v)+Math.abs(y)>359.9&&(v=y=0,x=180-x),m=_n(Math.sqrt(B*B+V*V+Z*Z)),M=_n(Math.sqrt($*$+_t*_t)),N=va(rt,$),E=Math.abs(N)>2e-4?N*bo:0,T=ot?1/(ot<0?-ot:ot):0),n.svg&&(nt=t.getAttribute("transform"),n.forceCSS=t.setAttribute("transform","")||!qv(Or(t,dn)),nt&&t.setAttribute("transform",nt))),Math.abs(E)>90&&Math.abs(E)<270&&(o?(m*=-1,E+=y<=0?180:-180,y+=y<=0?180:-180):(M*=-1,E+=E<=0?180:-180)),e=e||n.uncache,n.x=d-((n.xPercent=d&&(!e&&n.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-d)?-50:0)))?t.offsetWidth*n.xPercent/100:0)+l,n.y=g-((n.yPercent=g&&(!e&&n.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-g)?-50:0)))?t.offsetHeight*n.yPercent/100:0)+l,n.z=p+l,n.scaleX=_n(m),n.scaleY=_n(M),n.rotation=_n(y)+c,n.rotationX=_n(v)+c,n.rotationY=_n(x)+c,n.skewX=E+c,n.skewY=b+c,n.transformPerspective=T+l,(n.zOrigin=parseFloat(f.split(" ")[2])||!e&&n.zOrigin||0)&&(i[Ci]=Tu(f)),n.xOffset=n.yOffset=0,n.force3D=Ai.force3D,n.renderTransform=n.svg?QC:Vv?Yv:KC,n.uncache=0,n},Tu=function(t){return(t=t.split(" "))[0]+" "+t[1]},Yd=function(t,e,n){var i=Wn(e);return _n(parseFloat(e)+parseFloat(ks(t,"x",n+"px",i)))+i},KC=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,Yv(t,e)},So="0deg",Vl="0px",wo=") ",Yv=function(t,e){var n=e||this,i=n.xPercent,o=n.yPercent,l=n.x,c=n.y,u=n.z,f=n.rotation,d=n.rotationY,g=n.rotationX,p=n.skewX,m=n.skewY,M=n.scaleX,y=n.scaleY,v=n.transformPerspective,x=n.force3D,E=n.target,b=n.zOrigin,T="",U=x==="auto"&&t&&t!==1||x===!0;if(b&&(g!==So||d!==So)){var L=parseFloat(d)*ya,I=Math.sin(L),N=Math.cos(L),A;L=parseFloat(g)*ya,A=Math.cos(L),l=Yd(E,l,I*A*-b),c=Yd(E,c,-Math.sin(L)*-b),u=Yd(E,u,N*A*-b+b)}v!==Vl&&(T+="perspective("+v+wo),(i||o)&&(T+="translate("+i+"%, "+o+"%) "),(U||l!==Vl||c!==Vl||u!==Vl)&&(T+=u!==Vl||U?"translate3d("+l+", "+c+", "+u+") ":"translate("+l+", "+c+wo),f!==So&&(T+="rotate("+f+wo),d!==So&&(T+="rotateY("+d+wo),g!==So&&(T+="rotateX("+g+wo),(p!==So||m!==So)&&(T+="skew("+p+", "+m+wo),(M!==1||y!==1)&&(T+="scale("+M+", "+y+wo),E.style[dn]=T||"translate(0, 0)"},QC=function(t,e){var n=e||this,i=n.xPercent,o=n.yPercent,l=n.x,c=n.y,u=n.rotation,f=n.skewX,d=n.skewY,g=n.scaleX,p=n.scaleY,m=n.target,M=n.xOrigin,y=n.yOrigin,v=n.xOffset,x=n.yOffset,E=n.forceCSS,b=parseFloat(l),T=parseFloat(c),U,L,I,N,A;u=parseFloat(u),f=parseFloat(f),d=parseFloat(d),d&&(d=parseFloat(d),f+=d,u+=d),u||f?(u*=ya,f*=ya,U=Math.cos(u)*g,L=Math.sin(u)*g,I=Math.sin(u-f)*-p,N=Math.cos(u-f)*p,f&&(d*=ya,A=Math.tan(f-d),A=Math.sqrt(1+A*A),I*=A,N*=A,d&&(A=Math.tan(d),A=Math.sqrt(1+A*A),U*=A,L*=A)),U=_n(U),L=_n(L),I=_n(I),N=_n(N)):(U=g,N=p,L=I=0),(b&&!~(l+"").indexOf("px")||T&&!~(c+"").indexOf("px"))&&(b=ks(m,"x",l,"px"),T=ks(m,"y",c,"px")),(M||y||v||x)&&(b=_n(b+M-(M*U+y*I)+v),T=_n(T+y-(M*L+y*N)+x)),(i||o)&&(A=m.getBBox(),b=_n(b+i/100*A.width),T=_n(T+o/100*A.height)),A="matrix("+U+","+L+","+I+","+N+","+b+","+T+")",m.setAttribute("transform",A),E&&(m.style[dn]=A)},jC=function(t,e,n,i,o){var l=360,c=Pn(o),u=parseFloat(o)*(c&&~o.indexOf("rad")?bo:1),f=u-i,d=i+f+"deg",g,p;return c&&(g=o.split("_")[1],g==="short"&&(f%=l,f!==f%(l/2)&&(f+=f<0?l:-l)),g==="cw"&&f<0?f=(f+l*Iv)%l-~~(f/l)*l:g==="ccw"&&f>0&&(f=(f-l*Iv)%l-~~(f/l)*l)),t._pt=p=new hi(t._pt,e,n,i,f,OC),p.e=d,p.u="deg",t._props.push(n),p},Fv=function(t,e){for(var n in e)t[n]=e[n];return t},tR=function(t,e,n){var i=Fv({},n._gsap),o="perspective,force3D,transformOrigin,svgOrigin",l=n.style,c,u,f,d,g,p,m,M;i.svg?(f=n.getAttribute("transform"),n.setAttribute("transform",""),l[dn]=e,c=Wl(n,1),Eo(n,dn),n.setAttribute("transform",f)):(f=getComputedStyle(n)[dn],l[dn]=e,c=Wl(n,1),l[dn]=f);for(u in es)f=i[u],d=c[u],f!==d&&o.indexOf(u)<0&&(m=Wn(f),M=Wn(d),g=m!==M?ks(n,u,f,M):parseFloat(f),p=parseFloat(d),t._pt=new hi(t._pt,c,u,g,p-g,Zd),t._pt.u=M||0,t._props.push(u));Fv(c,i)};ui("padding,margin,Width,Radius",function(r,t){var e="Top",n="Right",i="Bottom",o="Left",l=(t<3?[e,n,i,o]:[e+o,e+n,i+n,i+o]).map(function(c){return t<2?r+c:"border"+c+r});bu[t>1?"border"+r:r]=function(c,u,f,d,g){var p,m;if(arguments.length<4)return p=l.map(function(M){return ts(c,M,f)}),m=p.join(" "),m.split(p[0]).length===5?p[0]:m;p=(d+"").split(" "),m={},l.forEach(function(M,y){return m[M]=p[y]=p[y]||p[(y-1)/2|0]}),c.init(u,m,g)}});var np={name:"css",register:Jd,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,n,i,o){var l=this._props,c=t.style,u=n.vars.startAt,f,d,g,p,m,M,y,v,x,E,b,T,U,L,I,N;Qd||Jd(),this.styles=this.styles||Hv(t),N=this.styles.props,this.tween=n;for(y in e)if(y!=="autoRound"&&(d=e[y],!(bi[y]&&kd(y,e,n,i,t,o)))){if(m=typeof d,M=bu[y],m==="function"&&(d=d.call(n,i,t,o),m=typeof d),m==="string"&&~d.indexOf("random(")&&(d=_a(d)),M)M(this,t,y,d,n)&&(I=1);else if(y.substr(0,2)==="--")f=(getComputedStyle(t).getPropertyValue(y)+"").trim(),d+="",Qr.lastIndex=0,Qr.test(f)||(v=Wn(f),x=Wn(d)),x?v!==x&&(f=ks(t,y,f,x)+x):v&&(d+=v),this.add(c,"setProperty",f,d,i,o,0,0,y),l.push(y),N.push(y,0,c[y]);else if(m!=="undefined"){if(u&&y in u?(f=typeof u[y]=="function"?u[y].call(n,i,t,o):u[y],Pn(f)&&~f.indexOf("random(")&&(f=_a(f)),Wn(f+"")||f==="auto"||(f+=Ai.units[y]||Wn(ts(t,y))||""),(f+"").charAt(1)==="="&&(f=ts(t,y))):f=ts(t,y),p=parseFloat(f),E=m==="string"&&d.charAt(1)==="="&&d.substr(0,2),E&&(d=d.substr(2)),g=parseFloat(d),y in Nr&&(y==="autoAlpha"&&(p===1&&ts(t,"visibility")==="hidden"&&g&&(p=0),N.push("visibility",0,c.visibility),Bs(this,c,"visibility",p?"inherit":"hidden",g?"inherit":"hidden",!g)),y!=="scale"&&y!=="transform"&&(y=Nr[y],~y.indexOf(",")&&(y=y.split(",")[0]))),b=y in es,b){if(this.styles.save(y),T||(U=t._gsap,U.renderTransform&&!e.parseTransform||Wl(t,e.parseTransform),L=e.smoothOrigin!==!1&&U.smooth,T=this._pt=new hi(this._pt,c,dn,0,1,U.renderTransform,U,0,-1),T.dep=1),y==="scale")this._pt=new hi(this._pt,U,"scaleY",U.scaleY,(E?yo(U.scaleY,E+g):g)-U.scaleY||0,Zd),this._pt.u=0,l.push("scaleY",y),y+="X";else if(y==="transformOrigin"){N.push(Ci,0,c[Ci]),d=$C(d),U.svg?Kd(t,d,0,L,0,this):(x=parseFloat(d.split(" ")[2])||0,x!==U.zOrigin&&Bs(this,U,"zOrigin",U.zOrigin,x),Bs(this,c,y,Tu(f),Tu(d)));continue}else if(y==="svgOrigin"){Kd(t,d,1,L,0,this);continue}else if(y in Xv){jC(this,U,y,p,E?yo(p,E+d):d);continue}else if(y==="smoothOrigin"){Bs(this,U,"smooth",U.smooth,d);continue}else if(y==="force3D"){U[y]=d;continue}else if(y==="transform"){tR(this,d,t);continue}}else y in c||(y=Ma(y)||y);if(b||(g||g===0)&&(p||p===0)&&!NC.test(d)&&y in c)v=(f+"").substr((p+"").length),g||(g=0),x=Wn(d)||(y in Ai.units?Ai.units[y]:v),v!==x&&(p=ks(t,y,f,x)),this._pt=new hi(this._pt,b?U:c,y,p,(E?yo(p,E+g):g)-p,!b&&(x==="px"||y==="zIndex")&&e.autoRound!==!1?zC:Zd),this._pt.u=x||0,v!==x&&x!=="%"&&(this._pt.b=f,this._pt.r=FC);else if(y in c)ZC.call(this,t,y,f,E?E+d:d);else if(y in t)this.add(t,y,f||t[y],E?E+d:d,i,o);else if(y!=="parseTransform"){xu(y,d);continue}b||(y in c?N.push(y,0,c[y]):N.push(y,1,f||t[y])),l.push(y)}}I&&Xd(this)},render:function(t,e){if(e.tween._time||!jd())for(var n=e._pt;n;)n.r(t,n.d),n=n._next;else e.styles.revert()},get:ts,aliases:Nr,getSetter:function(t,e,n){var i=Nr[e];return i&&i.indexOf(",")<0&&(e=i),e in es&&e!==Ci&&(t._gsap.x||ts(t,"x"))?n&&Pv===n?e==="scale"?VC:HC:(Pv=n||{})&&(e==="scale"?GC:WC):t.style&&!vu(t.style[e])?BC:~e.indexOf("-")?kC:wu(t,e)},core:{_removeProperty:Eo,_getMatrix:ep}};Qn.utils.checkPrefix=Ma;Qn.core.getStyleSaver=Hv;(function(r,t,e,n){var i=ui(r+","+t+","+e,function(o){es[o]=1});ui(t,function(o){Ai.units[o]="deg",Xv[o]=1}),Nr[i[13]]=r+","+t,ui(n,function(o){var l=o.split(":");Nr[l[1]]=i[l[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");ui("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(r){Ai.units[r]="px"});Qn.registerPlugin(np);var Xl=Qn.registerPlugin(np)||Qn,D3=Xl.core.Tween;function Zv(r,t){for(var e=0;eu?(o=i,i=M,c=l,l=v):n?i+=M:i=o+(M-o)/(v-c)*(l-c)},g=function(){o=i=n?0:i,c=l=0},p=function(M){var y=c,v=o,x=Zl();return(M||M===0)&&M!==i&&d(M),l===c||x-c>f?0:(i+(n?v:-v))/((n?x:l)-y)*1e3};return{update:d,reset:g,getVelocity:p}},ql=function(t,e){return e&&!t._gsapAllow&&t.preventDefault(),t.changedTouches?t.changedTouches[0]:t},$v=function(t){var e=Math.max.apply(Math,t),n=Math.min.apply(Math,t);return Math.abs(e)>=Math.abs(n)?e:n},ex=function(){Yl=Xn.core.globals().ScrollTrigger,Yl&&Yl.core&&iR()},nx=function(t){return Xn=t||jv(),!Cu&&Xn&&typeof document<"u"&&document.body&&(Gi=window,Hs=document,Vs=Hs.documentElement,wa=Hs.body,Kv=[Gi,Hs,Vs,wa],nR=Xn.utils.clamp,Qv=Xn.core.context||function(){},Ao="onpointerenter"in wa?"pointer":"mouse",Jv=vn.isTouch=Gi.matchMedia&&Gi.matchMedia("(hover: none), (pointer: coarse)").matches?1:"ontouchstart"in Gi||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0?2:0,vr=vn.eventTypes=("ontouchstart"in Vs?"touchstart,touchmove,touchcancel,touchend":"onpointerdown"in Vs?"pointerdown,pointermove,pointercancel,pointerup":"mousedown,mousemove,mouseup,mouseup").split(","),setTimeout(function(){return tx=0},500),ex(),Cu=1),Cu};jn.op=Tn;Te.cache=0;var vn=function(){function r(e){this.init(e)}var t=r.prototype;return t.init=function(n){Cu||nx(Xn)||console.warn("Please gsap.registerPlugin(Observer)"),Yl||ex();var i=n.tolerance,o=n.dragMinimum,l=n.type,c=n.target,u=n.lineHeight,f=n.debounce,d=n.preventDefault,g=n.onStop,p=n.onStopDelay,m=n.ignore,M=n.wheelSpeed,y=n.event,v=n.onDragStart,x=n.onDragEnd,E=n.onDrag,b=n.onPress,T=n.onRelease,U=n.onRight,L=n.onLeft,I=n.onUp,N=n.onDown,A=n.onChangeX,w=n.onChangeY,B=n.onChange,V=n.onToggleX,Z=n.onToggleY,j=n.onHover,rt=n.onHoverEnd,$=n.onMove,nt=n.ignoreCheck,K=n.isNormalizer,gt=n.onGestureStart,z=n.onGestureEnd,bt=n.onWheel,jt=n.onEnable,fe=n.onDisable,ot=n.onClick,_t=n.scrollSpeed,Et=n.capture,wt=n.allowClicks,kt=n.lockAxis,Ht=n.onLockAxis;this.target=c=pi(c)||Vs,this.vars=n,m&&(m=Xn.utils.toArray(m)),i=i||1e-9,o=o||0,M=M||1,_t=_t||1,l=l||"wheel,touch,pointer",f=f!==!1,u||(u=parseFloat(Gi.getComputedStyle(wa).lineHeight)||22);var ae,_e,k,Jt,re,se,Ut,et=this,Vt=0,Gt=0,O=n.passive||!d,C=is(c,jn),it=is(c,Tn),ft=C(),mt=it(),at=~l.indexOf("touch")&&!~l.indexOf("pointer")&&vr[0]==="pointerdown",zt=$l(c),yt=c.ownerDocument||Hs,Ct=[0,0,0],Qt=[0,0,0],Mt=0,It=function(){return Mt=Zl()},Kt=function(Wt,Ie){return(et.event=Wt)&&m&&~m.indexOf(Wt.target)||Ie&&at&&Wt.pointerType!=="touch"||nt&&nt(Wt,Ie)},ee=function(){et._vx.reset(),et._vy.reset(),_e.pause(),g&&g(et)},Pt=function(){var Wt=et.deltaX=$v(Ct),Ie=et.deltaY=$v(Qt),Tt=Math.abs(Wt)>=i,ue=Math.abs(Ie)>=i;B&&(Tt||ue)&&B(et,Wt,Ie,Ct,Qt),Tt&&(U&&et.deltaX>0&&U(et),L&&et.deltaX<0&&L(et),A&&A(et),V&&et.deltaX<0!=Vt<0&&V(et),Vt=et.deltaX,Ct[0]=Ct[1]=Ct[2]=0),ue&&(N&&et.deltaY>0&&N(et),I&&et.deltaY<0&&I(et),w&&w(et),Z&&et.deltaY<0!=Gt<0&&Z(et),Gt=et.deltaY,Qt[0]=Qt[1]=Qt[2]=0),(Jt||k)&&($&&$(et),k&&(E(et),k=!1),Jt=!1),se&&!(se=!1)&&Ht&&Ht(et),re&&(bt(et),re=!1),ae=0},ne=function(Wt,Ie,Tt){Ct[Tt]+=Wt,Qt[Tt]+=Ie,et._vx.update(Wt),et._vy.update(Ie),f?ae||(ae=requestAnimationFrame(Pt)):Pt()},de=function(Wt,Ie){kt&&!Ut&&(et.axis=Ut=Math.abs(Wt)>Math.abs(Ie)?"x":"y",se=!0),Ut!=="y"&&(Ct[2]+=Wt,et._vx.update(Wt,!0)),Ut!=="x"&&(Qt[2]+=Ie,et._vy.update(Ie,!0)),f?ae||(ae=requestAnimationFrame(Pt)):Pt()},ze=function(Wt){if(!Kt(Wt,1)){Wt=ql(Wt,d);var Ie=Wt.clientX,Tt=Wt.clientY,ue=Ie-et.x,te=Tt-et.y,he=et.isDragging;et.x=Ie,et.y=Tt,(he||Math.abs(et.startX-Ie)>=o||Math.abs(et.startY-Tt)>=o)&&(E&&(k=!0),he||(et.isDragging=!0),de(ue,te),he||v&&v(et))}},X=et.onPress=function(ie){Kt(ie,1)||ie&&ie.button||(et.axis=Ut=null,_e.pause(),et.isPressed=!0,ie=ql(ie),Vt=Gt=0,et.startX=et.x=ie.clientX,et.startY=et.y=ie.clientY,et._vx.reset(),et._vy.reset(),di(K?c:yt,vr[1],ze,O,!0),et.deltaX=et.deltaY=0,b&&b(et))},lt=et.onRelease=function(ie){if(!Kt(ie,1)){fi(K?c:yt,vr[1],ze,!0);var Wt=!isNaN(et.y-et.startY),Ie=et.isDragging,Tt=Ie&&(Math.abs(et.x-et.startX)>3||Math.abs(et.y-et.startY)>3),ue=ql(ie);!Tt&&Wt&&(et._vx.reset(),et._vy.reset(),d&&wt&&Xn.delayedCall(.08,function(){if(Zl()-Mt>300&&!ie.defaultPrevented){if(ie.target.click)ie.target.click();else if(yt.createEvent){var te=yt.createEvent("MouseEvents");te.initMouseEvent("click",!0,!0,Gi,1,ue.screenX,ue.screenY,ue.clientX,ue.clientY,!1,!1,!1,!1,0,null),ie.target.dispatchEvent(te)}}})),et.isDragging=et.isGesturing=et.isPressed=!1,g&&Ie&&!K&&_e.restart(!0),x&&Ie&&x(et),T&&T(et,Tt)}},ut=function(Wt){return Wt.touches&&Wt.touches.length>1&&(et.isGesturing=!0)&>(Wt,et.isDragging)},ht=function(){return(et.isGesturing=!1)||z(et)},St=function(Wt){if(!Kt(Wt)){var Ie=C(),Tt=it();ne((Ie-ft)*_t,(Tt-mt)*_t,1),ft=Ie,mt=Tt,g&&_e.restart(!0)}},Yt=function(Wt){if(!Kt(Wt)){Wt=ql(Wt,d),bt&&(re=!0);var Ie=(Wt.deltaMode===1?u:Wt.deltaMode===2?Gi.innerHeight:1)*M;ne(Wt.deltaX*Ie,Wt.deltaY*Ie,0),g&&!K&&_e.restart(!0)}},me=function(Wt){if(!Kt(Wt)){var Ie=Wt.clientX,Tt=Wt.clientY,ue=Ie-et.x,te=Tt-et.y;et.x=Ie,et.y=Tt,Jt=!0,g&&_e.restart(!0),(ue||te)&&de(ue,te)}},Ge=function(Wt){et.event=Wt,j(et)},Ye=function(Wt){et.event=Wt,rt(et)},be=function(Wt){return Kt(Wt)||ql(Wt,d)&&ot(et)};_e=et._dc=Xn.delayedCall(p||.25,ee).pause(),et.deltaX=et.deltaY=0,et._vx=Pu(0,50,!0),et._vy=Pu(0,50,!0),et.scrollX=C,et.scrollY=it,et.isDragging=et.isGesturing=et.isPressed=!1,Qv(this),et.enable=function(ie){return et.isEnabled||(di(zt?yt:c,"scroll",rp),l.indexOf("scroll")>=0&&di(zt?yt:c,"scroll",St,O,Et),l.indexOf("wheel")>=0&&di(c,"wheel",Yt,O,Et),(l.indexOf("touch")>=0&&Jv||l.indexOf("pointer")>=0)&&(di(c,vr[0],X,O,Et),di(yt,vr[2],lt),di(yt,vr[3],lt),wt&&di(c,"click",It,!0,!0),ot&&di(c,"click",be),gt&&di(yt,"gesturestart",ut),z&&di(yt,"gestureend",ht),j&&di(c,Ao+"enter",Ge),rt&&di(c,Ao+"leave",Ye),$&&di(c,Ao+"move",me)),et.isEnabled=!0,ie&&ie.type&&X(ie),jt&&jt(et)),et},et.disable=function(){et.isEnabled&&(Sa.filter(function(ie){return ie!==et&&$l(ie.target)}).length||fi(zt?yt:c,"scroll",rp),et.isPressed&&(et._vx.reset(),et._vy.reset(),fi(K?c:yt,vr[1],ze,!0)),fi(zt?yt:c,"scroll",St,Et),fi(c,"wheel",Yt,Et),fi(c,vr[0],X,Et),fi(yt,vr[2],lt),fi(yt,vr[3],lt),fi(c,"click",It,!0),fi(c,"click",be),fi(yt,"gesturestart",ut),fi(yt,"gestureend",ht),fi(c,Ao+"enter",Ge),fi(c,Ao+"leave",Ye),fi(c,Ao+"move",me),et.isEnabled=et.isPressed=et.isDragging=!1,fe&&fe(et))},et.kill=et.revert=function(){et.disable();var ie=Sa.indexOf(et);ie>=0&&Sa.splice(ie,1),ns===et&&(ns=0)},Sa.push(et),K&&$l(c)&&(ns=et),et.enable(y)},eR(r,[{key:"velocityX",get:function(){return this._vx.getVelocity()}},{key:"velocityY",get:function(){return this._vy.getVelocity()}}]),r}();vn.version="3.12.5";vn.create=function(r){return new vn(r)};vn.register=nx;vn.getAll=function(){return Sa.slice()};vn.getById=function(r){return Sa.filter(function(t){return t.vars.id===r})[0]};jv()&&Xn.registerPlugin(vn);var Bt,Ea,Fe,pn,yr,sn,yx,qu,lc,nc,Kl,Iu,ti,Ju,fp,gi,ix,rx,Aa,Mx,sp,Sx,mi,dp,wx,bx,Gs,pp,xp,Ca,yp,Yu,mp,op,Lu=1,ei=Date.now,ap=ei(),cr=0,Ql=0,sx=function(t,e,n){var i=Xi(t)&&(t.substr(0,6)==="clamp("||t.indexOf("max")>-1);return n["_"+e+"Clamp"]=i,i?t.substr(6,t.length-7):t},ox=function(t,e){return e&&(!Xi(t)||t.substr(0,6)!=="clamp(")?"clamp("+t+")":t},rR=function r(){return Ql&&requestAnimationFrame(r)},ax=function(){return Ju=1},lx=function(){return Ju=0},Fr=function(t){return t},jl=function(t){return Math.round(t*1e5)/1e5||0},Tx=function(){return typeof window<"u"},Ex=function(){return Bt||Tx()&&(Bt=window.gsap)&&Bt.registerPlugin&&Bt},Do=function(t){return!!~yx.indexOf(t)},Ax=function(t){return(t==="Height"?yp:Fe["inner"+t])||yr["client"+t]||sn["client"+t]},Cx=function(t){return rs(t,"getBoundingClientRect")||(Do(t)?function(){return Xu.width=Fe.innerWidth,Xu.height=yp,Xu}:function(){return ss(t)})},sR=function(t,e,n){var i=n.d,o=n.d2,l=n.a;return(l=rs(t,"getBoundingClientRect"))?function(){return l()[i]}:function(){return(e?Ax(o):t["client"+o])||0}},oR=function(t,e){return!e||~xr.indexOf(t)?Cx(t):function(){return Xu}},zr=function(t,e){var n=e.s,i=e.d2,o=e.d,l=e.a;return Math.max(0,(n="scroll"+i)&&(l=rs(t,n))?l()-Cx(t)()[o]:Do(t)?(yr[n]||sn[n])-Ax(i):t[n]-t["offset"+i])},Du=function(t,e){for(var n=0;n0){for(i-=l,c=0;c=i)return n[c];return n[c-1]}else for(c=n.length,i+=l;c--;)if(n[c]<=i)return n[c];return n[0]}:function(i,o,l){l===void 0&&(l=.001);var c=e(i);return!o||Math.abs(c-i)n&&(i*=e/100),t=t.substr(0,n-1)),t=i+(t in $u?$u[t]*e:~t.indexOf("%")?parseFloat(t)*e/100:parseFloat(t)||0)}return t},Fu=function(t,e,n,i,o,l,c,u){var f=o.startColor,d=o.endColor,g=o.fontSize,p=o.indent,m=o.fontWeight,M=pn.createElement("div"),y=Do(n)||rs(n,"pinType")==="fixed",v=t.indexOf("scroller")!==-1,x=y?sn:n,E=t.indexOf("start")!==-1,b=E?f:d,T="border-color:"+b+";font-size:"+g+";color:"+b+";font-weight:"+m+";pointer-events:none;white-space:nowrap;font-family:sans-serif,Arial;z-index:1000;padding:4px 8px;border-width:0;border-style:solid;";return T+="position:"+((v||u)&&y?"fixed;":"absolute;"),(v||u||!y)&&(T+=(i===Tn?Mp:Sp)+":"+(l+parseFloat(p))+"px;"),c&&(T+="box-sizing:border-box;text-align:left;width:"+c.offsetWidth+"px;"),M._isStart=E,M.setAttribute("class","gsap-marker-"+t+(e?" marker-"+e:"")),M.style.cssText=T,M.innerText=e||e===0?t+"-"+e:t,x.children[0]?x.insertBefore(M,x.children[0]):x.appendChild(M),M._offset=M["offset"+i.op.d2],Vu(M,0,i,E),M},Vu=function(t,e,n,i){var o={display:"block"},l=n[i?"os2":"p2"],c=n[i?"p2":"os2"];t._isFlipped=i,o[n.a+"Percent"]=i?-100:0,o[n.a]=i?"1px":0,o["border"+l+Pa]=1,o["border"+c+Pa]=0,o[n.p]=e+"px",Bt.set(t,o)},Ee=[],gp={},cc,hx=function(){return ei()-cr>34&&(cc||(cc=requestAnimationFrame(os)))},Ta=function(){(!mi||!mi.isPressed||mi.startX>sn.clientWidth)&&(Te.cache++,mi?cc||(cc=requestAnimationFrame(os)):os(),cr||No("scrollStart"),cr=ei())},cp=function(){bx=Fe.innerWidth,wx=Fe.innerHeight},ec=function(){Te.cache++,!ti&&!Sx&&!pn.fullscreenElement&&!pn.webkitFullscreenElement&&(!dp||bx!==Fe.innerWidth||Math.abs(Fe.innerHeight-wx)>Fe.innerHeight*.25)&&qu.restart(!0)},Uo={},uR=[],Lx=function r(){return zn(Ae,"scrollEnd",r)||Ro(!0)},No=function(t){return Uo[t]&&Uo[t].map(function(e){return e()})||uR},Wi=[],Dx=function(t){for(var e=0;eo,c=i._startClamp&&i.start>=o;(l||c)&&i.setPositions(c?o-1:i.start,l?Math.max(c?o:i.start+1,o):i.end,!0)}),dx(!1),mp=0,n.forEach(function(i){return i&&i.render&&i.render(-1)}),Te.forEach(function(i){vi(i)&&(i.smooth&&requestAnimationFrame(function(){return i.target.style.scrollBehavior="smooth"}),i.rec&&i(i.rec))}),Ux(xp,1),qu.pause(),Lo++,_i=2,os(2),Ee.forEach(function(i){return vi(i.vars.onRefresh)&&i.vars.onRefresh(i)}),_i=Ae.isRefreshing=!1,No("refresh")},_p=0,Gu=1,ac,os=function(t){if(t===2||!_i&&!Yu){Ae.isUpdating=!0,ac&&ac.update(0);var e=Ee.length,n=ei(),i=n-ap>=50,o=e&&Ee[0].scroll();if(Gu=_p>o?-1:1,_i||(_p=o),i&&(cr&&!Ju&&n-cr>200&&(cr=0,No("scrollEnd")),Kl=ap,ap=n),Gu<0){for(gi=e;gi-- >0;)Ee[gi]&&Ee[gi].update(0,i);Gu=1}else for(gi=0;gi20),n-=n-L}if(M&&(u[M]=t||-.001,t<0&&(t=0)),l){var N=t+n,A=l._isStart;v="scroll"+i.d2,Vu(l,N,i,A&&N>20||!A&&(g?Math.max(sn[v],yr[v]):l.parentNode[v])<=N+1),g&&(f=ss(c),g&&(l.style[i.op.p]=f[i.op.p]-i.op.m-l._offset+In))}return m&&E&&(v=ss(E),m.seek(p),x=ss(E),m._caScrollDist=v[i.p]-x[i.p],t=t/m._caScrollDist*p),m&&m.seek(y),m?t:Math.round(t)},mR=/(webkit|moz|length|cssText|inset)/i,mx=function(t,e,n,i){if(t.parentNode!==e){var o=t.style,l,c;if(e===sn){t._stOrig=o.cssText,c=lr(t);for(l in c)!+l&&!mR.test(l)&&c[l]&&typeof o[l]=="string"&&l!=="0"&&(o[l]=c[l]);o.top=n,o.left=i}else o.cssText=t._stOrig;Bt.core.getCache(t).uncache=1,e.appendChild(t)}},Ox=function(t,e,n){var i=e,o=i;return function(l){var c=Math.round(t());return c!==i&&c!==o&&Math.abs(c-i)>3&&Math.abs(c-o)>3&&(l=c,n&&n()),o=i,i=l,l}},Bu=function(t,e,n){var i={};i[e.p]="+="+n,Bt.set(t,i)},gx=function(t,e){var n=is(t,e),i="_scroll"+e.p2,o=function l(c,u,f,d,g){var p=l.tween,m=u.onComplete,M={};f=f||n();var y=Ox(n,f,function(){p.kill(),l.tween=0});return g=d&&g||0,d=d||c-f,p&&p.kill(),u[i]=c,u.inherit=!1,u.modifiers=M,M[i]=function(){return y(f+d*p.ratio+g*p.ratio*p.ratio)},u.onUpdate=function(){Te.cache++,l.tween&&os()},u.onComplete=function(){l.tween=0,m&&m.call(p)},p=l.tween=Bt.to(t,u),p};return t[i]=n,n.wheelHandler=function(){return o.tween&&o.tween.kill()&&(o.tween=0)},Bn(t,"wheel",n.wheelHandler),Ae.isTouch&&Bn(t,"touchmove",n.wheelHandler),o},Ae=function(){function r(e,n){Ea||r.register(Bt)||console.warn("Please gsap.registerPlugin(ScrollTrigger)"),pp(this),this.init(e,n)}var t=r.prototype;return t.init=function(n,i){if(this.progress=this.start=0,this.vars&&this.kill(!0,!0),!Ql){this.update=this.refresh=this.kill=Fr;return}n=cx(Xi(n)||tc(n)||n.nodeType?{trigger:n}:n,Ou);var o=n,l=o.onUpdate,c=o.toggleClass,u=o.id,f=o.onToggle,d=o.onRefresh,g=o.scrub,p=o.trigger,m=o.pin,M=o.pinSpacing,y=o.invalidateOnRefresh,v=o.anticipatePin,x=o.onScrubComplete,E=o.onSnapComplete,b=o.once,T=o.snap,U=o.pinReparent,L=o.pinSpacer,I=o.containerAnimation,N=o.fastScrollEnd,A=o.preventOverlaps,w=n.horizontal||n.containerAnimation&&n.horizontal!==!1?jn:Tn,B=!g&&g!==0,V=pi(n.scroller||Fe),Z=Bt.core.getCache(V),j=Do(V),rt=("pinType"in n?n.pinType:rs(V,"pinType")||j&&"fixed")==="fixed",$=[n.onEnter,n.onLeave,n.onEnterBack,n.onLeaveBack],nt=B&&n.toggleActions.split(" "),K="markers"in n?n.markers:Ou.markers,gt=j?0:parseFloat(lr(V)["border"+w.p2+Pa])||0,z=this,bt=n.onRefreshInit&&function(){return n.onRefreshInit(z)},jt=sR(V,j,w),fe=oR(V,j),ot=0,_t=0,Et=0,wt=is(V,w),kt,Ht,ae,_e,k,Jt,re,se,Ut,et,Vt,Gt,O,C,it,ft,mt,at,zt,yt,Ct,Qt,Mt,It,Kt,ee,Pt,ne,de,ze,X,lt,ut,ht,St,Yt,me,Ge,Ye;if(z._startClamp=z._endClamp=!1,z._dir=w,v*=45,z.scroller=V,z.scroll=I?I.time.bind(I):wt,_e=wt(),z.vars=n,i=i||n.animation,"refreshPriority"in n&&(Mx=1,n.refreshPriority===-9999&&(ac=z)),Z.tweenScroll=Z.tweenScroll||{top:gx(V,Tn),left:gx(V,jn)},z.tweenTo=kt=Z.tweenScroll[w.p],z.scrubDuration=function(Tt){ut=tc(Tt)&&Tt,ut?lt?lt.duration(Tt):lt=Bt.to(i,{ease:"expo",totalProgress:"+=0",inherit:!1,duration:ut,paused:!0,onComplete:function(){return x&&x(z)}}):(lt&<.progress(1).kill(),lt=0)},i&&(i.vars.lazy=!1,i._initted&&!z.isReverted||i.vars.immediateRender!==!1&&n.immediateRender!==!1&&i.duration()&&i.render(0,!0,!0),z.animation=i.pause(),i.scrollTrigger=z,z.scrubDuration(g),ze=0,u||(u=i.vars.id)),T&&((!Co(T)||T.push)&&(T={snapTo:T}),"scrollBehavior"in sn.style&&Bt.set(j?[sn,yr]:V,{scrollBehavior:"auto"}),Te.forEach(function(Tt){return vi(Tt)&&Tt.target===(j?pn.scrollingElement||yr:V)&&(Tt.smooth=!1)}),ae=vi(T.snapTo)?T.snapTo:T.snapTo==="labels"?lR(i):T.snapTo==="labelsDirectional"?cR(i):T.directional!==!1?function(Tt,ue){return bp(T.snapTo)(Tt,ei()-_t<500?0:ue.direction)}:Bt.utils.snap(T.snapTo),ht=T.duration||{min:.1,max:2},ht=Co(ht)?nc(ht.min,ht.max):nc(ht,ht),St=Bt.delayedCall(T.delay||ut/2||.1,function(){var Tt=wt(),ue=ei()-_t<500,te=kt.tween;if((ue||Math.abs(z.getVelocity())<10)&&!te&&!Ju&&ot!==Tt){var he=(Tt-Jt)/C,nn=i&&!B?i.totalProgress():he,xe=ue?0:(nn-X)/(ei()-Kl)*1e3||0,Je=Bt.utils.clamp(-he,1-he,ba(xe/2)*xe/.185),xn=he+(T.inertia===!1?0:Je),Ke,Ze,He=T,ri=He.onStart,P=He.onInterrupt,G=He.onComplete;if(Ke=ae(xn,z),tc(Ke)||(Ke=xn),Ze=Math.round(Jt+Ke*C),Tt<=re&&Tt>=Jt&&Ze!==Tt){if(te&&!te._initted&&te.data<=ba(Ze-Tt))return;T.inertia===!1&&(Je=Ke-he),kt(Ze,{duration:ht(ba(Math.max(ba(xn-nn),ba(Ke-nn))*.185/xe/.05||0)),ease:T.ease||"power3",data:ba(Ze-Tt),onInterrupt:function(){return St.restart(!0)&&P&&P(z)},onComplete:function(){z.update(),ot=wt(),i&&(lt?lt.resetTo("totalProgress",Ke,i._tTime/i._tDur):i.progress(Ke)),ze=X=i&&!B?i.totalProgress():z.progress,E&&E(z),G&&G(z)}},Tt,Je*C,Ze-Tt-Je*C),ri&&ri(z,kt.tween)}}else z.isActive&&ot!==Tt&&St.restart(!0)}).pause()),u&&(gp[u]=z),p=z.trigger=pi(p||m!==!0&&m),Ye=p&&p._gsap&&p._gsap.stRevert,Ye&&(Ye=Ye(z)),m=m===!0?p:pi(m),Xi(c)&&(c={targets:p,className:c}),m&&(M===!1||M===ar||(M=!M&&m.parentNode&&m.parentNode.style&&lr(m.parentNode).display==="flex"?!1:En),z.pin=m,Ht=Bt.core.getCache(m),Ht.spacer?it=Ht.pinState:(L&&(L=pi(L),L&&!L.nodeType&&(L=L.current||L.nativeElement),Ht.spacerIsNative=!!L,L&&(Ht.spacerState=zu(L))),Ht.spacer=at=L||pn.createElement("div"),at.classList.add("pin-spacer"),u&&at.classList.add("pin-spacer-"+u),Ht.pinState=it=zu(m)),n.force3D!==!1&&Bt.set(m,{force3D:!0}),z.spacer=at=Ht.spacer,de=lr(m),It=de[M+w.os2],yt=Bt.getProperty(m),Ct=Bt.quickSetter(m,w.a,In),up(m,at,de),mt=zu(m)),K){Gt=Co(K)?cx(K,ux):ux,et=Fu("scroller-start",u,V,w,Gt,0),Vt=Fu("scroller-end",u,V,w,Gt,0,et),zt=et["offset"+w.op.d2];var be=pi(rs(V,"content")||V);se=this.markerStart=Fu("start",u,be,w,Gt,zt,0,I),Ut=this.markerEnd=Fu("end",u,be,w,Gt,zt,0,I),I&&(Ge=Bt.quickSetter([se,Ut],w.a,In)),!rt&&!(xr.length&&rs(V,"fixedMarkers")===!0)&&(aR(j?sn:V),Bt.set([et,Vt],{force3D:!0}),ee=Bt.quickSetter(et,w.a,In),ne=Bt.quickSetter(Vt,w.a,In))}if(I){var ie=I.vars.onUpdate,Wt=I.vars.onUpdateParams;I.eventCallback("onUpdate",function(){z.update(0,0,1),ie&&ie.apply(I,Wt||[])})}if(z.previous=function(){return Ee[Ee.indexOf(z)-1]},z.next=function(){return Ee[Ee.indexOf(z)+1]},z.revert=function(Tt,ue){if(!ue)return z.kill(!0);var te=Tt!==!1||!z.enabled,he=ti;te!==z.isReverted&&(te&&(Yt=Math.max(wt(),z.scroll.rec||0),Et=z.progress,me=i&&i.progress()),se&&[se,Ut,et,Vt].forEach(function(nn){return nn.style.display=te?"none":"block"}),te&&(ti=z,z.update(te)),m&&(!U||!z.isActive)&&(te?fR(m,at,it):up(m,at,lr(m),Kt)),te||z.update(te),ti=he,z.isReverted=te)},z.refresh=function(Tt,ue,te,he){if(!((ti||!z.enabled)&&!ue)){if(m&&Tt&&cr){Bn(r,"scrollEnd",Lx);return}!_i&&bt&&bt(z),ti=z,kt.tween&&!te&&(kt.tween.kill(),kt.tween=0),lt&<.pause(),y&&i&&i.revert({kill:!1}).invalidate(),z.isReverted||z.revert(!0,!0),z._subPinOffset=!1;var nn=jt(),xe=fe(),Je=I?I.duration():zr(V,w),xn=C<=.01,Ke=0,Ze=he||0,He=Co(te)?te.end:n.end,ri=n.endTrigger||p,P=Co(te)?te.start:n.start||(n.start===0||!p?0:m?"0 0":"0 100%"),G=z.pinnedContainer=n.pinnedContainer&&pi(n.pinnedContainer,z),Q=p&&Math.max(0,Ee.indexOf(z))||0,J=Q,W,vt,At,Ot,Rt,Nt,Zt,qt,Le,We,Ue,yn,Ce;for(K&&Co(te)&&(yn=Bt.getProperty(et,w.p),Ce=Bt.getProperty(Vt,w.p));J--;)Nt=Ee[J],Nt.end||Nt.refresh(0,1)||(ti=z),Zt=Nt.pin,Zt&&(Zt===p||Zt===m||Zt===G)&&!Nt.isReverted&&(We||(We=[]),We.unshift(Nt),Nt.revert(!0,!0)),Nt!==Ee[J]&&(Q--,J--);for(vi(P)&&(P=P(z)),P=sx(P,"start",z),Jt=px(P,p,nn,w,wt(),se,et,z,xe,gt,rt,Je,I,z._startClamp&&"_startClamp")||(m?-.001:0),vi(He)&&(He=He(z)),Xi(He)&&!He.indexOf("+=")&&(~He.indexOf(" ")?He=(Xi(P)?P.split(" ")[0]:"")+He:(Ke=Hu(He.substr(2),nn),He=Xi(P)?P:(I?Bt.utils.mapRange(0,I.duration(),I.scrollTrigger.start,I.scrollTrigger.end,Jt):Jt)+Ke,ri=p)),He=sx(He,"end",z),re=Math.max(Jt,px(He||(ri?"100% 0":Je),ri,nn,w,wt()+Ke,Ut,Vt,z,xe,gt,rt,Je,I,z._endClamp&&"_endClamp"))||-.001,Ke=0,J=Q;J--;)Nt=Ee[J],Zt=Nt.pin,Zt&&Nt.start-Nt._pinPush<=Jt&&!I&&Nt.end>0&&(W=Nt.end-(z._startClamp?Math.max(0,Nt.start):Nt.start),(Zt===p&&Nt.start-Nt._pinPush=zr(V,w)))W=lr(m),Ot=w===Tn,At=wt(),Qt=parseFloat(yt(w.a))+Ze,!Je&&re>1&&(Ue=(j?pn.scrollingElement||yr:V).style,Ue={style:Ue,value:Ue["overflow"+w.a.toUpperCase()]},j&&lr(sn)["overflow"+w.a.toUpperCase()]!=="scroll"&&(Ue.style["overflow"+w.a.toUpperCase()]="scroll")),up(m,at,W),mt=zu(m),vt=ss(m,!0),qt=rt&&is(V,Ot?jn:Tn)(),M?(Kt=[M+w.os2,C+Ze+In],Kt.t=at,J=M===En?Zu(m,w)+C+Ze:0,J&&(Kt.push(w.d,J+In),at.style.flexBasis!=="auto"&&(at.style.flexBasis=J+In)),Ra(Kt),G&&Ee.forEach(function(Xt){Xt.pin===G&&Xt.vars.pinSpacing!==!1&&(Xt._subPinOffset=!0)}),rt&&wt(Yt)):(J=Zu(m,w),J&&at.style.flexBasis!=="auto"&&(at.style.flexBasis=J+In)),rt&&(Rt={top:vt.top+(Ot?At-Jt:qt)+In,left:vt.left+(Ot?qt:At-Jt)+In,boxSizing:"border-box",position:"fixed"},Rt[Po]=Rt["max"+Pa]=Math.ceil(vt.width)+In,Rt[Io]=Rt["max"+wp]=Math.ceil(vt.height)+In,Rt[ar]=Rt[ar+sc]=Rt[ar+ic]=Rt[ar+oc]=Rt[ar+rc]="0",Rt[En]=W[En],Rt[En+sc]=W[En+sc],Rt[En+ic]=W[En+ic],Rt[En+oc]=W[En+oc],Rt[En+rc]=W[En+rc],ft=pR(it,Rt,U),_i&&wt(0)),i?(Le=i._initted,sp(1),i.render(i.duration(),!0,!0),Mt=yt(w.a)-Qt+C+Ze,Pt=Math.abs(C-Mt)>1,rt&&Pt&&ft.splice(ft.length-2,2),i.render(0,!0,!0),Le||i.invalidate(!0),i.parent||i.totalTime(i.totalTime()),sp(0)):Mt=C,Ue&&(Ue.value?Ue.style["overflow"+w.a.toUpperCase()]=Ue.value:Ue.style.removeProperty("overflow-"+w.a));else if(p&&wt()&&!I)for(vt=p.parentNode;vt&&vt!==sn;)vt._pinOffset&&(Jt-=vt._pinOffset,re-=vt._pinOffset),vt=vt.parentNode;We&&We.forEach(function(Xt){return Xt.revert(!1,!0)}),z.start=Jt,z.end=re,_e=k=_i?Yt:wt(),!I&&!_i&&(_e0?Ee.slice(0,ue).reverse():Ee.slice(ue+1);return(Xi(Tt)?te.filter(function(he){return he.vars.preventOverlaps===Tt}):te).filter(function(he){return z.direction>0?he.end<=Jt:he.start>=re})},z.update=function(Tt,ue,te){if(!(I&&!te&&!Tt)){var he=_i===!0?Yt:z.scroll(),nn=Tt?0:(he-Jt)/C,xe=nn<0?0:nn>1?1:nn||0,Je=z.progress,xn,Ke,Ze,He,ri,P,G,Q;if(ue&&(k=_e,_e=I?wt():he,T&&(X=ze,ze=i&&!B?i.totalProgress():xe)),v&&m&&!ti&&!Lu&&cr&&(!xe&&Jthe+(he-k)/(ei()-Kl)*v&&(xe=.9999)),xe!==Je&&z.enabled){if(xn=z.isActive=!!xe&&xe<1,Ke=!!Je&&Je<1,P=xn!==Ke,ri=P||!!xe!=!!Je,z.direction=xe>Je?1:-1,z.progress=xe,ri&&!ti&&(Ze=xe&&!Je?0:xe===1?1:Je===1?2:3,B&&(He=!P&&nt[Ze+1]!=="none"&&nt[Ze+1]||nt[Ze],Q=i&&(He==="complete"||He==="reset"||He in i))),A&&(P||Q)&&(Q||g||!i)&&(vi(A)?A(z):z.getTrailing(A).forEach(function(At){return At.endAnimation()})),B||(lt&&!ti&&!Lu?(lt._dp._time-lt._start!==lt._time&<.render(lt._dp._time-lt._start),lt.resetTo?lt.resetTo("totalProgress",xe,i._tTime/i._tDur):(lt.vars.totalProgress=xe,lt.invalidate().restart())):i&&i.totalProgress(xe,!!(ti&&(_t||Tt)))),m){if(Tt&&M&&(at.style[M+w.os2]=It),!rt)Ct(jl(Qt+Mt*xe));else if(ri){if(G=!Tt&&xe>Je&&re+1>he&&he+1>=zr(V,w),U)if(!Tt&&(xn||G)){var J=ss(m,!0),W=he-Jt;mx(m,sn,J.top+(w===Tn?W:0)+In,J.left+(w===Tn?0:W)+In)}else mx(m,at);Ra(xn||G?ft:mt),Pt&&xe<1&&xn||Ct(Qt+(xe===1&&!G?Mt:0))}}T&&!kt.tween&&!ti&&!Lu&&St.restart(!0),c&&(P||b&&xe&&(xe<1||!op))&&lc(c.targets).forEach(function(At){return At.classList[xn||b?"add":"remove"](c.className)}),l&&!B&&!Tt&&l(z),ri&&!ti?(B&&(Q&&(He==="complete"?i.pause().totalProgress(1):He==="reset"?i.restart(!0).pause():He==="restart"?i.restart(!0):i[He]()),l&&l(z)),(P||!op)&&(f&&P&&lp(z,f),$[Ze]&&lp(z,$[Ze]),b&&(xe===1?z.kill(!1,1):$[Ze]=0),P||(Ze=xe===1?1:3,$[Ze]&&lp(z,$[Ze]))),N&&!xn&&Math.abs(z.getVelocity())>(tc(N)?N:2500)&&(Jl(z.callbackAnimation),lt?lt.progress(1):Jl(i,He==="reverse"?1:!xe,1))):B&&l&&!ti&&l(z)}if(ne){var vt=I?he/I.duration()*(I._caScrollDist||0):he;ee(vt+(et._isFlipped?1:0)),ne(vt)}Ge&&Ge(-he/I.duration()*(I._caScrollDist||0))}},z.enable=function(Tt,ue){z.enabled||(z.enabled=!0,Bn(V,"resize",ec),j||Bn(V,"scroll",Ta),bt&&Bn(r,"refreshInit",bt),Tt!==!1&&(z.progress=Et=0,_e=k=ot=wt()),ue!==!1&&z.refresh())},z.getTween=function(Tt){return Tt&&kt?kt.tween:lt},z.setPositions=function(Tt,ue,te,he){if(I){var nn=I.scrollTrigger,xe=I.duration(),Je=nn.end-nn.start;Tt=nn.start+Je*Tt/xe,ue=nn.start+Je*ue/xe}z.refresh(!1,!1,{start:ox(Tt,te&&!!z._startClamp),end:ox(ue,te&&!!z._endClamp)},he),z.update()},z.adjustPinSpacing=function(Tt){if(Kt&&Tt){var ue=Kt.indexOf(w.d)+1;Kt[ue]=parseFloat(Kt[ue])+Tt+In,Kt[1]=parseFloat(Kt[1])+Tt+In,Ra(Kt)}},z.disable=function(Tt,ue){if(z.enabled&&(Tt!==!1&&z.revert(!0,!0),z.enabled=z.isActive=!1,ue||lt&<.pause(),Yt=0,Ht&&(Ht.uncache=1),bt&&zn(r,"refreshInit",bt),St&&(St.pause(),kt.tween&&kt.tween.kill()&&(kt.tween=0)),!j)){for(var te=Ee.length;te--;)if(Ee[te].scroller===V&&Ee[te]!==z)return;zn(V,"resize",ec),j||zn(V,"scroll",Ta)}},z.kill=function(Tt,ue){z.disable(Tt,ue),lt&&!ue&<.kill(),u&&delete gp[u];var te=Ee.indexOf(z);te>=0&&Ee.splice(te,1),te===gi&&Gu>0&&gi--,te=0,Ee.forEach(function(he){return he.scroller===z.scroller&&(te=1)}),te||_i||(z.scroll.rec=0),i&&(i.scrollTrigger=null,Tt&&i.revert({kill:!1}),ue||i.kill()),se&&[se,Ut,et,Vt].forEach(function(he){return he.parentNode&&he.parentNode.removeChild(he)}),ac===z&&(ac=0),m&&(Ht&&(Ht.uncache=1),te=0,Ee.forEach(function(he){return he.pin===m&&te++}),te||(Ht.spacer=0)),n.onKill&&n.onKill(z)},Ee.push(z),z.enable(!1,!1),Ye&&Ye(z),i&&i.add&&!C){var Ie=z.update;z.update=function(){z.update=Ie,Jt||re||z.refresh()},Bt.delayedCall(.01,z.update),C=.01,Jt=re=0}else z.refresh();m&&hR()},r.register=function(n){return Ea||(Bt=n||Ex(),Tx()&&window.document&&r.enable(),Ea=Ql),Ea},r.defaults=function(n){if(n)for(var i in n)Ou[i]=n[i];return Ou},r.disable=function(n,i){Ql=0,Ee.forEach(function(l){return l[i?"kill":"disable"](n)}),zn(Fe,"wheel",Ta),zn(pn,"scroll",Ta),clearInterval(Iu),zn(pn,"touchcancel",Fr),zn(sn,"touchstart",Fr),Uu(zn,pn,"pointerdown,touchstart,mousedown",ax),Uu(zn,pn,"pointerup,touchend,mouseup",lx),qu.kill(),Du(zn);for(var o=0;o0&&l.left+c0&&l.top+c=0&&Wi.splice(e,5),Wi.push(t,t.style.cssText,t.getBBox&&t.getAttribute("transform"),Bt.core.getCache(t),pp())}}):Wi};Ae.revert=function(r,t){return Tp(!r,t)};Ae.create=function(r,t){return new Ae(r,t)};Ae.refresh=function(r){return r?ec():(Ea||Ae.register())&&Ro(!0)};Ae.update=function(r){return++Te.cache&&os(r===!0?2:0)};Ae.clearScrollMemory=Ux;Ae.maxScroll=function(r,t){return zr(r,t?jn:Tn)};Ae.getScrollFunc=function(r,t){return is(pi(r),t?jn:Tn)};Ae.getById=function(r){return gp[r]};Ae.getAll=function(){return Ee.filter(function(r){return r.vars.id!=="ScrollSmoother"})};Ae.isScrolling=function(){return!!cr};Ae.snapDirectional=bp;Ae.addEventListener=function(r,t){var e=Uo[r]||(Uo[r]=[]);~e.indexOf(t)||e.push(t)};Ae.removeEventListener=function(r,t){var e=Uo[r],n=e&&e.indexOf(t);n>=0&&e.splice(n,1)};Ae.batch=function(r,t){var e=[],n={},i=t.interval||.016,o=t.batchMax||1e9,l=function(f,d){var g=[],p=[],m=Bt.delayedCall(i,function(){d(g,p),g=[],p=[]}).pause();return function(M){g.length||m.restart(!0),g.push(M.trigger),p.push(M),o<=g.length&&m.progress(1)}},c;for(c in t)n[c]=c.substr(0,2)==="on"&&vi(t[c])&&c!=="onRefreshInit"?l(c,t[c]):t[c];return vi(o)&&(o=o(),Bn(Ae,"refresh",function(){return o=t.batchMax()})),lc(r).forEach(function(u){var f={};for(c in n)f[c]=n[c];f.trigger=u,e.push(Ae.create(f))}),e};var _x=function(t,e,n,i){return e>i?t(i):e<0&&t(0),n>i?(i-e)/(n-e):n<0?e/(e-n):1},hp=function r(t,e){e===!0?t.style.removeProperty("touch-action"):t.style.touchAction=e===!0?"auto":e?"pan-"+e+(vn.isTouch?" pinch-zoom":""):"none",t===yr&&r(sn,e)},ku={auto:1,scroll:1},gR=function(t){var e=t.event,n=t.target,i=t.axis,o=(e.changedTouches?e.changedTouches[0]:e).target,l=o._gsap||Bt.core.getCache(o),c=ei(),u;if(!l._isScrollT||c-l._isScrollT>2e3){for(;o&&o!==sn&&(o.scrollHeight<=o.clientHeight&&o.scrollWidth<=o.clientWidth||!(ku[(u=lr(o)).overflowY]||ku[u.overflowX]));)o=o.parentNode;l._isScroll=o&&o!==n&&!Do(o)&&(ku[(u=lr(o)).overflowY]||ku[u.overflowX]),l._isScrollT=c}(l._isScroll||i==="x")&&(e.stopPropagation(),e._gsapAllow=!0)},Fx=function(t,e,n,i){return vn.create({target:t,capture:!0,debounce:!1,lockAxis:!0,type:e,onWheel:i=i&&gR,onPress:i,onDrag:i,onScroll:i,onEnable:function(){return n&&Bn(pn,vn.eventTypes[0],xx,!1,!0)},onDisable:function(){return zn(pn,vn.eventTypes[0],xx,!0)}})},_R=/(input|label|select|textarea)/i,vx,xx=function(t){var e=_R.test(t.target.tagName);(e||vx)&&(t._gsapAllow=!0,vx=e)},vR=function(t){Co(t)||(t={}),t.preventDefault=t.isNormalizer=t.allowClicks=!0,t.type||(t.type="wheel,touch"),t.debounce=!!t.debounce,t.id=t.id||"normalizer";var e=t,n=e.normalizeScrollX,i=e.momentum,o=e.allowNestedScroll,l=e.onRelease,c,u,f=pi(t.target)||yr,d=Bt.core.globals().ScrollSmoother,g=d&&d.get(),p=Gs&&(t.content&&pi(t.content)||g&&t.content!==!1&&!g.smooth()&&g.content()),m=is(f,Tn),M=is(f,jn),y=1,v=(vn.isTouch&&Fe.visualViewport?Fe.visualViewport.scale*Fe.visualViewport.width:Fe.outerWidth)/Fe.innerWidth,x=0,E=vi(i)?function(){return i(c)}:function(){return i||2.8},b,T,U=Fx(f,t.type,!0,o),L=function(){return T=!1},I=Fr,N=Fr,A=function(){u=zr(f,Tn),N=nc(Gs?1:0,u),n&&(I=nc(0,zr(f,jn))),b=Lo},w=function(){p._gsap.y=jl(parseFloat(p._gsap.y)+m.offset)+"px",p.style.transform="matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, "+parseFloat(p._gsap.y)+", 0, 1)",m.offset=m.cacheID=0},B=function(){if(T){requestAnimationFrame(L);var K=jl(c.deltaY/2),gt=N(m.v-K);if(p&>!==m.v+m.offset){m.offset=gt-m.v;var z=jl((parseFloat(p&&p._gsap.y)||0)-m.offset);p.style.transform="matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, "+z+", 0, 1)",p._gsap.y=z+"px",m.cacheID=Te.cache,os()}return!0}m.offset&&w(),T=!0},V,Z,j,rt,$=function(){A(),V.isActive()&&V.vars.scrollY>u&&(m()>u?V.progress(1)&&m(u):V.resetTo("scrollY",u))};return p&&Bt.set(p,{y:"+=0"}),t.ignoreCheck=function(nt){return Gs&&nt.type==="touchmove"&&B(nt)||y>1.05&&nt.type!=="touchstart"||c.isGesturing||nt.touches&&nt.touches.length>1},t.onPress=function(){T=!1;var nt=y;y=jl((Fe.visualViewport&&Fe.visualViewport.scale||1)/v),V.pause(),nt!==y&&hp(f,y>1.01?!0:n?!1:"x"),Z=M(),j=m(),A(),b=Lo},t.onRelease=t.onGestureStart=function(nt,K){if(m.offset&&w(),!K)rt.restart(!0);else{Te.cache++;var gt=E(),z,bt;n&&(z=M(),bt=z+gt*.05*-nt.velocityX/.227,gt*=_x(M,z,bt,zr(f,jn)),V.vars.scrollX=I(bt)),z=m(),bt=z+gt*.05*-nt.velocityY/.227,gt*=_x(m,z,bt,zr(f,Tn)),V.vars.scrollY=N(bt),V.invalidate().duration(gt).play(.01),(Gs&&V.vars.scrollY>=u||z>=u-1)&&Bt.to({},{onUpdate:$,duration:gt})}l&&l(nt)},t.onWheel=function(){V._ts&&V.pause(),ei()-x>1e3&&(b=0,x=ei())},t.onChange=function(nt,K,gt,z,bt){if(Lo!==b&&A(),K&&n&&M(I(z[2]===K?Z+(nt.startX-nt.x):M()+K-z[1])),gt){m.offset&&w();var jt=bt[2]===gt,fe=jt?j+nt.startY-nt.y:m()+gt-bt[1],ot=N(fe);jt&&fe!==ot&&(j+=ot-fe),m(ot)}(gt||K)&&os()},t.onEnable=function(){hp(f,n?!1:"x"),Ae.addEventListener("refresh",$),Bn(Fe,"resize",$),m.smooth&&(m.target.style.scrollBehavior="auto",m.smooth=M.smooth=!1),U.enable()},t.onDisable=function(){hp(f,!0),zn(Fe,"resize",$),Ae.removeEventListener("refresh",$),U.kill()},t.lockAxis=t.lockAxis!==!1,c=new vn(t),c.iOS=Gs,Gs&&!m()&&m(1),Gs&&Bt.ticker.add(Fr),rt=c._dc,V=Bt.to(c,{ease:"power4",paused:!0,inherit:!1,scrollX:n?"+=0.1":"+=0",scrollY:"+=0.1",modifiers:{scrollY:Ox(m,m(),function(){return V.pause()})},onUpdate:os,onComplete:rt.vars.onComplete}),c};Ae.sort=function(r){return Ee.sort(r||function(t,e){return(t.vars.refreshPriority||0)*-1e6+t.start-(e.start+(e.vars.refreshPriority||0)*-1e6)})};Ae.observe=function(r){return new vn(r)};Ae.normalizeScroll=function(r){if(typeof r>"u")return mi;if(r===!0&&mi)return mi.enable();if(r===!1){mi&&mi.kill(),mi=r;return}var t=r instanceof vn?r:vR(r);return mi&&mi.target===t.target&&mi.kill(),Do(t.target)&&(mi=t),t};Ae.core={_getVelocityProp:Pu,_inputObserver:Fx,_scrollers:Te,_proxies:xr,bridge:{ss:function(){cr||No("scrollStart"),cr=ei()},ref:function(){return ti}}};Ex()&&Bt.registerPlugin(Ae);function Bx(r,t,e){return Math.max(r,Math.min(t,e))}var Ep=class{constructor(){this.isRunning=!1,this.value=0,this.from=0,this.to=0,this.currentTime=0}advance(t){var e;if(!this.isRunning)return;let n=!1;if(this.duration&&this.easing){this.currentTime+=t;let i=Bx(0,this.currentTime/this.duration,1);n=i>=1;let o=n?1:this.easing(i);this.value=this.from+(this.to-this.from)*o}else this.lerp?(this.value=function(o,l,c,u){return function(d,g,p){return(1-p)*d+p*g}(o,l,1-Math.exp(-c*u))}(this.value,this.to,60*this.lerp,t),Math.round(this.value)===this.to&&(this.value=this.to,n=!0)):(this.value=this.to,n=!0);n&&this.stop(),(e=this.onUpdate)===null||e===void 0||e.call(this,this.value,n)}stop(){this.isRunning=!1}fromTo(t,e,{lerp:n,duration:i,easing:o,onStart:l,onUpdate:c}){this.from=this.value=t,this.to=e,this.lerp=n,this.duration=i,this.easing=o,this.currentTime=0,this.isRunning=!0,l?.(),this.onUpdate=c}},Ap=class{constructor(t,e,{autoResize:n=!0,debounce:i=250}={}){this.wrapper=t,this.content=e,this.width=0,this.height=0,this.scrollHeight=0,this.scrollWidth=0,this.resize=()=>{this.onWrapperResize(),this.onContentResize()},this.onWrapperResize=()=>{this.wrapper instanceof Window?(this.width=window.innerWidth,this.height=window.innerHeight):(this.width=this.wrapper.clientWidth,this.height=this.wrapper.clientHeight)},this.onContentResize=()=>{this.wrapper instanceof Window?(this.scrollHeight=this.content.scrollHeight,this.scrollWidth=this.content.scrollWidth):(this.scrollHeight=this.wrapper.scrollHeight,this.scrollWidth=this.wrapper.scrollWidth)},n&&(this.debouncedResize=function(l,c){let u;return function(...f){let d=this;clearTimeout(u),u=setTimeout(()=>{u=void 0,l.apply(d,f)},c)}}(this.resize,i),this.wrapper instanceof Window?window.addEventListener("resize",this.debouncedResize,!1):(this.wrapperResizeObserver=new ResizeObserver(this.debouncedResize),this.wrapperResizeObserver.observe(this.wrapper)),this.contentResizeObserver=new ResizeObserver(this.debouncedResize),this.contentResizeObserver.observe(this.content)),this.resize()}destroy(){var t,e;(t=this.wrapperResizeObserver)===null||t===void 0||t.disconnect(),(e=this.contentResizeObserver)===null||e===void 0||e.disconnect(),this.wrapper===window&&this.debouncedResize&&window.removeEventListener("resize",this.debouncedResize,!1)}get limit(){return{x:this.scrollWidth-this.width,y:this.scrollHeight-this.height}}},Ku=class{constructor(){this.events={}}emit(t,...e){var n;let i=this.events[t]||[];for(let o=0,l=i.length;o{var i;this.events[t]=(i=this.events[t])===null||i===void 0?void 0:i.filter(o=>e!==o)}}off(t,e){var n;this.events[t]=(n=this.events[t])===null||n===void 0?void 0:n.filter(i=>e!==i)}destroy(){this.events={}}},zx=100/6,Ws={passive:!1},Cp=class{constructor(t,e={wheelMultiplier:1,touchMultiplier:1}){this.element=t,this.options=e,this.touchStart={x:0,y:0},this.lastDelta={x:0,y:0},this.window={width:0,height:0},this.emitter=new Ku,this.onTouchStart=n=>{let{clientX:i,clientY:o}=n.targetTouches?n.targetTouches[0]:n;this.touchStart.x=i,this.touchStart.y=o,this.lastDelta={x:0,y:0},this.emitter.emit("scroll",{deltaX:0,deltaY:0,event:n})},this.onTouchMove=n=>{let{clientX:i,clientY:o}=n.targetTouches?n.targetTouches[0]:n,l=-(i-this.touchStart.x)*this.options.touchMultiplier,c=-(o-this.touchStart.y)*this.options.touchMultiplier;this.touchStart.x=i,this.touchStart.y=o,this.lastDelta={x:l,y:c},this.emitter.emit("scroll",{deltaX:l,deltaY:c,event:n})},this.onTouchEnd=n=>{this.emitter.emit("scroll",{deltaX:this.lastDelta.x,deltaY:this.lastDelta.y,event:n})},this.onWheel=n=>{let{deltaX:i,deltaY:o,deltaMode:l}=n;i*=l===1?zx:l===2?this.window.width:1,o*=l===1?zx:l===2?this.window.height:1,i*=this.options.wheelMultiplier,o*=this.options.wheelMultiplier,this.emitter.emit("scroll",{deltaX:i,deltaY:o,event:n})},this.onWindowResize=()=>{this.window={width:window.innerWidth,height:window.innerHeight}},window.addEventListener("resize",this.onWindowResize,!1),this.onWindowResize(),this.element.addEventListener("wheel",this.onWheel,Ws),this.element.addEventListener("touchstart",this.onTouchStart,Ws),this.element.addEventListener("touchmove",this.onTouchMove,Ws),this.element.addEventListener("touchend",this.onTouchEnd,Ws)}on(t,e){return this.emitter.on(t,e)}destroy(){this.emitter.destroy(),window.removeEventListener("resize",this.onWindowResize,!1),this.element.removeEventListener("wheel",this.onWheel,Ws),this.element.removeEventListener("touchstart",this.onTouchStart,Ws),this.element.removeEventListener("touchmove",this.onTouchMove,Ws),this.element.removeEventListener("touchend",this.onTouchEnd,Ws)}},Qu=class{constructor({wrapper:t=window,content:e=document.documentElement,eventsTarget:n=t,smoothWheel:i=!0,syncTouch:o=!1,syncTouchLerp:l=.075,touchInertiaMultiplier:c=35,duration:u,easing:f=T=>Math.min(1,1.001-Math.pow(2,-10*T)),lerp:d=.1,infinite:g=!1,orientation:p="vertical",gestureOrientation:m="vertical",touchMultiplier:M=1,wheelMultiplier:y=1,autoResize:v=!0,prevent:x,virtualScroll:E,__experimental__naiveDimensions:b=!1}={}){this._isScrolling=!1,this._isStopped=!1,this._isLocked=!1,this._preventNextNativeScrollEvent=!1,this._resetVelocityTimeout=null,this.time=0,this.userData={},this.lastVelocity=0,this.velocity=0,this.direction=0,this.animate=new Ep,this.emitter=new Ku,this.onPointerDown=T=>{T.button===1&&this.reset()},this.onVirtualScroll=T=>{if(typeof this.options.virtualScroll=="function"&&this.options.virtualScroll(T)===!1)return;let{deltaX:U,deltaY:L,event:I}=T;if(this.emitter.emit("virtual-scroll",{deltaX:U,deltaY:L,event:I}),I.ctrlKey)return;let N=I.type.includes("touch"),A=I.type.includes("wheel");if(this.isTouching=I.type==="touchstart"||I.type==="touchmove",this.options.syncTouch&&N&&I.type==="touchstart"&&!this.isStopped&&!this.isLocked)return void this.reset();let w=U===0&&L===0,B=this.options.gestureOrientation==="vertical"&&L===0||this.options.gestureOrientation==="horizontal"&&U===0;if(w||B)return;let V=I.composedPath();V=V.slice(0,V.indexOf(this.rootElement));let Z=this.options.prevent;if(V.find(nt=>{var K,gt,z,bt,jt;return nt instanceof HTMLElement&&(typeof Z=="function"&&Z?.(nt)||((K=nt.hasAttribute)===null||K===void 0?void 0:K.call(nt,"data-lenis-prevent"))||N&&((gt=nt.hasAttribute)===null||gt===void 0?void 0:gt.call(nt,"data-lenis-prevent-touch"))||A&&((z=nt.hasAttribute)===null||z===void 0?void 0:z.call(nt,"data-lenis-prevent-wheel"))||((bt=nt.classList)===null||bt===void 0?void 0:bt.contains("lenis"))&&!(!((jt=nt.classList)===null||jt===void 0)&&jt.contains("lenis-stopped")))}))return;if(this.isStopped||this.isLocked)return void I.preventDefault();if(!(this.options.syncTouch&&N||this.options.smoothWheel&&A))return this.isScrolling="native",void this.animate.stop();I.preventDefault();let j=L;this.options.gestureOrientation==="both"?j=Math.abs(L)>Math.abs(U)?L:U:this.options.gestureOrientation==="horizontal"&&(j=U);let rt=N&&this.options.syncTouch,$=N&&I.type==="touchend"&&Math.abs(j)>5;$&&(j=this.velocity*this.options.touchInertiaMultiplier),this.scrollTo(this.targetScroll+j,Object.assign({programmatic:!1},rt?{lerp:$?this.options.syncTouchLerp:1}:{lerp:this.options.lerp,duration:this.options.duration,easing:this.options.easing}))},this.onNativeScroll=()=>{if(this._resetVelocityTimeout!==null&&(clearTimeout(this._resetVelocityTimeout),this._resetVelocityTimeout=null),this._preventNextNativeScrollEvent)this._preventNextNativeScrollEvent=!1;else if(this.isScrolling===!1||this.isScrolling==="native"){let T=this.animatedScroll;this.animatedScroll=this.targetScroll=this.actualScroll,this.lastVelocity=this.velocity,this.velocity=this.animatedScroll-T,this.direction=Math.sign(this.animatedScroll-T),this.isScrolling="native",this.emit(),this.velocity!==0&&(this._resetVelocityTimeout=setTimeout(()=>{this.lastVelocity=this.velocity,this.velocity=0,this.isScrolling=!1,this.emit()},400))}},window.lenisVersion="1.1.13",t&&t!==document.documentElement&&t!==document.body||(t=window),this.options={wrapper:t,content:e,eventsTarget:n,smoothWheel:i,syncTouch:o,syncTouchLerp:l,touchInertiaMultiplier:c,duration:u,easing:f,lerp:d,infinite:g,gestureOrientation:m,orientation:p,touchMultiplier:M,wheelMultiplier:y,autoResize:v,prevent:x,virtualScroll:E,__experimental__naiveDimensions:b},this.dimensions=new Ap(t,e,{autoResize:v}),this.updateClassName(),this.targetScroll=this.animatedScroll=this.actualScroll,this.options.wrapper.addEventListener("scroll",this.onNativeScroll,!1),this.options.wrapper.addEventListener("pointerdown",this.onPointerDown,!1),this.virtualScroll=new Cp(n,{touchMultiplier:M,wheelMultiplier:y}),this.virtualScroll.on("scroll",this.onVirtualScroll)}destroy(){this.emitter.destroy(),this.options.wrapper.removeEventListener("scroll",this.onNativeScroll,!1),this.options.wrapper.removeEventListener("pointerdown",this.onPointerDown,!1),this.virtualScroll.destroy(),this.dimensions.destroy(),this.cleanUpClassName()}on(t,e){return this.emitter.on(t,e)}off(t,e){return this.emitter.off(t,e)}setScroll(t){this.isHorizontal?this.rootElement.scrollLeft=t:this.rootElement.scrollTop=t}resize(){this.dimensions.resize(),this.animatedScroll=this.targetScroll=this.actualScroll,this.emit()}emit(){this.emitter.emit("scroll",this)}reset(){this.isLocked=!1,this.isScrolling=!1,this.animatedScroll=this.targetScroll=this.actualScroll,this.lastVelocity=this.velocity=0,this.animate.stop()}start(){this.isStopped&&(this.isStopped=!1,this.reset())}stop(){this.isStopped||(this.isStopped=!0,this.animate.stop(),this.reset())}raf(t){let e=t-(this.time||t);this.time=t,this.animate.advance(.001*e)}scrollTo(t,{offset:e=0,immediate:n=!1,lock:i=!1,duration:o=this.options.duration,easing:l=this.options.easing,lerp:c=this.options.lerp,onStart:u,onComplete:f,force:d=!1,programmatic:g=!0,userData:p}={}){if(!this.isStopped&&!this.isLocked||d){if(typeof t=="string"&&["top","left","start"].includes(t))t=0;else if(typeof t=="string"&&["bottom","right","end"].includes(t))t=this.limit;else{let m;if(typeof t=="string"?m=document.querySelector(t):t instanceof HTMLElement&&t?.nodeType&&(m=t),m){if(this.options.wrapper!==window){let y=this.rootElement.getBoundingClientRect();e-=this.isHorizontal?y.left:y.top}let M=m.getBoundingClientRect();t=(this.isHorizontal?M.left:M.top)+this.animatedScroll}}if(typeof t=="number"){if(t+=e,t=Math.round(t),this.options.infinite?g&&(this.targetScroll=this.animatedScroll=this.scroll):t=Bx(0,t,this.limit),t===this.targetScroll)return u?.(this),void(f==null||f(this));if(this.userData=p??{},n)return this.animatedScroll=this.targetScroll=t,this.setScroll(this.scroll),this.reset(),this.preventNextNativeScrollEvent(),this.emit(),f?.(this),void(this.userData={});g||(this.targetScroll=t),this.animate.fromTo(this.animatedScroll,t,{duration:o,easing:l,lerp:c,onStart:()=>{i&&(this.isLocked=!0),this.isScrolling="smooth",u?.(this)},onUpdate:(m,M)=>{this.isScrolling="smooth",this.lastVelocity=this.velocity,this.velocity=m-this.animatedScroll,this.direction=Math.sign(this.velocity),this.animatedScroll=m,this.setScroll(this.scroll),g&&(this.targetScroll=m),M||this.emit(),M&&(this.reset(),this.emit(),f?.(this),this.userData={},this.preventNextNativeScrollEvent())}})}}}preventNextNativeScrollEvent(){this._preventNextNativeScrollEvent=!0,requestAnimationFrame(()=>{this._preventNextNativeScrollEvent=!1})}get rootElement(){return this.options.wrapper===window?document.documentElement:this.options.wrapper}get limit(){return this.options.__experimental__naiveDimensions?this.isHorizontal?this.rootElement.scrollWidth-this.rootElement.clientWidth:this.rootElement.scrollHeight-this.rootElement.clientHeight:this.dimensions.limit[this.isHorizontal?"x":"y"]}get isHorizontal(){return this.options.orientation==="horizontal"}get actualScroll(){return this.isHorizontal?this.rootElement.scrollLeft:this.rootElement.scrollTop}get scroll(){return this.options.infinite?function(e,n){return(e%n+n)%n}(this.animatedScroll,this.limit):this.animatedScroll}get progress(){return this.limit===0?1:this.scroll/this.limit}get isScrolling(){return this._isScrolling}set isScrolling(t){this._isScrolling!==t&&(this._isScrolling=t,this.updateClassName())}get isStopped(){return this._isStopped}set isStopped(t){this._isStopped!==t&&(this._isStopped=t,this.updateClassName())}get isLocked(){return this._isLocked}set isLocked(t){this._isLocked!==t&&(this._isLocked=t,this.updateClassName())}get isSmooth(){return this.isScrolling==="smooth"}get className(){let t="lenis";return this.isStopped&&(t+=" lenis-stopped"),this.isLocked&&(t+=" lenis-locked"),this.isScrolling&&(t+=" lenis-scrolling"),this.isScrolling==="smooth"&&(t+=" lenis-smooth"),t}updateClassName(){this.cleanUpClassName(),this.rootElement.className=`${this.rootElement.className} ${this.className}`.trim()}cleanUpClassName(){this.rootElement.className=this.rootElement.className.replace(/lenis(-\w+)?/g,"").trim()}};var kx={duration:.4,easing:r=>Math.min(1,1.001-Math.pow(2,-10*r)),touchMultiplier:2,infinite:!1},Ia={PARTICLES:{CAMERA_Z_INITIAL_DESKTOP:16,CAMERA_Z_INITIAL_MOBILE:20,CAMERA_Z_ANIMATED_DESKTOP:2,CAMERA_Z_ANIMATED_MOBILE:1},INITIAL_WIDTH:window.innerWidth,INITIAL_HEIGHT:window.innerHeight,BACKGROUND_COLOR:"#021f1e",POINTS_COLORS:["#21bfae","#da26e0","#e9991c","#0870b7"]},Br=Math.min(window.devicePixelRatio,2);var dg="168";var xR=0,Hx=1,yR=2;var Hy=1,MR=2,fs=3,to=0,Ii=1,ps=2,Qs=0,Qa=1,Rh=2,Vx=3,Gx=4,SR=5,Go=100,wR=101,bR=102,TR=103,ER=104,AR=200,CR=201,RR=202,PR=203,im=204,rm=205,IR=206,LR=207,DR=208,UR=209,NR=210,OR=211,FR=212,zR=213,BR=214,kR=0,HR=1,VR=2,Ph=3,GR=4,WR=5,XR=6,qR=7,Vy=0,YR=1,ZR=2,js=0,$R=1,JR=2,KR=3,QR=4,jR=5,tP=6,eP=7;var Gy=300,nl=301,il=302,sm=303,om=304,Kh=306,am=1e3,Xo=1001,lm=1002,hr=1003,nP=1004;var ju=1005;var br=1006,Rp=1007;var qo=1008;var _s=1009,Wy=1010,Xy=1011,xc=1012,pg=1013,Yo=1014,ms=1015,Mc=1016,mg=1017,gg=1018,rl=1020,qy=35902,Yy=1021,Zy=1022,Tr=1023,$y=1024,Jy=1025,ja=1026,sl=1027,Ky=1028,_g=1029,Qy=1030,vg=1031;var xg=1033,bh=33776,Th=33777,Eh=33778,Ah=33779,cm=35840,um=35841,hm=35842,fm=35843,dm=36196,pm=37492,mm=37496,gm=37808,_m=37809,vm=37810,xm=37811,ym=37812,Mm=37813,Sm=37814,wm=37815,bm=37816,Tm=37817,Em=37818,Am=37819,Cm=37820,Rm=37821,Ch=36492,Pm=36494,Im=36495,jy=36283,Lm=36284,Dm=36285,Um=36286;var Ih=2300,Nm=2301,Pp=2302,Wx=2400,Xx=2401,qx=2402;var iP=3200,rP=3201;var sP=0,oP=1,Ks="",kr="srgb",io="srgb-linear",yg="display-p3",Qh="display-p3-linear",Lh="linear",on="srgb",Dh="rec709",Uh="p3";var La=7680;var Yx=519,aP=512,lP=513,cP=514,tM=515,uP=516,hP=517,fP=518,dP=519,Zx=35044;var $x="300 es",gs=2e3,Nh=2001,eo=class{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;let n=this._listeners;return n[t]!==void 0&&n[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;let i=this._listeners[t];if(i!==void 0){let o=i.indexOf(e);o!==-1&&i.splice(o,1)}}dispatchEvent(t){if(this._listeners===void 0)return;let n=this._listeners[t.type];if(n!==void 0){t.target=this;let i=n.slice(0);for(let o=0,l=i.length;o>8&255]+ni[r>>16&255]+ni[r>>24&255]+"-"+ni[t&255]+ni[t>>8&255]+"-"+ni[t>>16&15|64]+ni[t>>24&255]+"-"+ni[e&63|128]+ni[e>>8&255]+"-"+ni[e>>16&255]+ni[e>>24&255]+ni[n&255]+ni[n>>8&255]+ni[n>>16&255]+ni[n>>24&255]).toLowerCase()}function Pi(r,t,e){return Math.max(t,Math.min(e,r))}function pP(r,t){return(r%t+t)%t}function Lp(r,t,e){return(1-e)*r+e*t}function uc(r,t){switch(t.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function Ri(r,t){switch(t.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}var Pe=class r{constructor(t=0,e=0){r.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}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(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(Pi(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let n=Math.cos(e),i=Math.sin(e),o=this.x-t.x,l=this.y-t.y;return this.x=o*n-l*i+t.x,this.y=o*i+l*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Se=class r{constructor(t,e,n,i,o,l,c,u,f){r.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,n,i,o,l,c,u,f)}set(t,e,n,i,o,l,c,u,f){let d=this.elements;return d[0]=t,d[1]=i,d[2]=c,d[3]=e,d[4]=o,d[5]=u,d[6]=n,d[7]=l,d[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let n=t.elements,i=e.elements,o=this.elements,l=n[0],c=n[3],u=n[6],f=n[1],d=n[4],g=n[7],p=n[2],m=n[5],M=n[8],y=i[0],v=i[3],x=i[6],E=i[1],b=i[4],T=i[7],U=i[2],L=i[5],I=i[8];return o[0]=l*y+c*E+u*U,o[3]=l*v+c*b+u*L,o[6]=l*x+c*T+u*I,o[1]=f*y+d*E+g*U,o[4]=f*v+d*b+g*L,o[7]=f*x+d*T+g*I,o[2]=p*y+m*E+M*U,o[5]=p*v+m*b+M*L,o[8]=p*x+m*T+M*I,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],n=t[1],i=t[2],o=t[3],l=t[4],c=t[5],u=t[6],f=t[7],d=t[8];return e*l*d-e*c*f-n*o*d+n*c*u+i*o*f-i*l*u}invert(){let t=this.elements,e=t[0],n=t[1],i=t[2],o=t[3],l=t[4],c=t[5],u=t[6],f=t[7],d=t[8],g=d*l-c*f,p=c*u-d*o,m=f*o-l*u,M=e*g+n*p+i*m;if(M===0)return this.set(0,0,0,0,0,0,0,0,0);let y=1/M;return t[0]=g*y,t[1]=(i*f-d*n)*y,t[2]=(c*n-i*l)*y,t[3]=p*y,t[4]=(d*e-i*u)*y,t[5]=(i*o-c*e)*y,t[6]=m*y,t[7]=(n*u-f*e)*y,t[8]=(l*e-n*o)*y,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,o,l,c){let u=Math.cos(o),f=Math.sin(o);return this.set(n*u,n*f,-n*(u*l+f*c)+l+t,-i*f,i*u,-i*(-f*l+u*c)+c+e,0,0,1),this}scale(t,e){return this.premultiply(Dp.makeScale(t,e)),this}rotate(t){return this.premultiply(Dp.makeRotation(-t)),this}translate(t,e){return this.premultiply(Dp.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,n=t.elements;for(let i=0;i<9;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){let n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return new this.constructor().fromArray(this.elements)}},Dp=new Se;function eM(r){for(let t=r.length-1;t>=0;--t)if(r[t]>=65535)return!0;return!1}function Oh(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function mP(){let r=Oh("canvas");return r.style.display="block",r}var Jx={};function _c(r){r in Jx||(Jx[r]=!0,console.warn(r))}function gP(r,t,e){return new Promise(function(n,i){function o(){switch(r.clientWaitSync(t,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(o,e);break;default:n()}}setTimeout(o,e)})}var Kx=new Se().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Qx=new Se().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),hc={[io]:{transfer:Lh,primaries:Dh,luminanceCoefficients:[.2126,.7152,.0722],toReference:r=>r,fromReference:r=>r},[kr]:{transfer:on,primaries:Dh,luminanceCoefficients:[.2126,.7152,.0722],toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[Qh]:{transfer:Lh,primaries:Uh,luminanceCoefficients:[.2289,.6917,.0793],toReference:r=>r.applyMatrix3(Qx),fromReference:r=>r.applyMatrix3(Kx)},[yg]:{transfer:on,primaries:Uh,luminanceCoefficients:[.2289,.6917,.0793],toReference:r=>r.convertSRGBToLinear().applyMatrix3(Qx),fromReference:r=>r.applyMatrix3(Kx).convertLinearToSRGB()}},_P=new Set([io,Qh]),qe={enabled:!0,_workingColorSpace:io,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(r){if(!_P.has(r))throw new Error(`Unsupported working color space, "${r}".`);this._workingColorSpace=r},convert:function(r,t,e){if(this.enabled===!1||t===e||!t||!e)return r;let n=hc[t].toReference,i=hc[e].fromReference;return i(n(r))},fromWorkingColorSpace:function(r,t){return this.convert(r,this._workingColorSpace,t)},toWorkingColorSpace:function(r,t){return this.convert(r,t,this._workingColorSpace)},getPrimaries:function(r){return hc[r].primaries},getTransfer:function(r){return r===Ks?Lh:hc[r].transfer},getLuminanceCoefficients:function(r,t=this._workingColorSpace){return r.fromArray(hc[t].luminanceCoefficients)}};function tl(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Up(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}var Da,Fm=class{static getDataURL(t){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{Da===void 0&&(Da=Oh("canvas")),Da.width=t.width,Da.height=t.height;let n=Da.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=Da}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){let e=Oh("canvas");e.width=t.width,e.height=t.height;let n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);let i=n.getImageData(0,0,t.width,t.height),o=i.data;for(let l=0;l0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==Gy)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case am:t.x=t.x-Math.floor(t.x);break;case Xo:t.x=t.x<0?0:1;break;case lm:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case am:t.y=t.y-Math.floor(t.y);break;case Xo:t.y=t.y<0?0:1;break;case lm:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}};fr.DEFAULT_IMAGE=null;fr.DEFAULT_MAPPING=Gy;fr.DEFAULT_ANISOTROPY=1;var Hn=class r{constructor(t=0,e=0,n=0,i=1){r.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){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: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,n=this.y,i=this.z,o=this.w,l=t.elements;return this.x=l[0]*e+l[4]*n+l[8]*i+l[12]*o,this.y=l[1]*e+l[5]*n+l[9]*i+l[13]*o,this.z=l[2]*e+l[6]*n+l[10]*i+l[14]*o,this.w=l[3]*e+l[7]*n+l[11]*i+l[15]*o,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,o,u=t.elements,f=u[0],d=u[4],g=u[8],p=u[1],m=u[5],M=u[9],y=u[2],v=u[6],x=u[10];if(Math.abs(d-p)<.01&&Math.abs(g-y)<.01&&Math.abs(M-v)<.01){if(Math.abs(d+p)<.1&&Math.abs(g+y)<.1&&Math.abs(M+v)<.1&&Math.abs(f+m+x-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let b=(f+1)/2,T=(m+1)/2,U=(x+1)/2,L=(d+p)/4,I=(g+y)/4,N=(M+v)/4;return b>T&&b>U?b<.01?(n=0,i=.707106781,o=.707106781):(n=Math.sqrt(b),i=L/n,o=I/n):T>U?T<.01?(n=.707106781,i=0,o=.707106781):(i=Math.sqrt(T),n=L/i,o=N/i):U<.01?(n=.707106781,i=.707106781,o=0):(o=Math.sqrt(U),n=I/o,i=N/o),this.set(n,i,o,e),this}let E=Math.sqrt((v-M)*(v-M)+(g-y)*(g-y)+(p-d)*(p-d));return Math.abs(E)<.001&&(E=1),this.x=(v-M)/E,this.y=(g-y)/E,this.z=(p-d)/E,this.w=Math.acos((f+m+x-1)/2),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),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}},zm=class extends eo{constructor(t=1,e=1,n={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new Hn(0,0,t,e),this.scissorTest=!1,this.viewport=new Hn(0,0,t,e);let i={width:t,height:e,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:br,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);let o=new fr(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);o.flipY=!1,o.generateMipmaps=n.generateMipmaps,o.internalFormat=n.internalFormat,this.textures=[];let l=n.count;for(let c=0;c=0?1:-1,b=1-x*x;if(b>Number.EPSILON){let U=Math.sqrt(b),L=Math.atan2(U,x*E);v=Math.sin(v*L)/U,c=Math.sin(c*L)/U}let T=c*E;if(u=u*v+p*T,f=f*v+m*T,d=d*v+M*T,g=g*v+y*T,v===1-c){let U=1/Math.sqrt(u*u+f*f+d*d+g*g);u*=U,f*=U,d*=U,g*=U}}t[e]=u,t[e+1]=f,t[e+2]=d,t[e+3]=g}static multiplyQuaternionsFlat(t,e,n,i,o,l){let c=n[i],u=n[i+1],f=n[i+2],d=n[i+3],g=o[l],p=o[l+1],m=o[l+2],M=o[l+3];return t[e]=c*M+d*g+u*m-f*p,t[e+1]=u*M+d*p+f*g-c*m,t[e+2]=f*M+d*m+c*p-u*g,t[e+3]=d*M-c*g-u*p-f*m,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){let n=t._x,i=t._y,o=t._z,l=t._order,c=Math.cos,u=Math.sin,f=c(n/2),d=c(i/2),g=c(o/2),p=u(n/2),m=u(i/2),M=u(o/2);switch(l){case"XYZ":this._x=p*d*g+f*m*M,this._y=f*m*g-p*d*M,this._z=f*d*M+p*m*g,this._w=f*d*g-p*m*M;break;case"YXZ":this._x=p*d*g+f*m*M,this._y=f*m*g-p*d*M,this._z=f*d*M-p*m*g,this._w=f*d*g+p*m*M;break;case"ZXY":this._x=p*d*g-f*m*M,this._y=f*m*g+p*d*M,this._z=f*d*M+p*m*g,this._w=f*d*g-p*m*M;break;case"ZYX":this._x=p*d*g-f*m*M,this._y=f*m*g+p*d*M,this._z=f*d*M-p*m*g,this._w=f*d*g+p*m*M;break;case"YZX":this._x=p*d*g+f*m*M,this._y=f*m*g+p*d*M,this._z=f*d*M-p*m*g,this._w=f*d*g-p*m*M;break;case"XZY":this._x=p*d*g-f*m*M,this._y=f*m*g-p*d*M,this._z=f*d*M+p*m*g,this._w=f*d*g+p*m*M;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+l)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,n=e[0],i=e[4],o=e[8],l=e[1],c=e[5],u=e[9],f=e[2],d=e[6],g=e[10],p=n+c+g;if(p>0){let m=.5/Math.sqrt(p+1);this._w=.25/m,this._x=(d-u)*m,this._y=(o-f)*m,this._z=(l-i)*m}else if(n>c&&n>g){let m=2*Math.sqrt(1+n-c-g);this._w=(d-u)/m,this._x=.25*m,this._y=(i+l)/m,this._z=(o+f)/m}else if(c>g){let m=2*Math.sqrt(1+c-n-g);this._w=(o-f)/m,this._x=(i+l)/m,this._y=.25*m,this._z=(u+d)/m}else{let m=2*Math.sqrt(1+g-n-c);this._w=(l-i)/m,this._x=(o+f)/m,this._y=(u+d)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return nMath.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Pi(this.dot(t),-1,1)))}rotateTowards(t,e){let n=this.angleTo(t);if(n===0)return this;let i=Math.min(1,e/n);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let n=t._x,i=t._y,o=t._z,l=t._w,c=e._x,u=e._y,f=e._z,d=e._w;return this._x=n*d+l*c+i*f-o*u,this._y=i*d+l*u+o*c-n*f,this._z=o*d+l*f+n*u-i*c,this._w=l*d-n*c-i*u-o*f,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);let n=this._x,i=this._y,o=this._z,l=this._w,c=l*t._w+n*t._x+i*t._y+o*t._z;if(c<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,c=-c):this.copy(t),c>=1)return this._w=l,this._x=n,this._y=i,this._z=o,this;let u=1-c*c;if(u<=Number.EPSILON){let m=1-e;return this._w=m*l+e*this._w,this._x=m*n+e*this._x,this._y=m*i+e*this._y,this._z=m*o+e*this._z,this.normalize(),this}let f=Math.sqrt(u),d=Math.atan2(f,c),g=Math.sin((1-e)*d)/f,p=Math.sin(e*d)/f;return this._w=l*g+this._w*p,this._x=n*g+this._x*p,this._y=i*g+this._y*p,this._z=o*g+this._z*p,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){let t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),o=Math.sqrt(n);return this.set(i*Math.sin(t),i*Math.cos(t),o*Math.sin(e),o*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},tt=class r{constructor(t=0,e=0,n=0){r.prototype.isVector3=!0,this.x=t,this.y=e,this.z=n}set(t,e,n){return n===void 0&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(jx.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(jx.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,n=this.y,i=this.z,o=t.elements;return this.x=o[0]*e+o[3]*n+o[6]*i,this.y=o[1]*e+o[4]*n+o[7]*i,this.z=o[2]*e+o[5]*n+o[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,n=this.y,i=this.z,o=t.elements,l=1/(o[3]*e+o[7]*n+o[11]*i+o[15]);return this.x=(o[0]*e+o[4]*n+o[8]*i+o[12])*l,this.y=(o[1]*e+o[5]*n+o[9]*i+o[13])*l,this.z=(o[2]*e+o[6]*n+o[10]*i+o[14])*l,this}applyQuaternion(t){let e=this.x,n=this.y,i=this.z,o=t.x,l=t.y,c=t.z,u=t.w,f=2*(l*i-c*n),d=2*(c*e-o*i),g=2*(o*n-l*e);return this.x=e+u*f+l*g-c*d,this.y=n+u*d+c*f-o*g,this.z=i+u*g+o*d-l*f,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,n=this.y,i=this.z,o=t.elements;return this.x=o[0]*e+o[4]*n+o[8]*i,this.y=o[1]*e+o[5]*n+o[9]*i,this.z=o[2]*e+o[6]*n+o[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}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(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let n=t.x,i=t.y,o=t.z,l=e.x,c=e.y,u=e.z;return this.x=i*u-o*c,this.y=o*l-n*u,this.z=n*c-i*l,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Op.copy(this).projectOnVector(t),this.sub(Op)}reflect(t){return this.sub(Op.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(Pi(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){let i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=Math.random()*2-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Op=new tt,jx=new no,Zo=class{constructor(t=new tt(1/0,1/0,1/0),e=new tt(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,Mr),Mr.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(fc),eh.subVectors(this.max,fc),Ua.subVectors(t.a,fc),Na.subVectors(t.b,fc),Oa.subVectors(t.c,fc),Xs.subVectors(Na,Ua),qs.subVectors(Oa,Na),Oo.subVectors(Ua,Oa);let e=[0,-Xs.z,Xs.y,0,-qs.z,qs.y,0,-Oo.z,Oo.y,Xs.z,0,-Xs.x,qs.z,0,-qs.x,Oo.z,0,-Oo.x,-Xs.y,Xs.x,0,-qs.y,qs.x,0,-Oo.y,Oo.x,0];return!Fp(e,Ua,Na,Oa,eh)||(e=[1,0,0,0,1,0,0,0,1],!Fp(e,Ua,Na,Oa,eh))?!1:(nh.crossVectors(Xs,qs),e=[nh.x,nh.y,nh.z],Fp(e,Ua,Na,Oa,eh))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Mr).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(Mr).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(as[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),as[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),as[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),as[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),as[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),as[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),as[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),as[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(as),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},as=[new tt,new tt,new tt,new tt,new tt,new tt,new tt,new tt],Mr=new tt,th=new Zo,Ua=new tt,Na=new tt,Oa=new tt,Xs=new tt,qs=new tt,Oo=new tt,fc=new tt,eh=new tt,nh=new tt,Fo=new tt;function Fp(r,t,e,n,i){for(let o=0,l=r.length-3;o<=l;o+=3){Fo.fromArray(r,o);let c=i.x*Math.abs(Fo.x)+i.y*Math.abs(Fo.y)+i.z*Math.abs(Fo.z),u=t.dot(Fo),f=e.dot(Fo),d=n.dot(Fo);if(Math.max(-Math.max(u,f,d),Math.min(u,f,d))>c)return!1}return!0}var yP=new Zo,dc=new tt,zp=new tt,ol=class{constructor(t=new tt,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let n=this.center;e!==void 0?n.copy(e):yP.setFromPoints(t).getCenter(n);let i=0;for(let o=0,l=t.length;othis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;dc.subVectors(t,this.center);let e=dc.lengthSq();if(e>this.radius*this.radius){let n=Math.sqrt(e),i=(n-this.radius)*.5;this.center.addScaledVector(dc,i/n),this.radius+=i}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(zp.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(dc.copy(t.center).add(zp)),this.expandByPoint(dc.copy(t.center).sub(zp))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}},ls=new tt,Bp=new tt,ih=new tt,Ys=new tt,kp=new tt,rh=new tt,Hp=new tt,Bh=class{constructor(t=new tt,e=new tt(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,ls)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);let n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){let e=ls.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(ls.copy(this.origin).addScaledVector(this.direction,e),ls.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){Bp.copy(t).add(e).multiplyScalar(.5),ih.copy(e).sub(t).normalize(),Ys.copy(this.origin).sub(Bp);let o=t.distanceTo(e)*.5,l=-this.direction.dot(ih),c=Ys.dot(this.direction),u=-Ys.dot(ih),f=Ys.lengthSq(),d=Math.abs(1-l*l),g,p,m,M;if(d>0)if(g=l*u-c,p=l*c-u,M=o*d,g>=0)if(p>=-M)if(p<=M){let y=1/d;g*=y,p*=y,m=g*(g+l*p+2*c)+p*(l*g+p+2*u)+f}else p=o,g=Math.max(0,-(l*p+c)),m=-g*g+p*(p+2*u)+f;else p=-o,g=Math.max(0,-(l*p+c)),m=-g*g+p*(p+2*u)+f;else p<=-M?(g=Math.max(0,-(-l*o+c)),p=g>0?-o:Math.min(Math.max(-o,-u),o),m=-g*g+p*(p+2*u)+f):p<=M?(g=0,p=Math.min(Math.max(-o,-u),o),m=p*(p+2*u)+f):(g=Math.max(0,-(l*o+c)),p=g>0?o:Math.min(Math.max(-o,-u),o),m=-g*g+p*(p+2*u)+f);else p=l>0?-o:o,g=Math.max(0,-(l*p+c)),m=-g*g+p*(p+2*u)+f;return n&&n.copy(this.origin).addScaledVector(this.direction,g),i&&i.copy(Bp).addScaledVector(ih,p),m}intersectSphere(t,e){ls.subVectors(t.center,this.origin);let n=ls.dot(this.direction),i=ls.dot(ls)-n*n,o=t.radius*t.radius;if(i>o)return null;let l=Math.sqrt(o-i),c=n-l,u=n+l;return u<0?null:c<0?this.at(u,e):this.at(c,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){let n=this.distanceToPlane(t);return n===null?null:this.at(n,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,o,l,c,u,f=1/this.direction.x,d=1/this.direction.y,g=1/this.direction.z,p=this.origin;return f>=0?(n=(t.min.x-p.x)*f,i=(t.max.x-p.x)*f):(n=(t.max.x-p.x)*f,i=(t.min.x-p.x)*f),d>=0?(o=(t.min.y-p.y)*d,l=(t.max.y-p.y)*d):(o=(t.max.y-p.y)*d,l=(t.min.y-p.y)*d),n>l||o>i||((o>n||isNaN(n))&&(n=o),(l=0?(c=(t.min.z-p.z)*g,u=(t.max.z-p.z)*g):(c=(t.max.z-p.z)*g,u=(t.min.z-p.z)*g),n>u||c>i)||((c>n||n!==n)&&(n=c),(u=0?n:i,e)}intersectsBox(t){return this.intersectBox(t,ls)!==null}intersectTriangle(t,e,n,i,o){kp.subVectors(e,t),rh.subVectors(n,t),Hp.crossVectors(kp,rh);let l=this.direction.dot(Hp),c;if(l>0){if(i)return null;c=1}else if(l<0)c=-1,l=-l;else return null;Ys.subVectors(this.origin,t);let u=c*this.direction.dot(rh.crossVectors(Ys,rh));if(u<0)return null;let f=c*this.direction.dot(kp.cross(Ys));if(f<0||u+f>l)return null;let d=-c*Ys.dot(Hp);return d<0?null:this.at(d/l,o)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Ln=class r{constructor(t,e,n,i,o,l,c,u,f,d,g,p,m,M,y,v){r.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,n,i,o,l,c,u,f,d,g,p,m,M,y,v)}set(t,e,n,i,o,l,c,u,f,d,g,p,m,M,y,v){let x=this.elements;return x[0]=t,x[4]=e,x[8]=n,x[12]=i,x[1]=o,x[5]=l,x[9]=c,x[13]=u,x[2]=f,x[6]=d,x[10]=g,x[14]=p,x[3]=m,x[7]=M,x[11]=y,x[15]=v,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 r().fromArray(this.elements)}copy(t){let e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){let e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){let e=this.elements,n=t.elements,i=1/Fa.setFromMatrixColumn(t,0).length(),o=1/Fa.setFromMatrixColumn(t,1).length(),l=1/Fa.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*o,e[5]=n[5]*o,e[6]=n[6]*o,e[7]=0,e[8]=n[8]*l,e[9]=n[9]*l,e[10]=n[10]*l,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,n=t.x,i=t.y,o=t.z,l=Math.cos(n),c=Math.sin(n),u=Math.cos(i),f=Math.sin(i),d=Math.cos(o),g=Math.sin(o);if(t.order==="XYZ"){let p=l*d,m=l*g,M=c*d,y=c*g;e[0]=u*d,e[4]=-u*g,e[8]=f,e[1]=m+M*f,e[5]=p-y*f,e[9]=-c*u,e[2]=y-p*f,e[6]=M+m*f,e[10]=l*u}else if(t.order==="YXZ"){let p=u*d,m=u*g,M=f*d,y=f*g;e[0]=p+y*c,e[4]=M*c-m,e[8]=l*f,e[1]=l*g,e[5]=l*d,e[9]=-c,e[2]=m*c-M,e[6]=y+p*c,e[10]=l*u}else if(t.order==="ZXY"){let p=u*d,m=u*g,M=f*d,y=f*g;e[0]=p-y*c,e[4]=-l*g,e[8]=M+m*c,e[1]=m+M*c,e[5]=l*d,e[9]=y-p*c,e[2]=-l*f,e[6]=c,e[10]=l*u}else if(t.order==="ZYX"){let p=l*d,m=l*g,M=c*d,y=c*g;e[0]=u*d,e[4]=M*f-m,e[8]=p*f+y,e[1]=u*g,e[5]=y*f+p,e[9]=m*f-M,e[2]=-f,e[6]=c*u,e[10]=l*u}else if(t.order==="YZX"){let p=l*u,m=l*f,M=c*u,y=c*f;e[0]=u*d,e[4]=y-p*g,e[8]=M*g+m,e[1]=g,e[5]=l*d,e[9]=-c*d,e[2]=-f*d,e[6]=m*g+M,e[10]=p-y*g}else if(t.order==="XZY"){let p=l*u,m=l*f,M=c*u,y=c*f;e[0]=u*d,e[4]=-g,e[8]=f*d,e[1]=p*g+y,e[5]=l*d,e[9]=m*g-M,e[2]=M*g-m,e[6]=c*d,e[10]=y*g+p}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(MP,t,SP)}lookAt(t,e,n){let i=this.elements;return qi.subVectors(t,e),qi.lengthSq()===0&&(qi.z=1),qi.normalize(),Zs.crossVectors(n,qi),Zs.lengthSq()===0&&(Math.abs(n.z)===1?qi.x+=1e-4:qi.z+=1e-4,qi.normalize(),Zs.crossVectors(n,qi)),Zs.normalize(),sh.crossVectors(qi,Zs),i[0]=Zs.x,i[4]=sh.x,i[8]=qi.x,i[1]=Zs.y,i[5]=sh.y,i[9]=qi.y,i[2]=Zs.z,i[6]=sh.z,i[10]=qi.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let n=t.elements,i=e.elements,o=this.elements,l=n[0],c=n[4],u=n[8],f=n[12],d=n[1],g=n[5],p=n[9],m=n[13],M=n[2],y=n[6],v=n[10],x=n[14],E=n[3],b=n[7],T=n[11],U=n[15],L=i[0],I=i[4],N=i[8],A=i[12],w=i[1],B=i[5],V=i[9],Z=i[13],j=i[2],rt=i[6],$=i[10],nt=i[14],K=i[3],gt=i[7],z=i[11],bt=i[15];return o[0]=l*L+c*w+u*j+f*K,o[4]=l*I+c*B+u*rt+f*gt,o[8]=l*N+c*V+u*$+f*z,o[12]=l*A+c*Z+u*nt+f*bt,o[1]=d*L+g*w+p*j+m*K,o[5]=d*I+g*B+p*rt+m*gt,o[9]=d*N+g*V+p*$+m*z,o[13]=d*A+g*Z+p*nt+m*bt,o[2]=M*L+y*w+v*j+x*K,o[6]=M*I+y*B+v*rt+x*gt,o[10]=M*N+y*V+v*$+x*z,o[14]=M*A+y*Z+v*nt+x*bt,o[3]=E*L+b*w+T*j+U*K,o[7]=E*I+b*B+T*rt+U*gt,o[11]=E*N+b*V+T*$+U*z,o[15]=E*A+b*Z+T*nt+U*bt,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],n=t[4],i=t[8],o=t[12],l=t[1],c=t[5],u=t[9],f=t[13],d=t[2],g=t[6],p=t[10],m=t[14],M=t[3],y=t[7],v=t[11],x=t[15];return M*(+o*u*g-i*f*g-o*c*p+n*f*p+i*c*m-n*u*m)+y*(+e*u*m-e*f*p+o*l*p-i*l*m+i*f*d-o*u*d)+v*(+e*f*g-e*c*m-o*l*g+n*l*m+o*c*d-n*f*d)+x*(-i*c*d-e*u*g+e*c*p+i*l*g-n*l*p+n*u*d)}transpose(){let t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){let i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){let t=this.elements,e=t[0],n=t[1],i=t[2],o=t[3],l=t[4],c=t[5],u=t[6],f=t[7],d=t[8],g=t[9],p=t[10],m=t[11],M=t[12],y=t[13],v=t[14],x=t[15],E=g*v*f-y*p*f+y*u*m-c*v*m-g*u*x+c*p*x,b=M*p*f-d*v*f-M*u*m+l*v*m+d*u*x-l*p*x,T=d*y*f-M*g*f+M*c*m-l*y*m-d*c*x+l*g*x,U=M*g*u-d*y*u-M*c*p+l*y*p+d*c*v-l*g*v,L=e*E+n*b+i*T+o*U;if(L===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let I=1/L;return t[0]=E*I,t[1]=(y*p*o-g*v*o-y*i*m+n*v*m+g*i*x-n*p*x)*I,t[2]=(c*v*o-y*u*o+y*i*f-n*v*f-c*i*x+n*u*x)*I,t[3]=(g*u*o-c*p*o-g*i*f+n*p*f+c*i*m-n*u*m)*I,t[4]=b*I,t[5]=(d*v*o-M*p*o+M*i*m-e*v*m-d*i*x+e*p*x)*I,t[6]=(M*u*o-l*v*o-M*i*f+e*v*f+l*i*x-e*u*x)*I,t[7]=(l*p*o-d*u*o+d*i*f-e*p*f-l*i*m+e*u*m)*I,t[8]=T*I,t[9]=(M*g*o-d*y*o-M*n*m+e*y*m+d*n*x-e*g*x)*I,t[10]=(l*y*o-M*c*o+M*n*f-e*y*f-l*n*x+e*c*x)*I,t[11]=(d*c*o-l*g*o-d*n*f+e*g*f+l*n*m-e*c*m)*I,t[12]=U*I,t[13]=(d*y*i-M*g*i+M*n*p-e*y*p-d*n*v+e*g*v)*I,t[14]=(M*c*i-l*y*i-M*n*u+e*y*u+l*n*v-e*c*v)*I,t[15]=(l*g*i-d*c*i+d*n*u-e*g*u-l*n*p+e*c*p)*I,this}scale(t){let e=this.elements,n=t.x,i=t.y,o=t.z;return e[0]*=n,e[4]*=i,e[8]*=o,e[1]*=n,e[5]*=i,e[9]*=o,e[2]*=n,e[6]*=i,e[10]*=o,e[3]*=n,e[7]*=i,e[11]*=o,this}getMaxScaleOnAxis(){let t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let n=Math.cos(e),i=Math.sin(e),o=1-n,l=t.x,c=t.y,u=t.z,f=o*l,d=o*c;return this.set(f*l+n,f*c-i*u,f*u+i*c,0,f*c+i*u,d*c+n,d*u-i*l,0,f*u-i*c,d*u+i*l,o*u*u+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,i,o,l){return this.set(1,n,o,0,t,1,l,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){let i=this.elements,o=e._x,l=e._y,c=e._z,u=e._w,f=o+o,d=l+l,g=c+c,p=o*f,m=o*d,M=o*g,y=l*d,v=l*g,x=c*g,E=u*f,b=u*d,T=u*g,U=n.x,L=n.y,I=n.z;return i[0]=(1-(y+x))*U,i[1]=(m+T)*U,i[2]=(M-b)*U,i[3]=0,i[4]=(m-T)*L,i[5]=(1-(p+x))*L,i[6]=(v+E)*L,i[7]=0,i[8]=(M+b)*I,i[9]=(v-E)*I,i[10]=(1-(p+y))*I,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){let i=this.elements,o=Fa.set(i[0],i[1],i[2]).length(),l=Fa.set(i[4],i[5],i[6]).length(),c=Fa.set(i[8],i[9],i[10]).length();this.determinant()<0&&(o=-o),t.x=i[12],t.y=i[13],t.z=i[14],Sr.copy(this);let f=1/o,d=1/l,g=1/c;return Sr.elements[0]*=f,Sr.elements[1]*=f,Sr.elements[2]*=f,Sr.elements[4]*=d,Sr.elements[5]*=d,Sr.elements[6]*=d,Sr.elements[8]*=g,Sr.elements[9]*=g,Sr.elements[10]*=g,e.setFromRotationMatrix(Sr),n.x=o,n.y=l,n.z=c,this}makePerspective(t,e,n,i,o,l,c=gs){let u=this.elements,f=2*o/(e-t),d=2*o/(n-i),g=(e+t)/(e-t),p=(n+i)/(n-i),m,M;if(c===gs)m=-(l+o)/(l-o),M=-2*l*o/(l-o);else if(c===Nh)m=-l/(l-o),M=-l*o/(l-o);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+c);return u[0]=f,u[4]=0,u[8]=g,u[12]=0,u[1]=0,u[5]=d,u[9]=p,u[13]=0,u[2]=0,u[6]=0,u[10]=m,u[14]=M,u[3]=0,u[7]=0,u[11]=-1,u[15]=0,this}makeOrthographic(t,e,n,i,o,l,c=gs){let u=this.elements,f=1/(e-t),d=1/(n-i),g=1/(l-o),p=(e+t)*f,m=(n+i)*d,M,y;if(c===gs)M=(l+o)*g,y=-2*g;else if(c===Nh)M=o*g,y=-1*g;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+c);return u[0]=2*f,u[4]=0,u[8]=0,u[12]=-p,u[1]=0,u[5]=2*d,u[9]=0,u[13]=-m,u[2]=0,u[6]=0,u[10]=y,u[14]=-M,u[3]=0,u[7]=0,u[11]=0,u[15]=1,this}equals(t){let e=this.elements,n=t.elements;for(let i=0;i<16;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){let n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}},Fa=new tt,Sr=new Ln,MP=new tt(0,0,0),SP=new tt(1,1,1),Zs=new tt,sh=new tt,qi=new tt,ty=new Ln,ey=new no,xs=class r{constructor(t=0,e=0,n=0,i=r.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){let i=t.elements,o=i[0],l=i[4],c=i[8],u=i[1],f=i[5],d=i[9],g=i[2],p=i[6],m=i[10];switch(e){case"XYZ":this._y=Math.asin(Pi(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-d,m),this._z=Math.atan2(-l,o)):(this._x=Math.atan2(p,f),this._z=0);break;case"YXZ":this._x=Math.asin(-Pi(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(c,m),this._z=Math.atan2(u,f)):(this._y=Math.atan2(-g,o),this._z=0);break;case"ZXY":this._x=Math.asin(Pi(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-g,m),this._z=Math.atan2(-l,f)):(this._y=0,this._z=Math.atan2(u,o));break;case"ZYX":this._y=Math.asin(-Pi(g,-1,1)),Math.abs(g)<.9999999?(this._x=Math.atan2(p,m),this._z=Math.atan2(u,o)):(this._x=0,this._z=Math.atan2(-l,f));break;case"YZX":this._z=Math.asin(Pi(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(-d,f),this._y=Math.atan2(-g,o)):(this._x=0,this._y=Math.atan2(c,m));break;case"XZY":this._z=Math.asin(-Pi(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(p,f),this._y=Math.atan2(c,o)):(this._x=Math.atan2(-d,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,n===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return ty.makeRotationFromQuaternion(t),this.setFromRotationMatrix(ty,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return ey.setFromEuler(this),this.setFromQuaternion(ey,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};xs.DEFAULT_ORDER="XYZ";var kh=class{constructor(){this.mask=1}set(t){this.mask=(1<>>0}enable(t){this.mask|=1<1){for(let e=0;e1){for(let n=0;n0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(c=>({boxInitialized:c.boxInitialized,boxMin:c.box.min.toArray(),boxMax:c.box.max.toArray(),sphereInitialized:c.sphereInitialized,sphereRadius:c.sphere.radius,sphereCenter:c.sphere.center.toArray()})),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(t),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function o(c,u){return c[u.uuid]===void 0&&(c[u.uuid]=u.toJSON(t)),u.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=o(t.geometries,this.geometry);let c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){let u=c.shapes;if(Array.isArray(u))for(let f=0,d=u.length;f0){i.children=[];for(let c=0;c0){i.animations=[];for(let c=0;c0&&(n.geometries=c),u.length>0&&(n.materials=u),f.length>0&&(n.textures=f),d.length>0&&(n.images=d),g.length>0&&(n.shapes=g),p.length>0&&(n.skeletons=p),m.length>0&&(n.animations=m),M.length>0&&(n.nodes=M)}return n.object=i,n;function l(c){let u=[];for(let f in c){let d=c[f];delete d.metadata,u.push(d)}return u}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let n=0;n0?i.multiplyScalar(1/Math.sqrt(o)):i.set(0,0,0)}static getBarycoord(t,e,n,i,o){wr.subVectors(i,e),us.subVectors(n,e),Gp.subVectors(t,e);let l=wr.dot(wr),c=wr.dot(us),u=wr.dot(Gp),f=us.dot(us),d=us.dot(Gp),g=l*f-c*c;if(g===0)return o.set(0,0,0),null;let p=1/g,m=(f*u-c*d)*p,M=(l*d-c*u)*p;return o.set(1-m-M,M,m)}static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,hs)===null?!1:hs.x>=0&&hs.y>=0&&hs.x+hs.y<=1}static getInterpolation(t,e,n,i,o,l,c,u){return this.getBarycoord(t,e,n,i,hs)===null?(u.x=0,u.y=0,"z"in u&&(u.z=0),"w"in u&&(u.w=0),null):(u.setScalar(0),u.addScaledVector(o,hs.x),u.addScaledVector(l,hs.y),u.addScaledVector(c,hs.z),u)}static isFrontFacing(t,e,n,i){return wr.subVectors(n,e),us.subVectors(t,e),wr.cross(us).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return wr.subVectors(this.c,this.b),us.subVectors(this.a,this.b),wr.cross(us).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return r.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return r.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,i,o){return r.getInterpolation(t,this.a,this.b,this.c,e,n,i,o)}containsPoint(t){return r.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return r.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let n=this.a,i=this.b,o=this.c,l,c;ka.subVectors(i,n),Ha.subVectors(o,n),Wp.subVectors(t,n);let u=ka.dot(Wp),f=Ha.dot(Wp);if(u<=0&&f<=0)return e.copy(n);Xp.subVectors(t,i);let d=ka.dot(Xp),g=Ha.dot(Xp);if(d>=0&&g<=d)return e.copy(i);let p=u*g-d*f;if(p<=0&&u>=0&&d<=0)return l=u/(u-d),e.copy(n).addScaledVector(ka,l);qp.subVectors(t,o);let m=ka.dot(qp),M=Ha.dot(qp);if(M>=0&&m<=M)return e.copy(o);let y=m*f-u*M;if(y<=0&&f>=0&&M<=0)return c=f/(f-M),e.copy(n).addScaledVector(Ha,c);let v=d*M-m*g;if(v<=0&&g-d>=0&&m-M>=0)return ay.subVectors(o,i),c=(g-d)/(g-d+(m-M)),e.copy(i).addScaledVector(ay,c);let x=1/(v+y+p);return l=y*x,c=p*x,e.copy(n).addScaledVector(ka,l).addScaledVector(Ha,c)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},nM={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},$s={h:0,s:0,l:0},ah={h:0,s:0,l:0};function Yp(r,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?r+(t-r)*6*e:e<1/2?t:e<2/3?r+(t-r)*6*(2/3-e):r}var ke=class{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(e===void 0&&n===void 0){let i=t;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=kr){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,qe.toWorkingColorSpace(this,e),this}setRGB(t,e,n,i=qe.workingColorSpace){return this.r=t,this.g=e,this.b=n,qe.toWorkingColorSpace(this,i),this}setHSL(t,e,n,i=qe.workingColorSpace){if(t=pP(t,1),e=Pi(e,0,1),n=Pi(n,0,1),e===0)this.r=this.g=this.b=n;else{let o=n<=.5?n*(1+e):n+e-n*e,l=2*n-o;this.r=Yp(l,o,t+1/3),this.g=Yp(l,o,t),this.b=Yp(l,o,t-1/3)}return qe.toWorkingColorSpace(this,i),this}setStyle(t,e=kr){function n(o){o!==void 0&&parseFloat(o)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(t)){let o,l=i[1],c=i[2];switch(l){case"rgb":case"rgba":if(o=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setRGB(Math.min(255,parseInt(o[1],10))/255,Math.min(255,parseInt(o[2],10))/255,Math.min(255,parseInt(o[3],10))/255,e);if(o=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setRGB(Math.min(100,parseInt(o[1],10))/100,Math.min(100,parseInt(o[2],10))/100,Math.min(100,parseInt(o[3],10))/100,e);break;case"hsl":case"hsla":if(o=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(c))return n(o[4]),this.setHSL(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){let o=i[1],l=o.length;if(l===3)return this.setRGB(parseInt(o.charAt(0),16)/15,parseInt(o.charAt(1),16)/15,parseInt(o.charAt(2),16)/15,e);if(l===6)return this.setHex(parseInt(o,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=kr){let n=nM[t.toLowerCase()];return n!==void 0?this.setHex(n,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=tl(t.r),this.g=tl(t.g),this.b=tl(t.b),this}copyLinearToSRGB(t){return this.r=Up(t.r),this.g=Up(t.g),this.b=Up(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=kr){return qe.fromWorkingColorSpace(ii.copy(this),t),Math.round(Pi(ii.r*255,0,255))*65536+Math.round(Pi(ii.g*255,0,255))*256+Math.round(Pi(ii.b*255,0,255))}getHexString(t=kr){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=qe.workingColorSpace){qe.fromWorkingColorSpace(ii.copy(this),e);let n=ii.r,i=ii.g,o=ii.b,l=Math.max(n,i,o),c=Math.min(n,i,o),u,f,d=(c+l)/2;if(c===l)u=0,f=0;else{let g=l-c;switch(f=d<=.5?g/(l+c):g/(2-l-c),l){case n:u=(i-o)/g+(i0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(let e in t){let n=t[e];if(n===void 0){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}let i=this[e];if(i===void 0){console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n}}toJSON(t){let e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});let n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Qa&&(n.blending=this.blending),this.side!==to&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==im&&(n.blendSrc=this.blendSrc),this.blendDst!==rm&&(n.blendDst=this.blendDst),this.blendEquation!==Go&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Ph&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Yx&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==La&&(n.stencilFail=this.stencilFail),this.stencilZFail!==La&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==La&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(o){let l=[];for(let c in o){let u=o[c];delete u.metadata,l.push(u)}return l}if(e){let o=i(t.textures),l=i(t.images);o.length>0&&(n.textures=o),l.length>0&&(n.images=l)}return n}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;let e=t.clippingPlanes,n=null;if(e!==null){let i=e.length;n=new Array(i);for(let o=0;o!==i;++o)n[o]=e[o].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}},Hh=class extends $o{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ke(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 xs,this.combine=Vy,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}};var An=new tt,lh=new Pe,Li=class{constructor(t,e,n=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=n,this.usage=Zx,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=ms,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return _c("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,o=this.itemSize;i0&&(t.userData=this.userData),this.parameters!==void 0){let u=this.parameters;for(let f in u)u[f]!==void 0&&(t[f]=u[f]);return t}t.data={attributes:{}};let e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let n=this.attributes;for(let u in n){let f=n[u];t.data.attributes[u]=f.toJSON(t.data)}let i={},o=!1;for(let u in this.morphAttributes){let f=this.morphAttributes[u],d=[];for(let g=0,p=f.length;g0&&(i[u]=d,o=!0)}o&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);let l=this.groups;l.length>0&&(t.data.groups=JSON.parse(JSON.stringify(l)));let c=this.boundingSphere;return c!==null&&(t.data.boundingSphere={center:c.center.toArray(),radius:c.radius}),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let n=t.index;n!==null&&this.setIndex(n.clone(e));let i=t.attributes;for(let f in i){let d=i[f];this.setAttribute(f,d.clone(e))}let o=t.morphAttributes;for(let f in o){let d=[],g=o[f];for(let p=0,m=g.length;p0){let i=e[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;o(t.far-t.near)**2))&&(ly.copy(o).invert(),zo.copy(t.ray).applyMatrix4(ly),!(n.boundingBox!==null&&zo.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(t,e,zo)))}_computeIntersections(t,e,n){let i,o=this.geometry,l=this.material,c=o.index,u=o.attributes.position,f=o.attributes.uv,d=o.attributes.uv1,g=o.attributes.normal,p=o.groups,m=o.drawRange;if(c!==null)if(Array.isArray(l))for(let M=0,y=p.length;Me.far?null:{distance:f,point:mh.clone(),object:r}}function gh(r,t,e,n,i,o,l,c,u,f){r.getVertexPosition(c,Ga),r.getVertexPosition(u,Wa),r.getVertexPosition(f,Xa);let d=RP(r,t,e,n,Ga,Wa,Xa,ph);if(d){i&&(hh.fromBufferAttribute(i,c),fh.fromBufferAttribute(i,u),dh.fromBufferAttribute(i,f),d.uv=$a.getInterpolation(ph,Ga,Wa,Xa,hh,fh,dh,new Pe)),o&&(hh.fromBufferAttribute(o,c),fh.fromBufferAttribute(o,u),dh.fromBufferAttribute(o,f),d.uv1=$a.getInterpolation(ph,Ga,Wa,Xa,hh,fh,dh,new Pe)),l&&(uy.fromBufferAttribute(l,c),hy.fromBufferAttribute(l,u),fy.fromBufferAttribute(l,f),d.normal=$a.getInterpolation(ph,Ga,Wa,Xa,uy,hy,fy,new tt),d.normal.dot(n.direction)>0&&d.normal.multiplyScalar(-1));let g={a:c,b:u,c:f,normal:new tt,materialIndex:0};$a.getNormal(Ga,Wa,Xa,g.normal),d.face=g}return d}var yc=class r extends ys{constructor(t=1,e=1,n=1,i=1,o=1,l=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:o,depthSegments:l};let c=this;i=Math.floor(i),o=Math.floor(o),l=Math.floor(l);let u=[],f=[],d=[],g=[],p=0,m=0;M("z","y","x",-1,-1,n,e,t,l,o,0),M("z","y","x",1,-1,n,e,-t,l,o,1),M("x","z","y",1,1,t,n,e,i,l,2),M("x","z","y",1,-1,t,n,-e,i,l,3),M("x","y","z",1,-1,t,e,n,i,o,4),M("x","y","z",-1,-1,t,e,-n,i,o,5),this.setIndex(u),this.setAttribute("position",new Di(f,3)),this.setAttribute("normal",new Di(d,3)),this.setAttribute("uv",new Di(g,2));function M(y,v,x,E,b,T,U,L,I,N,A){let w=T/I,B=U/N,V=T/2,Z=U/2,j=L/2,rt=I+1,$=N+1,nt=0,K=0,gt=new tt;for(let z=0;z<$;z++){let bt=z*B-Z;for(let jt=0;jt0?1:-1,d.push(gt.x,gt.y,gt.z),g.push(jt/I),g.push(1-z/N),nt+=1}}for(let z=0;z0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;let n={};for(let i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}},Wh=class extends dr{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ln,this.projectionMatrix=new Ln,this.projectionMatrixInverse=new Ln,this.coordinateSystem=gs}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}},Js=new tt,dy=new Pe,py=new Pe,qn=class extends Wh{constructor(t=50,e=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=t.view===null?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){let e=.5*this.getFilmHeight()/t;this.fov=Om*2*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){let t=Math.tan(Ip*.5*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return Om*2*Math.atan(Math.tan(Ip*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,n){Js.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(Js.x,Js.y).multiplyScalar(-t/Js.z),Js.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Js.x,Js.y).multiplyScalar(-t/Js.z)}getViewSize(t,e){return this.getViewBounds(t,dy,py),e.subVectors(py,dy)}setViewOffset(t,e,n,i,o,l){this.aspect=t/e,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=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=o,this.view.height=l,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=this.near,e=t*Math.tan(Ip*.5*this.fov)/this.zoom,n=2*e,i=this.aspect*n,o=-.5*i,l=this.view;if(this.view!==null&&this.view.enabled){let u=l.fullWidth,f=l.fullHeight;o+=l.offsetX*i/u,e-=l.offsetY*n/f,i*=l.width/u,n*=l.height/f}let c=this.filmOffset;c!==0&&(o+=t*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(o,o+i,e,e-n,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,this.view!==null&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}},qa=-90,Ya=1,km=class extends dr{constructor(t,e,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let i=new qn(qa,Ya,t,e);i.layers=this.layers,this.add(i);let o=new qn(qa,Ya,t,e);o.layers=this.layers,this.add(o);let l=new qn(qa,Ya,t,e);l.layers=this.layers,this.add(l);let c=new qn(qa,Ya,t,e);c.layers=this.layers,this.add(c);let u=new qn(qa,Ya,t,e);u.layers=this.layers,this.add(u);let f=new qn(qa,Ya,t,e);f.layers=this.layers,this.add(f)}updateCoordinateSystem(){let t=this.coordinateSystem,e=this.children.concat(),[n,i,o,l,c,u]=e;for(let f of e)this.remove(f);if(t===gs)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),o.up.set(0,0,-1),o.lookAt(0,1,0),l.up.set(0,0,1),l.lookAt(0,-1,0),c.up.set(0,1,0),c.lookAt(0,0,1),u.up.set(0,1,0),u.lookAt(0,0,-1);else if(t===Nh)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),o.up.set(0,0,1),o.lookAt(0,1,0),l.up.set(0,0,-1),l.lookAt(0,-1,0),c.up.set(0,-1,0),c.lookAt(0,0,1),u.up.set(0,-1,0),u.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(let f of e)this.add(f),f.updateMatrixWorld()}update(t,e){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());let[o,l,c,u,f,d]=this.children,g=t.getRenderTarget(),p=t.getActiveCubeFace(),m=t.getActiveMipmapLevel(),M=t.xr.enabled;t.xr.enabled=!1;let y=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0,i),t.render(e,o),t.setRenderTarget(n,1,i),t.render(e,l),t.setRenderTarget(n,2,i),t.render(e,c),t.setRenderTarget(n,3,i),t.render(e,u),t.setRenderTarget(n,4,i),t.render(e,f),n.texture.generateMipmaps=y,t.setRenderTarget(n,5,i),t.render(e,d),t.setRenderTarget(g,p,m),t.xr.enabled=M,n.texture.needsPMREMUpdate=!0}},Xh=class extends fr{constructor(t,e,n,i,o,l,c,u,f,d){t=t!==void 0?t:[],e=e!==void 0?e:nl,super(t,e,n,i,o,l,c,u,f,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}},Hm=class extends vs{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;let n={width:t,height:t,depth:1},i=[n,n,n,n,n,n];this.texture=new Xh(i,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=e.generateMipmaps!==void 0?e.generateMipmaps:!1,this.texture.minFilter=e.minFilter!==void 0?e.minFilter:br}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; vec3 transformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include } `,fragmentShader:` uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); } `},i=new yc(5,5,5),o=new Ui({name:"CubemapFromEquirect",uniforms:al(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Ii,blending:Qs});o.uniforms.tEquirect.value=e;let l=new Er(i,o),c=e.minFilter;return e.minFilter===qo&&(e.minFilter=br),new km(1,10,this).update(t,l),e.minFilter=c,l.geometry.dispose(),l.material.dispose(),this}clear(t,e,n,i){let o=t.getRenderTarget();for(let l=0;l<6;l++)t.setRenderTarget(this,l),t.clear(e,n,i);t.setRenderTarget(o)}},Jp=new tt,UP=new tt,NP=new Se,ds=class{constructor(t=new tt(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){let i=Jp.subVectors(n,e).cross(UP.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){let t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){let n=t.delta(Jp),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;let o=-(t.start.dot(this.normal)+this.constant)/i;return o<0||o>1?null:e.copy(t.start).addScaledVector(n,o)}intersectsLine(t){let e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let n=e||NP.getNormalMatrix(t),i=this.coplanarPoint(Jp).applyMatrix4(t),o=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(o),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}},Bo=new ol,_h=new tt,qh=class{constructor(t=new ds,e=new ds,n=new ds,i=new ds,o=new ds,l=new ds){this.planes=[t,e,n,i,o,l]}set(t,e,n,i,o,l){let c=this.planes;return c[0].copy(t),c[1].copy(e),c[2].copy(n),c[3].copy(i),c[4].copy(o),c[5].copy(l),this}copy(t){let e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t,e=gs){let n=this.planes,i=t.elements,o=i[0],l=i[1],c=i[2],u=i[3],f=i[4],d=i[5],g=i[6],p=i[7],m=i[8],M=i[9],y=i[10],v=i[11],x=i[12],E=i[13],b=i[14],T=i[15];if(n[0].setComponents(u-o,p-f,v-m,T-x).normalize(),n[1].setComponents(u+o,p+f,v+m,T+x).normalize(),n[2].setComponents(u+l,p+d,v+M,T+E).normalize(),n[3].setComponents(u-l,p-d,v-M,T-E).normalize(),n[4].setComponents(u-c,p-g,v-y,T-b).normalize(),e===gs)n[5].setComponents(u+c,p+g,v+y,T+b).normalize();else if(e===Nh)n[5].setComponents(c,g,y,b).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),Bo.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{let e=t.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),Bo.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Bo)}intersectsSprite(t){return Bo.center.set(0,0,0),Bo.radius=.7071067811865476,Bo.applyMatrix4(t.matrixWorld),this.intersectsSphere(Bo)}intersectsSphere(t){let e=this.planes,n=t.center,i=-t.radius;for(let o=0;o<6;o++)if(e[o].distanceToPoint(n)0?t.max.x:t.min.x,_h.y=i.normal.y>0?t.max.y:t.min.y,_h.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(_h)<0)return!1}return!0}containsPoint(t){let e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};function rM(){let r=null,t=!1,e=null,n=null;function i(o,l){e(o,l),n=r.requestAnimationFrame(i)}return{start:function(){t!==!0&&e!==null&&(n=r.requestAnimationFrame(i),t=!0)},stop:function(){r.cancelAnimationFrame(n),t=!1},setAnimationLoop:function(o){e=o},setContext:function(o){r=o}}}function OP(r){let t=new WeakMap;function e(c,u){let f=c.array,d=c.usage,g=f.byteLength,p=r.createBuffer();r.bindBuffer(u,p),r.bufferData(u,f,d),c.onUploadCallback();let m;if(f instanceof Float32Array)m=r.FLOAT;else if(f instanceof Uint16Array)c.isFloat16BufferAttribute?m=r.HALF_FLOAT:m=r.UNSIGNED_SHORT;else if(f instanceof Int16Array)m=r.SHORT;else if(f instanceof Uint32Array)m=r.UNSIGNED_INT;else if(f instanceof Int32Array)m=r.INT;else if(f instanceof Int8Array)m=r.BYTE;else if(f instanceof Uint8Array)m=r.UNSIGNED_BYTE;else if(f instanceof Uint8ClampedArray)m=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:p,type:m,bytesPerElement:f.BYTES_PER_ELEMENT,version:c.version,size:g}}function n(c,u,f){let d=u.array,g=u._updateRange,p=u.updateRanges;if(r.bindBuffer(f,c),g.count===-1&&p.length===0&&r.bufferSubData(f,0,d),p.length!==0){for(let m=0,M=p.length;m 0 vec4 plane; #ifdef ALPHA_TO_COVERAGE float distanceToPlane, distanceGradient; float clipOpacity = 1.0; #pragma unroll_loop_start for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; distanceGradient = fwidth( distanceToPlane ) / 2.0; clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); if ( clipOpacity == 0.0 ) discard; } #pragma unroll_loop_end #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES float unionClipOpacity = 1.0; #pragma unroll_loop_start for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; distanceGradient = fwidth( distanceToPlane ) / 2.0; unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); } #pragma unroll_loop_end clipOpacity *= 1.0 - unionClipOpacity; #endif diffuseColor.a *= clipOpacity; if ( diffuseColor.a == 0.0 ) discard; #else #pragma unroll_loop_start for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; } #pragma unroll_loop_end #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES bool clipped = true; #pragma unroll_loop_start for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; } #pragma unroll_loop_end if ( clipped ) discard; #endif #endif #endif`,jP=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`,tI=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; #endif`,eI=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; #endif`,nI=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; #endif`,iI=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; #endif`,rI=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) varying vec3 vColor; #endif`,sI=`#if defined( USE_COLOR_ALPHA ) vColor = vec4( 1.0 ); #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) vColor = vec3( 1.0 ); #endif #ifdef USE_COLOR vColor *= color; #endif #ifdef USE_INSTANCING_COLOR vColor.xyz *= instanceColor.xyz; #endif #ifdef USE_BATCHING_COLOR vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); vColor.xyz *= batchingColor.xyz; #endif`,oI=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 #define RECIPROCAL_PI2 0.15915494309189535 #define EPSILON 1e-6 #ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif #define whiteComplement( a ) ( 1.0 - saturate( a ) ) float pow2( const in float x ) { return x*x; } vec3 pow2( const in vec3 x ) { return x*x; } float pow3( const in float x ) { return x*x*x; } float pow4( const in float x ) { float x2 = x*x; return x2*x2; } float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } highp float rand( const in vec2 uv ) { const highp float a = 12.9898, b = 78.233, c = 43758.5453; highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); return fract( sin( sn ) * c ); } #ifdef HIGH_PRECISION float precisionSafeLength( vec3 v ) { return length( v ); } #else float precisionSafeLength( vec3 v ) { float maxComponent = max3( abs( v ) ); return length( v / maxComponent ) * maxComponent; } #endif struct IncidentLight { vec3 color; vec3 direction; bool visible; }; struct ReflectedLight { vec3 directDiffuse; vec3 directSpecular; vec3 indirectDiffuse; vec3 indirectSpecular; }; #ifdef USE_ALPHAHASH varying vec3 vPosition; #endif vec3 transformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); } mat3 transposeMat3( const in mat3 m ) { mat3 tmp; tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); return tmp; } bool isPerspectiveMatrix( mat4 m ) { return m[ 2 ][ 3 ] == - 1.0; } vec2 equirectUv( in vec3 dir ) { float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; return vec2( u, v ); } vec3 BRDF_Lambert( const in vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor; } vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); } float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); } // validated`,aI=`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_minMipLevel 4.0 #define cubeUV_minTileSize 16.0 float getFace( vec3 direction ) { vec3 absDirection = abs( direction ); float face = - 1.0; if ( absDirection.x > absDirection.z ) { if ( absDirection.x > absDirection.y ) face = direction.x > 0.0 ? 0.0 : 3.0; else face = direction.y > 0.0 ? 1.0 : 4.0; } else { if ( absDirection.z > absDirection.y ) face = direction.z > 0.0 ? 2.0 : 5.0; else face = direction.y > 0.0 ? 1.0 : 4.0; } return face; } vec2 getUV( vec3 direction, float face ) { vec2 uv; if ( face == 0.0 ) { uv = vec2( direction.z, direction.y ) / abs( direction.x ); } else if ( face == 1.0 ) { uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); } else if ( face == 2.0 ) { uv = vec2( - direction.x, direction.y ) / abs( direction.z ); } else if ( face == 3.0 ) { uv = vec2( - direction.z, direction.y ) / abs( direction.x ); } else if ( face == 4.0 ) { uv = vec2( - direction.x, direction.z ) / abs( direction.y ); } else { uv = vec2( direction.x, direction.y ) / abs( direction.z ); } return 0.5 * ( uv + 1.0 ); } vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { float face = getFace( direction ); float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); mipInt = max( mipInt, cubeUV_minMipLevel ); float faceSize = exp2( mipInt ); highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; if ( face > 2.0 ) { uv.y += faceSize; face -= 3.0; } uv.x += face * faceSize; uv.x += filterInt * 3.0 * cubeUV_minTileSize; uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); uv.x *= CUBEUV_TEXEL_WIDTH; uv.y *= CUBEUV_TEXEL_HEIGHT; #ifdef texture2DGradEXT return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; #else return texture2D( envMap, uv ).rgb; #endif } #define cubeUV_r0 1.0 #define cubeUV_m0 - 2.0 #define cubeUV_r1 0.8 #define cubeUV_m1 - 1.0 #define cubeUV_r4 0.4 #define cubeUV_m4 2.0 #define cubeUV_r5 0.305 #define cubeUV_m5 3.0 #define cubeUV_r6 0.21 #define cubeUV_m6 4.0 float roughnessToMip( float roughness ) { float mip = 0.0; if ( roughness >= cubeUV_r1 ) { mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; } else if ( roughness >= cubeUV_r4 ) { mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; } else if ( roughness >= cubeUV_r5 ) { mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; } else if ( roughness >= cubeUV_r6 ) { mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; } else { mip = - 2.0 * log2( 1.16 * roughness ); } return mip; } vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); float mipF = fract( mip ); float mipInt = floor( mip ); vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); if ( mipF == 0.0 ) { return vec4( color0, 1.0 ); } else { vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); return vec4( mix( color0, color1, mipF ), 1.0 ); } } #endif`,lI=`vec3 transformedNormal = objectNormal; #ifdef USE_TANGENT vec3 transformedTangent = objectTangent; #endif #ifdef USE_BATCHING mat3 bm = mat3( batchingMatrix ); transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); transformedNormal = bm * transformedNormal; #ifdef USE_TANGENT transformedTangent = bm * transformedTangent; #endif #endif #ifdef USE_INSTANCING mat3 im = mat3( instanceMatrix ); transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); transformedNormal = im * transformedNormal; #ifdef USE_TANGENT transformedTangent = im * transformedTangent; #endif #endif transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedNormal = - transformedNormal; #endif #ifdef USE_TANGENT transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif #endif`,cI=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; #endif`,uI=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); #endif`,hI=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); totalEmissiveRadiance *= emissiveColor.rgb; #endif`,fI=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; #endif`,dI="gl_FragColor = linearToOutputTexel( gl_FragColor );",pI=` const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( vec3( 0.8224621, 0.177538, 0.0 ), vec3( 0.0331941, 0.9668058, 0.0 ), vec3( 0.0170827, 0.0723974, 0.9105199 ) ); const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3( vec3( 1.2249401, - 0.2249404, 0.0 ), vec3( - 0.0420569, 1.0420571, 0.0 ), vec3( - 0.0196376, - 0.0786361, 1.0982735 ) ); vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) { return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a ); } vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) { return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a ); } vec4 LinearTransferOETF( in vec4 value ) { return value; } vec4 sRGBTransferOETF( in vec4 value ) { return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); }`,mI=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); } else { cameraToFrag = normalize( vWorldPosition - cameraPosition ); } vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); #ifdef ENVMAP_MODE_REFLECTION vec3 reflectVec = reflect( cameraToFrag, worldNormal ); #else vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); #endif #else vec3 reflectVec = vReflect; #endif #ifdef ENVMAP_TYPE_CUBE vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); #else vec4 envColor = vec4( 0.0 ); #endif #ifdef ENVMAP_BLENDING_MULTIPLY outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); #elif defined( ENVMAP_BLENDING_MIX ) outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif #endif`,gI=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; uniform mat3 envMapRotation; #ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #else uniform sampler2D envMap; #endif #endif`,_I=`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif #ifdef ENV_WORLDPOS varying vec3 vWorldPosition; uniform float refractionRatio; #else varying vec3 vReflect; #endif #endif`,vI=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif #ifdef ENV_WORLDPOS varying vec3 vWorldPosition; #else varying vec3 vReflect; uniform float refractionRatio; #endif #endif`,xI=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else vec3 cameraToVertex; if ( isOrthographic ) { cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); } else { cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); } vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); #ifdef ENVMAP_MODE_REFLECTION vReflect = reflect( cameraToVertex, worldNormal ); #else vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif #endif`,yI=`#ifdef USE_FOG vFogDepth = - mvPosition.z; #endif`,MI=`#ifdef USE_FOG varying float vFogDepth; #endif`,SI=`#ifdef USE_FOG #ifdef FOG_EXP2 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); #else float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); #endif gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); #endif`,wI=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 uniform float fogDensity; #else uniform float fogNear; uniform float fogFar; #endif #endif`,bI=`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { float dotNL = dot( normal, lightDirection ); vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); #ifdef USE_GRADIENTMAP return vec3( texture2D( gradientMap, coord ).r ); #else vec2 fw = fwidth( coord ) * 0.5; return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); #endif }`,TI=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; #endif`,EI=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularStrength = specularStrength;`,AI=`varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; }; void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Lambert #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,CI=`uniform bool receiveShadow; uniform vec3 ambientLightColor; #if defined( USE_LIGHT_PROBES ) uniform vec3 lightProbe[ 9 ]; #endif vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { float x = normal.x, y = normal.y, z = normal.z; vec3 result = shCoefficients[ 0 ] * 0.886227; result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); return result; } vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); return irradiance; } vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { vec3 irradiance = ambientLightColor; return irradiance; } float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); if ( cutoffDistance > 0.0 ) { distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); } return distanceFalloff; } float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { return smoothstep( coneCosine, penumbraCosine, angleCosine ); } #if NUM_DIR_LIGHTS > 0 struct DirectionalLight { vec3 direction; vec3 color; }; uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { light.color = directionalLight.color; light.direction = directionalLight.direction; light.visible = true; } #endif #if NUM_POINT_LIGHTS > 0 struct PointLight { vec3 position; vec3 color; float distance; float decay; }; uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { vec3 lVector = pointLight.position - geometryPosition; light.direction = normalize( lVector ); float lightDistance = length( lVector ); light.color = pointLight.color; light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); light.visible = ( light.color != vec3( 0.0 ) ); } #endif #if NUM_SPOT_LIGHTS > 0 struct SpotLight { vec3 position; vec3 direction; vec3 color; float distance; float decay; float coneCos; float penumbraCos; }; uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { vec3 lVector = spotLight.position - geometryPosition; light.direction = normalize( lVector ); float angleCos = dot( light.direction, spotLight.direction ); float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); if ( spotAttenuation > 0.0 ) { float lightDistance = length( lVector ); light.color = spotLight.color * spotAttenuation; light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); light.visible = ( light.color != vec3( 0.0 ) ); } else { light.color = vec3( 0.0 ); light.visible = false; } } #endif #if NUM_RECT_AREA_LIGHTS > 0 struct RectAreaLight { vec3 color; vec3 position; vec3 halfWidth; vec3 halfHeight; }; uniform sampler2D ltc_1; uniform sampler2D ltc_2; uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; #endif #if NUM_HEMI_LIGHTS > 0 struct HemisphereLight { vec3 direction; vec3 skyColor; vec3 groundColor; }; uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { float dotNL = dot( normal, hemiLight.direction ); float hemiDiffuseWeight = 0.5 * dotNL + 0.5; vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); return irradiance; } #endif`,RI=`#ifdef USE_ENVMAP vec3 getIBLIrradiance( const in vec3 normal ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); return PI * envMapColor.rgb * envMapIntensity; #else return vec3( 0.0 ); #endif } vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 reflectVec = reflect( - viewDir, normal ); reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); return envMapColor.rgb * envMapIntensity; #else return vec3( 0.0 ); #endif } #ifdef USE_ANISOTROPY vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 bentNormal = cross( bitangent, viewDir ); bentNormal = normalize( cross( bentNormal, bitangent ) ); bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); return getIBLRadiance( viewDir, bentNormal, roughness ); #else return vec3( 0.0 ); #endif } #endif #endif`,PI=`ToonMaterial material; material.diffuseColor = diffuseColor.rgb;`,II=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,LI=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; material.specularStrength = specularStrength;`,DI=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; float specularShininess; float specularStrength; }; void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; } void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,UI=`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; material.roughness = min( material.roughness, 1.0 ); #ifdef IOR material.ior = ior; #ifdef USE_SPECULAR float specularIntensityFactor = specularIntensity; vec3 specularColorFactor = specularColor; #ifdef USE_SPECULAR_COLORMAP specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; #endif #ifdef USE_SPECULAR_INTENSITYMAP specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; #endif material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); #else float specularIntensityFactor = 1.0; vec3 specularColorFactor = vec3( 1.0 ); material.specularF90 = 1.0; #endif material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); #else material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); material.specularF90 = 1.0; #endif #ifdef USE_CLEARCOAT material.clearcoat = clearcoat; material.clearcoatRoughness = clearcoatRoughness; material.clearcoatF0 = vec3( 0.04 ); material.clearcoatF90 = 1.0; #ifdef USE_CLEARCOATMAP material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; #endif material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); material.clearcoatRoughness += geometryRoughness; material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); #endif #ifdef USE_DISPERSION material.dispersion = dispersion; #endif #ifdef USE_IRIDESCENCE material.iridescence = iridescence; material.iridescenceIOR = iridescenceIOR; #ifdef USE_IRIDESCENCEMAP material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; #else material.iridescenceThickness = iridescenceThicknessMaximum; #endif #endif #ifdef USE_SHEEN material.sheenColor = sheenColor; #ifdef USE_SHEEN_COLORMAP material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; #endif material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); #ifdef USE_SHEEN_ROUGHNESSMAP material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; #endif #endif #ifdef USE_ANISOTROPY #ifdef USE_ANISOTROPYMAP mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; #else vec2 anisotropyV = anisotropyVector; #endif material.anisotropy = length( anisotropyV ); if( material.anisotropy == 0.0 ) { anisotropyV = vec2( 1.0, 0.0 ); } else { anisotropyV /= material.anisotropy; material.anisotropy = saturate( material.anisotropy ); } material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; #endif`,NI=`struct PhysicalMaterial { vec3 diffuseColor; float roughness; vec3 specularColor; float specularF90; float dispersion; #ifdef USE_CLEARCOAT float clearcoat; float clearcoatRoughness; vec3 clearcoatF0; float clearcoatF90; #endif #ifdef USE_IRIDESCENCE float iridescence; float iridescenceIOR; float iridescenceThickness; vec3 iridescenceFresnel; vec3 iridescenceF0; #endif #ifdef USE_SHEEN vec3 sheenColor; float sheenRoughness; #endif #ifdef IOR float ior; #endif #ifdef USE_TRANSMISSION float transmission; float transmissionAlpha; float thickness; float attenuationDistance; vec3 attenuationColor; #endif #ifdef USE_ANISOTROPY float anisotropy; float alphaT; vec3 anisotropyT; vec3 anisotropyB; #endif }; vec3 clearcoatSpecularDirect = vec3( 0.0 ); vec3 clearcoatSpecularIndirect = vec3( 0.0 ); vec3 sheenSpecularDirect = vec3( 0.0 ); vec3 sheenSpecularIndirect = vec3(0.0 ); vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); float x2 = x * x; float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); } float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { float a2 = pow2( alpha ); float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); return 0.5 / max( gv + gl, EPSILON ); } float D_GGX( const in float alpha, const in float dotNH ) { float a2 = pow2( alpha ); float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; return RECIPROCAL_PI * a2 / pow2( denom ); } #ifdef USE_ANISOTROPY float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); float v = 0.5 / ( gv + gl ); return saturate(v); } float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { float a2 = alphaT * alphaB; highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); highp float v2 = dot( v, v ); float w2 = a2 / v2; return RECIPROCAL_PI * a2 * pow2 ( w2 ); } #endif #ifdef USE_CLEARCOAT vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { vec3 f0 = material.clearcoatF0; float f90 = material.clearcoatF90; float roughness = material.clearcoatRoughness; float alpha = pow2( roughness ); vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float dotVH = saturate( dot( viewDir, halfDir ) ); vec3 F = F_Schlick( f0, f90, dotVH ); float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); float D = D_GGX( alpha, dotNH ); return F * ( V * D ); } #endif vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { vec3 f0 = material.specularColor; float f90 = material.specularF90; float roughness = material.roughness; float alpha = pow2( roughness ); vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float dotVH = saturate( dot( viewDir, halfDir ) ); vec3 F = F_Schlick( f0, f90, dotVH ); #ifdef USE_IRIDESCENCE F = mix( F, material.iridescenceFresnel, material.iridescence ); #endif #ifdef USE_ANISOTROPY float dotTL = dot( material.anisotropyT, lightDir ); float dotTV = dot( material.anisotropyT, viewDir ); float dotTH = dot( material.anisotropyT, halfDir ); float dotBL = dot( material.anisotropyB, lightDir ); float dotBV = dot( material.anisotropyB, viewDir ); float dotBH = dot( material.anisotropyB, halfDir ); float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); #else float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); float D = D_GGX( alpha, dotNH ); #endif return F * ( V * D ); } vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { const float LUT_SIZE = 64.0; const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; const float LUT_BIAS = 0.5 / LUT_SIZE; float dotNV = saturate( dot( N, V ) ); vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); uv = uv * LUT_SCALE + LUT_BIAS; return uv; } float LTC_ClippedSphereFormFactor( const in vec3 f ) { float l = length( f ); return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); } vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { float x = dot( v1, v2 ); float y = abs( x ); float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; float b = 3.4175940 + ( 4.1616724 + y ) * y; float v = a / b; float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; return cross( v1, v2 ) * theta_sintheta; } vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; vec3 lightNormal = cross( v1, v2 ); if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); vec3 T1, T2; T1 = normalize( V - N * dot( V, N ) ); T2 = - cross( N, T1 ); mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); vec3 coords[ 4 ]; coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); coords[ 0 ] = normalize( coords[ 0 ] ); coords[ 1 ] = normalize( coords[ 1 ] ); coords[ 2 ] = normalize( coords[ 2 ] ); coords[ 3 ] = normalize( coords[ 3 ] ); vec3 vectorFormFactor = vec3( 0.0 ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); return vec3( result ); } #if defined( USE_SHEEN ) float D_Charlie( float roughness, float dotNH ) { float alpha = pow2( roughness ); float invAlpha = 1.0 / alpha; float cos2h = dotNH * dotNH; float sin2h = max( 1.0 - cos2h, 0.0078125 ); return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); } float V_Neubelt( float dotNV, float dotNL ) { return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); } vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float D = D_Charlie( sheenRoughness, dotNH ); float V = V_Neubelt( dotNV, dotNL ); return sheenColor * ( D * V ); } #endif float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { float dotNV = saturate( dot( normal, viewDir ) ); float r2 = roughness * roughness; float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); return saturate( DG * RECIPROCAL_PI ); } vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { float dotNV = saturate( dot( normal, viewDir ) ); const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); vec4 r = roughness * c0 + c1; float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; return fab; } vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { vec2 fab = DFGApprox( normal, viewDir, roughness ); return specularColor * fab.x + specularF90 * fab.y; } #ifdef USE_IRIDESCENCE void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { #else void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { #endif vec2 fab = DFGApprox( normal, viewDir, roughness ); #ifdef USE_IRIDESCENCE vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); #else vec3 Fr = specularColor; #endif vec3 FssEss = Fr * fab.x + specularF90 * fab.y; float Ess = fab.x + fab.y; float Ems = 1.0 - Ess; vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); singleScatter += FssEss; multiScatter += Fms * Ems; } #if NUM_RECT_AREA_LIGHTS > 0 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { vec3 normal = geometryNormal; vec3 viewDir = geometryViewDir; vec3 position = geometryPosition; vec3 lightPos = rectAreaLight.position; vec3 halfWidth = rectAreaLight.halfWidth; vec3 halfHeight = rectAreaLight.halfHeight; vec3 lightColor = rectAreaLight.color; float roughness = material.roughness; vec3 rectCoords[ 4 ]; rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; vec2 uv = LTC_Uv( normal, viewDir, roughness ); vec4 t1 = texture2D( ltc_1, uv ); vec4 t2 = texture2D( ltc_2, uv ); mat3 mInv = mat3( vec3( t1.x, 0, t1.y ), vec3( 0, 1, 0 ), vec3( t1.z, 0, t1.w ) ); vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); } #endif void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; #ifdef USE_CLEARCOAT float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); vec3 ccIrradiance = dotNLcc * directLight.color; clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); #endif #ifdef USE_SHEEN sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); #endif reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } 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 ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { #ifdef USE_CLEARCOAT clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); #endif #ifdef USE_SHEEN sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); #endif vec3 singleScattering = vec3( 0.0 ); vec3 multiScattering = vec3( 0.0 ); vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; #ifdef USE_IRIDESCENCE computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); #else computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); #endif vec3 totalScattering = singleScattering + multiScattering; vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); reflectedLight.indirectSpecular += radiance * singleScattering; reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; } #define RE_Direct RE_Direct_Physical #define RE_Direct_RectArea RE_Direct_RectArea_Physical #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical #define RE_IndirectSpecular RE_IndirectSpecular_Physical float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); }`,OI=` vec3 geometryPosition = - vViewPosition; vec3 geometryNormal = normal; vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); vec3 geometryClearcoatNormal = vec3( 0.0 ); #ifdef USE_CLEARCOAT geometryClearcoatNormal = clearcoatNormal; #endif #ifdef USE_IRIDESCENCE float dotNVi = saturate( dot( normal, geometryViewDir ) ); if ( material.iridescenceThickness == 0.0 ) { material.iridescence = 0.0; } else { material.iridescence = saturate( material.iridescence ); } if ( material.iridescence > 0.0 ) { material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); } #endif IncidentLight directLight; #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) PointLight pointLight; #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 PointLightShadow pointLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { pointLight = pointLights[ i ]; getPointLightInfo( pointLight, geometryPosition, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) pointLightShadow = pointLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) SpotLight spotLight; vec4 spotColor; vec3 spotLightCoord; bool inSpotLightMap; #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 SpotLightShadow spotLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { spotLight = spotLights[ i ]; getSpotLightInfo( spotLight, geometryPosition, directLight ); #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS #else #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) #endif #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; #endif #undef SPOT_LIGHT_MAP_INDEX #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) spotLightShadow = spotLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) DirectionalLight directionalLight; #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 DirectionalLightShadow directionalLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { directionalLight = directionalLights[ i ]; getDirectionalLightInfo( directionalLight, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) directionalLightShadow = directionalLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) RectAreaLight rectAreaLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { rectAreaLight = rectAreaLights[ i ]; RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if defined( RE_IndirectDiffuse ) vec3 iblIrradiance = vec3( 0.0 ); vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); #if defined( USE_LIGHT_PROBES ) irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); #endif #if ( NUM_HEMI_LIGHTS > 0 ) #pragma unroll_loop_start for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); } #pragma unroll_loop_end #endif #endif #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); #endif`,FI=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; irradiance += lightMapIrradiance; #endif #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) iblIrradiance += getIBLIrradiance( geometryNormal ); #endif #endif #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) #ifdef USE_ANISOTROPY radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); #else radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); #endif #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); #endif #endif`,zI=`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif`,BI=`#if defined( USE_LOGDEPTHBUF ) gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; #endif`,kI=`#if defined( USE_LOGDEPTHBUF ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; #endif`,HI=`#ifdef USE_LOGDEPTHBUF varying float vFragDepth; varying float vIsPerspective; #endif`,VI=`#ifdef USE_LOGDEPTHBUF vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); #endif`,GI=`#ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vMapUv ); #ifdef DECODE_VIDEO_TEXTURE sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); #endif diffuseColor *= sampledDiffuseColor; #endif`,WI=`#ifdef USE_MAP uniform sampler2D map; #endif`,XI=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) #if defined( USE_POINTS_UV ) vec2 uv = vUv; #else vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; #endif #endif #ifdef USE_MAP diffuseColor *= texture2D( map, uv ); #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; #endif`,qI=`#if defined( USE_POINTS_UV ) varying vec2 vUv; #else #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) uniform mat3 uvTransform; #endif #endif #ifdef USE_MAP uniform sampler2D map; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; #endif`,YI=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; #endif`,ZI=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; #endif`,$I=`#ifdef USE_INSTANCING_MORPH float morphTargetInfluences[ MORPHTARGETS_COUNT ]; float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; } #endif`,JI=`#if defined( USE_MORPHCOLORS ) vColor *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { #if defined( USE_COLOR_ALPHA ) if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; #elif defined( USE_COLOR ) if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } #endif`,KI=`#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; } #endif`,QI=`#ifdef USE_MORPHTARGETS #ifndef USE_INSTANCING_MORPH uniform float morphTargetBaseInfluence; uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; #endif uniform sampler2DArray morphTargetsTexture; uniform ivec2 morphTargetsTextureSize; vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; int y = texelIndex / morphTargetsTextureSize.x; int x = texelIndex - y * morphTargetsTextureSize.x; ivec3 morphUV = ivec3( x, y, morphTargetIndex ); return texelFetch( morphTargetsTexture, morphUV, 0 ); } #endif`,jI=`#ifdef USE_MORPHTARGETS transformed *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; } #endif`,t2=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = dFdx( vViewPosition ); vec3 fdy = dFdy( vViewPosition ); vec3 normal = normalize( cross( fdx, fdy ) ); #else vec3 normal = normalize( vNormal ); #ifdef DOUBLE_SIDED normal *= faceDirection; #endif #endif #if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) #ifdef USE_TANGENT mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); #else mat3 tbn = getTangentFrame( - vViewPosition, normal, #if defined( USE_NORMALMAP ) vNormalMapUv #elif defined( USE_CLEARCOAT_NORMALMAP ) vClearcoatNormalMapUv #else vUv #endif ); #endif #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) tbn[0] *= faceDirection; tbn[1] *= faceDirection; #endif #endif #ifdef USE_CLEARCOAT_NORMALMAP #ifdef USE_TANGENT mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); #else mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); #endif #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) tbn2[0] *= faceDirection; tbn2[1] *= faceDirection; #endif #endif vec3 nonPerturbedNormal = normal;`,e2=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; #endif #ifdef DOUBLE_SIDED normal = normal * faceDirection; #endif normal = normalize( normalMatrix * normal ); #elif defined( USE_NORMALMAP_TANGENTSPACE ) vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; mapN.xy *= normalScale; normal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); #endif`,n2=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,i2=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,r2=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif #endif`,s2=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif #ifdef USE_NORMALMAP_OBJECTSPACE uniform mat3 normalMatrix; #endif #if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { vec3 q0 = dFdx( eye_pos.xyz ); vec3 q1 = dFdy( eye_pos.xyz ); vec2 st0 = dFdx( uv.st ); vec2 st1 = dFdy( uv.st ); vec3 N = surf_norm; vec3 q1perp = cross( q1, N ); vec3 q0perp = cross( N, q0 ); vec3 T = q1perp * st0.x + q0perp * st1.x; vec3 B = q1perp * st0.y + q0perp * st1.y; float det = max( dot( T, T ), dot( B, B ) ); float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); return mat3( T * scale, B * scale, N ); } #endif`,o2=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = nonPerturbedNormal; #endif`,a2=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); #endif`,l2=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP uniform sampler2D clearcoatNormalMap; uniform vec2 clearcoatNormalScale; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; #endif`,c2=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; #endif`,u2=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,h2=`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { return 2.0 * rgb.xyz - 1.0; } const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; const float Inv255 = 1. / 255.; const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); vec4 packDepthToRGBA( const in float v ) { if( v <= 0.0 ) return vec4( 0., 0., 0., 0. ); if( v >= 1.0 ) return vec4( 1., 1., 1., 1. ); float vuf; float af = modf( v * PackFactors.a, vuf ); float bf = modf( vuf * ShiftRight8, vuf ); float gf = modf( vuf * ShiftRight8, vuf ); return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); } vec3 packDepthToRGB( const in float v ) { if( v <= 0.0 ) return vec3( 0., 0., 0. ); if( v >= 1.0 ) return vec3( 1., 1., 1. ); float vuf; float bf = modf( v * PackFactors.b, vuf ); float gf = modf( vuf * ShiftRight8, vuf ); return vec3( vuf * Inv255, gf * PackUpscale, bf ); } vec2 packDepthToRG( const in float v ) { if( v <= 0.0 ) return vec2( 0., 0. ); if( v >= 1.0 ) return vec2( 1., 1. ); float vuf; float gf = modf( v * 256., vuf ); return vec2( vuf * Inv255, gf ); } float unpackRGBAToDepth( const in vec4 v ) { return dot( v, UnpackFactors4 ); } float unpackRGBToDepth( const in vec3 v ) { return dot( v, UnpackFactors3 ); } float unpackRGToDepth( const in vec2 v ) { return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; } vec4 pack2HalfToRGBA( const in vec2 v ) { vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); } vec2 unpackRGBATo2Half( const in vec4 v ) { return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); } float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { return ( viewZ + near ) / ( near - far ); } float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { return depth * ( near - far ) - near; } float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); } float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { return ( near * far ) / ( ( far - near ) * depth - far ); }`,f2=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; #endif`,d2=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING mvPosition = batchingMatrix * mvPosition; #endif #ifdef USE_INSTANCING mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; gl_Position = projectionMatrix * mvPosition;`,p2=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); #endif`,m2=`#ifdef DITHERING vec3 dithering( vec3 color ) { float grid_position = rand( gl_FragCoord.xy ); vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); return color + dither_shift_RGB; } #endif`,g2=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; #endif`,_2=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; #endif`,v2=`#if NUM_SPOT_LIGHT_COORDS > 0 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #if NUM_SPOT_LIGHT_MAPS > 0 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; #endif #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; struct DirectionalLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; struct SpotLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; #endif #if NUM_POINT_LIGHT_SHADOWS > 0 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; struct PointLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); } vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { return unpackRGBATo2Half( texture2D( shadow, uv ) ); } float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ float occlusion = 1.0; vec2 distribution = texture2DDistribution( shadow, uv ); float hard_shadow = step( compare , distribution.x ); if (hard_shadow != 1.0 ) { float distance = compare - distribution.x ; float variance = max( 0.00000, distribution.y * distribution.y ); float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); } return occlusion; } float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { float shadow = 1.0; shadowCoord.xyz /= shadowCoord.w; shadowCoord.z += shadowBias; bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; bool frustumTest = inFrustum && shadowCoord.z <= 1.0; if ( frustumTest ) { #if defined( SHADOWMAP_TYPE_PCF ) vec2 texelSize = vec2( 1.0 ) / shadowMapSize; float dx0 = - texelSize.x * shadowRadius; float dy0 = - texelSize.y * shadowRadius; float dx1 = + texelSize.x * shadowRadius; float dy1 = + texelSize.y * shadowRadius; float dx2 = dx0 / 2.0; float dy2 = dy0 / 2.0; float dx3 = dx1 / 2.0; float dy3 = dy1 / 2.0; shadow = ( texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) ) * ( 1.0 / 17.0 ); #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) vec2 texelSize = vec2( 1.0 ) / shadowMapSize; float dx = texelSize.x; float dy = texelSize.y; vec2 uv = shadowCoord.xy; vec2 f = fract( uv * shadowMapSize + 0.5 ); uv -= f * texelSize; shadow = ( texture2DCompare( shadowMap, uv, shadowCoord.z ) + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), f.x ) + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), f.x ) + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), f.y ) + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), f.y ) + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), f.x ), mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), f.x ), f.y ) ) * ( 1.0 / 9.0 ); #elif defined( SHADOWMAP_TYPE_VSM ) shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); #else shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); #endif } return mix( 1.0, shadow, shadowIntensity ); } vec2 cubeToUV( vec3 v, float texelSizeY ) { vec3 absV = abs( v ); float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); absV *= scaleToCube; v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); vec2 planar = v.xy; float almostATexel = 1.5 * texelSizeY; float almostOne = 1.0 - almostATexel; if ( absV.z >= almostOne ) { if ( v.z > 0.0 ) planar.x = 4.0 - v.x; } else if ( absV.x >= almostOne ) { float signX = sign( v.x ); planar.x = v.z * signX + 2.0 * signX; } else if ( absV.y >= almostOne ) { float signY = sign( v.y ); planar.x = v.x + 2.0 * signY + 2.0; planar.y = v.z * signY - 2.0; } return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); } float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { float shadow = 1.0; vec3 lightToPosition = shadowCoord.xyz; float lightToPositionLength = length( lightToPosition ); if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; vec3 bd3D = normalize( lightToPosition ); vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; shadow = ( texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) ) * ( 1.0 / 9.0 ); #else shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); #endif } return mix( 1.0, shadow, shadowIntensity ); } #endif`,x2=`#if NUM_SPOT_LIGHT_COORDS > 0 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; struct DirectionalLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 struct SpotLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; #endif #if NUM_POINT_LIGHT_SHADOWS > 0 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; struct PointLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif #endif`,y2=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); vec4 shadowWorldPosition; #endif #if defined( USE_SHADOWMAP ) #if NUM_DIR_LIGHT_SHADOWS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif #if NUM_POINT_LIGHT_SHADOWS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif #endif #if NUM_SPOT_LIGHT_COORDS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { shadowWorldPosition = worldPosition; #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; #endif vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif`,M2=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 DirectionalLightShadow directionalLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { directionalLight = directionalLightShadows[ i ]; shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; } #pragma unroll_loop_end #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 SpotLightShadow spotLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { spotLight = spotLightShadows[ i ]; shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; } #pragma unroll_loop_end #endif #if NUM_POINT_LIGHT_SHADOWS > 0 PointLightShadow pointLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { pointLight = pointLightShadows[ i ]; shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; } #pragma unroll_loop_end #endif #endif return shadow; }`,S2=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); #endif`,w2=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; mat4 getBoneMatrix( const in float i ) { int size = textureSize( boneTexture, 0 ).x; int j = int( i ) * 4; int x = j % size; int y = j / size; vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); return mat4( v1, v2, v3, v4 ); } #endif`,b2=`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; skinned += boneMatY * skinVertex * skinWeight.y; skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; #endif`,T2=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; skinMatrix += skinWeight.z * boneMatZ; skinMatrix += skinWeight.w * boneMatW; skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif #endif`,E2=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; #endif`,A2=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; #endif`,C2=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); #endif`,R2=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; vec3 LinearToneMapping( vec3 color ) { return saturate( toneMappingExposure * color ); } vec3 ReinhardToneMapping( vec3 color ) { color *= toneMappingExposure; return saturate( color / ( vec3( 1.0 ) + color ) ); } vec3 CineonToneMapping( vec3 color ) { color *= toneMappingExposure; color = max( vec3( 0.0 ), color - 0.004 ); return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); } vec3 RRTAndODTFit( vec3 v ) { vec3 a = v * ( v + 0.0245786 ) - 0.000090537; vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; return a / b; } vec3 ACESFilmicToneMapping( vec3 color ) { const mat3 ACESInputMat = mat3( vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), vec3( 0.04823, 0.01566, 0.83777 ) ); const mat3 ACESOutputMat = mat3( vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), vec3( -0.07367, -0.00605, 1.07602 ) ); color *= toneMappingExposure / 0.6; color = ACESInputMat * color; color = RRTAndODTFit( color ); color = ACESOutputMat * color; return saturate( color ); } const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( vec3( 1.6605, - 0.1246, - 0.0182 ), vec3( - 0.5876, 1.1329, - 0.1006 ), vec3( - 0.0728, - 0.0083, 1.1187 ) ); const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( vec3( 0.6274, 0.0691, 0.0164 ), vec3( 0.3293, 0.9195, 0.0880 ), vec3( 0.0433, 0.0113, 0.8956 ) ); vec3 agxDefaultContrastApprox( vec3 x ) { vec3 x2 = x * x; vec3 x4 = x2 * x2; return + 15.5 * x4 * x2 - 40.14 * x4 * x + 31.96 * x4 - 6.868 * x2 * x + 0.4298 * x2 + 0.1191 * x - 0.00232; } vec3 AgXToneMapping( vec3 color ) { const mat3 AgXInsetMatrix = mat3( vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) ); const mat3 AgXOutsetMatrix = mat3( vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) ); const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; color *= toneMappingExposure; color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; color = AgXInsetMatrix * color; color = max( color, 1e-10 ); color = log2( color ); color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); color = clamp( color, 0.0, 1.0 ); color = agxDefaultContrastApprox( color ); color = AgXOutsetMatrix * color; color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); color = LINEAR_REC2020_TO_LINEAR_SRGB * color; color = clamp( color, 0.0, 1.0 ); return color; } vec3 NeutralToneMapping( vec3 color ) { const float StartCompression = 0.8 - 0.04; const float Desaturation = 0.15; color *= toneMappingExposure; float x = min( color.r, min( color.g, color.b ) ); float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; color -= offset; float peak = max( color.r, max( color.g, color.b ) ); if ( peak < StartCompression ) return color; float d = 1. - StartCompression; float newPeak = 1. - d * d / ( peak + d - StartCompression ); color *= newPeak / peak; float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); return mix( color, vec3( newPeak ), g ); } vec3 CustomToneMapping( vec3 color ) { return color; }`,P2=`#ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; material.attenuationDistance = attenuationDistance; material.attenuationColor = attenuationColor; #ifdef USE_TRANSMISSIONMAP material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; #endif #ifdef USE_THICKNESSMAP material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; #endif vec3 pos = vWorldPosition; vec3 v = normalize( cameraPosition - pos ); vec3 n = inverseTransformDirection( normal, viewMatrix ); vec4 transmitted = getIBLVolumeRefraction( n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); #endif`,I2=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; uniform vec3 attenuationColor; #ifdef USE_TRANSMISSIONMAP uniform sampler2D transmissionMap; #endif #ifdef USE_THICKNESSMAP uniform sampler2D thicknessMap; #endif uniform vec2 transmissionSamplerSize; uniform sampler2D transmissionSamplerMap; uniform mat4 modelMatrix; uniform mat4 projectionMatrix; varying vec3 vWorldPosition; float w0( float a ) { return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); } float w1( float a ) { return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); } float w2( float a ){ return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); } float w3( float a ) { return ( 1.0 / 6.0 ) * ( a * a * a ); } float g0( float a ) { return w0( a ) + w1( a ); } float g1( float a ) { return w2( a ) + w3( a ); } float h0( float a ) { return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); } float h1( float a ) { return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); } vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { uv = uv * texelSize.zw + 0.5; vec2 iuv = floor( uv ); vec2 fuv = fract( uv ); float g0x = g0( fuv.x ); float g1x = g1( fuv.x ); float h0x = h0( fuv.x ); float h1x = h1( fuv.x ); float h0y = h0( fuv.y ); float h1y = h1( fuv.y ); vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); } vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); vec2 fLodSizeInv = 1.0 / fLodSize; vec2 cLodSizeInv = 1.0 / cLodSize; vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); return mix( fSample, cSample, fract( lod ) ); } vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); vec3 modelScale; modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); return normalize( refractionVector ) * thickness * modelScale; } float applyIorToRoughness( const in float roughness, const in float ior ) { return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); } vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); } vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { if ( isinf( attenuationDistance ) ) { return vec3( 1.0 ); } else { vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; } } vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, const in vec3 attenuationColor, const in float attenuationDistance ) { vec4 transmittedLight; vec3 transmittance; #ifdef USE_DISPERSION float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); for ( int i = 0; i < 3; i ++ ) { vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); vec3 refractedRayExit = position + transmissionRay; vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); vec2 refractionCoords = ndcPos.xy / ndcPos.w; refractionCoords += 1.0; refractionCoords /= 2.0; vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); transmittedLight[ i ] = transmissionSample[ i ]; transmittedLight.a += transmissionSample.a; transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; } transmittedLight.a /= 3.0; #else vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); vec3 refractedRayExit = position + transmissionRay; vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); vec2 refractionCoords = ndcPos.xy / ndcPos.w; refractionCoords += 1.0; refractionCoords /= 2.0; transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); #endif vec3 attenuatedColor = transmittance * transmittedLight.rgb; vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); } #endif`,L2=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP varying vec2 vMapUv; #endif #ifdef USE_ALPHAMAP varying vec2 vAlphaMapUv; #endif #ifdef USE_LIGHTMAP varying vec2 vLightMapUv; #endif #ifdef USE_AOMAP varying vec2 vAoMapUv; #endif #ifdef USE_BUMPMAP varying vec2 vBumpMapUv; #endif #ifdef USE_NORMALMAP varying vec2 vNormalMapUv; #endif #ifdef USE_EMISSIVEMAP varying vec2 vEmissiveMapUv; #endif #ifdef USE_METALNESSMAP varying vec2 vMetalnessMapUv; #endif #ifdef USE_ROUGHNESSMAP varying vec2 vRoughnessMapUv; #endif #ifdef USE_ANISOTROPYMAP varying vec2 vAnisotropyMapUv; #endif #ifdef USE_CLEARCOATMAP varying vec2 vClearcoatMapUv; #endif #ifdef USE_CLEARCOAT_NORMALMAP varying vec2 vClearcoatNormalMapUv; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP varying vec2 vClearcoatRoughnessMapUv; #endif #ifdef USE_IRIDESCENCEMAP varying vec2 vIridescenceMapUv; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP varying vec2 vIridescenceThicknessMapUv; #endif #ifdef USE_SHEEN_COLORMAP varying vec2 vSheenColorMapUv; #endif #ifdef USE_SHEEN_ROUGHNESSMAP varying vec2 vSheenRoughnessMapUv; #endif #ifdef USE_SPECULARMAP varying vec2 vSpecularMapUv; #endif #ifdef USE_SPECULAR_COLORMAP varying vec2 vSpecularColorMapUv; #endif #ifdef USE_SPECULAR_INTENSITYMAP varying vec2 vSpecularIntensityMapUv; #endif #ifdef USE_TRANSMISSIONMAP uniform mat3 transmissionMapTransform; varying vec2 vTransmissionMapUv; #endif #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; #endif`,D2=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP uniform mat3 mapTransform; varying vec2 vMapUv; #endif #ifdef USE_ALPHAMAP uniform mat3 alphaMapTransform; varying vec2 vAlphaMapUv; #endif #ifdef USE_LIGHTMAP uniform mat3 lightMapTransform; varying vec2 vLightMapUv; #endif #ifdef USE_AOMAP uniform mat3 aoMapTransform; varying vec2 vAoMapUv; #endif #ifdef USE_BUMPMAP uniform mat3 bumpMapTransform; varying vec2 vBumpMapUv; #endif #ifdef USE_NORMALMAP uniform mat3 normalMapTransform; varying vec2 vNormalMapUv; #endif #ifdef USE_DISPLACEMENTMAP uniform mat3 displacementMapTransform; varying vec2 vDisplacementMapUv; #endif #ifdef USE_EMISSIVEMAP uniform mat3 emissiveMapTransform; varying vec2 vEmissiveMapUv; #endif #ifdef USE_METALNESSMAP uniform mat3 metalnessMapTransform; varying vec2 vMetalnessMapUv; #endif #ifdef USE_ROUGHNESSMAP uniform mat3 roughnessMapTransform; varying vec2 vRoughnessMapUv; #endif #ifdef USE_ANISOTROPYMAP uniform mat3 anisotropyMapTransform; varying vec2 vAnisotropyMapUv; #endif #ifdef USE_CLEARCOATMAP uniform mat3 clearcoatMapTransform; varying vec2 vClearcoatMapUv; #endif #ifdef USE_CLEARCOAT_NORMALMAP uniform mat3 clearcoatNormalMapTransform; varying vec2 vClearcoatNormalMapUv; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform mat3 clearcoatRoughnessMapTransform; varying vec2 vClearcoatRoughnessMapUv; #endif #ifdef USE_SHEEN_COLORMAP uniform mat3 sheenColorMapTransform; varying vec2 vSheenColorMapUv; #endif #ifdef USE_SHEEN_ROUGHNESSMAP uniform mat3 sheenRoughnessMapTransform; varying vec2 vSheenRoughnessMapUv; #endif #ifdef USE_IRIDESCENCEMAP uniform mat3 iridescenceMapTransform; varying vec2 vIridescenceMapUv; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform mat3 iridescenceThicknessMapTransform; varying vec2 vIridescenceThicknessMapUv; #endif #ifdef USE_SPECULARMAP uniform mat3 specularMapTransform; varying vec2 vSpecularMapUv; #endif #ifdef USE_SPECULAR_COLORMAP uniform mat3 specularColorMapTransform; varying vec2 vSpecularColorMapUv; #endif #ifdef USE_SPECULAR_INTENSITYMAP uniform mat3 specularIntensityMapTransform; varying vec2 vSpecularIntensityMapUv; #endif #ifdef USE_TRANSMISSIONMAP uniform mat3 transmissionMapTransform; varying vec2 vTransmissionMapUv; #endif #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; #endif`,U2=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) vUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; #endif #ifdef USE_ALPHAMAP vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; #endif #ifdef USE_LIGHTMAP vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; #endif #ifdef USE_AOMAP vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; #endif #ifdef USE_BUMPMAP vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; #endif #ifdef USE_NORMALMAP vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; #endif #ifdef USE_DISPLACEMENTMAP vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; #endif #ifdef USE_EMISSIVEMAP vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; #endif #ifdef USE_METALNESSMAP vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_ROUGHNESSMAP vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_ANISOTROPYMAP vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOATMAP vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOAT_NORMALMAP vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_IRIDESCENCEMAP vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_SHEEN_COLORMAP vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; #endif #ifdef USE_SHEEN_ROUGHNESSMAP vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULARMAP vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULAR_COLORMAP vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULAR_INTENSITYMAP vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; #endif #ifdef USE_TRANSMISSIONMAP vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; #endif`,N2=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 vec4 worldPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING worldPosition = batchingMatrix * worldPosition; #endif #ifdef USE_INSTANCING worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; #endif`,O2=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); }`,F2=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { vec4 texColor = texture2D( t2D, vUv ); #ifdef DECODE_VIDEO_TEXTURE texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); #endif texColor.rgb *= backgroundIntensity; gl_FragColor = texColor; #include #include }`,z2=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,B2=`#ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #elif defined( ENVMAP_TYPE_CUBE_UV ) uniform sampler2D envMap; #endif uniform float flipEnvMap; uniform float backgroundBlurriness; uniform float backgroundIntensity; uniform mat3 backgroundRotation; varying vec3 vWorldDirection; #include void main() { #ifdef ENVMAP_TYPE_CUBE vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); #elif defined( ENVMAP_TYPE_CUBE_UV ) vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); #else vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); #endif texColor.rgb *= backgroundIntensity; gl_FragColor = texColor; #include #include }`,k2=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,H2=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; void main() { vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); gl_FragColor = texColor; gl_FragColor.a *= opacity; #include #include }`,V2=`#include #include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { #include #include #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vHighPrecisionZW = gl_Position.zw; }`,G2=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include #include #include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { vec4 diffuseColor = vec4( 1.0 ); #include #if DEPTH_PACKING == 3200 diffuseColor.a = opacity; #endif #include #include #include #include #include float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; #if DEPTH_PACKING == 3200 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); #elif DEPTH_PACKING == 3201 gl_FragColor = packDepthToRGBA( fragCoordZ ); #elif DEPTH_PACKING == 3202 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); #elif DEPTH_PACKING == 3203 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); #endif }`,W2=`#define DISTANCE varying vec3 vWorldPosition; #include #include #include #include #include #include #include void main() { #include #include #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vWorldPosition = worldPosition.xyz; }`,X2=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; varying vec3 vWorldPosition; #include #include #include #include #include #include #include #include void main () { vec4 diffuseColor = vec4( 1.0 ); #include #include #include #include #include float dist = length( vWorldPosition - referencePosition ); dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); }`,q2=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include }`,Y2=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include }`,Z2=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include #include #include #include #include #include #include void main() { vLineDistance = scale * lineDistance; #include #include #include #include #include #include #include #include #include #include }`,$2=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; varying float vLineDistance; #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include if ( mod( vLineDistance, totalSize ) > dashSize ) { discard; } vec3 outgoingLight = vec3( 0.0 ); #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include #include }`,J2=`#include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) #include #include #include #include #include #endif #include #include #include #include #include #include #include #include #include }`,K2=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include #include #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; #else reflectedLight.indirectDiffuse += vec3( 1.0 ); #endif #include reflectedLight.indirectDiffuse *= diffuseColor.rgb; vec3 outgoingLight = reflectedLight.indirectDiffuse; #include #include #include #include #include #include #include }`,Q2=`#define LAMBERT varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #include }`,j2=`#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 #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include #include #include #include #include #include #include }`,tL=`#define MATCAP varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; }`,eL=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include #include #include #include vec3 viewDir = normalize( vViewPosition ); vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); vec3 y = cross( viewDir, x ); vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; #ifdef USE_MATCAP vec4 matcapColor = texture2D( matcap, uv ); #else vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); #endif vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; #include #include #include #include #include #include }`,nL=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) vViewPosition = - mvPosition.xyz; #endif }`,iL=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); #include #include #include #include gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); #ifdef OPAQUE gl_FragColor.a = 1.0; #endif }`,rL=`#define PHONG varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #include }`,sL=`#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 #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; #include #include #include #include #include #include #include }`,oL=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; #endif #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif }`,aL=`#define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR #endif uniform vec3 diffuse; uniform vec3 emissive; uniform float roughness; uniform float metalness; uniform float opacity; #ifdef IOR uniform float ior; #endif #ifdef USE_SPECULAR uniform float specularIntensity; uniform vec3 specularColor; #ifdef USE_SPECULAR_COLORMAP uniform sampler2D specularColorMap; #endif #ifdef USE_SPECULAR_INTENSITYMAP uniform sampler2D specularIntensityMap; #endif #endif #ifdef USE_CLEARCOAT uniform float clearcoat; uniform float clearcoatRoughness; #endif #ifdef USE_DISPERSION uniform float dispersion; #endif #ifdef USE_IRIDESCENCE uniform float iridescence; uniform float iridescenceIOR; uniform float iridescenceThicknessMinimum; uniform float iridescenceThicknessMaximum; #endif #ifdef USE_SHEEN uniform vec3 sheenColor; uniform float sheenRoughness; #ifdef USE_SHEEN_COLORMAP uniform sampler2D sheenColorMap; #endif #ifdef USE_SHEEN_ROUGHNESSMAP uniform sampler2D sheenRoughnessMap; #endif #endif #ifdef USE_ANISOTROPY uniform vec2 anisotropyVector; #ifdef USE_ANISOTROPYMAP uniform sampler2D anisotropyMap; #endif #endif varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; #include vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; #ifdef USE_SHEEN float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; #endif #ifdef USE_CLEARCOAT float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; #endif #include #include #include #include #include #include }`,lL=`#define TOON varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include }`,cL=`#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 #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include #include #include #include #include #include }`,uL=`uniform float size; uniform float scale; #include #include #include #include #include #include #ifdef USE_POINTS_UV varying vec2 vUv; uniform mat3 uvTransform; #endif void main() { #ifdef USE_POINTS_UV vUv = ( uvTransform * vec3( uv, 1 ) ).xy; #endif #include #include #include #include #include #include gl_PointSize = size; #ifdef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); #endif #include #include #include #include }`,hL=`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include vec3 outgoingLight = vec3( 0.0 ); #include #include #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include #include }`,fL=`#include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include }`,dL=`uniform vec3 color; uniform float opacity; #include #include #include #include #include #include #include #include void main() { #include gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); #include #include #include }`,pL=`uniform float rotation; uniform vec2 center; #include #include #include #include #include void main() { #include vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); vec2 scale; scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); #ifndef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) scale *= - mvPosition.z; #endif vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; vec2 rotatedPosition; rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; mvPosition.xy += rotatedPosition; gl_Position = projectionMatrix * mvPosition; #include #include #include }`,mL=`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include vec3 outgoingLight = vec3( 0.0 ); #include #include #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include }`,Me={alphahash_fragment:FP,alphahash_pars_fragment:zP,alphamap_fragment:BP,alphamap_pars_fragment:kP,alphatest_fragment:HP,alphatest_pars_fragment:VP,aomap_fragment:GP,aomap_pars_fragment:WP,batching_pars_vertex:XP,batching_vertex:qP,begin_vertex:YP,beginnormal_vertex:ZP,bsdfs:$P,iridescence_fragment:JP,bumpmap_pars_fragment:KP,clipping_planes_fragment:QP,clipping_planes_pars_fragment:jP,clipping_planes_pars_vertex:tI,clipping_planes_vertex:eI,color_fragment:nI,color_pars_fragment:iI,color_pars_vertex:rI,color_vertex:sI,common:oI,cube_uv_reflection_fragment:aI,defaultnormal_vertex:lI,displacementmap_pars_vertex:cI,displacementmap_vertex:uI,emissivemap_fragment:hI,emissivemap_pars_fragment:fI,colorspace_fragment:dI,colorspace_pars_fragment:pI,envmap_fragment:mI,envmap_common_pars_fragment:gI,envmap_pars_fragment:_I,envmap_pars_vertex:vI,envmap_physical_pars_fragment:RI,envmap_vertex:xI,fog_vertex:yI,fog_pars_vertex:MI,fog_fragment:SI,fog_pars_fragment:wI,gradientmap_pars_fragment:bI,lightmap_pars_fragment:TI,lights_lambert_fragment:EI,lights_lambert_pars_fragment:AI,lights_pars_begin:CI,lights_toon_fragment:PI,lights_toon_pars_fragment:II,lights_phong_fragment:LI,lights_phong_pars_fragment:DI,lights_physical_fragment:UI,lights_physical_pars_fragment:NI,lights_fragment_begin:OI,lights_fragment_maps:FI,lights_fragment_end:zI,logdepthbuf_fragment:BI,logdepthbuf_pars_fragment:kI,logdepthbuf_pars_vertex:HI,logdepthbuf_vertex:VI,map_fragment:GI,map_pars_fragment:WI,map_particle_fragment:XI,map_particle_pars_fragment:qI,metalnessmap_fragment:YI,metalnessmap_pars_fragment:ZI,morphinstance_vertex:$I,morphcolor_vertex:JI,morphnormal_vertex:KI,morphtarget_pars_vertex:QI,morphtarget_vertex:jI,normal_fragment_begin:t2,normal_fragment_maps:e2,normal_pars_fragment:n2,normal_pars_vertex:i2,normal_vertex:r2,normalmap_pars_fragment:s2,clearcoat_normal_fragment_begin:o2,clearcoat_normal_fragment_maps:a2,clearcoat_pars_fragment:l2,iridescence_pars_fragment:c2,opaque_fragment:u2,packing:h2,premultiplied_alpha_fragment:f2,project_vertex:d2,dithering_fragment:p2,dithering_pars_fragment:m2,roughnessmap_fragment:g2,roughnessmap_pars_fragment:_2,shadowmap_pars_fragment:v2,shadowmap_pars_vertex:x2,shadowmap_vertex:y2,shadowmask_pars_fragment:M2,skinbase_vertex:S2,skinning_pars_vertex:w2,skinning_vertex:b2,skinnormal_vertex:T2,specularmap_fragment:E2,specularmap_pars_fragment:A2,tonemapping_fragment:C2,tonemapping_pars_fragment:R2,transmission_fragment:P2,transmission_pars_fragment:I2,uv_pars_fragment:L2,uv_pars_vertex:D2,uv_vertex:U2,worldpos_vertex:N2,background_vert:O2,background_frag:F2,backgroundCube_vert:z2,backgroundCube_frag:B2,cube_vert:k2,cube_frag:H2,depth_vert:V2,depth_frag:G2,distanceRGBA_vert:W2,distanceRGBA_frag:X2,equirect_vert:q2,equirect_frag:Y2,linedashed_vert:Z2,linedashed_frag:$2,meshbasic_vert:J2,meshbasic_frag:K2,meshlambert_vert:Q2,meshlambert_frag:j2,meshmatcap_vert:tL,meshmatcap_frag:eL,meshnormal_vert:nL,meshnormal_frag:iL,meshphong_vert:rL,meshphong_frag:sL,meshphysical_vert:oL,meshphysical_frag:aL,meshtoon_vert:lL,meshtoon_frag:cL,points_vert:uL,points_frag:hL,shadow_vert:fL,shadow_frag:dL,sprite_vert:pL,sprite_frag:mL},Dt={common:{diffuse:{value:new ke(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Se},alphaMap:{value:null},alphaMapTransform:{value:new Se},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Se}},envmap:{envMap:{value:null},envMapRotation:{value:new Se},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Se}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Se}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Se},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Se},normalScale:{value:new Pe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Se},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Se}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Se}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Se}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ke(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 ke(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Se},alphaTest:{value:0},uvTransform:{value:new Se}},sprite:{diffuse:{value:new ke(16777215)},opacity:{value:1},center:{value:new Pe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Se},alphaMap:{value:null},alphaMapTransform:{value:new Se},alphaTest:{value:0}}},Hr={basic:{uniforms:xi([Dt.common,Dt.specularmap,Dt.envmap,Dt.aomap,Dt.lightmap,Dt.fog]),vertexShader:Me.meshbasic_vert,fragmentShader:Me.meshbasic_frag},lambert:{uniforms:xi([Dt.common,Dt.specularmap,Dt.envmap,Dt.aomap,Dt.lightmap,Dt.emissivemap,Dt.bumpmap,Dt.normalmap,Dt.displacementmap,Dt.fog,Dt.lights,{emissive:{value:new ke(0)}}]),vertexShader:Me.meshlambert_vert,fragmentShader:Me.meshlambert_frag},phong:{uniforms:xi([Dt.common,Dt.specularmap,Dt.envmap,Dt.aomap,Dt.lightmap,Dt.emissivemap,Dt.bumpmap,Dt.normalmap,Dt.displacementmap,Dt.fog,Dt.lights,{emissive:{value:new ke(0)},specular:{value:new ke(1118481)},shininess:{value:30}}]),vertexShader:Me.meshphong_vert,fragmentShader:Me.meshphong_frag},standard:{uniforms:xi([Dt.common,Dt.envmap,Dt.aomap,Dt.lightmap,Dt.emissivemap,Dt.bumpmap,Dt.normalmap,Dt.displacementmap,Dt.roughnessmap,Dt.metalnessmap,Dt.fog,Dt.lights,{emissive:{value:new ke(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Me.meshphysical_vert,fragmentShader:Me.meshphysical_frag},toon:{uniforms:xi([Dt.common,Dt.aomap,Dt.lightmap,Dt.emissivemap,Dt.bumpmap,Dt.normalmap,Dt.displacementmap,Dt.gradientmap,Dt.fog,Dt.lights,{emissive:{value:new ke(0)}}]),vertexShader:Me.meshtoon_vert,fragmentShader:Me.meshtoon_frag},matcap:{uniforms:xi([Dt.common,Dt.bumpmap,Dt.normalmap,Dt.displacementmap,Dt.fog,{matcap:{value:null}}]),vertexShader:Me.meshmatcap_vert,fragmentShader:Me.meshmatcap_frag},points:{uniforms:xi([Dt.points,Dt.fog]),vertexShader:Me.points_vert,fragmentShader:Me.points_frag},dashed:{uniforms:xi([Dt.common,Dt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Me.linedashed_vert,fragmentShader:Me.linedashed_frag},depth:{uniforms:xi([Dt.common,Dt.displacementmap]),vertexShader:Me.depth_vert,fragmentShader:Me.depth_frag},normal:{uniforms:xi([Dt.common,Dt.bumpmap,Dt.normalmap,Dt.displacementmap,{opacity:{value:1}}]),vertexShader:Me.meshnormal_vert,fragmentShader:Me.meshnormal_frag},sprite:{uniforms:xi([Dt.sprite,Dt.fog]),vertexShader:Me.sprite_vert,fragmentShader:Me.sprite_frag},background:{uniforms:{uvTransform:{value:new Se},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Me.background_vert,fragmentShader:Me.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Se}},vertexShader:Me.backgroundCube_vert,fragmentShader:Me.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Me.cube_vert,fragmentShader:Me.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Me.equirect_vert,fragmentShader:Me.equirect_frag},distanceRGBA:{uniforms:xi([Dt.common,Dt.displacementmap,{referencePosition:{value:new tt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Me.distanceRGBA_vert,fragmentShader:Me.distanceRGBA_frag},shadow:{uniforms:xi([Dt.lights,Dt.fog,{color:{value:new ke(0)},opacity:{value:1}}]),vertexShader:Me.shadow_vert,fragmentShader:Me.shadow_frag}};Hr.physical={uniforms:xi([Hr.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Se},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Se},clearcoatNormalScale:{value:new Pe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Se},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Se},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Se},sheen:{value:0},sheenColor:{value:new ke(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Se},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Se},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Se},transmissionSamplerSize:{value:new Pe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Se},attenuationDistance:{value:0},attenuationColor:{value:new ke(0)},specularColor:{value:new ke(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Se},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Se},anisotropyVector:{value:new Pe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Se}}]),vertexShader:Me.meshphysical_vert,fragmentShader:Me.meshphysical_frag};var vh={r:0,b:0,g:0},ko=new xs,gL=new Ln;function _L(r,t,e,n,i,o,l){let c=new ke(0),u=o===!0?0:1,f,d,g=null,p=0,m=null;function M(E){let b=E.isScene===!0?E.background:null;return b&&b.isTexture&&(b=(E.backgroundBlurriness>0?e:t).get(b)),b}function y(E){let b=!1,T=M(E);T===null?x(c,u):T&&T.isColor&&(x(T,1),b=!0);let U=r.xr.getEnvironmentBlendMode();U==="additive"?n.buffers.color.setClear(0,0,0,1,l):U==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,l),(r.autoClear||b)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function v(E,b){let T=M(b);T&&(T.isCubeTexture||T.mapping===Kh)?(d===void 0&&(d=new Er(new yc(1,1,1),new Ui({name:"BackgroundCubeMaterial",uniforms:al(Hr.backgroundCube.uniforms),vertexShader:Hr.backgroundCube.vertexShader,fragmentShader:Hr.backgroundCube.fragmentShader,side:Ii,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(U,L,I){this.matrixWorld.copyPosition(I.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(d)),ko.copy(b.backgroundRotation),ko.x*=-1,ko.y*=-1,ko.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(ko.y*=-1,ko.z*=-1),d.material.uniforms.envMap.value=T,d.material.uniforms.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=b.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=b.backgroundIntensity,d.material.uniforms.backgroundRotation.value.setFromMatrix4(gL.makeRotationFromEuler(ko)),d.material.toneMapped=qe.getTransfer(T.colorSpace)!==on,(g!==T||p!==T.version||m!==r.toneMapping)&&(d.material.needsUpdate=!0,g=T,p=T.version,m=r.toneMapping),d.layers.enableAll(),E.unshift(d,d.geometry,d.material,0,0,null)):T&&T.isTexture&&(f===void 0&&(f=new Er(new ll(2,2),new Ui({name:"BackgroundMaterial",uniforms:al(Hr.background.uniforms),vertexShader:Hr.background.vertexShader,fragmentShader:Hr.background.fragmentShader,side:to,depthTest:!1,depthWrite:!1,fog:!1})),f.geometry.deleteAttribute("normal"),Object.defineProperty(f.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(f)),f.material.uniforms.t2D.value=T,f.material.uniforms.backgroundIntensity.value=b.backgroundIntensity,f.material.toneMapped=qe.getTransfer(T.colorSpace)!==on,T.matrixAutoUpdate===!0&&T.updateMatrix(),f.material.uniforms.uvTransform.value.copy(T.matrix),(g!==T||p!==T.version||m!==r.toneMapping)&&(f.material.needsUpdate=!0,g=T,p=T.version,m=r.toneMapping),f.layers.enableAll(),E.unshift(f,f.geometry,f.material,0,0,null))}function x(E,b){E.getRGB(vh,iM(r)),n.buffers.color.setClear(vh.r,vh.g,vh.b,b,l)}return{getClearColor:function(){return c},setClearColor:function(E,b=1){c.set(E),u=b,x(c,u)},getClearAlpha:function(){return u},setClearAlpha:function(E){u=E,x(c,u)},render:y,addToRenderList:v}}function vL(r,t){let e=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=p(null),o=i,l=!1;function c(w,B,V,Z,j){let rt=!1,$=g(Z,V,B);o!==$&&(o=$,f(o.object)),rt=m(w,Z,V,j),rt&&M(w,Z,V,j),j!==null&&t.update(j,r.ELEMENT_ARRAY_BUFFER),(rt||l)&&(l=!1,T(w,B,V,Z),j!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t.get(j).buffer))}function u(){return r.createVertexArray()}function f(w){return r.bindVertexArray(w)}function d(w){return r.deleteVertexArray(w)}function g(w,B,V){let Z=V.wireframe===!0,j=n[w.id];j===void 0&&(j={},n[w.id]=j);let rt=j[B.id];rt===void 0&&(rt={},j[B.id]=rt);let $=rt[Z];return $===void 0&&($=p(u()),rt[Z]=$),$}function p(w){let B=[],V=[],Z=[];for(let j=0;j=0){let z=j[K],bt=rt[K];if(bt===void 0&&(K==="instanceMatrix"&&w.instanceMatrix&&(bt=w.instanceMatrix),K==="instanceColor"&&w.instanceColor&&(bt=w.instanceColor)),z===void 0||z.attribute!==bt||bt&&z.data!==bt.data)return!0;$++}return o.attributesNum!==$||o.index!==Z}function M(w,B,V,Z){let j={},rt=B.attributes,$=0,nt=V.getAttributes();for(let K in nt)if(nt[K].location>=0){let z=rt[K];z===void 0&&(K==="instanceMatrix"&&w.instanceMatrix&&(z=w.instanceMatrix),K==="instanceColor"&&w.instanceColor&&(z=w.instanceColor));let bt={};bt.attribute=z,z&&z.data&&(bt.data=z.data),j[K]=bt,$++}o.attributes=j,o.attributesNum=$,o.index=Z}function y(){let w=o.newAttributes;for(let B=0,V=w.length;B=0){let gt=j[nt];if(gt===void 0&&(nt==="instanceMatrix"&&w.instanceMatrix&&(gt=w.instanceMatrix),nt==="instanceColor"&&w.instanceColor&&(gt=w.instanceColor)),gt!==void 0){let z=gt.normalized,bt=gt.itemSize,jt=t.get(gt);if(jt===void 0)continue;let fe=jt.buffer,ot=jt.type,_t=jt.bytesPerElement,Et=ot===r.INT||ot===r.UNSIGNED_INT||gt.gpuType===pg;if(gt.isInterleavedBufferAttribute){let wt=gt.data,kt=wt.stride,Ht=gt.offset;if(wt.isInstancedInterleavedBuffer){for(let ae=0;ae0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";L="mediump"}return L==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let f=e.precision!==void 0?e.precision:"highp",d=u(f);d!==f&&(console.warn("THREE.WebGLRenderer:",f,"not supported, using",d,"instead."),f=d);let g=e.logarithmicDepthBuffer===!0,p=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),m=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),M=r.getParameter(r.MAX_TEXTURE_SIZE),y=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),v=r.getParameter(r.MAX_VERTEX_ATTRIBS),x=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),E=r.getParameter(r.MAX_VARYING_VECTORS),b=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),T=m>0,U=r.getParameter(r.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:o,getMaxPrecision:u,textureFormatReadable:l,textureTypeReadable:c,precision:f,logarithmicDepthBuffer:g,maxTextures:p,maxVertexTextures:m,maxTextureSize:M,maxCubemapSize:y,maxAttributes:v,maxVertexUniforms:x,maxVaryings:E,maxFragmentUniforms:b,vertexTextures:T,maxSamples:U}}function ML(r){let t=this,e=null,n=0,i=!1,o=!1,l=new ds,c=new Se,u={value:null,needsUpdate:!1};this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(g,p){let m=g.length!==0||p||n!==0||i;return i=p,n=g.length,m},this.beginShadows=function(){o=!0,d(null)},this.endShadows=function(){o=!1},this.setGlobalState=function(g,p){e=d(g,p,0)},this.setState=function(g,p,m){let M=g.clippingPlanes,y=g.clipIntersection,v=g.clipShadows,x=r.get(g);if(!i||M===null||M.length===0||o&&!v)o?d(null):f();else{let E=o?0:n,b=E*4,T=x.clippingState||null;u.value=T,T=d(M,p,b,m);for(let U=0;U!==b;++U)T[U]=e[U];x.clippingState=T,this.numIntersection=y?this.numPlanes:0,this.numPlanes+=E}};function f(){u.value!==e&&(u.value=e,u.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0}function d(g,p,m,M){let y=g!==null?g.length:0,v=null;if(y!==0){if(v=u.value,M!==!0||v===null){let x=m+y*4,E=p.matrixWorldInverse;c.getNormalMatrix(E),(v===null||v.length0){let f=new Hm(u.height);return f.fromEquirectangularTexture(r,l),t.set(l,f),l.addEventListener("dispose",i),e(f.texture,l.mapping)}else return null}}return l}function i(l){let c=l.target;c.removeEventListener("dispose",i);let u=t.get(c);u!==void 0&&(t.delete(c),u.dispose())}function o(){t=new WeakMap}return{get:n,dispose:o}}var Vm=class extends Wh{constructor(t=-1,e=1,n=1,i=-1,o=.1,l=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=o,this.far=l,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,e,n,i,o,l){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=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=o,this.view.height=l,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,o=n-t,l=n+t,c=i+e,u=i-e;if(this.view!==null&&this.view.enabled){let f=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;o+=f*this.view.offsetX,l=o+f*this.view.width,c-=d*this.view.offsetY,u=c-d*this.view.height}this.projectionMatrix.makeOrthographic(o,l,c,u,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}},Ja=4,my=[.125,.215,.35,.446,.526,.582],Wo=20,Kp=new Vm,gy=new ke,Qp=null,jp=0,tm=0,em=!1,Vo=(1+Math.sqrt(5))/2,Za=1/Vo,_y=[new tt(-Vo,Za,0),new tt(Vo,Za,0),new tt(-Za,0,Vo),new tt(Za,0,Vo),new tt(0,Vo,-Za),new tt(0,Vo,Za),new tt(-1,1,-1),new tt(1,1,-1),new tt(-1,1,1),new tt(1,1,1)],Yh=class{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100){Qp=this._renderer.getRenderTarget(),jp=this._renderer.getActiveCubeFace(),tm=this._renderer.getActiveMipmapLevel(),em=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);let o=this._allocateTargets();return o.depthBuffer=!0,this._sceneToCubeUV(t,n,i,o),e>0&&this._blur(o,0,0,e),this._applyPMREM(o),this._cleanup(o),o}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=yy(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=xy(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t2?b:0,b,b),d.setRenderTarget(i),y&&d.render(M,c),d.render(t,c)}M.geometry.dispose(),M.material.dispose(),d.toneMapping=p,d.autoClear=g,t.background=v}_textureToCubeUV(t,e){let n=this._renderer,i=t.mapping===nl||t.mapping===il;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=yy()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=xy());let o=i?this._cubemapMaterial:this._equirectMaterial,l=new Er(this._lodPlanes[0],o),c=o.uniforms;c.envMap.value=t;let u=this._cubeSize;xh(e,0,0,3*u,2*u),n.setRenderTarget(e),n.render(l,Kp)}_applyPMREM(t){let e=this._renderer,n=e.autoClear;e.autoClear=!1;let i=this._lodPlanes.length;for(let o=1;oWo&&console.warn(`sigmaRadians, ${o}, is too large and will clip, as it requested ${v} samples when the maximum is set to ${Wo}`);let x=[],E=0;for(let I=0;Ib-Ja?i-b+Ja:0),L=4*(this._cubeSize-T);xh(e,U,L,3*T,2*T),u.setRenderTarget(e),u.render(g,Kp)}};function wL(r){let t=[],e=[],n=[],i=r,o=r-Ja+1+my.length;for(let l=0;lr-Ja?u=my[l-r+Ja-1]:l===0&&(u=0),n.push(u);let f=1/(c-2),d=-f,g=1+f,p=[d,d,g,d,g,g,d,d,g,g,d,g],m=6,M=6,y=3,v=2,x=1,E=new Float32Array(y*M*m),b=new Float32Array(v*M*m),T=new Float32Array(x*M*m);for(let L=0;L2?0:-1,A=[I,N,0,I+2/3,N,0,I+2/3,N+1,0,I,N,0,I+2/3,N+1,0,I,N+1,0];E.set(A,y*M*L),b.set(p,v*M*L);let w=[L,L,L,L,L,L];T.set(w,x*M*L)}let U=new ys;U.setAttribute("position",new Li(E,y)),U.setAttribute("uv",new Li(b,v)),U.setAttribute("faceIndex",new Li(T,x)),t.push(U),i>Ja&&i--}return{lodPlanes:t,sizeLods:e,sigmas:n}}function vy(r,t,e){let n=new vs(r,t,e);return n.texture.mapping=Kh,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function xh(r,t,e,n,i){r.viewport.set(t,e,n,i),r.scissor.set(t,e,n,i)}function bL(r,t,e){let n=new Float32Array(Wo),i=new tt(0,1,0);return new Ui({name:"SphericalGaussianBlur",defines:{n:Wo,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Mg(),fragmentShader:` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform sampler2D envMap; uniform int samples; uniform float weights[ n ]; uniform bool latitudinal; uniform float dTheta; uniform float mipInt; uniform vec3 poleAxis; #define ENVMAP_TYPE_CUBE_UV #include vec3 getSample( float theta, vec3 axis ) { float cosTheta = cos( theta ); // Rodrigues' axis-angle rotation vec3 sampleDirection = vOutputDirection * cosTheta + cross( axis, vOutputDirection ) * sin( theta ) + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); return bilinearCubeUV( envMap, sampleDirection, mipInt ); } void main() { vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); if ( all( equal( axis, vec3( 0.0 ) ) ) ) { axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); } axis = normalize( axis ); gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); for ( int i = 1; i < n; i++ ) { if ( i >= samples ) { break; } float theta = dTheta * float( i ); gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); } } `,blending:Qs,depthTest:!1,depthWrite:!1})}function xy(){return new Ui({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Mg(),fragmentShader:` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform sampler2D envMap; #include void main() { vec3 outputDirection = normalize( vOutputDirection ); vec2 uv = equirectUv( outputDirection ); gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); } `,blending:Qs,depthTest:!1,depthWrite:!1})}function yy(){return new Ui({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Mg(),fragmentShader:` precision mediump float; precision mediump int; uniform float flipEnvMap; varying vec3 vOutputDirection; uniform samplerCube envMap; void main() { gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); } `,blending:Qs,depthTest:!1,depthWrite:!1})}function Mg(){return` precision mediump float; precision mediump int; attribute float faceIndex; varying vec3 vOutputDirection; // RH coordinate system; PMREM face-indexing convention vec3 getDirection( vec2 uv, float face ) { uv = 2.0 * uv - 1.0; vec3 direction = vec3( uv, 1.0 ); if ( face == 0.0 ) { direction = direction.zyx; // ( 1, v, u ) pos x } else if ( face == 1.0 ) { direction = direction.xzy; direction.xz *= -1.0; // ( -u, 1, -v ) pos y } else if ( face == 2.0 ) { direction.x *= -1.0; // ( -u, v, 1 ) pos z } else if ( face == 3.0 ) { direction = direction.zyx; direction.xz *= -1.0; // ( -1, v, -u ) neg x } else if ( face == 4.0 ) { direction = direction.xzy; direction.xy *= -1.0; // ( -u, -1, v ) neg y } else if ( face == 5.0 ) { direction.z *= -1.0; // ( u, v, -1 ) neg z } return direction; } void main() { vOutputDirection = getDirection( uv, faceIndex ); gl_Position = vec4( position, 1.0 ); } `}function TL(r){let t=new WeakMap,e=null;function n(c){if(c&&c.isTexture){let u=c.mapping,f=u===sm||u===om,d=u===nl||u===il;if(f||d){let g=t.get(c),p=g!==void 0?g.texture.pmremVersion:0;if(c.isRenderTargetTexture&&c.pmremVersion!==p)return e===null&&(e=new Yh(r)),g=f?e.fromEquirectangular(c,g):e.fromCubemap(c,g),g.texture.pmremVersion=c.pmremVersion,t.set(c,g),g.texture;if(g!==void 0)return g.texture;{let m=c.image;return f&&m&&m.height>0||d&&m&&i(m)?(e===null&&(e=new Yh(r)),g=f?e.fromEquirectangular(c):e.fromCubemap(c),g.texture.pmremVersion=c.pmremVersion,t.set(c,g),c.addEventListener("dispose",o),g.texture):null}}}return c}function i(c){let u=0,f=6;for(let d=0;dt.maxTextureSize&&(U=Math.ceil(T/t.maxTextureSize),T=t.maxTextureSize);let L=new Float32Array(T*U*4*g),I=new zh(L,T,U,g);I.type=ms,I.needsUpdate=!0;let N=b*4;for(let w=0;w0)return r;let i=t*e,o=Sy[i];if(o===void 0&&(o=new Float32Array(i),Sy[i]=o),t!==0){n.toArray(o,0);for(let l=1,c=0;l!==t;++l)c+=e,r[l].toArray(o,c)}return o}function Dn(r,t){if(r.length!==t.length)return!1;for(let e=0,n=r.length;e":" "} ${c}: ${e[l]}`)}return n.join(` `)}function SD(r){let t=qe.getPrimaries(qe.workingColorSpace),e=qe.getPrimaries(r),n;switch(t===e?n="":t===Uh&&e===Dh?n="LinearDisplayP3ToLinearSRGB":t===Dh&&e===Uh&&(n="LinearSRGBToLinearDisplayP3"),r){case io:case Qh:return[n,"LinearTransferOETF"];case kr:case yg:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",r),[n,"LinearTransferOETF"]}}function Ry(r,t,e){let n=r.getShaderParameter(t,r.COMPILE_STATUS),i=r.getShaderInfoLog(t).trim();if(n&&i==="")return"";let o=/ERROR: 0:(\d+)/.exec(i);if(o){let l=parseInt(o[1]);return e.toUpperCase()+` `+i+` `+MD(r.getShaderSource(t),l)}else return i}function wD(r,t){let e=SD(t);return`vec4 ${r}( vec4 value ) { return ${e[0]}( ${e[1]}( value ) ); }`}function bD(r,t){let e;switch(t){case $R:e="Linear";break;case JR:e="Reinhard";break;case KR:e="Cineon";break;case QR:e="ACESFilmic";break;case tP:e="AgX";break;case eP:e="Neutral";break;case jR:e="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),e="Linear"}return"vec3 "+r+"( vec3 color ) { return "+e+"ToneMapping( color ); }"}var yh=new tt;function TD(){qe.getLuminanceCoefficients(yh);let r=yh.x.toFixed(4),t=yh.y.toFixed(4),e=yh.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${r}, ${t}, ${e} );`," return dot( weights, rgb );","}"].join(` `)}function ED(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(gc).join(` `)}function AD(r){let t=[];for(let e in r){let n=r[e];n!==!1&&t.push("#define "+e+" "+n)}return t.join(` `)}function CD(r,t){let e={},n=r.getProgramParameter(t,r.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function qm(r){return r.replace(RD,ID)}var PD=new Map;function ID(r,t){let e=Me[t];if(e===void 0){let n=PD.get(t);if(n!==void 0)e=Me[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,n);else throw new Error("Can not resolve #include <"+t+">")}return qm(e)}var LD=/#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 Ly(r){return r.replace(LD,DD)}function DD(r,t,e,n){let i="";for(let o=parseInt(t);o0&&(v+=` `),x=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,M].filter(gc).join(` `),x.length>0&&(x+=` `)):(v=[Dy(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,M,e.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",e.batching?"#define USE_BATCHING":"",e.batchingColor?"#define USE_BATCHING_COLOR":"",e.instancing?"#define USE_INSTANCING":"",e.instancingColor?"#define USE_INSTANCING_COLOR":"",e.instancingMorph?"#define USE_INSTANCING_MORPH":"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+d:"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.displacementMap?"#define USE_DISPLACEMENTMAP":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.mapUv?"#define MAP_UV "+e.mapUv:"",e.alphaMapUv?"#define ALPHAMAP_UV "+e.alphaMapUv:"",e.lightMapUv?"#define LIGHTMAP_UV "+e.lightMapUv:"",e.aoMapUv?"#define AOMAP_UV "+e.aoMapUv:"",e.emissiveMapUv?"#define EMISSIVEMAP_UV "+e.emissiveMapUv:"",e.bumpMapUv?"#define BUMPMAP_UV "+e.bumpMapUv:"",e.normalMapUv?"#define NORMALMAP_UV "+e.normalMapUv:"",e.displacementMapUv?"#define DISPLACEMENTMAP_UV "+e.displacementMapUv:"",e.metalnessMapUv?"#define METALNESSMAP_UV "+e.metalnessMapUv:"",e.roughnessMapUv?"#define ROUGHNESSMAP_UV "+e.roughnessMapUv:"",e.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+e.anisotropyMapUv:"",e.clearcoatMapUv?"#define CLEARCOATMAP_UV "+e.clearcoatMapUv:"",e.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+e.clearcoatNormalMapUv:"",e.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+e.clearcoatRoughnessMapUv:"",e.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+e.iridescenceMapUv:"",e.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+e.iridescenceThicknessMapUv:"",e.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+e.sheenColorMapUv:"",e.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+e.sheenRoughnessMapUv:"",e.specularMapUv?"#define SPECULARMAP_UV "+e.specularMapUv:"",e.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+e.specularColorMapUv:"",e.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+e.specularIntensityMapUv:"",e.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+e.transmissionMapUv:"",e.thicknessMapUv?"#define THICKNESSMAP_UV "+e.thicknessMapUv:"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.flatShading?"#define FLAT_SHADED":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals&&e.flatShading===!1?"#define USE_MORPHNORMALS":"",e.morphColors?"#define USE_MORPHCOLORS":"",e.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+e.morphTextureStride:"",e.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+e.morphTargetsCount:"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+u:"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` `].filter(gc).join(` `),x=[Dy(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,M,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",e.map?"#define USE_MAP":"",e.matcap?"#define USE_MATCAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+f:"",e.envMap?"#define "+d:"",e.envMap?"#define "+g:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoat?"#define USE_CLEARCOAT":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.dispersion?"#define USE_DISPERSION":"",e.iridescence?"#define USE_IRIDESCENCE":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaTest?"#define USE_ALPHATEST":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.sheen?"#define USE_SHEEN":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors||e.instancingColor||e.batchingColor?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.gradientMap?"#define USE_GRADIENTMAP":"",e.flatShading?"#define FLAT_SHADED":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+u:"",e.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",e.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",e.toneMapping!==js?"#define TONE_MAPPING":"",e.toneMapping!==js?Me.tonemapping_pars_fragment:"",e.toneMapping!==js?bD("toneMapping",e.toneMapping):"",e.dithering?"#define DITHERING":"",e.opaque?"#define OPAQUE":"",Me.colorspace_pars_fragment,wD("linearToOutputTexel",e.outputColorSpace),TD(),e.useDepthPacking?"#define DEPTH_PACKING "+e.depthPacking:"",` `].filter(gc).join(` `)),l=qm(l),l=Py(l,e),l=Iy(l,e),c=qm(c),c=Py(c,e),c=Iy(c,e),l=Ly(l),c=Ly(c),e.isRawShaderMaterial!==!0&&(E=`#version 300 es `,v=[m,"#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` `+v,x=["#define varying in",e.glslVersion===$x?"":"layout(location = 0) out highp vec4 pc_fragColor;",e.glslVersion===$x?"":"#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(` `)+` `+x);let b=E+v+l,T=E+x+c,U=Cy(i,i.VERTEX_SHADER,b),L=Cy(i,i.FRAGMENT_SHADER,T);i.attachShader(y,U),i.attachShader(y,L),e.index0AttributeName!==void 0?i.bindAttribLocation(y,0,e.index0AttributeName):e.morphTargets===!0&&i.bindAttribLocation(y,0,"position"),i.linkProgram(y);function I(B){if(r.debug.checkShaderErrors){let V=i.getProgramInfoLog(y).trim(),Z=i.getShaderInfoLog(U).trim(),j=i.getShaderInfoLog(L).trim(),rt=!0,$=!0;if(i.getProgramParameter(y,i.LINK_STATUS)===!1)if(rt=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,y,U,L);else{let nt=Ry(i,U,"vertex"),K=Ry(i,L,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(y,i.VALIDATE_STATUS)+` Material Name: `+B.name+` Material Type: `+B.type+` Program Info Log: `+V+` `+nt+` `+K)}else V!==""?console.warn("THREE.WebGLProgram: Program Info Log:",V):(Z===""||j==="")&&($=!1);$&&(B.diagnostics={runnable:rt,programLog:V,vertexShader:{log:Z,prefix:v},fragmentShader:{log:j,prefix:x}})}i.deleteShader(U),i.deleteShader(L),N=new el(i,y),A=CD(i,y)}let N;this.getUniforms=function(){return N===void 0&&I(this),N};let A;this.getAttributes=function(){return A===void 0&&I(this),A};let w=e.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return w===!1&&(w=i.getProgramParameter(y,xD)),w},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(y),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=yD++,this.cacheKey=t,this.usedTimes=1,this.program=y,this.vertexShader=U,this.fragmentShader=L,this}var kD=0,Ym=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){let e=t.vertexShader,n=t.fragmentShader,i=this._getShaderStage(e),o=this._getShaderStage(n),l=this._getShaderCacheForMaterial(t);return l.has(i)===!1&&(l.add(i),i.usedTimes++),l.has(o)===!1&&(l.add(o),o.usedTimes++),this}remove(t){let e=this.materialCache.get(t);for(let n of e)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){let e=this.materialCache,n=e.get(t);return n===void 0&&(n=new Set,e.set(t,n)),n}_getShaderStage(t){let e=this.shaderCache,n=e.get(t);return n===void 0&&(n=new Zm(t),e.set(t,n)),n}},Zm=class{constructor(t){this.id=kD++,this.code=t,this.usedTimes=0}};function HD(r,t,e,n,i,o,l){let c=new kh,u=new Ym,f=new Set,d=[],g=i.logarithmicDepthBuffer,p=i.vertexTextures,m=i.precision,M={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function y(A){return f.add(A),A===0?"uv":`uv${A}`}function v(A,w,B,V,Z){let j=V.fog,rt=Z.geometry,$=A.isMeshStandardMaterial?V.environment:null,nt=(A.isMeshStandardMaterial?e:t).get(A.envMap||$),K=nt&&nt.mapping===Kh?nt.image.height:null,gt=M[A.type];A.precision!==null&&(m=i.getMaxPrecision(A.precision),m!==A.precision&&console.warn("THREE.WebGLProgram.getParameters:",A.precision,"not supported, using",m,"instead."));let z=rt.morphAttributes.position||rt.morphAttributes.normal||rt.morphAttributes.color,bt=z!==void 0?z.length:0,jt=0;rt.morphAttributes.position!==void 0&&(jt=1),rt.morphAttributes.normal!==void 0&&(jt=2),rt.morphAttributes.color!==void 0&&(jt=3);let fe,ot,_t,Et;if(gt){let be=Hr[gt];fe=be.vertexShader,ot=be.fragmentShader}else fe=A.vertexShader,ot=A.fragmentShader,u.update(A),_t=u.getVertexShaderID(A),Et=u.getFragmentShaderID(A);let wt=r.getRenderTarget(),kt=Z.isInstancedMesh===!0,Ht=Z.isBatchedMesh===!0,ae=!!A.map,_e=!!A.matcap,k=!!nt,Jt=!!A.aoMap,re=!!A.lightMap,se=!!A.bumpMap,Ut=!!A.normalMap,et=!!A.displacementMap,Vt=!!A.emissiveMap,Gt=!!A.metalnessMap,O=!!A.roughnessMap,C=A.anisotropy>0,it=A.clearcoat>0,ft=A.dispersion>0,mt=A.iridescence>0,at=A.sheen>0,zt=A.transmission>0,yt=C&&!!A.anisotropyMap,Ct=it&&!!A.clearcoatMap,Qt=it&&!!A.clearcoatNormalMap,Mt=it&&!!A.clearcoatRoughnessMap,It=mt&&!!A.iridescenceMap,Kt=mt&&!!A.iridescenceThicknessMap,ee=at&&!!A.sheenColorMap,Pt=at&&!!A.sheenRoughnessMap,ne=!!A.specularMap,de=!!A.specularColorMap,ze=!!A.specularIntensityMap,X=zt&&!!A.transmissionMap,lt=zt&&!!A.thicknessMap,ut=!!A.gradientMap,ht=!!A.alphaMap,St=A.alphaTest>0,Yt=!!A.alphaHash,me=!!A.extensions,Ge=js;A.toneMapped&&(wt===null||wt.isXRRenderTarget===!0)&&(Ge=r.toneMapping);let Ye={shaderID:gt,shaderType:A.type,shaderName:A.name,vertexShader:fe,fragmentShader:ot,defines:A.defines,customVertexShaderID:_t,customFragmentShaderID:Et,isRawShaderMaterial:A.isRawShaderMaterial===!0,glslVersion:A.glslVersion,precision:m,batching:Ht,batchingColor:Ht&&Z._colorsTexture!==null,instancing:kt,instancingColor:kt&&Z.instanceColor!==null,instancingMorph:kt&&Z.morphTexture!==null,supportsVertexTextures:p,outputColorSpace:wt===null?r.outputColorSpace:wt.isXRRenderTarget===!0?wt.texture.colorSpace:io,alphaToCoverage:!!A.alphaToCoverage,map:ae,matcap:_e,envMap:k,envMapMode:k&&nt.mapping,envMapCubeUVHeight:K,aoMap:Jt,lightMap:re,bumpMap:se,normalMap:Ut,displacementMap:p&&et,emissiveMap:Vt,normalMapObjectSpace:Ut&&A.normalMapType===oP,normalMapTangentSpace:Ut&&A.normalMapType===sP,metalnessMap:Gt,roughnessMap:O,anisotropy:C,anisotropyMap:yt,clearcoat:it,clearcoatMap:Ct,clearcoatNormalMap:Qt,clearcoatRoughnessMap:Mt,dispersion:ft,iridescence:mt,iridescenceMap:It,iridescenceThicknessMap:Kt,sheen:at,sheenColorMap:ee,sheenRoughnessMap:Pt,specularMap:ne,specularColorMap:de,specularIntensityMap:ze,transmission:zt,transmissionMap:X,thicknessMap:lt,gradientMap:ut,opaque:A.transparent===!1&&A.blending===Qa&&A.alphaToCoverage===!1,alphaMap:ht,alphaTest:St,alphaHash:Yt,combine:A.combine,mapUv:ae&&y(A.map.channel),aoMapUv:Jt&&y(A.aoMap.channel),lightMapUv:re&&y(A.lightMap.channel),bumpMapUv:se&&y(A.bumpMap.channel),normalMapUv:Ut&&y(A.normalMap.channel),displacementMapUv:et&&y(A.displacementMap.channel),emissiveMapUv:Vt&&y(A.emissiveMap.channel),metalnessMapUv:Gt&&y(A.metalnessMap.channel),roughnessMapUv:O&&y(A.roughnessMap.channel),anisotropyMapUv:yt&&y(A.anisotropyMap.channel),clearcoatMapUv:Ct&&y(A.clearcoatMap.channel),clearcoatNormalMapUv:Qt&&y(A.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Mt&&y(A.clearcoatRoughnessMap.channel),iridescenceMapUv:It&&y(A.iridescenceMap.channel),iridescenceThicknessMapUv:Kt&&y(A.iridescenceThicknessMap.channel),sheenColorMapUv:ee&&y(A.sheenColorMap.channel),sheenRoughnessMapUv:Pt&&y(A.sheenRoughnessMap.channel),specularMapUv:ne&&y(A.specularMap.channel),specularColorMapUv:de&&y(A.specularColorMap.channel),specularIntensityMapUv:ze&&y(A.specularIntensityMap.channel),transmissionMapUv:X&&y(A.transmissionMap.channel),thicknessMapUv:lt&&y(A.thicknessMap.channel),alphaMapUv:ht&&y(A.alphaMap.channel),vertexTangents:!!rt.attributes.tangent&&(Ut||C),vertexColors:A.vertexColors,vertexAlphas:A.vertexColors===!0&&!!rt.attributes.color&&rt.attributes.color.itemSize===4,pointsUvs:Z.isPoints===!0&&!!rt.attributes.uv&&(ae||ht),fog:!!j,useFog:A.fog===!0,fogExp2:!!j&&j.isFogExp2,flatShading:A.flatShading===!0,sizeAttenuation:A.sizeAttenuation===!0,logarithmicDepthBuffer:g,skinning:Z.isSkinnedMesh===!0,morphTargets:rt.morphAttributes.position!==void 0,morphNormals:rt.morphAttributes.normal!==void 0,morphColors:rt.morphAttributes.color!==void 0,morphTargetsCount:bt,morphTextureStride:jt,numDirLights:w.directional.length,numPointLights:w.point.length,numSpotLights:w.spot.length,numSpotLightMaps:w.spotLightMap.length,numRectAreaLights:w.rectArea.length,numHemiLights:w.hemi.length,numDirLightShadows:w.directionalShadowMap.length,numPointLightShadows:w.pointShadowMap.length,numSpotLightShadows:w.spotShadowMap.length,numSpotLightShadowsWithMaps:w.numSpotLightShadowsWithMaps,numLightProbes:w.numLightProbes,numClippingPlanes:l.numPlanes,numClipIntersection:l.numIntersection,dithering:A.dithering,shadowMapEnabled:r.shadowMap.enabled&&B.length>0,shadowMapType:r.shadowMap.type,toneMapping:Ge,decodeVideoTexture:ae&&A.map.isVideoTexture===!0&&qe.getTransfer(A.map.colorSpace)===on,premultipliedAlpha:A.premultipliedAlpha,doubleSided:A.side===ps,flipSided:A.side===Ii,useDepthPacking:A.depthPacking>=0,depthPacking:A.depthPacking||0,index0AttributeName:A.index0AttributeName,extensionClipCullDistance:me&&A.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(me&&A.extensions.multiDraw===!0||Ht)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:A.customProgramCacheKey()};return Ye.vertexUv1s=f.has(1),Ye.vertexUv2s=f.has(2),Ye.vertexUv3s=f.has(3),f.clear(),Ye}function x(A){let w=[];if(A.shaderID?w.push(A.shaderID):(w.push(A.customVertexShaderID),w.push(A.customFragmentShaderID)),A.defines!==void 0)for(let B in A.defines)w.push(B),w.push(A.defines[B]);return A.isRawShaderMaterial===!1&&(E(w,A),b(w,A),w.push(r.outputColorSpace)),w.push(A.customProgramCacheKey),w.join()}function E(A,w){A.push(w.precision),A.push(w.outputColorSpace),A.push(w.envMapMode),A.push(w.envMapCubeUVHeight),A.push(w.mapUv),A.push(w.alphaMapUv),A.push(w.lightMapUv),A.push(w.aoMapUv),A.push(w.bumpMapUv),A.push(w.normalMapUv),A.push(w.displacementMapUv),A.push(w.emissiveMapUv),A.push(w.metalnessMapUv),A.push(w.roughnessMapUv),A.push(w.anisotropyMapUv),A.push(w.clearcoatMapUv),A.push(w.clearcoatNormalMapUv),A.push(w.clearcoatRoughnessMapUv),A.push(w.iridescenceMapUv),A.push(w.iridescenceThicknessMapUv),A.push(w.sheenColorMapUv),A.push(w.sheenRoughnessMapUv),A.push(w.specularMapUv),A.push(w.specularColorMapUv),A.push(w.specularIntensityMapUv),A.push(w.transmissionMapUv),A.push(w.thicknessMapUv),A.push(w.combine),A.push(w.fogExp2),A.push(w.sizeAttenuation),A.push(w.morphTargetsCount),A.push(w.morphAttributeCount),A.push(w.numDirLights),A.push(w.numPointLights),A.push(w.numSpotLights),A.push(w.numSpotLightMaps),A.push(w.numHemiLights),A.push(w.numRectAreaLights),A.push(w.numDirLightShadows),A.push(w.numPointLightShadows),A.push(w.numSpotLightShadows),A.push(w.numSpotLightShadowsWithMaps),A.push(w.numLightProbes),A.push(w.shadowMapType),A.push(w.toneMapping),A.push(w.numClippingPlanes),A.push(w.numClipIntersection),A.push(w.depthPacking)}function b(A,w){c.disableAll(),w.supportsVertexTextures&&c.enable(0),w.instancing&&c.enable(1),w.instancingColor&&c.enable(2),w.instancingMorph&&c.enable(3),w.matcap&&c.enable(4),w.envMap&&c.enable(5),w.normalMapObjectSpace&&c.enable(6),w.normalMapTangentSpace&&c.enable(7),w.clearcoat&&c.enable(8),w.iridescence&&c.enable(9),w.alphaTest&&c.enable(10),w.vertexColors&&c.enable(11),w.vertexAlphas&&c.enable(12),w.vertexUv1s&&c.enable(13),w.vertexUv2s&&c.enable(14),w.vertexUv3s&&c.enable(15),w.vertexTangents&&c.enable(16),w.anisotropy&&c.enable(17),w.alphaHash&&c.enable(18),w.batching&&c.enable(19),w.dispersion&&c.enable(20),w.batchingColor&&c.enable(21),A.push(c.mask),c.disableAll(),w.fog&&c.enable(0),w.useFog&&c.enable(1),w.flatShading&&c.enable(2),w.logarithmicDepthBuffer&&c.enable(3),w.skinning&&c.enable(4),w.morphTargets&&c.enable(5),w.morphNormals&&c.enable(6),w.morphColors&&c.enable(7),w.premultipliedAlpha&&c.enable(8),w.shadowMapEnabled&&c.enable(9),w.doubleSided&&c.enable(10),w.flipSided&&c.enable(11),w.useDepthPacking&&c.enable(12),w.dithering&&c.enable(13),w.transmission&&c.enable(14),w.sheen&&c.enable(15),w.opaque&&c.enable(16),w.pointsUvs&&c.enable(17),w.decodeVideoTexture&&c.enable(18),w.alphaToCoverage&&c.enable(19),A.push(c.mask)}function T(A){let w=M[A.type],B;if(w){let V=Hr[w];B=IP.clone(V.uniforms)}else B=A.uniforms;return B}function U(A,w){let B;for(let V=0,Z=d.length;V0?n.push(x):m.transparent===!0?i.push(x):e.push(x)}function u(g,p,m,M,y,v){let x=l(g,p,m,M,y,v);m.transmission>0?n.unshift(x):m.transparent===!0?i.unshift(x):e.unshift(x)}function f(g,p){e.length>1&&e.sort(g||GD),n.length>1&&n.sort(p||Uy),i.length>1&&i.sort(p||Uy)}function d(){for(let g=t,p=r.length;g=o.length?(l=new Ny,o.push(l)):l=o[i],l}function e(){r=new WeakMap}return{get:t,dispose:e}}function XD(){let r={};return{get:function(t){if(r[t.id]!==void 0)return r[t.id];let e;switch(t.type){case"DirectionalLight":e={direction:new tt,color:new ke};break;case"SpotLight":e={position:new tt,direction:new tt,color:new ke,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new tt,color:new ke,distance:0,decay:0};break;case"HemisphereLight":e={direction:new tt,skyColor:new ke,groundColor:new ke};break;case"RectAreaLight":e={color:new ke,position:new tt,halfWidth:new tt,halfHeight:new tt};break}return r[t.id]=e,e}}}function qD(){let r={};return{get:function(t){if(r[t.id]!==void 0)return r[t.id];let e;switch(t.type){case"DirectionalLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Pe};break;case"SpotLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Pe};break;case"PointLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Pe,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[t.id]=e,e}}}var YD=0;function ZD(r,t){return(t.castShadow?2:0)-(r.castShadow?2:0)+(t.map?1:0)-(r.map?1:0)}function $D(r){let t=new XD,e=qD(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let f=0;f<9;f++)n.probe.push(new tt);let i=new tt,o=new Ln,l=new Ln;function c(f){let d=0,g=0,p=0;for(let A=0;A<9;A++)n.probe[A].set(0,0,0);let m=0,M=0,y=0,v=0,x=0,E=0,b=0,T=0,U=0,L=0,I=0;f.sort(ZD);for(let A=0,w=f.length;A0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Dt.LTC_FLOAT_1,n.rectAreaLTC2=Dt.LTC_FLOAT_2):(n.rectAreaLTC1=Dt.LTC_HALF_1,n.rectAreaLTC2=Dt.LTC_HALF_2)),n.ambient[0]=d,n.ambient[1]=g,n.ambient[2]=p;let N=n.hash;(N.directionalLength!==m||N.pointLength!==M||N.spotLength!==y||N.rectAreaLength!==v||N.hemiLength!==x||N.numDirectionalShadows!==E||N.numPointShadows!==b||N.numSpotShadows!==T||N.numSpotMaps!==U||N.numLightProbes!==I)&&(n.directional.length=m,n.spot.length=y,n.rectArea.length=v,n.point.length=M,n.hemi.length=x,n.directionalShadow.length=E,n.directionalShadowMap.length=E,n.pointShadow.length=b,n.pointShadowMap.length=b,n.spotShadow.length=T,n.spotShadowMap.length=T,n.directionalShadowMatrix.length=E,n.pointShadowMatrix.length=b,n.spotLightMatrix.length=T+U-L,n.spotLightMap.length=U,n.numSpotLightShadowsWithMaps=L,n.numLightProbes=I,N.directionalLength=m,N.pointLength=M,N.spotLength=y,N.rectAreaLength=v,N.hemiLength=x,N.numDirectionalShadows=E,N.numPointShadows=b,N.numSpotShadows=T,N.numSpotMaps=U,N.numLightProbes=I,n.version=YD++)}function u(f,d){let g=0,p=0,m=0,M=0,y=0,v=d.matrixWorldInverse;for(let x=0,E=f.length;x=l.length?(c=new Oy(r),l.push(c)):c=l[o],c}function n(){t=new WeakMap}return{get:e,dispose:n}}var $m=class extends $o{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=iP,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}},Jm=class extends $o{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}},KD=`void main() { gl_Position = vec4( position, 1.0 ); }`,QD=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include void main() { const float samples = float( VSM_SAMPLES ); float mean = 0.0; float squared_mean = 0.0; float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); float uvStart = samples <= 1.0 ? 0.0 : - 1.0; for ( float i = 0.0; i < samples; i ++ ) { float uvOffset = uvStart + i * uvStride; #ifdef HORIZONTAL_PASS vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); mean += distribution.x; squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; #else float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); mean += depth; squared_mean += depth * depth; #endif } mean = mean / samples; squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); }`;function jD(r,t,e){let n=new qh,i=new Pe,o=new Pe,l=new Hn,c=new $m({depthPacking:rP}),u=new Jm,f={},d=e.maxTextureSize,g={[to]:Ii,[Ii]:to,[ps]:ps},p=new Ui({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Pe},radius:{value:4}},vertexShader:KD,fragmentShader:QD}),m=p.clone();m.defines.HORIZONTAL_PASS=1;let M=new ys;M.setAttribute("position",new Li(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let y=new Er(M,p),v=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Hy;let x=this.type;this.render=function(L,I,N){if(v.enabled===!1||v.autoUpdate===!1&&v.needsUpdate===!1||L.length===0)return;let A=r.getRenderTarget(),w=r.getActiveCubeFace(),B=r.getActiveMipmapLevel(),V=r.state;V.setBlending(Qs),V.buffers.color.setClear(1,1,1,1),V.buffers.depth.setTest(!0),V.setScissorTest(!1);let Z=x!==fs&&this.type===fs,j=x===fs&&this.type!==fs;for(let rt=0,$=L.length;rt<$;rt++){let nt=L[rt],K=nt.shadow;if(K===void 0){console.warn("THREE.WebGLShadowMap:",nt,"has no shadow.");continue}if(K.autoUpdate===!1&&K.needsUpdate===!1)continue;i.copy(K.mapSize);let gt=K.getFrameExtents();if(i.multiply(gt),o.copy(K.mapSize),(i.x>d||i.y>d)&&(i.x>d&&(o.x=Math.floor(d/gt.x),i.x=o.x*gt.x,K.mapSize.x=o.x),i.y>d&&(o.y=Math.floor(d/gt.y),i.y=o.y*gt.y,K.mapSize.y=o.y)),K.map===null||Z===!0||j===!0){let bt=this.type!==fs?{minFilter:hr,magFilter:hr}:{};K.map!==null&&K.map.dispose(),K.map=new vs(i.x,i.y,bt),K.map.texture.name=nt.name+".shadowMap",K.camera.updateProjectionMatrix()}r.setRenderTarget(K.map),r.clear();let z=K.getViewportCount();for(let bt=0;bt0||I.map&&I.alphaTest>0){let V=w.uuid,Z=I.uuid,j=f[V];j===void 0&&(j={},f[V]=j);let rt=j[Z];rt===void 0&&(rt=w.clone(),j[Z]=rt,I.addEventListener("dispose",U)),w=rt}if(w.visible=I.visible,w.wireframe=I.wireframe,A===fs?w.side=I.shadowSide!==null?I.shadowSide:I.side:w.side=I.shadowSide!==null?I.shadowSide:g[I.side],w.alphaMap=I.alphaMap,w.alphaTest=I.alphaTest,w.map=I.map,w.clipShadows=I.clipShadows,w.clippingPlanes=I.clippingPlanes,w.clipIntersection=I.clipIntersection,w.displacementMap=I.displacementMap,w.displacementScale=I.displacementScale,w.displacementBias=I.displacementBias,w.wireframeLinewidth=I.wireframeLinewidth,w.linewidth=I.linewidth,N.isPointLight===!0&&w.isMeshDistanceMaterial===!0){let V=r.properties.get(w);V.light=N}return w}function T(L,I,N,A,w){if(L.visible===!1)return;if(L.layers.test(I.layers)&&(L.isMesh||L.isLine||L.isPoints)&&(L.castShadow||L.receiveShadow&&w===fs)&&(!L.frustumCulled||n.intersectsObject(L))){L.modelViewMatrix.multiplyMatrices(N.matrixWorldInverse,L.matrixWorld);let Z=t.update(L),j=L.material;if(Array.isArray(j)){let rt=Z.groups;for(let $=0,nt=rt.length;$=1):nt.indexOf("OpenGL ES")!==-1&&($=parseFloat(/^OpenGL ES (\d)/.exec(nt)[1]),rt=$>=2);let K=null,gt={},z=r.getParameter(r.SCISSOR_BOX),bt=r.getParameter(r.VIEWPORT),jt=new Hn().fromArray(z),fe=new Hn().fromArray(bt);function ot(X,lt,ut,ht){let St=new Uint8Array(4),Yt=r.createTexture();r.bindTexture(X,Yt),r.texParameteri(X,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(X,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let me=0;me"u"?!1:/OculusBrowser/g.test(navigator.userAgent),f=new Pe,d=new WeakMap,g,p=new WeakMap,m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function M(O,C){return m?new OffscreenCanvas(O,C):Oh("canvas")}function y(O,C,it){let ft=1,mt=Gt(O);if((mt.width>it||mt.height>it)&&(ft=it/Math.max(mt.width,mt.height)),ft<1)if(typeof HTMLImageElement<"u"&&O instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&O instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&O instanceof ImageBitmap||typeof VideoFrame<"u"&&O instanceof VideoFrame){let at=Math.floor(ft*mt.width),zt=Math.floor(ft*mt.height);g===void 0&&(g=M(at,zt));let yt=C?M(at,zt):g;return yt.width=at,yt.height=zt,yt.getContext("2d").drawImage(O,0,0,at,zt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+mt.width+"x"+mt.height+") to ("+at+"x"+zt+")."),yt}else return"data"in O&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+mt.width+"x"+mt.height+")."),O;return O}function v(O){return O.generateMipmaps&&O.minFilter!==hr&&O.minFilter!==br}function x(O){r.generateMipmap(O)}function E(O,C,it,ft,mt=!1){if(O!==null){if(r[O]!==void 0)return r[O];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+O+"'")}let at=C;if(C===r.RED&&(it===r.FLOAT&&(at=r.R32F),it===r.HALF_FLOAT&&(at=r.R16F),it===r.UNSIGNED_BYTE&&(at=r.R8)),C===r.RED_INTEGER&&(it===r.UNSIGNED_BYTE&&(at=r.R8UI),it===r.UNSIGNED_SHORT&&(at=r.R16UI),it===r.UNSIGNED_INT&&(at=r.R32UI),it===r.BYTE&&(at=r.R8I),it===r.SHORT&&(at=r.R16I),it===r.INT&&(at=r.R32I)),C===r.RG&&(it===r.FLOAT&&(at=r.RG32F),it===r.HALF_FLOAT&&(at=r.RG16F),it===r.UNSIGNED_BYTE&&(at=r.RG8)),C===r.RG_INTEGER&&(it===r.UNSIGNED_BYTE&&(at=r.RG8UI),it===r.UNSIGNED_SHORT&&(at=r.RG16UI),it===r.UNSIGNED_INT&&(at=r.RG32UI),it===r.BYTE&&(at=r.RG8I),it===r.SHORT&&(at=r.RG16I),it===r.INT&&(at=r.RG32I)),C===r.RGB&&it===r.UNSIGNED_INT_5_9_9_9_REV&&(at=r.RGB9_E5),C===r.RGBA){let zt=mt?Lh:qe.getTransfer(ft);it===r.FLOAT&&(at=r.RGBA32F),it===r.HALF_FLOAT&&(at=r.RGBA16F),it===r.UNSIGNED_BYTE&&(at=zt===on?r.SRGB8_ALPHA8:r.RGBA8),it===r.UNSIGNED_SHORT_4_4_4_4&&(at=r.RGBA4),it===r.UNSIGNED_SHORT_5_5_5_1&&(at=r.RGB5_A1)}return(at===r.R16F||at===r.R32F||at===r.RG16F||at===r.RG32F||at===r.RGBA16F||at===r.RGBA32F)&&t.get("EXT_color_buffer_float"),at}function b(O,C){let it;return O?C===null||C===Yo||C===rl?it=r.DEPTH24_STENCIL8:C===ms?it=r.DEPTH32F_STENCIL8:C===xc&&(it=r.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):C===null||C===Yo||C===rl?it=r.DEPTH_COMPONENT24:C===ms?it=r.DEPTH_COMPONENT32F:C===xc&&(it=r.DEPTH_COMPONENT16),it}function T(O,C){return v(O)===!0||O.isFramebufferTexture&&O.minFilter!==hr&&O.minFilter!==br?Math.log2(Math.max(C.width,C.height))+1:O.mipmaps!==void 0&&O.mipmaps.length>0?O.mipmaps.length:O.isCompressedTexture&&Array.isArray(O.image)?C.mipmaps.length:1}function U(O){let C=O.target;C.removeEventListener("dispose",U),I(C),C.isVideoTexture&&d.delete(C)}function L(O){let C=O.target;C.removeEventListener("dispose",L),A(C)}function I(O){let C=n.get(O);if(C.__webglInit===void 0)return;let it=O.source,ft=p.get(it);if(ft){let mt=ft[C.__cacheKey];mt.usedTimes--,mt.usedTimes===0&&N(O),Object.keys(ft).length===0&&p.delete(it)}n.remove(O)}function N(O){let C=n.get(O);r.deleteTexture(C.__webglTexture);let it=O.source,ft=p.get(it);delete ft[C.__cacheKey],l.memory.textures--}function A(O){let C=n.get(O);if(O.depthTexture&&O.depthTexture.dispose(),O.isWebGLCubeRenderTarget)for(let ft=0;ft<6;ft++){if(Array.isArray(C.__webglFramebuffer[ft]))for(let mt=0;mt=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+O+" texture units while this GPU supports only "+i.maxTextures),w+=1,O}function Z(O){let C=[];return C.push(O.wrapS),C.push(O.wrapT),C.push(O.wrapR||0),C.push(O.magFilter),C.push(O.minFilter),C.push(O.anisotropy),C.push(O.internalFormat),C.push(O.format),C.push(O.type),C.push(O.generateMipmaps),C.push(O.premultiplyAlpha),C.push(O.flipY),C.push(O.unpackAlignment),C.push(O.colorSpace),C.join()}function j(O,C){let it=n.get(O);if(O.isVideoTexture&&et(O),O.isRenderTargetTexture===!1&&O.version>0&&it.__version!==O.version){let ft=O.image;if(ft===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ft.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{fe(it,O,C);return}}e.bindTexture(r.TEXTURE_2D,it.__webglTexture,r.TEXTURE0+C)}function rt(O,C){let it=n.get(O);if(O.version>0&&it.__version!==O.version){fe(it,O,C);return}e.bindTexture(r.TEXTURE_2D_ARRAY,it.__webglTexture,r.TEXTURE0+C)}function $(O,C){let it=n.get(O);if(O.version>0&&it.__version!==O.version){fe(it,O,C);return}e.bindTexture(r.TEXTURE_3D,it.__webglTexture,r.TEXTURE0+C)}function nt(O,C){let it=n.get(O);if(O.version>0&&it.__version!==O.version){ot(it,O,C);return}e.bindTexture(r.TEXTURE_CUBE_MAP,it.__webglTexture,r.TEXTURE0+C)}let K={[am]:r.REPEAT,[Xo]:r.CLAMP_TO_EDGE,[lm]:r.MIRRORED_REPEAT},gt={[hr]:r.NEAREST,[nP]:r.NEAREST_MIPMAP_NEAREST,[ju]:r.NEAREST_MIPMAP_LINEAR,[br]:r.LINEAR,[Rp]:r.LINEAR_MIPMAP_NEAREST,[qo]:r.LINEAR_MIPMAP_LINEAR},z={[aP]:r.NEVER,[dP]:r.ALWAYS,[lP]:r.LESS,[tM]:r.LEQUAL,[cP]:r.EQUAL,[fP]:r.GEQUAL,[uP]:r.GREATER,[hP]:r.NOTEQUAL};function bt(O,C){if(C.type===ms&&t.has("OES_texture_float_linear")===!1&&(C.magFilter===br||C.magFilter===Rp||C.magFilter===ju||C.magFilter===qo||C.minFilter===br||C.minFilter===Rp||C.minFilter===ju||C.minFilter===qo)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(O,r.TEXTURE_WRAP_S,K[C.wrapS]),r.texParameteri(O,r.TEXTURE_WRAP_T,K[C.wrapT]),(O===r.TEXTURE_3D||O===r.TEXTURE_2D_ARRAY)&&r.texParameteri(O,r.TEXTURE_WRAP_R,K[C.wrapR]),r.texParameteri(O,r.TEXTURE_MAG_FILTER,gt[C.magFilter]),r.texParameteri(O,r.TEXTURE_MIN_FILTER,gt[C.minFilter]),C.compareFunction&&(r.texParameteri(O,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(O,r.TEXTURE_COMPARE_FUNC,z[C.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(C.magFilter===hr||C.minFilter!==ju&&C.minFilter!==qo||C.type===ms&&t.has("OES_texture_float_linear")===!1)return;if(C.anisotropy>1||n.get(C).__currentAnisotropy){let it=t.get("EXT_texture_filter_anisotropic");r.texParameterf(O,it.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(C.anisotropy,i.getMaxAnisotropy())),n.get(C).__currentAnisotropy=C.anisotropy}}}function jt(O,C){let it=!1;O.__webglInit===void 0&&(O.__webglInit=!0,C.addEventListener("dispose",U));let ft=C.source,mt=p.get(ft);mt===void 0&&(mt={},p.set(ft,mt));let at=Z(C);if(at!==O.__cacheKey){mt[at]===void 0&&(mt[at]={texture:r.createTexture(),usedTimes:0},l.memory.textures++,it=!0),mt[at].usedTimes++;let zt=mt[O.__cacheKey];zt!==void 0&&(mt[O.__cacheKey].usedTimes--,zt.usedTimes===0&&N(C)),O.__cacheKey=at,O.__webglTexture=mt[at].texture}return it}function fe(O,C,it){let ft=r.TEXTURE_2D;(C.isDataArrayTexture||C.isCompressedArrayTexture)&&(ft=r.TEXTURE_2D_ARRAY),C.isData3DTexture&&(ft=r.TEXTURE_3D);let mt=jt(O,C),at=C.source;e.bindTexture(ft,O.__webglTexture,r.TEXTURE0+it);let zt=n.get(at);if(at.version!==zt.__version||mt===!0){e.activeTexture(r.TEXTURE0+it);let yt=qe.getPrimaries(qe.workingColorSpace),Ct=C.colorSpace===Ks?null:qe.getPrimaries(C.colorSpace),Qt=C.colorSpace===Ks||yt===Ct?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,C.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,C.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,C.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Qt);let Mt=y(C.image,!1,i.maxTextureSize);Mt=Vt(C,Mt);let It=o.convert(C.format,C.colorSpace),Kt=o.convert(C.type),ee=E(C.internalFormat,It,Kt,C.colorSpace,C.isVideoTexture);bt(ft,C);let Pt,ne=C.mipmaps,de=C.isVideoTexture!==!0,ze=zt.__version===void 0||mt===!0,X=at.dataReady,lt=T(C,Mt);if(C.isDepthTexture)ee=b(C.format===sl,C.type),ze&&(de?e.texStorage2D(r.TEXTURE_2D,1,ee,Mt.width,Mt.height):e.texImage2D(r.TEXTURE_2D,0,ee,Mt.width,Mt.height,0,It,Kt,null));else if(C.isDataTexture)if(ne.length>0){de&&ze&&e.texStorage2D(r.TEXTURE_2D,lt,ee,ne[0].width,ne[0].height);for(let ut=0,ht=ne.length;ut0){let St=Fy(Pt.width,Pt.height,C.format,C.type);for(let Yt of C.layerUpdates){let me=Pt.data.subarray(Yt*St/Pt.data.BYTES_PER_ELEMENT,(Yt+1)*St/Pt.data.BYTES_PER_ELEMENT);e.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,ut,0,0,Yt,Pt.width,Pt.height,1,It,me,0,0)}C.clearLayerUpdates()}else e.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,ut,0,0,0,Pt.width,Pt.height,Mt.depth,It,Pt.data,0,0)}else e.compressedTexImage3D(r.TEXTURE_2D_ARRAY,ut,ee,Pt.width,Pt.height,Mt.depth,0,Pt.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else de?X&&e.texSubImage3D(r.TEXTURE_2D_ARRAY,ut,0,0,0,Pt.width,Pt.height,Mt.depth,It,Kt,Pt.data):e.texImage3D(r.TEXTURE_2D_ARRAY,ut,ee,Pt.width,Pt.height,Mt.depth,0,It,Kt,Pt.data)}else{de&&ze&&e.texStorage2D(r.TEXTURE_2D,lt,ee,ne[0].width,ne[0].height);for(let ut=0,ht=ne.length;ut0){let ut=Fy(Mt.width,Mt.height,C.format,C.type);for(let ht of C.layerUpdates){let St=Mt.data.subarray(ht*ut/Mt.data.BYTES_PER_ELEMENT,(ht+1)*ut/Mt.data.BYTES_PER_ELEMENT);e.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,ht,Mt.width,Mt.height,1,It,Kt,St)}C.clearLayerUpdates()}else e.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,Mt.width,Mt.height,Mt.depth,It,Kt,Mt.data)}else e.texImage3D(r.TEXTURE_2D_ARRAY,0,ee,Mt.width,Mt.height,Mt.depth,0,It,Kt,Mt.data);else if(C.isData3DTexture)de?(ze&&e.texStorage3D(r.TEXTURE_3D,lt,ee,Mt.width,Mt.height,Mt.depth),X&&e.texSubImage3D(r.TEXTURE_3D,0,0,0,0,Mt.width,Mt.height,Mt.depth,It,Kt,Mt.data)):e.texImage3D(r.TEXTURE_3D,0,ee,Mt.width,Mt.height,Mt.depth,0,It,Kt,Mt.data);else if(C.isFramebufferTexture){if(ze)if(de)e.texStorage2D(r.TEXTURE_2D,lt,ee,Mt.width,Mt.height);else{let ut=Mt.width,ht=Mt.height;for(let St=0;St>=1,ht>>=1}}else if(ne.length>0){if(de&&ze){let ut=Gt(ne[0]);e.texStorage2D(r.TEXTURE_2D,lt,ee,ut.width,ut.height)}for(let ut=0,ht=ne.length;ut0&<++;let ht=Gt(It[0]);e.texStorage2D(r.TEXTURE_CUBE_MAP,lt,ne,ht.width,ht.height)}for(let ht=0;ht<6;ht++)if(Mt){de?X&&e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ht,0,0,0,It[ht].width,It[ht].height,ee,Pt,It[ht].data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ht,0,ne,It[ht].width,It[ht].height,0,ee,Pt,It[ht].data);for(let St=0;St>at),It=Math.max(1,C.height>>at);mt===r.TEXTURE_3D||mt===r.TEXTURE_2D_ARRAY?e.texImage3D(mt,at,Ct,Mt,It,C.depth,0,zt,yt,null):e.texImage2D(mt,at,Ct,Mt,It,0,zt,yt,null)}e.bindFramebuffer(r.FRAMEBUFFER,O),Ut(C)?c.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,ft,mt,n.get(it).__webglTexture,0,se(C)):(mt===r.TEXTURE_2D||mt>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&mt<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,ft,mt,n.get(it).__webglTexture,at),e.bindFramebuffer(r.FRAMEBUFFER,null)}function Et(O,C,it){if(r.bindRenderbuffer(r.RENDERBUFFER,O),C.depthBuffer){let ft=C.depthTexture,mt=ft&&ft.isDepthTexture?ft.type:null,at=b(C.stencilBuffer,mt),zt=C.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,yt=se(C);Ut(C)?c.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,yt,at,C.width,C.height):it?r.renderbufferStorageMultisample(r.RENDERBUFFER,yt,at,C.width,C.height):r.renderbufferStorage(r.RENDERBUFFER,at,C.width,C.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,zt,r.RENDERBUFFER,O)}else{let ft=C.textures;for(let mt=0;mt{delete C.__boundDepthTexture,delete C.__depthDisposeCallback,ft.removeEventListener("dispose",mt)};ft.addEventListener("dispose",mt),C.__depthDisposeCallback=mt}C.__boundDepthTexture=ft}if(O.depthTexture&&!C.__autoAllocateDepthBuffer){if(it)throw new Error("target.depthTexture not supported in Cube render targets");wt(C.__webglFramebuffer,O)}else if(it){C.__webglDepthbuffer=[];for(let ft=0;ft<6;ft++)if(e.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer[ft]),C.__webglDepthbuffer[ft]===void 0)C.__webglDepthbuffer[ft]=r.createRenderbuffer(),Et(C.__webglDepthbuffer[ft],O,!1);else{let mt=O.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,at=C.__webglDepthbuffer[ft];r.bindRenderbuffer(r.RENDERBUFFER,at),r.framebufferRenderbuffer(r.FRAMEBUFFER,mt,r.RENDERBUFFER,at)}}else if(e.bindFramebuffer(r.FRAMEBUFFER,C.__webglFramebuffer),C.__webglDepthbuffer===void 0)C.__webglDepthbuffer=r.createRenderbuffer(),Et(C.__webglDepthbuffer,O,!1);else{let ft=O.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,mt=C.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,mt),r.framebufferRenderbuffer(r.FRAMEBUFFER,ft,r.RENDERBUFFER,mt)}e.bindFramebuffer(r.FRAMEBUFFER,null)}function Ht(O,C,it){let ft=n.get(O);C!==void 0&&_t(ft.__webglFramebuffer,O,O.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),it!==void 0&&kt(O)}function ae(O){let C=O.texture,it=n.get(O),ft=n.get(C);O.addEventListener("dispose",L);let mt=O.textures,at=O.isWebGLCubeRenderTarget===!0,zt=mt.length>1;if(zt||(ft.__webglTexture===void 0&&(ft.__webglTexture=r.createTexture()),ft.__version=C.version,l.memory.textures++),at){it.__webglFramebuffer=[];for(let yt=0;yt<6;yt++)if(C.mipmaps&&C.mipmaps.length>0){it.__webglFramebuffer[yt]=[];for(let Ct=0;Ct0){it.__webglFramebuffer=[];for(let yt=0;yt0&&Ut(O)===!1){it.__webglMultisampledFramebuffer=r.createFramebuffer(),it.__webglColorRenderbuffer=[],e.bindFramebuffer(r.FRAMEBUFFER,it.__webglMultisampledFramebuffer);for(let yt=0;yt0)for(let Ct=0;Ct0)for(let Ct=0;Ct0){if(Ut(O)===!1){let C=O.textures,it=O.width,ft=O.height,mt=r.COLOR_BUFFER_BIT,at=O.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,zt=n.get(O),yt=C.length>1;if(yt)for(let Ct=0;Ct0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&C.__useRenderToTexture!==!1}function et(O){let C=l.render.frame;d.get(O)!==C&&(d.set(O,C),O.update())}function Vt(O,C){let it=O.colorSpace,ft=O.format,mt=O.type;return O.isCompressedTexture===!0||O.isVideoTexture===!0||it!==io&&it!==Ks&&(qe.getTransfer(it)===on?(ft!==Tr||mt!==_s)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",it)),C}function Gt(O){return typeof HTMLImageElement<"u"&&O instanceof HTMLImageElement?(f.width=O.naturalWidth||O.width,f.height=O.naturalHeight||O.height):typeof VideoFrame<"u"&&O instanceof VideoFrame?(f.width=O.displayWidth,f.height=O.displayHeight):(f.width=O.width,f.height=O.height),f}this.allocateTextureUnit=V,this.resetTextureUnits=B,this.setTexture2D=j,this.setTexture2DArray=rt,this.setTexture3D=$,this.setTextureCube=nt,this.rebindTextures=Ht,this.setupRenderTarget=ae,this.updateRenderTargetMipmap=_e,this.updateMultisampleRenderTarget=re,this.setupDepthRenderbuffer=kt,this.setupFrameBufferTexture=_t,this.useMultisampledRTT=Ut}function i3(r,t){function e(n,i=Ks){let o,l=qe.getTransfer(i);if(n===_s)return r.UNSIGNED_BYTE;if(n===mg)return r.UNSIGNED_SHORT_4_4_4_4;if(n===gg)return r.UNSIGNED_SHORT_5_5_5_1;if(n===qy)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===Wy)return r.BYTE;if(n===Xy)return r.SHORT;if(n===xc)return r.UNSIGNED_SHORT;if(n===pg)return r.INT;if(n===Yo)return r.UNSIGNED_INT;if(n===ms)return r.FLOAT;if(n===Mc)return r.HALF_FLOAT;if(n===Yy)return r.ALPHA;if(n===Zy)return r.RGB;if(n===Tr)return r.RGBA;if(n===$y)return r.LUMINANCE;if(n===Jy)return r.LUMINANCE_ALPHA;if(n===ja)return r.DEPTH_COMPONENT;if(n===sl)return r.DEPTH_STENCIL;if(n===Ky)return r.RED;if(n===_g)return r.RED_INTEGER;if(n===Qy)return r.RG;if(n===vg)return r.RG_INTEGER;if(n===xg)return r.RGBA_INTEGER;if(n===bh||n===Th||n===Eh||n===Ah)if(l===on)if(o=t.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(n===bh)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Th)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Eh)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Ah)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=t.get("WEBGL_compressed_texture_s3tc"),o!==null){if(n===bh)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Th)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Eh)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Ah)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===cm||n===um||n===hm||n===fm)if(o=t.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(n===cm)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===um)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===hm)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===fm)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===dm||n===pm||n===mm)if(o=t.get("WEBGL_compressed_texture_etc"),o!==null){if(n===dm||n===pm)return l===on?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(n===mm)return l===on?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===gm||n===_m||n===vm||n===xm||n===ym||n===Mm||n===Sm||n===wm||n===bm||n===Tm||n===Em||n===Am||n===Cm||n===Rm)if(o=t.get("WEBGL_compressed_texture_astc"),o!==null){if(n===gm)return l===on?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===_m)return l===on?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===vm)return l===on?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===xm)return l===on?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===ym)return l===on?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Mm)return l===on?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Sm)return l===on?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===wm)return l===on?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===bm)return l===on?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Tm)return l===on?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Em)return l===on?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Am)return l===on?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Cm)return l===on?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Rm)return l===on?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Ch||n===Pm||n===Im)if(o=t.get("EXT_texture_compression_bptc"),o!==null){if(n===Ch)return l===on?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Pm)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Im)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===jy||n===Lm||n===Dm||n===Um)if(o=t.get("EXT_texture_compression_rgtc"),o!==null){if(n===Ch)return o.COMPRESSED_RED_RGTC1_EXT;if(n===Lm)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Dm)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Um)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===rl?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:e}}var Km=class extends qn{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}},Ka=class extends dr{constructor(){super(),this.isGroup=!0,this.type="Group"}},r3={type:"move"},vc=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ka,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Ka,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new tt,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new tt),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ka,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new tt,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new tt),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){let e=this._hand;if(e)for(let n of t.hand.values())this._getHandJoint(e,n)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,e,n){let i=null,o=null,l=null,c=this._targetRay,u=this._grip,f=this._hand;if(t&&e.session.visibilityState!=="visible-blurred"){if(f&&t.hand){l=!0;for(let y of t.hand.values()){let v=e.getJointPose(y,n),x=this._getHandJoint(f,y);v!==null&&(x.matrix.fromArray(v.transform.matrix),x.matrix.decompose(x.position,x.rotation,x.scale),x.matrixWorldNeedsUpdate=!0,x.jointRadius=v.radius),x.visible=v!==null}let d=f.joints["index-finger-tip"],g=f.joints["thumb-tip"],p=d.position.distanceTo(g.position),m=.02,M=.005;f.inputState.pinching&&p>m+M?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!f.inputState.pinching&&p<=m-M&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else u!==null&&t.gripSpace&&(o=e.getPose(t.gripSpace,n),o!==null&&(u.matrix.fromArray(o.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,o.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(o.linearVelocity)):u.hasLinearVelocity=!1,o.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(o.angularVelocity)):u.hasAngularVelocity=!1));c!==null&&(i=e.getPose(t.targetRaySpace,n),i===null&&o!==null&&(i=o),i!==null&&(c.matrix.fromArray(i.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,i.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(i.linearVelocity)):c.hasLinearVelocity=!1,i.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(i.angularVelocity)):c.hasAngularVelocity=!1,this.dispatchEvent(r3)))}return c!==null&&(c.visible=i!==null),u!==null&&(u.visible=o!==null),f!==null&&(f.visible=l!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){let n=new Ka;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}},s3=` void main() { gl_Position = vec4( position, 1.0 ); }`,o3=` uniform sampler2DArray depthColor; uniform float depthWidth; uniform float depthHeight; void main() { vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); if ( coord.x >= 1.0 ) { gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; } else { gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; } }`,Qm=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,n){if(this.texture===null){let i=new fr,o=t.properties.get(i);o.__webglTexture=e.texture,(e.depthNear!=n.depthNear||e.depthFar!=n.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(t){if(this.texture!==null&&this.mesh===null){let e=t.cameras[0].viewport,n=new Ui({vertexShader:s3,fragmentShader:o3,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new Er(new ll(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},jm=class extends eo{constructor(t,e){super();let n=this,i=null,o=1,l=null,c="local-floor",u=1,f=null,d=null,g=null,p=null,m=null,M=null,y=new Qm,v=e.getContextAttributes(),x=null,E=null,b=[],T=[],U=new Pe,L=null,I=new qn;I.layers.enable(1),I.viewport=new Hn;let N=new qn;N.layers.enable(2),N.viewport=new Hn;let A=[I,N],w=new Km;w.layers.enable(1),w.layers.enable(2);let B=null,V=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ot){let _t=b[ot];return _t===void 0&&(_t=new vc,b[ot]=_t),_t.getTargetRaySpace()},this.getControllerGrip=function(ot){let _t=b[ot];return _t===void 0&&(_t=new vc,b[ot]=_t),_t.getGripSpace()},this.getHand=function(ot){let _t=b[ot];return _t===void 0&&(_t=new vc,b[ot]=_t),_t.getHandSpace()};function Z(ot){let _t=T.indexOf(ot.inputSource);if(_t===-1)return;let Et=b[_t];Et!==void 0&&(Et.update(ot.inputSource,ot.frame,f||l),Et.dispatchEvent({type:ot.type,data:ot.inputSource}))}function j(){i.removeEventListener("select",Z),i.removeEventListener("selectstart",Z),i.removeEventListener("selectend",Z),i.removeEventListener("squeeze",Z),i.removeEventListener("squeezestart",Z),i.removeEventListener("squeezeend",Z),i.removeEventListener("end",j),i.removeEventListener("inputsourceschange",rt);for(let ot=0;ot=0&&(T[wt]=null,b[wt].disconnect(Et))}for(let _t=0;_t=T.length){T.push(Et),wt=Ht;break}else if(T[Ht]===null){T[Ht]=Et,wt=Ht;break}if(wt===-1)break}let kt=b[wt];kt&&kt.connect(Et)}}let $=new tt,nt=new tt;function K(ot,_t,Et){$.setFromMatrixPosition(_t.matrixWorld),nt.setFromMatrixPosition(Et.matrixWorld);let wt=$.distanceTo(nt),kt=_t.projectionMatrix.elements,Ht=Et.projectionMatrix.elements,ae=kt[14]/(kt[10]-1),_e=kt[14]/(kt[10]+1),k=(kt[9]+1)/kt[5],Jt=(kt[9]-1)/kt[5],re=(kt[8]-1)/kt[0],se=(Ht[8]+1)/Ht[0],Ut=ae*re,et=ae*se,Vt=wt/(-re+se),Gt=Vt*-re;if(_t.matrixWorld.decompose(ot.position,ot.quaternion,ot.scale),ot.translateX(Gt),ot.translateZ(Vt),ot.matrixWorld.compose(ot.position,ot.quaternion,ot.scale),ot.matrixWorldInverse.copy(ot.matrixWorld).invert(),kt[10]===-1)ot.projectionMatrix.copy(_t.projectionMatrix),ot.projectionMatrixInverse.copy(_t.projectionMatrixInverse);else{let O=ae+Vt,C=_e+Vt,it=Ut-Gt,ft=et+(wt-Gt),mt=k*_e/C*O,at=Jt*_e/C*O;ot.projectionMatrix.makePerspective(it,ft,mt,at,O,C),ot.projectionMatrixInverse.copy(ot.projectionMatrix).invert()}}function gt(ot,_t){_t===null?ot.matrixWorld.copy(ot.matrix):ot.matrixWorld.multiplyMatrices(_t.matrixWorld,ot.matrix),ot.matrixWorldInverse.copy(ot.matrixWorld).invert()}this.updateCamera=function(ot){if(i===null)return;let _t=ot.near,Et=ot.far;y.texture!==null&&(y.depthNear>0&&(_t=y.depthNear),y.depthFar>0&&(Et=y.depthFar)),w.near=N.near=I.near=_t,w.far=N.far=I.far=Et,(B!==w.near||V!==w.far)&&(i.updateRenderState({depthNear:w.near,depthFar:w.far}),B=w.near,V=w.far);let wt=ot.parent,kt=w.cameras;gt(w,wt);for(let Ht=0;Ht0&&(v.alphaTest.value=x.alphaTest);let E=t.get(x),b=E.envMap,T=E.envMapRotation;b&&(v.envMap.value=b,Ho.copy(T),Ho.x*=-1,Ho.y*=-1,Ho.z*=-1,b.isCubeTexture&&b.isRenderTargetTexture===!1&&(Ho.y*=-1,Ho.z*=-1),v.envMapRotation.value.setFromMatrix4(a3.makeRotationFromEuler(Ho)),v.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,v.reflectivity.value=x.reflectivity,v.ior.value=x.ior,v.refractionRatio.value=x.refractionRatio),x.lightMap&&(v.lightMap.value=x.lightMap,v.lightMapIntensity.value=x.lightMapIntensity,e(x.lightMap,v.lightMapTransform)),x.aoMap&&(v.aoMap.value=x.aoMap,v.aoMapIntensity.value=x.aoMapIntensity,e(x.aoMap,v.aoMapTransform))}function l(v,x){v.diffuse.value.copy(x.color),v.opacity.value=x.opacity,x.map&&(v.map.value=x.map,e(x.map,v.mapTransform))}function c(v,x){v.dashSize.value=x.dashSize,v.totalSize.value=x.dashSize+x.gapSize,v.scale.value=x.scale}function u(v,x,E,b){v.diffuse.value.copy(x.color),v.opacity.value=x.opacity,v.size.value=x.size*E,v.scale.value=b*.5,x.map&&(v.map.value=x.map,e(x.map,v.uvTransform)),x.alphaMap&&(v.alphaMap.value=x.alphaMap,e(x.alphaMap,v.alphaMapTransform)),x.alphaTest>0&&(v.alphaTest.value=x.alphaTest)}function f(v,x){v.diffuse.value.copy(x.color),v.opacity.value=x.opacity,v.rotation.value=x.rotation,x.map&&(v.map.value=x.map,e(x.map,v.mapTransform)),x.alphaMap&&(v.alphaMap.value=x.alphaMap,e(x.alphaMap,v.alphaMapTransform)),x.alphaTest>0&&(v.alphaTest.value=x.alphaTest)}function d(v,x){v.specular.value.copy(x.specular),v.shininess.value=Math.max(x.shininess,1e-4)}function g(v,x){x.gradientMap&&(v.gradientMap.value=x.gradientMap)}function p(v,x){v.metalness.value=x.metalness,x.metalnessMap&&(v.metalnessMap.value=x.metalnessMap,e(x.metalnessMap,v.metalnessMapTransform)),v.roughness.value=x.roughness,x.roughnessMap&&(v.roughnessMap.value=x.roughnessMap,e(x.roughnessMap,v.roughnessMapTransform)),x.envMap&&(v.envMapIntensity.value=x.envMapIntensity)}function m(v,x,E){v.ior.value=x.ior,x.sheen>0&&(v.sheenColor.value.copy(x.sheenColor).multiplyScalar(x.sheen),v.sheenRoughness.value=x.sheenRoughness,x.sheenColorMap&&(v.sheenColorMap.value=x.sheenColorMap,e(x.sheenColorMap,v.sheenColorMapTransform)),x.sheenRoughnessMap&&(v.sheenRoughnessMap.value=x.sheenRoughnessMap,e(x.sheenRoughnessMap,v.sheenRoughnessMapTransform))),x.clearcoat>0&&(v.clearcoat.value=x.clearcoat,v.clearcoatRoughness.value=x.clearcoatRoughness,x.clearcoatMap&&(v.clearcoatMap.value=x.clearcoatMap,e(x.clearcoatMap,v.clearcoatMapTransform)),x.clearcoatRoughnessMap&&(v.clearcoatRoughnessMap.value=x.clearcoatRoughnessMap,e(x.clearcoatRoughnessMap,v.clearcoatRoughnessMapTransform)),x.clearcoatNormalMap&&(v.clearcoatNormalMap.value=x.clearcoatNormalMap,e(x.clearcoatNormalMap,v.clearcoatNormalMapTransform),v.clearcoatNormalScale.value.copy(x.clearcoatNormalScale),x.side===Ii&&v.clearcoatNormalScale.value.negate())),x.dispersion>0&&(v.dispersion.value=x.dispersion),x.iridescence>0&&(v.iridescence.value=x.iridescence,v.iridescenceIOR.value=x.iridescenceIOR,v.iridescenceThicknessMinimum.value=x.iridescenceThicknessRange[0],v.iridescenceThicknessMaximum.value=x.iridescenceThicknessRange[1],x.iridescenceMap&&(v.iridescenceMap.value=x.iridescenceMap,e(x.iridescenceMap,v.iridescenceMapTransform)),x.iridescenceThicknessMap&&(v.iridescenceThicknessMap.value=x.iridescenceThicknessMap,e(x.iridescenceThicknessMap,v.iridescenceThicknessMapTransform))),x.transmission>0&&(v.transmission.value=x.transmission,v.transmissionSamplerMap.value=E.texture,v.transmissionSamplerSize.value.set(E.width,E.height),x.transmissionMap&&(v.transmissionMap.value=x.transmissionMap,e(x.transmissionMap,v.transmissionMapTransform)),v.thickness.value=x.thickness,x.thicknessMap&&(v.thicknessMap.value=x.thicknessMap,e(x.thicknessMap,v.thicknessMapTransform)),v.attenuationDistance.value=x.attenuationDistance,v.attenuationColor.value.copy(x.attenuationColor)),x.anisotropy>0&&(v.anisotropyVector.value.set(x.anisotropy*Math.cos(x.anisotropyRotation),x.anisotropy*Math.sin(x.anisotropyRotation)),x.anisotropyMap&&(v.anisotropyMap.value=x.anisotropyMap,e(x.anisotropyMap,v.anisotropyMapTransform))),v.specularIntensity.value=x.specularIntensity,v.specularColor.value.copy(x.specularColor),x.specularColorMap&&(v.specularColorMap.value=x.specularColorMap,e(x.specularColorMap,v.specularColorMapTransform)),x.specularIntensityMap&&(v.specularIntensityMap.value=x.specularIntensityMap,e(x.specularIntensityMap,v.specularIntensityMapTransform))}function M(v,x){x.matcap&&(v.matcap.value=x.matcap)}function y(v,x){let E=t.get(x).light;v.referencePosition.value.setFromMatrixPosition(E.matrixWorld),v.nearDistance.value=E.shadow.camera.near,v.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function c3(r,t,e,n){let i={},o={},l=[],c=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function u(E,b){let T=b.program;n.uniformBlockBinding(E,T)}function f(E,b){let T=i[E.id];T===void 0&&(M(E),T=d(E),i[E.id]=T,E.addEventListener("dispose",v));let U=b.program;n.updateUBOMapping(E,U);let L=t.render.frame;o[E.id]!==L&&(p(E),o[E.id]=L)}function d(E){let b=g();E.__bindingPointIndex=b;let T=r.createBuffer(),U=E.__size,L=E.usage;return r.bindBuffer(r.UNIFORM_BUFFER,T),r.bufferData(r.UNIFORM_BUFFER,U,L),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,b,T),T}function g(){for(let E=0;E0&&(T+=U-L),E.__size=T,E.__cache={},this}function y(E){let b={boundary:0,storage:0};return typeof E=="number"||typeof E=="boolean"?(b.boundary=4,b.storage=4):E.isVector2?(b.boundary=8,b.storage=8):E.isVector3||E.isColor?(b.boundary=16,b.storage=12):E.isVector4?(b.boundary=16,b.storage=16):E.isMatrix3?(b.boundary=48,b.storage=48):E.isMatrix4?(b.boundary=64,b.storage=64):E.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",E),b}function v(E){let b=E.target;b.removeEventListener("dispose",v);let T=l.indexOf(b.__bindingPointIndex);l.splice(T,1),r.deleteBuffer(i[b.id]),delete i[b.id],delete o[b.id]}function x(){for(let E in i)r.deleteBuffer(i[E]);l=[],i={},o={}}return{bind:u,update:f,dispose:x}}var cl=class{constructor(t={}){let{canvas:e=mP(),context:n=null,depth:i=!0,stencil:o=!1,alpha:l=!1,antialias:c=!1,premultipliedAlpha:u=!0,preserveDrawingBuffer:f=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:g=!1}=t;this.isWebGLRenderer=!0;let p;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=n.getContextAttributes().alpha}else p=l;let m=new Uint32Array(4),M=new Int32Array(4),y=null,v=null,x=[],E=[];this.domElement=e,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._outputColorSpace=kr,this.toneMapping=js,this.toneMappingExposure=1;let b=this,T=!1,U=0,L=0,I=null,N=-1,A=null,w=new Hn,B=new Hn,V=null,Z=new ke(0),j=0,rt=e.width,$=e.height,nt=1,K=null,gt=null,z=new Hn(0,0,rt,$),bt=new Hn(0,0,rt,$),jt=!1,fe=new qh,ot=!1,_t=!1,Et=new Ln,wt=new tt,kt=new Hn,Ht={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},ae=!1;function _e(){return I===null?nt:1}let k=n;function Jt(P,G){return e.getContext(P,G)}try{let P={alpha:!0,depth:i,stencil:o,antialias:c,premultipliedAlpha:u,preserveDrawingBuffer:f,powerPreference:d,failIfMajorPerformanceCaveat:g};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${dg}`),e.addEventListener("webglcontextlost",ut,!1),e.addEventListener("webglcontextrestored",ht,!1),e.addEventListener("webglcontextcreationerror",St,!1),k===null){let G="webgl2";if(k=Jt(G,P),k===null)throw Jt(G)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(P){throw console.error("THREE.WebGLRenderer: "+P.message),P}let re,se,Ut,et,Vt,Gt,O,C,it,ft,mt,at,zt,yt,Ct,Qt,Mt,It,Kt,ee,Pt,ne,de,ze;function X(){re=new EL(k),re.init(),ne=new i3(k,re),se=new yL(k,re,t,ne),Ut=new t3(k),et=new RL(k),Vt=new VD,Gt=new n3(k,re,Ut,Vt,se,ne,et),O=new SL(b),C=new TL(b),it=new OP(k),de=new vL(k,it),ft=new AL(k,it,et,de),mt=new IL(k,ft,it,et),Kt=new PL(k,se,Gt),Qt=new ML(Vt),at=new HD(b,O,C,re,se,de,Qt),zt=new l3(b,Vt),yt=new WD,Ct=new JD(re),It=new _L(b,O,C,Ut,mt,p,u),Mt=new jD(b,mt,se),ze=new c3(k,et,se,Ut),ee=new xL(k,re,et),Pt=new CL(k,re,et),et.programs=at.programs,b.capabilities=se,b.extensions=re,b.properties=Vt,b.renderLists=yt,b.shadowMap=Mt,b.state=Ut,b.info=et}X();let lt=new jm(b,k);this.xr=lt,this.getContext=function(){return k},this.getContextAttributes=function(){return k.getContextAttributes()},this.forceContextLoss=function(){let P=re.get("WEBGL_lose_context");P&&P.loseContext()},this.forceContextRestore=function(){let P=re.get("WEBGL_lose_context");P&&P.restoreContext()},this.getPixelRatio=function(){return nt},this.setPixelRatio=function(P){P!==void 0&&(nt=P,this.setSize(rt,$,!1))},this.getSize=function(P){return P.set(rt,$)},this.setSize=function(P,G,Q=!0){if(lt.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}rt=P,$=G,e.width=Math.floor(P*nt),e.height=Math.floor(G*nt),Q===!0&&(e.style.width=P+"px",e.style.height=G+"px"),this.setViewport(0,0,P,G)},this.getDrawingBufferSize=function(P){return P.set(rt*nt,$*nt).floor()},this.setDrawingBufferSize=function(P,G,Q){rt=P,$=G,nt=Q,e.width=Math.floor(P*Q),e.height=Math.floor(G*Q),this.setViewport(0,0,P,G)},this.getCurrentViewport=function(P){return P.copy(w)},this.getViewport=function(P){return P.copy(z)},this.setViewport=function(P,G,Q,J){P.isVector4?z.set(P.x,P.y,P.z,P.w):z.set(P,G,Q,J),Ut.viewport(w.copy(z).multiplyScalar(nt).round())},this.getScissor=function(P){return P.copy(bt)},this.setScissor=function(P,G,Q,J){P.isVector4?bt.set(P.x,P.y,P.z,P.w):bt.set(P,G,Q,J),Ut.scissor(B.copy(bt).multiplyScalar(nt).round())},this.getScissorTest=function(){return jt},this.setScissorTest=function(P){Ut.setScissorTest(jt=P)},this.setOpaqueSort=function(P){K=P},this.setTransparentSort=function(P){gt=P},this.getClearColor=function(P){return P.copy(It.getClearColor())},this.setClearColor=function(){It.setClearColor.apply(It,arguments)},this.getClearAlpha=function(){return It.getClearAlpha()},this.setClearAlpha=function(){It.setClearAlpha.apply(It,arguments)},this.clear=function(P=!0,G=!0,Q=!0){let J=0;if(P){let W=!1;if(I!==null){let vt=I.texture.format;W=vt===xg||vt===vg||vt===_g}if(W){let vt=I.texture.type,At=vt===_s||vt===Yo||vt===xc||vt===rl||vt===mg||vt===gg,Ot=It.getClearColor(),Rt=It.getClearAlpha(),Nt=Ot.r,Zt=Ot.g,qt=Ot.b;At?(m[0]=Nt,m[1]=Zt,m[2]=qt,m[3]=Rt,k.clearBufferuiv(k.COLOR,0,m)):(M[0]=Nt,M[1]=Zt,M[2]=qt,M[3]=Rt,k.clearBufferiv(k.COLOR,0,M))}else J|=k.COLOR_BUFFER_BIT}G&&(J|=k.DEPTH_BUFFER_BIT),Q&&(J|=k.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),k.clear(J)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",ut,!1),e.removeEventListener("webglcontextrestored",ht,!1),e.removeEventListener("webglcontextcreationerror",St,!1),yt.dispose(),Ct.dispose(),Vt.dispose(),O.dispose(),C.dispose(),mt.dispose(),de.dispose(),ze.dispose(),at.dispose(),lt.dispose(),lt.removeEventListener("sessionstart",Wt),lt.removeEventListener("sessionend",Ie),Tt.stop()};function ut(P){P.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),T=!0}function ht(){console.log("THREE.WebGLRenderer: Context Restored."),T=!1;let P=et.autoReset,G=Mt.enabled,Q=Mt.autoUpdate,J=Mt.needsUpdate,W=Mt.type;X(),et.autoReset=P,Mt.enabled=G,Mt.autoUpdate=Q,Mt.needsUpdate=J,Mt.type=W}function St(P){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",P.statusMessage)}function Yt(P){let G=P.target;G.removeEventListener("dispose",Yt),me(G)}function me(P){Ge(P),Vt.remove(P)}function Ge(P){let G=Vt.get(P).programs;G!==void 0&&(G.forEach(function(Q){at.releaseProgram(Q)}),P.isShaderMaterial&&at.releaseShaderCache(P))}this.renderBufferDirect=function(P,G,Q,J,W,vt){G===null&&(G=Ht);let At=W.isMesh&&W.matrixWorld.determinant()<0,Ot=Ze(P,G,Q,J,W);Ut.setMaterial(J,At);let Rt=Q.index,Nt=1;if(J.wireframe===!0){if(Rt=ft.getWireframeAttribute(Q),Rt===void 0)return;Nt=2}let Zt=Q.drawRange,qt=Q.attributes.position,Le=Zt.start*Nt,We=(Zt.start+Zt.count)*Nt;vt!==null&&(Le=Math.max(Le,vt.start*Nt),We=Math.min(We,(vt.start+vt.count)*Nt)),Rt!==null?(Le=Math.max(Le,0),We=Math.min(We,Rt.count)):qt!=null&&(Le=Math.max(Le,0),We=Math.min(We,qt.count));let Ue=We-Le;if(Ue<0||Ue===1/0)return;de.setup(W,J,Ot,Q,Rt);let yn,Ce=ee;if(Rt!==null&&(yn=it.get(Rt),Ce=Pt,Ce.setIndex(yn)),W.isMesh)J.wireframe===!0?(Ut.setLineWidth(J.wireframeLinewidth*_e()),Ce.setMode(k.LINES)):Ce.setMode(k.TRIANGLES);else if(W.isLine){let Xt=J.linewidth;Xt===void 0&&(Xt=1),Ut.setLineWidth(Xt*_e()),W.isLineSegments?Ce.setMode(k.LINES):W.isLineLoop?Ce.setMode(k.LINE_LOOP):Ce.setMode(k.LINE_STRIP)}else W.isPoints?Ce.setMode(k.POINTS):W.isSprite&&Ce.setMode(k.TRIANGLES);if(W.isBatchedMesh)if(W._multiDrawInstances!==null)Ce.renderMultiDrawInstances(W._multiDrawStarts,W._multiDrawCounts,W._multiDrawCount,W._multiDrawInstances);else if(re.get("WEBGL_multi_draw"))Ce.renderMultiDraw(W._multiDrawStarts,W._multiDrawCounts,W._multiDrawCount);else{let Xt=W._multiDrawStarts,bn=W._multiDrawCounts,Be=W._multiDrawCount,si=Rt?it.get(Rt).bytesPerElement:1,Ms=Vt.get(J).currentProgram.getUniforms();for(let Yn=0;Yn{function vt(){if(J.forEach(function(At){Vt.get(At).currentProgram.isReady()&&J.delete(At)}),J.size===0){W(P);return}setTimeout(vt,10)}re.get("KHR_parallel_shader_compile")!==null?vt():setTimeout(vt,10)})};let be=null;function ie(P){be&&be(P)}function Wt(){Tt.stop()}function Ie(){Tt.start()}let Tt=new rM;Tt.setAnimationLoop(ie),typeof self<"u"&&Tt.setContext(self),this.setAnimationLoop=function(P){be=P,lt.setAnimationLoop(P),P===null?Tt.stop():Tt.start()},lt.addEventListener("sessionstart",Wt),lt.addEventListener("sessionend",Ie),this.render=function(P,G){if(G!==void 0&&G.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(T===!0)return;if(P.matrixWorldAutoUpdate===!0&&P.updateMatrixWorld(),G.parent===null&&G.matrixWorldAutoUpdate===!0&&G.updateMatrixWorld(),lt.enabled===!0&<.isPresenting===!0&&(lt.cameraAutoUpdate===!0&<.updateCamera(G),G=lt.getCamera()),P.isScene===!0&&P.onBeforeRender(b,P,G,I),v=Ct.get(P,E.length),v.init(G),E.push(v),Et.multiplyMatrices(G.projectionMatrix,G.matrixWorldInverse),fe.setFromProjectionMatrix(Et),_t=this.localClippingEnabled,ot=Qt.init(this.clippingPlanes,_t),y=yt.get(P,x.length),y.init(),x.push(y),lt.enabled===!0&<.isPresenting===!0){let vt=b.xr.getDepthSensingMesh();vt!==null&&ue(vt,G,-1/0,b.sortObjects)}ue(P,G,0,b.sortObjects),y.finish(),b.sortObjects===!0&&y.sort(K,gt),ae=lt.enabled===!1||lt.isPresenting===!1||lt.hasDepthSensing()===!1,ae&&It.addToRenderList(y,P),this.info.render.frame++,ot===!0&&Qt.beginShadows();let Q=v.state.shadowsArray;Mt.render(Q,P,G),ot===!0&&Qt.endShadows(),this.info.autoReset===!0&&this.info.reset();let J=y.opaque,W=y.transmissive;if(v.setupLights(),G.isArrayCamera){let vt=G.cameras;if(W.length>0)for(let At=0,Ot=vt.length;At0&&he(J,W,P,G),ae&&It.render(P),te(y,P,G);I!==null&&(Gt.updateMultisampleRenderTarget(I),Gt.updateRenderTargetMipmap(I)),P.isScene===!0&&P.onAfterRender(b,P,G),de.resetDefaultState(),N=-1,A=null,E.pop(),E.length>0?(v=E[E.length-1],ot===!0&&Qt.setGlobalState(b.clippingPlanes,v.state.camera)):v=null,x.pop(),x.length>0?y=x[x.length-1]:y=null};function ue(P,G,Q,J){if(P.visible===!1)return;if(P.layers.test(G.layers)){if(P.isGroup)Q=P.renderOrder;else if(P.isLOD)P.autoUpdate===!0&&P.update(G);else if(P.isLight)v.pushLight(P),P.castShadow&&v.pushShadow(P);else if(P.isSprite){if(!P.frustumCulled||fe.intersectsSprite(P)){J&&kt.setFromMatrixPosition(P.matrixWorld).applyMatrix4(Et);let At=mt.update(P),Ot=P.material;Ot.visible&&y.push(P,At,Ot,Q,kt.z,null)}}else if((P.isMesh||P.isLine||P.isPoints)&&(!P.frustumCulled||fe.intersectsObject(P))){let At=mt.update(P),Ot=P.material;if(J&&(P.boundingSphere!==void 0?(P.boundingSphere===null&&P.computeBoundingSphere(),kt.copy(P.boundingSphere.center)):(At.boundingSphere===null&&At.computeBoundingSphere(),kt.copy(At.boundingSphere.center)),kt.applyMatrix4(P.matrixWorld).applyMatrix4(Et)),Array.isArray(Ot)){let Rt=At.groups;for(let Nt=0,Zt=Rt.length;Nt0&&nn(W,G,Q),vt.length>0&&nn(vt,G,Q),At.length>0&&nn(At,G,Q),Ut.buffers.depth.setTest(!0),Ut.buffers.depth.setMask(!0),Ut.buffers.color.setMask(!0),Ut.setPolygonOffset(!1)}function he(P,G,Q,J){if((Q.isScene===!0?Q.overrideMaterial:null)!==null)return;v.state.transmissionRenderTarget[J.id]===void 0&&(v.state.transmissionRenderTarget[J.id]=new vs(1,1,{generateMipmaps:!0,type:re.has("EXT_color_buffer_half_float")||re.has("EXT_color_buffer_float")?Mc:_s,minFilter:qo,samples:4,stencilBuffer:o,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:qe.workingColorSpace}));let vt=v.state.transmissionRenderTarget[J.id],At=J.viewport||w;vt.setSize(At.z,At.w);let Ot=b.getRenderTarget();b.setRenderTarget(vt),b.getClearColor(Z),j=b.getClearAlpha(),j<1&&b.setClearColor(16777215,.5),b.clear(),ae&&It.render(Q);let Rt=b.toneMapping;b.toneMapping=js;let Nt=J.viewport;if(J.viewport!==void 0&&(J.viewport=void 0),v.setupLightsView(J),ot===!0&&Qt.setGlobalState(b.clippingPlanes,J),nn(P,Q,J),Gt.updateMultisampleRenderTarget(vt),Gt.updateRenderTargetMipmap(vt),re.has("WEBGL_multisampled_render_to_texture")===!1){let Zt=!1;for(let qt=0,Le=G.length;qt0),qt=!!Q.morphAttributes.position,Le=!!Q.morphAttributes.normal,We=!!Q.morphAttributes.color,Ue=js;J.toneMapped&&(I===null||I.isXRRenderTarget===!0)&&(Ue=b.toneMapping);let yn=Q.morphAttributes.position||Q.morphAttributes.normal||Q.morphAttributes.color,Ce=yn!==void 0?yn.length:0,Xt=Vt.get(J),bn=v.state.lights;if(ot===!0&&(_t===!0||P!==A)){let oi=P===A&&J.id===N;Qt.setState(J,P,oi)}let Be=!1;J.version===Xt.__version?(Xt.needsLights&&Xt.lightsStateVersion!==bn.state.version||Xt.outputColorSpace!==Ot||W.isBatchedMesh&&Xt.batching===!1||!W.isBatchedMesh&&Xt.batching===!0||W.isBatchedMesh&&Xt.batchingColor===!0&&W.colorTexture===null||W.isBatchedMesh&&Xt.batchingColor===!1&&W.colorTexture!==null||W.isInstancedMesh&&Xt.instancing===!1||!W.isInstancedMesh&&Xt.instancing===!0||W.isSkinnedMesh&&Xt.skinning===!1||!W.isSkinnedMesh&&Xt.skinning===!0||W.isInstancedMesh&&Xt.instancingColor===!0&&W.instanceColor===null||W.isInstancedMesh&&Xt.instancingColor===!1&&W.instanceColor!==null||W.isInstancedMesh&&Xt.instancingMorph===!0&&W.morphTexture===null||W.isInstancedMesh&&Xt.instancingMorph===!1&&W.morphTexture!==null||Xt.envMap!==Rt||J.fog===!0&&Xt.fog!==vt||Xt.numClippingPlanes!==void 0&&(Xt.numClippingPlanes!==Qt.numPlanes||Xt.numIntersection!==Qt.numIntersection)||Xt.vertexAlphas!==Nt||Xt.vertexTangents!==Zt||Xt.morphTargets!==qt||Xt.morphNormals!==Le||Xt.morphColors!==We||Xt.toneMapping!==Ue||Xt.morphTargetsCount!==Ce)&&(Be=!0):(Be=!0,Xt.__version=J.version);let si=Xt.currentProgram;Be===!0&&(si=Je(J,G,W));let Ms=!1,Yn=!1,Ss=!1,un=si.getUniforms(),Cr=Xt.uniforms;if(Ut.useProgram(si.program)&&(Ms=!0,Yn=!0,Ss=!0),J.id!==N&&(N=J.id,Yn=!0),Ms||A!==P){un.setValue(k,"projectionMatrix",P.projectionMatrix),un.setValue(k,"viewMatrix",P.matrixWorldInverse);let oi=un.map.cameraPosition;oi!==void 0&&oi.setValue(k,wt.setFromMatrixPosition(P.matrixWorld)),se.logarithmicDepthBuffer&&un.setValue(k,"logDepthBufFC",2/(Math.log(P.far+1)/Math.LN2)),(J.isMeshPhongMaterial||J.isMeshToonMaterial||J.isMeshLambertMaterial||J.isMeshBasicMaterial||J.isMeshStandardMaterial||J.isShaderMaterial)&&un.setValue(k,"isOrthographic",P.isOrthographicCamera===!0),A!==P&&(A=P,Yn=!0,Ss=!0)}if(W.isSkinnedMesh){un.setOptional(k,W,"bindMatrix"),un.setOptional(k,W,"bindMatrixInverse");let oi=W.skeleton;oi&&(oi.boneTexture===null&&oi.computeBoneTexture(),un.setValue(k,"boneTexture",oi.boneTexture,Gt))}W.isBatchedMesh&&(un.setOptional(k,W,"batchingTexture"),un.setValue(k,"batchingTexture",W._matricesTexture,Gt),un.setOptional(k,W,"batchingIdTexture"),un.setValue(k,"batchingIdTexture",W._indirectTexture,Gt),un.setOptional(k,W,"batchingColorTexture"),W._colorsTexture!==null&&un.setValue(k,"batchingColorTexture",W._colorsTexture,Gt));let Qo=Q.morphAttributes;if((Qo.position!==void 0||Qo.normal!==void 0||Qo.color!==void 0)&&Kt.update(W,Q,si),(Yn||Xt.receiveShadow!==W.receiveShadow)&&(Xt.receiveShadow=W.receiveShadow,un.setValue(k,"receiveShadow",W.receiveShadow)),J.isMeshGouraudMaterial&&J.envMap!==null&&(Cr.envMap.value=Rt,Cr.flipEnvMap.value=Rt.isCubeTexture&&Rt.isRenderTargetTexture===!1?-1:1),J.isMeshStandardMaterial&&J.envMap===null&&G.environment!==null&&(Cr.envMapIntensity.value=G.environmentIntensity),Yn&&(un.setValue(k,"toneMappingExposure",b.toneMappingExposure),Xt.needsLights&&He(Cr,Ss),vt&&J.fog===!0&&zt.refreshFogUniforms(Cr,vt),zt.refreshMaterialUniforms(Cr,J,nt,$,v.state.transmissionRenderTarget[P.id]),el.upload(k,xn(Xt),Cr,Gt)),J.isShaderMaterial&&J.uniformsNeedUpdate===!0&&(el.upload(k,xn(Xt),Cr,Gt),J.uniformsNeedUpdate=!1),J.isSpriteMaterial&&un.setValue(k,"center",W.center),un.setValue(k,"modelViewMatrix",W.modelViewMatrix),un.setValue(k,"normalMatrix",W.normalMatrix),un.setValue(k,"modelMatrix",W.matrixWorld),J.isShaderMaterial||J.isRawShaderMaterial){let oi=J.uniformsGroups;for(let ro=0,tf=oi.length;ro0&&Gt.useMultisampledRTT(P)===!1?W=Vt.get(P).__webglMultisampledFramebuffer:Array.isArray(Zt)?W=Zt[Q]:W=Zt,w.copy(P.viewport),B.copy(P.scissor),V=P.scissorTest}else w.copy(z).multiplyScalar(nt).floor(),B.copy(bt).multiplyScalar(nt).floor(),V=jt;if(Ut.bindFramebuffer(k.FRAMEBUFFER,W)&&J&&Ut.drawBuffers(P,W),Ut.viewport(w),Ut.scissor(B),Ut.setScissorTest(V),vt){let Rt=Vt.get(P.texture);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_CUBE_MAP_POSITIVE_X+G,Rt.__webglTexture,Q)}else if(At){let Rt=Vt.get(P.texture),Nt=G||0;k.framebufferTextureLayer(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,Rt.__webglTexture,Q||0,Nt)}N=-1},this.readRenderTargetPixels=function(P,G,Q,J,W,vt,At){if(!(P&&P.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ot=Vt.get(P).__webglFramebuffer;if(P.isWebGLCubeRenderTarget&&At!==void 0&&(Ot=Ot[At]),Ot){Ut.bindFramebuffer(k.FRAMEBUFFER,Ot);try{let Rt=P.texture,Nt=Rt.format,Zt=Rt.type;if(!se.textureFormatReadable(Nt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!se.textureTypeReadable(Zt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}G>=0&&G<=P.width-J&&Q>=0&&Q<=P.height-W&&k.readPixels(G,Q,J,W,ne.convert(Nt),ne.convert(Zt),vt)}finally{let Rt=I!==null?Vt.get(I).__webglFramebuffer:null;Ut.bindFramebuffer(k.FRAMEBUFFER,Rt)}}},this.readRenderTargetPixelsAsync=async function(P,G,Q,J,W,vt,At){if(!(P&&P.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Ot=Vt.get(P).__webglFramebuffer;if(P.isWebGLCubeRenderTarget&&At!==void 0&&(Ot=Ot[At]),Ot){Ut.bindFramebuffer(k.FRAMEBUFFER,Ot);try{let Rt=P.texture,Nt=Rt.format,Zt=Rt.type;if(!se.textureFormatReadable(Nt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!se.textureTypeReadable(Zt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(G>=0&&G<=P.width-J&&Q>=0&&Q<=P.height-W){let qt=k.createBuffer();k.bindBuffer(k.PIXEL_PACK_BUFFER,qt),k.bufferData(k.PIXEL_PACK_BUFFER,vt.byteLength,k.STREAM_READ),k.readPixels(G,Q,J,W,ne.convert(Nt),ne.convert(Zt),0),k.flush();let Le=k.fenceSync(k.SYNC_GPU_COMMANDS_COMPLETE,0);await gP(k,Le,4);try{k.bindBuffer(k.PIXEL_PACK_BUFFER,qt),k.getBufferSubData(k.PIXEL_PACK_BUFFER,0,vt)}finally{k.deleteBuffer(qt),k.deleteSync(Le)}return vt}}finally{let Rt=I!==null?Vt.get(I).__webglFramebuffer:null;Ut.bindFramebuffer(k.FRAMEBUFFER,Rt)}}},this.copyFramebufferToTexture=function(P,G=null,Q=0){P.isTexture!==!0&&(_c("WebGLRenderer: copyFramebufferToTexture function signature has changed."),G=arguments[0]||null,P=arguments[1]);let J=Math.pow(2,-Q),W=Math.floor(P.image.width*J),vt=Math.floor(P.image.height*J),At=G!==null?G.x:0,Ot=G!==null?G.y:0;Gt.setTexture2D(P,0),k.copyTexSubImage2D(k.TEXTURE_2D,Q,0,0,At,Ot,W,vt),Ut.unbindTexture()},this.copyTextureToTexture=function(P,G,Q=null,J=null,W=0){P.isTexture!==!0&&(_c("WebGLRenderer: copyTextureToTexture function signature has changed."),J=arguments[0]||null,P=arguments[1],G=arguments[2],W=arguments[3]||0,Q=null);let vt,At,Ot,Rt,Nt,Zt;Q!==null?(vt=Q.max.x-Q.min.x,At=Q.max.y-Q.min.y,Ot=Q.min.x,Rt=Q.min.y):(vt=P.image.width,At=P.image.height,Ot=0,Rt=0),J!==null?(Nt=J.x,Zt=J.y):(Nt=0,Zt=0);let qt=ne.convert(G.format),Le=ne.convert(G.type);Gt.setTexture2D(G,0),k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,G.flipY),k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,G.premultiplyAlpha),k.pixelStorei(k.UNPACK_ALIGNMENT,G.unpackAlignment);let We=k.getParameter(k.UNPACK_ROW_LENGTH),Ue=k.getParameter(k.UNPACK_IMAGE_HEIGHT),yn=k.getParameter(k.UNPACK_SKIP_PIXELS),Ce=k.getParameter(k.UNPACK_SKIP_ROWS),Xt=k.getParameter(k.UNPACK_SKIP_IMAGES),bn=P.isCompressedTexture?P.mipmaps[W]:P.image;k.pixelStorei(k.UNPACK_ROW_LENGTH,bn.width),k.pixelStorei(k.UNPACK_IMAGE_HEIGHT,bn.height),k.pixelStorei(k.UNPACK_SKIP_PIXELS,Ot),k.pixelStorei(k.UNPACK_SKIP_ROWS,Rt),P.isDataTexture?k.texSubImage2D(k.TEXTURE_2D,W,Nt,Zt,vt,At,qt,Le,bn.data):P.isCompressedTexture?k.compressedTexSubImage2D(k.TEXTURE_2D,W,Nt,Zt,bn.width,bn.height,qt,bn.data):k.texSubImage2D(k.TEXTURE_2D,W,Nt,Zt,vt,At,qt,Le,bn),k.pixelStorei(k.UNPACK_ROW_LENGTH,We),k.pixelStorei(k.UNPACK_IMAGE_HEIGHT,Ue),k.pixelStorei(k.UNPACK_SKIP_PIXELS,yn),k.pixelStorei(k.UNPACK_SKIP_ROWS,Ce),k.pixelStorei(k.UNPACK_SKIP_IMAGES,Xt),W===0&&G.generateMipmaps&&k.generateMipmap(k.TEXTURE_2D),Ut.unbindTexture()},this.copyTextureToTexture3D=function(P,G,Q=null,J=null,W=0){P.isTexture!==!0&&(_c("WebGLRenderer: copyTextureToTexture3D function signature has changed."),Q=arguments[0]||null,J=arguments[1]||null,P=arguments[2],G=arguments[3],W=arguments[4]||0);let vt,At,Ot,Rt,Nt,Zt,qt,Le,We,Ue=P.isCompressedTexture?P.mipmaps[W]:P.image;Q!==null?(vt=Q.max.x-Q.min.x,At=Q.max.y-Q.min.y,Ot=Q.max.z-Q.min.z,Rt=Q.min.x,Nt=Q.min.y,Zt=Q.min.z):(vt=Ue.width,At=Ue.height,Ot=Ue.depth,Rt=0,Nt=0,Zt=0),J!==null?(qt=J.x,Le=J.y,We=J.z):(qt=0,Le=0,We=0);let yn=ne.convert(G.format),Ce=ne.convert(G.type),Xt;if(G.isData3DTexture)Gt.setTexture3D(G,0),Xt=k.TEXTURE_3D;else if(G.isDataArrayTexture||G.isCompressedArrayTexture)Gt.setTexture2DArray(G,0),Xt=k.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}k.pixelStorei(k.UNPACK_FLIP_Y_WEBGL,G.flipY),k.pixelStorei(k.UNPACK_PREMULTIPLY_ALPHA_WEBGL,G.premultiplyAlpha),k.pixelStorei(k.UNPACK_ALIGNMENT,G.unpackAlignment);let bn=k.getParameter(k.UNPACK_ROW_LENGTH),Be=k.getParameter(k.UNPACK_IMAGE_HEIGHT),si=k.getParameter(k.UNPACK_SKIP_PIXELS),Ms=k.getParameter(k.UNPACK_SKIP_ROWS),Yn=k.getParameter(k.UNPACK_SKIP_IMAGES);k.pixelStorei(k.UNPACK_ROW_LENGTH,Ue.width),k.pixelStorei(k.UNPACK_IMAGE_HEIGHT,Ue.height),k.pixelStorei(k.UNPACK_SKIP_PIXELS,Rt),k.pixelStorei(k.UNPACK_SKIP_ROWS,Nt),k.pixelStorei(k.UNPACK_SKIP_IMAGES,Zt),P.isDataTexture||P.isData3DTexture?k.texSubImage3D(Xt,W,qt,Le,We,vt,At,Ot,yn,Ce,Ue.data):G.isCompressedArrayTexture?k.compressedTexSubImage3D(Xt,W,qt,Le,We,vt,At,Ot,yn,Ue.data):k.texSubImage3D(Xt,W,qt,Le,We,vt,At,Ot,yn,Ce,Ue),k.pixelStorei(k.UNPACK_ROW_LENGTH,bn),k.pixelStorei(k.UNPACK_IMAGE_HEIGHT,Be),k.pixelStorei(k.UNPACK_SKIP_PIXELS,si),k.pixelStorei(k.UNPACK_SKIP_ROWS,Ms),k.pixelStorei(k.UNPACK_SKIP_IMAGES,Yn),W===0&&G.generateMipmaps&&k.generateMipmap(Xt),Ut.unbindTexture()},this.initRenderTarget=function(P){Vt.get(P).__webglFramebuffer===void 0&&Gt.setupRenderTarget(P)},this.initTexture=function(P){P.isCubeTexture?Gt.setTextureCube(P,0):P.isData3DTexture?Gt.setTexture3D(P,0):P.isDataArrayTexture||P.isCompressedArrayTexture?Gt.setTexture2DArray(P,0):Gt.setTexture2D(P,0),Ut.unbindTexture()},this.resetState=function(){U=0,L=0,I=null,Ut.reset(),de.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return gs}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=t===yg?"display-p3":"srgb",e.unpackColorSpace=qe.workingColorSpace===Qh?"display-p3":"srgb"}};var ul=class extends dr{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new xs,this.environmentIntensity=1,this.environmentRotation=new xs,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){let e=super.toJSON(t);return this.fog!==null&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}};var tg=class extends $o{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new ke(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}},zy=new Ln,eg=new Bh,Mh=new ol,Sh=new tt,hl=class extends dr{constructor(t=new ys,e=new tg){super(),this.isPoints=!0,this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}raycast(t,e){let n=this.geometry,i=this.matrixWorld,o=t.params.Points.threshold,l=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Mh.copy(n.boundingSphere),Mh.applyMatrix4(i),Mh.radius+=o,t.ray.intersectsSphere(Mh)===!1)return;zy.copy(i).invert(),eg.copy(t.ray).applyMatrix4(zy);let c=o/((this.scale.x+this.scale.y+this.scale.z)/3),u=c*c,f=n.index,g=n.attributes.position;if(f!==null){let p=Math.max(0,l.start),m=Math.min(f.count,l.start+l.count);for(let M=p,y=m;M0){let i=e[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=i.length;oi.far)return;o.push({distance:f,distanceToRay:Math.sqrt(c),point:u,index:t,face:null,object:l})}}var ng=class r extends ys{constructor(t=[],e=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i};let o=[],l=[];c(i),f(n),d(),this.setAttribute("position",new Di(o,3)),this.setAttribute("normal",new Di(o.slice(),3)),this.setAttribute("uv",new Di(l,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function c(E){let b=new tt,T=new tt,U=new tt;for(let L=0;L.9&&I<.1&&(b<.2&&(l[E+0]+=1),T<.2&&(l[E+2]+=1),U<.2&&(l[E+4]+=1))}}function p(E){o.push(E.x,E.y,E.z)}function m(E,b){let T=E*3;b.x=t[T+0],b.y=t[T+1],b.z=t[T+2]}function M(){let E=new tt,b=new tt,T=new tt,U=new tt,L=new Pe,I=new Pe,N=new Pe;for(let A=0,w=0;A=o)){let c=e[1];t=o)break e}l=n,n=0;break n}break t}for(;n>>1;te;)--l;if(++l,o!==0||l!==i){o>=l&&(l=Math.max(l,1),o=l-1);let c=this.getValueSize();this.times=n.slice(o,l),this.values=this.values.slice(o*c,l*c)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);let n=this.times,i=this.values,o=n.length;o===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let l=null;for(let c=0;c!==o;c++){let u=n[c];if(typeof u=="number"&&isNaN(u)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,c,u),t=!1;break}if(l!==null&&l>u){console.error("THREE.KeyframeTrack: Out of order keys.",this,c,u,l),t=!1;break}l=u}if(i!==void 0&&u3(i))for(let c=0,u=i.length;c!==u;++c){let f=i[c];if(isNaN(f)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,c,f),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Pp,o=t.length-1,l=1;for(let c=1;c0){t[l]=t[o];for(let c=o*n,u=l*n,f=0;f!==n;++f)e[u+f]=e[c+f];++l}return l!==t.length?(this.times=t.slice(0,l),this.values=e.slice(0,l*n)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),n=this.constructor,i=new n(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}};Ar.prototype.TimeBufferType=Float32Array;Ar.prototype.ValueBufferType=Float32Array;Ar.prototype.DefaultInterpolation=Nm;var Jo=class extends Ar{constructor(t,e,n){super(t,e,n)}};Jo.prototype.ValueTypeName="bool";Jo.prototype.ValueBufferType=Array;Jo.prototype.DefaultInterpolation=Ih;Jo.prototype.InterpolantFactoryMethodLinear=void 0;Jo.prototype.InterpolantFactoryMethodSmooth=void 0;var og=class extends Ar{};og.prototype.ValueTypeName="color";var ag=class extends Ar{};ag.prototype.ValueTypeName="number";var lg=class extends fl{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){let o=this.resultBuffer,l=this.sampleValues,c=this.valueSize,u=(n-e)/(i-e),f=t*c;for(let d=f+c;f!==d;f+=4)no.slerpFlat(o,0,l,f-c,l,f,u);return o}},Jh=class extends Ar{InterpolantFactoryMethodLinear(t){return new lg(this.times,this.values,this.getValueSize(),t)}};Jh.prototype.ValueTypeName="quaternion";Jh.prototype.InterpolantFactoryMethodSmooth=void 0;var Ko=class extends Ar{constructor(t,e,n){super(t,e,n)}};Ko.prototype.ValueTypeName="string";Ko.prototype.ValueBufferType=Array;Ko.prototype.DefaultInterpolation=Ih;Ko.prototype.InterpolantFactoryMethodLinear=void 0;Ko.prototype.InterpolantFactoryMethodSmooth=void 0;var cg=class extends Ar{};cg.prototype.ValueTypeName="vector";var ug=class{constructor(t,e,n){let i=this,o=!1,l=0,c=0,u,f=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(d){c++,o===!1&&i.onStart!==void 0&&i.onStart(d,l,c),o=!0},this.itemEnd=function(d){l++,i.onProgress!==void 0&&i.onProgress(d,l,c),l===c&&(o=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(d){i.onError!==void 0&&i.onError(d)},this.resolveURL=function(d){return u?u(d):d},this.setURLModifier=function(d){return u=d,this},this.addHandler=function(d,g){return f.push(d,g),this},this.removeHandler=function(d){let g=f.indexOf(d);return g!==-1&&f.splice(g,2),this},this.getHandler=function(d){for(let g=0,p=f.length;g"u"?Date:performance).now()}var Sg="\\[\\]\\.:\\/",f3=new RegExp("["+Sg+"]","g"),wg="[^"+Sg+"]",d3="[^"+Sg.replace("\\.","")+"]",p3=/((?:WC+[\/:])*)/.source.replace("WC",wg),m3=/(WCOD+)?/.source.replace("WCOD",d3),g3=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",wg),_3=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",wg),v3=new RegExp("^"+p3+m3+g3+_3+"$"),x3=["material","materials","bones","map"],fg=class{constructor(t,e,n){let i=n||cn.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}getValue(t,e){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(t,e)}setValue(t,e){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,o=n.length;i!==o;++i)n[i].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},cn=class r{constructor(t,e,n){this.path=e,this.parsedPath=n||r.parseTrackName(e),this.node=r.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new r.Composite(t,e,n):new r(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(f3,"")}static parseTrackName(t){let e=v3.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){let o=n.nodeName.substring(i+1);x3.indexOf(o)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=o)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let n=t.skeleton.getBoneByName(e);if(n!==void 0)return n}if(t.children){let n=function(o){for(let l=0;l0.475)discard;gl_FragColor=vec4(uColor,uAlpha); #include }`;var hM="uniform float uTime;uniform float uSize;uniform float uElevation;uniform vec2 uFrequency;uniform float uSpeed;void main(){vec4 modelPosition=modelMatrix*vec4(position,1.0);float elevation=sin(modelPosition.x*uFrequency.x+uTime*uSpeed)*sin(modelPosition.z*uFrequency.y+uTime*uSpeed)*uElevation;modelPosition.y+=elevation;vec4 viewPosition=viewMatrix*modelPosition;vec4 projectedPosition=projectionMatrix*viewPosition;gl_Position=projectedPosition;gl_PointSize=uSize;}";var{INITIAL_HEIGHT:q3,INITIAL_WIDTH:Y3}=Ia,bg=class{constructor(t){this.canvasEl=t.canvasEl,this.wrapperEl=t.wrapperEl,this.animationFrameId=0,this.clock=new dl;let e=this.wrapperEl.clientWidth,n=this.wrapperEl.clientHeight;this.camera=new qn(75,e/n,.1,100),this.camera.position.set(0,0,5),this.renderer=new cl({canvas:this.canvasEl,antialias:!0,stencil:!0}),this.renderer.setClearColor(t.backgroundColor),this.renderer.setSize(e,n),this.renderer.setPixelRatio(Br);let i=new ll(t.geometry.width,t.geometry.height,t.geometry.widthSegments,t.geometry.heightSegments),o=new Ui({fragmentShader:uM,vertexShader:hM,uniforms:{uTime:new Zi(0),uSize:new Zi(t.size),uElevation:new Zi(t.elevation),uFrequency:new Zi(new Pe(t.frequency.x,t.frequency.y)),uSpeed:new Zi(t.speed),uColor:new Zi(new tt(t.color.r,t.color.g,t.color.b)),uAlpha:new Zi(t.alpha)}});if(this.terrain=new hl(i,o),this.terrain.frustumCulled=!1,t.terrain){if(t.terrain.position){let{x:l,y:c,z:u}=t.terrain.position;this.terrain.position.set(l,c,u)}if(t.terrain.rotation){let{x:l,y:c,z:u}=t.terrain.rotation;this.terrain.rotation.set(l,c,u)}}if(t.camera){if(t.camera.position){let{x:l,y:c,z:u}=t.camera.position;this.camera.position.set(l,c,u)}if(t.camera.rotation){let{x:l,y:c,z:u}=t.camera.rotation;this.camera.rotation.set(l,c,u)}}this.scene=new ul,this.scene.add(this.camera),this.scene.add(this.terrain),window.addEventListener("resize",this.handleResize.bind(this))}draw(){let t=()=>{let e=this.clock.getElapsedTime();this.terrain.material.uniforms.uTime.value=e,this.renderer.render(this.scene,this.camera),this.animationFrameId=window.requestAnimationFrame(t)};t()}handleResize(){let t=this.wrapperEl.clientWidth,e=this.wrapperEl.clientHeight;this.camera.aspect=t/e,this.camera.updateProjectionMatrix(),this.renderer.setSize(t,e),this.renderer.setPixelRatio(Br)}dispose(){this.terrain.geometry.dispose(),this.terrain.material.dispose(),this.animationFrameId&&window.cancelAnimationFrame(this.animationFrameId)}},Tg=bg;var mM=MA(fM(),1);var dM=`uniform float uTime;varying vec3 vColor;varying float vRandom;void main(){float sineWave=sin((uTime*0.2)+vRandom*10.0);float visibility=smoothstep(0.4,0.5,sineWave);vec2 uv=gl_PointCoord;float distanceToCenter=length(uv-0.5);float alpha=(0.05/distanceToCenter-0.1)*visibility;gl_FragColor=vec4(vColor,alpha); #include #include }`;var pM="uniform vec2 uResolution;uniform float uSize;uniform float uTime;uniform float uSpeed;attribute float aSize;attribute vec3 aColor;varying float vRandom;varying vec3 vColor;vec3 mod289(vec3 x){return x-floor(x*(1.0/289.0))*289.0;}vec4 mod289(vec4 x){return x-floor(x*(1.0/289.0))*289.0;}vec4 permute(vec4 x){return mod289(((x*34.0)+10.0)*x);}vec4 taylorInvSqrt(vec4 r){return 1.79284291400159-0.85373472095314*r;}vec3 fade(vec3 t){return t*t*t*(t*(t*6.0-15.0)+10.0);}float cnoise(vec3 P){vec3 Pi0=floor(P);vec3 Pi1=Pi0+vec3(1.0);Pi0=mod289(Pi0);Pi1=mod289(Pi1);vec3 Pf0=fract(P);vec3 Pf1=Pf0-vec3(1.0);vec4 ix=vec4(Pi0.x,Pi1.x,Pi0.x,Pi1.x);vec4 iy=vec4(Pi0.yy,Pi1.yy);vec4 iz0=Pi0.zzzz;vec4 iz1=Pi1.zzzz;vec4 ixy=permute(permute(ix)+iy);vec4 ixy0=permute(ixy+iz0);vec4 ixy1=permute(ixy+iz1);vec4 gx0=ixy0*(1.0/7.0);vec4 gy0=fract(floor(gx0)*(1.0/7.0))-0.5;gx0=fract(gx0);vec4 gz0=vec4(0.5)-abs(gx0)-abs(gy0);vec4 sz0=step(gz0,vec4(0.0));gx0-=sz0*(step(0.0,gx0)-0.5);gy0-=sz0*(step(0.0,gy0)-0.5);vec4 gx1=ixy1*(1.0/7.0);vec4 gy1=fract(floor(gx1)*(1.0/7.0))-0.5;gx1=fract(gx1);vec4 gz1=vec4(0.5)-abs(gx1)-abs(gy1);vec4 sz1=step(gz1,vec4(0.0));gx1-=sz1*(step(0.0,gx1)-0.5);gy1-=sz1*(step(0.0,gy1)-0.5);vec3 g000=vec3(gx0.x,gy0.x,gz0.x);vec3 g100=vec3(gx0.y,gy0.y,gz0.y);vec3 g010=vec3(gx0.z,gy0.z,gz0.z);vec3 g110=vec3(gx0.w,gy0.w,gz0.w);vec3 g001=vec3(gx1.x,gy1.x,gz1.x);vec3 g101=vec3(gx1.y,gy1.y,gz1.y);vec3 g011=vec3(gx1.z,gy1.z,gz1.z);vec3 g111=vec3(gx1.w,gy1.w,gz1.w);vec4 norm0=taylorInvSqrt(vec4(dot(g000,g000),dot(g010,g010),dot(g100,g100),dot(g110,g110)));g000*=norm0.x;g010*=norm0.y;g100*=norm0.z;g110*=norm0.w;vec4 norm1=taylorInvSqrt(vec4(dot(g001,g001),dot(g011,g011),dot(g101,g101),dot(g111,g111)));g001*=norm1.x;g011*=norm1.y;g101*=norm1.z;g111*=norm1.w;float n000=dot(g000,Pf0);float n100=dot(g100,vec3(Pf1.x,Pf0.yz));float n010=dot(g010,vec3(Pf0.x,Pf1.y,Pf0.z));float n110=dot(g110,vec3(Pf1.xy,Pf0.z));float n001=dot(g001,vec3(Pf0.xy,Pf1.z));float n101=dot(g101,vec3(Pf1.x,Pf0.y,Pf1.z));float n011=dot(g011,vec3(Pf0.x,Pf1.yz));float n111=dot(g111,Pf1);vec3 fade_xyz=fade(Pf0);vec4 n_z=mix(vec4(n000,n100,n010,n110),vec4(n001,n101,n011,n111),fade_xyz.z);vec2 n_yz=mix(n_z.xy,n_z.zw,fade_xyz.y);float n_xyz=mix(n_yz.x,n_yz.y,fade_xyz.x);return 2.2*n_xyz;}float pnoise(vec3 P,vec3 rep){vec3 Pi0=mod(floor(P),rep);vec3 Pi1=mod(Pi0+vec3(1.0),rep);Pi0=mod289(Pi0);Pi1=mod289(Pi1);vec3 Pf0=fract(P);vec3 Pf1=Pf0-vec3(1.0);vec4 ix=vec4(Pi0.x,Pi1.x,Pi0.x,Pi1.x);vec4 iy=vec4(Pi0.yy,Pi1.yy);vec4 iz0=Pi0.zzzz;vec4 iz1=Pi1.zzzz;vec4 ixy=permute(permute(ix)+iy);vec4 ixy0=permute(ixy+iz0);vec4 ixy1=permute(ixy+iz1);vec4 gx0=ixy0*(1.0/7.0);vec4 gy0=fract(floor(gx0)*(1.0/7.0))-0.5;gx0=fract(gx0);vec4 gz0=vec4(0.5)-abs(gx0)-abs(gy0);vec4 sz0=step(gz0,vec4(0.0));gx0-=sz0*(step(0.0,gx0)-0.5);gy0-=sz0*(step(0.0,gy0)-0.5);vec4 gx1=ixy1*(1.0/7.0);vec4 gy1=fract(floor(gx1)*(1.0/7.0))-0.5;gx1=fract(gx1);vec4 gz1=vec4(0.5)-abs(gx1)-abs(gy1);vec4 sz1=step(gz1,vec4(0.0));gx1-=sz1*(step(0.0,gx1)-0.5);gy1-=sz1*(step(0.0,gy1)-0.5);vec3 g000=vec3(gx0.x,gy0.x,gz0.x);vec3 g100=vec3(gx0.y,gy0.y,gz0.y);vec3 g010=vec3(gx0.z,gy0.z,gz0.z);vec3 g110=vec3(gx0.w,gy0.w,gz0.w);vec3 g001=vec3(gx1.x,gy1.x,gz1.x);vec3 g101=vec3(gx1.y,gy1.y,gz1.y);vec3 g011=vec3(gx1.z,gy1.z,gz1.z);vec3 g111=vec3(gx1.w,gy1.w,gz1.w);vec4 norm0=taylorInvSqrt(vec4(dot(g000,g000),dot(g010,g010),dot(g100,g100),dot(g110,g110)));g000*=norm0.x;g010*=norm0.y;g100*=norm0.z;g110*=norm0.w;vec4 norm1=taylorInvSqrt(vec4(dot(g001,g001),dot(g011,g011),dot(g101,g101),dot(g111,g111)));g001*=norm1.x;g011*=norm1.y;g101*=norm1.z;g111*=norm1.w;float n000=dot(g000,Pf0);float n100=dot(g100,vec3(Pf1.x,Pf0.yz));float n010=dot(g010,vec3(Pf0.x,Pf1.y,Pf0.z));float n110=dot(g110,vec3(Pf1.xy,Pf0.z));float n001=dot(g001,vec3(Pf0.xy,Pf1.z));float n101=dot(g101,vec3(Pf1.x,Pf0.y,Pf1.z));float n011=dot(g011,vec3(Pf0.x,Pf1.yz));float n111=dot(g111,Pf1);vec3 fade_xyz=fade(Pf0);vec4 n_z=mix(vec4(n000,n100,n010,n110),vec4(n001,n101,n011,n111),fade_xyz.z);vec2 n_yz=mix(n_z.xy,n_z.zw,fade_xyz.y);float n_xyz=mix(n_yz.x,n_yz.y,fade_xyz.x);return 2.2*n_xyz;}void main(){vColor=aColor;vRandom=fract(sin(dot(position.xyz,vec3(12.9898,78.233,45.164)))*43758.5453)*2.0-1.0;vec4 modelPosition=modelMatrix*vec4(position,1.0);vec4 viewPosition=viewMatrix*modelPosition;float noise=pnoise(position+uTime*uSpeed,vec3(10.0));float displacement=noise/10.0;vec3 newPosition=position+normal*displacement;vec4 projectedPosition=projectionMatrix*modelViewMatrix*vec4(newPosition,1.0);gl_Position=projectedPosition;gl_PointSize=aSize*uSize*uResolution.y;gl_PointSize*=(1.0/-viewPosition.z);}";var{BACKGROUND_COLOR:b3}=Ia,Eg=class{constructor(t){this.canvasEl=t.canvasEl,this.wrapperEl=t.wrapperEl,this.scene=new ul,this.clock=new dl,this.animationFrameId=0,this.colorsList=t.colors;let e=this.wrapperEl.clientWidth,n=this.wrapperEl.clientHeight;if(this.camera=new qn(35,e/n,.1,100),this.renderer=new cl({canvas:this.canvasEl,antialias:!0}),this.renderer.setSize(e,n),this.renderer.setPixelRatio(Br),this.renderer.setClearColor(b3),t.camera){if(t.camera.position){let{x:c,y:u,z:f}=t.camera.position;this.camera.position.set(c,u,f)}if(t.camera.rotation){let{x:c,y:u,z:f}=t.camera.rotation;this.camera.rotation.set(c,u,f)}}let i=new $h(t.geometry.radius,t.geometry.detail);i.setIndex(null);let o=new Ui({vertexShader:pM,fragmentShader:dM,uniforms:{uTime:{value:0},uSize:new Zi(t.size),uResolution:new Zi(new Pe(e*Br,n*Br)),uSpeed:{value:t.speed}},blending:Rh,depthWrite:!1}),l=new hl(i,o);this.particles={geometry:i,material:o,points:l},this.maxPointsCount=this.particles.geometry.attributes.position.count,this.scene.add(this.camera),this.scene.add(this.particles.points),this.setPointsColors(this.colorsList),this.randomizePointsSizes(),window.addEventListener("resize",this.handleResize.bind(this))}randomizePointsSizes(){let t=new Float32Array(this.maxPointsCount);for(let e=0;e{let e=this.clock.getElapsedTime();this.particles.material.uniforms.uTime.value=e,this.renderer.render(this.scene,this.camera),this.animationFrameId=window.requestAnimationFrame(t)};t()}dispose(){this.particles.geometry.dispose(),this.particles.material.dispose(),this.animationFrameId&&window.cancelAnimationFrame(this.animationFrameId)}},gM=Eg;var{PARTICLES:lU,POINTS_COLORS:cU}=Ia;window.Webflow||(window.Webflow=[]);window.Webflow.push(()=>{Xl.registerPlugin(Ae);let r=new Qu(kx);r.on("scroll",Ae.update),Xl.ticker.add(t=>{r.raf(t*1e3)}),Xl.ticker.lagSmoothing(0)});window.Webflow.push(()=>{});window.Webflow.push(()=>{let r=document.querySelector("#dots-terrain-1-wrapper"),t=document.querySelector("#dots-terrain-1-canvas");new Tg({canvasEl:t,wrapperEl:r,backgroundColor:"#000",geometry:{width:24,height:24,widthSegments:200,heightSegments:200},terrain:{position:{x:0,y:1.72,z:.38},rotation:{x:-.7,y:0,z:1.85}},camera:{position:{x:-.42,y:-2.13,z:5.58},rotation:{x:.07,y:-.07,z:0}},tweakPanelTitle:"dots terrain 1",size:7.826,elevation:.413,frequency:{x:1,y:1.5},speed:.326,color:{r:.15,g:.15,b:.15},alpha:1}).draw()});window.Webflow.push(()=>{let r=document.querySelector("#sphere-2-wrapper"),t=document.querySelector("#sphere-2-canvas");new gM({canvasEl:t,wrapperEl:r,size:.2,camera:{position:{x:0,y:0,z:25}},colors:["#50f2fb"],geometry:{radius:4,detail:48},speed:.5}).draw()});window.Webflow.push(()=>{let r=document.querySelector("#dots-terrain-2-wrapper"),t=document.querySelector("#dots-terrain-2-canvas");new Tg({canvasEl:t,wrapperEl:r,backgroundColor:"#ffffff",geometry:{width:24,height:24,widthSegments:100,heightSegments:100},terrain:{position:{x:2,y:2.24,z:-3.26},rotation:{x:-.98,y:0,z:.19}},camera:{position:{x:.12,y:10,z:-3.25},rotation:{x:.29,y:.11,z:.06}},tweakPanelTitle:"dots terrain 2",size:4.5,elevation:.761,frequency:{x:1,y:1.281},speed:1.413/5,color:{r:0,g:0,b:0},alpha:.2}).draw()});})(); /*! Bundled license information: lodash/lodash.js: (** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors *) gsap/gsap-core.js: (*! * GSAP 3.12.5 * https://gsap.com * * @license Copyright 2008-2024, GreenSock. All rights reserved. * Subject to the terms at https://gsap.com/standard-license or for * Club GSAP members, the agreement issued with that membership. * @author: Jack Doyle, jack@greensock.com *) gsap/CSSPlugin.js: (*! * CSSPlugin 3.12.5 * https://gsap.com * * Copyright 2008-2024, GreenSock. All rights reserved. * Subject to the terms at https://gsap.com/standard-license or for * Club GSAP members, the agreement issued with that membership. * @author: Jack Doyle, jack@greensock.com *) gsap/Observer.js: (*! * Observer 3.12.5 * https://gsap.com * * @license Copyright 2008-2024, GreenSock. All rights reserved. * Subject to the terms at https://gsap.com/standard-license or for * Club GSAP members, the agreement issued with that membership. * @author: Jack Doyle, jack@greensock.com *) gsap/ScrollTrigger.js: (*! * ScrollTrigger 3.12.5 * https://gsap.com * * @license Copyright 2008-2024, GreenSock. All rights reserved. * Subject to the terms at https://gsap.com/standard-license or for * Club GSAP members, the agreement issued with that membership. * @author: Jack Doyle, jack@greensock.com *) three/build/three.module.js: (** * @license * Copyright 2010-2024 Three.js Authors * SPDX-License-Identifier: MIT *) */