PageSourceSearch

https://census-labs.com/_next/static/chunks/0y9rhao_syik7.js

js census-labs.com collected 2026-10-02 08:01:09 UTC 675,561 bytes, 398 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,34593,35648,e=>{"use strict";var t=e.i(32919),n=e.i(84677);t.default.registerPlugin(n.SplitText),e.s(["disposeSplitText",0,function(e){if(e){if("dispose"in e&&"function"==typeof e.dispose)return void e.dispose();t.default.killTweensOf([e.elements,e.chars,e.words,e.lines]),e.revert()}},"splitText",0,function(e,r={}){if(!e)return null;let i=r.type??"chars",a=r.animate??i,o=new n.SplitText(e,{type:function(e){switch(e){case"chars":default:return"words,chars";case"words":return"words";case"lines":return"lines,words"}}(i),wordsClass:r.wordsClass??"split-w",charsClass:r.charsClass??"split-c",linesClass:r.linesClass??"split-l",aria:"none",...r.vars}),s=o.chars,l=o.words,u=o.lines,c=function(e,t){switch(t){case"chars":default:return e.chars;case"words":return e.words;case"lines":return e.lines}}(o,a),d=!1;return{instance:o,element:e,chars:s,words:l,lines:u,targets:c,dispose:()=>{d||(d=!0,t.default.killTweensOf([e,s,l,u,c]),o.revert())}}}],35648);let r=globalThis;r.__nextGsapInitialized||(t.default.defaults({duration:1.2,ease:"expo.out"}),t.default.registerPlugin(n.SplitText),r.__nextGsapInitialized=!0);let i=t.default;e.s(["A",0,{page:{in:{duration:1.2,ease:"expo.out"},out:{duration:.6,ease:"expo.out"}},graphPhaseFocus:{durationSec:.55,ease:"power2.inOut"}},"default",0,i],34593)},36702,41640,e=>{"use strict";class t{subscribers=[];add(e,t=0){let n={callback:e,priority:t},r=this.subscribers.findIndex(e=>e.priority>t);return -1===r?this.subscribers.push(n):this.subscribers.splice(r,0,n),()=>{let e=this.subscribers.indexOf(n);-1!==e&&this.subscribers.splice(e,1)}}notify(e){for(let t of this.subscribers)t.callback(e)}clear(){this.subscribers=[]}}e.s(["Subscribable",0,t],41640);let n=globalThis,r=n.__nextScrollState??new class extends t{lenis;glPixelRatio;setLenis(e){this.lenis=e}setGlPixelRatio(e){this.glPixelRatio=e}get gl(){let e=this.lenis?.scroll??0;return this.glPixelRatio?e*this.glPixelRatio:e}get scrollEventData(){let e=this.lenis?.direction;return{velocity:this.lenis?.velocity??0,scroll:this.lenis?.scroll??0,direction:-1===e?-1:1,progress:this.lenis?.progress??0,glScroll:this.gl}}notifyScroll(){this.notify(this.scrollEventData)}resize(){this.lenis?.resize()}to(e,t){this.lenis?.scrollTo(e,t)}};n.__nextScrollState=r,e.s(["Scroll",0,r],36702)},84677,(e,t,n)=>{e.e,function(e){"use strict";let t,n,r="function"==typeof Symbol?Symbol():"_split",i,a="u">typeof Intl&&"Segmenter"in Intl?new Intl.Segmenter:0,o=e=>e?"string"==typeof e?o(document.querySelectorAll(e)):"length"in e?Array.from(e).reduce((e,t)=>("string"==typeof t?e.push(...o(t)):e.push(t),e),[]):[e]:[],s=e=>o(e).filter(e=>e&&1===e.nodeType),l=[],u=function(){},c={add:e=>e()},d=/\s+/g,h=RegExp("\\p{RI}\\p{RI}|\\p{Emoji}(\\p{EMod}|\\u{FE0F}\\u{20E3}?|[\\u{E0020}-\\u{E007E}]+\\u{E007F})?(\\u{200D}\\p{Emoji}(\\p{EMod}|\\u{FE0F}\\u{20E3}?|[\\u{E0020}-\\u{E007E}]+\\u{E007F})?)*|.","gu"),f={left:0,top:0,width:0,height:0},p=(e,t)=>{for(;++t<e.length&&e[t]===f;);return e[t]||f},m=({element:e,html:t,ariaL:n,ariaH:r})=>{e.innerHTML=t,n?e.setAttribute("aria-label",n):e.removeAttribute("aria-label"),r?e.setAttribute("aria-hidden",r):e.removeAttribute("aria-hidden")},v=(e,t)=>
1{if(t){let n=new Set(e.join("").match(t)||l),r=e.length,i,a,o,s;if(n.size){for(;--r>-1;)for(o of(a=e[r],n))if(o.startsWith(a)&&o.length>a.length){for(i=0,s=a;o.startsWith(s+=e[r+ ++i])&&s.length<o.length;);if(i&&s.length===o.length){e[r]=o,e.splice(r+1,i);break}}}}return e},g=e=>"inline"===window.getComputedStyle(e).display&&(e.style.display="inline-block"),_=(e,t,n)=>t.insertBefore("string"==typeof e?document.createTextNode(e):e,n),S=(e,t,n)=>{let r=t[e+"sClass"]||"",{tag:i="div",aria:a="auto",propIndex:o=!1}=t,s="line"===e?"block":"inline-block",l=r.indexOf("++")>-1,u=t=>{let u=document.createElement(i),c=n.length+1;return r&&(u.className=r+(l?" "+r+c:"")),o&&u.style.setProperty("--"+e,c+""),"none"!==a&&u.setAttribute("aria-hidden","true"),"span"!==i&&(u.style.position="relative",u.style.display=s),u.textContent=t,n.push(u),u};return l&&(r=r.replace("++","")),u.collection=n,u},x=(e,t,n,r,i,o,s,u,c,h)=>{var f;let p=Array.from(e.childNodes),m=0,{wordDelimiter:S,reduceWhiteSpace:T=!0,prepareText:M}=t,b=e.getBoundingClientRect(),E=b,R=!T&&"pre"===window.getComputedStyle(e).whiteSpace.substring(0,3),w=0,C=n.collection,y,A,L,D,P,N,U,I,F,O,B,G,H,k,V,z,W,X;for("object"==typeof S?(L=S.delimiter||S,A=S.replaceWith||""):A=""===S?"":S||" ",y=" "!==A;m<p.length;m++)if(3===(D=p[m]).nodeType){for(V=D.textContent||"",T?V=V.replace(d," "):R&&(V=V.replace(/\n/g,A+"\n")),M&&(V=M(V,e)),D.textContent=V,W=(P=A||L?V.split(L||A):V.match(u)||l)[P.length-1],I=y?" "===W.slice(-1):!W,W||P.pop(),E=b,(U=y?" "===P[0].charAt(0):!P[0])&&_(" ",e,D),P[0]||P.shift(),v(P,c),o&&h||(D.textContent=""),F=1;F<=P.length;F++)if(z=P[F-1],!T&&R&&"\n"===z.charAt(0)&&(null==(f=D.previousSibling)||f.remove(),_(document.createElement("br"),e,D),z=z.slice(1)),T||""!==z)if(" "===z)e.insertBefore(document.createTextNode(" "),D);else{if(y&&" "===z.charAt(0)&&_(" ",e,D),w&&1===F&&!U&&C.indexOf(w.parentNode)>-1?(N=C[C.length-1]).appendChild(document.createTextNode(r?"":z)):(_(N=n(r?"":z),e,D),w&&1===F&&!U&&N.insertBefore(w,N.firstChild)),r)for(B=a?v([...a.segment(z)].map(e=>e.segment),c):z.match(u)||l,X=0;X<B.length;X++)N.appendChild(" "===B[X]?document.createTextNode(" "):r(B[X]));if(o&&h){if(V=D.textContent=V.substring(z.length+1,V.length),(O=N.getBoundingClientRect()).top>E.top&&O.left<=E.left){for(G=e.cloneNode(),H=e.childNodes[0];H&&H!==N;)k=H,H=H.nextSibling,G.appendChild(k);e.parentNode.insertBefore(G,e),i&&g(G)}E=O}(F<P.length||I)&&_(F>=P.length?" ":y&&" "===z.slice(-1)?" "+A:A,e,D)}else _(A,e,D);e.removeChild(D),w=0}else 1===D.nodeType&&(s&&s.indexOf(D)>-1?(C.indexOf(D.previousSibling)>-1&&C[C.length-1].appendChild(D),w=D):(x(D,t,n,r,i,o,s,u,c,!0),w=0),i&&g(D))},T=class e{constructor(e,t){this.isSplit=!1,i||M.register(window.gsap),this.elements=s(e),this.chars=[],this.words=[],this.lines=[],this.masks=[],this.vars=t,this.elements.forEach(e=>{var n;!1!==t.overwrite&&(null==(n=e[r])||n._data.orig.filter(({element:t})=>t===e).forEach(m)),e[r]=this}),this._split=()=>this.isSplit&&this.split(this.vars);let n=[],a,o=()=>{let e=n.length,t;for(;e--;){let r=(t=n[e]).element.offsetWidth;if(r!==t.width){t.width=r,this._split();return}}};this._data={orig:n,obs:"u">typeof ResizeObserver&&new ResizeObserver(()=>{clearTimeout(a),a=setTimeout(o,200)})},u(this),this.split(t)}split(e){return(this._ctx||c).add(()=>{this.isSplit&&this.revert(),this.vars=e=e||this.vars||{};let{type:t="chars,words,lines",aria:r="auto",deepSlice:i=!0,smartWrap:a,onSplit:l,autoSplit:u=!1,specialChars:c,mask:d}=this.vars,m=t.indexOf("lines")>-1,v=t.indexOf("chars")>-1,g=t.indexOf("words")>-1,_=v&&!g&&!m,T=c&&("push"in c?RegExp("(?:"+c.join("|")+")","gu"):c),M=T?RegExp(T.source+"|"+h.source,"gu"):h,b=!!e.ignore&&s(e.ignore),{orig:E,animTime:R,obs:w}=this._data,C;(v||g||m)&&(this.elements.forEach((t,n)=>{E[n]={element:t,html:t.innerHTML,ariaL:t.getAttribute("aria-label"),ariaH:t.getAttribute("aria-hidden")},"auto"===r?t.setAttribute("aria-label",(t.textContent||"").trim()):"hidden"===r&&t.setAttribute("aria-hidden","true");let s=[],l=[],u=[],c=v?S("char",e,s):null,d=S("word",e,l),h,R,w,C;if(x(t,e,d,c,_,i&&(m||_),b,M,T,!1),m){let n,r,i=o(t.childNodes),a=(n=S("line",e,u),r=window.getComputedStyle(t).textAlign||"left",(e,a)=>{let o=n("");for(o.style.textAlign=r,t.insertBefore(o,i[e]);e<a;e++)o.appendChild(i[e]);o.normalize()}),s,l=[],c=0,d=i.map(e=>1===e.nodeType?e.getBoundingClientRect():f),m=f,v;for(h=0;h<i.length;h++)1===(s=i[h]).nodeType&&("BR"===s.nodeName?(h&&"BR"===i[h-1].nodeName||(l.push(s),a(c,h+1)),c=h+1,m=p(d,h)):(v=d[h
1],h&&v.top>m.top&&v.left<m.left+m.width-1&&(a(c,h),c=h),m=v));c<h&&a(c,h),l.forEach(e=>{var t;return null==(t=e.parentNode)?void 0:t.removeChild(e)})}if(!g){for(h=0;h<l.length;h++)if(R=l[h],v||!R.nextSibling||3!==R.nextSibling.nodeType)if(a&&!m){for((w=document.createElement("span")).style.whiteSpace="nowrap";R.firstChild;)w.appendChild(R.firstChild);R.replaceWith(w)}else R.replaceWith(...R.childNodes);else(C=R.nextSibling)&&3===C.nodeType&&(C.textContent=(R.textContent||"")+(C.textContent||""),R.remove());l.length=0,t.normalize()}this.lines.push(...u),this.words.push(...l),this.chars.push(...s)}),d&&this[d]&&this.masks.push(...this[d].map(e=>{let t=e.cloneNode();return e.replaceWith(t),t.appendChild(e),e.className&&(t.className=e.className.trim().split(" ").map(e=>e+"-mask").join(" ")),t.style.overflow="clip",t}))),this.isSplit=!0,n&&m&&u&&n.addEventListener("loadingdone",this._split),(C=l&&l(this))&&C.totalTime&&(this._data.anim=R?C.totalTime(R):C),m&&u&&this.elements.forEach((e,t)=>{E[t].width=e.offsetWidth,w&&w.observe(e)})}),this}kill(){let{obs:e}=this._data;e&&e.disconnect(),null==n||n.removeEventListener("loadingdone",this._split)}revert(){var e,t;if(this.isSplit){let{orig:n,anim:r}=this._data;this.kill(),n.forEach(m),this.chars.length=this.words.length=this.lines.length=n.length=this.masks.length=0,this.isSplit=!1,r&&(this._data.animTime=r.totalTime(),r.revert()),null==(t=(e=this.vars).onRevert)||t.call(e,this)}return this}static create(t,n){return new e(t,n)}static register(e){(t=t||e||window.gsap)&&(o=t.utils.toArray,u=t.core.context||u),!i&&window.innerWidth>0&&(n=document.fonts,i=!0)}};T.version="3.15.0";let M=T;e.SplitText=M,e.default=M,Object.defineProperty(e,"__esModule",{value:!0})}(n)},32919,e=>{"use strict";function t(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function n(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var r,i,a,o,s,l,u,c,d,h,f,p,m,v,g,_,S,x,T,M,b,E,R,w,C,y,A,L,D={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},P={duration:.5,overwrite:!1,delay:0},N=2*Math.PI,U=N/4,I=0,F=Math.sqrt,O=Math.cos,B=Math.sin,G=function(e){return"string"==typeof e},H=function(e){return"function"==typeof e},k=function(e){return"number"==typeof e},V=function(e){return void 0===e},z=function(e){return"object"==typeof e},W=function(e){return!1!==e},X=function(){return"u">typeof window},K=function(e){return H(e)||G(e)},j="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},q=Array.isArray,Y=/random\([^)]+\)/g,Z=/,\s*/g,$=/(?:-?\.?\d|\.)+/gi,Q=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,J=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,ee=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,et=/[+-]=-?[.\d]+/,en=/[^,'"\[\]\s]+/gi,er=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,ei={},ea={},eo=function(e){return(ea=eF(e,ei))&&nC},es=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},el=function(e,t){return!t&&console.warn(e)},eu=function(e,t){return e&&(ei[e]=t)&&ea&&(ea[e]=t)||ei},ec=function(){return 0},ed={suppressEvents:!0,isStart:!0,kill:!1},eh={suppressEvents:!0,kill:!1},ef={suppressEvents:!0},ep={},em=[],ev={},eg={},e_={},eS=30,ex=[],eT="",eM=function(e){var t,n,r=e[0];if(z(r)||H(r)||(e=[e]),!(t=(r._gsap||{}).harness)){for(n=ex.length;n--&&!ex[n].targetTest(r););t=ex[n]}for(n=e.length;n--;)e[n]&&(e[n]._gsap||(e[n]._gsap=new tz(e[n],t)))||e.splice(n,1);return e},eb=function(e){return e._gsap||eM(to(e))[0]._gsap},eE=function(e,t,n){return(n=e[t])&&H(n)?e[t]():V(n)&&e.getAttribute&&e.getAttribute(t)||n},eR=function(e,t){return(e=e.split(",")).forEach(t)||e},ew=function(e){return Math.round(1e5*e)/1e5||0},eC=function(e){return Math.round(1e7*e)/1e7||0},ey=function(e,t){var n=t.charAt(0),r=parseFloat(t.substr(2));return e=parseFloat(e),"+"===n?e+r:"-"===n?e-r:"*"===n?e*r:e/r},eA=function(e,t){for(var n=t.length,r=0;0>e.indexOf(t[r])&&++r<n;);return r<n},eL=function(){var e,t,n=em.length,r=em.slice(0);for(ev={},em.length=0,e=0;e<n;e++)(t=r[e])&&t._lazy&&(t.render(t._lazy[0],t._lazy[1],!0)._lazy=0)},eD=function(e){return!!(e._initted||e._startAt||e.add)},eP=function(e,t,n,r){em.length&&!T&&eL(),e.render(t,n,r||!!(T&&t<0&&eD(e))),em.length&&!T&&eL()},eN=function(e){var t=parseFloat(e);return(t||0===t)&&(e+"").match(en).length<2?t:G(e)?e.trim():e},eU=function(e){return e}
vendor: 3,326 bytes, line 1
1,eI=function(e,t){for(var n in t)n in e||(e[n]=t[n]);return e},eF=function(e,t){for(var n in t)e[n]=t[n];return e},eO=function e(t,n){for(var r in n)"__proto__"!==r&&"constructor"!==r&&"prototype"!==r&&(t[r]=z(n[r])?e(t[r]||(t[r]={}),n[r]):n[r]);return t},eB=function(e,t){var n,r={};for(n in e)n in t||(r[n]=e[n]);return r},eG=function(e){var t,n=e.parent||b,r=e.keyframes?(t=q(e.keyframes),function(e,n){for(var r in n)r in e||"duration"===r&&t||"ease"===r||(e[r]=n[r])}):eI;if(W(e.inherit))for(;n;)r(e,n.vars.defaults),n=n.parent||n._dp;return e},eH=function(e,t){for(var n=e.length,r=n===t.length;r&&n--&&e[n]===t[n];);return n<0},ek=function(e,t,n,r,i){void 0===n&&(n="_first"),void 0===r&&(r="_last");var a,o=e[r];if(i)for(a=t[i];o&&o[i]>a;)o=o._prev;return o?(t._next=o._next,o._next=t):(t._next=e[n],e[n]=t),t._next?t._next._prev=t:e[r]=t,t._prev=o,t.parent=t._dp=e,t},eV=function(e,t,n,r){void 0===n&&(n="_first"),void 0===r&&(r="_last");var i=t._prev,a=t._next;i?i._next=a:e[n]===t&&(e[n]=a),a?a._prev=i:e[r]===t&&(e[r]=i),t._next=t._prev=t.parent=null},ez=function(e,t){e.parent&&(!t||e.parent.autoRemoveChildren)&&e.parent.remove&&e.parent.remove(e),e._act=0},eW=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var n=e;n;)n._dirty=1,n=n.parent;return e},eX=function(e){for(var t=e.parent;t&&t.parent;)t._dirty=1,t.totalDuration(),t=t.parent;return e},eK=function(e,t,n,r){return e._startAt&&(T?e._startAt.revert(eh):e.vars.immediateRender&&!e.vars.autoRevert||e._startAt.render(t,!0,r))},ej=function(e){return e._repeat?eq(e._tTime,e=e.duration()+e._rDelay)*e:0},eq=function(e,t){var n=Math.floor(e=eC(e/t));return e&&n===e?n-1:n},eY=function(e,t){return(e-t._start)*t._ts+(t._ts>=0?0:t._dirty?t.totalDuration():t._tDur)},eZ=function(e){return e._end=eC(e._start+(e._tDur/Math.abs(e._ts||e._rts||1e-8)||0))},e$=function(e,t){var n=e._dp;return n&&n.smoothChildTiming&&e._ts&&(e._start=eC(n._time-(e._ts>0?t/e._ts:-(((e._dirty?e.totalDuration():e._tDur)-t)/e._ts))),eZ(e),n._dirty||eW(n,e)),e},eQ=function(e,t){var n;if((t._time||!t._dur&&t._initted||t._start<e._time&&(t._dur||!t.add))&&(n=eY(e.rawTime(),t),(!t._dur||tn(0,t.totalDuration(),n)-t._tTime>1e-8)&&t.render(n,!0)),eW(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur<e.duration())for(n=e;n._dp;)n.rawTime()>=0&&n.totalTime(n._tTime),n=n._dp;e._zTime=-1e-8}},eJ=function(e,t,n,r){return t.parent&&ez(t),t._start=eC((k(n)?n:n||e!==b?e7(e,n,t):e._time)+t._delay),t._end=eC(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),ek(e,t,"_first","_last",e._sort?"_start":0),e2(t)||(e._recent=t),r||eQ(e,t),e._ts<0&&e$(e,e._tTime),e},e0=function(e,t){return(ei.ScrollTrigger||es("scrollTrigger",t))&&ei.ScrollTrigger.create(t,e)},e1=function(e,t,n,r,i){return(t3(e,t,i),e._initted)?!n&&e._pt&&!T&&(e._dur&&!1!==e.vars.lazy||!e._dur&&e.vars.lazy)&&y!==tA.frame?(em.push(e),e._lazy=[i,r],1):void 0:1},e3=function e(t){var n=t.parent;return n&&n._ts&&n._initted&&!n._lock&&(0>n.rawTime()||e(n))},e2=function(e){var t=e.data;return"isFromStart"===t||"isStart"===t},e5=function(e,t,n,r){var i,a,o,s=e.ratio,l=t<0||!t&&(!e._start&&e3(e)&&!(!e._initted&&e2(e))||(e._ts<0||e._dp._ts<0)&&!e2(e))?0:1,u=e._rDelay,c=0;if(u&&e._repeat&&(a=eq(c=tn(0,e._tDur,t),u),e._yoyo&&1&a&&(l=1-l),a!==eq(e._tTime,u)&&(s=1-l,e.vars.repeatRefresh&&e._initted&&e.invali
vendor: 4,239 bytes, line 1
1date())),l!==s||T||r||1e-8===e._zTime||!t&&e._zTime){if(!e._initted&&e1(e,t,r,n,c))return;for(o=e._zTime,e._zTime=t||1e-8*!!n,n||(n=t&&!o),e.ratio=l,e._from&&(l=1-l),e._time=0,e._tTime=c,i=e._pt;i;)i.r(l,i.d),i=i._next;t<0&&eK(e,t,n,!0),e._onUpdate&&!n&&tg(e,"onUpdate"),c&&e._repeat&&!n&&e.parent&&tg(e,"onRepeat"),(t>=e._tDur||t<0)&&e.ratio===l&&(l&&ez(e,1),n||T||(tg(e,l?"onComplete":"onReverseComplete",!0),e._prom&&e._prom()))}else e._zTime||(e._zTime=t)},e4=function(e,t,n){var r;if(n>t)for(r=e._first;r&&r._start<=n;){if("isPause"===r.data&&r._start>t)return r;r=r._next}else for(r=e._last;r&&r._start>=n;){if("isPause"===r.data&&r._start<t)return r;r=r._prev}},e8=function(e,t,n,r){var i=e._repeat,a=eC(t)||0,o=e._tTime/e._tDur;return o&&!r&&(e._time*=a/e._dur),e._dur=a,e._tDur=i?i<0?1e10:eC(a*(i+1)+e._rDelay*i):a,o>0&&!r&&e$(e,e._tTime=e._tDur*o),e.parent&&eZ(e),n||eW(e.parent,e),e},e6=function(e){return e instanceof tX?eW(e):e8(e,e._dur)},e9={_start:0,endTime:ec,totalDuration:ec},e7=function e(t,n,r){var i,a,o,s=t.labels,l=t._recent||e9,u=t.duration()>=1e8?l.endTime(!1):t._dur;return G(n)&&(isNaN(n)||n in s)?(a=n.charAt(0),o="%"===n.substr(-1),i=n.indexOf("="),"<"===a||">"===a)?(i>=0&&(n=n.replace(/=/,"")),("<"===a?l._start:l.endTime(l._repeat>=0))+(parseFloat(n.substr(1))||0)*(o?(i<0?l:r).totalDuration()/100:1)):i<0?(n in s||(s[n]=u),s[n]):(a=parseFloat(n.charAt(i-1)+n.substr(i+1)),o&&r&&(a=a/100*(q(r)?r[0]:r).totalDuration()),i>1?e(t,n.substr(0,i-1),r)+a:u+a):null==n?u:+n},te=function(e,t,n){var r,i,a=k(t[1]),o=(a?2:1)+(e<2?0:1),s=t[o];if(a&&(s.duration=t[1]),s.parent=n,e){for(r=s,i=n;i&&!("immediateRender"in r);)r=i.vars.defaults||{},i=W(i.vars.inherit)&&i.parent;s.immediateRender=W(r.immediateRender),e<2?s.runBackwards=1:s.startAt=t[o-1]}return new t7(t[0],s,t[o+1])},tt=function(e,t){return e||0===e?t(e):t},tn=function(e,t,n){return n<e?e:n>t?t:n},tr=function(e,t){return G(e)&&(t=er.exec(e))?t[1]:""},ti=[].slice,ta=function(e,t){return e&&z(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&z(e[0]))&&!e.nodeType&&e!==E},to=function(e,t,n){var r;return M&&!t&&M.selector?M.selector(e):G(e)&&!n&&(R||!tL())?ti.call((t||w).querySelectorAll(e),0):q(e)?(void 0===r&&(r=[]),e.forEach(function(e){var t;return G(e)&&!n||ta(e,1)?(t=r).push.apply(t,to(e)):r.push(e)})||r):ta(e)?ti.call(e,0):e?[e]:[]},ts=function(e){return e=to(e)[0]||el("Invalid scope")||{},function(t){var n=e.current||e.nativeElement||e;return to(t,n.querySelectorAll?n:n===e?el("Invalid scope")||w.createElement("div"):e)}},tl=function(e){return e.sort(function(){return .5-Math.random()})},tu=function(e){if(H(e))return e;var t=z(e)?e:{each:e},n=tB(t.ease),r=t.from||0,i=parseFloat(t.base)||0,a={},o=r>0&&r<1,s=isNaN(r)||o,l=t.axis,u=r,c=r;return G(r)?u=c=({center:.5,edges:.5,end:1})[r]||0:!o&&s&&(u=r[0],c=r[1]),function(e,o,d){var h,f,p,m,v,g,_,S,x,T=(d||t).length,M=a[T];if(!M){if(!(x="auto"===t.grid?0:(t.grid||[1,1e8])[1])){for(_=-1e8;_<(_=d[x++].getBoundingClientRect().left)&&x<T;);x<T&&x--}for(M=a[T]=[],h=s?Math.min(x,T)*u-.5:r%x,f=1e8===x?0:s?T*c/x-.5:r/x|0,_=0,S=1e8,g=0;g<T;g++)p=g%x-h,m=f-(g/x|0),M[g]=v=l?Math.abs("y"===l?m:p):F(p*p+m*m),v>_&&(_=v),v<S&&(S=v);"random"===r&&tl(M),M.max=_-S,M.min=S,M.v=T=(parseFloat(t.amount)||parseFloat(t.each)*(x>T?T-1:l?"y"===l?T/x:x:Math.max(x,T/x))||0)*("edges"===r?-1:1),M.b=T<0?i-T:i,M.u=tr(t.amount||t.each)||0,n=n&&T<0?tO(n):n}return T=(M[e]-M.min)/M.max||0,eC(M.b+(n?n(T):T)*M.v)+M.u}},tc=function(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(n){var r=eC(Math.round(parseFloat(n)/e)*e*t);return(r-r%1)/t+(k(n)?0:tr(n))}},td=function(e,t){var n,r,i=q(e);return!i&&z(e)&&(n=i=e.radius||1e8,e.values?(r=!k((e=to(e.values))[0]))&&(n*=n):e=tc(e.increment)),tt(t,i?H(e)?function(t){return Math.abs((r=e(t))-t)<=n?r:t}:function(t){for(var i,a,o=parseFloat(r?t.x:t),s=parseFloat(r?t.y:0),l=1e8,u=0,c=e.length;c--;)(i=r?(i=e[c].x-o)*i+(a=e[c].y-s)*a:Math.abs(e[c]-o))<l&&(l=i,u=c);return u=!n||l<=n?e[u]:t,r||u===t||k(t)?u:u+tr(t)}:tc(e))},th=function(e,t,n,r){return tt(q(e)?!t:!0===n?(n=0,!1):!r,function(){return q(e)?e[~~(Math.random()*e.length)]:(r=(n=n||1e-5)<1?Math.pow(10,(n+"").length-2):1)&&Math.floor(Math.round((e-n/2+Math.random()*(t-e+.99*n))/n)
1*n*r)/r})},tf=function(e,t,n){return tt(n,function(n){return e[~~t(n)]})},tp=function(e){return e.replace(Y,function(e){var t=e.indexOf("[")+1,n=e.substring(t||7,t?e.indexOf("]"):e.length-1).split(Z);return th(t?n:+n[0],t?0:+n[1],+n[2]||1e-5)})},tm=function(e,t,n,r,i){var a=t-e,o=r-n;return tt(i,function(t){return n+((t-e)/a*o||0)})},tv=function(e,t,n){var r,i,a,o=e.labels,s=1e8;for(r in o)(i=o[r]-t)<0==!!n&&i&&s>(i=Math.abs(i))&&(a=r,s=i);return a},tg=function(e,t,n){var r,i,a,o=e.vars,s=o[t],l=M,u=e._ctx;if(s)return r=o[t+"Params"],i=o.callbackScope||e,n&&em.length&&eL(),u&&(M=u),a=r?s.apply(i,r):s.call(i),M=l,a},t_=function(e){return ez(e),e.scrollTrigger&&e.scrollTrigger.kill(!!T),1>e.progress()&&tg(e,"onInterrupt"),e},tS=[],tx=function(e){if(e)if(e=!e.name&&e.default||e,X()||e.headless){var t=e.name,n=H(e),r=t&&!n&&e.init?function(){this._props=[]}:e,i={init:ec,render:nl,add:tJ,kill:nc,modifier:nu,rawVars:0},a={targetTest:0,get:0,getSetter:ni,aliases:{},register:0};if(tL(),e!==r){if(eg[t])return;eI(r,eI(eB(e,i),a)),eF(r.prototype,eF(i,eB(e,a))),eg[r.prop=t]=r,e.targetTest&&(ex.push(r),ep[t]=1),t=("css"===t?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}eu(t,r),e.register&&e.register(nC,r,nf)}else tS.push(e)},tT={aqua:[0,255,255],lime:[0,255,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,255],navy:[0,0,128],white:[255,255,255],olive:[128,128,0],yellow:[255,255,0],orange:[255,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[255,0,0],pink:[255,192,203],cyan:[0,255,255],transparent:[255,255,255,0]},tM=function(e,t,n){return(6*(e+=e<0?1:e>1?-1:0)<1?t+(n-t)*e*6:e<.5?n:3*e<2?t+(n-t)*(2/3-e)*6:t)*255+.5|0},tb=function(e,t,n){var r,i,a,o,s,l,u,c,d,h,f=e?k(e)?[e>>16,e>>8&255,255&e]:0:tT.black;if(!f){if(","===e.substr(-1)&&(e=e.substr(0,e.length-1)),tT[e])f=tT[e];else if("#"===e.charAt(0)){if(e.length<6&&(r=e.charAt(1),e="#"+r+r+(i=e.charAt(2))+i+(a=e.charAt(3))+a+(5===e.length?e.charAt(4)+e.charAt(4):"")),9===e.length)return[(f=parseInt(e.substr(1,6),16))>>16,f>>8&255,255&f,parseInt(e.substr(7),16)/255];f=[(e=parseInt(e.substr(1),16))>>16,e>>8&255,255&e]}else if("hsl"===e.substr(0,3))if(f=h=e.match($),t){if(~e.indexOf("="))return f=e.match(Q),n&&f.length<4&&(f[3]=1),f}else o=f[0]%360/360,s=f[1]/100,i=(l=f[2]/100)<=.5?l*(s+1):l+s-l*s,r=2*l-i,f.length>3&&(f[3]*=1),f[0]=tM(o+1/3,r,i),f[1]=tM(o,r,i),f[2]=tM(o-1/3,r,i);else f=e.match($)||tT.transparent;f=f.map(Number)}return t&&!h&&(r=f[0]/255,l=((u=Math.max(r,i=f[1]/255,a=f[2]/255))+(c=Math.min(r,i,a)))/2,u===c?o=s=0:(d=u-c,s=l>.5?d/(2-u-c):d/(u+c),o=(u===r?(i-a)/d+6*(i<a):u===i?(a-r)/d+2:(r-i)/d+4)*60),f[0]=~~(o+.5),f[1]=~~(100*s+.5),f[2]=~~(100*l+.5)),n&&f.length<4&&(f[3]=1),f},tE=function(e){var t=[],n=[],r=-1;return e.split(tw).forEach(function(e){var i=e.match(J)||[];t.push.apply(t,i),n.push(r+=i.length+1)}),t.c=n,t},tR=function(e,t,n){var r,i,a,o,s="",l=(e+s).match(tw),u=t?"hsla(":"rgba(",c=0;if(!l)return e;if(l=l.map(function(e){return(e=tb(e,t,1))&&u+(t?e[0]+","+e[1]+"%,"+e[2]+"%,"+e[3]:e.join(","))+")"}),n&&(a=tE(e),(r=n.c).join(s)!==a.c.join(s)))for(o=(i=e.replace(tw,"1").split(J)).length-1;c<o;c++)s+=i[c]+(~r.indexOf(c)?l.shift()||u+"0,0,0,0)":(a.length?a:l.length?l:n).shift());if(!i)for(o=(i=e.split(tw)).length-1;c<o;c++)s+=i[c]+l[c];return s+i[o]},tw=function(){var e,t="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b";for(e in tT)t+="|"+e+"\\b";return RegExp(t+")","gi")}(),tC=/hsl[a]?\(/,ty=function(e){var t,n=e.join(" ");if(tw.lastIndex=0,tw.test(n))return t=tC.test(n),e[1]=tR(e[1],t),e[0]=tR(e[0],t,tE(e[1])),!0},tA=(d=Date.now,h=500,f=33,m=p=d(),v=1e3/240,g=1e3/240,_=[],S=function e(t){var n,r,i,s,S=d()-m,x=!0===t;if((S>h||S<0)&&(p+=S-f),m+=S,((n=(i=m-p)-g)>0||x)&&(s=++l.frame,u=i-1e3*l.time,l.time=i/=1e3,g+=n+(n>=v?4:v-n),r=1),x||(a=o(e)),r)for(c=0;c<_.length;c++)_[c](i,u,s,t)},l={time:0,frame:0,tick:function(){S(!0)},deltaRatio:function(e){return u/(1e3/(e||60))},wake:function(){C&&(!R&&X()&&(w=(E=R=window).document||{},ei.gsap=nC,(E.gsapVersions||(E.gsapVersions=[])).push(nC.version),eo(ea||E.GreenSockGlobals||!E.gsap&&E||{}
vendor: 46,808 bytes, line 1
1),tS.forEach(tx)),s="u">typeof requestAnimationFrame&&requestAnimationFrame,a&&l.sleep(),o=s||function(e){return setTimeout(e,g-1e3*l.time+1|0)},L=1,S(2))},sleep:function(){(s?cancelAnimationFrame:clearTimeout)(a),L=0,o=ec},lagSmoothing:function(e,t){f=Math.min(t||33,h=e||1/0)},fps:function(e){v=1e3/(e||240),g=1e3*l.time+v},add:function(e,t,n){var r=t?function(t,n,i,a){e(t,n,i,a),l.remove(r)}:e;return l.remove(e),_[n?"unshift":"push"](r),tL(),r},remove:function(e,t){~(t=_.indexOf(e))&&_.splice(t,1)&&c>=t&&c--},_listeners:_}),tL=function(){return!L&&tA.wake()},tD={},tP=/^[\d.\-M][\d.\-,\s]/,tN=/["']/g,tU=function(e){for(var t,n,r,i={},a=e.substr(1,e.length-3).split(":"),o=a[0],s=1,l=a.length;s<l;s++)n=a[s],t=s!==l-1?n.lastIndexOf(","):n.length,r=n.substr(0,t),i[o]=isNaN(r)?r.replace(tN,"").trim():+r,o=n.substr(t+1).trim();return i},tI=function(e){var t=e.indexOf("(")+1,n=e.indexOf(")"),r=e.indexOf("(",t);return e.substring(t,~r&&r<n?e.indexOf(")",n+1):n)},tF=function(e){var t=(e+"").split("("),n=tD[t[0]];return n&&t.length>1&&n.config?n.config.apply(null,~e.indexOf("{")?[tU(t[1])]:tI(e).split(",").map(eN)):tD._CE&&tP.test(e)?tD._CE("",e):n},tO=function(e){return function(t){return 1-e(1-t)}},tB=function(e,t){return e&&(H(e)?e:tD[e]||tF(e))||t},tG=function(e,t,n,r){void 0===n&&(n=function(e){return 1-t(1-e)}),void 0===r&&(r=function(e){return e<.5?t(2*e)/2:1-t((1-e)*2)/2});var i,a={easeIn:t,easeOut:n,easeInOut:r};return eR(e,function(e){for(var t in tD[e]=ei[e]=a,tD[i=e.toLowerCase()]=n,a)tD[i+("easeIn"===t?".in":"easeOut"===t?".out":".inOut")]=tD[e+"."+t]=a[t]}),a},tH=function(e){return function(t){return t<.5?(1-e(1-2*t))/2:.5+e((t-.5)*2)/2}},tk=function e(t,n,r){var i=n>=1?n:1,a=(r||(t?.3:.45))/(n<1?n:1),o=a/N*(Math.asin(1/i)||0),s=function(e){return 1===e?1:i*Math.pow(2,-10*e)*B((e-o)*a)+1},l="out"===t?s:"in"===t?function(e){return 1-s(1-e)}:tH(s);return a=N/a,l.config=function(n,r){return e(t,n,r)},l},tV=function e(t,n){void 0===n&&(n=1.70158);var r=function(e){return e?--e*e*((n+1)*e+n)+1:0},i="out"===t?r:"in"===t?function(e){return 1-r(1-e)}:tH(r);return i.config=function(n){return e(t,n)},i};eR("Linear,Quad,Cubic,Quart,Quint,Strong",function(e,t){var n=t<5?t+1:t;tG(e+",Power"+(n-1),t?function(e){return Math.pow(e,n)}:function(e){return e},function(e){return 1-Math.pow(1-e,n)},function(e){return e<.5?Math.pow(2*e,n)/2:1-Math.pow((1-e)*2,n)/2})}),tD.Linear.easeNone=tD.none=tD.Linear.easeIn,tG("Elastic",tk("in"),tk("out"),tk()),tj=2*(tK=1/2.75),tq=2.5*tK,tG("Bounce",function(e){return 1-tY(1-e)},tY=function(e){return e<tK?7.5625*e*e:e<tj?7.5625*Math.pow(e-1.5/2.75,2)+.75:e<tq?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*Math.pow(e-2.625/2.75,2)+.984375}),tG("Expo",function(e){return Math.pow(2,10*(e-1))*e+e*e*e*e*e*e*(1-e)}),tG("Circ",function(e){return-(F(1-e*e)-1)}),tG("Sine",function(e){return 1===e?1:-O(e*U)+1}),tG("Back",tV("in"),tV("out"),tV()),tD.SteppedEase=tD.steps=ei.SteppedEase={config:function(e,t){void 0===e&&(e=1);var n=1/e,r=e+ +!t,i=+!!t,a=.99999999;return function(e){return((r*tn(0,a,e)|0)+i)*n}}},P.ease=tD["quad.out"],eR("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(e){return eT+=e+","+e+"Params,"});var tz=function(e,t){this.id=I++,e._gsap=this,this.target=e,this.harness=t,this.get=t?t.get:eE,this.set=t?t.getSetter:ni},tW=function(){function e(e){this.vars=e,this._delay=+e.delay||0,(this._repeat=e.repeat===1/0?-2:e.repeat||0)&&(this._rDelay=e.repeatDelay||0,this._yoyo=!!e.yoyo||!!e.yoyoEase),this._ts=1,e8(this,+e.duration,1,1),this.data=e.data,M&&(this._ctx=M,M.data.push(this)),L||tA.wake()}var t=e.prototype;return t.delay=function(e){return e||0===e?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+e-this._delay),this._delay=e,this):this._delay},t.duration=function(e){return arguments.length?this.totalDuration(this._repeat>0?e+(e+this._rDelay)*this._repeat:e):this.totalDuration()&&this._dur},t.totalDuration=function(e){return arguments.length?(this._dirty=0,e8(this,this._repeat<0?e:(e-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(e,t){if(tL(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(e$(this,e),!n._dp||n.parent||eQ(n,this);n&&n.parent;)n.parent._time!==n._start+(n._ts>=0?n._tTime/n._ts:-((n.totalDuration()-n._tTime)/n._ts))&&n.totalTime(n._tTime,!0),n=n.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&e<this._tDur||this._ts<0&&e>0||!this._tDur&&!e)&&eJ(this._dp,this,this._start-this._delay)}return(this._tTime!==e||!this._dur&&!t||this._initted&&1e-8===Math.abs(this._zTime)||!this._initted&&this._dur&&e||!e&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=e),eP(this,e,t)),this},t.time=function(e,t){return arguments.length?this.totalTime(Math.min(this.totalDuration(),e+ej(this))%(this._dur+this._rDelay)||(e?this._dur:0),t):this._time},t.totalProgress=function(e,t){return arguments.length?this.totalTime(this.totalDuration()*e,t):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>=0&&this._initted?1:0},t.progress=function(e,t){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(1&this.iteration())?1-e:e)+ej(this),t):this.duration()?Math.min(1,this._time/this._dur):+(this.rawTime()>0)},t.iteration=function(e,t){var n=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(e-1)*n,t):this._repeat?eq(this._tTime,n)+1:1},t.timeScale=function(e,t){if(!arguments.length)return -1e-8===this._rts?0:this._rts;if(this._rts===e)return this;var n=this.parent&&this._ts?eY(this.parent._time,this):this._tTime;return this._rts=+e||0,this._ts=this._ps||-1e-8===e?0:this._rts,this.totalTime(tn(-Math.abs(this._delay),this.totalDuration(),n),!1!==t),eZ(this),eX(this)},t.paused=function(e){return arguments.length?(this._ps!==e&&(this._ps=e,e?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(tL(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&1e-8!==Math.abs(this._zTime)&&(this._tTime-=1e-8)))),this):this._ps},t.startTime=function(e){if(arguments.length){this._start=eC(e);var t=this.parent||this._dp;return t&&(t._sort||!this.parent)&&eJ(t,this,this._start-this._delay),this}return this._start},t.endTime=function(e){return this._start+(W(e)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},t.rawTime=function(e){var t=this.parent||this._dp;return t?e&&(!this._ts||this._repeat&&this._time&&1>this.totalProgress())?this._tTime%(this._dur+this._rDelay):this._ts?eY(t.rawTime(e),this):this._tTime:this._tTime},t.revert=function(e){void 0===e&&(e=ef);var t=T;return T=e,eD(this)&&(this.timeline&&this.timeline.revert(e),this.totalTime(-.01,e.suppressEvents)),"nested"!==this.data&&!1!==e.kill&&this.kill(),T=t,this},t.globalTime=function(e){for(var t=this,n=arguments.length?e:t.rawTime();t;)n=t._start+n/(Math.abs(t._ts)||1),t=t._dp;return!this.parent&&this._sat?this._sat.globalTime(e):n},t.repeat=function(e){return arguments.length?(this._repeat=e===1/0?-2:e,e6(this)):-2===this._repeat?1/0:this._repeat},t.repeatDelay=function(e){if(arguments.length){var t=this._time;return this._rDelay=e,e6(this),t?this.time(t):this}return this._rDelay},t.yoyo=function(e){return arguments.length?(this._yoyo=e,this):this._yoyo},t.seek=function(e,t){return this.totalTime(e7(this,e),W(t))},t.restart=function(e,t){return this.play().totalTime(e?-this._delay:0,W(t)),this._dur||(this._zTime=-1e-8),this},t.play=function(e,t){return null!=e&&this.seek(e,t),this.reversed(!1).paused(!1)},t.reverse=function(e,t){return null!=e&&this.seek(e||this.totalDuration(),t),this.reversed(!0).paused(!1)},t.pause=function(e,t){return null!=e&&this.seek(e,t),this.paused(!0)},t.resume=function(){return this.paused(!1)},t.reversed=function(e){return arguments.length?(!!e!==this.reversed()&&this.timeScale(-this._rts||(e?-1e-8:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-1e-8,this},t.isActive=function(){var e,t=this.parent||this._dp,n=this._start;return!!(!t||this._ts&&this._initted&&t.isActive()&&(e=t.rawTime(!0))>=n&&e<this.endTime(!0)-1e-8)},t.eventCallback=function(e,t,n){var r=this.vars;return arguments.length>1?(t?(r[e]=t,n&&(r[e+"Params"]=n),"onUpdate"===e&&(this._onUpdate=t)):delete r[e],this):r[e]},t.then=function(e){var t=this,n=t._prom;return new Promise(function(r){var i=H(e)?e:eU,a=function(){var e=t.then;t.then=null,n&&n(),H(i)&&(i=i(t))&&(i.then||i===t)&&(t.then=e),r(i),t.then=e};t._initted&&1===t.totalProgress()&&t._ts>=0||!t._tTime&&t._ts<0?a():t._prom=a})},t.kill=function(){t_(this)},e}();eI(tW.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:-1e-8,_prom:0,_ps:!1,_rts:1});var tX=function(e){function r(n,r){var i;return void 0===n&&(n={}),(i=e.call(this,n)||this).labels={},i.smoothChildTiming=!!n.smoothChildTiming,i.autoRemoveChildren=!!n.autoRemoveChildren,i._sort=W(n.sortChildren),b&&eJ(n.parent||b,t(i),r),n.reversed&&i.reverse(),n.paused&&i.paused(!0),n.scrollTrigger&&e0(t(i),n.scrollTrigger),i}n(r,e);var i=r.prototype;return i.to=function(e,t,n){return te(0,arguments,this),this},i.from=function(e,t,n){return te(1,arguments,this),this},i.fromTo=function(e,t,n,r){return te(2,arguments,this),this},i.set=function(e,t,n){return t.duration=0,t.parent=this,eG(t).repeatDelay||(t.repeat=0),t.immediateRender=!!t.immediateRender,new t7(e,t,e7(this,n),1),this},i.call=function(e,t,n){return eJ(this,t7.delayedCall(0,e,t),n)},i.staggerTo=function(e,t,n,r,i,a,o){return n.duration=t,n.stagger=n.stagger||r,n.onComplete=a,n.onCompleteParams=o,n.parent=this,new t7(e,n,e7(this,i)),this},i.staggerFrom=function(e,t,n,r,i,a,o){return n.runBackwards=1,eG(n).immediateRender=W(n.immediateRender),this.staggerTo(e,t,n,r,i,a,o)},i.staggerFromTo=function(e,t,n,r,i,a,o,s){return r.startAt=n,eG(r).immediateRender=W(r.immediateRender),this.staggerTo(e,t,r,i,a,o,s)},i.render=function(e,t,n){var r,i,a,o,s,l,u,c,d,h,f,p,m=this._time,v=this._dirty?this.totalDuration():this._tDur,g=this._dur,_=e<=0?0:eC(e),S=this._zTime<0!=e<0&&(this._initted||!g);if(this!==b&&_>v&&e>=0&&(_=v),_!==this._tTime||n||S){if(m!==this._time&&g&&(_+=this._time-m,e+=this._time-m),r=_,d=this._start,l=!(c=this._ts),S&&(g||(m=this._zTime),(e||!t)&&(this._zTime=e)),this._repeat){if(f=this._yoyo,s=g+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*s+e,t,n);if(r=eC(_%s),_===v?(o=this._repeat,r=g):((o=~~(h=eC(_/s)))&&o===h&&(r=g,o--),r>g&&(r=g)),h=eq(this._tTime,s),!m&&this._tTime&&h!==o&&this._tTime-h*s-this._dur<=0&&(h=o),f&&1&o&&(r=g-r,p=1),o!==h&&!this._lock){var x=f&&1&h,M=x===(f&&1&o);if(o<h&&(x=!x),m=x?0:_%g?g:_,this._lock=1,this.render(m||(p?0:eC(o*s)),t,!g)._lock=0,this._tTime=_,!t&&this.parent&&tg(this,"onRepeat"),this.vars.repeatRefresh&&!p&&(this.invalidate()._lock=1,h=o),m&&m!==this._time||!this._ts!==l||this.vars.onRepeat&&!this.parent&&!this._act||(g=this._dur,v=this._tDur,M&&(this._lock=2,m=x?g:-1e-4,this.render(m,!0),this.vars.repeatRefresh&&!p&&this.invalidate()),this._lock=0,!this._ts&&!l))return this}}if(this._hasPause&&!this._forcing&&this._lock<2&&(u=e4(this,eC(m),eC(r)))&&(_-=r-(r=u._start)),this._tTime=_,this._time=r,this._act=!!c,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=e,m=0),!m&&_&&g&&!t&&!h&&(tg(this,"onStart"),this._tTime!==_))return this;if(r>=m&&e>=0)for(i=this._first;i;){if(a=i._next,(i._act||r>=i._start)&&i._ts&&u!==i){if(i.parent!==this)return this.render(e,t,n);if(i.render(i._ts>0?(r-i._start)*i._ts:(i._dirty?i.totalDuration():i._tDur)+(r-i._start)*i._ts,t,n),r!==this._time||!this._ts&&!l){u=0,a&&(_+=this._zTime=-1e-8);break}}i=a}else{i=this._last;for(var E=e<0?e:r;i;){if(a=i._prev,(i._act||E<=i._end)&&i._ts&&u!==i){if(i.parent!==this)return this.render(e,t,n);if(i.render(i._ts>0?(E-i._start)*i._ts:(i._dirty?i.totalDuration():i._tDur)+(E-i._start)*i._ts,t,n||T&&eD(i)),r!==this._time||!this._ts&&!l){u=0,a&&(_+=this._zTime=E?-1e-8:1e-8);break}}i=a}}if(u&&!t&&(this.pause(),u.render(r>=m?0:-1e-8)._zTime=r>=m?1:-1,this._ts))return this._start=d,eZ(this),this.render(e,t,n);this._onUpdate&&!t&&tg(this,"onUpdate",!0),(_===v&&this._tTime>=this.totalDuration()||!_&&m)&&(d===this._start||Math.abs(c)!==Math.abs(this._ts))&&!this._lock&&((e||!g)&&(_===v&&this._ts>0||!_&&this._ts<0)&&ez(this,1),t||e<0&&!m||!_&&!m&&v||(tg(this,_===v&&e>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(_<v&&this.timeScale()>0)&&this._prom()))}return this},i.add=function(e,t){var n=this;if(k(t)||(t=e7(this,t,e)),!(e instanceof tW)){if(q(e))return e.forEach(function(e){return n.add(e,t)}),this;if(G(e))return this.addLabel(e,t);if(!H(e))return this;e=t7.delayedCall(0,e)}return this!==e?eJ(this,e,t):this},i.getChildren=function(e,t,n,r){void 0===e&&(e=!0),void 0===t&&(t=!0),void 0===n&&(n=!0),void 0===r&&(r=-1e8);for(var i=[],a=this._first;a;)a._start>=r&&(a instanceof t7?t&&i.push(a):(n&&i.push(a),e&&i.push.apply(i,a.getChildren(!0,t,n)))),a=a._next;return i},i.getById=function(e){for(var t=this.getChildren(1,1,1),n=t.length;n--;)if(t[n].vars.id===e)return t[n]},i.remove=function(e){return G(e)?this.removeLabel(e):H(e)?this.killTweensOf(e):(e.parent===this&&eV(this,e),e===this._recent&&(this._recent=this._last),eW(this))},i.totalTime=function(t,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=eC(tA.time-(this._ts>0?t/this._ts:-((this.totalDuration()-t)/this._ts)))),e.prototype.totalTime.call(this,t,n),this._forcing=0,this):this._tTime},i.addLabel=function(e,t){return this.labels[e]=e7(this,t),this},i.removeLabel=function(e){return delete this.labels[e],this},i.addPause=function(e,t,n){var r=t7.delayedCall(0,t||ec,n);return r.data="isPause",this._hasPause=1,eJ(this,r,e7(this,e))},i.removePause=function(e){var t=this._first;for(e=e7(this,e);t;)t._start===e&&"isPause"===t.data&&ez(t),t=t._next},i.killTweensOf=function(e,t,n){for(var r=this.getTweensOf(e,n),i=r.length;i--;)tZ!==r[i]&&r[i].kill(e,t);return this},i.getTweensOf=function(e,t){for(var n,r=[],i=to(e),a=this._first,o=k(t);a;)a instanceof t7?eA(a._targets,i)&&(o?(!tZ||a._initted&&a._ts)&&a.globalTime(0)<=t&&a.globalTime(a.totalDuration())>t:!t||a.isActive())&&r.push(a):(n=a.getTweensOf(i,t)).length&&r.push.apply(r,n),a=a._next;return r},i.tweenTo=function(e,t){t=t||{};var n,r=this,i=e7(r,e),a=t,o=a.startAt,s=a.onStart,l=a.onStartParams,u=a.immediateRender,c=t7.to(r,eI({ease:t.ease||"none",lazy:!1,immediateRender:!1,time:i,overwrite:"auto",duration:t.duration||Math.abs((i-(o&&"time"in o?o.time:r._time))/r.timeScale())||1e-8,onStart:function(){if(r.pause(),!n){var e=t.duration||Math.abs((i-(o&&"time"in o?o.time:r._time))/r.timeScale());c._dur!==e&&e8(c,e,0,1).render(c._time,!0,!0),n=1}s&&s.apply(c,l||[])}},t));return u?c.render(0):c},i.tweenFromTo=function(e,t,n){return this.tweenTo(t,eI({startAt:{time:e7(this,e)}},n))},i.recent=function(){return this._recent},i.nextLabel=function(e){return void 0===e&&(e=this._time),tv(this,e7(this,e))},i.previousLabel=function(e){return void 0===e&&(e=this._time),tv(this,e7(this,e),1)},i.currentLabel=function(e){return arguments.length?this.seek(e,!0):this.previousLabel(this._time+1e-8)},i.shiftChildren=function(e,t,n){void 0===n&&(n=0);var r,i=this._first,a=this.labels;for(e=eC(e);i;)i._start>=n&&(i._start+=e,i._end+=e),i=i._next;if(t)for(r in a)a[r]>=n&&(a[r]+=e);return eW(this)},i.invalidate=function(t){var n=this._first;for(this._lock=0;n;)n.invalidate(t),n=n._next;return e.prototype.invalidate.call(this,t)},i.clear=function(e){void 0===e&&(e=!0);for(var t,n=this._first;n;)t=n._next,this.remove(n),n=t;return this._dp&&(this._time=this._tTime=this._pTime=0),e&&(this.labels={}),eW(this)},i.totalDuration=function(e){var t,n,r,i=0,a=this._last,o=1e8;if(arguments.length)return this.timeScale((this._repeat<0?this.duration():this.totalDuration())/(this.reversed()?-e:e));if(this._dirty){for(r=this.parent;a;)t=a._prev,a._dirty&&a.totalDuration(),(n=a._start)>o&&this._sort&&a._ts&&!this._lock?(this._lock=1,eJ(this,a,n-a._delay,1)._lock=0):o=n,n<0&&a._ts&&(i-=n,(!r&&!this._dp||r&&r.smoothChildTiming)&&(this._start+=eC(n/this._ts),this._time-=n,this._tTime-=n),this.shiftChildren(-n,!1,-Infinity),o=0),a._end>i&&a._ts&&(i=a._end),a=t;e8(this,this===b&&this._time>i?this._time:i,1,1),this._dirty=0}return this._tDur},r.updateRoot=function(e){if(b._ts&&(eP(b,eY(e,b)),y=tA.frame),tA.frame>=eS){eS+=D.autoSleep||120;var t=b._first;if((!t||!t._ts)&&D.autoSleep&&tA._listeners.length<2){for(;t&&!t._ts;)t=t._next;t||tA.sleep()}}},r}(tW);eI(tX.prototype,{_lock:0,_hasPause:0,_forcing:0});var tK,tj,tq,tY,tZ,t$,tQ=function(e,t,n,r,i,a,o){var s,l,u,c,d,h,f,p,m=new nf(this._pt,e,t,0,1,ns,null,i),v=0,g=0;for(m.b=n,m.e=r,n+="",r+="",(f=~r.indexOf("random("))&&(r=tp(r)),a&&(a(p=[n,r],e,t),n=p[0],r=p[1]),l=n.match(ee)||[];s=ee.exec(r);)c=s[0],d=r.substring(v,s.index),u?u=(u+1)%5:"rgba("===d.substr(-5)&&(u=1),c!==l[g++]&&(h=parseFloat(l[g-1])||0,m._pt={_next:m._pt,p:d||1===g?d:",",s:h,c:"="===c.charAt(1)?ey(h,c)-h:parseFloat(c)-h,m:u&&u<4?Math.round:0},v=ee.lastIndex);return m.c=v<r.length?r.substring(v,r.length):"",m.fp=o,(et.test(r)||f)&&(m.e=0),this._pt=m,m},tJ=function(e,t,n,r,i,a,o,s,l,u){H(r)&&(r=r(i||0,e,a));var c,d=e[t],h="get"!==n?n:H(d)?l?e[t.indexOf("set")||!H(e["get"+t.substr(3)])?t:"get"+t.substr(3)](l):e[t]():d,f=H(d)?l?nn:nt:ne;if(G(r)&&(~r.indexOf("random(")&&(r=tp(r)),"="===r.charAt(1)&&((c=ey(h,r)+(tr(h)||0))||0===c)&&(r=c)),!u||h!==r||t$)return isNaN(h*r)||""===r?(d||t in e||es(t,r),tQ.call(this,e,t,h,r,f,s||D.stringFilter,l)):(c=new nf(this._pt,e,t,+h||0,r-(h||0),"boolean"==typeof d?no:na,0,f),l&&(c.fp=l),o&&c.modifier(o,this,e),this._pt=c)},t0=function(e,t,n,r,i){if(H(e)&&(e=t8(e,i,t,n,r)),!z(e)||e.style&&e.nodeType||q(e)||j(e))return G(e)?t8(e,i,t,n,r):e;var a,o={};for(a in e)o[a]=t8(e[a],i,t,n,r);return o},t1=function(e,t,n,r,i,a){var o,s,l,u;if(eg[e]&&!1!==(o=new eg[e]).init(i,o.rawVars?t[e]:t0(t[e],r,i,a,n),n,r,a)&&(n._pt=s=new nf(n._pt,i,e,0,1,o.render,o,0,o.priority),n!==A))for(l=n._ptLookup[n._targets.indexOf(i)],u=o._props.length;u--;)l[o._props[u]]=s;return o},t3=function e(t,n,r){var i,a,o,s,l,u,c,d,h,f,p,m,v,g=t.vars,_=g.ease,S=g.startAt,M=g.immediateRender,E=g.lazy,R=g.onUpdate,w=g.runBackwards,C=g.yoyoEase,y=g.keyframes,A=g.autoRevert,L=t._dur,D=t._startAt,N=t._targets,U=t.parent,I=U&&"nested"===U.data?U.vars.targets:N,F="auto"===t._overwrite&&!x,O=t.timeline,B=g.easeReverse||C;if(!O||y&&_||(_="none"),t._ease=tB(_,P.ease),t._rEase=B&&(tB(B)||t._ease),t._from=!O&&!!g.runBackwards,t._from&&(t.ratio=1),!O||y&&!g.stagger){if(m=(d=N[0]?eb(N[0]).harness:0)&&g[d.prop],i=eB(g,ep),D&&(D._zTime<0&&D.progress(1),n<0&&w&&M&&!A?D.render(-1,!0):D.revert(w&&L?eh:ed),D._lazy=0),S){if(ez(t._startAt=t7.set(N,eI({data:"isStart",overwrite:!1,parent:U,immediateRender:!0,lazy:!D&&W(E),startAt:null,delay:0,onUpdate:R&&function(){return tg(t,"onUpdate")},stagger:0},S))),t._startAt._dp=0,t._startAt._sat=t,n<0&&(T||!M&&!A)&&t._startAt.revert(eh),M&&L&&n<=0&&r<=0){n&&(t._zTime=n);return}}else if(w&&L&&!D)if(n&&(M=!1),o=eI({overwrite:!1,data:"isFromStart",lazy:M&&!D&&W(E),immediateRender:M,stagger:0,parent:U},i),m&&(o[d.prop]=m),ez(t._startAt=t7.set(N,o)),t._startAt._dp=0,t._startAt._sat=t,n<0&&(T?t._startAt.revert(eh):t._startAt.render(-1,!0)),t._zTime=n,M){if(!n)return}else e(t._startAt,1e-8,1e-8);for(t._pt=t._ptCache=0,E=L&&W(E)||E&&!L,a=0;a<N.length;a++){if(c=(l=N[a])._gsap||eM(N)[a]._gsap,t._ptLookup[a]=f={},ev[c.id]&&em.length&&eL(),p=I===N?a:I.indexOf(l),d&&!1!==(h=new d).init(l,m||i,t,p,I)&&(t._pt=s=new nf(t._pt,l,h.name,0,1,h.render,h,0,h.priority),h._props.forEach(function(e){f[e]=s}),h.priority&&(u=1)),!d||m)for(o in i)eg[o]&&(h=t1(o,i,t,p,l,I))?h.priority&&(u=1):f[o]=s=tJ.call(t,l,o,"get",i[o],p,I,0,g.stringFilter);t._op&&t._op[a]&&t.kill(l,t._op[a]),F&&t._pt&&(tZ=t,b.killTweensOf(l,f,t.globalTime(n)),v=!t.parent,tZ=0),t._pt&&E&&(ev[c.id]=1)}u&&nh(t),t._onInit&&t._onInit(t)}t._onUpdate=R,t._initted=(!t._op||t._pt)&&!v,y&&n<=0&&O.render(1e8,!0,!0)},t2=function(e,t,n,r,i,a,o,s){var l,u,c,d,h=(e._pt&&e._ptCache||(e._ptCache={}))[t];if(!h)for(h=e._ptCache[t]=[],c=e._ptLookup,d=e._targets.length;d--;){if((l=c[d][t])&&l.d&&l.d._pt)for(l=l.d._pt;l&&l.p!==t&&l.fp!==t;)l=l._next;if(!l)return t$=1,e.vars[t]="+=0",t3(e,o),t$=0,s?el(t+" not eligible for reset. Try splitting into individual properties"):1;h.push(l)}for(d=h.length;d--;)(l=(u=h[d])._pt||u).s=(r||0===r)&&!i?r:l.s+(r||0)+a*l.c,l.c=n-l.s,u.e&&(u.e=ew(n)+tr(u.e)),u.b&&(u.b=l.s+tr(u.b))},t5=function(e,t){var n,r,i,a,o=e[0]?eb(e[0]).harness:0,s=o&&o.aliases;if(!s)return t;for(r in n=eF({},t),s)if(r in n)for(i=(a=s[r].split(",")).length;i--;)n[a[i]]=n[r];return n},t4=function(e,t,n,r){var i,a,o=t.ease||r||"power1.inOut";if(q(t))a=n[e]||(n[e]=[]),t.forEach(function(e,n){return a.push({t:n/(t.length-1)*100,v:e,e:o})});else for(i in t)a=n[i]||(n[i]=[]),"ease"===i||a.push({t:parseFloat(e),v:t[i],e:o})},t8=function(e,t,n,r,i){return H(e)?e.call(t,n,r,i):G(e)&&~e.indexOf("random(")?tp(e):e},t6=eT+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,easeReverse,autoRevert",t9={};eR(t6+",id,stagger,delay,duration,paused,scrollTrigger",function(e){return t9[e]=1});var t7=function(e){function r(n,r,i,a){"number"==typeof r&&(i.duration=r,r=i,i=null);var o,s,l,u,c,d,h,f,p=e.call(this,a?r:eG(r))||this,m=p.vars,v=m.duration,g=m.delay,_=m.immediateRender,S=m.stagger,T=m.overwrite,M=m.keyframes,E=m.defaults,R=m.scrollTrigger,w=r.parent||b,C=(q(n)||j(n)?k(n[0]):"length"in r)?[n]:to(n);if(p._targets=C.length?eM(C):el("GSAP target "+n+" not found. https://gsap.com",!D.nullTargetWarn)||[],p._ptLookup=[],p._overwrite=T,M||S||K(v)||K(g)){var y=(r=p.vars).easeReverse||r.yoyoEase;if((o=p.timeline=new tX({data:"nested",defaults:E||{},targets:w&&"nested"===w.data?w.vars.targets:C})).kill(),o.parent=o._dp=t(p),o._start=0,S||K(v)||K(g)){if(u=C.length,h=S&&tu(S),z(S))for(c in S)~t6.indexOf(c)&&(f||(f={}),f[c]=S[c]);for(s=0;s<u;s++)(l=eB(r,t9)).stagger=0,y&&(l.easeReverse=y),f&&eF(l,f),d=C[s],l.duration=+t8(v,t(p),s,d,C),l.delay=(+t8(g,t(p),s,d,C)||0)-p._delay,!S&&1===u&&l.delay&&(p._delay=g=l.delay,p._start+=g,l.delay=0),o.to(d,l,h?h(s,d,C):0),o._ease=tD.none;o.duration()?v=g=0:p.timeline=0}else if(M){eG(eI(o.vars.defaults,{ease:"none"})),o._ease=tB(M.ease||r.ease||"none");var A,L,P,N=0;if(q(M))M.forEach(function(e){return o.to(C,e,">")}),o.duration();else{for(c in l={},M)"ease"===c||"easeEach"===c||t4(c,M[c],l,M.easeEach);for(c in l)for(A=l[c].sort(function(e,t){return e.t-t.t}),N=0,s=0;s<A.length;s++)(P={ease:(L=A[s]).e,duration:(L.t-(s?A[s-1].t:0))/100*v})[c]=L.v,o.to(C,P,N),N+=P.duration;o.duration()<v&&o.to({},{duration:v-o.duration()})}}v||p.duration(v=o.duration())}else p.timeline=0;return!0!==T||x||(tZ=t(p),b.killTweensOf(C),tZ=0),eJ(w,t(p),i),r.reversed&&p.reverse(),r.paused&&p.paused(!0),(_||!v&&!M&&p._start===eC(w._time)&&W(_)&&function e(t){return!t||t._ts&&e(t.parent)}(t(p))&&"nested"!==w.data)&&(p._tTime=-1e-8,p.render(Math.max(0,-g)||0)),R&&e0(t(p),R),p}n(r,e);var i=r.prototype;return i.render=function(e,t,n){var r,i,a,o,s,l,u,c,d=this._time,h=this._tDur,f=this._dur,p=e<0,m=e>h-1e-8&&!p?h:e<1e-8?0:e;if(f){if(m!==this._tTime||!e||n||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==p||this._lazy){if(r=m,c=this.timeline,this._repeat){if(o=f+this._rDelay,this._repeat<-1&&p)return this.totalTime(100*o+e,t,n);if(r=eC(m%o),m===h?(a=this._repeat,r=f):(a=~~(s=eC(m/o)))&&a===s?(r=f,a--):r>f&&(r=f),(l=this._yoyo&&1&a)&&(r=f-r),s=eq(this._tTime,o),r===d&&!n&&this._initted&&a===s)return this._tTime=m,this;a!==s&&this.vars.repeatRefresh&&!l&&!this._lock&&r!==o&&this._initted&&(this._lock=n=1,this.render(eC(o*a),!0).invalidate()._lock=0)}if(!this._initted){if(e1(this,p?e:r,n,t,m))return this._tTime=0,this;if(d!==this._time&&!(n&&this.vars.repeatRefresh&&a!==s))return this;if(f!==this._dur)return this.render(e,t,n)}if(this._rEase){var v=r<d;if(v!==this._inv){var g=v?d:f-d;this._inv=v,this._from&&(this.ratio=1-this.ratio),this._invRatio=this.ratio,this._invTime=d,this._invRecip=g?(v?-1:1)/g:0,this._invScale=v?-this.ratio:1-this.ratio,this._invEase=v?this._rEase:this._ease}this.ratio=u=this._invRatio+this._invScale*this._invEase((r-this._invTime)*this._invRecip)}else this.ratio=u=this._ease(r/f);if(this._from&&(this.ratio=u=1-u),this._tTime=m,this._time=r,!this._act&&this._ts&&(this._act=1,this._lazy=0),!d&&m&&!t&&!s&&(tg(this,"onStart"),this._tTime!==m))return this;for(i=this._pt;i;)i.r(u,i.d),i=i._next;c&&c.render(e<0?e:c._dur*c._ease(r/this._dur),t,n)||this._startAt&&(this._zTime=e),this._onUpdate&&!t&&(p&&eK(this,e,t,n),tg(this,"onUpdate")),this._repeat&&a!==s&&this.vars.onRepeat&&!t&&this.parent&&tg(this,"onRepeat"),(m===this._tDur||!m)&&this._tTime===m&&(p&&!this._onUpdate&&eK(this,e,!0,!0),(e||!f)&&(m===this._tDur&&this._ts>0||!m&&this._ts<0)&&ez(this,1),!t&&!(p&&!d)&&(m||d||l)&&(tg(this,m===h?"onComplete":"onReverseComplete",!0),this._prom&&!(m<h&&this.timeScale()>0)&&this._prom()))}}else e5(this,e,t,n);return this},i.targets=function(){return this._targets},i.invalidate=function(t){return t&&this.vars.runBackwards||(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(t),e.prototype.invalidate.call(this,t)},i.resetTo=function(e,t,n,r,i){L||tA.wake(),this._ts||this.play();var a=Math.min(this._dur,(this._dp._time-this._start)*this._ts);return(this._initted||t3(this,a),t2(this,e,t,n,r,this._ease(a/this._dur),a,i))?this.resetTo(e,t,n,r,1):(e$(this,0),this.parent||ek(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},i.kill=function(e,t){if(void 0===t&&(t="all"),!e&&(!t||"all"===t))return this._lazy=this._pt=0,this.parent?t_(this):this.scrollTrigger&&this.scrollTrigger.kill(!!T),this;if(this.timeline){var n=this.timeline.totalDuration();return this.timeline.killTweensOf(e,t,tZ&&!0!==tZ.vars.overwrite)._first||t_(this),this.parent&&n!==this.timeline.totalDuration()&&e8(this,this._dur*this.timeline._tDur/n,0,1),this}var r,i,a,o,s,l,u,c=this._targets,d=e?to(e):c,h=this._ptLookup,f=this._pt;if((!t||"all"===t)&&eH(c,d))return"all"===t&&(this._pt=0),t_(this);for(r=this._op=this._op||[],"all"!==t&&(G(t)&&(s={},eR(t,function(e){return s[e]=1}),t=s),t=t5(c,t)),u=c.length;u--;)if(~d.indexOf(c[u]))for(s in i=h[u],"all"===t?(r[u]=t,o=i,a={}):(a=r[u]=r[u]||{},o=t),o)(l=i&&i[s])&&("kill"in l.d&&!0!==l.d.kill(s)||eV(this,l,"_pt"),delete i[s]),"all"!==a&&(a[s]=1);return this._initted&&!this._pt&&f&&t_(this),this},r.to=function(e,t){return new r(e,t,arguments[2])},r.from=function(e,t){return te(1,arguments)},r.delayedCall=function(e,t,n,i){return new r(t,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:e,onComplete:t,onReverseComplete:t,onCompleteParams:n,onReverseCompleteParams:n,callbackScope:i})},r.fromTo=function(e,t,n){return te(2,arguments)},r.set=function(e,t){return t.duration=0,t.repeatDelay||(t.repeat=0),new r(e,t)},r.killTweensOf=function(e,t,n){return b.killTweensOf(e,t,n)},r}(tW);eI(t7.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),eR("staggerTo,staggerFrom,staggerFromTo",function(e){t7[e]=function(){var t=new tX,n=ti.call(arguments,0);return n.splice("staggerFromTo"===e?5:4,0,0),t[e].apply(t,n)}});var ne=function(e,t,n){return e[t]=n},nt=function(e,t,n){return e[t](n)},nn=function(e,t,n,r){return e[t](r.fp,n)},nr=function(e,t,n){return e.setAttribute(t,n)},ni=function(e,t){return H(e[t])?nt:V(e[t])&&e.setAttribute?nr:ne},na=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e6)/1e6,t)},no=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},ns=function(e,t){var n=t._pt,r="";if(!e&&t.b)r=t.b;else if(1===e&&t.e)r=t.e;else{for(;n;)r=n.p+(n.m?n.m(n.s+n.c*e):Math.round((n.s+n.c*e)*1e4)/1e4)+r,n=n._next;r+=t.c}t.set(t.t,t.p,r,t)},nl=function(e,t){for(var n=t._pt;n;)n.r(e,n.d),n=n._next},nu=function(e,t,n,r){for(var i,a=this._pt;a;)i=a._next,a.p===r&&a.modifier(e,t,n),a=i},nc=function(e){for(var t,n,r=this._pt;r;)n=r._next,(r.p!==e||r.op)&&r.op!==e?r.dep||(t=1):eV(this,r,"_pt"),r=n;return!t},nd=function(e,t,n,r){r.mSet(e,t,r.m.call(r.tween,n,r.mt),r)},nh=function(e){for(var t,n,r,i,a=e._pt;a;){for(t=a._next,n=r;n&&n.pr>a.pr;)n=n._next;(a._prev=n?n._prev:i)?a._prev._next=a:r=a,(a._next=n)?n._prev=a:i=a,a=t}e._pt=r},nf=function(){function e(e,t,n,r,i,a,o,s,l){this.t=t,this.s=r,this.c=i,this.p=n,this.r=a||na,this.d=o||this,this.set=s||ne,this.pr=l||0,this._next=e,e&&(e._prev=this)}return e.prototype.modifier=function(e,t,n){this.mSet=this.mSet||this.set,this.set=nd,this.m=e,this.mt=n,this.tween=t},e}();eR(eT+"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,easeReverse",function(e){return ep[e]=1}),ei.TweenMax=ei.TweenLite=t7,ei.TimelineLite=ei.TimelineMax=tX,b=new tX({sortChildren:!1,defaults:P,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),D.stringFilter=ty;var np=[],nm={},nv=[],ng=0,n_=0,nS=function(e){return(nm[e]||nv).map(function(e){return e()})},nx=function(){var e=Date.now(),t=[];e-ng>2&&(nS("matchMediaInit"),np.forEach(function(e){var n,r,i,a,o=e.queries,s=e.conditions;for(r in o)(n=E.matchMedia(o[r]).matches)&&(i=1),n!==s[r]&&(s[r]=n,a=1);a&&(e.revert(),i&&t.push(e))}),nS("matchMediaRevert"),t.forEach(function(e){return e.onMatch(e,function(t){return e.add(null,t)})}),ng=e,nS("matchMedia"))},nT=function(){function e(e,t){this.selector=t&&ts(t),this.data=[],this._r=[],this.isReverted=!1,this.id=n_++,e&&this.add(e)}var t=e.prototype;return t.add=function(e,t,n){H(e)&&(n=t,t=e,e=H);var r=this,i=function(){var e,i=M,a=r.selector;return i&&i!==r&&i.data.push(r),n&&(r.selector=ts(n)),M=r,e=t.apply(r,arguments),H(e)&&r._r.push(e),M=i,r.selector=a,r.isReverted=!1,e};return r.last=i,e===H?i(r,function(e){return r.add(null,e)}):e?r[e]=i:i},t.ignore=function(e){var t=M;M=null,e(this),M=t},t.getTweens=function(){var t=[];return this.data.forEach(function(n){return n instanceof e?t.push.apply(t,n.getTweens()):n instanceof t7&&!(n.parent&&"nested"===n.parent.data)&&t.push(n)}),t},t.clear=function(){this._r.length=this.data.length=0},t.kill=function(e,t){var n=this;if(e){for(var r,i=n.getTweens(),a=n.data.length;a--;)"isFlip"===(r=n.data[a]).data&&(r.revert(),r.getChildren(!0,!0,!1).forEach(function(e){return i.splice(i.indexOf(e),1)}));for(i.map(function(e){return{g:e._dur||e._delay||e._sat&&!e._sat.vars.immediateRender?e.globalTime(0):-1/0,t:e}}).sort(function(e,t){return t.g-e.g||-1/0}).forEach(function(t){return t.t.revert(e)}),a=n.data.length;a--;)(r=n.data[a])instanceof tX?"nested"!==r.data&&(r.scrollTrigger&&r.scrollTrigger.revert(),r.kill()):r instanceof t7||!r.revert||r.revert(e);n._r.forEach(function(t){return t(e,n)}),n.isReverted=!0}else this.data.forEach(function(e){return e.kill&&e.kill()});if(this.clear(),t)for(var o=np.length;o--;)np[o].id===this.id&&np.splice(o,1)},t.revert=function(e){this.kill(e||{})},e}(),nM=function(){function e(e){this.contexts=[],this.scope=e,M&&M.data.push(this)}var t=e.prototype;return t.add=function(e,t,n){z(e)||(e={matches:e});var r,i,a,o=new nT(0,n||this.scope),s=o.conditions={};for(i in M&&!o.selector&&(o.selector=M.selector),this.contexts.push(o),t=o.add("onMatch",t),o.queries=e,e)"all"===i?a=1:(r=E.matchMedia(e[i]))&&(0>np.indexOf(o)&&np.push(o),(s[i]=r.matches)&&(a=1),r.addListener?r.addListener(nx):r.addEventListener("change",nx));return a&&t(o,function(e){return o.add(null,e)}),this},t.revert=function(e){this.kill(e||{})},t.kill=function(e){this.contexts.forEach(function(t){return t.kill(e,!0)})},e}(),nb={registerPlugin:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];t.forEach(function(e){return tx(e)})},timeline:function(e){return new tX(e)},getTweensOf:function(e,t){return b.getTweensOf(e,t)},getProperty:function(e,t,n,r){G(e)&&(e=to(e)[0]);var i=eb(e||{}).get,a=n?eU:eN;return"native"===n&&(n=""),e?t?a((eg[t]&&eg[t].get||i)(e,t,n,r)):function(t,n,r){return a((eg[t]&&eg[t].get||i)(e,t,n,r))}:e},quickSetter:function(e,t,n){if((e=to(e)).length>1){var r=e.map(function(e){return nC.quickSetter(e,t,n)}),i=r.length;return function(e){for(var t=i;t--;)r[t](e)}}e=e[0]||{};var a=eg[t],o=eb(e),s=o.harness&&(o.harness.aliases||{})[t]||t,l=a?function(t){var r=new a;A._pt=0,r.init(e,n?t+n:t,A,0,[e]),r.render(1,r),A._pt&&nl(1,A)}:o.set(e,s);return a?l:function(t){return l(e,s,n?t+n:t,o,1)}},quickTo:function(e,t,n){var r,i=nC.to(e,eI(((r={})[t]="+=0.1",r.paused=!0,r.stagger=0,r),n||{})),a=function(e,n,r){return i.resetTo(t,e,n,r)};return a.tween=i,a},isTweening:function(e){return b.getTweensOf(e,!0).length>0},defaults:function(e){return e&&e.ease&&(e.ease=tB(e.ease,P.ease)),eO(P,e||{})},config:function(e){return eO(D,e||{})},registerEffect:function(e){var t=e.name,n=e.effect,r=e.plugins,i=e.defaults,a=e.extendTimeline;(r||"").split(",").forEach(function(e){return e&&!eg[e]&&!ei[e]&&el(t+" effect requires "+e+" plugin.")}),e_[t]=function(e,t,r){return n(to(e),eI(t||{},i),r)},a&&(tX.prototype[t]=function(e,n,r){return this.add(e_[t](e,z(n)?n:(r=n)&&{},this),r)})},registerEase:function(e,t){tD[e]=tB(t)},parseEase:function(e,t){return arguments.length?tB(e,t):tD},getById:function(e){return b.getById(e)},exportRoot:function(e,t){void 0===e&&(e={});var n,r,i=new tX(e);for(i.smoothChildTiming=W(e.smoothChildTiming),b.remove(i),i._dp=0,i._time=i._tTime=b._time,n=b._first;n;)r=n._next,(t||!(!n._dur&&n instanceof t7&&n.vars.onComplete===n._targets[0]))&&eJ(i,n,n._start-n._delay),n=r;return eJ(b,i,0),i},context:function(e,t){return e?new nT(e,t):M},matchMedia:function(e){return new nM(e)},matchMediaRefresh:function(){return np.forEach(function(e){var t,n,r=e.conditions;for(n in r)r[n]&&(r[n]=!1,t=1);t&&e.revert()})||nx()},addEventListener:function(e,t){var n=nm[e]||(nm[e]=[]);~n.indexOf(t)||n.push(t)},removeEventListener:function(e,t){var n=nm[e],r=n&&n.indexOf(t);r>=0&&n.splice(r,1)},utils:{wrap:function e(t,n,r){var i=n-t;return q(t)?tf(t,e(0,t.length),n):tt(r,function(e){return(i+(e-t)%i)%i+t})},wrapYoyo:function e(t,n,r){var i=n-t,a=2*i;return q(t)?tf(t,e(0,t.length-1),n):tt(r,function(e){return e=(a+(e-t)%a)%a||0,t+(e>i?a-e:e)})},distribute:tu,random:th,snap:td,normalize:function(e,t,n){return tm(e,t,0,1,n)},getUnit:tr,clamp:function(e,t,n){return tt(n,function(n){return tn(e,t,n)})},splitColor:tb,toArray:to,selector:ts,mapRange:tm,pipe:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return t.reduce(function(e,t){return t(e)},e)}},unitize:function(e,t){return function(n){return e(parseFloat(n))+(t||tr(n))}},interpolate:function e(t,n,r,i){var a=isNaN(t+n)?0:function(e){return(1-e)*t+e*n};if(!a){var o,s,l,u,c,d=G(t),h={};if(!0===r&&(i=1)&&(r=null),d)t={p:t},n={p:n};else if(q(t)&&!q(n)){for(l=[],c=(u=t.length)-2,s=1;s<u;s++)l.push(e(t[s-1],t[s]));u--,a=function(e){var t=Math.min(c,~~(e*=u));return l[t](e-t)},r=n}else i||(t=eF(q(t)?[]:{},t));if(!l){for(o in n)tJ.call(h,t,o,"get",n[o]);a=function(e){return nl(e,h)||(d?t.p:t)}}}return tt(r,a)},shuffle:tl},install:eo,effects:e_,ticker:tA,updateRoot:tX.updateRoot,plugins:eg,globalTimeline:b,core:{PropTween:nf,globals:eu,Tween:t7,Timeline:tX,Animation:tW,getCache:eb,_removeLinkedListItem:eV,reverting:function(){return T},context:function(e){return e&&M&&(M.data.push(e),e._ctx=M),M},suppressOverwrites:function(e){return x=e}}};eR("to,from,fromTo,delayedCall,set,killTweensOf",function(e){return nb[e]=t7[e]}),tA.add(tX.updateRoot),A=nb.to({},{duration:0});var nE=function(e,t){for(var n=e._pt;n&&n.p!==t&&n.op!==t&&n.fp!==t;)n=n._next;return n},nR=function(e,t){var n,r,i,a=e._targets;for(n in t)for(r=a.length;r--;)(i=e._ptLookup[r][n])&&(i=i.d)&&(i._pt&&(i=nE(i,n)),i&&i.modifier&&i.modifier(t[n],e,a[r],n))},nw=function(e,t){return{name:e,headless:1,rawVars:1,init:function(e,n,r){r._onInit=function(e){var r,i;if(G(n)&&(r={},eR(n,function(e){return r[e]=1}),n=r),t){for(i in r={},n)r[i]=t(n[i]);n=r}nR(e,n)}}}},nC=nb.registerPlugin({name:"attr",init:function(e,t,n,r,i){var a,o,s;for(a in this.tween=n,t)s=e.getAttribute(a)||"",(o=this.add(e,"setAttribute",(s||0)+"",t[a],r,i,0,0,a)).op=a,o.b=s,this._props.push(a)},render:function(e,t){for(var n=t._pt;n;)T?n.set(n.t,n.p,n.b,n):n.r(e,n.d),n=n._next}},{name:"endArray",headless:1,init:function(e,t){for(var n=t.length;n--;)this.add(e,n,e[n]||0,t[n],0,0,0,0,0,1)}},nw("roundProps",tc),nw("modifiers"),nw("snap",td))||nb;t7.version=tX.version=nC.version="3.15.0",C=1,X()&&tL(),tD.Power0,tD.Power1,tD.Power2,tD.Power3,tD.Power4,tD.Linear,tD.Quad,tD.Cubic,tD.Quart,tD.Quint,tD.Strong,tD.Elastic,tD.Back,tD.SteppedEase,tD.Bounce,tD.Sine,tD.Expo,tD.Circ;var ny,nA,nL,nD,nP,nN,nU,nI={},nF=180/Math.PI,nO=Math.PI/180,nB=Math.atan2,nG=/([A-Z])/g,nH=/(left|right|width|margin|padding|x)/i,nk=/[\s,\(]\S/,nV={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},nz=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},nW=function(e,t){return t.set(t.t,t.p,1===e?t.e:Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},nX=function(e,t){return t.set(t.t,t.p,e?Math.round((t.s+t.c*e)*1e4)/1e4+t.u:t.b,t)},nK=function(e,t){return t.set(t.t,t.p,1===e?t.e:e?Math.round((t.s+t.c*e)*1e4)/1e4+t.u:t.b,t)},nj=function(e,t){var n=t.s+t.c*e;t.set(t.t,t.p,~~(n+(n<0?-.5:.5))+t.u,t)},nq=function(e,t){return t.set(t.t,t.p,e?t.e:t.b,t)},nY=function(e,t){return t.set(t.t,t.p,1!==e?t.b:t.e,t)},nZ=function(e,t,n){return e.style[t]=n},n$=function(e,t,n){return e.style.setProperty(t,n)},nQ=function(e,t,n){return e._gsap[t]=n},nJ=function(e,t,n){return e._gsap.scaleX=e._gsap.scaleY=n},n0=function(e,t,n,r,i){var a=e._gsap;a.scaleX=a.scaleY=n,a.renderTransform(i,a)},n1=function(e,t,n,r,i){var a=e._gsap;a[t]=n,a.renderTransform(i,a)},n3="transform",n2=n3+"Origin",n5=function e(t,n){var r=this,i=this.target,a=i.style,o=i._gsap;if(t in nI&&a){if(this.tfm=this.tfm||{},"transform"===t)return nV.transform.split(",").forEach(function(t){return e.call(r,t,n)});if(~(t=nV[t]||t).indexOf(",")?t.split(",").forEach(function(e){return r.tfm[e]=rh(i,e)}):this.tfm[t]=o.x?o[t]:rh(i,t),t===n2&&(this.tfm.zOrigin=o.zOrigin),this.props.indexOf(n3)>=0)return;o.svg&&(this.svgo=i.getAttribute("data-svg-origin"),this.props.push(n2,n,"")),t=n3}(a||n)&&this.props.push(t,n,a[t])},n4=function(e){e.translate&&(e.removeProperty("translate"),e.removeProperty("scale"),e.removeProperty("rotate"))},n8=function(){var e,t,n=this.props,r=this.target,i=r.style,a=r._gsap;for(e=0;e<n.length;e+=3)n[e+1]?2===n[e+1]?r[n[e]](n[e+2]):r[n[e]]=n[e+2]:n[e+2]?i[n[e]]=n[e+2]:i.removeProperty("--"===n[e].substr(0,2)?n[e]:n[e].replace(nG,"-$1").toLowerCase());if(this.tfm){for(t in this.tfm)a[t]=this.tfm[t];a.svg&&(a.renderTransform(),r.setAttribute("data-svg-origin",this.svgo||"")),(e=nN())&&e.isStart||i[n3]||(n4(i),a.zOrigin&&i[n2]&&(i[n2]+=" "+a.zOrigin+"px",a.zOrigin=0,a.renderTransform()),a.uncache=1)}},n6=function(e,t){var n={target:e,props:[],revert:n8,save:n5};return e._gsap||nC.core.getCache(e),t&&e.style&&e.nodeType&&t.split(",").forEach(function(e){return n.save(e)}),n},n9=function(e,t){var n=ny.createElementNS?ny.createElementNS((t||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),e):ny.createElement(e);return n&&n.style?n:ny.createElement(e)},n7=function e(t,n,r){var i=getComputedStyle(t);return i[n]||i.getPropertyValue(n.replace(nG,"-$1").toLowerCase())||i.getPropertyValue(n)||!r&&e(t,rt(n)||n,1)||""},re="O,Moz,ms,Ms,Webkit".split(","),rt=function(e,t,n){var r=(t||nD).style,i=5;if(e in r&&!n)return e;for(e=e.charAt(0).toUpperCase()+e.substr(1);i--&&!(re[i]+e in r););return i<0?null:(3===i?"ms":i>=0?re[i]:"")+e},rn=function(){"u">typeof window&&window.document&&(nA=(ny=window.document).documentElement,nD=n9("div")||{style:{}},n9("div"),n2=(n3=rt(n3))+"Origin",nD.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",nU=!!rt("perspective"),nN=nC.core.reverting,nL=1)},rr=function(e){var t,n=e.ownerSVGElement,r=n9("svg",n&&n.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),i=e.cloneNode(!0);i.style.display="block",r.appendChild(i),nA.appendChild(r);try{t=i.getBBox()}catch(e){}return r.removeChild(i),nA.removeChild(r),t},ri=function(e,t){for(var n=t.length;n--;)if(e.hasAttribute(t[n]))return e.getAttribute(t[n])},ra=function(e){var t,n;try{t=e.getBBox()}catch(r){t=rr(e),n=1}return t&&(t.width||t.height)||n||(t=rr(e)),!t||t.width||t.x||t.y?t:{x:+ri(e,["x","cx","x1"])||0,y:+ri(e,["y","cy","y1"])||0,width:0,height:0}},ro=function(e){return!!(e.getCTM&&(!e.parentNode||e.ownerSVGElement)&&ra(e))},rs=function(e,t){if(t){var n,r=e.style;t in nI&&t!==n2&&(t=n3),r.removeProperty?(("ms"===(n=t.substr(0,2))||"webkit"===t.substr(0,6))&&(t="-"+t),r.removeProperty("--"===n?t:t.replace(nG,"-$1").toLowerCase())):r.removeAttribute(t)}},rl=function(e,t,n,r,i,a){var o=new nf(e._pt,t,n,0,1,a?nY:nq);return e._pt=o,o.b=r,o.e=i,e._props.push(n),o},ru={deg:1,rad:1,turn:1},rc={grid:1,flex:1},rd=function e(t,n,r,i){var a,o,s,l,u=parseFloat(r)||0,c=(r+"").trim().substr((u+"").length)||"px",d=nD.style,h=nH.test(n),f="svg"===t.tagName.toLowerCase(),p=(f?"client":"offset")+(h?"Width":"Height"),m="px"===i,v="%"===i;if(i===c||!u||ru[i]||ru[c])return u;if("px"===c||m||(u=e(t,n,r,"px")),l=t.getCTM&&ro(t),(v||"%"===c)&&(nI[n]||~n.indexOf("adius")))return a=l?t.getBBox()[h?"width":"height"]:t[p],ew(v?u/a*100:u/100*a);if(d[h?"width":"height"]=100+(m?c:i),o="rem"!==i&&~n.indexOf("adius")||"em"===i&&t.appendChild&&!f?t:t.parentNode,l&&(o=(t.ownerSVGElement||{}).parentNode),o&&o!==ny&&o.appendChild||(o=ny.body),(s=o._gsap)&&v&&s.width&&h&&s.time===tA.time&&!s.uncache)return ew(u/s.width*100);if(v&&("height"===n||"width"===n)){var g=t.style[n];t.style[n]=100+i,a=t[p],g?t.style[n]=g:rs(t,n)}else(v||"%"===c)&&!rc[n7(o,"display")]&&(d.position=n7(t,"position")),o===t&&(d.position="static"),o.appendChild(nD),a=nD[p],o.removeChild(nD),d.position="absolute";return h&&v&&((s=eb(o)).time=tA.time,s.width=o[p]),ew(m?a*u/100:a&&u?100/a*u:0)},rh=function(e,t,n,r){var i;return nL||rn(),t in nV&&"transform"!==t&&~(t=nV[t]).indexOf(",")&&(t=t.split(",")[0]),nI[t]&&"transform"!==t?(i=rE(e,r),i="transformOrigin"!==t?i[t]:i.svg?i.origin:rR(n7(e,n2))+" "+i.zOrigin+"px"):(!(i=e.style[t])||"auto"===i||r||~(i+"").indexOf("calc("))&&(i=rg[t]&&rg[t](e,t,n)||n7(e,t)||eE(e,t)||+("opacity"===t)),n&&!~(i+"").trim().indexOf(" ")?rd(e,t,i,n)+n:i},rf=function(e,t,n,r){if(!n||"none"===n){var i=rt(t,e,1),a=i&&n7(e,i,1);a&&a!==n?(t=i,n=a):"borderColor"===t&&(n=n7(e,"borderTopColor"))}var o,s,l,u,c,d,h,f,p,m,v,g=new nf(this._pt,e.style,t,0,1,ns),_=0,S=0;if(g.b=n,g.e=r,n+="","var(--"===(r+="").substring(0,6)&&(r=n7(e,r.substring(4,r.indexOf(")")))),"auto"===r&&(d=e.style[t],e.style[t]=r,r=n7(e,t)||r,d?e.style[t]=d:rs(e,t)),ty(o=[n,r]),n=o[0],r=o[1],l=n.match(J)||[],(r.match(J)||[]).length){for(;s=J.exec(r);)h=s[0],p=r.substring(_,s.index),c?c=(c+1)%5:("rgba("===p.substr(-5)||"hsla("===p.substr(-5))&&(c=1),h!==(d=l[S++]||"")&&(u=parseFloat(d)||0,v=d.substr((u+"").length),"="===h.charAt(1)&&(h=ey(u,h)+v),f=parseFloat(h),m=h.substr((f+"").length),_=J.lastIndex-m.length,m||(m=m||D.units[t]||v,_===r.length&&(r+=m,g.e+=m)),v!==m&&(u=rd(e,t,d,m)||0),g._pt={_next:g._pt,p:p||1===S?p:",",s:u,c:f-u,m:c&&c<4||"zIndex"===t?Math.round:0});g.c=_<r.length?r.substring(_,r.length):""}else g.r="display"===t&&"none"===r?nY:nq;return et.test(r)&&(g.e=0),this._pt=g,g},rp={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},rm=function(e){var t=e.split(" "),n=t[0],r=t[1]||"50%";return("top"===n||"bottom"===n||"left"===r||"right"===r)&&(e=n,n=r,r=e),t[0]=rp[n]||n,t[1]=rp[r]||r,t.join(" ")},rv=function(e,t){if(t.tween&&t.tween._time===t.tween._dur){var n,r,i,a=t.t,o=a.style,s=t.u,l=a._gsap;if("all"===s||!0===s)o.cssText="",r=1;else for(i=(s=s.split(",")).length;--i>-1;)nI[n=s[i]]&&(r=1,n="transformOrigin"===n?n2:n3),rs(a,n);r&&(rs(a,n3),l&&(l.svg&&a.removeAttribute("transform"),o.scale=o.rotate=o.translate="none",rE(a,1),l.uncache=1,n4(o)))}},rg={clearProps:function(e,t,n,r,i){if("isFromStart"!==i.data){var a=e._pt=new nf(e._pt,t,n,0,0,rv);return a.u=r,a.pr=-10,a.tween=i,e._props.push(n),1}}},r_=[1,0,0,1,0,0],rS={},rx=function(e){return"matrix(1, 0, 0, 1, 0, 0)"===e||"none"===e||!e},rT=function(e){var t=n7(e,n3);return rx(t)?r_:t.substr(7).match(Q).map(ew)},rM=function(e,t){var n,r,i,a,o=e._gsap||eb(e),s=e.style,l=rT(e);return o.svg&&e.getAttribute("transform")?"1,0,0,1,0,0"===(l=[(i=e.transform.baseVal.consolidate().matrix).a,i.b,i.c,i.d,i.e,i.f]).join(",")?r_:l:(l!==r_||e.offsetParent||e===nA||o.svg||(i=s.display,s.display="block",(n=e.parentNode)&&(e.offsetParent||e.getBoundingClientRect().width)||(a=1,r=e.nextElementSibling,nA.appendChild(e)),l=rT(e),i?s.display=i:rs(e,"display"),a&&(r?n.insertBefore(e,r):n?n.appendChild(e):nA.removeChild(e))),t&&l.length>6?[l[0],l[1],l[4],l[5],l[12],l[13]]:l)},rb=function(e,t,n,r,i,a){var o,s,l,u,c=e._gsap,d=i||rM(e,!0),h=c.xOrigin||0,f=c.yOrigin||0,p=c.xOffset||0,m=c.yOffset||0,v=d[0],g=d[1],_=d[2],S=d[3],x=d[4],T=d[5],M=t.split(" "),b=parseFloat(M[0])||0,E=parseFloat(M[1])||0;n?d!==r_&&(s=v*S-g*_)&&(l=S/s*b+-_/s*E+(_*T-S*x)/s,u=-g/s*b+v/s*E-(v*T-g*x)/s,b=l,E=u):(b=(o=ra(e)).x+(~M[0].indexOf("%")?b/100*o.width:b),E=o.y+(~(M[1]||M[0]).indexOf("%")?E/100*o.height:E)),r||!1!==r&&c.smooth?(c.xOffset=p+((x=b-h)*v+(T=E-f)*_)-x,c.yOffset=m+(x*g+T*S)-T):c.xOffset=c.yOffset=0,c.xOrigin=b,c.yOrigin=E,c.smooth=!!r,c.origin=t,c.originIsAbsolute=!!n,e.style[n2]="0px 0px",a&&(rl(a,c,"xOrigin",h,b),rl(a,c,"yOrigin",f,E),rl(a,c,"xOffset",p,c.xOffset),rl(a,c,"yOffset",m,c.yOffset)),e.setAttribute("data-svg-origin",b+" "+E)},rE=function(e,t){var n=e._gsap||new tz(e);if("x"in n&&!t&&!n.uncache)return n;var r,i,a,o,s,l,u,c,d,h,f,p,m,v,g,_,S,x,T,M,b,E,R,w,C,y,A,L,P,N,U,I,F=e.style,O=n.scaleX<0,B=getComputedStyle(e),G=n7(e,n2)||"0";return r=i=a=l=u=c=d=h=f=0,o=s=1,n.svg=!!(e.getCTM&&ro(e)),B.translate&&(("none"!==B.translate||"none"!==B.scale||"none"!==B.rotate)&&(F[n3]=("none"!==B.translate?"translate3d("+(B.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+("none"!==B.rotate?"rotate("+B.rotate+") ":"")+("none"!==B.scale?"scale("+B.scale.split(" ").join(",")+") ":"")+("none"!==B[n3]?B[n3]:"")),F.scale=F.rotate=F.translate="none"),v=rM(e,n.svg),n.svg&&(n.uncache?(C=e.getBBox(),G=n.xOrigin-C.x+"px "+(n.yOrigin-C.y)+"px",w=""):w=!t&&e.getAttribute("data-svg-origin"),rb(e,w||G,!!w||n.originIsAbsolute,!1!==n.smooth,v)),p=n.xOrigin||0,m=n.yOrigin||0,v!==r_&&(x=v[0],T=v[1],M=v[2],b=v[3],r=E=v[4],i=R=v[5],6===v.length?(o=Math.sqrt(x*x+T*T),s=Math.sqrt(b*b+M*M),l=x||T?nB(T,x)*n
1F:0,(d=M||b?nB(M,b)*nF+l:0)&&(s*=Math.abs(Math.cos(d*nO))),n.svg&&(r-=p-(p*x+m*M),i-=m-(p*T+m*b))):(I=v[6],N=v[7],A=v[8],L=v[9],P=v[10],U=v[11],r=v[12],i=v[13],a=v[14],u=(g=nB(I,P))*nF,g&&(w=E*(_=Math.cos(-g))+A*(S=Math.sin(-g)),C=R*_+L*S,y=I*_+P*S,A=-(E*S)+A*_,L=-(R*S)+L*_,P=-(I*S)+P*_,U=-(N*S)+U*_,E=w,R=C,I=y),c=(g=nB(-M,P))*nF,g&&(w=x*(_=Math.cos(-g))-A*(S=Math.sin(-g)),C=T*_-L*S,y=M*_-P*S,U=b*S+U*_,x=w,T=C,M=y),l=(g=nB(T,x))*nF,g&&(w=x*(_=Math.cos(g))+T*(S=Math.sin(g)),C=E*_+R*S,T=T*_-x*S,R=R*_-E*S,x=w,E=C),u&&Math.abs(u)+Math.abs(l)>359.9&&(u=l=0,c=180-c),o=ew(Math.sqrt(x*x+T*T+M*M)),s=ew(Math.sqrt(R*R+I*I)),d=Math.abs(g=nB(E,R))>2e-4?g*nF:0,f=U?1/(U<0?-U:U):0),n.svg&&(w=e.getAttribute("transform"),n.forceCSS=e.setAttribute("transform","")||!rx(n7(e,n3)),w&&e.setAttribute("transform",w))),Math.abs(d)>90&&270>Math.abs(d)&&(O?(o*=-1,d+=l<=0?180:-180,l+=l<=0?180:-180):(s*=-1,d+=d<=0?180:-180)),t=t||n.uncache,n.x=r-((n.xPercent=r&&(!t&&n.xPercent||(Math.round(e.offsetWidth/2)===Math.round(-r)?-50:0)))?e.offsetWidth*n.xPercent/100:0)+"px",n.y=i-((n.yPercent=i&&(!t&&n.yPercent||(Math.round(e.offsetHeight/2)===Math.round(-i)?-50:0)))?e.offsetHeight*n.yPercent/100:0)+"px",n.z=a+"px",n.scaleX=ew(o),n.scaleY=ew(s),n.rotation=ew(l)+"deg",n.rotationX=ew(u)+"deg",n.rotationY=ew(c)+"deg",n.skewX=d+"deg",n.skewY=h+"deg",n.transformPerspective=f+"px",(n.zOrigin=parseFloat(G.split(" ")[2])||!t&&n.zOrigin||0)&&(F[n2]=rR(G)),n.xOffset=n.yOffset=0,n.force3D=D.force3D,n.renderTransform=n.svg?rL:nU?rA:rC,n.uncache=0,n},rR=function(e){return(e=e.split(" "))[0]+" "+e[1]},rw=function(e,t,n){var r=tr(t);return ew(parseFloat(t)+parseFloat(rd(e,"x",n+"px",r)))+r},rC=function(e,t){t.z="0px",t.rotationY=t.rotationX="0deg",t.force3D=0,rA(e,t)},ry="0deg",rA=function(e,t){var n=t||this,r=n.xPercent,i=n.yPercent,a=n.x,o=n.y,s=n.z,l=n.rotation,u=n.rotationY,c=n.rotationX,d=n.skewX,h=n.skewY,f=n.scaleX,p=n.scaleY,m=n.transformPerspective,v=n.force3D,g=n.target,_=n.zOrigin,S="",x="auto"===v&&e&&1!==e||!0===v;if(_&&(c!==ry||u!==ry)){var T,M=parseFloat(u)*nO,b=Math.sin(M),E=Math.cos(M);a=rw(g,a,-(b*(T=Math.cos(M=parseFloat(c)*nO))*_)),o=rw(g,o,-(-Math.sin(M)*_)),s=rw(g,s,-(E*T*_)+_)}"0px"!==m&&(S+="perspective("+m+") "),(r||i)&&(S+="translate("+r+"%, "+i+"%) "),(x||"0px"!==a||"0px"!==o||"0px"!==s)&&(S+="0px"!==s||x?"translate3d("+a+", "+o+", "+s+") ":"translate("+a+", "+o+") "),l!==ry&&(S+="rotate("+l+") "),u!==ry&&(S+="rotateY("+u+") "),c!==ry&&(S+="rotateX("+c+") "),(d!==ry||h!==ry)&&(S+="skew("+d+", "+h+") "),(1!==f||1!==p)&&(S+="scale("+f+", "+p+") "),g.style[n3]=S||"translate(0, 0)"},rL=function(e,t){var n,r,i,a,o,s=t||this,l=s.xPercent,u=s.yPercent,c=s.x,d=s.y,h=s.rotation,f=s.skewX,p=s.skewY,m=s.scaleX,v=s.scaleY,g=s.target,_=s.xOrigin,S=s.yOrigin,x=s.xOffset,T=s.yOffset,M=s.forceCSS,b=parseFloat(c),E=parseFloat(d);h=parseFloat(h),f=parseFloat(f),(p=parseFloat(p))&&(f+=p=parseFloat(p),h+=p),h||f?(h*=nO,f*=nO,n=Math.cos(h)*m,r=Math.sin(h)*m,i=-(Math.sin(h-f)*v),a=Math.cos(h-f)*v,f&&(p*=nO,i*=o=Math.sqrt(1+(o=Math.tan(f-p))*o),a*=o,p&&(n*=o=Math.sqrt(1+(o=Math.tan(p))*o),r*=o)),n=ew(n),r=ew(r),i=ew(i),a=ew(a)):(n=m,a=v,r=i=0),(b&&!~(c+"").indexOf("px")||E&&!~(d+"").indexOf("px"))&&(b=rd(g,"x",c,"px"),E=rd(g,"y",d,"px")),(_||S||x||T)&&(b=ew(b+_-(_*n+S*i)+x),E=ew(E+S-(_*r+S*a)+T)),(l||u)&&(b=ew(b+l/100*(o=g.getBBox()).width),E=ew(E+u/100*o.height)),o="matrix("+n+","+r+","+i+","+a+","+b+","+E+")",g.setAttribute("transform",o),M&&(g.style[n3]=o)},rD=function(e,t,n,r,i){var a,o,s=G(i),l=parseFloat(i)*(s&&~i.indexOf("rad")?nF:1)-r,u=r+l+"deg";return s&&("short"===(a=i.split("_")[1])&&(l%=360)!=l%180&&(l+=l<0?360:-360),"cw"===a&&l<0?l=(l+36e9)%360-360*~~(l/360):"ccw"===a&&l>0&&(l=(l-36e9)%360-360*~~(l/360))),e._pt=o=new nf(e._pt,t,n,r,l,nW),o.e=u,o.u="deg",e._props.push(n),o},rP=function(e,t){for(var n in t)e[n]=t[n];return e},rN=function(e,t,n){var r,i,a,o,s,l,u,c=rP({},n._gsap),d=n.style;for(i in c.svg?(a=n.getAttribute("transform"),n.setAttribute("transform",""),d[n3]=t,r=rE(n,1),rs(n,n3),n.setAttribute("transform",a)):(a=getComputedStyle(n)[n3],d[n3]=t,r=rE(n,1),d[n3]=a),nI)(a=c[i])!==(o=r[i])&&0>"perspective,force3D,transformOrigin,svgOrigin".indexOf(i)&&(s=tr(a)!==(u=tr(o))?rd(n,i,a,u):parseFloat(a),l=parseFloat(o),e._pt=new nf(e._pt,r,i,s,l-s,nz),e._pt.u=u||0,e._props.push(i));rP(r,c)};eR("padding,margin,Width,Radius",function(e,t){var n="Right",r="Bottom",i="Left",a=(t<3?["Top",n,r,i]:["Top"+i,"Top"+n,r+n,r+i]).map(function(n){return t<2?e+n:"border"+n+e});rg[t>1?"border"+e:e]=function(e,t,n,r,i){var o,s;if(arguments.length<4)return 5===(s=(o=a.map(function(t){return rh(e,t,n)})).join(" ")).split(o[0]).length?o[0]:s;o=(r+"").split(" "),s={},a.forEach(function(e,t){return s[e]=o[t]=o[t]||o[(t-1)/2|0]}),e.init(t,s,i)}});var rU={name:"css",register:rn,targetTest:function(e){return e.style&&e.nodeType},init:function(e,t,n,r,i){var a,o,s,l,u,c,d,h,f,p,m,v,g,_,S,x,T,M=this._props,b=e.style,E=n.vars.startAt;for(d in nL||rn(),this.styles=this.styles||n6(e),x=this.styles.props,this.tween=n,t)if("autoRound"!==d&&(o=t[d],!(eg[d]&&t1(d,t,n,r,e,i)))){if(u=typeof o,c=rg[d],"function"===u&&(u=typeof(o=o.call(n,r,e,i))),"string"===u&&~o.indexOf("random(")&&(o=tp(o)),c)c(this,e,d,o,n)&&(S=1);else if("--"===d.substr(0,2))a=(getComputedStyle(e).getPropertyValue(d)+"").trim(),o+="",tw.lastIndex=0,!tw.test(a)&&(h=tr(a),(f=tr(o
1))?h!==f&&(a=rd(e,d,a,f)+f):h&&(o+=h)),this.add(b,"setProperty",a,o,r,i,0,0,d),M.push(d),x.push(d,0,b[d]);else if("undefined"!==u){if(E&&d in E?(G(a="function"==typeof E[d]?E[d].call(n,r,e,i):E[d])&&~a.indexOf("random(")&&(a=tp(a)),tr(a+"")||"auto"===a||(a+=D.units[d]||tr(rh(e,d))||""),"="===(a+"").charAt(1)&&(a=rh(e,d))):a=rh(e,d),l=parseFloat(a),(p="string"===u&&"="===o.charAt(1)&&o.substr(0,2))&&(o=o.substr(2)),s=parseFloat(o),d in nV&&("autoAlpha"===d&&(1===l&&"hidden"===rh(e,"visibility")&&s&&(l=0),x.push("visibility",0,b.visibility),rl(this,b,"visibility",l?"inherit":"hidden",s?"inherit":"hidden",!s)),"scale"!==d&&"transform"!==d&&~(d=nV[d]).indexOf(",")&&(d=d.split(",")[0])),m=d in nI){if(this.styles.save(d),T=o,"string"===u&&"var(--"===o.substring(0,6)){if("calc("===(o=n7(e,o.substring(4,o.indexOf(")")))).substring(0,5)){var R=e.style.perspective;e.style.perspective=o,o=n7(e,"perspective"),R?e.style.perspective=R:rs(e,"perspective")}s=parseFloat(o)}if(v||((g=e._gsap).renderTransform&&!t.parseTransform||rE(e,t.parseTransform),_=!1!==t.smoothOrigin&&g.smooth,(v=this._pt=new nf(this._pt,b,n3,0,1,g.renderTransform,g,0,-1)).dep=1),"scale"===d)this._pt=new nf(this._pt,g,"scaleY",g.scaleY,(p?ey(g.scaleY,p+s):s)-g.scaleY||0,nz),this._pt.u=0,M.push("scaleY",d),d+="X";else if("transformOrigin"===d){x.push(n2,0,b[n2]),o=rm(o),g.svg?rb(e,o,0,_,0,this):((f=parseFloat(o.split(" ")[2])||0)!==g.zOrigin&&rl(this,g,"zOrigin",g.zOrigin,f),rl(this,b,d,rR(a),rR(o)));continue}else if("svgOrigin"===d){rb(e,o,1,_,0,this);continue}else if(d in rS){rD(this,g,d,l,p?ey(l,p+o):o);continue}else if("smoothOrigin"===d){rl(this,g,"smooth",g.smooth,o);continue}else if("force3D"===d){g[d]=o;continue}else if("transform"===d){rN(this,o,e);continue}}else d in b||(d=rt(d)||d);if(m||(s||0===s)&&(l||0===l)&&!nk.test(o)&&d in b)h=(a+"").substr((l+"").length),s||(s=0),f=tr(o)||(d in D.units?D.units[d]:h),h!==f&&(l=rd(e,d,a,f)),this._pt=new nf(this._pt,m?g:b,d,l,(p?ey(l,p+s):s)-l,!m&&("px"===f||"zIndex"===d)&&!1!==t.autoRound?nj:nz),this._pt.u=f||0,m&&T!==o?(this._pt.b=a,this._pt.e=T,this._pt.r=nK):h!==f&&"%"!==f&&(this._pt.b=a,this._pt.r=nX);else if(d in b)rf.call(this,e,d,a,p?p+o:o);else if(d in e)this.add(e,d,a||e[d],p?p+o:o,r,i);else if("parseTransform"!==d){es(d,o);continue}m||(d in b?x.push(d,0,b[d]):"function"==typeof e[d]?x.push(d,2,e[d]()):x.push(d,1,a||e[d])),M.push(d)}}S&&nh(this)},render:function(e,t){if(t.tween._time||!nN())for(var n=t._pt;n;)n.r(e,n.d),n=n._next;else t.styles.revert()},get:rh,aliases:nV,getSetter:function(e,t,n){var r=nV[t];return r&&0>r.indexOf(",")&&(t=r),t in nI&&t!==n2&&(e._gsap.x||rh(e,"x"))?n&&nP===n?"scale"===t?nJ:nQ:(nP=n||{},"scale"===t?n0:n1):e.style&&!V(e.style[t])?nZ:~t.indexOf("-")?n$:ni(e,t)},core:{_removeProperty:rs,_getMatrix:rM}};nC.utils.checkPrefix=rt,nC.core.getStyleSaver=n6,i=eR("x,y,z,scale,scaleX,scaleY,xPercent,yPercent,"+(r="rotation,rotationX,rotationY,skewX,skewY")+",transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective",function(e){nI[e]=1}),eR(r,function(e){D.units[e]="deg",rS[e]=1}),nV[i[13]]="x,y,z,scale,scaleX,scaleY,xPercent,yPercent,"+r,eR("0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY",function(e){var t=e.split(":");nV[t[1]]=i[t[0]]}),eR("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(e){D.units[e]="px"}),nC.registerPlugin(rU);var rI=nC.registerPlugin(rU)||nC;rI.core.Tween,e.s(["default",0,rI],32919)},34034,7183,e=>{"use strict";var t=e.i(92454);function n(){let e=null,t=!1,n=null,r=null;function i(t,a){r=e.requestAnimationFrame(i),n(t,a)}return{start:function(){!0===t||null===n||null!==e&&(r=e.requestAnimationFrame(i),t=!0)},stop:function(){null!==e&&e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function r(e){let t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);let r=t.get(n);r&&(e.deleteBuffer(r.buffer),t.delete(n))},update:function(n,r){if(n.isInterleavedBufferAttribute&&(n=n.data),n.isGLBufferAttribute){let e=t.get(n);
1(!e||e.version<n.version)&&t.set(n,{buffer:n.buffer,type:n.type,bytesPerElement:n.elementSize,version:n.version});return}let i=t.get(n);if(void 0===i)t.set(n,function(t,n){let r,i=t.array,a=t.usage,o=i.byteLength,s=e.createBuffer();if(e.bindBuffer(n,s),e.bufferData(n,i,a),t.onUploadCallback(),i instanceof Float32Array)r=e.FLOAT;else if("u">typeof Float16Array&&i instanceof Float16Array)r=e.HALF_FLOAT;else if(i instanceof Uint16Array)r=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(i instanceof Int16Array)r=e.SHORT;else if(i instanceof Uint32Array)r=e.UNSIGNED_INT;else if(i instanceof Int32Array)r=e.INT;else if(i instanceof Int8Array)r=e.BYTE;else if(i instanceof Uint8Array)r=e.UNSIGNED_BYTE;else if(i instanceof Uint8ClampedArray)r=e.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+i);return{buffer:s,type:r,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version,size:o}}(n,r));else if(i.version<n.version){if(i.size!==n.array.byteLength)throw Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");!function(t,n,r){let i=n.array,a=n.updateRanges;if(e.bindBuffer(r,t),0===a.length)e.bufferSubData(r,0,i);else{a.sort((e,t)=>e.start-t.start);let t=0;for(let e=1;e<a.length;e++){let n=a[t],r=a[e];r.start<=n.start+n.count+1?n.count=Math.max(n.count,r.start+r.count-n.start):a[++t]=r}a.length=t+1;for(let t=0,n=a.length;t<n;t++){let n=a[t];e.bufferSubData(r,n.start*i.BYTES_PER_ELEMENT,i,n.start,n.count)}n.clearUpdateRanges()}n.onUploadCallback()}(i.buffer,n,r),i.version=n.version}}}}let i={alphahash_fragment:"#ifdef USE_ALPHAHASH\n	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n	const float ALPHA_HASH_SCALE = 0.05;\n	float hash2D( vec2 value ) {\n		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n	}\n	float hash3D( vec3 value ) {\n		return hash2D( vec2( hash2D( value.xy ), value.z ) );\n	}\n	float getAlphaHashThreshold( vec3 position ) {\n		float maxDeriv = max(\n			length( dFdx( position.xyz ) ),\n			length( dFdy( position.xyz ) )\n		);\n		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n		vec2 pixScales = vec2(\n			exp2( floor( log2( pixScale ) ) ),\n			exp2( ceil( log2( pixScale ) ) )\n		);\n		vec2 alpha = vec2(\n			hash3D( floor( pixScales.x * position.xyz ) ),\n			hash3D( floor( pixScales.y * position.xyz ) )\n		);\n		float lerpFactor = fract( log2( pixScale ) );\n		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n		float a = min( lerpFactor, 1.0 - lerpFactor );\n		vec3 cases = vec3(\n			x * x / ( 2.0 * a * ( 1.0 - a ) ),\n			( x - 0.5 * a ) / ( 1.0 - a ),\n			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n		);\n		float threshold = ( x < ( 1.0 - a ) )\n			? ( ( x < a ) ? cases.x : cases.y )\n			: cases.z;\n		return clamp( threshold , 1.0e-6, 1.0 );\n	}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n	uniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n	#ifdef ALPHA_TO_COVERAGE\n	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n	if ( diffuseColor.a == 0.0 ) discard;\n	#else\n	if ( diffuseColor.a < alphaTest ) discard;\n	#endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n	uniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n	reflectedLight.indirectDiffuse *= ambientOcclusion;\n	#if defined( USE_CLEARCOAT ) \n		clearcoatSpecularIndirect *= ambientOcclusion;\n	#endif\n	#if defined( USE_SHEEN ) \n		sheenSpecularIndirect *= ambientOcclusion;\n	#endif\n	#if defined( USE_ENVMAP ) && defined( STANDARD )\n		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n	#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n	uniform sampler2D aoMap;\n	uniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n	#if ! defined( GL_ANGLE_multi_draw )\n	#define gl_DrawID _gl_DrawID\n	uniform int _gl_DrawID;\n	#endif\n	uniform highp sampler2D batchingTexture;\n	uniform highp usampler2D batchingIdTexture;\n	mat4 getBatchingMatrix( const in float i ) {\n		int size = textureSize( batchingTexture, 0 ).x;\n		int j = int( i ) * 4;\n		int x = j % size;\n		int y = j / size;\n		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n		return mat4( v1, v2, v3, v4 );\n	}\n	float getIndirectIndex( const in int i ) {\n		int size = textureSize( batchingIdTexture, 0 ).x;\n		int x = i % size;\n		int y = i / size;\n		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n	}\n#endif\n#ifdef USE_BATCHING_COLOR\n	uniform sampler2D batchingColorTexture;\n	vec4 getBatchingColor( const in float i ) {\n		int size = textureSize( batchingColorTexture, 0 ).x;\n		int j = int( i );\n		int x = j % size;\n		int y = j / size;\n		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );\n	}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n	vPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n	vec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n	return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n	vec3 halfDir = normalize( lightDir + viewDir );
1\n	float dotNH = saturate( dot( normal, halfDir ) );\n	float dotVH = saturate( dot( viewDir, halfDir ) );\n	vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n	float G = G_BlinnPhong_Implicit( );\n	float D = D_BlinnPhong( shininess, dotNH );\n	return F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n	const mat3 XYZ_TO_REC709 = mat3(\n		 3.2404542, -0.9692660,  0.0556434,\n		-1.5371385,  1.8760108, -0.2040259,\n		-0.4985314,  0.0415560,  1.0572252\n	);\n	vec3 Fresnel0ToIor( vec3 fresnel0 ) {\n		vec3 sqrtF0 = sqrt( fresnel0 );\n		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n	}\n	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n	}\n	float IorToFresnel0( float transmittedIor, float incidentIor ) {\n		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n	}\n	vec3 evalSensitivity( float OPD, vec3 shift ) {\n		float phase = 2.0 * PI * OPD * 1.0e-9;\n		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n		xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n		xyz /= 1.0685e-7;\n		vec3 rgb = XYZ_TO_REC709 * xyz;\n		return rgb;\n	}\n	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n		vec3 I;\n		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n		float cosTheta2Sq = 1.0 - sinTheta2Sq;\n		if ( cosTheta2Sq < 0.0 ) {\n			return vec3( 1.0 );\n		}\n		float cosTheta2 = sqrt( cosTheta2Sq );\n		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
1\n		float T121 = 1.0 - R12;\n		float phi12 = 0.0;\n		if ( iridescenceIOR < outsideIOR ) phi12 = PI;\n		float phi21 = PI - phi12;\n		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n		vec3 phi23 = vec3( 0.0 );\n		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n		vec3 phi = vec3( phi21 ) + phi23;\n		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n		vec3 r123 = sqrt( R123 );\n		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n		vec3 C0 = R12 + Rs;\n		I = C0;\n		vec3 Cm = Rs - T121;\n		for ( int m = 1; m <= 2; ++ m ) {\n			Cm *= r123;\n			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n			I += Cm * Sm;\n		}\n		return max( I, vec3( 0.0 ) );\n	}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n	uniform sampler2D bumpMap;\n	uniform float bumpScale;\n	vec2 dHdxy_fwd() {\n		vec2 dSTdx = dFdx( vBumpMapUv );\n		vec2 dSTdy = dFdy( vBumpMapUv );\n		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n		return vec2( dBx, dBy );\n	}\n	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n		vec3 vN = surf_norm;\n		vec3 R1 = cross( vSigmaY, vN );\n		vec3 R2 = cross( vN, vSigmaX );\n		float fDet = dot( vSigmaX, R1 ) * faceDirection;\n		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n		return normalize( abs( fDet ) * surf_norm - vGrad );\n	}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n	vec4 plane;\n	#ifdef ALPHA_TO_COVERAGE\n		float distanceToPlane, distanceGradient;\n		float clipOpacity = 1.0;\n		#pragma unroll_loop_start\n		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n			plane = clippingPlanes[ i ];\n			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n			distanceGradient = fwidth( distanceToPlane ) / 2.0;\n			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n			if ( clipOpacity == 0.0 ) discard;\n		}\n		#pragma unroll_loop_end\n		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n			float unionClipOpacity = 1.0;\n			#pragma unroll_loop_start\n			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n				plane = clippingPlanes[ i ];\n				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n				distanceGradient = fwidth( distanceToPlane ) / 2.0;\n				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n			}\n			#pragma unroll_loop_end\n			clipOpacity *= 1.0 - unionClipOpacity;\n		#endif\n		diffuseColor.a *= clipOpacity;\n		if ( diffuseColor.a == 0.0 ) discard;\n	#else\n		#pragma unroll_loop_start\n		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n			plane = clippingPlanes[ i ];\n			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n		}\n		#pragma unroll_loop_end\n		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n			bool clipped = true;\n			#pragma unroll_loop_start\n			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n				plane = clippingPlanes[ i ];\n				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n			}\n			#pragma unroll_loop_end\n			if ( clipped ) discard;\n		#endif\n	#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n	varying vec3 vClipPosition;\n	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n	varying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n	vClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\n	diffuseColor *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\n	varying vec4 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n	varying vec4 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n	vColor = vec4( 1.0 );\n#endif\n#ifdef USE_COLOR_ALPHA\n	vColor *= color;\n#elif defined( USE_COLOR )\n	vColor.rgb *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n	vColor.rgb *= instanceColor.rgb;\n#endif\n#ifdef USE_BATCHING_COLOR\n	vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n	const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n	return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n	float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n	float precisionSafeLength( vec3 v ) {\n		float maxComponent = max3( abs( v ) );\n		return length( v / maxComponent ) * maxComponent;\n	}\n#endif\nstruct IncidentLight {\n	vec3 color;\n	vec3 direction;\n	bool visible;\n};\nstruct ReflectedLight {\n	vec3 directDiffuse;\n	vec3 directSpecular;\n	vec3 indirectDiffuse;\n	vec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n	varying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\n#define inverseTransformDirection transformDirectionByInverseViewMatrix\nvec3 transformNormalByInverseViewMatrix( in vec3 normal, in mat4 viewMatrix ) {\n	return normalize( ( vec4( normal, 0.0 ) * viewMatrix ).xyz );\n}\nvec3 transformDirectionByInverseViewMatrix( in vec3 dir, in mat4 viewMatrix ) {\n	return normalize( ( vec4( dir, 0.0 ) * viewMatrix ).xyz );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n	return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n	return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n	return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n	#define cubeUV_minMipLevel 4.0\n	#define cubeUV_minTileSize 16.0\n	float getFace( vec3 direction ) {\n		vec3 absDirection = abs( direction );\n		float face = - 1.0;\n		if ( absDirection.x > absDirection.z ) {\n			if ( absDirection.x > absDirection.y )\n				face = direction.x > 0.0 ? 0.0 : 3.0;\n			else\n				face = direction.y > 0.0 ? 1.0 : 4.0;\n		} else {\n			if ( absDirection.z > absDirection.y )\n				face = direction.z > 0.0 ? 2.0 : 5.0;\n			else\n				face = direction.y > 0.0 ? 1.0 : 4.0;\n		}\n		return face;\n	}\n	vec2 getUV( vec3 direction, float face ) {\n		vec2 uv;\n		if ( face == 0.0 ) {\n			uv = vec2( direction.z, direction.y ) / abs( direction.x );\n		} else if ( face == 1.0 ) {\n			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n		} else if ( face == 2.0 ) {\n			uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n		} else if ( face == 3.0 ) {\n			uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n		} else if ( face == 4.0 ) {\n			uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n		} else {\n			uv = vec2( direction.x, direction.y ) / abs( direction.z );\n		}\n		return 0.5 * ( uv + 1.0 );\n	}\n	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n		float face = getFace( direction );\n		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n		mipInt = max( mipInt, cubeUV_minMipLevel );\n		float faceSize = exp2( mipInt );\n		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n		if ( face > 2.0 ) {\n			uv.y += faceSize;\n			face -= 3.0;\n		}\n		uv.x += face * faceSize;\n		uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n		uv.x *= CUBEUV_TEXEL_WIDTH;\n		uv.y *= CUBEUV_TEXEL_HEIGHT;\n		#ifdef texture2DGradEXT\n			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n		#else\n			return texture2D( envMap, uv ).rgb;\n		#endif\n	}\n	#define cubeUV_r0 1.0\n	#define cubeUV_m0 - 2.0\n	#define cubeUV_r1 0.8\n	#define cubeUV_m1 - 1.0\n	#define cubeUV_r4 0.4\n	#define cubeUV_m4 2.0\n	#define cubeUV_r5 0.305\n	#define cubeUV_m5 3.0\n	#define cubeUV_r6 0.21\n	#define cubeUV_m6 4.0\n	float roughnessToMip( float roughness ) {\n		float mip = 0.0;\n		if ( roughness >= cubeUV_r1 ) {\n			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n		} else if ( roughness >= cubeUV_r4 ) {\n			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n		} else if ( roughness >= cubeUV_r5 ) {\n			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n		} else if ( roughness >= cubeUV_r6 ) {\n			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n		} else {\n			mip = - 2.0 * log2( 1.16 * roughness );		}\n		return mip;\n	}\n	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n		float mipF = fract( mip );\n		float mipInt = floor( mip );\n		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n		if ( mipF == 0.0 ) {\n			return vec4( color0, 1.0 );\n		} else {\n			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n			return vec4( mix( color0, color1, mipF ), 1.0 );\n		}\n	}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n	vec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n	mat3 bm = mat3( batchingMatrix );
1\n	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n	transformedNormal = bm * transformedNormal;\n	#ifdef USE_TANGENT\n		transformedTangent = bm * transformedTangent;\n	#endif\n#endif\n#ifdef USE_INSTANCING\n	mat3 im = mat3( instanceMatrix );\n	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n	transformedNormal = im * transformedNormal;\n	#ifdef USE_TANGENT\n		transformedTangent = im * transformedTangent;\n	#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n	transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n	uniform sampler2D displacementMap;\n	uniform float displacementScale;\n	uniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n		emissiveColor = sRGBTransferEOTF( emissiveColor );\n	#endif\n	totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n	uniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n	return value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n	return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n	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 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n	#ifdef ENV_WORLDPOS\n		vec3 cameraToFrag;\n		if ( isOrthographic ) {\n			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n		} else {\n			cameraToFrag = normalize( vWorldPosition - cameraPosition );\n		}\n		vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );\n		#ifdef ENVMAP_MODE_REFLECTION\n			vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n		#else\n			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n		#endif\n	#else\n		vec3 reflectVec = vReflect;\n	#endif\n	#ifdef ENVMAP_TYPE_CUBE\n		vec4 envColor = textureCube( envMap, envMapRotation * reflectVec );\n		#ifdef ENVMAP_BLENDING_MULTIPLY\n			outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n		#elif defined( ENVMAP_BLENDING_MIX )\n			outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n		#elif defined( ENVMAP_BLENDING_ADD )\n			outgoingLight += envColor.xyz * specularStrength * reflectivity;\n		#endif\n	#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n	uniform float envMapIntensity;\n	uniform mat3 envMapRotation;\n	#ifdef ENVMAP_TYPE_CUBE\n		uniform samplerCube envMap;\n	#else\n		uniform sampler2D envMap;\n	#endif\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n	uniform float reflectivity;\n	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n		#define ENV_WORLDPOS\n	#endif\n	#ifdef ENV_WORLDPOS\n		varying vec3 vWorldPosition;\n		uniform float refractionRatio;\n	#else\n		varying vec3 vReflect;\n	#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n		#define ENV_WORLDPOS\n	#endif\n	#ifdef ENV_WORLDPOS\n		\n		varying vec3 vWorldPosition;\n	#else\n		varying vec3 vReflect;\n		uniform float refractionRatio;\n	#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n	vec3 getIBLIrradiance( const in vec3 normal ) {\n		#ifdef ENVMAP_TYPE_CUBE_UV\n			vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );\n			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n			return PI * envMapColor.rgb * envMapIntensity;\n		#else\n			return vec3( 0.0 );\n		#endif\n	}\n	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n		#ifdef ENVMAP_TYPE_CUBE_UV\n			vec3 reflectVec = reflect( - viewDir, normal );
1\n			reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n			reflectVec = transformDirectionByInverseViewMatrix( reflectVec, viewMatrix );\n			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n			return envMapColor.rgb * envMapIntensity;\n		#else\n			return vec3( 0.0 );\n		#endif\n	}\n	#ifdef USE_RETROREFLECTION\n		vec3 getIBLRetroRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n			#ifdef ENVMAP_TYPE_CUBE_UV\n				vec3 retroVec = normalize( mix( viewDir, normal, pow4( roughness ) ) );\n				retroVec = transformDirectionByInverseViewMatrix( retroVec, viewMatrix );\n				vec4 envMapColor = textureCubeUV( envMap, envMapRotation * retroVec, roughness );\n				return envMapColor.rgb * envMapIntensity;\n			#else\n				return vec3( 0.0 );\n			#endif\n		}\n	#endif\n	#ifdef USE_ANISOTROPY\n		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n			#ifdef ENVMAP_TYPE_CUBE_UV\n				vec3 bentNormal = cross( bitangent, viewDir );\n				bentNormal = normalize( cross( bentNormal, bitangent ) );\n				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n				return getIBLRadiance( viewDir, bentNormal, roughness );\n			#else\n				return vec3( 0.0 );\n			#endif\n		}\n		#ifdef USE_RETROREFLECTION\n			vec3 getIBLAnisotropyRetroRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n				#ifdef ENVMAP_TYPE_CUBE_UV\n					vec3 bentNormal = cross( bitangent, viewDir );\n					bentNormal = normalize( cross( bentNormal, bitangent ) );\n					bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n					return getIBLRetroRadiance( viewDir, bentNormal, roughness );\n				#else\n					return vec3( 0.0 );\n				#endif\n			}\n		#endif\n	#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n	#ifdef ENV_WORLDPOS\n		vWorldPosition = worldPosition.xyz;\n	#else\n		vec3 cameraToVertex;\n		if ( isOrthographic ) {\n			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n		}
1 else {\n			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n		}\n		vec3 worldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );\n		#ifdef ENVMAP_MODE_REFLECTION\n			vReflect = reflect( cameraToVertex, worldNormal );\n		#else\n			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n		#endif\n	#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n	vFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n	varying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n	#ifdef FOG_EXP2\n		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n	#else\n		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n	#endif\n	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n	uniform vec3 fogColor;\n	varying float vFogDepth;\n	#ifdef FOG_EXP2\n		uniform float fogDensity;\n	#else\n		uniform float fogNear;\n		uniform float fogFar;\n	#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n	uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n	float dotNL = dot( normal, lightDirection );\n	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n	#ifdef USE_GRADIENTMAP\n		return vec3( texture2D( gradientMap, coord ).r );\n	#else\n		vec2 fw = fwidth( coord ) * 0.5;\n		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n	#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n	uniform sampler2D lightMap;\n	uniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n	vec3 diffuseColor;\n	float specularStrength;\n};\nvoid 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 ) {\n	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n	vec3 irradiance = dotNL * directLight.color;\n	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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 ) {\n	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct				RE_Direct_Lambert\n#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n	uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n	float x = normal.x, y = normal.y, z = normal.z;\n	vec3 result = shCoefficients[ 0 ] * 0.886227;\n	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n	return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n	vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );\n	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n	return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n	vec3 irradiance = ambientLightColor;\n	return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n	if ( cutoffDistance > 0.0 ) {\n		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n	}\n	return distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n	return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_SUN_LIGHTS > 0\n	struct SunLight {\n		vec3 direction;\n		vec3 color;\n	};\n	uniform SunLight sunLights[ NUM_SUN_LIGHTS ];\n	void getSunLightInfo( const in SunLight sunLight, out IncidentLight light ) {\n		light.color = sunLight.color;\n		light.direction = sunLight.direction;\n		light.visible = true;\n	}\n#endif\n#if NUM_DIR_LIGHTS > 0\n	struct DirectionalLight {\n		vec3 direction;\n		vec3 color;\n	};\n	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n		light.color = directionalLight.color;\n		light.direction = directionalLight.direction;\n		light.visible = true;\n	}\n#endif\n#if NUM_POINT_LIGHTS > 0\n	struct PointLight {\n		vec3 position;\n		vec3 color;\n		float distance;\n		float decay;\n	};\n	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n		vec3 lVector = pointLight.position - geometryPosition;\n		light.direction = normalize( lVector );\n		float lightDistance = length( lVector );\n		light.color = pointLight.color;\n		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n		light.visible = ( light.color != vec3( 0.0 ) );\n	}
1\n#endif\n#if NUM_SPOT_LIGHTS > 0\n	struct SpotLight {\n		vec3 position;\n		vec3 direction;\n		vec3 color;\n		float distance;\n		float decay;\n		float coneCos;\n		float penumbraCos;\n	};\n	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n		vec3 lVector = spotLight.position - geometryPosition;\n		light.direction = normalize( lVector );\n		float angleCos = dot( light.direction, spotLight.direction );\n		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n		if ( spotAttenuation > 0.0 ) {\n			float lightDistance = length( lVector );\n			light.color = spotLight.color * spotAttenuation;\n			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n			light.visible = ( light.color != vec3( 0.0 ) );\n		} else {\n			light.color = vec3( 0.0 );\n			light.visible = false;\n		}\n	}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n	struct RectAreaLight {\n		vec3 color;\n		vec3 position;\n		vec3 halfWidth;\n		vec3 halfHeight;\n	};\n	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;\n	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n	struct HemisphereLight {\n		vec3 direction;\n		vec3 skyColor;\n		vec3 groundColor;\n	};\n	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n		float dotNL = dot( normal, hemiLight.direction );\n		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n		return irradiance;\n	}\n#endif\n#include <lightprobes_pars_fragment>",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n	vec3 diffuseColor;\n};\nvoid 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 ) {\n	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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 ) {\n	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct				RE_Direct_Toon\n#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n	vec3 diffuseColor;\n	vec3 specularColor;\n	float specularShininess;\n	float specularStrength;\n};\nvoid 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 ) {\n	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n	vec3 irradiance = dotNL * directLight.color;\n	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid 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 ) {\n	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct				RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.metalness = metalnessFactor;\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n	material.ior = ior;\n	#ifdef USE_SPECULAR\n		float specularIntensityFactor = specularIntensity;\n		vec3 specularColorFactor = specularColor;\n		#ifdef USE_SPECULAR_COLORMAP\n			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n		#endif\n		#ifdef USE_SPECULAR_INTENSITYMAP\n			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n		#endif\n		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n	#else\n		float specularIntensityFactor = 1.0;\n		vec3 specularColorFactor = vec3( 1.0 );\n		material.specularF90 = 1.0;\n	#endif\n	material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\n	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n#else\n	material.specularColor = vec3( 0.04 );\n	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n	material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n	material.clearcoat = clearcoat;
1\n	material.clearcoatRoughness = clearcoatRoughness;\n	material.clearcoatF0 = vec3( 0.04 );\n	material.clearcoatF90 = 1.0;\n	#ifdef USE_CLEARCOATMAP\n		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n	#endif\n	#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n	#endif\n	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n	material.clearcoatRoughness += geometryRoughness;\n	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n	material.dispersion = dispersion;\n#endif\n#ifdef USE_RETROREFLECTION\n	material.retroreflectivity = retroreflectivity;\n#endif\n#ifdef USE_IRIDESCENCE\n	material.iridescence = iridescence;\n	material.iridescenceIOR = iridescenceIOR;\n	#ifdef USE_IRIDESCENCEMAP\n		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n	#endif\n	#ifdef USE_IRIDESCENCE_THICKNESSMAP\n		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n	#else\n		material.iridescenceThickness = iridescenceThicknessMaximum;\n	#endif\n#endif\n#ifdef USE_SHEEN\n	material.sheenColor = sheenColor;\n	#ifdef USE_SHEEN_COLORMAP\n		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n	#endif\n	material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );\n	#ifdef USE_SHEEN_ROUGHNESSMAP\n		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n	#endif\n#endif\n#ifdef USE_ANISOTROPY\n	#ifdef USE_ANISOTROPYMAP\n		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n	#else\n		vec2 anisotropyV = anisotropyVector;\n	#endif\n	material.anisotropy = length( anisotropyV );\n	if( material.anisotropy == 0.0 ) {\n		anisotropyV = vec2( 1.0, 0.0 );\n	} else {\n		anisotropyV /= material.anisotropy;\n		material.anisotropy = saturate( material.anisotropy );\n	}\n	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n	vec3 diffuseColor;\n	vec3 diffuseContribution;\n	vec3 specularColor;\n	vec3 specularColorBlended;\n	float roughness;\n	float metalness;\n	float specularF90;\n	float dispersion;\n	vec2 dfg;\n	vec3 multiScatteringCompensation;\n	#ifdef USE_RETROREFLECTION\n		float retroreflectivity;\n	#endif\n	#ifdef USE_CLEARCOAT\n		float clearcoat;\n		float clearcoatRoughness;\n		vec3 clearcoatF0;\n		float clearcoatF90;\n	#endif\n	#ifdef USE_IRIDESCENCE\n		float iridescence;\n		float iridescenceIOR;\n		float iridescenceThickness;\n		vec3 iridescenceFresnel;\n		vec3 iridescenceF0Dielectric;\n		vec3 iridescenceF0Metallic;\n	#endif\n	#ifdef USE_SHEEN\n		vec3 sheenColor;\n		float sheenRoughness;\n	#endif\n	#ifdef IOR\n		float ior;\n	#endif\n	#ifdef USE_TRANSMISSION\n		float transmission;\n		float transmissionAlpha;\n		float thickness;\n		float attenuationDistance;\n		vec3 attenuationColor;\n	#endif\n	#ifdef USE_ANISOTROPY\n		float anisotropy;\n		float alphaT;\n		vec3 anisotropyT;\n		vec3 anisotropyB;\n	#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n    float x2 = x * x;\n    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n	float a2 = pow2( alpha );\n	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n	return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n	float a2 = pow2( alpha );\n	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n	return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n	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 ) {\n		float gv = dotNL * length( vec3( alphaT * dotTV, alph
1aB * dotBV, dotNV ) );\n		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n		return 0.5 / max( gv + gl, EPSILON );\n	}\n	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n		float a2 = alphaT * alphaB;\n		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n		highp float v2 = dot( v, v );\n		float w2 = a2 / v2;\n		return RECIPROCAL_PI * a2 * pow2 ( w2 );\n	}\n#endif\n#ifdef USE_CLEARCOAT\n	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n		vec3 f0 = material.clearcoatF0;\n		float f90 = material.clearcoatF90;\n		float roughness = material.clearcoatRoughness;\n		float alpha = pow2( roughness );\n		vec3 halfDir = normalize( lightDir + viewDir );\n		float dotNL = saturate( dot( normal, lightDir ) );\n		float dotNV = saturate( dot( normal, viewDir ) );\n		float dotNH = saturate( dot( normal, halfDir ) );\n		float dotVH = saturate( dot( viewDir, halfDir ) );\n		vec3 F = F_Schlick( f0, f90, dotVH );\n		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n		float D = D_GGX( alpha, dotNH );\n		return F * ( V * D );\n	}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n	vec3 f0 = material.specularColorBlended;\n	float f90 = material.specularF90;\n	float roughness = material.roughness;\n	float alpha = pow2( roughness );\n	vec3 halfDir = normalize( lightDir + viewDir );\n	float dotNL = saturate( dot( normal, lightDir ) );\n	float dotNV = saturate( dot( normal, viewDir ) );\n	float dotNH = saturate( dot( normal, halfDir ) );\n	float dotVH = saturate( dot( viewDir, halfDir ) );\n	vec3 F = F_Schlick( f0, f90, dotVH );\n	#ifdef USE_IRIDESCENCE\n		F = mix( F, material.iridescenceFresnel, material.iridescence );\n	#endif\n	#ifdef USE_ANISOTROPY\n		float dotTL = dot( material.anisotropyT, lightDir );\n		float dotTV = dot( material.anisotropyT, viewDir );\n		float dotTH = dot( material.anisotropyT, halfDir );\n		float dotBL = dot( material.anisotropyB, lightDir );\n		float dotBV = dot( material.anisotropyB, viewDir );\n		float dotBH = dot( material.anisotropyB, halfDir );\n		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n	#else\n		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n		float D = D_GGX( alpha, dotNH );\n	#endif\n	return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n	const float LUT_SIZE = 64.0;\n	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n	const float LUT_BIAS = 0.5 / LUT_SIZE;\n	float dotNV = saturate( dot( N, V ) );\n	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n	uv = uv * LUT_SCALE + LUT_BIAS;\n	return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n	float l = length( f );\n	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n	float x = dot( v1, v2 );\n	float y = abs( x );\n	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n	float b = 3.4175940 + ( 4.1616724 + y ) * y;\n	float v = a / b;\n	float theta_sintheta = ( x >
1 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n	return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n	vec3 lightNormal = cross( v1, v2 );\n	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n	vec3 T1, T2;\n	T1 = normalize( V - N * dot( V, N ) );\n	T2 = - cross( N, T1 );\n	mat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n	vec3 coords[ 4 ];\n	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n	coords[ 0 ] = normalize( coords[ 0 ] );\n	coords[ 1 ] = normalize( coords[ 1 ] );\n	coords[ 2 ] = normalize( coords[ 2 ] );\n	coords[ 3 ] = normalize( coords[ 3 ] );\n	vec3 vectorFormFactor = vec3( 0.0 );\n	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n	return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n	float alpha = pow2( roughness );\n	float invAlpha = 1.0 / alpha;\n	float cos2h = dotNH * dotNH;\n	float sin2h = max( 1.0 - cos2h, 0.0078125 );\n	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n	vec3 halfDir = normalize( lightDir + viewDir );\n	float dotNL = saturate( dot( normal, lightDir ) );\n	float dotNV = saturate( dot( normal, viewDir ) );\n	float dotNH = saturate( dot( normal, halfDir ) );\n	float D = D_Charlie( sheenRoughness, dotNH );\n	float V = V_Neubelt( dotNV, dotNL );\n	return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n	float dotNV = saturate( dot( normal, viewDir ) );\n	float r2 = roughness * roughness;\n	float rInv = 1.0 / ( roughness + 0.1 );\n	float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n	float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n	float DG = exp( a * dotNV + b );\n	return saturate( DG );\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n	float dotNV = saturate( dot( normal, viewDir ) );\n	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n	return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec2 fab, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec2 fab, const in vec3 specularColor, const in float specularF90, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n	#ifdef USE_IRIDESCENCE\n		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n	#else\n		vec3 Fr = specularColor;\n	#endif\n	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n	float Ess = fab.x + fab.y;\n	float Ems = 1.0 - Ess;\n	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n	singleScatter += FssEss;\n	multiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n	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 ) {\n		vec3 normal = geometryNormal;\n		vec3 viewDir = geometryViewDir;\n		vec3 position = geometryPosition;
1\n		vec3 lightPos = rectAreaLight.position;\n		vec3 halfWidth = rectAreaLight.halfWidth;\n		vec3 halfHeight = rectAreaLight.halfHeight;\n		vec3 lightColor = rectAreaLight.color;\n		float roughness = material.roughness;\n		vec3 rectCoords[ 4 ];\n		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n		vec2 uv = LTC_Uv( normal, viewDir, roughness );\n		vec4 t1 = texture2D( ltc_1, uv );\n		vec4 t2 = texture2D( ltc_2, uv );\n		mat3 mInv = mat3(\n			vec3( t1.x, 0, t1.y ),\n			vec3(    0, 1,    0 ),\n			vec3( t1.z, 0, t1.w )\n		);\n		vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );\n		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n		reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n		#ifdef USE_CLEARCOAT\n			vec3 Ncc = geometryClearcoatNormal;\n			vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );\n			vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );\n			vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );\n			mat3 mInvClearcoat = mat3(\n				vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),\n				vec3(             0, 1,             0 ),\n				vec3( t1Clearcoat.z, 0, t1Clearcoat.w )\n			);\n			vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;\n			clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );\n		#endif\n	}\n#endif\nvoid 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 ) {\n	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n	vec3 irradiance = dotNL * directLight.color;\n	#ifdef USE_CLEARCOAT\n		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n		vec3 ccIrradiance = dotNLcc * directLight.color;\n		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n	#endif\n	#ifdef USE_SHEEN\n \n 		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n 		float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n 		float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n 		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n 		irradiance *= sheenEnergyComp;\n \n 	#endif\n	vec3 specularBRDF = BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n	#ifdef USE_RETROREFLECTION\n		vec3 retroViewDir = reflect( - geometryViewDir, geometryNormal );\n		vec3 retroSpecularBRDF = BRDF_GGX( directLight.direction, retroViewDir, geometryNormal, material );\n		specularBRDF = mix( specularBRDF, retroSpecularBRDF, saturate( material.retroreflectivity ) );\n	#endif\n	reflectedLight.directSpecular += irradiance * specularBRDF * material.multiScatteringCompensation;\n	vec3 halfDir = normalize( directLight.direction + geometryViewDir );\n	float dotVH = saturate( dot( geometryViewDir, halfDir ) );\n	vec3 F = F_Schlick( material.specularColor, material.specularF90, dotVH );\n	#ifdef USE_RETROREFLECTION\n		vec3 retroHalfDir = normalize( directLight.direction + retroViewDir );\n		float dotRetroVH = saturate( dot( retroViewDir, retroHalfDir ) );\n		vec3 retroF = F_Schlick( material.specularColor, material.specularF90, dotRetroVH );\n		F = mix( F, retroF, saturate( material.retroreflectivity ) );\n	#endif\n	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - F );\n}\nvoid 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 ) {\n	vec3 singleScattering = vec3( 0.0 );\n	vec3 multiScattering = vec3( 0.0 );
1\n	#ifdef USE_IRIDESCENCE\n		computeMultiscatteringIridescence( material.dfg, material.specularColor, material.specularF90, material.iridescence, material.iridescenceF0Dielectric, singleScattering, multiScattering );\n	#else\n		computeMultiscattering( material.dfg, material.specularColor, material.specularF90, singleScattering, multiScattering );\n	#endif\n	vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - singleScattering - multiScattering );\n	#ifdef USE_SHEEN\n		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n		sheenSpecularIndirect += irradiance * material.sheenColor * sheenAlbedo * RECIPROCAL_PI;\n		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n		diffuse *= sheenEnergyComp;\n	#endif\n	reflectedLight.indirectDiffuse += diffuse;\n}\nvoid 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) {\n	#ifdef USE_CLEARCOAT\n		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n	#endif\n	#ifdef USE_SHEEN\n		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\n 	#endif\n	vec3 singleScatteringDielectric = vec3( 0.0 );\n	vec3 multiScatteringDielectric = vec3( 0.0 );\n	vec3 singleScatteringMetallic = vec3( 0.0 );\n	vec3 multiScatteringMetallic = vec3( 0.0 );\n	#ifdef USE_IRIDESCENCE\n		computeMultiscatteringIridescence( material.dfg, material.specularColor, material.specularF90, material.iridescence, material.iridescenceF0Dielectric, singleScatteringDielectric, multiScatteringDielectric );\n		computeMultiscatteringIridescence( material.dfg, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceF0Metallic, singleScatteringMetallic, multiScatteringMetallic );\n	#else\n		computeMultiscattering( material.dfg, material.specularColor, material.specularF90, singleScatteringDielectric, multiScatteringDielectric );\n		computeMultiscattering( material.dfg, material.diffuseColor, material.specularF90, singleScatteringMetallic, multiScatteringMetallic );\n	#endif\n	vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n	vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n	vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n	vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n	vec3 indirectSpecular = radiance * singleScattering;\n	indirectSpecular += multiScattering * cosineWeightedIrradiance;\n	vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n	#ifdef USE_SHEEN\n		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n		indirectSpecular *= sheenEnergyComp;\n		indirectDiffuse *= sheenEnergyComp;\n	#endif\n	reflectedLight.indirectSpecular += indirectSpecular;\n	reflectedLight.indirectDiffuse += indirectDiffuse;\n}\n#define RE_Direct				RE_Direct_Physical\n#define RE_Direct_RectArea		RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular		RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n	geometryClearcoatNormal = clearcoatNormal;
1\n#endif\n#ifdef USE_IRIDESCENCE\n	float dotNVi = saturate( dot( normal, geometryViewDir ) );\n	if ( material.iridescenceThickness == 0.0 ) {\n		material.iridescence = 0.0;\n	} else {\n		material.iridescence = saturate( material.iridescence );\n	}\n	if ( material.iridescence > 0.0 ) {\n		vec3 iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n		vec3 iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n		material.iridescenceFresnel = mix( iridescenceFresnelDielectric, iridescenceFresnelMetallic, material.metalness );\n		material.iridescenceF0Dielectric = Schlick_to_F0( iridescenceFresnelDielectric, 1.0, dotNVi );\n		material.iridescenceF0Metallic = Schlick_to_F0( iridescenceFresnelMetallic, 1.0, dotNVi );\n	}\n#endif\n#ifdef STANDARD\n	float dotNVms = saturate( dot( geometryNormal, geometryViewDir ) );\n	material.dfg = texture2D( dfgLUT, vec2( material.roughness, dotNVms ) ).rg;\n	#if ( NUM_SUN_LIGHTS > 0 || NUM_DIR_LIGHTS > 0 || NUM_POINT_LIGHTS > 0 || NUM_SPOT_LIGHTS > 0 )\n		float EssMs = material.dfg.x + material.dfg.y;\n		material.multiScatteringCompensation = 1.0 + material.specularColorBlended * ( 1.0 / EssMs - 1.0 );\n	#endif\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n	PointLight pointLight;\n	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n	PointLightShadow pointLightShadow;\n	#endif\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n		pointLight = pointLights[ i ];\n		getPointLightInfo( pointLight, geometryPosition, directLight );\n		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n		pointLightShadow = pointLightShadows[ i ];\n		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n		#endif\n		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n	}\n	#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n	SpotLight spotLight;\n	vec4 spotColor;\n	vec3 spotLightCoord;\n	bool inSpotLightMap;\n	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n	SpotLightShadow spotLightShadow;\n	#endif\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n		spotLight = spotLights[ i ];\n		getSpotLightInfo( spotLight, geometryPosition, directLight );\n		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n		#else\n		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n		#endif\n		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n		#endif\n		#undef SPOT_LIGHT_MAP_INDEX\n		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n		spotLightShadow = spotLightShadows[ i ];\n		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n		#endif\n		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n	}\n	#pragma unroll_loop_end\n#endif\n#if ( NUM_SUN_LIGHTS > 0 ) && defined( RE_Direct )\n	SunLight sunLight;\n	#if defined( USE_SHADOWMAP ) && NUM_SUN_LIGHT_SHADOWS > 0\n	SunLightShadow sunLightShadow;\n	#endif\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_SUN_LIGHTS; i ++ ) {\n		sunLight = sunLights[ i ];\n		getSunLightInfo( sunLight, directLight );\n		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SUN_LIGHT_SHADOWS )\n		sunLightShadow = sunLightShadows[ i ];\n		directLight.color *= ( directLight.visible && receiveShadow ) ? getSunShadow( sunShadowMap[ i ], sunLightShadow, UNROLLED_LOOP_INDEX ) : 1.0;\n		#endif\n		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n	}\n	#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n	DirectionalLight directionalLight;\n	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n	DirectionalLightShadow directionalLightShadow;\n	#endif\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n		directionalLight = directionalLights[ i ];\n		getDirectionalLightInfo( directionalLight, directLight );\n		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n		directionalLightShadow = directionalLightShadows[ i ];\n		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n		#endif\n		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n	}\n	#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n	RectAreaLight rectAreaLight;\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n		rectAreaLight = rectAreaLights[ i ];\n		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n	}\n	#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n	vec3 iblIrradiance = vec3( 0.0 );\n	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n	#if defined( USE_LIGHT_PROBES )\n		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n	#endif\n	#if ( NUM_HEMI_LIGHTS > 0 )\n		#pragma unroll_loop_start\n		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n		}\n		#pragma unroll_loop_end\n	#endif\n	#ifdef USE_LIGHT_PROBES_GRID\n		vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;\n		vec3 probeWorldNormal = transformNormalByInverseViewMatrix( geometryNormal, viewMatrix );\n		irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );\n	#endif\n#endif\n#if defined( RE_IndirectSpecular )\n	vec3 radiance = vec3( 0.0 );\n	vec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n	#ifdef USE_LIGHTMAP\n		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n		irradiance += lightMapIrradiance;\n	#endif\n	#if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )\n		#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )\n			iblIrradiance += getIBLIrradiance( geometryNormal );\n		#endif\n	#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n	#ifdef USE_ANISOTROPY\n		vec3 iblRadiance = getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n	#else\n		vec3 iblRadiance = getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n	#endif\n	#ifdef USE_RETROREFLECTION\n		#ifdef USE_ANISOTROPY\n			vec3 retroIBLRadiance = getIBLAnisotropyRetroRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n		#else\n			vec3 retroIBLRadiance = getIBLRetroRadiance( geometryViewDir, geometryNormal, material.roughness );\n		#endif\n		iblRadiance = mix( iblRadiance, retroIBLRadiance, saturate( material.retroreflectivity ) );\n	#endif\n	radiance += iblRadiance;\n	#ifdef USE_CLEARCOAT\n		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n	#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n	#if defined( LAMBERT ) || defined( PHONG )\n		irradiance += iblIrradiance;\n	#endif\n	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",lightprobes_pars_fragment:"#ifdef USE_LIGHT_PROBES_GRID\nuniform highp sampler3D probesSH;\nuniform vec3 probesMin;\nuniform vec3 probesMax;\nuniform vec3 probesResolution;\nvec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {\n	vec3 res = probesResolution;\n	vec3 gridRange = probesMax - probesMin;\n	vec3 resMinusOne = res - 1.0;\n	vec3 probeSpacing = gridRange / resMinusOne;\n	vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;\n	vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );\n	uvw = uvw * resMinusOne / res + 0.5 / res;\n	float nz          = res.z;\n	float paddedSlices = nz + 2.0;\n	float atlasDepth  = 7.0 * paddedSlices;\n	float uvZBase     = uvw.z * nz + 1.0;\n	vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase                       ) / atlasDepth ) );\n	vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase +       paddedSlices   ) / atlasDepth ) );\n	vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices   ) / atlasDepth ) );\n	vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices   ) / atlasDepth ) );\n	vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices   ) / atlasDepth ) );\n	vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices   ) / atlasDepth ) );\n	vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices   ) / atlasDepth ) );\n	vec3 c0 = s0.xyz;\n	vec3 c1 = vec3( s0.w, s1.xy );\n	vec3 c2 = vec3( s1.zw, s2.x );\n	vec3 c3 = s2.yzw;\n	vec3 c4 = s3.xyz;\n	vec3 c5 = vec3( s3.w, s4.xy );\n	vec3 c6 = vec3( s4.zw, s5.x );\n	vec3 c7 = s5.yzw;\n	vec3 c8 = s6.xyz;\n	float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;\n	vec3 result = c0 * 0.886227;\n	result += c1 * 2.0 * 0.511664 * y;\n	result += c2 * 2.0 * 0.511664 * z;\n	result += c3 * 2.0 * 0.511664 * x;\n	result += c4 * 2.0 * 0.429043 * x * y;\n	result += c5 * 2.0 * 0.429043 * y * z;\n	result += c6 * ( 0.743125 * z * z - 0.247708 );\n	result += c7 * 2.0 * 0.429043 * x * z;\n	result += c8 * 0.429043 * ( x * x - y * y );\n	return max( result, vec3( 0.0 ) );\n}\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n	uniform float logDepthBufFC;\n	varying float vFragDepth;\n	varying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n	varying float vFragDepth;\n	varying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n	vFragDepth = 1.0 + gl_Position.w;\n	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n	vec4 sampledDiffuseColor = texture2D( map, vMapUv );\n	#ifdef DECODE_VIDEO_TEXTURE\n		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n	#endif\n	diffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n	uniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n	#if defined( USE_POINTS_UV )\n		vec2 uv = vUv;\n	#else\n		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n	#endif\n#endif\n#ifdef USE_MAP\n	diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n	diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n	varying vec2 vUv;\n#else\n	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n		uniform mat3 uvTransform;\n	#endif\n#endif\n#ifdef USE_MAP\n	uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n	uniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n	metalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n	uniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n	float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n	}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n	vColor *= morphTargetBaseInfluence;\n	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n		#if defined( USE_COLOR_ALPHA )\n			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n		#elif defined( USE_COLOR )\n			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n		#endif\n	}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n	objectNormal *= morphTargetBaseInfluence;\n	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n	}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n	#ifndef USE_INSTANCING_MORPH\n		uniform float morphTargetBaseInfluence;\n		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n	#endif\n	uniform sampler2DArray morphTargetsTexture;\n	uniform ivec2 morphTargetsTextureSize;\n	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n		int y = texelIndex / morphTargetsTextureSize.x;\n		int x = texelIndex - y * morphTargetsTextureSize.x;\n		ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n		return texelFetch( morphTargetsTexture, morphUV, 0 );\n	}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n	transformed *= morphTargetBaseInfluence;\n	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n	}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n	vec3 fdx = dFdx( vViewPosition );\n	vec3 fdy = dFdy( vViewPosition );\n	vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n	vec3 normal = normalize( vNormal );\n	#ifdef DOUBLE_SIDED\n		normal *= faceDirection;\n	#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n	#ifdef USE_TANGENT\n		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n	#else\n		mat3 tbn = getTangentFrame( - vViewPosition, normal,\n		#if defined( USE_NORMALMAP )\n			vNormalMapUv\n		#elif defined( USE_CLEARCOAT_NORMALMAP )\n			vClearcoatNormalMapUv\n		#else\n			vUv\n		#endif\n		);\n	#endif\n	#ifdef DOUBLE_SIDED\n		tbn[0] *= faceDirection;\n		tbn[1] *= faceDirection;\n	#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n	#ifdef USE_TANGENT\n		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n	#else\n		mat3 tbn2 = getTangentFrame( - vViewPosition, normal,
1 vClearcoatNormalMapUv );\n	#endif\n	#ifdef DOUBLE_SIDED\n		tbn2[0] *= faceDirection;\n		tbn2[1] *= faceDirection;\n	#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n	#ifdef FLIP_SIDED\n		normal = - normal;\n	#endif\n	#ifdef DOUBLE_SIDED\n		normal = normal * faceDirection;\n	#endif\n	normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n	#if defined( USE_PACKED_NORMALMAP )\n		mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );\n	#endif\n	mapN.xy *= normalScale;\n	normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n	varying vec3 vNormal;\n	#ifdef USE_TANGENT\n		varying vec3 vTangent;\n		varying vec3 vBitangent;\n	#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n	varying vec3 vNormal;\n	#ifdef USE_TANGENT\n		varying vec3 vTangent;\n		varying vec3 vBitangent;\n	#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n	vNormal = normalize( transformedNormal );\n	#ifdef USE_TANGENT\n		vTangent = normalize( transformedTangent );\n		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n		#ifdef FLIP_SIDED\n			vBitangent = - vBitangent;\n		#endif\n	#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n	uniform sampler2D normalMap;\n	uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n	uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n		vec3 q0 = dFdx( eye_pos.xyz );\n		vec3 q1 = dFdy( eye_pos.xyz );\n		vec2 st0 = dFdx( uv.st );\n		vec2 st1 = dFdy( uv.st );\n		vec3 N = surf_norm;\n		vec3 q1perp = cross( q1, N );\n		vec3 q0perp = cross( N, q0 );\n		vec3 T = q1perp * st0.x + q0perp * st1.x;\n		vec3 B = q1perp * st0.y + q0perp * st1.y;\n		float det = max( dot( T, T ), dot( B, B ) );\n		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n		return mat3( T * scale, B * scale, N );\n	}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n	vec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n	clearcoatMapN.xy *= clearcoatNormalScale;\n	clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n	uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n	uniform sampler2D clearcoatNormalMap;\n	uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n	uniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n	uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n	uniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n	return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n	return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n	if( v <= 0.0 )\n		return vec4( 0., 0., 0., 0. );\n	if( v >= 1.0 )\n		return vec4( 1., 1., 1., 1. );\n	float vuf;\n	float af = modf( v * PackFactors.a, vuf );\n	float bf = modf( vuf * ShiftRight8, vuf );\n	float gf = modf( vuf * ShiftRight8, vuf );\n	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n	if( v <= 0.0 )\n		return vec3( 0., 0., 0. );\n	if( v >= 1.0 )\n		return vec3( 1., 1., 1. );\n	float vuf;\n	float bf = modf( v * PackFactors.b, vuf );\n	float gf = modf( vuf * ShiftRight8, vuf );\n	return vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n	if( v <= 0.0 )\n		return vec2( 0., 0. );\n	if( v >= 1.0 )\n		return vec2( 1., 1. );\n	float vuf;\n	float gf = modf( v * 256., vuf );\n	return vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n	return dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n	return dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n	vec4 r = vec4( v.x, fract( v.x * 25
15.0 ), v.y, fract( v.y * 255.0 ) );\n	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n	return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n	#ifdef USE_REVERSED_DEPTH_BUFFER\n	\n		return depth * ( far - near ) - far;\n	#else\n		return depth * ( near - far ) - near;\n	#endif\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n	\n	#ifdef USE_REVERSED_DEPTH_BUFFER\n		return ( near * far ) / ( ( near - far ) * depth - near );\n	#else\n		return ( near * far ) / ( ( far - near ) * depth - far );\n	#endif\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n	gl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n	mvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n	mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n	gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n	vec3 dithering( vec3 color ) {\n		float grid_position = rand( gl_FragCoord.xy );\n		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n		return color + dither_shift_RGB;\n	}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n	roughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n	uniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n	#if NUM_SUN_LIGHT_SHADOWS > 0\n		#define SUN_LIGHT_CASCADES 2\n		#if defined( SHADOWMAP_TYPE_PCF )\n			uniform sampler2DShadow sunShadowMap[ NUM_SUN_LIGHT_SHADOWS ];\n		#else\n			uniform sampler2D sunShadowMap[ NUM_SUN_LIGHT_SHADOWS ];\n		#endif\n		uniform mat4 sunShadowMatrix[ NUM_SUN_LIGHT_SHADOWS * SUN_LIGHT_CASCADES ];\n		uniform vec4 sunShadowCascade[ NUM_SUN_LIGHT_SHADOWS * SUN_LIGHT_CASCADES ];\n		varying vec4 vSunShadowWorldPosition;\n		varying vec3 vSunShadowWorldNormal;\n		struct SunLightShadow {\n			float shadowIntensity;\n			float shadowBias;\n			float shadowNormalBias;\n			float shadowRadius;\n			vec2 shadowMapSize;\n		};\n		uniform SunLightShadow sunLightShadows[ NUM_SUN_LIGHT_SHADOWS ];\n	#endif\n	#if NUM_DIR_LIGHT_SHADOWS > 0\n		#if defined( SHADOWMAP_TYPE_PCF )\n			uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n		#else\n			uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n		#endif\n		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n		struct DirectionalLightShadow {\n			float shadowIntensity;\n			float shadowBias;\n			float shadowNormalBias;\n			float shadowRadius;\n			vec2 shadowMapSize;\n		};\n		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n	#endif\n	#if NUM_SPOT_LIGHT_SHADOWS > 0\n		#if defined( SHADOWMAP_TYPE_PCF )\n			uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n		#else\n			uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n		#endif\n		struct SpotLightShadow {\n			float shadowIntensity;\n			float shadowBias;\n			float shadowNormalBias;\n			float shadowRadius;\n			vec2 shadowMapSize;\n		};
1\n		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n	#endif\n	#if NUM_POINT_LIGHT_SHADOWS > 0\n		#if defined( SHADOWMAP_TYPE_PCF )\n			uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n		#elif defined( SHADOWMAP_TYPE_BASIC )\n			uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n		#endif\n		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n		struct PointLightShadow {\n			float shadowIntensity;\n			float shadowBias;\n			float shadowNormalBias;\n			float shadowRadius;\n			vec2 shadowMapSize;\n			float shadowCameraNear;\n			float shadowCameraFar;\n		};\n		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n	#endif\n	#if defined( SHADOWMAP_TYPE_PCF )\n		float interleavedGradientNoise( vec2 position ) {\n			return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );\n		}\n		vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\n			const float goldenAngle = 2.399963229728653;\n			float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\n			float theta = float( sampleIndex ) * goldenAngle + phi;\n			return vec2( cos( theta ), sin( theta ) ) * r;\n		}\n	#endif\n	#if defined( SHADOWMAP_TYPE_PCF )\n		float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n			float shadow = 1.0;\n			shadowCoord.xyz /= shadowCoord.w;\n			shadowCoord.z += shadowBias;\n			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n			if ( frustumTest ) {\n				vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n				float radius = shadowRadius * texelSize.x;\n				float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n				shadow = (\n					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\n					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\n					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\n					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\n					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\n				) * 0.2;\n			}\n			return mix( 1.0, shadow, shadowIntensity );\n		}\n	#elif defined( SHADOWMAP_TYPE_VSM )\n		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n			float shadow = 1.0;\n			shadowCoord.xyz /= shadowCoord.w;\n			#ifdef USE_REVERSED_DEPTH_BUFFER\n				shadowCoord.z -= shadowBias;\n			#else\n				shadowCoord.z += shadowBias;\n			#endif\n			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n			if ( frustumTest ) {\n				vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\n				float mean = distribution.x;\n				float variance = distribution.y * distribution.y;\n				#ifdef USE_REVERSED_DEPTH_BUFFER\n					float hard_shadow = step( mean, shadowCoord.z );\n				#else\n					float hard_shadow = step( shadowCoord.z, mean );\n				#endif\n				\n				if ( hard_shadow == 1.0 ) {\n					shadow = 1.0;\n				} else {\n					variance = max( variance, 0.0000001 );\n					float d = shadowCoord.z - mean;\n					float p_max = variance / ( variance + d * d );\n					p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\n					shadow = max( hard_shadow, p_max );\n				}\n			}\n			return mix( 1.0, shadow, shadowIntensity );\n		}\n	#else\n		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n			float shadow = 1.0;\n			shadowCoord.xyz /= shadowCoord.w;\n			#ifdef USE_REVERSED_DEPTH_BUFFER\n				shadowCoord.z -= shadowBias;\n			#else\n				shadowCoord.z += shadowBias;\n			#endif\n			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n			if ( frustumTest ) {\n				float depth = texture2D( shadowMap, shadowCoord.xy ).r;\n				#ifdef USE_REVERSED_DEPTH_BUFFER\n					shadow = step( depth, shadowCoord.z );\n				#else\n					shadow = step( shadowCoord.z, depth );\n				#endif\n			}\n			return mix( 1.0, shadow, shadowIntensity );\n		}\n	#endif\n	#if NUM_SUN_LIGHT_SHADOWS > 0\n		float getSunShadow(\n			#if defined( SHADOWMAP_TYPE_PCF )\n				sampler2DShadow shadowMap,\n			#else\n				sampler2D shadowMap,\n			#endif\n			SunLightShadow sunLightShadow,\n			int shadowIndex\n		) {\n			vec4 shadowWorldPosition = vec4( vSunShadowWorldPosition.xyz + vSunShadowWorldNormal * sunLightShadow.shadowNormalBias, 1.0 );\n			float viewDepth = vSunShadowWorldPosition.w;\n			int cascadeOffset = shadowIndex * SUN_LIGHT_CASCADES;\n			float shadow = 1.0;\n			for ( int i = SUN_LIGHT_CASCADES - 1; i >= 0; i -- ) {\n				vec4 cascade = sunShadowCascade[ cascadeOffset + i ];\n				if ( viewDepth >= cascade.x && viewDepth < cascade.y ) {\n					float cascadeShadow = getShadow(\n						shadowMap,\n						sunLightShadow.shadowMapSize,\n						sunLightShadow.shadowIntensity,\n						sunLightShadow.shadowBias,\n						sunLightShadow.shadowRadius,\n						sunShadowMatrix[ cascadeOffset + i ] * shadowWorldPosition\n					);\n					shadow = mix( cascadeShadow, shadow, smoothstep( cascade.z, cascade.y, viewDepth ) );\n				}\n			}\n			return shadow;\n		}\n	#endif\n	#if NUM_POINT_LIGHT_SHADOWS > 0\n	#if defined( SHADOWMAP_TYPE_PCF )\n	float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n		float shadow = 1.0;\n		vec3 lightToPosition = shadowCoord.xyz;\n		vec3 bd3D = normalize( lightToPosition );\n		vec3 absVec = abs( lightToPosition );\n		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n			#ifdef USE_REVERSED_DEPTH_BUFFER\n				float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1\n				dp -= shadowBias;\n			#else\n				float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n				dp += shadowBias;\n			#endif\n			float texelSize = shadowRadius / shadowMapSize.x;\n			vec3 absDir = abs( bd3D );\n			vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\n			tangent = normalize( cross( bd3D, tangent ) );\n			vec3 bitangent = cross( bd3D, tangent );\n			float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n			vec2 sample0 = vogelDiskSample( 0, 5, phi );\n			vec2 sample1 = vogelDiskSample( 1, 5, phi );\n			vec2 sample2 = vogelDiskSample( 2, 5, phi );\n			vec2 sample3 = vogelDiskSample( 3, 5, phi );\n			vec2 sample4 = vogelDiskSample( 4, 5, phi );\n			shadow = (\n				texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +\n				texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +\n				texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +\n				texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +\n				texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )\n			) * 0.2;\n		}\n		return mix( 1.0, shadow, shadowIntensity );\n	}\n	#elif defined( SHADOWMAP_TYPE_BASIC )\n	float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n		float shadow = 1.0;\n		vec3 lightToPosition = shadowCoord.xyz;\n		vec3 absVec = abs( lightToPosition );\n		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n			float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n			dp += shadowBias;\n			vec3 bd3D = normalize( lightToPosition );\n			float depth = textureCube( shadowMap, bd3D ).r;\n			#ifdef USE_REVERSED_DEPTH_BUFFER\n				depth = 1.0 - depth;\n			#endif\n			shadow = step( dp, depth );\n		}\n		return mix( 1.0, shadow, shadowIntensity );\n	}\n	#endif\n	#endif\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n	#if NUM_SUN_LIGHT_SHADOWS > 0\n		varying vec4 vSunShadowWorldPosition;\n		varying vec3 vSunShadowWorldNormal;\n	#endif\n	#if NUM_DIR_LIGHT_SHADOWS > 0\n		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n		struct DirectionalLightShadow {\n			float shadowIntensity;\n			float shadowBias;\n			float shadowNormalBias;\n			float shadowRadius;\n			vec2 shadowMapSize;\n		};\n		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n	#endif\n	#if NUM_SPOT_LIGHT_SHADOWS > 0\n		struct SpotLightShadow {\n			float shadowIntensity;\n			float shadowBias;\n			float shadowNormalBias;\n			float shadowRadius;\n			vec2 shadowMapSize;\n		};\n		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n	#endif\n	#if NUM_POINT_LIGHT_SHADOWS > 0\n		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n		struct PointLightShadow {\n			float shadowIntensity;\n			float shadowBias;\n			float shadowNormalBias;\n			float shadowRadius;\n			vec2 shadowMapSize;\n			float shadowCameraNear;\n			float shadowCameraFar;\n		};\n		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n	#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SUN_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n	#ifdef HAS_NORMAL\n		vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );\n	#else\n		vec3 shadowWorldNormal = vec3( 0.0 );\n	#endif\n	vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n	#if NUM_SUN_LIGHT_SHADOWS > 0\n		vSunShadowWorldPosition = vec4( worldPosition.xyz, - mvPosition.z );\n		vSunShadowWorldNormal = shadowWorldNormal;\n	#endif\n	#if NUM_DIR_LIGHT_SHADOWS > 0\n		#pragma unroll_loop_start\n		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n		}\n		#pragma unroll_loop_end\n	#endif\n	#if NUM_POINT_LIGHT_SHADOWS > 0\n		#pragma unroll_loop_start\n		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n		}
1\n		#pragma unroll_loop_end\n	#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n		shadowWorldPosition = worldPosition;\n		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n		#endif\n		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n	}\n	#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n	float shadow = 1.0;\n	#ifdef USE_SHADOWMAP\n	#if NUM_SUN_LIGHT_SHADOWS > 0\n	SunLightShadow sunLight;\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_SUN_LIGHT_SHADOWS; i ++ ) {\n		sunLight = sunLightShadows[ i ];\n		shadow *= receiveShadow ? getSunShadow( sunShadowMap[ i ], sunLight, UNROLLED_LOOP_INDEX ) : 1.0;\n	}\n	#pragma unroll_loop_end\n	#endif\n	#if NUM_DIR_LIGHT_SHADOWS > 0\n	DirectionalLightShadow directionalLight;\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n		directionalLight = directionalLightShadows[ i ];\n		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n	}\n	#pragma unroll_loop_end\n	#endif\n	#if NUM_SPOT_LIGHT_SHADOWS > 0\n	SpotLightShadow spotLight;\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n		spotLight = spotLightShadows[ i ];\n		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n	}\n	#pragma unroll_loop_end\n	#endif\n	#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n	PointLightShadow pointLight;\n	#pragma unroll_loop_start\n	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n		pointLight = pointLightShadows[ i ];\n		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n	}\n	#pragma unroll_loop_end\n	#endif\n	#endif\n	return shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n	mat4 boneMatX = getBoneMatrix( skinIndex.x );\n	mat4 boneMatY = getBoneMatrix( skinIndex.y );\n	mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n	mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n	uniform mat4 bindMatrix;\n	uniform mat4 bindMatrixInverse;\n	uniform highp sampler2D boneTexture;\n	mat4 getBoneMatrix( const in float i ) {\n		int size = textureSize( boneTexture, 0 ).x;\n		int j = int( i ) * 4;\n		int x = j % size;\n		int y = j / size;\n		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n		return mat4( v1, v2, v3, v4 );\n	}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n	vec4 skinned = vec4( 0.0 );\n	skinned += boneMatX * skinVertex * skinWeight.x;\n	skinned += boneMatY * skinVertex * skinWeight.y;\n	skinned += boneMatZ * skinVertex * skinWeight.z;\n	skinned += boneMatW * skinVertex * skinWeight.w;\n	transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n	mat4 skinMatrix = mat4( 0.0 );\n	skinMatrix += skinWeight.x * boneMatX;\n	skinMatrix += skinWeight.y * boneMatY;\n	skinMatrix += skinWeight.z * boneMatZ;\n	skinMatrix += skinWeight.w * boneMatW;\n	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n	#ifdef USE_TANGENT\n		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n	#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n	specularStrength = texelSpecular.r;\n#else\n	specularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n	uniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;
1\nvec3 LinearToneMapping( vec3 color ) {\n	return saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n	color *= toneMappingExposure;\n	return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n	color *= toneMappingExposure;\n	color = max( vec3( 0.0 ), color - 0.004 );\n	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n	return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n	const mat3 ACESInputMat = mat3(\n		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),\n		vec3( 0.04823, 0.01566, 0.83777 )\n	);\n	const mat3 ACESOutputMat = mat3(\n		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),\n		vec3( -0.07367, -0.00605,  1.07602 )\n	);\n	color *= toneMappingExposure / 0.6;\n	color = ACESInputMat * color;\n	color = RRTAndODTFit( color );\n	color = ACESOutputMat * color;\n	return saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n	vec3( 1.6605, - 0.1246, - 0.0182 ),\n	vec3( - 0.5876, 1.1329, - 0.1006 ),\n	vec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n	vec3( 0.6274, 0.0691, 0.0164 ),\n	vec3( 0.3293, 0.9195, 0.0880 ),\n	vec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n	vec3 x2 = x * x;\n	vec3 x4 = x2 * x2;\n	return + 15.5 * x4 * x2\n		- 40.14 * x4 * x\n		+ 31.96 * x4\n		- 6.868 * x2 * x\n		+ 0.4298 * x2\n		+ 0.1191 * x\n		- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n	const mat3 AgXInsetMatrix = mat3(\n		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n	);
1\n	const mat3 AgXOutsetMatrix = mat3(\n		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n	);\n	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;\n	color *= toneMappingExposure;\n	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n	color = AgXInsetMatrix * color;\n	color = max( color, 1e-10 );	color = log2( color );\n	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n	color = clamp( color, 0.0, 1.0 );\n	color = agxDefaultContrastApprox( color );\n	color = AgXOutsetMatrix * color;\n	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n	color = clamp( color, 0.0, 1.0 );\n	return color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n	const float StartCompression = 0.8 - 0.04;\n	const float Desaturation = 0.15;\n	color *= toneMappingExposure;\n	float x = min( color.r, min( color.g, color.b ) );\n	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n	color -= offset;\n	float peak = max( color.r, max( color.g, color.b ) );\n	if ( peak < StartCompression ) return color;\n	float d = 1. - StartCompression;\n	float newPeak = 1. - d * d / ( peak + d - StartCompression );\n	color *= newPeak / peak;\n	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n	return mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n	material.transmission = transmission;\n	material.transmissionAlpha = 1.0;\n	material.thickness = thickness;\n	material.attenuationDistance = attenuationDistance;\n	material.attenuationColor = attenuationColor;\n	#ifdef USE_TRANSMISSIONMAP\n		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n	#endif\n	#ifdef USE_THICKNESSMAP\n		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n	#endif\n	vec3 pos = vWorldPosition;\n	vec3 v = normalize( cameraPosition - pos );\n	vec3 n = transformNormalByInverseViewMatrix( normal, viewMatrix );\n	vec4 transmitted = getIBLVolumeRefraction(\n		n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,\n		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n		material.attenuationColor, material.attenuationDistance );\n	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n	uniform float transmission;\n	uniform float thickness;\n	uniform float attenuationDistance;\n	uniform vec3 attenuationColor;\n	#ifdef USE_TRANSMISSIONMAP\n		uniform sampler2D transmissionMap;\n	#endif\n	#ifdef USE_THICKNESSMAP\n		uniform sampler2D thicknessMap;\n	#endif\n	uniform vec2 transmissionSamplerSize;\n	uniform sampler2D transmissionSamplerMap;\n	uniform mat4 modelMatrix;\n	uniform mat4 projectionMatrix;\n	varying vec3 vWorldPosition;\n	float w0( float a ) {\n		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n	}\n	float w1( float a ) {\n		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );\n	}\n	float w2( float a ){\n		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n	}\n	float w3( float a ) {\n		return ( 1.0 / 6.0 ) * ( a * a * a );\n	}\n	float g0( float a ) {\n		return w0( a ) + w1( a );\n	}\n	float g1( float a ) {\n		return w2( a ) + w3( a );\n	}\n	float h0( float a ) {\n		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n	}\n	float h1( float a ) {\n		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n	}\n	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n		uv = uv * texelSize.zw + 0.5;\n		vec2 iuv = floor( uv );\n		vec2 fuv = fract( uv );\n		float g0x = g0( fuv.x );\n		float g1x = g1( fuv.x );\n		float h0x = h0( fuv.x );\n		float h1x = h1( fuv.x );\n		float h0y = h0( fuv.y );\n		float h1y = h1( fuv.y );\n		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n	}\n	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n		vec2 fLodSizeInv = 1.0 / fLodSize;\n		vec2 cLodSizeInv = 1.0 / cLodSize;\n		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n		return mix( fSample, cSample, fract( lod ) );\n	}\n	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n		vec3 modelScale;\n		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n		return normalize( refractionVector ) * thickness * modelScale;\n	}\n	float applyIorToRoughness( const in float roughness, const in float ior ) {\n		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n	}\n	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n	}\n	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n		if ( isinf( attenuationDistance ) ) {\n			return vec3( 1.0 );\n		} else {\n			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;\n		}\n	}\n	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n		const in vec3 attenuationColor, const in float attenuationDistance ) {\n		vec4 transmittedLight;\n		vec3 transmittance;\n		#ifdef USE_DISPERSION\n			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n			for ( int i = 0; i < 3; i ++ ) {\n				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n				vec3 refractedRayExit = position + transmissionRay;\n				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n				vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n				refractionCoords += 1.0;\n				refractionCoords /= 2.0;\n				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n				transmittedLight[ i ] = transmissionSample[ i ];\n				transmittedLight.a += transmissionSample.a;\n				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n			}\n			transmittedLight.a /= 3.0;\n		#else\n			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n			vec3 refractedRayExit = position + transmissionRay;\n			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n			vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n			refractionCoords += 1.0;\n			refractionCoords /= 2.0;\n			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n		#endif\n		vec3 attenuatedColor = transmittance * transmittedLight.rgb;\n		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n	}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n	varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n	varying vec2 vMapUv;
1\n#endif\n#ifdef USE_ALPHAMAP\n	varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n	varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n	varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n	varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n	varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n	varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n	varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n	varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n	varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n	varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n	varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n	varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n	varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n	varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n	varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n	varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n	varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n	varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n	varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n	uniform mat3 transmissionMapTransform;\n	varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n	uniform mat3 thicknessMapTransform;\n	varying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n	varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n	uniform mat3 mapTransform;\n	varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n	uniform mat3 alphaMapTransform;\n	varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n	uniform mat3 lightMapTransform;\n	varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n	uniform mat3 aoMapTransform;\n	varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n	uniform mat3 bumpMapTransform;\n	varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n	uniform mat3 normalMapTransform;\n	varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n	uniform mat3 displacementMapTransform;\n	varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n	uniform mat3 emissiveMapTransform;\n	varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n	uniform mat3 metalnessMapTransform;\n	varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n	uniform mat3 roughnessMapTransform;\n	varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n	uniform mat3 anisotropyMapTransform;\n	varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n	uniform mat3 clearcoatMapTransform;\n	varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n	uniform mat3 clearcoatNormalMapTransform;\n	varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n	uniform mat3 clearcoatRoughnessMapTransform;\n	varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n	uniform mat3 sheenColorMapTransform;\n	varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n	uniform mat3 sheenRoughnessMapTransform;\n	varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n	uniform mat3 iridescenceMapTransform;\n	varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n	uniform mat3 iridescenceThicknessMapTransform;\n	varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n	uniform mat3 specularMapTransform;\n	varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n	uniform mat3 specularColorMapTransform;\n	varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n	uniform mat3 specularIntensityMapTransform;\n	varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n	uniform mat3 transmissionMapTransform;\n	varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n	uniform mat3 thicknessMapTransform;\n	varying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n	vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
1\n#endif\n#ifdef USE_IRIDESCENCEMAP\n	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n	vec4 worldPosition = vec4( transformed, 1.0 );\n	#ifdef USE_BATCHING\n		worldPosition = batchingMatrix * worldPosition;\n	#endif\n	#ifdef USE_INSTANCING\n		worldPosition = instanceMatrix * worldPosition;\n	#endif\n	worldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n	gl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n	vec4 texColor = texture2D( t2D, vUv );\n	#ifdef DECODE_VIDEO_TEXTURE\n		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 );\n	#endif\n	texColor.rgb *= backgroundIntensity;\n	gl_FragColor = texColor;\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n	vWorldDirection = transformDirection( position, modelMatrix );\n	#include <begin_vertex>\n	#include <project_vertex>\n	gl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n	uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n	uniform sampler2D envMap;\n#endif\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n	#ifdef ENVMAP_TYPE_CUBE\n		vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );\n	#elif defined( ENVMAP_TYPE_CUBE_UV )\n		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n	#else\n		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n	#endif\n	texColor.rgb *= backgroundIntensity;\n	gl_FragColor = texColor;\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n	vWorldDirection = transformDirection( position, modelMatrix );\n	#include <begin_vertex>\n	#include <project_vertex>\n	gl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n	gl_FragColor = texColor;\n	gl_FragColor.a *= opacity;\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n	#include <uv_vertex>\n	#include <batching_vertex>\n	#include <skinbase_vertex>\n	#include <morphinstance_vertex>\n	#ifdef USE_DISPLACEMENTMAP\n		#include <beginnormal_vertex>\n		#include <morphnormal_vertex>\n		#include <skinnormal_vertex>\n	#endif\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	vHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n	uniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n	vec4 diffuseColor = vec4( 1.0 );\n	#include <clipping_planes_fragment>\n	#if DEPTH_PACKING == 3200\n		diffuseColor.a = opacity;\n	#endif\n	#include <map_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <alphahash_fragment>\n	#include <logdepthbuf_fragment>\n	#ifdef USE_REVERSED_DEPTH_BUFFER\n		float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n	#else\n		float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n	#endif\n	#if DEPTH_PACKING == 3200\n		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n	#elif DEPTH_PACKING == 3201\n		gl_FragColor = packDepthToRGBA( fragCoordZ );\n	#elif DEPTH_PACKING == 3202\n		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n	#elif DEPTH_PACKING == 3203\n		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n	#endif\n}",distance_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <batching_vertex>\n	#include <skinbase_vertex>\n	#include <morphinstance_vertex>\n	#ifdef USE_DISPLACEMENTMAP\n		#include <beginnormal_vertex>\n		#include <morphnormal_vertex>\n		#include <skinnormal_vertex>\n	#endif\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <worldpos_vertex>\n	#include <clipping_planes_vertex>\n	vWorldPosition = worldPosition.xyz;\n}",distance_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	vec4 diffuseColor = vec4( 1.0 );\n	#include <clipping_planes_fragment>\n	#include <map_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <alphahash_fragment>\n	float dist = length( vWorldPosition - referencePosition );\n	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n	dist = saturate( dist );\n	gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n	vWorldDirection = transformDirection( position, modelMatrix );\n	#include <begin_vertex>\n	#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n	vec3 direction = normalize( vWorldDirection );\n	vec2 sampleUV = equirectUv( direction );\n	gl_FragColor = texture2D( tEquirect, sampleUV );\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	vLineDistance = scale * lineDistance;\n	#include <uv_vertex>\n	#include <color_vertex>\n	#include <morphinstance_vertex>\n	#include <morphcolor_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <clipping_planes_fragment>\n	if ( mod( vLineDistance, totalSize ) > dashSize ) {\n		discard;\n	}\n	vec3 outgoingLight = vec3( 0.0 );\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	outgoingLight = diffuseColor.rgb;\n	#include <opaque_fragment>\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <color_vertex>\n	#include <morphinstance_vertex>\n	#include <morphcolor_vertex>\n	#include <batching_vertex>\n	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n		#include <beginnormal_vertex>\n		#include <morphnormal_vertex>\n		#include <skinbase_vertex>\n		#include <skinnormal_vertex>\n		#include <defaultnormal_vertex>\n	#endif\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	#include <worldpos_vertex>\n	#include <envmap_vertex>\n	#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n	varying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <clipping_planes_fragment>\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <alphahash_fragment>\n	#include <specularmap_fragment>\n	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n	#ifdef USE_LIGHTMAP\n		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n	#else\n		reflectedLight.indirectDiffuse += vec3( 1.0 );\n	#endif\n	#include <aomap_fragment>\n	reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n	vec3 outgoingLight = reflectedLight.indirectDiffuse;\n	#include <envmap_fragment>\n	#include <opaque_fragment>\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n	#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <color_vertex>\n	#include <morphinstance_vertex>\n	#include <morphcolor_vertex>\n	#include <batching_vertex>\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <normal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	vViewPosition = - mvPosition.xyz;\n	#include <worldpos_vertex>\n	#include <envmap_vertex>\n	#include <shadowmap_vertex>\n	#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <clipping_planes_fragment>\n	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n	vec3 totalEmissiveRadiance = emissive;\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <alphahash_fragment>\n	#include <specularmap_fragment>\n	#include <normal_fragment_begin>\n	#include <normal_fragment_maps>\n	#include <emissivemap_fragment>\n	#include <lights_lambert_fragment>\n	#include <lights_fragment_begin>\n	#include <lights_fragment_maps>\n	#include <lights_fragment_end>\n	#include <aomap_fragment>\n	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n	#include <envmap_fragment>\n	#include <opaque_fragment>\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n	#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <color_vertex>\n	#include <morphinstance_vertex>\n	#include <morphcolor_vertex>\n	#include <batching_vertex>\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <normal_vertex>\n	#include <begin_vertex>\n	#include <mor
1phtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	#include <fog_vertex>\n	vViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <clipping_planes_fragment>\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <alphahash_fragment>\n	#include <normal_fragment_begin>\n	#include <normal_fragment_maps>\n	vec3 viewDir = normalize( vViewPosition );\n	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n	vec3 y = cross( viewDir, x );\n	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n	#ifdef USE_MATCAP\n		vec4 matcapColor = texture2D( matcap, uv );\n	#else\n		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n	#endif\n	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n	#include <opaque_fragment>\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n	#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n	varying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <batching_vertex>\n	#include <beginnormal_vertex>\n	#include <morphinstance_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <normal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n	vViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n	varying vec3 vViewPosition;\n#endif\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n	#include <clipping_planes_fragment>\n	#include <logdepthbuf_fragment>\n	#include <normal_fragment_begin>\n	#include <normal_fragment_maps>\n	gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );\n	#ifdef OPAQUE\n		gl_FragColor.a = 1.0;\n	#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <color_vertex>\n	#include <morphcolor_vertex>\n	#include <batching_vertex>\n	#include <beginnormal_vertex>\n	#include <morphinstance_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <normal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	vViewPosition = - mvPosition.xyz;\n	#include <worldpos_vertex>\n	#include <envmap_vertex>\n	#include <shadowmap_vertex>\n	#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <clipping_planes_fragment>\n	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n	vec3 totalEmissiveRadiance = emissive;\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <alphahash_fragment>\n	#include <specularmap_fragment>\n	#include <normal_fragment_begin>\n	#include <normal_fragment_maps>\n	#include <emissivemap_fragment>\n	#include <lights_phong_fragment>\n	#include <lights_fragment_begin>\n	#include <lights_fragment_maps>\n	#include <lights_fragment_end>\n	#include <aomap_fragment>\n	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n	#include <envmap_fragment>\n	#include <opaque_fragment>\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n	#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n	varying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <color_vertex>\n	#include <morphinstance_vertex>\n	#include <morphcolor_vertex>\n	#include <batching_vertex>\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <normal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	vViewPosition = - mvPosition.xyz;\n	#include <worldpos_vertex>\n	#include <shadowmap_vertex>\n	#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n	vWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n	#define IOR\n	#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n	uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n	uniform float specularIntensity;\n	uniform vec3 specularColor;\n	#ifdef USE_SPECULAR_COLORMAP\n		uniform sampler2D specularColorMap;\n	#endif\n	#ifdef USE_SPECULAR_INTENSITYMAP\n		uniform sampler2D specularIntensityMap;\n	#endif\n#endif\n#ifdef USE_CLEARCOAT\n	uniform float clearcoat;
1\n	uniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n	uniform float dispersion;\n#endif\n#ifdef USE_RETROREFLECTION\n	uniform float retroreflectivity;\n#endif\n#ifdef USE_IRIDESCENCE\n	uniform float iridescence;\n	uniform float iridescenceIOR;\n	uniform float iridescenceThicknessMinimum;\n	uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n	uniform vec3 sheenColor;\n	uniform float sheenRoughness;\n	#ifdef USE_SHEEN_COLORMAP\n		uniform sampler2D sheenColorMap;\n	#endif\n	#ifdef USE_SHEEN_ROUGHNESSMAP\n		uniform sampler2D sheenRoughnessMap;\n	#endif\n#endif\n#ifdef USE_ANISOTROPY\n	uniform vec2 anisotropyVector;\n	#ifdef USE_ANISOTROPYMAP\n		uniform sampler2D anisotropyMap;\n	#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <clipping_planes_fragment>\n	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n	vec3 totalEmissiveRadiance = emissive;\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <alphahash_fragment>\n	#include <roughnessmap_fragment>\n	#include <metalnessmap_fragment>\n	#include <normal_fragment_begin>\n	#include <normal_fragment_maps>\n	#include <clearcoat_normal_fragment_begin>\n	#include <clearcoat_normal_fragment_maps>\n	#include <emissivemap_fragment>\n	#include <lights_physical_fragment>\n	#include <lights_fragment_begin>\n	#include <lights_fragment_maps>\n	#include <lights_fragment_end>\n	#include <aomap_fragment>\n	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n	#include <transmission_fragment>\n	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n	#ifdef USE_SHEEN\n \n		outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\n \n 	#endif\n	#ifdef USE_CLEARCOAT\n		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
1\n	#endif\n	#include <opaque_fragment>\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n	#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	#include <color_vertex>\n	#include <morphinstance_vertex>\n	#include <morphcolor_vertex>\n	#include <batching_vertex>\n	#include <beginnormal_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <normal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <displacementmap_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	vViewPosition = - mvPosition.xyz;\n	#include <worldpos_vertex>\n	#include <shadowmap_vertex>\n	#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <clipping_planes_fragment>\n	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n	vec3 totalEmissiveRadiance = emissive;\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <color_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <alphahash_fragment>\n	#include <normal_fragment_begin>\n	#include <normal_fragment_maps>\n	#include <emissivemap_fragment>\n	#include <lights_toon_fragment>\n	#include <lights_fragment_begin>\n	#include <lights_fragment_maps>\n	#include <lights_fragment_end>\n	#include <aomap_fragment>\n	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n	#include <opaque_fragment>\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n	#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n	varying vec2 vUv;\n	uniform mat3 uvTransform;\n#endif\nvoid main() {\n	#ifdef USE_POINTS_UV\n		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n	#endif\n	#include <color_vertex>\n	#include <morphinstance_vertex>\n	#include <morphcolor_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <project_vertex>\n	gl_PointSize = size;\n	#ifdef USE_SIZEATTENUATION\n		bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n	#endif\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	#include <worldpos_vertex>\n	#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <clipping_planes_fragment>\n	vec3 outgoingLight = vec3( 0.0 );\n	#include <logdepthbuf_fragment>\n	#include <map_particle_fragment>\n	#include <color_fragment>\n	#include <alphatest_fragment>\n	#include <alphahash_fragment>\n	outgoingLight = diffuseColor.rgb;\n	#include <opaque_fragment>\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n	#include <batching_vertex>\n	#include <beginnormal_vertex>\n	#include <morphinstance_vertex>\n	#include <morphnormal_vertex>\n	#include <skinbase_vertex>\n	#include <skinnormal_vertex>\n	#include <defaultnormal_vertex>\n	#include <begin_vertex>\n	#include <morphtarget_vertex>\n	#include <skinning_vertex>\n	#include <project_vertex>\n	#include <logdepthbuf_vertex>\n	#include <worldpos_vertex>\n	#include <shadowmap_vertex>\n	#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n	#include <logdepthbuf_fragment>\n	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n	#include <fog_fragment>\n	#include <premultiplied_alpha_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n	#include <uv_vertex>\n	vec4 mvPosition = modelViewMatrix[ 3 ];\n	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n	#ifndef USE_SIZEATTENUATION\n		bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n		if ( isPerspective ) scale *= - mvPosition.z;\n	#endif\n	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n	vec2 rotatedPosition;\n	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n	mvPosition.xy += rotatedPosition;\n	gl_Position = projectionMatrix * mvPosition;\n	#include <logdepthbuf_vertex>\n	#include <clipping_planes_vertex>\n	#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n	vec4 diffuseColor = vec4( diffuse, opacity );\n	#include <clipping_planes_fragment>\n	vec3 outgoingLight = vec3( 0.0 );\n	#include <logdepthbuf_fragment>\n	#include <map_fragment>\n	#include <alphamap_fragment>\n	#include <alphatest_fragment>\n	#include <alphahash_fragment>\n	outgoingLight = diffuseColor.rgb;\n	#include <opaque_fragment>\n	#include <tonemapping_fragment>\n	#include <colorspace_fragment>\n	#include <fog_fragment>\n}"},a={common:{diffuse:{value:new t.Color(0xffffff)},opacity:{value:1},map:{value:null},mapTransform:{value:new t.Matrix3},alphaMap:{value:null},alphaMapTransform:{value:new t.Matrix3},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new t.Matrix3}},envmap:{envMap:{value:null},envMapRotation:{value:new t.Matrix3},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new t.Matrix3}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new t.Matrix3}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new t.Matrix3},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new t.Matrix3},normalScale:{value:new t.Vector2(1,1)}}
vendor: 7,924 bytes, line 1
1,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new t.Matrix3},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new t.Matrix3}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new t.Matrix3}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new t.Matrix3}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new t.Color(0xffffff)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},sunLights:{value:[],properties:{direction:{},color:{}}},sunLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},sunShadowMatrix:{value:[]},sunShadowCascade:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new t.Vector3},probesMax:{value:new t.Vector3},probesResolution:{value:new t.Vector3}},points:{diffuse:{value:new t.Color(0xffffff)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new t.Matrix3},alphaTest:{value:0},uvTransform:{value:new t.Matrix3}},sprite:{diffuse:{value:new t.Color(0xffffff)},opacity:{value:1},center:{value:new t.Vector2(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new t.Matrix3},alphaMap:{value:null},alphaMapTransform:{value:new t.Matrix3},alphaTest:{value:0}}},o={basic:{uniforms:(0,t.mergeUniforms)([a.common,a.specularmap,a.envmap,a.aomap,a.lightmap,a.fog]),vertexShader:i.meshbasic_vert,fragmentShader:i.meshbasic_frag},lambert:{uniforms:(0,t.mergeUniforms)([a.common,a.specularmap,a.envmap,a.aomap,a.lightmap,a.emissivemap,a.bumpmap,a.normalmap,a.displacementmap,a.fog,a.lights,{emissive:{value:new t.Color(0)},envMapIntensity:{value:1}}]),vertexShader:i.meshlambert_vert,fragmentShader:i.meshlambert_frag},phong:{uniforms:(0,t.mergeUniforms)([a.common,a.specularmap,a.envmap,a.aomap,a.lightmap,a.emissivemap,a.bumpmap,a.normalmap,a.displacementmap,a.fog,a.lights,{emissive:{value:new t.Color(0)},specular:{value:new t.Color(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:i.meshphong_vert,fragmentShader:i.meshphong_frag},standard:{uniforms:(0,t.mergeUniforms)([a.common,a.envmap,a.aomap,a.lightmap,a.emissivemap,a.bumpmap,a.normalmap,a.displacementmap,a.roughnessmap,a.metalnessmap,a.fog,a.lights,{emissive:{value:new t.Color(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:i.meshphysical_vert,fragmentShader:i.meshphysical_frag},toon:{uniforms:(0,t.mergeUniforms)([a.common,a.aomap,a.lightmap,a.emissivemap,a.bumpmap,a.normalmap,a.displacementmap,a.gradientmap,a.fog,a.lights,{emissive:{value:new t.Color(0)}}]),vertexShader:i.meshtoon_vert,fragmentShader:i.meshtoon_frag},matcap:{uniforms:(0,t.mergeUniforms)([a.common,a.bumpmap,a.normalmap,a.displacementmap,a.fog,{matcap:{value:null}}]),vertexShader:i.meshmatcap_vert,fragmentShader:i.meshmatcap_frag},points:{uniforms:(0,t.mergeUniforms)([a.points,a.fog]),vertexShader:i.points_vert,fragmentShader:i.points_frag},dashed:{uniforms:(0,t.mergeUniforms)([a.common,a.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:i.linedashed_vert,fragmentShader:i.linedashed_frag},depth:{uniforms:(0,t.mergeUniforms)([a.common,a.displacementmap]),vertexShader:i.depth_vert,fragmentShader:i.depth_frag},normal:{uniforms:(0,t.mergeUniforms)([a.common,a.bumpmap,a.normalmap,a.displacementmap,{opacity:{value:1}}]),vertexShader:i.meshnormal_vert,fragmentShader:i.meshnormal_frag},sprite:{uniforms:(0,t.mergeUniforms)([a.sprite,a.fog]),vertexShader:i.sprite_vert,fragmentShader:i.sprite_frag},background:{uniforms:{uvTransform:{value:new t.Matrix3},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:i.background_vert,fragmentShader:i.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new t.Matrix3}},vertexShader:i.backgroundCube_vert,fragmentShader:i.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:i.cube_vert,fragmentShader:i.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:i.equirect_vert,fragmentShader:i.equirect_frag},distance:{uniforms:(0,t.mergeUniforms)([a.common,a.displacementmap,{referencePosition:{value:new t.Vector3},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:i.distance_vert,fragmentShader:i.distance_frag},shadow:{uniforms:(0,t.mergeUniforms)([a.lights,a.fog,{color:{value:new t.Color(0)},opacity:{value:1}}]),vertexShader:i.shadow_vert,fragmentShader:i.shadow_frag}};o.physical={uniforms:(0,t.mergeUniforms)([o.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new t.Matrix3},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new t.Matrix3},clearcoatNormalScale:{value:new t.Vector2(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new t.Matrix3},dispersion:{value:0},retroreflectivity:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new t.Matrix3},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new t.Matrix3},sheen:{value:0},sheenColor:{value:new t.Color(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new t.Matrix3},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new t.Matrix3},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new t.Matrix3},transmissionSamplerSize:{value:new t.Vector2},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new t.Matrix3},attenuationDistance:{value:0},attenuationColor:{value:new t.Color(0)},specularColor:{value:new t.Color(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new t.Matrix3},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new t.Matrix3},anisotropyVector:{value:new t.Vector2},anisotropyMap:{value:null},anisotropyMapTransform:{value:new t.Matrix3}}]),vertexShader:i.meshphysical_vert,fragmentShader:i.meshphysical_frag};let s={r:0,b:0,g:0},l=new t.Matrix4,u=new t.Matrix3;function c(e,n,r,i,a,c){let d,h,f=new t.Color(0),p=+(!0!==a),m=null,v=0,g=null;function _(e){let t=!0===e.isScene?e.background:null;if(t&&t.isTexture){let r=e.backgroundBlurriness>0;t=n.get(t,r)}return t}function S(n,i){n.getRGB(s,(0,t.getUnlitUniformColorSpace)(e)),r.buffers.color.setClear(s.r,s.g,s.b,i,c)}return{getClearColor:function(){return f},setClearColor:function(e,t=1){f.set(e),S(f,p=t)},getClearAlpha:function(){return p}
vendor: 8,679 bytes, line 1
1,setClearAlpha:function(e){S(f,p=e)},render:function(t){let n=!1,i=_(t);null===i?S(f,p):i&&i.isColor&&(S(i,1),n=!0);let a=e.xr.getEnvironmentBlendMode();"additive"===a?r.buffers.color.setClear(0,0,0,1,c):"alpha-blend"===a&&r.buffers.color.setClear(0,0,0,0,c),(e.autoClear||n)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(n,r){let a=_(r);a&&(a.isCubeTexture||a.mapping===t.CubeUVReflectionMapping)?(void 0===h&&((h=new t.Mesh(new t.BoxGeometry(1,1,1),new t.ShaderMaterial({name:"BackgroundCubeMaterial",uniforms:(0,t.cloneUniforms)(o.backgroundCube.uniforms),vertexShader:o.backgroundCube.vertexShader,fragmentShader:o.backgroundCube.fragmentShader,side:t.BackSide,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(h)),h.material.uniforms.envMap.value=a,h.material.uniforms.backgroundBlurriness.value=r.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=r.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(l.makeRotationFromEuler(r.backgroundRotation)).transpose(),a.isCubeTexture&&!1===a.isRenderTargetTexture&&h.material.uniforms.backgroundRotation.value.premultiply(u),h.material.toneMapped=t.ColorManagement.getTransfer(a.colorSpace)!==t.SRGBTransfer,(m!==a||v!==a.version||g!==e.toneMapping)&&(h.material.needsUpdate=!0,m=a,v=a.version,g=e.toneMapping),h.layers.enableAll(),n.unshift(h,h.geometry,h.material,0,0,null)):a&&a.isTexture&&(void 0===d&&((d=new t.Mesh(new t.PlaneGeometry(2,2),new t.ShaderMaterial({name:"BackgroundMaterial",uniforms:(0,t.cloneUniforms)(o.background.uniforms),vertexShader:o.background.vertexShader,fragmentShader:o.background.fragmentShader,side:t.FrontSide,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(d.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(d)),d.material.uniforms.t2D.value=a,d.material.uniforms.backgroundIntensity.value=r.backgroundIntensity,d.material.toneMapped=t.ColorManagement.getTransfer(a.colorSpace)!==t.SRGBTransfer,!0===a.matrixAutoUpdate&&a.updateMatrix(),d.material.uniforms.uvTransform.value.copy(a.matrix),(m!==a||v!==a.version||g!==e.toneMapping)&&(d.material.needsUpdate=!0,m=a,v=a.version,g=e.toneMapping),d.layers.enableAll(),n.unshift(d,d.geometry,d.material,0,0,null))},dispose:function(){void 0!==h&&(h.geometry.dispose(),h.material.dispose(),h=void 0),void 0!==d&&(d.geometry.dispose(),d.material.dispose(),d=void 0)}}}function d(e,n){let r=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},a=c(null),o=a,s=!1;function l(t){return e.bindVertexArray(t)}function u(t){return e.deleteVertexArray(t)}function c(e){let t=[],n=[],i=[];for(let e=0;e<r;e++)t[e]=0,n[e]=0,i[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:n,attributeDivisors:i,object:e,attributes:{},index:null}}function d(){let e=o.newAttributes;for(let t=0,n=e.length;t<n;t++)e[t]=0}function h(e){f(e,0)}function f(t,n){let r=o.newAttributes,i=o.enabledAttributes,a=o.attributeDivisors;r[t]=1,0===i[t]&&(e.enableVertexAttribArray(t),i[t]=1),a[t]!==n&&(e.vertexAttribDivisor(t,n),a[t]=n)}function p(){let t=o.newAttributes,n=o.enabledAttributes;for(let r=0,i=n.length;r<i;r++)n[r]!==t[r]&&(e.disableVertexAttribArray(r),n[r]=0)}function m(t,n,r,i,a,o,s){!0===s?e.vertexAttribIPointer(t,n,r,a,o):e.vertexAttribPointer(t,n,r,i,a,o)}function v(){g(),s=!0,o!==a&&l((o=a).object)}function g(){a.geometry=null,a.program=null,a.wireframe=!1}return{setup:function(r,a,u,v,g){var _,S,x;let T,M,b,E,R,w,C=!1,y=(_=r,S=v,x=u,T=!0===a.wireframe,void 0===(M=i[S.id])&&(M={},i[S.id]=M),void 0===(E=M[b=!0===_.isInstancedMesh?_.id:0])&&(E={},M[b]=E),void 0===(R=E[x.id])&&(R={},E[x.id]=R),void 0===(w=R[T])&&(w=c(e.createVertexArray()),R[T]=w),w);o!==y&&l((o=y).object),(C=function(e,t,n,r){let i=o.attributes,a=t.attributes,s=0,l=n.getAttributes();for(let t in l)if(l[t].location>=0){let n=i[t],r=a[t];if(void 0===r&&("instanceMatrix"===t&&e.instanceMatrix&&(r=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(r=e.instanceColor)),void 0===n||n.attribute!==r||r&&n.data!==r.data)return!0;s++}return o.attributesNum!==s||o.index!==r}(r,v,u,g))&&function(e,t,n,r){let i={},a=t.attributes,s=0,l=n.getAttributes();for(let t in l)if(l[t].location>=0){let n=a[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));let r={};r.attribute=n,n&&n.data&&(r.data=n.data),i[t]=r,s++}o.attributes=i,o.attributesNum=s,o.index=r}(r,v,u,g),null!==g&&n.update(g,e.ELEMENT_ARRAY_BUFFER),(C||s)&&(s=!1,function(r,i,a,o){d();let s=o.attributes,l=a.getAttributes(),u=i.defaultAttributeValues;for(let i in l){let a=l[i];if(a.location>=0){let l=s[i];if(void 0===l&&("instanceMatrix"===i&&r.instanceMatrix&&(l=r.instanceMatrix),"instanceColor"===i&&r.instanceColor&&(l=r.instanceColor)),void 0!==l){let i=l.normalized,s=l.itemSize,u=n.get(l);if(void 0===u)continue;let c=u.buffer,d=u.type,p=u.bytesPerElement,v=d===e.INT||d===e.UNSIGNED_INT||l.gpuType===t.IntType;if(l.isInterleavedBufferAttribute){let t=l.data,n=t.stride,u=l.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<a.locationSize;e++)f(a.location+e,t.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===o._maxInstanceCount&&(o._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<a.locationSize;e++)h(a.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<a.locationSize;e++)m(a.location+e,s/a.locationSize,d,i,n*p,(u+s/a.locationSize*e)*p,v)}else{if(l.isInstancedBufferAttribute){for(let e=0;e<a.locationSize;e++)f(a.location+e,l.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===o._maxInstanceCount&&(o._maxInstanceCount=l.meshPerAttribute*l.count)}else for(let e=0;e<a.locationSize;e++)h(a.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<a.locationSize;e++)m(a.location+e,s/a.locationSize,d,i,s*p,s/a.locationSize*e*p,v)}}else if(void 0!==u){let t=u[i];if(void 0!==t)switch(t.length){case 2:e.vertexAttrib2fv(a.location,t);break;case 3:e.vertexAttrib3fv(a.location,t);break;case 4:e.vertexAttrib4fv(a.location,t);break;default:e.vertexAttrib1fv(a.location,t)}}}}p()}(r,a,u,v),null!==g&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.get(g).buffer))},reset:v,resetDefaultState:g,dispose:function(){for(let e in v(),i){let t=i[e];for(let e in t){let n=t[e];for(let e in n){let t=n[e];for(let e in t)u(t[e].object),delete t[e];delete n[e]}}delete i[e]}},releaseStatesOfGeometry:function(e){if(void 0===i[e.id])return;let t=i[e.id];for(let e in t){let n=t[e];for(let e in n){let t=n[e];for(let e in t)u(t[e].object),delete t[e];delete n[e]}}delete i[e.id]},releaseStatesOfObject:function(e){for(let t in i){let n=i[t],r=!0===e.isInstancedMesh?e.id:0,a=n[r];if(void 0!==a){for(let e in a){let t=a[e];for(let e in t)u(t[e].object),delete t[e];delete a[e]}delete n[r],0===Object.keys(n).length&&delete i[t]}}},releaseStatesOfProgram:function(e){for(let t in i){let n=i[t];for(let t in n){let r=n[t];if(void 0===r[e.id])continue;let i=r[e.id];for(let e in i)u(i[e].object),delete i[e];delete r[e.id]}}},initAttributes:d,enableAttribute:h,disableUnusedAttributes:p}}function h(e,t,n){let r;this.setMode=function(e){r=e},this.render=function(t,i){e.drawArrays(r,t,i),n.update(i,r,1)},this.renderInstances=function(t,i,a){0!==a&&(e.drawArraysInstanced(r,t,i,a),n.update(i,r,a))},this.renderMultiDraw=function(e,i,a){if(0===a)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(r,e,0,i,0,a);let o=0;for(let e=0;e<a;e++)o+=i[e];n.update(o,r,1)}}function f(e,n,r,i){let a;function o(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let s=void 0!==r.precision?r.precision:"highp",l=o(s);l!==s&&((0,t.warn)("WebGLRenderer:",s,"not supported, using",l,"instead."),s=l);let u=!0===r.logarithmicDepthBuffer,c=!0===r.reversedDepthBuffer&&n.has("EXT_clip_control");return!0===r.reversedDepthBuffer&&!1===c&&(0,t.warn)("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer."),{isWebG
1L2:!0,getMaxAnisotropy:function(){if(void 0!==a)return a;if(!0===n.has("EXT_texture_filter_anisotropic")){let t=n.get("EXT_texture_filter_anisotropic");a=e.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else a=0;return a},getMaxPrecision:o,textureFormatReadable:function(n){return n===t.RGBAFormat||i.convert(n)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(r){let a=r===t.HalfFloatType&&(n.has("EXT_color_buffer_half_float")||n.has("EXT_color_buffer_float"));return r===t.UnsignedByteType||r===t.FloatType||!!a||i.convert(r)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)},precision:s,logarithmicDepthBuffer:u,reversedDepthBuffer:c,maxTextures:e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),maxVertexTextures:e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),maxSamples:e.getParameter(e.MAX_SAMPLES),samples:e.getParameter(e.SAMPLES)}}function p(e){let n=this,r=null,i=0,a=!1,o=!1,s=new t.Plane,l=new t.Matrix3,u={value:null,needsUpdate:!1};function c(e,t,r,i){let a=null!==e?e.length:0,o=null;if(0!==a){if(o=u.value,!0!==i||null===o){let n=r+4*a,i=t.matrixWorldInverse;l.getNormalMatrix(i),(null===o||o.length<n)&&(o=new Float32Array(n));for(let t=0,n=r;t!==a;++t,n+=4)s.copy(e[t]).applyMatrix4(i,l),s.normal.toArray(o,n),o[n+3]=s.constant}u.value=o,u.needsUpdate=!0}return n.numPlanes=a,n.numIntersection=0,o}this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){let n=0!==e.length||t||0!==i||a;return a=t,i=e.length,n},this.beginShadows=function(){o=!0,c(null)},this.endShadows=function(){o=!1},this.setGlobalState=function(e,t){r=c(e,t,0)},this.setState=function(t,s,l){let d=t.clippingPlanes,h=t.clipIntersection,f=t.clipShadows,p=e.get(t);if(a&&null!==d&&0!==d.length&&(!o||f)){let e=o?0:i,t=4*e,n=p.clippingState||null;u.value=n,n=c(d,s,t,l);for(let e=0;e!==t;++e)n[e]=r[e];p.clippingState=n,this.numIntersection=h?this.numPlanes:0,this.numPlanes+=e}else o?c(null):(u.value!==r&&(u.value=r,u.needsUpdate=i>0),n.numPlanes=i,n.numIntersection=0)}}u.set(-1,0,0,0,1,0,0,0,1);let m=new t.OrthographicCamera,v=new t.Color,g=null,_=0,S=0,x=!1,T=new t.Vector3,M=new t.Vector3;class b{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,r=100,i={}){let{size:a=256,position:o=T}=i;g=this._renderer.getRenderTarget(),_=this._renderer.getActiveCubeFace(),S=this._renderer.getActiveMipmapLevel(),x=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);let s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s,o),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=C(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=w(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose(),null!==this._backgroundBox&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._ggxMaterial&&this._ggxMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(g,_,S),this._renderer.xr.enabled=x,e.scissorTest=!1,R(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===t.CubeReflectionMapping||e.mapping===t.CubeRefractionMapping?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),g=this._renderer.getRenderTarget(),_=this._renderer.getActiveCubeFace(),S=this._renderer.getActiveMipmapLevel(),x=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let r=n||this._allocateTargets();return this._textureToCubeUV(e,r),this._applyPMREM(r),this._cleanup(r),r}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),n=4*this._cubeSize,r={magFilter:t.LinearFilter,minFilter:t.LinearFilter,generateMipmaps:!1,type:t.HalfFloatType,format:t.RGBAFormat,colorSpace:t.LinearSRGBColorSpace,depthBuffer:!1},i=E(e,n,r);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){var a,o,s,l,u,c;null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=E(e,n,r);let{_lodMax:i}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods}
1=function(e){let n=[],r=[],i=e,a=e-4+1+6;for(let e=0;e<a;e++){let e=Math.pow(2,i);n.push(e);let a=1/(e-2),o=-a,s=1+a,l=[o,o,s,o,s,s,o,o,s,s,o,s],u=new Float32Array(108),c=new Float32Array(108);for(let e=0;e<6;e++){let t=e%3*2/3-1,n=e>2?0:-1,r=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];u.set(r,18*e);for(let t=0;t<6;t++){let n=2*l[2*t]-1,r=2*l[2*t+1]-1;0===e?M.set(1,r,n):1===e?M.set(-n,1,-r):2===e?M.set(-n,r,1):3===e?M.set(-1,r,-n):4===e?M.set(-n,-1,r):M.set(n,r,-1),M.toArray(c,(6*e+t)*3)}}let d=new t.BufferGeometry;d.setAttribute("position",new t.BufferAttribute(u,3)),d.setAttribute("outputDirection",new t.BufferAttribute(c,3)),r.push(new t.Mesh(d,null)),i>4&&i--}return{lodMeshes:r,sizeLods:n}}(i)),this._blurMaterial=(a=i,o=e,s=n,new t.ShaderMaterial({name:"SphericalGaussianBlur",defines:{SAMPLES:20,CUBEUV_TEXEL_WIDTH:1/o,CUBEUV_TEXEL_HEIGHT:1/s,CUBEUV_MAX_MIP:`${a}.0`},uniforms:{envMap:{value:null},sigma:{value:0},mipInt:{value:0}},vertexShader:y(),fragmentShader:`
2
3			precision highp float;
4			precision highp int;
5
6			varying vec3 vOutputDirection;
7
8			uniform sampler2D envMap;
9			uniform float sigma;
10			uniform float mipInt;
11
12			#define ENVMAP_TYPE_CUBE_UV
13			#include <cube_uv_reflection_fragment>
14
15			#define PI 3.14159265359
16			#define GOLDEN_ANGLE 2.39996322973
17
18			void main() {
19
20				if ( sigma == 0.0 ) {
21
22					gl_FragColor = vec4( bilinearCubeUV( envMap, vOutputDirection, mipInt ), 1.0 );
23					return;
24
25				}
26
27				vec3 outputDirection = normalize( vOutputDirection );
28
29				vec3 up = abs( outputDirection.z ) < 0.999 ? vec3( 0.0, 0.0, 1.0 ) : vec3( 1.0, 0.0, 0.0 );
30				vec3 tangent = normalize( cross( up, outputDirection ) );
31				vec3 bitangent = cross( outputDirection, tangent );
32
33				// Truncate the kernel at three standard deviations or at the antipode.
34				float thetaMax = min( 3.0 * sigma, PI );
35				float truncation = 1.0 - exp( - 0.5 * thetaMax * thetaMax / ( sigma * sigma ) );
36
37				vec3 accumColor = vec3( 0.0 );
38				float accumWeight = 0.0;
39
40				for ( int i = 0; i < SAMPLES; i ++ ) {
41
42					// Stratified inverse-CDF sampling of the Gaussian, placed on a golden-angle spiral.
43					float stratum = ( float( i ) + 0.5 ) / float( SAMPLES );
44					float theta = sigma * sqrt( - 2.0 * log( 1.0 - stratum * truncation ) );
45					float phi = float( i ) * GOLDEN_ANGLE;
46
47					vec3 offset = cos( phi ) * tangent + sin( phi ) * bitangent;
48					vec3 sampleDirection = cos( theta ) * outputDirection + sin( theta ) * offset;
49
50					// Correct the planar sample density to solid angle.
51					float weight = sin( theta ) / theta;
52
53					accumColor += weight * bilinearCubeUV( envMap, sampleDirection, mipInt );
54					accumWeight += weight;
55
56				}
57
58				gl_FragColor = vec4( accumColor / accumWeight, 1.0 );
59
60			}
61		`,blending:t.NoBlending,depthTest:!1,depthWrite:!1})),this._ggxMaterial=(l=i,u=e,c=n,new t.ShaderMaterial({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:256,CUBEUV_TEXEL_WIDTH:1/u,CUBEUV_TEXEL_HEIGHT:1/c,CUBEUV_MAX_MIP:`${l}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:y(),fragmentShader:`
62
63			precision highp float;
64			precision highp int;
65
66			varying vec3 vOutputDirection;
67
68			uniform sampler2D envMap;
69			uniform float roughness;
70			uniform float mipInt;
71
72			#define ENVMAP_TYPE_CUBE_UV
73			#include <cube_uv_reflection_fragment>
74
75			#define PI 3.14159265359
76
77			// Van der Corput radical inverse
78			float radicalInverse_VdC(uint bits) {
79				bits = (bits << 16u) | (bits >> 16u);
80				bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
81				bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
82				bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
83				bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
84				return float(bits) * 2.3283064365386963e-10; // / 0x100000000
85			}
86
87			// Hammersley sequence
88			vec2 hammersley(uint i, uint N) {
89				return vec2(float(i) / float(N), radicalInverse_VdC(i));
90			}
91
92			// GGX VNDF importance sampling (Eric Heitz 2018)
93			// "Sampling the GGX Distribution of Visible Normals"
94			// https://jcgt.org/published/0007/04/01/
95			vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
96				float alpha = roughness * roughness;
97
98				// Section 4.1: Orthonormal basis
99				vec3 T1 = vec3(1.0, 0.0, 0.0);
100				vec3 T2 = cross(V, T1);
101
102				// Section 4.2: Parameterization of projected area
103				float r = sqrt(Xi.x);
104				float phi = 2.0 * PI * Xi.y;
105				float t1 = r * cos(phi);
106				float t2 = r * sin(phi);
107				float s = 0.5 * (1.0 + V.z);
108				t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
109
110				// Section 4.3: Reprojection onto hemisphere
111				vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;
112
113				// Section 3.4: Transform back to ellipsoid configuration
114				return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
115			}
116
117			void main() {
118				vec3 N = normalize(vOutputDirection);
119				vec3 V = N; // Assume view direction equals normal for pre-filtering
120
121				vec3 prefilteredColor = vec3(0.0);
122				float totalWeight = 0.0;
123
124				// For very low roughness, just sample the environment directly
125				if (roughness < 0.001) {
126					gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
127					return;
128				}
129
130				// Tangent space basis for VNDF sampling
131				vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
132				vec3 tangent = normalize(cross(up, N));
133				vec3 bitangent = cross(N, tangent);
134
135				for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
136					vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
137
138					// For PMREM, V = N, so in tangent space V is always (0, 0, 1)
139					vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
140
141					// Transform H back to world space
142					vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
143					vec3 L = normalize(2.0 * dot(V, H) * H - V);
144
145					float NdotL = max(dot(N, L), 0.0);
146
147					if(NdotL > 0.0) {
148						// Sample environment at fixed mip level
149						// VNDF importance sampling handles the distribution filtering
150						vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
151
152						// Weight by NdotL for the split-sum approximation
153						// VNDF PDF naturally accounts for the visible microfacet distribution
154						prefilteredColor += sampleColor * NdotL;
155						totalWeight += NdotL;
156					}
157				}
158
159				if (totalWeight > 0.0) {
160					prefilteredColor = prefilteredColor / totalWeight;
161				}
162
163				gl_FragColor = vec4(prefilteredColor, 1.0);
164			}
165		`,blending:t.NoBlending,depthTest:!1,depthWrite:!1}))}return i}_compileMaterial(e){let n=new t.Mesh(new t.BufferGeometry,e);this._renderer.compile(n,m)}_sceneToCubeUV(e,n,r,i,a){let o=new t.PerspectiveCamera(90,1,n,r),s=[1,-1,1,1,1,1],l=[1,1,1,-1,-1,-1],u=this._renderer,c=u.autoClear,d=u.toneMapping;u.getClearColor(v),u.toneMapping=t.NoToneMapping,u.autoClear=!1,u.state.buffers.depth.getReversed()&&(u.setRenderTarget(i),u.clearDepth(),u.setRenderTarget(null)),null===this._backgroundBox&&(this._backgroundBox=new t.Mesh(new t.BoxGeometry,new t.MeshBasicMaterial({name:"PMREM.Backgroun
165d",side:t.BackSide,depthWrite:!1,depthTest:!1})));let h=this._backgroundBox,f=h.material,p=!1,m=e.background;m?m.isColor&&(f.color.copy(m),e.background=null,p=!0):(f.color.copy(v),p=!0);for(let t=0;t<6;t++){let n=t%3;0===n?(o.up.set(0,s[t],0),o.position.set(a.x,a.y,a.z),o.lookAt(a.x+l[t],a.y,a.z)):1===n?(o.up.set(0,0,s[t]),o.position.set(a.x,a.y,a.z),o.lookAt(a.x,a.y+l[t],a.z)):(o.up.set(0,s[t],0),o.position.set(a.x,a.y,a.z),o.lookAt(a.x,a.y,a.z+l[t]));let r=this._cubeSize;R(i,n*r,t>2?r:0,r,r),u.setRenderTarget(i),p&&u.render(h,o),u.render(e,o)}u.toneMapping=d,u.autoClear=c,e.background=m}_textureToCubeUV(e,n){let r=this._renderer,i=e.mapping===t.CubeReflectionMapping||e.mapping===t.CubeRefractionMapping;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=C()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=w());let a=i?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=a,a.uniforms.envMap.value=e;let s=this._cubeSize;R(n,0,0,3*s,2*s),r.setRenderTarget(n),r.render(o,m)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let t=1;t<r;t++)this._applyGGXFilter(e,t-1,t);t.autoClear=n}_applyGGXFilter(e,t,n){let r=this._renderer,i=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[n];o.material=a;let s=a.uniforms,l=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),c=Math.sqrt(l*l-u*u),{_lodMax:d}=this,h=this._sizeLods[n],f=3*h*(n>d-4?n-d+4:0),p=4*(this._cubeSize-h);s.envMap.value=e.texture,s.roughness.value=1.25*l*c,s.mipInt.value=d-t,R(i,f,p,3*h,2*h),r.setRenderTarget(i),r.render(o,m),s.envMap.value=i.texture,s.roughness.value=0,s.mipInt.value=d-n,R(e,f,p,3*h,2*h),r.setRenderTarget(e),r.render(o,m)}_blur(e,t,n,r){let i=this._pingPongRenderTarget,a=Math.min(r,Math.PI)/Math.SQRT2;this._blurPass(e,i,t,n,a),this._blurPass(i,e,n,n,a)}_blurPass(e,t,n,r,i){let a=this._renderer,o=this._blurMaterial,s=this._lodMeshes[r];s.material=o;let l=o.uniforms;l.envMap.value=e.texture,l.sigma.value=i,l.mipInt.value=this._lodMax-n;let u=this._sizeLods[r];R(t,3*u*(r>this._lodMax-4?r-this._lodMax+4:0),4*(this._cubeSize-u),3*u,2*u),a.setRenderTarget(t),a.render(s,m)}}function E(e,n,r){let i=new t.WebGLRenderTarget(e,n,r);return i.texture.mapping=t.CubeUVReflectionMapping,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function R(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function w(){return new t.ShaderMaterial({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:y(),fragmentShader:`
166
167			precision mediump float;
168			precision mediump int;
169
170			varying vec3 vOutputDirection;
171
172			uniform sampler2D envMap;
173
174			#include <common>
175
176			void main() {
177
178				vec3 outputDirection = normalize( vOutputDirection );
179				vec2 uv = equirectUv( outputDirection );
180
181				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
182
183			}
184		`,blending:t.NoBlending,depthTest:!1,depthWrite:!1})}function C(){return new t.ShaderMaterial({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:y(),fragmentShader:`
185
186			precision mediump float;
187			precision mediump int;
188
189			uniform float flipEnvMap;
190
191			varying vec3 vOutputDirection;
192
193			uniform samplerCube envMap;
194
195			void main() {
196
197				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
198
199			}
200		`,blending:t.NoBlending,depthTest:!1,depthWrite:!1})}function y(){return`
201
202		precision mediump float;
203		precision mediump int;
204
205		attribute vec3 outputDirection;
206
207		varying vec3 vOutputDirection;
208
209		void main() {
210
211			vOutputDirection = outputDirection;
212			gl_Position = vec4( position, 1.0 );
213
214		}
215	`}class A extends t.WebGLRenderTarget{constructor(e=1,n={}){super(e,e,n),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1};this.texture=new t.CubeTexture([r,r,r,r,r,r]),this._setTextureOptions(n),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,n){this.texture.type=n.type,this.texture.colorSpace=n.colorSpace,this.texture.generateMipmaps=n.generateMipmaps,this.texture.minFilter=n.minFilter,this.texture.magFilter=n.magFilter;let r={uniforms:{tEquirect:{value:null}},vertexShader:`
216
217				varying vec3 vWorldDirection;
218
219				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
220
221					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
222
223				}
224
225				void main() {
226
227					vWorldDirection = transformDirection( position, modelMatrix );
228
229					#include <begin_vertex>
230					#include <project_vertex>
231
232				}
233			`,fragmentShader:`
234
235				uniform sampler2D tEquirect;
236
237				varying vec3 vWorldDirection;
238
239				#include <common>
240
241				void main() {
242
243					vec3 direction = normalize( vWorldDirection );
244
245					vec2 sampleUV = equirectUv( direction );
246
247					gl_FragColor = texture2D( tEquirect, sampleUV );
248
249				}
250			`},i=new t.BoxGeometry(5,5,5),a=new t.ShaderMaterial({name:"CubemapFromEquirect",uniforms:(0,t.cloneUniforms)(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:t.BackSide,blending:t.NoBlending});a.uniforms.tEquirect.value=n;let o=new t.Mesh(i,a),s=n.minFilter;return n.minFilter===t.LinearMipmapLinearFilter&&(n.minFilter=t.LinearFilter),new t.CubeCamera(1,10,this).update(e,o),n.minFilter=s,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let i=e.getRenderTarget();for(let i=0;i<6;i++)e.setRenderTarget(this,i),e.clear(t,n,r);e.setRenderTarget(i)}}function L(e){let n=new WeakMap,r=new WeakMap,i=null;function a(e,n){return n===t.EquirectangularReflectionMapping?e.mapping=t.CubeReflectionMapping:n===t.EquirectangularRefractionMapping&&(e.mapping=t.CubeRefractionMapping),e}function o(e){let t=e.target;t.removeEventListener("dispose",o);let r=n.get(t);void 0!==r&&(n.delete(t),r.dispose())}function s(e){let t=e.target;t.removeEventListener("dispose",s);let n=r.get(t);void 0!==n&&(r.delete(t),n.dispose())}return{get:function(l,u=!1){return null==l?null:u?function(n){if(n&&n.isTexture){let a=n.mapping,o=a===t.EquirectangularReflectionMapping||a===t.EquirectangularRefractionMapping,l=a===t.CubeReflectionMapping||a===t.CubeRefractionMapping;if(o||l){let t=r.get(n),a=void 0!==t?t.texture.pmremVersion:0;if(n.isRenderTargetTexture&&n.pmremVersion!==a)return null===i&&(i=new b(e)),(t=o?i.fromEquirectangular(n,t):i.fromCubemap(n,t)).texture.pmremVersion=n.pmremVersion,r.set(n,t),t.texture;{if(void 0!==t)return t.texture;let a=n.image;return o&&a&&a.height>0||l&&a&&function(e){let t=0;for(let n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(a)?(null===i&&(i=new b(e)),(t=o?i.fromEquirectangular(n):i.fromCubemap(n)).texture.pmremVersion=n.pmremVersion,r.set(n,t),n.addEventListener("dispose",s),t.texture):null}}}return n}(l):function(r){if(r&&r.isTexture){let i=r.mapping;if(i===t.EquirectangularReflectionMapping||i===t.EquirectangularRefractionMapping)if(n.has(r))return a(n.get(r).texture,r.mapping);else{let t=r.image;if(!t||!(t.height>0))return null;{let i=new A(t.height);return i.fromEquirectangularTexture(e,r),n.set(r,i),r.addEventListener("dispose",o),a(i.texture,r.mapping)}}}return r}(l)},dispose:function(){n=new WeakMap,r=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function D(e){let n={};function r(t){if(void 0!==n[t])return n[t];let r=e.getExtension(t);return n[t]=r,r}return{has:function(e){return null!==r(e)},init:function(){r("EXT_color_buffer_float"),r("WEBGL_clip_cull_distance"),r("OES_texture_float_linear"),r("EXT_color_buffer_half_float"),r("WEBGL_multisampled_render_to_texture"),r("WEBGL_render_shared_exponent")},get:function(e){let n=r(e);return null===n&&(0,t.warnOnce)("WebGLRenderer: "+e+" extension not supported."),n}}}function P(e,n,r,i){let a={},o=new WeakMap;function s(e){let t=e.target;for(let e in null!==t.index&&n.remove(t.index),t.attributes)n.remove(t.attributes[e]);t.removeEventListener("dispose",s),delete a[t.id];let l=o.get(t);l&&(n.remove(l),o.delete(t)),i.releaseStatesOfGeometry(t),!0===t.isInstancedBufferGeometry&&delete t._maxInstanceCount,r.memory.geometries--}function l(e){let r=[],i=e.index,a=e.attributes.position,s=0;if(void 0===a)return;if(null!==i){let e=i.array;s=i.version;for(let t=0,n=e.length;t<n;t+=3){let n=e[t+0],i=e[t+1],a=e[t+2];r.push(n,i,i,a,a,n)}}else{let e=a.array;s=a.version;for(let t=0,n=e.length/3-1;t<n;t+=3){let e=t+0,n=t+1,i=t+2;r.push(e,n,n,i,i,e)}}let l=new(a.count>=65535?t.Uint32BufferAttribute:t.Uint16BufferAttribute)(r,1);l.version=s;let u=o.get(e);u&&n.remove(u),o.set(e,l)}return{get:function(e,t){return!0===a[t.id]||(t.addEventListener("dispose",s),a[t.id]=!0,r.memory.geometries++),t},update:function(t){let r=t.attributes;for(let t in r)n.update(r[t],e.ARRAY_BUFFER)},getWireframeAttribute:function(e){let t=o.get(e);if(t){let n=e.index;null!==n&&t.version<n.version&&l(e)}else l(e);return o.get(e)}}}function N(e,t,n){let r,i,a;this.setMode=function(e){r=e},this.setIndex=function(e){i=e.type,a=e.bytesPerElement},this.render=function(t,o){e.drawElements(r,o,i,t*a),n.update(o,r,1)},this.renderInstances=function(t,o,s){0!==s&&(e.drawElementsInstanced(r,o,i,t*a,s),n.update(o,r,s))},this.renderMultiDraw=function(e,a,o){if(0===o)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(r,a,0,i,e,0,o);let s=0;for(let e=0;e<o;e++)s+=a[e];
250n.update(s,r,1)}}function U(e){let n={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:n,programs:null,autoReset:!0,reset:function(){n.calls=0,n.triangles=0,n.points=0,n.lines=0},update:function(r,i,a){switch(n.calls++,i){case e.TRIANGLES:n.triangles+=r/3*a;break;case e.LINES:n.lines+=r/2*a;break;case e.LINE_STRIP:n.lines+=a*(r-1);break;case e.LINE_LOOP:n.lines+=a*r;break;case e.POINTS:n.points+=a*r;break;default:(0,t.error)("WebGLInfo: Unknown draw mode:",i)}}}}function I(e,n,r){let i=new WeakMap,a=new t.Vector4;return{update:function(o,s,l){let u=o.morphTargetInfluences,c=s.morphAttributes.position||s.morphAttributes.normal||s.morphAttributes.color,d=void 0!==c?c.length:0,h=i.get(s);if(void 0===h||h.count!==d){void 0!==h&&h.texture.dispose();let e=void 0!==s.morphAttributes.position,r=void 0!==s.morphAttributes.normal,o=void 0!==s.morphAttributes.color,l=s.morphAttributes.position||[],u=s.morphAttributes.normal||[],c=s.morphAttributes.color||[],f=0;!0===e&&(f=1),!0===r&&(f=2),!0===o&&(f=3);let p=s.attributes.position.count*f,m=1;p>n.maxTextureSize&&(m=Math.ceil(p/n.maxTextureSize),p=n.maxTextureSize);let v=new Float32Array(p*m*4*d),g=new t.DataArrayTexture(v,p,m,d);g.type=t.FloatType,g.needsUpdate=!0;let _=4*f;for(let t=0;t<d;t++){let n=l[t],i=u[t],s=c[t],d=p*m*4*t;for(let t=0;t<n.count;t++){let l=t*_;!0===e&&(a.fromBufferAttribute(n,t),v[d+l+0]=a.x,v[d+l+1]=a.y,v[d+l+2]=a.z,v[d+l+3]=0),!0===r&&(a.fromBufferAttribute(i,t),v[d+l+4]=a.x,v[d+l+5]=a.y,v[d+l+6]=a.z,v[d+l+7]=0),!0===o&&(a.fromBufferAttribute(s,t),v[d+l+8]=a.x,v[d+l+9]=a.y,v[d+l+10]=a.z,v[d+l+11]=4===s.itemSize?a.w:1)}}h={count:d,texture:g,size:new t.Vector2(p,m)},i.set(s,h),s.addEventListener("dispose",function e(){g.dispose(),i.delete(s),s.removeEventListener("dispose",e)})}if(!0===o.isInstancedMesh&&null!==o.morphTexture)l.getUniforms().setValue(e,"morphTexture",o.morphTexture,r);else{let t=0;for(let e=0;e<u.length;e++)t+=u[e];let n=s.morphTargetsRelative?1:1-t;l.getUniforms().setValue(e,"morphTargetBaseInfluence",n),l.getUniforms().setValue(e,"morphTargetInfluences",u)}l.getUniforms().setValue(e,"morphTargetsTexture",h.texture,r),l.getUniforms().setValue(e,"morphTargetsTextureSize",h.size)}}}function F(e,t,n,r,i){let a=new WeakMap;function o(e){let t=e.target;t.removeEventListener("dispose",o),r.releaseStatesOfObject(t),n.remove(t.instanceMatrix),null!==t.instanceColor&&n.remove(t.instanceColor)}return{update:function(r){let s=i.render.frame,l=r.geometry,u=t.get(r,l);if(a.get(u)!==s&&(t.update(u),a.set(u,s)),r.isInstancedMesh&&(!1===r.hasEventListener("dispose",o)&&r.addEventListener("dispose",o),a.get(r)!==s&&(n.update(r.instanceMatrix,e.ARRAY_BUFFER),null!==r.instanceColor&&n.update(r.instanceColor,e.ARRAY_BUFFER),a.set(r,s))),r.isSkinnedMesh){let e=r.skeleton;a.get(e)!==s&&(e.update(),a.set(e,s))}return u},dispose:function(){a=new WeakMap}}}let O={[t.LinearToneMapping]:"LINEAR_TONE_MAPPING",[t.ReinhardToneMapping]:"REINHARD_TONE_MAPPING",[t.CineonToneMapping]:"CINEON_TONE_MAPPING",[t.ACESFilmicToneMapping]:"ACES_FILMIC_TONE_MAPPING",[t.AgXToneMapping]:"AGX_TONE_MAPPING",[t.NeutralToneMapping]:"NEUTRAL_TONE_MAPPING",[t.CustomToneMapping]:"CUSTOM_TONE_MAPPING"};function B(e,n,r,i,a,o){let s,l=new t.WebGLRenderTarget(n,r,{type:e,depthBuffer:a,stencilBuffer:o,samples:4*!!i,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,resolveDepthBuffer:!1,resolveStencilBuffer:!1}),u=null,c=null,d=new t.BufferGeometry;d.setAttribute("position",new t.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),d.setAttribute("uv",new t.Float32BufferAttribute([0,2,0,0,2,0],2));let h=new t.RawShaderMaterial({uniforms:{tDiffuse:{value:null}},vertexShader:`
251			precision highp float;
252
253			uniform mat4 modelViewMatrix;
254			uniform mat4 projectionMatrix;
255
256			attribute vec3 position;
257			attribute vec2 uv;
258
259			varying vec2 vUv;
260
261			void main() {
262				vUv = uv;
263				gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
264			}`,fragmentShader:`
265			precision highp float;
266
267			uniform sampler2D tDiffuse;
268
269			varying vec2 vUv;
270
271			#include <tonemapping_pars_fragment>
272			#include <colorspace_pars_fragment>
273
274			void main() {
275				gl_FragColor = texture2D( tDiffuse, vUv );
276
277				#ifdef LINEAR_TONE_MAPPING
278					gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
279				#elif defined( REINHARD_TONE_MAPPING )
280					gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
281				#elif defined( CINEON_TONE_MAPPING )
282					gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
283				#elif defined( ACES_FILMIC_TONE_MAPPING )
284					gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
285				#elif defined( AGX_TONE_MAPPING )
286					gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
287				#elif defined( NEUTRAL_TONE_MAPPING )
288					gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
289				#elif defined( CUSTOM_TONE_MAPPING )
290					gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
291				#endif
292
293				#ifdef SRGB_TRANSFER
294					gl_FragColor = sRGBTransferOETF( gl_FragColor );
295				#endif
296			}`,depthTest:!1,depthWrite:!1}
296),f=new t.Mesh(d,h),p=new t.OrthographicCamera(-1,1,1,-1,0,1),m=null,v=null,g=!1,_=null,S=[],x=!1;this.setSize=function(e,t){l.setSize(e,t),null!==u&&u.setSize(e,t),null!==c&&c.setSize(e,t);for(let n=0;n<S.length;n++){let r=S[n];r.setSize&&r.setSize(e,t)}},this.setEffects=function(e){x=(S=e).length>0&&!0===S[0].isRenderPass;let n=l.width,r=l.height;S.length>0&&null===u&&(u=new t.WebGLRenderTarget(n,r,{type:t.HalfFloatType,depthBuffer:!1,stencilBuffer:!1}),c=new t.WebGLRenderTarget(n,r,{type:t.HalfFloatType,depthBuffer:!1,stencilBuffer:!1}));for(let e=0;e<S.length;e++){let t=S[e];t.setSize&&t.setSize(n,r)}},this.begin=function(e,n){if(g||e.toneMapping===t.NoToneMapping&&0===S.length)return!1;if(_=n,null!==n){let e=n.width,t=n.height;(l.width!==e||l.height!==t)&&this.setSize(e,t)}return!1===x&&e.setRenderTarget(l),s=e.toneMapping,e.toneMapping=t.NoToneMapping,!0},this.hasRenderPass=function(){return x},this.end=function(e,n){e.toneMapping=s,g=!0;let r=l,i=u;for(let t=0;t<S.length;t++){let a=S[t];!1!==a.enabled&&(a.render(e,i,r,n),!1!==a.needsSwap&&(r=i,i=i===u?c:u))}if(m!==e.outputColorSpace||v!==e.toneMapping){m=e.outputColorSpace,v=e.toneMapping,h.defines={},t.ColorManagement.getTransfer(m)===t.SRGBTransfer&&(h.defines.SRGB_TRANSFER="");let n=O[v];n&&(h.defines[n]=""),h.needsUpdate=!0}h.uniforms.tDiffuse.value=r.texture,e.setRenderTarget(_),e.render(f,p),_=null,g=!1},this.isCompositing=function(){return g},this.dispose=function(){l.dispose(),null!==u&&u.dispose(),null!==c&&c.dispose(),d.dispose(),h.dispose()}}let G=new t.Texture,H=new t.DepthTexture(1,1),k=new t.DataArrayTexture,V=new t.Data3DTexture,z=new t.CubeTexture,W=[],X=[],K=new Float32Array(16),j=new Float32Array(9),q=new Float32Array(4);function Y(e,t,n){let r=e[0];if(r<=0||r>0)return e;let i=t*n,a=W[i];if(void 0===a&&(a=new Float32Array(i),W[i]=a),0!==t){r.toArray(a,0);for(let r=1,i=0;r!==t;++r)i+=n,e[r].toArray(a,i)}return a}function Z(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function $(e,t){for(let n=0,r=t.length;n<r;n++)e[n]=t[n]}function Q(e,t){let n=X[t];void 0===n&&(n=new Int32Array(t),X[t]=n);for(let r=0;r!==t;++r)n[r]=e.allocateTextureUnit();return n}function J(e,t){let n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function ee(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(Z(n,t))return;e.uniform2fv(this.addr,t),$(n,t)}}function et(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)(n[0]!==t.r||n[1]!==t.g||n[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(Z(n,t))return;e.uniform3fv(this.addr,t),$(n,t)}}function en(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(Z(n,t))return;e.uniform4fv(this.addr,t),$(n,t)}}function er(e,t){let n=this.cache,r=t.elements;if(void 0===r){if(Z(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),$(n,t)}else{if(Z(n,r))return;q.set(r),e.uniformMatrix2fv(this.addr,!1,q),$(n,r)}}function ei(e,t){let n=this.cache,r=t.elements;if(void 0===r){if(Z(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),$(n,t)}else{if(Z(n,r))return;j.set(r),e.uniformMatrix3fv(this.addr,!1,j),$(n,r)}}function ea(e,t){let n=this.cache,r=t.elements;if(void 0===r){if(Z(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),$(n,t)}else{if(Z(n,r))return;K.set(r),e.uniformMatrix4fv(this.addr,!1,K),$(n,r)}}function eo(e,t){let n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function es(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(Z(n,t))return;e.uniform2iv(this.addr,t),$(n,t)}}function el(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(Z(n,t))return;e.uniform3iv(this.addr,t),$(n,t)}}function eu(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(Z(n,t))return;e.uniform4iv(this.addr,t),$(n,t)}}function ec(e,t){let n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function ed(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(Z(n,t))return;e.uniform2uiv(this.addr,t),$(n,t)}}function eh(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(Z(n,t))return;e.uniform3uiv(this.addr,t),$(n,t)}}function ef(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(Z(n,t))return;e.uniform4uiv(this.addr,t),$(n,t)}}function ep(e,n,r){let i,a=this.cache,o=r.allocateTextureUnit();a[0]!==o&&(e.uniform1i(this.addr,o),a[0]=o),this.type===e.SAMPLER_2D_SHADOW?(H.c
296ompareFunction=r.isReversedDepthBuffer()?t.GreaterEqualCompare:t.LessEqualCompare,i=H):i=G,r.setTexture2D(n||i,o)}function em(e,t,n){let r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(t||V,i)}function ev(e,t,n){let r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(t||z,i)}function eg(e,t,n){let r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(t||k,i)}function e_(e,t){e.uniform1fv(this.addr,t)}function eS(e,t){let n=Y(t,this.size,2);e.uniform2fv(this.addr,n)}function ex(e,t){let n=Y(t,this.size,3);e.uniform3fv(this.addr,n)}function eT(e,t){let n=Y(t,this.size,4);e.uniform4fv(this.addr,n)}function eM(e,t){let n=Y(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function eb(e,t){let n=Y(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function eE(e,t){let n=Y(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function eR(e,t){e.uniform1iv(this.addr,t)}function ew(e,t){e.uniform2iv(this.addr,t)}function eC(e,t){e.uniform3iv(this.addr,t)}function ey(e,t){e.uniform4iv(this.addr,t)}function eA(e,t){e.uniform1uiv(this.addr,t)}function eL(e,t){e.uniform2uiv(this.addr,t)}function eD(e,t){e.uniform3uiv(this.addr,t)}function eP(e,t){e.uniform4uiv(this.addr,t)}function eN(e,t,n){let r,i=this.cache,a=t.length,o=Q(n,a);Z(i,o)||(e.uniform1iv(this.addr,o),$(i,o)),r=this.type===e.SAMPLER_2D_SHADOW?H:G;for(let e=0;e!==a;++e)n.setTexture2D(t[e]||r,o[e])}function eU(e,t,n){let r=this.cache,i=t.length,a=Q(n,i);Z(r,a)||(e.uniform1iv(this.addr,a),$(r,a));for(let e=0;e!==i;++e)n.setTexture3D(t[e]||V,a[e])}function eI(e,t,n){let r=this.cache,i=t.length,a=Q(n,i);Z(r,a)||(e.uniform1iv(this.addr,a),$(r,a));for(let e=0;e!==i;++e)n.setTextureCube(t[e]||z,a[e])}function eF(e,t,n){let r=this.cache,i=t.length,a=Q(n,i);Z(r,a)||(e.uniform1iv(this.addr,a),$(r,a));for(let e=0;e!==i;++e)n.setTexture2DArray(t[e]||k,a[e])}class eO{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=function(e){switch(e){case 5126:return J;case 35664:return ee;case 35665:return et;case 35666:return en;case 35674:return er;case 35675:return ei;case 35676:return ea;case 5124:case 35670:return eo;case 35667:case 35671:return es;case 35668:case 35672:return el;case 35669:case 35673:return eu;case 5125:return ec;case 36294:return ed;case 36295:return eh;case 36296:return ef;case 35678:case 36198:case 36298:case 36306:case 35682:return ep;case 35679:case 36299:case 36307:return em;case 35680:case 36300:case 36308:case 36293:return ev;case 36289:case 36303:case 36311:case 36292:return eg}}(t.type)}}class eB{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return e_;case 35664:return eS;case 35665:return ex;case 35666:return eT;case 35674:return eM;case 35675:return eb;case 35676:return eE;case 5124:case 35670:return eR;case 35667:case 35671:return ew;case 35668:case 35672:return eC;case 35669:case 35673:return ey;case 5125:return eA;case 36294:return eL;case 36295:return eD;case 36296:return eP;case 35678:case 36198:case 36298:case 36306:case 35682:return eN;case 35679:case 36299:case 36307:return eU;case 35680:case 36300:case 36308:case 36293:return eI;case 36289:case 36303:case 36311:case 36292:return eF}}(t.type)}}class eG{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){let r=this.seq;for(let i=0,a=r.length;i!==a;++i){let a=r[i];a.setValue(e,t[a.id],n)}}}let eH=/(\w+)(\])?(\[|\.)?/g;function ek(e,t){e.seq.push(t),e.map[t.id]=t}class eV{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<n;++r){const n=e.getActiveUniform(t,r),i=e.getUniformLocation(t,n.name);!function(e,t,n){let r=e.name,i=r.length;for(eH.lastIndex=0;;){let a=eH.exec(r),o=eH.lastIndex,s=a[1],l="]"===a[2],u=a[3];if(l&&(s|=0),void 0===u||"["===u&&o+2===i){ek(n,void 0===u?new eO(s,e,t):new eB(s,e,t));break}{let e=n.map[s];void 0===e&&ek(n,e=new eG(s)),n=e}}}(n,i,this)}const r=[],i=[];for(const t of this.seq)t.type===e.SAMPLER_2D_SHADOW||t.type===e.SAMPLER_CUBE_SHADOW||t.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(t):i.push(t);r.length>0&&(this.seq=r.concat(i))}setValue(e,t,n,r){let i=this.map[t];void 0!==i&&i.setValue(e,n,r)}setOptional(e,t,n){let r=t[n];void 0!==r&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let i=0,a=t.length;i!==a;++i){let a=t[i],o=n[a.id];!1!==o.needsUpdate&&a.setValue(e,o.value,r)}}static seqWithValue(e,t){let n=[];for(let r=0,i=e.length;r!==i;++r){let i=e[r];i.id in t&&n.push(i)}return n}}function ez(e,t,n){let r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),r}let eW=0,eX=new t.Matrix3;
296function eK(e,t,n){let r=e.getShaderParameter(t,e.COMPILE_STATUS),i=(e.getShaderInfoLog(t)||"").trim();if(r&&""===i)return"";let a=/ERROR: 0:(\d+)/.exec(i);if(!a)return i;{let r=parseInt(a[1]);return n.toUpperCase()+"\n\n"+i+"\n\n"+function(e,t){let n=e.split("\n"),r=[],i=Math.max(t-6,0),a=Math.min(t+6,n.length);for(let e=i;e<a;e++){let i=e+1;r.push(`${i===t?">":" "} ${i}: ${n[e]}`)}return r.join("\n")}(e.getShaderSource(t),r)}}let ej={[t.LinearToneMapping]:"Linear",[t.ReinhardToneMapping]:"Reinhard",[t.CineonToneMapping]:"Cineon",[t.ACESFilmicToneMapping]:"ACESFilmic",[t.AgXToneMapping]:"AgX",[t.NeutralToneMapping]:"Neutral",[t.CustomToneMapping]:"Custom"},eq=new t.Vector3;function eY(e){return""!==e}function eZ(e,t){let n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_SUN_LIGHTS/g,t.numSunLights).replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_SUN_LIGHT_SHADOWS/g,t.numSunLightShadows).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function e$(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}let eQ=/^[ \t]*#include +<([\w\d./]+)>/gm;function eJ(e){return e.replace(eQ,e1)}let e0=new Map;function e1(e,n){let r=i[n];if(void 0===r){let e=e0.get(n);if(void 0!==e)r=i[e],(0,t.warn)('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',n,e);else throw Error("THREE.WebGLProgram: Can not resolve #include <"+n+">")}return eJ(r)}let e3=/#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 e2(e){return e.replace(e3,e5)}function e5(e,t,n,r){let i="";for(let e=parseInt(t);e<parseInt(n);e++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return i}function e4(e){let t=`precision ${e.precision} float;
297	precision ${e.precision} int;
298	precision ${e.precision} sampler2D;
299	precision ${e.precision} samplerCube;
300	precision ${e.precision} sampler3D;
301	precision ${e.precision} sampler2DArray;
302	precision ${e.precision} sampler2DShadow;
303	precision ${e.precision} samplerCubeShadow;
304	precision ${e.precision} sampler2DArrayShadow;
305	precision ${e.precision} isampler2D;
306	precision ${e.precision} isampler3D;
307	precision ${e.precision} isamplerCube;
308	precision ${e.precision} isampler2DArray;
309	precision ${e.precision} usampler2D;
310	precision ${e.precision} usampler3D;
311	precision ${e.precision} usamplerCube;
312	precision ${e.precision} usampler2DArray;
313	`;return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}let e8={[t.PCFShadowMap]:"SHADOWMAP_TYPE_PCF",[t.VSMShadowMap]:"SHADOWMAP_TYPE_VSM"},e6={[t.CubeReflectionMapping]:"ENVMAP_TYPE_CUBE",[t.CubeRefractionMapping]:"ENVMAP_TYPE_CUBE",[t.CubeUVReflectionMapping]:"ENVMAP_TYPE_CUBE_UV"},e9={[t.CubeRefractionMapping]:"ENVMAP_MODE_REFRACTION"},e7={[t.MultiplyOperation]:"ENVMAP_BLENDING_MULTIPLY",[t.MixOperation]:"ENVMAP_BLENDING_MIX",[t.AddOperation]:"ENVMAP_BLENDING_ADD"};function te(e,n,r,a){var o,s;let l,u,c,d,h=e.getContext(),f=r.defines,p=r.vertexShader,m=r.fragmentShader,v=e8[r.shadowMapType]||"SHADOWMAP_TYPE_BASIC",g=!1===r.envMap?"ENVMAP_TYPE_CUBE":e6[r.envMapMode]||"ENVMAP_TYPE_CUBE",_=!1===r.envMap?"ENVMAP_MODE_REFLECTION":e9[r.envMapMode]||"ENVMAP_MODE_REFLECTION",S=!1===r.envMap?"ENVMAP_BLENDING_NONE":e7[r.combine]||"ENVMAP_BLENDING_NONE",x=function(e){let t=e.envMapCubeUVHeight;if(null===t)return null;let n=Math.log2(t)-2;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:1/t,maxMip:n}}
vendor: 7,361 bytes, line 313
313(r),T=[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(eY).join("\n"),M=function(e){let t=[];for(let n in e){let r=e[n];!1!==r&&t.push("#define "+n+" "+r)}return t.join("\n")}(f),b=h.createProgram(),E=r.glslVersion?"#version "+r.glslVersion+"\n":"";if(r.isRawShaderMaterial)(l=["#define SHADER_TYPE "+r.shaderType,"#define SHADER_NAME "+r.shaderName,M].filter(eY).join("\n")).length>0&&(l+="\n"),(u=["#define SHADER_TYPE "+r.shaderType,"#define SHADER_NAME "+r.shaderName,M].filter(eY).join("\n")).length>0&&(u+="\n");else{let e,n,a,c,d;l=[e4(r),"#define SHADER_TYPE "+r.shaderType,"#define SHADER_NAME "+r.shaderName,M,r.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",r.batching?"#define USE_BATCHING":"",r.batchingColor?"#define USE_BATCHING_COLOR":"",r.instancing?"#define USE_INSTANCING":"",r.instancingColor?"#define USE_INSTANCING_COLOR":"",r.instancingMorph?"#define USE_INSTANCING_MORPH":"",r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+_:"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",r.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",r.displacementMap?"#define USE_DISPLACEMENTMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.anisotropy?"#define USE_ANISOTROPY":"",r.anisotropyMap?"#define USE_ANISOTROPYMAP":"",r.clearcoatMap?"#define USE_CLEARCOATMAP":"",r.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",r.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",r.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",r.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",r.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.alphaHash?"#define USE_ALPHAHASH":"",r.transmission?"#define USE_TRANSMISSION":"",r.transmissionMap?"#define USE_TRANSMISSIONMAP":"",r.thicknessMap?"#define USE_THICKNESSMAP":"",r.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",r.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",r.mapUv?"#define MAP_UV "+r.mapUv:"",r.alphaMapUv?"#define ALPHAMAP_UV "+r.alphaMapUv:"",r.lightMapUv?"#define LIGHTMAP_UV "+r.lightMapUv:"",r.aoMapUv?"#define AOMAP_UV "+r.aoMapUv:"",r.emissiveMapUv?"#define EMISSIVEMAP_UV "+r.emissiveMapUv:"",r.bumpMapUv?"#define BUMPMAP_UV "+r.bumpMapUv:"",r.normalMapUv?"#define NORMALMAP_UV "+r.normalMapUv:"",r.displacementMapUv?"#define DISPLACEMENTMAP_UV "+r.displacementMapUv:"",r.metalnessMapUv?"#define METALNESSMAP_UV "+r.metalnessMapUv:"",r.roughnessMapUv?"#define ROUGHNESSMAP_UV "+r.roughnessMapUv:"",r.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+r.anisotropyMapUv:"",r.clearcoatMapUv?"#define CLEARCOATMAP_UV "+r.clearcoatMapUv:"",r.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+r.clearcoatNormalMapUv:"",r.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+r.clearcoatRoughnessMapUv:"",r.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+r.iridescenceMapUv:"",r.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+r.iridescenceThicknessMapUv:"",r.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+r.sheenColorMapUv:"",r.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+r.sheenRoughnessMapUv:"",r.specularMapUv?"#define SPECULARMAP_UV "+r.specularMapUv:"",r.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+r.specularColorMapUv:"",r.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+r.specularIntensityMapUv:"",r.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+r.transmissionMapUv:"",r.thicknessMapUv?"#define THICKNESSMAP_UV "+r.thicknessMapUv:"",r.vertexTangents&&!1===r.flatShading?"#define USE_TANGENT":"",r.vertexNormals?"#define HAS_NORMAL":"",r.vertexColors?"#define USE_COLOR":"",r.vertexAlphas?"#define USE_COLOR_ALPHA":"",r.vertexUv1s?"#define USE_UV1":"",r.vertexUv2s?"#define USE_UV2":"",r.vertexUv3s?"#define USE_UV3":"",r.pointsUvs?"#define USE_POINTS_UV":"",r.flatShading?"#define FLAT_SHADED":"",r.skinning?"#define USE_SKINNING":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.morphNormals&&!1===r.flatShading?"#define USE_MORPHNORMALS":"",r.morphColors?"#define USE_MORPHCOLORS":"",r.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+r.morphTextureStride:"",r.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+r.morphTargetsCount:"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"",r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+v:"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"",r.numLightProbes>0?"#define USE_LIGHT_PROBES":"",r.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",r.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","	uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","	attribute vec2 uv1;","#endif","#ifdef USE_UV2","	attribute vec2 uv2;","#endif","#ifdef USE_UV3","	attribute vec2 uv3;","#endif","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif","\n"].filter(eY).join("\n"),u=[e4(r),"#define SHADER_TYPE "+r.shaderType,"#define SHADER_NAME "+r.shaderName,M,r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp2?"#define FOG_EXP2":"",r.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",r.map?"#define USE_MAP":"",r.matcap?"#define USE_MATCAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+g:"",r.envMap?"#define "+_:"",r.envMap?"#define "+S:"",x?"#define CUBEUV_TEXEL_WIDTH "+x.texelWidth:"",x?"#define CUBEUV_TEXEL_HEIGHT "+x.texelHeight:"",x?"#define CUBEUV_MAX_MIP "+x.maxMip+".0":"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",r.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",r.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.anisotropy?"#define USE_ANISOTROPY":"",r.anisotropyMap?"#define USE_ANISOTROPYMAP":"",r.clearcoat?"#define USE_CLEARCOAT":"",r.clearcoatMap?"#define USE_CLEARCOATMAP":"",r.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",r.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",r.dispersion?"#define USE_DISPERSION":"",r.retroreflection?"#define USE_RETROREFLECTION":"",r.iridescence?"#define USE_IR
313IDESCENCE":"",r.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",r.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",r.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.alphaTest?"#define USE_ALPHATEST":"",r.alphaHash?"#define USE_ALPHAHASH":"",r.sheen?"#define USE_SHEEN":"",r.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",r.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",r.transmission?"#define USE_TRANSMISSION":"",r.transmissionMap?"#define USE_TRANSMISSIONMAP":"",r.thicknessMap?"#define USE_THICKNESSMAP":"",r.vertexTangents&&!1===r.flatShading?"#define USE_TANGENT":"",r.vertexColors||r.instancingColor?"#define USE_COLOR":"",r.vertexAlphas||r.batchingColor?"#define USE_COLOR_ALPHA":"",r.vertexUv1s?"#define USE_UV1":"",r.vertexUv2s?"#define USE_UV2":"",r.vertexUv3s?"#define USE_UV3":"",r.pointsUvs?"#define USE_POINTS_UV":"",r.gradientMap?"#define USE_GRADIENTMAP":"",r.flatShading?"#define FLAT_SHADED":"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"",r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+v:"",r.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",r.numLightProbes>0?"#define USE_LIGHT_PROBES":"",r.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",r.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",r.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",r.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",r.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",r.toneMapping!==t.NoToneMapping?"#define TONE_MAPPING":"",r.toneMapping!==t.NoToneMapping?i.tonemapping_pars_fragment:"",r.toneMapping!==t.NoToneMapping?(o="toneMapping",void 0===(e=ej[s=r.toneMapping])?((0,t.warn)("WebGLProgram: Unsupported toneMapping:",s),"vec3 "+o+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+o+"( vec3 color ) { return "+e+"ToneMapping( color ); }"):"",r.dithering?"#define DITHERING":"",r.opaque?"#define OPAQUE":"",i.colorspace_pars_fragment,(n=function(e){t.ColorManagement._getMatrix(eX,t.ColorManagement.workingColorSpace,e);let n=`mat3( ${eX.elements.map(e=>e.toFixed(4))} )`;switch(t.ColorManagement.getTransfer(e)){case t.LinearTransfer:return[n,"LinearTransferOETF"];case t.SRGBTransfer:return[n,"sRGBTransferOETF"];default:return(0,t.warn)("WebGLProgram: Unsupported color space: ",e),[n,"LinearTransferOETF"]}}(r.outputColorSpace),`vec4 linearToOutputTexel( vec4 value ) {
314	return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );
315}`),(t.ColorManagement.getLuminanceCoefficients(eq),a=eq.x.toFixed(4),c=eq.y.toFixed(4),d=eq.z.toFixed(4),`float luminance( const in vec3 rgb ) {
316	const vec3 weights = vec3( ${a}, ${c}, ${d} );
317	return dot( weights, rgb );
318}`),r.useDepthPacking?"#define DEPTH_PACKING "+r.depthPacking:"","\n"].filter(eY).join("\n")}p=e$(p=eZ(p=eJ(p),r),r),m=e$(m=eZ(m=eJ(m),r),r),p=e2(p),m=e2(m),!0!==r.isRawShaderMaterial&&(E="#version 300 es\n",l=[T,"#define attribute in\n#define varying out\n#define texture2D texture"].join("\n")+"\n"+l,u=["#define varying in",r.glslVersion===t.GLSL3?"":"layout(location = 0) out highp vec4 pc_fragColor;",r.glslVersion===t.GLSL3?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+u);let R=E+l+p,w=E+u+m,C=ez(h,h.VERTEX_SHADER,R),y=ez(h,h.FRAGMENT_SHADER,w);function A(n){if(e.debug.checkShaderErrors){let r=h.getProgramInfoLog(b)||"",i=h.getShaderInfoLog(C)||"",a=h.getShaderInfoLog(y)||"",o=r.trim(),s=i.trim(),c=a.trim(),d=!0,f=!0;if(!1===h.getProgramParameter(b,h.LINK_STATUS))if(d=!1,"function"==typeof e.debug.onSha
318derError)e.debug.onShaderError(h,b,C,y);else{let e=eK(h,C,"vertex"),r=eK(h,y,"fragment");(0,t.error)("WebGLProgram: Shader Error "+h.getError()+" - VALIDATE_STATUS "+h.getProgramParameter(b,h.VALIDATE_STATUS)+"\n\nMaterial Name: "+n.name+"\nMaterial Type: "+n.type+"\n\nProgram Info Log: "+o+"\n"+e+"\n"+r)}else""!==o?(0,t.warn)("WebGLProgram: Program Info Log:",o):(""===s||""===c)&&(f=!1);f&&(n.diagnostics={runnable:d,programLog:o,vertexShader:{log:s,prefix:l},fragmentShader:{log:c,prefix:u}})}h.deleteShader(C),h.deleteShader(y),c=new eV(h,b),d=function(e,t){let n={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let i=0;i<r;i++){let r=e.getActiveAttrib(t,i),a=r.name,o=1;r.type===e.FLOAT_MAT2&&(o=2),r.type===e.FLOAT_MAT3&&(o=3),r.type===e.FLOAT_MAT4&&(o=4),n[a]={type:r.type,location:e.getAttribLocation(t,a),locationSize:o}}return n}(h,b)}h.attachShader(b,C),h.attachShader(b,y),void 0!==r.index0AttributeName?h.bindAttribLocation(b,0,r.index0AttributeName):!0===r.hasPositionAttribute&&h.bindAttribLocation(b,0,"position"),h.linkProgram(b),this.getUniforms=function(){return void 0===c&&A(this),c},this.getAttributes=function(){return void 0===d&&A(this),d};let L=!1===r.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===L&&(L=h.getProgramParameter(b,37297)),L},this.destroy=function(){a.releaseStatesOfProgram(this),h.deleteProgram(b),this.program=void 0},this.type=r.shaderType,this.name=r.shaderName,this.id=eW++,this.cacheKey=n,this.usedTimes=1,this.program=b,this.vertexShader=C,this.fragmentShader=y,this}let tt=0;class tn{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){let r=this._getShaderCacheForMaterial(e);return!1===r.has(t)&&(r.add(t),t.usedTimes++),!1===r.has(n)&&(r.add(n),n.usedTimes++),this}remove(e){for(let t of this.materialCache.get(e))t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return void 0===n&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return void 0===n&&(n=new tr(e),t.set(e,n)),n}}class tr{constructor(e){this.id=tt++,this.code=e,this.usedTimes=0}}function ti(e,n,r,i,a,s){let l=new t.Layers,u=new tn,c=new Set,d=[],h=new Map,f=i.logarithmicDepthBuffer,p=i.precision,m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function v(e){return(c.add(e),0===e)?"uv":`uv${e}`}return{getParameters:function(a,l,d,h,g,_){var S;let x,T,M,b,E=h.fog,R=g.geometry,w=a.isMeshStandardMaterial||a.isMeshLambertMaterial||a.isMeshPhongMaterial?h.environment:null,C=a.isMeshStandardMaterial||a.isMeshLambertMaterial&&!a.envMap||a.isMeshPhongMaterial&&!a.envMap,y=n.get(a.envMap||w,C),A=y&&y.mapping===t.CubeUVReflectionMapping?y.image.height:null,L=m[a.type];null!==a.precision&&(p=i.getMaxPrecision(a.precision))!==a.precision&&(0,t.warn)("WebGLProgram.getParameters:",a.precision,"not supported, using",p,"instead.");let D=R.morphAttributes.position||R.morphAttributes.normal||R.morphAttributes.color,P=void 0!==D?D.length:0,N=0;if(void 0!==R.morphAttributes.position&&(N=1),void 0!==R.morphAttributes.normal&&(N=2),void 0!==R.morphAttributes.color&&(N=3),L){let e=o[L];x=e.vertexShader,T=e.fragmentShader}else{x=a.vertexShader,T=a.fragmentShader;let e=u.getVertexShaderStage(a),t=u.getFragmentShaderStage(a);u.update(a,e,t),M=e.id,b=t.id}let U=e.getRenderTarget(),I=e.state.buffers.depth.getReversed(),F=!0===g.isInstancedMesh,O=!0===g.isBatchedMesh,B=!!a.map,G=!!a.matcap,H=!!y,k=!!a.aoMap,V=!!a.lightMap,z=!!a.bumpMap&&
vendor: 1,401 bytes, line 318
318!1===a.wireframe,W=!!a.normalMap,X=!!a.displacementMap,K=!!a.emissiveMap,j=!!a.metalnessMap,q=!!a.roughnessMap,Y=a.anisotropy>0,Z=a.clearcoat>0,$=a.dispersion>0,Q=a.retroreflectivity>0,J=a.iridescence>0,ee=a.sheen>0,et=a.transmission>0,en=Y&&!!a.anisotropyMap,er=Z&&!!a.clearcoatMap,ei=Z&&!!a.clearcoatNormalMap,ea=Z&&!!a.clearcoatRoughnessMap,eo=J&&!!a.iridescenceMap,es=J&&!!a.iridescenceThicknessMap,el=ee&&!!a.sheenColorMap,eu=ee&&!!a.sheenRoughnessMap,ec=!!a.specularMap,ed=!!a.specularColorMap,eh=!!a.specularIntensityMap,ef=et&&!!a.transmissionMap,ep=et&&!!a.thicknessMap,em=!!a.gradientMap,ev=!!a.alphaMap,eg=a.alphaTest>0,e_=!!a.alphaHash,eS=!!a.extensions,ex=t.NoToneMapping;a.toneMapped&&(null===U||!0===U.isXRRenderTarget)&&(ex=e.toneMapping);let eT={shaderID:L,shaderType:a.type,shaderName:a.name,vertexShader:x,fragmentShader:T,defines:a.defines,customVertexShaderID:M,customFragmentShaderID:b,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:p,batching:O,batchingColor:O&&null!==g._colorsTexture,instancing:F,instancingColor:F&&null!==g.instanceColor,instancingMorph:F&&null!==g.morphTexture,outputColorSpace:null===U?e.outputColorSpace:!0===U.isXRRenderTarget?U.texture.colorSpace:t.ColorManagement.workingColorSpace,alphaToCoverage:!!a.alphaToCoverage,map:B,matcap:G,envMap:H,envMapMode:H&&y.mapping,envMapCubeUVHeight:A,aoMap:k,lightMap:V,bumpMap:z,
vendor: 7,763 bytes, line 318
318normalMap:W,displacementMap:X,emissiveMap:K,normalMapObjectSpace:W&&a.normalMapType===t.ObjectSpaceNormalMap,normalMapTangentSpace:W&&a.normalMapType===t.TangentSpaceNormalMap,packedNormalMap:W&&a.normalMapType===t.TangentSpaceNormalMap&&((S=a.normalMap.format)===t.RGFormat||S===t.RG11_EAC_Format||S===t.RED_GREEN_RGTC2_Format),metalnessMap:j,roughnessMap:q,anisotropy:Y,anisotropyMap:en,clearcoat:Z,clearcoatMap:er,clearcoatNormalMap:ei,clearcoatRoughnessMap:ea,dispersion:$,retroreflection:Q,iridescence:J,iridescenceMap:eo,iridescenceThicknessMap:es,sheen:ee,sheenColorMap:el,sheenRoughnessMap:eu,specularMap:ec,specularColorMap:ed,specularIntensityMap:eh,transmission:et,transmissionMap:ef,thicknessMap:ep,gradientMap:em,opaque:!1===a.transparent&&a.blending===t.NormalBlending&&!1===a.alphaToCoverage,alphaMap:ev,alphaTest:eg,alphaHash:e_,combine:a.combine,mapUv:B&&v(a.map.channel),aoMapUv:k&&v(a.aoMap.channel),lightMapUv:V&&v(a.lightMap.channel),bumpMapUv:z&&v(a.bumpMap.channel),normalMapUv:W&&v(a.normalMap.channel),displacementMapUv:X&&v(a.displacementMap.channel),emissiveMapUv:K&&v(a.emissiveMap.channel),metalnessMapUv:j&&v(a.metalnessMap.channel),roughnessMapUv:q&&v(a.roughnessMap.channel),anisotropyMapUv:en&&v(a.anisotropyMap.channel),clearcoatMapUv:er&&v(a.clearcoatMap.channel),clearcoatNormalMapUv:ei&&v(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ea&&v(a.clearcoatRoughnessMap.channel),iridescenceMapUv:eo&&v(a.iridescenceMap.channel),iridescenceThicknessMapUv:es&&v(a.iridescenceThicknessMap.channel),sheenColorMapUv:el&&v(a.sheenColorMap.channel),sheenRoughnessMapUv:eu&&v(a.sheenRoughnessMap.channel),specularMapUv:ec&&v(a.specularMap.channel),specularColorMapUv:ed&&v(a.specularColorMap.channel),specularIntensityMapUv:eh&&v(a.specularIntensityMap.channel),transmissionMapUv:ef&&v(a.transmissionMap.channel),thicknessMapUv:ep&&v(a.thicknessMap.channel),alphaMapUv:ev&&v(a.alphaMap.channel),vertexTangents:!!R.attributes.tangent&&(W||Y),vertexNormals:!!R.attributes.normal,vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!R.attributes.color&&4===R.attributes.color.itemSize,pointsUvs:!0===g.isPoints&&!!R.attributes.uv&&(B||ev),fog:!!E,useFog:!0===a.fog,fogExp2:!!E&&E.isFogExp2,flatShading:!1===a.wireframe&&(!0===a.flatShading||void 0===R.attributes.normal&&!1===W&&(a.isMeshLambertMaterial||a.isMeshPhongMaterial||a.isMeshStandardMaterial||a.isMeshPhysicalMaterial)),sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:f,reversedDepthBuffer:I,skinning:!0===g.isSkinnedMesh,hasPositionAttribute:void 0!==R.attributes.position,morphTargets:void 0!==R.morphAttributes.position,morphNormals:void 0!==R.morphAttributes.normal,morphColors:void 0!==R.morphAttributes.color,morphTargetsCount:P,morphTextureStride:N,numSunLights:l.sun.length,numDirLights:l.directional.length,numPointLights:l.point.length,numSpotLights:l.spot.length,numSpotLightMaps:l.spotLightMap.length,numRectAreaLights:l.rectArea.length,numHemiLights:l.hemi.length,numSunLightShadows:l.sunShadowMap.length,numDirLightShadows:l.directionalShadowMap.length,numPointLightShadows:l.pointShadowMap.length,numSpotLightShadows:l.spotShadowMap.length,numSpotLightShadowsWithMaps:l.numSpotLightShadowsWithMaps,numLightProbes:l.numLightProbes,numLightProbeGrids:_.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&d.length>0,shadowMapType:e.shadowMap.type,toneMapping:ex,decodeVideoTexture:B&&!0===a.map.isVideoTexture&&t.ColorManagement.getTransfer(a.map.colorSpace)===t.SRGBTransfer,decodeVideoTextureEmissive:K&&!0===a.emissiveMap.isVideoTexture&&t.ColorManagement.getTransfer(a.emissiveMap.colorSpace)===t.SRGBTransfer,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===t.DoubleSide,flipSided:a.side===t.BackSide,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:eS&&!0===a.extensions.clipCullDistance&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(eS&&!0===a.extensions.multiDraw||O)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:a.customProgramCacheKey()};return eT.vertexUv1s=c.has(1),eT.vertexUv2s=c.has(2),eT.vertexUv3s=c.has(3),c.clear(),eT},getProgramCacheKey:function(t){var n,r,i,a;let o=[];if(t.shaderID?o.push(t.shaderID):(o.push(t.customVertexShaderID),o.push(t.customFragmentShaderID)),void 0!==t.defines)for(let e in t.defines)o.push(e),o.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(n=o,r=t,n.push(r.precision),n.push(r.outputColorSpace),n.push(r.envMapMode),n.push(r.envMapCubeUVHeight),n.push(r.mapUv),n.push(r.alphaMapUv),n.push(r.lightMapUv),n.push(r.aoMapUv),n.push(r.bumpMapUv),n.push(r.normalMapUv),n.push(r.displacementMapUv),n.push(r.emissiveMapUv),n.push(r.metalnessMapUv),n.push(r.roughnessMapUv),n.push(r.anisotropyMapUv),n.push(r.clearcoatMapUv),n.push(r.clearcoatNormalMapUv),n.push(r.clearcoatRoughnessMapUv),n.push(r.iridescenceMapUv),n.push(r.iridescenceThicknessMapUv),n.push(r.sheenColorMapUv),n.push(r.sheenRoughnessMapUv),n.push(r.specularMapUv),n.push(r.specularColorMapUv),n.push(r.specularIntensityMapUv),n.push(r.transmissionMapUv),n.push(r.thicknessMapUv),n.push(r.combine),n.push(r.fogExp2),n.push(r.sizeAttenuation),n.push(r.morphTargetsCount),n.push(r.morphAttributeCount),n.push(r.numSunLights),n.push(r.numDirLights),n.push(r.numPointLights),n.push(r.numSpotLights),n.push(r.numSpotLightMaps),n.push(r.numHemiLights),n.push(r.numRectAreaLights),n.push(r.numSunLightShadows),n.push(r.numDirLightShadows),n.push(r.numPointLightShadows),n.push(r.numSpotLightShadows),n.push(r.numSpotLightShadowsWithMaps),n.push(r.numLightProbes),n.push(r.shadowMapType),n.push(r.toneMapping),n.push(r.numClippingPlanes),n.push(r.numClipIntersection),n.push(r.depthPacking),i=o,a=t,l.disableAll(),a.instancing&&l.enable(0),a.instancingColor&&l.enable(1),a.instancingMorph&&l.enable(2),a.matcap&&l.enable(3),a.envMap&&l.enable(4),a.normalMapObjectSpace&&l.enable(5),a.normalMapTangentSpace&&l.enable(6),a.clearcoat&&l.enable(7),a.iridescence&&l.enable(8),a.alphaTest&&l.enable(9),a.vertexColors&&l.enable(10),a.vertexAlphas&&l.enable(11),a.vertexUv1s&&l.enable(12),a.vertexUv2s&&l.enable(13),a.vertexUv3s&&l.enable(14),a.vertexTangents&&l.enable(15),a.anisotropy&&l.enable(16),a.alphaHash&&l.enable(17),a.batching&&l.enable(18),a.dispersion&&l.enable(19),a.retroreflection&&l.enable(24),a.batchingColor&&l.enable(20),a.gradientMap&&l.enable(21),a.packedNormalMap&&l.enable(22),a.vertexNormals&&l.enable(23),i.push(l.mask),l.disableAll(),a.fog&&l.enable(0),a.useFog&&l.enable(1),a.flatShading&&l.enable(2),a.logarithmicDepthBuffer&&l.enable(3),a.reversedDepthBuffer&&l.enable(4),a.skinning&&l.enable(5),a.morphTargets&&l.enable(6),a.morphNormals&&l.enable(7),a.morphColors&&l.enable(8),a.premultipliedAlpha&&l.enable(9),a.shadowMapEnabled&&l.enable(10),a.doubleSided&&l.enable(11),a.flipSided&&l.enable(12),a.useDepthPacking&&l.enable(13),a.dithering&&l.enable(14),a.transmission&&l.enable(15),a.sheen&&l.enable(16),a.opaque&&l.enable(17),a.pointsUvs&&l.enable(18),a.decodeVideoTexture&&l.enable(19),a.decodeVideoTextureEmissive&&l.enable(20),a.alphaToCoverage&&l.enable(21),a.numLightProbeGrids>0&&l.enable(22),a.hasPositionAttribute&&l.enable(23),i.push(l.mask),o.push(e.outputColorSpace)),o.push(t.customProgramCacheKey),o.join()},getUniforms:function(e){let n,r=m[e.type];if(r){let e=o[r];n=t.UniformsUtils.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let r=h.get(n);return void 0!==r?++r.usedTimes:(r=new te(e,n,t,a),d.push(r),h.set(n,r)),r},releaseProgram:function(e){if(0==--e.usedTimes){let t=d.indexOf(e);
318d[t]=d[d.length-1],d.pop(),h.delete(e.cacheKey),e.destroy()}},releaseShaderCache:function(e){u.remove(e)},programs:d,dispose:function(){u.dispose()}}}function ta(){let e=new WeakMap;return{has:function(t){return e.has(t)},get:function(t){let n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,r){e.get(t)[n]=r},dispose:function(){e=new WeakMap}}}function to(e,t){if(e.groupOrder!==t.groupOrder)return e.groupOrder-t.groupOrder;if(e.renderOrder!==t.renderOrder)return e.renderOrder-t.renderOrder;if(e.material.id!==t.material.id)return e.material.id-t.material.id;if(e.materialVariant!==t.materialVariant)return e.materialVariant-t.materialVariant;if(e.z!==t.z)return e.z-t.z;else return e.id-t.id}function ts(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function tl(){let e=[],t=0,n=[],r=[],i=[];function a(e){let t=0;return e.isInstancedMesh&&(t+=2),e.isSkinnedMesh&&(t+=1),t}function o(n,r,i,o,s,l){let u=e[t];return void 0===u?(u={id:n.id,object:n,geometry:r,material:i,materialVariant:a(n),groupOrder:o,renderOrder:n.renderOrder,z:s,group:l},e[t]=u):(u.id=n.id,u.object=n,u.geometry=r,u.material=i,u.materialVariant=a(n),u.groupOrder=o,u.renderOrder=n.renderOrder,u.z=s,u.group=l),t++,u}return{opaque:n,transmissive:r,transparent:i,init:function(){t=0,n.length=0,r.length=0,i.length=0},push:function(e,t,a,s,l,u,c){!0===c.reversedDepth&&(l=-l);let d=o(e,t,a,s,l,u);a.transmission>0?r.push(d):!0===a.transparent?i.push(d):n.push(d)},unshift:function(e,t,a,s,l,u){let c=o(e,t,a,s,l,u);a.transmission>0?r.unshift(c):!0===a.transparent?i.unshift(c):n.unshift(c)},finish:function(){for(let n=t,r=e.length;n<r;n++){let t=e[n];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t){n.length>1&&n.sort(e||to),r.length>1&&r.sort(t||ts),i.length>1&&i.sort(t||ts)}}}function tu(){let e=new WeakMap;return{get:function(t,n){let r,i=e.get(t);return void 0===i?(r=new tl,e.set(t,[r])):n>=i.length?(r=new tl,i.push(r)):r=i[n],r},dispose:function(){e=new WeakMap}}}function tc(){let e={};return{get:function(n){let r;if(void 0!==e[n.id])return e[n.id];switch(n.type){case"SunLight":case"DirectionalLight":r={direction:new t.Vector3,color:new t.Color};break;case"SpotLight":r={position:new t.Vector3,direction:new t.Vector3,color:new t.Color,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":r={position:new t.Vector3,color:new t.Color,distance:0,decay:0};break;case"HemisphereLight":r={direction:new t.Vector3,skyColor:new t.Color,groundColor:new t.Color};break;case"RectAreaLight":r={color:new t.Color,position:new t.Vector3,halfWidth:new t.Vector3,halfHeight:new t.Vector3}}return e[n.id]=r,r}}}let td=0;function th(e,t){return 2*!!t.castShadow-2*!!e.castShadow+ +!!t.map-!!e.map}function tf(e){let n,r=new tc,i=(n={},{get:function(e){let r;if(void 0!==n[e.id])return n[e.id];switch(e.type){case"SunLight":case"DirectionalLight":case"SpotLight":r={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new t.Vector2};break;case"PointLight":r={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new t.Vector2,shadowCameraNear:1,shadowCameraFar:1e3}}return n[e.id]=r,r}}),o={version:0,hash:{sunLength:-1,directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numSunShadows:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],sun:[],sunShadow:[],sunShadowMap:[],sunShadowMatrix:[],sunShadowCascade:[],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 e=0;e<9;e++)o.probe.push(new t.Vector3);let s=new t.Vector3,l=new t.Matrix4,u=new t.Matrix4;return{setup:function(n){let s=0,l=0,u=0;for(let e=0;e<9;e++)o.probe[e].set(0,0,0);let c=0,d=0,h=0,f=0,p=0,m=0,v=0,g=0,_=0,S=0,x=0,T=0,M=0,b=0;n.sort(th);for(let e=0,a=n.length;e<a;e++){let a=n[e],E=a.color,R=a.intensity,w=a.distance,C=null;if(a.shadow&&a.shadow.map&&(C=a.shadow.map.texture.format===t.RGFormat?a.shadow.map.texture:a.shadow.map.depthTexture||a.shadow.map.texture),a.isAmbientLight)s+=E.r*R,l+=E.g*R,u+=E.b*R;else if(a.isLightProbe){for(let e=0;e<9;e++)o.probe[e].addScaledVector(a.sh.coefficients[e],R);b++}else if(a.isSunLight){let e=r.get(a);if(e.color.copy(a.color).multiplyScalar(a.intensity),a.castShadow){let e=a.shadow,t=i.get(a);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.n
318ormalBias,t.shadowRadius=e.radius,t.shadowMapSize.copy(e.mapSize).multiply(e.getFrameExtents()),o.sunShadow[d]=t,o.sunShadowMap[d]=C;let n=e.getViewportCount();for(let t=0;t<n;t++)o.sunShadowMatrix[h+t]=e.getMatrix(t),o.sunShadowCascade[h+t]=e._cascadeData[t];h+=n,d++}o.sun[c]=e,c++}else if(a.isDirectionalLight){let e=r.get(a);if(e.color.copy(a.color).multiplyScalar(a.intensity),a.castShadow){let e=a.shadow,t=i.get(a);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,o.directionalShadow[f]=t,o.directionalShadowMap[f]=C,o.directionalShadowMatrix[f]=a.shadow.matrix,_++}o.directional[f]=e,f++}else if(a.isSpotLight){let e=r.get(a);e.position.setFromMatrixPosition(a.matrixWorld),e.color.copy(E).multiplyScalar(R),e.distance=w,e.coneCos=Math.cos(a.angle),e.penumbraCos=Math.cos(a.angle*(1-a.penumbra)),e.decay=a.decay,o.spot[m]=e;let t=a.shadow;if(a.map&&(o.spotLightMap[T]=a.map,T++,t.updateMatrices(a),a.castShadow&&M++),o.spotLightMatrix[m]=t.matrix,a.castShadow){let e=i.get(a);e.shadowIntensity=t.intensity,e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,o.spotShadow[m]=e,o.spotShadowMap[m]=C,x++}m++}else if(a.isRectAreaLight){let e=r.get(a);e.color.copy(E).multiplyScalar(R),e.halfWidth.set(.5*a.width,0,0),e.halfHeight.set(0,.5*a.height,0),o.rectArea[v]=e,v++}else if(a.isPointLight){let e=r.get(a);if(e.color.copy(a.color).multiplyScalar(a.intensity),e.distance=a.distance,e.decay=a.decay,a.castShadow){let e=a.shadow,t=i.get(a);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,o.pointShadow[p]=t,o.pointShadowMap[p]=C,o.pointShadowMatrix[p]=a.shadow.matrix,S++}o.point[p]=e,p++}else if(a.isHemisphereLight){let e=r.get(a);e.skyColor.copy(a.color).multiplyScalar(R),e.groundColor.copy(a.groundColor).multiplyScalar(R),o.hemi[g]=e,g++}}v>0&&(!0===e.has("OES_texture_float_linear")?(o.rectAreaLTC1=a.LTC_FLOAT_1,o.rectAreaLTC2=a.LTC_FLOAT_2):(o.rectAreaLTC1=a.LTC_HALF_1,o.rectAreaLTC2=a.LTC_HALF_2)),o.ambient[0]=s,o.ambient[1]=l,o.ambient[2]=u;let E=o.hash;(E.sunLength!==c||E.directionalLength!==f||E.pointLength!==p||E.spotLength!==m||E.rectAreaLength!==v||E.hemiLength!==g||E.numSunShadows!==d||E.numDirectionalShadows!==_||E.numPointShadows!==S||E.numSpotShadows!==x||E.numSpotMaps!==T||E.numLightProbes!==b)&&(o.sun.length=c,o.directional.length=f,o.spot.length=m,o.rectArea.length=v,o.point.length=p,o.hemi.length=g,o.sunShadow.length=d,o.sunShadowMap.length=d,o.sunShadowMatrix.length=h,o.sunShadowCascade.length=h,o.directionalShadow.length=_,o.directionalShadowMap.length=_,o.directionalShadowMatrix.length=_,o.pointShadow.length=S,o.pointShadowMap.length=S,o.pointShadowMatrix.length=S,o.spotShadow.length=x,o.spotShadowMap.length=x,o.spotLightMatrix.length=x+T-M,o.spotLightMap.length=T,o.numSpotLightShadowsWithMaps=M,o.numLightProbes=b,E.sunLength=c,E.directionalLength=f,E.pointLength=p,E.spotLength=m,E.rectAreaLength=v,E.hemiLength=g,E.numSunShadows=d,E.numDirectionalShadows=_,E.numPointShadows=S,E.numSpotShadows=x,E.numSpotMaps=T,E.numLightProbes=b,o.version=td++)},setupView:function(e,t){let n=0,r=0,i=0,a=0,c=0,d=0,h=t.matrixWorldInverse;for(let t=0,f=e.length;t<f;t++){let f=e[t];if(f.isSunLight){let e=o.sun[n];e.direction.setFromMatrixPosition(f.matrixWorld),e.direction.transformDirection(h),n++}else if(f.isDirectionalLight){let e=o.directional[r];e.direction.setFromMatrixPosition(f.matrixWorld),s.setFromMatrixPosition(f.target.matrixWorld),e.direction.sub(s),e.direction.transformDirection(h),r++}else if(f.isSpotLight){let e=o.spot[a];e.position.setFromMatrixPosition(f.matrixWorld),e.position.applyMatrix4(h),e.direction.setFromMatrixPosition(f.matrixWorld),s.setFromMatrixPosition(f.target.matrixWorld),e.direction.sub(s),e.direction.transformDirection(h),a++}else if(f.isRectAreaLight){let e=o.rectArea[c];e.position.setFromMatrixPosition(f.matrixWorld),e.position.applyMatrix4(h),u.identity(),l.copy(f.matrixWorld),l.premultiply(h),u.extractRotation(l),e.halfWidth.set(.5*f.width,0,0),e.halfHeight.set(0,.5*f.height,0),e.halfWidth.applyMatrix4(u),e.halfHeight.applyMatrix4(u),c++}else if(f.isPointLight){let e=o.point[i];e.position.setFromMatrixPosition(f.matrixWorld),e.position.applyMatrix4(h),i++}else if(f.isHemisphereLight){let e=o.hemi[d];e.direction.setFromMatrixPosition(f.matrixWorld),e.direction.transformDirection(h),d++}}},state:o}}function tp(e){let t=new tf(e),n=[],r=[],i=[],a={lightsArray:n,shadowsArray:r,lightProbeGridArray:i,camera:null,lights:t,transmissionRenderTarget:{},textureUnits:0};return{init:function(e){a.camera=e,n.length=0,r.length=0,i.length=0},state:a,setupLights:function(){t.setup(n)},setupLightsView:function(e){t.setupView(n,e)},pushLight:function(e){n.push(e)},pushShadow:function(e){r.push(e)},pushLightProbeGrid:function(e){i.push(e)}}}function tm(e){let t=new WeakMap;return{get:function(n,r=0){let i,a=t.get(n);return void 0===a?(i=new tp(e),t.set(n,[i])):r>=a.length?(i=new tp(e),a.push(i)):i=a[r],i},dispose:function(){t=new WeakMap}}}let tv=[new t.Vector3(1,0,0),new t.Vector3(-1,0,0),new t.Vector3(0,1,0),new t.Vector3(0,-1,0),new t.Vector3(0,0,1),new t.Vector3(0,0,-1)],tg=[new t.Vector3(0,-1,0),new t.Vector3(0,-1,0),new t.Vector3(0,0,1),new t.Vector3(0,0,-1),new t.Vector3(0,-1,0),new t.Vector3(0,-1,0)],t_=new t.Matrix4,tS=new t.Vector3,tx=new t.Vector3;function tT(e,n,r){let i=new t.Frustum,a=new t.Vector2,o=new t.Vector2,s=new t.Vector4,l=new t.MeshDepthMaterial,u=new t.MeshDistanceMaterial,c={},d=r.maxTextureSize,h={[t.FrontSide]:t.BackSide,[t.BackSide]:t.FrontSide,[t.DoubleSide]:t.DoubleSide}
318,f=new t.ShaderMaterial({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new t.Vector2},radius:{value:4}},vertexShader:"void main() {\n	gl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\nvoid main() {\n	const float samples = float( VSM_SAMPLES );\n	float mean = 0.0;\n	float squared_mean = 0.0;\n	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n	for ( float i = 0.0; i < samples; i ++ ) {\n		float uvOffset = uvStart + i * uvStride;\n		#ifdef HORIZONTAL_PASS\n			vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;\n			mean += distribution.x;\n			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n		#else\n			float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;\n			mean += depth;\n			squared_mean += depth * depth;\n		#endif\n	}\n	mean = mean / samples;\n	squared_mean = squared_mean / samples;\n	float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );\n	gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );\n}"}),p=f.clone();p.defines.HORIZONTAL_PASS=1;let m=new t.BufferGeometry;m.setAttribute("position",new t.BufferAttribute(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let v=new t.Mesh(m,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=t.PCFShadowMap;let _=this.type;function S(n,r,i,a){let o=null,s=!0===i.isPointLight?n.customDistanceMaterial:n.customDepthMaterial;if(void 0!==s)o=s;else if(o=!0===i.isPointLight?u:l,e.localClippingEnabled&&!0===r.clipShadows&&Array.isArray(r.clippingPlanes)&&0!==r.clippingPlanes.length||r.displacementMap&&0!==r.displacementScale||r.alphaMap&&r.alphaTest>0||r.map&&r.alphaTest>0||!0===r.alphaToCoverage){let e=o.uuid,t=r.uuid,n=c[e];void 0===n&&(n={},c[e]=n);let i=n[t];void 0===i&&(i=o.clone(),n[t]=i,r.addEventListener("dispose",x)),o=i}return o.visible=r.visible,o.wireframe=r.wireframe,a===t.VSMShadowMap?o.side=null!==r.shadowSide?r.shadowSide:r.side:o.side=null!==r.shadowSide?r.shadowSide:h[r.side],o.alphaMap=r.alphaMap,o.alphaTest=!0===r.alphaToCoverage?.5:r.alphaTest,o.map=r.map,o.clipShadows=r.clipShadows,o.clippingPlanes=r.clippingPlanes,o.clipIntersection=r.clipIntersection,o.displacementMap=r.displacementMap,o.displacementScale=r.displacementScale,o.displacementBias=r.displacementBias,o.wireframeLinewidth=r.wireframeLinewidth,o.linewidth=r.linewidth,!0===i.isPointLight&&!0===o.isMeshDistanceMaterial&&(e.properties.get(o).light=i),o}function x(e){for(let t in e.target.removeEventListener("dispose",x),c){let n=c[t],r=e.target.uuid;r in n&&(n[r].dispose(),delete n[r])}}this.render=function(r,l,u){if(!1===g.enabled||!1===g.autoUpdate&&!1===g.needsUpdate||0===r.length)return;this.type===t.PCFSoftShadowMap&&((0,t.warn)("WebGLShadowMap: PCFSoftShadowMap has been removed. Using PCFShadowMap instead."),this.type=t.PCFShadowMap);let c=e.getRenderTarget(),h=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),x=e.state;x.setBlending(t.NoBlending),!0===x.buffers.depth.getReversed()?x.buffers.color.setClear(0,0,0,0):x.buffers.color.setClear(1,1,1,1),x.buffers.depth.setTest(!0),x.setScissorTest(!1);let T=_!==this.type;T&&l.traverse(function(e){e.material&&(Array.isArray(e.material)?e.material.forEach(e=>e.needsUpdate=!0):e.material.needsUpdate=!0)});for(let c=0,h=r.length;c<h;c++){let h=r[c],m=h.shadow;if(void 0===m){(0,t.warn)("WebGLShadowMap:",h,"has no shadow.");continue}if(!1===m.autoUpdate&&!1===m.needsUpdate)continue;a.copy(m.mapSize);let g=m.getFrameExtents();a.multiply(g),o.copy(m.mapSize),(a.x>d||a.y>d)&&(a.x>d&&(o.x=Math.floor(d/g.x),a.x=o.x*g.x,m.mapSize.x=o.x),a.y>d&&(o.y=Math.floor(d/g.y),a.y=o.y*g.y,m.mapSize.y=o.y));let _=e.state.buffers.depth.getReversed();if(m.camera._reversedDepth=_,null===m.map||!0===T){if(null!==m.map&&(null!==m.map.depthTexture&&(m.map.depthTexture.dispose(),m.map.depthTexture=null),m.map.dispose()),this.type===t.VSMShadowMap){if
318(h.isPointLight){(0,t.warn)("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}m.map=new t.WebGLRenderTarget(a.x,a.y,{format:t.RGFormat,type:t.HalfFloatType,minFilter:t.LinearFilter,magFilter:t.LinearFilter,generateMipmaps:!1}),m.map.texture.name=h.name+".shadowMap",m.map.depthTexture=new t.DepthTexture(a.x,a.y,t.FloatType),m.map.depthTexture.name=h.name+".shadowMapDepth",m.map.depthTexture.format=t.DepthFormat,m.map.depthTexture.compareFunction=null,m.map.depthTexture.minFilter=t.NearestFilter,m.map.depthTexture.magFilter=t.NearestFilter}else h.isPointLight?(m.map=new A(a.x),m.map.depthTexture=new t.CubeDepthTexture(a.x,t.UnsignedIntType)):(m.map=new t.WebGLRenderTarget(a.x,a.y),m.map.depthTexture=new t.DepthTexture(a.x,a.y,t.UnsignedIntType)),m.map.depthTexture.name=h.name+".shadowMap",m.map.depthTexture.format=t.DepthFormat,this.type===t.PCFShadowMap?(m.map.depthTexture.compareFunction=_?t.GreaterEqualCompare:t.LessEqualCompare,m.map.depthTexture.minFilter=t.LinearFilter,m.map.depthTexture.magFilter=t.LinearFilter):(m.map.depthTexture.compareFunction=null,m.map.depthTexture.minFilter=t.NearestFilter,m.map.depthTexture.magFilter=t.NearestFilter);m.camera.updateProjectionMatrix()}!0!==m.map.isWebGLCubeRenderTarget&&(m.map.width!==a.x||m.map.height!==a.y)&&m.map.setSize(a.x,a.y);let M=m.map.isWebGLCubeRenderTarget?6:m.getViewportCount();!0!==h.isPointLight&&m.updateMatrices(h,u);for(let r=0;r<M;r++){let a=m.getCamera(r);if(h.isPointLight){let e=m.camera,t=m.matrix,n=h.distance||e.far;n!==e.far&&(e.far=n,e.updateProjectionMatrix()),tS.setFromMatrixPosition(h.matrixWorld),e.position.copy(tS),tx.copy(e.position),tx.add(tv[r]),e.up.copy(tg[r]),e.lookAt(tx),e.updateMatrixWorld(),t.makeTranslation(-tS.x,-tS.y,-tS.z),t_.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),m._frustum.setFromProjectionMatrix(t_,e.coordinateSystem,e.reversedDepth)}if(m.map.isWebGLCubeRenderTarget)e.setRenderTarget(m.map,r),e.clear();else{0===r&&(e.setRenderTarget(m.map),e.clear());let t=m.getViewport(r);s.set(o.x*t.x,o.y*t.y,o.x*t.z,o.y*t.w),x.viewport(s)}i=m.getFrustum(r),function r(a,o,s,l,u){if(!1===a.visible)return;if(a.layers.test(o.layers)&&(a.isMesh||a.isLine||a.isPoints)&&(a.castShadow||a.receiveShadow&&u===t.VSMShadowMap)&&(!a.frustumCulled||a.intersectsFrustum(i))){a.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,a.matrixWorld);let t=n.update(a),r=a.material;if(Array.isArray(r)){let n=t.groups;for(let i=0,c=n.length;i<c;i++){let c=n[i],d=r[c.materialIndex];if(d&&d.visible){let n=S(a,d,l,u);a.onBeforeShadow(e,a,o,s,t,n,c),e.renderBufferDirect(s,null,t,n,a,c),a.onAfterShadow(e,a,o,s,t,n,c)}}}else if(r.visible){let n=S(a,r,l,u);a.onBeforeShadow(e,a,o,s,t,n,null),e.renderBufferDirect(s,null,t,n,a,null),a.onAfterShadow(e,a,o,s,t,n,null)}}let c=a.children;for(let e=0,t=c.length;e<t;e++)r(c[e],o,s,l,u)}(l,u,a,h,this.type)}!0!==m.isPointLightShadow&&this.type===t.VSMShadowMap&&function(r,i){let o=n.update(v);f.defines.VSM_SAMPLES!==r.blurSamples&&(f.defines.VSM_SAMPLES=r.blurSamples,p.defines.VSM_SAMPLES=r.blurSamples,f.needsUpdate=!0,p.needsUpdate=!0),null===r.mapPass?r.mapPass=new t.WebGLRenderTarget(a.x,a.y,{format:t.RGFormat,type:t.HalfFloatType}):(r.mapPass.width!==r.map.width||r.mapPass.height!==r.map.height)&&r.mapPass.setSize(r.map.width,r.map.height),f.uniforms.shadow_pass.value=r.map.depthTexture,f.uniforms.resolution.value.set(r.map.width,r.map.height),f.uniforms.radius.value=r.radius,e.setRenderTarget(r.mapPass),e.clear(),e.renderBufferDirect(i,null,o,f,v,null),p.uniforms.shadow_pass.value=r.mapPass.texture,p.uniforms.resolution.value.set(r.map.width,r.map.height),p.uniforms.radius.value=r.radius,e.setRenderTarget(r.map),e.clear(),e.renderBufferDirect(i,null,o,p,v,null)}(m,u),m.needsUpdate=!1}_=this.type,g.needsUpdate=!1,e.setRenderTarget(c,h,m)}}function tM(e,n){let r=new function(){let n=!1,r=new t.Vector4,i=null,a=new t.Vector4(0,0,0,0);return{setMask:function(t){i===t||n||(e.colorMask(t,t,t,t),i=t)},setLocked:function(e){n=e},setClear:function(t,n,i,o,s){!0===s&&(t*=o,n*=o,i*=o),r.set(t,n,i,o),!1===a.equals(r)&&(e.clearColor(t,n,i,o),a.copy(r))},reset:function(){n=!1,i=null,a.set(-1,0,0,0)}}},i=new function(){let r=!1,i=!1,a=null,o=null,s=null;return{setReversed:function(e){if(i!==e){let t=n.get("EXT_clip_control");e?t.clipControlEXT(t.LOWER_LEFT_EXT,t.ZERO_TO_ONE_EXT):t.clipControlEXT(t.LOWER_LEFT_EXT,t.NEGATIVE_ONE_TO_ONE_EXT),i=e;let r=s;s=null,this.setClear(r)}},getReversed:function(){return i},setTest:function(t){t?k(e.DEPTH_TEST):V(e.DEPTH_TEST)},setMask:function(t){a===t||r||(e.depthMask(t),a=t)},setFunc:function(n){if(i&&(n=t.ReversedDepthFuncs[n]),o!==n){switch(n){case t.NeverDepth:e.depthFunc(e.NEVER);break;case t.AlwaysDepth:e.depthFunc(e.ALWAYS);break;case t.LessDepth:e.depthFunc(e.LESS);break;case t.LessEqualDepth:e.depthFunc(e.LEQUAL);break;case t.EqualDepth:e.depthFunc(e.EQUAL);break;case t.GreaterEqualDepth:e.depthFunc(e.GEQUAL);break;case t.GreaterDepth:e.depthFunc(e.GREATER);break;case t.NotEqualDepth:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}o=n}}
318,setLocked:function(e){r=e},setClear:function(t){s!==t&&(s=t,i&&(t=1-t),e.clearDepth(t))},reset:function(){r=!1,a=null,o=null,s=null,i=!1}}},a=new function(){let t=!1,n=null,r=null,i=null,a=null,o=null,s=null,l=null,u=null;return{setTest:function(n){t||(n?k(e.STENCIL_TEST):V(e.STENCIL_TEST))},setMask:function(r){n===r||t||(e.stencilMask(r),n=r)},setFunc:function(t,n,o){(r!==t||i!==n||a!==o)&&(e.stencilFunc(t,n,o),r=t,i=n,a=o)},setOp:function(t,n,r){(o!==t||s!==n||l!==r)&&(e.stencilOp(t,n,r),o=t,s=n,l=r)},setLocked:function(e){t=e},setClear:function(t){u!==t&&(e.clearStencil(t),u=t)},reset:function(){t=!1,n=null,r=null,i=null,a=null,o=null,s=null,l=null,u=null}}},o=new WeakMap,s=new WeakMap,l={},u={},c={},d=new WeakMap,h=[],f=null,p=!1,m=null,v=null,g=null,_=null,S=null,x=null,T=null,M=new t.Color(0,0,0),b=0,E=!1,R=null,w=null,C=null,y=null,A=null,L=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),D=!1,P=e.getParameter(e.VERSION);-1!==P.indexOf("WebGL")?D=parseFloat(/^WebGL (\d)/.exec(P)[1])>=1:-1!==P.indexOf("OpenGL ES")&&(D=parseFloat(/^OpenGL ES (\d)/.exec(P)[1])>=2);let N=null,U={},I=e.getParameter(e.SCISSOR_BOX),F=e.getParameter(e.VIEWPORT),O=new t.Vector4().fromArray(I),B=new t.Vector4().fromArray(F);function G(t,n,r,i){let a=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;o<r;o++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(n,0,e.RGBA,1,1,i,0,e.RGBA,e.UNSIGNED_BYTE,a):e.texImage2D(n+o,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,a);return o}let H={};function k(t){!0!==l[t]&&(e.enable(t),l[t]=!0)}function V(t){!1!==l[t]&&(e.disable(t),l[t]=!1)}H[e.TEXTURE_2D]=G(e.TEXTURE_2D,e.TEXTURE_2D,1),H[e.TEXTURE_CUBE_MAP]=G(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),H[e.TEXTURE_2D_ARRAY]=G(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),H[e.TEXTURE_3D]=G(e.TEXTURE_3D,e.TEXTURE_3D,1,1),r.setClear(0,0,0,1),i.setClear(1),a.setClear(0),k(e.DEPTH_TEST),i.setFunc(t.LessEqualDepth),K(!1),j(t.CullFaceBack),k(e.CULL_FACE),X(t.NoBlending);let z={[t.AddEquation]:e.FUNC_ADD,[t.SubtractEquation]:e.FUNC_SUBTRACT,[t.ReverseSubtractEquation]:e.FUNC_REVERSE_SUBTRACT};z[t.MinEquation]=e.MIN,z[t.MaxEquation]=e.MAX;let W={[t.ZeroFactor]:e.ZERO,[t.OneFactor]:e.ONE,[t.SrcColorFactor]:e.SRC_COLOR,[t.SrcAlphaFactor]:e.SRC_ALPHA,[t.SrcAlphaSaturateFactor]:e.SRC_ALPHA_SATURATE,[t.DstColorFactor]:e.DST_COLOR,[t.DstAlphaFactor]:e.DST_ALPHA,[t.OneMinusSrcColorFactor]:e.ONE_MINUS_SRC_COLOR,[t.OneMinusSrcAlphaFactor]:e.ONE_MINUS_SRC_ALPHA,[t.OneMinusDstColorFactor]:e.ONE_MINUS_DST_COLOR,[t.OneMinusDstAlphaFactor]:e.ONE_MINUS_DST_ALPHA,[t.ConstantColorFactor]:e.CONSTANT_COLOR,[t.OneMinusConstantColorFactor]:e.ONE_MINUS_CONSTANT_COLOR,[t.ConstantAlphaFactor]:e.CONSTANT_ALPHA,[t.OneMinusConstantAlphaFactor]:e.ONE_MINUS_CONSTANT_ALPHA};function X(n,r,i,a,o,s,l,u,c,d){if(n===t.NoBlending){!0===p&&(V(e.BLEND),p=!1);return}if(!1===p&&(k(e.BLEND),p=!0),n!==t.CustomBlending){if(n!==m||d!==E){if((v!==t.AddEquation||S!==t.AddEquation)&&(e.blendEquation(e.FUNC_ADD),v=t.AddEquation,S=t.AddEquation),d)switch(n){case t.NormalBlending:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case t.AdditiveBlending:e.blendFunc(e.ONE,e.ONE);break;case t.SubtractiveBlending:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case t.MultiplyBlending:e.blendFuncSeparate(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ZERO,e.ONE);break;default:(0,t.error)("WebGLState: Invalid blending: ",n)}else switch(n){case t.NormalBlending:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case t.AdditiveBlending:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE,e.ONE,e.ONE);break;case t.SubtractiveBlending:(0,t.error)("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case t.MultiplyBlending:(0,t.error)("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:(0,t.error)("WebGLState: Invalid blending: ",n)}g=null,_=null,x=null,T=null,M.set(0,0,0),b=0,m=n,E=d}return}o=o||r,s=s||i,l=l||a,(r!==v||o!==S)&&(e.blendEquationSeparate(z[r],z[o]),v=r,S=o),(i!==g||a!==_||s!==x||l!==T)&&(e.blendFuncSeparate(W[i],W[a],W[s],W[l]),g=i,_=a,x=s,T=l),
vendor: 4,416 bytes, line 318
318(!1===u.equals(M)||c!==b)&&(e.blendColor(u.r,u.g,u.b,c),M.copy(u),b=c),m=n,E=!1}function K(t){R!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),R=t)}function j(n){n!==t.CullFaceNone?(k(e.CULL_FACE),n!==w&&(n===t.CullFaceBack?e.cullFace(e.BACK):n===t.CullFaceFront?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):V(e.CULL_FACE),w=n}function q(t,n,r){t?(k(e.POLYGON_OFFSET_FILL),(y!==n||A!==r)&&(y=n,A=r,i.getReversed()&&(n=-n),e.polygonOffset(n,r))):V(e.POLYGON_OFFSET_FILL)}return{buffers:{color:r,depth:i,stencil:a},enable:k,disable:V,bindFramebuffer:function(t,n){return c[t]!==n&&(e.bindFramebuffer(t,n),c[t]=n,t===e.DRAW_FRAMEBUFFER&&(c[e.FRAMEBUFFER]=n),t===e.FRAMEBUFFER&&(c[e.DRAW_FRAMEBUFFER]=n),!0)},drawBuffers:function(t,n){let r=h,i=!1;if(t){void 0===(r=d.get(n))&&(r=[],d.set(n,r));let a=t.textures;if(r.length!==a.length||r[0]!==e.COLOR_ATTACHMENT0){for(let t=0,n=a.length;t<n;t++)r[t]=e.COLOR_ATTACHMENT0+t;r.length=a.length,i=!0}}else r[0]!==e.BACK&&(r[0]=e.BACK,i=!0);i&&e.drawBuffers(r)},useProgram:function(t){return f!==t&&(e.useProgram(t),f=t,!0)},setBlending:X,setMaterial:function(n,o){n.side===t.DoubleSide?V(e.CULL_FACE):k(e.CULL_FACE);let s=n.side===t.BackSide;o&&(s=!s),K(s),n.blending===t.NormalBlending&&!1===n.transparent?X(t.NoBlending):X(n.blending,n.blendEquation,n.blendSrc,n.blendDst,n.blendEquationAlpha,n.blendSrcAlpha,n.blendDstAlpha,n.blendColor,n.blendAlpha,n.premultipliedAlpha),i.setFunc(n.depthFunc),i.setTest(n.depthTest),i.setMask(n.depthWrite),r.setMask(n.colorWrite);let l=n.stencilWrite;a.setTest(l),l&&(a.setMask(n.stencilWriteMask),a.setFunc(n.stencilFunc,n.stencilRef,n.stencilFuncMask),a.setOp(n.stencilFail,n.stencilZFail,n.stencilZPass)),q(n.polygonOffset,n.polygonOffsetFactor,n.polygonOffsetUnits),!0===n.alphaToCoverage?k(e.SAMPLE_ALPHA_TO_COVERAGE):V(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:K,setCullFace:j,setLineWidth:function(t){t!==C&&(D&&e.lineWidth(t),C=t)},setPolygonOffset:q,setScissorTest:function(t){t?k(e.SCISSOR_TEST):V(e.SCISSOR_TEST)},activeTexture:function(t){void 0===t&&(t=e.TEXTURE0+L-1),N!==t&&(e.activeTexture(t),N=t)},bindTexture:function(t,n,r){void 0===r&&(r=null===N?e.TEXTURE0+L-1:N);let i=U[r];void 0===i&&(i={type:void 0,texture:void 0},U[r]=i),(i.type!==t||i.texture!==n)&&(N!==r&&(e.activeTexture(r),N=r),e.bindTexture(t,n||H[t]),i.type=t,i.texture=n)},unbindTexture:function(){let t=U[N];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D(...arguments)}catch(e){(0,t.error)("WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D(...arguments)}catch(e){(0,t.error)("WebGLState:",e)}},texImage2D:function(){try{e.texImage2D(...arguments)}catch(e){(0,t.error)("WebGLState:",e)}},texImage3D:function(){try{e.texImage3D(...arguments)}catch(e){(0,t.error)("WebGLState:",e)}},pixelStorei:function(t,n){u[t]!==n&&(e.pixelStorei(t,n),u[t]=n)},getParameter:function(t){return void 0!==u[t]?u[t]:e.getParameter(t)},updateUBOMapping:function(t,n){let r=s.get(n);void 0===r&&(r=new WeakMap,s.set(n,r));let i=r.get(t);void 0===i&&(i=e.getUniformBlockIndex(n,t.name),r.set(t,i))},uniformBlockBinding:function(t,n){let r=s.get(n).get(t);o.get(n)!==r&&(e.uniformBlockBinding(n,r,t.__bindingPointIndex),o.set(n,r))},texStorage2D:function(){try{e.texStorage2D(...arguments)}catch(e){(0,t.error)("WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D(...arguments)}catch(e){(0,t.error)("WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D(...arguments)}catch(e){(0,t.error)("WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D(...arguments)}catch(e){(0,t.error)("WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D(...arguments)}catch(e){(0,t.error)("WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D(...arguments)}catch(e){(0,t.error)("WebGLState:",e)}},scissor:function(t){!1===O.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),O.copy(t))},viewport:function(t){!1===B.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),B.copy(t))},reset:function(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor
318(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),i.setReversed(!1),e.clearDepth(1),e.stencilMask(0xffffffff),e.stencilFunc(e.ALWAYS,0,0xffffffff),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),e.pixelStorei(e.PACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.BROWSER_DEFAULT_WEBGL),e.pixelStorei(e.PACK_ROW_LENGTH,0),e.pixelStorei(e.PACK_SKIP_PIXELS,0),e.pixelStorei(e.PACK_SKIP_ROWS,0),e.pixelStorei(e.UNPACK_ROW_LENGTH,0),e.pixelStorei(e.UNPACK_IMAGE_HEIGHT,0),e.pixelStorei(e.UNPACK_SKIP_PIXELS,0),e.pixelStorei(e.UNPACK_SKIP_ROWS,0),e.pixelStorei(e.UNPACK_SKIP_IMAGES,0),l={},u={},N=null,U={},c={},d=new WeakMap,h=[],f=null,p=!1,m=null,v=null,g=null,_=null,S=null,x=null,T=null,M=new t.Color(0,0,0),b=0,E=!1,R=null,w=null,C=null,y=null,A=null,O.set(0,0,e.canvas.width,e.canvas.height),B.set(0,0,e.canvas.width,e.canvas.height),r.reset(),i.reset(),a.reset()}}}function tb(e,n,r,i,a,o,s){let l,u=n.has("WEBGL_multisampled_render_to_texture")?n.get("WEBGL_multisampled_render_to_texture"):null,c="u">typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),d=new t.Vector2,h=new WeakMap,f=new Set,p=new WeakMap,m=!1;try{m="u">typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function v(e,n){return m?new OffscreenCanvas(e,n):(0,t.createElementNS)("canvas")}function g(e,n,r){let i=1,a=W(e);if((a.width>r||a.height>r)&&(i=r/Math.max(a.width,a.height)),i<1)if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap||"u">typeof VideoFrame&&e instanceof VideoFrame){let r=Math.floor(i*a.width),o=Math.floor(i*a.height);void 0===l&&(l=v(r,o));let s=n?v(r,o):l;return s.width=r,s.height=o,s.getContext("2d").drawImage(e,0,0,r,o),(0,t.warn)("WebGLRenderer: Texture has been resized from ("+a.width+"x"+a.height+") to ("+r+"x"+o+")."),s}else"data"in e&&(0,t.warn)("WebGLRenderer: Image in DataTexture is too big ("+a.width+"x"+a.height+").");return e}function _(e){return e.generateMipmaps}function S(t){e.generateMipmap(t)}function x(r,i,a,o,s,l=!1){let u;if(null!==r){if(void 0!==e[r])return e[r];(0,t.warn)("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+r+"'")}o&&((u=n.get("EXT_texture_norm16"))||(0,t.warn)("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let c=i;if(i===e.RED&&(a===e.FLOAT&&(c=e.R32F),a===e.HALF_FLOAT&&(c=e.R16F),a===e.UNSIGNED_BYTE&&(c=e.R8),a===e.UNSIGNED_SHORT&&u&&(c=u.R16_EXT),a===e.SHORT&&u&&(c=u.R16_SNORM_EXT)),i===e.RED_INTEGER&&(a===e.UNSIGNED_BYTE&&(c=e.R8UI),a===e.UNSIGNED_SHORT&&(c=e.R16UI),a===e.UNSIGNED_INT&&(c=e.R32UI),a===e.BYTE&&(c=e.R8I),a===e.SHORT&&(c=e.R16I),a===e.INT&&(c=e.R32I)),i===e.RG&&(a===e.FLOAT&&(c=e.RG32F),a===e.HALF_FLOAT&&(c=e.RG16F),a===e.UNSIGNED_BYTE&&(c=e.RG8),a===e.UNSIGNED_SHORT&&u&&(c=u.RG16_EXT),a===e.SHORT&&u&&(c=u.RG16_SNORM_EXT)),i===e.RG_INTEGER&&(a===e.UNSIGNED_BYTE&&(c=e.RG8UI),a===e.UNSIGNED_SHORT&&(c=e.RG16UI),a===e.UNSIGNED_INT&&(c=e.RG32UI),a===e.BYTE&&(c=e.RG8I),a===e.SHORT&&(c=e.RG16I),a===e.INT&&(c=e.RG32I)),i===e.RGB_INTEGER&&(a===e.UNSIGNED_BYTE&&(c=e.RGB8UI),a===e.UNSIGNED_SHORT&&(c=e.RGB16UI),a===e.UNSIGNED_INT&&(c=e.RGB32UI),a===e.BYTE&&(c=e.RGB8I),a===e.SHORT&&(c=e.RGB16I),a===e.INT&&(c=e.RGB32I)),i===e.RGBA_INTEGER&&(a===e.UNSIGNED_BYTE&&(c=e.RGBA8UI),a===e.UNSIGNED_SHORT&&(c=e.RGBA16UI),a===e.UNSIGNED_INT&&(c=e.RGBA32UI),a===e.BYTE&&(c=e.RGBA8I),a===e.SHORT&&(c=e.RGBA16I),a===e.INT&&(c=e.RGBA32I)),i===e.RGB&&(a===e.UNSIGNED_SHORT&&u&&(c=u.RGB16_EXT),a===e.SHORT&&u&&(c=u.RGB16_SNORM_EXT),a===e.UNSIGNED_INT_5_9_9_9_REV&&(c=e.RGB9_E5),a===e.UNSIGNED_INT_10F_11F_11F_REV&&(c=e.R11F_G11F_B10F)),i===e.RGBA){let n=l?t.LinearTransfer:t.ColorManagement.getTransfer(s);a===e.FLOAT&&(c=e.RGBA32F),a===e.HALF_FLOAT&&(c=e.RGBA16F),a===e.UNSIGNED_BYTE&&(c=n===t.SRGBTransfer?e.SRGB8_ALPHA8:e.RGBA8),a===e.UNSIGNED_SHORT&&u&&(c=u.RGBA16_EXT),a===e.SHORT&&u&&(c=u.RGBA16_SNORM_EXT),a===e.UNSIGNED_SHORT_4_4_4_4&&(c=e.RGBA4),a===e.UNSIGNED_SHORT_5_5_5_1&&(c=e.RGB5_A1)}return(c===e.R16F||c===e.R32F||c===e.RG16F||c===e.RG32F||c===e.RGBA16F||c===e.RGBA32F)&&n.get("EXT_color_buffer_float"),c}function T(n,r){let i;return n?null===r||r===t.UnsignedIntType||r===t.UnsignedInt248Type?i=e.DEPTH24_STENCIL8:r===t.FloatType?i=e.DEPTH32F_STENCIL8:r===t.UnsignedShortType&&(i=e.DEPTH24_STENCIL8,(0,t.warn)("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===r||r===t.UnsignedIntType||r===t.UnsignedInt248Type?i=e.DEPTH_COMPONENT24:r===t.FloatType?i=e.DEPTH_COMPONENT32F:r===t.UnsignedShortType&&(i=e.DEPTH_COMPONENT16),i}function M(e,n){return!0===_(e)||e.isFramebufferTexture&&e.minFilter!==t.NearestFilter&&e.minFilter!==t.LinearFilter?Math.log2(Math.max(n.width,n.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?n.mipmaps.length:1}function b(e){let t=e.target;t.removeEventListener("dispose",b),function(e){let t=i.get(e);if(void 0===t.__webglInit)return;let n=e.source,r=p.get(n);if(r){let i=r[t.__cacheKey];i.usedTimes--,0===i.usedTimes&&R(e),0===Object.keys(r).length&&p.delete(n)}i.remove(e)}(t),t.isVideoTexture&&h.delete(t),t.isHTMLTexture&&f.delete(t)}function E(t){let n=t.target;n.removeEventListener("dispose",E),function(t){let n=i.get(t);if(t.depthTexture&&(t.depthTexture.dispose(),i.remove(t.depthTexture)),t.isWebGLCubeRen
318derTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let r=0;r<n.__webglFramebuffer[t].length;r++)e.deleteFramebuffer(n.__webglFramebuffer[t][r]);else e.deleteFramebuffer(n.__webglFramebuffer[t]);n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[t])}else{if(Array.isArray(n.__webglFramebuffer))for(let t=0;t<n.__webglFramebuffer.length;t++)e.deleteFramebuffer(n.__webglFramebuffer[t]);else e.deleteFramebuffer(n.__webglFramebuffer);if(n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(let t=0;t<n.__webglColorRenderbuffer.length;t++)n.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(n.__webglColorRenderbuffer[t]);n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer)}let r=t.textures;for(let t=0,n=r.length;t<n;t++){let n=i.get(r[t]);n.__webglTexture&&(e.deleteTexture(n.__webglTexture),s.memory.textures--),i.remove(r[t])}i.remove(t)}(n)}function R(t){let n=i.get(t);e.deleteTexture(n.__webglTexture);let r=t.source,a=p.get(r);delete a[n.__cacheKey],s.memory.textures--}let w=0;function C(n,a){var o;let l,u=i.get(n);if(n.isVideoTexture&&(o=n,l=s.render.frame,h.get(o)!==l&&(h.set(o,l),o.update())),!1===n.isRenderTargetTexture&&!0!==n.isExternalTexture&&n.version>0&&u.__version!==n.version){let e=n.image;if(null===e)(0,t.warn)("WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void U(u,n,a);(0,t.warn)("WebGLRenderer: Texture marked for update but image is incomplete")}}else n.isExternalTexture&&(u.__webglTexture=n.sourceTexture?n.sourceTexture:null);r.bindTexture(e.TEXTURE_2D,u.__webglTexture,e.TEXTURE0+a)}let y={[t.RepeatWrapping]:e.REPEAT,[t.ClampToEdgeWrapping]:e.CLAMP_TO_EDGE,[t.MirroredRepeatWrapping]:e.MIRRORED_REPEAT},A={[t.NearestFilter]:e.NEAREST,[t.NearestMipmapNearestFilter]:e.NEAREST_MIPMAP_NEAREST,[t.NearestMipmapLinearFilter]:e.NEAREST_MIPMAP_LINEAR,[t.LinearFilter]:e.LINEAR,[t.LinearMipmapNearestFilter]:e.LINEAR_MIPMAP_NEAREST,[t.LinearMipmapLinearFilter]:e.LINEAR_MIPMAP_LINEAR},L={[t.NeverCompare]:e.NEVER,[t.AlwaysCompare]:e.ALWAYS,[t.LessCompare]:e.LESS,[t.LessEqualCompare]:e.LEQUAL,[t.EqualCompare]:e.EQUAL,[t.GreaterEqualCompare]:e.GEQUAL,[t.GreaterCompare]:e.GREATER,[t.NotEqualCompare]:e.NOTEQUAL};function D(r,o){if((o.type===t.FloatType&&!1===n.has("OES_texture_float_linear")&&(o.magFilter===t.LinearFilter||o.magFilter===t.LinearMipmapNearestFilter||o.magFilter===t.NearestMipmapLinearFilter||o.magFilter===t.LinearMipmapLinearFilter||o.minFilter===t.LinearFilter||o.minFilter===t.LinearMipmapNearestFilter||o.minFilter===t.NearestMipmapLinearFilter||o.minFilter===t.LinearMipmapLinearFilter)&&(0,t.warn)("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(r,e.TEXTURE_WRAP_S,y[o.wrapS]),e.texParameteri(r,e.TEXTURE_WRAP_T,y[o.wrapT]),(r===e.TEXTURE_3D||r===e.TEXTURE_2D_ARRAY)&&e.texParameteri(r,e.TEXTURE_WRAP_R,y[o.wrapR]),e.texParameteri(r,e.TEXTURE_MAG_FILTER,A[o.magFilter]),e.texParameteri(r,e.TEXTURE_MIN_FILTER,A[o.minFilter]),o.compareFunction&&(e.texParameteri(r,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(r,e.TEXTURE_COMPARE_FUNC,L[o.compareFunction])),!0===n.has("EXT_texture_filter_anisotropic"))&&o.magFilter!==t.NearestFilter&&(o.minFilter===t.NearestMipmapLinearFilter||o.minFilter===t.LinearMipmapLinearFilter)&&(o.type!==t.FloatType||!1!==n.has("OES_texture_float_linear"))&&(o.anisotropy>1||i.get(o).__currentAnisotropy)){let t=n.get("EXT_texture_filter_anisotropic");e.texParameterf(r,t.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,a.getMaxAnisotropy())),i.get(o).__currentAnisotropy=o.anisotropy}}function P(t,n){let r,i=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",b));let a=n.source,o=p.get(a);void 0===o&&(o={},p.set(a,o));let l=((r=[]).push(n.wrapS),r.push(n.wrapT),r.push(n.wrapR||0),r.push(n.magFilter),r.push(n.minFilter),r.push(n.anisotropy),r.push(n.internalFormat),r.push(n.format),r.push(n.type),r.push(n.generateMipmaps),r.push(n.premultiplyAlpha),r.push(n.flipY),r.push(n.unpackAlignment),r.push(n.colorSpace),r.join());if(l!==t.__cacheKey){void 0===o[l]&&(o[l]={texture:e.createTexture(),usedTimes:0},s.memory.textures++,i=!0),o[l].usedTimes++;let r=o[t.__cacheKey];void 0!==r&&(o[t.__cacheKey].usedTimes--,0===r.usedTimes&&R(n)),t.__cacheKey=l,t.__webglTexture=o[l].texture}return i}function N(e,t,n){return Math.floor(Math.floor(e/n)/t)}
318function U(n,s,l){let u=e.TEXTURE_2D;(s.isDataArrayTexture||s.isCompressedArrayTexture)&&(u=e.TEXTURE_2D_ARRAY),s.isData3DTexture&&(u=e.TEXTURE_3D);let c=P(n,s),d=s.source;r.bindTexture(u,n.__webglTexture,e.TEXTURE0+l);let h=i.get(d);if(d.version!==h.__version||!0===c){let n;if(r.activeTexture(e.TEXTURE0+l),!1==("u">typeof ImageBitmap&&s.image instanceof ImageBitmap)){let n=t.ColorManagement.getPrimaries(t.ColorManagement.workingColorSpace),i=s.colorSpace===t.NoColorSpace?null:t.ColorManagement.getPrimaries(s.colorSpace),a=s.colorSpace===t.NoColorSpace||n===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;r.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),r.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),r.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,a)}r.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment);let i=g(s.image,!1,a.maxTextureSize);i=z(s,i);let p=o.convert(s.format,s.colorSpace),m=o.convert(s.type),v=x(s.internalFormat,p,m,s.normalized,s.colorSpace,s.isVideoTexture);D(u,s);let b=s.mipmaps,E=!0!==s.isVideoTexture,R=void 0===h.__version||!0===c,w=d.dataReady,C=M(s,i);if(s.isDepthTexture)v=T(s.format===t.DepthStencilFormat,s.type),R&&(E?r.texStorage2D(e.TEXTURE_2D,1,v,i.width,i.height):r.texImage2D(e.TEXTURE_2D,0,v,i.width,i.height,0,p,m,null));else if(s.isDataTexture)if(b.length>0){E&&R&&r.texStorage2D(e.TEXTURE_2D,C,v,b[0].width,b[0].height);for(let t=0,i=b.length;t<i;t++)n=b[t],E?w&&r.texSubImage2D(e.TEXTURE_2D,t,0,0,n.width,n.height,p,m,n.data):r.texImage2D(e.TEXTURE_2D,t,v,n.width,n.height,0,p,m,n.data);s.generateMipmaps=!1}else E?(R&&r.texStorage2D(e.TEXTURE_2D,C,v,i.width,i.height),w&&function(t,n,i,a){let o=t.updateRanges;if(0===o.length)r.texSubImage2D(e.TEXTURE_2D,0,0,0,n.width,n.height,i,a,n.data);else{o.sort((e,t)=>e.start-t.start);let s=0;for(let e=1;e<o.length;e++){let t=o[s],r=o[e],i=t.start+t.count,a=N(r.start,n.width,4),l=N(t.start,n.width,4);r.start<=i+1&&a===l&&N(r.start+r.count-1,n.width,4)===a?t.count=Math.max(t.count,r.start+r.count-t.start):o[++s]=r}o.length=s+1;let l=r.getParameter(e.UNPACK_ROW_LENGTH),u=r.getParameter(e.UNPACK_SKIP_PIXELS),c=r.getParameter(e.UNPACK_SKIP_ROWS);r.pixelStorei(e.UNPACK_ROW_LENGTH,n.width);for(let t=0,s=o.length;t<s;t++){let s=o[t],l=Math.floor(s.start/4),u=Math.ceil(s.count/4),c=l%n.width,d=Math.floor(l/n.width);r.pixelStorei(e.UNPACK_SKIP_PIXELS,c),r.pixelStorei(e.UNPACK_SKIP_ROWS,d),r.texSubImage2D(e.TEXTURE_2D,0,c,d,u,1,i,a,n.data)}t.clearUpdateRanges(),r.pixelStorei(e.UNPACK_ROW_LENGTH,l),r.pixelStorei(e.UNPACK_SKIP_PIXELS,u),r.pixelStorei(e.UNPACK_SKIP_ROWS,c)}}(s,i,p,m)):r.texImage2D(e.TEXTURE_2D,0,v,i.width,i.height,0,p,m,i.data);else if(s.isCompressedTexture)if(s.isCompressedArrayTexture){E&&R&&r.texStorage3D(e.TEXTURE_2D_ARRAY,C,v,b[0].width,b[0].height,i.depth);for(let a=0,o=b.length;a<o;a++)if(n=b[a],s.format!==t.RGBAFormat)if(null!==p)if(E){if(w)if(s.layerUpdates.size>0){let i=(0,t.getByteLength)(n.width,n.height,s.format,s.type);for(let t of s.layerUpdates){let o=n.data.subarray(t*i/n.data.BYTES_PER_ELEMENT,(t+1)*i/n.data.BYTES_PER_ELEMENT);r.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,a,0,0,t,n.width,n.height,1,p,o)}}else r.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,a,0,0,0,n.width,n.height,i.depth,p,n.data)}else r.compressedTexImage3D(e.TEXTURE_2D_ARRAY,a,v,n.width,n.height,i.depth,0,n.data,0,0);else(0,t.warn)("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else E?w&&r.texSubImage3D(e.TEXTURE_2D_ARRAY,a,0,0,0,n.width,n.height,i.depth,p,m,n.data):r.texImage3D(e.TEXTURE_2D_ARRAY,a,v,n.width,n.height,i.depth,0,p,m,n.data);s.layerUpdates.size>0&&s.clearLayerUpdates()}else{E&&R&&r.texStorage2D(e.TEXTURE_2D,C,v,b[0].width,b[0].height);for(let i=0,a=b.length;i<a;i++)n=b[i],s.format!==t.RGBAFormat?null!==p?E?w&&r.compressedTexSubImage2D(e.TEXTURE_2D,i,0,0,n.width,n.height,p,n.data):r.compressedTexImage2D(e.TEXTURE_2D,i,v,n.width,n.height,0,n.data):(0,t.warn)("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):E?w&&r.texSubImage2D(e.TEXTURE_2D,i,0,0,n.width,n.height,p,m,n.data):r.texImage2D(e.TEXTURE_2D,i,v,n.width,n.height,0,p,m,n.data)}else if(s.isDataArrayTexture)if(E){if(R&&r.texStorage3D(e.TEXTURE_2D_ARRAY,C,v,i.width,i.height,i.depth),w)if(s.layerUpdates.size>0){let n=(0,t.getByteLength)(i.width,i.height,s.format,s.type);for(let t of s.layerUpdates){let a=i.data.subarray(t*n/i.data.BYTES_PER_ELEMENT,(t+1)*n/i.data.BYTES_PER_ELEMENT);r.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,t,i.width,i.height,1,p,m,a)}s.clearLayerUpdates()}else r.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,i.width,i.height,i.depth,p,m,i.data)}else r.texImage3D(e.TEXTURE_2D_ARRAY,0,v,i.width,i.height,i.depth,0,p,m,i.data);else if(s.isData3DTexture)E?(R&&r.texStorage3D(e.TEXTURE_3D,C,v,i.width,i.height,i.depth),w&&r.texSubImage3D(e.TEXTURE_3D,0,0,0,0,i.width,i.height,i.depth,p,m,i.data)):r.texImage3D(e.TEXTURE_3D,0,v,i.width,i.height,i.depth,0,p,m,i.data);else if(s.isFramebufferTexture){if(R)if(E)r.texStorage2D(e.TEXTURE_2D,C,v,i.width,i.height);else{let t=i.width,n=i.height;for(let i=0;i<C;i++)r.texImage2D(e.TEXTURE_2D,i,v,t,n,0,p,m,null),t>>=1,n>>=1}}else if(s.isHTMLTexture){if("texElementImage2D"in e){let t=e.canvas;if(t.hasAttribute("layoutsubtree")||t.setAttribute("layoutsubtree","true"),i.parentNode!==t){t.appendChild(i),f.add(s),t.onpaint=e=>{let t=e.changedElements;for(let e of f)t.includes(e.image)&&(e.needsUpdate=!0)},t.requestPaint();return}if(3===e.texElementImage2D.length)e.texElementImage2D(e.TEXTURE_2D,e.RGBA8,i);else{let t=e.RGBA,n=e.RGBA,r=e.UNSIGNED_BYTE;e.texElementImage2D(e.TEXTURE_2D,0,t,n,r,i)}e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}}else if(b.length>0){if(E&&R){let t=W(b[0]);r.texStorage2D(e.TEXTURE_2D,C,v,t.width,t.height)}for(let t=0,i=b.length;t<i;t++)n=b[t],E?w&&r.texSubImage2D(e.TEXTURE_2D,t,0,0,p,m,n):r.texImage2D(e.TEXTURE_2D,t,v,p,m,n);s.generateMipmaps=!1}else if(E){if(R){let t=W(i);r.texStorage2D(e.TEXTURE_2D,C,v,t.width,t.height)}w&&r.texSubImage2D(e.TEXTURE_2D,0,0,0,p,m,i)}else r.texImage2D(e.TEXTURE_2D,0,v,p,m,i);
vendor: 5,524 bytes, line 318
318_(s)&&S(u),h.__version=d.version,s.onUpdate&&s.onUpdate(s)}n.__version=s.version}function I(t,n,a,s,l,c){let d=o.convert(a.format,a.colorSpace),h=o.convert(a.type),f=x(a.internalFormat,d,h,a.normalized,a.colorSpace),p=i.get(n),m=i.get(a);if(m.__renderTarget=n,!p.__hasExternalTextures){let t=Math.max(1,n.width>>c),i=Math.max(1,n.height>>c);l===e.TEXTURE_3D||l===e.TEXTURE_2D_ARRAY?r.texImage3D(l,c,f,t,i,n.depth,0,d,h,null):r.texImage2D(l,c,f,t,i,0,d,h,null)}r.bindFramebuffer(e.FRAMEBUFFER,t),V(n)?u.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,s,l,m.__webglTexture,0,k(n)):(l===e.TEXTURE_2D||l>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&l<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,s,l,m.__webglTexture,c),r.bindFramebuffer(e.FRAMEBUFFER,null)}function F(t,n,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){let i=n.depthTexture,a=i&&i.isDepthTexture?i.type:null,o=T(n.stencilBuffer,a),s=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;V(n)?u.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,k(n),o,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,k(n),o,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,o,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,s,e.RENDERBUFFER,t)}else{let t=n.textures;for(let i=0;i<t.length;i++){let a=t[i],s=o.convert(a.format,a.colorSpace),l=o.convert(a.type),c=x(a.internalFormat,s,l,a.normalized,a.colorSpace);V(n)?u.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,k(n),c,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,k(n),c,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,c,n.width,n.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function O(n,a,s){let l=!0===a.isWebGLCubeRenderTarget;if(r.bindFramebuffer(e.FRAMEBUFFER,n),!(a.depthTexture&&a.depthTexture.isDepthTexture))throw Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");let c=i.get(a.depthTexture);if(c.__renderTarget=a,c.__webglTexture&&a.depthTexture.image.width===a.width&&a.depthTexture.image.height===a.height||(a.depthTexture.image.width=a.width,a.depthTexture.image.height=a.height,a.depthTexture.needsUpdate=!0),l){if(void 0===c.__webglInit&&(c.__webglInit=!0,a.depthTexture.addEventListener("dispose",b)),void 0===c.__webglTexture){let n;c.__webglTexture=e.createTexture(),r.bindTexture(e.TEXTURE_CUBE_MAP,c.__webglTexture),D(e.TEXTURE_CUBE_MAP,a.depthTexture);let i=o.convert(a.depthTexture.format),s=o.convert(a.depthTexture.type);a.depthTexture.format===t.DepthFormat?n=e.DEPTH_COMPONENT24:a.depthTexture.format===t.DepthStencilFormat&&(n=e.DEPTH24_STENCIL8);for(let t=0;t<6;t++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,n,a.width,a.height,0,i,s,null)}}else C(a.depthTexture,0);let d=c.__webglTexture,h=k(a),f=l?e.TEXTURE_CUBE_MAP_POSITIVE_X+s:e.TEXTURE_2D,p=a.depthTexture.format===t.DepthStencilFormat?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;if(a.depthTexture.format===t.DepthFormat)V(a)?u.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,p,f,d,0,h):e.framebufferTexture2D(e.FRAMEBUFFER,p,f,d,0);else if(a.depthTexture.format===t.DepthStencilFormat)V(a)?u.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,p,f,d,0,h):e.framebufferTexture2D(e.FRAMEBUFFER,p,f,d,0);else throw Error("THREE.WebGLTextures: Unknown depthTexture format.")}function B(t){let n=i.get(t),a=!0===t.isWebGLCubeRenderTarget;if(n.__boundDepthTexture!==t.depthTexture){let e=t.depthTexture;if(n.__depthDisposeCallback&&n.__depthDisposeCallback(),e){let t=()=>{delete n.__boundDepthTexture,delete n.__depthDisposeCallback,e.removeEventListener("dispose",t)};e.addEventListener("dispose",t),n.__depthDisposeCallback=t}n.__boundDepthTexture=e}if(t.depthTexture&&!n.__autoAllocateDepthBuffer)if(a)for(let e=0;e<6;e++)O(n.__webglFramebuffer[e],t,e);else{let e=t.texture.mipmaps;e&&e.length>0?O(n.__webglFramebuffer[0],t,0):O(n.__webglFramebuffer,t,0)}else if(a){n.__webglDepthbuffer=[];for(let i=0;i<6;i++)if(r.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer[i]),void 0===n.__webglDepthbuffer[i])n.__webglDepthbuffer[i]=e.createRenderbuffer(),F(n.__webglDepthbuffer[i],t,!1);else{let r=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,a=n.__webglDepthbuffer[i];e.bindRenderbuffer(e.RENDERBUFFER,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,r,e.RENDERBUFFER,a)}}else{let i=t.texture.mipmaps;if(i&&i.length>0?r.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer[0]):r.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer),void 0===n.__webglDepthbuffer)n.__webglDepthbuffer=e.createRenderbuffer(),F(n.__webglDepthbuffer,t,!1);else{let r=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,i=n.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,i),e.framebufferRenderbuffer(e.FRAMEBUFFER,r,e.RENDERBUFFER,i)}}r.bindFramebuffer(e.FRAMEBUFFER,null)}let G=[],H=[];function k(e){return Math.min(a.maxSamples,e.samples)}function V(e){let t=i.get(e);return e.samples>0&&!0===n.has("WEBGL_multisampled_render_to_texture")&&!1!==t.__useRenderToTexture}function z(e,n){let r=e.colorSpace,i=e.format,a=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||r!==t.LinearSRGBColorSpace&&r!==t.NoColorSpace&&(t.ColorManagement.getTransfer(r)===t.SRGBTransfer?(i!==t.RGBAFormat||a!==t.UnsignedByteType)&&(0,t.warn)("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):(0,t.error)("WebGLTextures: Unsupported texture color space:",r)),n}function W(e){return"u">typeof HTMLImageElement&&e instanceof HTMLImageElement?(d.width=e.naturalWi
318dth||e.width,d.height=e.naturalHeight||e.height):"u">typeof VideoFrame&&e instanceof VideoFrame?(d.width=e.displayWidth,d.height=e.displayHeight):(d.width=e.width,d.height=e.height),d}this.allocateTextureUnit=function(){let e=w;return e>=a.maxTextures&&(0,t.warn)("WebGLTextures: Trying to use "+(e+1)+" texture units while this GPU supports only "+a.maxTextures),w+=1,e},this.resetTextureUnits=function(){w=0},this.getTextureUnits=function(){return w},this.setTextureUnits=function(e){w=e},this.setTexture2D=C,this.setTexture2DArray=function(t,n){let a=i.get(t);!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version?U(a,t,n):(t.isExternalTexture&&(a.__webglTexture=t.sourceTexture?t.sourceTexture:null),r.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+n))},this.setTexture3D=function(t,n){let a=i.get(t);!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version?U(a,t,n):r.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+n)},this.setTextureCube=function(n,s){let l=i.get(n);!0!==n.isCubeDepthTexture&&n.version>0&&l.__version!==n.version?function(n,s,l){if(6!==s.image.length)return;let u=P(n,s),c=s.source;r.bindTexture(e.TEXTURE_CUBE_MAP,n.__webglTexture,e.TEXTURE0+l);let d=i.get(c);if(c.version!==d.__version||!0===u){let n;r.activeTexture(e.TEXTURE0+l);let i=t.ColorManagement.getPrimaries(t.ColorManagement.workingColorSpace),h=s.colorSpace===t.NoColorSpace?null:t.ColorManagement.getPrimaries(s.colorSpace),f=s.colorSpace===t.NoColorSpace||i===h?e.NONE:e.BROWSER_DEFAULT_WEBGL;r.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),r.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),r.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),r.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,f);let p=s.isCompressedTexture||s.image[0].isCompressedTexture,m=s.image[0]&&s.image[0].isDataTexture,v=[];for(let e=0;e<6;e++)p||m?v[e]=m?s.image[e].image:s.image[e]:v[e]=g(s.image[e],!0,a.maxCubemapSize),v[e]=z(s,v[e]);let T=v[0],b=o.convert(s.format,s.colorSpace),E=o.convert(s.type),R=x(s.internalFormat,b,E,s.normalized,s.colorSpace),w=!0!==s.isVideoTexture,C=void 0===d.__version||!0===u,y=c.dataReady,A=M(s,T);if(D(e.TEXTURE_CUBE_MAP,s),p){w&&C&&r.texStorage2D(e.TEXTURE_CUBE_MAP,A,R,T.width,T.height);for(let i=0;i<6;i++){n=v[i].mipmaps;for(let a=0;a<n.length;a++){let o=n[a];s.format!==t.RGBAFormat?null!==b?w?y&&r.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,a,0,0,o.width,o.height,b,o.data):r.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,a,R,o.width,o.height,0,o.data):(0,t.warn)("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):w?y&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,a,0,0,o.width,o.height,b,E,o.data):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,a,R,o.width,o.height,0,b,E,o.data)}}}else{if(n=s.mipmaps,w&&C){n.length>0&&A++;let t=W(v[0]);r.texStorage2D(e.TEXTURE_CUBE_MAP,A,R,t.width,t.height)}for(let t=0;t<6;t++)if(m){w?y&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,v[t].width,v[t].height,b,E,v[t].data):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,R,v[t].width,v[t].height,0,b,E,v[t].data);for(let i=0;i<n.length;i++){let a=n[i].image[t].image;w?y&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,0,0,a.width,a.height,b,E,a.data):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,R,a.width,a.height,0,b,E,a.data)}}else{w?y&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,b,E,v[t]):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,R,b,E,v[t]);for(let i=0;i<n.length;i++){let a=n[i];w?y&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,0,0,b,E,a.image[t]):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,R,b,E,a.image[t])}}}_(s)&&S(e.TEXTURE_CUBE_MAP),d.__version=c.version,s.onUpdate&&s.onUpdate(s)}n.__version=s.version}(l,n,s):r.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture,e.TEXTURE0+s)},this.rebindTextures=function(t,n,r){let a=i.get(t);void 0!==n&&I(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==r&&B(t)},this.setupRenderTarget=function(t){let n=t.texture,a=i.get(t),l=i.get(n);t.addEventListener("dispose",E);
vendor: 4,102 bytes, line 318
318let u=t.textures,c=!0===t.isWebGLCubeRenderTarget,d=u.length>1;if(!d&&(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=n.version,s.memory.textures++),c){a.__webglFramebuffer=[];for(let t=0;t<6;t++)if(n.mipmaps&&n.mipmaps.length>0){a.__webglFramebuffer[t]=[];for(let r=0;r<n.mipmaps.length;r++)a.__webglFramebuffer[t][r]=e.createFramebuffer()}else a.__webglFramebuffer[t]=e.createFramebuffer()}else{if(n.mipmaps&&n.mipmaps.length>0){a.__webglFramebuffer=[];for(let t=0;t<n.mipmaps.length;t++)a.__webglFramebuffer[t]=e.createFramebuffer()}else a.__webglFramebuffer=e.createFramebuffer();if(d)for(let t=0,n=u.length;t<n;t++){let n=i.get(u[t]);void 0===n.__webglTexture&&(n.__webglTexture=e.createTexture(),s.memory.textures++)}if(t.samples>0&&!1===V(t)){a.__webglMultisampledFramebuffer=e.createFramebuffer(),a.__webglColorRenderbuffer=[],r.bindFramebuffer(e.FRAMEBUFFER,a.__webglMultisampledFramebuffer);for(let n=0;n<u.length;n++){let r=u[n];a.__webglColorRenderbuffer[n]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,a.__webglColorRenderbuffer[n]);let i=o.convert(r.format,r.colorSpace),s=o.convert(r.type),l=x(r.internalFormat,i,s,r.normalized,r.colorSpace,!0===t.isXRRenderTarget),c=k(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,c,l,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+n,e.RENDERBUFFER,a.__webglColorRenderbuffer[n])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(a.__webglDepthRenderbuffer=e.createRenderbuffer(),F(a.__webglDepthRenderbuffer,t,!0)),r.bindFramebuffer(e.FRAMEBUFFER,null)}}if(c){r.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),D(e.TEXTURE_CUBE_MAP,n);for(let r=0;r<6;r++)if(n.mipmaps&&n.mipmaps.length>0)for(let i=0;i<n.mipmaps.length;i++)I(a.__webglFramebuffer[r][i],t,n,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+r,i);else I(a.__webglFramebuffer[r],t,n,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0);_(n)&&S(e.TEXTURE_CUBE_MAP),r.unbindTexture()}else if(d){for(let n=0,o=u.length;n<o;n++){let o=u[n],s=i.get(o),l=e.TEXTURE_2D;(t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(l=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),r.bindTexture(l,s.__webglTexture),D(l,o),I(a.__webglFramebuffer,t,o,e.COLOR_ATTACHMENT0+n,l,0),_(o)&&S(l)}r.unbindTexture()}else{let i=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(i=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),r.bindTexture(i,l.__webglTexture),D(i,n),n.mipmaps&&n.mipmaps.length>0)for(let r=0;r<n.mipmaps.length;r++)I(a.__webglFramebuffer[r],t,n,e.COLOR_ATTACHMENT0,i,r);else I(a.__webglFramebuffer,t,n,e.COLOR_ATTACHMENT0,i,0);_(n)&&S(i),r.unbindTexture()}t.depthBuffer&&B(t)},this.updateRenderTargetMipmap=function(t){let n=t.textures;for(let a=0,o=n.length;a<o;a++){let o=n[a];if(_(o)){let n=t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D,a=i.get(o).__webglTexture;r.bindTexture(n,a),S(n),r.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(t.samples>0){if(!1===V(t)){let n=t.textures,a=t.width,o=t.height,s=e.COLOR_BUFFER_BIT,l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,u=i.get(t),d=n.length>1;if(d)for(let t=0;t<n.length;t++)r.bindFramebuffer(e.FRAMEBUFFER,u.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),r.bindFramebuffer(e.FRAMEBUFFER,u.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);r.bindFramebuffer(e.READ_FRAMEBUFFER,u.__webglMultisampledFramebuffer);let h=t.texture.mipmaps;h&&h.length>0?r.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglFramebuffer[0]):r.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglFramebuffer);for(let r=0;r<n.length;r++){if(t.resolveDepthBuffer&&(t.depthBuffer&&(s|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&t.resolveStencilBuffer&&(s|=e.STENCIL_BUFFER_BIT)),d){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,u.__webglColorRen
318derbuffer[r]);let t=i.get(n[r]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,a,o,0,0,a,o,s,e.NEAREST),!0===c&&(G.length=0,H.length=0,G.push(e.COLOR_ATTACHMENT0+r),t.depthBuffer&&!1===t.storeMultisampledDepthBuffer&&(G.push(l),H.push(l),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,H)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,G))}if(r.bindFramebuffer(e.READ_FRAMEBUFFER,null),r.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),d)for(let t=0;t<n.length;t++){r.bindFramebuffer(e.FRAMEBUFFER,u.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,u.__webglColorRenderbuffer[t]);let a=i.get(n[t]).__webglTexture;r.bindFramebuffer(e.FRAMEBUFFER,u.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,a,0)}r.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&!1===t.storeMultisampledDepthBuffer&&c){let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[n])}}},this.setupDepthRenderbuffer=B,this.setupFrameBufferTexture=I,this.useMultisampledRTT=V,this.isReversedDepthBuffer=function(){return r.buffers.depth.getReversed()}}function tE(e,n){return{convert:function(r,i=t.NoColorSpace){let a,o=t.ColorManagement.getTransfer(i);if(r===t.UnsignedByteType)return e.UNSIGNED_BYTE;if(r===t.UnsignedShort4444Type)return e.UNSIGNED_SHORT_4_4_4_4;if(r===t.UnsignedShort5551Type)return e.UNSIGNED_SHORT_5_5_5_1;if(r===t.UnsignedInt5999Type)return e.UNSIGNED_INT_5_9_9_9_REV;if(r===t.UnsignedInt101111Type)return e.UNSIGNED_INT_10F_11F_11F_REV;if(r===t.ByteType)return e.BYTE;if(r===t.ShortType)return e.SHORT;if(r===t.UnsignedShortType)return e.UNSIGNED_SHORT;if(r===t.IntType)return e.INT;if(r===t.UnsignedIntType)return e.UNSIGNED_INT;if(r===t.FloatType)return e.FLOAT;if(r===t.HalfFloatType)return e.HALF_FLOAT;if(r===t.AlphaFormat)return e.ALPHA;if(r===t.RGBFormat)return e.RGB;if(r===t.RGBAFormat)return e.RGBA;if(r===t.DepthFormat)return e.DEPTH_COMPONENT;if(r===t.DepthStencilFormat)return e.DEPTH_STENCIL;if(r===t.RedFormat)return e.RED;if(r===t.RedIntegerFormat)return e.RED_INTEGER;if(r===t.RGFormat)return e.RG;if(r===t.RGIntegerFormat)return e.RG_INTEGER;if(r===t.RGBAIntegerFormat)return e.RGBA_INTEGER;if(r===t.RGB_S3TC_DXT1_Format||r===t.RGBA_S3TC_DXT1_Format||r===t.RGBA_S3TC_DXT3_Format||r===t.RGBA_S3TC_DXT5_Format)if(o===t.SRGBTransfer){if(null===(a=n.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(r===t.RGB_S3TC_DXT1_Format)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===t.RGBA_S3TC_DXT1_Format)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===t.RGBA_S3TC_DXT3_Format)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===t.RGBA_S3TC_DXT5_Format)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(a=n.get("WEBGL_compressed_texture_s3tc")))return null;if(r===t.RGB_S3TC_DXT1_Format)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===t.RGBA_S3TC_DXT1_Format)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===t.RGBA_S3TC_DXT3_Format)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===t.RGBA_S3TC_DXT5_Format)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(r===t.RGB_PVRTC_4BPPV1_Format||r===t.RGB_PVRTC_2BPPV1_Format||r===t.RGBA_PVRTC_4BPPV1_Format||r===t.RGBA_PVRTC_2BPPV1_Format){if(null===(a=n.get("WEBGL_compressed_texture_pvrtc")))return null;if(r===t.RGB_PVRTC_4BPPV1_Format)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===t.RGB_PVRTC_2BPPV1_Format)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===t.RGBA_PVRTC_4BPPV1_Format)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===t.RGBA_PVRTC_2BPPV1_Format)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(r===t.RGB_ETC1_Format||r===t.RGB_ETC2_Format||r===t.RGBA_ETC2_EAC_Format||r===t.R11_EAC_Format||r===t.SIGNED_R11_EAC_Format||r===t.RG11_EAC_Format||r===t.SIGNED_RG11_EAC_Format){if(null===(a=n.get("WEBGL_compressed_texture_etc")))return null;if(r===t.RGB_ETC1_Format||r===t.RGB_ETC2_Format)return o===t.SRGBTransfer?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(r===t.RGBA_ETC2_EAC_Format)return o===t.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC;
318if(r===t.R11_EAC_Format)return a.COMPRESSED_R11_EAC;if(r===t.SIGNED_R11_EAC_Format)return a.COMPRESSED_SIGNED_R11_EAC;if(r===t.RG11_EAC_Format)return a.COMPRESSED_RG11_EAC;if(r===t.SIGNED_RG11_EAC_Format)return a.COMPRESSED_SIGNED_RG11_EAC}if(r===t.RGBA_ASTC_4x4_Format||r===t.RGBA_ASTC_5x4_Format||r===t.RGBA_ASTC_5x5_Format||r===t.RGBA_ASTC_6x5_Format||r===t.RGBA_ASTC_6x6_Format||r===t.RGBA_ASTC_8x5_Format||r===t.RGBA_ASTC_8x6_Format||r===t.RGBA_ASTC_8x8_Format||r===t.RGBA_ASTC_10x5_Format||r===t.RGBA_ASTC_10x6_Format||r===t.RGBA_ASTC_10x8_Format||r===t.RGBA_ASTC_10x10_Format||r===t.RGBA_ASTC_12x10_Format||r===t.RGBA_ASTC_12x12_Format){if(null===(a=n.get("WEBGL_compressed_texture_astc")))return null;if(r===t.RGBA_ASTC_4x4_Format)return o===t.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===t.RGBA_ASTC_5x4_Format)return o===t.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===t.RGBA_ASTC_5x5_Format)return o===t.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===t.RGBA_ASTC_6x5_Format)return o===t.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===t.RGBA_ASTC_6x6_Format)return o===t.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===t.RGBA_ASTC_8x5_Format)return o===t.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===t.RGBA_ASTC_8x6_Format)return o===t.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===t.RGBA_ASTC_8x8_Format)return o===t.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===t.RGBA_ASTC_10x5_Format)return o===t.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===t.RGBA_ASTC_10x6_Format)return o===t.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===t.RGBA_ASTC_10x8_Format)return o===t.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===t.RGBA_ASTC_10x10_Format)return o===t.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===t.RGBA_ASTC_12x10_Format)return o===t.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===t.RGBA_ASTC_12x12_Format)return o===t.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}if(r===t.RGBA_BPTC_Format||r===t.RGB_BPTC_SIGNED_Format||r===t.RGB_BPTC_UNSIGNED_Format){if(null===(a=n.get("EXT_texture_compression_bptc")))return null;if(r===t.RGBA_BPTC_Format)return o===t.SRGBTransfer?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===t.RGB_BPTC_SIGNED_Format)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===t.RGB_BPTC_UNSIGNED_Format)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(r===t.RED_RGTC1_Format||r===t.SIGNED_RED_RGTC1_Format||r===t.RED_GREEN_RGTC2_Format||r===t.SIGNED_RED_GREEN_RGTC2_Format){if(null===(a=n.get("EXT_texture_compression_rgtc")))return null;if(r===t.RED_RGTC1_Format)return a.COMPRESSED_RED_RGTC1_EXT;if(r===t.SIGNED_RED_RGTC1_Format)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===t.RED_GREEN_RGTC2_Format)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===t.SIGNED_RED_GREEN_RGTC2_Format)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return r===t.UnsignedInt248Type?e.UNSIGNED_INT_24_8:void 0!==e[r]?e[r]:null}}}let tR=`
319void main() {
320
321	gl_Position = vec4( position, 1.0 );
322
323}`,tw=`
324uniform sampler2DArray depthColor;
325uniform float depthWidth;
326uniform float depthHeight;
327
328void main() {
329
330	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
331
332	if ( coord.x >= 1.0 ) {
333
334		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
335
336	} else {
337
338		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
339
340	}
341
342}`;class tC{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n){if(null===this.texture){let r=new t.ExternalTexture(e.texture);(e.depthNear!==n.depthNear||e.depthFar!==n.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=r}}getMesh(e){if(null!==this.texture&&null===this.mesh){let n=e.cameras[0].viewport,r=new t.ShaderMaterial({vertexShader:tR,fragmentShader:tw,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new t.Mesh(new t.PlaneGeometry(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class ty extends t.EventDispatcher{constructor(e,r){super();const i=this;let a=null,o=1,s=null,l="local-floor",u=1,c=null,d=null,h=null,f=null,p=null,m=null;const v="u">typeof XRWebGLBinding,g=new tC,_={},S=r.getContextAttributes();let x=null,T=null;const M=[],b=[],E=new t.Vector2;let R=null,w=null;const C=new t.PerspectiveCamera;C.viewport=new t.Vector4;const y=new t.PerspectiveCamera;y.viewport=new t.Vector4;const A=[C,y],L=new t.ArrayCamera;let D=null,P=null;function N(e){let t=b.indexOf(e.inputSource);if(-1===t)return;let n=M[t];void 0!==n&&(n.update(e.inputSource,e.frame,c||s),n.dispatchEvent({type:e.type,data:e.inputSource}))}function U(){a.removeEventListener("select",N),a.removeEventListener("selectstart",N),a.removeEventListener("selectend",N),a.removeEventListener("squeeze",N),a.removeEventListener("squeezestart",N),a.removeEventListener("squeezeend",N),a.removeEventListener("end",U
342),a.removeEventListener("inputsourceschange",I);for(let e=0;e<M.length;e++){let t=b[e];null!==t&&(b[e]=null,M[e].disconnect(t))}for(let e in D=null,P=null,g.reset(),_)delete _[e];if(e.setRenderTarget(x),p=null,f=null,h=null,a=null,T=null,H.stop(),i.isPresenting=!1,e.setPixelRatio(R),e.setSize(E.width,E.height,!1),null!==w){let e=w.camera;e.fov=w.fov,e.zoom=w.zoom,e.updateProjectionMatrix(),w=null}i.dispatchEvent({type:"sessionend"})}function I(e){for(let t=0;t<e.removed.length;t++){let n=e.removed[t],r=b.indexOf(n);r>=0&&(b[r]=null,M[r].disconnect(n))}for(let t=0;t<e.added.length;t++){let n=e.added[t],r=b.indexOf(n);if(-1===r){for(let e=0;e<M.length;e++)if(e>=b.length){b.push(n),r=e;break}else if(null===b[e]){b[e]=n,r=e;break}if(-1===r)break}let i=M[r];i&&i.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let n=M[e];return void 0===n&&(n=new t.WebXRController,M[e]=n),n.getTargetRaySpace()},this.getControllerGrip=function(e){let n=M[e];return void 0===n&&(n=new t.WebXRController,M[e]=n),n.getGripSpace()},this.getHand=function(e){let n=M[e];return void 0===n&&(n=new t.WebXRController,M[e]=n),n.getHandSpace()},this.setFramebufferScaleFactor=function(e){o=e,!0===i.isPresenting&&(0,t.warn)("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){l=e,!0===i.isPresenting&&(0,t.warn)("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||s},this.setReferenceSpace=function(e){c=e},this.getBaseLayer=function(){return null!==f?f:p},this.getBinding=function(){return null===h&&v&&(h=new XRWebGLBinding(a,r)),h},this.getFrame=function(){return m},this.getSession=function(){return a},this.setSession=async function(n){if(null!==(a=n)){if(x=e.getRenderTarget(),a.addEventListener("select",N),a.addEventListener("selectstart",N),a.addEventListener("selectend",N),a.addEventListener("squeeze",N),a.addEventListener("squeezestart",N),a.addEventListener("squeezeend",N),a.addEventListener("end",U),a.addEventListener("inputsourceschange",I),!0!==S.xrCompatible&&await r.makeXRCompatible(),R=e.getPixelRatio(),e.getSize(E),v&&"createProjectionLayer"in XRWebGLBinding.prototype){let n=null,i=null,s=null;S.depth&&(s=S.stencil?r.DEPTH24_STENCIL8:r.DEPTH_COMPONENT24,n=S.stencil?t.DepthStencilFormat:t.DepthFormat,i=S.stencil?t.UnsignedInt248Type:t.UnsignedIntType);let l={colorFormat:r.RGBA8,depthFormat:s,scaleFactor:o};f=(h=this.getBinding()).createProjectionLayer(l),a.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1),T=new t.WebGLRenderTarget(f.textureWidth,f.textureHeight,{format:t.RGBAFormat,type:t.UnsignedByteType,depthTexture:new t.DepthTexture(f.textureWidth,f.textureHeight,i,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:S.stencil,colorSpace:e.outputColorSpace,samples:4*!!S.antialias,resolveDepthBuffer:!1===f.ignoreDepthValues,resolveStencilBuffer:!1===f.ignoreDepthValues,storeMultisampledDepthBuffer:!1===f.ignoreDepthValues,storeMultisampledStencilBuffer:!1===f.ignoreDepthValues})}else{let n={antialias:S.antialias,alpha:!0,depth:S.depth,stencil:S.stencil,framebufferScaleFactor:o};p=new XRWebGLLayer(a,r,n),a.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),T=new t.WebGLRenderTarget(p.framebufferWidth,p.framebufferHeight,{format:t.RGBAFormat,type:t.UnsignedByteType,colorSpace:e.outputColorSpace,stencilBuffer:S.stencil,resolveDepthBuffer:!1===p.ignoreDepthValues,resolveStencilBuffer:!1===p.ignoreDepthValues,storeMultisampledDepthBuffer:!1===p.ignoreDepthValues,storeMultisampledStencilBuffer:!1===p.ignoreDepthValues})}T.isXRRenderTarget=!0,this.setFoveation(u),c=null,s=await a.requestReferenceSpace(l),H.setContext(a),H.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==a)return a.environmentBlendMode},this.getDepthTexture=function(){return g.getDepthTexture()};const F=new t.Vector3,O=new t.Vector3;function B(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){var n,r,i;if(null===a)return;let o=e.near,s=e.far;null!==g.texture&&(g.depthNear>0&&(o=g.depthNear),g.depthFar>0&&(s=g.depthFar)),L.near=y.near=C.near=o,L.far=y.far=C.far=s,(D!==L.near||P!==L.far)&&(a.updateRenderState({depthNear:L.near,depthFar:L.far}),D=L.near,P=L.far),L.layers.mask=6|e.layers.mask,C.layers.mask=-5&L.layers.mask,y.layers.mask=-3&L.layers.mask;let l=e.parent,u=L.cameras;B(L,l);for(let e=0;e<u.length;e++)B(u[e],l);2===u.length?function(e,t,n){F.setFromMatrixPosition(t.matrixWorld),O.setFromMatrixPosition(n.matrixWorld);let r=F.distanceTo(O),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),l=(i[9]+1)/i[5],u=(i[9]-1)/i[5],c=(i[8]-1)/i[0],d=(a[8]+1)/a[0],h=r/(-c+d),f=-(h*c);if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(f),e.translateZ(h),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),-1===i[10])e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let t=o+h,n=s+h;e.projectionMatrix.makePerspective(o*c-f,o*d+(r-f),l*s/n*t,u*s/n*t,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}(L,C,y):L.projectionMatrix.copy(C.projectionMatrix),null===w&&e.isPerspectiveCamera&&(w={camera:e,fov:e.fov,zoom:e.zoom}),n=e,r=L,null===(i=l)?n.matrix.copy(r.matrixWorld):(n.matrix.copy(i.matrixWorld),n.matrix.invert(),n.matrix.multiply(r.matrixWorld)),n.matrix.decompose(n.position,n.quaternion,n.scale),n.updateMatrixWorld(!0),n.projectionMatrix.copy(r.projectionMatrix),n.projectionMatrixInverse.copy(r.projectionMatrixInverse),n.isPerspectiveCamera&&(n.fov=2*t.RAD2DEG*Math.atan(1/n.projectionMatrix.elements[5]),n.zoom=1)},this.getCamera=function(){return L},this.getFoveation=function(){if(null!==f||null!==p)return u},this.setFoveation=function(e){u=e,null!==f&&(f.fixedFoveation=e),null!==p&&void 0!==p.fixedFoveation&&(p.fixedFoveation=e)},this.hasDepthSensing=function(){return null!==g.texture},this.getDepthSensingMesh=function(){return g.getMesh(L)},this.getCameraTexture=function(e){return _[e]};let G=null;const H=new n;H.setAnimationLoop(function(n,r){if(d=r.getViewerPose(c||s),m=r,null!==d){let n=d.views;null!==p&&(e.setRenderTargetFramebuffer(T,p.framebuffer),e.setRenderTarget(T));let r=!1;n.length!==L.cameras.length&&(L.cameras.length=0,r=!0);for(let i=0;i<n.length;i++){let a=n[i],o=null;if(null!==p)o=p.getViewport(a);else{let t=h.getViewSubImage(f,a);o=t.viewport,0===i&&(e.setRenderTargetTextures(T,t.colorTexture,t.depthStencilTexture),e.setRenderTarget(T))}let s=A[i];void 0===s&&((s=new t.PerspectiveCamera).layers.enable(i),s.viewport=new t.Vector4,A[i]=s),s.matrix.fromArray(a.transform.matrix),s.matrix.decompose(s.position,s.quaternion,s.scale),s.projectionMatrix.fromArray(a.projectionMatrix),s.projectionMatrixInverse.copy(s.projectionMatrix).invert(),s.viewport.set(o.x,o.y,o.width,o.height),0===i&&(L.matrix.copy(s.matrix
342),L.matrix.decompose(L.position,L.quaternion,L.scale)),!0===r&&L.cameras.push(s)}let o=a.enabledFeatures;if(o&&o.includes("depth-sensing")&&"gpu-optimized"==a.depthUsage&&v){let e=(h=i.getBinding()).getDepthInformation(n[0]);e&&e.isValid&&e.texture&&g.init(e,a.renderState)}if(o&&o.includes("camera-access")&&v){e.state.unbindTexture(),h=i.getBinding();for(let e=0;e<n.length;e++){let r=n[e].camera;if(r){let e=_[r];e||(e=new t.ExternalTexture,_[r]=e);let n=h.getCameraImage(r);e.sourceTexture=n}}}}for(let e=0;e<M.length;e++){let t=b[e],n=M[e];null!==t&&void 0!==n&&n.update(t,r,c||s)}G&&G(n,r),r.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:r}),m=null}),this.setAnimationLoop=function(e){G=e},this.dispose=function(){}}}let tA=new t.Matrix4,tL=new t.Matrix3;function tD(e,n){function r(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function i(e,i){e.opacity.value=i.opacity,i.color&&e.diffuse.value.copy(i.color),i.emissive&&e.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(e.map.value=i.map,r(i.map,e.mapTransform)),i.alphaMap&&(e.alphaMap.value=i.alphaMap,r(i.alphaMap,e.alphaMapTransform)),i.bumpMap&&(e.bumpMap.value=i.bumpMap,r(i.bumpMap,e.bumpMapTransform),e.bumpScale.value=i.bumpScale,i.side===t.BackSide&&(e.bumpScale.value*=-1)),i.normalMap&&(e.normalMap.value=i.normalMap,r(i.normalMap,e.normalMapTransform),e.normalScale.value.copy(i.normalScale),i.side===t.BackSide&&e.normalScale.value.negate()),i.displacementMap&&(e.displacementMap.value=i.displacementMap,r(i.displacementMap,e.displacementMapTransform),e.displacementScale.value=i.displacementScale,e.displacementBias.value=i.displacementBias),i.emissiveMap&&(e.emissiveMap.value=i.emissiveMap,r(i.emissiveMap,e.emissiveMapTransform)),i.specularMap&&(e.specularMap.value=i.specularMap,r(i.specularMap,e.specularMapTransform)),i.alphaTest>0&&(e.alphaTest.value=i.alphaTest);let a=n.get(i),o=a.envMap,s=a.envMapRotation;o&&(e.envMap.value=o,e.envMapRotation.value.setFromMatrix4(tA.makeRotationFromEuler(s)).transpose(),o.isCubeTexture&&!1===o.isRenderTargetTexture&&e.envMapRotation.value.premultiply(tL),e.reflectivity.value=i.reflectivity,e.ior.value=i.ior,e.refractionRatio.value=i.refractionRatio),i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity,r(i.lightMap,e.lightMapTransform)),i.aoMap&&(e.aoMap.value=i.aoMap,e.aoMapIntensity.value=i.aoMapIntensity,r(i.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(n,r){r.color.getRGB(n.fogColor.value,(0,t.getUnlitUniformColorSpace)(e)),r.isFog?(n.fogNear.value=r.near,n.fogFar.value=r.far):r.isFogExp2&&(n.fogDensity.value=r.density)},refreshMaterialUniforms:function(e,a,o,s,l){var u,c,d,h,f,p,m,v,g,_,S,x,T,M,b,E,R,w,C,y,A,L,D;let P;a.isNodeMaterial?a.uniformsNeedUpdate=!1:a.isMeshBasicMaterial?i(e,a):a.isMeshLambertMaterial?(i(e,a),a.envMap&&(e.envMapIntensity.value=a.envMapIntensity)):a.isMeshToonMaterial?(i(e,a),u=e,(c=a).gradientMap&&(u.gradientMap.value=c.gradientMap)):a.isMeshPhongMaterial?(i(e,a),d=e,h=a,d.specular.value.copy(h.specular),d.shininess.value=Math.max(h.shininess,1e-4),a.envMap&&(e.envMapIntensity.value=a.envMapIntensity)):a.isMeshStandardMaterial?(i(e,a),f=e,p=a,f.metalness.value=p.metalness,p.metalnessMap&&(f.metalnessMap.value=p.metalnessMap,r(p.metalnessMap,f.metalnessMapTransform)),f.roughness.value=p.roughness,p.roughnessMap&&(f.roughnessMap.value=p.roughnessMap,r(p.roughnessMap,f.roughnessMapTransform)),p.envMap&&(f.envMapIntensity.value=p.envMapIntensity),a.isMeshPhysicalMaterial&&(m=e,v=a,g=l,m.ior.value=v.ior,v.sheen>0&&(m.sheenColor.value.copy(v.sheenColor).multiplyScalar(v.sheen),m.sheenRoughness.value=v.sheenRoughness,v.sheenColorMap&&(m.sheenColorMap.value=v.sheenColorMap,r(v.sheenColorMap,m.sheenColorMapTransform)),v.sheenRoughnessMap&&(m.sheenRoughnessMap.value=v.sheenRoughnessMap,r(v.sheenRoughnessMap,m.sheenRoughnessMapTransform))),v.clearcoat>0&&(m.clearcoat.value=v.clearcoat,m.clearcoatRoughness.value=v.clearcoatRoughness,v.clearcoatMap&&(m.clearcoatMap.value=v.clearcoatMap,r(v.clearcoatMap,m.clearcoatMapTransform)),v.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=v.clearcoatRoughnessMap,r(v.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),v.clearcoatNormalMap&&(m.clearcoatNormalMap.value=v.clearcoatNormalMap,r(v.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(v.clearcoatNormalScale),v.side===t.BackSide&&m.clearcoatNormalScale.value.negate())),v.dispersion>0&&(m.dispersion.value=v.dispersion),v.retroreflectivity>0&&(m.retroreflectivity.value=v.retroreflectivity),v.iridescence>0&&(m.iridescence.value=v.iridescence,m.iridescenceIOR.value=v.iridescenceIOR,m.
342iridescenceThicknessMinimum.value=v.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=v.iridescenceThicknessRange[1],v.iridescenceMap&&(m.iridescenceMap.value=v.iridescenceMap,r(v.iridescenceMap,m.iridescenceMapTransform)),v.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=v.iridescenceThicknessMap,r(v.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),v.transmission>0&&(m.transmission.value=v.transmission,m.transmissionSamplerMap.value=g.texture,m.transmissionSamplerSize.value.set(g.width,g.height),v.transmissionMap&&(m.transmissionMap.value=v.transmissionMap,r(v.transmissionMap,m.transmissionMapTransform)),m.thickness.value=v.thickness,v.thicknessMap&&(m.thicknessMap.value=v.thicknessMap,r(v.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=v.attenuationDistance,m.attenuationColor.value.copy(v.attenuationColor)),v.anisotropy>0&&(m.anisotropyVector.value.set(v.anisotropy*Math.cos(v.anisotropyRotation),v.anisotropy*Math.sin(v.anisotropyRotation)),v.anisotropyMap&&(m.anisotropyMap.value=v.anisotropyMap,r(v.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=v.specularIntensity,m.specularColor.value.copy(v.specularColor),v.specularColorMap&&(m.specularColorMap.value=v.specularColorMap,r(v.specularColorMap,m.specularColorMapTransform)),v.specularIntensityMap&&(m.specularIntensityMap.value=v.specularIntensityMap,r(v.specularIntensityMap,m.specularIntensityMapTransform)))):a.isMeshMatcapMaterial?(i(e,a),_=e,(S=a).matcap&&(_.matcap.value=S.matcap)):a.isMeshDepthMaterial?i(e,a):a.isMeshDistanceMaterial?(i(e,a),x=e,T=a,P=n.get(T).light,x.referencePosition.value.setFromMatrixPosition(P.matrixWorld),x.nearDistance.value=P.shadow.camera.near,x.farDistance.value=P.shadow.camera.far):a.isMeshNormalMaterial?i(e,a):a.isLineBasicMaterial?(M=e,b=a,M.diffuse.value.copy(b.color),M.opacity.value=b.opacity,b.map&&(M.map.value=b.map,r(b.map,M.mapTransform)),a.isLineDashedMaterial&&(E=e,R=a,E.dashSize.value=R.dashSize,E.totalSize.value=R.dashSize+R.gapSize,E.scale.value=R.scale)):a.isPointsMaterial?(w=e,C=a,y=o,A=s,w.diffuse.value.copy(C.color),w.opacity.value=C.opacity,w.size.value=C.size*y,w.scale.value=.5*A,C.map&&(w.map.value=C.map,r(C.map,w.uvTransform)),C.alphaMap&&(w.alphaMap.value=C.alphaMap,r(C.alphaMap,w.alphaMapTransform)),C.alphaTest>0&&(w.alphaTest.value=C.alphaTest)):a.isSpriteMaterial?(L=e,D=a,L.diffuse.value.copy(D.color),L.opacity.value=D.opacity,L.rotation.value=D.rotation,D.map&&(L.map.value=D.map,r(D.map,L.mapTransform)),D.alphaMap&&(L.alphaMap.value=D.alphaMap,r(D.alphaMap,L.alphaMapTransform)),D.alphaTest>0&&(L.alphaTest.value=D.alphaTest)):a.isShadowMaterial?(e.color.value.copy(a.color),e.opacity.value=a.opacity):a.isShaderMaterial&&(a.uniformsNeedUpdate=!1)}}}function tP(e,n,r,i){let a={},o={},s=[],l=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function u(t,n,r,i){if(!0===function(e,t,n,r){let i=e.value,a=t+"_"+n;if(void 0===r[a])return"number"==typeof i||"boolean"==typeof i?r[a]=i:ArrayBuffer.isView(i)?r[a]=i.slice():r[a]=i.clone(),!0;{let e=r[a];if("number"==typeof i||"boolean"==typeof i){if(e!==i)return r[a]=i,!0}else if(ArrayBuffer.isView(i))return!0;else if(!1===e.equals(i))return e.copy(i),!0}return!1}(t,n,r,i)){let n=t.__offset,r=t.value;if(Array.isArray(r)){let e=0;for(let n=0;n<r.length;n++){let i=r[n],a=d(i);c(i,t.__data,e),"number"==typeof i||"boolean"==typeof i||i.isMatrix3||ArrayBuffer.isView(i)||(e+=a.storage/Float32Array.BYTES_PER_ELEMENT)}}else c(r,t.__data,0);e.bufferSubData(e.UNIFORM_BUFFER,n,t.__data)}}function c(e,t,n){"number"==typeof e||"boolean"==typeof e?t[0]=e:e.isMatrix3?(t[0]=e.elements[0],t[1]=e.elements[1],t[2]=e.elements[2],t[3]=0,t[4]=e.elements[3],t[5]=e.elements[4],t[6]=e.elements[5],t[7]=0,t[8]=e.elements[6],t[9]=e.elements[7],t[10]=e.elements[8],t[11]=0):ArrayBuffer.isView(e)?t.set(new e.constructor(e.buffer,e.byteOffset,t.length)):e.toArray(t,n)}function d(e){let n={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(n.boundary=4,n.storage=4):e.isVector2?(n.boundary=8,n.storage=8):e.isVector3||e.isColor?(n.boundary=16,n.storage=12):e.isVector4?(n.boundary=16,n.storage=16):e.isMatrix3?(n.boundary=48,n.storage=48):e.isMatrix4?(n.boundary=64,n.storage=64):e.isTexture?(0,t.warn)("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(e)?(n.boundary=16,n.storage=e.byteLength):(0,t.warn)("WebGLRenderer: Unsupported uniform value type.",e),n}function h(t){let n=t.target;n.removeEventListener("dispose",h);let r=s.indexOf(n.__bindingPointIndex);s.splice(r,1),e.deleteBuffer(a[n.id]),delete a[n.id],delete o[n.id]}return{bind:function(e,t){let n=t.program;i.uniformBlockBinding(e,n)},update:function(r,c){var f;let p,m,v,g,_=a[r.id];void 0===_&&(function(e){let t=e.uniforms,n=0;for(let e=0,r=t.length;e<r;e++){let r=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=r.length;e<t;e++){let t=r[e],i=Array.isArray(t.value)?t.value:[t.value];for(let e=0,r=i.length;e<r;e++){let r=d(i[e]),a=n%16,o=a%r.boundary,s=a+o;n+=o,0!==s&&16-s<r.storage&&(n+=16-s),t.__data=new Float32Array(r.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=n,n+=r.storage}}}let r=n%16;r>0&&(n+=16-r),e.__size=n,e.__cache={}}(r),(f=r).__bindingPointIndex=p=function(){for(let e=0;e<l;e++)if(-1===s.indexOf(e))return s.push(e),e;return(0,t.error)("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}(),m=e.createBuffer(),v=f.__size,g=f.usage,e.bindBuffer(e.UNIFORM_BUFFER,m),e.bufferData(e.UNIFORM_BUFFER,v,g),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,p,m),_=m,a[r.id]=_,r.addEventListener("dispose",h));let S=c.program;i.updateUBOMapping(r,S);let x=n.render.frame;o[r.id]!==x&&(function(t){let n=a[t.id],r=t.uniforms,i=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(let e=0,t=r.length;e<t;e++){let t=r[e];if(Array.isArray(t))for(let n=0,r=t.length;n<r;n++)u(t[n],e,n,i);else u(t,e,0,i)}e.bindBuffer(e.UNIFORM_BUFFER,null)}(r),o[r.id]=x)},dispose:function(){for(let t in a)e.deleteBuffer(a[t]);s=[],a={},o={}}}}tL.set(-1,0,0,0,1,0,0,0,1);let tN=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10
342751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),tU=null;e.s(["WebGLRenderer",0,class{constructor(e={}){let i,a,o,s,l,u,m,v,g,_,S,x,T,M,b,E,R,w,C,y,A,O,G,H;const{canvas:k=(0,t.createCanvasElement)(),context:V=null,depth:z=!0,stencil:W=!1,alpha:X=!1,antialias:K=!1,premultipliedAlpha:j=!0,preserveDrawingBuffer:q=!1,powerPreference:Y="default",failIfMajorPerformanceCaveat:Z=!1,reversedDepthBuffer:$=!1,outputBufferType:Q=t.UnsignedByteType}=e;if(this.isWebGLRenderer=!0,null!==V){if("u">typeof WebGLRenderingContext&&V instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");i=V.getContextAttributes().alpha}else i=X;const J=new Set([t.RGBAIntegerFormat,t.RGIntegerFormat,t.RedIntegerFormat]),ee=new Set([t.UnsignedByteType,t.UnsignedIntType,t.UnsignedShortType,t.UnsignedInt248Type,t.UnsignedShort4444Type,t.UnsignedShort5551Type]),et=new Uint32Array(4),en=new Int32Array(4),er=new t.Vector3;let ei=null,ea=null;const eo=[],es=[];let el=null;this.domElement=k,this.debug={checkShaderErrors:!0,diagnostics:{keywords:!1},onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=t.NoToneMapping,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const eu=this;let ec=!1,ed=null,eh=null,ef=null,ep=null;this._outputColorSpace=t.SRGBColorSpace;let em=0,ev=0,eg=null,e_=-1,eS=null;const ex=new t.Vector4,eT=new t.Vector4;let eM=null;const eb=new t.Color(0);let eE=0,eR=k.width,ew=k.height,eC=1,ey=null,eA=null;const eL=new t.Vector4(0,0,eR,ew),eD=new t.Vector4(0,0,eR,ew);let eP=!1;const eN=new t.Frustum;let eU=!1,eI=!1;const eF=new t.Matrix4,eO=new t.Vector3,eB=new t.Vector4,eG={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let eH=!1;function ek(){return null===eg?eC:1}let ez=V;function eW(e,t){return k.getContext(e,t)}
342try{if("setAttribute"in k&&k.setAttribute("data-engine",`three.js r${t.REVISION}`),k.addEventListener("webglcontextlost",ej,!1),k.addEventListener("webglcontextrestored",eq,!1),k.addEventListener("webglcontextcreationerror",eY,!1),null===ez){const e="webgl2";if(ez=eW(e,{alpha:!0,depth:z,stencil:W,antialias:K,premultipliedAlpha:j,preserveDrawingBuffer:q,powerPreference:Y,failIfMajorPerformanceCaveat:Z}),null===ez)if(eW(e))throw Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes.");else throw Error("THREE.WebGLRenderer: Error creating WebGL context.")}eX()}catch(e){throw k.removeEventListener("webglcontextlost",ej,!1),k.removeEventListener("webglcontextrestored",eq,!1),k.removeEventListener("webglcontextcreationerror",eY,!1),(0,t.error)("WebGLRenderer: "+e.message),e}function eX(){(a=new D(ez)).init(),O=new tE(ez,a),o=new f(ez,a,e,O),s=new tM(ez,a),o.reversedDepthBuffer&&$&&s.buffers.depth.setReversed(!0),eh=ez.createFramebuffer(),ef=ez.createFramebuffer(),ep=ez.createFramebuffer(),l=new U(ez),u=new ta,m=new tb(ez,a,s,u,o,O,l),v=new L(eu),g=new r(ez),G=new d(ez,g),_=new P(ez,g,l,G),S=new F(ez,_,g,G,l),C=new I(ez,o,m),E=new p(u),x=new ti(eu,v,a,o,G,E),T=new tD(eu,u),M=new tu,b=new tm(a),w=new c(eu,v,s,S,i,j),R=new tT(eu,S,o),H=new tP(ez,l,o,s),y=new h(ez,a,l),A=new N(ez,a,l),l.programs=x.programs,eu.capabilities=o,eu.extensions=a,eu.properties=u,eu.renderLists=M,eu.shadowMap=R,eu.state=s,eu.info=l}Q!==t.UnsignedByteType&&(el=new B(Q,k.width,k.height,K,z,W));const eK=new ty(eu,ez);function ej(e){e.preventDefault(),(0,t.log)("WebGLRenderer: Context Lost."),ec=!0}function eq(){(0,t.log)("WebGLRenderer: Context Restored."),ec=!1;let e=l.autoReset,n=R.enabled,r=R.autoUpdate,i=R.needsUpdate,a=R.type;eX(),l.autoReset=e,R.enabled=n,R.autoUpdate=r,R.needsUpdate=i,R.type=a}function eY(e){(0,t.error)("WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function eZ(e){var t,n;let r,i=e.target;i.removeEventListener("dispose",eZ),n=t=i,void 0!==(r=u.get(n).programs)&&(r.forEach(function(e){x.releaseProgram(e)}),n.isShaderMaterial&&x.releaseShaderCache(n)),u.remove(t)}function e$(e,n,r,i){null!==ed&&e.isNodeMaterial&&ed.setObject(i,e),!0===eU&&E.setState(e,r,!1),!0===e.transparent&&e.side===t.DoubleSide&&!1===e.forceSinglePass?(e.side=t.BackSide,e.needsUpdate=!0,e6(e,n,i),e.side=t.FrontSide,e.needsUpdate=!0,e6(e,n,i),e.side=t.DoubleSide):e6(e,n,i)}this.xr=eK,this.getContext=function(){return ez},this.getContextAttributes=function(){return ez.getContextAttributes()},this.forceContextLoss=function(){let e=a.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){let e=a.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return eC},this.setPixelRatio=function(e){void 0!==e&&(eC=e,this.setSize(eR,ew,!1))},this.getSize=function(e){return e.set(eR,ew)},this.setSize=function(e,n,r=!0){eK.isPresenting?(0,t.warn)("WebGLRenderer: Can't change size while VR device is presenting."):(eR=e,ew=n,k.width=Math.floor(e*eC),k.height=Math.floor(n*eC),!0===r&&(k.style.width=e+"px",k.style.height=n+"px"),null!==el&&el.setSize(k.width,k.height),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return e.set(eR*eC,ew*eC).floor()},this.setDrawingBufferSize=function(e,t,n){eR=e,ew=t,eC=n,k.width=Math.floor(e*n),k.height=Math.floor(t*n),this.setViewport(0,0,e,t)},this.setEffects=function(e){if(Q===t.UnsignedByteType)return void(0,t.error)("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");if(e){for(let n=0;n<e.length;n++)if(!0===e[n].isOutputPass){(0,t.warn)("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}el.setEffects(e||[])},this.getCurrentViewport=function(e){return e.copy(ex)},this.getViewport=function(e){return e.copy(eL)},this.setViewport=function(e,t,n,r){e.isVector4?eL.set(e.x,e.y,e.z,e.w):eL.set(e,t,n,r),s.viewport(ex.copy(eL).multiplyScalar(eC).round())},this.getScissor=function(e){return e.copy(eD)},this.setScissor=function(e,t,n,r){e.isVector4?eD.set(e.x,e.y,e.z,e.w):eD.set(e,t,n,r),s.scissor(eT.copy(eD).multiplyScalar(eC).round())}
vendor: 3,014 bytes, line 342
342,this.getScissorTest=function(){return eP},this.setScissorTest=function(e){s.setScissorTest(eP=e)},this.setOpaqueSort=function(e){ey=e},this.setTransparentSort=function(e){eA=e},this.getClearColor=function(e){return e.copy(w.getClearColor())},this.setClearColor=function(){w.setClearColor(...arguments)},this.getClearAlpha=function(){return w.getClearAlpha()},this.setClearAlpha=function(){w.setClearAlpha(...arguments)},this.clear=function(e=!0,t=!0,n=!0){let r=0;if(e){let e=!1;if(null!==eg){let t=eg.texture.format;e=J.has(t)}if(e){let e=eg.texture.type,t=ee.has(e),n=w.getClearColor(),r=w.getClearAlpha(),i=n.r,a=n.g,o=n.b;t?(et[0]=i,et[1]=a,et[2]=o,et[3]=r,ez.clearBufferuiv(ez.COLOR,0,et)):(en[0]=i,en[1]=a,en[2]=o,en[3]=r,ez.clearBufferiv(ez.COLOR,0,en))}else r|=ez.COLOR_BUFFER_BIT}t&&(r|=ez.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),n&&(r|=ez.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(0xffffffff)),0!==r&&ez.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(e){e.setRenderer(this),ed=e},this.dispose=function(){k.removeEventListener("webglcontextlost",ej,!1),k.removeEventListener("webglcontextrestored",eq,!1),k.removeEventListener("webglcontextcreationerror",eY,!1),w.dispose(),M.dispose(),b.dispose(),u.dispose(),v.dispose(),S.dispose(),G.dispose(),H.dispose(),x.dispose(),eK.dispose(),eK.removeEventListener("sessionstart",eJ),eK.removeEventListener("sessionend",e0),e1.stop()},this.renderBufferDirect=function(e,n,r,i,l,c){let d;null===n&&(n=eG);let h=l.isMesh&&0>l.matrixWorld.determinantAffine(),f=function(e,n,r,i,a){!0!==n.isScene&&(n=eG),m.resetTextureUnits();let l=n.fog,c=i.isMeshStandardMaterial||i.isMeshLambertMaterial||i.isMeshPhongMaterial?n.environment:null,d=null===eg?eu.outputColorSpace:!0===eg.isXRRenderTarget?eg.texture.colorSpace:t.ColorManagement.workingColorSpace,h=i.isMeshStandardMaterial||i.isMeshLambertMaterial&&!i.envMap||i.isMeshPhongMaterial&&!i.envMap,f=v.get(i.envMap||c,h),p=!0===i.vertexColors&&!!r.attributes.color&&4===r.attributes.color.itemSize,g=!!r.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),_=!!r.morphAttributes.position,S=!!r.morphAttributes.normal,x=!!r.morphAttributes.color,M=t.NoToneMapping;i.toneMapped&&(null===eg||!0===eg.isXRRenderTarget)&&(M=eu.toneMapping);let b=r.morphAttributes.position||r.morphAttributes.normal||r.morphAttributes.color,R=void 0!==b?b.length:0,w=u.get(i),y=ea.state.lights;if(!0===eU&&(!0===eI||e!==eS)){let t=e===eS&&i.id===e_;E.setState(i,e,t)}let A=!1;i.version===w.__version?w.needsLights&&w.lightsStateVersion!==y.state.version||w.outputColorSpace!==d||a.isBatchedMesh&&!1===w.batching?A=!0:a.isBatchedMesh||!0!==w.batching?a.isBatchedMesh&&!0===w.batchingColor&&null===a._colorsTexture||a.isBatchedMesh&&!1===w.batchingColor&&null!==a._colorsTexture||a.isInstancedMesh&&!1===w.instancing?A=!0:a.isInstancedMesh||!0!==w.instancing?a.isSkinnedMesh&&
vendor: 5,194 bytes, line 342
342!1===w.skinning?A=!0:a.isSkinnedMesh||!0!==w.skinning?a.isInstancedMesh&&!0===w.instancingColor&&null===a.instanceColor||a.isInstancedMesh&&!1===w.instancingColor&&null!==a.instanceColor||a.isInstancedMesh&&!0===w.instancingMorph&&null===a.morphTexture||a.isInstancedMesh&&!1===w.instancingMorph&&null!==a.morphTexture||w.envMap!==f||!0===i.fog&&w.fog!==l||void 0!==w.numClippingPlanes&&(w.numClippingPlanes!==E.numPlanes||w.numIntersection!==E.numIntersection)||w.vertexAlphas!==p||w.vertexTangents!==g||w.morphTargets!==_||w.morphNormals!==S||w.morphColors!==x||w.toneMapping!==M||w.morphTargetsCount!==R?A=!0:!!w.lightProbeGrid!=ea.state.lightProbeGridArray.length>0&&(A=!0):A=!0:A=!0:A=!0:(A=!0,w.__version=i.version);let L=w.currentProgram;!0===A&&(L=e6(i,n,a),ed&&i.isNodeMaterial&&ed.onUpdateProgram(i,L,w));let D=!1,P=!1,N=!1,U=L.getUniforms(),I=w.uniforms;if(s.useProgram(L.program)&&(D=!0,P=!0,N=!0),i.id!==e_&&(e_=i.id,P=!0),w.needsLights){let e=function(e,t){if(0===e.length)return null;if(1===e.length)return null!==e[0].texture?e[0]:null;er.setFromMatrixPosition(t.matrixWorld);for(let t=0,n=e.length;t<n;t++){let n=e[t];if(null!==n.texture&&n.boundingBox.containsPoint(er))return n}return null}(ea.state.lightProbeGridArray,a);w.lightProbeGrid!==e&&(w.lightProbeGrid=e,P=!0)}if(D||eS!==e){s.buffers.depth.getReversed()&&!0!==e.reversedDepth&&(e._reversedDepth=!0,e.updateProjectionMatrix()),U.setValue(ez,"projectionMatrix",e.projectionMatrix),U.setValue(ez,"viewMatrix",e.matrixWorldInverse);let t=U.map.cameraPosition;void 0!==t&&t.setValue(ez,eO.setFromMatrixPosition(e.matrixWorld)),o.logarithmicDepthBuffer&&U.setValue(ez,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&U.setValue(ez,"isOrthographic",!0===e.isOrthographicCamera),eS!==e&&(eS=e,P=!0,N=!0)}if(w.needsLights&&(y.state.sunShadowMap.length>0&&U.setValue(ez,"sunShadowMap",y.state.sunShadowMap,m),y.state.directionalShadowMap.length>0&&U.setValue(ez,"directionalShadowMap",y.state.directionalShadowMap,m),y.state.spotShadowMap.length>0&&U.setValue(ez,"spotShadowMap",y.state.spotShadowMap,m),y.state.pointShadowMap.length>0&&U.setValue(ez,"pointShadowMap",y.state.pointShadowMap,m)),a.isSkinnedMesh){U.setOptional(ez,a,"bindMatrix"),U.setOptional(ez,a,"bindMatrixInverse");let e=a.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),U.setValue(ez,"boneTexture",e.boneTexture,m))}a.isBatchedMesh&&(U.setOptional(ez,a,"batchingTexture"),U.setValue(ez,"batchingTexture",a._matricesTexture,m),U.setOptional(ez,a,"batchingIdTexture"),U.setValue(ez,"batchingIdTexture",a._indirectTexture,m),U.setOptional(ez,a,"batchingColorTexture"),null!==a._colorsTexture&&U.setValue(ez,"batchingColorTexture",a._colorsTexture,m));let F=r.morphAttributes;if((void 0!==F.position||void 0!==F.normal||void 0!==F.color)&&C.update(a,r,L),(P||w.receiveShadow!==a.receiveShadow)&&(w.receiveShadow=a.receiveShadow,U.setValue(ez,"receiveShadow",a.receiveShadow)),(i.isMeshStandardMaterial||i.isMeshLambertMaterial||i.isMeshPhongMaterial)&&null===i.envMap&&null!==n.environment&&(I.envMapIntensity.value=n.environmentIntensity),void 0!==I.dfgLUT&&(I.dfgLUT.value=(null===tU&&((tU=new t.DataTexture(tN,16,16,t.RGFormat,t.HalfFloatType)).name="DFG_LUT",tU.minFilter=t.LinearFilter,tU.magFilter=t.LinearFilter,tU.wrapS=t.ClampToEdgeWrapping,tU.wrapT=t.ClampToEdgeWrapping,tU.generateMipmaps=!1,tU.needsUpdate=!0),tU)),P){var O,B;if(U.setValue(ez,"toneMappingExposure",eu.toneMappingExposure),w.needsLights&&(O=I,B=N,O.ambientLightColor.needsUpdate=B,O.lightProbe.needsUpdate=B,O.sunLights.needsUpdate=B,O.sunLightShadows.needsUpdate=B,O.directionalLights.needsUpdate=B,O.directionalLightShadows.needsUpdate=B,O.pointLights.needsUpdate=B,O.pointLightShadows.needsUpdate=B,O.spotLights.needsUpdate=B,O.spotLightShadows.needsUpdate=B,O.rectAreaLights.needsUpdate=B,O.hemisphereLights.needsUpdate=B),l&&!0===i.fog&&T.refreshFogUniforms(I,l),T.refreshMaterialUniforms(I,i,eC,ew,ea.state.transmissionRenderTarget[e.id]),w.needsLights&&w.lightProbeGrid){let e=w.lightProbeGrid;I.probesSH.value=e.texture,I.probesMin.value.copy(e.boundingBox.min),I.probesMax.value.copy(e.boundingBox.max),I.probesResolution.value.copy(e.resolution)}eV.upload(ez,e9(w),I,m)}if(i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(eV.upload(ez,e9(w),I,m),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&U.setValue(ez,"center",a.center),U.setValue(ez,"modelViewMatrix",a.modelViewMatrix),U.setValue(ez,"normalMatrix",a.normalMatrix),U.setValue(ez,"modelMatrix",a.matrixWorld),void 0!==i.uniformsGroups){let e=i.uniformsGroups;for(let t=0,n=e.length;t<n;t++){let n=e[t];H.update(n,L),H.bind(n,L)}}return L}(e,n,r,i,l);s.setMaterial(i,h);let p=r.index,S=1;if(!0===i.wireframe){if(void 0===(p=_.getWireframeAttribute(r)))return;S=2}let x=r.drawRange,M=r.attributes.position,b=x.start*S,R=(x.start+x.count)*S;null!==c&&(b=Math.max(b,c.start*S),R=Math.min(R,(c.start+c.count)*S)),null!==p?(b=Math.max(b,0),R=Math.min(R,p.count)):null!=M&&(b=Math.max(b,0),R=Math.min(R,M.count));let w=R-b;if(w<0||w===1/0)return;G.setup(l,i,f,r,p);let L=y;
vendor: 19,772 bytes, line 342
342if(null!==p&&(d=g.get(p),(L=A).setIndex(d)),l.isMesh)!0===i.wireframe?(s.setLineWidth(i.wireframeLinewidth*ek()),L.setMode(ez.LINES)):L.setMode(ez.TRIANGLES);else if(l.isLine){let e=i.linewidth;void 0===e&&(e=1),s.setLineWidth(e*ek()),l.isLineSegments?L.setMode(ez.LINES):l.isLineLoop?L.setMode(ez.LINE_LOOP):L.setMode(ez.LINE_STRIP)}else l.isPoints?L.setMode(ez.POINTS):l.isSprite&&L.setMode(ez.TRIANGLES);if(l.isBatchedMesh)if(a.get("WEBGL_multi_draw"))L.renderMultiDraw(l._multiDrawStarts,l._multiDrawCounts,l._multiDrawCount);else{let e=l._multiDrawStarts,t=l._multiDrawCounts,n=l._multiDrawCount,r=p?g.get(p).bytesPerElement:1,a=u.get(i).currentProgram.getUniforms();for(let i=0;i<n;i++)a.setValue(ez,"_gl_DrawID",i),L.render(e[i]/r,t[i])}else if(l.isInstancedMesh)L.renderInstances(b,w,l.count);else if(r.isInstancedBufferGeometry){let e=void 0!==r._maxInstanceCount?r._maxInstanceCount:1/0,t=Math.min(r.instanceCount,e);L.renderInstances(b,w,t)}else L.render(b,w)},this.compile=function(e,t,n=null){null===n&&(n=e),null!==ed&&ed.renderStart(e,t,n),(ea=b.get(n)).init(t),es.push(ea),n.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(ea.pushLight(e),e.castShadow&&ea.pushShadow(e))}),e!==n&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(ea.pushLight(e),e.castShadow&&ea.pushShadow(e))}),ea.setupLights(),null!==ed&&ed.updateLights(ea.state.lightsArray),eI=this.localClippingEnabled,!0===(eU=E.init(this.clippingPlanes,eI))&&E.setGlobalState(this.clippingPlanes,t),null!==ed&&R.render(ea.state.shadowsArray,n,t);let r=new Set;return e.traverse(function(e){if(!(e.isMesh||e.isPoints||e.isLine||e.isSprite))return;let i=e.material;if(i)if(Array.isArray(i))for(let a=0;a<i.length;a++){let o=i[a];e$(o,n,t,e),r.add(o)}else e$(i,n,t,e),r.add(i)}),ea=es.pop(),null!==ed&&ed.renderEnd(),r},this.compileAsync=function(e,t,n=null){let r=this.compile(e,t,n);return new Promise(t=>{function n(){(r.forEach(function(e){let t=u.get(e).currentProgram;(void 0===t||t.isReady())&&r.delete(e)}),0===r.size)?t(e):setTimeout(n,10)}null!==a.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)})};let eQ=null;function eJ(){e1.stop()}function e0(){e1.start()}const e1=new n;function e3(e,t,n,r){if(!1===e.visible)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLightProbeGrid)ea.pushLightProbeGrid(e);else if(e.isLight)ea.pushLight(e),e.castShadow&&ea.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||e.intersectsFrustum(eN)){r&&eB.setFromMatrixPosition(e.matrixWorld).applyMatrix4(eF);let i=S.update(e),a=e.material;a.visible&&ei.push(e,i,a,n,eB.z,null,t)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||e.intersectsFrustum(eN))){let i=S.update(e),a=e.material;if(r&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),eB.copy(e.boundingSphere.center)):(null===i.boundingSphere&&i.computeBoundingSphere(),eB.copy(i.boundingSphere.center)),eB.applyMatrix4(e.matrixWorld).applyMatrix4(eF)),Array.isArray(a)){let r=i.groups;for(let o=0,s=r.length;o<s;o++){let s=r[o],l=a[s.materialIndex];l&&l.visible&&ei.push(e,i,l,n,eB.z,s,t)}}else a.visible&&ei.push(e,i,a,n,eB.z,null,t)}}let i=e.children;for(let e=0,a=i.length;e<a;e++)e3(i[e],t,n,r)}function e2(e,t,n,r){let{opaque:i,transmissive:a,transparent:o}=e;ea.setupLightsView(n),!0===eU&&E.setGlobalState(eu.clippingPlanes,n),r&&s.viewport(ex.copy(r)),i.length>0&&e4(i,t,n),a.length>0&&e4(a,t,n),o.length>0&&e4(o,t,n),s.buffers.depth.setTest(!0),s.buffers.depth.setMask(!0),s.buffers.color.setMask(!0),s.setPolygonOffset(!1)}function e5(e,n,r,i){if(null!==(!0===r.isScene?r.overrideMaterial:null))return;if(void 0===ea.state.transmissionRenderTarget[i.id]){let e=a.has("EXT_color_buffer_half_float")||a.has("EXT_color_buffer_float");ea.state.transmissionRenderTarget[i.id]=new t.WebGLRenderTarget(1,1,{generateMipmaps:!0,type:e?t.HalfFloatType:t.UnsignedByteType,minFilter:t.LinearMipmapLinearFilter,samples:Math.max(4,o.samples),stencilBuffer:W,resolveDepthBuffer:!1,resolveStencilBuffer:!1,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,colorSpace:t.ColorManagement.workingColorSpace})}let s=ea.state.transmissionRenderTarget[i.id],l=i.viewport||ex;s.setSize(l.z*eu.transmissionResolutionScale,l.w*eu.transmissionResolutionScale);let u=eu.getRenderTarget(),c=eu.getActiveCubeFace(),d=eu.getActiveMipmapLevel();eu.setRenderTarget(s),eu.getClearColor(eb),(eE=eu.getClearAlpha())<1&&eu.setClearColor(0xffffff,.5),eu.clear(),eH&&w.render(r);let h=eu.toneMapping;eu.toneMapping=t.NoToneMapping;let f=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),ea.setupLightsView(i),!0===eU&&E.setGlobalState(eu.clippingPlanes,i),e4(e,r,i),m.updateMultisampleRenderTarget(s),m.updateRenderTargetMipmap(s),!1===a.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let a=0,o=n.length;a<o;a++){let{object:o,geometry:s,material:l,group:u}=n[a];if(l.side===t.DoubleSide&&o.layers.test(i.layers)){let n=l.side;l.side=t.BackSide,l.needsUpdate=!0,e8(o,r,i,s,l,u),l.side=n,l.needsUpdate=!0,e=!0}}!0===e&&(m.updateMultisampleRenderTarget(s),m.updateRenderTargetMipmap(s))}eu.setRenderTarget(u,c,d),eu.setClearColor(eb,eE),void 0!==f&&(i.viewport=f),eu.toneMapping=h}function e4(e,t,n){let r=!0===t.isScene?t.overrideMaterial:null;for(let i=0,a=e.length;i<a;i++){let a=e[i],{object:o,geometry:s,group:l}=a,u=a.material;!0===u.allowOverride&&null!==r&&(u=r),o.layers.test(n.layers)&&e8(o,t,n,s,u,l)}}function e8(e,n,r,i,a,o){null!==ed&&a.isNodeMaterial&&ed.setObject(e,a),e.onBeforeRender(eu,n,r,i,a,o),e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),a.onBeforeRender(eu,n,r,i,e,o),!0===a.transparent&&a.side===t.DoubleSide&&!1===a.forceSinglePass?(a.side=t.BackSide,a.needsUpdate=!0,eu.renderBufferDirect(r,n,i,a,e,o),a.side=t.FrontSide,a.needsUpdate=!0,eu.renderBufferDirect(r,n,i,a,e,o),a.side=t.DoubleSide):eu.renderBufferDirect(r,n,i,a,e,o),e.onAfterRender(eu,n,r,i,a,o)}function e6(e,t,n){var r;!0!==t.isScene&&(t=eG);let i=u.get(e),a=ea.state.lights,o=ea.state.shadowsArray,s=a.state.version,l=x.getParameters(e,a.state,o,t,n,ea.state.lightProbeGridArray),c=x.getProgramCacheKey(l),d=i.programs;i.environment=e.isMeshStandardMaterial||e.isMeshLambertMaterial||e.isMeshPhongMaterial?t.environment:null,i.fog=t.fog;let h=e.isMeshStandardMaterial||e.isMeshLambertMaterial&&!e.envMap||e.isMeshPhongMaterial&&!e.envMap;i.envMap=v.get(e.envMap||i.environment,h),i.envMapRotation=null!==i.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation,void 0===d&&(e.addEventListener("dispose",eZ),i.programs=d=new Map);let f=d.get(c);if(void 0!==f){if(i.currentProgram===f&&i.lightsStateVersion===s)return e7(e,l),f}else l.uniforms=x.getUniforms(e),null!==ed&&e.isNodeMaterial&&ed.build(e,n,l),e.onBeforeCompile(l,eu),f=x.acquireProgram(l,c),d.set(c,f),i.uniforms=l.uniforms;let p=i.uniforms;return(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(p.clippingPlanes=E.uniform),e7(e,l),i.needsLights=(r=e).isMeshLambertMaterial||r.isMeshToonMaterial||r.isMeshPhongMaterial||r.isMeshStandardMaterial||r.isShadowMaterial||r.isShaderMaterial&&!0===r.lights,i.lightsStateVersion=s,i.needsLights&&(p.ambientLightColor.value=a.state.ambient,p.lightProbe.value=a.state.probe,p.sunLights.value=a.state.sun,p.sunLightShadows.value=a.state.sunShadow,p.directionalLights.value=a.state.directional,p.directionalLightShadows.value=a.state.directionalShadow,p.spotLights.value=a.state.spot,p.spotLightShadows.value=a.state.spotShadow,p.rectAreaLights.value=a.state.rectArea,p.ltc_1.value=a.state.rectAreaLTC1,p.ltc_2.value=a.state.rectAreaLTC2,p.pointLights.value=a.state.point,p.pointLightShadows.value=a.state.pointShadow,p.hemisphereLights.value=a.state.hemi,p.sunShadowMatrix.value=a.state.sunShadowMatrix,p.sunShadowCascade.value=a.state.sunShadowCascade,p.directionalShadowMatrix.value=a.state.directionalShadowMatrix,p.spotLightMatrix.value=a.state.spotLightMatrix,p.spotLightMap.value=a.state.spotLightMap,p.pointShadowMatrix.value=a.state.pointShadowMatrix),i.lightProbeGrid=ea.state.lightProbeGridArray.length>0,i.currentProgram=f,i.uniformsList=null,f}function e9(e){if(null===e.uniformsList){let t=e.currentProgram.getUniforms();e.uniformsList=eV.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function e7(e,t){let n=u.get(e);n.outputColorSpace=t.outputColorSpace,n.batching=t.batching,n.batchingColor=t.batchingColor,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.instancingMorph=t.instancingMorph,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}function te(e){let t=u.get(e);return(t.__readFormat!==e.format||t.__readType!==e.type)&&(t.__readFormat=e.format,t.__readType=e.type,t.__formatReadable=o.textureFormatReadable(e.format),t.__typeReadable=o.textureTypeReadable(e.type)),t}e1.setAnimationLoop(function(e){eQ&&eQ(e)}),"u">typeof self&&e1.setContext(self),this.setAnimationLoop=function(e){eQ=e,eK.setAnimationLoop(e),null===e?e1.stop():e1.start()},eK.addEventListener("sessionstart",eJ),eK.addEventListener("sessionend",e0),this.render=function(e,n){if(void 0!==n&&!0!==n.isCamera)return void(0,t.error)("WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===ec)return;null!==ed&&ed.renderStart(e,n);let r=!0===eK.enabled&&!0===eK.isPresenting,i=null!==el&&(null===eg||r)&&el.begin(eu,eg);if(!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===n.parent&&!0===n.matrixWorldAutoUpdate&&n.updateMatrixWorld(),!0===eK.enabled&&!0===eK.isPresenting&&(null===el||!1===el.isCompositing())&&(!0===eK.cameraAutoUpdate&&eK.updateCamera(n),n=eK.getCamera()),!0===e.isScene&&e.onBeforeRender(eu,e,n,eg),(ea=b.get(e,es.length)).init(n),ea.state.textureUnits=m.getTextureUnits(),es.push(ea),eF.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),eN.setFromProjectionMatrix(eF,t.WebGLCoordinateSystem,n.reversedDepth),eI=this.localClippingEnabled,eU=E.init(this.clippingPlanes,eI),(ei=M.get(e,eo.length)).init(),eo.push(ei),!0===eK.enabled&&!0===eK.isPresenting){let e=eu.xr.getDepthSensingMesh();null!==e&&e3(e,n,-1/0,eu.sortObjects)}e3(e,n,0,eu.sortObjects),ei.finish(),null!==ed&&ed.updateLights(ea.state.lightsArray),!0===eu.sortObjects&&ei.sort(ey,eA),(eH=!1===eK.enabled||!1===eK.isPresenting||!1===eK.hasDepthSensing())&&w.addToRenderList(ei,e),this.info.render.frame++,!0===this.info.autoReset&&this.info.reset(),!0===eU&&E.beginShadows();let a=ea.state.shadowsArray;if(R.render(a,e,n),!0===eU&&E.endShadows(),!1===(i&&el.hasRenderPass())){let t=ei.opaque,r=ei.transmissive;if(ea.setupLights(),n.isArrayCamera){let i=n.cameras;if(r.length>0)for(let n=0,a=i.length;n<a;n++)e5(t,r,e,i[n]);eH&&w.render(e);for(let t=0,n=i.length;t<n;t++){let n=i[t];e2(ei,e,n,n.viewport)}}else r.length>0&&e5(t,r,e,n),eH&&w.render(e),e2(ei,e,n)}null!==eg&&0===ev&&(m.updateMultisampleRenderTarget(eg),m.updateRenderTargetMipmap(eg)),i&&el.end(eu),!0===e.isScene&&e.onAfterRender(eu,e,n),G.resetDefaultState(),e_=-1,eS=null,es.pop(),es.length>0?(ea=es[es.length-1],m.setTextureUnits(ea.state.textureUnits),!0===eU&&E.setGlobalState(eu.clippingPlanes,ea.state.camera)):ea=null,eo.pop(),ei=eo.length>0?eo[eo.length-1]:null,null!==ed&&ed.renderEnd()},this.getActiveCubeFace=function(){return em},this.getActiveMipmapLevel=function(){return ev},this.getRenderTarget=function(){return eg},this.setRenderTargetTextures=function(e,t,n){let r=u.get(e);r.__autoAllocateDepthBuffer=!1===e.resolveDepthBuffer,!1===r.__autoAllocateDepthBuffer&&(r.__useRenderToTexture=!1),u.get(e.texture).__webglTexture=t,u.get(e.depthTexture).__webglTexture=r.__autoAllocateDepthBuffer?void 0:n,r.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,t){let n=u.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,n=0){eg=e,em=t,ev=n;let r=null,i=!1,a=!1;if(e){let o=u.get(e);if(void 0!==o.__useDefaultFramebuffer){s.bindFramebuffer(ez.FRAMEBUFFER,o.__webglFramebuffer),ex.copy(e.viewport),eT.copy(e.scissor),eM=e.scissorTest,s.viewport(ex),s.scissor(eT),s.setScissorTest(eM),e_=-1;return}if(void 0===o.__webglFramebuffer)m.setupRenderTarget(e);else if(o.__hasExternalTextures)m.rebindTextures(e,u.get(e.texture).__webglTexture,u.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){let t=e.depthTexture;if(o.__boundDepthTexture!==t){if(null!==t&&u.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");m.setupDepthRenderbuffer(e)}}let l=e.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(a=!0);let c=u.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(c[t])?c[t][n]:c[t],i=!0):r=e.samples>0&&!1===m.useMultisampledRTT(e)?u.get(e).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,ex.copy(e.viewport),eT.copy(e.scissor),eM=e.scissorTest}else ex.copy(eL).multiplyScalar(eC).floor(),eT.copy(eD).multiplyScalar(eC).floor(),eM=eP;if(0!==n&&(r=eh),s.bindFramebuffer(ez.FRAMEBUFFER,r)&&s.drawBuffers(e,r),s.viewport(ex),s.scissor(eT),s.setScissorTest(eM),i){let r=u.get(e.texture);ez.framebufferTexture2D(ez.FRAMEBUFFER,ez.COLOR_ATTACHMENT0,ez.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,n)}else if(a)for(let r=0;r<e.textures.length;r++){let i=u.get(e.textures[r]);ez.framebufferTextureLayer(ez.FRAMEBUFFER,ez.COLOR_ATTACHMENT0+r,i.__webglTexture,n,t)}else if(null!==e&&0!==n){let t=u.get(e.texture);ez.framebufferTexture2D(ez.FRAMEBUFFER,ez.COLOR_ATTACHMENT0,ez.TEXTURE_2D,t.__webglTexture,n)}e_=-1},this.readRenderTargetPixels=function(e,n,r,i,a,o,l,c=0){if(!(e&&e.isWebGLRenderTarget))return void(0,t.error)("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let d=u.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==l&&(d=d[l]),d){s.bindFramebuffer(ez.FRAMEBUFFER,d);try{let s=e.textures[c],l=s.format,u=s.type;e.textures.length>1&&ez.readBuffer(ez.COLOR_ATTACHMENT0+c);let d=te(s);if(!1===d.__formatReadable)return void(0,t.error)("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!1===d.__typeReadable)return void(0,t.error)("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");n>=0&&n<=e.width-i&&r>=0&&r<=e.height-a&&ez.readPixels(n,r,i,a,O.convert(l),O.convert(u),o)}finally{let e=null!==eg?u.get(eg).__webglFramebuffer:null;s.bindFramebuffer(ez.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,n,r,i,a,o,l,c=0){if(!(e&&e.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let d=u.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==l&&(d=d[l]),d)if(n>=0&&n<=e.width-i&&r>=0&&r<=e.height-a){s.bindFramebuffer(ez.FRAMEBUFFER,d);let l=e.textures[c],h=l.format,f=l.type;e.textures.length>1&&ez.readBuffer(ez.COLOR_ATTACHMENT0+c);let p=te(l);if(!1===p.__formatReadable)throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!1===p.__typeReadable)throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let m=ez.createBuffer();ez.bindBuffer(ez.PIXEL_PACK_BUFFER,m),ez.bufferData(ez.PIXEL_PACK_BUFFER,o.byteLength,ez.STREAM_READ),ez.readPixels(n,r,i,a,O.convert(h),O.convert(f),0),ez.bindBuffer(ez.PIXEL_PACK_BUFFER,null);let v=null!==eg?u.get(eg).__webglFramebuffer:null;s.bindFramebuffer(ez.FRAMEBUFFER,v);let g=ez.fenceSync(ez.SYNC_GPU_COMMANDS_COMPLETE,0);return ez.flush(),await (0,t.probeAsync)(ez,g,4),ez.bindBuffer(ez.PIXEL_PACK_BUFFER,m),ez.getBufferSubData(ez.PIXEL_PACK_BUFFER,0,o),ez.bindBuffer(ez.PIXEL_PACK_BUFFER,null),ez.deleteBuffer(m),ez.deleteSync(g),o}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(e,t=null,n=0){let r=Math.pow(2,-n),i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r),o=null!==t?t.x:0,l=null!==t?t.y:0;m.setTexture2D(e,0),ez.copyTexSubImage2D(ez.TEXTURE_2D,n,0,0,o,l,i,a),s.unbindTexture()},this.copyTextureToTexture=function(e,t,n=null,r=null,i=0,a=0){let o,l,c,d,h,f,p,v,g,_,S=e.isCompressedTexture?e.mipmaps[a]:e.image;if(null!==n)o=n.max.x-n.min.x,l=n.max.y-n.min.y,c=n.isBox3?n.max.z-n.min.z:1,d=n.min.x,h=n.min.y,f=n.isBox3?n.min.z:0;else{let t=Math.pow(2,-i);o=Math.floor(S.width*t),l=Math.floor(S.height*t),c=e.isDataArrayTexture?S.depth:e.isData3DTexture?Math.floor(S.depth*t):1,d=0,h=0,f=0}null!==r?(p=r.x,v=r.y,g=r.z):(p=0,v=0,g=0);let x=O.convert(t.format),T=O.convert(t.type);t.isData3DTexture?(m.setTexture3D(t,0),_=ez.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(m.setTexture2DArray(t,0),_=ez.TEXTURE_2D_ARRAY):(m.setTexture2D(t,0),_=ez.TEXTURE_2D),s.activeTexture(ez.TEXTURE0),s.pixelStorei(ez.UNPACK_FLIP_Y_WEBGL,t.flipY),s.pixelStorei(ez.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),s.pixelStorei(ez.UNPACK_ALIGNMENT,t.unpackAlignment);let M=s.getParameter(ez.UNPACK_ROW_LENGTH),b=s.getParameter(ez.UNPACK_IMAGE_HEIGHT),E=s.getParameter(ez.UNPACK_SKIP_PIXELS),R=s.getParameter(ez.UNPACK_SKIP_ROWS),w=s.getParameter(ez.UNPACK_SKIP_IMAGES);s.pixelStorei(ez.UNPACK_ROW_LENGTH,S.width),s.pixelStorei(ez.UNPACK_IMAGE_HEIGHT,S.height),s.pixelStorei(ez.UNPACK_SKIP_PIXELS,d),s.pixelStorei(ez.UNPACK_SKIP_ROWS,h),s.pixelStorei(ez.UNPACK_SKIP_IMAGES,f);let C=e.isDataArrayTexture||e.isData3DTexture,y=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let n=u.get(e),r=u.get(t),m=u.get(n.__renderTarget),_=u.get(r.__renderTarget);s.bindFramebuffer(ez.READ_FRAMEBUFFER,m.__webglFramebuffer),s.bindFramebuffer(ez.DRAW_FRAMEBUFFER,_.__webglFramebuffer);for(let n=0;n<c;n++)C&&(ez.framebufferTextureLayer(ez.READ_FRAMEBUFFER,ez.COLOR_ATTACHMENT0,u.get(e).__webglTexture,i,f+n),ez.framebufferTextureLayer(ez.DRAW_FRAMEBUFFER,ez.COLOR_ATTACHMENT0,u.get(t).__webglTexture,a,g+n)),ez.blitFramebuffer(d,h,o,l,p,v,o,l,ez.DEPTH_BUFFER_BIT,ez.NEAREST);s.bindFramebuffer(ez.READ_FRAMEBUFFER,null),s.bindFramebuffer(ez.DRAW_FRAMEBUFFER,null)}else if(0!==i||e.isRenderTargetTexture||u.has(e)){let n=u.get(e),r=u.get(t);s.bindFramebuffer(ez.READ_FRAMEBUFFER,ef),s.bindFramebuffer(ez.DRAW_FRAMEBUFFER,ep);for(let e=0;e<c;e++)C?ez.framebufferTextureLayer(ez.READ_FRAMEBUFFER,ez.COLOR_ATTACHMENT0,n.__webglTexture,i,f+e):ez.framebufferTexture2D(ez.READ_FRAMEBUFFER,ez.COLOR_ATTACHMENT0,ez.TEXTURE_2D,n.__webglTexture,i),y?ez.framebufferTextureLayer(ez.DRAW_FRAMEBUFFER,ez.COLOR_ATTACHMENT0,r.__webglTexture,a,g+e):ez.framebufferTexture2D(ez.DRAW_FRAMEBUFFER,ez.COLOR_ATTACHMENT0,ez.TEXTURE_2D,r.__webglTexture,a),0!==i?ez.blitFramebuffer(d,h,o,l,p,v,o,l,ez.COLOR_BUFFER_BIT,ez.NEAREST):y?ez.copyTexSubImage3D(_,a,p,v,g+e,d,h,o,l):ez.copyTexSubImage2D(_,a,p,v,d,h,o,l);s.bindFramebuffer(ez.READ_FRAMEBUFFER,null),s.bindFramebuffer(ez.DRAW_FRAMEBUFFER,null)}else y?e.isDataTexture||e.isData3DTexture?ez.texSubImage3D(_,a,p,v,g,o,l,c,x,T,S.data):t.isCompressedArrayTexture?ez.compressedTexSubImage3D(_,a,p,v,g,o,l,c,x,S.data):ez.texSubImage3D(_,a,p,v,g,o,l,c,x,T,S):e.isDataTexture?ez.texSubImage2D(ez.TEXTURE_2D,a,p,v,o,l,x,T,S.data):e.isCompressedTexture?ez.compressedTexSubImage2D(ez.TEXTURE_2D,a,p,v,S.width,S.height,x,S.data):ez.texSubImage2D(ez.TEXTURE_2D,a,p,v,o,l,x,T,S
342);s.pixelStorei(ez.UNPACK_ROW_LENGTH,M),s.pixelStorei(ez.UNPACK_IMAGE_HEIGHT,b),s.pixelStorei(ez.UNPACK_SKIP_PIXELS,E),s.pixelStorei(ez.UNPACK_SKIP_ROWS,R),s.pixelStorei(ez.UNPACK_SKIP_IMAGES,w),0===a&&t.generateMipmaps&&ez.generateMipmap(_),s.unbindTexture()},this.initRenderTarget=function(e){void 0===u.get(e).__webglFramebuffer&&m.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?m.setTextureCube(e,0):e.isData3DTexture?m.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?m.setTexture2DArray(e,0):m.setTexture2D(e,0),s.unbindTexture()},this.resetState=function(){em=0,ev=0,eg=null,s.reset(),G.reset()},"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return t.WebGLCoordinateSystem}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let n=this.getContext();n.drawingBufferColorSpace=t.ColorManagement._getDrawingBufferColorSpace(e),n.unpackColorSpace=t.ColorManagement._getUnpackColorSpace()}}],34034),e.s(["useMouseSpeed",0,function(){let e=0,t={x:0,y:0},n=0;return{calculateMouseSpeed:r=>{let i=performance.now(),a={x:r.clientX,y:r.clientY};if(n){let r=(i-n)/1e3;e=Math.min(Math.hypot(a.x-t.x,a.y-t.y)/r/1e3,1)}return t=a,n=i,isNaN(e)&&(e=0),e}}}],7183)},7192,e=>{"use strict";let t=null,n=null,r=null,i=null,a=null,o=null,s=null,l=null,u=null,c=0;e.s(["Gui",()=>n,"Resizer",()=>a,"Scroll",()=>i,"assets",()=>s,"clientRectGl",()=>l,"gsap",()=>t,"lerp",()=>r,"setGlContext",0,function(e){let d=++c;return void 0!==e.gsap&&(t=e.gsap),void 0!==e.Gui&&(n=e.Gui),void 0!==e.lerp&&(r=e.lerp),void 0!==e.Scroll&&(i=e.Scroll),void 0!==e.Resizer&&(a=e.Resizer),void 0!==e.setWebgl&&(o=e.setWebgl),void 0!==e.assets&&(s=e.assets),void 0!==e.clientRectGl&&(l=e.clientRectGl),void 0!==e.webglHomeRef&&(u=e.webglHomeRef),()=>{d===c&&(t=null,n=null,r=null,i=null,a=null,o=null,s=null,l=null,u=null,c+=1)}},"setWebgl",()=>o,"webglHomeRef",()=>u])},28721,81190,e=>{"use strict";e.s(["Gl",()=>tW,"params",()=>tk,"resolveGlRoute",()=>tG],28721);var t=e.i(34034),n=e.i(92454),r=e.i(7183),i=e.i(7192),a=n,o=n;function s(e,t){if(t===n.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t!==n.TriangleFanDrawMode&&t!==n.TriangleStripDrawMode)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e;{let r=e.getIndex();if(null===r){let t=[],n=e.getAttribute("position");if(void 0===n)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<n.count;e++)t.push(e);e.setIndex(t),r=e.getIndex()}let i=r.count-2,a=[];if(t===n.TriangleFanDrawMode)for(let e=1;e<=i;e++)a.push(r.getX(0)),a.push(r.getX(e)),a.push(r.getX(e+1));else for(let e=0;e<i;e++)e%2==0?(a.push(r.getX(e)),a.push(r.getX(e+1)),a.push(r.getX(e+2))):(a.push(r.getX(e+2)),a.push(r.getX(e+1)),a.push(r.getX(e)));return a.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles."),e.setIndex(a),e.clearGroups(),e}}class l extends o.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new m(e)}),this.register(function(e){return new v(e)}),this.register(function(e){return new R(e)}),this.register(function(e){return new w(e)}),this.register(function(e){return new C(e)}),this.register(function(e){return new _(e)}),this.register(function(e){return new S(e)}),this.register(function(e){return new x(e)}),this.register(function(e){return new T(e)}),this.register(function(e){return new p(e)}),this.register(function(e){return new M(e)}),this.register(function(e){return new g(e)}),this.register(function(e){return new E(e)}),this.register(function(e){return new b(e)}),this.register(function(e){return new h(e)}),this.register(function(e){return new y(e,d.EXT_MESHOPT_COMPRESSION)}
342),this.register(function(e){return new y(e,d.KHR_MESHOPT_COMPRESSION)}),this.register(function(e){return new A(e)})}load(e,t,n,r){let i,a=this;if(""!==this.resourcePath)i=this.resourcePath;else if(""!==this.path){let t=o.LoaderUtils.extractUrlBase(e);i=o.LoaderUtils.resolveURL(t,this.path)}else i=o.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);let s=function(t){r?r(t):console.error(t),a.manager.itemError(e),a.manager.itemEnd(e)},l=new o.FileLoader(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(n){try{a.parse(n,i,function(n){t(n),a.manager.itemEnd(e)},s)}catch(e){s(e)}},n,s)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return -1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return -1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,r){let i,a={},o={},s=new TextDecoder;if("string"==typeof e)i=JSON.parse(e);else if(e instanceof ArrayBuffer)if(s.decode(new Uint8Array(e,0,4))===L){try{a[d.KHR_BINARY_GLTF]=new D(e)}catch(e){r&&r(e);return}i=JSON.parse(a[d.KHR_BINARY_GLTF].content)}else i=JSON.parse(s.decode(e));else i=e;if(void 0===i.asset||i.asset.version[0]<2){r&&r(Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let l=new $(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){let t=this.pluginCallbacks[e](l);t.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[t.name]=t,a[t.name]=!0}if(i.extensionsUsed)for(let e=0;e<i.extensionsUsed.length;++e){let t=i.extensionsUsed[e],n=i.extensionsRequired||[];switch(t){case d.KHR_MATERIALS_UNLIT:a[t]=new f;break;case d.KHR_DRACO_MESH_COMPRESSION:a[t]=new P(i,this.dracoLoader);break;case d.KHR_TEXTURE_TRANSFORM:a[t]=new N;break;case d.KHR_MESH_QUANTIZATION:a[t]=new U;break;default:n.indexOf(t)>=0&&void 0===o[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}l.setExtensions(a),l.setPlugins(o),l.parse(n,r)}parseAsync(e,t){let n=this;return new Promise(function(r,i){n.parse(e,t,r,i)})}}function u(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}function c(e,t,n){let r=e.json.materials[t];return r.extensions&&r.extensions[n]?r.extensions[n]:null}let d={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class h{constructor(e){this.parser=e,this.name=d.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,r=t.length;n<r;n++){let r=t[n];r.extensions&&r.extensions[this.name]&&void 0!==r.extensions[this.name].light&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){let t,n=this.parser,r="light:"+e,i=n.cache.get(r);if(i)return i;let a=n.json,s=((a.extensions&&a.extensions[this.name]||{}).lights||[])[e],l=new o.Color(0xffffff);void 0!==s.color&&l.setRGB(s.color[0],s.color[1],s.color[2],o.LinearSRGBColorSpace);let u=void 0!==s.range?s.range:0;switch(s.type){case"directional":(t=new o.DirectionalLight(l)).target.position.set(0,0,-1),t.add(t.target);break;case"point":(t=new o.PointLight(l)).distance=u;break;case"spot":(t=new o.SpotLight(l)).distance=u,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,t.angle=s.spot.outerConeAngle,t.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,t.target.position.set(0,0,-1),t.add(t.target);break;default:throw Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return t.position.set(0,0,0),j(t,s),void 0!==s.intensity&&(t.intensity=s.intensity),t.name=n.createUniqueName(s.name||"light_"+e),i=Promise.resolve(t),n.cache.add(r,i),i}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){let t=this,n=this.parser,r=n.json.nodes[e],i=(r.extensions&&r.extensions[this.name]||{}).light;return void 0===i?null:this._loadLight(i).then(function(e){return n._getNodeRef(t.cache,i,e)})}}class f{constructor(){this.name=d.KHR_MATERIALS_UNLIT}getMaterialType(){return o.MeshBasicMaterial}extendParams(e,t,n){let r=[];e.color=new o.Color(1,1,1),e.opacity=1;let i=t.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){let t=i.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],o.LinearSRGBColorSpace),e.opacity=t[3]}void 0!==i.baseColorTexture&&r.push(n.assignTexture(e,"map",i.baseColorTexture,o.SRGBColorSpace))}return Promise.all(r)}}class p{constructor(e){this.parser=e,this.name=d.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let n=c(this.parser,e,this.name);return null===n||void 0!==n.emissiveStrength&&(t.emissiveIntensity=n.emissiveStrength),Promise.resolve()}}class m{constructor(e){this.parser=e,this.name=d.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return null!==c(this.parser,e,this.name)?o.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let n=c(this.parser,e,this.name);if(null===n)return Promise.resolve();let r=[];if(void 0!==n.clearcoatFactor&&(t.clearcoat=n.clearcoatFactor),void 0!==n.clearcoatTexture&&r.push(this.parser.assignTexture(t,"clearcoatMap",n.clearcoatTexture)),void 0!==n.clearcoatRoughnessFactor&&(t.clearcoatRoughness=n.clearcoatRoughnessFactor),void 0!==n.clearcoatRoughnessTexture&&r.push(this.parser.assignTexture(t,"clearcoatRoughnessMap",n.clearcoatRoughnessTexture)),void 0!==n.clearcoatNormalTexture&&(r.push(this.parser.assignTexture(t,"clearcoatNormalMap",n.clearcoatNormalTexture)),void 0!==n.clearcoatNormalTexture.scale)){let e=n.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new o.Vector2(e,e)}return Promise.all(r)}}class v{constructor(e){this.parser=e,this.name=d.KHR_MATERIALS_DISPERSION}getMaterialType(e){return null!==c(this.parser,e,this.name)?o.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let n=c(this.parser,e,this.name);return null===n||(t.dispersion=void 0!==n.dispersion?n.dispersion:0),Promise.resolve()}}class g{constructor(e){this.parser=e,this.name=d.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return null!==c(this.parser,e,this.name)?o.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let n=c(this.parser,e,this.name);if(null===n)return Promise.resolve();let r=[];return void 0!==n.iridescenceFactor&&(t.iridescence=n.iridescenceFactor),void 0!==n.iridescenceTexture&&r.push(this.parser.assignTexture(t,"iridescenceMap",n.iridescenceTexture)),void 0!==n.iridescenceIor&&(t.iridescenceIOR=n.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==n.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=n.iridescenceThicknessMinimum),void 0!==n.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=n.iridescenceThicknessMaximum),void 0!==n.iridescenceThicknessTexture&&r.push(this.parser.assignTexture(t,"iridescenceThicknessMap",n.iridescenceThicknessTexture)),Promise.all(r)}}class _{constructor(e){this.parser=e,this.name=d.KHR_MATERIALS_SHEEN}getMaterialType(e){return null!==c(this.parser,e,this.name)?o.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let n=c(this.parser,e,this.name);if(null===n)return Promise.resolve();let r=[];if(t.sheenColor=new o.Color(0,0,0),t.sheenRoughness=0,t.sheen=1,void 0!==n.sheenColorFactor){let e=n.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],o.LinearSRGBColorSpace)}return void 0!==n.sheenRoughnessFactor&&(t.sheenRoughness=n.sheenRoughnessFactor),void 0!==n.sheenColorTexture&&r.push(this.parser.assignTexture(t,"sheenColorMap",n.sheenColorTexture,o.SRGBColorSpace)),void 0!==n.sheenRoughnessTexture&&r.push(this.parser.assignTexture(t,"sheenRoughnessMap",n.sheenRoughnessTexture)),Promise.all(r)}}class S{constructor(e){this.parser=e,this.name=d.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return null!==c(this.parser,e,this.name)?o.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let n=c(this.parser,e,this.name);if(null===n)return Promise.resolve();let r=[];return void 0!==n.transmissionFactor&&(t.transmission=n.transmissionFactor),void 0!==n.transmissionTexture&&r.push(this.parser.assignTexture(t,"transmissionMap",n.transmissionTexture)),Promise.all(r)}}class x{constructor(e){this.parser=e,this.name=d.KHR_MATERIALS_VOLUME}getMaterialType(e){return null!==c(this.parser,e,this.name)?o.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let n=c(this.parser,e,this.name);if(null===n)return Promise.resolve();let r=[];t.thickness=void 0!==n.thicknessFactor?n.thicknessFactor:0,void 0!==n.thicknessTexture&&r.push(this.parser.assignTexture(t,"thicknessMap",n.thicknessTexture)),t.attenuationDistance=n.attenuationDistance||1/0;let i=n.attenuationColor||[1,1,1];return t.attenuationColor=new o.Color().setRGB(i[0],i[1],i[2],o.LinearSRGBColorSpace),Promise.all(r)}}class T{constructor(e){this.parser=e,this.name=d.KHR_MATERIALS_IOR}getMaterialType(e){return null!==c(this.parser,e,this.name)?o.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let n=c(this.parser,e,this.name);return null===n||(t.ior=void 0!==n.ior?n.ior:1.5,0===t.ior&&(t.ior=1e3)),Promise.resolve()}}class M{constructor(e){this.parser=e,this.name=d.KHR_MATERIALS_SPECULAR}getMaterialType(e){return null!==c(this.parser,e,this.name)?o.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let n=c(this.parser,e,this.name);if(null===n)return Promise.resolve();let r=[];t.specularIntensity=void 0!==n.specularFactor?n.specularFactor:1,void 0!==n.specularTexture&&r.push(this.parser.assignTexture(t,"specularIntensityMap",n.specularTexture));let i=n.specularColorFactor||[1,1,1];return t.specularColor=new o.Color().setRGB(i[0],i[1],i[2],o.LinearSRGBColorSpace),void 0!==n.specularColorTexture&&r.push(this.parser.assignTexture(t,"specularColorMap",n.specularColorTexture,o.SRGBColorSpace)),Promise.all(r)}}class b{constructor(e){this.parser=e,this.name=d.EXT_MATERIALS_BUMP}getMaterialType(e){return null!==c(this.parser,e,this.name)?o.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let n=c(this.parser,e,this.name);if(null===n)return Promise.resolve();let r=[];return t.bumpScale=void 0!==n.bumpFactor?n.bumpFactor:1,void 0!==n.bumpTexture&&r.push(this.parser.assignTexture(t,"bumpMap",n.bumpTexture)),Promise.all(r)}}class E{constructor(e){this.parser=e,this.name=d.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return null!==c(this.parser,e,this.name)?o.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let n=c(this.parser,e,this.name);if(null===n)return Promise.resolve();let r=[];return void 0!==n.anisotropyStrength&&(t.anisotropy=n.anisotropyStrength),void 0!==n.anisotropyRotation&&(t.anisotropyRotation=n.anisotropyRotation),void 0!==n.anisotropyTexture&&r.push(this.parser.assignTexture(t,"anisotropyMap",n.anisotropyTexture)),Promise.all(r)}}class R{constructor(e){this.parser=e,this.name=d.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,n=t.json,r=n.textures[e];if(!r.extensions||!r.extensions[this.name])return null;let i=r.extensions[this.name],a=t.options.ktx2Loader;if(!a)if(!(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0))return null;else throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return t.loadTextureImage(e,i.source,a)}}class w{constructor(e){this.parser=e,this.name=d.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);null!==e&&(s=e)}return n.loadTextureImage(e,a.source,s)}}class C{constructor(e){this.parser=e,this.name=d.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);null!==e&&(s=e)}return n.loadTextureImage(e,a.source,s)}}class y{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(!n.extensions||!n.extensions[this.name])return null;{let e=n.extensions[this.name],r=this.parser.getDependency("buffer",e.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported)if(!(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0))return null;else throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return r.then(function(t){let n=e.byteOffset||0,r=e.byteLength||0,a=e.count,o=e.byteStride,s=new Uint8Array(t,n,r);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(a,o,s,e.mode,e.filter).then(function(e){return e.buffer}):i.ready.then(function(){let t=new ArrayBuffer(a*o);return i.decodeGltfBuffer(new Uint8Array(t),a,o,s,e.mode,e.filter),t})})}}}class A{constructor(e){this.name=d.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;for(let e of t.meshes[n.mesh].primitives)if(e.mode!==B.TRIANGLES&&e.mode!==B.TRIANGLE_STRIP&&e.mode!==B.TRIANGLE_FAN&&void 0!==e.mode)return null;let r=n.extensions[this.name].attributes,i=[],a={};for(let e in r)i.push(this.parser.getDependency("accessor",r[e]).then(t=>(a[e]=t,a[e])));return i.length<1?null:(i.push(this.parser.createNodeMesh(e)),Promise.all(i).then(e=>{let t=e.pop(),n=t.isGroup?t.children:[t],r=e[0].count,i=[];for(let e of n){let t=new o.Matrix4,n=new o.Vector3,s=new o.Quaternion,l=new o.Vector3(1,1,1),u=new o.InstancedMesh(e.geometry,e.material,r);for(let e=0;e<r;e++)a.TRANSLATION&&n.fromBufferAttribute(a.TRANSLATION,e),a.ROTATION&&s.fromBufferAttribute(a.ROTATION,e),a.SCALE&&l.fromBufferAttribute(a.SCALE,e),u.setMatr
342ixAt(e,t.compose(n,s,l));let c=null;for(let e in a)if("_COLOR_0"===e){let t=a[e];u.instanceColor=new o.InstancedBufferAttribute(t.array,t.itemSize,t.normalized)}else if("TRANSLATION"!==e&&"ROTATION"!==e&&"SCALE"!==e){if(null===c){let e=u.geometry;for(let t in(c=new o.BufferGeometry).name=e.name,e.attributes)c.setAttribute(t,e.attributes[t]);for(let t in e.morphAttributes)c.morphAttributes[t]=e.morphAttributes[t];for(let t of(null!==e.index&&c.setIndex(e.index),c.morphTargetsRelative=e.morphTargetsRelative,e.groups))c.addGroup(t.start,t.count,t.materialIndex);null!==e.boundingBox&&(c.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(c.boundingSphere=e.boundingSphere.clone()),c.drawRange.start=e.drawRange.start,c.drawRange.count=e.drawRange.count,c.userData=Object.assign({},e.userData),u.geometry=c}let t=a[e];c.setAttribute(e,new o.InstancedBufferAttribute(t.array,t.itemSize,t.normalized))}o.Object3D.prototype.copy.call(u,e),this.parser.assignFinalMaterial(u),i.push(u)}return t.isGroup?(t.clear(),t.add(...i),t):i[0]}))}}let L="glTF";class D{constructor(e){this.name=d.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==L)throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-12,i=new DataView(e,12);let a=0;for(;a<r;){const t=i.getUint32(a,!0);a+=4;const r=i.getUint32(a,!0);if(a+=4,0x4e4f534a===r){const r=new Uint8Array(e,12+a,t);this.content=n.decode(r)}else if(5130562===r){const n=12+a;this.body=e.slice(n,n+t)}a+=t}if(null===this.content)throw Error("THREE.GLTFLoader: JSON content not found.")}}class P{constructor(e,t){if(!t)throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=d.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let n=this.json,r=this.dracoLoader,i=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,s={},l={},u={};for(let e in a)s[z[e]||e.toLowerCase()]=a[e];for(let t in e.attributes){let r=z[t]||t.toLowerCase();if(void 0!==a[t]){let i=n.accessors[e.attributes[t]],a=G[i.componentType];u[r]=a.name,l[r]=!0===i.normalized}}return t.getDependency("bufferView",i).then(function(e){return new Promise(function(t,n){r.decodeDracoFile(e,function(e){for(let t in e.attributes){let n=e.attributes[t],r=l[t];void 0!==r&&(n.normalized=r)}t(e)},s,u,o.LinearSRGBColorSpace,n)})})}}class N{constructor(){this.name=d.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){if((void 0===t.texCoord||t.texCoord===e.channel)&&void 0===t.offset&&void 0===t.rotation&&void 0===t.scale)return e;if(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),void 0!==t.rotation){let t=Math.cos(e.rotation),n=Math.sin(e.rotation);e.matrix.set(e.repeat.x*t,e.repeat.y*n,e.offset.x,-e.repeat.x*n,e.repeat.y*t,e.offset.y,0,0,1),e.matrixAutoUpdate=!1}return e.needsUpdate=!0,e}}class U{constructor(){this.name=d.KHR_MESH_QUANTIZATION}}class I extends o.Interpolant{constructor(e,t,n,r){super(e,t,n,r)}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r*3+r;for(let e=0;e!==r;e++)t[e]=n[i+e];return t}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=2*o,l=3*o,u=r-t,c=(n-t)/u,d=c*c,h=d*c,f=e*l,p=f-l,m=-2*h+3*d,v=h-d,g=1-m,_=v-d+c;for(let e=0;e!==o;e++){let t=a[p+e+o],n=a[p+e+s]*u,r=a[f+e+o],l=a[f+e]*u;i[e]=g*t+_*n+m*r+v*l}return i}}let F=new o.Quaternion;class O extends I{interpolate_(e,t,n,r){let i=super.interpolate_(e,t,n,r);return F.fromArray(i).normalize().toArray(i),i}}let B={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},G={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},H={9728:o.NearestFilter,9729:o.LinearFilter,9984:o.NearestMipmapNearestFilter,9985:o.LinearMipmapNearestFilter,9986:o.NearestMipmapLinearFilter,9987:o.LinearMipmapLinearFilter},k={33071:o.ClampToEdgeWrapping,33648:o.MirroredRepeatWrapping,10497:o.RepeatWrapping},V={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},z={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},W={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},X={CUBICSPLINE:void 0,LINEAR:o.InterpolateLinear,STEP:o.InterpolateDiscrete};function K(e,t,n){for(let r in n.extensions)void 0===e[r]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=n.extensions[r])}function j(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function q(e){let t="",n=Object.keys(e).sort();for(let r=0,i=n.length;r<i;r++)t+=n[r]+":"+e[n[r]]+";";return t}function Y(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}let Z=new o.Matrix4;class ${constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new u,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,r=-1,i=!1,a=-1;if("u">typeof navigator&&void 0!==navigator.userAgent){const e=navigator.userAgent;n=!0===/^((?!chrome|android).)*safari/i.test(e);const t=e.match(/Version\/(\d+)/);r=n&&t?parseInt(t[1],10):-1,a=(i=e.indexOf("Firefox")>-1)?e.match(/Firefox\/([0-9]+)\./)[1]:-1}"u"<typeof createImageBitmap||n&&r<17||i&&a<98?this.textureLoader=new o.TextureLoader(this.options.manager):this.textureLoader=new o.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new o.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()}
342)).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(t){let a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};return K(i,a,r),j(a,r),Promise.all(n._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(let e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,r=t.length;n<r;n++){let r=t[n].joints;for(let t=0,n=r.length;t<n;t++)e[r[t]].isBone=!0}for(let t=0,r=e.length;t<r;t++){let r=e[t];void 0!==r.mesh&&(this._addNodeRef(this.meshCache,r.mesh),void 0!==r.skin&&(n[r.mesh].isSkinnedMesh=!0)),void 0!==r.camera&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;let r=n.clone(),i=(e,t)=>{let n=this.associations.get(e);for(let[r,a]of(null!=n&&this.associations.set(t,n),e.children.entries()))i(a,t.children[r])};return i(n,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){let r=e(t[n]);if(r)return r}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let n=[];for(let r=0;r<t.length;r++){let i=e(t[r]);i&&n.push(i)}return n}getDependency(e,t){let n=e+":"+t,r=this.cache.get(n);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case"mesh":r=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case"texture":r=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case"camera":r=this.loadCamera(t);break;default:if(!(r=this._invokeOne(function(n){return n!=this&&n.getDependency&&n.getDependency(e,t)})))throw Error("Unknown type: "+e)}this.cache.add(n,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){let n=this;t=Promise.all((this.json[e+("mesh"===e?"es":"s")]||[]).map(function(t,r){return n.getDependency(e,r)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],n=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[d.KHR_BINARY_GLTF].body);let r=this.options;return new Promise(function(e,i){n.load(o.LoaderUtils.resolveURL(t.uri,r.path),e,void 0,function(){i(Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(e){let n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)})}loadAccessor(e){let t=this,n=this.json,r=this.json.accessors[e];if(void 0===r.bufferView&&void 0===r.sparse){let e=V[r.type],t=G[r.componentType],n=!0===r.normalized,i=new t(r.count*e);return Promise.resolve(new o.BufferAttribute(i,e,n))}let i=[];return void 0!==r.bufferView?i.push(this.getDependency("bufferView",r.bufferView)):i.push(null),void 0!==r.sparse&&(i.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(i).then(function(e){let i,a,s=e[0],l=V[r.type],u=G[r.componentType],c=u.BYTES_PER_ELEMENT,d=c*l,h=r.byteOffset||0,f=void 0!==r.bufferView?n.bufferViews[r.bufferView].byteStride:void 0,p=!0===r.normalized;if(f&&f!==d){let e=Math.floor(h/f),n="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+e+":"+r.count,d=t.cache.get(n);d||(i=new u(s,e*f,r.count*f/c),d=new o.InterleavedBuffer(i,f/c),t.cac
342he.add(n,d)),a=new o.InterleavedBufferAttribute(d,l,h%f/c,p)}else i=null===s?new u(r.count*l):new u(s,h,r.count*l),a=new o.BufferAttribute(i,l,p);if(void 0!==r.sparse){let t=V.SCALAR,n=G[r.sparse.indices.componentType],i=r.sparse.indices.byteOffset||0,c=r.sparse.values.byteOffset||0,d=new n(e[1],i,r.sparse.count*t),h=new u(e[2],c,r.sparse.count*l);null!==s&&(a=new o.BufferAttribute(a.array.slice(),a.itemSize,a.normalized)),a.normalized=!1;for(let e=0,t=d.length;e<t;e++){let t=d[e];if(a.setX(t,h[e*l]),l>=2&&a.setY(t,h[e*l+1]),l>=3&&a.setZ(t,h[e*l+2]),l>=4&&a.setW(t,h[e*l+3]),l>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}a.normalized=p}return a})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e].source,i=t.images[r],a=this.textureLoader;if(i.uri){let e=n.manager.getHandler(i.uri);null!==e&&(a=e)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,n){let r=this,i=this.json,a=i.textures[e],s=i.images[t],l=(s.uri||s.bufferView)+":"+a.sampler;if(this.textureCache[l])return this.textureCache[l];let u=this.loadImageSource(t,n).then(function(t){t.flipY=!1,t.name=a.name||s.name||"",""===t.name&&"string"==typeof s.uri&&!1===s.uri.startsWith("data:image/")&&(t.name=s.uri);let n=(i.samplers||{})[a.sampler]||{};return t.magFilter=H[n.magFilter]||o.LinearFilter,t.minFilter=H[n.minFilter]||o.LinearMipmapLinearFilter,t.wrapS=k[n.wrapS]||o.RepeatWrapping,t.wrapT=k[n.wrapT]||o.RepeatWrapping,t.generateMipmaps=!t.isCompressedTexture&&t.minFilter!==o.NearestFilter&&t.minFilter!==o.LinearFilter,r.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[l]=u,u}loadImageSource(e,t){let n=this.json,r=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());let i=n.images[e],a=self.URL||self.webkitURL,s=i.uri||"",l=!1;if(void 0!==i.bufferView)s=this.getDependency("bufferView",i.bufferView).then(function(e){l=!0;let t=new Blob([e],{type:i.mimeType});return s=a.createObjectURL(t)});else if(void 0===i.uri)throw Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let u=Promise.resolve(s).then(function(e){return new Promise(function(n,i){let a=n;!0===t.isImageBitmapLoader&&(a=function(e){let t=new o.Texture(e);t.needsUpdate=!0,n(t)}),t.load(o.LoaderUtils.resolveURL(e,r.path),a,void 0,i)})}).then(function(e){var t;return!0===l&&a.revokeObjectURL(s),j(e,i),e.userData.mimeType=i.mimeType||((t=i.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":t.search(/\.ktx2($|\?)/i)>0||0===t.search(/^data\:image\/ktx2/)?"image/ktx2":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",s),e});return this.sourceCache[e]=u,u}assignTexture(e,t,n,r){let i=this;return this.getDependency("texture",n.index).then(function(a){if(!a)return null;if(void 0!==n.texCoord&&n.texCoord>0&&((a=a.clone()).channel=n.texCoord),i.extensions[d.KHR_TEXTURE_TRANSFORM]){let e=void 0!==n.extensions?n.extensions[d.KHR_TEXTURE_TRANSFORM]:void 0;if(e){let t=i.associations.get(a);a=i.extensions[d.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),i.associations.set(a,t)}}
342return void 0!==r&&(a.colorSpace=r),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,n=e.material,r=void 0===t.attributes.tangent,i=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){let e="PointsMaterial:"+n.uuid,t=this.cache.get(e);t||(t=new o.PointsMaterial,o.Material.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){let e="LineBasicMaterial:"+n.uuid,t=this.cache.get(e);t||(t=new o.LineBasicMaterial,o.Material.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(r||i||a){let e="ClonedMaterial:"+n.uuid+":";r&&(e+="derivative-tangents:"),i&&(e+="vertex-colors:"),a&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=n.clone(),i&&(t.vertexColors=!0),a&&(t.flatShading=!0),r&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return o.MeshStandardMaterial}loadMaterial(e){let t,n=this,r=this.json,i=this.extensions,a=r.materials[e],s={},l=a.extensions||{},u=[];if(l[d.KHR_MATERIALS_UNLIT]){let e=i[d.KHR_MATERIALS_UNLIT];t=e.getMaterialType(),u.push(e.extendParams(s,a,n))}else{let r=a.pbrMetallicRoughness||{};if(s.color=new o.Color(1,1,1),s.opacity=1,Array.isArray(r.baseColorFactor)){let e=r.baseColorFactor;s.color.setRGB(e[0],e[1],e[2],o.LinearSRGBColorSpace),s.opacity=e[3]}void 0!==r.baseColorTexture&&u.push(n.assignTexture(s,"map",r.baseColorTexture,o.SRGBColorSpace)),s.metalness=void 0!==r.metallicFactor?r.metallicFactor:1,s.roughness=void 0!==r.roughnessFactor?r.roughnessFactor:1,void 0!==r.metallicRoughnessTexture&&(u.push(n.assignTexture(s,"metalnessMap",r.metallicRoughnessTexture)),u.push(n.assignTexture(s,"roughnessMap",r.metallicRoughnessTexture))),t=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),u.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,s)})))}!0===a.doubleSided&&(s.side=o.DoubleSide);let c=a.alphaMode||"OPAQUE";if("BLEND"===c?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,"MASK"===c&&(s.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==o.MeshBasicMaterial&&(u.push(n.assignTexture(s,"normalMap",a.normalTexture)),s.normalScale=new o.Vector2(1,1),void 0!==a.normalTexture.scale)){let e=a.normalTexture.scale;s.normalScale.set(e,e)}if(void 0!==a.occlusionTexture&&t!==o.MeshBasicMaterial&&(u.push(n.assignTexture(s,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(s.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==o.MeshBasicMaterial){let e=a.emissiveFactor;s.emissive=new o.Color().setRGB(e[0],e[1],e[2],o.LinearSRGBColorSpace)}return void 0!==a.emissiveTexture&&t!==o.MeshBasicMaterial&&u.push(n.assignTexture(s,"emissiveMap",a.emissiveTexture,o.SRGBColorSpace)),Promise.all(u).then(function(){let r=new t(s);return a.name&&(r.name=a.name),j(r,a),n.associations.set(r,{materials:e}),a.extensions&&K(i,r,a),r})}createUniqueName(e){let t=o.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,n=this.extensions,r=this.primitiveCache,i=[];for(let a=0,l=e.length;a<l;a++){let l=e[a],u=function(e){let t,n=e.extensions&&e.extensions[d.KHR_DRACO_MESH_COMPRESSION];if(t=n?"draco:"+n.bufferView+":"+n.indices+":"+q(n.attributes):e.indices+":"+q(e.attributes)+":"+e.mode,void 0!==e.targets)for(let n=0,r=e.targets.length;n<r;n++)t+=":"+q(e.targets[n]);return t}(l),c=r[u];if(c)i.push(c.promise);else{let e;e=l.extensions&&l.extensions[d.KHR_DRACO_MESH_COMPRESSION]?function(e){return n[d.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(n){return Q(n,e,t)})}(l):Q(new o.BufferGeometry,l,t),l.mode===B.TRIANGLE_STRIP?e=e.then(e=>s(e,o.TriangleStripDrawMode)):l.mode===B.TRIANGLE_FAN&&(e=e.then(e=>s(e,o.TriangleFanDrawMode))),r[u]={primitive:l,promise:e},i.push(e)}}return Promise.all(i)}loadMesh(e){let t=this,n=this.json,r=this.extensions,i=n.meshes[e],a=i.primitives,s=[];for(let e=0,t=a.length;e<t;e++){var l;let t=void 0===a[e].material?(void 0===(l=this.cache).DefaultMaterial&&(l.DefaultMaterial=new o.MeshStandardMaterial({color:0xffffff,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:o.FrontSide})),l.DefaultMaterial):this.getDependency("material",a[e].material);s.push(t)}return s.push(t.loadGeometries(a)),Promise.all(s).then(async function(n){let s=n.slice(0,n.length-1),l=n[n.length-1],u=[];for(let n=0,c=l.length;n<c;n++){let c,d=l[n],h=a[n],f=s[n];if(h.mode===B.TRIANGLES||h.mode===B.TRIANGLE_STRIP||h.mode===B.TRIANGLE_FAN||void 0===h.mode){let e=!0===i.isSkinnedMesh,t=d.hasAttribute("skinIndex")&&d.hasAttribute("skinWeight");e&&!1===t&&console.warn("THREE.GLTFLoader: Missing skinIndex or skinWeight attributes. Skinning disabled."),!0===(c=e&&t?new o.SkinnedMesh(d,f):new o.Mesh(d,f)).isSkinnedMesh&&c.normalizeSkinWeights()}else if(h.mode===B.LINES)c=new o.LineSegments(d,f);else if(h.mode===B.LINE_STRIP)c=new o.Line(d,f);else if(h.mode===B.LINE_LOOP)c=new o.LineLoop(d,f);else if(h.mode===B.POINTS)c=new o.Points(d,f);else throw Error("THREE.GLTFLoader: Primitive mode unsupported: "+h.mode);Object.keys(c.geometry.morphAttributes).length>0&&function(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let n=0,r=t.weights.length;n<r;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){let n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(let t=0,r=n.length;t<r;t++)e.morphTargetDictionary[n[t]]=t}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}(c,i),c.name=t.createUniqueName(i.name||"mesh_"+e),j(c,i),h.extensions&&K(r,c,h),t.assignFinalMaterial(c),u.push(c)}for(let n=0,r=u.length;n<r;n++)t.associations.set(u[n],{meshes:e,primitives:n});if(1===u.length)return i.extensions&&K(r,u[0],i),u[0];let c=new o.Group;i.extensions&&K(r,c,i),t.associations.set(c,{meshes:e});for(let e=0,t=u.length;e<t;e++)c.add(u[e]);return c})}loadCamera(e){let t,n=this.json.cameras[e],r=n[n.type];return r?("perspective"===n.type?t=new o.PerspectiveCamera(o.MathUtils.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===n.type&&(t=new o.Orthogra
342phicCamera(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),j(t,n),Promise.resolve(t)):void console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){let t=this.json.skins[e],n=[];for(let e=0,r=t.joints.length;e<r;e++)n.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(e){let n=e.pop(),r=[],i=[];for(let a=0,s=e.length;a<s;a++){let s=e[a];if(s){r.push(s);let e=new o.Matrix4;null!==n&&e.fromArray(n.array,16*a),i.push(e)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[a])}return new o.Skeleton(r,i)})}loadAnimation(e){let t=this.json,n=this,r=t.animations[e],i=r.name?r.name:"animation_"+e,a=[],s=[],l=[],u=[],c=[];for(let e=0,t=r.channels.length;e<t;e++){let t=r.channels[e],n=r.samplers[t.sampler],i=t.target,o=i.node,d=void 0!==r.parameters?r.parameters[n.input]:n.input,h=void 0!==r.parameters?r.parameters[n.output]:n.output;void 0!==i.node&&(a.push(this.getDependency("node",o)),s.push(this.getDependency("accessor",d)),l.push(this.getDependency("accessor",h)),u.push(n),c.push(i))}return Promise.all([Promise.all(a),Promise.all(s),Promise.all(l),Promise.all(u),Promise.all(c)]).then(function(e){let t=e[0],a=e[1],s=e[2],l=e[3],u=e[4],c=[];for(let e=0,r=t.length;e<r;e++){let r=t[e],i=a[e],o=s[e],d=l[e],h=u[e];if(void 0===r)continue;r.updateMatrix&&r.updateMatrix();let f=n._createAnimationTracks(r,i,o,d,h);if(f)for(let e=0;e<f.length;e++)c.push(f[e])}let d=new o.AnimationClip(i,void 0,c);return j(d,r),d})}createNodeMesh(e){let t=this.json,n=this,r=t.nodes[e];return void 0===r.mesh?null:n.getDependency("mesh",r.mesh).then(function(e){let t=n._getNodeRef(n.meshCache,r.mesh,e);return void 0!==r.weights&&t.traverse(function(e){if(e.isMesh)for(let t=0,n=r.weights.length;t<n;t++)e.morphTargetInfluences[t]=r.weights[t]}),t})}loadNode(e){let t=this.json.nodes[e],n=this._loadNodeShallow(e),r=[],i=t.children||[];for(let e=0,t=i.length;e<t;e++)r.push(this.getDependency("node",i[e]));let a=void 0===t.skin?Promise.resolve(null):this.getDependency("skin",t.skin);return Promise.all([n,Promise.all(r),a]).then(function(e){let t=e[0],n=e[1],r=e[2];null!==r&&t.traverse(function(e){e.isSkinnedMesh&&e.bind(r,Z)});for(let e=0,r=n.length;e<r;e++)t.add(n[e]);if(void 0!==t.userData.pivot&&n.length>0){let e=t.userData.pivot,r=n[0];t.pivot=new o.Vector3().fromArray(e),t.position.x-=e[0],t.position.y-=e[1],t.position.z-=e[2],r.position.set(0,0,0),delete t.userData.pivot}return t})}_loadNodeShallow(e){let t=this.json,n=this.extensions,r=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];let i=t.nodes[e],a=i.name?r.createUniqueName(i.name):"",s=[],l=r._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return l&&s.push(l),void 0!==i.camera&&s.push(r.getDependency("camera",i.camera).then(function(e){return r._getNodeRef(r.cameraCache,i.camera,e)})),r._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){s.push(e)}),this.nodeCache[e]=Promise.all(s).then(function(t){let s;if((s=!0===i.isBone?new o.Bone:t.length>1?new o.Group:1===t.length?t[0]:new o.Object3D)!==t[0])for(let e=0,n=t.length;e<n;e++)s.add(t[e]);if(i.name&&(s.userData.name=i.name,s.name=a),j(s,i),i.extensions&&K(n,s,i),void 0!==i.matrix){let e=new o.Matrix4;e.fromArray(i.matrix),s.applyMatrix4(e)}else void 0!==i.translation&&s.position.fromArray(i.translation),void 0!==i.rotation&&s.quaternion.fromArray(i.rotation),void 0!==i.scale&&s.scale.fromArray(i.scale);if(r.associations.has(s)){if(void 0!==i.mesh&&r.meshCache.refs[i.mesh]>1){let e=r.associations.get(s);r.associations.set(s,{...e})}}else r.associations.set(s,{});return r.associations.get(s).nodes=e,s}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],r=this,i=new o.Group;n.name&&(i.name=r.createUniqueName(n.name)),j(i,n),n.extensions&&K(t,i,n);let a=n.nodes||[],s=[];for(let e=0,t=a.length;e<t;e++)s.push(r.getDependency("node",a[e]));return Promise.all(s).then(function(e){for(let t=0,n=e.length;t<n;t++){let n=e[t];null!==n.parent?i.add(function(e){let t=new Map,n=new Map,r=e.clone();return function e(t,n,r){r(t,n);for(let i=0;i<t.children.length;i++)e(t.children[i],n.children[i],r)}(e,r,function(e,r){t.set(r,e),n.set(e,r)}),r.traverse(function(e){if(!e.isSkinnedMesh)return;let r=t.get(e),i=r.skeleton.bones;e.skeleton=r.skeleton.clone(),e.bindMatrix.copy(r.bindMatrix),e.skeleton.bones=i.map(function(e){return n.get(e)}),e.bind(e.skeleton,e.bindMatrix)}),r}(n)):i.add(n)}return r.associations=(e=>{let t=new Map;for(let[e,n]of r.associations)(e instanceof o.Material||e instanceof o.Texture)&&t.set(e,n);return e.traverse(e=>{let n=r.associations.get(e);null!=n&&t.set(e,n)}),t})(i),i})}_createAnimationTracks(e,t,n,r,i){let a,s=[],l=e.name?e.name:e.uuid,u=[];function c(e){e.morphTargetInfluences&&u.push(e.name?e.name:e.uuid)}
342switch(W[i.path]===W.weights?(c(e),e.isGroup&&e.children.forEach(c)):u.push(l),W[i.path]){case W.weights:a=o.NumberKeyframeTrack;break;case W.rotation:a=o.QuaternionKeyframeTrack;break;case W.translation:case W.scale:a=o.VectorKeyframeTrack;break;default:a=1===n.itemSize?o.NumberKeyframeTrack:o.VectorKeyframeTrack}let d=void 0!==r.interpolation?X[r.interpolation]:o.InterpolateLinear,h=this._getArrayFromAccessor(n);for(let e=0,n=u.length;e<n;e++){let n=new a(u[e]+"."+W[i.path],t.array,h,d);"CUBICSPLINE"===r.interpolation&&this._createCubicSplineTrackInterpolant(n),s.push(n)}return s}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let e=Y(t.constructor),n=new Float32Array(t.length);for(let r=0,i=t.length;r<i;r++)n[r]=t[r]*e;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof o.QuaternionKeyframeTrack?O:I)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Q(e,t,n){let r=t.attributes,i=[];for(let t in r){let a=z[t]||t.toLowerCase();a in e.attributes||i.push(function(t,r){return n.getDependency("accessor",t).then(function(t){e.setAttribute(r,t)})}(r[t],a))}if(void 0!==t.indices&&!e.index){let r=n.getDependency("accessor",t.indices).then(function(t){e.setIndex(t)});i.push(r)}return o.ColorManagement.workingColorSpace!==o.LinearSRGBColorSpace&&"COLOR_0"in r&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${o.ColorManagement.workingColorSpace}" not supported.`),j(e,t),!function(e,t,n){let r=t.attributes,i=new o.Box3;if(void 0===r.POSITION)return;{let e=n.json.accessors[r.POSITION],t=e.min,a=e.max;if(void 0===t||void 0===a)return console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(i.set(new o.Vector3(t[0],t[1],t[2]),new o.Vector3(a[0],a[1],a[2])),e.normalized){let t=Y(G[e.componentType]);i.min.multiplyScalar(t),i.max.multiplyScalar(t)}}let a=t.targets;if(void 0!==a){let e=new o.Vector3,t=new o.Vector3;for(let r=0,i=a.length;r<i;r++){let i=a[r];if(void 0!==i.POSITION){let r=n.json.accessors[i.POSITION],a=r.min,o=r.max;if(void 0!==a&&void 0!==o){if(t.setX(Math.max(Math.abs(a[0]),Math.abs(o[0]))),t.setY(Math.max(Math.abs(a[1]),Math.abs(o[1]))),t.setZ(Math.max(Math.abs(a[2]),Math.abs(o[2]))),r.normalized){let e=Y(G[r.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(e)}e.boundingBox=i;let s=new o.Sphere;i.getCenter(s.center),s.radius=i.min.distanceTo(i.max)/2,e.boundingSphere=s}(e,t,n),Promise.all(i).then(function(){return void 0!==t.targets?function(e,t,n){let r=!1,i=!1,a=!1;for(let e=0,n=t.length;e<n;e++){let n=t[e];if(void 0!==n.POSITION&&(r=!0),void 0!==n.NORMAL&&(i=!0),void 0!==n.COLOR_0&&(a=!0),r&&i&&a)break}if(!r&&!i&&!a)return Promise.resolve(e);let o=[],s=[],l=[];for(let u=0,c=t.length;u<c;u++){let c=t[u];if(r){let t=void 0!==c.POSITION?n.getDependency("accessor",c.POSITION):e.attributes.position;o.push(t)}if(i){let t=void 0!==c.NORMAL?n.getDependency("accessor",c.NORMAL):e.attributes.normal;s.push(t)}if(a){let t=void 0!==c.COLOR_0?n.getDependency("accessor",c.COLOR_0):e.attributes.color;l.push(t)}}return Promise.all([Promise.all(o),Promise.all(s),Promise.all(l)]).then(function(t){let n=t[0],o=t[1],s=t[2];return r&&(e.morphAttributes.position=n),i&&(e.morphAttributes.normal=o),a&&(e.morphAttributes.color=s),e.morphTargetsRelative=!0,e})}(e,t.targets,n):e})}var J=n;let ee=new WeakMap,et=new e.U(e.r(60077)).toString(),en=new e.U(e.r(45377)).toString(),er=new e.U(e.r(32726)).toString();new e.U(e.r(58711)).toString(),new e.U(e.r(34938)).toString();class ei extends J.Loader{constructor(e){super(e),this.decoderPaths={js:en,wasm:et,dep_js:er},this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){let{decoderPaths:t}=this;return"object"==typeof e?(t.js=e.js,t.wasm=e.wasm,t.dep_js=null):(t.js=J.LoaderUtils.resolveURL("draco_wasm_wrapper.js",e),t.wasm=J.LoaderUtils.resolveURL("draco_decoder.wasm",e),t.dep_js=J.LoaderUtils.resolveURL("draco_decoder.js",e)),this}setDecoderConfig(e){return console.warn("THREE.DRACOLoader: setDecoderConfig to has been deprecated and will be removed in r194."),this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,n,r){let i=new J.FileLoader(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,e=>{this.parse(e,t,r)},n,r)}parse(e,t,n=()=>{}){this.decodeDracoFile(e,t,null,null,J.SRGBColorSpace,n).catch(n)}decodeDracoFile(e,t,n,r,i=J.LinearSRGBColorSpace,a=()=>{}){let o={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:i};
342return this.decodeGeometry(e,o).then(t).catch(a)}decodeGeometry(e,t){let n,r=JSON.stringify(t);if(ee.has(e)){let t=ee.get(e);if(t.key===r)return t.promise;if(0===e.byteLength)throw Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i=this.workerNextTaskID++,a=e.byteLength,o=this._getWorker(i,a).then(r=>(n=r,new Promise((r,a)=>{n._callbacks[i]={resolve:r,reject:a},n.postMessage({type:"decode",id:i,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return o.catch(()=>!0).then(()=>{n&&i&&this._releaseTask(n,i)}),ee.set(e,{key:r,promise:o}),o}_createGeometry(e){let t=new J.BufferGeometry;e.index&&t.setIndex(new J.BufferAttribute(e.index.array,1));for(let n=0;n<e.attributes.length;n++){let r,{name:i,array:a,itemSize:o,stride:s,vertexColorSpace:l}=e.attributes[n];if(o===s)r=new J.BufferAttribute(a,o);else{let e=new J.InterleavedBuffer(a,s);r=new J.InterleavedBufferAttribute(e,o,0)}"color"===i&&(this._assignVertexColorSpace(r,l),r.normalized=a instanceof Float32Array==!1),t.setAttribute(i,r)}return t}_assignVertexColorSpace(e,t){if(t!==J.SRGBColorSpace)return;let n=new J.Color;for(let t=0,r=e.count;t<r;t++)n.fromBufferAttribute(e,t),J.ColorManagement.colorSpaceToWorking(n,J.SRGBColorSpace),e.setXYZ(t,n.r,n.g,n.b)}_loadLibrary(e,t){let n=new J.FileLoader(this.manager);return n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((t,r)=>{n.load(e,t,void 0,r)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[],{decoderPaths:n}=this;if(e){if(null===n.dep_js)throw Error("THREE.DRACOLoader: WebAssembly is required when using a custom decoder paths.");t.push(this._loadLibrary(n.dep_js,"text"))}else t.push(this._loadLibrary(n.js,"text")),t.push(this._loadLibrary(n.wasm,"arraybuffer"));return this.decoderPending=Promise.all(t).then(t=>{let n=t[0];e||(this.decoderConfig.wasmBinary=t[1]);let r=ea.toString(),i=["/* draco decoder */",n,"\n/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){let n=t.data;switch(n.type){case"decode":e._callbacks[n.id].resolve(n);break;case"error":e._callbacks[n.id].reject(n);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+n.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort(function(e,t){return e._taskLoad>t._taskLoad?-1:1});let n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}}function ea(){let e,t;onmessage=function(n){let r=n.data;switch(r.type){case"init":e=r.decoderConfig,t=new Promise(function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)});break;case"decode":let i=r.buffer,a=r.taskConfig;t.then(e=>{let t=e.draco,n=new t.Decoder;try{let e=function(e,t,n,r){var i,a,o;let s,l,u,c,d,h,f=r.attributeIDs,p=r.attributeTypes,m=t.GetEncodedGeometryType(n);if(m===e.TRIANGULAR_MESH)d=new e.Mesh,h=t.DecodeArrayToMesh(n,n.byteLength,d);else if(m===e.POINT_CLOUD)d=new e.PointCloud,h=t.DecodeArrayToPointCloud(n,n.byteLength,d);else throw Error("THREE.DRACOLoader: Unexpected geometry type.");if(!h.ok()||0===d.ptr)throw Error("THREE.DRACOLoader: Decoding failed: "+h.error_msg());let v={index:null,attributes:[]};for(let n in f){let i,a,o=self[p[n]];if(r.useUniqueIDs)a=f[n],i=t.GetAttributeByUniqueId(d,a);else{if(-1===(a=t.GetAttributeId(d,e[f[n]])))continue;i=t.GetAttribute(d,a)}let s=function(e,t,n,r,i,a){let o,s=n.num_points(),l=a.num_components(),u=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,i),c=l*i.BYTES_PER_ELEMENT,d=4*Math.ceil(c/4),h=d/i.BYTES_PER_ELEMENT,f=s*c,p=e._malloc(f);t.GetAttributeDataArrayForAllPoints(n,a,u,f,p);let m=new i(e.HEAPF32.buffer,p,f/i.BYTES_PER_ELEMENT);if(c===d)o=m.slice();else{o=new i(s*d/i.BYTES_PER_ELEMENT);let e=0;for(let t=0,n=m.length;t<n;t++){for(let n=0;n<l;n++)o[e+n]=m[t*l+n];e+=h}}return e._free(p),{name:r,count:s,itemSize:l,array:o,stride:h}}(e,t,d,n,o,i);
342"color"===n&&(s.vertexColorSpace=r.vertexColorSpace),v.attributes.push(s)}return m===e.TRIANGULAR_MESH&&(i=e,a=t,o=d,s=3*o.num_faces(),l=4*s,u=i._malloc(l),a.GetTrianglesUInt32Array(o,l,u),c=new Uint32Array(i.HEAPF32.buffer,u,s).slice(),i._free(u),v.index={array:c,itemSize:1}),e.destroy(d),v}(t,n,new Int8Array(i),a),o=e.attributes.map(e=>e.array.buffer);e.index&&o.push(e.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:e},o)}catch(e){console.error(e),self.postMessage({type:"error",id:r.id,error:e.message})}finally{t.destroy(n)}})}}}let eo=new ei;eo.setDecoderPath("/draco/");let es=new l;es.setDRACOLoader(eo);let el=new n.TextureLoader;async function eu(e={}){let t=[],n=[];for(let r in e)!function e(r,i){if("string"==typeof r){let e=r.split(".").pop().toLowerCase();if(["glb","gltf"].includes(e))t.push(new Promise((e,t)=>{es.load(r,t=>{t.scene.traverse(e=>{e.isSkinnedMesh&&t.animations.length&&(e.parent.animations=t.animations)}),e(t.scene)},void 0,t)})),n.push(i);else["jpg","png","webp","jpeg"].includes(e)&&(t.push(new Promise(e=>{el.load(r,t=>{t.needsUpdate=!0,t.source.w=t.source.data.width,t.source.h=t.source.data.height,t.source.r=t.source.data.width/t.source.data.height,e(t)})})),n.push(i))}else if("object"==typeof r&&null!==r)for(let t in r)e(r[t],`${i}.${t}`)}(e[r],r);let r=await Promise.all(t);return n.reduce((e,t,n)=>{let i=t.split("."),a=e;for(let e=0;e<i.length-1;e++)a[i[e]]||(a[i[e]]={}),a=a[i[e]];return a[i[i.length-1]]=r[n],e},{})}function ec(e){e&&(e.traverse(e=>{if(e.isMesh||e.isSkinnedMesh||e.isInstancedMesh){e.geometry?.dispose?.();let t=e.material;if(Array.isArray(t))for(let e of t)ed(e);else ed(t)}}),e.parent?.remove?.(e))}function ed(e){if(e){for(let t of Object.keys(e)){let n=e[t];n&&n.isTexture&&"function"==typeof n.dispose&&n.dispose()}e.dispose?.()}}function eh(e){if(e&&"object"==typeof e){if(e.isTexture&&"function"==typeof e.dispose)return void e.dispose();if(e.isObject3D)return void ec(e);for(let t of Object.keys(e))eh(e[t])}}var ef=n;let ep={vignetteInner:.1,vignetteOuter:1.1,vignetteDarken:.4,warpNoiseScale:1.5,warpStrength:.04,warpOffsetA_x:0,warpOffsetA_y:3.1,warpOffsetB_x:7.4,warpOffsetB_y:0,fbmCoarseWeight:.7,fbmFineWeight:.22,fbmFineFreqScale:2.17,fbmFinePhaseX:41.7,fbmFinePhaseY:-19.3,grainUvScale:6,grainPhaseX:-50.3,grainPhaseY:22.9,grainStrength:.008,dMetricClamp:1.2};class em extends ef.Mesh{constructor({vertexShader:e="attribute vec3 position;\nattribute vec2 uv;\n\nvarying vec2 v_uv;\n\nvoid main() {\n  v_uv = uv;\n  \n  \n  \n  gl_Position = vec4(position.xy, 1.0, 1.0);\n}",fragmentShader:t="precision highp float;\nvec4 LinearTosRGB(in vec4 value) {\n  return vec4(\n    mix(\n      pow(value.rgb, vec3(0.41666)) * 1.055 - vec3(0.055),\n      value.rgb * 12.92,\n      vec3(lessThanEqual(value.rgb, vec3(0.0031308)))\n    ),\n    value.a\n  );\n}\n\nvec4 sRGBToLinear(in vec4 value) {\n  return vec4(\n    mix(\n      pow(value.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)),\n      value.rgb * 0.0773993808,\n      vec3(lessThanEqual(value.rgb, vec3(0.04045)))\n    ),\n    value.a\n  );\n}\n\nvec4 linearToOutputTexel(in vec4 value) {\n  return LinearTosRGB(value);\n}\nvec3 permute(vec3 x) {\n    return mod(((x * 34.0) + 1.0) * x, 289.0);\n}\n\nfloat snoise(vec2 v) {\n    const vec4 C = vec4(0.211324865405187, 0.366025403784439,\n            -0.577350269189626, 0.024390243902439);\n    vec2 i = floor(v + dot(v, C.yy));\n    vec2 x0 = v - i + dot(i, C.xx);\n    vec2 i1;\n    i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n    vec4 x12 = x0.xyxy + C.xxzz;\n    x12.xy -= i1;\n    i = mod(i, 289.0);\n    vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0))\n                + i.x + vec3(0.0, i1.x, 1.0));\n    vec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy),\n                    dot(x12.zw, x12.zw)), 0.0);\n    m = m * m;\n    m = m * m;\n    vec3 x = 2.0 * fract(p * C.www) - 1.0;\n    vec3 h = abs(x) - 0.5;\n    vec3 ox = floor(x + 0.5);\n    vec3 a0 = x - ox;\n    m *= 1.79284291400159 - 0.85373472095314 * (a0 * a0 + h * h);\n    vec3 g;\n    g.x = a0.x * x0.x + h.x * x0.y;\n    g.yz = a0.yz * x12.xz + h.yz * x12.yw;\n    return 130.0 * dot(m, g);\n}\n\nuniform vec4 u_bgNoise0;\n\nuniform vec4 u_bgNoise1;\n\nuniform vec4 u_bgNoise2;\n\nuniform vec4 u_bgNoise3;\n\nuniform float u_time;\nuniform vec3 u_color;\n\nuniform vec3 u_color2;\n\nuniform vec4 u_sweep;\nuniform vec3 u_vignette;\n\nvarying vec2 v_uv;\n\nfloat fbm(vec2 q) {\n  float n = u_bgNoise2.x * snoise(q);\n  n += u_bgNoise2.y * snoise(q * u_bgNoise2.z + u_bgNoise3.xy);\n  return n;\n}\n\nvoid main() {\n  vec2 p = v_uv * 2.0 - 1.0;\n\n  float warpScale = u_bgNoise0.x;\n  vec2 w = vec2(\n    fbm(p * warpScale + u_bgNoise1.xy),\n    fbm(p * warpScale + u_bgNoise1.zw)\n  );\n  p += w * u_bgNoise0.y;\n\n  float d = max(abs(p.x), abs(p.y));\n\n  float grain =\n    fbm(p * u_bgNoise0.z + u_bgNoise3.zw) * u_bgNoise0.w;\n  d = clamp(d + grain, 0.0, u_bgNoise2.w);\n\n  \n  \n  \n  float soft = max(u_sweep.y, 1e-4);\n  float bow = u_sweep.z;\n  float cx = v_uv.x - 0.5;\n  float curve = bow * (1.0 - 4.0 * cx * cx);\n  float edge = mix(-soft - bow, 1.0 + soft, u_sweep.x) + curve;\n  float band = 1.0 - smoothstep(edge - soft, edge + soft, v_uv.y);\n  vec3 base = mix(u_color, u_color2, band);\n\n  float vig = smoothstep(u_vignette.x, u_vignette.y, d);\n  vec3 rgb = mix(base, base * u_vignette.z, vig);\n\n  gl_FragColor = linearToOutputTexel(vec4(rgb, 1.0));\n}",uniforms:n={},shape:r}={}){if(super(function(){let e=new ef.BufferGeometry,t=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),n=new Float32Array([0,0,2,0,0,2]);return e.setAttribute("position",new ef.BufferAttribute(t,3)),e.setAttribute("uv",new ef.BufferAttribute(n,2)),e}(),new ev({vertexShader:e,fragmentShader:t,uniforms:{u_color:{value:new ef.Color(tk.clearColor)},...n},shape:r})),this.frustumCulled=!1,tk.backgroundSweep){const{from:e,to:t,progress:n}=tk.backgroundSweep;this.setSweep(e,t,n)}tW.scene.add(this)}set time(e){this.material.uniforms.u_time&&(this.material.uniforms.u_time.value=e)}render(e){this.time=e}setSweep(e,t,n){let r=this.material.uniforms;
342r.u_color.value.setHex(e),r.u_color2.value.setHex(t),r.u_sweep.value.x=Math.max(0,Math.min(1,n))}resetSweep(){let e=this.material.uniforms;e.u_color.value.setHex(tk.clearColor),e.u_color2.value.setHex(tk.clearColor),e.u_sweep.value.x=0}dispose(){this.parent?.remove(this),this.geometry.dispose(),this.material.dispose()}}class ev extends ef.RawShaderMaterial{constructor({vertexShader:e,fragmentShader:t,uniforms:r={},shape:i}={}){const a={u_vignette:{value:new n.Vector3},u_bgNoise0:{value:new n.Vector4},u_bgNoise1:{value:new n.Vector4},u_bgNoise2:{value:new n.Vector4},u_bgNoise3:{value:new n.Vector4}};super({vertexShader:e,fragmentShader:t,uniforms:{u_time:{value:0},u_color:{value:new ef.Color(tk.clearColor)},u_color2:{value:new ef.Color(tk.clearColor)},u_sweep:{value:new ef.Vector4(0,.1,.06,0)},...a,...r},side:ef.DoubleSide,depthTest:!0,depthWrite:!1}),function(e,t={}){let n=e.uniforms,r=function(e={}){return{...ep,...e}}(t);n.u_vignette.value.set(r.vignetteInner,r.vignetteOuter,r.vignetteDarken),n.u_bgNoise0.value.set(r.warpNoiseScale,r.warpStrength,r.grainUvScale,r.grainStrength),n.u_bgNoise1.value.set(r.warpOffsetA_x,r.warpOffsetA_y,r.warpOffsetB_x,r.warpOffsetB_y),n.u_bgNoise2.value.set(r.fbmCoarseWeight,r.fbmFineWeight,r.fbmFineFreqScale,r.dMetricClamp),n.u_bgNoise3.value.set(r.fbmFinePhaseX,r.fbmFinePhaseY,r.grainPhaseX,r.grainPhaseY)}(this,i??{})}}var eg=n,e_=n;class eS{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}let ex=new e_.OrthographicCamera(-1,1,1,-1,0,1);class eT extends e_.BufferGeometry{constructor(){super(),this.setAttribute("position",new e_.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new e_.Float32BufferAttribute([0,2,0,0,2,0],2))}}let eM=new eT;class eb{constructor(e){this._mesh=new e_.Mesh(eM,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,ex)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class eE{constructor(e,t,r){this.variables=[],this.currentTextureIndex=0;let i=n.FloatType;const a={passThruTexture:{value:null}},o=u("uniform sampler2D passThruTexture;\n\nvoid main() {\n\n	vec2 uv = gl_FragCoord.xy / resolution.xy;\n\n	gl_FragColor = texture2D( passThruTexture, uv );\n\n}\n",a),s=new eb(o);function l(n){n.defines.resolution="vec2( "+e.toFixed(1)+", "+t.toFixed(1)+" )"}function u(e,t){t=t||{};let r=new n.ShaderMaterial({name:"GPUComputationShader",uniforms:t,vertexShader:"void main()	{\n\n	gl_Position = vec4( position, 1.0 );\n\n}\n",fragmentShader:e});return l(r),r}this.setDataType=function(e){return i=e,this},this.addVariable=function(e,t,r){let i={name:e,initialValueTexture:r,material:this.createShaderMaterial(t),dependencies:null,renderTargets:[],wrapS:null,wrapT:null,minFilter:n.NearestFilter,magFilter:n.NearestFilter};return this.variables.push(i),i},this.setVariableDependencies=function(e,t){e.dependencies=t},this.init=function(){if(0===r.capabilities.maxVertexTextures)return"No support for vertex shader textures.";for(let n=0;n<this.variables.length;n++){let r=this.variables[n];r.renderTargets[0]=this.createRenderTarget(e,t,r.wrapS,r.wrapT,r.minFilter,r.magFilter),r.renderTargets[1]=this.createRenderTarget(e,t,r.wrapS,r.wrapT,r.minFilter,r.magFilter),this.renderTexture(r.initialValueTexture,r.renderTargets[0]),this.renderTexture(r.initialValueTexture,r.renderTargets[1]);let i=r.material,a=i.uniforms;if(null!==r.dependencies)for(let e=0;e<r.dependencies.length;e++){let t=r.dependencies[e];if(t.name!==r.name){let e=!1;for(let n=0;n<this.variables.length;n++)if(t.name===this.variables[n].name){e=!0;break}if(!e)return"Variable dependency not found. Variable="+r.name+", dependency="+t.name}a[t.name]={value:null},i.fragmentShader="\nuniform sampler2D "+t.name+";\n"+i.fragmentShader}}return this.currentTextureIndex=0,null},this.compute=function(){let e=this.currentTextureIndex,t=+(0===this.currentTextureIndex);for(let n=0,r=this.variables.length;n<r;n++){let r=this.variables[n];if(null!==r.dependencies){let t=r.material.uniforms;for(let n=0,i=r.dependencies.length;n<i;n++){let i=r.dependencies[n];t[i.name].value=i.renderTargets[e].texture}}this.doRenderTarget(r.material,r.renderTargets[t])}this.currentTextureIndex=t},this.getCurrentRenderTarget=function(e){return e.renderTargets[this.currentTextureIndex]},this.getAlternateRenderTarget=function(e){return e.renderTargets[+(0===this.currentTextureIndex)]},this.dispose=function(){s.dispose();let e=this.variables;for(let t=0;t<e.length;t++){let n=e[t];n.initialValueTexture&&n.initialValueTexture.dispose();let r=n.renderTargets;for(let e=0;e<r.length;e++)r[e].dispose();n.material.dispose()}},this.addResolutionDefine=l,this.createShaderMaterial=u,this.createRenderTarget=function(r,a,o,s,l,u){return r=r||e,a=a||t,o=o||n.ClampToEdgeWrapping,s=s||n.ClampToEdgeWrapping,l=l||n.NearestFilter,u=u||n.NearestFilter,new n.WebGLRenderTarget(r,a,{wrapS:o,wrapT:s,minFilter:l,magFilter:u,format:n.RGBAFormat,type:i,depthBuffer:!1})},this.createTexture=function(){let r=new Float32Array(e*t*4),i=new n.DataTexture(r,e,t,n.RGBAFormat,n.FloatType);return i.needsUpdate=!0,i},this.renderTexture=function(e,t){a.passThruTexture.value=e,this.doRenderTarget(o,t),a.passThruTexture.value=null},this.doRenderTarget=function(e,t){let n=r.getRenderTarget(),i=r.xr.enabled,a=r.shadowMap.autoUpdate;r.xr.enabled=!1,r.shadowMap.autoUpdate=!1,s.material=e,r.setRenderTarget(t),s.render(r),s.material=o,r.xr.enabled=i,r.shadowMap.autoUpdate=a,r.setRenderTarget(n)}}}class eR{constructor(e,t=128){this.size=t,this.gpu=new eE(t,t,e);const r=this.gpu.createTexture();this.variable=this.gpu.addVariable("u_displaceState","precision highp float;\n\nuniform float u_time;\nuniform vec2 u_mouseUv;\nuniform vec2 u_mouseVelUv;\nuniform float u_mouseSpeed;\n\nuniform float u_decay;\nuniform float u_diffusion;\nuniform float u_springForce;\nuniform float u_mouseForce;\nuniform float u_mouseRadius;\n\nuniform float u_directionalMix;\n\nuniform float u_velocityUvScale;\n\nuniform float u_dtScale;\n\nconst float DISPLACE_SAMPLE_EPS = 1e-5;\n\nvec4 sampleDisplace(vec2 coord) {\n    vec2 c = coord;\n    c.x = fract(c.x);\n    if (c.y < 0.0)\n        c.y = -c.y;\n    else if (c.y > 1.0)\n        c.y = 2.0 - c.y;\n    return texture2D(u_displaceState,\n        clamp(c, vec2(0.0), vec2(1.0) - DISPLACE_SAMPLE_EPS));\n}\n\nvoid main() {\n    vec2 uv = gl_FragCoord.xy / resolution.xy;\n    float k = clamp(u_dtScale, 0.001, 4.0);\n\n    \n    vec2 texel = 1.0 / resolution.xy;\n\n    vec4 state = sampleDisplace(uv);\n\n    vec4 sum = vec4(0.0);
342\n    sum += sampleDisplace(uv + vec2(-texel.x, 0.0));\n    sum += sampleDisplace(uv + vec2(texel.x, 0.0));\n    sum += sampleDisplace(uv + vec2(0.0, -texel.y));\n    sum += sampleDisplace(uv + vec2(0.0, texel.y));\n    vec4 average = sum * 0.25;\n\n    \n    float diffAmt = 1.0 - pow(max(0.0, 1.0 - u_diffusion), k);\n    float h = mix(state.r, average.r, diffAmt);\n    float v = state.g;\n\n    \n    if (u_mouseUv.x >= 0.0) {\n        vec2 mvel = u_mouseVelUv;\n        float mlen = length(mvel);\n        float amp = u_mouseSpeed + mlen * u_velocityUvScale;\n        vec2 d = vec2(uv.x - u_mouseUv.x, uv.y - u_mouseUv.y);\n        d.x = fract(d.x + 0.5) - 0.5;\n        float dist = length(d);\n        if (dist < u_mouseRadius && amp >= 1e-7) {\n            float influence = 1.0 - (dist / u_mouseRadius);\n            influence *= influence * (3.0 - 2.0 * influence);\n            float dirTerm = 1.0;\n            if (mlen > 1e-6 && dist > 1e-5) {\n                vec2 radial = d / dist;\n                vec2 mdir = mvel / mlen;\n                dirTerm =\n                    mix(1.0, clamp(dot(radial, mdir), -1.0, 1.0), u_directionalMix);\n            }\n            v -= influence * amp * u_mouseForce * dirTerm;\n        }\n    }\n\n    \n    v += -h * u_springForce * k;\n    v *= pow(u_decay, k);\n\n    h += v * k;\n\n    gl_FragColor = vec4(h, v, 0.0, 1.0);\n}",r),this.variable.wrapS=n.RepeatWrapping,this.variable.wrapT=n.ClampToEdgeWrapping,this.variable.minFilter=n.LinearFilter,this.variable.magFilter=n.LinearFilter,this.gpu.setVariableDependencies(this.variable,[this.variable]);const i=this.variable.material.uniforms;i.u_time={value:0},i.u_mouseUv={value:[-1,-1]},i.u_mouseVelUv={value:[0,0]},i.u_mouseSpeed={value:0},i.u_velocityUvScale={value:280},i.u_dtScale={value:1},i.u_directionalMix={value:.73},i.u_decay={value:.943},i.u_diffusion={value:.43},i.u_springForce={value:.038},i.u_mouseForce={value:.013},i.u_mouseRadius={value:.23},this.variable.material.uniforms=i;const a=this.gpu.init();null!==a&&console.error("GPUComputationRenderer init failed:",a)}step({time:e,mouseUv:t,mouseVelUv:n,mouseSpeed:r,dtScale:i=1,params:a}){let o=this.variable.material.uniforms;o.u_time.value=e,o.u_dtScale.value=i,o.u_mouseUv.value[0]=t.x,o.u_mouseUv.value[1]=t.y,o.u_mouseVelUv.value[0]=n.x,o.u_mouseVelUv.value[1]=n.y,o.u_mouseSpeed.value=r,a&&(o.u_decay.value=a.decay,o.u_diffusion.value=a.diffusion,o.u_springForce.value=a.springForce,o.u_mouseForce.value=a.mouseForce,o.u_mouseRadius.value=a.mouseRadius,o.u_directionalMix.value=a.directionalMix,o.u_velocityUvScale.value=a.velocityUvScale),this.gpu.compute()}getTexture(){let e=this.gpu.getCurrentRenderTarget(this.variable);return e?.texture??null}dispose(){this.gpu?.dispose?.(),this.gpu=null,this.variable=null}}class ew extends eg.Mesh{#e;#t=new eg.Raycaster;#n=new eg.Vector2(-1,-1);#r=new eg.Vector2(-1,-1);#i=new eg.Vector2(0,0);#a=.9;#o=new eg.Vector3;#s=new eg.Vector3;disposed=!1;params={decay:.943,diffusion:.43,springForce:.038,mouseForce:.013,mouseRadius:.23,displaceScale:.07,directionalMix:.73,velocityUvScale:280,ambientDisplace:.342,ambientTimeScale:.28,opacity:.4,specStrength:6.8,fresnelPower:5.2,iridescence:0,baseColor:`#${tk.clearColor.toString(16).padStart(6,"0")}`,mouseRedLight:.16,mouseRedLightSpot:-.1};constructor(){super(new eg.IcosahedronGeometry(.9,20),new eC),this.simSize=128,this.gpgpu=new eR(tW.renderer,this.simSize),this.material.uniforms.u_displaceTexel.value[0]=1/this.simSize,this.material.uniforms.u_displaceTexel.value[1]=1/this.simSize,this.#e=tW.subscribe(this.render.bind(this)),tW.scene.add(this),this.renderOrder=1}render(e){if(!this.visible)return;this.material.uniforms.u_time&&(this.material.uniforms.u_time.value=e),this.#i.set(0,0),this.#n.set(-1,-1),this.#t.setFromCamera(new eg.Vector2(tW.mouse.ex,tW.mouse.ey),tW.camera);let t=this.#t.intersectObject(this);if(t.length>0){let e=this.worldToLocal(t[0].point.clone()).normalize();this.#o.copy(e),this.#s.copy(e).multiplyScalar(1.18*this.#a).applyMatrix4(this.matrixWorld);let n=Math.atan2(e.z,e.x)/(2*Math.PI)+.5,r=Math.asin(Math.max(-1,Math.min(1,e.y)))/Math.PI+.5;if(this.#n.set(n,r),this.#r.x>=0){let e=n-this.#r.x;e>.5&&(e-=1),e<-.5&&(e+=1);let t=r-this.#r.y;this.#i.set(e,t)}this.#r.set(n,r)}else this.#r.set(-1,-1),this.material.uniforms.u_mouseRedLight.value=0;this.gpgpu.step({time:e,mouseUv:this.#n,mouseVelUv:this.#i,mouseSpeed:tW.mouse.espeed,dtScale:tW.simDtScale,params:this.params}),this.material.uniforms.u_displaceMap.value=this.gpgpu.getTexture(),this.material.uniforms.u_displaceScale.value=this.params.displaceScale,this.material.uniforms.u_ambientDisplace.value=this.params.ambientDisplace,this.material.uniforms.u_ambientTimeScale.value=this.params.ambientTimeScale,this.material.uniforms.u_opacity.value=this.params.opacity,this.material.uniforms.u_specStrength.value=this.params.specStrength,this.material.uniforms.u_fresnelPower.value=this.params.fresnelPower,this.material.uniforms.u_iridescence.value=this.params.iridescence,this.material.uniforms.u_baseColor.value.set(this.params.baseColor),t.length>0&&(this.material.uniforms.u_mouseRedLight.value=this.params.mouseRedLight,this.material.uniforms.u_mouseRedLightSpot.value=this.params.mouseRedLightSpot,this.material.uniforms.u_mouseRadialLocal.value.copy(this.#o),this.material.uniforms.u_mouseLightPosView.value.copy(this.#s).applyMatrix4(tW.camera.matrixWorldInverse)),this.material.opacity=this.params.opacity;let n=this.params.opacity<.9999;this.material.transparent=n,this.material.depthWrite=!n}dispose(){this.disposed=!0,this.#e?.(),this.gpgpu?.dispose(),this.gpgpu=null,this.parent?.remove(this),this.geometry.dispose(),this.material.dispose()}}
342class eC extends eg.RawShaderMaterial{constructor(){super({vertexShader:"precision highp float;\n\n#define MPI 3.1415926538\n#define MTAU 6.28318530718\n\nattribute vec3 position;\nattribute vec2 uv;\nattribute vec3 normal;\n\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat3 normalMatrix;\n\nuniform float u_time;\nuniform sampler2D u_displaceMap;\nuniform float u_displaceScale;\nuniform vec2 u_displaceTexel;\n\nuniform float u_ambientDisplace;\nuniform float u_ambientTimeScale;\n\nvarying vec2 v_uv;\nvarying vec3 v_normal;\nvarying vec3 v_viewPosition;\n\nvarying vec3 v_viewPos;\n\nvarying vec3 v_sphereDir;\n\nvec2 simUvFromDir(vec3 dir) {\n  \n  float xz = length(dir.xz);\n  float u = xz > 1e-4 ? atan(dir.z, dir.x) / (2.0 * MPI) + 0.5 : 0.5;\n  float v = asin(clamp(dir.y, -1.0, 1.0)) / MPI + 0.5;\n  return vec2(u, v);\n}\n\nfloat ambientDisplacement(vec3 dir, float t) {\n  if (u_ambientDisplace <= 1e-8)\n    return 0.0;\n  float w1 = dot(dir, vec3(1.0, 0.73, 0.41));\n  float w2 = dot(dir, vec3(-0.62, 0.91, -0.48));\n  float w3 = dot(dir, vec3(0.29, -0.54, 0.79));\n  float s =\n    sin(t * u_ambientTimeScale + w1 * 5.0) * 0.42 +\n    sin(t * u_ambientTimeScale * 0.79 + w2 * 4.35) * 0.38 +\n    sin(t * u_ambientTimeScale * 1.17 + w3 * 3.1) * 0.28;\n  return u_ambientDisplace * s;\n}\n\nvec3 displacedAtDir(vec3 dir, float R0) {\n  vec2 sampleUv = simUvFromDir(dir);\n  \n  sampleUv.x = fract(sampleUv.x);\n  float hTex = texture2D(u_displaceMap, sampleUv).r;\n  float h = ambientDisplacement(dir, u_time) + hTex;\n  return dir * (R0 + h * u_displaceScale);\n}\n\nvoid main() {\n  vec3 w = normalize(position);\n  float R0 = length(position);\n\n  vec3 pos = displacedAtDir(w, R0);\n\n  \n  vec3 refUp = abs(w.y) < 0.95 ? vec3(0.0, 1.0, 0.0) : vec3(1.0, 0.0, 0.0);\n  vec3 t1 = normalize(cross(refUp, w));\n  vec3 t2 = cross(w, t1);\n\n  \n  float ang = max(u_displaceTexel.x, u_displaceTexel.y) * 3.0;\n\n  vec3 d1p = normalize(w + ang * t1);\n  vec3 d1m = normalize(w - ang * t1);\n  vec3 d2p = normalize(w + ang * t2);\n  vec3 d2m = normalize(w - ang * t2);\n\n  vec3 tangentA = displacedAtDir(d1p, R0) - displacedAtDir(d1m, R0);\n  vec3 tangentB = displacedAtDir(d2p, R0) - displacedAtDir(d2m, R0);\n\n  vec3 nRaw = cross(tangentA, tangentB);\n  float nLen = length(nRaw);\n\n  vec3 newNormal;\n  if (nLen < 1e-6) {\n    newNormal = w;\n  } else {\n    newNormal = nRaw / nLen;\n    if (dot(newNormal, w) < 0.0) newNormal = -newNormal;\n  }\n\n  vec4 mvPosition = modelViewMatrix * vec4(pos, 1.0);\n\n  gl_Position = projectionMatrix * mvPosition;\n\n  v_uv = uv;\n  v_normal = normalize(normalMatrix * newNormal);\n  v_viewPosition = -mvPosition.xyz;\n  v_viewPos = mvPosition.xyz;\n  v_sphereDir = w;\n}",fragmentShader:"precision highp float;\n\n#define MPI 3.1415926538\n#define MTAU 6.28318530718\nvec4 LinearTosRGB(in vec4 value) {\n  return vec4(\n    mix(\n      pow(value.rgb, vec3(0.41666)) * 1.055 - vec3(0.055),\n      value.rgb * 12.92,\n      vec3(lessThanEqual(value.rgb, vec3(0.0031308)))\n    ),\n    value.a\n  );\n}\n\nvec4 sRGBToLinear(in vec4 value) {\n  return vec4(\n    mix(\n      pow(value.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)),\n      value.rgb * 0.0773993808,\n      vec3(lessThanEqual(value.rgb, vec3(0.04045)))\n    ),\n    value.a\n  );\n}\n\nvec4 linearToOutputTexel(in vec4 value) {\n  return LinearTosRGB(value);\n}\nstruct BubbleShade {\n    vec3 diffuse;\n    vec3 spec;\n};\n\nvec3 hdrKeyLightDir() { return normalize(vec3(1.0, 1.0, 1.0)); }\nvec3 hdrKeyLightColor() { return vec3(1.0, 0.95, 0.9) * 1.5; }\nvec3 hdrFillLightDir() { return normalize(vec3(-1.0, 0.5, 0.5)); }\nvec3 hdrFillLightColor() { return vec3(0.5, 0.6, 0.8) * 0.5; }\n\nvec3 computeEnv(vec3 reflectDir) {\n    float upY = reflectDir.y;\n    vec3 envGround = vec3(0.015, 0.025, 0.05);\n    vec3 envHorizon = vec3(0.55, 0.42, 0.32);\n    vec3 envZenith = vec3(0.88, 0.94, 1.0);\n    float gh = smoothstep(-0.55, 0.05, upY);\n    float hs = smoothstep(0.05, 0.75, upY);\n    vec3 envColor = mix(mix(envGround, envHorizon, gh), envZenith, hs);
342\n\n    vec3 windowDir = normalize(vec3(0.7, 0.35, -0.6));\n    float windowLobe = pow(max(0.0, dot(reflectDir, windowDir)), 6.0);\n    envColor += vec3(1.0, 0.82, 0.55) * windowLobe * 0.7;\n\n    vec3 occluderDir = normalize(vec3(-0.55, -0.25, 0.75));\n    float occluderLobe = pow(max(0.0, dot(reflectDir, occluderDir)), 3.0);\n    envColor *= 1.0 - 0.55 * occluderLobe;\n\n    vec3 sparkleDir = normalize(vec3(-0.4, 0.85, 0.45));\n    float sparkle = pow(max(0.0, dot(reflectDir, sparkleDir)), 40.0);\n    envColor += vec3(0.65, 0.85, 1.0) * sparkle * 2.0;\n\n    float sun1 = pow(max(0.0, dot(reflectDir, hdrKeyLightDir())), 220.0);\n    envColor += hdrKeyLightColor() * sun1 * 6.0;\n\n    float sun2 = pow(max(0.0, dot(reflectDir, hdrFillLightDir())), 96.0);\n    envColor += hdrFillLightColor() * sun2 * 2.5;\n\n    return envColor;\n}\n\nBubbleShade computeBubbleShade(\n    vec3 normal,\n    vec3 viewDir,\n    float specStrength,\n    float fresnelPower,\n    float iridescenceStrength\n) {\n    vec3 n = normalize(normal);\n    vec3 v = normalize(viewDir);\n\n    vec3 lightDir1 = hdrKeyLightDir();\n    vec3 lightColor1 = hdrKeyLightColor();\n    float diff1 = max(0.0, dot(n, lightDir1));\n\n    vec3 lightDir2 = hdrFillLightDir();\n    vec3 lightColor2 = hdrFillLightColor();\n    float diff2 = max(0.0, dot(n, lightDir2));\n\n    vec3 lightDir3 = normalize(vec3(0.0, -0.5, -1.0));\n    vec3 lightColor3 = vec3(0.2, 0.2, 0.4) * 0.8;\n    float diff3 = max(0.0, dot(n, lightDir3));\n\n    vec3 ambient = mix(\n        vec3(0.08, 0.12, 0.18),\n        vec3(0.35, 0.40, 0.48),\n        n.y * 0.5 + 0.5);\n\n    vec3 diffuseLighting = ambient;\n    diffuseLighting += diff1 * lightColor1;\n    diffuseLighting += diff2 * lightColor2;\n    diffuseLighting += diff3 * lightColor3;\n\n    vec3 reflectDir = reflect(-v, n);\n    vec3 envColor = computeEnv(reflectDir);\n\n    \n    float cosTheta = max(0.0, dot(n, v));\n    float fresnel = pow(1.0 - cosTheta, fresnelPower);\n\n    \n    \n    vec3 thinFilm = 0.5 + 0.5 * cos(\n        vec3(7.0, 9.0, 11.0) * cosTheta + vec3(0.0, 1.6, 3.2));\n\n    vec3 spec = envColor * fresnel * specStrength;\n    vec3 irid = thinFilm * fresnel * iridescenceStrength;\n\n    BubbleShade s;\n    s.diffuse = diffuseLighting * 0.18;\n    s.spec = spec + irid;\n    return s;\n}\n\nvec3 hdrKeyLightDirDeep()    { return normalize(vec3(-0.55, 0.85, 0.65)); }\nvec3 hdrKeyLightColorDeep()  { return vec3(0.96, 0.98, 1.0) * 1.35; }\nvec3 hdrFillLightDirDeep()   { return normalize(vec3(0.85, 0.15, -0.35)); }\nvec3 hdrFillLightColorDeep() { return vec3(0.30, 0.45, 0.70) * 0.42; }\n\nvec3 computeEnvDeep(vec3 reflectDir) {\n    float upY = reflectDir.y;\n    vec3 envGround  = vec3(0.004, 0.008, 0.018);\n    vec3 envHorizon = vec3(0.035, 0.060, 0.110);\n    vec3 envZenith  = vec3(0.160, 0.240, 0.420);\n    float gh = smoothstep(-0.6, 0.05, upY);\n    float hs = smoothstep(0.05, 0.85, upY);\n    vec3 envColor = mix(mix(envGround, envHorizon, gh), envZenith, hs);\n\n    \n    vec3 sparkleDir = normalize(vec3(0.35, 0.82, -0.25));\n    float sparkle = pow(max(0.0, dot(reflectDir, sparkleDir)), 48.0);\n    envColor += vec3(0.62, 0.82, 1.0) * sparkle * 1.1;\n\n    vec3 sparkleDir2 = normalize(vec3(-0.72, 0.25, 0.58));\n    float sparkle2 = pow(max(0.0, dot(reflectDir, sparkleDir2)), 72.0);\n    envColor += vec3(0.75, 0.88, 1.0) * sparkle2 * 0.65;\n\n    \n    vec3 occluderDir = normalize(vec3(0.55, -0.3, -0.6));\n    float occluderLobe = pow(max(0.0, dot(reflectDir, occluderDir)), 2.5);\n    envColor *= 1.0 - 0.5 * occluderLobe;\n\n    return envColor;\n}\n\nBubbleShade computeBubbleShadeDeep(\n    vec3 normal,\n    vec3 viewDir,\n    float specStrength,\n    float fresnelPower,\n    float iridescenceStrength\n) {\n    vec3 n = normalize(normal);\n    vec3 v = normalize(viewDir);\n\n    vec3 lightDir1 = hdrKeyLightDirDeep();\n    vec3 lightColor1 = hdrKeyLightColorDeep();\n    float diff1 = max(0.0, dot(n, lightDir1));\n\n    vec3 lightDir2 = hdrFillLightDirDeep();\n    vec3 lightColor2 = hdrFillLightColorDeep();\n    float diff2 = max(0.0, dot(n, lightDir2));\n\n    \n    \n    vec3 ambient = mix(\n        vec3(0.018, 0.032, 0.060),\n        vec3(0.110, 0.165, 0.270),\n        n.y * 0.5 + 0.5);\n\n    vec3 diffuseLighting = ambient;\n    diffuseLighting += diff1 * lightColor1 * 0.35;\n    diffuseLighting += diff2 * lightColor2 * 0.35;\n\n    vec3 reflectDir = reflect(-v, n);\n    vec3 envColor = computeEnvDeep(reflectDir);\n\n    float cosTheta = max(0.0, dot(n, v));\n    \n    float schlick = pow(1.0 - cosTheta, fresnelPower);\n    float fresnel = 0.055 + (1.0 - 0.055) * schlick;\n\n    vec3 thinFilm = 0.5 + 0.5 * cos(\n        vec3(7.0, 9.0, 11.0) * cosTheta + vec3(0.0, 1.6, 3.2));\n\n    vec3 spec = envColor * fresnel * specStrength;\n    vec3 irid = thinFilm * schlick * iridescenceStrength;\n\n    BubbleShade s;\n    s.diffuse = diffuseLighting * 0.11;\n    s.spec = spec + irid;\n    return s;\n}\n\nuniform vec3 u_baseColor;\nuniform float u_opacity;\nuniform float u_time;\nuniform float u_specStrength;\nuniform float u_fresnelPower;\nuniform float u_iridescence;\n\nuniform float u_mouseRedLight;\nuniform float u_mouseRedLightSpot;\nuniform vec3 u_mouseRadialLocal;\nuniform vec3 u_mouseLightPosView;\n\nvarying vec2 v_uv;\nvarying vec3 v_normal;\nvarying vec3 v_viewPosition;\nvarying vec3 v_viewPos;\nvarying vec3 v_sphereDir;\n\nfloat triDither(vec2 fragCoord) {\n    float r1 = fract(sin(dot(fragCoord, vec2(12.9898, 78.233))) * 43758.5453);\n    float r2 = fract(sin(dot(fragCoord, vec2(93.9898, 67.345))) * 24634.6345);\n    return (r1 + r2 - 1.0) / 255.0;\n}\n\nvoid main() {\n    vec3 n = normalize(v_normal);\n    vec3 v = normalize(v_viewPosition);\n\n    BubbleShade shade = computeBubbleShadeDeep(\n        n, v, u_specStrength, u_fresnelPower, u_iridescence);\n\n    \n    float redAmount = 0.0;\n    const vec3 redTint = vec3(1.0, 0.14, 0.1);\n    if (u_mouseRedLight > 1e-5) {\n        vec3 sDir = normalize(v_sphereDir);\n        float angDist = acos(clamp(dot(sDir, u_mouseRadialLocal), -1.0, 1.0));\n        \n        float angMax = mix(0.88, 0.28, clamp((u_mouseRedLightSpot + 0.15) / 1.0, 0.0, 1.0));\n        float hemi = 1.0 - smoothstep(angMax * 0.35, angMax, angDist);\n        hemi = pow(hemi, 0.72);\n\n        vec3 viewPos = v_viewPos;\n        vec3 L = normalize(u_mouseLightPosView - viewPos);\n        float wrap = clamp(dot(n, L) * 0.18 + 0.82, 0.0, 1.0);\n\n        redAmount = hemi * wrap;\n    }\n    vec3 diffusePart = u_baseColor * shade.diffuse;\n    vec3 spec = shade.spec;\n    float specLum = dot(spec, vec3(0.2126, 0.7152, 0.0722));\n\n    \n    \n    float redMix = clamp(redAmount, 0.0, 1.0);\n    spec *= 1.0 - redMix * 0.52;\n\n    vec3 finalColor = diffusePart + spec;\n\n    if (redMix > 1e-5) {\n        vec3 redLayer = redTint * u_mouseRedLight * redAmount;\n        float overBright = smoothstep(0.03, 0.42, specLum);\n        redLayer *= 1.0 + overBright * redMix * 1.35;\n        finalColor += redLayer;\n    }\n\n    \n    finalColor = (finalColor * (2.51 * finalColor + 0.03)) /\n        (finalColor * (2.43 * finalColor + 0.59) + 0.14);\n\n    \n    vec4 outColor = linearToOutputTexel(vec4(finalColor, u_opacity));\n    outColor.rgb += vec3(triDither(gl_FragCoord.xy));\n    gl_FragColor = outColor;\n}",uniforms:{u_time:{value:0},u_baseColor:{value:new eg.Color(tk.clearColor)},u_displaceMap:{value:null},u_displaceScale:{value:.07},u_displaceTexel:{value:[0,0]},u_ambientDisplace:{value:.042},u_ambientTimeScale:{value:.38},u_opacity:{value:.4},u_specStrength:{value:6.8},u_fresnelPower:{value:5.2},u_iridescence:{value:0},u_mouseRedLight:{value:0},u_mouseRedLightSpot:{value:-.1},u_mouseRadialLocal:{value:new eg.Vector3(0,0,1)},u_mouseLightPosView:{value:new eg.Vector3(0,0,-5)}},side:eg.FrontSide,transparent:!0,depthWrite:!1})}}var ey=n;let eA=new ey.Vector3,eL=new ey.Vector3;class eD extends ey.Mesh{constructor(){const e=new ey.RawShaderMaterial({vertexShader:"precision highp float;\n\nattribute vec3 position;\nattribute vec2 uv;\n\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\n\nvarying vec2 v_uv;\n\nvoid main() {\n  v_uv = uv;\n  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0
342);\n}",fragmentShader:"precision highp float;\n\nvec4 LinearTosRGB(in vec4 value) {\n  return vec4(\n    mix(\n      pow(value.rgb, vec3(0.41666)) * 1.055 - vec3(0.055),\n      value.rgb * 12.92,\n      vec3(lessThanEqual(value.rgb, vec3(0.0031308)))\n    ),\n    value.a\n  );\n}\n\nvec4 sRGBToLinear(in vec4 value) {\n  return vec4(\n    mix(\n      pow(value.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)),\n      value.rgb * 0.0773993808,\n      vec3(lessThanEqual(value.rgb, vec3(0.04045)))\n    ),\n    value.a\n  );\n}\n\nvec4 linearToOutputTexel(in vec4 value) {\n  return LinearTosRGB(value);\n}\n\nuniform vec3 u_color;\nuniform float u_strength;\n\nvarying vec2 v_uv;\n\nfloat triDither(vec2 fragCoord) {\n  float r1 = fract(sin(dot(fragCoord, vec2(12.9898, 78.233))) * 43758.5453);\n  float r2 = fract(sin(dot(fragCoord, vec2(93.9898, 67.345))) * 24634.6345);\n  return (r1 + r2 - 1.0) / 255.0;\n}\n\nvoid main() {\n  vec2 p = v_uv * 2.0 - 1.0;\n  float t = clamp(length(p), 0.0, 1.0);\n  float glow = pow(1.0 - t, 1.85);\n  vec3 rgb = u_color * glow * u_strength;\n  vec4 outColor = linearToOutputTexel(vec4(rgb, 1.0));\n  outColor.rgb += vec3(triDither(gl_FragCoord.xy));\n  gl_FragColor = outColor;\n}",uniforms:{u_color:{value:new ey.Color(0xff4060)},u_strength:{value:0}},transparent:!0,depthTest:!1,depthWrite:!1,blending:ey.AdditiveBlending,side:ey.DoubleSide});super(new ey.PlaneGeometry(1,1),e),this.frustumCulled=!1,this.renderOrder=0,this.visible=!1,tW.scene.add(this)}sync({worldPosition:e,diameter:t,strength:n}){let r=n>1e-4;this.visible=r,r&&(tW.camera?(tW.camera.getWorldDirection(eL),eL.multiplyScalar(.35)):eL.set(0,0,-.35),eA.copy(e).add(eL),this.position.copy(eA),tW.camera&&this.quaternion.copy(tW.camera.quaternion),this.scale.set(t,t,1),this.material.uniforms.u_strength.value=n)}dispose(){this.parent?.remove(this),this.geometry.dispose(),this.material.dispose()}}var eP=n,eN=n;function eU(e,t=new n.Vector3){return t.set((e>>16&255)/255,(e>>8&255)/255,(255&e)/255)}function eI(e=new n.Vector3){let t=function(e=new n.Vector3){return eU(tk.clearColor,e)}(new n.Vector3),r=eU(1059390,new n.Vector3);return e.copy(t).lerp(r,.22)}function eF(e,t){let n=String(e??"").replace(/^#/,""),r=parseInt(3===n.length?n.split("").map(e=>e+e).join(""):n,16);return Number.isFinite(r)?t.set((r>>16&255)/255,(r>>8&255)/255,(255&r)/255):t}let eO=null;function eB(e,t){let n=String(t),r=e.find(e=>e.name===n);if(r)return r.name;let i=e.find(e=>e.name.endsWith(`.${n}`));if(i)return i.name;let a=RegExp(`(^|[^0-9])${n}([^0-9]|$)`);return e.find(e=>a.test(e.name))?.name??null}function eG(e,t){let n=e.attributes.position;if(!n)return;let r=new Float32Array(n.count);r.fill(t),e.setAttribute("a_curvesBlend",new eN.BufferAttribute(r,1))}class eH extends eN.Group{disposed=!1;mesh;_material;_outerMaterial;_ownsGeometries;morphParams={};morphTargets=[];outerMesh=null;curvesProgress=.5;curvesProgressAtAssess=.5;internalLightStrength=0;internalLightScale=3.9;internalLightLift=1.9;internalLightPower=2.2;internalLightPowerOscAmp=.45;internalLightPowerOscSpeed=.127;curvesBand=.14;curvesNoiseScale=1.1;curvesNoiseStrength=1;curvesNoiseThreshold=.5;curvesNoiseSoftness=.25;curvesNoiseAnimate=0;curvesNoiseScroll=1.3;curvesNoiseWarp=1.98;curvesNoiseGain=4.9;curvesElevationBias=-1.05;curvesElevationWarp=15.65;curvesDebugNoise=!1;baseColorHex="#000000";curvesColorHex="#6ea8d4";curvesSparkleScale=52;curvesSparkleStrength=.7;curvesSparklePower=5.5;phase=0;layoutOpacity=1;outerShellOpacity=1;_raf;outerNoiseScale=1.15;outerNoiseStrength=.55;outerNoiseAnimate=0;outerGradStart=.05;outerGradEnd=.45;outerFadeStart=.65;outerMaskSoftness=.05;outerEdgeHighlight=6;outerEdgeHighlightWidth=.25;outerNoiseScroll=14;outerDebugNoise=!1;constructor({name:e="sphere",radius:t=.9,baseColor:n=eI(),model:r=null,curvesMap:i=null,attachToScene:a=!0}={}){if(super(),this.name=e,i&&(i.colorSpace=eN.LinearSRGBColorSpace),this._material=new ek({baseColor:n,curvesMap:i}),this._outerMaterial=r?new eV({baseColor:n}):null,this.baseColorHex=function(e){return"#"+[Math.round(255*Math.max(0,Math.min(1,e.x))),Math.round(255*Math.max(0,Math.min(1,e.y))),Math.round(255*Math.max(0,Math.min(1,e.z)))].map(e=>e.toString(16).padStart(2,"0")).join("")}(this._material.uniforms.u_baseColor.value),r){this.mesh=r.clone(!0),this.mesh.traverse(e=>{!e.isMesh||this.outerMesh||(e.geometry?.morphAttributes?.position?.length??0)>0||(this.outerMesh=e)}),this.mesh.traverse(e=>{e.isMesh&&(e===this.outerMesh?(e.material=this._outerMaterial,e.visible=!0):e.material=this._material)}),this._setupMorphTargets();const e=new eN.Sphere;new eN.Box3().setFromObject(this.mesh).getBoundingSphere(e),e.radius>1e-6&&this.mesh.scale.setScalar(t/e.radius),this._ownsGeometries=!1}else{const e=new eN.IcosahedronGeometry(t,8);eG(e,0),this.mesh=new eN.Mesh(e,this._material),this._ownsGeometries=!0}const o=1+t;this.mesh.renderOrder=o,this._ownsGeometries||this.mesh.traverse(e=>{e.isMesh&&(e.renderOrder=e===this.outerMesh?o+.5:o)}),this.add(this.mesh),a&&tW.scene.add(this),this.syncColors(),i&&this.syncCurvesUniforms(),this._raf=tW.subscribe(this._tickNoiseTime.bind(this)),r&&(this.setPhase(0),this.syncOuterShellUniforms()),this.syncLayoutOpacity()}_setupMorphTargets(){this.mesh.traverse(e=>{if(!e.isMesh)return;let t=e.geometry,n=t?.morphAttributes?.position;
342if(!n||0===n.length)return;let r=t.morphAttributes.normal??[],i=Object.fromEntries(Object.entries(e.morphTargetDictionary??{}).map(([e,t])=>[t,e])),a=Math.min(n.length,2);n.length>2&&console.warn(`[Sphere:${this.name}] mesh "${e.name}" has ${n.length} morph targets but the shader only supports 2; extras ignored.`);for(let e=0;e<a;e++){t.setAttribute(`a_morphPosition${e}`,n[e]),r[e]&&t.setAttribute(`a_morphNormal${e}`,r[e]);let a=i[e]??`morph${e}`;a in this.morphParams||(this.morphParams[a]=0,this.morphTargets.push({name:a,index:e}))}eG(t,1)})}syncCurvesUniforms(){let e=this._material.uniforms;void 0!==e.u_curvesProgress&&(e.u_curvesProgress.value=Math.max(0,Math.min(1,this.curvesProgress)),e.u_curvesBand.value=Math.max(0,Math.min(1,this.curvesBand)),e.u_curvesNoiseScale.value=Math.max(0,this.curvesNoiseScale),e.u_curvesNoiseStrength.value=Math.max(0,Math.min(1,this.curvesNoiseStrength)),e.u_curvesNoiseThreshold.value=Math.max(0,Math.min(1,this.curvesNoiseThreshold)),e.u_curvesNoiseSoftness.value=Math.max(0,this.curvesNoiseSoftness),e.u_curvesNoiseAnimate.value=Number(this.curvesNoiseAnimate)||0,e.u_curvesNoiseScroll.value=Number(this.curvesNoiseScroll)||0,e.u_curvesNoiseWarp.value=Math.max(0,Number(this.curvesNoiseWarp)||0),e.u_curvesNoiseGain.value=Math.max(1,Number(this.curvesNoiseGain)||1),e.u_curvesElevationBias.value=Number(this.curvesElevationBias)||0,e.u_curvesElevationWarp.value=Number(this.curvesElevationWarp)||0,e.u_curvesDebugNoise.value=+!!this.curvesDebugNoise,void 0!==e.u_curvesSparkleScale&&(e.u_curvesSparkleScale.value=Math.max(1,Number(this.curvesSparkleScale)||52),e.u_curvesSparkleStrength.value=Math.max(0,Number(this.curvesSparkleStrength)||0),e.u_curvesSparklePower.value=Math.max(1,Number(this.curvesSparklePower)||5.5)),void 0!==e.u_internalLightStrength&&(e.u_internalLightStrength.value=Math.max(0,Math.min(1,Number(this.internalLightStrength)||0)),e.u_internalLightScale.value=Math.max(.1,Number(this.internalLightScale)||3.9),e.u_internalLightLift.value=Math.max(0,Number(this.internalLightLift)||0),this._pushInternalLightPower(tW.time??0)))}_pushInternalLightPower(e){let t=this._material?.uniforms?.u_internalLightPower;if(!t)return;let n=Math.max(1,Number(this.internalLightPower)||2.2),r=Math.max(0,Number(this.internalLightPowerOscAmp)||0),i=Number(this.internalLightPowerOscSpeed)||.127;t.value=Math.max(1,n+(Number.isFinite(e)&&r>0?r*Math.sin(e*i):0))}syncColors(){let e=this._material;e?.uniforms?.u_baseColor&&eF(this.baseColorHex,e.uniforms.u_baseColor.value),e?.uniforms?.u_curvesColor&&eF(this.curvesColorHex,e.uniforms.u_curvesColor.value);let t=this._outerMaterial;t?.uniforms?.u_baseColor&&eF(this.baseColorHex,t.uniforms.u_baseColor.value)}syncCurvesProgressFromPhase(e){let t=Math.max(0,Math.min(2,Number(e)||0)),n=Math.max(0,Math.min(1,Number(this.curvesProgressAtAssess)||.5));t<=1?this.curvesProgress=n*(1-t):this.curvesProgress=0}syncInternalLightFromPhase(e){let t=Math.max(0,Math.min(2,Number(e)||0));this.internalLightStrength=t<=1?0:t-1}syncOuterShellFromPhase(e){if(!this._outerMaterial)return;let t=Math.max(0,Math.min(2,Number(e)||0)),n=Math.max(this.outerGradEnd,Math.min(1,Number(this.outerFadeStart)||.65));t<=1?this.outerNoiseAnimate=t*n:this.outerNoiseAnimate=n+(t-1)*(1-n)}_tickNoiseTime(e){let t=this._material?.uniforms?.u_curvesNoiseTime;t&&(t.value=.05*e),this._pushInternalLightPower(e)}syncLayoutOpacity(){let e=Math.max(0,Math.min(1,Number(this.layoutOpacity)||0)),t=this._material;t?.uniforms?.u_layoutOpacity&&(t.uniforms.u_layoutOpacity.value=e,t.transparent=e<.999,t.depthWrite=e>.01);let n=this._outerMaterial;if(n?.uniforms?.u_layoutOpacity){let t=Number(this.outerShellOpacity),r=e*(Number.isFinite(t)?Math.max(0,Math.min(1,t)):1);n.uniforms.u_layoutOpacity.value=r}}syncOuterShellUniforms(){let e=this._outerMaterial;e?.uniforms&&(e.uniforms.u_outerNoiseScale.value=this.outerNoiseScale,e.uniforms.u_outerNoiseStrength.value=this.outerNoiseStrength,e.uniforms.u_outerNoiseAnimate.value=this.outerNoiseAnimate,e.uniforms.u_outerGradStart.value=this.outerGradStart,e.uniforms.u_outerGradEnd.value=this.outerGradEnd,e.uniforms.u_outerFadeStart.value=this.outerFadeStart,e.uniforms.u_outerMaskSoftness.value=this.outerMaskSoftness,e.uniforms.u_outerEdgeHighlight.value=Math.max(0,Number(this.outerEdgeHighlight)||0),e.uniforms.u_outerEdgeHighlightWidth.value=Math.max(.05,Number(this.outerEdgeHighlightWidth)||.25),e.uniforms.u_outerNoiseScroll.value=this.outerNoiseScroll,e.uniforms.u_outerDebug
342Noise.value=+!!this.outerDebugNoise)}syncMorphInfluences(){let e=this._material.uniforms.u_morphInfluences.value;for(let{name:t,index:n}of this.morphTargets)e[n]=this.morphParams[t]??0}setPhase(e){let t=Math.max(0,Math.min(2,Number(e)||0));for(let e of(this.phase=t,Object.keys(this.morphParams)))this.morphParams[e]=0;let n=this.morphTargets;if(0===n.length){this.syncCurvesProgressFromPhase(t),this.syncInternalLightFromPhase(t),this.syncCurvesUniforms(),this.syncOuterShellFromPhase(t),this.syncOuterShellUniforms();return}if(1===n.length){let e=n[0].name;this.morphParams[e]=1-Math.min(t,2-t),this.syncMorphInfluences(),this.syncCurvesProgressFromPhase(t),this.syncInternalLightFromPhase(t),this.syncCurvesUniforms(),this.syncOuterShellFromPhase(t),this.syncOuterShellUniforms();return}let r=eB(n,"006")??n[0].name,i=eB(n,"007")??n[1].name;if(r===i){let e=n.find(e=>e.name!==r)?.name;e&&(i=e)}let a=t<=1?1-t:0,o=t<=1?0:t-1;this.morphParams[r]=a,this.morphParams[i]=o,this.syncMorphInfluences(),this.syncCurvesProgressFromPhase(t),this.syncInternalLightFromPhase(t),this.syncCurvesUniforms(),this.syncOuterShellFromPhase(t),this.syncOuterShellUniforms()}dispose(){this.disposed=!0,this._raf?.(),this._raf=void 0,this.parent?.remove(this),this._ownsGeometries&&this.mesh.geometry?.dispose?.(),this._material?.dispose?.(),this._outerMaterial?.dispose?.()}}class ek extends eN.RawShaderMaterial{constructor({baseColor:e=eI(),curvesMap:t=null}={}){const n=t??function(){if(!eO){let e=new Uint8Array([255,255,255,255]);(eO=new eN.DataTexture(e,1,1,eN.RGBAFormat,eN.UnsignedByteType)).needsUpdate=!0}return eO}();super({vertexShader:"precision highp float;\n\n#define MORPH_COUNT 2\n\nattribute vec3 position;\nattribute vec2 uv;\nattribute vec3 normal;\n\nattribute vec3 a_morphPosition0;\nattribute vec3 a_morphPosition1;\nattribute vec3 a_morphNormal0;\nattribute vec3 a_morphNormal1;\n\nattribute float a_curvesBlend;\n\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat3 normalMatrix;\nuniform float u_morphInfluences[MORPH_COUNT];\n\nvarying vec3 v_normal;\nvarying vec3 v_viewPosition;\nvarying vec2 v_uv;\nvarying float v_curvesBlend;\n\nvarying vec3 v_localPosition;\n\nvarying float v_elevation;\n\nvoid main() {\n  v_localPosition = position;\n\n  vec3 displaced = position\n    + a_morphPosition0 * u_morphInfluences[0]\n    + a_morphPosition1 * u_morphInfluences[1];\n\n  vec3 outward = position / max(length(position), 1e-3);\n  v_elevation = dot(displaced - position, outward);\n\n  \n  vec3 displacedNormal = normal\n    + a_morphNormal0 * u_morphInfluences[0]\n    + a_morphNormal1 * u_morphInfluences[1];\n\n  vec4 mvPosition = modelViewMatrix * vec4(displaced, 1.0);\n  gl_Position = projectionMatrix * mvPosition;\n\n  v_normal = normalize(normalMatrix * displacedNormal);\n  \n  v_viewPosition = -mvPosition.xyz;\n  v_uv = uv;\n  v_curvesBlend = a_curvesBlend;\n}",fragmentShader:"precision highp float;\n\nvec4 LinearTosRGB(in vec4 value) {\n  return vec4(\n    mix(\n      pow(value.rgb, vec3(0.41666)) * 1.055 - vec3(0.055),\n      value.rgb * 12.92,\n      vec3(lessThanEqual(value.rgb, vec3(0.0031308)))\n    ),\n    value.a\n  );\n}\n\nvec4 sRGBToLinear(in vec4 value) {\n  return vec4(\n    mix(\n      pow(value.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)),\n      value.rgb * 0.0773993808,\n      vec3(lessThanEqual(value.rgb, vec3(0.04045)))\n    ),\n    value.a\n  );\n}\n\nvec4 linearToOutputTexel(in vec4 value) {\n  return LinearTosRGB(value);\n}\nstruct BubbleShade {\n    vec3 diffuse;\n    vec3 spec;\n};\n\nvec3 hdrKeyLightDir() { return normalize(vec3(1.0, 1.0, 1.0)); }\nvec3 hdrKeyLightColor() { return vec3(1.0, 0.95, 0.9) * 1.5; }\nvec3 hdrFillLightDir() { return normalize(vec3(-1.0, 0.5, 0.5)); }\nvec3 hdrFillLightColor() { return vec3(0.5, 0.6, 0.8) * 0.5; }\n\nvec3 computeEnv(vec3 reflectDir) {\n    float upY = reflectDir.y;\n    vec3 envGround = vec3(0.015, 0.025, 0.05);\n    vec3 envHorizon = vec3(0.55, 0.42, 0.32);\n    vec3 envZenith = vec3(0.88, 0.94, 1.0);\n    float gh = smoothstep(-0.55, 0.05, upY);\n    float hs = smoothstep(0.05, 0.75, upY);\n    vec3 envColor = mix(mix(envGround, envHorizon, gh), envZenith, hs);
342\n\n    vec3 windowDir = normalize(vec3(0.7, 0.35, -0.6));\n    float windowLobe = pow(max(0.0, dot(reflectDir, windowDir)), 6.0);\n    envColor += vec3(1.0, 0.82, 0.55) * windowLobe * 0.7;\n\n    vec3 occluderDir = normalize(vec3(-0.55, -0.25, 0.75));\n    float occluderLobe = pow(max(0.0, dot(reflectDir, occluderDir)), 3.0);\n    envColor *= 1.0 - 0.55 * occluderLobe;\n\n    vec3 sparkleDir = normalize(vec3(-0.4, 0.85, 0.45));\n    float sparkle = pow(max(0.0, dot(reflectDir, sparkleDir)), 40.0);\n    envColor += vec3(0.65, 0.85, 1.0) * sparkle * 2.0;\n\n    float sun1 = pow(max(0.0, dot(reflectDir, hdrKeyLightDir())), 220.0);\n    envColor += hdrKeyLightColor() * sun1 * 6.0;\n\n    float sun2 = pow(max(0.0, dot(reflectDir, hdrFillLightDir())), 96.0);\n    envColor += hdrFillLightColor() * sun2 * 2.5;\n\n    return envColor;\n}\n\nBubbleShade computeBubbleShade(\n    vec3 normal,\n    vec3 viewDir,\n    float specStrength,\n    float fresnelPower,\n    float iridescenceStrength\n) {\n    vec3 n = normalize(normal);\n    vec3 v = normalize(viewDir);\n\n    vec3 lightDir1 = hdrKeyLightDir();\n    vec3 lightColor1 = hdrKeyLightColor();\n    float diff1 = max(0.0, dot(n, lightDir1));\n\n    vec3 lightDir2 = hdrFillLightDir();\n    vec3 lightColor2 = hdrFillLightColor();\n    float diff2 = max(0.0, dot(n, lightDir2));\n\n    vec3 lightDir3 = normalize(vec3(0.0, -0.5, -1.0));\n    vec3 lightColor3 = vec3(0.2, 0.2, 0.4) * 0.8;\n    float diff3 = max(0.0, dot(n, lightDir3));\n\n    vec3 ambient = mix(\n        vec3(0.08, 0.12, 0.18),\n        vec3(0.35, 0.40, 0.48),\n        n.y * 0.5 + 0.5);\n\n    vec3 diffuseLighting = ambient;\n    diffuseLighting += diff1 * lightColor1;\n    diffuseLighting += diff2 * lightColor2;\n    diffuseLighting += diff3 * lightColor3;\n\n    vec3 reflectDir = reflect(-v, n);\n    vec3 envColor = computeEnv(reflectDir);\n\n    \n    float cosTheta = max(0.0, dot(n, v));\n    float fresnel = pow(1.0 - cosTheta, fresnelPower);\n\n    \n    \n    vec3 thinFilm = 0.5 + 0.5 * cos(\n        vec3(7.0, 9.0, 11.0) * cosTheta + vec3(0.0, 1.6, 3.2));\n\n    vec3 spec = envColor * fresnel * specStrength;\n    vec3 irid = thinFilm * fresnel * iridescenceStrength;\n\n    BubbleShade s;\n    s.diffuse = diffuseLighting * 0.18;\n    s.spec = spec + irid;\n    return s;\n}\n\nvec3 hdrKeyLightDirDeep()    { return normalize(vec3(-0.55, 0.85, 0.65)); }\nvec3 hdrKeyLightColorDeep()  { return vec3(0.96, 0.98, 1.0) * 1.35; }\nvec3 hdrFillLightDirDeep()   { return normalize(vec3(0.85, 0.15, -0.35)); }\nvec3 hdrFillLightColorDeep() { return vec3(0.30, 0.45, 0.70) * 0.42; }\n\nvec3 computeEnvDeep(vec3 reflectDir) {\n    float upY = reflectDir.y;\n    vec3 envGround  = vec3(0.004, 0.008, 0.018);\n    vec3 envHorizon = vec3(0.035, 0.060, 0.110);\n    vec3 envZenith  = vec3(0.160, 0.240, 0.420);\n    float gh = smoothstep(-0.6, 0.05, upY);\n    float hs = smoothstep(0.05, 0.85, upY);\n    vec3 envColor = mix(mix(envGround, envHorizon, gh), envZenith, hs);\n\n    \n    vec3 sparkleDir = normalize(vec3(0.35, 0.82, -0.25));\n    float sparkle = pow(max(0.0, dot(reflectDir, sparkleDir)), 48.0);\n    envColor += vec3(0.62, 0.82, 1.0) * sparkle * 1.1;\n\n    vec3 sparkleDir2 = normalize(vec3(-0.72, 0.25, 0.58));\n    float sparkle2 = pow(max(0.0, dot(reflectDir, sparkleDir2)), 72.0);\n    envColor += vec3(0.75, 0.88, 1.0) * sparkle2 * 0.65;\n\n    \n    vec3 occluderDir = normalize(vec3(0.55, -0.3, -0.6));\n    float occluderLobe = pow(max(0.0, dot(reflectDir, occluderDir)), 2.5);\n    envColor *= 1.0 - 0.5 * occluderLobe;\n\n    return envColor;\n}\n\nBubbleShade computeBubbleShadeDeep(\n    vec3 normal,\n    vec3 viewDir,\n    float specStrength,\n    float fresnelPower,\n    float iridescenceStrength\n) {\n    vec3 n = normalize(normal);\n    vec3 v = normalize(viewDir);\n\n    vec3 lightDir1 = hdrKeyLightDirDeep();\n    vec3 lightColor1 = hdrKeyLightColorDeep();\n    float diff1 = max(0.0, dot(n, lightDir1));\n\n    vec3 lightDir2 = hdrFillLightDirDeep();\n    vec3 lightColor2 = hdrFillLightColorDeep();\n    float diff2 = max(0.0, dot(n, lightDir2));\n\n    \n    \n    vec3 ambient = mix(\n        vec3(0.018, 0.032, 0.060),\n        vec3(0.110, 0.165, 0.270),\n        n.y * 0.5 + 0.5);\n\n    vec3 diffuseLighting = ambient;\n    diffuseLighting += diff1 * lightColor1 * 0.35;\n    diffuseLighting += diff2 * lightColor2 * 0.35;\n\n    vec3 reflectDir = reflect(-v, n);\n    vec3 envColor = computeEnvDeep(reflectDir);\n\n    float cosTheta = max(0.0, dot(n, v));\n    \n    float schlick = pow(1.0 - cosTheta, fresnelPower);\n    float fresnel = 0.055 + (1.0 - 0.055) * schlick;\n\n    vec3 thinFilm = 0.5 + 0.5 * cos(\n        vec3(7.0, 9.0, 11.0) * cosTheta + vec3(0.0, 1.6, 3.2));\n\n    vec3 spec = envColor * fresnel * specStrength;\n    vec3 irid = thinFilm * schlick * iridescenceStrength;\n\n    BubbleShade s;\n    s.diffuse = diffuseLighting * 0.11;\n    s.spec = spec + irid;\n    return s;\n}
342\n#define NUM_OCTAVES 5\n\nfloat mod289(float x){return x - floor(x * (1.0 / 289.0)) * 289.0;}\nvec4 mod289(vec4 x){return x - floor(x * (1.0 / 289.0)) * 289.0;}\nvec4 perm(vec4 x){return mod289(((x * 34.0) + 1.0) * x);}\n\nfloat rand(float n){\n	return fract(sin(n) * 43758.5453123);\n}\n\nfloat rand(vec2 n) { \n	return fract(sin(dot(n, vec2(12.9898, 4.1414))) * 43758.5453);\n}\n\nfloat noise(float p){\n	float fl = floor(p);\n	float fc = fract(p);	\n	return mix(rand(fl), rand(fl + 1.0), fc);\n}\n\nfloat noise(vec2 n) {\n	const vec2 d = vec2(0.0, 1.0);\n  vec2 b = floor(n), f = smoothstep(vec2(0.0), vec2(1.0), fract(n));\n	return mix(mix(rand(b), rand(b + d.yx), f.x), mix(rand(b + d.xy), rand(b + d.yy), f.x), f.y);\n}\n\nfloat noise(vec3 p){\n    vec3 a = floor(p);\n    vec3 d = p - a;\n    d = d * d * (3.0 - 2.0 * d);\n\n    vec4 b = a.xxyy + vec4(0.0, 1.0, 0.0, 1.0);\n    vec4 k1 = perm(b.xyxy);\n    vec4 k2 = perm(k1.xyxy + b.zzww);\n\n    vec4 c = k2 + a.zzzz;\n    vec4 k3 = perm(c);\n    vec4 k4 = perm(c + 1.0);\n\n    vec4 o1 = fract(k3 * (1.0 / 41.0));\n    vec4 o2 = fract(k4 * (1.0 / 41.0));\n\n    vec4 o3 = o2 * d.z + o1 * (1.0 - d.z);\n    vec2 o4 = o3.yw * d.x + o3.xz * (1.0 - d.x);\n\n    return o4.y * d.y + o4.x * (1.0 - d.y);\n}\n\nfloat fbm(float x) {\n	float v = 0.0;\n	float a = 0.5;\n	float shift = float(100);\n	for (int i = 0; i < NUM_OCTAVES; ++i) {\n		v += a * noise(x);\n		x = x * 2.0 + shift;\n		a *= 0.5;\n	}\n	return v;\n}\n\nfloat fbm(vec2 x) {\n	float v = 0.0;\n	float a = 0.5;\n	vec2 shift = vec2(100);\n	\n    mat2 rot = mat2(cos(0.5), sin(0.5), -sin(0.5), cos(0.50));\n	for (int i = 0; i < NUM_OCTAVES; ++i) {\n		v += a * noise(x);\n		x = rot * x * 2.0 + shift;\n		a *= 0.5;\n	}\n	return v;\n}\n\nfloat fbm(vec3 x) {\n	float v = 0.0;\n	float a = 0.5;\n	vec3 shift = vec3(100);\n	for (int i = 0; i < NUM_OCTAVES; ++i) {\n		v += a * noise(x);\n		x = x * 2.0 + shift;\n		a *= 0.5;\n	}\n	return v;\n}\n\nfloat fbm01(vec3 x) {\n	const float denom = 1.0 - pow(0.5, float(NUM_OCTAVES));\n	return clamp(fbm(x) / denom, 0.0, 1.0);\n}\n\nuniform vec3 u_baseColor;\n\nuniform vec3 u_curvesColor;\n\nuniform float u_curvesSparkleScale;\nuniform float u_curvesSparkleStrength;\nuniform float u_curvesSparklePower;\nuniform float u_specStrength;\nuniform float u_fresnelPower;\n\nuniform sampler2D u_curvesMap;\n\nuniform float u_curvesProgress;\n\nuniform float u_curvesBand;\n\nuniform float u_curvesNoiseScale;\nuniform float u_curvesNoiseStrength;\nuniform float u_curvesNoiseThreshold;\nuniform float u_curvesNoiseSoftness;\nuniform float u_curvesNoiseAnimate;\nuniform float u_curvesNoiseScroll;\n\nuniform float u_curvesNoiseTime;\n\nuniform float u_curvesNoiseWarp;\n\nuniform float u_curvesNoiseGain;\n\nuniform float u_curvesElevationBias;\n\nuniform float u_curvesElevationWarp;\n\nuniform float u_curvesDebugNoise;\n\nuniform float u_internalLightStrength;\nuniform float u_internalLightScale;\nuniform float u_internalLightLift;\n\nuniform float u_internalLightPower;\n\nuniform float u_layoutOpacity;\n\nvarying vec3 v_normal;\nvarying vec3 v_viewPosition;\nvarying vec2 v_uv;\nvarying float v_curvesBlend;\nvarying vec3 v_localPosition;\nvarying float v_elevation;\n\nfloat triDither(vec2 fragCoord) {\n    float r1 = fract(sin(dot(fragCoord, vec2(12.9898, 78.233))) * 43758.5453);\n    float r2 = fract(sin(dot(fragCoord, vec2(93.9898, 67.345))) * 24634.6345);\n    return (r1 + r2 - 1.0) / 255.0;\n}\n\nvoid main() {\n    vec3 n = normalize(v_normal);\n    vec3 v = normalize(v_viewPosition);\n\n    BubbleShade shade = computeBubbleShade(\n        n, v, u_specStrength, u_fresnelPower, 0.0);\n\n    \n    const vec3 kDiffuseTone = vec3(0.88, 0.94, 1.05);\n    const vec3 kSpecTone = vec3(0.62, 0.78, 1.0);\n    shade.diffuse *= kDiffuseTone;\n    shade.spec *= kSpecTone;\n\n    \n    vec3 baseLinear = sRGBToLinear(vec4(u_baseColor, 1.0)).rgb;\n    vec3 finalColor = baseLinear * shade.diffuse + shade.spec + baseLinear * 0.04;\n\n    \n    float buildLight = clamp(u_internalLightStrength, 0.0, 1.0);\n    if (buildLight > 1e-4) {\n        float craterDepth = clamp(-v_elevation * u_internalLightScale, 0.0, 1.0);\n        float deepPow = max(u_internalLightPower, 1.0);\n        float deep = pow(craterDepth, deepPow);
342\n        float core = pow(craterDepth, deepPow * 1.75);\n        finalColor += baseLinear * u_internalLightLift * (deep + core * 0.65) * buildLight;\n    }\n\n    float c =\n        texture2D(u_curvesMap, vec2(v_uv.x, 1.0 - v_uv.y)).r;\n\n    \n    float progress = clamp(u_curvesProgress, 0.0, 1.0);\n    float halfW = max(u_curvesBand * 0.5, 1e-4);\n    float threshold = 1.0 - progress;\n    float curveMask = smoothstep(threshold - halfW, threshold + halfW, c);\n\n    \n    float tNoise = (u_curvesNoiseAnimate + u_curvesNoiseTime) * u_curvesNoiseScroll;\n    vec3 flow = vec3(\n        sin(tNoise * 0.91)          + cos(tNoise * 0.37)         * 0.6,\n        sin(tNoise * 0.73 + 1.70)   + cos(tNoise * 0.51 + 2.30)  * 0.6,\n        sin(tNoise * 0.41 + 3.10)   + cos(tNoise * 1.13 + 4.70)  * 0.6);\n\n    \n    vec3 elevWarp = v_elevation * u_curvesElevationWarp\n        * vec3(2.7, 1.3, 0.9);\n    vec3 warpPos = v_localPosition * (u_curvesNoiseScale * 0.4)\n        + flow * 0.5\n        + elevWarp;\n    vec3 warp = vec3(\n        noise(warpPos),\n        noise(warpPos + vec3(5.2, 1.3, 9.1)),\n        noise(warpPos + vec3(12.7, 7.4, 3.9))) * 2.0 - 1.0;\n\n    vec3 nSample = v_localPosition * u_curvesNoiseScale\n        + flow\n        + warp * u_curvesNoiseWarp;\n    float curvesNoise = fbm01(nSample);\n    \n    curvesNoise = clamp(curvesNoise + v_elevation * u_curvesElevationBias,\n        0.0, 1.0);\n    float nHalfSoft = max(u_curvesNoiseSoftness, 1e-4) * 0.5;\n    float nThresh = clamp(u_curvesNoiseThreshold, 0.0, 1.0);\n    float noiseGate = smoothstep(nThresh - nHalfSoft, nThresh + nHalfSoft, curvesNoise);\n    \n    float gateK = max(u_curvesNoiseGain, 1.0);\n    noiseGate = noiseGate < 0.5\n        ? 0.5 * pow(2.0 * noiseGate, gateK)\n        : 1.0 - 0.5 * pow(2.0 * (1.0 - noiseGate), gateK);\n    float gatedMask = curveMask * mix(1.0, noiseGate, clamp(u_curvesNoiseStrength, 0.0, 1.0));\n\n    float lineVis = gatedMask * clamp(v_curvesBlend, 0.0, 1.0);\n    if (lineVis > 1e-5) {\n        vec3 curvesLinear = sRGBToLinear(vec4(u_curvesColor, 1.0)).rgb;\n\n        \n        float craterHint = clamp(-v_elevation * 2.5, 0.0, 1.0)\n            * (1.0 - buildLight);\n        vec3 innerHint = vec3(0.52, 0.7, 1.0);\n        curvesLinear = mix(curvesLinear, sRGBToLinear(vec4(innerHint, 1.0)).rgb,\n            craterHint * 0.4);\n\n        \n        float sparkleN = noise(vec3(\n            v_uv * u_curvesSparkleScale,\n            u_curvesNoiseTime * 0.35));\n        float sparkle = pow(clamp(sparkleN, 0.0, 1.0),\n            max(u_curvesSparklePower, 1.0));\n        sparkle = smoothstep(0.62, 0.94, sparkle);\n        float sparkAmt = clamp(u_curvesSparkleStrength, 0.0, 2.0);\n        vec3 curvesHot = curvesLinear * vec3(1.08, 1.14, 1.28);\n        vec3 lineCol = mix(curvesLinear, curvesHot, sparkle * sparkAmt);\n        float lineBright = lineVis * (1.0 + sparkle * sparkAmt * 0.9);\n        finalColor += lineCol * lineBright;\n    }\n\n    finalColor = (finalColor * (2.51 * finalColor + 0.03)) /\n        (finalColor * (2.43 * finalColor + 0.59) + 0.14);\n\n    vec4 outColor = linearToOutputTexel(vec4(finalColor, 1.));\n\n    \n    if (u_curvesDebugNoise > 0.5) {\n        vec3 fieldRed = vec3(1.0, 0.0, 0.0) * curvesNoise * 0.55;\n        vec3 gateRed  = vec3(1.0, 0.25, 0.25) * noiseGate * 0.45;\n        outColor.rgb = mix(outColor.rgb, fieldRed + gateRed, 0.7);\n    }\n\n    outColor.rgb += triDither(gl_FragCoord.xy);\n    outColor.a *= clamp(u_layoutOpacity, 0.0, 1.0);\n    gl_FragColor = outColor;\n}",uniforms:{u_baseColor:{value:e?.isVector3===!0?e.clone():eI()},u_curvesColor:{value:new eN.Vector3(.43,.66,.83)},u_curvesSparkleScale:{value:52},u_curvesSparkleStrength:{value:.7},u_curvesSparklePower:{value:5.5},u_specStrength:{value:.35},u_fresnelPower:{value:5},u_morphInfluences:{value:[,,].fill(0)},u_curvesMap:{value:n},u_curvesProgress:{value:.5},u_curvesBand:{value:.14},u_curvesNoiseScale:{value:1.1},u_curvesNoiseStrength:{value:1},u_curvesNoiseThreshold:{value:.5},u_curvesNoiseSoftness:{value:.25},u_curvesNoiseAnimate:{value:0},u_curvesNoiseScroll:{value:1.3},u_curvesNoiseTime:{value:0},u_curvesNoiseWarp:{value:1.98},u_curvesNoiseGain:{value:4.9},u_curvesElevationBias:{value:-1.05},u_curvesElevationWarp:{value:15.65},u_curvesDebugNoise:{value:0},u_internalLightStrength:{value:0},u_internalLightScale:{value:3.9},u_internalLightLift:{value:1.9},u_internalLightPower:{value:2.2},u_layoutOpacity:{value:1}},side:eN.FrontSide,transparent:!1,depthWrite:!0})}}class eV extends eN.RawShaderMaterial{constructor({baseColor:e=eI()}={}){super({vertexShader:"precision highp float;\n\nattribute vec3 position;\nattribute vec2 uv;\nattribute vec3 normal;\n\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat3 normalMatrix;\n\nvarying vec3 v_normal;\nvarying vec3 v_viewPosition;\nvarying vec2 v_uv;\n\nvarying vec3 v_localPosition;\n\nvoid main() {\n  v_localPosition = position;
342\n\n  vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n  gl_Position = projectionMatrix * mvPosition;\n\n  v_normal = normalize(normalMatrix * normal);\n  v_viewPosition = -mvPosition.xyz;\n  v_uv = uv;\n}",fragmentShader:"precision highp float;\n\n#define NUM_OCTAVES 5\n\nfloat mod289(float x){return x - floor(x * (1.0 / 289.0)) * 289.0;}\nvec4 mod289(vec4 x){return x - floor(x * (1.0 / 289.0)) * 289.0;}\nvec4 perm(vec4 x){return mod289(((x * 34.0) + 1.0) * x);}\n\nfloat rand(float n){\n	return fract(sin(n) * 43758.5453123);\n}\n\nfloat rand(vec2 n) { \n	return fract(sin(dot(n, vec2(12.9898, 4.1414))) * 43758.5453);\n}\n\nfloat noise(float p){\n	float fl = floor(p);\n	float fc = fract(p);	\n	return mix(rand(fl), rand(fl + 1.0), fc);\n}\n\nfloat noise(vec2 n) {\n	const vec2 d = vec2(0.0, 1.0);\n  vec2 b = floor(n), f = smoothstep(vec2(0.0), vec2(1.0), fract(n));\n	return mix(mix(rand(b), rand(b + d.yx), f.x), mix(rand(b + d.xy), rand(b + d.yy), f.x), f.y);\n}\n\nfloat noise(vec3 p){\n    vec3 a = floor(p);\n    vec3 d = p - a;\n    d = d * d * (3.0 - 2.0 * d);\n\n    vec4 b = a.xxyy + vec4(0.0, 1.0, 0.0, 1.0);\n    vec4 k1 = perm(b.xyxy);\n    vec4 k2 = perm(k1.xyxy + b.zzww);\n\n    vec4 c = k2 + a.zzzz;\n    vec4 k3 = perm(c);\n    vec4 k4 = perm(c + 1.0);\n\n    vec4 o1 = fract(k3 * (1.0 / 41.0));\n    vec4 o2 = fract(k4 * (1.0 / 41.0));\n\n    vec4 o3 = o2 * d.z + o1 * (1.0 - d.z);\n    vec2 o4 = o3.yw * d.x + o3.xz * (1.0 - d.x);\n\n    return o4.y * d.y + o4.x * (1.0 - d.y);\n}\n\nfloat fbm(float x) {\n	float v = 0.0;\n	float a = 0.5;\n	float shift = float(100);\n	for (int i = 0; i < NUM_OCTAVES; ++i) {\n		v += a * noise(x);\n		x = x * 2.0 + shift;\n		a *= 0.5;\n	}\n	return v;\n}\n\nfloat fbm(vec2 x) {\n	float v = 0.0;\n	float a = 0.5;\n	vec2 shift = vec2(100);\n	\n    mat2 rot = mat2(cos(0.5), sin(0.5), -sin(0.5), cos(0.50));\n	for (int i = 0; i < NUM_OCTAVES; ++i) {\n		v += a * noise(x);\n		x = rot * x * 2.0 + shift;\n		a *= 0.5;\n	}\n	return v;\n}\n\nfloat fbm(vec3 x) {\n	float v = 0.0;\n	float a = 0.5;\n	vec3 shift = vec3(100);\n	for (int i = 0; i < NUM_OCTAVES; ++i) {\n		v += a * noise(x);\n		x = x * 2.0 + shift;\n		a *= 0.5;\n	}\n	return v;\n}\n\nfloat fbm01(vec3 x) {\n	const float denom = 1.0 - pow(0.5, float(NUM_OCTAVES));\n	return clamp(fbm(x) / denom, 0.0, 1.0);\n}\nvec4 LinearTosRGB(in vec4 value) {\n  return vec4(\n    mix(\n      pow(value.rgb, vec3(0.41666)) * 1.055 - vec3(0.055),\n      value.rgb * 12.92,\n      vec3(lessThanEqual(value.rgb, vec3(0.0031308)))\n    ),\n    value.a\n  );\n}\n\nvec4 sRGBToLinear(in vec4 value) {\n  return vec4(\n    mix(\n      pow(value.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)),\n      value.rgb * 0.0773993808,\n      vec3(lessThanEqual(value.rgb, vec3(0.04045)))\n    ),\n    value.a\n  );\n}\n\nvec4 linearToOutputTexel(in vec4 value) {\n  return LinearTosRGB(value);\n}\nstruct BubbleShade {\n    vec3 diffuse;\n    vec3 spec;\n};\n\nvec3 hdrKeyLightDir() { return normalize(vec3(1.0, 1.0, 1.0)); }\nvec3 hdrKeyLightColor() { return vec3(1.0, 0.95, 0.9) * 1.5; }\nvec3 hdrFillLightDir() { return normalize(vec3(-1.0, 0.5, 0.5)); }\nvec3 hdrFillLightColor() { return vec3(0.5, 0.6, 0.8) * 0.5; }\n\nvec3 computeEnv(vec3 reflectDir) {\n    float upY = reflectDir.y;\n    vec3 envGround = vec3(0.015, 0.025, 0.05);\n    vec3 envHorizon = vec3(0.55, 0.42, 0.32);\n    vec3 envZenith = vec3(0.88, 0.94, 1.0);\n    float gh = smoothstep(-0.55, 0.05, upY);\n    float hs = smoothstep(0.05, 0.75, upY);\n    vec3 envColor = mix(mix(envGround, envHorizon, gh), envZenith, hs);\n\n    vec3 windowDir = normalize(vec3(0.7, 0.35, -0.6));\n    float windowLobe = pow(max(0.0, dot(reflectDir, windowDir)), 6.0);\n    envColor += vec3(1.0, 0.82, 0.55) * windowLobe * 0.7;\n\n    vec3 occluderDir = normalize(vec3(-0.55, -0.25, 0.75));\n    float occluderLobe = pow(max(0.0, dot(reflectDir, occluderDir)), 3.0);\n    envColor *= 1.0 - 0.55 * occluderLobe;\n\n    vec3 sparkleDir = normalize(vec3(-0.4, 0.85, 0.45));\n    float sparkle = pow(max(0.0, dot(reflectDir, sparkleDir)), 40.0);\n    envColor += vec3(0.65, 0.85, 1.0) * sparkle * 2.0;\n\n    float sun1 = pow(max(0.0, dot(reflectDir, hdrKeyLightDir())), 220.0);\n    envColor += hdrKeyLightColor() * sun1 * 6.0;\n\n    float sun2 = pow(max(0.0, dot(reflectDir, hdrFillLightDir())), 96.0);\n    envColor += hdrFillLightColor() * sun2 * 2.5;\n\n    return envColor;\n}\n\nBubbleShade computeBubbleShade(\n    vec3 normal,\n    vec3 viewDir,\n    float specStrength,\n    float fresnelPower,\n    float iridescenceStrength\n) {\n    vec3 n = normalize(normal);\n    vec3 v = normalize(viewDir);\n\n    vec3 lightDir1 = hdrKeyLightDir();\n    vec3 lightColor1 = hdrKeyLightColor();\n    float diff1 = max(0.0, dot(n, lightDir1));\n\n    vec3 lightDir2 = hdrFillLightDir();\n    vec3 lightColor2 = hdrFillLightColor();\n    float diff2 = max(0.0, dot(n, lightDir2));\n\n    vec3 lightDir3 = normalize(vec3(0.0, -0.5, -1.0));\n    vec3 lightColor3 = vec3(0.2, 0.2, 0.4) * 0.8;\n    float diff3 = max(0.0, dot(n, lightDir3));\n\n    vec3 ambient = mix(\n        vec3(0.08, 0.12, 0.18),\n        vec3(0.35, 0.40, 0.48),\n        n.y * 0.5 + 0.5);\n\n    vec3 diffuseLighting = ambient;\n    diffuseLighting += diff1 * lightColor1;\n    diffuseLighting += diff2 * lightColor2;\n    diffuseLighting += diff3 * lightColor3;\n\n    vec3 reflectDir = reflect(-v, n);\n    vec3 envColor = computeEnv(reflectDir);\n\n    \n    float cosTheta = max(0.0, dot(n, v));\n    float fresnel = pow(1.0 - cosTheta, fresnelPower);\n\n    \n    \n    vec3 thinFilm = 0.5 + 0.5 * cos(\n        vec3(7.0, 9.0, 11.0) * cosTheta + vec3(0.0, 1.6, 3.2));\n\n    vec3 spec = envColor * fresnel * specStrength;\n    vec3 irid = thinFilm * fresnel * iridescenceStrength;\n\n    BubbleShade s;\n    s.diffuse = diffuseLighting * 0.18;\n    s.spec = spec + irid;\n    return s;\n}\n\nvec3 hdrKeyLightDirDeep()    { return normalize(vec3(-0.55, 0.85, 0.65)); }\nvec3 hdrKeyLightColorDeep()  { return vec3(0.96, 0.98, 1.0) * 1.35; }\nvec3 hdrFillLightDirDeep()   { return normalize(vec3(0.85, 0.15, -0.35)); }\nvec3 hdrFillLightColorDeep() { return vec3(0.30, 0.45, 0.70) * 0.42; }\n\nvec3 computeEnvDeep(vec3 reflectDir) {\n    float upY = reflectDir.y;\n    vec3 envGround  = vec3(0.004, 0.008, 0.018);\n    vec3 envHorizon = vec3(0.035, 0.060, 0.110);\n    vec3 envZenith  = vec3(0.160, 0.240, 0.420);\n    float gh = smoothstep(-0.6, 0.05, upY);\n    float hs = smoothstep(0.05, 0.85, upY);\n    vec3 envColor = mix(mix(envGround, envHorizon, gh), envZenith, hs);\n\n    \n    vec3 sparkleDir = normalize(vec3(0.35, 0.82, -0.25));\n    float sparkle = pow(max(0.0, dot(reflectDir, sparkleDir)), 48.0);\n    envColor += vec3(0.62, 0.82, 1.0) * sparkle * 1.1;\n\n    vec3 sparkleDir2 = normalize(vec3(-0.72, 0.25, 0.58));\n    float sparkle2 = pow(max(0.0, dot(reflectDir, sparkleDir2)), 72.0);\n    envColor += vec3(0.75, 0.88, 1.0) * sparkle2 * 0.65;\n\n    \n    vec3 occluderDir = normalize(vec3(0.55, -0.3, -0.6));\n    float occluderLobe = pow(max(0.0, dot(reflectDir, occluderDir)), 2.5);
342\n    envColor *= 1.0 - 0.5 * occluderLobe;\n\n    return envColor;\n}\n\nBubbleShade computeBubbleShadeDeep(\n    vec3 normal,\n    vec3 viewDir,\n    float specStrength,\n    float fresnelPower,\n    float iridescenceStrength\n) {\n    vec3 n = normalize(normal);\n    vec3 v = normalize(viewDir);\n\n    vec3 lightDir1 = hdrKeyLightDirDeep();\n    vec3 lightColor1 = hdrKeyLightColorDeep();\n    float diff1 = max(0.0, dot(n, lightDir1));\n\n    vec3 lightDir2 = hdrFillLightDirDeep();\n    vec3 lightColor2 = hdrFillLightColorDeep();\n    float diff2 = max(0.0, dot(n, lightDir2));\n\n    \n    \n    vec3 ambient = mix(\n        vec3(0.018, 0.032, 0.060),\n        vec3(0.110, 0.165, 0.270),\n        n.y * 0.5 + 0.5);\n\n    vec3 diffuseLighting = ambient;\n    diffuseLighting += diff1 * lightColor1 * 0.35;\n    diffuseLighting += diff2 * lightColor2 * 0.35;\n\n    vec3 reflectDir = reflect(-v, n);\n    vec3 envColor = computeEnvDeep(reflectDir);\n\n    float cosTheta = max(0.0, dot(n, v));\n    \n    float schlick = pow(1.0 - cosTheta, fresnelPower);\n    float fresnel = 0.055 + (1.0 - 0.055) * schlick;\n\n    vec3 thinFilm = 0.5 + 0.5 * cos(\n        vec3(7.0, 9.0, 11.0) * cosTheta + vec3(0.0, 1.6, 3.2));\n\n    vec3 spec = envColor * fresnel * specStrength;\n    vec3 irid = thinFilm * schlick * iridescenceStrength;\n\n    BubbleShade s;\n    s.diffuse = diffuseLighting * 0.11;\n    s.spec = spec + irid;\n    return s;\n}\n\nuniform vec3 u_baseColor;\nuniform float u_specStrength;\nuniform float u_fresnelPower;\nuniform float u_outerNoiseScale;\n\nuniform float u_outerNoiseStrength;\n\nuniform float u_outerNoiseAnimate;\n\nuniform float u_outerGradStart;\n\nuniform float u_outerGradEnd;\n\nuniform float u_outerFadeStart;\n\nuniform float u_outerMaskSoftness;\n\nuniform float u_outerEdgeHighlight;\nuniform float u_outerEdgeHighlightWidth;\nuniform float u_outerNoiseScroll;\nuniform float u_outerDebugNoise;\n\nuniform float u_layoutOpacity;\n\nvarying vec3 v_normal;\nvarying vec3 v_viewPosition;\nvarying vec2 v_uv;\nvarying vec3 v_localPosition;\n\nfloat triDither(vec2 fragCoord) {\n    float r1 = fract(sin(dot(fragCoord, vec2(12.9898, 78.233))) * 43758.5453);\n    float r2 = fract(sin(dot(fragCoord, vec2(93.9898, 67.345))) * 24634.6345);\n    return (r1 + r2 - 1.0) / 255.0;\n}\n\nvoid main() {\n    float tRaw = clamp(u_outerNoiseAnimate, 0.0, 1.0);\n    float g0 = clamp(u_outerGradStart, 0.0, 1.0);\n    float g1 = clamp(max(u_outerGradEnd, g0 + 1e-3), 0.001, 1.0);\n    float fStart = clamp(max(u_outerFadeStart, g1), g1, 1.0);\n\n    \n    float appear = smoothstep(g0, g1, tRaw);\n    float disappear = 1.0 - smoothstep(fStart, 1.0, tRaw);\n    float revealAmount = appear * disappear;\n\n    \n    float scroll = tRaw * u_outerNoiseScroll;\n    vec3 nScroll = vec3(\n        scroll * 1.6180339887,\n        scroll * -0.9549235028,\n        scroll * 0.7320896123);\n    float nfRaw = fbm01(v_localPosition * u_outerNoiseScale + nScroll);\n\n    \n    float halfSoft = max(u_outerMaskSoftness, 1e-4) * 0.5;\n    float threshold = mix(1.0 + halfSoft, 0.0 - halfSoft, revealAmount);\n    float mask = smoothstep(threshold - halfSoft, threshold + halfSoft, nfRaw);\n\n    \n    float edgeBand = halfSoft * max(u_outerEdgeHighlightWidth, 0.05);\n    float edgeDist = abs(nfRaw - threshold);\n    float edgeGlow = 1.0 - smoothstep(0.0, edgeBand, edgeDist);\n    edgeGlow = edgeGlow * edgeGlow;\n\n    if (u_outerDebugNoise > 0.5) {\n        vec3 dbg = vec3(mask);\n        dbg += vec3(0.35, 0.7, 1.15) * edgeGlow * clamp(u_outerEdgeHighlight, 0.0, 4.0);\n        gl_FragColor = vec4(dbg, 1.0);\n        return;\n    }\n\n    vec3 n = normalize(v_normal);\n    vec3 v = normalize(v_viewPosition);\n\n    BubbleShade shade = computeBubbleShade(\n        n, v, u_specStrength, u_fresnelPower, 0.0);\n\n    const vec3 kDiffuseTone = vec3(0.94, 0.98, 1.08);\n    const vec3 kSpecTone = vec3(0.78, 0.9, 1.18);\n    shade.diffuse *= kDiffuseTone;\n    shade.spec *= kSpecTone;\n\n    \n    float edgeStrength = clamp(u_outerEdgeHighlight, 0.0, 6.0);\n    float edgeVis = max(mask, edgeGlow * 0.4);\n    shade.spec += edgeGlow * edgeStrength * 0.55 * edgeVis;\n\n    vec3 baseLinear = sRGBToLinear(vec4(u_baseColor, 1.0)).rgb;\n    vec3 shaded = baseLinear * shade.diffuse + shade.spec + baseLinear * 0.06;\n\n    \n    float grain = nfRaw * 2.0 - 1.0;\n    shaded *= 1.0 + grain * u_outerNoiseStrength * mask;\n\n    vec3 edgeTint = vec3(0.45, 0.76, 1.25);\n    shaded += edgeTint * edgeGlow * edgeStrength * edgeVis;\n\n    shaded = (shaded * (2.51 * shaded + 0.03)) /\n        (shaded * (2.43 * shaded + 0.59) + 0.14);\n\n    vec4 outColor = linearToOutputTexel(vec4(shaded, 1.0));\n    outColor.rgb += triDither(gl_FragCoord.xy);\n    float layoutOpacity = clamp(u_layoutOpacity, 0.0, 1.0);
342\n    gl_FragColor = vec4(outColor.rgb, mask * layoutOpacity);\n}",uniforms:{u_baseColor:{value:e?.isVector3===!0?e.clone():eI()},u_specStrength:{value:.58},u_fresnelPower:{value:6.5},u_outerNoiseScale:{value:1.15},u_outerNoiseStrength:{value:.55},u_outerNoiseAnimate:{value:0},u_outerGradStart:{value:.05},u_outerGradEnd:{value:.45},u_outerFadeStart:{value:.65},u_outerMaskSoftness:{value:.05},u_outerEdgeHighlight:{value:6},u_outerEdgeHighlightWidth:{value:.25},u_outerNoiseScroll:{value:14},u_outerDebugNoise:{value:0},u_layoutOpacity:{value:1}},side:eN.FrontSide,transparent:!0,depthWrite:!1})}}class ez extends eP.Group{disposed=!1;constructor(e){super(),this.name=e?.name??"sphere-rig",this.layoutMotion=new eP.Group,this.layoutMotion.name="layoutMotion",this.add(this.layoutMotion),this.layoutScale=new eP.Group,this.layoutScale.name="layoutScale",this.layoutMotion.add(this.layoutScale),this.sphere=new eH({...e,attachToScene:!1}),this.layoutScale.add(this.sphere),tW.scene.add(this)}setPhase(e){this.sphere?.setPhase?.(e)}dispose(){this.disposed=!0,this.sphere?.dispose?.(),this.sphere=null,this.parent?.remove(this)}}var eW=n;class eX{constructor(e,t,r,{initialScale:i=1}={}){this.count=t,this.size=Math.max(1,Math.ceil(Math.sqrt(t)));const a=r instanceof Float32Array?{default:r}:r,o=Object.keys(a);if(0===o.length)throw Error("ParticlesGpgpu: at least one rest state is required");this.activeSlot=o[0],this.targetSlot=o[0],this.gpu=new eE(this.size,this.size,e);const s=this.gpu.createTexture();this.#l(s.image.data,a[this.activeSlot],i);const l=this.gpu.createTexture();for(const e of(this.positionVariable=this.gpu.addVariable("u_position","uniform float u_streamCount;\nuniform float u_streamShape;\n\nuniform float u_streamMode;\nuniform vec3 u_streamAxis;\nuniform float u_streamSpeed;\nuniform float u_streamContain;\nuniform float u_streamRelease;\n\nconst float STREAM_SHIELD_R = 0.36;\n\nvec3 wrapAroundShield(vec3 p, vec3 n, vec3 fallbackDir, float a) {\n    if (a < 1e-4) return p;\n    float along = dot(p, n);\n    vec3 perp = p - n * along;\n    float rho = length(perp);\n    vec3 perpDir = rho > 1e-4 ? perp / rho : fallbackDir;\n    float aa = a * a;\n    float rho2 = rho * rho + (aa * aa) / (along * along + aa);\n    vec3 outp = n * along + perpDir * sqrt(max(rho2, 0.0));\n    \n    float pl = length(outp);\n    if (pl < a && pl > 1e-4) outp *= a / pl;\n    return outp;\n}\n\nconst float LEAK_RIM = 0.365;\n\nvec3 leakFocusA(float time) {\n    return normalize(vec3(\n        -0.15 + 0.55 * sin(time * 0.11),\n        0.55 + 0.35 * sin(time * 0.07 + 0.8),\n        0.55 + 0.35 * cos(time * 0.11)));\n}\n\nvec3 leakFocusB(float time) {\n    return normalize(vec3(\n        -0.25 + 0.5 * sin(time * 0.08 + 2.3),\n        0.35 + 0.45 * cos(time * 0.09 + 1.4),\n        0.6 + 0.3 * sin(time * 0.08 + 2.3)));\n}\n\nfloat streamHash(vec2 p, vec2 k, float m) {\n    return fract(sin(dot(p, k)) * m);\n}\n\nvec3 streamTarget(vec2 uv, float time) {\n    vec3 n = normalize(u_streamAxis);\n    vec3 helper = abs(n.y) < 0.9 ? vec3(0.0, 1.0, 0.0) : vec3(1.0, 0.0, 0.0);\n    vec3 e1 = normalize(cross(n, helper));\n    vec3 e2 = cross(n, e1);\n\n    float seed = streamHash(uv, vec2(12.9898, 78.233), 43758.5453);\n    float seed2 = streamHash(uv, vec2(39.3467, 11.135), 24634.6345);\n    float seed3 = streamHash(uv, vec2(63.7264, 50.281), 13543.1234);\n\n    \n    const float L = 1.0;\n    \n    float t = fract(seed + time * u_streamSpeed * 0.126);\n    float s = (t * 2.0 - 1.0) * L;\n    \n    float open = 1.0;\n    float rad = 0.012 + 0.06 * seed3;\n    float ang = seed2 * 6.28318 + s * 2.2 + time * 0.48;\n    \n    vec3 wiggle =\n        (e1 * sin(s * 3.6 + seed * 6.28318 + time * 1.05) +\n         e2 * cos(s * 2.7 + seed2 * 6.28318 + time * 0.9) +\n         e2 * sin(s * 7.2 + seed3 * 6.28318 + time * 1.55) * 0.22) *\n        0.038 * open;\n    vec3 lineT = n * s + (e1 * cos(ang) + e2 * sin(ang)) * rad + wiggle;\n\n    \n    \n    const vec3 LEAK_AXIS = vec3(-0.23880, 0.73809, 0.65126);\n    const float LEAK_MOUTH = 0.95;\n    vec3 lh = abs(LEAK_AXIS.y) < 0.9 ? vec3(0.0, 1.0, 0.0) : vec3(1.0, 0.0, 0.0);\n    vec3 lt1 = normalize(cross(LEAK_AXIS, lh));\n    vec3 lt2 = cross(LEAK_AXIS, lt1);\n    float polar = LEAK_MOUTH * (0.1 + 0.5 * seed2);\n    float az = seed3 * 6.28318;\n    vec3 hole = LEAK_AXIS * cos(polar) + (lt1 * cos(az) + lt2 * sin(az)) * sin(polar);\n    vec3 h1 = normalize(cross(hole, lh));\n    vec3 h2 = cross(hole, h1);\n    float pace = 0.7 + 0.6 * fract(seed * 5.7);\n    float lt = fract(seed + time * u_streamSpeed * 0.06 * pace);\n    const float REACH = 0.42;\n    float lr = LEAK_RIM + pow(lt, 0.9) * REACH;\n    vec3 sway =\n        (h1 * sin(time * 0.5 + seed * 6.28318) + h2 * cos(time * 0.4 + seed3 * 6.28318)) *\n        0.035 * lt;\n    vec3 leakT = hole * lr + sway;\n\n    \n    vec3 tubeDir = e1 * cos(ang) + e2 * sin(ang);\n    vec3 shieldT = wrapAroundShield(\n        lineT, n, tubeDir, STREAM_SHIELD_R * u_streamShape);
342\n\n    \n    \n    float clusters = mix(1.0, 6.0, u_streamMode);\n    float ci = floor(seed * clusters);\n    float drift = mix(1.0, 0.45, u_streamMode);\n    vec3 center = vec3(\n        sin(time * 0.21 * drift + ci * 1.7),\n        sin(time * 0.17 * drift + 1.3 + ci * 2.3),\n        cos(time * 0.13 * drift + 0.6 + ci * 0.9)) * mix(0.14, 0.21, u_streamMode);\n    \n    \n    float cs = fract(seed * clusters);\n    float th = cs * 6.28318 + time * u_streamSpeed * drift * (0.6 + 0.8 * fract(seed3 * 3.7));\n    float ph = acos(2.0 * seed2 - 1.0);\n    \n    float r = mix(0.13, 0.06, u_streamMode) * pow(fract(seed3 * 7.31 + 0.13), 0.3333);\n    vec3 dir = vec3(sin(ph) * cos(th), sin(ph) * sin(th), cos(ph));\n    vec3 blobT = center + dir * r;\n    float bl = length(blobT);\n    if (bl > u_streamContain) blobT *= u_streamContain / bl;\n\n    vec3 cryptT = mix(leakT, blobT, u_streamShape);\n    return mix(shieldT, cryptT, u_streamMode);\n}\n\nuniform float u_dt;\nuniform float u_time;\n\nvoid main() {\n    vec2 uv = gl_FragCoord.xy / resolution.xy;\n\n    vec3 pos = texture2D(u_position, uv).xyz;\n    vec3 vel = texture2D(u_velocity, uv).xyz;\n\n    vec3 next = pos + vel * u_dt;\n\n    \n    float texelIndex = floor(gl_FragCoord.x) + floor(gl_FragCoord.y) * resolution.x;\n    if (u_streamCount > 0.5 && texelIndex < u_streamCount) {\n        vec3 placed = streamTarget(uv, u_time) + vel;\n        float pl = length(placed);\n        if (u_streamMode > 0.5) {\n            \n            float lim = mix(10.0, u_streamContain, u_streamShape);\n            if (pl > lim) placed *= lim / pl;\n        } else {\n            \n            float a = STREAM_SHIELD_R * u_streamShape;\n            if (a > 1e-4 && pl < a && pl > 1e-4) placed *= a / pl;\n        }\n        next = mix(placed, next, u_streamRelease);\n    }\n\n    gl_FragColor = vec4(next, 1.0);\n}",s),this.velocityVariable=this.gpu.addVariable("u_velocity","vec3 _noise_mod289(vec3 x) {\n    return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec4 _noise_mod289(vec4 x) {\n    return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec4 _noise_permute(vec4 x) {\n    return _noise_mod289(((x * 34.0) + 1.0) * x);\n}\n\nvec4 _noise_taylorInvSqrt(vec4 r) {\n    return 1.79284291400159 - 0.85373472095314 * r;\n}\n\nfloat snoise(vec3 v) {\n    const vec2 C = vec2(1.0 / 6.0, 1.0 / 3.0);\n    const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n\n    vec3 i = floor(v + dot(v, C.yyy));\n    vec3 x0 = v - i + dot(i, C.xxx);\n\n    vec3 g = step(x0.yzx, x0.xyz);\n    vec3 l = 1.0 - g;\n    vec3 i1 = min(g.xyz, l.zxy);\n    vec3 i2 = max(g.xyz, l.zxy);\n\n    vec3 x1 = x0 - i1 + C.xxx;\n    vec3 x2 = x0 - i2 + C.yyy;\n    vec3 x3 = x0 - D.yyy;\n\n    i = _noise_mod289(i);\n    vec4 p = _noise_permute(_noise_permute(_noise_permute(\n                  i.z + vec4(0.0, i1.z, i2.z, 1.0))\n              + i.y + vec4(0.0, i1.y, i2.y, 1.0))\n              + i.x + vec4(0.0, i1.x, i2.x, 1.0));\n\n    float n_ = 0.142857142857;\n    vec3 ns = n_ * D.wyz - D.xzx;\n\n    vec4 j = p - 49.0 * floor(p * ns.z * ns.z);\n\n    vec4 x_ = floor(j * ns.z);\n    vec4 y_ = floor(j - 7.0 * x_);\n\n    vec4 x = x_ * ns.x + ns.yyyy;\n    vec4 y = y_ * ns.x + ns.yyyy;\n    vec4 h = 1.0 - abs(x) - abs(y);\n\n    vec4 b0 = vec4(x.xy, y.xy);\n    vec4 b1 = vec4(x.zw, y.zw);\n\n    vec4 s0 = floor(b0) * 2.0 + 1.0;\n    vec4 s1 = floor(b1) * 2.0 + 1.0;\n    vec4 sh = -step(h, vec4(0.0));\n\n    vec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;\n    vec4 a1 = b1.xzyw + s1.xzyw * sh.zzww;\n\n    vec3 p0 = vec3(a0.xy, h.x);\n    vec3 p1 = vec3(a0.zw, h.y);\n    vec3 p2 = vec3(a1.xy, h.z);\n    vec3 p3 = vec3(a1.zw, h.w);\n\n    vec4 norm = _noise_taylorInvSqrt(vec4(\n        dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));\n    p0 *= norm.x;\n    p1 *= norm.y;\n    p2 *= norm.z;\n    p3 *= norm.w;\n\n    vec4 m = max(0.6 - vec4(\n        dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0);\n    m = m * m;\n    return 42.0 * dot(m * m, vec4(\n        dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));\n}\n\nvec3 snoiseVec3(vec3 p) {\n    float s  = snoise(p);\n    float s1 = snoise(vec3(p.y - 19.1, p.z + 33.4, p.x + 47.2));\n    float s2 = snoise(vec3(p.z + 74.2, p.x - 124.5, p.y + 99.4));\n    return vec3(s, s1, s2);\n}\n\nvec3 curlNoise(vec3 p) {\n    const float e = 0.1;\n    vec3 dx = vec3(e, 0.0, 0.0);\n    vec3 dy = vec3(0.0, e, 0.0);\n    vec3 dz = vec3(0.0, 0.0, e);\n\n    vec3 p_x0 = snoiseVec3(p - dx);\n    vec3 p_x1 = snoiseVec3(p + dx);\n    vec3 p_y0 = snoiseVec3(p - dy);\n    vec3 p_y1 = snoiseVec3(p + dy);\n    vec3 p_z0 = snoiseVec3(p - dz);\n    vec3 p_z1 = snoiseVec3(p + dz);\n\n    float x = p_y1.z - p_y0.z - p_z1.y + p_z0.y;\n    float y = p_z1.x - p_z0.x - p_x1.z + p_x0.z;\n    float z = p_x1.y - p_x0.y - p_y1.x + p_y0.x;\n\n    const float divisor = 1.0 / (2.0 * e);\n    vec3 c = vec3(x, y, z) * divisor;\n    float l = length(c);\n    return l > 1e-6 ? c / l : vec3(0.0);\n}\nuniform float u_streamCount;\nuniform float u_streamShape;\n\nuniform float u_streamMode;\nuniform vec3 u_streamAxis;\nuniform float u_streamSpeed;\nuniform float u_streamContain;\nuniform float u_streamRelease;\n\nconst float STREAM_SHIELD_R = 0.36;\n\nvec3 wrapAroundShield(vec3 p, vec3 n, vec3 fallbackDir, float a) {\n    if (a < 1e-4) return p;\n    float along = dot(p, n);\n    vec3 perp = p - n * along;\n    float rho = length(perp);\n    vec3 perpDir = rho > 1e-4 ? perp / rho : fallbackDir;\n    float aa = a * a;\n    float rho2 = rho * rho + (aa * aa) / (along * along + aa);\n    vec3 outp = n * along + perpDir * sqrt(max(rho2, 0.0));\n    \n    float pl = length(outp);\n    if (pl < a && pl > 1e-4) outp *= a / pl;\n    return outp;\n}\n\nconst float LEAK_RIM = 0.365;\n\nvec3 leakFocusA(float time) {\n    return normalize(vec3(\n        -0.
34215 + 0.55 * sin(time * 0.11),\n        0.55 + 0.35 * sin(time * 0.07 + 0.8),\n        0.55 + 0.35 * cos(time * 0.11)));\n}\n\nvec3 leakFocusB(float time) {\n    return normalize(vec3(\n        -0.25 + 0.5 * sin(time * 0.08 + 2.3),\n        0.35 + 0.45 * cos(time * 0.09 + 1.4),\n        0.6 + 0.3 * sin(time * 0.08 + 2.3)));\n}\n\nfloat streamHash(vec2 p, vec2 k, float m) {\n    return fract(sin(dot(p, k)) * m);\n}\n\nvec3 streamTarget(vec2 uv, float time) {\n    vec3 n = normalize(u_streamAxis);\n    vec3 helper = abs(n.y) < 0.9 ? vec3(0.0, 1.0, 0.0) : vec3(1.0, 0.0, 0.0);\n    vec3 e1 = normalize(cross(n, helper));\n    vec3 e2 = cross(n, e1);\n\n    float seed = streamHash(uv, vec2(12.9898, 78.233), 43758.5453);\n    float seed2 = streamHash(uv, vec2(39.3467, 11.135), 24634.6345);\n    float seed3 = streamHash(uv, vec2(63.7264, 50.281), 13543.1234);\n\n    \n    const float L = 1.0;\n    \n    float t = fract(seed + time * u_streamSpeed * 0.126);\n    float s = (t * 2.0 - 1.0) * L;\n    \n    float open = 1.0;\n    float rad = 0.012 + 0.06 * seed3;\n    float ang = seed2 * 6.28318 + s * 2.2 + time * 0.48;\n    \n    vec3 wiggle =\n        (e1 * sin(s * 3.6 + seed * 6.28318 + time * 1.05) +\n         e2 * cos(s * 2.7 + seed2 * 6.28318 + time * 0.9) +\n         e2 * sin(s * 7.2 + seed3 * 6.28318 + time * 1.55) * 0.22) *\n        0.038 * open;\n    vec3 lineT = n * s + (e1 * cos(ang) + e2 * sin(ang)) * rad + wiggle;\n\n    \n    \n    const vec3 LEAK_AXIS = vec3(-0.23880, 0.73809, 0.65126);\n    const float LEAK_MOUTH = 0.95;\n    vec3 lh = abs(LEAK_AXIS.y) < 0.9 ? vec3(0.0, 1.0, 0.0) : vec3(1.0, 0.0, 0.0);\n    vec3 lt1 = normalize(cross(LEAK_AXIS, lh));\n    vec3 lt2 = cross(LEAK_AXIS, lt1);\n    float polar = LEAK_MOUTH * (0.1 + 0.5 * seed2);\n    float az = seed3 * 6.28318;\n    vec3 hole = LEAK_AXIS * cos(polar) + (lt1 * cos(az) + lt2 * sin(az)) * sin(polar);\n    vec3 h1 = normalize(cross(hole, lh));\n    vec3 h2 = cross(hole, h1);\n    float pace = 0.7 + 0.6 * fract(seed * 5.7);\n    float lt = fract(seed + time * u_streamSpeed * 0.06 * pace);\n    const float REACH = 0.42;\n    float lr = LEAK_RIM + pow(lt, 0.9) * REACH;\n    vec3 sway =\n        (h1 * sin(time * 0.5 + seed * 6.28318) + h2 * cos(time * 0.4 + seed3 * 6.28318)) *\n        0.035 * lt;\n    vec3 leakT = hole * lr + sway;\n\n    \n    vec3 tubeDir = e1 * cos(ang) + e2 * sin(ang);\n    vec3 shieldT = wrapAroundShield(\n        lineT, n, tubeDir, STREAM_SHIELD_R * u_streamShape);\n\n    \n    \n    float clusters = mix(1.0, 6.0, u_streamMode);\n    float ci = floor(seed * clusters);\n    float drift = mix(1.0, 0.45, u_streamMode);\n    vec3 center = vec3(\n        sin(time * 0.21 * drift + ci * 1.7),\n        sin(time * 0.17 * drift + 1.3 + ci * 2.3),\n        cos(time * 0.13 * drift + 0.6 + ci * 0.9)) * mix(0.14, 0.21, u_streamMode);\n    \n    \n    float cs = fract(seed * clusters);\n    float th = cs * 6.28318 + time * u_streamSpeed * drift * (0.6 + 0.8 * fract(seed3 * 3.7));\n    float ph = acos(2.0 * seed2 - 1.0);\n    \n    float r = mix(0.13, 0.06, u_streamMode) * pow(fract(seed3 * 7.31 + 0.13), 0.3333);\n    vec3 dir = vec3(sin(ph) * cos(th), sin(ph) * sin(th), cos(ph));\n    vec3 blobT = center + dir * r;\n    float bl = length(blobT);\n    if (bl > u_streamContain) blobT *= u_streamContain / bl;\n\n    vec3 cryptT = mix(leakT, blobT, u_streamShape);\n    return mix(shieldT, cryptT, u_streamMode);\n}\n\nuniform float u_dt;\nuniform float u_decay;\nuniform float u_springForce;\nuniform sampler2D u_restPositionA;\nuniform sampler2D u_restPositionB;\nuniform float u_restMix;\n\nuniform float u_restScaleA;\nuniform float u_restScaleB;\nuniform vec3 u_mouseRayOrigin;\nuniform vec3 u_mouseRayDir;\nuniform float u_mouseRadius;\nuniform float u_mouseStrength;\nuniform float u_mouseSpeed;\n\nuniform float u_leakBreathe;\n\nuniform float u_time;\nuniform float u_curlStrength;\nuniform float u_curlScale;\nuniform float u_curlTimeScale;\n\nuniform float u_streamFollow;\nuniform float u_streamDisturbRadius;\nuniform float u_streamDisturbStrength;\n\nvec3 mouseImpulse(vec3 p) {\n    if (u_mouseSpeed <= 1e-4) return vec3(0.0);\n    vec3 toParticle = p - u_mouseRayOrigin;\n    float t = max(0.0, dot(toParticle, u_mouseRayDir));\n    vec3 closestOnRay = u_mouseRayOrigin + u_mouseRayDir * t;\n    vec3 fromRay = p - closestOnRay;\n    float dist = length(fromRay);\n    if (dist >= u_mouseRadius) return vec3(0.0);\n    vec3 dir = dist > 1e-4 ? fromRay / dist : vec3(1.0, 0.0, 0.0);\n    float falloff = 1.0 - dist / u_mouseRadius;\n    return dir * u_mouseStrength * falloff * u_mouseSpeed * u_dt;\n}\n\nvoid main() {\n    vec2 uv = gl_FragCoord.xy / resolution.xy;\n\n    vec3 pos = texture2D(u_position, uv).xyz;\n    vec3 vel = texture2D(u_velocity, uv).xyz;\n\n    float texelIndex = floor(gl_FragCoord.x) + floor(gl_FragCoord.y) * resolution.x;\n    bool isStream = u_streamCount > 0.5 && texelIndex < u_streamCount;\n\n    \n    vec3 curlSampleP = vec3(\n        pos.x * u_curlScale,\n        pos.y * u_curlScale,\n        pos.z * u_curlScale + u_time * u_curlTimeScale);\n    vec3 curl = curlNoise(curlSampleP);\n\n    if (isStream) {\n        \n        vec3 disp = vel;\n        disp += mouseImpulse(pos) * 1.5;\n        \n        float swarm = u_streamMode * u_streamShape;\n        \n        float curlAmt = mix(3.4, mix(3.4, 11.0, u_streamMode), u_streamShape);\n        float keep = mix(0.90, mix(0.90, 0.985, u_streamMode), u_streamShape);\n        \n        vec3 swarmCurl = curlNoise(vec3(\n            pos.xy * u_curlScale * 6.0,\n            pos.z * u_curlScale * 6.0 + u_time * u_curlTimeScale * 1.6));
342\n        vec3 c = mix(curl, swarmCurl, swarm);\n        disp += c * u_curlStrength * curlAmt * u_dt;\n        disp *= pow(keep, u_dt);\n        \n        if (u_streamMode < 0.5 && u_streamShape > 1e-3) {\n            vec3 placed = streamTarget(uv, u_time) + disp;\n            float pl = length(placed);\n            float a = STREAM_SHIELD_R * u_streamShape;\n            if (pl < a && pl > 1e-4) {\n                disp += (placed / pl) * (a - pl);\n            }\n        }\n        \n        if (swarm > 1e-3) {\n            vec3 placed = streamTarget(uv, u_time) + disp;\n            float pl = length(placed);\n            \n            float lim = u_streamContain * 1.05;\n            \n            float inward = (pl / lim) * (pl / lim) * 0.02 * swarm * u_dt;\n            disp -= placed * inward;\n            \n            if (pl > lim) disp -= (placed / pl) * (pl - lim) * 0.9 * swarm;\n        }\n\n        \n        vec3 restA = texture2D(u_restPositionA, uv).xyz * u_restScaleA;\n        vec3 restB = texture2D(u_restPositionB, uv).xyz * u_restScaleB;\n        vec3 rest = mix(restA, restB, u_restMix);\n        vec3 desired = (rest - pos) * u_streamFollow + curl * u_curlStrength * 6.0;\n        vec3 dynamic = mix(vel, desired, 1.0 - pow(0.55, u_dt));\n\n        vel = mix(disp, dynamic, u_streamRelease);\n        gl_FragColor = vec4(vel, length(disp));\n        return;\n    }\n\n    \n    vec3 restA = texture2D(u_restPositionA, uv).xyz * u_restScaleA;\n    vec3 restB = texture2D(u_restPositionB, uv).xyz * u_restScaleB;\n    vec3 rest = mix(restA, restB, u_restMix);\n\n    \n    if (u_leakBreathe > 1e-6) {\n        float restLen = length(rest);\n        const float LEAK_RIM = 0.365;\n        if (restLen > LEAK_RIM) {\n            vec3 dir = rest / restLen;\n            \n            vec3 focusA = leakFocusA(u_time);\n            vec3 focusB = leakFocusB(u_time);\n            float align = max(dot(dir, focusA), dot(dir, focusB));\n            float gate = smoothstep(0.42, 0.88, align);\n\n            float seed = fract(\n                sin(dot(uv, vec2(12.9898, 78.233))) * 43758.5453);\n            float rate = 0.28 * (0.55 + 0.9 * seed);\n            float osc = 0.5 + 0.5 * sin(u_time * rate + seed * 6.28318);\n            float travel = osc * gate * u_leakBreathe;\n            rest *= mix(LEAK_RIM, restLen, travel) / restLen;\n        }\n    }\n\n    \n    float hole = u_streamDisturbRadius * (1.0 - u_streamShape) * (1.0 - u_streamMode);\n    \n    float holeAgit = 0.0;\n    if (hole > 1e-4 && u_streamCount > 0.5) {\n        vec3 n = normalize(u_streamAxis);\n        float along = dot(rest, n);\n        vec3 radial = rest - n * along;\n        float d = length(radial);\n        if (d < hole && abs(along) < hole * 2.0) {\n            vec3 dir = d > 1e-4 ? radial / d : vec3(0.0, 1.0, 0.0);\n            float spread = hole * (1.0 + 0.35 * (d / hole));\n            rest = n * along + dir * spread;\n        }\n        holeAgit = (1.0 - smoothstep(hole, hole * 2.6, d)) *\n            (1.0 - smoothstep(hole * 2.0, hole * 3.0, abs(along)));\n    }\n\n    \n    vec3 toRest = rest - pos;\n    vel += toRest * u_springForce * u_dt;\n\n    vel += curl * u_curlStrength * (1.0 + 6.0 * holeAgit) * u_dt;\n\n    vel += mouseImpulse(pos);\n\n    \n    vel *= pow(u_decay, u_dt);\n\n    \n    gl_FragColor = vec4(vel, length(toRest));\n}",l),this.gpu.setVariableDependencies(this.positionVariable,[this.positionVariable,this.velocityVariable]),this.gpu.setVariableDependencies(this.velocityVariable,[this.positionVariable,this.velocityVariable]),[this.positionVariable,this.velocityVariable]))e.wrapS=n.ClampToEdgeWrapping,e.wrapT=n.ClampToEdgeWrapping,e.minFilter=n.NearestFilter,e.magFilter=n.NearestFilter;for(const e of(this.restTextures=new Map,o))this.restTextures.set(e,this.#u(a[e]));const u=this.positionVariable.material.uniforms;u.u_dt={value:1};const c=this.restTextures.get(this.activeSlot),d=this.velocityVariable.material.uniforms;d.u_dt={value:1},d.u_decay={value:.88},d.u_springForce={value:.02},d.u_restPositionA={value:c},d.u_restPositionB={value:c},d.u_restMix={value:0},d.u_restScaleA={value:1},d.u_restScaleB={value:1},d.u_mouseRayOrigin={value:new n.Vector3},d.u_mouseRayDir={value:new n.Vector3(0,0,-1)},d.u_mouseRadius={value:.18},d.u_mouseStrength={value:.025},d.u_mouseSpeed={value:0},d.u_leakBreathe={value:0},d.u_time={value:0},d.u_curlStrength={value:.0015},d.u_curlScale={value:1.2},d.u_curlTimeScale={value:.15};const h={u_streamCount:{value:0},u_streamShape:{value:0},u_streamMode:{value:0},u_streamAxis:{value:new n.Vector3(0,0,1)},u_streamSpeed:{value:.5},u_streamContain:{value:.3},u_streamRelease:{value:0}};
342Object.assign(d,h),Object.assign(u,h),u.u_time={value:0},d.u_streamFollow={value:.12},d.u_streamDisturbRadius={value:.1},d.u_streamDisturbStrength={value:0};const f=this.gpu.init();null!==f&&console.error("ParticlesGpgpu init failed:",f)}#l(e,t,n=1){let r=t.length/3;for(let i=0;i<r;i++)e[4*i+0]=t[3*i+0]*n,e[4*i+1]=t[3*i+1]*n,e[4*i+2]=t[3*i+2]*n,e[4*i+3]=1}#u(e){let t=new Float32Array(this.size*this.size*4);this.#l(t,e);let r=new n.DataTexture(t,this.size,this.size,n.RGBAFormat,n.FloatType);return r.needsUpdate=!0,r.minFilter=n.NearestFilter,r.magFilter=n.NearestFilter,r.wrapS=n.ClampToEdgeWrapping,r.wrapT=n.ClampToEdgeWrapping,r}step({time:e=0,dtScale:t=1,mouseRayOrigin:n,mouseRayDir:r,mouseSpeed:i}){let a=this.positionVariable.material.uniforms,o=this.velocityVariable.material.uniforms;a.u_dt.value=t,a.u_time.value=e,o.u_dt.value=t,o.u_time.value=e,n&&o.u_mouseRayOrigin.value.copy(n),r&&o.u_mouseRayDir.value.copy(r),o.u_mouseSpeed.value=i??0,this.gpu.compute()}setRestState(e){if(!this.restTextures.has(e))return void console.warn(`ParticlesGpgpu: unknown rest state "${e}"`);if(e===this.targetSlot)return;let t=this.velocityVariable.material.uniforms;t.u_restMix.value>=.5&&(this.activeSlot=this.targetSlot),t.u_restPositionA.value=this.restTextures.get(this.activeSlot),t.u_restPositionB.value=this.restTextures.get(e),t.u_restMix.value=0,this.targetSlot=e}tickRestMix(e=1,t=.04){if(this.activeSlot===this.targetSlot)return;let n=this.velocityVariable.material.uniforms;n.u_restMix.value=Math.min(1,n.u_restMix.value+t*e),n.u_restMix.value>=1&&(n.u_restPositionA.value=n.u_restPositionB.value,n.u_restMix.value=0,this.activeSlot=this.targetSlot)}getRestStateSlots(){return Array.from(this.restTextures.keys())}getPositionTexture(){let e=this.gpu.getCurrentRenderTarget(this.positionVariable);return e?.texture??null}getVelocityTexture(){let e=this.gpu.getCurrentRenderTarget(this.velocityVariable);return e?.texture??null}dispose(){if(this.gpu?.dispose?.(),this.restTextures){for(let e of this.restTextures.values())e.dispose?.();this.restTextures.clear()}this.gpu=null,this.positionVariable=null,this.velocityVariable=null,this.restTextures=null}}function eK(e,{radius:t=.12,jitter:n=.005}={}){return eZ(e,{radius:t,jitter:n})}function ej(e,{radius:t=.35,jitter:n=.016,holeThreshold:r=.42,edgeSoftness:i=.18,maxTries:a=24}={}){let o=new Float32Array(3*e),s=Math.PI*(3-Math.sqrt(5)),l=Math.max(1,e-1),u=2*Math.PI;for(let f=0;f<e;f++){var c,d,h;let e=1-f/l*2,p=Math.sqrt(Math.max(0,1-e*e)),m=s*f,v=Math.cos(m)*p,g=Math.sin(m)*p;for(let t=0;t<a&&!(Math.sin(15.8*(c=v)+.8)*Math.cos(14.6*(d=e)-1.7)+Math.sin(16.4*d-.4)*Math.cos(15.2*(h=g)+2.1)+Math.sin(14.9*h+1.3)*Math.cos(16.1*c-.6)>r+Math.random()*i);t++)p=Math.sqrt(Math.max(0,1-(e=2*Math.random()-1)*e)),v=Math.cos(m=Math.random()*u)*p,g=Math.sin(m)*p;let _=t+(Math.random()-.5)*2*n;o[3*f+0]=v*_,o[3*f+1]=e*_,o[3*f+2]=g*_}return o}function eq(e,{radius:t=.35,jitter:n=.012,leakX:r=-.22,leakY:i=.68,leakZ:a=.6,mouth:o=.95,dustReach:s=1.35}={}){let l,u,c,d,h,f,p=new Float32Array(3*e),m=Math.PI*(3-Math.sqrt(5)),v=Math.max(1,e-1),g=Math.hypot(r,i,a)||1,_=r/g,S=i/g,x=a/g,{tx:T,ty:M,tz:b,bx:E,by:R,bz:w}=(f=Math.hypot(c=(u=+(0==(l=+(.9>Math.abs(_)))))*x,d=-l*x,h=l*S-u*_)||1,{tx:c/=f,ty:d/=f,tz:h/=f,bx:S*h-x*d,by:x*c-_*h,bz:_*d-S*c}),C=2*Math.PI,y=[];for(let e=0;e<6;e++)y.push({polar:o*(.25+.7*Math.random()),az:Math.random()*C,d:.12+.5*Math.random(),s:.09+.11*Math.random()});let A=(e,t)=>{let n=Math.sin(e),r=Math.cos(e),i=Math.cos(t),a=Math.sin(t);return{x:_*r+(T*i+E*a)*n,y:S*r+(M*i+R*a)*n,z:x*r+(b*i+w*a)*n}};for(let r=0;r<e;r++){let e,i,a,l,u=1-r/v*2,c=Math.sqrt(Math.max(0,1-u*u)),d=m*r,h=Math.cos(d)*c,f=Math.sin(d)*c,g=Math.acos(Math.max(-1,Math.min(1,h*_+u*S+f*x))),L=Math.atan2(h*E+u*R+f*w,h*T+u*M+f*b),D=o*(1+.24*Math.sin(3*L+1.2)+.15*Math.sin(7*L-.5)+.09*Math.sin(11*L+2));if(g>=D)e=h,i=u,a=f,l=t+(Math.random()-.5)*2*n;else{let c=Math.random();if(c<.2){let r=A(D+(Math.random()-.5)*.07,L);e=r.x,i=r.y,a=r.z,l=t+(Math.random()-.5)*2*n*2}else if(c<.35)e=h,i=u,a=f,l=t+(Math.random()-.5)*2*n*3;else if(c<.76){let e=y[Math.random()*y.length|0],n=A(e.polar,e.az),i=Math.pow(Math.random(),.65),a=()=>(Math.random()+Math.random()-1)*e.s*t*(.35+.65*i),o=(1+e.d*i)*t+1.2*a();p[3*r+0]=n.x*o+(T*a()+E*a())*1.3,p[3*r+1]=n.y*o+(M*a()+R*a())*1.3,p[3*r+2]=n.z*o+(b*a()+w*a())*.6;continue}else{let n=A(o*(.15+1.25*Math.random()),Math.random()*C);e=n.x,i=n.y,a=n.z,l=t*(1.05+Math.pow(Math.random(),1.6)*s)}}p[3*r+0]=e*l,p[3*r+1]=i*l,p[3*r+2]=a*l}return p}function eY(e,{radius:t=.35,jitter:n=.01,inner:r=.18,outer:i=.92}={}){let a=new Float32Array(3*e),o=Math.PI*(3-Math.sqrt(5)),s=Math.max(1,e-1),l=i-r;for(let i=0;i<e;i++){let e=1-i/s*2,u=Math.sqrt(Math.max(0,1-e*e)),c=o*i,d=Math.cos(c)*u,h=Math.sin(c)*u,f=t*(r+l*Math.pow(.61803398875*i%1,.55))+(Math.random()-.5)*2*n;a[3*i+0]=d*f,a[3*i+1]=e*f,a[3*i+2]=h*f}return a}function eZ(e,{radius:t=.35,jitter:n=.04}={}){let r=new Float32Array(3*e),i=Math.PI*(3-Math.sqrt(5)),a=Math.max(1,e-1);for(let o=0;o<e;o++){let e=1-o/a*2,s=Math.sqrt(Math.max(0,1-e*e)),l=i*o,u=Math.cos(l)*s,c=Math.sin(l)*s,d=t+(Math.random()-.5)*2*n;r[3*o+0]=u*d,r[3*o+1]=e*d,r[3*o+2]=c*d}return r}function e$(e,{turns:t=4.5,height:n=.92,radius:r=.25,ribbonHeight:i=.072,tangentSpan:a=.028,radialPuff:o=.012,jitter:s=.005,rotateY:l=Math.PI/4.8,tiltX:u=.18}={}){let c=new Float32Array(3*e);if(e<=0)return c;let d=(Math.sqrt(5)-1)/2,h=2*Math.PI*t,f=1/Math.hypot(h,n);for(let t=0;t<e;t++){let e=((t*d+.001*Math.random())%1+(Math.random()-.5)*a*f+1)%1,l=e*h,u=(e-.5)*n+(Math.random()-.5)*i,p=r+Math.random()*o,m=(Math.random()-.5)*2*s,v=(Math.random()-.5)*2*s,g=(Math.random()-.5)*2*s;c[3*t+0]=p*Math.cos(l)+m,c[3*t+1]=u+v,c[3*t+2]=p*Math.sin(l)+g}return e2(c,e,l),e3(c,e,u),c}function eQ(e,{radius:t=.3,width:n=.2,thickness:r=.012,jitter:i=.004,tiltX:a=.35}={}){let o=new Float32Array(3*e),s=(Math.sqrt(5)-1)/2,l=2*Math.PI;for(let a=0;a<e;a++){let u=(a*s+.0015*Math.random())%1*l,c=((a+.5)/e+1/e*(Math.random()-.5)-.5)*n,d=.5*u,h=Math.cos(d),f=Math.sin(d),p=Math.cos(u),m=Math.sin(u),v=t+c*h,g=v*p,_=c*f,S=v*m,x=-p*f,T=-m*f,M=(Math.random()-.5)*2*r,b=(Math.random()-.5)*2*i,E=(Math.random()-.5)*2*i,R=(Math.random()-.5)*2*i;o[3*a+0]=g+x*M+b,o[3*a+1]=_+h*M+E,o[3*a+2]=S+T*M+R}return e3(o,e,a),o}function eJ(e,{size:t=1.05,jitter:n=.0025,wave:r=.018,rotateY:i=e1.rotateY,t
342iltX:a=e1.tiltX}={}){let o=new Float32Array(3*e);if(e<=0)return o;let s=Math.max(1,Math.round(Math.sqrt(e))),l=Math.max(1,Math.ceil(e/s));for(let i=0;i<e;i++){let e=i%s,a=Math.floor(i/s),u=((e+.5)/s-.5)*t,c=((a+.5)/l-.5)*t,d=Math.sin(7*u)*Math.cos(6.2*c)*r+Math.sin(15*u+1.3)*Math.cos(13*c)*r*.35;o[3*i+0]=u+(Math.random()-.5)*2*n,o[3*i+1]=c+(Math.random()-.5)*2*n,o[3*i+2]=d+(Math.random()-.5)*2*n}return e2(o,e,i),e3(o,e,a),o}function e0(e,{radius:t=1,depthScale:n=.3}={}){let r=new Float32Array(3*e);for(let i=0;i<e;i++){let e=Math.random()*Math.PI*2,a=Math.acos(2*Math.random()-1),o=t*Math.cbrt(Math.random()),s=Math.sin(a);r[3*i+0]=o*s*Math.cos(e),r[3*i+1]=o*s*Math.sin(e),r[3*i+2]=o*Math.cos(a)*n}return r}let e1={rotateY:-1.45,tiltX:0};function e3(e,t,n){if(!n)return;let r=Math.cos(n),i=Math.sin(n);for(let n=0;n<t;n++){let t=3*n,a=e[t+1],o=e[t+2];e[t+1]=a*r-o*i,e[t+2]=a*i+o*r}}function e2(e,t,n){if(!n)return;let r=Math.cos(n),i=Math.sin(n);for(let n=0;n<t;n++){let t=3*n,a=e[t],o=e[t+2];e[t]=a*r+o*i,e[t+2]=-a*i+o*r}}function e5(e,{planeCount:t=11,size:n=.34,height:r=.66,jitter:i=.0018,thickness:a=4e-4,tiltX:o=.4,rotateY:s=Math.PI/6}={}){let l=new Float32Array(3*e);if(e<=0||t<=0)return l;let u=Math.max(1,t-1),c=0,d=0;for(let o=0;o<t&&c<e;o++){let s=o===t-1?e-d:Math.floor(e/t);if(d+=s,s<=0)continue;let h=(o/u-.5)*r,f=(.137*o%1-.5)*n*.03,p=(.091*o%1-.5)*n*.03,m=Math.max(1,Math.round(Math.sqrt(1.05*s))),v=Math.max(1,Math.ceil(s/m));for(let t=0;t<s&&c<e;t++){let e=t%m,r=Math.floor(t/m),s=((e+.5+(Math.random()-.5)*.06)/m-.5)*n,u=((r+.5+(Math.random()-.5)*.06)/v-.5)*n,d=h+function(e,t,n){let r=1.31*n;return 0+Math.sin(2.4*e+r)*Math.cos(2.4*t+.5*r)*.018+Math.sin(5*e+.9*r)*Math.cos(4.6*t+.7*r)*.008}(s,u,o)+(Math.random()-.5)*2*a;l[3*c+0]=s+f+(Math.random()-.5)*2*i,l[3*c+1]=d+(Math.random()-.5)*i,l[3*c+2]=u+p+(Math.random()-.5)*2*i,c++}}return e2(l,c,s),e3(l,c,o),l}e.s(["compactSpherePositions",0,eK,"containedSpherePositions",0,eY,"latticePlaneNormal",0,function({rotateY:e=e1.rotateY,tiltX:t=e1.tiltX}={}){let n=new Float32Array([0,0,1]);return e2(n,1,e),e3(n,1,t),[n[0],n[1],n[2]]},"latticePlanePositions",0,eJ,"leakingSpherePositions",0,eq,"mobiusStripPositions",0,eQ,"patchySpherePositions",0,ej,"roughSpherePositions",0,eZ,"scatterPositions",0,e0,"spiralPositions",0,e$,"stackedPlanesPositions",0,e5],81190);let e4={sphere:e=>eZ(e),compactSphere:e=>eK(e),patchySphere:e=>ej(e),leakingSphere:e=>eq(e),containedSphere:e=>eY(e),latticePlane:e=>eJ(e),scatter:e=>e0(e),spiral:e=>e$(e),mobius:e=>eQ(e),cubes:e=>e5(e)},e8={sphere:1,compactSphere:1,patchySphere:1,leakingSphere:1,containedSphere:1,spiral:2.34,mobius:2.6,cubes:2.58},e6={sphere:1,compactSphere:1,patchySphere:.42,leakingSphere:.55,containedSphere:1.35,spiral:.62,mobius:.48,cubes:.58},e9={sphere:1,compactSphere:1,patchySphere:1.45,leakingSphere:1.35,containedSphere:1.55,spiral:1.4,mobius:1.55,cubes:1.55},e7={sphere:1,compactSphere:1,patchySphere:1,leakingSphere:.85,containedSphere:1.45,spiral:1.35,mobius:1.45,cubes:1.4};class te extends eW.Group{#e;#t=new eW.Raycaster;#c=new eW.Vector2;#d=new eW.Matrix4;#h=new eW.Vector3;#f=new eW.Vector3;disposed=!1;simPaused=!1;scrollDrivenRest=!1;params={decay:.88,springForce:.02,mouseRadius:.18,mouseStrength:.025,leakBreathe:0,curlStrength:.0015,curlScale:1.2,curlTimeScale:.15,baseColor:"#920202",baseColorDark:"#920202",specStrength:.82,fresnelPower:5,speedFloor:.024,speedToLight:.043,glowBoost:2.44,particleSize:1,sizeVariation:.5,tintVariation:.4,blending:"additive",opacity:1,drawFraction:1,revealProgress:1,revealSoftness:.035,restState:"sphere",restTransitionRate:.04,restScales:{},restCurlMultipliers:{},restSpringMultipliers:{},restCurlScaleMultipliers:{},streamFraction:0,streamColor:"#e8281c",streamColorDark:"#9c6a67",streamShape:0,streamMode:0,leakTint:"#ff2a1c",leakTintDark:"#ff2a1c",agitateTint:0,streamAxis:[0,0,1],streamSpeed:.5,streamFollow:.12,streamContain:.3,streamDisturbRadius:.16,streamDisturbStrength:0,streamSize:1.15,streamBlending:"normal",streamRelease:0};#p="normal";#m=null;#v=null;constructor({name:e="particles",count:t=49152,particleRadius:n=.003,attachTo:r=null,attachToScene:i=!0,restStateBuilders:a=e4,initialRestState:o="sphere",restScales:s=e8}={}){super(),this.name=e,this.count=t;const l={};for(const[e,n]of Object.entries(a))l[e]=n(t);for(const e of(o in l||(o=Object.keys(l)[0]),Object.keys(l)))this.params.restScales[e]=s[e]??e8[e]??1,this.params.restCurlMultipliers[e]=e6[e]??1,this.params.restSpringMultipliers[e]=e9[e]??1,this.params.restCurlScaleMultipliers[e]=e7[e]??1;const u={[o]:l[o],...Object.fromEntries(Object.entries(l).filter(([e])=>e!==o))};this.params.restState=o,this.#m=o,this.gpgpu=new eX(tW.renderer,t,u,{initialScale:this.params.restScales[o]??1});const c=this.#g(t,this.gpgpu.size,n),d=new tt({baseColor:this.params.baseColor,specStrength:this.params.specStrength,fresnelPower:this.params.fresnelPower});this.mesh=new eW.Mesh(c,d),this.mesh.frustumCulled=!1,d.uniforms.u_simSize.value=this.gpgpu.size;const h=new tt({baseColor:this.params.streamColor,specStrength:this.params.specStrength,fresnelPower:this.params.fresnelPower});h.uniforms.u_groupSelect.value=1,h.uniforms.u_simSize.value=this.gpgpu.size,h.transparent=!0,h.depthWrite=!0,h.blending=eW.NormalBlending,this.streamMesh=new eW.Mesh(c,h),this.streamMesh.frustumCulled=!1,this.streamMesh.renderOrder=1,this.streamMesh.visible=!1,this.#_(this.params.blending),this.#v=this.params.blending,this.add(this.mesh),this.add(this.streamMesh),r?r.add(this):i&&tW.scene.add(this),this.#e=tW.subscribe(this.render.bind(this))}applyRestScroll(e,t=["sphere","spiral","mobius"],{ease:n=!0}={}){let r,i;if(!this.gpgpu?.velocityVariable||t.length<2)return;let a=t.length-1,o=Math.max(0,Math.min(a,Number(e)||0)),s=Math.min(a-1,Math.floor(o)),l=o-s,u=n?(i=(r=Math.max(0,Math.min(1,l)))*r*(3-2*r))*i*(3-2*i):l,c=this.gpgpu.velocityVariable.material.uniforms,d=this.gpgpu.restTextures,h=d.get(t[s]),f=d.get(t[s+1]);h&&f&&(c.u_restPositionA.value=h,c.u_restPositionB.value=f,c.u_restMix.value=u,u>=1-1e-5?(c.u_restPositionA.value=c.u_restPositionB.value,c.u_restMix.value=0,this.gpgpu.activeSlot=t[s+1]):this.gpgpu.activeSlot=t[s],this.gpgpu.targetSlot=t[s+1],this.params.restState=u<.5?t[s]:t[s+1],this.#m=this.params.restState)}#_(e){this.#S(this.mesh.material,e)}#x(e){let t=this.streamMesh.material;this.#S(t,e),"normal"===e&&(t.transparent=!0,t.depthWrite=!0)}#S(e,t){e.blendEquation=eW.AddEquation,"additive"===t?(e.transparent=!0,e.depthWrite=!1,e.blending=eW.AdditiveBlending,e.blendSrc=eW.SrcAlphaFactor,e.blendDst=eW.OneFactor):"exclusion"===t?(e.transparent=!0,e.depthWrite=!1,e.blending=eW.CustomBlending,e.blendSrc=eW.OneMinusDstColorFactor,e.blendDst=eW.OneMinusSrcColorFactor):(e.transparent=!1,e.depthWrite=!0,e.blending=eW.NormalBlending,e.blendSrc=eW.SrcAlphaFactor,e.blendDst=eW.OneMinusSrcAlphaFactor)}#g(e,t,n){let r=new eW.InstancedBufferGeometry,i=Math.sqrt(3),a=new Float32Array([-i,-1,n,i,-1,n,0,2,n]);r.setAttribute("position",new eW.BufferAttribute(a,3));let o=new Float32Array(2*e),s=new Float32Array(2*e);for(let n=0;n<e;n++){let e=n%t,r=Math.floor(n/t);o[2*n+0]=(e+.5)/t,o[2*n+1]=(r+.5)/t,s[2*n+0]=Math.random(),s[2*n+1]=Math.random()}return r.setAttribute("instanceUv",new eW.InstancedBufferAttribute(o,2)),r.setAttribute("instanceRand",new eW.InstancedBufferAttribute(s,2)),r.instanceCount=e,r}#T(){let e=this.params.restCurlMultipliers,t=e[this.gpgpu.activeSlot]??1;return t+((e[this.gpgpu.targetSlot]??1)-t)*(this.gpgpu.velocityVariable?.material?.uniforms?.u_restMix?.value??0)}#M(){let e=this.params.restSpringMultipliers,t=e[this.gpgpu.activeSlot]??1;return t+((e[this.gpgpu.targetSlot]??1)-t)*(this.gpgpu.velocityVariable?.material?.uniforms?.u_restMix?.value??0)}#b(){let e=this.params.restCurlScaleMultipliers,t=e[this.gpgpu.activeSlot]??1;return t+((e[this.gpgpu.targetSlot]??1)-t)*(this.gpgpu.velocityVariable?.material?.uniforms?.u_restMix?.value??0)}render(e){if(!this.mesh.visible)return;let t=this.mesh.material.uniforms;if(t.u_revealProgress.value=Math.max(0,Math.min(1,Number(this.params.revealProgress)||0)),t.u_revealSoftness.value=Math.max(1e-4,Number(this.params.revealSoftness)||.035),this.simPaused){t.u_positionTexture.value=this.gpgpu.getPositionTexture(),t.u_velocityTexture.value=this.gpgpu.getVelocityTexture();return}this.#c.set(tW.mouse.ex,tW.mouse.ey),this.#t.setFromCamera(this.#c,tW.camera),this.updateWorldMatrix(!0,!1),this.#d.copy(this.matrixWorld).invert(),this.#h.copy(this.#t.ray.origin).applyMatrix4(this.#d),this.#f.copy(this.#t.ray.direction).transformDirection(this.#d),this.gpgpu.step({time:e,dtScale:tW.simDtScale,mouseRayOrigin:this.#h,mouseRayDir:this.#f,mouseSpeed:tW.mouse.espeed}),t.u_positionTexture.value=this.gpgpu.getPositionTexture(),t.u_velocityTexture.value=this.gpgpu.getVelocityTexture(),t.u_baseColor.value.set(this.params.baseColor),t.u_baseColorDark.value.set(this.params.baseColorDark),this.#E(t),t.u_specStrength.value=this.params.specStrength,t.u_fresnelPower.value=this.params.fresnelPower,t.u_speedFloor.value=this.params.speedFloor,t.u_speedToLight.value=this.params.speedToLight,t.u_glowBo
342ost.value=this.params.glowBoost,t.u_sizeScale.value=this.params.particleSize,t.u_sizeVariation.value=this.params.sizeVariation,t.u_tintVariation.value=this.params.tintVariation,t.u_opacity.value=this.params.opacity,t.u_drawFraction.value=Math.max(0,Math.min(1,Number(this.params.drawFraction)||1));let n=this.gpgpu.velocityVariable.material.uniforms;n.u_decay.value=this.params.decay,n.u_springForce.value=this.params.springForce*this.#M(),n.u_mouseRadius.value=this.params.mouseRadius,n.u_mouseStrength.value=this.params.mouseStrength,n.u_leakBreathe.value=Math.max(0,Math.min(1,Number(this.params.leakBreathe)||0)),n.u_curlStrength.value=this.params.curlStrength*this.#T(),n.u_curlScale.value=this.params.curlScale*this.#b(),n.u_curlTimeScale.value=this.params.curlTimeScale,this.scrollDrivenRest||(this.params.restState!==this.#m&&(this.gpgpu.setRestState(this.params.restState),this.#m=this.params.restState),this.gpgpu.tickRestMix(tW.simDtScale,this.params.restTransitionRate)),this.params.blending!==this.#v&&(this.#_(this.params.blending),this.#v=this.params.blending);let r=this.params.restScales;n.u_restScaleA.value=r[this.gpgpu.activeSlot]??1,n.u_restScaleB.value=r[this.gpgpu.targetSlot]??1,this.#R(n)}#w=new eW.Vector2;#E(e){let t=tk.invertSweep;t&&e.u_groundSweep.value.set(t.progress,t.soft,t.bow,t.enabled?t.flip?2:1:0),tW.renderer&&(tW.renderer.getDrawingBufferSize(this.#w),e.u_resolution.value.copy(this.#w))}#R(e){let t=this.params,n=Math.max(0,Math.min(.5,Number(t.streamFraction)||0)),r=Math.round(this.count*n),i=Math.max(0,Math.min(1,Number(t.streamShape)||0));e.u_streamCount.value=r,e.u_streamShape.value=i;let a=Math.max(0,Math.min(1,Number(t.streamMode)||0));e.u_streamMode.value=a;let o=t.streamAxis;Array.isArray(o)&&o.length>=3&&e.u_streamAxis.value.set(o[0],o[1],o[2]),e.u_streamSpeed.value=t.streamSpeed,e.u_streamFollow.value=t.streamFollow,e.u_streamContain.value=t.streamContain,e.u_streamDisturbRadius.value=t.streamDisturbRadius,e.u_streamDisturbStrength.value=t.streamDisturbStrength,e.u_streamRelease.value=Math.max(0,Math.min(1,Number(t.streamRelease)||0));let s=this.mesh.material.uniforms;s.u_streamCount.value=r,s.u_hostLeakTint.value=r>0?a*(1-i):0,s.u_leakTint.value.set(t.leakTint),s.u_leakTintDark.value.set(t.leakTintDark),s.u_agitateTint.value=Math.max(0,Math.min(1,Number(t.agitateTint)||0));let l=this.streamMesh;if(l.visible=this.mesh.visible&&r>0,!l.visible)return;t.streamBlending!==this.#p&&(this.#x(t.streamBlending),this.#p=t.streamBlending);let u=l.material.uniforms;u.u_streamCount.value=r,u.u_positionTexture.value=s.u_positionTexture.value,u.u_velocityTexture.value=s.u_velocityTexture.value,u.u_baseColor.value.set(t.streamColor),u.u_baseColorDark.value.set(t.streamColorDark),this.#E(u),u.u_specStrength.value=t.specStrength,u.u_fresnelPower.value=t.fresnelPower,u.u_speedFloor.value=t.speedFloor,u.u_speedToLight.value=t.speedToLight,u.u_glowBoost.value=0,u.u_sizeScale.value=t.particleSize*t.streamSize,u.u_sizeVariation.value=t.sizeVariation,u.u_drawFraction.value=s.u_drawFraction.value,u.u_tintVariation.value=.5*t.tintVariation,u.u_opacity.value=t.opacity,u.u_revealProgress.value=s.u_revealProgress.value,u.u_revealSoftness.value=s.u_revealSoftness.value,u.u_streamAxis.value.copy(e.u_streamAxis.value),u.u_streamShape.value=i,u.u_streamMode.value=a}dispose(){this.disposed=!0,this.#e?.(),this.gpgpu?.dispose(),this.gpgpu=null,this.parent?.remove(this),this.mesh.geometry.dispose(),this.mesh.material.dispose(),this.streamMesh?.material.dispose()}}
342class tt extends eW.RawShaderMaterial{constructor({baseColor:e="#920202",specStrength:t=.82,fresnelPower:n=5}={}){super({vertexShader:"precision highp float;\n\nattribute vec3 position;\n\nattribute vec2 instanceUv;\n\nattribute vec2 instanceRand;\n\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\n\nuniform sampler2D u_positionTexture;\nuniform sampler2D u_velocityTexture;\n\nuniform float u_sizeScale;\n\nuniform float u_sizeVariation;\nuniform float u_revealProgress;\nuniform float u_revealSoftness;\n\nuniform float u_streamCount;\nuniform float u_simSize;\nuniform float u_groupSelect;\n\nuniform vec3 u_streamAxis;\nuniform float u_streamShape;\nuniform float u_streamMode;\n\nuniform float u_hostLeakTint;\n\nuniform float u_drawFraction;\n\nvarying vec2 v_disc;\nvarying vec3 v_viewPosition;\n\nvarying float v_speed;\n\nvarying float v_tintRand;\n\nvarying float v_revealMask;\n\nvarying float v_escape;\n\nvarying float v_displace;\n\nvoid main() {\n    float texelIndex =\n        floor(instanceUv.x * u_simSize) + floor(instanceUv.y * u_simSize) * u_simSize;\n    float isStream = (u_streamCount > 0.5 && texelIndex < u_streamCount) ? 1.0 : 0.0;\n    float inGroup = mix(1.0 - isStream, isStream, u_groupSelect);\n    float keep = u_drawFraction < 1e-4 ? 1.0 : u_drawFraction;\n    if (inGroup < 0.5 || instanceRand.y > keep) {\n        \n        gl_Position = vec4(0.0, 0.0, 2.0, 1.0);\n        v_disc = vec2(0.0);\n        v_viewPosition = vec3(0.0);\n        v_speed = 0.0;\n        v_displace = 0.0;\n        v_tintRand = 0.0;\n        v_revealMask = 0.0;\n        v_escape = 0.0;\n        return;\n    }\n\n    vec3 instancePos = texture2D(u_positionTexture, instanceUv).xyz;\n    vec4 velSample = texture2D(u_velocityTexture, instanceUv);\n    vec3 instanceVel = velSample.xyz;\n    float reveal = clamp(u_revealProgress, 0.0, 1.0);\n\n    \n    float instanceScale = 1.0 + (instanceRand.x - 0.5) * u_sizeVariation;\n    \n    float awayStory = u_groupSelect < 0.5\n        ? u_hostLeakTint\n        : u_streamMode * (1.0 - u_streamShape);\n    float away = smoothstep(0.385, 0.8, length(instancePos));\n    instanceScale *= mix(1.0, 0.45, away * awayStory);\n    \n    float groupScale = length(modelViewMatrix[0].xyz);\n    float radius = position.z * u_sizeScale * instanceScale * groupScale;\n\n    vec4 instanceCenterMv = modelViewMatrix * vec4(instancePos, 1.0);\n    vec4 originMv = modelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0);\n    vec3 viewRadiusVec = (modelViewMatrix * vec4(instancePos, 0.0)).xyz;\n    float revealRadius = max(length(viewRadiusVec), 1e-4);\n    float frontToBack = clamp(\n        (revealRadius - (instanceCenterMv.z - originMv.z)) /\n            (2.0 * revealRadius),\n        0.0,\n        1.0);\n    float revealSoftness = max(u_revealSoftness, 1e-4);\n    v_revealMask = reveal <= 0.0\n        ? 0.0\n        : reveal >= 1.0\n            ? 1.0\n            : smoothstep(\n                frontToBack - revealSoftness,\n                frontToBack + revealSoftness,\n                reveal);\n    v_revealMask = v_revealMask < 0.5\n        ? 0.5 * pow(2.0 * v_revealMask, 1.8)\n        : 1.0 - 0.5 * pow(2.0 * (1.0 - v_revealMask), 1.8);\n\n    \n    v_escape = u_groupSelect < 0.5\n        ? u_hostLeakTint * smoothstep(0.385, 0.5, length(instancePos))\n        : 0.0;\n\n    if (u_groupSelect > 0.5) {\n        float along = dot(instancePos, normalize(u_streamAxis));\n        float lineEnds = smoothstep(1.0, 0.62, abs(along));\n        \n        float r = length(instancePos);\n        float leakEnds = smoothstep(0.34, 0.42, r) * smoothstep(0.78, 0.6, r);\n        float ends = mix(lineEnds, leakEnds, u_streamMode);\n        \n        v_revealMask *= mix(ends, 1.0, u_streamShape * u_streamMode);\n    }\n\n    vec4 mvPosition = instanceCenterMv;\n    mvPosition.xy += position.xy * radius;\n    gl_Position = projectionMatrix * mvPosition;\n\n    v_disc = position.xy;\n    v_viewPosition = -mvPosition.xyz;\n    v_speed = length(instanceVel);\n    v_displace = velSample.w;\n    v_tintRand = instanceRand.y;\n}",fragmentShader:"precision highp float;\n\nvec4 LinearTosRGB(in vec4 value) {\n  return vec4(\n    mix(\n      pow(value.rgb, vec3(0.41666)) * 1.055 - vec3(0.055),\n      value.rgb * 12.92,\n      vec3(lessThanEqual(value.rgb, vec3(0.0031308)))\n    ),\n    value.a\n  );\n}\n\nvec4 sRGBToLinear(in vec4 value) {\n  return vec4(\n    mix(\n      pow(value.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)),\n      value.rgb * 0.0773993808,\n      vec3(lessThanEqual(value.rgb, vec3(0.04045)))\n    ),\n    value.a\n  );\n}\n\nvec4 linearToOutputTexel(in vec4 value) {\n  return LinearTosRGB(value);\n}\nstruct BubbleShade {\n    vec3 diffuse;\n    vec3 spec;\n};\n\nvec3 hdrKeyLightDir() { return normalize(vec3(1.0, 1.0, 1.0)); }\nvec3 hdrKeyLightColor() { return vec3(1.0, 0.95, 0.9) * 1.5; }\nvec3 hdrFillLightDir() { return normalize(vec3(-1.0, 0.5, 0.5)); }\nvec3 hdrFillLightColor() { return vec3(0.5, 0.6, 0.8) * 0.5; }\n\nvec3 computeEnv(vec3 reflectDir) {\n    float upY = reflectDir.y;\n    vec3 envGround = vec3(0.015, 0.025, 0.05);\n    vec3 envHorizon = vec3(0.55, 0.42, 0.32);\n    vec3 envZenith = vec3(0.88, 0.94, 1.0);\n    float gh = smoothstep(-0.55, 0.05, upY);\n    float hs = smoothstep(0.05, 0.75, upY);\n    vec3 envColor = mix(mix(envGround, envHorizon, gh), envZenith, hs);
342\n\n    vec3 windowDir = normalize(vec3(0.7, 0.35, -0.6));\n    float windowLobe = pow(max(0.0, dot(reflectDir, windowDir)), 6.0);\n    envColor += vec3(1.0, 0.82, 0.55) * windowLobe * 0.7;\n\n    vec3 occluderDir = normalize(vec3(-0.55, -0.25, 0.75));\n    float occluderLobe = pow(max(0.0, dot(reflectDir, occluderDir)), 3.0);\n    envColor *= 1.0 - 0.55 * occluderLobe;\n\n    vec3 sparkleDir = normalize(vec3(-0.4, 0.85, 0.45));\n    float sparkle = pow(max(0.0, dot(reflectDir, sparkleDir)), 40.0);\n    envColor += vec3(0.65, 0.85, 1.0) * sparkle * 2.0;\n\n    float sun1 = pow(max(0.0, dot(reflectDir, hdrKeyLightDir())), 220.0);\n    envColor += hdrKeyLightColor() * sun1 * 6.0;\n\n    float sun2 = pow(max(0.0, dot(reflectDir, hdrFillLightDir())), 96.0);\n    envColor += hdrFillLightColor() * sun2 * 2.5;\n\n    return envColor;\n}\n\nBubbleShade computeBubbleShade(\n    vec3 normal,\n    vec3 viewDir,\n    float specStrength,\n    float fresnelPower,\n    float iridescenceStrength\n) {\n    vec3 n = normalize(normal);\n    vec3 v = normalize(viewDir);\n\n    vec3 lightDir1 = hdrKeyLightDir();\n    vec3 lightColor1 = hdrKeyLightColor();\n    float diff1 = max(0.0, dot(n, lightDir1));\n\n    vec3 lightDir2 = hdrFillLightDir();\n    vec3 lightColor2 = hdrFillLightColor();\n    float diff2 = max(0.0, dot(n, lightDir2));\n\n    vec3 lightDir3 = normalize(vec3(0.0, -0.5, -1.0));\n    vec3 lightColor3 = vec3(0.2, 0.2, 0.4) * 0.8;\n    float diff3 = max(0.0, dot(n, lightDir3));\n\n    vec3 ambient = mix(\n        vec3(0.08, 0.12, 0.18),\n        vec3(0.35, 0.40, 0.48),\n        n.y * 0.5 + 0.5);\n\n    vec3 diffuseLighting = ambient;\n    diffuseLighting += diff1 * lightColor1;\n    diffuseLighting += diff2 * lightColor2;\n    diffuseLighting += diff3 * lightColor3;\n\n    vec3 reflectDir = reflect(-v, n);\n    vec3 envColor = computeEnv(reflectDir);\n\n    \n    float cosTheta = max(0.0, dot(n, v));\n    float fresnel = pow(1.0 - cosTheta, fresnelPower);\n\n    \n    \n    vec3 thinFilm = 0.5 + 0.5 * cos(\n        vec3(7.0, 9.0, 11.0) * cosTheta + vec3(0.0, 1.6, 3.2));\n\n    vec3 spec = envColor * fresnel * specStrength;\n    vec3 irid = thinFilm * fresnel * iridescenceStrength;\n\n    BubbleShade s;\n    s.diffuse = diffuseLighting * 0.18;\n    s.spec = spec + irid;\n    return s;\n}\n\nvec3 hdrKeyLightDirDeep()    { return normalize(vec3(-0.55, 0.85, 0.65)); }\nvec3 hdrKeyLightColorDeep()  { return vec3(0.96, 0.98, 1.0) * 1.35; }\nvec3 hdrFillLightDirDeep()   { return normalize(vec3(0.85, 0.15, -0.35)); }\nvec3 hdrFillLightColorDeep() { return vec3(0.30, 0.45, 0.70) * 0.42; }\n\nvec3 computeEnvDeep(vec3 reflectDir) {\n    float upY = reflectDir.y;\n    vec3 envGround  = vec3(0.004, 0.008, 0.018);\n    vec3 envHorizon = vec3(0.035, 0.060, 0.110);\n    vec3 envZenith  = vec3(0.160, 0.240, 0.420);\n    float gh = smoothstep(-0.6, 0.05, upY);\n    float hs = smoothstep(0.05, 0.85, upY);\n    vec3 envColor = mix(mix(envGround, envHorizon, gh), envZenith, hs);\n\n    \n    vec3 sparkleDir = normalize(vec3(0.35, 0.82, -0.25));\n    float sparkle = pow(max(0.0, dot(reflectDir, sparkleDir)), 48.0);\n    envColor += vec3(0.62, 0.82, 1.0) * sparkle * 1.1;\n\n    vec3 sparkleDir2 = normalize(vec3(-0.72, 0.25, 0.58));\n    float sparkle2 = pow(max(0.0, dot(reflectDir, sparkleDir2)), 72.0);\n    envColor += vec3(0.75, 0.88, 1.0) * sparkle2 * 0.65;\n\n    \n    vec3 occluderDir = normalize(vec3(0.55, -0.3, -0.6));\n    float occluderLobe = pow(max(0.0, dot(reflectDir, occluderDir)), 2.5);\n    envColor *= 1.0 - 0.5 * occluderLobe;\n\n    return envColor;\n}\n\nBubbleShade computeBubbleShadeDeep(\n    vec3 normal,\n    vec3 viewDir,\n    float specStrength,\n    float fresnelPower,\n    float iridescenceStrength\n) {\n    vec3 n = normalize(normal);\n    vec3 v = normalize(viewDir);\n\n    vec3 lightDir1 = hdrKeyLightDirDeep();\n    vec3 lightColor1 = hdrKeyLightColorDeep();\n    float diff1 = max(0.0, dot(n, lightDir1));\n\n    vec3 lightDir2 = hdrFillLightDirDeep();\n    vec3 lightColor2 = hdrFillLightColorDeep();\n    float diff2 = max(0.0, dot(n, lightDir2));\n\n    \n    \n    vec3 ambient = mix(\n        vec3(0.018, 0.032, 0.060),\n        vec3(0.110, 0.165, 0.270),\n        n.y * 0.5 + 0.5);\n\n    vec3 diffuseLighting = ambient;\n    diffuseLighting += diff1 * lightColor1 * 0.35;\n    diffuseLighting += diff2 * lightColor2 * 0.35;\n\n    vec3 reflectDir = reflect(-v, n);\n    vec3 envColor = computeEnvDeep(reflectDir);\n\n    float cosTheta = max(0.0, dot(n, v));\n    \n    float schlick = pow(1.0 - cosTheta, fresnelPower);\n    float fresnel = 0.055 + (1.0 - 0.055) * schlick;\n\n    vec3 thinFilm = 0.5 + 0.5 * cos(\n        vec3(7.0, 9.0, 11.0) * cosTheta + vec3(0.0, 1.6, 3.2));\n\n    vec3 spec = envColor * fresnel * specStrength;\n    vec3 irid = thinFilm * schlick * iridescenceStrength;\n\n    BubbleShade s;\n    s.diffuse = diffuseLighting * 0.11;\n    s.spec = spec + irid;\n    return s;\n}\n\nuniform vec3 u_baseColor;\n\nuniform vec3 u_baseColorDark;\n\nuniform vec4 u_groundSweep;\nuniform vec2 u_resolution;\nuniform float u_specStrength;\nuniform float u_fresnelPower;\n\nuniform float u_speedFloor;\nuniform float u_speedToLight;
342\n\nuniform float u_glowBoost;\n\nuniform float u_opacity;\n\nuniform float u_tintVariation;\n\nvarying vec2 v_disc;\nvarying vec3 v_viewPosition;\nvarying float v_speed;\nvarying float v_displace;\nvarying float v_tintRand;\nvarying float v_revealMask;\n\nuniform vec3 u_leakTint;\nuniform vec3 u_leakTintDark;\nvarying float v_escape;\n\nuniform float u_agitateTint;\n\nfloat groundBand() {\n    if (u_groundSweep.w < 0.5) return 1.0;\n    vec2 uv = gl_FragCoord.xy / u_resolution;\n    float soft = max(u_groundSweep.y, 1e-4);\n    float bow = u_groundSweep.z;\n    float flip = step(1.5, u_groundSweep.w);\n    float t = mix(u_groundSweep.x, 1.0 - u_groundSweep.x, flip);\n    float cx = uv.x - 0.5;\n    float curve = bow * (1.0 - 4.0 * cx * cx);\n    float edge = mix(-soft - bow, 1.0 + soft, t) + curve;\n    float stepped = smoothstep(edge - soft, edge + soft, uv.y);\n    return mix(1.0 - stepped, stepped, flip);\n}\n\nvoid main() {\n    float band = groundBand();\n    vec3 sourceColor = mix(u_baseColor, u_baseColorDark, band);\n    vec3 leakTint = mix(u_leakTint, u_leakTintDark, band);\n\n    \n    float r2 = dot(v_disc, v_disc);\n    if (r2 > 1.0) discard;\n    \n    float rimAA = 1.0 - smoothstep(0.84, 1.0, r2);\n    vec3 n = vec3(v_disc, sqrt(max(0.0, 1.0 - r2)));\n    vec3 v = normalize(v_viewPosition);\n\n    float lightFactor = pow(\n        smoothstep(u_speedFloor, u_speedToLight, v_speed), 1.5);\n\n    float tint = 1.0 + (v_tintRand - 0.5) * u_tintVariation;\n\n    vec3 baseColor = sourceColor * tint * (1.0 + lightFactor * 1.5);\n\n    \n    BubbleShade shade = computeBubbleShade(\n        n, v, u_specStrength, u_fresnelPower, 0.0);\n\n    vec3 finalColor = baseColor * shade.diffuse + shade.spec;\n\n    \n    finalColor += sourceColor * lightFactor * u_glowBoost;\n\n    \n    \n    float agitated = smoothstep(0.03, 0.09, v_displace) * u_agitateTint;\n    float redness = max(clamp(v_escape, 0.0, 1.0), agitated);\n    finalColor = mix(finalColor, leakTint, redness);\n\n    finalColor = (finalColor * (2.51 * finalColor + 0.03)) /\n        (finalColor * (2.43 * finalColor + 0.59) + 0.14);\n\n    \n    float opacity = u_opacity * clamp(v_revealMask, 0.0, 1.0) * rimAA;\n    gl_FragColor = linearToOutputTexel(vec4(finalColor * opacity, opacity));\n}",uniforms:{u_positionTexture:{value:null},u_velocityTexture:{value:null},u_baseColor:{value:new eW.Color(e)},u_specStrength:{value:t},u_fresnelPower:{value:n},u_speedFloor:{value:.024},u_speedToLight:{value:.043},u_glowBoost:{value:2.44},u_sizeScale:{value:1},u_sizeVariation:{value:.5},u_tintVariation:{value:.4},u_opacity:{value:1},u_drawFraction:{value:1},u_revealProgress:{value:1},u_revealSoftness:{value:.035},u_streamCount:{value:0},u_simSize:{value:1},u_groupSelect:{value:0},u_streamAxis:{value:new eW.Vector3(0,0,1)},u_streamShape:{value:0},u_streamMode:{value:0},u_hostLeakTint:{value:0},u_leakTint:{value:new eW.Color("#ff2a1c")},u_leakTintDark:{value:new eW.Color("#ff2a1c")},u_baseColorDark:{value:new eW.Color(e)},u_groundSweep:{value:new eW.Vector4(0,.1,.06,0)},u_resolution:{value:new eW.Vector2(1,1)},u_agitateTint:{value:0}},side:eW.FrontSide,transparent:!1,depthWrite:!0})}}var tn=n;class tr extends tn.Mesh{#e;static ANCHOR_X_NDC=.88;static ANCHOR_Y_NDC=-.82;static RADIUS_NDC_Y=.065;static LOCAL_Z=.5;constructor(){super(new tn.IcosahedronGeometry(1,6),new tn.RawShaderMaterial({vertexShader:"precision highp float;\n\nattribute vec3 position;\nattribute vec3 normal;\n\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat3 normalMatrix;\n\nvarying vec3 v_normal;\nvarying vec3 v_viewPosition;\n\nvoid main() {\n  vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n  gl_Position = projectionMatrix * mvPosition;\n\n  v_normal = normalize(normalMatrix * normal);\n  v_viewPosition = -mvPosition.xyz;\n}",fragmentShader:"precision highp float;\n\nvec4 LinearTosRGB(in vec4 value) {\n  return vec4(\n    mix(\n      pow(value.rgb, vec3(0.41666)) * 1.055 - vec3(0.055),\n      value.rgb * 12.92,\n      vec3(lessThanEqual(value.rgb, vec3(0.0031308)))\n    ),\n    value.a\n  );\n}\n\nvec4 sRGBToLinear(in vec4 value) {\n  return vec4(\n    mix(\n      pow(value.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)),\n      value.rgb * 0.0773993808,\n      vec3(lessThanEqual(value.rgb, vec3(0.04045)))\n    ),\n    value.a\n  );\n}\n\nvec4 linearToOutputTexel(in vec4 value) {\n  return LinearTosRGB(value);\n}\nstruct BubbleShade {\n    vec3 diffuse;\n    vec3 spec;\n};\n\nvec3 hdrKeyLightDir() { return normalize(vec3(1.0, 1.0, 1.0)); }\nvec3 hdrKeyLightColor() { return vec3(1.0, 0.95, 0.9) * 1.5; }\nvec3 hdrFillLightDir() { return normalize(vec3(-1.0, 0.5, 0.5)); }\nvec3 hdrFillLightColor() { return vec3(0.5, 0.6, 0.8) * 0.5; }\n\nvec3 computeEnv(vec3 reflectDir) {\n    float upY = reflectDir.y;\n    vec3 envGround = vec3(0.015, 0.025, 0.05);\n    vec3 envHorizon = vec3(0.55, 0.42, 0.32);\n    vec3 envZenith = vec3(0.88, 0.94, 1.0);\n    float gh = smoothstep(-0.55, 0.05, upY);\n    float hs = smoothstep(0.05, 0.75, upY);\n    vec3 envColor = mix(mix(envGround, envHorizon, gh), envZenith, hs);
342\n\n    vec3 windowDir = normalize(vec3(0.7, 0.35, -0.6));\n    float windowLobe = pow(max(0.0, dot(reflectDir, windowDir)), 6.0);\n    envColor += vec3(1.0, 0.82, 0.55) * windowLobe * 0.7;\n\n    vec3 occluderDir = normalize(vec3(-0.55, -0.25, 0.75));\n    float occluderLobe = pow(max(0.0, dot(reflectDir, occluderDir)), 3.0);\n    envColor *= 1.0 - 0.55 * occluderLobe;\n\n    vec3 sparkleDir = normalize(vec3(-0.4, 0.85, 0.45));\n    float sparkle = pow(max(0.0, dot(reflectDir, sparkleDir)), 40.0);\n    envColor += vec3(0.65, 0.85, 1.0) * sparkle * 2.0;\n\n    float sun1 = pow(max(0.0, dot(reflectDir, hdrKeyLightDir())), 220.0);\n    envColor += hdrKeyLightColor() * sun1 * 6.0;\n\n    float sun2 = pow(max(0.0, dot(reflectDir, hdrFillLightDir())), 96.0);\n    envColor += hdrFillLightColor() * sun2 * 2.5;\n\n    return envColor;\n}\n\nBubbleShade computeBubbleShade(\n    vec3 normal,\n    vec3 viewDir,\n    float specStrength,\n    float fresnelPower,\n    float iridescenceStrength\n) {\n    vec3 n = normalize(normal);\n    vec3 v = normalize(viewDir);\n\n    vec3 lightDir1 = hdrKeyLightDir();\n    vec3 lightColor1 = hdrKeyLightColor();\n    float diff1 = max(0.0, dot(n, lightDir1));\n\n    vec3 lightDir2 = hdrFillLightDir();\n    vec3 lightColor2 = hdrFillLightColor();\n    float diff2 = max(0.0, dot(n, lightDir2));\n\n    vec3 lightDir3 = normalize(vec3(0.0, -0.5, -1.0));\n    vec3 lightColor3 = vec3(0.2, 0.2, 0.4) * 0.8;\n    float diff3 = max(0.0, dot(n, lightDir3));\n\n    vec3 ambient = mix(\n        vec3(0.08, 0.12, 0.18),\n        vec3(0.35, 0.40, 0.48),\n        n.y * 0.5 + 0.5);\n\n    vec3 diffuseLighting = ambient;\n    diffuseLighting += diff1 * lightColor1;\n    diffuseLighting += diff2 * lightColor2;\n    diffuseLighting += diff3 * lightColor3;\n\n    vec3 reflectDir = reflect(-v, n);\n    vec3 envColor = computeEnv(reflectDir);\n\n    \n    float cosTheta = max(0.0, dot(n, v));\n    float fresnel = pow(1.0 - cosTheta, fresnelPower);\n\n    \n    \n    vec3 thinFilm = 0.5 + 0.5 * cos(\n        vec3(7.0, 9.0, 11.0) * cosTheta + vec3(0.0, 1.6, 3.2));\n\n    vec3 spec = envColor * fresnel * specStrength;\n    vec3 irid = thinFilm * fresnel * iridescenceStrength;\n\n    BubbleShade s;\n    s.diffuse = diffuseLighting * 0.18;\n    s.spec = spec + irid;\n    return s;\n}\n\nvec3 hdrKeyLightDirDeep()    { return normalize(vec3(-0.55, 0.85, 0.65)); }\nvec3 hdrKeyLightColorDeep()  { return vec3(0.96, 0.98, 1.0) * 1.35; }\nvec3 hdrFillLightDirDeep()   { return normalize(vec3(0.85, 0.15, -0.35)); }\nvec3 hdrFillLightColorDeep() { return vec3(0.30, 0.45, 0.70) * 0.42; }\n\nvec3 computeEnvDeep(vec3 reflectDir) {\n    float upY = reflectDir.y;\n    vec3 envGround  = vec3(0.004, 0.008, 0.018);\n    vec3 envHorizon = vec3(0.035, 0.060, 0.110);\n    vec3 envZenith  = vec3(0.160, 0.240, 0.420);\n    float gh = smoothstep(-0.6, 0.05, upY);\n    float hs = smoothstep(0.05, 0.85, upY);\n    vec3 envColor = mix(mix(envGround, envHorizon, gh), envZenith, hs);\n\n    \n    vec3 sparkleDir = normalize(vec3(0.35, 0.82, -0.25));\n    float sparkle = pow(max(0.0, dot(reflectDir, sparkleDir)), 48.0);\n    envColor += vec3(0.62, 0.82, 1.0) * sparkle * 1.1;\n\n    vec3 sparkleDir2 = normalize(vec3(-0.72, 0.25, 0.58));\n    float sparkle2 = pow(max(0.0, dot(reflectDir, sparkleDir2)), 72.0);\n    envColor += vec3(0.75, 0.88, 1.0) * sparkle2 * 0.65;\n\n    \n    vec3 occluderDir = normalize(vec3(0.55, -0.3, -0.6));\n    float occluderLobe = pow(max(0.0, dot(reflectDir, occluderDir)), 2.5);\n    envColor *= 1.0 - 0.5 * occluderLobe;\n\n    return envColor;\n}\n\nBubbleShade computeBubbleShadeDeep(\n    vec3 normal,\n    vec3 viewDir,\n    float specStrength,\n    float fresnelPower,\n    float iridescenceStrength\n) {\n    vec3 n = normalize(normal);\n    vec3 v = normalize(viewDir);\n\n    vec3 lightDir1 = hdrKeyLightDirDeep();\n    vec3 lightColor1 = hdrKeyLightColorDeep();\n    float diff1 = max(0.0, dot(n, lightDir1));\n\n    vec3 lightDir2 = hdrFillLightDirDeep();\n    vec3 lightColor2 = hdrFillLightColorDeep();\n    float diff2 = max(0.0, dot(n, lightDir2));\n\n    \n    \n    vec3 ambient = mix(\n        vec3(0.018, 0.032, 0.060),\n        vec3(0.110, 0.165, 0.270),\n        n.y * 0.5 + 0.5);\n\n    vec3 diffuseLighting = ambient;\n    diffuseLighting += diff1 * lightColor1 * 0.35;\n    diffuseLighting += diff2 * lightColor2 * 0.35;\n\n    vec3 reflectDir = reflect(-v, n);\n    vec3 envColor = computeEnvDeep(reflectDir);\n\n    float cosTheta = max(0.0, dot(n, v));\n    \n    float schlick = pow(1.0 - cosTheta, fresnelPower);\n    float fresnel = 0.055 + (1.0 - 0.055) * schlick;\n\n    vec3 thinFilm = 0.5 + 0.5 * cos(\n        vec3(7.0, 9.0, 11.0) * cosTheta + vec3(0.0, 1.6, 3.2));\n\n    vec3 spec = envColor * fresnel * specStrength;\n    vec3 irid = thinFilm * schlick * iridescenceStrength;\n\n    BubbleShade s;\n    s.diffuse = diffuseLighting * 0.11;\n    s.spec = spec + irid;\n    return s;\n}\n\nvarying vec3 v_normal;\nvarying vec3 v_viewPosition;\n\nfloat triDither(vec2 fragCoord) {\n    float r1 = fract(sin(dot(fragCoord, vec2(12.9898, 78.233))) * 43758.5453);\n    float r2 = fract(sin(dot(fragCoord, vec2(93.9898, 67.345))) * 24634.6345);\n    return (r1 + r2 - 1.0) / 255.0;\n}\n\nvoid main() {\n    vec3 n = normalize(v_normal);\n    vec3 v = normalize(v_viewPosition);\n    vec3 r = reflect(-v, n);\n\n    vec3 env = computeEnvDeep(r);\n\n    \n    env = (env * (2.51 * env + 0.03)) /\n        (env * (2.43 * env + 0.59) + 0.14);\n\n    vec4 outColor = linearToOutputTexel(vec4(env, 1.0));\n    outColor.rgb += vec3(triDither(gl_FragCoord.xy));\n    gl_FragColor = outColor;\n}",uniforms:{},side:tn.FrontSide,transparent:!1,depthTest:!1,depthWrite:!1})),this.renderOrder=999,this.visible=!1,tW.scene.children.includes(tW.camera)||tW.scene.add(tW.camera),tW.camera.add(this),this.#e=tW.subscribe(this.#C.bind(this)),this.#C()}#C(){if(!tW.camera)return;let e=tW.camera.fov*Math.PI/180,t=tW.camera.aspect,n=tr.LOCAL_Z,r=n*Math.tan(e/2),i=r*tr.RADIUS_NDC_Y,a=tr.ANCHOR_X_NDC*(r*t-i),o=tr.ANCHOR_Y_NDC*(r-i);this.position.set(a,o,-n),this.scale.setScalar(i)}dispose(){this.#e?.(),this.parent?.remove(this),this.geometry.dispose(),this.material.dispose()}}let ti=new Set(["/pqc","/golden-eagle","/cryptellum"]),ta="spheres",to={name:ta,radius:1.68},ts=14e-5,tl=42e-5,tu=1e-4,tc=-38e-5,td=14e-5,th=-14e-5,tf=["compactSphere","sphere","mobius","spiral","cubes","sphere","compactSphere"],tp=new a.Vector3,tm={asse
342ss:0,design:1,build:2},tv=Object.keys(tm),tg=()=>({background:!1,bubble:!1,envPreview:!1,spheres:[],spherePhase:0,spherePhaseFromHost:!1,particles:!1});function t_(e,t){let n=e.length>1&&e.endsWith("/")?e.slice(0,-1):e;if("/"===n)return{...tg(),background:!0,bubble:!0,spheres:[ta],spherePhaseFromHost:!0,particles:!0};if(ti.has(n))return{...tg(),background:!0,particles:!0,spherePhaseFromHost:!0};if("/webgl"!==n)return{...tg(),background:!0};let r=new URLSearchParams(t).get("model");if(!r?.trim())return{...tg(),background:!0};let i=r.split(",").map(e=>e.trim().toLowerCase()).filter(Boolean),a=i.includes("bubble"),o=i.includes("env")||i.includes("envpreview"),s=i.includes("spheres")||i.includes("all")||tv.some(e=>i.includes(e)),l=new URLSearchParams(t).get("phase"),u=0;if(null!=l&&""!==l){let e=Number(l);Number.isFinite(e)&&(u=Math.max(0,Math.min(2,e)))}else{let e=i.includes("spheres")||i.includes("all"),t=tv.filter(e=>i.includes(e));e||1!==t.length||(u=tm[t[0]])}return{background:!0,bubble:a,envPreview:o,spheres:s?[ta]:[],spherePhase:u,particles:i.includes("particles")}}class tS extends a.Scene{#y=null;#A=0;#L=0;#D=0;#P=0;#N=0;#U=0;#I=null;#F=null;constructor({isActive:e=()=>!0}={}){super(),this.isActive=e,this.disposed=!1,this.load()}#O(){return tG()}#B(){let{pathname:e,search:t}=this.#O();`${e}?${t}`!==this.#F&&this.syncWebglQueryObjects()}async #G(){if(this.assets?.sphere&&this.assets?.curves)return;if(this.#I)return this.#I;let e={};if(i.assets?.sphere&&!this.assets?.sphere&&(e.sphere=i.assets.sphere),i.assets?.curves&&!this.assets?.curves&&(e.curves=i.assets.curves),Object.keys(e).length)return this.#I=(async()=>{let t=await eu(e);this.disposed||!this.isActive()?eh(t):Object.assign(this.assets,t)})().finally(()=>{this.#I=null}),this.#I}async load(){this.assets={};let{pathname:e,search:t}=this.#O(),{spheres:n}=t_(e,t);if(n.length?await this.#G():await Promise.resolve(),this.disposed||!this.isActive()){eh(this.assets),this.assets=null;return}i.setWebgl&&(0,i.setWebgl)({loaded:!0}),this.create()}create(){this.syncWebglQueryObjects()}syncWebglQueryObjects(){if(!this.assets)return;let{pathname:e,search:t}=this.#O();this.#F=`${e}?${t}`;let{background:n,bubble:r,envPreview:i,spheres:a,spherePhase:o,spherePhaseFromHost:s,particles:l}=t_(e,t);this._spherePhaseFromHost=s,s||(this.#y=null,this.#U=0,this.#A=0,this.#L=0,this.#D=0,this.#P=0,this.#N=0),n&&!this.background&&(this.background=new em),!n&&this.background&&(this.background.dispose(),this.background=null),r&&!this.bubble&&(this.bubble=new ew,s&&(this.bubble.visible=!1),s&&(this.haloBackdrop=new eD)),!r&&this.bubble&&(this.bubble.dispose(),this.bubble=null,this.haloBackdrop?.dispose(),this.haloBackdrop=null),i&&!this.envPreview&&(this.envPreview=new tr),!i&&this.envPreview&&(this.envPreview.dispose(),this.envPreview=null),this.spheres||(this.spheres={});let u=new Set(a);for(let e of Object.keys(this.spheres))u.has(e)||(this.spheres[e].dispose(),delete this.spheres[e]);for(let e of(a.length&&!(this.assets?.sphere&&this.assets?.curves)&&this.#G().then(()=>{!this.disposed&&this.isActive()&&this.syncWebglQueryObjects()}),a))if(!this.spheres[e]&&this.assets?.sphere){let t=this.assets.sphere,n=this.assets?.curves??null;this.spheres[e]=new ez({...to,model:t,curvesMap:n})}let c=this.spheres[ta];c&&(c.position.set(0,0,0),c.scale.setScalar(1),c.layoutMotion.position.set(0,0,0),c.layoutMotion.rotation.set(0,0,0),c.layoutMotion.scale.setScalar(1),c.layoutScale.position.set(0,0,0),c.layoutScale.rotation.set(0,0,0),c.layoutScale.scale.setScalar(1),s||c.setPhase?.(o));let d=s&&a.length>0,h=d?c?.layoutMotion??null:null;if(this.particles){let e=this.particles.parent,t=d&&h&&e!==h,n=!d&&e&&e!==this&&e!==tW.scene;(!l||t||n)&&(this.particles.dispose(),this.particles=null)}l&&!this.particles&&(!d||h)&&(this.particles=new te({attachTo:h,attachToScene:!h}),s&&(this.particles.simPaused=!0,this.particles.mesh.visible=!1,this.particles.scrollDrivenRest=!0)),this.#H()}#H(){if(!this._spherePhaseFromHost||!i.webglHomeRef)return void this.#k(0);let e=this.spheres?.[ta],t=Number(i.webglHomeRef.tigerTeamScroll01),n=Number.isFinite(t)&&t>0,r=Number(i.webglHomeRef.researchScroll01),a=Number.isFinite(r)&&r>0,o=tW.viewSize?.w??2,s=tW.viewSize?.h??2;if(e){let t=Number(i.webglHomeRef.spherePhase);Number.isFinite(t)&&e.setPhase(t),e.layoutMotion.position.z=0,e.layoutMotion.position.y=0;let n=Number(i.webglHomeRef.sphereLayoutXFrac);e.layoutMotion.position.x=Number.isFinite(n)?o*n:0;let r=Number(i.webglHomeRef.sphereLayoutBlend),l=Number.isFinite(r)?Math.max(0,Math.min(1,r)):0,u=Number(i.webglHomeRef.sphereLayoutYFrac),c=Number.isFinite(u)?u:0;e.layoutScale.position.y=-(.75*s)*l+s*c;let d=Number(i.webglHomeRef.sphereLayoutScale);e.layoutScale.scale.setScalar(Number.isFinite(d)?d:1);let h=Number(i.webglHomeRef.sphereLayoutOpacity);e.sphere&&Number.isFinite(h)&&(e.sphere.layoutOpacity=Math.max(0,Math.min(1,h)),e.sphere.outerShellOpacity=+!a,e.sphere.syncLayoutOpacity?.());let f=1-l,p=f*f*(3-2*f);e.layoutScale.rotation.set(this.#A+this.#P+-.95*p,this.#L,this.#D+this.#N+-.2*p)}if(this.bubble){let e=Number.isFinite(i.webglHomeRef.bubbleLayoutYFrac)?i.webglHomeRef.bubbleLayoutYFrac:-1,t=.999>Math.abs(e);this.bubble.visible=t;let n=this._spherePhaseFromHost?.82:1;this.bubble.scale.setScalar(n),t&&(this.bubble.position.y=s*e)}if(this.particles){let t=!!e,r=Number.isFinite(i.webglHomeRef.particlesOpacity)?Math.max(0,Math.min(1,i.webglHomeRef.particlesOpacity)):1,a=n&&r>.001;
342if(this.particles.simPaused=!a,this.particles.mesh.visible=a,this.particles.params.opacity=r,t)this.particles.params.baseColor="#920202",this.particles.params.blending="additive",this.particles.params.glowBoost=2.44,this.particles.params.specStrength=.82;else{let e=i.webglHomeRef.particlesBaseColor;"string"==typeof e&&e&&(this.particles.params.baseColor=e);let t=i.webglHomeRef.particlesBlending;("normal"===t||"additive"===t||"exclusion"===t)&&(this.particles.params.blending=t);let n=Number(i.webglHomeRef.particlesGlowBoost);Number.isFinite(n)&&n>=0&&(this.particles.params.glowBoost=n);let r=Number(i.webglHomeRef.particlesSpecStrength);Number.isFinite(r)&&r>=0&&(this.particles.params.specStrength=r)}let l=Number(i.webglHomeRef.particlesCurlStrength),u=t?.0015:Number.isFinite(l)&&l>=0?l:.0015,c=Number(i.webglHomeRef.particlesMouseRadius),d=t?.18:Number.isFinite(c)&&c>0?c:.18,h=Number(i.webglHomeRef.particlesMouseStrength),f=t?.025:Number.isFinite(h)&&h>=0?h:.025,p=Number(i.webglHomeRef.particlesLeakBreathe);this.particles.params.leakBreathe=t||!(Number.isFinite(p)&&p>0)?0:Math.min(1,p);let m=Number(i.webglHomeRef.particlesRevealProgress);if(this.particles.params.revealProgress=Number.isFinite(m)?Math.max(0,Math.min(1,m)):0,t)this.particles.params.streamFraction=0,this.particles.params.streamShape=0,this.particles.params.streamMode=0,this.particles.params.agitateTint=0,this.particles.params.streamRelease=0,this.particles.params.baseColorDark=this.particles.params.baseColor;else{let e=Number(i.webglHomeRef.particlesStreamFraction);this.particles.params.streamFraction=Number.isFinite(e)&&e>0?Math.min(.5,e):0;let t=Number(i.webglHomeRef.particlesStreamShape);this.particles.params.streamShape=Number.isFinite(t)?Math.max(0,Math.min(1,t)):0;let n=Number(i.webglHomeRef.particlesAgitateTint);this.particles.params.agitateTint=Number.isFinite(n)?Math.max(0,Math.min(1,n)):0;let r=i.webglHomeRef.particlesLeakTint;"string"==typeof r&&r&&(this.particles.params.leakTint=r);let a=i.webglHomeRef.particlesLeakTintDark;"string"==typeof a&&a&&(this.particles.params.leakTintDark=a);let o=i.webglHomeRef.particlesBaseColorDark;this.particles.params.baseColorDark="string"==typeof o&&o?o:this.particles.params.baseColor;let s=i.webglHomeRef.particlesStreamColorDark;"string"==typeof s&&s&&(this.particles.params.streamColorDark=s);let l=Number(i.webglHomeRef.particlesStreamMode);this.particles.params.streamMode=Number.isFinite(l)?Math.max(0,Math.min(1,l)):0;let u=i.webglHomeRef.particlesStreamAxis;Array.isArray(u)&&u.length>=3&&(this.particles.params.streamAxis=u);let c=i.webglHomeRef.particlesStreamColor;"string"==typeof c&&c&&(this.particles.params.streamColor=c);let d=Number(i.webglHomeRef.particlesStreamSize);Number.isFinite(d)&&d>0&&(this.particles.params.streamSize=d);let h=i.webglHomeRef.particlesStreamBlending;("normal"===h||"additive"===h||"exclusion"===h)&&(this.particles.params.streamBlending=h);let f=Number(i.webglHomeRef.particlesStreamRelease);this.particles.params.streamRelease=Number.isFinite(f)?Math.max(0,Math.min(1,f)):0}let v=Number(i.webglHomeRef.particlesLayoutXFrac);Number.isFinite(v)&&(this.particles.position.x=o*v);let g=Number(i.webglHomeRef.particlesLayoutZ),_=t?0:Number.isFinite(g)?g:0,S=Number(i.webglHomeRef.particlesLayoutRollX),x=Number(i.webglHomeRef.particlesLayoutRollY),T=Number(i.webglHomeRef.particlesLayoutRollZ),M=Number.isFinite(S)?S:0,b=Number.isFinite(x)?x:0,E=Number.isFinite(T)?T:0,R=Number(i.webglHomeRef.particlesHeightFrac),w=!t&&Number.isFinite(R)&&R>0;if(w&&!i.webglHomeRef.particlesScrollTumble)Math.abs(this.#A)+Math.abs(this.#L)+Math.abs(this.#D)+Math.abs(this.#P)+Math.abs(this.#N)>1e-4?(this.#A+=(0-this.#A)*.08,this.#L+=(0-this.#L)*.08,this.#D+=(0-this.#D)*.08,this.#P+=(0-this.#P)*.08,this.#N+=(0-this.#N)*.08):(this.#A=0,this.#L=0,this.#D=0,this.#P=0,this.#N=0);else if(w&&i.webglHomeRef.particlesScrollTumble){let e=Number(i.webglHomeRef.particlesTumbleSettle),t=Number.isFinite(e)?Math.max(0,Math.min(1,e)):0,n=this.#U*(1-t);this.#A+=(n*tc-this.#A)*.1,this.#L+=(n*td-this.#L)*.1,this.#D+=(n*th-this.#D)*.1,this.#P+=(0-this.#P)*.1*t,this.#N+=(0-this.#N)*.1*t}!t&&(w||i.webglHomeRef.particlesScrollTumble)?(this.particles.rotation.set(this.#A+this.#P+M,this.#L+b,this.#D+this.#N+E),i.webglHomeRef.particlesRotX=this.particles.rotation.x,i.webglHomeRef.particlesRotY=this.particles.rotation.y,i.webglHomeRef.particlesRotZ=this.particles.rotation.z):this.particles.rotation.set(0,0,0),this.particles.position.z=_;let C=t?0:Number(i.webglHomeRef.particlesHeightFrac),y=Number(i.webglHomeRef.particlesDotScale),A=t?1:Number.isFinite(y)&&y>0?y:1;if(!t&&Number.isFinite(C)&&C>0){let e=s*C/2/Math.max(1e-6,.35*(this.particles.params.restScales?.sphere??1));this.particles.scale.setScalar(e);let t=(tW.vp?.w??1024)<768,n=Math.min(1,C/.88),r=t?Math.min(1,.32+.48*n):1;this.particles.params.particleSize=A*r/e,this.particles.params.drawFraction=t?Math.min(1,Math.max(.58,.42+.38*n)):1,this.particles.params.curlStrength=u/e,this.particles.params.mouseRadius=d/e,this.particles.params.mouseStrength=f/e,this.particles.params.speedFloor=.024/e,this.particles.params.speedToLight=.043/e}else this.particles.scale.setScalar(1),this.particles.params.particleSize=A,this.particles.params.curlStrength=u,this.particles.params.mouseRadius=d,this.particles.params.mouseStrength=f,this.particles.params.speedFloor=.024,this.particles.params.speedToLight=.043,this.particles.params.drawFraction=1;if(a&&this.particles.scrollDrivenRest){let e=Number(i.webglHomeRef.particlesRestScrollU);if(Number.isFinite(e)){let n=t?null:i.webglHomeRef.particlesRestSlots,r=Array.isArray(n)&&n.length>=2?n:tf;this.particles.applyRestScroll(e,r,{ease:!1})}}}this.#k(r)}#k(e){let t,n=Number(e),r=Number(i.webglHomeRef?.bubbleLayoutYFrac),a=Number.isFinite(r)&&.92>Math.abs(r),o=Math.max((t=Math.max(0,Math.min(1,Number.isFinite(n)?n:0)))<=0?0:t<.2?t/.2:t<.8?1:Math.max(0,1-(t-.8)/.19999999999999996),a&&.45>Math.abs(r)?.75:0),s=this._spherePhaseFromHost&&i.webglHomeRef&&a?.55*o:0;if(!this.haloBackdrop)return;if(s<=1e-4)return void this.haloBackdrop.sync({worldPosition:tp.set(0,0,0),diameter:0,strength:0});let l=this.bubble?.visible?this.bubble.scale.x:.82;if(this.bubble?.visible)this.bubble.getWorldPosition(tp);else{let e=tW.viewSize?.h??2;tp.set(0,r*e,0)}this.haloBackdrop.sync({worldPosition:tp,diameter:1.8*l*1.32,strength:s})}render(){this.#B(),this.#H()}resize(){this.#H()}onScroll({scroll:e,velocity:t}={}){if(!this._spherePhaseFromHost)return;let n=Number(e);
342if(Number.isFinite(n)){if(null!=this.#y){let e=!!this.spheres?.[ta],t=Number(i.webglHomeRef?.particlesHeightFrac),r=!e&&Number.isFinite(t)&&t>0&&!i.webglHomeRef?.particlesScrollTumble;if(!e&&i.webglHomeRef?.particlesScrollTumble)this.#U=n;else if(!r){let e=n-this.#y;this.#A+=e*ts,this.#L+=e*tl,this.#D+=e*tu}}this.#y=n}let r=Number(t);if(Number.isFinite(r)){let e=!!this.spheres?.[ta],t=Number(i.webglHomeRef?.particlesHeightFrac),n=!e&&Number.isFinite(t)&&t>0&&!i.webglHomeRef?.particlesScrollTumble?0:Math.max(-.05,Math.min(.05,5e-5*r));this.#P+=(n-this.#P)*.07,this.#N+=(-(.55*n)-this.#N)*.07}this.#H()}dispose(){if(this.disposed=!0,this.background?.dispose?.(),this.background=null,this.bubble?.dispose?.(),this.bubble=null,this.haloBackdrop?.dispose?.(),this.haloBackdrop=null,this.envPreview?.dispose?.(),this.envPreview=null,this.particles?.dispose?.(),this.particles=null,this.spheres){for(let e of Object.values(this.spheres))e.dispose();this.spheres=null}for(let e of[...this.children])ec(e);eh(this.assets),this.assets=null}}let tx={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
343
344		varying vec2 vUv;
345
346		void main() {
347
348			vUv = uv;
349			gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
350
351		}`,fragmentShader:`
352
353		uniform float opacity;
354
355		uniform sampler2D tDiffuse;
356
357		varying vec2 vUv;
358
359		void main() {
360
361			vec4 texel = texture2D( tDiffuse, vUv );
362			gl_FragColor = opacity * texel;
363
364
365		}`};class tT extends eS{constructor(e,t="tDiffuse"){super(),this.textureID=t,this.uniforms=null,this.material=null,e instanceof n.ShaderMaterial?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=n.UniformsUtils.clone(e.uniforms),this.material=new n.ShaderMaterial({name:void 0!==e.name?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this._fsQuad=new eb(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this._fsQuad.material=this.material,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)),this._fsQuad.render(e)}dispose(){this.material.dispose(),this._fsQuad.dispose()}}class tM extends eS{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){let r,i,a=e.getContext(),o=e.state;o.buffers.color.setMask(!1),o.buffers.depth.setMask(!1),o.buffers.color.setLocked(!0),o.buffers.depth.setLocked(!0),this.inverse?(r=0,i=1):(r=1,i=0),o.buffers.stencil.setTest(!0),o.buffers.stencil.setOp(a.REPLACE,a.REPLACE,a.REPLACE),o.buffers.stencil.setFunc(a.ALWAYS,r,0xffffffff),o.buffers.stencil.setClear(i),o.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),o.buffers.color.setLocked(!1),o.buffers.depth.setLocked(!1),o.buffers.color.setMask(!0),o.buffers.depth.setMask(!0),o.buffers.stencil.setLocked(!1),o.buffers.stencil.setFunc(a.EQUAL,1,0xffffffff),o.buffers.stencil.setOp(a.KEEP,a.KEEP,a.KEEP),o.buffers.stencil.setLocked(!0)}}class tb extends eS{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class tE{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),void 0===t){const r=e.getSize(new n.Vector2);this._width=r.width,this._height=r.height,(t=new n.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:n.HalfFloatType})).texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new tT(tx),this.copyPass.material.blending=n.NoBlending,this.timer=new n.Timer}swapBuffers(){let e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){let t=this.passes.indexOf(e);-1!==t&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}
365render(e){this.timer.update(),void 0===e&&(e=this.timer.getDelta());let t=this.renderer.getRenderTarget(),n=!1;for(let t=0,r=this.passes.length;t<r;t++){let r=this.passes[t];if(!1!==r.enabled){if(r.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(t),r.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),r.needsSwap){if(n){let t=this.renderer.getContext(),n=this.renderer.state.buffers.stencil;n.setFunc(t.NOTEQUAL,1,0xffffffff),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),n.setFunc(t.EQUAL,1,0xffffffff)}this.swapBuffers()}void 0!==tM&&(r instanceof tM?n=!0:r instanceof tb&&(n=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(void 0===e){let t=this.renderer.getSize(new n.Vector2);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,(e=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;let n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget1.setSize(n,r),this.renderTarget2.setSize(n,r);for(let e=0;e<this.passes.length;e++)this.passes[e].setSize(n,r)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}class tR extends eS{constructor(e,t,r=null,i=null,a=null){super(),this.scene=e,this.camera=t,this.overrideMaterial=r,this.clearColor=i,this.clearAlpha=a,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.isRenderPass=!0,this._oldClearColor=new n.Color}render(e,t,n){let r,i,a=e.autoClear;e.autoClear=!1,null!==this.overrideMaterial&&(i=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),null!==this.clearColor&&(e.getClearColor(this._oldClearColor),e.setClearColor(this.clearColor,e.getClearAlpha())),null!==this.clearAlpha&&(r=e.getClearAlpha(),e.setClearAlpha(this.clearAlpha)),!0==this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),!0===this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),null!==this.clearColor&&e.setClearColor(this._oldClearColor),null!==this.clearAlpha&&e.setClearAlpha(r),null!==this.overrideMaterial&&(this.scene.overrideMaterial=i),e.autoClear=a}}let tw={name:"AfterimageShader",uniforms:{damp:{value:.96},tOld:{value:null},tNew:{value:null}},vertexShader:`
366
367		varying vec2 vUv;
368
369		void main() {
370
371			vUv = uv;
372			gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
373
374		}`,fragmentShader:`
375
376		uniform float damp;
377
378		uniform sampler2D tOld;
379		uniform sampler2D tNew;
380
381		varying vec2 vUv;
382
383		vec4 when_gt( vec4 x, float y ) {
384
385			return max( sign( x - y ), 0.0 );
386
387		}
388
389		void main() {
390
391			vec4 texelOld = texture2D( tOld, vUv );
392			vec4 texelNew = texture2D( tNew, vUv );
393
394			texelOld *= damp * when_gt( texelOld, 0.1 );
395
396			gl_FragColor = max(texelNew, texelOld);
397
398		}`};class tC extends eS{constructor(e=.96){super(),this.uniforms=n.UniformsUtils.clone(tw.uniforms),this.damp=e,this.compFsMaterial=new n.ShaderMaterial({uniforms:this.uniforms,vertexShader:tw.vertexShader,fragmentShader:tw.fragmentShader}),this.copyFsMaterial=new n.ShaderMaterial({uniforms:n.UniformsUtils.clone(tx.uniforms),vertexShader:tx.vertexShader,fragmentShader:tx.fragmentShader,blending:n.NoBlending,depthTest:!1,depthWrite:!1}),this._textureComp=new n.WebGLRenderTarget(window.innerWidth,window.innerHeight,{magFilter:n.NearestFilter,type:n.HalfFloatType,depthBuffer:!1}),this._textureOld=new n.WebGLRenderTarget(window.innerWidth,window.innerHeight,{magFilter:n.NearestFilter,type:n.HalfFloatType,depthBuffer:!1}),this._compFsQuad=new eb(this.compFsMaterial),this._copyFsQuad=new eb(this.copyFsMaterial)}get damp(){return this.uniforms.damp.value}set damp(e){this.uniforms.damp.value=e}render(e,t,n){this.uniforms.tOld.value=this._textureOld.texture,this.uniforms.tNew.value=n.texture,e.setRenderTarget(this._textureComp),this._compFsQuad.render(e),this._copyFsQuad.material.uniforms.tDiffuse.value=this._textureComp.texture,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear()),this._copyFsQuad.render(e);let r=this._textureOld;this._textureOld=this._textureComp,this._textureComp=r}setSize(e,t){this._textureComp.setSize(e,t),this._textureOld.setSize(e,t)}dispose(){this._textureComp.dispose(),this._textureOld.dispose(),this.compFsMaterial.dispose(),this.copyFsMaterial.dispose(),this._compFsQuad.dispose(),this._copyFsQuad.dispose()}}let ty="uniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\n\nin vec3 position;\nin vec2 uv;\n\nout vec2 vUv;\n\nvoid main() {\n  vUv = uv;\n  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0
398);\n}",tA={minFilter:n.LinearFilter,magFilter:n.LinearFilter,format:n.RGBAFormat,type:n.HalfFloatType,wrapS:n.ClampToEdgeWrapping,wrapT:n.ClampToEdgeWrapping,depthBuffer:!1,stencilBuffer:!1};function tL(e,t){let r=new n.WebGLRenderTarget(e,t,tA);return r.texture.generateMipmaps=!1,r}class tD extends eS{constructor({strength:e=.45,radius:t=.55,threshold:r=.78,softKnee:i=.55,clamp:a=12,tint:o=[1,1,1]}={}){super(),this.strength=e,this.radius=t,this.threshold=r,this.softKnee=i,this.clamp=a,this.tint=new n.Vector3().fromArray(o),this.needsSwap=!0,this.enabled=!0,this._size=new n.Vector2(1,1),this._mipSizes=[],this._mipRTs=[],this._tmpRTs=[];for(let e=0;e<4;++e)this._mipSizes.push(new n.Vector2(1,1)),this._mipRTs.push(tL(1,1)),this._tmpRTs.push(tL(1,1));this._extractMaterial=new n.RawShaderMaterial({glslVersion:n.GLSL3,vertexShader:ty,fragmentShader:"precision highp float;\nvec4 LinearTosRGB(in vec4 value) {\n  return vec4(\n    mix(\n      pow(value.rgb, vec3(0.41666)) * 1.055 - vec3(0.055),\n      value.rgb * 12.92,\n      vec3(lessThanEqual(value.rgb, vec3(0.0031308)))\n    ),\n    value.a\n  );\n}\n\nvec4 sRGBToLinear(in vec4 value) {\n  return vec4(\n    mix(\n      pow(value.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)),\n      value.rgb * 0.0773993808,\n      vec3(lessThanEqual(value.rgb, vec3(0.04045)))\n    ),\n    value.a\n  );\n}\n\nvec4 linearToOutputTexel(in vec4 value) {\n  return LinearTosRGB(value);\n}\n\nuniform sampler2D tDiffuse;\nuniform float u_threshold;  \nuniform float u_softKnee;   \nuniform float u_clamp;      \n\nin vec2 vUv;\nout vec4 fragColor;\n\nvoid main() {\n  vec3 srgb = texture(tDiffuse, vUv).rgb;\n  vec3 lin = sRGBToLinear(vec4(srgb, 1.0)).rgb;\n\n  float brightness = max(max(lin.r, lin.g), lin.b);\n\n  float knee = u_threshold * u_softKnee + 1e-5;\n  float soft = brightness - u_threshold + knee;\n  soft = clamp(soft, 0.0, 2.0 * knee);\n  soft = (soft * soft) / (4.0 * knee + 1e-5);\n\n  float contribution = max(soft, brightness - u_threshold);\n  contribution /= max(brightness, 1e-5);\n\n  vec3 outColor = min(lin * contribution, vec3(u_clamp));\n  fragColor = vec4(outColor, 1.0);\n}",uniforms:{tDiffuse:{value:null},u_threshold:{value:this.threshold},u_softKnee:{value:this.softKnee},u_clamp:{value:this.clamp}},depthTest:!1,depthWrite:!1}),this._blurMaterial=new n.RawShaderMaterial({glslVersion:n.GLSL3,vertexShader:ty,fragmentShader:"precision highp float;\n\nuniform sampler2D tDiffuse;\nuniform vec2 u_direction;   \nuniform vec2 u_invSize;     \n\nin vec2 vUv;\nout vec4 fragColor;\n\nconst float w0 = 0.2270;\nconst float w1 = 0.1945;\nconst float w2 = 0.1216;\nconst float w3 = 0.0541;\nconst float w4 = 0.0162;\n\nvoid main() {\n  vec2 stepUv = u_direction * u_invSize;\n\n  vec3 c = texture(tDiffuse, vUv).rgb * w0;\n  c += texture(tDiffuse, vUv + stepUv * 1.0).rgb * w1;\n  c += texture(tDiffuse, vUv - stepUv * 1.0).rgb * w1;\n  c += texture(tDiffuse, vUv + stepUv * 2.0).rgb * w2;\n  c += texture(tDiffuse, vUv - stepUv * 2.0).rgb * w2;\n  c += texture(tDiffuse, vUv + stepUv * 3.0).rgb * w3;\n  c += texture(tDiffuse, vUv - stepUv * 3.0).rgb * w3;\n  c += texture(tDiffuse, vUv + stepUv * 4.0).rgb * w4;\n  c += texture(tDiffuse, vUv - stepUv * 4.0).rgb * w4;\n\n  fragColor = vec4(c, 1.0);\n}",uniforms:{tDiffuse:{value:null},u_direction:{value:new n.Vector2(1,0)},u_invSize:{value:new n.Vector2(1,1)}},depthTest:!1,depthWrite:!1}),this._compositeMaterial=new n.RawShaderMaterial({glslVersion:n.GLSL3,vertexShader:ty,fragmentShader:"precision highp float;\nvec4 LinearTosRGB(in vec4 value) {\n  return vec4(\n    mix(\n      pow(value.rgb, vec3(0.41666)) * 1.055 - vec3(0.055),\n      value.rgb * 12.92,\n      vec3(lessThanEqual(value.rgb, vec3(0.0031308)))\n    ),\n    value.a\n  );\n}\n\nvec4 sRGBToLinear(in vec4 value) {\n  return vec4(\n    mix(\n      pow(value.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)),\n      value.rgb * 0.0773993808,\n      vec3(lessThanEqual(value.rgb, vec3(0.04045)))\n    ),\n    value.a\n  );\n}\n\nvec4 linearToOutputTexel(in vec4 value) {\n  return LinearTosRGB(value);\n}\n\nuniform sampler2D tDiffuse;\nuniform sampler2D u_mip0;\nuniform sampler2D u_mip1;\nuniform sampler2D u_mip2;\nuniform sampler2D u_mip3;\nuniform float u_strength;\nuniform float u_radius;\nuniform vec3 u_tint;\n\nin vec2 vUv;\nout vec4 fragColor;\n\nfloat mipFactor(float f) {\n  return mix(f, 1.2 - f, u_radius);\n}\n\nvoid main() {\n  vec3 baseSrgb = texture(tDiffuse, vUv).rgb;\n  vec3 base = sRGBToLinear(vec4(baseSrgb, 1.0)).rgb;\n\n  vec3 b0 = texture(u_mip0, vUv).rgb;\n  vec3 b1 = texture(u_mip1, vUv).rgb;\n  vec3 b2 = texture(u_mip2, vUv).rgb;\n  vec3 b3 = texture(u_mip3, vUv).rgb;\n\n  vec3 bloom =\n    mipFactor(1.00) * b0 +\n    mipFactor(0.80) * b1 +\n    mipFactor(0.60) * b2 +\n    mipFactor(0.40) * b3;\n\n  vec3 finalColor = base + bloom * u_tint * u_strength;\n  fragColor = linearToOutputTexel(vec4(finalColor, 1.0));\n}",uniforms:{tDiffuse:{value:null},u_mip0:{value:this._mipRTs[0].texture},u_mip1:{value:this._mipRTs[1].texture},u_mip2:{value:this._mipRTs[2].texture},u_mip3:{value:this._mipRTs[3].texture},u_strength:{value:this.strength},u_radius:{value:this.radius},u_tint:{value:this.tint}},depthTest:!1,depthWrite:!1}),this._quad=new eb(null)}setSize(e,t){this._size.set(e,t);
398let n=Math.max(1,Math.floor(e/2)),r=Math.max(1,Math.floor(t/2));for(let e=0;e<4;++e)this._mipSizes[e].set(n,r),this._mipRTs[e].setSize(n,r),this._tmpRTs[e].setSize(n,r),n=Math.max(1,Math.floor(n/2)),r=Math.max(1,Math.floor(r/2))}render(e,t,n){let r=e.autoClear,i=e.getRenderTarget();e.autoClear=!1,this._extractMaterial.uniforms.tDiffuse.value=n.texture,this._extractMaterial.uniforms.u_threshold.value=this.threshold,this._extractMaterial.uniforms.u_softKnee.value=this.softKnee,this._extractMaterial.uniforms.u_clamp.value=this.clamp,this._quad.material=this._extractMaterial,e.setRenderTarget(this._mipRTs[0]),e.clear(),this._quad.render(e),this._quad.material=this._blurMaterial;for(let t=0;t<4;++t){let n=this._mipRTs[t],r=this._tmpRTs[t],i=this._mipSizes[t];this._blurMaterial.uniforms.u_invSize.value.set(1/i.x,1/i.y),this._blurMaterial.uniforms.tDiffuse.value=n.texture,this._blurMaterial.uniforms.u_direction.value.set(1,0),e.setRenderTarget(r),e.clear(),this._quad.render(e),this._blurMaterial.uniforms.tDiffuse.value=r.texture,this._blurMaterial.uniforms.u_direction.value.set(0,1),e.setRenderTarget(n),e.clear(),this._quad.render(e),t<3&&(this._blurMaterial.uniforms.tDiffuse.value=n.texture,this._blurMaterial.uniforms.u_direction.value.set(0,0),e.setRenderTarget(this._mipRTs[t+1]),e.clear(),this._quad.render(e))}this._compositeMaterial.uniforms.tDiffuse.value=n.texture,this._compositeMaterial.uniforms.u_strength.value=this.strength,this._compositeMaterial.uniforms.u_radius.value=this.radius,this._quad.material=this._compositeMaterial,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),e.clear()),this._quad.render(e),e.setRenderTarget(i),e.autoClear=r}dispose(){for(let e=0;e<4;++e)this._mipRTs[e].dispose(),this._tmpRTs[e].dispose();this._extractMaterial.dispose(),this._blurMaterial.dispose(),this._compositeMaterial.dispose(),this._quad.dispose()}}class tP extends eS{constructor(){super(),this.needsSwap=!0,this._material=new n.RawShaderMaterial({glslVersion:n.GLSL3,vertexShader:ty,fragmentShader:"precision highp float;\n\nuniform sampler2D tDiffuse;\n\nuniform vec4 u_sweep;\n\nuniform vec3 u_lightGain;\n\nin vec2 vUv;\nout vec4 fragColor;\n\nvoid main() {\n  vec4 scene = texture(tDiffuse, vUv);\n  if (u_sweep.w < 0.5) {\n    fragColor = scene;\n    return;\n  }\n  float soft = max(u_sweep.y, 1e-4);\n  float bow = u_sweep.z;\n  float flip = step(1.5, u_sweep.w);\n  float t = mix(u_sweep.x, 1.0 - u_sweep.x, flip);\n  float cx = vUv.x - 0.5;\n  float curve = bow * (1.0 - 4.0 * cx * cx);\n  float edge = mix(-soft - bow, 1.0 + soft, t) + curve;\n  float stepped = smoothstep(edge - soft, edge + soft, vUv.y);\n  float band = mix(1.0 - stepped, stepped, flip);\n  vec3 inverted = (vec3(1.0) - scene.rgb) * u_lightGain;\n  fragColor = vec4(mix(inverted, scene.rgb, band), scene.a);\n}",uniforms:{tDiffuse:{value:null},u_sweep:{value:new n.Vector4(0,.1,.06,0)},u_lightGain:{value:new n.Vector3(1,1,1)}},depthTest:!1,depthWrite:!1}),this._quad=new eb(this._material)}setSweep(e){this._material.uniforms.u_sweep.value.set(Math.max(0,Math.min(1,e.progress)),e.soft,e.bow,e.enabled?e.flip?2:1:0);let t=e.lightGain;Array.isArray(t)&&t.length>=3?this._material.uniforms.u_lightGain.value.set(t[0],t[1],t[2]):this._material.uniforms.u_lightGain.value.set(1,1,1)}render(e,t,n){this._material.uniforms.tDiffuse.value=n.texture,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),e.clear()),this._quad.render(e)}dispose(){this._material.dispose(),this._quad.dispose()}}class tN extends tE{isOn=!0;constructor(){super(tW.renderer),this.renderPass=new tR(tW.scene,tW.camera,null,tk.clearColor,1),this.addPass(this.renderPass),this.afterimage=new tC(.7),this.afterimage.enabled=!1,this.addPass(this.afterimage),this.bloom=new tD,this.bloom.renderToScreen=!1,this.addPass(this.bloom),this.invertSweep=new tP,this.invertSweep.renderToScreen=!0,this.addPass(this.invertSweep)}renderPasses(){if(this.invertSweep?.setSweep(tk.invertSweep),this.afterimage){let e=tk.afterimage;this.afterimage.enabled=!!e.enabled&&e.damp>0,this.afterimage.uniforms.damp.value=Math.max(0,Math.min(.98,e.damp))}}renderPost(e){this.isOn?(this.renderPasses(e),this.render()):tW.renderer.render(tW.scene,tW.camera)}dispose(){super.dispose?.(),this.bloom?.dispose?.(),this.bloom=null,this.afterimage?.dispose?.(),this.afterimage=null,this.invertSweep?.dispose?.(),this.invertSweep=null,this.renderPass=null}}var tU=n;class tI extends tU.Scene{debug=!1;targetSize=[.5*tW.vp.w,.5*tW.vp.h];
398plane=new tU.Mesh(new tU.PlaneGeometry(2,2),new tF);gpu=new eE(...this.targetSize,tW.renderer);_camera=()=>{let e=new tU.OrthographicCamera(-1,1,1,-1,-2,1);return e.position.z=1,e.lookAt(0,0,0),e};_target=()=>{let e=new tU.WebGLRenderTarget(...this.targetSize);return e.texture.generateMipmaps=!1,e.texture.minFilter=e.texture.magFilter=tU.NearestFilter,e.texture.wrapS=e.texture.wrapT=tU.RepeatWrapping,e};constructor(){super(),this.camera=this._camera(),this.target=this._target(),this.add(this.plane),this.init()}init(){this.sim1=function(e,t,n,{texture:r,uniforms:i={}}){let a=e.addVariable(t,n,r||e.createTexture());return e.setVariableDependencies(a,[a]),Object.assign(a.material.uniforms,i),a}(this.gpu,"sim1","#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform float u_time;\nuniform vec4 u_mouse;\nuniform sampler2D u_previous;\n\nconst float DECAY = .99; \nconst float SPEED_MULT = .5; \nconst float NOISE_POW = 0.03; \nconst float MAIN_FLOW = 0.0; \nconst float DIFFUSION_RATE = 0.03; \nconst vec2 INTERACTION_SIZE = vec2(0.01, 0.3); \nconst vec4 MOUSE_COLOR = vec4(1.0, 0., 0.0, 1.0); \n\nvec3 permute(vec3 x) {\n    return mod(((x * 34.0) + 1.0) * x, 289.0);\n}\n\nfloat snoise(vec2 v) {\n    const vec4 C = vec4(0.211324865405187, 0.366025403784439,\n            -0.577350269189626, 0.024390243902439);\n    vec2 i = floor(v + dot(v, C.yy));\n    vec2 x0 = v - i + dot(i, C.xx);\n    vec2 i1;\n    i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n    vec4 x12 = x0.xyxy + C.xxzz;\n    x12.xy -= i1;\n    i = mod(i, 289.0);\n    vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0))\n                + i.x + vec3(0.0, i1.x, 1.0));\n    vec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy),\n                    dot(x12.zw, x12.zw)), 0.0);\n    m = m * m;\n    m = m * m;\n    vec3 x = 2.0 * fract(p * C.www) - 1.0;\n    vec3 h = abs(x) - 0.5;\n    vec3 ox = floor(x + 0.5);\n    vec3 a0 = x - ox;\n    m *= 1.79284291400159 - 0.85373472095314 * (a0 * a0 + h * h);\n    vec3 g;\n    g.x = a0.x * x0.x + h.x * x0.y;\n    g.yz = a0.yz * x12.xz + h.yz * x12.yw;\n    return 130.0 * dot(m, g);\n}\n\nvoid main() {\n    vec2 uv = gl_FragCoord.xy / resolution.xy;\n\n    vec4 previousState = texture2D(u_previous, uv);\n\n    \n    vec4 sum = vec4(0.0);\n    float weight = 0.0;\n    for (float i = -2.0; i <= 2.0; i++) {\n        for (float j = -2.0; j <= 2.0; j++) {\n            vec2 offset = vec2(i, j) / resolution.xy;\n            float w = 1.0 / (length(offset) + 1.0);\n            sum += texture2D(u_previous, uv + offset) * w;\n            weight += w;\n        }\n    }\n\n    vec4 average = sum / weight;\n    float noiseValue = snoise(uv * 3.0 + u_time * 0.05) * NOISE_POW;\n\n    \n    vec2 mousePos = u_mouse.xy * .5 + .5;\n    float mouseSpeed = u_mouse.z * SPEED_MULT;\n    float interactionSize = mix(INTERACTION_SIZE.x, INTERACTION_SIZE.y, mouseSpeed); \n    float mouseInfluence = smoothstep(interactionSize, 0.0, length(uv - mousePos)) * 0.5;\n\n    \n    vec4 diffusedState = mix(previousState, average, DIFFUSION_RATE);\n    vec4 finalState = diffusedState + noiseValue * diffusedState + mouseInfluence * MOUSE_COLOR * (mouseSpeed + 0.1);\n\n    finalState += vec4(snoise(uv * 1.5 + u_time * 0.01) * MAIN_FLOW);\n    finalState *= DECAY;\n    finalState = clamp(finalState, 0.0, 1.0);\n\n    gl_FragColor = vec4(finalState.rgb, 1.0);\n}",{uniforms:{u_time:{value:0},u_mouse:{value:[0,0,0,0]},u_previous:{value:null}}}),this.gpu.init()}get _sim1(){return this.gpu.getCurrentRenderTarget(this.sim1).texture}render(e){this.plane.material.time=e,this.sim1.material.uniforms.u_previous.value=this._sim1,this.sim1.material.uniforms.u_time.value=e,this.sim1.material.uniforms.u_mouse.value=[tW.mouse.ex,tW.mouse.ey,tW.mouse.espeed,0],this.gpu.compute(),this.plane.material.uniforms.u_texture.value=this._sim1,this.debug&&(tW.renderer.setRenderTarget(this.target),tW.renderer.render(this,this.camera),tW.renderer.setRenderTarget(null))}dispose(){this.gpu?.dispose?.(),this.target?.dispose?.(),ec(this),this.gpu=null,this.target=null,this.plane=null,this.camera=null}}class tF extends tU.RawShaderMaterial{constructor(){super({fragmentShader:"precision mediump float;\n\nvec4 LinearTosRGB(in vec4 value) {\n  return vec4(\n    mix(\n      pow(value.rgb, vec3(0.41666)) * 1.055 - vec3(0.055),\n      value.rgb * 12.92,\n      vec3(lessThanEqual(value.rgb, vec3(0.0031308)))\n    ),\n    value.a\n  );\n}\n\nvec4 sRGBToLinear(in vec4 value) {\n  return vec4(\n    mix(\n      pow(value.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)),\n      value.rgb * 0.0773993808,\n      vec3(lessThanEqual(value.rgb, vec3(0.04045)))\n    ),\n    value.a\n  );\n}\n\nvec4 linearToOutputTexel(in vec4 value) {\n  return LinearTosRGB(value);\n}\n\nuniform float u_time;\nuniform vec4 u_mouse;\nuniform sampler2D u_texture;\nuniform sampler2D u_previous;\n\nvarying vec2 v_uv;\n\nvoid main() {\n    \n\n    vec3 position = texture2D(u_texture, v_uv).rgb;\n\n    gl_FragColor.rgb = position.rgb;\n    gl_FragColor.a = 1.;\n}",vertexShader:"#define MPI 3.1415926535897932384626433832795\n\nattribute vec3 position;\nattribute vec2 uv;\n\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat3 normalMatrix;\n\nuniform float u_time;\n\nvarying vec2 v_uv;\n\nvoid main() {\n    vec3 pos = position;\n    gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0
398);\n    v_uv = uv;\n}",uniforms:{u_time:{value:0},u_mouse:{value:[0,0,0,0]},u_texture:{value:null},u_previous:{value:null}}})}set time(e){this.uniforms.u_time.value=e}}let tO=e=>e&&e.length>1&&e.endsWith("/")?e.slice(0,-1):e,tB={pathname:"",search:""};function tG(){if(!("u">typeof document))return tB.pathname="",tB.search="",tB;let e=tO(window.location.pathname),t=tW._routeOverride;if(t){if(t.pathname!==e&&t.fromPathname===e)return tB.pathname=t.pathname,tB.search=t.search,tB;tW._routeOverride=null}return tB.pathname=e,tB.search=window.location.search.replace(/^\?/,""),tB}let tH=()=>({x:1,y:1,hx:1,hy:1,ex:0,ey:0,speed:0,espeed:0}),tk={clearColor:398882,backgroundSweep:null,afterimage:{enabled:!1,damp:.7},invertSweep:{enabled:!1,progress:0,soft:.1,bow:.06,lightGain:null,flip:!1}};class tV{subscribers=[];paused=!1;time=0;simDtScale=1;_lastSimFrameTimeMs=null;_lastRenderMs=null;_lastInputMs=0;mouse=tH();_runId=0;_routeOverride=null;start(e){if(!("u">typeof document)||!e)return;this.renderer&&this.destroy();let r=++this._runId;this.resetRunState(),this.renderer=new t.WebGLRenderer({alpha:!1,antialias:!1,powerPreference:"low-power"}),this.vp={container:e,w:window.innerWidth,h:window.innerHeight,aspect:()=>this.vp.w/this.vp.h,dpr:()=>Math.min(window.devicePixelRatio,2)},this.renderer.setPixelRatio(this.vp.dpr()),this.renderer.setSize(this.vp.w,this.vp.h),this.renderer.setClearColor(tk.clearColor,1),this.vp.container.appendChild(this.renderer.domElement),this.camera=new n.PerspectiveCamera(55,this.vp.aspect(),1e-4,100),this.camera.position.set(0,0,2),this.setRouteDebugToolsEnabled("/webgl"===tO(tG().pathname)),this._renderBound=this.render.bind(this),this._mouseBound=this.onMouseMove.bind(this),this._scrollBound=this.onScroll.bind(this),this._resizeBound=this.resize.bind(this),this.init(r),this.resize(),i.Scroll&&i.Scroll.setGlPixelRatio(this.vp.px),this.evt=this._evt()}setRouteDebugToolsEnabled(e){if(this.routeDebugToolsEnabled=!!e,!this.routeDebugToolsEnabled){this.paused&&("u"<typeof document||!document.hidden)&&(this.paused=!1),this.controls?.dispose?.(),this.controls=null;return}this.loadOrbitControls()}loadOrbitControls(){if(!("u">typeof document)||!this.camera||!this.renderer||this.controls)return;let t=this._runId;this._controlsImportPromise??=e.A(48383),this._controlsImportPromise.then(({OrbitControls:e})=>{this.routeDebugToolsEnabled&&this._runId===t&&this.camera&&this.renderer&&!this.controls&&(this.controls=new e(this.camera,document.body),this.controls.enabled=!1)}).catch(e=>{this._controlsImportPromise=null,console.warn("OrbitControls import failed",e)})}_evt(){var e,t;let n;return[(e=document.body,t=this._mouseBound,n=e=>t(e,tz(e)),document.addEventListener("mousemove",n),()=>{document.removeEventListener("mousemove",n)}),i.Scroll?i.Scroll.add(this._scrollBound):()=>{},function(e){function t(t){!(!e.routeDebugToolsEnabled||function(e){if(!e)return!1;let t=e.tagName;return"INPUT"===t||"TEXTAREA"===t||"SELECT"===t||!0===e.isContentEditable}(t.target))&&(" "===t.key?e.paused=!e.paused:"o"===t.key?e.controls&&(e.controls.enabled=!e.controls.enabled):"g"===t.key&&i.Gui?i.Gui.show():"p"===t.key&&(tW.paused=!tW.paused))}return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}}(this),i.Resizer?i.Resizer.add(this._resizeBound):()=>{}]}resetRunState(){this.subscribers=[],this.paused=!1,this.time=0,this.simDtScale=1,this._lastSimFrameTimeMs=null,this._lastRenderMs=null,this._lastInputMs=0,this.mouse=tH(),this.controls=null,this._routeOverride=null,this.routeDebugToolsEnabled=!1,this.post=null,this.screen=null,this.scene=null,this.evt=void 0}async init(e){this.scene=new tS({isActive:()=>this._runId===e&&!!this.renderer}),this.screen=new tI,this.post=new tN,i.gsap&&i.gsap.ticker.add(this._renderBound)}render(){if(this.paused||!i.lerp||!this.renderer||!this.scene||!this.post)return;let e="u">typeof performance?performance.now():null,t=1;if(null!=e){if(e-this._lastInputMs>250&&null!=this._lastRenderMs&&e-this._lastRenderMs<15.166666666666668)return;if(this._lastRenderMs=e,null!=this._lastSimFrameTimeMs){let n=Math.max(1e-6,(e-this._lastSimFrameTimeMs)/1e3);this.simDtScale=Math.min(4,n/.008333333333333333),t=Math.min(4,60*n)}else this.simDtScale=1;this._lastSimFrameTimeMs=e}else this.simDtScale=1;this.time+=.05*t,this.mouse.ex=(0,i.lerp)(this.mouse.ex,this.mouse.x,.1),this.mouse.ey=(0,i.lerp)(this.mouse.ey,this.mouse.y,.1),this.mouse.espeed=(0,i.lerp)(this.mouse.espeed,this.mouse.speed,.1),this.controls?.update(
398),this.screen?.debug&&this.screen.render(this.time),this.scene?.render(this.time),this.subscribers.forEach(e=>e.cb(this.time)),this.screen?.debug?this.renderer.render(this.screen,this.screen.camera):this.post.renderPost(this.time)}resize({width:e,height:t}={width:window.innerWidth,height:window.innerHeight}){this.vp&&this.renderer&&this.camera&&(this.vp.w=e,this.vp.h=t,this.vp.viewSize=this.viewSize,this.vp.px=this.pixel,this.renderer.setSize(this.vp.w,this.vp.h),this.camera.aspect=this.vp.aspect(),this.camera.updateProjectionMatrix(),this.post?.setSize(this.vp.w,this.vp.h),i.Scroll&&i.Scroll.setGlPixelRatio(this.vp.px),this.scene?.resize())}onMouseMove({clientX:e,clientY:t},n){!this.vp||(this.#V(),i.Resizer?.isMobile||(this.mouse.x=e/this.vp.w*2-1,this.mouse.y=-(2*(t/this.vp.h))+1,this.mouse.hx=e-this.vp.w/2,this.mouse.hy=t-this.vp.h/2,this.mouse.speed=.75*n))}onScroll({velocity:e,scroll:t,direction:n,progress:r}){this.#V(),this.scene?.onScroll({velocity:e,scroll:t,direction:n,progress:r})}#V(){"u">typeof performance&&(this._lastInputMs=performance.now())}setClearColor(e,t=1){tk.clearColor=e,this.renderer?.setClearColor(e,t),tk.backgroundSweep||this.scene?.background?.material?.uniforms?.u_color?.value?.setHex?.(e),this.post?.renderPass&&(this.post.renderPass.clearColor=e)}resetClearColor(){this.setClearColor(398882)}setBackgroundSweep(e,t,n){let r=Math.max(0,Math.min(1,n)),i=tk.backgroundSweep;i&&i.from===e&&i.to===t&&i.progress===r||(tk.backgroundSweep={from:e,to:t,progress:r},this.scene?.background?.setSweep?.(e,t,r))}resetBackgroundSweep(){tk.backgroundSweep=null,this.scene?.background?.resetSweep?.()}setInvertSweep(e,{soft:t,bow:n,lightGain:r,flip:i}={}){let a=tk.invertSweep;a.enabled=!0,a.progress=Math.max(0,Math.min(1,e)),a.flip=!!i,"number"==typeof t&&(a.soft=t),"number"==typeof n&&(a.bow=n),void 0!==r&&(a.lightGain=r)}resetInvertSweep(){tk.invertSweep.enabled=!1,tk.invertSweep.progress=0,tk.invertSweep.flip=!1}setRoute(e,t=""){this._routeOverride={pathname:tO(String(e??"")),search:String(t??"").replace(/^\?/,""),fromPathname:"u">typeof document?tO(window.location.pathname):""},this.scene?.syncWebglQueryObjects?.()}setAfterimage(e){tk.afterimage.enabled=e>0,tk.afterimage.damp=e}resetAfterimage(){tk.afterimage.enabled=!1}destroy(){this._runId+=1,this._routeOverride=null,this.routeDebugToolsEnabled=!1,i.gsap&&this._renderBound&&i.gsap.ticker.remove(this._renderBound),this.evt?.forEach(e=>e()),this.evt=void 0;let e=this.renderer?.domElement;this.vp?.container&&e&&(e.parentNode===this.vp.container&&this.vp.container.removeChild(e),e.remove()),this.controls?.dispose?.(),this.post?.dispose?.(),this.screen?.dispose?.(),this.scene?.dispose?.(),this.renderer?.dispose?.();try{this.renderer?.forceContextLoss?.()}catch(e){console.warn("renderer.forceContextLoss failed",e)}this.subscribers=[],this.controls=null,this.post=null,this.screen=null,this.scene=null,this.renderer=null,this.camera=null,this.vp=null,this._renderBound=null,this._mouseBound=null,this._scrollBound=null,this._resizeBound=null}get viewSize(){let e=this.camera.fov*Math.PI/180,t=Math.abs(this.camera.position.z*Math.tan(e/2)*2);return{w:t*(this.vp.w/this.vp.h),h:t}}get pixel(){return(this.viewSize.w/this.vp.w+this.viewSize.h/this.vp.h)/2}subscribe(e,t=0){let n=Symbol();return this.subscribers.push({cb:e,id:n,priority:t}),this.subscribers.sort((e,t)=>e.priority-t.priority),()=>this.unsubscribe(n)}unsubscribe(e){this.subscribers=this.subscribers.filter(t=>t.id!==e)}}let{calculateMouseSpeed:tz}=(0,r.useMouseSpeed)(),tW=new tV;tW.params=tk,"u">typeof document&&(tW.paused=document.hidden,document.addEventListener("visibilitychange",()=>{tW.paused=document.hidden}))}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.