var dk=Object.defineProperty;var pk=(i,e,t)=>e in i?dk(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var kt=(i,e,t)=>pk(i,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function t(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(r){if(r.ep)return;r.ep=!0;const s=t(r);fetch(r.href,s)}})();function bE(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var mM={exports:{}},w0={};/** * @license React * react-jsx-runtime.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var h3;function mk(){if(h3)return w0;h3=1;var i=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(n,r,s){var a=null;if(s!==void 0&&(a=""+s),r.key!==void 0&&(a=""+r.key),"key"in r){s={};for(var l in r)l!=="key"&&(s[l]=r[l])}else s=r;return r=s.ref,{$$typeof:i,type:n,key:a,ref:r!==void 0?r:null,props:s}}return w0.Fragment=e,w0.jsx=t,w0.jsxs=t,w0}var d3;function gk(){return d3||(d3=1,mM.exports=mk()),mM.exports}var H=gk(),gM={exports:{}},vn={};/** * @license React * react.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var p3;function vk(){if(p3)return vn;p3=1;var i=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),a=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),v=Symbol.iterator;function x(k){return k===null||typeof k!="object"?null:(k=v&&k[v]||k["@@iterator"],typeof k=="function"?k:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,S={};function M(k,Z,oe){this.props=k,this.context=Z,this.refs=S,this.updater=oe||b}M.prototype.isReactComponent={},M.prototype.setState=function(k,Z){if(typeof k!="object"&&typeof k!="function"&&k!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,k,Z,"setState")},M.prototype.forceUpdate=function(k){this.updater.enqueueForceUpdate(this,k,"forceUpdate")};function A(){}A.prototype=M.prototype;function D(k,Z,oe){this.props=k,this.context=Z,this.refs=S,this.updater=oe||b}var R=D.prototype=new A;R.constructor=D,w(R,M.prototype),R.isPureReactComponent=!0;var I=Array.isArray;function P(){}var F={H:null,A:null,T:null,S:null},N=Object.prototype.hasOwnProperty;function L(k,Z,oe){var fe=oe.ref;return{$$typeof:i,type:k,key:Z,ref:fe!==void 0?fe:null,props:oe}}function G(k,Z){return L(k.type,Z,k.props)}function X(k){return typeof k=="object"&&k!==null&&k.$$typeof===i}function W(k){var Z={"=":"=0",":":"=2"};return"$"+k.replace(/[=:]/g,function(oe){return Z[oe]})}var q=/\/+/g;function K(k,Z){return typeof k=="object"&&k!==null&&k.key!=null?W(""+k.key):Z.toString(36)}function ne(k){switch(k.status){case"fulfilled":return k.value;case"rejected":throw k.reason;default:switch(typeof k.status=="string"?k.then(P,P):(k.status="pending",k.then(function(Z){k.status==="pending"&&(k.status="fulfilled",k.value=Z)},function(Z){k.status==="pending"&&(k.status="rejected",k.reason=Z)})),k.status){case"fulfilled":return k.value;case"rejected":throw k.reason}}throw k}function j(k,Z,oe,fe,ve){var se=typeof k;(se==="undefined"||se==="boolean")&&(k=null);var de=!1;if(k===null)de=!0;else switch(se){case"bigint":case"string":case"number":de=!0;break;case"object":switch(k.$$typeof){case i:case e:de=!0;break;case p:return de=k._init,j(de(k._payload),Z,oe,fe,ve)}}if(de)return ve=ve(k),de=fe===""?"."+K(k,0):fe,I(ve)?(oe="",de!=null&&(oe=de.replace(q,"$&/")+"/"),j(ve,Z,oe,"",function(ot){return ot})):ve!=null&&(X(ve)&&(ve=G(ve,oe+(ve.key==null||k&&k.key===ve.key?"":(""+ve.key).replace(q,"$&/")+"/")+de)),Z.push(ve)),1;de=0;var be=fe===""?".":fe+":";if(I(k))for(var Ge=0;Ge>>1,ue=j[le];if(0>>1;ler(oe,he))fer(ve,oe)?(j[le]=ve,j[fe]=he,le=fe):(j[le]=oe,j[Z]=he,le=Z);else if(fer(ve,he))j[le]=ve,j[fe]=he,le=fe;else break e}}return $}function r(j,$){var he=j.sortIndex-$.sortIndex;return he!==0?he:j.id-$.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;i.unstable_now=function(){return s.now()}}else{var a=Date,l=a.now();i.unstable_now=function(){return a.now()-l}}var c=[],h=[],p=1,g=null,v=3,x=!1,b=!1,w=!1,S=!1,M=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function R(j){for(var $=t(h);$!==null;){if($.callback===null)n(h);else if($.startTime<=j)n(h),$.sortIndex=$.expirationTime,e(c,$);else break;$=t(h)}}function I(j){if(w=!1,R(j),!b)if(t(c)!==null)b=!0,P||(P=!0,W());else{var $=t(h);$!==null&&ne(I,$.startTime-j)}}var P=!1,F=-1,N=5,L=-1;function G(){return S?!0:!(i.unstable_now()-Lj&&G());){var le=g.callback;if(typeof le=="function"){g.callback=null,v=g.priorityLevel;var ue=le(g.expirationTime<=j);if(j=i.unstable_now(),typeof ue=="function"){g.callback=ue,R(j),$=!0;break t}g===t(c)&&n(c),R(j)}else n(c);g=t(c)}if(g!==null)$=!0;else{var k=t(h);k!==null&&ne(I,k.startTime-j),$=!1}}break e}finally{g=null,v=he,x=!1}$=void 0}}finally{$?W():P=!1}}}var W;if(typeof D=="function")W=function(){D(X)};else if(typeof MessageChannel<"u"){var q=new MessageChannel,K=q.port2;q.port1.onmessage=X,W=function(){K.postMessage(null)}}else W=function(){M(X,0)};function ne(j,$){F=M(function(){j(i.unstable_now())},$)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(j){j.callback=null},i.unstable_forceFrameRate=function(j){0>j||125le?(j.sortIndex=he,e(h,j),t(c)===null&&j===t(h)&&(w?(A(F),F=-1):w=!0,ne(I,he-le))):(j.sortIndex=ue,e(c,j),b||x||(b=!0,P||(P=!0,W()))),j},i.unstable_shouldYield=G,i.unstable_wrapCallback=function(j){var $=v;return function(){var he=v;v=$;try{return j.apply(this,arguments)}finally{v=he}}}})(xM)),xM}var v3;function kU(){return v3||(v3=1,yM.exports=yk()),yM.exports}var _M={exports:{}},Is={};/** * @license React * react-dom.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var y3;function xk(){if(y3)return Is;y3=1;var i=ty();function e(c){var h="https://react.dev/errors/"+c;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(e){console.error(e)}}return i(),_M.exports=xk(),_M.exports}/** * @license React * react-dom-client.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var _3;function bk(){if(_3)return T0;_3=1;var i=kU(),e=ty(),t=_k();function n(o){var u="https://react.dev/errors/"+o;if(1ue||(o.current=le[ue],le[ue]=null,ue--)}function oe(o,u){ue++,le[ue]=o.current,o.current=u}var fe=k(null),ve=k(null),se=k(null),de=k(null);function be(o,u){switch(oe(se,u),oe(ve,o),oe(fe,null),u.nodeType){case 9:case 11:o=(o=u.documentElement)&&(o=o.namespaceURI)?PC(o):0;break;default:if(o=u.tagName,u=u.namespaceURI)u=PC(u),o=OC(u,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}Z(fe),oe(fe,o)}function Ge(){Z(fe),Z(ve),Z(se)}function ot(o){o.memoizedState!==null&&oe(de,o);var u=fe.current,m=OC(u,o.type);u!==m&&(oe(ve,o),oe(fe,m))}function Qe(o){ve.current===o&&(Z(fe),Z(ve)),de.current===o&&(Z(de),_0._currentValue=he)}var Je,Mt;function Le(o){if(Je===void 0)try{throw Error()}catch(m){var u=m.stack.trim().match(/\n( *(at )?)/);Je=u&&u[1]||"",Mt=-1)":-1E||ge[y]!==ke[E]){var at=` `+ge[y].replace(" at new "," at ");return o.displayName&&at.includes("")&&(at=at.replace("",o.displayName)),at}while(1<=y&&0<=E);break}}}finally{ze=!1,Error.prepareStackTrace=m}return(m=o?o.displayName||o.name:"")?Le(m):""}function tt(o,u){switch(o.tag){case 26:case 27:case 5:return Le(o.type);case 16:return Le("Lazy");case 13:return o.child!==u&&u!==null?Le("Suspense Fallback"):Le("Suspense");case 19:return Le("SuspenseList");case 0:case 15:return Ie(o.type,!1);case 11:return Ie(o.type.render,!1);case 1:return Ie(o.type,!0);case 31:return Le("Activity");default:return""}}function ee(o){try{var u="",m=null;do u+=tt(o,m),m=o,o=o.return;while(o);return u}catch(y){return` Error generating stack: `+y.message+` `+y.stack}}var lt=Object.prototype.hasOwnProperty,Ye=i.unstable_scheduleCallback,Re=i.unstable_cancelCallback,We=i.unstable_shouldYield,Q=i.unstable_requestPaint,B=i.unstable_now,ce=i.unstable_getCurrentPriorityLevel,Ue=i.unstable_ImmediatePriority,Ae=i.unstable_UserBlockingPriority,Ee=i.unstable_NormalPriority,rt=i.unstable_LowPriority,st=i.unstable_IdlePriority,Et=i.log,Nt=i.unstable_setDisableYieldValue,Ve=null,Pe=null;function $e(o){if(typeof Et=="function"&&Nt(o),Pe&&typeof Pe.setStrictMode=="function")try{Pe.setStrictMode(Ve,o)}catch{}}var ct=Math.clz32?Math.clz32:ye,mt=Math.log,Gt=Math.LN2;function ye(o){return o>>>=0,o===0?32:31-(mt(o)/Gt|0)|0}var we=256,it=262144,Lt=4194304;function et(o){var u=o&42;if(u!==0)return u;switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function Ne(o,u,m){var y=o.pendingLanes;if(y===0)return 0;var E=0,C=o.suspendedLanes,z=o.pingedLanes;o=o.warmLanes;var te=y&134217727;return te!==0?(y=te&~C,y!==0?E=et(y):(z&=te,z!==0?E=et(z):m||(m=te&~o,m!==0&&(E=et(m))))):(te=y&~C,te!==0?E=et(te):z!==0?E=et(z):m||(m=y&~o,m!==0&&(E=et(m)))),E===0?0:u!==0&&u!==E&&(u&C)===0&&(C=E&-E,m=u&-u,C>=m||C===32&&(m&4194048)!==0)?u:E}function Ct(o,u){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&u)===0}function Bt(o,u){switch(o){case 1:case 2:case 4:case 8:case 64:return u+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return u+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ot(){var o=Lt;return Lt<<=1,(Lt&62914560)===0&&(Lt=4194304),o}function Zt(o){for(var u=[],m=0;31>m;m++)u.push(o);return u}function Bn(o,u){o.pendingLanes|=u,u!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function Wn(o,u,m,y,E,C){var z=o.pendingLanes;o.pendingLanes=m,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=m,o.entangledLanes&=m,o.errorRecoveryDisabledLanes&=m,o.shellSuspendCounter=0;var te=o.entanglements,ge=o.expirationTimes,ke=o.hiddenUpdates;for(m=z&~m;0"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var cn=/[\n"\\]/g;function Rt(o){return o.replace(cn,function(u){return"\\"+u.charCodeAt(0).toString(16)+" "})}function Xn(o,u,m,y,E,C,z,te){o.name="",z!=null&&typeof z!="function"&&typeof z!="symbol"&&typeof z!="boolean"?o.type=z:o.removeAttribute("type"),u!=null?z==="number"?(u===0&&o.value===""||o.value!=u)&&(o.value=""+Xt(u)):o.value!==""+Xt(u)&&(o.value=""+Xt(u)):z!=="submit"&&z!=="reset"||o.removeAttribute("value"),u!=null?En(o,z,Xt(u)):m!=null?En(o,z,Xt(m)):y!=null&&o.removeAttribute("value"),E==null&&C!=null&&(o.defaultChecked=!!C),E!=null&&(o.checked=E&&typeof E!="function"&&typeof E!="symbol"),te!=null&&typeof te!="function"&&typeof te!="symbol"&&typeof te!="boolean"?o.name=""+Xt(te):o.removeAttribute("name")}function ai(o,u,m,y,E,C,z,te){if(C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(o.type=C),u!=null||m!=null){if(!(C!=="submit"&&C!=="reset"||u!=null)){tn(o);return}m=m!=null?""+Xt(m):"",u=u!=null?""+Xt(u):m,te||u===o.value||(o.value=u),o.defaultValue=u}y=y??E,y=typeof y!="function"&&typeof y!="symbol"&&!!y,o.checked=te?o.checked:!!y,o.defaultChecked=!!y,z!=null&&typeof z!="function"&&typeof z!="symbol"&&typeof z!="boolean"&&(o.name=z),tn(o)}function En(o,u,m){u==="number"&&yt(o.ownerDocument)===o||o.defaultValue===""+m||(o.defaultValue=""+m)}function oi(o,u,m,y){if(o=o.options,u){u={};for(var E=0;E"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),cs=!1;if(js)try{var xo={};Object.defineProperty(xo,"passive",{get:function(){cs=!0}}),window.addEventListener("test",xo,xo),window.removeEventListener("test",xo,xo)}catch{cs=!1}var qr=null,zu=null,ja=null;function Bl(){if(ja)return ja;var o,u=zu,m=u.length,y,E="value"in qr?qr.value:qr.textContent,C=E.length;for(o=0;o=Nc),Ly=" ",nh=!1;function Wd(o,u){switch(o){case"keyup":return Uy.indexOf(u.keyCode)!==-1;case"keydown":return u.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function cg(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Wu=!1;function Iy(o,u){switch(o){case"compositionend":return cg(u);case"keypress":return u.which!==32?null:(nh=!0,Ly);case"textInput":return o=u.data,o===Ly&&nh?null:o;default:return null}}function fg(o,u){if(Wu)return o==="compositionend"||!Hu&&Wd(o,u)?(o=Bl(),ja=zu=qr=null,Wu=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(u.ctrlKey||u.altKey||u.metaKey)||u.ctrlKey&&u.altKey){if(u.char&&1=u)return{node:m,offset:u-o};o=y}e:{for(;m;){if(m.nextSibling){m=m.nextSibling;break e}m=m.parentNode}m=void 0}m=sh(m)}}function mi(o,u){return o&&u?o===u?!0:o&&o.nodeType===3?!1:u&&u.nodeType===3?mi(o,u.parentNode):"contains"in o?o.contains(u):o.compareDocumentPosition?!!(o.compareDocumentPosition(u)&16):!1:!1}function zy(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var u=yt(o.document);u instanceof o.HTMLIFrameElement;){try{var m=typeof u.contentWindow.location.href=="string"}catch{m=!1}if(m)o=u.contentWindow;else break;u=yt(o.document)}return u}function xg(o){var u=o&&o.nodeName&&o.nodeName.toLowerCase();return u&&(u==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||u==="textarea"||o.contentEditable==="true")}var By=js&&"documentMode"in document&&11>=document.documentMode,wo=null,To=null,Pc=null,Xd=!1;function Oc(o,u,m){var y=m.window===m?m.document:m.nodeType===9?m:m.ownerDocument;Xd||wo==null||wo!==yt(y)||(y=wo,"selectionStart"in y&&xg(y)?y={start:y.selectionStart,end:y.selectionEnd}:(y=(y.ownerDocument&&y.ownerDocument.defaultView||window).getSelection(),y={anchorNode:y.anchorNode,anchorOffset:y.anchorOffset,focusNode:y.focusNode,focusOffset:y.focusOffset}),Pc&&Lc(Pc,y)||(Pc=y,y=zx(To,"onSelect"),0>=z,E-=z,Ii=1<<32-ct(u)+E|m<An?(Gn=Qt,Qt=null):Gn=Qt.sibling;var ni=He(Ce,Qt,Fe[An],ut);if(ni===null){Qt===null&&(Qt=Gn);break}o&&Qt&&ni.alternate===null&&u(Ce,Qt),Te=C(ni,Te,An),ti===null?rn=ni:ti.sibling=ni,ti=ni,Qt=Gn}if(An===Fe.length)return m(Ce,Qt),On&&Ao(Ce,An),rn;if(Qt===null){for(;AnAn?(Gn=Qt,Qt=null):Gn=Qt.sibling;var pf=He(Ce,Qt,ni.value,ut);if(pf===null){Qt===null&&(Qt=Gn);break}o&&Qt&&pf.alternate===null&&u(Ce,Qt),Te=C(pf,Te,An),ti===null?rn=pf:ti.sibling=pf,ti=pf,Qt=Gn}if(ni.done)return m(Ce,Qt),On&&Ao(Ce,An),rn;if(Qt===null){for(;!ni.done;An++,ni=Fe.next())ni=ft(Ce,ni.value,ut),ni!==null&&(Te=C(ni,Te,An),ti===null?rn=ni:ti.sibling=ni,ti=ni);return On&&Ao(Ce,An),rn}for(Qt=y(Qt);!ni.done;An++,ni=Fe.next())ni=Ke(Qt,Ce,An,ni.value,ut),ni!==null&&(o&&ni.alternate!==null&&Qt.delete(ni.key===null?An:ni.key),Te=C(ni,Te,An),ti===null?rn=ni:ti.sibling=ni,ti=ni);return o&&Qt.forEach(function(hk){return u(Ce,hk)}),On&&Ao(Ce,An),rn}function xi(Ce,Te,Fe,ut){if(typeof Fe=="object"&&Fe!==null&&Fe.type===w&&Fe.key===null&&(Fe=Fe.props.children),typeof Fe=="object"&&Fe!==null){switch(Fe.$$typeof){case x:e:{for(var rn=Fe.key;Te!==null;){if(Te.key===rn){if(rn=Fe.type,rn===w){if(Te.tag===7){m(Ce,Te.sibling),ut=E(Te,Fe.props.children),ut.return=Ce,Ce=ut;break e}}else if(Te.elementType===rn||typeof rn=="object"&&rn!==null&&rn.$$typeof===N&&Zu(rn)===Te.type){m(Ce,Te.sibling),ut=E(Te,Fe.props),Ma(ut,Fe),ut.return=Ce,Ce=ut;break e}m(Ce,Te);break}else u(Ce,Te);Te=Te.sibling}Fe.type===w?(ut=Zl(Fe.props.children,Ce.mode,ut,Fe.key),ut.return=Ce,Ce=ut):(ut=Eo(Fe.type,Fe.key,Fe.props,null,Ce.mode,ut),Ma(ut,Fe),ut.return=Ce,Ce=ut)}return z(Ce);case b:e:{for(rn=Fe.key;Te!==null;){if(Te.key===rn)if(Te.tag===4&&Te.stateNode.containerInfo===Fe.containerInfo&&Te.stateNode.implementation===Fe.implementation){m(Ce,Te.sibling),ut=E(Te,Fe.children||[]),ut.return=Ce,Ce=ut;break e}else{m(Ce,Te);break}else u(Ce,Te);Te=Te.sibling}ut=Qd(Fe,Ce.mode,ut),ut.return=Ce,Ce=ut}return z(Ce);case N:return Fe=Zu(Fe),xi(Ce,Te,Fe,ut)}if(ne(Fe))return Yt(Ce,Te,Fe,ut);if(W(Fe)){if(rn=W(Fe),typeof rn!="function")throw Error(n(150));return Fe=rn.call(Fe),on(Ce,Te,Fe,ut)}if(typeof Fe.then=="function")return xi(Ce,Te,mh(Fe),ut);if(Fe.$$typeof===D)return xi(Ce,Te,Wc(Ce,Fe),ut);jc(Ce,Fe)}return typeof Fe=="string"&&Fe!==""||typeof Fe=="number"||typeof Fe=="bigint"?(Fe=""+Fe,Te!==null&&Te.tag===6?(m(Ce,Te.sibling),ut=E(Te,Fe),ut.return=Ce,Ce=ut):(m(Ce,Te),ut=Kd(Fe,Ce.mode,ut),ut.return=Ce,Ce=ut),z(Ce)):m(Ce,Te)}return function(Ce,Te,Fe,ut){try{$u=0;var rn=xi(Ce,Te,Fe,ut);return Ju=null,rn}catch(Qt){if(Qt===qu||Qt===bn)throw Qt;var ti=Li(29,Qt,null,Ce.mode);return ti.lanes=ut,ti.return=Ce,ti}finally{}}}var cl=op(!0),lp=op(!1),ds=!1;function gh(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Rg(o,u){o=o.updateQueue,u.updateQueue===o&&(u.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function fl(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function nu(o,u,m){var y=o.updateQueue;if(y===null)return null;if(y=y.shared,($t&2)!==0){var E=y.pending;return E===null?u.next=u:(u.next=E.next,E.next=u),y.pending=u,u=ba(o),Yl(o,null,m),u}return Rr(o,y,u,m),ba(o)}function iu(o,u,m){if(u=u.updateQueue,u!==null&&(u=u.shared,(m&4194048)!==0)){var y=u.lanes;y&=o.pendingLanes,m|=y,u.lanes=m,Ui(o,m)}}function nn(o,u){var m=o.updateQueue,y=o.alternate;if(y!==null&&(y=y.updateQueue,m===y)){var E=null,C=null;if(m=m.firstBaseUpdate,m!==null){do{var z={lane:m.lane,tag:m.tag,payload:m.payload,callback:null,next:null};C===null?E=C=z:C=C.next=z,m=m.next}while(m!==null);C===null?E=C=u:C=C.next=u}else E=C=u;m={baseState:y.baseState,firstBaseUpdate:E,lastBaseUpdate:C,shared:y.shared,callbacks:y.callbacks},o.updateQueue=m;return}o=m.lastBaseUpdate,o===null?m.firstBaseUpdate=u:o.next=u,m.lastBaseUpdate=u}var Dg=!1;function vh(){if(Dg){var o=Sa;if(o!==null)throw o}}function Xc(o,u,m,y){Dg=!1;var E=o.updateQueue;ds=!1;var C=E.firstBaseUpdate,z=E.lastBaseUpdate,te=E.shared.pending;if(te!==null){E.shared.pending=null;var ge=te,ke=ge.next;ge.next=null,z===null?C=ke:z.next=ke,z=ge;var at=o.alternate;at!==null&&(at=at.updateQueue,te=at.lastBaseUpdate,te!==z&&(te===null?at.firstBaseUpdate=ke:te.next=ke,at.lastBaseUpdate=ge))}if(C!==null){var ft=E.baseState;z=0,at=ke=ge=null,te=C;do{var He=te.lane&-536870913,Ke=He!==te.lane;if(Ke?(_n&He)===He:(y&He)===He){He!==0&&He===ul&&(Dg=!0),at!==null&&(at=at.next={lane:0,tag:te.tag,payload:te.payload,callback:null,next:null});e:{var Yt=o,on=te;He=u;var xi=m;switch(on.tag){case 1:if(Yt=on.payload,typeof Yt=="function"){ft=Yt.call(xi,ft,He);break e}ft=Yt;break e;case 3:Yt.flags=Yt.flags&-65537|128;case 0:if(Yt=on.payload,He=typeof Yt=="function"?Yt.call(xi,ft,He):Yt,He==null)break e;ft=g({},ft,He);break e;case 2:ds=!0}}He=te.callback,He!==null&&(o.flags|=64,Ke&&(o.flags|=8192),Ke=E.callbacks,Ke===null?E.callbacks=[He]:Ke.push(He))}else Ke={lane:He,tag:te.tag,payload:te.payload,callback:te.callback,next:null},at===null?(ke=at=Ke,ge=ft):at=at.next=Ke,z|=He;if(te=te.next,te===null){if(te=E.shared.pending,te===null)break;Ke=te,te=Ke.next,Ke.next=null,E.lastBaseUpdate=Ke,E.shared.pending=null}}while(!0);at===null&&(ge=ft),E.baseState=ge,E.firstBaseUpdate=ke,E.lastBaseUpdate=at,C===null&&(E.shared.lanes=0),Vo|=z,o.lanes=z,o.memoizedState=ft}}function Yc(o,u){if(typeof o!="function")throw Error(n(191,o));o.call(u)}function Zy(o,u){var m=o.callbacks;if(m!==null)for(o.callbacks=null,o=0;oC?C:8;var z=j.T,te={};j.T=te,$g(o,!1,u,m);try{var ge=E(),ke=j.S;if(ke!==null&&ke(te,ge),ge!==null&&typeof ge=="object"&&typeof ge.then=="function"){var at=Ag(ge,y);bh(o,u,at,ta(o))}else bh(o,u,y,ta(o))}catch(ft){bh(o,u,{then:function(){},status:"rejected",reason:ft},ta())}finally{$.p=C,z!==null&&te.types!==null&&(z.types=te.types),j.T=z}}function GS(){}function Qg(o,u,m,y){if(o.tag!==5)throw Error(n(476));var E=Sx(o).queue;bx(o,E,u,he,m===null?GS:function(){return Mx(o),m(y)})}function Sx(o){var u=o.memoizedState;if(u!==null)return u;u={memoizedState:he,baseState:he,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:dl,lastRenderedState:he},next:null};var m={};return u.next={memoizedState:m,baseState:m,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:dl,lastRenderedState:m},next:null},o.memoizedState=u,o=o.alternate,o!==null&&(o.memoizedState=u),u}function Mx(o){var u=Sx(o);u.next===null&&(u=o.alternate.memoizedState),bh(o,u.next.queue,{},ta())}function Jg(){return ln(_0)}function wx(){return Qi().memoizedState}function Tx(){return Qi().memoizedState}function HS(o){for(var u=o.return;u!==null;){switch(u.tag){case 24:case 3:var m=ta();o=fl(m);var y=nu(u,o,m);y!==null&&(Mn(y,u,m),iu(y,u,m)),u={cache:wg()},o.payload=u;return}u=u.return}}function WS(o,u,m){var y=ta();m={lane:y,revertLane:0,gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null},vp(o)?Ax(u,m):(m=qd(o,u,m,y),m!==null&&(Mn(m,o,y),Cx(m,u,y)))}function Ex(o,u,m){var y=ta();bh(o,u,m,y)}function bh(o,u,m,y){var E={lane:y,revertLane:0,gesture:null,action:m,hasEagerState:!1,eagerState:null,next:null};if(vp(o))Ax(u,E);else{var C=o.alternate;if(o.lanes===0&&(C===null||C.lanes===0)&&(C=u.lastRenderedReducer,C!==null))try{var z=u.lastRenderedState,te=C(z,m);if(E.hasEagerState=!0,E.eagerState=te,fs(te,z))return Rr(o,u,E,0),hn===null&&ch(),!1}catch{}finally{}if(m=qd(o,u,E,y),m!==null)return Mn(m,o,y),Cx(m,u,y),!0}return!1}function $g(o,u,m,y){if(y={lane:2,revertLane:Xe(),gesture:null,action:y,hasEagerState:!1,eagerState:null,next:null},vp(o)){if(u)throw Error(n(479))}else u=qd(o,m,y,2),u!==null&&Mn(u,o,2)}function vp(o){var u=o.alternate;return o===mn||u!==null&&u===mn}function Ax(o,u){Zc=wa=!0;var m=o.pending;m===null?u.next=u:(u.next=m.next,m.next=u),o.pending=u}function Cx(o,u,m){if((m&4194048)!==0){var y=u.lanes;y&=o.pendingLanes,m|=y,u.lanes=m,Ui(o,m)}}var Qc={readContext:ln,use:ru,useCallback:Pi,useContext:Pi,useEffect:Pi,useImperativeHandle:Pi,useLayoutEffect:Pi,useInsertionEffect:Pi,useMemo:Pi,useReducer:Pi,useRef:Pi,useState:Pi,useDebugValue:Pi,useDeferredValue:Pi,useTransition:Pi,useSyncExternalStore:Pi,useId:Pi,useHostTransitionStatus:Pi,useFormState:Pi,useActionState:Pi,useOptimistic:Pi,useMemoCache:Pi,useCacheRefresh:Pi};Qc.useEffectEvent=Pi;var Rx={readContext:ln,use:ru,useCallback:function(o,u){return xr().memoizedState=[o,u===void 0?null:u],o},useContext:ln,useEffect:fx,useImperativeHandle:function(o,u,m){m=m!=null?m.concat([o]):null,mp(4194308,4,gx.bind(null,u,o),m)},useLayoutEffect:function(o,u){return mp(4194308,4,o,u)},useInsertionEffect:function(o,u){mp(4,2,o,u)},useMemo:function(o,u){var m=xr();u=u===void 0?null:u;var y=o();if(ec){$e(!0);try{o()}finally{$e(!1)}}return m.memoizedState=[y,u],y},useReducer:function(o,u,m){var y=xr();if(m!==void 0){var E=m(u);if(ec){$e(!0);try{m(u)}finally{$e(!1)}}}else E=u;return y.memoizedState=y.baseState=E,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:E},y.queue=o,o=o.dispatch=WS.bind(null,mn,o),[y.memoizedState,o]},useRef:function(o){var u=xr();return o={current:o},u.memoizedState=o},useState:function(o){o=Vg(o);var u=o.queue,m=Ex.bind(null,mn,u);return u.dispatch=m,[o.memoizedState,m]},useDebugValue:Zg,useDeferredValue:function(o,u){var m=xr();return Kg(m,o,u)},useTransition:function(){var o=Vg(!1);return o=bx.bind(null,mn,o.queue,!0,!1),xr().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,u,m){var y=mn,E=xr();if(On){if(m===void 0)throw Error(n(407));m=m()}else{if(m=u(),hn===null)throw Error(n(349));(_n&127)!==0||ex(y,u,m)}E.memoizedState=m;var C={value:m,getSnapshot:u};return E.queue=C,fx(nx.bind(null,y,C,o),[o]),y.flags|=2048,su(9,{destroy:void 0},tx.bind(null,y,C,m,u),null),m},useId:function(){var o=xr(),u=hn.identifierPrefix;if(On){var m=qa,y=Ii;m=(y&~(1<<32-ct(y)-1)).toString(32)+m,u="_"+u+"R_"+m,m=cp++,0<\/script>",C=C.removeChild(C.firstChild);break;case"select":C=typeof y.is=="string"?z.createElement("select",{is:y.is}):z.createElement("select"),y.multiple?C.multiple=!0:y.size&&(C.size=y.size);break;default:C=typeof y.is=="string"?z.createElement(E,{is:y.is}):z.createElement(E)}}C[jn]=u,C[Y]=y;e:for(z=u.child;z!==null;){if(z.tag===5||z.tag===6)C.appendChild(z.stateNode);else if(z.tag!==4&&z.tag!==27&&z.child!==null){z.child.return=z,z=z.child;continue}if(z===u)break e;for(;z.sibling===null;){if(z.return===null||z.return===u)break e;z=z.return}z.sibling.return=z.return,z=z.sibling}u.stateNode=C;e:switch(xs(C,E,y),E){case"button":case"input":case"select":case"textarea":y=!!y.autoFocus;break e;case"img":y=!0;break e;default:y=!1}y&&Oo(u)}}return ui(u),Th(u,u.type,o===null?null:o.memoizedProps,u.pendingProps,m),null;case 6:if(o&&u.stateNode!=null)o.memoizedProps!==y&&Oo(u);else{if(typeof y!="string"&&u.stateNode===null)throw Error(n(166));if(o=se.current,Gc(u)){if(o=u.stateNode,m=u.memoizedProps,y=null,E=Hi,E!==null)switch(E.tag){case 27:case 5:y=E.memoizedProps}o[jn]=u,o=!!(o.nodeValue===m||y!==null&&y.suppressHydrationWarning===!0||LC(o.nodeValue,m)),o||Ro(u,!0)}else o=Bx(o).createTextNode(y),o[jn]=u,u.stateNode=o}return ui(u),null;case 31:if(m=u.memoizedState,o===null||o.memoizedState!==null){if(y=Gc(u),m!==null){if(o===null){if(!y)throw Error(n(318));if(o=u.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(n(557));o[jn]=u}else Jl(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;ui(u),o=!1}else m=ep(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=m),o=!0;if(!o)return u.flags&256?(Ki(u),u):(Ki(u),null);if((u.flags&128)!==0)throw Error(n(558))}return ui(u),null;case 13:if(y=u.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(E=Gc(u),y!==null&&y.dehydrated!==null){if(o===null){if(!E)throw Error(n(318));if(E=u.memoizedState,E=E!==null?E.dehydrated:null,!E)throw Error(n(317));E[jn]=u}else Jl(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;ui(u),E=!1}else E=ep(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=E),E=!0;if(!E)return u.flags&256?(Ki(u),u):(Ki(u),null)}return Ki(u),(u.flags&128)!==0?(u.lanes=m,u):(m=y!==null,o=o!==null&&o.memoizedState!==null,m&&(y=u.child,E=null,y.alternate!==null&&y.alternate.memoizedState!==null&&y.alternate.memoizedState.cachePool!==null&&(E=y.alternate.memoizedState.cachePool.pool),C=null,y.memoizedState!==null&&y.memoizedState.cachePool!==null&&(C=y.memoizedState.cachePool.pool),C!==E&&(y.flags|=2048)),m!==o&&m&&(u.child.flags|=8192),pl(u,u.updateQueue),ui(u),null);case 4:return Ge(),o===null&&ZS(u.stateNode.containerInfo),ui(u),null;case 10:return Uo(u.type),ui(u),null;case 19:if(Z(Fn),y=u.memoizedState,y===null)return ui(u),null;if(E=(u.flags&128)!==0,C=y.rendering,C===null)if(E)Fo(y,!1);else{if(Oi!==0||o!==null&&(o.flags&128)!==0)for(o=u.child;o!==null;){if(C=Ks(o),C!==null){for(u.flags|=128,Fo(y,!1),o=C.updateQueue,u.updateQueue=o,pl(u,o),u.subtreeFlags=0,o=m,m=u.child;m!==null;)Fc(m,o),m=m.sibling;return oe(Fn,Fn.current&1|2),On&&Ao(u,y.treeForkCount),u.child}o=o.sibling}y.tail!==null&&B()>$i&&(u.flags|=128,E=!0,Fo(y,!1),u.lanes=4194304)}else{if(!E)if(o=Ks(C),o!==null){if(u.flags|=128,E=!0,o=o.updateQueue,u.updateQueue=o,pl(u,o),Fo(y,!0),y.tail===null&&y.tailMode==="hidden"&&!C.alternate&&!On)return ui(u),null}else 2*B()-y.renderingStartTime>$i&&m!==536870912&&(u.flags|=128,E=!0,Fo(y,!1),u.lanes=4194304);y.isBackwards?(C.sibling=u.child,u.child=C):(o=y.last,o!==null?o.sibling=C:u.child=C,y.last=C)}return y.tail!==null?(o=y.tail,y.rendering=o,y.tail=o.sibling,y.renderingStartTime=B(),o.sibling=null,m=Fn.current,oe(Fn,E?m&1|2:m&1),On&&Ao(u,y.treeForkCount),o):(ui(u),null);case 22:case 23:return Ki(u),yh(),y=u.memoizedState!==null,o!==null?o.memoizedState!==null!==y&&(u.flags|=8192):y&&(u.flags|=8192),y?(m&536870912)!==0&&(u.flags&128)===0&&(ui(u),u.subtreeFlags&6&&(u.flags|=8192)):ui(u),m=u.updateQueue,m!==null&&pl(u,m.retryQueue),m=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(m=o.memoizedState.cachePool.pool),y=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(y=u.memoizedState.cachePool.pool),y!==m&&(u.flags|=2048),o!==null&&Z(tu),null;case 24:return m=null,o!==null&&(m=o.memoizedState.cache),u.memoizedState.cache!==m&&(u.flags|=2048),Uo(ur),ui(u),null;case 25:return null;case 30:return null}throw Error(n(156,u.tag))}function Ea(o,u){switch(Jd(u),u.tag){case 1:return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 3:return Uo(ur),Ge(),o=u.flags,(o&65536)!==0&&(o&128)===0?(u.flags=o&-65537|128,u):null;case 26:case 27:case 5:return Qe(u),null;case 31:if(u.memoizedState!==null){if(Ki(u),u.alternate===null)throw Error(n(340));Jl()}return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 13:if(Ki(u),o=u.memoizedState,o!==null&&o.dehydrated!==null){if(u.alternate===null)throw Error(n(340));Jl()}return o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 19:return Z(Fn),null;case 4:return Ge(),null;case 10:return Uo(u.type),null;case 22:case 23:return Ki(u),yh(),o!==null&&Z(tu),o=u.flags,o&65536?(u.flags=o&-65537|128,u):null;case 24:return Uo(ur),null;case 25:return null;default:return null}}function Qs(o,u){switch(Jd(u),u.tag){case 3:Uo(ur),Ge();break;case 26:case 27:case 5:Qe(u);break;case 4:Ge();break;case 31:u.memoizedState!==null&&Ki(u);break;case 13:Ki(u);break;case 19:Z(Fn);break;case 10:Uo(u.type);break;case 22:case 23:Ki(u),yh(),o!==null&&Z(tu);break;case 24:Uo(ur)}}function Aa(o,u){try{var m=u.updateQueue,y=m!==null?m.lastEffect:null;if(y!==null){var E=y.next;m=E;do{if((m.tag&o)===o){y=void 0;var C=m.create,z=m.inst;y=C(),z.destroy=y}m=m.next}while(m!==E)}}catch(te){Yn(u,u.return,te)}}function zr(o,u,m){try{var y=u.updateQueue,E=y!==null?y.lastEffect:null;if(E!==null){var C=E.next;y=C;do{if((y.tag&o)===o){var z=y.inst,te=z.destroy;if(te!==void 0){z.destroy=void 0,E=u;var ge=m,ke=te;try{ke()}catch(at){Yn(E,ge,at)}}}y=y.next}while(y!==C)}}catch(at){Yn(u,u.return,at)}}function Za(o){var u=o.updateQueue;if(u!==null){var m=o.stateNode;try{Zy(u,m)}catch(y){Yn(o,o.return,y)}}}function Nr(o,u,m){m.props=au(o.type,o.memoizedProps),m.state=o.memoizedState;try{m.componentWillUnmount()}catch(y){Yn(o,u,y)}}function ml(o,u){try{var m=o.ref;if(m!==null){switch(o.tag){case 26:case 27:case 5:var y=o.stateNode;break;case 30:y=o.stateNode;break;default:y=o.stateNode}typeof m=="function"?o.refCleanup=m(y):m.current=y}}catch(E){Yn(o,u,E)}}function Br(o,u){var m=o.ref,y=o.refCleanup;if(m!==null)if(typeof y=="function")try{y()}catch(E){Yn(o,u,E)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof m=="function")try{m(null)}catch(E){Yn(o,u,E)}else m.current=null}function Ah(o){var u=o.type,m=o.memoizedProps,y=o.stateNode;try{e:switch(u){case"button":case"input":case"select":case"textarea":m.autoFocus&&y.focus();break e;case"img":m.src?y.src=m.src:m.srcSet&&(y.srcset=m.srcSet)}}catch(E){Yn(o,o.return,E)}}function br(o,u,m){try{var y=o.stateNode;OF(y,o.type,m,u),y[Y]=u}catch(E){Yn(o,o.return,E)}}function Di(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&uf(o.type)||o.tag===4}function Un(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Di(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&uf(o.type)||o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function ko(o,u,m){var y=o.tag;if(y===5||y===6)o=o.stateNode,u?(m.nodeType===9?m.body:m.nodeName==="HTML"?m.ownerDocument.body:m).insertBefore(o,u):(u=m.nodeType===9?m.body:m.nodeName==="HTML"?m.ownerDocument.body:m,u.appendChild(o),m=m._reactRootContainer,m!=null||u.onclick!==null||(u.onclick=Yr));else if(y!==4&&(y===27&&uf(o.type)&&(m=o.stateNode,u=null),o=o.child,o!==null))for(ko(o,u,m),o=o.sibling;o!==null;)ko(o,u,m),o=o.sibling}function ms(o,u,m){var y=o.tag;if(y===5||y===6)o=o.stateNode,u?m.insertBefore(o,u):m.appendChild(o);else if(y!==4&&(y===27&&uf(o.type)&&(m=o.stateNode),o=o.child,o!==null))for(ms(o,u,m),o=o.sibling;o!==null;)ms(o,u,m),o=o.sibling}function Rp(o){var u=o.stateNode,m=o.memoizedProps;try{for(var y=o.type,E=u.attributes;E.length;)u.removeAttributeNode(E[0]);xs(u,y,m),u[jn]=o,u[Y]=m}catch(C){Yn(o,o.return,C)}}var Ca=!1,vi=!1,Ka=!1,Fx=typeof WeakSet=="function"?WeakSet:Set,Ur=null;function XS(o,u){if(o=o.containerInfo,JS=Yx,o=zy(o),xg(o)){if("selectionStart"in o)var m={start:o.selectionStart,end:o.selectionEnd};else e:{m=(m=o.ownerDocument)&&m.defaultView||window;var y=m.getSelection&&m.getSelection();if(y&&y.rangeCount!==0){m=y.anchorNode;var E=y.anchorOffset,C=y.focusNode;y=y.focusOffset;try{m.nodeType,C.nodeType}catch{m=null;break e}var z=0,te=-1,ge=-1,ke=0,at=0,ft=o,He=null;t:for(;;){for(var Ke;ft!==m||E!==0&&ft.nodeType!==3||(te=z+E),ft!==C||y!==0&&ft.nodeType!==3||(ge=z+y),ft.nodeType===3&&(z+=ft.nodeValue.length),(Ke=ft.firstChild)!==null;)He=ft,ft=Ke;for(;;){if(ft===o)break t;if(He===m&&++ke===E&&(te=z),He===C&&++at===y&&(ge=z),(Ke=ft.nextSibling)!==null)break;ft=He,He=ft.parentNode}ft=Ke}m=te===-1||ge===-1?null:{start:te,end:ge}}else m=null}m=m||{start:0,end:0}}else m=null;for($S={focusedElem:o,selectionRange:m},Yx=!1,Ur=u;Ur!==null;)if(u=Ur,o=u.child,(u.subtreeFlags&1028)!==0&&o!==null)o.return=u,Ur=o;else for(;Ur!==null;){switch(u=Ur,C=u.alternate,o=u.flags,u.tag){case 0:if((o&4)!==0&&(o=u.updateQueue,o=o!==null?o.events:null,o!==null))for(m=0;m title"))),xs(C,y,m),C[jn]=o,pe(C),y=C;break e;case"link":var z=KC("link","href",E).get(y+(m.href||""));if(z){for(var te=0;texi&&(z=xi,xi=on,on=z);var Ce=Ic(te,on),Te=Ic(te,xi);if(Ce&&Te&&(Ke.rangeCount!==1||Ke.anchorNode!==Ce.node||Ke.anchorOffset!==Ce.offset||Ke.focusNode!==Te.node||Ke.focusOffset!==Te.offset)){var Fe=ft.createRange();Fe.setStart(Ce.node,Ce.offset),Ke.removeAllRanges(),on>xi?(Ke.addRange(Fe),Ke.extend(Te.node,Te.offset)):(Fe.setEnd(Te.node,Te.offset),Ke.addRange(Fe))}}}}for(ft=[],Ke=te;Ke=Ke.parentNode;)Ke.nodeType===1&&ft.push({element:Ke,left:Ke.scrollLeft,top:Ke.scrollTop});for(typeof te.focus=="function"&&te.focus(),te=0;tem?32:m,j.T=null,m=rf,rf=null;var C=ea,z=La;if(ri=0,tf=ea=null,La=0,($t&6)!==0)throw Error(n(331));var te=$t;if($t|=4,Ns(C.current),h0(C,C.current,z,m),$t=te,Ht(0,!1),Pe&&typeof Pe.onPostCommitFiberRoot=="function")try{Pe.onPostCommitFiberRoot(Ve,C)}catch{}return!0}finally{$.p=E,j.T=y,Ho(o,u)}}function m0(o,u,m){u=Ys(m,u),u=s0(o.stateNode,u,2),o=nu(o,u,2),o!==null&&(Bn(o,2),bt(o))}function Yn(o,u,m){if(o.tag===3)m0(o,o,m);else for(;u!==null;){if(u.tag===3){m0(u,o,m);break}else if(u.tag===1){var y=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof y.componentDidCatch=="function"&&(er===null||!er.has(y))){o=Ys(m,o),m=a0(2),y=nu(u,m,2),y!==null&&(Ux(m,y,u,o),Bn(y,2),bt(y));break}}u=u.return}}function Ih(o,u,m){var y=o.pingCache;if(y===null){y=o.pingCache=new gn;var E=new Set;y.set(u,E)}else E=y.get(u),E===void 0&&(E=new Set,y.set(u,E));E.has(m)||(d0=!0,E.add(m),o=f.bind(null,o,u,m),u.then(o,o))}function f(o,u,m){var y=o.pingCache;y!==null&&y.delete(u),o.pingedLanes|=o.suspendedLanes&m,o.warmLanes&=~m,hn===o&&(_n&m)===m&&(Oi===4||Oi===3&&(_n&62914560)===_n&&300>B()-ef?($t&2)===0&&pu(o,0):Rh|=m,bi===_n&&(bi=0)),bt(o)}function d(o,u){u===0&&(u=Ot()),o=hs(o,u),o!==null&&(Bn(o,u),bt(o))}function _(o){var u=o.memoizedState,m=0;u!==null&&(m=u.retryLane),d(o,m)}function T(o,u){var m=0;switch(o.tag){case 31:case 13:var y=o.stateNode,E=o.memoizedState;E!==null&&(m=E.retryLane);break;case 19:y=o.stateNode;break;case 22:y=o.stateNode._retryCache;break;default:throw Error(n(314))}y!==null&&y.delete(u),d(o,m)}function U(o,u){return Ye(o,u)}var O=null,J=null,xe=!1,Ze=!1,xt=!1,Ut=0;function bt(o){o!==J&&o.next===null&&(J===null?O=J=o:J=J.next=o),Ze=!0,xe||(xe=!0,De())}function Ht(o,u){if(!xt&&Ze){xt=!0;do for(var m=!1,y=O;y!==null;){if(o!==0){var E=y.pendingLanes;if(E===0)var C=0;else{var z=y.suspendedLanes,te=y.pingedLanes;C=(1<<31-ct(42|o)+1)-1,C&=E&~(z&~te),C=C&201326741?C&201326741|1:C?C|2:0}C!==0&&(m=!0,Be(y,C))}else C=_n,C=Ne(y,y===hn?C:0,y.cancelPendingCommit!==null||y.timeoutHandle!==-1),(C&3)===0||Ct(y,C)||(m=!0,Be(y,C));y=y.next}while(m);xt=!1}}function dn(){tr()}function tr(){Ze=xe=!1;var o=0;Ut!==0&&kF()&&(o=Ut);for(var u=B(),m=null,y=O;y!==null;){var E=y.next,C=lf(y,u);C===0?(y.next=null,m===null?O=E:m.next=E,E===null&&(J=m)):(m=y,(o!==0||(C&3)!==0)&&(Ze=!0)),y=E}ri!==0&&ri!==5||Ht(o),Ut!==0&&(Ut=0)}function lf(o,u){for(var m=o.suspendedLanes,y=o.pingedLanes,E=o.expirationTimes,C=o.pendingLanes&-62914561;0te)break;var at=ge.transferSize,ft=ge.initiatorType;at&&IC(ft)&&(ge=ge.responseEnd,z+=at*(ge"u"?null:document;function XC(o,u,m){var y=Pp;if(y&&typeof u=="string"&&u){var E=Rt(u);E='link[rel="'+o+'"][href="'+E+'"]',typeof m=="string"&&(E+='[crossorigin="'+m+'"]'),jC.has(E)||(jC.add(E),o={rel:o,crossOrigin:m,href:u},y.querySelector(E)===null&&(u=y.createElement("link"),xs(u,"link",o),pe(u),y.head.appendChild(u)))}}function YF(o){pc.D(o),XC("dns-prefetch",o,null)}function qF(o,u){pc.C(o,u),XC("preconnect",o,u)}function ZF(o,u,m){pc.L(o,u,m);var y=Pp;if(y&&o&&u){var E='link[rel="preload"][as="'+Rt(u)+'"]';u==="image"&&m&&m.imageSrcSet?(E+='[imagesrcset="'+Rt(m.imageSrcSet)+'"]',typeof m.imageSizes=="string"&&(E+='[imagesizes="'+Rt(m.imageSizes)+'"]')):E+='[href="'+Rt(o)+'"]';var C=E;switch(u){case"style":C=Op(o);break;case"script":C=Fp(o)}jo.has(C)||(o=g({rel:"preload",href:u==="image"&&m&&m.imageSrcSet?void 0:o,as:u},m),jo.set(C,o),y.querySelector(E)!==null||u==="style"&&y.querySelector(y0(C))||u==="script"&&y.querySelector(x0(C))||(u=y.createElement("link"),xs(u,"link",o),pe(u),y.head.appendChild(u)))}}function KF(o,u){pc.m(o,u);var m=Pp;if(m&&o){var y=u&&typeof u.as=="string"?u.as:"script",E='link[rel="modulepreload"][as="'+Rt(y)+'"][href="'+Rt(o)+'"]',C=E;switch(y){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":C=Fp(o)}if(!jo.has(C)&&(o=g({rel:"modulepreload",href:o},u),jo.set(C,o),m.querySelector(E)===null)){switch(y){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(m.querySelector(x0(C)))return}y=m.createElement("link"),xs(y,"link",o),pe(y),m.head.appendChild(y)}}}function QF(o,u,m){pc.S(o,u,m);var y=Pp;if(y&&o){var E=V(y).hoistableStyles,C=Op(o);u=u||"default";var z=E.get(C);if(!z){var te={loading:0,preload:null};if(z=y.querySelector(y0(C)))te.loading=5;else{o=g({rel:"stylesheet",href:o,"data-precedence":u},m),(m=jo.get(C))&&aM(o,m);var ge=z=y.createElement("link");pe(ge),xs(ge,"link",o),ge._p=new Promise(function(ke,at){ge.onload=ke,ge.onerror=at}),ge.addEventListener("load",function(){te.loading|=1}),ge.addEventListener("error",function(){te.loading|=2}),te.loading|=4,Gx(z,u,y)}z={type:"stylesheet",instance:z,count:1,state:te},E.set(C,z)}}}function JF(o,u){pc.X(o,u);var m=Pp;if(m&&o){var y=V(m).hoistableScripts,E=Fp(o),C=y.get(E);C||(C=m.querySelector(x0(E)),C||(o=g({src:o,async:!0},u),(u=jo.get(E))&&oM(o,u),C=m.createElement("script"),pe(C),xs(C,"link",o),m.head.appendChild(C)),C={type:"script",instance:C,count:1,state:null},y.set(E,C))}}function $F(o,u){pc.M(o,u);var m=Pp;if(m&&o){var y=V(m).hoistableScripts,E=Fp(o),C=y.get(E);C||(C=m.querySelector(x0(E)),C||(o=g({src:o,async:!0,type:"module"},u),(u=jo.get(E))&&oM(o,u),C=m.createElement("script"),pe(C),xs(C,"link",o),m.head.appendChild(C)),C={type:"script",instance:C,count:1,state:null},y.set(E,C))}}function YC(o,u,m,y){var E=(E=se.current)?Vx(E):null;if(!E)throw Error(n(446));switch(o){case"meta":case"title":return null;case"style":return typeof m.precedence=="string"&&typeof m.href=="string"?(u=Op(m.href),m=V(E).hoistableStyles,y=m.get(u),y||(y={type:"style",instance:null,count:0,state:null},m.set(u,y)),y):{type:"void",instance:null,count:0,state:null};case"link":if(m.rel==="stylesheet"&&typeof m.href=="string"&&typeof m.precedence=="string"){o=Op(m.href);var C=V(E).hoistableStyles,z=C.get(o);if(z||(E=E.ownerDocument||E,z={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},C.set(o,z),(C=E.querySelector(y0(o)))&&!C._p&&(z.instance=C,z.state.loading=5),jo.has(o)||(m={rel:"preload",as:"style",href:m.href,crossOrigin:m.crossOrigin,integrity:m.integrity,media:m.media,hrefLang:m.hrefLang,referrerPolicy:m.referrerPolicy},jo.set(o,m),C||ek(E,o,m,z.state))),u&&y===null)throw Error(n(528,""));return z}if(u&&y!==null)throw Error(n(529,""));return null;case"script":return u=m.async,m=m.src,typeof m=="string"&&u&&typeof u!="function"&&typeof u!="symbol"?(u=Fp(m),m=V(E).hoistableScripts,y=m.get(u),y||(y={type:"script",instance:null,count:0,state:null},m.set(u,y)),y):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,o))}}function Op(o){return'href="'+Rt(o)+'"'}function y0(o){return'link[rel="stylesheet"]['+o+"]"}function qC(o){return g({},o,{"data-precedence":o.precedence,precedence:null})}function ek(o,u,m,y){o.querySelector('link[rel="preload"][as="style"]['+u+"]")?y.loading=1:(u=o.createElement("link"),y.preload=u,u.addEventListener("load",function(){return y.loading|=1}),u.addEventListener("error",function(){return y.loading|=2}),xs(u,"link",m),pe(u),o.head.appendChild(u))}function Fp(o){return'[src="'+Rt(o)+'"]'}function x0(o){return"script[async]"+o}function ZC(o,u,m){if(u.count++,u.instance===null)switch(u.type){case"style":var y=o.querySelector('style[data-href~="'+Rt(m.href)+'"]');if(y)return u.instance=y,pe(y),y;var E=g({},m,{"data-href":m.href,"data-precedence":m.precedence,href:null,precedence:null});return y=(o.ownerDocument||o).createElement("style"),pe(y),xs(y,"style",E),Gx(y,m.precedence,o),u.instance=y;case"stylesheet":E=Op(m.href);var C=o.querySelector(y0(E));if(C)return u.state.loading|=4,u.instance=C,pe(C),C;y=qC(m),(E=jo.get(E))&&aM(y,E),C=(o.ownerDocument||o).createElement("link"),pe(C);var z=C;return z._p=new Promise(function(te,ge){z.onload=te,z.onerror=ge}),xs(C,"link",y),u.state.loading|=4,Gx(C,m.precedence,o),u.instance=C;case"script":return C=Fp(m.src),(E=o.querySelector(x0(C)))?(u.instance=E,pe(E),E):(y=m,(E=jo.get(C))&&(y=g({},m),oM(y,E)),o=o.ownerDocument||o,E=o.createElement("script"),pe(E),xs(E,"link",y),o.head.appendChild(E),u.instance=E);case"void":return null;default:throw Error(n(443,u.type))}else u.type==="stylesheet"&&(u.state.loading&4)===0&&(y=u.instance,u.state.loading|=4,Gx(y,m.precedence,o));return u.instance}function Gx(o,u,m){for(var y=m.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),E=y.length?y[y.length-1]:null,C=E,z=0;z title"):null)}function tk(o,u,m){if(m===1||u.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof u.precedence!="string"||typeof u.href!="string"||u.href==="")break;return!0;case"link":if(typeof u.rel!="string"||typeof u.href!="string"||u.href===""||u.onLoad||u.onError)break;switch(u.rel){case"stylesheet":return o=u.disabled,typeof u.precedence=="string"&&o==null;default:return!0}case"script":if(u.async&&typeof u.async!="function"&&typeof u.async!="symbol"&&!u.onLoad&&!u.onError&&u.src&&typeof u.src=="string")return!0}return!1}function JC(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function nk(o,u,m,y){if(m.type==="stylesheet"&&(typeof y.media!="string"||matchMedia(y.media).matches!==!1)&&(m.state.loading&4)===0){if(m.instance===null){var E=Op(y.href),C=u.querySelector(y0(E));if(C){u=C._p,u!==null&&typeof u=="object"&&typeof u.then=="function"&&(o.count++,o=Wx.bind(o),u.then(o,o)),m.state.loading|=4,m.instance=C,pe(C);return}C=u.ownerDocument||u,y=qC(y),(E=jo.get(E))&&aM(y,E),C=C.createElement("link"),pe(C);var z=C;z._p=new Promise(function(te,ge){z.onload=te,z.onerror=ge}),xs(C,"link",y),m.instance=C}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(m,u),(u=m.state.preload)&&(m.state.loading&3)===0&&(o.count++,m=Wx.bind(o),u.addEventListener("load",m),u.addEventListener("error",m))}}var lM=0;function ik(o,u){return o.stylesheets&&o.count===0&&Xx(o,o.stylesheets),0lM?50:800)+u);return o.unsuspend=m,function(){o.unsuspend=null,clearTimeout(y),clearTimeout(E)}}:null}function Wx(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xx(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var jx=null;function Xx(o,u){o.stylesheets=null,o.unsuspend!==null&&(o.count++,jx=new Map,u.forEach(rk,o),jx=null,Wx.call(o))}function rk(o,u){if(!(u.state.loading&4)){var m=jx.get(o);if(m)var y=m.get(null);else{m=new Map,jx.set(o,m);for(var E=o.querySelectorAll("link[data-precedence],style[data-precedence]"),C=0;C"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(e){console.error(e)}}return i(),vM.exports=bk(),vM.exports}var Mk=Sk(),S3="1.3.19";function zU(i,e,t){return Math.max(i,Math.min(e,t))}function wk(i,e,t){return(1-t)*i+t*e}function Tk(i,e,t,n){return wk(i,e,1-Math.exp(-t*n))}function Ek(i,e){return(i%e+e)%e}var Ak=class{constructor(){kt(this,"isRunning",!1);kt(this,"value",0);kt(this,"from",0);kt(this,"to",0);kt(this,"currentTime",0);kt(this,"lerp");kt(this,"duration");kt(this,"easing");kt(this,"onUpdate")}advance(i){var t;if(!this.isRunning)return;let e=!1;if(this.duration&&this.easing){this.currentTime+=i;const n=zU(0,this.currentTime/this.duration,1);e=n>=1;const r=e?1:this.easing(n);this.value=this.from+(this.to-this.from)*r}else this.lerp?(this.value=Tk(this.value,this.to,this.lerp*60,i),Math.round(this.value)===this.to&&(this.value=this.to,e=!0)):(this.value=this.to,e=!0);e&&this.stop(),(t=this.onUpdate)==null||t.call(this,this.value,e)}stop(){this.isRunning=!1}fromTo(i,e,{lerp:t,duration:n,easing:r,onStart:s,onUpdate:a}){this.from=this.value=i,this.to=e,this.lerp=t,this.duration=n,this.easing=r,this.currentTime=0,this.isRunning=!0,s==null||s(),this.onUpdate=a}};function Ck(i,e){let t;return function(...n){clearTimeout(t),t=setTimeout(()=>{t=void 0,i.apply(this,n)},e)}}var Rk=class{constructor(i,e,{autoResize:t=!0,debounce:n=250}={}){kt(this,"width",0);kt(this,"height",0);kt(this,"scrollHeight",0);kt(this,"scrollWidth",0);kt(this,"debouncedResize");kt(this,"wrapperResizeObserver");kt(this,"contentResizeObserver");kt(this,"resize",()=>{this.onWrapperResize(),this.onContentResize()});kt(this,"onWrapperResize",()=>{this.wrapper instanceof Window?(this.width=window.innerWidth,this.height=window.innerHeight):(this.width=this.wrapper.clientWidth,this.height=this.wrapper.clientHeight)});kt(this,"onContentResize",()=>{this.wrapper instanceof Window?(this.scrollHeight=this.content.scrollHeight,this.scrollWidth=this.content.scrollWidth):(this.scrollHeight=this.wrapper.scrollHeight,this.scrollWidth=this.wrapper.scrollWidth)});this.wrapper=i,this.content=e,t&&(this.debouncedResize=Ck(this.resize,n),this.wrapper instanceof Window?window.addEventListener("resize",this.debouncedResize):(this.wrapperResizeObserver=new ResizeObserver(this.debouncedResize),this.wrapperResizeObserver.observe(this.wrapper)),this.contentResizeObserver=new ResizeObserver(this.debouncedResize),this.contentResizeObserver.observe(this.content)),this.resize()}destroy(){var i,e;(i=this.wrapperResizeObserver)==null||i.disconnect(),(e=this.contentResizeObserver)==null||e.disconnect(),this.wrapper===window&&this.debouncedResize&&window.removeEventListener("resize",this.debouncedResize)}get limit(){return{x:this.scrollWidth-this.width,y:this.scrollHeight-this.height}}},BU=class{constructor(){kt(this,"events",{})}emit(i,...e){var n;const t=this.events[i]||[];for(let r=0,s=t.length;r{var t;this.events[i]=(t=this.events[i])==null?void 0:t.filter(n=>e!==n)}}off(i,e){var t;this.events[i]=(t=this.events[i])==null?void 0:t.filter(n=>e!==n)}destroy(){this.events={}}},Dk=100/6,mf={passive:!1};function M3(i,e){return i===1?Dk:i===2?e:1}var Nk=class{constructor(i,e={wheelMultiplier:1,touchMultiplier:1}){kt(this,"touchStart",{x:0,y:0});kt(this,"lastDelta",{x:0,y:0});kt(this,"window",{width:0,height:0});kt(this,"emitter",new BU);kt(this,"onTouchStart",i=>{const{clientX:e,clientY:t}=i.targetTouches?i.targetTouches[0]:i;this.touchStart.x=e,this.touchStart.y=t,this.lastDelta={x:0,y:0},this.emitter.emit("scroll",{deltaX:0,deltaY:0,event:i})});kt(this,"onTouchMove",i=>{const{clientX:e,clientY:t}=i.targetTouches?i.targetTouches[0]:i,n=-(e-this.touchStart.x)*this.options.touchMultiplier,r=-(t-this.touchStart.y)*this.options.touchMultiplier;this.touchStart.x=e,this.touchStart.y=t,this.lastDelta={x:n,y:r},this.emitter.emit("scroll",{deltaX:n,deltaY:r,event:i})});kt(this,"onTouchEnd",i=>{this.emitter.emit("scroll",{deltaX:this.lastDelta.x,deltaY:this.lastDelta.y,event:i})});kt(this,"onWheel",i=>{let{deltaX:e,deltaY:t,deltaMode:n}=i;const r=M3(n,this.window.width),s=M3(n,this.window.height);e*=r,t*=s,e*=this.options.wheelMultiplier,t*=this.options.wheelMultiplier,this.emitter.emit("scroll",{deltaX:e,deltaY:t,event:i})});kt(this,"onWindowResize",()=>{this.window={width:window.innerWidth,height:window.innerHeight}});this.element=i,this.options=e,window.addEventListener("resize",this.onWindowResize),this.onWindowResize(),this.element.addEventListener("wheel",this.onWheel,mf),this.element.addEventListener("touchstart",this.onTouchStart,mf),this.element.addEventListener("touchmove",this.onTouchMove,mf),this.element.addEventListener("touchend",this.onTouchEnd,mf)}on(i,e){return this.emitter.on(i,e)}destroy(){this.emitter.destroy(),window.removeEventListener("resize",this.onWindowResize),this.element.removeEventListener("wheel",this.onWheel,mf),this.element.removeEventListener("touchstart",this.onTouchStart,mf),this.element.removeEventListener("touchmove",this.onTouchMove,mf),this.element.removeEventListener("touchend",this.onTouchEnd,mf)}},w3=i=>Math.min(1,1.001-2**(-10*i)),Uk=class{constructor({wrapper:i=window,content:e=document.documentElement,eventsTarget:t=i,smoothWheel:n=!0,syncTouch:r=!1,syncTouchLerp:s=.075,touchInertiaExponent:a=1.7,duration:l,easing:c,lerp:h=.1,infinite:p=!1,orientation:g="vertical",gestureOrientation:v=g==="horizontal"?"both":"vertical",touchMultiplier:x=1,wheelMultiplier:b=1,autoResize:w=!0,prevent:S,virtualScroll:M,overscroll:A=!0,autoRaf:D=!1,anchors:R=!1,autoToggle:I=!1,allowNestedScroll:P=!1,__experimental__naiveDimensions:F=!1,naiveDimensions:N=F,stopInertiaOnNavigate:L=!1}={}){kt(this,"_isScrolling",!1);kt(this,"_isStopped",!1);kt(this,"_isLocked",!1);kt(this,"_preventNextNativeScrollEvent",!1);kt(this,"_resetVelocityTimeout",null);kt(this,"_rafId",null);kt(this,"isTouching");kt(this,"time",0);kt(this,"userData",{});kt(this,"lastVelocity",0);kt(this,"velocity",0);kt(this,"direction",0);kt(this,"options");kt(this,"targetScroll");kt(this,"animatedScroll");kt(this,"animate",new Ak);kt(this,"emitter",new BU);kt(this,"dimensions");kt(this,"virtualScroll");kt(this,"onScrollEnd",i=>{i instanceof CustomEvent||(this.isScrolling==="smooth"||this.isScrolling===!1)&&i.stopPropagation()});kt(this,"dispatchScrollendEvent",()=>{this.options.wrapper.dispatchEvent(new CustomEvent("scrollend",{bubbles:this.options.wrapper===window,detail:{lenisScrollEnd:!0}}))});kt(this,"onTransitionEnd",i=>{i.propertyName.includes("overflow")&&this.checkOverflow()});kt(this,"onClick",i=>{const n=i.composedPath().filter(s=>s instanceof HTMLAnchorElement&&s.href).map(s=>new URL(s.href)),r=new URL(window.location.href);if(this.options.anchors){const s=n.find(a=>r.host===a.host&&r.pathname===a.pathname&&a.hash);if(s){const a=typeof this.options.anchors=="object"&&this.options.anchors?this.options.anchors:void 0,l=`#${s.hash.split("#")[1]}`;this.scrollTo(l,a);return}}if(this.options.stopInertiaOnNavigate&&n.some(a=>r.host===a.host&&r.pathname!==a.pathname)){this.reset();return}});kt(this,"onPointerDown",i=>{i.button===1&&this.reset()});kt(this,"onVirtualScroll",i=>{if(typeof this.options.virtualScroll=="function"&&this.options.virtualScroll(i)===!1)return;const{deltaX:e,deltaY:t,event:n}=i;if(this.emitter.emit("virtual-scroll",{deltaX:e,deltaY:t,event:n}),n.ctrlKey||n.lenisStopPropagation)return;const r=n.type.includes("touch"),s=n.type.includes("wheel");this.isTouching=n.type==="touchstart"||n.type==="touchmove";const a=e===0&&t===0;if(this.options.syncTouch&&r&&n.type==="touchstart"&&a&&!this.isStopped&&!this.isLocked){this.reset();return}const c=this.options.gestureOrientation==="vertical"&&t===0||this.options.gestureOrientation==="horizontal"&&e===0;if(a||c)return;let h=n.composedPath();h=h.slice(0,h.indexOf(this.rootElement));const p=this.options.prevent,g=Math.abs(e)>=Math.abs(t)?"horizontal":"vertical";if(h.find(M=>{var A,D,R,I,P;return M instanceof HTMLElement&&(typeof p=="function"&&(p==null?void 0:p(M))||((A=M.hasAttribute)==null?void 0:A.call(M,"data-lenis-prevent"))||g==="vertical"&&((D=M.hasAttribute)==null?void 0:D.call(M,"data-lenis-prevent-vertical"))||g==="horizontal"&&((R=M.hasAttribute)==null?void 0:R.call(M,"data-lenis-prevent-horizontal"))||r&&((I=M.hasAttribute)==null?void 0:I.call(M,"data-lenis-prevent-touch"))||s&&((P=M.hasAttribute)==null?void 0:P.call(M,"data-lenis-prevent-wheel"))||this.options.allowNestedScroll&&this.hasNestedScroll(M,{deltaX:e,deltaY:t}))}))return;if(this.isStopped||this.isLocked){n.cancelable&&n.preventDefault();return}if(!(this.options.syncTouch&&r||this.options.smoothWheel&&s)){this.isScrolling="native",this.animate.stop(),n.lenisStopPropagation=!0;return}let x=t;this.options.gestureOrientation==="both"?x=Math.abs(t)>Math.abs(e)?t:e:this.options.gestureOrientation==="horizontal"&&(x=e),(!this.options.overscroll||this.options.infinite||this.options.wrapper!==window&&this.limit>0&&(this.animatedScroll>0&&this.animatedScroll0||this.animatedScroll===this.limit&&t<0))&&(n.lenisStopPropagation=!0),n.cancelable&&n.preventDefault();const b=r&&this.options.syncTouch,S=r&&n.type==="touchend";S&&(x=Math.sign(this.velocity)*Math.abs(this.velocity)**this.options.touchInertiaExponent),this.scrollTo(this.targetScroll+x,{programmatic:!1,...b?{lerp:S?this.options.syncTouchLerp:1}:{lerp:this.options.lerp,duration:this.options.duration,easing:this.options.easing}})});kt(this,"onNativeScroll",()=>{if(this._resetVelocityTimeout!==null&&(clearTimeout(this._resetVelocityTimeout),this._resetVelocityTimeout=null),this._preventNextNativeScrollEvent){this._preventNextNativeScrollEvent=!1;return}if(this.isScrolling===!1||this.isScrolling==="native"){const i=this.animatedScroll;this.animatedScroll=this.targetScroll=this.actualScroll,this.lastVelocity=this.velocity,this.velocity=this.animatedScroll-i,this.direction=Math.sign(this.animatedScroll-i),this.isStopped||(this.isScrolling="native"),this.emit(),this.velocity!==0&&(this._resetVelocityTimeout=setTimeout(()=>{this.lastVelocity=this.velocity,this.velocity=0,this.isScrolling=!1,this.emit()},400))}});kt(this,"raf",i=>{const e=i-(this.time||i);this.time=i,this.animate.advance(e*.001),this.options.autoRaf&&(this._rafId=requestAnimationFrame(this.raf))});window.lenisVersion=S3,window.lenis||(window.lenis={}),window.lenis.version=S3,g==="horizontal"&&(window.lenis.horizontal=!0),r===!0&&(window.lenis.touch=!0),(!i||i===document.documentElement)&&(i=window),typeof l=="number"&&typeof c!="function"?c=w3:typeof c=="function"&&typeof l!="number"&&(l=1),this.options={wrapper:i,content:e,eventsTarget:t,smoothWheel:n,syncTouch:r,syncTouchLerp:s,touchInertiaExponent:a,duration:l,easing:c,lerp:h,infinite:p,gestureOrientation:v,orientation:g,touchMultiplier:x,wheelMultiplier:b,autoResize:w,prevent:S,virtualScroll:M,overscroll:A,autoRaf:D,anchors:R,autoToggle:I,allowNestedScroll:P,naiveDimensions:N,stopInertiaOnNavigate:L},this.dimensions=new Rk(i,e,{autoResize:w}),this.updateClassName(),this.targetScroll=this.animatedScroll=this.actualScroll,this.options.wrapper.addEventListener("scroll",this.onNativeScroll),this.options.wrapper.addEventListener("scrollend",this.onScrollEnd,{capture:!0}),(this.options.anchors||this.options.stopInertiaOnNavigate)&&this.options.wrapper.addEventListener("click",this.onClick),this.options.wrapper.addEventListener("pointerdown",this.onPointerDown),this.virtualScroll=new Nk(t,{touchMultiplier:x,wheelMultiplier:b}),this.virtualScroll.on("scroll",this.onVirtualScroll),this.options.autoToggle&&(this.checkOverflow(),this.rootElement.addEventListener("transitionend",this.onTransitionEnd)),this.options.autoRaf&&(this._rafId=requestAnimationFrame(this.raf))}destroy(){this.emitter.destroy(),this.options.wrapper.removeEventListener("scroll",this.onNativeScroll),this.options.wrapper.removeEventListener("scrollend",this.onScrollEnd,{capture:!0}),this.options.wrapper.removeEventListener("pointerdown",this.onPointerDown),(this.options.anchors||this.options.stopInertiaOnNavigate)&&this.options.wrapper.removeEventListener("click",this.onClick),this.virtualScroll.destroy(),this.dimensions.destroy(),this.cleanUpClassName(),this._rafId&&cancelAnimationFrame(this._rafId)}on(i,e){return this.emitter.on(i,e)}off(i,e){return this.emitter.off(i,e)}get overflow(){const i=this.isHorizontal?"overflow-x":"overflow-y";return getComputedStyle(this.rootElement)[i]}checkOverflow(){["hidden","clip"].includes(this.overflow)?this.internalStop():this.internalStart()}setScroll(i){this.isHorizontal?this.options.wrapper.scrollTo({left:i,behavior:"instant"}):this.options.wrapper.scrollTo({top:i,behavior:"instant"})}resize(){this.dimensions.resize(),this.animatedScroll=this.targetScroll=this.actualScroll,this.emit()}emit(){this.emitter.emit("scroll",this)}reset(){this.isLocked=!1,this.isScrolling=!1,this.animatedScroll=this.targetScroll=this.actualScroll,this.lastVelocity=this.velocity=0,this.animate.stop()}start(){if(this.isStopped){if(this.options.autoToggle){this.rootElement.style.removeProperty("overflow");return}this.internalStart()}}internalStart(){this.isStopped&&(this.reset(),this.isStopped=!1,this.emit())}stop(){if(!this.isStopped){if(this.options.autoToggle){this.rootElement.style.setProperty("overflow","clip");return}this.internalStop()}}internalStop(){this.isStopped||(this.reset(),this.isStopped=!0,this.emit())}scrollTo(i,{offset:e=0,immediate:t=!1,lock:n=!1,programmatic:r=!0,lerp:s=r?this.options.lerp:void 0,duration:a=r?this.options.duration:void 0,easing:l=r?this.options.easing:void 0,onStart:c,onComplete:h,force:p=!1,userData:g}={}){if((this.isStopped||this.isLocked)&&!p)return;let v=i,x=e;if(typeof v=="string"&&["top","left","start","#"].includes(v))v=0;else if(typeof v=="string"&&["bottom","right","end"].includes(v))v=this.limit;else{let b=null;if(typeof v=="string"?(b=document.querySelector(v),b||(v==="#top"?v=0:console.warn("Lenis: Target not found",v))):v instanceof HTMLElement&&(v!=null&&v.nodeType)&&(b=v),b){if(this.options.wrapper!==window){const S=this.rootElement.getBoundingClientRect();x-=this.isHorizontal?S.left:S.top}const w=b.getBoundingClientRect();v=(this.isHorizontal?w.left:w.top)+this.animatedScroll}}if(typeof v=="number"){if(v+=x,v=Math.round(v),this.options.infinite){if(r){this.targetScroll=this.animatedScroll=this.scroll;const b=v-this.animatedScroll;b>this.limit/2?v-=this.limit:b<-this.limit/2&&(v+=this.limit)}}else v=zU(0,v,this.limit);if(v===this.targetScroll){c==null||c(this),h==null||h(this);return}if(this.userData=g??{},t){this.animatedScroll=this.targetScroll=v,this.setScroll(this.scroll),this.reset(),this.preventNextNativeScrollEvent(),this.emit(),h==null||h(this),this.userData={},requestAnimationFrame(()=>{this.dispatchScrollendEvent()});return}r||(this.targetScroll=v),typeof a=="number"&&typeof l!="function"?l=w3:typeof l=="function"&&typeof a!="number"&&(a=1),this.animate.fromTo(this.animatedScroll,v,{duration:a,easing:l,lerp:s,onStart:()=>{n&&(this.isLocked=!0),this.isScrolling="smooth",c==null||c(this)},onUpdate:(b,w)=>{this.isScrolling="smooth",this.lastVelocity=this.velocity,this.velocity=b-this.animatedScroll,this.direction=Math.sign(this.velocity),this.animatedScroll=b,this.setScroll(this.scroll),r&&(this.targetScroll=b),w||this.emit(),w&&(this.reset(),this.emit(),h==null||h(this),this.userData={},requestAnimationFrame(()=>{this.dispatchScrollendEvent()}),this.preventNextNativeScrollEvent())}})}}preventNextNativeScrollEvent(){this._preventNextNativeScrollEvent=!0,requestAnimationFrame(()=>{this._preventNextNativeScrollEvent=!1})}hasNestedScroll(i,{deltaX:e,deltaY:t}){const n=Date.now();i._lenis||(i._lenis={});const r=i._lenis;let s,a,l,c,h,p,g,v,x,b;if(n-(r.time??0)>2e3){r.time=Date.now();const F=window.getComputedStyle(i);if(r.computedStyle=F,s=["auto","overlay","scroll"].includes(F.overflowX),a=["auto","overlay","scroll"].includes(F.overflowY),h=["auto"].includes(F.overscrollBehaviorX),p=["auto"].includes(F.overscrollBehaviorY),r.hasOverflowX=s,r.hasOverflowY=a,!(s||a))return!1;g=i.scrollWidth,v=i.scrollHeight,x=i.clientWidth,b=i.clientHeight,l=g>x,c=v>b,r.isScrollableX=l,r.isScrollableY=c,r.scrollWidth=g,r.scrollHeight=v,r.clientWidth=x,r.clientHeight=b,r.hasOverscrollBehaviorX=h,r.hasOverscrollBehaviorY=p}else l=r.isScrollableX,c=r.isScrollableY,s=r.hasOverflowX,a=r.hasOverflowY,g=r.scrollWidth,v=r.scrollHeight,x=r.clientWidth,b=r.clientHeight,h=r.hasOverscrollBehaviorX,p=r.hasOverscrollBehaviorY;if(!(s&&l||a&&c))return!1;const w=Math.abs(e)>=Math.abs(t)?"horizontal":"vertical";let S,M,A,D,R,I;if(w==="horizontal")S=Math.round(i.scrollLeft),M=g-x,A=e,D=s,R=l,I=h;else if(w==="vertical")S=Math.round(i.scrollTop),M=v-b,A=t,D=a,R=c,I=p;else return!1;return!I&&(S>=M||S<=0)?!0:(A>0?S0)&&D&&R}get rootElement(){return this.options.wrapper===window?document.documentElement:this.options.wrapper}get limit(){return this.options.naiveDimensions?this.isHorizontal?this.rootElement.scrollWidth-this.rootElement.clientWidth:this.rootElement.scrollHeight-this.rootElement.clientHeight:this.dimensions.limit[this.isHorizontal?"x":"y"]}get isHorizontal(){return this.options.orientation==="horizontal"}get actualScroll(){const i=this.options.wrapper;return this.isHorizontal?i.scrollX??i.scrollLeft:i.scrollY??i.scrollTop}get scroll(){return this.options.infinite?Ek(this.animatedScroll,this.limit):this.animatedScroll}get progress(){return this.limit===0?1:this.scroll/this.limit}get isScrolling(){return this._isScrolling}set isScrolling(i){this._isScrolling!==i&&(this._isScrolling=i,this.updateClassName())}get isStopped(){return this._isStopped}set isStopped(i){this._isStopped!==i&&(this._isStopped=i,this.updateClassName())}get isLocked(){return this._isLocked}set isLocked(i){this._isLocked!==i&&(this._isLocked=i,this.updateClassName())}get isSmooth(){return this.isScrolling==="smooth"}get className(){let i="lenis";return this.options.autoToggle&&(i+=" lenis-autoToggle"),this.isStopped&&(i+=" lenis-stopped"),this.isLocked&&(i+=" lenis-locked"),this.isScrolling&&(i+=" lenis-scrolling"),this.isScrolling==="smooth"&&(i+=" lenis-smooth"),i}updateClassName(){this.cleanUpClassName(),this.rootElement.className=`${this.rootElement.className} ${this.className}`.trim()}cleanUpClassName(){this.rootElement.className=this.rootElement.className.replace(/lenis(-\w+)?/g,"").trim()}};const SE=ae.createContext({});function zf(i){const e=ae.useRef(null);return e.current===null&&(e.current=i()),e.current}const Lk=typeof window<"u",Bb=Lk?ae.useLayoutEffect:ae.useEffect,Vb=ae.createContext(null);function ME(i,e){i.indexOf(e)===-1&&i.push(e)}function M1(i,e){const t=i.indexOf(e);t>-1&&i.splice(t,1)}const Ll=(i,e,t)=>t>e?e:t{};const Bf={},VU=i=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(i);function GU(i){return typeof i=="object"&&i!==null}const HU=i=>/^0[^.\s]+$/u.test(i);function WU(i){let e;return()=>(e===void 0&&(e=i()),e)}const ka=i=>i,Ik=(i,e)=>t=>e(i(t)),ny=(...i)=>i.reduce(Ik),Rm=(i,e,t)=>{const n=e-i;return n===0?1:(t-i)/n};class wE{constructor(){this.subscriptions=[]}add(e){return ME(this.subscriptions,e),()=>M1(this.subscriptions,e)}notify(e,t,n){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let s=0;si*1e3,Zo=i=>i/1e3;function TE(i,e){return e?i*(1e3/e):0}const jU=(i,e,t)=>(((1-3*t+3*e)*i+(3*t-6*e))*i+3*e)*i,Pk=1e-7,Ok=12;function Fk(i,e,t,n,r){let s,a,l=0;do a=e+(t-e)/2,s=jU(a,n,r)-i,s>0?t=a:e=a;while(Math.abs(s)>Pk&&++lFk(s,0,1,i,t);return s=>s===0||s===1?s:jU(r(s),e,n)}const XU=i=>e=>e<=.5?i(2*e)/2:(2-i(2*(1-e)))/2,YU=i=>e=>1-i(1-e),qU=iy(.33,1.53,.69,.99),EE=YU(qU),ZU=XU(EE),KU=i=>i>=1?1:(i*=2)<1?.5*EE(i):.5*(2-Math.pow(2,-10*(i-1))),AE=i=>1-Math.sin(Math.acos(i)),QU=YU(AE),JU=XU(AE),kk=iy(.42,0,1,1),zk=iy(0,0,.58,1),$U=iy(.42,0,.58,1),Bk=i=>Array.isArray(i)&&typeof i[0]!="number",eL=i=>Array.isArray(i)&&typeof i[0]=="number",Vk={linear:ka,easeIn:kk,easeInOut:$U,easeOut:zk,circIn:AE,circInOut:JU,circOut:QU,backIn:EE,backInOut:ZU,backOut:qU,anticipate:KU},Gk=i=>typeof i=="string",T3=i=>{if(eL(i)){Mv(i.length===4);const[e,t,n,r]=i;return iy(e,t,n,r)}else if(Gk(i))return Vk[i];return i},e_=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Hk(i,e){let t=new Set,n=new Set,r=!1,s=!1;const a=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1};function c(p){a.has(p)&&(h.schedule(p),i()),p(l)}const h={schedule:(p,g=!1,v=!1)=>{const b=v&&r?t:n;return g&&a.add(p),b.add(p),p},cancel:p=>{n.delete(p),a.delete(p)},process:p=>{if(l=p,r){s=!0;return}r=!0;const g=t;t=n,n=g,t.forEach(c),t.clear(),r=!1,s&&(s=!1,h.process(p))}};return h}const Wk=40;function tL(i,e){let t=!1,n=!0;const r={delta:0,timestamp:0,isProcessing:!1},s=()=>t=!0,a=e_.reduce((D,R)=>(D[R]=Hk(s),D),{}),{setup:l,read:c,resolveKeyframes:h,preUpdate:p,update:g,preRender:v,render:x,postRender:b}=a,w=()=>{const D=Bf.useManualTiming,R=D?r.timestamp:performance.now();t=!1,D||(r.delta=n?1e3/60:Math.max(Math.min(R-r.timestamp,Wk),1)),r.timestamp=R,r.isProcessing=!0,l.process(r),c.process(r),h.process(r),p.process(r),g.process(r),v.process(r),x.process(r),b.process(r),r.isProcessing=!1,t&&e&&(n=!1,i(w))},S=()=>{t=!0,n=!0,r.isProcessing||i(w)};return{schedule:e_.reduce((D,R)=>{const I=a[R];return D[R]=(P,F=!1,N=!1)=>(t||S(),I.schedule(P,F,N)),D},{}),cancel:D=>{for(let R=0;R(o1===void 0&&la.set(ts.isProcessing||Bf.useManualTiming?ts.timestamp:performance.now()),o1),set:i=>{o1=i,queueMicrotask(jk)}},nL=i=>e=>typeof e=="string"&&e.startsWith(i),iL=nL("--"),Xk=nL("var(--"),CE=i=>Xk(i)?Yk.test(i.split("/*")[0].trim()):!1,Yk=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function E3(i){return typeof i!="string"?!1:i.split("/*")[0].includes("var(--")}const Xm={test:i=>typeof i=="number",parse:parseFloat,transform:i=>i},wv={...Xm,transform:i=>Ll(0,1,i)},t_={...Xm,default:1},ev=i=>Math.round(i*1e5)/1e5,RE=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function qk(i){return i==null}const Zk=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,DE=(i,e)=>t=>!!(typeof t=="string"&&Zk.test(t)&&t.startsWith(i)||e&&!qk(t)&&Object.prototype.hasOwnProperty.call(t,e)),rL=(i,e,t)=>n=>{if(typeof n!="string")return n;const[r,s,a,l]=n.match(RE);return{[i]:parseFloat(r),[e]:parseFloat(s),[t]:parseFloat(a),alpha:l!==void 0?parseFloat(l):1}},Kk=i=>Ll(0,255,i),SM={...Xm,transform:i=>Math.round(Kk(i))},rd={test:DE("rgb","red"),parse:rL("red","green","blue"),transform:({red:i,green:e,blue:t,alpha:n=1})=>"rgba("+SM.transform(i)+", "+SM.transform(e)+", "+SM.transform(t)+", "+ev(wv.transform(n))+")"};function Qk(i){let e="",t="",n="",r="";return i.length>5?(e=i.substring(1,3),t=i.substring(3,5),n=i.substring(5,7),r=i.substring(7,9)):(e=i.substring(1,2),t=i.substring(2,3),n=i.substring(3,4),r=i.substring(4,5),e+=e,t+=t,n+=n,r+=r),{red:parseInt(e,16),green:parseInt(t,16),blue:parseInt(n,16),alpha:r?parseInt(r,16)/255:1}}const eT={test:DE("#"),parse:Qk,transform:rd.transform},ry=i=>({test:e=>typeof e=="string"&&e.endsWith(i)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${i}`}),Tf=ry("deg"),Nu=ry("%"),qt=ry("px"),Jk=ry("vh"),$k=ry("vw"),A3={...Nu,parse:i=>Nu.parse(i)/100,transform:i=>Nu.transform(i*100)},pm={test:DE("hsl","hue"),parse:rL("hue","saturation","lightness"),transform:({hue:i,saturation:e,lightness:t,alpha:n=1})=>"hsla("+Math.round(i)+", "+Nu.transform(ev(e))+", "+Nu.transform(ev(t))+", "+ev(wv.transform(n))+")"},Pr={test:i=>rd.test(i)||eT.test(i)||pm.test(i),parse:i=>rd.test(i)?rd.parse(i):pm.test(i)?pm.parse(i):eT.parse(i),transform:i=>typeof i=="string"?i:i.hasOwnProperty("red")?rd.transform(i):pm.transform(i),getAnimatableNone:i=>{const e=Pr.parse(i);return e.alpha=0,Pr.transform(e)}},ez=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function tz(i){var e,t;return isNaN(i)&&typeof i=="string"&&(((e=i.match(RE))==null?void 0:e.length)||0)+(((t=i.match(ez))==null?void 0:t.length)||0)>0}const sL="number",aL="color",nz="var",iz="var(",C3="${}",rz=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Dm(i){const e=i.toString(),t=[],n={color:[],number:[],var:[]},r=[];let s=0;const l=e.replace(rz,c=>(Pr.test(c)?(n.color.push(s),r.push(aL),t.push(Pr.parse(c))):c.startsWith(iz)?(n.var.push(s),r.push(nz),t.push(c)):(n.number.push(s),r.push(sL),t.push(parseFloat(c))),++s,C3)).split(C3);return{values:t,split:l,indexes:n,types:r}}function sz(i){return Dm(i).values}function oL({split:i,types:e}){const t=i.length;return n=>{let r="";for(let s=0;stypeof i=="number"?0:Pr.test(i)?Pr.getAnimatableNone(i):i,lz=(i,e)=>typeof i=="number"?e!=null&&e.trim().endsWith("/")?i:0:oz(i);function uz(i){const e=Dm(i);return oL(e)(e.values.map((n,r)=>lz(n,e.split[r])))}const Dl={test:tz,parse:sz,createTransformer:az,getAnimatableNone:uz};function MM(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*(2/3-t)*6:i}function cz({hue:i,saturation:e,lightness:t,alpha:n}){i/=360,e/=100,t/=100;let r=0,s=0,a=0;if(!e)r=s=a=t;else{const l=t<.5?t*(1+e):t+e-t*e,c=2*t-l;r=MM(c,l,i+1/3),s=MM(c,l,i),a=MM(c,l,i-1/3)}return{red:Math.round(r*255),green:Math.round(s*255),blue:Math.round(a*255),alpha:n}}function w1(i,e){return t=>t>0?e:i}const Bi=(i,e,t)=>i+(e-i)*t,wM=(i,e,t)=>{const n=i*i,r=t*(e*e-n)+n;return r<0?0:Math.sqrt(r)},fz=[eT,rd,pm],hz=i=>fz.find(e=>e.test(i));function R3(i){const e=hz(i);if(!e)return!1;let t=e.parse(i);return e===pm&&(t=cz(t)),t}const D3=(i,e)=>{const t=R3(i),n=R3(e);if(!t||!n)return w1(i,e);const r={...t};return s=>(r.red=wM(t.red,n.red,s),r.green=wM(t.green,n.green,s),r.blue=wM(t.blue,n.blue,s),r.alpha=Bi(t.alpha,n.alpha,s),rd.transform(r))},tT=new Set(["none","hidden"]);function dz(i,e){return tT.has(i)?t=>t<=0?i:e:t=>t>=1?e:i}function pz(i,e){return t=>Bi(i,e,t)}function NE(i){return typeof i=="number"?pz:typeof i=="string"?CE(i)?w1:Pr.test(i)?D3:vz:Array.isArray(i)?lL:typeof i=="object"?Pr.test(i)?D3:mz:w1}function lL(i,e){const t=[...i],n=t.length,r=i.map((s,a)=>NE(s)(s,e[a]));return s=>{for(let a=0;a{for(const s in n)t[s]=n[s](r);return t}}function gz(i,e){const t=[],n={color:0,var:0,number:0};for(let r=0;r{const t=Dl.createTransformer(e),n=Dm(i),r=Dm(e);return n.indexes.var.length===r.indexes.var.length&&n.indexes.color.length===r.indexes.color.length&&n.indexes.number.length>=r.indexes.number.length?tT.has(i)&&!r.values.length||tT.has(e)&&!n.values.length?dz(i,e):ny(lL(gz(n,r),r.values),t):w1(i,e)};function uL(i,e,t){return typeof i=="number"&&typeof e=="number"&&typeof t=="number"?Bi(i,e,t):NE(i)(i,e)}const yz=i=>{const e=({timestamp:t})=>i(t);return{start:(t=!0)=>Kn.update(e,t),stop:()=>el(e),now:()=>ts.isProcessing?ts.timestamp:la.now()}},cL=(i,e,t=10)=>{let n="";const r=Math.max(Math.round(e/t),2);for(let s=0;s=T1?1/0:e}function xz(i,e=100,t){const n=t({...i,keyframes:[0,e]}),r=Math.min(UE(n),T1);return{type:"keyframes",ease:s=>n.next(r*s).value/e,duration:Zo(r)}}const pr={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function nT(i,e){return i*Math.sqrt(1-e*e)}const _z=12;function bz(i,e,t){let n=t;for(let r=1;r<_z;r++)n=n-i(n)/e(n);return n}const TM=.001;function Sz({duration:i=pr.duration,bounce:e=pr.bounce,velocity:t=pr.velocity,mass:n=pr.mass}){let r,s,a=1-e;a=Ll(pr.minDamping,pr.maxDamping,a),i=Ll(pr.minDuration,pr.maxDuration,Zo(i)),a<1?(r=h=>{const p=h*a,g=p*i,v=p-t,x=nT(h,a),b=Math.exp(-g);return TM-v/x*b},s=h=>{const g=h*a*i,v=g*t+t,x=Math.pow(a,2)*Math.pow(h,2)*i,b=Math.exp(-g),w=nT(Math.pow(h,2),a);return(-r(h)+TM>0?-1:1)*((v-x)*b)/w}):(r=h=>{const p=Math.exp(-h*i),g=(h-t)*i+1;return-TM+p*g},s=h=>{const p=Math.exp(-h*i),g=(t-h)*(i*i);return p*g});const l=5/i,c=bz(r,s,l);if(i=oo(i),isNaN(c))return{stiffness:pr.stiffness,damping:pr.damping,duration:i};{const h=Math.pow(c,2)*n;return{stiffness:h,damping:a*2*Math.sqrt(n*h),duration:i}}}const Mz=["duration","bounce"],wz=["stiffness","damping","mass"];function N3(i,e){return e.some(t=>i[t]!==void 0)}function Tz(i){let e={velocity:pr.velocity,stiffness:pr.stiffness,damping:pr.damping,mass:pr.mass,isResolvedFromDuration:!1,...i};if(!N3(i,wz)&&N3(i,Mz))if(e.velocity=0,i.visualDuration){const t=i.visualDuration,n=2*Math.PI/(t*1.2),r=n*n,s=2*Ll(.05,1,1-(i.bounce||0))*Math.sqrt(r);e={...e,mass:pr.mass,stiffness:r,damping:s}}else{const t=Sz({...i,velocity:0});e={...e,...t,mass:pr.mass},e.isResolvedFromDuration=!0}return e}function E1(i=pr.visualDuration,e=pr.bounce){const t=typeof i!="object"?{visualDuration:i,keyframes:[0,1],bounce:e}:i;let{restSpeed:n,restDelta:r}=t;const s=t.keyframes[0],a=t.keyframes[t.keyframes.length-1],l={done:!1,value:s},{stiffness:c,damping:h,mass:p,duration:g,velocity:v,isResolvedFromDuration:x}=Tz({...t,velocity:-Zo(t.velocity||0)}),b=v||0,w=h/(2*Math.sqrt(c*p)),S=a-s,M=Zo(Math.sqrt(c/p)),A=Math.abs(S)<5;n||(n=A?pr.restSpeed.granular:pr.restSpeed.default),r||(r=A?pr.restDelta.granular:pr.restDelta.default);let D,R,I,P,F,N;if(w<1)I=nT(M,w),P=(b+w*M*S)/I,D=G=>{const X=Math.exp(-w*M*G);return a-X*(P*Math.sin(I*G)+S*Math.cos(I*G))},F=w*M*P+S*I,N=w*M*S-P*I,R=G=>Math.exp(-w*M*G)*(F*Math.sin(I*G)+N*Math.cos(I*G));else if(w===1){D=X=>a-Math.exp(-M*X)*(S+(b+M*S)*X);const G=b+M*S;R=X=>Math.exp(-M*X)*(M*G*X-b)}else{const G=M*Math.sqrt(w*w-1);D=K=>{const ne=Math.exp(-w*M*K),j=Math.min(G*K,300);return a-ne*((b+w*M*S)*Math.sinh(j)+G*S*Math.cosh(j))/G};const X=(b+w*M*S)/G,W=w*M*X-S*G,q=w*M*S-X*G;R=K=>{const ne=Math.exp(-w*M*K),j=Math.min(G*K,300);return ne*(W*Math.sinh(j)+q*Math.cosh(j))}}const L={calculatedDuration:x&&g||null,velocity:G=>oo(R(G)),next:G=>{if(!x&&w<1){const W=Math.exp(-w*M*G),q=Math.sin(I*G),K=Math.cos(I*G),ne=a-W*(P*q+S*K),j=oo(W*(F*q+N*K));return l.done=Math.abs(j)<=n&&Math.abs(a-ne)<=r,l.value=l.done?a:ne,l}const X=D(G);if(x)l.done=G>=g;else{const W=oo(R(G));l.done=Math.abs(W)<=n&&Math.abs(a-X)<=r}return l.value=l.done?a:X,l},toString:()=>{const G=Math.min(UE(L),T1),X=cL(W=>L.next(G*W).value,G,30);return G+"ms "+X},toTransition:()=>{}};return L}E1.applyToOptions=i=>{const e=xz(i,100,E1);return i.ease=e.ease,i.duration=oo(e.duration),i.type="keyframes",i};const Ez=5;function fL(i,e,t){const n=Math.max(e-Ez,0);return TE(t-i(n),e-n)}function iT({keyframes:i,velocity:e=0,power:t=.8,timeConstant:n=325,bounceDamping:r=10,bounceStiffness:s=500,modifyTarget:a,min:l,max:c,restDelta:h=.5,restSpeed:p}){const g=i[0],v={done:!1,value:g},x=N=>l!==void 0&&Nc,b=N=>l===void 0?c:c===void 0||Math.abs(l-N)-w*Math.exp(-N/n),D=N=>M+A(N),R=N=>{const L=A(N),G=D(N);v.done=Math.abs(L)<=h,v.value=v.done?M:G};let I,P;const F=N=>{x(v.value)&&(I=N,P=E1({keyframes:[v.value,b(v.value)],velocity:fL(D,N,v.value),damping:r,stiffness:s,restDelta:h,restSpeed:p}))};return F(0),{calculatedDuration:null,next:N=>{let L=!1;return!P&&I===void 0&&(L=!0,R(N),F(N)),I!==void 0&&N>=I?P.next(N-I):(!L&&R(N),v)}}}function Az(i,e,t){const n=[],r=t||Bf.mix||uL,s=i.length-1;for(let a=0;ae[0];if(s===2&&e[0]===e[1])return()=>e[1];const a=i[0]===i[1];i[0]>i[s-1]&&(i=[...i].reverse(),e=[...e].reverse());const l=Az(e,n,r),c=l.length,h=p=>{if(a&&p1)for(;gh(Ll(i[0],i[s-1],p)):h}function Cz(i,e){const t=i[i.length-1];for(let n=1;n<=e;n++){const r=Rm(0,e,n);i.push(Bi(t,1,r))}}function hL(i){const e=[0];return Cz(e,i.length-1),e}function Rz(i,e){return i.map(t=>t*e)}function Dz(i,e){return i.map(()=>e||$U).splice(0,i.length-1)}function tv({duration:i=300,keyframes:e,times:t,ease:n="easeInOut"}){const r=Bk(n)?n.map(T3):T3(n),s={done:!1,value:e[0]},a=Rz(t&&t.length===e.length?t:hL(e),i),l=LE(a,e,{ease:Array.isArray(r)?r:Dz(e,r)});return{calculatedDuration:i,next:c=>(s.value=l(c),s.done=c>=i,s)}}const Nz=i=>i!==null;function Gb(i,{repeat:e,repeatType:t="loop"},n,r=1){const s=i.filter(Nz),l=r<0||e&&t!=="loop"&&e%2===1?0:s.length-1;return!l||n===void 0?s[l]:n}const Uz={decay:iT,inertia:iT,tween:tv,keyframes:tv,spring:E1};function dL(i){typeof i.type=="string"&&(i.type=Uz[i.type])}class IE{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}}const Lz=i=>i/100;class Tv extends IE{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var n,r;const{motionValue:t}=this.options;t&&t.updatedAt!==la.now()&&this.tick(la.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(r=(n=this.options).onStop)==null||r.call(n))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;dL(e);const{type:t=tv,repeat:n=0,repeatDelay:r=0,repeatType:s,velocity:a=0}=e;let{keyframes:l}=e;const c=t||tv;c!==tv&&typeof l[0]!="number"&&(this.mixKeyframes=ny(Lz,uL(l[0],l[1])),l=[0,100]);const h=c({...e,keyframes:l});s==="mirror"&&(this.mirroredGenerator=c({...e,keyframes:[...l].reverse(),velocity:-a})),h.calculatedDuration===null&&(h.calculatedDuration=UE(h));const{calculatedDuration:p}=h;this.calculatedDuration=p,this.resolvedDuration=p+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=h}updateTime(e){const t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){const{generator:n,totalDuration:r,mixKeyframes:s,mirroredGenerator:a,resolvedDuration:l,calculatedDuration:c}=this;if(this.startTime===null)return n.next(0);const{delay:h=0,keyframes:p,repeat:g,repeatType:v,repeatDelay:x,type:b,onUpdate:w,finalKeyframe:S}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);const M=this.currentTime-h*(this.playbackSpeed>=0?1:-1),A=this.playbackSpeed>=0?M<0:M>r;this.currentTime=Math.max(M,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=r);let D=this.currentTime,R=n;if(g){const N=Math.min(this.currentTime,r)/l;let L=Math.floor(N),G=N%1;!G&&N>=1&&(G=1),G===1&&L--,L=Math.min(L,g+1),!!(L%2)&&(v==="reverse"?(G=1-G,x&&(G-=x/l)):v==="mirror"&&(R=a)),D=Ll(0,1,G)*l}let I;A?(this.delayState.value=p[0],I=this.delayState):I=R.next(D),s&&!A&&(I.value=s(I.value));let{done:P}=I;!A&&c!==null&&(P=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const F=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&P);return F&&b!==iT&&(I.value=Gb(p,this.options,S,this.speed)),w&&w(I.value),F&&this.finish(),I}then(e,t){return this.finished.then(e,t)}get duration(){return Zo(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Zo(e)}get time(){return Zo(this.currentTime)}set time(e){e=oo(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){const e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);const t=this.generator.next(e).value;return fL(n=>this.generator.next(n).value,e,t)}get speed(){return this.playbackSpeed}set speed(e){const t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(la.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=Zo(this.currentTime))}play(){var r,s;if(this.isStopped)return;const{driver:e=yz,startTime:t}=this.options;this.driver||(this.driver=e(a=>this.tick(a))),(s=(r=this.options).onPlay)==null||s.call(r);const n=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=n):this.holdTime!==null?this.startTime=n-this.holdTime:this.startTime||(this.startTime=t??n),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(la.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,t;this.notifyFinished(),this.teardown(),this.state="finished",(t=(e=this.options).onComplete)==null||t.call(e)}cancel(){var e,t;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(t=(e=this.options).onCancel)==null||t.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var t;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(t=this.driver)==null||t.stop(),e.observe(this)}}function Iz(i){for(let e=1;ei*180/Math.PI,rT=i=>{const e=sd(Math.atan2(i[1],i[0]));return sT(e)},Pz={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:i=>(Math.abs(i[0])+Math.abs(i[3]))/2,rotate:rT,rotateZ:rT,skewX:i=>sd(Math.atan(i[1])),skewY:i=>sd(Math.atan(i[2])),skew:i=>(Math.abs(i[1])+Math.abs(i[2]))/2},sT=i=>(i=i%360,i<0&&(i+=360),i),U3=rT,L3=i=>Math.sqrt(i[0]*i[0]+i[1]*i[1]),I3=i=>Math.sqrt(i[4]*i[4]+i[5]*i[5]),Oz={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:L3,scaleY:I3,scale:i=>(L3(i)+I3(i))/2,rotateX:i=>sT(sd(Math.atan2(i[6],i[5]))),rotateY:i=>sT(sd(Math.atan2(-i[2],i[0]))),rotateZ:U3,rotate:U3,skewX:i=>sd(Math.atan(i[4])),skewY:i=>sd(Math.atan(i[1])),skew:i=>(Math.abs(i[1])+Math.abs(i[4]))/2};function aT(i){return i.includes("scale")?1:0}function oT(i,e){if(!i||i==="none")return aT(e);const t=i.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,r;if(t)n=Oz,r=t;else{const l=i.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=Pz,r=l}if(!r)return aT(e);const s=n[e],a=r[1].split(",").map(kz);return typeof s=="function"?s(a):a[s]}const Fz=(i,e)=>{const{transform:t="none"}=getComputedStyle(i);return oT(t,e)};function kz(i){return parseFloat(i.trim())}const Ym=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],qm=new Set(Ym),P3=i=>i===Xm||i===qt,zz=new Set(["x","y","z"]),Bz=Ym.filter(i=>!zz.has(i));function Vz(i){const e=[];return Bz.forEach(t=>{const n=i.getValue(t);n!==void 0&&(e.push([t,n.get()]),n.set(t.startsWith("scale")?1:0))}),e}const Rf={width:({x:i},{paddingLeft:e="0",paddingRight:t="0",boxSizing:n})=>{const r=i.max-i.min;return n==="border-box"?r:r-parseFloat(e)-parseFloat(t)},height:({y:i},{paddingTop:e="0",paddingBottom:t="0",boxSizing:n})=>{const r=i.max-i.min;return n==="border-box"?r:r-parseFloat(e)-parseFloat(t)},top:(i,{top:e})=>parseFloat(e),left:(i,{left:e})=>parseFloat(e),bottom:({y:i},{top:e})=>parseFloat(e)+(i.max-i.min),right:({x:i},{left:e})=>parseFloat(e)+(i.max-i.min),x:(i,{transform:e})=>oT(e,"x"),y:(i,{transform:e})=>oT(e,"y")};Rf.translateX=Rf.x;Rf.translateY=Rf.y;const md=new Set;let lT=!1,uT=!1,cT=!1;function pL(){if(uT){const i=Array.from(md).filter(n=>n.needsMeasurement),e=new Set(i.map(n=>n.element)),t=new Map;e.forEach(n=>{const r=Vz(n);r.length&&(t.set(n,r),n.render())}),i.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const r=t.get(n);r&&r.forEach(([s,a])=>{var l;(l=n.getValue(s))==null||l.set(a)})}),i.forEach(n=>n.measureEndState()),i.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}uT=!1,lT=!1,md.forEach(i=>i.complete(cT)),md.clear()}function mL(){md.forEach(i=>{i.readKeyframes(),i.needsMeasurement&&(uT=!0)})}function Gz(){cT=!0,mL(),pL(),cT=!1}class PE{constructor(e,t,n,r,s,a=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=s,this.isAsync=a}scheduleResolve(){this.state="scheduled",this.isAsync?(md.add(this),lT||(lT=!0,Kn.read(mL),Kn.resolveKeyframes(pL))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){const s=r==null?void 0:r.get(),a=e[e.length-1];if(s!==void 0)e[0]=s;else if(n&&t){const l=n.readValue(t,a);l!=null&&(e[0]=l)}e[0]===void 0&&(e[0]=a),r&&s===void 0&&r.set(e[0])}Iz(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),md.delete(this)}cancel(){this.state==="scheduled"&&(md.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Hz=i=>i.startsWith("--");function gL(i,e,t){Hz(e)?i.style.setProperty(e,t):i.style[e]=t}const Wz={};function OE(i,e){const t=WU(i);return()=>Wz[e]??t()}const FE=OE(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),vL=OE(()=>window.ViewTimeline!==void 0,"viewTimeline"),yL=OE(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),X0=([i,e,t,n])=>`cubic-bezier(${i}, ${e}, ${t}, ${n})`,O3={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:X0([0,.65,.55,1]),circOut:X0([.55,0,1,.45]),backIn:X0([.31,.01,.66,-.59]),backOut:X0([.33,1.53,.69,.99])};function xL(i,e){if(i)return typeof i=="function"?yL()?cL(i,e):"ease-out":eL(i)?X0(i):Array.isArray(i)?i.map(t=>xL(t,e)||O3.easeOut):O3[i]}function jz(i,e,t,{delay:n=0,duration:r=300,repeat:s=0,repeatType:a="loop",ease:l="easeOut",times:c}={},h=void 0){const p={[e]:t};c&&(p.offset=c);const g=xL(l,r);Array.isArray(g)&&(p.easing=g);const v={delay:n,duration:r,easing:Array.isArray(g)?"linear":g,fill:"both",iterations:s+1,direction:a==="reverse"?"alternate":"normal"};return h&&(v.pseudoElement=h),i.animate(p,v)}function _L(i){return typeof i=="function"&&"applyToOptions"in i}function Xz({type:i,...e}){return _L(i)&&yL()?i.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class bL extends IE{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:n,keyframes:r,pseudoElement:s,allowFlatten:a=!1,finalKeyframe:l,onComplete:c}=e;this.isPseudoElement=!!s,this.allowFlatten=a,this.options=e,Mv(typeof e.type!="string");const h=Xz(e);this.animation=jz(t,n,r,h,s),h.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const p=Gb(r,this.options,l,this.speed);this.updateMotionValue&&this.updateMotionValue(p),gL(t,n,p),this.animation.cancel()}c==null||c(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,t;(t=(e=this.animation).finish)==null||t.call(e)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var t,n,r;const e=(t=this.options)==null?void 0:t.element;!this.isPseudoElement&&(e!=null&&e.isConnected)&&((r=(n=this.animation).commitStyles)==null||r.call(n))}get duration(){var t,n;const e=((n=(t=this.animation.effect)==null?void 0:t.getComputedTiming)==null?void 0:n.call(t).duration)||0;return Zo(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Zo(e)}get time(){return Zo(Number(this.animation.currentTime)||0)}set time(e){const t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=oo(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:n,observe:r}){var s;return this.allowFlatten&&((s=this.animation.effect)==null||s.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&FE()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),ka):r(this)}}const SL={anticipate:KU,backInOut:ZU,circInOut:JU};function Yz(i){return i in SL}function qz(i){typeof i.ease=="string"&&Yz(i.ease)&&(i.ease=SL[i.ease])}const EM=10;class Zz extends bL{constructor(e){qz(e),dL(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:t,onUpdate:n,onComplete:r,element:s,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}const l=new Tv({...a,autoplay:!1}),c=Math.max(EM,la.now()-this.startTime),h=Ll(0,EM,c-EM),p=l.sample(c).value,{name:g}=this.options;s&&g&&gL(s,g,p),t.setWithVelocity(l.sample(Math.max(0,c-h)).value,p,h),l.stop()}}const F3=(i,e)=>e==="zIndex"?!1:!!(typeof i=="number"||Array.isArray(i)||typeof i=="string"&&(Dl.test(i)||i==="0")&&!i.startsWith("url("));function Kz(i){const e=i[0];if(i.length===1)return!0;for(let t=0;tObject.hasOwnProperty.call(Element.prototype,"animate"));function nB(i){var g;const{motionValue:e,name:t,repeatDelay:n,repeatType:r,damping:s,type:a,keyframes:l}=i;if(!(((g=e==null?void 0:e.owner)==null?void 0:g.current)instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:p}=e.owner.getProps();return tB()&&t&&(ML.has(t)||eB.has(t)&&$z(l))&&(t!=="transform"||!p)&&!h&&!n&&r!=="mirror"&&s!==0&&a!=="inertia"}const iB=40;class rB extends IE{constructor({autoplay:e=!0,delay:t=0,type:n="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:a="loop",keyframes:l,name:c,motionValue:h,element:p,...g}){var b;super(),this.stop=()=>{var w,S;this._animation&&(this._animation.stop(),(w=this.stopTimeline)==null||w.call(this)),(S=this.keyframeResolver)==null||S.cancel()},this.createdAt=la.now();const v={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:s,repeatType:a,name:c,motionValue:h,element:p,...g},x=(p==null?void 0:p.KeyframeResolver)||PE;this.keyframeResolver=new x(l,(w,S,M)=>this.onKeyframesResolved(w,S,v,!M),c,h,p),(b=this.keyframeResolver)==null||b.scheduleResolve()}onKeyframesResolved(e,t,n,r){var M,A;this.keyframeResolver=void 0;const{name:s,type:a,velocity:l,delay:c,isHandoff:h,onUpdate:p}=n;this.resolvedAt=la.now();let g=!0;Qz(e,s,a,l)||(g=!1,(Bf.instantAnimations||!c)&&(p==null||p(Gb(e,n,t))),e[0]=e[e.length-1],fT(n),n.repeat=0);const x={startTime:r?this.resolvedAt?this.resolvedAt-this.createdAt>iB?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},b=g&&!h&&nB(x),w=(A=(M=x.motionValue)==null?void 0:M.owner)==null?void 0:A.current;let S;if(b)try{S=new Zz({...x,element:w})}catch{S=new Tv(x)}else S=new Tv(x);S.finished.then(()=>{this.notifyFinished()}).catch(ka),this.pendingTimeline&&(this.stopTimeline=S.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=S}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),Gz()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}}function wL(i,e,t,n=0,r=1){const s=Array.from(i).sort((h,p)=>h.sortNodePosition(p)).indexOf(e),a=i.size,l=(a-1)*n;return typeof t=="function"?t(s,a):r===1?s*n:l-s*n}const sB=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function aB(i){const e=sB.exec(i);if(!e)return[,];const[,t,n,r]=e;return[`--${t??n}`,r]}function TL(i,e,t=1){const[n,r]=aB(i);if(!n)return;const s=window.getComputedStyle(e).getPropertyValue(n);if(s){const a=s.trim();return VU(a)?parseFloat(a):a}return CE(r)?TL(r,e,t+1):r}const oB={type:"spring",stiffness:500,damping:25,restSpeed:10},lB=i=>({type:"spring",stiffness:550,damping:i===0?2*Math.sqrt(550):30,restSpeed:10}),uB={type:"keyframes",duration:.8},cB={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},fB=(i,{keyframes:e})=>e.length>2?uB:qm.has(i)?i.startsWith("scale")?lB(e[1]):oB:cB;function EL(i,e){if(i!=null&&i.inherit&&e){const{inherit:t,...n}=i;return{...e,...n}}return i}function kE(i,e){const t=(i==null?void 0:i[e])??(i==null?void 0:i.default)??i;return t!==i?EL(t,i):t}const hB=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function dB(i){for(const e in i)if(!hB.has(e))return!0;return!1}const zE=(i,e,t,n={},r,s)=>a=>{const l=kE(n,i)||{},c=l.delay||n.delay||0;let{elapsed:h=0}=n;h=h-oo(c);const p={keyframes:Array.isArray(t)?t:[null,t],ease:"easeOut",velocity:e.getVelocity(),...l,delay:-h,onUpdate:v=>{e.set(v),l.onUpdate&&l.onUpdate(v)},onComplete:()=>{a(),l.onComplete&&l.onComplete()},name:i,motionValue:e,element:s?void 0:r};dB(l)||Object.assign(p,fB(i,p)),p.duration&&(p.duration=oo(p.duration)),p.repeatDelay&&(p.repeatDelay=oo(p.repeatDelay)),p.from!==void 0&&(p.keyframes[0]=p.from);let g=!1;if((p.type===!1||p.duration===0&&!p.repeatDelay)&&(fT(p),p.delay===0&&(g=!0)),(Bf.instantAnimations||Bf.skipAnimations||r!=null&&r.shouldSkipAnimations)&&(g=!0,fT(p),p.delay=0),p.allowFlatten=!l.type&&!l.ease,g&&!s&&e.get()!==void 0){const v=Gb(p.keyframes,l);if(v!==void 0){Kn.update(()=>{p.onUpdate(v),p.onComplete()});return}}return l.isSync?new Tv(p):new rB(p)};function k3(i){const e=[{},{}];return i==null||i.values.forEach((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()}),e}function BE(i,e,t,n){if(typeof e=="function"){const[r,s]=k3(n);e=e(t!==void 0?t:i.custom,r,s)}if(typeof e=="string"&&(e=i.variants&&i.variants[e]),typeof e=="function"){const[r,s]=k3(n);e=e(t!==void 0?t:i.custom,r,s)}return e}function gd(i,e,t){const n=i.getProps();return BE(n,e,t!==void 0?t:n.custom,i)}const AL=new Set(["width","height","top","left","right","bottom",...Ym]),z3=30,pB=i=>!isNaN(parseFloat(i)),nv={current:void 0};class mB{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=n=>{var s;const r=la.now();if(this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&((s=this.events.change)==null||s.notify(this.current),this.dependents))for(const a of this.dependents)a.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=la.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=pB(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new wE);const n=this.events[e].add(t);return e==="change"?()=>{n(),Kn.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;(e=this.events.change)==null||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return nv.current&&nv.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const e=la.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>z3)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,z3);return TE(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var e,t;(e=this.dependents)==null||e.clear(),(t=this.events.destroy)==null||t.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Cl(i,e){return new mB(i,e)}const hT=i=>Array.isArray(i);function gB(i,e,t){i.hasValue(e)?i.getValue(e).set(t):i.addValue(e,Cl(t))}function vB(i){return hT(i)?i[i.length-1]||0:i}function yB(i,e){const t=gd(i,e);let{transitionEnd:n={},transition:r={},...s}=t||{};s={...s,...n};for(const a in s){const l=vB(s[a]);gB(i,a,l)}}const Wr=i=>!!(i&&i.getVelocity);function xB(i){return!!(Wr(i)&&i.add)}function dT(i,e){const t=i.getValue("willChange");if(xB(t))return t.add(e);if(!t&&Bf.WillChange){const n=new Bf.WillChange("auto");i.addValue("willChange",n),n.add(e)}}function VE(i){return i.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const _B="framerAppearId",CL="data-"+VE(_B);function RL(i){return i.props[CL]}function bB({protectedKeys:i,needsAnimating:e},t){const n=i.hasOwnProperty(t)&&e[t]!==!0;return e[t]=!1,n}function DL(i,e,{delay:t=0,transitionOverride:n,type:r}={}){let{transition:s,transitionEnd:a,...l}=e;const c=i.getDefaultTransition();s=s?EL(s,c):c;const h=s==null?void 0:s.reduceMotion;n&&(s=n);const p=[],g=r&&i.animationState&&i.animationState.getState()[r];for(const v in l){const x=i.getValue(v,i.latestValues[v]??null),b=l[v];if(b===void 0||g&&bB(g,v))continue;const w={delay:t,...kE(s||{},v)},S=x.get();if(S!==void 0&&!x.isAnimating()&&!Array.isArray(b)&&b===S&&!w.velocity){Kn.update(()=>x.set(b));continue}let M=!1;if(window.MotionHandoffAnimation){const R=RL(i);if(R){const I=window.MotionHandoffAnimation(R,v,Kn);I!==null&&(w.startTime=I,M=!0)}}dT(i,v);const A=h??i.shouldReduceMotion;x.start(zE(v,x,b,A&&AL.has(v)?{type:!1}:w,i,M));const D=x.animation;D&&p.push(D)}if(a){const v=()=>Kn.update(()=>{a&&yB(i,a)});p.length?Promise.all(p).then(v):v()}return p}function pT(i,e,t={}){var c;const n=gd(i,e,t.type==="exit"?(c=i.presenceContext)==null?void 0:c.custom:void 0);let{transition:r=i.getDefaultTransition()||{}}=n||{};t.transitionOverride&&(r=t.transitionOverride);const s=n?()=>Promise.all(DL(i,n,t)):()=>Promise.resolve(),a=i.variantChildren&&i.variantChildren.size?(h=0)=>{const{delayChildren:p=0,staggerChildren:g,staggerDirection:v}=r;return SB(i,e,h,p,g,v,t)}:()=>Promise.resolve(),{when:l}=r;if(l){const[h,p]=l==="beforeChildren"?[s,a]:[a,s];return h().then(()=>p())}else return Promise.all([s(),a(t.delay)])}function SB(i,e,t=0,n=0,r=0,s=1,a){const l=[];for(const c of i.variantChildren)c.notify("AnimationStart",e),l.push(pT(c,e,{...a,delay:t+(typeof n=="function"?0:n)+wL(i.variantChildren,c,n,r,s)}).then(()=>c.notify("AnimationComplete",e)));return Promise.all(l)}function MB(i,e,t={}){i.notify("AnimationStart",e);let n;if(Array.isArray(e)){const r=e.map(s=>pT(i,s,t));n=Promise.all(r)}else if(typeof e=="string")n=pT(i,e,t);else{const r=typeof e=="function"?gd(i,e,t.custom):e;n=Promise.all(DL(i,r,t))}return n.then(()=>{i.notify("AnimationComplete",e)})}const wB={test:i=>i==="auto",parse:i=>i},NL=i=>e=>e.test(i),UL=[Xm,qt,Nu,Tf,$k,Jk,wB],B3=i=>UL.find(NL(i));function TB(i){return typeof i=="number"?i===0:i!==null?i==="none"||i==="0"||HU(i):!0}const EB=new Set(["brightness","contrast","saturate","opacity"]);function AB(i){const[e,t]=i.slice(0,-1).split("(");if(e==="drop-shadow")return i;const[n]=t.match(RE)||[];if(!n)return i;const r=t.replace(n,"");let s=EB.has(e)?1:0;return n!==t&&(s*=100),e+"("+s+r+")"}const CB=/\b([a-z-]*)\(.*?\)/gu,mT={...Dl,getAnimatableNone:i=>{const e=i.match(CB);return e?e.map(AB).join(" "):i}},gT={...Dl,getAnimatableNone:i=>{const e=Dl.parse(i);return Dl.createTransformer(i)(e.map(n=>typeof n=="number"?0:typeof n=="object"?{...n,alpha:1}:n))}},V3={...Xm,transform:Math.round},RB={rotate:Tf,rotateX:Tf,rotateY:Tf,rotateZ:Tf,scale:t_,scaleX:t_,scaleY:t_,scaleZ:t_,skew:Tf,skewX:Tf,skewY:Tf,distance:qt,translateX:qt,translateY:qt,translateZ:qt,x:qt,y:qt,z:qt,perspective:qt,transformPerspective:qt,opacity:wv,originX:A3,originY:A3,originZ:qt},GE={borderWidth:qt,borderTopWidth:qt,borderRightWidth:qt,borderBottomWidth:qt,borderLeftWidth:qt,borderRadius:qt,borderTopLeftRadius:qt,borderTopRightRadius:qt,borderBottomRightRadius:qt,borderBottomLeftRadius:qt,width:qt,maxWidth:qt,height:qt,maxHeight:qt,top:qt,right:qt,bottom:qt,left:qt,inset:qt,insetBlock:qt,insetBlockStart:qt,insetBlockEnd:qt,insetInline:qt,insetInlineStart:qt,insetInlineEnd:qt,padding:qt,paddingTop:qt,paddingRight:qt,paddingBottom:qt,paddingLeft:qt,paddingBlock:qt,paddingBlockStart:qt,paddingBlockEnd:qt,paddingInline:qt,paddingInlineStart:qt,paddingInlineEnd:qt,margin:qt,marginTop:qt,marginRight:qt,marginBottom:qt,marginLeft:qt,marginBlock:qt,marginBlockStart:qt,marginBlockEnd:qt,marginInline:qt,marginInlineStart:qt,marginInlineEnd:qt,fontSize:qt,backgroundPositionX:qt,backgroundPositionY:qt,...RB,zIndex:V3,fillOpacity:wv,strokeOpacity:wv,numOctaves:V3},DB={...GE,color:Pr,backgroundColor:Pr,outlineColor:Pr,fill:Pr,stroke:Pr,borderColor:Pr,borderTopColor:Pr,borderRightColor:Pr,borderBottomColor:Pr,borderLeftColor:Pr,filter:mT,WebkitFilter:mT,mask:gT,WebkitMask:gT},LL=i=>DB[i],NB=new Set([mT,gT]);function IL(i,e){let t=LL(i);return NB.has(t)||(t=Dl),t.getAnimatableNone?t.getAnimatableNone(e):void 0}const UB=new Set(["auto","none","0"]);function LB(i,e,t){let n=0,r;for(;n{e.getValue(c).set(h)}),this.resolveNoneKeyframes()}}function PL(i,e,t){if(i==null)return[];if(i instanceof EventTarget)return[i];if(typeof i=="string"){const r=document.querySelectorAll(i);return r?Array.from(r):[]}return Array.from(i).filter(n=>n!=null)}const OL=(i,e)=>e&&typeof i=="number"?e.transform(i):i;function iv(i){return GU(i)&&"offsetHeight"in i&&!("ownerSVGElement"in i)}const{schedule:HE}=tL(queueMicrotask,!1),El={x:!1,y:!1};function FL(){return El.x||El.y}function PB(i){return i==="x"||i==="y"?El[i]?null:(El[i]=!0,()=>{El[i]=!1}):El.x||El.y?null:(El.x=El.y=!0,()=>{El.x=El.y=!1})}function kL(i,e){const t=PL(i),n=new AbortController,r={passive:!0,...e,signal:n.signal};return[t,r,()=>n.abort()]}function OB(i){return!(i.pointerType==="touch"||FL())}function FB(i,e,t={}){const[n,r,s]=kL(i,t);return n.forEach(a=>{let l=!1,c=!1,h;const p=()=>{a.removeEventListener("pointerleave",b)},g=S=>{h&&(h(S),h=void 0),p()},v=S=>{l=!1,window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",v),c&&(c=!1,g(S))},x=()=>{l=!0,window.addEventListener("pointerup",v,r),window.addEventListener("pointercancel",v,r)},b=S=>{if(S.pointerType!=="touch"){if(l){c=!0;return}g(S)}},w=S=>{if(!OB(S))return;c=!1;const M=e(a,S);typeof M=="function"&&(h=M,a.addEventListener("pointerleave",b,r))};a.addEventListener("pointerenter",w,r),a.addEventListener("pointerdown",x,r)}),s}const zL=(i,e)=>e?i===e?!0:zL(i,e.parentElement):!1,WE=i=>i.pointerType==="mouse"?typeof i.button!="number"||i.button<=0:i.isPrimary!==!1,kB=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function zB(i){return kB.has(i.tagName)||i.isContentEditable===!0}const BB=new Set(["INPUT","SELECT","TEXTAREA"]);function VB(i){return BB.has(i.tagName)||i.isContentEditable===!0}const l1=new WeakSet;function G3(i){return e=>{e.key==="Enter"&&i(e)}}function AM(i,e){i.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const GB=(i,e)=>{const t=i.currentTarget;if(!t)return;const n=G3(()=>{if(l1.has(t))return;AM(t,"down");const r=G3(()=>{AM(t,"up")}),s=()=>AM(t,"cancel");t.addEventListener("keyup",r,e),t.addEventListener("blur",s,e)});t.addEventListener("keydown",n,e),t.addEventListener("blur",()=>t.removeEventListener("keydown",n),e)};function H3(i){return WE(i)&&!FL()}const W3=new WeakSet;function HB(i,e,t={}){const[n,r,s]=kL(i,t),a=l=>{const c=l.currentTarget;if(!H3(l)||W3.has(l))return;l1.add(c),t.stopPropagation&&W3.add(l);const h=e(c,l),p=(x,b)=>{window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",v),l1.has(c)&&l1.delete(c),H3(x)&&typeof h=="function"&&h(x,{success:b})},g=x=>{p(x,c===window||c===document||t.useGlobalTarget||zL(c,x.target))},v=x=>{p(x,!1)};window.addEventListener("pointerup",g,r),window.addEventListener("pointercancel",v,r)};return n.forEach(l=>{(t.useGlobalTarget?window:l).addEventListener("pointerdown",a,r),iv(l)&&(l.addEventListener("focus",h=>GB(h,r)),!zB(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),s}function jE(i){return GU(i)&&"ownerSVGElement"in i}const u1=new WeakMap;let Ef;const BL=(i,e,t)=>(n,r)=>r&&r[0]?r[0][i+"Size"]:jE(n)&&"getBBox"in n?n.getBBox()[e]:n[t],WB=BL("inline","width","offsetWidth"),jB=BL("block","height","offsetHeight");function XB({target:i,borderBoxSize:e}){var t;(t=u1.get(i))==null||t.forEach(n=>{n(i,{get width(){return WB(i,e)},get height(){return jB(i,e)}})})}function YB(i){i.forEach(XB)}function qB(){typeof ResizeObserver>"u"||(Ef=new ResizeObserver(YB))}function ZB(i,e){Ef||qB();const t=PL(i);return t.forEach(n=>{let r=u1.get(n);r||(r=new Set,u1.set(n,r)),r.add(e),Ef==null||Ef.observe(n)}),()=>{t.forEach(n=>{const r=u1.get(n);r==null||r.delete(e),r!=null&&r.size||Ef==null||Ef.unobserve(n)})}}const c1=new Set;let mm;function KB(){mm=()=>{const i={get width(){return window.innerWidth},get height(){return window.innerHeight}};c1.forEach(e=>e(i))},window.addEventListener("resize",mm)}function QB(i){return c1.add(i),mm||KB(),()=>{c1.delete(i),!c1.size&&typeof mm=="function"&&(window.removeEventListener("resize",mm),mm=void 0)}}function vT(i,e){return typeof i=="function"?QB(i):ZB(i,e)}function VL(i,e){let t;const n=()=>{const{currentTime:r}=e,a=(r===null?0:r.value)/100;t!==a&&i(a),t=a};return Kn.preUpdate(n,!0),()=>el(n)}function JB(i){return jE(i)&&i.tagName==="svg"}function $B(...i){const e=!Array.isArray(i[0]),t=e?0:-1,n=i[0+t],r=i[1+t],s=i[2+t],a=i[3+t],l=LE(r,s,a);return e?l(n):l}function e5(i,e,t={}){const n=i.get();let r=null,s=n,a;const l=typeof n=="string"?n.replace(/[\d.-]/g,""):void 0,c=()=>{r&&(r.stop(),r=null),i.animation=void 0},h=()=>{const g=j3(i.get()),v=j3(s);if(g===v){c();return}const x=r?r.getGeneratorVelocity():i.getVelocity();c(),r=new Tv({keyframes:[g,v],velocity:x,type:"spring",restDelta:.001,restSpeed:.01,...t,onUpdate:a})},p=()=>{var g;h(),i.animation=r??void 0,(g=i.events.animationStart)==null||g.notify(),r==null||r.then(()=>{var v;i.animation=void 0,(v=i.events.animationComplete)==null||v.notify()})};if(i.attach((g,v)=>{s=g,a=x=>v(CM(x,l)),Kn.postRender(p)},c),Wr(e)){let g=t.skipInitialAnimation===!0;const v=e.on("change",b=>{g?(g=!1,i.jump(CM(b,l),!1)):i.set(CM(b,l))}),x=i.on("destroy",v);return()=>{v(),x()}}return c}function CM(i,e){return e?i+e:i}function j3(i){return typeof i=="number"?i:parseFloat(i)}const t5=[...UL,Pr,Dl],n5=i=>t5.find(NL(i)),X3=()=>({translate:0,scale:1,origin:0,originPoint:0}),gm=()=>({x:X3(),y:X3()}),Y3=()=>({min:0,max:0}),Hr=()=>({x:Y3(),y:Y3()}),i5=new WeakMap;function Hb(i){return i!==null&&typeof i=="object"&&typeof i.start=="function"}function Ev(i){return typeof i=="string"||Array.isArray(i)}const XE=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],YE=["initial",...XE];function Wb(i){return Hb(i.animate)||YE.some(e=>Ev(i[e]))}function GL(i){return!!(Wb(i)||i.variants)}function r5(i,e,t){for(const n in e){const r=e[n],s=t[n];if(Wr(r))i.addValue(n,r);else if(Wr(s))i.addValue(n,Cl(r,{owner:i}));else if(s!==r)if(i.hasValue(n)){const a=i.getValue(n);a.liveStyle===!0?a.jump(r):a.hasAnimated||a.set(r)}else{const a=i.getStaticValue(n);i.addValue(n,Cl(a!==void 0?a:r,{owner:i}))}}for(const n in t)e[n]===void 0&&i.removeValue(n);return e}const yT={current:null},HL={current:!1},s5=typeof window<"u";function a5(){if(HL.current=!0,!!s5)if(window.matchMedia){const i=window.matchMedia("(prefers-reduced-motion)"),e=()=>yT.current=i.matches;i.addEventListener("change",e),e()}else yT.current=!1}const q3=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let A1={};function WL(i){A1=i}function o5(){return A1}class l5{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:s,blockInitialAnimation:a,visualState:l},c={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=PE,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const x=la.now();this.renderScheduledAtthis.bindToMotionValue(s,r)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(HL.current||a5(),this.shouldReduceMotion=yT.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(n=this.parent)==null||n.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var e;this.projection&&this.projection.unmount(),el(this.notifyUpdate),el(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const n=this.features[t];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&ML.has(e)&&this.current instanceof HTMLElement){const{factory:a,keyframes:l,times:c,ease:h,duration:p}=t.accelerate,g=new bL({element:this.current,name:e,keyframes:l,times:c,ease:h,duration:oo(p)}),v=a(g);this.valueSubscriptions.set(e,()=>{v(),g.cancel()});return}const n=qm.has(e);n&&this.onBindTransform&&this.onBindTransform();const r=t.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&Kn.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let s;typeof window<"u"&&window.MotionCheckAppearSync&&(s=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),s&&s(),t.owner&&t.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in A1){const t=A1[e];if(!t)continue;const{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Hr()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let n=0;nt.variantChildren.delete(e)}addValue(e,t){const n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=Cl(t===null?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n=="string"&&(VU(n)||HU(n))?n=parseFloat(n):!n5(n)&&Dl.test(t)&&(n=IL(e,t)),this.setBaseTarget(e,Wr(n)?n.get():n)),Wr(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){var s;const{initial:t}=this.props;let n;if(typeof t=="string"||typeof t=="object"){const a=BE(this.props,t,(s=this.presenceContext)==null?void 0:s.custom);a&&(n=a[e])}if(t&&n!==void 0)return n;const r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!Wr(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new wE),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){HE.render(this.render)}}class jL extends l5{constructor(){super(...arguments),this.KeyframeResolver=IB}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){const n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Wr(e)&&(this.childSubscription=e.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}}class qf{constructor(e){this.isMounted=!1,this.node=e}update(){}}function XL({top:i,left:e,right:t,bottom:n}){return{x:{min:e,max:t},y:{min:i,max:n}}}function u5({x:i,y:e}){return{top:e.min,right:i.max,bottom:e.max,left:i.min}}function c5(i,e){if(!e)return i;const t=e({x:i.left,y:i.top}),n=e({x:i.right,y:i.bottom});return{top:t.y,left:t.x,bottom:n.y,right:n.x}}function RM(i){return i===void 0||i===1}function xT({scale:i,scaleX:e,scaleY:t}){return!RM(i)||!RM(e)||!RM(t)}function ed(i){return xT(i)||YL(i)||i.z||i.rotate||i.rotateX||i.rotateY||i.skewX||i.skewY}function YL(i){return Z3(i.x)||Z3(i.y)}function Z3(i){return i&&i!=="0%"}function C1(i,e,t){const n=i-t,r=e*n;return t+r}function K3(i,e,t,n,r){return r!==void 0&&(i=C1(i,r,n)),C1(i,t,n)+e}function _T(i,e=0,t=1,n,r){i.min=K3(i.min,e,t,n,r),i.max=K3(i.max,e,t,n,r)}function qL(i,{x:e,y:t}){_T(i.x,e.translate,e.scale,e.originPoint),_T(i.y,t.translate,t.scale,t.originPoint)}const Q3=.999999999999,J3=1.0000000000001;function f5(i,e,t,n=!1){var l;const r=t.length;if(!r)return;e.x=e.y=1;let s,a;for(let c=0;cQ3&&(e.x=1),e.yQ3&&(e.y=1)}function wu(i,e){i.min+=e,i.max+=e}function $3(i,e,t,n,r=.5){const s=Bi(i.min,i.max,r);_T(i,e,t,s,n)}function eR(i,e){return typeof i=="string"?parseFloat(i)/100*(e.max-e.min):i}function f1(i,e,t){const n=t??i;$3(i.x,eR(e.x,n.x),e.scaleX,e.scale,e.originX),$3(i.y,eR(e.y,n.y),e.scaleY,e.scale,e.originY)}function ZL(i,e){return XL(c5(i.getBoundingClientRect(),e))}function h5(i,e,t){const n=ZL(i,t),{scroll:r}=e;return r&&(wu(n.x,r.offset.x),wu(n.y,r.offset.y)),n}const d5={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},p5=Ym.length;function m5(i,e,t){let n="",r=!0;for(let s=0;s{if(!e.target)return i;if(typeof i=="string")if(qt.test(i))i=parseFloat(i);else return i;const t=tR(i,e.target.x),n=tR(i,e.target.y);return`${t}% ${n}%`}},g5={correct:(i,{treeScale:e,projectionDelta:t})=>{const n=i,r=Dl.parse(i);if(r.length>5)return n;const s=Dl.createTransformer(i),a=typeof r[0]!="number"?1:0,l=t.x.scale*e.x,c=t.y.scale*e.y;r[0+a]/=l,r[1+a]/=c;const h=Bi(l,c,.5);return typeof r[2+a]=="number"&&(r[2+a]/=h),typeof r[3+a]=="number"&&(r[3+a]/=h),s(r)}},bT={borderRadius:{...E0,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:E0,borderTopRightRadius:E0,borderBottomLeftRadius:E0,borderBottomRightRadius:E0,boxShadow:g5};function QL(i,{layout:e,layoutId:t}){return qm.has(i)||i.startsWith("origin")||(e||t!==void 0)&&(!!bT[i]||i==="opacity")}function ZE(i,e,t){var a;const n=i.style,r=e==null?void 0:e.style,s={};if(!n)return s;for(const l in n)(Wr(n[l])||r&&Wr(r[l])||QL(l,i)||((a=t==null?void 0:t.getValue(l))==null?void 0:a.liveStyle)!==void 0)&&(s[l]=n[l]);return s}function v5(i){return window.getComputedStyle(i)}class y5 extends jL{constructor(){super(...arguments),this.type="html",this.renderInstance=KL}readValueFromInstance(e,t){var n;if(qm.has(t))return(n=this.projection)!=null&&n.isProjecting?aT(t):Fz(e,t);{const r=v5(e),s=(iL(t)?r.getPropertyValue(t):r[t])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:t}){return ZL(e,t)}build(e,t,n){qE(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return ZE(e,t,n)}}const x5={offset:"stroke-dashoffset",array:"stroke-dasharray"},_5={offset:"strokeDashoffset",array:"strokeDasharray"};function b5(i,e,t=1,n=0,r=!0){i.pathLength=1;const s=r?x5:_5;i[s.offset]=`${-n}`,i[s.array]=`${e} ${t}`}const S5=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function JL(i,{attrX:e,attrY:t,attrScale:n,pathLength:r,pathSpacing:s=1,pathOffset:a=0,...l},c,h,p){if(qE(i,l,h),c){i.style.viewBox&&(i.attrs.viewBox=i.style.viewBox);return}i.attrs=i.style,i.style={};const{attrs:g,style:v}=i;g.transform&&(v.transform=g.transform,delete g.transform),(v.transform||g.transformOrigin)&&(v.transformOrigin=g.transformOrigin??"50% 50%",delete g.transformOrigin),v.transform&&(v.transformBox=(p==null?void 0:p.transformBox)??"fill-box",delete g.transformBox);for(const x of S5)g[x]!==void 0&&(v[x]=g[x],delete g[x]);e!==void 0&&(g.x=e),t!==void 0&&(g.y=t),n!==void 0&&(g.scale=n),r!==void 0&&b5(g,r,s,a,!1)}const $L=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),eI=i=>typeof i=="string"&&i.toLowerCase()==="svg";function M5(i,e,t,n){KL(i,e,void 0,n);for(const r in e.attrs)i.setAttribute($L.has(r)?r:VE(r),e.attrs[r])}function tI(i,e,t){const n=ZE(i,e,t);for(const r in i)if(Wr(i[r])||Wr(e[r])){const s=Ym.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;n[s]=i[r]}return n}class w5 extends jL{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Hr}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(qm.has(t)){const n=LL(t);return n&&n.default||0}return t=$L.has(t)?t:VE(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return tI(e,t,n)}build(e,t,n){JL(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){M5(e,t,n,r)}mount(e){this.isSVGTag=eI(e.tagName),super.mount(e)}}const T5=YE.length;function nI(i){if(!i)return;if(!i.isControllingVariants){const t=i.parent?nI(i.parent)||{}:{};return i.props.initial!==void 0&&(t.initial=i.props.initial),t}const e={};for(let t=0;tPromise.all(e.map(({animation:t,options:n})=>MB(i,t,n)))}function R5(i){let e=C5(i),t=nR(),n=!0,r=!1;const s=h=>(p,g)=>{var x;const v=gd(i,g,h==="exit"?(x=i.presenceContext)==null?void 0:x.custom:void 0);if(v){const{transition:b,transitionEnd:w,...S}=v;p={...p,...S,...w}}return p};function a(h){e=h(i)}function l(h){const{props:p}=i,g=nI(i.parent)||{},v=[],x=new Set;let b={},w=1/0;for(let M=0;Mw&&I,G=!1;const X=Array.isArray(R)?R:[R];let W=X.reduce(s(A),{});P===!1&&(W={});const{prevResolvedValues:q={}}=D,K={...q,...W},ne=he=>{L=!0,x.has(he)&&(G=!0,x.delete(he)),D.needsAnimating[he]=!0;const le=i.getValue(he);le&&(le.liveStyle=!1)};for(const he in K){const le=W[he],ue=q[he];if(b.hasOwnProperty(he))continue;let k=!1;hT(le)&&hT(ue)?k=!iI(le,ue):k=le!==ue,k?le!=null?ne(he):x.add(he):le!==void 0&&x.has(he)?ne(he):D.protectedKeys[he]=!0}D.prevProp=R,D.prevResolvedValues=W,D.isActive&&(b={...b,...W}),(n||r)&&i.blockInitialAnimation&&(L=!1);const j=F&&N;L&&(!j||G)&&v.push(...X.map(he=>{const le={type:A};if(typeof he=="string"&&(n||r)&&!j&&i.manuallyAnimateOnMount&&i.parent){const{parent:ue}=i,k=gd(ue,he);if(ue.enteringChildren&&k){const{delayChildren:Z}=k.transition||{};le.delay=wL(ue.enteringChildren,i,Z)}}return{animation:he,options:le}}))}if(x.size){const M={};if(typeof p.initial!="boolean"){const A=gd(i,Array.isArray(p.initial)?p.initial[0]:p.initial);A&&A.transition&&(M.transition=A.transition)}x.forEach(A=>{const D=i.getBaseTarget(A),R=i.getValue(A);R&&(R.liveStyle=!0),M[A]=D??null}),v.push({animation:M})}let S=!!v.length;return n&&(p.initial===!1||p.initial===p.animate)&&!i.manuallyAnimateOnMount&&(S=!1),n=!1,r=!1,S?e(v):Promise.resolve()}function c(h,p){var v;if(t[h].isActive===p)return Promise.resolve();(v=i.variantChildren)==null||v.forEach(x=>{var b;return(b=x.animationState)==null?void 0:b.setActive(h,p)}),t[h].isActive=p;const g=l(h);for(const x in t)t[x].protectedKeys={};return g}return{animateChanges:l,setActive:c,setAnimateFunction:a,getState:()=>t,reset:()=>{t=nR(),r=!0}}}function D5(i,e){return typeof e=="string"?e!==i:Array.isArray(e)?!iI(e,i):!1}function Ph(i=!1){return{isActive:i,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function nR(){return{animate:Ph(!0),whileInView:Ph(),whileHover:Ph(),whileTap:Ph(),whileDrag:Ph(),whileFocus:Ph(),exit:Ph()}}function ST(i,e){i.min=e.min,i.max=e.max}function bl(i,e){ST(i.x,e.x),ST(i.y,e.y)}function iR(i,e){i.translate=e.translate,i.scale=e.scale,i.originPoint=e.originPoint,i.origin=e.origin}const rI=1e-4,N5=1-rI,U5=1+rI,sI=.01,L5=0-sI,I5=0+sI;function ua(i){return i.max-i.min}function P5(i,e,t){return Math.abs(i-e)<=t}function rR(i,e,t,n=.5){i.origin=n,i.originPoint=Bi(e.min,e.max,i.origin),i.scale=ua(t)/ua(e),i.translate=Bi(t.min,t.max,i.origin)-i.originPoint,(i.scale>=N5&&i.scale<=U5||isNaN(i.scale))&&(i.scale=1),(i.translate>=L5&&i.translate<=I5||isNaN(i.translate))&&(i.translate=0)}function rv(i,e,t,n){rR(i.x,e.x,t.x,n?n.originX:void 0),rR(i.y,e.y,t.y,n?n.originY:void 0)}function sR(i,e,t,n=0){const r=n?Bi(t.min,t.max,n):t.min;i.min=r+e.min,i.max=i.min+ua(e)}function O5(i,e,t,n){sR(i.x,e.x,t.x,n==null?void 0:n.x),sR(i.y,e.y,t.y,n==null?void 0:n.y)}function aR(i,e,t,n=0){const r=n?Bi(t.min,t.max,n):t.min;i.min=e.min-r,i.max=i.min+ua(e)}function R1(i,e,t,n){aR(i.x,e.x,t.x,n==null?void 0:n.x),aR(i.y,e.y,t.y,n==null?void 0:n.y)}function oR(i,e,t,n,r){return i-=e,i=C1(i,1/t,n),r!==void 0&&(i=C1(i,1/r,n)),i}function F5(i,e=0,t=1,n=.5,r,s=i,a=i){if(Nu.test(e)&&(e=parseFloat(e),e=Bi(a.min,a.max,e/100)-a.min),typeof e!="number")return;let l=Bi(s.min,s.max,n);i===s&&(l-=e),i.min=oR(i.min,e,t,l,r),i.max=oR(i.max,e,t,l,r)}function lR(i,e,[t,n,r],s,a){F5(i,e[t],e[n],e[r],e.scale,s,a)}const k5=["x","scaleX","originX"],z5=["y","scaleY","originY"];function uR(i,e,t,n){lR(i.x,e,k5,t?t.x:void 0,n?n.x:void 0),lR(i.y,e,z5,t?t.y:void 0,n?n.y:void 0)}function cR(i){return i.translate===0&&i.scale===1}function aI(i){return cR(i.x)&&cR(i.y)}function fR(i,e){return i.min===e.min&&i.max===e.max}function B5(i,e){return fR(i.x,e.x)&&fR(i.y,e.y)}function hR(i,e){return Math.round(i.min)===Math.round(e.min)&&Math.round(i.max)===Math.round(e.max)}function oI(i,e){return hR(i.x,e.x)&&hR(i.y,e.y)}function dR(i){return ua(i.x)/ua(i.y)}function pR(i,e){return i.translate===e.translate&&i.scale===e.scale&&i.originPoint===e.originPoint}function Su(i){return[i("x"),i("y")]}function V5(i,e,t){let n="";const r=i.x.translate/e.x,s=i.y.translate/e.y,a=(t==null?void 0:t.z)||0;if((r||s||a)&&(n=`translate3d(${r}px, ${s}px, ${a}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),t){const{transformPerspective:h,rotate:p,rotateX:g,rotateY:v,skewX:x,skewY:b}=t;h&&(n=`perspective(${h}px) ${n}`),p&&(n+=`rotate(${p}deg) `),g&&(n+=`rotateX(${g}deg) `),v&&(n+=`rotateY(${v}deg) `),x&&(n+=`skewX(${x}deg) `),b&&(n+=`skewY(${b}deg) `)}const l=i.x.scale*e.x,c=i.y.scale*e.y;return(l!==1||c!==1)&&(n+=`scale(${l}, ${c})`),n||"none"}const lI=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],G5=lI.length,mR=i=>typeof i=="string"?parseFloat(i):i,gR=i=>typeof i=="number"||qt.test(i);function H5(i,e,t,n,r,s){r?(i.opacity=Bi(0,t.opacity??1,W5(n)),i.opacityExit=Bi(e.opacity??1,0,j5(n))):s&&(i.opacity=Bi(e.opacity??1,t.opacity??1,n));for(let a=0;ane?1:t(Rm(i,e,n))}function X5(i,e,t){const n=Wr(i)?i:Cl(i);return n.start(zE("",n,e,t)),n.animation}function Av(i,e,t,n={passive:!0}){return i.addEventListener(e,t,n),()=>i.removeEventListener(e,t)}const Y5=(i,e)=>i.depth-e.depth;class q5{constructor(){this.children=[],this.isDirty=!1}add(e){ME(this.children,e),this.isDirty=!0}remove(e){M1(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Y5),this.isDirty=!1,this.children.forEach(e)}}function Z5(i,e){const t=la.now(),n=({timestamp:r})=>{const s=r-t;s>=e&&(el(n),i(s-e))};return Kn.setup(n,!0),()=>el(n)}function h1(i){return Wr(i)?i.get():i}class K5{constructor(){this.members=[]}add(e){ME(this.members,e);for(let t=this.members.length-1;t>=0;t--){const n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;const r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(M1(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(M1(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(e){var t;for(let n=this.members.indexOf(e)-1;n>=0;n--){const r=this.members[n];if(r.isPresent!==!1&&((t=r.instance)==null?void 0:t.isConnected)!==!1)return this.promote(r),!0}return!1}promote(e,t){var r;const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();const{layoutDependency:s}=n.options,{layoutDependency:a}=e.options;(s===void 0||s!==a)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),(r=e.root)!=null&&r.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{var t,n,r,s,a;(n=(t=e.options).onExitComplete)==null||n.call(t),(a=(r=e.resumingFrom)==null?void 0:(s=r.options).onExitComplete)==null||a.call(s)})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){var e;(e=this.lead)!=null&&e.snapshot&&(this.lead.snapshot=void 0)}}const d1={hasAnimatedSinceResize:!0,hasEverUpdated:!1},DM=["","X","Y","Z"],Q5=1e3;let J5=0;function NM(i,e,t,n){const{latestValues:r}=e;r[i]&&(t[i]=r[i],e.setStaticValue(i,0),n&&(n[i]=0))}function cI(i){if(i.hasCheckedOptimisedAppear=!0,i.root===i)return;const{visualElement:e}=i.options;if(!e)return;const t=RL(e);if(window.MotionHasOptimisedAnimation(t,"transform")){const{layout:r,layoutId:s}=i.options;window.MotionCancelOptimisedAnimation(t,"transform",Kn,!(r||s))}const{parent:n}=i;n&&!n.hasCheckedOptimisedAppear&&cI(n)}function fI({attachResizeListener:i,defaultParent:e,measureScroll:t,checkIsScrollRoot:n,resetTransform:r}){return class{constructor(a={},l=e==null?void 0:e()){this.id=J5++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(t2),this.nodes.forEach(o2),this.nodes.forEach(l2),this.nodes.forEach(n2)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;cthis.root.updateBlockedByResize=!1;Kn.read(()=>{g=window.innerWidth}),i(a,()=>{const x=window.innerWidth;x!==g&&(g=x,this.root.updateBlockedByResize=!0,p&&p(),p=Z5(v,250),d1.hasAnimatedSinceResize&&(d1.hasAnimatedSinceResize=!1,this.nodes.forEach(_R)))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&h&&(l||c)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:g,hasRelativeLayoutChanged:v,layout:x})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const b=this.options.transition||h.getDefaultTransition()||d2,{onLayoutAnimationStart:w,onLayoutAnimationComplete:S}=h.getProps(),M=!this.targetLayout||!oI(this.targetLayout,x),A=!g&&v;if(this.options.layoutRoot||this.resumeFrom||A||g&&(M||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const D={...kE(b,"layout"),onPlay:w,onComplete:S};(h.shouldReduceMotion||this.options.layoutRoot)&&(D.delay=0,D.type=!1),this.startAnimation(D),this.setAnimationOrigin(p,A)}else g||_R(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=x})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),el(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(u2),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&cI(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let p=0;p{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!ua(this.snapshot.measuredBox.x)&&!ua(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c{const I=R/1e3;bR(g.x,a.x,I),bR(g.y,a.y,I),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(R1(v,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),f2(this.relativeTarget,this.relativeTargetOrigin,v,I),D&&B5(this.relativeTarget,D)&&(this.isProjectionDirty=!1),D||(D=Hr()),bl(D,this.relativeTarget)),w&&(this.animationValues=p,H5(p,h,this.latestValues,I,A,M)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=I},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){var l,c,h;this.notifyListeners("animationStart"),(l=this.currentAnimation)==null||l.stop(),(h=(c=this.resumingFrom)==null?void 0:c.currentAnimation)==null||h.stop(),this.pendingAnimation&&(el(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Kn.update(()=>{d1.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Cl(0)),this.motionValue.jump(0,!1),this.currentAnimation=X5(this.motionValue,[0,1e3],{...a,velocity:0,isSync:!0,onUpdate:p=>{this.mixTargetDelta(p),a.onUpdate&&a.onUpdate(p)},onStop:()=>{},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Q5),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:l,target:c,layout:h,latestValues:p}=a;if(!(!l||!c||!h)){if(this!==a&&this.layout&&h&&hI(this.options.animationType,this.layout.layoutBox,h.layoutBox)){c=this.target||Hr();const g=ua(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+g;const v=ua(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+v}bl(l,c),f1(l,p),rv(this.projectionDeltaWithTransform,this.layoutCorrected,l,p)}}registerSharedNode(a,l){this.sharedNodes.has(a)||this.sharedNodes.set(a,new K5),this.sharedNodes.get(a).add(l);const h=l.options.initialPromotionConfig;l.promote({transition:h?h.transition:void 0,preserveFollowOpacity:h&&h.shouldPreserveFollowOpacity?h.shouldPreserveFollowOpacity(l):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var l;const{layoutId:a}=this.options;return a?((l=this.getStack())==null?void 0:l.lead)||this:this}getPrevLead(){var l;const{layoutId:a}=this.options;return a?(l=this.getStack())==null?void 0:l.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:l,preserveFollowOpacity:c}={}){const h=this.getStack();h&&h.promote(this,c),a&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetSkewAndRotation(){const{visualElement:a}=this.options;if(!a)return;let l=!1;const{latestValues:c}=a;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const h={};c.z&&NM("z",a,h,this.animationValues);for(let p=0;p{var l;return(l=a.currentAnimation)==null?void 0:l.stop()}),this.root.nodes.forEach(yR),this.root.sharedNodes.clear()}}}function $5(i){i.updateLayout()}function e2(i){var t;const e=((t=i.resumeFrom)==null?void 0:t.snapshot)||i.snapshot;if(i.isLead()&&i.layout&&e&&i.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:r}=i.layout,{animationType:s}=i.options,a=e.source!==i.layout.source;if(s==="size")Su(g=>{const v=a?e.measuredBox[g]:e.layoutBox[g],x=ua(v);v.min=n[g].min,v.max=v.min+x});else if(s==="x"||s==="y"){const g=s==="x"?"y":"x";ST(a?e.measuredBox[g]:e.layoutBox[g],n[g])}else hI(s,e.layoutBox,n)&&Su(g=>{const v=a?e.measuredBox[g]:e.layoutBox[g],x=ua(n[g]);v.max=v.min+x,i.relativeTarget&&!i.currentAnimation&&(i.isProjectionDirty=!0,i.relativeTarget[g].max=i.relativeTarget[g].min+x)});const l=gm();rv(l,n,e.layoutBox);const c=gm();a?rv(c,i.applyTransform(r,!0),e.measuredBox):rv(c,n,e.layoutBox);const h=!aI(l);let p=!1;if(!i.resumeFrom){const g=i.getClosestProjectingParent();if(g&&!g.resumeFrom){const{snapshot:v,layout:x}=g;if(v&&x){const b=i.options.layoutAnchor||void 0,w=Hr();R1(w,e.layoutBox,v.layoutBox,b);const S=Hr();R1(S,n,x.layoutBox,b),oI(w,S)||(p=!0),g.options.layoutRoot&&(i.relativeTarget=S,i.relativeTargetOrigin=w,i.relativeParent=g)}}}i.notifyListeners("didUpdate",{layout:n,snapshot:e,delta:c,layoutDelta:l,hasLayoutChanged:h,hasRelativeLayoutChanged:p})}else if(i.isLead()){const{onExitComplete:n}=i.options;n&&n()}i.options.transition=void 0}function t2(i){i.parent&&(i.isProjecting()||(i.isProjectionDirty=i.parent.isProjectionDirty),i.isSharedProjectionDirty||(i.isSharedProjectionDirty=!!(i.isProjectionDirty||i.parent.isProjectionDirty||i.parent.isSharedProjectionDirty)),i.isTransformDirty||(i.isTransformDirty=i.parent.isTransformDirty))}function n2(i){i.isProjectionDirty=i.isSharedProjectionDirty=i.isTransformDirty=!1}function i2(i){i.clearSnapshot()}function yR(i){i.clearMeasurements()}function r2(i){i.isLayoutDirty=!0,i.updateLayout()}function xR(i){i.isLayoutDirty=!1}function s2(i){i.isAnimationBlocked&&i.layout&&!i.isLayoutDirty&&(i.snapshot=i.layout,i.isLayoutDirty=!0)}function a2(i){const{visualElement:e}=i.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),i.resetTransform()}function _R(i){i.finishAnimation(),i.targetDelta=i.relativeTarget=i.target=void 0,i.isProjectionDirty=!0}function o2(i){i.resolveTargetDelta()}function l2(i){i.calcProjection()}function u2(i){i.resetSkewAndRotation()}function c2(i){i.removeLeadSnapshot()}function bR(i,e,t){i.translate=Bi(e.translate,0,t),i.scale=Bi(e.scale,1,t),i.origin=e.origin,i.originPoint=e.originPoint}function SR(i,e,t,n){i.min=Bi(e.min,t.min,n),i.max=Bi(e.max,t.max,n)}function f2(i,e,t,n){SR(i.x,e.x,t.x,n),SR(i.y,e.y,t.y,n)}function h2(i){return i.animationValues&&i.animationValues.opacityExit!==void 0}const d2={duration:.45,ease:[.4,0,.1,1]},MR=i=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(i),wR=MR("applewebkit/")&&!MR("chrome/")?Math.round:ka;function TR(i){i.min=wR(i.min),i.max=wR(i.max)}function p2(i){TR(i.x),TR(i.y)}function hI(i,e,t){return i==="position"||i==="preserve-aspect"&&!P5(dR(e),dR(t),.2)}function m2(i){var e;return i!==i.root&&((e=i.scroll)==null?void 0:e.wasRoot)}const g2=fI({attachResizeListener:(i,e)=>Av(i,"resize",e),measureScroll:()=>{var i,e;return{x:document.documentElement.scrollLeft||((i=document.body)==null?void 0:i.scrollLeft)||0,y:document.documentElement.scrollTop||((e=document.body)==null?void 0:e.scrollTop)||0}},checkIsScrollRoot:()=>!0}),UM={current:void 0},dI=fI({measureScroll:i=>({x:i.scrollLeft,y:i.scrollTop}),defaultParent:()=>{if(!UM.current){const i=new g2({});i.mount(window),i.setOptions({layoutScroll:!0}),UM.current=i}return UM.current},resetTransform:(i,e)=>{i.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:i=>window.getComputedStyle(i).position==="fixed"}),sy=ae.createContext({transformPagePoint:i=>i,isStatic:!1,reducedMotion:"never"});function ER(i,e){if(typeof i=="function")return i(e);i!=null&&(i.current=e)}function v2(...i){return e=>{let t=!1;const n=i.map(r=>{const s=ER(r,e);return!t&&typeof s=="function"&&(t=!0),s});if(t)return()=>{for(let r=0;r{const{width:x,height:b,top:w,left:S,right:M,bottom:A}=c.current;if(e||s===!1||!l.current||!x||!b)return;const D=t==="left"?`left: ${S}`:`right: ${M}`,R=n==="bottom"?`bottom: ${A}`:`top: ${w}`;l.current.dataset.motionPopId=a;const I=document.createElement("style");h&&(I.nonce=h);const P=r??document.head;return P.appendChild(I),I.sheet&&I.sheet.insertRule(` [data-motion-pop-id="${a}"] { position: absolute !important; width: ${x}px !important; height: ${b}px !important; ${D}px !important; ${R}px !important; } `),()=>{var F;(F=l.current)==null||F.removeAttribute("data-motion-pop-id"),P.contains(I)&&P.removeChild(I)}},[e]),H.jsx(x2,{isPresent:e,childRef:l,sizeRef:c,pop:s,children:s===!1?i:ae.cloneElement(i,{ref:g})})}const b2=({children:i,initial:e,isPresent:t,onExitComplete:n,custom:r,presenceAffectsLayout:s,mode:a,anchorX:l,anchorY:c,root:h})=>{const p=zf(S2),g=ae.useId();let v=!0,x=ae.useMemo(()=>(v=!1,{id:g,initial:e,isPresent:t,custom:r,onExitComplete:b=>{p.set(b,!0);for(const w of p.values())if(!w)return;n&&n()},register:b=>(p.set(b,!1),()=>p.delete(b))}),[t,p,n]);return s&&v&&(x={...x}),ae.useMemo(()=>{p.forEach((b,w)=>p.set(w,!1))},[t]),ae.useEffect(()=>{!t&&!p.size&&n&&n()},[t]),i=H.jsx(_2,{pop:a==="popLayout",isPresent:t,anchorX:l,anchorY:c,root:h,children:i}),H.jsx(Vb.Provider,{value:x,children:i})};function S2(){return new Map}function pI(i=!0){const e=ae.useContext(Vb);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:n,register:r}=e,s=ae.useId();ae.useEffect(()=>{if(i)return r(s)},[i]);const a=ae.useCallback(()=>i&&n&&n(s),[s,n,i]);return!t&&n?[!1,a]:[!0]}const n_=i=>i.key||"";function AR(i){const e=[];return ae.Children.forEach(i,t=>{ae.isValidElement(t)&&e.push(t)}),e}const jb=({children:i,custom:e,initial:t=!0,onExitComplete:n,presenceAffectsLayout:r=!0,mode:s="sync",propagate:a=!1,anchorX:l="left",anchorY:c="top",root:h})=>{const[p,g]=pI(a),v=ae.useMemo(()=>AR(i),[i]),x=a&&!p?[]:v.map(n_),b=ae.useRef(!0),w=ae.useRef(v),S=zf(()=>new Map),M=ae.useRef(new Set),[A,D]=ae.useState(v),[R,I]=ae.useState(v);Bb(()=>{b.current=!1,w.current=v;for(let N=0;N{const L=n_(N),G=a&&!p?!1:v===R||x.includes(L),X=()=>{if(M.current.has(L))return;if(S.has(L))M.current.add(L),S.set(L,!0);else return;let W=!0;S.forEach(q=>{q||(W=!1)}),W&&(F==null||F(),I(w.current),a&&(g==null||g()),n&&n())};return H.jsx(b2,{isPresent:G,initial:!b.current||t?void 0:!1,custom:e,presenceAffectsLayout:r,mode:s,root:h,onExitComplete:G?void 0:X,anchorX:l,anchorY:c,children:N},L)})})},mI=ae.createContext({strict:!1}),CR={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let RR=!1;function M2(){if(RR)return;const i={};for(const e in CR)i[e]={isEnabled:t=>CR[e].some(n=>!!t[n])};WL(i),RR=!0}function gI(){return M2(),o5()}function w2(i){const e=gI();for(const t in i)e[t]={...e[t],...i[t]};WL(e)}const T2=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function D1(i){return i.startsWith("while")||i.startsWith("drag")&&i!=="draggable"||i.startsWith("layout")||i.startsWith("onTap")||i.startsWith("onPan")||i.startsWith("onLayout")||T2.has(i)}let vI=i=>!D1(i);function E2(i){typeof i=="function"&&(vI=e=>e.startsWith("on")?!D1(e):i(e))}try{E2(require("@emotion/is-prop-valid").default)}catch{}function A2(i,e,t){const n={};for(const r in i)r==="values"&&typeof i.values=="object"||Wr(i[r])||(vI(r)||t===!0&&D1(r)||!e&&!D1(r)||i.draggable&&r.startsWith("onDrag"))&&(n[r]=i[r]);return n}const Xb=ae.createContext({});function C2(i,e){if(Wb(i)){const{initial:t,animate:n}=i;return{initial:t===!1||Ev(t)?t:void 0,animate:Ev(n)?n:void 0}}return i.inherit!==!1?e:{}}function R2(i){const{initial:e,animate:t}=C2(i,ae.useContext(Xb));return ae.useMemo(()=>({initial:e,animate:t}),[DR(e),DR(t)])}function DR(i){return Array.isArray(i)?i.join(" "):i}const KE=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function yI(i,e,t){for(const n in e)!Wr(e[n])&&!QL(n,t)&&(i[n]=e[n])}function D2({transformTemplate:i},e){return ae.useMemo(()=>{const t=KE();return qE(t,e,i),Object.assign({},t.vars,t.style)},[e])}function N2(i,e){const t=i.style||{},n={};return yI(n,t,i),Object.assign(n,D2(i,e)),n}function U2(i,e){const t={},n=N2(i,e);return i.drag&&i.dragListener!==!1&&(t.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=i.drag===!0?"none":`pan-${i.drag==="x"?"y":"x"}`),i.tabIndex===void 0&&(i.onTap||i.onTapStart||i.whileTap)&&(t.tabIndex=0),t.style=n,t}const xI=()=>({...KE(),attrs:{}});function L2(i,e,t,n){const r=ae.useMemo(()=>{const s=xI();return JL(s,e,eI(n),i.transformTemplate,i.style),{...s.attrs,style:{...s.style}}},[e]);if(i.style){const s={};yI(s,i.style,i),r.style={...s,...r.style}}return r}const I2=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function QE(i){return typeof i!="string"||i.includes("-")?!1:!!(I2.indexOf(i)>-1||/[A-Z]/u.test(i))}function P2(i,e,t,{latestValues:n},r,s=!1,a){const c=(a??QE(i)?L2:U2)(e,n,r,i),h=A2(e,typeof i=="string",s),p=i!==ae.Fragment?{...h,...c,ref:t}:{},{children:g}=e,v=ae.useMemo(()=>Wr(g)?g.get():g,[g]);return ae.createElement(i,{...p,children:v})}function O2({scrapeMotionValuesFromProps:i,createRenderState:e},t,n,r){return{latestValues:F2(t,n,r,i),renderState:e()}}function F2(i,e,t,n){const r={},s=n(i,{});for(const v in s)r[v]=h1(s[v]);let{initial:a,animate:l}=i;const c=Wb(i),h=GL(i);e&&h&&!c&&i.inherit!==!1&&(a===void 0&&(a=e.initial),l===void 0&&(l=e.animate));let p=t?t.initial===!1:!1;p=p||a===!1;const g=p?l:a;if(g&&typeof g!="boolean"&&!Hb(g)){const v=Array.isArray(g)?g:[g];for(let x=0;x(e,t)=>{const n=ae.useContext(Xb),r=ae.useContext(Vb),s=()=>O2(i,e,n,r);return t?s():zf(s)},k2=_I({scrapeMotionValuesFromProps:ZE,createRenderState:KE}),z2=_I({scrapeMotionValuesFromProps:tI,createRenderState:xI}),B2=Symbol.for("motionComponentSymbol");function V2(i,e,t){const n=ae.useRef(t);ae.useInsertionEffect(()=>{n.current=t});const r=ae.useRef(null);return ae.useCallback(s=>{var l;s&&((l=i.onMount)==null||l.call(i,s));const a=n.current;if(typeof a=="function")if(s){const c=a(s);typeof c=="function"&&(r.current=c)}else r.current?(r.current(),r.current=null):a(s);else a&&(a.current=s);e&&(s?e.mount(s):e.unmount())},[e])}const bI=ae.createContext({});function dm(i){return i&&typeof i=="object"&&Object.prototype.hasOwnProperty.call(i,"current")}function G2(i,e,t,n,r,s){var D,R;const{visualElement:a}=ae.useContext(Xb),l=ae.useContext(mI),c=ae.useContext(Vb),h=ae.useContext(sy),p=h.reducedMotion,g=h.skipAnimations,v=ae.useRef(null),x=ae.useRef(!1);n=n||l.renderer,!v.current&&n&&(v.current=n(i,{visualState:e,parent:a,props:t,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:p,skipAnimations:g,isSVG:s}),x.current&&v.current&&(v.current.manuallyAnimateOnMount=!0));const b=v.current,w=ae.useContext(bI);b&&!b.projection&&r&&(b.type==="html"||b.type==="svg")&&H2(v.current,t,r,w);const S=ae.useRef(!1);ae.useInsertionEffect(()=>{b&&S.current&&b.update(t,c)});const M=t[CL],A=ae.useRef(!!M&&typeof window<"u"&&!((D=window.MotionHandoffIsComplete)!=null&&D.call(window,M))&&((R=window.MotionHasOptimisedAnimation)==null?void 0:R.call(window,M)));return Bb(()=>{x.current=!0,b&&(S.current=!0,window.MotionIsMounted=!0,b.updateFeatures(),b.scheduleRenderMicrotask(),A.current&&b.animationState&&b.animationState.animateChanges())}),ae.useEffect(()=>{b&&(!A.current&&b.animationState&&b.animationState.animateChanges(),A.current&&(queueMicrotask(()=>{var I;(I=window.MotionHandoffMarkAsComplete)==null||I.call(window,M)}),A.current=!1),b.enteringChildren=void 0)}),b}function H2(i,e,t,n){const{layoutId:r,layout:s,drag:a,dragConstraints:l,layoutScroll:c,layoutRoot:h,layoutAnchor:p,layoutCrossfade:g}=e;i.projection=new t(i.latestValues,e["data-framer-portal-id"]?void 0:SI(i.parent)),i.projection.setOptions({layoutId:r,layout:s,alwaysMeasureLayout:!!a||l&&dm(l),visualElement:i,animationType:typeof s=="string"?s:"both",initialPromotionConfig:n,crossfade:g,layoutScroll:c,layoutRoot:h,layoutAnchor:p})}function SI(i){if(i)return i.options.allowProjection!==!1?i.projection:SI(i.parent)}function LM(i,{forwardMotionProps:e=!1,type:t}={},n,r){n&&w2(n);const s=t?t==="svg":QE(i),a=s?z2:k2;function l(h,p){let g;const v={...ae.useContext(sy),...h,layoutId:W2(h)},{isStatic:x}=v,b=R2(h),w=a(h,x);if(!x&&typeof window<"u"){j2();const S=X2(v);g=S.MeasureLayout,b.visualElement=G2(i,w,v,r,S.ProjectionNode,s)}return H.jsxs(Xb.Provider,{value:b,children:[g&&b.visualElement?H.jsx(g,{visualElement:b.visualElement,...v}):null,P2(i,h,V2(w,b.visualElement,p),w,x,e,s)]})}l.displayName=`motion.${typeof i=="string"?i:`create(${i.displayName??i.name??""})`}`;const c=ae.forwardRef(l);return c[B2]=i,c}function W2({layoutId:i}){const e=ae.useContext(SE).id;return e&&i!==void 0?e+"-"+i:i}function j2(i,e){ae.useContext(mI).strict}function X2(i){const e=gI(),{drag:t,layout:n}=e;if(!t&&!n)return{};const r={...t,...n};return{MeasureLayout:t!=null&&t.isEnabled(i)||n!=null&&n.isEnabled(i)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function Y2(i,e){if(typeof Proxy>"u")return LM;const t=new Map,n=(s,a)=>LM(s,a,i,e),r=(s,a)=>n(s,a);return new Proxy(r,{get:(s,a)=>a==="create"?n:(t.has(a)||t.set(a,LM(a,void 0,i,e)),t.get(a))})}const q2=(i,e)=>e.isSVG??QE(i)?new w5(e):new y5(e,{allowProjection:i!==ae.Fragment});class Z2 extends qf{constructor(e){super(e),e.animationState||(e.animationState=R5(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Hb(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let K2=0;class Q2 extends qf{constructor(){super(...arguments),this.id=K2++,this.isExitComplete=!1}update(){var s;if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;if(e&&n===!1){if(this.isExitComplete){const{initial:a,custom:l}=this.node.getProps();if(typeof a=="string"){const c=gd(this.node,a,l);if(c){const{transition:h,transitionEnd:p,...g}=c;for(const v in g)(s=this.node.getValue(v))==null||s.jump(g[v])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const r=this.node.animationState.setActive("exit",!e);t&&!e&&r.then(()=>{this.isExitComplete=!0,t(this.id)})}mount(){const{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const J2={animation:{Feature:Z2},exit:{Feature:Q2}};function ay(i){return{point:{x:i.pageX,y:i.pageY}}}const $2=i=>e=>WE(e)&&i(e,ay(e));function sv(i,e,t,n){return Av(i,e,$2(t),n)}const MI=({current:i})=>i?i.ownerDocument.defaultView:null,NR=(i,e)=>Math.abs(i-e);function e6(i,e){const t=NR(i.x,e.x),n=NR(i.y,e.y);return Math.sqrt(t**2+n**2)}const UR=new Set(["auto","scroll"]);class wI{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:s=!1,distanceThreshold:a=3,element:l}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=x=>{this.handleScroll(x.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=i_(this.lastRawMoveEventInfo,this.transformPagePoint));const x=IM(this.lastMoveEventInfo,this.history),b=this.startEvent!==null,w=e6(x.offset,{x:0,y:0})>=this.distanceThreshold;if(!b&&!w)return;const{point:S}=x,{timestamp:M}=ts;this.history.push({...S,timestamp:M});const{onStart:A,onMove:D}=this.handlers;b||(A&&A(this.lastMoveEvent,x),this.startEvent=this.lastMoveEvent),D&&D(this.lastMoveEvent,x)},this.handlePointerMove=(x,b)=>{this.lastMoveEvent=x,this.lastRawMoveEventInfo=b,this.lastMoveEventInfo=i_(b,this.transformPagePoint),Kn.update(this.updatePoint,!0)},this.handlePointerUp=(x,b)=>{this.end();const{onEnd:w,onSessionEnd:S,resumeAnimation:M}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&M&&M(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const A=IM(x.type==="pointercancel"?this.lastMoveEventInfo:i_(b,this.transformPagePoint),this.history);this.startEvent&&w&&w(x,A),S&&S(x,A)},!WE(e))return;this.dragSnapToOrigin=s,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;const c=ay(e),h=i_(c,this.transformPagePoint),{point:p}=h,{timestamp:g}=ts;this.history=[{...p,timestamp:g}];const{onSessionStart:v}=t;v&&v(e,IM(h,this.history)),this.removeListeners=ny(sv(this.contextWindow,"pointermove",this.handlePointerMove),sv(this.contextWindow,"pointerup",this.handlePointerUp),sv(this.contextWindow,"pointercancel",this.handlePointerUp)),l&&this.startScrollTracking(l)}startScrollTracking(e){let t=e.parentElement;for(;t;){const n=getComputedStyle(t);(UR.has(n.overflowX)||UR.has(n.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const t=this.scrollPositions.get(e);if(!t)return;const n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},s={x:r.x-t.x,y:r.y-t.y};s.x===0&&s.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=s.x,this.lastMoveEventInfo.point.y+=s.y):this.history.length>0&&(this.history[0].x-=s.x,this.history[0].y-=s.y),this.scrollPositions.set(e,r),Kn.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),el(this.updatePoint)}}function i_(i,e){return e?{point:e(i.point)}:i}function LR(i,e){return{x:i.x-e.x,y:i.y-e.y}}function IM({point:i},e){return{point:i,delta:LR(i,TI(e)),offset:LR(i,t6(e)),velocity:n6(e,.1)}}function t6(i){return i[0]}function TI(i){return i[i.length-1]}function n6(i,e){if(i.length<2)return{x:0,y:0};let t=i.length-1,n=null;const r=TI(i);for(;t>=0&&(n=i[t],!(r.timestamp-n.timestamp>oo(e)));)t--;if(!n)return{x:0,y:0};n===i[0]&&i.length>2&&r.timestamp-n.timestamp>oo(e)*2&&(n=i[1]);const s=Zo(r.timestamp-n.timestamp);if(s===0)return{x:0,y:0};const a={x:(r.x-n.x)/s,y:(r.y-n.y)/s};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function i6(i,{min:e,max:t},n){return e!==void 0&&it&&(i=n?Bi(t,i,n.max):Math.min(i,t)),i}function IR(i,e,t){return{min:e!==void 0?i.min+e:void 0,max:t!==void 0?i.max+t-(i.max-i.min):void 0}}function r6(i,{top:e,left:t,bottom:n,right:r}){return{x:IR(i.x,t,r),y:IR(i.y,e,n)}}function PR(i,e){let t=e.min-i.min,n=e.max-i.max;return e.max-e.minn?t=Rm(e.min,e.max-n,i.min):n>r&&(t=Rm(i.min,i.max-r,e.min)),Ll(0,1,t)}function o6(i,e){const t={};return e.min!==void 0&&(t.min=e.min-i.min),e.max!==void 0&&(t.max=e.max-i.min),t}const MT=.35;function l6(i=MT){return i===!1?i=0:i===!0&&(i=MT),{x:OR(i,"left","right"),y:OR(i,"top","bottom")}}function OR(i,e,t){return{min:FR(i,e),max:FR(i,t)}}function FR(i,e){return typeof i=="number"?i:i[e]||0}const u6=new WeakMap;class c6{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Hr(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=g=>{t&&this.snapToCursor(ay(g).point),this.stopAnimation()},a=(g,v)=>{const{drag:x,dragPropagation:b,onDragStart:w}=this.getProps();if(x&&!b&&(this.openDragLock&&this.openDragLock(),this.openDragLock=PB(x),!this.openDragLock))return;this.latestPointerEvent=g,this.latestPanInfo=v,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Su(M=>{let A=this.getAxisMotionValue(M).get()||0;if(Nu.test(A)){const{projection:D}=this.visualElement;if(D&&D.layout){const R=D.layout.layoutBox[M];R&&(A=ua(R)*(parseFloat(A)/100))}}this.originPoint[M]=A}),w&&Kn.update(()=>w(g,v),!1,!0),dT(this.visualElement,"transform");const{animationState:S}=this.visualElement;S&&S.setActive("whileDrag",!0)},l=(g,v)=>{this.latestPointerEvent=g,this.latestPanInfo=v;const{dragPropagation:x,dragDirectionLock:b,onDirectionLock:w,onDrag:S}=this.getProps();if(!x&&!this.openDragLock)return;const{offset:M}=v;if(b&&this.currentDirection===null){this.currentDirection=h6(M),this.currentDirection!==null&&w&&w(this.currentDirection);return}this.updateAxis("x",v.point,M),this.updateAxis("y",v.point,M),this.visualElement.render(),S&&Kn.update(()=>S(g,v),!1,!0)},c=(g,v)=>{this.latestPointerEvent=g,this.latestPanInfo=v,this.stop(g,v),this.latestPointerEvent=null,this.latestPanInfo=null},h=()=>{const{dragSnapToOrigin:g}=this.getProps();(g||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:p}=this.getProps();this.panSession=new wI(e,{onSessionStart:s,onStart:a,onMove:l,onSessionEnd:c,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:p,distanceThreshold:n,contextWindow:MI(this.visualElement),element:this.visualElement.current})}stop(e,t){const n=e||this.latestPointerEvent,r=t||this.latestPanInfo,s=this.isDragging;if(this.cancel(),!s||!r||!n)return;const{velocity:a}=r;this.startAnimation(a);const{onDragEnd:l}=this.getProps();l&&Kn.postRender(()=>l(n,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){const{drag:r}=this.getProps();if(!n||!r_(e,r,this.currentDirection))return;const s=this.getAxisMotionValue(e);let a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=i6(a,this.constraints[e],this.elastic[e])),s.set(a)}resolveConstraints(){var s;const{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(s=this.visualElement.projection)==null?void 0:s.layout,r=this.constraints;e&&dm(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&n?this.constraints=r6(n.layoutBox,e):this.constraints=!1,this.elastic=l6(t),r!==this.constraints&&!dm(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&Su(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=o6(n.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!dm(e))return!1;const n=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const s=h5(n,r.root,this.visualElement.getTransformPagePoint());let a=s6(r.layout.layoutBox,s);if(t){const l=t(u5(a));this.hasMutatedConstraints=!!l,l&&(a=XL(l))}return a}startAnimation(e){const{drag:t,dragMomentum:n,dragElastic:r,dragTransition:s,dragSnapToOrigin:a,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},h=Su(p=>{if(!r_(p,t,this.currentDirection))return;let g=c&&c[p]||{};(a===!0||a===p)&&(g={min:0,max:0});const v=r?200:1e6,x=r?40:1e7,b={type:"inertia",velocity:n?e[p]:0,bounceStiffness:v,bounceDamping:x,timeConstant:750,restDelta:1,restSpeed:10,...s,...g};return this.startAxisValueAnimation(p,b)});return Promise.all(h).then(l)}startAxisValueAnimation(e,t){const n=this.getAxisMotionValue(e);return dT(this.visualElement,e),n.start(zE(e,n,0,t,this.visualElement,!1))}stopAnimation(){Su(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),r=n[t];return r||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){Su(t=>{const{drag:n}=this.getProps();if(!r_(t,n,this.currentDirection))return;const{projection:r}=this.visualElement,s=this.getAxisMotionValue(t);if(r&&r.layout){const{min:a,max:l}=r.layout.layoutBox[t],c=s.get()||0;s.set(e[t]-Bi(a,l,.5)+c)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!dm(t)||!n||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};Su(a=>{const l=this.getAxisMotionValue(a);if(l&&this.constraints!==!1){const c=l.get();r[a]=a6({min:c,max:c},this.constraints[a])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),Su(a=>{if(!r_(a,e,null))return;const l=this.getAxisMotionValue(a),{min:c,max:h}=this.constraints[a];l.set(Bi(c,h,r[a]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;u6.set(this.visualElement,this);const e=this.visualElement.current,t=sv(e,"pointerdown",h=>{const{drag:p,dragListener:g=!0}=this.getProps(),v=h.target,x=v!==e&&VB(v);p&&g&&!x&&this.start(h)});let n;const r=()=>{const{dragConstraints:h}=this.getProps();dm(h)&&h.current&&(this.constraints=this.resolveRefConstraints(),n||(n=f6(e,h.current,()=>this.scalePositionWithinConstraints())))},{projection:s}=this.visualElement,a=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),Kn.read(r);const l=Av(window,"resize",()=>this.scalePositionWithinConstraints()),c=s.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:p})=>{this.isDragging&&p&&(Su(g=>{const v=this.getAxisMotionValue(g);v&&(this.originPoint[g]+=h[g].translate,v.set(v.get()+h[g].translate))}),this.visualElement.render())}));return()=>{l(),t(),a(),c&&c(),n&&n()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:s=!1,dragElastic:a=MT,dragMomentum:l=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:s,dragElastic:a,dragMomentum:l}}}function kR(i){let e=!0;return()=>{if(e){e=!1;return}i()}}function f6(i,e,t){const n=vT(i,kR(t)),r=vT(e,kR(t));return()=>{n(),r()}}function r_(i,e,t){return(e===!0||e===i)&&(t===null||t===i)}function h6(i,e=10){let t=null;return Math.abs(i.y)>e?t="y":Math.abs(i.x)>e&&(t="x"),t}class d6 extends qf{constructor(e){super(e),this.removeGroupControls=ka,this.removeListeners=ka,this.controls=new c6(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ka}update(){const{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const PM=i=>(e,t)=>{i&&Kn.update(()=>i(e,t),!1,!0)};class p6 extends qf{constructor(){super(...arguments),this.removePointerDownListener=ka}onPointerDown(e){this.session=new wI(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:MI(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:PM(e),onStart:PM(t),onMove:PM(n),onEnd:(s,a)=>{delete this.session,r&&Kn.postRender(()=>r(s,a))}}}mount(){this.removePointerDownListener=sv(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let OM=!1;class m6 extends ae.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:s}=e;s&&(t.group&&t.group.add(s),n&&n.register&&r&&n.register(s),OM&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),d1.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:n,drag:r,isPresent:s}=this.props,{projection:a}=n;return a&&(a.isPresent=s,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),OM=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==s?a.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?a.promote():a.relegate()||Kn.postRender(()=>{const l=a.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),HE.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;OM=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function EI(i){const[e,t]=pI(),n=ae.useContext(SE);return H.jsx(m6,{...i,layoutGroup:n,switchLayoutGroup:ae.useContext(bI),isPresent:e,safeToRemove:t})}const g6={pan:{Feature:p6},drag:{Feature:d6,ProjectionNode:dI,MeasureLayout:EI}};function zR(i,e,t){const{props:n}=i;i.animationState&&n.whileHover&&i.animationState.setActive("whileHover",t==="Start");const r="onHover"+t,s=n[r];s&&Kn.postRender(()=>s(e,ay(e)))}class v6 extends qf{mount(){const{current:e}=this.node;e&&(this.unmount=FB(e,(t,n)=>(zR(this.node,n,"Start"),r=>zR(this.node,r,"End"))))}unmount(){}}class y6 extends qf{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=ny(Av(this.node.current,"focus",()=>this.onFocus()),Av(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function BR(i,e,t){const{props:n}=i;if(i.current instanceof HTMLButtonElement&&i.current.disabled)return;i.animationState&&n.whileTap&&i.animationState.setActive("whileTap",t==="Start");const r="onTap"+(t==="End"?"":t),s=n[r];s&&Kn.postRender(()=>s(e,ay(e)))}class x6 extends qf{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=HB(e,(r,s)=>(BR(this.node,s,"Start"),(a,{success:l})=>BR(this.node,a,l?"End":"Cancel")),{useGlobalTarget:t,stopPropagation:(n==null?void 0:n.tap)===!1})}unmount(){}}const wT=new WeakMap,FM=new WeakMap,_6=i=>{const e=wT.get(i.target);e&&e(i)},b6=i=>{i.forEach(_6)};function S6({root:i,...e}){const t=i||document;FM.has(t)||FM.set(t,{});const n=FM.get(t),r=JSON.stringify(e);return n[r]||(n[r]=new IntersectionObserver(b6,{root:i,...e})),n[r]}function M6(i,e,t){const n=S6(e);return wT.set(i,t),n.observe(i),()=>{wT.delete(i),n.unobserve(i)}}const w6={some:0,all:1};class T6 extends qf{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var c;(c=this.stopObserver)==null||c.call(this);const{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r="some",once:s}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r=="number"?r:w6[r]},l=h=>{const{isIntersecting:p}=h;if(this.isInView===p||(this.isInView=p,s&&!p&&this.hasEnteredView))return;p&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",p);const{onViewportEnter:g,onViewportLeave:v}=this.node.getProps(),x=p?g:v;x&&x(h)};this.stopObserver=M6(this.node.current,a,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(E6(e,t))&&this.startObserver()}unmount(){var e;(e=this.stopObserver)==null||e.call(this),this.hasEnteredView=!1,this.isInView=!1}}function E6({viewport:i={}},{viewport:e={}}={}){return t=>i[t]!==e[t]}const A6={inView:{Feature:T6},tap:{Feature:x6},focus:{Feature:y6},hover:{Feature:v6}},C6={layout:{ProjectionNode:dI,MeasureLayout:EI}},R6={...J2,...A6,...g6,...C6},mr=Y2(R6,q2);function N1(i){return typeof window>"u"?!1:i?vL():FE()}const D6=50,VR=()=>({current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0}),N6=()=>({time:0,x:VR(),y:VR()}),U6={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}};function GR(i,e,t,n){const r=t[e],{length:s,position:a}=U6[e],l=r.current,c=t.time;r.current=Math.abs(i[`scroll${a}`]),r.scrollLength=i[`scroll${s}`]-i[`client${s}`],r.offset.length=0,r.offset[0]=0,r.offset[1]=r.scrollLength,r.progress=Rm(0,r.scrollLength,r.current);const h=n-c;r.velocity=h>D6?0:TE(r.current-l,h)}function L6(i,e,t){GR(i,"x",e,t),GR(i,"y",e,t),e.time=t}function I6(i,e){const t={x:0,y:0};let n=i;for(;n&&n!==e;)if(iv(n))t.x+=n.offsetLeft,t.y+=n.offsetTop,n=n.offsetParent;else if(n.tagName==="svg"){const r=n.getBoundingClientRect();n=n.parentElement;const s=n.getBoundingClientRect();t.x+=r.left-s.left,t.y+=r.top-s.top}else if(n instanceof SVGGraphicsElement){const{x:r,y:s}=n.getBBox();t.x+=r,t.y+=s;let a=null,l=n.parentNode;for(;!a;)l.tagName==="svg"&&(a=l),l=n.parentNode;n=a}else break;return t}const TT={start:0,center:.5,end:1};function HR(i,e,t=0){let n=0;if(i in TT&&(i=TT[i]),typeof i=="string"){const r=parseFloat(i);i.endsWith("px")?n=r:i.endsWith("%")?i=r/100:i.endsWith("vw")?n=r/100*document.documentElement.clientWidth:i.endsWith("vh")?n=r/100*document.documentElement.clientHeight:i=r}return typeof i=="number"&&(n=e*i),t+n}const P6=[0,0];function O6(i,e,t,n){let r=Array.isArray(i)?i:P6,s=0,a=0;return typeof i=="number"?r=[i,i]:typeof i=="string"&&(i=i.trim(),i.includes(" ")?r=i.split(" "):r=[i,TT[i]?i:"0"]),s=HR(r[0],t,n),a=HR(r[1],e),s-a}const Y0={Enter:[[0,1],[1,1]],Exit:[[0,0],[1,0]],Any:[[1,0],[0,1]],All:[[0,0],[1,1]]},F6={x:0,y:0};function k6(i){return"getBBox"in i&&i.tagName!=="svg"?i.getBBox():{width:i.clientWidth,height:i.clientHeight}}function z6(i,e,t){const{offset:n=Y0.All}=t,{target:r=i,axis:s="y"}=t,a=s==="y"?"height":"width",l=r!==i?I6(r,i):F6,c=r===i?{width:i.scrollWidth,height:i.scrollHeight}:k6(r),h={width:i.clientWidth,height:i.clientHeight};e[s].offset.length=0;let p=!e[s].interpolate;const g=n.length;for(let v=0;v{B6(i,n.target,t),L6(i,t,r),(n.offset||n.target)&&z6(i,t,n)},notify:()=>e(t)}}const zp=new WeakMap,WR=new WeakMap,kM=new WeakMap,jR=new WeakMap,s_=new WeakMap,XR=i=>i===document.scrollingElement?window:i;function AI(i,{container:e=document.scrollingElement,trackContentSize:t=!1,...n}={}){if(!e)return ka;let r=kM.get(e);r||(r=new Set,kM.set(e,r));const s=N6(),a=V6(e,i,s,n);if(r.add(a),!zp.has(e)){const c=()=>{for(const v of r)v.measure(ts.timestamp);Kn.preUpdate(h)},h=()=>{for(const v of r)v.notify()},p=()=>Kn.read(c);zp.set(e,p);const g=XR(e);window.addEventListener("resize",p),e!==document.documentElement&&WR.set(e,vT(e,p)),g.addEventListener("scroll",p),p()}if(t&&!s_.has(e)){const c=zp.get(e),h={width:e.scrollWidth,height:e.scrollHeight};jR.set(e,h);const p=()=>{const v=e.scrollWidth,x=e.scrollHeight;(h.width!==v||h.height!==x)&&(c(),h.width=v,h.height=x)},g=Kn.read(p,!0);s_.set(e,g)}const l=zp.get(e);return Kn.read(l,!1,!0),()=>{var g;el(l);const c=kM.get(e);if(!c||(c.delete(a),c.size))return;const h=zp.get(e);zp.delete(e),h&&(XR(e).removeEventListener("scroll",h),(g=WR.get(e))==null||g(),window.removeEventListener("resize",h));const p=s_.get(e);p&&(el(p),s_.delete(e)),jR.delete(e)}}const G6=[[Y0.Enter,"entry"],[Y0.Exit,"exit"],[Y0.Any,"cover"],[Y0.All,"contain"]],YR={start:0,end:1};function H6(i){const e=i.trim().split(/\s+/);if(e.length!==2)return;const t=YR[e[0]],n=YR[e[1]];if(!(t===void 0||n===void 0))return[t,n]}function W6(i){if(i.length!==2)return;const e=[];for(const t of i)if(Array.isArray(t))e.push(t);else if(typeof t=="string"){const n=H6(t);if(!n)return;e.push(n)}else return;return e}function j6(i,e){const t=W6(i);if(!t)return!1;for(let n=0;n<2;n++){const r=t[n],s=e[n];if(r[0]!==s[0]||r[1]!==s[1])return!1}return!0}function JE(i){if(!i)return{rangeStart:"contain 0%",rangeEnd:"contain 100%"};for(const[e,t]of G6)if(j6(i,e))return{rangeStart:`${t} 0%`,rangeEnd:`${t} 100%`}}const qR=new Map;function ZR(i){const e={value:0},t=AI(n=>{e.value=n[i.axis].progress*100},i);return{currentTime:e,cancel:t}}function CI({source:i,container:e,...t}){const{axis:n}=t;i&&(e=i);let r=qR.get(e);r||(r=new Map,qR.set(e,r));const s=t.target??"self";let a=r.get(s);a||(a={},r.set(s,a));const l=n+(t.offset??[]).join(",");return a[l]||(t.target&&N1(t.target)?JE(t.offset)?a[l]=new ViewTimeline({subject:t.target,axis:n}):a[l]=ZR({container:e,...t}):N1()?a[l]=new ScrollTimeline({source:e,axis:n}):a[l]=ZR({container:e,...t})),a[l]}function X6(i,e){const t=CI(e),n=e.target?JE(e.offset):void 0,r=e.target?N1(e.target)&&!!n:N1();return i.attachTimeline({timeline:r?t:void 0,...n&&r&&{rangeStart:n.rangeStart,rangeEnd:n.rangeEnd},observe:s=>(s.pause(),VL(a=>{s.time=s.iterationDuration*a},t))})}function Y6(i){return i.length===2}function q6(i,e){return Y6(i)?AI(t=>{i(t[e.axis].progress,t)},e):VL(i,CI(e))}function RI(i,{axis:e="y",container:t=document.scrollingElement,...n}={}){if(!t)return ka;const r={axis:e,container:t,...n};return typeof i=="function"?q6(i,r):X6(i,r)}const Z6=()=>({scrollX:Cl(0),scrollY:Cl(0),scrollXProgress:Cl(0),scrollYProgress:Cl(0)}),a_=i=>i?!i.current:!1;function KR(i,e,t,n){return{factory:r=>RI(r,{...e,axis:i,container:(t==null?void 0:t.current)||void 0,target:(n==null?void 0:n.current)||void 0}),times:[0,1],keyframes:[0,1],ease:r=>r,duration:1}}function K6(i,e){return typeof window>"u"?!1:i?vL()&&!!JE(e):FE()}function Q6({container:i,target:e,...t}={}){const n=zf(Z6);K6(e,t.offset)&&(n.scrollXProgress.accelerate=KR("x",t,i,e),n.scrollYProgress.accelerate=KR("y",t,i,e));const r=ae.useRef(null),s=ae.useRef(!1),a=ae.useCallback(()=>(r.current=RI((l,{x:c,y:h})=>{n.scrollX.set(c.current),n.scrollXProgress.set(c.progress),n.scrollY.set(h.current),n.scrollYProgress.set(h.progress)},{...t,container:(i==null?void 0:i.current)||void 0,target:(e==null?void 0:e.current)||void 0}),()=>{var l;(l=r.current)==null||l.call(r)}),[i,e,JSON.stringify(t.offset)]);return Bb(()=>{if(s.current=!1,a_(i)||a_(e)){s.current=!0;return}else return a()},[a]),ae.useEffect(()=>{if(s.current)return Mv(!a_(i)),Mv(!a_(e)),a()},[a]),n}function U1(i){const e=zf(()=>Cl(i)),{isStatic:t}=ae.useContext(sy);if(t){const[,n]=ae.useState(i);ae.useEffect(()=>e.on("change",n),[])}return e}function DI(i,e){const t=U1(e()),n=()=>t.set(e());return n(),Bb(()=>{const r=()=>Kn.preRender(n,!1,!0),s=i.map(a=>a.on("change",r));return()=>{s.forEach(a=>a()),el(n)}}),t}function J6(i){nv.current=[],i();const e=DI(nv.current,i);return nv.current=void 0,e}function Cv(i,e,t,n){if(typeof i=="function")return J6(i);if(t!==void 0&&!Array.isArray(t)&&typeof e!="function")return $6(i,e,t,n);const a=typeof e=="function"?e:$B(e,t,n),l=Array.isArray(i)?QR(i,a):QR([i],([h])=>a(h)),c=Array.isArray(i)?void 0:i.accelerate;return c&&!c.isTransformed&&typeof e!="function"&&Array.isArray(t)&&(n==null?void 0:n.clamp)!==!1&&(l.accelerate={...c,times:e,keyframes:t,isTransformed:!0}),l}function QR(i,e){const t=zf(()=>[]);return DI(i,()=>{t.length=0;const n=i.length;for(let r=0;rObject.keys(t)),s=zf(()=>({}));for(const a of r)s[a]=Cv(i,e,t[a],n);return s}function eV(i,e={}){const{isStatic:t}=ae.useContext(sy),n=()=>Wr(i)?i.get():i;if(t)return Cv(n);const r=U1(n());return ae.useInsertionEffect(()=>e5(r,i,e),[r,JSON.stringify(e)]),r}function Rv(i,e={}){return eV(i,{type:"spring",...e})}function bc(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function NI(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,i.__proto__=e}/*! * GSAP 3.14.2 * https://gsap.com * * @license Copyright 2008-2025, GreenSock. All rights reserved. * Subject to the terms at https://gsap.com/standard-license * @author: Jack Doyle, jack@greensock.com */var lo={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Nm={duration:.5,overwrite:!1,delay:0},$E,Ss,qi,Ko=1e8,Mi=1/Ko,ET=Math.PI*2,tV=ET/4,nV=0,UI=Math.sqrt,iV=Math.cos,rV=Math.sin,os=function(e){return typeof e=="string"},gr=function(e){return typeof e=="function"},Ec=function(e){return typeof e=="number"},eA=function(e){return typeof e>"u"},Uu=function(e){return typeof e=="object"},za=function(e){return e!==!1},tA=function(){return typeof window<"u"},o_=function(e){return gr(e)||os(e)},LI=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},zs=Array.isArray,sV=/random\([^)]+\)/g,aV=/,\s*/g,JR=/(?:-?\.?\d|\.)+/gi,II=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,vm=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,zM=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,PI=/[+-]=-?[.\d]+/,oV=/[^,'"\[\]\s]+/gi,lV=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,ir,Mu,AT,nA,fo={},L1={},OI,FI=function(e){return(L1=Um(e,fo))&&Ha},iA=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},Dv=function(e,t){return!t&&console.warn(e)},kI=function(e,t){return e&&(fo[e]=t)&&L1&&(L1[e]=t)||fo},Nv=function(){return 0},uV={suppressEvents:!0,isStart:!0,kill:!1},p1={suppressEvents:!0,kill:!1},cV={suppressEvents:!0},rA={},Ff=[],CT={},zI,to={},BM={},$R=30,m1=[],sA="",aA=function(e){var t=e[0],n,r;if(Uu(t)||gr(t)||(e=[e]),!(n=(t._gsap||{}).harness)){for(r=m1.length;r--&&!m1[r].targetTest(t););n=m1[r]}for(r=e.length;r--;)e[r]&&(e[r]._gsap||(e[r]._gsap=new uP(e[r],n)))||e.splice(r,1);return e},vd=function(e){return e._gsap||aA(Qo(e))[0]._gsap},BI=function(e,t,n){return(n=e[t])&&gr(n)?e[t]():eA(n)&&e.getAttribute&&e.getAttribute(t)||n},Ba=function(e,t){return(e=e.split(",")).forEach(t)||e},Tr=function(e){return Math.round(e*1e5)/1e5||0},nr=function(e){return Math.round(e*1e7)/1e7||0},Sm=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},fV=function(e,t){for(var n=t.length,r=0;e.indexOf(t[r])<0&&++rl;)a=a._prev;return a?(t._next=a._next,a._next=t):(t._next=e[n],e[n]=t),t._next?t._next._prev=t:e[r]=t,t._prev=a,t.parent=t._dp=e,t},Yb=function(e,t,n,r){n===void 0&&(n="_first"),r===void 0&&(r="_last");var s=t._prev,a=t._next;s?s._next=a:e[n]===t&&(e[n]=a),a?a._prev=s:e[r]===t&&(e[r]=s),t._next=t._prev=t.parent=null},Vf=function(e,t){e.parent&&(!t||e.parent.autoRemoveChildren)&&e.parent.remove&&e.parent.remove(e),e._act=0},yd=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},pV=function(e){for(var t=e.parent;t&&t.parent;)t._dirty=1,t.totalDuration(),t=t.parent;return e},RT=function(e,t,n,r){return e._startAt&&(Ss?e._startAt.revert(p1):e.vars.immediateRender&&!e.vars.autoRevert||e._startAt.render(t,!0,r))},mV=function i(e){return!e||e._ts&&i(e.parent)},tD=function(e){return e._repeat?Lm(e._tTime,e=e.duration()+e._rDelay)*e:0},Lm=function(e,t){var n=Math.floor(e=nr(e/t));return e&&n===e?n-1:n},O1=function(e,t){return(e-t._start)*t._ts+(t._ts>=0?0:t._dirty?t.totalDuration():t._tDur)},qb=function(e){return e._end=nr(e._start+(e._tDur/Math.abs(e._ts||e._rts||Mi)||0))},Zb=function(e,t){var n=e._dp;return n&&n.smoothChildTiming&&e._ts&&(e._start=nr(n._time-(e._ts>0?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),qb(e),n._dirty||yd(n,e)),e},jI=function(e,t){var n;if((t._time||!t._dur&&t._initted||t._startMi)&&t.render(n,!0)),yd(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur=0&&n.totalTime(n._tTime),n=n._dp;e._zTime=-Mi}},Tu=function(e,t,n,r){return t.parent&&Vf(t),t._start=nr((Ec(n)?n:n||e!==ir?Yo(e,n,t):e._time)+t._delay),t._end=nr(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),WI(e,t,"_first","_last",e._sort?"_start":0),DT(t)||(e._recent=t),r||jI(e,t),e._ts<0&&Zb(e,e._tTime),e},XI=function(e,t){return(fo.ScrollTrigger||iA("scrollTrigger",t))&&fo.ScrollTrigger.create(t,e)},YI=function(e,t,n,r,s){if(uA(e,t,s),!e._initted)return 1;if(!n&&e._pt&&!Ss&&(e._dur&&e.vars.lazy!==!1||!e._dur&&e.vars.lazy)&&zI!==no.frame)return Ff.push(e),e._lazy=[s,r],1},gV=function i(e){var t=e.parent;return t&&t._ts&&t._initted&&!t._lock&&(t.rawTime()<0||i(t))},DT=function(e){var t=e.data;return t==="isFromStart"||t==="isStart"},vV=function(e,t,n,r){var s=e.ratio,a=t<0||!t&&(!e._start&&gV(e)&&!(!e._initted&&DT(e))||(e._ts<0||e._dp._ts<0)&&!DT(e))?0:1,l=e._rDelay,c=0,h,p,g;if(l&&e._repeat&&(c=oy(0,e._tDur,t),p=Lm(c,l),e._yoyo&&p&1&&(a=1-a),p!==Lm(e._tTime,l)&&(s=1-a,e.vars.repeatRefresh&&e._initted&&e.invalidate())),a!==s||Ss||r||e._zTime===Mi||!t&&e._zTime){if(!e._initted&&YI(e,t,r,n,c))return;for(g=e._zTime,e._zTime=t||(n?Mi:0),n||(n=t&&!g),e.ratio=a,e._from&&(a=1-a),e._time=0,e._tTime=c,h=e._pt;h;)h.r(a,h.d),h=h._next;t<0&&RT(e,t,n,!0),e._onUpdate&&!n&&ro(e,"onUpdate"),c&&e._repeat&&!n&&e.parent&&ro(e,"onRepeat"),(t>=e._tDur||t<0)&&e.ratio===a&&(a&&Vf(e,1),!n&&!Ss&&(ro(e,a?"onComplete":"onReverseComplete",!0),e._prom&&e._prom()))}else e._zTime||(e._zTime=t)},yV=function(e,t,n){var r;if(n>t)for(r=e._first;r&&r._start<=n;){if(r.data==="isPause"&&r._start>t)return r;r=r._next}else for(r=e._last;r&&r._start>=n;){if(r.data==="isPause"&&r._start0&&!r&&Zb(e,e._tTime=e._tDur*l),e.parent&&qb(e),n||yd(e.parent,e),e},nD=function(e){return e instanceof aa?yd(e):Im(e,e._dur)},xV={_start:0,endTime:Nv,totalDuration:Nv},Yo=function i(e,t,n){var r=e.labels,s=e._recent||xV,a=e.duration()>=Ko?s.endTime(!1):e._dur,l,c,h;return os(t)&&(isNaN(t)||t in r)?(c=t.charAt(0),h=t.substr(-1)==="%",l=t.indexOf("="),c==="<"||c===">"?(l>=0&&(t=t.replace(/=/,"")),(c==="<"?s._start:s.endTime(s._repeat>=0))+(parseFloat(t.substr(1))||0)*(h?(l<0?s:n).totalDuration()/100:1)):l<0?(t in r||(r[t]=a),r[t]):(c=parseFloat(t.charAt(l-1)+t.substr(l+1)),h&&n&&(c=c/100*(zs(n)?n[0]:n).totalDuration()),l>1?i(e,t.substr(0,l-1),n)+c:a+c)):t==null?a:+t},ov=function(e,t,n){var r=Ec(t[1]),s=(r?2:1)+(e<2?0:1),a=t[s],l,c;if(r&&(a.duration=t[1]),a.parent=n,e){for(l=a,c=n;c&&!("immediateRender"in l);)l=c.vars.defaults||{},c=za(c.vars.inherit)&&c.parent;a.immediateRender=za(l.immediateRender),e<2?a.runBackwards=1:a.startAt=t[s-1]}return new Or(t[0],a,t[s+1])},Zf=function(e,t){return e||e===0?t(e):t},oy=function(e,t,n){return nt?t:n},ks=function(e,t){return!os(e)||!(t=lV.exec(e))?"":t[1]},_V=function(e,t,n){return Zf(n,function(r){return oy(e,t,r)})},NT=[].slice,qI=function(e,t){return e&&Uu(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&Uu(e[0]))&&!e.nodeType&&e!==Mu},bV=function(e,t,n){return n===void 0&&(n=[]),e.forEach(function(r){var s;return os(r)&&!t||qI(r,1)?(s=n).push.apply(s,Qo(r)):n.push(r)})||n},Qo=function(e,t,n){return qi&&!t&&qi.selector?qi.selector(e):os(e)&&!n&&(AT||!Pm())?NT.call((t||nA).querySelectorAll(e),0):zs(e)?bV(e,n):qI(e)?NT.call(e,0):e?[e]:[]},UT=function(e){return e=Qo(e)[0]||Dv("Invalid scope")||{},function(t){var n=e.current||e.nativeElement||e;return Qo(t,n.querySelectorAll?n:n===e?Dv("Invalid scope")||nA.createElement("div"):e)}},ZI=function(e){return e.sort(function(){return .5-Math.random()})},KI=function(e){if(gr(e))return e;var t=Uu(e)?e:{each:e},n=xd(t.ease),r=t.from||0,s=parseFloat(t.base)||0,a={},l=r>0&&r<1,c=isNaN(r)||l,h=t.axis,p=r,g=r;return os(r)?p=g={center:.5,edges:.5,end:1}[r]||0:!l&&c&&(p=r[0],g=r[1]),function(v,x,b){var w=(b||t).length,S=a[w],M,A,D,R,I,P,F,N,L;if(!S){if(L=t.grid==="auto"?0:(t.grid||[1,Ko])[1],!L){for(F=-Ko;F<(F=b[L++].getBoundingClientRect().left)&&LF&&(F=I),Iw?w-1:h?h==="y"?w/L:L:Math.max(L,w/L))||0)*(r==="edges"?-1:1),S.b=w<0?s-w:s,S.u=ks(t.amount||t.each)||0,n=n&&w<0?aP(n):n}return w=(S[v]-S.min)/S.max||0,nr(S.b+(n?n(w):w)*S.v)+S.u}},LT=function(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(n){var r=nr(Math.round(parseFloat(n)/e)*e*t);return(r-r%1)/t+(Ec(n)?0:ks(n))}},QI=function(e,t){var n=zs(e),r,s;return!n&&Uu(e)&&(r=n=e.radius||Ko,e.values?(e=Qo(e.values),(s=!Ec(e[0]))&&(r*=r)):e=LT(e.increment)),Zf(t,n?gr(e)?function(a){return s=e(a),Math.abs(s-a)<=r?s:a}:function(a){for(var l=parseFloat(s?a.x:a),c=parseFloat(s?a.y:0),h=Ko,p=0,g=e.length,v,x;g--;)s?(v=e[g].x-l,x=e[g].y-c,v=v*v+x*x):v=Math.abs(e[g]-l),vr?s-a:a)})},Uv=function(e){return e.replace(sV,function(t){var n=t.indexOf("[")+1,r=t.substring(n||7,n?t.indexOf("]"):t.length-1).split(aV);return JI(n?r:+r[0],n?0:+r[1],+r[2]||1e-5)})},eP=function(e,t,n,r,s){var a=t-e,l=r-n;return Zf(s,function(c){return n+((c-e)/a*l||0)})},AV=function i(e,t,n,r){var s=isNaN(e+t)?0:function(x){return(1-x)*e+x*t};if(!s){var a=os(e),l={},c,h,p,g,v;if(n===!0&&(r=1)&&(n=null),a)e={p:e},t={p:t};else if(zs(e)&&!zs(t)){for(p=[],g=e.length,v=g-2,h=1;h(l=Math.abs(l))&&(c=a,s=l);return c},ro=function(e,t,n){var r=e.vars,s=r[t],a=qi,l=e._ctx,c,h,p;if(s)return c=r[t+"Params"],h=r.callbackScope||e,n&&Ff.length&&I1(),l&&(qi=l),p=c?s.apply(h,c):s.call(h),qi=a,p},q0=function(e){return Vf(e),e.scrollTrigger&&e.scrollTrigger.kill(!!Ss),e.progress()<1&&ro(e,"onInterrupt"),e},ym,tP=[],nP=function(e){if(e)if(e=!e.name&&e.default||e,tA()||e.headless){var t=e.name,n=gr(e),r=t&&!n&&e.init?function(){this._props=[]}:e,s={init:Nv,render:hA,add:lA,kill:HV,modifier:GV,rawVars:0},a={targetTest:0,get:0,getSetter:fA,aliases:{},register:0};if(Pm(),e!==r){if(to[t])return;ho(r,ho(P1(e,s),a)),Um(r.prototype,Um(s,P1(e,a))),to[r.prop=t]=r,e.targetTest&&(m1.push(r),rA[t]=1),t=(t==="css"?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}kI(t,r),e.register&&e.register(Ha,r,Va)}else tP.push(e)},Si=255,Z0={aqua:[0,Si,Si],lime:[0,Si,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Si],navy:[0,0,128],white:[Si,Si,Si],olive:[128,128,0],yellow:[Si,Si,0],orange:[Si,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Si,0,0],pink:[Si,192,203],cyan:[0,Si,Si],transparent:[Si,Si,Si,0]},VM=function(e,t,n){return e+=e<0?1:e>1?-1:0,(e*6<1?t+(n-t)*e*6:e<.5?n:e*3<2?t+(n-t)*(2/3-e)*6:t)*Si+.5|0},iP=function(e,t,n){var r=e?Ec(e)?[e>>16,e>>8&Si,e&Si]:0:Z0.black,s,a,l,c,h,p,g,v,x,b;if(!r){if(e.substr(-1)===","&&(e=e.substr(0,e.length-1)),Z0[e])r=Z0[e];else if(e.charAt(0)==="#"){if(e.length<6&&(s=e.charAt(1),a=e.charAt(2),l=e.charAt(3),e="#"+s+s+a+a+l+l+(e.length===5?e.charAt(4)+e.charAt(4):"")),e.length===9)return r=parseInt(e.substr(1,6),16),[r>>16,r>>8&Si,r&Si,parseInt(e.substr(7),16)/255];e=parseInt(e.substr(1),16),r=[e>>16,e>>8&Si,e&Si]}else if(e.substr(0,3)==="hsl"){if(r=b=e.match(JR),!t)c=+r[0]%360/360,h=+r[1]/100,p=+r[2]/100,a=p<=.5?p*(h+1):p+h-p*h,s=p*2-a,r.length>3&&(r[3]*=1),r[0]=VM(c+1/3,s,a),r[1]=VM(c,s,a),r[2]=VM(c-1/3,s,a);else if(~e.indexOf("="))return r=e.match(II),n&&r.length<4&&(r[3]=1),r}else r=e.match(JR)||Z0.transparent;r=r.map(Number)}return t&&!b&&(s=r[0]/Si,a=r[1]/Si,l=r[2]/Si,g=Math.max(s,a,l),v=Math.min(s,a,l),p=(g+v)/2,g===v?c=h=0:(x=g-v,h=p>.5?x/(2-g-v):x/(g+v),c=g===s?(a-l)/x+(ae||M<0)&&(n+=M-t),r+=M,I=r-n,D=I-a,(D>0||A)&&(P=++g.frame,v=I-g.time*1e3,g.time=I=I/1e3,a+=D+(D>=s?4:s-D),R=1),A||(c=h(w)),R)for(x=0;x=M&&x--},_listeners:l},g})(),Pm=function(){return!Lv&&no.wake()},qn={},RV=/^[\d.\-M][\d.\-,\s]/,DV=/["']/g,NV=function(e){for(var t={},n=e.substr(1,e.length-3).split(":"),r=n[0],s=1,a=n.length,l,c,h;s1&&n.config?n.config.apply(null,~e.indexOf("{")?[NV(t[1])]:UV(e).split(",").map(GI)):qn._CE&&RV.test(e)?qn._CE("",e):n},aP=function(e){return function(t){return 1-e(1-t)}},oP=function i(e,t){for(var n=e._first,r;n;)n instanceof aa?i(n,t):n.vars.yoyoEase&&(!n._yoyo||!n._repeat)&&n._yoyo!==t&&(n.timeline?i(n.timeline,t):(r=n._ease,n._ease=n._yEase,n._yEase=r,n._yoyo=t)),n=n._next},xd=function(e,t){return e&&(gr(e)?e:qn[e]||LV(e))||t},Pd=function(e,t,n,r){n===void 0&&(n=function(c){return 1-t(1-c)}),r===void 0&&(r=function(c){return c<.5?t(c*2)/2:1-t((1-c)*2)/2});var s={easeIn:t,easeOut:n,easeInOut:r},a;return Ba(e,function(l){qn[l]=fo[l]=s,qn[a=l.toLowerCase()]=n;for(var c in s)qn[a+(c==="easeIn"?".in":c==="easeOut"?".out":".inOut")]=qn[l+"."+c]=s[c]}),s},lP=function(e){return function(t){return t<.5?(1-e(1-t*2))/2:.5+e((t-.5)*2)/2}},GM=function i(e,t,n){var r=t>=1?t:1,s=(n||(e?.3:.45))/(t<1?t:1),a=s/ET*(Math.asin(1/r)||0),l=function(p){return p===1?1:r*Math.pow(2,-10*p)*rV((p-a)*s)+1},c=e==="out"?l:e==="in"?function(h){return 1-l(1-h)}:lP(l);return s=ET/s,c.config=function(h,p){return i(e,h,p)},c},HM=function i(e,t){t===void 0&&(t=1.70158);var n=function(a){return a?--a*a*((t+1)*a+t)+1:0},r=e==="out"?n:e==="in"?function(s){return 1-n(1-s)}:lP(n);return r.config=function(s){return i(e,s)},r};Ba("Linear,Quad,Cubic,Quart,Quint,Strong",function(i,e){var t=e<5?e+1:e;Pd(i+",Power"+(t-1),e?function(n){return Math.pow(n,t)}:function(n){return n},function(n){return 1-Math.pow(1-n,t)},function(n){return n<.5?Math.pow(n*2,t)/2:1-Math.pow((1-n)*2,t)/2})});qn.Linear.easeNone=qn.none=qn.Linear.easeIn;Pd("Elastic",GM("in"),GM("out"),GM());(function(i,e){var t=1/e,n=2*t,r=2.5*t,s=function(l){return l0?n+(n+this._rDelay)*this._repeat:n):this.totalDuration()&&this._dur},e.totalDuration=function(n){return arguments.length?(this._dirty=0,Im(this,this._repeat<0?n:(n-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},e.totalTime=function(n,r){if(Pm(),!arguments.length)return this._tTime;var s=this._dp;if(s&&s.smoothChildTiming&&this._ts){for(Zb(this,n),!s._dp||s.parent||jI(s,this);s&&s.parent;)s.parent._time!==s._start+(s._ts>=0?s._tTime/s._ts:(s.totalDuration()-s._tTime)/-s._ts)&&s.totalTime(s._tTime,!0),s=s.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&n0||!this._tDur&&!n)&&Tu(this._dp,this,this._start-this._delay)}return(this._tTime!==n||!this._dur&&!r||this._initted&&Math.abs(this._zTime)===Mi||!this._initted&&this._dur&&n||!n&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=n),VI(this,n,r)),this},e.time=function(n,r){return arguments.length?this.totalTime(Math.min(this.totalDuration(),n+tD(this))%(this._dur+this._rDelay)||(n?this._dur:0),r):this._time},e.totalProgress=function(n,r){return arguments.length?this.totalTime(this.totalDuration()*n,r):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>=0&&this._initted?1:0},e.progress=function(n,r){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-n:n)+tD(this),r):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},e.iteration=function(n,r){var s=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(n-1)*s,r):this._repeat?Lm(this._tTime,s)+1:1},e.timeScale=function(n,r){if(!arguments.length)return this._rts===-Mi?0:this._rts;if(this._rts===n)return this;var s=this.parent&&this._ts?O1(this.parent._time,this):this._tTime;return this._rts=+n||0,this._ts=this._ps||n===-Mi?0:this._rts,this.totalTime(oy(-Math.abs(this._delay),this.totalDuration(),s),r!==!1),qb(this),pV(this)},e.paused=function(n){return arguments.length?(this._ps!==n&&(this._ps=n,n?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(Pm(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==Mi&&(this._tTime-=Mi)))),this):this._ps},e.startTime=function(n){if(arguments.length){this._start=nr(n);var r=this.parent||this._dp;return r&&(r._sort||!this.parent)&&Tu(r,this,this._start-this._delay),this}return this._start},e.endTime=function(n){return this._start+(za(n)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},e.rawTime=function(n){var r=this.parent||this._dp;return r?n&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?O1(r.rawTime(n),this):this._tTime:this._tTime},e.revert=function(n){n===void 0&&(n=cV);var r=Ss;return Ss=n,oA(this)&&(this.timeline&&this.timeline.revert(n),this.totalTime(-.01,n.suppressEvents)),this.data!=="nested"&&n.kill!==!1&&this.kill(),Ss=r,this},e.globalTime=function(n){for(var r=this,s=arguments.length?n:r.rawTime();r;)s=r._start+s/(Math.abs(r._ts)||1),r=r._dp;return!this.parent&&this._sat?this._sat.globalTime(n):s},e.repeat=function(n){return arguments.length?(this._repeat=n===1/0?-2:n,nD(this)):this._repeat===-2?1/0:this._repeat},e.repeatDelay=function(n){if(arguments.length){var r=this._time;return this._rDelay=n,nD(this),r?this.time(r):this}return this._rDelay},e.yoyo=function(n){return arguments.length?(this._yoyo=n,this):this._yoyo},e.seek=function(n,r){return this.totalTime(Yo(this,n),za(r))},e.restart=function(n,r){return this.play().totalTime(n?-this._delay:0,za(r)),this._dur||(this._zTime=-Mi),this},e.play=function(n,r){return n!=null&&this.seek(n,r),this.reversed(!1).paused(!1)},e.reverse=function(n,r){return n!=null&&this.seek(n||this.totalDuration(),r),this.reversed(!0).paused(!1)},e.pause=function(n,r){return n!=null&&this.seek(n,r),this.paused(!0)},e.resume=function(){return this.paused(!1)},e.reversed=function(n){return arguments.length?(!!n!==this.reversed()&&this.timeScale(-this._rts||(n?-Mi:0)),this):this._rts<0},e.invalidate=function(){return this._initted=this._act=0,this._zTime=-Mi,this},e.isActive=function(){var n=this.parent||this._dp,r=this._start,s;return!!(!n||this._ts&&this._initted&&n.isActive()&&(s=n.rawTime(!0))>=r&&s1?(r?(a[n]=r,s&&(a[n+"Params"]=s),n==="onUpdate"&&(this._onUpdate=r)):delete a[n],this):a[n]},e.then=function(n){var r=this,s=r._prom;return new Promise(function(a){var l=gr(n)?n:HI,c=function(){var p=r.then;r.then=null,s&&s(),gr(l)&&(l=l(r))&&(l.then||l===r)&&(r.then=p),a(l),r.then=p};r._initted&&r.totalProgress()===1&&r._ts>=0||!r._tTime&&r._ts<0?c():r._prom=c})},e.kill=function(){q0(this)},i})();ho(Iv.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:-Mi,_prom:0,_ps:!1,_rts:1});var aa=(function(i){NI(e,i);function e(n,r){var s;return n===void 0&&(n={}),s=i.call(this,n)||this,s.labels={},s.smoothChildTiming=!!n.smoothChildTiming,s.autoRemoveChildren=!!n.autoRemoveChildren,s._sort=za(n.sortChildren),ir&&Tu(n.parent||ir,bc(s),r),n.reversed&&s.reverse(),n.paused&&s.paused(!0),n.scrollTrigger&&XI(bc(s),n.scrollTrigger),s}var t=e.prototype;return t.to=function(r,s,a){return ov(0,arguments,this),this},t.from=function(r,s,a){return ov(1,arguments,this),this},t.fromTo=function(r,s,a,l){return ov(2,arguments,this),this},t.set=function(r,s,a){return s.duration=0,s.parent=this,av(s).repeatDelay||(s.repeat=0),s.immediateRender=!!s.immediateRender,new Or(r,s,Yo(this,a),1),this},t.call=function(r,s,a){return Tu(this,Or.delayedCall(0,r,s),a)},t.staggerTo=function(r,s,a,l,c,h,p){return a.duration=s,a.stagger=a.stagger||l,a.onComplete=h,a.onCompleteParams=p,a.parent=this,new Or(r,a,Yo(this,c)),this},t.staggerFrom=function(r,s,a,l,c,h,p){return a.runBackwards=1,av(a).immediateRender=za(a.immediateRender),this.staggerTo(r,s,a,l,c,h,p)},t.staggerFromTo=function(r,s,a,l,c,h,p,g){return l.startAt=a,av(l).immediateRender=za(l.immediateRender),this.staggerTo(r,s,l,c,h,p,g)},t.render=function(r,s,a){var l=this._time,c=this._dirty?this.totalDuration():this._tDur,h=this._dur,p=r<=0?0:nr(r),g=this._zTime<0!=r<0&&(this._initted||!h),v,x,b,w,S,M,A,D,R,I,P,F;if(this!==ir&&p>c&&r>=0&&(p=c),p!==this._tTime||a||g){if(l!==this._time&&h&&(p+=this._time-l,r+=this._time-l),v=p,R=this._start,D=this._ts,M=!D,g&&(h||(l=this._zTime),(r||!s)&&(this._zTime=r)),this._repeat){if(P=this._yoyo,S=h+this._rDelay,this._repeat<-1&&r<0)return this.totalTime(S*100+r,s,a);if(v=nr(p%S),p===c?(w=this._repeat,v=h):(I=nr(p/S),w=~~I,w&&w===I&&(v=h,w--),v>h&&(v=h)),I=Lm(this._tTime,S),!l&&this._tTime&&I!==w&&this._tTime-I*S-this._dur<=0&&(I=w),P&&w&1&&(v=h-v,F=1),w!==I&&!this._lock){var N=P&&I&1,L=N===(P&&w&1);if(w=l&&r>=0)for(x=this._first;x;){if(b=x._next,(x._act||v>=x._start)&&x._ts&&A!==x){if(x.parent!==this)return this.render(r,s,a);if(x.render(x._ts>0?(v-x._start)*x._ts:(x._dirty?x.totalDuration():x._tDur)+(v-x._start)*x._ts,s,a),v!==this._time||!this._ts&&!M){A=0,b&&(p+=this._zTime=-Mi);break}}x=b}else{x=this._last;for(var G=r<0?r:v;x;){if(b=x._prev,(x._act||G<=x._end)&&x._ts&&A!==x){if(x.parent!==this)return this.render(r,s,a);if(x.render(x._ts>0?(G-x._start)*x._ts:(x._dirty?x.totalDuration():x._tDur)+(G-x._start)*x._ts,s,a||Ss&&oA(x)),v!==this._time||!this._ts&&!M){A=0,b&&(p+=this._zTime=G?-Mi:Mi);break}}x=b}}if(A&&!s&&(this.pause(),A.render(v>=l?0:-Mi)._zTime=v>=l?1:-1,this._ts))return this._start=R,qb(this),this.render(r,s,a);this._onUpdate&&!s&&ro(this,"onUpdate",!0),(p===c&&this._tTime>=this.totalDuration()||!p&&l)&&(R===this._start||Math.abs(D)!==Math.abs(this._ts))&&(this._lock||((r||!h)&&(p===c&&this._ts>0||!p&&this._ts<0)&&Vf(this,1),!s&&!(r<0&&!l)&&(p||l||!c)&&(ro(this,p===c&&r>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(p0)&&this._prom())))}return this},t.add=function(r,s){var a=this;if(Ec(s)||(s=Yo(this,s,r)),!(r instanceof Iv)){if(zs(r))return r.forEach(function(l){return a.add(l,s)}),this;if(os(r))return this.addLabel(r,s);if(gr(r))r=Or.delayedCall(0,r);else return this}return this!==r?Tu(this,r,s):this},t.getChildren=function(r,s,a,l){r===void 0&&(r=!0),s===void 0&&(s=!0),a===void 0&&(a=!0),l===void 0&&(l=-Ko);for(var c=[],h=this._first;h;)h._start>=l&&(h instanceof Or?s&&c.push(h):(a&&c.push(h),r&&c.push.apply(c,h.getChildren(!0,s,a)))),h=h._next;return c},t.getById=function(r){for(var s=this.getChildren(1,1,1),a=s.length;a--;)if(s[a].vars.id===r)return s[a]},t.remove=function(r){return os(r)?this.removeLabel(r):gr(r)?this.killTweensOf(r):(r.parent===this&&Yb(this,r),r===this._recent&&(this._recent=this._last),yd(this))},t.totalTime=function(r,s){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=nr(no.time-(this._ts>0?r/this._ts:(this.totalDuration()-r)/-this._ts))),i.prototype.totalTime.call(this,r,s),this._forcing=0,this):this._tTime},t.addLabel=function(r,s){return this.labels[r]=Yo(this,s),this},t.removeLabel=function(r){return delete this.labels[r],this},t.addPause=function(r,s,a){var l=Or.delayedCall(0,s||Nv,a);return l.data="isPause",this._hasPause=1,Tu(this,l,Yo(this,r))},t.removePause=function(r){var s=this._first;for(r=Yo(this,r);s;)s._start===r&&s.data==="isPause"&&Vf(s),s=s._next},t.killTweensOf=function(r,s,a){for(var l=this.getTweensOf(r,a),c=l.length;c--;)Df!==l[c]&&l[c].kill(r,s);return this},t.getTweensOf=function(r,s){for(var a=[],l=Qo(r),c=this._first,h=Ec(s),p;c;)c instanceof Or?fV(c._targets,l)&&(h?(!Df||c._initted&&c._ts)&&c.globalTime(0)<=s&&c.globalTime(c.totalDuration())>s:!s||c.isActive())&&a.push(c):(p=c.getTweensOf(l,s)).length&&a.push.apply(a,p),c=c._next;return a},t.tweenTo=function(r,s){s=s||{};var a=this,l=Yo(a,r),c=s,h=c.startAt,p=c.onStart,g=c.onStartParams,v=c.immediateRender,x,b=Or.to(a,ho({ease:s.ease||"none",lazy:!1,immediateRender:!1,time:l,overwrite:"auto",duration:s.duration||Math.abs((l-(h&&"time"in h?h.time:a._time))/a.timeScale())||Mi,onStart:function(){if(a.pause(),!x){var S=s.duration||Math.abs((l-(h&&"time"in h?h.time:a._time))/a.timeScale());b._dur!==S&&Im(b,S,0,1).render(b._time,!0,!0),x=1}p&&p.apply(b,g||[])}},s));return v?b.render(0):b},t.tweenFromTo=function(r,s,a){return this.tweenTo(s,ho({startAt:{time:Yo(this,r)}},a))},t.recent=function(){return this._recent},t.nextLabel=function(r){return r===void 0&&(r=this._time),iD(this,Yo(this,r))},t.previousLabel=function(r){return r===void 0&&(r=this._time),iD(this,Yo(this,r),1)},t.currentLabel=function(r){return arguments.length?this.seek(r,!0):this.previousLabel(this._time+Mi)},t.shiftChildren=function(r,s,a){a===void 0&&(a=0);var l=this._first,c=this.labels,h;for(r=nr(r);l;)l._start>=a&&(l._start+=r,l._end+=r),l=l._next;if(s)for(h in c)c[h]>=a&&(c[h]+=r);return yd(this)},t.invalidate=function(r){var s=this._first;for(this._lock=0;s;)s.invalidate(r),s=s._next;return i.prototype.invalidate.call(this,r)},t.clear=function(r){r===void 0&&(r=!0);for(var s=this._first,a;s;)a=s._next,this.remove(s),s=a;return this._dp&&(this._time=this._tTime=this._pTime=0),r&&(this.labels={}),yd(this)},t.totalDuration=function(r){var s=0,a=this,l=a._last,c=Ko,h,p,g;if(arguments.length)return a.timeScale((a._repeat<0?a.duration():a.totalDuration())/(a.reversed()?-r:r));if(a._dirty){for(g=a.parent;l;)h=l._prev,l._dirty&&l.totalDuration(),p=l._start,p>c&&a._sort&&l._ts&&!a._lock?(a._lock=1,Tu(a,l,p-l._delay,1)._lock=0):c=p,p<0&&l._ts&&(s-=p,(!g&&!a._dp||g&&g.smoothChildTiming)&&(a._start+=nr(p/a._ts),a._time-=p,a._tTime-=p),a.shiftChildren(-p,!1,-1/0),c=0),l._end>s&&l._ts&&(s=l._end),l=h;Im(a,a===ir&&a._time>s?a._time:s,1,1),a._dirty=0}return a._tDur},e.updateRoot=function(r){if(ir._ts&&(VI(ir,O1(r,ir)),zI=no.frame),no.frame>=$R){$R+=lo.autoSleep||120;var s=ir._first;if((!s||!s._ts)&&lo.autoSleep&&no._listeners.length<2){for(;s&&!s._ts;)s=s._next;s||no.sleep()}}},e})(Iv);ho(aa.prototype,{_lock:0,_hasPause:0,_forcing:0});var IV=function(e,t,n,r,s,a,l){var c=new Va(this._pt,e,t,0,1,mP,null,s),h=0,p=0,g,v,x,b,w,S,M,A;for(c.b=n,c.e=r,n+="",r+="",(M=~r.indexOf("random("))&&(r=Uv(r)),a&&(A=[n,r],a(A,e,t),n=A[0],r=A[1]),v=n.match(zM)||[];g=zM.exec(r);)b=g[0],w=r.substring(h,g.index),x?x=(x+1)%5:w.substr(-5)==="rgba("&&(x=1),b!==v[p++]&&(S=parseFloat(v[p-1])||0,c._pt={_next:c._pt,p:w||p===1?w:",",s:S,c:b.charAt(1)==="="?Sm(S,b)-S:parseFloat(b)-S,m:x&&x<4?Math.round:0},h=zM.lastIndex);return c.c=h")}),R.duration();else{P={};for(N in b)N==="ease"||N==="easeEach"||kV(N,b[N],P,b.easeEach);for(N in P)for(q=P[N].sort(function(j,$){return j.t-$.t}),W=0,I=0;Ic-Mi&&!p?c:rh&&(v=h)),M=this._yoyo&&b&1,M&&(R=this._yEase,v=h-v),S=Lm(this._tTime,w),v===l&&!a&&this._initted&&b===S)return this._tTime=g,this;b!==S&&(D&&this._yEase&&oP(D,M),this.vars.repeatRefresh&&!M&&!this._lock&&v!==w&&this._initted&&(this._lock=a=1,this.render(nr(w*b),!0).invalidate()._lock=0))}if(!this._initted){if(YI(this,p?r:v,a,s,g))return this._tTime=0,this;if(l!==this._time&&!(a&&this.vars.repeatRefresh&&b!==S))return this;if(h!==this._dur)return this.render(r,s,a)}if(this._tTime=g,this._time=v,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=A=(R||this._ease)(v/h),this._from&&(this.ratio=A=1-A),!l&&g&&!s&&!S&&(ro(this,"onStart"),this._tTime!==g))return this;for(x=this._pt;x;)x.r(A,x.d),x=x._next;D&&D.render(r<0?r:D._dur*D._ease(v/this._dur),s,a)||this._startAt&&(this._zTime=r),this._onUpdate&&!s&&(p&&RT(this,r,s,a),ro(this,"onUpdate")),this._repeat&&b!==S&&this.vars.onRepeat&&!s&&this.parent&&ro(this,"onRepeat"),(g===this._tDur||!g)&&this._tTime===g&&(p&&!this._onUpdate&&RT(this,r,!0,!0),(r||!h)&&(g===this._tDur&&this._ts>0||!g&&this._ts<0)&&Vf(this,1),!s&&!(p&&!l)&&(g||l||M)&&(ro(this,g===c?"onComplete":"onReverseComplete",!0),this._prom&&!(g0)&&this._prom()))}return this},t.targets=function(){return this._targets},t.invalidate=function(r){return(!r||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(r),i.prototype.invalidate.call(this,r)},t.resetTo=function(r,s,a,l,c){Lv||no.wake(),this._ts||this.play();var h=Math.min(this._dur,(this._dp._time-this._start)*this._ts),p;return this._initted||uA(this,h),p=this._ease(h/this._dur),OV(this,r,s,a,l,p,h,c)?this.resetTo(r,s,a,l,1):(Zb(this,0),this.parent||WI(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},t.kill=function(r,s){if(s===void 0&&(s="all"),!r&&(!s||s==="all"))return this._lazy=this._pt=0,this.parent?q0(this):this.scrollTrigger&&this.scrollTrigger.kill(!!Ss),this;if(this.timeline){var a=this.timeline.totalDuration();return this.timeline.killTweensOf(r,s,Df&&Df.vars.overwrite!==!0)._first||q0(this),this.parent&&a!==this.timeline.totalDuration()&&Im(this,this._dur*this.timeline._tDur/a,0,1),this}var l=this._targets,c=r?Qo(r):l,h=this._ptLookup,p=this._pt,g,v,x,b,w,S,M;if((!s||s==="all")&&dV(l,c))return s==="all"&&(this._pt=0),q0(this);for(g=this._op=this._op||[],s!=="all"&&(os(s)&&(w={},Ba(s,function(A){return w[A]=1}),s=w),s=FV(l,s)),M=l.length;M--;)if(~c.indexOf(l[M])){v=h[M],s==="all"?(g[M]=s,b=v,x={}):(x=g[M]=g[M]||{},b=s);for(w in b)S=v&&v[w],S&&((!("kill"in S.d)||S.d.kill(w)===!0)&&Yb(this,S,"_pt"),delete v[w]),x!=="all"&&(x[w]=1)}return this._initted&&!this._pt&&p&&q0(this),this},e.to=function(r,s){return new e(r,s,arguments[2])},e.from=function(r,s){return ov(1,arguments)},e.delayedCall=function(r,s,a,l){return new e(s,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:r,onComplete:s,onReverseComplete:s,onCompleteParams:a,onReverseCompleteParams:a,callbackScope:l})},e.fromTo=function(r,s,a){return ov(2,arguments)},e.set=function(r,s){return s.duration=0,s.repeatDelay||(s.repeat=0),new e(r,s)},e.killTweensOf=function(r,s,a){return ir.killTweensOf(r,s,a)},e})(Iv);ho(Or.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0});Ba("staggerTo,staggerFrom,staggerFromTo",function(i){Or[i]=function(){var e=new aa,t=NT.call(arguments,0);return t.splice(i==="staggerFromTo"?5:4,0,0),e[i].apply(e,t)}});var cA=function(e,t,n){return e[t]=n},dP=function(e,t,n){return e[t](n)},zV=function(e,t,n,r){return e[t](r.fp,n)},BV=function(e,t,n){return e.setAttribute(t,n)},fA=function(e,t){return gr(e[t])?dP:eA(e[t])&&e.setAttribute?BV:cA},pP=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e6)/1e6,t)},VV=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},mP=function(e,t){var n=t._pt,r="";if(!e&&t.b)r=t.b;else if(e===1&&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)},hA=function(e,t){for(var n=t._pt;n;)n.r(e,n.d),n=n._next},GV=function(e,t,n,r){for(var s=this._pt,a;s;)a=s._next,s.p===r&&s.modifier(e,t,n),s=a},HV=function(e){for(var t=this._pt,n,r;t;)r=t._next,t.p===e&&!t.op||t.op===e?Yb(this,t,"_pt"):t.dep||(n=1),t=r;return!n},WV=function(e,t,n,r){r.mSet(e,t,r.m.call(r.tween,n,r.mt),r)},gP=function(e){for(var t=e._pt,n,r,s,a;t;){for(n=t._next,r=s;r&&r.pr>t.pr;)r=r._next;(t._prev=r?r._prev:a)?t._prev._next=t:s=t,(t._next=r)?r._prev=t:a=t,t=n}e._pt=s},Va=(function(){function i(t,n,r,s,a,l,c,h,p){this.t=n,this.s=s,this.c=a,this.p=r,this.r=l||pP,this.d=c||this,this.set=h||cA,this.pr=p||0,this._next=t,t&&(t._prev=this)}var e=i.prototype;return e.modifier=function(n,r,s){this.mSet=this.mSet||this.set,this.set=WV,this.m=n,this.mt=s,this.tween=r},i})();Ba(sA+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",function(i){return rA[i]=1});fo.TweenMax=fo.TweenLite=Or;fo.TimelineLite=fo.TimelineMax=aa;ir=new aa({sortChildren:!1,defaults:Nm,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0});lo.stringFilter=sP;var _d=[],g1={},jV=[],sD=0,XV=0,WM=function(e){return(g1[e]||jV).map(function(t){return t()})},PT=function(){var e=Date.now(),t=[];e-sD>2&&(WM("matchMediaInit"),_d.forEach(function(n){var r=n.queries,s=n.conditions,a,l,c,h;for(l in r)a=Mu.matchMedia(r[l]).matches,a&&(c=1),a!==s[l]&&(s[l]=a,h=1);h&&(n.revert(),c&&t.push(n))}),WM("matchMediaRevert"),t.forEach(function(n){return n.onMatch(n,function(r){return n.add(null,r)})}),sD=e,WM("matchMedia"))},vP=(function(){function i(t,n){this.selector=n&&UT(n),this.data=[],this._r=[],this.isReverted=!1,this.id=XV++,t&&this.add(t)}var e=i.prototype;return e.add=function(n,r,s){gr(n)&&(s=r,r=n,n=gr);var a=this,l=function(){var h=qi,p=a.selector,g;return h&&h!==a&&h.data.push(a),s&&(a.selector=UT(s)),qi=a,g=r.apply(a,arguments),gr(g)&&a._r.push(g),qi=h,a.selector=p,a.isReverted=!1,g};return a.last=l,n===gr?l(a,function(c){return a.add(null,c)}):n?a[n]=l:l},e.ignore=function(n){var r=qi;qi=null,n(this),qi=r},e.getTweens=function(){var n=[];return this.data.forEach(function(r){return r instanceof i?n.push.apply(n,r.getTweens()):r instanceof Or&&!(r.parent&&r.parent.data==="nested")&&n.push(r)}),n},e.clear=function(){this._r.length=this.data.length=0},e.kill=function(n,r){var s=this;if(n?(function(){for(var l=s.getTweens(),c=s.data.length,h;c--;)h=s.data[c],h.data==="isFlip"&&(h.revert(),h.getChildren(!0,!0,!1).forEach(function(p){return l.splice(l.indexOf(p),1)}));for(l.map(function(p){return{g:p._dur||p._delay||p._sat&&!p._sat.vars.immediateRender?p.globalTime(0):-1/0,t:p}}).sort(function(p,g){return g.g-p.g||-1/0}).forEach(function(p){return p.t.revert(n)}),c=s.data.length;c--;)h=s.data[c],h instanceof aa?h.data!=="nested"&&(h.scrollTrigger&&h.scrollTrigger.revert(),h.kill()):!(h instanceof Or)&&h.revert&&h.revert(n);s._r.forEach(function(p){return p(n,s)}),s.isReverted=!0})():this.data.forEach(function(l){return l.kill&&l.kill()}),this.clear(),r)for(var a=_d.length;a--;)_d[a].id===this.id&&_d.splice(a,1)},e.revert=function(n){this.kill(n||{})},i})(),YV=(function(){function i(t){this.contexts=[],this.scope=t,qi&&qi.data.push(this)}var e=i.prototype;return e.add=function(n,r,s){Uu(n)||(n={matches:n});var a=new vP(0,s||this.scope),l=a.conditions={},c,h,p;qi&&!a.selector&&(a.selector=qi.selector),this.contexts.push(a),r=a.add("onMatch",r),a.queries=n;for(h in n)h==="all"?p=1:(c=Mu.matchMedia(n[h]),c&&(_d.indexOf(a)<0&&_d.push(a),(l[h]=c.matches)&&(p=1),c.addListener?c.addListener(PT):c.addEventListener("change",PT)));return p&&r(a,function(g){return a.add(null,g)}),this},e.revert=function(n){this.kill(n||{})},e.kill=function(n){this.contexts.forEach(function(r){return r.kill(n,!0)})},i})(),F1={registerPlugin:function(){for(var e=arguments.length,t=new Array(e),n=0;n1){var r=e.map(function(p){return Ha.quickSetter(p,t,n)}),s=r.length;return function(p){for(var g=s;g--;)r[g](p)}}e=e[0]||{};var a=to[t],l=vd(e),c=l.harness&&(l.harness.aliases||{})[t]||t,h=a?function(p){var g=new a;ym._pt=0,g.init(e,n?p+n:p,ym,0,[e]),g.render(1,g),ym._pt&&hA(1,ym)}:l.set(e,c);return a?h:function(p){return h(e,c,n?p+n:p,l,1)}},quickTo:function(e,t,n){var r,s=Ha.to(e,ho((r={},r[t]="+=0.1",r.paused=!0,r.stagger=0,r),n||{})),a=function(c,h,p){return s.resetTo(t,c,h,p)};return a.tween=s,a},isTweening:function(e){return ir.getTweensOf(e,!0).length>0},defaults:function(e){return e&&e.ease&&(e.ease=xd(e.ease,Nm.ease)),eD(Nm,e||{})},config:function(e){return eD(lo,e||{})},registerEffect:function(e){var t=e.name,n=e.effect,r=e.plugins,s=e.defaults,a=e.extendTimeline;(r||"").split(",").forEach(function(l){return l&&!to[l]&&!fo[l]&&Dv(t+" effect requires "+l+" plugin.")}),BM[t]=function(l,c,h){return n(Qo(l),ho(c||{},s),h)},a&&(aa.prototype[t]=function(l,c,h){return this.add(BM[t](l,Uu(c)?c:(h=c)&&{},this),h)})},registerEase:function(e,t){qn[e]=xd(t)},parseEase:function(e,t){return arguments.length?xd(e,t):qn},getById:function(e){return ir.getById(e)},exportRoot:function(e,t){e===void 0&&(e={});var n=new aa(e),r,s;for(n.smoothChildTiming=za(e.smoothChildTiming),ir.remove(n),n._dp=0,n._time=n._tTime=ir._time,r=ir._first;r;)s=r._next,(t||!(!r._dur&&r instanceof Or&&r.vars.onComplete===r._targets[0]))&&Tu(n,r,r._start-r._delay),r=s;return Tu(ir,n,0),n},context:function(e,t){return e?new vP(e,t):qi},matchMedia:function(e){return new YV(e)},matchMediaRefresh:function(){return _d.forEach(function(e){var t=e.conditions,n,r;for(r in t)t[r]&&(t[r]=!1,n=1);n&&e.revert()})||PT()},addEventListener:function(e,t){var n=g1[e]||(g1[e]=[]);~n.indexOf(t)||n.push(t)},removeEventListener:function(e,t){var n=g1[e],r=n&&n.indexOf(t);r>=0&&n.splice(r,1)},utils:{wrap:TV,wrapYoyo:EV,distribute:KI,random:JI,snap:QI,normalize:wV,getUnit:ks,clamp:_V,splitColor:iP,toArray:Qo,selector:UT,mapRange:eP,pipe:SV,unitize:MV,interpolate:AV,shuffle:ZI},install:FI,effects:BM,ticker:no,updateRoot:aa.updateRoot,plugins:to,globalTimeline:ir,core:{PropTween:Va,globals:kI,Tween:Or,Timeline:aa,Animation:Iv,getCache:vd,_removeLinkedListItem:Yb,reverting:function(){return Ss},context:function(e){return e&&qi&&(qi.data.push(e),e._ctx=qi),qi},suppressOverwrites:function(e){return $E=e}}};Ba("to,from,fromTo,delayedCall,set,killTweensOf",function(i){return F1[i]=Or[i]});no.add(aa.updateRoot);ym=F1.to({},{duration:0});var qV=function(e,t){for(var n=e._pt;n&&n.p!==t&&n.op!==t&&n.fp!==t;)n=n._next;return n},ZV=function(e,t){var n=e._targets,r,s,a;for(r in t)for(s=n.length;s--;)a=e._ptLookup[s][r],a&&(a=a.d)&&(a._pt&&(a=qV(a,r)),a&&a.modifier&&a.modifier(t[r],e,n[s],r))},jM=function(e,t){return{name:e,headless:1,rawVars:1,init:function(r,s,a){a._onInit=function(l){var c,h;if(os(s)&&(c={},Ba(s,function(p){return c[p]=1}),s=c),t){c={};for(h in s)c[h]=t(s[h]);s=c}ZV(l,s)}}}},Ha=F1.registerPlugin({name:"attr",init:function(e,t,n,r,s){var a,l,c;this.tween=n;for(a in t)c=e.getAttribute(a)||"",l=this.add(e,"setAttribute",(c||0)+"",t[a],r,s,0,0,a),l.op=a,l.b=c,this._props.push(a)},render:function(e,t){for(var n=t._pt;n;)Ss?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)}},jM("roundProps",LT),jM("modifiers"),jM("snap",QI))||F1;Or.version=aa.version=Ha.version="3.14.2";OI=1;tA()&&Pm();qn.Power0;qn.Power1;qn.Power2;qn.Power3;qn.Power4;qn.Linear;qn.Quad;qn.Cubic;qn.Quart;qn.Quint;qn.Strong;qn.Elastic;qn.Back;qn.SteppedEase;qn.Bounce;qn.Sine;qn.Expo;qn.Circ;/*! * CSSPlugin 3.14.2 * https://gsap.com * * Copyright 2008-2025, GreenSock. All rights reserved. * Subject to the terms at https://gsap.com/standard-license * @author: Jack Doyle, jack@greensock.com */var aD,Nf,Mm,dA,ad,oD,pA,KV=function(){return typeof window<"u"},Ac={},td=180/Math.PI,wm=Math.PI/180,Bp=Math.atan2,lD=1e8,mA=/([A-Z])/g,QV=/(left|right|width|margin|padding|x)/i,JV=/[\s,\(]\S/,Au={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},OT=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},$V=function(e,t){return t.set(t.t,t.p,e===1?t.e:Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},e8=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)},t8=function(e,t){return t.set(t.t,t.p,e===1?t.e:e?Math.round((t.s+t.c*e)*1e4)/1e4+t.u:t.b,t)},n8=function(e,t){var n=t.s+t.c*e;t.set(t.t,t.p,~~(n+(n<0?-.5:.5))+t.u,t)},yP=function(e,t){return t.set(t.t,t.p,e?t.e:t.b,t)},xP=function(e,t){return t.set(t.t,t.p,e!==1?t.b:t.e,t)},i8=function(e,t,n){return e.style[t]=n},r8=function(e,t,n){return e.style.setProperty(t,n)},s8=function(e,t,n){return e._gsap[t]=n},a8=function(e,t,n){return e._gsap.scaleX=e._gsap.scaleY=n},o8=function(e,t,n,r,s){var a=e._gsap;a.scaleX=a.scaleY=n,a.renderTransform(s,a)},l8=function(e,t,n,r,s){var a=e._gsap;a[t]=n,a.renderTransform(s,a)},rr="transform",Ga=rr+"Origin",u8=function i(e,t){var n=this,r=this.target,s=r.style,a=r._gsap;if(e in Ac&&s){if(this.tfm=this.tfm||{},e!=="transform")e=Au[e]||e,~e.indexOf(",")?e.split(",").forEach(function(l){return n.tfm[l]=Sc(r,l)}):this.tfm[e]=a.x?a[e]:Sc(r,e),e===Ga&&(this.tfm.zOrigin=a.zOrigin);else return Au.transform.split(",").forEach(function(l){return i.call(n,l,t)});if(this.props.indexOf(rr)>=0)return;a.svg&&(this.svgo=r.getAttribute("data-svg-origin"),this.props.push(Ga,t,"")),e=rr}(s||t)&&this.props.push(e,t,s[e])},_P=function(e){e.translate&&(e.removeProperty("translate"),e.removeProperty("scale"),e.removeProperty("rotate"))},c8=function(){var e=this.props,t=this.target,n=t.style,r=t._gsap,s,a;for(s=0;s=0?uD[a]:"")+e},kT=function(){KV()&&window.document&&(aD=window,Nf=aD.document,Mm=Nf.documentElement,ad=FT("div")||{style:{}},FT("div"),rr=Om(rr),Ga=rr+"Origin",ad.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",SP=!!Om("perspective"),pA=Ha.core.reverting,dA=1)},cD=function(e){var t=e.ownerSVGElement,n=FT("svg",t&&t.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),r=e.cloneNode(!0),s;r.style.display="block",n.appendChild(r),Mm.appendChild(n);try{s=r.getBBox()}catch{}return n.removeChild(r),Mm.removeChild(n),s},fD=function(e,t){for(var n=t.length;n--;)if(e.hasAttribute(t[n]))return e.getAttribute(t[n])},MP=function(e){var t,n;try{t=e.getBBox()}catch{t=cD(e),n=1}return t&&(t.width||t.height)||n||(t=cD(e)),t&&!t.width&&!t.x&&!t.y?{x:+fD(e,["x","cx","x1"])||0,y:+fD(e,["y","cy","y1"])||0,width:0,height:0}:t},wP=function(e){return!!(e.getCTM&&(!e.parentNode||e.ownerSVGElement)&&MP(e))},Gf=function(e,t){if(t){var n=e.style,r;t in Ac&&t!==Ga&&(t=rr),n.removeProperty?(r=t.substr(0,2),(r==="ms"||t.substr(0,6)==="webkit")&&(t="-"+t),n.removeProperty(r==="--"?t:t.replace(mA,"-$1").toLowerCase())):n.removeAttribute(t)}},Uf=function(e,t,n,r,s,a){var l=new Va(e._pt,t,n,0,1,a?xP:yP);return e._pt=l,l.b=r,l.e=s,e._props.push(n),l},hD={deg:1,rad:1,turn:1},f8={grid:1,flex:1},Hf=function i(e,t,n,r){var s=parseFloat(n)||0,a=(n+"").trim().substr((s+"").length)||"px",l=ad.style,c=QV.test(t),h=e.tagName.toLowerCase()==="svg",p=(h?"client":"offset")+(c?"Width":"Height"),g=100,v=r==="px",x=r==="%",b,w,S,M;if(r===a||!s||hD[r]||hD[a])return s;if(a!=="px"&&!v&&(s=i(e,t,n,"px")),M=e.getCTM&&wP(e),(x||a==="%")&&(Ac[t]||~t.indexOf("adius")))return b=M?e.getBBox()[c?"width":"height"]:e[p],Tr(x?s/b*g:s/100*b);if(l[c?"width":"height"]=g+(v?a:r),w=r!=="rem"&&~t.indexOf("adius")||r==="em"&&e.appendChild&&!h?e:e.parentNode,M&&(w=(e.ownerSVGElement||{}).parentNode),(!w||w===Nf||!w.appendChild)&&(w=Nf.body),S=w._gsap,S&&x&&S.width&&c&&S.time===no.time&&!S.uncache)return Tr(s/S.width*g);if(x&&(t==="height"||t==="width")){var A=e.style[t];e.style[t]=g+r,b=e[p],A?e.style[t]=A:Gf(e,t)}else(x||a==="%")&&!f8[so(w,"display")]&&(l.position=so(e,"position")),w===e&&(l.position="static"),w.appendChild(ad),b=ad[p],w.removeChild(ad),l.position="absolute";return c&&x&&(S=vd(w),S.time=no.time,S.width=w[p]),Tr(v?b*s/g:b&&s?g/b*s:0)},Sc=function(e,t,n,r){var s;return dA||kT(),t in Au&&t!=="transform"&&(t=Au[t],~t.indexOf(",")&&(t=t.split(",")[0])),Ac[t]&&t!=="transform"?(s=Ov(e,r),s=t!=="transformOrigin"?s[t]:s.svg?s.origin:z1(so(e,Ga))+" "+s.zOrigin+"px"):(s=e.style[t],(!s||s==="auto"||r||~(s+"").indexOf("calc("))&&(s=k1[t]&&k1[t](e,t,n)||so(e,t)||BI(e,t)||(t==="opacity"?1:0))),n&&!~(s+"").trim().indexOf(" ")?Hf(e,t,s,n)+n:s},h8=function(e,t,n,r){if(!n||n==="none"){var s=Om(t,e,1),a=s&&so(e,s,1);a&&a!==n?(t=s,n=a):t==="borderColor"&&(n=so(e,"borderTopColor"))}var l=new Va(this._pt,e.style,t,0,1,mP),c=0,h=0,p,g,v,x,b,w,S,M,A,D,R,I;if(l.b=n,l.e=r,n+="",r+="",r.substring(0,6)==="var(--"&&(r=so(e,r.substring(4,r.indexOf(")")))),r==="auto"&&(w=e.style[t],e.style[t]=r,r=so(e,t)||r,w?e.style[t]=w:Gf(e,t)),p=[n,r],sP(p),n=p[0],r=p[1],v=n.match(vm)||[],I=r.match(vm)||[],I.length){for(;g=vm.exec(r);)S=g[0],A=r.substring(c,g.index),b?b=(b+1)%5:(A.substr(-5)==="rgba("||A.substr(-5)==="hsla(")&&(b=1),S!==(w=v[h++]||"")&&(x=parseFloat(w)||0,R=w.substr((x+"").length),S.charAt(1)==="="&&(S=Sm(x,S)+R),M=parseFloat(S),D=S.substr((M+"").length),c=vm.lastIndex-D.length,D||(D=D||lo.units[t]||R,c===r.length&&(r+=D,l.e+=D)),R!==D&&(x=Hf(e,t,w,D)||0),l._pt={_next:l._pt,p:A||h===1?A:",",s:x,c:M-x,m:b&&b<4||t==="zIndex"?Math.round:0});l.c=c-1;)l=s[h],Ac[l]&&(c=1,l=l==="transformOrigin"?Ga:rr),Gf(n,l);c&&(Gf(n,rr),a&&(a.svg&&n.removeAttribute("transform"),r.scale=r.rotate=r.translate="none",Ov(n,1),a.uncache=1,_P(r)))}},k1={clearProps:function(e,t,n,r,s){if(s.data!=="isFromStart"){var a=e._pt=new Va(e._pt,t,n,0,0,p8);return a.u=r,a.pr=-10,a.tween=s,e._props.push(n),1}}},Pv=[1,0,0,1,0,0],TP={},EP=function(e){return e==="matrix(1, 0, 0, 1, 0, 0)"||e==="none"||!e},pD=function(e){var t=so(e,rr);return EP(t)?Pv:t.substr(7).match(II).map(Tr)},gA=function(e,t){var n=e._gsap||vd(e),r=e.style,s=pD(e),a,l,c,h;return n.svg&&e.getAttribute("transform")?(c=e.transform.baseVal.consolidate().matrix,s=[c.a,c.b,c.c,c.d,c.e,c.f],s.join(",")==="1,0,0,1,0,0"?Pv:s):(s===Pv&&!e.offsetParent&&e!==Mm&&!n.svg&&(c=r.display,r.display="block",a=e.parentNode,(!a||!e.offsetParent&&!e.getBoundingClientRect().width)&&(h=1,l=e.nextElementSibling,Mm.appendChild(e)),s=pD(e),c?r.display=c:Gf(e,"display"),h&&(l?a.insertBefore(e,l):a?a.appendChild(e):Mm.removeChild(e))),t&&s.length>6?[s[0],s[1],s[4],s[5],s[12],s[13]]:s)},zT=function(e,t,n,r,s,a){var l=e._gsap,c=s||gA(e,!0),h=l.xOrigin||0,p=l.yOrigin||0,g=l.xOffset||0,v=l.yOffset||0,x=c[0],b=c[1],w=c[2],S=c[3],M=c[4],A=c[5],D=t.split(" "),R=parseFloat(D[0])||0,I=parseFloat(D[1])||0,P,F,N,L;n?c!==Pv&&(F=x*S-b*w)&&(N=R*(S/F)+I*(-w/F)+(w*A-S*M)/F,L=R*(-b/F)+I*(x/F)-(x*A-b*M)/F,R=N,I=L):(P=MP(e),R=P.x+(~D[0].indexOf("%")?R/100*P.width:R),I=P.y+(~(D[1]||D[0]).indexOf("%")?I/100*P.height:I)),r||r!==!1&&l.smooth?(M=R-h,A=I-p,l.xOffset=g+(M*x+A*w)-M,l.yOffset=v+(M*b+A*S)-A):l.xOffset=l.yOffset=0,l.xOrigin=R,l.yOrigin=I,l.smooth=!!r,l.origin=t,l.originIsAbsolute=!!n,e.style[Ga]="0px 0px",a&&(Uf(a,l,"xOrigin",h,R),Uf(a,l,"yOrigin",p,I),Uf(a,l,"xOffset",g,l.xOffset),Uf(a,l,"yOffset",v,l.yOffset)),e.setAttribute("data-svg-origin",R+" "+I)},Ov=function(e,t){var n=e._gsap||new uP(e);if("x"in n&&!t&&!n.uncache)return n;var r=e.style,s=n.scaleX<0,a="px",l="deg",c=getComputedStyle(e),h=so(e,Ga)||"0",p,g,v,x,b,w,S,M,A,D,R,I,P,F,N,L,G,X,W,q,K,ne,j,$,he,le,ue,k,Z,oe,fe,ve;return p=g=v=w=S=M=A=D=R=0,x=b=1,n.svg=!!(e.getCTM&&wP(e)),c.translate&&((c.translate!=="none"||c.scale!=="none"||c.rotate!=="none")&&(r[rr]=(c.translate!=="none"?"translate3d("+(c.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(c.rotate!=="none"?"rotate("+c.rotate+") ":"")+(c.scale!=="none"?"scale("+c.scale.split(" ").join(",")+") ":"")+(c[rr]!=="none"?c[rr]:"")),r.scale=r.rotate=r.translate="none"),F=gA(e,n.svg),n.svg&&(n.uncache?(he=e.getBBox(),h=n.xOrigin-he.x+"px "+(n.yOrigin-he.y)+"px",$=""):$=!t&&e.getAttribute("data-svg-origin"),zT(e,$||h,!!$||n.originIsAbsolute,n.smooth!==!1,F)),I=n.xOrigin||0,P=n.yOrigin||0,F!==Pv&&(X=F[0],W=F[1],q=F[2],K=F[3],p=ne=F[4],g=j=F[5],F.length===6?(x=Math.sqrt(X*X+W*W),b=Math.sqrt(K*K+q*q),w=X||W?Bp(W,X)*td:0,A=q||K?Bp(q,K)*td+w:0,A&&(b*=Math.abs(Math.cos(A*wm))),n.svg&&(p-=I-(I*X+P*q),g-=P-(I*W+P*K))):(ve=F[6],oe=F[7],ue=F[8],k=F[9],Z=F[10],fe=F[11],p=F[12],g=F[13],v=F[14],N=Bp(ve,Z),S=N*td,N&&(L=Math.cos(-N),G=Math.sin(-N),$=ne*L+ue*G,he=j*L+k*G,le=ve*L+Z*G,ue=ne*-G+ue*L,k=j*-G+k*L,Z=ve*-G+Z*L,fe=oe*-G+fe*L,ne=$,j=he,ve=le),N=Bp(-q,Z),M=N*td,N&&(L=Math.cos(-N),G=Math.sin(-N),$=X*L-ue*G,he=W*L-k*G,le=q*L-Z*G,fe=K*G+fe*L,X=$,W=he,q=le),N=Bp(W,X),w=N*td,N&&(L=Math.cos(N),G=Math.sin(N),$=X*L+W*G,he=ne*L+j*G,W=W*L-X*G,j=j*L-ne*G,X=$,ne=he),S&&Math.abs(S)+Math.abs(w)>359.9&&(S=w=0,M=180-M),x=Tr(Math.sqrt(X*X+W*W+q*q)),b=Tr(Math.sqrt(j*j+ve*ve)),N=Bp(ne,j),A=Math.abs(N)>2e-4?N*td:0,R=fe?1/(fe<0?-fe:fe):0),n.svg&&($=e.getAttribute("transform"),n.forceCSS=e.setAttribute("transform","")||!EP(so(e,rr)),$&&e.setAttribute("transform",$))),Math.abs(A)>90&&Math.abs(A)<270&&(s?(x*=-1,A+=w<=0?180:-180,w+=w<=0?180:-180):(b*=-1,A+=A<=0?180:-180)),t=t||n.uncache,n.x=p-((n.xPercent=p&&(!t&&n.xPercent||(Math.round(e.offsetWidth/2)===Math.round(-p)?-50:0)))?e.offsetWidth*n.xPercent/100:0)+a,n.y=g-((n.yPercent=g&&(!t&&n.yPercent||(Math.round(e.offsetHeight/2)===Math.round(-g)?-50:0)))?e.offsetHeight*n.yPercent/100:0)+a,n.z=v+a,n.scaleX=Tr(x),n.scaleY=Tr(b),n.rotation=Tr(w)+l,n.rotationX=Tr(S)+l,n.rotationY=Tr(M)+l,n.skewX=A+l,n.skewY=D+l,n.transformPerspective=R+a,(n.zOrigin=parseFloat(h.split(" ")[2])||!t&&n.zOrigin||0)&&(r[Ga]=z1(h)),n.xOffset=n.yOffset=0,n.force3D=lo.force3D,n.renderTransform=n.svg?g8:SP?AP:m8,n.uncache=0,n},z1=function(e){return(e=e.split(" "))[0]+" "+e[1]},XM=function(e,t,n){var r=ks(t);return Tr(parseFloat(t)+parseFloat(Hf(e,"x",n+"px",r)))+r},m8=function(e,t){t.z="0px",t.rotationY=t.rotationX="0deg",t.force3D=0,AP(e,t)},Oh="0deg",A0="0px",Fh=") ",AP=function(e,t){var n=t||this,r=n.xPercent,s=n.yPercent,a=n.x,l=n.y,c=n.z,h=n.rotation,p=n.rotationY,g=n.rotationX,v=n.skewX,x=n.skewY,b=n.scaleX,w=n.scaleY,S=n.transformPerspective,M=n.force3D,A=n.target,D=n.zOrigin,R="",I=M==="auto"&&e&&e!==1||M===!0;if(D&&(g!==Oh||p!==Oh)){var P=parseFloat(p)*wm,F=Math.sin(P),N=Math.cos(P),L;P=parseFloat(g)*wm,L=Math.cos(P),a=XM(A,a,F*L*-D),l=XM(A,l,-Math.sin(P)*-D),c=XM(A,c,N*L*-D+D)}S!==A0&&(R+="perspective("+S+Fh),(r||s)&&(R+="translate("+r+"%, "+s+"%) "),(I||a!==A0||l!==A0||c!==A0)&&(R+=c!==A0||I?"translate3d("+a+", "+l+", "+c+") ":"translate("+a+", "+l+Fh),h!==Oh&&(R+="rotate("+h+Fh),p!==Oh&&(R+="rotateY("+p+Fh),g!==Oh&&(R+="rotateX("+g+Fh),(v!==Oh||x!==Oh)&&(R+="skew("+v+", "+x+Fh),(b!==1||w!==1)&&(R+="scale("+b+", "+w+Fh),A.style[rr]=R||"translate(0, 0)"},g8=function(e,t){var n=t||this,r=n.xPercent,s=n.yPercent,a=n.x,l=n.y,c=n.rotation,h=n.skewX,p=n.skewY,g=n.scaleX,v=n.scaleY,x=n.target,b=n.xOrigin,w=n.yOrigin,S=n.xOffset,M=n.yOffset,A=n.forceCSS,D=parseFloat(a),R=parseFloat(l),I,P,F,N,L;c=parseFloat(c),h=parseFloat(h),p=parseFloat(p),p&&(p=parseFloat(p),h+=p,c+=p),c||h?(c*=wm,h*=wm,I=Math.cos(c)*g,P=Math.sin(c)*g,F=Math.sin(c-h)*-v,N=Math.cos(c-h)*v,h&&(p*=wm,L=Math.tan(h-p),L=Math.sqrt(1+L*L),F*=L,N*=L,p&&(L=Math.tan(p),L=Math.sqrt(1+L*L),I*=L,P*=L)),I=Tr(I),P=Tr(P),F=Tr(F),N=Tr(N)):(I=g,N=v,P=F=0),(D&&!~(a+"").indexOf("px")||R&&!~(l+"").indexOf("px"))&&(D=Hf(x,"x",a,"px"),R=Hf(x,"y",l,"px")),(b||w||S||M)&&(D=Tr(D+b-(b*I+w*F)+S),R=Tr(R+w-(b*P+w*N)+M)),(r||s)&&(L=x.getBBox(),D=Tr(D+r/100*L.width),R=Tr(R+s/100*L.height)),L="matrix("+I+","+P+","+F+","+N+","+D+","+R+")",x.setAttribute("transform",L),A&&(x.style[rr]=L)},v8=function(e,t,n,r,s){var a=360,l=os(s),c=parseFloat(s)*(l&&~s.indexOf("rad")?td:1),h=c-r,p=r+h+"deg",g,v;return l&&(g=s.split("_")[1],g==="short"&&(h%=a,h!==h%(a/2)&&(h+=h<0?a:-a)),g==="cw"&&h<0?h=(h+a*lD)%a-~~(h/a)*a:g==="ccw"&&h>0&&(h=(h-a*lD)%a-~~(h/a)*a)),e._pt=v=new Va(e._pt,t,n,r,h,$V),v.e=p,v.u="deg",e._props.push(n),v},mD=function(e,t){for(var n in t)e[n]=t[n];return e},y8=function(e,t,n){var r=mD({},n._gsap),s="perspective,force3D,transformOrigin,svgOrigin",a=n.style,l,c,h,p,g,v,x,b;r.svg?(h=n.getAttribute("transform"),n.setAttribute("transform",""),a[rr]=t,l=Ov(n,1),Gf(n,rr),n.setAttribute("transform",h)):(h=getComputedStyle(n)[rr],a[rr]=t,l=Ov(n,1),a[rr]=h);for(c in Ac)h=r[c],p=l[c],h!==p&&s.indexOf(c)<0&&(x=ks(h),b=ks(p),g=x!==b?Hf(n,c,h,b):parseFloat(h),v=parseFloat(p),e._pt=new Va(e._pt,l,c,g,v-g,OT),e._pt.u=b||0,e._props.push(c));mD(l,r)};Ba("padding,margin,Width,Radius",function(i,e){var t="Top",n="Right",r="Bottom",s="Left",a=(e<3?[t,n,r,s]:[t+s,t+n,r+n,r+s]).map(function(l){return e<2?i+l:"border"+l+i});k1[e>1?"border"+i:i]=function(l,c,h,p,g){var v,x;if(arguments.length<4)return v=a.map(function(b){return Sc(l,b,h)}),x=v.join(" "),x.split(v[0]).length===5?v[0]:x;v=(p+"").split(" "),x={},a.forEach(function(b,w){return x[b]=v[w]=v[w]||v[(w-1)/2|0]}),l.init(c,x,g)}});var CP={name:"css",register:kT,targetTest:function(e){return e.style&&e.nodeType},init:function(e,t,n,r,s){var a=this._props,l=e.style,c=n.vars.startAt,h,p,g,v,x,b,w,S,M,A,D,R,I,P,F,N,L;dA||kT(),this.styles=this.styles||bP(e),N=this.styles.props,this.tween=n;for(w in t)if(w!=="autoRound"&&(p=t[w],!(to[w]&&cP(w,t,n,r,e,s)))){if(x=typeof p,b=k1[w],x==="function"&&(p=p.call(n,r,e,s),x=typeof p),x==="string"&&~p.indexOf("random(")&&(p=Uv(p)),b)b(this,e,w,p,n)&&(F=1);else if(w.substr(0,2)==="--")h=(getComputedStyle(e).getPropertyValue(w)+"").trim(),p+="",kf.lastIndex=0,kf.test(h)||(S=ks(h),M=ks(p),M?S!==M&&(h=Hf(e,w,h,M)+M):S&&(p+=S)),this.add(l,"setProperty",h,p,r,s,0,0,w),a.push(w),N.push(w,0,l[w]);else if(x!=="undefined"){if(c&&w in c?(h=typeof c[w]=="function"?c[w].call(n,r,e,s):c[w],os(h)&&~h.indexOf("random(")&&(h=Uv(h)),ks(h+"")||h==="auto"||(h+=lo.units[w]||ks(Sc(e,w))||""),(h+"").charAt(1)==="="&&(h=Sc(e,w))):h=Sc(e,w),v=parseFloat(h),A=x==="string"&&p.charAt(1)==="="&&p.substr(0,2),A&&(p=p.substr(2)),g=parseFloat(p),w in Au&&(w==="autoAlpha"&&(v===1&&Sc(e,"visibility")==="hidden"&&g&&(v=0),N.push("visibility",0,l.visibility),Uf(this,l,"visibility",v?"inherit":"hidden",g?"inherit":"hidden",!g)),w!=="scale"&&w!=="transform"&&(w=Au[w],~w.indexOf(",")&&(w=w.split(",")[0]))),D=w in Ac,D){if(this.styles.save(w),L=p,x==="string"&&p.substring(0,6)==="var(--"){if(p=so(e,p.substring(4,p.indexOf(")"))),p.substring(0,5)==="calc("){var G=e.style.perspective;e.style.perspective=p,p=so(e,"perspective"),G?e.style.perspective=G:Gf(e,"perspective")}g=parseFloat(p)}if(R||(I=e._gsap,I.renderTransform&&!t.parseTransform||Ov(e,t.parseTransform),P=t.smoothOrigin!==!1&&I.smooth,R=this._pt=new Va(this._pt,l,rr,0,1,I.renderTransform,I,0,-1),R.dep=1),w==="scale")this._pt=new Va(this._pt,I,"scaleY",I.scaleY,(A?Sm(I.scaleY,A+g):g)-I.scaleY||0,OT),this._pt.u=0,a.push("scaleY",w),w+="X";else if(w==="transformOrigin"){N.push(Ga,0,l[Ga]),p=d8(p),I.svg?zT(e,p,0,P,0,this):(M=parseFloat(p.split(" ")[2])||0,M!==I.zOrigin&&Uf(this,I,"zOrigin",I.zOrigin,M),Uf(this,l,w,z1(h),z1(p)));continue}else if(w==="svgOrigin"){zT(e,p,1,P,0,this);continue}else if(w in TP){v8(this,I,w,v,A?Sm(v,A+p):p);continue}else if(w==="smoothOrigin"){Uf(this,I,"smooth",I.smooth,p);continue}else if(w==="force3D"){I[w]=p;continue}else if(w==="transform"){y8(this,p,e);continue}}else w in l||(w=Om(w)||w);if(D||(g||g===0)&&(v||v===0)&&!JV.test(p)&&w in l)S=(h+"").substr((v+"").length),g||(g=0),M=ks(p)||(w in lo.units?lo.units[w]:S),S!==M&&(v=Hf(e,w,h,M)),this._pt=new Va(this._pt,D?I:l,w,v,(A?Sm(v,A+g):g)-v,!D&&(M==="px"||w==="zIndex")&&t.autoRound!==!1?n8:OT),this._pt.u=M||0,D&&L!==p?(this._pt.b=h,this._pt.e=L,this._pt.r=t8):S!==M&&M!=="%"&&(this._pt.b=h,this._pt.r=e8);else if(w in l)h8.call(this,e,w,h,A?A+p:p);else if(w in e)this.add(e,w,h||e[w],A?A+p:p,r,s);else if(w!=="parseTransform"){iA(w,p);continue}D||(w in l?N.push(w,0,l[w]):typeof e[w]=="function"?N.push(w,2,e[w]()):N.push(w,1,h||e[w])),a.push(w)}}F&&gP(this)},render:function(e,t){if(t.tween._time||!pA())for(var n=t._pt;n;)n.r(e,n.d),n=n._next;else t.styles.revert()},get:Sc,aliases:Au,getSetter:function(e,t,n){var r=Au[t];return r&&r.indexOf(",")<0&&(t=r),t in Ac&&t!==Ga&&(e._gsap.x||Sc(e,"x"))?n&&oD===n?t==="scale"?a8:s8:(oD=n||{})&&(t==="scale"?o8:l8):e.style&&!eA(e.style[t])?i8:~t.indexOf("-")?r8:fA(e,t)},core:{_removeProperty:Gf,_getMatrix:gA}};Ha.utils.checkPrefix=Om;Ha.core.getStyleSaver=bP;(function(i,e,t,n){var r=Ba(i+","+e+","+t,function(s){Ac[s]=1});Ba(e,function(s){lo.units[s]="deg",TP[s]=1}),Au[r[13]]=i+","+e,Ba(n,function(s){var a=s.split(":");Au[a[1]]=r[a[0]]})})("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY");Ba("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(i){lo.units[i]="px"});Ha.registerPlugin(CP);var B1=Ha.registerPlugin(CP)||Ha;B1.core.Tween;function x8(){const[i,e]=ae.useState("default"),t=Rv(0,{stiffness:1e3,damping:50}),n=Rv(0,{stiffness:1e3,damping:50});return ae.useEffect(()=>{const r=s=>{var g;const{clientX:a,clientY:l}=s;t.set(a),n.set(l);const c=s.target,h=((g=c.closest("[data-cursor]"))==null?void 0:g.getAttribute("data-cursor"))||"default";e(h);const p=c.closest("[data-magnetic]");if(p){const v=p.getBoundingClientRect(),x=v.left+v.width/2,b=v.top+v.height/2,w=a-x,S=l-b;B1.to(p,{x:w*.35,y:S*.35,duration:.4,ease:"power2.out"})}else document.querySelectorAll("[data-magnetic]").forEach(v=>{B1.to(v,{x:0,y:0,duration:.6,ease:"elastic.out(1, 0.3)"})})};return window.addEventListener("mousemove",r),()=>window.removeEventListener("mousemove",r)},[t,n]),H.jsx("div",{className:"fixed inset-0 pointer-events-none z-[10000]",children:H.jsx(mr.div,{className:"fixed top-0 left-0 rounded-full transition-colors duration-300",animate:{width:i==="none"?0:i==="default"?11:22,height:i==="none"?0:i==="default"?11:22,backgroundColor:i==="default"?"var(--color-violet)":"var(--color-cyan)",opacity:i==="none"?0:i==="default"?.8:.4},transition:{type:"spring",stiffness:500,damping:30},style:{x:t,y:n,translateX:"-50%",translateY:"-50%"}})})}function _8(){const i=ae.useRef(null);return ae.useEffect(()=>{const e=t=>{if(i.current){const{clientX:n,clientY:r}=t;i.current.style.setProperty("--x",`${n}px`),i.current.style.setProperty("--y",`${r}px`)}};return window.addEventListener("mousemove",e),()=>window.removeEventListener("mousemove",e)},[]),H.jsx("div",{ref:i,className:"fixed inset-0 pointer-events-none z-[1] opacity-60 dark:opacity-20 transition-opacity duration-1000",style:{background:`radial-gradient(800px circle at var(--x, 50%) var(--y, 50%), rgba(255, 97, 32, 0.08), transparent 80%), radial-gradient(1200px circle at var(--x, 50%) var(--y, 50%), rgba(255, 183, 77, 0.05), transparent 80%)`}})}/** * @license * Copyright 2010-2026 Three.js Authors * SPDX-License-Identifier: MIT */const Zm="183",b8={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},S8={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},RP=0,BT=1,DP=2,M8=3,NP=0,Tm=1,uv=2,od=3,Cc=0,ca=1,io=2,Nl=0,bd=1,V1=2,VT=3,GT=4,UP=5,w8=6,Cf=100,LP=101,IP=102,PP=103,OP=104,FP=200,kP=201,zP=202,BP=203,G1=204,H1=205,VP=206,GP=207,HP=208,WP=209,jP=210,XP=211,YP=212,qP=213,ZP=214,W1=0,j1=1,X1=2,Ed=3,Y1=4,q1=5,Z1=6,K1=7,ly=0,KP=1,QP=2,Jo=0,vA=1,yA=2,xA=3,Kb=4,_A=5,bA=6,SA=7,HT="attached",JP="detached",Wf=300,Il=301,jf=302,Em=303,cv=304,Km=306,Fv=1e3,vr=1001,kv=1002,Er=1003,MA=1004,T8=1004,xm=1005,E8=1005,In=1006,fv=1007,A8=1007,Cu=1008,WT=1008,is=1009,Qb=1010,Jb=1011,Fm=1012,uy=1013,po=1014,Gi=1015,ar=1016,$b=1017,eS=1018,km=1020,wA=35902,TA=35899,EA=1021,AA=1022,Ar=1023,Lu=1026,Lf=1027,cy=1028,fy=1029,Ad=1030,tS=1031,C8=1032,nS=1033,hv=33776,dv=33777,pv=33778,mv=33779,Q1=35840,J1=35841,$1=35842,eb=35843,tb=36196,nb=37492,ib=37496,rb=37488,sb=37489,ab=37490,ob=37491,lb=37808,ub=37809,cb=37810,fb=37811,hb=37812,db=37813,pb=37814,mb=37815,gb=37816,vb=37817,yb=37818,xb=37819,_b=37820,bb=37821,Sb=36492,Mb=36494,wb=36495,Tb=36283,Eb=36284,Ab=36285,Cb=36286,$P=2200,eO=2201,tO=2202,zv=2300,Rb=2301,v1=2302,jT=2303,ld=2400,ud=2401,Bv=2402,iS=2500,CA=2501,R8=0,D8=1,N8=2,nO=3200,iO=3201,U8=3202,L8=3203,Kf=0,rO=1,Mc="",bs="srgb",Pl="srgb-linear",Vv="linear",ci="srgb",I8="",P8="rg",O8="ga",F8=0,nd=7680,k8=7681,z8=7682,B8=7683,V8=34055,G8=34056,H8=5386,W8=512,j8=513,X8=514,Y8=515,q8=516,Z8=517,K8=518,XT=519,sO=512,aO=513,oO=514,rS=515,lO=516,uO=517,sS=518,cO=519,Gv=35044,Sd=35048,Q8=35040,J8=35045,$8=35049,eG=35041,tG=35046,nG=35050,iG=35042,rG="100",YT="300 es",ao=2e3,Cd=2001,sG={COMPUTE:"compute",RENDER:"render"},aG={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},oG={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},lG={TEXTURE_COMPARE:"depthTextureCompare"};function uG(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}const cG={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function _m(i,e){return new cG[i](e)}function fO(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function Hv(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function hO(){const i=Hv("canvas");return i.style.display="block",i}const gD={};let Xf=null;function fG(i){Xf=i}function hG(){return Xf}function Wv(...i){const e="THREE."+i.shift();Xf?Xf("log",e,...i):console.log(e,...i)}function dO(i){const e=i[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=i[1];t&&t.isStackTrace?i[0]+=" "+t.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}function Ft(...i){i=dO(i);const e="THREE."+i.shift();if(Xf)Xf("warn",e,...i);else{const t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function en(...i){i=dO(i);const e="THREE."+i.shift();if(Xf)Xf("error",e,...i);else{const t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function jv(...i){const e=i.join(" ");e in gD||(gD[e]=!0,Ft(...i))}function dG(i,e,t){return new Promise(function(n,r){function s(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}const pG={[W1]:j1,[X1]:Z1,[Y1]:K1,[Ed]:q1,[j1]:W1,[Z1]:X1,[K1]:Y1,[q1]:Ed};class Iu{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const r=n[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let s=0,a=r.length;s>8&255]+Ps[i>>16&255]+Ps[i>>24&255]+"-"+Ps[e&255]+Ps[e>>8&255]+"-"+Ps[e>>16&15|64]+Ps[e>>24&255]+"-"+Ps[t&63|128]+Ps[t>>8&255]+"-"+Ps[t>>16&255]+Ps[t>>24&255]+Ps[n&255]+Ps[n>>8&255]+Ps[n>>16&255]+Ps[n>>24&255]).toLowerCase()}function fn(i,e,t){return Math.max(e,Math.min(t,i))}function RA(i,e){return(i%e+e)%e}function mG(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function gG(i,e,t){return i!==e?(t-i)/(e-i):0}function gv(i,e,t){return(1-t)*i+t*e}function vG(i,e,t,n){return gv(i,e,1-Math.exp(-t*n))}function yG(i,e=1){return e-Math.abs(RA(i,e*2)-e)}function xG(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function _G(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function bG(i,e){return i+Math.floor(Math.random()*(e-i+1))}function SG(i,e){return i+Math.random()*(e-i)}function MG(i){return i*(.5-Math.random())}function wG(i){i!==void 0&&(vD=i);let e=vD+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function TG(i){return i*Md}function EG(i){return i*zm}function AG(i){return(i&i-1)===0&&i!==0}function CG(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function RG(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function DG(i,e,t,n,r){const s=Math.cos,a=Math.sin,l=s(t/2),c=a(t/2),h=s((e+n)/2),p=a((e+n)/2),g=s((e-n)/2),v=a((e-n)/2),x=s((n-e)/2),b=a((n-e)/2);switch(r){case"XYX":i.set(l*p,c*g,c*v,l*h);break;case"YZY":i.set(c*v,l*p,c*g,l*h);break;case"ZXZ":i.set(c*g,c*v,l*p,l*h);break;case"XZX":i.set(l*p,c*b,c*x,l*h);break;case"YXY":i.set(c*x,l*p,c*b,l*h);break;case"ZYZ":i.set(c*b,c*x,l*p,l*h);break;default:Ft("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function oa(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("Invalid component type.")}}function Tn(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("Invalid component type.")}}const Bm={DEG2RAD:Md,RAD2DEG:zm,generateUUID:uo,clamp:fn,euclideanModulo:RA,mapLinear:mG,inverseLerp:gG,lerp:gv,damp:vG,pingpong:yG,smoothstep:xG,smootherstep:_G,randInt:bG,randFloat:SG,randFloatSpread:MG,seededRandom:wG,degToRad:TG,radToDeg:EG,isPowerOfTwo:AG,ceilPowerOfTwo:CG,floorPowerOfTwo:RG,setQuaternionFromProperEuler:DG,normalize:Tn,denormalize:oa};class pt{constructor(e=0,t=0){pt.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=fn(this.x,e.x,t.x),this.y=fn(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=fn(this.x,e,t),this.y=fn(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(fn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(fn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*r+e.x,this.y=s*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class fa{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,a,l){let c=n[r+0],h=n[r+1],p=n[r+2],g=n[r+3],v=s[a+0],x=s[a+1],b=s[a+2],w=s[a+3];if(g!==w||c!==v||h!==x||p!==b){let S=c*v+h*x+p*b+g*w;S<0&&(v=-v,x=-x,b=-b,w=-w,S=-S);let M=1-l;if(S<.9995){const A=Math.acos(S),D=Math.sin(A);M=Math.sin(M*A)/D,l=Math.sin(l*A)/D,c=c*M+v*l,h=h*M+x*l,p=p*M+b*l,g=g*M+w*l}else{c=c*M+v*l,h=h*M+x*l,p=p*M+b*l,g=g*M+w*l;const A=1/Math.sqrt(c*c+h*h+p*p+g*g);c*=A,h*=A,p*=A,g*=A}}e[t]=c,e[t+1]=h,e[t+2]=p,e[t+3]=g}static multiplyQuaternionsFlat(e,t,n,r,s,a){const l=n[r],c=n[r+1],h=n[r+2],p=n[r+3],g=s[a],v=s[a+1],x=s[a+2],b=s[a+3];return e[t]=l*b+p*g+c*x-h*v,e[t+1]=c*b+p*v+h*g-l*x,e[t+2]=h*b+p*x+l*v-c*g,e[t+3]=p*b-l*g-c*v-h*x,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,r=e._y,s=e._z,a=e._order,l=Math.cos,c=Math.sin,h=l(n/2),p=l(r/2),g=l(s/2),v=c(n/2),x=c(r/2),b=c(s/2);switch(a){case"XYZ":this._x=v*p*g+h*x*b,this._y=h*x*g-v*p*b,this._z=h*p*b+v*x*g,this._w=h*p*g-v*x*b;break;case"YXZ":this._x=v*p*g+h*x*b,this._y=h*x*g-v*p*b,this._z=h*p*b-v*x*g,this._w=h*p*g+v*x*b;break;case"ZXY":this._x=v*p*g-h*x*b,this._y=h*x*g+v*p*b,this._z=h*p*b+v*x*g,this._w=h*p*g-v*x*b;break;case"ZYX":this._x=v*p*g-h*x*b,this._y=h*x*g+v*p*b,this._z=h*p*b-v*x*g,this._w=h*p*g+v*x*b;break;case"YZX":this._x=v*p*g+h*x*b,this._y=h*x*g+v*p*b,this._z=h*p*b-v*x*g,this._w=h*p*g-v*x*b;break;case"XZY":this._x=v*p*g-h*x*b,this._y=h*x*g-v*p*b,this._z=h*p*b+v*x*g,this._w=h*p*g+v*x*b;break;default:Ft("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],s=t[8],a=t[1],l=t[5],c=t[9],h=t[2],p=t[6],g=t[10],v=n+l+g;if(v>0){const x=.5/Math.sqrt(v+1);this._w=.25/x,this._x=(p-c)*x,this._y=(s-h)*x,this._z=(a-r)*x}else if(n>l&&n>g){const x=2*Math.sqrt(1+n-l-g);this._w=(p-c)/x,this._x=.25*x,this._y=(r+a)/x,this._z=(s+h)/x}else if(l>g){const x=2*Math.sqrt(1+l-n-g);this._w=(s-h)/x,this._x=(r+a)/x,this._y=.25*x,this._z=(c+p)/x}else{const x=2*Math.sqrt(1+g-n-l);this._w=(a-r)/x,this._x=(s+h)/x,this._y=(c+p)/x,this._z=.25*x}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(fn(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,s=e._z,a=e._w,l=t._x,c=t._y,h=t._z,p=t._w;return this._x=n*p+a*l+r*h-s*c,this._y=r*p+a*c+s*l-n*h,this._z=s*p+a*h+n*c-r*l,this._w=a*p-n*l-r*c-s*h,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,s=e._z,a=e._w,l=this.dot(e);l<0&&(n=-n,r=-r,s=-s,a=-a,l=-l);let c=1-t;if(l<.9995){const h=Math.acos(l),p=Math.sin(h);c=Math.sin(c*h)/p,t=Math.sin(t*h)/p,this._x=this._x*c+n*t,this._y=this._y*c+r*t,this._z=this._z*c+s*t,this._w=this._w*c+a*t,this._onChangeCallback()}else this._x=this._x*c+n*t,this._y=this._y*c+r*t,this._z=this._z*c+s*t,this._w=this._w*c+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class re{constructor(e=0,t=0,n=0){re.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(yD.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(yD.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,s=e.x,a=e.y,l=e.z,c=e.w,h=2*(a*r-l*n),p=2*(l*t-s*r),g=2*(s*n-a*t);return this.x=t+c*h+a*g-l*p,this.y=n+c*p+l*h-s*g,this.z=r+c*g+s*p-a*h,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=fn(this.x,e.x,t.x),this.y=fn(this.y,e.y,t.y),this.z=fn(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=fn(this.x,e,t),this.y=fn(this.y,e,t),this.z=fn(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(fn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,s=e.z,a=t.x,l=t.y,c=t.z;return this.x=r*c-s*l,this.y=s*a-n*c,this.z=n*l-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return YM.copy(this).projectOnVector(e),this.sub(YM)}reflect(e){return this.sub(YM.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(fn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const YM=new re,yD=new fa;class yn{constructor(e,t,n,r,s,a,l,c,h){yn.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,a,l,c,h)}set(e,t,n,r,s,a,l,c,h){const p=this.elements;return p[0]=e,p[1]=r,p[2]=l,p[3]=t,p[4]=s,p[5]=c,p[6]=n,p[7]=a,p[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,s=this.elements,a=n[0],l=n[3],c=n[6],h=n[1],p=n[4],g=n[7],v=n[2],x=n[5],b=n[8],w=r[0],S=r[3],M=r[6],A=r[1],D=r[4],R=r[7],I=r[2],P=r[5],F=r[8];return s[0]=a*w+l*A+c*I,s[3]=a*S+l*D+c*P,s[6]=a*M+l*R+c*F,s[1]=h*w+p*A+g*I,s[4]=h*S+p*D+g*P,s[7]=h*M+p*R+g*F,s[2]=v*w+x*A+b*I,s[5]=v*S+x*D+b*P,s[8]=v*M+x*R+b*F,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],l=e[5],c=e[6],h=e[7],p=e[8];return t*a*p-t*l*h-n*s*p+n*l*c+r*s*h-r*a*c}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],a=e[4],l=e[5],c=e[6],h=e[7],p=e[8],g=p*a-l*h,v=l*c-p*s,x=h*s-a*c,b=t*g+n*v+r*x;if(b===0)return this.set(0,0,0,0,0,0,0,0,0);const w=1/b;return e[0]=g*w,e[1]=(r*h-p*n)*w,e[2]=(l*n-r*a)*w,e[3]=v*w,e[4]=(p*t-r*c)*w,e[5]=(r*s-l*t)*w,e[6]=x*w,e[7]=(n*c-h*t)*w,e[8]=(a*t-n*s)*w,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,a,l){const c=Math.cos(s),h=Math.sin(s);return this.set(n*c,n*h,-n*(c*a+h*l)+a+e,-r*h,r*c,-r*(-h*a+c*l)+l+t,0,0,1),this}scale(e,t){return this.premultiply(qM.makeScale(e,t)),this}rotate(e){return this.premultiply(qM.makeRotation(-e)),this}translate(e,t){return this.premultiply(qM.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const qM=new yn,xD=new yn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),_D=new yn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function NG(){const i={enabled:!0,workingColorSpace:Pl,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===ci&&(r.r=Tc(r.r),r.g=Tc(r.g),r.b=Tc(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===ci&&(r.r=Am(r.r),r.g=Am(r.g),r.b=Am(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===Mc?Vv:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return jv("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return jv("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[Pl]:{primaries:e,whitePoint:n,transfer:Vv,toXYZ:xD,fromXYZ:_D,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:bs},outputColorSpaceConfig:{drawingBufferColorSpace:bs}},[bs]:{primaries:e,whitePoint:n,transfer:ci,toXYZ:xD,fromXYZ:_D,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:bs}}}),i}const Hn=NG();function Tc(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function Am(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let Vp;class pO{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Vp===void 0&&(Vp=Hv("canvas")),Vp.width=e.width,Vp.height=e.height;const r=Vp.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=Vp}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Hv("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a1),this.pmremVersion=0}get width(){return this.source.getSize(KM).x}get height(){return this.source.getSize(KM).y}get depth(){return this.source.getSize(KM).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){Ft(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){Ft(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Wf)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Fv:e.x=e.x-Math.floor(e.x);break;case vr:e.x=e.x<0?0:1;break;case kv:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Fv:e.y=e.y-Math.floor(e.y);break;case vr:e.y=e.y<0?0:1;break;case kv:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}di.DEFAULT_IMAGE=null;di.DEFAULT_MAPPING=Wf;di.DEFAULT_ANISOTROPY=1;class fi{constructor(e=0,t=0,n=0,r=1){fi.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s;const c=e.elements,h=c[0],p=c[4],g=c[8],v=c[1],x=c[5],b=c[9],w=c[2],S=c[6],M=c[10];if(Math.abs(p-v)<.01&&Math.abs(g-w)<.01&&Math.abs(b-S)<.01){if(Math.abs(p+v)<.1&&Math.abs(g+w)<.1&&Math.abs(b+S)<.1&&Math.abs(h+x+M-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const D=(h+1)/2,R=(x+1)/2,I=(M+1)/2,P=(p+v)/4,F=(g+w)/4,N=(b+S)/4;return D>R&&D>I?D<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(D),r=P/n,s=F/n):R>I?R<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(R),n=P/r,s=N/r):I<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(I),n=F/s,r=N/s),this.set(n,r,s,t),this}let A=Math.sqrt((S-b)*(S-b)+(g-w)*(g-w)+(v-p)*(v-p));return Math.abs(A)<.001&&(A=1),this.x=(S-b)/A,this.y=(g-w)/A,this.z=(v-p)/A,this.w=Math.acos((h+x+M-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=fn(this.x,e.x,t.x),this.y=fn(this.y,e.y,t.y),this.z=fn(this.z,e.z,t.z),this.w=fn(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=fn(this.x,e,t),this.y=fn(this.y,e,t),this.z=fn(this.z,e,t),this.w=fn(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(fn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class DA extends Iu{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:In,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new fi(0,0,e,t),this.scissorTest=!1,this.viewport=new fi(0,0,e,t),this.textures=[];const r={width:e,height:t,depth:n.depth},s=new di(r),a=n.count;for(let l=0;l1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(l=>({...l,boundingBox:l.boundingBox?l.boundingBox.toJSON():void 0,boundingSphere:l.boundingSphere?l.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(l=>({...l})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(l,c){return l[c.uuid]===void 0&&(l[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const l=this.geometry.parameters;if(l!==void 0&&l.shapes!==void 0){const c=l.shapes;if(Array.isArray(c))for(let h=0,p=c.length;h0){r.children=[];for(let l=0;l0){r.animations=[];for(let l=0;l0&&(n.geometries=l),c.length>0&&(n.materials=c),h.length>0&&(n.textures=h),p.length>0&&(n.images=p),g.length>0&&(n.shapes=g),v.length>0&&(n.skeletons=v),x.length>0&&(n.animations=x),b.length>0&&(n.nodes=b)}return n.object=r,n;function a(l){const c=[];for(const h in l){const p=l[h];delete p.metadata,c.push(p)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),e.pivot!==null&&(this.pivot=e.pivot.clone()),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;nx+b?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!h.inputState.pinching&&v<=x-b&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));l!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1,this.dispatchEvent(GG)))}return l!==null&&(l.visible=r!==null),c!==null&&(c.visible=s!==null),h!==null&&(h.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new bm;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const mO={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},vf={h:0,s:0,l:0},c_={h:0,s:0,l:0};function JM(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}class zt{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=bs){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Hn.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=Hn.workingColorSpace){return this.r=e,this.g=t,this.b=n,Hn.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=Hn.workingColorSpace){if(e=RA(e,1),t=fn(t,0,1),n=fn(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=JM(a,s,e+1/3),this.g=JM(a,s,e),this.b=JM(a,s,e-1/3)}return Hn.colorSpaceToWorking(this,r),this}setStyle(e,t=bs){function n(s){s!==void 0&&parseFloat(s)<1&&Ft("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],l=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(l))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:Ft("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);Ft("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=bs){const n=mO[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Ft("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Tc(e.r),this.g=Tc(e.g),this.b=Tc(e.b),this}copyLinearToSRGB(e){return this.r=Am(e.r),this.g=Am(e.g),this.b=Am(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=bs){return Hn.workingToColorSpace(Os.copy(this),e),Math.round(fn(Os.r*255,0,255))*65536+Math.round(fn(Os.g*255,0,255))*256+Math.round(fn(Os.b*255,0,255))}getHexString(e=bs){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Hn.workingColorSpace){Hn.workingToColorSpace(Os.copy(this),t);const n=Os.r,r=Os.g,s=Os.b,a=Math.max(n,r,s),l=Math.min(n,r,s);let c,h;const p=(l+a)/2;if(l===a)c=0,h=0;else{const g=a-l;switch(h=p<=.5?g/(a+l):g/(2-a-l),a){case n:c=(r-s)/g+(r0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}};const Ml=new re,gc=new re,$M=new re,vc=new re,jp=new re,Xp=new re,CD=new re,ew=new re,tw=new re,nw=new re,iw=new fi,rw=new fi,sw=new fi;class Fa{constructor(e=new re,t=new re,n=new re){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Ml.subVectors(e,t),r.cross(Ml);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){Ml.subVectors(r,t),gc.subVectors(n,t),$M.subVectors(e,t);const a=Ml.dot(Ml),l=Ml.dot(gc),c=Ml.dot($M),h=gc.dot(gc),p=gc.dot($M),g=a*h-l*l;if(g===0)return s.set(0,0,0),null;const v=1/g,x=(h*c-l*p)*v,b=(a*p-l*c)*v;return s.set(1-x-b,b,x)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,vc)===null?!1:vc.x>=0&&vc.y>=0&&vc.x+vc.y<=1}static getInterpolation(e,t,n,r,s,a,l,c){return this.getBarycoord(e,t,n,r,vc)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(s,vc.x),c.addScaledVector(a,vc.y),c.addScaledVector(l,vc.z),c)}static getInterpolatedAttribute(e,t,n,r,s,a){return iw.setScalar(0),rw.setScalar(0),sw.setScalar(0),iw.fromBufferAttribute(e,t),rw.fromBufferAttribute(e,n),sw.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(iw,s.x),a.addScaledVector(rw,s.y),a.addScaledVector(sw,s.z),a}static isFrontFacing(e,t,n,r){return Ml.subVectors(n,t),gc.subVectors(e,t),Ml.cross(gc).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Ml.subVectors(this.c,this.b),gc.subVectors(this.a,this.b),Ml.cross(gc).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Fa.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Fa.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return Fa.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return Fa.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Fa.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,s=this.c;let a,l;jp.subVectors(r,n),Xp.subVectors(s,n),ew.subVectors(e,n);const c=jp.dot(ew),h=Xp.dot(ew);if(c<=0&&h<=0)return t.copy(n);tw.subVectors(e,r);const p=jp.dot(tw),g=Xp.dot(tw);if(p>=0&&g<=p)return t.copy(r);const v=c*g-p*h;if(v<=0&&c>=0&&p<=0)return a=c/(c-p),t.copy(n).addScaledVector(jp,a);nw.subVectors(e,s);const x=jp.dot(nw),b=Xp.dot(nw);if(b>=0&&x<=b)return t.copy(s);const w=x*h-c*b;if(w<=0&&h>=0&&b<=0)return l=h/(h-b),t.copy(n).addScaledVector(Xp,l);const S=p*b-x*g;if(S<=0&&g-p>=0&&x-b>=0)return CD.subVectors(s,r),l=(g-p)/(g-p+(x-b)),t.copy(r).addScaledVector(CD,l);const M=1/(S+w+v);return a=w*M,l=v*M,t.copy(n).addScaledVector(jp,a).addScaledVector(Xp,l)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class ss{constructor(e=new re(1/0,1/0,1/0),t=new re(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,wl),wl.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(R0),h_.subVectors(this.max,R0),Yp.subVectors(e.a,R0),qp.subVectors(e.b,R0),Zp.subVectors(e.c,R0),yf.subVectors(qp,Yp),xf.subVectors(Zp,qp),kh.subVectors(Yp,Zp);let t=[0,-yf.z,yf.y,0,-xf.z,xf.y,0,-kh.z,kh.y,yf.z,0,-yf.x,xf.z,0,-xf.x,kh.z,0,-kh.x,-yf.y,yf.x,0,-xf.y,xf.x,0,-kh.y,kh.x,0];return!aw(t,Yp,qp,Zp,h_)||(t=[1,0,0,0,1,0,0,0,1],!aw(t,Yp,qp,Zp,h_))?!1:(d_.crossVectors(yf,xf),t=[d_.x,d_.y,d_.z],aw(t,Yp,qp,Zp,h_))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,wl).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(wl).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(yc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),yc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),yc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),yc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),yc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),yc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),yc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),yc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(yc),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const yc=[new re,new re,new re,new re,new re,new re,new re,new re],wl=new re,f_=new ss,Yp=new re,qp=new re,Zp=new re,yf=new re,xf=new re,kh=new re,R0=new re,h_=new re,d_=new re,zh=new re;function aw(i,e,t,n,r){for(let s=0,a=i.length-3;s<=a;s+=3){zh.fromArray(i,s);const l=r.x*Math.abs(zh.x)+r.y*Math.abs(zh.y)+r.z*Math.abs(zh.z),c=e.dot(zh),h=t.dot(zh),p=n.dot(zh);if(Math.max(-Math.max(c,h,p),Math.min(c,h,p))>l)return!1}return!0}const wc=HG();function HG(){const i=new ArrayBuffer(4),e=new Float32Array(i),t=new Uint32Array(i),n=new Uint32Array(512),r=new Uint32Array(512);for(let c=0;c<256;++c){const h=c-127;h<-27?(n[c]=0,n[c|256]=32768,r[c]=24,r[c|256]=24):h<-14?(n[c]=1024>>-h-14,n[c|256]=1024>>-h-14|32768,r[c]=-h-1,r[c|256]=-h-1):h<=15?(n[c]=h+15<<10,n[c|256]=h+15<<10|32768,r[c]=13,r[c|256]=13):h<128?(n[c]=31744,n[c|256]=64512,r[c]=24,r[c|256]=24):(n[c]=31744,n[c|256]=64512,r[c]=13,r[c|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),l=new Uint32Array(64);for(let c=1;c<1024;++c){let h=c<<13,p=0;for(;(h&8388608)===0;)h<<=1,p-=8388608;h&=-8388609,p+=947912704,s[c]=h|p}for(let c=1024;c<2048;++c)s[c]=939524096+(c-1024<<13);for(let c=1;c<31;++c)a[c]=c<<23;a[31]=1199570944,a[32]=2147483648;for(let c=33;c<63;++c)a[c]=2147483648+(c-32<<23);a[63]=3347054592;for(let c=1;c<64;++c)c!==32&&(l[c]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:l}}function Oa(i){Math.abs(i)>65504&&Ft("DataUtils.toHalfFloat(): Value out of range."),i=fn(i,-65504,65504),wc.floatView[0]=i;const e=wc.uint32View[0],t=e>>23&511;return wc.baseTable[t]+((e&8388607)>>wc.shiftTable[t])}function K0(i){const e=i>>10;return wc.uint32View[0]=wc.mantissaTable[wc.offsetTable[e]+(i&1023)]+wc.exponentTable[e],wc.floatView[0]}class cd{static toHalfFloat(e){return Oa(e)}static fromHalfFloat(e){return K0(e)}}const Ir=new re,p_=new pt;let WG=0;class _i{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:WG++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Gv,this.updateRanges=[],this.gpuType=Gi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;rthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;D0.subVectors(e,this.center);const t=D0.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(D0,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(ow.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(D0.copy(e.center).add(ow)),this.expandByPoint(D0.copy(e.center).sub(ow))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let JG=0;const Xo=new un,lw=new ei,Kp=new re,eo=new ss,N0=new ss,es=new re;class xn extends Iu{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:JG++}),this.uuid=uo(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(uG(e)?UA:NA)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new yn().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Xo.makeRotationFromQuaternion(e),this.applyMatrix4(Xo),this}rotateX(e){return Xo.makeRotationX(e),this.applyMatrix4(Xo),this}rotateY(e){return Xo.makeRotationY(e),this.applyMatrix4(Xo),this}rotateZ(e){return Xo.makeRotationZ(e),this.applyMatrix4(Xo),this}translate(e,t,n){return Xo.makeTranslation(e,t,n),this.applyMatrix4(Xo),this}scale(e,t,n){return Xo.makeScale(e,t,n),this.applyMatrix4(Xo),this}lookAt(e){return lw.lookAt(e),lw.updateMatrix(),this.applyMatrix4(lw.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Kp).negate(),this.translate(Kp.x,Kp.y,Kp.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let r=0,s=e.length;rt.count&&Ft("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ss);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){en("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new re(-1/0,-1/0,-1/0),new re(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n0&&(e.userData=this.userData),this.parameters!==void 0){const c=this.parameters;for(const h in c)c[h]!==void 0&&(e[h]=c[h]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const c in n){const h=n[c];e.data.attributes[c]=h.toJSON(e.data)}const r={};let s=!1;for(const c in this.morphAttributes){const h=this.morphAttributes[c],p=[];for(let g=0,v=h.length;g0&&(r[c]=p,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const l=this.boundingSphere;return l!==null&&(e.data.boundingSphere=l.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const r=e.attributes;for(const h in r){const p=r[h];this.setAttribute(h,p.clone(t))}const s=e.morphAttributes;for(const h in s){const p=[],g=s[h];for(let v=0,x=g.length;v0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){Ft(`Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){Ft(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==bd&&(n.blending=this.blending),this.side!==Cc&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==G1&&(n.blendSrc=this.blendSrc),this.blendDst!==H1&&(n.blendDst=this.blendDst),this.blendEquation!==Cf&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Ed&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==XT&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==nd&&(n.stencilFail=this.stencilFail),this.stencilZFail!==nd&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==nd&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){const a=[];for(const l in s){const c=s[l];delete c.metadata,a.push(c)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class LA extends Vs{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new zt(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let Qp;const U0=new re,Jp=new re,$p=new re,em=new pt,L0=new pt,gO=new un,m_=new re,I0=new re,g_=new re,RD=new pt,uw=new pt,DD=new pt;class vO extends ei{constructor(e=new LA){if(super(),this.isSprite=!0,this.type="Sprite",Qp===void 0){Qp=new xn;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new cS(t,5);Qp.setIndex([0,1,2,0,2,3]),Qp.setAttribute("position",new Rd(n,3,0,!1)),Qp.setAttribute("uv",new Rd(n,2,3,!1))}this.geometry=Qp,this.material=e,this.center=new pt(.5,.5),this.count=1}raycast(e,t){e.camera===null&&en('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Jp.setFromMatrixScale(this.matrixWorld),gO.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),$p.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Jp.multiplyScalar(-$p.z);const n=this.material.rotation;let r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));const a=this.center;v_(m_.set(-.5,-.5,0),$p,a,Jp,r,s),v_(I0.set(.5,-.5,0),$p,a,Jp,r,s),v_(g_.set(.5,.5,0),$p,a,Jp,r,s),RD.set(0,0),uw.set(1,0),DD.set(1,1);let l=e.ray.intersectTriangle(m_,I0,g_,!1,U0);if(l===null&&(v_(I0.set(-.5,.5,0),$p,a,Jp,r,s),uw.set(0,1),l=e.ray.intersectTriangle(m_,g_,I0,!1,U0),l===null))return;const c=e.ray.origin.distanceTo(U0);ce.far||t.push({distance:c,point:U0.clone(),uv:Fa.getInterpolation(U0,m_,I0,g_,RD,uw,DD,new pt),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function v_(i,e,t,n,r,s){em.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(L0.x=s*em.x-r*em.y,L0.y=r*em.x+s*em.y):L0.copy(em),i.copy(e),i.x+=L0.x,i.y+=L0.y,i.applyMatrix4(gO)}const y_=new re,ND=new re;class yO extends ei{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,r=t.length;n0){let n,r;for(n=1,r=t.length;n0){y_.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(y_);this.getObjectForDistance(r).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){y_.setFromMatrixPosition(e.matrixWorld),ND.setFromMatrixPosition(this.matrixWorld);const n=y_.distanceTo(ND)/e.zoom;t[0].object.visible=!0;let r,s;for(r=1,s=t.length;r=a)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;r0)if(g=a*c-l,v=a*l-c,b=s*p,g>=0)if(v>=-b)if(v<=b){const w=1/p;g*=w,v*=w,x=g*(g+a*v+2*l)+v*(a*g+v+2*c)+h}else v=s,g=Math.max(0,-(a*v+l)),x=-g*g+v*(v+2*c)+h;else v=-s,g=Math.max(0,-(a*v+l)),x=-g*g+v*(v+2*c)+h;else v<=-b?(g=Math.max(0,-(-a*s+l)),v=g>0?-s:Math.min(Math.max(-s,-c),s),x=-g*g+v*(v+2*c)+h):v<=b?(g=0,v=Math.min(Math.max(-s,-c),s),x=v*(v+2*c)+h):(g=Math.max(0,-(a*s+l)),v=g>0?s:Math.min(Math.max(-s,-c),s),x=-g*g+v*(v+2*c)+h);else v=a>0?-s:s,g=Math.max(0,-(a*v+l)),x=-g*g+v*(v+2*c)+h;return n&&n.copy(this.origin).addScaledVector(this.direction,g),r&&r.copy(cw).addScaledVector(x_,v),x}intersectSphere(e,t){xc.subVectors(e.center,this.origin);const n=xc.dot(this.direction),r=xc.dot(xc)-n*n,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),l=n-a,c=n+a;return c<0?null:l<0?this.at(c,t):this.at(l,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,a,l,c;const h=1/this.direction.x,p=1/this.direction.y,g=1/this.direction.z,v=this.origin;return h>=0?(n=(e.min.x-v.x)*h,r=(e.max.x-v.x)*h):(n=(e.max.x-v.x)*h,r=(e.min.x-v.x)*h),p>=0?(s=(e.min.y-v.y)*p,a=(e.max.y-v.y)*p):(s=(e.max.y-v.y)*p,a=(e.min.y-v.y)*p),n>a||s>r||((s>n||isNaN(n))&&(n=s),(a=0?(l=(e.min.z-v.z)*g,c=(e.max.z-v.z)*g):(l=(e.max.z-v.z)*g,c=(e.min.z-v.z)*g),n>c||l>r)||((l>n||n!==n)&&(n=l),(c=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,xc)!==null}intersectTriangle(e,t,n,r,s){fw.subVectors(t,e),__.subVectors(n,e),hw.crossVectors(fw,__);let a=this.direction.dot(hw),l;if(a>0){if(r)return null;l=1}else if(a<0)l=-1,a=-a;else return null;_f.subVectors(this.origin,e);const c=l*this.direction.dot(__.crossVectors(_f,__));if(c<0)return null;const h=l*this.direction.dot(fw.cross(_f));if(h<0||c+h>a)return null;const p=-l*_f.dot(hw);return p<0?null:this.at(p/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Ol extends Vs{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new zt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new mo,this.combine=ly,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const UD=new un,Bh=new Qm,b_=new as,LD=new re,S_=new re,M_=new re,w_=new re,dw=new re,T_=new re,ID=new re,E_=new re;class wi extends ei{constructor(e=new xn,t=new Ol){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s(e.far-e.near)**2))&&(UD.copy(s).invert(),Bh.copy(e.ray).applyMatrix4(UD),!(n.boundingBox!==null&&Bh.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Bh)))}_computeIntersections(e,t,n){let r;const s=this.geometry,a=this.material,l=s.index,c=s.attributes.position,h=s.attributes.uv,p=s.attributes.uv1,g=s.attributes.normal,v=s.groups,x=s.drawRange;if(l!==null)if(Array.isArray(a))for(let b=0,w=v.length;bt.far?null:{distance:h,point:E_.clone(),object:i}}function A_(i,e,t,n,r,s,a,l,c,h){i.getVertexPosition(l,S_),i.getVertexPosition(c,M_),i.getVertexPosition(h,w_);const p=eH(i,e,t,n,S_,M_,w_,ID);if(p){const g=new re;Fa.getBarycoord(ID,S_,M_,w_,g),r&&(p.uv=Fa.getInterpolatedAttribute(r,l,c,h,g,new pt)),s&&(p.uv1=Fa.getInterpolatedAttribute(s,l,c,h,g,new pt)),a&&(p.normal=Fa.getInterpolatedAttribute(a,l,c,h,g,new re),p.normal.dot(n.direction)>0&&p.normal.multiplyScalar(-1));const v={a:l,b:c,c:h,normal:new re,materialIndex:0};Fa.getNormal(S_,M_,w_,v.normal),p.face=v,p.barycoord=g}return p}const PD=new re,OD=new fi,FD=new fi,tH=new re,kD=new un,C_=new re,pw=new as,zD=new un,mw=new Qm;class xO extends wi{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=HT,this.bindMatrix=new un,this.bindMatrixInverse=new un,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new ss),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||sH.getNormalMatrix(e),r=this.coplanarPoint(gw).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Vh=new as,aH=new pt(.5,.5),D_=new re;class Jm{constructor(e=new Af,t=new Af,n=new Af,r=new Af,s=new Af,a=new Af){this.planes=[e,t,n,r,s,a]}set(e,t,n,r,s,a){const l=this.planes;return l[0].copy(e),l[1].copy(t),l[2].copy(n),l[3].copy(r),l[4].copy(s),l[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=ao,n=!1){const r=this.planes,s=e.elements,a=s[0],l=s[1],c=s[2],h=s[3],p=s[4],g=s[5],v=s[6],x=s[7],b=s[8],w=s[9],S=s[10],M=s[11],A=s[12],D=s[13],R=s[14],I=s[15];if(r[0].setComponents(h-a,x-p,M-b,I-A).normalize(),r[1].setComponents(h+a,x+p,M+b,I+A).normalize(),r[2].setComponents(h+l,x+g,M+w,I+D).normalize(),r[3].setComponents(h-l,x-g,M-w,I-D).normalize(),n)r[4].setComponents(c,v,S,R).normalize(),r[5].setComponents(h-c,x-v,M-S,I-R).normalize();else if(r[4].setComponents(h-c,x-v,M-S,I-R).normalize(),t===ao)r[5].setComponents(h+c,x+v,M+S,I+R).normalize();else if(t===Cd)r[5].setComponents(c,v,S,R).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Vh.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Vh.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Vh)}intersectsSprite(e){Vh.center.set(0,0,0);const t=aH.distanceTo(e.center);return Vh.radius=.7071067811865476+t,Vh.applyMatrix4(e.matrixWorld),this.intersectsSphere(Vh)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)0?e.max.x:e.min.x,D_.y=r.normal.y>0?e.max.y:e.min.y,D_.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(D_)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const yu=new un,xu=new Jm;class hS{constructor(){this.coordinateSystem=ao}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n=s.length&&s.push({start:-1,count:-1,z:-1,index:-1});const l=s[this.index];a.push(l),this.index++,l.start=e,l.count=t,l.z=n,l.index=r}reset(){this.list.length=0,this.index=0}}const Pa=new un,cH=new zt(1,1,1),HD=new Jm,fH=new hS,N_=new ss,Gh=new as,F0=new re,WD=new re,hH=new re,yw=new uH,Fs=new wi,U_=[];function dH(i,e,t=0){const n=e.itemSize;if(i.isInterleavedBufferAttribute||i.array.constructor!==e.array.constructor){const r=i.count;for(let s=0;s65535?new Uint32Array(r):new Uint16Array(r);t.setIndex(new _i(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const r=e.getAttribute(n),s=t.getAttribute(n);if(r.itemSize!==s.itemSize||r.normalized!==s.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ss);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,r=t.length;n=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let r=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(vw),r=this._availableInstanceIds.shift(),this._instanceInfo[r]=n):(r=this._instanceInfo.length,this._instanceInfo.push(n));const s=this._matricesTexture;Pa.identity().toArray(s.image.data,r*16),s.needsUpdate=!0;const a=this._colorsTexture;return a&&(cH.toArray(a.image.data,r*4),a.needsUpdate=!0),this._visibilityChanged=!0,r}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const r={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},s=this._geometryInfo;r.vertexStart=this._nextVertexStart,r.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const a=e.getIndex();if(a!==null&&(r.indexStart=this._nextIndexStart,r.reservedIndexCount=n===-1?a.count:n),r.indexStart!==-1&&r.indexStart+r.reservedIndexCount>this._maxIndexCount||r.vertexStart+r.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let c;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(vw),c=this._availableGeometryIds.shift(),s[c]=r):(c=this._geometryCount,this._geometryCount++,s.push(r)),this.setGeometryAt(c,e),this._nextIndexStart=r.indexStart+r.reservedIndexCount,this._nextVertexStart=r.vertexStart+r.reservedVertexCount,c}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,r=n.getIndex()!==null,s=n.getIndex(),a=t.getIndex(),l=this._geometryInfo[e];if(r&&a.count>l.reservedIndexCount||t.attributes.position.count>l.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const c=l.vertexStart,h=l.reservedVertexCount;l.vertexCount=t.getAttribute("position").count;for(const p in n.attributes){const g=t.getAttribute(p),v=n.getAttribute(p);dH(g,v,c);const x=g.itemSize;for(let b=g.count,w=h;b=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let r=0,s=n.length;rl).sort((a,l)=>n[a].vertexStart-n[l].vertexStart),s=this.geometry;for(let a=0,l=n.length;a=this._geometryCount)return null;const n=this.geometry,r=this._geometryInfo[e];if(r.boundingBox===null){const s=new ss,a=n.index,l=n.attributes.position;for(let c=r.start,h=r.start+r.count;c=this._geometryCount)return null;const n=this.geometry,r=this._geometryInfo[e];if(r.boundingSphere===null){const s=new as;this.getBoundingBoxAt(e,N_),N_.getCenter(s.center);const a=n.index,l=n.attributes.position;let c=0;for(let h=r.start,p=r.start+r.count;hl.active);if(Math.max(...n.map(l=>l.vertexStart+l.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(c=>c.indexStart+c.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const s=this.geometry;s.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new xn,this._initializeGeometry(s));const a=this.geometry;s.index&&Hh(s.index.array,a.index.array);for(const l in s.attributes)Hh(s.attributes[l].array,a.attributes[l].array)}raycast(e,t){const n=this._instanceInfo,r=this._geometryInfo,s=this.matrixWorld,a=this.geometry;Fs.material=this.material,Fs.geometry.index=a.index,Fs.geometry.attributes=a.attributes,Fs.geometry.boundingBox===null&&(Fs.geometry.boundingBox=new ss),Fs.geometry.boundingSphere===null&&(Fs.geometry.boundingSphere=new as);for(let l=0,c=n.length;l({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,r,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const a=r.getIndex();let l=a===null?1:a.array.BYTES_PER_ELEMENT,c=1;s.wireframe&&(c=2,l=r.attributes.position.count>65535?4:2);const h=this._instanceInfo,p=this._multiDrawStarts,g=this._multiDrawCounts,v=this._geometryInfo,x=this.perObjectFrustumCulled,b=this._indirectTexture,w=b.image.data,S=n.isArrayCamera?fH:HD;x&&!n.isArrayCamera&&(Pa.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),HD.setFromProjectionMatrix(Pa,n.coordinateSystem,n.reversedDepth));let M=0;if(this.sortObjects){Pa.copy(this.matrixWorld).invert(),F0.setFromMatrixPosition(n.matrixWorld).applyMatrix4(Pa),WD.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(Pa);for(let R=0,I=h.length;R0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;sn)return;xw.applyMatrix4(i.matrixWorld);const h=e.ray.origin.distanceTo(xw);if(!(he.far))return{distance:h,point:XD.clone().applyMatrix4(i.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:i}}const YD=new re,qD=new re;class Pu extends Yf{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let r=0,s=t.count;r0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;sr.far)return;s.push({distance:h,distanceToRay:Math.sqrt(l),point:c,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class wO extends di{constructor(e,t,n,r,s=In,a=In,l,c,h){super(e,t,n,r,s,a,l,c,h),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const p=this;function g(){p.needsUpdate=!0,p._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class pH extends wO{constructor(e,t,n,r,s,a,l,c){super({},e,t,n,r,s,a,l,c),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class mH extends di{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Er,this.minFilter=Er,this.generateMipmaps=!1,this.needsUpdate=!0}}class pS extends di{constructor(e,t,n,r,s,a,l,c,h,p,g,v){super(null,a,l,c,h,p,r,s,g,v),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class gH extends pS{constructor(e,t,n,r,s,a){super(e,t,n,s,a),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=vr,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class vH extends pS{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,Il),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class dy extends di{constructor(e=[],t=Il,n,r,s,a,l,c,h,p){super(e,t,n,r,s,a,l,c,h,p),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class yH extends di{constructor(e,t,n,r,s,a,l,c,h){super(e,t,n,r,s,a,l,c,h),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Nd extends di{constructor(e,t,n=po,r,s,a,l=Er,c=Er,h,p=Lu,g=1){if(p!==Lu&&p!==Lf)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const v={width:e,height:t,depth:g};super(v,r,s,a,l,c,p,n,h),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new If(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class TO extends Nd{constructor(e,t=po,n=Il,r,s,a=Er,l=Er,c,h=Lu){const p={width:e,height:e,depth:1},g=[p,p,p,p,p,p];super(e,e,t,n,r,s,a,l,c,h),this.image=g,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class PA extends di{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Qf extends xn{constructor(e=1,t=1,n=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:a};const l=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const c=[],h=[],p=[],g=[];let v=0,x=0;b("z","y","x",-1,-1,n,t,e,a,s,0),b("z","y","x",1,-1,n,t,-e,a,s,1),b("x","z","y",1,1,e,n,t,r,a,2),b("x","z","y",1,-1,e,n,-t,r,a,3),b("x","y","z",1,-1,e,t,n,r,s,4),b("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(c),this.setAttribute("position",new jt(h,3)),this.setAttribute("normal",new jt(p,3)),this.setAttribute("uv",new jt(g,2));function b(w,S,M,A,D,R,I,P,F,N,L){const G=R/F,X=I/N,W=R/2,q=I/2,K=P/2,ne=F+1,j=N+1;let $=0,he=0;const le=new re;for(let ue=0;ue0?1:-1,p.push(le.x,le.y,le.z),g.push(Z/F),g.push(1-ue/N),$+=1}}for(let ue=0;ue0){const L=(A-1)*w;for(let G=0;G0&&D(!0),t>0&&D(!1)),this.setIndex(p),this.setAttribute("position",new jt(g,3)),this.setAttribute("normal",new jt(v,3)),this.setAttribute("uv",new jt(x,2));function A(){const R=new re,I=new re;let P=0;const F=(t-e)/n;for(let N=0;N<=s;N++){const L=[],G=N/s,X=G*(t-e)+e;for(let W=0;W<=r;W++){const q=W/r,K=q*c+l,ne=Math.sin(K),j=Math.cos(K);I.x=X*ne,I.y=-G*n+S,I.z=X*j,g.push(I.x,I.y,I.z),R.set(ne,F,j).normalize(),v.push(R.x,R.y,R.z),x.push(q,1-G),L.push(b++)}w.push(L)}for(let N=0;N0||L!==0)&&(p.push(G,X,q),P+=3),(t>0||L!==s-1)&&(p.push(X,W,q),P+=3)}h.addGroup(M,P,0),M+=P}function D(R){const I=b,P=new pt,F=new re;let N=0;const L=R===!0?e:t,G=R===!0?1:-1;for(let W=1;W<=r;W++)g.push(0,S*G,0),v.push(0,G,0),x.push(.5,.5),b++;const X=b;for(let W=0;W<=r;W++){const K=W/r*c+l,ne=Math.cos(K),j=Math.sin(K);F.x=L*j,F.y=S*G,F.z=L*ne,g.push(F.x,F.y,F.z),v.push(0,G,0),P.x=ne*.5+.5,P.y=j*.5*G+.5,x.push(P.x,P.y),b++}for(let W=0;W.9&&F<.1&&(D<.2&&(a[A+0]+=1),R<.2&&(a[A+2]+=1),I<.2&&(a[A+4]+=1))}}function v(A){s.push(A.x,A.y,A.z)}function x(A,D){const R=A*3;D.x=e[R+0],D.y=e[R+1],D.z=e[R+2]}function b(){const A=new re,D=new re,R=new re,I=new re,P=new pt,F=new pt,N=new pt;for(let L=0,G=0;L0)c=r-1;else{c=r;break}if(r=c,n[r]===a)return r/(s-1);const p=n[r],v=n[r+1]-p,x=(a-p)/v;return(r+x)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const a=this.getPoint(r),l=this.getPoint(s),c=t||(a.isVector2?new pt:new re);return c.copy(l).sub(a).normalize(),c}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new re,r=[],s=[],a=[],l=new re,c=new un;for(let x=0;x<=e;x++){const b=x/e;r[x]=this.getTangentAt(b,new re)}s[0]=new re,a[0]=new re;let h=Number.MAX_VALUE;const p=Math.abs(r[0].x),g=Math.abs(r[0].y),v=Math.abs(r[0].z);p<=h&&(h=p,n.set(1,0,0)),g<=h&&(h=g,n.set(0,1,0)),v<=h&&n.set(0,0,1),l.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],l),a[0].crossVectors(r[0],s[0]);for(let x=1;x<=e;x++){if(s[x]=s[x-1].clone(),a[x]=a[x-1].clone(),l.crossVectors(r[x-1],r[x]),l.length()>Number.EPSILON){l.normalize();const b=Math.acos(fn(r[x-1].dot(r[x]),-1,1));s[x].applyMatrix4(c.makeRotationAxis(l,b))}a[x].crossVectors(r[x],s[x])}if(t===!0){let x=Math.acos(fn(s[0].dot(s[e]),-1,1));x/=e,r[0].dot(l.crossVectors(s[0],s[e]))>0&&(x=-x);for(let b=1;b<=e;b++)s[b].applyMatrix4(c.makeRotationAxis(r[b],x*b)),a[b].crossVectors(r[b],s[b])}return{tangents:r,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class yS extends Fl{constructor(e=0,t=0,n=1,r=1,s=0,a=Math.PI*2,l=!1,c=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=l,this.aRotation=c}getPoint(e,t=new pt){const n=t,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)r;)s-=r;s0?0:(Math.floor(Math.abs(l)/s)+1)*s:c===0&&l===s-1&&(l=s-2,c=1);let h,p;this.closed||l>0?h=r[(l-1)%s]:(B_.subVectors(r[0],r[1]).add(r[0]),h=B_);const g=r[l%s],v=r[(l+1)%s];if(this.closed||l+2r.length-2?r.length-1:a+1],g=r[a>r.length-3?r.length-1:a+2];return n.set(QD(l,c.x,h.x,p.x,g.x),QD(l,c.y,h.y,p.y,g.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const a=r[s]-n,l=this.curves[s],c=l.getLength(),h=c===0?0:1-a/c;return l.getPointAt(h,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,r=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const g=h.getPoint(0);g.equals(this.currentPoint)||this.lineTo(g.x,g.y)}this.curves.push(h);const p=h.getPoint(1);return this.currentPoint.copy(p),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class wd extends Lb{constructor(e){super(e),this.uuid=uo(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,r=this.holes.length;n80*t){l=i[0],c=i[1];let p=l,g=c;for(let v=t;vp&&(p=x),b>g&&(g=b)}h=Math.max(p-l,g-c),h=h!==0?32767/h:0}return Xv(s,a,t,l,c,h,0),a}function UO(i,e,t,n,r){let s;if(r===GH(i,e,t,n)>0)for(let a=e;a=e;a-=n)s=JD(a/n|0,i[a],i[a+1],s);return s&&Gm(s,s.next)&&(qv(s),s=s.next),s}function Ud(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(Gm(t,t.next)||sr(t.prev,t,t.next)===0)){if(qv(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Xv(i,e,t,n,r,s,a){if(!i)return;!a&&s&&OH(i,n,r,s);let l=i;for(;i.prev!==i.next;){const c=i.prev,h=i.next;if(s?CH(i,n,r,s):AH(i)){e.push(c.i,i.i,h.i),qv(i),i=h.next,l=h.next;continue}if(i=h,i===l){a?a===1?(i=RH(Ud(i),e),Xv(i,e,t,n,r,s,2)):a===2&&DH(i,e,t,n,r,s):Xv(Ud(i),e,t,n,r,s,1);break}}}function AH(i){const e=i.prev,t=i,n=i.next;if(sr(e,t,n)>=0)return!1;const r=e.x,s=t.x,a=n.x,l=e.y,c=t.y,h=n.y,p=Math.min(r,s,a),g=Math.min(l,c,h),v=Math.max(r,s,a),x=Math.max(l,c,h);let b=n.next;for(;b!==e;){if(b.x>=p&&b.x<=v&&b.y>=g&&b.y<=x&&Q0(r,l,s,c,a,h,b.x,b.y)&&sr(b.prev,b,b.next)>=0)return!1;b=b.next}return!0}function CH(i,e,t,n){const r=i.prev,s=i,a=i.next;if(sr(r,s,a)>=0)return!1;const l=r.x,c=s.x,h=a.x,p=r.y,g=s.y,v=a.y,x=Math.min(l,c,h),b=Math.min(p,g,v),w=Math.max(l,c,h),S=Math.max(p,g,v),M=ZT(x,b,e,t,n),A=ZT(w,S,e,t,n);let D=i.prevZ,R=i.nextZ;for(;D&&D.z>=M&&R&&R.z<=A;){if(D.x>=x&&D.x<=w&&D.y>=b&&D.y<=S&&D!==r&&D!==a&&Q0(l,p,c,g,h,v,D.x,D.y)&&sr(D.prev,D,D.next)>=0||(D=D.prevZ,R.x>=x&&R.x<=w&&R.y>=b&&R.y<=S&&R!==r&&R!==a&&Q0(l,p,c,g,h,v,R.x,R.y)&&sr(R.prev,R,R.next)>=0))return!1;R=R.nextZ}for(;D&&D.z>=M;){if(D.x>=x&&D.x<=w&&D.y>=b&&D.y<=S&&D!==r&&D!==a&&Q0(l,p,c,g,h,v,D.x,D.y)&&sr(D.prev,D,D.next)>=0)return!1;D=D.prevZ}for(;R&&R.z<=A;){if(R.x>=x&&R.x<=w&&R.y>=b&&R.y<=S&&R!==r&&R!==a&&Q0(l,p,c,g,h,v,R.x,R.y)&&sr(R.prev,R,R.next)>=0)return!1;R=R.nextZ}return!0}function RH(i,e){let t=i;do{const n=t.prev,r=t.next.next;!Gm(n,r)&&IO(n,t,t.next,r)&&Yv(n,r)&&Yv(r,n)&&(e.push(n.i,t.i,r.i),qv(t),qv(t.next),t=i=r),t=t.next}while(t!==i);return Ud(t)}function DH(i,e,t,n,r,s){let a=i;do{let l=a.next.next;for(;l!==a.prev;){if(a.i!==l.i&&zH(a,l)){let c=PO(a,l);a=Ud(a,a.next),c=Ud(c,c.next),Xv(a,e,t,n,r,s,0),Xv(c,e,t,n,r,s,0);return}l=l.next}a=a.next}while(a!==i)}function NH(i,e,t,n){const r=[];for(let s=0,a=e.length;s=t.next.y&&t.next.y!==t.y){const g=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(g<=n&&g>s&&(s=g,a=t.x=t.x&&t.x>=c&&n!==t.x&&LO(ra.x||t.x===a.x&&PH(a,t)))&&(a=t,p=g)}t=t.next}while(t!==l);return a}function PH(i,e){return sr(i.prev,i,e.prev)<0&&sr(e.next,i,i.next)<0}function OH(i,e,t,n){let r=i;do r.z===0&&(r.z=ZT(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,FH(r)}function FH(i){let e,t=1;do{let n=i,r;i=null;let s=null;for(e=0;n;){e++;let a=n,l=0;for(let h=0;h0||c>0&&a;)l!==0&&(c===0||!a||n.z<=a.z)?(r=n,n=n.nextZ,l--):(r=a,a=a.nextZ,c--),s?s.nextZ=r:i=r,r.prevZ=s,s=r;n=a}s.nextZ=null,t*=2}while(e>1);return i}function ZT(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function kH(i){let e=i,t=i;do(e.x=(i-a)*(s-l)&&(i-a)*(n-l)>=(t-a)*(e-l)&&(t-a)*(s-l)>=(r-a)*(n-l)}function Q0(i,e,t,n,r,s,a,l){return!(i===a&&e===l)&&LO(i,e,t,n,r,s,a,l)}function zH(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!BH(i,e)&&(Yv(i,e)&&Yv(e,i)&&VH(i,e)&&(sr(i.prev,i,e.prev)||sr(i,e.prev,e))||Gm(i,e)&&sr(i.prev,i,i.next)>0&&sr(e.prev,e,e.next)>0)}function sr(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function Gm(i,e){return i.x===e.x&&i.y===e.y}function IO(i,e,t,n){const r=G_(sr(i,e,t)),s=G_(sr(i,e,n)),a=G_(sr(t,n,i)),l=G_(sr(t,n,e));return!!(r!==s&&a!==l||r===0&&V_(i,t,e)||s===0&&V_(i,n,e)||a===0&&V_(t,i,n)||l===0&&V_(t,e,n))}function V_(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function G_(i){return i>0?1:i<0?-1:0}function BH(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&IO(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function Yv(i,e){return sr(i.prev,i,i.next)<0?sr(i,e,i.next)>=0&&sr(i,i.prev,e)>=0:sr(i,e,i.prev)<0||sr(i,i.next,e)<0}function VH(i,e){let t=i,n=!1;const r=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function PO(i,e){const t=KT(i.i,i.x,i.y),n=KT(e.i,e.x,e.y),r=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function JD(i,e,t,n){const r=KT(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function qv(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function KT(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function GH(i,e,t,n){let r=0;for(let s=e,a=t-n;s2&&i[e-1].equals(i[0])&&i.pop()}function eN(i,e){for(let t=0;tNumber.EPSILON){const Ue=Math.sqrt(B),Ae=Math.sqrt(We*We+Q*Q),Ee=ze.x-Re/Ue,rt=ze.y+Ye/Ue,st=Ie.x-Q/Ae,Et=Ie.y+We/Ae,Nt=((st-Ee)*Q-(Et-rt)*We)/(Ye*Q-Re*We);tt=Ee+Ye*Nt-Le.x,ee=rt+Re*Nt-Le.y;const Ve=tt*tt+ee*ee;if(Ve<=2)return new pt(tt,ee);lt=Math.sqrt(Ve/2)}else{let Ue=!1;Ye>Number.EPSILON?We>Number.EPSILON&&(Ue=!0):Ye<-Number.EPSILON?We<-Number.EPSILON&&(Ue=!0):Math.sign(Re)===Math.sign(Q)&&(Ue=!0),Ue?(tt=-Re,ee=Ye,lt=Math.sqrt(B)):(tt=Ye,ee=Re,lt=Math.sqrt(B/2))}return new pt(tt/lt,ee/lt)}const le=[];for(let Le=0,ze=ne.length,Ie=ze-1,tt=Le+1;Le=0;Le--){const ze=Le/S,Ie=x*Math.cos(ze*Math.PI/2),tt=b*Math.sin(ze*Math.PI/2)+w;for(let ee=0,lt=ne.length;ee=0;){const tt=Ie;let ee=Ie-1;ee<0&&(ee=Le.length-1);for(let lt=0,Ye=p+S*2;lt0)&&x.push(D,R,P),(M!==n-1||c0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class HA extends ls{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class WA extends Vs{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new zt(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kf,this.normalScale=new pt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new mo,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class jA extends WA{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new pt(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return fn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new zt(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new zt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new zt(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class zO extends Vs{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new zt(16777215),this.specular=new zt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kf,this.normalScale=new pt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new mo,this.combine=ly,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class BO extends Vs{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new zt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kf,this.normalScale=new pt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class VO extends Vs{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kf,this.normalScale=new pt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class GO extends Vs{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new zt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new zt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kf,this.normalScale=new pt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new mo,this.combine=ly,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class yy extends Vs{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=nO,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class ES extends Vs{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class HO extends Vs{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new zt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kf,this.normalScale=new pt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class WO extends ha{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function fd(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}function jO(i){function e(r,s){return i[r]-i[s]}const t=i.length,n=new Array(t);for(let r=0;r!==t;++r)n[r]=r;return n.sort(e),n}function QT(i,e,t){const n=i.length,r=new i.constructor(n);for(let s=0,a=0;a!==n;++s){const l=t[s]*e;for(let c=0;c!==e;++c)r[a++]=i[l+c]}return r}function XA(i,e,t,n){let r=1,s=i[0];for(;s!==void 0&&s[n]===void 0;)s=i[r++];if(s===void 0)return;let a=s[n];if(a!==void 0)if(Array.isArray(a))do a=s[n],a!==void 0&&(e.push(s.time),t.push(...a)),s=i[r++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=i[r++];while(s!==void 0);else do a=s[n],a!==void 0&&(e.push(s.time),t.push(a)),s=i[r++];while(s!==void 0)}function KH(i,e,t,n,r=30){const s=i.clone();s.name=e;const a=[];for(let c=0;c=n)){g.push(h.times[x]);for(let w=0;ws.tracks[c].times[0]&&(l=s.tracks[c].times[0]);for(let c=0;c=l.times[b]){const M=b*g+p,A=M+g-p;w=l.values.slice(M,A)}else{const M=l.createInterpolant(),A=p,D=g-p;M.evaluate(s),w=M.resultBuffer.slice(A,D)}c==="quaternion"&&new fa().fromArray(w).normalize().conjugate().toArray(w);const S=h.times.length;for(let M=0;M=s)){const l=t[1];e=s)break t}a=n,n=0;break n}break e}for(;n>>1;et;)--a;if(++a,s!==0||a!==r){s>=a&&(a=Math.max(a,1),s=a-1);const l=this.getValueSize();this.times=n.slice(s,a),this.values=this.values.slice(s*l,a*l)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(en("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,r=this.values,s=n.length;s===0&&(en("KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let l=0;l!==s;l++){const c=n[l];if(typeof c=="number"&&isNaN(c)){en("KeyframeTrack: Time is not a valid number.",this,l,c),e=!1;break}if(a!==null&&a>c){en("KeyframeTrack: Out of order keys.",this,l,c,a),e=!1;break}a=c}if(r!==void 0&&fO(r))for(let l=0,c=r.length;l!==c;++l){const h=r[l];if(isNaN(h)){en("KeyframeTrack: Value is not a valid number.",this,l,h),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===v1,s=e.length-1;let a=1;for(let l=1;l0){e[a]=e[s];for(let l=s*n,c=a*n,h=0;h!==n;++h)t[c+h]=t[l+h];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}nl.prototype.ValueTypeName="";nl.prototype.TimeBufferType=Float32Array;nl.prototype.ValueBufferType=Float32Array;nl.prototype.DefaultInterpolation=Rb;class Od extends nl{constructor(e,t,n){super(e,t,n)}}Od.prototype.ValueTypeName="bool";Od.prototype.ValueBufferType=Array;Od.prototype.DefaultInterpolation=zv;Od.prototype.InterpolantFactoryMethodLinear=void 0;Od.prototype.InterpolantFactoryMethodSmooth=void 0;class qA extends nl{constructor(e,t,n,r){super(e,t,n,r)}}qA.prototype.ValueTypeName="color";class Zv extends nl{constructor(e,t,n,r){super(e,t,n,r)}}Zv.prototype.ValueTypeName="number";class ZO extends tg{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){const s=this.resultBuffer,a=this.sampleValues,l=this.valueSize,c=(n-t)/(r-t);let h=e*l;for(let p=h+l;h!==p;h+=4)fa.slerpFlat(s,0,a,h-l,a,h,c);return s}}class xy extends nl{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new ZO(this.times,this.values,this.getValueSize(),e)}}xy.prototype.ValueTypeName="quaternion";xy.prototype.InterpolantFactoryMethodSmooth=void 0;class Fd extends nl{constructor(e,t,n){super(e,t,n)}}Fd.prototype.ValueTypeName="string";Fd.prototype.ValueBufferType=Array;Fd.prototype.DefaultInterpolation=zv;Fd.prototype.InterpolantFactoryMethodLinear=void 0;Fd.prototype.InterpolantFactoryMethodSmooth=void 0;class Kv extends nl{constructor(e,t,n,r){super(e,t,n,r)}}Kv.prototype.ValueTypeName="vector";class Qv{constructor(e="",t=-1,n=[],r=iS){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=uo(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,r=1/(e.fps||1);for(let a=0,l=n.length;a!==l;++a)t.push(e9(n[a]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s.userData=JSON.parse(e.userData||"{}"),s}static toJSON(e){const t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let s=0,a=n.length;s!==a;++s)t.push(nl.toJSON(n[s]));return r}static CreateFromMorphTargetSequence(e,t,n,r){const s=t.length,a=[];for(let l=0;l1){const g=p[1];let v=r[g];v||(r[g]=v=[]),v.push(h)}}const a=[];for(const l in r)a.push(this.CreateFromMorphTargetSequence(l,r[l],t,n));return a}static parseAnimation(e,t){if(Ft("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return en("AnimationClip: No animation in JSONLoader data."),null;const n=function(g,v,x,b,w){if(x.length!==0){const S=[],M=[];XA(x,S,M,b),S.length!==0&&w.push(new g(v,S,M))}},r=[],s=e.name||"default",a=e.fps||30,l=e.blendMode;let c=e.length||-1;const h=e.hierarchy||[];for(let g=0;g{t&&t(s),this.manager.itemEnd(e)},0),s;if(_c[e]!==void 0){_c[e].push({onLoad:t,onProgress:n,onError:r});return}_c[e]=[],_c[e].push({onLoad:t,onProgress:n,onError:r});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),l=this.mimeType,c=this.responseType;fetch(a).then(h=>{if(h.status===200||h.status===0){if(h.status===0&&Ft("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||h.body===void 0||h.body.getReader===void 0)return h;const p=_c[e],g=h.body.getReader(),v=h.headers.get("X-File-Size")||h.headers.get("Content-Length"),x=v?parseInt(v):0,b=x!==0;let w=0;const S=new ReadableStream({start(M){A();function A(){g.read().then(({done:D,value:R})=>{if(D)M.close();else{w+=R.byteLength;const I=new ProgressEvent("progress",{lengthComputable:b,loaded:w,total:x});for(let P=0,F=p.length;P{M.error(D)})}}});return new Response(S)}else throw new t9(`fetch for "${h.url}" responded with ${h.status}: ${h.statusText}`,h)}).then(h=>{switch(c){case"arraybuffer":return h.arrayBuffer();case"blob":return h.blob();case"document":return h.text().then(p=>new DOMParser().parseFromString(p,l));case"json":return h.json();default:if(l==="")return h.text();{const g=/charset="?([^;"\s]*)"?/i.exec(l),v=g&&g[1]?g[1].toLowerCase():void 0,x=new TextDecoder(v);return h.arrayBuffer().then(b=>x.decode(b))}}}).then(h=>{Ru.add(`file:${e}`,h);const p=_c[e];delete _c[e];for(let g=0,v=p.length;g{const p=_c[e];if(p===void 0)throw this.manager.itemError(e),h;delete _c[e];for(let g=0,v=p.length;g{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class n9 extends da{constructor(e){super(e)}load(e,t,n,r){const s=this,a=new co(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){try{t(s.parse(JSON.parse(l)))}catch(c){r?r(c):en(c),s.manager.itemError(e)}},n,r)}parse(e){const t=[];for(let n=0;n0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const a=e.uniforms[s];switch(r.uniforms[s]={},a.type){case"t":r.uniforms[s].value=n(a.value);break;case"c":r.uniforms[s].value=new zt().setHex(a.value);break;case"v2":r.uniforms[s].value=new pt().fromArray(a.value);break;case"v3":r.uniforms[s].value=new re().fromArray(a.value);break;case"v4":r.uniforms[s].value=new fi().fromArray(a.value);break;case"m3":r.uniforms[s].value=new yn().fromArray(a.value);break;case"m4":r.uniforms[s].value=new un().fromArray(a.value);break;default:r.uniforms[s].value=a.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(r.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)r.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(r.lights=e.lights),e.clipping!==void 0&&(r.clipping=e.clipping),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=n(e.map)),e.matcap!==void 0&&(r.matcap=n(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new pt().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(r.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(r.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(r.envMap=n(e.envMap)),e.envMapRotation!==void 0&&r.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new pt().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(r.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(r.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(r.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(r.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(r.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=n(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return RS.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:FO,SpriteMaterial:LA,RawShaderMaterial:HA,ShaderMaterial:ls,PointsMaterial:dS,MeshPhysicalMaterial:jA,MeshStandardMaterial:WA,MeshPhongMaterial:zO,MeshToonMaterial:BO,MeshNormalMaterial:VO,MeshLambertMaterial:GO,MeshDepthMaterial:yy,MeshDistanceMaterial:ES,MeshBasicMaterial:Ol,MeshMatcapMaterial:HO,LineDashedMaterial:WO,LineBasicMaterial:ha,Material:Vs};return new t[e]}}class JT{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class JA extends xn{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class s4 extends da{constructor(e){super(e)}load(e,t,n,r){const s=this,a=new co(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(l){try{t(s.parse(JSON.parse(l)))}catch(c){r?r(c):en(c),s.manager.itemError(e)}},n,r)}parse(e){const t={},n={};function r(x,b){if(t[b]!==void 0)return t[b];const S=x.interleavedBuffers[b],M=s(x,S.buffer),A=_m(S.type,M),D=new cS(A,S.stride);return D.uuid=S.uuid,t[b]=D,D}function s(x,b){if(n[b]!==void 0)return n[b];const S=x.arrayBuffers[b],M=new Uint32Array(S).buffer;return n[b]=M,M}const a=e.isInstancedBufferGeometry?new JA:new xn,l=e.data.index;if(l!==void 0){const x=_m(l.type,l.array);a.setIndex(new _i(x,1))}const c=e.data.attributes;for(const x in c){const b=c[x];let w;if(b.isInterleavedBufferAttribute){const S=r(e.data,b.data);w=new Rd(S,b.itemSize,b.offset,b.normalized)}else{const S=_m(b.type,b.array),M=b.isInstancedBufferAttribute?Dd:_i;w=new M(S,b.itemSize,b.normalized)}b.name!==void 0&&(w.name=b.name),b.usage!==void 0&&w.setUsage(b.usage),a.setAttribute(x,w)}const h=e.data.morphAttributes;if(h)for(const x in h){const b=h[x],w=[];for(let S=0,M=b.length;S0){const c=new AS(t);s=new Jv(c),s.setCrossOrigin(this.crossOrigin);for(let h=0,p=e.length;h0){r=new Jv(this.manager),r.setCrossOrigin(this.crossOrigin);for(let a=0,l=e.length;a{let M=null,A=null;return S.boundingBox!==void 0&&(M=new ss().fromJSON(S.boundingBox)),S.boundingSphere!==void 0&&(A=new as().fromJSON(S.boundingSphere)),{...S,boundingBox:M,boundingSphere:A}}),a._instanceInfo=e.instanceInfo,a._availableInstanceIds=e._availableInstanceIds,a._availableGeometryIds=e._availableGeometryIds,a._nextIndexStart=e.nextIndexStart,a._nextVertexStart=e.nextVertexStart,a._geometryCount=e.geometryCount,a._maxInstanceCount=e.maxInstanceCount,a._maxVertexCount=e.maxVertexCount,a._maxIndexCount=e.maxIndexCount,a._geometryInitialized=e.geometryInitialized,a._matricesTexture=h(e.matricesTexture.uuid),a._indirectTexture=h(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(a._colorsTexture=h(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(a.boundingSphere=new as().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(a.boundingBox=new ss().fromJSON(e.boundingBox));break;case"LOD":a=new yO;break;case"Line":a=new Yf(l(e.geometry),c(e.material));break;case"LineLoop":a=new SO(l(e.geometry),c(e.material));break;case"LineSegments":a=new Pu(l(e.geometry),c(e.material));break;case"PointCloud":case"Points":a=new MO(l(e.geometry),c(e.material));break;case"Sprite":a=new vO(c(e.material));break;case"Group":a=new bm;break;case"Bone":a=new IA;break;default:a=new ei}if(a.uuid=e.uuid,e.name!==void 0&&(a.name=e.name),e.matrix!==void 0?(a.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(e.position!==void 0&&a.position.fromArray(e.position),e.rotation!==void 0&&a.rotation.fromArray(e.rotation),e.quaternion!==void 0&&a.quaternion.fromArray(e.quaternion),e.scale!==void 0&&a.scale.fromArray(e.scale)),e.up!==void 0&&a.up.fromArray(e.up),e.pivot!==void 0&&(a.pivot=new re().fromArray(e.pivot)),e.morphTargetDictionary!==void 0&&(a.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),e.morphTargetInfluences!==void 0&&(a.morphTargetInfluences=e.morphTargetInfluences.slice()),e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(a.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(a.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(a.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(a.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(a.visible=e.visible),e.frustumCulled!==void 0&&(a.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(a.renderOrder=e.renderOrder),e.static!==void 0&&(a.static=e.static),e.userData!==void 0&&(a.userData=e.userData),e.layers!==void 0&&(a.layers.mask=e.layers),e.children!==void 0){const v=e.children;for(let x=0;x"u"&&Ft("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&Ft("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Ru.get(`image-bitmap:${e}`);if(a!==void 0){if(s.manager.itemStart(e),a.then){a.then(h=>{if(Tw.has(a)===!0)r&&r(Tw.get(a)),s.manager.itemError(e),s.manager.itemEnd(e);else return t&&t(h),s.manager.itemEnd(e),h});return}return setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a}const l={};l.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",l.headers=this.requestHeader,l.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const c=fetch(e,l).then(function(h){return h.blob()}).then(function(h){return createImageBitmap(h,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(h){return Ru.add(`image-bitmap:${e}`,h),t&&t(h),s.manager.itemEnd(e),h}).catch(function(h){r&&r(h),Tw.set(c,h),Ru.remove(`image-bitmap:${e}`),s.manager.itemError(e),s.manager.itemEnd(e)});Ru.add(`image-bitmap:${e}`,c),s.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let j_;class $A{static getContext(){return j_===void 0&&(j_=new(window.AudioContext||window.webkitAudioContext)),j_}static setContext(e){j_=e}}class f9 extends da{constructor(e){super(e)}load(e,t,n,r){const s=this,a=new co(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(c){try{const h=c.slice(0);$A.getContext().decodeAudioData(h,function(g){t(g)}).catch(l)}catch(h){l(h)}},n,r);function l(c){r?r(c):en(c),s.manager.itemError(e)}}}const cN=new un,fN=new un,Wh=new un;class h9{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new ns,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ns,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Wh.copy(e.projectionMatrix);const r=t.eyeSep/2,s=r*t.near/t.focus,a=t.near*Math.tan(Md*t.fov*.5)/t.zoom;let l,c;fN.elements[12]=-r,cN.elements[12]=r,l=-a*t.aspect+s,c=a*t.aspect+s,Wh.elements[0]=2*t.near/(c-l),Wh.elements[8]=(c+l)/(c-l),this.cameraL.projectionMatrix.copy(Wh),l=-a*t.aspect-s,c=a*t.aspect-s,Wh.elements[0]=2*t.near/(c-l),Wh.elements[8]=(c+l)/(c-l),this.cameraR.projectionMatrix.copy(Wh)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(fN),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(cN)}}const im=-90,rm=1;class a4 extends ei{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new ns(im,rm,e,t);r.layers=this.layers,this.add(r);const s=new ns(im,rm,e,t);s.layers=this.layers,this.add(s);const a=new ns(im,rm,e,t);a.layers=this.layers,this.add(a);const l=new ns(im,rm,e,t);l.layers=this.layers,this.add(l);const c=new ns(im,rm,e,t);c.layers=this.layers,this.add(c);const h=new ns(im,rm,e,t);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,s,a,l,c]=t;for(const h of t)this.remove(h);if(e===ao)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),l.up.set(0,1,0),l.lookAt(0,0,1),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===Cd)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),l.up.set(0,-1,0),l.lookAt(0,0,1),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const h of t)this.add(h),h.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,l,c,h,p]=this.children,g=e.getRenderTarget(),v=e.getActiveCubeFace(),x=e.getActiveMipmapLevel(),b=e.xr.enabled;e.xr.enabled=!1;const w=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let S=!1;e.isWebGLRenderer===!0?S=e.state.buffers.depth.getReversed():S=e.reversedDepthBuffer,e.setRenderTarget(n,0,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,2,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,3,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),e.setRenderTarget(n,4,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),n.texture.generateMipmaps=w,e.setRenderTarget(n,5,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,p),e.setRenderTarget(g,v,x),e.xr.enabled=b,n.texture.needsPMREMUpdate=!0}}class o4 extends ns{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class l4{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=d9.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function d9(){this._document.hidden===!1&&this.reset()}const jh=new re,Ew=new fa,p9=new re,Xh=new re,Yh=new re;class m9 extends ei{constructor(){super(),this.type="AudioListener",this.context=$A.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new l4}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e),this._timer.update();const t=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(jh,Ew,p9),Xh.set(0,0,-1).applyQuaternion(Ew),Yh.set(0,1,0).applyQuaternion(Ew),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(jh.x,n),t.positionY.linearRampToValueAtTime(jh.y,n),t.positionZ.linearRampToValueAtTime(jh.z,n),t.forwardX.linearRampToValueAtTime(Xh.x,n),t.forwardY.linearRampToValueAtTime(Xh.y,n),t.forwardZ.linearRampToValueAtTime(Xh.z,n),t.upX.linearRampToValueAtTime(Yh.x,n),t.upY.linearRampToValueAtTime(Yh.y,n),t.upZ.linearRampToValueAtTime(Yh.z,n)}else t.setPosition(jh.x,jh.y,jh.z),t.setOrientation(Xh.x,Xh.y,Xh.z,Yh.x,Yh.y,Yh.z)}}class u4 extends ei{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){Ft("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){Ft("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){Ft("Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){Ft("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(let c=t,h=t+t;c!==h;++c)if(n[c]!==n[c+t]){l.setValue(n,r);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(let s=n,a=r;s!==a;++s)t[s]=t[r+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let a=0;a!==s;++a)e[t+a]=e[n+a]}_slerp(e,t,n,r){fa.slerpFlat(e,t,e,t,e,n,r)}_slerpAdditive(e,t,n,r,s){const a=this._workIndex*s;fa.multiplyQuaternionsFlat(e,a,e,t,e,n),fa.slerpFlat(e,t,e,t,e,a,r)}_lerp(e,t,n,r,s){const a=1-r;for(let l=0;l!==s;++l){const c=t+l;e[c]=e[c]*a+e[n+l]*r}}_lerpAdditive(e,t,n,r,s){for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]+e[n+a]*r}}}const eC="\\[\\]\\.:\\/",x9=new RegExp("["+eC+"]","g"),tC="[^"+eC+"]",_9="[^"+eC.replace("\\.","")+"]",b9=/((?:WC+[\/:])*)/.source.replace("WC",tC),S9=/(WCOD+)?/.source.replace("WCOD",_9),M9=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",tC),w9=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",tC),T9=new RegExp("^"+b9+S9+M9+w9+"$"),E9=["material","materials","bones","map"];class A9{constructor(e,t,n){const r=n||$n.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=n.length;r!==s;++r)n[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class $n{constructor(e,t,n){this.path=t,this.parsedPath=n||$n.parseTrackName(t),this.node=$n.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new $n.Composite(e,t,n):new $n(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(x9,"")}static parseTrackName(e){const t=T9.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=n.nodeName.substring(r+1);E9.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let a=0;a=s){const g=s++,v=e[g];t[v.uuid]=p,e[p]=v,t[h]=g,e[g]=c;for(let x=0,b=r;x!==b;++x){const w=n[x],S=w[g],M=w[p];w[p]=S,w[g]=M}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length;let s=this.nCachedObjects_,a=e.length;for(let l=0,c=arguments.length;l!==c;++l){const h=arguments[l],p=h.uuid,g=t[p];if(g!==void 0)if(delete t[p],g0&&(t[x.uuid]=g),e[g]=x,e.pop();for(let b=0,w=r;b!==w;++b){const S=n[b];S[g]=S[v],S.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const n=this._bindingsIndicesByPath;let r=n[e];const s=this._bindings;if(r!==void 0)return s[r];const a=this._paths,l=this._parsedPaths,c=this._objects,h=c.length,p=this.nCachedObjects_,g=new Array(h);r=s.length,n[e]=r,a.push(e),l.push(t),s.push(g);for(let v=p,x=c.length;v!==x;++v){const b=c[v];g[v]=new $n(b,e,t)}return g}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const r=this._paths,s=this._parsedPaths,a=this._bindings,l=a.length-1,c=a[l],h=e[l];t[h]=n,a[n]=c,a.pop(),s[n]=s[l],s.pop(),r[n]=r[l],r.pop()}}}class f4{constructor(e,t,n=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=r;const s=t.tracks,a=s.length,l=new Array(a),c={endingStart:ld,endingEnd:ld};for(let h=0;h!==a;++h){const p=s[h].createInterpolant(null);l[h]=p,p.settings=c}this._interpolantSettings=c,this._interpolants=l,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=eO,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const r=this._clip.duration,s=e._clip.duration,a=s/r,l=r/s;e.warp(1,a,t),this.warp(l,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const r=this._mixer,s=r.time,a=this.timeScale;let l=this._timeScaleInterpolant;l===null&&(l=r._lendControlInterpolant(),this._timeScaleInterpolant=l);const c=l.parameterPositions,h=l.sampleValues;return c[0]=s,c[1]=s+n,h[0]=e/a,h[1]=t/a,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,r){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const c=(e-s)*n;c<0||n===0?t=0:(this._startTime=null,t=n*c)}t*=this._updateTimeScale(e);const a=this._updateTime(t),l=this._updateWeight(e);if(l>0){const c=this._interpolants,h=this._propertyBindings;switch(this.blendMode){case CA:for(let p=0,g=c.length;p!==g;++p)c[p].evaluate(a),h[p].accumulateAdditive(l);break;case iS:default:for(let p=0,g=c.length;p!==g;++p)c[p].evaluate(a),h[p].accumulate(r,l)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let r=this.time+e,s=this._loopCount;const a=n===tO;if(e===0)return s===-1?r:a&&(s&1)===1?t-r:r;if(n===$P){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),r>=t||r<0){const l=Math.floor(r/t);r-=t*l,s+=Math.abs(l);const c=this.repetitions-s;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(c===1){const h=e<0;this._setEndings(h,!h,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:l})}}else this.time=r;if(a&&(s&1)===1)return t-r}return r}_setEndings(e,t,n){const r=this._interpolantSettings;n?(r.endingStart=ud,r.endingEnd=ud):(e?r.endingStart=this.zeroSlopeAtStart?ud:ld:r.endingStart=Bv,t?r.endingEnd=this.zeroSlopeAtEnd?ud:ld:r.endingEnd=Bv)}_scheduleFading(e,t,n){const r=this._mixer,s=r.time;let a=this._weightInterpolant;a===null&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,c[0]=t,l[1]=s+e,c[1]=n,this}}const R9=new Float32Array(1);class D9 extends Iu{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){const n=e._localRoot||this._root,r=e._clip.tracks,s=r.length,a=e._propertyBindings,l=e._interpolants,c=n.uuid,h=this._bindingsByRootAndName;let p=h[c];p===void 0&&(p={},h[c]=p);for(let g=0;g!==s;++g){const v=r[g],x=v.name;let b=p[x];if(b!==void 0)++b.referenceCount,a[g]=b;else{if(b=a[g],b!==void 0){b._cacheIndex===null&&(++b.referenceCount,this._addInactiveBinding(b,c,x));continue}const w=t&&t._propertyBindings[g].binding.parsedPath;b=new c4($n.create(n,x,w),v.ValueTypeName,v.getValueSize()),++b.referenceCount,this._addInactiveBinding(b,c,x),a[g]=b}l[g].resultBuffer=b.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,r=e._clip.uuid,s=this._actionsByClip[r];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,r,n)}const t=e._propertyBindings;for(let n=0,r=t.length;n!==r;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,r=t.length;n!==r;++n){const s=t[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,r=this.time+=e,s=Math.sign(e),a=this._accuIndex^=1;for(let h=0;h!==n;++h)t[h]._update(r,e,s,a);const l=this._bindings,c=this._nActiveBindings;for(let h=0;h!==c;++h)l[h].apply(a);return this}setTime(e){this.time=0;for(let t=0;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,mN).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const gN=new re,X_=new re,sm=new re,am=new re,Aw=new re,z9=new re,B9=new re;class V9{constructor(e=new re,t=new re){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){gN.subVectors(e,this.start),X_.subVectors(this.end,this.start);const n=X_.dot(X_);let s=X_.dot(gN)/n;return t&&(s=fn(s,0,1)),s}closestPointToPoint(e,t,n){const r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}distanceSqToLine3(e,t=z9,n=B9){const r=10000000000000001e-32;let s,a;const l=this.start,c=e.start,h=this.end,p=e.end;sm.subVectors(h,l),am.subVectors(p,c),Aw.subVectors(l,c);const g=sm.dot(sm),v=am.dot(am),x=am.dot(Aw);if(g<=r&&v<=r)return t.copy(l),n.copy(c),t.sub(n),t.dot(t);if(g<=r)s=0,a=x/v,a=fn(a,0,1);else{const b=sm.dot(Aw);if(v<=r)a=0,s=fn(-b/g,0,1);else{const w=sm.dot(am),S=g*v-w*w;S!==0?s=fn((w*x-b*v)/S,0,1):s=0,a=(w*s+x)/v,a<0?(a=0,s=fn(-b/g,0,1)):a>1&&(a=1,s=fn((w-b)/g,0,1))}}return t.copy(l).addScaledVector(sm,s),n.copy(c).addScaledVector(am,a),t.distanceToSquared(n)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const vN=new re;class G9 extends ei{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new xn,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,l=1,c=32;a1)for(let g=0;g.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{SN.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(SN,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class t7 extends Pu{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new xn;r.setAttribute("position",new jt(t,3)),r.setAttribute("color",new jt(n,3));const s=new ha({vertexColors:!0,toneMapped:!1});super(r,s),this.type="AxesHelper"}setColors(e,t,n){const r=new zt,s=this.geometry.attributes.color.array;return r.set(e),r.toArray(s,0),r.toArray(s,3),r.set(t),r.toArray(s,6),r.toArray(s,9),r.set(n),r.toArray(s,12),r.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class n7{constructor(){this.type="ShapePath",this.color=new zt,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Lb,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,s,a){return this.currentPath.bezierCurveTo(e,t,n,r,s,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(M){const A=[];for(let D=0,R=M.length;DNumber.EPSILON){if(G<0&&(F=A[P],L=-L,N=A[I],G=-G),M.yN.y)continue;if(M.y===F.y){if(M.x===F.x)return!0}else{const X=G*(M.x-F.x)-L*(M.y-F.y);if(X===0)return!0;if(X<0)continue;R=!R}}else{if(M.y!==F.y)continue;if(N.x<=M.x&&M.x<=F.x||F.x<=M.x&&M.x<=N.x)return!0}}return R}const r=Rl.isClockWise,s=this.subPaths;if(s.length===0)return[];let a,l,c;const h=[];if(s.length===1)return l=s[0],c=new wd,c.curves=l.curves,h.push(c),h;let p=!r(s[0].getPoints());p=e?!p:p;const g=[],v=[];let x=[],b=0,w;v[b]=void 0,x[b]=[];for(let M=0,A=s.length;M1){let M=!1,A=0;for(let D=0,R=v.length;D0&&M===!1&&(x=g)}let S;for(let M=0,A=v.length;Me?(i.repeat.x=1,i.repeat.y=t/e,i.offset.x=0,i.offset.y=(1-i.repeat.y)/2):(i.repeat.x=e/t,i.repeat.y=1,i.offset.x=(1-i.repeat.x)/2,i.offset.y=0),i}function s7(i,e){const t=i.image&&i.image.width?i.image.width/i.image.height:1;return t>e?(i.repeat.x=e/t,i.repeat.y=1,i.offset.x=(1-i.repeat.x)/2,i.offset.y=0):(i.repeat.x=1,i.repeat.y=t/e,i.offset.x=0,i.offset.y=(1-i.repeat.y)/2),i}function a7(i){return i.repeat.x=1,i.repeat.y=1,i.offset.x=0,i.offset.y=0,i}function eE(i,e,t,n){const r=o7(n);switch(t){case EA:return i*e;case cy:return i*e/r.components*r.byteLength;case fy:return i*e/r.components*r.byteLength;case Ad:return i*e*2/r.components*r.byteLength;case tS:return i*e*2/r.components*r.byteLength;case AA:return i*e*3/r.components*r.byteLength;case Ar:return i*e*4/r.components*r.byteLength;case nS:return i*e*4/r.components*r.byteLength;case hv:case dv:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case pv:case mv:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case J1:case eb:return Math.max(i,16)*Math.max(e,8)/4;case Q1:case $1:return Math.max(i,8)*Math.max(e,8)/2;case tb:case nb:case rb:case sb:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case ib:case ab:case ob:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case lb:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case ub:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case cb:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case fb:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case hb:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case db:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case pb:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case mb:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case gb:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case vb:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case yb:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case xb:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case _b:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case bb:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case Sb:case Mb:case wb:return Math.ceil(i/4)*Math.ceil(e/4)*16;case Tb:case Eb:return Math.ceil(i/4)*Math.ceil(e/4)*8;case Ab:case Cb:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function o7(i){switch(i){case is:case Qb:return{byteLength:1,components:1};case Fm:case Jb:case ar:return{byteLength:2,components:1};case $b:case eS:return{byteLength:2,components:4};case po:case uy:case Gi:return{byteLength:4,components:1};case wA:case TA:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${i}.`)}class l7{static contain(e,t){return r7(e,t)}static cover(e,t){return s7(e,t)}static fill(e){return a7(e)}static getByteLength(e,t,n,r){return eE(e,t,n,r)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Zm}}));typeof window<"u"&&(window.__THREE__?Ft("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Zm);/** * @license * Copyright 2010-2026 Three.js Authors * SPDX-License-Identifier: MIT */function p4(){let i=null,e=!1,t=null,n=null;function r(s,a){t(s,a),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function u7(i){const e=new WeakMap;function t(l,c){const h=l.array,p=l.usage,g=h.byteLength,v=i.createBuffer();i.bindBuffer(c,v),i.bufferData(c,h,p),l.onUploadCallback();let x;if(h instanceof Float32Array)x=i.FLOAT;else if(typeof Float16Array<"u"&&h instanceof Float16Array)x=i.HALF_FLOAT;else if(h instanceof Uint16Array)l.isFloat16BufferAttribute?x=i.HALF_FLOAT:x=i.UNSIGNED_SHORT;else if(h instanceof Int16Array)x=i.SHORT;else if(h instanceof Uint32Array)x=i.UNSIGNED_INT;else if(h instanceof Int32Array)x=i.INT;else if(h instanceof Int8Array)x=i.BYTE;else if(h instanceof Uint8Array)x=i.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)x=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:v,type:x,bytesPerElement:h.BYTES_PER_ELEMENT,version:l.version,size:g}}function n(l,c,h){const p=c.array,g=c.updateRanges;if(i.bindBuffer(h,l),g.length===0)i.bufferSubData(h,0,p);else{g.sort((x,b)=>x.start-b.start);let v=0;for(let x=1;x 0 vec4 plane; #ifdef ALPHA_TO_COVERAGE float distanceToPlane, distanceGradient; float clipOpacity = 1.0; #pragma unroll_loop_start for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; distanceGradient = fwidth( distanceToPlane ) / 2.0; clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); if ( clipOpacity == 0.0 ) discard; } #pragma unroll_loop_end #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES float unionClipOpacity = 1.0; #pragma unroll_loop_start for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; distanceGradient = fwidth( distanceToPlane ) / 2.0; unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); } #pragma unroll_loop_end clipOpacity *= 1.0 - unionClipOpacity; #endif diffuseColor.a *= clipOpacity; if ( diffuseColor.a == 0.0 ) discard; #else #pragma unroll_loop_start for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; } #pragma unroll_loop_end #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES bool clipped = true; #pragma unroll_loop_start for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; } #pragma unroll_loop_end if ( clipped ) discard; #endif #endif #endif`,E7=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`,A7=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; #endif`,C7=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; #endif`,R7=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #endif`,D7=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) varying vec4 vColor; #endif`,N7=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) varying vec4 vColor; #endif`,U7=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) vColor = vec4( 1.0 ); #endif #ifdef USE_COLOR_ALPHA vColor *= color; #elif defined( USE_COLOR ) vColor.rgb *= color; #endif #ifdef USE_INSTANCING_COLOR vColor.rgb *= instanceColor.rgb; #endif #ifdef USE_BATCHING_COLOR vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) ); #endif`,L7=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 #define RECIPROCAL_PI2 0.15915494309189535 #define EPSILON 1e-6 #ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif #define whiteComplement( a ) ( 1.0 - saturate( a ) ) float pow2( const in float x ) { return x*x; } vec3 pow2( const in vec3 x ) { return x*x; } float pow3( const in float x ) { return x*x*x; } float pow4( const in float x ) { float x2 = x*x; return x2*x2; } float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } highp float rand( const in vec2 uv ) { const highp float a = 12.9898, b = 78.233, c = 43758.5453; highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); return fract( sin( sn ) * c ); } #ifdef HIGH_PRECISION float precisionSafeLength( vec3 v ) { return length( v ); } #else float precisionSafeLength( vec3 v ) { float maxComponent = max3( abs( v ) ); return length( v / maxComponent ) * maxComponent; } #endif struct IncidentLight { vec3 color; vec3 direction; bool visible; }; struct ReflectedLight { vec3 directDiffuse; vec3 directSpecular; vec3 indirectDiffuse; vec3 indirectSpecular; }; #ifdef USE_ALPHAHASH varying vec3 vPosition; #endif vec3 transformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); } bool isPerspectiveMatrix( mat4 m ) { return m[ 2 ][ 3 ] == - 1.0; } vec2 equirectUv( in vec3 dir ) { float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; return vec2( u, v ); } vec3 BRDF_Lambert( const in vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor; } vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); } float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); } // validated`,I7=`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_minMipLevel 4.0 #define cubeUV_minTileSize 16.0 float getFace( vec3 direction ) { vec3 absDirection = abs( direction ); float face = - 1.0; if ( absDirection.x > absDirection.z ) { if ( absDirection.x > absDirection.y ) face = direction.x > 0.0 ? 0.0 : 3.0; else face = direction.y > 0.0 ? 1.0 : 4.0; } else { if ( absDirection.z > absDirection.y ) face = direction.z > 0.0 ? 2.0 : 5.0; else face = direction.y > 0.0 ? 1.0 : 4.0; } return face; } vec2 getUV( vec3 direction, float face ) { vec2 uv; if ( face == 0.0 ) { uv = vec2( direction.z, direction.y ) / abs( direction.x ); } else if ( face == 1.0 ) { uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); } else if ( face == 2.0 ) { uv = vec2( - direction.x, direction.y ) / abs( direction.z ); } else if ( face == 3.0 ) { uv = vec2( - direction.z, direction.y ) / abs( direction.x ); } else if ( face == 4.0 ) { uv = vec2( - direction.x, direction.z ) / abs( direction.y ); } else { uv = vec2( direction.x, direction.y ) / abs( direction.z ); } return 0.5 * ( uv + 1.0 ); } vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { float face = getFace( direction ); float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); mipInt = max( mipInt, cubeUV_minMipLevel ); float faceSize = exp2( mipInt ); highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; if ( face > 2.0 ) { uv.y += faceSize; face -= 3.0; } uv.x += face * faceSize; uv.x += filterInt * 3.0 * cubeUV_minTileSize; uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); uv.x *= CUBEUV_TEXEL_WIDTH; uv.y *= CUBEUV_TEXEL_HEIGHT; #ifdef texture2DGradEXT return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; #else return texture2D( envMap, uv ).rgb; #endif } #define cubeUV_r0 1.0 #define cubeUV_m0 - 2.0 #define cubeUV_r1 0.8 #define cubeUV_m1 - 1.0 #define cubeUV_r4 0.4 #define cubeUV_m4 2.0 #define cubeUV_r5 0.305 #define cubeUV_m5 3.0 #define cubeUV_r6 0.21 #define cubeUV_m6 4.0 float roughnessToMip( float roughness ) { float mip = 0.0; if ( roughness >= cubeUV_r1 ) { mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; } else if ( roughness >= cubeUV_r4 ) { mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; } else if ( roughness >= cubeUV_r5 ) { mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; } else if ( roughness >= cubeUV_r6 ) { mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; } else { mip = - 2.0 * log2( 1.16 * roughness ); } return mip; } vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); float mipF = fract( mip ); float mipInt = floor( mip ); vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); if ( mipF == 0.0 ) { return vec4( color0, 1.0 ); } else { vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); return vec4( mix( color0, color1, mipF ), 1.0 ); } } #endif`,P7=`vec3 transformedNormal = objectNormal; #ifdef USE_TANGENT vec3 transformedTangent = objectTangent; #endif #ifdef USE_BATCHING mat3 bm = mat3( batchingMatrix ); transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); transformedNormal = bm * transformedNormal; #ifdef USE_TANGENT transformedTangent = bm * transformedTangent; #endif #endif #ifdef USE_INSTANCING mat3 im = mat3( instanceMatrix ); transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); transformedNormal = im * transformedNormal; #ifdef USE_TANGENT transformedTangent = im * transformedTangent; #endif #endif transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedNormal = - transformedNormal; #endif #ifdef USE_TANGENT transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif #endif`,O7=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; #endif`,F7=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); #endif`,k7=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE emissiveColor = sRGBTransferEOTF( emissiveColor ); #endif totalEmissiveRadiance *= emissiveColor.rgb; #endif`,z7=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; #endif`,B7="gl_FragColor = linearToOutputTexel( gl_FragColor );",V7=`vec4 LinearTransferOETF( in vec4 value ) { return value; } vec4 sRGBTransferEOTF( in vec4 value ) { return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); } vec4 sRGBTransferOETF( in vec4 value ) { return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); }`,G7=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); } else { cameraToFrag = normalize( vWorldPosition - cameraPosition ); } vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); #ifdef ENVMAP_MODE_REFLECTION vec3 reflectVec = reflect( cameraToFrag, worldNormal ); #else vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); #endif #else vec3 reflectVec = vReflect; #endif #ifdef ENVMAP_TYPE_CUBE vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); #ifdef ENVMAP_BLENDING_MULTIPLY outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); #elif defined( ENVMAP_BLENDING_MIX ) outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif #endif #endif`,H7=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; uniform mat3 envMapRotation; #ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #else uniform sampler2D envMap; #endif #endif`,W7=`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif #ifdef ENV_WORLDPOS varying vec3 vWorldPosition; uniform float refractionRatio; #else varying vec3 vReflect; #endif #endif`,j7=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif #ifdef ENV_WORLDPOS varying vec3 vWorldPosition; #else varying vec3 vReflect; uniform float refractionRatio; #endif #endif`,X7=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else vec3 cameraToVertex; if ( isOrthographic ) { cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); } else { cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); } vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); #ifdef ENVMAP_MODE_REFLECTION vReflect = reflect( cameraToVertex, worldNormal ); #else vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif #endif`,Y7=`#ifdef USE_FOG vFogDepth = - mvPosition.z; #endif`,q7=`#ifdef USE_FOG varying float vFogDepth; #endif`,Z7=`#ifdef USE_FOG #ifdef FOG_EXP2 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); #else float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); #endif gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); #endif`,K7=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 uniform float fogDensity; #else uniform float fogNear; uniform float fogFar; #endif #endif`,Q7=`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { float dotNL = dot( normal, lightDirection ); vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); #ifdef USE_GRADIENTMAP return vec3( texture2D( gradientMap, coord ).r ); #else vec2 fw = fwidth( coord ) * 0.5; return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); #endif }`,J7=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; #endif`,$7=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularStrength = specularStrength;`,eW=`varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; }; void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Lambert #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,tW=`uniform bool receiveShadow; uniform vec3 ambientLightColor; #if defined( USE_LIGHT_PROBES ) uniform vec3 lightProbe[ 9 ]; #endif vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { float x = normal.x, y = normal.y, z = normal.z; vec3 result = shCoefficients[ 0 ] * 0.886227; result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); return result; } vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); return irradiance; } vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { vec3 irradiance = ambientLightColor; return irradiance; } float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); if ( cutoffDistance > 0.0 ) { distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); } return distanceFalloff; } float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { return smoothstep( coneCosine, penumbraCosine, angleCosine ); } #if NUM_DIR_LIGHTS > 0 struct DirectionalLight { vec3 direction; vec3 color; }; uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { light.color = directionalLight.color; light.direction = directionalLight.direction; light.visible = true; } #endif #if NUM_POINT_LIGHTS > 0 struct PointLight { vec3 position; vec3 color; float distance; float decay; }; uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { vec3 lVector = pointLight.position - geometryPosition; light.direction = normalize( lVector ); float lightDistance = length( lVector ); light.color = pointLight.color; light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); light.visible = ( light.color != vec3( 0.0 ) ); } #endif #if NUM_SPOT_LIGHTS > 0 struct SpotLight { vec3 position; vec3 direction; vec3 color; float distance; float decay; float coneCos; float penumbraCos; }; uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { vec3 lVector = spotLight.position - geometryPosition; light.direction = normalize( lVector ); float angleCos = dot( light.direction, spotLight.direction ); float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); if ( spotAttenuation > 0.0 ) { float lightDistance = length( lVector ); light.color = spotLight.color * spotAttenuation; light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); light.visible = ( light.color != vec3( 0.0 ) ); } else { light.color = vec3( 0.0 ); light.visible = false; } } #endif #if NUM_RECT_AREA_LIGHTS > 0 struct RectAreaLight { vec3 color; vec3 position; vec3 halfWidth; vec3 halfHeight; }; uniform sampler2D ltc_1; uniform sampler2D ltc_2; uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; #endif #if NUM_HEMI_LIGHTS > 0 struct HemisphereLight { vec3 direction; vec3 skyColor; vec3 groundColor; }; uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { float dotNL = dot( normal, hemiLight.direction ); float hemiDiffuseWeight = 0.5 * dotNL + 0.5; vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); return irradiance; } #endif`,nW=`#ifdef USE_ENVMAP vec3 getIBLIrradiance( const in vec3 normal ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); return PI * envMapColor.rgb * envMapIntensity; #else return vec3( 0.0 ); #endif } vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 reflectVec = reflect( - viewDir, normal ); reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) ); reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); return envMapColor.rgb * envMapIntensity; #else return vec3( 0.0 ); #endif } #ifdef USE_ANISOTROPY vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 bentNormal = cross( bitangent, viewDir ); bentNormal = normalize( cross( bentNormal, bitangent ) ); bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); return getIBLRadiance( viewDir, bentNormal, roughness ); #else return vec3( 0.0 ); #endif } #endif #endif`,iW=`ToonMaterial material; material.diffuseColor = diffuseColor.rgb;`,rW=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,sW=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; material.specularStrength = specularStrength;`,aW=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; float specularShininess; float specularStrength; }; void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; } void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,oW=`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb; material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); material.metalness = metalnessFactor; vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; material.roughness = min( material.roughness, 1.0 ); #ifdef IOR material.ior = ior; #ifdef USE_SPECULAR float specularIntensityFactor = specularIntensity; vec3 specularColorFactor = specularColor; #ifdef USE_SPECULAR_COLORMAP specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; #endif #ifdef USE_SPECULAR_INTENSITYMAP specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; #endif material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); #else float specularIntensityFactor = 1.0; vec3 specularColorFactor = vec3( 1.0 ); material.specularF90 = 1.0; #endif material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor; material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); #else material.specularColor = vec3( 0.04 ); material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); material.specularF90 = 1.0; #endif #ifdef USE_CLEARCOAT material.clearcoat = clearcoat; material.clearcoatRoughness = clearcoatRoughness; material.clearcoatF0 = vec3( 0.04 ); material.clearcoatF90 = 1.0; #ifdef USE_CLEARCOATMAP material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; #endif material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); material.clearcoatRoughness += geometryRoughness; material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); #endif #ifdef USE_DISPERSION material.dispersion = dispersion; #endif #ifdef USE_IRIDESCENCE material.iridescence = iridescence; material.iridescenceIOR = iridescenceIOR; #ifdef USE_IRIDESCENCEMAP material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; #else material.iridescenceThickness = iridescenceThicknessMaximum; #endif #endif #ifdef USE_SHEEN material.sheenColor = sheenColor; #ifdef USE_SHEEN_COLORMAP material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; #endif material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 ); #ifdef USE_SHEEN_ROUGHNESSMAP material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; #endif #endif #ifdef USE_ANISOTROPY #ifdef USE_ANISOTROPYMAP mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; #else vec2 anisotropyV = anisotropyVector; #endif material.anisotropy = length( anisotropyV ); if( material.anisotropy == 0.0 ) { anisotropyV = vec2( 1.0, 0.0 ); } else { anisotropyV /= material.anisotropy; material.anisotropy = saturate( material.anisotropy ); } material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; #endif`,lW=`uniform sampler2D dfgLUT; struct PhysicalMaterial { vec3 diffuseColor; vec3 diffuseContribution; vec3 specularColor; vec3 specularColorBlended; float roughness; float metalness; float specularF90; float dispersion; #ifdef USE_CLEARCOAT float clearcoat; float clearcoatRoughness; vec3 clearcoatF0; float clearcoatF90; #endif #ifdef USE_IRIDESCENCE float iridescence; float iridescenceIOR; float iridescenceThickness; vec3 iridescenceFresnel; vec3 iridescenceF0; vec3 iridescenceFresnelDielectric; vec3 iridescenceFresnelMetallic; #endif #ifdef USE_SHEEN vec3 sheenColor; float sheenRoughness; #endif #ifdef IOR float ior; #endif #ifdef USE_TRANSMISSION float transmission; float transmissionAlpha; float thickness; float attenuationDistance; vec3 attenuationColor; #endif #ifdef USE_ANISOTROPY float anisotropy; float alphaT; vec3 anisotropyT; vec3 anisotropyB; #endif }; vec3 clearcoatSpecularDirect = vec3( 0.0 ); vec3 clearcoatSpecularIndirect = vec3( 0.0 ); vec3 sheenSpecularDirect = vec3( 0.0 ); vec3 sheenSpecularIndirect = vec3(0.0 ); vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); float x2 = x * x; float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); } float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { float a2 = pow2( alpha ); float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); return 0.5 / max( gv + gl, EPSILON ); } float D_GGX( const in float alpha, const in float dotNH ) { float a2 = pow2( alpha ); float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; return RECIPROCAL_PI * a2 / pow2( denom ); } #ifdef USE_ANISOTROPY float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); float v = 0.5 / ( gv + gl ); return v; } float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { float a2 = alphaT * alphaB; highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); highp float v2 = dot( v, v ); float w2 = a2 / v2; return RECIPROCAL_PI * a2 * pow2 ( w2 ); } #endif #ifdef USE_CLEARCOAT vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { vec3 f0 = material.clearcoatF0; float f90 = material.clearcoatF90; float roughness = material.clearcoatRoughness; float alpha = pow2( roughness ); vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float dotVH = saturate( dot( viewDir, halfDir ) ); vec3 F = F_Schlick( f0, f90, dotVH ); float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); float D = D_GGX( alpha, dotNH ); return F * ( V * D ); } #endif vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { vec3 f0 = material.specularColorBlended; float f90 = material.specularF90; float roughness = material.roughness; float alpha = pow2( roughness ); vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float dotVH = saturate( dot( viewDir, halfDir ) ); vec3 F = F_Schlick( f0, f90, dotVH ); #ifdef USE_IRIDESCENCE F = mix( F, material.iridescenceFresnel, material.iridescence ); #endif #ifdef USE_ANISOTROPY float dotTL = dot( material.anisotropyT, lightDir ); float dotTV = dot( material.anisotropyT, viewDir ); float dotTH = dot( material.anisotropyT, halfDir ); float dotBL = dot( material.anisotropyB, lightDir ); float dotBV = dot( material.anisotropyB, viewDir ); float dotBH = dot( material.anisotropyB, halfDir ); float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); #else float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); float D = D_GGX( alpha, dotNH ); #endif return F * ( V * D ); } vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { const float LUT_SIZE = 64.0; const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; const float LUT_BIAS = 0.5 / LUT_SIZE; float dotNV = saturate( dot( N, V ) ); vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); uv = uv * LUT_SCALE + LUT_BIAS; return uv; } float LTC_ClippedSphereFormFactor( const in vec3 f ) { float l = length( f ); return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); } vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { float x = dot( v1, v2 ); float y = abs( x ); float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; float b = 3.4175940 + ( 4.1616724 + y ) * y; float v = a / b; float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; return cross( v1, v2 ) * theta_sintheta; } vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; vec3 lightNormal = cross( v1, v2 ); if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); vec3 T1, T2; T1 = normalize( V - N * dot( V, N ) ); T2 = - cross( N, T1 ); mat3 mat = mInv * transpose( mat3( T1, T2, N ) ); vec3 coords[ 4 ]; coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); coords[ 0 ] = normalize( coords[ 0 ] ); coords[ 1 ] = normalize( coords[ 1 ] ); coords[ 2 ] = normalize( coords[ 2 ] ); coords[ 3 ] = normalize( coords[ 3 ] ); vec3 vectorFormFactor = vec3( 0.0 ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); return vec3( result ); } #if defined( USE_SHEEN ) float D_Charlie( float roughness, float dotNH ) { float alpha = pow2( roughness ); float invAlpha = 1.0 / alpha; float cos2h = dotNH * dotNH; float sin2h = max( 1.0 - cos2h, 0.0078125 ); return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); } float V_Neubelt( float dotNV, float dotNL ) { return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); } vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float D = D_Charlie( sheenRoughness, dotNH ); float V = V_Neubelt( dotNV, dotNL ); return sheenColor * ( D * V ); } #endif float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { float dotNV = saturate( dot( normal, viewDir ) ); float r2 = roughness * roughness; float rInv = 1.0 / ( roughness + 0.1 ); float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv; float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv; float DG = exp( a * dotNV + b ); return saturate( DG ); } vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { float dotNV = saturate( dot( normal, viewDir ) ); vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; return specularColor * fab.x + specularF90 * fab.y; } #ifdef USE_IRIDESCENCE void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { #else void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { #endif float dotNV = saturate( dot( normal, viewDir ) ); vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; #ifdef USE_IRIDESCENCE vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); #else vec3 Fr = specularColor; #endif vec3 FssEss = Fr * fab.x + specularF90 * fab.y; float Ess = fab.x + fab.y; float Ems = 1.0 - Ess; vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); singleScatter += FssEss; multiScatter += Fms * Ems; } vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg; vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg; vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y; vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y; float Ess_V = dfgV.x + dfgV.y; float Ess_L = dfgL.x + dfgL.y; float Ems_V = 1.0 - Ess_V; float Ems_L = 1.0 - Ess_L; vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON ); float compensationFactor = Ems_V * Ems_L; vec3 multiScatter = Fms * compensationFactor; return singleScatter + multiScatter; } #if NUM_RECT_AREA_LIGHTS > 0 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { vec3 normal = geometryNormal; vec3 viewDir = geometryViewDir; vec3 position = geometryPosition; vec3 lightPos = rectAreaLight.position; vec3 halfWidth = rectAreaLight.halfWidth; vec3 halfHeight = rectAreaLight.halfHeight; vec3 lightColor = rectAreaLight.color; float roughness = material.roughness; vec3 rectCoords[ 4 ]; rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; vec2 uv = LTC_Uv( normal, viewDir, roughness ); vec4 t1 = texture2D( ltc_1, uv ); vec4 t2 = texture2D( ltc_2, uv ); mat3 mInv = mat3( vec3( t1.x, 0, t1.y ), vec3( 0, 1, 0 ), vec3( t1.z, 0, t1.w ) ); vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y ); reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); #ifdef USE_CLEARCOAT vec3 Ncc = geometryClearcoatNormal; vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness ); vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat ); vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat ); mat3 mInvClearcoat = mat3( vec3( t1Clearcoat.x, 0, t1Clearcoat.y ), vec3( 0, 1, 0 ), vec3( t1Clearcoat.z, 0, t1Clearcoat.w ) ); vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y; clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords ); #endif } #endif void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; #ifdef USE_CLEARCOAT float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); vec3 ccIrradiance = dotNLcc * directLight.color; clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); #endif #ifdef USE_SHEEN sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness ); float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL ); irradiance *= sheenEnergyComp; #endif reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material ); reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ); } void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ); #ifdef USE_SHEEN float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; diffuse *= sheenEnergyComp; #endif reflectedLight.indirectDiffuse += diffuse; } void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { #ifdef USE_CLEARCOAT clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); #endif #ifdef USE_SHEEN sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI; #endif vec3 singleScatteringDielectric = vec3( 0.0 ); vec3 multiScatteringDielectric = vec3( 0.0 ); vec3 singleScatteringMetallic = vec3( 0.0 ); vec3 multiScatteringMetallic = vec3( 0.0 ); #ifdef USE_IRIDESCENCE computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); #else computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); #endif vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness ); vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness ); vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric; vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric ); vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; vec3 indirectSpecular = radiance * singleScattering; indirectSpecular += multiScattering * cosineWeightedIrradiance; vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance; #ifdef USE_SHEEN float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; indirectSpecular *= sheenEnergyComp; indirectDiffuse *= sheenEnergyComp; #endif reflectedLight.indirectSpecular += indirectSpecular; reflectedLight.indirectDiffuse += indirectDiffuse; } #define RE_Direct RE_Direct_Physical #define RE_Direct_RectArea RE_Direct_RectArea_Physical #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical #define RE_IndirectSpecular RE_IndirectSpecular_Physical float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); }`,uW=` vec3 geometryPosition = - vViewPosition; vec3 geometryNormal = normal; vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); vec3 geometryClearcoatNormal = vec3( 0.0 ); #ifdef USE_CLEARCOAT geometryClearcoatNormal = clearcoatNormal; #endif #ifdef USE_IRIDESCENCE float dotNVi = saturate( dot( normal, geometryViewDir ) ); if ( material.iridescenceThickness == 0.0 ) { material.iridescence = 0.0; } else { material.iridescence = saturate( material.iridescence ); } if ( material.iridescence > 0.0 ) { material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor ); material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness ); material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); } #endif IncidentLight directLight; #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) PointLight pointLight; #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 PointLightShadow pointLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { pointLight = pointLights[ i ]; getPointLightInfo( pointLight, geometryPosition, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) pointLightShadow = pointLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) SpotLight spotLight; vec4 spotColor; vec3 spotLightCoord; bool inSpotLightMap; #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 SpotLightShadow spotLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { spotLight = spotLights[ i ]; getSpotLightInfo( spotLight, geometryPosition, directLight ); #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS #else #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) #endif #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; #endif #undef SPOT_LIGHT_MAP_INDEX #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) spotLightShadow = spotLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) DirectionalLight directionalLight; #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 DirectionalLightShadow directionalLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { directionalLight = directionalLights[ i ]; getDirectionalLightInfo( directionalLight, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) directionalLightShadow = directionalLightShadows[ i ]; directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) RectAreaLight rectAreaLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { rectAreaLight = rectAreaLights[ i ]; RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); } #pragma unroll_loop_end #endif #if defined( RE_IndirectDiffuse ) vec3 iblIrradiance = vec3( 0.0 ); vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); #if defined( USE_LIGHT_PROBES ) irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); #endif #if ( NUM_HEMI_LIGHTS > 0 ) #pragma unroll_loop_start for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); } #pragma unroll_loop_end #endif #endif #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); #endif`,cW=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; irradiance += lightMapIrradiance; #endif #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV ) #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG ) iblIrradiance += getIBLIrradiance( geometryNormal ); #endif #endif #endif #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) #ifdef USE_ANISOTROPY radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); #else radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); #endif #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); #endif #endif`,fW=`#if defined( RE_IndirectDiffuse ) #if defined( LAMBERT ) || defined( PHONG ) irradiance += iblIrradiance; #endif RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif`,hW=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; #endif`,dW=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; #endif`,pW=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER varying float vFragDepth; varying float vIsPerspective; #endif`,mW=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); #endif`,gW=`#ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vMapUv ); #ifdef DECODE_VIDEO_TEXTURE sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); #endif diffuseColor *= sampledDiffuseColor; #endif`,vW=`#ifdef USE_MAP uniform sampler2D map; #endif`,yW=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) #if defined( USE_POINTS_UV ) vec2 uv = vUv; #else vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; #endif #endif #ifdef USE_MAP diffuseColor *= texture2D( map, uv ); #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; #endif`,xW=`#if defined( USE_POINTS_UV ) varying vec2 vUv; #else #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) uniform mat3 uvTransform; #endif #endif #ifdef USE_MAP uniform sampler2D map; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; #endif`,_W=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; #endif`,bW=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; #endif`,SW=`#ifdef USE_INSTANCING_MORPH float morphTargetInfluences[ MORPHTARGETS_COUNT ]; float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; } #endif`,MW=`#if defined( USE_MORPHCOLORS ) vColor *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { #if defined( USE_COLOR_ALPHA ) if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; #elif defined( USE_COLOR ) if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } #endif`,wW=`#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; } #endif`,TW=`#ifdef USE_MORPHTARGETS #ifndef USE_INSTANCING_MORPH uniform float morphTargetBaseInfluence; uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; #endif uniform sampler2DArray morphTargetsTexture; uniform ivec2 morphTargetsTextureSize; vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; int y = texelIndex / morphTargetsTextureSize.x; int x = texelIndex - y * morphTargetsTextureSize.x; ivec3 morphUV = ivec3( x, y, morphTargetIndex ); return texelFetch( morphTargetsTexture, morphUV, 0 ); } #endif`,EW=`#ifdef USE_MORPHTARGETS transformed *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; } #endif`,AW=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = dFdx( vViewPosition ); vec3 fdy = dFdy( vViewPosition ); vec3 normal = normalize( cross( fdx, fdy ) ); #else vec3 normal = normalize( vNormal ); #ifdef DOUBLE_SIDED normal *= faceDirection; #endif #endif #if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) #ifdef USE_TANGENT mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); #else mat3 tbn = getTangentFrame( - vViewPosition, normal, #if defined( USE_NORMALMAP ) vNormalMapUv #elif defined( USE_CLEARCOAT_NORMALMAP ) vClearcoatNormalMapUv #else vUv #endif ); #endif #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) tbn[0] *= faceDirection; tbn[1] *= faceDirection; #endif #endif #ifdef USE_CLEARCOAT_NORMALMAP #ifdef USE_TANGENT mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); #else mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); #endif #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) tbn2[0] *= faceDirection; tbn2[1] *= faceDirection; #endif #endif vec3 nonPerturbedNormal = normal;`,CW=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; #endif #ifdef DOUBLE_SIDED normal = normal * faceDirection; #endif normal = normalize( normalMatrix * normal ); #elif defined( USE_NORMALMAP_TANGENTSPACE ) vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; mapN.xy *= normalScale; normal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); #endif`,RW=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,DW=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,NW=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif #endif`,UW=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif #ifdef USE_NORMALMAP_OBJECTSPACE uniform mat3 normalMatrix; #endif #if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { vec3 q0 = dFdx( eye_pos.xyz ); vec3 q1 = dFdy( eye_pos.xyz ); vec2 st0 = dFdx( uv.st ); vec2 st1 = dFdy( uv.st ); vec3 N = surf_norm; vec3 q1perp = cross( q1, N ); vec3 q0perp = cross( N, q0 ); vec3 T = q1perp * st0.x + q0perp * st1.x; vec3 B = q1perp * st0.y + q0perp * st1.y; float det = max( dot( T, T ), dot( B, B ) ); float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); return mat3( T * scale, B * scale, N ); } #endif`,LW=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = nonPerturbedNormal; #endif`,IW=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); #endif`,PW=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP uniform sampler2D clearcoatNormalMap; uniform vec2 clearcoatNormalScale; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; #endif`,OW=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; #endif`,FW=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,kW=`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { return 2.0 * rgb.xyz - 1.0; } const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; const float Inv255 = 1. / 255.; const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); vec4 packDepthToRGBA( const in float v ) { if( v <= 0.0 ) return vec4( 0., 0., 0., 0. ); if( v >= 1.0 ) return vec4( 1., 1., 1., 1. ); float vuf; float af = modf( v * PackFactors.a, vuf ); float bf = modf( vuf * ShiftRight8, vuf ); float gf = modf( vuf * ShiftRight8, vuf ); return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); } vec3 packDepthToRGB( const in float v ) { if( v <= 0.0 ) return vec3( 0., 0., 0. ); if( v >= 1.0 ) return vec3( 1., 1., 1. ); float vuf; float bf = modf( v * PackFactors.b, vuf ); float gf = modf( vuf * ShiftRight8, vuf ); return vec3( vuf * Inv255, gf * PackUpscale, bf ); } vec2 packDepthToRG( const in float v ) { if( v <= 0.0 ) return vec2( 0., 0. ); if( v >= 1.0 ) return vec2( 1., 1. ); float vuf; float gf = modf( v * 256., vuf ); return vec2( vuf * Inv255, gf ); } float unpackRGBAToDepth( const in vec4 v ) { return dot( v, UnpackFactors4 ); } float unpackRGBToDepth( const in vec3 v ) { return dot( v, UnpackFactors3 ); } float unpackRGToDepth( const in vec2 v ) { return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; } vec4 pack2HalfToRGBA( const in vec2 v ) { vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); } vec2 unpackRGBATo2Half( const in vec4 v ) { return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); } float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { return ( viewZ + near ) / ( near - far ); } float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { #ifdef USE_REVERSED_DEPTH_BUFFER return depth * ( far - near ) - far; #else return depth * ( near - far ) - near; #endif } float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); } float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { #ifdef USE_REVERSED_DEPTH_BUFFER return ( near * far ) / ( ( near - far ) * depth - near ); #else return ( near * far ) / ( ( far - near ) * depth - far ); #endif }`,zW=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; #endif`,BW=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING mvPosition = batchingMatrix * mvPosition; #endif #ifdef USE_INSTANCING mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; gl_Position = projectionMatrix * mvPosition;`,VW=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); #endif`,GW=`#ifdef DITHERING vec3 dithering( vec3 color ) { float grid_position = rand( gl_FragCoord.xy ); vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); return color + dither_shift_RGB; } #endif`,HW=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; #endif`,WW=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; #endif`,jW=`#if NUM_SPOT_LIGHT_COORDS > 0 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #if NUM_SPOT_LIGHT_MAPS > 0 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; #endif #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 #if defined( SHADOWMAP_TYPE_PCF ) uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; #else uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; #endif varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; struct DirectionalLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 #if defined( SHADOWMAP_TYPE_PCF ) uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; #else uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; #endif struct SpotLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; #endif #if NUM_POINT_LIGHT_SHADOWS > 0 #if defined( SHADOWMAP_TYPE_PCF ) uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; #elif defined( SHADOWMAP_TYPE_BASIC ) uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; #endif varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; struct PointLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif #if defined( SHADOWMAP_TYPE_PCF ) float interleavedGradientNoise( vec2 position ) { return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) ); } vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) { const float goldenAngle = 2.399963229728653; float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) ); float theta = float( sampleIndex ) * goldenAngle + phi; return vec2( cos( theta ), sin( theta ) ) * r; } #endif #if defined( SHADOWMAP_TYPE_PCF ) float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { float shadow = 1.0; shadowCoord.xyz /= shadowCoord.w; shadowCoord.z += shadowBias; bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; bool frustumTest = inFrustum && shadowCoord.z <= 1.0; if ( frustumTest ) { vec2 texelSize = vec2( 1.0 ) / shadowMapSize; float radius = shadowRadius * texelSize.x; float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; shadow = ( texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) ) ) * 0.2; } return mix( 1.0, shadow, shadowIntensity ); } #elif defined( SHADOWMAP_TYPE_VSM ) float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { float shadow = 1.0; shadowCoord.xyz /= shadowCoord.w; #ifdef USE_REVERSED_DEPTH_BUFFER shadowCoord.z -= shadowBias; #else shadowCoord.z += shadowBias; #endif bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; bool frustumTest = inFrustum && shadowCoord.z <= 1.0; if ( frustumTest ) { vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg; float mean = distribution.x; float variance = distribution.y * distribution.y; #ifdef USE_REVERSED_DEPTH_BUFFER float hard_shadow = step( mean, shadowCoord.z ); #else float hard_shadow = step( shadowCoord.z, mean ); #endif if ( hard_shadow == 1.0 ) { shadow = 1.0; } else { variance = max( variance, 0.0000001 ); float d = shadowCoord.z - mean; float p_max = variance / ( variance + d * d ); p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 ); shadow = max( hard_shadow, p_max ); } } return mix( 1.0, shadow, shadowIntensity ); } #else float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { float shadow = 1.0; shadowCoord.xyz /= shadowCoord.w; #ifdef USE_REVERSED_DEPTH_BUFFER shadowCoord.z -= shadowBias; #else shadowCoord.z += shadowBias; #endif bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; bool frustumTest = inFrustum && shadowCoord.z <= 1.0; if ( frustumTest ) { float depth = texture2D( shadowMap, shadowCoord.xy ).r; #ifdef USE_REVERSED_DEPTH_BUFFER shadow = step( depth, shadowCoord.z ); #else shadow = step( shadowCoord.z, depth ); #endif } return mix( 1.0, shadow, shadowIntensity ); } #endif #if NUM_POINT_LIGHT_SHADOWS > 0 #if defined( SHADOWMAP_TYPE_PCF ) float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { float shadow = 1.0; vec3 lightToPosition = shadowCoord.xyz; vec3 bd3D = normalize( lightToPosition ); vec3 absVec = abs( lightToPosition ); float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { #ifdef USE_REVERSED_DEPTH_BUFFER float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); dp -= shadowBias; #else float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); dp += shadowBias; #endif float texelSize = shadowRadius / shadowMapSize.x; vec3 absDir = abs( bd3D ); vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 ); tangent = normalize( cross( bd3D, tangent ) ); vec3 bitangent = cross( bd3D, tangent ); float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; vec2 sample0 = vogelDiskSample( 0, 5, phi ); vec2 sample1 = vogelDiskSample( 1, 5, phi ); vec2 sample2 = vogelDiskSample( 2, 5, phi ); vec2 sample3 = vogelDiskSample( 3, 5, phi ); vec2 sample4 = vogelDiskSample( 4, 5, phi ); shadow = ( texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) + texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) + texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) + texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) + texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) ) ) * 0.2; } return mix( 1.0, shadow, shadowIntensity ); } #elif defined( SHADOWMAP_TYPE_BASIC ) float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { float shadow = 1.0; vec3 lightToPosition = shadowCoord.xyz; vec3 absVec = abs( lightToPosition ); float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); dp += shadowBias; vec3 bd3D = normalize( lightToPosition ); float depth = textureCube( shadowMap, bd3D ).r; #ifdef USE_REVERSED_DEPTH_BUFFER depth = 1.0 - depth; #endif shadow = step( dp, depth ); } return mix( 1.0, shadow, shadowIntensity ); } #endif #endif #endif`,XW=`#if NUM_SPOT_LIGHT_COORDS > 0 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; struct DirectionalLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 struct SpotLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; #endif #if NUM_POINT_LIGHT_SHADOWS > 0 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; struct PointLightShadow { float shadowIntensity; float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif #endif`,YW=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); vec4 shadowWorldPosition; #endif #if defined( USE_SHADOWMAP ) #if NUM_DIR_LIGHT_SHADOWS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif #if NUM_POINT_LIGHT_SHADOWS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif #endif #if NUM_SPOT_LIGHT_COORDS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { shadowWorldPosition = worldPosition; #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; #endif vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif`,qW=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 DirectionalLightShadow directionalLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { directionalLight = directionalLightShadows[ i ]; shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; } #pragma unroll_loop_end #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 SpotLightShadow spotLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { spotLight = spotLightShadows[ i ]; shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; } #pragma unroll_loop_end #endif #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) PointLightShadow pointLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { pointLight = pointLightShadows[ i ]; shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; } #pragma unroll_loop_end #endif #endif return shadow; }`,ZW=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); #endif`,KW=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; mat4 getBoneMatrix( const in float i ) { int size = textureSize( boneTexture, 0 ).x; int j = int( i ) * 4; int x = j % size; int y = j / size; vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); return mat4( v1, v2, v3, v4 ); } #endif`,QW=`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; skinned += boneMatY * skinVertex * skinWeight.y; skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; #endif`,JW=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; skinMatrix += skinWeight.z * boneMatZ; skinMatrix += skinWeight.w * boneMatW; skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif #endif`,$W=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; #endif`,ej=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; #endif`,tj=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); #endif`,nj=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; vec3 LinearToneMapping( vec3 color ) { return saturate( toneMappingExposure * color ); } vec3 ReinhardToneMapping( vec3 color ) { color *= toneMappingExposure; return saturate( color / ( vec3( 1.0 ) + color ) ); } vec3 CineonToneMapping( vec3 color ) { color *= toneMappingExposure; color = max( vec3( 0.0 ), color - 0.004 ); return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); } vec3 RRTAndODTFit( vec3 v ) { vec3 a = v * ( v + 0.0245786 ) - 0.000090537; vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; return a / b; } vec3 ACESFilmicToneMapping( vec3 color ) { const mat3 ACESInputMat = mat3( vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), vec3( 0.04823, 0.01566, 0.83777 ) ); const mat3 ACESOutputMat = mat3( vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), vec3( -0.07367, -0.00605, 1.07602 ) ); color *= toneMappingExposure / 0.6; color = ACESInputMat * color; color = RRTAndODTFit( color ); color = ACESOutputMat * color; return saturate( color ); } const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( vec3( 1.6605, - 0.1246, - 0.0182 ), vec3( - 0.5876, 1.1329, - 0.1006 ), vec3( - 0.0728, - 0.0083, 1.1187 ) ); const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( vec3( 0.6274, 0.0691, 0.0164 ), vec3( 0.3293, 0.9195, 0.0880 ), vec3( 0.0433, 0.0113, 0.8956 ) ); vec3 agxDefaultContrastApprox( vec3 x ) { vec3 x2 = x * x; vec3 x4 = x2 * x2; return + 15.5 * x4 * x2 - 40.14 * x4 * x + 31.96 * x4 - 6.868 * x2 * x + 0.4298 * x2 + 0.1191 * x - 0.00232; } vec3 AgXToneMapping( vec3 color ) { const mat3 AgXInsetMatrix = mat3( vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) ); const mat3 AgXOutsetMatrix = mat3( vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) ); const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; color *= toneMappingExposure; color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; color = AgXInsetMatrix * color; color = max( color, 1e-10 ); color = log2( color ); color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); color = clamp( color, 0.0, 1.0 ); color = agxDefaultContrastApprox( color ); color = AgXOutsetMatrix * color; color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); color = LINEAR_REC2020_TO_LINEAR_SRGB * color; color = clamp( color, 0.0, 1.0 ); return color; } vec3 NeutralToneMapping( vec3 color ) { const float StartCompression = 0.8 - 0.04; const float Desaturation = 0.15; color *= toneMappingExposure; float x = min( color.r, min( color.g, color.b ) ); float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; color -= offset; float peak = max( color.r, max( color.g, color.b ) ); if ( peak < StartCompression ) return color; float d = 1. - StartCompression; float newPeak = 1. - d * d / ( peak + d - StartCompression ); color *= newPeak / peak; float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); return mix( color, vec3( newPeak ), g ); } vec3 CustomToneMapping( vec3 color ) { return color; }`,ij=`#ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; material.attenuationDistance = attenuationDistance; material.attenuationColor = attenuationColor; #ifdef USE_TRANSMISSIONMAP material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; #endif #ifdef USE_THICKNESSMAP material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; #endif vec3 pos = vWorldPosition; vec3 v = normalize( cameraPosition - pos ); vec3 n = inverseTransformDirection( normal, viewMatrix ); vec4 transmitted = getIBLVolumeRefraction( n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90, pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); #endif`,rj=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; uniform vec3 attenuationColor; #ifdef USE_TRANSMISSIONMAP uniform sampler2D transmissionMap; #endif #ifdef USE_THICKNESSMAP uniform sampler2D thicknessMap; #endif uniform vec2 transmissionSamplerSize; uniform sampler2D transmissionSamplerMap; uniform mat4 modelMatrix; uniform mat4 projectionMatrix; varying vec3 vWorldPosition; float w0( float a ) { return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); } float w1( float a ) { return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); } float w2( float a ){ return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); } float w3( float a ) { return ( 1.0 / 6.0 ) * ( a * a * a ); } float g0( float a ) { return w0( a ) + w1( a ); } float g1( float a ) { return w2( a ) + w3( a ); } float h0( float a ) { return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); } float h1( float a ) { return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); } vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { uv = uv * texelSize.zw + 0.5; vec2 iuv = floor( uv ); vec2 fuv = fract( uv ); float g0x = g0( fuv.x ); float g1x = g1( fuv.x ); float h0x = h0( fuv.x ); float h1x = h1( fuv.x ); float h0y = h0( fuv.y ); float h1y = h1( fuv.y ); vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); } vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); vec2 fLodSizeInv = 1.0 / fLodSize; vec2 cLodSizeInv = 1.0 / cLodSize; vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); return mix( fSample, cSample, fract( lod ) ); } vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); vec3 modelScale; modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); return normalize( refractionVector ) * thickness * modelScale; } float applyIorToRoughness( const in float roughness, const in float ior ) { return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); } vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); } vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { if ( isinf( attenuationDistance ) ) { return vec3( 1.0 ); } else { vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; } } vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, const in vec3 attenuationColor, const in float attenuationDistance ) { vec4 transmittedLight; vec3 transmittance; #ifdef USE_DISPERSION float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); for ( int i = 0; i < 3; i ++ ) { vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); vec3 refractedRayExit = position + transmissionRay; vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); vec2 refractionCoords = ndcPos.xy / ndcPos.w; refractionCoords += 1.0; refractionCoords /= 2.0; vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); transmittedLight[ i ] = transmissionSample[ i ]; transmittedLight.a += transmissionSample.a; transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; } transmittedLight.a /= 3.0; #else vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); vec3 refractedRayExit = position + transmissionRay; vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); vec2 refractionCoords = ndcPos.xy / ndcPos.w; refractionCoords += 1.0; refractionCoords /= 2.0; transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); #endif vec3 attenuatedColor = transmittance * transmittedLight.rgb; vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); } #endif`,sj=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP varying vec2 vMapUv; #endif #ifdef USE_ALPHAMAP varying vec2 vAlphaMapUv; #endif #ifdef USE_LIGHTMAP varying vec2 vLightMapUv; #endif #ifdef USE_AOMAP varying vec2 vAoMapUv; #endif #ifdef USE_BUMPMAP varying vec2 vBumpMapUv; #endif #ifdef USE_NORMALMAP varying vec2 vNormalMapUv; #endif #ifdef USE_EMISSIVEMAP varying vec2 vEmissiveMapUv; #endif #ifdef USE_METALNESSMAP varying vec2 vMetalnessMapUv; #endif #ifdef USE_ROUGHNESSMAP varying vec2 vRoughnessMapUv; #endif #ifdef USE_ANISOTROPYMAP varying vec2 vAnisotropyMapUv; #endif #ifdef USE_CLEARCOATMAP varying vec2 vClearcoatMapUv; #endif #ifdef USE_CLEARCOAT_NORMALMAP varying vec2 vClearcoatNormalMapUv; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP varying vec2 vClearcoatRoughnessMapUv; #endif #ifdef USE_IRIDESCENCEMAP varying vec2 vIridescenceMapUv; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP varying vec2 vIridescenceThicknessMapUv; #endif #ifdef USE_SHEEN_COLORMAP varying vec2 vSheenColorMapUv; #endif #ifdef USE_SHEEN_ROUGHNESSMAP varying vec2 vSheenRoughnessMapUv; #endif #ifdef USE_SPECULARMAP varying vec2 vSpecularMapUv; #endif #ifdef USE_SPECULAR_COLORMAP varying vec2 vSpecularColorMapUv; #endif #ifdef USE_SPECULAR_INTENSITYMAP varying vec2 vSpecularIntensityMapUv; #endif #ifdef USE_TRANSMISSIONMAP uniform mat3 transmissionMapTransform; varying vec2 vTransmissionMapUv; #endif #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; #endif`,aj=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP uniform mat3 mapTransform; varying vec2 vMapUv; #endif #ifdef USE_ALPHAMAP uniform mat3 alphaMapTransform; varying vec2 vAlphaMapUv; #endif #ifdef USE_LIGHTMAP uniform mat3 lightMapTransform; varying vec2 vLightMapUv; #endif #ifdef USE_AOMAP uniform mat3 aoMapTransform; varying vec2 vAoMapUv; #endif #ifdef USE_BUMPMAP uniform mat3 bumpMapTransform; varying vec2 vBumpMapUv; #endif #ifdef USE_NORMALMAP uniform mat3 normalMapTransform; varying vec2 vNormalMapUv; #endif #ifdef USE_DISPLACEMENTMAP uniform mat3 displacementMapTransform; varying vec2 vDisplacementMapUv; #endif #ifdef USE_EMISSIVEMAP uniform mat3 emissiveMapTransform; varying vec2 vEmissiveMapUv; #endif #ifdef USE_METALNESSMAP uniform mat3 metalnessMapTransform; varying vec2 vMetalnessMapUv; #endif #ifdef USE_ROUGHNESSMAP uniform mat3 roughnessMapTransform; varying vec2 vRoughnessMapUv; #endif #ifdef USE_ANISOTROPYMAP uniform mat3 anisotropyMapTransform; varying vec2 vAnisotropyMapUv; #endif #ifdef USE_CLEARCOATMAP uniform mat3 clearcoatMapTransform; varying vec2 vClearcoatMapUv; #endif #ifdef USE_CLEARCOAT_NORMALMAP uniform mat3 clearcoatNormalMapTransform; varying vec2 vClearcoatNormalMapUv; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform mat3 clearcoatRoughnessMapTransform; varying vec2 vClearcoatRoughnessMapUv; #endif #ifdef USE_SHEEN_COLORMAP uniform mat3 sheenColorMapTransform; varying vec2 vSheenColorMapUv; #endif #ifdef USE_SHEEN_ROUGHNESSMAP uniform mat3 sheenRoughnessMapTransform; varying vec2 vSheenRoughnessMapUv; #endif #ifdef USE_IRIDESCENCEMAP uniform mat3 iridescenceMapTransform; varying vec2 vIridescenceMapUv; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform mat3 iridescenceThicknessMapTransform; varying vec2 vIridescenceThicknessMapUv; #endif #ifdef USE_SPECULARMAP uniform mat3 specularMapTransform; varying vec2 vSpecularMapUv; #endif #ifdef USE_SPECULAR_COLORMAP uniform mat3 specularColorMapTransform; varying vec2 vSpecularColorMapUv; #endif #ifdef USE_SPECULAR_INTENSITYMAP uniform mat3 specularIntensityMapTransform; varying vec2 vSpecularIntensityMapUv; #endif #ifdef USE_TRANSMISSIONMAP uniform mat3 transmissionMapTransform; varying vec2 vTransmissionMapUv; #endif #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; #endif`,oj=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) vUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; #endif #ifdef USE_ALPHAMAP vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; #endif #ifdef USE_LIGHTMAP vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; #endif #ifdef USE_AOMAP vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; #endif #ifdef USE_BUMPMAP vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; #endif #ifdef USE_NORMALMAP vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; #endif #ifdef USE_DISPLACEMENTMAP vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; #endif #ifdef USE_EMISSIVEMAP vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; #endif #ifdef USE_METALNESSMAP vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_ROUGHNESSMAP vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_ANISOTROPYMAP vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOATMAP vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOAT_NORMALMAP vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_IRIDESCENCEMAP vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_SHEEN_COLORMAP vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; #endif #ifdef USE_SHEEN_ROUGHNESSMAP vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULARMAP vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULAR_COLORMAP vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; #endif #ifdef USE_SPECULAR_INTENSITYMAP vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; #endif #ifdef USE_TRANSMISSIONMAP vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; #endif`,lj=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 vec4 worldPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING worldPosition = batchingMatrix * worldPosition; #endif #ifdef USE_INSTANCING worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; #endif`;const uj=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); }`,cj=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { vec4 texColor = texture2D( t2D, vUv ); #ifdef DECODE_VIDEO_TEXTURE texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); #endif texColor.rgb *= backgroundIntensity; gl_FragColor = texColor; #include #include }`,fj=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,hj=`#ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #elif defined( ENVMAP_TYPE_CUBE_UV ) uniform sampler2D envMap; #endif uniform float flipEnvMap; uniform float backgroundBlurriness; uniform float backgroundIntensity; uniform mat3 backgroundRotation; varying vec3 vWorldDirection; #include void main() { #ifdef ENVMAP_TYPE_CUBE vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); #elif defined( ENVMAP_TYPE_CUBE_UV ) vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); #else vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); #endif texColor.rgb *= backgroundIntensity; gl_FragColor = texColor; #include #include }`,dj=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,pj=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; void main() { vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); gl_FragColor = texColor; gl_FragColor.a *= opacity; #include #include }`,mj=`#include #include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { #include #include #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vHighPrecisionZW = gl_Position.zw; }`,gj=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include #include #include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { vec4 diffuseColor = vec4( 1.0 ); #include #if DEPTH_PACKING == 3200 diffuseColor.a = opacity; #endif #include #include #include #include #include #ifdef USE_REVERSED_DEPTH_BUFFER float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; #else float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; #endif #if DEPTH_PACKING == 3200 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); #elif DEPTH_PACKING == 3201 gl_FragColor = packDepthToRGBA( fragCoordZ ); #elif DEPTH_PACKING == 3202 gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); #elif DEPTH_PACKING == 3203 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); #endif }`,vj=`#define DISTANCE varying vec3 vWorldPosition; #include #include #include #include #include #include #include void main() { #include #include #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vWorldPosition = worldPosition.xyz; }`,yj=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; varying vec3 vWorldPosition; #include #include #include #include #include #include #include void main () { vec4 diffuseColor = vec4( 1.0 ); #include #include #include #include #include float dist = length( vWorldPosition - referencePosition ); dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); }`,xj=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include }`,_j=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include }`,bj=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include #include #include #include #include #include #include void main() { vLineDistance = scale * lineDistance; #include #include #include #include #include #include #include #include #include #include }`,Sj=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; varying float vLineDistance; #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include if ( mod( vLineDistance, totalSize ) > dashSize ) { discard; } vec3 outgoingLight = vec3( 0.0 ); #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include #include }`,Mj=`#include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) #include #include #include #include #include #endif #include #include #include #include #include #include #include #include #include }`,wj=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include #include #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; #else reflectedLight.indirectDiffuse += vec3( 1.0 ); #endif #include reflectedLight.indirectDiffuse *= diffuseColor.rgb; vec3 outgoingLight = reflectedLight.indirectDiffuse; #include #include #include #include #include #include #include }`,Tj=`#define LAMBERT varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #include }`,Ej=`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include #include #include #include #include #include #include }`,Aj=`#define MATCAP varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; }`,Cj=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include #include #include #include vec3 viewDir = normalize( vViewPosition ); vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); vec3 y = cross( viewDir, x ); vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; #ifdef USE_MATCAP vec4 matcapColor = texture2D( matcap, uv ); #else vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); #endif vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; #include #include #include #include #include #include }`,Rj=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) vViewPosition = - mvPosition.xyz; #endif }`,Dj=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); #include #include #include #include gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a ); #ifdef OPAQUE gl_FragColor.a = 1.0; #endif }`,Nj=`#define PHONG varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #include }`,Uj=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; uniform float shininess; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; #include #include #include #include #include #include #include }`,Lj=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; #endif #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif }`,Ij=`#define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR #endif uniform vec3 diffuse; uniform vec3 emissive; uniform float roughness; uniform float metalness; uniform float opacity; #ifdef IOR uniform float ior; #endif #ifdef USE_SPECULAR uniform float specularIntensity; uniform vec3 specularColor; #ifdef USE_SPECULAR_COLORMAP uniform sampler2D specularColorMap; #endif #ifdef USE_SPECULAR_INTENSITYMAP uniform sampler2D specularIntensityMap; #endif #endif #ifdef USE_CLEARCOAT uniform float clearcoat; uniform float clearcoatRoughness; #endif #ifdef USE_DISPERSION uniform float dispersion; #endif #ifdef USE_IRIDESCENCE uniform float iridescence; uniform float iridescenceIOR; uniform float iridescenceThicknessMinimum; uniform float iridescenceThicknessMaximum; #endif #ifdef USE_SHEEN uniform vec3 sheenColor; uniform float sheenRoughness; #ifdef USE_SHEEN_COLORMAP uniform sampler2D sheenColorMap; #endif #ifdef USE_SHEEN_ROUGHNESSMAP uniform sampler2D sheenRoughnessMap; #endif #endif #ifdef USE_ANISOTROPY uniform vec2 anisotropyVector; #ifdef USE_ANISOTROPYMAP uniform sampler2D anisotropyMap; #endif #endif varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; #include vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; #ifdef USE_SHEEN outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect; #endif #ifdef USE_CLEARCOAT float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; #endif #include #include #include #include #include #include }`,Pj=`#define TOON varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include }`,Oj=`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include #include #include #include #include #include }`,Fj=`uniform float size; uniform float scale; #include #include #include #include #include #include #ifdef USE_POINTS_UV varying vec2 vUv; uniform mat3 uvTransform; #endif void main() { #ifdef USE_POINTS_UV vUv = ( uvTransform * vec3( uv, 1 ) ).xy; #endif #include #include #include #include #include #include gl_PointSize = size; #ifdef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); #endif #include #include #include #include }`,kj=`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include vec3 outgoingLight = vec3( 0.0 ); #include #include #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include #include }`,zj=`#include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include }`,Bj=`uniform vec3 color; uniform float opacity; #include #include #include #include #include #include #include void main() { #include gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); #include #include #include #include }`,Vj=`uniform float rotation; uniform vec2 center; #include #include #include #include #include void main() { #include vec4 mvPosition = modelViewMatrix[ 3 ]; vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); #ifndef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) scale *= - mvPosition.z; #endif vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; vec2 rotatedPosition; rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; mvPosition.xy += rotatedPosition; gl_Position = projectionMatrix * mvPosition; #include #include #include }`,Gj=`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include #include #include void main() { vec4 diffuseColor = vec4( diffuse, opacity ); #include vec3 outgoingLight = vec3( 0.0 ); #include #include #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include }`,wn={alphahash_fragment:c7,alphahash_pars_fragment:f7,alphamap_fragment:h7,alphamap_pars_fragment:d7,alphatest_fragment:p7,alphatest_pars_fragment:m7,aomap_fragment:g7,aomap_pars_fragment:v7,batching_pars_vertex:y7,batching_vertex:x7,begin_vertex:_7,beginnormal_vertex:b7,bsdfs:S7,iridescence_fragment:M7,bumpmap_pars_fragment:w7,clipping_planes_fragment:T7,clipping_planes_pars_fragment:E7,clipping_planes_pars_vertex:A7,clipping_planes_vertex:C7,color_fragment:R7,color_pars_fragment:D7,color_pars_vertex:N7,color_vertex:U7,common:L7,cube_uv_reflection_fragment:I7,defaultnormal_vertex:P7,displacementmap_pars_vertex:O7,displacementmap_vertex:F7,emissivemap_fragment:k7,emissivemap_pars_fragment:z7,colorspace_fragment:B7,colorspace_pars_fragment:V7,envmap_fragment:G7,envmap_common_pars_fragment:H7,envmap_pars_fragment:W7,envmap_pars_vertex:j7,envmap_physical_pars_fragment:nW,envmap_vertex:X7,fog_vertex:Y7,fog_pars_vertex:q7,fog_fragment:Z7,fog_pars_fragment:K7,gradientmap_pars_fragment:Q7,lightmap_pars_fragment:J7,lights_lambert_fragment:$7,lights_lambert_pars_fragment:eW,lights_pars_begin:tW,lights_toon_fragment:iW,lights_toon_pars_fragment:rW,lights_phong_fragment:sW,lights_phong_pars_fragment:aW,lights_physical_fragment:oW,lights_physical_pars_fragment:lW,lights_fragment_begin:uW,lights_fragment_maps:cW,lights_fragment_end:fW,logdepthbuf_fragment:hW,logdepthbuf_pars_fragment:dW,logdepthbuf_pars_vertex:pW,logdepthbuf_vertex:mW,map_fragment:gW,map_pars_fragment:vW,map_particle_fragment:yW,map_particle_pars_fragment:xW,metalnessmap_fragment:_W,metalnessmap_pars_fragment:bW,morphinstance_vertex:SW,morphcolor_vertex:MW,morphnormal_vertex:wW,morphtarget_pars_vertex:TW,morphtarget_vertex:EW,normal_fragment_begin:AW,normal_fragment_maps:CW,normal_pars_fragment:RW,normal_pars_vertex:DW,normal_vertex:NW,normalmap_pars_fragment:UW,clearcoat_normal_fragment_begin:LW,clearcoat_normal_fragment_maps:IW,clearcoat_pars_fragment:PW,iridescence_pars_fragment:OW,opaque_fragment:FW,packing:kW,premultiplied_alpha_fragment:zW,project_vertex:BW,dithering_fragment:VW,dithering_pars_fragment:GW,roughnessmap_fragment:HW,roughnessmap_pars_fragment:WW,shadowmap_pars_fragment:jW,shadowmap_pars_vertex:XW,shadowmap_vertex:YW,shadowmask_pars_fragment:qW,skinbase_vertex:ZW,skinning_pars_vertex:KW,skinning_vertex:QW,skinnormal_vertex:JW,specularmap_fragment:$W,specularmap_pars_fragment:ej,tonemapping_fragment:tj,tonemapping_pars_fragment:nj,transmission_fragment:ij,transmission_pars_fragment:rj,uv_pars_fragment:sj,uv_pars_vertex:aj,uv_vertex:oj,worldpos_vertex:lj,background_vert:uj,background_frag:cj,backgroundCube_vert:fj,backgroundCube_frag:hj,cube_vert:dj,cube_frag:pj,depth_vert:mj,depth_frag:gj,distance_vert:vj,distance_frag:yj,equirect_vert:xj,equirect_frag:_j,linedashed_vert:bj,linedashed_frag:Sj,meshbasic_vert:Mj,meshbasic_frag:wj,meshlambert_vert:Tj,meshlambert_frag:Ej,meshmatcap_vert:Aj,meshmatcap_frag:Cj,meshnormal_vert:Rj,meshnormal_frag:Dj,meshphong_vert:Nj,meshphong_frag:Uj,meshphysical_vert:Lj,meshphysical_frag:Ij,meshtoon_vert:Pj,meshtoon_frag:Oj,points_vert:Fj,points_frag:kj,shadow_vert:zj,shadow_frag:Bj,sprite_vert:Vj,sprite_frag:Gj},Vt={common:{diffuse:{value:new zt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new yn},alphaMap:{value:null},alphaMapTransform:{value:new yn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new yn}},envmap:{envMap:{value:null},envMapRotation:{value:new yn},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new yn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new yn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new yn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new yn},normalScale:{value:new pt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new yn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new yn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new yn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new yn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new zt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{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}},points:{diffuse:{value:new zt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new yn},alphaTest:{value:0},uvTransform:{value:new yn}},sprite:{diffuse:{value:new zt(16777215)},opacity:{value:1},center:{value:new pt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new yn},alphaMap:{value:null},alphaMapTransform:{value:new yn},alphaTest:{value:0}}},Al={basic:{uniforms:ia([Vt.common,Vt.specularmap,Vt.envmap,Vt.aomap,Vt.lightmap,Vt.fog]),vertexShader:wn.meshbasic_vert,fragmentShader:wn.meshbasic_frag},lambert:{uniforms:ia([Vt.common,Vt.specularmap,Vt.envmap,Vt.aomap,Vt.lightmap,Vt.emissivemap,Vt.bumpmap,Vt.normalmap,Vt.displacementmap,Vt.fog,Vt.lights,{emissive:{value:new zt(0)},envMapIntensity:{value:1}}]),vertexShader:wn.meshlambert_vert,fragmentShader:wn.meshlambert_frag},phong:{uniforms:ia([Vt.common,Vt.specularmap,Vt.envmap,Vt.aomap,Vt.lightmap,Vt.emissivemap,Vt.bumpmap,Vt.normalmap,Vt.displacementmap,Vt.fog,Vt.lights,{emissive:{value:new zt(0)},specular:{value:new zt(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:wn.meshphong_vert,fragmentShader:wn.meshphong_frag},standard:{uniforms:ia([Vt.common,Vt.envmap,Vt.aomap,Vt.lightmap,Vt.emissivemap,Vt.bumpmap,Vt.normalmap,Vt.displacementmap,Vt.roughnessmap,Vt.metalnessmap,Vt.fog,Vt.lights,{emissive:{value:new zt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:wn.meshphysical_vert,fragmentShader:wn.meshphysical_frag},toon:{uniforms:ia([Vt.common,Vt.aomap,Vt.lightmap,Vt.emissivemap,Vt.bumpmap,Vt.normalmap,Vt.displacementmap,Vt.gradientmap,Vt.fog,Vt.lights,{emissive:{value:new zt(0)}}]),vertexShader:wn.meshtoon_vert,fragmentShader:wn.meshtoon_frag},matcap:{uniforms:ia([Vt.common,Vt.bumpmap,Vt.normalmap,Vt.displacementmap,Vt.fog,{matcap:{value:null}}]),vertexShader:wn.meshmatcap_vert,fragmentShader:wn.meshmatcap_frag},points:{uniforms:ia([Vt.points,Vt.fog]),vertexShader:wn.points_vert,fragmentShader:wn.points_frag},dashed:{uniforms:ia([Vt.common,Vt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:wn.linedashed_vert,fragmentShader:wn.linedashed_frag},depth:{uniforms:ia([Vt.common,Vt.displacementmap]),vertexShader:wn.depth_vert,fragmentShader:wn.depth_frag},normal:{uniforms:ia([Vt.common,Vt.bumpmap,Vt.normalmap,Vt.displacementmap,{opacity:{value:1}}]),vertexShader:wn.meshnormal_vert,fragmentShader:wn.meshnormal_frag},sprite:{uniforms:ia([Vt.sprite,Vt.fog]),vertexShader:wn.sprite_vert,fragmentShader:wn.sprite_frag},background:{uniforms:{uvTransform:{value:new yn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:wn.background_vert,fragmentShader:wn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new yn}},vertexShader:wn.backgroundCube_vert,fragmentShader:wn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:wn.cube_vert,fragmentShader:wn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:wn.equirect_vert,fragmentShader:wn.equirect_frag},distance:{uniforms:ia([Vt.common,Vt.displacementmap,{referencePosition:{value:new re},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:wn.distance_vert,fragmentShader:wn.distance_frag},shadow:{uniforms:ia([Vt.lights,Vt.fog,{color:{value:new zt(0)},opacity:{value:1}}]),vertexShader:wn.shadow_vert,fragmentShader:wn.shadow_frag}};Al.physical={uniforms:ia([Al.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new yn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new yn},clearcoatNormalScale:{value:new pt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new yn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new yn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new yn},sheen:{value:0},sheenColor:{value:new zt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new yn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new yn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new yn},transmissionSamplerSize:{value:new pt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new yn},attenuationDistance:{value:0},attenuationColor:{value:new zt(0)},specularColor:{value:new zt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new yn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new yn},anisotropyVector:{value:new pt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new yn}}]),vertexShader:wn.meshphysical_vert,fragmentShader:wn.meshphysical_frag};const J_={r:0,b:0,g:0},Kh=new mo,Hj=new un;function Wj(i,e,t,n,r,s){const a=new zt(0);let l=r===!0?0:1,c,h,p=null,g=0,v=null;function x(A){let D=A.isScene===!0?A.background:null;if(D&&D.isTexture){const R=A.backgroundBlurriness>0;D=e.get(D,R)}return D}function b(A){let D=!1;const R=x(A);R===null?S(a,l):R&&R.isColor&&(S(R,1),D=!0);const I=i.xr.getEnvironmentBlendMode();I==="additive"?t.buffers.color.setClear(0,0,0,1,s):I==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(i.autoClear||D)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function w(A,D){const R=x(D);R&&(R.isCubeTexture||R.mapping===Km)?(h===void 0&&(h=new wi(new Qf(1,1,1),new ls({name:"BackgroundCubeMaterial",uniforms:Hm(Al.backgroundCube.uniforms),vertexShader:Al.backgroundCube.vertexShader,fragmentShader:Al.backgroundCube.fragmentShader,side:ca,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(I,P,F){this.matrixWorld.copyPosition(F.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(h)),Kh.copy(D.backgroundRotation),Kh.x*=-1,Kh.y*=-1,Kh.z*=-1,R.isCubeTexture&&R.isRenderTargetTexture===!1&&(Kh.y*=-1,Kh.z*=-1),h.material.uniforms.envMap.value=R,h.material.uniforms.flipEnvMap.value=R.isCubeTexture&&R.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=D.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=D.backgroundIntensity,h.material.uniforms.backgroundRotation.value.setFromMatrix4(Hj.makeRotationFromEuler(Kh)),h.material.toneMapped=Hn.getTransfer(R.colorSpace)!==ci,(p!==R||g!==R.version||v!==i.toneMapping)&&(h.material.needsUpdate=!0,p=R,g=R.version,v=i.toneMapping),h.layers.enableAll(),A.unshift(h,h.geometry,h.material,0,0,null)):R&&R.isTexture&&(c===void 0&&(c=new wi(new tl(2,2),new ls({name:"BackgroundMaterial",uniforms:Hm(Al.background.uniforms),vertexShader:Al.background.vertexShader,fragmentShader:Al.background.fragmentShader,side:Cc,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(c)),c.material.uniforms.t2D.value=R,c.material.uniforms.backgroundIntensity.value=D.backgroundIntensity,c.material.toneMapped=Hn.getTransfer(R.colorSpace)!==ci,R.matrixAutoUpdate===!0&&R.updateMatrix(),c.material.uniforms.uvTransform.value.copy(R.matrix),(p!==R||g!==R.version||v!==i.toneMapping)&&(c.material.needsUpdate=!0,p=R,g=R.version,v=i.toneMapping),c.layers.enableAll(),A.unshift(c,c.geometry,c.material,0,0,null))}function S(A,D){A.getRGB(J_,kO(i)),t.buffers.color.setClear(J_.r,J_.g,J_.b,D,s)}function M(){h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return a},setClearColor:function(A,D=1){a.set(A),l=D,S(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(A){l=A,S(a,l)},render:b,addToRenderList:w,dispose:M}}function jj(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=v(null);let s=r,a=!1;function l(X,W,q,K,ne){let j=!1;const $=g(X,K,q,W);s!==$&&(s=$,h(s.object)),j=x(X,K,q,ne),j&&b(X,K,q,ne),ne!==null&&e.update(ne,i.ELEMENT_ARRAY_BUFFER),(j||a)&&(a=!1,R(X,W,q,K),ne!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(ne).buffer))}function c(){return i.createVertexArray()}function h(X){return i.bindVertexArray(X)}function p(X){return i.deleteVertexArray(X)}function g(X,W,q,K){const ne=K.wireframe===!0;let j=n[W.id];j===void 0&&(j={},n[W.id]=j);const $=X.isInstancedMesh===!0?X.id:0;let he=j[$];he===void 0&&(he={},j[$]=he);let le=he[q.id];le===void 0&&(le={},he[q.id]=le);let ue=le[ne];return ue===void 0&&(ue=v(c()),le[ne]=ue),ue}function v(X){const W=[],q=[],K=[];for(let ne=0;ne=0){const k=ne[le];let Z=j[le];if(Z===void 0&&(le==="instanceMatrix"&&X.instanceMatrix&&(Z=X.instanceMatrix),le==="instanceColor"&&X.instanceColor&&(Z=X.instanceColor)),k===void 0||k.attribute!==Z||Z&&k.data!==Z.data)return!0;$++}return s.attributesNum!==$||s.index!==K}function b(X,W,q,K){const ne={},j=W.attributes;let $=0;const he=q.getAttributes();for(const le in he)if(he[le].location>=0){let k=j[le];k===void 0&&(le==="instanceMatrix"&&X.instanceMatrix&&(k=X.instanceMatrix),le==="instanceColor"&&X.instanceColor&&(k=X.instanceColor));const Z={};Z.attribute=k,k&&k.data&&(Z.data=k.data),ne[le]=Z,$++}s.attributes=ne,s.attributesNum=$,s.index=K}function w(){const X=s.newAttributes;for(let W=0,q=X.length;W=0){let ue=ne[he];if(ue===void 0&&(he==="instanceMatrix"&&X.instanceMatrix&&(ue=X.instanceMatrix),he==="instanceColor"&&X.instanceColor&&(ue=X.instanceColor)),ue!==void 0){const k=ue.normalized,Z=ue.itemSize,oe=e.get(ue);if(oe===void 0)continue;const fe=oe.buffer,ve=oe.type,se=oe.bytesPerElement,de=ve===i.INT||ve===i.UNSIGNED_INT||ue.gpuType===uy;if(ue.isInterleavedBufferAttribute){const be=ue.data,Ge=be.stride,ot=ue.offset;if(be.isInstancedInterleavedBuffer){for(let Qe=0;Qe0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";F="mediump"}return F==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let h=t.precision!==void 0?t.precision:"highp";const p=c(h);p!==h&&(Ft("WebGLRenderer:",h,"not supported, using",p,"instead."),h=p);const g=t.logarithmicDepthBuffer===!0,v=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),x=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),b=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),w=i.getParameter(i.MAX_TEXTURE_SIZE),S=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),M=i.getParameter(i.MAX_VERTEX_ATTRIBS),A=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),D=i.getParameter(i.MAX_VARYING_VECTORS),R=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),I=i.getParameter(i.MAX_SAMPLES),P=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:c,textureFormatReadable:a,textureTypeReadable:l,precision:h,logarithmicDepthBuffer:g,reversedDepthBuffer:v,maxTextures:x,maxVertexTextures:b,maxTextureSize:w,maxCubemapSize:S,maxAttributes:M,maxVertexUniforms:A,maxVaryings:D,maxFragmentUniforms:R,maxSamples:I,samples:P}}function qj(i){const e=this;let t=null,n=0,r=!1,s=!1;const a=new Af,l=new yn,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(g,v){const x=g.length!==0||v||n!==0||r;return r=v,n=g.length,x},this.beginShadows=function(){s=!0,p(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(g,v){t=p(g,v,0)},this.setState=function(g,v,x){const b=g.clippingPlanes,w=g.clipIntersection,S=g.clipShadows,M=i.get(g);if(!r||b===null||b.length===0||s&&!S)s?p(null):h();else{const A=s?0:n,D=A*4;let R=M.clippingState||null;c.value=R,R=p(b,v,D,x);for(let I=0;I!==D;++I)R[I]=t[I];M.clippingState=R,this.numIntersection=w?this.numPlanes:0,this.numPlanes+=A}};function h(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function p(g,v,x,b){const w=g!==null?g.length:0;let S=null;if(w!==0){if(S=c.value,b!==!0||S===null){const M=x+w*4,A=v.matrixWorldInverse;l.getNormalMatrix(A),(S===null||S.length0&&this._blur(c,0,0,t),this._applyPMREM(c),this._cleanup(c),c}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=AN(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=EN(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(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(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?I:0,I,I),g.setRenderTarget(r),M&&g.render(w,c),g.render(e,c)}g.toneMapping=x,g.autoClear=v,e.background=A}_textureToCubeUV(e,t){const n=this._renderer,r=e.mapping===Il||e.mapping===jf;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=AN()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=EN());const s=r?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=s;const l=s.uniforms;l.envMap.value=e;const c=this._cubeSize;om(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(a,z0)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const r=this._lodMeshes.length;for(let s=1;sb-Pf?n-b+Pf:0),M=4*(this._cubeSize-w);c.envMap.value=e.texture,c.roughness.value=x,c.mipInt.value=b-t,om(s,S,M,3*w,2*w),r.setRenderTarget(s),r.render(l,z0),c.envMap.value=s.texture,c.roughness.value=0,c.mipInt.value=b-n,om(e,S,M,3*w,2*w),r.setRenderTarget(e),r.render(l,z0)}_blur(e,t,n,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",s),this._halfBlur(a,e,n,n,r,"longitudinal",s)}_halfBlur(e,t,n,r,s,a,l){const c=this._renderer,h=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&en("blur direction must be either latitudinal or longitudinal!");const p=3,g=this._lodMeshes[r];g.material=h;const v=h.uniforms,x=this._sizeLods[n]-1,b=isFinite(s)?Math.PI/(2*x):2*Math.PI/(2*id-1),w=s/b,S=isFinite(s)?1+Math.floor(p*w):id;S>id&&Ft(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${id}`);const M=[];let A=0;for(let F=0;FD-Pf?r-D+Pf:0),P=4*(this._cubeSize-R);om(t,I,P,3*R,2*R),c.setRenderTarget(t),c.render(g,z0)}}function Qj(i){const e=[],t=[],n=[];let r=i;const s=i-Pf+1+MN.length;for(let a=0;ai-Pf?c=MN[a-i+Pf-1]:a===0&&(c=0),t.push(c);const h=1/(l-2),p=-h,g=1+h,v=[p,p,g,p,g,g,p,p,g,g,p,g],x=6,b=6,w=3,S=2,M=1,A=new Float32Array(w*b*x),D=new Float32Array(S*b*x),R=new Float32Array(M*b*x);for(let P=0;P2?0:-1,L=[F,N,0,F+2/3,N,0,F+2/3,N+1,0,F,N,0,F+2/3,N+1,0,F,N+1,0];A.set(L,w*b*P),D.set(v,S*b*P);const G=[P,P,P,P,P,P];R.set(G,M*b*P)}const I=new xn;I.setAttribute("position",new _i(A,w)),I.setAttribute("uv",new _i(D,S)),I.setAttribute("faceIndex",new _i(R,M)),n.push(new wi(I,null)),r>Pf&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function TN(i,e,t){const n=new rs(i,e,t);return n.texture.mapping=Km,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function om(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function Jj(i,e,t){return new ls({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Zj,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:DS(),fragmentShader:` precision highp float; precision highp int; varying vec3 vOutputDirection; uniform sampler2D envMap; uniform float roughness; uniform float mipInt; #define ENVMAP_TYPE_CUBE_UV #include #define PI 3.14159265359 // Van der Corput radical inverse float radicalInverse_VdC(uint bits) { bits = (bits << 16u) | (bits >> 16u); bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); return float(bits) * 2.3283064365386963e-10; // / 0x100000000 } // Hammersley sequence vec2 hammersley(uint i, uint N) { return vec2(float(i) / float(N), radicalInverse_VdC(i)); } // GGX VNDF importance sampling (Eric Heitz 2018) // "Sampling the GGX Distribution of Visible Normals" // https://jcgt.org/published/0007/04/01/ vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { float alpha = roughness * roughness; // Section 4.1: Orthonormal basis vec3 T1 = vec3(1.0, 0.0, 0.0); vec3 T2 = cross(V, T1); // Section 4.2: Parameterization of projected area float r = sqrt(Xi.x); float phi = 2.0 * PI * Xi.y; float t1 = r * cos(phi); float t2 = r * sin(phi); float s = 0.5 * (1.0 + V.z); t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; // Section 4.3: Reprojection onto hemisphere vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V; // Section 3.4: Transform back to ellipsoid configuration return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); } void main() { vec3 N = normalize(vOutputDirection); vec3 V = N; // Assume view direction equals normal for pre-filtering vec3 prefilteredColor = vec3(0.0); float totalWeight = 0.0; // For very low roughness, just sample the environment directly if (roughness < 0.001) { gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); return; } // Tangent space basis for VNDF sampling vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); vec3 tangent = normalize(cross(up, N)); vec3 bitangent = cross(N, tangent); for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); // For PMREM, V = N, so in tangent space V is always (0, 0, 1) vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); // Transform H back to world space vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); vec3 L = normalize(2.0 * dot(V, H) * H - V); float NdotL = max(dot(N, L), 0.0); if(NdotL > 0.0) { // Sample environment at fixed mip level // VNDF importance sampling handles the distribution filtering vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); // Weight by NdotL for the split-sum approximation // VNDF PDF naturally accounts for the visible microfacet distribution prefilteredColor += sampleColor * NdotL; totalWeight += NdotL; } } if (totalWeight > 0.0) { prefilteredColor = prefilteredColor / totalWeight; } gl_FragColor = vec4(prefilteredColor, 1.0); } `,blending:Nl,depthTest:!1,depthWrite:!1})}function $j(i,e,t){const n=new Float32Array(id),r=new re(0,1,0);return new ls({name:"SphericalGaussianBlur",defines:{n:id,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${i}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:DS(),fragmentShader:` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform sampler2D envMap; uniform int samples; uniform float weights[ n ]; uniform bool latitudinal; uniform float dTheta; uniform float mipInt; uniform vec3 poleAxis; #define ENVMAP_TYPE_CUBE_UV #include vec3 getSample( float theta, vec3 axis ) { float cosTheta = cos( theta ); // Rodrigues' axis-angle rotation vec3 sampleDirection = vOutputDirection * cosTheta + cross( axis, vOutputDirection ) * sin( theta ) + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); return bilinearCubeUV( envMap, sampleDirection, mipInt ); } void main() { vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); if ( all( equal( axis, vec3( 0.0 ) ) ) ) { axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); } axis = normalize( axis ); gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); for ( int i = 1; i < n; i++ ) { if ( i >= samples ) { break; } float theta = dTheta * float( i ); gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); } } `,blending:Nl,depthTest:!1,depthWrite:!1})}function EN(){return new ls({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:DS(),fragmentShader:` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform sampler2D envMap; #include void main() { vec3 outputDirection = normalize( vOutputDirection ); vec2 uv = equirectUv( outputDirection ); gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); } `,blending:Nl,depthTest:!1,depthWrite:!1})}function AN(){return new ls({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:DS(),fragmentShader:` precision mediump float; precision mediump int; uniform float flipEnvMap; varying vec3 vOutputDirection; uniform samplerCube envMap; void main() { gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); } `,blending:Nl,depthTest:!1,depthWrite:!1})}function DS(){return` precision mediump float; precision mediump int; attribute float faceIndex; varying vec3 vOutputDirection; // RH coordinate system; PMREM face-indexing convention vec3 getDirection( vec2 uv, float face ) { uv = 2.0 * uv - 1.0; vec3 direction = vec3( uv, 1.0 ); if ( face == 0.0 ) { direction = direction.zyx; // ( 1, v, u ) pos x } else if ( face == 1.0 ) { direction = direction.xzy; direction.xz *= -1.0; // ( -u, 1, -v ) pos y } else if ( face == 2.0 ) { direction.x *= -1.0; // ( -u, v, 1 ) pos z } else if ( face == 3.0 ) { direction = direction.zyx; direction.xz *= -1.0; // ( -1, v, -u ) neg x } else if ( face == 4.0 ) { direction = direction.xzy; direction.xy *= -1.0; // ( -u, -1, v ) neg y } else if ( face == 5.0 ) { direction.z *= -1.0; // ( u, v, -1 ) neg z } return direction; } void main() { vOutputDirection = getDirection( uv, faceIndex ); gl_Position = vec4( position, 1.0 ); } `}class NS extends rs{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new dy(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; vec3 transformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include } `,fragmentShader:` uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); } `},r=new Qf(5,5,5),s=new ls({name:"CubemapFromEquirect",uniforms:Hm(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:ca,blending:Nl});s.uniforms.tEquirect.value=t;const a=new wi(r,s),l=t.minFilter;return t.minFilter===Cu&&(t.minFilter=In),new a4(1,10,this).update(e,a),t.minFilter=l,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(s)}}function eX(i){let e=new WeakMap,t=new WeakMap,n=null;function r(v,x=!1){return v==null?null:x?a(v):s(v)}function s(v){if(v&&v.isTexture){const x=v.mapping;if(x===Em||x===cv)if(e.has(v)){const b=e.get(v).texture;return l(b,v.mapping)}else{const b=v.image;if(b&&b.height>0){const w=new NS(b.height);return w.fromEquirectangularTexture(i,v),e.set(v,w),v.addEventListener("dispose",h),l(w.texture,v.mapping)}else return null}}return v}function a(v){if(v&&v.isTexture){const x=v.mapping,b=x===Em||x===cv,w=x===Il||x===jf;if(b||w){let S=t.get(v);const M=S!==void 0?S.texture.pmremVersion:0;if(v.isRenderTargetTexture&&v.pmremVersion!==M)return n===null&&(n=new tE(i)),S=b?n.fromEquirectangular(v,S):n.fromCubemap(v,S),S.texture.pmremVersion=v.pmremVersion,t.set(v,S),S.texture;if(S!==void 0)return S.texture;{const A=v.image;return b&&A&&A.height>0||w&&A&&c(A)?(n===null&&(n=new tE(i)),S=b?n.fromEquirectangular(v):n.fromCubemap(v),S.texture.pmremVersion=v.pmremVersion,t.set(v,S),v.addEventListener("dispose",p),S.texture):null}}}return v}function l(v,x){return x===Em?v.mapping=Il:x===cv&&(v.mapping=jf),v}function c(v){let x=0;const b=6;for(let w=0;w=65535?UA:NA)(v,1);S.version=w;const M=s.get(g);M&&e.remove(M),s.set(g,S)}function p(g){const v=s.get(g);if(v){const x=g.index;x!==null&&v.versione.maxTextureSize&&(P=Math.ceil(I/e.maxTextureSize),I=e.maxTextureSize);const F=new Float32Array(I*P*4*g),N=new aS(F,I,P,g);N.type=Gi,N.needsUpdate=!0;const L=R*4;for(let X=0;X #include void main() { gl_FragColor = texture2D( tDiffuse, vUv ); #ifdef LINEAR_TONE_MAPPING gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); #elif defined( REINHARD_TONE_MAPPING ) gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); #elif defined( CINEON_TONE_MAPPING ) gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); #elif defined( ACES_FILMIC_TONE_MAPPING ) gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); #elif defined( AGX_TONE_MAPPING ) gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); #elif defined( NEUTRAL_TONE_MAPPING ) gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); #elif defined( CUSTOM_TONE_MAPPING ) gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); #endif #ifdef SRGB_TRANSFER gl_FragColor = sRGBTransferOETF( gl_FragColor ); #endif }`,depthTest:!1,depthWrite:!1}),h=new wi(l,c),p=new kd(-1,1,1,-1,0,1);let g=null,v=null,x=!1,b,w=null,S=[],M=!1;this.setSize=function(A,D){s.setSize(A,D),a.setSize(A,D);for(let R=0;R0&&S[0].isRenderPass===!0;const D=s.width,R=s.height;for(let I=0;I0)return i;const r=e*t;let s=CN[r];if(s===void 0&&(s=new Float32Array(r),CN[r]=s),e!==0){n.toArray(s,0);for(let a=1,l=0;a!==e;++a)l+=t,i[a].toArray(s,l)}return s}function jr(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t0&&(this.seq=r.concat(s))}setValue(e,t,n,r){const s=this.map[t];s!==void 0&&s.setValue(e,n,r)}setOptional(e,t,n){const r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let s=0,a=t.length;s!==a;++s){const l=t[s],c=n[l.id];c.needsUpdate!==!1&&l.setValue(e,c.value,r)}}static seqWithValue(e,t){const n=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in t&&n.push(a)}return n}}function IN(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const $X=37297;let eY=0;function tY(i,e){const t=i.split(` `),n=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=r;a":" "} ${l}: ${t[a]}`)}return n.join(` `)}const PN=new yn;function nY(i){Hn._getMatrix(PN,Hn.workingColorSpace,i);const e=`mat3( ${PN.elements.map(t=>t.toFixed(4))} )`;switch(Hn.getTransfer(i)){case Vv:return[e,"LinearTransferOETF"];case ci:return[e,"sRGBTransferOETF"];default:return Ft("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function ON(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),s=(i.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";const a=/ERROR: 0:(\d+)/.exec(s);if(a){const l=parseInt(a[1]);return t.toUpperCase()+` `+s+` `+tY(i.getShaderSource(e),l)}else return s}function iY(i,e){const t=nY(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` `)}const rY={[vA]:"Linear",[yA]:"Reinhard",[xA]:"Cineon",[Kb]:"ACESFilmic",[bA]:"AgX",[SA]:"Neutral",[_A]:"Custom"};function sY(i,e){const t=rY[e];return t===void 0?(Ft("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const $_=new re;function aY(){Hn.getLuminanceCoefficients($_);const i=$_.x.toFixed(4),e=$_.y.toFixed(4),t=$_.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` `)}function oY(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(J0).join(` `)}function lY(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` `)}function uY(i,e){const t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r/gm;function iE(i){return i.replace(cY,hY)}const fY=new Map;function hY(i,e){let t=wn[e];if(t===void 0){const n=fY.get(e);if(n!==void 0)t=wn[n],Ft('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return iE(t)}const dY=/#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 zN(i){return i.replace(dY,pY)}function pY(i,e,t,n){let r="";for(let s=parseInt(e);s0&&(S+=` `),M=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,b].filter(J0).join(` `),M.length>0&&(M+=` `)):(S=[BN(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,b,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+p:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.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",` `].filter(J0).join(` `),M=[BN(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,b,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.envMap?"#define "+p:"",t.envMap?"#define "+g:"",v?"#define CUBEUV_TEXEL_WIDTH "+v.texelWidth:"",v?"#define CUBEUV_TEXEL_HEIGHT "+v.texelHeight:"",v?"#define CUBEUV_MAX_MIP "+v.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Jo?"#define TONE_MAPPING":"",t.toneMapping!==Jo?wn.tonemapping_pars_fragment:"",t.toneMapping!==Jo?sY("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",wn.colorspace_pars_fragment,iY("linearToOutputTexel",t.outputColorSpace),aY(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` `].filter(J0).join(` `)),a=iE(a),a=FN(a,t),a=kN(a,t),l=iE(l),l=FN(l,t),l=kN(l,t),a=zN(a),l=zN(l),t.isRawShaderMaterial!==!0&&(A=`#version 300 es `,S=[x,"#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` `+S,M=["#define varying in",t.glslVersion===YT?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===YT?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` `)+` `+M);const D=A+S+a,R=A+M+l,I=IN(r,r.VERTEX_SHADER,D),P=IN(r,r.FRAGMENT_SHADER,R);r.attachShader(w,I),r.attachShader(w,P),t.index0AttributeName!==void 0?r.bindAttribLocation(w,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(w,0,"position"),r.linkProgram(w);function F(X){if(i.debug.checkShaderErrors){const W=r.getProgramInfoLog(w)||"",q=r.getShaderInfoLog(I)||"",K=r.getShaderInfoLog(P)||"",ne=W.trim(),j=q.trim(),$=K.trim();let he=!0,le=!0;if(r.getProgramParameter(w,r.LINK_STATUS)===!1)if(he=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,w,I,P);else{const ue=ON(r,I,"vertex"),k=ON(r,P,"fragment");en("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(w,r.VALIDATE_STATUS)+` Material Name: `+X.name+` Material Type: `+X.type+` Program Info Log: `+ne+` `+ue+` `+k)}else ne!==""?Ft("WebGLProgram: Program Info Log:",ne):(j===""||$==="")&&(le=!1);le&&(X.diagnostics={runnable:he,programLog:ne,vertexShader:{log:j,prefix:S},fragmentShader:{log:$,prefix:M}})}r.deleteShader(I),r.deleteShader(P),N=new x1(r,w),L=uY(r,w)}let N;this.getUniforms=function(){return N===void 0&&F(this),N};let L;this.getAttributes=function(){return L===void 0&&F(this),L};let G=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return G===!1&&(G=r.getProgramParameter(w,$X)),G},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(w),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=eY++,this.cacheKey=e,this.usedTimes=1,this.program=w,this.vertexShader=I,this.fragmentShader=P,this}let TY=0;class EY{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new AY(e),t.set(e,n)),n}}class AY{constructor(e){this.id=TY++,this.code=e,this.usedTimes=0}}function CY(i,e,t,n,r,s){const a=new Vm,l=new EY,c=new Set,h=[],p=new Map,g=n.logarithmicDepthBuffer;let v=n.precision;const x={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 b(N){return c.add(N),N===0?"uv":`uv${N}`}function w(N,L,G,X,W){const q=X.fog,K=W.geometry,ne=N.isMeshStandardMaterial||N.isMeshLambertMaterial||N.isMeshPhongMaterial?X.environment:null,j=N.isMeshStandardMaterial||N.isMeshLambertMaterial&&!N.envMap||N.isMeshPhongMaterial&&!N.envMap,$=e.get(N.envMap||ne,j),he=$&&$.mapping===Km?$.image.height:null,le=x[N.type];N.precision!==null&&(v=n.getMaxPrecision(N.precision),v!==N.precision&&Ft("WebGLProgram.getParameters:",N.precision,"not supported, using",v,"instead."));const ue=K.morphAttributes.position||K.morphAttributes.normal||K.morphAttributes.color,k=ue!==void 0?ue.length:0;let Z=0;K.morphAttributes.position!==void 0&&(Z=1),K.morphAttributes.normal!==void 0&&(Z=2),K.morphAttributes.color!==void 0&&(Z=3);let oe,fe,ve,se;if(le){const Zt=Al[le];oe=Zt.vertexShader,fe=Zt.fragmentShader}else oe=N.vertexShader,fe=N.fragmentShader,l.update(N),ve=l.getVertexShaderID(N),se=l.getFragmentShaderID(N);const de=i.getRenderTarget(),be=i.state.buffers.depth.getReversed(),Ge=W.isInstancedMesh===!0,ot=W.isBatchedMesh===!0,Qe=!!N.map,Je=!!N.matcap,Mt=!!$,Le=!!N.aoMap,ze=!!N.lightMap,Ie=!!N.bumpMap,tt=!!N.normalMap,ee=!!N.displacementMap,lt=!!N.emissiveMap,Ye=!!N.metalnessMap,Re=!!N.roughnessMap,We=N.anisotropy>0,Q=N.clearcoat>0,B=N.dispersion>0,ce=N.iridescence>0,Ue=N.sheen>0,Ae=N.transmission>0,Ee=We&&!!N.anisotropyMap,rt=Q&&!!N.clearcoatMap,st=Q&&!!N.clearcoatNormalMap,Et=Q&&!!N.clearcoatRoughnessMap,Nt=ce&&!!N.iridescenceMap,Ve=ce&&!!N.iridescenceThicknessMap,Pe=Ue&&!!N.sheenColorMap,$e=Ue&&!!N.sheenRoughnessMap,ct=!!N.specularMap,mt=!!N.specularColorMap,Gt=!!N.specularIntensityMap,ye=Ae&&!!N.transmissionMap,we=Ae&&!!N.thicknessMap,it=!!N.gradientMap,Lt=!!N.alphaMap,et=N.alphaTest>0,Ne=!!N.alphaHash,Ct=!!N.extensions;let Bt=Jo;N.toneMapped&&(de===null||de.isXRRenderTarget===!0)&&(Bt=i.toneMapping);const Ot={shaderID:le,shaderType:N.type,shaderName:N.name,vertexShader:oe,fragmentShader:fe,defines:N.defines,customVertexShaderID:ve,customFragmentShaderID:se,isRawShaderMaterial:N.isRawShaderMaterial===!0,glslVersion:N.glslVersion,precision:v,batching:ot,batchingColor:ot&&W._colorsTexture!==null,instancing:Ge,instancingColor:Ge&&W.instanceColor!==null,instancingMorph:Ge&&W.morphTexture!==null,outputColorSpace:de===null?i.outputColorSpace:de.isXRRenderTarget===!0?de.texture.colorSpace:Pl,alphaToCoverage:!!N.alphaToCoverage,map:Qe,matcap:Je,envMap:Mt,envMapMode:Mt&&$.mapping,envMapCubeUVHeight:he,aoMap:Le,lightMap:ze,bumpMap:Ie,normalMap:tt,displacementMap:ee,emissiveMap:lt,normalMapObjectSpace:tt&&N.normalMapType===rO,normalMapTangentSpace:tt&&N.normalMapType===Kf,metalnessMap:Ye,roughnessMap:Re,anisotropy:We,anisotropyMap:Ee,clearcoat:Q,clearcoatMap:rt,clearcoatNormalMap:st,clearcoatRoughnessMap:Et,dispersion:B,iridescence:ce,iridescenceMap:Nt,iridescenceThicknessMap:Ve,sheen:Ue,sheenColorMap:Pe,sheenRoughnessMap:$e,specularMap:ct,specularColorMap:mt,specularIntensityMap:Gt,transmission:Ae,transmissionMap:ye,thicknessMap:we,gradientMap:it,opaque:N.transparent===!1&&N.blending===bd&&N.alphaToCoverage===!1,alphaMap:Lt,alphaTest:et,alphaHash:Ne,combine:N.combine,mapUv:Qe&&b(N.map.channel),aoMapUv:Le&&b(N.aoMap.channel),lightMapUv:ze&&b(N.lightMap.channel),bumpMapUv:Ie&&b(N.bumpMap.channel),normalMapUv:tt&&b(N.normalMap.channel),displacementMapUv:ee&&b(N.displacementMap.channel),emissiveMapUv:lt&&b(N.emissiveMap.channel),metalnessMapUv:Ye&&b(N.metalnessMap.channel),roughnessMapUv:Re&&b(N.roughnessMap.channel),anisotropyMapUv:Ee&&b(N.anisotropyMap.channel),clearcoatMapUv:rt&&b(N.clearcoatMap.channel),clearcoatNormalMapUv:st&&b(N.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Et&&b(N.clearcoatRoughnessMap.channel),iridescenceMapUv:Nt&&b(N.iridescenceMap.channel),iridescenceThicknessMapUv:Ve&&b(N.iridescenceThicknessMap.channel),sheenColorMapUv:Pe&&b(N.sheenColorMap.channel),sheenRoughnessMapUv:$e&&b(N.sheenRoughnessMap.channel),specularMapUv:ct&&b(N.specularMap.channel),specularColorMapUv:mt&&b(N.specularColorMap.channel),specularIntensityMapUv:Gt&&b(N.specularIntensityMap.channel),transmissionMapUv:ye&&b(N.transmissionMap.channel),thicknessMapUv:we&&b(N.thicknessMap.channel),alphaMapUv:Lt&&b(N.alphaMap.channel),vertexTangents:!!K.attributes.tangent&&(tt||We),vertexColors:N.vertexColors,vertexAlphas:N.vertexColors===!0&&!!K.attributes.color&&K.attributes.color.itemSize===4,pointsUvs:W.isPoints===!0&&!!K.attributes.uv&&(Qe||Lt),fog:!!q,useFog:N.fog===!0,fogExp2:!!q&&q.isFogExp2,flatShading:N.wireframe===!1&&(N.flatShading===!0||K.attributes.normal===void 0&&tt===!1&&(N.isMeshLambertMaterial||N.isMeshPhongMaterial||N.isMeshStandardMaterial||N.isMeshPhysicalMaterial)),sizeAttenuation:N.sizeAttenuation===!0,logarithmicDepthBuffer:g,reversedDepthBuffer:be,skinning:W.isSkinnedMesh===!0,morphTargets:K.morphAttributes.position!==void 0,morphNormals:K.morphAttributes.normal!==void 0,morphColors:K.morphAttributes.color!==void 0,morphTargetsCount:k,morphTextureStride:Z,numDirLights:L.directional.length,numPointLights:L.point.length,numSpotLights:L.spot.length,numSpotLightMaps:L.spotLightMap.length,numRectAreaLights:L.rectArea.length,numHemiLights:L.hemi.length,numDirLightShadows:L.directionalShadowMap.length,numPointLightShadows:L.pointShadowMap.length,numSpotLightShadows:L.spotShadowMap.length,numSpotLightShadowsWithMaps:L.numSpotLightShadowsWithMaps,numLightProbes:L.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:N.dithering,shadowMapEnabled:i.shadowMap.enabled&&G.length>0,shadowMapType:i.shadowMap.type,toneMapping:Bt,decodeVideoTexture:Qe&&N.map.isVideoTexture===!0&&Hn.getTransfer(N.map.colorSpace)===ci,decodeVideoTextureEmissive:lt&&N.emissiveMap.isVideoTexture===!0&&Hn.getTransfer(N.emissiveMap.colorSpace)===ci,premultipliedAlpha:N.premultipliedAlpha,doubleSided:N.side===io,flipSided:N.side===ca,useDepthPacking:N.depthPacking>=0,depthPacking:N.depthPacking||0,index0AttributeName:N.index0AttributeName,extensionClipCullDistance:Ct&&N.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ct&&N.extensions.multiDraw===!0||ot)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:N.customProgramCacheKey()};return Ot.vertexUv1s=c.has(1),Ot.vertexUv2s=c.has(2),Ot.vertexUv3s=c.has(3),c.clear(),Ot}function S(N){const L=[];if(N.shaderID?L.push(N.shaderID):(L.push(N.customVertexShaderID),L.push(N.customFragmentShaderID)),N.defines!==void 0)for(const G in N.defines)L.push(G),L.push(N.defines[G]);return N.isRawShaderMaterial===!1&&(M(L,N),A(L,N),L.push(i.outputColorSpace)),L.push(N.customProgramCacheKey),L.join()}function M(N,L){N.push(L.precision),N.push(L.outputColorSpace),N.push(L.envMapMode),N.push(L.envMapCubeUVHeight),N.push(L.mapUv),N.push(L.alphaMapUv),N.push(L.lightMapUv),N.push(L.aoMapUv),N.push(L.bumpMapUv),N.push(L.normalMapUv),N.push(L.displacementMapUv),N.push(L.emissiveMapUv),N.push(L.metalnessMapUv),N.push(L.roughnessMapUv),N.push(L.anisotropyMapUv),N.push(L.clearcoatMapUv),N.push(L.clearcoatNormalMapUv),N.push(L.clearcoatRoughnessMapUv),N.push(L.iridescenceMapUv),N.push(L.iridescenceThicknessMapUv),N.push(L.sheenColorMapUv),N.push(L.sheenRoughnessMapUv),N.push(L.specularMapUv),N.push(L.specularColorMapUv),N.push(L.specularIntensityMapUv),N.push(L.transmissionMapUv),N.push(L.thicknessMapUv),N.push(L.combine),N.push(L.fogExp2),N.push(L.sizeAttenuation),N.push(L.morphTargetsCount),N.push(L.morphAttributeCount),N.push(L.numDirLights),N.push(L.numPointLights),N.push(L.numSpotLights),N.push(L.numSpotLightMaps),N.push(L.numHemiLights),N.push(L.numRectAreaLights),N.push(L.numDirLightShadows),N.push(L.numPointLightShadows),N.push(L.numSpotLightShadows),N.push(L.numSpotLightShadowsWithMaps),N.push(L.numLightProbes),N.push(L.shadowMapType),N.push(L.toneMapping),N.push(L.numClippingPlanes),N.push(L.numClipIntersection),N.push(L.depthPacking)}function A(N,L){a.disableAll(),L.instancing&&a.enable(0),L.instancingColor&&a.enable(1),L.instancingMorph&&a.enable(2),L.matcap&&a.enable(3),L.envMap&&a.enable(4),L.normalMapObjectSpace&&a.enable(5),L.normalMapTangentSpace&&a.enable(6),L.clearcoat&&a.enable(7),L.iridescence&&a.enable(8),L.alphaTest&&a.enable(9),L.vertexColors&&a.enable(10),L.vertexAlphas&&a.enable(11),L.vertexUv1s&&a.enable(12),L.vertexUv2s&&a.enable(13),L.vertexUv3s&&a.enable(14),L.vertexTangents&&a.enable(15),L.anisotropy&&a.enable(16),L.alphaHash&&a.enable(17),L.batching&&a.enable(18),L.dispersion&&a.enable(19),L.batchingColor&&a.enable(20),L.gradientMap&&a.enable(21),N.push(a.mask),a.disableAll(),L.fog&&a.enable(0),L.useFog&&a.enable(1),L.flatShading&&a.enable(2),L.logarithmicDepthBuffer&&a.enable(3),L.reversedDepthBuffer&&a.enable(4),L.skinning&&a.enable(5),L.morphTargets&&a.enable(6),L.morphNormals&&a.enable(7),L.morphColors&&a.enable(8),L.premultipliedAlpha&&a.enable(9),L.shadowMapEnabled&&a.enable(10),L.doubleSided&&a.enable(11),L.flipSided&&a.enable(12),L.useDepthPacking&&a.enable(13),L.dithering&&a.enable(14),L.transmission&&a.enable(15),L.sheen&&a.enable(16),L.opaque&&a.enable(17),L.pointsUvs&&a.enable(18),L.decodeVideoTexture&&a.enable(19),L.decodeVideoTextureEmissive&&a.enable(20),L.alphaToCoverage&&a.enable(21),N.push(a.mask)}function D(N){const L=x[N.type];let G;if(L){const X=Al[L];G=GA.clone(X.uniforms)}else G=N.uniforms;return G}function R(N,L){let G=p.get(L);return G!==void 0?++G.usedTimes:(G=new wY(i,L,N,r),h.push(G),p.set(L,G)),G}function I(N){if(--N.usedTimes===0){const L=h.indexOf(N);h[L]=h[h.length-1],h.pop(),p.delete(N.cacheKey),N.destroy()}}function P(N){l.remove(N)}function F(){l.dispose()}return{getParameters:w,getProgramCacheKey:S,getUniforms:D,acquireProgram:R,releaseProgram:I,releaseShaderCache:P,programs:h,dispose:F}}function RY(){let i=new WeakMap;function e(a){return i.has(a)}function t(a){let l=i.get(a);return l===void 0&&(l={},i.set(a,l)),l}function n(a){i.delete(a)}function r(a,l,c){i.get(a)[l]=c}function s(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:s}}function DY(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.materialVariant!==e.materialVariant?i.materialVariant-e.materialVariant:i.z!==e.z?i.z-e.z:i.id-e.id}function VN(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function GN(){const i=[];let e=0;const t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function a(v){let x=0;return v.isInstancedMesh&&(x+=2),v.isSkinnedMesh&&(x+=1),x}function l(v,x,b,w,S,M){let A=i[e];return A===void 0?(A={id:v.id,object:v,geometry:x,material:b,materialVariant:a(v),groupOrder:w,renderOrder:v.renderOrder,z:S,group:M},i[e]=A):(A.id=v.id,A.object=v,A.geometry=x,A.material=b,A.materialVariant=a(v),A.groupOrder=w,A.renderOrder=v.renderOrder,A.z=S,A.group=M),e++,A}function c(v,x,b,w,S,M){const A=l(v,x,b,w,S,M);b.transmission>0?n.push(A):b.transparent===!0?r.push(A):t.push(A)}function h(v,x,b,w,S,M){const A=l(v,x,b,w,S,M);b.transmission>0?n.unshift(A):b.transparent===!0?r.unshift(A):t.unshift(A)}function p(v,x){t.length>1&&t.sort(v||DY),n.length>1&&n.sort(x||VN),r.length>1&&r.sort(x||VN)}function g(){for(let v=e,x=i.length;v=s.length?(a=new GN,s.push(a)):a=s[r],a}function t(){i=new WeakMap}return{get:e,dispose:t}}function UY(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new re,color:new zt};break;case"SpotLight":t={position:new re,direction:new re,color:new zt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new re,color:new zt,distance:0,decay:0};break;case"HemisphereLight":t={direction:new re,skyColor:new zt,groundColor:new zt};break;case"RectAreaLight":t={color:new zt,position:new re,halfWidth:new re,halfHeight:new re};break}return i[e.id]=t,t}}}function LY(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new pt};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new pt};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new pt,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let IY=0;function PY(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function OY(i){const e=new UY,t=LY(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let h=0;h<9;h++)n.probe.push(new re);const r=new re,s=new un,a=new un;function l(h){let p=0,g=0,v=0;for(let L=0;L<9;L++)n.probe[L].set(0,0,0);let x=0,b=0,w=0,S=0,M=0,A=0,D=0,R=0,I=0,P=0,F=0;h.sort(PY);for(let L=0,G=h.length;L0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Vt.LTC_FLOAT_1,n.rectAreaLTC2=Vt.LTC_FLOAT_2):(n.rectAreaLTC1=Vt.LTC_HALF_1,n.rectAreaLTC2=Vt.LTC_HALF_2)),n.ambient[0]=p,n.ambient[1]=g,n.ambient[2]=v;const N=n.hash;(N.directionalLength!==x||N.pointLength!==b||N.spotLength!==w||N.rectAreaLength!==S||N.hemiLength!==M||N.numDirectionalShadows!==A||N.numPointShadows!==D||N.numSpotShadows!==R||N.numSpotMaps!==I||N.numLightProbes!==F)&&(n.directional.length=x,n.spot.length=w,n.rectArea.length=S,n.point.length=b,n.hemi.length=M,n.directionalShadow.length=A,n.directionalShadowMap.length=A,n.pointShadow.length=D,n.pointShadowMap.length=D,n.spotShadow.length=R,n.spotShadowMap.length=R,n.directionalShadowMatrix.length=A,n.pointShadowMatrix.length=D,n.spotLightMatrix.length=R+I-P,n.spotLightMap.length=I,n.numSpotLightShadowsWithMaps=P,n.numLightProbes=F,N.directionalLength=x,N.pointLength=b,N.spotLength=w,N.rectAreaLength=S,N.hemiLength=M,N.numDirectionalShadows=A,N.numPointShadows=D,N.numSpotShadows=R,N.numSpotMaps=I,N.numLightProbes=F,n.version=IY++)}function c(h,p){let g=0,v=0,x=0,b=0,w=0;const S=p.matrixWorldInverse;for(let M=0,A=h.length;M=a.length?(l=new HN(i),a.push(l)):l=a[s],l}function n(){e=new WeakMap}return{get:t,dispose:n}}const kY=`void main() { gl_Position = vec4( position, 1.0 ); }`,zY=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; void main() { const float samples = float( VSM_SAMPLES ); float mean = 0.0; float squared_mean = 0.0; float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); float uvStart = samples <= 1.0 ? 0.0 : - 1.0; for ( float i = 0.0; i < samples; i ++ ) { float uvOffset = uvStart + i * uvStride; #ifdef HORIZONTAL_PASS vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg; mean += distribution.x; squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; #else float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r; mean += depth; squared_mean += depth * depth; #endif } mean = mean / samples; squared_mean = squared_mean / samples; float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); }`,BY=[new re(1,0,0),new re(-1,0,0),new re(0,1,0),new re(0,-1,0),new re(0,0,1),new re(0,0,-1)],VY=[new re(0,-1,0),new re(0,-1,0),new re(0,0,1),new re(0,0,-1),new re(0,-1,0),new re(0,-1,0)],WN=new un,B0=new re,Pw=new re;function GY(i,e,t){let n=new Jm;const r=new pt,s=new pt,a=new fi,l=new yy,c=new ES,h={},p=t.maxTextureSize,g={[Cc]:ca,[ca]:Cc,[io]:io},v=new ls({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new pt},radius:{value:4}},vertexShader:kY,fragmentShader:zY}),x=v.clone();x.defines.HORIZONTAL_PASS=1;const b=new xn;b.setAttribute("position",new _i(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const w=new wi(b,v),S=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Tm;let M=this.type;this.render=function(P,F,N){if(S.enabled===!1||S.autoUpdate===!1&&S.needsUpdate===!1||P.length===0)return;this.type===uv&&(Ft("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Tm);const L=i.getRenderTarget(),G=i.getActiveCubeFace(),X=i.getActiveMipmapLevel(),W=i.state;W.setBlending(Nl),W.buffers.depth.getReversed()===!0?W.buffers.color.setClear(0,0,0,0):W.buffers.color.setClear(1,1,1,1),W.buffers.depth.setTest(!0),W.setScissorTest(!1);const q=M!==this.type;q&&F.traverse(function(K){K.material&&(Array.isArray(K.material)?K.material.forEach(ne=>ne.needsUpdate=!0):K.material.needsUpdate=!0)});for(let K=0,ne=P.length;Kp||r.y>p)&&(r.x>p&&(s.x=Math.floor(p/he.x),r.x=s.x*he.x,$.mapSize.x=s.x),r.y>p&&(s.y=Math.floor(p/he.y),r.y=s.y*he.y,$.mapSize.y=s.y));const le=i.state.buffers.depth.getReversed();if($.camera._reversedDepth=le,$.map===null||q===!0){if($.map!==null&&($.map.depthTexture!==null&&($.map.depthTexture.dispose(),$.map.depthTexture=null),$.map.dispose()),this.type===od){if(j.isPointLight){Ft("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}$.map=new rs(r.x,r.y,{format:Ad,type:ar,minFilter:In,magFilter:In,generateMipmaps:!1}),$.map.texture.name=j.name+".shadowMap",$.map.depthTexture=new Nd(r.x,r.y,Gi),$.map.depthTexture.name=j.name+".shadowMapDepth",$.map.depthTexture.format=Lu,$.map.depthTexture.compareFunction=null,$.map.depthTexture.minFilter=Er,$.map.depthTexture.magFilter=Er}else j.isPointLight?($.map=new NS(r.x),$.map.depthTexture=new TO(r.x,po)):($.map=new rs(r.x,r.y),$.map.depthTexture=new Nd(r.x,r.y,po)),$.map.depthTexture.name=j.name+".shadowMap",$.map.depthTexture.format=Lu,this.type===Tm?($.map.depthTexture.compareFunction=le?sS:rS,$.map.depthTexture.minFilter=In,$.map.depthTexture.magFilter=In):($.map.depthTexture.compareFunction=null,$.map.depthTexture.minFilter=Er,$.map.depthTexture.magFilter=Er);$.camera.updateProjectionMatrix()}const ue=$.map.isWebGLCubeRenderTarget?6:1;for(let k=0;k0||F.map&&F.alphaTest>0||F.alphaToCoverage===!0){const W=G.uuid,q=F.uuid;let K=h[W];K===void 0&&(K={},h[W]=K);let ne=K[q];ne===void 0&&(ne=G.clone(),K[q]=ne,F.addEventListener("dispose",I)),G=ne}if(G.visible=F.visible,G.wireframe=F.wireframe,L===od?G.side=F.shadowSide!==null?F.shadowSide:F.side:G.side=F.shadowSide!==null?F.shadowSide:g[F.side],G.alphaMap=F.alphaMap,G.alphaTest=F.alphaToCoverage===!0?.5:F.alphaTest,G.map=F.map,G.clipShadows=F.clipShadows,G.clippingPlanes=F.clippingPlanes,G.clipIntersection=F.clipIntersection,G.displacementMap=F.displacementMap,G.displacementScale=F.displacementScale,G.displacementBias=F.displacementBias,G.wireframeLinewidth=F.wireframeLinewidth,G.linewidth=F.linewidth,N.isPointLight===!0&&G.isMeshDistanceMaterial===!0){const W=i.properties.get(G);W.light=N}return G}function R(P,F,N,L,G){if(P.visible===!1)return;if(P.layers.test(F.layers)&&(P.isMesh||P.isLine||P.isPoints)&&(P.castShadow||P.receiveShadow&&G===od)&&(!P.frustumCulled||n.intersectsObject(P))){P.modelViewMatrix.multiplyMatrices(N.matrixWorldInverse,P.matrixWorld);const q=e.update(P),K=P.material;if(Array.isArray(K)){const ne=q.groups;for(let j=0,$=ne.length;j<$;j++){const he=ne[j],le=K[he.materialIndex];if(le&&le.visible){const ue=D(P,le,L,G);P.onBeforeShadow(i,P,F,N,q,ue,he),i.renderBufferDirect(N,null,q,ue,P,he),P.onAfterShadow(i,P,F,N,q,ue,he)}}}else if(K.visible){const ne=D(P,K,L,G);P.onBeforeShadow(i,P,F,N,q,ne,null),i.renderBufferDirect(N,null,q,ne,P,null),P.onAfterShadow(i,P,F,N,q,ne,null)}}const W=P.children;for(let q=0,K=W.length;q=1):he.indexOf("OpenGL ES")!==-1&&($=parseFloat(/^OpenGL ES (\d)/.exec(he)[1]),j=$>=2);let le=null,ue={};const k=i.getParameter(i.SCISSOR_BOX),Z=i.getParameter(i.VIEWPORT),oe=new fi().fromArray(k),fe=new fi().fromArray(Z);function ve(ye,we,it,Lt){const et=new Uint8Array(4),Ne=i.createTexture();i.bindTexture(ye,Ne),i.texParameteri(ye,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(ye,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Ct=0;Ct"u"?!1:/OculusBrowser/g.test(navigator.userAgent),h=new pt,p=new WeakMap;let g;const v=new WeakMap;let x=!1;try{x=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function b(Q,B){return x?new OffscreenCanvas(Q,B):Hv("canvas")}function w(Q,B,ce){let Ue=1;const Ae=We(Q);if((Ae.width>ce||Ae.height>ce)&&(Ue=ce/Math.max(Ae.width,Ae.height)),Ue<1)if(typeof HTMLImageElement<"u"&&Q instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&Q instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&Q instanceof ImageBitmap||typeof VideoFrame<"u"&&Q instanceof VideoFrame){const Ee=Math.floor(Ue*Ae.width),rt=Math.floor(Ue*Ae.height);g===void 0&&(g=b(Ee,rt));const st=B?b(Ee,rt):g;return st.width=Ee,st.height=rt,st.getContext("2d").drawImage(Q,0,0,Ee,rt),Ft("WebGLRenderer: Texture has been resized from ("+Ae.width+"x"+Ae.height+") to ("+Ee+"x"+rt+")."),st}else return"data"in Q&&Ft("WebGLRenderer: Image in DataTexture is too big ("+Ae.width+"x"+Ae.height+")."),Q;return Q}function S(Q){return Q.generateMipmaps}function M(Q){i.generateMipmap(Q)}function A(Q){return Q.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:Q.isWebGL3DRenderTarget?i.TEXTURE_3D:Q.isWebGLArrayRenderTarget||Q.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function D(Q,B,ce,Ue,Ae=!1){if(Q!==null){if(i[Q]!==void 0)return i[Q];Ft("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+Q+"'")}let Ee=B;if(B===i.RED&&(ce===i.FLOAT&&(Ee=i.R32F),ce===i.HALF_FLOAT&&(Ee=i.R16F),ce===i.UNSIGNED_BYTE&&(Ee=i.R8)),B===i.RED_INTEGER&&(ce===i.UNSIGNED_BYTE&&(Ee=i.R8UI),ce===i.UNSIGNED_SHORT&&(Ee=i.R16UI),ce===i.UNSIGNED_INT&&(Ee=i.R32UI),ce===i.BYTE&&(Ee=i.R8I),ce===i.SHORT&&(Ee=i.R16I),ce===i.INT&&(Ee=i.R32I)),B===i.RG&&(ce===i.FLOAT&&(Ee=i.RG32F),ce===i.HALF_FLOAT&&(Ee=i.RG16F),ce===i.UNSIGNED_BYTE&&(Ee=i.RG8)),B===i.RG_INTEGER&&(ce===i.UNSIGNED_BYTE&&(Ee=i.RG8UI),ce===i.UNSIGNED_SHORT&&(Ee=i.RG16UI),ce===i.UNSIGNED_INT&&(Ee=i.RG32UI),ce===i.BYTE&&(Ee=i.RG8I),ce===i.SHORT&&(Ee=i.RG16I),ce===i.INT&&(Ee=i.RG32I)),B===i.RGB_INTEGER&&(ce===i.UNSIGNED_BYTE&&(Ee=i.RGB8UI),ce===i.UNSIGNED_SHORT&&(Ee=i.RGB16UI),ce===i.UNSIGNED_INT&&(Ee=i.RGB32UI),ce===i.BYTE&&(Ee=i.RGB8I),ce===i.SHORT&&(Ee=i.RGB16I),ce===i.INT&&(Ee=i.RGB32I)),B===i.RGBA_INTEGER&&(ce===i.UNSIGNED_BYTE&&(Ee=i.RGBA8UI),ce===i.UNSIGNED_SHORT&&(Ee=i.RGBA16UI),ce===i.UNSIGNED_INT&&(Ee=i.RGBA32UI),ce===i.BYTE&&(Ee=i.RGBA8I),ce===i.SHORT&&(Ee=i.RGBA16I),ce===i.INT&&(Ee=i.RGBA32I)),B===i.RGB&&(ce===i.UNSIGNED_INT_5_9_9_9_REV&&(Ee=i.RGB9_E5),ce===i.UNSIGNED_INT_10F_11F_11F_REV&&(Ee=i.R11F_G11F_B10F)),B===i.RGBA){const rt=Ae?Vv:Hn.getTransfer(Ue);ce===i.FLOAT&&(Ee=i.RGBA32F),ce===i.HALF_FLOAT&&(Ee=i.RGBA16F),ce===i.UNSIGNED_BYTE&&(Ee=rt===ci?i.SRGB8_ALPHA8:i.RGBA8),ce===i.UNSIGNED_SHORT_4_4_4_4&&(Ee=i.RGBA4),ce===i.UNSIGNED_SHORT_5_5_5_1&&(Ee=i.RGB5_A1)}return(Ee===i.R16F||Ee===i.R32F||Ee===i.RG16F||Ee===i.RG32F||Ee===i.RGBA16F||Ee===i.RGBA32F)&&e.get("EXT_color_buffer_float"),Ee}function R(Q,B){let ce;return Q?B===null||B===po||B===km?ce=i.DEPTH24_STENCIL8:B===Gi?ce=i.DEPTH32F_STENCIL8:B===Fm&&(ce=i.DEPTH24_STENCIL8,Ft("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):B===null||B===po||B===km?ce=i.DEPTH_COMPONENT24:B===Gi?ce=i.DEPTH_COMPONENT32F:B===Fm&&(ce=i.DEPTH_COMPONENT16),ce}function I(Q,B){return S(Q)===!0||Q.isFramebufferTexture&&Q.minFilter!==Er&&Q.minFilter!==In?Math.log2(Math.max(B.width,B.height))+1:Q.mipmaps!==void 0&&Q.mipmaps.length>0?Q.mipmaps.length:Q.isCompressedTexture&&Array.isArray(Q.image)?B.mipmaps.length:1}function P(Q){const B=Q.target;B.removeEventListener("dispose",P),N(B),B.isVideoTexture&&p.delete(B)}function F(Q){const B=Q.target;B.removeEventListener("dispose",F),G(B)}function N(Q){const B=n.get(Q);if(B.__webglInit===void 0)return;const ce=Q.source,Ue=v.get(ce);if(Ue){const Ae=Ue[B.__cacheKey];Ae.usedTimes--,Ae.usedTimes===0&&L(Q),Object.keys(Ue).length===0&&v.delete(ce)}n.remove(Q)}function L(Q){const B=n.get(Q);i.deleteTexture(B.__webglTexture);const ce=Q.source,Ue=v.get(ce);delete Ue[B.__cacheKey],a.memory.textures--}function G(Q){const B=n.get(Q);if(Q.depthTexture&&(Q.depthTexture.dispose(),n.remove(Q.depthTexture)),Q.isWebGLCubeRenderTarget)for(let Ue=0;Ue<6;Ue++){if(Array.isArray(B.__webglFramebuffer[Ue]))for(let Ae=0;Ae=r.maxTextures&&Ft("WebGLTextures: Trying to use "+Q+" texture units while this GPU supports only "+r.maxTextures),X+=1,Q}function K(Q){const B=[];return B.push(Q.wrapS),B.push(Q.wrapT),B.push(Q.wrapR||0),B.push(Q.magFilter),B.push(Q.minFilter),B.push(Q.anisotropy),B.push(Q.internalFormat),B.push(Q.format),B.push(Q.type),B.push(Q.generateMipmaps),B.push(Q.premultiplyAlpha),B.push(Q.flipY),B.push(Q.unpackAlignment),B.push(Q.colorSpace),B.join()}function ne(Q,B){const ce=n.get(Q);if(Q.isVideoTexture&&Ye(Q),Q.isRenderTargetTexture===!1&&Q.isExternalTexture!==!0&&Q.version>0&&ce.__version!==Q.version){const Ue=Q.image;if(Ue===null)Ft("WebGLRenderer: Texture marked for update but no image data found.");else if(Ue.complete===!1)Ft("WebGLRenderer: Texture marked for update but image is incomplete");else{se(ce,Q,B);return}}else Q.isExternalTexture&&(ce.__webglTexture=Q.sourceTexture?Q.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,ce.__webglTexture,i.TEXTURE0+B)}function j(Q,B){const ce=n.get(Q);if(Q.isRenderTargetTexture===!1&&Q.version>0&&ce.__version!==Q.version){se(ce,Q,B);return}else Q.isExternalTexture&&(ce.__webglTexture=Q.sourceTexture?Q.sourceTexture:null);t.bindTexture(i.TEXTURE_2D_ARRAY,ce.__webglTexture,i.TEXTURE0+B)}function $(Q,B){const ce=n.get(Q);if(Q.isRenderTargetTexture===!1&&Q.version>0&&ce.__version!==Q.version){se(ce,Q,B);return}t.bindTexture(i.TEXTURE_3D,ce.__webglTexture,i.TEXTURE0+B)}function he(Q,B){const ce=n.get(Q);if(Q.isCubeDepthTexture!==!0&&Q.version>0&&ce.__version!==Q.version){de(ce,Q,B);return}t.bindTexture(i.TEXTURE_CUBE_MAP,ce.__webglTexture,i.TEXTURE0+B)}const le={[Fv]:i.REPEAT,[vr]:i.CLAMP_TO_EDGE,[kv]:i.MIRRORED_REPEAT},ue={[Er]:i.NEAREST,[MA]:i.NEAREST_MIPMAP_NEAREST,[xm]:i.NEAREST_MIPMAP_LINEAR,[In]:i.LINEAR,[fv]:i.LINEAR_MIPMAP_NEAREST,[Cu]:i.LINEAR_MIPMAP_LINEAR},k={[sO]:i.NEVER,[cO]:i.ALWAYS,[aO]:i.LESS,[rS]:i.LEQUAL,[oO]:i.EQUAL,[sS]:i.GEQUAL,[lO]:i.GREATER,[uO]:i.NOTEQUAL};function Z(Q,B){if(B.type===Gi&&e.has("OES_texture_float_linear")===!1&&(B.magFilter===In||B.magFilter===fv||B.magFilter===xm||B.magFilter===Cu||B.minFilter===In||B.minFilter===fv||B.minFilter===xm||B.minFilter===Cu)&&Ft("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(Q,i.TEXTURE_WRAP_S,le[B.wrapS]),i.texParameteri(Q,i.TEXTURE_WRAP_T,le[B.wrapT]),(Q===i.TEXTURE_3D||Q===i.TEXTURE_2D_ARRAY)&&i.texParameteri(Q,i.TEXTURE_WRAP_R,le[B.wrapR]),i.texParameteri(Q,i.TEXTURE_MAG_FILTER,ue[B.magFilter]),i.texParameteri(Q,i.TEXTURE_MIN_FILTER,ue[B.minFilter]),B.compareFunction&&(i.texParameteri(Q,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(Q,i.TEXTURE_COMPARE_FUNC,k[B.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(B.magFilter===Er||B.minFilter!==xm&&B.minFilter!==Cu||B.type===Gi&&e.has("OES_texture_float_linear")===!1)return;if(B.anisotropy>1||n.get(B).__currentAnisotropy){const ce=e.get("EXT_texture_filter_anisotropic");i.texParameterf(Q,ce.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(B.anisotropy,r.getMaxAnisotropy())),n.get(B).__currentAnisotropy=B.anisotropy}}}function oe(Q,B){let ce=!1;Q.__webglInit===void 0&&(Q.__webglInit=!0,B.addEventListener("dispose",P));const Ue=B.source;let Ae=v.get(Ue);Ae===void 0&&(Ae={},v.set(Ue,Ae));const Ee=K(B);if(Ee!==Q.__cacheKey){Ae[Ee]===void 0&&(Ae[Ee]={texture:i.createTexture(),usedTimes:0},a.memory.textures++,ce=!0),Ae[Ee].usedTimes++;const rt=Ae[Q.__cacheKey];rt!==void 0&&(Ae[Q.__cacheKey].usedTimes--,rt.usedTimes===0&&L(B)),Q.__cacheKey=Ee,Q.__webglTexture=Ae[Ee].texture}return ce}function fe(Q,B,ce){return Math.floor(Math.floor(Q/ce)/B)}function ve(Q,B,ce,Ue){const Ee=Q.updateRanges;if(Ee.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,B.width,B.height,ce,Ue,B.data);else{Ee.sort((Ve,Pe)=>Ve.start-Pe.start);let rt=0;for(let Ve=1;Ve0){ye&&we&&t.texStorage2D(i.TEXTURE_2D,Lt,ct,Gt[0].width,Gt[0].height);for(let et=0,Ne=Gt.length;et0){const Ct=eE(mt.width,mt.height,B.format,B.type);for(const Bt of B.layerUpdates){const Ot=mt.data.subarray(Bt*Ct/mt.data.BYTES_PER_ELEMENT,(Bt+1)*Ct/mt.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,et,0,0,Bt,mt.width,mt.height,1,Pe,Ot)}B.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,et,0,0,0,mt.width,mt.height,Ve.depth,Pe,mt.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,et,ct,mt.width,mt.height,Ve.depth,0,mt.data,0,0);else Ft("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else ye?it&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,et,0,0,0,mt.width,mt.height,Ve.depth,Pe,$e,mt.data):t.texImage3D(i.TEXTURE_2D_ARRAY,et,ct,mt.width,mt.height,Ve.depth,0,Pe,$e,mt.data)}else{ye&&we&&t.texStorage2D(i.TEXTURE_2D,Lt,ct,Gt[0].width,Gt[0].height);for(let et=0,Ne=Gt.length;et0){const et=eE(Ve.width,Ve.height,B.format,B.type);for(const Ne of B.layerUpdates){const Ct=Ve.data.subarray(Ne*et/Ve.data.BYTES_PER_ELEMENT,(Ne+1)*et/Ve.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,Ne,Ve.width,Ve.height,1,Pe,$e,Ct)}B.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Ve.width,Ve.height,Ve.depth,Pe,$e,Ve.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,ct,Ve.width,Ve.height,Ve.depth,0,Pe,$e,Ve.data);else if(B.isData3DTexture)ye?(we&&t.texStorage3D(i.TEXTURE_3D,Lt,ct,Ve.width,Ve.height,Ve.depth),it&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,Ve.width,Ve.height,Ve.depth,Pe,$e,Ve.data)):t.texImage3D(i.TEXTURE_3D,0,ct,Ve.width,Ve.height,Ve.depth,0,Pe,$e,Ve.data);else if(B.isFramebufferTexture){if(we)if(ye)t.texStorage2D(i.TEXTURE_2D,Lt,ct,Ve.width,Ve.height);else{let et=Ve.width,Ne=Ve.height;for(let Ct=0;Ct>=1,Ne>>=1}}else if(Gt.length>0){if(ye&&we){const et=We(Gt[0]);t.texStorage2D(i.TEXTURE_2D,Lt,ct,et.width,et.height)}for(let et=0,Ne=Gt.length;et0&&Lt++;const Ne=We(Pe[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,Lt,Gt,Ne.width,Ne.height)}for(let Ne=0;Ne<6;Ne++)if(Ve){ye?it&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,0,0,0,Pe[Ne].width,Pe[Ne].height,ct,mt,Pe[Ne].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Ne,0,Gt,Pe[Ne].width,Pe[Ne].height,0,ct,mt,Pe[Ne].data);for(let Ct=0;Ct>Ee),$e=Math.max(1,B.height>>Ee);Ae===i.TEXTURE_3D||Ae===i.TEXTURE_2D_ARRAY?t.texImage3D(Ae,Ee,Et,Pe,$e,B.depth,0,rt,st,null):t.texImage2D(Ae,Ee,Et,Pe,$e,0,rt,st,null)}t.bindFramebuffer(i.FRAMEBUFFER,Q),lt(B)?l.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Ue,Ae,Ve.__webglTexture,0,ee(B)):(Ae===i.TEXTURE_2D||Ae>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&Ae<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,Ue,Ae,Ve.__webglTexture,Ee),t.bindFramebuffer(i.FRAMEBUFFER,null)}function Ge(Q,B,ce){if(i.bindRenderbuffer(i.RENDERBUFFER,Q),B.depthBuffer){const Ue=B.depthTexture,Ae=Ue&&Ue.isDepthTexture?Ue.type:null,Ee=R(B.stencilBuffer,Ae),rt=B.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;lt(B)?l.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,ee(B),Ee,B.width,B.height):ce?i.renderbufferStorageMultisample(i.RENDERBUFFER,ee(B),Ee,B.width,B.height):i.renderbufferStorage(i.RENDERBUFFER,Ee,B.width,B.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,rt,i.RENDERBUFFER,Q)}else{const Ue=B.textures;for(let Ae=0;Ae{delete B.__boundDepthTexture,delete B.__depthDisposeCallback,Ue.removeEventListener("dispose",Ae)};Ue.addEventListener("dispose",Ae),B.__depthDisposeCallback=Ae}B.__boundDepthTexture=Ue}if(Q.depthTexture&&!B.__autoAllocateDepthBuffer)if(ce)for(let Ue=0;Ue<6;Ue++)ot(B.__webglFramebuffer[Ue],Q,Ue);else{const Ue=Q.texture.mipmaps;Ue&&Ue.length>0?ot(B.__webglFramebuffer[0],Q,0):ot(B.__webglFramebuffer,Q,0)}else if(ce){B.__webglDepthbuffer=[];for(let Ue=0;Ue<6;Ue++)if(t.bindFramebuffer(i.FRAMEBUFFER,B.__webglFramebuffer[Ue]),B.__webglDepthbuffer[Ue]===void 0)B.__webglDepthbuffer[Ue]=i.createRenderbuffer(),Ge(B.__webglDepthbuffer[Ue],Q,!1);else{const Ae=Q.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Ee=B.__webglDepthbuffer[Ue];i.bindRenderbuffer(i.RENDERBUFFER,Ee),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ae,i.RENDERBUFFER,Ee)}}else{const Ue=Q.texture.mipmaps;if(Ue&&Ue.length>0?t.bindFramebuffer(i.FRAMEBUFFER,B.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,B.__webglFramebuffer),B.__webglDepthbuffer===void 0)B.__webglDepthbuffer=i.createRenderbuffer(),Ge(B.__webglDepthbuffer,Q,!1);else{const Ae=Q.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Ee=B.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,Ee),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ae,i.RENDERBUFFER,Ee)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function Je(Q,B,ce){const Ue=n.get(Q);B!==void 0&&be(Ue.__webglFramebuffer,Q,Q.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),ce!==void 0&&Qe(Q)}function Mt(Q){const B=Q.texture,ce=n.get(Q),Ue=n.get(B);Q.addEventListener("dispose",F);const Ae=Q.textures,Ee=Q.isWebGLCubeRenderTarget===!0,rt=Ae.length>1;if(rt||(Ue.__webglTexture===void 0&&(Ue.__webglTexture=i.createTexture()),Ue.__version=B.version,a.memory.textures++),Ee){ce.__webglFramebuffer=[];for(let st=0;st<6;st++)if(B.mipmaps&&B.mipmaps.length>0){ce.__webglFramebuffer[st]=[];for(let Et=0;Et0){ce.__webglFramebuffer=[];for(let st=0;st0&<(Q)===!1){ce.__webglMultisampledFramebuffer=i.createFramebuffer(),ce.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,ce.__webglMultisampledFramebuffer);for(let st=0;st0)for(let Et=0;Et0)for(let Et=0;Et0){if(lt(Q)===!1){const B=Q.textures,ce=Q.width,Ue=Q.height;let Ae=i.COLOR_BUFFER_BIT;const Ee=Q.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,rt=n.get(Q),st=B.length>1;if(st)for(let Nt=0;Nt0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,rt.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,rt.__webglFramebuffer);for(let Nt=0;Nt0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&B.__useRenderToTexture!==!1}function Ye(Q){const B=a.render.frame;p.get(Q)!==B&&(p.set(Q,B),Q.update())}function Re(Q,B){const ce=Q.colorSpace,Ue=Q.format,Ae=Q.type;return Q.isCompressedTexture===!0||Q.isVideoTexture===!0||ce!==Pl&&ce!==Mc&&(Hn.getTransfer(ce)===ci?(Ue!==Ar||Ae!==is)&&Ft("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):en("WebGLTextures: Unsupported texture color space:",ce)),B}function We(Q){return typeof HTMLImageElement<"u"&&Q instanceof HTMLImageElement?(h.width=Q.naturalWidth||Q.width,h.height=Q.naturalHeight||Q.height):typeof VideoFrame<"u"&&Q instanceof VideoFrame?(h.width=Q.displayWidth,h.height=Q.displayHeight):(h.width=Q.width,h.height=Q.height),h}this.allocateTextureUnit=q,this.resetTextureUnits=W,this.setTexture2D=ne,this.setTexture2DArray=j,this.setTexture3D=$,this.setTextureCube=he,this.rebindTextures=Je,this.setupRenderTarget=Mt,this.updateRenderTargetMipmap=Le,this.updateMultisampleRenderTarget=tt,this.setupDepthRenderbuffer=Qe,this.setupFrameBufferTexture=be,this.useMultisampledRTT=lt,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function x4(i,e){function t(n,r=Mc){let s;const a=Hn.getTransfer(r);if(n===is)return i.UNSIGNED_BYTE;if(n===$b)return i.UNSIGNED_SHORT_4_4_4_4;if(n===eS)return i.UNSIGNED_SHORT_5_5_5_1;if(n===wA)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===TA)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===Qb)return i.BYTE;if(n===Jb)return i.SHORT;if(n===Fm)return i.UNSIGNED_SHORT;if(n===uy)return i.INT;if(n===po)return i.UNSIGNED_INT;if(n===Gi)return i.FLOAT;if(n===ar)return i.HALF_FLOAT;if(n===EA)return i.ALPHA;if(n===AA)return i.RGB;if(n===Ar)return i.RGBA;if(n===Lu)return i.DEPTH_COMPONENT;if(n===Lf)return i.DEPTH_STENCIL;if(n===cy)return i.RED;if(n===fy)return i.RED_INTEGER;if(n===Ad)return i.RG;if(n===tS)return i.RG_INTEGER;if(n===nS)return i.RGBA_INTEGER;if(n===hv||n===dv||n===pv||n===mv)if(a===ci)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===hv)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===dv)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===pv)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===mv)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===hv)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===dv)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===pv)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===mv)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===Q1||n===J1||n===$1||n===eb)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===Q1)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===J1)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===$1)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===eb)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===tb||n===nb||n===ib||n===rb||n===sb||n===ab||n===ob)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===tb||n===nb)return a===ci?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===ib)return a===ci?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===rb)return s.COMPRESSED_R11_EAC;if(n===sb)return s.COMPRESSED_SIGNED_R11_EAC;if(n===ab)return s.COMPRESSED_RG11_EAC;if(n===ob)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===lb||n===ub||n===cb||n===fb||n===hb||n===db||n===pb||n===mb||n===gb||n===vb||n===yb||n===xb||n===_b||n===bb)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===lb)return a===ci?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===ub)return a===ci?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===cb)return a===ci?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===fb)return a===ci?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===hb)return a===ci?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===db)return a===ci?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===pb)return a===ci?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===mb)return a===ci?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===gb)return a===ci?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===vb)return a===ci?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===yb)return a===ci?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===xb)return a===ci?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===_b)return a===ci?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===bb)return a===ci?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Sb||n===Mb||n===wb)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Sb)return a===ci?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Mb)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===wb)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Tb||n===Eb||n===Ab||n===Cb)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Tb)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Eb)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Ab)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Cb)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===km?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}const jY=` void main() { gl_Position = vec4( position, 1.0 ); }`,XY=` uniform sampler2DArray depthColor; uniform float depthWidth; uniform float depthHeight; void main() { vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); if ( coord.x >= 1.0 ) { gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; } else { gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; } }`;class YY{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new PA(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new ls({vertexShader:jY,fragmentShader:XY,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new wi(new tl(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class qY extends Iu{constructor(e,t){super();const n=this;let r=null,s=1,a=null,l="local-floor",c=1,h=null,p=null,g=null,v=null,x=null,b=null;const w=typeof XRWebGLBinding<"u",S=new YY,M={},A=t.getContextAttributes();let D=null,R=null;const I=[],P=[],F=new pt;let N=null;const L=new ns;L.viewport=new fi;const G=new ns;G.viewport=new fi;const X=[L,G],W=new o4;let q=null,K=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(se){let de=I[se];return de===void 0&&(de=new y1,I[se]=de),de.getTargetRaySpace()},this.getControllerGrip=function(se){let de=I[se];return de===void 0&&(de=new y1,I[se]=de),de.getGripSpace()},this.getHand=function(se){let de=I[se];return de===void 0&&(de=new y1,I[se]=de),de.getHandSpace()};function ne(se){const de=P.indexOf(se.inputSource);if(de===-1)return;const be=I[de];be!==void 0&&(be.update(se.inputSource,se.frame,h||a),be.dispatchEvent({type:se.type,data:se.inputSource}))}function j(){r.removeEventListener("select",ne),r.removeEventListener("selectstart",ne),r.removeEventListener("selectend",ne),r.removeEventListener("squeeze",ne),r.removeEventListener("squeezestart",ne),r.removeEventListener("squeezeend",ne),r.removeEventListener("end",j),r.removeEventListener("inputsourceschange",$);for(let se=0;se=0&&(P[Ge]=null,I[Ge].disconnect(be))}for(let de=0;de=P.length){P.push(be),Ge=Qe;break}else if(P[Qe]===null){P[Qe]=be,Ge=Qe;break}if(Ge===-1)break}const ot=I[Ge];ot&&ot.connect(be)}}const he=new re,le=new re;function ue(se,de,be){he.setFromMatrixPosition(de.matrixWorld),le.setFromMatrixPosition(be.matrixWorld);const Ge=he.distanceTo(le),ot=de.projectionMatrix.elements,Qe=be.projectionMatrix.elements,Je=ot[14]/(ot[10]-1),Mt=ot[14]/(ot[10]+1),Le=(ot[9]+1)/ot[5],ze=(ot[9]-1)/ot[5],Ie=(ot[8]-1)/ot[0],tt=(Qe[8]+1)/Qe[0],ee=Je*Ie,lt=Je*tt,Ye=Ge/(-Ie+tt),Re=Ye*-Ie;if(de.matrixWorld.decompose(se.position,se.quaternion,se.scale),se.translateX(Re),se.translateZ(Ye),se.matrixWorld.compose(se.position,se.quaternion,se.scale),se.matrixWorldInverse.copy(se.matrixWorld).invert(),ot[10]===-1)se.projectionMatrix.copy(de.projectionMatrix),se.projectionMatrixInverse.copy(de.projectionMatrixInverse);else{const We=Je+Ye,Q=Mt+Ye,B=ee-Re,ce=lt+(Ge-Re),Ue=Le*Mt/Q*We,Ae=ze*Mt/Q*We;se.projectionMatrix.makePerspective(B,ce,Ue,Ae,We,Q),se.projectionMatrixInverse.copy(se.projectionMatrix).invert()}}function k(se,de){de===null?se.matrixWorld.copy(se.matrix):se.matrixWorld.multiplyMatrices(de.matrixWorld,se.matrix),se.matrixWorldInverse.copy(se.matrixWorld).invert()}this.updateCamera=function(se){if(r===null)return;let de=se.near,be=se.far;S.texture!==null&&(S.depthNear>0&&(de=S.depthNear),S.depthFar>0&&(be=S.depthFar)),W.near=G.near=L.near=de,W.far=G.far=L.far=be,(q!==W.near||K!==W.far)&&(r.updateRenderState({depthNear:W.near,depthFar:W.far}),q=W.near,K=W.far),W.layers.mask=se.layers.mask|6,L.layers.mask=W.layers.mask&-5,G.layers.mask=W.layers.mask&-3;const Ge=se.parent,ot=W.cameras;k(W,Ge);for(let Qe=0;Qe0&&(S.alphaTest.value=M.alphaTest);const A=e.get(M),D=A.envMap,R=A.envMapRotation;D&&(S.envMap.value=D,Qh.copy(R),Qh.x*=-1,Qh.y*=-1,Qh.z*=-1,D.isCubeTexture&&D.isRenderTargetTexture===!1&&(Qh.y*=-1,Qh.z*=-1),S.envMapRotation.value.setFromMatrix4(ZY.makeRotationFromEuler(Qh)),S.flipEnvMap.value=D.isCubeTexture&&D.isRenderTargetTexture===!1?-1:1,S.reflectivity.value=M.reflectivity,S.ior.value=M.ior,S.refractionRatio.value=M.refractionRatio),M.lightMap&&(S.lightMap.value=M.lightMap,S.lightMapIntensity.value=M.lightMapIntensity,t(M.lightMap,S.lightMapTransform)),M.aoMap&&(S.aoMap.value=M.aoMap,S.aoMapIntensity.value=M.aoMapIntensity,t(M.aoMap,S.aoMapTransform))}function a(S,M){S.diffuse.value.copy(M.color),S.opacity.value=M.opacity,M.map&&(S.map.value=M.map,t(M.map,S.mapTransform))}function l(S,M){S.dashSize.value=M.dashSize,S.totalSize.value=M.dashSize+M.gapSize,S.scale.value=M.scale}function c(S,M,A,D){S.diffuse.value.copy(M.color),S.opacity.value=M.opacity,S.size.value=M.size*A,S.scale.value=D*.5,M.map&&(S.map.value=M.map,t(M.map,S.uvTransform)),M.alphaMap&&(S.alphaMap.value=M.alphaMap,t(M.alphaMap,S.alphaMapTransform)),M.alphaTest>0&&(S.alphaTest.value=M.alphaTest)}function h(S,M){S.diffuse.value.copy(M.color),S.opacity.value=M.opacity,S.rotation.value=M.rotation,M.map&&(S.map.value=M.map,t(M.map,S.mapTransform)),M.alphaMap&&(S.alphaMap.value=M.alphaMap,t(M.alphaMap,S.alphaMapTransform)),M.alphaTest>0&&(S.alphaTest.value=M.alphaTest)}function p(S,M){S.specular.value.copy(M.specular),S.shininess.value=Math.max(M.shininess,1e-4)}function g(S,M){M.gradientMap&&(S.gradientMap.value=M.gradientMap)}function v(S,M){S.metalness.value=M.metalness,M.metalnessMap&&(S.metalnessMap.value=M.metalnessMap,t(M.metalnessMap,S.metalnessMapTransform)),S.roughness.value=M.roughness,M.roughnessMap&&(S.roughnessMap.value=M.roughnessMap,t(M.roughnessMap,S.roughnessMapTransform)),M.envMap&&(S.envMapIntensity.value=M.envMapIntensity)}function x(S,M,A){S.ior.value=M.ior,M.sheen>0&&(S.sheenColor.value.copy(M.sheenColor).multiplyScalar(M.sheen),S.sheenRoughness.value=M.sheenRoughness,M.sheenColorMap&&(S.sheenColorMap.value=M.sheenColorMap,t(M.sheenColorMap,S.sheenColorMapTransform)),M.sheenRoughnessMap&&(S.sheenRoughnessMap.value=M.sheenRoughnessMap,t(M.sheenRoughnessMap,S.sheenRoughnessMapTransform))),M.clearcoat>0&&(S.clearcoat.value=M.clearcoat,S.clearcoatRoughness.value=M.clearcoatRoughness,M.clearcoatMap&&(S.clearcoatMap.value=M.clearcoatMap,t(M.clearcoatMap,S.clearcoatMapTransform)),M.clearcoatRoughnessMap&&(S.clearcoatRoughnessMap.value=M.clearcoatRoughnessMap,t(M.clearcoatRoughnessMap,S.clearcoatRoughnessMapTransform)),M.clearcoatNormalMap&&(S.clearcoatNormalMap.value=M.clearcoatNormalMap,t(M.clearcoatNormalMap,S.clearcoatNormalMapTransform),S.clearcoatNormalScale.value.copy(M.clearcoatNormalScale),M.side===ca&&S.clearcoatNormalScale.value.negate())),M.dispersion>0&&(S.dispersion.value=M.dispersion),M.iridescence>0&&(S.iridescence.value=M.iridescence,S.iridescenceIOR.value=M.iridescenceIOR,S.iridescenceThicknessMinimum.value=M.iridescenceThicknessRange[0],S.iridescenceThicknessMaximum.value=M.iridescenceThicknessRange[1],M.iridescenceMap&&(S.iridescenceMap.value=M.iridescenceMap,t(M.iridescenceMap,S.iridescenceMapTransform)),M.iridescenceThicknessMap&&(S.iridescenceThicknessMap.value=M.iridescenceThicknessMap,t(M.iridescenceThicknessMap,S.iridescenceThicknessMapTransform))),M.transmission>0&&(S.transmission.value=M.transmission,S.transmissionSamplerMap.value=A.texture,S.transmissionSamplerSize.value.set(A.width,A.height),M.transmissionMap&&(S.transmissionMap.value=M.transmissionMap,t(M.transmissionMap,S.transmissionMapTransform)),S.thickness.value=M.thickness,M.thicknessMap&&(S.thicknessMap.value=M.thicknessMap,t(M.thicknessMap,S.thicknessMapTransform)),S.attenuationDistance.value=M.attenuationDistance,S.attenuationColor.value.copy(M.attenuationColor)),M.anisotropy>0&&(S.anisotropyVector.value.set(M.anisotropy*Math.cos(M.anisotropyRotation),M.anisotropy*Math.sin(M.anisotropyRotation)),M.anisotropyMap&&(S.anisotropyMap.value=M.anisotropyMap,t(M.anisotropyMap,S.anisotropyMapTransform))),S.specularIntensity.value=M.specularIntensity,S.specularColor.value.copy(M.specularColor),M.specularColorMap&&(S.specularColorMap.value=M.specularColorMap,t(M.specularColorMap,S.specularColorMapTransform)),M.specularIntensityMap&&(S.specularIntensityMap.value=M.specularIntensityMap,t(M.specularIntensityMap,S.specularIntensityMapTransform))}function b(S,M){M.matcap&&(S.matcap.value=M.matcap)}function w(S,M){const A=e.get(M).light;S.referencePosition.value.setFromMatrixPosition(A.matrixWorld),S.nearDistance.value=A.shadow.camera.near,S.farDistance.value=A.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function QY(i,e,t,n){let r={},s={},a=[];const l=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function c(A,D){const R=D.program;n.uniformBlockBinding(A,R)}function h(A,D){let R=r[A.id];R===void 0&&(b(A),R=p(A),r[A.id]=R,A.addEventListener("dispose",S));const I=D.program;n.updateUBOMapping(A,I);const P=e.render.frame;s[A.id]!==P&&(v(A),s[A.id]=P)}function p(A){const D=g();A.__bindingPointIndex=D;const R=i.createBuffer(),I=A.__size,P=A.usage;return i.bindBuffer(i.UNIFORM_BUFFER,R),i.bufferData(i.UNIFORM_BUFFER,I,P),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,D,R),R}function g(){for(let A=0;A0&&(R+=I-P),A.__size=R,A.__cache={},this}function w(A){const D={boundary:0,storage:0};return typeof A=="number"||typeof A=="boolean"?(D.boundary=4,D.storage=4):A.isVector2?(D.boundary=8,D.storage=8):A.isVector3||A.isColor?(D.boundary=16,D.storage=12):A.isVector4?(D.boundary=16,D.storage=16):A.isMatrix3?(D.boundary=48,D.storage=48):A.isMatrix4?(D.boundary=64,D.storage=64):A.isTexture?Ft("WebGLRenderer: Texture samplers can not be part of an uniforms group."):Ft("WebGLRenderer: Unsupported uniform value type.",A),D}function S(A){const D=A.target;D.removeEventListener("dispose",S);const R=a.indexOf(D.__bindingPointIndex);a.splice(R,1),i.deleteBuffer(r[D.id]),delete r[D.id],delete s[D.id]}function M(){for(const A in r)i.deleteBuffer(r[A]);a=[],r={},s={}}return{bind:c,update:h,dispose:M}}const JY=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let bu=null;function $Y(){return bu===null&&(bu=new $o(JY,16,16,Ad,ar),bu.name="DFG_LUT",bu.minFilter=In,bu.magFilter=In,bu.wrapS=vr,bu.wrapT=vr,bu.generateMipmaps=!1,bu.needsUpdate=!0),bu}class sC{constructor(e={}){const{canvas:t=hO(),context:n=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:l=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:h=!1,powerPreference:p="default",failIfMajorPerformanceCaveat:g=!1,reversedDepthBuffer:v=!1,outputBufferType:x=is}=e;this.isWebGLRenderer=!0;let b;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");b=n.getContextAttributes().alpha}else b=a;const w=x,S=new Set([nS,tS,fy]),M=new Set([is,po,Fm,km,$b,eS]),A=new Uint32Array(4),D=new Int32Array(4);let R=null,I=null;const P=[],F=[];let N=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Jo,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const L=this;let G=!1;this._outputColorSpace=bs;let X=0,W=0,q=null,K=-1,ne=null;const j=new fi,$=new fi;let he=null;const le=new zt(0);let ue=0,k=t.width,Z=t.height,oe=1,fe=null,ve=null;const se=new fi(0,0,k,Z),de=new fi(0,0,k,Z);let be=!1;const Ge=new Jm;let ot=!1,Qe=!1;const Je=new un,Mt=new re,Le=new fi,ze={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ie=!1;function tt(){return q===null?oe:1}let ee=n;function lt(V,pe){return t.getContext(V,pe)}try{const V={alpha:!0,depth:r,stencil:s,antialias:l,premultipliedAlpha:c,preserveDrawingBuffer:h,powerPreference:p,failIfMajorPerformanceCaveat:g};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Zm}`),t.addEventListener("webglcontextlost",Ct,!1),t.addEventListener("webglcontextrestored",Bt,!1),t.addEventListener("webglcontextcreationerror",Ot,!1),ee===null){const pe="webgl2";if(ee=lt(pe,V),ee===null)throw lt(pe)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(V){throw en("WebGLRenderer: "+V.message),V}let Ye,Re,We,Q,B,ce,Ue,Ae,Ee,rt,st,Et,Nt,Ve,Pe,$e,ct,mt,Gt,ye,we,it,Lt;function et(){Ye=new tX(ee),Ye.init(),we=new x4(ee,Ye),Re=new Yj(ee,Ye,e,we),We=new HY(ee,Ye),Re.reversedDepthBuffer&&v&&We.buffers.depth.setReversed(!0),Q=new rX(ee),B=new RY,ce=new WY(ee,Ye,We,B,Re,we,Q),Ue=new eX(L),Ae=new u7(ee),it=new jj(ee,Ae),Ee=new nX(ee,Ae,Q,it),rt=new aX(ee,Ee,Ae,it,Q),mt=new sX(ee,Re,ce),Pe=new qj(B),st=new CY(L,Ue,Ye,Re,it,Pe),Et=new KY(L,B),Nt=new NY,Ve=new FY(Ye),ct=new Wj(L,Ue,We,rt,b,c),$e=new GY(L,rt,Re),Lt=new QY(ee,Q,Re,We),Gt=new Xj(ee,Ye,Q),ye=new iX(ee,Ye,Q),Q.programs=st.programs,L.capabilities=Re,L.extensions=Ye,L.properties=B,L.renderLists=Nt,L.shadowMap=$e,L.state=We,L.info=Q}et(),w!==is&&(N=new lX(w,t.width,t.height,r,s));const Ne=new qY(L,ee);this.xr=Ne,this.getContext=function(){return ee},this.getContextAttributes=function(){return ee.getContextAttributes()},this.forceContextLoss=function(){const V=Ye.get("WEBGL_lose_context");V&&V.loseContext()},this.forceContextRestore=function(){const V=Ye.get("WEBGL_lose_context");V&&V.restoreContext()},this.getPixelRatio=function(){return oe},this.setPixelRatio=function(V){V!==void 0&&(oe=V,this.setSize(k,Z,!1))},this.getSize=function(V){return V.set(k,Z)},this.setSize=function(V,pe,Me=!0){if(Ne.isPresenting){Ft("WebGLRenderer: Can't change size while VR device is presenting.");return}k=V,Z=pe,t.width=Math.floor(V*oe),t.height=Math.floor(pe*oe),Me===!0&&(t.style.width=V+"px",t.style.height=pe+"px"),N!==null&&N.setSize(t.width,t.height),this.setViewport(0,0,V,pe)},this.getDrawingBufferSize=function(V){return V.set(k*oe,Z*oe).floor()},this.setDrawingBufferSize=function(V,pe,Me){k=V,Z=pe,oe=Me,t.width=Math.floor(V*Me),t.height=Math.floor(pe*Me),this.setViewport(0,0,V,pe)},this.setEffects=function(V){if(w===is){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(V){for(let pe=0;pe{function nt(){if(_e.forEach(function(ht){B.get(ht).currentProgram.isReady()&&_e.delete(ht)}),_e.size===0){Se(V);return}setTimeout(nt,10)}Ye.get("KHR_parallel_shader_compile")!==null?nt():setTimeout(nt,10)})};let Ui=null;function yr(V){Ui&&Ui(V)}function Zi(){pi.stop()}function Ti(){pi.start()}const pi=new p4;pi.setAnimationLoop(yr),typeof self<"u"&&pi.setContext(self),this.setAnimationLoop=function(V){Ui=V,Ne.setAnimationLoop(V),V===null?pi.stop():pi.start()},Ne.addEventListener("sessionstart",Zi),Ne.addEventListener("sessionend",Ti),this.render=function(V,pe){if(pe!==void 0&&pe.isCamera!==!0){en("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(G===!0)return;const Me=Ne.enabled===!0&&Ne.isPresenting===!0,_e=N!==null&&(q===null||Me)&&N.begin(L,q);if(V.matrixWorldAutoUpdate===!0&&V.updateMatrixWorld(),pe.parent===null&&pe.matrixWorldAutoUpdate===!0&&pe.updateMatrixWorld(),Ne.enabled===!0&&Ne.isPresenting===!0&&(N===null||N.isCompositing()===!1)&&(Ne.cameraAutoUpdate===!0&&Ne.updateCamera(pe),pe=Ne.getCamera()),V.isScene===!0&&V.onBeforeRender(L,V,pe,q),I=Ve.get(V,F.length),I.init(pe),F.push(I),Je.multiplyMatrices(pe.projectionMatrix,pe.matrixWorldInverse),Ge.setFromProjectionMatrix(Je,ao,pe.reversedDepth),Qe=this.localClippingEnabled,ot=Pe.init(this.clippingPlanes,Qe),R=Nt.get(V,P.length),R.init(),P.push(R),Ne.enabled===!0&&Ne.isPresenting===!0){const ht=L.xr.getDepthSensingMesh();ht!==null&&Jt(ht,pe,-1/0,L.sortObjects)}Jt(V,pe,0,L.sortObjects),R.finish(),L.sortObjects===!0&&R.sort(fe,ve),Ie=Ne.enabled===!1||Ne.isPresenting===!1||Ne.hasDepthSensing()===!1,Ie&&ct.addToRenderList(R,V),this.info.render.frame++,ot===!0&&Pe.beginShadows();const Se=I.state.shadowsArray;if($e.render(Se,V,pe),ot===!0&&Pe.endShadows(),this.info.autoReset===!0&&this.info.reset(),(_e&&N.hasRenderPass())===!1){const ht=R.opaque,dt=R.transmissive;if(I.setupLights(),pe.isArrayCamera){const gt=pe.cameras;if(dt.length>0)for(let Pt=0,It=gt.length;Pt0&&jn(ht,dt,V,pe),Ie&&ct.render(V),Jn(R,V,pe)}q!==null&&W===0&&(ce.updateMultisampleRenderTarget(q),ce.updateRenderTargetMipmap(q)),_e&&N.end(L),V.isScene===!0&&V.onAfterRender(L,V,pe),it.resetDefaultState(),K=-1,ne=null,F.pop(),F.length>0?(I=F[F.length-1],ot===!0&&Pe.setGlobalState(L.clippingPlanes,I.state.camera)):I=null,P.pop(),P.length>0?R=P[P.length-1]:R=null};function Jt(V,pe,Me,_e){if(V.visible===!1)return;if(V.layers.test(pe.layers)){if(V.isGroup)Me=V.renderOrder;else if(V.isLOD)V.autoUpdate===!0&&V.update(pe);else if(V.isLight)I.pushLight(V),V.castShadow&&I.pushShadow(V);else if(V.isSprite){if(!V.frustumCulled||Ge.intersectsSprite(V)){_e&&Le.setFromMatrixPosition(V.matrixWorld).applyMatrix4(Je);const ht=rt.update(V),dt=V.material;dt.visible&&R.push(V,ht,dt,Me,Le.z,null)}}else if((V.isMesh||V.isLine||V.isPoints)&&(!V.frustumCulled||Ge.intersectsObject(V))){const ht=rt.update(V),dt=V.material;if(_e&&(V.boundingSphere!==void 0?(V.boundingSphere===null&&V.computeBoundingSphere(),Le.copy(V.boundingSphere.center)):(ht.boundingSphere===null&&ht.computeBoundingSphere(),Le.copy(ht.boundingSphere.center)),Le.applyMatrix4(V.matrixWorld).applyMatrix4(Je)),Array.isArray(dt)){const gt=ht.groups;for(let Pt=0,It=gt.length;Pt0&&Y(Se,pe,Me),nt.length>0&&Y(nt,pe,Me),ht.length>0&&Y(ht,pe,Me),We.buffers.depth.setTest(!0),We.buffers.depth.setMask(!0),We.buffers.color.setMask(!0),We.setPolygonOffset(!1)}function jn(V,pe,Me,_e){if((Me.isScene===!0?Me.overrideMaterial:null)!==null)return;if(I.state.transmissionRenderTarget[_e.id]===void 0){const St=Ye.has("EXT_color_buffer_half_float")||Ye.has("EXT_color_buffer_float");I.state.transmissionRenderTarget[_e.id]=new rs(1,1,{generateMipmaps:!0,type:St?ar:is,minFilter:Cu,samples:Math.max(4,Re.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Hn.workingColorSpace})}const nt=I.state.transmissionRenderTarget[_e.id],ht=_e.viewport||j;nt.setSize(ht.z*L.transmissionResolutionScale,ht.w*L.transmissionResolutionScale);const dt=L.getRenderTarget(),gt=L.getActiveCubeFace(),Pt=L.getActiveMipmapLevel();L.setRenderTarget(nt),L.getClearColor(le),ue=L.getClearAlpha(),ue<1&&L.setClearColor(16777215,.5),L.clear(),Ie&&ct.render(Me);const It=L.toneMapping;L.toneMapping=Jo;const Kt=_e.viewport;if(_e.viewport!==void 0&&(_e.viewport=void 0),I.setupLightsView(_e),ot===!0&&Pe.setGlobalState(L.clippingPlanes,_e),Y(V,Me,_e),ce.updateMultisampleRenderTarget(nt),ce.updateRenderTargetMipmap(nt),Ye.has("WEBGL_multisampled_render_to_texture")===!1){let St=!1;for(let Xt=0,pn=pe.length;Xt0),St=!!Me.morphAttributes.position,Xt=!!Me.morphAttributes.normal,pn=!!Me.morphAttributes.color;let Pn=Jo;_e.toneMapped&&(q===null||q.isXRRenderTarget===!0)&&(Pn=L.toneMapping);const tn=Me.morphAttributes.position||Me.morphAttributes.normal||Me.morphAttributes.color,Wt=tn!==void 0?tn.length:0,yt=B.get(_e),cn=I.state.lights;if(ot===!0&&(Qe===!0||V!==ne)){const Ei=V===ne&&_e.id===K;Pe.setState(_e,V,Ei)}let Rt=!1;_e.version===yt.__version?(yt.needsLights&&yt.lightsStateVersion!==cn.state.version||yt.outputColorSpace!==dt||Se.isBatchedMesh&&yt.batching===!1||!Se.isBatchedMesh&&yt.batching===!0||Se.isBatchedMesh&&yt.batchingColor===!0&&Se.colorTexture===null||Se.isBatchedMesh&&yt.batchingColor===!1&&Se.colorTexture!==null||Se.isInstancedMesh&&yt.instancing===!1||!Se.isInstancedMesh&&yt.instancing===!0||Se.isSkinnedMesh&&yt.skinning===!1||!Se.isSkinnedMesh&&yt.skinning===!0||Se.isInstancedMesh&&yt.instancingColor===!0&&Se.instanceColor===null||Se.isInstancedMesh&&yt.instancingColor===!1&&Se.instanceColor!==null||Se.isInstancedMesh&&yt.instancingMorph===!0&&Se.morphTexture===null||Se.isInstancedMesh&&yt.instancingMorph===!1&&Se.morphTexture!==null||yt.envMap!==Pt||_e.fog===!0&&yt.fog!==nt||yt.numClippingPlanes!==void 0&&(yt.numClippingPlanes!==Pe.numPlanes||yt.numIntersection!==Pe.numIntersection)||yt.vertexAlphas!==It||yt.vertexTangents!==Kt||yt.morphTargets!==St||yt.morphNormals!==Xt||yt.morphColors!==pn||yt.toneMapping!==Pn||yt.morphTargetsCount!==Wt)&&(Rt=!0):(Rt=!0,yt.__version=_e.version);let Xn=yt.currentProgram;Rt===!0&&(Xn=me(_e,pe,Se));let ai=!1,En=!1,oi=!1;const Dn=Xn.getUniforms(),hi=yt.uniforms;if(We.useProgram(Xn.program)&&(ai=!0,En=!0,oi=!0),_e.id!==K&&(K=_e.id,En=!0),ai||ne!==V){We.buffers.depth.getReversed()&&V.reversedDepth!==!0&&(V._reversedDepth=!0,V.updateProjectionMatrix()),Dn.setValue(ee,"projectionMatrix",V.projectionMatrix),Dn.setValue(ee,"viewMatrix",V.matrixWorldInverse);const us=Dn.map.cameraPosition;us!==void 0&&us.setValue(ee,Mt.setFromMatrixPosition(V.matrixWorld)),Re.logarithmicDepthBuffer&&Dn.setValue(ee,"logDepthBufFC",2/(Math.log(V.far+1)/Math.LN2)),(_e.isMeshPhongMaterial||_e.isMeshToonMaterial||_e.isMeshLambertMaterial||_e.isMeshBasicMaterial||_e.isMeshStandardMaterial||_e.isShaderMaterial)&&Dn.setValue(ee,"isOrthographic",V.isOrthographicCamera===!0),ne!==V&&(ne=V,En=!0,oi=!0)}if(yt.needsLights&&(cn.state.directionalShadowMap.length>0&&Dn.setValue(ee,"directionalShadowMap",cn.state.directionalShadowMap,ce),cn.state.spotShadowMap.length>0&&Dn.setValue(ee,"spotShadowMap",cn.state.spotShadowMap,ce),cn.state.pointShadowMap.length>0&&Dn.setValue(ee,"pointShadowMap",cn.state.pointShadowMap,ce)),Se.isSkinnedMesh){Dn.setOptional(ee,Se,"bindMatrix"),Dn.setOptional(ee,Se,"bindMatrixInverse");const Ei=Se.skeleton;Ei&&(Ei.boneTexture===null&&Ei.computeBoneTexture(),Dn.setValue(ee,"boneTexture",Ei.boneTexture,ce))}Se.isBatchedMesh&&(Dn.setOptional(ee,Se,"batchingTexture"),Dn.setValue(ee,"batchingTexture",Se._matricesTexture,ce),Dn.setOptional(ee,Se,"batchingIdTexture"),Dn.setValue(ee,"batchingIdTexture",Se._indirectTexture,ce),Dn.setOptional(ee,Se,"batchingColorTexture"),Se._colorsTexture!==null&&Dn.setValue(ee,"batchingColorTexture",Se._colorsTexture,ce));const or=Me.morphAttributes;if((or.position!==void 0||or.normal!==void 0||or.color!==void 0)&&mt.update(Se,Me,Xn),(En||yt.receiveShadow!==Se.receiveShadow)&&(yt.receiveShadow=Se.receiveShadow,Dn.setValue(ee,"receiveShadow",Se.receiveShadow)),(_e.isMeshStandardMaterial||_e.isMeshLambertMaterial||_e.isMeshPhongMaterial)&&_e.envMap===null&&pe.environment!==null&&(hi.envMapIntensity.value=pe.environmentIntensity),hi.dfgLUT!==void 0&&(hi.dfgLUT.value=$Y()),En&&(Dn.setValue(ee,"toneMappingExposure",L.toneMappingExposure),yt.needsLights&&_t(hi,oi),nt&&_e.fog===!0&&Et.refreshFogUniforms(hi,nt),Et.refreshMaterialUniforms(hi,_e,oe,Z,I.state.transmissionRenderTarget[V.id]),x1.upload(ee,Oe(yt),hi,ce)),_e.isShaderMaterial&&_e.uniformsNeedUpdate===!0&&(x1.upload(ee,Oe(yt),hi,ce),_e.uniformsNeedUpdate=!1),_e.isSpriteMaterial&&Dn.setValue(ee,"center",Se.center),Dn.setValue(ee,"modelViewMatrix",Se.modelViewMatrix),Dn.setValue(ee,"normalMatrix",Se.normalMatrix),Dn.setValue(ee,"modelMatrix",Se.matrixWorld),_e.isShaderMaterial||_e.isRawShaderMaterial){const Ei=_e.uniformsGroups;for(let us=0,Ms=Ei.length;us0&&ce.useMultisampledRTT(V)===!1?_e=B.get(V).__webglMultisampledFramebuffer:Array.isArray(Pt)?_e=Pt[Me]:_e=Pt,j.copy(V.viewport),$.copy(V.scissor),he=V.scissorTest}else j.copy(se).multiplyScalar(oe).floor(),$.copy(de).multiplyScalar(oe).floor(),he=be;if(Me!==0&&(_e=wt),We.bindFramebuffer(ee.FRAMEBUFFER,_e)&&We.drawBuffers(V,_e),We.viewport(j),We.scissor($),We.setScissorTest(he),Se){const dt=B.get(V.texture);ee.framebufferTexture2D(ee.FRAMEBUFFER,ee.COLOR_ATTACHMENT0,ee.TEXTURE_CUBE_MAP_POSITIVE_X+pe,dt.__webglTexture,Me)}else if(nt){const dt=pe;for(let gt=0;gt1&&ee.readBuffer(ee.COLOR_ATTACHMENT0+dt),!Re.textureFormatReadable(It)){en("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Re.textureTypeReadable(Kt)){en("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}pe>=0&&pe<=V.width-_e&&Me>=0&&Me<=V.height-Se&&ee.readPixels(pe,Me,_e,Se,we.convert(It),we.convert(Kt),nt)}finally{const Pt=q!==null?B.get(q).__webglFramebuffer:null;We.bindFramebuffer(ee.FRAMEBUFFER,Pt)}}},this.readRenderTargetPixelsAsync=async function(V,pe,Me,_e,Se,nt,ht,dt=0){if(!(V&&V.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let gt=B.get(V).__webglFramebuffer;if(V.isWebGLCubeRenderTarget&&ht!==void 0&&(gt=gt[ht]),gt)if(pe>=0&&pe<=V.width-_e&&Me>=0&&Me<=V.height-Se){We.bindFramebuffer(ee.FRAMEBUFFER,gt);const Pt=V.textures[dt],It=Pt.format,Kt=Pt.type;if(V.textures.length>1&&ee.readBuffer(ee.COLOR_ATTACHMENT0+dt),!Re.textureFormatReadable(It))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Re.textureTypeReadable(Kt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const St=ee.createBuffer();ee.bindBuffer(ee.PIXEL_PACK_BUFFER,St),ee.bufferData(ee.PIXEL_PACK_BUFFER,nt.byteLength,ee.STREAM_READ),ee.readPixels(pe,Me,_e,Se,we.convert(It),we.convert(Kt),0);const Xt=q!==null?B.get(q).__webglFramebuffer:null;We.bindFramebuffer(ee.FRAMEBUFFER,Xt);const pn=ee.fenceSync(ee.SYNC_GPU_COMMANDS_COMPLETE,0);return ee.flush(),await dG(ee,pn,4),ee.bindBuffer(ee.PIXEL_PACK_BUFFER,St),ee.getBufferSubData(ee.PIXEL_PACK_BUFFER,0,nt),ee.deleteBuffer(St),ee.deleteSync(pn),nt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(V,pe=null,Me=0){const _e=Math.pow(2,-Me),Se=Math.floor(V.image.width*_e),nt=Math.floor(V.image.height*_e),ht=pe!==null?pe.x:0,dt=pe!==null?pe.y:0;ce.setTexture2D(V,0),ee.copyTexSubImage2D(ee.TEXTURE_2D,Me,0,0,ht,dt,Se,nt),We.unbindTexture()};const Tt=ee.createFramebuffer(),At=ee.createFramebuffer();this.copyTextureToTexture=function(V,pe,Me=null,_e=null,Se=0,nt=0){let ht,dt,gt,Pt,It,Kt,St,Xt,pn;const Pn=V.isCompressedTexture?V.mipmaps[nt]:V.image;if(Me!==null)ht=Me.max.x-Me.min.x,dt=Me.max.y-Me.min.y,gt=Me.isBox3?Me.max.z-Me.min.z:1,Pt=Me.min.x,It=Me.min.y,Kt=Me.isBox3?Me.min.z:0;else{const hi=Math.pow(2,-Se);ht=Math.floor(Pn.width*hi),dt=Math.floor(Pn.height*hi),V.isDataArrayTexture?gt=Pn.depth:V.isData3DTexture?gt=Math.floor(Pn.depth*hi):gt=1,Pt=0,It=0,Kt=0}_e!==null?(St=_e.x,Xt=_e.y,pn=_e.z):(St=0,Xt=0,pn=0);const tn=we.convert(pe.format),Wt=we.convert(pe.type);let yt;pe.isData3DTexture?(ce.setTexture3D(pe,0),yt=ee.TEXTURE_3D):pe.isDataArrayTexture||pe.isCompressedArrayTexture?(ce.setTexture2DArray(pe,0),yt=ee.TEXTURE_2D_ARRAY):(ce.setTexture2D(pe,0),yt=ee.TEXTURE_2D),ee.pixelStorei(ee.UNPACK_FLIP_Y_WEBGL,pe.flipY),ee.pixelStorei(ee.UNPACK_PREMULTIPLY_ALPHA_WEBGL,pe.premultiplyAlpha),ee.pixelStorei(ee.UNPACK_ALIGNMENT,pe.unpackAlignment);const cn=ee.getParameter(ee.UNPACK_ROW_LENGTH),Rt=ee.getParameter(ee.UNPACK_IMAGE_HEIGHT),Xn=ee.getParameter(ee.UNPACK_SKIP_PIXELS),ai=ee.getParameter(ee.UNPACK_SKIP_ROWS),En=ee.getParameter(ee.UNPACK_SKIP_IMAGES);ee.pixelStorei(ee.UNPACK_ROW_LENGTH,Pn.width),ee.pixelStorei(ee.UNPACK_IMAGE_HEIGHT,Pn.height),ee.pixelStorei(ee.UNPACK_SKIP_PIXELS,Pt),ee.pixelStorei(ee.UNPACK_SKIP_ROWS,It),ee.pixelStorei(ee.UNPACK_SKIP_IMAGES,Kt);const oi=V.isDataArrayTexture||V.isData3DTexture,Dn=pe.isDataArrayTexture||pe.isData3DTexture;if(V.isDepthTexture){const hi=B.get(V),or=B.get(pe),Ei=B.get(hi.__renderTarget),us=B.get(or.__renderTarget);We.bindFramebuffer(ee.READ_FRAMEBUFFER,Ei.__webglFramebuffer),We.bindFramebuffer(ee.DRAW_FRAMEBUFFER,us.__webglFramebuffer);for(let Ms=0;Ms"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:l;return zw.useSyncExternalStore=i.useSyncExternalStore!==void 0?i.useSyncExternalStore:p,zw}var XN;function nq(){return XN||(XN=1,kw.exports=tq()),kw.exports}/** * @license React * use-sync-external-store-shim/with-selector.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var YN;function iq(){if(YN)return Fw;YN=1;var i=ty(),e=nq();function t(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,s=i.useRef,a=i.useEffect,l=i.useMemo,c=i.useDebugValue;return Fw.useSyncExternalStoreWithSelector=function(h,p,g,v,x){var b=s(null);if(b.current===null){var w={hasValue:!1,value:null};b.current=w}else w=b.current;b=l(function(){function M(P){if(!A){if(A=!0,D=P,P=v(P),x!==void 0&&w.hasValue){var F=w.value;if(x(F,P))return R=F}return R=P}if(F=R,n(D,P))return F;var N=v(P);return x!==void 0&&x(F,N)?(D=P,F):(D=P,R=N)}var A=!1,D,R,I=g===void 0?null:g;return[function(){return M(p())},I===null?void 0:function(){return M(I())}]},[p,g,v,x]);var S=r(h,b[0],b[1]);return a(function(){w.hasValue=!0,w.value=S},[S]),c(S),S},Fw}var qN;function rq(){return qN||(qN=1,Ow.exports=iq()),Ow.exports}var sq=rq();const aq=bE(sq),ZN=i=>{let e;const t=new Set,n=(h,p)=>{const g=typeof h=="function"?h(e):h;if(!Object.is(g,e)){const v=e;e=p??(typeof g!="object"||g===null)?g:Object.assign({},e,g),t.forEach(x=>x(e,v))}},r=()=>e,l={setState:n,getState:r,getInitialState:()=>c,subscribe:h=>(t.add(h),()=>t.delete(h))},c=e=i(n,r,l);return l},oq=(i=>i?ZN(i):ZN),{useSyncExternalStoreWithSelector:lq}=aq,uq=i=>i;function cq(i,e=uq,t){const n=lq(i.subscribe,i.getState,i.getInitialState,e,t);return FU.useDebugValue(n),n}const KN=(i,e)=>{const t=oq(i),n=(r,s=e)=>cq(t,r,s);return Object.assign(n,t),n},_4=((i,e)=>i?KN(i,e):KN),fq=i=>typeof i=="object"&&typeof i.then=="function",hd=[];function b4(i,e,t=(n,r)=>n===r){if(i===e)return!0;if(!i||!e)return!1;const n=i.length;if(e.length!==n)return!1;for(let r=0;r0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,n.lifespan)),s.response;if(!t)throw s.promise}const r={keys:e,equal:n.equal,remove:()=>{const s=hd.indexOf(r);s!==-1&&hd.splice(s,1)},promise:(fq(i)?i:i(...e)).then(s=>{r.response=s,n.lifespan&&n.lifespan>0&&(r.timeout=setTimeout(r.remove,n.lifespan))}).catch(s=>r.error=s)};if(hd.push(r),!t)throw r.promise}const M4=(i,e,t)=>S4(i,e,!1,t),hq=(i,e,t)=>void S4(i,e,!0,t),dq=i=>{if(i===void 0||i.length===0)hd.splice(0,hd.length);else{const e=hd.find(t=>b4(i,t.keys,t.equal));e&&e.remove()}};var rE=kU();const pq=bE(rE);function aC(i,e,t){if(!i)return;if(t(i)===!0)return i;let n=e?i.return:i.child;for(;n;){const r=aC(n,e,t);if(r)return r;n=e?null:n.sibling}}function w4(i){try{return Object.defineProperties(i,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return i}}const oC=w4(ae.createContext(null));class T4 extends ae.Component{render(){return ae.createElement(oC.Provider,{value:this._reactInternals},this.props.children)}}function E4(){const i=ae.useContext(oC);if(i===null)throw new Error("its-fine: useFiber must be called within a !");const e=ae.useId();return ae.useMemo(()=>{for(const t of[i,i==null?void 0:i.alternate]){if(!t)continue;const n=aC(t,!1,r=>{let s=r.memoizedState;for(;s;){if(s.memoizedState===e)return!0;s=s.next}});if(n)return n}},[i,e])}const mq=Symbol.for("react.context"),gq=i=>i!==null&&typeof i=="object"&&"$$typeof"in i&&i.$$typeof===mq;function vq(){const i=E4(),[e]=ae.useState(()=>new Map);e.clear();let t=i;for(;t;){const n=t.type;gq(n)&&n!==oC&&!e.has(n)&&e.set(n,ae.use(w4(n))),t=t.return}return e}function yq(){const i=vq();return ae.useMemo(()=>Array.from(i.keys()).reduce((e,t)=>n=>ae.createElement(e,null,ae.createElement(t.Provider,{...n,value:i.get(t)})),e=>ae.createElement(T4,{...e})),[i])}function A4(i){let e=i.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const C4=i=>i&&i.isOrthographicCamera,xq=i=>i&&i.hasOwnProperty("current"),_q=i=>i!=null&&(typeof i=="string"||typeof i=="number"||i.isColor),_y=((i,e)=>typeof window<"u"&&(((i=window.document)==null?void 0:i.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?ae.useLayoutEffect:ae.useEffect;function lC(i){const e=ae.useRef(i);return _y(()=>void(e.current=i),[i]),e}function bq(){const i=E4(),e=yq();return ae.useMemo(()=>({children:t})=>{const r=!!aC(i,!0,s=>s.type===ae.StrictMode)?ae.StrictMode:ae.Fragment;return H.jsx(r,{children:H.jsx(e,{children:t})})},[i,e])}function Sq({set:i}){return _y(()=>(i(new Promise(()=>null)),()=>i(!1)),[i]),null}const Mq=(i=>(i=class extends ae.Component{constructor(...t){super(...t),this.state={error:!1}}componentDidCatch(t){this.props.set(t)}render(){return this.state.error?null:this.props.children}},i.getDerivedStateFromError=()=>({error:!0}),i))();function R4(i){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(i)?Math.min(Math.max(i[0],t),i[1]):i}function lm(i){var e;return(e=i.__r3f)==null?void 0:e.root.getState()}const Yi={obj:i=>i===Object(i)&&!Yi.arr(i)&&typeof i!="function",fun:i=>typeof i=="function",str:i=>typeof i=="string",num:i=>typeof i=="number",boo:i=>typeof i=="boolean",und:i=>i===void 0,nul:i=>i===null,arr:i=>Array.isArray(i),equ(i,e,{arrays:t="shallow",objects:n="reference",strict:r=!0}={}){if(typeof i!=typeof e||!!i!=!!e)return!1;if(Yi.str(i)||Yi.num(i)||Yi.boo(i))return i===e;const s=Yi.obj(i);if(s&&n==="reference")return i===e;const a=Yi.arr(i);if(a&&t==="reference")return i===e;if((a||s)&&i===e)return!0;let l;for(l in i)if(!(l in e))return!1;if(s&&t==="shallow"&&n==="shallow"){for(l in r?e:i)if(!Yi.equ(i[l],e[l],{strict:r,objects:"reference"}))return!1}else for(l in r?e:i)if(i[l]!==e[l])return!1;if(Yi.und(l)){if(a&&i.length===0&&e.length===0||s&&Object.keys(i).length===0&&Object.keys(e).length===0)return!0;if(i!==e)return!1}return!0}};function wq(i){const e={nodes:{},materials:{},meshes:{}};return i&&i.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material),t.isMesh&&!e.meshes[t.name]&&(e.meshes[t.name]=t)}),e}function Tq(i){i.type!=="Scene"&&(i.dispose==null||i.dispose());for(const e in i){const t=i[e];(t==null?void 0:t.type)!=="Scene"&&(t==null||t.dispose==null||t.dispose())}}const D4=["children","key","ref"];function Eq(i){const e={};for(const t in i)D4.includes(t)||(e[t]=i[t]);return e}function Ib(i,e,t,n){const r=i;let s=r==null?void 0:r.__r3f;return s||(s={root:e,type:t,parent:null,children:[],props:Eq(n),object:r,eventCount:0,handlers:{},isHidden:!1},r&&(r.__r3f=s)),s}function $v(i,e){if(!e.includes("-"))return{root:i,key:e,target:i[e]};if(e in i)return{root:i,key:e,target:i[e]};let t=i;const n=e.split("-");for(const r of n){if(typeof t!="object"||t===null){if(t!==void 0){const s=n.slice(n.indexOf(r)).join("-");return{root:t,key:s,target:void 0}}return{root:i,key:e,target:void 0}}e=r,i=t,t=t[e]}return{root:i,key:e,target:t}}const QN=/-\d+$/;function Pb(i,e){if(Yi.str(e.props.attach)){if(QN.test(e.props.attach)){const r=e.props.attach.replace(QN,""),{root:s,key:a}=$v(i.object,r);Array.isArray(s[a])||(s[a]=[])}const{root:t,key:n}=$v(i.object,e.props.attach);e.previousAttach=t[n],t[n]=e.object}else Yi.fun(e.props.attach)&&(e.previousAttach=e.props.attach(i.object,e.object))}function Ob(i,e){if(Yi.str(e.props.attach)){const{root:t,key:n}=$v(i.object,e.props.attach),r=e.previousAttach;r===void 0?delete t[n]:t[n]=r}else e.previousAttach==null||e.previousAttach(i.object,e.object);delete e.previousAttach}const sE=[...D4,"args","dispose","attach","object","onUpdate","dispose"],JN=new Map;function Aq(i){let e=JN.get(i.constructor);try{e||(e=new i.constructor,JN.set(i.constructor,e))}catch{}return e}function Cq(i,e){const t={};for(const n in e)if(!sE.includes(n)&&!Yi.equ(e[n],i.props[n])){t[n]=e[n];for(const r in e)r.startsWith(`${n}-`)&&(t[r]=e[r])}for(const n in i.props){if(sE.includes(n)||e.hasOwnProperty(n))continue;const{root:r,key:s}=$v(i.object,n);if(r.constructor&&r.constructor.length===0){const a=Aq(r);Yi.und(a)||(t[s]=a[s])}else t[s]=0}return t}const Rq=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],Dq=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function Eu(i,e){var t;const n=i.__r3f,r=n&&A4(n).getState(),s=n==null?void 0:n.eventCount;for(const l in e){let c=e[l];if(sE.includes(l))continue;if(n&&Dq.test(l)){typeof c=="function"?n.handlers[l]=c:delete n.handlers[l],n.eventCount=Object.keys(n.handlers).length;continue}if(c===void 0)continue;let{root:h,key:p,target:g}=$v(i,l);if(g===void 0&&(typeof h!="object"||h===null))throw Error(`R3F: Cannot set "${l}". Ensure it is an object before setting "${p}".`);if(g instanceof Vm&&c instanceof Vm)g.mask=c.mask;else if(g instanceof zt&&_q(c))g.set(c);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof g.copy=="function"&&c!=null&&c.constructor&&g.constructor===c.constructor)g.copy(c);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&Array.isArray(c))typeof g.fromArray=="function"?g.fromArray(c):g.set(...c);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof c=="number")typeof g.setScalar=="function"?g.setScalar(c):g.set(c);else{var a;h[p]=c,r&&!r.linear&&Rq.includes(p)&&(a=h[p])!=null&&a.isTexture&&h[p].format===Ar&&h[p].type===is&&(h[p].colorSpace=bs)}}if(n!=null&&n.parent&&r!=null&&r.internal&&(t=n.object)!=null&&t.isObject3D&&s!==n.eventCount){const l=n.object,c=r.internal.interaction.indexOf(l);c>-1&&r.internal.interaction.splice(c,1),n.eventCount&&l.raycast!==null&&r.internal.interaction.push(l)}return n&&n.props.attach===void 0&&(n.object.isBufferGeometry?n.props.attach="geometry":n.object.isMaterial&&(n.props.attach="material")),n&&ig(n),i}function ig(i){var e;if(!i.parent)return;i.props.onUpdate==null||i.props.onUpdate(i.object);const t=(e=i.root)==null||e.getState==null?void 0:e.getState();t&&t.internal.frames===0&&t.invalidate()}function N4(i,e){i.manual||(C4(i)?(i.left=e.width/-2,i.right=e.width/2,i.top=e.height/2,i.bottom=e.height/-2):i.aspect=e.width/e.height,i.updateProjectionMatrix())}const ra=i=>i==null?void 0:i.isObject3D;function e1(i){return(i.eventObject||i.object).uuid+"/"+i.index+i.instanceId}function U4(i,e,t,n){const r=t.get(e);r&&(t.delete(e),t.size===0&&(i.delete(n),r.target.releasePointerCapture(n)))}function Nq(i,e){const{internal:t}=i.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,r)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(r)}),t.capturedMap.forEach((n,r)=>{U4(t.capturedMap,e,n,r)})}function Uq(i){function e(c){const{internal:h}=i.getState(),p=c.offsetX-h.initialClick[0],g=c.offsetY-h.initialClick[1];return Math.round(Math.sqrt(p*p+g*g))}function t(c){return c.filter(h=>["Move","Over","Enter","Out","Leave"].some(p=>{var g;return(g=h.__r3f)==null?void 0:g.handlers["onPointer"+p]}))}function n(c,h){const p=i.getState(),g=new Set,v=[],x=h?h(p.internal.interaction):p.internal.interaction;for(let M=0;M{const D=lm(M.object),R=lm(A.object);return!D||!R?M.distance-A.distance:R.events.priority-D.events.priority||M.distance-A.distance}).filter(M=>{const A=e1(M);return g.has(A)?!1:(g.add(A),!0)});p.events.filter&&(w=p.events.filter(w,p));for(const M of w){let A=M.object;for(;A;){var S;(S=A.__r3f)!=null&&S.eventCount&&v.push({...M,eventObject:A}),A=A.parent}}if("pointerId"in c&&p.internal.capturedMap.has(c.pointerId))for(let M of p.internal.capturedMap.get(c.pointerId).values())g.has(e1(M.intersection))||v.push(M.intersection);return v}function r(c,h,p,g){if(c.length){const v={stopped:!1};for(const x of c){let b=lm(x.object);if(b||x.object.traverseAncestors(w=>{const S=lm(w);if(S)return b=S,!1}),b){const{raycaster:w,pointer:S,camera:M,internal:A}=b,D=new re(S.x,S.y,0).unproject(M),R=L=>{var G,X;return(G=(X=A.capturedMap.get(L))==null?void 0:X.has(x.eventObject))!=null?G:!1},I=L=>{const G={intersection:x,target:h.target};A.capturedMap.has(L)?A.capturedMap.get(L).set(x.eventObject,G):A.capturedMap.set(L,new Map([[x.eventObject,G]])),h.target.setPointerCapture(L)},P=L=>{const G=A.capturedMap.get(L);G&&U4(A.capturedMap,x.eventObject,G,L)};let F={};for(let L in h){let G=h[L];typeof G!="function"&&(F[L]=G)}let N={...x,...F,pointer:S,intersections:c,stopped:v.stopped,delta:p,unprojectedPoint:D,ray:w.ray,camera:M,stopPropagation(){const L="pointerId"in h&&A.capturedMap.get(h.pointerId);if((!L||L.has(x.eventObject))&&(N.stopped=v.stopped=!0,A.hovered.size&&Array.from(A.hovered.values()).find(G=>G.eventObject===x.eventObject))){const G=c.slice(0,c.indexOf(x));s([...G,x])}},target:{hasPointerCapture:R,setPointerCapture:I,releasePointerCapture:P},currentTarget:{hasPointerCapture:R,setPointerCapture:I,releasePointerCapture:P},nativeEvent:h};if(g(N),v.stopped===!0)break}}}return c}function s(c){const{internal:h}=i.getState();for(const p of h.hovered.values())if(!c.length||!c.find(g=>g.object===p.object&&g.index===p.index&&g.instanceId===p.instanceId)){const v=p.eventObject.__r3f;if(h.hovered.delete(e1(p)),v!=null&&v.eventCount){const x=v.handlers,b={...p,intersections:c};x.onPointerOut==null||x.onPointerOut(b),x.onPointerLeave==null||x.onPointerLeave(b)}}}function a(c,h){for(let p=0;ps([]);case"onLostPointerCapture":return h=>{const{internal:p}=i.getState();"pointerId"in h&&p.capturedMap.has(h.pointerId)&&requestAnimationFrame(()=>{p.capturedMap.has(h.pointerId)&&(p.capturedMap.delete(h.pointerId),s([]))})}}return function(p){const{onPointerMissed:g,internal:v}=i.getState();v.lastEvent.current=p;const x=c==="onPointerMove",b=c==="onClick"||c==="onContextMenu"||c==="onDoubleClick",S=n(p,x?t:void 0),M=b?e(p):0;c==="onPointerDown"&&(v.initialClick=[p.offsetX,p.offsetY],v.initialHits=S.map(D=>D.eventObject)),b&&!S.length&&M<=2&&(a(p,v.interaction),g&&g(p)),x&&s(S);function A(D){const R=D.eventObject,I=R.__r3f;if(!(I!=null&&I.eventCount))return;const P=I.handlers;if(x){if(P.onPointerOver||P.onPointerEnter||P.onPointerOut||P.onPointerLeave){const F=e1(D),N=v.hovered.get(F);N?N.stopped&&D.stopPropagation():(v.hovered.set(F,D),P.onPointerOver==null||P.onPointerOver(D),P.onPointerEnter==null||P.onPointerEnter(D))}P.onPointerMove==null||P.onPointerMove(D)}else{const F=P[c];F?(!b||v.initialHits.includes(R))&&(a(p,v.interaction.filter(N=>!v.initialHits.includes(N))),F(D)):b&&v.initialHits.includes(R)&&a(p,v.interaction.filter(N=>!v.initialHits.includes(N)))}}r(S,p,M,A)}}return{handlePointer:l}}const $N=i=>!!(i!=null&&i.render),uC=ae.createContext(null),Lq=(i,e)=>{const t=_4((l,c)=>{const h=new re,p=new re,g=new re;function v(M=c().camera,A=p,D=c().size){const{width:R,height:I,top:P,left:F}=D,N=R/I;A.isVector3?g.copy(A):g.set(...A);const L=M.getWorldPosition(h).distanceTo(g);if(C4(M))return{width:R/M.zoom,height:I/M.zoom,top:P,left:F,factor:1,distance:L,aspect:N};{const G=M.fov*Math.PI/180,X=2*Math.tan(G/2)*L,W=X*(R/I);return{width:W,height:X,top:P,left:F,factor:R/W,distance:L,aspect:N}}}let x;const b=M=>l(A=>({performance:{...A.performance,current:M}})),w=new pt;return{set:l,get:c,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(M=1)=>i(c(),M),advance:(M,A)=>e(M,A,c()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new h4,pointer:w,mouse:w,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const M=c();x&&clearTimeout(x),M.performance.current!==M.performance.min&&b(M.performance.min),x=setTimeout(()=>b(c().performance.max),M.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:v},setEvents:M=>l(A=>({...A,events:{...A.events,...M}})),setSize:(M,A,D=0,R=0)=>{const I=c().camera,P={width:M,height:A,top:D,left:R};l(F=>({size:P,viewport:{...F.viewport,...v(I,p,P)}}))},setDpr:M=>l(A=>{const D=R4(M);return{viewport:{...A.viewport,dpr:D,initialDpr:A.viewport.initialDpr||D}}}),setFrameloop:(M="always")=>{const A=c().clock;A.stop(),A.elapsedTime=0,M!=="never"&&(A.start(),A.elapsedTime=0),l(()=>({frameloop:M}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:ae.createRef(),active:!1,frames:0,priority:0,subscribe:(M,A,D)=>{const R=c().internal;return R.priority=R.priority+(A>0?1:0),R.subscribers.push({ref:M,priority:A,store:D}),R.subscribers=R.subscribers.sort((I,P)=>I.priority-P.priority),()=>{const I=c().internal;I!=null&&I.subscribers&&(I.priority=I.priority-(A>0?1:0),I.subscribers=I.subscribers.filter(P=>P.ref!==M))}}}}}),n=t.getState();let r=n.size,s=n.viewport.dpr,a=n.camera;return t.subscribe(()=>{const{camera:l,size:c,viewport:h,gl:p,set:g}=t.getState();if(c.width!==r.width||c.height!==r.height||h.dpr!==s){r=c,s=h.dpr,N4(l,c),h.dpr>0&&p.setPixelRatio(h.dpr);const v=typeof HTMLCanvasElement<"u"&&p.domElement instanceof HTMLCanvasElement;p.setSize(c.width,c.height,v)}l!==a&&(a=l,g(v=>({viewport:{...v.viewport,...v.viewport.getCurrentViewport(l)}})))}),t.subscribe(l=>i(l)),t};function cC(){const i=ae.useContext(uC);if(!i)throw new Error("R3F: Hooks can only be used within the Canvas component!");return i}function Bs(i=t=>t,e){return cC()(i,e)}function Gs(i,e=0){const t=cC(),n=t.getState().internal.subscribe,r=lC(i);return _y(()=>n(r,e,t),[e,n,t]),null}const eU=new WeakMap,Iq=i=>{var e;return typeof i=="function"&&(i==null||(e=i.prototype)==null?void 0:e.constructor)===i};function L4(i,e){return function(t,...n){let r;return Iq(t)?(r=eU.get(t),r||(r=new t,eU.set(t,r))):r=t,i&&i(r),Promise.all(n.map(s=>new Promise((a,l)=>r.load(s,c=>{ra(c==null?void 0:c.scene)&&Object.assign(c,wq(c.scene)),a(c)},e,c=>l(new Error(`Could not load ${s}: ${c==null?void 0:c.message}`))))))}}function Wm(i,e,t,n){const r=Array.isArray(e)?e:[e],s=M4(L4(t,n),[i,...r],{equal:Yi.equ});return Array.isArray(e)?s:s[0]}Wm.preload=function(i,e,t){const n=Array.isArray(e)?e:[e];return hq(L4(t),[i,...n])};Wm.clear=function(i,e){const t=Array.isArray(e)?e:[e];return dq([i,...t])};/** * @license React * react-reconciler-constants.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */const Pq=1,Oq=8,Fq=32,kq=2;var zq={version:"9.5.0"};function Bq(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var tU={exports:{}},nU={exports:{}},iU;function Vq(){return iU||(iU=1,(function(i){i.exports=function(e){function t(f,d,_,T){return new wg(f,d,_,T)}function n(){}function r(f){var d="https://react.dev/errors/"+f;if(1rc||(f.current=bp[rc],bp[rc]=null,rc--)}function b(f,d){rc++,bp[rc]=f.current,f.current=d}function w(f){return f>>>=0,f===0?32:31-(Sp(f)/Lx|0)|0}function S(f){var d=f&42;if(d!==0)return d;switch(f&-f){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return f&261888;case 262144:case 524288:case 1048576:case 2097152:return f&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return f&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return f}}function M(f,d,_){var T=f.pendingLanes;if(T===0)return 0;var U=0,O=f.suspendedLanes,J=f.pingedLanes;f=f.warmLanes;var xe=T&134217727;return xe!==0?(T=xe&~O,T!==0?U=S(T):(J&=xe,J!==0?U=S(J):_||(_=xe&~f,_!==0&&(U=S(_))))):(xe=T&~O,xe!==0?U=S(xe):J!==0?U=S(J):_||(_=T&~f,_!==0&&(U=S(_)))),U===0?0:d!==0&&d!==U&&(d&O)===0&&(O=U&-U,_=d&-d,O>=_||O===32&&(_&4194048)!==0)?d:U}function A(f,d){return(f.pendingLanes&~(f.suspendedLanes&~f.pingedLanes)&d)===0}function D(f,d){switch(f){case 1:case 2:case 4:case 8:case 64:return d+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return d+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function R(){var f=Jc;return Jc<<=1,(Jc&62914560)===0&&(Jc=4194304),f}function I(f){for(var d=[],_=0;31>_;_++)d.push(f);return d}function P(f,d){f.pendingLanes|=d,d!==268435456&&(f.suspendedLanes=0,f.pingedLanes=0,f.warmLanes=0)}function F(f,d,_,T,U,O){var J=f.pendingLanes;f.pendingLanes=_,f.suspendedLanes=0,f.pingedLanes=0,f.warmLanes=0,f.expiredLanes&=_,f.entangledLanes&=_,f.errorRecoveryDisabledLanes&=_,f.shellSuspendCounter=0;var xe=f.entanglements,Ze=f.expirationTimes,xt=f.hiddenUpdates;for(_=J&~_;0<_;){var Ut=31-Rs(_),bt=1<)":-1<_.stack.indexOf("@")?"@unknown:0:0":""}return` `+Cp+f+Oo}function j(f,d){if(!f||Th)return"";Th=!0;var _=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var T={DetermineComponentFrameRoot:function(){try{if(d){var bt=function(){throw Error()};if(Object.defineProperty(bt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(bt,[])}catch(dn){var Ht=dn}Reflect.construct(f,[],bt)}else{try{bt.call()}catch(dn){Ht=dn}f.call(bt.prototype)}}else{try{throw Error()}catch(dn){Ht=dn}(bt=f())&&typeof bt.catch=="function"&&bt.catch(function(){})}}catch(dn){if(dn&&Ht&&typeof dn.stack=="string")return[dn.stack,Ht.stack]}return[null,null]}};T.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var U=Object.getOwnPropertyDescriptor(T.DetermineComponentFrameRoot,"name");U&&U.configurable&&Object.defineProperty(T.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var O=T.DetermineComponentFrameRoot(),J=O[0],xe=O[1];if(J&&xe){var Ze=J.split(` `),xt=xe.split(` `);for(U=T=0;TU||Ze[T]!==xt[U]){var Ut=` `+Ze[T].replace(" at new "," at ");return f.displayName&&Ut.includes("")&&(Ut=Ut.replace("",f.displayName)),Ut}while(1<=T&&0<=U);break}}}finally{Th=!1,Error.prepareStackTrace=_}return(_=f?f.displayName||f.name:"")?ne(_):""}function $(f,d){switch(f.tag){case 26:case 27:case 5:return ne(f.type);case 16:return ne("Lazy");case 13:return f.child!==d&&d!==null?ne("Suspense Fallback"):ne("Suspense");case 19:return ne("SuspenseList");case 0:case 15:return j(f.type,!1);case 11:return j(f.type.render,!1);case 1:return j(f.type,!0);case 31:return ne("Activity");default:return""}}function he(f){try{var d="",_=null;do d+=$(f,_),_=f,f=f.return;while(f);return d}catch(T){return` Error generating stack: `+T.message+` `+T.stack}}function le(f,d){if(typeof f=="object"&&f!==null){var _=c0.get(f);return _!==void 0?_:(d={value:f,source:d,stack:he(d)},c0.set(f,d),d)}return{value:f,source:d,stack:he(d)}}function ue(f,d){pl[Fo++]=Eh,pl[Fo++]=ui,ui=f,Eh=d}function k(f,d,_){Ea[Qs++]=zr,Ea[Qs++]=Za,Ea[Qs++]=Aa,Aa=f;var T=zr;f=Za;var U=32-Rs(T)-1;T&=~(1<>=J,U-=J,zr=1<<32-Rs(d)+U|_<Vn?(Lr=an,an=null):Lr=an.sibling;var Zn=Ht(Be,an,Xe[Vn],Dt);if(Zn===null){an===null&&(an=Lr);break}f&&an&&Zn.alternate===null&&d(Be,an),De=O(Zn,De,Vn),zi===null?sn=Zn:zi.sibling=Zn,zi=Zn,an=Lr}if(Vn===Xe.length)return _(Be,an),Un&&ue(Be,Vn),sn;if(an===null){for(;VnVn?(Lr=an,an=null):Lr=an.sibling;var Ia=Ht(Be,an,Zn.value,Dt);if(Ia===null){an===null&&(an=Lr);break}f&&an&&Ia.alternate===null&&d(Be,an),De=O(Ia,De,Vn),zi===null?sn=Ia:zi.sibling=Ia,zi=Ia,an=Lr}if(Zn.done)return _(Be,an),Un&&ue(Be,Vn),sn;if(an===null){for(;!Zn.done;Vn++,Zn=Xe.next())Zn=bt(Be,Zn.value,Dt),Zn!==null&&(De=O(Zn,De,Vn),zi===null?sn=Zn:zi.sibling=Zn,zi=Zn);return Un&&ue(Be,Vn),sn}for(an=T(an);!Zn.done;Vn++,Zn=Xe.next())Zn=dn(an,Be,Vn,Zn.value,Dt),Zn!==null&&(f&&Zn.alternate!==null&&an.delete(Zn.key===null?Vn:Zn.key),De=O(Zn,De,Vn),zi===null?sn=Zn:zi.sibling=Zn,zi=Zn);return f&&an.forEach(function(YS){return d(Be,YS)}),Un&&ue(Be,Vn),sn}function vu(Be,De,Xe,Dt){if(typeof Xe=="object"&&Xe!==null&&Xe.type===Qu&&Xe.key===null&&(Xe=Xe.props.children),typeof Xe=="object"&&Xe!==null){switch(Xe.$$typeof){case Io:e:{for(var sn=Xe.key;De!==null;){if(De.key===sn){if(sn=Xe.type,sn===Qu){if(De.tag===7){_(Be,De.sibling),Dt=U(De,Xe.props.children),Dt.return=Be,Be=Dt;break e}}else if(De.elementType===sn||typeof sn=="object"&&sn!==null&&sn.$$typeof===ds&&Ot(sn)===De.type){_(Be,De.sibling),Dt=U(De,Xe.props),Qn(Dt,Xe),Dt.return=Be,Be=Dt;break e}_(Be,De);break}else d(Be,De);De=De.sibling}Xe.type===Qu?(Dt=Sa(Xe.props.children,Be.mode,Dt,Xe.key),Dt.return=Be,Be=Dt):(Dt=ul(Xe.type,Xe.key,Xe.props,null,Be.mode,Dt),Qn(Dt,Xe),Dt.return=Be,Be=Dt)}return J(Be);case Ku:e:{for(sn=Xe.key;De!==null;){if(De.key===sn)if(De.tag===4&&De.stateNode.containerInfo===Xe.containerInfo&&De.stateNode.implementation===Xe.implementation){_(Be,De.sibling),Dt=U(De,Xe.children||[]),Dt.return=Be,Be=Dt;break e}else{_(Be,De);break}else d(Be,De);De=De.sibling}Dt=Ag(Xe,Be.mode,Dt),Dt.return=Be,Be=Dt}return J(Be);case ds:return Xe=Ot(Xe),vu(Be,De,Xe,Dt)}if(iu(Xe))return tr(Be,De,Xe,Dt);if(p(Xe)){if(sn=p(Xe),typeof sn!="function")throw Error(r(150));return Xe=sn.call(Xe),lf(Be,De,Xe,Dt)}if(typeof Xe.then=="function")return vu(Be,De,Wn(Xe),Dt);if(Xe.$$typeof===Ma)return vu(Be,De,B(Be,Xe),Dt);Ui(Be,Xe)}return typeof Xe=="string"&&Xe!==""||typeof Xe=="number"||typeof Xe=="bigint"?(Xe=""+Xe,De!==null&&De.tag===6?(_(Be,De.sibling),Dt=U(De,Xe),Dt.return=Be,Be=Dt):(_(Be,De),Dt=Tg(Xe,Be.mode,Dt),Dt.return=Be,Be=Dt),J(Be)):_(Be,De)}return function(Be,De,Xe,Dt){try{oc=0;var sn=vu(Be,De,Xe,Dt);return uu=null,sn}catch(an){if(an===Mr||an===Na)throw an;var zi=t(29,an,null,Be.mode);return zi.lanes=Dt,zi.return=Be,zi}finally{}}}function Zi(){for(var f=Bo,d=lc=Bo=0;dO?O:8);var J=nn.T,xe={};nn.T=xe,zd(f,!1,d,_);try{var Ze=U(),xt=nn.S;if(xt!==null&&xt(xe,Ze),Ze!==null&&typeof Ze=="object"&&typeof Ze.then=="function"){var Ut=we(Ze,T);jl(f,d,Ut,Ci(f))}else jl(f,d,T,Ci(f))}catch(bt){jl(f,d,{then:function(){},status:"rejected",reason:bt},Ci())}finally{Nn(O),J!==null&&xe.types!==null&&(J.types=xe.types),nn.T=J}}function Vu(f){var d=f.memoizedState;if(d!==null)return d;d={memoizedState:tc,baseState:tc,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:En,lastRenderedState:tc},next:null};var _={};return d.next={memoizedState:_,baseState:_,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:En,lastRenderedState:_},next:null},f.memoizedState=d,f=f.alternate,f!==null&&(f.memoizedState=d),d}function Rc(){return Q(nc)}function Dc(){return yt().memoizedState}function Fr(){return yt().memoizedState}function Xs(f){for(var d=f.return;d!==null;){switch(d.tag){case 24:case 3:var _=Ci();f=me(_);var T=Oe(d,f,_);T!==null&&(Ii(T,d,_),je(T,d,_)),d={cache:Ue()},f.payload=d;return}d=d.return}}function Zr(f,d,_){var T=Ci();_={lane:T,revertLane:0,gesture:null,action:_,hasEagerState:!1,eagerState:null,next:null},Bd(f)?wy(d,_):(_=pi(f,d,_,T),_!==null&&(Ii(_,f,T),Ty(_,d,T)))}function Ya(f,d,_){var T=Ci();jl(f,d,_,T)}function jl(f,d,_,T){var U={lane:T,revertLane:0,gesture:null,action:_,hasEagerState:!1,eagerState:null,next:null};if(Bd(f))wy(d,U);else{var O=f.alternate;if(f.lanes===0&&(O===null||O.lanes===0)&&(O=d.lastRenderedReducer,O!==null))try{var J=d.lastRenderedState,xe=O(J,_);if(U.hasEagerState=!0,U.eagerState=xe,Ji(xe,J))return Ti(f,d,U,0),Mn===null&&Zi(),!1}catch{}finally{}if(_=pi(f,d,U,T),_!==null)return Ii(_,f,T),Ty(_,d,T),!0}return!1}function zd(f,d,_,T){if(T={lane:2,revertLane:mt(),gesture:null,action:T,hasEagerState:!1,eagerState:null,next:null},Bd(f)){if(d)throw Error(r(479))}else d=pi(f,_,T,2),d!==null&&Ii(d,f,2)}function Bd(f){var d=f.alternate;return f===gn||d!==null&&d===gn}function wy(f,d){_n=Sn=!0;var _=f.pending;_===null?d.next=d:(d.next=_.next,_.next=d),f.pending=d}function Ty(f,d,_){if((_&4194048)!==0){var T=d.lanes;T&=f.pendingLanes,_|=T,d.lanes=_,L(f,_)}}function ag(f,d,_,T){d=f.memoizedState,_=_(T,d),_=_==null?d:ap({},d,_),f.memoizedState=_,f.lanes===0&&(f.updateQueue.baseState=_)}function Vd(f,d,_,T,U,O,J){return f=f.stateNode,typeof f.shouldComponentUpdate=="function"?f.shouldComponentUpdate(T,O,J):d.prototype&&d.prototype.isPureReactComponent?!Ne(_,T)||!Ne(U,O):!0}function Ey(f,d,_,T){f=d.state,typeof d.componentWillReceiveProps=="function"&&d.componentWillReceiveProps(_,T),typeof d.UNSAFE_componentWillReceiveProps=="function"&&d.UNSAFE_componentWillReceiveProps(_,T),d.state!==f&&Rh.enqueueReplaceState(d,d.state,null)}function Gu(f,d){var _=d;if("ref"in d){_={};for(var T in d)T!=="ref"&&(_[T]=d[T])}if(f=f.defaultProps){_===d&&(_=ap({},_));for(var U in f)_[U]===void 0&&(_[U]=f[U])}return _}function Gd(f,d){try{var _=f.onUncaughtError;_(d.value,{componentStack:d.stack})}catch(T){setTimeout(function(){throw T})}}function og(f,d,_){try{var T=f.onCaughtError;T(_.value,{componentStack:_.stack,errorBoundary:d.tag===1?d.stateNode:null})}catch(U){setTimeout(function(){throw U})}}function lg(f,d,_){return _=me(_),_.tag=3,_.payload={element:null},_.callback=function(){Gd(f,d)},_}function Ay(f){return f=me(f),f.tag=3,f}function Cy(f,d,_,T){var U=_.type.getDerivedStateFromError;if(typeof U=="function"){var O=T.value;f.payload=function(){return U(O)},f.callback=function(){og(d,_,T)}}var J=_.stateNode;J!==null&&typeof J.componentDidCatch=="function"&&(f.callback=function(){og(d,_,T),typeof U!="function"&&(xl===null?xl=new Set([this]):xl.add(this));var xe=T.stack;this.componentDidCatch(T.value,{componentStack:xe!==null?xe:""})})}function FS(f,d,_,T,U){if(_.flags|=32768,T!==null&&typeof T=="object"&&typeof T.then=="function"){if(d=_.alternate,d!==null&&Ye(d,_,U,!0),_=Ns.current,_!==null){switch(_.tag){case 31:case 13:return Us===null?Vc():_.alternate===null&&ki===0&&(ki=3),_.flags&=-257,_.flags|=65536,_.lanes=U,T===zo?_.flags|=16384:(d=_.updateQueue,d===null?_.updateQueue=new Set([T]):d.add(T),Wc(f,T,U)),!1;case 22:return _.flags|=65536,T===zo?_.flags|=16384:(d=_.updateQueue,d===null?(d={transitions:null,markerInstances:null,retryQueue:new Set([T])},_.updateQueue=d):(_=d.retryQueue,_===null?d.retryQueue=new Set([T]):_.add(T)),Wc(f,T,U)),!1}throw Error(r(435,_.tag))}return Wc(f,T,U),Vc(),!1}if(Un)return d=Ns.current,d!==null?((d.flags&65536)===0&&(d.flags|=256),d.flags|=65536,d.lanes=U,T!==Rp&&(f=Error(r(422),{cause:T}),ze(le(f,_)))):(T!==Rp&&(d=Error(r(423),{cause:T}),ze(le(d,_))),f=f.current.alternate,f.flags|=65536,U&=-U,f.lanes|=U,T=le(T,_),U=lg(f.stateNode,T,U),qe(f,U),ki!==4&&(ki=2)),!1;var O=Error(r(520),{cause:T});if(O=le(O,_),Nh===null?Nh=[O]:Nh.push(O),ki!==4&&(ki=2),d===null)return!0;T=le(T,_),_=d;do{switch(_.tag){case 3:return _.flags|=65536,f=U&-U,_.lanes|=f,f=lg(_.stateNode,T,f),qe(_,f),!1;case 1:if(d=_.type,O=_.stateNode,(_.flags&128)===0&&(typeof d.getDerivedStateFromError=="function"||O!==null&&typeof O.componentDidCatch=="function"&&(xl===null||!xl.has(O))))return _.flags|=65536,U&=-U,_.lanes|=U,U=Ay(U),Cy(U,f,_,T),qe(_,U),!1}_=_.return}while(_!==null);return!1}function kr(f,d,_,T){d.child=f===null?h0(d,null,_,T):Vr(d,f.child,_,T)}function Ry(f,d,_,T,U){_=_.render;var O=d.ref;if("ref"in T){var J={};for(var xe in T)xe!=="ref"&&(J[xe]=T[xe])}else J=T;return We(d),T=It(f,d,_,J,O,U),xe=pn(),f!==null&&!bi?(Pn(f,d,U),Mo(f,d,U)):(Un&&xe&&Z(d),d.flags|=1,kr(f,d,T,U),d.child)}function Dy(f,d,_,T,U){if(f===null){var O=_.type;return typeof O=="function"&&!Yu(O)&&O.defaultProps===void 0&&_.compare===null?(d.tag=15,d.type=O,Ny(f,d,O,T,U)):(f=ul(_.type,null,T,d,d.mode,U),f.ref=d.ref,f.return=d,d.child=f)}if(O=f.child,!ih(f,U)){var J=O.memoizedProps;if(_=_.compare,_=_!==null?_:Ne,_(J,T)&&f.ref===d.ref)return Mo(f,d,U)}return d.flags|=1,f=Zs(O,T),f.ref=d.ref,f.return=d,d.child=f}function Ny(f,d,_,T,U){if(f!==null){var O=f.memoizedProps;if(Ne(O,T)&&f.ref===d.ref)if(bi=!1,d.pendingProps=T=O,ih(f,U))(f.flags&131072)!==0&&(bi=!0);else return d.lanes=f.lanes,Mo(f,d,U)}return Wd(f,d,_,T,U)}function Uy(f,d,_,T){var U=T.children,O=f!==null?f.memoizedState:null;if(f===null&&d.stateNode===null&&(d.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),T.mode==="hidden"){if((d.flags&128)!==0){if(O=O!==null?O.baseLanes|_:_,f!==null){for(T=d.child=f.child,U=0;T!==null;)U=U|T.lanes|T.childLanes,T=T.sibling;T=U&~O}else T=0,d.child=null;return Nc(f,d,O,_,T)}if((_&536870912)!==0)d.memoizedState={baseLanes:0,cachePool:null},f!==null&&Lt(d,O!==null?O.cachePool:null),O!==null?At(d,O):V(),Se(d);else return T=d.lanes=536870912,Nc(f,d,O!==null?O.baseLanes|_:_,_,T)}else O!==null?(Lt(d,O.cachePool),At(d,O),nt(),d.memoizedState=null):(f!==null&&Lt(d,null),V(),nt());return kr(f,d,U,_),d.child}function Hu(f,d){return f!==null&&f.tag===22||d.stateNode!==null||(d.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.sibling}function Nc(f,d,_,T,U){var O=it();return O=O===null?null:{parent:Ki?Ni._currentValue:Ni._currentValue2,pool:O},d.memoizedState={baseLanes:_,cachePool:O},f!==null&&Lt(d,null),V(),Se(d),f!==null&&Ye(f,d,T,!0),d.childLanes=U,null}function Hd(f,d){return d=Xl({mode:d.mode,children:d.children},f.mode),d.ref=f.ref,f.child=d,d.return=f,d}function ug(f,d,_){return Vr(d,f.child,null,_),f=Hd(d,d.pendingProps),f.flags|=2,ht(d),d.memoizedState=null,f}function Ly(f,d,_){var T=d.pendingProps,U=(d.flags&128)!==0;if(d.flags&=-129,f===null){if(Un){if(T.mode==="hidden")return f=Hd(d,T),d.lanes=536870912,Hu(null,f);if(_e(d),(f=Di)?(f=Kg(f,ms),f!==null&&(d.memoizedState={dehydrated:f,treeContext:Aa!==null?{id:zr,overflow:Za}:null,retryLane:536870912,hydrationErrors:null},_=Eg(f),_.return=d,d.child=_,br=d,Di=null)):f=null,f===null)throw Ge(d);return d.lanes=536870912,null}return Hd(d,T)}var O=f.memoizedState;if(O!==null){var J=O.dehydrated;if(_e(d),U)if(d.flags&256)d.flags&=-257,d=ug(f,d,_);else if(d.memoizedState!==null)d.child=f.child,d.flags|=128,d=null;else throw Error(r(558));else if(bi||Ye(f,d,_,!1),U=(_&f.childLanes)!==0,bi||U){if(T=Mn,T!==null&&(J=G(T,_),J!==0&&J!==O.retryLane))throw O.retryLane=J,Jt(f,J),Ii(T,f,J),vs;Vc(),d=ug(f,d,_)}else f=O.treeContext,Ri&&(Di=gx(J),br=d,Un=!0,ko=null,ms=!1,f!==null&&fe(d,f)),d=Hd(d,T),d.flags|=4096;return d}return f=Zs(f.child,{mode:T.mode,children:T.children}),f.ref=d.ref,d.child=f,f.return=d,f}function nh(f,d){var _=d.ref;if(_===null)f!==null&&f.ref!==null&&(d.flags|=4194816);else{if(typeof _!="function"&&typeof _!="object")throw Error(r(284));(f===null||f.ref!==_)&&(d.flags|=4194816)}}function Wd(f,d,_,T,U){return We(d),_=It(f,d,_,T,void 0,U),T=pn(),f!==null&&!bi?(Pn(f,d,U),Mo(f,d,U)):(Un&&T&&Z(d),d.flags|=1,kr(f,d,_,U),d.child)}function cg(f,d,_,T,U,O){return We(d),d.updateQueue=null,_=St(d,T,_,U),Kt(f),T=pn(),f!==null&&!bi?(Pn(f,d,O),Mo(f,d,O)):(Un&&T&&Z(d),d.flags|=1,kr(f,d,_,O),d.child)}function Wu(f,d,_,T,U){if(We(d),d.stateNode===null){var O=Po,J=_.contextType;typeof J=="object"&&J!==null&&(O=Q(J)),O=new _(T,O),d.memoizedState=O.state!==null&&O.state!==void 0?O.state:null,O.updater=Rh,d.stateNode=O,O._reactInternals=d,O=d.stateNode,O.props=T,O.state=d.memoizedState,O.refs={},Y(d),J=_.contextType,O.context=typeof J=="object"&&J!==null?Q(J):Po,O.state=d.memoizedState,J=_.getDerivedStateFromProps,typeof J=="function"&&(ag(d,_,J,T),O.state=d.memoizedState),typeof _.getDerivedStateFromProps=="function"||typeof O.getSnapshotBeforeUpdate=="function"||typeof O.UNSAFE_componentWillMount!="function"&&typeof O.componentWillMount!="function"||(J=O.state,typeof O.componentWillMount=="function"&&O.componentWillMount(),typeof O.UNSAFE_componentWillMount=="function"&&O.UNSAFE_componentWillMount(),J!==O.state&&Rh.enqueueReplaceState(O,O.state,null),vt(d,T,O,U),_t(),O.state=d.memoizedState),typeof O.componentDidMount=="function"&&(d.flags|=4194308),T=!0}else if(f===null){O=d.stateNode;var xe=d.memoizedProps,Ze=Gu(_,xe);O.props=Ze;var xt=O.context,Ut=_.contextType;J=Po,typeof Ut=="object"&&Ut!==null&&(J=Q(Ut));var bt=_.getDerivedStateFromProps;Ut=typeof bt=="function"||typeof O.getSnapshotBeforeUpdate=="function",xe=d.pendingProps!==xe,Ut||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(xe||xt!==J)&&Ey(d,O,T,J),Js=!1;var Ht=d.memoizedState;O.state=Ht,vt(d,T,O,U),_t(),xt=d.memoizedState,xe||Ht!==xt||Js?(typeof bt=="function"&&(ag(d,_,bt,T),xt=d.memoizedState),(Ze=Js||Vd(d,_,Ze,T,Ht,xt,J))?(Ut||typeof O.UNSAFE_componentWillMount!="function"&&typeof O.componentWillMount!="function"||(typeof O.componentWillMount=="function"&&O.componentWillMount(),typeof O.UNSAFE_componentWillMount=="function"&&O.UNSAFE_componentWillMount()),typeof O.componentDidMount=="function"&&(d.flags|=4194308)):(typeof O.componentDidMount=="function"&&(d.flags|=4194308),d.memoizedProps=T,d.memoizedState=xt),O.props=T,O.state=xt,O.context=J,T=Ze):(typeof O.componentDidMount=="function"&&(d.flags|=4194308),T=!1)}else{O=d.stateNode,ie(f,d),J=d.memoizedProps,Ut=Gu(_,J),O.props=Ut,bt=d.pendingProps,Ht=O.context,xt=_.contextType,Ze=Po,typeof xt=="object"&&xt!==null&&(Ze=Q(xt)),xe=_.getDerivedStateFromProps,(xt=typeof xe=="function"||typeof O.getSnapshotBeforeUpdate=="function")||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(J!==bt||Ht!==Ze)&&Ey(d,O,T,Ze),Js=!1,Ht=d.memoizedState,O.state=Ht,vt(d,T,O,U),_t();var dn=d.memoizedState;J!==bt||Ht!==dn||Js||f!==null&&f.dependencies!==null&&Re(f.dependencies)?(typeof xe=="function"&&(ag(d,_,xe,T),dn=d.memoizedState),(Ut=Js||Vd(d,_,Ut,T,Ht,dn,Ze)||f!==null&&f.dependencies!==null&&Re(f.dependencies))?(xt||typeof O.UNSAFE_componentWillUpdate!="function"&&typeof O.componentWillUpdate!="function"||(typeof O.componentWillUpdate=="function"&&O.componentWillUpdate(T,dn,Ze),typeof O.UNSAFE_componentWillUpdate=="function"&&O.UNSAFE_componentWillUpdate(T,dn,Ze)),typeof O.componentDidUpdate=="function"&&(d.flags|=4),typeof O.getSnapshotBeforeUpdate=="function"&&(d.flags|=1024)):(typeof O.componentDidUpdate!="function"||J===f.memoizedProps&&Ht===f.memoizedState||(d.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||J===f.memoizedProps&&Ht===f.memoizedState||(d.flags|=1024),d.memoizedProps=T,d.memoizedState=dn),O.props=T,O.state=dn,O.context=Ze,T=Ut):(typeof O.componentDidUpdate!="function"||J===f.memoizedProps&&Ht===f.memoizedState||(d.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||J===f.memoizedProps&&Ht===f.memoizedState||(d.flags|=1024),T=!1)}return O=T,nh(f,d),T=(d.flags&128)!==0,O||T?(O=d.stateNode,_=T&&typeof _.getDerivedStateFromError!="function"?null:O.render(),d.flags|=1,f!==null&&T?(d.child=Vr(d,f.child,null,U),d.child=Vr(d,null,_,U)):kr(f,d,_,U),d.memoizedState=O.state,f=d.child):f=Mo(f,d,U),f}function Iy(f,d,_,T){return Mt(),d.flags|=256,kr(f,d,_,T),d.child}function fg(f){return{baseLanes:f,cachePool:et()}}function hg(f,d,_){return f=f!==null?f.childLanes&~_:0,d&&(f|=ys),f}function dg(f,d,_){var T=d.pendingProps,U=!1,O=(d.flags&128)!==0,J;if((J=O)||(J=f!==null&&f.memoizedState===null?!1:(Wi.current&2)!==0),J&&(U=!0,d.flags&=-129),J=(d.flags&32)!==0,d.flags&=-33,f===null){if(Un){if(U?Me(d):nt(),(f=Di)?(f=_x(f,ms),f!==null&&(d.memoizedState={dehydrated:f,treeContext:Aa!==null?{id:zr,overflow:Za}:null,retryLane:536870912,hydrationErrors:null},_=Eg(f),_.return=d,d.child=_,br=d,Di=null)):f=null,f===null)throw Ge(d);return pp(f)?d.lanes=32:d.lanes=536870912,null}var xe=T.children;return T=T.fallback,U?(nt(),U=d.mode,xe=Xl({mode:"hidden",children:xe},U),T=Sa(T,U,_,null),xe.return=d,T.return=d,xe.sibling=T,d.child=xe,T=d.child,T.memoizedState=fg(_),T.childLanes=hg(f,J,_),d.memoizedState=cc,Hu(null,T)):(Me(d),jd(d,xe))}var Ze=f.memoizedState;if(Ze!==null&&(xe=Ze.dehydrated,xe!==null)){if(O)d.flags&256?(Me(d),d.flags&=-257,d=ju(f,d,_)):d.memoizedState!==null?(nt(),d.child=f.child,d.flags|=128,d=null):(nt(),xe=T.fallback,U=d.mode,T=Xl({mode:"visible",children:T.children},U),xe=Sa(xe,U,_,null),xe.flags|=2,T.return=d,xe.return=d,T.sibling=xe,d.child=T,Vr(d,f.child,null,_),T=d.child,T.memoizedState=fg(_),T.childLanes=hg(f,J,_),d.memoizedState=cc,d=Hu(null,T));else if(Me(d),pp(xe))J=mp(xe).digest,T=Error(r(419)),T.stack="",T.digest=J,ze({value:T,source:null,stack:null}),d=ju(f,d,_);else if(bi||Ye(f,d,_,!1),J=(_&f.childLanes)!==0,bi||J){if(J=Mn,J!==null&&(T=G(J,_),T!==0&&T!==Ze.retryLane))throw Ze.retryLane=T,Jt(f,T),Ii(J,f,T),vs;su(xe)||Vc(),d=ju(f,d,_)}else su(xe)?(d.flags|=192,d.child=f.child,d=null):(f=Ze.treeContext,Ri&&(Di=vx(xe),br=d,Un=!0,ko=null,ms=!1,f!==null&&fe(d,f)),d=jd(d,T.children),d.flags|=4096);return d}return U?(nt(),xe=T.fallback,U=d.mode,Ze=f.child,O=Ze.sibling,T=Zs(Ze,{mode:"hidden",children:T.children}),T.subtreeFlags=Ze.subtreeFlags&65011712,O!==null?xe=Zs(O,xe):(xe=Sa(xe,U,_,null),xe.flags|=2),xe.return=d,T.return=d,T.sibling=xe,d.child=T,Hu(null,T),T=d.child,xe=f.child.memoizedState,xe===null?xe=fg(_):(U=xe.cachePool,U!==null?(Ze=Ki?Ni._currentValue:Ni._currentValue2,U=U.parent!==Ze?{parent:Ze,pool:Ze}:U):U=et(),xe={baseLanes:xe.baseLanes|_,cachePool:U}),T.memoizedState=xe,T.childLanes=hg(f,J,_),d.memoizedState=cc,Hu(f.child,T)):(Me(d),_=f.child,f=_.sibling,_=Zs(_,{mode:"visible",children:T.children}),_.return=d,_.sibling=null,f!==null&&(J=d.deletions,J===null?(d.deletions=[f],d.flags|=16):J.push(f)),d.child=_,d.memoizedState=null,_)}function jd(f,d){return d=Xl({mode:"visible",children:d},f.mode),d.return=f,f.child=d}function Xl(f,d){return f=t(22,f,null,d),f.lanes=0,f}function ju(f,d,_){return Vr(d,f.child,null,_),f=jd(d,d.pendingProps.children),f.flags|=2,d.memoizedState=null,f}function Py(f,d,_){f.lanes|=d;var T=f.alternate;T!==null&&(T.lanes|=d),ee(f.return,d,_)}function Uc(f,d,_,T,U,O){var J=f.memoizedState;J===null?f.memoizedState={isBackwards:d,rendering:null,renderingStartTime:0,last:T,tail:_,tailMode:U,treeForkCount:O}:(J.isBackwards=d,J.rendering=null,J.renderingStartTime=0,J.last=T,J.tail=_,J.tailMode=U,J.treeForkCount=O)}function pg(f,d,_){var T=d.pendingProps,U=T.revealOrder,O=T.tail;T=T.children;var J=Wi.current,xe=(J&2)!==0;if(xe?(J=J&1|2,d.flags|=128):J&=1,b(Wi,J),kr(f,d,T,_),T=Un?Eh:0,!xe&&f!==null&&(f.flags&128)!==0)e:for(f=d.child;f!==null;){if(f.tag===13)f.memoizedState!==null&&Py(f,_,d);else if(f.tag===19)Py(f,_,d);else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===d)break e;for(;f.sibling===null;){if(f.return===null||f.return===d)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}switch(U){case"forwards":for(_=d.child,U=null;_!==null;)f=_.alternate,f!==null&&dt(f)===null&&(U=_),_=_.sibling;_=U,_===null?(U=d.child,d.child=null):(U=_.sibling,_.sibling=null),Uc(d,!1,U,_,O,T);break;case"backwards":case"unstable_legacy-backwards":for(_=null,U=d.child,d.child=null;U!==null;){if(f=U.alternate,f!==null&&dt(f)===null){d.child=U;break}f=U.sibling,U.sibling=_,_=U,U=f}Uc(d,!0,_,null,O,T);break;case"together":Uc(d,!1,null,null,void 0,T);break;default:d.memoizedState=null}return d.child}function Mo(f,d,_){if(f!==null&&(d.dependencies=f.dependencies),yl|=d.lanes,(_&d.childLanes)===0)if(f!==null){if(Ye(f,d,_,!1),(_&d.childLanes)===0)return null}else return null;if(f!==null&&d.child!==f.child)throw Error(r(153));if(d.child!==null){for(f=d.child,_=Zs(f,f.pendingProps),d.child=_,_.return=d;f.sibling!==null;)f=f.sibling,_=_.sibling=Zs(f,f.pendingProps),_.return=d;_.sibling=null}return d.child}function ih(f,d){return(f.lanes&d)!==0?!0:(f=f.dependencies,!!(f!==null&&Re(f)))}function mg(f,d,_){switch(d.tag){case 3:ve(d,d.stateNode.containerInfo),Ie(d,Ni,f.memoizedState.cache),Mt();break;case 27:case 5:de(d);break;case 4:ve(d,d.stateNode.containerInfo);break;case 10:Ie(d,d.type,d.memoizedProps.value);break;case 31:if(d.memoizedState!==null)return d.flags|=128,_e(d),null;break;case 13:var T=d.memoizedState;if(T!==null)return T.dehydrated!==null?(Me(d),d.flags|=128,null):(_&d.child.childLanes)!==0?dg(f,d,_):(Me(d),f=Mo(f,d,_),f!==null?f.sibling:null);Me(d);break;case 19:var U=(f.flags&128)!==0;if(T=(_&d.childLanes)!==0,T||(Ye(f,d,_,!1),T=(_&d.childLanes)!==0),U){if(T)return pg(f,d,_);d.flags|=128}if(U=d.memoizedState,U!==null&&(U.rendering=null,U.tail=null,U.lastEffect=null),b(Wi,Wi.current),T)break;return null;case 22:return d.lanes=0,Uy(f,d,_,d.pendingProps);case 24:Ie(d,Ni,f.memoizedState.cache)}return Mo(f,d,_)}function gg(f,d,_){if(f!==null)if(f.memoizedProps!==d.pendingProps)bi=!0;else{if(!ih(f,_)&&(d.flags&128)===0)return bi=!1,mg(f,d,_);bi=(f.flags&131072)!==0}else bi=!1,Un&&(d.flags&1048576)!==0&&k(d,Eh,d.index);switch(d.lanes=0,d.tag){case 16:e:{var T=d.pendingProps;if(f=Ot(d.elementType),d.type=f,typeof f=="function")Yu(f)?(T=Gu(f,T),d.tag=1,d=Wu(null,d,f,T,_)):(d.tag=0,d=Wd(null,d,f,T,_));else{if(f!=null){var U=f.$$typeof;if(U===jc){d.tag=11,d=Ry(null,d,f,T,_);break e}else if(U===lp){d.tag=14,d=Dy(null,d,f,T,_);break e}}throw d=g(f)||f,Error(r(306,d,""))}}return d;case 0:return Wd(f,d,d.type,d.pendingProps,_);case 1:return T=d.type,U=Gu(T,d.pendingProps),Wu(f,d,T,U,_);case 3:e:{if(ve(d,d.stateNode.containerInfo),f===null)throw Error(r(387));var O=d.pendingProps;U=d.memoizedState,T=U.element,ie(f,d),vt(d,O,null,_);var J=d.memoizedState;if(O=J.cache,Ie(d,Ni,O),O!==U.cache&<(d,[Ni],_,!0),_t(),O=J.element,Ri&&U.isDehydrated)if(U={element:O,isDehydrated:!1,cache:J.cache},d.updateQueue.baseState=U,d.memoizedState=U,d.flags&256){d=Iy(f,d,O,_);break e}else if(O!==T){T=le(Error(r(424)),d),ze(T),d=Iy(f,d,O,_);break e}else for(Ri&&(Di=mx(d.stateNode.containerInfo),br=d,Un=!0,ko=null,ms=!0),_=h0(d,null,O,_),d.child=_;_;)_.flags=_.flags&-3|4096,_=_.sibling;else{if(Mt(),O===T){d=Mo(f,d,_);break e}kr(f,d,O,_)}d=d.child}return d;case 26:if(Ta)return nh(f,d),f===null?(_=t0(d.type,null,d.pendingProps,null))?d.memoizedState=_:Un||(d.stateNode=xp(d.type,d.pendingProps,Br.current,d)):d.memoizedState=t0(d.type,f.memoizedProps,d.pendingProps,f.memoizedState),null;case 27:if(_r)return de(d),f===null&&_r&&Un&&(T=d.stateNode=_p(d.type,d.pendingProps,Br.current,Nr.current,!1),br=d,ms=!0,Di=Zg(d.type,T,Di)),kr(f,d,d.pendingProps.children,_),nh(f,d),f===null&&(d.flags|=4194304),d.child;case 5:return f===null&&Un&&(Rx(d.type,d.pendingProps,Nr.current),(U=T=Di)&&(T=yx(T,d.type,d.pendingProps,ms),T!==null?(d.stateNode=T,br=d,Di=px(T),ms=!1,U=!0):U=!1),U||Ge(d)),de(d),U=d.type,O=d.pendingProps,J=f!==null?f.memoizedProps:null,T=O.children,ps(U,O)?T=null:J!==null&&ps(U,J)&&(d.flags|=32),d.memoizedState!==null&&(U=It(f,d,Xt,null,null,_),Ki?nc._currentValue=U:nc._currentValue2=U),nh(f,d),kr(f,d,T,_),d.child;case 6:return f===null&&Un&&(e0(d.pendingProps,Nr.current),(f=_=Di)&&(_=xx(_,d.pendingProps,ms),_!==null?(d.stateNode=_,br=d,Di=null,f=!0):f=!1),f||Ge(d)),null;case 13:return dg(f,d,_);case 4:return ve(d,d.stateNode.containerInfo),T=d.pendingProps,f===null?d.child=Vr(d,null,T,_):kr(f,d,T,_),d.child;case 11:return Ry(f,d,d.type,d.pendingProps,_);case 7:return kr(f,d,d.pendingProps,_),d.child;case 8:return kr(f,d,d.pendingProps.children,_),d.child;case 12:return kr(f,d,d.pendingProps.children,_),d.child;case 10:return T=d.pendingProps,Ie(d,d.type,T.value),kr(f,d,T.children,_),d.child;case 9:return U=d.type._context,T=d.pendingProps.children,We(d),U=Q(U),T=T(U),d.flags|=1,kr(f,d,T,_),d.child;case 14:return Dy(f,d,d.type,d.pendingProps,_);case 15:return Ny(f,d,d.type,d.pendingProps,_);case 19:return pg(f,d,_);case 31:return Ly(f,d,_);case 22:return Uy(f,d,_,d.pendingProps);case 24:return We(d),T=Q(Ni),f===null?(U=it(),U===null&&(U=Mn,O=Ue(),U.pooledCache=O,O.refCount++,O!==null&&(U.pooledCacheLanes|=_),U=O),d.memoizedState={parent:T,cache:U},Y(d),Ie(d,Ni,U)):((f.lanes&_)!==0&&(ie(f,d),vt(d,null,null,_),_t()),U=f.memoizedState,O=d.memoizedState,U.parent!==T?(U={parent:T,cache:T},d.memoizedState=U,d.lanes===0&&(d.memoizedState=d.updateQueue.baseState=U),Ie(d,Ni,T)):(T=O.cache,Ie(d,Ni,T),T!==U.cache&<(d,[Ni],_,!0))),kr(f,d,d.pendingProps.children,_),d.child;case 29:throw d.pendingProps}throw Error(r(156,d.tag))}function va(f){f.flags|=4}function rh(f){Ks&&(f.flags|=8)}function Oy(f,d){if(f!==null&&f.child===d.child)return!1;if((d.flags&16)!==0)return!0;for(f=d.child;f!==null;){if((f.flags&8218)!==0||(f.subtreeFlags&8218)!==0)return!0;f=f.sibling}return!1}function vg(f,d,_,T){if(Fn)for(_=d.child;_!==null;){if(_.tag===5||_.tag===6)yh(f,_.stateNode);else if(!(_.tag===4||_r&&_.tag===27)&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===d)break;for(;_.sibling===null;){if(_.return===null||_.return===d)return;_=_.return}_.sibling.return=_.return,_=_.sibling}else if(Ks)for(var U=d.child;U!==null;){if(U.tag===5){var O=U.stateNode;_&&T&&(O=cx(O,U.type,U.memoizedProps)),yh(f,O)}else if(U.tag===6)O=U.stateNode,_&&T&&(O=Yg(O,U.memoizedProps)),yh(f,O);else if(U.tag!==4){if(U.tag===22&&U.memoizedState!==null)O=U.child,O!==null&&(O.return=U),vg(f,U,!0,!0);else if(U.child!==null){U.child.return=U,U=U.child;continue}}if(U===d)break;for(;U.sibling===null;){if(U.return===null||U.return===d)return;U=U.return}U.sibling.return=U.return,U=U.sibling}}function Fy(f,d,_,T){var U=!1;if(Ks)for(var O=d.child;O!==null;){if(O.tag===5){var J=O.stateNode;_&&T&&(J=cx(J,O.type,O.memoizedProps)),jg(f,J)}else if(O.tag===6)J=O.stateNode,_&&T&&(J=Yg(J,O.memoizedProps)),jg(f,J);else if(O.tag!==4){if(O.tag===22&&O.memoizedState!==null)U=O.child,U!==null&&(U.return=O),Fy(f,O,!0,!0),U=!0;else if(O.child!==null){O.child.return=O,O=O.child;continue}}if(O===d)break;for(;O.sibling===null;){if(O.return===null||O.return===d)return U;O=O.return}O.sibling.return=O.return,O=O.sibling}return U}function ky(f,d){if(Ks&&Oy(f,d)){f=d.stateNode;var _=f.containerInfo,T=Wg();Fy(T,d,!1,!1),f.pendingChildren=T,va(d),ux(_,T)}}function yg(f,d,_,T){if(Fn)f.memoizedProps!==T&&va(d);else if(Ks){var U=f.stateNode,O=f.memoizedProps;if((f=Oy(f,d))||O!==T){var J=Nr.current;O=lx(U,_,O,T,!f,null),O===U?d.stateNode=U:(rh(d),As(O,_,T,J)&&va(d),d.stateNode=O,f&&vg(O,d,!1,!1))}else d.stateNode=U}}function fs(f,d,_,T,U){if((f.mode&32)!==0&&(_===null?xh(d,T):Kc(d,_,T))){if(f.flags|=16777216,(U&335544128)===U||Lg(d,T))if(Pi(f.stateNode,d,T))f.flags|=8192;else if(On())f.flags|=8192;else throw gs=zo,Np}else f.flags&=-16777217}function Lc(f,d){if(s0(d)){if(f.flags|=16777216,!a0(d))if(On())f.flags|=8192;else throw gs=zo,Np}else f.flags&=-16777217}function sh(f,d){d!==null&&(f.flags|=4),f.flags&16384&&(d=f.tag!==22?R():536870912,f.lanes|=d,af|=d)}function Ic(f,d){if(!Un)switch(f.tailMode){case"hidden":d=f.tail;for(var _=null;d!==null;)d.alternate!==null&&(_=d),d=d.sibling;_===null?f.tail=null:_.sibling=null;break;case"collapsed":_=f.tail;for(var T=null;_!==null;)_.alternate!==null&&(T=_),_=_.sibling;T===null?d||f.tail===null?f.tail=null:f.tail.sibling=null:T.sibling=null}}function mi(f){var d=f.alternate!==null&&f.alternate.child===f.child,_=0,T=0;if(d)for(var U=f.child;U!==null;)_|=U.lanes|U.childLanes,T|=U.subtreeFlags&65011712,T|=U.flags&65011712,U.return=f,U=U.sibling;else for(U=f.child;U!==null;)_|=U.lanes|U.childLanes,T|=U.subtreeFlags,T|=U.flags,U.return=f,U=U.sibling;return f.subtreeFlags|=T,f.childLanes=_,d}function zy(f,d,_){var T=d.pendingProps;switch(oe(d),d.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return mi(d),null;case 1:return mi(d),null;case 3:return _=d.stateNode,T=null,f!==null&&(T=f.memoizedState.cache),d.memoizedState.cache!==T&&(d.flags|=2048),tt(Ni),se(),_.pendingContext&&(_.context=_.pendingContext,_.pendingContext=null),(f===null||f.child===null)&&(Je(d)?va(d):f===null||f.memoizedState.isDehydrated&&(d.flags&256)===0||(d.flags|=1024,Le())),ky(f,d),mi(d),null;case 26:if(Ta){var U=d.type,O=d.memoizedState;return f===null?(va(d),O!==null?(mi(d),Lc(d,O)):(mi(d),fs(d,U,null,T,_))):O?O!==f.memoizedState?(va(d),mi(d),Lc(d,O)):(mi(d),d.flags&=-16777217):(O=f.memoizedProps,Fn?O!==T&&va(d):yg(f,d,U,T),mi(d),fs(d,U,O,T,_)),null}case 27:if(_r){if(be(d),_=Br.current,U=d.type,f!==null&&d.stateNode!=null)Fn?f.memoizedProps!==T&&va(d):yg(f,d,U,T);else{if(!T){if(d.stateNode===null)throw Error(r(166));return mi(d),null}f=Nr.current,Je(d)?ot(d,f):(f=_p(U,T,_,f,!0),d.stateNode=f,va(d))}return mi(d),null}case 5:if(be(d),U=d.type,f!==null&&d.stateNode!=null)yg(f,d,U,T);else{if(!T){if(d.stateNode===null)throw Error(r(166));return mi(d),null}if(O=Nr.current,Je(d))ot(d,O),Ex(d.stateNode,U,T,O)&&(d.flags|=64);else{var J=Ng(U,T,Br.current,O,d);rh(d),vg(J,d,!1,!1),d.stateNode=J,As(J,U,T,O)&&va(d)}}return mi(d),fs(d,d.type,f===null?null:f.memoizedProps,d.pendingProps,_),null;case 6:if(f&&d.stateNode!=null)_=f.memoizedProps,Fn?_!==T&&va(d):Ks&&(_!==T?(f=Br.current,_=Nr.current,rh(d),d.stateNode=hl(T,f,_,d)):d.stateNode=f.stateNode);else{if(typeof T!="string"&&d.stateNode===null)throw Error(r(166));if(f=Br.current,_=Nr.current,Je(d)){if(!Ri)throw Error(r(176));if(f=d.stateNode,_=d.memoizedProps,T=null,U=br,U!==null)switch(U.tag){case 27:case 5:T=U.memoizedProps}GS(f,_,d,T)||Ge(d,!0)}else rh(d),d.stateNode=hl(T,f,_,d)}return mi(d),null;case 31:if(_=d.memoizedState,f===null||f.memoizedState!==null){if(T=Je(d),_!==null){if(f===null){if(!T)throw Error(r(318));if(!Ri)throw Error(r(556));if(f=d.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(r(557));Qg(f,d)}else Mt(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;mi(d),f=!1}else _=Le(),f!==null&&f.memoizedState!==null&&(f.memoizedState.hydrationErrors=_),f=!0;if(!f)return d.flags&256?(ht(d),d):(ht(d),null);if((d.flags&128)!==0)throw Error(r(558))}return mi(d),null;case 13:if(T=d.memoizedState,f===null||f.memoizedState!==null&&f.memoizedState.dehydrated!==null){if(U=Je(d),T!==null&&T.dehydrated!==null){if(f===null){if(!U)throw Error(r(318));if(!Ri)throw Error(r(344));if(U=d.memoizedState,U=U!==null?U.dehydrated:null,!U)throw Error(r(317));Sx(U,d)}else Mt(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;mi(d),U=!1}else U=Le(),f!==null&&f.memoizedState!==null&&(f.memoizedState.hydrationErrors=U),U=!0;if(!U)return d.flags&256?(ht(d),d):(ht(d),null)}return ht(d),(d.flags&128)!==0?(d.lanes=_,d):(_=T!==null,f=f!==null&&f.memoizedState!==null,_&&(T=d.child,U=null,T.alternate!==null&&T.alternate.memoizedState!==null&&T.alternate.memoizedState.cachePool!==null&&(U=T.alternate.memoizedState.cachePool.pool),O=null,T.memoizedState!==null&&T.memoizedState.cachePool!==null&&(O=T.memoizedState.cachePool.pool),O!==U&&(T.flags|=2048)),_!==f&&_&&(d.child.flags|=8192),sh(d,d.updateQueue),mi(d),null);case 4:return se(),ky(f,d),f===null&&li(d.stateNode.containerInfo),mi(d),null;case 10:return tt(d.type),mi(d),null;case 19:if(x(Wi),T=d.memoizedState,T===null)return mi(d),null;if(U=(d.flags&128)!==0,O=T.rendering,O===null)if(U)Ic(T,!1);else{if(ki!==0||f!==null&&(f.flags&128)!==0)for(f=d.child;f!==null;){if(O=dt(f),O!==null){for(d.flags|=128,Ic(T,!1),f=O.updateQueue,d.updateQueue=f,sh(d,f),d.subtreeFlags=0,f=_,_=d.child;_!==null;)ip(_,f),_=_.sibling;return b(Wi,Wi.current&1|2),Un&&ue(d,T.treeForkCount),d.child}f=f.sibling}T.tail!==null&&Qr()>gu&&(d.flags|=128,U=!0,Ic(T,!1),d.lanes=4194304)}else{if(!U)if(f=dt(O),f!==null){if(d.flags|=128,U=!0,f=f.updateQueue,d.updateQueue=f,sh(d,f),Ic(T,!0),T.tail===null&&T.tailMode==="hidden"&&!O.alternate&&!Un)return mi(d),null}else 2*Qr()-T.renderingStartTime>gu&&_!==536870912&&(d.flags|=128,U=!0,Ic(T,!1),d.lanes=4194304);T.isBackwards?(O.sibling=d.child,d.child=O):(f=T.last,f!==null?f.sibling=O:d.child=O,T.last=O)}return T.tail!==null?(f=T.tail,T.rendering=f,T.tail=f.sibling,T.renderingStartTime=Qr(),f.sibling=null,_=Wi.current,b(Wi,U?_&1|2:_&1),Un&&ue(d,T.treeForkCount),f):(mi(d),null);case 22:case 23:return ht(d),pe(),T=d.memoizedState!==null,f!==null?f.memoizedState!==null!==T&&(d.flags|=8192):T&&(d.flags|=8192),T?(_&536870912)!==0&&(d.flags&128)===0&&(mi(d),d.subtreeFlags&6&&(d.flags|=8192)):mi(d),_=d.updateQueue,_!==null&&sh(d,_.retryQueue),_=null,f!==null&&f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(_=f.memoizedState.cachePool.pool),T=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(T=d.memoizedState.cachePool.pool),T!==_&&(d.flags|=2048),f!==null&&x(lu),null;case 24:return _=null,f!==null&&(_=f.memoizedState.cache),d.memoizedState.cache!==_&&(d.flags|=2048),tt(Ni),mi(d),null;case 25:return null;case 30:return null}throw Error(r(156,d.tag))}function xg(f,d){switch(oe(d),d.tag){case 1:return f=d.flags,f&65536?(d.flags=f&-65537|128,d):null;case 3:return tt(Ni),se(),f=d.flags,(f&65536)!==0&&(f&128)===0?(d.flags=f&-65537|128,d):null;case 26:case 27:case 5:return be(d),null;case 31:if(d.memoizedState!==null){if(ht(d),d.alternate===null)throw Error(r(340));Mt()}return f=d.flags,f&65536?(d.flags=f&-65537|128,d):null;case 13:if(ht(d),f=d.memoizedState,f!==null&&f.dehydrated!==null){if(d.alternate===null)throw Error(r(340));Mt()}return f=d.flags,f&65536?(d.flags=f&-65537|128,d):null;case 19:return x(Wi),null;case 4:return se(),null;case 10:return tt(d.type),null;case 22:case 23:return ht(d),pe(),f!==null&&x(lu),f=d.flags,f&65536?(d.flags=f&-65537|128,d):null;case 24:return tt(Ni),null;case 25:return null;default:return null}}function By(f,d){switch(oe(d),d.tag){case 3:tt(Ni),se();break;case 26:case 27:case 5:be(d);break;case 4:se();break;case 31:d.memoizedState!==null&&ht(d);break;case 13:ht(d);break;case 19:x(Wi);break;case 10:tt(d.type);break;case 22:case 23:ht(d),pe(),f!==null&&x(lu);break;case 24:tt(Ni)}}function wo(f,d){try{var _=d.updateQueue,T=_!==null?_.lastEffect:null;if(T!==null){var U=T.next;_=U;do{if((_.tag&f)===f){T=void 0;var O=_.create,J=_.inst;T=O(),J.destroy=T}_=_.next}while(_!==U)}}catch(xe){ln(d,d.return,xe)}}function To(f,d,_){try{var T=d.updateQueue,U=T!==null?T.lastEffect:null;if(U!==null){var O=U.next;T=O;do{if((T.tag&f)===f){var J=T.inst,xe=J.destroy;if(xe!==void 0){J.destroy=void 0,U=d;var Ze=_,xt=xe;try{xt()}catch(Ut){ln(U,Ze,Ut)}}}T=T.next}while(T!==O)}}catch(Ut){ln(d,d.return,Ut)}}function Pc(f){var d=f.updateQueue;if(d!==null){var _=f.stateNode;try{Tt(d,_)}catch(T){ln(f,f.return,T)}}}function Xd(f,d,_){_.props=Gu(f.type,f.memoizedProps),_.state=f.memoizedState;try{_.componentWillUnmount()}catch(T){ln(f,d,T)}}function Oc(f,d){try{var _=f.ref;if(_!==null){switch(f.tag){case 26:case 27:case 5:var T=Yc(f.stateNode);break;case 30:T=f.stateNode;break;default:T=f.stateNode}typeof _=="function"?f.refCleanup=_(T):_.current=T}}catch(U){ln(f,d,U)}}function Kr(f,d){var _=f.ref,T=f.refCleanup;if(_!==null)if(typeof T=="function")try{T()}catch(U){ln(f,d,U)}finally{f.refCleanup=null,f=f.alternate,f!=null&&(f.refCleanup=null)}else if(typeof _=="function")try{_(null)}catch(U){ln(f,d,U)}else _.current=null}function Xu(f){var d=f.type,_=f.memoizedProps,T=f.stateNode;try{ex(T,d,_,f)}catch(U){ln(f,f.return,U)}}function ah(f,d,_){try{tx(f.stateNode,f.type,_,d,f)}catch(T){ln(f,f.return,T)}}function _g(f){return f.tag===5||f.tag===3||(Ta?f.tag===26:!1)||(_r?f.tag===27&&ic(f.type):!1)||f.tag===4}function rl(f){e:for(;;){for(;f.sibling===null;){if(f.return===null||_g(f.return))return null;f=f.return}for(f.sibling.return=f.return,f=f.sibling;f.tag!==5&&f.tag!==6&&f.tag!==18;){if(_r&&f.tag===27&&ic(f.type)||f.flags&2||f.child===null||f.tag===4)continue e;f.child.return=f,f=f.child}if(!(f.flags&2))return f.stateNode}}function Yd(f,d,_){var T=f.tag;if(T===5||T===6)f=f.stateNode,d?ix(_,f,d):Bg(_,f);else if(T!==4&&(_r&&T===27&&ic(f.type)&&(_=f.stateNode,d=null),f=f.child,f!==null))for(Yd(f,d,_),f=f.sibling;f!==null;)Yd(f,d,_),f=f.sibling}function oh(f,d,_){var T=f.tag;if(T===5||T===6)f=f.stateNode,d?nx(_,f,d):zg(_,f);else if(T!==4&&(_r&&T===27&&ic(f.type)&&(_=f.stateNode),f=f.child,f!==null))for(oh(f,d,_),f=f.sibling;f!==null;)oh(f,d,_),f=f.sibling}function bg(f,d,_){f=f.containerInfo;try{Xg(f,_)}catch(T){ln(d,d.return,T)}}function Vy(f){var d=f.stateNode,_=f.memoizedProps;try{cr(f.type,_,d,f)}catch(T){ln(f,f.return,T)}}function kS(f,d){for(up(f.containerInfo),$i=d;$i!==null;)if(f=$i,d=f.child,(f.subtreeFlags&1028)!==0&&d!==null)d.return=f,$i=d;else for(;$i!==null;){f=$i;var _=f.alternate;switch(d=f.flags,f.tag){case 0:if((d&4)!==0&&(d=f.updateQueue,d=d!==null?d.events:null,d!==null))for(var T=0;T";case nf:return":has("+(zc(f)||"")+")";case rf:return'[role="'+f.value+'"]';case hu:return'"'+f.value+'"';case Dh:return'[data-testname="'+f.value+'"]';default:throw Error(r(365))}}function Bc(f,d){var _=[];f=[f,0];for(var T=0;T_?32:_;_=nn.T;var U=wa();try{Nn(T),nn.T=null,T=Ip,Ip=null;var O=_l,J=Ho;if(hr=0,dc=_l=null,Ho=0,(Cn&6)!==0)throw Error(r(331));var xe=Cn;if(Cn|=4,Qd(O.current),Zd(O,O.current,J,T),Cn=xe,st(0,!1),Ds&&typeof Ds.onPostCommitFiberRoot=="function")try{Ds.onPostCommitFiberRoot(ac,O)}catch{}return!0}finally{Nn(U),nn.T=_,np(f,d)}}function eu(f,d,_){d=le(_,d),d=lg(f.stateNode,d,2),f=Oe(f,d,2),f!==null&&(P(f,2),rt(f))}function ln(f,d,_){if(f.tag===3)eu(f,f,_);else for(;d!==null;){if(d.tag===3){eu(d,f,_);break}else if(d.tag===1){var T=d.stateNode;if(typeof d.type.getDerivedStateFromError=="function"||typeof T.componentDidCatch=="function"&&(xl===null||!xl.has(T))){f=le(_,f),_=Ay(2),T=Oe(d,_,2),T!==null&&(Cy(_,T,d,f),P(T,2),rt(T));break}}d=d.return}}function Wc(f,d,_){var T=f.pingCache;if(T===null){T=f.pingCache=new ta;var U=new Set;T.set(d,U)}else U=T.get(d),U===void 0&&(U=new Set,T.set(d,U));U.has(_)||(pu=!0,U.add(_),f=Xy.bind(null,f,d,_),d.then(f,f))}function Xy(f,d,_){var T=f.pingCache;T!==null&&T.delete(d),f.pingedLanes|=f.suspendedLanes&_,f.warmLanes&=~_,Mn===f&&(Ln&_)===_&&(ki===4||ki===3&&(Ln&62914560)===Ln&&300>Qr()-Uh?(Cn&2)===0&&Hi(f,0):sf|=_,af===Ln&&(af=0)),rt(f)}function Yy(f,d){d===0&&(d=R()),f=Jt(f,d),f!==null&&(P(f,d),rt(f))}function zS(f){var d=f.memoizedState,_=0;d!==null&&(_=d.retryLane),Yy(f,_)}function BS(f,d){var _=0;switch(f.tag){case 31:case 13:var T=f.stateNode,U=f.memoizedState;U!==null&&(_=U.retryLane);break;case 19:T=f.stateNode;break;case 22:T=f.stateNode._retryCache;break;default:throw Error(r(314))}T!==null&&T.delete(d),Yy(f,_)}function ur(f,d){return Mh(f,d)}function wg(f,d,_,T){this.tag=f,this.key=_,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=T,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Yu(f){return f=f.prototype,!(!f||!f.isReactComponent)}function Zs(f,d){var _=f.alternate;return _===null?(_=t(f.tag,d,f.key,f.mode),_.elementType=f.elementType,_.type=f.type,_.stateNode=f.stateNode,_.alternate=f,f.alternate=_):(_.pendingProps=d,_.type=f.type,_.flags=0,_.subtreeFlags=0,_.deletions=null),_.flags=f.flags&65011712,_.childLanes=f.childLanes,_.lanes=f.lanes,_.child=f.child,_.memoizedProps=f.memoizedProps,_.memoizedState=f.memoizedState,_.updateQueue=f.updateQueue,d=f.dependencies,_.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},_.sibling=f.sibling,_.index=f.index,_.ref=f.ref,_.refCleanup=f.refCleanup,_}function ip(f,d){f.flags&=65011714;var _=f.alternate;return _===null?(f.childLanes=0,f.lanes=d,f.child=null,f.subtreeFlags=0,f.memoizedProps=null,f.memoizedState=null,f.updateQueue=null,f.dependencies=null,f.stateNode=null):(f.childLanes=_.childLanes,f.lanes=_.lanes,f.child=_.child,f.subtreeFlags=0,f.deletions=null,f.memoizedProps=_.memoizedProps,f.memoizedState=_.memoizedState,f.updateQueue=_.updateQueue,f.type=_.type,d=_.dependencies,f.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext}),f}function ul(f,d,_,T,U,O){var J=0;if(T=f,typeof f=="function")Yu(f)&&(J=1);else if(typeof f=="string")J=Ta&&_r?yp(f,_,Nr.current)?26:o0(f)?27:5:Ta?yp(f,_,Nr.current)?26:5:_r&&o0(f)?27:5;else e:switch(f){case gh:return f=t(31,_,d,U),f.elementType=gh,f.lanes=O,f;case Qu:return Sa(_.children,U,O,d);case Ju:J=8,U|=24;break;case $u:return f=t(12,_,d,U|2),f.elementType=$u,f.lanes=O,f;case op:return f=t(13,_,d,U),f.elementType=op,f.lanes=O,f;case cl:return f=t(19,_,d,U),f.elementType=cl,f.lanes=O,f;default:if(typeof f=="object"&&f!==null)switch(f.$$typeof){case Ma:J=10;break e;case mh:J=9;break e;case jc:J=11;break e;case lp:J=14;break e;case ds:J=16,T=null;break e}J=29,_=Error(r(130,f===null?"null":typeof f,"")),T=null}return d=t(J,_,d,U),d.elementType=f,d.type=T,d.lanes=O,d}function Sa(f,d,_,T){return f=t(7,f,T,d),f.lanes=_,f}function Tg(f,d,_){return f=t(6,f,null,d),f.lanes=_,f}function Eg(f){var d=t(18,null,null,0);return d.stateNode=f,d}function Ag(f,d,_){return d=t(4,f.children!==null?f.children:[],f.key,d),d.lanes=_,d.stateNode={containerInfo:f.containerInfo,pendingChildren:null,implementation:f.implementation},d}function qy(f,d,_,T,U,O,J,xe,Ze){this.tag=1,this.containerInfo=f,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Cs,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=I(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=I(0),this.hiddenUpdates=I(null),this.identifierPrefix=T,this.onUncaughtError=U,this.onCaughtError=O,this.onRecoverableError=J,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Ze,this.incompleteTransitions=new Map}function tu(f,d,_,T,U,O,J,xe,Ze,xt,Ut,bt){return f=new qy(f,d,_,J,Ze,xt,Ut,bt,xe),d=1,O===!0&&(d|=24),O=t(3,null,null,d),f.current=O,O.stateNode=f,d=Ue(),d.refCount++,f.pooledCache=d,d.refCount++,O.memoizedState={element:T,isDehydrated:_,cache:d},Y(O),f}function rp(f){return f?(f=Po,f):Po}function dh(f){var d=f._reactInternals;if(d===void 0)throw typeof f.render=="function"?Error(r(188)):(f=Object.keys(f).join(","),Error(r(268,f)));return f=l(d),f=f!==null?c(f):null,f===null?null:Yc(f.stateNode)}function Cg(f,d,_,T,U,O){U=rp(U),T.context===null?T.context=U:T.pendingContext=U,T=me(d),T.payload={element:_},O=O===void 0?null:O,O!==null&&(T.callback=O),_=Oe(f,T,d),_!==null&&(Ii(_,f,d),je(_,f,d))}function qu(f,d){if(f=f.memoizedState,f!==null&&f.dehydrated!==null){var _=f.retryLane;f.retryLane=_!==0&&_=xt&&O>=bt&&U<=Ut&&J<=Ht){f.splice(d,1);break}else if(T!==xt||_.width!==Ze.width||HtJ){if(!(O!==bt||_.height!==Ze.height||UtU)){xt>T&&(Ze.width+=xt-T,Ze.x=T),UtO&&(Ze.height+=bt-O,Ze.y=O),Ht_&&(_=xe)),xe ")+` No matching component was found for: `)+f.join(" > ")}return null},bn.getPublicRootInstance=function(f){if(f=f.current,!f.child)return null;switch(f.child.tag){case 27:case 5:return Yc(f.child.stateNode);default:return f.child.stateNode}},bn.injectIntoDevTools=function(){var f={bundleType:0,version:Dg,rendererPackageName:vh,currentDispatcherRef:nn,reconcilerVersion:"19.2.0"};if(Xc!==null&&(f.rendererConfig=Xc),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")f=!1;else{var d=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(d.isDisabled||!d.supportsFiber)f=!0;else{try{ac=d.inject(f),Ds=d}catch{}f=!!d.checkDCE}}return f},bn.isAlreadyRendering=function(){return(Cn&6)!==0},bn.observeVisibleRects=function(f,d,_,T){if(!xr)throw Error(r(363));f=Ts(f,d);var U=dp(f,_,T).disconnect;return{disconnect:function(){U()}}},bn.shouldError=function(){return null},bn.shouldSuspend=function(){return!1},bn.startHostTransition=function(f,d,_,T){if(f.tag!==5)throw Error(r(476));var U=Vu(f).queue;Bu(f,U,d,tc,_===null?n:function(){var O=Vu(f);return O.next===null&&(O=f.alternate.memoizedState),jl(f,O.next.queue,{},Ci()),_(T)})},bn.updateContainer=function(f,d,_,T){var U=d.current,O=Ci();return Cg(U,O,f,d,_,T),O},bn.updateContainerSync=function(f,d,_,T){return Cg(d.current,2,f,d,_,T),2},bn},i.exports.default=i.exports,Object.defineProperty(i.exports,"__esModule",{value:!0})})(nU)),nU.exports}var rU;function Gq(){return rU||(rU=1,tU.exports=Vq()),tU.exports}var Hq=Gq();const Wq=Bq(Hq);function jq(i){const e=Wq(i);return e.injectIntoDevTools(),e}const I4=0,jm={},Xq=/^three(?=[A-Z])/,LS=i=>`${i[0].toUpperCase()}${i.slice(1)}`;let Yq=0;const qq=i=>typeof i=="function";function fC(i){if(qq(i)){const e=`${Yq++}`;return jm[e]=i,e}else Object.assign(jm,i)}function P4(i,e){const t=LS(i),n=jm[t];if(i!=="primitive"&&!n)throw new Error(`R3F: ${t} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(i==="primitive"&&!e.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(e.args!==void 0&&!Array.isArray(e.args))throw new Error("R3F: The args prop must be an array!")}function Zq(i,e,t){var n;return i=LS(i)in jm?i:i.replace(Xq,""),P4(i,e),i==="primitive"&&(n=e.object)!=null&&n.__r3f&&delete e.object.__r3f,Ib(e.object,t,i,e)}function Kq(i){if(!i.isHidden){var e;i.props.attach&&(e=i.parent)!=null&&e.object?Ob(i.parent,i):ra(i.object)&&(i.object.visible=!1),i.isHidden=!0,ig(i)}}function O4(i){if(i.isHidden){var e;i.props.attach&&(e=i.parent)!=null&&e.object?Pb(i.parent,i):ra(i.object)&&i.props.visible!==!1&&(i.object.visible=!0),i.isHidden=!1,ig(i)}}function hC(i,e,t){const n=e.root.getState();if(!(!i.parent&&i.object!==n.scene)){if(!e.object){var r,s;const a=jm[LS(e.type)];e.object=(r=e.props.object)!=null?r:new a(...(s=e.props.args)!=null?s:[]),e.object.__r3f=e}if(Eu(e.object,e.props),e.props.attach)Pb(i,e);else if(ra(e.object)&&ra(i.object)){const a=i.object.children.indexOf(t==null?void 0:t.object);if(t&&a!==-1){const l=i.object.children.indexOf(e.object);if(l!==-1){i.object.children.splice(l,1);const c=l{try{i.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():rE.unstable_scheduleCallback(rE.unstable_IdlePriority,e)}}function aE(i,e,t){if(!e)return;e.parent=null;const n=i.children.indexOf(e);n!==-1&&i.children.splice(n,1),e.props.attach?Ob(i,e):ra(e.object)&&ra(i.object)&&(i.object.remove(e.object),Nq(A4(e),e.object));const r=e.props.dispose!==null&&t!==!1;for(let s=e.children.length-1;s>=0;s--){const a=e.children[s];aE(e,a,r)}e.children.length=0,delete e.object.__r3f,r&&e.type!=="primitive"&&e.object.type!=="Scene"&&F4(e.object),t===void 0&&ig(e)}function Qq(i,e){for(const t of[i,i.alternate])if(t!==null)if(typeof t.ref=="function"){t.refCleanup==null||t.refCleanup();const n=t.ref(e);typeof n=="function"&&(t.refCleanup=n)}else t.ref&&(t.ref.current=e)}const _1=[];function Jq(){for(const[t]of _1){const n=t.parent;if(n){t.props.attach?Ob(n,t):ra(t.object)&&ra(n.object)&&n.object.remove(t.object);for(const r of t.children)r.props.attach?Ob(t,r):ra(r.object)&&ra(t.object)&&t.object.remove(r.object)}t.isHidden&&O4(t),t.object.__r3f&&delete t.object.__r3f,t.type!=="primitive"&&F4(t.object)}for(const[t,n,r]of _1){t.props=n;const s=t.parent;if(s){var i,e;const a=jm[LS(t.type)];t.object=(i=t.props.object)!=null?i:new a(...(e=t.props.args)!=null?e:[]),t.object.__r3f=t,Qq(r,t.object),Eu(t.object,t.props),t.props.attach?Pb(s,t):ra(t.object)&&ra(s.object)&&s.object.add(t.object);for(const l of t.children)l.props.attach?Pb(t,l):ra(l.object)&&ra(t.object)&&t.object.add(l.object);ig(t)}}_1.length=0}const Vw=()=>{},aU={};let t1=I4;const $q=0,eZ=4,Fb=jq({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:Zq,removeChild:aE,appendChild:Bw,appendInitialChild:Bw,insertBefore:sU,appendChildToContainer(i,e){const t=i.getState().scene.__r3f;!e||!t||Bw(t,e)},removeChildFromContainer(i,e){const t=i.getState().scene.__r3f;!e||!t||aE(t,e)},insertInContainerBefore(i,e,t){const n=i.getState().scene.__r3f;!e||!t||!n||sU(n,e,t)},getRootHostContext:()=>aU,getChildHostContext:()=>aU,commitUpdate(i,e,t,n,r){var s,a,l;P4(e,n);let c=!1;if((i.type==="primitive"&&t.object!==n.object||((s=n.args)==null?void 0:s.length)!==((a=t.args)==null?void 0:a.length)||(l=n.args)!=null&&l.some((p,g)=>{var v;return p!==((v=t.args)==null?void 0:v[g])}))&&(c=!0),c)_1.push([i,{...n},r]);else{const p=Cq(i,n);Object.keys(p).length&&(Object.assign(i.props,p),Eu(i.object,p))}(r.sibling===null||(r.flags&eZ)===$q)&&Jq()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:i=>i==null?void 0:i.object,prepareForCommit:()=>null,preparePortalMount:i=>Ib(i.getState().scene,i,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:Kq,unhideInstance:O4,createTextInstance:Vw,hideTextInstance:Vw,unhideTextInstance:Vw,scheduleTimeout:typeof setTimeout=="function"?setTimeout:void 0,cancelTimeout:typeof clearTimeout=="function"?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:ae.createContext(null),setCurrentUpdatePriority(i){t1=i},getCurrentUpdatePriority(){return t1},resolveUpdatePriority(){var i;if(t1!==I4)return t1;switch(typeof window<"u"&&((i=window.event)==null?void 0:i.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return kq;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Oq;default:return Fq}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:zq.version,applyViewTransitionName(i,e,t){},restoreViewTransitionName(i,e){},cancelViewTransitionName(i,e,t){},cancelRootViewTransitionName(i){},restoreRootViewTransitionName(i){},InstanceMeasurement:null,measureInstance:i=>null,wasInstanceInViewport:i=>!0,hasInstanceChanged:(i,e)=>!1,hasInstanceAffectedParent:(i,e)=>!1,suspendOnActiveViewTransition(i,e){},startGestureTransition:()=>null,startViewTransition:()=>null,stopViewTransition(i){},createViewTransitionInstance:i=>null,getCurrentGestureOffset(i){throw new Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance(i,e){return i},cloneMutableTextInstance(i){return i},cloneRootViewTransitionContainer(i){throw new Error("Not implemented.")},removeRootViewTransitionClone(i,e){throw new Error("Not implemented.")},createFragmentInstance:i=>null,updateFragmentInstanceFiber(i,e){},commitNewChildToFragmentInstance(i,e){},deleteChildFromFragmentInstance(i,e){},measureClonedInstance:i=>null,maySuspendCommitOnUpdate:(i,e,t)=>!1,maySuspendCommitInSyncRender:(i,e)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(i,e)=>null}),Ld=new Map,um={objects:"shallow",strict:!1};function tZ(i,e){if(!e&&typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement&&i.parentElement){const{width:t,height:n,top:r,left:s}=i.parentElement.getBoundingClientRect();return{width:t,height:n,top:r,left:s}}else if(!e&&typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas)return{width:i.width,height:i.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...e}}function nZ(i){const e=Ld.get(i),t=e==null?void 0:e.fiber,n=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const r=typeof reportError=="function"?reportError:console.error,s=n||Lq(uE,lU),a=t||Fb.createContainer(s,Pq,null,!1,null,"",r,r,r,null);e||Ld.set(i,{fiber:a,store:s});let l,c,h=!1,p=null;return{async configure(g={}){let v;p=new Promise(k=>v=k);let{gl:x,size:b,scene:w,events:S,onCreated:M,shadows:A=!1,linear:D=!1,flat:R=!1,legacy:I=!1,orthographic:P=!1,frameloop:F="always",dpr:N=[1,2],performance:L,raycaster:G,camera:X,onPointerMissed:W}=g,q=s.getState(),K=q.gl;if(!q.gl){const k={canvas:i,powerPreference:"high-performance",antialias:!0,alpha:!0},Z=typeof x=="function"?await x(k):x;$N(Z)?K=Z:K=new sC({...k,...x}),q.set({gl:K})}let ne=q.raycaster;ne||q.set({raycaster:ne=new iC});const{params:j,...$}=G||{};if(Yi.equ($,ne,um)||Eu(ne,{...$}),Yi.equ(j,ne.params,um)||Eu(ne,{params:{...ne.params,...j}}),!q.camera||q.camera===c&&!Yi.equ(c,X,um)){c=X;const k=X==null?void 0:X.isCamera,Z=k?X:P?new kd(0,0,0,0,.1,1e3):new ns(75,0,.1,1e3);k||(Z.position.z=5,X&&(Eu(Z,X),Z.manual||("aspect"in X||"left"in X||"right"in X||"bottom"in X||"top"in X)&&(Z.manual=!0,Z.updateProjectionMatrix())),!q.camera&&!(X!=null&&X.rotation)&&Z.lookAt(0,0,0)),q.set({camera:Z}),ne.camera=Z}if(!q.scene){let k;w!=null&&w.isScene?(k=w,Ib(k,s,"",{})):(k=new hy,Ib(k,s,"",{}),w&&Eu(k,w)),q.set({scene:k})}S&&!q.events.handlers&&q.set({events:S(s)});const he=tZ(i,b);if(Yi.equ(he,q.size,um)||q.setSize(he.width,he.height,he.top,he.left),N&&q.viewport.dpr!==R4(N)&&q.setDpr(N),q.frameloop!==F&&q.setFrameloop(F),q.onPointerMissed||q.set({onPointerMissed:W}),L&&!Yi.equ(L,q.performance,um)&&q.set(k=>({performance:{...k.performance,...L}})),!q.xr){var le;const k=(fe,ve)=>{const se=s.getState();se.frameloop!=="never"&&lU(fe,!0,se,ve)},Z=()=>{const fe=s.getState();fe.gl.xr.enabled=fe.gl.xr.isPresenting,fe.gl.xr.setAnimationLoop(fe.gl.xr.isPresenting?k:null),fe.gl.xr.isPresenting||uE(fe)},oe={connect(){const fe=s.getState().gl;fe.xr.addEventListener("sessionstart",Z),fe.xr.addEventListener("sessionend",Z)},disconnect(){const fe=s.getState().gl;fe.xr.removeEventListener("sessionstart",Z),fe.xr.removeEventListener("sessionend",Z)}};typeof((le=K.xr)==null?void 0:le.addEventListener)=="function"&&oe.connect(),q.set({xr:oe})}if(K.shadowMap){const k=K.shadowMap.enabled,Z=K.shadowMap.type;if(K.shadowMap.enabled=!!A,Yi.boo(A))K.shadowMap.type=uv;else if(Yi.str(A)){var ue;const oe={basic:NP,percentage:Tm,soft:uv,variance:od};K.shadowMap.type=(ue=oe[A])!=null?ue:uv}else Yi.obj(A)&&Object.assign(K.shadowMap,A);(k!==K.shadowMap.enabled||Z!==K.shadowMap.type)&&(K.shadowMap.needsUpdate=!0)}return Hn.enabled=!I,h||(K.outputColorSpace=D?Pl:bs,K.toneMapping=R?Jo:Kb),q.legacy!==I&&q.set(()=>({legacy:I})),q.linear!==D&&q.set(()=>({linear:D})),q.flat!==R&&q.set(()=>({flat:R})),x&&!Yi.fun(x)&&!$N(x)&&!Yi.equ(x,K,um)&&Eu(K,x),l=M,h=!0,v(),this},render(g){return!h&&!p&&this.configure(),p.then(()=>{Fb.updateContainer(H.jsx(iZ,{store:s,children:g,onCreated:l,rootElement:i}),a,null,()=>{})}),s},unmount(){k4(i)}}}function iZ({store:i,children:e,onCreated:t,rootElement:n}){return _y(()=>{const r=i.getState();r.set(s=>({internal:{...s.internal,active:!0}})),t&&t(r),i.getState().events.connected||r.events.connect==null||r.events.connect(n)},[]),H.jsx(uC.Provider,{value:i,children:e})}function k4(i,e){const t=Ld.get(i),n=t==null?void 0:t.fiber;if(n){const r=t==null?void 0:t.store.getState();r&&(r.internal.active=!1),Fb.updateContainer(null,n,null,()=>{r&&setTimeout(()=>{try{var s,a,l,c;r.events.disconnect==null||r.events.disconnect(),(s=r.gl)==null||(a=s.renderLists)==null||a.dispose==null||a.dispose(),(l=r.gl)==null||l.forceContextLoss==null||l.forceContextLoss(),(c=r.gl)!=null&&c.xr&&r.xr.disconnect(),Tq(r.scene),Ld.delete(i)}catch{}},500)})}}function rZ(i,e,t){return H.jsx(sZ,{children:i,container:e,state:t})}function sZ({state:i={},children:e,container:t}){const{events:n,size:r,...s}=i,a=cC(),[l]=ae.useState(()=>new iC),[c]=ae.useState(()=>new pt),h=lC((g,v)=>{let x;if(v.camera&&r){const b=v.camera;x=g.viewport.getCurrentViewport(b,new re,r),b!==g.camera&&N4(b,r)}return{...g,...v,scene:t,raycaster:l,pointer:c,mouse:c,previousRoot:a,events:{...g.events,...v.events,...n},size:{...g.size,...r},viewport:{...g.viewport,...x},setEvents:b=>v.set(w=>({...w,events:{...w.events,...b}}))}}),p=ae.useMemo(()=>{const g=_4((x,b)=>({...s,set:x,get:b})),v=x=>g.setState(b=>h.current(x,b));return v(a.getState()),a.subscribe(v),g},[a,t]);return H.jsx(H.Fragment,{children:Fb.createPortal(H.jsx(uC.Provider,{value:p,children:e}),p,null)})}const aZ=new Set,oZ=new Set,lZ=new Set;function Gw(i,e){if(i.size)for(const{callback:t}of i.values())t(e)}function xv(i,e){switch(i){case"before":return Gw(aZ,e);case"after":return Gw(oZ,e);case"tail":return Gw(lZ,e)}}let Hw,Ww;function oE(i,e,t){let n=e.clock.getDelta();e.frameloop==="never"&&typeof i=="number"&&(n=i-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=i),Hw=e.internal.subscribers;for(let r=0;r0)&&!((e=cm.gl.xr)!=null&&e.isPresenting)&&(jw+=oE(i,cm))}if(lE=!1,xv("after",i),jw===0)return xv("tail",i),kb=!1,cancelAnimationFrame(oU)}function uE(i,e=1){var t;if(!i)return Ld.forEach(n=>uE(n.store.getState(),e));(t=i.gl.xr)!=null&&t.isPresenting||!i.internal.active||i.frameloop==="never"||(e>1?i.internal.frames=Math.min(60,i.internal.frames+e):lE?i.internal.frames=2:i.internal.frames=1,kb||(kb=!0,requestAnimationFrame(z4)))}function lU(i,e=!0,t,n){if(e&&xv("before",i),t)oE(i,t,n);else for(const r of Ld.values())oE(i,r.store.getState());e&&xv("after",i)}const Xw={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function uZ(i){const{handlePointer:e}=Uq(i);return{priority:1,enabled:!0,compute(t,n,r){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(Xw).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:r}=i.getState();(t=r.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(r.lastEvent.current)},connect:t=>{const{set:n,events:r}=i.getState();if(r.disconnect==null||r.disconnect(),n(s=>({events:{...s.events,connected:t}})),r.handlers)for(const s in r.handlers){const a=r.handlers[s],[l,c]=Xw[s];t.addEventListener(l,a,{passive:c})}},disconnect:()=>{const{set:t,events:n}=i.getState();if(n.connected){if(n.handlers)for(const r in n.handlers){const s=n.handlers[r],[a]=Xw[r];n.connected.removeEventListener(a,s)}t(r=>({events:{...r.events,connected:void 0}}))}}}}function uU(i,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>i(...n),e)}}function cZ({debounce:i,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const r=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!r)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,a]=ae.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),l=ae.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),c=i?typeof i=="number"?i:i.scroll:null,h=i?typeof i=="number"?i:i.resize:null,p=ae.useRef(!1);ae.useEffect(()=>(p.current=!0,()=>void(p.current=!1)));const[g,v,x]=ae.useMemo(()=>{const M=()=>{if(!l.current.element)return;const{left:A,top:D,width:R,height:I,bottom:P,right:F,x:N,y:L}=l.current.element.getBoundingClientRect(),G={left:A,top:D,width:R,height:I,bottom:P,right:F,x:N,y:L};l.current.element instanceof HTMLElement&&n&&(G.height=l.current.element.offsetHeight,G.width=l.current.element.offsetWidth),Object.freeze(G),p.current&&!pZ(l.current.lastBounds,G)&&a(l.current.lastBounds=G)};return[M,h?uU(M,h):M,c?uU(M,c):M]},[a,n,c,h]);function b(){l.current.scrollContainers&&(l.current.scrollContainers.forEach(M=>M.removeEventListener("scroll",x,!0)),l.current.scrollContainers=null),l.current.resizeObserver&&(l.current.resizeObserver.disconnect(),l.current.resizeObserver=null),l.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",l.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",l.current.orientationHandler))}function w(){l.current.element&&(l.current.resizeObserver=new r(x),l.current.resizeObserver.observe(l.current.element),e&&l.current.scrollContainers&&l.current.scrollContainers.forEach(M=>M.addEventListener("scroll",x,{capture:!0,passive:!0})),l.current.orientationHandler=()=>{x()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",l.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",l.current.orientationHandler))}const S=M=>{!M||M===l.current.element||(b(),l.current.element=M,l.current.scrollContainers=B4(M),w())};return hZ(x,!!e),fZ(v),ae.useEffect(()=>{b(),w()},[e,x,v]),ae.useEffect(()=>b,[]),[S,s,g]}function fZ(i){ae.useEffect(()=>{const e=i;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[i])}function hZ(i,e){ae.useEffect(()=>{if(e){const t=i;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[i,e])}function B4(i){const e=[];if(!i||i===document.body)return e;const{overflow:t,overflowX:n,overflowY:r}=window.getComputedStyle(i);return[t,n,r].some(s=>s==="auto"||s==="scroll")&&e.push(i),[...e,...B4(i.parentElement)]}const dZ=["x","y","top","bottom","left","right","width","height"],pZ=(i,e)=>dZ.every(t=>i[t]===e[t]);function mZ({ref:i,children:e,fallback:t,resize:n,style:r,gl:s,events:a=uZ,eventSource:l,eventPrefix:c,shadows:h,linear:p,flat:g,legacy:v,orthographic:x,frameloop:b,dpr:w,performance:S,raycaster:M,camera:A,scene:D,onPointerMissed:R,onCreated:I,...P}){ae.useMemo(()=>fC(eq),[]);const F=bq(),[N,L]=cZ({scroll:!0,debounce:{scroll:50,resize:0},...n}),G=ae.useRef(null),X=ae.useRef(null);ae.useImperativeHandle(i,()=>G.current);const W=lC(R),[q,K]=ae.useState(!1),[ne,j]=ae.useState(!1);if(q)throw q;if(ne)throw ne;const $=ae.useRef(null);_y(()=>{const le=G.current;if(L.width>0&&L.height>0&&le){$.current||($.current=nZ(le));async function ue(){await $.current.configure({gl:s,scene:D,events:a,shadows:h,linear:p,flat:g,legacy:v,orthographic:x,frameloop:b,dpr:w,performance:S,raycaster:M,camera:A,size:L,onPointerMissed:(...k)=>W.current==null?void 0:W.current(...k),onCreated:k=>{k.events.connect==null||k.events.connect(l?xq(l)?l.current:l:X.current),c&&k.setEvents({compute:(Z,oe)=>{const fe=Z[c+"X"],ve=Z[c+"Y"];oe.pointer.set(fe/oe.size.width*2-1,-(ve/oe.size.height)*2+1),oe.raycaster.setFromCamera(oe.pointer,oe.camera)}}),I==null||I(k)}}),$.current.render(H.jsx(F,{children:H.jsx(Mq,{set:j,children:H.jsx(ae.Suspense,{fallback:H.jsx(Sq,{set:K}),children:e??null})})}))}ue()}}),ae.useEffect(()=>{const le=G.current;if(le)return()=>k4(le)},[]);const he=l?"none":"auto";return H.jsx("div",{ref:X,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:he,...r},...P,children:H.jsx("div",{ref:N,style:{width:"100%",height:"100%"},children:H.jsx("canvas",{ref:G,style:{display:"block"},children:t})})})}function by(i){return H.jsx(T4,{children:H.jsx(mZ,{...i})})}function go(){return go=Object.assign?Object.assign.bind():function(i){for(var e=1;e>>1|(Vi&21845)<<1;Mf=(Mf&52428)>>>2|(Mf&13107)<<2,Mf=(Mf&61680)>>>4|(Mf&3855)<<4,fE[Vi]=((Mf&65280)>>>8|(Mf&255)<<8)>>>1}var _v=(function(i,e,t){for(var n=i.length,r=0,s=new Of(e);r>>c]=h}else for(l=new Of(n),r=0;r>>15-i[r]);return l}),Sy=new qo(288);for(var Vi=0;Vi<144;++Vi)Sy[Vi]=8;for(var Vi=144;Vi<256;++Vi)Sy[Vi]=9;for(var Vi=256;Vi<280;++Vi)Sy[Vi]=7;for(var Vi=280;Vi<288;++Vi)Sy[Vi]=8;var Y4=new qo(32);for(var Vi=0;Vi<32;++Vi)Y4[Vi]=5;var _Z=_v(Sy,9,1),bZ=_v(Y4,5,1),Yw=function(i){for(var e=i[0],t=1;te&&(e=i[t]);return e},Tl=function(i,e,t){var n=e/8|0;return(i[n]|i[n+1]<<8)>>(e&7)&t},qw=function(i,e){var t=e/8|0;return(i[t]|i[t+1]<<8|i[t+2]<<16)>>(e&7)},SZ=function(i){return(i/8|0)+(i&7&&1)},MZ=function(i,e,t){(t==null||t>i.length)&&(t=i.length);var n=new(i instanceof Of?Of:i instanceof cE?cE:qo)(t-e);return n.set(i.subarray(e,t)),n},wZ=function(i,e,t){var n=i.length;if(!n||t&&!t.l&&n<5)return e||new qo(0);var r=!e||t,s=!t||t.i;t||(t={}),e||(e=new qo(n*3));var a=function(se){var de=e.length;if(se>de){var be=new qo(Math.max(de*2,se));be.set(e),e=be}},l=t.f||0,c=t.p||0,h=t.b||0,p=t.l,g=t.d,v=t.m,x=t.n,b=n*8;do{if(!p){t.f=l=Tl(i,c,1);var w=Tl(i,c+1,3);if(c+=3,w)if(w==1)p=_Z,g=bZ,v=9,x=5;else if(w==2){var D=Tl(i,c,31)+257,R=Tl(i,c+10,15)+4,I=D+Tl(i,c+5,31)+1;c+=14;for(var P=new qo(I),F=new qo(19),N=0;N>>4;if(S<16)P[N++]=S;else{var q=0,K=0;for(S==16?(K=3+Tl(i,c,3),c+=2,q=P[N-1]):S==17?(K=3+Tl(i,c,7),c+=3):S==18&&(K=11+Tl(i,c,127),c+=7);K--;)P[N++]=q}}var ne=P.subarray(0,D),j=P.subarray(D);v=Yw(ne),x=Yw(j),p=_v(ne,v,1),g=_v(j,x,1)}else throw"invalid block type";else{var S=SZ(c)+4,M=i[S-4]|i[S-3]<<8,A=S+M;if(A>n){if(s)throw"unexpected EOF";break}r&&a(h+M),e.set(i.subarray(S,A),h),t.b=h+=M,t.p=c=A*8;continue}if(c>b){if(s)throw"unexpected EOF";break}}r&&a(h+131072);for(var $=(1<>>4;if(c+=q&15,c>b){if(s)throw"unexpected EOF";break}if(!q)throw"invalid length/literal";if(ue<256)e[h++]=ue;else if(ue==256){le=c,p=null;break}else{var k=ue-254;if(ue>264){var N=ue-257,Z=G4[N];k=Tl(i,c,(1<>>4;if(!oe)throw"invalid distance";c+=oe&15;var j=xZ[fe];if(fe>3){var Z=H4[fe];j+=qw(i,c)&(1<b){if(s)throw"unexpected EOF";break}r&&a(h+131072);for(var ve=h+k;h>>4>7||(i[0]<<8|i[1])%31)throw"invalid zlib data";if(i[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function n1(i,e){return wZ((EZ(i),i.subarray(2,-4)),e)}var AZ=typeof TextDecoder<"u"&&new TextDecoder,CZ=0;try{AZ.decode(TZ,{stream:!0}),CZ=1}catch{}const RZ=i=>i&&i.isCubeTexture;class DZ extends wi{constructor(e,t){var n,r;const s=RZ(e),l=((r=s?(n=e.image[0])==null?void 0:n.width:e.image.width)!=null?r:1024)/4,c=Math.floor(Math.log2(l)),h=Math.pow(2,c),p=3*Math.max(h,112),g=4*h,v=[s?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/p}`,`#define CUBEUV_TEXEL_HEIGHT ${1/g}`,`#define CUBEUV_MAX_MIP ${c}.0`],x=` varying vec3 vWorldPosition; void main() { vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) ); vWorldPosition = worldPosition.xyz; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); } `,b=v.join(` `)+` #define ENVMAP_TYPE_CUBE_UV varying vec3 vWorldPosition; uniform float radius; uniform float height; uniform float angle; #ifdef ENVMAP_TYPE_CUBE uniform samplerCube map; #else uniform sampler2D map; #endif // From: https://www.shadertoy.com/view/4tsBD7 float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) { float d = dot ( rd, n ); if( d > 0.0 ) { return 1e6; } vec3 o = ro - c; float t = - dot( n, o ) / d; vec3 q = o + rd * t; return ( dot( q, q ) < r * r ) ? t : 1e6; } // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) { vec3 oc = ro - ce; float b = dot( oc, rd ); float c = dot( oc, oc ) - ra * ra; float h = b * b - c; if( h < 0.0 ) { return -1.0; } h = sqrt( h ); return - b + h; } vec3 project() { vec3 p = normalize( vWorldPosition ); vec3 camPos = cameraPosition; camPos.y -= height; float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius ); if( intersection > 0.0 ) { vec3 h = vec3( 0.0, - height, 0.0 ); float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius ); p = ( camPos + min( intersection, intersection2 ) * p ) / radius; } else { p = vec3( 0.0, 1.0, 0.0 ); } return p; } #include #include void main() { vec3 projectedWorldPosition = project(); #ifdef ENVMAP_TYPE_CUBE vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb; #else vec3 direction = normalize( projectedWorldPosition ); vec2 uv = equirectUv( direction ); vec3 outcolor = texture2D( map, uv ).rgb; #endif gl_FragColor = vec4( outcolor, 1.0 ); #include #include <${V4>=154?"colorspace_fragment":"encodings_fragment"}> } `,w={map:{value:e},height:{value:(t==null?void 0:t.height)||15},radius:{value:(t==null?void 0:t.radius)||100}},S=new $m(1,16),M=new ls({uniforms:w,fragmentShader:b,vertexShader:x,side:io});super(S,M)}set radius(e){this.material.uniforms.radius.value=e}get radius(){return this.material.uniforms.radius.value}set height(e){this.material.uniforms.height.value=e}get height(){return this.material.uniforms.height.value}}const NZ={uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:` varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); } `,fragmentShader:` uniform sampler2D tDiffuse; uniform float h; varying vec2 vUv; void main() { vec4 sum = vec4( 0.0 ); sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051; sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918; sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245; sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531; sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633; sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531; sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245; sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918; sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051; gl_FragColor = sum; } `},UZ={uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:` varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); } `,fragmentShader:` uniform sampler2D tDiffuse; uniform float v; varying vec2 vUv; void main() { vec4 sum = vec4( 0.0 ); sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051; sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918; sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245; sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531; sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633; sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531; sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245; sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918; sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051; gl_FragColor = sum; } `};class LZ extends ZA{constructor(e){super(e),this.type=ar}parse(e){const a=function(N,L){switch(N){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(L||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(L||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(L||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(L||""))}},g=function(N,L,G){L=L||1024;let W=N.pos,q=-1,K=0,ne="",j=String.fromCharCode.apply(null,new Uint16Array(N.subarray(W,W+128)));for(;0>(q=j.indexOf(` `))&&K=N.byteLength||!(ne=g(N)))&&a(1,"no header found"),(j=ne.match(L))||a(3,"bad initial token"),K.valid|=1,K.programtype=j[1],K.string+=ne+` `;ne=g(N),ne!==!1;){if(K.string+=ne+` `,ne.charAt(0)==="#"){K.comments+=ne+` `;continue}if((j=ne.match(G))&&(K.gamma=parseFloat(j[1])),(j=ne.match(X))&&(K.exposure=parseFloat(j[1])),(j=ne.match(W))&&(K.valid|=2,K.format=j[1]),(j=ne.match(q))&&(K.valid|=4,K.height=parseInt(j[1],10),K.width=parseInt(j[2],10)),K.valid&2&&K.valid&4)break}return K.valid&2||a(3,"missing format specifier"),K.valid&4||a(3,"missing image size specifier"),K},x=function(N,L,G){const X=L;if(X<8||X>32767||N[0]!==2||N[1]!==2||N[2]&128)return new Uint8Array(N);X!==(N[2]<<8|N[3])&&a(3,"wrong scanline width");const W=new Uint8Array(4*L*G);W.length||a(4,"unable to allocate buffer space");let q=0,K=0;const ne=4*X,j=new Uint8Array(4),$=new Uint8Array(ne);let he=G;for(;he>0&&KN.byteLength&&a(1),j[0]=N[K++],j[1]=N[K++],j[2]=N[K++],j[3]=N[K++],(j[0]!=2||j[1]!=2||(j[2]<<8|j[3])!=X)&&a(3,"bad rgbe scanline format");let le=0,ue;for(;le128;if(Z&&(ue-=128),(ue===0||le+ue>ne)&&a(3,"bad scanline data"),Z){const oe=N[K++];for(let fe=0;fe=152;class IZ extends ZA{constructor(e){super(e),this.type=ar}parse(e){const L=Math.pow(2.7182818,2.2);function G(Y,ie){for(var me=0,Oe=0;Oe<65536;++Oe)(Oe==0||Y[Oe>>3]&1<<(Oe&7))&&(ie[me++]=Oe);for(var je=me-1;me<65536;)ie[me++]=0;return je}function X(Y){for(var ie=0;ie<16384;ie++)Y[ie]={},Y[ie].len=0,Y[ie].lit=0,Y[ie].p=null}const W={l:0,c:0,lc:0};function q(Y,ie,me,Oe,je){for(;me>me&(1<0;--ie){var Oe=me+K[ie]>>1;K[ie]=me,me=Oe}for(var ie=0;ie<65537;++ie){var je=Y[ie];je>0&&(Y[ie]=je|K[je]++<<6)}}function j(Y,ie,me,Oe,je,qe,_t){for(var vt=me,wt=0,Tt=0;je<=qe;je++){if(vt.value-me.value>Oe)return!1;q(6,wt,Tt,Y,vt);var At=W.l;if(wt=W.c,Tt=W.lc,_t[je]=At,At==63){if(vt.value-me.value>Oe)throw"Something wrong with hufUnpackEncTable";q(8,wt,Tt,Y,vt);var V=W.l+6;if(wt=W.c,Tt=W.lc,je+V>qe+1)throw"Something wrong with hufUnpackEncTable";for(;V--;)_t[je++]=0;je--}else if(At>=59){var V=At-59+2;if(je+V>qe+1)throw"Something wrong with hufUnpackEncTable";for(;V--;)_t[je++]=0;je--}}ne(_t)}function $(Y){return Y&63}function he(Y){return Y>>6}function le(Y,ie,me,Oe){for(;ie<=me;ie++){var je=he(Y[ie]),qe=$(Y[ie]);if(je>>qe)throw"Invalid table entry";if(qe>14){var _t=Oe[je>>qe-14];if(_t.len)throw"Invalid table entry";if(_t.lit++,_t.p){var vt=_t.p;_t.p=new Array(_t.lit);for(var wt=0;wt<_t.lit-1;++wt)_t.p[wt]=vt[wt]}else _t.p=new Array(1);_t.p[_t.lit-1]=ie}else if(qe)for(var Tt=0,wt=1<<14-qe;wt>0;wt--){var _t=Oe[(je<<14-qe)+Tt];if(_t.len||_t.p)throw"Invalid table entry";_t.len=qe,_t.lit=ie,Tt++}}return!0}const ue={c:0,lc:0};function k(Y,ie,me,Oe){Y=Y<<8|$e(me,Oe),ie+=8,ue.c=Y,ue.lc=ie}const Z={c:0,lc:0};function oe(Y,ie,me,Oe,je,qe,_t,vt,wt,Tt){if(Y==ie){Oe<8&&(k(me,Oe,je,_t),me=ue.c,Oe=ue.lc),Oe-=8;var At=me>>Oe,At=new Uint8Array([At])[0];if(wt.value+At>Tt)return!1;for(var V=vt[wt.value-1];At-- >0;)vt[wt.value++]=V}else if(wt.value32767?ie-65536:ie}const se={a:0,b:0};function de(Y,ie){var me=ve(Y),Oe=ve(ie),je=Oe,qe=me+(je&1)+(je>>1),_t=qe,vt=qe-je;se.a=_t,se.b=vt}function be(Y,ie){var me=fe(Y),Oe=fe(ie),je=me-(Oe>>1)&65535,qe=Oe+je-32768&65535;se.a=qe,se.b=je}function Ge(Y,ie,me,Oe,je,qe,_t){for(var vt=_t<16384,wt=me>je?je:me,Tt=1,At;Tt<=wt;)Tt<<=1;for(Tt>>=1,At=Tt,Tt>>=1;Tt>=1;){for(var V=0,pe=V+qe*(je-At),Me=qe*Tt,_e=qe*At,Se=Oe*Tt,nt=Oe*At,ht,dt,gt,Pt;V<=pe;V+=_e){for(var It=V,Kt=V+Oe*(me-At);It<=Kt;It+=nt){var St=It+Se,Xt=It+Me,pn=Xt+Se;vt?(de(Y[It+ie],Y[Xt+ie]),ht=se.a,gt=se.b,de(Y[St+ie],Y[pn+ie]),dt=se.a,Pt=se.b,de(ht,dt),Y[It+ie]=se.a,Y[St+ie]=se.b,de(gt,Pt),Y[Xt+ie]=se.a,Y[pn+ie]=se.b):(be(Y[It+ie],Y[Xt+ie]),ht=se.a,gt=se.b,be(Y[St+ie],Y[pn+ie]),dt=se.a,Pt=se.b,be(ht,dt),Y[It+ie]=se.a,Y[St+ie]=se.b,be(gt,Pt),Y[Xt+ie]=se.a,Y[pn+ie]=se.b)}if(me&Tt){var Xt=It+Me;vt?de(Y[It+ie],Y[Xt+ie]):be(Y[It+ie],Y[Xt+ie]),ht=se.a,Y[Xt+ie]=se.b,Y[It+ie]=ht}}if(je&Tt)for(var It=V,Kt=V+Oe*(me-At);It<=Kt;It+=nt){var St=It+Se;vt?de(Y[It+ie],Y[St+ie]):be(Y[It+ie],Y[St+ie]),ht=se.a,Y[St+ie]=se.b,Y[It+ie]=ht}At=Tt,Tt>>=1}return V}function ot(Y,ie,me,Oe,je,qe,_t,vt,wt,Tt){for(var At=0,V=0,pe=vt,Me=Math.trunc(je.value+(qe+7)/8);je.value=14;){var _e=At>>V-14&16383,Se=ie[_e];if(Se.len)V-=Se.len,oe(Se.lit,_t,At,V,me,Oe,je,wt,Tt,pe),At=Z.c,V=Z.lc;else{if(!Se.p)throw"hufDecode issues";var nt;for(nt=0;nt=ht&&he(Y[Se.p[nt]])==(At>>V-ht&(1<>=dt,V-=dt;V>0;){var Se=ie[At<<14-V&16383];if(Se.len)V-=Se.len,oe(Se.lit,_t,At,V,me,Oe,je,wt,Tt,pe),At=Z.c,V=Z.lc;else throw"hufDecode issues"}return!0}function Qe(Y,ie,me,Oe,je,qe){var _t={value:0},vt=me.value,wt=Pe(ie,me),Tt=Pe(ie,me);me.value+=4;var At=Pe(ie,me);if(me.value+=4,wt<0||wt>=65537||Tt<0||Tt>=65537)throw"Something wrong with HUF_ENCSIZE";var V=new Array(65537),pe=new Array(16384);X(pe);var Me=Oe-(me.value-vt);if(j(Y,ie,me,Me,wt,Tt,V),At>8*(Oe-(me.value-vt)))throw"Something wrong with hufUncompress";le(V,wt,Tt,pe),ot(V,pe,Y,ie,me,At,Tt,qe,je,_t)}function Je(Y,ie,me){for(var Oe=0;Oeqe||(ie[je++]=Y[me++],je>qe));)ie[je++]=Y[Oe++]}function ze(Y){for(var ie=Y.byteLength,me=new Array,Oe=0,je=new DataView(Y);ie>0;){var qe=je.getInt8(Oe++);if(qe<0){var _t=-qe;ie-=_t+1;for(var vt=0;vt<_t;vt++)me.push(je.getUint8(Oe++))}else{var _t=qe;ie-=2;for(var wt=je.getUint8(Oe++),vt=0;vt<_t+1;vt++)me.push(wt)}}return me}function Ie(Y,ie,me,Oe,je,qe){var St=new DataView(qe.buffer),_t=me[Y.idx[0]].width,vt=me[Y.idx[0]].height,wt=3,Tt=Math.floor(_t/8),At=Math.ceil(_t/8),V=Math.ceil(vt/8),pe=_t-(At-1)*8,Me=vt-(V-1)*8,_e={value:0},Se=new Array(wt),nt=new Array(wt),ht=new Array(wt),dt=new Array(wt),gt=new Array(wt);for(let Wt=0;Wt>8==255?je+=Oe&255:(me[je]=Oe,je++),Y.value++}function ee(Y,ie){ie[0]=we(Y[0]),ie[1]=we(Y[1]),ie[2]=we(Y[5]),ie[3]=we(Y[6]),ie[4]=we(Y[14]),ie[5]=we(Y[15]),ie[6]=we(Y[27]),ie[7]=we(Y[28]),ie[8]=we(Y[2]),ie[9]=we(Y[4]),ie[10]=we(Y[7]),ie[11]=we(Y[13]),ie[12]=we(Y[16]),ie[13]=we(Y[26]),ie[14]=we(Y[29]),ie[15]=we(Y[42]),ie[16]=we(Y[3]),ie[17]=we(Y[8]),ie[18]=we(Y[12]),ie[19]=we(Y[17]),ie[20]=we(Y[25]),ie[21]=we(Y[30]),ie[22]=we(Y[41]),ie[23]=we(Y[43]),ie[24]=we(Y[9]),ie[25]=we(Y[11]),ie[26]=we(Y[18]),ie[27]=we(Y[24]),ie[28]=we(Y[31]),ie[29]=we(Y[40]),ie[30]=we(Y[44]),ie[31]=we(Y[53]),ie[32]=we(Y[10]),ie[33]=we(Y[19]),ie[34]=we(Y[23]),ie[35]=we(Y[32]),ie[36]=we(Y[39]),ie[37]=we(Y[45]),ie[38]=we(Y[52]),ie[39]=we(Y[54]),ie[40]=we(Y[20]),ie[41]=we(Y[22]),ie[42]=we(Y[33]),ie[43]=we(Y[38]),ie[44]=we(Y[46]),ie[45]=we(Y[51]),ie[46]=we(Y[55]),ie[47]=we(Y[60]),ie[48]=we(Y[21]),ie[49]=we(Y[34]),ie[50]=we(Y[37]),ie[51]=we(Y[47]),ie[52]=we(Y[50]),ie[53]=we(Y[56]),ie[54]=we(Y[59]),ie[55]=we(Y[61]),ie[56]=we(Y[35]),ie[57]=we(Y[36]),ie[58]=we(Y[48]),ie[59]=we(Y[49]),ie[60]=we(Y[57]),ie[61]=we(Y[58]),ie[62]=we(Y[62]),ie[63]=we(Y[63])}function lt(Y){const ie=.5*Math.cos(.7853975),me=.5*Math.cos(3.14159/16),Oe=.5*Math.cos(3.14159/8),je=.5*Math.cos(3*3.14159/16),qe=.5*Math.cos(5*3.14159/16),_t=.5*Math.cos(3*3.14159/8),vt=.5*Math.cos(7*3.14159/16);for(var wt=new Array(4),Tt=new Array(4),At=new Array(4),V=new Array(4),pe=0;pe<8;++pe){var Me=pe*8;wt[0]=Oe*Y[Me+2],wt[1]=_t*Y[Me+2],wt[2]=Oe*Y[Me+6],wt[3]=_t*Y[Me+6],Tt[0]=me*Y[Me+1]+je*Y[Me+3]+qe*Y[Me+5]+vt*Y[Me+7],Tt[1]=je*Y[Me+1]-vt*Y[Me+3]-me*Y[Me+5]-qe*Y[Me+7],Tt[2]=qe*Y[Me+1]-me*Y[Me+3]+vt*Y[Me+5]+je*Y[Me+7],Tt[3]=vt*Y[Me+1]-qe*Y[Me+3]+je*Y[Me+5]-me*Y[Me+7],At[0]=ie*(Y[Me+0]+Y[Me+4]),At[3]=ie*(Y[Me+0]-Y[Me+4]),At[1]=wt[0]+wt[3],At[2]=wt[1]-wt[2],V[0]=At[0]+At[1],V[1]=At[3]+At[2],V[2]=At[3]-At[2],V[3]=At[0]-At[1],Y[Me+0]=V[0]+Tt[0],Y[Me+1]=V[1]+Tt[1],Y[Me+2]=V[2]+Tt[2],Y[Me+3]=V[3]+Tt[3],Y[Me+4]=V[3]-Tt[3],Y[Me+5]=V[2]-Tt[2],Y[Me+6]=V[1]-Tt[1],Y[Me+7]=V[0]-Tt[0]}for(var _e=0;_e<8;++_e)wt[0]=Oe*Y[16+_e],wt[1]=_t*Y[16+_e],wt[2]=Oe*Y[48+_e],wt[3]=_t*Y[48+_e],Tt[0]=me*Y[8+_e]+je*Y[24+_e]+qe*Y[40+_e]+vt*Y[56+_e],Tt[1]=je*Y[8+_e]-vt*Y[24+_e]-me*Y[40+_e]-qe*Y[56+_e],Tt[2]=qe*Y[8+_e]-me*Y[24+_e]+vt*Y[40+_e]+je*Y[56+_e],Tt[3]=vt*Y[8+_e]-qe*Y[24+_e]+je*Y[40+_e]-me*Y[56+_e],At[0]=ie*(Y[_e]+Y[32+_e]),At[3]=ie*(Y[_e]-Y[32+_e]),At[1]=wt[0]+wt[3],At[2]=wt[1]-wt[2],V[0]=At[0]+At[1],V[1]=At[3]+At[2],V[2]=At[3]-At[2],V[3]=At[0]-At[1],Y[0+_e]=V[0]+Tt[0],Y[8+_e]=V[1]+Tt[1],Y[16+_e]=V[2]+Tt[2],Y[24+_e]=V[3]+Tt[3],Y[32+_e]=V[3]-Tt[3],Y[40+_e]=V[2]-Tt[2],Y[48+_e]=V[1]-Tt[1],Y[56+_e]=V[0]-Tt[0]}function Ye(Y){for(var ie=0;ie<64;++ie){var me=Y[0][ie],Oe=Y[1][ie],je=Y[2][ie];Y[0][ie]=me+1.5747*je,Y[1][ie]=me-.1873*Oe-.4682*je,Y[2][ie]=me+1.8556*Oe}}function Re(Y,ie,me){for(var Oe=0;Oe<64;++Oe)ie[me+Oe]=cd.toHalfFloat(We(Y[Oe]))}function We(Y){return Y<=1?Math.sign(Y)*Math.pow(Math.abs(Y),2.2):Math.sign(Y)*Math.pow(L,Math.abs(Y)-1)}function Q(Y){return new DataView(Y.array.buffer,Y.offset.value,Y.size)}function B(Y){var ie=Y.viewer.buffer.slice(Y.offset.value,Y.offset.value+Y.size),me=new Uint8Array(ze(ie)),Oe=new Uint8Array(me.length);return Mt(me),Le(me,Oe),new DataView(Oe.buffer)}function ce(Y){var ie=Y.array.slice(Y.offset.value,Y.offset.value+Y.size),me=n1(ie),Oe=new Uint8Array(me.length);return Mt(me),Le(me,Oe),new DataView(Oe.buffer)}function Ue(Y){for(var ie=Y.viewer,me={value:Y.offset.value},Oe=new Uint16Array(Y.width*Y.scanlineBlockSize*(Y.channels*Y.type)),je=new Uint8Array(8192),qe=0,_t=new Array(Y.channels),vt=0;vt=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if(wt<=Tt)for(var vt=0;vt0;){var vt=rt(ie.buffer,me),wt=ct(ie,me),Tt=wt>>2&3,At=(wt>>4)-1,V=new Int8Array([At])[0],pe=ct(ie,me);qe.push({name:vt,index:V,type:pe,compression:Tt}),_t-=vt.length+3}for(var Me=pi.channels,_e=new Array(Y.channels),Se=0;Se=0&&(dt.idx[Pt.index]=gt),nt.offset=gt)}if(je.acCompressedSize>0)switch(je.acCompression){case 0:var St=new Uint16Array(je.totalAcUncompressedCount);Qe(Y.array,ie,me,je.acCompressedSize,St,je.totalAcUncompressedCount);break;case 1:var It=Y.array.slice(me.value,me.value+je.totalAcUncompressedCount),Kt=n1(It),St=new Uint16Array(Kt.buffer);me.value+=je.totalAcUncompressedCount;break}if(je.dcCompressedSize>0){var Xt={array:Y.array,offset:me,size:je.dcCompressedSize},pn=new Uint16Array(ce(Xt).buffer);me.value+=je.dcCompressedSize}if(je.rleRawSize>0){var It=Y.array.slice(me.value,me.value+je.rleCompressedSize),Kt=n1(It),Pn=ze(Kt.buffer);me.value+=je.rleCompressedSize}for(var tn=0,Wt=new Array(_e.length),Se=0;Se>10,me=Y&1023;return(Y>>15?-1:1)*(ie?ie===31?me?NaN:1/0:Math.pow(2,ie-15)*(1+me/1024):6103515625e-14*(me/1024))}function it(Y,ie){var me=Y.getUint16(ie.value,!0);return ie.value+=2,me}function Lt(Y,ie){return we(it(Y,ie))}function et(Y,ie,me,Oe){for(var je=me.value,qe=[];me.valueJt.height?Jt.height-ie:Jt.scanlineBlockSize;const Oe=Jt.size=Jt.height)break;for(let _t=0;_t.init",h),p&&(p=n("<"+l+">.getTransferables",p));var g=null;typeof h=="function"?g=h.apply(void 0,c):console.error("worker module init function failed to rehydrate"),i[a]={id:a,value:g,getTransferables:p},s(g)}catch(v){v&&v.noLog||console.error(v),s(v)}}function t(r,s){var a,l=r.id,c=r.args;(!i[l]||typeof i[l].value!="function")&&s(new Error("Worker module "+l+": not found or its 'init' did not return a function"));try{var h=(a=i[l]).value.apply(a,c);h&&typeof h.then=="function"?h.then(p,function(g){return s(g instanceof Error?g:new Error(""+g))}):p(h)}catch(g){s(g)}function p(g){try{var v=i[l].getTransferables&&i[l].getTransferables(g);(!v||!Array.isArray(v)||!v.length)&&(v=void 0),s(g,v)}catch(x){console.error(x),s(x)}}}function n(r,s){var a=void 0;self.troikaDefine=function(c){return a=c};var l=URL.createObjectURL(new Blob(["/** "+r.replace(/\*/g,"")+` **/ troikaDefine( `+s+` )`],{type:"application/javascript"}));try{importScripts(l)}catch(c){console.error(c)}return URL.revokeObjectURL(l),delete self.troikaDefine,a}self.addEventListener("message",function(r){var s=r.data,a=s.messageId,l=s.action,c=s.data;try{l==="registerModule"&&e(c,function(h){h instanceof Error?postMessage({messageId:a,success:!1,error:h.message}):postMessage({messageId:a,success:!0,result:{isCallable:typeof h=="function"}})}),l==="callModule"&&t(c,function(h,p){h instanceof Error?postMessage({messageId:a,success:!1,error:h.message}):postMessage({messageId:a,success:!0,result:h},p||void 0)})}catch(h){postMessage({messageId:a,success:!1,error:h.stack})}})}function OZ(i){var e=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e._getInitResult().then(function(r){if(typeof r=="function")return r.apply(void 0,t);throw new Error("Worker module function was called but `init` did not return a callable function")})};return e._getInitResult=function(){var t=i.dependencies,n=i.init;t=Array.isArray(t)?t.map(function(s){return s&&(s=s.onMainThread||s,s._getInitResult&&(s=s._getInitResult())),s}):[];var r=Promise.all(t).then(function(s){return n.apply(null,s)});return e._getInitResult=function(){return r},r},e}var q4=function(){var i=!1;if(typeof window<"u"&&typeof window.document<"u")try{var e=new Worker(URL.createObjectURL(new Blob([""],{type:"application/javascript"})));e.terminate(),i=!0}catch(t){console.log("Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: ["+t.message+"]")}return q4=function(){return i},i},FZ=0,kZ=0,Zw=!1,bv=Object.create(null),Sv=Object.create(null),hE=Object.create(null);function rg(i){if((!i||typeof i.init!="function")&&!Zw)throw new Error("requires `options.init` function");var e=i.dependencies,t=i.init,n=i.getTransferables,r=i.workerId,s=OZ(i);r==null&&(r="#default");var a="workerModule"+ ++FZ,l=i.name||a,c=null;e=e&&e.map(function(p){return typeof p=="function"&&!p.workerModuleData&&(Zw=!0,p=rg({workerId:r,name:"<"+l+"> function dependency: "+p.name,init:`function(){return ( `+b1(p)+` )}`}),Zw=!1),p&&p.workerModuleData&&(p=p.workerModuleData),p});function h(){for(var p=[],g=arguments.length;g--;)p[g]=arguments[g];if(!q4())return s.apply(void 0,p);if(!c){c=cU(r,"registerModule",h.workerModuleData);var v=function(){c=null,Sv[r].delete(v)};(Sv[r]||(Sv[r]=new Set)).add(v)}return c.then(function(x){var b=x.isCallable;if(b)return cU(r,"callModule",{id:a,args:p});throw new Error("Worker module function was called but `init` did not return a callable function")})}return h.workerModuleData={isWorkerModule:!0,id:a,name:l,dependencies:e,init:b1(t),getTransferables:n&&b1(n)},h.onMainThread=s,h}function zZ(i){Sv[i]&&Sv[i].forEach(function(e){e()}),bv[i]&&(bv[i].terminate(),delete bv[i])}function b1(i){var e=i.toString();return!/^function/.test(e)&&/^\w+\s*\(/.test(e)&&(e="function "+e),e}function BZ(i){var e=bv[i];if(!e){var t=b1(PZ);e=bv[i]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+i.replace(/\*/g,"")+` **/ ;(`+t+")()"],{type:"application/javascript"}))),e.onmessage=function(n){var r=n.data,s=r.messageId,a=hE[s];if(!a)throw new Error("WorkerModule response with empty or unknown messageId");delete hE[s],a(r)}}return e}function cU(i,e,t){return new Promise(function(n,r){var s=++kZ;hE[s]=function(a){a.success?n(a.result):r(new Error("Error in worker "+e+" call: "+a.error))},BZ(i).postMessage({messageId:s,action:e,data:t})})}function Z4(){var i=(function(e){function t(le,ue,k,Z,oe,fe,ve,se){var de=1-ve;se.x=de*de*le+2*de*ve*k+ve*ve*oe,se.y=de*de*ue+2*de*ve*Z+ve*ve*fe}function n(le,ue,k,Z,oe,fe,ve,se,de,be){var Ge=1-de;be.x=Ge*Ge*Ge*le+3*Ge*Ge*de*k+3*Ge*de*de*oe+de*de*de*ve,be.y=Ge*Ge*Ge*ue+3*Ge*Ge*de*Z+3*Ge*de*de*fe+de*de*de*se}function r(le,ue){for(var k=/([MLQCZ])([^MLQCZ]*)/g,Z,oe,fe,ve,se;Z=k.exec(le);){var de=Z[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(be){return parseFloat(be)});switch(Z[1]){case"M":ve=oe=de[0],se=fe=de[1];break;case"L":(de[0]!==ve||de[1]!==se)&&ue("L",ve,se,ve=de[0],se=de[1]);break;case"Q":{ue("Q",ve,se,ve=de[2],se=de[3],de[0],de[1]);break}case"C":{ue("C",ve,se,ve=de[4],se=de[5],de[0],de[1],de[2],de[3]);break}case"Z":(ve!==oe||se!==fe)&&ue("L",ve,se,oe,fe);break}}}function s(le,ue,k){k===void 0&&(k=16);var Z={x:0,y:0};r(le,function(oe,fe,ve,se,de,be,Ge,ot,Qe){switch(oe){case"L":ue(fe,ve,se,de);break;case"Q":{for(var Je=fe,Mt=ve,Le=1;Le0;)Ve[Pe]=arguments[Pe+2];var $e=Ue[Nt]||(Ue[Nt]=k.getUniformLocation(Ae,Nt));k["uniform"+Et].apply(k,[$e].concat(Ve))},setAttribute:function(Et,Nt,Ve,Pe,$e){var ct=ce[Et];ct||(ct=ce[Et]={buf:k.createBuffer(),loc:k.getAttribLocation(Ae,Et),data:null}),k.bindBuffer(k.ARRAY_BUFFER,ct.buf),k.vertexAttribPointer(ct.loc,Nt,k.FLOAT,!1,0,0),k.enableVertexAttribArray(ct.loc),oe?k.vertexAttribDivisor(ct.loc,Pe):ze("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(ct.loc,Pe),$e!==ct.data&&(k.bufferData(k.ARRAY_BUFFER,$e,Ve),ct.data=$e)}})}}}ve[Re].transaction(B)},ee=function(Re,We){de++;try{k.activeTexture(k.TEXTURE0+de);var Q=se[Re];Q||(Q=se[Re]=k.createTexture(),k.bindTexture(k.TEXTURE_2D,Q),k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.NEAREST),k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST)),k.bindTexture(k.TEXTURE_2D,Q),We(Q,de)}finally{de--}},lt=function(Re,We,Q){var B=k.createFramebuffer();be.push(B),k.bindFramebuffer(k.FRAMEBUFFER,B),k.activeTexture(k.TEXTURE0+We),k.bindTexture(k.TEXTURE_2D,Re),k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_2D,Re,0);try{Q(B)}finally{k.deleteFramebuffer(B),k.bindFramebuffer(k.FRAMEBUFFER,be[--be.length-1]||null)}},Ye=function(){fe={},ve={},se={},de=-1,be.length=0};var Ge=ze,ot=Ie,Qe=tt,Je=ee,Mt=lt,Le=Ye,oe=typeof WebGL2RenderingContext<"u"&&k instanceof WebGL2RenderingContext,fe={},ve={},se={},de=-1,be=[];k.canvas.addEventListener("webglcontextlost",function(Re){Ye(),Re.preventDefault()},!1),c.set(k,Z={gl:k,isWebGL2:oe,getExtension:ze,withProgram:tt,withTexture:ee,withTextureFramebuffer:lt,handleContextLoss:Ye})}ue(Z)}function g(le,ue,k,Z,oe,fe,ve,se){ve===void 0&&(ve=15),se===void 0&&(se=null),p(le,function(de){var be=de.gl,Ge=de.withProgram,ot=de.withTexture;ot("copy",function(Qe,Je){be.texImage2D(be.TEXTURE_2D,0,be.RGBA,oe,fe,0,be.RGBA,be.UNSIGNED_BYTE,ue),Ge("copy",a,l,function(Mt){var Le=Mt.setUniform,ze=Mt.setAttribute;ze("aUV",2,be.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),Le("1i","image",Je),be.bindFramebuffer(be.FRAMEBUFFER,se||null),be.disable(be.BLEND),be.colorMask(ve&8,ve&4,ve&2,ve&1),be.viewport(k,Z,oe,fe),be.scissor(k,Z,oe,fe),be.drawArrays(be.TRIANGLES,0,3)})})})}function v(le,ue,k){var Z=le.width,oe=le.height;p(le,function(fe){var ve=fe.gl,se=new Uint8Array(Z*oe*4);ve.readPixels(0,0,Z,oe,ve.RGBA,ve.UNSIGNED_BYTE,se),le.width=ue,le.height=k,g(ve,se,0,0,Z,oe)})}var x=Object.freeze({__proto__:null,withWebGLContext:p,renderImageData:g,resizeWebGLCanvasWithoutClearing:v});function b(le,ue,k,Z,oe,fe){fe===void 0&&(fe=1);var ve=new Uint8Array(le*ue),se=Z[2]-Z[0],de=Z[3]-Z[1],be=[];s(k,function(ze,Ie,tt,ee){be.push({x1:ze,y1:Ie,x2:tt,y2:ee,minX:Math.min(ze,tt),minY:Math.min(Ie,ee),maxX:Math.max(ze,tt),maxY:Math.max(Ie,ee)})}),be.sort(function(ze,Ie){return ze.maxX-Ie.maxX});for(var Ge=0;GeYe.minX&&Ie-eeYe.minY){var Re=M(ze,Ie,Ye.x1,Ye.y1,Ye.x2,Ye.y2);ReIe!=lt.y2>Ie&&ze<(lt.x2-lt.x1)*(Ie-lt.y1)/(lt.y2-lt.y1)+lt.x1;Ye&&(tt+=lt.y1p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function w(ee,lt){var Ye=36,Re=0,We=new Map,Q=lt&&new Map,B;return ee.split(",").forEach(function ce(Ue){if(Ue.indexOf("+")!==-1)for(var Ae=+Ue;Ae--;)ce(B);else{B=Ue;var Ee=Ue.split(">"),rt=Ee[0],st=Ee[1];rt=String.fromCodePoint(Re+=parseInt(rt,Ye)),st=String.fromCodePoint(Re+=parseInt(st,Ye)),We.set(rt,st),lt&&Q.set(st,rt)}}),{map:We,reverseMap:Q}}var S,M,A;function D(){if(!S){var ee=w(b.pairs,!0),lt=ee.map,Ye=ee.reverseMap;S=lt,M=Ye,A=w(b.canonical,!1).map}}function R(ee){return D(),S.get(ee)||null}function I(ee){return D(),M.get(ee)||null}function P(ee){return D(),A.get(ee)||null}var F=n.L,N=n.R,L=n.EN,G=n.ES,X=n.ET,W=n.AN,q=n.CS,K=n.B,ne=n.S,j=n.ON,$=n.BN,he=n.NSM,le=n.AL,ue=n.LRO,k=n.RLO,Z=n.LRE,oe=n.RLE,fe=n.PDF,ve=n.LRI,se=n.RLI,de=n.FSI,be=n.PDI;function Ge(ee,lt){for(var Ye=125,Re=new Uint32Array(ee.length),We=0;We0)ct--;else if(Gt>0){for(mt=0;!Pe[Pe.length-1]._isolate;)Pe.pop();var Ne=Pe[Pe.length-1]._isolInitIndex;Ne!=null&&(Ue.set(Ne,ye),Ue.set(ye,Ne)),Pe.pop(),Gt--}$e=Pe[Pe.length-1],ce[ye]=$e._level,$e._override&&B(ye,$e._override)}else we&fe?(ct===0&&(mt>0?mt--:!$e._isolate&&Pe.length>1&&(Pe.pop(),$e=Pe[Pe.length-1])),ce[ye]=$e._level):we&K&&(ce[ye]=Ee.level);else ce[ye]=$e._level,$e._override&&we!==$&&B(ye,$e._override)}for(var Ct=[],Bt=null,Ot=Ee.start;Ot<=Ee.end;Ot++){var Zt=Re[Ot];if(!(Zt&c)){var Bn=ce[Ot],Wn=Zt&s,Qn=Zt===be;Bt&&Bn===Bt._level?(Bt._end=Ot,Bt._endsWithIsolInit=Wn):Ct.push(Bt={_start:Ot,_end:Ot,_level:Bn,_startsWithPDI:Qn,_endsWithIsolInit:Wn})}}for(var Ui=[],yr=0;yr=0;je--)if(!(Re[je]&c)){Oe=ce[je];break}var qe=Jn[Jn.length-1],_t=ce[qe],vt=Ee.level;if(!(Re[qe]&s)){for(var wt=qe+1;wt<=Ee.end;wt++)if(!(Re[wt]&c)){vt=ce[wt];break}}Ui.push({_seqIndices:Jn,_sosType:Math.max(Oe,me)%2?N:F,_eosType:Math.max(vt,_t)%2?N:F})}}for(var Tt=0;Tt=0;dt--)if(!(Re[V[dt]]&c)){ht=Re[V[dt]];break}B(nt,ht&(s|be)?j:ht)}}if(Q.get(L))for(var gt=0;gt=-1;It--){var Kt=It===-1?pe:Re[V[It]];if(Kt&a){Kt===le&&B(Pt,W);break}}}if(Q.get(le))for(var St=0;St=0&&(tn=Re[V[yt]],!!(tn&c));yt--);for(var cn=pn+1;cn=0&&Re[V[ai]]&(X|c);ai--)B(V[ai],L);for(Rt++;Rt=0&&Re[V[Dn]]&c;Dn--)B(V[Dn],j);for(var hi=En+1;hi=0;Ws--){var ma=pa[Ws].char;if(ma===Ou||ma===I(P(vo))||R(P(ma))===vo){kl.push([pa[Ws].seqIndex,Yr]),pa.length=Ws;break}}}kl.sort(function(Fr,Xs){return Fr[0]-Xs[0]})}for(var Fu=0;Fu=0;ja--){var Bl=V[ja];if(Re[Bl]&eh){var Vl=Re[Bl]&Hs?N:F;Vl!==_e?cs=Vl:cs=_e;break}}}if(cs){if(Re[V[zl]]=Re[V[yo]]=cs,cs!==_e){for(var ga=zl+1;ga=0;Hl--)if(Re[V[Hl]]&c)Xa=Hl;else{_o=Re[V[Hl]]&Hs?N:F;break}for(var Wl=Me,bo=Ai+1;bo=0&&v(ee[Vu])&h;Vu--)ce[Vu]=Ee.level}}return{levels:ce,paragraphs:Ae};function Rc(Fr,Xs){for(var Zr=Fr;Zr=ce&&v(ee[Ee])&h;Ee--)Ae[Ee]=B.level;for(var rt=B.level,st=1/0,Et=0;Etrt&&(rt=Nt),Nt=st;Ve--)for(var Pe=0;Pe=Ve){for(var $e=Pe;Pe+1=Ve;)Pe++;Pe>$e&&Q.push([$e+ce,Pe+ce])}}}),Q}function Ie(ee,lt,Ye,Re){var We=tt(ee,lt,Ye,Re),Q=[].concat(ee);return We.forEach(function(B,ce){Q[ce]=(lt.levels[B]&1?Mt(ee[B]):null)||ee[B]}),Q.join("")}function tt(ee,lt,Ye,Re){for(var We=ze(ee,lt,Ye,Re),Q=[],B=0;B/gm;function t(n,r){let s=wn[r];return s?dE(s):n}return i.replace(e,t)}const _s=[];for(let i=0;i<256;i++)_s[i]=(i<16?"0":"")+i.toString(16);function GZ(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(_s[i&255]+_s[i>>8&255]+_s[i>>16&255]+_s[i>>24&255]+"-"+_s[e&255]+_s[e>>8&255]+"-"+_s[e>>16&15|64]+_s[e>>24&255]+"-"+_s[t&63|128]+_s[t>>8&255]+"-"+_s[t>>16&255]+_s[t>>24&255]+_s[n&255]+_s[n>>8&255]+_s[n>>16&255]+_s[n>>24&255]).toUpperCase()}const Jh=Object.assign||function(){let i=arguments[0];for(let e=1,t=arguments.length;ei.type,set:h=>{i.type=h}},isDerivedFrom:{writable:!0,configurable:!0,value:function(h){const p=this.baseMaterial;return h===p||p.isDerivedMaterial&&p.isDerivedFrom(h)||!1}},customProgramCacheKey:{writable:!0,configurable:!0,value:function(){return i.customProgramCacheKey()+"|"+t}},onBeforeCompile:{get(){return s},set(h){this[r]=h}},copy:{writable:!0,configurable:!0,value:function(h){return i.copy.call(this,h),!i.isShaderMaterial&&!i.isDerivedMaterial&&(Jh(this.extensions,h.extensions),Jh(this.defines,h.defines),Jh(this.uniforms,GA.clone(h.uniforms))),this}},clone:{writable:!0,configurable:!0,value:function(){const h=new i.constructor;return l(h).copy(this)}},getDepthMaterial:{writable:!0,configurable:!0,value:function(){let h=this._depthMaterial;return h||(h=this._depthMaterial=pE(i.isDerivedMaterial?i.getDepthMaterial():new yy({depthPacking:iO}),e),h.defines.IS_DEPTH_MATERIAL="",h.uniforms=this.uniforms),h}},getDistanceMaterial:{writable:!0,configurable:!0,value:function(){let h=this._distanceMaterial;return h||(h=this._distanceMaterial=pE(i.isDerivedMaterial?i.getDistanceMaterial():new ES,e),h.defines.IS_DISTANCE_MATERIAL="",h.uniforms=this.uniforms),h}},dispose:{writable:!0,configurable:!0,value(){const{_depthMaterial:h,_distanceMaterial:p}=this;h&&h.dispose(),p&&p.dispose(),i.dispose.call(this)}}};return n[t]=a,new a}function jZ(i,{vertexShader:e,fragmentShader:t},n,r){let{vertexDefs:s,vertexMainIntro:a,vertexMainOutro:l,vertexTransform:c,fragmentDefs:h,fragmentMainIntro:p,fragmentMainOutro:g,fragmentColorTransform:v,customRewriter:x,timeUniform:b}=n;if(s=s||"",a=a||"",l=l||"",h=h||"",p=p||"",g=g||"",(c||x)&&(e=dE(e)),(v||x)&&(t=t.replace(/^[ \t]*#include <((?:tonemapping|encodings|colorspace|fog|premultiplied_alpha|dithering)_fragment)>/gm,` //!BEGIN_POST_CHUNK $1 $& //!END_POST_CHUNK `),t=dE(t)),x){let w=x({vertexShader:e,fragmentShader:t});e=w.vertexShader,t=w.fragmentShader}if(v){let w=[];t=t.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,S=>(w.push(S),"")),g=`${v} ${w.join(` `)} ${g}`}if(b){const w=` uniform float ${b}; `;s=w+s,h=w+h}return c&&(e=`vec3 troika_position_${r}; vec3 troika_normal_${r}; vec2 troika_uv_${r}; ${e} `,s=`${s} void troikaVertexTransform${r}(inout vec3 position, inout vec3 normal, inout vec2 uv) { ${c} } `,a=` troika_position_${r} = vec3(position); troika_normal_${r} = vec3(normal); troika_uv_${r} = vec2(uv); troikaVertexTransform${r}(troika_position_${r}, troika_normal_${r}, troika_uv_${r}); ${a} `,e=e.replace(/\b(position|normal|uv)\b/g,(w,S,M,A)=>/\battribute\s+vec[23]\s+$/.test(A.substr(0,M))?S:`troika_${S}_${r}`),i.map&&i.map.channel>0||(e=e.replace(/\bMAP_UV\b/g,`troika_uv_${r}`))),e=dU(e,r,s,a,l),t=dU(t,r,h,p,g),{vertexShader:e,fragmentShader:t}}function dU(i,e,t,n,r){return(n||r||t)&&(i=i.replace(K4,` ${t} void troikaOrigMain${e}() {`),i+=` void main() { ${n} troikaOrigMain${e}(); ${r} }`),i}function XZ(i,e){return i==="uniforms"?void 0:typeof e=="function"?e.toString():e}let YZ=0;const pU=new Map;function qZ(i){const e=JSON.stringify(i,XZ);let t=pU.get(e);return t==null&&pU.set(e,t=++YZ),t}/*! Custom build of Typr.ts (https://github.com/fredli74/Typr.ts) for use in Troika text rendering. Original MIT license applies: https://github.com/fredli74/Typr.ts/blob/master/LICENSE */function ZZ(){return typeof window>"u"&&(self.window=self),(function(i){var e={parse:function(r){var s=e._bin,a=new Uint8Array(r);if(s.readASCII(a,0,4)=="ttcf"){var l=4;s.readUshort(a,l),l+=2,s.readUshort(a,l),l+=2;var c=s.readUint(a,l);l+=4;for(var h=[],p=0;p>>a&1)!=0&&s++;return s},e._lctf.readClassDef=function(r,s){var a=e._bin,l=[],c=a.readUshort(r,s);if(s+=2,c==1){var h=a.readUshort(r,s);s+=2;var p=a.readUshort(r,s);s+=2;for(var g=0;g0&&(c.featureParams=l+h);var p=a.readUshort(r,s);s+=2,c.tab=[];for(var g=0;g0&&(c.default=e._lctf.readLangSysTable(r,l+h));var p=a.readUshort(r,s);s+=2;for(var g=0;g255?-1:e.CFF.glyphByUnicode(r,e.CFF.tableSE[s])},e.CFF.readEncoding=function(r,s,a){e._bin;var l=[".notdef"],c=r[s];if(s++,c!=0)throw"error: unknown encoding format: "+c;var h=r[s];s++;for(var p=0;p>4,A=15&S;if(M!=15&&w.push(M),A!=15&&w.push(A),A==15)break}for(var D="",R=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],I=0;I=h.xMax||h.yMin>=h.yMax)return null;if(h.noc>0){h.endPts=[];for(var p=0;p=1&&p.fmt<=2){v=c.readUshort(r,a),a+=2;var x=c.readUshort(r,a);a+=2;var b=e._lctf.numOfOnes(v),w=e._lctf.numOfOnes(x);if(p.fmt==1){p.pairsets=[];var S=c.readUshort(r,a);a+=2;for(var M=0;M=1&&p.fmt<=2){if(p.fmt==1)p.delta=c.readShort(r,a),a+=2;else if(p.fmt==2){var v=c.readUshort(r,a);a+=2,p.newg=c.readUshorts(r,a,v),a+=2*p.newg.length}}else if(s==2&&p.fmt==1){v=c.readUshort(r,a),a+=2,p.seqs=[];for(var x=0;x>>8;if((b&=15)!=0)throw"unknown kern table format: "+b;s=e.kern.readFormat0(r,s,g)}return g},e.kern.parseV1=function(r,s,a,l){var c=e._bin;c.readFixed(r,s),s+=4;var h=c.readUint(r,s);s+=4;for(var p={glyph1:[],rval:[]},g=0;g>>8;if((x&=15)!=0)throw"unknown kern table format: "+x;s=e.kern.readFormat0(r,s,p)}return p},e.kern.readFormat0=function(r,s,a){var l=e._bin,c=-1,h=l.readUshort(r,s);s+=2,l.readUshort(r,s),s+=2,l.readUshort(r,s),s+=2,l.readUshort(r,s),s+=2;for(var p=0;p=c.map.length?0:c.map[s];if(c.format==4){for(var h=-1,p=0;ps?0:65535&(c.idRangeOffset[h]!=0?c.glyphIdArray[s-c.startCount[h]+(c.idRangeOffset[h]>>1)-(c.idRangeOffset.length-h)]:s+c.idDelta[h])}if(c.format==12){if(s>c.groups[c.groups.length-1][1])return 0;for(p=0;p-1?e.U._simpleGlyph(l,a):e.U._compoGlyph(l,s,a))},e.U._simpleGlyph=function(r,s){for(var a=0;ac)){for(var S=!0,M=0,A=0;Ac)){for(S=!0,A=0;A>1,h.length=0,g=!0;else if(W=="o3"||W=="o23")h.length%2!=0&&!g&&(v=h.shift()+l.nominalWidthX),p+=h.length>>1,h.length=0,g=!0;else if(W=="o4")h.length>1&&!g&&(v=h.shift()+l.nominalWidthX,g=!0),x&&e.U.P.closePath(c),S+=h.pop(),e.U.P.moveTo(c,w,S),x=!0;else if(W=="o5")for(;h.length>0;)w+=h.shift(),S+=h.shift(),e.U.P.lineTo(c,w,S);else if(W=="o6"||W=="o7")for(var q=h.length,K=W=="o6",ne=0;neMath.abs(N-S)?w=F+h.shift():S=N+h.shift(),e.U.P.curveTo(c,M,A,D,R,L,G),e.U.P.curveTo(c,I,P,F,N,w,S));else if(W=="o14"){if(h.length>0&&!g&&(v=h.shift()+a.nominalWidthX,g=!0),h.length==4){var he=h.shift(),le=h.shift(),ue=h.shift(),k=h.shift(),Z=e.CFF.glyphBySE(a,ue),oe=e.CFF.glyphBySE(a,k);e.U._drawCFF(a.CharStrings[Z],s,a,l,c),s.x=he,s.y=le,e.U._drawCFF(a.CharStrings[oe],s,a,l,c)}x&&(e.U.P.closePath(c),x=!1)}else if(W=="o19"||W=="o20")h.length%2!=0&&!g&&(v=h.shift()+l.nominalWidthX),p+=h.length>>1,h.length=0,g=!0,b+=p+7>>3;else if(W=="o21")h.length>2&&!g&&(v=h.shift()+l.nominalWidthX,g=!0),S+=h.pop(),w+=h.pop(),x&&e.U.P.closePath(c),e.U.P.moveTo(c,w,S),x=!0;else if(W=="o22")h.length>1&&!g&&(v=h.shift()+l.nominalWidthX,g=!0),w+=h.pop(),x&&e.U.P.closePath(c),e.U.P.moveTo(c,w,S),x=!0;else if(W=="o25"){for(;h.length>6;)w+=h.shift(),S+=h.shift(),e.U.P.lineTo(c,w,S);M=w+h.shift(),A=S+h.shift(),D=M+h.shift(),R=A+h.shift(),w=D+h.shift(),S=R+h.shift(),e.U.P.curveTo(c,M,A,D,R,w,S)}else if(W=="o26")for(h.length%2&&(w+=h.shift());h.length>0;)M=w,A=S+h.shift(),w=D=M+h.shift(),S=(R=A+h.shift())+h.shift(),e.U.P.curveTo(c,M,A,D,R,w,S);else if(W=="o27")for(h.length%2&&(S+=h.shift());h.length>0;)A=S,D=(M=w+h.shift())+h.shift(),R=A+h.shift(),w=D+h.shift(),S=R,e.U.P.curveTo(c,M,A,D,R,w,S);else if(W=="o10"||W=="o29"){var fe=W=="o10"?l:a;if(h.length==0)console.debug("error: empty stack");else{var ve=h.pop(),se=fe.Subrs[ve+fe.Bias];s.x=w,s.y=S,s.nStems=p,s.haveWidth=g,s.width=v,s.open=x,e.U._drawCFF(se,s,a,l,c),w=s.x,S=s.y,p=s.nStems,g=s.haveWidth,v=s.width,x=s.open}}else if(W=="o30"||W=="o31"){var de=h.length,be=($=0,W=="o31");for($+=de-(q=-3&de);$>>1|(21845&x)<<1;b=(61680&(b=(52428&b)>>>2|(13107&b)<<2))>>>4|(3855&b)<<4,v[x]=((65280&b)>>>8|(255&b)<<8)>>>1}var w=function(W,q,K){for(var ne=W.length,j=0,$=new t(q);j>>ue]=k}return he},S=new e(288);for(x=0;x<144;++x)S[x]=8;for(x=144;x<256;++x)S[x]=9;for(x=256;x<280;++x)S[x]=7;for(x=280;x<288;++x)S[x]=8;var M=new e(32);for(x=0;x<32;++x)M[x]=5;var A=w(S,9),D=w(M,5),R=function(W){for(var q=W[0],K=1;Kq&&(q=W[K]);return q},I=function(W,q,K){var ne=q/8|0;return(W[ne]|W[ne+1]<<8)>>(7&q)&K},P=function(W,q){var K=q/8|0;return(W[K]|W[K+1]<<8|W[K+2]<<16)>>(7&q)},F=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],N=function(W,q,K){var ne=new Error(q||F[W]);if(ne.code=W,Error.captureStackTrace&&Error.captureStackTrace(ne,N),!K)throw ne;return ne},L=function(W,q,K){var ne=W.length;if(!ne||K&&!K.l&&ne<5)return q||new e(0);var j=!q||K,$=!K||K.i;K||(K={}),q||(q=new e(3*ne));var he,le=function($e){var ct=q.length;if($e>ct){var mt=new e(Math.max(2*ct,$e));mt.set(q),q=mt}},ue=K.f||0,k=K.p||0,Z=K.b||0,oe=K.l,fe=K.d,ve=K.m,se=K.n,de=8*ne;do{if(!oe){K.f=ue=I(W,k,1);var be=I(W,k+1,3);if(k+=3,!be){var Ge=W[(Ye=((he=k)/8|0)+(7&he&&1)+4)-4]|W[Ye-3]<<8,ot=Ye+Ge;if(ot>ne){$&&N(0);break}j&&le(Z+Ge),q.set(W.subarray(Ye,ot),Z),K.b=Z+=Ge,K.p=k=8*ot;continue}if(be==1)oe=A,fe=D,ve=9,se=5;else if(be==2){var Qe=I(W,k,31)+257,Je=I(W,k+10,15)+4,Mt=Qe+I(W,k+5,31)+1;k+=14;for(var Le=new e(Mt),ze=new e(19),Ie=0;Ie>>4)<16)Le[Ie++]=Ye;else{var We=0,Q=0;for(Ye==16?(Q=3+I(W,k,3),k+=2,We=Le[Ie-1]):Ye==17?(Q=3+I(W,k,7),k+=3):Ye==18&&(Q=11+I(W,k,127),k+=7);Q--;)Le[Ie++]=We}}var B=Le.subarray(0,Qe),ce=Le.subarray(Qe);ve=R(B),se=R(ce),oe=w(B,ve),fe=w(ce,se)}else N(1);if(k>de){$&&N(0);break}}j&&le(Z+131072);for(var Ue=(1<>>4;if((k+=15&We)>de){$&&N(0);break}if(We||N(2),rt<256)q[Z++]=rt;else{if(rt==256){Ee=k,oe=null;break}var st=rt-254;if(rt>264){var Et=r[Ie=rt-257];st=I(W,k,(1<>>4;if(Nt||N(3),k+=15&Nt,ce=g[Ve],Ve>3&&(Et=s[Ve],ce+=P(W,k)&(1<de){$&&N(0);break}j&&le(Z+131072);for(var Pe=Z+st;Z$e.length)&&(mt=$e.length);var Gt=new($e instanceof t?t:$e instanceof n?n:e)(mt-ct);return Gt.set($e.subarray(ct,mt)),Gt})(q,0,Z)},G=new e(0),X=typeof TextDecoder<"u"&&new TextDecoder;try{X.decode(G,{stream:!0})}catch{}return i.convert_streams=function(W){var q=new DataView(W),K=0;function ne(){var Qe=q.getUint16(K);return K+=2,Qe}function j(){var Qe=q.getUint32(K);return K+=4,Qe}function $(Qe){Ge.setUint16(ot,Qe),ot+=2}function he(Qe){Ge.setUint32(ot,Qe),ot+=4}for(var le={signature:j(),flavor:j(),length:j(),numTables:ne(),reserved:ne(),totalSfntSize:j(),majorVersion:ne(),minorVersion:ne(),metaOffset:j(),metaLength:j(),metaOrigLength:j(),privOffset:j(),privLength:j()},ue=0;Math.pow(2,ue)<=le.numTables;)ue++;ue--;for(var k=16*Math.pow(2,ue),Z=16*le.numTables-k,oe=12,fe=[],ve=0;ve{let[W,q]=X.split("+");W=parseInt(W,36),q=q?parseInt(q,36):0,p.set(G+=W,N[L]);for(let K=q;K--;)p.set(++G,N[L])})}}return p.get(F)||h}const v=1,x=2,b=3,w=4,S=[null,"isol","init","fina","medi"];function M(F){const N=new Uint8Array(F.length);let L=h,G=v,X=-1;for(let W=0;W65535&&W++)}return N}function A(F,N){const L=[];for(let X=0;X65535&&X++,L.push(i.U.codeToGlyph(F,W))}const G=F.GSUB;if(G){const{lookupList:X,featureList:W}=G;let q;const K=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws|ccmp)$/,ne=[];W.forEach(j=>{if(K.test(j.tag))for(let $=0;$=0;ne--)if(N[ne]!==-1&&(!K||K(N[ne])))return ne;return-1}function W(K){return R(F,K)===1}function q(K,ne){for(let j=0;j<3;j++)L[ne*3+j]+=K[j]||0}}function R(F,N){const L=F.GDEF&&F.GDEF.glyphClassDef;return L?i.U._getGlyphClass(N,L):0}function I(...F){for(let N=0;N0},forEachGlyph(K,ne,j,$){let he=0;const le=1/q.unitsPerEm*ne,ue=A(F,K);let k=0;const Z=D(F,ue);return ue.forEach((oe,fe)=>{if(oe!==-1){let ve=N[oe];if(!ve){const{cmds:se,crds:de}=i.U.glyphToPath(F,oe);let be="",Ge=0;for(let Le=0,ze=se.length;Le1?",":"")+de[Ge++]}let ot,Qe,Je,Mt;if(de.length){ot=Qe=1/0,Je=Mt=-1/0;for(let Le=0,ze=de.length;LeJe&&(Je=Ie),tt>Mt&&(Mt=tt)}}else ot=Je=Qe=Mt=0;ve=N[oe]={index:oe,advanceWidth:F.hmtx.aWidth[oe],xMin:ot,yMin:Qe,xMax:Je,yMax:Mt,path:be}}$.call(null,ve,he+Z[fe*3]*le,Z[fe*3+1]*le,k),he+=Z[fe*3+2]*le,j&&(he+=j*ne)}k+=K.codePointAt(k)>65535?2:1}),he}};return q}return function(N){const L=new Uint8Array(N,0,4),G=i._bin.readASCII(L,0,4);if(G==="wOFF")N=e(N);else if(G==="wOF2")throw new Error("woff2 fonts not supported");return P(i.parse(N)[0])}}const JZ=rg({name:"Typr Font Parser",dependencies:[ZZ,KZ,QZ],init(i,e,t){const n=i(),r=e();return t(n,r)}});/*! Custom bundle of @unicode-font-resolver/client v1.0.2 (https://github.com/lojjic/unicode-font-resolver) for use in Troika text rendering. Original MIT license applies */function $Z(){return(function(i){var e=function(){this.buckets=new Map};e.prototype.add=function(D){var R=D>>5;this.buckets.set(R,(this.buckets.get(R)||0)|1<<(31&D))},e.prototype.has=function(D){var R=this.buckets.get(D>>5);return R!==void 0&&(R&1<<(31&D))!=0},e.prototype.serialize=function(){var D=[];return this.buckets.forEach((function(R,I){D.push((+I).toString(36)+":"+R.toString(36))})),D.join(",")},e.prototype.deserialize=function(D){var R=this;this.buckets.clear(),D.split(",").forEach((function(I){var P=I.split(":");R.buckets.set(parseInt(P[0],36),parseInt(P[1],36))}))};var t=Math.pow(2,8),n=t-1,r=~n;function s(D){var R=(function(P){return P&r})(D).toString(16),I=(function(P){return(P&r)+t-1})(D).toString(16);return"codepoint-index/plane"+(D>>16)+"/"+R+"-"+I+".json"}function a(D,R){var I=D&n,P=R.codePointAt(I/6|0);return((P=(P||48)-48)&1<65535&&(k++,ue=k)},ue=0;ue65535&&(oe++,Z=oe)},Z=0;Z65535&&(oe++,W[oe]=W[oe-1])}return{fontUrls:Array.from(X.keys()),chars:W}}))},Object.defineProperty(i,"__esModule",{value:!0}),i})({})}function eK(i,e){const t=Object.create(null),n=Object.create(null);function r(a,l){const c=h=>{console.error(`Failure loading font ${a}`,h)};try{const h=new XMLHttpRequest;h.open("get",a,!0),h.responseType="arraybuffer",h.onload=function(){if(h.status>=400)c(new Error(h.statusText));else if(h.status>0)try{const p=i(h.response);p.src=a,l(p)}catch(p){c(p)}},h.onerror=c,h.send()}catch(h){c(h)}}function s(a,l){let c=t[a];c?l(c):n[a]?n[a].push(l):(n[a]=[l],r(a,h=>{h.src=a,t[a]=h,n[a].forEach(p=>p(h)),delete n[a]}))}return function(a,l,{lang:c,fonts:h=[],style:p="normal",weight:g="normal",unicodeFontsURL:v}={}){const x=new Uint8Array(a.length),b=[];a.length||A();const w=new Map,S=[];if(p!=="italic"&&(p="normal"),typeof g!="number"&&(g=g==="bold"?700:400),h&&!Array.isArray(h)&&(h=[h]),h=h.slice().filter(R=>!R.lang||R.lang.test(c)).reverse(),h.length){let F=0;(function N(L=0){for(let G=L,X=a.length;G0&&/\s/.test(a[G]))x[G]=x[G-1],F===2&&(S[S.length-1][1]=G);else for(let q=x[G],K=h.length;q<=K;q++)if(q===K){const ne=F===2?S[S.length-1]:S[S.length]=[G,G];ne[1]=G,F=2}else{x[G]=q;const{src:ne,unicodeRange:j}=h[q];if(!j||D(W,j)){const $=t[ne];if(!$){s(ne,()=>{N(G)});return}if($.supportsCodePoint(W)){let he=w.get($);typeof he!="number"&&(he=b.length,b.push($),w.set($,he)),x[G]=he,F=1;break}}}W>65535&&G+1a.substring(I[0],I[1]+1)).join(` `);e.getFontsForString(R,{lang:c||void 0,style:p,weight:g,dataUrl:v}).then(({fontUrls:I,chars:P})=>{const F=b.length;let N=0;S.forEach(G=>{for(let X=0,W=G[1]-G[0];X<=W;X++)x[G[0]+X]=P[N++]+F;N++});let L=0;I.forEach((G,X)=>{s(G,W=>{b[X+F]=W,++L===I.length&&A()})})})}else A()}function A(){l({chars:x,fonts:b})}function D(R,I){for(let P=0;P{let L,G;const X=[];for(let W=0;W-1&&(console.info("Typesetter: got text with \\r chars; normalizing to \\n"),b=b.replace(/\r\n/g,` `).replace(/\r/g,` `)),A=+A,I=+I,F=+F,P=P||"normal",G=+G,a({text:b,lang:S,style:R,weight:D,fonts:typeof w=="string"?[{src:w}]:w,unicodeFontsURL:j,preResolvedFonts:$},fe=>{oe.fontLoad=g()-Z;const ve=isFinite(F);let se=null,de=null,be=null,Ge=null,ot=null,Qe=null,Je=null,Mt=null,Le=0,ze=0,Ie=X!=="nowrap";const tt=new Map,ee=g();let lt=G,Ye=0,Re=new v;const We=[Re];fe.forEach(Ae=>{const{fontObj:Ee}=Ae,{ascender:rt,descender:st,unitsPerEm:Et,lineGap:Nt,capHeight:Ve,xHeight:Pe}=Ee;let $e=tt.get(Ee);if(!$e){const we=A/Et,it=P==="normal"?(rt-st+Nt)*we:P*A,Lt=(it-(rt-st)*we)/2,et=Math.min(it,(rt-st)*we),Ne=(rt+st)/2*we+et/2;$e={index:tt.size,src:Ee.src,fontObj:Ee,fontSizeMult:we,unitsPerEm:Et,ascender:rt*we,descender:st*we,capHeight:Ve*we,xHeight:Pe*we,lineHeight:it,baseline:-Lt-rt*we,caretTop:Ne,caretBottom:Ne-et},tt.set(Ee,$e)}const{fontSizeMult:ct}=$e,mt=b.slice(Ae.start,Ae.end+1);let Gt,ye;Ee.forEachGlyph(mt,A,I,(we,it,Lt,et)=>{it+=Ye,et+=Ae.start,Gt=it,ye=we;const Ne=b.charAt(et),Ct=we.advanceWidth*ct,Bt=Re.count;let Ot;if("isEmpty"in we||(we.isWhitespace=!!Ne&&new RegExp(r).test(Ne),we.canBreakAfter=!!Ne&&s.test(Ne),we.isEmpty=we.xMin===we.xMax||we.yMin===we.yMax||n.test(Ne)),!we.isWhitespace&&!we.isEmpty&&ze++,Ie&&ve&&!we.isWhitespace&&it+Ct+lt>F&&Bt){if(Re.glyphAt(Bt-1).glyphObj.canBreakAfter)Ot=new v,lt=-it;else for(let Bn=Bt;Bn--;)if(Bn===0&&W==="break-word"){Ot=new v,lt=-it;break}else if(Re.glyphAt(Bn).glyphObj.canBreakAfter){Ot=Re.splitAt(Bn+1);const Wn=Ot.glyphAt(0).x;lt-=Wn;for(let Qn=Ot.count;Qn--;)Ot.glyphAt(Qn).x-=Wn;break}Ot&&(Re.isSoftWrapped=!0,Re=Ot,We.push(Re),Le=F)}let Zt=Re.glyphAt(Re.count);Zt.glyphObj=we,Zt.x=it+lt,Zt.y=Lt,Zt.width=Ct,Zt.charIndex=et,Zt.fontData=$e,Ne===` `&&(Re=new v,We.push(Re),lt=-(it+Ct+I*A)+G)}),Ye=Gt+ye.advanceWidth*ct+I*A});let Q=0;We.forEach(Ae=>{let Ee=!0;for(let rt=Ae.count;rt--;){const st=Ae.glyphAt(rt);Ee&&!st.glyphObj.isWhitespace&&(Ae.width=st.x+st.width,Ae.width>Le&&(Le=Ae.width),Ee=!1);let{lineHeight:Et,capHeight:Nt,xHeight:Ve,baseline:Pe}=st.fontData;Et>Ae.lineHeight&&(Ae.lineHeight=Et);const $e=Pe-Ae.baseline;$e<0&&(Ae.baseline+=$e,Ae.cap+=$e,Ae.ex+=$e),Ae.cap=Math.max(Ae.cap,Ae.baseline+Nt),Ae.ex=Math.max(Ae.ex,Ae.baseline+Ve)}Ae.baseline-=Q,Ae.cap-=Q,Ae.ex-=Q,Q+=Ae.lineHeight});let B=0,ce=0;if(q&&(typeof q=="number"?B=-q:typeof q=="string"&&(B=-Le*(q==="left"?0:q==="center"?.5:q==="right"?1:h(q)))),K&&(typeof K=="number"?ce=-K:typeof K=="string"&&(ce=K==="top"?0:K==="top-baseline"?-We[0].baseline:K==="top-cap"?-We[0].cap:K==="top-ex"?-We[0].ex:K==="middle"?Q/2:K==="bottom"?Q:K==="bottom-baseline"?-We[We.length-1].baseline:h(K)*Q)),!ne){const Ae=e.getEmbeddingLevels(b,N);se=new Uint16Array(ze),de=new Uint8Array(ze),be=new Float32Array(ze*2),Ge={},Je=[1/0,1/0,-1/0,-1/0],Mt=[],he&&(Qe=new Float32Array(b.length*4)),ue&&(ot=new Uint8Array(ze*3));let Ee=0,rt=-1,st=-1,Et,Nt;if(We.forEach((Ve,Pe)=>{let{count:$e,width:ct}=Ve;if($e>0){let mt=0;for(let et=$e;et--&&Ve.glyphAt(et).glyphObj.isWhitespace;)mt++;let Gt=0,ye=0;if(L==="center")Gt=(Le-ct)/2;else if(L==="right")Gt=Le-ct;else if(L==="justify"&&Ve.isSoftWrapped){let et=0;for(let Ne=$e-mt;Ne--;)Ve.glyphAt(Ne).glyphObj.isWhitespace&&et++;ye=(Le-ct)/et}if(ye||Gt){let et=0;for(let Ne=0;Ne<$e;Ne++){let Ct=Ve.glyphAt(Ne);const Bt=Ct.glyphObj;Ct.x+=Gt+et,ye!==0&&Bt.isWhitespace&&Ne<$e-mt&&(et+=ye,Ct.width+=ye)}}const we=e.getReorderSegments(b,Ae,Ve.glyphAt(0).charIndex,Ve.glyphAt(Ve.count-1).charIndex);for(let et=0;et=Ne){let Bn=Zt,Wn=Zt;for(;Wn<$e;Wn++){let Qn=Ve.glyphAt(Wn);if(Qn.charIndex>Ct)break;Wn<$e-mt&&(Bt=Math.min(Bt,Qn.x),Ot=Math.max(Ot,Qn.x+Qn.width))}for(let Qn=Bn;Qnit=et;for(let et=0;et<$e;et++){const Ne=Ve.glyphAt(et);it=Ne.glyphObj;const Ct=it.index,Bt=Ae.levels[Ne.charIndex]&1;if(Bt){const Ot=e.getMirroredCharacter(b[Ne.charIndex]);Ot&&Ne.fontData.fontObj.forEachGlyph(Ot,0,0,Lt)}if(he){const{charIndex:Ot,fontData:Zt}=Ne,Bn=Ne.x+B,Wn=Ne.x+Ne.width+B;Qe[Ot*4]=Bt?Wn:Bn,Qe[Ot*4+1]=Bt?Bn:Wn,Qe[Ot*4+2]=Ve.baseline+Zt.caretBottom+ce,Qe[Ot*4+3]=Ve.baseline+Zt.caretTop+ce;const Qn=Ot-rt;Qn>1&&p(Qe,rt,Qn),rt=Ot}if(ue){const{charIndex:Ot}=Ne;for(;Ot>st;)st++,ue.hasOwnProperty(st)&&(Nt=ue[st])}if(!it.isWhitespace&&!it.isEmpty){const Ot=Ee++,{fontSizeMult:Zt,src:Bn,index:Wn}=Ne.fontData,Qn=Ge[Bn]||(Ge[Bn]={});Qn[Ct]||(Qn[Ct]={path:it.path,pathBounds:[it.xMin,it.yMin,it.xMax,it.yMax]});const Ui=Ne.x+B,yr=Ne.y+Ve.baseline+ce;be[Ot*2]=Ui,be[Ot*2+1]=yr;const Zi=Ui+it.xMin*Zt,Ti=yr+it.yMin*Zt,pi=Ui+it.xMax*Zt,Jt=yr+it.yMax*Zt;ZiJe[2]&&(Je[2]=pi),Jt>Je[3]&&(Je[3]=Jt),Ot%le===0&&(Et={start:Ot,end:Ot,rect:[1/0,1/0,-1/0,-1/0]},Mt.push(Et)),Et.end++;const Jn=Et.rect;if(ZiJn[2]&&(Jn[2]=pi),Jt>Jn[3]&&(Jn[3]=Jt),se[Ot]=Ct,de[Ot]=Wn,ue){const jn=Ot*3;ot[jn]=Nt>>16&255,ot[jn+1]=Nt>>8&255,ot[jn+2]=Nt&255}}}}}),Qe){const Ve=b.length-rt;Ve>1&&p(Qe,rt,Ve)}}const Ue=[];tt.forEach(({index:Ae,src:Ee,unitsPerEm:rt,ascender:st,descender:Et,lineHeight:Nt,capHeight:Ve,xHeight:Pe})=>{Ue[Ae]={src:Ee,unitsPerEm:rt,ascender:st,descender:Et,lineHeight:Nt,capHeight:Ve,xHeight:Pe}}),oe.typesetting=g()-ee,k({glyphIds:se,glyphFontIndices:de,glyphPositions:be,glyphData:Ge,fontData:Ue,caretPositions:Qe,glyphColors:ot,chunkedBounds:Mt,fontSize:A,topBaseline:ce+We[0].baseline,blockBounds:[B,ce-Q,B+Le,ce],visibleBounds:Je,timings:oe})})}function c(b,w){l({...b,metricsOnly:!0},S=>{const[M,A,D,R]=S.blockBounds;w({width:D-M,height:R-A})})}function h(b){let w=b.match(/^([\d.]+)%$/),S=w?parseFloat(w[1]):NaN;return isNaN(S)?0:S/100}function p(b,w,S){const M=b[w*4],A=b[w*4+1],D=b[w*4+2],R=b[w*4+3],I=(A-M)/S;for(let P=0;P(Object.defineProperty(b,w,{get(){return this.data[this.index*x.length+S]},set(A){this.data[this.index*x.length+S]=A}}),b),{data:null,index:0}),{typeset:l,measure:c}}const Td=()=>(self.performance||Date).now(),IS=Z4();let mU;function iK(i,e,t,n,r,s,a,l,c,h,p=!0){return p?sK(i,e,t,n,r,s,a,l,c,h).then(null,g=>(mU||(console.warn("WebGL SDF generation failed, falling back to JS",g),mU=!0),vU(i,e,t,n,r,s,a,l,c,h))):vU(i,e,t,n,r,s,a,l,c,h)}const S1=[],rK=5;let mE=0;function Q4(){const i=Td();for(;S1.length&&Td()-inew Promise((e,t)=>{S1.push(()=>{const n=Td();try{IS.webgl.generateIntoCanvas(...i),e({timing:Td()-n})}catch(r){t(r)}}),mE||(mE=setTimeout(Q4,0))}),aK=4,oK=2e3,gU={};let lK=0;function vU(i,e,t,n,r,s,a,l,c,h){const p="TroikaTextSDFGenerator_JS_"+lK++%aK;let g=gU[p];return g||(g=gU[p]={workerModule:rg({name:p,workerId:p,dependencies:[Z4,Td],init(v,x){const b=v().javascript.generate;return function(...w){const S=x();return{textureData:b(...w),timing:x()-S}}},getTransferables(v){return[v.textureData.buffer]}}),requests:0,idleTimer:null}),g.requests++,clearTimeout(g.idleTimer),g.workerModule(i,e,t,n,r,s).then(({textureData:v,timing:x})=>{const b=Td(),w=new Uint8Array(v.length*4);for(let S=0;S{zZ(p)},oK)),{timing:x}})}function uK(i){i._warm||(IS.webgl.isSupported(i),i._warm=!0)}const cK=IS.webglUtils.resizeWebGLCanvasWithoutClearing,$0={unicodeFontsURL:null,sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048},fK=new zt;function fm(){return(self.performance||Date).now()}const yU=Object.create(null);function J4(i,e){i=pK({},i);const t=fm(),n=[];if(i.font&&n.push({label:"user",src:mK(i.font)}),i.font=n,i.text=""+i.text,i.sdfGlyphSize=i.sdfGlyphSize||$0.sdfGlyphSize,i.unicodeFontsURL=i.unicodeFontsURL||$0.unicodeFontsURL,i.colorRanges!=null){let v={};for(let x in i.colorRanges)if(i.colorRanges.hasOwnProperty(x)){let b=i.colorRanges[x];typeof b!="number"&&(b=fK.set(b).getHex()),v[x]=b}i.colorRanges=v}Object.freeze(i);const{textureWidth:r,sdfExponent:s}=$0,{sdfGlyphSize:a}=i,l=r/a*4;let c=yU[a];if(!c){const v=document.createElement("canvas");v.width=r,v.height=a*256/l,c=yU[a]={glyphCount:0,sdfGlyphSize:a,sdfCanvas:v,sdfTexture:new di(v,void 0,void 0,void 0,In,In),contextLost:!1,glyphsByFont:new Map},c.sdfTexture.generateMipmaps=!1,hK(c)}const{sdfTexture:h,sdfCanvas:p}=c;tF(i).then(v=>{const{glyphIds:x,glyphFontIndices:b,fontData:w,glyphPositions:S,fontSize:M,timings:A}=v,D=[],R=new Float32Array(x.length*4);let I=0,P=0;const F=fm(),N=w.map(q=>{let K=c.glyphsByFont.get(q.src);return K||c.glyphsByFont.set(q.src,K=new Map),K});x.forEach((q,K)=>{const ne=b[K],{src:j,unitsPerEm:$}=w[ne];let he=N[ne].get(q);if(!he){const{path:oe,pathBounds:fe}=v.glyphData[j][q],ve=Math.max(fe[2]-fe[0],fe[3]-fe[1])/a*($0.sdfMargin*a+.5),se=c.glyphCount++,de=[fe[0]-ve,fe[1]-ve,fe[2]+ve,fe[3]+ve];N[ne].set(q,he={path:oe,atlasIndex:se,sdfViewBox:de}),D.push(he)}const{sdfViewBox:le}=he,ue=S[P++],k=S[P++],Z=M/$;R[I++]=ue+le[0]*Z,R[I++]=k+le[1]*Z,R[I++]=ue+le[2]*Z,R[I++]=k+le[3]*Z,x[K]=he.atlasIndex}),A.quads=(A.quads||0)+(fm()-F);const L=fm();A.sdf={};const G=p.height,X=Math.ceil(c.glyphCount/l),W=Math.pow(2,Math.ceil(Math.log2(X*a)));W>G&&(console.info(`Increasing SDF texture size ${G}->${W}`),cK(p,r,W),h.dispose()),Promise.all(D.map(q=>$4(q,c,i.gpuAccelerateSDF).then(({timing:K})=>{A.sdf[q.atlasIndex]=K}))).then(()=>{D.length&&!c.contextLost&&(eF(c),h.needsUpdate=!0),A.sdfTotal=fm()-L,A.total=fm()-t,e(Object.freeze({parameters:i,sdfTexture:h,sdfGlyphSize:a,sdfExponent:s,glyphBounds:R,glyphAtlasIndices:x,glyphColors:v.glyphColors,caretPositions:v.caretPositions,chunkedBounds:v.chunkedBounds,ascender:v.ascender,descender:v.descender,lineHeight:v.lineHeight,capHeight:v.capHeight,xHeight:v.xHeight,topBaseline:v.topBaseline,blockBounds:v.blockBounds,visibleBounds:v.visibleBounds,timings:v.timings}))})}),Promise.resolve().then(()=>{c.contextLost||uK(p)})}function $4({path:i,atlasIndex:e,sdfViewBox:t},{sdfGlyphSize:n,sdfCanvas:r,contextLost:s},a){if(s)return Promise.resolve({timing:-1});const{textureWidth:l,sdfExponent:c}=$0,h=Math.max(t[2]-t[0],t[3]-t[1]),p=Math.floor(e/4),g=p%(l/n)*n,v=Math.floor(p/(l/n))*n,x=e%4;return iK(n,n,i,t,h,c,r,g,v,x,a)}function hK(i){const e=i.sdfCanvas;e.addEventListener("webglcontextlost",t=>{console.log("Context Lost",t),t.preventDefault(),i.contextLost=!0}),e.addEventListener("webglcontextrestored",t=>{console.log("Context Restored",t),i.contextLost=!1;const n=[];i.glyphsByFont.forEach(r=>{r.forEach(s=>{n.push($4(s,i,!0))})}),Promise.all(n).then(()=>{eF(i),i.sdfTexture.needsUpdate=!0})})}function dK({font:i,characters:e,sdfGlyphSize:t},n){let r=Array.isArray(e)?e.join(` `):""+e;J4({font:i,sdfGlyphSize:t,text:r},n)}function pK(i,e){for(let t in e)e.hasOwnProperty(t)&&(i[t]=e[t]);return i}let i1;function mK(i){return i1||(i1=typeof document>"u"?{}:document.createElement("a")),i1.href=i,i1.href}function eF(i){if(typeof createImageBitmap!="function"){console.info("Safari<15: applying SDF canvas workaround");const{sdfCanvas:e,sdfTexture:t}=i,{width:n,height:r}=e,s=i.sdfCanvas.getContext("webgl");let a=t.image.data;(!a||a.length!==n*r*4)&&(a=new Uint8Array(n*r*4),t.image={width:n,height:r,data:a},t.flipY=!1,t.isDataTexture=!0),s.readPixels(0,0,n,r,s.RGBA,s.UNSIGNED_BYTE,a)}}const gK=rg({name:"Typesetter",dependencies:[nK,tK,VZ],init(i,e,t){return i(e,t())}}),tF=rg({name:"Typesetter",dependencies:[gK],init(i){return function(e){return new Promise(t=>{i.typeset(e,t)})}},getTransferables(i){const e=[];for(let t in i)i[t]&&i[t].buffer&&e.push(i[t].buffer);return e}});tF.onMainThread;const xU={};function vK(i){let e=xU[i];return e||(e=xU[i]=new tl(1,1,i,i).translate(.5,.5,0)),e}const yK="aTroikaGlyphBounds",_U="aTroikaGlyphIndex",xK="aTroikaGlyphColor";class _K extends JA{constructor(){super(),this.detail=1,this.curveRadius=0,this.groups=[{start:0,count:1/0,materialIndex:0},{start:0,count:1/0,materialIndex:1}],this.boundingSphere=new as,this.boundingBox=new ss}computeBoundingSphere(){}computeBoundingBox(){}set detail(e){if(e!==this._detail){this._detail=e,(typeof e!="number"||e<1)&&(e=1);let t=vK(e);["position","normal","uv"].forEach(n=>{this.attributes[n]=t.attributes[n].clone()}),this.setIndex(t.getIndex().clone())}}get detail(){return this._detail}set curveRadius(e){e!==this._curveRadius&&(this._curveRadius=e,this._updateBounds())}get curveRadius(){return this._curveRadius}updateGlyphs(e,t,n,r,s){this.updateAttributeData(yK,e,4),this.updateAttributeData(_U,t,1),this.updateAttributeData(xK,s,3),this._blockBounds=n,this._chunkedBounds=r,this.instanceCount=t.length,this._updateBounds()}_updateBounds(){const e=this._blockBounds;if(e){const{curveRadius:t,boundingBox:n}=this;if(t){const{PI:r,floor:s,min:a,max:l,sin:c,cos:h}=Math,p=r/2,g=r*2,v=Math.abs(t),x=e[0]/v,b=e[2]/v,w=s((x+p)/g)!==s((b+p)/g)?-v:a(c(x)*v,c(b)*v),S=s((x-p)/g)!==s((b-p)/g)?v:l(c(x)*v,c(b)*v),M=s((x+r)/g)!==s((b+r)/g)?v*2:l(v-h(x)*v,v-h(b)*v);n.min.set(w,e[1],t<0?-M:0),n.max.set(S,e[3],t<0?0:M)}else n.min.set(e[0],e[1],0),n.max.set(e[2],e[3],0);n.getBoundingSphere(this.boundingSphere)}}applyClipRect(e){let t=this.getAttribute(_U).count,n=this._chunkedBounds;if(n)for(let r=n.length;r--;){t=n[r].end;let s=n[r].rect;if(s[1]e.y&&s[0]e.x)break}this.instanceCount=t}updateAttributeData(e,t,n){const r=this.getAttribute(e);t?r&&r.array.length===t.length?(r.array.set(t),r.needsUpdate=!0):(this.setAttribute(e,new Dd(t,n)),delete this._maxInstanceCount,this.dispose()):r&&this.deleteAttribute(e)}}const bK=` uniform vec2 uTroikaSDFTextureSize; uniform float uTroikaSDFGlyphSize; uniform vec4 uTroikaTotalBounds; uniform vec4 uTroikaClipRect; uniform mat3 uTroikaOrient; uniform bool uTroikaUseGlyphColors; uniform float uTroikaEdgeOffset; uniform float uTroikaBlurRadius; uniform vec2 uTroikaPositionOffset; uniform float uTroikaCurveRadius; attribute vec4 aTroikaGlyphBounds; attribute float aTroikaGlyphIndex; attribute vec3 aTroikaGlyphColor; varying vec2 vTroikaGlyphUV; varying vec4 vTroikaTextureUVBounds; varying float vTroikaTextureChannel; varying vec3 vTroikaGlyphColor; varying vec2 vTroikaGlyphDimensions; `,SK=` vec4 bounds = aTroikaGlyphBounds; bounds.xz += uTroikaPositionOffset.x; bounds.yw -= uTroikaPositionOffset.y; vec4 outlineBounds = vec4( bounds.xy - uTroikaEdgeOffset - uTroikaBlurRadius, bounds.zw + uTroikaEdgeOffset + uTroikaBlurRadius ); vec4 clippedBounds = vec4( clamp(outlineBounds.xy, uTroikaClipRect.xy, uTroikaClipRect.zw), clamp(outlineBounds.zw, uTroikaClipRect.xy, uTroikaClipRect.zw) ); vec2 clippedXY = (mix(clippedBounds.xy, clippedBounds.zw, position.xy) - bounds.xy) / (bounds.zw - bounds.xy); position.xy = mix(bounds.xy, bounds.zw, clippedXY); uv = (position.xy - uTroikaTotalBounds.xy) / (uTroikaTotalBounds.zw - uTroikaTotalBounds.xy); float rad = uTroikaCurveRadius; if (rad != 0.0) { float angle = position.x / rad; position.xz = vec2(sin(angle) * rad, rad - cos(angle) * rad); normal.xz = vec2(sin(angle), cos(angle)); } position = uTroikaOrient * position; normal = uTroikaOrient * normal; vTroikaGlyphUV = clippedXY.xy; vTroikaGlyphDimensions = vec2(bounds[2] - bounds[0], bounds[3] - bounds[1]); float txCols = uTroikaSDFTextureSize.x / uTroikaSDFGlyphSize; vec2 txUvPerSquare = uTroikaSDFGlyphSize / uTroikaSDFTextureSize; vec2 txStartUV = txUvPerSquare * vec2( mod(floor(aTroikaGlyphIndex / 4.0), txCols), floor(floor(aTroikaGlyphIndex / 4.0) / txCols) ); vTroikaTextureUVBounds = vec4(txStartUV, vec2(txStartUV) + txUvPerSquare); vTroikaTextureChannel = mod(aTroikaGlyphIndex, 4.0); `,MK=` uniform sampler2D uTroikaSDFTexture; uniform vec2 uTroikaSDFTextureSize; uniform float uTroikaSDFGlyphSize; uniform float uTroikaSDFExponent; uniform float uTroikaEdgeOffset; uniform float uTroikaFillOpacity; uniform float uTroikaBlurRadius; uniform vec3 uTroikaStrokeColor; uniform float uTroikaStrokeWidth; uniform float uTroikaStrokeOpacity; uniform bool uTroikaSDFDebug; varying vec2 vTroikaGlyphUV; varying vec4 vTroikaTextureUVBounds; varying float vTroikaTextureChannel; varying vec2 vTroikaGlyphDimensions; float troikaSdfValueToSignedDistance(float alpha) { // Inverse of exponential encoding in webgl-sdf-generator float maxDimension = max(vTroikaGlyphDimensions.x, vTroikaGlyphDimensions.y); float absDist = (1.0 - pow(2.0 * (alpha > 0.5 ? 1.0 - alpha : alpha), 1.0 / uTroikaSDFExponent)) * maxDimension; float signedDist = absDist * (alpha > 0.5 ? -1.0 : 1.0); return signedDist; } float troikaGlyphUvToSdfValue(vec2 glyphUV) { vec2 textureUV = mix(vTroikaTextureUVBounds.xy, vTroikaTextureUVBounds.zw, glyphUV); vec4 rgba = texture2D(uTroikaSDFTexture, textureUV); float ch = floor(vTroikaTextureChannel + 0.5); //NOTE: can't use round() in WebGL1 return ch == 0.0 ? rgba.r : ch == 1.0 ? rgba.g : ch == 2.0 ? rgba.b : rgba.a; } float troikaGlyphUvToDistance(vec2 uv) { return troikaSdfValueToSignedDistance(troikaGlyphUvToSdfValue(uv)); } float troikaGetAADist() { #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300 return length(fwidth(vTroikaGlyphUV * vTroikaGlyphDimensions)) * 0.5; #else return vTroikaGlyphDimensions.x / 64.0; #endif } float troikaGetFragDistValue() { vec2 clampedGlyphUV = clamp(vTroikaGlyphUV, 0.5 / uTroikaSDFGlyphSize, 1.0 - 0.5 / uTroikaSDFGlyphSize); float distance = troikaGlyphUvToDistance(clampedGlyphUV); // Extrapolate distance when outside bounds: distance += clampedGlyphUV == vTroikaGlyphUV ? 0.0 : length((vTroikaGlyphUV - clampedGlyphUV) * vTroikaGlyphDimensions); return distance; } float troikaGetEdgeAlpha(float distance, float distanceOffset, float aaDist) { #if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL) float alpha = step(-distanceOffset, -distance); #else float alpha = smoothstep( distanceOffset + aaDist, distanceOffset - aaDist, distance ); #endif return alpha; } `,wK=` float aaDist = troikaGetAADist(); float fragDistance = troikaGetFragDistValue(); float edgeAlpha = uTroikaSDFDebug ? troikaGlyphUvToSdfValue(vTroikaGlyphUV) : troikaGetEdgeAlpha(fragDistance, uTroikaEdgeOffset, max(aaDist, uTroikaBlurRadius)); #if !defined(IS_DEPTH_MATERIAL) && !defined(IS_DISTANCE_MATERIAL) vec4 fillRGBA = gl_FragColor; fillRGBA.a *= uTroikaFillOpacity; vec4 strokeRGBA = uTroikaStrokeWidth == 0.0 ? fillRGBA : vec4(uTroikaStrokeColor, uTroikaStrokeOpacity); if (fillRGBA.a == 0.0) fillRGBA.rgb = strokeRGBA.rgb; gl_FragColor = mix(fillRGBA, strokeRGBA, smoothstep( -uTroikaStrokeWidth - aaDist, -uTroikaStrokeWidth + aaDist, fragDistance )); gl_FragColor.a *= edgeAlpha; #endif if (edgeAlpha == 0.0) { discard; } `;function TK(i){const e=pE(i,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new pt},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new fi(0,0,0,0)},uTroikaClipRect:{value:new fi(0,0,0,0)},uTroikaEdgeOffset:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new pt},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new zt},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new yn},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:bK,vertexTransform:SK,fragmentDefs:MK,fragmentColorTransform:wK,customRewriter({vertexShader:t,fragmentShader:n}){let r=/\buniform\s+vec3\s+diffuse\b/;return r.test(n)&&(n=n.replace(r,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),r.test(t)||(t=t.replace(K4,`uniform vec3 diffuse; $& vTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse; `))),{vertexShader:t,fragmentShader:n}}});return e.transparent=!0,e.forceSinglePass=!0,Object.defineProperties(e,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),e}const dC=new Ol({color:16777215,side:io,transparent:!0}),bU=8421504,SU=new un,r1=new re,Kw=new re,G0=[],EK=new re,Qw="+x+y";function MU(i){return Array.isArray(i)?i[0]:i}let nF=()=>{const i=new wi(new tl(1,1),dC);return nF=()=>i,i},iF=()=>{const i=new wi(new tl(1,1,32,1),dC);return iF=()=>i,i};const AK={type:"syncstart"},CK={type:"synccomplete"},rF=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],RK=rF.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let sF=class extends wi{constructor(){const e=new _K;super(e,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.unicodeFontsURL=null,this.fontSize=.1,this.fontWeight="normal",this.fontStyle="normal",this.lang=null,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=bU,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=Qw,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(e){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(e):(this._isSyncing=!0,this.dispatchEvent(AK),J4({text:this.text,font:this.font,lang:this.lang,fontSize:this.fontSize||.1,fontWeight:this.fontWeight||"normal",fontStyle:this.fontStyle||"normal",letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF,unicodeFontsURL:this.unicodeFontsURL},t=>{this._isSyncing=!1,this._textRenderInfo=t,this.geometry.updateGlyphs(t.glyphBounds,t.glyphAtlasIndices,t.blockBounds,t.chunkedBounds,t.glyphColors);const n=this._queuedSyncs;n&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{n.forEach(r=>r&&r())})),this.dispatchEvent(CK),e&&e()})))}onBeforeRender(e,t,n,r,s,a){this.sync(),s.isTroikaTextMaterial&&this._prepareForRender(s)}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}createDerivedMaterial(e){return TK(e)}get material(){let e=this._derivedMaterial;const t=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=dC.clone());if((!e||!e.isDerivedFrom(t))&&(e=this._derivedMaterial=this.createDerivedMaterial(t),t.addEventListener("dispose",function n(){t.removeEventListener("dispose",n),e.dispose()})),this.hasOutline()){let n=e._outlineMtl;return n||(n=e._outlineMtl=Object.create(e,{id:{value:e.id+.1}}),n.isTextOutlineMaterial=!0,n.depthWrite=!1,n.map=null,e.addEventListener("dispose",function r(){e.removeEventListener("dispose",r),n.dispose()})),[n,e]}else return e}set material(e){e&&e.isTroikaTextMaterial?(this._derivedMaterial=e,this._baseMaterial=e.baseMaterial):this._baseMaterial=e}hasOutline(){return!!(this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY)}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(e){this.geometry.detail=e}get curveRadius(){return this.geometry.curveRadius}set curveRadius(e){this.geometry.curveRadius=e}get customDepthMaterial(){return MU(this.material).getDepthMaterial()}set customDepthMaterial(e){}get customDistanceMaterial(){return MU(this.material).getDistanceMaterial()}set customDistanceMaterial(e){}_prepareForRender(e){const t=e.isTextOutlineMaterial,n=e.uniforms,r=this.textRenderInfo;if(r){const{sdfTexture:l,blockBounds:c}=r;n.uTroikaSDFTexture.value=l,n.uTroikaSDFTextureSize.value.set(l.image.width,l.image.height),n.uTroikaSDFGlyphSize.value=r.sdfGlyphSize,n.uTroikaSDFExponent.value=r.sdfExponent,n.uTroikaTotalBounds.value.fromArray(c),n.uTroikaUseGlyphColors.value=!t&&!!r.glyphColors;let h=0,p=0,g=0,v,x,b,w=0,S=0;if(t){let{outlineWidth:A,outlineOffsetX:D,outlineOffsetY:R,outlineBlur:I,outlineOpacity:P}=this;h=this._parsePercent(A)||0,p=Math.max(0,this._parsePercent(I)||0),v=P,w=this._parsePercent(D)||0,S=this._parsePercent(R)||0}else g=Math.max(0,this._parsePercent(this.strokeWidth)||0),g&&(b=this.strokeColor,n.uTroikaStrokeColor.value.set(b??bU),x=this.strokeOpacity,x==null&&(x=1)),v=this.fillOpacity;n.uTroikaEdgeOffset.value=h,n.uTroikaPositionOffset.value.set(w,S),n.uTroikaBlurRadius.value=p,n.uTroikaStrokeWidth.value=g,n.uTroikaStrokeOpacity.value=x,n.uTroikaFillOpacity.value=v??1,n.uTroikaCurveRadius.value=this.curveRadius||0;let M=this.clipRect;if(M&&Array.isArray(M)&&M.length===4)n.uTroikaClipRect.value.fromArray(M);else{const A=(this.fontSize||.1)*100;n.uTroikaClipRect.value.set(c[0]-A,c[1]-A,c[2]+A,c[3]+A)}this.geometry.applyClipRect(n.uTroikaClipRect.value)}n.uTroikaSDFDebug.value=!!this.debugSDF,e.polygonOffset=!!this.depthOffset,e.polygonOffsetFactor=e.polygonOffsetUnits=this.depthOffset||0;const s=t?this.outlineColor||0:this.color;if(s==null)delete e.color;else{const l=e.hasOwnProperty("color")?e.color:e.color=new zt;(s!==l._input||typeof s=="object")&&l.set(l._input=s)}let a=this.orientation||Qw;if(a!==e._orientation){let l=n.uTroikaOrient.value;a=a.replace(/[^-+xyz]/g,"");let c=a!==Qw&&a.match(/^([-+])([xyz])([-+])([xyz])$/);if(c){let[,h,p,g,v]=c;r1.set(0,0,0)[p]=h==="-"?1:-1,Kw.set(0,0,0)[v]=g==="-"?-1:1,SU.lookAt(EK,r1.cross(Kw),Kw),l.setFromMatrix4(SU)}else l.identity();e._orientation=a}}_parsePercent(e){if(typeof e=="string"){let t=e.match(/^(-?[\d.]+)%$/),n=t?parseFloat(t[1]):NaN;e=(isNaN(n)?0:n/100)*this.fontSize}return e}localPositionToTextCoords(e,t=new pt){t.copy(e);const n=this.curveRadius;return n&&(t.x=Math.atan2(e.x,Math.abs(n)-Math.abs(e.z))*Math.abs(n)),t}worldPositionToTextCoords(e,t=new pt){return r1.copy(e),this.localPositionToTextCoords(this.worldToLocal(r1),t)}raycast(e,t){const{textRenderInfo:n,curveRadius:r}=this;if(n){const s=n.blockBounds,a=r?iF():nF(),l=a.geometry,{position:c,uv:h}=l.attributes;for(let p=0;p{this[n]=e[n]}),this}clone(){return new this.constructor().copy(this)}};rF.forEach(i=>{const e="_private_"+i;Object.defineProperty(sF.prototype,i,{get(){return this[e]},set(t){t!==this[e]&&(this[e]=t,this._needsSync=!0)}})});new ss;new zt;const DK=ae.forwardRef(({sdfGlyphSize:i=64,anchorX:e="center",anchorY:t="middle",font:n,fontSize:r=1,children:s,characters:a,onSync:l,...c},h)=>{const p=Bs(({invalidate:b})=>b),[g]=ae.useState(()=>new sF),[v,x]=ae.useMemo(()=>{const b=[];let w="";return ae.Children.forEach(s,S=>{typeof S=="string"||typeof S=="number"?w+=S:b.push(S)}),[b,w]},[s]);return M4(()=>new Promise(b=>dK({font:n,characters:a},b)),["troika-text",n,a]),ae.useLayoutEffect(()=>void g.sync(()=>{p(),l&&l(g)})),ae.useEffect(()=>()=>g.dispose(),[g]),ae.createElement("primitive",go({object:g,ref:h,font:n,text:x,anchorX:e,anchorY:t,fontSize:r,sdfGlyphSize:i},c),v)}),NK=()=>parseInt(Zm.replace(/\D+/g,"")),pC=NK();function UK(i,e,t){const n=Bs(x=>x.size),r=Bs(x=>x.viewport),s=typeof i=="number"?i:n.width*r.dpr,a=n.height*r.dpr,l=(typeof i=="number"?t:i)||{},{samples:c=0,depth:h,...p}=l,g=h??l.depthBuffer,v=ae.useMemo(()=>{const x=new rs(s,a,{minFilter:In,magFilter:In,type:ar,...p});return g&&(x.depthTexture=new Nd(s,a,Gi)),x.samples=c,x},[]);return ae.useLayoutEffect(()=>{v.setSize(s,a),c&&(v.samples=c)},[c,v,s,a]),ae.useEffect(()=>()=>v.dispose(),[]),v}const LK=i=>typeof i=="function",mC=ae.forwardRef(({envMap:i,resolution:e=256,frames:t=1/0,makeDefault:n,children:r,...s},a)=>{const l=Bs(({set:S})=>S),c=Bs(({camera:S})=>S),h=Bs(({size:S})=>S),p=ae.useRef(null);ae.useImperativeHandle(a,()=>p.current,[]);const g=ae.useRef(null),v=UK(e);ae.useLayoutEffect(()=>{s.manual||(p.current.aspect=h.width/h.height)},[h,s]),ae.useLayoutEffect(()=>{p.current.updateProjectionMatrix()});let x=0,b=null;const w=LK(r);return Gs(S=>{w&&(t===1/0||x{if(n){const S=c;return l(()=>({camera:p.current})),()=>l(()=>({camera:S}))}},[p,n,l]),ae.createElement(ae.Fragment,null,ae.createElement("perspectiveCamera",go({ref:p},s),!w&&r),ae.createElement("group",{ref:g},w&&r(v.texture)))});var IK=`#define GLSLIFY 1 vec3 mod289(vec3 x){return x-floor(x*(1.0/289.0))*289.0;}vec4 mod289(vec4 x){return x-floor(x*(1.0/289.0))*289.0;}vec4 permute(vec4 x){return mod289(((x*34.0)+1.0)*x);}vec4 taylorInvSqrt(vec4 r){return 1.79284291400159-0.85373472095314*r;}float snoise(vec3 v){const vec2 C=vec2(1.0/6.0,1.0/3.0);const vec4 D=vec4(0.0,0.5,1.0,2.0);vec3 i=floor(v+dot(v,C.yyy));vec3 x0=v-i+dot(i,C.xxx);vec3 g=step(x0.yzx,x0.xyz);vec3 l=1.0-g;vec3 i1=min(g.xyz,l.zxy);vec3 i2=max(g.xyz,l.zxy);vec3 x1=x0-i1+C.xxx;vec3 x2=x0-i2+C.yyy;vec3 x3=x0-D.yyy;i=mod289(i);vec4 p=permute(permute(permute(i.z+vec4(0.0,i1.z,i2.z,1.0))+i.y+vec4(0.0,i1.y,i2.y,1.0))+i.x+vec4(0.0,i1.x,i2.x,1.0));float n_=0.142857142857;vec3 ns=n_*D.wyz-D.xzx;vec4 j=p-49.0*floor(p*ns.z*ns.z);vec4 x_=floor(j*ns.z);vec4 y_=floor(j-7.0*x_);vec4 x=x_*ns.x+ns.yyyy;vec4 y=y_*ns.x+ns.yyyy;vec4 h=1.0-abs(x)-abs(y);vec4 b0=vec4(x.xy,y.xy);vec4 b1=vec4(x.zw,y.zw);vec4 s0=floor(b0)*2.0+1.0;vec4 s1=floor(b1)*2.0+1.0;vec4 sh=-step(h,vec4(0.0));vec4 a0=b0.xzyw+s0.xzyw*sh.xxyy;vec4 a1=b1.xzyw+s1.xzyw*sh.zzww;vec3 p0=vec3(a0.xy,h.x);vec3 p1=vec3(a0.zw,h.y);vec3 p2=vec3(a1.xy,h.z);vec3 p3=vec3(a1.zw,h.w);vec4 norm=taylorInvSqrt(vec4(dot(p0,p0),dot(p1,p1),dot(p2,p2),dot(p3,p3)));p0*=norm.x;p1*=norm.y;p2*=norm.z;p3*=norm.w;vec4 m=max(0.6-vec4(dot(x0,x0),dot(x1,x1),dot(x2,x2),dot(x3,x3)),0.0);m=m*m;return 42.0*dot(m*m,vec4(dot(p0,x0),dot(p1,x1),dot(p2,x2),dot(p3,x3)));}`;class PK extends jA{constructor(e={}){super(e),this.setValues(e),this._time={value:0},this._distort={value:.4},this._radius={value:1}}onBeforeCompile(e){e.uniforms.time=this._time,e.uniforms.radius=this._radius,e.uniforms.distort=this._distort,e.vertexShader=` uniform float time; uniform float radius; uniform float distort; ${IK} ${e.vertexShader} `,e.vertexShader=e.vertexShader.replace("#include ",` float updateTime = time / 50.0; float noise = snoise(vec3(position / 2.0 + updateTime * 5.0)); vec3 transformed = vec3(position * (noise * pow(distort, 2.0) + radius)); `)}get time(){return this._time.value}set time(e){this._time.value=e}get distort(){return this._distort.value}set distort(e){this._distort.value=e}get radius(){return this._radius.value}set radius(e){this._radius.value=e}}const gC=ae.forwardRef(({speed:i=1,...e},t)=>{const[n]=ae.useState(()=>new PK);return Gs(r=>n&&(n.time=r.clock.elapsedTime*i)),ae.createElement("primitive",go({object:n,ref:t,attach:"material"},e))}),Jw=pC>=154?"opaque_fragment":"output_fragment";class OK extends dS{constructor(e){super(e),this.onBeforeCompile=(t,n)=>{const{isWebGL2:r}=n.capabilities;t.fragmentShader=t.fragmentShader.replace(`#include <${Jw}>`,` ${r?`#include <${Jw}>`:`#extension GL_OES_standard_derivatives : enable #include <${Jw}>`} vec2 cxy = 2.0 * gl_PointCoord - 1.0; float r = dot(cxy, cxy); float delta = fwidth(r); float mask = 1.0 - smoothstep(1.0 - delta, 1.0 + delta, r); gl_FragColor = vec4(gl_FragColor.rgb, mask * gl_FragColor.a ); #include #include <${pC>=154?"colorspace_fragment":"encodings_fragment"}> `)}}}const FK=ae.forwardRef((i,e)=>{const[t]=ae.useState(()=>new OK(null));return ae.createElement("primitive",go({},i,{object:t,ref:e,attach:"material"}))}),vC=ae.forwardRef(({children:i,enabled:e=!0,speed:t=1,rotationIntensity:n=1,floatIntensity:r=1,floatingRange:s=[-.1,.1],autoInvalidate:a=!1,...l},c)=>{const h=ae.useRef(null);ae.useImperativeHandle(c,()=>h.current,[]);const p=ae.useRef(Math.random()*1e4);return Gs(g=>{var v,x;if(!e||t===0)return;a&&g.invalidate();const b=p.current+g.clock.elapsedTime;h.current.rotation.x=Math.cos(b/4*t)/8*n,h.current.rotation.y=Math.sin(b/4*t)/8*n,h.current.rotation.z=Math.sin(b/4*t)/20*n;let w=Math.sin(b/4*t)/10;w=Bm.mapLinear(w,-.1,.1,(v=s==null?void 0:s[0])!==null&&v!==void 0?v:-.1,(x=s==null?void 0:s[1])!==null&&x!==void 0?x:.1),h.current.position.y=w*r,h.current.updateMatrix()}),ae.createElement("group",l,ae.createElement("group",{ref:h,matrixAutoUpdate:!1},i))}),aF=(i,e,t)=>{let n;switch(i){case is:n=new Uint8ClampedArray(e*t*4);break;case ar:n=new Uint16Array(e*t*4);break;case po:n=new Uint32Array(e*t*4);break;case Qb:n=new Int8Array(e*t*4);break;case Jb:n=new Int16Array(e*t*4);break;case uy:n=new Int32Array(e*t*4);break;case Gi:n=new Float32Array(e*t*4);break;default:throw new Error("Unsupported data type")}return n};let s1;const kK=(i,e,t,n)=>{if(s1!==void 0)return s1;const r=new rs(1,1,n);e.setRenderTarget(r);const s=new wi(new tl,new Ol({color:16777215}));e.render(s,t),e.setRenderTarget(null);const a=aF(i,r.width,r.height);return e.readRenderTargetPixels(r,0,0,r.width,r.height,a),r.dispose(),s.geometry.dispose(),s.material.dispose(),s1=a[0]!==0,s1};class yC{constructor(e){kt(this,"_renderer");kt(this,"_rendererIsDisposable",!1);kt(this,"_material");kt(this,"_scene");kt(this,"_camera");kt(this,"_quad");kt(this,"_renderTarget");kt(this,"_width");kt(this,"_height");kt(this,"_type");kt(this,"_colorSpace");kt(this,"_supportsReadPixels",!0);kt(this,"render",()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)});var n,r,s,a,l,c,h,p,g,v,x,b,w,S,M,A;this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const t={format:Ar,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:((n=e.renderTargetOptions)==null?void 0:n.anisotropy)!==void 0?(r=e.renderTargetOptions)==null?void 0:r.anisotropy:1,generateMipmaps:((s=e.renderTargetOptions)==null?void 0:s.generateMipmaps)!==void 0?(a=e.renderTargetOptions)==null?void 0:a.generateMipmaps:!1,magFilter:((l=e.renderTargetOptions)==null?void 0:l.magFilter)!==void 0?(c=e.renderTargetOptions)==null?void 0:c.magFilter:In,minFilter:((h=e.renderTargetOptions)==null?void 0:h.minFilter)!==void 0?(p=e.renderTargetOptions)==null?void 0:p.minFilter:In,samples:((g=e.renderTargetOptions)==null?void 0:g.samples)!==void 0?(v=e.renderTargetOptions)==null?void 0:v.samples:void 0,wrapS:((x=e.renderTargetOptions)==null?void 0:x.wrapS)!==void 0?(b=e.renderTargetOptions)==null?void 0:b.wrapS:vr,wrapT:((w=e.renderTargetOptions)==null?void 0:w.wrapT)!==void 0?(S=e.renderTargetOptions)==null?void 0:S.wrapT:vr};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=yC.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new hy,this._camera=new kd,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!kK(this._type,this._renderer,this._camera,t)){let D;switch(this._type){case ar:D=this._renderer.extensions.has("EXT_color_buffer_float")?Gi:void 0;break}D!==void 0?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${Gi}`),this._type=D):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new wi(new tl,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new rs(this.width,this.height,t),this._renderTarget.texture.mapping=((M=e.renderTargetOptions)==null?void 0:M.mapping)!==void 0?(A=e.renderTargetOptions)==null?void 0:A.mapping:Wf}static instantiateRenderer(){const e=new sC;return e.setSize(128,128),e}toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=aF(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){const t=new $o(this.toArray(),this.width,this.height,Ar,this._type,(e==null?void 0:e.mapping)||Wf,(e==null?void 0:e.wrapS)||vr,(e==null?void 0:e.wrapT)||vr,(e==null?void 0:e.magFilter)||In,(e==null?void 0:e.minFilter)||In,(e==null?void 0:e.anisotropy)||1,Pl);return t.generateMipmaps=(e==null?void 0:e.generateMipmaps)!==void 0?e==null?void 0:e.generateMipmaps:!1,t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof ls&&Object.values(this.material.uniforms).forEach(t=>{t.value instanceof di&&t.value.dispose()}),Object.values(this.material).forEach(t=>{t instanceof di&&t.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}class oF extends Error{}class lF extends Error{}const H0=(i,e,t)=>{const n=new RegExp(`${e}="([^"]*)"`,"i").exec(i);if(n)return n[1];const r=new RegExp(`<${e}[^>]*>([\\s\\S]*?)`,"i").exec(i);if(r){const s=r[1].match(/([^<]*)<\/rdf:li>/g);return s&&s.length===3?s.map(a=>a.replace(/<\/?rdf:li>/g,"")):r[1].trim()}if(t!==void 0)return t;throw new Error(`Can't find ${e} in gainmap metadata`)},zK=i=>{let e;typeof TextDecoder<"u"?e=new TextDecoder().decode(i):e=i.toString();let t=e.indexOf("",t),r=e.slice(t,n+10);try{const s=H0(r,"hdrgm:GainMapMin","0"),a=H0(r,"hdrgm:GainMapMax"),l=H0(r,"hdrgm:Gamma","1"),c=H0(r,"hdrgm:OffsetSDR","0.015625"),h=H0(r,"hdrgm:OffsetHDR","0.015625"),p=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(r),g=p?p[1]:"0",v=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(r);if(!v)throw new Error("Incomplete gainmap metadata");const x=v[1];return{gainMapMin:Array.isArray(s)?s.map(b=>parseFloat(b)):[parseFloat(s),parseFloat(s),parseFloat(s)],gainMapMax:Array.isArray(a)?a.map(b=>parseFloat(b)):[parseFloat(a),parseFloat(a),parseFloat(a)],gamma:Array.isArray(l)?l.map(b=>parseFloat(b)):[parseFloat(l),parseFloat(l),parseFloat(l)],offsetSdr:Array.isArray(c)?c.map(b=>parseFloat(b)):[parseFloat(c),parseFloat(c),parseFloat(c)],offsetHdr:Array.isArray(h)?h.map(b=>parseFloat(b)):[parseFloat(h),parseFloat(h),parseFloat(h)],hdrCapacityMin:parseFloat(g),hdrCapacityMax:parseFloat(x)}}catch{}t=e.indexOf("{const r=this.options.debug,s=new DataView(e.buffer);if(s.getUint16(0)!==65496){n(new Error("Not a valid jpeg"));return}const a=s.byteLength;let l=2,c=0,h;for(;l250){n(new Error(`Found no marker after ${c} loops 😵`));return}if(s.getUint8(l)!==255){n(new Error(`Not a valid marker at offset 0x${l.toString(16)}, found: 0x${s.getUint8(l).toString(16)}`));return}if(h=s.getUint8(l+1),r&&console.log(`Marker: ${h.toString(16)}`),h===226){r&&console.log("Found APP2 marker (0xffe2)");const p=l+4;if(s.getUint32(p)===1297106432){const g=p+4;let v;if(s.getUint16(g)===18761)v=!1;else if(s.getUint16(g)===19789)v=!0;else{n(new Error("No valid endianness marker found in TIFF header"));return}if(s.getUint16(g+2,!v)!==42){n(new Error("Not valid TIFF data! (no 0x002A marker)"));return}const x=s.getUint32(g+4,!v);if(x<8){n(new Error("Not valid TIFF data! (First offset less than 8)"));return}const b=g+x,w=s.getUint16(b,!v),S=b+2;let M=0;for(let I=S;I{const e=zK(i);if(!e)throw new lF("Gain map XMP metadata not found");const n=await new BK({extractFII:!0,extractNonFII:!0}).extract(i);if(n.length!==2)throw new oF("Gain map recovery image not found");return{sdr:new Uint8Array(await n[0].arrayBuffer()),gainMap:new Uint8Array(await n[1].arrayBuffer()),metadata:e}},wU=i=>new Promise((e,t)=>{const n=document.createElement("img");n.onload=()=>{e(n)},n.onerror=r=>{t(r)},n.src=URL.createObjectURL(i)});class GK extends da{constructor(t,n){super(n);kt(this,"_renderer");kt(this,"_renderTargetOptions");kt(this,"_internalLoadingManager");kt(this,"_config");this._config=t,t.renderer&&(this._renderer=t.renderer),this._internalLoadingManager=new AS}setRenderer(t){return this._renderer=t,this}setRenderTargetOptions(t){return this._renderTargetOptions=t,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: A Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");const t=this._config.createMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new di,sdr:new di});return this._config.createQuadRenderer({width:16,height:16,type:ar,colorSpace:Pl,material:t,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async processImages(t,n,r){const s=n?new Blob([n],{type:"image/jpeg"}):void 0,a=new Blob([t],{type:"image/jpeg"});let l,c,h=!1;if(typeof createImageBitmap>"u"){const p=await Promise.all([s?wU(s):Promise.resolve(void 0),wU(a)]);c=p[0],l=p[1],h=r==="flipY"}else{const p=await Promise.all([s?createImageBitmap(s,{imageOrientation:r||"flipY"}):Promise.resolve(void 0),createImageBitmap(a,{imageOrientation:r||"flipY"})]);c=p[0],l=p[1]}return{sdrImage:l,gainMapImage:c,needsFlip:h}}createTextures(t,n,r){const s=new di(n||new ImageData(2,2),Wf,vr,vr,In,WT,Ar,is,1,Pl);s.flipY=r,s.needsUpdate=!0;const a=new di(t,Wf,vr,vr,In,WT,Ar,is,1,bs);return a.flipY=r,a.needsUpdate=!0,{gainMap:s,sdr:a}}updateQuadRenderer(t,n,r,s,a){t.width=n.width,t.height=n.height,t.material.gainMap=r,t.material.sdr=s,t.material.gainMapMin=a.gainMapMin,t.material.gainMapMax=a.gainMapMax,t.material.offsetHdr=a.offsetHdr,t.material.offsetSdr=a.offsetSdr,t.material.gamma=a.gamma,t.material.hdrCapacityMin=a.hdrCapacityMin,t.material.hdrCapacityMax=a.hdrCapacityMax,t.material.maxDisplayBoost=Math.pow(2,a.hdrCapacityMax),t.material.needsUpdate=!0}}const HK=` varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); } `,WK=` // min half float value #define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 ) // max half float value #define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 ) uniform sampler2D sdr; uniform sampler2D gainMap; uniform vec3 gamma; uniform vec3 offsetHdr; uniform vec3 offsetSdr; uniform vec3 gainMapMin; uniform vec3 gainMapMax; uniform float weightFactor; varying vec2 vUv; void main() { vec3 rgb = texture2D( sdr, vUv ).rgb; vec3 recovery = texture2D( gainMap, vUv ).rgb; vec3 logRecovery = pow( recovery, gamma ); vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery; vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr; vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor )); gl_FragColor = vec4( clampedHdrColor , 1.0 ); } `;class jK extends ls{constructor({gamma:t,offsetHdr:n,offsetSdr:r,gainMapMin:s,gainMapMax:a,maxDisplayBoost:l,hdrCapacityMin:c,hdrCapacityMax:h,sdr:p,gainMap:g}){super({name:"GainMapDecoderMaterial",vertexShader:HK,fragmentShader:WK,uniforms:{sdr:{value:p},gainMap:{value:g},gamma:{value:new re(1/t[0],1/t[1],1/t[2])},offsetHdr:{value:new re().fromArray(n)},offsetSdr:{value:new re().fromArray(r)},gainMapMin:{value:new re().fromArray(s)},gainMapMax:{value:new re().fromArray(a)},weightFactor:{value:(Math.log2(l)-c)/(h-c)}},blending:Nl,depthTest:!1,depthWrite:!1});kt(this,"_maxDisplayBoost");kt(this,"_hdrCapacityMin");kt(this,"_hdrCapacityMax");this._maxDisplayBoost=l,this._hdrCapacityMin=c,this._hdrCapacityMax=h,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(t){this.uniforms.sdr.value=t}get gainMap(){return this.uniforms.gainMap.value}set gainMap(t){this.uniforms.gainMap.value=t}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(t){this.uniforms.offsetHdr.value.fromArray(t)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(t){this.uniforms.offsetSdr.value.fromArray(t)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(t){this.uniforms.gainMapMin.value.fromArray(t)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(t){this.uniforms.gainMapMax.value.fromArray(t)}get gamma(){const t=this.uniforms.gamma.value;return[1/t.x,1/t.y,1/t.z]}set gamma(t){const n=this.uniforms.gamma.value;n.x=1/t[0],n.y=1/t[1],n.z=1/t[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(t){this._hdrCapacityMin=t,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(t){this._hdrCapacityMax=t,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(t){this._maxDisplayBoost=Math.max(1,Math.min(65504,t)),this.calculateWeight()}calculateWeight(){const t=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,t))}}class uF extends GK{constructor(e,t){super({renderer:e,createMaterial:n=>new jK(n),createQuadRenderer:n=>new yC(n)},t)}async render(e,t,n,r){const{sdrImage:s,gainMapImage:a,needsFlip:l}=await this.processImages(n,r,"flipY"),{gainMap:c,sdr:h}=this.createTextures(s,a,l);this.updateQuadRenderer(e,s,c,h,t),e.render()}}class XK extends uF{load([e,t,n],r,s,a){const l=this.prepareQuadRenderer();let c,h,p;const g=async()=>{if(c&&h&&p){try{await this.render(l,p,c,h)}catch(L){this.manager.itemError(e),this.manager.itemError(t),this.manager.itemError(n),typeof a=="function"&&a(L),l.disposeOnDemandRenderer();return}typeof r=="function"&&r(l),this.manager.itemEnd(e),this.manager.itemEnd(t),this.manager.itemEnd(n),l.disposeOnDemandRenderer()}};let v=!0,x=0,b=0,w=!0,S=0,M=0,A=!0,D=0,R=0;const I=()=>{if(typeof s=="function"){const L=x+S+D,G=b+M+R,X=v&&w&&A;s(new ProgressEvent("progress",{lengthComputable:X,loaded:G,total:L}))}};this.manager.itemStart(e),this.manager.itemStart(t),this.manager.itemStart(n);const P=new co(this._internalLoadingManager);P.setResponseType("arraybuffer"),P.setRequestHeader(this.requestHeader),P.setPath(this.path),P.setWithCredentials(this.withCredentials),P.load(e,async L=>{if(typeof L=="string")throw new Error("Invalid sdr buffer");c=L,await g()},L=>{v=L.lengthComputable,b=L.loaded,x=L.total,I()},L=>{this.manager.itemError(e),typeof a=="function"&&a(L)});const F=new co(this._internalLoadingManager);F.setResponseType("arraybuffer"),F.setRequestHeader(this.requestHeader),F.setPath(this.path),F.setWithCredentials(this.withCredentials),F.load(t,async L=>{if(typeof L=="string")throw new Error("Invalid gainmap buffer");h=L,await g()},L=>{w=L.lengthComputable,M=L.loaded,S=L.total,I()},L=>{this.manager.itemError(t),typeof a=="function"&&a(L)});const N=new co(this._internalLoadingManager);return N.setRequestHeader(this.requestHeader),N.setPath(this.path),N.setWithCredentials(this.withCredentials),N.load(n,async L=>{if(typeof L!="string")throw new Error("Invalid metadata string");p=JSON.parse(L),await g()},L=>{A=L.lengthComputable,R=L.loaded,D=L.total,I()},L=>{this.manager.itemError(n),typeof a=="function"&&a(L)}),l}}class YK extends uF{load(e,t,n,r){const s=this.prepareQuadRenderer(),a=new co(this._internalLoadingManager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(this.withCredentials),this.manager.itemStart(e),a.load(e,async l=>{if(typeof l=="string")throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const c=new Uint8Array(l);let h,p,g;try{const v=await VK(c);h=v.sdr,p=v.gainMap,g=v.metadata}catch(v){if(v instanceof lF||v instanceof oF)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),g={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},h=c;else throw v}try{await this.render(s,g,h.buffer,p==null?void 0:p.buffer)}catch(v){this.manager.itemError(e),typeof r=="function"&&r(v),s.disposeOnDemandRenderer();return}typeof t=="function"&&t(s),this.manager.itemEnd(e),s.disposeOnDemandRenderer()},n,l=>{this.manager.itemError(e),typeof r=="function"&&r(l)}),s}}const ey={apartment:"lebombo_1k.hdr",city:"potsdamer_platz_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",forest:"forest_slope_1k.hdr",lobby:"st_fagans_interior_1k.hdr",night:"dikhololo_night_1k.hdr",park:"rooitou_park_1k.hdr",studio:"studio_small_03_1k.hdr",sunset:"venice_sunset_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr"},cF="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",Cm=i=>Array.isArray(i),xC=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"];function PS({files:i=xC,path:e="",preset:t=void 0,colorSpace:n=void 0,extensions:r}={}){t&&(_C(t),i=ey[t],e=cF);const s=Cm(i),{extension:a,isCubemap:l}=bC(i),c=SC(a);if(!c)throw new Error("useEnvironment: Unrecognized file extension: "+i);const h=Bs(x=>x.gl);ae.useLayoutEffect(()=>{if(a!=="webp"&&a!=="jpg"&&a!=="jpeg")return;function x(){Wm.clear(c,s?[i]:i)}h.domElement.addEventListener("webglcontextlost",x,{once:!0})},[i,h.domElement]);const p=Wm(c,s?[i]:i,x=>{(a==="webp"||a==="jpg"||a==="jpeg")&&x.setRenderer(h),x.setPath==null||x.setPath(e),r&&r(x)});let g=s?p[0]:p;if(a==="jpg"||a==="jpeg"||a==="webp"){var v;g=(v=g.renderTarget)==null?void 0:v.texture}return g.mapping=l?Il:Em,g.colorSpace=n??(l?"srgb":"srgb-linear"),g}const qK={files:xC,path:"",preset:void 0,extensions:void 0};PS.preload=i=>{const e={...qK,...i};let{files:t,path:n=""}=e;const{preset:r,extensions:s}=e;r&&(_C(r),t=ey[r],n=cF);const{extension:a}=bC(t);if(a==="webp"||a==="jpg"||a==="jpeg")throw new Error("useEnvironment: Preloading gainmaps is not supported");const l=SC(a);if(!l)throw new Error("useEnvironment: Unrecognized file extension: "+t);Wm.preload(l,Cm(t)?[t]:t,c=>{c.setPath==null||c.setPath(n),s&&s(c)})};const ZK={files:xC,preset:void 0};PS.clear=i=>{const e={...ZK,...i};let{files:t}=e;const{preset:n}=e;n&&(_C(n),t=ey[n]);const{extension:r}=bC(t),s=SC(r);if(!s)throw new Error("useEnvironment: Unrecognized file extension: "+t);Wm.clear(s,Cm(t)?[t]:t)};function _C(i){if(!(i in ey))throw new Error("Preset must be one of: "+Object.keys(ey).join(", "))}function bC(i){var e;const t=Cm(i)&&i.length===6,n=Cm(i)&&i.length===3&&i.some(a=>a.endsWith("json")),r=Cm(i)?i[0]:i;return{extension:t?"cube":n?"webp":r.startsWith("data:application/exr")?"exr":r.startsWith("data:application/hdr")?"hdr":r.startsWith("data:image/jpeg")?"jpg":(e=r.split(".").pop())==null||(e=e.split("?"))==null||(e=e.shift())==null?void 0:e.toLowerCase(),isCubemap:t,isGainmap:n}}function SC(i){return i==="cube"?QO:i==="hdr"?LZ:i==="exr"?IZ:i==="jpg"||i==="jpeg"?YK:i==="webp"?XK:null}const KK=i=>i.current&&i.current.isScene,QK=i=>KK(i)?i.current:i;function MC(i,e,t,n,r={}){var s,a,l,c;r={backgroundBlurriness:0,backgroundIntensity:1,backgroundRotation:[0,0,0],environmentIntensity:1,environmentRotation:[0,0,0],...r};const h=QK(e||t),p=h.background,g=h.environment,v={backgroundBlurriness:h.backgroundBlurriness,backgroundIntensity:h.backgroundIntensity,backgroundRotation:(s=(a=h.backgroundRotation)==null||a.clone==null?void 0:a.clone())!==null&&s!==void 0?s:[0,0,0],environmentIntensity:h.environmentIntensity,environmentRotation:(l=(c=h.environmentRotation)==null||c.clone==null?void 0:c.clone())!==null&&l!==void 0?l:[0,0,0]};return i!=="only"&&(h.environment=n),i&&(h.background=n),Eu(h,r),()=>{i!=="only"&&(h.environment=g),i&&(h.background=p),Eu(h,v)}}function wC({scene:i,background:e=!1,map:t,...n}){const r=Bs(s=>s.scene);return ae.useLayoutEffect(()=>{if(t)return MC(e,i,r,t,n)}),null}function fF({background:i=!1,scene:e,blur:t,backgroundBlurriness:n,backgroundIntensity:r,backgroundRotation:s,environmentIntensity:a,environmentRotation:l,...c}){const h=PS(c),p=Bs(g=>g.scene);return ae.useLayoutEffect(()=>MC(i,e,p,h,{backgroundBlurriness:t??n,backgroundIntensity:r,backgroundRotation:s,environmentIntensity:a,environmentRotation:l})),ae.useEffect(()=>()=>{h.dispose()},[h]),null}function JK({children:i,near:e=.1,far:t=1e3,resolution:n=256,frames:r=1,map:s,background:a=!1,blur:l,backgroundBlurriness:c,backgroundIntensity:h,backgroundRotation:p,environmentIntensity:g,environmentRotation:v,scene:x,files:b,path:w,preset:S=void 0,extensions:M}){const A=Bs(N=>N.gl),D=Bs(N=>N.scene),R=ae.useRef(null),[I]=ae.useState(()=>new hy),P=ae.useMemo(()=>{const N=new NS(n);return N.texture.type=ar,N},[n]);ae.useEffect(()=>()=>{P.dispose()},[P]),ae.useLayoutEffect(()=>{if(r===1){const N=A.autoClear;A.autoClear=!0,R.current.update(A,I),A.autoClear=N}return MC(a,x,D,P.texture,{backgroundBlurriness:l??c,backgroundIntensity:h,backgroundRotation:p,environmentIntensity:g,environmentRotation:v})},[i,I,P.texture,x,D,a,r,A]);let F=1;return Gs(()=>{if(r===1/0||FfC({GroundProjectedEnvImpl:DZ}),[]),ae.useEffect(()=>()=>{s.dispose()},[s]);const l=ae.useMemo(()=>[a],[a]),c=(e=i.ground)==null?void 0:e.height,h=(t=i.ground)==null?void 0:t.radius,p=(n=(r=i.ground)==null?void 0:r.scale)!==null&&n!==void 0?n:1e3;return ae.createElement(ae.Fragment,null,ae.createElement(wC,go({},i,{map:a})),ae.createElement("groundProjectedEnvImpl",{args:l,scale:p,height:c,radius:h}))}function eQ(i){return i.ground?ae.createElement($K,i):i.map?ae.createElement(wC,i):i.children?ae.createElement(JK,i):ae.createElement(fF,i)}const tQ=ae.forwardRef(({scale:i=10,frames:e=1/0,opacity:t=1,width:n=1,height:r=1,blur:s=1,near:a=0,far:l=10,resolution:c=512,smooth:h=!0,color:p="#000000",depthWrite:g=!1,renderOrder:v,...x},b)=>{const w=ae.useRef(null),S=Bs(K=>K.scene),M=Bs(K=>K.gl),A=ae.useRef(null);n=n*(Array.isArray(i)?i[0]:i||1),r=r*(Array.isArray(i)?i[1]:i||1);const[D,R,I,P,F,N,L]=ae.useMemo(()=>{const K=new rs(c,c),ne=new rs(c,c);ne.texture.generateMipmaps=K.texture.generateMipmaps=!1;const j=new tl(n,r).rotateX(Math.PI/2),$=new wi(j),he=new yy;he.depthTest=he.depthWrite=!1,he.onBeforeCompile=k=>{k.uniforms={...k.uniforms,ucolor:{value:new zt(p)}},k.fragmentShader=k.fragmentShader.replace("void main() {",`uniform vec3 ucolor; void main() { `),k.fragmentShader=k.fragmentShader.replace("vec4( vec3( 1.0 - fragCoordZ ), opacity );","vec4( ucolor * fragCoordZ * 2.0, ( 1.0 - fragCoordZ ) * 1.0 );")};const le=new ls(NZ),ue=new ls(UZ);return ue.depthTest=le.depthTest=!1,[K,j,he,$,le,ue,ne]},[c,n,r,i,p]),G=K=>{P.visible=!0,P.material=F,F.uniforms.tDiffuse.value=D.texture,F.uniforms.h.value=K*1/256,M.setRenderTarget(L),M.render(P,A.current),P.material=N,N.uniforms.tDiffuse.value=L.texture,N.uniforms.v.value=K*1/256,M.setRenderTarget(D),M.render(P,A.current),P.visible=!1};let X=0,W,q;return Gs(()=>{A.current&&(e===1/0||Xw.current,[]),ae.createElement("group",go({"rotation-x":Math.PI/2},x,{ref:w}),ae.createElement("mesh",{renderOrder:v,geometry:R,scale:[1,-1,1],rotation:[-Math.PI/2,0,0]},ae.createElement("meshBasicMaterial",{transparent:!0,map:D.texture,opacity:t,depthWrite:g})),ae.createElement("orthographicCamera",{ref:A,args:[-n/2,n/2,r/2,-r/2,a,l]}))});class nQ extends ls{constructor(){super({uniforms:{time:{value:0},pixelRatio:{value:1}},vertexShader:` uniform float pixelRatio; uniform float time; attribute float size; attribute float speed; attribute float opacity; attribute vec3 noise; attribute vec3 color; varying vec3 vColor; varying float vOpacity; void main() { vec4 modelPosition = modelMatrix * vec4(position, 1.0); modelPosition.y += sin(time * speed + modelPosition.x * noise.x * 100.0) * 0.2; modelPosition.z += cos(time * speed + modelPosition.x * noise.y * 100.0) * 0.2; modelPosition.x += cos(time * speed + modelPosition.x * noise.z * 100.0) * 0.2; vec4 viewPosition = viewMatrix * modelPosition; vec4 projectionPostion = projectionMatrix * viewPosition; gl_Position = projectionPostion; gl_PointSize = size * 25. * pixelRatio; gl_PointSize *= (1.0 / - viewPosition.z); vColor = color; vOpacity = opacity; } `,fragmentShader:` varying vec3 vColor; varying float vOpacity; void main() { float distanceToCenter = distance(gl_PointCoord, vec2(0.5)); float strength = 0.05 / distanceToCenter - 0.1; gl_FragColor = vec4(vColor, strength * vOpacity); #include #include <${pC>=154?"colorspace_fragment":"encodings_fragment"}> } `})}get time(){return this.uniforms.time.value}set time(e){this.uniforms.time.value=e}get pixelRatio(){return this.uniforms.pixelRatio.value}set pixelRatio(e){this.uniforms.pixelRatio.value=e}}const hF=i=>i&&i.constructor===Float32Array,iQ=i=>[i.r,i.g,i.b],dF=i=>i instanceof pt||i instanceof re||i instanceof fi,pF=i=>Array.isArray(i)?i:dF(i)?i.toArray():[i,i,i];function W0(i,e,t){return ae.useMemo(()=>{if(e!==void 0){if(hF(e))return e;if(e instanceof zt){const n=Array.from({length:i*3},()=>iQ(e)).flat();return Float32Array.from(n)}else if(dF(e)||Array.isArray(e)){const n=Array.from({length:i*3},()=>pF(e)).flat();return Float32Array.from(n)}return Float32Array.from({length:i},()=>e)}return Float32Array.from({length:i},t)},[e])}const TU=ae.forwardRef(({noise:i=1,count:e=100,speed:t=1,opacity:n=1,scale:r=1,size:s,color:a,children:l,...c},h)=>{ae.useMemo(()=>fC({SparklesImplMaterial:nQ}),[]);const p=ae.useRef(null),g=Bs(D=>D.viewport.dpr),v=pF(r),x=ae.useMemo(()=>Float32Array.from(Array.from({length:e},()=>v.map(Bm.randFloatSpread)).flat()),[e,...v]),b=W0(e,s,Math.random),w=W0(e,n),S=W0(e,t),M=W0(e*3,i),A=W0(a===void 0?e*3:e,hF(a)?a:new zt(a),()=>1);return Gs(D=>{p.current&&p.current.material&&(p.current.material.time=D.clock.elapsedTime)}),ae.useImperativeHandle(h,()=>p.current,[]),ae.createElement("points",go({key:`particle-${e}-${JSON.stringify(r)}`},c,{ref:p}),ae.createElement("bufferGeometry",null,ae.createElement("bufferAttribute",{attach:"attributes-position",args:[x,3]}),ae.createElement("bufferAttribute",{attach:"attributes-size",args:[b,1]}),ae.createElement("bufferAttribute",{attach:"attributes-opacity",args:[w,1]}),ae.createElement("bufferAttribute",{attach:"attributes-speed",args:[S,1]}),ae.createElement("bufferAttribute",{attach:"attributes-color",args:[A,3]}),ae.createElement("bufferAttribute",{attach:"attributes-noise",args:[M,3]})),l||ae.createElement("sparklesImplMaterial",{transparent:!0,pixelRatio:g,depthWrite:!1}))});let $h,j0;const rQ=ae.createContext(null),EU=new un,AU=new re,sQ=ae.forwardRef(({children:i,range:e,limit:t=1e3,...n},r)=>{const s=ae.useRef(null);ae.useImperativeHandle(r,()=>s.current,[]);const[a,l]=ae.useState([]),[[c,h,p]]=ae.useState(()=>[new Float32Array(t*3),Float32Array.from({length:t*3},()=>1),Float32Array.from({length:t},()=>1)]);ae.useEffect(()=>{s.current.geometry.attributes.position.needsUpdate=!0}),Gs(()=>{for(s.current.updateMatrix(),s.current.updateMatrixWorld(),EU.copy(s.current.matrixWorld).invert(),s.current.geometry.drawRange.count=Math.min(t,e!==void 0?e:t,a.length),$h=0;$h({getParent:()=>s,subscribe:v=>(l(x=>[...x,v]),()=>l(x=>x.filter(b=>b.current!==v.current)))}),[]);return ae.createElement("points",go({userData:{instances:a},matrixAutoUpdate:!1,ref:s,raycast:()=>null},n),ae.createElement("bufferGeometry",null,ae.createElement("bufferAttribute",{attach:"attributes-position",args:[c,3],usage:Sd}),ae.createElement("bufferAttribute",{attach:"attributes-color",args:[h,3],usage:Sd}),ae.createElement("bufferAttribute",{attach:"attributes-size",args:[p,1],usage:Sd})),ae.createElement(rQ.Provider,{value:g},i))}),aQ=ae.forwardRef(({children:i,positions:e,colors:t,sizes:n,stride:r=3,...s},a)=>{const l=ae.useRef(null);return ae.useImperativeHandle(a,()=>l.current,[]),Gs(()=>{const c=l.current.geometry.attributes;c.position.needsUpdate=!0,t&&(c.color.needsUpdate=!0),n&&(c.size.needsUpdate=!0)}),ae.createElement("points",go({ref:l},s),ae.createElement("bufferGeometry",null,ae.createElement("bufferAttribute",{attach:"attributes-position",args:[e,r],usage:Sd}),t&&ae.createElement("bufferAttribute",{attach:"attributes-color",args:[t,r],count:t.length/r,usage:Sd}),n&&ae.createElement("bufferAttribute",{attach:"attributes-size",args:[n,1],count:n.length/r,usage:Sd})),i)}),oQ=ae.forwardRef((i,e)=>i.positions instanceof Float32Array?ae.createElement(aQ,go({},i,{ref:e})):ae.createElement(sQ,go({},i,{ref:e})));function lQ({progress:i}){const e=ae.useRef(null),t=ae.useRef(null);return Gs(n=>{const r=n.clock.getElapsedTime();e.current&&(e.current.rotation.y=Math.sin(r*.5)*.2,e.current.position.y=Math.sin(r*1.5)*.1),t.current&&(t.current.intensity=2+Math.sin(r*3)*1)}),H.jsxs("group",{children:[H.jsx(vC,{speed:2,rotationIntensity:.5,floatIntensity:1,children:H.jsxs(DK,{ref:e,font:"https://fonts.gstatic.com/s/spacegrotesk/v13/V8mQoQDjQSkFtoMM3T6r8E7mF71Q-g.woff",fontSize:2.5,color:"#ffffff",anchorX:"center",anchorY:"middle",maxWidth:10,children:["RK",H.jsx(gC,{color:"#ffffff",emissive:"#FF6120",emissiveIntensity:i>90?10:2,distort:.3,speed:2,roughness:0,metalness:1})]})}),H.jsx("pointLight",{ref:t,position:[0,0,2],color:"#FF6120",intensity:5,distance:10}),H.jsx("pointLight",{position:[-2,1,1],color:"#00f2ff",intensity:2,distance:8}),H.jsx(TU,{count:50,scale:10,size:2,speed:.5,color:"#FF6120"}),H.jsx(TU,{count:30,scale:10,size:1,speed:.8,color:"#00f2ff"})]})}function uQ(){const[i,e]=ae.useState(0),[t,n]=ae.useState(!0);return ae.useEffect(()=>{const r=setInterval(()=>{e(s=>{if(s>=100)return clearInterval(r),setTimeout(()=>n(!1),1200),100;const a=Math.floor(Math.random()*3)+1;return Math.min(s+a,100)})},30);return()=>clearInterval(r)},[]),H.jsx(jb,{children:t&&H.jsxs(mr.div,{className:"fixed inset-0 z-[9999] bg-[#050505] overflow-hidden",exit:{opacity:0,scale:1.1,transition:{duration:1,ease:[.76,0,.24,1]}},children:[H.jsx("div",{className:"absolute inset-0 z-0",children:H.jsxs(by,{shadows:!0,dpr:[1,2],children:[H.jsx(mC,{makeDefault:!0,position:[0,0,8],fov:40}),H.jsx("color",{attach:"background",args:["#050505"]}),H.jsx("fog",{attach:"fog",args:["#050505",5,15]}),H.jsxs(ae.Suspense,{fallback:null,children:[H.jsx(lQ,{progress:i}),H.jsx(eQ,{preset:"night"}),H.jsx(tQ,{position:[0,-2.5,0],opacity:.4,scale:20,blur:2,far:4.5})]})]})}),H.jsxs("div",{className:"relative z-10 h-full w-full flex flex-col items-center justify-center pointer-events-none",children:[H.jsx("div",{className:"absolute bottom-20 w-64 h-[2px] bg-white/5 overflow-hidden",children:H.jsx(mr.div,{className:"h-full bg-gradient-to-r from-violet to-cyan",initial:{width:0},animate:{width:`${i}%`},transition:{ease:"linear"}})}),H.jsxs("div",{className:"absolute bottom-24 flex items-baseline gap-2",children:[H.jsx(mr.span,{className:"font-display font-black text-6xl text-white",initial:{opacity:0,y:10},animate:{opacity:1,y:0},children:i},i),H.jsx("span",{className:"font-mono text-violet text-xl",children:"%"})]}),H.jsx(mr.div,{className:"absolute bottom-12 font-mono text-[10px] text-muted tracking-[0.5em] uppercase",animate:{opacity:[.3,.6,.3]},transition:{repeat:1/0,duration:2},children:"Initializing Neural Interface"})]}),H.jsx("div",{className:"absolute inset-0 pointer-events-none bg-[radial-gradient(circle_at_center,transparent_0%,rgba(0,0,0,0.8)_100%)]"})]})})}/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cQ=i=>i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),fQ=i=>i.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),CU=i=>{const e=fQ(i);return e.charAt(0).toUpperCase()+e.slice(1)},mF=(...i)=>i.filter((e,t,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===t).join(" ").trim(),hQ=i=>{for(const e in i)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var dQ={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pQ=ae.forwardRef(({color:i="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:n,className:r="",children:s,iconNode:a,...l},c)=>ae.createElement("svg",{ref:c,...dQ,width:e,height:e,stroke:i,strokeWidth:n?Number(t)*24/Number(e):t,className:mF("lucide",r),...!s&&!hQ(l)&&{"aria-hidden":"true"},...l},[...a.map(([h,p])=>ae.createElement(h,p)),...Array.isArray(s)?s:[s]]));/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wa=(i,e)=>{const t=ae.forwardRef(({className:n,...r},s)=>ae.createElement(pQ,{ref:s,iconNode:e,className:mF(`lucide-${cQ(CU(i))}`,`lucide-${i}`,n),...r}));return t.displayName=CU(i),t};/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mQ=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],gQ=Wa("arrow-right",mQ);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vQ=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],$w=Wa("arrow-up-right",vQ);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yQ=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],xQ=Wa("calendar",yQ);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _Q=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],bQ=Wa("clock",_Q);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SQ=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],MQ=Wa("download",SQ);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wQ=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],gF=Wa("external-link",wQ);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TQ=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],EQ=Wa("github",TQ);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AQ=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],CQ=Wa("graduation-cap",AQ);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RQ=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],vF=Wa("map-pin",RQ);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DQ=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],NQ=Wa("menu",DQ);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UQ=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],RU=Wa("moon",UQ);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LQ=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],IQ=Wa("send",LQ);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PQ=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],DU=Wa("sun",PQ);/** * @license lucide-react v0.546.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OQ=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],gE=Wa("x",OQ);function FQ({theme:i,toggleTheme:e}){const[t,n]=ae.useState(!1),[r,s]=ae.useState(!1);ae.useEffect(()=>{const l=()=>n(window.scrollY>50);return window.addEventListener("scroll",l),()=>window.removeEventListener("scroll",l)},[]);const a=[{name:"ABOUT",href:"#about"},{name:"PATH",href:"#experience"},{name:"STACK",href:"#skills"},{name:"WORKS",href:"#projects"},{name:"CONNECT",href:"#contact"}];return H.jsxs("nav",{className:`fixed top-6 left-1/2 -translate-x-1/2 w-[90%] max-w-7xl z-[1000] transition-all duration-500 ${t?"py-3 glass rounded-full":"py-6 bg-transparent"}`,children:[H.jsxs("div",{className:"px-8 flex items-center justify-between",children:[H.jsxs("a",{href:"#",className:"text-2xl font-display font-bold tracking-tighter text-ink transition-colors duration-500","data-cursor":"link","data-magnetic":!0,children:["RK",H.jsx("span",{className:"text-violet",children:"."})]}),H.jsxs("div",{className:"hidden md:flex items-center gap-12",children:[a.map(l=>H.jsx("a",{href:l.href,className:"text-xs font-display font-bold tracking-widest text-ink/60 hover:text-ink transition-colors duration-500","data-cursor":"link","data-magnetic":!0,children:l.name},l.name)),H.jsx("button",{onClick:e,className:"p-2 rounded-full hover:bg-black/5 dark:hover:bg-white/10 transition-colors text-ink duration-500","data-cursor":"button","data-magnetic":!0,children:i==="dark"?H.jsx(DU,{size:20}):H.jsx(RU,{size:20})})]}),H.jsx("button",{className:"md:hidden text-ink",onClick:()=>s(!r),children:r?H.jsx(gE,{}):H.jsx(NQ,{})})]}),r&&H.jsxs(mr.div,{initial:{opacity:0,y:-20},animate:{opacity:1,y:0},className:"absolute top-full left-0 w-full glass border-b border-white/10 p-6 flex flex-col gap-6 md:hidden",children:[a.map(l=>H.jsx("a",{href:l.href,className:"text-lg font-display font-bold text-ink",onClick:()=>s(!1),children:l.name},l.name)),H.jsxs("button",{onClick:e,className:"flex items-center gap-2 text-ink",children:[i==="dark"?H.jsx(DU,{size:20}):H.jsx(RU,{size:20}),H.jsx("span",{className:"text-sm font-mono uppercase tracking-widest",children:"Toggle Theme"})]})]})]})}(function(){function i(){for(var n=arguments.length,r=0;r"u"||!(Symbol.iterator in Object(i)))){var t=[],n=!0,r=!1,s=void 0;try{for(var a=i[Symbol.iterator](),l;!(n=(l=a.next()).done)&&(t.push(l.value),!(e&&t.length===e));n=!0);}catch(c){r=!0,s=c}finally{try{!n&&a.return!=null&&a.return()}finally{if(r)throw s}}return t}}function xF(i,e){if(i){if(typeof i=="string")return vE(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return vE(i,e)}}function vE(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=new Array(e);t0&&arguments[0]!==void 0?arguments[0]:{},e=dd(i),t;return e.types!==void 0?t=e.types:e.split!==void 0&&(t=e.split),t!==void 0&&(e.types=(My(t)||TC(t)?String(t):"").split(",").map(function(n){return String(n).trim()}).filter(function(n){return/((line)|(word)|(char))/i.test(n)})),(e.absolute||e.position)&&(e.absolute=e.absolute||/absolute/.test(i.position)),e}function EC(i){var e=My(i)||TC(i)?String(i):"";return{none:!e,lines:/line/i.test(e),words:/word/i.test(e),chars:/char/i.test(e)}}function OS(i){return i!==null&&typeof i=="object"}function XQ(i){return OS(i)&&/^(1|3|11)$/.test(i.nodeType)}function YQ(i){return typeof i=="number"&&i>-1&&i%1===0}function qQ(i){return OS(i)&&YQ(i.length)}function Id(i){return TC(i)?i:i==null?[]:qQ(i)?Array.prototype.slice.call(i):[i]}function PU(i){var e=i;return My(i)&&(/^(#[a-z]\w+)$/.test(i.trim())?e=document.getElementById(i.trim().slice(1)):e=document.querySelectorAll(i)),Id(e).reduce(function(t,n){return[].concat(sa(t),sa(Id(n).filter(XQ)))},[])}var ZQ=Object.entries,zb="_splittype",Ul={},KQ=0;function Du(i,e,t){if(!OS(i))return console.warn("[data.set] owner is not an object"),null;var n=i[zb]||(i[zb]=++KQ),r=Ul[n]||(Ul[n]={});return t===void 0?e&&Object.getPrototypeOf(e)===Object.prototype&&(Ul[n]=IU(IU({},r),e)):e!==void 0&&(r[e]=t),t}function pd(i,e){var t=OS(i)?i[zb]:null,n=t&&Ul[t]||{};return n}function _F(i){var e=i&&i[zb];e&&(delete i[e],delete Ul[e])}function QQ(){Object.keys(Ul).forEach(function(i){delete Ul[i]})}function JQ(){ZQ(Ul).forEach(function(i){var e=yF(i,2),t=e[0],n=e[1],r=n.isRoot,s=n.isSplit;(!r||!s)&&(Ul[t]=null,delete Ul[t])})}function $Q(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:" ",t=i?String(i):"";return t.trim().replace(/\s+/g," ").split(e)}var AC="\\ud800-\\udfff",bF="\\u0300-\\u036f\\ufe20-\\ufe23",SF="\\u20d0-\\u20f0",MF="\\ufe0e\\ufe0f",eJ="[".concat(AC,"]"),yE="[".concat(bF).concat(SF,"]"),xE="\\ud83c[\\udffb-\\udfff]",tJ="(?:".concat(yE,"|").concat(xE,")"),wF="[^".concat(AC,"]"),TF="(?:\\ud83c[\\udde6-\\uddff]){2}",EF="[\\ud800-\\udbff][\\udc00-\\udfff]",AF="\\u200d",CF="".concat(tJ,"?"),RF="[".concat(MF,"]?"),nJ="(?:"+AF+"(?:"+[wF,TF,EF].join("|")+")"+RF+CF+")*",iJ=RF+CF+nJ,rJ="(?:".concat(["".concat(wF).concat(yE,"?"),yE,TF,EF,eJ].join("|"),` )`),sJ=RegExp("".concat(xE,"(?=").concat(xE,")|").concat(rJ).concat(iJ),"g"),aJ=[AF,AC,bF,SF,MF],oJ=RegExp("[".concat(aJ.join(""),"]"));function lJ(i){return i.split("")}function DF(i){return oJ.test(i)}function uJ(i){return i.match(sJ)||[]}function cJ(i){return DF(i)?uJ(i):lJ(i)}function fJ(i){return i==null?"":String(i)}function hJ(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return i=fJ(i),i&&My(i)&&!e&&DF(i)?cJ(i):i.split(e)}function _E(i,e){var t=document.createElement(i);return e&&Object.keys(e).forEach(function(n){var r=e[n],s=My(r)?r.trim():r;s===null||s===""||(n==="children"?t.append.apply(t,sa(Id(s))):t.setAttribute(n,s))}),t}var CC={splitClass:"",lineClass:"line",wordClass:"word",charClass:"char",types:["lines","words","chars"],absolute:!1,tagName:"div"};function dJ(i,e){e=dd(CC,e);var t=EC(e.types),n=e.tagName,r=i.nodeValue,s=document.createDocumentFragment(),a=[],l=[];return/^\s/.test(r)&&s.append(" "),a=$Q(r).reduce(function(c,h,p,g){var v,x;return t.chars&&(x=hJ(h).map(function(b){var w=_E(n,{class:"".concat(e.splitClass," ").concat(e.charClass),style:"display: inline-block;",children:b});return Du(w,"isChar",!0),l=[].concat(sa(l),[w]),w})),t.words||t.lines?(v=_E(n,{class:"".concat(e.wordClass," ").concat(e.splitClass),style:"display: inline-block; ".concat(t.words&&e.absolute?"position: relative;":""),children:t.chars?x:h}),Du(v,{isWord:!0,isWordStart:!0,isWordEnd:!0}),s.appendChild(v)):x.forEach(function(b){s.appendChild(b)}),p=D)&&(c=L,a.push(l=[])),l.push(R)),e.absolute&&Du(R,{top:L,left:G,width:F,height:N}))}),x&&x.removeChild(i),n.lines&&(v=a.map(function(R){var I=_E(r,{class:"".concat(e.splitClass," ").concat(e.lineClass),style:"display: block; text-align: ".concat(M,"; width: 100%;")});Du(I,"isLine",!0);var P={height:0,top:1e4};return w.appendChild(I),R.forEach(function(F,N,L){var G=pd(F),X=G.isWordEnd,W=G.top,q=G.height,K=L[N+1];P.height=Math.max(P.height,q),P.top=Math.min(P.top,W),I.appendChild(F),X&&pd(K).isWordStart&&I.append(" ")}),e.absolute&&Du(I,{height:P.height,top:P.top}),I}),n.words||UF(w),i.replaceChildren(w)),e.absolute&&(i.style.width="".concat(i.style.width||p,"px"),i.style.height="".concat(h,"px"),Id(s).forEach(function(R){var I=pd(R),P=I.isLine,F=I.top,N=I.left,L=I.width,G=I.height,X=pd(R.parentElement),W=!P&&X.isLine;R.style.top="".concat(W?F-X.top:F,"px"),R.style.left=P?"".concat(g.left,"px"):"".concat(N-(W?g.left:0),"px"),R.style.height="".concat(G,"px"),R.style.width=P?"".concat(g.width,"px"):"".concat(L,"px"),R.style.position="absolute"})),x&&(b?x.insertBefore(i,b):x.appendChild(i)),v}var hm=dd(CC,{}),vJ=(function(){UU(i,null,[{key:"clearData",value:function(){QQ()}},{key:"setDefaults",value:function(t){return hm=dd(hm,a1(t)),CC}},{key:"revert",value:function(t){PU(t).forEach(function(n){var r=pd(n),s=r.isSplit,a=r.html,l=r.cssWidth,c=r.cssHeight;s&&(n.innerHTML=a,n.style.width=l||"",n.style.height=c||"",_F(n))})}},{key:"create",value:function(t,n){return new i(t,n)}},{key:"data",get:function(){return Ul}},{key:"defaults",get:function(){return hm},set:function(t){hm=dd(hm,a1(t))}}]);function i(e,t){kQ(this,i),this.isSplit=!1,this.settings=dd(hm,a1(t)),this.elements=PU(e),this.split()}return UU(i,[{key:"split",value:function(t){var n=this;this.revert(),this.elements.forEach(function(a){Du(a,"html",a.innerHTML)}),this.lines=[],this.words=[],this.chars=[];var r=[window.pageXOffset,window.pageYOffset];t!==void 0&&(this.settings=dd(this.settings,a1(t)));var s=EC(this.settings.types);s.none||(this.elements.forEach(function(a){Du(a,"isRoot",!0);var l=NF(a,n.settings),c=l.words,h=l.chars;n.words=[].concat(sa(n.words),sa(c)),n.chars=[].concat(sa(n.chars),sa(h))}),this.elements.forEach(function(a){if(s.lines||n.settings.absolute){var l=gJ(a,n.settings,r);n.lines=[].concat(sa(n.lines),sa(l))}}),this.isSplit=!0,window.scrollTo(r[0],r[1]),JQ())}},{key:"revert",value:function(){this.isSplit&&(this.lines=null,this.words=null,this.chars=null,this.isSplit=!1),i.revert(this.elements)}}]),i})();function yJ(){const i=ae.useRef(null),e=ae.useMemo(()=>{const n=new Float32Array(6e3);for(let r=0;r<2e3;r++)n[r*3]=(Math.random()-.5)*15,n[r*3+1]=(Math.random()-.5)*15,n[r*3+2]=(Math.random()-.5)*15;return n},[]);return Gs(t=>{i.current.rotation.y=t.clock.getElapsedTime()*.05,i.current.rotation.x=t.clock.getElapsedTime()*.03}),H.jsx(oQ,{ref:i,positions:e,stride:3,frustumCulled:!1,children:H.jsx(FK,{transparent:!0,color:"#FF6120",size:.02,sizeAttenuation:!0,depthWrite:!1,blending:V1})})}function xJ(){const i=ae.useRef(null),e=ae.useRef({x:0,y:0}),t=ae.useMemo(()=>{const r=[];for(let s=0;s<50;s++)r.push(new re((Math.random()-.5)*10,(Math.random()-.5)*10,(Math.random()-.5)*10));return r},[]),n=ae.useMemo(()=>{const r=[];for(let s=0;s{const r=s=>{e.current={x:s.clientX/window.innerWidth*2-1,y:-(s.clientY/window.innerHeight)*2+1}};return window.addEventListener("mousemove",r),()=>window.removeEventListener("mousemove",r)},[]),Gs(r=>{const s=r.clock.getElapsedTime();i.current.rotation.y=s*.1,i.current.rotation.x=s*.05,i.current.position.x=Bm.lerp(i.current.position.x,e.current.x*1.5,.05),i.current.position.y=Bm.lerp(i.current.position.y,e.current.y*1.5,.05)}),H.jsxs("group",{ref:i,children:[t.map((r,s)=>H.jsxs("mesh",{position:r,children:[H.jsx("sphereGeometry",{args:[.05,16,16]}),H.jsx("meshStandardMaterial",{color:"#FF6120",emissive:"#FF6120",emissiveIntensity:2})]},s)),H.jsxs("lineSegments",{children:[H.jsx("bufferGeometry",{attach:"geometry",children:H.jsx("bufferAttribute",{attach:"attributes-position",count:n.length,array:new Float32Array(n.flatMap(r=>[r.x,r.y,r.z])),itemSize:3})}),H.jsx("lineBasicMaterial",{attach:"material",color:"#FFB74D",transparent:!0,opacity:.3})]})]})}function _J({data:i}){const e=ae.useRef(null);return ae.useEffect(()=>{if(e.current){const t=new vJ(e.current,{types:"chars"});B1.from(t.chars,{y:100,opacity:0,duration:1,stagger:.02,ease:"power4.out",delay:1.2})}},[]),H.jsxs("section",{className:"relative h-screen w-full flex items-center justify-center overflow-hidden",children:[H.jsx("div",{className:"absolute inset-0 z-0 opacity-60",children:H.jsxs(by,{camera:{position:[0,0,8],fov:45},children:[H.jsx("ambientLight",{intensity:.4}),H.jsx("pointLight",{position:[10,10,10],intensity:1.5,color:"#FF6120"}),H.jsx("pointLight",{position:[-10,-10,-10],intensity:1,color:"#FFB74D"}),H.jsx(xJ,{}),H.jsx(yJ,{})]})}),H.jsxs("div",{className:"relative z-10 max-w-7xl mx-auto px-6 md:px-12 text-center",children:[H.jsx(mr.span,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:1},className:"font-mono text-xs tracking-[0.5em] text-violet mb-6 block",children:i.identity.titles[0].toUpperCase()}),H.jsxs("h1",{ref:e,className:"text-[12vw] md:text-[8vw] font-display font-black leading-[0.9] tracking-tighter text-ink uppercase overflow-hidden",children:["RUTHIK ",H.jsx("br",{}),H.jsx("span",{className:"text-stroke",children:"KALE"})]}),H.jsx(mr.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:1.5,duration:1},className:"mt-8 text-lg md:text-xl text-muted max-w-xl mx-auto font-body transition-colors duration-500",children:i.identity.tagline}),H.jsxs(mr.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:1.8},className:"mt-12 flex flex-col md:flex-row items-center justify-center gap-6",children:[H.jsx("a",{href:"#projects",className:"px-10 py-4 bg-violet text-white font-display font-bold tracking-widest text-xs hover:scale-105 transition-transform shadow-[0_10px_30px_rgba(255,97,32,0.3)]","data-cursor":"button","data-magnetic":!0,children:"EXPLORE WORKS"}),H.jsx("a",{href:"#contact",className:"px-10 py-4 border border-ink/20 text-ink font-display font-bold tracking-widest text-xs hover:bg-ink hover:text-bg transition-all duration-300","data-cursor":"button","data-magnetic":!0,children:"INITIATE CONTACT"})]})]}),H.jsxs(mr.div,{animate:{y:[0,10,0]},transition:{repeat:1/0,duration:2},className:"absolute bottom-10 left-1/2 -translate-x-1/2 flex flex-col items-center gap-2",children:[H.jsx("div",{className:"w-[1px] h-12 bg-gradient-to-b from-violet to-transparent"}),H.jsx("span",{className:"font-mono text-[10px] text-muted tracking-widest",children:"SCROLL"})]})]})}function bJ({items:i}){return H.jsx("div",{className:"py-12 border-y border-white/5 overflow-hidden flex whitespace-nowrap bg-bg2",children:H.jsx(mr.div,{animate:{x:[0,-1e3]},transition:{repeat:1/0,duration:20,ease:"linear"},className:"flex gap-20 items-center",children:[...i,...i].map((e,t)=>H.jsxs("div",{className:"flex items-center gap-6",children:[H.jsx("span",{className:"text-4xl md:text-6xl font-display font-bold text-white/20 hover:text-violet transition-colors duration-500",children:e.toUpperCase()}),H.jsx("div",{className:"w-3 h-3 rounded-full bg-violet"})]},t))})})}const OU=30,SJ=.6,wf={x:20,y:12};function MJ(){const i=ae.useRef(new re),e=ae.useRef(new re),t=ae.useRef([]),[n,r]=ae.useState([]),[s,a]=ae.useState([]);ae.useEffect(()=>{const h=p=>{const g=document.getElementById("about");if(!g)return;const v=g.getBoundingClientRect(),x=(p.clientX-v.left)/v.width*2-1,b=-((p.clientY-v.top)/v.height)*2+1;i.current.set(x,b,0)};return window.addEventListener("mousemove",h),()=>window.removeEventListener("mousemove",h)},[]);const l=ae.useMemo(()=>Array.from({length:OU}).map((h,p)=>({position:new re((Math.random()-.5)*40,(Math.random()-.5)*24,0),velocity:new re((Math.random()-.5)*.15,(Math.random()-.5)*.15,0),size:.15+Math.random()*.3,color:p%2===0?"#FF6120":"#FFB74D",rotationSpeed:new re(Math.random()*.05,Math.random()*.05,Math.random()*.05),isDestroyed:!1,blastTime:0})),[]),c=ae.useRef(l);return Gs(h=>{const p=h.clock.getElapsedTime(),{viewport:g}=h,v=i.current.x*g.width/2,x=i.current.y*g.height/2;e.current.lerp(new re(v,x,0),.2);const b=[...n].filter(S=>S.life>0),w=[...s].filter(S=>p-S.startTime<.5);for(let S=0;S.2){M.isDestroyed=!1;const R=Math.floor(Math.random()*4);R===0?M.position.set(-20,(Math.random()-.5)*wf.y*2,0):R===1?M.position.set(wf.x,(Math.random()-.5)*wf.y*2,0):R===2?M.position.set((Math.random()-.5)*wf.x*2,-12,0):M.position.set((Math.random()-.5)*wf.x*2,wf.y,0),M.velocity.set((Math.random()-.5)*.15,(Math.random()-.5)*.15,0),A.visible=!0}continue}if(M.position.add(M.velocity),M.position.distanceTo(e.current)wf.x+2||Math.abs(M.position.y)>wf.y+2)&&(M.isDestroyed=!0,M.blastTime=p-.1,A.visible=!1),A.position.copy(M.position),A.rotation.x+=M.rotationSpeed.x,A.rotation.y+=M.rotationSpeed.y,A.scale.setScalar(M.size*(Math.sin(p*3+S)*.08+1))}b.forEach(S=>{S.position.add(S.velocity),S.life-=.04}),r(b),a(w)}),H.jsxs(H.Fragment,{children:[H.jsx("ambientLight",{intensity:.5}),H.jsx("pointLight",{position:[10,10,10],intensity:2,color:"#FF6120"}),l.map((h,p)=>H.jsxs("mesh",{ref:g=>t.current[p]=g,children:[H.jsx("icosahedronGeometry",{args:[1,0]}),H.jsx(gC,{color:h.color,emissive:h.color,emissiveIntensity:1.5,distort:.5,speed:3,transparent:!0,opacity:.6})]},p)),n.map((h,p)=>H.jsxs("mesh",{position:h.position,scale:h.size*h.life,children:[H.jsx("boxGeometry",{args:[1,1,1]}),H.jsx("meshBasicMaterial",{color:h.color,transparent:!0,opacity:h.life})]},`p-${p}`)),s.map((h,p)=>H.jsx(wJ,{...h},`bw-${p}`)),H.jsx(TJ,{mouseRef:e})]})}function wJ({position:i,startTime:e,color:t}){const n=ae.useRef(null),{clock:r}=Bs();return Gs(()=>{const s=r.getElapsedTime()-e,a=s*10,l=1-s/.5;n.current.scale.setScalar(a),n.current.material instanceof Ol&&(n.current.material.opacity=Math.max(0,l))}),H.jsxs("mesh",{ref:n,position:i,children:[H.jsx("ringGeometry",{args:[.9,1,32]}),H.jsx("meshBasicMaterial",{color:t,transparent:!0,opacity:1,side:io})]})}function TJ({mouseRef:i}){const e=ae.useRef(null);return Gs(t=>{const n=t.clock.getElapsedTime();e.current.position.copy(i.current),e.current.rotation.y=n*4,e.current.rotation.z=Math.sin(n*2)*.15}),H.jsxs("group",{ref:e,children:[H.jsxs("mesh",{children:[H.jsx("sphereGeometry",{args:[.3,32,32,0,Math.PI*2,0,Math.PI*.5]}),H.jsx("meshStandardMaterial",{color:"#cccccc",emissive:"#222222",metalness:.8,roughness:.2})]}),H.jsxs("mesh",{rotation:[Math.PI*.5,0,0],children:[H.jsx("torusGeometry",{args:[.4,.04,16,100]}),H.jsx("meshStandardMaterial",{color:"#FF6120",emissive:"#FF6120",emissiveIntensity:5})]}),H.jsxs("mesh",{position:[0,.1,0],children:[H.jsx("sphereGeometry",{args:[.15,32,32]}),H.jsx("meshStandardMaterial",{color:"#ffffff",emissive:"#00f2ff",emissiveIntensity:4,transparent:!0,opacity:.9})]}),H.jsx("pointLight",{intensity:5,distance:10,color:"#00f2ff"})]})}function EJ(){return H.jsx("div",{"data-cursor":"none",className:"absolute inset-0 pointer-events-auto z-0 opacity-60 cursor-none overflow-hidden",children:H.jsxs(by,{style:{cursor:"none"},children:[H.jsx(mC,{makeDefault:!0,position:[0,0,10]}),H.jsx(MJ,{})]})})}function AJ({data:i}){return H.jsxs("section",{id:"about","data-cursor":"none",className:"relative py-32 overflow-hidden transition-colors duration-500 cursor-none",children:[H.jsx(EJ,{}),H.jsx("div",{className:"max-w-7xl mx-auto px-6 md:px-12 relative z-10 pointer-events-none",children:H.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-20",children:[H.jsxs(mr.div,{initial:{opacity:0,x:-50},whileInView:{opacity:1,x:0},viewport:{once:!0},className:"pointer-events-auto",children:[H.jsx("span",{className:"font-mono text-xs text-violet tracking-widest mb-4 block",children:"01 / OVERVIEW"}),H.jsxs("h2",{className:"text-5xl md:text-7xl font-display font-bold tracking-tighter text-ink mb-8 transition-colors duration-500",children:["I architect ",H.jsx("br",{}),"intelligence."]}),H.jsxs("p",{className:"text-xl text-muted leading-relaxed mb-12 transition-colors duration-500",children:["I design ",H.jsx("span",{className:"text-ink font-semibold",children:"ML systems and MLOps pipelines"}),". that make churn, risk, and forecasting models reliable, observable, and actually used by the business."]}),H.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[H.jsxs("div",{className:"flex items-center gap-4 text-muted",children:[H.jsx("div",{className:"w-10 h-10 rounded-full bg-ink/5 dark:bg-white/5 backdrop-blur-md border border-ink/10 dark:border-white/10 flex items-center justify-center text-violet transition-all duration-500",children:H.jsx(vF,{size:18})}),H.jsxs("div",{children:[H.jsx("p",{className:"text-[10px] font-mono uppercase tracking-widest",children:"Location"}),H.jsx("p",{className:"text-ink font-medium transition-colors duration-500",children:i.identity.location})]})]}),H.jsxs("div",{className:"flex items-center gap-4 text-muted",children:[H.jsx("div",{className:"w-10 h-10 rounded-full bg-ink/5 dark:bg-white/5 backdrop-blur-md border border-ink/10 dark:border-white/10 flex items-center justify-center text-violet transition-all duration-500",children:H.jsx(bQ,{size:18})}),H.jsxs("div",{children:[H.jsx("p",{className:"text-[10px] font-mono uppercase tracking-widest",children:"Timezone"}),H.jsx("p",{className:"text-ink font-medium transition-colors duration-500",children:i.identity.timezone})]})]})]})]}),H.jsx("div",{className:"grid grid-cols-2 gap-4 pointer-events-auto",children:i.stats.map((e,t)=>H.jsxs(mr.div,{whileHover:{y:-5,scale:1.02},className:"col-span-1 p-8 bg-ink/5 dark:bg-white/5 backdrop-blur-[1px] border border-ink/5 dark:border-white/5 rounded-[2rem] flex flex-col justify-between transition-all duration-500 h-48",children:[H.jsxs("span",{className:"text-4xl md:text-5xl font-display font-bold text-ink transition-colors duration-500",children:[e.value,e.suffix]}),H.jsx("span",{className:"text-[10px] font-mono text-muted uppercase tracking-widest",children:e.label})]},t))})]})})]})}function CJ({position:i,color:e,speed:t,distort:n}){const r=ae.useRef(null),{mouse:s}=Bs(),a=ae.useRef(.5+Math.random()*.5);Gs(c=>{const h=c.clock.getElapsedTime();r.current.rotation.x=h*t*.5,r.current.rotation.y=h*t*.3;const p=new re(s.x*5,s.y*5,0);if(r.current.position.distanceTo(p)<2){const v=Math.sin(h*20)*.2+1.2;r.current.scale.setScalar(a.current*v),r.current.rotation.z+=.1}else r.current.scale.setScalar(Bm.lerp(r.current.scale.x,a.current,.1))});const l=ae.useMemo(()=>{const c=[new $m(1,0),new eg(1,0),new vy(1,0),new Qf(1,1,1)];return c[Math.floor(Math.random()*c.length)]},[]);return H.jsx(vC,{speed:t*2,rotationIntensity:1,floatIntensity:1,children:H.jsx("mesh",{ref:r,position:i,geometry:l,children:H.jsx(gC,{color:e,distort:n,speed:t,roughness:.2,metalness:.8,transparent:!0,opacity:.3,emissive:e,emissiveIntensity:.1})})})}function sg(){const i=ae.useMemo(()=>Array.from({length:8}).map((e,t)=>({position:[(Math.random()-.5)*12,(Math.random()-.5)*12,(Math.random()-.5)*4],color:t%2===0?"#FF6120":"#FFB74D",speed:.8+Math.random()*1.2,distort:.3+Math.random()*.4})),[]);return H.jsx("div",{className:"absolute inset-0 pointer-events-none opacity-30 z-0",children:H.jsxs(by,{camera:{position:[0,0,10],fov:50},children:[H.jsx("ambientLight",{intensity:.6}),H.jsx("pointLight",{position:[10,10,10],intensity:1.5,color:"#FF6120"}),H.jsx("pointLight",{position:[-10,-10,-10],intensity:1,color:"#FFB74D"}),i.map((e,t)=>H.jsx(CJ,{...e},t))]})})}function RJ({data:i}){const[e,t]=ae.useState(0),n=(i==null?void 0:i.experience)||[],r=ae.useRef(null),s=a=>{t(a),setTimeout(()=>{r.current&&r.current.scrollIntoView({behavior:"smooth",block:"center"})},100)};return H.jsxs("section",{id:"experience",className:"py-40 px-6 md:px-12 bg-bg relative overflow-hidden border-y border-ink/5 dark:border-white/5 transition-colors duration-500",children:[H.jsx(sg,{}),H.jsxs("div",{className:"max-w-7xl mx-auto relative z-10",children:[H.jsxs("div",{className:"flex items-center gap-4 mb-24",children:[H.jsx("div",{className:"w-12 h-[1px] bg-violet"}),H.jsx("h2",{className:"font-mono text-violet text-[10px] tracking-[0.4em] uppercase",children:"02 / TRAJECTORY"})]}),H.jsxs("div",{className:"flex flex-col lg:flex-row gap-20",children:[H.jsx("div",{className:"lg:w-1/3",children:H.jsx("div",{className:"flex flex-col gap-8",children:n.map((a,l)=>H.jsxs("button",{onClick:()=>s(l),className:"group text-left relative pl-8","data-cursor":"button",children:[H.jsx("div",{className:`absolute left-0 top-1/2 -translate-y-1/2 w-1 h-1 rounded-full transition-all duration-500 ${e===l?"bg-violet scale-[3] shadow-[0_0_10px_#FF6120]":"bg-ink/10 dark:bg-white/10 group-hover:bg-ink/30 dark:group-hover:bg-white/30"}`}),H.jsx("span",{className:`block font-mono text-[9px] uppercase tracking-[0.2em] mb-2 transition-colors ${e===l?"text-violet":"text-muted"}`,children:a.period}),H.jsx("h4",{className:`font-display text-xl font-bold uppercase tracking-tight transition-colors ${e===l?"text-ink":"text-ink/40 dark:text-white/20 group-hover:text-ink/60 dark:group-hover:text-white/40"}`,children:a.roleShort||a.org})]},a.id))})}),H.jsx("div",{className:"lg:w-2/3",ref:r,children:H.jsx(jb,{mode:"wait",children:H.jsxs(mr.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:-20},transition:{duration:.6,ease:[.16,1,.3,1]},className:"glass rounded-[2rem] p-10 md:p-16 transition-all duration-500",children:[H.jsxs("div",{className:"mb-12",children:[H.jsx("span",{className:"font-mono text-[9px] text-violet uppercase tracking-[0.3em] mb-4 block",children:n[e].org}),H.jsx("h3",{className:"text-4xl md:text-5xl font-bold uppercase tracking-tighter mb-6 text-ink transition-colors duration-500",children:n[e].role}),H.jsx("div",{className:"flex items-center gap-6 text-[10px] font-mono text-muted uppercase tracking-widest",children:H.jsxs("span",{className:"flex items-center gap-2",children:[H.jsx(vF,{className:"w-3 h-3"}),n[e].location]})})]}),H.jsx("div",{className:"space-y-6 mb-12",children:n[e].description.map((a,l)=>H.jsxs("div",{className:"flex gap-4 group/item",children:[H.jsx("div",{className:"mt-2 w-1.5 h-[1px] bg-violet/30 group-hover/item:bg-violet transition-colors flex-shrink-0"}),H.jsx("p",{className:"text-muted text-sm md:text-base leading-relaxed group-hover/item:text-ink/80 dark:group-hover/item:text-white/80 transition-colors",children:a})]},l))}),H.jsx("div",{className:"flex flex-wrap gap-2",children:n[e].tags.map(a=>H.jsx("span",{className:"px-3 py-1 bg-violet/5 border border-violet/10 rounded-full font-mono text-[9px] text-muted uppercase tracking-wider",children:a},a))})]},e)})})]})]})]})}function DJ({data:i}){const e=(i==null?void 0:i.education)||[];return H.jsxs("section",{id:"education",className:"py-40 px-6 md:px-12 bg-bg relative overflow-hidden border-y border-ink/5 dark:border-white/5 transition-colors duration-500",children:[H.jsx(sg,{}),H.jsxs("div",{className:"max-w-7xl mx-auto relative z-10",children:[H.jsxs("div",{className:"flex items-center gap-4 mb-24",children:[H.jsx("div",{className:"w-12 h-[1px] bg-violet"}),H.jsx("h2",{className:"font-mono text-violet text-[10px] tracking-[0.4em] uppercase",children:"03 / FOUNDATION"})]}),H.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:e.map((t,n)=>H.jsx(mr.div,{initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{duration:.6,delay:n*.1},className:"group relative",children:H.jsxs("div",{className:"glass rounded-[2rem] p-8 md:p-12 h-full flex flex-col transition-all duration-500 hover:border-violet/30",children:[H.jsxs("div",{className:"flex justify-between items-start mb-8",children:[H.jsx("div",{className:"w-16 h-16 rounded-2xl bg-white/5 border border-white/10 flex items-center justify-center overflow-hidden p-2",children:t.logo?H.jsx("img",{src:t.logo,alt:t.school,className:"w-full h-full object-contain filter grayscale group-hover:grayscale-0 transition-all duration-500",referrerPolicy:"no-referrer",onError:r=>{r.target.src=`https://picsum.photos/seed/${t.school}/100/100`}}):H.jsx(CQ,{className:"w-8 h-8 text-violet"})}),H.jsxs("div",{className:"flex items-center gap-2 px-3 py-1 bg-violet/5 border border-violet/10 rounded-full",children:[H.jsx(xQ,{className:"w-3 h-3 text-violet"}),H.jsx("span",{className:"font-mono text-[9px] text-muted uppercase tracking-wider",children:t.year})]})]}),H.jsxs("div",{className:"flex-grow",children:[H.jsx("h3",{className:"text-2xl md:text-3xl font-bold uppercase tracking-tighter mb-2 text-ink transition-colors duration-500",children:t.degree}),H.jsxs("p",{className:"font-mono text-[10px] text-violet uppercase tracking-[0.2em] mb-6",children:[t.school,t.subSchool&&H.jsx("span",{className:"block text-muted/60 mt-1",children:t.subSchool})]}),H.jsx("p",{className:"text-muted text-sm md:text-base leading-relaxed mb-8",children:t.description})]}),t.link&&H.jsxs("a",{href:t.link,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-[10px] font-mono text-muted hover:text-violet transition-colors uppercase tracking-widest mt-auto group/link","data-cursor":"button",children:["View Program",H.jsx(gF,{className:"w-3 h-3 transition-transform group-hover/link:translate-x-1 group-hover/link:-translate-y-1"})]})]})},n))})]})]})}function NJ({title:i,skills:e}){const t=ae.useRef(null),n=U1(0),r=U1(0),s=Rv(n),a=Rv(r),l=Cv(a,[-.5,.5],["10deg","-10deg"]),c=Cv(s,[-.5,.5],["-10deg","10deg"]),h=g=>{var x;const v=(x=t.current)==null?void 0:x.getBoundingClientRect();if(v){const b=v.width,w=v.height,S=g.clientX-v.left,M=g.clientY-v.top,A=S/b-.5,D=M/w-.5;n.set(A),r.set(D)}},p=()=>{n.set(0),r.set(0)};return H.jsxs(mr.div,{ref:t,onMouseMove:h,onMouseLeave:p,style:{rotateX:l,rotateY:c,transformStyle:"preserve-3d"},className:"relative p-8 glass rounded-[2rem] group overflow-hidden transition-all duration-500",children:[H.jsx("div",{className:"absolute inset-0 opacity-0 group-hover:opacity-100 transition-opacity duration-500 pointer-events-none bg-[radial-gradient(circle_at_var(--x)_var(--y),rgba(255,97,32,0.15),transparent_40%)]",style:{"--x":`${(n.get()+.5)*100}%`,"--y":`${(r.get()+.5)*100}%`}}),H.jsx("h3",{className:"text-2xl font-display font-bold text-ink mb-6 group-hover:text-violet transition-colors duration-500",children:i}),H.jsx("div",{className:"flex flex-wrap gap-3",children:e.map(g=>H.jsx("span",{className:"px-4 py-2 rounded-full border border-ink/10 dark:border-white/5 bg-ink/[0.04] dark:bg-white/5 text-xs font-mono text-muted group-hover:border-violet/30 group-hover:text-ink dark:group-hover:text-white transition-all duration-500",children:g},g))})]})}function UJ({data:i}){return H.jsxs("section",{id:"skills",className:"relative py-32 px-6 overflow-hidden transition-colors duration-500",children:[H.jsx(sg,{}),H.jsxs("div",{className:"max-w-7xl mx-auto relative z-10",children:[H.jsxs("div",{className:"mb-20",children:[H.jsx("span",{className:"font-mono text-xs text-violet tracking-widest mb-4 block",children:"04 / STACK"}),H.jsxs("h2",{className:"text-5xl md:text-7xl font-display font-bold tracking-tighter text-ink transition-colors duration-500",children:["Technical ",H.jsx("br",{})," Arsenal."]})]}),H.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:Object.entries(i.skills).map(([e,t])=>H.jsx(NJ,{title:e,skills:t},e))})]})]})}function LJ({project:i}){const[e,t]=ae.useState(i.custom_image||`https://picsum.photos/seed/${i.name}/800/600`);return ae.useEffect(()=>{if(i.custom_image){t(i.custom_image);return}fetch(`https://raw.githubusercontent.com/Ruthik27/${i.picture_serach}/main/README.md`).then(n=>n.text()).then(n=>{const r=n.match(/!\[.*?\]\((.*?)\)/);r&&r[1]&&t(r[1])}).catch(()=>{})},[i.name,i.custom_image]),H.jsx("div",{className:"min-w-[400px] md:min-w-[600px] h-[70vh] px-4 group","data-cursor":"image",children:H.jsxs("div",{className:"h-full glass rounded-[2rem] overflow-hidden flex flex-col border border-ink/5 dark:border-white/5 relative transition-all duration-500",children:[H.jsx("div",{className:"absolute top-6 left-6 z-10 flex gap-2",children:H.jsx("span",{className:"px-3 py-1 bg-bg/40 dark:bg-black/40 backdrop-blur-md border border-ink/10 dark:border-white/10 rounded-full text-[10px] font-mono text-ink/80 dark:text-white/80 transition-colors duration-500",children:i.language||"ML"})}),H.jsxs("div",{className:"h-full overflow-hidden relative",children:[H.jsx("img",{src:e,alt:i.title,className:"w-full h-full object-cover grayscale group-hover:grayscale-0 group-hover:scale-105 transition-all duration-1000 ease-out",referrerPolicy:"no-referrer"}),H.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-bg via-transparent to-transparent opacity-80 transition-colors duration-500"}),H.jsx("div",{className:"absolute bottom-0 left-0 w-full p-10",children:H.jsxs("div",{className:"flex items-end justify-between gap-6",children:[H.jsxs("div",{className:"max-w-md",children:[H.jsx("h3",{className:"text-4xl md:text-5xl font-display font-black text-ink dark:text-white uppercase leading-none mb-4 group-hover:text-violet transition-colors duration-500",children:i.title}),H.jsx("p",{className:"text-muted text-sm line-clamp-2 font-body transition-colors duration-500",children:i.description})]}),H.jsxs("div",{className:"flex gap-3",children:[H.jsx("a",{href:i.url,target:"_blank",className:"w-12 h-12 rounded-full border border-ink/10 dark:border-white/10 flex items-center justify-center text-ink dark:text-white hover:bg-ink dark:hover:bg-white hover:text-bg transition-all duration-500","data-cursor":"button",children:H.jsx(EQ,{size:20})}),H.jsx("a",{href:i.url,target:"_blank",className:"w-12 h-12 rounded-full bg-violet flex items-center justify-center text-white hover:scale-110 transition-all duration-500","data-cursor":"button",children:H.jsx(gF,{size:20})})]})]})})]})]})})}function IJ({data:i}){const e=ae.useRef(null),{scrollYProgress:t}=Q6({target:e}),n=Cv(t,[0,1],["0%","-62%"]);Rv(t,{stiffness:100,damping:30});const[r,s]=ae.useState(0);return ae.useEffect(()=>t.on("change",a=>{s(Math.round(a*100))}),[t]),H.jsx("section",{id:"projects",ref:e,className:"relative h-[500vh] bg-bg",children:H.jsxs("div",{className:"sticky top-0 h-screen flex flex-col justify-center overflow-hidden",children:[H.jsx(sg,{}),H.jsx("div",{className:"max-w-7xl mx-auto px-6 w-full mb-12 flex flex-col md:flex-row md:items-end justify-between gap-8",children:H.jsxs("div",{children:[H.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[H.jsx("div",{className:"w-12 h-[1px] bg-violet"}),H.jsx("span",{className:"font-mono text-xs text-violet tracking-widest",children:"05 / WORKS"})]}),H.jsxs("h2",{className:"text-6xl md:text-8xl font-display font-black text-ink dark:text-white uppercase leading-[0.85] transition-colors duration-500",children:["CURATED ",H.jsx("br",{})," PORTFOLIO."]})]})}),H.jsxs(mr.div,{style:{x:n},className:"flex px-6 md:px-[10vw]",children:[i.projects.map(a=>H.jsx(LJ,{project:a},a.id)),H.jsx("div",{className:"min-w-[400px] md:min-w-[600px] h-[70vh] px-4",children:H.jsxs("a",{href:"https://github.com/Ruthik27",target:"_blank",rel:"noopener noreferrer",className:"h-full glass rounded-[2rem] border border-dashed border-ink/20 dark:border-white/20 flex flex-col items-center justify-center group cursor-pointer transition-all duration-500","data-cursor":"button",children:[H.jsx("div",{className:"w-24 h-24 rounded-full border border-ink/10 dark:border-white/10 flex items-center justify-center group-hover:bg-ink dark:group-hover:bg-white group-hover:text-bg dark:group-hover:text-black transition-all duration-500",children:H.jsx(gQ,{size:40,className:"group-hover:translate-x-2 transition-transform"})}),H.jsx("h3",{className:"mt-8 text-2xl font-display font-bold text-ink dark:text-white uppercase tracking-widest transition-colors duration-500",children:"View All Repos"}),H.jsx("p",{className:"mt-2 text-muted font-mono text-xs uppercase tracking-widest transition-colors duration-500",children:"Github.com/Ruthik27"})]})})]}),H.jsxs("div",{className:"absolute bottom-12 left-0 w-full px-6 md:px-12 flex items-center justify-between",children:[H.jsxs("div",{className:"flex items-center gap-6",children:[H.jsx("div",{className:"w-48 h-[2px] bg-ink/10 dark:bg-white/5 relative overflow-hidden transition-colors duration-500",children:H.jsx(mr.div,{className:"absolute top-0 left-0 h-full bg-violet",style:{scaleX:t,transformOrigin:"left"}})}),H.jsxs("span",{className:"font-mono text-[10px] text-muted tracking-widest uppercase transition-colors duration-500",children:[r,"% EXPLORED"]})]}),H.jsxs("div",{className:"flex items-center gap-4",children:[H.jsxs("span",{className:"font-mono text-[10px] text-muted tracking-widest uppercase transition-colors duration-500",children:["REPOS: ",i.projects.length,"+"]}),H.jsx("div",{className:"w-10 h-10 rounded-full border border-ink/10 dark:border-white/10 flex items-center justify-center transition-colors duration-500",children:H.jsx("div",{className:"w-1 h-1 bg-ink dark:bg-white rounded-full transition-colors duration-500"})})]})]})]})})}function PJ({data:i}){const[e,t]=ae.useState(null),[n,r]=ae.useState({top:!0,left:!0}),s=ae.useRef(null),a=i!=null&&i.certifications?[...i.certifications].sort((h,p)=>h.categoryp.category?1:new Date(p.issued).getTime()-new Date(h.issued).getTime()):[],l=(h,p)=>{const g=h.currentTarget.getBoundingClientRect(),v=window.innerHeight,x=window.innerWidth,b=g.top>v*.3,w=g.left>x*.5;r({top:!b,left:!w}),t(p)},c=h=>{const p=h.toLowerCase();return p.includes("aws")||p.includes("amazon")?"https://upload.wikimedia.org/wikipedia/commons/9/93/Amazon_Web_Services_Logo.svg":p.includes("google")?"https://upload.wikimedia.org/wikipedia/commons/c/c1/Google_%22G%22_logo.svg":p.includes("oracle")?"https://upload.wikimedia.org/wikipedia/commons/thumb/5/50/Oracle_logo.svg/1200px-Oracle_logo.svg.png":p.includes("cisco")?"https://www.logo.wine/a/logo/Cisco_Systems/Cisco_Systems-Logo.wine.svg":p.includes("vmware")?"https://www.logo.wine/a/logo/VMware/VMware-Logo.wine.svg":p.includes("coursera")?"https://cdn.brandfetch.io/idTHfL51P-/theme/dark/logo.svg?c=1bxid64Mup7aczewSAYMX&t=1667591275475":p.includes("udemy")?"https://www.logo.wine/a/logo/Udemy/Udemy-Logo.wine.svg":p.includes("university of michigan")?"https://www.logo.wine/a/logo/University_of_Michigan/University_of_Michigan-Logo.wine.svg":p.includes("johns hopkins")?"https://www.logo.wine/a/logo/Johns_Hopkins_University/Johns_Hopkins_University-Logo.wine.svg":p.includes("sololearn")?"https://upload.wikimedia.org/wikipedia/commons/5/53/SoloLearn_logo.svg":p.includes("mathworks")?"https://upload.wikimedia.org/wikipedia/commons/thumb/2/21/Matlab_Logo.png/1200px-Matlab_Logo.png":null};return H.jsxs("section",{ref:s,id:"certifications",className:"py-32 px-8 md:px-12 bg-bg relative z-[50] transition-colors duration-500",children:[H.jsx(sg,{}),H.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[800px] h-[800px] bg-cyan/10 dark:bg-cyan/5 rounded-full blur-[120px] pointer-events-none"}),H.jsxs("div",{className:"max-w-7xl mx-auto relative z-10",children:[H.jsxs("div",{className:"flex flex-col md:flex-row md:items-end justify-between mb-20 gap-8",children:[H.jsxs("div",{children:[H.jsx("h2",{className:"font-mono text-cyan text-sm tracking-[0.3em] uppercase mb-4",children:"06 / CERTIFICATIONS"}),H.jsxs("h3",{className:"font-display text-5xl md:text-7xl font-bold uppercase tracking-tighter text-ink transition-colors duration-500",children:["Neural ",H.jsx("span",{className:"italic font-light text-muted transition-colors duration-500",children:"Badges"})]})]}),H.jsx("p",{className:"max-w-md text-muted font-sans text-lg transition-colors duration-500",children:"A collection of verified technical proficiencies across Machine Learning, Cloud Architecture, and Data Science."})]}),H.jsx("div",{className:"flex flex-wrap gap-x-2 gap-y-8 md:gap-x-4 md:gap-y-12 justify-center max-w-5xl mx-auto",children:a.map((h,p)=>{const g=c(h.issuer),v=h.issuer.toLowerCase().includes("udemy")||h.issuer.toLowerCase().includes("vmware")||h.issuer.toLowerCase().includes("university of michigan")||h.issuer.toLowerCase().includes("johns hopkins")||h.issuer.toLowerCase().includes("sololearn")||h.issuer.toLowerCase().includes("coursera")||h.issuer.toLowerCase().includes("oracle")||h.issuer.toLowerCase().includes("cisco");return H.jsxs("div",{className:"relative group",onMouseEnter:x=>l(x,h),onMouseLeave:()=>t(null),children:[H.jsxs(mr.div,{initial:{opacity:0,scale:.8},whileInView:{opacity:1,scale:1},whileHover:{scale:1.1,rotate:2,y:-5},viewport:{once:!0},transition:{duration:.5,delay:p*.02,scale:{type:"spring",stiffness:300,damping:15}},className:"w-28 h-32 md:w-36 md:h-40 relative flex items-center justify-center z-10",style:{clipPath:"polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%)"},children:[H.jsx("div",{className:"absolute inset-0 bg-black/5 dark:bg-white/10 transition-colors duration-500",style:{clipPath:"polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%)"}}),H.jsx("div",{className:"absolute inset-[1px] bg-white transition-colors duration-500 shadow-inner",style:{clipPath:"polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%)"}}),H.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-cyan/20 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-500"}),H.jsx("div",{className:"absolute inset-0 opacity-0 group-hover:opacity-100 transition-opacity duration-1000 pointer-events-none overflow-hidden",style:{clipPath:"inherit"},children:H.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-cyan/20 dark:via-white/20 to-transparent -translate-x-full group-hover:animate-[shimmer_2s_infinite]"})}),H.jsxs("div",{className:"relative z-10 text-center p-4 flex flex-col items-center justify-center h-full",children:[g?H.jsxs("div",{className:"relative mb-3 group-hover:scale-110 transition-transform duration-500",children:[H.jsx("div",{className:"absolute inset-0 bg-cyan/10 dark:bg-cyan/20 rounded-full blur-xl opacity-0 group-hover:opacity-100 transition-opacity duration-500"}),H.jsx("img",{src:g,alt:h.issuer,className:"w-12 h-12 md:w-16 md:h-16 object-contain relative z-10 transition-all duration-500 drop-shadow-[0_4px_12px_rgba(0,0,0,0.08)] dark:drop-shadow-[0_0_8px_rgba(255,255,255,0.2)]",style:{transform:v?"scale(2.0)":void 0},referrerPolicy:"no-referrer"})]}):H.jsx("div",{className:"font-mono text-[8px] md:text-[10px] text-cyan mb-1 uppercase tracking-tighter opacity-70",children:h.issuer.split(" ")[0]}),H.jsx("h5",{className:"font-display text-[8px] md:text-[10px] font-bold text-black/70 group-hover:text-black leading-tight uppercase line-clamp-2 max-w-[85%] transition-colors duration-500",children:h.name})]}),H.jsx("svg",{className:"absolute inset-0 w-full h-full pointer-events-none",viewBox:"0 0 100 115",children:H.jsx("path",{d:"M50 2L98 28V87L50 113L2 87V28L50 2Z",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"text-black/5 dark:text-white/10 group-hover:text-cyan transition-colors duration-500",strokeDasharray:"400",strokeDashoffset:"400"})})]}),H.jsx(jb,{children:e===h&&H.jsxs(mr.div,{initial:{opacity:0,y:n.top?20:-20,scale:.9,filter:"blur(10px)"},animate:{opacity:1,y:0,scale:1,filter:"blur(0px)"},exit:{opacity:0,y:n.top?20:-20,scale:.9,filter:"blur(10px)"},className:`absolute z-[100] w-80 p-6 glass rounded-3xl pointer-events-auto transition-all duration-500 ${n.top?"top-full mt-6":"bottom-full mb-6"} ${n.left?"left-1/2 -translate-x-1/2":"right-0"} `,children:[H.jsx("div",{className:`absolute left-1/2 -translate-x-1/2 w-4 h-4 bg-white/80 dark:bg-black/80 backdrop-blur-md border-l border-t border-white/40 dark:border-white/10 rotate-45 transition-colors duration-500 ${n.top?"-top-2":"-bottom-2"} `}),H.jsxs("div",{className:"flex items-start justify-between mb-6",children:[H.jsxs("div",{className:"flex items-center gap-3",children:[g&&H.jsx("div",{className:"p-2 bg-black/5 dark:bg-white/5 rounded-xl transition-colors duration-500",children:H.jsx("img",{src:g,alt:h.issuer,className:"w-8 h-8 object-contain",style:{transform:v?"scale(2.0)":void 0},referrerPolicy:"no-referrer"})}),H.jsxs("div",{children:[H.jsx("div",{className:"font-mono text-[10px] text-cyan uppercase tracking-wider",children:h.issuer}),H.jsxs("div",{className:"font-mono text-[9px] text-muted uppercase transition-colors duration-500",children:["Issued ",h.issued]})]})]}),H.jsx("div",{className:"px-2 py-1 bg-cyan/10 border border-cyan/20 rounded text-[8px] font-mono text-cyan uppercase tracking-tighter",children:h.category})]}),H.jsx("h6",{className:"font-display text-xl font-bold text-ink dark:text-white mb-3 leading-tight uppercase tracking-tight transition-colors duration-500",children:h.name}),H.jsxs("div",{className:"flex flex-col gap-4",children:[h.show_credential_url&&H.jsxs("a",{href:h.show_credential_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center gap-2 py-3 bg-violet text-white font-mono text-[10px] uppercase font-bold rounded-xl hover:bg-cyan hover:text-black transition-all duration-300 group/btn shadow-[0_10px_20px_rgba(255,97,32,0.2)]",children:["View Credential",H.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"transition-transform group-hover/btn:translate-x-1",children:H.jsx("path",{d:"M1 11L11 1M11 1H1M11 1V11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),H.jsxs("div",{className:"pt-4 border-t border-black/5 dark:border-white/5 flex items-center justify-between transition-colors duration-500",children:[H.jsxs("div",{className:"flex flex-col",children:[H.jsx("span",{className:"font-mono text-[9px] text-muted uppercase tracking-wider transition-colors duration-500",children:"Verified Status"}),H.jsx("span",{className:"font-mono text-[8px] text-cyan uppercase",children:"Authentic Record"})]}),H.jsxs("div",{className:"flex gap-1.5",children:[H.jsx("div",{className:"w-2 h-2 rounded-full bg-cyan animate-pulse shadow-[0_0_10px_rgba(255,183,77,0.5)]"}),H.jsx("div",{className:"w-2 h-2 rounded-full bg-violet animate-pulse delay-150 shadow-[0_0_10px_rgba(255,97,32,0.5)]"})]})]})]})]})})]},h.name+p)})})]}),H.jsx("style",{dangerouslySetInnerHTML:{__html:` @keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } } .animate-\\[shimmer_2s_infinite\\] { animation: shimmer 2s infinite; } `}})]})}function OJ({data:i}){return H.jsxs("section",{id:"contact",className:"relative py-32 px-6 overflow-hidden transition-colors duration-500",children:[H.jsx(sg,{}),H.jsxs("div",{className:"max-w-7xl mx-auto relative z-10",children:[H.jsxs("div",{className:"mb-20 flex items-center gap-4",children:[H.jsx("div",{className:"w-12 h-[1px] bg-violet"}),H.jsx("span",{className:"font-mono text-xs text-violet tracking-widest uppercase",children:"07 / CONNECT"})]}),H.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-20",children:[H.jsx("div",{className:"flex flex-col justify-between",children:H.jsxs("div",{children:[H.jsxs("h2",{className:"text-6xl md:text-8xl font-display font-black text-ink uppercase leading-[0.85] mb-12",children:["Let's build ",H.jsx("br",{})," the ",H.jsx("span",{className:"text-violet",children:"future."})]}),H.jsxs("div",{className:"space-y-12",children:[H.jsxs("div",{className:"group cursor-pointer",children:[H.jsx("span",{className:"text-[10px] font-mono text-violet uppercase tracking-[0.3em] mb-4 block",children:"Direct Line"}),H.jsxs("a",{href:`mailto:${i.identity.email}`,className:"text-3xl md:text-5xl font-display font-black text-ink hover:text-violet transition-all flex items-center gap-4","data-cursor":"text",children:[i.identity.email,H.jsx($w,{size:32,className:"text-violet opacity-0 group-hover:opacity-100 transition-opacity"})]})]}),H.jsxs("div",{className:"flex flex-wrap gap-12",children:[H.jsxs("div",{className:"flex flex-col gap-4",children:[H.jsx("span",{className:"text-[10px] font-mono text-muted uppercase tracking-widest",children:"Socials"}),H.jsxs("div",{className:"flex gap-6",children:[H.jsxs("a",{href:i.identity.linkedin,target:"_blank",className:"text-sm font-mono text-ink hover:text-violet transition-colors flex items-center gap-2",children:["LINKEDIN ",H.jsx($w,{size:14})]}),H.jsxs("a",{href:i.identity.github,target:"_blank",className:"text-sm font-mono text-ink hover:text-violet transition-colors flex items-center gap-2",children:["GITHUB ",H.jsx($w,{size:14})]})]})]}),H.jsxs("div",{className:"flex flex-col gap-4",children:[H.jsx("span",{className:"text-[10px] font-mono text-muted uppercase tracking-widest",children:"Location"}),H.jsx("span",{className:"text-sm font-mono text-ink uppercase",children:i.identity.location})]})]})]})]})}),H.jsxs("div",{className:"glass p-8 md:p-12 rounded-[2.5rem] border border-white/5 relative overflow-hidden",children:[H.jsx("div",{className:"absolute -bottom-10 -right-10 text-white/5 font-display font-black text-9xl pointer-events-none",children:"HI"}),H.jsxs("form",{action:"https://formspree.io/f/xgonggqe",method:"POST",className:"space-y-12 relative z-10",children:[H.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-12",children:[H.jsxs("div",{className:"relative group",children:[H.jsx("input",{type:"text",name:"name",required:!0,className:"w-full bg-transparent border-b border-white/10 py-4 text-ink placeholder:text-muted focus:outline-none focus:border-violet transition-colors peer"}),H.jsx("label",{className:"absolute left-0 top-4 text-muted font-mono text-[10px] uppercase tracking-widest transition-all peer-focus:-top-4 peer-focus:text-violet peer-valid:-top-4",children:"Full Name"})]}),H.jsxs("div",{className:"relative group",children:[H.jsx("input",{type:"email",name:"email",required:!0,className:"w-full bg-transparent border-b border-white/10 py-4 text-ink placeholder:text-muted focus:outline-none focus:border-violet transition-colors peer"}),H.jsx("label",{className:"absolute left-0 top-4 text-muted font-mono text-[10px] uppercase tracking-widest transition-all peer-focus:-top-4 peer-focus:text-violet peer-valid:-top-4",children:"Email Address"})]})]}),H.jsxs("div",{className:"relative group",children:[H.jsx("textarea",{name:"message",required:!0,rows:4,className:"w-full bg-transparent border-b border-white/10 py-4 text-ink placeholder:text-muted focus:outline-none focus:border-violet transition-colors resize-none peer"}),H.jsx("label",{className:"absolute left-0 top-4 text-muted font-mono text-[10px] uppercase tracking-widest transition-all peer-focus:-top-4 peer-focus:text-violet peer-valid:-top-4",children:"Your Message"})]}),H.jsxs("button",{type:"submit",className:"group relative w-full py-8 bg-violet text-white font-display font-black uppercase tracking-widest text-sm overflow-hidden rounded-2xl transition-all hover:scale-[1.02] active:scale-[0.98]","data-cursor":"button",children:[H.jsxs("div",{className:"relative z-10 flex items-center justify-center gap-4",children:["DISPATCH MESSAGE ",H.jsx(IQ,{size:18,className:"group-hover:translate-x-1 group-hover:-translate-y-1 transition-transform"})]}),H.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-1000"})]})]})]})]})]})]})}function FJ({data:i}){return H.jsx("footer",{className:"py-8 border-t border-white/5 bg-bg2",children:H.jsxs("div",{className:"max-w-7xl mx-auto px-6 md:px-12 flex flex-col md:flex-row justify-between items-center gap-12",children:[H.jsxs("div",{className:"flex flex-col gap-4",children:[H.jsxs("div",{className:"font-display font-bold text-2xl text-white",children:["RK",H.jsx("span",{className:"text-violet",children:"."})]}),H.jsxs("div",{className:"space-y-1",children:[H.jsx("p",{className:"font-mono text-[10px] text-ink/60 tracking-widest uppercase",children:"Made with intent, built with AI."}),H.jsx("p",{className:"font-mono text-[10px] text-violet tracking-widest uppercase",children:"From idea to shipped in 2:49:00"})]})]}),H.jsxs("div",{className:"flex flex-col md:items-center gap-6",children:[H.jsxs("div",{className:"flex gap-8",children:[H.jsx("a",{href:i.identity.github,className:"text-[10px] font-mono text-muted hover:text-white transition-colors tracking-widest",children:"GITHUB"}),H.jsx("a",{href:i.identity.linkedin,className:"text-[10px] font-mono text-muted hover:text-white transition-colors tracking-widest",children:"LINKEDIN"})]}),H.jsxs("p",{className:"font-mono text-[9px] text-muted/40 tracking-[0.3em] uppercase",children:["© 2026 ",i.identity.name]})]}),H.jsxs("div",{className:"md:text-right space-y-2",children:[H.jsxs("div",{className:"flex items-center md:justify-end gap-2",children:[H.jsx("div",{className:"w-2 h-2 rounded-full bg-emerald-500 animate-pulse"}),H.jsx("p",{className:"font-mono text-[10px] text-ink uppercase tracking-widest",children:i.identity.location})]}),H.jsxs("p",{className:"font-mono text-[10px] text-muted uppercase tracking-widest",children:[new Date().toLocaleTimeString("en-US",{hour12:!0,hour:"2-digit",minute:"2-digit"})," PST"]})]})]})})}function kJ({theme:i}){const e=ae.useRef(null);Gs(n=>{const r=n.clock.getElapsedTime();e.current.rotation.y=r*.4,e.current.rotation.x=Math.sin(r*.5)*.2});const t=i==="dark"?"#FF6120":"#20BEFF";return H.jsx(vC,{speed:3,rotationIntensity:1,floatIntensity:1,children:H.jsxs("group",{ref:e,children:[H.jsxs("mesh",{children:[H.jsx("octahedronGeometry",{args:[.7,0]}),H.jsx("meshStandardMaterial",{color:t,emissive:t,emissiveIntensity:1.5,metalness:.8,roughness:.2})]}),H.jsxs("mesh",{children:[H.jsx("icosahedronGeometry",{args:[1.3,1]}),H.jsx("meshStandardMaterial",{color:t,wireframe:!0,transparent:!0,opacity:.2})]}),[...Array(8)].map((n,r)=>{const s=r/8*Math.PI*2,a=1.5;return H.jsxs("mesh",{position:[Math.cos(s)*a,Math.sin(s*1.5)*.6,Math.sin(s)*a],children:[H.jsx("boxGeometry",{args:[.15,.15,.15]}),H.jsx("meshStandardMaterial",{color:t,emissive:t,emissiveIntensity:.8})]},r)})]})})}function zJ({theme:i,resumeUrl:e}){const[t,n]=ae.useState(!1),r=i==="dark"?"rgba(255, 97, 32, 0.4)":"rgba(32, 190, 255, 0.4)",s=i==="dark"?"bg-violet":"bg-cyan";return H.jsxs("div",{className:"fixed bottom-8 right-8 z-[999] flex flex-col items-end gap-4",children:[H.jsx(jb,{children:t&&H.jsxs(mr.div,{initial:{opacity:0,scale:.8,y:20,filter:"blur(10px)"},animate:{opacity:1,scale:1,y:0,filter:"blur(0px)"},exit:{opacity:0,scale:.8,y:20,filter:"blur(10px)"},className:"glass p-6 rounded-3xl w-64 shadow-2xl relative overflow-hidden",children:[H.jsx("div",{className:"absolute -top-10 -right-10 w-32 h-32 rounded-full blur-3xl pointer-events-none",style:{backgroundColor:r}}),H.jsxs("div",{className:"relative z-10",children:[H.jsxs("div",{className:"flex items-center justify-between mb-4",children:[H.jsx("span",{className:"font-mono text-[10px] text-muted uppercase tracking-widest",children:"Curriculum Vitae"}),H.jsx("button",{onClick:()=>n(!1),className:"text-muted hover:text-ink transition-colors",children:H.jsx(gE,{size:16})})]}),H.jsx("h4",{className:"font-display text-xl font-bold text-ink mb-2",children:"Resume 2024"}),H.jsx("p",{className:"text-xs text-muted mb-6 leading-relaxed",children:"Machine Learning Specialist with expertise in MLOps and Predictive Analytics."}),H.jsxs("a",{href:e,download:!0,className:`flex items-center justify-center gap-2 w-full py-3 ${s} text-white rounded-xl font-mono text-[10px] font-bold uppercase tracking-widest hover:opacity-90 transition-all group`,children:["Download PDF",H.jsx(MQ,{size:14,className:"group-hover:translate-y-0.5 transition-transform"})]})]})]})}),H.jsxs(mr.button,{onClick:()=>n(!t),whileHover:{scale:1.05},whileTap:{scale:.95},className:"relative w-20 h-20 rounded-full glass border border-white/10 flex items-center justify-center group overflow-hidden","data-cursor":"button",children:[H.jsx("div",{className:"absolute inset-0 opacity-40 blur-xl group-hover:opacity-60 transition-opacity",style:{backgroundColor:r}}),H.jsx("div",{className:"absolute inset-0 pointer-events-none",children:H.jsxs(by,{children:[H.jsx(mC,{makeDefault:!0,position:[0,0,4]}),H.jsx("ambientLight",{intensity:.5}),H.jsx("pointLight",{position:[10,10,10],intensity:1}),H.jsx(kJ,{theme:i})]})}),H.jsxs("div",{className:`relative z-10 transition-all duration-500 flex flex-col items-center ${t?"rotate-90 opacity-0 scale-0":"rotate-0 opacity-100 scale-100"}`,children:[H.jsx("span",{className:"font-display font-bold text-2xl text-ink tracking-tighter leading-none",children:"CV"}),H.jsx("div",{className:"w-6 h-[1px] bg-violet/50 mt-1"})]}),H.jsx("div",{className:`absolute z-10 transition-all duration-500 ${t?"rotate-0 opacity-100 scale-100":"-rotate-90 opacity-0 scale-0"}`,children:H.jsx(gE,{size:24,className:"text-ink"})})]})]})}function BJ(){const[i,e]=ae.useState(null),[t,n]=ae.useState("dark");ae.useEffect(()=>{document.documentElement.classList.add("dark"),fetch("/ruthik_data.json").then(l=>l.json()).then(l=>e(l));const s=new Uk;function a(l){s.raf(l),requestAnimationFrame(a)}requestAnimationFrame(a)},[]);const r=()=>{n(t==="dark"?"light":"dark"),document.documentElement.classList.toggle("light"),document.documentElement.classList.toggle("dark")};return i?H.jsxs("div",{className:"relative",children:[H.jsx(uQ,{}),H.jsx(x8,{}),H.jsx(_8,{}),H.jsx(FQ,{theme:t,toggleTheme:r}),H.jsxs("main",{children:[H.jsx(_J,{data:i}),H.jsx(bJ,{items:i.marquee}),H.jsx(AJ,{data:i}),H.jsx(RJ,{data:i}),H.jsx(DJ,{data:i}),H.jsx(UJ,{data:i}),H.jsx(IJ,{data:i}),H.jsx(PJ,{data:i}),H.jsx(OJ,{data:i})]}),H.jsx(zJ,{theme:t,resumeUrl:i.identity.resume||"/resume.pdf"}),H.jsx(FJ,{data:i})]}):null}Mk.createRoot(document.getElementById("root")).render(H.jsx(ae.StrictMode,{children:H.jsx(BJ,{})}));