Files
shengsuan-homepage/dist/assets/index-DHgtFENf.js
T

4281 lines
806 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))a(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&a(u)}).observe(document,{childList:!0,subtree:!0});function n(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function a(o){if(o.ep)return;o.ep=!0;const c=n(o);fetch(o.href,c)}})();var Ld={exports:{}},Sl={};var Fv;function N1(){if(Fv)return Sl;Fv=1;var r=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,o,c){var u=null;if(c!==void 0&&(u=""+c),o.key!==void 0&&(u=""+o.key),"key"in o){c={};for(var d in o)d!=="key"&&(c[d]=o[d])}else c=o;return o=c.ref,{$$typeof:r,type:a,key:u,ref:o!==void 0?o:null,props:c}}return Sl.Fragment=t,Sl.jsx=n,Sl.jsxs=n,Sl}var Hv;function O1(){return Hv||(Hv=1,Ld.exports=N1()),Ld.exports}var It=O1(),Ud={exports:{}},ye={};var Gv;function P1(){if(Gv)return ye;Gv=1;var r=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),g=Symbol.iterator;function y(I){return I===null||typeof I!="object"?null:(I=g&&I[g]||I["@@iterator"],typeof I=="function"?I:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A=Object.assign,x={};function S(I,J,bt){this.props=I,this.context=J,this.refs=x,this.updater=bt||E}S.prototype.isReactComponent={},S.prototype.setState=function(I,J){if(typeof I!="object"&&typeof I!="function"&&I!=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,I,J,"setState")},S.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function D(){}D.prototype=S.prototype;function U(I,J,bt){this.props=I,this.context=J,this.refs=x,this.updater=bt||E}var w=U.prototype=new D;w.constructor=U,A(w,S.prototype),w.isPureReactComponent=!0;var B=Array.isArray;function N(){}var P={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function O(I,J,bt){var Lt=bt.ref;return{$$typeof:r,type:I,key:J,ref:Lt!==void 0?Lt:null,props:bt}}function W(I,J){return O(I.type,J,I.props)}function k(I){return typeof I=="object"&&I!==null&&I.$$typeof===r}function Q(I){var J={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(bt){return J[bt]})}var dt=/\/+/g;function vt(I,J){return typeof I=="object"&&I!==null&&I.key!=null?Q(""+I.key):J.toString(36)}function Z(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(N,N):(I.status="pending",I.then(function(J){I.status==="pending"&&(I.status="fulfilled",I.value=J)},function(J){I.status==="pending"&&(I.status="rejected",I.reason=J)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function F(I,J,bt,Lt,Ht){var st=typeof I;(st==="undefined"||st==="boolean")&&(I=null);var St=!1;if(I===null)St=!0;else switch(st){case"bigint":case"string":case"number":St=!0;break;case"object":switch(I.$$typeof){case r:case t:St=!0;break;case _:return St=I._init,F(St(I._payload),J,bt,Lt,Ht)}}if(St)return Ht=Ht(I),St=Lt===""?"."+vt(I,0):Lt,B(Ht)?(bt="",St!=null&&(bt=St.replace(dt,"$&/")+"/"),F(Ht,J,bt,"",function(ge){return ge})):Ht!=null&&(k(Ht)&&(Ht=W(Ht,bt+(Ht.key==null||I&&I.key===Ht.key?"":(""+Ht.key).replace(dt,"$&/")+"/")+St)),J.push(Ht)),1;St=0;var Et=Lt===""?".":Lt+":";if(B(I))for(var Yt=0;Yt<I.length;Yt++)Lt=I[Yt],st=Et+vt(Lt,Yt),St+=F(Lt,J,bt,st,Ht);else if(Yt=y(I),typeof Yt=="function")for(I=Yt.call(I),Yt=0;!(Lt=I.next()).done;)Lt=Lt.value,st=Et+vt(Lt,Yt++),St+=F(Lt,J,bt,st,Ht);else if(st==="object"){if(typeof I.then=="function")return F(Z(I),J,bt,Lt,Ht);throw J=String(I),Error("Objects are not valid as a React child (found: "+(J==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":J)+"). If you meant to render a collection of children, use an array instead.")}return St}function V(I,J,bt){if(I==null)return I;var Lt=[],Ht=0;return F(I,Lt,"","",function(st){return J.call(bt,st,Ht++)}),Lt}function et(I){if(I._status===-1){var J=I._result;J=J(),J.then(function(bt){(I._status===0||I._status===-1)&&(I._status=1,I._result=bt)},function(bt){(I._status===0||I._status===-1)&&(I._status=2,I._result=bt)}),I._status===-1&&(I._status=0,I._result=J)}if(I._status===1)return I._result.default;throw I._result}var mt=typeof reportError=="function"?reportError:function(I){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var J=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof I=="object"&&I!==null&&typeof I.message=="string"?String(I.message):String(I),error:I});if(!window.dispatchEvent(J))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",I);return}console.error(I)},At={map:V,forEach:function(I,J,bt){V(I,function(){J.apply(this,arguments)},bt)},count:function(I){var J=0;return V(I,function(){J++}),J},toArray:function(I){return V(I,function(J){return J})||[]},only:function(I){if(!k(I))throw Error("React.Children.only expected to receive a single React element child.");return I}};return ye.Activity=v,ye.Children=At,ye.Component=S,ye.Fragment=n,ye.Profiler=o,ye.PureComponent=U,ye.StrictMode=a,ye.Suspense=m,ye.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=P,ye.__COMPILER_RUNTIME={__proto__:null,c:function(I){return P.H.useMemoCache(I)}},ye.cache=function(I){return function(){return I.apply(null,arguments)}},ye.cacheSignal=function(){return null},ye.cloneElement=function(I,J,bt){if(I==null)throw Error("The argument must be a React element, but you passed "+I+".");var Lt=A({},I.props),Ht=I.key;if(J!=null)for(st in J.key!==void 0&&(Ht=""+J.key),J)!T.call(J,st)||st==="key"||st==="__self"||st==="__source"||st==="ref"&&J.ref===void 0||(Lt[st]=J[st]);var st=arguments.length-2;if(st===1)Lt.children=bt;else if(1<st){for(var St=Array(st),Et=0;Et<st;Et++)St[Et]=arguments[Et+2];Lt.children=St}return O(I.type,Ht,Lt)},ye.createContext=function(I){return I={$$typeof:u,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null},I.Provider=I,I.Consumer={$$typeof:c,_context:I},I},ye.createElement=function(I,J,bt){var Lt,Ht={},st=null;if(J!=null)for(Lt in J.key!==void 0&&(st=""+J.key),J)T.call(J,Lt)&&Lt!=="key"&&Lt!=="__self"&&Lt!=="__source"&&(Ht[Lt]=J[Lt]);var St=arguments.length-2;if(St===1)Ht.children=bt;else if(1<St){for(var Et=Array(St),Yt=0;Yt<St;Yt++)Et[Yt]=arguments[Yt+2];Ht.children=Et}if(I&&I.defaultProps)for(Lt in St=I.defaultProps,St)Ht[Lt]===void 0&&(Ht[Lt]=St[Lt]);return O(I,st,Ht)},ye.createRef=function(){return{current:null}},ye.forwardRef=function(I){return{$$typeof:d,render:I}},ye.isValidElement=k,ye.lazy=function(I){return{$$typeof:_,_payload:{_status:-1,_result:I},_init:et}},ye.memo=function(I,J){return{$$typeof:p,type:I,compare:J===void 0?null:J}},ye.startTransition=function(I){var J=P.T,bt={};P.T=bt;try{var Lt=I(),Ht=P.S;Ht!==null&&Ht(bt,Lt),typeof Lt=="object"&&Lt!==null&&typeof Lt.then=="function"&&Lt.then(N,mt)}catch(st){mt(st)}finally{J!==null&&bt.types!==null&&(J.types=bt.types),P.T=J}},ye.unstable_useCacheRefresh=function(){return P.H.useCacheRefresh()},ye.use=function(I){return P.H.use(I)},ye.useActionState=function(I,J,bt){return P.H.useActionState(I,J,bt)},ye.useCallback=function(I,J){return P.H.useCallback(I,J)},ye.useContext=function(I){return P.H.useContext(I)},ye.useDebugValue=function(){},ye.useDeferredValue=function(I,J){return P.H.useDeferredValue(I,J)},ye.useEffect=function(I,J){return P.H.useEffect(I,J)},ye.useEffectEvent=function(I){return P.H.useEffectEvent(I)},ye.useId=function(){return P.H.useId()},ye.useImperativeHandle=function(I,J,bt){return P.H.useImperativeHandle(I,J,bt)},ye.useInsertionEffect=function(I,J){return P.H.useInsertionEffect(I,J)},ye.useLayoutEffect=function(I,J){return P.H.useLayoutEffect(I,J)},ye.useMemo=function(I,J){return P.H.useMemo(I,J)},ye.useOptimistic=function(I,J){return P.H.useOptimistic(I,J)},ye.useReducer=function(I,J,bt){return P.H.useReducer(I,J,bt)},ye.useRef=function(I){return P.H.useRef(I)},ye.useState=function(I){return P.H.useState(I)},ye.useSyncExternalStore=function(I,J,bt){return P.H.useSyncExternalStore(I,J,bt)},ye.useTransition=function(){return P.H.useTransition()},ye.version="19.2.3",ye}var Vv;function Tm(){return Vv||(Vv=1,Ud.exports=P1()),Ud.exports}var ht=Tm(),Nd={exports:{}},Ml={},Od={exports:{}},Pd={};var kv;function B1(){return kv||(kv=1,(function(r){function t(F,V){var et=F.length;F.push(V);t:for(;0<et;){var mt=et-1>>>1,At=F[mt];if(0<o(At,V))F[mt]=V,F[et]=At,et=mt;else break t}}function n(F){return F.length===0?null:F[0]}function a(F){if(F.length===0)return null;var V=F[0],et=F.pop();if(et!==V){F[0]=et;t:for(var mt=0,At=F.length,I=At>>>1;mt<I;){var J=2*(mt+1)-1,bt=F[J],Lt=J+1,Ht=F[Lt];if(0>o(bt,et))Lt<At&&0>o(Ht,bt)?(F[mt]=Ht,F[Lt]=et,mt=Lt):(F[mt]=bt,F[J]=et,mt=J);else if(Lt<At&&0>o(Ht,et))F[mt]=Ht,F[Lt]=et,mt=Lt;else break t}}return V}function o(F,V){var et=F.sortIndex-V.sortIndex;return et!==0?et:F.id-V.id}if(r.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;r.unstable_now=function(){return c.now()}}else{var u=Date,d=u.now();r.unstable_now=function(){return u.now()-d}}var m=[],p=[],_=1,v=null,g=3,y=!1,E=!1,A=!1,x=!1,S=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,U=typeof setImmediate<"u"?setImmediate:null;function w(F){for(var V=n(p);V!==null;){if(V.callback===null)a(p);else if(V.startTime<=F)a(p),V.sortIndex=V.expirationTime,t(m,V);else break;V=n(p)}}function B(F){if(A=!1,w(F),!E)if(n(m)!==null)E=!0,N||(N=!0,Q());else{var V=n(p);V!==null&&Z(B,V.startTime-F)}}var N=!1,P=-1,T=5,O=-1;function W(){return x?!0:!(r.unstable_now()-O<T)}function k(){if(x=!1,N){var F=r.unstable_now();O=F;var V=!0;try{t:{E=!1,A&&(A=!1,D(P),P=-1),y=!0;var et=g;try{e:{for(w(F),v=n(m);v!==null&&!(v.expirationTime>F&&W());){var mt=v.callback;if(typeof mt=="function"){v.callback=null,g=v.priorityLevel;var At=mt(v.expirationTime<=F);if(F=r.unstable_now(),typeof At=="function"){v.callback=At,w(F),V=!0;break e}v===n(m)&&a(m),w(F)}else a(m);v=n(m)}if(v!==null)V=!0;else{var I=n(p);I!==null&&Z(B,I.startTime-F),V=!1}}break t}finally{v=null,g=et,y=!1}V=void 0}}finally{V?Q():N=!1}}}var Q;if(typeof U=="function")Q=function(){U(k)};else if(typeof MessageChannel<"u"){var dt=new MessageChannel,vt=dt.port2;dt.port1.onmessage=k,Q=function(){vt.postMessage(null)}}else Q=function(){S(k,0)};function Z(F,V){P=S(function(){F(r.unstable_now())},V)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(F){F.callback=null},r.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):T=0<F?Math.floor(1e3/F):5},r.unstable_getCurrentPriorityLevel=function(){return g},r.unstable_next=function(F){switch(g){case 1:case 2:case 3:var V=3;break;default:V=g}var et=g;g=V;try{return F()}finally{g=et}},r.unstable_requestPaint=function(){x=!0},r.unstable_runWithPriority=function(F,V){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var et=g;g=F;try{return V()}finally{g=et}},r.unstable_scheduleCallback=function(F,V,et){var mt=r.unstable_now();switch(typeof et=="object"&&et!==null?(et=et.delay,et=typeof et=="number"&&0<et?mt+et:mt):et=mt,F){case 1:var At=-1;break;case 2:At=250;break;case 5:At=1073741823;break;case 4:At=1e4;break;default:At=5e3}return At=et+At,F={id:_++,callback:V,priorityLevel:F,startTime:et,expirationTime:At,sortIndex:-1},et>mt?(F.sortIndex=et,t(p,F),n(m)===null&&F===n(p)&&(A?(D(P),P=-1):A=!0,Z(B,et-mt))):(F.sortIndex=At,t(m,F),E||y||(E=!0,N||(N=!0,Q()))),F},r.unstable_shouldYield=W,r.unstable_wrapCallback=function(F){var V=g;return function(){var et=g;g=V;try{return F.apply(this,arguments)}finally{g=et}}}})(Pd)),Pd}var Wv;function I1(){return Wv||(Wv=1,Od.exports=B1()),Od.exports}var Bd={exports:{}},zn={};var Xv;function z1(){if(Xv)return zn;Xv=1;var r=Tm();function t(m){var p="https://react.dev/errors/"+m;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var _=2;_<arguments.length;_++)p+="&args[]="+encodeURIComponent(arguments[_])}return"Minified React error #"+m+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var a={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function c(m,p,_){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:v==null?null:""+v,children:m,containerInfo:p,implementation:_}}var u=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(m,p){if(m==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return zn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,zn.createPortal=function(m,p){var _=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return c(m,p,null,_)},zn.flushSync=function(m){var p=u.T,_=a.p;try{if(u.T=null,a.p=2,m)return m()}finally{u.T=p,a.p=_,a.d.f()}},zn.preconnect=function(m,p){typeof m=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,a.d.C(m,p))},zn.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},zn.preinit=function(m,p){if(typeof m=="string"&&p&&typeof p.as=="string"){var _=p.as,v=d(_,p.crossOrigin),g=typeof p.integrity=="string"?p.integrity:void 0,y=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;_==="style"?a.d.S(m,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:v,integrity:g,fetchPriority:y}):_==="script"&&a.d.X(m,{crossOrigin:v,integrity:g,fetchPriority:y,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},zn.preinitModule=function(m,p){if(typeof m=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var _=d(p.as,p.crossOrigin);a.d.M(m,{crossOrigin:_,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&a.d.M(m)},zn.preload=function(m,p){if(typeof m=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var _=p.as,v=d(_,p.crossOrigin);a.d.L(m,_,{crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},zn.preloadModule=function(m,p){if(typeof m=="string")if(p){var _=d(p.as,p.crossOrigin);a.d.m(m,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:_,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else a.d.m(m)},zn.requestFormReset=function(m){a.d.r(m)},zn.unstable_batchedUpdates=function(m,p){return m(p)},zn.useFormState=function(m,p,_){return u.H.useFormState(m,p,_)},zn.useFormStatus=function(){return u.H.useHostTransitionStatus()},zn.version="19.2.3",zn}var qv;function F1(){if(qv)return Bd.exports;qv=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(t){console.error(t)}}return r(),Bd.exports=z1(),Bd.exports}var Yv;function H1(){if(Yv)return Ml;Yv=1;var r=I1(),t=Tm(),n=F1();function a(e){var i="https://react.dev/errors/"+e;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)i+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+e+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var i=e,s=e;if(e.alternate)for(;i.return;)i=i.return;else{e=i;do i=e,(i.flags&4098)!==0&&(s=i.return),e=i.return;while(e)}return i.tag===3?s:null}function u(e){if(e.tag===13){var i=e.memoizedState;if(i===null&&(e=e.alternate,e!==null&&(i=e.memoizedState)),i!==null)return i.dehydrated}return null}function d(e){if(e.tag===31){var i=e.memoizedState;if(i===null&&(e=e.alternate,e!==null&&(i=e.memoizedState)),i!==null)return i.dehydrated}return null}function m(e){if(c(e)!==e)throw Error(a(188))}function p(e){var i=e.alternate;if(!i){if(i=c(e),i===null)throw Error(a(188));return i!==e?null:e}for(var s=e,l=i;;){var f=s.return;if(f===null)break;var h=f.alternate;if(h===null){if(l=f.return,l!==null){s=l;continue}break}if(f.child===h.child){for(h=f.child;h;){if(h===s)return m(f),e;if(h===l)return m(f),i;h=h.sibling}throw Error(a(188))}if(s.return!==l.return)s=f,l=h;else{for(var M=!1,C=f.child;C;){if(C===s){M=!0,s=f,l=h;break}if(C===l){M=!0,l=f,s=h;break}C=C.sibling}if(!M){for(C=h.child;C;){if(C===s){M=!0,s=h,l=f;break}if(C===l){M=!0,l=h,s=f;break}C=C.sibling}if(!M)throw Error(a(189))}}if(s.alternate!==l)throw Error(a(190))}if(s.tag!==3)throw Error(a(188));return s.stateNode.current===s?e:i}function _(e){var i=e.tag;if(i===5||i===26||i===27||i===6)return e;for(e=e.child;e!==null;){if(i=_(e),i!==null)return i;e=e.sibling}return null}var v=Object.assign,g=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),D=Symbol.for("react.consumer"),U=Symbol.for("react.context"),w=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),O=Symbol.for("react.activity"),W=Symbol.for("react.memo_cache_sentinel"),k=Symbol.iterator;function Q(e){return e===null||typeof e!="object"?null:(e=k&&e[k]||e["@@iterator"],typeof e=="function"?e:null)}var dt=Symbol.for("react.client.reference");function vt(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===dt?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case A:return"Fragment";case S:return"Profiler";case x:return"StrictMode";case B:return"Suspense";case N:return"SuspenseList";case O:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case E:return"Portal";case U:return e.displayName||"Context";case D:return(e._context.displayName||"Context")+".Consumer";case w:var i=e.render;return e=e.displayName,e||(e=i.displayName||i.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case P:return i=e.displayName||null,i!==null?i:vt(e.type)||"Memo";case T:i=e._payload,e=e._init;try{return vt(e(i))}catch{}}return null}var Z=Array.isArray,F=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,et={pending:!1,data:null,method:null,action:null},mt=[],At=-1;function I(e){return{current:e}}function J(e){0>At||(e.current=mt[At],mt[At]=null,At--)}function bt(e,i){At++,mt[At]=e.current,e.current=i}var Lt=I(null),Ht=I(null),st=I(null),St=I(null);function Et(e,i){switch(bt(st,i),bt(Ht,e),bt(Lt,null),i.nodeType){case 9:case 11:e=(e=i.documentElement)&&(e=e.namespaceURI)?lv(e):0;break;default:if(e=i.tagName,i=i.namespaceURI)i=lv(i),e=cv(i,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}J(Lt),bt(Lt,e)}function Yt(){J(Lt),J(Ht),J(st)}function ge(e){e.memoizedState!==null&&bt(St,e);var i=Lt.current,s=cv(i,e.type);i!==s&&(bt(Ht,e),bt(Lt,s))}function se(e){Ht.current===e&&(J(Lt),J(Ht)),St.current===e&&(J(St),_l._currentValue=et)}var kt,Mt;function gt(e){if(kt===void 0)try{throw Error()}catch(s){var i=s.stack.trim().match(/\n( *(at )?)/);kt=i&&i[1]||"",Mt=-1<s.stack.indexOf(`
at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
`+kt+e+Mt}var Ut=!1;function Rt(e,i){if(!e||Ut)return"";Ut=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(i){var yt=function(){throw Error()};if(Object.defineProperty(yt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(yt,[])}catch(ut){var lt=ut}Reflect.construct(e,[],yt)}else{try{yt.call()}catch(ut){lt=ut}e.call(yt.prototype)}}else{try{throw Error()}catch(ut){lt=ut}(yt=e())&&typeof yt.catch=="function"&&yt.catch(function(){})}}catch(ut){if(ut&&lt&&typeof ut.stack=="string")return[ut.stack,lt.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=l.DetermineComponentFrameRoot(),M=h[0],C=h[1];if(M&&C){var G=M.split(`
`),it=C.split(`
`);for(f=l=0;l<G.length&&!G[l].includes("DetermineComponentFrameRoot");)l++;for(;f<it.length&&!it[f].includes("DetermineComponentFrameRoot");)f++;if(l===G.length||f===it.length)for(l=G.length-1,f=it.length-1;1<=l&&0<=f&&G[l]!==it[f];)f--;for(;1<=l&&0<=f;l--,f--)if(G[l]!==it[f]){if(l!==1||f!==1)do if(l--,f--,0>f||G[l]!==it[f]){var pt=`
`+G[l].replace(" at new "," at ");return e.displayName&&pt.includes("<anonymous>")&&(pt=pt.replace("<anonymous>",e.displayName)),pt}while(1<=l&&0<=f);break}}}finally{Ut=!1,Error.prepareStackTrace=s}return(s=e?e.displayName||e.name:"")?gt(s):""}function Jt(e,i){switch(e.tag){case 26:case 27:case 5:return gt(e.type);case 16:return gt("Lazy");case 13:return e.child!==i&&i!==null?gt("Suspense Fallback"):gt("Suspense");case 19:return gt("SuspenseList");case 0:case 15:return Rt(e.type,!1);case 11:return Rt(e.type.render,!1);case 1:return Rt(e.type,!0);case 31:return gt("Activity");default:return""}}function jt(e){try{var i="",s=null;do i+=Jt(e,s),s=e,e=e.return;while(e);return i}catch(l){return`
Error generating stack: `+l.message+`
`+l.stack}}var ee=Object.prototype.hasOwnProperty,ne=r.unstable_scheduleCallback,le=r.unstable_cancelCallback,ve=r.unstable_shouldYield,H=r.unstable_requestPaint,Ft=r.unstable_now,ie=r.unstable_getCurrentPriorityLevel,L=r.unstable_ImmediatePriority,b=r.unstable_UserBlockingPriority,K=r.unstable_NormalPriority,$=r.unstable_LowPriority,tt=r.unstable_IdlePriority,wt=r.log,Ct=r.unstable_setDisableYieldValue,ct=null,ft=null;function Dt(e){if(typeof wt=="function"&&Ct(e),ft&&typeof ft.setStrictMode=="function")try{ft.setStrictMode(ct,e)}catch{}}var Xt=Math.clz32?Math.clz32:ue,Bt=Math.log,Ot=Math.LN2;function ue(e){return e>>>=0,e===0?32:31-(Bt(e)/Ot|0)|0}var he=256,xe=262144,q=4194304;function Nt(e){var i=e&42;if(i!==0)return i;switch(e&-e){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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function _t(e,i,s){var l=e.pendingLanes;if(l===0)return 0;var f=0,h=e.suspendedLanes,M=e.pingedLanes;e=e.warmLanes;var C=l&134217727;return C!==0?(l=C&~h,l!==0?f=Nt(l):(M&=C,M!==0?f=Nt(M):s||(s=C&~e,s!==0&&(f=Nt(s))))):(C=l&~h,C!==0?f=Nt(C):M!==0?f=Nt(M):s||(s=l&~e,s!==0&&(f=Nt(s)))),f===0?0:i!==0&&i!==f&&(i&h)===0&&(h=f&-f,s=i&-i,h>=s||h===32&&(s&4194048)!==0)?i:f}function Pt(e,i){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&i)===0}function Wt(e,i){switch(e){case 1:case 2:case 4:case 8:case 64:return i+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 i+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 Tt(){var e=q;return q<<=1,(q&62914560)===0&&(q=4194304),e}function ae(e){for(var i=[],s=0;31>s;s++)i.push(e);return i}function Kt(e,i){e.pendingLanes|=i,i!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function an(e,i,s,l,f,h){var M=e.pendingLanes;e.pendingLanes=s,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=s,e.entangledLanes&=s,e.errorRecoveryDisabledLanes&=s,e.shellSuspendCounter=0;var C=e.entanglements,G=e.expirationTimes,it=e.hiddenUpdates;for(s=M&~s;0<s;){var pt=31-Xt(s),yt=1<<pt;C[pt]=0,G[pt]=-1;var lt=it[pt];if(lt!==null)for(it[pt]=null,pt=0;pt<lt.length;pt++){var ut=lt[pt];ut!==null&&(ut.lane&=-536870913)}s&=~yt}l!==0&&Ge(e,l,0),h!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=h&~(M&~i))}function Ge(e,i,s){e.pendingLanes|=i,e.suspendedLanes&=~i;var l=31-Xt(i);e.entangledLanes|=i,e.entanglements[l]=e.entanglements[l]|1073741824|s&261930}function ri(e,i){var s=e.entangledLanes|=i;for(e=e.entanglements;s;){var l=31-Xt(s),f=1<<l;f&i|e[l]&i&&(e[l]|=i),s&=~f}}function si(e,i){var s=i&-i;return s=(s&42)!==0?1:Lo(s),(s&(e.suspendedLanes|i))!==0?0:s}function Lo(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;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:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Uo(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function No(){var e=V.p;return e!==0?e:(e=window.event,e===void 0?32:Uv(e.type))}function xs(e,i){var s=V.p;try{return V.p=e,i()}finally{V.p=s}}var Zi=Math.random().toString(36).slice(2),mn="__reactFiber$"+Zi,Ln="__reactProps$"+Zi,Kn="__reactContainer$"+Zi,Nr="__reactEvents$"+Zi,$l="__reactListeners$"+Zi,tc="__reactHandles$"+Zi,Or="__reactResources$"+Zi,qa="__reactMarker$"+Zi;function Ya(e){delete e[mn],delete e[Ln],delete e[Nr],delete e[$l],delete e[tc]}function fa(e){var i=e[mn];if(i)return i;for(var s=e.parentNode;s;){if(i=s[Kn]||s[mn]){if(s=i.alternate,i.child!==null||s!==null&&s.child!==null)for(e=gv(e);e!==null;){if(s=e[mn])return s;e=gv(e)}return i}e=s,s=e.parentNode}return null}function ha(e){if(e=e[mn]||e[Kn]){var i=e.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return e}return null}function Pr(e){var i=e.tag;if(i===5||i===26||i===27||i===6)return e.stateNode;throw Error(a(33))}function Za(e){var i=e[Or];return i||(i=e[Or]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function gn(e){e[qa]=!0}var ec=new Set,R={};function Y(e,i){ot(e,i),ot(e+"Capture",i)}function ot(e,i){for(R[e]=i,e=0;e<i.length;e++)ec.add(i[e])}var at=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),rt={},Gt={};function Zt(e){return ee.call(Gt,e)?!0:ee.call(rt,e)?!1:at.test(e)?Gt[e]=!0:(rt[e]=!0,!1)}function zt(e,i,s){if(Zt(i))if(s===null)e.removeAttribute(i);else{switch(typeof s){case"undefined":case"function":case"symbol":e.removeAttribute(i);return;case"boolean":var l=i.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(i);return}}e.setAttribute(i,""+s)}}function $t(e,i,s){if(s===null)e.removeAttribute(i);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(i);return}e.setAttribute(i,""+s)}}function Qt(e,i,s,l){if(l===null)e.removeAttribute(s);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(s);return}e.setAttributeNS(i,s,""+l)}}function de(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Me(e){var i=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function oe(e,i,s){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,i);if(!e.hasOwnProperty(i)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var f=l.get,h=l.set;return Object.defineProperty(e,i,{configurable:!0,get:function(){return f.call(this)},set:function(M){s=""+M,h.call(this,M)}}),Object.defineProperty(e,i,{enumerable:l.enumerable}),{getValue:function(){return s},setValue:function(M){s=""+M},stopTracking:function(){e._valueTracker=null,delete e[i]}}}}function Pe(e){if(!e._valueTracker){var i=Me(e)?"checked":"value";e._valueTracker=oe(e,i,""+e[i])}}function rn(e){if(!e)return!1;var i=e._valueTracker;if(!i)return!0;var s=i.getValue(),l="";return e&&(l=Me(e)?e.checked?"true":"false":e.value),e=l,e!==s?(i.setValue(e),!0):!1}function $e(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Ve=/[\n"\\]/g;function ke(e){return e.replace(Ve,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function qt(e,i,s,l,f,h,M,C){e.name="",M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?e.type=M:e.removeAttribute("type"),i!=null?M==="number"?(i===0&&e.value===""||e.value!=i)&&(e.value=""+de(i)):e.value!==""+de(i)&&(e.value=""+de(i)):M!=="submit"&&M!=="reset"||e.removeAttribute("value"),i!=null?Re(e,M,de(i)):s!=null?Re(e,M,de(s)):l!=null&&e.removeAttribute("value"),f==null&&h!=null&&(e.defaultChecked=!!h),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?e.name=""+de(C):e.removeAttribute("name")}function In(e,i,s,l,f,h,M,C){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),i!=null||s!=null){if(!(h!=="submit"&&h!=="reset"||i!=null)){Pe(e);return}s=s!=null?""+de(s):"",i=i!=null?""+de(i):s,C||i===e.value||(e.value=i),e.defaultValue=i}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=C?e.checked:!!l,e.defaultChecked=!!l,M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(e.name=M),Pe(e)}function Re(e,i,s){i==="number"&&$e(e.ownerDocument)===e||e.defaultValue===""+s||(e.defaultValue=""+s)}function En(e,i,s,l){if(e=e.options,i){i={};for(var f=0;f<s.length;f++)i["$"+s[f]]=!0;for(s=0;s<e.length;s++)f=i.hasOwnProperty("$"+e[s].value),e[s].selected!==f&&(e[s].selected=f),f&&l&&(e[s].defaultSelected=!0)}else{for(s=""+de(s),i=null,f=0;f<e.length;f++){if(e[f].value===s){e[f].selected=!0,l&&(e[f].defaultSelected=!0);return}i!==null||e[f].disabled||(i=e[f])}i!==null&&(i.selected=!0)}}function oi(e,i,s){if(i!=null&&(i=""+de(i),i!==e.value&&(e.value=i),s==null)){e.defaultValue!==i&&(e.defaultValue=i);return}e.defaultValue=s!=null?""+de(s):""}function Pi(e,i,s,l){if(i==null){if(l!=null){if(s!=null)throw Error(a(92));if(Z(l)){if(1<l.length)throw Error(a(93));l=l[0]}s=l}s==null&&(s=""),i=s}s=de(i),e.defaultValue=s,l=e.textContent,l===s&&l!==""&&l!==null&&(e.value=l),Pe(e)}function li(e,i){if(i){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=i;return}}e.textContent=i}var We=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function sn(e,i,s){var l=i.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?l?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="":l?e.setProperty(i,s):typeof s!="number"||s===0||We.has(i)?i==="float"?e.cssFloat=s:e[i]=(""+s).trim():e[i]=s+"px"}function Bi(e,i,s){if(i!=null&&typeof i!="object")throw Error(a(62));if(e=e.style,s!=null){for(var l in s)!s.hasOwnProperty(l)||i!=null&&i.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var f in i)l=i[f],i.hasOwnProperty(f)&&s[f]!==l&&sn(e,f,l)}else for(var h in i)i.hasOwnProperty(h)&&sn(e,h,i[h])}function He(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ki=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Ka=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Br(e){return Ka.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function da(){}var wf=null;function Cf(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ys=null,Ss=null;function o0(e){var i=ha(e);if(i&&(e=i.stateNode)){var s=e[Ln]||null;t:switch(e=i.stateNode,i.type){case"input":if(qt(e,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),i=s.name,s.type==="radio"&&i!=null){for(s=e;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+ke(""+i)+'"][type="radio"]'),i=0;i<s.length;i++){var l=s[i];if(l!==e&&l.form===e.form){var f=l[Ln]||null;if(!f)throw Error(a(90));qt(l,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(i=0;i<s.length;i++)l=s[i],l.form===e.form&&rn(l)}break t;case"textarea":oi(e,s.value,s.defaultValue);break t;case"select":i=s.value,i!=null&&En(e,!!s.multiple,i,!1)}}}var Df=!1;function l0(e,i,s){if(Df)return e(i,s);Df=!0;try{var l=e(i);return l}finally{if(Df=!1,(ys!==null||Ss!==null)&&(Vc(),ys&&(i=ys,e=Ss,Ss=ys=null,o0(i),e)))for(i=0;i<e.length;i++)o0(e[i])}}function Oo(e,i){var s=e.stateNode;if(s===null)return null;var l=s[Ln]||null;if(l===null)return null;s=l[i];t:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break t;default:e=!1}if(e)return null;if(s&&typeof s!="function")throw Error(a(231,i,typeof s));return s}var pa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Lf=!1;if(pa)try{var Po={};Object.defineProperty(Po,"passive",{get:function(){Lf=!0}}),window.addEventListener("test",Po,Po),window.removeEventListener("test",Po,Po)}catch{Lf=!1}var Qa=null,Uf=null,nc=null;function c0(){if(nc)return nc;var e,i=Uf,s=i.length,l,f="value"in Qa?Qa.value:Qa.textContent,h=f.length;for(e=0;e<s&&i[e]===f[e];e++);var M=s-e;for(l=1;l<=M&&i[s-l]===f[h-l];l++);return nc=f.slice(e,1<l?1-l:void 0)}function ic(e){var i=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&i===13&&(e=13)):e=i,e===10&&(e=13),32<=e||e===13?e:0}function ac(){return!0}function u0(){return!1}function Qn(e){function i(s,l,f,h,M){this._reactName=s,this._targetInst=f,this.type=l,this.nativeEvent=h,this.target=M,this.currentTarget=null;for(var C in e)e.hasOwnProperty(C)&&(s=e[C],this[C]=s?s(h):h[C]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?ac:u0,this.isPropagationStopped=u0,this}return v(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=ac)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=ac)},persist:function(){},isPersistent:ac}),i}var Ir={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},rc=Qn(Ir),Bo=v({},Ir,{view:0,detail:0}),LS=Qn(Bo),Nf,Of,Io,sc=v({},Bo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Bf,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Io&&(Io&&e.type==="mousemove"?(Nf=e.screenX-Io.screenX,Of=e.screenY-Io.screenY):Of=Nf=0,Io=e),Nf)},movementY:function(e){return"movementY"in e?e.movementY:Of}}),f0=Qn(sc),US=v({},sc,{dataTransfer:0}),NS=Qn(US),OS=v({},Bo,{relatedTarget:0}),Pf=Qn(OS),PS=v({},Ir,{animationName:0,elapsedTime:0,pseudoElement:0}),BS=Qn(PS),IS=v({},Ir,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),zS=Qn(IS),FS=v({},Ir,{data:0}),h0=Qn(FS),HS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},GS={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},VS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function kS(e){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(e):(e=VS[e])?!!i[e]:!1}function Bf(){return kS}var WS=v({},Bo,{key:function(e){if(e.key){var i=HS[e.key]||e.key;if(i!=="Unidentified")return i}return e.type==="keypress"?(e=ic(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?GS[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Bf,charCode:function(e){return e.type==="keypress"?ic(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ic(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),XS=Qn(WS),qS=v({},sc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),d0=Qn(qS),YS=v({},Bo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Bf}),ZS=Qn(YS),KS=v({},Ir,{propertyName:0,elapsedTime:0,pseudoElement:0}),QS=Qn(KS),JS=v({},sc,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),jS=Qn(JS),$S=v({},Ir,{newState:0,oldState:0}),tM=Qn($S),eM=[9,13,27,32],If=pa&&"CompositionEvent"in window,zo=null;pa&&"documentMode"in document&&(zo=document.documentMode);var nM=pa&&"TextEvent"in window&&!zo,p0=pa&&(!If||zo&&8<zo&&11>=zo),m0=" ",g0=!1;function _0(e,i){switch(e){case"keyup":return eM.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function v0(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ms=!1;function iM(e,i){switch(e){case"compositionend":return v0(i);case"keypress":return i.which!==32?null:(g0=!0,m0);case"textInput":return e=i.data,e===m0&&g0?null:e;default:return null}}function aM(e,i){if(Ms)return e==="compositionend"||!If&&_0(e,i)?(e=c0(),nc=Uf=Qa=null,Ms=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return p0&&i.locale!=="ko"?null:i.data;default:return null}}var rM={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function x0(e){var i=e&&e.nodeName&&e.nodeName.toLowerCase();return i==="input"?!!rM[e.type]:i==="textarea"}function y0(e,i,s,l){ys?Ss?Ss.push(l):Ss=[l]:ys=l,i=Kc(i,"onChange"),0<i.length&&(s=new rc("onChange","change",null,s,l),e.push({event:s,listeners:i}))}var Fo=null,Ho=null;function sM(e){nv(e,0)}function oc(e){var i=Pr(e);if(rn(i))return e}function S0(e,i){if(e==="change")return i}var M0=!1;if(pa){var zf;if(pa){var Ff="oninput"in document;if(!Ff){var E0=document.createElement("div");E0.setAttribute("oninput","return;"),Ff=typeof E0.oninput=="function"}zf=Ff}else zf=!1;M0=zf&&(!document.documentMode||9<document.documentMode)}function b0(){Fo&&(Fo.detachEvent("onpropertychange",T0),Ho=Fo=null)}function T0(e){if(e.propertyName==="value"&&oc(Ho)){var i=[];y0(i,Ho,e,Cf(e)),l0(sM,i)}}function oM(e,i,s){e==="focusin"?(b0(),Fo=i,Ho=s,Fo.attachEvent("onpropertychange",T0)):e==="focusout"&&b0()}function lM(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return oc(Ho)}function cM(e,i){if(e==="click")return oc(i)}function uM(e,i){if(e==="input"||e==="change")return oc(i)}function fM(e,i){return e===i&&(e!==0||1/e===1/i)||e!==e&&i!==i}var ci=typeof Object.is=="function"?Object.is:fM;function Go(e,i){if(ci(e,i))return!0;if(typeof e!="object"||e===null||typeof i!="object"||i===null)return!1;var s=Object.keys(e),l=Object.keys(i);if(s.length!==l.length)return!1;for(l=0;l<s.length;l++){var f=s[l];if(!ee.call(i,f)||!ci(e[f],i[f]))return!1}return!0}function A0(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function R0(e,i){var s=A0(e);e=0;for(var l;s;){if(s.nodeType===3){if(l=e+s.textContent.length,e<=i&&l>=i)return{node:s,offset:i-e};e=l}t:{for(;s;){if(s.nextSibling){s=s.nextSibling;break t}s=s.parentNode}s=void 0}s=A0(s)}}function w0(e,i){return e&&i?e===i?!0:e&&e.nodeType===3?!1:i&&i.nodeType===3?w0(e,i.parentNode):"contains"in e?e.contains(i):e.compareDocumentPosition?!!(e.compareDocumentPosition(i)&16):!1:!1}function C0(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var i=$e(e.document);i instanceof e.HTMLIFrameElement;){try{var s=typeof i.contentWindow.location.href=="string"}catch{s=!1}if(s)e=i.contentWindow;else break;i=$e(e.document)}return i}function Hf(e){var i=e&&e.nodeName&&e.nodeName.toLowerCase();return i&&(i==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||i==="textarea"||e.contentEditable==="true")}var hM=pa&&"documentMode"in document&&11>=document.documentMode,Es=null,Gf=null,Vo=null,Vf=!1;function D0(e,i,s){var l=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Vf||Es==null||Es!==$e(l)||(l=Es,"selectionStart"in l&&Hf(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Vo&&Go(Vo,l)||(Vo=l,l=Kc(Gf,"onSelect"),0<l.length&&(i=new rc("onSelect","select",null,i,s),e.push({event:i,listeners:l}),i.target=Es)))}function zr(e,i){var s={};return s[e.toLowerCase()]=i.toLowerCase(),s["Webkit"+e]="webkit"+i,s["Moz"+e]="moz"+i,s}var bs={animationend:zr("Animation","AnimationEnd"),animationiteration:zr("Animation","AnimationIteration"),animationstart:zr("Animation","AnimationStart"),transitionrun:zr("Transition","TransitionRun"),transitionstart:zr("Transition","TransitionStart"),transitioncancel:zr("Transition","TransitionCancel"),transitionend:zr("Transition","TransitionEnd")},kf={},L0={};pa&&(L0=document.createElement("div").style,"AnimationEvent"in window||(delete bs.animationend.animation,delete bs.animationiteration.animation,delete bs.animationstart.animation),"TransitionEvent"in window||delete bs.transitionend.transition);function Fr(e){if(kf[e])return kf[e];if(!bs[e])return e;var i=bs[e],s;for(s in i)if(i.hasOwnProperty(s)&&s in L0)return kf[e]=i[s];return e}var U0=Fr("animationend"),N0=Fr("animationiteration"),O0=Fr("animationstart"),dM=Fr("transitionrun"),pM=Fr("transitionstart"),mM=Fr("transitioncancel"),P0=Fr("transitionend"),B0=new Map,Wf="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Wf.push("scrollEnd");function Ii(e,i){B0.set(e,i),Y(i,[e])}var lc=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Ei=[],Ts=0,Xf=0;function cc(){for(var e=Ts,i=Xf=Ts=0;i<e;){var s=Ei[i];Ei[i++]=null;var l=Ei[i];Ei[i++]=null;var f=Ei[i];Ei[i++]=null;var h=Ei[i];if(Ei[i++]=null,l!==null&&f!==null){var M=l.pending;M===null?f.next=f:(f.next=M.next,M.next=f),l.pending=f}h!==0&&I0(s,f,h)}}function uc(e,i,s,l){Ei[Ts++]=e,Ei[Ts++]=i,Ei[Ts++]=s,Ei[Ts++]=l,Xf|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function qf(e,i,s,l){return uc(e,i,s,l),fc(e)}function Hr(e,i){return uc(e,null,null,i),fc(e)}function I0(e,i,s){e.lanes|=s;var l=e.alternate;l!==null&&(l.lanes|=s);for(var f=!1,h=e.return;h!==null;)h.childLanes|=s,l=h.alternate,l!==null&&(l.childLanes|=s),h.tag===22&&(e=h.stateNode,e===null||e._visibility&1||(f=!0)),e=h,h=h.return;return e.tag===3?(h=e.stateNode,f&&i!==null&&(f=31-Xt(s),e=h.hiddenUpdates,l=e[f],l===null?e[f]=[i]:l.push(i),i.lane=s|536870912),h):null}function fc(e){if(50<ul)throw ul=0,ed=null,Error(a(185));for(var i=e.return;i!==null;)e=i,i=e.return;return e.tag===3?e.stateNode:null}var As={};function gM(e,i,s,l){this.tag=e,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ui(e,i,s,l){return new gM(e,i,s,l)}function Yf(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ma(e,i){var s=e.alternate;return s===null?(s=ui(e.tag,i,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=i,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&65011712,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,i=e.dependencies,s.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s.refCleanup=e.refCleanup,s}function z0(e,i){e.flags&=65011714;var s=e.alternate;return s===null?(e.childLanes=0,e.lanes=i,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=s.childLanes,e.lanes=s.lanes,e.child=s.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=s.memoizedProps,e.memoizedState=s.memoizedState,e.updateQueue=s.updateQueue,e.type=s.type,i=s.dependencies,e.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),e}function hc(e,i,s,l,f,h){var M=0;if(l=e,typeof e=="function")Yf(e)&&(M=1);else if(typeof e=="string")M=S1(e,s,Lt.current)?26:e==="html"||e==="head"||e==="body"?27:5;else t:switch(e){case O:return e=ui(31,s,i,f),e.elementType=O,e.lanes=h,e;case A:return Gr(s.children,f,h,i);case x:M=8,f|=24;break;case S:return e=ui(12,s,i,f|2),e.elementType=S,e.lanes=h,e;case B:return e=ui(13,s,i,f),e.elementType=B,e.lanes=h,e;case N:return e=ui(19,s,i,f),e.elementType=N,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case U:M=10;break t;case D:M=9;break t;case w:M=11;break t;case P:M=14;break t;case T:M=16,l=null;break t}M=29,s=Error(a(130,e===null?"null":typeof e,"")),l=null}return i=ui(M,s,i,f),i.elementType=e,i.type=l,i.lanes=h,i}function Gr(e,i,s,l){return e=ui(7,e,l,i),e.lanes=s,e}function Zf(e,i,s){return e=ui(6,e,null,i),e.lanes=s,e}function F0(e){var i=ui(18,null,null,0);return i.stateNode=e,i}function Kf(e,i,s){return i=ui(4,e.children!==null?e.children:[],e.key,i),i.lanes=s,i.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},i}var H0=new WeakMap;function bi(e,i){if(typeof e=="object"&&e!==null){var s=H0.get(e);return s!==void 0?s:(i={value:e,source:i,stack:jt(i)},H0.set(e,i),i)}return{value:e,source:i,stack:jt(i)}}var Rs=[],ws=0,dc=null,ko=0,Ti=[],Ai=0,Ja=null,Qi=1,Ji="";function ga(e,i){Rs[ws++]=ko,Rs[ws++]=dc,dc=e,ko=i}function G0(e,i,s){Ti[Ai++]=Qi,Ti[Ai++]=Ji,Ti[Ai++]=Ja,Ja=e;var l=Qi;e=Ji;var f=32-Xt(l)-1;l&=~(1<<f),s+=1;var h=32-Xt(i)+f;if(30<h){var M=f-f%5;h=(l&(1<<M)-1).toString(32),l>>=M,f-=M,Qi=1<<32-Xt(i)+f|s<<f|l,Ji=h+e}else Qi=1<<h|s<<f|l,Ji=e}function Qf(e){e.return!==null&&(ga(e,1),G0(e,1,0))}function Jf(e){for(;e===dc;)dc=Rs[--ws],Rs[ws]=null,ko=Rs[--ws],Rs[ws]=null;for(;e===Ja;)Ja=Ti[--Ai],Ti[Ai]=null,Ji=Ti[--Ai],Ti[Ai]=null,Qi=Ti[--Ai],Ti[Ai]=null}function V0(e,i){Ti[Ai++]=Qi,Ti[Ai++]=Ji,Ti[Ai++]=Ja,Qi=i.id,Ji=i.overflow,Ja=e}var Un=null,en=null,Ue=!1,ja=null,Ri=!1,jf=Error(a(519));function $a(e){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Wo(bi(i,e)),jf}function k0(e){var i=e.stateNode,s=e.type,l=e.memoizedProps;switch(i[mn]=e,i[Ln]=l,s){case"dialog":Ce("cancel",i),Ce("close",i);break;case"iframe":case"object":case"embed":Ce("load",i);break;case"video":case"audio":for(s=0;s<hl.length;s++)Ce(hl[s],i);break;case"source":Ce("error",i);break;case"img":case"image":case"link":Ce("error",i),Ce("load",i);break;case"details":Ce("toggle",i);break;case"input":Ce("invalid",i),In(i,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ce("invalid",i);break;case"textarea":Ce("invalid",i),Pi(i,l.value,l.defaultValue,l.children)}s=l.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||i.textContent===""+s||l.suppressHydrationWarning===!0||sv(i.textContent,s)?(l.popover!=null&&(Ce("beforetoggle",i),Ce("toggle",i)),l.onScroll!=null&&Ce("scroll",i),l.onScrollEnd!=null&&Ce("scrollend",i),l.onClick!=null&&(i.onclick=da),i=!0):i=!1,i||$a(e,!0)}function W0(e){for(Un=e.return;Un;)switch(Un.tag){case 5:case 31:case 13:Ri=!1;return;case 27:case 3:Ri=!0;return;default:Un=Un.return}}function Cs(e){if(e!==Un)return!1;if(!Ue)return W0(e),Ue=!0,!1;var i=e.tag,s;if((s=i!==3&&i!==27)&&((s=i===5)&&(s=e.type,s=!(s!=="form"&&s!=="button")||gd(e.type,e.memoizedProps)),s=!s),s&&en&&$a(e),W0(e),i===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));en=mv(e)}else if(i===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(317));en=mv(e)}else i===27?(i=en,dr(e.type)?(e=Sd,Sd=null,en=e):en=i):en=Un?Ci(e.stateNode.nextSibling):null;return!0}function Vr(){en=Un=null,Ue=!1}function $f(){var e=ja;return e!==null&&(ti===null?ti=e:ti.push.apply(ti,e),ja=null),e}function Wo(e){ja===null?ja=[e]:ja.push(e)}var th=I(null),kr=null,_a=null;function tr(e,i,s){bt(th,i._currentValue),i._currentValue=s}function va(e){e._currentValue=th.current,J(th)}function eh(e,i,s){for(;e!==null;){var l=e.alternate;if((e.childLanes&i)!==i?(e.childLanes|=i,l!==null&&(l.childLanes|=i)):l!==null&&(l.childLanes&i)!==i&&(l.childLanes|=i),e===s)break;e=e.return}}function nh(e,i,s,l){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var h=f.dependencies;if(h!==null){var M=f.child;h=h.firstContext;t:for(;h!==null;){var C=h;h=f;for(var G=0;G<i.length;G++)if(C.context===i[G]){h.lanes|=s,C=h.alternate,C!==null&&(C.lanes|=s),eh(h.return,s,e),l||(M=null);break t}h=C.next}}else if(f.tag===18){if(M=f.return,M===null)throw Error(a(341));M.lanes|=s,h=M.alternate,h!==null&&(h.lanes|=s),eh(M,s,e),M=null}else M=f.child;if(M!==null)M.return=f;else for(M=f;M!==null;){if(M===e){M=null;break}if(f=M.sibling,f!==null){f.return=M.return,M=f;break}M=M.return}f=M}}function Ds(e,i,s,l){e=null;for(var f=i,h=!1;f!==null;){if(!h){if((f.flags&524288)!==0)h=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var M=f.alternate;if(M===null)throw Error(a(387));if(M=M.memoizedProps,M!==null){var C=f.type;ci(f.pendingProps.value,M.value)||(e!==null?e.push(C):e=[C])}}else if(f===St.current){if(M=f.alternate,M===null)throw Error(a(387));M.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(_l):e=[_l])}f=f.return}e!==null&&nh(i,e,s,l),i.flags|=262144}function pc(e){for(e=e.firstContext;e!==null;){if(!ci(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Wr(e){kr=e,_a=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Nn(e){return X0(kr,e)}function mc(e,i){return kr===null&&Wr(e),X0(e,i)}function X0(e,i){var s=i._currentValue;if(i={context:i,memoizedValue:s,next:null},_a===null){if(e===null)throw Error(a(308));_a=i,e.dependencies={lanes:0,firstContext:i},e.flags|=524288}else _a=_a.next=i;return s}var _M=typeof AbortController<"u"?AbortController:function(){var e=[],i=this.signal={aborted:!1,addEventListener:function(s,l){e.push(l)}};this.abort=function(){i.aborted=!0,e.forEach(function(s){return s()})}},vM=r.unstable_scheduleCallback,xM=r.unstable_NormalPriority,_n={$$typeof:U,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ih(){return{controller:new _M,data:new Map,refCount:0}}function Xo(e){e.refCount--,e.refCount===0&&vM(xM,function(){e.controller.abort()})}var qo=null,ah=0,Ls=0,Us=null;function yM(e,i){if(qo===null){var s=qo=[];ah=0,Ls=od(),Us={status:"pending",value:void 0,then:function(l){s.push(l)}}}return ah++,i.then(q0,q0),i}function q0(){if(--ah===0&&qo!==null){Us!==null&&(Us.status="fulfilled");var e=qo;qo=null,Ls=0,Us=null;for(var i=0;i<e.length;i++)(0,e[i])()}}function SM(e,i){var s=[],l={status:"pending",value:null,reason:null,then:function(f){s.push(f)}};return e.then(function(){l.status="fulfilled",l.value=i;for(var f=0;f<s.length;f++)(0,s[f])(i)},function(f){for(l.status="rejected",l.reason=f,f=0;f<s.length;f++)(0,s[f])(void 0)}),l}var Y0=F.S;F.S=function(e,i){D_=Ft(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&yM(e,i),Y0!==null&&Y0(e,i)};var Xr=I(null);function rh(){var e=Xr.current;return e!==null?e:tn.pooledCache}function gc(e,i){i===null?bt(Xr,Xr.current):bt(Xr,i.pool)}function Z0(){var e=rh();return e===null?null:{parent:_n._currentValue,pool:e}}var Ns=Error(a(460)),sh=Error(a(474)),_c=Error(a(542)),vc={then:function(){}};function K0(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Q0(e,i,s){switch(s=e[s],s===void 0?e.push(i):s!==i&&(i.then(da,da),i=s),i.status){case"fulfilled":return i.value;case"rejected":throw e=i.reason,j0(e),e;default:if(typeof i.status=="string")i.then(da,da);else{if(e=tn,e!==null&&100<e.shellSuspendCounter)throw Error(a(482));e=i,e.status="pending",e.then(function(l){if(i.status==="pending"){var f=i;f.status="fulfilled",f.value=l}},function(l){if(i.status==="pending"){var f=i;f.status="rejected",f.reason=l}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw e=i.reason,j0(e),e}throw Yr=i,Ns}}function qr(e){try{var i=e._init;return i(e._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(Yr=s,Ns):s}}var Yr=null;function J0(){if(Yr===null)throw Error(a(459));var e=Yr;return Yr=null,e}function j0(e){if(e===Ns||e===_c)throw Error(a(483))}var Os=null,Yo=0;function xc(e){var i=Yo;return Yo+=1,Os===null&&(Os=[]),Q0(Os,e,i)}function Zo(e,i){i=i.props.ref,e.ref=i!==void 0?i:null}function yc(e,i){throw i.$$typeof===g?Error(a(525)):(e=Object.prototype.toString.call(i),Error(a(31,e==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":e)))}function $0(e){function i(j,X){if(e){var nt=j.deletions;nt===null?(j.deletions=[X],j.flags|=16):nt.push(X)}}function s(j,X){if(!e)return null;for(;X!==null;)i(j,X),X=X.sibling;return null}function l(j){for(var X=new Map;j!==null;)j.key!==null?X.set(j.key,j):X.set(j.index,j),j=j.sibling;return X}function f(j,X){return j=ma(j,X),j.index=0,j.sibling=null,j}function h(j,X,nt){return j.index=nt,e?(nt=j.alternate,nt!==null?(nt=nt.index,nt<X?(j.flags|=67108866,X):nt):(j.flags|=67108866,X)):(j.flags|=1048576,X)}function M(j){return e&&j.alternate===null&&(j.flags|=67108866),j}function C(j,X,nt,xt){return X===null||X.tag!==6?(X=Zf(nt,j.mode,xt),X.return=j,X):(X=f(X,nt),X.return=j,X)}function G(j,X,nt,xt){var pe=nt.type;return pe===A?pt(j,X,nt.props.children,xt,nt.key):X!==null&&(X.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===T&&qr(pe)===X.type)?(X=f(X,nt.props),Zo(X,nt),X.return=j,X):(X=hc(nt.type,nt.key,nt.props,null,j.mode,xt),Zo(X,nt),X.return=j,X)}function it(j,X,nt,xt){return X===null||X.tag!==4||X.stateNode.containerInfo!==nt.containerInfo||X.stateNode.implementation!==nt.implementation?(X=Kf(nt,j.mode,xt),X.return=j,X):(X=f(X,nt.children||[]),X.return=j,X)}function pt(j,X,nt,xt,pe){return X===null||X.tag!==7?(X=Gr(nt,j.mode,xt,pe),X.return=j,X):(X=f(X,nt),X.return=j,X)}function yt(j,X,nt){if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return X=Zf(""+X,j.mode,nt),X.return=j,X;if(typeof X=="object"&&X!==null){switch(X.$$typeof){case y:return nt=hc(X.type,X.key,X.props,null,j.mode,nt),Zo(nt,X),nt.return=j,nt;case E:return X=Kf(X,j.mode,nt),X.return=j,X;case T:return X=qr(X),yt(j,X,nt)}if(Z(X)||Q(X))return X=Gr(X,j.mode,nt,null),X.return=j,X;if(typeof X.then=="function")return yt(j,xc(X),nt);if(X.$$typeof===U)return yt(j,mc(j,X),nt);yc(j,X)}return null}function lt(j,X,nt,xt){var pe=X!==null?X.key:null;if(typeof nt=="string"&&nt!==""||typeof nt=="number"||typeof nt=="bigint")return pe!==null?null:C(j,X,""+nt,xt);if(typeof nt=="object"&&nt!==null){switch(nt.$$typeof){case y:return nt.key===pe?G(j,X,nt,xt):null;case E:return nt.key===pe?it(j,X,nt,xt):null;case T:return nt=qr(nt),lt(j,X,nt,xt)}if(Z(nt)||Q(nt))return pe!==null?null:pt(j,X,nt,xt,null);if(typeof nt.then=="function")return lt(j,X,xc(nt),xt);if(nt.$$typeof===U)return lt(j,X,mc(j,nt),xt);yc(j,nt)}return null}function ut(j,X,nt,xt,pe){if(typeof xt=="string"&&xt!==""||typeof xt=="number"||typeof xt=="bigint")return j=j.get(nt)||null,C(X,j,""+xt,pe);if(typeof xt=="object"&&xt!==null){switch(xt.$$typeof){case y:return j=j.get(xt.key===null?nt:xt.key)||null,G(X,j,xt,pe);case E:return j=j.get(xt.key===null?nt:xt.key)||null,it(X,j,xt,pe);case T:return xt=qr(xt),ut(j,X,nt,xt,pe)}if(Z(xt)||Q(xt))return j=j.get(nt)||null,pt(X,j,xt,pe,null);if(typeof xt.then=="function")return ut(j,X,nt,xc(xt),pe);if(xt.$$typeof===U)return ut(j,X,nt,mc(X,xt),pe);yc(X,xt)}return null}function te(j,X,nt,xt){for(var pe=null,Be=null,re=X,be=X=0,Le=null;re!==null&&be<nt.length;be++){re.index>be?(Le=re,re=null):Le=re.sibling;var Ie=lt(j,re,nt[be],xt);if(Ie===null){re===null&&(re=Le);break}e&&re&&Ie.alternate===null&&i(j,re),X=h(Ie,X,be),Be===null?pe=Ie:Be.sibling=Ie,Be=Ie,re=Le}if(be===nt.length)return s(j,re),Ue&&ga(j,be),pe;if(re===null){for(;be<nt.length;be++)re=yt(j,nt[be],xt),re!==null&&(X=h(re,X,be),Be===null?pe=re:Be.sibling=re,Be=re);return Ue&&ga(j,be),pe}for(re=l(re);be<nt.length;be++)Le=ut(re,j,be,nt[be],xt),Le!==null&&(e&&Le.alternate!==null&&re.delete(Le.key===null?be:Le.key),X=h(Le,X,be),Be===null?pe=Le:Be.sibling=Le,Be=Le);return e&&re.forEach(function(vr){return i(j,vr)}),Ue&&ga(j,be),pe}function _e(j,X,nt,xt){if(nt==null)throw Error(a(151));for(var pe=null,Be=null,re=X,be=X=0,Le=null,Ie=nt.next();re!==null&&!Ie.done;be++,Ie=nt.next()){re.index>be?(Le=re,re=null):Le=re.sibling;var vr=lt(j,re,Ie.value,xt);if(vr===null){re===null&&(re=Le);break}e&&re&&vr.alternate===null&&i(j,re),X=h(vr,X,be),Be===null?pe=vr:Be.sibling=vr,Be=vr,re=Le}if(Ie.done)return s(j,re),Ue&&ga(j,be),pe;if(re===null){for(;!Ie.done;be++,Ie=nt.next())Ie=yt(j,Ie.value,xt),Ie!==null&&(X=h(Ie,X,be),Be===null?pe=Ie:Be.sibling=Ie,Be=Ie);return Ue&&ga(j,be),pe}for(re=l(re);!Ie.done;be++,Ie=nt.next())Ie=ut(re,j,be,Ie.value,xt),Ie!==null&&(e&&Ie.alternate!==null&&re.delete(Ie.key===null?be:Ie.key),X=h(Ie,X,be),Be===null?pe=Ie:Be.sibling=Ie,Be=Ie);return e&&re.forEach(function(U1){return i(j,U1)}),Ue&&ga(j,be),pe}function Je(j,X,nt,xt){if(typeof nt=="object"&&nt!==null&&nt.type===A&&nt.key===null&&(nt=nt.props.children),typeof nt=="object"&&nt!==null){switch(nt.$$typeof){case y:t:{for(var pe=nt.key;X!==null;){if(X.key===pe){if(pe=nt.type,pe===A){if(X.tag===7){s(j,X.sibling),xt=f(X,nt.props.children),xt.return=j,j=xt;break t}}else if(X.elementType===pe||typeof pe=="object"&&pe!==null&&pe.$$typeof===T&&qr(pe)===X.type){s(j,X.sibling),xt=f(X,nt.props),Zo(xt,nt),xt.return=j,j=xt;break t}s(j,X);break}else i(j,X);X=X.sibling}nt.type===A?(xt=Gr(nt.props.children,j.mode,xt,nt.key),xt.return=j,j=xt):(xt=hc(nt.type,nt.key,nt.props,null,j.mode,xt),Zo(xt,nt),xt.return=j,j=xt)}return M(j);case E:t:{for(pe=nt.key;X!==null;){if(X.key===pe)if(X.tag===4&&X.stateNode.containerInfo===nt.containerInfo&&X.stateNode.implementation===nt.implementation){s(j,X.sibling),xt=f(X,nt.children||[]),xt.return=j,j=xt;break t}else{s(j,X);break}else i(j,X);X=X.sibling}xt=Kf(nt,j.mode,xt),xt.return=j,j=xt}return M(j);case T:return nt=qr(nt),Je(j,X,nt,xt)}if(Z(nt))return te(j,X,nt,xt);if(Q(nt)){if(pe=Q(nt),typeof pe!="function")throw Error(a(150));return nt=pe.call(nt),_e(j,X,nt,xt)}if(typeof nt.then=="function")return Je(j,X,xc(nt),xt);if(nt.$$typeof===U)return Je(j,X,mc(j,nt),xt);yc(j,nt)}return typeof nt=="string"&&nt!==""||typeof nt=="number"||typeof nt=="bigint"?(nt=""+nt,X!==null&&X.tag===6?(s(j,X.sibling),xt=f(X,nt),xt.return=j,j=xt):(s(j,X),xt=Zf(nt,j.mode,xt),xt.return=j,j=xt),M(j)):s(j,X)}return function(j,X,nt,xt){try{Yo=0;var pe=Je(j,X,nt,xt);return Os=null,pe}catch(re){if(re===Ns||re===_c)throw re;var Be=ui(29,re,null,j.mode);return Be.lanes=xt,Be.return=j,Be}}}var Zr=$0(!0),tg=$0(!1),er=!1;function oh(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function lh(e,i){e=e.updateQueue,i.updateQueue===e&&(i.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function nr(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ir(e,i,s){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Fe&2)!==0){var f=l.pending;return f===null?i.next=i:(i.next=f.next,f.next=i),l.pending=i,i=fc(e),I0(e,null,s),i}return uc(e,l,i,s),fc(e)}function Ko(e,i,s){if(i=i.updateQueue,i!==null&&(i=i.shared,(s&4194048)!==0)){var l=i.lanes;l&=e.pendingLanes,s|=l,i.lanes=s,ri(e,s)}}function ch(e,i){var s=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,s===l)){var f=null,h=null;if(s=s.firstBaseUpdate,s!==null){do{var M={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};h===null?f=h=M:h=h.next=M,s=s.next}while(s!==null);h===null?f=h=i:h=h.next=i}else f=h=i;s={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:h,shared:l.shared,callbacks:l.callbacks},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=i:e.next=i,s.lastBaseUpdate=i}var uh=!1;function Qo(){if(uh){var e=Us;if(e!==null)throw e}}function Jo(e,i,s,l){uh=!1;var f=e.updateQueue;er=!1;var h=f.firstBaseUpdate,M=f.lastBaseUpdate,C=f.shared.pending;if(C!==null){f.shared.pending=null;var G=C,it=G.next;G.next=null,M===null?h=it:M.next=it,M=G;var pt=e.alternate;pt!==null&&(pt=pt.updateQueue,C=pt.lastBaseUpdate,C!==M&&(C===null?pt.firstBaseUpdate=it:C.next=it,pt.lastBaseUpdate=G))}if(h!==null){var yt=f.baseState;M=0,pt=it=G=null,C=h;do{var lt=C.lane&-536870913,ut=lt!==C.lane;if(ut?(De&lt)===lt:(l&lt)===lt){lt!==0&&lt===Ls&&(uh=!0),pt!==null&&(pt=pt.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});t:{var te=e,_e=C;lt=i;var Je=s;switch(_e.tag){case 1:if(te=_e.payload,typeof te=="function"){yt=te.call(Je,yt,lt);break t}yt=te;break t;case 3:te.flags=te.flags&-65537|128;case 0:if(te=_e.payload,lt=typeof te=="function"?te.call(Je,yt,lt):te,lt==null)break t;yt=v({},yt,lt);break t;case 2:er=!0}}lt=C.callback,lt!==null&&(e.flags|=64,ut&&(e.flags|=8192),ut=f.callbacks,ut===null?f.callbacks=[lt]:ut.push(lt))}else ut={lane:lt,tag:C.tag,payload:C.payload,callback:C.callback,next:null},pt===null?(it=pt=ut,G=yt):pt=pt.next=ut,M|=lt;if(C=C.next,C===null){if(C=f.shared.pending,C===null)break;ut=C,C=ut.next,ut.next=null,f.lastBaseUpdate=ut,f.shared.pending=null}}while(!0);pt===null&&(G=yt),f.baseState=G,f.firstBaseUpdate=it,f.lastBaseUpdate=pt,h===null&&(f.shared.lanes=0),lr|=M,e.lanes=M,e.memoizedState=yt}}function eg(e,i){if(typeof e!="function")throw Error(a(191,e));e.call(i)}function ng(e,i){var s=e.callbacks;if(s!==null)for(e.callbacks=null,e=0;e<s.length;e++)eg(s[e],i)}var Ps=I(null),Sc=I(0);function ig(e,i){e=Ra,bt(Sc,e),bt(Ps,i),Ra=e|i.baseLanes}function fh(){bt(Sc,Ra),bt(Ps,Ps.current)}function hh(){Ra=Sc.current,J(Ps),J(Sc)}var fi=I(null),wi=null;function ar(e){var i=e.alternate;bt(dn,dn.current&1),bt(fi,e),wi===null&&(i===null||Ps.current!==null||i.memoizedState!==null)&&(wi=e)}function dh(e){bt(dn,dn.current),bt(fi,e),wi===null&&(wi=e)}function ag(e){e.tag===22?(bt(dn,dn.current),bt(fi,e),wi===null&&(wi=e)):rr()}function rr(){bt(dn,dn.current),bt(fi,fi.current)}function hi(e){J(fi),wi===e&&(wi=null),J(dn)}var dn=I(0);function Mc(e){for(var i=e;i!==null;){if(i.tag===13){var s=i.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||xd(s)||yd(s)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===e)break;for(;i.sibling===null;){if(i.return===null||i.return===e)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var xa=0,Ee=null,Ke=null,vn=null,Ec=!1,Bs=!1,Kr=!1,bc=0,jo=0,Is=null,MM=0;function un(){throw Error(a(321))}function ph(e,i){if(i===null)return!1;for(var s=0;s<i.length&&s<e.length;s++)if(!ci(e[s],i[s]))return!1;return!0}function mh(e,i,s,l,f,h){return xa=h,Ee=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,F.H=e===null||e.memoizedState===null?Gg:Dh,Kr=!1,h=s(l,f),Kr=!1,Bs&&(h=sg(i,s,l,f)),rg(e),h}function rg(e){F.H=el;var i=Ke!==null&&Ke.next!==null;if(xa=0,vn=Ke=Ee=null,Ec=!1,jo=0,Is=null,i)throw Error(a(300));e===null||xn||(e=e.dependencies,e!==null&&pc(e)&&(xn=!0))}function sg(e,i,s,l){Ee=e;var f=0;do{if(Bs&&(Is=null),jo=0,Bs=!1,25<=f)throw Error(a(301));if(f+=1,vn=Ke=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}F.H=Vg,h=i(s,l)}while(Bs);return h}function EM(){var e=F.H,i=e.useState()[0];return i=typeof i.then=="function"?$o(i):i,e=e.useState()[0],(Ke!==null?Ke.memoizedState:null)!==e&&(Ee.flags|=1024),i}function gh(){var e=bc!==0;return bc=0,e}function _h(e,i,s){i.updateQueue=e.updateQueue,i.flags&=-2053,e.lanes&=~s}function vh(e){if(Ec){for(e=e.memoizedState;e!==null;){var i=e.queue;i!==null&&(i.pending=null),e=e.next}Ec=!1}xa=0,vn=Ke=Ee=null,Bs=!1,jo=bc=0,Is=null}function qn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return vn===null?Ee.memoizedState=vn=e:vn=vn.next=e,vn}function pn(){if(Ke===null){var e=Ee.alternate;e=e!==null?e.memoizedState:null}else e=Ke.next;var i=vn===null?Ee.memoizedState:vn.next;if(i!==null)vn=i,Ke=e;else{if(e===null)throw Ee.alternate===null?Error(a(467)):Error(a(310));Ke=e,e={memoizedState:Ke.memoizedState,baseState:Ke.baseState,baseQueue:Ke.baseQueue,queue:Ke.queue,next:null},vn===null?Ee.memoizedState=vn=e:vn=vn.next=e}return vn}function Tc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function $o(e){var i=jo;return jo+=1,Is===null&&(Is=[]),e=Q0(Is,e,i),i=Ee,(vn===null?i.memoizedState:vn.next)===null&&(i=i.alternate,F.H=i===null||i.memoizedState===null?Gg:Dh),e}function Ac(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return $o(e);if(e.$$typeof===U)return Nn(e)}throw Error(a(438,String(e)))}function xh(e){var i=null,s=Ee.updateQueue;if(s!==null&&(i=s.memoCache),i==null){var l=Ee.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(i={data:l.data.map(function(f){return f.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),s===null&&(s=Tc(),Ee.updateQueue=s),s.memoCache=i,s=i.data[i.index],s===void 0)for(s=i.data[i.index]=Array(e),l=0;l<e;l++)s[l]=W;return i.index++,s}function ya(e,i){return typeof i=="function"?i(e):i}function Rc(e){var i=pn();return yh(i,Ke,e)}function yh(e,i,s){var l=e.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=s;var f=e.baseQueue,h=l.pending;if(h!==null){if(f!==null){var M=f.next;f.next=h.next,h.next=M}i.baseQueue=f=h,l.pending=null}if(h=e.baseState,f===null)e.memoizedState=h;else{i=f.next;var C=M=null,G=null,it=i,pt=!1;do{var yt=it.lane&-536870913;if(yt!==it.lane?(De&yt)===yt:(xa&yt)===yt){var lt=it.revertLane;if(lt===0)G!==null&&(G=G.next={lane:0,revertLane:0,gesture:null,action:it.action,hasEagerState:it.hasEagerState,eagerState:it.eagerState,next:null}),yt===Ls&&(pt=!0);else if((xa&lt)===lt){it=it.next,lt===Ls&&(pt=!0);continue}else yt={lane:0,revertLane:it.revertLane,gesture:null,action:it.action,hasEagerState:it.hasEagerState,eagerState:it.eagerState,next:null},G===null?(C=G=yt,M=h):G=G.next=yt,Ee.lanes|=lt,lr|=lt;yt=it.action,Kr&&s(h,yt),h=it.hasEagerState?it.eagerState:s(h,yt)}else lt={lane:yt,revertLane:it.revertLane,gesture:it.gesture,action:it.action,hasEagerState:it.hasEagerState,eagerState:it.eagerState,next:null},G===null?(C=G=lt,M=h):G=G.next=lt,Ee.lanes|=yt,lr|=yt;it=it.next}while(it!==null&&it!==i);if(G===null?M=h:G.next=C,!ci(h,e.memoizedState)&&(xn=!0,pt&&(s=Us,s!==null)))throw s;e.memoizedState=h,e.baseState=M,e.baseQueue=G,l.lastRenderedState=h}return f===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Sh(e){var i=pn(),s=i.queue;if(s===null)throw Error(a(311));s.lastRenderedReducer=e;var l=s.dispatch,f=s.pending,h=i.memoizedState;if(f!==null){s.pending=null;var M=f=f.next;do h=e(h,M.action),M=M.next;while(M!==f);ci(h,i.memoizedState)||(xn=!0),i.memoizedState=h,i.baseQueue===null&&(i.baseState=h),s.lastRenderedState=h}return[h,l]}function og(e,i,s){var l=Ee,f=pn(),h=Ue;if(h){if(s===void 0)throw Error(a(407));s=s()}else s=i();var M=!ci((Ke||f).memoizedState,s);if(M&&(f.memoizedState=s,xn=!0),f=f.queue,bh(ug.bind(null,l,f,e),[e]),f.getSnapshot!==i||M||vn!==null&&vn.memoizedState.tag&1){if(l.flags|=2048,zs(9,{destroy:void 0},cg.bind(null,l,f,s,i),null),tn===null)throw Error(a(349));h||(xa&127)!==0||lg(l,i,s)}return s}function lg(e,i,s){e.flags|=16384,e={getSnapshot:i,value:s},i=Ee.updateQueue,i===null?(i=Tc(),Ee.updateQueue=i,i.stores=[e]):(s=i.stores,s===null?i.stores=[e]:s.push(e))}function cg(e,i,s,l){i.value=s,i.getSnapshot=l,fg(i)&&hg(e)}function ug(e,i,s){return s(function(){fg(i)&&hg(e)})}function fg(e){var i=e.getSnapshot;e=e.value;try{var s=i();return!ci(e,s)}catch{return!0}}function hg(e){var i=Hr(e,2);i!==null&&ei(i,e,2)}function Mh(e){var i=qn();if(typeof e=="function"){var s=e;if(e=s(),Kr){Dt(!0);try{s()}finally{Dt(!1)}}}return i.memoizedState=i.baseState=e,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ya,lastRenderedState:e},i}function dg(e,i,s,l){return e.baseState=s,yh(e,Ke,typeof l=="function"?l:ya)}function bM(e,i,s,l,f){if(Dc(e))throw Error(a(485));if(e=i.action,e!==null){var h={payload:f,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(M){h.listeners.push(M)}};F.T!==null?s(!0):h.isTransition=!1,l(h),s=i.pending,s===null?(h.next=i.pending=h,pg(i,h)):(h.next=s.next,i.pending=s.next=h)}}function pg(e,i){var s=i.action,l=i.payload,f=e.state;if(i.isTransition){var h=F.T,M={};F.T=M;try{var C=s(f,l),G=F.S;G!==null&&G(M,C),mg(e,i,C)}catch(it){Eh(e,i,it)}finally{h!==null&&M.types!==null&&(h.types=M.types),F.T=h}}else try{h=s(f,l),mg(e,i,h)}catch(it){Eh(e,i,it)}}function mg(e,i,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(l){gg(e,i,l)},function(l){return Eh(e,i,l)}):gg(e,i,s)}function gg(e,i,s){i.status="fulfilled",i.value=s,_g(i),e.state=s,i=e.pending,i!==null&&(s=i.next,s===i?e.pending=null:(s=s.next,i.next=s,pg(e,s)))}function Eh(e,i,s){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do i.status="rejected",i.reason=s,_g(i),i=i.next;while(i!==l)}e.action=null}function _g(e){e=e.listeners;for(var i=0;i<e.length;i++)(0,e[i])()}function vg(e,i){return i}function xg(e,i){if(Ue){var s=tn.formState;if(s!==null){t:{var l=Ee;if(Ue){if(en){e:{for(var f=en,h=Ri;f.nodeType!==8;){if(!h){f=null;break e}if(f=Ci(f.nextSibling),f===null){f=null;break e}}h=f.data,f=h==="F!"||h==="F"?f:null}if(f){en=Ci(f.nextSibling),l=f.data==="F!";break t}}$a(l)}l=!1}l&&(i=s[0])}}return s=qn(),s.memoizedState=s.baseState=i,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:vg,lastRenderedState:i},s.queue=l,s=zg.bind(null,Ee,l),l.dispatch=s,l=Mh(!1),h=Ch.bind(null,Ee,!1,l.queue),l=qn(),f={state:i,dispatch:null,action:e,pending:null},l.queue=f,s=bM.bind(null,Ee,f,h,s),f.dispatch=s,l.memoizedState=e,[i,s,!1]}function yg(e){var i=pn();return Sg(i,Ke,e)}function Sg(e,i,s){if(i=yh(e,i,vg)[0],e=Rc(ya)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var l=$o(i)}catch(M){throw M===Ns?_c:M}else l=i;i=pn();var f=i.queue,h=f.dispatch;return s!==i.memoizedState&&(Ee.flags|=2048,zs(9,{destroy:void 0},TM.bind(null,f,s),null)),[l,h,e]}function TM(e,i){e.action=i}function Mg(e){var i=pn(),s=Ke;if(s!==null)return Sg(i,s,e);pn(),i=i.memoizedState,s=pn();var l=s.queue.dispatch;return s.memoizedState=e,[i,l,!1]}function zs(e,i,s,l){return e={tag:e,create:s,deps:l,inst:i,next:null},i=Ee.updateQueue,i===null&&(i=Tc(),Ee.updateQueue=i),s=i.lastEffect,s===null?i.lastEffect=e.next=e:(l=s.next,s.next=e,e.next=l,i.lastEffect=e),e}function Eg(){return pn().memoizedState}function wc(e,i,s,l){var f=qn();Ee.flags|=e,f.memoizedState=zs(1|i,{destroy:void 0},s,l===void 0?null:l)}function Cc(e,i,s,l){var f=pn();l=l===void 0?null:l;var h=f.memoizedState.inst;Ke!==null&&l!==null&&ph(l,Ke.memoizedState.deps)?f.memoizedState=zs(i,h,s,l):(Ee.flags|=e,f.memoizedState=zs(1|i,h,s,l))}function bg(e,i){wc(8390656,8,e,i)}function bh(e,i){Cc(2048,8,e,i)}function AM(e){Ee.flags|=4;var i=Ee.updateQueue;if(i===null)i=Tc(),Ee.updateQueue=i,i.events=[e];else{var s=i.events;s===null?i.events=[e]:s.push(e)}}function Tg(e){var i=pn().memoizedState;return AM({ref:i,nextImpl:e}),function(){if((Fe&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function Ag(e,i){return Cc(4,2,e,i)}function Rg(e,i){return Cc(4,4,e,i)}function wg(e,i){if(typeof i=="function"){e=e();var s=i(e);return function(){typeof s=="function"?s():i(null)}}if(i!=null)return e=e(),i.current=e,function(){i.current=null}}function Cg(e,i,s){s=s!=null?s.concat([e]):null,Cc(4,4,wg.bind(null,i,e),s)}function Th(){}function Dg(e,i){var s=pn();i=i===void 0?null:i;var l=s.memoizedState;return i!==null&&ph(i,l[1])?l[0]:(s.memoizedState=[e,i],e)}function Lg(e,i){var s=pn();i=i===void 0?null:i;var l=s.memoizedState;if(i!==null&&ph(i,l[1]))return l[0];if(l=e(),Kr){Dt(!0);try{e()}finally{Dt(!1)}}return s.memoizedState=[l,i],l}function Ah(e,i,s){return s===void 0||(xa&1073741824)!==0&&(De&261930)===0?e.memoizedState=i:(e.memoizedState=s,e=U_(),Ee.lanes|=e,lr|=e,s)}function Ug(e,i,s,l){return ci(s,i)?s:Ps.current!==null?(e=Ah(e,s,l),ci(e,i)||(xn=!0),e):(xa&42)===0||(xa&1073741824)!==0&&(De&261930)===0?(xn=!0,e.memoizedState=s):(e=U_(),Ee.lanes|=e,lr|=e,i)}function Ng(e,i,s,l,f){var h=V.p;V.p=h!==0&&8>h?h:8;var M=F.T,C={};F.T=C,Ch(e,!1,i,s);try{var G=f(),it=F.S;if(it!==null&&it(C,G),G!==null&&typeof G=="object"&&typeof G.then=="function"){var pt=SM(G,l);tl(e,i,pt,mi(e))}else tl(e,i,l,mi(e))}catch(yt){tl(e,i,{then:function(){},status:"rejected",reason:yt},mi())}finally{V.p=h,M!==null&&C.types!==null&&(M.types=C.types),F.T=M}}function RM(){}function Rh(e,i,s,l){if(e.tag!==5)throw Error(a(476));var f=Og(e).queue;Ng(e,f,i,et,s===null?RM:function(){return Pg(e),s(l)})}function Og(e){var i=e.memoizedState;if(i!==null)return i;i={memoizedState:et,baseState:et,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ya,lastRenderedState:et},next:null};var s={};return i.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ya,lastRenderedState:s},next:null},e.memoizedState=i,e=e.alternate,e!==null&&(e.memoizedState=i),i}function Pg(e){var i=Og(e);i.next===null&&(i=e.alternate.memoizedState),tl(e,i.next.queue,{},mi())}function wh(){return Nn(_l)}function Bg(){return pn().memoizedState}function Ig(){return pn().memoizedState}function wM(e){for(var i=e.return;i!==null;){switch(i.tag){case 24:case 3:var s=mi();e=nr(s);var l=ir(i,e,s);l!==null&&(ei(l,i,s),Ko(l,i,s)),i={cache:ih()},e.payload=i;return}i=i.return}}function CM(e,i,s){var l=mi();s={lane:l,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Dc(e)?Fg(i,s):(s=qf(e,i,s,l),s!==null&&(ei(s,e,l),Hg(s,i,l)))}function zg(e,i,s){var l=mi();tl(e,i,s,l)}function tl(e,i,s,l){var f={lane:l,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(Dc(e))Fg(i,f);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=i.lastRenderedReducer,h!==null))try{var M=i.lastRenderedState,C=h(M,s);if(f.hasEagerState=!0,f.eagerState=C,ci(C,M))return uc(e,i,f,0),tn===null&&cc(),!1}catch{}if(s=qf(e,i,f,l),s!==null)return ei(s,e,l),Hg(s,i,l),!0}return!1}function Ch(e,i,s,l){if(l={lane:2,revertLane:od(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Dc(e)){if(i)throw Error(a(479))}else i=qf(e,s,l,2),i!==null&&ei(i,e,2)}function Dc(e){var i=e.alternate;return e===Ee||i!==null&&i===Ee}function Fg(e,i){Bs=Ec=!0;var s=e.pending;s===null?i.next=i:(i.next=s.next,s.next=i),e.pending=i}function Hg(e,i,s){if((s&4194048)!==0){var l=i.lanes;l&=e.pendingLanes,s|=l,i.lanes=s,ri(e,s)}}var el={readContext:Nn,use:Ac,useCallback:un,useContext:un,useEffect:un,useImperativeHandle:un,useLayoutEffect:un,useInsertionEffect:un,useMemo:un,useReducer:un,useRef:un,useState:un,useDebugValue:un,useDeferredValue:un,useTransition:un,useSyncExternalStore:un,useId:un,useHostTransitionStatus:un,useFormState:un,useActionState:un,useOptimistic:un,useMemoCache:un,useCacheRefresh:un};el.useEffectEvent=un;var Gg={readContext:Nn,use:Ac,useCallback:function(e,i){return qn().memoizedState=[e,i===void 0?null:i],e},useContext:Nn,useEffect:bg,useImperativeHandle:function(e,i,s){s=s!=null?s.concat([e]):null,wc(4194308,4,wg.bind(null,i,e),s)},useLayoutEffect:function(e,i){return wc(4194308,4,e,i)},useInsertionEffect:function(e,i){wc(4,2,e,i)},useMemo:function(e,i){var s=qn();i=i===void 0?null:i;var l=e();if(Kr){Dt(!0);try{e()}finally{Dt(!1)}}return s.memoizedState=[l,i],l},useReducer:function(e,i,s){var l=qn();if(s!==void 0){var f=s(i);if(Kr){Dt(!0);try{s(i)}finally{Dt(!1)}}}else f=i;return l.memoizedState=l.baseState=f,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:f},l.queue=e,e=e.dispatch=CM.bind(null,Ee,e),[l.memoizedState,e]},useRef:function(e){var i=qn();return e={current:e},i.memoizedState=e},useState:function(e){e=Mh(e);var i=e.queue,s=zg.bind(null,Ee,i);return i.dispatch=s,[e.memoizedState,s]},useDebugValue:Th,useDeferredValue:function(e,i){var s=qn();return Ah(s,e,i)},useTransition:function(){var e=Mh(!1);return e=Ng.bind(null,Ee,e.queue,!0,!1),qn().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,i,s){var l=Ee,f=qn();if(Ue){if(s===void 0)throw Error(a(407));s=s()}else{if(s=i(),tn===null)throw Error(a(349));(De&127)!==0||lg(l,i,s)}f.memoizedState=s;var h={value:s,getSnapshot:i};return f.queue=h,bg(ug.bind(null,l,h,e),[e]),l.flags|=2048,zs(9,{destroy:void 0},cg.bind(null,l,h,s,i),null),s},useId:function(){var e=qn(),i=tn.identifierPrefix;if(Ue){var s=Ji,l=Qi;s=(l&~(1<<32-Xt(l)-1)).toString(32)+s,i="_"+i+"R_"+s,s=bc++,0<s&&(i+="H"+s.toString(32)),i+="_"}else s=MM++,i="_"+i+"r_"+s.toString(32)+"_";return e.memoizedState=i},useHostTransitionStatus:wh,useFormState:xg,useActionState:xg,useOptimistic:function(e){var i=qn();i.memoizedState=i.baseState=e;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=s,i=Ch.bind(null,Ee,!0,s),s.dispatch=i,[e,i]},useMemoCache:xh,useCacheRefresh:function(){return qn().memoizedState=wM.bind(null,Ee)},useEffectEvent:function(e){var i=qn(),s={impl:e};return i.memoizedState=s,function(){if((Fe&2)!==0)throw Error(a(440));return s.impl.apply(void 0,arguments)}}},Dh={readContext:Nn,use:Ac,useCallback:Dg,useContext:Nn,useEffect:bh,useImperativeHandle:Cg,useInsertionEffect:Ag,useLayoutEffect:Rg,useMemo:Lg,useReducer:Rc,useRef:Eg,useState:function(){return Rc(ya)},useDebugValue:Th,useDeferredValue:function(e,i){var s=pn();return Ug(s,Ke.memoizedState,e,i)},useTransition:function(){var e=Rc(ya)[0],i=pn().memoizedState;return[typeof e=="boolean"?e:$o(e),i]},useSyncExternalStore:og,useId:Bg,useHostTransitionStatus:wh,useFormState:yg,useActionState:yg,useOptimistic:function(e,i){var s=pn();return dg(s,Ke,e,i)},useMemoCache:xh,useCacheRefresh:Ig};Dh.useEffectEvent=Tg;var Vg={readContext:Nn,use:Ac,useCallback:Dg,useContext:Nn,useEffect:bh,useImperativeHandle:Cg,useInsertionEffect:Ag,useLayoutEffect:Rg,useMemo:Lg,useReducer:Sh,useRef:Eg,useState:function(){return Sh(ya)},useDebugValue:Th,useDeferredValue:function(e,i){var s=pn();return Ke===null?Ah(s,e,i):Ug(s,Ke.memoizedState,e,i)},useTransition:function(){var e=Sh(ya)[0],i=pn().memoizedState;return[typeof e=="boolean"?e:$o(e),i]},useSyncExternalStore:og,useId:Bg,useHostTransitionStatus:wh,useFormState:Mg,useActionState:Mg,useOptimistic:function(e,i){var s=pn();return Ke!==null?dg(s,Ke,e,i):(s.baseState=e,[e,s.queue.dispatch])},useMemoCache:xh,useCacheRefresh:Ig};Vg.useEffectEvent=Tg;function Lh(e,i,s,l){i=e.memoizedState,s=s(l,i),s=s==null?i:v({},i,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var Uh={enqueueSetState:function(e,i,s){e=e._reactInternals;var l=mi(),f=nr(l);f.payload=i,s!=null&&(f.callback=s),i=ir(e,f,l),i!==null&&(ei(i,e,l),Ko(i,e,l))},enqueueReplaceState:function(e,i,s){e=e._reactInternals;var l=mi(),f=nr(l);f.tag=1,f.payload=i,s!=null&&(f.callback=s),i=ir(e,f,l),i!==null&&(ei(i,e,l),Ko(i,e,l))},enqueueForceUpdate:function(e,i){e=e._reactInternals;var s=mi(),l=nr(s);l.tag=2,i!=null&&(l.callback=i),i=ir(e,l,s),i!==null&&(ei(i,e,s),Ko(i,e,s))}};function kg(e,i,s,l,f,h,M){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,h,M):i.prototype&&i.prototype.isPureReactComponent?!Go(s,l)||!Go(f,h):!0}function Wg(e,i,s,l){e=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(s,l),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(s,l),i.state!==e&&Uh.enqueueReplaceState(i,i.state,null)}function Qr(e,i){var s=i;if("ref"in i){s={};for(var l in i)l!=="ref"&&(s[l]=i[l])}if(e=e.defaultProps){s===i&&(s=v({},s));for(var f in e)s[f]===void 0&&(s[f]=e[f])}return s}function Xg(e){lc(e)}function qg(e){console.error(e)}function Yg(e){lc(e)}function Lc(e,i){try{var s=e.onUncaughtError;s(i.value,{componentStack:i.stack})}catch(l){setTimeout(function(){throw l})}}function Zg(e,i,s){try{var l=e.onCaughtError;l(s.value,{componentStack:s.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Nh(e,i,s){return s=nr(s),s.tag=3,s.payload={element:null},s.callback=function(){Lc(e,i)},s}function Kg(e){return e=nr(e),e.tag=3,e}function Qg(e,i,s,l){var f=s.type.getDerivedStateFromError;if(typeof f=="function"){var h=l.value;e.payload=function(){return f(h)},e.callback=function(){Zg(i,s,l)}}var M=s.stateNode;M!==null&&typeof M.componentDidCatch=="function"&&(e.callback=function(){Zg(i,s,l),typeof f!="function"&&(cr===null?cr=new Set([this]):cr.add(this));var C=l.stack;this.componentDidCatch(l.value,{componentStack:C!==null?C:""})})}function DM(e,i,s,l,f){if(s.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(i=s.alternate,i!==null&&Ds(i,s,f,!0),s=fi.current,s!==null){switch(s.tag){case 31:case 13:return wi===null?kc():s.alternate===null&&fn===0&&(fn=3),s.flags&=-257,s.flags|=65536,s.lanes=f,l===vc?s.flags|=16384:(i=s.updateQueue,i===null?s.updateQueue=new Set([l]):i.add(l),ad(e,l,f)),!1;case 22:return s.flags|=65536,l===vc?s.flags|=16384:(i=s.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([l])},s.updateQueue=i):(s=i.retryQueue,s===null?i.retryQueue=new Set([l]):s.add(l)),ad(e,l,f)),!1}throw Error(a(435,s.tag))}return ad(e,l,f),kc(),!1}if(Ue)return i=fi.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=f,l!==jf&&(e=Error(a(422),{cause:l}),Wo(bi(e,s)))):(l!==jf&&(i=Error(a(423),{cause:l}),Wo(bi(i,s))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,l=bi(l,s),f=Nh(e.stateNode,l,f),ch(e,f),fn!==4&&(fn=2)),!1;var h=Error(a(520),{cause:l});if(h=bi(h,s),cl===null?cl=[h]:cl.push(h),fn!==4&&(fn=2),i===null)return!0;l=bi(l,s),s=i;do{switch(s.tag){case 3:return s.flags|=65536,e=f&-f,s.lanes|=e,e=Nh(s.stateNode,l,e),ch(s,e),!1;case 1:if(i=s.type,h=s.stateNode,(s.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(cr===null||!cr.has(h))))return s.flags|=65536,f&=-f,s.lanes|=f,f=Kg(f),Qg(f,e,s,l),ch(s,f),!1}s=s.return}while(s!==null);return!1}var Oh=Error(a(461)),xn=!1;function On(e,i,s,l){i.child=e===null?tg(i,null,s,l):Zr(i,e.child,s,l)}function Jg(e,i,s,l,f){s=s.render;var h=i.ref;if("ref"in l){var M={};for(var C in l)C!=="ref"&&(M[C]=l[C])}else M=l;return Wr(i),l=mh(e,i,s,M,h,f),C=gh(),e!==null&&!xn?(_h(e,i,f),Sa(e,i,f)):(Ue&&C&&Qf(i),i.flags|=1,On(e,i,l,f),i.child)}function jg(e,i,s,l,f){if(e===null){var h=s.type;return typeof h=="function"&&!Yf(h)&&h.defaultProps===void 0&&s.compare===null?(i.tag=15,i.type=h,$g(e,i,h,l,f)):(e=hc(s.type,null,l,i,i.mode,f),e.ref=i.ref,e.return=i,i.child=e)}if(h=e.child,!Vh(e,f)){var M=h.memoizedProps;if(s=s.compare,s=s!==null?s:Go,s(M,l)&&e.ref===i.ref)return Sa(e,i,f)}return i.flags|=1,e=ma(h,l),e.ref=i.ref,e.return=i,i.child=e}function $g(e,i,s,l,f){if(e!==null){var h=e.memoizedProps;if(Go(h,l)&&e.ref===i.ref)if(xn=!1,i.pendingProps=l=h,Vh(e,f))(e.flags&131072)!==0&&(xn=!0);else return i.lanes=e.lanes,Sa(e,i,f)}return Ph(e,i,s,l,f)}function t_(e,i,s,l){var f=l.children,h=e!==null?e.memoizedState:null;if(e===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((i.flags&128)!==0){if(h=h!==null?h.baseLanes|s:s,e!==null){for(l=i.child=e.child,f=0;l!==null;)f=f|l.lanes|l.childLanes,l=l.sibling;l=f&~h}else l=0,i.child=null;return e_(e,i,h,s,l)}if((s&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},e!==null&&gc(i,h!==null?h.cachePool:null),h!==null?ig(i,h):fh(),ag(i);else return l=i.lanes=536870912,e_(e,i,h!==null?h.baseLanes|s:s,s,l)}else h!==null?(gc(i,h.cachePool),ig(i,h),rr(),i.memoizedState=null):(e!==null&&gc(i,null),fh(),rr());return On(e,i,f,s),i.child}function nl(e,i){return e!==null&&e.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function e_(e,i,s,l,f){var h=rh();return h=h===null?null:{parent:_n._currentValue,pool:h},i.memoizedState={baseLanes:s,cachePool:h},e!==null&&gc(i,null),fh(),ag(i),e!==null&&Ds(e,i,l,!0),i.childLanes=f,null}function Uc(e,i){return i=Oc({mode:i.mode,children:i.children},e.mode),i.ref=e.ref,e.child=i,i.return=e,i}function n_(e,i,s){return Zr(i,e.child,null,s),e=Uc(i,i.pendingProps),e.flags|=2,hi(i),i.memoizedState=null,e}function LM(e,i,s){var l=i.pendingProps,f=(i.flags&128)!==0;if(i.flags&=-129,e===null){if(Ue){if(l.mode==="hidden")return e=Uc(i,l),i.lanes=536870912,nl(null,e);if(dh(i),(e=en)?(e=pv(e,Ri),e=e!==null&&e.data==="&"?e:null,e!==null&&(i.memoizedState={dehydrated:e,treeContext:Ja!==null?{id:Qi,overflow:Ji}:null,retryLane:536870912,hydrationErrors:null},s=F0(e),s.return=i,i.child=s,Un=i,en=null)):e=null,e===null)throw $a(i);return i.lanes=536870912,null}return Uc(i,l)}var h=e.memoizedState;if(h!==null){var M=h.dehydrated;if(dh(i),f)if(i.flags&256)i.flags&=-257,i=n_(e,i,s);else if(i.memoizedState!==null)i.child=e.child,i.flags|=128,i=null;else throw Error(a(558));else if(xn||Ds(e,i,s,!1),f=(s&e.childLanes)!==0,xn||f){if(l=tn,l!==null&&(M=si(l,s),M!==0&&M!==h.retryLane))throw h.retryLane=M,Hr(e,M),ei(l,e,M),Oh;kc(),i=n_(e,i,s)}else e=h.treeContext,en=Ci(M.nextSibling),Un=i,Ue=!0,ja=null,Ri=!1,e!==null&&V0(i,e),i=Uc(i,l),i.flags|=4096;return i}return e=ma(e.child,{mode:l.mode,children:l.children}),e.ref=i.ref,i.child=e,e.return=i,e}function Nc(e,i){var s=i.ref;if(s===null)e!==null&&e.ref!==null&&(i.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(a(284));(e===null||e.ref!==s)&&(i.flags|=4194816)}}function Ph(e,i,s,l,f){return Wr(i),s=mh(e,i,s,l,void 0,f),l=gh(),e!==null&&!xn?(_h(e,i,f),Sa(e,i,f)):(Ue&&l&&Qf(i),i.flags|=1,On(e,i,s,f),i.child)}function i_(e,i,s,l,f,h){return Wr(i),i.updateQueue=null,s=sg(i,l,s,f),rg(e),l=gh(),e!==null&&!xn?(_h(e,i,h),Sa(e,i,h)):(Ue&&l&&Qf(i),i.flags|=1,On(e,i,s,h),i.child)}function a_(e,i,s,l,f){if(Wr(i),i.stateNode===null){var h=As,M=s.contextType;typeof M=="object"&&M!==null&&(h=Nn(M)),h=new s(l,h),i.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=Uh,i.stateNode=h,h._reactInternals=i,h=i.stateNode,h.props=l,h.state=i.memoizedState,h.refs={},oh(i),M=s.contextType,h.context=typeof M=="object"&&M!==null?Nn(M):As,h.state=i.memoizedState,M=s.getDerivedStateFromProps,typeof M=="function"&&(Lh(i,s,M,l),h.state=i.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(M=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),M!==h.state&&Uh.enqueueReplaceState(h,h.state,null),Jo(i,l,h,f),Qo(),h.state=i.memoizedState),typeof h.componentDidMount=="function"&&(i.flags|=4194308),l=!0}else if(e===null){h=i.stateNode;var C=i.memoizedProps,G=Qr(s,C);h.props=G;var it=h.context,pt=s.contextType;M=As,typeof pt=="object"&&pt!==null&&(M=Nn(pt));var yt=s.getDerivedStateFromProps;pt=typeof yt=="function"||typeof h.getSnapshotBeforeUpdate=="function",C=i.pendingProps!==C,pt||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(C||it!==M)&&Wg(i,h,l,M),er=!1;var lt=i.memoizedState;h.state=lt,Jo(i,l,h,f),Qo(),it=i.memoizedState,C||lt!==it||er?(typeof yt=="function"&&(Lh(i,s,yt,l),it=i.memoizedState),(G=er||kg(i,s,G,l,lt,it,M))?(pt||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(i.flags|=4194308)):(typeof h.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=l,i.memoizedState=it),h.props=l,h.state=it,h.context=M,l=G):(typeof h.componentDidMount=="function"&&(i.flags|=4194308),l=!1)}else{h=i.stateNode,lh(e,i),M=i.memoizedProps,pt=Qr(s,M),h.props=pt,yt=i.pendingProps,lt=h.context,it=s.contextType,G=As,typeof it=="object"&&it!==null&&(G=Nn(it)),C=s.getDerivedStateFromProps,(it=typeof C=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(M!==yt||lt!==G)&&Wg(i,h,l,G),er=!1,lt=i.memoizedState,h.state=lt,Jo(i,l,h,f),Qo();var ut=i.memoizedState;M!==yt||lt!==ut||er||e!==null&&e.dependencies!==null&&pc(e.dependencies)?(typeof C=="function"&&(Lh(i,s,C,l),ut=i.memoizedState),(pt=er||kg(i,s,pt,l,lt,ut,G)||e!==null&&e.dependencies!==null&&pc(e.dependencies))?(it||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(l,ut,G),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(l,ut,G)),typeof h.componentDidUpdate=="function"&&(i.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof h.componentDidUpdate!="function"||M===e.memoizedProps&&lt===e.memoizedState||(i.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||M===e.memoizedProps&&lt===e.memoizedState||(i.flags|=1024),i.memoizedProps=l,i.memoizedState=ut),h.props=l,h.state=ut,h.context=G,l=pt):(typeof h.componentDidUpdate!="function"||M===e.memoizedProps&&lt===e.memoizedState||(i.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||M===e.memoizedProps&&lt===e.memoizedState||(i.flags|=1024),l=!1)}return h=l,Nc(e,i),l=(i.flags&128)!==0,h||l?(h=i.stateNode,s=l&&typeof s.getDerivedStateFromError!="function"?null:h.render(),i.flags|=1,e!==null&&l?(i.child=Zr(i,e.child,null,f),i.child=Zr(i,null,s,f)):On(e,i,s,f),i.memoizedState=h.state,e=i.child):e=Sa(e,i,f),e}function r_(e,i,s,l){return Vr(),i.flags|=256,On(e,i,s,l),i.child}var Bh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ih(e){return{baseLanes:e,cachePool:Z0()}}function zh(e,i,s){return e=e!==null?e.childLanes&~s:0,i&&(e|=pi),e}function s_(e,i,s){var l=i.pendingProps,f=!1,h=(i.flags&128)!==0,M;if((M=h)||(M=e!==null&&e.memoizedState===null?!1:(dn.current&2)!==0),M&&(f=!0,i.flags&=-129),M=(i.flags&32)!==0,i.flags&=-33,e===null){if(Ue){if(f?ar(i):rr(),(e=en)?(e=pv(e,Ri),e=e!==null&&e.data!=="&"?e:null,e!==null&&(i.memoizedState={dehydrated:e,treeContext:Ja!==null?{id:Qi,overflow:Ji}:null,retryLane:536870912,hydrationErrors:null},s=F0(e),s.return=i,i.child=s,Un=i,en=null)):e=null,e===null)throw $a(i);return yd(e)?i.lanes=32:i.lanes=536870912,null}var C=l.children;return l=l.fallback,f?(rr(),f=i.mode,C=Oc({mode:"hidden",children:C},f),l=Gr(l,f,s,null),C.return=i,l.return=i,C.sibling=l,i.child=C,l=i.child,l.memoizedState=Ih(s),l.childLanes=zh(e,M,s),i.memoizedState=Bh,nl(null,l)):(ar(i),Fh(i,C))}var G=e.memoizedState;if(G!==null&&(C=G.dehydrated,C!==null)){if(h)i.flags&256?(ar(i),i.flags&=-257,i=Hh(e,i,s)):i.memoizedState!==null?(rr(),i.child=e.child,i.flags|=128,i=null):(rr(),C=l.fallback,f=i.mode,l=Oc({mode:"visible",children:l.children},f),C=Gr(C,f,s,null),C.flags|=2,l.return=i,C.return=i,l.sibling=C,i.child=l,Zr(i,e.child,null,s),l=i.child,l.memoizedState=Ih(s),l.childLanes=zh(e,M,s),i.memoizedState=Bh,i=nl(null,l));else if(ar(i),yd(C)){if(M=C.nextSibling&&C.nextSibling.dataset,M)var it=M.dgst;M=it,l=Error(a(419)),l.stack="",l.digest=M,Wo({value:l,source:null,stack:null}),i=Hh(e,i,s)}else if(xn||Ds(e,i,s,!1),M=(s&e.childLanes)!==0,xn||M){if(M=tn,M!==null&&(l=si(M,s),l!==0&&l!==G.retryLane))throw G.retryLane=l,Hr(e,l),ei(M,e,l),Oh;xd(C)||kc(),i=Hh(e,i,s)}else xd(C)?(i.flags|=192,i.child=e.child,i=null):(e=G.treeContext,en=Ci(C.nextSibling),Un=i,Ue=!0,ja=null,Ri=!1,e!==null&&V0(i,e),i=Fh(i,l.children),i.flags|=4096);return i}return f?(rr(),C=l.fallback,f=i.mode,G=e.child,it=G.sibling,l=ma(G,{mode:"hidden",children:l.children}),l.subtreeFlags=G.subtreeFlags&65011712,it!==null?C=ma(it,C):(C=Gr(C,f,s,null),C.flags|=2),C.return=i,l.return=i,l.sibling=C,i.child=l,nl(null,l),l=i.child,C=e.child.memoizedState,C===null?C=Ih(s):(f=C.cachePool,f!==null?(G=_n._currentValue,f=f.parent!==G?{parent:G,pool:G}:f):f=Z0(),C={baseLanes:C.baseLanes|s,cachePool:f}),l.memoizedState=C,l.childLanes=zh(e,M,s),i.memoizedState=Bh,nl(e.child,l)):(ar(i),s=e.child,e=s.sibling,s=ma(s,{mode:"visible",children:l.children}),s.return=i,s.sibling=null,e!==null&&(M=i.deletions,M===null?(i.deletions=[e],i.flags|=16):M.push(e)),i.child=s,i.memoizedState=null,s)}function Fh(e,i){return i=Oc({mode:"visible",children:i},e.mode),i.return=e,e.child=i}function Oc(e,i){return e=ui(22,e,null,i),e.lanes=0,e}function Hh(e,i,s){return Zr(i,e.child,null,s),e=Fh(i,i.pendingProps.children),e.flags|=2,i.memoizedState=null,e}function o_(e,i,s){e.lanes|=i;var l=e.alternate;l!==null&&(l.lanes|=i),eh(e.return,i,s)}function Gh(e,i,s,l,f,h){var M=e.memoizedState;M===null?e.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:l,tail:s,tailMode:f,treeForkCount:h}:(M.isBackwards=i,M.rendering=null,M.renderingStartTime=0,M.last=l,M.tail=s,M.tailMode=f,M.treeForkCount=h)}function l_(e,i,s){var l=i.pendingProps,f=l.revealOrder,h=l.tail;l=l.children;var M=dn.current,C=(M&2)!==0;if(C?(M=M&1|2,i.flags|=128):M&=1,bt(dn,M),On(e,i,l,s),l=Ue?ko:0,!C&&e!==null&&(e.flags&128)!==0)t:for(e=i.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&o_(e,s,i);else if(e.tag===19)o_(e,s,i);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===i)break t;for(;e.sibling===null;){if(e.return===null||e.return===i)break t;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(f){case"forwards":for(s=i.child,f=null;s!==null;)e=s.alternate,e!==null&&Mc(e)===null&&(f=s),s=s.sibling;s=f,s===null?(f=i.child,i.child=null):(f=s.sibling,s.sibling=null),Gh(i,!1,f,s,h,l);break;case"backwards":case"unstable_legacy-backwards":for(s=null,f=i.child,i.child=null;f!==null;){if(e=f.alternate,e!==null&&Mc(e)===null){i.child=f;break}e=f.sibling,f.sibling=s,s=f,f=e}Gh(i,!0,s,null,h,l);break;case"together":Gh(i,!1,null,null,void 0,l);break;default:i.memoizedState=null}return i.child}function Sa(e,i,s){if(e!==null&&(i.dependencies=e.dependencies),lr|=i.lanes,(s&i.childLanes)===0)if(e!==null){if(Ds(e,i,s,!1),(s&i.childLanes)===0)return null}else return null;if(e!==null&&i.child!==e.child)throw Error(a(153));if(i.child!==null){for(e=i.child,s=ma(e,e.pendingProps),i.child=s,s.return=i;e.sibling!==null;)e=e.sibling,s=s.sibling=ma(e,e.pendingProps),s.return=i;s.sibling=null}return i.child}function Vh(e,i){return(e.lanes&i)!==0?!0:(e=e.dependencies,!!(e!==null&&pc(e)))}function UM(e,i,s){switch(i.tag){case 3:Et(i,i.stateNode.containerInfo),tr(i,_n,e.memoizedState.cache),Vr();break;case 27:case 5:ge(i);break;case 4:Et(i,i.stateNode.containerInfo);break;case 10:tr(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,dh(i),null;break;case 13:var l=i.memoizedState;if(l!==null)return l.dehydrated!==null?(ar(i),i.flags|=128,null):(s&i.child.childLanes)!==0?s_(e,i,s):(ar(i),e=Sa(e,i,s),e!==null?e.sibling:null);ar(i);break;case 19:var f=(e.flags&128)!==0;if(l=(s&i.childLanes)!==0,l||(Ds(e,i,s,!1),l=(s&i.childLanes)!==0),f){if(l)return l_(e,i,s);i.flags|=128}if(f=i.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),bt(dn,dn.current),l)break;return null;case 22:return i.lanes=0,t_(e,i,s,i.pendingProps);case 24:tr(i,_n,e.memoizedState.cache)}return Sa(e,i,s)}function c_(e,i,s){if(e!==null)if(e.memoizedProps!==i.pendingProps)xn=!0;else{if(!Vh(e,s)&&(i.flags&128)===0)return xn=!1,UM(e,i,s);xn=(e.flags&131072)!==0}else xn=!1,Ue&&(i.flags&1048576)!==0&&G0(i,ko,i.index);switch(i.lanes=0,i.tag){case 16:t:{var l=i.pendingProps;if(e=qr(i.elementType),i.type=e,typeof e=="function")Yf(e)?(l=Qr(e,l),i.tag=1,i=a_(null,i,e,l,s)):(i.tag=0,i=Ph(null,i,e,l,s));else{if(e!=null){var f=e.$$typeof;if(f===w){i.tag=11,i=Jg(null,i,e,l,s);break t}else if(f===P){i.tag=14,i=jg(null,i,e,l,s);break t}}throw i=vt(e)||e,Error(a(306,i,""))}}return i;case 0:return Ph(e,i,i.type,i.pendingProps,s);case 1:return l=i.type,f=Qr(l,i.pendingProps),a_(e,i,l,f,s);case 3:t:{if(Et(i,i.stateNode.containerInfo),e===null)throw Error(a(387));l=i.pendingProps;var h=i.memoizedState;f=h.element,lh(e,i),Jo(i,l,null,s);var M=i.memoizedState;if(l=M.cache,tr(i,_n,l),l!==h.cache&&nh(i,[_n],s,!0),Qo(),l=M.element,h.isDehydrated)if(h={element:l,isDehydrated:!1,cache:M.cache},i.updateQueue.baseState=h,i.memoizedState=h,i.flags&256){i=r_(e,i,l,s);break t}else if(l!==f){f=bi(Error(a(424)),i),Wo(f),i=r_(e,i,l,s);break t}else for(e=i.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,en=Ci(e.firstChild),Un=i,Ue=!0,ja=null,Ri=!0,s=tg(i,null,l,s),i.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(Vr(),l===f){i=Sa(e,i,s);break t}On(e,i,l,s)}i=i.child}return i;case 26:return Nc(e,i),e===null?(s=yv(i.type,null,i.pendingProps,null))?i.memoizedState=s:Ue||(s=i.type,e=i.pendingProps,l=Qc(st.current).createElement(s),l[mn]=i,l[Ln]=e,Pn(l,s,e),gn(l),i.stateNode=l):i.memoizedState=yv(i.type,e.memoizedProps,i.pendingProps,e.memoizedState),null;case 27:return ge(i),e===null&&Ue&&(l=i.stateNode=_v(i.type,i.pendingProps,st.current),Un=i,Ri=!0,f=en,dr(i.type)?(Sd=f,en=Ci(l.firstChild)):en=f),On(e,i,i.pendingProps.children,s),Nc(e,i),e===null&&(i.flags|=4194304),i.child;case 5:return e===null&&Ue&&((f=l=en)&&(l=l1(l,i.type,i.pendingProps,Ri),l!==null?(i.stateNode=l,Un=i,en=Ci(l.firstChild),Ri=!1,f=!0):f=!1),f||$a(i)),ge(i),f=i.type,h=i.pendingProps,M=e!==null?e.memoizedProps:null,l=h.children,gd(f,h)?l=null:M!==null&&gd(f,M)&&(i.flags|=32),i.memoizedState!==null&&(f=mh(e,i,EM,null,null,s),_l._currentValue=f),Nc(e,i),On(e,i,l,s),i.child;case 6:return e===null&&Ue&&((e=s=en)&&(s=c1(s,i.pendingProps,Ri),s!==null?(i.stateNode=s,Un=i,en=null,e=!0):e=!1),e||$a(i)),null;case 13:return s_(e,i,s);case 4:return Et(i,i.stateNode.containerInfo),l=i.pendingProps,e===null?i.child=Zr(i,null,l,s):On(e,i,l,s),i.child;case 11:return Jg(e,i,i.type,i.pendingProps,s);case 7:return On(e,i,i.pendingProps,s),i.child;case 8:return On(e,i,i.pendingProps.children,s),i.child;case 12:return On(e,i,i.pendingProps.children,s),i.child;case 10:return l=i.pendingProps,tr(i,i.type,l.value),On(e,i,l.children,s),i.child;case 9:return f=i.type._context,l=i.pendingProps.children,Wr(i),f=Nn(f),l=l(f),i.flags|=1,On(e,i,l,s),i.child;case 14:return jg(e,i,i.type,i.pendingProps,s);case 15:return $g(e,i,i.type,i.pendingProps,s);case 19:return l_(e,i,s);case 31:return LM(e,i,s);case 22:return t_(e,i,s,i.pendingProps);case 24:return Wr(i),l=Nn(_n),e===null?(f=rh(),f===null&&(f=tn,h=ih(),f.pooledCache=h,h.refCount++,h!==null&&(f.pooledCacheLanes|=s),f=h),i.memoizedState={parent:l,cache:f},oh(i),tr(i,_n,f)):((e.lanes&s)!==0&&(lh(e,i),Jo(i,null,null,s),Qo()),f=e.memoizedState,h=i.memoizedState,f.parent!==l?(f={parent:l,cache:l},i.memoizedState=f,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=f),tr(i,_n,l)):(l=h.cache,tr(i,_n,l),l!==f.cache&&nh(i,[_n],s,!0))),On(e,i,i.pendingProps.children,s),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function Ma(e){e.flags|=4}function kh(e,i,s,l,f){if((i=(e.mode&32)!==0)&&(i=!1),i){if(e.flags|=16777216,(f&335544128)===f)if(e.stateNode.complete)e.flags|=8192;else if(B_())e.flags|=8192;else throw Yr=vc,sh}else e.flags&=-16777217}function u_(e,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Tv(i))if(B_())e.flags|=8192;else throw Yr=vc,sh}function Pc(e,i){i!==null&&(e.flags|=4),e.flags&16384&&(i=e.tag!==22?Tt():536870912,e.lanes|=i,Vs|=i)}function il(e,i){if(!Ue)switch(e.tailMode){case"hidden":i=e.tail;for(var s=null;i!==null;)i.alternate!==null&&(s=i),i=i.sibling;s===null?e.tail=null:s.sibling=null;break;case"collapsed":s=e.tail;for(var l=null;s!==null;)s.alternate!==null&&(l=s),s=s.sibling;l===null?i||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function nn(e){var i=e.alternate!==null&&e.alternate.child===e.child,s=0,l=0;if(i)for(var f=e.child;f!==null;)s|=f.lanes|f.childLanes,l|=f.subtreeFlags&65011712,l|=f.flags&65011712,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)s|=f.lanes|f.childLanes,l|=f.subtreeFlags,l|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=l,e.childLanes=s,i}function NM(e,i,s){var l=i.pendingProps;switch(Jf(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return nn(i),null;case 1:return nn(i),null;case 3:return s=i.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),i.memoizedState.cache!==l&&(i.flags|=2048),va(_n),Yt(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(Cs(i)?Ma(i):e===null||e.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,$f())),nn(i),null;case 26:var f=i.type,h=i.memoizedState;return e===null?(Ma(i),h!==null?(nn(i),u_(i,h)):(nn(i),kh(i,f,null,l,s))):h?h!==e.memoizedState?(Ma(i),nn(i),u_(i,h)):(nn(i),i.flags&=-16777217):(e=e.memoizedProps,e!==l&&Ma(i),nn(i),kh(i,f,e,l,s)),null;case 27:if(se(i),s=st.current,f=i.type,e!==null&&i.stateNode!=null)e.memoizedProps!==l&&Ma(i);else{if(!l){if(i.stateNode===null)throw Error(a(166));return nn(i),null}e=Lt.current,Cs(i)?k0(i):(e=_v(f,l,s),i.stateNode=e,Ma(i))}return nn(i),null;case 5:if(se(i),f=i.type,e!==null&&i.stateNode!=null)e.memoizedProps!==l&&Ma(i);else{if(!l){if(i.stateNode===null)throw Error(a(166));return nn(i),null}if(h=Lt.current,Cs(i))k0(i);else{var M=Qc(st.current);switch(h){case 1:h=M.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:h=M.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":h=M.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":h=M.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":h=M.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof l.is=="string"?M.createElement("select",{is:l.is}):M.createElement("select"),l.multiple?h.multiple=!0:l.size&&(h.size=l.size);break;default:h=typeof l.is=="string"?M.createElement(f,{is:l.is}):M.createElement(f)}}h[mn]=i,h[Ln]=l;t:for(M=i.child;M!==null;){if(M.tag===5||M.tag===6)h.appendChild(M.stateNode);else if(M.tag!==4&&M.tag!==27&&M.child!==null){M.child.return=M,M=M.child;continue}if(M===i)break t;for(;M.sibling===null;){if(M.return===null||M.return===i)break t;M=M.return}M.sibling.return=M.return,M=M.sibling}i.stateNode=h;t:switch(Pn(h,f,l),f){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break t;case"img":l=!0;break t;default:l=!1}l&&Ma(i)}}return nn(i),kh(i,i.type,e===null?null:e.memoizedProps,i.pendingProps,s),null;case 6:if(e&&i.stateNode!=null)e.memoizedProps!==l&&Ma(i);else{if(typeof l!="string"&&i.stateNode===null)throw Error(a(166));if(e=st.current,Cs(i)){if(e=i.stateNode,s=i.memoizedProps,l=null,f=Un,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}e[mn]=i,e=!!(e.nodeValue===s||l!==null&&l.suppressHydrationWarning===!0||sv(e.nodeValue,s)),e||$a(i,!0)}else e=Qc(e).createTextNode(l),e[mn]=i,i.stateNode=e}return nn(i),null;case 31:if(s=i.memoizedState,e===null||e.memoizedState!==null){if(l=Cs(i),s!==null){if(e===null){if(!l)throw Error(a(318));if(e=i.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(a(557));e[mn]=i}else Vr(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;nn(i),e=!1}else s=$f(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),e=!0;if(!e)return i.flags&256?(hi(i),i):(hi(i),null);if((i.flags&128)!==0)throw Error(a(558))}return nn(i),null;case 13:if(l=i.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=Cs(i),l!==null&&l.dehydrated!==null){if(e===null){if(!f)throw Error(a(318));if(f=i.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(a(317));f[mn]=i}else Vr(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;nn(i),f=!1}else f=$f(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return i.flags&256?(hi(i),i):(hi(i),null)}return hi(i),(i.flags&128)!==0?(i.lanes=s,i):(s=l!==null,e=e!==null&&e.memoizedState!==null,s&&(l=i.child,f=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(f=l.alternate.memoizedState.cachePool.pool),h=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(h=l.memoizedState.cachePool.pool),h!==f&&(l.flags|=2048)),s!==e&&s&&(i.child.flags|=8192),Pc(i,i.updateQueue),nn(i),null);case 4:return Yt(),e===null&&fd(i.stateNode.containerInfo),nn(i),null;case 10:return va(i.type),nn(i),null;case 19:if(J(dn),l=i.memoizedState,l===null)return nn(i),null;if(f=(i.flags&128)!==0,h=l.rendering,h===null)if(f)il(l,!1);else{if(fn!==0||e!==null&&(e.flags&128)!==0)for(e=i.child;e!==null;){if(h=Mc(e),h!==null){for(i.flags|=128,il(l,!1),e=h.updateQueue,i.updateQueue=e,Pc(i,e),i.subtreeFlags=0,e=s,s=i.child;s!==null;)z0(s,e),s=s.sibling;return bt(dn,dn.current&1|2),Ue&&ga(i,l.treeForkCount),i.child}e=e.sibling}l.tail!==null&&Ft()>Hc&&(i.flags|=128,f=!0,il(l,!1),i.lanes=4194304)}else{if(!f)if(e=Mc(h),e!==null){if(i.flags|=128,f=!0,e=e.updateQueue,i.updateQueue=e,Pc(i,e),il(l,!0),l.tail===null&&l.tailMode==="hidden"&&!h.alternate&&!Ue)return nn(i),null}else 2*Ft()-l.renderingStartTime>Hc&&s!==536870912&&(i.flags|=128,f=!0,il(l,!1),i.lanes=4194304);l.isBackwards?(h.sibling=i.child,i.child=h):(e=l.last,e!==null?e.sibling=h:i.child=h,l.last=h)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=Ft(),e.sibling=null,s=dn.current,bt(dn,f?s&1|2:s&1),Ue&&ga(i,l.treeForkCount),e):(nn(i),null);case 22:case 23:return hi(i),hh(),l=i.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(i.flags|=8192):l&&(i.flags|=8192),l?(s&536870912)!==0&&(i.flags&128)===0&&(nn(i),i.subtreeFlags&6&&(i.flags|=8192)):nn(i),s=i.updateQueue,s!==null&&Pc(i,s.retryQueue),s=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),l=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(l=i.memoizedState.cachePool.pool),l!==s&&(i.flags|=2048),e!==null&&J(Xr),null;case 24:return s=null,e!==null&&(s=e.memoizedState.cache),i.memoizedState.cache!==s&&(i.flags|=2048),va(_n),nn(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function OM(e,i){switch(Jf(i),i.tag){case 1:return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 3:return va(_n),Yt(),e=i.flags,(e&65536)!==0&&(e&128)===0?(i.flags=e&-65537|128,i):null;case 26:case 27:case 5:return se(i),null;case 31:if(i.memoizedState!==null){if(hi(i),i.alternate===null)throw Error(a(340));Vr()}return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 13:if(hi(i),e=i.memoizedState,e!==null&&e.dehydrated!==null){if(i.alternate===null)throw Error(a(340));Vr()}return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 19:return J(dn),null;case 4:return Yt(),null;case 10:return va(i.type),null;case 22:case 23:return hi(i),hh(),e!==null&&J(Xr),e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 24:return va(_n),null;case 25:return null;default:return null}}function f_(e,i){switch(Jf(i),i.tag){case 3:va(_n),Yt();break;case 26:case 27:case 5:se(i);break;case 4:Yt();break;case 31:i.memoizedState!==null&&hi(i);break;case 13:hi(i);break;case 19:J(dn);break;case 10:va(i.type);break;case 22:case 23:hi(i),hh(),e!==null&&J(Xr);break;case 24:va(_n)}}function al(e,i){try{var s=i.updateQueue,l=s!==null?s.lastEffect:null;if(l!==null){var f=l.next;s=f;do{if((s.tag&e)===e){l=void 0;var h=s.create,M=s.inst;l=h(),M.destroy=l}s=s.next}while(s!==f)}}catch(C){qe(i,i.return,C)}}function sr(e,i,s){try{var l=i.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var h=f.next;l=h;do{if((l.tag&e)===e){var M=l.inst,C=M.destroy;if(C!==void 0){M.destroy=void 0,f=i;var G=s,it=C;try{it()}catch(pt){qe(f,G,pt)}}}l=l.next}while(l!==h)}}catch(pt){qe(i,i.return,pt)}}function h_(e){var i=e.updateQueue;if(i!==null){var s=e.stateNode;try{ng(i,s)}catch(l){qe(e,e.return,l)}}}function d_(e,i,s){s.props=Qr(e.type,e.memoizedProps),s.state=e.memoizedState;try{s.componentWillUnmount()}catch(l){qe(e,i,l)}}function rl(e,i){try{var s=e.ref;if(s!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof s=="function"?e.refCleanup=s(l):s.current=l}}catch(f){qe(e,i,f)}}function ji(e,i){var s=e.ref,l=e.refCleanup;if(s!==null)if(typeof l=="function")try{l()}catch(f){qe(e,i,f)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(f){qe(e,i,f)}else s.current=null}function p_(e){var i=e.type,s=e.memoizedProps,l=e.stateNode;try{t:switch(i){case"button":case"input":case"select":case"textarea":s.autoFocus&&l.focus();break t;case"img":s.src?l.src=s.src:s.srcSet&&(l.srcset=s.srcSet)}}catch(f){qe(e,e.return,f)}}function Wh(e,i,s){try{var l=e.stateNode;n1(l,e.type,s,i),l[Ln]=i}catch(f){qe(e,e.return,f)}}function m_(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&dr(e.type)||e.tag===4}function Xh(e){t:for(;;){for(;e.sibling===null;){if(e.return===null||m_(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&dr(e.type)||e.flags&2||e.child===null||e.tag===4)continue t;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function qh(e,i,s){var l=e.tag;if(l===5||l===6)e=e.stateNode,i?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(e,i):(i=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,i.appendChild(e),s=s._reactRootContainer,s!=null||i.onclick!==null||(i.onclick=da));else if(l!==4&&(l===27&&dr(e.type)&&(s=e.stateNode,i=null),e=e.child,e!==null))for(qh(e,i,s),e=e.sibling;e!==null;)qh(e,i,s),e=e.sibling}function Bc(e,i,s){var l=e.tag;if(l===5||l===6)e=e.stateNode,i?s.insertBefore(e,i):s.appendChild(e);else if(l!==4&&(l===27&&dr(e.type)&&(s=e.stateNode),e=e.child,e!==null))for(Bc(e,i,s),e=e.sibling;e!==null;)Bc(e,i,s),e=e.sibling}function g_(e){var i=e.stateNode,s=e.memoizedProps;try{for(var l=e.type,f=i.attributes;f.length;)i.removeAttributeNode(f[0]);Pn(i,l,s),i[mn]=e,i[Ln]=s}catch(h){qe(e,e.return,h)}}var Ea=!1,yn=!1,Yh=!1,__=typeof WeakSet=="function"?WeakSet:Set,wn=null;function PM(e,i){if(e=e.containerInfo,pd=iu,e=C0(e),Hf(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else t:{s=(s=e.ownerDocument)&&s.defaultView||window;var l=s.getSelection&&s.getSelection();if(l&&l.rangeCount!==0){s=l.anchorNode;var f=l.anchorOffset,h=l.focusNode;l=l.focusOffset;try{s.nodeType,h.nodeType}catch{s=null;break t}var M=0,C=-1,G=-1,it=0,pt=0,yt=e,lt=null;e:for(;;){for(var ut;yt!==s||f!==0&&yt.nodeType!==3||(C=M+f),yt!==h||l!==0&&yt.nodeType!==3||(G=M+l),yt.nodeType===3&&(M+=yt.nodeValue.length),(ut=yt.firstChild)!==null;)lt=yt,yt=ut;for(;;){if(yt===e)break e;if(lt===s&&++it===f&&(C=M),lt===h&&++pt===l&&(G=M),(ut=yt.nextSibling)!==null)break;yt=lt,lt=yt.parentNode}yt=ut}s=C===-1||G===-1?null:{start:C,end:G}}else s=null}s=s||{start:0,end:0}}else s=null;for(md={focusedElem:e,selectionRange:s},iu=!1,wn=i;wn!==null;)if(i=wn,e=i.child,(i.subtreeFlags&1028)!==0&&e!==null)e.return=i,wn=e;else for(;wn!==null;){switch(i=wn,h=i.alternate,e=i.flags,i.tag){case 0:if((e&4)!==0&&(e=i.updateQueue,e=e!==null?e.events:null,e!==null))for(s=0;s<e.length;s++)f=e[s],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&h!==null){e=void 0,s=i,f=h.memoizedProps,h=h.memoizedState,l=s.stateNode;try{var te=Qr(s.type,f);e=l.getSnapshotBeforeUpdate(te,h),l.__reactInternalSnapshotBeforeUpdate=e}catch(_e){qe(s,s.return,_e)}}break;case 3:if((e&1024)!==0){if(e=i.stateNode.containerInfo,s=e.nodeType,s===9)vd(e);else if(s===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":vd(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(a(163))}if(e=i.sibling,e!==null){e.return=i.return,wn=e;break}wn=i.return}}function v_(e,i,s){var l=s.flags;switch(s.tag){case 0:case 11:case 15:Ta(e,s),l&4&&al(5,s);break;case 1:if(Ta(e,s),l&4)if(e=s.stateNode,i===null)try{e.componentDidMount()}catch(M){qe(s,s.return,M)}else{var f=Qr(s.type,i.memoizedProps);i=i.memoizedState;try{e.componentDidUpdate(f,i,e.__reactInternalSnapshotBeforeUpdate)}catch(M){qe(s,s.return,M)}}l&64&&h_(s),l&512&&rl(s,s.return);break;case 3:if(Ta(e,s),l&64&&(e=s.updateQueue,e!==null)){if(i=null,s.child!==null)switch(s.child.tag){case 27:case 5:i=s.child.stateNode;break;case 1:i=s.child.stateNode}try{ng(e,i)}catch(M){qe(s,s.return,M)}}break;case 27:i===null&&l&4&&g_(s);case 26:case 5:Ta(e,s),i===null&&l&4&&p_(s),l&512&&rl(s,s.return);break;case 12:Ta(e,s);break;case 31:Ta(e,s),l&4&&S_(e,s);break;case 13:Ta(e,s),l&4&&M_(e,s),l&64&&(e=s.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(s=WM.bind(null,s),u1(e,s))));break;case 22:if(l=s.memoizedState!==null||Ea,!l){i=i!==null&&i.memoizedState!==null||yn,f=Ea;var h=yn;Ea=l,(yn=i)&&!h?Aa(e,s,(s.subtreeFlags&8772)!==0):Ta(e,s),Ea=f,yn=h}break;case 30:break;default:Ta(e,s)}}function x_(e){var i=e.alternate;i!==null&&(e.alternate=null,x_(i)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(i=e.stateNode,i!==null&&Ya(i)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var on=null,Jn=!1;function ba(e,i,s){for(s=s.child;s!==null;)y_(e,i,s),s=s.sibling}function y_(e,i,s){if(ft&&typeof ft.onCommitFiberUnmount=="function")try{ft.onCommitFiberUnmount(ct,s)}catch{}switch(s.tag){case 26:yn||ji(s,i),ba(e,i,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:yn||ji(s,i);var l=on,f=Jn;dr(s.type)&&(on=s.stateNode,Jn=!1),ba(e,i,s),pl(s.stateNode),on=l,Jn=f;break;case 5:yn||ji(s,i);case 6:if(l=on,f=Jn,on=null,ba(e,i,s),on=l,Jn=f,on!==null)if(Jn)try{(on.nodeType===9?on.body:on.nodeName==="HTML"?on.ownerDocument.body:on).removeChild(s.stateNode)}catch(h){qe(s,i,h)}else try{on.removeChild(s.stateNode)}catch(h){qe(s,i,h)}break;case 18:on!==null&&(Jn?(e=on,hv(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,s.stateNode),Qs(e)):hv(on,s.stateNode));break;case 4:l=on,f=Jn,on=s.stateNode.containerInfo,Jn=!0,ba(e,i,s),on=l,Jn=f;break;case 0:case 11:case 14:case 15:sr(2,s,i),yn||sr(4,s,i),ba(e,i,s);break;case 1:yn||(ji(s,i),l=s.stateNode,typeof l.componentWillUnmount=="function"&&d_(s,i,l)),ba(e,i,s);break;case 21:ba(e,i,s);break;case 22:yn=(l=yn)||s.memoizedState!==null,ba(e,i,s),yn=l;break;default:ba(e,i,s)}}function S_(e,i){if(i.memoizedState===null&&(e=i.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Qs(e)}catch(s){qe(i,i.return,s)}}}function M_(e,i){if(i.memoizedState===null&&(e=i.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Qs(e)}catch(s){qe(i,i.return,s)}}function BM(e){switch(e.tag){case 31:case 13:case 19:var i=e.stateNode;return i===null&&(i=e.stateNode=new __),i;case 22:return e=e.stateNode,i=e._retryCache,i===null&&(i=e._retryCache=new __),i;default:throw Error(a(435,e.tag))}}function Ic(e,i){var s=BM(e);i.forEach(function(l){if(!s.has(l)){s.add(l);var f=XM.bind(null,e,l);l.then(f,f)}})}function jn(e,i){var s=i.deletions;if(s!==null)for(var l=0;l<s.length;l++){var f=s[l],h=e,M=i,C=M;t:for(;C!==null;){switch(C.tag){case 27:if(dr(C.type)){on=C.stateNode,Jn=!1;break t}break;case 5:on=C.stateNode,Jn=!1;break t;case 3:case 4:on=C.stateNode.containerInfo,Jn=!0;break t}C=C.return}if(on===null)throw Error(a(160));y_(h,M,f),on=null,Jn=!1,h=f.alternate,h!==null&&(h.return=null),f.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)E_(i,e),i=i.sibling}var zi=null;function E_(e,i){var s=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:jn(i,e),$n(e),l&4&&(sr(3,e,e.return),al(3,e),sr(5,e,e.return));break;case 1:jn(i,e),$n(e),l&512&&(yn||s===null||ji(s,s.return)),l&64&&Ea&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(s=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=s===null?l:s.concat(l))));break;case 26:var f=zi;if(jn(i,e),$n(e),l&512&&(yn||s===null||ji(s,s.return)),l&4){var h=s!==null?s.memoizedState:null;if(l=e.memoizedState,s===null)if(l===null)if(e.stateNode===null){t:{l=e.type,s=e.memoizedProps,f=f.ownerDocument||f;e:switch(l){case"title":h=f.getElementsByTagName("title")[0],(!h||h[qa]||h[mn]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=f.createElement(l),f.head.insertBefore(h,f.querySelector("head > title"))),Pn(h,l,s),h[mn]=e,gn(h),l=h;break t;case"link":var M=Ev("link","href",f).get(l+(s.href||""));if(M){for(var C=0;C<M.length;C++)if(h=M[C],h.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&h.getAttribute("rel")===(s.rel==null?null:s.rel)&&h.getAttribute("title")===(s.title==null?null:s.title)&&h.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){M.splice(C,1);break e}}h=f.createElement(l),Pn(h,l,s),f.head.appendChild(h);break;case"meta":if(M=Ev("meta","content",f).get(l+(s.content||""))){for(C=0;C<M.length;C++)if(h=M[C],h.getAttribute("content")===(s.content==null?null:""+s.content)&&h.getAttribute("name")===(s.name==null?null:s.name)&&h.getAttribute("property")===(s.property==null?null:s.property)&&h.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&h.getAttribute("charset")===(s.charSet==null?null:s.charSet)){M.splice(C,1);break e}}h=f.createElement(l),Pn(h,l,s),f.head.appendChild(h);break;default:throw Error(a(468,l))}h[mn]=e,gn(h),l=h}e.stateNode=l}else bv(f,e.type,e.stateNode);else e.stateNode=Mv(f,l,e.memoizedProps);else h!==l?(h===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):h.count--,l===null?bv(f,e.type,e.stateNode):Mv(f,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Wh(e,e.memoizedProps,s.memoizedProps)}break;case 27:jn(i,e),$n(e),l&512&&(yn||s===null||ji(s,s.return)),s!==null&&l&4&&Wh(e,e.memoizedProps,s.memoizedProps);break;case 5:if(jn(i,e),$n(e),l&512&&(yn||s===null||ji(s,s.return)),e.flags&32){f=e.stateNode;try{li(f,"")}catch(te){qe(e,e.return,te)}}l&4&&e.stateNode!=null&&(f=e.memoizedProps,Wh(e,f,s!==null?s.memoizedProps:f)),l&1024&&(Yh=!0);break;case 6:if(jn(i,e),$n(e),l&4){if(e.stateNode===null)throw Error(a(162));l=e.memoizedProps,s=e.stateNode;try{s.nodeValue=l}catch(te){qe(e,e.return,te)}}break;case 3:if($c=null,f=zi,zi=Jc(i.containerInfo),jn(i,e),zi=f,$n(e),l&4&&s!==null&&s.memoizedState.isDehydrated)try{Qs(i.containerInfo)}catch(te){qe(e,e.return,te)}Yh&&(Yh=!1,b_(e));break;case 4:l=zi,zi=Jc(e.stateNode.containerInfo),jn(i,e),$n(e),zi=l;break;case 12:jn(i,e),$n(e);break;case 31:jn(i,e),$n(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ic(e,l)));break;case 13:jn(i,e),$n(e),e.child.flags&8192&&e.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(Fc=Ft()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ic(e,l)));break;case 22:f=e.memoizedState!==null;var G=s!==null&&s.memoizedState!==null,it=Ea,pt=yn;if(Ea=it||f,yn=pt||G,jn(i,e),yn=pt,Ea=it,$n(e),l&8192)t:for(i=e.stateNode,i._visibility=f?i._visibility&-2:i._visibility|1,f&&(s===null||G||Ea||yn||Jr(e)),s=null,i=e;;){if(i.tag===5||i.tag===26){if(s===null){G=s=i;try{if(h=G.stateNode,f)M=h.style,typeof M.setProperty=="function"?M.setProperty("display","none","important"):M.display="none";else{C=G.stateNode;var yt=G.memoizedProps.style,lt=yt!=null&&yt.hasOwnProperty("display")?yt.display:null;C.style.display=lt==null||typeof lt=="boolean"?"":(""+lt).trim()}}catch(te){qe(G,G.return,te)}}}else if(i.tag===6){if(s===null){G=i;try{G.stateNode.nodeValue=f?"":G.memoizedProps}catch(te){qe(G,G.return,te)}}}else if(i.tag===18){if(s===null){G=i;try{var ut=G.stateNode;f?dv(ut,!0):dv(G.stateNode,!1)}catch(te){qe(G,G.return,te)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===e)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===e)break t;for(;i.sibling===null;){if(i.return===null||i.return===e)break t;s===i&&(s=null),i=i.return}s===i&&(s=null),i.sibling.return=i.return,i=i.sibling}l&4&&(l=e.updateQueue,l!==null&&(s=l.retryQueue,s!==null&&(l.retryQueue=null,Ic(e,s))));break;case 19:jn(i,e),$n(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,Ic(e,l)));break;case 30:break;case 21:break;default:jn(i,e),$n(e)}}function $n(e){var i=e.flags;if(i&2){try{for(var s,l=e.return;l!==null;){if(m_(l)){s=l;break}l=l.return}if(s==null)throw Error(a(160));switch(s.tag){case 27:var f=s.stateNode,h=Xh(e);Bc(e,h,f);break;case 5:var M=s.stateNode;s.flags&32&&(li(M,""),s.flags&=-33);var C=Xh(e);Bc(e,C,M);break;case 3:case 4:var G=s.stateNode.containerInfo,it=Xh(e);qh(e,it,G);break;default:throw Error(a(161))}}catch(pt){qe(e,e.return,pt)}e.flags&=-3}i&4096&&(e.flags&=-4097)}function b_(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var i=e;b_(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),e=e.sibling}}function Ta(e,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)v_(e,i.alternate,i),i=i.sibling}function Jr(e){for(e=e.child;e!==null;){var i=e;switch(i.tag){case 0:case 11:case 14:case 15:sr(4,i,i.return),Jr(i);break;case 1:ji(i,i.return);var s=i.stateNode;typeof s.componentWillUnmount=="function"&&d_(i,i.return,s),Jr(i);break;case 27:pl(i.stateNode);case 26:case 5:ji(i,i.return),Jr(i);break;case 22:i.memoizedState===null&&Jr(i);break;case 30:Jr(i);break;default:Jr(i)}e=e.sibling}}function Aa(e,i,s){for(s=s&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var l=i.alternate,f=e,h=i,M=h.flags;switch(h.tag){case 0:case 11:case 15:Aa(f,h,s),al(4,h);break;case 1:if(Aa(f,h,s),l=h,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(it){qe(l,l.return,it)}if(l=h,f=l.updateQueue,f!==null){var C=l.stateNode;try{var G=f.shared.hiddenCallbacks;if(G!==null)for(f.shared.hiddenCallbacks=null,f=0;f<G.length;f++)eg(G[f],C)}catch(it){qe(l,l.return,it)}}s&&M&64&&h_(h),rl(h,h.return);break;case 27:g_(h);case 26:case 5:Aa(f,h,s),s&&l===null&&M&4&&p_(h),rl(h,h.return);break;case 12:Aa(f,h,s);break;case 31:Aa(f,h,s),s&&M&4&&S_(f,h);break;case 13:Aa(f,h,s),s&&M&4&&M_(f,h);break;case 22:h.memoizedState===null&&Aa(f,h,s),rl(h,h.return);break;case 30:break;default:Aa(f,h,s)}i=i.sibling}}function Zh(e,i){var s=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),e=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(e=i.memoizedState.cachePool.pool),e!==s&&(e!=null&&e.refCount++,s!=null&&Xo(s))}function Kh(e,i){e=null,i.alternate!==null&&(e=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==e&&(i.refCount++,e!=null&&Xo(e))}function Fi(e,i,s,l){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)T_(e,i,s,l),i=i.sibling}function T_(e,i,s,l){var f=i.flags;switch(i.tag){case 0:case 11:case 15:Fi(e,i,s,l),f&2048&&al(9,i);break;case 1:Fi(e,i,s,l);break;case 3:Fi(e,i,s,l),f&2048&&(e=null,i.alternate!==null&&(e=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==e&&(i.refCount++,e!=null&&Xo(e)));break;case 12:if(f&2048){Fi(e,i,s,l),e=i.stateNode;try{var h=i.memoizedProps,M=h.id,C=h.onPostCommit;typeof C=="function"&&C(M,i.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(G){qe(i,i.return,G)}}else Fi(e,i,s,l);break;case 31:Fi(e,i,s,l);break;case 13:Fi(e,i,s,l);break;case 23:break;case 22:h=i.stateNode,M=i.alternate,i.memoizedState!==null?h._visibility&2?Fi(e,i,s,l):sl(e,i):h._visibility&2?Fi(e,i,s,l):(h._visibility|=2,Fs(e,i,s,l,(i.subtreeFlags&10256)!==0||!1)),f&2048&&Zh(M,i);break;case 24:Fi(e,i,s,l),f&2048&&Kh(i.alternate,i);break;default:Fi(e,i,s,l)}}function Fs(e,i,s,l,f){for(f=f&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var h=e,M=i,C=s,G=l,it=M.flags;switch(M.tag){case 0:case 11:case 15:Fs(h,M,C,G,f),al(8,M);break;case 23:break;case 22:var pt=M.stateNode;M.memoizedState!==null?pt._visibility&2?Fs(h,M,C,G,f):sl(h,M):(pt._visibility|=2,Fs(h,M,C,G,f)),f&&it&2048&&Zh(M.alternate,M);break;case 24:Fs(h,M,C,G,f),f&&it&2048&&Kh(M.alternate,M);break;default:Fs(h,M,C,G,f)}i=i.sibling}}function sl(e,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var s=e,l=i,f=l.flags;switch(l.tag){case 22:sl(s,l),f&2048&&Zh(l.alternate,l);break;case 24:sl(s,l),f&2048&&Kh(l.alternate,l);break;default:sl(s,l)}i=i.sibling}}var ol=8192;function Hs(e,i,s){if(e.subtreeFlags&ol)for(e=e.child;e!==null;)A_(e,i,s),e=e.sibling}function A_(e,i,s){switch(e.tag){case 26:Hs(e,i,s),e.flags&ol&&e.memoizedState!==null&&M1(s,zi,e.memoizedState,e.memoizedProps);break;case 5:Hs(e,i,s);break;case 3:case 4:var l=zi;zi=Jc(e.stateNode.containerInfo),Hs(e,i,s),zi=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=ol,ol=16777216,Hs(e,i,s),ol=l):Hs(e,i,s));break;default:Hs(e,i,s)}}function R_(e){var i=e.alternate;if(i!==null&&(e=i.child,e!==null)){i.child=null;do i=e.sibling,e.sibling=null,e=i;while(e!==null)}}function ll(e){var i=e.deletions;if((e.flags&16)!==0){if(i!==null)for(var s=0;s<i.length;s++){var l=i[s];wn=l,C_(l,e)}R_(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)w_(e),e=e.sibling}function w_(e){switch(e.tag){case 0:case 11:case 15:ll(e),e.flags&2048&&sr(9,e,e.return);break;case 3:ll(e);break;case 12:ll(e);break;case 22:var i=e.stateNode;e.memoizedState!==null&&i._visibility&2&&(e.return===null||e.return.tag!==13)?(i._visibility&=-3,zc(e)):ll(e);break;default:ll(e)}}function zc(e){var i=e.deletions;if((e.flags&16)!==0){if(i!==null)for(var s=0;s<i.length;s++){var l=i[s];wn=l,C_(l,e)}R_(e)}for(e=e.child;e!==null;){switch(i=e,i.tag){case 0:case 11:case 15:sr(8,i,i.return),zc(i);break;case 22:s=i.stateNode,s._visibility&2&&(s._visibility&=-3,zc(i));break;default:zc(i)}e=e.sibling}}function C_(e,i){for(;wn!==null;){var s=wn;switch(s.tag){case 0:case 11:case 15:sr(8,s,i);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var l=s.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Xo(s.memoizedState.cache)}if(l=s.child,l!==null)l.return=s,wn=l;else t:for(s=e;wn!==null;){l=wn;var f=l.sibling,h=l.return;if(x_(l),l===s){wn=null;break t}if(f!==null){f.return=h,wn=f;break t}wn=h}}}var IM={getCacheForType:function(e){var i=Nn(_n),s=i.data.get(e);return s===void 0&&(s=e(),i.data.set(e,s)),s},cacheSignal:function(){return Nn(_n).controller.signal}},zM=typeof WeakMap=="function"?WeakMap:Map,Fe=0,tn=null,we=null,De=0,Xe=0,di=null,or=!1,Gs=!1,Qh=!1,Ra=0,fn=0,lr=0,jr=0,Jh=0,pi=0,Vs=0,cl=null,ti=null,jh=!1,Fc=0,D_=0,Hc=1/0,Gc=null,cr=null,bn=0,ur=null,ks=null,wa=0,$h=0,td=null,L_=null,ul=0,ed=null;function mi(){return(Fe&2)!==0&&De!==0?De&-De:F.T!==null?od():No()}function U_(){if(pi===0)if((De&536870912)===0||Ue){var e=xe;xe<<=1,(xe&3932160)===0&&(xe=262144),pi=e}else pi=536870912;return e=fi.current,e!==null&&(e.flags|=32),pi}function ei(e,i,s){(e===tn&&(Xe===2||Xe===9)||e.cancelPendingCommit!==null)&&(Ws(e,0),fr(e,De,pi,!1)),Kt(e,s),((Fe&2)===0||e!==tn)&&(e===tn&&((Fe&2)===0&&(jr|=s),fn===4&&fr(e,De,pi,!1)),$i(e))}function N_(e,i,s){if((Fe&6)!==0)throw Error(a(327));var l=!s&&(i&127)===0&&(i&e.expiredLanes)===0||Pt(e,i),f=l?GM(e,i):id(e,i,!0),h=l;do{if(f===0){Gs&&!l&&fr(e,i,0,!1);break}else{if(s=e.current.alternate,h&&!FM(s)){f=id(e,i,!1),h=!1;continue}if(f===2){if(h=i,e.errorRecoveryDisabledLanes&h)var M=0;else M=e.pendingLanes&-536870913,M=M!==0?M:M&536870912?536870912:0;if(M!==0){i=M;t:{var C=e;f=cl;var G=C.current.memoizedState.isDehydrated;if(G&&(Ws(C,M).flags|=256),M=id(C,M,!1),M!==2){if(Qh&&!G){C.errorRecoveryDisabledLanes|=h,jr|=h,f=4;break t}h=ti,ti=f,h!==null&&(ti===null?ti=h:ti.push.apply(ti,h))}f=M}if(h=!1,f!==2)continue}}if(f===1){Ws(e,0),fr(e,i,0,!0);break}t:{switch(l=e,h=f,h){case 0:case 1:throw Error(a(345));case 4:if((i&4194048)!==i)break;case 6:fr(l,i,pi,!or);break t;case 2:ti=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(f=Fc+300-Ft(),10<f)){if(fr(l,i,pi,!or),_t(l,0,!0)!==0)break t;wa=i,l.timeoutHandle=uv(O_.bind(null,l,s,ti,Gc,jh,i,pi,jr,Vs,or,h,"Throttled",-0,0),f);break t}O_(l,s,ti,Gc,jh,i,pi,jr,Vs,or,h,null,-0,0)}}break}while(!0);$i(e)}function O_(e,i,s,l,f,h,M,C,G,it,pt,yt,lt,ut){if(e.timeoutHandle=-1,yt=i.subtreeFlags,yt&8192||(yt&16785408)===16785408){yt={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:da},A_(i,h,yt);var te=(h&62914560)===h?Fc-Ft():(h&4194048)===h?D_-Ft():0;if(te=E1(yt,te),te!==null){wa=h,e.cancelPendingCommit=te(V_.bind(null,e,i,h,s,l,f,M,C,G,pt,yt,null,lt,ut)),fr(e,h,M,!it);return}}V_(e,i,h,s,l,f,M,C,G)}function FM(e){for(var i=e;;){var s=i.tag;if((s===0||s===11||s===15)&&i.flags&16384&&(s=i.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var l=0;l<s.length;l++){var f=s[l],h=f.getSnapshot;f=f.value;try{if(!ci(h(),f))return!1}catch{return!1}}if(s=i.child,i.subtreeFlags&16384&&s!==null)s.return=i,i=s;else{if(i===e)break;for(;i.sibling===null;){if(i.return===null||i.return===e)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function fr(e,i,s,l){i&=~Jh,i&=~jr,e.suspendedLanes|=i,e.pingedLanes&=~i,l&&(e.warmLanes|=i),l=e.expirationTimes;for(var f=i;0<f;){var h=31-Xt(f),M=1<<h;l[h]=-1,f&=~M}s!==0&&Ge(e,s,i)}function Vc(){return(Fe&6)===0?(fl(0),!1):!0}function nd(){if(we!==null){if(Xe===0)var e=we.return;else e=we,_a=kr=null,vh(e),Os=null,Yo=0,e=we;for(;e!==null;)f_(e.alternate,e),e=e.return;we=null}}function Ws(e,i){var s=e.timeoutHandle;s!==-1&&(e.timeoutHandle=-1,r1(s)),s=e.cancelPendingCommit,s!==null&&(e.cancelPendingCommit=null,s()),wa=0,nd(),tn=e,we=s=ma(e.current,null),De=i,Xe=0,di=null,or=!1,Gs=Pt(e,i),Qh=!1,Vs=pi=Jh=jr=lr=fn=0,ti=cl=null,jh=!1,(i&8)!==0&&(i|=i&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=i;0<l;){var f=31-Xt(l),h=1<<f;i|=e[f],l&=~h}return Ra=i,cc(),s}function P_(e,i){Ee=null,F.H=el,i===Ns||i===_c?(i=J0(),Xe=3):i===sh?(i=J0(),Xe=4):Xe=i===Oh?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,di=i,we===null&&(fn=1,Lc(e,bi(i,e.current)))}function B_(){var e=fi.current;return e===null?!0:(De&4194048)===De?wi===null:(De&62914560)===De||(De&536870912)!==0?e===wi:!1}function I_(){var e=F.H;return F.H=el,e===null?el:e}function z_(){var e=F.A;return F.A=IM,e}function kc(){fn=4,or||(De&4194048)!==De&&fi.current!==null||(Gs=!0),(lr&134217727)===0&&(jr&134217727)===0||tn===null||fr(tn,De,pi,!1)}function id(e,i,s){var l=Fe;Fe|=2;var f=I_(),h=z_();(tn!==e||De!==i)&&(Gc=null,Ws(e,i)),i=!1;var M=fn;t:do try{if(Xe!==0&&we!==null){var C=we,G=di;switch(Xe){case 8:nd(),M=6;break t;case 3:case 2:case 9:case 6:fi.current===null&&(i=!0);var it=Xe;if(Xe=0,di=null,Xs(e,C,G,it),s&&Gs){M=0;break t}break;default:it=Xe,Xe=0,di=null,Xs(e,C,G,it)}}HM(),M=fn;break}catch(pt){P_(e,pt)}while(!0);return i&&e.shellSuspendCounter++,_a=kr=null,Fe=l,F.H=f,F.A=h,we===null&&(tn=null,De=0,cc()),M}function HM(){for(;we!==null;)F_(we)}function GM(e,i){var s=Fe;Fe|=2;var l=I_(),f=z_();tn!==e||De!==i?(Gc=null,Hc=Ft()+500,Ws(e,i)):Gs=Pt(e,i);t:do try{if(Xe!==0&&we!==null){i=we;var h=di;e:switch(Xe){case 1:Xe=0,di=null,Xs(e,i,h,1);break;case 2:case 9:if(K0(h)){Xe=0,di=null,H_(i);break}i=function(){Xe!==2&&Xe!==9||tn!==e||(Xe=7),$i(e)},h.then(i,i);break t;case 3:Xe=7;break t;case 4:Xe=5;break t;case 7:K0(h)?(Xe=0,di=null,H_(i)):(Xe=0,di=null,Xs(e,i,h,7));break;case 5:var M=null;switch(we.tag){case 26:M=we.memoizedState;case 5:case 27:var C=we;if(M?Tv(M):C.stateNode.complete){Xe=0,di=null;var G=C.sibling;if(G!==null)we=G;else{var it=C.return;it!==null?(we=it,Wc(it)):we=null}break e}}Xe=0,di=null,Xs(e,i,h,5);break;case 6:Xe=0,di=null,Xs(e,i,h,6);break;case 8:nd(),fn=6;break t;default:throw Error(a(462))}}VM();break}catch(pt){P_(e,pt)}while(!0);return _a=kr=null,F.H=l,F.A=f,Fe=s,we!==null?0:(tn=null,De=0,cc(),fn)}function VM(){for(;we!==null&&!ve();)F_(we)}function F_(e){var i=c_(e.alternate,e,Ra);e.memoizedProps=e.pendingProps,i===null?Wc(e):we=i}function H_(e){var i=e,s=i.alternate;switch(i.tag){case 15:case 0:i=i_(s,i,i.pendingProps,i.type,void 0,De);break;case 11:i=i_(s,i,i.pendingProps,i.type.render,i.ref,De);break;case 5:vh(i);default:f_(s,i),i=we=z0(i,Ra),i=c_(s,i,Ra)}e.memoizedProps=e.pendingProps,i===null?Wc(e):we=i}function Xs(e,i,s,l){_a=kr=null,vh(i),Os=null,Yo=0;var f=i.return;try{if(DM(e,f,i,s,De)){fn=1,Lc(e,bi(s,e.current)),we=null;return}}catch(h){if(f!==null)throw we=f,h;fn=1,Lc(e,bi(s,e.current)),we=null;return}i.flags&32768?(Ue||l===1?e=!0:Gs||(De&536870912)!==0?e=!1:(or=e=!0,(l===2||l===9||l===3||l===6)&&(l=fi.current,l!==null&&l.tag===13&&(l.flags|=16384))),G_(i,e)):Wc(i)}function Wc(e){var i=e;do{if((i.flags&32768)!==0){G_(i,or);return}e=i.return;var s=NM(i.alternate,i,Ra);if(s!==null){we=s;return}if(i=i.sibling,i!==null){we=i;return}we=i=e}while(i!==null);fn===0&&(fn=5)}function G_(e,i){do{var s=OM(e.alternate,e);if(s!==null){s.flags&=32767,we=s;return}if(s=e.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!i&&(e=e.sibling,e!==null)){we=e;return}we=e=s}while(e!==null);fn=6,we=null}function V_(e,i,s,l,f,h,M,C,G){e.cancelPendingCommit=null;do Xc();while(bn!==0);if((Fe&6)!==0)throw Error(a(327));if(i!==null){if(i===e.current)throw Error(a(177));if(h=i.lanes|i.childLanes,h|=Xf,an(e,s,h,M,C,G),e===tn&&(we=tn=null,De=0),ks=i,ur=e,wa=s,$h=h,td=f,L_=l,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,qM(K,function(){return Y_(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||l){l=F.T,F.T=null,f=V.p,V.p=2,M=Fe,Fe|=4;try{PM(e,i,s)}finally{Fe=M,V.p=f,F.T=l}}bn=1,k_(),W_(),X_()}}function k_(){if(bn===1){bn=0;var e=ur,i=ks,s=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||s){s=F.T,F.T=null;var l=V.p;V.p=2;var f=Fe;Fe|=4;try{E_(i,e);var h=md,M=C0(e.containerInfo),C=h.focusedElem,G=h.selectionRange;if(M!==C&&C&&C.ownerDocument&&w0(C.ownerDocument.documentElement,C)){if(G!==null&&Hf(C)){var it=G.start,pt=G.end;if(pt===void 0&&(pt=it),"selectionStart"in C)C.selectionStart=it,C.selectionEnd=Math.min(pt,C.value.length);else{var yt=C.ownerDocument||document,lt=yt&&yt.defaultView||window;if(lt.getSelection){var ut=lt.getSelection(),te=C.textContent.length,_e=Math.min(G.start,te),Je=G.end===void 0?_e:Math.min(G.end,te);!ut.extend&&_e>Je&&(M=Je,Je=_e,_e=M);var j=R0(C,_e),X=R0(C,Je);if(j&&X&&(ut.rangeCount!==1||ut.anchorNode!==j.node||ut.anchorOffset!==j.offset||ut.focusNode!==X.node||ut.focusOffset!==X.offset)){var nt=yt.createRange();nt.setStart(j.node,j.offset),ut.removeAllRanges(),_e>Je?(ut.addRange(nt),ut.extend(X.node,X.offset)):(nt.setEnd(X.node,X.offset),ut.addRange(nt))}}}}for(yt=[],ut=C;ut=ut.parentNode;)ut.nodeType===1&&yt.push({element:ut,left:ut.scrollLeft,top:ut.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<yt.length;C++){var xt=yt[C];xt.element.scrollLeft=xt.left,xt.element.scrollTop=xt.top}}iu=!!pd,md=pd=null}finally{Fe=f,V.p=l,F.T=s}}e.current=i,bn=2}}function W_(){if(bn===2){bn=0;var e=ur,i=ks,s=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||s){s=F.T,F.T=null;var l=V.p;V.p=2;var f=Fe;Fe|=4;try{v_(e,i.alternate,i)}finally{Fe=f,V.p=l,F.T=s}}bn=3}}function X_(){if(bn===4||bn===3){bn=0,H();var e=ur,i=ks,s=wa,l=L_;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?bn=5:(bn=0,ks=ur=null,q_(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(cr=null),Uo(s),i=i.stateNode,ft&&typeof ft.onCommitFiberRoot=="function")try{ft.onCommitFiberRoot(ct,i,void 0,(i.current.flags&128)===128)}catch{}if(l!==null){i=F.T,f=V.p,V.p=2,F.T=null;try{for(var h=e.onRecoverableError,M=0;M<l.length;M++){var C=l[M];h(C.value,{componentStack:C.stack})}}finally{F.T=i,V.p=f}}(wa&3)!==0&&Xc(),$i(e),f=e.pendingLanes,(s&261930)!==0&&(f&42)!==0?e===ed?ul++:(ul=0,ed=e):ul=0,fl(0)}}function q_(e,i){(e.pooledCacheLanes&=i)===0&&(i=e.pooledCache,i!=null&&(e.pooledCache=null,Xo(i)))}function Xc(){return k_(),W_(),X_(),Y_()}function Y_(){if(bn!==5)return!1;var e=ur,i=$h;$h=0;var s=Uo(wa),l=F.T,f=V.p;try{V.p=32>s?32:s,F.T=null,s=td,td=null;var h=ur,M=wa;if(bn=0,ks=ur=null,wa=0,(Fe&6)!==0)throw Error(a(331));var C=Fe;if(Fe|=4,w_(h.current),T_(h,h.current,M,s),Fe=C,fl(0,!1),ft&&typeof ft.onPostCommitFiberRoot=="function")try{ft.onPostCommitFiberRoot(ct,h)}catch{}return!0}finally{V.p=f,F.T=l,q_(e,i)}}function Z_(e,i,s){i=bi(s,i),i=Nh(e.stateNode,i,2),e=ir(e,i,2),e!==null&&(Kt(e,2),$i(e))}function qe(e,i,s){if(e.tag===3)Z_(e,e,s);else for(;i!==null;){if(i.tag===3){Z_(i,e,s);break}else if(i.tag===1){var l=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(cr===null||!cr.has(l))){e=bi(s,e),s=Kg(2),l=ir(i,s,2),l!==null&&(Qg(s,l,i,e),Kt(l,2),$i(l));break}}i=i.return}}function ad(e,i,s){var l=e.pingCache;if(l===null){l=e.pingCache=new zM;var f=new Set;l.set(i,f)}else f=l.get(i),f===void 0&&(f=new Set,l.set(i,f));f.has(s)||(Qh=!0,f.add(s),e=kM.bind(null,e,i,s),i.then(e,e))}function kM(e,i,s){var l=e.pingCache;l!==null&&l.delete(i),e.pingedLanes|=e.suspendedLanes&s,e.warmLanes&=~s,tn===e&&(De&s)===s&&(fn===4||fn===3&&(De&62914560)===De&&300>Ft()-Fc?(Fe&2)===0&&Ws(e,0):Jh|=s,Vs===De&&(Vs=0)),$i(e)}function K_(e,i){i===0&&(i=Tt()),e=Hr(e,i),e!==null&&(Kt(e,i),$i(e))}function WM(e){var i=e.memoizedState,s=0;i!==null&&(s=i.retryLane),K_(e,s)}function XM(e,i){var s=0;switch(e.tag){case 31:case 13:var l=e.stateNode,f=e.memoizedState;f!==null&&(s=f.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(a(314))}l!==null&&l.delete(i),K_(e,s)}function qM(e,i){return ne(e,i)}var qc=null,qs=null,rd=!1,Yc=!1,sd=!1,hr=0;function $i(e){e!==qs&&e.next===null&&(qs===null?qc=qs=e:qs=qs.next=e),Yc=!0,rd||(rd=!0,ZM())}function fl(e,i){if(!sd&&Yc){sd=!0;do for(var s=!1,l=qc;l!==null;){if(e!==0){var f=l.pendingLanes;if(f===0)var h=0;else{var M=l.suspendedLanes,C=l.pingedLanes;h=(1<<31-Xt(42|e)+1)-1,h&=f&~(M&~C),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(s=!0,$_(l,h))}else h=De,h=_t(l,l===tn?h:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(h&3)===0||Pt(l,h)||(s=!0,$_(l,h));l=l.next}while(s);sd=!1}}function YM(){Q_()}function Q_(){Yc=rd=!1;var e=0;hr!==0&&a1()&&(e=hr);for(var i=Ft(),s=null,l=qc;l!==null;){var f=l.next,h=J_(l,i);h===0?(l.next=null,s===null?qc=f:s.next=f,f===null&&(qs=s)):(s=l,(e!==0||(h&3)!==0)&&(Yc=!0)),l=f}bn!==0&&bn!==5||fl(e),hr!==0&&(hr=0)}function J_(e,i){for(var s=e.suspendedLanes,l=e.pingedLanes,f=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var M=31-Xt(h),C=1<<M,G=f[M];G===-1?((C&s)===0||(C&l)!==0)&&(f[M]=Wt(C,i)):G<=i&&(e.expiredLanes|=C),h&=~C}if(i=tn,s=De,s=_t(e,e===i?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,s===0||e===i&&(Xe===2||Xe===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&le(l),e.callbackNode=null,e.callbackPriority=0;if((s&3)===0||Pt(e,s)){if(i=s&-s,i===e.callbackPriority)return i;switch(l!==null&&le(l),Uo(s)){case 2:case 8:s=b;break;case 32:s=K;break;case 268435456:s=tt;break;default:s=K}return l=j_.bind(null,e),s=ne(s,l),e.callbackPriority=i,e.callbackNode=s,i}return l!==null&&l!==null&&le(l),e.callbackPriority=2,e.callbackNode=null,2}function j_(e,i){if(bn!==0&&bn!==5)return e.callbackNode=null,e.callbackPriority=0,null;var s=e.callbackNode;if(Xc()&&e.callbackNode!==s)return null;var l=De;return l=_t(e,e===tn?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(N_(e,l,i),J_(e,Ft()),e.callbackNode!=null&&e.callbackNode===s?j_.bind(null,e):null)}function $_(e,i){if(Xc())return null;N_(e,i,!0)}function ZM(){s1(function(){(Fe&6)!==0?ne(L,YM):Q_()})}function od(){if(hr===0){var e=Ls;e===0&&(e=he,he<<=1,(he&261888)===0&&(he=256)),hr=e}return hr}function tv(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Br(""+e)}function ev(e,i){var s=i.ownerDocument.createElement("input");return s.name=i.name,s.value=i.value,e.id&&s.setAttribute("form",e.id),i.parentNode.insertBefore(s,i),e=new FormData(e),s.parentNode.removeChild(s),e}function KM(e,i,s,l,f){if(i==="submit"&&s&&s.stateNode===f){var h=tv((f[Ln]||null).action),M=l.submitter;M&&(i=(i=M[Ln]||null)?tv(i.formAction):M.getAttribute("formAction"),i!==null&&(h=i,M=null));var C=new rc("action","action",null,l,f);e.push({event:C,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(hr!==0){var G=M?ev(f,M):new FormData(f);Rh(s,{pending:!0,data:G,method:f.method,action:h},null,G)}}else typeof h=="function"&&(C.preventDefault(),G=M?ev(f,M):new FormData(f),Rh(s,{pending:!0,data:G,method:f.method,action:h},h,G))},currentTarget:f}]})}}for(var ld=0;ld<Wf.length;ld++){var cd=Wf[ld],QM=cd.toLowerCase(),JM=cd[0].toUpperCase()+cd.slice(1);Ii(QM,"on"+JM)}Ii(U0,"onAnimationEnd"),Ii(N0,"onAnimationIteration"),Ii(O0,"onAnimationStart"),Ii("dblclick","onDoubleClick"),Ii("focusin","onFocus"),Ii("focusout","onBlur"),Ii(dM,"onTransitionRun"),Ii(pM,"onTransitionStart"),Ii(mM,"onTransitionCancel"),Ii(P0,"onTransitionEnd"),ot("onMouseEnter",["mouseout","mouseover"]),ot("onMouseLeave",["mouseout","mouseover"]),ot("onPointerEnter",["pointerout","pointerover"]),ot("onPointerLeave",["pointerout","pointerover"]),Y("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Y("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Y("onBeforeInput",["compositionend","keypress","textInput","paste"]),Y("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Y("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Y("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var hl="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),jM=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(hl));function nv(e,i){i=(i&4)!==0;for(var s=0;s<e.length;s++){var l=e[s],f=l.event;l=l.listeners;t:{var h=void 0;if(i)for(var M=l.length-1;0<=M;M--){var C=l[M],G=C.instance,it=C.currentTarget;if(C=C.listener,G!==h&&f.isPropagationStopped())break t;h=C,f.currentTarget=it;try{h(f)}catch(pt){lc(pt)}f.currentTarget=null,h=G}else for(M=0;M<l.length;M++){if(C=l[M],G=C.instance,it=C.currentTarget,C=C.listener,G!==h&&f.isPropagationStopped())break t;h=C,f.currentTarget=it;try{h(f)}catch(pt){lc(pt)}f.currentTarget=null,h=G}}}}function Ce(e,i){var s=i[Nr];s===void 0&&(s=i[Nr]=new Set);var l=e+"__bubble";s.has(l)||(iv(i,e,2,!1),s.add(l))}function ud(e,i,s){var l=0;i&&(l|=4),iv(s,e,l,i)}var Zc="_reactListening"+Math.random().toString(36).slice(2);function fd(e){if(!e[Zc]){e[Zc]=!0,ec.forEach(function(s){s!=="selectionchange"&&(jM.has(s)||ud(s,!1,e),ud(s,!0,e))});var i=e.nodeType===9?e:e.ownerDocument;i===null||i[Zc]||(i[Zc]=!0,ud("selectionchange",!1,i))}}function iv(e,i,s,l){switch(Uv(i)){case 2:var f=A1;break;case 8:f=R1;break;default:f=Ad}s=f.bind(null,i,s,e),f=void 0,!Lf||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(f=!0),l?f!==void 0?e.addEventListener(i,s,{capture:!0,passive:f}):e.addEventListener(i,s,!0):f!==void 0?e.addEventListener(i,s,{passive:f}):e.addEventListener(i,s,!1)}function hd(e,i,s,l,f){var h=l;if((i&1)===0&&(i&2)===0&&l!==null)t:for(;;){if(l===null)return;var M=l.tag;if(M===3||M===4){var C=l.stateNode.containerInfo;if(C===f)break;if(M===4)for(M=l.return;M!==null;){var G=M.tag;if((G===3||G===4)&&M.stateNode.containerInfo===f)return;M=M.return}for(;C!==null;){if(M=fa(C),M===null)return;if(G=M.tag,G===5||G===6||G===26||G===27){l=h=M;continue t}C=C.parentNode}}l=l.return}l0(function(){var it=h,pt=Cf(s),yt=[];t:{var lt=B0.get(e);if(lt!==void 0){var ut=rc,te=e;switch(e){case"keypress":if(ic(s)===0)break t;case"keydown":case"keyup":ut=XS;break;case"focusin":te="focus",ut=Pf;break;case"focusout":te="blur",ut=Pf;break;case"beforeblur":case"afterblur":ut=Pf;break;case"click":if(s.button===2)break t;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ut=f0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ut=NS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ut=ZS;break;case U0:case N0:case O0:ut=BS;break;case P0:ut=QS;break;case"scroll":case"scrollend":ut=LS;break;case"wheel":ut=jS;break;case"copy":case"cut":case"paste":ut=zS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ut=d0;break;case"toggle":case"beforetoggle":ut=tM}var _e=(i&4)!==0,Je=!_e&&(e==="scroll"||e==="scrollend"),j=_e?lt!==null?lt+"Capture":null:lt;_e=[];for(var X=it,nt;X!==null;){var xt=X;if(nt=xt.stateNode,xt=xt.tag,xt!==5&&xt!==26&&xt!==27||nt===null||j===null||(xt=Oo(X,j),xt!=null&&_e.push(dl(X,xt,nt))),Je)break;X=X.return}0<_e.length&&(lt=new ut(lt,te,null,s,pt),yt.push({event:lt,listeners:_e}))}}if((i&7)===0){t:{if(lt=e==="mouseover"||e==="pointerover",ut=e==="mouseout"||e==="pointerout",lt&&s!==wf&&(te=s.relatedTarget||s.fromElement)&&(fa(te)||te[Kn]))break t;if((ut||lt)&&(lt=pt.window===pt?pt:(lt=pt.ownerDocument)?lt.defaultView||lt.parentWindow:window,ut?(te=s.relatedTarget||s.toElement,ut=it,te=te?fa(te):null,te!==null&&(Je=c(te),_e=te.tag,te!==Je||_e!==5&&_e!==27&&_e!==6)&&(te=null)):(ut=null,te=it),ut!==te)){if(_e=f0,xt="onMouseLeave",j="onMouseEnter",X="mouse",(e==="pointerout"||e==="pointerover")&&(_e=d0,xt="onPointerLeave",j="onPointerEnter",X="pointer"),Je=ut==null?lt:Pr(ut),nt=te==null?lt:Pr(te),lt=new _e(xt,X+"leave",ut,s,pt),lt.target=Je,lt.relatedTarget=nt,xt=null,fa(pt)===it&&(_e=new _e(j,X+"enter",te,s,pt),_e.target=nt,_e.relatedTarget=Je,xt=_e),Je=xt,ut&&te)e:{for(_e=$M,j=ut,X=te,nt=0,xt=j;xt;xt=_e(xt))nt++;xt=0;for(var pe=X;pe;pe=_e(pe))xt++;for(;0<nt-xt;)j=_e(j),nt--;for(;0<xt-nt;)X=_e(X),xt--;for(;nt--;){if(j===X||X!==null&&j===X.alternate){_e=j;break e}j=_e(j),X=_e(X)}_e=null}else _e=null;ut!==null&&av(yt,lt,ut,_e,!1),te!==null&&Je!==null&&av(yt,Je,te,_e,!0)}}t:{if(lt=it?Pr(it):window,ut=lt.nodeName&&lt.nodeName.toLowerCase(),ut==="select"||ut==="input"&&lt.type==="file")var Be=S0;else if(x0(lt))if(M0)Be=uM;else{Be=lM;var re=oM}else ut=lt.nodeName,!ut||ut.toLowerCase()!=="input"||lt.type!=="checkbox"&&lt.type!=="radio"?it&&He(it.elementType)&&(Be=S0):Be=cM;if(Be&&(Be=Be(e,it))){y0(yt,Be,s,pt);break t}re&&re(e,lt,it),e==="focusout"&&it&&lt.type==="number"&&it.memoizedProps.value!=null&&Re(lt,"number",lt.value)}switch(re=it?Pr(it):window,e){case"focusin":(x0(re)||re.contentEditable==="true")&&(Es=re,Gf=it,Vo=null);break;case"focusout":Vo=Gf=Es=null;break;case"mousedown":Vf=!0;break;case"contextmenu":case"mouseup":case"dragend":Vf=!1,D0(yt,s,pt);break;case"selectionchange":if(hM)break;case"keydown":case"keyup":D0(yt,s,pt)}var be;if(If)t:{switch(e){case"compositionstart":var Le="onCompositionStart";break t;case"compositionend":Le="onCompositionEnd";break t;case"compositionupdate":Le="onCompositionUpdate";break t}Le=void 0}else Ms?_0(e,s)&&(Le="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(Le="onCompositionStart");Le&&(p0&&s.locale!=="ko"&&(Ms||Le!=="onCompositionStart"?Le==="onCompositionEnd"&&Ms&&(be=c0()):(Qa=pt,Uf="value"in Qa?Qa.value:Qa.textContent,Ms=!0)),re=Kc(it,Le),0<re.length&&(Le=new h0(Le,e,null,s,pt),yt.push({event:Le,listeners:re}),be?Le.data=be:(be=v0(s),be!==null&&(Le.data=be)))),(be=nM?iM(e,s):aM(e,s))&&(Le=Kc(it,"onBeforeInput"),0<Le.length&&(re=new h0("onBeforeInput","beforeinput",null,s,pt),yt.push({event:re,listeners:Le}),re.data=be)),KM(yt,e,it,s,pt)}nv(yt,i)})}function dl(e,i,s){return{instance:e,listener:i,currentTarget:s}}function Kc(e,i){for(var s=i+"Capture",l=[];e!==null;){var f=e,h=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||h===null||(f=Oo(e,s),f!=null&&l.unshift(dl(e,f,h)),f=Oo(e,i),f!=null&&l.push(dl(e,f,h))),e.tag===3)return l;e=e.return}return[]}function $M(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function av(e,i,s,l,f){for(var h=i._reactName,M=[];s!==null&&s!==l;){var C=s,G=C.alternate,it=C.stateNode;if(C=C.tag,G!==null&&G===l)break;C!==5&&C!==26&&C!==27||it===null||(G=it,f?(it=Oo(s,h),it!=null&&M.unshift(dl(s,it,G))):f||(it=Oo(s,h),it!=null&&M.push(dl(s,it,G)))),s=s.return}M.length!==0&&e.push({event:i,listeners:M})}var t1=/\r\n?/g,e1=/\u0000|\uFFFD/g;function rv(e){return(typeof e=="string"?e:""+e).replace(t1,`
`).replace(e1,"")}function sv(e,i){return i=rv(i),rv(e)===i}function Qe(e,i,s,l,f,h){switch(s){case"children":typeof l=="string"?i==="body"||i==="textarea"&&l===""||li(e,l):(typeof l=="number"||typeof l=="bigint")&&i!=="body"&&li(e,""+l);break;case"className":$t(e,"class",l);break;case"tabIndex":$t(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":$t(e,s,l);break;case"style":Bi(e,l,h);break;case"data":if(i!=="object"){$t(e,"data",l);break}case"src":case"href":if(l===""&&(i!=="a"||s!=="href")){e.removeAttribute(s);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(s);break}l=Br(""+l),e.setAttribute(s,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(s,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof h=="function"&&(s==="formAction"?(i!=="input"&&Qe(e,i,"name",f.name,f,null),Qe(e,i,"formEncType",f.formEncType,f,null),Qe(e,i,"formMethod",f.formMethod,f,null),Qe(e,i,"formTarget",f.formTarget,f,null)):(Qe(e,i,"encType",f.encType,f,null),Qe(e,i,"method",f.method,f,null),Qe(e,i,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(s);break}l=Br(""+l),e.setAttribute(s,l);break;case"onClick":l!=null&&(e.onclick=da);break;case"onScroll":l!=null&&Ce("scroll",e);break;case"onScrollEnd":l!=null&&Ce("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(s=l.__html,s!=null){if(f.children!=null)throw Error(a(60));e.innerHTML=s}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}s=Br(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(s,""+l):e.removeAttribute(s);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(s,""):e.removeAttribute(s);break;case"capture":case"download":l===!0?e.setAttribute(s,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(s,l):e.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(s,l):e.removeAttribute(s);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(s):e.setAttribute(s,l);break;case"popover":Ce("beforetoggle",e),Ce("toggle",e),zt(e,"popover",l);break;case"xlinkActuate":Qt(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Qt(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Qt(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Qt(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Qt(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Qt(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Qt(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Qt(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Qt(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":zt(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(s=Ki.get(s)||s,zt(e,s,l))}}function dd(e,i,s,l,f,h){switch(s){case"style":Bi(e,l,h);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(a(61));if(s=l.__html,s!=null){if(f.children!=null)throw Error(a(60));e.innerHTML=s}}break;case"children":typeof l=="string"?li(e,l):(typeof l=="number"||typeof l=="bigint")&&li(e,""+l);break;case"onScroll":l!=null&&Ce("scroll",e);break;case"onScrollEnd":l!=null&&Ce("scrollend",e);break;case"onClick":l!=null&&(e.onclick=da);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!R.hasOwnProperty(s))t:{if(s[0]==="o"&&s[1]==="n"&&(f=s.endsWith("Capture"),i=s.slice(2,f?s.length-7:void 0),h=e[Ln]||null,h=h!=null?h[s]:null,typeof h=="function"&&e.removeEventListener(i,h,f),typeof l=="function")){typeof h!="function"&&h!==null&&(s in e?e[s]=null:e.hasAttribute(s)&&e.removeAttribute(s)),e.addEventListener(i,l,f);break t}s in e?e[s]=l:l===!0?e.setAttribute(s,""):zt(e,s,l)}}}function Pn(e,i,s){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ce("error",e),Ce("load",e);var l=!1,f=!1,h;for(h in s)if(s.hasOwnProperty(h)){var M=s[h];if(M!=null)switch(h){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:Qe(e,i,h,M,s,null)}}f&&Qe(e,i,"srcSet",s.srcSet,s,null),l&&Qe(e,i,"src",s.src,s,null);return;case"input":Ce("invalid",e);var C=h=M=f=null,G=null,it=null;for(l in s)if(s.hasOwnProperty(l)){var pt=s[l];if(pt!=null)switch(l){case"name":f=pt;break;case"type":M=pt;break;case"checked":G=pt;break;case"defaultChecked":it=pt;break;case"value":h=pt;break;case"defaultValue":C=pt;break;case"children":case"dangerouslySetInnerHTML":if(pt!=null)throw Error(a(137,i));break;default:Qe(e,i,l,pt,s,null)}}In(e,h,C,G,it,M,f,!1);return;case"select":Ce("invalid",e),l=M=h=null;for(f in s)if(s.hasOwnProperty(f)&&(C=s[f],C!=null))switch(f){case"value":h=C;break;case"defaultValue":M=C;break;case"multiple":l=C;default:Qe(e,i,f,C,s,null)}i=h,s=M,e.multiple=!!l,i!=null?En(e,!!l,i,!1):s!=null&&En(e,!!l,s,!0);return;case"textarea":Ce("invalid",e),h=f=l=null;for(M in s)if(s.hasOwnProperty(M)&&(C=s[M],C!=null))switch(M){case"value":l=C;break;case"defaultValue":f=C;break;case"children":h=C;break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(a(91));break;default:Qe(e,i,M,C,s,null)}Pi(e,l,f,h);return;case"option":for(G in s)s.hasOwnProperty(G)&&(l=s[G],l!=null)&&(G==="selected"?e.selected=l&&typeof l!="function"&&typeof l!="symbol":Qe(e,i,G,l,s,null));return;case"dialog":Ce("beforetoggle",e),Ce("toggle",e),Ce("cancel",e),Ce("close",e);break;case"iframe":case"object":Ce("load",e);break;case"video":case"audio":for(l=0;l<hl.length;l++)Ce(hl[l],e);break;case"image":Ce("error",e),Ce("load",e);break;case"details":Ce("toggle",e);break;case"embed":case"source":case"link":Ce("error",e),Ce("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(it in s)if(s.hasOwnProperty(it)&&(l=s[it],l!=null))switch(it){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:Qe(e,i,it,l,s,null)}return;default:if(He(i)){for(pt in s)s.hasOwnProperty(pt)&&(l=s[pt],l!==void 0&&dd(e,i,pt,l,s,void 0));return}}for(C in s)s.hasOwnProperty(C)&&(l=s[C],l!=null&&Qe(e,i,C,l,s,null))}function n1(e,i,s,l){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,h=null,M=null,C=null,G=null,it=null,pt=null;for(ut in s){var yt=s[ut];if(s.hasOwnProperty(ut)&&yt!=null)switch(ut){case"checked":break;case"value":break;case"defaultValue":G=yt;default:l.hasOwnProperty(ut)||Qe(e,i,ut,null,l,yt)}}for(var lt in l){var ut=l[lt];if(yt=s[lt],l.hasOwnProperty(lt)&&(ut!=null||yt!=null))switch(lt){case"type":h=ut;break;case"name":f=ut;break;case"checked":it=ut;break;case"defaultChecked":pt=ut;break;case"value":M=ut;break;case"defaultValue":C=ut;break;case"children":case"dangerouslySetInnerHTML":if(ut!=null)throw Error(a(137,i));break;default:ut!==yt&&Qe(e,i,lt,ut,l,yt)}}qt(e,M,C,G,it,pt,h,f);return;case"select":ut=M=C=lt=null;for(h in s)if(G=s[h],s.hasOwnProperty(h)&&G!=null)switch(h){case"value":break;case"multiple":ut=G;default:l.hasOwnProperty(h)||Qe(e,i,h,null,l,G)}for(f in l)if(h=l[f],G=s[f],l.hasOwnProperty(f)&&(h!=null||G!=null))switch(f){case"value":lt=h;break;case"defaultValue":C=h;break;case"multiple":M=h;default:h!==G&&Qe(e,i,f,h,l,G)}i=C,s=M,l=ut,lt!=null?En(e,!!s,lt,!1):!!l!=!!s&&(i!=null?En(e,!!s,i,!0):En(e,!!s,s?[]:"",!1));return;case"textarea":ut=lt=null;for(C in s)if(f=s[C],s.hasOwnProperty(C)&&f!=null&&!l.hasOwnProperty(C))switch(C){case"value":break;case"children":break;default:Qe(e,i,C,null,l,f)}for(M in l)if(f=l[M],h=s[M],l.hasOwnProperty(M)&&(f!=null||h!=null))switch(M){case"value":lt=f;break;case"defaultValue":ut=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(a(91));break;default:f!==h&&Qe(e,i,M,f,l,h)}oi(e,lt,ut);return;case"option":for(var te in s)lt=s[te],s.hasOwnProperty(te)&&lt!=null&&!l.hasOwnProperty(te)&&(te==="selected"?e.selected=!1:Qe(e,i,te,null,l,lt));for(G in l)lt=l[G],ut=s[G],l.hasOwnProperty(G)&&lt!==ut&&(lt!=null||ut!=null)&&(G==="selected"?e.selected=lt&&typeof lt!="function"&&typeof lt!="symbol":Qe(e,i,G,lt,l,ut));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var _e in s)lt=s[_e],s.hasOwnProperty(_e)&&lt!=null&&!l.hasOwnProperty(_e)&&Qe(e,i,_e,null,l,lt);for(it in l)if(lt=l[it],ut=s[it],l.hasOwnProperty(it)&&lt!==ut&&(lt!=null||ut!=null))switch(it){case"children":case"dangerouslySetInnerHTML":if(lt!=null)throw Error(a(137,i));break;default:Qe(e,i,it,lt,l,ut)}return;default:if(He(i)){for(var Je in s)lt=s[Je],s.hasOwnProperty(Je)&&lt!==void 0&&!l.hasOwnProperty(Je)&&dd(e,i,Je,void 0,l,lt);for(pt in l)lt=l[pt],ut=s[pt],!l.hasOwnProperty(pt)||lt===ut||lt===void 0&&ut===void 0||dd(e,i,pt,lt,l,ut);return}}for(var j in s)lt=s[j],s.hasOwnProperty(j)&&lt!=null&&!l.hasOwnProperty(j)&&Qe(e,i,j,null,l,lt);for(yt in l)lt=l[yt],ut=s[yt],!l.hasOwnProperty(yt)||lt===ut||lt==null&&ut==null||Qe(e,i,yt,lt,l,ut)}function ov(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function i1(){if(typeof performance.getEntriesByType=="function"){for(var e=0,i=0,s=performance.getEntriesByType("resource"),l=0;l<s.length;l++){var f=s[l],h=f.transferSize,M=f.initiatorType,C=f.duration;if(h&&C&&ov(M)){for(M=0,C=f.responseEnd,l+=1;l<s.length;l++){var G=s[l],it=G.startTime;if(it>C)break;var pt=G.transferSize,yt=G.initiatorType;pt&&ov(yt)&&(G=G.responseEnd,M+=pt*(G<C?1:(C-it)/(G-it)))}if(--l,i+=8*(h+M)/(f.duration/1e3),e++,10<e)break}}if(0<e)return i/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var pd=null,md=null;function Qc(e){return e.nodeType===9?e:e.ownerDocument}function lv(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function cv(e,i){if(e===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&i==="foreignObject"?0:e}function gd(e,i){return e==="textarea"||e==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var _d=null;function a1(){var e=window.event;return e&&e.type==="popstate"?e===_d?!1:(_d=e,!0):(_d=null,!1)}var uv=typeof setTimeout=="function"?setTimeout:void 0,r1=typeof clearTimeout=="function"?clearTimeout:void 0,fv=typeof Promise=="function"?Promise:void 0,s1=typeof queueMicrotask=="function"?queueMicrotask:typeof fv<"u"?function(e){return fv.resolve(null).then(e).catch(o1)}:uv;function o1(e){setTimeout(function(){throw e})}function dr(e){return e==="head"}function hv(e,i){var s=i,l=0;do{var f=s.nextSibling;if(e.removeChild(s),f&&f.nodeType===8)if(s=f.data,s==="/$"||s==="/&"){if(l===0){e.removeChild(f),Qs(i);return}l--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")l++;else if(s==="html")pl(e.ownerDocument.documentElement);else if(s==="head"){s=e.ownerDocument.head,pl(s);for(var h=s.firstChild;h;){var M=h.nextSibling,C=h.nodeName;h[qa]||C==="SCRIPT"||C==="STYLE"||C==="LINK"&&h.rel.toLowerCase()==="stylesheet"||s.removeChild(h),h=M}}else s==="body"&&pl(e.ownerDocument.body);s=f}while(s);Qs(i)}function dv(e,i){var s=e;e=0;do{var l=s.nextSibling;if(s.nodeType===1?i?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(i?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),l&&l.nodeType===8)if(s=l.data,s==="/$"){if(e===0)break;e--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||e++;s=l}while(s)}function vd(e){var i=e.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var s=i;switch(i=i.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":vd(s),Ya(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}e.removeChild(s)}}function l1(e,i,s,l){for(;e.nodeType===1;){var f=s;if(e.nodeName.toLowerCase()!==i.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[qa])switch(i){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(h=e.getAttribute("rel"),h==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(h!==f.rel||e.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||e.getAttribute("title")!==(f.title==null?null:f.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(h=e.getAttribute("src"),(h!==(f.src==null?null:f.src)||e.getAttribute("type")!==(f.type==null?null:f.type)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&h&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(i==="input"&&e.type==="hidden"){var h=f.name==null?null:""+f.name;if(f.type==="hidden"&&e.getAttribute("name")===h)return e}else return e;if(e=Ci(e.nextSibling),e===null)break}return null}function c1(e,i,s){if(i==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!s||(e=Ci(e.nextSibling),e===null))return null;return e}function pv(e,i){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!i||(e=Ci(e.nextSibling),e===null))return null;return e}function xd(e){return e.data==="$?"||e.data==="$~"}function yd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function u1(e,i){var s=e.ownerDocument;if(e.data==="$~")e._reactRetry=i;else if(e.data!=="$?"||s.readyState!=="loading")i();else{var l=function(){i(),s.removeEventListener("DOMContentLoaded",l)};s.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function Ci(e){for(;e!=null;e=e.nextSibling){var i=e.nodeType;if(i===1||i===3)break;if(i===8){if(i=e.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return e}var Sd=null;function mv(e){e=e.nextSibling;for(var i=0;e;){if(e.nodeType===8){var s=e.data;if(s==="/$"||s==="/&"){if(i===0)return Ci(e.nextSibling);i--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||i++}e=e.nextSibling}return null}function gv(e){e=e.previousSibling;for(var i=0;e;){if(e.nodeType===8){var s=e.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(i===0)return e;i--}else s!=="/$"&&s!=="/&"||i++}e=e.previousSibling}return null}function _v(e,i,s){switch(i=Qc(s),e){case"html":if(e=i.documentElement,!e)throw Error(a(452));return e;case"head":if(e=i.head,!e)throw Error(a(453));return e;case"body":if(e=i.body,!e)throw Error(a(454));return e;default:throw Error(a(451))}}function pl(e){for(var i=e.attributes;i.length;)e.removeAttributeNode(i[0]);Ya(e)}var Di=new Map,vv=new Set;function Jc(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ca=V.d;V.d={f:f1,r:h1,D:d1,C:p1,L:m1,m:g1,X:v1,S:_1,M:x1};function f1(){var e=Ca.f(),i=Vc();return e||i}function h1(e){var i=ha(e);i!==null&&i.tag===5&&i.type==="form"?Pg(i):Ca.r(e)}var Ys=typeof document>"u"?null:document;function xv(e,i,s){var l=Ys;if(l&&typeof i=="string"&&i){var f=ke(i);f='link[rel="'+e+'"][href="'+f+'"]',typeof s=="string"&&(f+='[crossorigin="'+s+'"]'),vv.has(f)||(vv.add(f),e={rel:e,crossOrigin:s,href:i},l.querySelector(f)===null&&(i=l.createElement("link"),Pn(i,"link",e),gn(i),l.head.appendChild(i)))}}function d1(e){Ca.D(e),xv("dns-prefetch",e,null)}function p1(e,i){Ca.C(e,i),xv("preconnect",e,i)}function m1(e,i,s){Ca.L(e,i,s);var l=Ys;if(l&&e&&i){var f='link[rel="preload"][as="'+ke(i)+'"]';i==="image"&&s&&s.imageSrcSet?(f+='[imagesrcset="'+ke(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(f+='[imagesizes="'+ke(s.imageSizes)+'"]')):f+='[href="'+ke(e)+'"]';var h=f;switch(i){case"style":h=Zs(e);break;case"script":h=Ks(e)}Di.has(h)||(e=v({rel:"preload",href:i==="image"&&s&&s.imageSrcSet?void 0:e,as:i},s),Di.set(h,e),l.querySelector(f)!==null||i==="style"&&l.querySelector(ml(h))||i==="script"&&l.querySelector(gl(h))||(i=l.createElement("link"),Pn(i,"link",e),gn(i),l.head.appendChild(i)))}}function g1(e,i){Ca.m(e,i);var s=Ys;if(s&&e){var l=i&&typeof i.as=="string"?i.as:"script",f='link[rel="modulepreload"][as="'+ke(l)+'"][href="'+ke(e)+'"]',h=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=Ks(e)}if(!Di.has(h)&&(e=v({rel:"modulepreload",href:e},i),Di.set(h,e),s.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(gl(h)))return}l=s.createElement("link"),Pn(l,"link",e),gn(l),s.head.appendChild(l)}}}function _1(e,i,s){Ca.S(e,i,s);var l=Ys;if(l&&e){var f=Za(l).hoistableStyles,h=Zs(e);i=i||"default";var M=f.get(h);if(!M){var C={loading:0,preload:null};if(M=l.querySelector(ml(h)))C.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":i},s),(s=Di.get(h))&&Md(e,s);var G=M=l.createElement("link");gn(G),Pn(G,"link",e),G._p=new Promise(function(it,pt){G.onload=it,G.onerror=pt}),G.addEventListener("load",function(){C.loading|=1}),G.addEventListener("error",function(){C.loading|=2}),C.loading|=4,jc(M,i,l)}M={type:"stylesheet",instance:M,count:1,state:C},f.set(h,M)}}}function v1(e,i){Ca.X(e,i);var s=Ys;if(s&&e){var l=Za(s).hoistableScripts,f=Ks(e),h=l.get(f);h||(h=s.querySelector(gl(f)),h||(e=v({src:e,async:!0},i),(i=Di.get(f))&&Ed(e,i),h=s.createElement("script"),gn(h),Pn(h,"link",e),s.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function x1(e,i){Ca.M(e,i);var s=Ys;if(s&&e){var l=Za(s).hoistableScripts,f=Ks(e),h=l.get(f);h||(h=s.querySelector(gl(f)),h||(e=v({src:e,async:!0,type:"module"},i),(i=Di.get(f))&&Ed(e,i),h=s.createElement("script"),gn(h),Pn(h,"link",e),s.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(f,h))}}function yv(e,i,s,l){var f=(f=st.current)?Jc(f):null;if(!f)throw Error(a(446));switch(e){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(i=Zs(s.href),s=Za(f).hoistableStyles,l=s.get(i),l||(l={type:"style",instance:null,count:0,state:null},s.set(i,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){e=Zs(s.href);var h=Za(f).hoistableStyles,M=h.get(e);if(M||(f=f.ownerDocument||f,M={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,M),(h=f.querySelector(ml(e)))&&!h._p&&(M.instance=h,M.state.loading=5),Di.has(e)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},Di.set(e,s),h||y1(f,e,s,M.state))),i&&l===null)throw Error(a(528,""));return M}if(i&&l!==null)throw Error(a(529,""));return null;case"script":return i=s.async,s=s.src,typeof s=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Ks(s),s=Za(f).hoistableScripts,l=s.get(i),l||(l={type:"script",instance:null,count:0,state:null},s.set(i,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,e))}}function Zs(e){return'href="'+ke(e)+'"'}function ml(e){return'link[rel="stylesheet"]['+e+"]"}function Sv(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function y1(e,i,s,l){e.querySelector('link[rel="preload"][as="style"]['+i+"]")?l.loading=1:(i=e.createElement("link"),l.preload=i,i.addEventListener("load",function(){return l.loading|=1}),i.addEventListener("error",function(){return l.loading|=2}),Pn(i,"link",s),gn(i),e.head.appendChild(i))}function Ks(e){return'[src="'+ke(e)+'"]'}function gl(e){return"script[async]"+e}function Mv(e,i,s){if(i.count++,i.instance===null)switch(i.type){case"style":var l=e.querySelector('style[data-href~="'+ke(s.href)+'"]');if(l)return i.instance=l,gn(l),l;var f=v({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),gn(l),Pn(l,"style",f),jc(l,s.precedence,e),i.instance=l;case"stylesheet":f=Zs(s.href);var h=e.querySelector(ml(f));if(h)return i.state.loading|=4,i.instance=h,gn(h),h;l=Sv(s),(f=Di.get(f))&&Md(l,f),h=(e.ownerDocument||e).createElement("link"),gn(h);var M=h;return M._p=new Promise(function(C,G){M.onload=C,M.onerror=G}),Pn(h,"link",l),i.state.loading|=4,jc(h,s.precedence,e),i.instance=h;case"script":return h=Ks(s.src),(f=e.querySelector(gl(h)))?(i.instance=f,gn(f),f):(l=s,(f=Di.get(h))&&(l=v({},s),Ed(l,f)),e=e.ownerDocument||e,f=e.createElement("script"),gn(f),Pn(f,"link",l),e.head.appendChild(f),i.instance=f);case"void":return null;default:throw Error(a(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(l=i.instance,i.state.loading|=4,jc(l,s.precedence,e));return i.instance}function jc(e,i,s){for(var l=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,h=f,M=0;M<l.length;M++){var C=l[M];if(C.dataset.precedence===i)h=C;else if(h!==f)break}h?h.parentNode.insertBefore(e,h.nextSibling):(i=s.nodeType===9?s.head:s,i.insertBefore(e,i.firstChild))}function Md(e,i){e.crossOrigin==null&&(e.crossOrigin=i.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=i.referrerPolicy),e.title==null&&(e.title=i.title)}function Ed(e,i){e.crossOrigin==null&&(e.crossOrigin=i.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=i.referrerPolicy),e.integrity==null&&(e.integrity=i.integrity)}var $c=null;function Ev(e,i,s){if($c===null){var l=new Map,f=$c=new Map;f.set(s,l)}else f=$c,l=f.get(s),l||(l=new Map,f.set(s,l));if(l.has(e))return l;for(l.set(e,null),s=s.getElementsByTagName(e),f=0;f<s.length;f++){var h=s[f];if(!(h[qa]||h[mn]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var M=h.getAttribute(i)||"";M=e+M;var C=l.get(M);C?C.push(h):l.set(M,[h])}}return l}function bv(e,i,s){e=e.ownerDocument||e,e.head.insertBefore(s,i==="title"?e.querySelector("head > title"):null)}function S1(e,i,s){if(s===1||i.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;return i.rel==="stylesheet"?(e=i.disabled,typeof i.precedence=="string"&&e==null):!0;case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function Tv(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function M1(e,i,s,l){if(s.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var f=Zs(l.href),h=i.querySelector(ml(f));if(h){i=h._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(e.count++,e=tu.bind(e),i.then(e,e)),s.state.loading|=4,s.instance=h,gn(h);return}h=i.ownerDocument||i,l=Sv(l),(f=Di.get(f))&&Md(l,f),h=h.createElement("link"),gn(h);var M=h;M._p=new Promise(function(C,G){M.onload=C,M.onerror=G}),Pn(h,"link",l),s.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(s,i),(i=s.state.preload)&&(s.state.loading&3)===0&&(e.count++,s=tu.bind(e),i.addEventListener("load",s),i.addEventListener("error",s))}}var bd=0;function E1(e,i){return e.stylesheets&&e.count===0&&nu(e,e.stylesheets),0<e.count||0<e.imgCount?function(s){var l=setTimeout(function(){if(e.stylesheets&&nu(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+i);0<e.imgBytes&&bd===0&&(bd=62500*i1());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&nu(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>bd?50:800)+i);return e.unsuspend=s,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(f)}}:null}function tu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)nu(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var eu=null;function nu(e,i){e.stylesheets=null,e.unsuspend!==null&&(e.count++,eu=new Map,i.forEach(b1,e),eu=null,tu.call(e))}function b1(e,i){if(!(i.state.loading&4)){var s=eu.get(e);if(s)var l=s.get(null);else{s=new Map,eu.set(e,s);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<f.length;h++){var M=f[h];(M.nodeName==="LINK"||M.getAttribute("media")!=="not all")&&(s.set(M.dataset.precedence,M),l=M)}l&&s.set(null,l)}f=i.instance,M=f.getAttribute("data-precedence"),h=s.get(M)||l,h===l&&s.set(null,f),s.set(M,f),this.count++,l=tu.bind(this),f.addEventListener("load",l),f.addEventListener("error",l),h?h.parentNode.insertBefore(f,h.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(f,e.firstChild)),i.state.loading|=4}}var _l={$$typeof:U,Provider:null,Consumer:null,_currentValue:et,_currentValue2:et,_threadCount:0};function T1(e,i,s,l,f,h,M,C,G){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ae(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ae(0),this.hiddenUpdates=ae(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=h,this.onRecoverableError=M,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=G,this.incompleteTransitions=new Map}function Av(e,i,s,l,f,h,M,C,G,it,pt,yt){return e=new T1(e,i,s,M,G,it,pt,yt,C),i=1,h===!0&&(i|=24),h=ui(3,null,null,i),e.current=h,h.stateNode=e,i=ih(),i.refCount++,e.pooledCache=i,i.refCount++,h.memoizedState={element:l,isDehydrated:s,cache:i},oh(h),e}function Rv(e){return e?(e=As,e):As}function wv(e,i,s,l,f,h){f=Rv(f),l.context===null?l.context=f:l.pendingContext=f,l=nr(i),l.payload={element:s},h=h===void 0?null:h,h!==null&&(l.callback=h),s=ir(e,l,i),s!==null&&(ei(s,e,i),Ko(s,e,i))}function Cv(e,i){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<i?s:i}}function Td(e,i){Cv(e,i),(e=e.alternate)&&Cv(e,i)}function Dv(e){if(e.tag===13||e.tag===31){var i=Hr(e,67108864);i!==null&&ei(i,e,67108864),Td(e,67108864)}}function Lv(e){if(e.tag===13||e.tag===31){var i=mi();i=Lo(i);var s=Hr(e,i);s!==null&&ei(s,e,i),Td(e,i)}}var iu=!0;function A1(e,i,s,l){var f=F.T;F.T=null;var h=V.p;try{V.p=2,Ad(e,i,s,l)}finally{V.p=h,F.T=f}}function R1(e,i,s,l){var f=F.T;F.T=null;var h=V.p;try{V.p=8,Ad(e,i,s,l)}finally{V.p=h,F.T=f}}function Ad(e,i,s,l){if(iu){var f=Rd(l);if(f===null)hd(e,i,l,au,s),Nv(e,l);else if(C1(f,e,i,s,l))l.stopPropagation();else if(Nv(e,l),i&4&&-1<w1.indexOf(e)){for(;f!==null;){var h=ha(f);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var M=Nt(h.pendingLanes);if(M!==0){var C=h;for(C.pendingLanes|=2,C.entangledLanes|=2;M;){var G=1<<31-Xt(M);C.entanglements[1]|=G,M&=~G}$i(h),(Fe&6)===0&&(Hc=Ft()+500,fl(0))}}break;case 31:case 13:C=Hr(h,2),C!==null&&ei(C,h,2),Vc(),Td(h,2)}if(h=Rd(l),h===null&&hd(e,i,l,au,s),h===f)break;f=h}f!==null&&l.stopPropagation()}else hd(e,i,l,null,s)}}function Rd(e){return e=Cf(e),wd(e)}var au=null;function wd(e){if(au=null,e=fa(e),e!==null){var i=c(e);if(i===null)e=null;else{var s=i.tag;if(s===13){if(e=u(i),e!==null)return e;e=null}else if(s===31){if(e=d(i),e!==null)return e;e=null}else if(s===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;e=null}else i!==e&&(e=null)}}return au=e,null}function Uv(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ie()){case L:return 2;case b:return 8;case K:case $:return 32;case tt:return 268435456;default:return 32}default:return 32}}var Cd=!1,pr=null,mr=null,gr=null,vl=new Map,xl=new Map,_r=[],w1="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Nv(e,i){switch(e){case"focusin":case"focusout":pr=null;break;case"dragenter":case"dragleave":mr=null;break;case"mouseover":case"mouseout":gr=null;break;case"pointerover":case"pointerout":vl.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":xl.delete(i.pointerId)}}function yl(e,i,s,l,f,h){return e===null||e.nativeEvent!==h?(e={blockedOn:i,domEventName:s,eventSystemFlags:l,nativeEvent:h,targetContainers:[f]},i!==null&&(i=ha(i),i!==null&&Dv(i)),e):(e.eventSystemFlags|=l,i=e.targetContainers,f!==null&&i.indexOf(f)===-1&&i.push(f),e)}function C1(e,i,s,l,f){switch(i){case"focusin":return pr=yl(pr,e,i,s,l,f),!0;case"dragenter":return mr=yl(mr,e,i,s,l,f),!0;case"mouseover":return gr=yl(gr,e,i,s,l,f),!0;case"pointerover":var h=f.pointerId;return vl.set(h,yl(vl.get(h)||null,e,i,s,l,f)),!0;case"gotpointercapture":return h=f.pointerId,xl.set(h,yl(xl.get(h)||null,e,i,s,l,f)),!0}return!1}function Ov(e){var i=fa(e.target);if(i!==null){var s=c(i);if(s!==null){if(i=s.tag,i===13){if(i=u(s),i!==null){e.blockedOn=i,xs(e.priority,function(){Lv(s)});return}}else if(i===31){if(i=d(s),i!==null){e.blockedOn=i,xs(e.priority,function(){Lv(s)});return}}else if(i===3&&s.stateNode.current.memoizedState.isDehydrated){e.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ru(e){if(e.blockedOn!==null)return!1;for(var i=e.targetContainers;0<i.length;){var s=Rd(e.nativeEvent);if(s===null){s=e.nativeEvent;var l=new s.constructor(s.type,s);wf=l,s.target.dispatchEvent(l),wf=null}else return i=ha(s),i!==null&&Dv(i),e.blockedOn=s,!1;i.shift()}return!0}function Pv(e,i,s){ru(e)&&s.delete(i)}function D1(){Cd=!1,pr!==null&&ru(pr)&&(pr=null),mr!==null&&ru(mr)&&(mr=null),gr!==null&&ru(gr)&&(gr=null),vl.forEach(Pv),xl.forEach(Pv)}function su(e,i){e.blockedOn===i&&(e.blockedOn=null,Cd||(Cd=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,D1)))}var ou=null;function Bv(e){ou!==e&&(ou=e,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){ou===e&&(ou=null);for(var i=0;i<e.length;i+=3){var s=e[i],l=e[i+1],f=e[i+2];if(typeof l!="function"){if(wd(l||s)===null)continue;break}var h=ha(s);h!==null&&(e.splice(i,3),i-=3,Rh(h,{pending:!0,data:f,method:s.method,action:l},l,f))}}))}function Qs(e){function i(G){return su(G,e)}pr!==null&&su(pr,e),mr!==null&&su(mr,e),gr!==null&&su(gr,e),vl.forEach(i),xl.forEach(i);for(var s=0;s<_r.length;s++){var l=_r[s];l.blockedOn===e&&(l.blockedOn=null)}for(;0<_r.length&&(s=_r[0],s.blockedOn===null);)Ov(s),s.blockedOn===null&&_r.shift();if(s=(e.ownerDocument||e).$$reactFormReplay,s!=null)for(l=0;l<s.length;l+=3){var f=s[l],h=s[l+1],M=f[Ln]||null;if(typeof h=="function")M||Bv(s);else if(M){var C=null;if(h&&h.hasAttribute("formAction")){if(f=h,M=h[Ln]||null)C=M.formAction;else if(wd(f)!==null)continue}else C=M.action;typeof C=="function"?s[l+1]=C:(s.splice(l,3),l-=3),Bv(s)}}}function Iv(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(M){return f=M})},focusReset:"manual",scroll:"manual"})}function i(){f!==null&&(f(),f=null),l||setTimeout(s,20)}function s(){if(!l&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,f=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(s,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),f!==null&&(f(),f=null)}}}function Dd(e){this._internalRoot=e}lu.prototype.render=Dd.prototype.render=function(e){var i=this._internalRoot;if(i===null)throw Error(a(409));var s=i.current,l=mi();wv(s,l,e,i,null,null)},lu.prototype.unmount=Dd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var i=e.containerInfo;wv(e.current,2,null,e,null,null),Vc(),i[Kn]=null}};function lu(e){this._internalRoot=e}lu.prototype.unstable_scheduleHydration=function(e){if(e){var i=No();e={blockedOn:null,target:e,priority:i};for(var s=0;s<_r.length&&i!==0&&i<_r[s].priority;s++);_r.splice(s,0,e),s===0&&Ov(e)}};var zv=t.version;if(zv!=="19.2.3")throw Error(a(527,zv,"19.2.3"));V.findDOMNode=function(e){var i=e._reactInternals;if(i===void 0)throw typeof e.render=="function"?Error(a(188)):(e=Object.keys(e).join(","),Error(a(268,e)));return e=p(i),e=e!==null?_(e):null,e=e===null?null:e.stateNode,e};var L1={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var cu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!cu.isDisabled&&cu.supportsFiber)try{ct=cu.inject(L1),ft=cu}catch{}}return Ml.createRoot=function(e,i){if(!o(e))throw Error(a(299));var s=!1,l="",f=Xg,h=qg,M=Yg;return i!=null&&(i.unstable_strictMode===!0&&(s=!0),i.identifierPrefix!==void 0&&(l=i.identifierPrefix),i.onUncaughtError!==void 0&&(f=i.onUncaughtError),i.onCaughtError!==void 0&&(h=i.onCaughtError),i.onRecoverableError!==void 0&&(M=i.onRecoverableError)),i=Av(e,1,!1,null,null,s,l,null,f,h,M,Iv),e[Kn]=i.current,fd(e),new Dd(i)},Ml.hydrateRoot=function(e,i,s){if(!o(e))throw Error(a(299));var l=!1,f="",h=Xg,M=qg,C=Yg,G=null;return s!=null&&(s.unstable_strictMode===!0&&(l=!0),s.identifierPrefix!==void 0&&(f=s.identifierPrefix),s.onUncaughtError!==void 0&&(h=s.onUncaughtError),s.onCaughtError!==void 0&&(M=s.onCaughtError),s.onRecoverableError!==void 0&&(C=s.onRecoverableError),s.formState!==void 0&&(G=s.formState)),i=Av(e,1,!0,i,s??null,l,f,G,h,M,C,Iv),i.context=Rv(null),s=i.current,l=mi(),l=Lo(l),f=nr(l),f.callback=null,ir(s,f,l),s=l,i.current.lanes=s,Kt(i,s),$i(i),e[Kn]=i.current,fd(e),new lu(i)},Ml.version="19.2.3",Ml}var Zv;function G1(){if(Zv)return Nd.exports;Zv=1;function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(t){console.error(t)}}return r(),Nd.exports=H1(),Nd.exports}var V1=G1();var Am=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,My=/^[\\/]{2}/;function k1(r,t){return t+r.replace(/\\/g,"/")}var Kv="popstate";function Qv(r){return typeof r=="object"&&r!=null&&"pathname"in r&&"search"in r&&"hash"in r&&"state"in r&&"key"in r}function W1(r={}){function t(a,o){let c=o.state?.masked,{pathname:u,search:d,hash:m}=c||a.location;return Ap("",{pathname:u,search:d,hash:m},o.state&&o.state.usr||null,o.state&&o.state.key||"default",c?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function n(a,o){return typeof o=="string"?o:Vl(o)}return q1(t,n,null,r)}function Tn(r,t){if(r===!1||r===null||typeof r>"u")throw new Error(t)}function la(r,t){if(!r){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function X1(){return Math.random().toString(36).substring(2,10)}function Jv(r,t){return{usr:r.state,key:r.key,idx:t,masked:r.mask?{pathname:r.pathname,search:r.search,hash:r.hash}:void 0}}function Ap(r,t,n=null,a,o){return{pathname:typeof r=="string"?r:r.pathname,search:"",hash:"",...typeof t=="string"?Zl(t):t,state:n,key:t&&t.key||a||X1(),mask:o}}function Vl({pathname:r="/",search:t="",hash:n=""}){return t&&t!=="?"&&(r+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(r+=n.charAt(0)==="#"?n:"#"+n),r}function Zl(r){let t={};if(r){let n=r.indexOf("#");n>=0&&(t.hash=r.substring(n),r=r.substring(0,n));let a=r.indexOf("?");a>=0&&(t.search=r.substring(a),r=r.substring(0,a)),r&&(t.pathname=r)}return t}function q1(r,t,n,a={}){let{window:o=document.defaultView,v5Compat:c=!1}=a,u=o.history,d="POP",m=null,p=_();p==null&&(p=0,u.replaceState({...u.state,idx:p},""));function _(){return(u.state||{idx:null}).idx}function v(){d="POP";let x=_(),S=x==null?null:x-p;p=x,m&&m({action:d,location:A.location,delta:S})}function g(x,S){d="PUSH";let D=Qv(x)?x:Ap(A.location,x,S);p=_()+1;let U=Jv(D,p),w=A.createHref(D.mask||D);try{u.pushState(U,"",w)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;o.location.assign(w)}c&&m&&m({action:d,location:A.location,delta:1})}function y(x,S){d="REPLACE";let D=Qv(x)?x:Ap(A.location,x,S);p=_();let U=Jv(D,p),w=A.createHref(D.mask||D);u.replaceState(U,"",w),c&&m&&m({action:d,location:A.location,delta:0})}function E(x){return Y1(o,x)}let A={get action(){return d},get location(){return r(o,u)},listen(x){if(m)throw new Error("A history only accepts one active listener");return o.addEventListener(Kv,v),m=x,()=>{o.removeEventListener(Kv,v),m=null}},createHref(x){return t(o,x)},createURL:E,encodeLocation(x){let S=E(x);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:g,replace:y,go(x){return u.go(x)}};return A}function Y1(r,t,n=!1){let a="http://localhost";r&&(a=r.location.origin!=="null"?r.location.origin:r.location.href),Tn(a,"No window.location.(origin|href) available to create URL");let o=typeof t=="string"?t:Vl(t);return o=o.replace(/ $/,"%20"),!n&&My.test(o)&&(o=a+o),new URL(o,a)}function Ey(r,t,n="/"){return Z1(r,t,n,!1)}function Z1(r,t,n,a,o){let c=typeof t=="string"?Zl(t):t,u=Va(c.pathname||"/",n);if(u==null)return null;let d=K1(r),m=null,p=sE(u);for(let _=0;m==null&&_<d.length;++_)m=rE(d[_],p,a);return m}function K1(r){let t=by(r);return Q1(t),t}function by(r,t=[],n=[],a="",o=!1){let c=(u,d,m=o,p)=>{let _={relativePath:p===void 0?u.path||"":p,caseSensitive:u.caseSensitive===!0,childrenIndex:d,route:u};if(_.relativePath.startsWith("/")){if(!_.relativePath.startsWith(a)&&m)return;Tn(_.relativePath.startsWith(a),`Absolute route path "${_.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),_.relativePath=_.relativePath.slice(a.length)}let v=qi([a,_.relativePath]),g=n.concat(_);u.children&&u.children.length>0&&(Tn(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),by(u.children,t,g,v,m)),!(u.path==null&&!u.index)&&t.push({path:v,score:iE(v,u.index),routesMeta:g.map((y,E)=>{let[A,x]=Ry(y.relativePath,y.caseSensitive,E===g.length-1);return{...y,matcher:A,compiledParams:x}})})};return r.forEach((u,d)=>{if(u.path===""||!u.path?.includes("?"))c(u,d);else for(let m of Ty(u.path))c(u,d,!0,m)}),t}function Ty(r){let t=r.split("/");if(t.length===0)return[];let[n,...a]=t,o=n.endsWith("?"),c=n.replace(/\?$/,"");if(a.length===0)return o?[c,""]:[c];let u=Ty(a.join("/")),d=[];return d.push(...u.map(m=>m===""?c:[c,m].join("/"))),o&&d.push(...u),d.map(m=>r.startsWith("/")&&m===""?"/":m)}function Q1(r){r.sort((t,n)=>t.score!==n.score?n.score-t.score:aE(t.routesMeta.map(a=>a.childrenIndex),n.routesMeta.map(a=>a.childrenIndex)))}var J1=/^:[\w-]+$/,j1=3,$1=2,tE=1,eE=10,nE=-2,jv=r=>r==="*";function iE(r,t){let n=r.split("/"),a=n.length;return n.some(jv)&&(a+=nE),t&&(a+=$1),n.filter(o=>!jv(o)).reduce((o,c)=>o+(J1.test(c)?j1:c===""?tE:eE),a)}function aE(r,t){return r.length===t.length&&r.slice(0,-1).every((a,o)=>a===t[o])?r[r.length-1]-t[t.length-1]:0}function rE(r,t,n=!1){let{routesMeta:a}=r,o={},c="/",u=[];for(let d=0;d<a.length;++d){let m=a[d],p=d===a.length-1,_=c==="/"?t:t.slice(c.length)||"/",v={path:m.relativePath,caseSensitive:m.caseSensitive,end:p},g=m.matcher&&m.compiledParams?Ay(v,_,m.matcher,m.compiledParams):af(v,_),y=m.route;if(!g&&p&&n&&!a[a.length-1].route.index&&(g=af({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},_)),!g)return null;Object.assign(o,g.params),u.push({params:o,pathname:qi([c,g.pathname]),pathnameBase:cE(qi([c,g.pathnameBase])),route:y}),g.pathnameBase!=="/"&&(c=qi([c,g.pathnameBase]))}return u}function af(r,t){typeof r=="string"&&(r={path:r,caseSensitive:!1,end:!0});let[n,a]=Ry(r.path,r.caseSensitive,r.end);return Ay(r,t,n,a)}function Ay(r,t,n,a){let o=t.match(n);if(!o)return null;let c=o[0],u=c.replace(/(.)\/+$/,"$1"),d=o.slice(1);return{params:a.reduce((p,{paramName:_,isOptional:v},g)=>{if(_==="*"){let E=d[g]||"";u=c.slice(0,c.length-E.length).replace(/(.)\/+$/,"$1")}const y=d[g];return v&&!y?p[_]=void 0:p[_]=(y||"").replace(/%2F/g,"/"),p},{}),pathname:c,pathnameBase:u,pattern:r}}function Ry(r,t=!1,n=!0){la(r==="*"||!r.endsWith("*")||r.endsWith("/*"),`Route path "${r}" will be treated as if it were "${r.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${r.replace(/\*$/,"/*")}".`);let a=[],o="^"+r.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,d,m,p,_)=>{if(a.push({paramName:d,isOptional:m!=null}),m){let v=_.charAt(p+u.length);return v&&v!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return r.endsWith("*")?(a.push({paramName:"*"}),o+=r==="*"||r==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":r!==""&&r!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),a]}function sE(r){try{return r.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return la(!1,`The URL path "${r}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),r}}function Va(r,t){if(t==="/")return r;if(!r.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,a=r.charAt(n);return a&&a!=="/"?null:r.slice(n)||"/"}function oE(r,t="/"){let{pathname:n,search:a="",hash:o=""}=typeof r=="string"?Zl(r):r,c;return n?(n=Cy(n),n.startsWith("/")?c=$v(n.substring(1),"/"):c=$v(n,t)):c=t,{pathname:c,search:uE(a),hash:fE(o)}}function $v(r,t){let n=rf(t).split("/");return r.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function Id(r,t,n,a){return`Cannot include a '${r}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function lE(r){return r.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function wy(r){let t=lE(r);return t.map((n,a)=>a===t.length-1?n.pathname:n.pathnameBase)}function Rm(r,t,n,a=!1){let o;typeof r=="string"?o=Zl(r):(o={...r},Tn(!o.pathname||!o.pathname.includes("?"),Id("?","pathname","search",o)),Tn(!o.pathname||!o.pathname.includes("#"),Id("#","pathname","hash",o)),Tn(!o.search||!o.search.includes("#"),Id("#","search","hash",o)));let c=r===""||o.pathname==="",u=c?"/":o.pathname,d;if(u==null)d=n;else{let v=t.length-1;if(!a&&u.startsWith("..")){let g=u.split("/");for(;g[0]==="..";)g.shift(),v-=1;o.pathname=g.join("/")}d=v>=0?t[v]:"/"}let m=oE(o,d),p=u&&u!=="/"&&u.endsWith("/"),_=(c||u===".")&&n.endsWith("/");return!m.pathname.endsWith("/")&&(p||_)&&(m.pathname+="/"),m}var Cy=r=>r.replace(/[\\/]{2,}/g,"/"),qi=r=>Cy(r.join("/")),rf=r=>r.replace(/\/+$/,""),cE=r=>rf(r).replace(/^\/*/,"/"),uE=r=>!r||r==="?"?"":r.startsWith("?")?r:"?"+r,fE=r=>!r||r==="#"?"":r.startsWith("#")?r:"#"+r,hE=class{constructor(r,t,n,a=!1){this.status=r,this.statusText=t||"",this.internal=a,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function dE(r){return r!=null&&typeof r.status=="number"&&typeof r.statusText=="string"&&typeof r.internal=="boolean"&&"data"in r}function pE(r){let t=r.map(n=>n.route.path).filter(Boolean);return qi(t)||"/"}var Dy=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ly(r,t){let n=r;if(typeof n!="string"||!Am.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let a=n,o=!1;if(Dy)try{let c=new URL(window.location.href),u=My.test(n)?new URL(k1(n,c.protocol)):new URL(n),d=Va(u.pathname,t);u.origin===c.origin&&d!=null?n=d+u.search+u.hash:o=!0}catch{la(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:o,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Uy=["POST","PUT","PATCH","DELETE"];new Set(Uy);var mE=["GET",...Uy];new Set(mE);var gE=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function _E(r){try{return gE.includes(new URL(r).protocol)}catch{return!1}}var wo=ht.createContext(null);wo.displayName="DataRouter";var xf=ht.createContext(null);xf.displayName="DataRouterState";var Ny=ht.createContext(!1);function vE(){return ht.useContext(Ny)}var Oy=ht.createContext({isTransitioning:!1});Oy.displayName="ViewTransition";var xE=ht.createContext(new Map);xE.displayName="Fetchers";var yE=ht.createContext(null);yE.displayName="Await";var Oi=ht.createContext(null);Oi.displayName="Navigation";var yf=ht.createContext(null);yf.displayName="Location";var Wa=ht.createContext({outlet:null,matches:[],isDataRoute:!1});Wa.displayName="Route";var wm=ht.createContext(null);wm.displayName="RouteError";var Py="REACT_ROUTER_ERROR",SE="REDIRECT",ME="ROUTE_ERROR_RESPONSE";function EE(r){if(r.startsWith(`${Py}:${SE}:{`))try{let t=JSON.parse(r.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function bE(r){if(r.startsWith(`${Py}:${ME}:{`))try{let t=JSON.parse(r.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new hE(t.status,t.statusText,t.data)}catch{}}function TE(r,{relative:t}={}){Tn(Kl(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:a}=ht.useContext(Oi),{hash:o,pathname:c,search:u}=Ql(r,{relative:t}),d=c;return n!=="/"&&(d=c==="/"?n:qi([n,c])),a.createHref({pathname:d,search:u,hash:o})}function Kl(){return ht.useContext(yf)!=null}function Xa(){return Tn(Kl(),"useLocation() may be used only in the context of a <Router> component."),ht.useContext(yf).location}var By="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Iy(r){ht.useContext(Oi).static||ht.useLayoutEffect(r)}function AE(){let{isDataRoute:r}=ht.useContext(Wa);return r?FE():RE()}function RE(){Tn(Kl(),"useNavigate() may be used only in the context of a <Router> component.");let r=ht.useContext(wo),{basename:t,navigator:n}=ht.useContext(Oi),{matches:a}=ht.useContext(Wa),{pathname:o}=Xa(),c=JSON.stringify(wy(a)),u=ht.useRef(!1);return Iy(()=>{u.current=!0}),ht.useCallback((m,p={})=>{if(la(u.current,By),!u.current)return;if(typeof m=="number"){n.go(m);return}let _=Rm(m,JSON.parse(c),o,p.relative==="path");r==null&&t!=="/"&&(_.pathname=_.pathname==="/"?t:qi([t,_.pathname])),(p.replace?n.replace:n.push)(_,p.state,p)},[t,n,c,o,r])}ht.createContext(null);function Ql(r,{relative:t}={}){let{matches:n}=ht.useContext(Wa),{pathname:a}=Xa(),o=JSON.stringify(wy(n));return ht.useMemo(()=>Rm(r,JSON.parse(o),a,t==="path"),[r,o,a,t])}function wE(r,t,n){Tn(Kl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=ht.useContext(Oi),{matches:o}=ht.useContext(Wa),c=o[o.length-1],u=c?c.params:{},d=c?c.pathname:"/",m=c?c.pathnameBase:"/",p=c&&c.route;{let x=p&&p.path||"";Fy(d,!p||x.endsWith("*")||x.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${x}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
Please change the parent <Route path="${x}"> to <Route path="${x==="/"?"*":`${x}/*`}">.`)}let _=Xa(),v;v=_;let g=v.pathname||"/",y=g;if(m!=="/"){let x=m.replace(/^\//,"").split("/");y="/"+g.replace(/^\//,"").split("/").slice(x.length).join("/")}let E=n&&n.state.matches.length?n.state.matches.map(x=>Object.assign(x,{route:n.manifest[x.route.id]||x.route})):Ey(r,{pathname:y});return la(p||E!=null,`No routes matched location "${v.pathname}${v.search}${v.hash}" `),la(E==null||E[E.length-1].route.element!==void 0||E[E.length-1].route.Component!==void 0||E[E.length-1].route.lazy!==void 0,`Matched leaf route at location "${v.pathname}${v.search}${v.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),NE(E&&E.map(x=>Object.assign({},x,{params:Object.assign({},u,x.params),pathname:qi([m,a.encodeLocation?a.encodeLocation(x.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?m:qi([m,a.encodeLocation?a.encodeLocation(x.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:x.pathnameBase])})),o,n)}function CE(){let r=zE(),t=dE(r)?`${r.status} ${r.statusText}`:r instanceof Error?r.message:JSON.stringify(r),n=r instanceof Error?r.stack:null,a="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:a},c={padding:"2px 4px",backgroundColor:a},u=null;return console.error("Error handled by React Router default ErrorBoundary:",r),u=ht.createElement(ht.Fragment,null,ht.createElement("p",null,"💿 Hey developer 👋"),ht.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",ht.createElement("code",{style:c},"ErrorBoundary")," or"," ",ht.createElement("code",{style:c},"errorElement")," prop on your route.")),ht.createElement(ht.Fragment,null,ht.createElement("h2",null,"Unexpected Application Error!"),ht.createElement("h3",{style:{fontStyle:"italic"}},t),n?ht.createElement("pre",{style:o},n):null,u)}var DE=ht.createElement(CE,null),zy=class extends ht.Component{constructor(r){super(r),this.state={location:r.location,revalidation:r.revalidation,error:r.error}}static getDerivedStateFromError(r){return{error:r}}static getDerivedStateFromProps(r,t){return t.location!==r.location||t.revalidation!=="idle"&&r.revalidation==="idle"?{error:r.error,location:r.location,revalidation:r.revalidation}:{error:r.error!==void 0?r.error:t.error,location:t.location,revalidation:r.revalidation||t.revalidation}}componentDidCatch(r,t){this.props.onError?this.props.onError(r,t):console.error("React Router caught the following error during render",r)}render(){let r=this.state.error;if(this.context&&typeof r=="object"&&r&&"digest"in r&&typeof r.digest=="string"){const n=bE(r.digest);n&&(r=n)}let t=r!==void 0?ht.createElement(Wa.Provider,{value:this.props.routeContext},ht.createElement(wm.Provider,{value:r,children:this.props.component})):this.props.children;return this.context?ht.createElement(LE,{error:r},t):t}};zy.contextType=Ny;var zd=new WeakMap;function LE({children:r,error:t}){let{basename:n}=ht.useContext(Oi);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let a=EE(t.digest);if(a){let o=zd.get(t);if(o)throw o;let c=Ly(a.location,n),u=c.absoluteURL||c.to;if(_E(u))throw new Error("Invalid redirect location");if(Dy&&!zd.get(t))if(c.isExternal||a.reloadDocument)window.location.href=u;else{const d=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(c.to,{replace:a.replace}));throw zd.set(t,d),d}return ht.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u}`})}}return r}function UE({routeContext:r,match:t,children:n}){let a=ht.useContext(wo);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),ht.createElement(Wa.Provider,{value:r},n)}function NE(r,t=[],n){let a=n?.state;if(r==null){if(!a)return null;if(a.errors)r=a.matches;else if(t.length===0&&!a.initialized&&a.matches.length>0)r=a.matches;else return null}let o=r,c=a?.errors;if(c!=null){let _=o.findIndex(v=>v.route.id&&c?.[v.route.id]!==void 0);Tn(_>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),o=o.slice(0,Math.min(o.length,_+1))}let u=!1,d=-1;if(n&&a){u=a.renderFallback;for(let _=0;_<o.length;_++){let v=o[_];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(d=_),v.route.id){let{loaderData:g,errors:y}=a,E=v.route.loader&&!g.hasOwnProperty(v.route.id)&&(!y||y[v.route.id]===void 0);if(v.route.lazy||E){n.isStatic&&(u=!0),d>=0?o=o.slice(0,d+1):o=[o[0]];break}}}}let m=n?.onError,p=a&&m?(_,v)=>{m(_,{location:a.location,params:a.matches?.[0]?.params??{},pattern:pE(a.matches),errorInfo:v})}:void 0;return o.reduceRight((_,v,g)=>{let y,E=!1,A=null,x=null;a&&(y=c&&v.route.id?c[v.route.id]:void 0,A=v.route.errorElement||DE,u&&(d<0&&g===0?(Fy("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),E=!0,x=null):d===g&&(E=!0,x=v.route.hydrateFallbackElement||null)));let S=t.concat(o.slice(0,g+1)),D=()=>{let U;return y?U=A:E?U=x:v.route.Component?U=ht.createElement(v.route.Component,null):v.route.element?U=v.route.element:U=_,ht.createElement(UE,{match:v,routeContext:{outlet:_,matches:S,isDataRoute:a!=null},children:U})};return a&&(v.route.ErrorBoundary||v.route.errorElement||g===0)?ht.createElement(zy,{location:a.location,revalidation:a.revalidation,component:A,error:y,children:D(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:p}):D()},null)}function Cm(r){return`${r} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function OE(r){let t=ht.useContext(wo);return Tn(t,Cm(r)),t}function PE(r){let t=ht.useContext(xf);return Tn(t,Cm(r)),t}function BE(r){let t=ht.useContext(Wa);return Tn(t,Cm(r)),t}function Dm(r){let t=BE(r),n=t.matches[t.matches.length-1];return Tn(n.route.id,`${r} can only be used on routes that contain a unique "id"`),n.route.id}function IE(){return Dm("useRouteId")}function zE(){let r=ht.useContext(wm),t=PE("useRouteError"),n=Dm("useRouteError");return r!==void 0?r:t.errors?.[n]}function FE(){let{router:r}=OE("useNavigate"),t=Dm("useNavigate"),n=ht.useRef(!1);return Iy(()=>{n.current=!0}),ht.useCallback(async(o,c={})=>{la(n.current,By),n.current&&(typeof o=="number"?await r.navigate(o):await r.navigate(o,{fromRouteId:t,...c}))},[r,t])}var tx={};function Fy(r,t,n){!t&&!tx[r]&&(tx[r]=!0,la(!1,n))}ht.memo(HE);function HE({routes:r,manifest:t,future:n,state:a,isStatic:o,onError:c}){return wE(r,void 0,{manifest:t,state:a,isStatic:o,onError:c})}function GE({basename:r="/",children:t=null,location:n,navigationType:a="POP",navigator:o,static:c=!1,useTransitions:u}){Tn(!Kl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=r.replace(/^\/*/,"/"),m=ht.useMemo(()=>({basename:d,navigator:o,static:c,useTransitions:u,future:{}}),[d,o,c,u]);typeof n=="string"&&(n=Zl(n));let{pathname:p="/",search:_="",hash:v="",state:g=null,key:y="default",mask:E}=n,A=ht.useMemo(()=>{let x=Va(p,d);return x==null?null:{location:{pathname:x,search:_,hash:v,state:g,key:y,mask:E},navigationType:a}},[d,p,_,v,g,y,a,E]);return la(A!=null,`<Router basename="${d}"> is not able to match the URL "${p}${_}${v}" because it does not start with the basename, so the <Router> won't render anything.`),A==null?null:ht.createElement(Oi.Provider,{value:m},ht.createElement(yf.Provider,{children:t,value:A}))}var Yu="get",Zu="application/x-www-form-urlencoded";function Sf(r){return typeof HTMLElement<"u"&&r instanceof HTMLElement}function VE(r){return Sf(r)&&r.tagName.toLowerCase()==="button"}function kE(r){return Sf(r)&&r.tagName.toLowerCase()==="form"}function WE(r){return Sf(r)&&r.tagName.toLowerCase()==="input"}function XE(r){return!!(r.metaKey||r.altKey||r.ctrlKey||r.shiftKey)}function qE(r,t){return r.button===0&&(!t||t==="_self")&&!XE(r)}var uu=null;function YE(){if(uu===null)try{new FormData(document.createElement("form"),0),uu=!1}catch{uu=!0}return uu}var ZE=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Fd(r){return r!=null&&!ZE.has(r)?(la(!1,`"${r}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Zu}"`),null):r}function KE(r,t){let n,a,o,c,u;if(kE(r)){let d=r.getAttribute("action");a=d?Va(d,t):null,n=r.getAttribute("method")||Yu,o=Fd(r.getAttribute("enctype"))||Zu,c=new FormData(r)}else if(VE(r)||WE(r)&&(r.type==="submit"||r.type==="image")){let d=r.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=r.getAttribute("formaction")||d.getAttribute("action");if(a=m?Va(m,t):null,n=r.getAttribute("formmethod")||d.getAttribute("method")||Yu,o=Fd(r.getAttribute("formenctype"))||Fd(d.getAttribute("enctype"))||Zu,c=new FormData(d,r),!YE()){let{name:p,type:_,value:v}=r;if(_==="image"){let g=p?`${p}.`:"";c.append(`${g}x`,"0"),c.append(`${g}y`,"0")}else p&&c.append(p,v)}}else{if(Sf(r))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Yu,a=null,o=Zu,u=r}return c&&o==="text/plain"&&(u=c,c=void 0),{action:a,method:n.toLowerCase(),encType:o,formData:c,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Lm(r,t){if(r===!1||r===null||typeof r>"u")throw new Error(t)}function Hy(r,t,n,a){let o=typeof r=="string"?new URL(r,typeof window>"u"?"server://singlefetch/":window.location.origin):r;return n?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${a}`:o.pathname=`${o.pathname}.${a}`:o.pathname==="/"?o.pathname=`_root.${a}`:t&&Va(o.pathname,t)==="/"?o.pathname=`${rf(t)}/_root.${a}`:o.pathname=`${rf(o.pathname)}.${a}`,o}async function QE(r,t){if(r.id in t)return t[r.id];try{let n=await import(r.module);return t[r.id]=n,n}catch(n){return console.error(`Error loading route module \`${r.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function JE(r){return r==null?!1:r.href==null?r.rel==="preload"&&typeof r.imageSrcSet=="string"&&typeof r.imageSizes=="string":typeof r.rel=="string"&&typeof r.href=="string"}async function jE(r,t,n){let a=await Promise.all(r.map(async o=>{let c=t.routes[o.route.id];if(c){let u=await QE(c,n);return u.links?u.links():[]}return[]}));return nb(a.flat(1).filter(JE).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function ex(r,t,n,a,o,c){let u=(m,p)=>n[p]?m.route.id!==n[p].route.id:!0,d=(m,p)=>n[p].pathname!==m.pathname||n[p].route.path?.endsWith("*")&&n[p].params["*"]!==m.params["*"];return c==="assets"?t.filter((m,p)=>u(m,p)||d(m,p)):c==="data"?t.filter((m,p)=>{let _=a.routes[m.route.id];if(!_||!_.hasLoader)return!1;if(u(m,p)||d(m,p))return!0;if(m.route.shouldRevalidate){let v=m.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(r,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof v=="boolean")return v}return!0}):[]}function $E(r,t,{includeHydrateFallback:n}={}){return tb(r.map(a=>{let o=t.routes[a.route.id];if(!o)return[];let c=[o.module];return o.clientActionModule&&(c=c.concat(o.clientActionModule)),o.clientLoaderModule&&(c=c.concat(o.clientLoaderModule)),n&&o.hydrateFallbackModule&&(c=c.concat(o.hydrateFallbackModule)),o.imports&&(c=c.concat(o.imports)),c}).flat(1))}function tb(r){return[...new Set(r)]}function eb(r){let t={},n=Object.keys(r).sort();for(let a of n)t[a]=r[a];return t}function nb(r,t){let n=new Set;return new Set(t),r.reduce((a,o)=>{let c=JSON.stringify(eb(o));return n.has(c)||(n.add(c),a.push({key:c,link:o})),a},[])}function Um(){let r=ht.useContext(wo);return Lm(r,"You must render this element inside a <DataRouterContext.Provider> element"),r}function ib(){let r=ht.useContext(xf);return Lm(r,"You must render this element inside a <DataRouterStateContext.Provider> element"),r}var Nm=ht.createContext(void 0);Nm.displayName="FrameworkContext";function Mf(){let r=ht.useContext(Nm);return Lm(r,"You must render this element inside a <HydratedRouter> element"),r}function ab(r,t){let n=ht.useContext(Nm),[a,o]=ht.useState(!1),[c,u]=ht.useState(!1),{onFocus:d,onBlur:m,onMouseEnter:p,onMouseLeave:_,onTouchStart:v}=t,g=ht.useRef(null);ht.useEffect(()=>{if(r==="render"&&u(!0),r==="viewport"){let A=S=>{S.forEach(D=>{u(D.isIntersecting)})},x=new IntersectionObserver(A,{threshold:.5});return g.current&&x.observe(g.current),()=>{x.disconnect()}}},[r]),ht.useEffect(()=>{if(a){let A=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(A)}}},[a]);let y=()=>{o(!0)},E=()=>{o(!1),u(!1)};return n?r!=="intent"?[c,g,{}]:[c,g,{onFocus:El(d,y),onBlur:El(m,E),onMouseEnter:El(p,y),onMouseLeave:El(_,E),onTouchStart:El(v,y)}]:[!1,g,{}]}function El(r,t){return n=>{r&&r(n),n.defaultPrevented||t(n)}}function rb({page:r,...t}){let n=vE(),{nonce:a}=Mf(),{router:o}=Um(),c=ht.useMemo(()=>Ey(o.routes,r,o.basename),[o.routes,r,o.basename]);return c?(t.nonce==null&&a&&(t={...t,nonce:a}),n?ht.createElement(ob,{page:r,matches:c,...t}):ht.createElement(lb,{page:r,matches:c,...t})):null}function sb(r){let{manifest:t,routeModules:n}=Mf(),[a,o]=ht.useState([]);return ht.useEffect(()=>{let c=!1;return jE(r,t,n).then(u=>{c||o(u)}),()=>{c=!0}},[r,t,n]),a}function ob({page:r,matches:t,...n}){let a=Xa(),{future:o}=Mf(),{basename:c}=Um(),u=ht.useMemo(()=>{if(r===a.pathname+a.search+a.hash)return[];let d=Hy(r,c,o.v8_trailingSlashAwareDataRequests,"rsc"),m=!1,p=[];for(let _ of t)typeof _.route.shouldRevalidate=="function"?m=!0:p.push(_.route.id);return m&&p.length>0&&d.searchParams.set("_routes",p.join(",")),[d.pathname+d.search]},[c,o.v8_trailingSlashAwareDataRequests,r,a,t]);return ht.createElement(ht.Fragment,null,u.map(d=>ht.createElement("link",{key:d,rel:"prefetch",as:"fetch",href:d,...n})))}function lb({page:r,matches:t,...n}){let a=Xa(),{future:o,manifest:c,routeModules:u}=Mf(),{basename:d}=Um(),{loaderData:m,matches:p}=ib(),_=ht.useMemo(()=>ex(r,t,p,c,a,"data"),[r,t,p,c,a]),v=ht.useMemo(()=>ex(r,t,p,c,a,"assets"),[r,t,p,c,a]),g=ht.useMemo(()=>{if(r===a.pathname+a.search+a.hash)return[];let A=new Set,x=!1;if(t.forEach(D=>{let U=c.routes[D.route.id];!U||!U.hasLoader||(!_.some(w=>w.route.id===D.route.id)&&D.route.id in m&&u[D.route.id]?.shouldRevalidate||U.hasClientLoader?x=!0:A.add(D.route.id))}),A.size===0)return[];let S=Hy(r,d,o.v8_trailingSlashAwareDataRequests,"data");return x&&A.size>0&&S.searchParams.set("_routes",t.filter(D=>A.has(D.route.id)).map(D=>D.route.id).join(",")),[S.pathname+S.search]},[d,o.v8_trailingSlashAwareDataRequests,m,a,c,_,t,r,u]),y=ht.useMemo(()=>$E(v,c),[v,c]),E=sb(v);return ht.createElement(ht.Fragment,null,g.map(A=>ht.createElement("link",{key:A,rel:"prefetch",as:"fetch",href:A,...n})),y.map(A=>ht.createElement("link",{key:A,rel:"modulepreload",href:A,...n})),E.map(({key:A,link:x})=>ht.createElement("link",{key:A,nonce:n.nonce,...x,crossOrigin:x.crossOrigin??n.crossOrigin})))}function cb(...r){return t=>{r.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var ub=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{ub&&(window.__reactRouterVersion="7.18.2")}catch{}function fb({basename:r,children:t,useTransitions:n,window:a}){let o=ht.useRef();o.current==null&&(o.current=W1({window:a,v5Compat:!0}));let c=o.current,[u,d]=ht.useState({action:c.action,location:c.location}),m=ht.useCallback(p=>{n===!1?d(p):ht.startTransition(()=>d(p))},[n]);return ht.useLayoutEffect(()=>c.listen(m),[c,m]),ht.createElement(GE,{basename:r,children:t,location:u.location,navigationType:u.action,navigator:c,useTransitions:n})}var Gy=ht.forwardRef(function({onClick:t,discover:n="render",prefetch:a="none",relative:o,reloadDocument:c,replace:u,mask:d,state:m,target:p,to:_,preventScrollReset:v,viewTransition:g,defaultShouldRevalidate:y,...E},A){let{basename:x,navigator:S,useTransitions:D}=ht.useContext(Oi),U=typeof _=="string"&&Am.test(_),w=Ly(_,x);_=w.to;let B=TE(_,{relative:o}),N=Xa(),P=null;if(d){let Z=Rm(d,[],N.mask?N.mask.pathname:"/",!0);x!=="/"&&(Z.pathname=Z.pathname==="/"?x:qi([x,Z.pathname])),P=S.createHref(Z)}let[T,O,W]=ab(a,E),k=mb(_,{replace:u,mask:d,state:m,target:p,preventScrollReset:v,relative:o,viewTransition:g,defaultShouldRevalidate:y,useTransitions:D});function Q(Z){t&&t(Z),Z.defaultPrevented||k(Z)}let dt=!(w.isExternal||c),vt=ht.createElement("a",{...E,...W,href:(dt?P:void 0)||w.absoluteURL||B,onClick:dt?Q:t,ref:cb(A,O),target:p,"data-discover":!U&&n==="render"?"true":void 0});return T&&!U?ht.createElement(ht.Fragment,null,vt,ht.createElement(rb,{page:B})):vt});Gy.displayName="Link";var hb=ht.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:a="",end:o=!1,style:c,to:u,viewTransition:d,children:m,...p},_){let v=Ql(u,{relative:p.relative}),g=Xa(),y=ht.useContext(xf),{navigator:E,basename:A}=ht.useContext(Oi),x=y!=null&&yb(v)&&d===!0,S=E.encodeLocation?E.encodeLocation(v).pathname:v.pathname,D=g.pathname,U=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;n||(D=D.toLowerCase(),U=U?U.toLowerCase():null,S=S.toLowerCase()),U&&A&&(U=Va(U,A)||U);const w=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let B=D===S||!o&&D.startsWith(S)&&D.charAt(w)==="/",N=U!=null&&(U===S||!o&&U.startsWith(S)&&U.charAt(S.length)==="/"),P={isActive:B,isPending:N,isTransitioning:x},T=B?t:void 0,O;typeof a=="function"?O=a(P):O=[a,B?"active":null,N?"pending":null,x?"transitioning":null].filter(Boolean).join(" ");let W=typeof c=="function"?c(P):c;return ht.createElement(Gy,{...p,"aria-current":T,className:O,ref:_,style:W,to:u,viewTransition:d},typeof m=="function"?m(P):m)});hb.displayName="NavLink";var db=ht.forwardRef(({discover:r="render",fetcherKey:t,navigate:n,reloadDocument:a,replace:o,state:c,method:u=Yu,action:d,onSubmit:m,relative:p,preventScrollReset:_,viewTransition:v,defaultShouldRevalidate:g,...y},E)=>{let{useTransitions:A}=ht.useContext(Oi),x=vb(),S=xb(d,{relative:p}),D=u.toLowerCase()==="get"?"get":"post",U=typeof d=="string"&&Am.test(d),w=B=>{if(m&&m(B),B.defaultPrevented)return;B.preventDefault();let N=B.nativeEvent.submitter,P=N?.getAttribute("formmethod")||u,T=()=>x(N||B.currentTarget,{fetcherKey:t,method:P,navigate:n,replace:o,state:c,relative:p,preventScrollReset:_,viewTransition:v,defaultShouldRevalidate:g});A&&n!==!1?ht.startTransition(()=>T()):T()};return ht.createElement("form",{ref:E,method:D,action:S,onSubmit:a?m:w,...y,"data-discover":!U&&r==="render"?"true":void 0})});db.displayName="Form";function pb(r){return`${r} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Vy(r){let t=ht.useContext(wo);return Tn(t,pb(r)),t}function mb(r,{target:t,replace:n,mask:a,state:o,preventScrollReset:c,relative:u,viewTransition:d,defaultShouldRevalidate:m,useTransitions:p}={}){let _=AE(),v=Xa(),g=Ql(r,{relative:u});return ht.useCallback(y=>{if(qE(y,t)){y.preventDefault();let E=n!==void 0?n:Vl(v)===Vl(g),A=()=>_(r,{replace:E,mask:a,state:o,preventScrollReset:c,relative:u,viewTransition:d,defaultShouldRevalidate:m});p?ht.startTransition(()=>A()):A()}},[v,_,g,n,a,o,t,r,c,u,d,m,p])}var gb=0,_b=()=>`__${String(++gb)}__`;function vb(){let{router:r}=Vy("useSubmit"),{basename:t}=ht.useContext(Oi),n=IE(),a=r.fetch,o=r.navigate;return ht.useCallback(async(c,u={})=>{let{action:d,method:m,encType:p,formData:_,body:v}=KE(c,t);if(u.navigate===!1){let g=u.fetcherKey||_b();await a(g,n,u.action||d,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:_,body:v,formMethod:u.method||m,formEncType:u.encType||p,flushSync:u.flushSync})}else await o(u.action||d,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:_,body:v,formMethod:u.method||m,formEncType:u.encType||p,replace:u.replace,state:u.state,fromRouteId:n,flushSync:u.flushSync,viewTransition:u.viewTransition})},[a,o,t,n])}function xb(r,{relative:t}={}){let{basename:n}=ht.useContext(Oi),a=ht.useContext(Wa);Tn(a,"useFormAction must be used inside a RouteContext");let[o]=a.matches.slice(-1),c={...Ql(r||".",{relative:t})},u=Xa();if(r==null){c.search=u.search;let d=new URLSearchParams(c.search),m=d.getAll("index");if(m.some(_=>_==="")){d.delete("index"),m.filter(v=>v).forEach(v=>d.append("index",v));let _=d.toString();c.search=_?`?${_}`:""}}return(!r||r===".")&&o.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(c.pathname=c.pathname==="/"?n:qi([n,c.pathname])),Vl(c)}function yb(r,{relative:t}={}){let n=ht.useContext(Oy);Tn(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=Vy("useViewTransitionState"),o=Ql(r,{relative:t});if(!n.isTransitioning)return!1;let c=Va(n.currentLocation.pathname,a)||n.currentLocation.pathname,u=Va(n.nextLocation.pathname,a)||n.nextLocation.pathname;return af(o.pathname,u)!=null||af(o.pathname,c)!=null}const Om="185",Sb=0,nx=1,Mb=2,Ku=1,Eb=2,zl=3,Dr=0,ii=1,aa=2,sa=0,xo=1,Ar=2,ix=3,ax=4,bb=5,ls=100,Tb=101,Ab=102,Rb=103,wb=104,Cb=200,Db=201,Lb=202,Ub=203,Rp=204,wp=205,Nb=206,Ob=207,Pb=208,Bb=209,Ib=210,zb=211,Fb=212,Hb=213,Gb=214,Cp=0,Dp=1,Lp=2,Eo=3,Up=4,Np=5,Op=6,Pp=7,ky=0,Vb=1,kb=2,oa=0,Wy=1,Xy=2,qy=3,Pm=4,Yy=5,Zy=6,Ky=7,Qy=300,ps=301,bo=302,Hd=303,Gd=304,Ef=306,Bp=1e3,za=1001,Ip=1002,Bn=1003,Wb=1004,fu=1005,Gn=1006,Vd=1007,fs=1008,yi=1009,Jy=1010,jy=1011,kl=1012,Bm=1013,ca=1014,Wi=1015,Mi=1016,Im=1017,zm=1018,Wl=1020,$y=35902,tS=35899,eS=1021,nS=1022,Xi=1023,ka=1026,hs=1027,Fm=1028,Hm=1029,ms=1030,Gm=1031,Vm=1033,Qu=33776,Ju=33777,ju=33778,$u=33779,zp=35840,Fp=35841,Hp=35842,Gp=35843,Vp=36196,kp=37492,Wp=37496,Xp=37488,qp=37489,sf=37490,Yp=37491,Zp=37808,Kp=37809,Qp=37810,Jp=37811,jp=37812,$p=37813,tm=37814,em=37815,nm=37816,im=37817,am=37818,rm=37819,sm=37820,om=37821,lm=36492,cm=36494,um=36495,fm=36283,hm=36284,of=36285,dm=36286,Xb=3200,pm=0,qb=1,Rr="",Ui="srgb",lf="srgb-linear",cf="linear",Ye="srgb",Js=7680,rx=519,Yb=512,Zb=513,Kb=514,km=515,Qb=516,Jb=517,Wm=518,jb=519,mm=35044,sx="300 es",ra=2e3,Xl=2001;function $b(r){for(let t=r.length-1;t>=0;--t)if(r[t]>=65535)return!0;return!1}function uf(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function tT(){const r=uf("canvas");return r.style.display="block",r}const ox={};function ff(...r){const t="THREE."+r.shift();console.log(t,...r)}function iS(r){const t=r[0];if(typeof t=="string"&&t.startsWith("TSL:")){const n=r[1];n&&n.isStackTrace?r[0]+=" "+n.getLocation():r[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return r}function me(...r){r=iS(r);const t="THREE."+r.shift();{const n=r[0];n&&n.isStackTrace?console.warn(n.getError(t)):console.warn(t,...r)}}function Oe(...r){r=iS(r);const t="THREE."+r.shift();{const n=r[0];n&&n.isStackTrace?console.error(n.getError(t)):console.error(t,...r)}}function yo(...r){const t=r.join(" ");t in ox||(ox[t]=!0,me(...r))}function eT(r,t,n){return new Promise(function(a,o){function c(){switch(r.clientWaitSync(t,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:o();break;case r.TIMEOUT_EXPIRED:setTimeout(c,n);break;default:a()}}setTimeout(c,n)})}const nT={[Cp]:Dp,[Lp]:Op,[Up]:Pp,[Eo]:Np,[Dp]:Cp,[Op]:Lp,[Pp]:Up,[Np]:Eo};class gs{addEventListener(t,n){this._listeners===void 0&&(this._listeners={});const a=this._listeners;a[t]===void 0&&(a[t]=[]),a[t].indexOf(n)===-1&&a[t].push(n)}hasEventListener(t,n){const a=this._listeners;return a===void 0?!1:a[t]!==void 0&&a[t].indexOf(n)!==-1}removeEventListener(t,n){const a=this._listeners;if(a===void 0)return;const o=a[t];if(o!==void 0){const c=o.indexOf(n);c!==-1&&o.splice(c,1)}}dispatchEvent(t){const n=this._listeners;if(n===void 0)return;const a=n[t.type];if(a!==void 0){t.target=this;const o=a.slice(0);for(let c=0,u=o.length;c<u;c++)o[c].call(this,t);t.target=null}}}const Fn=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let lx=1234567;const So=Math.PI/180,ql=180/Math.PI;function Fa(){const r=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,a=Math.random()*4294967295|0;return(Fn[r&255]+Fn[r>>8&255]+Fn[r>>16&255]+Fn[r>>24&255]+"-"+Fn[t&255]+Fn[t>>8&255]+"-"+Fn[t>>16&15|64]+Fn[t>>24&255]+"-"+Fn[n&63|128]+Fn[n>>8&255]+"-"+Fn[n>>16&255]+Fn[n>>24&255]+Fn[a&255]+Fn[a>>8&255]+Fn[a>>16&255]+Fn[a>>24&255]).toLowerCase()}function Ae(r,t,n){return Math.max(t,Math.min(n,r))}function Xm(r,t){return(r%t+t)%t}function iT(r,t,n,a,o){return a+(r-t)*(o-a)/(n-t)}function aT(r,t,n){return r!==t?(n-r)/(t-r):0}function Hl(r,t,n){return(1-n)*r+n*t}function rT(r,t,n,a){return Hl(r,t,1-Math.exp(-n*a))}function sT(r,t=1){return t-Math.abs(Xm(r,t*2)-t)}function oT(r,t,n){return r<=t?0:r>=n?1:(r=(r-t)/(n-t),r*r*(3-2*r))}function lT(r,t,n){return r<=t?0:r>=n?1:(r=(r-t)/(n-t),r*r*r*(r*(r*6-15)+10))}function cT(r,t){return r+Math.floor(Math.random()*(t-r+1))}function uT(r,t){return r+Math.random()*(t-r)}function fT(r){return r*(.5-Math.random())}function hT(r){r!==void 0&&(lx=r);let t=lx+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function dT(r){return r*So}function pT(r){return r*ql}function mT(r){return(r&r-1)===0&&r!==0}function gT(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function _T(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function vT(r,t,n,a,o){const c=Math.cos,u=Math.sin,d=c(n/2),m=u(n/2),p=c((t+a)/2),_=u((t+a)/2),v=c((t-a)/2),g=u((t-a)/2),y=c((a-t)/2),E=u((a-t)/2);switch(o){case"XYX":r.set(d*_,m*v,m*g,d*p);break;case"YZY":r.set(m*g,d*_,m*v,d*p);break;case"ZXZ":r.set(m*v,m*g,d*_,d*p);break;case"XZX":r.set(d*_,m*E,m*y,d*p);break;case"YXY":r.set(m*y,d*_,m*E,d*p);break;case"ZYZ":r.set(m*E,m*y,d*_,d*p);break;default:me("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+o)}}function ki(r,t){switch(t.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function Ze(r,t){switch(t.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}const cx={DEG2RAD:So,RAD2DEG:ql,generateUUID:Fa,clamp:Ae,euclideanModulo:Xm,mapLinear:iT,inverseLerp:aT,lerp:Hl,damp:rT,pingpong:sT,smoothstep:oT,smootherstep:lT,randInt:cT,randFloat:uT,randFloatSpread:fT,seededRandom:hT,degToRad:dT,radToDeg:pT,isPowerOfTwo:mT,ceilPowerOfTwo:gT,floorPowerOfTwo:_T,setQuaternionFromProperEuler:vT,normalize:Ze,denormalize:ki},n0=class n0{constructor(t=0,n=0){this.x=t,this.y=n}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,n){return this.x=t,this.y=n,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,n){switch(t){case 0:this.x=n;break;case 1:this.y=n;break;default:throw new Error("THREE.Vector2: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,n){return this.x=t.x+n.x,this.y=t.y+n.y,this}addScaledVector(t,n){return this.x+=t.x*n,this.y+=t.y*n,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,n){return this.x=t.x-n.x,this.y=t.y-n.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const n=this.x,a=this.y,o=t.elements;return this.x=o[0]*n+o[3]*a+o[6],this.y=o[1]*n+o[4]*a+o[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,n){return this.x=Ae(this.x,t.x,n.x),this.y=Ae(this.y,t.y,n.y),this}clampScalar(t,n){return this.x=Ae(this.x,t,n),this.y=Ae(this.y,t,n),this}clampLength(t,n){const a=this.length();return this.divideScalar(a||1).multiplyScalar(Ae(a,t,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const n=Math.sqrt(this.lengthSq()*t.lengthSq());if(n===0)return Math.PI/2;const a=this.dot(t)/n;return Math.acos(Ae(a,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const n=this.x-t.x,a=this.y-t.y;return n*n+a*a}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,n){return this.x+=(t.x-this.x)*n,this.y+=(t.y-this.y)*n,this}lerpVectors(t,n,a){return this.x=t.x+(n.x-t.x)*a,this.y=t.y+(n.y-t.y)*a,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,n=0){return this.x=t[n],this.y=t[n+1],this}toArray(t=[],n=0){return t[n]=this.x,t[n+1]=this.y,t}fromBufferAttribute(t,n){return this.x=t.getX(n),this.y=t.getY(n),this}rotateAround(t,n){const a=Math.cos(n),o=Math.sin(n),c=this.x-t.x,u=this.y-t.y;return this.x=c*a-u*o+t.x,this.y=c*o+u*a+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};n0.prototype.isVector2=!0;let fe=n0;class vi{constructor(t=0,n=0,a=0,o=1){this.isQuaternion=!0,this._x=t,this._y=n,this._z=a,this._w=o}static slerpFlat(t,n,a,o,c,u,d){let m=a[o+0],p=a[o+1],_=a[o+2],v=a[o+3],g=c[u+0],y=c[u+1],E=c[u+2],A=c[u+3];if(v!==A||m!==g||p!==y||_!==E){let x=m*g+p*y+_*E+v*A;x<0&&(g=-g,y=-y,E=-E,A=-A,x=-x);let S=1-d;if(x<.9995){const D=Math.acos(x),U=Math.sin(D);S=Math.sin(S*D)/U,d=Math.sin(d*D)/U,m=m*S+g*d,p=p*S+y*d,_=_*S+E*d,v=v*S+A*d}else{m=m*S+g*d,p=p*S+y*d,_=_*S+E*d,v=v*S+A*d;const D=1/Math.sqrt(m*m+p*p+_*_+v*v);m*=D,p*=D,_*=D,v*=D}}t[n]=m,t[n+1]=p,t[n+2]=_,t[n+3]=v}static multiplyQuaternionsFlat(t,n,a,o,c,u){const d=a[o],m=a[o+1],p=a[o+2],_=a[o+3],v=c[u],g=c[u+1],y=c[u+2],E=c[u+3];return t[n]=d*E+_*v+m*y-p*g,t[n+1]=m*E+_*g+p*v-d*y,t[n+2]=p*E+_*y+d*g-m*v,t[n+3]=_*E-d*v-m*g-p*y,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,n,a,o){return this._x=t,this._y=n,this._z=a,this._w=o,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,n=!0){const a=t._x,o=t._y,c=t._z,u=t._order,d=Math.cos,m=Math.sin,p=d(a/2),_=d(o/2),v=d(c/2),g=m(a/2),y=m(o/2),E=m(c/2);switch(u){case"XYZ":this._x=g*_*v+p*y*E,this._y=p*y*v-g*_*E,this._z=p*_*E+g*y*v,this._w=p*_*v-g*y*E;break;case"YXZ":this._x=g*_*v+p*y*E,this._y=p*y*v-g*_*E,this._z=p*_*E-g*y*v,this._w=p*_*v+g*y*E;break;case"ZXY":this._x=g*_*v-p*y*E,this._y=p*y*v+g*_*E,this._z=p*_*E+g*y*v,this._w=p*_*v-g*y*E;break;case"ZYX":this._x=g*_*v-p*y*E,this._y=p*y*v+g*_*E,this._z=p*_*E-g*y*v,this._w=p*_*v+g*y*E;break;case"YZX":this._x=g*_*v+p*y*E,this._y=p*y*v+g*_*E,this._z=p*_*E-g*y*v,this._w=p*_*v-g*y*E;break;case"XZY":this._x=g*_*v-p*y*E,this._y=p*y*v-g*_*E,this._z=p*_*E+g*y*v,this._w=p*_*v+g*y*E;break;default:me("Quaternion: .setFromEuler() encountered an unknown order: "+u)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,n){const a=n/2,o=Math.sin(a);return this._x=t.x*o,this._y=t.y*o,this._z=t.z*o,this._w=Math.cos(a),this._onChangeCallback(),this}setFromRotationMatrix(t){const n=t.elements,a=n[0],o=n[4],c=n[8],u=n[1],d=n[5],m=n[9],p=n[2],_=n[6],v=n[10],g=a+d+v;if(g>0){const y=.5/Math.sqrt(g+1);this._w=.25/y,this._x=(_-m)*y,this._y=(c-p)*y,this._z=(u-o)*y}else if(a>d&&a>v){const y=2*Math.sqrt(1+a-d-v);this._w=(_-m)/y,this._x=.25*y,this._y=(o+u)/y,this._z=(c+p)/y}else if(d>v){const y=2*Math.sqrt(1+d-a-v);this._w=(c-p)/y,this._x=(o+u)/y,this._y=.25*y,this._z=(m+_)/y}else{const y=2*Math.sqrt(1+v-a-d);this._w=(u-o)/y,this._x=(c+p)/y,this._y=(m+_)/y,this._z=.25*y}return this._onChangeCallback(),this}setFromUnitVectors(t,n){let a=t.dot(n)+1;return a<1e-8?(a=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=a):(this._x=0,this._y=-t.z,this._z=t.y,this._w=a)):(this._x=t.y*n.z-t.z*n.y,this._y=t.z*n.x-t.x*n.z,this._z=t.x*n.y-t.y*n.x,this._w=a),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Ae(this.dot(t),-1,1)))}rotateTowards(t,n){const a=this.angleTo(t);if(a===0)return this;const o=Math.min(1,n/a);return this.slerp(t,o),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,n){const a=t._x,o=t._y,c=t._z,u=t._w,d=n._x,m=n._y,p=n._z,_=n._w;return this._x=a*_+u*d+o*p-c*m,this._y=o*_+u*m+c*d-a*p,this._z=c*_+u*p+a*m-o*d,this._w=u*_-a*d-o*m-c*p,this._onChangeCallback(),this}slerp(t,n){let a=t._x,o=t._y,c=t._z,u=t._w,d=this.dot(t);d<0&&(a=-a,o=-o,c=-c,u=-u,d=-d);let m=1-n;if(d<.9995){const p=Math.acos(d),_=Math.sin(p);m=Math.sin(m*p)/_,n=Math.sin(n*p)/_,this._x=this._x*m+a*n,this._y=this._y*m+o*n,this._z=this._z*m+c*n,this._w=this._w*m+u*n,this._onChangeCallback()}else this._x=this._x*m+a*n,this._y=this._y*m+o*n,this._z=this._z*m+c*n,this._w=this._w*m+u*n,this.normalize();return this}slerpQuaternions(t,n,a){return this.copy(t).slerp(n,a)}random(){const t=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),a=Math.random(),o=Math.sqrt(1-a),c=Math.sqrt(a);return this.set(o*Math.sin(t),o*Math.cos(t),c*Math.sin(n),c*Math.cos(n))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,n=0){return this._x=t[n],this._y=t[n+1],this._z=t[n+2],this._w=t[n+3],this._onChangeCallback(),this}toArray(t=[],n=0){return t[n]=this._x,t[n+1]=this._y,t[n+2]=this._z,t[n+3]=this._w,t}fromBufferAttribute(t,n){return this._x=t.getX(n),this._y=t.getY(n),this._z=t.getZ(n),this._w=t.getW(n),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const i0=class i0{constructor(t=0,n=0,a=0){this.x=t,this.y=n,this.z=a}set(t,n,a){return a===void 0&&(a=this.z),this.x=t,this.y=n,this.z=a,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,n){switch(t){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new Error("THREE.Vector3: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,n){return this.x=t.x+n.x,this.y=t.y+n.y,this.z=t.z+n.z,this}addScaledVector(t,n){return this.x+=t.x*n,this.y+=t.y*n,this.z+=t.z*n,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,n){return this.x=t.x-n.x,this.y=t.y-n.y,this.z=t.z-n.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,n){return this.x=t.x*n.x,this.y=t.y*n.y,this.z=t.z*n.z,this}applyEuler(t){return this.applyQuaternion(ux.setFromEuler(t))}applyAxisAngle(t,n){return this.applyQuaternion(ux.setFromAxisAngle(t,n))}applyMatrix3(t){const n=this.x,a=this.y,o=this.z,c=t.elements;return this.x=c[0]*n+c[3]*a+c[6]*o,this.y=c[1]*n+c[4]*a+c[7]*o,this.z=c[2]*n+c[5]*a+c[8]*o,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const n=this.x,a=this.y,o=this.z,c=t.elements,u=1/(c[3]*n+c[7]*a+c[11]*o+c[15]);return this.x=(c[0]*n+c[4]*a+c[8]*o+c[12])*u,this.y=(c[1]*n+c[5]*a+c[9]*o+c[13])*u,this.z=(c[2]*n+c[6]*a+c[10]*o+c[14])*u,this}applyQuaternion(t){const n=this.x,a=this.y,o=this.z,c=t.x,u=t.y,d=t.z,m=t.w,p=2*(u*o-d*a),_=2*(d*n-c*o),v=2*(c*a-u*n);return this.x=n+m*p+u*v-d*_,this.y=a+m*_+d*p-c*v,this.z=o+m*v+c*_-u*p,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const n=this.x,a=this.y,o=this.z,c=t.elements;return this.x=c[0]*n+c[4]*a+c[8]*o,this.y=c[1]*n+c[5]*a+c[9]*o,this.z=c[2]*n+c[6]*a+c[10]*o,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,n){return this.x=Ae(this.x,t.x,n.x),this.y=Ae(this.y,t.y,n.y),this.z=Ae(this.z,t.z,n.z),this}clampScalar(t,n){return this.x=Ae(this.x,t,n),this.y=Ae(this.y,t,n),this.z=Ae(this.z,t,n),this}clampLength(t,n){const a=this.length();return this.divideScalar(a||1).multiplyScalar(Ae(a,t,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,n){return this.x+=(t.x-this.x)*n,this.y+=(t.y-this.y)*n,this.z+=(t.z-this.z)*n,this}lerpVectors(t,n,a){return this.x=t.x+(n.x-t.x)*a,this.y=t.y+(n.y-t.y)*a,this.z=t.z+(n.z-t.z)*a,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,n){const a=t.x,o=t.y,c=t.z,u=n.x,d=n.y,m=n.z;return this.x=o*m-c*d,this.y=c*u-a*m,this.z=a*d-o*u,this}projectOnVector(t){const n=t.lengthSq();if(n===0)return this.set(0,0,0);const a=t.dot(this)/n;return this.copy(t).multiplyScalar(a)}projectOnPlane(t){return kd.copy(this).projectOnVector(t),this.sub(kd)}reflect(t){return this.sub(kd.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const n=Math.sqrt(this.lengthSq()*t.lengthSq());if(n===0)return Math.PI/2;const a=this.dot(t)/n;return Math.acos(Ae(a,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const n=this.x-t.x,a=this.y-t.y,o=this.z-t.z;return n*n+a*a+o*o}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,n,a){const o=Math.sin(n)*t;return this.x=o*Math.sin(a),this.y=Math.cos(n)*t,this.z=o*Math.cos(a),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,n,a){return this.x=t*Math.sin(n),this.y=a,this.z=t*Math.cos(n),this}setFromMatrixPosition(t){const n=t.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(t){const n=this.setFromMatrixColumn(t,0).length(),a=this.setFromMatrixColumn(t,1).length(),o=this.setFromMatrixColumn(t,2).length();return this.x=n,this.y=a,this.z=o,this}setFromMatrixColumn(t,n){return this.fromArray(t.elements,n*4)}setFromMatrix3Column(t,n){return this.fromArray(t.elements,n*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,n=0){return this.x=t[n],this.y=t[n+1],this.z=t[n+2],this}toArray(t=[],n=0){return t[n]=this.x,t[n+1]=this.y,t[n+2]=this.z,t}fromBufferAttribute(t,n){return this.x=t.getX(n),this.y=t.getY(n),this.z=t.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,n=Math.random()*2-1,a=Math.sqrt(1-n*n);return this.x=a*Math.cos(t),this.y=n,this.z=a*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};i0.prototype.isVector3=!0;let z=i0;const kd=new z,ux=new vi,a0=class a0{constructor(t,n,a,o,c,u,d,m,p){this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,n,a,o,c,u,d,m,p)}set(t,n,a,o,c,u,d,m,p){const _=this.elements;return _[0]=t,_[1]=o,_[2]=d,_[3]=n,_[4]=c,_[5]=m,_[6]=a,_[7]=u,_[8]=p,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const n=this.elements,a=t.elements;return n[0]=a[0],n[1]=a[1],n[2]=a[2],n[3]=a[3],n[4]=a[4],n[5]=a[5],n[6]=a[6],n[7]=a[7],n[8]=a[8],this}extractBasis(t,n,a){return t.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),a.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const n=t.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,n){const a=t.elements,o=n.elements,c=this.elements,u=a[0],d=a[3],m=a[6],p=a[1],_=a[4],v=a[7],g=a[2],y=a[5],E=a[8],A=o[0],x=o[3],S=o[6],D=o[1],U=o[4],w=o[7],B=o[2],N=o[5],P=o[8];return c[0]=u*A+d*D+m*B,c[3]=u*x+d*U+m*N,c[6]=u*S+d*w+m*P,c[1]=p*A+_*D+v*B,c[4]=p*x+_*U+v*N,c[7]=p*S+_*w+v*P,c[2]=g*A+y*D+E*B,c[5]=g*x+y*U+E*N,c[8]=g*S+y*w+E*P,this}multiplyScalar(t){const n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=t,n[4]*=t,n[7]*=t,n[2]*=t,n[5]*=t,n[8]*=t,this}determinant(){const t=this.elements,n=t[0],a=t[1],o=t[2],c=t[3],u=t[4],d=t[5],m=t[6],p=t[7],_=t[8];return n*u*_-n*d*p-a*c*_+a*d*m+o*c*p-o*u*m}invert(){const t=this.elements,n=t[0],a=t[1],o=t[2],c=t[3],u=t[4],d=t[5],m=t[6],p=t[7],_=t[8],v=_*u-d*p,g=d*m-_*c,y=p*c-u*m,E=n*v+a*g+o*y;if(E===0)return this.set(0,0,0,0,0,0,0,0,0);const A=1/E;return t[0]=v*A,t[1]=(o*p-_*a)*A,t[2]=(d*a-o*u)*A,t[3]=g*A,t[4]=(_*n-o*m)*A,t[5]=(o*c-d*n)*A,t[6]=y*A,t[7]=(a*m-p*n)*A,t[8]=(u*n-a*c)*A,this}transpose(){let t;const n=this.elements;return t=n[1],n[1]=n[3],n[3]=t,t=n[2],n[2]=n[6],n[6]=t,t=n[5],n[5]=n[7],n[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const n=this.elements;return t[0]=n[0],t[1]=n[3],t[2]=n[6],t[3]=n[1],t[4]=n[4],t[5]=n[7],t[6]=n[2],t[7]=n[5],t[8]=n[8],this}setUvTransform(t,n,a,o,c,u,d){const m=Math.cos(c),p=Math.sin(c);return this.set(a*m,a*p,-a*(m*u+p*d)+u+t,-o*p,o*m,-o*(-p*u+m*d)+d+n,0,0,1),this}scale(t,n){return yo("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(Wd.makeScale(t,n)),this}rotate(t){return yo("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(Wd.makeRotation(-t)),this}translate(t,n){return yo("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(Wd.makeTranslation(t,n)),this}makeTranslation(t,n){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,n,0,0,1),this}makeRotation(t){const n=Math.cos(t),a=Math.sin(t);return this.set(n,-a,0,a,n,0,0,0,1),this}makeScale(t,n){return this.set(t,0,0,0,n,0,0,0,1),this}equals(t){const n=this.elements,a=t.elements;for(let o=0;o<9;o++)if(n[o]!==a[o])return!1;return!0}fromArray(t,n=0){for(let a=0;a<9;a++)this.elements[a]=t[a+n];return this}toArray(t=[],n=0){const a=this.elements;return t[n]=a[0],t[n+1]=a[1],t[n+2]=a[2],t[n+3]=a[3],t[n+4]=a[4],t[n+5]=a[5],t[n+6]=a[6],t[n+7]=a[7],t[n+8]=a[8],t}clone(){return new this.constructor().fromArray(this.elements)}};a0.prototype.isMatrix3=!0;let Se=a0;const Wd=new Se,fx=new Se().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),hx=new Se().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function xT(){const r={enabled:!0,workingColorSpace:lf,spaces:{},convert:function(o,c,u){return this.enabled===!1||c===u||!c||!u||(this.spaces[c].transfer===Ye&&(o.r=Ha(o.r),o.g=Ha(o.g),o.b=Ha(o.b)),this.spaces[c].primaries!==this.spaces[u].primaries&&(o.applyMatrix3(this.spaces[c].toXYZ),o.applyMatrix3(this.spaces[u].fromXYZ)),this.spaces[u].transfer===Ye&&(o.r=Mo(o.r),o.g=Mo(o.g),o.b=Mo(o.b))),o},workingToColorSpace:function(o,c){return this.convert(o,this.workingColorSpace,c)},colorSpaceToWorking:function(o,c){return this.convert(o,c,this.workingColorSpace)},getPrimaries:function(o){return this.spaces[o].primaries},getTransfer:function(o){return o===Rr?cf:this.spaces[o].transfer},getToneMappingMode:function(o){return this.spaces[o].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(o,c=this.workingColorSpace){return o.fromArray(this.spaces[c].luminanceCoefficients)},define:function(o){Object.assign(this.spaces,o)},_getMatrix:function(o,c,u){return o.copy(this.spaces[c].toXYZ).multiply(this.spaces[u].fromXYZ)},_getDrawingBufferColorSpace:function(o){return this.spaces[o].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(o=this.workingColorSpace){return this.spaces[o].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(o,c){return yo("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(o,c)},toWorkingColorSpace:function(o,c){return yo("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(o,c)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],a=[.3127,.329];return r.define({[lf]:{primaries:t,whitePoint:a,transfer:cf,toXYZ:fx,fromXYZ:hx,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:Ui},outputColorSpaceConfig:{drawingBufferColorSpace:Ui}},[Ui]:{primaries:t,whitePoint:a,transfer:Ye,toXYZ:fx,fromXYZ:hx,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:Ui}}}),r}const Ne=xT();function Ha(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Mo(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let js;class yT{static getDataURL(t,n="image/png"){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let a;if(t instanceof HTMLCanvasElement)a=t;else{js===void 0&&(js=uf("canvas")),js.width=t.width,js.height=t.height;const o=js.getContext("2d");t instanceof ImageData?o.putImageData(t,0,0):o.drawImage(t,0,0,t.width,t.height),a=js}return a.toDataURL(n)}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){const n=uf("canvas");n.width=t.width,n.height=t.height;const a=n.getContext("2d");a.drawImage(t,0,0,t.width,t.height);const o=a.getImageData(0,0,t.width,t.height),c=o.data;for(let u=0;u<c.length;u++)c[u]=Ha(c[u]/255)*255;return a.putImageData(o,0,0),n}else if(t.data){const n=t.data.slice(0);for(let a=0;a<n.length;a++)n instanceof Uint8Array||n instanceof Uint8ClampedArray?n[a]=Math.floor(Ha(n[a]/255)*255):n[a]=Ha(n[a]);return{data:n,width:t.width,height:t.height}}else return me("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}let ST=0;class qm{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:ST++}),this.uuid=Fa(),this.data=t,this.dataReady=!0,this.version=0}getSize(t){const n=this.data;return typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement?t.set(n.videoWidth,n.videoHeight,0):typeof VideoFrame<"u"&&n instanceof VideoFrame?t.set(n.displayWidth,n.displayHeight,0):n!==null?t.set(n.width,n.height,n.depth||0):t.set(0,0,0),t}set needsUpdate(t){t===!0&&this.version++}toJSON(t){const n=t===void 0||typeof t=="string";if(!n&&t.images[this.uuid]!==void 0)return t.images[this.uuid];const a={uuid:this.uuid,url:""},o=this.data;if(o!==null){let c;if(Array.isArray(o)){c=[];for(let u=0,d=o.length;u<d;u++)o[u].isDataTexture?c.push(Xd(o[u].image)):c.push(Xd(o[u]))}else c=Xd(o);a.url=c}return n||(t.images[this.uuid]=a),a}}function Xd(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?yT.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(me("Texture: Unable to serialize Texture."),{})}let MT=0;const qd=new z;class Xn extends gs{constructor(t=Xn.DEFAULT_IMAGE,n=Xn.DEFAULT_MAPPING,a=za,o=za,c=Gn,u=fs,d=Xi,m=yi,p=Xn.DEFAULT_ANISOTROPY,_=Rr){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:MT++}),this.uuid=Fa(),this.name="",this.source=new qm(t),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=a,this.wrapT=o,this.magFilter=c,this.minFilter=u,this.anisotropy=p,this.format=d,this.internalFormat=null,this.type=m,this.offset=new fe(0,0),this.repeat=new fe(1,1),this.center=new fe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Se,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=_,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(qd).x}get height(){return this.source.getSize(qd).y}get depth(){return this.source.getSize(qd).z}get image(){return this.source.data}set image(t){this.source.data=t}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(t,n){this.updateRanges.push({start:t,count:n})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.normalized=t.normalized,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(const n in t){const a=t[n];if(a===void 0){me(`Texture.setValues(): parameter '${n}' has value of undefined.`);continue}const o=this[n];if(o===void 0){me(`Texture.setValues(): property '${n}' does not exist.`);continue}o&&a&&o.isVector2&&a.isVector2||o&&a&&o.isVector3&&a.isVector3||o&&a&&o.isMatrix3&&a.isMatrix3?o.copy(a):this[n]=a}}toJSON(t){const n=t===void 0||typeof t=="string";if(!n&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];const a={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).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,normalized:this.normalized,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&&(a.userData=this.userData),n||(t.textures[this.uuid]=a),a}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==Qy)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Bp:t.x=t.x-Math.floor(t.x);break;case za:t.x=t.x<0?0:1;break;case Ip:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case Bp:t.y=t.y-Math.floor(t.y);break;case za:t.y=t.y<0?0:1;break;case Ip:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}}Xn.DEFAULT_IMAGE=null;Xn.DEFAULT_MAPPING=Qy;Xn.DEFAULT_ANISOTROPY=1;const r0=class r0{constructor(t=0,n=0,a=0,o=1){this.x=t,this.y=n,this.z=a,this.w=o}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,n,a,o){return this.x=t,this.y=n,this.z=a,this.w=o,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,n){switch(t){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;break;default:throw new Error("THREE.Vector4: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,n){return this.x=t.x+n.x,this.y=t.y+n.y,this.z=t.z+n.z,this.w=t.w+n.w,this}addScaledVector(t,n){return this.x+=t.x*n,this.y+=t.y*n,this.z+=t.z*n,this.w+=t.w*n,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,n){return this.x=t.x-n.x,this.y=t.y-n.y,this.z=t.z-n.z,this.w=t.w-n.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const n=this.x,a=this.y,o=this.z,c=this.w,u=t.elements;return this.x=u[0]*n+u[4]*a+u[8]*o+u[12]*c,this.y=u[1]*n+u[5]*a+u[9]*o+u[13]*c,this.z=u[2]*n+u[6]*a+u[10]*o+u[14]*c,this.w=u[3]*n+u[7]*a+u[11]*o+u[15]*c,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const n=Math.sqrt(1-t.w*t.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/n,this.y=t.y/n,this.z=t.z/n),this}setAxisAngleFromRotationMatrix(t){let n,a,o,c;const m=t.elements,p=m[0],_=m[4],v=m[8],g=m[1],y=m[5],E=m[9],A=m[2],x=m[6],S=m[10];if(Math.abs(_-g)<.01&&Math.abs(v-A)<.01&&Math.abs(E-x)<.01){if(Math.abs(_+g)<.1&&Math.abs(v+A)<.1&&Math.abs(E+x)<.1&&Math.abs(p+y+S-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const U=(p+1)/2,w=(y+1)/2,B=(S+1)/2,N=(_+g)/4,P=(v+A)/4,T=(E+x)/4;return U>w&&U>B?U<.01?(a=0,o=.707106781,c=.707106781):(a=Math.sqrt(U),o=N/a,c=P/a):w>B?w<.01?(a=.707106781,o=0,c=.707106781):(o=Math.sqrt(w),a=N/o,c=T/o):B<.01?(a=.707106781,o=.707106781,c=0):(c=Math.sqrt(B),a=P/c,o=T/c),this.set(a,o,c,n),this}let D=Math.sqrt((x-E)*(x-E)+(v-A)*(v-A)+(g-_)*(g-_));return Math.abs(D)<.001&&(D=1),this.x=(x-E)/D,this.y=(v-A)/D,this.z=(g-_)/D,this.w=Math.acos((p+y+S-1)/2),this}setFromMatrixPosition(t){const n=t.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this.w=n[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,n){return this.x=Ae(this.x,t.x,n.x),this.y=Ae(this.y,t.y,n.y),this.z=Ae(this.z,t.z,n.z),this.w=Ae(this.w,t.w,n.w),this}clampScalar(t,n){return this.x=Ae(this.x,t,n),this.y=Ae(this.y,t,n),this.z=Ae(this.z,t,n),this.w=Ae(this.w,t,n),this}clampLength(t,n){const a=this.length();return this.divideScalar(a||1).multiplyScalar(Ae(a,t,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,n){return this.x+=(t.x-this.x)*n,this.y+=(t.y-this.y)*n,this.z+=(t.z-this.z)*n,this.w+=(t.w-this.w)*n,this}lerpVectors(t,n,a){return this.x=t.x+(n.x-t.x)*a,this.y=t.y+(n.y-t.y)*a,this.z=t.z+(n.z-t.z)*a,this.w=t.w+(n.w-t.w)*a,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,n=0){return this.x=t[n],this.y=t[n+1],this.z=t[n+2],this.w=t[n+3],this}toArray(t=[],n=0){return t[n]=this.x,t[n+1]=this.y,t[n+2]=this.z,t[n+3]=this.w,t}fromBufferAttribute(t,n){return this.x=t.getX(n),this.y=t.getY(n),this.z=t.getZ(n),this.w=t.getW(n),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}};r0.prototype.isVector4=!0;let cn=r0;class ET extends gs{constructor(t=1,n=1,a={}){super(),a=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Gn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},a),this.isRenderTarget=!0,this.width=t,this.height=n,this.depth=a.depth,this.scissor=new cn(0,0,t,n),this.scissorTest=!1,this.viewport=new cn(0,0,t,n),this.textures=[];const o={width:t,height:n,depth:a.depth},c=new Xn(o),u=a.count;for(let d=0;d<u;d++)this.textures[d]=c.clone(),this.textures[d].isRenderTargetTexture=!0,this.textures[d].renderTarget=this;this._setTextureOptions(a),this.depthBuffer=a.depthBuffer,this.stencilBuffer=a.stencilBuffer,this.resolveDepthBuffer=a.resolveDepthBuffer,this.resolveStencilBuffer=a.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=a.depthTexture,this.samples=a.samples,this.multiview=a.multiview,this.useArrayDepthTexture=a.useArrayDepthTexture}_setTextureOptions(t={}){const n={minFilter:Gn,generateMipmaps:!1,flipY:!1,internalFormat:null};t.mapping!==void 0&&(n.mapping=t.mapping),t.wrapS!==void 0&&(n.wrapS=t.wrapS),t.wrapT!==void 0&&(n.wrapT=t.wrapT),t.wrapR!==void 0&&(n.wrapR=t.wrapR),t.magFilter!==void 0&&(n.magFilter=t.magFilter),t.minFilter!==void 0&&(n.minFilter=t.minFilter),t.format!==void 0&&(n.format=t.format),t.type!==void 0&&(n.type=t.type),t.anisotropy!==void 0&&(n.anisotropy=t.anisotropy),t.colorSpace!==void 0&&(n.colorSpace=t.colorSpace),t.flipY!==void 0&&(n.flipY=t.flipY),t.generateMipmaps!==void 0&&(n.generateMipmaps=t.generateMipmaps),t.internalFormat!==void 0&&(n.internalFormat=t.internalFormat);for(let a=0;a<this.textures.length;a++)this.textures[a].setValues(n)}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}set depthTexture(t){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),t!==null&&(t.renderTarget=this),this._depthTexture=t}get depthTexture(){return this._depthTexture}setSize(t,n,a=1){if(this.width!==t||this.height!==n||this.depth!==a){this.width=t,this.height=n,this.depth=a;for(let o=0,c=this.textures.length;o<c;o++)this.textures[o].image.width=t,this.textures[o].image.height=n,this.textures[o].image.depth=a,this.textures[o].isData3DTexture!==!0&&(this.textures[o].isArrayTexture=this.textures[o].image.depth>1);this.dispose()}this.viewport.set(0,0,t,n),this.scissor.set(0,0,t,n)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let n=0,a=t.textures.length;n<a;n++){this.textures[n]=t.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0,this.textures[n].renderTarget=this;const o=Object.assign({},t.textures[n].image);this.textures[n].source=new qm(o)}return this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this.multiview=t.multiview,this.useArrayDepthTexture=t.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ai extends ET{constructor(t=1,n=1,a={}){super(t,n,a),this.isWebGLRenderTarget=!0}}class aS extends Xn{constructor(t=null,n=1,a=1,o=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:n,height:a,depth:o},this.magFilter=Bn,this.minFilter=Bn,this.wrapR=za,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class bT extends Xn{constructor(t=null,n=1,a=1,o=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:n,height:a,depth:o},this.magFilter=Bn,this.minFilter=Bn,this.wrapR=za,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const vf=class vf{constructor(t,n,a,o,c,u,d,m,p,_,v,g,y,E,A,x){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,n,a,o,c,u,d,m,p,_,v,g,y,E,A,x)}set(t,n,a,o,c,u,d,m,p,_,v,g,y,E,A,x){const S=this.elements;return S[0]=t,S[4]=n,S[8]=a,S[12]=o,S[1]=c,S[5]=u,S[9]=d,S[13]=m,S[2]=p,S[6]=_,S[10]=v,S[14]=g,S[3]=y,S[7]=E,S[11]=A,S[15]=x,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new vf().fromArray(this.elements)}copy(t){const n=this.elements,a=t.elements;return n[0]=a[0],n[1]=a[1],n[2]=a[2],n[3]=a[3],n[4]=a[4],n[5]=a[5],n[6]=a[6],n[7]=a[7],n[8]=a[8],n[9]=a[9],n[10]=a[10],n[11]=a[11],n[12]=a[12],n[13]=a[13],n[14]=a[14],n[15]=a[15],this}copyPosition(t){const n=this.elements,a=t.elements;return n[12]=a[12],n[13]=a[13],n[14]=a[14],this}setFromMatrix3(t){const n=t.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(t,n,a){return this.determinantAffine()===0?(t.set(1,0,0),n.set(0,1,0),a.set(0,0,1),this):(t.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),a.setFromMatrixColumn(this,2),this)}makeBasis(t,n,a){return this.set(t.x,n.x,a.x,0,t.y,n.y,a.y,0,t.z,n.z,a.z,0,0,0,0,1),this}extractRotation(t){if(t.determinantAffine()===0)return this.identity();const n=this.elements,a=t.elements,o=1/$s.setFromMatrixColumn(t,0).length(),c=1/$s.setFromMatrixColumn(t,1).length(),u=1/$s.setFromMatrixColumn(t,2).length();return n[0]=a[0]*o,n[1]=a[1]*o,n[2]=a[2]*o,n[3]=0,n[4]=a[4]*c,n[5]=a[5]*c,n[6]=a[6]*c,n[7]=0,n[8]=a[8]*u,n[9]=a[9]*u,n[10]=a[10]*u,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(t){const n=this.elements,a=t.x,o=t.y,c=t.z,u=Math.cos(a),d=Math.sin(a),m=Math.cos(o),p=Math.sin(o),_=Math.cos(c),v=Math.sin(c);if(t.order==="XYZ"){const g=u*_,y=u*v,E=d*_,A=d*v;n[0]=m*_,n[4]=-m*v,n[8]=p,n[1]=y+E*p,n[5]=g-A*p,n[9]=-d*m,n[2]=A-g*p,n[6]=E+y*p,n[10]=u*m}else if(t.order==="YXZ"){const g=m*_,y=m*v,E=p*_,A=p*v;n[0]=g+A*d,n[4]=E*d-y,n[8]=u*p,n[1]=u*v,n[5]=u*_,n[9]=-d,n[2]=y*d-E,n[6]=A+g*d,n[10]=u*m}else if(t.order==="ZXY"){const g=m*_,y=m*v,E=p*_,A=p*v;n[0]=g-A*d,n[4]=-u*v,n[8]=E+y*d,n[1]=y+E*d,n[5]=u*_,n[9]=A-g*d,n[2]=-u*p,n[6]=d,n[10]=u*m}else if(t.order==="ZYX"){const g=u*_,y=u*v,E=d*_,A=d*v;n[0]=m*_,n[4]=E*p-y,n[8]=g*p+A,n[1]=m*v,n[5]=A*p+g,n[9]=y*p-E,n[2]=-p,n[6]=d*m,n[10]=u*m}else if(t.order==="YZX"){const g=u*m,y=u*p,E=d*m,A=d*p;n[0]=m*_,n[4]=A-g*v,n[8]=E*v+y,n[1]=v,n[5]=u*_,n[9]=-d*_,n[2]=-p*_,n[6]=y*v+E,n[10]=g-A*v}else if(t.order==="XZY"){const g=u*m,y=u*p,E=d*m,A=d*p;n[0]=m*_,n[4]=-v,n[8]=p*_,n[1]=g*v+A,n[5]=u*_,n[9]=y*v-E,n[2]=E*v-y,n[6]=d*_,n[10]=A*v+g}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(t){return this.compose(TT,t,AT)}lookAt(t,n,a){const o=this.elements;return gi.subVectors(t,n),gi.lengthSq()===0&&(gi.z=1),gi.normalize(),xr.crossVectors(a,gi),xr.lengthSq()===0&&(Math.abs(a.z)===1?gi.x+=1e-4:gi.z+=1e-4,gi.normalize(),xr.crossVectors(a,gi)),xr.normalize(),hu.crossVectors(gi,xr),o[0]=xr.x,o[4]=hu.x,o[8]=gi.x,o[1]=xr.y,o[5]=hu.y,o[9]=gi.y,o[2]=xr.z,o[6]=hu.z,o[10]=gi.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,n){const a=t.elements,o=n.elements,c=this.elements,u=a[0],d=a[4],m=a[8],p=a[12],_=a[1],v=a[5],g=a[9],y=a[13],E=a[2],A=a[6],x=a[10],S=a[14],D=a[3],U=a[7],w=a[11],B=a[15],N=o[0],P=o[4],T=o[8],O=o[12],W=o[1],k=o[5],Q=o[9],dt=o[13],vt=o[2],Z=o[6],F=o[10],V=o[14],et=o[3],mt=o[7],At=o[11],I=o[15];return c[0]=u*N+d*W+m*vt+p*et,c[4]=u*P+d*k+m*Z+p*mt,c[8]=u*T+d*Q+m*F+p*At,c[12]=u*O+d*dt+m*V+p*I,c[1]=_*N+v*W+g*vt+y*et,c[5]=_*P+v*k+g*Z+y*mt,c[9]=_*T+v*Q+g*F+y*At,c[13]=_*O+v*dt+g*V+y*I,c[2]=E*N+A*W+x*vt+S*et,c[6]=E*P+A*k+x*Z+S*mt,c[10]=E*T+A*Q+x*F+S*At,c[14]=E*O+A*dt+x*V+S*I,c[3]=D*N+U*W+w*vt+B*et,c[7]=D*P+U*k+w*Z+B*mt,c[11]=D*T+U*Q+w*F+B*At,c[15]=D*O+U*dt+w*V+B*I,this}multiplyScalar(t){const n=this.elements;return n[0]*=t,n[4]*=t,n[8]*=t,n[12]*=t,n[1]*=t,n[5]*=t,n[9]*=t,n[13]*=t,n[2]*=t,n[6]*=t,n[10]*=t,n[14]*=t,n[3]*=t,n[7]*=t,n[11]*=t,n[15]*=t,this}determinant(){const t=this.elements,n=t[0],a=t[4],o=t[8],c=t[12],u=t[1],d=t[5],m=t[9],p=t[13],_=t[2],v=t[6],g=t[10],y=t[14],E=t[3],A=t[7],x=t[11],S=t[15],D=m*y-p*g,U=d*y-p*v,w=d*g-m*v,B=u*y-p*_,N=u*g-m*_,P=u*v-d*_;return n*(A*D-x*U+S*w)-a*(E*D-x*B+S*N)+o*(E*U-A*B+S*P)-c*(E*w-A*N+x*P)}determinantAffine(){const t=this.elements,n=t[0],a=t[4],o=t[8],c=t[1],u=t[5],d=t[9],m=t[2],p=t[6],_=t[10];return n*(u*_-d*p)-a*(c*_-d*m)+o*(c*p-u*m)}transpose(){const t=this.elements;let n;return n=t[1],t[1]=t[4],t[4]=n,n=t[2],t[2]=t[8],t[8]=n,n=t[6],t[6]=t[9],t[9]=n,n=t[3],t[3]=t[12],t[12]=n,n=t[7],t[7]=t[13],t[13]=n,n=t[11],t[11]=t[14],t[14]=n,this}setPosition(t,n,a){const o=this.elements;return t.isVector3?(o[12]=t.x,o[13]=t.y,o[14]=t.z):(o[12]=t,o[13]=n,o[14]=a),this}invert(){const t=this.elements,n=t[0],a=t[1],o=t[2],c=t[3],u=t[4],d=t[5],m=t[6],p=t[7],_=t[8],v=t[9],g=t[10],y=t[11],E=t[12],A=t[13],x=t[14],S=t[15],D=n*d-a*u,U=n*m-o*u,w=n*p-c*u,B=a*m-o*d,N=a*p-c*d,P=o*p-c*m,T=_*A-v*E,O=_*x-g*E,W=_*S-y*E,k=v*x-g*A,Q=v*S-y*A,dt=g*S-y*x,vt=D*dt-U*Q+w*k+B*W-N*O+P*T;if(vt===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const Z=1/vt;return t[0]=(d*dt-m*Q+p*k)*Z,t[1]=(o*Q-a*dt-c*k)*Z,t[2]=(A*P-x*N+S*B)*Z,t[3]=(g*N-v*P-y*B)*Z,t[4]=(m*W-u*dt-p*O)*Z,t[5]=(n*dt-o*W+c*O)*Z,t[6]=(x*w-E*P-S*U)*Z,t[7]=(_*P-g*w+y*U)*Z,t[8]=(u*Q-d*W+p*T)*Z,t[9]=(a*W-n*Q-c*T)*Z,t[10]=(E*N-A*w+S*D)*Z,t[11]=(v*w-_*N-y*D)*Z,t[12]=(d*O-u*k-m*T)*Z,t[13]=(n*k-a*O+o*T)*Z,t[14]=(A*U-E*B-x*D)*Z,t[15]=(_*B-v*U+g*D)*Z,this}scale(t){const n=this.elements,a=t.x,o=t.y,c=t.z;return n[0]*=a,n[4]*=o,n[8]*=c,n[1]*=a,n[5]*=o,n[9]*=c,n[2]*=a,n[6]*=o,n[10]*=c,n[3]*=a,n[7]*=o,n[11]*=c,this}getMaxScaleOnAxis(){const t=this.elements,n=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],a=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],o=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(n,a,o))}makeTranslation(t,n,a){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,n,0,0,1,a,0,0,0,1),this}makeRotationX(t){const n=Math.cos(t),a=Math.sin(t);return this.set(1,0,0,0,0,n,-a,0,0,a,n,0,0,0,0,1),this}makeRotationY(t){const n=Math.cos(t),a=Math.sin(t);return this.set(n,0,a,0,0,1,0,0,-a,0,n,0,0,0,0,1),this}makeRotationZ(t){const n=Math.cos(t),a=Math.sin(t);return this.set(n,-a,0,0,a,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,n){const a=Math.cos(n),o=Math.sin(n),c=1-a,u=t.x,d=t.y,m=t.z,p=c*u,_=c*d;return this.set(p*u+a,p*d-o*m,p*m+o*d,0,p*d+o*m,_*d+a,_*m-o*u,0,p*m-o*d,_*m+o*u,c*m*m+a,0,0,0,0,1),this}makeScale(t,n,a){return this.set(t,0,0,0,0,n,0,0,0,0,a,0,0,0,0,1),this}makeShear(t,n,a,o,c,u){return this.set(1,a,c,0,t,1,u,0,n,o,1,0,0,0,0,1),this}compose(t,n,a){const o=this.elements,c=n._x,u=n._y,d=n._z,m=n._w,p=c+c,_=u+u,v=d+d,g=c*p,y=c*_,E=c*v,A=u*_,x=u*v,S=d*v,D=m*p,U=m*_,w=m*v,B=a.x,N=a.y,P=a.z;return o[0]=(1-(A+S))*B,o[1]=(y+w)*B,o[2]=(E-U)*B,o[3]=0,o[4]=(y-w)*N,o[5]=(1-(g+S))*N,o[6]=(x+D)*N,o[7]=0,o[8]=(E+U)*P,o[9]=(x-D)*P,o[10]=(1-(g+A))*P,o[11]=0,o[12]=t.x,o[13]=t.y,o[14]=t.z,o[15]=1,this}decompose(t,n,a){const o=this.elements;t.x=o[12],t.y=o[13],t.z=o[14];const c=this.determinantAffine();if(c===0)return a.set(1,1,1),n.identity(),this;let u=$s.set(o[0],o[1],o[2]).length();const d=$s.set(o[4],o[5],o[6]).length(),m=$s.set(o[8],o[9],o[10]).length();c<0&&(u=-u),Hi.copy(this);const p=1/u,_=1/d,v=1/m;return Hi.elements[0]*=p,Hi.elements[1]*=p,Hi.elements[2]*=p,Hi.elements[4]*=_,Hi.elements[5]*=_,Hi.elements[6]*=_,Hi.elements[8]*=v,Hi.elements[9]*=v,Hi.elements[10]*=v,n.setFromRotationMatrix(Hi),a.x=u,a.y=d,a.z=m,this}makePerspective(t,n,a,o,c,u,d=ra,m=!1){const p=this.elements,_=2*c/(n-t),v=2*c/(a-o),g=(n+t)/(n-t),y=(a+o)/(a-o);let E,A;if(m)E=c/(u-c),A=u*c/(u-c);else if(d===ra)E=-(u+c)/(u-c),A=-2*u*c/(u-c);else if(d===Xl)E=-u/(u-c),A=-u*c/(u-c);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+d);return p[0]=_,p[4]=0,p[8]=g,p[12]=0,p[1]=0,p[5]=v,p[9]=y,p[13]=0,p[2]=0,p[6]=0,p[10]=E,p[14]=A,p[3]=0,p[7]=0,p[11]=-1,p[15]=0,this}makeOrthographic(t,n,a,o,c,u,d=ra,m=!1){const p=this.elements,_=2/(n-t),v=2/(a-o),g=-(n+t)/(n-t),y=-(a+o)/(a-o);let E,A;if(m)E=1/(u-c),A=u/(u-c);else if(d===ra)E=-2/(u-c),A=-(u+c)/(u-c);else if(d===Xl)E=-1/(u-c),A=-c/(u-c);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+d);return p[0]=_,p[4]=0,p[8]=0,p[12]=g,p[1]=0,p[5]=v,p[9]=0,p[13]=y,p[2]=0,p[6]=0,p[10]=E,p[14]=A,p[3]=0,p[7]=0,p[11]=0,p[15]=1,this}equals(t){const n=this.elements,a=t.elements;for(let o=0;o<16;o++)if(n[o]!==a[o])return!1;return!0}fromArray(t,n=0){for(let a=0;a<16;a++)this.elements[a]=t[a+n];return this}toArray(t=[],n=0){const a=this.elements;return t[n]=a[0],t[n+1]=a[1],t[n+2]=a[2],t[n+3]=a[3],t[n+4]=a[4],t[n+5]=a[5],t[n+6]=a[6],t[n+7]=a[7],t[n+8]=a[8],t[n+9]=a[9],t[n+10]=a[10],t[n+11]=a[11],t[n+12]=a[12],t[n+13]=a[13],t[n+14]=a[14],t[n+15]=a[15],t}};vf.prototype.isMatrix4=!0;let ze=vf;const $s=new z,Hi=new ze,TT=new z(0,0,0),AT=new z(1,1,1),xr=new z,hu=new z,gi=new z,dx=new ze,px=new vi;class ua{constructor(t=0,n=0,a=0,o=ua.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=n,this._z=a,this._order=o}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,n,a,o=this._order){return this._x=t,this._y=n,this._z=a,this._order=o,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,n=this._order,a=!0){const o=t.elements,c=o[0],u=o[4],d=o[8],m=o[1],p=o[5],_=o[9],v=o[2],g=o[6],y=o[10];switch(n){case"XYZ":this._y=Math.asin(Ae(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(-_,y),this._z=Math.atan2(-u,c)):(this._x=Math.atan2(g,p),this._z=0);break;case"YXZ":this._x=Math.asin(-Ae(_,-1,1)),Math.abs(_)<.9999999?(this._y=Math.atan2(d,y),this._z=Math.atan2(m,p)):(this._y=Math.atan2(-v,c),this._z=0);break;case"ZXY":this._x=Math.asin(Ae(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(-v,y),this._z=Math.atan2(-u,p)):(this._y=0,this._z=Math.atan2(m,c));break;case"ZYX":this._y=Math.asin(-Ae(v,-1,1)),Math.abs(v)<.9999999?(this._x=Math.atan2(g,y),this._z=Math.atan2(m,c)):(this._x=0,this._z=Math.atan2(-u,p));break;case"YZX":this._z=Math.asin(Ae(m,-1,1)),Math.abs(m)<.9999999?(this._x=Math.atan2(-_,p),this._y=Math.atan2(-v,c)):(this._x=0,this._y=Math.atan2(d,y));break;case"XZY":this._z=Math.asin(-Ae(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(g,p),this._y=Math.atan2(d,c)):(this._x=Math.atan2(-_,y),this._y=0);break;default:me("Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,a===!0&&this._onChangeCallback(),this}setFromQuaternion(t,n,a){return dx.makeRotationFromQuaternion(t),this.setFromRotationMatrix(dx,n,a)}setFromVector3(t,n=this._order){return this.set(t.x,t.y,t.z,n)}reorder(t){return px.setFromEuler(this),this.setFromQuaternion(px,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],n=0){return t[n]=this._x,t[n+1]=this._y,t[n+2]=this._z,t[n+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}ua.DEFAULT_ORDER="XYZ";class rS{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}}let RT=0;const mx=new z,to=new vi,Da=new ze,du=new z,bl=new z,wT=new z,CT=new vi,gx=new z(1,0,0),_x=new z(0,1,0),vx=new z(0,0,1),xx={type:"added"},DT={type:"removed"},eo={type:"childadded",child:null},Yd={type:"childremoved",child:null};class hn extends gs{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:RT++}),this.uuid=Fa(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=hn.DEFAULT_UP.clone();const t=new z,n=new ua,a=new vi,o=new z(1,1,1);function c(){a.setFromEuler(n,!1)}function u(){n.setFromQuaternion(a,void 0,!1)}n._onChange(c),a._onChange(u),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:a},scale:{configurable:!0,enumerable:!0,value:o},modelViewMatrix:{value:new ze},normalMatrix:{value:new Se}}),this.matrix=new ze,this.matrixWorld=new ze,this.matrixAutoUpdate=hn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=hn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new rS,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,n){this.quaternion.setFromAxisAngle(t,n)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,n){return to.setFromAxisAngle(t,n),this.quaternion.multiply(to),this}rotateOnWorldAxis(t,n){return to.setFromAxisAngle(t,n),this.quaternion.premultiply(to),this}rotateX(t){return this.rotateOnAxis(gx,t)}rotateY(t){return this.rotateOnAxis(_x,t)}rotateZ(t){return this.rotateOnAxis(vx,t)}translateOnAxis(t,n){return mx.copy(t).applyQuaternion(this.quaternion),this.position.add(mx.multiplyScalar(n)),this}translateX(t){return this.translateOnAxis(gx,t)}translateY(t){return this.translateOnAxis(_x,t)}translateZ(t){return this.translateOnAxis(vx,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Da.copy(this.matrixWorld).invert())}lookAt(t,n,a){t.isVector3?du.copy(t):du.set(t,n,a);const o=this.parent;this.updateWorldMatrix(!0,!1),bl.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Da.lookAt(bl,du,this.up):Da.lookAt(du,bl,this.up),this.quaternion.setFromRotationMatrix(Da),o&&(Da.extractRotation(o.matrixWorld),to.setFromRotationMatrix(Da),this.quaternion.premultiply(to.invert()))}add(t){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return t===this?(Oe("Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(xx),eo.child=t,this.dispatchEvent(eo),eo.child=null):Oe("Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let a=0;a<arguments.length;a++)this.remove(arguments[a]);return this}const n=this.children.indexOf(t);return n!==-1&&(t.parent=null,this.children.splice(n,1),t.dispatchEvent(DT),Yd.child=t,this.dispatchEvent(Yd),Yd.child=null),this}removeFromParent(){const t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Da.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Da.multiply(t.parent.matrixWorld)),t.applyMatrix4(Da),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(xx),eo.child=t,this.dispatchEvent(eo),eo.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,n){if(this[t]===n)return this;for(let a=0,o=this.children.length;a<o;a++){const u=this.children[a].getObjectByProperty(t,n);if(u!==void 0)return u}}getObjectsByProperty(t,n,a=[]){this[t]===n&&a.push(this);const o=this.children;for(let c=0,u=o.length;c<u;c++)o[c].getObjectsByProperty(t,n,a);return a}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(bl,t,wT),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(bl,CT,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const n=this.matrixWorld.elements;return t.set(n[8],n[9],n[10]).normalize()}raycast(){}traverse(t){t(this);const n=this.children;for(let a=0,o=n.length;a<o;a++)n[a].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);const n=this.children;for(let a=0,o=n.length;a<o;a++)n[a].traverseVisible(t)}traverseAncestors(t){const n=this.parent;n!==null&&(t(n),n.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const t=this.pivot;if(t!==null){const n=t.x,a=t.y,o=t.z,c=this.matrix.elements;c[12]+=n-c[0]*n-c[4]*a-c[8]*o,c[13]+=a-c[1]*n-c[5]*a-c[9]*o,c[14]+=o-c[2]*n-c[6]*a-c[10]*o}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const n=this.children;for(let a=0,o=n.length;a<o;a++)n[a].updateMatrixWorld(t)}updateWorldMatrix(t,n,a=!1){const o=this.parent;if(t===!0&&o!==null&&o.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||a)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,a=!0),n===!0){const c=this.children;for(let u=0,d=c.length;u<d;u++)c[u].updateWorldMatrix(!1,!0,a)}}toJSON(t){const n=t===void 0||typeof t=="string",a={};n&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},a.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const o={};o.uuid=this.uuid,o.type=this.type,this.name!==""&&(o.name=this.name),this.castShadow===!0&&(o.castShadow=!0),this.receiveShadow===!0&&(o.receiveShadow=!0),this.visible===!1&&(o.visible=!1),this.frustumCulled===!1&&(o.frustumCulled=!1),this.renderOrder!==0&&(o.renderOrder=this.renderOrder),this.static!==!1&&(o.static=this.static),Object.keys(this.userData).length>0&&(o.userData=this.userData),o.layers=this.layers.mask,o.matrix=this.matrix.toArray(),o.up=this.up.toArray(),this.pivot!==null&&(o.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(o.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(o.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(o.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(o.type="InstancedMesh",o.count=this.count,o.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(o.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(o.type="BatchedMesh",o.perObjectFrustumCulled=this.perObjectFrustumCulled,o.sortObjects=this.sortObjects,o.drawRanges=this._drawRanges,o.reservedRanges=this._reservedRanges,o.geometryInfo=this._geometryInfo.map(d=>({...d,boundingBox:d.boundingBox?d.boundingBox.toJSON():void 0,boundingSphere:d.boundingSphere?d.boundingSphere.toJSON():void 0})),o.instanceInfo=this._instanceInfo.map(d=>({...d})),o.availableInstanceIds=this._availableInstanceIds.slice(),o.availableGeometryIds=this._availableGeometryIds.slice(),o.nextIndexStart=this._nextIndexStart,o.nextVertexStart=this._nextVertexStart,o.geometryCount=this._geometryCount,o.maxInstanceCount=this._maxInstanceCount,o.maxVertexCount=this._maxVertexCount,o.maxIndexCount=this._maxIndexCount,o.geometryInitialized=this._geometryInitialized,o.matricesTexture=this._matricesTexture.toJSON(t),o.indirectTexture=this._indirectTexture.toJSON(t),this._colorsTexture!==null&&(o.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(o.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(o.boundingBox=this.boundingBox.toJSON()));function c(d,m){return d[m.uuid]===void 0&&(d[m.uuid]=m.toJSON(t)),m.uuid}if(this.isScene)this.background&&(this.background.isColor?o.background=this.background.toJSON():this.background.isTexture&&(o.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(o.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){o.geometry=c(t.geometries,this.geometry);const d=this.geometry.parameters;if(d!==void 0&&d.shapes!==void 0){const m=d.shapes;if(Array.isArray(m))for(let p=0,_=m.length;p<_;p++){const v=m[p];c(t.shapes,v)}else c(t.shapes,m)}}if(this.isSkinnedMesh&&(o.bindMode=this.bindMode,o.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(c(t.skeletons,this.skeleton),o.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const d=[];for(let m=0,p=this.material.length;m<p;m++)d.push(c(t.materials,this.material[m]));o.material=d}else o.material=c(t.materials,this.material);if(this.children.length>0){o.children=[];for(let d=0;d<this.children.length;d++)o.children.push(this.children[d].toJSON(t).object)}if(this.animations.length>0){o.animations=[];for(let d=0;d<this.animations.length;d++){const m=this.animations[d];o.animations.push(c(t.animations,m))}}if(n){const d=u(t.geometries),m=u(t.materials),p=u(t.textures),_=u(t.images),v=u(t.shapes),g=u(t.skeletons),y=u(t.animations),E=u(t.nodes);d.length>0&&(a.geometries=d),m.length>0&&(a.materials=m),p.length>0&&(a.textures=p),_.length>0&&(a.images=_),v.length>0&&(a.shapes=v),g.length>0&&(a.skeletons=g),y.length>0&&(a.animations=y),E.length>0&&(a.nodes=E)}return a.object=o,a;function u(d){const m=[];for(const p in d){const _=d[p];delete _.metadata,m.push(_)}return m}}clone(t){return new this.constructor().copy(this,t)}copy(t,n=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.pivot=t.pivot!==null?t.pivot.clone():null,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.static=t.static,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),n===!0)for(let a=0;a<t.children.length;a++){const o=t.children[a];this.add(o.clone())}return this}}hn.DEFAULT_UP=new z(0,1,0);hn.DEFAULT_MATRIX_AUTO_UPDATE=!0;hn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class wr extends hn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const LT={type:"move"};class Zd{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new wr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new wr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new z,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new z),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new wr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new z,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new z,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const n=this._hand;if(n)for(const a of t.hand.values())this._getHandJoint(n,a)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,n,a){let o=null,c=null,u=null;const d=this._targetRay,m=this._grip,p=this._hand;if(t&&n.session.visibilityState!=="visible-blurred"){if(p&&t.hand){u=!0;for(const A of t.hand.values()){const x=n.getJointPose(A,a),S=this._getHandJoint(p,A);x!==null&&(S.matrix.fromArray(x.transform.matrix),S.matrix.decompose(S.position,S.rotation,S.scale),S.matrixWorldNeedsUpdate=!0,S.jointRadius=x.radius),S.visible=x!==null}const _=p.joints["index-finger-tip"],v=p.joints["thumb-tip"],g=_.position.distanceTo(v.position),y=.02,E=.005;p.inputState.pinching&&g>y+E?(p.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!p.inputState.pinching&&g<=y-E&&(p.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else m!==null&&t.gripSpace&&(c=n.getPose(t.gripSpace,a),c!==null&&(m.matrix.fromArray(c.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.matrixWorldNeedsUpdate=!0,c.linearVelocity?(m.hasLinearVelocity=!0,m.linearVelocity.copy(c.linearVelocity)):m.hasLinearVelocity=!1,c.angularVelocity?(m.hasAngularVelocity=!0,m.angularVelocity.copy(c.angularVelocity)):m.hasAngularVelocity=!1,m.eventsEnabled&&m.dispatchEvent({type:"gripUpdated",data:t,target:this})));d!==null&&(o=n.getPose(t.targetRaySpace,a),o===null&&c!==null&&(o=c),o!==null&&(d.matrix.fromArray(o.transform.matrix),d.matrix.decompose(d.position,d.rotation,d.scale),d.matrixWorldNeedsUpdate=!0,o.linearVelocity?(d.hasLinearVelocity=!0,d.linearVelocity.copy(o.linearVelocity)):d.hasLinearVelocity=!1,o.angularVelocity?(d.hasAngularVelocity=!0,d.angularVelocity.copy(o.angularVelocity)):d.hasAngularVelocity=!1,this.dispatchEvent(LT)))}return d!==null&&(d.visible=o!==null),m!==null&&(m.visible=c!==null),p!==null&&(p.visible=u!==null),this}_getHandJoint(t,n){if(t.joints[n.jointName]===void 0){const a=new wr;a.matrixAutoUpdate=!1,a.visible=!1,t.joints[n.jointName]=a,t.add(a)}return t.joints[n.jointName]}}const sS={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},yr={h:0,s:0,l:0},pu={h:0,s:0,l:0};function Kd(r,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?r+(t-r)*6*n:n<1/2?t:n<2/3?r+(t-r)*6*(2/3-n):r}class ce{constructor(t,n,a){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,n,a)}set(t,n,a){if(n===void 0&&a===void 0){const o=t;o&&o.isColor?this.copy(o):typeof o=="number"?this.setHex(o):typeof o=="string"&&this.setStyle(o)}else this.setRGB(t,n,a);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,n=Ui){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,Ne.colorSpaceToWorking(this,n),this}setRGB(t,n,a,o=Ne.workingColorSpace){return this.r=t,this.g=n,this.b=a,Ne.colorSpaceToWorking(this,o),this}setHSL(t,n,a,o=Ne.workingColorSpace){if(t=Xm(t,1),n=Ae(n,0,1),a=Ae(a,0,1),n===0)this.r=this.g=this.b=a;else{const c=a<=.5?a*(1+n):a+n-a*n,u=2*a-c;this.r=Kd(u,c,t+1/3),this.g=Kd(u,c,t),this.b=Kd(u,c,t-1/3)}return Ne.colorSpaceToWorking(this,o),this}setStyle(t,n=Ui){function a(c){c!==void 0&&parseFloat(c)<1&&me("Color: Alpha component of "+t+" will be ignored.")}let o;if(o=/^(\w+)\(([^\)]*)\)/.exec(t)){let c;const u=o[1],d=o[2];switch(u){case"rgb":case"rgba":if(c=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(d))return a(c[4]),this.setRGB(Math.min(255,parseInt(c[1],10))/255,Math.min(255,parseInt(c[2],10))/255,Math.min(255,parseInt(c[3],10))/255,n);if(c=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(d))return a(c[4]),this.setRGB(Math.min(100,parseInt(c[1],10))/100,Math.min(100,parseInt(c[2],10))/100,Math.min(100,parseInt(c[3],10))/100,n);break;case"hsl":case"hsla":if(c=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(d))return a(c[4]),this.setHSL(parseFloat(c[1])/360,parseFloat(c[2])/100,parseFloat(c[3])/100,n);break;default:me("Color: Unknown color model "+t)}}else if(o=/^\#([A-Fa-f\d]+)$/.exec(t)){const c=o[1],u=c.length;if(u===3)return this.setRGB(parseInt(c.charAt(0),16)/15,parseInt(c.charAt(1),16)/15,parseInt(c.charAt(2),16)/15,n);if(u===6)return this.setHex(parseInt(c,16),n);me("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,n);return this}setColorName(t,n=Ui){const a=sS[t.toLowerCase()];return a!==void 0?this.setHex(a,n):me("Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=Ha(t.r),this.g=Ha(t.g),this.b=Ha(t.b),this}copyLinearToSRGB(t){return this.r=Mo(t.r),this.g=Mo(t.g),this.b=Mo(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Ui){return Ne.workingToColorSpace(Hn.copy(this),t),Math.round(Ae(Hn.r*255,0,255))*65536+Math.round(Ae(Hn.g*255,0,255))*256+Math.round(Ae(Hn.b*255,0,255))}getHexString(t=Ui){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,n=Ne.workingColorSpace){Ne.workingToColorSpace(Hn.copy(this),n);const a=Hn.r,o=Hn.g,c=Hn.b,u=Math.max(a,o,c),d=Math.min(a,o,c);let m,p;const _=(d+u)/2;if(d===u)m=0,p=0;else{const v=u-d;switch(p=_<=.5?v/(u+d):v/(2-u-d),u){case a:m=(o-c)/v+(o<c?6:0);break;case o:m=(c-a)/v+2;break;case c:m=(a-o)/v+4;break}m/=6}return t.h=m,t.s=p,t.l=_,t}getRGB(t,n=Ne.workingColorSpace){return Ne.workingToColorSpace(Hn.copy(this),n),t.r=Hn.r,t.g=Hn.g,t.b=Hn.b,t}getStyle(t=Ui){Ne.workingToColorSpace(Hn.copy(this),t);const n=Hn.r,a=Hn.g,o=Hn.b;return t!==Ui?`color(${t} ${n.toFixed(3)} ${a.toFixed(3)} ${o.toFixed(3)})`:`rgb(${Math.round(n*255)},${Math.round(a*255)},${Math.round(o*255)})`}offsetHSL(t,n,a){return this.getHSL(yr),this.setHSL(yr.h+t,yr.s+n,yr.l+a)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,n){return this.r=t.r+n.r,this.g=t.g+n.g,this.b=t.b+n.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,n){return this.r+=(t.r-this.r)*n,this.g+=(t.g-this.g)*n,this.b+=(t.b-this.b)*n,this}lerpColors(t,n,a){return this.r=t.r+(n.r-t.r)*a,this.g=t.g+(n.g-t.g)*a,this.b=t.b+(n.b-t.b)*a,this}lerpHSL(t,n){this.getHSL(yr),t.getHSL(pu);const a=Hl(yr.h,pu.h,n),o=Hl(yr.s,pu.s,n),c=Hl(yr.l,pu.l,n);return this.setHSL(a,o,c),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const n=this.r,a=this.g,o=this.b,c=t.elements;return this.r=c[0]*n+c[3]*a+c[6]*o,this.g=c[1]*n+c[4]*a+c[7]*o,this.b=c[2]*n+c[5]*a+c[8]*o,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,n=0){return this.r=t[n],this.g=t[n+1],this.b=t[n+2],this}toArray(t=[],n=0){return t[n]=this.r,t[n+1]=this.g,t[n+2]=this.b,t}fromBufferAttribute(t,n){return this.r=t.getX(n),this.g=t.getY(n),this.b=t.getZ(n),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Hn=new ce;ce.NAMES=sS;class Ym{constructor(t,n=25e-5){this.isFogExp2=!0,this.name="",this.color=new ce(t),this.density=n}clone(){return new Ym(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class UT extends hn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new ua,this.environmentIntensity=1,this.environmentRotation=new ua,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,n){return super.copy(t,n),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const n=super.toJSON(t);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(n.object.environmentIntensity=this.environmentIntensity),n.object.environmentRotation=this.environmentRotation.toArray(),n}}const Gi=new z,La=new z,Qd=new z,Ua=new z,no=new z,io=new z,yx=new z,Jd=new z,jd=new z,$d=new z,tp=new cn,ep=new cn,np=new cn;class Si{constructor(t=new z,n=new z,a=new z){this.a=t,this.b=n,this.c=a}static getNormal(t,n,a,o){o.subVectors(a,n),Gi.subVectors(t,n),o.cross(Gi);const c=o.lengthSq();return c>0?o.multiplyScalar(1/Math.sqrt(c)):o.set(0,0,0)}static getBarycoord(t,n,a,o,c){Gi.subVectors(o,n),La.subVectors(a,n),Qd.subVectors(t,n);const u=Gi.dot(Gi),d=Gi.dot(La),m=Gi.dot(Qd),p=La.dot(La),_=La.dot(Qd),v=u*p-d*d;if(v===0)return c.set(0,0,0),null;const g=1/v,y=(p*m-d*_)*g,E=(u*_-d*m)*g;return c.set(1-y-E,E,y)}static containsPoint(t,n,a,o){return this.getBarycoord(t,n,a,o,Ua)===null?!1:Ua.x>=0&&Ua.y>=0&&Ua.x+Ua.y<=1}static getInterpolation(t,n,a,o,c,u,d,m){return this.getBarycoord(t,n,a,o,Ua)===null?(m.x=0,m.y=0,"z"in m&&(m.z=0),"w"in m&&(m.w=0),null):(m.setScalar(0),m.addScaledVector(c,Ua.x),m.addScaledVector(u,Ua.y),m.addScaledVector(d,Ua.z),m)}static getInterpolatedAttribute(t,n,a,o,c,u){return tp.setScalar(0),ep.setScalar(0),np.setScalar(0),tp.fromBufferAttribute(t,n),ep.fromBufferAttribute(t,a),np.fromBufferAttribute(t,o),u.setScalar(0),u.addScaledVector(tp,c.x),u.addScaledVector(ep,c.y),u.addScaledVector(np,c.z),u}static isFrontFacing(t,n,a,o){return Gi.subVectors(a,n),La.subVectors(t,n),Gi.cross(La).dot(o)<0}set(t,n,a){return this.a.copy(t),this.b.copy(n),this.c.copy(a),this}setFromPointsAndIndices(t,n,a,o){return this.a.copy(t[n]),this.b.copy(t[a]),this.c.copy(t[o]),this}setFromAttributeAndIndices(t,n,a,o){return this.a.fromBufferAttribute(t,n),this.b.fromBufferAttribute(t,a),this.c.fromBufferAttribute(t,o),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Gi.subVectors(this.c,this.b),La.subVectors(this.a,this.b),Gi.cross(La).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Si.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,n){return Si.getBarycoord(t,this.a,this.b,this.c,n)}getInterpolation(t,n,a,o,c){return Si.getInterpolation(t,this.a,this.b,this.c,n,a,o,c)}containsPoint(t){return Si.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Si.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,n){const a=this.a,o=this.b,c=this.c;let u,d;no.subVectors(o,a),io.subVectors(c,a),Jd.subVectors(t,a);const m=no.dot(Jd),p=io.dot(Jd);if(m<=0&&p<=0)return n.copy(a);jd.subVectors(t,o);const _=no.dot(jd),v=io.dot(jd);if(_>=0&&v<=_)return n.copy(o);const g=m*v-_*p;if(g<=0&&m>=0&&_<=0)return u=m/(m-_),n.copy(a).addScaledVector(no,u);$d.subVectors(t,c);const y=no.dot($d),E=io.dot($d);if(E>=0&&y<=E)return n.copy(c);const A=y*p-m*E;if(A<=0&&p>=0&&E<=0)return d=p/(p-E),n.copy(a).addScaledVector(io,d);const x=_*E-y*v;if(x<=0&&v-_>=0&&y-E>=0)return yx.subVectors(c,o),d=(v-_)/(v-_+(y-E)),n.copy(o).addScaledVector(yx,d);const S=1/(x+A+g);return u=A*S,d=g*S,n.copy(a).addScaledVector(no,u).addScaledVector(io,d)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}class _s{constructor(t=new z(1/0,1/0,1/0),n=new z(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=n}set(t,n){return this.min.copy(t),this.max.copy(n),this}setFromArray(t){this.makeEmpty();for(let n=0,a=t.length;n<a;n+=3)this.expandByPoint(Vi.fromArray(t,n));return this}setFromBufferAttribute(t){this.makeEmpty();for(let n=0,a=t.count;n<a;n++)this.expandByPoint(Vi.fromBufferAttribute(t,n));return this}setFromPoints(t){this.makeEmpty();for(let n=0,a=t.length;n<a;n++)this.expandByPoint(t[n]);return this}setFromCenterAndSize(t,n){const a=Vi.copy(n).multiplyScalar(.5);return this.min.copy(t).sub(a),this.max.copy(t).add(a),this}setFromObject(t,n=!1){return this.makeEmpty(),this.expandByObject(t,n)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,n=!1){t.updateWorldMatrix(!1,!1);const a=t.geometry;if(a!==void 0){const c=a.getAttribute("position");if(n===!0&&c!==void 0&&t.isInstancedMesh!==!0)for(let u=0,d=c.count;u<d;u++)t.isMesh===!0?t.getVertexPosition(u,Vi):Vi.fromBufferAttribute(c,u),Vi.applyMatrix4(t.matrixWorld),this.expandByPoint(Vi);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),mu.copy(t.boundingBox)):(a.boundingBox===null&&a.computeBoundingBox(),mu.copy(a.boundingBox)),mu.applyMatrix4(t.matrixWorld),this.union(mu)}const o=t.children;for(let c=0,u=o.length;c<u;c++)this.expandByObject(o[c],n);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,n){return n.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,Vi),Vi.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let n,a;return t.normal.x>0?(n=t.normal.x*this.min.x,a=t.normal.x*this.max.x):(n=t.normal.x*this.max.x,a=t.normal.x*this.min.x),t.normal.y>0?(n+=t.normal.y*this.min.y,a+=t.normal.y*this.max.y):(n+=t.normal.y*this.max.y,a+=t.normal.y*this.min.y),t.normal.z>0?(n+=t.normal.z*this.min.z,a+=t.normal.z*this.max.z):(n+=t.normal.z*this.max.z,a+=t.normal.z*this.min.z),n<=-t.constant&&a>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Tl),gu.subVectors(this.max,Tl),ao.subVectors(t.a,Tl),ro.subVectors(t.b,Tl),so.subVectors(t.c,Tl),Sr.subVectors(ro,ao),Mr.subVectors(so,ro),$r.subVectors(ao,so);let n=[0,-Sr.z,Sr.y,0,-Mr.z,Mr.y,0,-$r.z,$r.y,Sr.z,0,-Sr.x,Mr.z,0,-Mr.x,$r.z,0,-$r.x,-Sr.y,Sr.x,0,-Mr.y,Mr.x,0,-$r.y,$r.x,0];return!ip(n,ao,ro,so,gu)||(n=[1,0,0,0,1,0,0,0,1],!ip(n,ao,ro,so,gu))?!1:(_u.crossVectors(Sr,Mr),n=[_u.x,_u.y,_u.z],ip(n,ao,ro,so,gu))}clampPoint(t,n){return n.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Vi).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(Vi).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(Na[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Na[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Na[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Na[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Na[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Na[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Na[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Na[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Na),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}}const Na=[new z,new z,new z,new z,new z,new z,new z,new z],Vi=new z,mu=new _s,ao=new z,ro=new z,so=new z,Sr=new z,Mr=new z,$r=new z,Tl=new z,gu=new z,_u=new z,ts=new z;function ip(r,t,n,a,o){for(let c=0,u=r.length-3;c<=u;c+=3){ts.fromArray(r,c);const d=o.x*Math.abs(ts.x)+o.y*Math.abs(ts.y)+o.z*Math.abs(ts.z),m=t.dot(ts),p=n.dot(ts),_=a.dot(ts);if(Math.max(-Math.max(m,p,_),Math.min(m,p,_))>d)return!1}return!0}const Sn=new z,vu=new fe;let NT=0;class Vn extends gs{constructor(t,n,a=!1){if(super(),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:NT++}),this.name="",this.array=t,this.itemSize=n,this.count=t!==void 0?t.length/n:0,this.normalized=a,this.usage=mm,this.updateRanges=[],this.gpuType=Wi,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,n){this.updateRanges.push({start:t,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,n,a){t*=this.itemSize,a*=n.itemSize;for(let o=0,c=this.itemSize;o<c;o++)this.array[t+o]=n.array[a+o];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let n=0,a=this.count;n<a;n++)vu.fromBufferAttribute(this,n),vu.applyMatrix3(t),this.setXY(n,vu.x,vu.y);else if(this.itemSize===3)for(let n=0,a=this.count;n<a;n++)Sn.fromBufferAttribute(this,n),Sn.applyMatrix3(t),this.setXYZ(n,Sn.x,Sn.y,Sn.z);return this}applyMatrix4(t){for(let n=0,a=this.count;n<a;n++)Sn.fromBufferAttribute(this,n),Sn.applyMatrix4(t),this.setXYZ(n,Sn.x,Sn.y,Sn.z);return this}applyNormalMatrix(t){for(let n=0,a=this.count;n<a;n++)Sn.fromBufferAttribute(this,n),Sn.applyNormalMatrix(t),this.setXYZ(n,Sn.x,Sn.y,Sn.z);return this}transformDirection(t){for(let n=0,a=this.count;n<a;n++)Sn.fromBufferAttribute(this,n),Sn.transformDirection(t),this.setXYZ(n,Sn.x,Sn.y,Sn.z);return this}set(t,n=0){return this.array.set(t,n),this}getComponent(t,n){let a=this.array[t*this.itemSize+n];return this.normalized&&(a=ki(a,this.array)),a}setComponent(t,n,a){return this.normalized&&(a=Ze(a,this.array)),this.array[t*this.itemSize+n]=a,this}getX(t){let n=this.array[t*this.itemSize];return this.normalized&&(n=ki(n,this.array)),n}setX(t,n){return this.normalized&&(n=Ze(n,this.array)),this.array[t*this.itemSize]=n,this}getY(t){let n=this.array[t*this.itemSize+1];return this.normalized&&(n=ki(n,this.array)),n}setY(t,n){return this.normalized&&(n=Ze(n,this.array)),this.array[t*this.itemSize+1]=n,this}getZ(t){let n=this.array[t*this.itemSize+2];return this.normalized&&(n=ki(n,this.array)),n}setZ(t,n){return this.normalized&&(n=Ze(n,this.array)),this.array[t*this.itemSize+2]=n,this}getW(t){let n=this.array[t*this.itemSize+3];return this.normalized&&(n=ki(n,this.array)),n}setW(t,n){return this.normalized&&(n=Ze(n,this.array)),this.array[t*this.itemSize+3]=n,this}setXY(t,n,a){return t*=this.itemSize,this.normalized&&(n=Ze(n,this.array),a=Ze(a,this.array)),this.array[t+0]=n,this.array[t+1]=a,this}setXYZ(t,n,a,o){return t*=this.itemSize,this.normalized&&(n=Ze(n,this.array),a=Ze(a,this.array),o=Ze(o,this.array)),this.array[t+0]=n,this.array[t+1]=a,this.array[t+2]=o,this}setXYZW(t,n,a,o,c){return t*=this.itemSize,this.normalized&&(n=Ze(n,this.array),a=Ze(a,this.array),o=Ze(o,this.array),c=Ze(c,this.array)),this.array[t+0]=n,this.array[t+1]=a,this.array[t+2]=o,this.array[t+3]=c,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(t.name=this.name),this.usage!==mm&&(t.usage=this.usage),t}dispose(){this.dispatchEvent({type:"dispose"})}}class oS extends Vn{constructor(t,n,a){super(new Uint16Array(t),n,a)}}class lS extends Vn{constructor(t,n,a){super(new Uint32Array(t),n,a)}}class Mn extends Vn{constructor(t,n,a){super(new Float32Array(t),n,a)}}const OT=new _s,Al=new z,ap=new z;class vs{constructor(t=new z,n=-1){this.isSphere=!0,this.center=t,this.radius=n}set(t,n){return this.center.copy(t),this.radius=n,this}setFromPoints(t,n){const a=this.center;n!==void 0?a.copy(n):OT.setFromPoints(t).getCenter(a);let o=0;for(let c=0,u=t.length;c<u;c++)o=Math.max(o,a.distanceToSquared(t[c]));return this.radius=Math.sqrt(o),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const n=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=n*n}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,n){const a=this.center.distanceToSquared(t);return n.copy(t),a>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Al.subVectors(t,this.center);const n=Al.lengthSq();if(n>this.radius*this.radius){const a=Math.sqrt(n),o=(a-this.radius)*.5;this.center.addScaledVector(Al,o/a),this.radius+=o}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(ap.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Al.copy(t.center).add(ap)),this.expandByPoint(Al.copy(t.center).sub(ap))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}}let PT=0;const Li=new ze,rp=new hn,oo=new z,_i=new _s,Rl=new _s,Cn=new z;class Dn extends gs{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:PT++}),this.uuid=Fa(),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={},this._transformed=!1}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new($b(t)?lS:oS)(t,1):this.index=t,this}setIndirect(t,n=0){return this.indirect=t,this.indirectOffset=n,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,n){return this.attributes[t]=n,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,n,a=0){this.groups.push({start:t,count:n,materialIndex:a})}clearGroups(){this.groups=[]}setDrawRange(t,n){this.drawRange.start=t,this.drawRange.count=n}applyMatrix4(t){const n=this.attributes.position;n!==void 0&&(n.applyMatrix4(t),n.needsUpdate=!0);const a=this.attributes.normal;if(a!==void 0){const c=new Se().getNormalMatrix(t);a.applyNormalMatrix(c),a.needsUpdate=!0}const o=this.attributes.tangent;return o!==void 0&&(o.transformDirection(t),o.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(t){return Li.makeRotationFromQuaternion(t),this.applyMatrix4(Li),this}rotateX(t){return Li.makeRotationX(t),this.applyMatrix4(Li),this}rotateY(t){return Li.makeRotationY(t),this.applyMatrix4(Li),this}rotateZ(t){return Li.makeRotationZ(t),this.applyMatrix4(Li),this}translate(t,n,a){return Li.makeTranslation(t,n,a),this.applyMatrix4(Li),this}scale(t,n,a){return Li.makeScale(t,n,a),this.applyMatrix4(Li),this}lookAt(t){return rp.lookAt(t),rp.updateMatrix(),this.applyMatrix4(rp.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(oo).negate(),this.translate(oo.x,oo.y,oo.z),this}setFromPoints(t){const n=this.getAttribute("position");if(n===void 0){const a=[];for(let o=0,c=t.length;o<c;o++){const u=t[o];a.push(u.x,u.y,u.z||0)}this.setAttribute("position",new Mn(a,3))}else{const a=Math.min(t.length,n.count);for(let o=0;o<a;o++){const c=t[o];n.setXYZ(o,c.x,c.y,c.z||0)}t.length>n.count&&me("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),n.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new _s);const t=this.attributes.position,n=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){Oe("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new z(-1/0,-1/0,-1/0),new z(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),n)for(let a=0,o=n.length;a<o;a++){const c=n[a];_i.setFromBufferAttribute(c),this.morphTargetsRelative?(Cn.addVectors(this.boundingBox.min,_i.min),this.boundingBox.expandByPoint(Cn),Cn.addVectors(this.boundingBox.max,_i.max),this.boundingBox.expandByPoint(Cn)):(this.boundingBox.expandByPoint(_i.min),this.boundingBox.expandByPoint(_i.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Oe('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new vs);const t=this.attributes.position,n=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){Oe("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new z,1/0);return}if(t){const a=this.boundingSphere.center;if(_i.setFromBufferAttribute(t),n)for(let c=0,u=n.length;c<u;c++){const d=n[c];Rl.setFromBufferAttribute(d),this.morphTargetsRelative?(Cn.addVectors(_i.min,Rl.min),_i.expandByPoint(Cn),Cn.addVectors(_i.max,Rl.max),_i.expandByPoint(Cn)):(_i.expandByPoint(Rl.min),_i.expandByPoint(Rl.max))}_i.getCenter(a);let o=0;for(let c=0,u=t.count;c<u;c++)Cn.fromBufferAttribute(t,c),o=Math.max(o,a.distanceToSquared(Cn));if(n)for(let c=0,u=n.length;c<u;c++){const d=n[c],m=this.morphTargetsRelative;for(let p=0,_=d.count;p<_;p++)Cn.fromBufferAttribute(d,p),m&&(oo.fromBufferAttribute(t,p),Cn.add(oo)),o=Math.max(o,a.distanceToSquared(Cn))}this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&Oe('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,n=this.attributes;if(t===null||n.position===void 0||n.normal===void 0||n.uv===void 0){Oe("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const a=n.position,o=n.normal,c=n.uv;let u=this.getAttribute("tangent");(u===void 0||u.count!==a.count)&&(u=new Vn(new Float32Array(4*a.count),4),this.setAttribute("tangent",u));const d=[],m=[];for(let T=0;T<a.count;T++)d[T]=new z,m[T]=new z;const p=new z,_=new z,v=new z,g=new fe,y=new fe,E=new fe,A=new z,x=new z;function S(T,O,W){p.fromBufferAttribute(a,T),_.fromBufferAttribute(a,O),v.fromBufferAttribute(a,W),g.fromBufferAttribute(c,T),y.fromBufferAttribute(c,O),E.fromBufferAttribute(c,W),_.sub(p),v.sub(p),y.sub(g),E.sub(g);const k=1/(y.x*E.y-E.x*y.y);isFinite(k)&&(A.copy(_).multiplyScalar(E.y).addScaledVector(v,-y.y).multiplyScalar(k),x.copy(v).multiplyScalar(y.x).addScaledVector(_,-E.x).multiplyScalar(k),d[T].add(A),d[O].add(A),d[W].add(A),m[T].add(x),m[O].add(x),m[W].add(x))}let D=this.groups;D.length===0&&(D=[{start:0,count:t.count}]);for(let T=0,O=D.length;T<O;++T){const W=D[T],k=W.start,Q=W.count;for(let dt=k,vt=k+Q;dt<vt;dt+=3)S(t.getX(dt+0),t.getX(dt+1),t.getX(dt+2))}const U=new z,w=new z,B=new z,N=new z;function P(T){B.fromBufferAttribute(o,T),N.copy(B);const O=d[T];U.copy(O),U.sub(B.multiplyScalar(B.dot(O))).normalize(),w.crossVectors(N,O);const k=w.dot(m[T])<0?-1:1;u.setXYZW(T,U.x,U.y,U.z,k)}for(let T=0,O=D.length;T<O;++T){const W=D[T],k=W.start,Q=W.count;for(let dt=k,vt=k+Q;dt<vt;dt+=3)P(t.getX(dt+0)),P(t.getX(dt+1)),P(t.getX(dt+2))}this._transformed=!0}computeVertexNormals(){const t=this.index,n=this.getAttribute("position");if(n!==void 0){let a=this.getAttribute("normal");if(a===void 0||a.count!==n.count)a=new Vn(new Float32Array(n.count*3),3),this.setAttribute("normal",a);else for(let g=0,y=a.count;g<y;g++)a.setXYZ(g,0,0,0);const o=new z,c=new z,u=new z,d=new z,m=new z,p=new z,_=new z,v=new z;if(t)for(let g=0,y=t.count;g<y;g+=3){const E=t.getX(g+0),A=t.getX(g+1),x=t.getX(g+2);o.fromBufferAttribute(n,E),c.fromBufferAttribute(n,A),u.fromBufferAttribute(n,x),_.subVectors(u,c),v.subVectors(o,c),_.cross(v),d.fromBufferAttribute(a,E),m.fromBufferAttribute(a,A),p.fromBufferAttribute(a,x),d.add(_),m.add(_),p.add(_),a.setXYZ(E,d.x,d.y,d.z),a.setXYZ(A,m.x,m.y,m.z),a.setXYZ(x,p.x,p.y,p.z)}else for(let g=0,y=n.count;g<y;g+=3)o.fromBufferAttribute(n,g+0),c.fromBufferAttribute(n,g+1),u.fromBufferAttribute(n,g+2),_.subVectors(u,c),v.subVectors(o,c),_.cross(v),a.setXYZ(g+0,_.x,_.y,_.z),a.setXYZ(g+1,_.x,_.y,_.z),a.setXYZ(g+2,_.x,_.y,_.z);this.normalizeNormals(),a.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let n=0,a=t.count;n<a;n++)Cn.fromBufferAttribute(t,n),Cn.normalize(),t.setXYZ(n,Cn.x,Cn.y,Cn.z)}toNonIndexed(){function t(d,m){const p=d.array,_=d.itemSize,v=d.normalized,g=new p.constructor(m.length*_);let y=0,E=0;for(let A=0,x=m.length;A<x;A++){d.isInterleavedBufferAttribute?y=m[A]*d.data.stride+d.offset:y=m[A]*_;for(let S=0;S<_;S++)g[E++]=p[y++]}return new Vn(g,_,v)}if(this.index===null)return me("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new Dn,a=this.index.array,o=this.attributes;for(const d in o){const m=o[d],p=t(m,a);n.setAttribute(d,p)}const c=this.morphAttributes;for(const d in c){const m=[],p=c[d];for(let _=0,v=p.length;_<v;_++){const g=p[_],y=t(g,a);m.push(y)}n.morphAttributes[d]=m}n.morphTargetsRelative=this.morphTargetsRelative;const u=this.groups;for(let d=0,m=u.length;d<m;d++){const p=u[d];n.addGroup(p.start,p.count,p.materialIndex)}return n}toJSON(){const t={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){const m=this.parameters;for(const p in m)m[p]!==void 0&&(t[p]=m[p]);return t}t.data={attributes:{}};const n=this.index;n!==null&&(t.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const a=this.attributes;for(const m in a){const p=a[m];t.data.attributes[m]=p.toJSON(t.data)}const o={};let c=!1;for(const m in this.morphAttributes){const p=this.morphAttributes[m],_=[];for(let v=0,g=p.length;v<g;v++){const y=p[v];_.push(y.toJSON(t.data))}_.length>0&&(o[m]=_,c=!0)}c&&(t.data.morphAttributes=o,t.data.morphTargetsRelative=this.morphTargetsRelative);const u=this.groups;u.length>0&&(t.data.groups=JSON.parse(JSON.stringify(u)));const d=this.boundingSphere;return d!==null&&(t.data.boundingSphere=d.toJSON()),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=t.name;const a=t.index;a!==null&&this.setIndex(a.clone());const o=t.attributes;for(const p in o){const _=o[p];this.setAttribute(p,_.clone(n))}const c=t.morphAttributes;for(const p in c){const _=[],v=c[p];for(let g=0,y=v.length;g<y;g++)_.push(v[g].clone(n));this.morphAttributes[p]=_}this.morphTargetsRelative=t.morphTargetsRelative;const u=t.groups;for(let p=0,_=u.length;p<_;p++){const v=u[p];this.addGroup(v.start,v.count,v.materialIndex)}const d=t.boundingBox;d!==null&&(this.boundingBox=d.clone());const m=t.boundingSphere;return m!==null&&(this.boundingSphere=m.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this._transformed=t._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}}class BT{constructor(t,n){this.isInterleavedBuffer=!0,this.array=t,this.stride=n,this.count=t!==void 0?t.length/n:0,this.usage=mm,this.updateRanges=[],this.version=0,this.uuid=Fa()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,n){this.updateRanges.push({start:t,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,n,a){t*=this.stride,a*=n.stride;for(let o=0,c=this.stride;o<c;o++)this.array[t+o]=n.array[a+o];return this}set(t,n=0){return this.array.set(t,n),this}clone(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Fa()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const n=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),a=new this.constructor(n,this.stride);return a.setUsage(this.usage),a}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Fa()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Yn=new z;class hf{constructor(t,n,a,o=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=n,this.offset=a,this.normalized=o}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let n=0,a=this.data.count;n<a;n++)Yn.fromBufferAttribute(this,n),Yn.applyMatrix4(t),this.setXYZ(n,Yn.x,Yn.y,Yn.z);return this}applyNormalMatrix(t){for(let n=0,a=this.count;n<a;n++)Yn.fromBufferAttribute(this,n),Yn.applyNormalMatrix(t),this.setXYZ(n,Yn.x,Yn.y,Yn.z);return this}transformDirection(t){for(let n=0,a=this.count;n<a;n++)Yn.fromBufferAttribute(this,n),Yn.transformDirection(t),this.setXYZ(n,Yn.x,Yn.y,Yn.z);return this}getComponent(t,n){let a=this.array[t*this.data.stride+this.offset+n];return this.normalized&&(a=ki(a,this.array)),a}setComponent(t,n,a){return this.normalized&&(a=Ze(a,this.array)),this.data.array[t*this.data.stride+this.offset+n]=a,this}setX(t,n){return this.normalized&&(n=Ze(n,this.array)),this.data.array[t*this.data.stride+this.offset]=n,this}setY(t,n){return this.normalized&&(n=Ze(n,this.array)),this.data.array[t*this.data.stride+this.offset+1]=n,this}setZ(t,n){return this.normalized&&(n=Ze(n,this.array)),this.data.array[t*this.data.stride+this.offset+2]=n,this}setW(t,n){return this.normalized&&(n=Ze(n,this.array)),this.data.array[t*this.data.stride+this.offset+3]=n,this}getX(t){let n=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(n=ki(n,this.array)),n}getY(t){let n=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(n=ki(n,this.array)),n}getZ(t){let n=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(n=ki(n,this.array)),n}getW(t){let n=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(n=ki(n,this.array)),n}setXY(t,n,a){return t=t*this.data.stride+this.offset,this.normalized&&(n=Ze(n,this.array),a=Ze(a,this.array)),this.data.array[t+0]=n,this.data.array[t+1]=a,this}setXYZ(t,n,a,o){return t=t*this.data.stride+this.offset,this.normalized&&(n=Ze(n,this.array),a=Ze(a,this.array),o=Ze(o,this.array)),this.data.array[t+0]=n,this.data.array[t+1]=a,this.data.array[t+2]=o,this}setXYZW(t,n,a,o,c){return t=t*this.data.stride+this.offset,this.normalized&&(n=Ze(n,this.array),a=Ze(a,this.array),o=Ze(o,this.array),c=Ze(c,this.array)),this.data.array[t+0]=n,this.data.array[t+1]=a,this.data.array[t+2]=o,this.data.array[t+3]=c,this}clone(t){if(t===void 0){ff("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const n=[];for(let a=0;a<this.count;a++){const o=a*this.data.stride+this.offset;for(let c=0;c<this.itemSize;c++)n.push(this.data.array[o+c])}return new Vn(new this.array.constructor(n),this.itemSize,this.normalized)}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new hf(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){ff("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const n=[];for(let a=0;a<this.count;a++){const o=a*this.data.stride+this.offset;for(let c=0;c<this.itemSize;c++)n.push(this.data.array[o+c])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:n,normalized:this.normalized}}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}let IT=0;class Ur extends gs{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:IT++}),this.uuid=Fa(),this.name="",this.type="Material",this.blending=xo,this.side=Dr,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Rp,this.blendDst=wp,this.blendEquation=ls,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ce(0,0,0),this.blendAlpha=0,this.depthFunc=Eo,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=rx,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Js,this.stencilZFail=Js,this.stencilZPass=Js,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(const n in t){const a=t[n];if(a===void 0){me(`Material: parameter '${n}' has value of undefined.`);continue}const o=this[n];if(o===void 0){me(`Material: '${n}' is not a property of THREE.${this.type}.`);continue}o&&o.isColor?o.set(a):o&&o.isVector2&&a&&a.isVector2||o&&o.isEuler&&a&&a.isEuler||o&&o.isVector3&&a&&a.isVector3?o.copy(a):this[n]=a}}toJSON(t){const n=t===void 0||typeof t=="string";n&&(t={textures:{},images:{}});const a={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};a.uuid=this.uuid,a.type=this.type,this.name!==""&&(a.name=this.name),this.color&&this.color.isColor&&(a.color=this.color.getHex()),this.roughness!==void 0&&(a.roughness=this.roughness),this.metalness!==void 0&&(a.metalness=this.metalness),this.sheen!==void 0&&(a.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(a.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(a.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(a.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(a.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(a.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(a.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(a.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(a.shininess=this.shininess),this.clearcoat!==void 0&&(a.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(a.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(a.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(a.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(a.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,a.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(a.sheenColorMap=this.sheenColorMap.toJSON(t).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(a.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(t).uuid),this.dispersion!==void 0&&(a.dispersion=this.dispersion),this.iridescence!==void 0&&(a.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(a.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(a.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(a.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(a.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(a.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(a.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(a.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(a.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(a.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(a.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(a.lightMap=this.lightMap.toJSON(t).uuid,a.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(a.aoMap=this.aoMap.toJSON(t).uuid,a.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(a.bumpMap=this.bumpMap.toJSON(t).uuid,a.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(a.normalMap=this.normalMap.toJSON(t).uuid,a.normalMapType=this.normalMapType,a.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(a.displacementMap=this.displacementMap.toJSON(t).uuid,a.displacementScale=this.displacementScale,a.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(a.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(a.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(a.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(a.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(a.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(a.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(a.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(a.combine=this.combine)),this.envMapRotation!==void 0&&(a.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(a.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(a.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(a.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(a.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(a.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(a.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(a.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(a.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(a.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(a.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(a.size=this.size),this.shadowSide!==null&&(a.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(a.sizeAttenuation=this.sizeAttenuation),this.blending!==xo&&(a.blending=this.blending),this.side!==Dr&&(a.side=this.side),this.vertexColors===!0&&(a.vertexColors=!0),this.opacity<1&&(a.opacity=this.opacity),this.transparent===!0&&(a.transparent=!0),this.blendSrc!==Rp&&(a.blendSrc=this.blendSrc),this.blendDst!==wp&&(a.blendDst=this.blendDst),this.blendEquation!==ls&&(a.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(a.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(a.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(a.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(a.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(a.blendAlpha=this.blendAlpha),this.depthFunc!==Eo&&(a.depthFunc=this.depthFunc),this.depthTest===!1&&(a.depthTest=this.depthTest),this.depthWrite===!1&&(a.depthWrite=this.depthWrite),this.colorWrite===!1&&(a.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(a.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==rx&&(a.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(a.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(a.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Js&&(a.stencilFail=this.stencilFail),this.stencilZFail!==Js&&(a.stencilZFail=this.stencilZFail),this.stencilZPass!==Js&&(a.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(a.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(a.rotation=this.rotation),this.polygonOffset===!0&&(a.polygonOffset=!0),this.polygonOffsetFactor!==0&&(a.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(a.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(a.linewidth=this.linewidth),this.dashSize!==void 0&&(a.dashSize=this.dashSize),this.gapSize!==void 0&&(a.gapSize=this.gapSize),this.scale!==void 0&&(a.scale=this.scale),this.dithering===!0&&(a.dithering=!0),this.alphaTest>0&&(a.alphaTest=this.alphaTest),this.alphaHash===!0&&(a.alphaHash=!0),this.alphaToCoverage===!0&&(a.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(a.premultipliedAlpha=!0),this.forceSinglePass===!0&&(a.forceSinglePass=!0),this.allowOverride===!1&&(a.allowOverride=!1),this.wireframe===!0&&(a.wireframe=!0),this.wireframeLinewidth>1&&(a.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(a.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(a.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(a.flatShading=!0),this.visible===!1&&(a.visible=!1),this.toneMapped===!1&&(a.toneMapped=!1),this.fog===!1&&(a.fog=!1),Object.keys(this.userData).length>0&&(a.userData=this.userData);function o(c){const u=[];for(const d in c){const m=c[d];delete m.metadata,u.push(m)}return u}if(n){const c=o(t.textures),u=o(t.images);c.length>0&&(a.textures=c),u.length>0&&(a.images=u)}return a}fromJSON(t,n){if(t.uuid!==void 0&&(this.uuid=t.uuid),t.name!==void 0&&(this.name=t.name),t.color!==void 0&&this.color!==void 0&&this.color.setHex(t.color),t.roughness!==void 0&&(this.roughness=t.roughness),t.metalness!==void 0&&(this.metalness=t.metalness),t.sheen!==void 0&&(this.sheen=t.sheen),t.sheenColor!==void 0&&(this.sheenColor=new ce().setHex(t.sheenColor)),t.sheenRoughness!==void 0&&(this.sheenRoughness=t.sheenRoughness),t.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(t.emissive),t.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(t.specular),t.specularIntensity!==void 0&&(this.specularIntensity=t.specularIntensity),t.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(t.specularColor),t.shininess!==void 0&&(this.shininess=t.shininess),t.clearcoat!==void 0&&(this.clearcoat=t.clearcoat),t.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=t.clearcoatRoughness),t.dispersion!==void 0&&(this.dispersion=t.dispersion),t.iridescence!==void 0&&(this.iridescence=t.iridescence),t.iridescenceIOR!==void 0&&(this.iridescenceIOR=t.iridescenceIOR),t.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=t.iridescenceThicknessRange),t.transmission!==void 0&&(this.transmission=t.transmission),t.thickness!==void 0&&(this.thickness=t.thickness),t.attenuationDistance!==void 0&&(this.attenuationDistance=t.attenuationDistance),t.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(t.attenuationColor),t.anisotropy!==void 0&&(this.anisotropy=t.anisotropy),t.anisotropyRotation!==void 0&&(this.anisotropyRotation=t.anisotropyRotation),t.fog!==void 0&&(this.fog=t.fog),t.flatShading!==void 0&&(this.flatShading=t.flatShading),t.blending!==void 0&&(this.blending=t.blending),t.combine!==void 0&&(this.combine=t.combine),t.side!==void 0&&(this.side=t.side),t.shadowSide!==void 0&&(this.shadowSide=t.shadowSide),t.opacity!==void 0&&(this.opacity=t.opacity),t.transparent!==void 0&&(this.transparent=t.transparent),t.alphaTest!==void 0&&(this.alphaTest=t.alphaTest),t.alphaHash!==void 0&&(this.alphaHash=t.alphaHash),t.depthFunc!==void 0&&(this.depthFunc=t.depthFunc),t.depthTest!==void 0&&(this.depthTest=t.depthTest),t.depthWrite!==void 0&&(this.depthWrite=t.depthWrite),t.colorWrite!==void 0&&(this.colorWrite=t.colorWrite),t.blendSrc!==void 0&&(this.blendSrc=t.blendSrc),t.blendDst!==void 0&&(this.blendDst=t.blendDst),t.blendEquation!==void 0&&(this.blendEquation=t.blendEquation),t.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=t.blendSrcAlpha),t.blendDstAlpha!==void 0&&(this.blendDstAlpha=t.blendDstAlpha),t.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=t.blendEquationAlpha),t.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(t.blendColor),t.blendAlpha!==void 0&&(this.blendAlpha=t.blendAlpha),t.stencilWriteMask!==void 0&&(this.stencilWriteMask=t.stencilWriteMask),t.stencilFunc!==void 0&&(this.stencilFunc=t.stencilFunc),t.stencilRef!==void 0&&(this.stencilRef=t.stencilRef),t.stencilFuncMask!==void 0&&(this.stencilFuncMask=t.stencilFuncMask),t.stencilFail!==void 0&&(this.stencilFail=t.stencilFail),t.stencilZFail!==void 0&&(this.stencilZFail=t.stencilZFail),t.stencilZPass!==void 0&&(this.stencilZPass=t.stencilZPass),t.stencilWrite!==void 0&&(this.stencilWrite=t.stencilWrite),t.wireframe!==void 0&&(this.wireframe=t.wireframe),t.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=t.wireframeLinewidth),t.wireframeLinecap!==void 0&&(this.wireframeLinecap=t.wireframeLinecap),t.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=t.wireframeLinejoin),t.rotation!==void 0&&(this.rotation=t.rotation),t.linewidth!==void 0&&(this.linewidth=t.linewidth),t.dashSize!==void 0&&(this.dashSize=t.dashSize),t.gapSize!==void 0&&(this.gapSize=t.gapSize),t.scale!==void 0&&(this.scale=t.scale),t.polygonOffset!==void 0&&(this.polygonOffset=t.polygonOffset),t.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=t.polygonOffsetFactor),t.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=t.polygonOffsetUnits),t.dithering!==void 0&&(this.dithering=t.dithering),t.alphaToCoverage!==void 0&&(this.alphaToCoverage=t.alphaToCoverage),t.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=t.premultipliedAlpha),t.forceSinglePass!==void 0&&(this.forceSinglePass=t.forceSinglePass),t.allowOverride!==void 0&&(this.allowOverride=t.allowOverride),t.visible!==void 0&&(this.visible=t.visible),t.toneMapped!==void 0&&(this.toneMapped=t.toneMapped),t.userData!==void 0&&(this.userData=t.userData),t.vertexColors!==void 0&&(typeof t.vertexColors=="number"?this.vertexColors=t.vertexColors>0:this.vertexColors=t.vertexColors),t.size!==void 0&&(this.size=t.size),t.sizeAttenuation!==void 0&&(this.sizeAttenuation=t.sizeAttenuation),t.map!==void 0&&(this.map=n[t.map]||null),t.matcap!==void 0&&(this.matcap=n[t.matcap]||null),t.alphaMap!==void 0&&(this.alphaMap=n[t.alphaMap]||null),t.bumpMap!==void 0&&(this.bumpMap=n[t.bumpMap]||null),t.bumpScale!==void 0&&(this.bumpScale=t.bumpScale),t.normalMap!==void 0&&(this.normalMap=n[t.normalMap]||null),t.normalMapType!==void 0&&(this.normalMapType=t.normalMapType),t.normalScale!==void 0){let a=t.normalScale;Array.isArray(a)===!1&&(a=[a,a]),this.normalScale=new fe().fromArray(a)}return t.displacementMap!==void 0&&(this.displacementMap=n[t.displacementMap]||null),t.displacementScale!==void 0&&(this.displacementScale=t.displacementScale),t.displacementBias!==void 0&&(this.displacementBias=t.displacementBias),t.roughnessMap!==void 0&&(this.roughnessMap=n[t.roughnessMap]||null),t.metalnessMap!==void 0&&(this.metalnessMap=n[t.metalnessMap]||null),t.emissiveMap!==void 0&&(this.emissiveMap=n[t.emissiveMap]||null),t.emissiveIntensity!==void 0&&(this.emissiveIntensity=t.emissiveIntensity),t.specularMap!==void 0&&(this.specularMap=n[t.specularMap]||null),t.specularIntensityMap!==void 0&&(this.specularIntensityMap=n[t.specularIntensityMap]||null),t.specularColorMap!==void 0&&(this.specularColorMap=n[t.specularColorMap]||null),t.envMap!==void 0&&(this.envMap=n[t.envMap]||null),t.envMapRotation!==void 0&&this.envMapRotation.fromArray(t.envMapRotation),t.envMapIntensity!==void 0&&(this.envMapIntensity=t.envMapIntensity),t.reflectivity!==void 0&&(this.reflectivity=t.reflectivity),t.refractionRatio!==void 0&&(this.refractionRatio=t.refractionRatio),t.lightMap!==void 0&&(this.lightMap=n[t.lightMap]||null),t.lightMapIntensity!==void 0&&(this.lightMapIntensity=t.lightMapIntensity),t.aoMap!==void 0&&(this.aoMap=n[t.aoMap]||null),t.aoMapIntensity!==void 0&&(this.aoMapIntensity=t.aoMapIntensity),t.gradientMap!==void 0&&(this.gradientMap=n[t.gradientMap]||null),t.clearcoatMap!==void 0&&(this.clearcoatMap=n[t.clearcoatMap]||null),t.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=n[t.clearcoatRoughnessMap]||null),t.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=n[t.clearcoatNormalMap]||null),t.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new fe().fromArray(t.clearcoatNormalScale)),t.iridescenceMap!==void 0&&(this.iridescenceMap=n[t.iridescenceMap]||null),t.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=n[t.iridescenceThicknessMap]||null),t.transmissionMap!==void 0&&(this.transmissionMap=n[t.transmissionMap]||null),t.thicknessMap!==void 0&&(this.thicknessMap=n[t.thicknessMap]||null),t.anisotropyMap!==void 0&&(this.anisotropyMap=n[t.anisotropyMap]||null),t.sheenColorMap!==void 0&&(this.sheenColorMap=n[t.sheenColorMap]||null),t.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=n[t.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const n=t.clippingPlanes;let a=null;if(n!==null){const o=n.length;a=new Array(o);for(let c=0;c!==o;++c)a[c]=n[c].clone()}return this.clippingPlanes=a,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.allowOverride=t.allowOverride,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}}class tf extends Ur{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new ce(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}let lo;const wl=new z,co=new z,uo=new z,fo=new fe,Cl=new fe,cS=new ze,xu=new z,Dl=new z,yu=new z,Sx=new fe,sp=new fe,Mx=new fe;class op extends hn{constructor(t=new tf){if(super(),this.isSprite=!0,this.type="Sprite",lo===void 0){lo=new Dn;const n=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),a=new BT(n,5);lo.setIndex([0,1,2,0,2,3]),lo.setAttribute("position",new hf(a,3,0,!1)),lo.setAttribute("uv",new hf(a,2,3,!1))}this.geometry=lo,this.material=t,this.center=new fe(.5,.5),this.count=1}raycast(t,n){t.camera===null&&Oe('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),co.setFromMatrixScale(this.matrixWorld),cS.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),uo.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&co.multiplyScalar(-uo.z);const a=this.material.rotation;let o,c;a!==0&&(c=Math.cos(a),o=Math.sin(a));const u=this.center;Su(xu.set(-.5,-.5,0),uo,u,co,o,c),Su(Dl.set(.5,-.5,0),uo,u,co,o,c),Su(yu.set(.5,.5,0),uo,u,co,o,c),Sx.set(0,0),sp.set(1,0),Mx.set(1,1);let d=t.ray.intersectTriangle(xu,Dl,yu,!1,wl);if(d===null&&(Su(Dl.set(-.5,.5,0),uo,u,co,o,c),sp.set(0,1),d=t.ray.intersectTriangle(xu,yu,Dl,!1,wl),d===null))return;const m=t.ray.origin.distanceTo(wl);m<t.near||m>t.far||n.push({distance:m,point:wl.clone(),uv:Si.getInterpolation(wl,xu,Dl,yu,Sx,sp,Mx,new fe),face:null,object:this})}copy(t,n){return super.copy(t,n),t.center!==void 0&&this.center.copy(t.center),this.material=t.material,this}}function Su(r,t,n,a,o,c){fo.subVectors(r,n).addScalar(.5).multiply(a),o!==void 0?(Cl.x=c*fo.x-o*fo.y,Cl.y=o*fo.x+c*fo.y):Cl.copy(fo),r.copy(t),r.x+=Cl.x,r.y+=Cl.y,r.applyMatrix4(cS)}const Oa=new z,lp=new z,Mu=new z,Er=new z,cp=new z,Eu=new z,up=new z;class Zm{constructor(t=new z,n=new z(0,0,-1)){this.origin=t,this.direction=n}set(t,n){return this.origin.copy(t),this.direction.copy(n),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,n){return n.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Oa)),this}closestPointToPoint(t,n){n.subVectors(t,this.origin);const a=n.dot(this.direction);return a<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,a)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const n=Oa.subVectors(t,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(t):(Oa.copy(this.origin).addScaledVector(this.direction,n),Oa.distanceToSquared(t))}distanceSqToSegment(t,n,a,o){lp.copy(t).add(n).multiplyScalar(.5),Mu.copy(n).sub(t).normalize(),Er.copy(this.origin).sub(lp);const c=t.distanceTo(n)*.5,u=-this.direction.dot(Mu),d=Er.dot(this.direction),m=-Er.dot(Mu),p=Er.lengthSq(),_=Math.abs(1-u*u);let v,g,y,E;if(_>0)if(v=u*m-d,g=u*d-m,E=c*_,v>=0)if(g>=-E)if(g<=E){const A=1/_;v*=A,g*=A,y=v*(v+u*g+2*d)+g*(u*v+g+2*m)+p}else g=c,v=Math.max(0,-(u*g+d)),y=-v*v+g*(g+2*m)+p;else g=-c,v=Math.max(0,-(u*g+d)),y=-v*v+g*(g+2*m)+p;else g<=-E?(v=Math.max(0,-(-u*c+d)),g=v>0?-c:Math.min(Math.max(-c,-m),c),y=-v*v+g*(g+2*m)+p):g<=E?(v=0,g=Math.min(Math.max(-c,-m),c),y=g*(g+2*m)+p):(v=Math.max(0,-(u*c+d)),g=v>0?c:Math.min(Math.max(-c,-m),c),y=-v*v+g*(g+2*m)+p);else g=u>0?-c:c,v=Math.max(0,-(u*g+d)),y=-v*v+g*(g+2*m)+p;return a&&a.copy(this.origin).addScaledVector(this.direction,v),o&&o.copy(lp).addScaledVector(Mu,g),y}intersectSphere(t,n){Oa.subVectors(t.center,this.origin);const a=Oa.dot(this.direction),o=Oa.dot(Oa)-a*a,c=t.radius*t.radius;if(o>c)return null;const u=Math.sqrt(c-o),d=a-u,m=a+u;return m<0?null:d<0?this.at(m,n):this.at(d,n)}intersectsSphere(t){return t.radius<0?!1:this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const n=t.normal.dot(this.direction);if(n===0)return t.distanceToPoint(this.origin)===0?0:null;const a=-(this.origin.dot(t.normal)+t.constant)/n;return a>=0?a:null}intersectPlane(t,n){const a=this.distanceToPlane(t);return a===null?null:this.at(a,n)}intersectsPlane(t){const n=t.distanceToPoint(this.origin);return n===0||t.normal.dot(this.direction)*n<0}intersectBox(t,n){let a,o,c,u,d,m;const p=1/this.direction.x,_=1/this.direction.y,v=1/this.direction.z,g=this.origin;return p>=0?(a=(t.min.x-g.x)*p,o=(t.max.x-g.x)*p):(a=(t.max.x-g.x)*p,o=(t.min.x-g.x)*p),_>=0?(c=(t.min.y-g.y)*_,u=(t.max.y-g.y)*_):(c=(t.max.y-g.y)*_,u=(t.min.y-g.y)*_),a>u||c>o||((c>a||isNaN(a))&&(a=c),(u<o||isNaN(o))&&(o=u),v>=0?(d=(t.min.z-g.z)*v,m=(t.max.z-g.z)*v):(d=(t.max.z-g.z)*v,m=(t.min.z-g.z)*v),a>m||d>o)||((d>a||a!==a)&&(a=d),(m<o||o!==o)&&(o=m),o<0)?null:this.at(a>=0?a:o,n)}intersectsBox(t){return this.intersectBox(t,Oa)!==null}intersectTriangle(t,n,a,o,c){cp.subVectors(n,t),Eu.subVectors(a,t),up.crossVectors(cp,Eu);let u=this.direction.dot(up),d;if(u>0){if(o)return null;d=1}else if(u<0)d=-1,u=-u;else return null;Er.subVectors(this.origin,t);const m=d*this.direction.dot(Eu.crossVectors(Er,Eu));if(m<0)return null;const p=d*this.direction.dot(cp.cross(Er));if(p<0||m+p>u)return null;const _=-d*Er.dot(up);return _<0?null:this.at(_/u,c)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class bf extends Ur{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ce(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 ua,this.combine=ky,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const Ex=new ze,es=new Zm,bu=new vs,bx=new z,Tu=new z,Au=new z,Ru=new z,fp=new z,wu=new z,Tx=new z,Cu=new z;class ln extends hn{constructor(t=new Dn,n=new bf){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(t,n){return super.copy(t,n),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const n=this.geometry.morphAttributes,a=Object.keys(n);if(a.length>0){const o=n[a[0]];if(o!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let c=0,u=o.length;c<u;c++){const d=o[c].name||String(c);this.morphTargetInfluences.push(0),this.morphTargetDictionary[d]=c}}}}getVertexPosition(t,n){const a=this.geometry,o=a.attributes.position,c=a.morphAttributes.position,u=a.morphTargetsRelative;n.fromBufferAttribute(o,t);const d=this.morphTargetInfluences;if(c&&d){wu.set(0,0,0);for(let m=0,p=c.length;m<p;m++){const _=d[m],v=c[m];_!==0&&(fp.fromBufferAttribute(v,t),u?wu.addScaledVector(fp,_):wu.addScaledVector(fp.sub(n),_))}n.add(wu)}return n}raycast(t,n){const a=this.geometry,o=this.material,c=this.matrixWorld;o!==void 0&&(a.boundingSphere===null&&a.computeBoundingSphere(),bu.copy(a.boundingSphere),bu.applyMatrix4(c),es.copy(t.ray).recast(t.near),!(bu.containsPoint(es.origin)===!1&&(es.intersectSphere(bu,bx)===null||es.origin.distanceToSquared(bx)>(t.far-t.near)**2))&&(Ex.copy(c).invert(),es.copy(t.ray).applyMatrix4(Ex),!(a.boundingBox!==null&&es.intersectsBox(a.boundingBox)===!1)&&this._computeIntersections(t,n,es)))}_computeIntersections(t,n,a){let o;const c=this.geometry,u=this.material,d=c.index,m=c.attributes.position,p=c.attributes.uv,_=c.attributes.uv1,v=c.attributes.normal,g=c.groups,y=c.drawRange;if(d!==null)if(Array.isArray(u))for(let E=0,A=g.length;E<A;E++){const x=g[E],S=u[x.materialIndex],D=Math.max(x.start,y.start),U=Math.min(d.count,Math.min(x.start+x.count,y.start+y.count));for(let w=D,B=U;w<B;w+=3){const N=d.getX(w),P=d.getX(w+1),T=d.getX(w+2);o=Du(this,S,t,a,p,_,v,N,P,T),o&&(o.faceIndex=Math.floor(w/3),o.face.materialIndex=x.materialIndex,n.push(o))}}else{const E=Math.max(0,y.start),A=Math.min(d.count,y.start+y.count);for(let x=E,S=A;x<S;x+=3){const D=d.getX(x),U=d.getX(x+1),w=d.getX(x+2);o=Du(this,u,t,a,p,_,v,D,U,w),o&&(o.faceIndex=Math.floor(x/3),n.push(o))}}else if(m!==void 0)if(Array.isArray(u))for(let E=0,A=g.length;E<A;E++){const x=g[E],S=u[x.materialIndex],D=Math.max(x.start,y.start),U=Math.min(m.count,Math.min(x.start+x.count,y.start+y.count));for(let w=D,B=U;w<B;w+=3){const N=w,P=w+1,T=w+2;o=Du(this,S,t,a,p,_,v,N,P,T),o&&(o.faceIndex=Math.floor(w/3),o.face.materialIndex=x.materialIndex,n.push(o))}}else{const E=Math.max(0,y.start),A=Math.min(m.count,y.start+y.count);for(let x=E,S=A;x<S;x+=3){const D=x,U=x+1,w=x+2;o=Du(this,u,t,a,p,_,v,D,U,w),o&&(o.faceIndex=Math.floor(x/3),n.push(o))}}}}function zT(r,t,n,a,o,c,u,d){let m;if(t.side===ii?m=a.intersectTriangle(u,c,o,!0,d):m=a.intersectTriangle(o,c,u,t.side===Dr,d),m===null)return null;Cu.copy(d),Cu.applyMatrix4(r.matrixWorld);const p=n.ray.origin.distanceTo(Cu);return p<n.near||p>n.far?null:{distance:p,point:Cu.clone(),object:r}}function Du(r,t,n,a,o,c,u,d,m,p){r.getVertexPosition(d,Tu),r.getVertexPosition(m,Au),r.getVertexPosition(p,Ru);const _=zT(r,t,n,a,Tu,Au,Ru,Tx);if(_){const v=new z;Si.getBarycoord(Tx,Tu,Au,Ru,v),o&&(_.uv=Si.getInterpolatedAttribute(o,d,m,p,v,new fe)),c&&(_.uv1=Si.getInterpolatedAttribute(c,d,m,p,v,new fe)),u&&(_.normal=Si.getInterpolatedAttribute(u,d,m,p,v,new z),_.normal.dot(a.direction)>0&&_.normal.multiplyScalar(-1));const g={a:d,b:m,c:p,normal:new z,materialIndex:0};Si.getNormal(Tu,Au,Ru,g.normal),_.face=g,_.barycoord=v}return _}class uS extends Xn{constructor(t=null,n=1,a=1,o,c,u,d,m,p=Bn,_=Bn,v,g){super(null,u,d,m,p,_,o,c,v,g),this.isDataTexture=!0,this.image={data:t,width:n,height:a},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Tr extends Vn{constructor(t,n,a,o=1){super(t,n,a),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=o}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}const ho=new ze,Ax=new ze,Lu=[],Rx=new _s,FT=new ze,Ll=new ln,Ul=new vs;class hp extends ln{constructor(t,n,a){super(t,n),this.isInstancedMesh=!0,this.instanceMatrix=new Tr(new Float32Array(a*16),16),this.instanceColor=null,this.morphTexture=null,this.count=a,this.boundingBox=null,this.boundingSphere=null;for(let o=0;o<a;o++)this.setMatrixAt(o,FT)}computeBoundingBox(){const t=this.geometry,n=this.count;this.boundingBox===null&&(this.boundingBox=new _s),t.boundingBox===null&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let a=0;a<n;a++)this.getMatrixAt(a,ho),Rx.copy(t.boundingBox).applyMatrix4(ho),this.boundingBox.union(Rx)}computeBoundingSphere(){const t=this.geometry,n=this.count;this.boundingSphere===null&&(this.boundingSphere=new vs),t.boundingSphere===null&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let a=0;a<n;a++)this.getMatrixAt(a,ho),Ul.copy(t.boundingSphere).applyMatrix4(ho),this.boundingSphere.union(Ul)}copy(t,n){return super.copy(t,n),this.instanceMatrix.copy(t.instanceMatrix),t.morphTexture!==null&&(this.morphTexture=t.morphTexture.clone()),t.instanceColor!==null&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this}getColorAt(t,n){return this.instanceColor===null?n.setRGB(1,1,1):n.fromArray(this.instanceColor.array,t*3)}getMatrixAt(t,n){return n.fromArray(this.instanceMatrix.array,t*16)}getMorphAt(t,n){const a=n.morphTargetInfluences,o=this.morphTexture.source.data.data,c=a.length+1,u=t*c+1;for(let d=0;d<a.length;d++)a[d]=o[u+d]}raycast(t,n){const a=this.matrixWorld,o=this.count;if(Ll.geometry=this.geometry,Ll.material=this.material,Ll.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Ul.copy(this.boundingSphere),Ul.applyMatrix4(a),t.ray.intersectsSphere(Ul)!==!1))for(let c=0;c<o;c++){this.getMatrixAt(c,ho),Ax.multiplyMatrices(a,ho),Ll.matrixWorld=Ax,Ll.raycast(t,Lu);for(let u=0,d=Lu.length;u<d;u++){const m=Lu[u];m.instanceId=c,m.object=this,n.push(m)}Lu.length=0}}setColorAt(t,n){return this.instanceColor===null&&(this.instanceColor=new Tr(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),n.toArray(this.instanceColor.array,t*3),this}setMatrixAt(t,n){return n.toArray(this.instanceMatrix.array,t*16),this}setMorphAt(t,n){const a=n.morphTargetInfluences,o=a.length+1;this.morphTexture===null&&(this.morphTexture=new uS(new Float32Array(o*this.count),o,this.count,Fm,Wi));const c=this.morphTexture.source.data.data;let u=0;for(let p=0;p<a.length;p++)u+=a[p];const d=this.geometry.morphTargetsRelative?1:1-u,m=o*t;return c[m]=d,c.set(a,m+1),this}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const dp=new z,HT=new z,GT=new Se;class os{constructor(t=new z(1,0,0),n=0){this.isPlane=!0,this.normal=t,this.constant=n}set(t,n){return this.normal.copy(t),this.constant=n,this}setComponents(t,n,a,o){return this.normal.set(t,n,a),this.constant=o,this}setFromNormalAndCoplanarPoint(t,n){return this.normal.copy(t),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(t,n,a){const o=dp.subVectors(a,n).cross(HT.subVectors(t,n)).normalize();return this.setFromNormalAndCoplanarPoint(o,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,n){return n.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,n,a=!0){const o=t.delta(dp),c=this.normal.dot(o);if(c===0)return this.distanceToPoint(t.start)===0?n.copy(t.start):null;const u=-(t.start.dot(this.normal)+this.constant)/c;return a===!0&&(u<0||u>1)?null:n.copy(t.start).addScaledVector(o,u)}intersectsLine(t){const n=this.distanceToPoint(t.start),a=this.distanceToPoint(t.end);return n<0&&a>0||a<0&&n>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,n){const a=n||GT.getNormalMatrix(t),o=this.coplanarPoint(dp).applyMatrix4(t),c=this.normal.applyMatrix3(a).normalize();return this.constant=-o.dot(c),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}}const ns=new vs,VT=new fe(.5,.5),Uu=new z;class Km{constructor(t=new os,n=new os,a=new os,o=new os,c=new os,u=new os){this.planes=[t,n,a,o,c,u]}set(t,n,a,o,c,u){const d=this.planes;return d[0].copy(t),d[1].copy(n),d[2].copy(a),d[3].copy(o),d[4].copy(c),d[5].copy(u),this}copy(t){const n=this.planes;for(let a=0;a<6;a++)n[a].copy(t.planes[a]);return this}setFromProjectionMatrix(t,n=ra,a=!1){const o=this.planes,c=t.elements,u=c[0],d=c[1],m=c[2],p=c[3],_=c[4],v=c[5],g=c[6],y=c[7],E=c[8],A=c[9],x=c[10],S=c[11],D=c[12],U=c[13],w=c[14],B=c[15];if(o[0].setComponents(p-u,y-_,S-E,B-D).normalize(),o[1].setComponents(p+u,y+_,S+E,B+D).normalize(),o[2].setComponents(p+d,y+v,S+A,B+U).normalize(),o[3].setComponents(p-d,y-v,S-A,B-U).normalize(),a)o[4].setComponents(m,g,x,w).normalize(),o[5].setComponents(p-m,y-g,S-x,B-w).normalize();else if(o[4].setComponents(p-m,y-g,S-x,B-w).normalize(),n===ra)o[5].setComponents(p+m,y+g,S+x,B+w).normalize();else if(n===Xl)o[5].setComponents(m,g,x,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),ns.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const n=t.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),ns.copy(n.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(ns)}intersectsSprite(t){ns.center.set(0,0,0);const n=VT.distanceTo(t.center);return ns.radius=.7071067811865476+n,ns.applyMatrix4(t.matrixWorld),this.intersectsSphere(ns)}intersectsSphere(t){const n=this.planes,a=t.center,o=-t.radius;for(let c=0;c<6;c++)if(n[c].distanceToPoint(a)<o)return!1;return!0}intersectsBox(t){const n=this.planes;for(let a=0;a<6;a++){const o=n[a];if(Uu.x=o.normal.x>0?t.max.x:t.min.x,Uu.y=o.normal.y>0?t.max.y:t.min.y,Uu.z=o.normal.z>0?t.max.z:t.min.z,o.distanceToPoint(Uu)<0)return!1}return!0}containsPoint(t){const n=this.planes;for(let a=0;a<6;a++)if(n[a].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class fS extends Ur{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new ce(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}const df=new z,pf=new z,wx=new ze,Nl=new Zm,Nu=new vs,pp=new z,Cx=new z;class kT extends hn{constructor(t=new Dn,n=new fS){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,n){return super.copy(t,n),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(t.index===null){const n=t.attributes.position,a=[0];for(let o=1,c=n.count;o<c;o++)df.fromBufferAttribute(n,o-1),pf.fromBufferAttribute(n,o),a[o]=a[o-1],a[o]+=df.distanceTo(pf);t.setAttribute("lineDistance",new Mn(a,1))}else me("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,n){const a=this.geometry,o=this.matrixWorld,c=t.params.Line.threshold,u=a.drawRange;if(a.boundingSphere===null&&a.computeBoundingSphere(),Nu.copy(a.boundingSphere),Nu.applyMatrix4(o),Nu.radius+=c,t.ray.intersectsSphere(Nu)===!1)return;wx.copy(o).invert(),Nl.copy(t.ray).applyMatrix4(wx);const d=c/((this.scale.x+this.scale.y+this.scale.z)/3),m=d*d,p=this.isLineSegments?2:1,_=a.index,g=a.attributes.position;if(_!==null){const y=Math.max(0,u.start),E=Math.min(_.count,u.start+u.count);for(let A=y,x=E-1;A<x;A+=p){const S=_.getX(A),D=_.getX(A+1),U=Ou(this,t,Nl,m,S,D,A);U&&n.push(U)}if(this.isLineLoop){const A=_.getX(E-1),x=_.getX(y),S=Ou(this,t,Nl,m,A,x,E-1);S&&n.push(S)}}else{const y=Math.max(0,u.start),E=Math.min(g.count,u.start+u.count);for(let A=y,x=E-1;A<x;A+=p){const S=Ou(this,t,Nl,m,A,A+1,A);S&&n.push(S)}if(this.isLineLoop){const A=Ou(this,t,Nl,m,E-1,y,E-1);A&&n.push(A)}}}updateMorphTargets(){const n=this.geometry.morphAttributes,a=Object.keys(n);if(a.length>0){const o=n[a[0]];if(o!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let c=0,u=o.length;c<u;c++){const d=o[c].name||String(c);this.morphTargetInfluences.push(0),this.morphTargetDictionary[d]=c}}}}}function Ou(r,t,n,a,o,c,u){const d=r.geometry.attributes.position;if(df.fromBufferAttribute(d,o),pf.fromBufferAttribute(d,c),n.distanceSqToSegment(df,pf,pp,Cx)>a)return;pp.applyMatrix4(r.matrixWorld);const p=t.ray.origin.distanceTo(pp);if(!(p<t.near||p>t.far))return{distance:p,point:Cx.clone().applyMatrix4(r.matrixWorld),index:u,face:null,faceIndex:null,barycoord:null,object:r}}const Dx=new z,Lx=new z;class WT extends kT{constructor(t,n){super(t,n),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(t.index===null){const n=t.attributes.position,a=[];for(let o=0,c=n.count;o<c;o+=2)Dx.fromBufferAttribute(n,o),Lx.fromBufferAttribute(n,o+1),a[o]=o===0?0:a[o-1],a[o+1]=a[o]+Dx.distanceTo(Lx);t.setAttribute("lineDistance",new Mn(a,1))}else me("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class gm extends Ur{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new ce(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}const Ux=new ze,_m=new Zm,Pu=new vs,Bu=new z;class Nx extends hn{constructor(t=new Dn,n=new gm){super(),this.isPoints=!0,this.type="Points",this.geometry=t,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,n){return super.copy(t,n),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}raycast(t,n){const a=this.geometry,o=this.matrixWorld,c=t.params.Points.threshold,u=a.drawRange;if(a.boundingSphere===null&&a.computeBoundingSphere(),Pu.copy(a.boundingSphere),Pu.applyMatrix4(o),Pu.radius+=c,t.ray.intersectsSphere(Pu)===!1)return;Ux.copy(o).invert(),_m.copy(t.ray).applyMatrix4(Ux);const d=c/((this.scale.x+this.scale.y+this.scale.z)/3),m=d*d,p=a.index,v=a.attributes.position;if(p!==null){const g=Math.max(0,u.start),y=Math.min(p.count,u.start+u.count);for(let E=g,A=y;E<A;E++){const x=p.getX(E);Bu.fromBufferAttribute(v,x),Ox(Bu,x,m,o,t,n,this)}}else{const g=Math.max(0,u.start),y=Math.min(v.count,u.start+u.count);for(let E=g,A=y;E<A;E++)Bu.fromBufferAttribute(v,E),Ox(Bu,E,m,o,t,n,this)}}updateMorphTargets(){const n=this.geometry.morphAttributes,a=Object.keys(n);if(a.length>0){const o=n[a[0]];if(o!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let c=0,u=o.length;c<u;c++){const d=o[c].name||String(c);this.morphTargetInfluences.push(0),this.morphTargetDictionary[d]=c}}}}}function Ox(r,t,n,a,o,c,u){const d=_m.distanceSqToPoint(r);if(d<n){const m=new z;_m.closestPointToPoint(r,m),m.applyMatrix4(a);const p=o.ray.origin.distanceTo(m);if(p<o.near||p>o.far)return;c.push({distance:p,distanceToRay:Math.sqrt(d),point:m,index:t,face:null,faceIndex:null,barycoord:null,object:u})}}class hS extends Xn{constructor(t=[],n=ps,a,o,c,u,d,m,p,_){super(t,n,a,o,c,u,d,m,p,_),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class dS extends Xn{constructor(t,n,a,o,c,u,d,m,p){super(t,n,a,o,c,u,d,m,p),this.isCanvasTexture=!0,this.needsUpdate=!0}}class To extends Xn{constructor(t,n,a=ca,o,c,u,d=Bn,m=Bn,p,_=ka,v=1){if(_!==ka&&_!==hs)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const g={width:t,height:n,depth:v};super(g,o,c,u,d,m,_,a,p),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new qm(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){const n=super.toJSON(t);return this.compareFunction!==null&&(n.compareFunction=this.compareFunction),n}}class XT extends To{constructor(t,n=ca,a=ps,o,c,u=Bn,d=Bn,m,p=ka){const _={width:t,height:t,depth:1},v=[_,_,_,_,_,_];super(t,t,n,a,o,c,u,d,m,p),this.image=v,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(t){this.image=t}}class pS extends Xn{constructor(t=null){super(),this.sourceTexture=t,this.isExternalTexture=!0}copy(t){return super.copy(t),this.sourceTexture=t.sourceTexture,this}}class Jl extends Dn{constructor(t=1,n=1,a=1,o=1,c=1,u=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:n,depth:a,widthSegments:o,heightSegments:c,depthSegments:u};const d=this;o=Math.floor(o),c=Math.floor(c),u=Math.floor(u);const m=[],p=[],_=[],v=[];let g=0,y=0;E("z","y","x",-1,-1,a,n,t,u,c,0),E("z","y","x",1,-1,a,n,-t,u,c,1),E("x","z","y",1,1,t,a,n,o,u,2),E("x","z","y",1,-1,t,a,-n,o,u,3),E("x","y","z",1,-1,t,n,a,o,c,4),E("x","y","z",-1,-1,t,n,-a,o,c,5),this.setIndex(m),this.setAttribute("position",new Mn(p,3)),this.setAttribute("normal",new Mn(_,3)),this.setAttribute("uv",new Mn(v,2));function E(A,x,S,D,U,w,B,N,P,T,O){const W=w/P,k=B/T,Q=w/2,dt=B/2,vt=N/2,Z=P+1,F=T+1;let V=0,et=0;const mt=new z;for(let At=0;At<F;At++){const I=At*k-dt;for(let J=0;J<Z;J++){const bt=J*W-Q;mt[A]=bt*D,mt[x]=I*U,mt[S]=vt,p.push(mt.x,mt.y,mt.z),mt[A]=0,mt[x]=0,mt[S]=N>0?1:-1,_.push(mt.x,mt.y,mt.z),v.push(J/P),v.push(1-At/T),V+=1}}for(let At=0;At<T;At++)for(let I=0;I<P;I++){const J=g+I+Z*At,bt=g+I+Z*(At+1),Lt=g+(I+1)+Z*(At+1),Ht=g+(I+1)+Z*At;m.push(J,bt,Ht),m.push(bt,Lt,Ht),et+=6}d.addGroup(y,et,O),y+=et,g+=V}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Jl(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}class Co extends Dn{constructor(t=[],n=[],a=1,o=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:n,radius:a,detail:o};const c=[],u=[];d(o),p(a),_(),this.setAttribute("position",new Mn(c,3)),this.setAttribute("normal",new Mn(c.slice(),3)),this.setAttribute("uv",new Mn(u,2)),o===0?this.computeVertexNormals():this.normalizeNormals();function d(D){const U=new z,w=new z,B=new z;for(let N=0;N<n.length;N+=3)y(n[N+0],U),y(n[N+1],w),y(n[N+2],B),m(U,w,B,D)}function m(D,U,w,B){const N=B+1,P=[];for(let T=0;T<=N;T++){P[T]=[];const O=D.clone().lerp(w,T/N),W=U.clone().lerp(w,T/N),k=N-T;for(let Q=0;Q<=k;Q++)Q===0&&T===N?P[T][Q]=O:P[T][Q]=O.clone().lerp(W,Q/k)}for(let T=0;T<N;T++)for(let O=0;O<2*(N-T)-1;O++){const W=Math.floor(O/2);O%2===0?(g(P[T][W+1]),g(P[T+1][W]),g(P[T][W])):(g(P[T][W+1]),g(P[T+1][W+1]),g(P[T+1][W]))}}function p(D){const U=new z;for(let w=0;w<c.length;w+=3)U.x=c[w+0],U.y=c[w+1],U.z=c[w+2],U.normalize().multiplyScalar(D),c[w+0]=U.x,c[w+1]=U.y,c[w+2]=U.z}function _(){const D=new z;for(let U=0;U<c.length;U+=3){D.x=c[U+0],D.y=c[U+1],D.z=c[U+2];const w=x(D)/2/Math.PI+.5,B=S(D)/Math.PI+.5;u.push(w,1-B)}E(),v()}function v(){for(let D=0;D<u.length;D+=6){const U=u[D+0],w=u[D+2],B=u[D+4],N=Math.max(U,w,B),P=Math.min(U,w,B);N>.9&&P<.1&&(U<.2&&(u[D+0]+=1),w<.2&&(u[D+2]+=1),B<.2&&(u[D+4]+=1))}}function g(D){c.push(D.x,D.y,D.z)}function y(D,U){const w=D*3;U.x=t[w+0],U.y=t[w+1],U.z=t[w+2]}function E(){const D=new z,U=new z,w=new z,B=new z,N=new fe,P=new fe,T=new fe;for(let O=0,W=0;O<c.length;O+=9,W+=6){D.set(c[O+0],c[O+1],c[O+2]),U.set(c[O+3],c[O+4],c[O+5]),w.set(c[O+6],c[O+7],c[O+8]),N.set(u[W+0],u[W+1]),P.set(u[W+2],u[W+3]),T.set(u[W+4],u[W+5]),B.copy(D).add(U).add(w).divideScalar(3);const k=x(B);A(N,W+0,D,k),A(P,W+2,U,k),A(T,W+4,w,k)}}function A(D,U,w,B){B<0&&D.x===1&&(u[U]=D.x-1),w.x===0&&w.z===0&&(u[U]=B/2/Math.PI+.5)}function x(D){return Math.atan2(D.z,-D.x)}function S(D){return Math.atan2(-D.y,Math.sqrt(D.x*D.x+D.z*D.z))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Co(t.vertices,t.indices,t.radius,t.detail)}}class Qm extends Co{constructor(t=1,n=0){const a=(1+Math.sqrt(5))/2,o=1/a,c=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-o,-a,0,-o,a,0,o,-a,0,o,a,-o,-a,0,-o,a,0,o,-a,0,o,a,0,-a,0,-o,a,0,-o,-a,0,o,a,0,o],u=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(c,u,t,n),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:n}}static fromJSON(t){return new Qm(t.radius,t.detail)}}const Iu=new z,zu=new z,mp=new z,Fu=new Si;class qT extends Dn{constructor(t=null,n=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:n},t!==null){const o=Math.pow(10,4),c=Math.cos(So*n),u=t.getIndex(),d=t.getAttribute("position"),m=u?u.count:d.count,p=[0,0,0],_=["a","b","c"],v=new Array(3),g={},y=[];for(let E=0;E<m;E+=3){u?(p[0]=u.getX(E),p[1]=u.getX(E+1),p[2]=u.getX(E+2)):(p[0]=E,p[1]=E+1,p[2]=E+2);const{a:A,b:x,c:S}=Fu;if(A.fromBufferAttribute(d,p[0]),x.fromBufferAttribute(d,p[1]),S.fromBufferAttribute(d,p[2]),Fu.getNormal(mp),v[0]=`${Math.round(A.x*o)},${Math.round(A.y*o)},${Math.round(A.z*o)}`,v[1]=`${Math.round(x.x*o)},${Math.round(x.y*o)},${Math.round(x.z*o)}`,v[2]=`${Math.round(S.x*o)},${Math.round(S.y*o)},${Math.round(S.z*o)}`,!(v[0]===v[1]||v[1]===v[2]||v[2]===v[0]))for(let D=0;D<3;D++){const U=(D+1)%3,w=v[D],B=v[U],N=Fu[_[D]],P=Fu[_[U]],T=`${w}_${B}`,O=`${B}_${w}`;O in g&&g[O]?(mp.dot(g[O].normal)<=c&&(y.push(N.x,N.y,N.z),y.push(P.x,P.y,P.z)),g[O]=null):T in g||(g[T]={index0:p[D],index1:p[U],normal:mp.clone()})}}for(const E in g)if(g[E]){const{index0:A,index1:x}=g[E];Iu.fromBufferAttribute(d,A),zu.fromBufferAttribute(d,x),y.push(Iu.x,Iu.y,Iu.z),y.push(zu.x,zu.y,zu.z)}this.setAttribute("position",new Mn(y,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}class YT{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){me("Curve: .getPoint() not implemented.")}getPointAt(t,n){const a=this.getUtoTmapping(t);return this.getPoint(a,n)}getPoints(t=5){const n=[];for(let a=0;a<=t;a++)n.push(this.getPoint(a/t));return n}getSpacedPoints(t=5){const n=[];for(let a=0;a<=t;a++)n.push(this.getPointAt(a/t));return n}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const n=[];let a,o=this.getPoint(0),c=0;n.push(0);for(let u=1;u<=t;u++)a=this.getPoint(u/t),c+=a.distanceTo(o),n.push(c),o=a;return this.cacheArcLengths=n,n}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,n=null){const a=this.getLengths();let o=0;const c=a.length;let u;n?u=n:u=t*a[c-1];let d=0,m=c-1,p;for(;d<=m;)if(o=Math.floor(d+(m-d)/2),p=a[o]-u,p<0)d=o+1;else if(p>0)m=o-1;else{m=o;break}if(o=m,a[o]===u)return o/(c-1);const _=a[o],g=a[o+1]-_,y=(u-_)/g;return(o+y)/(c-1)}getTangent(t,n){let o=t-1e-4,c=t+1e-4;o<0&&(o=0),c>1&&(c=1);const u=this.getPoint(o),d=this.getPoint(c),m=n||(u.isVector2?new fe:new z);return m.copy(d).sub(u).normalize(),m}getTangentAt(t,n){const a=this.getUtoTmapping(t);return this.getTangent(a,n)}computeFrenetFrames(t,n=!1){const a=new z,o=[],c=[],u=[],d=new z,m=new ze;for(let y=0;y<=t;y++){const E=y/t;o[y]=this.getTangentAt(E,new z)}c[0]=new z,u[0]=new z;let p=Number.MAX_VALUE;const _=Math.abs(o[0].x),v=Math.abs(o[0].y),g=Math.abs(o[0].z);_<=p&&(p=_,a.set(1,0,0)),v<=p&&(p=v,a.set(0,1,0)),g<=p&&a.set(0,0,1),d.crossVectors(o[0],a).normalize(),c[0].crossVectors(o[0],d),u[0].crossVectors(o[0],c[0]);for(let y=1;y<=t;y++){if(c[y]=c[y-1].clone(),u[y]=u[y-1].clone(),d.crossVectors(o[y-1],o[y]),d.length()>Number.EPSILON){d.normalize();const E=Math.acos(Ae(o[y-1].dot(o[y]),-1,1));c[y].applyMatrix4(m.makeRotationAxis(d,E))}u[y].crossVectors(o[y],c[y])}if(n===!0){let y=Math.acos(Ae(c[0].dot(c[t]),-1,1));y/=t,o[0].dot(d.crossVectors(c[0],c[t]))>0&&(y=-y);for(let E=1;E<=t;E++)c[E].applyMatrix4(m.makeRotationAxis(o[E],y*E)),u[E].crossVectors(o[E],c[E])}return{tangents:o,normals:c,binormals:u}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}function Jm(){let r=0,t=0,n=0,a=0;function o(c,u,d,m){r=c,t=d,n=-3*c+3*u-2*d-m,a=2*c-2*u+d+m}return{initCatmullRom:function(c,u,d,m,p){o(u,d,p*(d-c),p*(m-u))},initNonuniformCatmullRom:function(c,u,d,m,p,_,v){let g=(u-c)/p-(d-c)/(p+_)+(d-u)/_,y=(d-u)/_-(m-u)/(_+v)+(m-d)/v;g*=_,y*=_,o(u,d,g,y)},calc:function(c){const u=c*c,d=u*c;return r+t*c+n*u+a*d}}}const Px=new z,Bx=new z,gp=new Jm,_p=new Jm,vp=new Jm;class ZT extends YT{constructor(t=[],n=!1,a="centripetal",o=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=n,this.curveType=a,this.tension=o}getPoint(t,n=new z){const a=n,o=this.points,c=o.length,u=(c-(this.closed?0:1))*t;let d=Math.floor(u),m=u-d;this.closed?d+=d>0?0:(Math.floor(Math.abs(d)/c)+1)*c:m===0&&d===c-1&&(d=c-2,m=1);let p,_;this.closed||d>0?p=o[(d-1)%c]:(Bx.subVectors(o[0],o[1]).add(o[0]),p=Bx);const v=o[d%c],g=o[(d+1)%c];if(this.closed||d+2<c?_=o[(d+2)%c]:(Px.subVectors(o[c-1],o[c-2]).add(o[c-1]),_=Px),this.curveType==="centripetal"||this.curveType==="chordal"){const y=this.curveType==="chordal"?.5:.25;let E=Math.pow(p.distanceToSquared(v),y),A=Math.pow(v.distanceToSquared(g),y),x=Math.pow(g.distanceToSquared(_),y);A<1e-4&&(A=1),E<1e-4&&(E=A),x<1e-4&&(x=A),gp.initNonuniformCatmullRom(p.x,v.x,g.x,_.x,E,A,x),_p.initNonuniformCatmullRom(p.y,v.y,g.y,_.y,E,A,x),vp.initNonuniformCatmullRom(p.z,v.z,g.z,_.z,E,A,x)}else this.curveType==="catmullrom"&&(gp.initCatmullRom(p.x,v.x,g.x,_.x,this.tension),_p.initCatmullRom(p.y,v.y,g.y,_.y,this.tension),vp.initCatmullRom(p.z,v.z,g.z,_.z,this.tension));return a.set(gp.calc(m),_p.calc(m),vp.calc(m)),a}copy(t){super.copy(t),this.points=[];for(let n=0,a=t.points.length;n<a;n++){const o=t.points[n];this.points.push(o.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let n=0,a=this.points.length;n<a;n++){const o=this.points[n];t.points.push(o.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let n=0,a=t.points.length;n<a;n++){const o=t.points[n];this.points.push(new z().fromArray(o))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}class Ia extends Co{constructor(t=1,n=0){const a=(1+Math.sqrt(5))/2,o=[-1,a,0,1,a,0,-1,-a,0,1,-a,0,0,-1,a,0,1,a,0,-1,-a,0,1,-a,a,0,-1,a,0,1,-a,0,-1,-a,0,1],c=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(o,c,t,n),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:n}}static fromJSON(t){return new Ia(t.radius,t.detail)}}class jm extends Co{constructor(t=1,n=0){const a=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],o=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(a,o,t,n),this.type="OctahedronGeometry",this.parameters={radius:t,detail:n}}static fromJSON(t){return new jm(t.radius,t.detail)}}class ds extends Dn{constructor(t=1,n=1,a=1,o=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:n,widthSegments:a,heightSegments:o};const c=t/2,u=n/2,d=Math.floor(a),m=Math.floor(o),p=d+1,_=m+1,v=t/d,g=n/m,y=[],E=[],A=[],x=[];for(let S=0;S<_;S++){const D=S*g-u;for(let U=0;U<p;U++){const w=U*v-c;E.push(w,-D,0),A.push(0,0,1),x.push(U/d),x.push(1-S/m)}}for(let S=0;S<m;S++)for(let D=0;D<d;D++){const U=D+p*S,w=D+p*(S+1),B=D+1+p*(S+1),N=D+1+p*S;y.push(U,w,N),y.push(w,B,N)}this.setIndex(y),this.setAttribute("position",new Mn(E,3)),this.setAttribute("normal",new Mn(A,3)),this.setAttribute("uv",new Mn(x,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ds(t.width,t.height,t.widthSegments,t.heightSegments)}}class $m extends Co{constructor(t=1,n=0){const a=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],o=[2,1,0,0,3,2,1,3,0,2,3,1];super(a,o,t,n),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:n}}static fromJSON(t){return new $m(t.radius,t.detail)}}class mf extends Dn{constructor(t=1,n=.4,a=12,o=48,c=Math.PI*2,u=0,d=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:n,radialSegments:a,tubularSegments:o,arc:c,thetaStart:u,thetaLength:d},a=Math.floor(a),o=Math.floor(o);const m=[],p=[],_=[],v=[],g=new z,y=new z,E=new z;for(let A=0;A<=a;A++){const x=u+A/a*d;for(let S=0;S<=o;S++){const D=S/o*c;y.x=(t+n*Math.cos(x))*Math.cos(D),y.y=(t+n*Math.cos(x))*Math.sin(D),y.z=n*Math.sin(x),p.push(y.x,y.y,y.z),g.x=t*Math.cos(D),g.y=t*Math.sin(D),E.subVectors(y,g).normalize(),_.push(E.x,E.y,E.z),v.push(S/o),v.push(A/a)}}for(let A=1;A<=a;A++)for(let x=1;x<=o;x++){const S=(o+1)*A+x-1,D=(o+1)*(A-1)+x-1,U=(o+1)*(A-1)+x,w=(o+1)*A+x;m.push(S,D,w),m.push(D,U,w)}this.setIndex(m),this.setAttribute("position",new Mn(p,3)),this.setAttribute("normal",new Mn(_,3)),this.setAttribute("uv",new Mn(v,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new mf(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}}function Ao(r){const t={};for(const n in r){t[n]={};for(const a in r[n]){const o=r[n][a];if(Ix(o))o.isRenderTargetTexture?(me("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[n][a]=null):t[n][a]=o.clone();else if(Array.isArray(o))if(Ix(o[0])){const c=[];for(let u=0,d=o.length;u<d;u++)c[u]=o[u].clone();t[n][a]=c}else t[n][a]=o.slice();else t[n][a]=o}}return t}function Zn(r){const t={};for(let n=0;n<r.length;n++){const a=Ao(r[n]);for(const o in a)t[o]=a[o]}return t}function Ix(r){return r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)}function KT(r){const t=[];for(let n=0;n<r.length;n++)t.push(r[n].clone());return t}function mS(r){const t=r.getRenderTarget();return t===null?r.outputColorSpace:t.isXRRenderTarget===!0?t.texture.colorSpace:Ne.workingColorSpace}const gf={clone:Ao,merge:Zn};var QT=`void main() {
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,JT=`void main() {
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;class kn extends Ur{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=QT,this.fragmentShader=JT,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,t!==void 0&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Ao(t.uniforms),this.uniformsGroups=KT(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this.defaultAttributeValues=Object.assign({},t.defaultAttributeValues),this.index0AttributeName=t.index0AttributeName,this.uniformsNeedUpdate=t.uniformsNeedUpdate,this}toJSON(t){const n=super.toJSON(t);n.glslVersion=this.glslVersion,n.uniforms={};for(const o in this.uniforms){const u=this.uniforms[o].value;u&&u.isTexture?n.uniforms[o]={type:"t",value:u.toJSON(t).uuid}:u&&u.isColor?n.uniforms[o]={type:"c",value:u.getHex()}:u&&u.isVector2?n.uniforms[o]={type:"v2",value:u.toArray()}:u&&u.isVector3?n.uniforms[o]={type:"v3",value:u.toArray()}:u&&u.isVector4?n.uniforms[o]={type:"v4",value:u.toArray()}:u&&u.isMatrix3?n.uniforms[o]={type:"m3",value:u.toArray()}:u&&u.isMatrix4?n.uniforms[o]={type:"m4",value:u.toArray()}:n.uniforms[o]={value:u}}Object.keys(this.defines).length>0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const a={};for(const o in this.extensions)this.extensions[o]===!0&&(a[o]=!0);return Object.keys(a).length>0&&(n.extensions=a),n}fromJSON(t,n){if(super.fromJSON(t,n),t.uniforms!==void 0)for(const a in t.uniforms){const o=t.uniforms[a];switch(this.uniforms[a]={},o.type){case"t":this.uniforms[a].value=n[o.value]||null;break;case"c":this.uniforms[a].value=new ce().setHex(o.value);break;case"v2":this.uniforms[a].value=new fe().fromArray(o.value);break;case"v3":this.uniforms[a].value=new z().fromArray(o.value);break;case"v4":this.uniforms[a].value=new cn().fromArray(o.value);break;case"m3":this.uniforms[a].value=new Se().fromArray(o.value);break;case"m4":this.uniforms[a].value=new ze().fromArray(o.value);break;default:this.uniforms[a].value=o.value}}if(t.defines!==void 0&&(this.defines=t.defines),t.vertexShader!==void 0&&(this.vertexShader=t.vertexShader),t.fragmentShader!==void 0&&(this.fragmentShader=t.fragmentShader),t.glslVersion!==void 0&&(this.glslVersion=t.glslVersion),t.extensions!==void 0)for(const a in t.extensions)this.extensions[a]=t.extensions[a];return t.lights!==void 0&&(this.lights=t.lights),t.clipping!==void 0&&(this.clipping=t.clipping),this}}class jT extends kn{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class vm extends Ur{constructor(t){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new ce(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 ce(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=pm,this.normalScale=new fe(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 ua,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class $T extends Ur{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Xb,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class tA extends Ur{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}class t0 extends hn{constructor(t,n=1){super(),this.isLight=!0,this.type="Light",this.color=new ce(t),this.intensity=n}dispose(){this.dispatchEvent({type:"dispose"})}copy(t,n){return super.copy(t,n),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const n=super.toJSON(t);return n.object.color=this.color.getHex(),n.object.intensity=this.intensity,n}}const xp=new ze,zx=new z,Fx=new z;class gS{constructor(t){this.camera=t,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new fe(512,512),this.mapType=yi,this.map=null,this.mapPass=null,this.matrix=new ze,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Km,this._frameExtents=new fe(1,1),this._viewportCount=1,this._viewports=[new cn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const n=this.camera,a=this.matrix;zx.setFromMatrixPosition(t.matrixWorld),n.position.copy(zx),Fx.setFromMatrixPosition(t.target.matrixWorld),n.lookAt(Fx),n.updateMatrixWorld(),xp.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(xp,n.coordinateSystem,n.reversedDepth),n.coordinateSystem===Xl||n.reversedDepth?a.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):a.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),a.multiply(xp)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.intensity=t.intensity,this.bias=t.bias,this.radius=t.radius,this.autoUpdate=t.autoUpdate,this.needsUpdate=t.needsUpdate,this.normalBias=t.normalBias,this.blurSamples=t.blurSamples,this.mapSize.copy(t.mapSize),this.biasNode=t.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){const t={};return this.intensity!==1&&(t.intensity=this.intensity),this.bias!==0&&(t.bias=this.bias),this.normalBias!==0&&(t.normalBias=this.normalBias),this.radius!==1&&(t.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}const Hu=new z,Gu=new vi,ta=new z;class _S extends hn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ze,this.projectionMatrix=new ze,this.projectionMatrixInverse=new ze,this.coordinateSystem=ra,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(t,n){return super.copy(t,n),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorld.decompose(Hu,Gu,ta),ta.x===1&&ta.y===1&&ta.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Hu,Gu,ta.set(1,1,1)).invert()}updateWorldMatrix(t,n,a=!1){super.updateWorldMatrix(t,n,a),this.matrixWorld.decompose(Hu,Gu,ta),ta.x===1&&ta.y===1&&ta.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Hu,Gu,ta.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const br=new z,Hx=new fe,Gx=new fe;class xi extends _S{constructor(t=50,n=1,a=.1,o=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=a,this.far=o,this.focus=10,this.aspect=n,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,n){return super.copy(t,n),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=t.view===null?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const n=.5*this.getFilmHeight()/t;this.fov=ql*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(So*.5*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return ql*2*Math.atan(Math.tan(So*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,n,a){br.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(br.x,br.y).multiplyScalar(-t/br.z),br.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),a.set(br.x,br.y).multiplyScalar(-t/br.z)}getViewSize(t,n){return this.getViewBounds(t,Hx,Gx),n.subVectors(Gx,Hx)}setViewOffset(t,n,a,o,c,u){this.aspect=t/n,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=n,this.view.offsetX=a,this.view.offsetY=o,this.view.width=c,this.view.height=u,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let n=t*Math.tan(So*.5*this.fov)/this.zoom,a=2*n,o=this.aspect*a,c=-.5*o;const u=this.view;if(this.view!==null&&this.view.enabled){const m=u.fullWidth,p=u.fullHeight;c+=u.offsetX*o/m,n-=u.offsetY*a/p,o*=u.width/m,a*=u.height/p}const d=this.filmOffset;d!==0&&(c+=t*d/this.getFilmWidth()),this.projectionMatrix.makePerspective(c,c+o,n,n-a,t,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const n=super.toJSON(t);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,this.view!==null&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}}class eA extends gS{constructor(){super(new xi(90,1,.5,500)),this.isPointLightShadow=!0}}class nA extends t0{constructor(t,n,a=0,o=2){super(t,n),this.isPointLight=!0,this.type="PointLight",this.distance=a,this.decay=o,this.shadow=new eA}get power(){return this.intensity*4*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(t,n){return super.copy(t,n),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}toJSON(t){const n=super.toJSON(t);return n.object.distance=this.distance,n.object.decay=this.decay,n.object.shadow=this.shadow.toJSON(),n}}class Tf extends _S{constructor(t=-1,n=1,a=1,o=-1,c=.1,u=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=n,this.top=a,this.bottom=o,this.near=c,this.far=u,this.updateProjectionMatrix()}copy(t,n){return super.copy(t,n),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,n,a,o,c,u){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=n,this.view.offsetX=a,this.view.offsetY=o,this.view.width=c,this.view.height=u,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),a=(this.right+this.left)/2,o=(this.top+this.bottom)/2;let c=a-t,u=a+t,d=o+n,m=o-n;if(this.view!==null&&this.view.enabled){const p=(this.right-this.left)/this.view.fullWidth/this.zoom,_=(this.top-this.bottom)/this.view.fullHeight/this.zoom;c+=p*this.view.offsetX,u=c+p*this.view.width,d-=_*this.view.offsetY,m=d-_*this.view.height}this.projectionMatrix.makeOrthographic(c,u,d,m,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const n=super.toJSON(t);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}}class iA extends gS{constructor(){super(new Tf(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Vu extends t0{constructor(t,n){super(t,n),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(hn.DEFAULT_UP),this.updateMatrix(),this.target=new hn,this.shadow=new iA}dispose(){super.dispose(),this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}toJSON(t){const n=super.toJSON(t);return n.object.shadow=this.shadow.toJSON(),n.object.target=this.target.uuid,n}}class aA extends t0{constructor(t,n){super(t,n),this.isAmbientLight=!0,this.type="AmbientLight"}}const po=-90,mo=1;class rA extends hn{constructor(t,n,a){super(),this.type="CubeCamera",this.renderTarget=a,this.coordinateSystem=null,this.activeMipmapLevel=0;const o=new xi(po,mo,t,n);o.layers=this.layers,this.add(o);const c=new xi(po,mo,t,n);c.layers=this.layers,this.add(c);const u=new xi(po,mo,t,n);u.layers=this.layers,this.add(u);const d=new xi(po,mo,t,n);d.layers=this.layers,this.add(d);const m=new xi(po,mo,t,n);m.layers=this.layers,this.add(m);const p=new xi(po,mo,t,n);p.layers=this.layers,this.add(p)}updateCoordinateSystem(){const t=this.coordinateSystem,n=this.children.concat(),[a,o,c,u,d,m]=n;for(const p of n)this.remove(p);if(t===ra)a.up.set(0,1,0),a.lookAt(1,0,0),o.up.set(0,1,0),o.lookAt(-1,0,0),c.up.set(0,0,-1),c.lookAt(0,1,0),u.up.set(0,0,1),u.lookAt(0,-1,0),d.up.set(0,1,0),d.lookAt(0,0,1),m.up.set(0,1,0),m.lookAt(0,0,-1);else if(t===Xl)a.up.set(0,-1,0),a.lookAt(-1,0,0),o.up.set(0,-1,0),o.lookAt(1,0,0),c.up.set(0,0,1),c.lookAt(0,1,0),u.up.set(0,0,-1),u.lookAt(0,-1,0),d.up.set(0,-1,0),d.lookAt(0,0,1),m.up.set(0,-1,0),m.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(const p of n)this.add(p),p.updateMatrixWorld()}update(t,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:a,activeMipmapLevel:o}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[c,u,d,m,p,_]=this.children,v=t.getRenderTarget(),g=t.getActiveCubeFace(),y=t.getActiveMipmapLevel(),E=t.xr.enabled;t.xr.enabled=!1;const A=a.texture.generateMipmaps;a.texture.generateMipmaps=!1;let x=!1;t.isWebGLRenderer===!0?x=t.state.buffers.depth.getReversed():x=t.reversedDepthBuffer,t.setRenderTarget(a,0,o),x&&t.autoClear===!1&&t.clearDepth(),t.render(n,c),t.setRenderTarget(a,1,o),x&&t.autoClear===!1&&t.clearDepth(),t.render(n,u),t.setRenderTarget(a,2,o),x&&t.autoClear===!1&&t.clearDepth(),t.render(n,d),t.setRenderTarget(a,3,o),x&&t.autoClear===!1&&t.clearDepth(),t.render(n,m),t.setRenderTarget(a,4,o),x&&t.autoClear===!1&&t.clearDepth(),t.render(n,p),a.texture.generateMipmaps=A,t.setRenderTarget(a,5,o),x&&t.autoClear===!1&&t.clearDepth(),t.render(n,_),t.setRenderTarget(v,g,y),t.xr.enabled=E,a.texture.needsPMREMUpdate=!0}}class sA extends xi{constructor(t=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=t}}class oA{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(t){this._document=t,t.hidden!==void 0&&(this._pageVisibilityHandler=lA.bind(this),t.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(t){return this._timescale=t,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(t){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(t!==void 0?t:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function lA(){this._document.hidden===!1&&this.reset()}class cA{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,me("Clock: This module has been deprecated. Please use THREE.Timer instead.")}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const n=performance.now();t=(n-this.oldTime)/1e3,this.oldTime=n,this.elapsedTime+=t}return t}}const s0=class s0{constructor(t,n,a,o){this.elements=[1,0,0,1],t!==void 0&&this.set(t,n,a,o)}identity(){return this.set(1,0,0,1),this}fromArray(t,n=0){for(let a=0;a<4;a++)this.elements[a]=t[a+n];return this}set(t,n,a,o){const c=this.elements;return c[0]=t,c[2]=n,c[1]=a,c[3]=o,this}};s0.prototype.isMatrix2=!0;let Vx=s0;function kx(r,t,n,a){const o=uA(a);switch(n){case eS:return r*t;case Fm:return r*t/o.components*o.byteLength;case Hm:return r*t/o.components*o.byteLength;case ms:return r*t*2/o.components*o.byteLength;case Gm:return r*t*2/o.components*o.byteLength;case nS:return r*t*3/o.components*o.byteLength;case Xi:return r*t*4/o.components*o.byteLength;case Vm:return r*t*4/o.components*o.byteLength;case Qu:case Ju:return Math.floor((r+3)/4)*Math.floor((t+3)/4)*8;case ju:case $u:return Math.floor((r+3)/4)*Math.floor((t+3)/4)*16;case Fp:case Gp:return Math.max(r,16)*Math.max(t,8)/4;case zp:case Hp:return Math.max(r,8)*Math.max(t,8)/2;case Vp:case kp:case Xp:case qp:return Math.floor((r+3)/4)*Math.floor((t+3)/4)*8;case Wp:case sf:case Yp:return Math.floor((r+3)/4)*Math.floor((t+3)/4)*16;case Zp:return Math.floor((r+3)/4)*Math.floor((t+3)/4)*16;case Kp:return Math.floor((r+4)/5)*Math.floor((t+3)/4)*16;case Qp:return Math.floor((r+4)/5)*Math.floor((t+4)/5)*16;case Jp:return Math.floor((r+5)/6)*Math.floor((t+4)/5)*16;case jp:return Math.floor((r+5)/6)*Math.floor((t+5)/6)*16;case $p:return Math.floor((r+7)/8)*Math.floor((t+4)/5)*16;case tm:return Math.floor((r+7)/8)*Math.floor((t+5)/6)*16;case em:return Math.floor((r+7)/8)*Math.floor((t+7)/8)*16;case nm:return Math.floor((r+9)/10)*Math.floor((t+4)/5)*16;case im:return Math.floor((r+9)/10)*Math.floor((t+5)/6)*16;case am:return Math.floor((r+9)/10)*Math.floor((t+7)/8)*16;case rm:return Math.floor((r+9)/10)*Math.floor((t+9)/10)*16;case sm:return Math.floor((r+11)/12)*Math.floor((t+9)/10)*16;case om:return Math.floor((r+11)/12)*Math.floor((t+11)/12)*16;case lm:case cm:case um:return Math.ceil(r/4)*Math.ceil(t/4)*16;case fm:case hm:return Math.ceil(r/4)*Math.ceil(t/4)*8;case of:case dm:return Math.ceil(r/4)*Math.ceil(t/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function uA(r){switch(r){case yi:case Jy:return{byteLength:1,components:1};case kl:case jy:case Mi:return{byteLength:2,components:1};case Im:case zm:return{byteLength:2,components:4};case ca:case Bm:case Wi:return{byteLength:4,components:1};case $y:case tS:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${r}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Om}}));typeof window<"u"&&(window.__THREE__?me("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Om);function vS(){let r=null,t=!1,n=null,a=null;function o(c,u){n(c,u),a=r.requestAnimationFrame(o)}return{start:function(){t!==!0&&n!==null&&r!==null&&(a=r.requestAnimationFrame(o),t=!0)},stop:function(){r!==null&&r.cancelAnimationFrame(a),t=!1},setAnimationLoop:function(c){n=c},setContext:function(c){r=c}}}function fA(r){const t=new WeakMap;function n(d,m){const p=d.array,_=d.usage,v=p.byteLength,g=r.createBuffer();r.bindBuffer(m,g),r.bufferData(m,p,_),d.onUploadCallback();let y;if(p instanceof Float32Array)y=r.FLOAT;else if(typeof Float16Array<"u"&&p instanceof Float16Array)y=r.HALF_FLOAT;else if(p instanceof Uint16Array)d.isFloat16BufferAttribute?y=r.HALF_FLOAT:y=r.UNSIGNED_SHORT;else if(p instanceof Int16Array)y=r.SHORT;else if(p instanceof Uint32Array)y=r.UNSIGNED_INT;else if(p instanceof Int32Array)y=r.INT;else if(p instanceof Int8Array)y=r.BYTE;else if(p instanceof Uint8Array)y=r.UNSIGNED_BYTE;else if(p instanceof Uint8ClampedArray)y=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+p);return{buffer:g,type:y,bytesPerElement:p.BYTES_PER_ELEMENT,version:d.version,size:v}}function a(d,m,p){const _=m.array,v=m.updateRanges;if(r.bindBuffer(p,d),v.length===0)r.bufferSubData(p,0,_);else{v.sort((y,E)=>y.start-E.start);let g=0;for(let y=1;y<v.length;y++){const E=v[g],A=v[y];A.start<=E.start+E.count+1?E.count=Math.max(E.count,A.start+A.count-E.start):(++g,v[g]=A)}v.length=g+1;for(let y=0,E=v.length;y<E;y++){const A=v[y];r.bufferSubData(p,A.start*_.BYTES_PER_ELEMENT,_,A.start,A.count)}m.clearUpdateRanges()}m.onUploadCallback()}function o(d){return d.isInterleavedBufferAttribute&&(d=d.data),t.get(d)}function c(d){d.isInterleavedBufferAttribute&&(d=d.data);const m=t.get(d);m&&(r.deleteBuffer(m.buffer),t.delete(d))}function u(d,m){if(d.isInterleavedBufferAttribute&&(d=d.data),d.isGLBufferAttribute){const _=t.get(d);(!_||_.version<d.version)&&t.set(d,{buffer:d.buffer,type:d.type,bytesPerElement:d.elementSize,version:d.version});return}const p=t.get(d);if(p===void 0)t.set(d,n(d,m));else if(p.version<d.version){if(p.size!==d.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");a(p.buffer,d,m),p.version=d.version}}return{get:o,remove:c,update:u}}var hA=`#ifdef USE_ALPHAHASH
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
#endif`,dA=`#ifdef USE_ALPHAHASH
const float ALPHA_HASH_SCALE = 0.05;
float hash2D( vec2 value ) {
return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
}
float hash3D( vec3 value ) {
return hash2D( vec2( hash2D( value.xy ), value.z ) );
}
float getAlphaHashThreshold( vec3 position ) {
float maxDeriv = max(
length( dFdx( position.xyz ) ),
length( dFdy( position.xyz ) )
);
float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
vec2 pixScales = vec2(
exp2( floor( log2( pixScale ) ) ),
exp2( ceil( log2( pixScale ) ) )
);
vec2 alpha = vec2(
hash3D( floor( pixScales.x * position.xyz ) ),
hash3D( floor( pixScales.y * position.xyz ) )
);
float lerpFactor = fract( log2( pixScale ) );
float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
float a = min( lerpFactor, 1.0 - lerpFactor );
vec3 cases = vec3(
x * x / ( 2.0 * a * ( 1.0 - a ) ),
( x - 0.5 * a ) / ( 1.0 - a ),
1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
);
float threshold = ( x < ( 1.0 - a ) )
? ( ( x < a ) ? cases.x : cases.y )
: cases.z;
return clamp( threshold , 1.0e-6, 1.0 );
}
#endif`,pA=`#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,mA=`#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
#endif`,gA=`#ifdef USE_ALPHATEST
#ifdef ALPHA_TO_COVERAGE
diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
if ( diffuseColor.a == 0.0 ) discard;
#else
if ( diffuseColor.a < alphaTest ) discard;
#endif
#endif`,_A=`#ifdef USE_ALPHATEST
uniform float alphaTest;
#endif`,vA=`#ifdef USE_AOMAP
float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
reflectedLight.indirectDiffuse *= ambientOcclusion;
#if defined( USE_CLEARCOAT )
clearcoatSpecularIndirect *= ambientOcclusion;
#endif
#if defined( USE_SHEEN )
sheenSpecularIndirect *= ambientOcclusion;
#endif
#if defined( USE_ENVMAP ) && defined( STANDARD )
float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
#endif
#endif`,xA=`#ifdef USE_AOMAP
uniform sampler2D aoMap;
uniform float aoMapIntensity;
#endif`,yA=`#ifdef USE_BATCHING
#if ! defined( GL_ANGLE_multi_draw )
#define gl_DrawID _gl_DrawID
uniform int _gl_DrawID;
#endif
uniform highp sampler2D batchingTexture;
uniform highp usampler2D batchingIdTexture;
mat4 getBatchingMatrix( const in float i ) {
int size = textureSize( batchingTexture, 0 ).x;
int j = int( i ) * 4;
int x = j % size;
int y = j / size;
vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
return mat4( v1, v2, v3, v4 );
}
float getIndirectIndex( const in int i ) {
int size = textureSize( batchingIdTexture, 0 ).x;
int x = i % size;
int y = i / size;
return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
}
#endif
#ifdef USE_BATCHING_COLOR
uniform sampler2D batchingColorTexture;
vec4 getBatchingColor( const in float i ) {
int size = textureSize( batchingColorTexture, 0 ).x;
int j = int( i );
int x = j % size;
int y = j / size;
return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
}
#endif`,SA=`#ifdef USE_BATCHING
mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
#endif`,MA=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
vPosition = vec3( position );
#endif`,EA=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
vec3 objectTangent = vec3( tangent.xyz );
#endif`,bA=`float G_BlinnPhong_Implicit( ) {
return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
}
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
vec3 halfDir = normalize( lightDir + viewDir );
float dotNH = saturate( dot( normal, halfDir ) );
float dotVH = saturate( dot( viewDir, halfDir ) );
vec3 F = F_Schlick( specularColor, 1.0, dotVH );
float G = G_BlinnPhong_Implicit( );
float D = D_BlinnPhong( shininess, dotNH );
return F * ( G * D );
} // validated`,TA=`#ifdef USE_IRIDESCENCE
const mat3 XYZ_TO_REC709 = mat3(
3.2404542, -0.9692660, 0.0556434,
-1.5371385, 1.8760108, -0.2040259,
-0.4985314, 0.0415560, 1.0572252
);
vec3 Fresnel0ToIor( vec3 fresnel0 ) {
vec3 sqrtF0 = sqrt( fresnel0 );
return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
}
vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
}
float IorToFresnel0( float transmittedIor, float incidentIor ) {
return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
}
vec3 evalSensitivity( float OPD, vec3 shift ) {
float phase = 2.0 * PI * OPD * 1.0e-9;
vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
xyz /= 1.0685e-7;
vec3 rgb = XYZ_TO_REC709 * xyz;
return rgb;
}
vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
vec3 I;
float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
float cosTheta2Sq = 1.0 - sinTheta2Sq;
if ( cosTheta2Sq < 0.0 ) {
return vec3( 1.0 );
}
float cosTheta2 = sqrt( cosTheta2Sq );
float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
float R12 = F_Schlick( R0, 1.0, cosTheta1 );
float T121 = 1.0 - R12;
float phi12 = 0.0;
if ( iridescenceIOR < outsideIOR ) phi12 = PI;
float phi21 = PI - phi12;
vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
vec3 phi23 = vec3( 0.0 );
if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
vec3 phi = vec3( phi21 ) + phi23;
vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
vec3 r123 = sqrt( R123 );
vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
vec3 C0 = R12 + Rs;
I = C0;
vec3 Cm = Rs - T121;
for ( int m = 1; m <= 2; ++ m ) {
Cm *= r123;
vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
I += Cm * Sm;
}
return max( I, vec3( 0.0 ) );
}
#endif`,AA=`#ifdef USE_BUMPMAP
uniform sampler2D bumpMap;
uniform float bumpScale;
vec2 dHdxy_fwd() {
vec2 dSTdx = dFdx( vBumpMapUv );
vec2 dSTdy = dFdy( vBumpMapUv );
float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
return vec2( dBx, dBy );
}
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
vec3 vN = surf_norm;
vec3 R1 = cross( vSigmaY, vN );
vec3 R2 = cross( vN, vSigmaX );
float fDet = dot( vSigmaX, R1 ) * faceDirection;
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
return normalize( abs( fDet ) * surf_norm - vGrad );
}
#endif`,RA=`#if NUM_CLIPPING_PLANES > 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`,wA=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,CA=`#if NUM_CLIPPING_PLANES > 0
varying vec3 vClipPosition;
#endif`,DA=`#if NUM_CLIPPING_PLANES > 0
vClipPosition = - mvPosition.xyz;
#endif`,LA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
diffuseColor *= vColor;
#endif`,UA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
varying vec4 vColor;
#endif`,NA=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
varying vec4 vColor;
#endif`,OA=`#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`,PA=`#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 );
}
#define inverseTransformDirection transformDirectionByInverseViewMatrix
vec3 transformNormalByInverseViewMatrix( in vec3 normal, in mat4 viewMatrix ) {
return normalize( ( vec4( normal, 0.0 ) * viewMatrix ).xyz );
}
vec3 transformDirectionByInverseViewMatrix( in vec3 dir, in mat4 viewMatrix ) {
return normalize( ( vec4( dir, 0.0 ) * viewMatrix ).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`,BA=`#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`,IA=`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;
#endif`,zA=`#ifdef USE_DISPLACEMENTMAP
uniform sampler2D displacementMap;
uniform float displacementScale;
uniform float displacementBias;
#endif`,FA=`#ifdef USE_DISPLACEMENTMAP
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
#endif`,HA=`#ifdef USE_EMISSIVEMAP
vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
emissiveColor = sRGBTransferEOTF( emissiveColor );
#endif
totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,GA=`#ifdef USE_EMISSIVEMAP
uniform sampler2D emissiveMap;
#endif`,VA="gl_FragColor = linearToOutputTexel( gl_FragColor );",kA=`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 );
}`,WA=`#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 = transformNormalByInverseViewMatrix( 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 * reflectVec );
#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`,XA=`#ifdef USE_ENVMAP
uniform float envMapIntensity;
uniform mat3 envMapRotation;
#ifdef ENVMAP_TYPE_CUBE
uniform samplerCube envMap;
#else
uniform sampler2D envMap;
#endif
#endif`,qA=`#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`,YA=`#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`,ZA=`#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 = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );
#ifdef ENVMAP_MODE_REFLECTION
vReflect = reflect( cameraToVertex, worldNormal );
#else
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
#endif
#endif
#endif`,KA=`#ifdef USE_FOG
vFogDepth = - mvPosition.z;
#endif`,QA=`#ifdef USE_FOG
varying float vFogDepth;
#endif`,JA=`#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`,jA=`#ifdef USE_FOG
uniform vec3 fogColor;
varying float vFogDepth;
#ifdef FOG_EXP2
uniform float fogDensity;
#else
uniform float fogNear;
uniform float fogFar;
#endif
#endif`,$A=`#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
}`,t2=`#ifdef USE_LIGHTMAP
uniform sampler2D lightMap;
uniform float lightMapIntensity;
#endif`,e2=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,n2=`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`,i2=`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 = transformNormalByInverseViewMatrix( 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
#include <lightprobes_pars_fragment>`,a2=`#ifdef USE_ENVMAP
vec3 getIBLIrradiance( const in vec3 normal ) {
#ifdef ENVMAP_TYPE_CUBE_UV
vec3 worldNormal = transformNormalByInverseViewMatrix( 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 = transformDirectionByInverseViewMatrix( 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`,r2=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,s2=`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`,o2=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,l2=`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`,c2=`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`,u2=`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 ) );
return 0.5 / max( gv + gl, EPSILON );
}
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 );
}`,f2=`
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
#ifdef USE_LIGHT_PROBES_GRID
vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;
vec3 probeWorldNormal = transformNormalByInverseViewMatrix( geometryNormal, viewMatrix );
irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );
#endif
#endif
#if defined( RE_IndirectSpecular )
vec3 radiance = vec3( 0.0 );
vec3 clearcoatRadiance = vec3( 0.0 );
#endif`,h2=`#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`,d2=`#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`,p2=`#ifdef USE_LIGHT_PROBES_GRID
uniform highp sampler3D probesSH;
uniform vec3 probesMin;
uniform vec3 probesMax;
uniform vec3 probesResolution;
vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
vec3 res = probesResolution;
vec3 gridRange = probesMax - probesMin;
vec3 resMinusOne = res - 1.0;
vec3 probeSpacing = gridRange / resMinusOne;
vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;
vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );
uvw = uvw * resMinusOne / res + 0.5 / res;
float nz = res.z;
float paddedSlices = nz + 2.0;
float atlasDepth = 7.0 * paddedSlices;
float uvZBase = uvw.z * nz + 1.0;
vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase ) / atlasDepth ) );
vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase + paddedSlices ) / atlasDepth ) );
vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) );
vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) );
vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) );
vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) );
vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) );
vec3 c0 = s0.xyz;
vec3 c1 = vec3( s0.w, s1.xy );
vec3 c2 = vec3( s1.zw, s2.x );
vec3 c3 = s2.yzw;
vec3 c4 = s3.xyz;
vec3 c5 = vec3( s3.w, s4.xy );
vec3 c6 = vec3( s4.zw, s5.x );
vec3 c7 = s5.yzw;
vec3 c8 = s6.xyz;
float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;
vec3 result = c0 * 0.886227;
result += c1 * 2.0 * 0.511664 * y;
result += c2 * 2.0 * 0.511664 * z;
result += c3 * 2.0 * 0.511664 * x;
result += c4 * 2.0 * 0.429043 * x * y;
result += c5 * 2.0 * 0.429043 * y * z;
result += c6 * ( 0.743125 * z * z - 0.247708 );
result += c7 * 2.0 * 0.429043 * x * z;
result += c8 * 0.429043 * ( x * x - y * y );
return max( result, vec3( 0.0 ) );
}
#endif`,m2=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,g2=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
uniform float logDepthBufFC;
varying float vFragDepth;
varying float vIsPerspective;
#endif`,_2=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
varying float vFragDepth;
varying float vIsPerspective;
#endif`,v2=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
vFragDepth = 1.0 + gl_Position.w;
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#endif`,x2=`#ifdef USE_MAP
vec4 sampledDiffuseColor = texture2D( map, vMapUv );
#ifdef DECODE_VIDEO_TEXTURE
sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
#endif
diffuseColor *= sampledDiffuseColor;
#endif`,y2=`#ifdef USE_MAP
uniform sampler2D map;
#endif`,S2=`#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`,M2=`#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`,E2=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
metalnessFactor *= texelMetalness.b;
#endif`,b2=`#ifdef USE_METALNESSMAP
uniform sampler2D metalnessMap;
#endif`,T2=`#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`,A2=`#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`,R2=`#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`,w2=`#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`,C2=`#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`,D2=`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
#ifdef DOUBLE_SIDED
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
#ifdef DOUBLE_SIDED
tbn2[0] *= faceDirection;
tbn2[1] *= faceDirection;
#endif
#endif
vec3 nonPerturbedNormal = normal;`,L2=`#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;
#if defined( USE_PACKED_NORMALMAP )
mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );
#endif
mapN.xy *= normalScale;
normal = normalize( tbn * mapN );
#elif defined( USE_BUMPMAP )
normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
#endif`,U2=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif`,N2=`#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif`,O2=`#ifndef FLAT_SHADED
vNormal = normalize( transformedNormal );
#ifdef USE_TANGENT
vTangent = normalize( transformedTangent );
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
#ifdef FLIP_SIDED
vBitangent = - vBitangent;
#endif
#endif
#endif`,P2=`#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`,B2=`#ifdef USE_CLEARCOAT
vec3 clearcoatNormal = nonPerturbedNormal;
#endif`,I2=`#ifdef USE_CLEARCOAT_NORMALMAP
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
clearcoatMapN.xy *= clearcoatNormalScale;
clearcoatNormal = normalize( tbn2 * clearcoatMapN );
#endif`,z2=`#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`,F2=`#ifdef USE_IRIDESCENCEMAP
uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
uniform sampler2D iridescenceThicknessMap;
#endif`,H2=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,G2=`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
}`,V2=`#ifdef PREMULTIPLIED_ALPHA
gl_FragColor.rgb *= gl_FragColor.a;
#endif`,k2=`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;`,W2=`#ifdef DITHERING
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,X2=`#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`,q2=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
roughnessFactor *= texelRoughness.g;
#endif`,Y2=`#ifdef USE_ROUGHNESSMAP
uniform sampler2D roughnessMap;
#endif`,Z2=`#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`,K2=`#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`,Q2=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
#ifdef HAS_NORMAL
vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );
#else
vec3 shadowWorldNormal = vec3( 0.0 );
#endif
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`,J2=`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;
}`,j2=`#ifdef USE_SKINNING
mat4 boneMatX = getBoneMatrix( skinIndex.x );
mat4 boneMatY = getBoneMatrix( skinIndex.y );
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,$2=`#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`,tR=`#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`,eR=`#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`,nR=`float specularStrength;
#ifdef USE_SPECULARMAP
vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
specularStrength = texelSpecular.r;
#else
specularStrength = 1.0;
#endif`,iR=`#ifdef USE_SPECULARMAP
uniform sampler2D specularMap;
#endif`,aR=`#if defined( TONE_MAPPING )
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,rR=`#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; }`,sR=`#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 = transformNormalByInverseViewMatrix( 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`,oR=`#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`,lR=`#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`,cR=`#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`,uR=`#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`,fR=`#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 hR=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,dR=`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 <tonemapping_fragment>
#include <colorspace_fragment>
}`,pR=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
}`,mR=`#ifdef ENVMAP_TYPE_CUBE
uniform samplerCube envMap;
#elif defined( ENVMAP_TYPE_CUBE_UV )
uniform sampler2D envMap;
#endif
uniform float backgroundBlurriness;
uniform float backgroundIntensity;
uniform mat3 backgroundRotation;
varying vec3 vWorldDirection;
#include <cube_uv_reflection_fragment>
void main() {
#ifdef ENVMAP_TYPE_CUBE
vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );
#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 <tonemapping_fragment>
#include <colorspace_fragment>
}`,gR=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
}`,_R=`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 <tonemapping_fragment>
#include <colorspace_fragment>
}`,vR=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
varying vec2 vHighPrecisionZW;
void main() {
#include <uv_vertex>
#include <batching_vertex>
#include <skinbase_vertex>
#include <morphinstance_vertex>
#ifdef USE_DISPLACEMENTMAP
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vHighPrecisionZW = gl_Position.zw;
}`,xR=`#if DEPTH_PACKING == 3200
uniform float opacity;
#endif
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
varying vec2 vHighPrecisionZW;
void main() {
vec4 diffuseColor = vec4( 1.0 );
#include <clipping_planes_fragment>
#if DEPTH_PACKING == 3200
diffuseColor.a = opacity;
#endif
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <logdepthbuf_fragment>
#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
}`,yR=`#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <batching_vertex>
#include <skinbase_vertex>
#include <morphinstance_vertex>
#ifdef USE_DISPLACEMENTMAP
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <worldpos_vertex>
#include <clipping_planes_vertex>
vWorldPosition = worldPosition.xyz;
}`,SR=`#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
varying vec3 vWorldPosition;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( 1.0 );
#include <clipping_planes_fragment>
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
float dist = length( vWorldPosition - referencePosition );
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
dist = saturate( dist );
gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
}`,MR=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
}`,ER=`uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
vec3 direction = normalize( vWorldDirection );
vec2 sampleUV = equirectUv( direction );
gl_FragColor = texture2D( tEquirect, sampleUV );
#include <tonemapping_fragment>
#include <colorspace_fragment>
}`,bR=`uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
vLineDistance = scale * lineDistance;
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
}`,TR=`uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
varying float vLineDistance;
#include <common>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
if ( mod( vLineDistance, totalSize ) > dashSize ) {
discard;
}
vec3 outgoingLight = vec3( 0.0 );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
outgoingLight = diffuseColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
}`,AR=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <worldpos_vertex>
#include <envmap_vertex>
#include <fog_vertex>
}`,RR=`uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#endif
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <specularmap_fragment>
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 <aomap_fragment>
reflectedLight.indirectDiffuse *= diffuseColor.rgb;
vec3 outgoingLight = reflectedLight.indirectDiffuse;
#include <envmap_fragment>
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,wR=`#define LAMBERT
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,CR=`#define LAMBERT
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_lambert_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <specularmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_lambert_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
#include <envmap_fragment>
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,DR=`#define MATCAP
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <displacementmap_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
vViewPosition = - mvPosition.xyz;
}`,LR=`#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
varying vec3 vViewPosition;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
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 <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,UR=`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphinstance_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
vViewPosition = - mvPosition.xyz;
#endif
}`,NR=`#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
varying vec3 vViewPosition;
#endif
#include <uv_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
#include <clipping_planes_fragment>
#include <logdepthbuf_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );
#ifdef OPAQUE
gl_FragColor.a = 1.0;
#endif
}`,OR=`#define PHONG
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphinstance_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,PR=`#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_phong_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <specularmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_phong_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
#include <envmap_fragment>
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,BR=`#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
varying vec3 vWorldPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
#ifdef USE_TRANSMISSION
vWorldPosition = worldPosition.xyz;
#endif
}`,IR=`#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 <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <iridescence_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_physical_pars_fragment>
#include <transmission_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <clearcoat_pars_fragment>
#include <iridescence_pars_fragment>
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <roughnessmap_fragment>
#include <metalnessmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <clearcoat_normal_fragment_begin>
#include <clearcoat_normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_physical_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
#include <transmission_fragment>
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 <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,zR=`#define TOON
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <normal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,FR=`#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <gradientmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_toon_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_toon_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,HR=`uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
#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 <color_vertex>
#include <morphinstance_vertex>
#include <morphcolor_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <project_vertex>
gl_PointSize = size;
#ifdef USE_SIZEATTENUATION
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
#endif
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <worldpos_vertex>
#include <fog_vertex>
}`,GR=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
vec3 outgoingLight = vec3( 0.0 );
#include <logdepthbuf_fragment>
#include <map_particle_fragment>
#include <color_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
outgoingLight = diffuseColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
}`,VR=`#include <common>
#include <batching_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
#include <batching_vertex>
#include <beginnormal_vertex>
#include <morphinstance_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,kR=`uniform vec3 color;
uniform float opacity;
#include <common>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <logdepthbuf_pars_fragment>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
void main() {
#include <logdepthbuf_fragment>
gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
}`,WR=`uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
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 <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
}`,XR=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
vec4 diffuseColor = vec4( diffuse, opacity );
#include <clipping_planes_fragment>
vec3 outgoingLight = vec3( 0.0 );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <alphahash_fragment>
outgoingLight = diffuseColor.rgb;
#include <opaque_fragment>
#include <tonemapping_fragment>
#include <colorspace_fragment>
#include <fog_fragment>
}`,Te={alphahash_fragment:hA,alphahash_pars_fragment:dA,alphamap_fragment:pA,alphamap_pars_fragment:mA,alphatest_fragment:gA,alphatest_pars_fragment:_A,aomap_fragment:vA,aomap_pars_fragment:xA,batching_pars_vertex:yA,batching_vertex:SA,begin_vertex:MA,beginnormal_vertex:EA,bsdfs:bA,iridescence_fragment:TA,bumpmap_pars_fragment:AA,clipping_planes_fragment:RA,clipping_planes_pars_fragment:wA,clipping_planes_pars_vertex:CA,clipping_planes_vertex:DA,color_fragment:LA,color_pars_fragment:UA,color_pars_vertex:NA,color_vertex:OA,common:PA,cube_uv_reflection_fragment:BA,defaultnormal_vertex:IA,displacementmap_pars_vertex:zA,displacementmap_vertex:FA,emissivemap_fragment:HA,emissivemap_pars_fragment:GA,colorspace_fragment:VA,colorspace_pars_fragment:kA,envmap_fragment:WA,envmap_common_pars_fragment:XA,envmap_pars_fragment:qA,envmap_pars_vertex:YA,envmap_physical_pars_fragment:a2,envmap_vertex:ZA,fog_vertex:KA,fog_pars_vertex:QA,fog_fragment:JA,fog_pars_fragment:jA,gradientmap_pars_fragment:$A,lightmap_pars_fragment:t2,lights_lambert_fragment:e2,lights_lambert_pars_fragment:n2,lights_pars_begin:i2,lights_toon_fragment:r2,lights_toon_pars_fragment:s2,lights_phong_fragment:o2,lights_phong_pars_fragment:l2,lights_physical_fragment:c2,lights_physical_pars_fragment:u2,lights_fragment_begin:f2,lights_fragment_maps:h2,lights_fragment_end:d2,lightprobes_pars_fragment:p2,logdepthbuf_fragment:m2,logdepthbuf_pars_fragment:g2,logdepthbuf_pars_vertex:_2,logdepthbuf_vertex:v2,map_fragment:x2,map_pars_fragment:y2,map_particle_fragment:S2,map_particle_pars_fragment:M2,metalnessmap_fragment:E2,metalnessmap_pars_fragment:b2,morphinstance_vertex:T2,morphcolor_vertex:A2,morphnormal_vertex:R2,morphtarget_pars_vertex:w2,morphtarget_vertex:C2,normal_fragment_begin:D2,normal_fragment_maps:L2,normal_pars_fragment:U2,normal_pars_vertex:N2,normal_vertex:O2,normalmap_pars_fragment:P2,clearcoat_normal_fragment_begin:B2,clearcoat_normal_fragment_maps:I2,clearcoat_pars_fragment:z2,iridescence_pars_fragment:F2,opaque_fragment:H2,packing:G2,premultiplied_alpha_fragment:V2,project_vertex:k2,dithering_fragment:W2,dithering_pars_fragment:X2,roughnessmap_fragment:q2,roughnessmap_pars_fragment:Y2,shadowmap_pars_fragment:Z2,shadowmap_pars_vertex:K2,shadowmap_vertex:Q2,shadowmask_pars_fragment:J2,skinbase_vertex:j2,skinning_pars_vertex:$2,skinning_vertex:tR,skinnormal_vertex:eR,specularmap_fragment:nR,specularmap_pars_fragment:iR,tonemapping_fragment:aR,tonemapping_pars_fragment:rR,transmission_fragment:sR,transmission_pars_fragment:oR,uv_pars_fragment:lR,uv_pars_vertex:cR,uv_vertex:uR,worldpos_vertex:fR,background_vert:hR,background_frag:dR,backgroundCube_vert:pR,backgroundCube_frag:mR,cube_vert:gR,cube_frag:_R,depth_vert:vR,depth_frag:xR,distance_vert:yR,distance_frag:SR,equirect_vert:MR,equirect_frag:ER,linedashed_vert:bR,linedashed_frag:TR,meshbasic_vert:AR,meshbasic_frag:RR,meshlambert_vert:wR,meshlambert_frag:CR,meshmatcap_vert:DR,meshmatcap_frag:LR,meshnormal_vert:UR,meshnormal_frag:NR,meshphong_vert:OR,meshphong_frag:PR,meshphysical_vert:BR,meshphysical_frag:IR,meshtoon_vert:zR,meshtoon_frag:FR,points_vert:HR,points_frag:GR,shadow_vert:VR,shadow_frag:kR,sprite_vert:WR,sprite_frag:XR},Vt={common:{diffuse:{value:new ce(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Se},alphaMap:{value:null},alphaMapTransform:{value:new Se},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Se}},envmap:{envMap:{value:null},envMapRotation:{value:new Se},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Se}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Se}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Se},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Se},normalScale:{value:new fe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Se},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Se}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Se}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Se}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ce(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},probesSH:{value:null},probesMin:{value:new z},probesMax:{value:new z},probesResolution:{value:new z}},points:{diffuse:{value:new ce(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Se},alphaTest:{value:0},uvTransform:{value:new Se}},sprite:{diffuse:{value:new ce(16777215)},opacity:{value:1},center:{value:new fe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Se},alphaMap:{value:null},alphaMapTransform:{value:new Se},alphaTest:{value:0}}},ia={basic:{uniforms:Zn([Vt.common,Vt.specularmap,Vt.envmap,Vt.aomap,Vt.lightmap,Vt.fog]),vertexShader:Te.meshbasic_vert,fragmentShader:Te.meshbasic_frag},lambert:{uniforms:Zn([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 ce(0)},envMapIntensity:{value:1}}]),vertexShader:Te.meshlambert_vert,fragmentShader:Te.meshlambert_frag},phong:{uniforms:Zn([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 ce(0)},specular:{value:new ce(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Te.meshphong_vert,fragmentShader:Te.meshphong_frag},standard:{uniforms:Zn([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 ce(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Te.meshphysical_vert,fragmentShader:Te.meshphysical_frag},toon:{uniforms:Zn([Vt.common,Vt.aomap,Vt.lightmap,Vt.emissivemap,Vt.bumpmap,Vt.normalmap,Vt.displacementmap,Vt.gradientmap,Vt.fog,Vt.lights,{emissive:{value:new ce(0)}}]),vertexShader:Te.meshtoon_vert,fragmentShader:Te.meshtoon_frag},matcap:{uniforms:Zn([Vt.common,Vt.bumpmap,Vt.normalmap,Vt.displacementmap,Vt.fog,{matcap:{value:null}}]),vertexShader:Te.meshmatcap_vert,fragmentShader:Te.meshmatcap_frag},points:{uniforms:Zn([Vt.points,Vt.fog]),vertexShader:Te.points_vert,fragmentShader:Te.points_frag},dashed:{uniforms:Zn([Vt.common,Vt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Te.linedashed_vert,fragmentShader:Te.linedashed_frag},depth:{uniforms:Zn([Vt.common,Vt.displacementmap]),vertexShader:Te.depth_vert,fragmentShader:Te.depth_frag},normal:{uniforms:Zn([Vt.common,Vt.bumpmap,Vt.normalmap,Vt.displacementmap,{opacity:{value:1}}]),vertexShader:Te.meshnormal_vert,fragmentShader:Te.meshnormal_frag},sprite:{uniforms:Zn([Vt.sprite,Vt.fog]),vertexShader:Te.sprite_vert,fragmentShader:Te.sprite_frag},background:{uniforms:{uvTransform:{value:new Se},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Te.background_vert,fragmentShader:Te.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Se}},vertexShader:Te.backgroundCube_vert,fragmentShader:Te.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Te.cube_vert,fragmentShader:Te.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Te.equirect_vert,fragmentShader:Te.equirect_frag},distance:{uniforms:Zn([Vt.common,Vt.displacementmap,{referencePosition:{value:new z},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Te.distance_vert,fragmentShader:Te.distance_frag},shadow:{uniforms:Zn([Vt.lights,Vt.fog,{color:{value:new ce(0)},opacity:{value:1}}]),vertexShader:Te.shadow_vert,fragmentShader:Te.shadow_frag}};ia.physical={uniforms:Zn([ia.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Se},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Se},clearcoatNormalScale:{value:new fe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Se},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Se},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Se},sheen:{value:0},sheenColor:{value:new ce(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Se},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Se},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Se},transmissionSamplerSize:{value:new fe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Se},attenuationDistance:{value:0},attenuationColor:{value:new ce(0)},specularColor:{value:new ce(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Se},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Se},anisotropyVector:{value:new fe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Se}}]),vertexShader:Te.meshphysical_vert,fragmentShader:Te.meshphysical_frag};const ku={r:0,b:0,g:0},qR=new ze,xS=new Se;xS.set(-1,0,0,0,1,0,0,0,1);function YR(r,t,n,a,o,c){const u=new ce(0);let d=o===!0?0:1,m,p,_=null,v=0,g=null;function y(D){let U=D.isScene===!0?D.background:null;if(U&&U.isTexture){const w=D.backgroundBlurriness>0;U=t.get(U,w)}return U}function E(D){let U=!1;const w=y(D);w===null?x(u,d):w&&w.isColor&&(x(w,1),U=!0);const B=r.xr.getEnvironmentBlendMode();B==="additive"?n.buffers.color.setClear(0,0,0,1,c):B==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,c),(r.autoClear||U)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function A(D,U){const w=y(U);w&&(w.isCubeTexture||w.mapping===Ef)?(p===void 0&&(p=new ln(new Jl(1,1,1),new kn({name:"BackgroundCubeMaterial",uniforms:Ao(ia.backgroundCube.uniforms),vertexShader:ia.backgroundCube.vertexShader,fragmentShader:ia.backgroundCube.fragmentShader,side:ii,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),p.geometry.deleteAttribute("normal"),p.geometry.deleteAttribute("uv"),p.onBeforeRender=function(B,N,P){this.matrixWorld.copyPosition(P.matrixWorld)},Object.defineProperty(p.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),a.update(p)),p.material.uniforms.envMap.value=w,p.material.uniforms.backgroundBlurriness.value=U.backgroundBlurriness,p.material.uniforms.backgroundIntensity.value=U.backgroundIntensity,p.material.uniforms.backgroundRotation.value.setFromMatrix4(qR.makeRotationFromEuler(U.backgroundRotation)).transpose(),w.isCubeTexture&&w.isRenderTargetTexture===!1&&p.material.uniforms.backgroundRotation.value.premultiply(xS),p.material.toneMapped=Ne.getTransfer(w.colorSpace)!==Ye,(_!==w||v!==w.version||g!==r.toneMapping)&&(p.material.needsUpdate=!0,_=w,v=w.version,g=r.toneMapping),p.layers.enableAll(),D.unshift(p,p.geometry,p.material,0,0,null)):w&&w.isTexture&&(m===void 0&&(m=new ln(new ds(2,2),new kn({name:"BackgroundMaterial",uniforms:Ao(ia.background.uniforms),vertexShader:ia.background.vertexShader,fragmentShader:ia.background.fragmentShader,side:Dr,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),m.geometry.deleteAttribute("normal"),Object.defineProperty(m.material,"map",{get:function(){return this.uniforms.t2D.value}}),a.update(m)),m.material.uniforms.t2D.value=w,m.material.uniforms.backgroundIntensity.value=U.backgroundIntensity,m.material.toneMapped=Ne.getTransfer(w.colorSpace)!==Ye,w.matrixAutoUpdate===!0&&w.updateMatrix(),m.material.uniforms.uvTransform.value.copy(w.matrix),(_!==w||v!==w.version||g!==r.toneMapping)&&(m.material.needsUpdate=!0,_=w,v=w.version,g=r.toneMapping),m.layers.enableAll(),D.unshift(m,m.geometry,m.material,0,0,null))}function x(D,U){D.getRGB(ku,mS(r)),n.buffers.color.setClear(ku.r,ku.g,ku.b,U,c)}function S(){p!==void 0&&(p.geometry.dispose(),p.material.dispose(),p=void 0),m!==void 0&&(m.geometry.dispose(),m.material.dispose(),m=void 0)}return{getClearColor:function(){return u},setClearColor:function(D,U=1){u.set(D),d=U,x(u,d)},getClearAlpha:function(){return d},setClearAlpha:function(D){d=D,x(u,d)},render:E,addToRenderList:A,dispose:S}}function ZR(r,t){const n=r.getParameter(r.MAX_VERTEX_ATTRIBS),a={},o=g(null);let c=o,u=!1;function d(k,Q,dt,vt,Z){let F=!1;const V=v(k,vt,dt,Q);c!==V&&(c=V,p(c.object)),F=y(k,vt,dt,Z),F&&E(k,vt,dt,Z),Z!==null&&t.update(Z,r.ELEMENT_ARRAY_BUFFER),(F||u)&&(u=!1,w(k,Q,dt,vt),Z!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t.get(Z).buffer))}function m(){return r.createVertexArray()}function p(k){return r.bindVertexArray(k)}function _(k){return r.deleteVertexArray(k)}function v(k,Q,dt,vt){const Z=vt.wireframe===!0;let F=a[Q.id];F===void 0&&(F={},a[Q.id]=F);const V=k.isInstancedMesh===!0?k.id:0;let et=F[V];et===void 0&&(et={},F[V]=et);let mt=et[dt.id];mt===void 0&&(mt={},et[dt.id]=mt);let At=mt[Z];return At===void 0&&(At=g(m()),mt[Z]=At),At}function g(k){const Q=[],dt=[],vt=[];for(let Z=0;Z<n;Z++)Q[Z]=0,dt[Z]=0,vt[Z]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:Q,enabledAttributes:dt,attributeDivisors:vt,object:k,attributes:{},index:null}}function y(k,Q,dt,vt){const Z=c.attributes,F=Q.attributes;let V=0;const et=dt.getAttributes();for(const mt in et)if(et[mt].location>=0){const I=Z[mt];let J=F[mt];if(J===void 0&&(mt==="instanceMatrix"&&k.instanceMatrix&&(J=k.instanceMatrix),mt==="instanceColor"&&k.instanceColor&&(J=k.instanceColor)),I===void 0||I.attribute!==J||J&&I.data!==J.data)return!0;V++}return c.attributesNum!==V||c.index!==vt}function E(k,Q,dt,vt){const Z={},F=Q.attributes;let V=0;const et=dt.getAttributes();for(const mt in et)if(et[mt].location>=0){let I=F[mt];I===void 0&&(mt==="instanceMatrix"&&k.instanceMatrix&&(I=k.instanceMatrix),mt==="instanceColor"&&k.instanceColor&&(I=k.instanceColor));const J={};J.attribute=I,I&&I.data&&(J.data=I.data),Z[mt]=J,V++}c.attributes=Z,c.attributesNum=V,c.index=vt}function A(){const k=c.newAttributes;for(let Q=0,dt=k.length;Q<dt;Q++)k[Q]=0}function x(k){S(k,0)}function S(k,Q){const dt=c.newAttributes,vt=c.enabledAttributes,Z=c.attributeDivisors;dt[k]=1,vt[k]===0&&(r.enableVertexAttribArray(k),vt[k]=1),Z[k]!==Q&&(r.vertexAttribDivisor(k,Q),Z[k]=Q)}function D(){const k=c.newAttributes,Q=c.enabledAttributes;for(let dt=0,vt=Q.length;dt<vt;dt++)Q[dt]!==k[dt]&&(r.disableVertexAttribArray(dt),Q[dt]=0)}function U(k,Q,dt,vt,Z,F,V){V===!0?r.vertexAttribIPointer(k,Q,dt,Z,F):r.vertexAttribPointer(k,Q,dt,vt,Z,F)}function w(k,Q,dt,vt){A();const Z=vt.attributes,F=dt.getAttributes(),V=Q.defaultAttributeValues;for(const et in F){const mt=F[et];if(mt.location>=0){let At=Z[et];if(At===void 0&&(et==="instanceMatrix"&&k.instanceMatrix&&(At=k.instanceMatrix),et==="instanceColor"&&k.instanceColor&&(At=k.instanceColor)),At!==void 0){const I=At.normalized,J=At.itemSize,bt=t.get(At);if(bt===void 0)continue;const Lt=bt.buffer,Ht=bt.type,st=bt.bytesPerElement,St=Ht===r.INT||Ht===r.UNSIGNED_INT||At.gpuType===Bm;if(At.isInterleavedBufferAttribute){const Et=At.data,Yt=Et.stride,ge=At.offset;if(Et.isInstancedInterleavedBuffer){for(let se=0;se<mt.locationSize;se++)S(mt.location+se,Et.meshPerAttribute);k.isInstancedMesh!==!0&&vt._maxInstanceCount===void 0&&(vt._maxInstanceCount=Et.meshPerAttribute*Et.count)}else for(let se=0;se<mt.locationSize;se++)x(mt.location+se);r.bindBuffer(r.ARRAY_BUFFER,Lt);for(let se=0;se<mt.locationSize;se++)U(mt.location+se,J/mt.locationSize,Ht,I,Yt*st,(ge+J/mt.locationSize*se)*st,St)}else{if(At.isInstancedBufferAttribute){for(let Et=0;Et<mt.locationSize;Et++)S(mt.location+Et,At.meshPerAttribute);k.isInstancedMesh!==!0&&vt._maxInstanceCount===void 0&&(vt._maxInstanceCount=At.meshPerAttribute*At.count)}else for(let Et=0;Et<mt.locationSize;Et++)x(mt.location+Et);r.bindBuffer(r.ARRAY_BUFFER,Lt);for(let Et=0;Et<mt.locationSize;Et++)U(mt.location+Et,J/mt.locationSize,Ht,I,J*st,J/mt.locationSize*Et*st,St)}}else if(V!==void 0){const I=V[et];if(I!==void 0)switch(I.length){case 2:r.vertexAttrib2fv(mt.location,I);break;case 3:r.vertexAttrib3fv(mt.location,I);break;case 4:r.vertexAttrib4fv(mt.location,I);break;default:r.vertexAttrib1fv(mt.location,I)}}}}D()}function B(){O();for(const k in a){const Q=a[k];for(const dt in Q){const vt=Q[dt];for(const Z in vt){const F=vt[Z];for(const V in F)_(F[V].object),delete F[V];delete vt[Z]}}delete a[k]}}function N(k){if(a[k.id]===void 0)return;const Q=a[k.id];for(const dt in Q){const vt=Q[dt];for(const Z in vt){const F=vt[Z];for(const V in F)_(F[V].object),delete F[V];delete vt[Z]}}delete a[k.id]}function P(k){for(const Q in a){const dt=a[Q];for(const vt in dt){const Z=dt[vt];if(Z[k.id]===void 0)continue;const F=Z[k.id];for(const V in F)_(F[V].object),delete F[V];delete Z[k.id]}}}function T(k){for(const Q in a){const dt=a[Q],vt=k.isInstancedMesh===!0?k.id:0,Z=dt[vt];if(Z!==void 0){for(const F in Z){const V=Z[F];for(const et in V)_(V[et].object),delete V[et];delete Z[F]}delete dt[vt],Object.keys(dt).length===0&&delete a[Q]}}}function O(){W(),u=!0,c!==o&&(c=o,p(c.object))}function W(){o.geometry=null,o.program=null,o.wireframe=!1}return{setup:d,reset:O,resetDefaultState:W,dispose:B,releaseStatesOfGeometry:N,releaseStatesOfObject:T,releaseStatesOfProgram:P,initAttributes:A,enableAttribute:x,disableUnusedAttributes:D}}function KR(r,t,n){let a;function o(m){a=m}function c(m,p){r.drawArrays(a,m,p),n.update(p,a,1)}function u(m,p,_){_!==0&&(r.drawArraysInstanced(a,m,p,_),n.update(p,a,_))}function d(m,p,_){if(_===0)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(a,m,0,p,0,_);let g=0;for(let y=0;y<_;y++)g+=p[y];n.update(g,a,1)}this.setMode=o,this.render=c,this.renderInstances=u,this.renderMultiDraw=d}function QR(r,t,n,a){let o;function c(){if(o!==void 0)return o;if(t.has("EXT_texture_filter_anisotropic")===!0){const P=t.get("EXT_texture_filter_anisotropic");o=r.getParameter(P.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else o=0;return o}function u(P){return!(P!==Xi&&a.convert(P)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_FORMAT))}function d(P){const T=P===Mi&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(P!==yi&&a.convert(P)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_TYPE)&&P!==Wi&&!T)}function m(P){if(P==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";P="mediump"}return P==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let p=n.precision!==void 0?n.precision:"highp";const _=m(p);_!==p&&(me("WebGLRenderer:",p,"not supported, using",_,"instead."),p=_);const v=n.logarithmicDepthBuffer===!0,g=n.reversedDepthBuffer===!0&&t.has("EXT_clip_control");n.reversedDepthBuffer===!0&&g===!1&&me("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");const y=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),E=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),A=r.getParameter(r.MAX_TEXTURE_SIZE),x=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),S=r.getParameter(r.MAX_VERTEX_ATTRIBS),D=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),U=r.getParameter(r.MAX_VARYING_VECTORS),w=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),B=r.getParameter(r.MAX_SAMPLES),N=r.getParameter(r.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:c,getMaxPrecision:m,textureFormatReadable:u,textureTypeReadable:d,precision:p,logarithmicDepthBuffer:v,reversedDepthBuffer:g,maxTextures:y,maxVertexTextures:E,maxTextureSize:A,maxCubemapSize:x,maxAttributes:S,maxVertexUniforms:D,maxVaryings:U,maxFragmentUniforms:w,maxSamples:B,samples:N}}function JR(r){const t=this;let n=null,a=0,o=!1,c=!1;const u=new os,d=new Se,m={value:null,needsUpdate:!1};this.uniform=m,this.numPlanes=0,this.numIntersection=0,this.init=function(v,g){const y=v.length!==0||g||a!==0||o;return o=g,a=v.length,y},this.beginShadows=function(){c=!0,_(null)},this.endShadows=function(){c=!1},this.setGlobalState=function(v,g){n=_(v,g,0)},this.setState=function(v,g,y){const E=v.clippingPlanes,A=v.clipIntersection,x=v.clipShadows,S=r.get(v);if(!o||E===null||E.length===0||c&&!x)c?_(null):p();else{const D=c?0:a,U=D*4;let w=S.clippingState||null;m.value=w,w=_(E,g,U,y);for(let B=0;B!==U;++B)w[B]=n[B];S.clippingState=w,this.numIntersection=A?this.numPlanes:0,this.numPlanes+=D}};function p(){m.value!==n&&(m.value=n,m.needsUpdate=a>0),t.numPlanes=a,t.numIntersection=0}function _(v,g,y,E){const A=v!==null?v.length:0;let x=null;if(A!==0){if(x=m.value,E!==!0||x===null){const S=y+A*4,D=g.matrixWorldInverse;d.getNormalMatrix(D),(x===null||x.length<S)&&(x=new Float32Array(S));for(let U=0,w=y;U!==A;++U,w+=4)u.copy(v[U]).applyMatrix4(D,d),u.normal.toArray(x,w),x[w+3]=u.constant}m.value=x,m.needsUpdate=!0}return t.numPlanes=A,t.numIntersection=0,x}}const Cr=4,Wx=[.125,.215,.35,.446,.526,.582],cs=20,jR=256,Ol=new Tf,Xx=new ce;let yp=null,Sp=0,Mp=0,Ep=!1;const $R=new z;class qx{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(t,n=0,a=.1,o=100,c={}){const{size:u=256,position:d=$R}=c;yp=this._renderer.getRenderTarget(),Sp=this._renderer.getActiveCubeFace(),Mp=this._renderer.getActiveMipmapLevel(),Ep=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(u);const m=this._allocateTargets();return m.depthBuffer=!0,this._sceneToCubeUV(t,a,o,m,d),n>0&&this._blur(m,0,0,n),this._applyPMREM(m),this._cleanup(m),m}fromEquirectangular(t,n=null){return this._fromTexture(t,n)}fromCubemap(t,n=null){return this._fromTexture(t,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Kx(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Zx(),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(t){this._lodMax=Math.floor(Math.log2(t)),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 t=0;t<this._lodMeshes.length;t++)this._lodMeshes[t].geometry.dispose()}_cleanup(t){this._renderer.setRenderTarget(yp,Sp,Mp),this._renderer.xr.enabled=Ep,t.scissorTest=!1,go(t,0,0,t.width,t.height)}_fromTexture(t,n){t.mapping===ps||t.mapping===bo?this._setSize(t.image.length===0?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),yp=this._renderer.getRenderTarget(),Sp=this._renderer.getActiveCubeFace(),Mp=this._renderer.getActiveMipmapLevel(),Ep=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const a=n||this._allocateTargets();return this._textureToCubeUV(t,a),this._applyPMREM(a),this._cleanup(a),a}_allocateTargets(){const t=3*Math.max(this._cubeSize,112),n=4*this._cubeSize,a={magFilter:Gn,minFilter:Gn,generateMipmaps:!1,type:Mi,format:Xi,colorSpace:lf,depthBuffer:!1},o=Yx(t,n,a);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Yx(t,n,a);const{_lodMax:c}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=t3(c)),this._blurMaterial=n3(c,t,n),this._ggxMaterial=e3(c,t,n)}return o}_compileMaterial(t){const n=new ln(new Dn,t);this._renderer.compile(n,Ol)}_sceneToCubeUV(t,n,a,o,c){const m=new xi(90,1,n,a),p=[1,-1,1,1,1,1],_=[1,1,1,-1,-1,-1],v=this._renderer,g=v.autoClear,y=v.toneMapping;v.getClearColor(Xx),v.toneMapping=oa,v.autoClear=!1,v.state.buffers.depth.getReversed()&&(v.setRenderTarget(o),v.clearDepth(),v.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new ln(new Jl,new bf({name:"PMREM.Background",side:ii,depthWrite:!1,depthTest:!1})));const A=this._backgroundBox,x=A.material;let S=!1;const D=t.background;D?D.isColor&&(x.color.copy(D),t.background=null,S=!0):(x.color.copy(Xx),S=!0);for(let U=0;U<6;U++){const w=U%3;w===0?(m.up.set(0,p[U],0),m.position.set(c.x,c.y,c.z),m.lookAt(c.x+_[U],c.y,c.z)):w===1?(m.up.set(0,0,p[U]),m.position.set(c.x,c.y,c.z),m.lookAt(c.x,c.y+_[U],c.z)):(m.up.set(0,p[U],0),m.position.set(c.x,c.y,c.z),m.lookAt(c.x,c.y,c.z+_[U]));const B=this._cubeSize;go(o,w*B,U>2?B:0,B,B),v.setRenderTarget(o),S&&v.render(A,m),v.render(t,m)}v.toneMapping=y,v.autoClear=g,t.background=D}_textureToCubeUV(t,n){const a=this._renderer,o=t.mapping===ps||t.mapping===bo;o?(this._cubemapMaterial===null&&(this._cubemapMaterial=Kx()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Zx());const c=o?this._cubemapMaterial:this._equirectMaterial,u=this._lodMeshes[0];u.material=c;const d=c.uniforms;d.envMap.value=t;const m=this._cubeSize;go(n,0,0,3*m,2*m),a.setRenderTarget(n),a.render(u,Ol)}_applyPMREM(t){const n=this._renderer,a=n.autoClear;n.autoClear=!1;const o=this._lodMeshes.length;for(let c=1;c<o;c++)this._applyGGXFilter(t,c-1,c);n.autoClear=a}_applyGGXFilter(t,n,a){const o=this._renderer,c=this._pingPongRenderTarget,u=this._ggxMaterial,d=this._lodMeshes[a];d.material=u;const m=u.uniforms,p=a/(this._lodMeshes.length-1),_=n/(this._lodMeshes.length-1),v=Math.sqrt(p*p-_*_),g=0+p*1.25,y=v*g,{_lodMax:E}=this,A=this._sizeLods[a],x=3*A*(a>E-Cr?a-E+Cr:0),S=4*(this._cubeSize-A);m.envMap.value=t.texture,m.roughness.value=y,m.mipInt.value=E-n,go(c,x,S,3*A,2*A),o.setRenderTarget(c),o.render(d,Ol),m.envMap.value=c.texture,m.roughness.value=0,m.mipInt.value=E-a,go(t,x,S,3*A,2*A),o.setRenderTarget(t),o.render(d,Ol)}_blur(t,n,a,o,c){const u=this._pingPongRenderTarget;this._halfBlur(t,u,n,a,o,"latitudinal",c),this._halfBlur(u,t,a,a,o,"longitudinal",c)}_halfBlur(t,n,a,o,c,u,d){const m=this._renderer,p=this._blurMaterial;u!=="latitudinal"&&u!=="longitudinal"&&Oe("blur direction must be either latitudinal or longitudinal!");const _=3,v=this._lodMeshes[o];v.material=p;const g=p.uniforms,y=this._sizeLods[a]-1,E=isFinite(c)?Math.PI/(2*y):2*Math.PI/(2*cs-1),A=c/E,x=isFinite(c)?1+Math.floor(_*A):cs;x>cs&&me(`sigmaRadians, ${c}, is too large and will clip, as it requested ${x} samples when the maximum is set to ${cs}`);const S=[];let D=0;for(let P=0;P<cs;++P){const T=P/A,O=Math.exp(-T*T/2);S.push(O),P===0?D+=O:P<x&&(D+=2*O)}for(let P=0;P<S.length;P++)S[P]=S[P]/D;g.envMap.value=t.texture,g.samples.value=x,g.weights.value=S,g.latitudinal.value=u==="latitudinal",d&&(g.poleAxis.value=d);const{_lodMax:U}=this;g.dTheta.value=E,g.mipInt.value=U-a;const w=this._sizeLods[o],B=3*w*(o>U-Cr?o-U+Cr:0),N=4*(this._cubeSize-w);go(n,B,N,3*w,2*w),m.setRenderTarget(n),m.render(v,Ol)}}function t3(r){const t=[],n=[],a=[];let o=r;const c=r-Cr+1+Wx.length;for(let u=0;u<c;u++){const d=Math.pow(2,o);t.push(d);let m=1/d;u>r-Cr?m=Wx[u-r+Cr-1]:u===0&&(m=0),n.push(m);const p=1/(d-2),_=-p,v=1+p,g=[_,_,v,_,v,v,_,_,v,v,_,v],y=6,E=6,A=3,x=2,S=1,D=new Float32Array(A*E*y),U=new Float32Array(x*E*y),w=new Float32Array(S*E*y);for(let N=0;N<y;N++){const P=N%3*2/3-1,T=N>2?0:-1,O=[P,T,0,P+2/3,T,0,P+2/3,T+1,0,P,T,0,P+2/3,T+1,0,P,T+1,0];D.set(O,A*E*N),U.set(g,x*E*N);const W=[N,N,N,N,N,N];w.set(W,S*E*N)}const B=new Dn;B.setAttribute("position",new Vn(D,A)),B.setAttribute("uv",new Vn(U,x)),B.setAttribute("faceIndex",new Vn(w,S)),a.push(new ln(B,null)),o>Cr&&o--}return{lodMeshes:a,sizeLods:t,sigmas:n}}function Yx(r,t,n){const a=new ai(r,t,n);return a.texture.mapping=Ef,a.texture.name="PMREM.cubeUv",a.scissorTest=!0,a}function go(r,t,n,a,o){r.viewport.set(t,n,a,o),r.scissor.set(t,n,a,o)}function e3(r,t,n){return new kn({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:jR,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Af(),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 <cube_uv_reflection_fragment>
#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:sa,depthTest:!1,depthWrite:!1})}function n3(r,t,n){const a=new Float32Array(cs),o=new z(0,1,0);return new kn({name:"SphericalGaussianBlur",defines:{n:cs,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:a},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:o}},vertexShader:Af(),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 <cube_uv_reflection_fragment>
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:sa,depthTest:!1,depthWrite:!1})}function Zx(){return new kn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Af(),fragmentShader:`
precision mediump float;
precision mediump int;
varying vec3 vOutputDirection;
uniform sampler2D envMap;
#include <common>
void main() {
vec3 outputDirection = normalize( vOutputDirection );
vec2 uv = equirectUv( outputDirection );
gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
}
`,blending:sa,depthTest:!1,depthWrite:!1})}function Kx(){return new kn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Af(),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:sa,depthTest:!1,depthWrite:!1})}function Af(){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 yS extends ai{constructor(t=1,n={}){super(t,t,n),this.isWebGLCubeRenderTarget=!0;const a={width:t,height:t,depth:1},o=[a,a,a,a,a,a];this.texture=new hS(o),this._setTextureOptions(n),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(t,n){this.texture.type=n.type,this.texture.colorSpace=n.colorSpace,this.texture.generateMipmaps=n.generateMipmaps,this.texture.minFilter=n.minFilter,this.texture.magFilter=n.magFilter;const a={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 <begin_vertex>
#include <project_vertex>
}
`,fragmentShader:`
uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
vec3 direction = normalize( vWorldDirection );
vec2 sampleUV = equirectUv( direction );
gl_FragColor = texture2D( tEquirect, sampleUV );
}
`},o=new Jl(5,5,5),c=new kn({name:"CubemapFromEquirect",uniforms:Ao(a.uniforms),vertexShader:a.vertexShader,fragmentShader:a.fragmentShader,side:ii,blending:sa});c.uniforms.tEquirect.value=n;const u=new ln(o,c),d=n.minFilter;return n.minFilter===fs&&(n.minFilter=Gn),new rA(1,10,this).update(t,u),n.minFilter=d,u.geometry.dispose(),u.material.dispose(),this}clear(t,n=!0,a=!0,o=!0){const c=t.getRenderTarget();for(let u=0;u<6;u++)t.setRenderTarget(this,u),t.clear(n,a,o);t.setRenderTarget(c)}}function i3(r){let t=new WeakMap,n=new WeakMap,a=null;function o(g,y=!1){return g==null?null:y?u(g):c(g)}function c(g){if(g&&g.isTexture){const y=g.mapping;if(y===Hd||y===Gd)if(t.has(g)){const E=t.get(g).texture;return d(E,g.mapping)}else{const E=g.image;if(E&&E.height>0){const A=new yS(E.height);return A.fromEquirectangularTexture(r,g),t.set(g,A),g.addEventListener("dispose",p),d(A.texture,g.mapping)}else return null}}return g}function u(g){if(g&&g.isTexture){const y=g.mapping,E=y===Hd||y===Gd,A=y===ps||y===bo;if(E||A){let x=n.get(g);const S=x!==void 0?x.texture.pmremVersion:0;if(g.isRenderTargetTexture&&g.pmremVersion!==S)return a===null&&(a=new qx(r)),x=E?a.fromEquirectangular(g,x):a.fromCubemap(g,x),x.texture.pmremVersion=g.pmremVersion,n.set(g,x),x.texture;if(x!==void 0)return x.texture;{const D=g.image;return E&&D&&D.height>0||A&&D&&m(D)?(a===null&&(a=new qx(r)),x=E?a.fromEquirectangular(g):a.fromCubemap(g),x.texture.pmremVersion=g.pmremVersion,n.set(g,x),g.addEventListener("dispose",_),x.texture):null}}}return g}function d(g,y){return y===Hd?g.mapping=ps:y===Gd&&(g.mapping=bo),g}function m(g){let y=0;const E=6;for(let A=0;A<E;A++)g[A]!==void 0&&y++;return y===E}function p(g){const y=g.target;y.removeEventListener("dispose",p);const E=t.get(y);E!==void 0&&(t.delete(y),E.dispose())}function _(g){const y=g.target;y.removeEventListener("dispose",_);const E=n.get(y);E!==void 0&&(n.delete(y),E.dispose())}function v(){t=new WeakMap,n=new WeakMap,a!==null&&(a.dispose(),a=null)}return{get:o,dispose:v}}function a3(r){const t={};function n(a){if(t[a]!==void 0)return t[a];const o=r.getExtension(a);return t[a]=o,o}return{has:function(a){return n(a)!==null},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(a){const o=n(a);return o===null&&yo("WebGLRenderer: "+a+" extension not supported."),o}}}function r3(r,t,n,a){const o={},c=new WeakMap;function u(v){const g=v.target;g.index!==null&&t.remove(g.index);for(const E in g.attributes)t.remove(g.attributes[E]);g.removeEventListener("dispose",u),delete o[g.id];const y=c.get(g);y&&(t.remove(y),c.delete(g)),a.releaseStatesOfGeometry(g),g.isInstancedBufferGeometry===!0&&delete g._maxInstanceCount,n.memory.geometries--}function d(v,g){return o[g.id]===!0||(g.addEventListener("dispose",u),o[g.id]=!0,n.memory.geometries++),g}function m(v){const g=v.attributes;for(const y in g)t.update(g[y],r.ARRAY_BUFFER)}function p(v){const g=[],y=v.index,E=v.attributes.position;let A=0;if(E===void 0)return;if(y!==null){const D=y.array;A=y.version;for(let U=0,w=D.length;U<w;U+=3){const B=D[U+0],N=D[U+1],P=D[U+2];g.push(B,N,N,P,P,B)}}else{const D=E.array;A=E.version;for(let U=0,w=D.length/3-1;U<w;U+=3){const B=U+0,N=U+1,P=U+2;g.push(B,N,N,P,P,B)}}const x=new(E.count>=65535?lS:oS)(g,1);x.version=A;const S=c.get(v);S&&t.remove(S),c.set(v,x)}function _(v){const g=c.get(v);if(g){const y=v.index;y!==null&&g.version<y.version&&p(v)}else p(v);return c.get(v)}return{get:d,update:m,getWireframeAttribute:_}}function s3(r,t,n){let a;function o(v){a=v}let c,u;function d(v){c=v.type,u=v.bytesPerElement}function m(v,g){r.drawElements(a,g,c,v*u),n.update(g,a,1)}function p(v,g,y){y!==0&&(r.drawElementsInstanced(a,g,c,v*u,y),n.update(g,a,y))}function _(v,g,y){if(y===0)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(a,g,0,c,v,0,y);let A=0;for(let x=0;x<y;x++)A+=g[x];n.update(A,a,1)}this.setMode=o,this.setIndex=d,this.render=m,this.renderInstances=p,this.renderMultiDraw=_}function o3(r){const t={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function a(c,u,d){switch(n.calls++,u){case r.TRIANGLES:n.triangles+=d*(c/3);break;case r.LINES:n.lines+=d*(c/2);break;case r.LINE_STRIP:n.lines+=d*(c-1);break;case r.LINE_LOOP:n.lines+=d*c;break;case r.POINTS:n.points+=d*c;break;default:Oe("WebGLInfo: Unknown draw mode:",u);break}}function o(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:t,render:n,programs:null,autoReset:!0,reset:o,update:a}}function l3(r,t,n){const a=new WeakMap,o=new cn;function c(u,d,m){const p=u.morphTargetInfluences,_=d.morphAttributes.position||d.morphAttributes.normal||d.morphAttributes.color,v=_!==void 0?_.length:0;let g=a.get(d);if(g===void 0||g.count!==v){let W=function(){T.dispose(),a.delete(d),d.removeEventListener("dispose",W)};var y=W;g!==void 0&&g.texture.dispose();const E=d.morphAttributes.position!==void 0,A=d.morphAttributes.normal!==void 0,x=d.morphAttributes.color!==void 0,S=d.morphAttributes.position||[],D=d.morphAttributes.normal||[],U=d.morphAttributes.color||[];let w=0;E===!0&&(w=1),A===!0&&(w=2),x===!0&&(w=3);let B=d.attributes.position.count*w,N=1;B>t.maxTextureSize&&(N=Math.ceil(B/t.maxTextureSize),B=t.maxTextureSize);const P=new Float32Array(B*N*4*v),T=new aS(P,B,N,v);T.type=Wi,T.needsUpdate=!0;const O=w*4;for(let k=0;k<v;k++){const Q=S[k],dt=D[k],vt=U[k],Z=B*N*4*k;for(let F=0;F<Q.count;F++){const V=F*O;E===!0&&(o.fromBufferAttribute(Q,F),P[Z+V+0]=o.x,P[Z+V+1]=o.y,P[Z+V+2]=o.z,P[Z+V+3]=0),A===!0&&(o.fromBufferAttribute(dt,F),P[Z+V+4]=o.x,P[Z+V+5]=o.y,P[Z+V+6]=o.z,P[Z+V+7]=0),x===!0&&(o.fromBufferAttribute(vt,F),P[Z+V+8]=o.x,P[Z+V+9]=o.y,P[Z+V+10]=o.z,P[Z+V+11]=vt.itemSize===4?o.w:1)}}g={count:v,texture:T,size:new fe(B,N)},a.set(d,g),d.addEventListener("dispose",W)}if(u.isInstancedMesh===!0&&u.morphTexture!==null)m.getUniforms().setValue(r,"morphTexture",u.morphTexture,n);else{let E=0;for(let x=0;x<p.length;x++)E+=p[x];const A=d.morphTargetsRelative?1:1-E;m.getUniforms().setValue(r,"morphTargetBaseInfluence",A),m.getUniforms().setValue(r,"morphTargetInfluences",p)}m.getUniforms().setValue(r,"morphTargetsTexture",g.texture,n),m.getUniforms().setValue(r,"morphTargetsTextureSize",g.size)}return{update:c}}function c3(r,t,n,a,o){let c=new WeakMap;function u(p){const _=o.render.frame,v=p.geometry,g=t.get(p,v);if(c.get(g)!==_&&(t.update(g),c.set(g,_)),p.isInstancedMesh&&(p.hasEventListener("dispose",m)===!1&&p.addEventListener("dispose",m),c.get(p)!==_&&(n.update(p.instanceMatrix,r.ARRAY_BUFFER),p.instanceColor!==null&&n.update(p.instanceColor,r.ARRAY_BUFFER),c.set(p,_))),p.isSkinnedMesh){const y=p.skeleton;c.get(y)!==_&&(y.update(),c.set(y,_))}return g}function d(){c=new WeakMap}function m(p){const _=p.target;_.removeEventListener("dispose",m),a.releaseStatesOfObject(_),n.remove(_.instanceMatrix),_.instanceColor!==null&&n.remove(_.instanceColor)}return{update:u,dispose:d}}const u3={[Wy]:"LINEAR_TONE_MAPPING",[Xy]:"REINHARD_TONE_MAPPING",[qy]:"CINEON_TONE_MAPPING",[Pm]:"ACES_FILMIC_TONE_MAPPING",[Zy]:"AGX_TONE_MAPPING",[Ky]:"NEUTRAL_TONE_MAPPING",[Yy]:"CUSTOM_TONE_MAPPING"};function f3(r,t,n,a,o,c){const u=new ai(t,n,{type:r,depthBuffer:o,stencilBuffer:c,samples:a?4:0,depthTexture:o?new To(t,n):void 0}),d=new ai(t,n,{type:Mi,depthBuffer:!1,stencilBuffer:!1}),m=new Dn;m.setAttribute("position",new Mn([-1,3,0,-1,-1,0,3,-1,0],3)),m.setAttribute("uv",new Mn([0,2,0,0,2,0],2));const p=new jT({uniforms:{tDiffuse:{value:null}},vertexShader:`
precision highp float;
uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;
attribute vec3 position;
attribute vec2 uv;
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,fragmentShader:`
precision highp float;
uniform sampler2D tDiffuse;
varying vec2 vUv;
#include <tonemapping_pars_fragment>
#include <colorspace_pars_fragment>
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}),_=new ln(m,p),v=new Tf(-1,1,1,-1,0,1);let g=null,y=null,E=!1,A,x=null,S=[],D=!1;this.setSize=function(U,w){u.setSize(U,w),d.setSize(U,w);for(let B=0;B<S.length;B++){const N=S[B];N.setSize&&N.setSize(U,w)}},this.setEffects=function(U){S=U,D=S.length>0&&S[0].isRenderPass===!0;const w=u.width,B=u.height;for(let N=0;N<S.length;N++){const P=S[N];P.setSize&&P.setSize(w,B)}},this.begin=function(U,w){if(E||U.toneMapping===oa&&S.length===0)return!1;if(x=w,w!==null){const B=w.width,N=w.height;(u.width!==B||u.height!==N)&&this.setSize(B,N)}return D===!1&&U.setRenderTarget(u),A=U.toneMapping,U.toneMapping=oa,!0},this.hasRenderPass=function(){return D},this.end=function(U,w){U.toneMapping=A,E=!0;let B=u,N=d;for(let P=0;P<S.length;P++){const T=S[P];if(T.enabled!==!1&&(T.render(U,N,B,w),T.needsSwap!==!1)){const O=B;B=N,N=O}}if(g!==U.outputColorSpace||y!==U.toneMapping){g=U.outputColorSpace,y=U.toneMapping,p.defines={},Ne.getTransfer(g)===Ye&&(p.defines.SRGB_TRANSFER="");const P=u3[y];P&&(p.defines[P]=""),p.needsUpdate=!0}p.uniforms.tDiffuse.value=B.texture,U.setRenderTarget(x),U.render(_,v),x=null,E=!1},this.isCompositing=function(){return E},this.dispose=function(){u.depthTexture&&u.depthTexture.dispose(),u.dispose(),d.dispose(),m.dispose(),p.dispose()}}const SS=new Xn,xm=new To(1,1),MS=new aS,ES=new bT,bS=new hS,Qx=[],Jx=[],jx=new Float32Array(16),$x=new Float32Array(9),ty=new Float32Array(4);function Do(r,t,n){const a=r[0];if(a<=0||a>0)return r;const o=t*n;let c=Qx[o];if(c===void 0&&(c=new Float32Array(o),Qx[o]=c),t!==0){a.toArray(c,0);for(let u=1,d=0;u!==t;++u)d+=n,r[u].toArray(c,d)}return c}function An(r,t){if(r.length!==t.length)return!1;for(let n=0,a=r.length;n<a;n++)if(r[n]!==t[n])return!1;return!0}function Rn(r,t){for(let n=0,a=t.length;n<a;n++)r[n]=t[n]}function Rf(r,t){let n=Jx[t];n===void 0&&(n=new Int32Array(t),Jx[t]=n);for(let a=0;a!==t;++a)n[a]=r.allocateTextureUnit();return n}function h3(r,t){const n=this.cache;n[0]!==t&&(r.uniform1f(this.addr,t),n[0]=t)}function d3(r,t){const n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y)&&(r.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(An(n,t))return;r.uniform2fv(this.addr,t),Rn(n,t)}}function p3(r,t){const n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(r.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(t.r!==void 0)(n[0]!==t.r||n[1]!==t.g||n[2]!==t.b)&&(r.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(An(n,t))return;r.uniform3fv(this.addr,t),Rn(n,t)}}function m3(r,t){const n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(r.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(An(n,t))return;r.uniform4fv(this.addr,t),Rn(n,t)}}function g3(r,t){const n=this.cache,a=t.elements;if(a===void 0){if(An(n,t))return;r.uniformMatrix2fv(this.addr,!1,t),Rn(n,t)}else{if(An(n,a))return;ty.set(a),r.uniformMatrix2fv(this.addr,!1,ty),Rn(n,a)}}function _3(r,t){const n=this.cache,a=t.elements;if(a===void 0){if(An(n,t))return;r.uniformMatrix3fv(this.addr,!1,t),Rn(n,t)}else{if(An(n,a))return;$x.set(a),r.uniformMatrix3fv(this.addr,!1,$x),Rn(n,a)}}function v3(r,t){const n=this.cache,a=t.elements;if(a===void 0){if(An(n,t))return;r.uniformMatrix4fv(this.addr,!1,t),Rn(n,t)}else{if(An(n,a))return;jx.set(a),r.uniformMatrix4fv(this.addr,!1,jx),Rn(n,a)}}function x3(r,t){const n=this.cache;n[0]!==t&&(r.uniform1i(this.addr,t),n[0]=t)}function y3(r,t){const n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y)&&(r.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(An(n,t))return;r.uniform2iv(this.addr,t),Rn(n,t)}}function S3(r,t){const n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(r.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(An(n,t))return;r.uniform3iv(this.addr,t),Rn(n,t)}}function M3(r,t){const n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(r.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(An(n,t))return;r.uniform4iv(this.addr,t),Rn(n,t)}}function E3(r,t){const n=this.cache;n[0]!==t&&(r.uniform1ui(this.addr,t),n[0]=t)}function b3(r,t){const n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y)&&(r.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(An(n,t))return;r.uniform2uiv(this.addr,t),Rn(n,t)}}function T3(r,t){const n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(r.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(An(n,t))return;r.uniform3uiv(this.addr,t),Rn(n,t)}}function A3(r,t){const n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(r.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(An(n,t))return;r.uniform4uiv(this.addr,t),Rn(n,t)}}function R3(r,t,n){const a=this.cache,o=n.allocateTextureUnit();a[0]!==o&&(r.uniform1i(this.addr,o),a[0]=o);let c;this.type===r.SAMPLER_2D_SHADOW?(xm.compareFunction=n.isReversedDepthBuffer()?Wm:km,c=xm):c=SS,n.setTexture2D(t||c,o)}function w3(r,t,n){const a=this.cache,o=n.allocateTextureUnit();a[0]!==o&&(r.uniform1i(this.addr,o),a[0]=o),n.setTexture3D(t||ES,o)}function C3(r,t,n){const a=this.cache,o=n.allocateTextureUnit();a[0]!==o&&(r.uniform1i(this.addr,o),a[0]=o),n.setTextureCube(t||bS,o)}function D3(r,t,n){const a=this.cache,o=n.allocateTextureUnit();a[0]!==o&&(r.uniform1i(this.addr,o),a[0]=o),n.setTexture2DArray(t||MS,o)}function L3(r){switch(r){case 5126:return h3;case 35664:return d3;case 35665:return p3;case 35666:return m3;case 35674:return g3;case 35675:return _3;case 35676:return v3;case 5124:case 35670:return x3;case 35667:case 35671:return y3;case 35668:case 35672:return S3;case 35669:case 35673:return M3;case 5125:return E3;case 36294:return b3;case 36295:return T3;case 36296:return A3;case 35678:case 36198:case 36298:case 36306:case 35682:return R3;case 35679:case 36299:case 36307:return w3;case 35680:case 36300:case 36308:case 36293:return C3;case 36289:case 36303:case 36311:case 36292:return D3}}function U3(r,t){r.uniform1fv(this.addr,t)}function N3(r,t){const n=Do(t,this.size,2);r.uniform2fv(this.addr,n)}function O3(r,t){const n=Do(t,this.size,3);r.uniform3fv(this.addr,n)}function P3(r,t){const n=Do(t,this.size,4);r.uniform4fv(this.addr,n)}function B3(r,t){const n=Do(t,this.size,4);r.uniformMatrix2fv(this.addr,!1,n)}function I3(r,t){const n=Do(t,this.size,9);r.uniformMatrix3fv(this.addr,!1,n)}function z3(r,t){const n=Do(t,this.size,16);r.uniformMatrix4fv(this.addr,!1,n)}function F3(r,t){r.uniform1iv(this.addr,t)}function H3(r,t){r.uniform2iv(this.addr,t)}function G3(r,t){r.uniform3iv(this.addr,t)}function V3(r,t){r.uniform4iv(this.addr,t)}function k3(r,t){r.uniform1uiv(this.addr,t)}function W3(r,t){r.uniform2uiv(this.addr,t)}function X3(r,t){r.uniform3uiv(this.addr,t)}function q3(r,t){r.uniform4uiv(this.addr,t)}function Y3(r,t,n){const a=this.cache,o=t.length,c=Rf(n,o);An(a,c)||(r.uniform1iv(this.addr,c),Rn(a,c));let u;this.type===r.SAMPLER_2D_SHADOW?u=xm:u=SS;for(let d=0;d!==o;++d)n.setTexture2D(t[d]||u,c[d])}function Z3(r,t,n){const a=this.cache,o=t.length,c=Rf(n,o);An(a,c)||(r.uniform1iv(this.addr,c),Rn(a,c));for(let u=0;u!==o;++u)n.setTexture3D(t[u]||ES,c[u])}function K3(r,t,n){const a=this.cache,o=t.length,c=Rf(n,o);An(a,c)||(r.uniform1iv(this.addr,c),Rn(a,c));for(let u=0;u!==o;++u)n.setTextureCube(t[u]||bS,c[u])}function Q3(r,t,n){const a=this.cache,o=t.length,c=Rf(n,o);An(a,c)||(r.uniform1iv(this.addr,c),Rn(a,c));for(let u=0;u!==o;++u)n.setTexture2DArray(t[u]||MS,c[u])}function J3(r){switch(r){case 5126:return U3;case 35664:return N3;case 35665:return O3;case 35666:return P3;case 35674:return B3;case 35675:return I3;case 35676:return z3;case 5124:case 35670:return F3;case 35667:case 35671:return H3;case 35668:case 35672:return G3;case 35669:case 35673:return V3;case 5125:return k3;case 36294:return W3;case 36295:return X3;case 36296:return q3;case 35678:case 36198:case 36298:case 36306:case 35682:return Y3;case 35679:case 36299:case 36307:return Z3;case 35680:case 36300:case 36308:case 36293:return K3;case 36289:case 36303:case 36311:case 36292:return Q3}}class j3{constructor(t,n,a){this.id=t,this.addr=a,this.cache=[],this.type=n.type,this.setValue=L3(n.type)}}class $3{constructor(t,n,a){this.id=t,this.addr=a,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=J3(n.type)}}class tw{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,n,a){const o=this.seq;for(let c=0,u=o.length;c!==u;++c){const d=o[c];d.setValue(t,n[d.id],a)}}}const bp=/(\w+)(\])?(\[|\.)?/g;function ey(r,t){r.seq.push(t),r.map[t.id]=t}function ew(r,t,n){const a=r.name,o=a.length;for(bp.lastIndex=0;;){const c=bp.exec(a),u=bp.lastIndex;let d=c[1];const m=c[2]==="]",p=c[3];if(m&&(d=d|0),p===void 0||p==="["&&u+2===o){ey(n,p===void 0?new j3(d,r,t):new $3(d,r,t));break}else{let v=n.map[d];v===void 0&&(v=new tw(d),ey(n,v)),n=v}}}class ef{constructor(t,n){this.seq=[],this.map={};const a=t.getProgramParameter(n,t.ACTIVE_UNIFORMS);for(let u=0;u<a;++u){const d=t.getActiveUniform(n,u),m=t.getUniformLocation(n,d.name);ew(d,m,this)}const o=[],c=[];for(const u of this.seq)u.type===t.SAMPLER_2D_SHADOW||u.type===t.SAMPLER_CUBE_SHADOW||u.type===t.SAMPLER_2D_ARRAY_SHADOW?o.push(u):c.push(u);o.length>0&&(this.seq=o.concat(c))}setValue(t,n,a,o){const c=this.map[n];c!==void 0&&c.setValue(t,a,o)}setOptional(t,n,a){const o=n[a];o!==void 0&&this.setValue(t,a,o)}static upload(t,n,a,o){for(let c=0,u=n.length;c!==u;++c){const d=n[c],m=a[d.id];m.needsUpdate!==!1&&d.setValue(t,m.value,o)}}static seqWithValue(t,n){const a=[];for(let o=0,c=t.length;o!==c;++o){const u=t[o];u.id in n&&a.push(u)}return a}}function ny(r,t,n){const a=r.createShader(t);return r.shaderSource(a,n),r.compileShader(a),a}const nw=37297;let iw=0;function aw(r,t){const n=r.split(`
`),a=[],o=Math.max(t-6,0),c=Math.min(t+6,n.length);for(let u=o;u<c;u++){const d=u+1;a.push(`${d===t?">":" "} ${d}: ${n[u]}`)}return a.join(`
`)}const iy=new Se;function rw(r){Ne._getMatrix(iy,Ne.workingColorSpace,r);const t=`mat3( ${iy.elements.map(n=>n.toFixed(4))} )`;switch(Ne.getTransfer(r)){case cf:return[t,"LinearTransferOETF"];case Ye:return[t,"sRGBTransferOETF"];default:return me("WebGLProgram: Unsupported color space: ",r),[t,"LinearTransferOETF"]}}function ay(r,t,n){const a=r.getShaderParameter(t,r.COMPILE_STATUS),c=(r.getShaderInfoLog(t)||"").trim();if(a&&c==="")return"";const u=/ERROR: 0:(\d+)/.exec(c);if(u){const d=parseInt(u[1]);return n.toUpperCase()+`
`+c+`
`+aw(r.getShaderSource(t),d)}else return c}function sw(r,t){const n=rw(t);return[`vec4 ${r}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(`
`)}const ow={[Wy]:"Linear",[Xy]:"Reinhard",[qy]:"Cineon",[Pm]:"ACESFilmic",[Zy]:"AgX",[Ky]:"Neutral",[Yy]:"Custom"};function lw(r,t){const n=ow[t];return n===void 0?(me("WebGLProgram: Unsupported toneMapping:",t),"vec3 "+r+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+r+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const Wu=new z;function cw(){Ne.getLuminanceCoefficients(Wu);const r=Wu.x.toFixed(4),t=Wu.y.toFixed(4),n=Wu.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${r}, ${t}, ${n} );`," return dot( weights, rgb );","}"].join(`
`)}function uw(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Fl).join(`
`)}function fw(r){const t=[];for(const n in r){const a=r[n];a!==!1&&t.push("#define "+n+" "+a)}return t.join(`
`)}function hw(r,t){const n={},a=r.getProgramParameter(t,r.ACTIVE_ATTRIBUTES);for(let o=0;o<a;o++){const c=r.getActiveAttrib(t,o),u=c.name;let d=1;c.type===r.FLOAT_MAT2&&(d=2),c.type===r.FLOAT_MAT3&&(d=3),c.type===r.FLOAT_MAT4&&(d=4),n[u]={type:c.type,location:r.getAttribLocation(t,u),locationSize:d}}return n}function Fl(r){return r!==""}function ry(r,t){const n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return r.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function sy(r,t){return r.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const dw=/^[ \t]*#include +<([\w\d./]+)>/gm;function ym(r){return r.replace(dw,mw)}const pw=new Map;function mw(r,t){let n=Te[t];if(n===void 0){const a=pw.get(t);if(a!==void 0)n=Te[a],me('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,a);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+t+">")}return ym(n)}const gw=/#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 oy(r){return r.replace(gw,_w)}function _w(r,t,n,a){let o="";for(let c=parseInt(t);c<parseInt(n);c++)o+=a.replace(/\[\s*i\s*\]/g,"[ "+c+" ]").replace(/UNROLLED_LOOP_INDEX/g,c);return o}function ly(r){let t=`precision ${r.precision} float;
precision ${r.precision} int;
precision ${r.precision} sampler2D;
precision ${r.precision} samplerCube;
precision ${r.precision} sampler3D;
precision ${r.precision} sampler2DArray;
precision ${r.precision} sampler2DShadow;
precision ${r.precision} samplerCubeShadow;
precision ${r.precision} sampler2DArrayShadow;
precision ${r.precision} isampler2D;
precision ${r.precision} isampler3D;
precision ${r.precision} isamplerCube;
precision ${r.precision} isampler2DArray;
precision ${r.precision} usampler2D;
precision ${r.precision} usampler3D;
precision ${r.precision} usamplerCube;
precision ${r.precision} usampler2DArray;
`;return r.precision==="highp"?t+=`
#define HIGH_PRECISION`:r.precision==="mediump"?t+=`
#define MEDIUM_PRECISION`:r.precision==="lowp"&&(t+=`
#define LOW_PRECISION`),t}const vw={[Ku]:"SHADOWMAP_TYPE_PCF",[zl]:"SHADOWMAP_TYPE_VSM"};function xw(r){return vw[r.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const yw={[ps]:"ENVMAP_TYPE_CUBE",[bo]:"ENVMAP_TYPE_CUBE",[Ef]:"ENVMAP_TYPE_CUBE_UV"};function Sw(r){return r.envMap===!1?"ENVMAP_TYPE_CUBE":yw[r.envMapMode]||"ENVMAP_TYPE_CUBE"}const Mw={[bo]:"ENVMAP_MODE_REFRACTION"};function Ew(r){return r.envMap===!1?"ENVMAP_MODE_REFLECTION":Mw[r.envMapMode]||"ENVMAP_MODE_REFLECTION"}const bw={[ky]:"ENVMAP_BLENDING_MULTIPLY",[Vb]:"ENVMAP_BLENDING_MIX",[kb]:"ENVMAP_BLENDING_ADD"};function Tw(r){return r.envMap===!1?"ENVMAP_BLENDING_NONE":bw[r.combine]||"ENVMAP_BLENDING_NONE"}function Aw(r){const t=r.envMapCubeUVHeight;if(t===null)return null;const n=Math.log2(t)-2,a=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:a,maxMip:n}}function Rw(r,t,n,a){const o=r.getContext(),c=n.defines;let u=n.vertexShader,d=n.fragmentShader;const m=xw(n),p=Sw(n),_=Ew(n),v=Tw(n),g=Aw(n),y=uw(n),E=fw(c),A=o.createProgram();let x,S,D=n.glslVersion?"#version "+n.glslVersion+`
`:"";n.isRawShaderMaterial?(x=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,E].filter(Fl).join(`
`),x.length>0&&(x+=`
`),S=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,E].filter(Fl).join(`
`),S.length>0&&(S+=`
`)):(x=[ly(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,E,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+_:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexNormals?"#define HAS_NORMAL":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+m:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.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(Fl).join(`
`),S=[ly(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,E,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+p:"",n.envMap?"#define "+_:"",n.envMap?"#define "+v:"",g?"#define CUBEUV_TEXEL_WIDTH "+g.texelWidth:"",g?"#define CUBEUV_TEXEL_HEIGHT "+g.texelHeight:"",g?"#define CUBEUV_MAX_MIP "+g.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas||n.batchingColor?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+m:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==oa?"#define TONE_MAPPING":"",n.toneMapping!==oa?Te.tonemapping_pars_fragment:"",n.toneMapping!==oa?lw("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Te.colorspace_pars_fragment,sw("linearToOutputTexel",n.outputColorSpace),cw(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
`].filter(Fl).join(`
`)),u=ym(u),u=ry(u,n),u=sy(u,n),d=ym(d),d=ry(d,n),d=sy(d,n),u=oy(u),d=oy(d),n.isRawShaderMaterial!==!0&&(D=`#version 300 es
`,x=[y,"#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
`+x,S=["#define varying in",n.glslVersion===sx?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===sx?"":"#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(`
`)+`
`+S);const U=D+x+u,w=D+S+d,B=ny(o,o.VERTEX_SHADER,U),N=ny(o,o.FRAGMENT_SHADER,w);o.attachShader(A,B),o.attachShader(A,N),n.index0AttributeName!==void 0?o.bindAttribLocation(A,0,n.index0AttributeName):n.hasPositionAttribute===!0&&o.bindAttribLocation(A,0,"position"),o.linkProgram(A);function P(k){if(r.debug.checkShaderErrors){const Q=o.getProgramInfoLog(A)||"",dt=o.getShaderInfoLog(B)||"",vt=o.getShaderInfoLog(N)||"",Z=Q.trim(),F=dt.trim(),V=vt.trim();let et=!0,mt=!0;if(o.getProgramParameter(A,o.LINK_STATUS)===!1)if(et=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(o,A,B,N);else{const At=ay(o,B,"vertex"),I=ay(o,N,"fragment");Oe("WebGLProgram: Shader Error "+o.getError()+" - VALIDATE_STATUS "+o.getProgramParameter(A,o.VALIDATE_STATUS)+`
Material Name: `+k.name+`
Material Type: `+k.type+`
Program Info Log: `+Z+`
`+At+`
`+I)}else Z!==""?me("WebGLProgram: Program Info Log:",Z):(F===""||V==="")&&(mt=!1);mt&&(k.diagnostics={runnable:et,programLog:Z,vertexShader:{log:F,prefix:x},fragmentShader:{log:V,prefix:S}})}o.deleteShader(B),o.deleteShader(N),T=new ef(o,A),O=hw(o,A)}let T;this.getUniforms=function(){return T===void 0&&P(this),T};let O;this.getAttributes=function(){return O===void 0&&P(this),O};let W=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return W===!1&&(W=o.getProgramParameter(A,nw)),W},this.destroy=function(){a.releaseStatesOfProgram(this),o.deleteProgram(A),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=iw++,this.cacheKey=t,this.usedTimes=1,this.program=A,this.vertexShader=B,this.fragmentShader=N,this}let ww=0;class Cw{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t,n,a){const o=this._getShaderCacheForMaterial(t);return o.has(n)===!1&&(o.add(n),n.usedTimes++),o.has(a)===!1&&(o.add(a),a.usedTimes++),this}remove(t){const n=this.materialCache.get(t);for(const a of n)a.usedTimes--,a.usedTimes===0&&this.shaderCache.delete(a.code);return this.materialCache.delete(t),this}getVertexShaderStage(t){return this._getShaderStage(t.vertexShader)}getFragmentShaderStage(t){return this._getShaderStage(t.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const n=this.materialCache;let a=n.get(t);return a===void 0&&(a=new Set,n.set(t,a)),a}_getShaderStage(t){const n=this.shaderCache;let a=n.get(t);return a===void 0&&(a=new Dw(t),n.set(t,a)),a}}class Dw{constructor(t){this.id=ww++,this.code=t,this.usedTimes=0}}function Lw(r){return r===ms||r===sf||r===of}function Uw(r,t,n,a,o,c){const u=new rS,d=new Cw,m=new Set,p=[],_=new Map,v=a.logarithmicDepthBuffer;let g=a.precision;const y={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function E(T){return m.add(T),T===0?"uv":`uv${T}`}function A(T,O,W,k,Q,dt){const vt=k.fog,Z=Q.geometry,F=T.isMeshStandardMaterial||T.isMeshLambertMaterial||T.isMeshPhongMaterial?k.environment:null,V=T.isMeshStandardMaterial||T.isMeshLambertMaterial&&!T.envMap||T.isMeshPhongMaterial&&!T.envMap,et=t.get(T.envMap||F,V),mt=et&&et.mapping===Ef?et.image.height:null,At=y[T.type];T.precision!==null&&(g=a.getMaxPrecision(T.precision),g!==T.precision&&me("WebGLProgram.getParameters:",T.precision,"not supported, using",g,"instead."));const I=Z.morphAttributes.position||Z.morphAttributes.normal||Z.morphAttributes.color,J=I!==void 0?I.length:0;let bt=0;Z.morphAttributes.position!==void 0&&(bt=1),Z.morphAttributes.normal!==void 0&&(bt=2),Z.morphAttributes.color!==void 0&&(bt=3);let Lt,Ht,st,St;if(At){const Kt=ia[At];Lt=Kt.vertexShader,Ht=Kt.fragmentShader}else{Lt=T.vertexShader,Ht=T.fragmentShader;const Kt=d.getVertexShaderStage(T),an=d.getFragmentShaderStage(T);d.update(T,Kt,an),st=Kt.id,St=an.id}const Et=r.getRenderTarget(),Yt=r.state.buffers.depth.getReversed(),ge=Q.isInstancedMesh===!0,se=Q.isBatchedMesh===!0,kt=!!T.map,Mt=!!T.matcap,gt=!!et,Ut=!!T.aoMap,Rt=!!T.lightMap,Jt=!!T.bumpMap&&T.wireframe===!1,jt=!!T.normalMap,ee=!!T.displacementMap,ne=!!T.emissiveMap,le=!!T.metalnessMap,ve=!!T.roughnessMap,H=T.anisotropy>0,Ft=T.clearcoat>0,ie=T.dispersion>0,L=T.iridescence>0,b=T.sheen>0,K=T.transmission>0,$=H&&!!T.anisotropyMap,tt=Ft&&!!T.clearcoatMap,wt=Ft&&!!T.clearcoatNormalMap,Ct=Ft&&!!T.clearcoatRoughnessMap,ct=L&&!!T.iridescenceMap,ft=L&&!!T.iridescenceThicknessMap,Dt=b&&!!T.sheenColorMap,Xt=b&&!!T.sheenRoughnessMap,Bt=!!T.specularMap,Ot=!!T.specularColorMap,ue=!!T.specularIntensityMap,he=K&&!!T.transmissionMap,xe=K&&!!T.thicknessMap,q=!!T.gradientMap,Nt=!!T.alphaMap,_t=T.alphaTest>0,Pt=!!T.alphaHash,Wt=!!T.extensions;let Tt=oa;T.toneMapped&&(Et===null||Et.isXRRenderTarget===!0)&&(Tt=r.toneMapping);const ae={shaderID:At,shaderType:T.type,shaderName:T.name,vertexShader:Lt,fragmentShader:Ht,defines:T.defines,customVertexShaderID:st,customFragmentShaderID:St,isRawShaderMaterial:T.isRawShaderMaterial===!0,glslVersion:T.glslVersion,precision:g,batching:se,batchingColor:se&&Q._colorsTexture!==null,instancing:ge,instancingColor:ge&&Q.instanceColor!==null,instancingMorph:ge&&Q.morphTexture!==null,outputColorSpace:Et===null?r.outputColorSpace:Et.isXRRenderTarget===!0?Et.texture.colorSpace:Ne.workingColorSpace,alphaToCoverage:!!T.alphaToCoverage,map:kt,matcap:Mt,envMap:gt,envMapMode:gt&&et.mapping,envMapCubeUVHeight:mt,aoMap:Ut,lightMap:Rt,bumpMap:Jt,normalMap:jt,displacementMap:ee,emissiveMap:ne,normalMapObjectSpace:jt&&T.normalMapType===qb,normalMapTangentSpace:jt&&T.normalMapType===pm,packedNormalMap:jt&&T.normalMapType===pm&&Lw(T.normalMap.format),metalnessMap:le,roughnessMap:ve,anisotropy:H,anisotropyMap:$,clearcoat:Ft,clearcoatMap:tt,clearcoatNormalMap:wt,clearcoatRoughnessMap:Ct,dispersion:ie,iridescence:L,iridescenceMap:ct,iridescenceThicknessMap:ft,sheen:b,sheenColorMap:Dt,sheenRoughnessMap:Xt,specularMap:Bt,specularColorMap:Ot,specularIntensityMap:ue,transmission:K,transmissionMap:he,thicknessMap:xe,gradientMap:q,opaque:T.transparent===!1&&T.blending===xo&&T.alphaToCoverage===!1,alphaMap:Nt,alphaTest:_t,alphaHash:Pt,combine:T.combine,mapUv:kt&&E(T.map.channel),aoMapUv:Ut&&E(T.aoMap.channel),lightMapUv:Rt&&E(T.lightMap.channel),bumpMapUv:Jt&&E(T.bumpMap.channel),normalMapUv:jt&&E(T.normalMap.channel),displacementMapUv:ee&&E(T.displacementMap.channel),emissiveMapUv:ne&&E(T.emissiveMap.channel),metalnessMapUv:le&&E(T.metalnessMap.channel),roughnessMapUv:ve&&E(T.roughnessMap.channel),anisotropyMapUv:$&&E(T.anisotropyMap.channel),clearcoatMapUv:tt&&E(T.clearcoatMap.channel),clearcoatNormalMapUv:wt&&E(T.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ct&&E(T.clearcoatRoughnessMap.channel),iridescenceMapUv:ct&&E(T.iridescenceMap.channel),iridescenceThicknessMapUv:ft&&E(T.iridescenceThicknessMap.channel),sheenColorMapUv:Dt&&E(T.sheenColorMap.channel),sheenRoughnessMapUv:Xt&&E(T.sheenRoughnessMap.channel),specularMapUv:Bt&&E(T.specularMap.channel),specularColorMapUv:Ot&&E(T.specularColorMap.channel),specularIntensityMapUv:ue&&E(T.specularIntensityMap.channel),transmissionMapUv:he&&E(T.transmissionMap.channel),thicknessMapUv:xe&&E(T.thicknessMap.channel),alphaMapUv:Nt&&E(T.alphaMap.channel),vertexTangents:!!Z.attributes.tangent&&(jt||H),vertexNormals:!!Z.attributes.normal,vertexColors:T.vertexColors,vertexAlphas:T.vertexColors===!0&&!!Z.attributes.color&&Z.attributes.color.itemSize===4,pointsUvs:Q.isPoints===!0&&!!Z.attributes.uv&&(kt||Nt),fog:!!vt,useFog:T.fog===!0,fogExp2:!!vt&&vt.isFogExp2,flatShading:T.wireframe===!1&&(T.flatShading===!0||Z.attributes.normal===void 0&&jt===!1&&(T.isMeshLambertMaterial||T.isMeshPhongMaterial||T.isMeshStandardMaterial||T.isMeshPhysicalMaterial)),sizeAttenuation:T.sizeAttenuation===!0,logarithmicDepthBuffer:v,reversedDepthBuffer:Yt,skinning:Q.isSkinnedMesh===!0,hasPositionAttribute:Z.attributes.position!==void 0,morphTargets:Z.morphAttributes.position!==void 0,morphNormals:Z.morphAttributes.normal!==void 0,morphColors:Z.morphAttributes.color!==void 0,morphTargetsCount:J,morphTextureStride:bt,numDirLights:O.directional.length,numPointLights:O.point.length,numSpotLights:O.spot.length,numSpotLightMaps:O.spotLightMap.length,numRectAreaLights:O.rectArea.length,numHemiLights:O.hemi.length,numDirLightShadows:O.directionalShadowMap.length,numPointLightShadows:O.pointShadowMap.length,numSpotLightShadows:O.spotShadowMap.length,numSpotLightShadowsWithMaps:O.numSpotLightShadowsWithMaps,numLightProbes:O.numLightProbes,numLightProbeGrids:dt.length,numClippingPlanes:c.numPlanes,numClipIntersection:c.numIntersection,dithering:T.dithering,shadowMapEnabled:r.shadowMap.enabled&&W.length>0,shadowMapType:r.shadowMap.type,toneMapping:Tt,decodeVideoTexture:kt&&T.map.isVideoTexture===!0&&Ne.getTransfer(T.map.colorSpace)===Ye,decodeVideoTextureEmissive:ne&&T.emissiveMap.isVideoTexture===!0&&Ne.getTransfer(T.emissiveMap.colorSpace)===Ye,premultipliedAlpha:T.premultipliedAlpha,doubleSided:T.side===aa,flipSided:T.side===ii,useDepthPacking:T.depthPacking>=0,depthPacking:T.depthPacking||0,index0AttributeName:T.index0AttributeName,extensionClipCullDistance:Wt&&T.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Wt&&T.extensions.multiDraw===!0||se)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:T.customProgramCacheKey()};return ae.vertexUv1s=m.has(1),ae.vertexUv2s=m.has(2),ae.vertexUv3s=m.has(3),m.clear(),ae}function x(T){const O=[];if(T.shaderID?O.push(T.shaderID):(O.push(T.customVertexShaderID),O.push(T.customFragmentShaderID)),T.defines!==void 0)for(const W in T.defines)O.push(W),O.push(T.defines[W]);return T.isRawShaderMaterial===!1&&(S(O,T),D(O,T),O.push(r.outputColorSpace)),O.push(T.customProgramCacheKey),O.join()}function S(T,O){T.push(O.precision),T.push(O.outputColorSpace),T.push(O.envMapMode),T.push(O.envMapCubeUVHeight),T.push(O.mapUv),T.push(O.alphaMapUv),T.push(O.lightMapUv),T.push(O.aoMapUv),T.push(O.bumpMapUv),T.push(O.normalMapUv),T.push(O.displacementMapUv),T.push(O.emissiveMapUv),T.push(O.metalnessMapUv),T.push(O.roughnessMapUv),T.push(O.anisotropyMapUv),T.push(O.clearcoatMapUv),T.push(O.clearcoatNormalMapUv),T.push(O.clearcoatRoughnessMapUv),T.push(O.iridescenceMapUv),T.push(O.iridescenceThicknessMapUv),T.push(O.sheenColorMapUv),T.push(O.sheenRoughnessMapUv),T.push(O.specularMapUv),T.push(O.specularColorMapUv),T.push(O.specularIntensityMapUv),T.push(O.transmissionMapUv),T.push(O.thicknessMapUv),T.push(O.combine),T.push(O.fogExp2),T.push(O.sizeAttenuation),T.push(O.morphTargetsCount),T.push(O.morphAttributeCount),T.push(O.numDirLights),T.push(O.numPointLights),T.push(O.numSpotLights),T.push(O.numSpotLightMaps),T.push(O.numHemiLights),T.push(O.numRectAreaLights),T.push(O.numDirLightShadows),T.push(O.numPointLightShadows),T.push(O.numSpotLightShadows),T.push(O.numSpotLightShadowsWithMaps),T.push(O.numLightProbes),T.push(O.shadowMapType),T.push(O.toneMapping),T.push(O.numClippingPlanes),T.push(O.numClipIntersection),T.push(O.depthPacking)}function D(T,O){u.disableAll(),O.instancing&&u.enable(0),O.instancingColor&&u.enable(1),O.instancingMorph&&u.enable(2),O.matcap&&u.enable(3),O.envMap&&u.enable(4),O.normalMapObjectSpace&&u.enable(5),O.normalMapTangentSpace&&u.enable(6),O.clearcoat&&u.enable(7),O.iridescence&&u.enable(8),O.alphaTest&&u.enable(9),O.vertexColors&&u.enable(10),O.vertexAlphas&&u.enable(11),O.vertexUv1s&&u.enable(12),O.vertexUv2s&&u.enable(13),O.vertexUv3s&&u.enable(14),O.vertexTangents&&u.enable(15),O.anisotropy&&u.enable(16),O.alphaHash&&u.enable(17),O.batching&&u.enable(18),O.dispersion&&u.enable(19),O.batchingColor&&u.enable(20),O.gradientMap&&u.enable(21),O.packedNormalMap&&u.enable(22),O.vertexNormals&&u.enable(23),T.push(u.mask),u.disableAll(),O.fog&&u.enable(0),O.useFog&&u.enable(1),O.flatShading&&u.enable(2),O.logarithmicDepthBuffer&&u.enable(3),O.reversedDepthBuffer&&u.enable(4),O.skinning&&u.enable(5),O.morphTargets&&u.enable(6),O.morphNormals&&u.enable(7),O.morphColors&&u.enable(8),O.premultipliedAlpha&&u.enable(9),O.shadowMapEnabled&&u.enable(10),O.doubleSided&&u.enable(11),O.flipSided&&u.enable(12),O.useDepthPacking&&u.enable(13),O.dithering&&u.enable(14),O.transmission&&u.enable(15),O.sheen&&u.enable(16),O.opaque&&u.enable(17),O.pointsUvs&&u.enable(18),O.decodeVideoTexture&&u.enable(19),O.decodeVideoTextureEmissive&&u.enable(20),O.alphaToCoverage&&u.enable(21),O.numLightProbeGrids>0&&u.enable(22),O.hasPositionAttribute&&u.enable(23),T.push(u.mask)}function U(T){const O=y[T.type];let W;if(O){const k=ia[O];W=gf.clone(k.uniforms)}else W=T.uniforms;return W}function w(T,O){let W=_.get(O);return W!==void 0?++W.usedTimes:(W=new Rw(r,O,T,o),p.push(W),_.set(O,W)),W}function B(T){if(--T.usedTimes===0){const O=p.indexOf(T);p[O]=p[p.length-1],p.pop(),_.delete(T.cacheKey),T.destroy()}}function N(T){d.remove(T)}function P(){d.dispose()}return{getParameters:A,getProgramCacheKey:x,getUniforms:U,acquireProgram:w,releaseProgram:B,releaseShaderCache:N,programs:p,dispose:P}}function Nw(){let r=new WeakMap;function t(u){return r.has(u)}function n(u){let d=r.get(u);return d===void 0&&(d={},r.set(u,d)),d}function a(u){r.delete(u)}function o(u,d,m){r.get(u)[d]=m}function c(){r=new WeakMap}return{has:t,get:n,remove:a,update:o,dispose:c}}function Ow(r,t){return r.groupOrder!==t.groupOrder?r.groupOrder-t.groupOrder:r.renderOrder!==t.renderOrder?r.renderOrder-t.renderOrder:r.material.id!==t.material.id?r.material.id-t.material.id:r.materialVariant!==t.materialVariant?r.materialVariant-t.materialVariant:r.z!==t.z?r.z-t.z:r.id-t.id}function cy(r,t){return r.groupOrder!==t.groupOrder?r.groupOrder-t.groupOrder:r.renderOrder!==t.renderOrder?r.renderOrder-t.renderOrder:r.z!==t.z?t.z-r.z:r.id-t.id}function uy(){const r=[];let t=0;const n=[],a=[],o=[];function c(){t=0,n.length=0,a.length=0,o.length=0}function u(g){let y=0;return g.isInstancedMesh&&(y+=2),g.isSkinnedMesh&&(y+=1),y}function d(g,y,E,A,x,S){let D=r[t];return D===void 0?(D={id:g.id,object:g,geometry:y,material:E,materialVariant:u(g),groupOrder:A,renderOrder:g.renderOrder,z:x,group:S},r[t]=D):(D.id=g.id,D.object=g,D.geometry=y,D.material=E,D.materialVariant=u(g),D.groupOrder=A,D.renderOrder=g.renderOrder,D.z=x,D.group=S),t++,D}function m(g,y,E,A,x,S){const D=d(g,y,E,A,x,S);E.transmission>0?a.push(D):E.transparent===!0?o.push(D):n.push(D)}function p(g,y,E,A,x,S){const D=d(g,y,E,A,x,S);E.transmission>0?a.unshift(D):E.transparent===!0?o.unshift(D):n.unshift(D)}function _(g,y,E){n.length>1&&n.sort(g||Ow),a.length>1&&a.sort(y||cy),o.length>1&&o.sort(y||cy),E&&(n.reverse(),a.reverse(),o.reverse())}function v(){for(let g=t,y=r.length;g<y;g++){const E=r[g];if(E.id===null)break;E.id=null,E.object=null,E.geometry=null,E.material=null,E.group=null}}return{opaque:n,transmissive:a,transparent:o,init:c,push:m,unshift:p,finish:v,sort:_}}function Pw(){let r=new WeakMap;function t(a,o){const c=r.get(a);let u;return c===void 0?(u=new uy,r.set(a,[u])):o>=c.length?(u=new uy,c.push(u)):u=c[o],u}function n(){r=new WeakMap}return{get:t,dispose:n}}function Bw(){const r={};return{get:function(t){if(r[t.id]!==void 0)return r[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new z,color:new ce};break;case"SpotLight":n={position:new z,direction:new z,color:new ce,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new z,color:new ce,distance:0,decay:0};break;case"HemisphereLight":n={direction:new z,skyColor:new ce,groundColor:new ce};break;case"RectAreaLight":n={color:new ce,position:new z,halfWidth:new z,halfHeight:new z};break}return r[t.id]=n,n}}}function Iw(){const r={};return{get:function(t){if(r[t.id]!==void 0)return r[t.id];let n;switch(t.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new fe};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new fe};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new fe,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[t.id]=n,n}}}let zw=0;function Fw(r,t){return(t.castShadow?2:0)-(r.castShadow?2:0)+(t.map?1:0)-(r.map?1:0)}function Hw(r){const t=new Bw,n=Iw(),a={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 p=0;p<9;p++)a.probe.push(new z);const o=new z,c=new ze,u=new ze;function d(p){let _=0,v=0,g=0;for(let O=0;O<9;O++)a.probe[O].set(0,0,0);let y=0,E=0,A=0,x=0,S=0,D=0,U=0,w=0,B=0,N=0,P=0;p.sort(Fw);for(let O=0,W=p.length;O<W;O++){const k=p[O],Q=k.color,dt=k.intensity,vt=k.distance;let Z=null;if(k.shadow&&k.shadow.map&&(k.shadow.map.texture.format===ms?Z=k.shadow.map.texture:Z=k.shadow.map.depthTexture||k.shadow.map.texture),k.isAmbientLight)_+=Q.r*dt,v+=Q.g*dt,g+=Q.b*dt;else if(k.isLightProbe){for(let F=0;F<9;F++)a.probe[F].addScaledVector(k.sh.coefficients[F],dt);P++}else if(k.isDirectionalLight){const F=t.get(k);if(F.color.copy(k.color).multiplyScalar(k.intensity),k.castShadow){const V=k.shadow,et=n.get(k);et.shadowIntensity=V.intensity,et.shadowBias=V.bias,et.shadowNormalBias=V.normalBias,et.shadowRadius=V.radius,et.shadowMapSize=V.mapSize,a.directionalShadow[y]=et,a.directionalShadowMap[y]=Z,a.directionalShadowMatrix[y]=k.shadow.matrix,D++}a.directional[y]=F,y++}else if(k.isSpotLight){const F=t.get(k);F.position.setFromMatrixPosition(k.matrixWorld),F.color.copy(Q).multiplyScalar(dt),F.distance=vt,F.coneCos=Math.cos(k.angle),F.penumbraCos=Math.cos(k.angle*(1-k.penumbra)),F.decay=k.decay,a.spot[A]=F;const V=k.shadow;if(k.map&&(a.spotLightMap[B]=k.map,B++,V.updateMatrices(k),k.castShadow&&N++),a.spotLightMatrix[A]=V.matrix,k.castShadow){const et=n.get(k);et.shadowIntensity=V.intensity,et.shadowBias=V.bias,et.shadowNormalBias=V.normalBias,et.shadowRadius=V.radius,et.shadowMapSize=V.mapSize,a.spotShadow[A]=et,a.spotShadowMap[A]=Z,w++}A++}else if(k.isRectAreaLight){const F=t.get(k);F.color.copy(Q).multiplyScalar(dt),F.halfWidth.set(k.width*.5,0,0),F.halfHeight.set(0,k.height*.5,0),a.rectArea[x]=F,x++}else if(k.isPointLight){const F=t.get(k);if(F.color.copy(k.color).multiplyScalar(k.intensity),F.distance=k.distance,F.decay=k.decay,k.castShadow){const V=k.shadow,et=n.get(k);et.shadowIntensity=V.intensity,et.shadowBias=V.bias,et.shadowNormalBias=V.normalBias,et.shadowRadius=V.radius,et.shadowMapSize=V.mapSize,et.shadowCameraNear=V.camera.near,et.shadowCameraFar=V.camera.far,a.pointShadow[E]=et,a.pointShadowMap[E]=Z,a.pointShadowMatrix[E]=k.shadow.matrix,U++}a.point[E]=F,E++}else if(k.isHemisphereLight){const F=t.get(k);F.skyColor.copy(k.color).multiplyScalar(dt),F.groundColor.copy(k.groundColor).multiplyScalar(dt),a.hemi[S]=F,S++}}x>0&&(r.has("OES_texture_float_linear")===!0?(a.rectAreaLTC1=Vt.LTC_FLOAT_1,a.rectAreaLTC2=Vt.LTC_FLOAT_2):(a.rectAreaLTC1=Vt.LTC_HALF_1,a.rectAreaLTC2=Vt.LTC_HALF_2)),a.ambient[0]=_,a.ambient[1]=v,a.ambient[2]=g;const T=a.hash;(T.directionalLength!==y||T.pointLength!==E||T.spotLength!==A||T.rectAreaLength!==x||T.hemiLength!==S||T.numDirectionalShadows!==D||T.numPointShadows!==U||T.numSpotShadows!==w||T.numSpotMaps!==B||T.numLightProbes!==P)&&(a.directional.length=y,a.spot.length=A,a.rectArea.length=x,a.point.length=E,a.hemi.length=S,a.directionalShadow.length=D,a.directionalShadowMap.length=D,a.pointShadow.length=U,a.pointShadowMap.length=U,a.spotShadow.length=w,a.spotShadowMap.length=w,a.directionalShadowMatrix.length=D,a.pointShadowMatrix.length=U,a.spotLightMatrix.length=w+B-N,a.spotLightMap.length=B,a.numSpotLightShadowsWithMaps=N,a.numLightProbes=P,T.directionalLength=y,T.pointLength=E,T.spotLength=A,T.rectAreaLength=x,T.hemiLength=S,T.numDirectionalShadows=D,T.numPointShadows=U,T.numSpotShadows=w,T.numSpotMaps=B,T.numLightProbes=P,a.version=zw++)}function m(p,_){let v=0,g=0,y=0,E=0,A=0;const x=_.matrixWorldInverse;for(let S=0,D=p.length;S<D;S++){const U=p[S];if(U.isDirectionalLight){const w=a.directional[v];w.direction.setFromMatrixPosition(U.matrixWorld),o.setFromMatrixPosition(U.target.matrixWorld),w.direction.sub(o),w.direction.transformDirection(x),v++}else if(U.isSpotLight){const w=a.spot[y];w.position.setFromMatrixPosition(U.matrixWorld),w.position.applyMatrix4(x),w.direction.setFromMatrixPosition(U.matrixWorld),o.setFromMatrixPosition(U.target.matrixWorld),w.direction.sub(o),w.direction.transformDirection(x),y++}else if(U.isRectAreaLight){const w=a.rectArea[E];w.position.setFromMatrixPosition(U.matrixWorld),w.position.applyMatrix4(x),u.identity(),c.copy(U.matrixWorld),c.premultiply(x),u.extractRotation(c),w.halfWidth.set(U.width*.5,0,0),w.halfHeight.set(0,U.height*.5,0),w.halfWidth.applyMatrix4(u),w.halfHeight.applyMatrix4(u),E++}else if(U.isPointLight){const w=a.point[g];w.position.setFromMatrixPosition(U.matrixWorld),w.position.applyMatrix4(x),g++}else if(U.isHemisphereLight){const w=a.hemi[A];w.direction.setFromMatrixPosition(U.matrixWorld),w.direction.transformDirection(x),A++}}}return{setup:d,setupView:m,state:a}}function fy(r){const t=new Hw(r),n=[],a=[],o=[];function c(g){v.camera=g,n.length=0,a.length=0,o.length=0}function u(g){n.push(g)}function d(g){a.push(g)}function m(g){o.push(g)}function p(){t.setup(n)}function _(g){t.setupView(n,g)}const v={lightsArray:n,shadowsArray:a,lightProbeGridArray:o,camera:null,lights:t,transmissionRenderTarget:{},textureUnits:0};return{init:c,state:v,setupLights:p,setupLightsView:_,pushLight:u,pushShadow:d,pushLightProbeGrid:m}}function Gw(r){let t=new WeakMap;function n(o,c=0){const u=t.get(o);let d;return u===void 0?(d=new fy(r),t.set(o,[d])):c>=u.length?(d=new fy(r),u.push(d)):d=u[c],d}function a(){t=new WeakMap}return{get:n,dispose:a}}const Vw=`void main() {
gl_Position = vec4( position, 1.0 );
}`,kw=`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 );
}`,Ww=[new z(1,0,0),new z(-1,0,0),new z(0,1,0),new z(0,-1,0),new z(0,0,1),new z(0,0,-1)],Xw=[new z(0,-1,0),new z(0,-1,0),new z(0,0,1),new z(0,0,-1),new z(0,-1,0),new z(0,-1,0)],hy=new ze,Pl=new z,Tp=new z;function qw(r,t,n){let a=new Km;const o=new fe,c=new fe,u=new cn,d=new $T,m=new tA,p={},_=n.maxTextureSize,v={[Dr]:ii,[ii]:Dr,[aa]:aa},g=new kn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new fe},radius:{value:4}},vertexShader:Vw,fragmentShader:kw}),y=g.clone();y.defines.HORIZONTAL_PASS=1;const E=new Dn;E.setAttribute("position",new Vn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const A=new ln(E,g),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ku;let S=this.type;this.render=function(N,P,T){if(x.enabled===!1||x.autoUpdate===!1&&x.needsUpdate===!1||N.length===0)return;this.type===Eb&&(me("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Ku);const O=r.getRenderTarget(),W=r.getActiveCubeFace(),k=r.getActiveMipmapLevel(),Q=r.state;Q.setBlending(sa),Q.buffers.depth.getReversed()===!0?Q.buffers.color.setClear(0,0,0,0):Q.buffers.color.setClear(1,1,1,1),Q.buffers.depth.setTest(!0),Q.setScissorTest(!1);const dt=S!==this.type;dt&&P.traverse(function(vt){vt.material&&(Array.isArray(vt.material)?vt.material.forEach(Z=>Z.needsUpdate=!0):vt.material.needsUpdate=!0)});for(let vt=0,Z=N.length;vt<Z;vt++){const F=N[vt],V=F.shadow;if(V===void 0){me("WebGLShadowMap:",F,"has no shadow.");continue}if(V.autoUpdate===!1&&V.needsUpdate===!1)continue;o.copy(V.mapSize);const et=V.getFrameExtents();o.multiply(et),c.copy(V.mapSize),(o.x>_||o.y>_)&&(o.x>_&&(c.x=Math.floor(_/et.x),o.x=c.x*et.x,V.mapSize.x=c.x),o.y>_&&(c.y=Math.floor(_/et.y),o.y=c.y*et.y,V.mapSize.y=c.y));const mt=r.state.buffers.depth.getReversed();if(V.camera._reversedDepth=mt,V.map===null||dt===!0){if(V.map!==null&&(V.map.depthTexture!==null&&(V.map.depthTexture.dispose(),V.map.depthTexture=null),V.map.dispose()),this.type===zl){if(F.isPointLight){me("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}V.map=new ai(o.x,o.y,{format:ms,type:Mi,minFilter:Gn,magFilter:Gn,generateMipmaps:!1}),V.map.texture.name=F.name+".shadowMap",V.map.depthTexture=new To(o.x,o.y,Wi),V.map.depthTexture.name=F.name+".shadowMapDepth",V.map.depthTexture.format=ka,V.map.depthTexture.compareFunction=null,V.map.depthTexture.minFilter=Bn,V.map.depthTexture.magFilter=Bn}else F.isPointLight?(V.map=new yS(o.x),V.map.depthTexture=new XT(o.x,ca)):(V.map=new ai(o.x,o.y),V.map.depthTexture=new To(o.x,o.y,ca)),V.map.depthTexture.name=F.name+".shadowMap",V.map.depthTexture.format=ka,this.type===Ku?(V.map.depthTexture.compareFunction=mt?Wm:km,V.map.depthTexture.minFilter=Gn,V.map.depthTexture.magFilter=Gn):(V.map.depthTexture.compareFunction=null,V.map.depthTexture.minFilter=Bn,V.map.depthTexture.magFilter=Bn);V.camera.updateProjectionMatrix()}const At=V.map.isWebGLCubeRenderTarget?6:1;for(let I=0;I<At;I++){if(V.map.isWebGLCubeRenderTarget)r.setRenderTarget(V.map,I),r.clear();else{I===0&&(r.setRenderTarget(V.map),r.clear());const J=V.getViewport(I);u.set(c.x*J.x,c.y*J.y,c.x*J.z,c.y*J.w),Q.viewport(u)}if(F.isPointLight){const J=V.camera,bt=V.matrix,Lt=F.distance||J.far;Lt!==J.far&&(J.far=Lt,J.updateProjectionMatrix()),Pl.setFromMatrixPosition(F.matrixWorld),J.position.copy(Pl),Tp.copy(J.position),Tp.add(Ww[I]),J.up.copy(Xw[I]),J.lookAt(Tp),J.updateMatrixWorld(),bt.makeTranslation(-Pl.x,-Pl.y,-Pl.z),hy.multiplyMatrices(J.projectionMatrix,J.matrixWorldInverse),V._frustum.setFromProjectionMatrix(hy,J.coordinateSystem,J.reversedDepth)}else V.updateMatrices(F);a=V.getFrustum(),w(P,T,V.camera,F,this.type)}V.isPointLightShadow!==!0&&this.type===zl&&D(V,T),V.needsUpdate=!1}S=this.type,x.needsUpdate=!1,r.setRenderTarget(O,W,k)};function D(N,P){const T=t.update(A);g.defines.VSM_SAMPLES!==N.blurSamples&&(g.defines.VSM_SAMPLES=N.blurSamples,y.defines.VSM_SAMPLES=N.blurSamples,g.needsUpdate=!0,y.needsUpdate=!0),N.mapPass===null&&(N.mapPass=new ai(o.x,o.y,{format:ms,type:Mi})),g.uniforms.shadow_pass.value=N.map.depthTexture,g.uniforms.resolution.value=N.mapSize,g.uniforms.radius.value=N.radius,r.setRenderTarget(N.mapPass),r.clear(),r.renderBufferDirect(P,null,T,g,A,null),y.uniforms.shadow_pass.value=N.mapPass.texture,y.uniforms.resolution.value=N.mapSize,y.uniforms.radius.value=N.radius,r.setRenderTarget(N.map),r.clear(),r.renderBufferDirect(P,null,T,y,A,null)}function U(N,P,T,O){let W=null;const k=T.isPointLight===!0?N.customDistanceMaterial:N.customDepthMaterial;if(k!==void 0)W=k;else if(W=T.isPointLight===!0?m:d,r.localClippingEnabled&&P.clipShadows===!0&&Array.isArray(P.clippingPlanes)&&P.clippingPlanes.length!==0||P.displacementMap&&P.displacementScale!==0||P.alphaMap&&P.alphaTest>0||P.map&&P.alphaTest>0||P.alphaToCoverage===!0){const Q=W.uuid,dt=P.uuid;let vt=p[Q];vt===void 0&&(vt={},p[Q]=vt);let Z=vt[dt];Z===void 0&&(Z=W.clone(),vt[dt]=Z,P.addEventListener("dispose",B)),W=Z}if(W.visible=P.visible,W.wireframe=P.wireframe,O===zl?W.side=P.shadowSide!==null?P.shadowSide:P.side:W.side=P.shadowSide!==null?P.shadowSide:v[P.side],W.alphaMap=P.alphaMap,W.alphaTest=P.alphaToCoverage===!0?.5:P.alphaTest,W.map=P.map,W.clipShadows=P.clipShadows,W.clippingPlanes=P.clippingPlanes,W.clipIntersection=P.clipIntersection,W.displacementMap=P.displacementMap,W.displacementScale=P.displacementScale,W.displacementBias=P.displacementBias,W.wireframeLinewidth=P.wireframeLinewidth,W.linewidth=P.linewidth,T.isPointLight===!0&&W.isMeshDistanceMaterial===!0){const Q=r.properties.get(W);Q.light=T}return W}function w(N,P,T,O,W){if(N.visible===!1)return;if(N.layers.test(P.layers)&&(N.isMesh||N.isLine||N.isPoints)&&(N.castShadow||N.receiveShadow&&W===zl)&&(!N.frustumCulled||a.intersectsObject(N))){N.modelViewMatrix.multiplyMatrices(T.matrixWorldInverse,N.matrixWorld);const dt=t.update(N),vt=N.material;if(Array.isArray(vt)){const Z=dt.groups;for(let F=0,V=Z.length;F<V;F++){const et=Z[F],mt=vt[et.materialIndex];if(mt&&mt.visible){const At=U(N,mt,O,W);N.onBeforeShadow(r,N,P,T,dt,At,et),r.renderBufferDirect(T,null,dt,At,N,et),N.onAfterShadow(r,N,P,T,dt,At,et)}}}else if(vt.visible){const Z=U(N,vt,O,W);N.onBeforeShadow(r,N,P,T,dt,Z,null),r.renderBufferDirect(T,null,dt,Z,N,null),N.onAfterShadow(r,N,P,T,dt,Z,null)}}const Q=N.children;for(let dt=0,vt=Q.length;dt<vt;dt++)w(Q[dt],P,T,O,W)}function B(N){N.target.removeEventListener("dispose",B);for(const T in p){const O=p[T],W=N.target.uuid;W in O&&(O[W].dispose(),delete O[W])}}}function Yw(r,t){function n(){let q=!1;const Nt=new cn;let _t=null;const Pt=new cn(0,0,0,0);return{setMask:function(Wt){_t!==Wt&&!q&&(r.colorMask(Wt,Wt,Wt,Wt),_t=Wt)},setLocked:function(Wt){q=Wt},setClear:function(Wt,Tt,ae,Kt,an){an===!0&&(Wt*=Kt,Tt*=Kt,ae*=Kt),Nt.set(Wt,Tt,ae,Kt),Pt.equals(Nt)===!1&&(r.clearColor(Wt,Tt,ae,Kt),Pt.copy(Nt))},reset:function(){q=!1,_t=null,Pt.set(-1,0,0,0)}}}function a(){let q=!1,Nt=!1,_t=null,Pt=null,Wt=null;return{setReversed:function(Tt){if(Nt!==Tt){const ae=t.get("EXT_clip_control");Tt?ae.clipControlEXT(ae.LOWER_LEFT_EXT,ae.ZERO_TO_ONE_EXT):ae.clipControlEXT(ae.LOWER_LEFT_EXT,ae.NEGATIVE_ONE_TO_ONE_EXT),Nt=Tt;const Kt=Wt;Wt=null,this.setClear(Kt)}},getReversed:function(){return Nt},setTest:function(Tt){Tt?Et(r.DEPTH_TEST):Yt(r.DEPTH_TEST)},setMask:function(Tt){_t!==Tt&&!q&&(r.depthMask(Tt),_t=Tt)},setFunc:function(Tt){if(Nt&&(Tt=nT[Tt]),Pt!==Tt){switch(Tt){case Cp:r.depthFunc(r.NEVER);break;case Dp:r.depthFunc(r.ALWAYS);break;case Lp:r.depthFunc(r.LESS);break;case Eo:r.depthFunc(r.LEQUAL);break;case Up:r.depthFunc(r.EQUAL);break;case Np:r.depthFunc(r.GEQUAL);break;case Op:r.depthFunc(r.GREATER);break;case Pp:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}Pt=Tt}},setLocked:function(Tt){q=Tt},setClear:function(Tt){Wt!==Tt&&(Wt=Tt,Nt&&(Tt=1-Tt),r.clearDepth(Tt))},reset:function(){q=!1,_t=null,Pt=null,Wt=null,Nt=!1}}}function o(){let q=!1,Nt=null,_t=null,Pt=null,Wt=null,Tt=null,ae=null,Kt=null,an=null;return{setTest:function(Ge){q||(Ge?Et(r.STENCIL_TEST):Yt(r.STENCIL_TEST))},setMask:function(Ge){Nt!==Ge&&!q&&(r.stencilMask(Ge),Nt=Ge)},setFunc:function(Ge,ri,si){(_t!==Ge||Pt!==ri||Wt!==si)&&(r.stencilFunc(Ge,ri,si),_t=Ge,Pt=ri,Wt=si)},setOp:function(Ge,ri,si){(Tt!==Ge||ae!==ri||Kt!==si)&&(r.stencilOp(Ge,ri,si),Tt=Ge,ae=ri,Kt=si)},setLocked:function(Ge){q=Ge},setClear:function(Ge){an!==Ge&&(r.clearStencil(Ge),an=Ge)},reset:function(){q=!1,Nt=null,_t=null,Pt=null,Wt=null,Tt=null,ae=null,Kt=null,an=null}}}const c=new n,u=new a,d=new o,m=new WeakMap,p=new WeakMap;let _={},v={},g={},y=new WeakMap,E=[],A=null,x=!1,S=null,D=null,U=null,w=null,B=null,N=null,P=null,T=new ce(0,0,0),O=0,W=!1,k=null,Q=null,dt=null,vt=null,Z=null;const F=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let V=!1,et=0;const mt=r.getParameter(r.VERSION);mt.indexOf("WebGL")!==-1?(et=parseFloat(/^WebGL (\d)/.exec(mt)[1]),V=et>=1):mt.indexOf("OpenGL ES")!==-1&&(et=parseFloat(/^OpenGL ES (\d)/.exec(mt)[1]),V=et>=2);let At=null,I={};const J=r.getParameter(r.SCISSOR_BOX),bt=r.getParameter(r.VIEWPORT),Lt=new cn().fromArray(J),Ht=new cn().fromArray(bt);function st(q,Nt,_t,Pt){const Wt=new Uint8Array(4),Tt=r.createTexture();r.bindTexture(q,Tt),r.texParameteri(q,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(q,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let ae=0;ae<_t;ae++)q===r.TEXTURE_3D||q===r.TEXTURE_2D_ARRAY?r.texImage3D(Nt,0,r.RGBA,1,1,Pt,0,r.RGBA,r.UNSIGNED_BYTE,Wt):r.texImage2D(Nt+ae,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,Wt);return Tt}const St={};St[r.TEXTURE_2D]=st(r.TEXTURE_2D,r.TEXTURE_2D,1),St[r.TEXTURE_CUBE_MAP]=st(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),St[r.TEXTURE_2D_ARRAY]=st(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),St[r.TEXTURE_3D]=st(r.TEXTURE_3D,r.TEXTURE_3D,1,1),c.setClear(0,0,0,1),u.setClear(1),d.setClear(0),Et(r.DEPTH_TEST),u.setFunc(Eo),Jt(!1),jt(nx),Et(r.CULL_FACE),Ut(sa);function Et(q){_[q]!==!0&&(r.enable(q),_[q]=!0)}function Yt(q){_[q]!==!1&&(r.disable(q),_[q]=!1)}function ge(q,Nt){return g[q]!==Nt?(r.bindFramebuffer(q,Nt),g[q]=Nt,q===r.DRAW_FRAMEBUFFER&&(g[r.FRAMEBUFFER]=Nt),q===r.FRAMEBUFFER&&(g[r.DRAW_FRAMEBUFFER]=Nt),!0):!1}function se(q,Nt){let _t=E,Pt=!1;if(q){_t=y.get(Nt),_t===void 0&&(_t=[],y.set(Nt,_t));const Wt=q.textures;if(_t.length!==Wt.length||_t[0]!==r.COLOR_ATTACHMENT0){for(let Tt=0,ae=Wt.length;Tt<ae;Tt++)_t[Tt]=r.COLOR_ATTACHMENT0+Tt;_t.length=Wt.length,Pt=!0}}else _t[0]!==r.BACK&&(_t[0]=r.BACK,Pt=!0);Pt&&r.drawBuffers(_t)}function kt(q){return A!==q?(r.useProgram(q),A=q,!0):!1}const Mt={[ls]:r.FUNC_ADD,[Tb]:r.FUNC_SUBTRACT,[Ab]:r.FUNC_REVERSE_SUBTRACT};Mt[Rb]=r.MIN,Mt[wb]=r.MAX;const gt={[Cb]:r.ZERO,[Db]:r.ONE,[Lb]:r.SRC_COLOR,[Rp]:r.SRC_ALPHA,[Ib]:r.SRC_ALPHA_SATURATE,[Pb]:r.DST_COLOR,[Nb]:r.DST_ALPHA,[Ub]:r.ONE_MINUS_SRC_COLOR,[wp]:r.ONE_MINUS_SRC_ALPHA,[Bb]:r.ONE_MINUS_DST_COLOR,[Ob]:r.ONE_MINUS_DST_ALPHA,[zb]:r.CONSTANT_COLOR,[Fb]:r.ONE_MINUS_CONSTANT_COLOR,[Hb]:r.CONSTANT_ALPHA,[Gb]:r.ONE_MINUS_CONSTANT_ALPHA};function Ut(q,Nt,_t,Pt,Wt,Tt,ae,Kt,an,Ge){if(q===sa){x===!0&&(Yt(r.BLEND),x=!1);return}if(x===!1&&(Et(r.BLEND),x=!0),q!==bb){if(q!==S||Ge!==W){if((D!==ls||B!==ls)&&(r.blendEquation(r.FUNC_ADD),D=ls,B=ls),Ge)switch(q){case xo:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Ar:r.blendFunc(r.ONE,r.ONE);break;case ix:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case ax:r.blendFuncSeparate(r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ZERO,r.ONE);break;default:Oe("WebGLState: Invalid blending: ",q);break}else switch(q){case xo:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case Ar:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE,r.ONE,r.ONE);break;case ix:Oe("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case ax:Oe("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Oe("WebGLState: Invalid blending: ",q);break}U=null,w=null,N=null,P=null,T.set(0,0,0),O=0,S=q,W=Ge}return}Wt=Wt||Nt,Tt=Tt||_t,ae=ae||Pt,(Nt!==D||Wt!==B)&&(r.blendEquationSeparate(Mt[Nt],Mt[Wt]),D=Nt,B=Wt),(_t!==U||Pt!==w||Tt!==N||ae!==P)&&(r.blendFuncSeparate(gt[_t],gt[Pt],gt[Tt],gt[ae]),U=_t,w=Pt,N=Tt,P=ae),(Kt.equals(T)===!1||an!==O)&&(r.blendColor(Kt.r,Kt.g,Kt.b,an),T.copy(Kt),O=an),S=q,W=!1}function Rt(q,Nt){q.side===aa?Yt(r.CULL_FACE):Et(r.CULL_FACE);let _t=q.side===ii;Nt&&(_t=!_t),Jt(_t),q.blending===xo&&q.transparent===!1?Ut(sa):Ut(q.blending,q.blendEquation,q.blendSrc,q.blendDst,q.blendEquationAlpha,q.blendSrcAlpha,q.blendDstAlpha,q.blendColor,q.blendAlpha,q.premultipliedAlpha),u.setFunc(q.depthFunc),u.setTest(q.depthTest),u.setMask(q.depthWrite),c.setMask(q.colorWrite);const Pt=q.stencilWrite;d.setTest(Pt),Pt&&(d.setMask(q.stencilWriteMask),d.setFunc(q.stencilFunc,q.stencilRef,q.stencilFuncMask),d.setOp(q.stencilFail,q.stencilZFail,q.stencilZPass)),ne(q.polygonOffset,q.polygonOffsetFactor,q.polygonOffsetUnits),q.alphaToCoverage===!0?Et(r.SAMPLE_ALPHA_TO_COVERAGE):Yt(r.SAMPLE_ALPHA_TO_COVERAGE)}function Jt(q){k!==q&&(q?r.frontFace(r.CW):r.frontFace(r.CCW),k=q)}function jt(q){q!==Sb?(Et(r.CULL_FACE),q!==Q&&(q===nx?r.cullFace(r.BACK):q===Mb?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):Yt(r.CULL_FACE),Q=q}function ee(q){q!==dt&&(V&&r.lineWidth(q),dt=q)}function ne(q,Nt,_t){q?(Et(r.POLYGON_OFFSET_FILL),(vt!==Nt||Z!==_t)&&(vt=Nt,Z=_t,u.getReversed()&&(Nt=-Nt),r.polygonOffset(Nt,_t))):Yt(r.POLYGON_OFFSET_FILL)}function le(q){q?Et(r.SCISSOR_TEST):Yt(r.SCISSOR_TEST)}function ve(q){q===void 0&&(q=r.TEXTURE0+F-1),At!==q&&(r.activeTexture(q),At=q)}function H(q,Nt,_t){_t===void 0&&(At===null?_t=r.TEXTURE0+F-1:_t=At);let Pt=I[_t];Pt===void 0&&(Pt={type:void 0,texture:void 0},I[_t]=Pt),(Pt.type!==q||Pt.texture!==Nt)&&(At!==_t&&(r.activeTexture(_t),At=_t),r.bindTexture(q,Nt||St[q]),Pt.type=q,Pt.texture=Nt)}function Ft(){const q=I[At];q!==void 0&&q.type!==void 0&&(r.bindTexture(q.type,null),q.type=void 0,q.texture=void 0)}function ie(){try{r.compressedTexImage2D(...arguments)}catch(q){Oe("WebGLState:",q)}}function L(){try{r.compressedTexImage3D(...arguments)}catch(q){Oe("WebGLState:",q)}}function b(){try{r.texSubImage2D(...arguments)}catch(q){Oe("WebGLState:",q)}}function K(){try{r.texSubImage3D(...arguments)}catch(q){Oe("WebGLState:",q)}}function $(){try{r.compressedTexSubImage2D(...arguments)}catch(q){Oe("WebGLState:",q)}}function tt(){try{r.compressedTexSubImage3D(...arguments)}catch(q){Oe("WebGLState:",q)}}function wt(){try{r.texStorage2D(...arguments)}catch(q){Oe("WebGLState:",q)}}function Ct(){try{r.texStorage3D(...arguments)}catch(q){Oe("WebGLState:",q)}}function ct(){try{r.texImage2D(...arguments)}catch(q){Oe("WebGLState:",q)}}function ft(){try{r.texImage3D(...arguments)}catch(q){Oe("WebGLState:",q)}}function Dt(q){return v[q]!==void 0?v[q]:r.getParameter(q)}function Xt(q,Nt){v[q]!==Nt&&(r.pixelStorei(q,Nt),v[q]=Nt)}function Bt(q){Lt.equals(q)===!1&&(r.scissor(q.x,q.y,q.z,q.w),Lt.copy(q))}function Ot(q){Ht.equals(q)===!1&&(r.viewport(q.x,q.y,q.z,q.w),Ht.copy(q))}function ue(q,Nt){let _t=p.get(Nt);_t===void 0&&(_t=new WeakMap,p.set(Nt,_t));let Pt=_t.get(q);Pt===void 0&&(Pt=r.getUniformBlockIndex(Nt,q.name),_t.set(q,Pt))}function he(q,Nt){const Pt=p.get(Nt).get(q);m.get(Nt)!==Pt&&(r.uniformBlockBinding(Nt,Pt,q.__bindingPointIndex),m.set(Nt,Pt))}function xe(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),u.setReversed(!1),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),r.pixelStorei(r.PACK_ALIGNMENT,4),r.pixelStorei(r.UNPACK_ALIGNMENT,4),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.BROWSER_DEFAULT_WEBGL),r.pixelStorei(r.PACK_ROW_LENGTH,0),r.pixelStorei(r.PACK_SKIP_PIXELS,0),r.pixelStorei(r.PACK_SKIP_ROWS,0),r.pixelStorei(r.UNPACK_ROW_LENGTH,0),r.pixelStorei(r.UNPACK_IMAGE_HEIGHT,0),r.pixelStorei(r.UNPACK_SKIP_PIXELS,0),r.pixelStorei(r.UNPACK_SKIP_ROWS,0),r.pixelStorei(r.UNPACK_SKIP_IMAGES,0),_={},v={},At=null,I={},g={},y=new WeakMap,E=[],A=null,x=!1,S=null,D=null,U=null,w=null,B=null,N=null,P=null,T=new ce(0,0,0),O=0,W=!1,k=null,Q=null,dt=null,vt=null,Z=null,Lt.set(0,0,r.canvas.width,r.canvas.height),Ht.set(0,0,r.canvas.width,r.canvas.height),c.reset(),u.reset(),d.reset()}return{buffers:{color:c,depth:u,stencil:d},enable:Et,disable:Yt,bindFramebuffer:ge,drawBuffers:se,useProgram:kt,setBlending:Ut,setMaterial:Rt,setFlipSided:Jt,setCullFace:jt,setLineWidth:ee,setPolygonOffset:ne,setScissorTest:le,activeTexture:ve,bindTexture:H,unbindTexture:Ft,compressedTexImage2D:ie,compressedTexImage3D:L,texImage2D:ct,texImage3D:ft,pixelStorei:Xt,getParameter:Dt,updateUBOMapping:ue,uniformBlockBinding:he,texStorage2D:wt,texStorage3D:Ct,texSubImage2D:b,texSubImage3D:K,compressedTexSubImage2D:$,compressedTexSubImage3D:tt,scissor:Bt,viewport:Ot,reset:xe}}function Zw(r,t,n,a,o,c,u){const d=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,m=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),p=new fe,_=new WeakMap,v=new Set;let g;const y=new WeakMap;let E=!1;try{E=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function A(L,b){return E?new OffscreenCanvas(L,b):uf("canvas")}function x(L,b,K){let $=1;const tt=ie(L);if((tt.width>K||tt.height>K)&&($=K/Math.max(tt.width,tt.height)),$<1)if(typeof HTMLImageElement<"u"&&L instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&L instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&L instanceof ImageBitmap||typeof VideoFrame<"u"&&L instanceof VideoFrame){const wt=Math.floor($*tt.width),Ct=Math.floor($*tt.height);g===void 0&&(g=A(wt,Ct));const ct=b?A(wt,Ct):g;return ct.width=wt,ct.height=Ct,ct.getContext("2d").drawImage(L,0,0,wt,Ct),me("WebGLRenderer: Texture has been resized from ("+tt.width+"x"+tt.height+") to ("+wt+"x"+Ct+")."),ct}else return"data"in L&&me("WebGLRenderer: Image in DataTexture is too big ("+tt.width+"x"+tt.height+")."),L;return L}function S(L){return L.generateMipmaps}function D(L){r.generateMipmap(L)}function U(L){return L.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:L.isWebGL3DRenderTarget?r.TEXTURE_3D:L.isWebGLArrayRenderTarget||L.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function w(L,b,K,$,tt,wt=!1){if(L!==null){if(r[L]!==void 0)return r[L];me("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+L+"'")}let Ct;$&&(Ct=t.get("EXT_texture_norm16"),Ct||me("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let ct=b;if(b===r.RED&&(K===r.FLOAT&&(ct=r.R32F),K===r.HALF_FLOAT&&(ct=r.R16F),K===r.UNSIGNED_BYTE&&(ct=r.R8),K===r.UNSIGNED_SHORT&&Ct&&(ct=Ct.R16_EXT),K===r.SHORT&&Ct&&(ct=Ct.R16_SNORM_EXT)),b===r.RED_INTEGER&&(K===r.UNSIGNED_BYTE&&(ct=r.R8UI),K===r.UNSIGNED_SHORT&&(ct=r.R16UI),K===r.UNSIGNED_INT&&(ct=r.R32UI),K===r.BYTE&&(ct=r.R8I),K===r.SHORT&&(ct=r.R16I),K===r.INT&&(ct=r.R32I)),b===r.RG&&(K===r.FLOAT&&(ct=r.RG32F),K===r.HALF_FLOAT&&(ct=r.RG16F),K===r.UNSIGNED_BYTE&&(ct=r.RG8),K===r.UNSIGNED_SHORT&&Ct&&(ct=Ct.RG16_EXT),K===r.SHORT&&Ct&&(ct=Ct.RG16_SNORM_EXT)),b===r.RG_INTEGER&&(K===r.UNSIGNED_BYTE&&(ct=r.RG8UI),K===r.UNSIGNED_SHORT&&(ct=r.RG16UI),K===r.UNSIGNED_INT&&(ct=r.RG32UI),K===r.BYTE&&(ct=r.RG8I),K===r.SHORT&&(ct=r.RG16I),K===r.INT&&(ct=r.RG32I)),b===r.RGB_INTEGER&&(K===r.UNSIGNED_BYTE&&(ct=r.RGB8UI),K===r.UNSIGNED_SHORT&&(ct=r.RGB16UI),K===r.UNSIGNED_INT&&(ct=r.RGB32UI),K===r.BYTE&&(ct=r.RGB8I),K===r.SHORT&&(ct=r.RGB16I),K===r.INT&&(ct=r.RGB32I)),b===r.RGBA_INTEGER&&(K===r.UNSIGNED_BYTE&&(ct=r.RGBA8UI),K===r.UNSIGNED_SHORT&&(ct=r.RGBA16UI),K===r.UNSIGNED_INT&&(ct=r.RGBA32UI),K===r.BYTE&&(ct=r.RGBA8I),K===r.SHORT&&(ct=r.RGBA16I),K===r.INT&&(ct=r.RGBA32I)),b===r.RGB&&(K===r.UNSIGNED_SHORT&&Ct&&(ct=Ct.RGB16_EXT),K===r.SHORT&&Ct&&(ct=Ct.RGB16_SNORM_EXT),K===r.UNSIGNED_INT_5_9_9_9_REV&&(ct=r.RGB9_E5),K===r.UNSIGNED_INT_10F_11F_11F_REV&&(ct=r.R11F_G11F_B10F)),b===r.RGBA){const ft=wt?cf:Ne.getTransfer(tt);K===r.FLOAT&&(ct=r.RGBA32F),K===r.HALF_FLOAT&&(ct=r.RGBA16F),K===r.UNSIGNED_BYTE&&(ct=ft===Ye?r.SRGB8_ALPHA8:r.RGBA8),K===r.UNSIGNED_SHORT&&Ct&&(ct=Ct.RGBA16_EXT),K===r.SHORT&&Ct&&(ct=Ct.RGBA16_SNORM_EXT),K===r.UNSIGNED_SHORT_4_4_4_4&&(ct=r.RGBA4),K===r.UNSIGNED_SHORT_5_5_5_1&&(ct=r.RGB5_A1)}return(ct===r.R16F||ct===r.R32F||ct===r.RG16F||ct===r.RG32F||ct===r.RGBA16F||ct===r.RGBA32F)&&t.get("EXT_color_buffer_float"),ct}function B(L,b){let K;return L?b===null||b===ca||b===Wl?K=r.DEPTH24_STENCIL8:b===Wi?K=r.DEPTH32F_STENCIL8:b===kl&&(K=r.DEPTH24_STENCIL8,me("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):b===null||b===ca||b===Wl?K=r.DEPTH_COMPONENT24:b===Wi?K=r.DEPTH_COMPONENT32F:b===kl&&(K=r.DEPTH_COMPONENT16),K}function N(L,b){return S(L)===!0||L.isFramebufferTexture&&L.minFilter!==Bn&&L.minFilter!==Gn?Math.log2(Math.max(b.width,b.height))+1:L.mipmaps!==void 0&&L.mipmaps.length>0?L.mipmaps.length:L.isCompressedTexture&&Array.isArray(L.image)?b.mipmaps.length:1}function P(L){const b=L.target;b.removeEventListener("dispose",P),O(b),b.isVideoTexture&&_.delete(b),b.isHTMLTexture&&v.delete(b)}function T(L){const b=L.target;b.removeEventListener("dispose",T),k(b)}function O(L){const b=a.get(L);if(b.__webglInit===void 0)return;const K=L.source,$=y.get(K);if($){const tt=$[b.__cacheKey];tt.usedTimes--,tt.usedTimes===0&&W(L),Object.keys($).length===0&&y.delete(K)}a.remove(L)}function W(L){const b=a.get(L);r.deleteTexture(b.__webglTexture);const K=L.source,$=y.get(K);delete $[b.__cacheKey],u.memory.textures--}function k(L){const b=a.get(L);if(L.depthTexture&&(L.depthTexture.dispose(),a.remove(L.depthTexture)),L.isWebGLCubeRenderTarget)for(let $=0;$<6;$++){if(Array.isArray(b.__webglFramebuffer[$]))for(let tt=0;tt<b.__webglFramebuffer[$].length;tt++)r.deleteFramebuffer(b.__webglFramebuffer[$][tt]);else r.deleteFramebuffer(b.__webglFramebuffer[$]);b.__webglDepthbuffer&&r.deleteRenderbuffer(b.__webglDepthbuffer[$])}else{if(Array.isArray(b.__webglFramebuffer))for(let $=0;$<b.__webglFramebuffer.length;$++)r.deleteFramebuffer(b.__webglFramebuffer[$]);else r.deleteFramebuffer(b.__webglFramebuffer);if(b.__webglDepthbuffer&&r.deleteRenderbuffer(b.__webglDepthbuffer),b.__webglMultisampledFramebuffer&&r.deleteFramebuffer(b.__webglMultisampledFramebuffer),b.__webglColorRenderbuffer)for(let $=0;$<b.__webglColorRenderbuffer.length;$++)b.__webglColorRenderbuffer[$]&&r.deleteRenderbuffer(b.__webglColorRenderbuffer[$]);b.__webglDepthRenderbuffer&&r.deleteRenderbuffer(b.__webglDepthRenderbuffer)}const K=L.textures;for(let $=0,tt=K.length;$<tt;$++){const wt=a.get(K[$]);wt.__webglTexture&&(r.deleteTexture(wt.__webglTexture),u.memory.textures--),a.remove(K[$])}a.remove(L)}let Q=0;function dt(){Q=0}function vt(){return Q}function Z(L){Q=L}function F(){const L=Q;return L>=o.maxTextures&&me("WebGLTextures: Trying to use "+L+" texture units while this GPU supports only "+o.maxTextures),Q+=1,L}function V(L){const b=[];return b.push(L.wrapS),b.push(L.wrapT),b.push(L.wrapR||0),b.push(L.magFilter),b.push(L.minFilter),b.push(L.anisotropy),b.push(L.internalFormat),b.push(L.format),b.push(L.type),b.push(L.generateMipmaps),b.push(L.premultiplyAlpha),b.push(L.flipY),b.push(L.unpackAlignment),b.push(L.colorSpace),b.join()}function et(L,b){const K=a.get(L);if(L.isVideoTexture&&H(L),L.isRenderTargetTexture===!1&&L.isExternalTexture!==!0&&L.version>0&&K.__version!==L.version){const $=L.image;if($===null)me("WebGLRenderer: Texture marked for update but no image data found.");else if($.complete===!1)me("WebGLRenderer: Texture marked for update but image is incomplete");else{Yt(K,L,b);return}}else L.isExternalTexture&&(K.__webglTexture=L.sourceTexture?L.sourceTexture:null);n.bindTexture(r.TEXTURE_2D,K.__webglTexture,r.TEXTURE0+b)}function mt(L,b){const K=a.get(L);if(L.isRenderTargetTexture===!1&&L.version>0&&K.__version!==L.version){Yt(K,L,b);return}else L.isExternalTexture&&(K.__webglTexture=L.sourceTexture?L.sourceTexture:null);n.bindTexture(r.TEXTURE_2D_ARRAY,K.__webglTexture,r.TEXTURE0+b)}function At(L,b){const K=a.get(L);if(L.isRenderTargetTexture===!1&&L.version>0&&K.__version!==L.version){Yt(K,L,b);return}n.bindTexture(r.TEXTURE_3D,K.__webglTexture,r.TEXTURE0+b)}function I(L,b){const K=a.get(L);if(L.isCubeDepthTexture!==!0&&L.version>0&&K.__version!==L.version){ge(K,L,b);return}n.bindTexture(r.TEXTURE_CUBE_MAP,K.__webglTexture,r.TEXTURE0+b)}const J={[Bp]:r.REPEAT,[za]:r.CLAMP_TO_EDGE,[Ip]:r.MIRRORED_REPEAT},bt={[Bn]:r.NEAREST,[Wb]:r.NEAREST_MIPMAP_NEAREST,[fu]:r.NEAREST_MIPMAP_LINEAR,[Gn]:r.LINEAR,[Vd]:r.LINEAR_MIPMAP_NEAREST,[fs]:r.LINEAR_MIPMAP_LINEAR},Lt={[Yb]:r.NEVER,[jb]:r.ALWAYS,[Zb]:r.LESS,[km]:r.LEQUAL,[Kb]:r.EQUAL,[Wm]:r.GEQUAL,[Qb]:r.GREATER,[Jb]:r.NOTEQUAL};function Ht(L,b){if(b.type===Wi&&t.has("OES_texture_float_linear")===!1&&(b.magFilter===Gn||b.magFilter===Vd||b.magFilter===fu||b.magFilter===fs||b.minFilter===Gn||b.minFilter===Vd||b.minFilter===fu||b.minFilter===fs)&&me("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(L,r.TEXTURE_WRAP_S,J[b.wrapS]),r.texParameteri(L,r.TEXTURE_WRAP_T,J[b.wrapT]),(L===r.TEXTURE_3D||L===r.TEXTURE_2D_ARRAY)&&r.texParameteri(L,r.TEXTURE_WRAP_R,J[b.wrapR]),r.texParameteri(L,r.TEXTURE_MAG_FILTER,bt[b.magFilter]),r.texParameteri(L,r.TEXTURE_MIN_FILTER,bt[b.minFilter]),b.compareFunction&&(r.texParameteri(L,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(L,r.TEXTURE_COMPARE_FUNC,Lt[b.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(b.magFilter===Bn||b.minFilter!==fu&&b.minFilter!==fs||b.type===Wi&&t.has("OES_texture_float_linear")===!1)return;if(b.anisotropy>1||a.get(b).__currentAnisotropy){const K=t.get("EXT_texture_filter_anisotropic");r.texParameterf(L,K.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,o.getMaxAnisotropy())),a.get(b).__currentAnisotropy=b.anisotropy}}}function st(L,b){let K=!1;L.__webglInit===void 0&&(L.__webglInit=!0,b.addEventListener("dispose",P));const $=b.source;let tt=y.get($);tt===void 0&&(tt={},y.set($,tt));const wt=V(b);if(wt!==L.__cacheKey){tt[wt]===void 0&&(tt[wt]={texture:r.createTexture(),usedTimes:0},u.memory.textures++,K=!0),tt[wt].usedTimes++;const Ct=tt[L.__cacheKey];Ct!==void 0&&(tt[L.__cacheKey].usedTimes--,Ct.usedTimes===0&&W(b)),L.__cacheKey=wt,L.__webglTexture=tt[wt].texture}return K}function St(L,b,K){return Math.floor(Math.floor(L/K)/b)}function Et(L,b,K,$){const wt=L.updateRanges;if(wt.length===0)n.texSubImage2D(r.TEXTURE_2D,0,0,0,b.width,b.height,K,$,b.data);else{wt.sort((Xt,Bt)=>Xt.start-Bt.start);let Ct=0;for(let Xt=1;Xt<wt.length;Xt++){const Bt=wt[Ct],Ot=wt[Xt],ue=Bt.start+Bt.count,he=St(Ot.start,b.width,4),xe=St(Bt.start,b.width,4);Ot.start<=ue+1&&he===xe&&St(Ot.start+Ot.count-1,b.width,4)===he?Bt.count=Math.max(Bt.count,Ot.start+Ot.count-Bt.start):(++Ct,wt[Ct]=Ot)}wt.length=Ct+1;const ct=n.getParameter(r.UNPACK_ROW_LENGTH),ft=n.getParameter(r.UNPACK_SKIP_PIXELS),Dt=n.getParameter(r.UNPACK_SKIP_ROWS);n.pixelStorei(r.UNPACK_ROW_LENGTH,b.width);for(let Xt=0,Bt=wt.length;Xt<Bt;Xt++){const Ot=wt[Xt],ue=Math.floor(Ot.start/4),he=Math.ceil(Ot.count/4),xe=ue%b.width,q=Math.floor(ue/b.width),Nt=he,_t=1;n.pixelStorei(r.UNPACK_SKIP_PIXELS,xe),n.pixelStorei(r.UNPACK_SKIP_ROWS,q),n.texSubImage2D(r.TEXTURE_2D,0,xe,q,Nt,_t,K,$,b.data)}L.clearUpdateRanges(),n.pixelStorei(r.UNPACK_ROW_LENGTH,ct),n.pixelStorei(r.UNPACK_SKIP_PIXELS,ft),n.pixelStorei(r.UNPACK_SKIP_ROWS,Dt)}}function Yt(L,b,K){let $=r.TEXTURE_2D;(b.isDataArrayTexture||b.isCompressedArrayTexture)&&($=r.TEXTURE_2D_ARRAY),b.isData3DTexture&&($=r.TEXTURE_3D);const tt=st(L,b),wt=b.source;n.bindTexture($,L.__webglTexture,r.TEXTURE0+K);const Ct=a.get(wt);if(wt.version!==Ct.__version||tt===!0){if(n.activeTexture(r.TEXTURE0+K),(typeof ImageBitmap<"u"&&b.image instanceof ImageBitmap)===!1){const _t=Ne.getPrimaries(Ne.workingColorSpace),Pt=b.colorSpace===Rr?null:Ne.getPrimaries(b.colorSpace),Wt=b.colorSpace===Rr||_t===Pt?r.NONE:r.BROWSER_DEFAULT_WEBGL;n.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,b.flipY),n.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b.premultiplyAlpha),n.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Wt)}n.pixelStorei(r.UNPACK_ALIGNMENT,b.unpackAlignment);let ft=x(b.image,!1,o.maxTextureSize);ft=Ft(b,ft);const Dt=c.convert(b.format,b.colorSpace),Xt=c.convert(b.type);let Bt=w(b.internalFormat,Dt,Xt,b.normalized,b.colorSpace,b.isVideoTexture);Ht($,b);let Ot;const ue=b.mipmaps,he=b.isVideoTexture!==!0,xe=Ct.__version===void 0||tt===!0,q=wt.dataReady,Nt=N(b,ft);if(b.isDepthTexture)Bt=B(b.format===hs,b.type),xe&&(he?n.texStorage2D(r.TEXTURE_2D,1,Bt,ft.width,ft.height):n.texImage2D(r.TEXTURE_2D,0,Bt,ft.width,ft.height,0,Dt,Xt,null));else if(b.isDataTexture)if(ue.length>0){he&&xe&&n.texStorage2D(r.TEXTURE_2D,Nt,Bt,ue[0].width,ue[0].height);for(let _t=0,Pt=ue.length;_t<Pt;_t++)Ot=ue[_t],he?q&&n.texSubImage2D(r.TEXTURE_2D,_t,0,0,Ot.width,Ot.height,Dt,Xt,Ot.data):n.texImage2D(r.TEXTURE_2D,_t,Bt,Ot.width,Ot.height,0,Dt,Xt,Ot.data);b.generateMipmaps=!1}else he?(xe&&n.texStorage2D(r.TEXTURE_2D,Nt,Bt,ft.width,ft.height),q&&Et(b,ft,Dt,Xt)):n.texImage2D(r.TEXTURE_2D,0,Bt,ft.width,ft.height,0,Dt,Xt,ft.data);else if(b.isCompressedTexture)if(b.isCompressedArrayTexture){he&&xe&&n.texStorage3D(r.TEXTURE_2D_ARRAY,Nt,Bt,ue[0].width,ue[0].height,ft.depth);for(let _t=0,Pt=ue.length;_t<Pt;_t++)if(Ot=ue[_t],b.format!==Xi)if(Dt!==null)if(he){if(q)if(b.layerUpdates.size>0){const Wt=kx(Ot.width,Ot.height,b.format,b.type);for(const Tt of b.layerUpdates){const ae=Ot.data.subarray(Tt*Wt/Ot.data.BYTES_PER_ELEMENT,(Tt+1)*Wt/Ot.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,_t,0,0,Tt,Ot.width,Ot.height,1,Dt,ae)}b.clearLayerUpdates()}else n.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,_t,0,0,0,Ot.width,Ot.height,ft.depth,Dt,Ot.data)}else n.compressedTexImage3D(r.TEXTURE_2D_ARRAY,_t,Bt,Ot.width,Ot.height,ft.depth,0,Ot.data,0,0);else me("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else he?q&&n.texSubImage3D(r.TEXTURE_2D_ARRAY,_t,0,0,0,Ot.width,Ot.height,ft.depth,Dt,Xt,Ot.data):n.texImage3D(r.TEXTURE_2D_ARRAY,_t,Bt,Ot.width,Ot.height,ft.depth,0,Dt,Xt,Ot.data)}else{he&&xe&&n.texStorage2D(r.TEXTURE_2D,Nt,Bt,ue[0].width,ue[0].height);for(let _t=0,Pt=ue.length;_t<Pt;_t++)Ot=ue[_t],b.format!==Xi?Dt!==null?he?q&&n.compressedTexSubImage2D(r.TEXTURE_2D,_t,0,0,Ot.width,Ot.height,Dt,Ot.data):n.compressedTexImage2D(r.TEXTURE_2D,_t,Bt,Ot.width,Ot.height,0,Ot.data):me("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):he?q&&n.texSubImage2D(r.TEXTURE_2D,_t,0,0,Ot.width,Ot.height,Dt,Xt,Ot.data):n.texImage2D(r.TEXTURE_2D,_t,Bt,Ot.width,Ot.height,0,Dt,Xt,Ot.data)}else if(b.isDataArrayTexture)if(he){if(xe&&n.texStorage3D(r.TEXTURE_2D_ARRAY,Nt,Bt,ft.width,ft.height,ft.depth),q)if(b.layerUpdates.size>0){const _t=kx(ft.width,ft.height,b.format,b.type);for(const Pt of b.layerUpdates){const Wt=ft.data.subarray(Pt*_t/ft.data.BYTES_PER_ELEMENT,(Pt+1)*_t/ft.data.BYTES_PER_ELEMENT);n.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,Pt,ft.width,ft.height,1,Dt,Xt,Wt)}b.clearLayerUpdates()}else n.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,ft.width,ft.height,ft.depth,Dt,Xt,ft.data)}else n.texImage3D(r.TEXTURE_2D_ARRAY,0,Bt,ft.width,ft.height,ft.depth,0,Dt,Xt,ft.data);else if(b.isData3DTexture)he?(xe&&n.texStorage3D(r.TEXTURE_3D,Nt,Bt,ft.width,ft.height,ft.depth),q&&n.texSubImage3D(r.TEXTURE_3D,0,0,0,0,ft.width,ft.height,ft.depth,Dt,Xt,ft.data)):n.texImage3D(r.TEXTURE_3D,0,Bt,ft.width,ft.height,ft.depth,0,Dt,Xt,ft.data);else if(b.isFramebufferTexture){if(xe)if(he)n.texStorage2D(r.TEXTURE_2D,Nt,Bt,ft.width,ft.height);else{let _t=ft.width,Pt=ft.height;for(let Wt=0;Wt<Nt;Wt++)n.texImage2D(r.TEXTURE_2D,Wt,Bt,_t,Pt,0,Dt,Xt,null),_t>>=1,Pt>>=1}}else if(b.isHTMLTexture){if("texElementImage2D"in r){const _t=r.canvas;if(_t.hasAttribute("layoutsubtree")||_t.setAttribute("layoutsubtree","true"),ft.parentNode!==_t){_t.appendChild(ft),v.add(b),_t.onpaint=Pt=>{const Wt=Pt.changedElements;for(const Tt of v)Wt.includes(Tt.image)&&(Tt.needsUpdate=!0)},_t.requestPaint();return}if(r.texElementImage2D.length===3)r.texElementImage2D(r.TEXTURE_2D,r.RGBA8,ft);else{const Wt=r.RGBA,Tt=r.RGBA,ae=r.UNSIGNED_BYTE;r.texElementImage2D(r.TEXTURE_2D,0,Wt,Tt,ae,ft)}r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE)}}else if(ue.length>0){if(he&&xe){const _t=ie(ue[0]);n.texStorage2D(r.TEXTURE_2D,Nt,Bt,_t.width,_t.height)}for(let _t=0,Pt=ue.length;_t<Pt;_t++)Ot=ue[_t],he?q&&n.texSubImage2D(r.TEXTURE_2D,_t,0,0,Dt,Xt,Ot):n.texImage2D(r.TEXTURE_2D,_t,Bt,Dt,Xt,Ot);b.generateMipmaps=!1}else if(he){if(xe){const _t=ie(ft);n.texStorage2D(r.TEXTURE_2D,Nt,Bt,_t.width,_t.height)}q&&n.texSubImage2D(r.TEXTURE_2D,0,0,0,Dt,Xt,ft)}else n.texImage2D(r.TEXTURE_2D,0,Bt,Dt,Xt,ft);S(b)&&D($),Ct.__version=wt.version,b.onUpdate&&b.onUpdate(b)}L.__version=b.version}function ge(L,b,K){if(b.image.length!==6)return;const $=st(L,b),tt=b.source;n.bindTexture(r.TEXTURE_CUBE_MAP,L.__webglTexture,r.TEXTURE0+K);const wt=a.get(tt);if(tt.version!==wt.__version||$===!0){n.activeTexture(r.TEXTURE0+K);const Ct=Ne.getPrimaries(Ne.workingColorSpace),ct=b.colorSpace===Rr?null:Ne.getPrimaries(b.colorSpace),ft=b.colorSpace===Rr||Ct===ct?r.NONE:r.BROWSER_DEFAULT_WEBGL;n.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,b.flipY),n.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b.premultiplyAlpha),n.pixelStorei(r.UNPACK_ALIGNMENT,b.unpackAlignment),n.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,ft);const Dt=b.isCompressedTexture||b.image[0].isCompressedTexture,Xt=b.image[0]&&b.image[0].isDataTexture,Bt=[];for(let Tt=0;Tt<6;Tt++)!Dt&&!Xt?Bt[Tt]=x(b.image[Tt],!0,o.maxCubemapSize):Bt[Tt]=Xt?b.image[Tt].image:b.image[Tt],Bt[Tt]=Ft(b,Bt[Tt]);const Ot=Bt[0],ue=c.convert(b.format,b.colorSpace),he=c.convert(b.type),xe=w(b.internalFormat,ue,he,b.normalized,b.colorSpace),q=b.isVideoTexture!==!0,Nt=wt.__version===void 0||$===!0,_t=tt.dataReady;let Pt=N(b,Ot);Ht(r.TEXTURE_CUBE_MAP,b);let Wt;if(Dt){q&&Nt&&n.texStorage2D(r.TEXTURE_CUBE_MAP,Pt,xe,Ot.width,Ot.height);for(let Tt=0;Tt<6;Tt++){Wt=Bt[Tt].mipmaps;for(let ae=0;ae<Wt.length;ae++){const Kt=Wt[ae];b.format!==Xi?ue!==null?q?_t&&n.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Tt,ae,0,0,Kt.width,Kt.height,ue,Kt.data):n.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Tt,ae,xe,Kt.width,Kt.height,0,Kt.data):me("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):q?_t&&n.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Tt,ae,0,0,Kt.width,Kt.height,ue,he,Kt.data):n.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Tt,ae,xe,Kt.width,Kt.height,0,ue,he,Kt.data)}}}else{if(Wt=b.mipmaps,q&&Nt){Wt.length>0&&Pt++;const Tt=ie(Bt[0]);n.texStorage2D(r.TEXTURE_CUBE_MAP,Pt,xe,Tt.width,Tt.height)}for(let Tt=0;Tt<6;Tt++)if(Xt){q?_t&&n.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Tt,0,0,0,Bt[Tt].width,Bt[Tt].height,ue,he,Bt[Tt].data):n.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Tt,0,xe,Bt[Tt].width,Bt[Tt].height,0,ue,he,Bt[Tt].data);for(let ae=0;ae<Wt.length;ae++){const an=Wt[ae].image[Tt].image;q?_t&&n.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Tt,ae+1,0,0,an.width,an.height,ue,he,an.data):n.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Tt,ae+1,xe,an.width,an.height,0,ue,he,an.data)}}else{q?_t&&n.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Tt,0,0,0,ue,he,Bt[Tt]):n.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Tt,0,xe,ue,he,Bt[Tt]);for(let ae=0;ae<Wt.length;ae++){const Kt=Wt[ae];q?_t&&n.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Tt,ae+1,0,0,ue,he,Kt.image[Tt]):n.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Tt,ae+1,xe,ue,he,Kt.image[Tt])}}}S(b)&&D(r.TEXTURE_CUBE_MAP),wt.__version=tt.version,b.onUpdate&&b.onUpdate(b)}L.__version=b.version}function se(L,b,K,$,tt,wt){const Ct=c.convert(K.format,K.colorSpace),ct=c.convert(K.type),ft=w(K.internalFormat,Ct,ct,K.normalized,K.colorSpace),Dt=a.get(b),Xt=a.get(K);if(Xt.__renderTarget=b,!Dt.__hasExternalTextures){const Bt=Math.max(1,b.width>>wt),Ot=Math.max(1,b.height>>wt);tt===r.TEXTURE_3D||tt===r.TEXTURE_2D_ARRAY?n.texImage3D(tt,wt,ft,Bt,Ot,b.depth,0,Ct,ct,null):n.texImage2D(tt,wt,ft,Bt,Ot,0,Ct,ct,null)}n.bindFramebuffer(r.FRAMEBUFFER,L),ve(b)?d.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,$,tt,Xt.__webglTexture,0,le(b)):(tt===r.TEXTURE_2D||tt>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&tt<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,$,tt,Xt.__webglTexture,wt),n.bindFramebuffer(r.FRAMEBUFFER,null)}function kt(L,b,K){if(r.bindRenderbuffer(r.RENDERBUFFER,L),b.depthBuffer){const $=b.depthTexture,tt=$&&$.isDepthTexture?$.type:null,wt=B(b.stencilBuffer,tt),Ct=b.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;ve(b)?d.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,le(b),wt,b.width,b.height):K?r.renderbufferStorageMultisample(r.RENDERBUFFER,le(b),wt,b.width,b.height):r.renderbufferStorage(r.RENDERBUFFER,wt,b.width,b.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,Ct,r.RENDERBUFFER,L)}else{const $=b.textures;for(let tt=0;tt<$.length;tt++){const wt=$[tt],Ct=c.convert(wt.format,wt.colorSpace),ct=c.convert(wt.type),ft=w(wt.internalFormat,Ct,ct,wt.normalized,wt.colorSpace);ve(b)?d.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,le(b),ft,b.width,b.height):K?r.renderbufferStorageMultisample(r.RENDERBUFFER,le(b),ft,b.width,b.height):r.renderbufferStorage(r.RENDERBUFFER,ft,b.width,b.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function Mt(L,b,K){const $=b.isWebGLCubeRenderTarget===!0;if(n.bindFramebuffer(r.FRAMEBUFFER,L),!(b.depthTexture&&b.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");const tt=a.get(b.depthTexture);if(tt.__renderTarget=b,(!tt.__webglTexture||b.depthTexture.image.width!==b.width||b.depthTexture.image.height!==b.height)&&(b.depthTexture.image.width=b.width,b.depthTexture.image.height=b.height,b.depthTexture.needsUpdate=!0),$){if(tt.__webglInit===void 0&&(tt.__webglInit=!0,b.depthTexture.addEventListener("dispose",P)),tt.__webglTexture===void 0){tt.__webglTexture=r.createTexture(),n.bindTexture(r.TEXTURE_CUBE_MAP,tt.__webglTexture),Ht(r.TEXTURE_CUBE_MAP,b.depthTexture);const Dt=c.convert(b.depthTexture.format),Xt=c.convert(b.depthTexture.type);let Bt;b.depthTexture.format===ka?Bt=r.DEPTH_COMPONENT24:b.depthTexture.format===hs&&(Bt=r.DEPTH24_STENCIL8);for(let Ot=0;Ot<6;Ot++)r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ot,0,Bt,b.width,b.height,0,Dt,Xt,null)}}else et(b.depthTexture,0);const wt=tt.__webglTexture,Ct=le(b),ct=$?r.TEXTURE_CUBE_MAP_POSITIVE_X+K:r.TEXTURE_2D,ft=b.depthTexture.format===hs?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;if(b.depthTexture.format===ka)ve(b)?d.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,ft,ct,wt,0,Ct):r.framebufferTexture2D(r.FRAMEBUFFER,ft,ct,wt,0);else if(b.depthTexture.format===hs)ve(b)?d.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,ft,ct,wt,0,Ct):r.framebufferTexture2D(r.FRAMEBUFFER,ft,ct,wt,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function gt(L){const b=a.get(L),K=L.isWebGLCubeRenderTarget===!0;if(b.__boundDepthTexture!==L.depthTexture){const $=L.depthTexture;if(b.__depthDisposeCallback&&b.__depthDisposeCallback(),$){const tt=()=>{delete b.__boundDepthTexture,delete b.__depthDisposeCallback,$.removeEventListener("dispose",tt)};$.addEventListener("dispose",tt),b.__depthDisposeCallback=tt}b.__boundDepthTexture=$}if(L.depthTexture&&!b.__autoAllocateDepthBuffer)if(K)for(let $=0;$<6;$++)Mt(b.__webglFramebuffer[$],L,$);else{const $=L.texture.mipmaps;$&&$.length>0?Mt(b.__webglFramebuffer[0],L,0):Mt(b.__webglFramebuffer,L,0)}else if(K){b.__webglDepthbuffer=[];for(let $=0;$<6;$++)if(n.bindFramebuffer(r.FRAMEBUFFER,b.__webglFramebuffer[$]),b.__webglDepthbuffer[$]===void 0)b.__webglDepthbuffer[$]=r.createRenderbuffer(),kt(b.__webglDepthbuffer[$],L,!1);else{const tt=L.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,wt=b.__webglDepthbuffer[$];r.bindRenderbuffer(r.RENDERBUFFER,wt),r.framebufferRenderbuffer(r.FRAMEBUFFER,tt,r.RENDERBUFFER,wt)}}else{const $=L.texture.mipmaps;if($&&$.length>0?n.bindFramebuffer(r.FRAMEBUFFER,b.__webglFramebuffer[0]):n.bindFramebuffer(r.FRAMEBUFFER,b.__webglFramebuffer),b.__webglDepthbuffer===void 0)b.__webglDepthbuffer=r.createRenderbuffer(),kt(b.__webglDepthbuffer,L,!1);else{const tt=L.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,wt=b.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,wt),r.framebufferRenderbuffer(r.FRAMEBUFFER,tt,r.RENDERBUFFER,wt)}}n.bindFramebuffer(r.FRAMEBUFFER,null)}function Ut(L,b,K){const $=a.get(L);b!==void 0&&se($.__webglFramebuffer,L,L.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),K!==void 0&&gt(L)}function Rt(L){const b=L.texture,K=a.get(L),$=a.get(b);L.addEventListener("dispose",T);const tt=L.textures,wt=L.isWebGLCubeRenderTarget===!0,Ct=tt.length>1;if(Ct||($.__webglTexture===void 0&&($.__webglTexture=r.createTexture()),$.__version=b.version,u.memory.textures++),wt){K.__webglFramebuffer=[];for(let ct=0;ct<6;ct++)if(b.mipmaps&&b.mipmaps.length>0){K.__webglFramebuffer[ct]=[];for(let ft=0;ft<b.mipmaps.length;ft++)K.__webglFramebuffer[ct][ft]=r.createFramebuffer()}else K.__webglFramebuffer[ct]=r.createFramebuffer()}else{if(b.mipmaps&&b.mipmaps.length>0){K.__webglFramebuffer=[];for(let ct=0;ct<b.mipmaps.length;ct++)K.__webglFramebuffer[ct]=r.createFramebuffer()}else K.__webglFramebuffer=r.createFramebuffer();if(Ct)for(let ct=0,ft=tt.length;ct<ft;ct++){const Dt=a.get(tt[ct]);Dt.__webglTexture===void 0&&(Dt.__webglTexture=r.createTexture(),u.memory.textures++)}if(L.samples>0&&ve(L)===!1){K.__webglMultisampledFramebuffer=r.createFramebuffer(),K.__webglColorRenderbuffer=[],n.bindFramebuffer(r.FRAMEBUFFER,K.__webglMultisampledFramebuffer);for(let ct=0;ct<tt.length;ct++){const ft=tt[ct];K.__webglColorRenderbuffer[ct]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,K.__webglColorRenderbuffer[ct]);const Dt=c.convert(ft.format,ft.colorSpace),Xt=c.convert(ft.type),Bt=w(ft.internalFormat,Dt,Xt,ft.normalized,ft.colorSpace,L.isXRRenderTarget===!0),Ot=le(L);r.renderbufferStorageMultisample(r.RENDERBUFFER,Ot,Bt,L.width,L.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+ct,r.RENDERBUFFER,K.__webglColorRenderbuffer[ct])}r.bindRenderbuffer(r.RENDERBUFFER,null),L.depthBuffer&&(K.__webglDepthRenderbuffer=r.createRenderbuffer(),kt(K.__webglDepthRenderbuffer,L,!0)),n.bindFramebuffer(r.FRAMEBUFFER,null)}}if(wt){n.bindTexture(r.TEXTURE_CUBE_MAP,$.__webglTexture),Ht(r.TEXTURE_CUBE_MAP,b);for(let ct=0;ct<6;ct++)if(b.mipmaps&&b.mipmaps.length>0)for(let ft=0;ft<b.mipmaps.length;ft++)se(K.__webglFramebuffer[ct][ft],L,b,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+ct,ft);else se(K.__webglFramebuffer[ct],L,b,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+ct,0);S(b)&&D(r.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(Ct){for(let ct=0,ft=tt.length;ct<ft;ct++){const Dt=tt[ct],Xt=a.get(Dt);let Bt=r.TEXTURE_2D;(L.isWebGL3DRenderTarget||L.isWebGLArrayRenderTarget)&&(Bt=L.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),n.bindTexture(Bt,Xt.__webglTexture),Ht(Bt,Dt),se(K.__webglFramebuffer,L,Dt,r.COLOR_ATTACHMENT0+ct,Bt,0),S(Dt)&&D(Bt)}n.unbindTexture()}else{let ct=r.TEXTURE_2D;if((L.isWebGL3DRenderTarget||L.isWebGLArrayRenderTarget)&&(ct=L.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),n.bindTexture(ct,$.__webglTexture),Ht(ct,b),b.mipmaps&&b.mipmaps.length>0)for(let ft=0;ft<b.mipmaps.length;ft++)se(K.__webglFramebuffer[ft],L,b,r.COLOR_ATTACHMENT0,ct,ft);else se(K.__webglFramebuffer,L,b,r.COLOR_ATTACHMENT0,ct,0);S(b)&&D(ct),n.unbindTexture()}L.depthBuffer&&gt(L)}function Jt(L){const b=L.textures;for(let K=0,$=b.length;K<$;K++){const tt=b[K];if(S(tt)){const wt=U(L),Ct=a.get(tt).__webglTexture;n.bindTexture(wt,Ct),D(wt),n.unbindTexture()}}}const jt=[],ee=[];function ne(L){if(L.samples>0){if(ve(L)===!1){const b=L.textures,K=L.width,$=L.height;let tt=r.COLOR_BUFFER_BIT;const wt=L.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Ct=a.get(L),ct=b.length>1;if(ct)for(let Dt=0;Dt<b.length;Dt++)n.bindFramebuffer(r.FRAMEBUFFER,Ct.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Dt,r.RENDERBUFFER,null),n.bindFramebuffer(r.FRAMEBUFFER,Ct.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Dt,r.TEXTURE_2D,null,0);n.bindFramebuffer(r.READ_FRAMEBUFFER,Ct.__webglMultisampledFramebuffer);const ft=L.texture.mipmaps;ft&&ft.length>0?n.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ct.__webglFramebuffer[0]):n.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ct.__webglFramebuffer);for(let Dt=0;Dt<b.length;Dt++){if(L.resolveDepthBuffer&&(L.depthBuffer&&(tt|=r.DEPTH_BUFFER_BIT),L.stencilBuffer&&L.resolveStencilBuffer&&(tt|=r.STENCIL_BUFFER_BIT)),ct){r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,Ct.__webglColorRenderbuffer[Dt]);const Xt=a.get(b[Dt]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,Xt,0)}r.blitFramebuffer(0,0,K,$,0,0,K,$,tt,r.NEAREST),m===!0&&(jt.length=0,ee.length=0,jt.push(r.COLOR_ATTACHMENT0+Dt),L.depthBuffer&&L.resolveDepthBuffer===!1&&(jt.push(wt),ee.push(wt),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,ee)),r.invalidateFramebuffer(r.READ_FRAMEBUFFER,jt))}if(n.bindFramebuffer(r.READ_FRAMEBUFFER,null),n.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),ct)for(let Dt=0;Dt<b.length;Dt++){n.bindFramebuffer(r.FRAMEBUFFER,Ct.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Dt,r.RENDERBUFFER,Ct.__webglColorRenderbuffer[Dt]);const Xt=a.get(b[Dt]).__webglTexture;n.bindFramebuffer(r.FRAMEBUFFER,Ct.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Dt,r.TEXTURE_2D,Xt,0)}n.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ct.__webglMultisampledFramebuffer)}else if(L.depthBuffer&&L.resolveDepthBuffer===!1&&m){const b=L.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[b])}}}function le(L){return Math.min(o.maxSamples,L.samples)}function ve(L){const b=a.get(L);return L.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&b.__useRenderToTexture!==!1}function H(L){const b=u.render.frame;_.get(L)!==b&&(_.set(L,b),L.update())}function Ft(L,b){const K=L.colorSpace,$=L.format,tt=L.type;return L.isCompressedTexture===!0||L.isVideoTexture===!0||K!==lf&&K!==Rr&&(Ne.getTransfer(K)===Ye?($!==Xi||tt!==yi)&&me("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Oe("WebGLTextures: Unsupported texture color space:",K)),b}function ie(L){return typeof HTMLImageElement<"u"&&L instanceof HTMLImageElement?(p.width=L.naturalWidth||L.width,p.height=L.naturalHeight||L.height):typeof VideoFrame<"u"&&L instanceof VideoFrame?(p.width=L.displayWidth,p.height=L.displayHeight):(p.width=L.width,p.height=L.height),p}this.allocateTextureUnit=F,this.resetTextureUnits=dt,this.getTextureUnits=vt,this.setTextureUnits=Z,this.setTexture2D=et,this.setTexture2DArray=mt,this.setTexture3D=At,this.setTextureCube=I,this.rebindTextures=Ut,this.setupRenderTarget=Rt,this.updateRenderTargetMipmap=Jt,this.updateMultisampleRenderTarget=ne,this.setupDepthRenderbuffer=gt,this.setupFrameBufferTexture=se,this.useMultisampledRTT=ve,this.isReversedDepthBuffer=function(){return n.buffers.depth.getReversed()}}function Kw(r,t){function n(a,o=Rr){let c;const u=Ne.getTransfer(o);if(a===yi)return r.UNSIGNED_BYTE;if(a===Im)return r.UNSIGNED_SHORT_4_4_4_4;if(a===zm)return r.UNSIGNED_SHORT_5_5_5_1;if(a===$y)return r.UNSIGNED_INT_5_9_9_9_REV;if(a===tS)return r.UNSIGNED_INT_10F_11F_11F_REV;if(a===Jy)return r.BYTE;if(a===jy)return r.SHORT;if(a===kl)return r.UNSIGNED_SHORT;if(a===Bm)return r.INT;if(a===ca)return r.UNSIGNED_INT;if(a===Wi)return r.FLOAT;if(a===Mi)return r.HALF_FLOAT;if(a===eS)return r.ALPHA;if(a===nS)return r.RGB;if(a===Xi)return r.RGBA;if(a===ka)return r.DEPTH_COMPONENT;if(a===hs)return r.DEPTH_STENCIL;if(a===Fm)return r.RED;if(a===Hm)return r.RED_INTEGER;if(a===ms)return r.RG;if(a===Gm)return r.RG_INTEGER;if(a===Vm)return r.RGBA_INTEGER;if(a===Qu||a===Ju||a===ju||a===$u)if(u===Ye)if(c=t.get("WEBGL_compressed_texture_s3tc_srgb"),c!==null){if(a===Qu)return c.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(a===Ju)return c.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(a===ju)return c.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(a===$u)return c.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(c=t.get("WEBGL_compressed_texture_s3tc"),c!==null){if(a===Qu)return c.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===Ju)return c.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===ju)return c.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===$u)return c.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(a===zp||a===Fp||a===Hp||a===Gp)if(c=t.get("WEBGL_compressed_texture_pvrtc"),c!==null){if(a===zp)return c.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===Fp)return c.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===Hp)return c.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(a===Gp)return c.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(a===Vp||a===kp||a===Wp||a===Xp||a===qp||a===sf||a===Yp)if(c=t.get("WEBGL_compressed_texture_etc"),c!==null){if(a===Vp||a===kp)return u===Ye?c.COMPRESSED_SRGB8_ETC2:c.COMPRESSED_RGB8_ETC2;if(a===Wp)return u===Ye?c.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:c.COMPRESSED_RGBA8_ETC2_EAC;if(a===Xp)return c.COMPRESSED_R11_EAC;if(a===qp)return c.COMPRESSED_SIGNED_R11_EAC;if(a===sf)return c.COMPRESSED_RG11_EAC;if(a===Yp)return c.COMPRESSED_SIGNED_RG11_EAC}else return null;if(a===Zp||a===Kp||a===Qp||a===Jp||a===jp||a===$p||a===tm||a===em||a===nm||a===im||a===am||a===rm||a===sm||a===om)if(c=t.get("WEBGL_compressed_texture_astc"),c!==null){if(a===Zp)return u===Ye?c.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:c.COMPRESSED_RGBA_ASTC_4x4_KHR;if(a===Kp)return u===Ye?c.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:c.COMPRESSED_RGBA_ASTC_5x4_KHR;if(a===Qp)return u===Ye?c.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:c.COMPRESSED_RGBA_ASTC_5x5_KHR;if(a===Jp)return u===Ye?c.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:c.COMPRESSED_RGBA_ASTC_6x5_KHR;if(a===jp)return u===Ye?c.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:c.COMPRESSED_RGBA_ASTC_6x6_KHR;if(a===$p)return u===Ye?c.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:c.COMPRESSED_RGBA_ASTC_8x5_KHR;if(a===tm)return u===Ye?c.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:c.COMPRESSED_RGBA_ASTC_8x6_KHR;if(a===em)return u===Ye?c.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:c.COMPRESSED_RGBA_ASTC_8x8_KHR;if(a===nm)return u===Ye?c.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:c.COMPRESSED_RGBA_ASTC_10x5_KHR;if(a===im)return u===Ye?c.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:c.COMPRESSED_RGBA_ASTC_10x6_KHR;if(a===am)return u===Ye?c.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:c.COMPRESSED_RGBA_ASTC_10x8_KHR;if(a===rm)return u===Ye?c.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:c.COMPRESSED_RGBA_ASTC_10x10_KHR;if(a===sm)return u===Ye?c.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:c.COMPRESSED_RGBA_ASTC_12x10_KHR;if(a===om)return u===Ye?c.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:c.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(a===lm||a===cm||a===um)if(c=t.get("EXT_texture_compression_bptc"),c!==null){if(a===lm)return u===Ye?c.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:c.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(a===cm)return c.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(a===um)return c.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(a===fm||a===hm||a===of||a===dm)if(c=t.get("EXT_texture_compression_rgtc"),c!==null){if(a===fm)return c.COMPRESSED_RED_RGTC1_EXT;if(a===hm)return c.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(a===of)return c.COMPRESSED_RED_GREEN_RGTC2_EXT;if(a===dm)return c.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return a===Wl?r.UNSIGNED_INT_24_8:r[a]!==void 0?r[a]:null}return{convert:n}}const Qw=`
void main() {
gl_Position = vec4( position, 1.0 );
}`,Jw=`
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 jw{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,n){if(this.texture===null){const a=new pS(t.texture);(t.depthNear!==n.depthNear||t.depthFar!==n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=a}}getMesh(t){if(this.texture!==null&&this.mesh===null){const n=t.cameras[0].viewport,a=new kn({vertexShader:Qw,fragmentShader:Jw,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new ln(new ds(20,20),a)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class $w extends gs{constructor(t,n){super();const a=this;let o=null,c=1,u=null,d="local-floor",m=1,p=null,_=null,v=null,g=null,y=null,E=null;const A=typeof XRWebGLBinding<"u",x=new jw,S={},D=n.getContextAttributes();let U=null,w=null;const B=[],N=[],P=new fe;let T=null;const O=new xi;O.viewport=new cn;const W=new xi;W.viewport=new cn;const k=[O,W],Q=new sA;let dt=null,vt=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(st){let St=B[st];return St===void 0&&(St=new Zd,B[st]=St),St.getTargetRaySpace()},this.getControllerGrip=function(st){let St=B[st];return St===void 0&&(St=new Zd,B[st]=St),St.getGripSpace()},this.getHand=function(st){let St=B[st];return St===void 0&&(St=new Zd,B[st]=St),St.getHandSpace()};function Z(st){const St=N.indexOf(st.inputSource);if(St===-1)return;const Et=B[St];Et!==void 0&&(Et.update(st.inputSource,st.frame,p||u),Et.dispatchEvent({type:st.type,data:st.inputSource}))}function F(){o.removeEventListener("select",Z),o.removeEventListener("selectstart",Z),o.removeEventListener("selectend",Z),o.removeEventListener("squeeze",Z),o.removeEventListener("squeezestart",Z),o.removeEventListener("squeezeend",Z),o.removeEventListener("end",F),o.removeEventListener("inputsourceschange",V);for(let st=0;st<B.length;st++){const St=N[st];St!==null&&(N[st]=null,B[st].disconnect(St))}dt=null,vt=null,x.reset();for(const st in S)delete S[st];t.setRenderTarget(U),y=null,g=null,v=null,o=null,w=null,Ht.stop(),a.isPresenting=!1,t.setPixelRatio(T),t.setSize(P.width,P.height,!1),a.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(st){c=st,a.isPresenting===!0&&me("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(st){d=st,a.isPresenting===!0&&me("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return p||u},this.setReferenceSpace=function(st){p=st},this.getBaseLayer=function(){return g!==null?g:y},this.getBinding=function(){return v===null&&A&&(v=new XRWebGLBinding(o,n)),v},this.getFrame=function(){return E},this.getSession=function(){return o},this.setSession=async function(st){if(o=st,o!==null){if(U=t.getRenderTarget(),o.addEventListener("select",Z),o.addEventListener("selectstart",Z),o.addEventListener("selectend",Z),o.addEventListener("squeeze",Z),o.addEventListener("squeezestart",Z),o.addEventListener("squeezeend",Z),o.addEventListener("end",F),o.addEventListener("inputsourceschange",V),D.xrCompatible!==!0&&await n.makeXRCompatible(),T=t.getPixelRatio(),t.getSize(P),A&&"createProjectionLayer"in XRWebGLBinding.prototype){let Et=null,Yt=null,ge=null;D.depth&&(ge=D.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,Et=D.stencil?hs:ka,Yt=D.stencil?Wl:ca);const se={colorFormat:n.RGBA8,depthFormat:ge,scaleFactor:c};v=this.getBinding(),g=v.createProjectionLayer(se),o.updateRenderState({layers:[g]}),t.setPixelRatio(1),t.setSize(g.textureWidth,g.textureHeight,!1),w=new ai(g.textureWidth,g.textureHeight,{format:Xi,type:yi,depthTexture:new To(g.textureWidth,g.textureHeight,Yt,void 0,void 0,void 0,void 0,void 0,void 0,Et),stencilBuffer:D.stencil,colorSpace:t.outputColorSpace,samples:D.antialias?4:0,resolveDepthBuffer:g.ignoreDepthValues===!1,resolveStencilBuffer:g.ignoreDepthValues===!1})}else{const Et={antialias:D.antialias,alpha:!0,depth:D.depth,stencil:D.stencil,framebufferScaleFactor:c};y=new XRWebGLLayer(o,n,Et),o.updateRenderState({baseLayer:y}),t.setPixelRatio(1),t.setSize(y.framebufferWidth,y.framebufferHeight,!1),w=new ai(y.framebufferWidth,y.framebufferHeight,{format:Xi,type:yi,colorSpace:t.outputColorSpace,stencilBuffer:D.stencil,resolveDepthBuffer:y.ignoreDepthValues===!1,resolveStencilBuffer:y.ignoreDepthValues===!1})}w.isXRRenderTarget=!0,this.setFoveation(m),p=null,u=await o.requestReferenceSpace(d),Ht.setContext(o),Ht.start(),a.isPresenting=!0,a.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(o!==null)return o.environmentBlendMode},this.getDepthTexture=function(){return x.getDepthTexture()};function V(st){for(let St=0;St<st.removed.length;St++){const Et=st.removed[St],Yt=N.indexOf(Et);Yt>=0&&(N[Yt]=null,B[Yt].disconnect(Et))}for(let St=0;St<st.added.length;St++){const Et=st.added[St];let Yt=N.indexOf(Et);if(Yt===-1){for(let se=0;se<B.length;se++)if(se>=N.length){N.push(Et),Yt=se;break}else if(N[se]===null){N[se]=Et,Yt=se;break}if(Yt===-1)break}const ge=B[Yt];ge&&ge.connect(Et)}}const et=new z,mt=new z;function At(st,St,Et){et.setFromMatrixPosition(St.matrixWorld),mt.setFromMatrixPosition(Et.matrixWorld);const Yt=et.distanceTo(mt),ge=St.projectionMatrix.elements,se=Et.projectionMatrix.elements,kt=ge[14]/(ge[10]-1),Mt=ge[14]/(ge[10]+1),gt=(ge[9]+1)/ge[5],Ut=(ge[9]-1)/ge[5],Rt=(ge[8]-1)/ge[0],Jt=(se[8]+1)/se[0],jt=kt*Rt,ee=kt*Jt,ne=Yt/(-Rt+Jt),le=ne*-Rt;if(St.matrixWorld.decompose(st.position,st.quaternion,st.scale),st.translateX(le),st.translateZ(ne),st.matrixWorld.compose(st.position,st.quaternion,st.scale),st.matrixWorldInverse.copy(st.matrixWorld).invert(),ge[10]===-1)st.projectionMatrix.copy(St.projectionMatrix),st.projectionMatrixInverse.copy(St.projectionMatrixInverse);else{const ve=kt+ne,H=Mt+ne,Ft=jt-le,ie=ee+(Yt-le),L=gt*Mt/H*ve,b=Ut*Mt/H*ve;st.projectionMatrix.makePerspective(Ft,ie,L,b,ve,H),st.projectionMatrixInverse.copy(st.projectionMatrix).invert()}}function I(st,St){St===null?st.matrixWorld.copy(st.matrix):st.matrixWorld.multiplyMatrices(St.matrixWorld,st.matrix),st.matrixWorldInverse.copy(st.matrixWorld).invert()}this.updateCamera=function(st){if(o===null)return;let St=st.near,Et=st.far;x.texture!==null&&(x.depthNear>0&&(St=x.depthNear),x.depthFar>0&&(Et=x.depthFar)),Q.near=W.near=O.near=St,Q.far=W.far=O.far=Et,(dt!==Q.near||vt!==Q.far)&&(o.updateRenderState({depthNear:Q.near,depthFar:Q.far}),dt=Q.near,vt=Q.far),Q.layers.mask=st.layers.mask|6,O.layers.mask=Q.layers.mask&-5,W.layers.mask=Q.layers.mask&-3;const Yt=st.parent,ge=Q.cameras;I(Q,Yt);for(let se=0;se<ge.length;se++)I(ge[se],Yt);ge.length===2?At(Q,O,W):Q.projectionMatrix.copy(O.projectionMatrix),J(st,Q,Yt)};function J(st,St,Et){Et===null?st.matrix.copy(St.matrixWorld):(st.matrix.copy(Et.matrixWorld),st.matrix.invert(),st.matrix.multiply(St.matrixWorld)),st.matrix.decompose(st.position,st.quaternion,st.scale),st.updateMatrixWorld(!0),st.projectionMatrix.copy(St.projectionMatrix),st.projectionMatrixInverse.copy(St.projectionMatrixInverse),st.isPerspectiveCamera&&(st.fov=ql*2*Math.atan(1/st.projectionMatrix.elements[5]),st.zoom=1)}this.getCamera=function(){return Q},this.getFoveation=function(){if(!(g===null&&y===null))return m},this.setFoveation=function(st){m=st,g!==null&&(g.fixedFoveation=st),y!==null&&y.fixedFoveation!==void 0&&(y.fixedFoveation=st)},this.hasDepthSensing=function(){return x.texture!==null},this.getDepthSensingMesh=function(){return x.getMesh(Q)},this.getCameraTexture=function(st){return S[st]};let bt=null;function Lt(st,St){if(_=St.getViewerPose(p||u),E=St,_!==null){const Et=_.views;y!==null&&(t.setRenderTargetFramebuffer(w,y.framebuffer),t.setRenderTarget(w));let Yt=!1;Et.length!==Q.cameras.length&&(Q.cameras.length=0,Yt=!0);for(let Mt=0;Mt<Et.length;Mt++){const gt=Et[Mt];let Ut=null;if(y!==null)Ut=y.getViewport(gt);else{const Jt=v.getViewSubImage(g,gt);Ut=Jt.viewport,Mt===0&&(t.setRenderTargetTextures(w,Jt.colorTexture,Jt.depthStencilTexture),t.setRenderTarget(w))}let Rt=k[Mt];Rt===void 0&&(Rt=new xi,Rt.layers.enable(Mt),Rt.viewport=new cn,k[Mt]=Rt),Rt.matrix.fromArray(gt.transform.matrix),Rt.matrix.decompose(Rt.position,Rt.quaternion,Rt.scale),Rt.projectionMatrix.fromArray(gt.projectionMatrix),Rt.projectionMatrixInverse.copy(Rt.projectionMatrix).invert(),Rt.viewport.set(Ut.x,Ut.y,Ut.width,Ut.height),Mt===0&&(Q.matrix.copy(Rt.matrix),Q.matrix.decompose(Q.position,Q.quaternion,Q.scale)),Yt===!0&&Q.cameras.push(Rt)}const ge=o.enabledFeatures;if(ge&&ge.includes("depth-sensing")&&o.depthUsage=="gpu-optimized"&&A){v=a.getBinding();const Mt=v.getDepthInformation(Et[0]);Mt&&Mt.isValid&&Mt.texture&&x.init(Mt,o.renderState)}if(ge&&ge.includes("camera-access")&&A){t.state.unbindTexture(),v=a.getBinding();for(let Mt=0;Mt<Et.length;Mt++){const gt=Et[Mt].camera;if(gt){let Ut=S[gt];Ut||(Ut=new pS,S[gt]=Ut);const Rt=v.getCameraImage(gt);Ut.sourceTexture=Rt}}}}for(let Et=0;Et<B.length;Et++){const Yt=N[Et],ge=B[Et];Yt!==null&&ge!==void 0&&ge.update(Yt,St,p||u)}bt&&bt(st,St),St.detectedPlanes&&a.dispatchEvent({type:"planesdetected",data:St}),E=null}const Ht=new vS;Ht.setAnimationLoop(Lt),this.setAnimationLoop=function(st){bt=st},this.dispose=function(){}}}const tC=new ze,TS=new Se;TS.set(-1,0,0,0,1,0,0,0,1);function eC(r,t){function n(x,S){x.matrixAutoUpdate===!0&&x.updateMatrix(),S.value.copy(x.matrix)}function a(x,S){S.color.getRGB(x.fogColor.value,mS(r)),S.isFog?(x.fogNear.value=S.near,x.fogFar.value=S.far):S.isFogExp2&&(x.fogDensity.value=S.density)}function o(x,S,D,U,w){S.isNodeMaterial?S.uniformsNeedUpdate=!1:S.isMeshBasicMaterial?c(x,S):S.isMeshLambertMaterial?(c(x,S),S.envMap&&(x.envMapIntensity.value=S.envMapIntensity)):S.isMeshToonMaterial?(c(x,S),v(x,S)):S.isMeshPhongMaterial?(c(x,S),_(x,S),S.envMap&&(x.envMapIntensity.value=S.envMapIntensity)):S.isMeshStandardMaterial?(c(x,S),g(x,S),S.isMeshPhysicalMaterial&&y(x,S,w)):S.isMeshMatcapMaterial?(c(x,S),E(x,S)):S.isMeshDepthMaterial?c(x,S):S.isMeshDistanceMaterial?(c(x,S),A(x,S)):S.isMeshNormalMaterial?c(x,S):S.isLineBasicMaterial?(u(x,S),S.isLineDashedMaterial&&d(x,S)):S.isPointsMaterial?m(x,S,D,U):S.isSpriteMaterial?p(x,S):S.isShadowMaterial?(x.color.value.copy(S.color),x.opacity.value=S.opacity):S.isShaderMaterial&&(S.uniformsNeedUpdate=!1)}function c(x,S){x.opacity.value=S.opacity,S.color&&x.diffuse.value.copy(S.color),S.emissive&&x.emissive.value.copy(S.emissive).multiplyScalar(S.emissiveIntensity),S.map&&(x.map.value=S.map,n(S.map,x.mapTransform)),S.alphaMap&&(x.alphaMap.value=S.alphaMap,n(S.alphaMap,x.alphaMapTransform)),S.bumpMap&&(x.bumpMap.value=S.bumpMap,n(S.bumpMap,x.bumpMapTransform),x.bumpScale.value=S.bumpScale,S.side===ii&&(x.bumpScale.value*=-1)),S.normalMap&&(x.normalMap.value=S.normalMap,n(S.normalMap,x.normalMapTransform),x.normalScale.value.copy(S.normalScale),S.side===ii&&x.normalScale.value.negate()),S.displacementMap&&(x.displacementMap.value=S.displacementMap,n(S.displacementMap,x.displacementMapTransform),x.displacementScale.value=S.displacementScale,x.displacementBias.value=S.displacementBias),S.emissiveMap&&(x.emissiveMap.value=S.emissiveMap,n(S.emissiveMap,x.emissiveMapTransform)),S.specularMap&&(x.specularMap.value=S.specularMap,n(S.specularMap,x.specularMapTransform)),S.alphaTest>0&&(x.alphaTest.value=S.alphaTest);const D=t.get(S),U=D.envMap,w=D.envMapRotation;U&&(x.envMap.value=U,x.envMapRotation.value.setFromMatrix4(tC.makeRotationFromEuler(w)).transpose(),U.isCubeTexture&&U.isRenderTargetTexture===!1&&x.envMapRotation.value.premultiply(TS),x.reflectivity.value=S.reflectivity,x.ior.value=S.ior,x.refractionRatio.value=S.refractionRatio),S.lightMap&&(x.lightMap.value=S.lightMap,x.lightMapIntensity.value=S.lightMapIntensity,n(S.lightMap,x.lightMapTransform)),S.aoMap&&(x.aoMap.value=S.aoMap,x.aoMapIntensity.value=S.aoMapIntensity,n(S.aoMap,x.aoMapTransform))}function u(x,S){x.diffuse.value.copy(S.color),x.opacity.value=S.opacity,S.map&&(x.map.value=S.map,n(S.map,x.mapTransform))}function d(x,S){x.dashSize.value=S.dashSize,x.totalSize.value=S.dashSize+S.gapSize,x.scale.value=S.scale}function m(x,S,D,U){x.diffuse.value.copy(S.color),x.opacity.value=S.opacity,x.size.value=S.size*D,x.scale.value=U*.5,S.map&&(x.map.value=S.map,n(S.map,x.uvTransform)),S.alphaMap&&(x.alphaMap.value=S.alphaMap,n(S.alphaMap,x.alphaMapTransform)),S.alphaTest>0&&(x.alphaTest.value=S.alphaTest)}function p(x,S){x.diffuse.value.copy(S.color),x.opacity.value=S.opacity,x.rotation.value=S.rotation,S.map&&(x.map.value=S.map,n(S.map,x.mapTransform)),S.alphaMap&&(x.alphaMap.value=S.alphaMap,n(S.alphaMap,x.alphaMapTransform)),S.alphaTest>0&&(x.alphaTest.value=S.alphaTest)}function _(x,S){x.specular.value.copy(S.specular),x.shininess.value=Math.max(S.shininess,1e-4)}function v(x,S){S.gradientMap&&(x.gradientMap.value=S.gradientMap)}function g(x,S){x.metalness.value=S.metalness,S.metalnessMap&&(x.metalnessMap.value=S.metalnessMap,n(S.metalnessMap,x.metalnessMapTransform)),x.roughness.value=S.roughness,S.roughnessMap&&(x.roughnessMap.value=S.roughnessMap,n(S.roughnessMap,x.roughnessMapTransform)),S.envMap&&(x.envMapIntensity.value=S.envMapIntensity)}function y(x,S,D){x.ior.value=S.ior,S.sheen>0&&(x.sheenColor.value.copy(S.sheenColor).multiplyScalar(S.sheen),x.sheenRoughness.value=S.sheenRoughness,S.sheenColorMap&&(x.sheenColorMap.value=S.sheenColorMap,n(S.sheenColorMap,x.sheenColorMapTransform)),S.sheenRoughnessMap&&(x.sheenRoughnessMap.value=S.sheenRoughnessMap,n(S.sheenRoughnessMap,x.sheenRoughnessMapTransform))),S.clearcoat>0&&(x.clearcoat.value=S.clearcoat,x.clearcoatRoughness.value=S.clearcoatRoughness,S.clearcoatMap&&(x.clearcoatMap.value=S.clearcoatMap,n(S.clearcoatMap,x.clearcoatMapTransform)),S.clearcoatRoughnessMap&&(x.clearcoatRoughnessMap.value=S.clearcoatRoughnessMap,n(S.clearcoatRoughnessMap,x.clearcoatRoughnessMapTransform)),S.clearcoatNormalMap&&(x.clearcoatNormalMap.value=S.clearcoatNormalMap,n(S.clearcoatNormalMap,x.clearcoatNormalMapTransform),x.clearcoatNormalScale.value.copy(S.clearcoatNormalScale),S.side===ii&&x.clearcoatNormalScale.value.negate())),S.dispersion>0&&(x.dispersion.value=S.dispersion),S.iridescence>0&&(x.iridescence.value=S.iridescence,x.iridescenceIOR.value=S.iridescenceIOR,x.iridescenceThicknessMinimum.value=S.iridescenceThicknessRange[0],x.iridescenceThicknessMaximum.value=S.iridescenceThicknessRange[1],S.iridescenceMap&&(x.iridescenceMap.value=S.iridescenceMap,n(S.iridescenceMap,x.iridescenceMapTransform)),S.iridescenceThicknessMap&&(x.iridescenceThicknessMap.value=S.iridescenceThicknessMap,n(S.iridescenceThicknessMap,x.iridescenceThicknessMapTransform))),S.transmission>0&&(x.transmission.value=S.transmission,x.transmissionSamplerMap.value=D.texture,x.transmissionSamplerSize.value.set(D.width,D.height),S.transmissionMap&&(x.transmissionMap.value=S.transmissionMap,n(S.transmissionMap,x.transmissionMapTransform)),x.thickness.value=S.thickness,S.thicknessMap&&(x.thicknessMap.value=S.thicknessMap,n(S.thicknessMap,x.thicknessMapTransform)),x.attenuationDistance.value=S.attenuationDistance,x.attenuationColor.value.copy(S.attenuationColor)),S.anisotropy>0&&(x.anisotropyVector.value.set(S.anisotropy*Math.cos(S.anisotropyRotation),S.anisotropy*Math.sin(S.anisotropyRotation)),S.anisotropyMap&&(x.anisotropyMap.value=S.anisotropyMap,n(S.anisotropyMap,x.anisotropyMapTransform))),x.specularIntensity.value=S.specularIntensity,x.specularColor.value.copy(S.specularColor),S.specularColorMap&&(x.specularColorMap.value=S.specularColorMap,n(S.specularColorMap,x.specularColorMapTransform)),S.specularIntensityMap&&(x.specularIntensityMap.value=S.specularIntensityMap,n(S.specularIntensityMap,x.specularIntensityMapTransform))}function E(x,S){S.matcap&&(x.matcap.value=S.matcap)}function A(x,S){const D=t.get(S).light;x.referencePosition.value.setFromMatrixPosition(D.matrixWorld),x.nearDistance.value=D.shadow.camera.near,x.farDistance.value=D.shadow.camera.far}return{refreshFogUniforms:a,refreshMaterialUniforms:o}}function nC(r,t,n,a){let o={},c={},u=[];const d=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function m(w,B){const N=B.program;a.uniformBlockBinding(w,N)}function p(w,B){let N=o[w.id];N===void 0&&(x(w),N=_(w),o[w.id]=N,w.addEventListener("dispose",D));const P=B.program;a.updateUBOMapping(w,P);const T=t.render.frame;c[w.id]!==T&&(g(w),c[w.id]=T)}function _(w){const B=v();w.__bindingPointIndex=B;const N=r.createBuffer(),P=w.__size,T=w.usage;return r.bindBuffer(r.UNIFORM_BUFFER,N),r.bufferData(r.UNIFORM_BUFFER,P,T),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,B,N),N}function v(){for(let w=0;w<d;w++)if(u.indexOf(w)===-1)return u.push(w),w;return Oe("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function g(w){const B=o[w.id],N=w.uniforms,P=w.__cache;r.bindBuffer(r.UNIFORM_BUFFER,B);for(let T=0,O=N.length;T<O;T++){const W=N[T];if(Array.isArray(W))for(let k=0,Q=W.length;k<Q;k++)y(W[k],T,k,P);else y(W,T,0,P)}r.bindBuffer(r.UNIFORM_BUFFER,null)}function y(w,B,N,P){if(A(w,B,N,P)===!0){const T=w.__offset,O=w.value;if(Array.isArray(O)){let W=0;for(let k=0;k<O.length;k++){const Q=O[k],dt=S(Q);E(Q,w.__data,W),typeof Q!="number"&&typeof Q!="boolean"&&!Q.isMatrix3&&!ArrayBuffer.isView(Q)&&(W+=dt.storage/Float32Array.BYTES_PER_ELEMENT)}}else E(O,w.__data,0);r.bufferSubData(r.UNIFORM_BUFFER,T,w.__data)}}function E(w,B,N){typeof w=="number"||typeof w=="boolean"?B[0]=w:w.isMatrix3?(B[0]=w.elements[0],B[1]=w.elements[1],B[2]=w.elements[2],B[3]=0,B[4]=w.elements[3],B[5]=w.elements[4],B[6]=w.elements[5],B[7]=0,B[8]=w.elements[6],B[9]=w.elements[7],B[10]=w.elements[8],B[11]=0):ArrayBuffer.isView(w)?B.set(new w.constructor(w.buffer,w.byteOffset,B.length)):w.toArray(B,N)}function A(w,B,N,P){const T=w.value,O=B+"_"+N;if(P[O]===void 0)return typeof T=="number"||typeof T=="boolean"?P[O]=T:ArrayBuffer.isView(T)?P[O]=T.slice():P[O]=T.clone(),!0;{const W=P[O];if(typeof T=="number"||typeof T=="boolean"){if(W!==T)return P[O]=T,!0}else{if(ArrayBuffer.isView(T))return!0;if(W.equals(T)===!1)return W.copy(T),!0}}return!1}function x(w){const B=w.uniforms;let N=0;const P=16;for(let O=0,W=B.length;O<W;O++){const k=Array.isArray(B[O])?B[O]:[B[O]];for(let Q=0,dt=k.length;Q<dt;Q++){const vt=k[Q],Z=Array.isArray(vt.value)?vt.value:[vt.value];for(let F=0,V=Z.length;F<V;F++){const et=Z[F],mt=S(et),At=N%P,I=At%mt.boundary,J=At+I;N+=I,J!==0&&P-J<mt.storage&&(N+=P-J),vt.__data=new Float32Array(mt.storage/Float32Array.BYTES_PER_ELEMENT),vt.__offset=N,N+=mt.storage}}}const T=N%P;return T>0&&(N+=P-T),w.__size=N,w.__cache={},this}function S(w){const B={boundary:0,storage:0};return typeof w=="number"||typeof w=="boolean"?(B.boundary=4,B.storage=4):w.isVector2?(B.boundary=8,B.storage=8):w.isVector3||w.isColor?(B.boundary=16,B.storage=12):w.isVector4?(B.boundary=16,B.storage=16):w.isMatrix3?(B.boundary=48,B.storage=48):w.isMatrix4?(B.boundary=64,B.storage=64):w.isTexture?me("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(w)?(B.boundary=16,B.storage=w.byteLength):me("WebGLRenderer: Unsupported uniform value type.",w),B}function D(w){const B=w.target;B.removeEventListener("dispose",D);const N=u.indexOf(B.__bindingPointIndex);u.splice(N,1),r.deleteBuffer(o[B.id]),delete o[B.id],delete c[B.id]}function U(){for(const w in o)r.deleteBuffer(o[w]);u=[],o={},c={}}return{bind:m,update:p,dispose:U}}const iC=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 ea=null;function aC(){return ea===null&&(ea=new uS(iC,16,16,ms,Mi),ea.name="DFG_LUT",ea.minFilter=Gn,ea.magFilter=Gn,ea.wrapS=za,ea.wrapT=za,ea.generateMipmaps=!1,ea.needsUpdate=!0),ea}class rC{constructor(t={}){const{canvas:n=tT(),context:a=null,depth:o=!0,stencil:c=!1,alpha:u=!1,antialias:d=!1,premultipliedAlpha:m=!0,preserveDrawingBuffer:p=!1,powerPreference:_="default",failIfMajorPerformanceCaveat:v=!1,reversedDepthBuffer:g=!1,outputBufferType:y=yi}=t;this.isWebGLRenderer=!0;let E;if(a!==null){if(typeof WebGLRenderingContext<"u"&&a instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");E=a.getContextAttributes().alpha}else E=u;const A=y,x=new Set([Vm,Gm,Hm]),S=new Set([yi,ca,kl,Wl,Im,zm]),D=new Uint32Array(4),U=new Int32Array(4),w=new z;let B=null,N=null;const P=[],T=[];let O=null;this.domElement=n,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=oa,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const W=this;let k=!1,Q=null,dt=null,vt=null,Z=null;this._outputColorSpace=Ui;let F=0,V=0,et=null,mt=-1,At=null;const I=new cn,J=new cn;let bt=null;const Lt=new ce(0);let Ht=0,st=n.width,St=n.height,Et=1,Yt=null,ge=null;const se=new cn(0,0,st,St),kt=new cn(0,0,st,St);let Mt=!1;const gt=new Km;let Ut=!1,Rt=!1;const Jt=new ze,jt=new z,ee=new cn,ne={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let le=!1;function ve(){return et===null?Et:1}let H=a;function Ft(R,Y){return n.getContext(R,Y)}try{const R={alpha:!0,depth:o,stencil:c,antialias:d,premultipliedAlpha:m,preserveDrawingBuffer:p,powerPreference:_,failIfMajorPerformanceCaveat:v};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${Om}`),n.addEventListener("webglcontextlost",an,!1),n.addEventListener("webglcontextrestored",Ge,!1),n.addEventListener("webglcontextcreationerror",ri,!1),H===null){const Y="webgl2";if(H=Ft(Y,R),H===null)throw Ft(Y)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(R){throw Oe("WebGLRenderer: "+R.message),R}let ie,L,b,K,$,tt,wt,Ct,ct,ft,Dt,Xt,Bt,Ot,ue,he,xe,q,Nt,_t,Pt,Wt,Tt;function ae(){ie=new a3(H),ie.init(),Pt=new Kw(H,ie),L=new QR(H,ie,t,Pt),b=new Yw(H,ie),L.reversedDepthBuffer&&g&&b.buffers.depth.setReversed(!0),dt=H.createFramebuffer(),vt=H.createFramebuffer(),Z=H.createFramebuffer(),K=new o3(H),$=new Nw,tt=new Zw(H,ie,b,$,L,Pt,K),wt=new i3(W),Ct=new fA(H),Wt=new ZR(H,Ct),ct=new r3(H,Ct,K,Wt),ft=new c3(H,ct,Ct,Wt,K),q=new l3(H,L,tt),ue=new JR($),Dt=new Uw(W,wt,ie,L,Wt,ue),Xt=new eC(W,$),Bt=new Pw,Ot=new Gw(ie),xe=new YR(W,wt,b,ft,E,m),he=new qw(W,ft,L),Tt=new nC(H,K,L,b),Nt=new KR(H,ie,K),_t=new s3(H,ie,K),K.programs=Dt.programs,W.capabilities=L,W.extensions=ie,W.properties=$,W.renderLists=Bt,W.shadowMap=he,W.state=b,W.info=K}ae(),A!==yi&&(O=new f3(A,n.width,n.height,d,o,c));const Kt=new $w(W,H);this.xr=Kt,this.getContext=function(){return H},this.getContextAttributes=function(){return H.getContextAttributes()},this.forceContextLoss=function(){const R=ie.get("WEBGL_lose_context");R&&R.loseContext()},this.forceContextRestore=function(){const R=ie.get("WEBGL_lose_context");R&&R.restoreContext()},this.getPixelRatio=function(){return Et},this.setPixelRatio=function(R){R!==void 0&&(Et=R,this.setSize(st,St,!1))},this.getSize=function(R){return R.set(st,St)},this.setSize=function(R,Y,ot=!0){if(Kt.isPresenting){me("WebGLRenderer: Can't change size while VR device is presenting.");return}st=R,St=Y,n.width=Math.floor(R*Et),n.height=Math.floor(Y*Et),ot===!0&&(n.style.width=R+"px",n.style.height=Y+"px"),O!==null&&O.setSize(n.width,n.height),this.setViewport(0,0,R,Y)},this.getDrawingBufferSize=function(R){return R.set(st*Et,St*Et).floor()},this.setDrawingBufferSize=function(R,Y,ot){st=R,St=Y,Et=ot,n.width=Math.floor(R*ot),n.height=Math.floor(Y*ot),this.setViewport(0,0,R,Y)},this.setEffects=function(R){if(A===yi){Oe("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(R){for(let Y=0;Y<R.length;Y++)if(R[Y].isOutputPass===!0){me("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}O.setEffects(R||[])},this.getCurrentViewport=function(R){return R.copy(I)},this.getViewport=function(R){return R.copy(se)},this.setViewport=function(R,Y,ot,at){R.isVector4?se.set(R.x,R.y,R.z,R.w):se.set(R,Y,ot,at),b.viewport(I.copy(se).multiplyScalar(Et).round())},this.getScissor=function(R){return R.copy(kt)},this.setScissor=function(R,Y,ot,at){R.isVector4?kt.set(R.x,R.y,R.z,R.w):kt.set(R,Y,ot,at),b.scissor(J.copy(kt).multiplyScalar(Et).round())},this.getScissorTest=function(){return Mt},this.setScissorTest=function(R){b.setScissorTest(Mt=R)},this.setOpaqueSort=function(R){Yt=R},this.setTransparentSort=function(R){ge=R},this.getClearColor=function(R){return R.copy(xe.getClearColor())},this.setClearColor=function(){xe.setClearColor(...arguments)},this.getClearAlpha=function(){return xe.getClearAlpha()},this.setClearAlpha=function(){xe.setClearAlpha(...arguments)},this.clear=function(R=!0,Y=!0,ot=!0){let at=0;if(R){let rt=!1;if(et!==null){const Gt=et.texture.format;rt=x.has(Gt)}if(rt){const Gt=et.texture.type,Zt=S.has(Gt),zt=xe.getClearColor(),$t=xe.getClearAlpha(),Qt=zt.r,de=zt.g,Me=zt.b;Zt?(D[0]=Qt,D[1]=de,D[2]=Me,D[3]=$t,H.clearBufferuiv(H.COLOR,0,D)):(U[0]=Qt,U[1]=de,U[2]=Me,U[3]=$t,H.clearBufferiv(H.COLOR,0,U))}else at|=H.COLOR_BUFFER_BIT}Y&&(at|=H.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),ot&&(at|=H.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),at!==0&&H.clear(at)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(R){R.setRenderer(this),Q=R},this.dispose=function(){n.removeEventListener("webglcontextlost",an,!1),n.removeEventListener("webglcontextrestored",Ge,!1),n.removeEventListener("webglcontextcreationerror",ri,!1),xe.dispose(),Bt.dispose(),Ot.dispose(),$.dispose(),wt.dispose(),ft.dispose(),Wt.dispose(),Tt.dispose(),Dt.dispose(),Kt.dispose(),Kt.removeEventListener("sessionstart",mn),Kt.removeEventListener("sessionend",Ln),Kn.stop()};function an(R){R.preventDefault(),ff("WebGLRenderer: Context Lost."),k=!0}function Ge(){ff("WebGLRenderer: Context Restored."),k=!1;const R=K.autoReset,Y=he.enabled,ot=he.autoUpdate,at=he.needsUpdate,rt=he.type;ae(),K.autoReset=R,he.enabled=Y,he.autoUpdate=ot,he.needsUpdate=at,he.type=rt}function ri(R){Oe("WebGLRenderer: A WebGL context could not be created. Reason: ",R.statusMessage)}function si(R){const Y=R.target;Y.removeEventListener("dispose",si),Lo(Y)}function Lo(R){Uo(R),$.remove(R)}function Uo(R){const Y=$.get(R).programs;Y!==void 0&&(Y.forEach(function(ot){Dt.releaseProgram(ot)}),R.isShaderMaterial&&Dt.releaseShaderCache(R))}this.renderBufferDirect=function(R,Y,ot,at,rt,Gt){Y===null&&(Y=ne);const Zt=rt.isMesh&&rt.matrixWorld.determinantAffine()<0,zt=Za(R,Y,ot,at,rt);b.setMaterial(at,Zt);let $t=ot.index,Qt=1;if(at.wireframe===!0){if($t=ct.getWireframeAttribute(ot),$t===void 0)return;Qt=2}const de=ot.drawRange,Me=ot.attributes.position;let oe=de.start*Qt,Pe=(de.start+de.count)*Qt;Gt!==null&&(oe=Math.max(oe,Gt.start*Qt),Pe=Math.min(Pe,(Gt.start+Gt.count)*Qt)),$t!==null?(oe=Math.max(oe,0),Pe=Math.min(Pe,$t.count)):Me!=null&&(oe=Math.max(oe,0),Pe=Math.min(Pe,Me.count));const rn=Pe-oe;if(rn<0||rn===1/0)return;Wt.setup(rt,at,zt,ot,$t);let $e,Ve=Nt;if($t!==null&&($e=Ct.get($t),Ve=_t,Ve.setIndex($e)),rt.isMesh)at.wireframe===!0?(b.setLineWidth(at.wireframeLinewidth*ve()),Ve.setMode(H.LINES)):Ve.setMode(H.TRIANGLES);else if(rt.isLine){let ke=at.linewidth;ke===void 0&&(ke=1),b.setLineWidth(ke*ve()),rt.isLineSegments?Ve.setMode(H.LINES):rt.isLineLoop?Ve.setMode(H.LINE_LOOP):Ve.setMode(H.LINE_STRIP)}else rt.isPoints?Ve.setMode(H.POINTS):rt.isSprite&&Ve.setMode(H.TRIANGLES);if(rt.isBatchedMesh)if(ie.get("WEBGL_multi_draw"))Ve.renderMultiDraw(rt._multiDrawStarts,rt._multiDrawCounts,rt._multiDrawCount);else{const ke=rt._multiDrawStarts,qt=rt._multiDrawCounts,In=rt._multiDrawCount,Re=$t?Ct.get($t).bytesPerElement:1,En=$.get(at).currentProgram.getUniforms();for(let oi=0;oi<In;oi++)En.setValue(H,"_gl_DrawID",oi),Ve.render(ke[oi]/Re,qt[oi])}else if(rt.isInstancedMesh)Ve.renderInstances(oe,rn,rt.count);else if(ot.isInstancedBufferGeometry){const ke=ot._maxInstanceCount!==void 0?ot._maxInstanceCount:1/0,qt=Math.min(ot.instanceCount,ke);Ve.renderInstances(oe,rn,qt)}else Ve.render(oe,rn)};function No(R,Y,ot){R.transparent===!0&&R.side===aa&&R.forceSinglePass===!1?(R.side=ii,R.needsUpdate=!0,Ya(R,Y,ot),R.side=Dr,R.needsUpdate=!0,Ya(R,Y,ot),R.side=aa):Ya(R,Y,ot)}this.compile=function(R,Y,ot=null){ot===null&&(ot=R),N=Ot.get(ot),N.init(Y),T.push(N),ot.traverseVisible(function(rt){rt.isLight&&rt.layers.test(Y.layers)&&(N.pushLight(rt),rt.castShadow&&N.pushShadow(rt))}),R!==ot&&R.traverseVisible(function(rt){rt.isLight&&rt.layers.test(Y.layers)&&(N.pushLight(rt),rt.castShadow&&N.pushShadow(rt))}),N.setupLights();const at=new Set;return R.traverse(function(rt){if(!(rt.isMesh||rt.isPoints||rt.isLine||rt.isSprite))return;const Gt=rt.material;if(Gt)if(Array.isArray(Gt))for(let Zt=0;Zt<Gt.length;Zt++){const zt=Gt[Zt];No(zt,ot,rt),at.add(zt)}else No(Gt,ot,rt),at.add(Gt)}),N=T.pop(),at},this.compileAsync=function(R,Y,ot=null){const at=this.compile(R,Y,ot);return new Promise(rt=>{function Gt(){if(at.forEach(function(Zt){$.get(Zt).currentProgram.isReady()&&at.delete(Zt)}),at.size===0){rt(R);return}setTimeout(Gt,10)}ie.get("KHR_parallel_shader_compile")!==null?Gt():setTimeout(Gt,10)})};let xs=null;function Zi(R){xs&&xs(R)}function mn(){Kn.stop()}function Ln(){Kn.start()}const Kn=new vS;Kn.setAnimationLoop(Zi),typeof self<"u"&&Kn.setContext(self),this.setAnimationLoop=function(R){xs=R,Kt.setAnimationLoop(R),R===null?Kn.stop():Kn.start()},Kt.addEventListener("sessionstart",mn),Kt.addEventListener("sessionend",Ln),this.render=function(R,Y){if(Y!==void 0&&Y.isCamera!==!0){Oe("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(k===!0)return;Q!==null&&Q.renderStart(R,Y);const ot=Kt.enabled===!0&&Kt.isPresenting===!0,at=O!==null&&(et===null||ot)&&O.begin(W,et);if(R.matrixWorldAutoUpdate===!0&&R.updateMatrixWorld(),Y.parent===null&&Y.matrixWorldAutoUpdate===!0&&Y.updateMatrixWorld(),Kt.enabled===!0&&Kt.isPresenting===!0&&(O===null||O.isCompositing()===!1)&&(Kt.cameraAutoUpdate===!0&&Kt.updateCamera(Y),Y=Kt.getCamera()),R.isScene===!0&&R.onBeforeRender(W,R,Y,et),N=Ot.get(R,T.length),N.init(Y),N.state.textureUnits=tt.getTextureUnits(),T.push(N),Jt.multiplyMatrices(Y.projectionMatrix,Y.matrixWorldInverse),gt.setFromProjectionMatrix(Jt,ra,Y.reversedDepth),Rt=this.localClippingEnabled,Ut=ue.init(this.clippingPlanes,Rt),B=Bt.get(R,P.length),B.init(),P.push(B),Kt.enabled===!0&&Kt.isPresenting===!0){const Zt=W.xr.getDepthSensingMesh();Zt!==null&&Nr(Zt,Y,-1/0,W.sortObjects)}Nr(R,Y,0,W.sortObjects),B.finish(),W.sortObjects===!0&&B.sort(Yt,ge,Y.reversedDepth),le=Kt.enabled===!1||Kt.isPresenting===!1||Kt.hasDepthSensing()===!1,le&&xe.addToRenderList(B,R),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),Ut===!0&&ue.beginShadows();const rt=N.state.shadowsArray;if(he.render(rt,R,Y),Ut===!0&&ue.endShadows(),(at&&O.hasRenderPass())===!1){const Zt=B.opaque,zt=B.transmissive;if(N.setupLights(),Y.isArrayCamera){const $t=Y.cameras;if(zt.length>0)for(let Qt=0,de=$t.length;Qt<de;Qt++){const Me=$t[Qt];tc(Zt,zt,R,Me)}le&&xe.render(R);for(let Qt=0,de=$t.length;Qt<de;Qt++){const Me=$t[Qt];$l(B,R,Me,Me.viewport)}}else zt.length>0&&tc(Zt,zt,R,Y),le&&xe.render(R),$l(B,R,Y)}et!==null&&V===0&&(tt.updateMultisampleRenderTarget(et),tt.updateRenderTargetMipmap(et)),at&&O.end(W),R.isScene===!0&&R.onAfterRender(W,R,Y),Wt.resetDefaultState(),mt=-1,At=null,T.pop(),T.length>0?(N=T[T.length-1],tt.setTextureUnits(N.state.textureUnits),Ut===!0&&ue.setGlobalState(W.clippingPlanes,N.state.camera)):N=null,P.pop(),P.length>0?B=P[P.length-1]:B=null,Q!==null&&Q.renderEnd()};function Nr(R,Y,ot,at){if(R.visible===!1)return;if(R.layers.test(Y.layers)){if(R.isGroup)ot=R.renderOrder;else if(R.isLOD)R.autoUpdate===!0&&R.update(Y);else if(R.isLightProbeGrid)N.pushLightProbeGrid(R);else if(R.isLight)N.pushLight(R),R.castShadow&&N.pushShadow(R);else if(R.isSprite){if(!R.frustumCulled||gt.intersectsSprite(R)){at&&ee.setFromMatrixPosition(R.matrixWorld).applyMatrix4(Jt);const Zt=ft.update(R),zt=R.material;zt.visible&&B.push(R,Zt,zt,ot,ee.z,null)}}else if((R.isMesh||R.isLine||R.isPoints)&&(!R.frustumCulled||gt.intersectsObject(R))){const Zt=ft.update(R),zt=R.material;if(at&&(R.boundingSphere!==void 0?(R.boundingSphere===null&&R.computeBoundingSphere(),ee.copy(R.boundingSphere.center)):(Zt.boundingSphere===null&&Zt.computeBoundingSphere(),ee.copy(Zt.boundingSphere.center)),ee.applyMatrix4(R.matrixWorld).applyMatrix4(Jt)),Array.isArray(zt)){const $t=Zt.groups;for(let Qt=0,de=$t.length;Qt<de;Qt++){const Me=$t[Qt],oe=zt[Me.materialIndex];oe&&oe.visible&&B.push(R,Zt,oe,ot,ee.z,Me)}}else zt.visible&&B.push(R,Zt,zt,ot,ee.z,null)}}const Gt=R.children;for(let Zt=0,zt=Gt.length;Zt<zt;Zt++)Nr(Gt[Zt],Y,ot,at)}function $l(R,Y,ot,at){const{opaque:rt,transmissive:Gt,transparent:Zt}=R;N.setupLightsView(ot),Ut===!0&&ue.setGlobalState(W.clippingPlanes,ot),at&&b.viewport(I.copy(at)),rt.length>0&&Or(rt,Y,ot),Gt.length>0&&Or(Gt,Y,ot),Zt.length>0&&Or(Zt,Y,ot),b.buffers.depth.setTest(!0),b.buffers.depth.setMask(!0),b.buffers.color.setMask(!0),b.setPolygonOffset(!1)}function tc(R,Y,ot,at){if((ot.isScene===!0?ot.overrideMaterial:null)!==null)return;if(N.state.transmissionRenderTarget[at.id]===void 0){const oe=ie.has("EXT_color_buffer_half_float")||ie.has("EXT_color_buffer_float");N.state.transmissionRenderTarget[at.id]=new ai(1,1,{generateMipmaps:!0,type:oe?Mi:yi,minFilter:fs,samples:Math.max(4,L.samples),stencilBuffer:c,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Ne.workingColorSpace})}const Gt=N.state.transmissionRenderTarget[at.id],Zt=at.viewport||I;Gt.setSize(Zt.z*W.transmissionResolutionScale,Zt.w*W.transmissionResolutionScale);const zt=W.getRenderTarget(),$t=W.getActiveCubeFace(),Qt=W.getActiveMipmapLevel();W.setRenderTarget(Gt),W.getClearColor(Lt),Ht=W.getClearAlpha(),Ht<1&&W.setClearColor(16777215,.5),W.clear(),le&&xe.render(ot);const de=W.toneMapping;W.toneMapping=oa;const Me=at.viewport;if(at.viewport!==void 0&&(at.viewport=void 0),N.setupLightsView(at),Ut===!0&&ue.setGlobalState(W.clippingPlanes,at),Or(R,ot,at),tt.updateMultisampleRenderTarget(Gt),tt.updateRenderTargetMipmap(Gt),ie.has("WEBGL_multisampled_render_to_texture")===!1){let oe=!1;for(let Pe=0,rn=Y.length;Pe<rn;Pe++){const $e=Y[Pe],{object:Ve,geometry:ke,material:qt,group:In}=$e;if(qt.side===aa&&Ve.layers.test(at.layers)){const Re=qt.side;qt.side=ii,qt.needsUpdate=!0,qa(Ve,ot,at,ke,qt,In),qt.side=Re,qt.needsUpdate=!0,oe=!0}}oe===!0&&(tt.updateMultisampleRenderTarget(Gt),tt.updateRenderTargetMipmap(Gt))}W.setRenderTarget(zt,$t,Qt),W.setClearColor(Lt,Ht),Me!==void 0&&(at.viewport=Me),W.toneMapping=de}function Or(R,Y,ot){const at=Y.isScene===!0?Y.overrideMaterial:null;for(let rt=0,Gt=R.length;rt<Gt;rt++){const Zt=R[rt],{object:zt,geometry:$t,group:Qt}=Zt;let de=Zt.material;de.allowOverride===!0&&at!==null&&(de=at),zt.layers.test(ot.layers)&&qa(zt,Y,ot,$t,de,Qt)}}function qa(R,Y,ot,at,rt,Gt){R.onBeforeRender(W,Y,ot,at,rt,Gt),R.modelViewMatrix.multiplyMatrices(ot.matrixWorldInverse,R.matrixWorld),R.normalMatrix.getNormalMatrix(R.modelViewMatrix),rt.onBeforeRender(W,Y,ot,at,R,Gt),rt.transparent===!0&&rt.side===aa&&rt.forceSinglePass===!1?(rt.side=ii,rt.needsUpdate=!0,W.renderBufferDirect(ot,Y,at,rt,R,Gt),rt.side=Dr,rt.needsUpdate=!0,W.renderBufferDirect(ot,Y,at,rt,R,Gt),rt.side=aa):W.renderBufferDirect(ot,Y,at,rt,R,Gt),R.onAfterRender(W,Y,ot,at,rt,Gt)}function Ya(R,Y,ot){Y.isScene!==!0&&(Y=ne);const at=$.get(R),rt=N.state.lights,Gt=N.state.shadowsArray,Zt=rt.state.version,zt=Dt.getParameters(R,rt.state,Gt,Y,ot,N.state.lightProbeGridArray),$t=Dt.getProgramCacheKey(zt);let Qt=at.programs;at.environment=R.isMeshStandardMaterial||R.isMeshLambertMaterial||R.isMeshPhongMaterial?Y.environment:null,at.fog=Y.fog;const de=R.isMeshStandardMaterial||R.isMeshLambertMaterial&&!R.envMap||R.isMeshPhongMaterial&&!R.envMap;at.envMap=wt.get(R.envMap||at.environment,de),at.envMapRotation=at.environment!==null&&R.envMap===null?Y.environmentRotation:R.envMapRotation,Qt===void 0&&(R.addEventListener("dispose",si),Qt=new Map,at.programs=Qt);let Me=Qt.get($t);if(Me!==void 0){if(at.currentProgram===Me&&at.lightsStateVersion===Zt)return ha(R,zt),Me}else zt.uniforms=Dt.getUniforms(R),Q!==null&&R.isNodeMaterial&&Q.build(R,ot,zt),R.onBeforeCompile(zt,W),Me=Dt.acquireProgram(zt,$t),Qt.set($t,Me),at.uniforms=zt.uniforms;const oe=at.uniforms;return(!R.isShaderMaterial&&!R.isRawShaderMaterial||R.clipping===!0)&&(oe.clippingPlanes=ue.uniform),ha(R,zt),at.needsLights=ec(R),at.lightsStateVersion=Zt,at.needsLights&&(oe.ambientLightColor.value=rt.state.ambient,oe.lightProbe.value=rt.state.probe,oe.directionalLights.value=rt.state.directional,oe.directionalLightShadows.value=rt.state.directionalShadow,oe.spotLights.value=rt.state.spot,oe.spotLightShadows.value=rt.state.spotShadow,oe.rectAreaLights.value=rt.state.rectArea,oe.ltc_1.value=rt.state.rectAreaLTC1,oe.ltc_2.value=rt.state.rectAreaLTC2,oe.pointLights.value=rt.state.point,oe.pointLightShadows.value=rt.state.pointShadow,oe.hemisphereLights.value=rt.state.hemi,oe.directionalShadowMatrix.value=rt.state.directionalShadowMatrix,oe.spotLightMatrix.value=rt.state.spotLightMatrix,oe.spotLightMap.value=rt.state.spotLightMap,oe.pointShadowMatrix.value=rt.state.pointShadowMatrix),at.lightProbeGrid=N.state.lightProbeGridArray.length>0,at.currentProgram=Me,at.uniformsList=null,Me}function fa(R){if(R.uniformsList===null){const Y=R.currentProgram.getUniforms();R.uniformsList=ef.seqWithValue(Y.seq,R.uniforms)}return R.uniformsList}function ha(R,Y){const ot=$.get(R);ot.outputColorSpace=Y.outputColorSpace,ot.batching=Y.batching,ot.batchingColor=Y.batchingColor,ot.instancing=Y.instancing,ot.instancingColor=Y.instancingColor,ot.instancingMorph=Y.instancingMorph,ot.skinning=Y.skinning,ot.morphTargets=Y.morphTargets,ot.morphNormals=Y.morphNormals,ot.morphColors=Y.morphColors,ot.morphTargetsCount=Y.morphTargetsCount,ot.numClippingPlanes=Y.numClippingPlanes,ot.numIntersection=Y.numClipIntersection,ot.vertexAlphas=Y.vertexAlphas,ot.vertexTangents=Y.vertexTangents,ot.toneMapping=Y.toneMapping}function Pr(R,Y){if(R.length===0)return null;if(R.length===1)return R[0].texture!==null?R[0]:null;w.setFromMatrixPosition(Y.matrixWorld);for(let ot=0,at=R.length;ot<at;ot++){const rt=R[ot];if(rt.texture!==null&&rt.boundingBox.containsPoint(w))return rt}return null}function Za(R,Y,ot,at,rt){Y.isScene!==!0&&(Y=ne),tt.resetTextureUnits();const Gt=Y.fog,Zt=at.isMeshStandardMaterial||at.isMeshLambertMaterial||at.isMeshPhongMaterial?Y.environment:null,zt=et===null?W.outputColorSpace:et.isXRRenderTarget===!0?et.texture.colorSpace:Ne.workingColorSpace,$t=at.isMeshStandardMaterial||at.isMeshLambertMaterial&&!at.envMap||at.isMeshPhongMaterial&&!at.envMap,Qt=wt.get(at.envMap||Zt,$t),de=at.vertexColors===!0&&!!ot.attributes.color&&ot.attributes.color.itemSize===4,Me=!!ot.attributes.tangent&&(!!at.normalMap||at.anisotropy>0),oe=!!ot.morphAttributes.position,Pe=!!ot.morphAttributes.normal,rn=!!ot.morphAttributes.color;let $e=oa;at.toneMapped&&(et===null||et.isXRRenderTarget===!0)&&($e=W.toneMapping);const Ve=ot.morphAttributes.position||ot.morphAttributes.normal||ot.morphAttributes.color,ke=Ve!==void 0?Ve.length:0,qt=$.get(at),In=N.state.lights;if(Ut===!0&&(Rt===!0||R!==At)){const He=R===At&&at.id===mt;ue.setState(at,R,He)}let Re=!1;at.version===qt.__version?(qt.needsLights&&qt.lightsStateVersion!==In.state.version||qt.outputColorSpace!==zt||rt.isBatchedMesh&&qt.batching===!1||!rt.isBatchedMesh&&qt.batching===!0||rt.isBatchedMesh&&qt.batchingColor===!0&&rt.colorTexture===null||rt.isBatchedMesh&&qt.batchingColor===!1&&rt.colorTexture!==null||rt.isInstancedMesh&&qt.instancing===!1||!rt.isInstancedMesh&&qt.instancing===!0||rt.isSkinnedMesh&&qt.skinning===!1||!rt.isSkinnedMesh&&qt.skinning===!0||rt.isInstancedMesh&&qt.instancingColor===!0&&rt.instanceColor===null||rt.isInstancedMesh&&qt.instancingColor===!1&&rt.instanceColor!==null||rt.isInstancedMesh&&qt.instancingMorph===!0&&rt.morphTexture===null||rt.isInstancedMesh&&qt.instancingMorph===!1&&rt.morphTexture!==null||qt.envMap!==Qt||at.fog===!0&&qt.fog!==Gt||qt.numClippingPlanes!==void 0&&(qt.numClippingPlanes!==ue.numPlanes||qt.numIntersection!==ue.numIntersection)||qt.vertexAlphas!==de||qt.vertexTangents!==Me||qt.morphTargets!==oe||qt.morphNormals!==Pe||qt.morphColors!==rn||qt.toneMapping!==$e||qt.morphTargetsCount!==ke||!!qt.lightProbeGrid!=N.state.lightProbeGridArray.length>0)&&(Re=!0):(Re=!0,qt.__version=at.version);let En=qt.currentProgram;Re===!0&&(En=Ya(at,Y,rt),Q&&at.isNodeMaterial&&Q.onUpdateProgram(at,En,qt));let oi=!1,Pi=!1,li=!1;const We=En.getUniforms(),sn=qt.uniforms;if(b.useProgram(En.program)&&(oi=!0,Pi=!0,li=!0),at.id!==mt&&(mt=at.id,Pi=!0),qt.needsLights){const He=Pr(N.state.lightProbeGridArray,rt);qt.lightProbeGrid!==He&&(qt.lightProbeGrid=He,Pi=!0)}if(oi||At!==R){b.buffers.depth.getReversed()&&R.reversedDepth!==!0&&(R._reversedDepth=!0,R.updateProjectionMatrix()),We.setValue(H,"projectionMatrix",R.projectionMatrix),We.setValue(H,"viewMatrix",R.matrixWorldInverse);const Ki=We.map.cameraPosition;Ki!==void 0&&Ki.setValue(H,jt.setFromMatrixPosition(R.matrixWorld)),L.logarithmicDepthBuffer&&We.setValue(H,"logDepthBufFC",2/(Math.log(R.far+1)/Math.LN2)),(at.isMeshPhongMaterial||at.isMeshToonMaterial||at.isMeshLambertMaterial||at.isMeshBasicMaterial||at.isMeshStandardMaterial||at.isShaderMaterial)&&We.setValue(H,"isOrthographic",R.isOrthographicCamera===!0),At!==R&&(At=R,Pi=!0,li=!0)}if(qt.needsLights&&(In.state.directionalShadowMap.length>0&&We.setValue(H,"directionalShadowMap",In.state.directionalShadowMap,tt),In.state.spotShadowMap.length>0&&We.setValue(H,"spotShadowMap",In.state.spotShadowMap,tt),In.state.pointShadowMap.length>0&&We.setValue(H,"pointShadowMap",In.state.pointShadowMap,tt)),rt.isSkinnedMesh){We.setOptional(H,rt,"bindMatrix"),We.setOptional(H,rt,"bindMatrixInverse");const He=rt.skeleton;He&&(He.boneTexture===null&&He.computeBoneTexture(),We.setValue(H,"boneTexture",He.boneTexture,tt))}rt.isBatchedMesh&&(We.setOptional(H,rt,"batchingTexture"),We.setValue(H,"batchingTexture",rt._matricesTexture,tt),We.setOptional(H,rt,"batchingIdTexture"),We.setValue(H,"batchingIdTexture",rt._indirectTexture,tt),We.setOptional(H,rt,"batchingColorTexture"),rt._colorsTexture!==null&&We.setValue(H,"batchingColorTexture",rt._colorsTexture,tt));const Bi=ot.morphAttributes;if((Bi.position!==void 0||Bi.normal!==void 0||Bi.color!==void 0)&&q.update(rt,ot,En),(Pi||qt.receiveShadow!==rt.receiveShadow)&&(qt.receiveShadow=rt.receiveShadow,We.setValue(H,"receiveShadow",rt.receiveShadow)),(at.isMeshStandardMaterial||at.isMeshLambertMaterial||at.isMeshPhongMaterial)&&at.envMap===null&&Y.environment!==null&&(sn.envMapIntensity.value=Y.environmentIntensity),sn.dfgLUT!==void 0&&(sn.dfgLUT.value=aC()),Pi){if(We.setValue(H,"toneMappingExposure",W.toneMappingExposure),qt.needsLights&&gn(sn,li),Gt&&at.fog===!0&&Xt.refreshFogUniforms(sn,Gt),Xt.refreshMaterialUniforms(sn,at,Et,St,N.state.transmissionRenderTarget[R.id]),qt.needsLights&&qt.lightProbeGrid){const He=qt.lightProbeGrid;sn.probesSH.value=He.texture,sn.probesMin.value.copy(He.boundingBox.min),sn.probesMax.value.copy(He.boundingBox.max),sn.probesResolution.value.copy(He.resolution)}ef.upload(H,fa(qt),sn,tt)}if(at.isShaderMaterial&&at.uniformsNeedUpdate===!0&&(ef.upload(H,fa(qt),sn,tt),at.uniformsNeedUpdate=!1),at.isSpriteMaterial&&We.setValue(H,"center",rt.center),We.setValue(H,"modelViewMatrix",rt.modelViewMatrix),We.setValue(H,"normalMatrix",rt.normalMatrix),We.setValue(H,"modelMatrix",rt.matrixWorld),at.uniformsGroups!==void 0){const He=at.uniformsGroups;for(let Ki=0,Ka=He.length;Ki<Ka;Ki++){const Br=He[Ki];Tt.update(Br,En),Tt.bind(Br,En)}}return En}function gn(R,Y){R.ambientLightColor.needsUpdate=Y,R.lightProbe.needsUpdate=Y,R.directionalLights.needsUpdate=Y,R.directionalLightShadows.needsUpdate=Y,R.pointLights.needsUpdate=Y,R.pointLightShadows.needsUpdate=Y,R.spotLights.needsUpdate=Y,R.spotLightShadows.needsUpdate=Y,R.rectAreaLights.needsUpdate=Y,R.hemisphereLights.needsUpdate=Y}function ec(R){return R.isMeshLambertMaterial||R.isMeshToonMaterial||R.isMeshPhongMaterial||R.isMeshStandardMaterial||R.isShadowMaterial||R.isShaderMaterial&&R.lights===!0}this.getActiveCubeFace=function(){return F},this.getActiveMipmapLevel=function(){return V},this.getRenderTarget=function(){return et},this.setRenderTargetTextures=function(R,Y,ot){const at=$.get(R);at.__autoAllocateDepthBuffer=R.resolveDepthBuffer===!1,at.__autoAllocateDepthBuffer===!1&&(at.__useRenderToTexture=!1),$.get(R.texture).__webglTexture=Y,$.get(R.depthTexture).__webglTexture=at.__autoAllocateDepthBuffer?void 0:ot,at.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(R,Y){const ot=$.get(R);ot.__webglFramebuffer=Y,ot.__useDefaultFramebuffer=Y===void 0},this.setRenderTarget=function(R,Y=0,ot=0){et=R,F=Y,V=ot;let at=null,rt=!1,Gt=!1;if(R){const zt=$.get(R);if(zt.__useDefaultFramebuffer!==void 0){b.bindFramebuffer(H.FRAMEBUFFER,zt.__webglFramebuffer),I.copy(R.viewport),J.copy(R.scissor),bt=R.scissorTest,b.viewport(I),b.scissor(J),b.setScissorTest(bt),mt=-1;return}else if(zt.__webglFramebuffer===void 0)tt.setupRenderTarget(R);else if(zt.__hasExternalTextures)tt.rebindTextures(R,$.get(R.texture).__webglTexture,$.get(R.depthTexture).__webglTexture);else if(R.depthBuffer){const de=R.depthTexture;if(zt.__boundDepthTexture!==de){if(de!==null&&$.has(de)&&(R.width!==de.image.width||R.height!==de.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");tt.setupDepthRenderbuffer(R)}}const $t=R.texture;($t.isData3DTexture||$t.isDataArrayTexture||$t.isCompressedArrayTexture)&&(Gt=!0);const Qt=$.get(R).__webglFramebuffer;R.isWebGLCubeRenderTarget?(Array.isArray(Qt[Y])?at=Qt[Y][ot]:at=Qt[Y],rt=!0):R.samples>0&&tt.useMultisampledRTT(R)===!1?at=$.get(R).__webglMultisampledFramebuffer:Array.isArray(Qt)?at=Qt[ot]:at=Qt,I.copy(R.viewport),J.copy(R.scissor),bt=R.scissorTest}else I.copy(se).multiplyScalar(Et).floor(),J.copy(kt).multiplyScalar(Et).floor(),bt=Mt;if(ot!==0&&(at=dt),b.bindFramebuffer(H.FRAMEBUFFER,at)&&b.drawBuffers(R,at),b.viewport(I),b.scissor(J),b.setScissorTest(bt),rt){const zt=$.get(R.texture);H.framebufferTexture2D(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_CUBE_MAP_POSITIVE_X+Y,zt.__webglTexture,ot)}else if(Gt){const zt=Y;for(let $t=0;$t<R.textures.length;$t++){const Qt=$.get(R.textures[$t]);H.framebufferTextureLayer(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0+$t,Qt.__webglTexture,ot,zt)}}else if(R!==null&&ot!==0){const zt=$.get(R.texture);H.framebufferTexture2D(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_2D,zt.__webglTexture,ot)}mt=-1},this.readRenderTargetPixels=function(R,Y,ot,at,rt,Gt,Zt,zt=0){if(!(R&&R.isWebGLRenderTarget)){Oe("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let $t=$.get(R).__webglFramebuffer;if(R.isWebGLCubeRenderTarget&&Zt!==void 0&&($t=$t[Zt]),$t){b.bindFramebuffer(H.FRAMEBUFFER,$t);try{const Qt=R.textures[zt],de=Qt.format,Me=Qt.type;if(R.textures.length>1&&H.readBuffer(H.COLOR_ATTACHMENT0+zt),!L.textureFormatReadable(de)){Oe("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!L.textureTypeReadable(Me)){Oe("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Y>=0&&Y<=R.width-at&&ot>=0&&ot<=R.height-rt&&H.readPixels(Y,ot,at,rt,Pt.convert(de),Pt.convert(Me),Gt)}finally{const Qt=et!==null?$.get(et).__webglFramebuffer:null;b.bindFramebuffer(H.FRAMEBUFFER,Qt)}}},this.readRenderTargetPixelsAsync=async function(R,Y,ot,at,rt,Gt,Zt,zt=0){if(!(R&&R.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let $t=$.get(R).__webglFramebuffer;if(R.isWebGLCubeRenderTarget&&Zt!==void 0&&($t=$t[Zt]),$t)if(Y>=0&&Y<=R.width-at&&ot>=0&&ot<=R.height-rt){b.bindFramebuffer(H.FRAMEBUFFER,$t);const Qt=R.textures[zt],de=Qt.format,Me=Qt.type;if(R.textures.length>1&&H.readBuffer(H.COLOR_ATTACHMENT0+zt),!L.textureFormatReadable(de))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!L.textureTypeReadable(Me))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const oe=H.createBuffer();H.bindBuffer(H.PIXEL_PACK_BUFFER,oe),H.bufferData(H.PIXEL_PACK_BUFFER,Gt.byteLength,H.STREAM_READ),H.readPixels(Y,ot,at,rt,Pt.convert(de),Pt.convert(Me),0);const Pe=et!==null?$.get(et).__webglFramebuffer:null;b.bindFramebuffer(H.FRAMEBUFFER,Pe);const rn=H.fenceSync(H.SYNC_GPU_COMMANDS_COMPLETE,0);return H.flush(),await eT(H,rn,4),H.bindBuffer(H.PIXEL_PACK_BUFFER,oe),H.getBufferSubData(H.PIXEL_PACK_BUFFER,0,Gt),H.deleteBuffer(oe),H.deleteSync(rn),Gt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(R,Y=null,ot=0){const at=Math.pow(2,-ot),rt=Math.floor(R.image.width*at),Gt=Math.floor(R.image.height*at),Zt=Y!==null?Y.x:0,zt=Y!==null?Y.y:0;tt.setTexture2D(R,0),H.copyTexSubImage2D(H.TEXTURE_2D,ot,0,0,Zt,zt,rt,Gt),b.unbindTexture()},this.copyTextureToTexture=function(R,Y,ot=null,at=null,rt=0,Gt=0){let Zt,zt,$t,Qt,de,Me,oe,Pe,rn;const $e=R.isCompressedTexture?R.mipmaps[Gt]:R.image;if(ot!==null)Zt=ot.max.x-ot.min.x,zt=ot.max.y-ot.min.y,$t=ot.isBox3?ot.max.z-ot.min.z:1,Qt=ot.min.x,de=ot.min.y,Me=ot.isBox3?ot.min.z:0;else{const sn=Math.pow(2,-rt);Zt=Math.floor($e.width*sn),zt=Math.floor($e.height*sn),R.isDataArrayTexture?$t=$e.depth:R.isData3DTexture?$t=Math.floor($e.depth*sn):$t=1,Qt=0,de=0,Me=0}at!==null?(oe=at.x,Pe=at.y,rn=at.z):(oe=0,Pe=0,rn=0);const Ve=Pt.convert(Y.format),ke=Pt.convert(Y.type);let qt;Y.isData3DTexture?(tt.setTexture3D(Y,0),qt=H.TEXTURE_3D):Y.isDataArrayTexture||Y.isCompressedArrayTexture?(tt.setTexture2DArray(Y,0),qt=H.TEXTURE_2D_ARRAY):(tt.setTexture2D(Y,0),qt=H.TEXTURE_2D),b.activeTexture(H.TEXTURE0),b.pixelStorei(H.UNPACK_FLIP_Y_WEBGL,Y.flipY),b.pixelStorei(H.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Y.premultiplyAlpha),b.pixelStorei(H.UNPACK_ALIGNMENT,Y.unpackAlignment);const In=b.getParameter(H.UNPACK_ROW_LENGTH),Re=b.getParameter(H.UNPACK_IMAGE_HEIGHT),En=b.getParameter(H.UNPACK_SKIP_PIXELS),oi=b.getParameter(H.UNPACK_SKIP_ROWS),Pi=b.getParameter(H.UNPACK_SKIP_IMAGES);b.pixelStorei(H.UNPACK_ROW_LENGTH,$e.width),b.pixelStorei(H.UNPACK_IMAGE_HEIGHT,$e.height),b.pixelStorei(H.UNPACK_SKIP_PIXELS,Qt),b.pixelStorei(H.UNPACK_SKIP_ROWS,de),b.pixelStorei(H.UNPACK_SKIP_IMAGES,Me);const li=R.isDataArrayTexture||R.isData3DTexture,We=Y.isDataArrayTexture||Y.isData3DTexture;if(R.isDepthTexture){const sn=$.get(R),Bi=$.get(Y),He=$.get(sn.__renderTarget),Ki=$.get(Bi.__renderTarget);b.bindFramebuffer(H.READ_FRAMEBUFFER,He.__webglFramebuffer),b.bindFramebuffer(H.DRAW_FRAMEBUFFER,Ki.__webglFramebuffer);for(let Ka=0;Ka<$t;Ka++)li&&(H.framebufferTextureLayer(H.READ_FRAMEBUFFER,H.COLOR_ATTACHMENT0,$.get(R).__webglTexture,rt,Me+Ka),H.framebufferTextureLayer(H.DRAW_FRAMEBUFFER,H.COLOR_ATTACHMENT0,$.get(Y).__webglTexture,Gt,rn+Ka)),H.blitFramebuffer(Qt,de,Zt,zt,oe,Pe,Zt,zt,H.DEPTH_BUFFER_BIT,H.NEAREST);b.bindFramebuffer(H.READ_FRAMEBUFFER,null),b.bindFramebuffer(H.DRAW_FRAMEBUFFER,null)}else if(rt!==0||R.isRenderTargetTexture||$.has(R)){const sn=$.get(R),Bi=$.get(Y);b.bindFramebuffer(H.READ_FRAMEBUFFER,vt),b.bindFramebuffer(H.DRAW_FRAMEBUFFER,Z);for(let He=0;He<$t;He++)li?H.framebufferTextureLayer(H.READ_FRAMEBUFFER,H.COLOR_ATTACHMENT0,sn.__webglTexture,rt,Me+He):H.framebufferTexture2D(H.READ_FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_2D,sn.__webglTexture,rt),We?H.framebufferTextureLayer(H.DRAW_FRAMEBUFFER,H.COLOR_ATTACHMENT0,Bi.__webglTexture,Gt,rn+He):H.framebufferTexture2D(H.DRAW_FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_2D,Bi.__webglTexture,Gt),rt!==0?H.blitFramebuffer(Qt,de,Zt,zt,oe,Pe,Zt,zt,H.COLOR_BUFFER_BIT,H.NEAREST):We?H.copyTexSubImage3D(qt,Gt,oe,Pe,rn+He,Qt,de,Zt,zt):H.copyTexSubImage2D(qt,Gt,oe,Pe,Qt,de,Zt,zt);b.bindFramebuffer(H.READ_FRAMEBUFFER,null),b.bindFramebuffer(H.DRAW_FRAMEBUFFER,null)}else We?R.isDataTexture||R.isData3DTexture?H.texSubImage3D(qt,Gt,oe,Pe,rn,Zt,zt,$t,Ve,ke,$e.data):Y.isCompressedArrayTexture?H.compressedTexSubImage3D(qt,Gt,oe,Pe,rn,Zt,zt,$t,Ve,$e.data):H.texSubImage3D(qt,Gt,oe,Pe,rn,Zt,zt,$t,Ve,ke,$e):R.isDataTexture?H.texSubImage2D(H.TEXTURE_2D,Gt,oe,Pe,Zt,zt,Ve,ke,$e.data):R.isCompressedTexture?H.compressedTexSubImage2D(H.TEXTURE_2D,Gt,oe,Pe,$e.width,$e.height,Ve,$e.data):H.texSubImage2D(H.TEXTURE_2D,Gt,oe,Pe,Zt,zt,Ve,ke,$e);b.pixelStorei(H.UNPACK_ROW_LENGTH,In),b.pixelStorei(H.UNPACK_IMAGE_HEIGHT,Re),b.pixelStorei(H.UNPACK_SKIP_PIXELS,En),b.pixelStorei(H.UNPACK_SKIP_ROWS,oi),b.pixelStorei(H.UNPACK_SKIP_IMAGES,Pi),Gt===0&&Y.generateMipmaps&&H.generateMipmap(qt),b.unbindTexture()},this.initRenderTarget=function(R){$.get(R).__webglFramebuffer===void 0&&tt.setupRenderTarget(R)},this.initTexture=function(R){R.isCubeTexture?tt.setTextureCube(R,0):R.isData3DTexture?tt.setTexture3D(R,0):R.isDataArrayTexture||R.isCompressedArrayTexture?tt.setTexture2DArray(R,0):tt.setTexture2D(R,0),b.unbindTexture()},this.resetState=function(){F=0,V=0,et=null,b.reset(),Wt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return ra}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const n=this.getContext();n.drawingBufferColorSpace=Ne._getDrawingBufferColorSpace(t),n.unpackColorSpace=Ne._getUnpackColorSpace()}}const nf={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,fragmentShader:`
uniform float opacity;
uniform sampler2D tDiffuse;
varying vec2 vUv;
void main() {
vec4 texel = texture2D( tDiffuse, vUv );
gl_FragColor = opacity * texel;
}`};class jl{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}const sC=new Tf(-1,1,1,-1,0,1);class oC extends Dn{constructor(){super(),this.setAttribute("position",new Mn([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Mn([0,2,0,0,2,0],2))}}const lC=new oC;class AS{constructor(t){this._mesh=new ln(lC,t)}dispose(){this._mesh.geometry.dispose()}render(t){t.render(this._mesh,sC)}get material(){return this._mesh.material}set material(t){this._mesh.material=t}}class cC extends jl{constructor(t,n="tDiffuse"){super(),this.textureID=n,this.uniforms=null,this.material=null,t instanceof kn?(this.uniforms=t.uniforms,this.material=t):t&&(this.uniforms=gf.clone(t.uniforms),this.material=new kn({name:t.name!==void 0?t.name:"unspecified",defines:Object.assign({},t.defines),uniforms:this.uniforms,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader})),this._fsQuad=new AS(this.material)}render(t,n,a){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=a.texture),this._fsQuad.material=this.material,this.renderToScreen?(t.setRenderTarget(null),this._fsQuad.render(t)):(t.setRenderTarget(n),this.clear&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),this._fsQuad.render(t))}dispose(){this.material.dispose(),this._fsQuad.dispose()}}class dy extends jl{constructor(t,n){super(),this.scene=t,this.camera=n,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(t,n,a){const o=t.getContext(),c=t.state;c.buffers.color.setMask(!1),c.buffers.depth.setMask(!1),c.buffers.color.setLocked(!0),c.buffers.depth.setLocked(!0);let u,d;this.inverse?(u=0,d=1):(u=1,d=0),c.buffers.stencil.setTest(!0),c.buffers.stencil.setOp(o.REPLACE,o.REPLACE,o.REPLACE),c.buffers.stencil.setFunc(o.ALWAYS,u,4294967295),c.buffers.stencil.setClear(d),c.buffers.stencil.setLocked(!0),t.setRenderTarget(a),this.clear&&t.clear(),t.render(this.scene,this.camera),t.setRenderTarget(n),this.clear&&t.clear(),t.render(this.scene,this.camera),c.buffers.color.setLocked(!1),c.buffers.depth.setLocked(!1),c.buffers.color.setMask(!0),c.buffers.depth.setMask(!0),c.buffers.stencil.setLocked(!1),c.buffers.stencil.setFunc(o.EQUAL,1,4294967295),c.buffers.stencil.setOp(o.KEEP,o.KEEP,o.KEEP),c.buffers.stencil.setLocked(!0)}}class uC extends jl{constructor(){super(),this.needsSwap=!1}render(t){t.state.buffers.stencil.setLocked(!1),t.state.buffers.stencil.setTest(!1)}}class fC{constructor(t,n){if(this.renderer=t,this._pixelRatio=t.getPixelRatio(),n===void 0){const a=t.getSize(new fe);this._width=a.width,this._height=a.height,n=new ai(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Mi}),n.texture.name="EffectComposer.rt1"}else this._width=n.width,this._height=n.height;this.renderTarget1=n,this.renderTarget2=n.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new cC(nf),this.copyPass.material.blending=sa,this.timer=new oA}swapBuffers(){const t=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=t}addPass(t){this.passes.push(t),t.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(t,n){this.passes.splice(n,0,t),t.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(t){const n=this.passes.indexOf(t);n!==-1&&this.passes.splice(n,1)}isLastEnabledPass(t){for(let n=t+1;n<this.passes.length;n++)if(this.passes[n].enabled)return!1;return!0}render(t){this.timer.update(),t===void 0&&(t=this.timer.getDelta());const n=this.renderer.getRenderTarget();let a=!1;for(let o=0,c=this.passes.length;o<c;o++){const u=this.passes[o];if(u.enabled!==!1){if(u.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(o),u.render(this.renderer,this.writeBuffer,this.readBuffer,t,a),u.needsSwap){if(a){const d=this.renderer.getContext(),m=this.renderer.state.buffers.stencil;m.setFunc(d.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,t),m.setFunc(d.EQUAL,1,4294967295)}this.swapBuffers()}dy!==void 0&&(u instanceof dy?a=!0:u instanceof uC&&(a=!1))}}this.renderer.setRenderTarget(n)}reset(t){if(t===void 0){const n=this.renderer.getSize(new fe);this._pixelRatio=this.renderer.getPixelRatio(),this._width=n.width,this._height=n.height,t=this.renderTarget1.clone(),t.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=t,this.renderTarget2=t.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(t,n){this._width=t,this._height=n;const a=this._width*this._pixelRatio,o=this._height*this._pixelRatio;this.renderTarget1.setSize(a,o),this.renderTarget2.setSize(a,o);for(let c=0;c<this.passes.length;c++)this.passes[c].setSize(a,o)}setPixelRatio(t){this._pixelRatio=t,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}class hC extends jl{constructor(t,n,a=null,o=null,c=null){super(),this.scene=t,this.camera=n,this.overrideMaterial=a,this.clearColor=o,this.clearAlpha=c,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.isRenderPass=!0,this._oldClearColor=new ce}render(t,n,a){const o=t.autoClear;t.autoClear=!1;let c,u;this.overrideMaterial!==null&&(u=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor!==null&&(t.getClearColor(this._oldClearColor),t.setClearColor(this.clearColor,t.getClearAlpha())),this.clearAlpha!==null&&(c=t.getClearAlpha(),t.setClearAlpha(this.clearAlpha)),this.clearDepth==!0&&t.clearDepth(),t.setRenderTarget(this.renderToScreen?null:a),this.clear===!0&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),t.render(this.scene,this.camera),this.clearColor!==null&&t.setClearColor(this._oldClearColor),this.clearAlpha!==null&&t.setClearAlpha(c),this.overrideMaterial!==null&&(this.scene.overrideMaterial=u),t.autoClear=o}}const dC={uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new ce(0)},defaultOpacity:{value:0}},vertexShader:`
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,fragmentShader:`
uniform sampler2D tDiffuse;
uniform vec3 defaultColor;
uniform float defaultOpacity;
uniform float luminosityThreshold;
uniform float smoothWidth;
varying vec2 vUv;
void main() {
vec4 texel = texture2D( tDiffuse, vUv );
float v = luminance( texel.xyz );
vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );
float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );
gl_FragColor = mix( outputColor, texel, alpha );
}`};class Ro extends jl{constructor(t,n=1,a,o){super(),this.strength=n,this.radius=a,this.threshold=o,this.resolution=t!==void 0?new fe(t.x,t.y):new fe(256,256),this.clearColor=new ce(0,0,0),this.needsSwap=!1,this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let c=Math.round(this.resolution.x/2),u=Math.round(this.resolution.y/2);this.renderTargetBright=new ai(c,u,{type:Mi}),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let _=0;_<this.nMips;_++){const v=new ai(c,u,{type:Mi});v.texture.name="UnrealBloomPass.h"+_,v.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(v);const g=new ai(c,u,{type:Mi});g.texture.name="UnrealBloomPass.v"+_,g.texture.generateMipmaps=!1,this.renderTargetsVertical.push(g),c=Math.round(c/2),u=Math.round(u/2)}const d=dC;this.highPassUniforms=gf.clone(d.uniforms),this.highPassUniforms.luminosityThreshold.value=o,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new kn({uniforms:this.highPassUniforms,vertexShader:d.vertexShader,fragmentShader:d.fragmentShader}),this.separableBlurMaterials=[];const m=[6,10,14,18,22];c=Math.round(this.resolution.x/2),u=Math.round(this.resolution.y/2);for(let _=0;_<this.nMips;_++)this.separableBlurMaterials.push(this._getSeparableBlurMaterial(m[_])),this.separableBlurMaterials[_].uniforms.invSize.value=new fe(1/c,1/u),c=Math.round(c/2),u=Math.round(u/2);this.compositeMaterial=this._getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=n,this.compositeMaterial.uniforms.bloomRadius.value=.1;const p=[1,.8,.6,.4,.2];this.compositeMaterial.uniforms.bloomFactors.value=p,this.bloomTintColors=[new z(1,1,1),new z(1,1,1),new z(1,1,1),new z(1,1,1),new z(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,this.copyUniforms=gf.clone(nf.uniforms),this.blendMaterial=new kn({uniforms:this.copyUniforms,vertexShader:nf.vertexShader,fragmentShader:nf.fragmentShader,premultipliedAlpha:!0,blending:Ar,depthTest:!1,depthWrite:!1,transparent:!0}),this._oldClearColor=new ce,this._oldClearAlpha=1,this._basic=new bf,this._fsQuad=new AS(null)}dispose(){for(let t=0;t<this.renderTargetsHorizontal.length;t++)this.renderTargetsHorizontal[t].dispose();for(let t=0;t<this.renderTargetsVertical.length;t++)this.renderTargetsVertical[t].dispose();this.renderTargetBright.dispose();for(let t=0;t<this.separableBlurMaterials.length;t++)this.separableBlurMaterials[t].dispose();this.compositeMaterial.dispose(),this.blendMaterial.dispose(),this._basic.dispose(),this._fsQuad.dispose()}setSize(t,n){let a=Math.round(t/2),o=Math.round(n/2);this.renderTargetBright.setSize(a,o);for(let c=0;c<this.nMips;c++)this.renderTargetsHorizontal[c].setSize(a,o),this.renderTargetsVertical[c].setSize(a,o),this.separableBlurMaterials[c].uniforms.invSize.value=new fe(1/a,1/o),a=Math.round(a/2),o=Math.round(o/2)}render(t,n,a,o,c){t.getClearColor(this._oldClearColor),this._oldClearAlpha=t.getClearAlpha();const u=t.autoClear;t.autoClear=!1,t.setClearColor(this.clearColor,0),c&&t.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this._fsQuad.material=this._basic,this._basic.map=a.texture,t.setRenderTarget(null),t.clear(),this._fsQuad.render(t)),this.highPassUniforms.tDiffuse.value=a.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this._fsQuad.material=this.materialHighPassFilter,t.setRenderTarget(this.renderTargetBright),t.clear(),this._fsQuad.render(t);let d=this.renderTargetBright;for(let m=0;m<this.nMips;m++)this._fsQuad.material=this.separableBlurMaterials[m],this.separableBlurMaterials[m].uniforms.colorTexture.value=d.texture,this.separableBlurMaterials[m].uniforms.direction.value=Ro.BlurDirectionX,t.setRenderTarget(this.renderTargetsHorizontal[m]),t.clear(),this._fsQuad.render(t),this.separableBlurMaterials[m].uniforms.colorTexture.value=this.renderTargetsHorizontal[m].texture,this.separableBlurMaterials[m].uniforms.direction.value=Ro.BlurDirectionY,t.setRenderTarget(this.renderTargetsVertical[m]),t.clear(),this._fsQuad.render(t),d=this.renderTargetsVertical[m];this._fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,t.setRenderTarget(this.renderTargetsHorizontal[0]),t.clear(),this._fsQuad.render(t),this._fsQuad.material=this.blendMaterial,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,c&&t.state.buffers.stencil.setTest(!0),this.renderToScreen?(t.setRenderTarget(null),this._fsQuad.render(t)):(t.setRenderTarget(a),this._fsQuad.render(t)),t.setClearColor(this._oldClearColor,this._oldClearAlpha),t.autoClear=u}_getSeparableBlurMaterial(t){const n=[],a=t/3;for(let o=0;o<t;o++)n.push(.39894*Math.exp(-.5*o*o/(a*a))/a);return new kn({defines:{KERNEL_RADIUS:t},uniforms:{colorTexture:{value:null},invSize:{value:new fe(.5,.5)},direction:{value:new fe(.5,.5)},gaussianCoefficients:{value:n}},vertexShader:`
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,fragmentShader:`
#include <common>
varying vec2 vUv;
uniform sampler2D colorTexture;
uniform vec2 invSize;
uniform vec2 direction;
uniform float gaussianCoefficients[KERNEL_RADIUS];
void main() {
float weightSum = gaussianCoefficients[0];
vec3 diffuseSum = texture2D( colorTexture, vUv ).rgb * weightSum;
for ( int i = 1; i < KERNEL_RADIUS; i ++ ) {
float x = float( i );
float w = gaussianCoefficients[i];
vec2 uvOffset = direction * invSize * x;
vec3 sample1 = texture2D( colorTexture, vUv + uvOffset ).rgb;
vec3 sample2 = texture2D( colorTexture, vUv - uvOffset ).rgb;
diffuseSum += ( sample1 + sample2 ) * w;
}
gl_FragColor = vec4( diffuseSum, 1.0 );
}`})}_getCompositeMaterial(t){return new kn({defines:{NUM_MIPS:t},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:`
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,fragmentShader:`
varying vec2 vUv;
uniform sampler2D blurTexture1;
uniform sampler2D blurTexture2;
uniform sampler2D blurTexture3;
uniform sampler2D blurTexture4;
uniform sampler2D blurTexture5;
uniform float bloomStrength;
uniform float bloomRadius;
uniform float bloomFactors[NUM_MIPS];
uniform vec3 bloomTintColors[NUM_MIPS];
float lerpBloomFactor( const in float factor ) {
float mirrorFactor = 1.2 - factor;
return mix( factor, mirrorFactor, bloomRadius );
}
void main() {
// 3.0 for backwards compatibility with previous alpha-based intensity
vec3 bloom = 3.0 * bloomStrength * (
lerpBloomFactor( bloomFactors[ 0 ] ) * bloomTintColors[ 0 ] * texture2D( blurTexture1, vUv ).rgb +
lerpBloomFactor( bloomFactors[ 1 ] ) * bloomTintColors[ 1 ] * texture2D( blurTexture2, vUv ).rgb +
lerpBloomFactor( bloomFactors[ 2 ] ) * bloomTintColors[ 2 ] * texture2D( blurTexture3, vUv ).rgb +
lerpBloomFactor( bloomFactors[ 3 ] ) * bloomTintColors[ 3 ] * texture2D( blurTexture4, vUv ).rgb +
lerpBloomFactor( bloomFactors[ 4 ] ) * bloomTintColors[ 4 ] * texture2D( blurTexture5, vUv ).rgb
);
float bloomAlpha = max( bloom.r, max( bloom.g, bloom.b ) );
gl_FragColor = vec4( bloom, bloomAlpha );
}`})}}Ro.BlurDirectionX=new fe(1,0);Ro.BlurDirectionY=new fe(0,1);const je={space:"#04060E",moonLit:"#5D6F8C",fracture:"#212B3D",fog:"#0E1826",relic:"#7FE7FF",dawn:"#F0C06A",nebulaTeal:"#1E8C96",nebulaViolet:"#5B4396",moonHi:"#7E8FAA",gapGlow:"#4FD8F0"},Bl=10,ni=new z(.55,-.35,.75).normalize(),py=new z(18,-12,25),_o=new z(34,10,-14),vo=new z(-26,14,-18),Xu=new z(-85,26,-29),my=r=>r<.5?4*r*r*r:1-Math.pow(-2*r+2,3)/2,gy=r=>1-Math.pow(1-r,1.8),is=r=>r,pC=r=>{if(r<.3)return .1*Math.pow(r/.3,2);const n=(r-.3)/(1-.3);return .1+.9*(1-Math.pow(1-n,3.2))},mC=r=>1-Math.pow(1-r,4),Ni=[{id:"W0",t0:0,t1:.12,type:"dwell",ease:is},{id:"W1",t0:.12,t1:.22,type:"dwell",ease:is},{id:"T1",t0:.22,t1:.32,type:"travel",ease:pC},{id:"W2",t0:.32,t1:.46,type:"dwell",ease:is},{id:"T2",t0:.46,t1:.54,type:"travel",ease:gy},{id:"W3",t0:.54,t1:.62,type:"dwell",ease:is},{id:"T3",t0:.62,t1:.7,type:"travel",ease:my,sway:!0},{id:"W4",t0:.7,t1:.8,type:"dwell",ease:is},{id:"T4",t0:.8,t1:.85,type:"travel",ease:gy},{id:"W5",t0:.85,t1:.868,type:"dwell",ease:is},{id:"T5",t0:.868,t1:.92,type:"travel",ease:my,sway:!0},{id:"W6",t0:.92,t1:.97,type:"dwell",ease:is},{id:"T6",t0:.97,t1:1,type:"travel",ease:mC}],us=[{t:0,pos:[-7,4,46],look:[-4,2,0]},{t:.22,pos:[-6.4,3.7,44.2],look:[-4,2,0]},{t:.27,pos:[10,7,37],look:[13,-5,24]},{t:.32,pos:[14.5,-6.2,25],look:[28.4,1.2,25]},{t:.46,pos:[14.6,-6.3,24.8],look:[28.4,1.2,25]},{t:.5,pos:[17,0,31],look:[8,-2,8]},{t:.54,pos:[13.5,3.2,34.6],look:[4,-3,5]},{t:.62,pos:[13.2,3.3,34.1],look:[4,-3,5]},{t:.66,pos:[24,9,12],look:[30,9,-6]},{t:.7,pos:[24.5,14.5,-2.5],look:[34,10,-14]},{t:.8,pos:[24.8,14.6,-2.9],look:[34,10,-14]},{t:.825,pos:[31,8,8],look:[10,0,0]},{t:.85,pos:[31.9,3.5,25.5],look:[4,-3,5]},{t:.89,pos:[6,14,6],look:[-12,12,-10]},{t:.92,pos:[-22.5,15.5,-4],look:[-26,14,-18]},{t:.97,pos:[-22.9,15.7,-4.3],look:[-26,14,-18]},{t:1,pos:[30,10,66],look:[-2,2,0]}],qu={W0:new z(-4,2,0),W1:new z(-4,2,0),W2:new z(28.4,1.2,25),W3:new z(4.5,-3,6),W4:new z(34,11,-14),W5:new z(-4,2,0),W6:new z(-26,15,-18),W7:new z(0,1,0)},gC={W0:["W0","W0"],W1:["W1","W1"],T1:["W1","W2"],W2:["W2","W2"],T2:["W2","W3"],W3:["W3","W3"],T3:["W3","W4"],W4:["W4","W4"],T4:["W4","W5"],W5:["W5","W5"],T5:["W5","W6"],W6:["W6","W6"],T6:["W6","W7"],W7:["W7","W7"]},Yi={W0:{hud:["OBSERVATION LOG — 07","TARGET: LUNA (FRACTURED)","DISTANCE: ——"]},W1:{glitch:"信 号 崩 溃 ",sub:"TRANSMISSION LOST — RETRYING…"},W2:{translation:"「天柱折,地维绝。」——此山名曰不周"},W3:{title:"它曾经是一座山。",sub:"FRACTURE ANALYSIS: IMPACT ORIGIN — EXOGENOUS"},W4:{note:"UNKNOWN ORIGIN — PREDATES IMPACT"},W6:{title:"传说与机器,刻着同一句话。",sub:"TRANSLATION CONVERGENCE: 100%"},W7:{title:"天亮了。",continue:"CONTINUE →"}},_y="█▓▒░▚▞▌▐◼◻╳口#*¥§ΞΨΩ∴∵",_C=.915;class vC{state;segListeners=new Set;frameListeners=new Set;lastSegId="";glitchStart=-1;sunriseStart=-1;constructor(){const t=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,n=typeof window<"u"&&(window.matchMedia("(pointer: coarse)").matches||window.innerWidth<768);this.state={raw:0,smooth:0,content:0,seg:Ni[0],segT:0,reduced:t,isMobile:n,pointer:{x:0,y:0},pointerDamped:{x:0,y:0},pointerActive:0,anchors:{},glitchClock:-1,glitchActive:!1,sunrise:0},window.addEventListener("scroll",this.onScroll,{passive:!0}),window.addEventListener("pointermove",this.onPointer,{passive:!0}),this.onScroll()}onScroll=()=>{const t=document.documentElement.scrollHeight-window.innerHeight;this.state.raw=t>0?Math.min(1,Math.max(0,window.scrollY/t)):0};onPointer=t=>{if(this.state.isMobile||this.state.reduced)return;const n=t.clientX/window.innerWidth*2-1,a=t.clientY/window.innerHeight*2-1,o=c=>Math.abs(c)<.05?0:c;this.state.pointer.x=o(n),this.state.pointer.y=o(a)};onSegmentChange(t){return this.segListeners.add(t),()=>{this.segListeners.delete(t)}}onFrame(t){return this.frameListeners.add(t),()=>{this.frameListeners.delete(t)}}update(t,n){const a=this.state,o=a.reduced?1:1-Math.pow(1-.08,t*60);a.smooth+=(a.raw-a.smooth)*o,Math.abs(a.raw-a.smooth)<4e-4&&(a.smooth=a.raw),a.content=Math.min(1,a.smooth/_C);let c=Ni[Ni.length-1];for(const m of Ni)if(a.content>=m.t0&&a.content<=m.t1){c=m;break}a.content>=1&&(c={...Ni[Ni.length-1],id:"W7",type:"dwell"}),a.seg=c,a.segT=c.t1>c.t0?(a.content-c.t0)/(c.t1-c.t0):1,a.segT=Math.min(1,Math.max(0,a.segT)),c.id!==this.lastSegId&&(this.lastSegId=c.id,this.segListeners.forEach(m=>m(c)),c.id==="W1"&&this.glitchStart<0&&!a.reduced&&(this.glitchStart=n),c.id==="W7"&&this.sunriseStart<0&&(this.sunriseStart=n)),c.id!=="W1"&&this.glitchStart>=0&&(this.glitchStart=-1),this.glitchStart>=0?(a.glitchClock=n-this.glitchStart,a.glitchActive=a.glitchClock<3):(a.glitchClock=-1,a.glitchActive=!1);let u=0;if(a.content>.97&&(u=(a.content-.97)/.03*.3),this.sunriseStart>=0){const m=n-this.sunriseStart,p=.3+.7*(1-Math.pow(1-Math.min(1,m/9),2.2));u=Math.max(u,p)}a.reduced&&a.content>=1&&(u=1),a.sunrise=Math.min(1,u);const d=1-Math.pow(1-.03,t*60);a.pointerDamped.x+=(a.pointer.x-a.pointerDamped.x)*d,a.pointerDamped.y+=(a.pointer.y-a.pointerDamped.y)*d,a.pointerActive=Math.min(1,a.pointerActive+t/.5),this.frameListeners.forEach(m=>m(t,n))}}const Wn=new vC;function Sm(r,t,n){const a=Math.sin(r*127.1+t*311.7+n*74.7)*43758.5453;return a-Math.floor(a)}function RS(r,t,n){const a=Math.floor(r),o=Math.floor(t),c=Math.floor(n),u=r-a,d=t-o,m=n-c,p=u*u*(3-2*u),_=d*d*(3-2*d),v=m*m*(3-2*m);let g=0;for(let y=0;y<8;y++){const E=y&1,A=y>>1&1,x=y>>2&1,S=Sm(a+E,o+A,c+x);g+=S*(E?p:1-p)*(A?_:1-_)*(x?v:1-v)}return g}function na(r,t,n,a=3){let o=0,c=.5,u=1;for(let d=0;d<a;d++)o+=RS(r*u,t*u,n*u)*c,c*=.5,u*=2.1;return o}function as(r,t,n,a=3){let o=0,c=.55,u=1;for(let d=0;d<a;d++){const m=RS(r*u,t*u,n*u);o+=(1-Math.abs(2*m-1))*c,c*=.5,u*=2.3}return o}function rs(r){return()=>{r|=0,r=r+1831565813|0;let t=Math.imul(r^r>>>15,1|r);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}const Pa=(r,t,n)=>{const a=Math.min(1,Math.max(0,(n-r)/(t-r)));return a*a*(3-2*a)},xC=r=>r*r*(3-2*r),vy=us.length,_f=new ZT(us.map(r=>new z(...r.pos)),!1,"centripetal");function xy(r){if(r<=us[0].t)return 0;for(let t=0;t<vy-1;t++)if(r<=us[t+1].t){const n=(r-us[t].t)/(us[t+1].t-us[t].t||1);return(t+n)/(vy-1)}return 1}const Lr=1600,Ga=new Float32Array(Lr+1);{let r=_f.getPoint(0);for(let t=1;t<=Lr;t++){const n=_f.getPoint(t/Lr);Ga[t]=Ga[t-1]+n.distanceTo(r),r=n}}const wS=Ga[Lr];function yy(r){const t=Math.min(1,Math.max(0,r))*Lr,n=Math.min(Lr-1,Math.floor(t)),a=t-n;return(Ga[n]+(Ga[n+1]-Ga[n])*a)/wS}function yC(r){const t=Math.min(1,Math.max(0,r))*wS;let n=0,a=Lr;for(;n<a;){const m=n+a>>1;Ga[m]<t?n=m+1:a=m}const o=Math.max(1,n),c=Ga[o-1],u=Ga[o],d=u>c?(t-c)/(u-c):0;return(o-1+d)/Lr}const Mm=Ni.map(r=>({a0:yy(xy(r.t0)),a1:yy(xy(r.t1))})),Em=Ni.map((r,t)=>(Mm[t].a1-Mm[t].a0)/(r.t1-r.t0||1)),bm=new Array(Ni.length+1).fill(0);for(let r=1;r<Ni.length;r++){const t=Em[r-1],n=Em[r];bm[r]=t+n>1e-8?2*t*n/(t+n):0}function SC(r){if(r<=0)return 0;if(r>=1)return 1;for(let t=0;t<Ni.length;t++){const n=Ni[t];if(r>=n.t0&&r<=n.t1){const a=Math.min(1,Math.max(0,(r-n.t0)/(n.t1-n.t0||1))),{a0:o,a1:c}=Mm[t],u=c-o,d=Em[t];let m=Math.abs(d)>1e-8?bm[t]/d:0,p=Math.abs(d)>1e-8?bm[t+1]/d:0;m=Math.max(0,m),p=Math.max(0,p);const _=m+p;if(_>2.9){const E=2.9/_;m*=E,p*=E}const v=a*a,g=v*a,y=(g-2*v+a)*m+(-2*g+3*v)+(g-v)*p;return o+u*y}}return 1}function Ba(r,t=!1){return new vm({color:r,roughness:.94,metalness:.05,flatShading:!1,vertexColors:t})}function Il(r,t){const n=document.createElement("canvas");n.width=n.height=256;const a=n.getContext("2d"),o=a.createRadialGradient(128,128,0,128,128,128);return o.addColorStop(0,r),o.addColorStop(.35,t),o.addColorStop(1,"rgba(0,0,0,0)"),a.fillStyle=o,a.fillRect(0,0,256,256),new dS(n)}function ss(r,t){const n=new ce(r);return`rgba(${Math.round(n.r*255)},${Math.round(n.g*255)},${Math.round(n.b*255)},${t})`}function MC(){const r=document.createElement("canvas");r.width=256,r.height=64;const t=r.getContext("2d"),n=t.createLinearGradient(0,0,256,0);n.addColorStop(0,"rgba(240,192,106,0)"),n.addColorStop(.25,"rgba(240,192,106,0.55)"),n.addColorStop(.75,"rgba(240,192,106,0.38)"),n.addColorStop(1,"rgba(240,192,106,0)"),t.fillStyle=n,t.fillRect(0,0,256,64);const a=t.getImageData(0,0,256,64);for(let o=0;o<64;o++){const c=1-Math.abs(o-32)/32;for(let u=0;u<256;u++)a.data[(o*256+u)*4+3]*=c*c}return t.putImageData(a,0,0),new dS(r)}function EC(r){const t=new rC({canvas:r,antialias:!0,powerPreference:"high-performance"});t.setPixelRatio(Math.min(window.devicePixelRatio,1.5)),t.setSize(window.innerWidth,window.innerHeight),t.toneMapping=Pm,t.toneMappingExposure=1.15;const n=new UT;n.background=new ce(je.space),n.fog=new Ym(je.fog,.008);const a=new xi(45,window.innerWidth/window.innerHeight,.1,600);a.position.set(-7,4,46),a.lookAt(qu.W0),n.add(new aA(3031128,.85));const o=new Vu(14479093,1.9);o.position.set(30,25,40),n.add(o);const c=new Vu(8382463,1.8);c.position.set(-25,-8,-45),n.add(c);const u=new Vu(5981078,.7);u.position.set(25,-35,-15),n.add(u);const d=new Vu(je.dawn,0);d.position.copy(Xu),n.add(d);const m=new nA(14216436,10,40,1.6);m.position.set(24,-8,31),n.add(m);function p(kt,Mt,gt,Ut,Rt,Jt){const jt=new Float32Array(kt*3),ee=new Float32Array(kt*3),ne=rs(Jt),le=new ce("#EAF6FB"),ve=new ce("#9FD8E8"),H=new ce("#F0DFC0");for(let L=0;L<kt;L++){const b=Mt+ne()*(gt-Mt),K=ne()*Math.PI*2,$=Math.acos(2*ne()-1);jt[L*3]=b*Math.sin($)*Math.cos(K),jt[L*3+1]=b*Math.cos($)*.6,jt[L*3+2]=b*Math.sin($)*Math.sin(K);const tt=ne(),wt=tt<.68?le:tt<.88?ve:H,Ct=.45+ne()*.55;ee[L*3]=wt.r*Ct,ee[L*3+1]=wt.g*Ct,ee[L*3+2]=wt.b*Ct}const Ft=new Dn;Ft.setAttribute("position",new Vn(jt,3)),Ft.setAttribute("color",new Vn(ee,3));const ie=new gm({size:Ut,sizeAttenuation:!1,vertexColors:!0,transparent:!0,opacity:Rt,fog:!1,depthWrite:!1});n.add(new Nx(Ft,ie))}p(1700,240,420,1,.7,7),p(260,170,260,1.9,.95,8);{const kt=Il(ss(je.nebulaTeal,.5),ss(je.nebulaTeal,.14)),Mt=Il(ss(je.nebulaViolet,.5),ss(je.nebulaViolet,.13)),gt=Il("rgba(58,92,150,0.45)","rgba(58,92,150,0.12)"),Ut=[kt,Mt,gt],Rt=rs(11);for(let Jt=0;Jt<7;Jt++){const jt=new op(new tf({map:Ut[Jt%3],transparent:!0,opacity:.3+Rt()*.14,depthWrite:!1,fog:!1,blending:Ar})),ee=Rt()*Math.PI*2;jt.position.set(Math.cos(ee)*(140+Rt()*160),(Rt()-.5)*180,Math.sin(ee)*(140+Rt()*160)-60),jt.scale.setScalar(150+Rt()*190),n.add(jt)}}const _=new wr;{const kt=new Ia(Bl,48),Mt=kt.attributes.position,gt=new Float32Array(Mt.count*3),Ut=new ce(je.moonLit),Rt=new ce(je.moonHi),Jt=new ce("#39445A"),jt=new ce(je.fracture),ee=new ce(je.gapGlow),ne=new z,le=Math.cos(.72),ve=[];{const H=rs(97);for(let Ft=0;Ft<18;Ft++){const ie=new z(H()*2-1,H()*2-1,H()*2-1);ie.lengthSq()<1e-4||(ie.normalize(),!(ie.dot(ni)>.1)&&ve.push({dir:ie,r:.1+H()*.22,depth:.22+H()*.5}))}}for(let H=0;H<Mt.count;H++){ne.fromBufferAttribute(Mt,H);const Ft=ne.clone().normalize(),ie=na(Ft.x*1.6+9,Ft.y*1.6,Ft.z*1.6,4),L=as(Ft.x*3.4+21,Ft.y*3.4,Ft.z*3.4,4);let b=Bl+(ie-.5)*1.5+(L-.55)*.8+(na(Ft.x*9+33,Ft.y*9,Ft.z*9)-.5)*.22;for(const wt of ve){const Ct=Ft.distanceTo(wt.dir);if(Ct<wt.r*1.6){const ct=Ct<wt.r?Math.cos(Math.PI*Ct/wt.r)*.5+.5:0,ft=(Ct-wt.r)/(wt.r*.3),Dt=Math.exp(-ft*ft)*.4;b+=-wt.depth*ct+wt.depth*Dt}}const K=Ft.dot(ni);let $=0;if(K>le){$=Pa(le,1,K);const wt=(as(Ft.x*6+40,Ft.y*6,Ft.z*6)-.5)*2.6;b-=$*(7.4+wt)}ne.copy(Ft).multiplyScalar(b),Mt.setXYZ(H,ne.x,ne.y,ne.z);let tt;$>.02?(tt=jt.clone().lerp(Ut,Math.max(0,.22-$*.22)),tt.lerp(ee,Math.max(0,$-.55)*.35)):(tt=Ut.clone(),tt.lerp(Jt,Pa(.5,.28,ie)*.7),tt.lerp(Rt,Pa(.55,.8,L)*.55),tt.multiplyScalar(.82+na(Ft.x*4,Ft.y*4+3,Ft.z*4)*.36)),gt[H*3]=tt.r,gt[H*3+1]=tt.g,gt[H*3+2]=tt.b}kt.setAttribute("color",new Vn(gt,3)),kt.computeVertexNormals(),_.add(new ln(kt,Ba("#ffffff",!0)))}{const kt=Math.sin(.72)*Bl*.96,Mt=ni.clone().multiplyScalar(Bl-5.6),gt=new z(0,1,0).cross(ni).normalize(),Ut=ni.clone().cross(gt).normalize(),Rt=52,Jt=Ba(je.fracture);Jt.emissive=new ce(je.gapGlow),Jt.emissiveIntensity=.08;const jt=new hp(new $m(.85),Jt,Rt),ee=rs(23),ne=new ze,le=new vi,ve=new ua;for(let H=0;H<Rt;H++){const Ft=H/Rt*Math.PI*2,ie=kt*(.9+ee()*.25),L=Mt.clone().addScaledVector(gt,Math.cos(Ft)*ie).addScaledVector(Ut,Math.sin(Ft)*ie).addScaledVector(ni,(ee()-.5)*1.6);ve.set(ee()*Math.PI,ee()*Math.PI,ee()*Math.PI),le.setFromEuler(ve),ne.compose(L,le,new z().setScalar(.5+ee()*1.1)),jt.setMatrixAt(H,ne)}_.add(jt)}{const kt=new op(new tf({map:Il(ss(je.gapGlow,.85),ss(je.gapGlow,.22)),transparent:!0,opacity:.3,depthWrite:!1,blending:Ar}));kt.position.copy(ni).multiplyScalar(Bl-3.2),kt.scale.setScalar(15),_.add(kt)}let v;{const Mt=new Float32Array(720),gt=rs(31),Ut=new z(0,1,0).cross(ni).normalize(),Rt=ni.clone().cross(Ut).normalize();for(let jt=0;jt<240;jt++){const ee=gt()*4.5,ne=gt()*Math.PI*2,le=ni.clone().multiplyScalar(4+gt()*5).addScaledVector(Ut,Math.cos(ne)*ee).addScaledVector(Rt,Math.sin(ne)*ee);Mt[jt*3]=le.x,Mt[jt*3+1]=le.y,Mt[jt*3+2]=le.z}const Jt=new Dn;Jt.setAttribute("position",new Vn(Mt,3)),v=new Nx(Jt,new gm({color:je.gapGlow,size:.14,transparent:!0,opacity:.65,blending:Ar,depthWrite:!1})),_.add(v)}n.add(_);const g={value:0};{const Mt=new Ia(1,1),gt=Ba("#ffffff");gt.flatShading=!0,gt.onBeforeCompile=tt=>{tt.uniforms.uTime=g,tt.vertexShader=`
uniform float uTime;
attribute vec3 aAxis; attribute float aRotP;
attribute float aBobA; attribute float aBobP;
attribute float aPhase; attribute vec3 aDrift;
`+tt.vertexShader.replace("#include <beginnormal_vertex>",`
#include <beginnormal_vertex>
{
float ang = uTime / aRotP * 6.2831853 + aPhase;
vec3 ax = normalize(aAxis);
float ca = cos(ang), sa = sin(ang);
objectNormal = objectNormal * ca + cross(ax, objectNormal) * sa
+ ax * dot(ax, objectNormal) * (1.0 - ca);
}
`).replace("#include <begin_vertex>",`
#include <begin_vertex>
{
float ang = uTime / aRotP * 6.2831853 + aPhase;
vec3 ax = normalize(aAxis);
float ca = cos(ang), sa = sin(ang);
transformed = transformed * ca + cross(ax, transformed) * sa
+ ax * dot(ax, transformed) * (1.0 - ca);
transformed.y += sin(uTime / aBobP * 6.2831853 + aPhase) * aBobA;
transformed += aDrift * sin(uTime * 0.04 + aPhase * 1.7);
}
`)};const Ut=new hp(Mt,gt,64),Rt=rs(47),Jt=new z(0,1,0).cross(ni).normalize(),jt=ni.clone().cross(Jt).normalize(),ee=new ze,ne=new vi,le=new Float32Array(192),ve=new Float32Array(64),H=new Float32Array(64),Ft=new Float32Array(64),ie=new Float32Array(64),L=new Float32Array(192),b=new ce(je.moonLit),K=new ce(je.fracture),$=new ce(je.gapGlow);for(let tt=0;tt<64;tt++){const wt=14+Math.pow(Rt(),1.4)*70,Ct=3+wt*.35;let ct=ni.clone().multiplyScalar(wt).addScaledVector(Jt,(Rt()-.5)*Ct).addScaledVector(jt,(Rt()-.5)*Ct);ct.distanceTo(new z(16,-4,25))<10&&(ct=ct.add(new z(0,12,-6)));const ft=.35+Rt()*Rt()*2;ne.identity(),ee.compose(ct,ne,new z(ft,ft*(.7+Rt()*.6),ft)),Ut.setMatrixAt(tt,ee);const Dt=Rt(),Xt=Dt<.62?b.clone().multiplyScalar(.7+Rt()*.5):Dt<.9?K.clone().multiplyScalar(.9+Rt()*.4):K.clone().lerp($,.45);Ut.setColorAt(tt,Xt);const Bt=new z(Rt()-.5,Rt()-.5,Rt()-.5).normalize();le[tt*3]=Bt.x,le[tt*3+1]=Bt.y,le[tt*3+2]=Bt.z,ve[tt]=20+Rt()*20,H[tt]=ft*(.02+Rt()*.03),Ft[tt]=20+Rt()*20,ie[tt]=Rt()*Math.PI*2;const Ot=ni.clone().multiplyScalar(.5+Rt()*1.5);L[tt*3]=Ot.x,L[tt*3+1]=Ot.y,L[tt*3+2]=Ot.z}Ut.instanceColor&&(Ut.instanceColor.needsUpdate=!0),Mt.setAttribute("aAxis",new Tr(le,3)),Mt.setAttribute("aRotP",new Tr(ve,1)),Mt.setAttribute("aBobA",new Tr(H,1)),Mt.setAttribute("aBobP",new Tr(Ft,1)),Mt.setAttribute("aPhase",new Tr(ie,1)),Mt.setAttribute("aDrift",new Tr(L,3)),n.add(Ut)}const y=new wr;{const kt=new Ia(4.5,20),Mt=kt.attributes.position,gt=new z;for(let Ut=0;Ut<Mt.count;Ut++){gt.fromBufferAttribute(Mt,Ut);const Rt=gt.clone().normalize(),Jt=4.5+(na(Rt.x*3+60,Rt.y*3,Rt.z*3)-.5)*1.6+(as(Rt.x*5+61,Rt.y*5,Rt.z*5)-.55)*.7;Mt.setXYZ(Ut,Rt.x*Jt,Rt.y*Jt,Rt.z*Jt)}kt.computeVertexNormals(),y.add(new ln(kt,Ba(je.moonLit))),y.position.copy(py),n.add(y)}let E,A,x;{const kt=new ds(90,90,110,110);kt.rotateX(-Math.PI/2);const Mt=kt.attributes.position;for(let gt=0;gt<Mt.count;gt++){const Ut=Mt.getX(gt),Rt=Mt.getZ(gt),Jt=(na(Ut*.12+80,0,Rt*.12,4)-.5)*3.2+(as(Ut*.3+100,0,Rt*.3,3)-.55)*1.4+(na(Ut*.8+120,0,Rt*.8,3)-.5)*.7;Mt.setY(gt,Jt)}kt.computeVertexNormals(),E=new ln(kt,Ba("#46566C")),E.position.set(30,-8.3,25),E.visible=!1,n.add(E)}let S;{const kt=new ds(34,13,90,40),Mt=kt.attributes.position;for(let gt=0;gt<Mt.count;gt++){const Ut=Mt.getX(gt),Rt=Mt.getY(gt),Jt=Pa(3.5,8,Math.abs(Ut))*Pa(1.8,4.5,Math.abs(Rt)),jt=(na(Ut*.3+200,Rt*.3,0,4)-.5)*2.9*(.3+.7*Jt)+(as(Ut*.5+210,Rt*.5,0,3)-.55)*1.2*Jt+(as(Ut*1.6+230,Rt*1.6,0,2)-.55)*.65+(na(Ut*3.2+250,Rt*3.2,0,2)-.5)*.3;Mt.setZ(gt,jt)}kt.computeVertexNormals(),A=new ln(kt,Ba("#4E6178")),A.rotation.y=-Math.PI/2,A.position.set(28.6,.8,25),A.visible=!1,n.add(A),S=new hn,S.position.set(28.2,.2,25),n.add(S)}{const kt=Wn.state.isMobile?90:200;x=new hp(new Qm(.14),Ba(je.moonLit),kt);const Mt=rs(71),gt=new ze,Ut=new vi,Rt=new ua;for(let Jt=0;Jt<kt;Jt++){const jt=Mt()*Math.PI*2,ee=1+Mt()*16,ne=new z(20+Math.cos(jt)*ee,-8.05,25+Math.sin(jt)*ee*.8);Rt.set(Mt()*3,Mt()*3,Mt()*3),Ut.setFromEuler(Rt),gt.compose(ne,Ut,new z().setScalar(.4+Mt()*1.6)),x.setMatrixAt(Jt,gt)}x.visible=!1,n.add(x)}const D=new wr;let U,w;{const kt=new ln((()=>{const Jt=new Ia(3.5,16),jt=Jt.attributes.position,ee=new z;for(let ne=0;ne<jt.count;ne++){ee.fromBufferAttribute(jt,ne);const le=ee.clone().normalize(),ve=3.5+(na(le.x*3+90,le.y*3,le.z*3)-.5)*1.2+(as(le.x*5+91,le.y*5,le.z*5)-.55)*.5;jt.setXYZ(ne,le.x*ve,le.y*ve,le.z*ve)}return Jt.computeVertexNormals(),Jt})(),Ba(je.moonLit));D.add(kt),U=new vm({color:2831940,roughness:.28,metalness:.92,emissive:new ce(je.relic),emissiveIntensity:0});const Mt=new z(24.5-_o.x,14.5-_o.y,-2.5-_o.z).normalize(),gt=new vi().setFromUnitVectors(new z(0,0,1),Mt),Ut=new ln(new mf(1.7,.2,12,56,Math.PI*1.6),U);Ut.quaternion.copy(gt),Ut.rotateZ(Math.PI*.9),Ut.position.copy(Mt).multiplyScalar(3.3),D.add(Ut);const Rt=new ln(new Ia(.78,0),U);Rt.position.copy(Mt).multiplyScalar(4.2),D.add(Rt),w=new WT(new qT(new Ia(1.22,0)),new fS({color:je.relic,transparent:!0,opacity:0})),w.position.copy(Mt).multiplyScalar(4.2),D.add(w),D.position.copy(_o),n.add(D)}const B=new hn;B.position.copy(_o).add(new z(-2.4,3.4,3.2)),n.add(B);const N=new wr;let P;{const kt=new Ia(3.4,16),Mt=kt.attributes.position,gt=new z;for(let ee=0;ee<Mt.count;ee++){gt.fromBufferAttribute(Mt,ee);const ne=gt.clone().normalize(),ve=3.4+(ne.x<0?(na(ne.x*3+140,ne.y*3,ne.z*3)-.5)*1.3:.1)-(ne.x<0?0:.35);Mt.setXYZ(ee,ne.x*ve,ne.y*ve,ne.z*ve)}kt.computeVertexNormals();{const ee=Ba(je.moonLit);ee.flatShading=!0,N.add(new ln(kt,ee))}P=new vm({color:2831940,roughness:.28,metalness:.92,emissive:new ce(je.relic),emissiveIntensity:.05});const Ut=new z(-22.5-vo.x,15.5-vo.y,-4-vo.z).normalize(),Rt=new vi().setFromUnitVectors(new z(0,0,1),Ut),Jt=new ln(new mf(1.9,.16,8,40,Math.PI),P);Jt.quaternion.copy(Rt),Jt.rotateZ(Math.PI*.15),Jt.position.copy(Ut).multiplyScalar(2.6),N.add(Jt);const jt=new ln(new jm(.8,0),P);jt.position.copy(Ut).multiplyScalar(3.4).add(new z(0,.5,0)),N.add(jt),N.position.copy(vo),n.add(N)}const T=new hn;T.position.copy(vo).add(new z(1,1.4,4.2)),n.add(T);const O=new op(new tf({map:Il("rgba(255,246,220,1)",ss(je.dawn,.55)),transparent:!0,opacity:0,depthWrite:!1,fog:!1,blending:Ar}));O.scale.setScalar(34),n.add(O);const W=Xu.clone().add(new z(-26,18,0)),k=Wn.state.isMobile?3:5,Q=[];{const kt=MC(),Mt=Xu.clone().negate().normalize();for(let gt=0;gt<k;gt++){const Ut=new ln(new ds(180,5.5),new bf({map:kt,transparent:!0,opacity:0,fog:!1,blending:Ar,depthWrite:!1,side:aa,color:je.dawn}));Ut.quaternion.setFromUnitVectors(new z(1,0,0),Mt),Ut.rotateX(gt*1.1+.4);const Rt=new z((gt-k/2)*7,gt%2*6-3,gt*37%11-5);Ut.position.copy(Mt.clone().multiplyScalar(45)).add(Rt),Q.push(Ut),n.add(Ut)}}const dt=new fC(t);dt.addPass(new hC(n,a));const vt=new Ro(new fe(window.innerWidth,window.innerHeight),.45,.7,.78);dt.addPass(vt);const Z=new z,F=new z,V=new z,et=new z,mt=qu.W0.clone(),At=new z,I=new z,J=new vi,bt=new vi,Lt=new z(0,1,0),Ht=new z(1,0,0),st=new cA;let St=0,Et=.008;const Yt={W2:S,W4:B,W6:T};function ge(){St=requestAnimationFrame(ge);const kt=Math.min(.05,st.getDelta()),Mt=st.elapsedTime,gt=Wn.state;Wn.update(kt,Mt),g.value=Mt;const Ut=SC(gt.content),Rt=yC(Ut);_f.getPoint(Rt,Z),_f.getTangent(Rt,F);const Jt=gt.seg.type==="dwell";if(!gt.reduced){const H=Jt?.045:.015;if(Z.y+=Math.sin(Mt*(Math.PI*2/5.5))*H,Z.x+=Math.sin(Mt*(Math.PI*2/7.3)+1.7)*H*.6,gt.seg.sway){const Ft=Math.sin(gt.segT*Math.PI*2.2)*.7,ie=new z().subVectors(Z,mt).cross(Lt).normalize();Z.addScaledVector(ie,Ft)}if(gt.seg.id==="W1"&&gt.glitchClock>=0){const Ft=gt.glitchClock,ie=Ft<1.5?.14*(1-Ft/1.8):.02;Z.x+=(Sm(Math.floor(Mt*24),1,0)-.5)*ie,Z.y+=(Sm(Math.floor(Mt*24),2,0)-.5)*ie}}a.position.copy(Z);{const H=gC[gt.seg.id]||["W7","W7"];if(V.lerpVectors(qu[H[0]],qu[H[1]],xC(gt.segT)),gt.seg.type==="travel"){const ie=Math.sin(Math.PI*gt.segT)*.22;et.copy(Z).addScaledVector(F,9),V.lerp(et,ie)}const Ft=gt.reduced?1:1-Math.pow(1-.055,kt*60);mt.lerp(V,Ft),a.lookAt(mt)}if(!gt.reduced){_.rotation.y=Math.sin(Mt*(Math.PI*2/240))*.5,_.rotation.z=.04,v.rotation.z+=kt*.05;const H=Mt*(Math.PI*2/58);y.rotation.set(Math.sin(H*.45)*.1,Math.sin(H*.11)*.12,Math.sin(H/1.9)*.08),y.position.y=py.y+Math.sin(Mt*(Math.PI*2/47)+1.2)*.09;const Ft=Mt*(Math.PI*2/64);D.rotation.set(Math.sin(Ft*.4)*.1,Math.sin(Ft*.13)*.12,Math.sin(Ft/2.1)*.09),D.position.y=_o.y+Math.sin(Mt*(Math.PI*2/41)+3.1)*.08;const ie=Mt*(Math.PI*2/52);N.rotation.set(Math.sin(ie*.5)*.1,Math.sin(ie*.12)*.11,Math.sin(ie/1.7)*.08),N.position.y=vo.y+Math.sin(Mt*(Math.PI*2/44)+5)*.08}if(!gt.reduced&&!gt.isMobile){let H=Jt?1:.35;gt.seg.id==="W1"&&gt.glitchActive&&(H=.15),gt.seg.id==="W7"&&(H=.55),H*=gt.pointerActive;const Ft=-gt.pointerDamped.x*cx.degToRad(1.5)*H,ie=-gt.pointerDamped.y*cx.degToRad(.9)*H;J.setFromAxisAngle(Lt,Ft),bt.setFromAxisAngle(Ht,ie),a.quaternion.multiply(J).multiply(bt);const L=.55*H;At.setFromMatrixColumn(a.matrix,0),I.setFromMatrixColumn(a.matrix,1),a.position.addScaledVector(At,gt.pointerDamped.x*L),a.position.addScaledVector(I,-gt.pointerDamped.y*L)}const jt=gt.seg.id;Et=jt==="W2"?.017:jt==="W4"||jt==="W6"?.011:jt==="W7"?.006:.008;const ee=n.fog;ee.density+=(Et-ee.density)*Math.min(1,kt*2.5);const ne=gt.content>.24&&gt.content<.56;E.visible=ne,A.visible=ne,x.visible=gt.content>.28&&gt.content<.5;const le=jt==="W4"?Pa(.08,.55,gt.segT):jt==="T4"||jt==="W5"?1:0;U.emissiveIntensity=le*.3,w.material.opacity=le*.45,P.emissiveIntensity=.05+(jt==="W6"?Pa(.1,.6,gt.segT)*.8:0);const ve=gt.sunrise;O.position.lerpVectors(W,Xu,Pa(0,.5,ve)),O.material.opacity=Math.min(1,ve*1.6),d.intensity=ve*2.3;for(let H=0;H<Q.length;H++){const Ft=Pa(.3+H*.15,.3+H*.15+.12,ve);Q[H].material.opacity=Ft*.4}vt.strength=.45+ve*.55,vt.threshold=.78-ve*.14,t.toneMappingExposure=1.15+ve*.12;for(const[H,Ft]of Object.entries(Yt)){Z.setFromMatrixPosition(Ft.matrixWorld).project(a);const ie=Z.z>1;gt.anchors[H]={x:(Z.x*.5+.5)*window.innerWidth,y:(-Z.y*.5+.5)*window.innerHeight,visible:!ie&&gt.seg.id===H}}dt.render(),window.__dbg={content:gt.content.toFixed(3),seg:gt.seg.id,segT:gt.segT.toFixed(2),cam:a.position.toArray().map(H=>+H.toFixed(1)),look:mt.toArray().map(H=>+H.toFixed(1)),fps:(1/Math.max(kt,1e-4)).toFixed(1)}}ge();const se=()=>{a.aspect=window.innerWidth/window.innerHeight,a.updateProjectionMatrix(),t.setSize(window.innerWidth,window.innerHeight),dt.setSize(window.innerWidth,window.innerHeight)};return window.addEventListener("resize",se),()=>{cancelAnimationFrame(St),window.removeEventListener("resize",se),t.dispose()}}const bC=[{l:"12%",t:"22%",d:0},{l:"28%",t:"64%",d:1.7},{l:"45%",t:"15%",d:3.1},{l:"58%",t:"76%",d:.9},{l:"71%",t:"34%",d:2.4},{l:"84%",t:"58%",d:4.2},{l:"36%",t:"42%",d:5},{l:"66%",t:"8%",d:1.2}];function TC(){const r=ht.useRef(null),t=ht.useRef(null),n=ht.useRef(null);return ht.useEffect(()=>Wn.onFrame(()=>{const a=Wn.state,o=a.glitchClock;let c=.05;if(o>=0&&o<1.5?c=.3:o>=1.5&&o<3&&(c=.3-(o-1.5)/1.5*.22),t.current&&(t.current.style.opacity=String(c)),r.current)if(o>=0&&o<2.5&&!a.reduced){const u=Math.floor(o*9),d=u*2654435761%100/100-.5,m=u*1597334677%100/100-.5;r.current.style.transform=`translate(${(d*4).toFixed(1)}px, ${(m*4).toFixed(1)}px)`}else r.current.style.transform="";if(n.current&&!a.isMobile&&!a.reduced){const u=-a.pointerDamped.x*35*a.pointerActive,d=-a.pointerDamped.y*22*a.pointerActive;n.current.style.transform=`translate(${u.toFixed(1)}px, ${d.toFixed(1)}px)`}}),[]),It.jsxs("div",{"code-path":"src/components/VisorOverlay.tsx:49:5",ref:r,className:"fixed inset-0 z-20 pointer-events-none","aria-hidden":!0,children:[It.jsx("div",{"code-path":"src/components/VisorOverlay.tsx:51:7",className:"absolute inset-0",style:{background:"radial-gradient(ellipse 72% 62% at 50% 46%, transparent 58%, rgba(3,6,12,0.55) 100%)"}}),It.jsx("div",{"code-path":"src/components/VisorOverlay.tsx:59:7",ref:t,className:"absolute inset-0",style:{background:"repeating-linear-gradient(to bottom, rgba(207,232,240,0.1) 0px, rgba(207,232,240,0.1) 1px, transparent 1px, transparent 4px)",opacity:.05}}),It.jsx("div",{"code-path":"src/components/VisorOverlay.tsx:69:7",ref:n,className:"absolute inset-0",children:bC.map((a,o)=>It.jsx("span",{"code-path":"src/components/VisorOverlay.tsx:71:11",className:"absolute block rounded-full dust-drift",style:{left:a.l,top:a.t,width:2,height:2,background:"rgba(207,232,240,0.5)",animationDelay:`${a.d}s`}},o))})]})}class AC{enabled=!1;ctx=null;master=null;drone=null;listeners=new Set;toggle(){this.enabled=!this.enabled,this.enabled&&this.ensureCtx(),this.master&&(this.master.gain.value=this.enabled?1:0),this.listeners.forEach(t=>t(this.enabled)),this.enabled?Wn.state.seg.id==="W7"&&this.startDrone():this.stopDrone()}onChange(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}ensureCtx(){if(this.ctx){this.ctx.state==="suspended"&&this.ctx.resume();return}this.ctx=new AudioContext,this.master=this.ctx.createGain(),this.master.gain.value=1,this.master.connect(this.ctx.destination)}playGlitchStatic(){if(!this.enabled||!this.ctx||!this.master)return;const t=this.ctx,n=1.4,a=t.createBuffer(1,t.sampleRate*n,t.sampleRate),o=a.getChannelData(0);for(let m=0;m<o.length;m++){const p=m/t.sampleRate,_=p<.9?1:Math.max(0,1-(p-.9)/.5),v=Math.random()<.02?3:1;o[m]=(Math.random()*2-1)*.22*_*v}const c=t.createBufferSource();c.buffer=a;const u=t.createBiquadFilter();u.type="bandpass",u.frequency.setValueAtTime(900,t.currentTime),u.frequency.exponentialRampToValueAtTime(2600,t.currentTime+.5),u.frequency.exponentialRampToValueAtTime(500,t.currentTime+n),u.Q.value=.8;const d=t.createGain();d.gain.value=.5,c.connect(u).connect(d).connect(this.master),c.start()}startDrone(){if(!this.enabled||!this.ctx||!this.master||this.drone)return;const t=this.ctx,n=t.createGain();n.gain.setValueAtTime(0,t.currentTime),n.gain.linearRampToValueAtTime(.06,t.currentTime+7);const a=t.createBiquadFilter();a.type="lowpass",a.frequency.value=140;const o=[54,54.6,108.3].map(c=>{const u=t.createOscillator();return u.type="sawtooth",u.frequency.value=c,u.connect(a),u.start(),u});a.connect(n).connect(this.master),this.drone={osc:o,gain:n}}stopDrone(){if(!this.drone||!this.ctx)return;const{osc:t,gain:n}=this.drone;n.gain.linearRampToValueAtTime(0,this.ctx.currentTime+.8),setTimeout(()=>t.forEach(a=>a.stop()),900),this.drone=null}}const Gl=new AC;Wn.onSegmentChange(r=>{r.id==="W1"&&Gl.playGlitchStatic(),r.id==="W7"?Gl.startDrone():Gl.stopDrone()});const Sy=[["M50 22 L50 70","M28 40 L28 70","M72 40 L72 70","M18 70 L82 70"],["M50 16 L50 84","M32 24 L68 24","M30 76 L70 76","M42 45 L58 45"],["M46 14 L50 44","M54 56 L58 86","M40 50 L62 52","M34 30 L52 34"],["M32 18 C44 34 24 48 36 64 C42 72 40 78 34 84","M52 14 C64 32 44 46 56 62 C62 71 60 79 54 86","M70 22 C78 34 62 48 72 62 C77 70 76 77 71 82"],["M50 30 L50 58","M50 58 L36 80","M50 58 L64 80","M42 22 L50 30 L58 22","M38 14 L44 24","M62 14 L56 24","M50 44 L70 40"],["M20 44 Q50 16 80 44","M26 62 L74 62","M50 30 L50 48"]];function CS({index:r,size:t=64,className:n,style:a}){const o=Sy[r%Sy.length];return It.jsx("svg",{"code-path":"src/scene/glyphs.tsx:30:5",width:t,height:t,viewBox:"0 0 100 100",className:n,style:a,"aria-hidden":!0,children:o.map((c,u)=>It.jsx("path",{"code-path":"src/scene/glyphs.tsx:35:9",d:c,fill:"none",stroke:"currentColor",strokeWidth:4.5,strokeLinecap:"round",strokeLinejoin:"round"},u))})}function RC(r){let t=r;return()=>(t=t*1103515245+12345&2147483647,t/2147483647)}function wC(r){const t=RC(r*7919+13),n=4,a=100/(n-1),o=[],c=[],u=4+Math.floor(t()*3);for(let p=0;p<u;p++){const _=[[1,0],[0,1],[1,1],[1,-1]],[v,g]=_[Math.floor(t()*4)],y=Math.floor(t()*(n-1)),E=Math.floor(t()*(n-1)),A=1+Math.floor(t()*2),x=Math.min(n-1,Math.max(0,y+v*A)),S=Math.min(n-1,Math.max(0,E+g*A));y===x&&E===S||(o.push({x1:y*a,y1:E*a,x2:x*a,y2:S*a}),c.push([y*a,E*a],[x*a,S*a]))}const d=new Set,m=c.filter(([p,_])=>{const v=`${p},${_}`;return d.has(v)?!1:(d.add(v),!0)});return{segs:o,dots:m.slice(0,8)}}function DS({seed:r,size:t=64,delay:n=0,active:a}){const o=ht.useMemo(()=>wC(r),[r]);return It.jsxs("svg",{"code-path":"src/scene/glyphs.tsx:90:5",width:t,height:t,viewBox:"-14 -14 128 128","aria-hidden":!0,children:[o.segs.map((c,u)=>{const d=Math.hypot(c.x2-c.x1,c.y2-c.y1);return It.jsx("line",{"code-path":"src/scene/glyphs.tsx:94:11",x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,stroke:"currentColor",strokeWidth:3.5,strokeLinecap:"round",strokeDasharray:d,strokeDashoffset:a?0:d,style:{transition:a?`stroke-dashoffset 200ms linear ${n+u*60}ms`:"none"}},u)}),o.dots.map(([c,u],d)=>It.jsx("circle",{"code-path":"src/scene/glyphs.tsx:107:9",cx:c,cy:u,r:3.2,fill:"currentColor",opacity:a?1:0,style:{transition:a?`opacity 120ms linear ${n+d*30}ms`:"none"}},d))]})}function CC(){const[r,t]=ht.useState("W0"),[n,a]=ht.useState(null);return ht.useEffect(()=>{let o;return Wn.onSegmentChange(c=>{t(u=>(u!==c.id&&(a(u),clearTimeout(o),o=setTimeout(()=>a(null),420)),c.id))})},[]),{active:r,leaving:n}}function Yl({children:r,delay:t=0,show:n,className:a=""}){return It.jsx("div",{"code-path":"src/components/TextLayers.tsx:34:5",className:`reveal ${n?"reveal-in":""} ${a}`,style:{transitionDelay:`${t}ms`},children:r})}function e0({id:r,children:t,className:n=""}){const a=ht.useRef(null);return ht.useEffect(()=>Wn.onFrame(()=>{const o=a.current;if(!o)return;const c=Wn.state.anchors[r],u=Wn.state;if(!c||!c.visible){o.style.opacity="0",o.style.visibility="hidden",o.classList.remove("anchor-on");return}const d=u.pointerDamped.x*16*u.pointerActive,m=u.pointerDamped.y*10*u.pointerActive;o.style.visibility="visible",o.style.opacity="1",o.classList.add("anchor-on"),o.style.transform=`translate(${(c.x+d).toFixed(1)}px, ${(c.y+m).toFixed(1)}px) translate(-50%, -50%)`}),[r]),It.jsx("div",{"code-path":"src/components/TextLayers.tsx:71:5",ref:a,className:`fixed left-0 top-0 z-10 pointer-events-none ${n}`,style:{opacity:0,visibility:"hidden"},children:t})}function DC({show:r}){return It.jsx("div",{"code-path":"src/components/TextLayers.tsx:84:5",className:"fixed left-6 bottom-8 md:left-10 md:bottom-12 z-10 pointer-events-none",children:Yi.W0.hud.map((t,n)=>It.jsx(Yl,{"code-path":"src/components/TextLayers.tsx:86:9",show:r,delay:n*80,children:It.jsx("div",{"code-path":"src/components/TextLayers.tsx:87:11",className:"hud-text hud-flicker",children:t})},t))})}function LC(){const r=Yi.W1.glitch,[t,n]=ht.useState(""),[a,o]=ht.useState(0),c=Wn.state.reduced;ht.useEffect(()=>{if(c){n(r),o(2);return}const d=r.split(""),m=d.map((v,g)=>500+g*110+Math.random()*180),p=performance.now(),_=setInterval(()=>{const v=performance.now()-p,g=v>2e3&&v<2500&&Math.random()<.08,y=d.map((E,A)=>E===" "?" ":g||v<m[A]?Math.random()<.12?E:_y[Math.floor(Math.random()*_y.length)]:E).join("");n(y),o(v<2e3?0:v<2500?1:2),v>2600&&clearInterval(_)},40);return()=>clearInterval(_)},[c,r]);const u=a===0&&!c&&!Wn.state.isMobile;return It.jsx("div",{"code-path":"src/components/TextLayers.tsx:132:5",className:"fixed inset-0 z-10 grid place-items-center pointer-events-none",children:It.jsxs("div",{"code-path":"src/components/TextLayers.tsx:133:7",className:`glitch-wrap ${u?"rgb-on":""}`,children:[u&&It.jsxs(It.Fragment,{children:[It.jsx("span",{"code-path":"src/components/TextLayers.tsx:136:13",className:"glitch-layer glitch-r","aria-hidden":!0,children:t}),It.jsx("span",{"code-path":"src/components/TextLayers.tsx:137:13",className:"glitch-layer glitch-b","aria-hidden":!0,children:t})]}),It.jsx("span",{"code-path":"src/components/TextLayers.tsx:140:9",className:`glitch-main ${a===0&&!c?"slice-jitter":""}`,children:t}),It.jsxs("div",{"code-path":"src/components/TextLayers.tsx:143:9",className:"hud-text text-center mt-6 transition-opacity duration-700",style:{opacity:a===2?.7:0},children:[Yi.W1.sub.replace("…",""),It.jsx("span",{"code-path":"src/components/TextLayers.tsx:148:11",className:"blink",children:"…"})]})]})})}function UC(){return It.jsxs(e0,{"code-path":"src/components/TextLayers.tsx:159:5",id:"W2",className:"text-center",children:[It.jsx("div",{"code-path":"src/components/TextLayers.tsx:160:7",className:"glyph-wall",children:[0,1,2,3,4,5].map(r=>It.jsx("div",{"code-path":"src/components/TextLayers.tsx:162:11",className:"glyph-item",style:{transitionDelay:`${500+r*150}ms`},children:It.jsx(CS,{"code-path":"src/components/TextLayers.tsx:163:13",index:r,size:54})},r))}),It.jsx("div",{"code-path":"src/components/TextLayers.tsx:167:7",className:"glyph-translation",style:{transitionDelay:"4300ms",opacity:void 0},children:Yi.W2.translation})]})}function NC({show:r}){return It.jsxs("div",{"code-path":"src/components/TextLayers.tsx:180:5",className:"fixed left-6 bottom-10 md:left-12 md:bottom-16 z-10 pointer-events-none max-w-[80vw]",children:[It.jsx(Yl,{"code-path":"src/components/TextLayers.tsx:181:7",show:r,children:It.jsx("h2",{"code-path":"src/components/TextLayers.tsx:182:9",className:"serif-title",children:Yi.W3.title})}),It.jsx(Yl,{"code-path":"src/components/TextLayers.tsx:184:7",show:r,delay:160,children:It.jsx("div",{"code-path":"src/components/TextLayers.tsx:185:9",className:"hud-text mt-[1.5em]",children:Yi.W3.sub})})]})}function OC(){const[r,t]=ht.useState(!1);return ht.useEffect(()=>{const n=setTimeout(()=>t(!0),400),a=setInterval(()=>{},4e3);return()=>{clearTimeout(n),clearInterval(a)}},[]),It.jsxs(e0,{"code-path":"src/components/TextLayers.tsx:203:5",id:"W4",className:"text-center tech-glow",children:[It.jsx("div",{"code-path":"src/components/TextLayers.tsx:204:7",className:"flex gap-1 justify-center",children:[3,7,11,17,23,31,43].map((n,a)=>It.jsx(DS,{"code-path":"src/components/TextLayers.tsx:206:11",seed:n,size:44,delay:a*80,active:r},n))}),It.jsx("div",{"code-path":"src/components/TextLayers.tsx:209:7",className:"hud-text mt-5 transition-opacity duration-700",style:{opacity:r?.7:0,transitionDelay:"900ms"},children:Yi.W4.note})]})}function PC({show:r}){return It.jsxs(It.Fragment,{children:[It.jsx(e0,{"code-path":"src/components/TextLayers.tsx:223:7",id:"W6",children:It.jsxs("div",{"code-path":"src/components/TextLayers.tsx:224:9",className:"flex items-center gap-3 convergence",children:[It.jsx(CS,{"code-path":"src/components/TextLayers.tsx:225:11",index:0,size:40}),It.jsx("span",{"code-path":"src/components/TextLayers.tsx:226:11",className:"conv-line"}),It.jsx(DS,{"code-path":"src/components/TextLayers.tsx:227:11",seed:53,size:40,delay:200,active:!0})]})}),It.jsxs("div",{"code-path":"src/components/TextLayers.tsx:230:7",className:"fixed left-6 bottom-10 md:left-12 md:bottom-16 z-10 pointer-events-none max-w-[80vw]",children:[It.jsx(Yl,{"code-path":"src/components/TextLayers.tsx:231:9",show:r,children:It.jsx("h2",{"code-path":"src/components/TextLayers.tsx:232:11",className:"serif-title",children:Yi.W6.title})}),It.jsx(Yl,{"code-path":"src/components/TextLayers.tsx:234:9",show:r,delay:160,children:It.jsx("div",{"code-path":"src/components/TextLayers.tsx:235:11",className:"hud-text mt-[1.5em]",children:Yi.W6.sub})})]})]})}function BC(){const[r,t]=ht.useState(!1);return ht.useEffect(()=>Wn.onFrame(()=>{Wn.state.sunrise>.94&&t(!0)}),[]),It.jsx("div",{"code-path":"src/components/TextLayers.tsx:251:5",className:"fixed inset-0 z-10 grid place-items-center pointer-events-none",children:It.jsxs("div",{"code-path":"src/components/TextLayers.tsx:252:7",className:`text-center finale ${r?"finale-in":""}`,children:[It.jsx("h1",{"code-path":"src/components/TextLayers.tsx:253:9",className:"serif-title finale-title",children:Yi.W7.title}),It.jsx("a",{"code-path":"src/components/TextLayers.tsx:254:9",href:"#top",className:"finale-continue",onClick:n=>{n.preventDefault(),window.scrollTo({top:0,behavior:"smooth"})},children:Yi.W7.continue})]})})}function IC(){const[r,t]=ht.useState(!1);return ht.useEffect(()=>Gl.onChange(t),[]),It.jsxs("button",{"code-path":"src/components/TextLayers.tsx:274:5",className:"fixed right-5 bottom-5 z-30 sound-toggle",onClick:()=>Gl.toggle(),"aria-pressed":r,children:["SOUND: ",r?"ON":"OFF"]})}function zC(){const{active:r,leaving:t}=CC(),n=(a,o)=>{switch(a){case"W0":return It.jsx(DC,{"code-path":"src/components/TextLayers.tsx:289:25",show:o},"W0");case"W1":return o?It.jsx(LC,{"code-path":"src/components/TextLayers.tsx:290:32"},"W1"):null;case"W2":return o?It.jsx(UC,{"code-path":"src/components/TextLayers.tsx:291:32"},"W2"):null;case"W3":return It.jsx(NC,{"code-path":"src/components/TextLayers.tsx:292:25",show:o},"W3");case"W4":return o?It.jsx(OC,{"code-path":"src/components/TextLayers.tsx:293:32"},"W4"):null;case"W6":return It.jsx(PC,{"code-path":"src/components/TextLayers.tsx:294:25",show:o},"W6");case"W7":return o?It.jsx(BC,{"code-path":"src/components/TextLayers.tsx:295:32"},"W7"):null;default:return null}};return It.jsxs(It.Fragment,{children:[t&&n(t,!1),n(r,!0),It.jsx(IC,{"code-path":"src/components/TextLayers.tsx:303:7"})]})}function FC(){const r=ht.useRef(null);return ht.useEffect(()=>{if(r.current)return EC(r.current)},[]),It.jsxs("div",{"code-path":"src/App.tsx:16:5",id:"top",className:"bg-[#060B14]",children:[It.jsx("div",{"code-path":"src/App.tsx:18:7",style:{height:"1000vh"},"aria-hidden":!0}),It.jsx("canvas",{"code-path":"src/App.tsx:20:7",ref:r,className:"fixed inset-0 z-0 w-full h-full pointer-events-none"}),It.jsx(TC,{"code-path":"src/App.tsx:22:7"}),It.jsx(zC,{"code-path":"src/App.tsx:23:7"}),It.jsxs("div",{"code-path":"src/App.tsx:25:7",className:"sr-only",children:[It.jsx("h1",{"code-path":"src/App.tsx:26:9",children:"观测日志 07:月球(破碎)——不周山"}),It.jsx("p",{"code-path":"src/App.tsx:27:9",children:"信号崩溃?传输丢失,正在重试。"}),It.jsx("p",{"code-path":"src/App.tsx:28:9",children:"「天柱折,地维绝。」——此山名曰不周"}),It.jsx("p",{"code-path":"src/App.tsx:29:9",children:"它曾经是一座山。断裂分析:撞击源——外生。"}),It.jsx("p",{"code-path":"src/App.tsx:30:9",children:"未知来源——先于撞击存在。"}),It.jsx("p",{"code-path":"src/App.tsx:31:9",children:"传说与机器,刻着同一句话。翻译收敛:100%。"}),It.jsx("p",{"code-path":"src/App.tsx:32:9",children:"天亮了。"})]})]})}V1.createRoot(document.getElementById("root")).render(It.jsx(ht.StrictMode,{"code-path":"src/main.tsx:8:3",children:It.jsx(fb,{"code-path":"src/main.tsx:9:5",children:It.jsx(FC,{"code-path":"src/main.tsx:10:7"})})}));