livedesk 0.1.31 → 0.1.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,24 +1,24 @@
1
- (function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))l(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const h of d.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&l(h)}).observe(document,{childList:!0,subtree:!0});function r(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function l(c){if(c.ep)return;c.ep=!0;const d=r(c);fetch(c.href,d)}})();var Zu={exports:{}},Cs={};var yg;function e0(){if(yg)return Cs;yg=1;var i=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(l,c,d){var h=null;if(d!==void 0&&(h=""+d),c.key!==void 0&&(h=""+c.key),"key"in c){d={};for(var m in c)m!=="key"&&(d[m]=c[m])}else d=c;return c=d.ref,{$$typeof:i,type:l,key:h,ref:c!==void 0?c:null,props:d}}return Cs.Fragment=n,Cs.jsx=r,Cs.jsxs=r,Cs}var vg;function t0(){return vg||(vg=1,Zu.exports=e0()),Zu.exports}var y=t0(),Fu={exports:{}},he={};var bg;function n0(){if(bg)return he;bg=1;var i=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),h=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),T=Symbol.iterator;function A(E){return E===null||typeof E!="object"?null:(E=T&&E[T]||E["@@iterator"],typeof E=="function"?E:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},U=Object.assign,$={};function P(E,M,J){this.props=E,this.context=M,this.refs=$,this.updater=J||C}P.prototype.isReactComponent={},P.prototype.setState=function(E,M){if(typeof E!="object"&&typeof E!="function"&&E!=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,E,M,"setState")},P.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function q(){}q.prototype=P.prototype;function N(E,M,J){this.props=E,this.context=M,this.refs=$,this.updater=J||C}var Y=N.prototype=new q;Y.constructor=N,U(Y,P.prototype),Y.isPureReactComponent=!0;var ue=Array.isArray;function G(){}var Q={H:null,A:null,T:null,S:null},Se=Object.prototype.hasOwnProperty;function we(E,M,J){var Z=J.ref;return{$$typeof:i,type:E,key:M,ref:Z!==void 0?Z:null,props:J}}function Nt(E,M){return we(E.type,M,E.props)}function We(E){return typeof E=="object"&&E!==null&&E.$$typeof===i}function Le(E){var M={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function(J){return M[J]})}var mt=/\/+/g;function pt(E,M){return typeof E=="object"&&E!==null&&E.key!=null?Le(""+E.key):M.toString(36)}function Ge(E){switch(E.status){case"fulfilled":return E.value;case"rejected":throw E.reason;default:switch(typeof E.status=="string"?E.then(G,G):(E.status="pending",E.then(function(M){E.status==="pending"&&(E.status="fulfilled",E.value=M)},function(M){E.status==="pending"&&(E.status="rejected",E.reason=M)})),E.status){case"fulfilled":return E.value;case"rejected":throw E.reason}}throw E}function D(E,M,J,Z,de){var me=typeof E;(me==="undefined"||me==="boolean")&&(E=null);var xe=!1;if(E===null)xe=!0;else switch(me){case"bigint":case"string":case"number":xe=!0;break;case"object":switch(E.$$typeof){case i:case n:xe=!0;break;case S:return xe=E._init,D(xe(E._payload),M,J,Z,de)}}if(xe)return de=de(E),xe=Z===""?"."+pt(E,0):Z,ue(de)?(J="",xe!=null&&(J=xe.replace(mt,"$&/")+"/"),D(de,M,J,"",function(kn){return kn})):de!=null&&(We(de)&&(de=Nt(de,J+(de.key==null||E&&E.key===de.key?"":(""+de.key).replace(mt,"$&/")+"/")+xe)),M.push(de)),1;xe=0;var Je=Z===""?".":Z+":";if(ue(E))for(var Xe=0;Xe<E.length;Xe++)Z=E[Xe],me=Je+pt(Z,Xe),xe+=D(Z,M,J,me,de);else if(Xe=A(E),typeof Xe=="function")for(E=Xe.call(E),Xe=0;!(Z=E.next()).done;)Z=Z.value,me=Je+pt(Z,Xe++),xe+=D(Z,M,J,me,de);else if(me==="object"){if(typeof E.then=="function")return D(Ge(E),M,J,Z,de);throw M=String(E),Error("Objects are not valid as a React child (found: "+(M==="[object Object]"?"object with keys {"+Object.keys(E).join(", ")+"}":M)+"). If you meant to render a collection of children, use an array instead.")}return xe}function K(E,M,J){if(E==null)return E;var Z=[],de=0;return D(E,Z,"","",function(me){return M.call(J,me,de++)}),Z}function ae(E){if(E._status===-1){var M=E._result;M=M(),M.then(function(J){(E._status===0||E._status===-1)&&(E._status=1,E._result=J)},function(J){(E._status===0||E._status===-1)&&(E._status=2,E._result=J)}),E._status===-1&&(E._status=0,E._result=M)}if(E._status===1)return E._result.default;throw E._result}var te=typeof reportError=="function"?reportError:function(E){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var M=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(M))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",E);return}console.error(E)},Ee={map:K,forEach:function(E,M,J){K(E,function(){M.apply(this,arguments)},J)},count:function(E){var M=0;return K(E,function(){M++}),M},toArray:function(E){return K(E,function(M){return M})||[]},only:function(E){if(!We(E))throw Error("React.Children.only expected to receive a single React element child.");return E}};return he.Activity=b,he.Children=Ee,he.Component=P,he.Fragment=r,he.Profiler=c,he.PureComponent=N,he.StrictMode=l,he.Suspense=g,he.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Q,he.__COMPILER_RUNTIME={__proto__:null,c:function(E){return Q.H.useMemoCache(E)}},he.cache=function(E){return function(){return E.apply(null,arguments)}},he.cacheSignal=function(){return null},he.cloneElement=function(E,M,J){if(E==null)throw Error("The argument must be a React element, but you passed "+E+".");var Z=U({},E.props),de=E.key;if(M!=null)for(me in M.key!==void 0&&(de=""+M.key),M)!Se.call(M,me)||me==="key"||me==="__self"||me==="__source"||me==="ref"&&M.ref===void 0||(Z[me]=M[me]);var me=arguments.length-2;if(me===1)Z.children=J;else if(1<me){for(var xe=Array(me),Je=0;Je<me;Je++)xe[Je]=arguments[Je+2];Z.children=xe}return we(E.type,de,Z)},he.createContext=function(E){return E={$$typeof:h,_currentValue:E,_currentValue2:E,_threadCount:0,Provider:null,Consumer:null},E.Provider=E,E.Consumer={$$typeof:d,_context:E},E},he.createElement=function(E,M,J){var Z,de={},me=null;if(M!=null)for(Z in M.key!==void 0&&(me=""+M.key),M)Se.call(M,Z)&&Z!=="key"&&Z!=="__self"&&Z!=="__source"&&(de[Z]=M[Z]);var xe=arguments.length-2;if(xe===1)de.children=J;else if(1<xe){for(var Je=Array(xe),Xe=0;Xe<xe;Xe++)Je[Xe]=arguments[Xe+2];de.children=Je}if(E&&E.defaultProps)for(Z in xe=E.defaultProps,xe)de[Z]===void 0&&(de[Z]=xe[Z]);return we(E,me,de)},he.createRef=function(){return{current:null}},he.forwardRef=function(E){return{$$typeof:m,render:E}},he.isValidElement=We,he.lazy=function(E){return{$$typeof:S,_payload:{_status:-1,_result:E},_init:ae}},he.memo=function(E,M){return{$$typeof:p,type:E,compare:M===void 0?null:M}},he.startTransition=function(E){var M=Q.T,J={};Q.T=J;try{var Z=E(),de=Q.S;de!==null&&de(J,Z),typeof Z=="object"&&Z!==null&&typeof Z.then=="function"&&Z.then(G,te)}catch(me){te(me)}finally{M!==null&&J.types!==null&&(M.types=J.types),Q.T=M}},he.unstable_useCacheRefresh=function(){return Q.H.useCacheRefresh()},he.use=function(E){return Q.H.use(E)},he.useActionState=function(E,M,J){return Q.H.useActionState(E,M,J)},he.useCallback=function(E,M){return Q.H.useCallback(E,M)},he.useContext=function(E){return Q.H.useContext(E)},he.useDebugValue=function(){},he.useDeferredValue=function(E,M){return Q.H.useDeferredValue(E,M)},he.useEffect=function(E,M){return Q.H.useEffect(E,M)},he.useEffectEvent=function(E){return Q.H.useEffectEvent(E)},he.useId=function(){return Q.H.useId()},he.useImperativeHandle=function(E,M,J){return Q.H.useImperativeHandle(E,M,J)},he.useInsertionEffect=function(E,M){return Q.H.useInsertionEffect(E,M)},he.useLayoutEffect=function(E,M){return Q.H.useLayoutEffect(E,M)},he.useMemo=function(E,M){return Q.H.useMemo(E,M)},he.useOptimistic=function(E,M){return Q.H.useOptimistic(E,M)},he.useReducer=function(E,M,J){return Q.H.useReducer(E,M,J)},he.useRef=function(E){return Q.H.useRef(E)},he.useState=function(E){return Q.H.useState(E)},he.useSyncExternalStore=function(E,M,J){return Q.H.useSyncExternalStore(E,M,J)},he.useTransition=function(){return Q.H.useTransition()},he.version="19.2.7",he}var Sg;function zd(){return Sg||(Sg=1,Fu.exports=n0()),Fu.exports}var I=zd(),ed={exports:{}},Os={},td={exports:{}},nd={};var wg;function a0(){return wg||(wg=1,(function(i){function n(D,K){var ae=D.length;D.push(K);e:for(;0<ae;){var te=ae-1>>>1,Ee=D[te];if(0<c(Ee,K))D[te]=K,D[ae]=Ee,ae=te;else break e}}function r(D){return D.length===0?null:D[0]}function l(D){if(D.length===0)return null;var K=D[0],ae=D.pop();if(ae!==K){D[0]=ae;e:for(var te=0,Ee=D.length,E=Ee>>>1;te<E;){var M=2*(te+1)-1,J=D[M],Z=M+1,de=D[Z];if(0>c(J,ae))Z<Ee&&0>c(de,J)?(D[te]=de,D[Z]=ae,te=Z):(D[te]=J,D[M]=ae,te=M);else if(Z<Ee&&0>c(de,ae))D[te]=de,D[Z]=ae,te=Z;else break e}}return K}function c(D,K){var ae=D.sortIndex-K.sortIndex;return ae!==0?ae:D.id-K.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;i.unstable_now=function(){return d.now()}}else{var h=Date,m=h.now();i.unstable_now=function(){return h.now()-m}}var g=[],p=[],S=1,b=null,T=3,A=!1,C=!1,U=!1,$=!1,P=typeof setTimeout=="function"?setTimeout:null,q=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function Y(D){for(var K=r(p);K!==null;){if(K.callback===null)l(p);else if(K.startTime<=D)l(p),K.sortIndex=K.expirationTime,n(g,K);else break;K=r(p)}}function ue(D){if(U=!1,Y(D),!C)if(r(g)!==null)C=!0,G||(G=!0,Le());else{var K=r(p);K!==null&&Ge(ue,K.startTime-D)}}var G=!1,Q=-1,Se=5,we=-1;function Nt(){return $?!0:!(i.unstable_now()-we<Se)}function We(){if($=!1,G){var D=i.unstable_now();we=D;var K=!0;try{e:{C=!1,U&&(U=!1,q(Q),Q=-1),A=!0;var ae=T;try{t:{for(Y(D),b=r(g);b!==null&&!(b.expirationTime>D&&Nt());){var te=b.callback;if(typeof te=="function"){b.callback=null,T=b.priorityLevel;var Ee=te(b.expirationTime<=D);if(D=i.unstable_now(),typeof Ee=="function"){b.callback=Ee,Y(D),K=!0;break t}b===r(g)&&l(g),Y(D)}else l(g);b=r(g)}if(b!==null)K=!0;else{var E=r(p);E!==null&&Ge(ue,E.startTime-D),K=!1}}break e}finally{b=null,T=ae,A=!1}K=void 0}}finally{K?Le():G=!1}}}var Le;if(typeof N=="function")Le=function(){N(We)};else if(typeof MessageChannel<"u"){var mt=new MessageChannel,pt=mt.port2;mt.port1.onmessage=We,Le=function(){pt.postMessage(null)}}else Le=function(){P(We,0)};function Ge(D,K){Q=P(function(){D(i.unstable_now())},K)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(D){D.callback=null},i.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Se=0<D?Math.floor(1e3/D):5},i.unstable_getCurrentPriorityLevel=function(){return T},i.unstable_next=function(D){switch(T){case 1:case 2:case 3:var K=3;break;default:K=T}var ae=T;T=K;try{return D()}finally{T=ae}},i.unstable_requestPaint=function(){$=!0},i.unstable_runWithPriority=function(D,K){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var ae=T;T=D;try{return K()}finally{T=ae}},i.unstable_scheduleCallback=function(D,K,ae){var te=i.unstable_now();switch(typeof ae=="object"&&ae!==null?(ae=ae.delay,ae=typeof ae=="number"&&0<ae?te+ae:te):ae=te,D){case 1:var Ee=-1;break;case 2:Ee=250;break;case 5:Ee=1073741823;break;case 4:Ee=1e4;break;default:Ee=5e3}return Ee=ae+Ee,D={id:S++,callback:K,priorityLevel:D,startTime:ae,expirationTime:Ee,sortIndex:-1},ae>te?(D.sortIndex=ae,n(p,D),r(g)===null&&D===r(p)&&(U?(q(Q),Q=-1):U=!0,Ge(ue,ae-te))):(D.sortIndex=Ee,n(g,D),C||A||(C=!0,G||(G=!0,Le()))),D},i.unstable_shouldYield=Nt,i.unstable_wrapCallback=function(D){var K=T;return function(){var ae=T;T=K;try{return D.apply(this,arguments)}finally{T=ae}}}})(nd)),nd}var _g;function i0(){return _g||(_g=1,td.exports=a0()),td.exports}var ad={exports:{}},At={};var Tg;function r0(){if(Tg)return At;Tg=1;var i=zd();function n(g){var p="https://react.dev/errors/"+g;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var S=2;S<arguments.length;S++)p+="&args[]="+encodeURIComponent(arguments[S])}return"Minified React error #"+g+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var l={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},c=Symbol.for("react.portal");function d(g,p,S){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:b==null?null:""+b,children:g,containerInfo:p,implementation:S}}var h=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(g,p){if(g==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return At.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,At.createPortal=function(g,p){var S=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(n(299));return d(g,p,null,S)},At.flushSync=function(g){var p=h.T,S=l.p;try{if(h.T=null,l.p=2,g)return g()}finally{h.T=p,l.p=S,l.d.f()}},At.preconnect=function(g,p){typeof g=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,l.d.C(g,p))},At.prefetchDNS=function(g){typeof g=="string"&&l.d.D(g)},At.preinit=function(g,p){if(typeof g=="string"&&p&&typeof p.as=="string"){var S=p.as,b=m(S,p.crossOrigin),T=typeof p.integrity=="string"?p.integrity:void 0,A=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;S==="style"?l.d.S(g,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:b,integrity:T,fetchPriority:A}):S==="script"&&l.d.X(g,{crossOrigin:b,integrity:T,fetchPriority:A,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},At.preinitModule=function(g,p){if(typeof g=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var S=m(p.as,p.crossOrigin);l.d.M(g,{crossOrigin:S,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&l.d.M(g)},At.preload=function(g,p){if(typeof g=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var S=p.as,b=m(S,p.crossOrigin);l.d.L(g,S,{crossOrigin:b,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})}},At.preloadModule=function(g,p){if(typeof g=="string")if(p){var S=m(p.as,p.crossOrigin);l.d.m(g,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:S,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else l.d.m(g)},At.requestFormReset=function(g){l.d.r(g)},At.unstable_batchedUpdates=function(g,p){return g(p)},At.useFormState=function(g,p,S){return h.H.useFormState(g,p,S)},At.useFormStatus=function(){return h.H.useHostTransitionStatus()},At.version="19.2.7",At}var kg;function s0(){if(kg)return ad.exports;kg=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(n){console.error(n)}}return i(),ad.exports=r0(),ad.exports}var Eg;function l0(){if(Eg)return Os;Eg=1;var i=i0(),n=zd(),r=s0();function l(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var t=e,a=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(a=t.return),e=t.return;while(e)}return t.tag===3?a:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(d(e)!==e)throw Error(l(188))}function p(e){var t=e.alternate;if(!t){if(t=d(e),t===null)throw Error(l(188));return t!==e?null:e}for(var a=e,s=t;;){var o=a.return;if(o===null)break;var u=o.alternate;if(u===null){if(s=o.return,s!==null){a=s;continue}break}if(o.child===u.child){for(u=o.child;u;){if(u===a)return g(o),e;if(u===s)return g(o),t;u=u.sibling}throw Error(l(188))}if(a.return!==s.return)a=o,s=u;else{for(var f=!1,v=o.child;v;){if(v===a){f=!0,a=o,s=u;break}if(v===s){f=!0,s=o,a=u;break}v=v.sibling}if(!f){for(v=u.child;v;){if(v===a){f=!0,a=u,s=o;break}if(v===s){f=!0,s=u,a=o;break}v=v.sibling}if(!f)throw Error(l(189))}}if(a.alternate!==s)throw Error(l(190))}if(a.tag!==3)throw Error(l(188));return a.stateNode.current===a?e:t}function S(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=S(e),t!==null)return t;e=e.sibling}return null}var b=Object.assign,T=Symbol.for("react.element"),A=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),U=Symbol.for("react.fragment"),$=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),q=Symbol.for("react.consumer"),N=Symbol.for("react.context"),Y=Symbol.for("react.forward_ref"),ue=Symbol.for("react.suspense"),G=Symbol.for("react.suspense_list"),Q=Symbol.for("react.memo"),Se=Symbol.for("react.lazy"),we=Symbol.for("react.activity"),Nt=Symbol.for("react.memo_cache_sentinel"),We=Symbol.iterator;function Le(e){return e===null||typeof e!="object"?null:(e=We&&e[We]||e["@@iterator"],typeof e=="function"?e:null)}var mt=Symbol.for("react.client.reference");function pt(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===mt?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case U:return"Fragment";case P:return"Profiler";case $:return"StrictMode";case ue:return"Suspense";case G:return"SuspenseList";case we:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case C:return"Portal";case N:return e.displayName||"Context";case q:return(e._context.displayName||"Context")+".Consumer";case Y:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Q:return t=e.displayName||null,t!==null?t:pt(e.type)||"Memo";case Se:t=e._payload,e=e._init;try{return pt(e(t))}catch{}}return null}var Ge=Array.isArray,D=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae={pending:!1,data:null,method:null,action:null},te=[],Ee=-1;function E(e){return{current:e}}function M(e){0>Ee||(e.current=te[Ee],te[Ee]=null,Ee--)}function J(e,t){Ee++,te[Ee]=e.current,e.current=t}var Z=E(null),de=E(null),me=E(null),xe=E(null);function Je(e,t){switch(J(me,t),J(de,e),J(Z,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?qm(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=qm(t),e=$m(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}M(Z),J(Z,e)}function Xe(){M(Z),M(de),M(me)}function kn(e){e.memoizedState!==null&&J(xe,e);var t=Z.current,a=$m(t,e.type);t!==a&&(J(de,e),J(Z,a))}function fn(e){de.current===e&&(M(Z),M(de)),xe.current===e&&(M(xe),ks._currentValue=ae)}var Ti,ki;function Dn(e){if(Ti===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);Ti=t&&t[1]||"",ki=-1<a.stack.indexOf(`
1
+ (function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))l(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const h of d.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&l(h)}).observe(document,{childList:!0,subtree:!0});function r(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function l(c){if(c.ep)return;c.ep=!0;const d=r(c);fetch(c.href,d)}})();var Zu={exports:{}},Cs={};var yg;function t0(){if(yg)return Cs;yg=1;var i=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(l,c,d){var h=null;if(d!==void 0&&(h=""+d),c.key!==void 0&&(h=""+c.key),"key"in c){d={};for(var m in c)m!=="key"&&(d[m]=c[m])}else d=c;return c=d.ref,{$$typeof:i,type:l,key:h,ref:c!==void 0?c:null,props:d}}return Cs.Fragment=n,Cs.jsx=r,Cs.jsxs=r,Cs}var vg;function n0(){return vg||(vg=1,Zu.exports=t0()),Zu.exports}var y=n0(),Fu={exports:{}},he={};var bg;function a0(){if(bg)return he;bg=1;var i=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),h=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),T=Symbol.iterator;function A(E){return E===null||typeof E!="object"?null:(E=T&&E[T]||E["@@iterator"],typeof E=="function"?E:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},U=Object.assign,$={};function P(E,M,J){this.props=E,this.context=M,this.refs=$,this.updater=J||C}P.prototype.isReactComponent={},P.prototype.setState=function(E,M){if(typeof E!="object"&&typeof E!="function"&&E!=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,E,M,"setState")},P.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function q(){}q.prototype=P.prototype;function N(E,M,J){this.props=E,this.context=M,this.refs=$,this.updater=J||C}var Y=N.prototype=new q;Y.constructor=N,U(Y,P.prototype),Y.isPureReactComponent=!0;var ue=Array.isArray;function G(){}var Q={H:null,A:null,T:null,S:null},Se=Object.prototype.hasOwnProperty;function we(E,M,J){var Z=J.ref;return{$$typeof:i,type:E,key:M,ref:Z!==void 0?Z:null,props:J}}function Nt(E,M){return we(E.type,M,E.props)}function We(E){return typeof E=="object"&&E!==null&&E.$$typeof===i}function Le(E){var M={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function(J){return M[J]})}var mt=/\/+/g;function pt(E,M){return typeof E=="object"&&E!==null&&E.key!=null?Le(""+E.key):M.toString(36)}function Ge(E){switch(E.status){case"fulfilled":return E.value;case"rejected":throw E.reason;default:switch(typeof E.status=="string"?E.then(G,G):(E.status="pending",E.then(function(M){E.status==="pending"&&(E.status="fulfilled",E.value=M)},function(M){E.status==="pending"&&(E.status="rejected",E.reason=M)})),E.status){case"fulfilled":return E.value;case"rejected":throw E.reason}}throw E}function D(E,M,J,Z,de){var me=typeof E;(me==="undefined"||me==="boolean")&&(E=null);var xe=!1;if(E===null)xe=!0;else switch(me){case"bigint":case"string":case"number":xe=!0;break;case"object":switch(E.$$typeof){case i:case n:xe=!0;break;case S:return xe=E._init,D(xe(E._payload),M,J,Z,de)}}if(xe)return de=de(E),xe=Z===""?"."+pt(E,0):Z,ue(de)?(J="",xe!=null&&(J=xe.replace(mt,"$&/")+"/"),D(de,M,J,"",function(kn){return kn})):de!=null&&(We(de)&&(de=Nt(de,J+(de.key==null||E&&E.key===de.key?"":(""+de.key).replace(mt,"$&/")+"/")+xe)),M.push(de)),1;xe=0;var Je=Z===""?".":Z+":";if(ue(E))for(var Xe=0;Xe<E.length;Xe++)Z=E[Xe],me=Je+pt(Z,Xe),xe+=D(Z,M,J,me,de);else if(Xe=A(E),typeof Xe=="function")for(E=Xe.call(E),Xe=0;!(Z=E.next()).done;)Z=Z.value,me=Je+pt(Z,Xe++),xe+=D(Z,M,J,me,de);else if(me==="object"){if(typeof E.then=="function")return D(Ge(E),M,J,Z,de);throw M=String(E),Error("Objects are not valid as a React child (found: "+(M==="[object Object]"?"object with keys {"+Object.keys(E).join(", ")+"}":M)+"). If you meant to render a collection of children, use an array instead.")}return xe}function K(E,M,J){if(E==null)return E;var Z=[],de=0;return D(E,Z,"","",function(me){return M.call(J,me,de++)}),Z}function ae(E){if(E._status===-1){var M=E._result;M=M(),M.then(function(J){(E._status===0||E._status===-1)&&(E._status=1,E._result=J)},function(J){(E._status===0||E._status===-1)&&(E._status=2,E._result=J)}),E._status===-1&&(E._status=0,E._result=M)}if(E._status===1)return E._result.default;throw E._result}var te=typeof reportError=="function"?reportError:function(E){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var M=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(M))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",E);return}console.error(E)},Ee={map:K,forEach:function(E,M,J){K(E,function(){M.apply(this,arguments)},J)},count:function(E){var M=0;return K(E,function(){M++}),M},toArray:function(E){return K(E,function(M){return M})||[]},only:function(E){if(!We(E))throw Error("React.Children.only expected to receive a single React element child.");return E}};return he.Activity=b,he.Children=Ee,he.Component=P,he.Fragment=r,he.Profiler=c,he.PureComponent=N,he.StrictMode=l,he.Suspense=g,he.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Q,he.__COMPILER_RUNTIME={__proto__:null,c:function(E){return Q.H.useMemoCache(E)}},he.cache=function(E){return function(){return E.apply(null,arguments)}},he.cacheSignal=function(){return null},he.cloneElement=function(E,M,J){if(E==null)throw Error("The argument must be a React element, but you passed "+E+".");var Z=U({},E.props),de=E.key;if(M!=null)for(me in M.key!==void 0&&(de=""+M.key),M)!Se.call(M,me)||me==="key"||me==="__self"||me==="__source"||me==="ref"&&M.ref===void 0||(Z[me]=M[me]);var me=arguments.length-2;if(me===1)Z.children=J;else if(1<me){for(var xe=Array(me),Je=0;Je<me;Je++)xe[Je]=arguments[Je+2];Z.children=xe}return we(E.type,de,Z)},he.createContext=function(E){return E={$$typeof:h,_currentValue:E,_currentValue2:E,_threadCount:0,Provider:null,Consumer:null},E.Provider=E,E.Consumer={$$typeof:d,_context:E},E},he.createElement=function(E,M,J){var Z,de={},me=null;if(M!=null)for(Z in M.key!==void 0&&(me=""+M.key),M)Se.call(M,Z)&&Z!=="key"&&Z!=="__self"&&Z!=="__source"&&(de[Z]=M[Z]);var xe=arguments.length-2;if(xe===1)de.children=J;else if(1<xe){for(var Je=Array(xe),Xe=0;Xe<xe;Xe++)Je[Xe]=arguments[Xe+2];de.children=Je}if(E&&E.defaultProps)for(Z in xe=E.defaultProps,xe)de[Z]===void 0&&(de[Z]=xe[Z]);return we(E,me,de)},he.createRef=function(){return{current:null}},he.forwardRef=function(E){return{$$typeof:m,render:E}},he.isValidElement=We,he.lazy=function(E){return{$$typeof:S,_payload:{_status:-1,_result:E},_init:ae}},he.memo=function(E,M){return{$$typeof:p,type:E,compare:M===void 0?null:M}},he.startTransition=function(E){var M=Q.T,J={};Q.T=J;try{var Z=E(),de=Q.S;de!==null&&de(J,Z),typeof Z=="object"&&Z!==null&&typeof Z.then=="function"&&Z.then(G,te)}catch(me){te(me)}finally{M!==null&&J.types!==null&&(M.types=J.types),Q.T=M}},he.unstable_useCacheRefresh=function(){return Q.H.useCacheRefresh()},he.use=function(E){return Q.H.use(E)},he.useActionState=function(E,M,J){return Q.H.useActionState(E,M,J)},he.useCallback=function(E,M){return Q.H.useCallback(E,M)},he.useContext=function(E){return Q.H.useContext(E)},he.useDebugValue=function(){},he.useDeferredValue=function(E,M){return Q.H.useDeferredValue(E,M)},he.useEffect=function(E,M){return Q.H.useEffect(E,M)},he.useEffectEvent=function(E){return Q.H.useEffectEvent(E)},he.useId=function(){return Q.H.useId()},he.useImperativeHandle=function(E,M,J){return Q.H.useImperativeHandle(E,M,J)},he.useInsertionEffect=function(E,M){return Q.H.useInsertionEffect(E,M)},he.useLayoutEffect=function(E,M){return Q.H.useLayoutEffect(E,M)},he.useMemo=function(E,M){return Q.H.useMemo(E,M)},he.useOptimistic=function(E,M){return Q.H.useOptimistic(E,M)},he.useReducer=function(E,M,J){return Q.H.useReducer(E,M,J)},he.useRef=function(E){return Q.H.useRef(E)},he.useState=function(E){return Q.H.useState(E)},he.useSyncExternalStore=function(E,M,J){return Q.H.useSyncExternalStore(E,M,J)},he.useTransition=function(){return Q.H.useTransition()},he.version="19.2.7",he}var Sg;function zd(){return Sg||(Sg=1,Fu.exports=a0()),Fu.exports}var I=zd(),ed={exports:{}},Os={},td={exports:{}},nd={};var wg;function i0(){return wg||(wg=1,(function(i){function n(D,K){var ae=D.length;D.push(K);e:for(;0<ae;){var te=ae-1>>>1,Ee=D[te];if(0<c(Ee,K))D[te]=K,D[ae]=Ee,ae=te;else break e}}function r(D){return D.length===0?null:D[0]}function l(D){if(D.length===0)return null;var K=D[0],ae=D.pop();if(ae!==K){D[0]=ae;e:for(var te=0,Ee=D.length,E=Ee>>>1;te<E;){var M=2*(te+1)-1,J=D[M],Z=M+1,de=D[Z];if(0>c(J,ae))Z<Ee&&0>c(de,J)?(D[te]=de,D[Z]=ae,te=Z):(D[te]=J,D[M]=ae,te=M);else if(Z<Ee&&0>c(de,ae))D[te]=de,D[Z]=ae,te=Z;else break e}}return K}function c(D,K){var ae=D.sortIndex-K.sortIndex;return ae!==0?ae:D.id-K.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;i.unstable_now=function(){return d.now()}}else{var h=Date,m=h.now();i.unstable_now=function(){return h.now()-m}}var g=[],p=[],S=1,b=null,T=3,A=!1,C=!1,U=!1,$=!1,P=typeof setTimeout=="function"?setTimeout:null,q=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function Y(D){for(var K=r(p);K!==null;){if(K.callback===null)l(p);else if(K.startTime<=D)l(p),K.sortIndex=K.expirationTime,n(g,K);else break;K=r(p)}}function ue(D){if(U=!1,Y(D),!C)if(r(g)!==null)C=!0,G||(G=!0,Le());else{var K=r(p);K!==null&&Ge(ue,K.startTime-D)}}var G=!1,Q=-1,Se=5,we=-1;function Nt(){return $?!0:!(i.unstable_now()-we<Se)}function We(){if($=!1,G){var D=i.unstable_now();we=D;var K=!0;try{e:{C=!1,U&&(U=!1,q(Q),Q=-1),A=!0;var ae=T;try{t:{for(Y(D),b=r(g);b!==null&&!(b.expirationTime>D&&Nt());){var te=b.callback;if(typeof te=="function"){b.callback=null,T=b.priorityLevel;var Ee=te(b.expirationTime<=D);if(D=i.unstable_now(),typeof Ee=="function"){b.callback=Ee,Y(D),K=!0;break t}b===r(g)&&l(g),Y(D)}else l(g);b=r(g)}if(b!==null)K=!0;else{var E=r(p);E!==null&&Ge(ue,E.startTime-D),K=!1}}break e}finally{b=null,T=ae,A=!1}K=void 0}}finally{K?Le():G=!1}}}var Le;if(typeof N=="function")Le=function(){N(We)};else if(typeof MessageChannel<"u"){var mt=new MessageChannel,pt=mt.port2;mt.port1.onmessage=We,Le=function(){pt.postMessage(null)}}else Le=function(){P(We,0)};function Ge(D,K){Q=P(function(){D(i.unstable_now())},K)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(D){D.callback=null},i.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Se=0<D?Math.floor(1e3/D):5},i.unstable_getCurrentPriorityLevel=function(){return T},i.unstable_next=function(D){switch(T){case 1:case 2:case 3:var K=3;break;default:K=T}var ae=T;T=K;try{return D()}finally{T=ae}},i.unstable_requestPaint=function(){$=!0},i.unstable_runWithPriority=function(D,K){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var ae=T;T=D;try{return K()}finally{T=ae}},i.unstable_scheduleCallback=function(D,K,ae){var te=i.unstable_now();switch(typeof ae=="object"&&ae!==null?(ae=ae.delay,ae=typeof ae=="number"&&0<ae?te+ae:te):ae=te,D){case 1:var Ee=-1;break;case 2:Ee=250;break;case 5:Ee=1073741823;break;case 4:Ee=1e4;break;default:Ee=5e3}return Ee=ae+Ee,D={id:S++,callback:K,priorityLevel:D,startTime:ae,expirationTime:Ee,sortIndex:-1},ae>te?(D.sortIndex=ae,n(p,D),r(g)===null&&D===r(p)&&(U?(q(Q),Q=-1):U=!0,Ge(ue,ae-te))):(D.sortIndex=Ee,n(g,D),C||A||(C=!0,G||(G=!0,Le()))),D},i.unstable_shouldYield=Nt,i.unstable_wrapCallback=function(D){var K=T;return function(){var ae=T;T=K;try{return D.apply(this,arguments)}finally{T=ae}}}})(nd)),nd}var _g;function r0(){return _g||(_g=1,td.exports=i0()),td.exports}var ad={exports:{}},At={};var Tg;function s0(){if(Tg)return At;Tg=1;var i=zd();function n(g){var p="https://react.dev/errors/"+g;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var S=2;S<arguments.length;S++)p+="&args[]="+encodeURIComponent(arguments[S])}return"Minified React error #"+g+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var l={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},c=Symbol.for("react.portal");function d(g,p,S){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:b==null?null:""+b,children:g,containerInfo:p,implementation:S}}var h=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(g,p){if(g==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return At.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,At.createPortal=function(g,p){var S=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(n(299));return d(g,p,null,S)},At.flushSync=function(g){var p=h.T,S=l.p;try{if(h.T=null,l.p=2,g)return g()}finally{h.T=p,l.p=S,l.d.f()}},At.preconnect=function(g,p){typeof g=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,l.d.C(g,p))},At.prefetchDNS=function(g){typeof g=="string"&&l.d.D(g)},At.preinit=function(g,p){if(typeof g=="string"&&p&&typeof p.as=="string"){var S=p.as,b=m(S,p.crossOrigin),T=typeof p.integrity=="string"?p.integrity:void 0,A=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;S==="style"?l.d.S(g,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:b,integrity:T,fetchPriority:A}):S==="script"&&l.d.X(g,{crossOrigin:b,integrity:T,fetchPriority:A,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},At.preinitModule=function(g,p){if(typeof g=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var S=m(p.as,p.crossOrigin);l.d.M(g,{crossOrigin:S,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&l.d.M(g)},At.preload=function(g,p){if(typeof g=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var S=p.as,b=m(S,p.crossOrigin);l.d.L(g,S,{crossOrigin:b,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})}},At.preloadModule=function(g,p){if(typeof g=="string")if(p){var S=m(p.as,p.crossOrigin);l.d.m(g,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:S,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else l.d.m(g)},At.requestFormReset=function(g){l.d.r(g)},At.unstable_batchedUpdates=function(g,p){return g(p)},At.useFormState=function(g,p,S){return h.H.useFormState(g,p,S)},At.useFormStatus=function(){return h.H.useHostTransitionStatus()},At.version="19.2.7",At}var kg;function l0(){if(kg)return ad.exports;kg=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(n){console.error(n)}}return i(),ad.exports=s0(),ad.exports}var Eg;function o0(){if(Eg)return Os;Eg=1;var i=r0(),n=zd(),r=l0();function l(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var t=e,a=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(a=t.return),e=t.return;while(e)}return t.tag===3?a:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(d(e)!==e)throw Error(l(188))}function p(e){var t=e.alternate;if(!t){if(t=d(e),t===null)throw Error(l(188));return t!==e?null:e}for(var a=e,s=t;;){var o=a.return;if(o===null)break;var u=o.alternate;if(u===null){if(s=o.return,s!==null){a=s;continue}break}if(o.child===u.child){for(u=o.child;u;){if(u===a)return g(o),e;if(u===s)return g(o),t;u=u.sibling}throw Error(l(188))}if(a.return!==s.return)a=o,s=u;else{for(var f=!1,v=o.child;v;){if(v===a){f=!0,a=o,s=u;break}if(v===s){f=!0,s=o,a=u;break}v=v.sibling}if(!f){for(v=u.child;v;){if(v===a){f=!0,a=u,s=o;break}if(v===s){f=!0,s=u,a=o;break}v=v.sibling}if(!f)throw Error(l(189))}}if(a.alternate!==s)throw Error(l(190))}if(a.tag!==3)throw Error(l(188));return a.stateNode.current===a?e:t}function S(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=S(e),t!==null)return t;e=e.sibling}return null}var b=Object.assign,T=Symbol.for("react.element"),A=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),U=Symbol.for("react.fragment"),$=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),q=Symbol.for("react.consumer"),N=Symbol.for("react.context"),Y=Symbol.for("react.forward_ref"),ue=Symbol.for("react.suspense"),G=Symbol.for("react.suspense_list"),Q=Symbol.for("react.memo"),Se=Symbol.for("react.lazy"),we=Symbol.for("react.activity"),Nt=Symbol.for("react.memo_cache_sentinel"),We=Symbol.iterator;function Le(e){return e===null||typeof e!="object"?null:(e=We&&e[We]||e["@@iterator"],typeof e=="function"?e:null)}var mt=Symbol.for("react.client.reference");function pt(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===mt?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case U:return"Fragment";case P:return"Profiler";case $:return"StrictMode";case ue:return"Suspense";case G:return"SuspenseList";case we:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case C:return"Portal";case N:return e.displayName||"Context";case q:return(e._context.displayName||"Context")+".Consumer";case Y:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Q:return t=e.displayName||null,t!==null?t:pt(e.type)||"Memo";case Se:t=e._payload,e=e._init;try{return pt(e(t))}catch{}}return null}var Ge=Array.isArray,D=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae={pending:!1,data:null,method:null,action:null},te=[],Ee=-1;function E(e){return{current:e}}function M(e){0>Ee||(e.current=te[Ee],te[Ee]=null,Ee--)}function J(e,t){Ee++,te[Ee]=e.current,e.current=t}var Z=E(null),de=E(null),me=E(null),xe=E(null);function Je(e,t){switch(J(me,t),J(de,e),J(Z,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?qm(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=qm(t),e=$m(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}M(Z),J(Z,e)}function Xe(){M(Z),M(de),M(me)}function kn(e){e.memoizedState!==null&&J(xe,e);var t=Z.current,a=$m(t,e.type);t!==a&&(J(de,e),J(Z,a))}function mn(e){de.current===e&&(M(Z),M(de)),xe.current===e&&(M(xe),ks._currentValue=ae)}var Ti,ki;function Dn(e){if(Ti===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);Ti=t&&t[1]||"",ki=-1<a.stack.indexOf(`
2
2
  at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
3
3
  `+Ti+e+ki}var Cr=!1;function ga(e,t){if(!e||Cr)return"";Cr=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var H=function(){throw Error()};if(Object.defineProperty(H.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(H,[])}catch(L){var j=L}Reflect.construct(e,[],H)}else{try{H.call()}catch(L){j=L}e.call(H.prototype)}}else{try{throw Error()}catch(L){j=L}(H=e())&&typeof H.catch=="function"&&H.catch(function(){})}}catch(L){if(L&&j&&typeof L.stack=="string")return[L.stack,j.stack]}return[null,null]}};s.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var o=Object.getOwnPropertyDescriptor(s.DetermineComponentFrameRoot,"name");o&&o.configurable&&Object.defineProperty(s.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=s.DetermineComponentFrameRoot(),f=u[0],v=u[1];if(f&&v){var _=f.split(`
4
4
  `),R=v.split(`
5
5
  `);for(o=s=0;s<_.length&&!_[s].includes("DetermineComponentFrameRoot");)s++;for(;o<R.length&&!R[o].includes("DetermineComponentFrameRoot");)o++;if(s===_.length||o===R.length)for(s=_.length-1,o=R.length-1;1<=s&&0<=o&&_[s]!==R[o];)o--;for(;1<=s&&0<=o;s--,o--)if(_[s]!==R[o]){if(s!==1||o!==1)do if(s--,o--,0>o||_[s]!==R[o]){var z=`
6
6
  `+_[s].replace(" at new "," at ");return e.displayName&&z.includes("<anonymous>")&&(z=z.replace("<anonymous>",e.displayName)),z}while(1<=s&&0<=o);break}}}finally{Cr=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Dn(a):""}function Yo(e,t){switch(e.tag){case 26:case 27:case 5:return Dn(e.type);case 16:return Dn("Lazy");case 13:return e.child!==t&&t!==null?Dn("Suspense Fallback"):Dn("Suspense");case 19:return Dn("SuspenseList");case 0:case 15:return ga(e.type,!1);case 11:return ga(e.type.render,!1);case 1:return ga(e.type,!0);case 31:return Dn("Activity");default:return""}}function Ae(e){try{var t="",a=null;do t+=Yo(e,a),a=e,e=e.return;while(e);return t}catch(s){return`
7
7
  Error generating stack: `+s.message+`
8
- `+s.stack}}var Ei=Object.prototype.hasOwnProperty,Un=i.unstable_scheduleCallback,Ai=i.unstable_cancelCallback,xi=i.unstable_shouldYield,Mn=i.unstable_requestPaint,Ot=i.unstable_now,Or=i.unstable_getCurrentPriorityLevel,Rr=i.unstable_ImmediatePriority,Ci=i.unstable_UserBlockingPriority,Ja=i.unstable_NormalPriority,He=i.unstable_LowPriority,tl=i.unstable_IdlePriority,tn=i.log,Jo=i.unstable_setDisableYieldValue,pa=null,St=null;function Lt(e){if(typeof tn=="function"&&Jo(e),St&&typeof St.setStrictMode=="function")try{St.setStrictMode(pa,e)}catch{}}var lt=Math.clz32?Math.clz32:Xo,se=Math.log,nn=Math.LN2;function Xo(e){return e>>>=0,e===0?32:31-(se(e)/nn|0)|0}var ya=256,Xa=262144,ot=4194304;function Dt(e){var t=e&42;if(t!==0)return t;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 va(e,t,a){var s=e.pendingLanes;if(s===0)return 0;var o=0,u=e.suspendedLanes,f=e.pingedLanes;e=e.warmLanes;var v=s&134217727;return v!==0?(s=v&~u,s!==0?o=Dt(s):(f&=v,f!==0?o=Dt(f):a||(a=v&~e,a!==0&&(o=Dt(a))))):(v=s&~u,v!==0?o=Dt(v):f!==0?o=Dt(f):a||(a=s&~e,a!==0&&(o=Dt(a)))),o===0?0:t!==0&&t!==o&&(t&u)===0&&(u=o&-o,a=t&-t,u>=a||u===32&&(a&4194048)!==0)?t:o}function En(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function nl(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 jr(){var e=ot;return ot<<=1,(ot&62914560)===0&&(ot=4194304),e}function Nr(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function zn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Qo(e,t,a,s,o,u){var f=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var v=e.entanglements,_=e.expirationTimes,R=e.hiddenUpdates;for(a=f&~a;0<a;){var z=31-lt(a),H=1<<z;v[z]=0,_[z]=-1;var j=R[z];if(j!==null)for(R[z]=null,z=0;z<j.length;z++){var L=j[z];L!==null&&(L.lane&=-536870913)}a&=~H}s!==0&&Lr(e,s,0),u!==0&&o===0&&e.tag!==0&&(e.suspendedLanes|=u&~(f&~t))}function Lr(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-lt(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|a&261930}function Dr(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var s=31-lt(a),o=1<<s;o&t|e[s]&t&&(e[s]|=t),a&=~o}}function Ur(e,t){var a=t&-t;return a=(a&42)!==0?1:Oi(a),(a&(e.suspendedLanes|t))!==0?0:a}function Oi(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 Qa(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Mr(){var e=K.p;return e!==0?e:(e=window.event,e===void 0?32:ug(e.type))}function al(e,t){var a=K.p;try{return K.p=e,t()}finally{K.p=a}}var Vt=Math.random().toString(36).slice(2),Ve="__reactFiber$"+Vt,wt="__reactProps$"+Vt,Bn="__reactContainer$"+Vt,Hn="__reactEvents$"+Vt,il="__reactListeners$"+Vt,rl="__reactHandles$"+Vt,ba="__reactResources$"+Vt,Sa="__reactMarker$"+Vt;function zr(e){delete e[Ve],delete e[wt],delete e[Hn],delete e[il],delete e[rl]}function qn(e){var t=e[Ve];if(t)return t;for(var a=e.parentNode;a;){if(t=a[Bn]||a[Ve]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=Jm(e);e!==null;){if(a=e[Ve])return a;e=Jm(e)}return t}e=a,a=e.parentNode}return null}function wa(e){if(e=e[Ve]||e[Bn]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Wa(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(l(33))}function $n(e){var t=e[ba];return t||(t=e[ba]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function qe(e){e[Sa]=!0}var Br=new Set,sl={};function Pn(e,t){In(e,t),In(e+"Capture",t)}function In(e,t){for(sl[e]=t,e=0;e<t.length;e++)Br.add(t[e])}var ll=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]*$"),Hr={},qr={};function ol(e){return Ei.call(qr,e)?!0:Ei.call(Hr,e)?!1:ll.test(e)?qr[e]=!0:(Hr[e]=!0,!1)}function Ri(e,t,a){if(ol(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var s=t.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+a)}}function Gn(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+a)}}function mn(e,t,a,s){if(s===null)e.removeAttribute(a);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,""+s)}}function Ut(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function yt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ji(e,t,a){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var o=s.get,u=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(f){a=""+f,u.call(this,f)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return a},setValue:function(f){a=""+f},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Za(e){if(!e._valueTracker){var t=yt(e)?"checked":"value";e._valueTracker=ji(e,t,""+e[t])}}function cl(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),s="";return e&&(s=yt(e)?e.checked?"true":"false":e.value),e=s,e!==a?(t.setValue(e),!0):!1}function $r(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 Wo=/[\n"\\]/g;function Mt(e){return e.replace(Wo,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Ni(e,t,a,s,o,u,f,v){e.name="",f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?e.type=f:e.removeAttribute("type"),t!=null?f==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Ut(t)):e.value!==""+Ut(t)&&(e.value=""+Ut(t)):f!=="submit"&&f!=="reset"||e.removeAttribute("value"),t!=null?Vn(e,f,Ut(t)):a!=null?Vn(e,f,Ut(a)):s!=null&&e.removeAttribute("value"),o==null&&u!=null&&(e.defaultChecked=!!u),o!=null&&(e.checked=o&&typeof o!="function"&&typeof o!="symbol"),v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?e.name=""+Ut(v):e.removeAttribute("name")}function Fa(e,t,a,s,o,u,f,v){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||a!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){Za(e);return}a=a!=null?""+Ut(a):"",t=t!=null?""+Ut(t):a,v||t===e.value||(e.value=t),e.defaultValue=t}s=s??o,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=v?e.checked:!!s,e.defaultChecked=!!s,f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.name=f),Za(e)}function Vn(e,t,a){t==="number"&&$r(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Kn(e,t,a,s){if(e=e.options,t){t={};for(var o=0;o<a.length;o++)t["$"+a[o]]=!0;for(a=0;a<e.length;a++)o=t.hasOwnProperty("$"+e[a].value),e[a].selected!==o&&(e[a].selected=o),o&&s&&(e[a].defaultSelected=!0)}else{for(a=""+Ut(a),t=null,o=0;o<e.length;o++){if(e[o].value===a){e[o].selected=!0,s&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function ul(e,t,a){if(t!=null&&(t=""+Ut(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+Ut(a):""}function dl(e,t,a,s){if(t==null){if(s!=null){if(a!=null)throw Error(l(92));if(Ge(s)){if(1<s.length)throw Error(l(93));s=s[0]}a=s}a==null&&(a=""),t=a}a=Ut(t),e.defaultValue=a,s=e.textContent,s===a&&s!==""&&s!==null&&(e.value=s),Za(e)}function _a(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var Zo=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 Yn(e,t,a){var s=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?s?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":s?e.setProperty(t,a):typeof a!="number"||a===0||Zo.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function hl(e,t,a){if(t!=null&&typeof t!="object")throw Error(l(62));if(e=e.style,a!=null){for(var s in a)!a.hasOwnProperty(s)||t!=null&&t.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var o in t)s=t[o],t.hasOwnProperty(o)&&a[o]!==s&&Yn(e,o,s)}else for(var u in t)t.hasOwnProperty(u)&&Yn(e,u,t[u])}function Pr(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 w=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"]]),V=/^[\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 ie(e){return V.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function W(){}var fe=null;function ce(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ye=null,tt=null;function Ke(e){var t=wa(e);if(t&&(e=t.stateNode)){var a=e[wt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Ni(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Mt(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var s=a[t];if(s!==e&&s.form===e.form){var o=s[wt]||null;if(!o)throw Error(l(90));Ni(s,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name)}}for(t=0;t<a.length;t++)s=a[t],s.form===e.form&&cl(s)}break e;case"textarea":ul(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&Kn(e,!!a.multiple,t,!1)}}}var nt=!1;function fl(e,t,a){if(nt)return e(t,a);nt=!0;try{var s=e(t);return s}finally{if(nt=!1,(ye!==null||tt!==null)&&(eo(),ye&&(t=ye,e=tt,tt=ye=null,Ke(t),e)))for(t=0;t<e.length;t++)Ke(e[t])}}function ei(e,t){var a=e.stateNode;if(a===null)return null;var s=a[wt]||null;if(s===null)return null;a=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(l(231,t,typeof a));return a}var Kt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Li=!1;if(Kt)try{var Jn={};Object.defineProperty(Jn,"passive",{get:function(){Li=!0}}),window.addEventListener("test",Jn,Jn),window.removeEventListener("test",Jn,Jn)}catch{Li=!1}var Ta=null,Fo=null,ml=null;function qd(){if(ml)return ml;var e,t=Fo,a=t.length,s,o="value"in Ta?Ta.value:Ta.textContent,u=o.length;for(e=0;e<a&&t[e]===o[e];e++);var f=a-e;for(s=1;s<=f&&t[a-s]===o[u-s];s++);return ml=o.slice(e,1<s?1-s:void 0)}function gl(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function pl(){return!0}function $d(){return!1}function zt(e){function t(a,s,o,u,f){this._reactName=a,this._targetInst=o,this.type=s,this.nativeEvent=u,this.target=f,this.currentTarget=null;for(var v in e)e.hasOwnProperty(v)&&(a=e[v],this[v]=a?a(u):u[v]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?pl:$d,this.isPropagationStopped=$d,this}return b(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=pl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=pl)},persist:function(){},isPersistent:pl}),t}var ti={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},yl=zt(ti),Ir=b({},ti,{view:0,detail:0}),Zp=zt(Ir),ec,tc,Gr,vl=b({},Ir,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ac,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!==Gr&&(Gr&&e.type==="mousemove"?(ec=e.screenX-Gr.screenX,tc=e.screenY-Gr.screenY):tc=ec=0,Gr=e),ec)},movementY:function(e){return"movementY"in e?e.movementY:tc}}),Pd=zt(vl),Fp=b({},vl,{dataTransfer:0}),ey=zt(Fp),ty=b({},Ir,{relatedTarget:0}),nc=zt(ty),ny=b({},ti,{animationName:0,elapsedTime:0,pseudoElement:0}),ay=zt(ny),iy=b({},ti,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),ry=zt(iy),sy=b({},ti,{data:0}),Id=zt(sy),ly={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},oy={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"},cy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function uy(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=cy[e])?!!t[e]:!1}function ac(){return uy}var dy=b({},Ir,{key:function(e){if(e.key){var t=ly[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=gl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?oy[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ac,charCode:function(e){return e.type==="keypress"?gl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?gl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),hy=zt(dy),fy=b({},vl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Gd=zt(fy),my=b({},Ir,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ac}),gy=zt(my),py=b({},ti,{propertyName:0,elapsedTime:0,pseudoElement:0}),yy=zt(py),vy=b({},vl,{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}),by=zt(vy),Sy=b({},ti,{newState:0,oldState:0}),wy=zt(Sy),_y=[9,13,27,32],ic=Kt&&"CompositionEvent"in window,Vr=null;Kt&&"documentMode"in document&&(Vr=document.documentMode);var Ty=Kt&&"TextEvent"in window&&!Vr,Vd=Kt&&(!ic||Vr&&8<Vr&&11>=Vr),Kd=" ",Yd=!1;function Jd(e,t){switch(e){case"keyup":return _y.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Di=!1;function ky(e,t){switch(e){case"compositionend":return Xd(t);case"keypress":return t.which!==32?null:(Yd=!0,Kd);case"textInput":return e=t.data,e===Kd&&Yd?null:e;default:return null}}function Ey(e,t){if(Di)return e==="compositionend"||!ic&&Jd(e,t)?(e=qd(),ml=Fo=Ta=null,Di=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Vd&&t.locale!=="ko"?null:t.data;default:return null}}var Ay={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 Qd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Ay[e.type]:t==="textarea"}function Wd(e,t,a,s){ye?tt?tt.push(s):tt=[s]:ye=s,t=lo(t,"onChange"),0<t.length&&(a=new yl("onChange","change",null,a,s),e.push({event:a,listeners:t}))}var Kr=null,Yr=null;function xy(e){Dm(e,0)}function bl(e){var t=Wa(e);if(cl(t))return e}function Zd(e,t){if(e==="change")return t}var Fd=!1;if(Kt){var rc;if(Kt){var sc="oninput"in document;if(!sc){var eh=document.createElement("div");eh.setAttribute("oninput","return;"),sc=typeof eh.oninput=="function"}rc=sc}else rc=!1;Fd=rc&&(!document.documentMode||9<document.documentMode)}function th(){Kr&&(Kr.detachEvent("onpropertychange",nh),Yr=Kr=null)}function nh(e){if(e.propertyName==="value"&&bl(Yr)){var t=[];Wd(t,Yr,e,ce(e)),fl(xy,t)}}function Cy(e,t,a){e==="focusin"?(th(),Kr=t,Yr=a,Kr.attachEvent("onpropertychange",nh)):e==="focusout"&&th()}function Oy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return bl(Yr)}function Ry(e,t){if(e==="click")return bl(t)}function jy(e,t){if(e==="input"||e==="change")return bl(t)}function Ny(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Yt=typeof Object.is=="function"?Object.is:Ny;function Jr(e,t){if(Yt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),s=Object.keys(t);if(a.length!==s.length)return!1;for(s=0;s<a.length;s++){var o=a[s];if(!Ei.call(t,o)||!Yt(e[o],t[o]))return!1}return!0}function ah(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ih(e,t){var a=ah(e);e=0;for(var s;a;){if(a.nodeType===3){if(s=e+a.textContent.length,e<=t&&s>=t)return{node:a,offset:t-e};e=s}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=ah(a)}}function rh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?rh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function sh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=$r(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=$r(e.document)}return t}function lc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Ly=Kt&&"documentMode"in document&&11>=document.documentMode,Ui=null,oc=null,Xr=null,cc=!1;function lh(e,t,a){var s=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;cc||Ui==null||Ui!==$r(s)||(s=Ui,"selectionStart"in s&&lc(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Xr&&Jr(Xr,s)||(Xr=s,s=lo(oc,"onSelect"),0<s.length&&(t=new yl("onSelect","select",null,t,a),e.push({event:t,listeners:s}),t.target=Ui)))}function ni(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var Mi={animationend:ni("Animation","AnimationEnd"),animationiteration:ni("Animation","AnimationIteration"),animationstart:ni("Animation","AnimationStart"),transitionrun:ni("Transition","TransitionRun"),transitionstart:ni("Transition","TransitionStart"),transitioncancel:ni("Transition","TransitionCancel"),transitionend:ni("Transition","TransitionEnd")},uc={},oh={};Kt&&(oh=document.createElement("div").style,"AnimationEvent"in window||(delete Mi.animationend.animation,delete Mi.animationiteration.animation,delete Mi.animationstart.animation),"TransitionEvent"in window||delete Mi.transitionend.transition);function ai(e){if(uc[e])return uc[e];if(!Mi[e])return e;var t=Mi[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in oh)return uc[e]=t[a];return e}var ch=ai("animationend"),uh=ai("animationiteration"),dh=ai("animationstart"),Dy=ai("transitionrun"),Uy=ai("transitionstart"),My=ai("transitioncancel"),hh=ai("transitionend"),fh=new Map,dc="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(" ");dc.push("scrollEnd");function gn(e,t){fh.set(e,t),Pn(t,[e])}var Sl=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=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(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},an=[],zi=0,hc=0;function wl(){for(var e=zi,t=hc=zi=0;t<e;){var a=an[t];an[t++]=null;var s=an[t];an[t++]=null;var o=an[t];an[t++]=null;var u=an[t];if(an[t++]=null,s!==null&&o!==null){var f=s.pending;f===null?o.next=o:(o.next=f.next,f.next=o),s.pending=o}u!==0&&mh(a,o,u)}}function _l(e,t,a,s){an[zi++]=e,an[zi++]=t,an[zi++]=a,an[zi++]=s,hc|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function fc(e,t,a,s){return _l(e,t,a,s),Tl(e)}function ii(e,t){return _l(e,null,null,t),Tl(e)}function mh(e,t,a){e.lanes|=a;var s=e.alternate;s!==null&&(s.lanes|=a);for(var o=!1,u=e.return;u!==null;)u.childLanes|=a,s=u.alternate,s!==null&&(s.childLanes|=a),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(o=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,o&&t!==null&&(o=31-lt(a),e=u.hiddenUpdates,s=e[o],s===null?e[o]=[t]:s.push(t),t.lane=a|536870912),u):null}function Tl(e){if(50<ys)throw ys=0,_u=null,Error(l(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Bi={};function zy(e,t,a,s){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Jt(e,t,a,s){return new zy(e,t,a,s)}function mc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Xn(e,t){var a=e.alternate;return a===null?(a=Jt(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function gh(e,t){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,t=a.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function kl(e,t,a,s,o,u){var f=0;if(s=e,typeof e=="function")mc(e)&&(f=1);else if(typeof e=="string")f=Pv(e,a,Z.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case we:return e=Jt(31,a,t,o),e.elementType=we,e.lanes=u,e;case U:return ri(a.children,o,u,t);case $:f=8,o|=24;break;case P:return e=Jt(12,a,t,o|2),e.elementType=P,e.lanes=u,e;case ue:return e=Jt(13,a,t,o),e.elementType=ue,e.lanes=u,e;case G:return e=Jt(19,a,t,o),e.elementType=G,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case N:f=10;break e;case q:f=9;break e;case Y:f=11;break e;case Q:f=14;break e;case Se:f=16,s=null;break e}f=29,a=Error(l(130,e===null?"null":typeof e,"")),s=null}return t=Jt(f,a,t,o),t.elementType=e,t.type=s,t.lanes=u,t}function ri(e,t,a,s){return e=Jt(7,e,s,t),e.lanes=a,e}function gc(e,t,a){return e=Jt(6,e,null,t),e.lanes=a,e}function ph(e){var t=Jt(18,null,null,0);return t.stateNode=e,t}function pc(e,t,a){return t=Jt(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var yh=new WeakMap;function rn(e,t){if(typeof e=="object"&&e!==null){var a=yh.get(e);return a!==void 0?a:(t={value:e,source:t,stack:Ae(t)},yh.set(e,t),t)}return{value:e,source:t,stack:Ae(t)}}var Hi=[],qi=0,El=null,Qr=0,sn=[],ln=0,ka=null,An=1,xn="";function Qn(e,t){Hi[qi++]=Qr,Hi[qi++]=El,El=e,Qr=t}function vh(e,t,a){sn[ln++]=An,sn[ln++]=xn,sn[ln++]=ka,ka=e;var s=An;e=xn;var o=32-lt(s)-1;s&=~(1<<o),a+=1;var u=32-lt(t)+o;if(30<u){var f=o-o%5;u=(s&(1<<f)-1).toString(32),s>>=f,o-=f,An=1<<32-lt(t)+o|a<<o|s,xn=u+e}else An=1<<u|a<<o|s,xn=e}function yc(e){e.return!==null&&(Qn(e,1),vh(e,1,0))}function vc(e){for(;e===El;)El=Hi[--qi],Hi[qi]=null,Qr=Hi[--qi],Hi[qi]=null;for(;e===ka;)ka=sn[--ln],sn[ln]=null,xn=sn[--ln],sn[ln]=null,An=sn[--ln],sn[ln]=null}function bh(e,t){sn[ln++]=An,sn[ln++]=xn,sn[ln++]=ka,An=t.id,xn=t.overflow,ka=e}var _t=null,Pe=null,ke=!1,Ea=null,on=!1,bc=Error(l(519));function Aa(e){var t=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Wr(rn(t,e)),bc}function Sh(e){var t=e.stateNode,a=e.type,s=e.memoizedProps;switch(t[Ve]=e,t[wt]=s,a){case"dialog":be("cancel",t),be("close",t);break;case"iframe":case"object":case"embed":be("load",t);break;case"video":case"audio":for(a=0;a<bs.length;a++)be(bs[a],t);break;case"source":be("error",t);break;case"img":case"image":case"link":be("error",t),be("load",t);break;case"details":be("toggle",t);break;case"input":be("invalid",t),Fa(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":be("invalid",t);break;case"textarea":be("invalid",t),dl(t,s.value,s.defaultValue,s.children)}a=s.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||s.suppressHydrationWarning===!0||Bm(t.textContent,a)?(s.popover!=null&&(be("beforetoggle",t),be("toggle",t)),s.onScroll!=null&&be("scroll",t),s.onScrollEnd!=null&&be("scrollend",t),s.onClick!=null&&(t.onclick=W),t=!0):t=!1,t||Aa(e,!0)}function wh(e){for(_t=e.return;_t;)switch(_t.tag){case 5:case 31:case 13:on=!1;return;case 27:case 3:on=!0;return;default:_t=_t.return}}function $i(e){if(e!==_t)return!1;if(!ke)return wh(e),ke=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||zu(e.type,e.memoizedProps)),a=!a),a&&Pe&&Aa(e),wh(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Pe=Ym(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Pe=Ym(e)}else t===27?(t=Pe,qa(e.type)?(e=Pu,Pu=null,Pe=e):Pe=t):Pe=_t?un(e.stateNode.nextSibling):null;return!0}function si(){Pe=_t=null,ke=!1}function Sc(){var e=Ea;return e!==null&&($t===null?$t=e:$t.push.apply($t,e),Ea=null),e}function Wr(e){Ea===null?Ea=[e]:Ea.push(e)}var wc=E(null),li=null,Wn=null;function xa(e,t,a){J(wc,t._currentValue),t._currentValue=a}function Zn(e){e._currentValue=wc.current,M(wc)}function _c(e,t,a){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===a)break;e=e.return}}function Tc(e,t,a,s){var o=e.child;for(o!==null&&(o.return=e);o!==null;){var u=o.dependencies;if(u!==null){var f=o.child;u=u.firstContext;e:for(;u!==null;){var v=u;u=o;for(var _=0;_<t.length;_++)if(v.context===t[_]){u.lanes|=a,v=u.alternate,v!==null&&(v.lanes|=a),_c(u.return,a,e),s||(f=null);break e}u=v.next}}else if(o.tag===18){if(f=o.return,f===null)throw Error(l(341));f.lanes|=a,u=f.alternate,u!==null&&(u.lanes|=a),_c(f,a,e),f=null}else f=o.child;if(f!==null)f.return=o;else for(f=o;f!==null;){if(f===e){f=null;break}if(o=f.sibling,o!==null){o.return=f.return,f=o;break}f=f.return}o=f}}function Pi(e,t,a,s){e=null;for(var o=t,u=!1;o!==null;){if(!u){if((o.flags&524288)!==0)u=!0;else if((o.flags&262144)!==0)break}if(o.tag===10){var f=o.alternate;if(f===null)throw Error(l(387));if(f=f.memoizedProps,f!==null){var v=o.type;Yt(o.pendingProps.value,f.value)||(e!==null?e.push(v):e=[v])}}else if(o===xe.current){if(f=o.alternate,f===null)throw Error(l(387));f.memoizedState.memoizedState!==o.memoizedState.memoizedState&&(e!==null?e.push(ks):e=[ks])}o=o.return}e!==null&&Tc(t,e,a,s),t.flags|=262144}function Al(e){for(e=e.firstContext;e!==null;){if(!Yt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function oi(e){li=e,Wn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Tt(e){return _h(li,e)}function xl(e,t){return li===null&&oi(e),_h(e,t)}function _h(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},Wn===null){if(e===null)throw Error(l(308));Wn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Wn=Wn.next=t;return a}var By=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,s){e.push(s)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},Hy=i.unstable_scheduleCallback,qy=i.unstable_NormalPriority,ct={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function kc(){return{controller:new By,data:new Map,refCount:0}}function Zr(e){e.refCount--,e.refCount===0&&Hy(qy,function(){e.controller.abort()})}var Fr=null,Ec=0,Ii=0,Gi=null;function $y(e,t){if(Fr===null){var a=Fr=[];Ec=0,Ii=Cu(),Gi={status:"pending",value:void 0,then:function(s){a.push(s)}}}return Ec++,t.then(Th,Th),t}function Th(){if(--Ec===0&&Fr!==null){Gi!==null&&(Gi.status="fulfilled");var e=Fr;Fr=null,Ii=0,Gi=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Py(e,t){var a=[],s={status:"pending",value:null,reason:null,then:function(o){a.push(o)}};return e.then(function(){s.status="fulfilled",s.value=t;for(var o=0;o<a.length;o++)(0,a[o])(t)},function(o){for(s.status="rejected",s.reason=o,o=0;o<a.length;o++)(0,a[o])(void 0)}),s}var kh=D.S;D.S=function(e,t){om=Ot(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&$y(e,t),kh!==null&&kh(e,t)};var ci=E(null);function Ac(){var e=ci.current;return e!==null?e:Be.pooledCache}function Cl(e,t){t===null?J(ci,ci.current):J(ci,t.pool)}function Eh(){var e=Ac();return e===null?null:{parent:ct._currentValue,pool:e}}var Vi=Error(l(460)),xc=Error(l(474)),Ol=Error(l(542)),Rl={then:function(){}};function Ah(e){return e=e.status,e==="fulfilled"||e==="rejected"}function xh(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(W,W),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Oh(e),e;default:if(typeof t.status=="string")t.then(W,W);else{if(e=Be,e!==null&&100<e.shellSuspendCounter)throw Error(l(482));e=t,e.status="pending",e.then(function(s){if(t.status==="pending"){var o=t;o.status="fulfilled",o.value=s}},function(s){if(t.status==="pending"){var o=t;o.status="rejected",o.reason=s}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Oh(e),e}throw di=t,Vi}}function ui(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(di=a,Vi):a}}var di=null;function Ch(){if(di===null)throw Error(l(459));var e=di;return di=null,e}function Oh(e){if(e===Vi||e===Ol)throw Error(l(483))}var Ki=null,es=0;function jl(e){var t=es;return es+=1,Ki===null&&(Ki=[]),xh(Ki,e,t)}function ts(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Nl(e,t){throw t.$$typeof===T?Error(l(525)):(e=Object.prototype.toString.call(t),Error(l(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Rh(e){function t(x,k){if(e){var O=x.deletions;O===null?(x.deletions=[k],x.flags|=16):O.push(k)}}function a(x,k){if(!e)return null;for(;k!==null;)t(x,k),k=k.sibling;return null}function s(x){for(var k=new Map;x!==null;)x.key!==null?k.set(x.key,x):k.set(x.index,x),x=x.sibling;return k}function o(x,k){return x=Xn(x,k),x.index=0,x.sibling=null,x}function u(x,k,O){return x.index=O,e?(O=x.alternate,O!==null?(O=O.index,O<k?(x.flags|=67108866,k):O):(x.flags|=67108866,k)):(x.flags|=1048576,k)}function f(x){return e&&x.alternate===null&&(x.flags|=67108866),x}function v(x,k,O,B){return k===null||k.tag!==6?(k=gc(O,x.mode,B),k.return=x,k):(k=o(k,O),k.return=x,k)}function _(x,k,O,B){var re=O.type;return re===U?z(x,k,O.props.children,B,O.key):k!==null&&(k.elementType===re||typeof re=="object"&&re!==null&&re.$$typeof===Se&&ui(re)===k.type)?(k=o(k,O.props),ts(k,O),k.return=x,k):(k=kl(O.type,O.key,O.props,null,x.mode,B),ts(k,O),k.return=x,k)}function R(x,k,O,B){return k===null||k.tag!==4||k.stateNode.containerInfo!==O.containerInfo||k.stateNode.implementation!==O.implementation?(k=pc(O,x.mode,B),k.return=x,k):(k=o(k,O.children||[]),k.return=x,k)}function z(x,k,O,B,re){return k===null||k.tag!==7?(k=ri(O,x.mode,B,re),k.return=x,k):(k=o(k,O),k.return=x,k)}function H(x,k,O){if(typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint")return k=gc(""+k,x.mode,O),k.return=x,k;if(typeof k=="object"&&k!==null){switch(k.$$typeof){case A:return O=kl(k.type,k.key,k.props,null,x.mode,O),ts(O,k),O.return=x,O;case C:return k=pc(k,x.mode,O),k.return=x,k;case Se:return k=ui(k),H(x,k,O)}if(Ge(k)||Le(k))return k=ri(k,x.mode,O,null),k.return=x,k;if(typeof k.then=="function")return H(x,jl(k),O);if(k.$$typeof===N)return H(x,xl(x,k),O);Nl(x,k)}return null}function j(x,k,O,B){var re=k!==null?k.key:null;if(typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint")return re!==null?null:v(x,k,""+O,B);if(typeof O=="object"&&O!==null){switch(O.$$typeof){case A:return O.key===re?_(x,k,O,B):null;case C:return O.key===re?R(x,k,O,B):null;case Se:return O=ui(O),j(x,k,O,B)}if(Ge(O)||Le(O))return re!==null?null:z(x,k,O,B,null);if(typeof O.then=="function")return j(x,k,jl(O),B);if(O.$$typeof===N)return j(x,k,xl(x,O),B);Nl(x,O)}return null}function L(x,k,O,B,re){if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return x=x.get(O)||null,v(k,x,""+B,re);if(typeof B=="object"&&B!==null){switch(B.$$typeof){case A:return x=x.get(B.key===null?O:B.key)||null,_(k,x,B,re);case C:return x=x.get(B.key===null?O:B.key)||null,R(k,x,B,re);case Se:return B=ui(B),L(x,k,O,B,re)}if(Ge(B)||Le(B))return x=x.get(O)||null,z(k,x,B,re,null);if(typeof B.then=="function")return L(x,k,O,jl(B),re);if(B.$$typeof===N)return L(x,k,O,xl(k,B),re);Nl(k,B)}return null}function F(x,k,O,B){for(var re=null,Ce=null,ne=k,pe=k=0,Te=null;ne!==null&&pe<O.length;pe++){ne.index>pe?(Te=ne,ne=null):Te=ne.sibling;var Oe=j(x,ne,O[pe],B);if(Oe===null){ne===null&&(ne=Te);break}e&&ne&&Oe.alternate===null&&t(x,ne),k=u(Oe,k,pe),Ce===null?re=Oe:Ce.sibling=Oe,Ce=Oe,ne=Te}if(pe===O.length)return a(x,ne),ke&&Qn(x,pe),re;if(ne===null){for(;pe<O.length;pe++)ne=H(x,O[pe],B),ne!==null&&(k=u(ne,k,pe),Ce===null?re=ne:Ce.sibling=ne,Ce=ne);return ke&&Qn(x,pe),re}for(ne=s(ne);pe<O.length;pe++)Te=L(ne,x,pe,O[pe],B),Te!==null&&(e&&Te.alternate!==null&&ne.delete(Te.key===null?pe:Te.key),k=u(Te,k,pe),Ce===null?re=Te:Ce.sibling=Te,Ce=Te);return e&&ne.forEach(function(Va){return t(x,Va)}),ke&&Qn(x,pe),re}function oe(x,k,O,B){if(O==null)throw Error(l(151));for(var re=null,Ce=null,ne=k,pe=k=0,Te=null,Oe=O.next();ne!==null&&!Oe.done;pe++,Oe=O.next()){ne.index>pe?(Te=ne,ne=null):Te=ne.sibling;var Va=j(x,ne,Oe.value,B);if(Va===null){ne===null&&(ne=Te);break}e&&ne&&Va.alternate===null&&t(x,ne),k=u(Va,k,pe),Ce===null?re=Va:Ce.sibling=Va,Ce=Va,ne=Te}if(Oe.done)return a(x,ne),ke&&Qn(x,pe),re;if(ne===null){for(;!Oe.done;pe++,Oe=O.next())Oe=H(x,Oe.value,B),Oe!==null&&(k=u(Oe,k,pe),Ce===null?re=Oe:Ce.sibling=Oe,Ce=Oe);return ke&&Qn(x,pe),re}for(ne=s(ne);!Oe.done;pe++,Oe=O.next())Oe=L(ne,x,pe,Oe.value,B),Oe!==null&&(e&&Oe.alternate!==null&&ne.delete(Oe.key===null?pe:Oe.key),k=u(Oe,k,pe),Ce===null?re=Oe:Ce.sibling=Oe,Ce=Oe);return e&&ne.forEach(function(Fv){return t(x,Fv)}),ke&&Qn(x,pe),re}function Me(x,k,O,B){if(typeof O=="object"&&O!==null&&O.type===U&&O.key===null&&(O=O.props.children),typeof O=="object"&&O!==null){switch(O.$$typeof){case A:e:{for(var re=O.key;k!==null;){if(k.key===re){if(re=O.type,re===U){if(k.tag===7){a(x,k.sibling),B=o(k,O.props.children),B.return=x,x=B;break e}}else if(k.elementType===re||typeof re=="object"&&re!==null&&re.$$typeof===Se&&ui(re)===k.type){a(x,k.sibling),B=o(k,O.props),ts(B,O),B.return=x,x=B;break e}a(x,k);break}else t(x,k);k=k.sibling}O.type===U?(B=ri(O.props.children,x.mode,B,O.key),B.return=x,x=B):(B=kl(O.type,O.key,O.props,null,x.mode,B),ts(B,O),B.return=x,x=B)}return f(x);case C:e:{for(re=O.key;k!==null;){if(k.key===re)if(k.tag===4&&k.stateNode.containerInfo===O.containerInfo&&k.stateNode.implementation===O.implementation){a(x,k.sibling),B=o(k,O.children||[]),B.return=x,x=B;break e}else{a(x,k);break}else t(x,k);k=k.sibling}B=pc(O,x.mode,B),B.return=x,x=B}return f(x);case Se:return O=ui(O),Me(x,k,O,B)}if(Ge(O))return F(x,k,O,B);if(Le(O)){if(re=Le(O),typeof re!="function")throw Error(l(150));return O=re.call(O),oe(x,k,O,B)}if(typeof O.then=="function")return Me(x,k,jl(O),B);if(O.$$typeof===N)return Me(x,k,xl(x,O),B);Nl(x,O)}return typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint"?(O=""+O,k!==null&&k.tag===6?(a(x,k.sibling),B=o(k,O),B.return=x,x=B):(a(x,k),B=gc(O,x.mode,B),B.return=x,x=B),f(x)):a(x,k)}return function(x,k,O,B){try{es=0;var re=Me(x,k,O,B);return Ki=null,re}catch(ne){if(ne===Vi||ne===Ol)throw ne;var Ce=Jt(29,ne,null,x.mode);return Ce.lanes=B,Ce.return=x,Ce}}}var hi=Rh(!0),jh=Rh(!1),Ca=!1;function Cc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Oc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Oa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ra(e,t,a){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Re&2)!==0){var o=s.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),s.pending=t,t=Tl(e),mh(e,null,a),t}return _l(e,s,t,a),Tl(e)}function ns(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,a|=s,t.lanes=a,Dr(e,a)}}function Rc(e,t){var a=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,a===s)){var o=null,u=null;if(a=a.firstBaseUpdate,a!==null){do{var f={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};u===null?o=u=f:u=u.next=f,a=a.next}while(a!==null);u===null?o=u=t:u=u.next=t}else o=u=t;a={baseState:s.baseState,firstBaseUpdate:o,lastBaseUpdate:u,shared:s.shared,callbacks:s.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var jc=!1;function as(){if(jc){var e=Gi;if(e!==null)throw e}}function is(e,t,a,s){jc=!1;var o=e.updateQueue;Ca=!1;var u=o.firstBaseUpdate,f=o.lastBaseUpdate,v=o.shared.pending;if(v!==null){o.shared.pending=null;var _=v,R=_.next;_.next=null,f===null?u=R:f.next=R,f=_;var z=e.alternate;z!==null&&(z=z.updateQueue,v=z.lastBaseUpdate,v!==f&&(v===null?z.firstBaseUpdate=R:v.next=R,z.lastBaseUpdate=_))}if(u!==null){var H=o.baseState;f=0,z=R=_=null,v=u;do{var j=v.lane&-536870913,L=j!==v.lane;if(L?(_e&j)===j:(s&j)===j){j!==0&&j===Ii&&(jc=!0),z!==null&&(z=z.next={lane:0,tag:v.tag,payload:v.payload,callback:null,next:null});e:{var F=e,oe=v;j=t;var Me=a;switch(oe.tag){case 1:if(F=oe.payload,typeof F=="function"){H=F.call(Me,H,j);break e}H=F;break e;case 3:F.flags=F.flags&-65537|128;case 0:if(F=oe.payload,j=typeof F=="function"?F.call(Me,H,j):F,j==null)break e;H=b({},H,j);break e;case 2:Ca=!0}}j=v.callback,j!==null&&(e.flags|=64,L&&(e.flags|=8192),L=o.callbacks,L===null?o.callbacks=[j]:L.push(j))}else L={lane:j,tag:v.tag,payload:v.payload,callback:v.callback,next:null},z===null?(R=z=L,_=H):z=z.next=L,f|=j;if(v=v.next,v===null){if(v=o.shared.pending,v===null)break;L=v,v=L.next,L.next=null,o.lastBaseUpdate=L,o.shared.pending=null}}while(!0);z===null&&(_=H),o.baseState=_,o.firstBaseUpdate=R,o.lastBaseUpdate=z,u===null&&(o.shared.lanes=0),Ua|=f,e.lanes=f,e.memoizedState=H}}function Nh(e,t){if(typeof e!="function")throw Error(l(191,e));e.call(t)}function Lh(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)Nh(a[e],t)}var Yi=E(null),Ll=E(0);function Dh(e,t){e=la,J(Ll,e),J(Yi,t),la=e|t.baseLanes}function Nc(){J(Ll,la),J(Yi,Yi.current)}function Lc(){la=Ll.current,M(Yi),M(Ll)}var Xt=E(null),cn=null;function ja(e){var t=e.alternate;J(at,at.current&1),J(Xt,e),cn===null&&(t===null||Yi.current!==null||t.memoizedState!==null)&&(cn=e)}function Dc(e){J(at,at.current),J(Xt,e),cn===null&&(cn=e)}function Uh(e){e.tag===22?(J(at,at.current),J(Xt,e),cn===null&&(cn=e)):Na()}function Na(){J(at,at.current),J(Xt,Xt.current)}function Qt(e){M(Xt),cn===e&&(cn=null),M(at)}var at=E(0);function Dl(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||qu(a)||$u(a)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Fn=0,ge=null,De=null,ut=null,Ul=!1,Ji=!1,fi=!1,Ml=0,rs=0,Xi=null,Iy=0;function Ze(){throw Error(l(321))}function Uc(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!Yt(e[a],t[a]))return!1;return!0}function Mc(e,t,a,s,o,u){return Fn=u,ge=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,D.H=e===null||e.memoizedState===null?bf:Wc,fi=!1,u=a(s,o),fi=!1,Ji&&(u=zh(t,a,s,o)),Mh(e),u}function Mh(e){D.H=os;var t=De!==null&&De.next!==null;if(Fn=0,ut=De=ge=null,Ul=!1,rs=0,Xi=null,t)throw Error(l(300));e===null||dt||(e=e.dependencies,e!==null&&Al(e)&&(dt=!0))}function zh(e,t,a,s){ge=e;var o=0;do{if(Ji&&(Xi=null),rs=0,Ji=!1,25<=o)throw Error(l(301));if(o+=1,ut=De=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}D.H=Sf,u=t(a,s)}while(Ji);return u}function Gy(){var e=D.H,t=e.useState()[0];return t=typeof t.then=="function"?ss(t):t,e=e.useState()[0],(De!==null?De.memoizedState:null)!==e&&(ge.flags|=1024),t}function zc(){var e=Ml!==0;return Ml=0,e}function Bc(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function Hc(e){if(Ul){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ul=!1}Fn=0,ut=De=ge=null,Ji=!1,rs=Ml=0,Xi=null}function Rt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ut===null?ge.memoizedState=ut=e:ut=ut.next=e,ut}function it(){if(De===null){var e=ge.alternate;e=e!==null?e.memoizedState:null}else e=De.next;var t=ut===null?ge.memoizedState:ut.next;if(t!==null)ut=t,De=e;else{if(e===null)throw ge.alternate===null?Error(l(467)):Error(l(310));De=e,e={memoizedState:De.memoizedState,baseState:De.baseState,baseQueue:De.baseQueue,queue:De.queue,next:null},ut===null?ge.memoizedState=ut=e:ut=ut.next=e}return ut}function zl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ss(e){var t=rs;return rs+=1,Xi===null&&(Xi=[]),e=xh(Xi,e,t),t=ge,(ut===null?t.memoizedState:ut.next)===null&&(t=t.alternate,D.H=t===null||t.memoizedState===null?bf:Wc),e}function Bl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ss(e);if(e.$$typeof===N)return Tt(e)}throw Error(l(438,String(e)))}function qc(e){var t=null,a=ge.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var s=ge.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(t={data:s.data.map(function(o){return o.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=zl(),ge.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),s=0;s<e;s++)a[s]=Nt;return t.index++,a}function ea(e,t){return typeof t=="function"?t(e):t}function Hl(e){var t=it();return $c(t,De,e)}function $c(e,t,a){var s=e.queue;if(s===null)throw Error(l(311));s.lastRenderedReducer=a;var o=e.baseQueue,u=s.pending;if(u!==null){if(o!==null){var f=o.next;o.next=u.next,u.next=f}t.baseQueue=o=u,s.pending=null}if(u=e.baseState,o===null)e.memoizedState=u;else{t=o.next;var v=f=null,_=null,R=t,z=!1;do{var H=R.lane&-536870913;if(H!==R.lane?(_e&H)===H:(Fn&H)===H){var j=R.revertLane;if(j===0)_!==null&&(_=_.next={lane:0,revertLane:0,gesture:null,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null}),H===Ii&&(z=!0);else if((Fn&j)===j){R=R.next,j===Ii&&(z=!0);continue}else H={lane:0,revertLane:R.revertLane,gesture:null,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null},_===null?(v=_=H,f=u):_=_.next=H,ge.lanes|=j,Ua|=j;H=R.action,fi&&a(u,H),u=R.hasEagerState?R.eagerState:a(u,H)}else j={lane:H,revertLane:R.revertLane,gesture:R.gesture,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null},_===null?(v=_=j,f=u):_=_.next=j,ge.lanes|=H,Ua|=H;R=R.next}while(R!==null&&R!==t);if(_===null?f=u:_.next=v,!Yt(u,e.memoizedState)&&(dt=!0,z&&(a=Gi,a!==null)))throw a;e.memoizedState=u,e.baseState=f,e.baseQueue=_,s.lastRenderedState=u}return o===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function Pc(e){var t=it(),a=t.queue;if(a===null)throw Error(l(311));a.lastRenderedReducer=e;var s=a.dispatch,o=a.pending,u=t.memoizedState;if(o!==null){a.pending=null;var f=o=o.next;do u=e(u,f.action),f=f.next;while(f!==o);Yt(u,t.memoizedState)||(dt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),a.lastRenderedState=u}return[u,s]}function Bh(e,t,a){var s=ge,o=it(),u=ke;if(u){if(a===void 0)throw Error(l(407));a=a()}else a=t();var f=!Yt((De||o).memoizedState,a);if(f&&(o.memoizedState=a,dt=!0),o=o.queue,Vc($h.bind(null,s,o,e),[e]),o.getSnapshot!==t||f||ut!==null&&ut.memoizedState.tag&1){if(s.flags|=2048,Qi(9,{destroy:void 0},qh.bind(null,s,o,a,t),null),Be===null)throw Error(l(349));u||(Fn&127)!==0||Hh(s,t,a)}return a}function Hh(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=ge.updateQueue,t===null?(t=zl(),ge.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function qh(e,t,a,s){t.value=a,t.getSnapshot=s,Ph(t)&&Ih(e)}function $h(e,t,a){return a(function(){Ph(t)&&Ih(e)})}function Ph(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!Yt(e,a)}catch{return!0}}function Ih(e){var t=ii(e,2);t!==null&&Pt(t,e,2)}function Ic(e){var t=Rt();if(typeof e=="function"){var a=e;if(e=a(),fi){Lt(!0);try{a()}finally{Lt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ea,lastRenderedState:e},t}function Gh(e,t,a,s){return e.baseState=a,$c(e,De,typeof s=="function"?s:ea)}function Vy(e,t,a,s,o){if(Pl(e))throw Error(l(485));if(e=t.action,e!==null){var u={payload:o,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(f){u.listeners.push(f)}};D.T!==null?a(!0):u.isTransition=!1,s(u),a=t.pending,a===null?(u.next=t.pending=u,Vh(t,u)):(u.next=a.next,t.pending=a.next=u)}}function Vh(e,t){var a=t.action,s=t.payload,o=e.state;if(t.isTransition){var u=D.T,f={};D.T=f;try{var v=a(o,s),_=D.S;_!==null&&_(f,v),Kh(e,t,v)}catch(R){Gc(e,t,R)}finally{u!==null&&f.types!==null&&(u.types=f.types),D.T=u}}else try{u=a(o,s),Kh(e,t,u)}catch(R){Gc(e,t,R)}}function Kh(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(s){Yh(e,t,s)},function(s){return Gc(e,t,s)}):Yh(e,t,a)}function Yh(e,t,a){t.status="fulfilled",t.value=a,Jh(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,Vh(e,a)))}function Gc(e,t,a){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=a,Jh(t),t=t.next;while(t!==s)}e.action=null}function Jh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Xh(e,t){return t}function Qh(e,t){if(ke){var a=Be.formState;if(a!==null){e:{var s=ge;if(ke){if(Pe){t:{for(var o=Pe,u=on;o.nodeType!==8;){if(!u){o=null;break t}if(o=un(o.nextSibling),o===null){o=null;break t}}u=o.data,o=u==="F!"||u==="F"?o:null}if(o){Pe=un(o.nextSibling),s=o.data==="F!";break e}}Aa(s)}s=!1}s&&(t=a[0])}}return a=Rt(),a.memoizedState=a.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xh,lastRenderedState:t},a.queue=s,a=pf.bind(null,ge,s),s.dispatch=a,s=Ic(!1),u=Qc.bind(null,ge,!1,s.queue),s=Rt(),o={state:t,dispatch:null,action:e,pending:null},s.queue=o,a=Vy.bind(null,ge,o,u,a),o.dispatch=a,s.memoizedState=e,[t,a,!1]}function Wh(e){var t=it();return Zh(t,De,e)}function Zh(e,t,a){if(t=$c(e,t,Xh)[0],e=Hl(ea)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=ss(t)}catch(f){throw f===Vi?Ol:f}else s=t;t=it();var o=t.queue,u=o.dispatch;return a!==t.memoizedState&&(ge.flags|=2048,Qi(9,{destroy:void 0},Ky.bind(null,o,a),null)),[s,u,e]}function Ky(e,t){e.action=t}function Fh(e){var t=it(),a=De;if(a!==null)return Zh(t,a,e);it(),t=t.memoizedState,a=it();var s=a.queue.dispatch;return a.memoizedState=e,[t,s,!1]}function Qi(e,t,a,s){return e={tag:e,create:a,deps:s,inst:t,next:null},t=ge.updateQueue,t===null&&(t=zl(),ge.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(s=a.next,a.next=e,e.next=s,t.lastEffect=e),e}function ef(){return it().memoizedState}function ql(e,t,a,s){var o=Rt();ge.flags|=e,o.memoizedState=Qi(1|t,{destroy:void 0},a,s===void 0?null:s)}function $l(e,t,a,s){var o=it();s=s===void 0?null:s;var u=o.memoizedState.inst;De!==null&&s!==null&&Uc(s,De.memoizedState.deps)?o.memoizedState=Qi(t,u,a,s):(ge.flags|=e,o.memoizedState=Qi(1|t,u,a,s))}function tf(e,t){ql(8390656,8,e,t)}function Vc(e,t){$l(2048,8,e,t)}function Yy(e){ge.flags|=4;var t=ge.updateQueue;if(t===null)t=zl(),ge.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function nf(e){var t=it().memoizedState;return Yy({ref:t,nextImpl:e}),function(){if((Re&2)!==0)throw Error(l(440));return t.impl.apply(void 0,arguments)}}function af(e,t){return $l(4,2,e,t)}function rf(e,t){return $l(4,4,e,t)}function sf(e,t){if(typeof t=="function"){e=e();var a=t(e);return function(){typeof a=="function"?a():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function lf(e,t,a){a=a!=null?a.concat([e]):null,$l(4,4,sf.bind(null,t,e),a)}function Kc(){}function of(e,t){var a=it();t=t===void 0?null:t;var s=a.memoizedState;return t!==null&&Uc(t,s[1])?s[0]:(a.memoizedState=[e,t],e)}function cf(e,t){var a=it();t=t===void 0?null:t;var s=a.memoizedState;if(t!==null&&Uc(t,s[1]))return s[0];if(s=e(),fi){Lt(!0);try{e()}finally{Lt(!1)}}return a.memoizedState=[s,t],s}function Yc(e,t,a){return a===void 0||(Fn&1073741824)!==0&&(_e&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=um(),ge.lanes|=e,Ua|=e,a)}function uf(e,t,a,s){return Yt(a,t)?a:Yi.current!==null?(e=Yc(e,a,s),Yt(e,t)||(dt=!0),e):(Fn&42)===0||(Fn&1073741824)!==0&&(_e&261930)===0?(dt=!0,e.memoizedState=a):(e=um(),ge.lanes|=e,Ua|=e,t)}function df(e,t,a,s,o){var u=K.p;K.p=u!==0&&8>u?u:8;var f=D.T,v={};D.T=v,Qc(e,!1,t,a);try{var _=o(),R=D.S;if(R!==null&&R(v,_),_!==null&&typeof _=="object"&&typeof _.then=="function"){var z=Py(_,s);ls(e,t,z,Ft(e))}else ls(e,t,s,Ft(e))}catch(H){ls(e,t,{then:function(){},status:"rejected",reason:H},Ft())}finally{K.p=u,f!==null&&v.types!==null&&(f.types=v.types),D.T=f}}function Jy(){}function Jc(e,t,a,s){if(e.tag!==5)throw Error(l(476));var o=hf(e).queue;df(e,o,t,ae,a===null?Jy:function(){return ff(e),a(s)})}function hf(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ea,lastRenderedState:ae},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ea,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ff(e){var t=hf(e);t.next===null&&(t=e.alternate.memoizedState),ls(e,t.next.queue,{},Ft())}function Xc(){return Tt(ks)}function mf(){return it().memoizedState}function gf(){return it().memoizedState}function Xy(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=Ft();e=Oa(a);var s=Ra(t,e,a);s!==null&&(Pt(s,t,a),ns(s,t,a)),t={cache:kc()},e.payload=t;return}t=t.return}}function Qy(e,t,a){var s=Ft();a={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Pl(e)?yf(t,a):(a=fc(e,t,a,s),a!==null&&(Pt(a,e,s),vf(a,t,s)))}function pf(e,t,a){var s=Ft();ls(e,t,a,s)}function ls(e,t,a,s){var o={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Pl(e))yf(t,o);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var f=t.lastRenderedState,v=u(f,a);if(o.hasEagerState=!0,o.eagerState=v,Yt(v,f))return _l(e,t,o,0),Be===null&&wl(),!1}catch{}if(a=fc(e,t,o,s),a!==null)return Pt(a,e,s),vf(a,t,s),!0}return!1}function Qc(e,t,a,s){if(s={lane:2,revertLane:Cu(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Pl(e)){if(t)throw Error(l(479))}else t=fc(e,a,s,2),t!==null&&Pt(t,e,2)}function Pl(e){var t=e.alternate;return e===ge||t!==null&&t===ge}function yf(e,t){Ji=Ul=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function vf(e,t,a){if((a&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,a|=s,t.lanes=a,Dr(e,a)}}var os={readContext:Tt,use:Bl,useCallback:Ze,useContext:Ze,useEffect:Ze,useImperativeHandle:Ze,useLayoutEffect:Ze,useInsertionEffect:Ze,useMemo:Ze,useReducer:Ze,useRef:Ze,useState:Ze,useDebugValue:Ze,useDeferredValue:Ze,useTransition:Ze,useSyncExternalStore:Ze,useId:Ze,useHostTransitionStatus:Ze,useFormState:Ze,useActionState:Ze,useOptimistic:Ze,useMemoCache:Ze,useCacheRefresh:Ze};os.useEffectEvent=Ze;var bf={readContext:Tt,use:Bl,useCallback:function(e,t){return Rt().memoizedState=[e,t===void 0?null:t],e},useContext:Tt,useEffect:tf,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,ql(4194308,4,sf.bind(null,t,e),a)},useLayoutEffect:function(e,t){return ql(4194308,4,e,t)},useInsertionEffect:function(e,t){ql(4,2,e,t)},useMemo:function(e,t){var a=Rt();t=t===void 0?null:t;var s=e();if(fi){Lt(!0);try{e()}finally{Lt(!1)}}return a.memoizedState=[s,t],s},useReducer:function(e,t,a){var s=Rt();if(a!==void 0){var o=a(t);if(fi){Lt(!0);try{a(t)}finally{Lt(!1)}}}else o=t;return s.memoizedState=s.baseState=o,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:o},s.queue=e,e=e.dispatch=Qy.bind(null,ge,e),[s.memoizedState,e]},useRef:function(e){var t=Rt();return e={current:e},t.memoizedState=e},useState:function(e){e=Ic(e);var t=e.queue,a=pf.bind(null,ge,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:Kc,useDeferredValue:function(e,t){var a=Rt();return Yc(a,e,t)},useTransition:function(){var e=Ic(!1);return e=df.bind(null,ge,e.queue,!0,!1),Rt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var s=ge,o=Rt();if(ke){if(a===void 0)throw Error(l(407));a=a()}else{if(a=t(),Be===null)throw Error(l(349));(_e&127)!==0||Hh(s,t,a)}o.memoizedState=a;var u={value:a,getSnapshot:t};return o.queue=u,tf($h.bind(null,s,u,e),[e]),s.flags|=2048,Qi(9,{destroy:void 0},qh.bind(null,s,u,a,t),null),a},useId:function(){var e=Rt(),t=Be.identifierPrefix;if(ke){var a=xn,s=An;a=(s&~(1<<32-lt(s)-1)).toString(32)+a,t="_"+t+"R_"+a,a=Ml++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=Iy++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Xc,useFormState:Qh,useActionState:Qh,useOptimistic:function(e){var t=Rt();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=Qc.bind(null,ge,!0,a),a.dispatch=t,[e,t]},useMemoCache:qc,useCacheRefresh:function(){return Rt().memoizedState=Xy.bind(null,ge)},useEffectEvent:function(e){var t=Rt(),a={impl:e};return t.memoizedState=a,function(){if((Re&2)!==0)throw Error(l(440));return a.impl.apply(void 0,arguments)}}},Wc={readContext:Tt,use:Bl,useCallback:of,useContext:Tt,useEffect:Vc,useImperativeHandle:lf,useInsertionEffect:af,useLayoutEffect:rf,useMemo:cf,useReducer:Hl,useRef:ef,useState:function(){return Hl(ea)},useDebugValue:Kc,useDeferredValue:function(e,t){var a=it();return uf(a,De.memoizedState,e,t)},useTransition:function(){var e=Hl(ea)[0],t=it().memoizedState;return[typeof e=="boolean"?e:ss(e),t]},useSyncExternalStore:Bh,useId:mf,useHostTransitionStatus:Xc,useFormState:Wh,useActionState:Wh,useOptimistic:function(e,t){var a=it();return Gh(a,De,e,t)},useMemoCache:qc,useCacheRefresh:gf};Wc.useEffectEvent=nf;var Sf={readContext:Tt,use:Bl,useCallback:of,useContext:Tt,useEffect:Vc,useImperativeHandle:lf,useInsertionEffect:af,useLayoutEffect:rf,useMemo:cf,useReducer:Pc,useRef:ef,useState:function(){return Pc(ea)},useDebugValue:Kc,useDeferredValue:function(e,t){var a=it();return De===null?Yc(a,e,t):uf(a,De.memoizedState,e,t)},useTransition:function(){var e=Pc(ea)[0],t=it().memoizedState;return[typeof e=="boolean"?e:ss(e),t]},useSyncExternalStore:Bh,useId:mf,useHostTransitionStatus:Xc,useFormState:Fh,useActionState:Fh,useOptimistic:function(e,t){var a=it();return De!==null?Gh(a,De,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:qc,useCacheRefresh:gf};Sf.useEffectEvent=nf;function Zc(e,t,a,s){t=e.memoizedState,a=a(s,t),a=a==null?t:b({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Fc={enqueueSetState:function(e,t,a){e=e._reactInternals;var s=Ft(),o=Oa(s);o.payload=t,a!=null&&(o.callback=a),t=Ra(e,o,s),t!==null&&(Pt(t,e,s),ns(t,e,s))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var s=Ft(),o=Oa(s);o.tag=1,o.payload=t,a!=null&&(o.callback=a),t=Ra(e,o,s),t!==null&&(Pt(t,e,s),ns(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=Ft(),s=Oa(a);s.tag=2,t!=null&&(s.callback=t),t=Ra(e,s,a),t!==null&&(Pt(t,e,a),ns(t,e,a))}};function wf(e,t,a,s,o,u,f){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,u,f):t.prototype&&t.prototype.isPureReactComponent?!Jr(a,s)||!Jr(o,u):!0}function _f(e,t,a,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,s),t.state!==e&&Fc.enqueueReplaceState(t,t.state,null)}function mi(e,t){var a=t;if("ref"in t){a={};for(var s in t)s!=="ref"&&(a[s]=t[s])}if(e=e.defaultProps){a===t&&(a=b({},a));for(var o in e)a[o]===void 0&&(a[o]=e[o])}return a}function Tf(e){Sl(e)}function kf(e){console.error(e)}function Ef(e){Sl(e)}function Il(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function Af(e,t,a){try{var s=e.onCaughtError;s(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(o){setTimeout(function(){throw o})}}function eu(e,t,a){return a=Oa(a),a.tag=3,a.payload={element:null},a.callback=function(){Il(e,t)},a}function xf(e){return e=Oa(e),e.tag=3,e}function Cf(e,t,a,s){var o=a.type.getDerivedStateFromError;if(typeof o=="function"){var u=s.value;e.payload=function(){return o(u)},e.callback=function(){Af(t,a,s)}}var f=a.stateNode;f!==null&&typeof f.componentDidCatch=="function"&&(e.callback=function(){Af(t,a,s),typeof o!="function"&&(Ma===null?Ma=new Set([this]):Ma.add(this));var v=s.stack;this.componentDidCatch(s.value,{componentStack:v!==null?v:""})})}function Wy(e,t,a,s,o){if(a.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=a.alternate,t!==null&&Pi(t,a,o,!0),a=Xt.current,a!==null){switch(a.tag){case 31:case 13:return cn===null?to():a.alternate===null&&Fe===0&&(Fe=3),a.flags&=-257,a.flags|=65536,a.lanes=o,s===Rl?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([s]):t.add(s),Eu(e,s,o)),!1;case 22:return a.flags|=65536,s===Rl?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([s])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([s]):a.add(s)),Eu(e,s,o)),!1}throw Error(l(435,a.tag))}return Eu(e,s,o),to(),!1}if(ke)return t=Xt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=o,s!==bc&&(e=Error(l(422),{cause:s}),Wr(rn(e,a)))):(s!==bc&&(t=Error(l(423),{cause:s}),Wr(rn(t,a))),e=e.current.alternate,e.flags|=65536,o&=-o,e.lanes|=o,s=rn(s,a),o=eu(e.stateNode,s,o),Rc(e,o),Fe!==4&&(Fe=2)),!1;var u=Error(l(520),{cause:s});if(u=rn(u,a),ps===null?ps=[u]:ps.push(u),Fe!==4&&(Fe=2),t===null)return!0;s=rn(s,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=o&-o,a.lanes|=e,e=eu(a.stateNode,s,e),Rc(a,e),!1;case 1:if(t=a.type,u=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Ma===null||!Ma.has(u))))return a.flags|=65536,o&=-o,a.lanes|=o,o=xf(o),Cf(o,e,a,s),Rc(a,o),!1}a=a.return}while(a!==null);return!1}var tu=Error(l(461)),dt=!1;function kt(e,t,a,s){t.child=e===null?jh(t,null,a,s):hi(t,e.child,a,s)}function Of(e,t,a,s,o){a=a.render;var u=t.ref;if("ref"in s){var f={};for(var v in s)v!=="ref"&&(f[v]=s[v])}else f=s;return oi(t),s=Mc(e,t,a,f,u,o),v=zc(),e!==null&&!dt?(Bc(e,t,o),ta(e,t,o)):(ke&&v&&yc(t),t.flags|=1,kt(e,t,s,o),t.child)}function Rf(e,t,a,s,o){if(e===null){var u=a.type;return typeof u=="function"&&!mc(u)&&u.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=u,jf(e,t,u,s,o)):(e=kl(a.type,null,s,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!cu(e,o)){var f=u.memoizedProps;if(a=a.compare,a=a!==null?a:Jr,a(f,s)&&e.ref===t.ref)return ta(e,t,o)}return t.flags|=1,e=Xn(u,s),e.ref=t.ref,e.return=t,t.child=e}function jf(e,t,a,s,o){if(e!==null){var u=e.memoizedProps;if(Jr(u,s)&&e.ref===t.ref)if(dt=!1,t.pendingProps=s=u,cu(e,o))(e.flags&131072)!==0&&(dt=!0);else return t.lanes=e.lanes,ta(e,t,o)}return nu(e,t,a,s,o)}function Nf(e,t,a,s){var o=s.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|a:a,e!==null){for(s=t.child=e.child,o=0;s!==null;)o=o|s.lanes|s.childLanes,s=s.sibling;s=o&~u}else s=0,t.child=null;return Lf(e,t,u,a,s)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Cl(t,u!==null?u.cachePool:null),u!==null?Dh(t,u):Nc(),Uh(t);else return s=t.lanes=536870912,Lf(e,t,u!==null?u.baseLanes|a:a,a,s)}else u!==null?(Cl(t,u.cachePool),Dh(t,u),Na(),t.memoizedState=null):(e!==null&&Cl(t,null),Nc(),Na());return kt(e,t,o,a),t.child}function cs(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Lf(e,t,a,s,o){var u=Ac();return u=u===null?null:{parent:ct._currentValue,pool:u},t.memoizedState={baseLanes:a,cachePool:u},e!==null&&Cl(t,null),Nc(),Uh(t),e!==null&&Pi(e,t,s,!0),t.childLanes=o,null}function Gl(e,t){return t=Kl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Df(e,t,a){return hi(t,e.child,null,a),e=Gl(t,t.pendingProps),e.flags|=2,Qt(t),t.memoizedState=null,e}function Zy(e,t,a){var s=t.pendingProps,o=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ke){if(s.mode==="hidden")return e=Gl(t,s),t.lanes=536870912,cs(null,e);if(Dc(t),(e=Pe)?(e=Km(e,on),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ka!==null?{id:An,overflow:xn}:null,retryLane:536870912,hydrationErrors:null},a=ph(e),a.return=t,t.child=a,_t=t,Pe=null)):e=null,e===null)throw Aa(t);return t.lanes=536870912,null}return Gl(t,s)}var u=e.memoizedState;if(u!==null){var f=u.dehydrated;if(Dc(t),o)if(t.flags&256)t.flags&=-257,t=Df(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(l(558));else if(dt||Pi(e,t,a,!1),o=(a&e.childLanes)!==0,dt||o){if(s=Be,s!==null&&(f=Ur(s,a),f!==0&&f!==u.retryLane))throw u.retryLane=f,ii(e,f),Pt(s,e,f),tu;to(),t=Df(e,t,a)}else e=u.treeContext,Pe=un(f.nextSibling),_t=t,ke=!0,Ea=null,on=!1,e!==null&&bh(t,e),t=Gl(t,s),t.flags|=4096;return t}return e=Xn(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Vl(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(l(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function nu(e,t,a,s,o){return oi(t),a=Mc(e,t,a,s,void 0,o),s=zc(),e!==null&&!dt?(Bc(e,t,o),ta(e,t,o)):(ke&&s&&yc(t),t.flags|=1,kt(e,t,a,o),t.child)}function Uf(e,t,a,s,o,u){return oi(t),t.updateQueue=null,a=zh(t,s,a,o),Mh(e),s=zc(),e!==null&&!dt?(Bc(e,t,u),ta(e,t,u)):(ke&&s&&yc(t),t.flags|=1,kt(e,t,a,u),t.child)}function Mf(e,t,a,s,o){if(oi(t),t.stateNode===null){var u=Bi,f=a.contextType;typeof f=="object"&&f!==null&&(u=Tt(f)),u=new a(s,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=Fc,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=s,u.state=t.memoizedState,u.refs={},Cc(t),f=a.contextType,u.context=typeof f=="object"&&f!==null?Tt(f):Bi,u.state=t.memoizedState,f=a.getDerivedStateFromProps,typeof f=="function"&&(Zc(t,a,f,s),u.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(f=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),f!==u.state&&Fc.enqueueReplaceState(u,u.state,null),is(t,s,u,o),as(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){u=t.stateNode;var v=t.memoizedProps,_=mi(a,v);u.props=_;var R=u.context,z=a.contextType;f=Bi,typeof z=="object"&&z!==null&&(f=Tt(z));var H=a.getDerivedStateFromProps;z=typeof H=="function"||typeof u.getSnapshotBeforeUpdate=="function",v=t.pendingProps!==v,z||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(v||R!==f)&&_f(t,u,s,f),Ca=!1;var j=t.memoizedState;u.state=j,is(t,s,u,o),as(),R=t.memoizedState,v||j!==R||Ca?(typeof H=="function"&&(Zc(t,a,H,s),R=t.memoizedState),(_=Ca||wf(t,a,_,s,j,R,f))?(z||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=R),u.props=s,u.state=R,u.context=f,s=_):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{u=t.stateNode,Oc(e,t),f=t.memoizedProps,z=mi(a,f),u.props=z,H=t.pendingProps,j=u.context,R=a.contextType,_=Bi,typeof R=="object"&&R!==null&&(_=Tt(R)),v=a.getDerivedStateFromProps,(R=typeof v=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(f!==H||j!==_)&&_f(t,u,s,_),Ca=!1,j=t.memoizedState,u.state=j,is(t,s,u,o),as();var L=t.memoizedState;f!==H||j!==L||Ca||e!==null&&e.dependencies!==null&&Al(e.dependencies)?(typeof v=="function"&&(Zc(t,a,v,s),L=t.memoizedState),(z=Ca||wf(t,a,z,s,j,L,_)||e!==null&&e.dependencies!==null&&Al(e.dependencies))?(R||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(s,L,_),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(s,L,_)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||f===e.memoizedProps&&j===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&j===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=L),u.props=s,u.state=L,u.context=_,s=z):(typeof u.componentDidUpdate!="function"||f===e.memoizedProps&&j===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&j===e.memoizedState||(t.flags|=1024),s=!1)}return u=s,Vl(e,t),s=(t.flags&128)!==0,u||s?(u=t.stateNode,a=s&&typeof a.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&s?(t.child=hi(t,e.child,null,o),t.child=hi(t,null,a,o)):kt(e,t,a,o),t.memoizedState=u.state,e=t.child):e=ta(e,t,o),e}function zf(e,t,a,s){return si(),t.flags|=256,kt(e,t,a,s),t.child}var au={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function iu(e){return{baseLanes:e,cachePool:Eh()}}function ru(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=Zt),e}function Bf(e,t,a){var s=t.pendingProps,o=!1,u=(t.flags&128)!==0,f;if((f=u)||(f=e!==null&&e.memoizedState===null?!1:(at.current&2)!==0),f&&(o=!0,t.flags&=-129),f=(t.flags&32)!==0,t.flags&=-33,e===null){if(ke){if(o?ja(t):Na(),(e=Pe)?(e=Km(e,on),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ka!==null?{id:An,overflow:xn}:null,retryLane:536870912,hydrationErrors:null},a=ph(e),a.return=t,t.child=a,_t=t,Pe=null)):e=null,e===null)throw Aa(t);return $u(e)?t.lanes=32:t.lanes=536870912,null}var v=s.children;return s=s.fallback,o?(Na(),o=t.mode,v=Kl({mode:"hidden",children:v},o),s=ri(s,o,a,null),v.return=t,s.return=t,v.sibling=s,t.child=v,s=t.child,s.memoizedState=iu(a),s.childLanes=ru(e,f,a),t.memoizedState=au,cs(null,s)):(ja(t),su(t,v))}var _=e.memoizedState;if(_!==null&&(v=_.dehydrated,v!==null)){if(u)t.flags&256?(ja(t),t.flags&=-257,t=lu(e,t,a)):t.memoizedState!==null?(Na(),t.child=e.child,t.flags|=128,t=null):(Na(),v=s.fallback,o=t.mode,s=Kl({mode:"visible",children:s.children},o),v=ri(v,o,a,null),v.flags|=2,s.return=t,v.return=t,s.sibling=v,t.child=s,hi(t,e.child,null,a),s=t.child,s.memoizedState=iu(a),s.childLanes=ru(e,f,a),t.memoizedState=au,t=cs(null,s));else if(ja(t),$u(v)){if(f=v.nextSibling&&v.nextSibling.dataset,f)var R=f.dgst;f=R,s=Error(l(419)),s.stack="",s.digest=f,Wr({value:s,source:null,stack:null}),t=lu(e,t,a)}else if(dt||Pi(e,t,a,!1),f=(a&e.childLanes)!==0,dt||f){if(f=Be,f!==null&&(s=Ur(f,a),s!==0&&s!==_.retryLane))throw _.retryLane=s,ii(e,s),Pt(f,e,s),tu;qu(v)||to(),t=lu(e,t,a)}else qu(v)?(t.flags|=192,t.child=e.child,t=null):(e=_.treeContext,Pe=un(v.nextSibling),_t=t,ke=!0,Ea=null,on=!1,e!==null&&bh(t,e),t=su(t,s.children),t.flags|=4096);return t}return o?(Na(),v=s.fallback,o=t.mode,_=e.child,R=_.sibling,s=Xn(_,{mode:"hidden",children:s.children}),s.subtreeFlags=_.subtreeFlags&65011712,R!==null?v=Xn(R,v):(v=ri(v,o,a,null),v.flags|=2),v.return=t,s.return=t,s.sibling=v,t.child=s,cs(null,s),s=t.child,v=e.child.memoizedState,v===null?v=iu(a):(o=v.cachePool,o!==null?(_=ct._currentValue,o=o.parent!==_?{parent:_,pool:_}:o):o=Eh(),v={baseLanes:v.baseLanes|a,cachePool:o}),s.memoizedState=v,s.childLanes=ru(e,f,a),t.memoizedState=au,cs(e.child,s)):(ja(t),a=e.child,e=a.sibling,a=Xn(a,{mode:"visible",children:s.children}),a.return=t,a.sibling=null,e!==null&&(f=t.deletions,f===null?(t.deletions=[e],t.flags|=16):f.push(e)),t.child=a,t.memoizedState=null,a)}function su(e,t){return t=Kl({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Kl(e,t){return e=Jt(22,e,null,t),e.lanes=0,e}function lu(e,t,a){return hi(t,e.child,null,a),e=su(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Hf(e,t,a){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),_c(e.return,t,a)}function ou(e,t,a,s,o,u){var f=e.memoizedState;f===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:a,tailMode:o,treeForkCount:u}:(f.isBackwards=t,f.rendering=null,f.renderingStartTime=0,f.last=s,f.tail=a,f.tailMode=o,f.treeForkCount=u)}function qf(e,t,a){var s=t.pendingProps,o=s.revealOrder,u=s.tail;s=s.children;var f=at.current,v=(f&2)!==0;if(v?(f=f&1|2,t.flags|=128):f&=1,J(at,f),kt(e,t,s,a),s=ke?Qr:0,!v&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Hf(e,a,t);else if(e.tag===19)Hf(e,a,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(o){case"forwards":for(a=t.child,o=null;a!==null;)e=a.alternate,e!==null&&Dl(e)===null&&(o=a),a=a.sibling;a=o,a===null?(o=t.child,t.child=null):(o=a.sibling,a.sibling=null),ou(t,!1,o,a,u,s);break;case"backwards":case"unstable_legacy-backwards":for(a=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&Dl(e)===null){t.child=o;break}e=o.sibling,o.sibling=a,a=o,o=e}ou(t,!0,a,null,u,s);break;case"together":ou(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function ta(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),Ua|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(Pi(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(l(153));if(t.child!==null){for(e=t.child,a=Xn(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=Xn(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function cu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Al(e)))}function Fy(e,t,a){switch(t.tag){case 3:Je(t,t.stateNode.containerInfo),xa(t,ct,e.memoizedState.cache),si();break;case 27:case 5:kn(t);break;case 4:Je(t,t.stateNode.containerInfo);break;case 10:xa(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Dc(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(ja(t),t.flags|=128,null):(a&t.child.childLanes)!==0?Bf(e,t,a):(ja(t),e=ta(e,t,a),e!==null?e.sibling:null);ja(t);break;case 19:var o=(e.flags&128)!==0;if(s=(a&t.childLanes)!==0,s||(Pi(e,t,a,!1),s=(a&t.childLanes)!==0),o){if(s)return qf(e,t,a);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),J(at,at.current),s)break;return null;case 22:return t.lanes=0,Nf(e,t,a,t.pendingProps);case 24:xa(t,ct,e.memoizedState.cache)}return ta(e,t,a)}function $f(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)dt=!0;else{if(!cu(e,a)&&(t.flags&128)===0)return dt=!1,Fy(e,t,a);dt=(e.flags&131072)!==0}else dt=!1,ke&&(t.flags&1048576)!==0&&vh(t,Qr,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=ui(t.elementType),t.type=e,typeof e=="function")mc(e)?(s=mi(e,s),t.tag=1,t=Mf(null,t,e,s,a)):(t.tag=0,t=nu(null,t,e,s,a));else{if(e!=null){var o=e.$$typeof;if(o===Y){t.tag=11,t=Of(null,t,e,s,a);break e}else if(o===Q){t.tag=14,t=Rf(null,t,e,s,a);break e}}throw t=pt(e)||e,Error(l(306,t,""))}}return t;case 0:return nu(e,t,t.type,t.pendingProps,a);case 1:return s=t.type,o=mi(s,t.pendingProps),Mf(e,t,s,o,a);case 3:e:{if(Je(t,t.stateNode.containerInfo),e===null)throw Error(l(387));s=t.pendingProps;var u=t.memoizedState;o=u.element,Oc(e,t),is(t,s,null,a);var f=t.memoizedState;if(s=f.cache,xa(t,ct,s),s!==u.cache&&Tc(t,[ct],a,!0),as(),s=f.element,u.isDehydrated)if(u={element:s,isDehydrated:!1,cache:f.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=zf(e,t,s,a);break e}else if(s!==o){o=rn(Error(l(424)),t),Wr(o),t=zf(e,t,s,a);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Pe=un(e.firstChild),_t=t,ke=!0,Ea=null,on=!0,a=jh(t,null,s,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(si(),s===o){t=ta(e,t,a);break e}kt(e,t,s,a)}t=t.child}return t;case 26:return Vl(e,t),e===null?(a=Zm(t.type,null,t.pendingProps,null))?t.memoizedState=a:ke||(a=t.type,e=t.pendingProps,s=oo(me.current).createElement(a),s[Ve]=t,s[wt]=e,Et(s,a,e),qe(s),t.stateNode=s):t.memoizedState=Zm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return kn(t),e===null&&ke&&(s=t.stateNode=Xm(t.type,t.pendingProps,me.current),_t=t,on=!0,o=Pe,qa(t.type)?(Pu=o,Pe=un(s.firstChild)):Pe=o),kt(e,t,t.pendingProps.children,a),Vl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ke&&((o=s=Pe)&&(s=Ov(s,t.type,t.pendingProps,on),s!==null?(t.stateNode=s,_t=t,Pe=un(s.firstChild),on=!1,o=!0):o=!1),o||Aa(t)),kn(t),o=t.type,u=t.pendingProps,f=e!==null?e.memoizedProps:null,s=u.children,zu(o,u)?s=null:f!==null&&zu(o,f)&&(t.flags|=32),t.memoizedState!==null&&(o=Mc(e,t,Gy,null,null,a),ks._currentValue=o),Vl(e,t),kt(e,t,s,a),t.child;case 6:return e===null&&ke&&((e=a=Pe)&&(a=Rv(a,t.pendingProps,on),a!==null?(t.stateNode=a,_t=t,Pe=null,e=!0):e=!1),e||Aa(t)),null;case 13:return Bf(e,t,a);case 4:return Je(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=hi(t,null,s,a):kt(e,t,s,a),t.child;case 11:return Of(e,t,t.type,t.pendingProps,a);case 7:return kt(e,t,t.pendingProps,a),t.child;case 8:return kt(e,t,t.pendingProps.children,a),t.child;case 12:return kt(e,t,t.pendingProps.children,a),t.child;case 10:return s=t.pendingProps,xa(t,t.type,s.value),kt(e,t,s.children,a),t.child;case 9:return o=t.type._context,s=t.pendingProps.children,oi(t),o=Tt(o),s=s(o),t.flags|=1,kt(e,t,s,a),t.child;case 14:return Rf(e,t,t.type,t.pendingProps,a);case 15:return jf(e,t,t.type,t.pendingProps,a);case 19:return qf(e,t,a);case 31:return Zy(e,t,a);case 22:return Nf(e,t,a,t.pendingProps);case 24:return oi(t),s=Tt(ct),e===null?(o=Ac(),o===null&&(o=Be,u=kc(),o.pooledCache=u,u.refCount++,u!==null&&(o.pooledCacheLanes|=a),o=u),t.memoizedState={parent:s,cache:o},Cc(t),xa(t,ct,o)):((e.lanes&a)!==0&&(Oc(e,t),is(t,null,null,a),as()),o=e.memoizedState,u=t.memoizedState,o.parent!==s?(o={parent:s,cache:s},t.memoizedState=o,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=o),xa(t,ct,s)):(s=u.cache,xa(t,ct,s),s!==o.cache&&Tc(t,[ct],a,!0))),kt(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(l(156,t.tag))}function na(e){e.flags|=4}function uu(e,t,a,s,o){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(o&335544128)===o)if(e.stateNode.complete)e.flags|=8192;else if(mm())e.flags|=8192;else throw di=Rl,xc}else e.flags&=-16777217}function Pf(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!ag(t))if(mm())e.flags|=8192;else throw di=Rl,xc}function Yl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?jr():536870912,e.lanes|=t,er|=t)}function us(e,t){if(!ke)switch(e.tailMode){case"hidden":t=e.tail;for(var a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var s=null;a!==null;)a.alternate!==null&&(s=a),a=a.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Ie(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,s=0;if(t)for(var o=e.child;o!==null;)a|=o.lanes|o.childLanes,s|=o.subtreeFlags&65011712,s|=o.flags&65011712,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)a|=o.lanes|o.childLanes,s|=o.subtreeFlags,s|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=s,e.childLanes=a,t}function ev(e,t,a){var s=t.pendingProps;switch(vc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ie(t),null;case 1:return Ie(t),null;case 3:return a=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),Zn(ct),Xe(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&($i(t)?na(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Sc())),Ie(t),null;case 26:var o=t.type,u=t.memoizedState;return e===null?(na(t),u!==null?(Ie(t),Pf(t,u)):(Ie(t),uu(t,o,null,s,a))):u?u!==e.memoizedState?(na(t),Ie(t),Pf(t,u)):(Ie(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&na(t),Ie(t),uu(t,o,e,s,a)),null;case 27:if(fn(t),a=me.current,o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&na(t);else{if(!s){if(t.stateNode===null)throw Error(l(166));return Ie(t),null}e=Z.current,$i(t)?Sh(t):(e=Xm(o,s,a),t.stateNode=e,na(t))}return Ie(t),null;case 5:if(fn(t),o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&na(t);else{if(!s){if(t.stateNode===null)throw Error(l(166));return Ie(t),null}if(u=Z.current,$i(t))Sh(t);else{var f=oo(me.current);switch(u){case 1:u=f.createElementNS("http://www.w3.org/2000/svg",o);break;case 2:u=f.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;default:switch(o){case"svg":u=f.createElementNS("http://www.w3.org/2000/svg",o);break;case"math":u=f.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;case"script":u=f.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof s.is=="string"?f.createElement("select",{is:s.is}):f.createElement("select"),s.multiple?u.multiple=!0:s.size&&(u.size=s.size);break;default:u=typeof s.is=="string"?f.createElement(o,{is:s.is}):f.createElement(o)}}u[Ve]=t,u[wt]=s;e:for(f=t.child;f!==null;){if(f.tag===5||f.tag===6)u.appendChild(f.stateNode);else if(f.tag!==4&&f.tag!==27&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}t.stateNode=u;e:switch(Et(u,o,s),o){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&na(t)}}return Ie(t),uu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&na(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(l(166));if(e=me.current,$i(t)){if(e=t.stateNode,a=t.memoizedProps,s=null,o=_t,o!==null)switch(o.tag){case 27:case 5:s=o.memoizedProps}e[Ve]=t,e=!!(e.nodeValue===a||s!==null&&s.suppressHydrationWarning===!0||Bm(e.nodeValue,a)),e||Aa(t,!0)}else e=oo(e).createTextNode(s),e[Ve]=t,t.stateNode=e}return Ie(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(s=$i(t),a!==null){if(e===null){if(!s)throw Error(l(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(557));e[Ve]=t}else si(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ie(t),e=!1}else a=Sc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(Qt(t),t):(Qt(t),null);if((t.flags&128)!==0)throw Error(l(558))}return Ie(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=$i(t),s!==null&&s.dehydrated!==null){if(e===null){if(!o)throw Error(l(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(l(317));o[Ve]=t}else si(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ie(t),o=!1}else o=Sc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(Qt(t),t):(Qt(t),null)}return Qt(t),(t.flags&128)!==0?(t.lanes=a,t):(a=s!==null,e=e!==null&&e.memoizedState!==null,a&&(s=t.child,o=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(o=s.alternate.memoizedState.cachePool.pool),u=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),u!==o&&(s.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),Yl(t,t.updateQueue),Ie(t),null);case 4:return Xe(),e===null&&Nu(t.stateNode.containerInfo),Ie(t),null;case 10:return Zn(t.type),Ie(t),null;case 19:if(M(at),s=t.memoizedState,s===null)return Ie(t),null;if(o=(t.flags&128)!==0,u=s.rendering,u===null)if(o)us(s,!1);else{if(Fe!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=Dl(e),u!==null){for(t.flags|=128,us(s,!1),e=u.updateQueue,t.updateQueue=e,Yl(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)gh(a,e),a=a.sibling;return J(at,at.current&1|2),ke&&Qn(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&Ot()>Zl&&(t.flags|=128,o=!0,us(s,!1),t.lanes=4194304)}else{if(!o)if(e=Dl(u),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,Yl(t,e),us(s,!0),s.tail===null&&s.tailMode==="hidden"&&!u.alternate&&!ke)return Ie(t),null}else 2*Ot()-s.renderingStartTime>Zl&&a!==536870912&&(t.flags|=128,o=!0,us(s,!1),t.lanes=4194304);s.isBackwards?(u.sibling=t.child,t.child=u):(e=s.last,e!==null?e.sibling=u:t.child=u,s.last=u)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Ot(),e.sibling=null,a=at.current,J(at,o?a&1|2:a&1),ke&&Qn(t,s.treeForkCount),e):(Ie(t),null);case 22:case 23:return Qt(t),Lc(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?(a&536870912)!==0&&(t.flags&128)===0&&(Ie(t),t.subtreeFlags&6&&(t.flags|=8192)):Ie(t),a=t.updateQueue,a!==null&&Yl(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==a&&(t.flags|=2048),e!==null&&M(ci),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Zn(ct),Ie(t),null;case 25:return null;case 30:return null}throw Error(l(156,t.tag))}function tv(e,t){switch(vc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Zn(ct),Xe(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return fn(t),null;case 31:if(t.memoizedState!==null){if(Qt(t),t.alternate===null)throw Error(l(340));si()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Qt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(l(340));si()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return M(at),null;case 4:return Xe(),null;case 10:return Zn(t.type),null;case 22:case 23:return Qt(t),Lc(),e!==null&&M(ci),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Zn(ct),null;case 25:return null;default:return null}}function If(e,t){switch(vc(t),t.tag){case 3:Zn(ct),Xe();break;case 26:case 27:case 5:fn(t);break;case 4:Xe();break;case 31:t.memoizedState!==null&&Qt(t);break;case 13:Qt(t);break;case 19:M(at);break;case 10:Zn(t.type);break;case 22:case 23:Qt(t),Lc(),e!==null&&M(ci);break;case 24:Zn(ct)}}function ds(e,t){try{var a=t.updateQueue,s=a!==null?a.lastEffect:null;if(s!==null){var o=s.next;a=o;do{if((a.tag&e)===e){s=void 0;var u=a.create,f=a.inst;s=u(),f.destroy=s}a=a.next}while(a!==o)}}catch(v){Ne(t,t.return,v)}}function La(e,t,a){try{var s=t.updateQueue,o=s!==null?s.lastEffect:null;if(o!==null){var u=o.next;s=u;do{if((s.tag&e)===e){var f=s.inst,v=f.destroy;if(v!==void 0){f.destroy=void 0,o=t;var _=a,R=v;try{R()}catch(z){Ne(o,_,z)}}}s=s.next}while(s!==u)}}catch(z){Ne(t,t.return,z)}}function Gf(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{Lh(t,a)}catch(s){Ne(e,e.return,s)}}}function Vf(e,t,a){a.props=mi(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(s){Ne(e,t,s)}}function hs(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof a=="function"?e.refCleanup=a(s):a.current=s}}catch(o){Ne(e,t,o)}}function Cn(e,t){var a=e.ref,s=e.refCleanup;if(a!==null)if(typeof s=="function")try{s()}catch(o){Ne(e,t,o)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(o){Ne(e,t,o)}else a.current=null}function Kf(e){var t=e.type,a=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&s.focus();break e;case"img":a.src?s.src=a.src:a.srcSet&&(s.srcset=a.srcSet)}}catch(o){Ne(e,e.return,o)}}function du(e,t,a){try{var s=e.stateNode;Tv(s,e.type,a,t),s[wt]=t}catch(o){Ne(e,e.return,o)}}function Yf(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&qa(e.type)||e.tag===4}function hu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Yf(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&&qa(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function fu(e,t,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=W));else if(s!==4&&(s===27&&qa(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(fu(e,t,a),e=e.sibling;e!==null;)fu(e,t,a),e=e.sibling}function Jl(e,t,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(s!==4&&(s===27&&qa(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Jl(e,t,a),e=e.sibling;e!==null;)Jl(e,t,a),e=e.sibling}function Jf(e){var t=e.stateNode,a=e.memoizedProps;try{for(var s=e.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);Et(t,s,a),t[Ve]=e,t[wt]=a}catch(u){Ne(e,e.return,u)}}var aa=!1,ht=!1,mu=!1,Xf=typeof WeakSet=="function"?WeakSet:Set,vt=null;function nv(e,t){if(e=e.containerInfo,Uu=po,e=sh(e),lc(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var s=a.getSelection&&a.getSelection();if(s&&s.rangeCount!==0){a=s.anchorNode;var o=s.anchorOffset,u=s.focusNode;s=s.focusOffset;try{a.nodeType,u.nodeType}catch{a=null;break e}var f=0,v=-1,_=-1,R=0,z=0,H=e,j=null;t:for(;;){for(var L;H!==a||o!==0&&H.nodeType!==3||(v=f+o),H!==u||s!==0&&H.nodeType!==3||(_=f+s),H.nodeType===3&&(f+=H.nodeValue.length),(L=H.firstChild)!==null;)j=H,H=L;for(;;){if(H===e)break t;if(j===a&&++R===o&&(v=f),j===u&&++z===s&&(_=f),(L=H.nextSibling)!==null)break;H=j,j=H.parentNode}H=L}a=v===-1||_===-1?null:{start:v,end:_}}else a=null}a=a||{start:0,end:0}}else a=null;for(Mu={focusedElem:e,selectionRange:a},po=!1,vt=t;vt!==null;)if(t=vt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,vt=e;else for(;vt!==null;){switch(t=vt,u=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)o=e[a],o.ref.impl=o.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,a=t,o=u.memoizedProps,u=u.memoizedState,s=a.stateNode;try{var F=mi(a.type,o);e=s.getSnapshotBeforeUpdate(F,u),s.__reactInternalSnapshotBeforeUpdate=e}catch(oe){Ne(a,a.return,oe)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)Hu(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Hu(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(l(163))}if(e=t.sibling,e!==null){e.return=t.return,vt=e;break}vt=t.return}}function Qf(e,t,a){var s=a.flags;switch(a.tag){case 0:case 11:case 15:ra(e,a),s&4&&ds(5,a);break;case 1:if(ra(e,a),s&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(f){Ne(a,a.return,f)}else{var o=mi(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(o,t,e.__reactInternalSnapshotBeforeUpdate)}catch(f){Ne(a,a.return,f)}}s&64&&Gf(a),s&512&&hs(a,a.return);break;case 3:if(ra(e,a),s&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{Lh(e,t)}catch(f){Ne(a,a.return,f)}}break;case 27:t===null&&s&4&&Jf(a);case 26:case 5:ra(e,a),t===null&&s&4&&Kf(a),s&512&&hs(a,a.return);break;case 12:ra(e,a);break;case 31:ra(e,a),s&4&&Ff(e,a);break;case 13:ra(e,a),s&4&&em(e,a),s&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=dv.bind(null,a),jv(e,a))));break;case 22:if(s=a.memoizedState!==null||aa,!s){t=t!==null&&t.memoizedState!==null||ht,o=aa;var u=ht;aa=s,(ht=t)&&!u?sa(e,a,(a.subtreeFlags&8772)!==0):ra(e,a),aa=o,ht=u}break;case 30:break;default:ra(e,a)}}function Wf(e){var t=e.alternate;t!==null&&(e.alternate=null,Wf(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&zr(t)),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 Ye=null,Bt=!1;function ia(e,t,a){for(a=a.child;a!==null;)Zf(e,t,a),a=a.sibling}function Zf(e,t,a){if(St&&typeof St.onCommitFiberUnmount=="function")try{St.onCommitFiberUnmount(pa,a)}catch{}switch(a.tag){case 26:ht||Cn(a,t),ia(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:ht||Cn(a,t);var s=Ye,o=Bt;qa(a.type)&&(Ye=a.stateNode,Bt=!1),ia(e,t,a),ws(a.stateNode),Ye=s,Bt=o;break;case 5:ht||Cn(a,t);case 6:if(s=Ye,o=Bt,Ye=null,ia(e,t,a),Ye=s,Bt=o,Ye!==null)if(Bt)try{(Ye.nodeType===9?Ye.body:Ye.nodeName==="HTML"?Ye.ownerDocument.body:Ye).removeChild(a.stateNode)}catch(u){Ne(a,t,u)}else try{Ye.removeChild(a.stateNode)}catch(u){Ne(a,t,u)}break;case 18:Ye!==null&&(Bt?(e=Ye,Gm(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),or(e)):Gm(Ye,a.stateNode));break;case 4:s=Ye,o=Bt,Ye=a.stateNode.containerInfo,Bt=!0,ia(e,t,a),Ye=s,Bt=o;break;case 0:case 11:case 14:case 15:La(2,a,t),ht||La(4,a,t),ia(e,t,a);break;case 1:ht||(Cn(a,t),s=a.stateNode,typeof s.componentWillUnmount=="function"&&Vf(a,t,s)),ia(e,t,a);break;case 21:ia(e,t,a);break;case 22:ht=(s=ht)||a.memoizedState!==null,ia(e,t,a),ht=s;break;default:ia(e,t,a)}}function Ff(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{or(e)}catch(a){Ne(t,t.return,a)}}}function em(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{or(e)}catch(a){Ne(t,t.return,a)}}function av(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Xf),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Xf),t;default:throw Error(l(435,e.tag))}}function Xl(e,t){var a=av(e);t.forEach(function(s){if(!a.has(s)){a.add(s);var o=hv.bind(null,e,s);s.then(o,o)}})}function Ht(e,t){var a=t.deletions;if(a!==null)for(var s=0;s<a.length;s++){var o=a[s],u=e,f=t,v=f;e:for(;v!==null;){switch(v.tag){case 27:if(qa(v.type)){Ye=v.stateNode,Bt=!1;break e}break;case 5:Ye=v.stateNode,Bt=!1;break e;case 3:case 4:Ye=v.stateNode.containerInfo,Bt=!0;break e}v=v.return}if(Ye===null)throw Error(l(160));Zf(u,f,o),Ye=null,Bt=!1,u=o.alternate,u!==null&&(u.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)tm(t,e),t=t.sibling}var pn=null;function tm(e,t){var a=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ht(t,e),qt(e),s&4&&(La(3,e,e.return),ds(3,e),La(5,e,e.return));break;case 1:Ht(t,e),qt(e),s&512&&(ht||a===null||Cn(a,a.return)),s&64&&aa&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?s:a.concat(s))));break;case 26:var o=pn;if(Ht(t,e),qt(e),s&512&&(ht||a===null||Cn(a,a.return)),s&4){var u=a!==null?a.memoizedState:null;if(s=e.memoizedState,a===null)if(s===null)if(e.stateNode===null){e:{s=e.type,a=e.memoizedProps,o=o.ownerDocument||o;t:switch(s){case"title":u=o.getElementsByTagName("title")[0],(!u||u[Sa]||u[Ve]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=o.createElement(s),o.head.insertBefore(u,o.querySelector("head > title"))),Et(u,s,a),u[Ve]=e,qe(u),s=u;break e;case"link":var f=tg("link","href",o).get(s+(a.href||""));if(f){for(var v=0;v<f.length;v++)if(u=f[v],u.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&u.getAttribute("rel")===(a.rel==null?null:a.rel)&&u.getAttribute("title")===(a.title==null?null:a.title)&&u.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){f.splice(v,1);break t}}u=o.createElement(s),Et(u,s,a),o.head.appendChild(u);break;case"meta":if(f=tg("meta","content",o).get(s+(a.content||""))){for(v=0;v<f.length;v++)if(u=f[v],u.getAttribute("content")===(a.content==null?null:""+a.content)&&u.getAttribute("name")===(a.name==null?null:a.name)&&u.getAttribute("property")===(a.property==null?null:a.property)&&u.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&u.getAttribute("charset")===(a.charSet==null?null:a.charSet)){f.splice(v,1);break t}}u=o.createElement(s),Et(u,s,a),o.head.appendChild(u);break;default:throw Error(l(468,s))}u[Ve]=e,qe(u),s=u}e.stateNode=s}else ng(o,e.type,e.stateNode);else e.stateNode=eg(o,s,e.memoizedProps);else u!==s?(u===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):u.count--,s===null?ng(o,e.type,e.stateNode):eg(o,s,e.memoizedProps)):s===null&&e.stateNode!==null&&du(e,e.memoizedProps,a.memoizedProps)}break;case 27:Ht(t,e),qt(e),s&512&&(ht||a===null||Cn(a,a.return)),a!==null&&s&4&&du(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Ht(t,e),qt(e),s&512&&(ht||a===null||Cn(a,a.return)),e.flags&32){o=e.stateNode;try{_a(o,"")}catch(F){Ne(e,e.return,F)}}s&4&&e.stateNode!=null&&(o=e.memoizedProps,du(e,o,a!==null?a.memoizedProps:o)),s&1024&&(mu=!0);break;case 6:if(Ht(t,e),qt(e),s&4){if(e.stateNode===null)throw Error(l(162));s=e.memoizedProps,a=e.stateNode;try{a.nodeValue=s}catch(F){Ne(e,e.return,F)}}break;case 3:if(ho=null,o=pn,pn=co(t.containerInfo),Ht(t,e),pn=o,qt(e),s&4&&a!==null&&a.memoizedState.isDehydrated)try{or(t.containerInfo)}catch(F){Ne(e,e.return,F)}mu&&(mu=!1,nm(e));break;case 4:s=pn,pn=co(e.stateNode.containerInfo),Ht(t,e),qt(e),pn=s;break;case 12:Ht(t,e),qt(e);break;case 31:Ht(t,e),qt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Xl(e,s)));break;case 13:Ht(t,e),qt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Wl=Ot()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Xl(e,s)));break;case 22:o=e.memoizedState!==null;var _=a!==null&&a.memoizedState!==null,R=aa,z=ht;if(aa=R||o,ht=z||_,Ht(t,e),ht=z,aa=R,qt(e),s&8192)e:for(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,o&&(a===null||_||aa||ht||gi(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){_=a=t;try{if(u=_.stateNode,o)f=u.style,typeof f.setProperty=="function"?f.setProperty("display","none","important"):f.display="none";else{v=_.stateNode;var H=_.memoizedProps.style,j=H!=null&&H.hasOwnProperty("display")?H.display:null;v.style.display=j==null||typeof j=="boolean"?"":(""+j).trim()}}catch(F){Ne(_,_.return,F)}}}else if(t.tag===6){if(a===null){_=t;try{_.stateNode.nodeValue=o?"":_.memoizedProps}catch(F){Ne(_,_.return,F)}}}else if(t.tag===18){if(a===null){_=t;try{var L=_.stateNode;o?Vm(L,!0):Vm(_.stateNode,!1)}catch(F){Ne(_,_.return,F)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;a===t&&(a=null),t=t.return}a===t&&(a=null),t.sibling.return=t.return,t=t.sibling}s&4&&(s=e.updateQueue,s!==null&&(a=s.retryQueue,a!==null&&(s.retryQueue=null,Xl(e,a))));break;case 19:Ht(t,e),qt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Xl(e,s)));break;case 30:break;case 21:break;default:Ht(t,e),qt(e)}}function qt(e){var t=e.flags;if(t&2){try{for(var a,s=e.return;s!==null;){if(Yf(s)){a=s;break}s=s.return}if(a==null)throw Error(l(160));switch(a.tag){case 27:var o=a.stateNode,u=hu(e);Jl(e,u,o);break;case 5:var f=a.stateNode;a.flags&32&&(_a(f,""),a.flags&=-33);var v=hu(e);Jl(e,v,f);break;case 3:case 4:var _=a.stateNode.containerInfo,R=hu(e);fu(e,R,_);break;default:throw Error(l(161))}}catch(z){Ne(e,e.return,z)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function nm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;nm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ra(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Qf(e,t.alternate,t),t=t.sibling}function gi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:La(4,t,t.return),gi(t);break;case 1:Cn(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&Vf(t,t.return,a),gi(t);break;case 27:ws(t.stateNode);case 26:case 5:Cn(t,t.return),gi(t);break;case 22:t.memoizedState===null&&gi(t);break;case 30:gi(t);break;default:gi(t)}e=e.sibling}}function sa(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,o=e,u=t,f=u.flags;switch(u.tag){case 0:case 11:case 15:sa(o,u,a),ds(4,u);break;case 1:if(sa(o,u,a),s=u,o=s.stateNode,typeof o.componentDidMount=="function")try{o.componentDidMount()}catch(R){Ne(s,s.return,R)}if(s=u,o=s.updateQueue,o!==null){var v=s.stateNode;try{var _=o.shared.hiddenCallbacks;if(_!==null)for(o.shared.hiddenCallbacks=null,o=0;o<_.length;o++)Nh(_[o],v)}catch(R){Ne(s,s.return,R)}}a&&f&64&&Gf(u),hs(u,u.return);break;case 27:Jf(u);case 26:case 5:sa(o,u,a),a&&s===null&&f&4&&Kf(u),hs(u,u.return);break;case 12:sa(o,u,a);break;case 31:sa(o,u,a),a&&f&4&&Ff(o,u);break;case 13:sa(o,u,a),a&&f&4&&em(o,u);break;case 22:u.memoizedState===null&&sa(o,u,a),hs(u,u.return);break;case 30:break;default:sa(o,u,a)}t=t.sibling}}function gu(e,t){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Zr(a))}function pu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Zr(e))}function yn(e,t,a,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)am(e,t,a,s),t=t.sibling}function am(e,t,a,s){var o=t.flags;switch(t.tag){case 0:case 11:case 15:yn(e,t,a,s),o&2048&&ds(9,t);break;case 1:yn(e,t,a,s);break;case 3:yn(e,t,a,s),o&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Zr(e)));break;case 12:if(o&2048){yn(e,t,a,s),e=t.stateNode;try{var u=t.memoizedProps,f=u.id,v=u.onPostCommit;typeof v=="function"&&v(f,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(_){Ne(t,t.return,_)}}else yn(e,t,a,s);break;case 31:yn(e,t,a,s);break;case 13:yn(e,t,a,s);break;case 23:break;case 22:u=t.stateNode,f=t.alternate,t.memoizedState!==null?u._visibility&2?yn(e,t,a,s):fs(e,t):u._visibility&2?yn(e,t,a,s):(u._visibility|=2,Wi(e,t,a,s,(t.subtreeFlags&10256)!==0||!1)),o&2048&&gu(f,t);break;case 24:yn(e,t,a,s),o&2048&&pu(t.alternate,t);break;default:yn(e,t,a,s)}}function Wi(e,t,a,s,o){for(o=o&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,f=t,v=a,_=s,R=f.flags;switch(f.tag){case 0:case 11:case 15:Wi(u,f,v,_,o),ds(8,f);break;case 23:break;case 22:var z=f.stateNode;f.memoizedState!==null?z._visibility&2?Wi(u,f,v,_,o):fs(u,f):(z._visibility|=2,Wi(u,f,v,_,o)),o&&R&2048&&gu(f.alternate,f);break;case 24:Wi(u,f,v,_,o),o&&R&2048&&pu(f.alternate,f);break;default:Wi(u,f,v,_,o)}t=t.sibling}}function fs(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,s=t,o=s.flags;switch(s.tag){case 22:fs(a,s),o&2048&&gu(s.alternate,s);break;case 24:fs(a,s),o&2048&&pu(s.alternate,s);break;default:fs(a,s)}t=t.sibling}}var ms=8192;function Zi(e,t,a){if(e.subtreeFlags&ms)for(e=e.child;e!==null;)im(e,t,a),e=e.sibling}function im(e,t,a){switch(e.tag){case 26:Zi(e,t,a),e.flags&ms&&e.memoizedState!==null&&Iv(a,pn,e.memoizedState,e.memoizedProps);break;case 5:Zi(e,t,a);break;case 3:case 4:var s=pn;pn=co(e.stateNode.containerInfo),Zi(e,t,a),pn=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=ms,ms=16777216,Zi(e,t,a),ms=s):Zi(e,t,a));break;default:Zi(e,t,a)}}function rm(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function gs(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var s=t[a];vt=s,lm(s,e)}rm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)sm(e),e=e.sibling}function sm(e){switch(e.tag){case 0:case 11:case 15:gs(e),e.flags&2048&&La(9,e,e.return);break;case 3:gs(e);break;case 12:gs(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ql(e)):gs(e);break;default:gs(e)}}function Ql(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var s=t[a];vt=s,lm(s,e)}rm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:La(8,t,t.return),Ql(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,Ql(t));break;default:Ql(t)}e=e.sibling}}function lm(e,t){for(;vt!==null;){var a=vt;switch(a.tag){case 0:case 11:case 15:La(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var s=a.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:Zr(a.memoizedState.cache)}if(s=a.child,s!==null)s.return=a,vt=s;else e:for(a=e;vt!==null;){s=vt;var o=s.sibling,u=s.return;if(Wf(s),s===a){vt=null;break e}if(o!==null){o.return=u,vt=o;break e}vt=u}}}var iv={getCacheForType:function(e){var t=Tt(ct),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return Tt(ct).controller.signal}},rv=typeof WeakMap=="function"?WeakMap:Map,Re=0,Be=null,ve=null,_e=0,je=0,Wt=null,Da=!1,Fi=!1,yu=!1,la=0,Fe=0,Ua=0,pi=0,vu=0,Zt=0,er=0,ps=null,$t=null,bu=!1,Wl=0,om=0,Zl=1/0,Fl=null,Ma=null,gt=0,za=null,tr=null,oa=0,Su=0,wu=null,cm=null,ys=0,_u=null;function Ft(){return(Re&2)!==0&&_e!==0?_e&-_e:D.T!==null?Cu():Mr()}function um(){if(Zt===0)if((_e&536870912)===0||ke){var e=Xa;Xa<<=1,(Xa&3932160)===0&&(Xa=262144),Zt=e}else Zt=536870912;return e=Xt.current,e!==null&&(e.flags|=32),Zt}function Pt(e,t,a){(e===Be&&(je===2||je===9)||e.cancelPendingCommit!==null)&&(nr(e,0),Ba(e,_e,Zt,!1)),zn(e,a),((Re&2)===0||e!==Be)&&(e===Be&&((Re&2)===0&&(pi|=a),Fe===4&&Ba(e,_e,Zt,!1)),On(e))}function dm(e,t,a){if((Re&6)!==0)throw Error(l(327));var s=!a&&(t&127)===0&&(t&e.expiredLanes)===0||En(e,t),o=s?ov(e,t):ku(e,t,!0),u=s;do{if(o===0){Fi&&!s&&Ba(e,t,0,!1);break}else{if(a=e.current.alternate,u&&!sv(a)){o=ku(e,t,!1),u=!1;continue}if(o===2){if(u=t,e.errorRecoveryDisabledLanes&u)var f=0;else f=e.pendingLanes&-536870913,f=f!==0?f:f&536870912?536870912:0;if(f!==0){t=f;e:{var v=e;o=ps;var _=v.current.memoizedState.isDehydrated;if(_&&(nr(v,f).flags|=256),f=ku(v,f,!1),f!==2){if(yu&&!_){v.errorRecoveryDisabledLanes|=u,pi|=u,o=4;break e}u=$t,$t=o,u!==null&&($t===null?$t=u:$t.push.apply($t,u))}o=f}if(u=!1,o!==2)continue}}if(o===1){nr(e,0),Ba(e,t,0,!0);break}e:{switch(s=e,u=o,u){case 0:case 1:throw Error(l(345));case 4:if((t&4194048)!==t)break;case 6:Ba(s,t,Zt,!Da);break e;case 2:$t=null;break;case 3:case 5:break;default:throw Error(l(329))}if((t&62914560)===t&&(o=Wl+300-Ot(),10<o)){if(Ba(s,t,Zt,!Da),va(s,0,!0)!==0)break e;oa=t,s.timeoutHandle=Pm(hm.bind(null,s,a,$t,Fl,bu,t,Zt,pi,er,Da,u,"Throttled",-0,0),o);break e}hm(s,a,$t,Fl,bu,t,Zt,pi,er,Da,u,null,-0,0)}}break}while(!0);On(e)}function hm(e,t,a,s,o,u,f,v,_,R,z,H,j,L){if(e.timeoutHandle=-1,H=t.subtreeFlags,H&8192||(H&16785408)===16785408){H={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:W},im(t,u,H);var F=(u&62914560)===u?Wl-Ot():(u&4194048)===u?om-Ot():0;if(F=Gv(H,F),F!==null){oa=u,e.cancelPendingCommit=F(Sm.bind(null,e,t,u,a,s,o,f,v,_,z,H,null,j,L)),Ba(e,u,f,!R);return}}Sm(e,t,u,a,s,o,f,v,_)}function sv(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var s=0;s<a.length;s++){var o=a[s],u=o.getSnapshot;o=o.value;try{if(!Yt(u(),o))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ba(e,t,a,s){t&=~vu,t&=~pi,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var o=t;0<o;){var u=31-lt(o),f=1<<u;s[u]=-1,o&=~f}a!==0&&Lr(e,a,t)}function eo(){return(Re&6)===0?(vs(0),!1):!0}function Tu(){if(ve!==null){if(je===0)var e=ve.return;else e=ve,Wn=li=null,Hc(e),Ki=null,es=0,e=ve;for(;e!==null;)If(e.alternate,e),e=e.return;ve=null}}function nr(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,Av(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),oa=0,Tu(),Be=e,ve=a=Xn(e.current,null),_e=t,je=0,Wt=null,Da=!1,Fi=En(e,t),yu=!1,er=Zt=vu=pi=Ua=Fe=0,$t=ps=null,bu=!1,(t&8)!==0&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var o=31-lt(s),u=1<<o;t|=e[o],s&=~u}return la=t,wl(),a}function fm(e,t){ge=null,D.H=os,t===Vi||t===Ol?(t=Ch(),je=3):t===xc?(t=Ch(),je=4):je=t===tu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Wt=t,ve===null&&(Fe=1,Il(e,rn(t,e.current)))}function mm(){var e=Xt.current;return e===null?!0:(_e&4194048)===_e?cn===null:(_e&62914560)===_e||(_e&536870912)!==0?e===cn:!1}function gm(){var e=D.H;return D.H=os,e===null?os:e}function pm(){var e=D.A;return D.A=iv,e}function to(){Fe=4,Da||(_e&4194048)!==_e&&Xt.current!==null||(Fi=!0),(Ua&134217727)===0&&(pi&134217727)===0||Be===null||Ba(Be,_e,Zt,!1)}function ku(e,t,a){var s=Re;Re|=2;var o=gm(),u=pm();(Be!==e||_e!==t)&&(Fl=null,nr(e,t)),t=!1;var f=Fe;e:do try{if(je!==0&&ve!==null){var v=ve,_=Wt;switch(je){case 8:Tu(),f=6;break e;case 3:case 2:case 9:case 6:Xt.current===null&&(t=!0);var R=je;if(je=0,Wt=null,ar(e,v,_,R),a&&Fi){f=0;break e}break;default:R=je,je=0,Wt=null,ar(e,v,_,R)}}lv(),f=Fe;break}catch(z){fm(e,z)}while(!0);return t&&e.shellSuspendCounter++,Wn=li=null,Re=s,D.H=o,D.A=u,ve===null&&(Be=null,_e=0,wl()),f}function lv(){for(;ve!==null;)ym(ve)}function ov(e,t){var a=Re;Re|=2;var s=gm(),o=pm();Be!==e||_e!==t?(Fl=null,Zl=Ot()+500,nr(e,t)):Fi=En(e,t);e:do try{if(je!==0&&ve!==null){t=ve;var u=Wt;t:switch(je){case 1:je=0,Wt=null,ar(e,t,u,1);break;case 2:case 9:if(Ah(u)){je=0,Wt=null,vm(t);break}t=function(){je!==2&&je!==9||Be!==e||(je=7),On(e)},u.then(t,t);break e;case 3:je=7;break e;case 4:je=5;break e;case 7:Ah(u)?(je=0,Wt=null,vm(t)):(je=0,Wt=null,ar(e,t,u,7));break;case 5:var f=null;switch(ve.tag){case 26:f=ve.memoizedState;case 5:case 27:var v=ve;if(f?ag(f):v.stateNode.complete){je=0,Wt=null;var _=v.sibling;if(_!==null)ve=_;else{var R=v.return;R!==null?(ve=R,no(R)):ve=null}break t}}je=0,Wt=null,ar(e,t,u,5);break;case 6:je=0,Wt=null,ar(e,t,u,6);break;case 8:Tu(),Fe=6;break e;default:throw Error(l(462))}}cv();break}catch(z){fm(e,z)}while(!0);return Wn=li=null,D.H=s,D.A=o,Re=a,ve!==null?0:(Be=null,_e=0,wl(),Fe)}function cv(){for(;ve!==null&&!xi();)ym(ve)}function ym(e){var t=$f(e.alternate,e,la);e.memoizedProps=e.pendingProps,t===null?no(e):ve=t}function vm(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=Uf(a,t,t.pendingProps,t.type,void 0,_e);break;case 11:t=Uf(a,t,t.pendingProps,t.type.render,t.ref,_e);break;case 5:Hc(t);default:If(a,t),t=ve=gh(t,la),t=$f(a,t,la)}e.memoizedProps=e.pendingProps,t===null?no(e):ve=t}function ar(e,t,a,s){Wn=li=null,Hc(t),Ki=null,es=0;var o=t.return;try{if(Wy(e,o,t,a,_e)){Fe=1,Il(e,rn(a,e.current)),ve=null;return}}catch(u){if(o!==null)throw ve=o,u;Fe=1,Il(e,rn(a,e.current)),ve=null;return}t.flags&32768?(ke||s===1?e=!0:Fi||(_e&536870912)!==0?e=!1:(Da=e=!0,(s===2||s===9||s===3||s===6)&&(s=Xt.current,s!==null&&s.tag===13&&(s.flags|=16384))),bm(t,e)):no(t)}function no(e){var t=e;do{if((t.flags&32768)!==0){bm(t,Da);return}e=t.return;var a=ev(t.alternate,t,la);if(a!==null){ve=a;return}if(t=t.sibling,t!==null){ve=t;return}ve=t=e}while(t!==null);Fe===0&&(Fe=5)}function bm(e,t){do{var a=tv(e.alternate,e);if(a!==null){a.flags&=32767,ve=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){ve=e;return}ve=e=a}while(e!==null);Fe=6,ve=null}function Sm(e,t,a,s,o,u,f,v,_){e.cancelPendingCommit=null;do ao();while(gt!==0);if((Re&6)!==0)throw Error(l(327));if(t!==null){if(t===e.current)throw Error(l(177));if(u=t.lanes|t.childLanes,u|=hc,Qo(e,a,u,f,v,_),e===Be&&(ve=Be=null,_e=0),tr=t,za=e,oa=a,Su=u,wu=o,cm=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,fv(Ja,function(){return Em(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=D.T,D.T=null,o=K.p,K.p=2,f=Re,Re|=4;try{nv(e,t,a)}finally{Re=f,K.p=o,D.T=s}}gt=1,wm(),_m(),Tm()}}function wm(){if(gt===1){gt=0;var e=za,t=tr,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=D.T,D.T=null;var s=K.p;K.p=2;var o=Re;Re|=4;try{tm(t,e);var u=Mu,f=sh(e.containerInfo),v=u.focusedElem,_=u.selectionRange;if(f!==v&&v&&v.ownerDocument&&rh(v.ownerDocument.documentElement,v)){if(_!==null&&lc(v)){var R=_.start,z=_.end;if(z===void 0&&(z=R),"selectionStart"in v)v.selectionStart=R,v.selectionEnd=Math.min(z,v.value.length);else{var H=v.ownerDocument||document,j=H&&H.defaultView||window;if(j.getSelection){var L=j.getSelection(),F=v.textContent.length,oe=Math.min(_.start,F),Me=_.end===void 0?oe:Math.min(_.end,F);!L.extend&&oe>Me&&(f=Me,Me=oe,oe=f);var x=ih(v,oe),k=ih(v,Me);if(x&&k&&(L.rangeCount!==1||L.anchorNode!==x.node||L.anchorOffset!==x.offset||L.focusNode!==k.node||L.focusOffset!==k.offset)){var O=H.createRange();O.setStart(x.node,x.offset),L.removeAllRanges(),oe>Me?(L.addRange(O),L.extend(k.node,k.offset)):(O.setEnd(k.node,k.offset),L.addRange(O))}}}}for(H=[],L=v;L=L.parentNode;)L.nodeType===1&&H.push({element:L,left:L.scrollLeft,top:L.scrollTop});for(typeof v.focus=="function"&&v.focus(),v=0;v<H.length;v++){var B=H[v];B.element.scrollLeft=B.left,B.element.scrollTop=B.top}}po=!!Uu,Mu=Uu=null}finally{Re=o,K.p=s,D.T=a}}e.current=t,gt=2}}function _m(){if(gt===2){gt=0;var e=za,t=tr,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=D.T,D.T=null;var s=K.p;K.p=2;var o=Re;Re|=4;try{Qf(e,t.alternate,t)}finally{Re=o,K.p=s,D.T=a}}gt=3}}function Tm(){if(gt===4||gt===3){gt=0,Mn();var e=za,t=tr,a=oa,s=cm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?gt=5:(gt=0,tr=za=null,km(e,e.pendingLanes));var o=e.pendingLanes;if(o===0&&(Ma=null),Qa(a),t=t.stateNode,St&&typeof St.onCommitFiberRoot=="function")try{St.onCommitFiberRoot(pa,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=D.T,o=K.p,K.p=2,D.T=null;try{for(var u=e.onRecoverableError,f=0;f<s.length;f++){var v=s[f];u(v.value,{componentStack:v.stack})}}finally{D.T=t,K.p=o}}(oa&3)!==0&&ao(),On(e),o=e.pendingLanes,(a&261930)!==0&&(o&42)!==0?e===_u?ys++:(ys=0,_u=e):ys=0,vs(0)}}function km(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Zr(t)))}function ao(){return wm(),_m(),Tm(),Em()}function Em(){if(gt!==5)return!1;var e=za,t=Su;Su=0;var a=Qa(oa),s=D.T,o=K.p;try{K.p=32>a?32:a,D.T=null,a=wu,wu=null;var u=za,f=oa;if(gt=0,tr=za=null,oa=0,(Re&6)!==0)throw Error(l(331));var v=Re;if(Re|=4,sm(u.current),am(u,u.current,f,a),Re=v,vs(0,!1),St&&typeof St.onPostCommitFiberRoot=="function")try{St.onPostCommitFiberRoot(pa,u)}catch{}return!0}finally{K.p=o,D.T=s,km(e,t)}}function Am(e,t,a){t=rn(a,t),t=eu(e.stateNode,t,2),e=Ra(e,t,2),e!==null&&(zn(e,2),On(e))}function Ne(e,t,a){if(e.tag===3)Am(e,e,a);else for(;t!==null;){if(t.tag===3){Am(t,e,a);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Ma===null||!Ma.has(s))){e=rn(a,e),a=xf(2),s=Ra(t,a,2),s!==null&&(Cf(a,s,t,e),zn(s,2),On(s));break}}t=t.return}}function Eu(e,t,a){var s=e.pingCache;if(s===null){s=e.pingCache=new rv;var o=new Set;s.set(t,o)}else o=s.get(t),o===void 0&&(o=new Set,s.set(t,o));o.has(a)||(yu=!0,o.add(a),e=uv.bind(null,e,t,a),t.then(e,e))}function uv(e,t,a){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Be===e&&(_e&a)===a&&(Fe===4||Fe===3&&(_e&62914560)===_e&&300>Ot()-Wl?(Re&2)===0&&nr(e,0):vu|=a,er===_e&&(er=0)),On(e)}function xm(e,t){t===0&&(t=jr()),e=ii(e,t),e!==null&&(zn(e,t),On(e))}function dv(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),xm(e,a)}function hv(e,t){var a=0;switch(e.tag){case 31:case 13:var s=e.stateNode,o=e.memoizedState;o!==null&&(a=o.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(l(314))}s!==null&&s.delete(t),xm(e,a)}function fv(e,t){return Un(e,t)}var io=null,ir=null,Au=!1,ro=!1,xu=!1,Ha=0;function On(e){e!==ir&&e.next===null&&(ir===null?io=ir=e:ir=ir.next=e),ro=!0,Au||(Au=!0,gv())}function vs(e,t){if(!xu&&ro){xu=!0;do for(var a=!1,s=io;s!==null;){if(e!==0){var o=s.pendingLanes;if(o===0)var u=0;else{var f=s.suspendedLanes,v=s.pingedLanes;u=(1<<31-lt(42|e)+1)-1,u&=o&~(f&~v),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(a=!0,jm(s,u))}else u=_e,u=va(s,s===Be?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(u&3)===0||En(s,u)||(a=!0,jm(s,u));s=s.next}while(a);xu=!1}}function mv(){Cm()}function Cm(){ro=Au=!1;var e=0;Ha!==0&&Ev()&&(e=Ha);for(var t=Ot(),a=null,s=io;s!==null;){var o=s.next,u=Om(s,t);u===0?(s.next=null,a===null?io=o:a.next=o,o===null&&(ir=a)):(a=s,(e!==0||(u&3)!==0)&&(ro=!0)),s=o}gt!==0&&gt!==5||vs(e),Ha!==0&&(Ha=0)}function Om(e,t){for(var a=e.suspendedLanes,s=e.pingedLanes,o=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var f=31-lt(u),v=1<<f,_=o[f];_===-1?((v&a)===0||(v&s)!==0)&&(o[f]=nl(v,t)):_<=t&&(e.expiredLanes|=v),u&=~v}if(t=Be,a=_e,a=va(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,a===0||e===t&&(je===2||je===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&Ai(s),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||En(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(s!==null&&Ai(s),Qa(a)){case 2:case 8:a=Ci;break;case 32:a=Ja;break;case 268435456:a=tl;break;default:a=Ja}return s=Rm.bind(null,e),a=Un(a,s),e.callbackPriority=t,e.callbackNode=a,t}return s!==null&&s!==null&&Ai(s),e.callbackPriority=2,e.callbackNode=null,2}function Rm(e,t){if(gt!==0&&gt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(ao()&&e.callbackNode!==a)return null;var s=_e;return s=va(e,e===Be?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(dm(e,s,t),Om(e,Ot()),e.callbackNode!=null&&e.callbackNode===a?Rm.bind(null,e):null)}function jm(e,t){if(ao())return null;dm(e,t,!0)}function gv(){xv(function(){(Re&6)!==0?Un(Rr,mv):Cm()})}function Cu(){if(Ha===0){var e=Ii;e===0&&(e=ya,ya<<=1,(ya&261888)===0&&(ya=256)),Ha=e}return Ha}function Nm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ie(""+e)}function Lm(e,t){var a=t.ownerDocument.createElement("input");return a.name=t.name,a.value=t.value,e.id&&a.setAttribute("form",e.id),t.parentNode.insertBefore(a,t),e=new FormData(e),a.parentNode.removeChild(a),e}function pv(e,t,a,s,o){if(t==="submit"&&a&&a.stateNode===o){var u=Nm((o[wt]||null).action),f=s.submitter;f&&(t=(t=f[wt]||null)?Nm(t.formAction):f.getAttribute("formAction"),t!==null&&(u=t,f=null));var v=new yl("action","action",null,s,o);e.push({event:v,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Ha!==0){var _=f?Lm(o,f):new FormData(o);Jc(a,{pending:!0,data:_,method:o.method,action:u},null,_)}}else typeof u=="function"&&(v.preventDefault(),_=f?Lm(o,f):new FormData(o),Jc(a,{pending:!0,data:_,method:o.method,action:u},u,_))},currentTarget:o}]})}}for(var Ou=0;Ou<dc.length;Ou++){var Ru=dc[Ou],yv=Ru.toLowerCase(),vv=Ru[0].toUpperCase()+Ru.slice(1);gn(yv,"on"+vv)}gn(ch,"onAnimationEnd"),gn(uh,"onAnimationIteration"),gn(dh,"onAnimationStart"),gn("dblclick","onDoubleClick"),gn("focusin","onFocus"),gn("focusout","onBlur"),gn(Dy,"onTransitionRun"),gn(Uy,"onTransitionStart"),gn(My,"onTransitionCancel"),gn(hh,"onTransitionEnd"),In("onMouseEnter",["mouseout","mouseover"]),In("onMouseLeave",["mouseout","mouseover"]),In("onPointerEnter",["pointerout","pointerover"]),In("onPointerLeave",["pointerout","pointerover"]),Pn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Pn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Pn("onBeforeInput",["compositionend","keypress","textInput","paste"]),Pn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Pn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Pn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var bs="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(" "),bv=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(bs));function Dm(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var s=e[a],o=s.event;s=s.listeners;e:{var u=void 0;if(t)for(var f=s.length-1;0<=f;f--){var v=s[f],_=v.instance,R=v.currentTarget;if(v=v.listener,_!==u&&o.isPropagationStopped())break e;u=v,o.currentTarget=R;try{u(o)}catch(z){Sl(z)}o.currentTarget=null,u=_}else for(f=0;f<s.length;f++){if(v=s[f],_=v.instance,R=v.currentTarget,v=v.listener,_!==u&&o.isPropagationStopped())break e;u=v,o.currentTarget=R;try{u(o)}catch(z){Sl(z)}o.currentTarget=null,u=_}}}}function be(e,t){var a=t[Hn];a===void 0&&(a=t[Hn]=new Set);var s=e+"__bubble";a.has(s)||(Um(t,e,2,!1),a.add(s))}function ju(e,t,a){var s=0;t&&(s|=4),Um(a,e,s,t)}var so="_reactListening"+Math.random().toString(36).slice(2);function Nu(e){if(!e[so]){e[so]=!0,Br.forEach(function(a){a!=="selectionchange"&&(bv.has(a)||ju(a,!1,e),ju(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[so]||(t[so]=!0,ju("selectionchange",!1,t))}}function Um(e,t,a,s){switch(ug(t)){case 2:var o=Yv;break;case 8:o=Jv;break;default:o=Yu}a=o.bind(null,t,a,e),o=void 0,!Li||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),s?o!==void 0?e.addEventListener(t,a,{capture:!0,passive:o}):e.addEventListener(t,a,!0):o!==void 0?e.addEventListener(t,a,{passive:o}):e.addEventListener(t,a,!1)}function Lu(e,t,a,s,o){var u=s;if((t&1)===0&&(t&2)===0&&s!==null)e:for(;;){if(s===null)return;var f=s.tag;if(f===3||f===4){var v=s.stateNode.containerInfo;if(v===o)break;if(f===4)for(f=s.return;f!==null;){var _=f.tag;if((_===3||_===4)&&f.stateNode.containerInfo===o)return;f=f.return}for(;v!==null;){if(f=qn(v),f===null)return;if(_=f.tag,_===5||_===6||_===26||_===27){s=u=f;continue e}v=v.parentNode}}s=s.return}fl(function(){var R=u,z=ce(a),H=[];e:{var j=fh.get(e);if(j!==void 0){var L=yl,F=e;switch(e){case"keypress":if(gl(a)===0)break e;case"keydown":case"keyup":L=hy;break;case"focusin":F="focus",L=nc;break;case"focusout":F="blur",L=nc;break;case"beforeblur":case"afterblur":L=nc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":L=Pd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":L=ey;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":L=gy;break;case ch:case uh:case dh:L=ay;break;case hh:L=yy;break;case"scroll":case"scrollend":L=Zp;break;case"wheel":L=by;break;case"copy":case"cut":case"paste":L=ry;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":L=Gd;break;case"toggle":case"beforetoggle":L=wy}var oe=(t&4)!==0,Me=!oe&&(e==="scroll"||e==="scrollend"),x=oe?j!==null?j+"Capture":null:j;oe=[];for(var k=R,O;k!==null;){var B=k;if(O=B.stateNode,B=B.tag,B!==5&&B!==26&&B!==27||O===null||x===null||(B=ei(k,x),B!=null&&oe.push(Ss(k,B,O))),Me)break;k=k.return}0<oe.length&&(j=new L(j,F,null,a,z),H.push({event:j,listeners:oe}))}}if((t&7)===0){e:{if(j=e==="mouseover"||e==="pointerover",L=e==="mouseout"||e==="pointerout",j&&a!==fe&&(F=a.relatedTarget||a.fromElement)&&(qn(F)||F[Bn]))break e;if((L||j)&&(j=z.window===z?z:(j=z.ownerDocument)?j.defaultView||j.parentWindow:window,L?(F=a.relatedTarget||a.toElement,L=R,F=F?qn(F):null,F!==null&&(Me=d(F),oe=F.tag,F!==Me||oe!==5&&oe!==27&&oe!==6)&&(F=null)):(L=null,F=R),L!==F)){if(oe=Pd,B="onMouseLeave",x="onMouseEnter",k="mouse",(e==="pointerout"||e==="pointerover")&&(oe=Gd,B="onPointerLeave",x="onPointerEnter",k="pointer"),Me=L==null?j:Wa(L),O=F==null?j:Wa(F),j=new oe(B,k+"leave",L,a,z),j.target=Me,j.relatedTarget=O,B=null,qn(z)===R&&(oe=new oe(x,k+"enter",F,a,z),oe.target=O,oe.relatedTarget=Me,B=oe),Me=B,L&&F)t:{for(oe=Sv,x=L,k=F,O=0,B=x;B;B=oe(B))O++;B=0;for(var re=k;re;re=oe(re))B++;for(;0<O-B;)x=oe(x),O--;for(;0<B-O;)k=oe(k),B--;for(;O--;){if(x===k||k!==null&&x===k.alternate){oe=x;break t}x=oe(x),k=oe(k)}oe=null}else oe=null;L!==null&&Mm(H,j,L,oe,!1),F!==null&&Me!==null&&Mm(H,Me,F,oe,!0)}}e:{if(j=R?Wa(R):window,L=j.nodeName&&j.nodeName.toLowerCase(),L==="select"||L==="input"&&j.type==="file")var Ce=Zd;else if(Qd(j))if(Fd)Ce=jy;else{Ce=Oy;var ne=Cy}else L=j.nodeName,!L||L.toLowerCase()!=="input"||j.type!=="checkbox"&&j.type!=="radio"?R&&Pr(R.elementType)&&(Ce=Zd):Ce=Ry;if(Ce&&(Ce=Ce(e,R))){Wd(H,Ce,a,z);break e}ne&&ne(e,j,R),e==="focusout"&&R&&j.type==="number"&&R.memoizedProps.value!=null&&Vn(j,"number",j.value)}switch(ne=R?Wa(R):window,e){case"focusin":(Qd(ne)||ne.contentEditable==="true")&&(Ui=ne,oc=R,Xr=null);break;case"focusout":Xr=oc=Ui=null;break;case"mousedown":cc=!0;break;case"contextmenu":case"mouseup":case"dragend":cc=!1,lh(H,a,z);break;case"selectionchange":if(Ly)break;case"keydown":case"keyup":lh(H,a,z)}var pe;if(ic)e:{switch(e){case"compositionstart":var Te="onCompositionStart";break e;case"compositionend":Te="onCompositionEnd";break e;case"compositionupdate":Te="onCompositionUpdate";break e}Te=void 0}else Di?Jd(e,a)&&(Te="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Te="onCompositionStart");Te&&(Vd&&a.locale!=="ko"&&(Di||Te!=="onCompositionStart"?Te==="onCompositionEnd"&&Di&&(pe=qd()):(Ta=z,Fo="value"in Ta?Ta.value:Ta.textContent,Di=!0)),ne=lo(R,Te),0<ne.length&&(Te=new Id(Te,e,null,a,z),H.push({event:Te,listeners:ne}),pe?Te.data=pe:(pe=Xd(a),pe!==null&&(Te.data=pe)))),(pe=Ty?ky(e,a):Ey(e,a))&&(Te=lo(R,"onBeforeInput"),0<Te.length&&(ne=new Id("onBeforeInput","beforeinput",null,a,z),H.push({event:ne,listeners:Te}),ne.data=pe)),pv(H,e,R,a,z)}Dm(H,t)})}function Ss(e,t,a){return{instance:e,listener:t,currentTarget:a}}function lo(e,t){for(var a=t+"Capture",s=[];e!==null;){var o=e,u=o.stateNode;if(o=o.tag,o!==5&&o!==26&&o!==27||u===null||(o=ei(e,a),o!=null&&s.unshift(Ss(e,o,u)),o=ei(e,t),o!=null&&s.push(Ss(e,o,u))),e.tag===3)return s;e=e.return}return[]}function Sv(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Mm(e,t,a,s,o){for(var u=t._reactName,f=[];a!==null&&a!==s;){var v=a,_=v.alternate,R=v.stateNode;if(v=v.tag,_!==null&&_===s)break;v!==5&&v!==26&&v!==27||R===null||(_=R,o?(R=ei(a,u),R!=null&&f.unshift(Ss(a,R,_))):o||(R=ei(a,u),R!=null&&f.push(Ss(a,R,_)))),a=a.return}f.length!==0&&e.push({event:t,listeners:f})}var wv=/\r\n?/g,_v=/\u0000|\uFFFD/g;function zm(e){return(typeof e=="string"?e:""+e).replace(wv,`
9
- `).replace(_v,"")}function Bm(e,t){return t=zm(t),zm(e)===t}function Ue(e,t,a,s,o,u){switch(a){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||_a(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&_a(e,""+s);break;case"className":Gn(e,"class",s);break;case"tabIndex":Gn(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":Gn(e,a,s);break;case"style":hl(e,s,u);break;case"data":if(t!=="object"){Gn(e,"data",s);break}case"src":case"href":if(s===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(a);break}s=ie(""+s),e.setAttribute(a,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(a,"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 u=="function"&&(a==="formAction"?(t!=="input"&&Ue(e,t,"name",o.name,o,null),Ue(e,t,"formEncType",o.formEncType,o,null),Ue(e,t,"formMethod",o.formMethod,o,null),Ue(e,t,"formTarget",o.formTarget,o,null)):(Ue(e,t,"encType",o.encType,o,null),Ue(e,t,"method",o.method,o,null),Ue(e,t,"target",o.target,o,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(a);break}s=ie(""+s),e.setAttribute(a,s);break;case"onClick":s!=null&&(e.onclick=W);break;case"onScroll":s!=null&&be("scroll",e);break;case"onScrollEnd":s!=null&&be("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(l(61));if(a=s.__html,a!=null){if(o.children!=null)throw Error(l(60));e.innerHTML=a}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}a=ie(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,""+s):e.removeAttribute(a);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":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":s===!0?e.setAttribute(a,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,s):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(a,s):e.removeAttribute(a);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(a):e.setAttribute(a,s);break;case"popover":be("beforetoggle",e),be("toggle",e),Ri(e,"popover",s);break;case"xlinkActuate":mn(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":mn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":mn(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":mn(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":mn(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":mn(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":mn(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":mn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":mn(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":Ri(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=w.get(a)||a,Ri(e,a,s))}}function Du(e,t,a,s,o,u){switch(a){case"style":hl(e,s,u);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(l(61));if(a=s.__html,a!=null){if(o.children!=null)throw Error(l(60));e.innerHTML=a}}break;case"children":typeof s=="string"?_a(e,s):(typeof s=="number"||typeof s=="bigint")&&_a(e,""+s);break;case"onScroll":s!=null&&be("scroll",e);break;case"onScrollEnd":s!=null&&be("scrollend",e);break;case"onClick":s!=null&&(e.onclick=W);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!sl.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(o=a.endsWith("Capture"),t=a.slice(2,o?a.length-7:void 0),u=e[wt]||null,u=u!=null?u[a]:null,typeof u=="function"&&e.removeEventListener(t,u,o),typeof s=="function")){typeof u!="function"&&u!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,s,o);break e}a in e?e[a]=s:s===!0?e.setAttribute(a,""):Ri(e,a,s)}}}function Et(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":be("error",e),be("load",e);var s=!1,o=!1,u;for(u in a)if(a.hasOwnProperty(u)){var f=a[u];if(f!=null)switch(u){case"src":s=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:Ue(e,t,u,f,a,null)}}o&&Ue(e,t,"srcSet",a.srcSet,a,null),s&&Ue(e,t,"src",a.src,a,null);return;case"input":be("invalid",e);var v=u=f=o=null,_=null,R=null;for(s in a)if(a.hasOwnProperty(s)){var z=a[s];if(z!=null)switch(s){case"name":o=z;break;case"type":f=z;break;case"checked":_=z;break;case"defaultChecked":R=z;break;case"value":u=z;break;case"defaultValue":v=z;break;case"children":case"dangerouslySetInnerHTML":if(z!=null)throw Error(l(137,t));break;default:Ue(e,t,s,z,a,null)}}Fa(e,u,v,_,R,f,o,!1);return;case"select":be("invalid",e),s=f=u=null;for(o in a)if(a.hasOwnProperty(o)&&(v=a[o],v!=null))switch(o){case"value":u=v;break;case"defaultValue":f=v;break;case"multiple":s=v;default:Ue(e,t,o,v,a,null)}t=u,a=f,e.multiple=!!s,t!=null?Kn(e,!!s,t,!1):a!=null&&Kn(e,!!s,a,!0);return;case"textarea":be("invalid",e),u=o=s=null;for(f in a)if(a.hasOwnProperty(f)&&(v=a[f],v!=null))switch(f){case"value":s=v;break;case"defaultValue":o=v;break;case"children":u=v;break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(l(91));break;default:Ue(e,t,f,v,a,null)}dl(e,s,o,u);return;case"option":for(_ in a)a.hasOwnProperty(_)&&(s=a[_],s!=null)&&(_==="selected"?e.selected=s&&typeof s!="function"&&typeof s!="symbol":Ue(e,t,_,s,a,null));return;case"dialog":be("beforetoggle",e),be("toggle",e),be("cancel",e),be("close",e);break;case"iframe":case"object":be("load",e);break;case"video":case"audio":for(s=0;s<bs.length;s++)be(bs[s],e);break;case"image":be("error",e),be("load",e);break;case"details":be("toggle",e);break;case"embed":case"source":case"link":be("error",e),be("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(R in a)if(a.hasOwnProperty(R)&&(s=a[R],s!=null))switch(R){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:Ue(e,t,R,s,a,null)}return;default:if(Pr(t)){for(z in a)a.hasOwnProperty(z)&&(s=a[z],s!==void 0&&Du(e,t,z,s,a,void 0));return}}for(v in a)a.hasOwnProperty(v)&&(s=a[v],s!=null&&Ue(e,t,v,s,a,null))}function Tv(e,t,a,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var o=null,u=null,f=null,v=null,_=null,R=null,z=null;for(L in a){var H=a[L];if(a.hasOwnProperty(L)&&H!=null)switch(L){case"checked":break;case"value":break;case"defaultValue":_=H;default:s.hasOwnProperty(L)||Ue(e,t,L,null,s,H)}}for(var j in s){var L=s[j];if(H=a[j],s.hasOwnProperty(j)&&(L!=null||H!=null))switch(j){case"type":u=L;break;case"name":o=L;break;case"checked":R=L;break;case"defaultChecked":z=L;break;case"value":f=L;break;case"defaultValue":v=L;break;case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(l(137,t));break;default:L!==H&&Ue(e,t,j,L,s,H)}}Ni(e,f,v,_,R,z,u,o);return;case"select":L=f=v=j=null;for(u in a)if(_=a[u],a.hasOwnProperty(u)&&_!=null)switch(u){case"value":break;case"multiple":L=_;default:s.hasOwnProperty(u)||Ue(e,t,u,null,s,_)}for(o in s)if(u=s[o],_=a[o],s.hasOwnProperty(o)&&(u!=null||_!=null))switch(o){case"value":j=u;break;case"defaultValue":v=u;break;case"multiple":f=u;default:u!==_&&Ue(e,t,o,u,s,_)}t=v,a=f,s=L,j!=null?Kn(e,!!a,j,!1):!!s!=!!a&&(t!=null?Kn(e,!!a,t,!0):Kn(e,!!a,a?[]:"",!1));return;case"textarea":L=j=null;for(v in a)if(o=a[v],a.hasOwnProperty(v)&&o!=null&&!s.hasOwnProperty(v))switch(v){case"value":break;case"children":break;default:Ue(e,t,v,null,s,o)}for(f in s)if(o=s[f],u=a[f],s.hasOwnProperty(f)&&(o!=null||u!=null))switch(f){case"value":j=o;break;case"defaultValue":L=o;break;case"children":break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(l(91));break;default:o!==u&&Ue(e,t,f,o,s,u)}ul(e,j,L);return;case"option":for(var F in a)j=a[F],a.hasOwnProperty(F)&&j!=null&&!s.hasOwnProperty(F)&&(F==="selected"?e.selected=!1:Ue(e,t,F,null,s,j));for(_ in s)j=s[_],L=a[_],s.hasOwnProperty(_)&&j!==L&&(j!=null||L!=null)&&(_==="selected"?e.selected=j&&typeof j!="function"&&typeof j!="symbol":Ue(e,t,_,j,s,L));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 oe in a)j=a[oe],a.hasOwnProperty(oe)&&j!=null&&!s.hasOwnProperty(oe)&&Ue(e,t,oe,null,s,j);for(R in s)if(j=s[R],L=a[R],s.hasOwnProperty(R)&&j!==L&&(j!=null||L!=null))switch(R){case"children":case"dangerouslySetInnerHTML":if(j!=null)throw Error(l(137,t));break;default:Ue(e,t,R,j,s,L)}return;default:if(Pr(t)){for(var Me in a)j=a[Me],a.hasOwnProperty(Me)&&j!==void 0&&!s.hasOwnProperty(Me)&&Du(e,t,Me,void 0,s,j);for(z in s)j=s[z],L=a[z],!s.hasOwnProperty(z)||j===L||j===void 0&&L===void 0||Du(e,t,z,j,s,L);return}}for(var x in a)j=a[x],a.hasOwnProperty(x)&&j!=null&&!s.hasOwnProperty(x)&&Ue(e,t,x,null,s,j);for(H in s)j=s[H],L=a[H],!s.hasOwnProperty(H)||j===L||j==null&&L==null||Ue(e,t,H,j,s,L)}function Hm(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function kv(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),s=0;s<a.length;s++){var o=a[s],u=o.transferSize,f=o.initiatorType,v=o.duration;if(u&&v&&Hm(f)){for(f=0,v=o.responseEnd,s+=1;s<a.length;s++){var _=a[s],R=_.startTime;if(R>v)break;var z=_.transferSize,H=_.initiatorType;z&&Hm(H)&&(_=_.responseEnd,f+=z*(_<v?1:(v-R)/(_-R)))}if(--s,t+=8*(u+f)/(o.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Uu=null,Mu=null;function oo(e){return e.nodeType===9?e:e.ownerDocument}function qm(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 $m(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function zu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Bu=null;function Ev(){var e=window.event;return e&&e.type==="popstate"?e===Bu?!1:(Bu=e,!0):(Bu=null,!1)}var Pm=typeof setTimeout=="function"?setTimeout:void 0,Av=typeof clearTimeout=="function"?clearTimeout:void 0,Im=typeof Promise=="function"?Promise:void 0,xv=typeof queueMicrotask=="function"?queueMicrotask:typeof Im<"u"?function(e){return Im.resolve(null).then(e).catch(Cv)}:Pm;function Cv(e){setTimeout(function(){throw e})}function qa(e){return e==="head"}function Gm(e,t){var a=t,s=0;do{var o=a.nextSibling;if(e.removeChild(a),o&&o.nodeType===8)if(a=o.data,a==="/$"||a==="/&"){if(s===0){e.removeChild(o),or(t);return}s--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")s++;else if(a==="html")ws(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,ws(a);for(var u=a.firstChild;u;){var f=u.nextSibling,v=u.nodeName;u[Sa]||v==="SCRIPT"||v==="STYLE"||v==="LINK"&&u.rel.toLowerCase()==="stylesheet"||a.removeChild(u),u=f}}else a==="body"&&ws(e.ownerDocument.body);a=o}while(a);or(t)}function Vm(e,t){var a=e;e=0;do{var s=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),s&&s.nodeType===8)if(a=s.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=s}while(a)}function Hu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Hu(a),zr(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function Ov(e,t,a,s){for(;e.nodeType===1;){var o=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[Sa])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==o.rel||e.getAttribute("href")!==(o.href==null||o.href===""?null:o.href)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin)||e.getAttribute("title")!==(o.title==null?null:o.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(o.src==null?null:o.src)||e.getAttribute("type")!==(o.type==null?null:o.type)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=o.name==null?null:""+o.name;if(o.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=un(e.nextSibling),e===null)break}return null}function Rv(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=un(e.nextSibling),e===null))return null;return e}function Km(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=un(e.nextSibling),e===null))return null;return e}function qu(e){return e.data==="$?"||e.data==="$~"}function $u(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function jv(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var s=function(){t(),a.removeEventListener("DOMContentLoaded",s)};a.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function un(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Pu=null;function Ym(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return un(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function Jm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(t===0)return e;t--}else a!=="/$"&&a!=="/&"||t++}e=e.previousSibling}return null}function Xm(e,t,a){switch(t=oo(a),e){case"html":if(e=t.documentElement,!e)throw Error(l(452));return e;case"head":if(e=t.head,!e)throw Error(l(453));return e;case"body":if(e=t.body,!e)throw Error(l(454));return e;default:throw Error(l(451))}}function ws(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);zr(e)}var dn=new Map,Qm=new Set;function co(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ca=K.d;K.d={f:Nv,r:Lv,D:Dv,C:Uv,L:Mv,m:zv,X:Hv,S:Bv,M:qv};function Nv(){var e=ca.f(),t=eo();return e||t}function Lv(e){var t=wa(e);t!==null&&t.tag===5&&t.type==="form"?ff(t):ca.r(e)}var rr=typeof document>"u"?null:document;function Wm(e,t,a){var s=rr;if(s&&typeof t=="string"&&t){var o=Mt(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof a=="string"&&(o+='[crossorigin="'+a+'"]'),Qm.has(o)||(Qm.add(o),e={rel:e,crossOrigin:a,href:t},s.querySelector(o)===null&&(t=s.createElement("link"),Et(t,"link",e),qe(t),s.head.appendChild(t)))}}function Dv(e){ca.D(e),Wm("dns-prefetch",e,null)}function Uv(e,t){ca.C(e,t),Wm("preconnect",e,t)}function Mv(e,t,a){ca.L(e,t,a);var s=rr;if(s&&e&&t){var o='link[rel="preload"][as="'+Mt(t)+'"]';t==="image"&&a&&a.imageSrcSet?(o+='[imagesrcset="'+Mt(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(o+='[imagesizes="'+Mt(a.imageSizes)+'"]')):o+='[href="'+Mt(e)+'"]';var u=o;switch(t){case"style":u=sr(e);break;case"script":u=lr(e)}dn.has(u)||(e=b({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),dn.set(u,e),s.querySelector(o)!==null||t==="style"&&s.querySelector(_s(u))||t==="script"&&s.querySelector(Ts(u))||(t=s.createElement("link"),Et(t,"link",e),qe(t),s.head.appendChild(t)))}}function zv(e,t){ca.m(e,t);var a=rr;if(a&&e){var s=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+Mt(s)+'"][href="'+Mt(e)+'"]',u=o;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=lr(e)}if(!dn.has(u)&&(e=b({rel:"modulepreload",href:e},t),dn.set(u,e),a.querySelector(o)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Ts(u)))return}s=a.createElement("link"),Et(s,"link",e),qe(s),a.head.appendChild(s)}}}function Bv(e,t,a){ca.S(e,t,a);var s=rr;if(s&&e){var o=$n(s).hoistableStyles,u=sr(e);t=t||"default";var f=o.get(u);if(!f){var v={loading:0,preload:null};if(f=s.querySelector(_s(u)))v.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":t},a),(a=dn.get(u))&&Iu(e,a);var _=f=s.createElement("link");qe(_),Et(_,"link",e),_._p=new Promise(function(R,z){_.onload=R,_.onerror=z}),_.addEventListener("load",function(){v.loading|=1}),_.addEventListener("error",function(){v.loading|=2}),v.loading|=4,uo(f,t,s)}f={type:"stylesheet",instance:f,count:1,state:v},o.set(u,f)}}}function Hv(e,t){ca.X(e,t);var a=rr;if(a&&e){var s=$n(a).hoistableScripts,o=lr(e),u=s.get(o);u||(u=a.querySelector(Ts(o)),u||(e=b({src:e,async:!0},t),(t=dn.get(o))&&Gu(e,t),u=a.createElement("script"),qe(u),Et(u,"link",e),a.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(o,u))}}function qv(e,t){ca.M(e,t);var a=rr;if(a&&e){var s=$n(a).hoistableScripts,o=lr(e),u=s.get(o);u||(u=a.querySelector(Ts(o)),u||(e=b({src:e,async:!0,type:"module"},t),(t=dn.get(o))&&Gu(e,t),u=a.createElement("script"),qe(u),Et(u,"link",e),a.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(o,u))}}function Zm(e,t,a,s){var o=(o=me.current)?co(o):null;if(!o)throw Error(l(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=sr(a.href),a=$n(o).hoistableStyles,s=a.get(t),s||(s={type:"style",instance:null,count:0,state:null},a.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=sr(a.href);var u=$n(o).hoistableStyles,f=u.get(e);if(f||(o=o.ownerDocument||o,f={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,f),(u=o.querySelector(_s(e)))&&!u._p&&(f.instance=u,f.state.loading=5),dn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},dn.set(e,a),u||$v(o,e,a,f.state))),t&&s===null)throw Error(l(528,""));return f}if(t&&s!==null)throw Error(l(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=lr(a),a=$n(o).hoistableScripts,s=a.get(t),s||(s={type:"script",instance:null,count:0,state:null},a.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,e))}}function sr(e){return'href="'+Mt(e)+'"'}function _s(e){return'link[rel="stylesheet"]['+e+"]"}function Fm(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function $v(e,t,a,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),Et(t,"link",a),qe(t),e.head.appendChild(t))}function lr(e){return'[src="'+Mt(e)+'"]'}function Ts(e){return"script[async]"+e}function eg(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Mt(a.href)+'"]');if(s)return t.instance=s,qe(s),s;var o=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),qe(s),Et(s,"style",o),uo(s,a.precedence,e),t.instance=s;case"stylesheet":o=sr(a.href);var u=e.querySelector(_s(o));if(u)return t.state.loading|=4,t.instance=u,qe(u),u;s=Fm(a),(o=dn.get(o))&&Iu(s,o),u=(e.ownerDocument||e).createElement("link"),qe(u);var f=u;return f._p=new Promise(function(v,_){f.onload=v,f.onerror=_}),Et(u,"link",s),t.state.loading|=4,uo(u,a.precedence,e),t.instance=u;case"script":return u=lr(a.src),(o=e.querySelector(Ts(u)))?(t.instance=o,qe(o),o):(s=a,(o=dn.get(u))&&(s=b({},a),Gu(s,o)),e=e.ownerDocument||e,o=e.createElement("script"),qe(o),Et(o,"link",s),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(l(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(s=t.instance,t.state.loading|=4,uo(s,a.precedence,e));return t.instance}function uo(e,t,a){for(var s=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=s.length?s[s.length-1]:null,u=o,f=0;f<s.length;f++){var v=s[f];if(v.dataset.precedence===t)u=v;else if(u!==o)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function Iu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Gu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var ho=null;function tg(e,t,a){if(ho===null){var s=new Map,o=ho=new Map;o.set(a,s)}else o=ho,s=o.get(a),s||(s=new Map,o.set(a,s));if(s.has(e))return s;for(s.set(e,null),a=a.getElementsByTagName(e),o=0;o<a.length;o++){var u=a[o];if(!(u[Sa]||u[Ve]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var f=u.getAttribute(t)||"";f=e+f;var v=s.get(f);v?v.push(u):s.set(f,[u])}}return s}function ng(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function Pv(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function ag(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Iv(e,t,a,s){if(a.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var o=sr(s.href),u=t.querySelector(_s(o));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=fo.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=u,qe(u);return}u=t.ownerDocument||t,s=Fm(s),(o=dn.get(o))&&Iu(s,o),u=u.createElement("link"),qe(u);var f=u;f._p=new Promise(function(v,_){f.onload=v,f.onerror=_}),Et(u,"link",s),a.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=fo.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var Vu=0;function Gv(e,t){return e.stylesheets&&e.count===0&&go(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var s=setTimeout(function(){if(e.stylesheets&&go(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Vu===0&&(Vu=62500*kv());var o=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&go(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Vu?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(o)}}:null}function fo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)go(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var mo=null;function go(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,mo=new Map,t.forEach(Vv,e),mo=null,fo.call(e))}function Vv(e,t){if(!(t.state.loading&4)){var a=mo.get(e);if(a)var s=a.get(null);else{a=new Map,mo.set(e,a);for(var o=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<o.length;u++){var f=o[u];(f.nodeName==="LINK"||f.getAttribute("media")!=="not all")&&(a.set(f.dataset.precedence,f),s=f)}s&&a.set(null,s)}o=t.instance,f=o.getAttribute("data-precedence"),u=a.get(f)||s,u===s&&a.set(null,o),a.set(f,o),this.count++,s=fo.bind(this),o.addEventListener("load",s),o.addEventListener("error",s),u?u.parentNode.insertBefore(o,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(o,e.firstChild)),t.state.loading|=4}}var ks={$$typeof:N,Provider:null,Consumer:null,_currentValue:ae,_currentValue2:ae,_threadCount:0};function Kv(e,t,a,s,o,u,f,v,_){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=Nr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Nr(0),this.hiddenUpdates=Nr(null),this.identifierPrefix=s,this.onUncaughtError=o,this.onCaughtError=u,this.onRecoverableError=f,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=_,this.incompleteTransitions=new Map}function ig(e,t,a,s,o,u,f,v,_,R,z,H){return e=new Kv(e,t,a,f,_,R,z,H,v),t=1,u===!0&&(t|=24),u=Jt(3,null,null,t),e.current=u,u.stateNode=e,t=kc(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:s,isDehydrated:a,cache:t},Cc(u),e}function rg(e){return e?(e=Bi,e):Bi}function sg(e,t,a,s,o,u){o=rg(o),s.context===null?s.context=o:s.pendingContext=o,s=Oa(t),s.payload={element:a},u=u===void 0?null:u,u!==null&&(s.callback=u),a=Ra(e,s,t),a!==null&&(Pt(a,e,t),ns(a,e,t))}function lg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function Ku(e,t){lg(e,t),(e=e.alternate)&&lg(e,t)}function og(e){if(e.tag===13||e.tag===31){var t=ii(e,67108864);t!==null&&Pt(t,e,67108864),Ku(e,67108864)}}function cg(e){if(e.tag===13||e.tag===31){var t=Ft();t=Oi(t);var a=ii(e,t);a!==null&&Pt(a,e,t),Ku(e,t)}}var po=!0;function Yv(e,t,a,s){var o=D.T;D.T=null;var u=K.p;try{K.p=2,Yu(e,t,a,s)}finally{K.p=u,D.T=o}}function Jv(e,t,a,s){var o=D.T;D.T=null;var u=K.p;try{K.p=8,Yu(e,t,a,s)}finally{K.p=u,D.T=o}}function Yu(e,t,a,s){if(po){var o=Ju(s);if(o===null)Lu(e,t,s,yo,a),dg(e,s);else if(Qv(o,e,t,a,s))s.stopPropagation();else if(dg(e,s),t&4&&-1<Xv.indexOf(e)){for(;o!==null;){var u=wa(o);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var f=Dt(u.pendingLanes);if(f!==0){var v=u;for(v.pendingLanes|=2,v.entangledLanes|=2;f;){var _=1<<31-lt(f);v.entanglements[1]|=_,f&=~_}On(u),(Re&6)===0&&(Zl=Ot()+500,vs(0))}}break;case 31:case 13:v=ii(u,2),v!==null&&Pt(v,u,2),eo(),Ku(u,2)}if(u=Ju(s),u===null&&Lu(e,t,s,yo,a),u===o)break;o=u}o!==null&&s.stopPropagation()}else Lu(e,t,s,null,a)}}function Ju(e){return e=ce(e),Xu(e)}var yo=null;function Xu(e){if(yo=null,e=qn(e),e!==null){var t=d(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=h(t),e!==null)return e;e=null}else if(a===31){if(e=m(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return yo=e,null}function ug(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(Or()){case Rr:return 2;case Ci:return 8;case Ja:case He:return 32;case tl:return 268435456;default:return 32}default:return 32}}var Qu=!1,$a=null,Pa=null,Ia=null,Es=new Map,As=new Map,Ga=[],Xv="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 dg(e,t){switch(e){case"focusin":case"focusout":$a=null;break;case"dragenter":case"dragleave":Pa=null;break;case"mouseover":case"mouseout":Ia=null;break;case"pointerover":case"pointerout":Es.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":As.delete(t.pointerId)}}function xs(e,t,a,s,o,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:a,eventSystemFlags:s,nativeEvent:u,targetContainers:[o]},t!==null&&(t=wa(t),t!==null&&og(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function Qv(e,t,a,s,o){switch(t){case"focusin":return $a=xs($a,e,t,a,s,o),!0;case"dragenter":return Pa=xs(Pa,e,t,a,s,o),!0;case"mouseover":return Ia=xs(Ia,e,t,a,s,o),!0;case"pointerover":var u=o.pointerId;return Es.set(u,xs(Es.get(u)||null,e,t,a,s,o)),!0;case"gotpointercapture":return u=o.pointerId,As.set(u,xs(As.get(u)||null,e,t,a,s,o)),!0}return!1}function hg(e){var t=qn(e.target);if(t!==null){var a=d(t);if(a!==null){if(t=a.tag,t===13){if(t=h(a),t!==null){e.blockedOn=t,al(e.priority,function(){cg(a)});return}}else if(t===31){if(t=m(a),t!==null){e.blockedOn=t,al(e.priority,function(){cg(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function vo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=Ju(e.nativeEvent);if(a===null){a=e.nativeEvent;var s=new a.constructor(a.type,a);fe=s,a.target.dispatchEvent(s),fe=null}else return t=wa(a),t!==null&&og(t),e.blockedOn=a,!1;t.shift()}return!0}function fg(e,t,a){vo(e)&&a.delete(t)}function Wv(){Qu=!1,$a!==null&&vo($a)&&($a=null),Pa!==null&&vo(Pa)&&(Pa=null),Ia!==null&&vo(Ia)&&(Ia=null),Es.forEach(fg),As.forEach(fg)}function bo(e,t){e.blockedOn===t&&(e.blockedOn=null,Qu||(Qu=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,Wv)))}var So=null;function mg(e){So!==e&&(So=e,i.unstable_scheduleCallback(i.unstable_NormalPriority,function(){So===e&&(So=null);for(var t=0;t<e.length;t+=3){var a=e[t],s=e[t+1],o=e[t+2];if(typeof s!="function"){if(Xu(s||a)===null)continue;break}var u=wa(a);u!==null&&(e.splice(t,3),t-=3,Jc(u,{pending:!0,data:o,method:a.method,action:s},s,o))}}))}function or(e){function t(_){return bo(_,e)}$a!==null&&bo($a,e),Pa!==null&&bo(Pa,e),Ia!==null&&bo(Ia,e),Es.forEach(t),As.forEach(t);for(var a=0;a<Ga.length;a++){var s=Ga[a];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Ga.length&&(a=Ga[0],a.blockedOn===null);)hg(a),a.blockedOn===null&&Ga.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(s=0;s<a.length;s+=3){var o=a[s],u=a[s+1],f=o[wt]||null;if(typeof u=="function")f||mg(a);else if(f){var v=null;if(u&&u.hasAttribute("formAction")){if(o=u,f=u[wt]||null)v=f.formAction;else if(Xu(o)!==null)continue}else v=f.action;typeof v=="function"?a[s+1]=v:(a.splice(s,3),s-=3),mg(a)}}}function gg(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(f){return o=f})},focusReset:"manual",scroll:"manual"})}function t(){o!==null&&(o(),o=null),s||setTimeout(a,20)}function a(){if(!s&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,o=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),o!==null&&(o(),o=null)}}}function Wu(e){this._internalRoot=e}wo.prototype.render=Wu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(l(409));var a=t.current,s=Ft();sg(a,s,e,t,null,null)},wo.prototype.unmount=Wu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;sg(e.current,2,null,e,null,null),eo(),t[Bn]=null}};function wo(e){this._internalRoot=e}wo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Mr();e={blockedOn:null,target:e,priority:t};for(var a=0;a<Ga.length&&t!==0&&t<Ga[a].priority;a++);Ga.splice(a,0,e),a===0&&hg(e)}};var pg=n.version;if(pg!=="19.2.7")throw Error(l(527,pg,"19.2.7"));K.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(l(188)):(e=Object.keys(e).join(","),Error(l(268,e)));return e=p(t),e=e!==null?S(e):null,e=e===null?null:e.stateNode,e};var Zv={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:D,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var _o=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!_o.isDisabled&&_o.supportsFiber)try{pa=_o.inject(Zv),St=_o}catch{}}return Os.createRoot=function(e,t){if(!c(e))throw Error(l(299));var a=!1,s="",o=Tf,u=kf,f=Ef;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(f=t.onRecoverableError)),t=ig(e,1,!1,null,null,a,s,null,o,u,f,gg),e[Bn]=t.current,Nu(e),new Wu(t)},Os.hydrateRoot=function(e,t,a){if(!c(e))throw Error(l(299));var s=!1,o="",u=Tf,f=kf,v=Ef,_=null;return a!=null&&(a.unstable_strictMode===!0&&(s=!0),a.identifierPrefix!==void 0&&(o=a.identifierPrefix),a.onUncaughtError!==void 0&&(u=a.onUncaughtError),a.onCaughtError!==void 0&&(f=a.onCaughtError),a.onRecoverableError!==void 0&&(v=a.onRecoverableError),a.formState!==void 0&&(_=a.formState)),t=ig(e,1,!0,t,a??null,s,o,_,u,f,v,gg),t.context=rg(null),a=t.current,s=Ft(),s=Oi(s),o=Oa(s),o.callback=null,Ra(a,o,s),a=s,t.current.lanes=a,zn(t,a),On(t),e[Bn]=t.current,Nu(e),new wo(t)},Os.version="19.2.7",Os}var Ag;function o0(){if(Ag)return ed.exports;Ag=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(n){console.error(n)}}return i(),ed.exports=l0(),ed.exports}var c0=o0();const u0=i=>i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),d0=i=>i.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,r,l)=>l?l.toUpperCase():r.toLowerCase()),xg=i=>{const n=d0(i);return n.charAt(0).toUpperCase()+n.slice(1)},Sp=(...i)=>i.filter((n,r,l)=>!!n&&n.trim()!==""&&l.indexOf(n)===r).join(" ").trim(),h0=i=>{for(const n in i)if(n.startsWith("aria-")||n==="role"||n==="title")return!0};var f0={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const m0=I.forwardRef(({color:i="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:l,className:c="",children:d,iconNode:h,...m},g)=>I.createElement("svg",{ref:g,...f0,width:n,height:n,stroke:i,strokeWidth:l?Number(r)*24/Number(n):r,className:Sp("lucide",c),...!d&&!h0(m)&&{"aria-hidden":"true"},...m},[...h.map(([p,S])=>I.createElement(p,S)),...Array.isArray(d)?d:[d]]));const ze=(i,n)=>{const r=I.forwardRef(({className:l,...c},d)=>I.createElement(m0,{ref:d,iconNode:n,className:Sp(`lucide-${u0(xg(i))}`,`lucide-${i}`,l),...c}));return r.displayName=xg(i),r};const g0=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Cg=ze("activity",g0);const p0=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],y0=ze("badge-check",p0);const v0=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],_d=ze("book-open",v0);const b0=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],wp=ze("chevron-left",b0);const S0=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],_p=ze("chevron-right",S0);const w0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],_0=ze("circle-check",w0);const T0=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],Rs=ze("clipboard",T0);const k0=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Td=ze("credit-card",k0);const E0=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],id=ze("database",E0);const A0=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],x0=ze("earth",A0);const C0=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],rd=ze("folder-open",C0);const O0=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],Tp=ze("layout-grid",O0);const R0=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],sd=ze("log-in",R0);const j0=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],N0=ze("log-out",j0);const L0=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],_r=ze("monitor",L0);const D0=[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]],kd=ze("mouse-pointer-2",D0);const U0=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],ld=ze("play",U0);const M0=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],z0=ze("power",M0);const B0=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],H0=ze("rotate-ccw",B0);const q0=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],od=ze("send",q0);const $0=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],cd=ze("server",$0);const P0=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],kp=ze("settings",P0);const I0=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Og=ze("shield-check",I0);const G0=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],V0=ze("star",G0);const K0=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],yr=ze("terminal",K0);const Y0=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],Rg=ze("volume-2",Y0);const J0=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],jg=ze("wifi",J0);const X0=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ng=ze("x",X0);function Po(i,n){var r={};for(var l in i)Object.prototype.hasOwnProperty.call(i,l)&&n.indexOf(l)<0&&(r[l]=i[l]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,l=Object.getOwnPropertySymbols(i);c<l.length;c++)n.indexOf(l[c])<0&&Object.prototype.propertyIsEnumerable.call(i,l[c])&&(r[l[c]]=i[l[c]]);return r}function Q0(i,n,r,l){function c(d){return d instanceof r?d:new r(function(h){h(d)})}return new(r||(r=Promise))(function(d,h){function m(S){try{p(l.next(S))}catch(b){h(b)}}function g(S){try{p(l.throw(S))}catch(b){h(b)}}function p(S){S.done?d(S.value):c(S.value).then(m,g)}p((l=l.apply(i,n||[])).next())})}const W0=i=>i?(...n)=>i(...n):(...n)=>fetch(...n);class Bd extends Error{constructor(n,r="FunctionsError",l){super(n),this.name=r,this.context=l}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class Z0 extends Bd{constructor(n){super("Failed to send a request to the Edge Function","FunctionsFetchError",n)}}class Lg extends Bd{constructor(n){super("Relay Error invoking the Edge Function","FunctionsRelayError",n)}}class Dg extends Bd{constructor(n){super("Edge Function returned a non-2xx status code","FunctionsHttpError",n)}}var Ed;(function(i){i.Any="any",i.ApNortheast1="ap-northeast-1",i.ApNortheast2="ap-northeast-2",i.ApSouth1="ap-south-1",i.ApSoutheast1="ap-southeast-1",i.ApSoutheast2="ap-southeast-2",i.CaCentral1="ca-central-1",i.EuCentral1="eu-central-1",i.EuWest1="eu-west-1",i.EuWest2="eu-west-2",i.EuWest3="eu-west-3",i.SaEast1="sa-east-1",i.UsEast1="us-east-1",i.UsWest1="us-west-1",i.UsWest2="us-west-2"})(Ed||(Ed={}));class F0{constructor(n,{headers:r={},customFetch:l,region:c=Ed.Any}={}){this.url=n,this.headers=r,this.region=c,this.fetch=W0(l)}setAuth(n){this.headers.Authorization=`Bearer ${n}`}invoke(n){return Q0(this,arguments,void 0,function*(r,l={}){var c;let d,h;try{const{headers:m,method:g,body:p,signal:S,timeout:b}=l;let T={},{region:A}=l;A||(A=this.region);const C=new URL(`${this.url}/${r}`);A&&A!=="any"&&(T["x-region"]=A,C.searchParams.set("forceFunctionRegion",A));let U;const $=!!m&&Object.keys(m).some(G=>G.toLowerCase()==="content-type");p&&!$?typeof Blob<"u"&&p instanceof Blob||p instanceof ArrayBuffer?(T["Content-Type"]="application/octet-stream",U=p):typeof p=="string"?(T["Content-Type"]="text/plain",U=p):typeof FormData<"u"&&p instanceof FormData?U=p:(T["Content-Type"]="application/json",U=JSON.stringify(p)):p&&typeof p!="string"&&!(typeof Blob<"u"&&p instanceof Blob)&&!(p instanceof ArrayBuffer)&&!(typeof FormData<"u"&&p instanceof FormData)?U=JSON.stringify(p):U=p;let P=S;b&&(h=new AbortController,d=setTimeout(()=>h.abort(),b),S?(P=h.signal,S.addEventListener("abort",()=>h.abort())):P=h.signal);const q=yield this.fetch(C.toString(),{method:g||"POST",headers:Object.assign(Object.assign(Object.assign({},T),this.headers),m),body:U,signal:P}).catch(G=>{throw new Z0(G)}),N=q.headers.get("x-relay-error");if(N&&N==="true")throw new Lg(q);if(!q.ok)throw new Dg(q);let Y=((c=q.headers.get("Content-Type"))!==null&&c!==void 0?c:"text/plain").split(";")[0].trim(),ue;return Y==="application/json"?ue=yield q.json():Y==="application/octet-stream"||Y==="application/pdf"?ue=yield q.blob():Y==="text/event-stream"?ue=q:Y==="multipart/form-data"?ue=yield q.formData():ue=yield q.text(),{data:ue,error:null,response:q}}catch(m){return{data:null,error:m,response:m instanceof Dg||m instanceof Lg?m.context:void 0}}finally{d&&clearTimeout(d)}})}}const Ep=3,Ug=i=>Math.min(1e3*2**i,3e4),eb=[520,503],Ap=["GET","HEAD","OPTIONS"];var Mg=class extends Error{constructor(i){super(i.message),this.name="PostgrestError",this.details=i.details,this.hint=i.hint,this.code=i.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function zg(i,n){return new Promise(r=>{if(n?.aborted){r();return}const l=setTimeout(()=>{n?.removeEventListener("abort",c),r()},i);function c(){clearTimeout(l),r()}n?.addEventListener("abort",c)})}function tb(i,n,r,l){return!(!l||r>=Ep||!Ap.includes(i)||!eb.includes(n))}var nb=class{constructor(i){var n,r,l,c,d;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=i.method,this.url=i.url,this.headers=new Headers(i.headers),this.schema=i.schema,this.body=i.body,this.shouldThrowOnError=(n=i.shouldThrowOnError)!==null&&n!==void 0?n:!1,this.signal=i.signal,this.isMaybeSingle=(r=i.isMaybeSingle)!==null&&r!==void 0?r:!1,this.shouldStripNulls=(l=i.shouldStripNulls)!==null&&l!==void 0?l:!1,this.urlLengthLimit=(c=i.urlLengthLimit)!==null&&c!==void 0?c:8e3,this.retryEnabled=(d=i.retry)!==null&&d!==void 0?d:!0,i.fetch?this.fetch=i.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(i,n){return this.headers=new Headers(this.headers),this.headers.set(i,n),this}retry(i){return this.retryEnabled=i,this}then(i,n){var r=this;if(this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const h=this.headers.get("Accept");h==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!h||h==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const l=this.fetch;let d=(async()=>{let h=0;for(;;){const p={};r.headers.forEach((b,T)=>{p[T]=b}),h>0&&(p["X-Retry-Count"]=String(h));let S;try{S=await l(r.url.toString(),{method:r.method,headers:p,body:JSON.stringify(r.body,(b,T)=>typeof T=="bigint"?T.toString():T),signal:r.signal})}catch(b){if(b?.name==="AbortError"||b?.code==="ABORT_ERR"||!Ap.includes(r.method))throw b;if(r.retryEnabled&&h<Ep){const T=Ug(h);h++,await zg(T,r.signal);continue}throw b}if(tb(r.method,S.status,h,r.retryEnabled)){var m,g;const b=(m=(g=S.headers)===null||g===void 0?void 0:g.get("Retry-After"))!==null&&m!==void 0?m:null,T=b!==null?Math.max(0,parseInt(b,10)||0)*1e3:Ug(h);await S.text(),h++,await zg(T,r.signal);continue}return await r.processResponse(S)}})();return this.shouldThrowOnError||(d=d.catch(h=>{var m;let g="",p="",S="";const b=h?.cause;if(b){var T,A,C,U;const q=(T=b?.message)!==null&&T!==void 0?T:"",N=(A=b?.code)!==null&&A!==void 0?A:"";g=`${(C=h?.name)!==null&&C!==void 0?C:"FetchError"}: ${h?.message}`,g+=`
8
+ `+s.stack}}var Ei=Object.prototype.hasOwnProperty,Un=i.unstable_scheduleCallback,Ai=i.unstable_cancelCallback,xi=i.unstable_shouldYield,Mn=i.unstable_requestPaint,Ot=i.unstable_now,Or=i.unstable_getCurrentPriorityLevel,Rr=i.unstable_ImmediatePriority,Ci=i.unstable_UserBlockingPriority,Ja=i.unstable_NormalPriority,He=i.unstable_LowPriority,tl=i.unstable_IdlePriority,tn=i.log,Jo=i.unstable_setDisableYieldValue,pa=null,St=null;function Lt(e){if(typeof tn=="function"&&Jo(e),St&&typeof St.setStrictMode=="function")try{St.setStrictMode(pa,e)}catch{}}var lt=Math.clz32?Math.clz32:Xo,se=Math.log,nn=Math.LN2;function Xo(e){return e>>>=0,e===0?32:31-(se(e)/nn|0)|0}var ya=256,Xa=262144,ot=4194304;function Dt(e){var t=e&42;if(t!==0)return t;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 va(e,t,a){var s=e.pendingLanes;if(s===0)return 0;var o=0,u=e.suspendedLanes,f=e.pingedLanes;e=e.warmLanes;var v=s&134217727;return v!==0?(s=v&~u,s!==0?o=Dt(s):(f&=v,f!==0?o=Dt(f):a||(a=v&~e,a!==0&&(o=Dt(a))))):(v=s&~u,v!==0?o=Dt(v):f!==0?o=Dt(f):a||(a=s&~e,a!==0&&(o=Dt(a)))),o===0?0:t!==0&&t!==o&&(t&u)===0&&(u=o&-o,a=t&-t,u>=a||u===32&&(a&4194048)!==0)?t:o}function En(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function nl(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 jr(){var e=ot;return ot<<=1,(ot&62914560)===0&&(ot=4194304),e}function Nr(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function zn(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Qo(e,t,a,s,o,u){var f=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var v=e.entanglements,_=e.expirationTimes,R=e.hiddenUpdates;for(a=f&~a;0<a;){var z=31-lt(a),H=1<<z;v[z]=0,_[z]=-1;var j=R[z];if(j!==null)for(R[z]=null,z=0;z<j.length;z++){var L=j[z];L!==null&&(L.lane&=-536870913)}a&=~H}s!==0&&Lr(e,s,0),u!==0&&o===0&&e.tag!==0&&(e.suspendedLanes|=u&~(f&~t))}function Lr(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-lt(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|a&261930}function Dr(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var s=31-lt(a),o=1<<s;o&t|e[s]&t&&(e[s]|=t),a&=~o}}function Ur(e,t){var a=t&-t;return a=(a&42)!==0?1:Oi(a),(a&(e.suspendedLanes|t))!==0?0:a}function Oi(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 Qa(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Mr(){var e=K.p;return e!==0?e:(e=window.event,e===void 0?32:ug(e.type))}function al(e,t){var a=K.p;try{return K.p=e,t()}finally{K.p=a}}var Vt=Math.random().toString(36).slice(2),Ve="__reactFiber$"+Vt,wt="__reactProps$"+Vt,Bn="__reactContainer$"+Vt,Hn="__reactEvents$"+Vt,il="__reactListeners$"+Vt,rl="__reactHandles$"+Vt,ba="__reactResources$"+Vt,Sa="__reactMarker$"+Vt;function zr(e){delete e[Ve],delete e[wt],delete e[Hn],delete e[il],delete e[rl]}function qn(e){var t=e[Ve];if(t)return t;for(var a=e.parentNode;a;){if(t=a[Bn]||a[Ve]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=Jm(e);e!==null;){if(a=e[Ve])return a;e=Jm(e)}return t}e=a,a=e.parentNode}return null}function wa(e){if(e=e[Ve]||e[Bn]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Wa(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(l(33))}function $n(e){var t=e[ba];return t||(t=e[ba]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function qe(e){e[Sa]=!0}var Br=new Set,sl={};function Pn(e,t){In(e,t),In(e+"Capture",t)}function In(e,t){for(sl[e]=t,e=0;e<t.length;e++)Br.add(t[e])}var ll=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]*$"),Hr={},qr={};function ol(e){return Ei.call(qr,e)?!0:Ei.call(Hr,e)?!1:ll.test(e)?qr[e]=!0:(Hr[e]=!0,!1)}function Ri(e,t,a){if(ol(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var s=t.toLowerCase().slice(0,5);if(s!=="data-"&&s!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+a)}}function Gn(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+a)}}function gn(e,t,a,s){if(s===null)e.removeAttribute(a);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,""+s)}}function Ut(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function yt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ji(e,t,a){var s=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof s<"u"&&typeof s.get=="function"&&typeof s.set=="function"){var o=s.get,u=s.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(f){a=""+f,u.call(this,f)}}),Object.defineProperty(e,t,{enumerable:s.enumerable}),{getValue:function(){return a},setValue:function(f){a=""+f},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Za(e){if(!e._valueTracker){var t=yt(e)?"checked":"value";e._valueTracker=ji(e,t,""+e[t])}}function cl(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),s="";return e&&(s=yt(e)?e.checked?"true":"false":e.value),e=s,e!==a?(t.setValue(e),!0):!1}function $r(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 Wo=/[\n"\\]/g;function Mt(e){return e.replace(Wo,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Ni(e,t,a,s,o,u,f,v){e.name="",f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"?e.type=f:e.removeAttribute("type"),t!=null?f==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Ut(t)):e.value!==""+Ut(t)&&(e.value=""+Ut(t)):f!=="submit"&&f!=="reset"||e.removeAttribute("value"),t!=null?Vn(e,f,Ut(t)):a!=null?Vn(e,f,Ut(a)):s!=null&&e.removeAttribute("value"),o==null&&u!=null&&(e.defaultChecked=!!u),o!=null&&(e.checked=o&&typeof o!="function"&&typeof o!="symbol"),v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?e.name=""+Ut(v):e.removeAttribute("name")}function Fa(e,t,a,s,o,u,f,v){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||a!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){Za(e);return}a=a!=null?""+Ut(a):"",t=t!=null?""+Ut(t):a,v||t===e.value||(e.value=t),e.defaultValue=t}s=s??o,s=typeof s!="function"&&typeof s!="symbol"&&!!s,e.checked=v?e.checked:!!s,e.defaultChecked=!!s,f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.name=f),Za(e)}function Vn(e,t,a){t==="number"&&$r(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Kn(e,t,a,s){if(e=e.options,t){t={};for(var o=0;o<a.length;o++)t["$"+a[o]]=!0;for(a=0;a<e.length;a++)o=t.hasOwnProperty("$"+e[a].value),e[a].selected!==o&&(e[a].selected=o),o&&s&&(e[a].defaultSelected=!0)}else{for(a=""+Ut(a),t=null,o=0;o<e.length;o++){if(e[o].value===a){e[o].selected=!0,s&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function ul(e,t,a){if(t!=null&&(t=""+Ut(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+Ut(a):""}function dl(e,t,a,s){if(t==null){if(s!=null){if(a!=null)throw Error(l(92));if(Ge(s)){if(1<s.length)throw Error(l(93));s=s[0]}a=s}a==null&&(a=""),t=a}a=Ut(t),e.defaultValue=a,s=e.textContent,s===a&&s!==""&&s!==null&&(e.value=s),Za(e)}function _a(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var Zo=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 Yn(e,t,a){var s=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?s?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":s?e.setProperty(t,a):typeof a!="number"||a===0||Zo.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function hl(e,t,a){if(t!=null&&typeof t!="object")throw Error(l(62));if(e=e.style,a!=null){for(var s in a)!a.hasOwnProperty(s)||t!=null&&t.hasOwnProperty(s)||(s.indexOf("--")===0?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="");for(var o in t)s=t[o],t.hasOwnProperty(o)&&a[o]!==s&&Yn(e,o,s)}else for(var u in t)t.hasOwnProperty(u)&&Yn(e,u,t[u])}function Pr(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 w=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"]]),V=/^[\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 ie(e){return V.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function W(){}var fe=null;function ce(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ye=null,tt=null;function Ke(e){var t=wa(e);if(t&&(e=t.stateNode)){var a=e[wt]||null;e:switch(e=t.stateNode,t.type){case"input":if(Ni(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Mt(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var s=a[t];if(s!==e&&s.form===e.form){var o=s[wt]||null;if(!o)throw Error(l(90));Ni(s,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name)}}for(t=0;t<a.length;t++)s=a[t],s.form===e.form&&cl(s)}break e;case"textarea":ul(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&Kn(e,!!a.multiple,t,!1)}}}var nt=!1;function fl(e,t,a){if(nt)return e(t,a);nt=!0;try{var s=e(t);return s}finally{if(nt=!1,(ye!==null||tt!==null)&&(eo(),ye&&(t=ye,e=tt,tt=ye=null,Ke(t),e)))for(t=0;t<e.length;t++)Ke(e[t])}}function ei(e,t){var a=e.stateNode;if(a===null)return null;var s=a[wt]||null;if(s===null)return null;a=s[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(l(231,t,typeof a));return a}var Kt=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Li=!1;if(Kt)try{var Jn={};Object.defineProperty(Jn,"passive",{get:function(){Li=!0}}),window.addEventListener("test",Jn,Jn),window.removeEventListener("test",Jn,Jn)}catch{Li=!1}var Ta=null,Fo=null,ml=null;function qd(){if(ml)return ml;var e,t=Fo,a=t.length,s,o="value"in Ta?Ta.value:Ta.textContent,u=o.length;for(e=0;e<a&&t[e]===o[e];e++);var f=a-e;for(s=1;s<=f&&t[a-s]===o[u-s];s++);return ml=o.slice(e,1<s?1-s:void 0)}function gl(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function pl(){return!0}function $d(){return!1}function zt(e){function t(a,s,o,u,f){this._reactName=a,this._targetInst=o,this.type=s,this.nativeEvent=u,this.target=f,this.currentTarget=null;for(var v in e)e.hasOwnProperty(v)&&(a=e[v],this[v]=a?a(u):u[v]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?pl:$d,this.isPropagationStopped=$d,this}return b(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=pl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=pl)},persist:function(){},isPersistent:pl}),t}var ti={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},yl=zt(ti),Ir=b({},ti,{view:0,detail:0}),Fp=zt(Ir),ec,tc,Gr,vl=b({},Ir,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ac,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!==Gr&&(Gr&&e.type==="mousemove"?(ec=e.screenX-Gr.screenX,tc=e.screenY-Gr.screenY):tc=ec=0,Gr=e),ec)},movementY:function(e){return"movementY"in e?e.movementY:tc}}),Pd=zt(vl),ey=b({},vl,{dataTransfer:0}),ty=zt(ey),ny=b({},Ir,{relatedTarget:0}),nc=zt(ny),ay=b({},ti,{animationName:0,elapsedTime:0,pseudoElement:0}),iy=zt(ay),ry=b({},ti,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),sy=zt(ry),ly=b({},ti,{data:0}),Id=zt(ly),oy={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},cy={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"},uy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function dy(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=uy[e])?!!t[e]:!1}function ac(){return dy}var hy=b({},Ir,{key:function(e){if(e.key){var t=oy[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=gl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?cy[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ac,charCode:function(e){return e.type==="keypress"?gl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?gl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),fy=zt(hy),my=b({},vl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Gd=zt(my),gy=b({},Ir,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ac}),py=zt(gy),yy=b({},ti,{propertyName:0,elapsedTime:0,pseudoElement:0}),vy=zt(yy),by=b({},vl,{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}),Sy=zt(by),wy=b({},ti,{newState:0,oldState:0}),_y=zt(wy),Ty=[9,13,27,32],ic=Kt&&"CompositionEvent"in window,Vr=null;Kt&&"documentMode"in document&&(Vr=document.documentMode);var ky=Kt&&"TextEvent"in window&&!Vr,Vd=Kt&&(!ic||Vr&&8<Vr&&11>=Vr),Kd=" ",Yd=!1;function Jd(e,t){switch(e){case"keyup":return Ty.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Di=!1;function Ey(e,t){switch(e){case"compositionend":return Xd(t);case"keypress":return t.which!==32?null:(Yd=!0,Kd);case"textInput":return e=t.data,e===Kd&&Yd?null:e;default:return null}}function Ay(e,t){if(Di)return e==="compositionend"||!ic&&Jd(e,t)?(e=qd(),ml=Fo=Ta=null,Di=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Vd&&t.locale!=="ko"?null:t.data;default:return null}}var xy={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 Qd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!xy[e.type]:t==="textarea"}function Wd(e,t,a,s){ye?tt?tt.push(s):tt=[s]:ye=s,t=lo(t,"onChange"),0<t.length&&(a=new yl("onChange","change",null,a,s),e.push({event:a,listeners:t}))}var Kr=null,Yr=null;function Cy(e){Dm(e,0)}function bl(e){var t=Wa(e);if(cl(t))return e}function Zd(e,t){if(e==="change")return t}var Fd=!1;if(Kt){var rc;if(Kt){var sc="oninput"in document;if(!sc){var eh=document.createElement("div");eh.setAttribute("oninput","return;"),sc=typeof eh.oninput=="function"}rc=sc}else rc=!1;Fd=rc&&(!document.documentMode||9<document.documentMode)}function th(){Kr&&(Kr.detachEvent("onpropertychange",nh),Yr=Kr=null)}function nh(e){if(e.propertyName==="value"&&bl(Yr)){var t=[];Wd(t,Yr,e,ce(e)),fl(Cy,t)}}function Oy(e,t,a){e==="focusin"?(th(),Kr=t,Yr=a,Kr.attachEvent("onpropertychange",nh)):e==="focusout"&&th()}function Ry(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return bl(Yr)}function jy(e,t){if(e==="click")return bl(t)}function Ny(e,t){if(e==="input"||e==="change")return bl(t)}function Ly(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Yt=typeof Object.is=="function"?Object.is:Ly;function Jr(e,t){if(Yt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),s=Object.keys(t);if(a.length!==s.length)return!1;for(s=0;s<a.length;s++){var o=a[s];if(!Ei.call(t,o)||!Yt(e[o],t[o]))return!1}return!0}function ah(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ih(e,t){var a=ah(e);e=0;for(var s;a;){if(a.nodeType===3){if(s=e+a.textContent.length,e<=t&&s>=t)return{node:a,offset:t-e};e=s}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=ah(a)}}function rh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?rh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function sh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=$r(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=$r(e.document)}return t}function lc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Dy=Kt&&"documentMode"in document&&11>=document.documentMode,Ui=null,oc=null,Xr=null,cc=!1;function lh(e,t,a){var s=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;cc||Ui==null||Ui!==$r(s)||(s=Ui,"selectionStart"in s&&lc(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Xr&&Jr(Xr,s)||(Xr=s,s=lo(oc,"onSelect"),0<s.length&&(t=new yl("onSelect","select",null,t,a),e.push({event:t,listeners:s}),t.target=Ui)))}function ni(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var Mi={animationend:ni("Animation","AnimationEnd"),animationiteration:ni("Animation","AnimationIteration"),animationstart:ni("Animation","AnimationStart"),transitionrun:ni("Transition","TransitionRun"),transitionstart:ni("Transition","TransitionStart"),transitioncancel:ni("Transition","TransitionCancel"),transitionend:ni("Transition","TransitionEnd")},uc={},oh={};Kt&&(oh=document.createElement("div").style,"AnimationEvent"in window||(delete Mi.animationend.animation,delete Mi.animationiteration.animation,delete Mi.animationstart.animation),"TransitionEvent"in window||delete Mi.transitionend.transition);function ai(e){if(uc[e])return uc[e];if(!Mi[e])return e;var t=Mi[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in oh)return uc[e]=t[a];return e}var ch=ai("animationend"),uh=ai("animationiteration"),dh=ai("animationstart"),Uy=ai("transitionrun"),My=ai("transitionstart"),zy=ai("transitioncancel"),hh=ai("transitionend"),fh=new Map,dc="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(" ");dc.push("scrollEnd");function pn(e,t){fh.set(e,t),Pn(t,[e])}var Sl=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=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(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},an=[],zi=0,hc=0;function wl(){for(var e=zi,t=hc=zi=0;t<e;){var a=an[t];an[t++]=null;var s=an[t];an[t++]=null;var o=an[t];an[t++]=null;var u=an[t];if(an[t++]=null,s!==null&&o!==null){var f=s.pending;f===null?o.next=o:(o.next=f.next,f.next=o),s.pending=o}u!==0&&mh(a,o,u)}}function _l(e,t,a,s){an[zi++]=e,an[zi++]=t,an[zi++]=a,an[zi++]=s,hc|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function fc(e,t,a,s){return _l(e,t,a,s),Tl(e)}function ii(e,t){return _l(e,null,null,t),Tl(e)}function mh(e,t,a){e.lanes|=a;var s=e.alternate;s!==null&&(s.lanes|=a);for(var o=!1,u=e.return;u!==null;)u.childLanes|=a,s=u.alternate,s!==null&&(s.childLanes|=a),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(o=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,o&&t!==null&&(o=31-lt(a),e=u.hiddenUpdates,s=e[o],s===null?e[o]=[t]:s.push(t),t.lane=a|536870912),u):null}function Tl(e){if(50<ys)throw ys=0,_u=null,Error(l(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Bi={};function By(e,t,a,s){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Jt(e,t,a,s){return new By(e,t,a,s)}function mc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Xn(e,t){var a=e.alternate;return a===null?(a=Jt(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function gh(e,t){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,t=a.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function kl(e,t,a,s,o,u){var f=0;if(s=e,typeof e=="function")mc(e)&&(f=1);else if(typeof e=="string")f=Iv(e,a,Z.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case we:return e=Jt(31,a,t,o),e.elementType=we,e.lanes=u,e;case U:return ri(a.children,o,u,t);case $:f=8,o|=24;break;case P:return e=Jt(12,a,t,o|2),e.elementType=P,e.lanes=u,e;case ue:return e=Jt(13,a,t,o),e.elementType=ue,e.lanes=u,e;case G:return e=Jt(19,a,t,o),e.elementType=G,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case N:f=10;break e;case q:f=9;break e;case Y:f=11;break e;case Q:f=14;break e;case Se:f=16,s=null;break e}f=29,a=Error(l(130,e===null?"null":typeof e,"")),s=null}return t=Jt(f,a,t,o),t.elementType=e,t.type=s,t.lanes=u,t}function ri(e,t,a,s){return e=Jt(7,e,s,t),e.lanes=a,e}function gc(e,t,a){return e=Jt(6,e,null,t),e.lanes=a,e}function ph(e){var t=Jt(18,null,null,0);return t.stateNode=e,t}function pc(e,t,a){return t=Jt(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var yh=new WeakMap;function rn(e,t){if(typeof e=="object"&&e!==null){var a=yh.get(e);return a!==void 0?a:(t={value:e,source:t,stack:Ae(t)},yh.set(e,t),t)}return{value:e,source:t,stack:Ae(t)}}var Hi=[],qi=0,El=null,Qr=0,sn=[],ln=0,ka=null,An=1,xn="";function Qn(e,t){Hi[qi++]=Qr,Hi[qi++]=El,El=e,Qr=t}function vh(e,t,a){sn[ln++]=An,sn[ln++]=xn,sn[ln++]=ka,ka=e;var s=An;e=xn;var o=32-lt(s)-1;s&=~(1<<o),a+=1;var u=32-lt(t)+o;if(30<u){var f=o-o%5;u=(s&(1<<f)-1).toString(32),s>>=f,o-=f,An=1<<32-lt(t)+o|a<<o|s,xn=u+e}else An=1<<u|a<<o|s,xn=e}function yc(e){e.return!==null&&(Qn(e,1),vh(e,1,0))}function vc(e){for(;e===El;)El=Hi[--qi],Hi[qi]=null,Qr=Hi[--qi],Hi[qi]=null;for(;e===ka;)ka=sn[--ln],sn[ln]=null,xn=sn[--ln],sn[ln]=null,An=sn[--ln],sn[ln]=null}function bh(e,t){sn[ln++]=An,sn[ln++]=xn,sn[ln++]=ka,An=t.id,xn=t.overflow,ka=e}var _t=null,Pe=null,ke=!1,Ea=null,on=!1,bc=Error(l(519));function Aa(e){var t=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Wr(rn(t,e)),bc}function Sh(e){var t=e.stateNode,a=e.type,s=e.memoizedProps;switch(t[Ve]=e,t[wt]=s,a){case"dialog":be("cancel",t),be("close",t);break;case"iframe":case"object":case"embed":be("load",t);break;case"video":case"audio":for(a=0;a<bs.length;a++)be(bs[a],t);break;case"source":be("error",t);break;case"img":case"image":case"link":be("error",t),be("load",t);break;case"details":be("toggle",t);break;case"input":be("invalid",t),Fa(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":be("invalid",t);break;case"textarea":be("invalid",t),dl(t,s.value,s.defaultValue,s.children)}a=s.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||s.suppressHydrationWarning===!0||Bm(t.textContent,a)?(s.popover!=null&&(be("beforetoggle",t),be("toggle",t)),s.onScroll!=null&&be("scroll",t),s.onScrollEnd!=null&&be("scrollend",t),s.onClick!=null&&(t.onclick=W),t=!0):t=!1,t||Aa(e,!0)}function wh(e){for(_t=e.return;_t;)switch(_t.tag){case 5:case 31:case 13:on=!1;return;case 27:case 3:on=!0;return;default:_t=_t.return}}function $i(e){if(e!==_t)return!1;if(!ke)return wh(e),ke=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||zu(e.type,e.memoizedProps)),a=!a),a&&Pe&&Aa(e),wh(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Pe=Ym(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Pe=Ym(e)}else t===27?(t=Pe,qa(e.type)?(e=Pu,Pu=null,Pe=e):Pe=t):Pe=_t?un(e.stateNode.nextSibling):null;return!0}function si(){Pe=_t=null,ke=!1}function Sc(){var e=Ea;return e!==null&&($t===null?$t=e:$t.push.apply($t,e),Ea=null),e}function Wr(e){Ea===null?Ea=[e]:Ea.push(e)}var wc=E(null),li=null,Wn=null;function xa(e,t,a){J(wc,t._currentValue),t._currentValue=a}function Zn(e){e._currentValue=wc.current,M(wc)}function _c(e,t,a){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===a)break;e=e.return}}function Tc(e,t,a,s){var o=e.child;for(o!==null&&(o.return=e);o!==null;){var u=o.dependencies;if(u!==null){var f=o.child;u=u.firstContext;e:for(;u!==null;){var v=u;u=o;for(var _=0;_<t.length;_++)if(v.context===t[_]){u.lanes|=a,v=u.alternate,v!==null&&(v.lanes|=a),_c(u.return,a,e),s||(f=null);break e}u=v.next}}else if(o.tag===18){if(f=o.return,f===null)throw Error(l(341));f.lanes|=a,u=f.alternate,u!==null&&(u.lanes|=a),_c(f,a,e),f=null}else f=o.child;if(f!==null)f.return=o;else for(f=o;f!==null;){if(f===e){f=null;break}if(o=f.sibling,o!==null){o.return=f.return,f=o;break}f=f.return}o=f}}function Pi(e,t,a,s){e=null;for(var o=t,u=!1;o!==null;){if(!u){if((o.flags&524288)!==0)u=!0;else if((o.flags&262144)!==0)break}if(o.tag===10){var f=o.alternate;if(f===null)throw Error(l(387));if(f=f.memoizedProps,f!==null){var v=o.type;Yt(o.pendingProps.value,f.value)||(e!==null?e.push(v):e=[v])}}else if(o===xe.current){if(f=o.alternate,f===null)throw Error(l(387));f.memoizedState.memoizedState!==o.memoizedState.memoizedState&&(e!==null?e.push(ks):e=[ks])}o=o.return}e!==null&&Tc(t,e,a,s),t.flags|=262144}function Al(e){for(e=e.firstContext;e!==null;){if(!Yt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function oi(e){li=e,Wn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Tt(e){return _h(li,e)}function xl(e,t){return li===null&&oi(e),_h(e,t)}function _h(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},Wn===null){if(e===null)throw Error(l(308));Wn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Wn=Wn.next=t;return a}var Hy=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,s){e.push(s)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},qy=i.unstable_scheduleCallback,$y=i.unstable_NormalPriority,ct={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function kc(){return{controller:new Hy,data:new Map,refCount:0}}function Zr(e){e.refCount--,e.refCount===0&&qy($y,function(){e.controller.abort()})}var Fr=null,Ec=0,Ii=0,Gi=null;function Py(e,t){if(Fr===null){var a=Fr=[];Ec=0,Ii=Cu(),Gi={status:"pending",value:void 0,then:function(s){a.push(s)}}}return Ec++,t.then(Th,Th),t}function Th(){if(--Ec===0&&Fr!==null){Gi!==null&&(Gi.status="fulfilled");var e=Fr;Fr=null,Ii=0,Gi=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Iy(e,t){var a=[],s={status:"pending",value:null,reason:null,then:function(o){a.push(o)}};return e.then(function(){s.status="fulfilled",s.value=t;for(var o=0;o<a.length;o++)(0,a[o])(t)},function(o){for(s.status="rejected",s.reason=o,o=0;o<a.length;o++)(0,a[o])(void 0)}),s}var kh=D.S;D.S=function(e,t){om=Ot(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Py(e,t),kh!==null&&kh(e,t)};var ci=E(null);function Ac(){var e=ci.current;return e!==null?e:Be.pooledCache}function Cl(e,t){t===null?J(ci,ci.current):J(ci,t.pool)}function Eh(){var e=Ac();return e===null?null:{parent:ct._currentValue,pool:e}}var Vi=Error(l(460)),xc=Error(l(474)),Ol=Error(l(542)),Rl={then:function(){}};function Ah(e){return e=e.status,e==="fulfilled"||e==="rejected"}function xh(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(W,W),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Oh(e),e;default:if(typeof t.status=="string")t.then(W,W);else{if(e=Be,e!==null&&100<e.shellSuspendCounter)throw Error(l(482));e=t,e.status="pending",e.then(function(s){if(t.status==="pending"){var o=t;o.status="fulfilled",o.value=s}},function(s){if(t.status==="pending"){var o=t;o.status="rejected",o.reason=s}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Oh(e),e}throw di=t,Vi}}function ui(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(di=a,Vi):a}}var di=null;function Ch(){if(di===null)throw Error(l(459));var e=di;return di=null,e}function Oh(e){if(e===Vi||e===Ol)throw Error(l(483))}var Ki=null,es=0;function jl(e){var t=es;return es+=1,Ki===null&&(Ki=[]),xh(Ki,e,t)}function ts(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Nl(e,t){throw t.$$typeof===T?Error(l(525)):(e=Object.prototype.toString.call(t),Error(l(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Rh(e){function t(x,k){if(e){var O=x.deletions;O===null?(x.deletions=[k],x.flags|=16):O.push(k)}}function a(x,k){if(!e)return null;for(;k!==null;)t(x,k),k=k.sibling;return null}function s(x){for(var k=new Map;x!==null;)x.key!==null?k.set(x.key,x):k.set(x.index,x),x=x.sibling;return k}function o(x,k){return x=Xn(x,k),x.index=0,x.sibling=null,x}function u(x,k,O){return x.index=O,e?(O=x.alternate,O!==null?(O=O.index,O<k?(x.flags|=67108866,k):O):(x.flags|=67108866,k)):(x.flags|=1048576,k)}function f(x){return e&&x.alternate===null&&(x.flags|=67108866),x}function v(x,k,O,B){return k===null||k.tag!==6?(k=gc(O,x.mode,B),k.return=x,k):(k=o(k,O),k.return=x,k)}function _(x,k,O,B){var re=O.type;return re===U?z(x,k,O.props.children,B,O.key):k!==null&&(k.elementType===re||typeof re=="object"&&re!==null&&re.$$typeof===Se&&ui(re)===k.type)?(k=o(k,O.props),ts(k,O),k.return=x,k):(k=kl(O.type,O.key,O.props,null,x.mode,B),ts(k,O),k.return=x,k)}function R(x,k,O,B){return k===null||k.tag!==4||k.stateNode.containerInfo!==O.containerInfo||k.stateNode.implementation!==O.implementation?(k=pc(O,x.mode,B),k.return=x,k):(k=o(k,O.children||[]),k.return=x,k)}function z(x,k,O,B,re){return k===null||k.tag!==7?(k=ri(O,x.mode,B,re),k.return=x,k):(k=o(k,O),k.return=x,k)}function H(x,k,O){if(typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint")return k=gc(""+k,x.mode,O),k.return=x,k;if(typeof k=="object"&&k!==null){switch(k.$$typeof){case A:return O=kl(k.type,k.key,k.props,null,x.mode,O),ts(O,k),O.return=x,O;case C:return k=pc(k,x.mode,O),k.return=x,k;case Se:return k=ui(k),H(x,k,O)}if(Ge(k)||Le(k))return k=ri(k,x.mode,O,null),k.return=x,k;if(typeof k.then=="function")return H(x,jl(k),O);if(k.$$typeof===N)return H(x,xl(x,k),O);Nl(x,k)}return null}function j(x,k,O,B){var re=k!==null?k.key:null;if(typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint")return re!==null?null:v(x,k,""+O,B);if(typeof O=="object"&&O!==null){switch(O.$$typeof){case A:return O.key===re?_(x,k,O,B):null;case C:return O.key===re?R(x,k,O,B):null;case Se:return O=ui(O),j(x,k,O,B)}if(Ge(O)||Le(O))return re!==null?null:z(x,k,O,B,null);if(typeof O.then=="function")return j(x,k,jl(O),B);if(O.$$typeof===N)return j(x,k,xl(x,O),B);Nl(x,O)}return null}function L(x,k,O,B,re){if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return x=x.get(O)||null,v(k,x,""+B,re);if(typeof B=="object"&&B!==null){switch(B.$$typeof){case A:return x=x.get(B.key===null?O:B.key)||null,_(k,x,B,re);case C:return x=x.get(B.key===null?O:B.key)||null,R(k,x,B,re);case Se:return B=ui(B),L(x,k,O,B,re)}if(Ge(B)||Le(B))return x=x.get(O)||null,z(k,x,B,re,null);if(typeof B.then=="function")return L(x,k,O,jl(B),re);if(B.$$typeof===N)return L(x,k,O,xl(k,B),re);Nl(k,B)}return null}function F(x,k,O,B){for(var re=null,Ce=null,ne=k,pe=k=0,Te=null;ne!==null&&pe<O.length;pe++){ne.index>pe?(Te=ne,ne=null):Te=ne.sibling;var Oe=j(x,ne,O[pe],B);if(Oe===null){ne===null&&(ne=Te);break}e&&ne&&Oe.alternate===null&&t(x,ne),k=u(Oe,k,pe),Ce===null?re=Oe:Ce.sibling=Oe,Ce=Oe,ne=Te}if(pe===O.length)return a(x,ne),ke&&Qn(x,pe),re;if(ne===null){for(;pe<O.length;pe++)ne=H(x,O[pe],B),ne!==null&&(k=u(ne,k,pe),Ce===null?re=ne:Ce.sibling=ne,Ce=ne);return ke&&Qn(x,pe),re}for(ne=s(ne);pe<O.length;pe++)Te=L(ne,x,pe,O[pe],B),Te!==null&&(e&&Te.alternate!==null&&ne.delete(Te.key===null?pe:Te.key),k=u(Te,k,pe),Ce===null?re=Te:Ce.sibling=Te,Ce=Te);return e&&ne.forEach(function(Va){return t(x,Va)}),ke&&Qn(x,pe),re}function oe(x,k,O,B){if(O==null)throw Error(l(151));for(var re=null,Ce=null,ne=k,pe=k=0,Te=null,Oe=O.next();ne!==null&&!Oe.done;pe++,Oe=O.next()){ne.index>pe?(Te=ne,ne=null):Te=ne.sibling;var Va=j(x,ne,Oe.value,B);if(Va===null){ne===null&&(ne=Te);break}e&&ne&&Va.alternate===null&&t(x,ne),k=u(Va,k,pe),Ce===null?re=Va:Ce.sibling=Va,Ce=Va,ne=Te}if(Oe.done)return a(x,ne),ke&&Qn(x,pe),re;if(ne===null){for(;!Oe.done;pe++,Oe=O.next())Oe=H(x,Oe.value,B),Oe!==null&&(k=u(Oe,k,pe),Ce===null?re=Oe:Ce.sibling=Oe,Ce=Oe);return ke&&Qn(x,pe),re}for(ne=s(ne);!Oe.done;pe++,Oe=O.next())Oe=L(ne,x,pe,Oe.value,B),Oe!==null&&(e&&Oe.alternate!==null&&ne.delete(Oe.key===null?pe:Oe.key),k=u(Oe,k,pe),Ce===null?re=Oe:Ce.sibling=Oe,Ce=Oe);return e&&ne.forEach(function(e0){return t(x,e0)}),ke&&Qn(x,pe),re}function Me(x,k,O,B){if(typeof O=="object"&&O!==null&&O.type===U&&O.key===null&&(O=O.props.children),typeof O=="object"&&O!==null){switch(O.$$typeof){case A:e:{for(var re=O.key;k!==null;){if(k.key===re){if(re=O.type,re===U){if(k.tag===7){a(x,k.sibling),B=o(k,O.props.children),B.return=x,x=B;break e}}else if(k.elementType===re||typeof re=="object"&&re!==null&&re.$$typeof===Se&&ui(re)===k.type){a(x,k.sibling),B=o(k,O.props),ts(B,O),B.return=x,x=B;break e}a(x,k);break}else t(x,k);k=k.sibling}O.type===U?(B=ri(O.props.children,x.mode,B,O.key),B.return=x,x=B):(B=kl(O.type,O.key,O.props,null,x.mode,B),ts(B,O),B.return=x,x=B)}return f(x);case C:e:{for(re=O.key;k!==null;){if(k.key===re)if(k.tag===4&&k.stateNode.containerInfo===O.containerInfo&&k.stateNode.implementation===O.implementation){a(x,k.sibling),B=o(k,O.children||[]),B.return=x,x=B;break e}else{a(x,k);break}else t(x,k);k=k.sibling}B=pc(O,x.mode,B),B.return=x,x=B}return f(x);case Se:return O=ui(O),Me(x,k,O,B)}if(Ge(O))return F(x,k,O,B);if(Le(O)){if(re=Le(O),typeof re!="function")throw Error(l(150));return O=re.call(O),oe(x,k,O,B)}if(typeof O.then=="function")return Me(x,k,jl(O),B);if(O.$$typeof===N)return Me(x,k,xl(x,O),B);Nl(x,O)}return typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint"?(O=""+O,k!==null&&k.tag===6?(a(x,k.sibling),B=o(k,O),B.return=x,x=B):(a(x,k),B=gc(O,x.mode,B),B.return=x,x=B),f(x)):a(x,k)}return function(x,k,O,B){try{es=0;var re=Me(x,k,O,B);return Ki=null,re}catch(ne){if(ne===Vi||ne===Ol)throw ne;var Ce=Jt(29,ne,null,x.mode);return Ce.lanes=B,Ce.return=x,Ce}}}var hi=Rh(!0),jh=Rh(!1),Ca=!1;function Cc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Oc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Oa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ra(e,t,a){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Re&2)!==0){var o=s.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),s.pending=t,t=Tl(e),mh(e,null,a),t}return _l(e,s,t,a),Tl(e)}function ns(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var s=t.lanes;s&=e.pendingLanes,a|=s,t.lanes=a,Dr(e,a)}}function Rc(e,t){var a=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,a===s)){var o=null,u=null;if(a=a.firstBaseUpdate,a!==null){do{var f={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};u===null?o=u=f:u=u.next=f,a=a.next}while(a!==null);u===null?o=u=t:u=u.next=t}else o=u=t;a={baseState:s.baseState,firstBaseUpdate:o,lastBaseUpdate:u,shared:s.shared,callbacks:s.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var jc=!1;function as(){if(jc){var e=Gi;if(e!==null)throw e}}function is(e,t,a,s){jc=!1;var o=e.updateQueue;Ca=!1;var u=o.firstBaseUpdate,f=o.lastBaseUpdate,v=o.shared.pending;if(v!==null){o.shared.pending=null;var _=v,R=_.next;_.next=null,f===null?u=R:f.next=R,f=_;var z=e.alternate;z!==null&&(z=z.updateQueue,v=z.lastBaseUpdate,v!==f&&(v===null?z.firstBaseUpdate=R:v.next=R,z.lastBaseUpdate=_))}if(u!==null){var H=o.baseState;f=0,z=R=_=null,v=u;do{var j=v.lane&-536870913,L=j!==v.lane;if(L?(_e&j)===j:(s&j)===j){j!==0&&j===Ii&&(jc=!0),z!==null&&(z=z.next={lane:0,tag:v.tag,payload:v.payload,callback:null,next:null});e:{var F=e,oe=v;j=t;var Me=a;switch(oe.tag){case 1:if(F=oe.payload,typeof F=="function"){H=F.call(Me,H,j);break e}H=F;break e;case 3:F.flags=F.flags&-65537|128;case 0:if(F=oe.payload,j=typeof F=="function"?F.call(Me,H,j):F,j==null)break e;H=b({},H,j);break e;case 2:Ca=!0}}j=v.callback,j!==null&&(e.flags|=64,L&&(e.flags|=8192),L=o.callbacks,L===null?o.callbacks=[j]:L.push(j))}else L={lane:j,tag:v.tag,payload:v.payload,callback:v.callback,next:null},z===null?(R=z=L,_=H):z=z.next=L,f|=j;if(v=v.next,v===null){if(v=o.shared.pending,v===null)break;L=v,v=L.next,L.next=null,o.lastBaseUpdate=L,o.shared.pending=null}}while(!0);z===null&&(_=H),o.baseState=_,o.firstBaseUpdate=R,o.lastBaseUpdate=z,u===null&&(o.shared.lanes=0),Ua|=f,e.lanes=f,e.memoizedState=H}}function Nh(e,t){if(typeof e!="function")throw Error(l(191,e));e.call(t)}function Lh(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)Nh(a[e],t)}var Yi=E(null),Ll=E(0);function Dh(e,t){e=la,J(Ll,e),J(Yi,t),la=e|t.baseLanes}function Nc(){J(Ll,la),J(Yi,Yi.current)}function Lc(){la=Ll.current,M(Yi),M(Ll)}var Xt=E(null),cn=null;function ja(e){var t=e.alternate;J(at,at.current&1),J(Xt,e),cn===null&&(t===null||Yi.current!==null||t.memoizedState!==null)&&(cn=e)}function Dc(e){J(at,at.current),J(Xt,e),cn===null&&(cn=e)}function Uh(e){e.tag===22?(J(at,at.current),J(Xt,e),cn===null&&(cn=e)):Na()}function Na(){J(at,at.current),J(Xt,Xt.current)}function Qt(e){M(Xt),cn===e&&(cn=null),M(at)}var at=E(0);function Dl(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||qu(a)||$u(a)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Fn=0,ge=null,De=null,ut=null,Ul=!1,Ji=!1,fi=!1,Ml=0,rs=0,Xi=null,Gy=0;function Ze(){throw Error(l(321))}function Uc(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!Yt(e[a],t[a]))return!1;return!0}function Mc(e,t,a,s,o,u){return Fn=u,ge=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,D.H=e===null||e.memoizedState===null?bf:Wc,fi=!1,u=a(s,o),fi=!1,Ji&&(u=zh(t,a,s,o)),Mh(e),u}function Mh(e){D.H=os;var t=De!==null&&De.next!==null;if(Fn=0,ut=De=ge=null,Ul=!1,rs=0,Xi=null,t)throw Error(l(300));e===null||dt||(e=e.dependencies,e!==null&&Al(e)&&(dt=!0))}function zh(e,t,a,s){ge=e;var o=0;do{if(Ji&&(Xi=null),rs=0,Ji=!1,25<=o)throw Error(l(301));if(o+=1,ut=De=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}D.H=Sf,u=t(a,s)}while(Ji);return u}function Vy(){var e=D.H,t=e.useState()[0];return t=typeof t.then=="function"?ss(t):t,e=e.useState()[0],(De!==null?De.memoizedState:null)!==e&&(ge.flags|=1024),t}function zc(){var e=Ml!==0;return Ml=0,e}function Bc(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function Hc(e){if(Ul){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ul=!1}Fn=0,ut=De=ge=null,Ji=!1,rs=Ml=0,Xi=null}function Rt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ut===null?ge.memoizedState=ut=e:ut=ut.next=e,ut}function it(){if(De===null){var e=ge.alternate;e=e!==null?e.memoizedState:null}else e=De.next;var t=ut===null?ge.memoizedState:ut.next;if(t!==null)ut=t,De=e;else{if(e===null)throw ge.alternate===null?Error(l(467)):Error(l(310));De=e,e={memoizedState:De.memoizedState,baseState:De.baseState,baseQueue:De.baseQueue,queue:De.queue,next:null},ut===null?ge.memoizedState=ut=e:ut=ut.next=e}return ut}function zl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ss(e){var t=rs;return rs+=1,Xi===null&&(Xi=[]),e=xh(Xi,e,t),t=ge,(ut===null?t.memoizedState:ut.next)===null&&(t=t.alternate,D.H=t===null||t.memoizedState===null?bf:Wc),e}function Bl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ss(e);if(e.$$typeof===N)return Tt(e)}throw Error(l(438,String(e)))}function qc(e){var t=null,a=ge.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var s=ge.alternate;s!==null&&(s=s.updateQueue,s!==null&&(s=s.memoCache,s!=null&&(t={data:s.data.map(function(o){return o.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=zl(),ge.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),s=0;s<e;s++)a[s]=Nt;return t.index++,a}function ea(e,t){return typeof t=="function"?t(e):t}function Hl(e){var t=it();return $c(t,De,e)}function $c(e,t,a){var s=e.queue;if(s===null)throw Error(l(311));s.lastRenderedReducer=a;var o=e.baseQueue,u=s.pending;if(u!==null){if(o!==null){var f=o.next;o.next=u.next,u.next=f}t.baseQueue=o=u,s.pending=null}if(u=e.baseState,o===null)e.memoizedState=u;else{t=o.next;var v=f=null,_=null,R=t,z=!1;do{var H=R.lane&-536870913;if(H!==R.lane?(_e&H)===H:(Fn&H)===H){var j=R.revertLane;if(j===0)_!==null&&(_=_.next={lane:0,revertLane:0,gesture:null,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null}),H===Ii&&(z=!0);else if((Fn&j)===j){R=R.next,j===Ii&&(z=!0);continue}else H={lane:0,revertLane:R.revertLane,gesture:null,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null},_===null?(v=_=H,f=u):_=_.next=H,ge.lanes|=j,Ua|=j;H=R.action,fi&&a(u,H),u=R.hasEagerState?R.eagerState:a(u,H)}else j={lane:H,revertLane:R.revertLane,gesture:R.gesture,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null},_===null?(v=_=j,f=u):_=_.next=j,ge.lanes|=H,Ua|=H;R=R.next}while(R!==null&&R!==t);if(_===null?f=u:_.next=v,!Yt(u,e.memoizedState)&&(dt=!0,z&&(a=Gi,a!==null)))throw a;e.memoizedState=u,e.baseState=f,e.baseQueue=_,s.lastRenderedState=u}return o===null&&(s.lanes=0),[e.memoizedState,s.dispatch]}function Pc(e){var t=it(),a=t.queue;if(a===null)throw Error(l(311));a.lastRenderedReducer=e;var s=a.dispatch,o=a.pending,u=t.memoizedState;if(o!==null){a.pending=null;var f=o=o.next;do u=e(u,f.action),f=f.next;while(f!==o);Yt(u,t.memoizedState)||(dt=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),a.lastRenderedState=u}return[u,s]}function Bh(e,t,a){var s=ge,o=it(),u=ke;if(u){if(a===void 0)throw Error(l(407));a=a()}else a=t();var f=!Yt((De||o).memoizedState,a);if(f&&(o.memoizedState=a,dt=!0),o=o.queue,Vc($h.bind(null,s,o,e),[e]),o.getSnapshot!==t||f||ut!==null&&ut.memoizedState.tag&1){if(s.flags|=2048,Qi(9,{destroy:void 0},qh.bind(null,s,o,a,t),null),Be===null)throw Error(l(349));u||(Fn&127)!==0||Hh(s,t,a)}return a}function Hh(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=ge.updateQueue,t===null?(t=zl(),ge.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function qh(e,t,a,s){t.value=a,t.getSnapshot=s,Ph(t)&&Ih(e)}function $h(e,t,a){return a(function(){Ph(t)&&Ih(e)})}function Ph(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!Yt(e,a)}catch{return!0}}function Ih(e){var t=ii(e,2);t!==null&&Pt(t,e,2)}function Ic(e){var t=Rt();if(typeof e=="function"){var a=e;if(e=a(),fi){Lt(!0);try{a()}finally{Lt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ea,lastRenderedState:e},t}function Gh(e,t,a,s){return e.baseState=a,$c(e,De,typeof s=="function"?s:ea)}function Ky(e,t,a,s,o){if(Pl(e))throw Error(l(485));if(e=t.action,e!==null){var u={payload:o,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(f){u.listeners.push(f)}};D.T!==null?a(!0):u.isTransition=!1,s(u),a=t.pending,a===null?(u.next=t.pending=u,Vh(t,u)):(u.next=a.next,t.pending=a.next=u)}}function Vh(e,t){var a=t.action,s=t.payload,o=e.state;if(t.isTransition){var u=D.T,f={};D.T=f;try{var v=a(o,s),_=D.S;_!==null&&_(f,v),Kh(e,t,v)}catch(R){Gc(e,t,R)}finally{u!==null&&f.types!==null&&(u.types=f.types),D.T=u}}else try{u=a(o,s),Kh(e,t,u)}catch(R){Gc(e,t,R)}}function Kh(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(s){Yh(e,t,s)},function(s){return Gc(e,t,s)}):Yh(e,t,a)}function Yh(e,t,a){t.status="fulfilled",t.value=a,Jh(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,Vh(e,a)))}function Gc(e,t,a){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=a,Jh(t),t=t.next;while(t!==s)}e.action=null}function Jh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Xh(e,t){return t}function Qh(e,t){if(ke){var a=Be.formState;if(a!==null){e:{var s=ge;if(ke){if(Pe){t:{for(var o=Pe,u=on;o.nodeType!==8;){if(!u){o=null;break t}if(o=un(o.nextSibling),o===null){o=null;break t}}u=o.data,o=u==="F!"||u==="F"?o:null}if(o){Pe=un(o.nextSibling),s=o.data==="F!";break e}}Aa(s)}s=!1}s&&(t=a[0])}}return a=Rt(),a.memoizedState=a.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xh,lastRenderedState:t},a.queue=s,a=pf.bind(null,ge,s),s.dispatch=a,s=Ic(!1),u=Qc.bind(null,ge,!1,s.queue),s=Rt(),o={state:t,dispatch:null,action:e,pending:null},s.queue=o,a=Ky.bind(null,ge,o,u,a),o.dispatch=a,s.memoizedState=e,[t,a,!1]}function Wh(e){var t=it();return Zh(t,De,e)}function Zh(e,t,a){if(t=$c(e,t,Xh)[0],e=Hl(ea)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=ss(t)}catch(f){throw f===Vi?Ol:f}else s=t;t=it();var o=t.queue,u=o.dispatch;return a!==t.memoizedState&&(ge.flags|=2048,Qi(9,{destroy:void 0},Yy.bind(null,o,a),null)),[s,u,e]}function Yy(e,t){e.action=t}function Fh(e){var t=it(),a=De;if(a!==null)return Zh(t,a,e);it(),t=t.memoizedState,a=it();var s=a.queue.dispatch;return a.memoizedState=e,[t,s,!1]}function Qi(e,t,a,s){return e={tag:e,create:a,deps:s,inst:t,next:null},t=ge.updateQueue,t===null&&(t=zl(),ge.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(s=a.next,a.next=e,e.next=s,t.lastEffect=e),e}function ef(){return it().memoizedState}function ql(e,t,a,s){var o=Rt();ge.flags|=e,o.memoizedState=Qi(1|t,{destroy:void 0},a,s===void 0?null:s)}function $l(e,t,a,s){var o=it();s=s===void 0?null:s;var u=o.memoizedState.inst;De!==null&&s!==null&&Uc(s,De.memoizedState.deps)?o.memoizedState=Qi(t,u,a,s):(ge.flags|=e,o.memoizedState=Qi(1|t,u,a,s))}function tf(e,t){ql(8390656,8,e,t)}function Vc(e,t){$l(2048,8,e,t)}function Jy(e){ge.flags|=4;var t=ge.updateQueue;if(t===null)t=zl(),ge.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function nf(e){var t=it().memoizedState;return Jy({ref:t,nextImpl:e}),function(){if((Re&2)!==0)throw Error(l(440));return t.impl.apply(void 0,arguments)}}function af(e,t){return $l(4,2,e,t)}function rf(e,t){return $l(4,4,e,t)}function sf(e,t){if(typeof t=="function"){e=e();var a=t(e);return function(){typeof a=="function"?a():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function lf(e,t,a){a=a!=null?a.concat([e]):null,$l(4,4,sf.bind(null,t,e),a)}function Kc(){}function of(e,t){var a=it();t=t===void 0?null:t;var s=a.memoizedState;return t!==null&&Uc(t,s[1])?s[0]:(a.memoizedState=[e,t],e)}function cf(e,t){var a=it();t=t===void 0?null:t;var s=a.memoizedState;if(t!==null&&Uc(t,s[1]))return s[0];if(s=e(),fi){Lt(!0);try{e()}finally{Lt(!1)}}return a.memoizedState=[s,t],s}function Yc(e,t,a){return a===void 0||(Fn&1073741824)!==0&&(_e&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=um(),ge.lanes|=e,Ua|=e,a)}function uf(e,t,a,s){return Yt(a,t)?a:Yi.current!==null?(e=Yc(e,a,s),Yt(e,t)||(dt=!0),e):(Fn&42)===0||(Fn&1073741824)!==0&&(_e&261930)===0?(dt=!0,e.memoizedState=a):(e=um(),ge.lanes|=e,Ua|=e,t)}function df(e,t,a,s,o){var u=K.p;K.p=u!==0&&8>u?u:8;var f=D.T,v={};D.T=v,Qc(e,!1,t,a);try{var _=o(),R=D.S;if(R!==null&&R(v,_),_!==null&&typeof _=="object"&&typeof _.then=="function"){var z=Iy(_,s);ls(e,t,z,Ft(e))}else ls(e,t,s,Ft(e))}catch(H){ls(e,t,{then:function(){},status:"rejected",reason:H},Ft())}finally{K.p=u,f!==null&&v.types!==null&&(f.types=v.types),D.T=f}}function Xy(){}function Jc(e,t,a,s){if(e.tag!==5)throw Error(l(476));var o=hf(e).queue;df(e,o,t,ae,a===null?Xy:function(){return ff(e),a(s)})}function hf(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ea,lastRenderedState:ae},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ea,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ff(e){var t=hf(e);t.next===null&&(t=e.alternate.memoizedState),ls(e,t.next.queue,{},Ft())}function Xc(){return Tt(ks)}function mf(){return it().memoizedState}function gf(){return it().memoizedState}function Qy(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=Ft();e=Oa(a);var s=Ra(t,e,a);s!==null&&(Pt(s,t,a),ns(s,t,a)),t={cache:kc()},e.payload=t;return}t=t.return}}function Wy(e,t,a){var s=Ft();a={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Pl(e)?yf(t,a):(a=fc(e,t,a,s),a!==null&&(Pt(a,e,s),vf(a,t,s)))}function pf(e,t,a){var s=Ft();ls(e,t,a,s)}function ls(e,t,a,s){var o={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Pl(e))yf(t,o);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var f=t.lastRenderedState,v=u(f,a);if(o.hasEagerState=!0,o.eagerState=v,Yt(v,f))return _l(e,t,o,0),Be===null&&wl(),!1}catch{}if(a=fc(e,t,o,s),a!==null)return Pt(a,e,s),vf(a,t,s),!0}return!1}function Qc(e,t,a,s){if(s={lane:2,revertLane:Cu(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Pl(e)){if(t)throw Error(l(479))}else t=fc(e,a,s,2),t!==null&&Pt(t,e,2)}function Pl(e){var t=e.alternate;return e===ge||t!==null&&t===ge}function yf(e,t){Ji=Ul=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function vf(e,t,a){if((a&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,a|=s,t.lanes=a,Dr(e,a)}}var os={readContext:Tt,use:Bl,useCallback:Ze,useContext:Ze,useEffect:Ze,useImperativeHandle:Ze,useLayoutEffect:Ze,useInsertionEffect:Ze,useMemo:Ze,useReducer:Ze,useRef:Ze,useState:Ze,useDebugValue:Ze,useDeferredValue:Ze,useTransition:Ze,useSyncExternalStore:Ze,useId:Ze,useHostTransitionStatus:Ze,useFormState:Ze,useActionState:Ze,useOptimistic:Ze,useMemoCache:Ze,useCacheRefresh:Ze};os.useEffectEvent=Ze;var bf={readContext:Tt,use:Bl,useCallback:function(e,t){return Rt().memoizedState=[e,t===void 0?null:t],e},useContext:Tt,useEffect:tf,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,ql(4194308,4,sf.bind(null,t,e),a)},useLayoutEffect:function(e,t){return ql(4194308,4,e,t)},useInsertionEffect:function(e,t){ql(4,2,e,t)},useMemo:function(e,t){var a=Rt();t=t===void 0?null:t;var s=e();if(fi){Lt(!0);try{e()}finally{Lt(!1)}}return a.memoizedState=[s,t],s},useReducer:function(e,t,a){var s=Rt();if(a!==void 0){var o=a(t);if(fi){Lt(!0);try{a(t)}finally{Lt(!1)}}}else o=t;return s.memoizedState=s.baseState=o,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:o},s.queue=e,e=e.dispatch=Wy.bind(null,ge,e),[s.memoizedState,e]},useRef:function(e){var t=Rt();return e={current:e},t.memoizedState=e},useState:function(e){e=Ic(e);var t=e.queue,a=pf.bind(null,ge,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:Kc,useDeferredValue:function(e,t){var a=Rt();return Yc(a,e,t)},useTransition:function(){var e=Ic(!1);return e=df.bind(null,ge,e.queue,!0,!1),Rt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var s=ge,o=Rt();if(ke){if(a===void 0)throw Error(l(407));a=a()}else{if(a=t(),Be===null)throw Error(l(349));(_e&127)!==0||Hh(s,t,a)}o.memoizedState=a;var u={value:a,getSnapshot:t};return o.queue=u,tf($h.bind(null,s,u,e),[e]),s.flags|=2048,Qi(9,{destroy:void 0},qh.bind(null,s,u,a,t),null),a},useId:function(){var e=Rt(),t=Be.identifierPrefix;if(ke){var a=xn,s=An;a=(s&~(1<<32-lt(s)-1)).toString(32)+a,t="_"+t+"R_"+a,a=Ml++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=Gy++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Xc,useFormState:Qh,useActionState:Qh,useOptimistic:function(e){var t=Rt();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=Qc.bind(null,ge,!0,a),a.dispatch=t,[e,t]},useMemoCache:qc,useCacheRefresh:function(){return Rt().memoizedState=Qy.bind(null,ge)},useEffectEvent:function(e){var t=Rt(),a={impl:e};return t.memoizedState=a,function(){if((Re&2)!==0)throw Error(l(440));return a.impl.apply(void 0,arguments)}}},Wc={readContext:Tt,use:Bl,useCallback:of,useContext:Tt,useEffect:Vc,useImperativeHandle:lf,useInsertionEffect:af,useLayoutEffect:rf,useMemo:cf,useReducer:Hl,useRef:ef,useState:function(){return Hl(ea)},useDebugValue:Kc,useDeferredValue:function(e,t){var a=it();return uf(a,De.memoizedState,e,t)},useTransition:function(){var e=Hl(ea)[0],t=it().memoizedState;return[typeof e=="boolean"?e:ss(e),t]},useSyncExternalStore:Bh,useId:mf,useHostTransitionStatus:Xc,useFormState:Wh,useActionState:Wh,useOptimistic:function(e,t){var a=it();return Gh(a,De,e,t)},useMemoCache:qc,useCacheRefresh:gf};Wc.useEffectEvent=nf;var Sf={readContext:Tt,use:Bl,useCallback:of,useContext:Tt,useEffect:Vc,useImperativeHandle:lf,useInsertionEffect:af,useLayoutEffect:rf,useMemo:cf,useReducer:Pc,useRef:ef,useState:function(){return Pc(ea)},useDebugValue:Kc,useDeferredValue:function(e,t){var a=it();return De===null?Yc(a,e,t):uf(a,De.memoizedState,e,t)},useTransition:function(){var e=Pc(ea)[0],t=it().memoizedState;return[typeof e=="boolean"?e:ss(e),t]},useSyncExternalStore:Bh,useId:mf,useHostTransitionStatus:Xc,useFormState:Fh,useActionState:Fh,useOptimistic:function(e,t){var a=it();return De!==null?Gh(a,De,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:qc,useCacheRefresh:gf};Sf.useEffectEvent=nf;function Zc(e,t,a,s){t=e.memoizedState,a=a(s,t),a=a==null?t:b({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Fc={enqueueSetState:function(e,t,a){e=e._reactInternals;var s=Ft(),o=Oa(s);o.payload=t,a!=null&&(o.callback=a),t=Ra(e,o,s),t!==null&&(Pt(t,e,s),ns(t,e,s))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var s=Ft(),o=Oa(s);o.tag=1,o.payload=t,a!=null&&(o.callback=a),t=Ra(e,o,s),t!==null&&(Pt(t,e,s),ns(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=Ft(),s=Oa(a);s.tag=2,t!=null&&(s.callback=t),t=Ra(e,s,a),t!==null&&(Pt(t,e,a),ns(t,e,a))}};function wf(e,t,a,s,o,u,f){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,u,f):t.prototype&&t.prototype.isPureReactComponent?!Jr(a,s)||!Jr(o,u):!0}function _f(e,t,a,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,s),t.state!==e&&Fc.enqueueReplaceState(t,t.state,null)}function mi(e,t){var a=t;if("ref"in t){a={};for(var s in t)s!=="ref"&&(a[s]=t[s])}if(e=e.defaultProps){a===t&&(a=b({},a));for(var o in e)a[o]===void 0&&(a[o]=e[o])}return a}function Tf(e){Sl(e)}function kf(e){console.error(e)}function Ef(e){Sl(e)}function Il(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function Af(e,t,a){try{var s=e.onCaughtError;s(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(o){setTimeout(function(){throw o})}}function eu(e,t,a){return a=Oa(a),a.tag=3,a.payload={element:null},a.callback=function(){Il(e,t)},a}function xf(e){return e=Oa(e),e.tag=3,e}function Cf(e,t,a,s){var o=a.type.getDerivedStateFromError;if(typeof o=="function"){var u=s.value;e.payload=function(){return o(u)},e.callback=function(){Af(t,a,s)}}var f=a.stateNode;f!==null&&typeof f.componentDidCatch=="function"&&(e.callback=function(){Af(t,a,s),typeof o!="function"&&(Ma===null?Ma=new Set([this]):Ma.add(this));var v=s.stack;this.componentDidCatch(s.value,{componentStack:v!==null?v:""})})}function Zy(e,t,a,s,o){if(a.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=a.alternate,t!==null&&Pi(t,a,o,!0),a=Xt.current,a!==null){switch(a.tag){case 31:case 13:return cn===null?to():a.alternate===null&&Fe===0&&(Fe=3),a.flags&=-257,a.flags|=65536,a.lanes=o,s===Rl?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([s]):t.add(s),Eu(e,s,o)),!1;case 22:return a.flags|=65536,s===Rl?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([s])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([s]):a.add(s)),Eu(e,s,o)),!1}throw Error(l(435,a.tag))}return Eu(e,s,o),to(),!1}if(ke)return t=Xt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=o,s!==bc&&(e=Error(l(422),{cause:s}),Wr(rn(e,a)))):(s!==bc&&(t=Error(l(423),{cause:s}),Wr(rn(t,a))),e=e.current.alternate,e.flags|=65536,o&=-o,e.lanes|=o,s=rn(s,a),o=eu(e.stateNode,s,o),Rc(e,o),Fe!==4&&(Fe=2)),!1;var u=Error(l(520),{cause:s});if(u=rn(u,a),ps===null?ps=[u]:ps.push(u),Fe!==4&&(Fe=2),t===null)return!0;s=rn(s,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=o&-o,a.lanes|=e,e=eu(a.stateNode,s,e),Rc(a,e),!1;case 1:if(t=a.type,u=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Ma===null||!Ma.has(u))))return a.flags|=65536,o&=-o,a.lanes|=o,o=xf(o),Cf(o,e,a,s),Rc(a,o),!1}a=a.return}while(a!==null);return!1}var tu=Error(l(461)),dt=!1;function kt(e,t,a,s){t.child=e===null?jh(t,null,a,s):hi(t,e.child,a,s)}function Of(e,t,a,s,o){a=a.render;var u=t.ref;if("ref"in s){var f={};for(var v in s)v!=="ref"&&(f[v]=s[v])}else f=s;return oi(t),s=Mc(e,t,a,f,u,o),v=zc(),e!==null&&!dt?(Bc(e,t,o),ta(e,t,o)):(ke&&v&&yc(t),t.flags|=1,kt(e,t,s,o),t.child)}function Rf(e,t,a,s,o){if(e===null){var u=a.type;return typeof u=="function"&&!mc(u)&&u.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=u,jf(e,t,u,s,o)):(e=kl(a.type,null,s,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!cu(e,o)){var f=u.memoizedProps;if(a=a.compare,a=a!==null?a:Jr,a(f,s)&&e.ref===t.ref)return ta(e,t,o)}return t.flags|=1,e=Xn(u,s),e.ref=t.ref,e.return=t,t.child=e}function jf(e,t,a,s,o){if(e!==null){var u=e.memoizedProps;if(Jr(u,s)&&e.ref===t.ref)if(dt=!1,t.pendingProps=s=u,cu(e,o))(e.flags&131072)!==0&&(dt=!0);else return t.lanes=e.lanes,ta(e,t,o)}return nu(e,t,a,s,o)}function Nf(e,t,a,s){var o=s.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|a:a,e!==null){for(s=t.child=e.child,o=0;s!==null;)o=o|s.lanes|s.childLanes,s=s.sibling;s=o&~u}else s=0,t.child=null;return Lf(e,t,u,a,s)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Cl(t,u!==null?u.cachePool:null),u!==null?Dh(t,u):Nc(),Uh(t);else return s=t.lanes=536870912,Lf(e,t,u!==null?u.baseLanes|a:a,a,s)}else u!==null?(Cl(t,u.cachePool),Dh(t,u),Na(),t.memoizedState=null):(e!==null&&Cl(t,null),Nc(),Na());return kt(e,t,o,a),t.child}function cs(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Lf(e,t,a,s,o){var u=Ac();return u=u===null?null:{parent:ct._currentValue,pool:u},t.memoizedState={baseLanes:a,cachePool:u},e!==null&&Cl(t,null),Nc(),Uh(t),e!==null&&Pi(e,t,s,!0),t.childLanes=o,null}function Gl(e,t){return t=Kl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Df(e,t,a){return hi(t,e.child,null,a),e=Gl(t,t.pendingProps),e.flags|=2,Qt(t),t.memoizedState=null,e}function Fy(e,t,a){var s=t.pendingProps,o=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ke){if(s.mode==="hidden")return e=Gl(t,s),t.lanes=536870912,cs(null,e);if(Dc(t),(e=Pe)?(e=Km(e,on),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ka!==null?{id:An,overflow:xn}:null,retryLane:536870912,hydrationErrors:null},a=ph(e),a.return=t,t.child=a,_t=t,Pe=null)):e=null,e===null)throw Aa(t);return t.lanes=536870912,null}return Gl(t,s)}var u=e.memoizedState;if(u!==null){var f=u.dehydrated;if(Dc(t),o)if(t.flags&256)t.flags&=-257,t=Df(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(l(558));else if(dt||Pi(e,t,a,!1),o=(a&e.childLanes)!==0,dt||o){if(s=Be,s!==null&&(f=Ur(s,a),f!==0&&f!==u.retryLane))throw u.retryLane=f,ii(e,f),Pt(s,e,f),tu;to(),t=Df(e,t,a)}else e=u.treeContext,Pe=un(f.nextSibling),_t=t,ke=!0,Ea=null,on=!1,e!==null&&bh(t,e),t=Gl(t,s),t.flags|=4096;return t}return e=Xn(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Vl(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(l(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function nu(e,t,a,s,o){return oi(t),a=Mc(e,t,a,s,void 0,o),s=zc(),e!==null&&!dt?(Bc(e,t,o),ta(e,t,o)):(ke&&s&&yc(t),t.flags|=1,kt(e,t,a,o),t.child)}function Uf(e,t,a,s,o,u){return oi(t),t.updateQueue=null,a=zh(t,s,a,o),Mh(e),s=zc(),e!==null&&!dt?(Bc(e,t,u),ta(e,t,u)):(ke&&s&&yc(t),t.flags|=1,kt(e,t,a,u),t.child)}function Mf(e,t,a,s,o){if(oi(t),t.stateNode===null){var u=Bi,f=a.contextType;typeof f=="object"&&f!==null&&(u=Tt(f)),u=new a(s,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=Fc,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=s,u.state=t.memoizedState,u.refs={},Cc(t),f=a.contextType,u.context=typeof f=="object"&&f!==null?Tt(f):Bi,u.state=t.memoizedState,f=a.getDerivedStateFromProps,typeof f=="function"&&(Zc(t,a,f,s),u.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(f=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),f!==u.state&&Fc.enqueueReplaceState(u,u.state,null),is(t,s,u,o),as(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){u=t.stateNode;var v=t.memoizedProps,_=mi(a,v);u.props=_;var R=u.context,z=a.contextType;f=Bi,typeof z=="object"&&z!==null&&(f=Tt(z));var H=a.getDerivedStateFromProps;z=typeof H=="function"||typeof u.getSnapshotBeforeUpdate=="function",v=t.pendingProps!==v,z||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(v||R!==f)&&_f(t,u,s,f),Ca=!1;var j=t.memoizedState;u.state=j,is(t,s,u,o),as(),R=t.memoizedState,v||j!==R||Ca?(typeof H=="function"&&(Zc(t,a,H,s),R=t.memoizedState),(_=Ca||wf(t,a,_,s,j,R,f))?(z||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=R),u.props=s,u.state=R,u.context=f,s=_):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{u=t.stateNode,Oc(e,t),f=t.memoizedProps,z=mi(a,f),u.props=z,H=t.pendingProps,j=u.context,R=a.contextType,_=Bi,typeof R=="object"&&R!==null&&(_=Tt(R)),v=a.getDerivedStateFromProps,(R=typeof v=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(f!==H||j!==_)&&_f(t,u,s,_),Ca=!1,j=t.memoizedState,u.state=j,is(t,s,u,o),as();var L=t.memoizedState;f!==H||j!==L||Ca||e!==null&&e.dependencies!==null&&Al(e.dependencies)?(typeof v=="function"&&(Zc(t,a,v,s),L=t.memoizedState),(z=Ca||wf(t,a,z,s,j,L,_)||e!==null&&e.dependencies!==null&&Al(e.dependencies))?(R||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(s,L,_),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(s,L,_)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||f===e.memoizedProps&&j===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&j===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=L),u.props=s,u.state=L,u.context=_,s=z):(typeof u.componentDidUpdate!="function"||f===e.memoizedProps&&j===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&j===e.memoizedState||(t.flags|=1024),s=!1)}return u=s,Vl(e,t),s=(t.flags&128)!==0,u||s?(u=t.stateNode,a=s&&typeof a.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&s?(t.child=hi(t,e.child,null,o),t.child=hi(t,null,a,o)):kt(e,t,a,o),t.memoizedState=u.state,e=t.child):e=ta(e,t,o),e}function zf(e,t,a,s){return si(),t.flags|=256,kt(e,t,a,s),t.child}var au={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function iu(e){return{baseLanes:e,cachePool:Eh()}}function ru(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=Zt),e}function Bf(e,t,a){var s=t.pendingProps,o=!1,u=(t.flags&128)!==0,f;if((f=u)||(f=e!==null&&e.memoizedState===null?!1:(at.current&2)!==0),f&&(o=!0,t.flags&=-129),f=(t.flags&32)!==0,t.flags&=-33,e===null){if(ke){if(o?ja(t):Na(),(e=Pe)?(e=Km(e,on),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ka!==null?{id:An,overflow:xn}:null,retryLane:536870912,hydrationErrors:null},a=ph(e),a.return=t,t.child=a,_t=t,Pe=null)):e=null,e===null)throw Aa(t);return $u(e)?t.lanes=32:t.lanes=536870912,null}var v=s.children;return s=s.fallback,o?(Na(),o=t.mode,v=Kl({mode:"hidden",children:v},o),s=ri(s,o,a,null),v.return=t,s.return=t,v.sibling=s,t.child=v,s=t.child,s.memoizedState=iu(a),s.childLanes=ru(e,f,a),t.memoizedState=au,cs(null,s)):(ja(t),su(t,v))}var _=e.memoizedState;if(_!==null&&(v=_.dehydrated,v!==null)){if(u)t.flags&256?(ja(t),t.flags&=-257,t=lu(e,t,a)):t.memoizedState!==null?(Na(),t.child=e.child,t.flags|=128,t=null):(Na(),v=s.fallback,o=t.mode,s=Kl({mode:"visible",children:s.children},o),v=ri(v,o,a,null),v.flags|=2,s.return=t,v.return=t,s.sibling=v,t.child=s,hi(t,e.child,null,a),s=t.child,s.memoizedState=iu(a),s.childLanes=ru(e,f,a),t.memoizedState=au,t=cs(null,s));else if(ja(t),$u(v)){if(f=v.nextSibling&&v.nextSibling.dataset,f)var R=f.dgst;f=R,s=Error(l(419)),s.stack="",s.digest=f,Wr({value:s,source:null,stack:null}),t=lu(e,t,a)}else if(dt||Pi(e,t,a,!1),f=(a&e.childLanes)!==0,dt||f){if(f=Be,f!==null&&(s=Ur(f,a),s!==0&&s!==_.retryLane))throw _.retryLane=s,ii(e,s),Pt(f,e,s),tu;qu(v)||to(),t=lu(e,t,a)}else qu(v)?(t.flags|=192,t.child=e.child,t=null):(e=_.treeContext,Pe=un(v.nextSibling),_t=t,ke=!0,Ea=null,on=!1,e!==null&&bh(t,e),t=su(t,s.children),t.flags|=4096);return t}return o?(Na(),v=s.fallback,o=t.mode,_=e.child,R=_.sibling,s=Xn(_,{mode:"hidden",children:s.children}),s.subtreeFlags=_.subtreeFlags&65011712,R!==null?v=Xn(R,v):(v=ri(v,o,a,null),v.flags|=2),v.return=t,s.return=t,s.sibling=v,t.child=s,cs(null,s),s=t.child,v=e.child.memoizedState,v===null?v=iu(a):(o=v.cachePool,o!==null?(_=ct._currentValue,o=o.parent!==_?{parent:_,pool:_}:o):o=Eh(),v={baseLanes:v.baseLanes|a,cachePool:o}),s.memoizedState=v,s.childLanes=ru(e,f,a),t.memoizedState=au,cs(e.child,s)):(ja(t),a=e.child,e=a.sibling,a=Xn(a,{mode:"visible",children:s.children}),a.return=t,a.sibling=null,e!==null&&(f=t.deletions,f===null?(t.deletions=[e],t.flags|=16):f.push(e)),t.child=a,t.memoizedState=null,a)}function su(e,t){return t=Kl({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Kl(e,t){return e=Jt(22,e,null,t),e.lanes=0,e}function lu(e,t,a){return hi(t,e.child,null,a),e=su(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Hf(e,t,a){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),_c(e.return,t,a)}function ou(e,t,a,s,o,u){var f=e.memoizedState;f===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:a,tailMode:o,treeForkCount:u}:(f.isBackwards=t,f.rendering=null,f.renderingStartTime=0,f.last=s,f.tail=a,f.tailMode=o,f.treeForkCount=u)}function qf(e,t,a){var s=t.pendingProps,o=s.revealOrder,u=s.tail;s=s.children;var f=at.current,v=(f&2)!==0;if(v?(f=f&1|2,t.flags|=128):f&=1,J(at,f),kt(e,t,s,a),s=ke?Qr:0,!v&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Hf(e,a,t);else if(e.tag===19)Hf(e,a,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(o){case"forwards":for(a=t.child,o=null;a!==null;)e=a.alternate,e!==null&&Dl(e)===null&&(o=a),a=a.sibling;a=o,a===null?(o=t.child,t.child=null):(o=a.sibling,a.sibling=null),ou(t,!1,o,a,u,s);break;case"backwards":case"unstable_legacy-backwards":for(a=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&Dl(e)===null){t.child=o;break}e=o.sibling,o.sibling=a,a=o,o=e}ou(t,!0,a,null,u,s);break;case"together":ou(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function ta(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),Ua|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(Pi(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(l(153));if(t.child!==null){for(e=t.child,a=Xn(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=Xn(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function cu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Al(e)))}function ev(e,t,a){switch(t.tag){case 3:Je(t,t.stateNode.containerInfo),xa(t,ct,e.memoizedState.cache),si();break;case 27:case 5:kn(t);break;case 4:Je(t,t.stateNode.containerInfo);break;case 10:xa(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Dc(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(ja(t),t.flags|=128,null):(a&t.child.childLanes)!==0?Bf(e,t,a):(ja(t),e=ta(e,t,a),e!==null?e.sibling:null);ja(t);break;case 19:var o=(e.flags&128)!==0;if(s=(a&t.childLanes)!==0,s||(Pi(e,t,a,!1),s=(a&t.childLanes)!==0),o){if(s)return qf(e,t,a);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),J(at,at.current),s)break;return null;case 22:return t.lanes=0,Nf(e,t,a,t.pendingProps);case 24:xa(t,ct,e.memoizedState.cache)}return ta(e,t,a)}function $f(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)dt=!0;else{if(!cu(e,a)&&(t.flags&128)===0)return dt=!1,ev(e,t,a);dt=(e.flags&131072)!==0}else dt=!1,ke&&(t.flags&1048576)!==0&&vh(t,Qr,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=ui(t.elementType),t.type=e,typeof e=="function")mc(e)?(s=mi(e,s),t.tag=1,t=Mf(null,t,e,s,a)):(t.tag=0,t=nu(null,t,e,s,a));else{if(e!=null){var o=e.$$typeof;if(o===Y){t.tag=11,t=Of(null,t,e,s,a);break e}else if(o===Q){t.tag=14,t=Rf(null,t,e,s,a);break e}}throw t=pt(e)||e,Error(l(306,t,""))}}return t;case 0:return nu(e,t,t.type,t.pendingProps,a);case 1:return s=t.type,o=mi(s,t.pendingProps),Mf(e,t,s,o,a);case 3:e:{if(Je(t,t.stateNode.containerInfo),e===null)throw Error(l(387));s=t.pendingProps;var u=t.memoizedState;o=u.element,Oc(e,t),is(t,s,null,a);var f=t.memoizedState;if(s=f.cache,xa(t,ct,s),s!==u.cache&&Tc(t,[ct],a,!0),as(),s=f.element,u.isDehydrated)if(u={element:s,isDehydrated:!1,cache:f.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=zf(e,t,s,a);break e}else if(s!==o){o=rn(Error(l(424)),t),Wr(o),t=zf(e,t,s,a);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Pe=un(e.firstChild),_t=t,ke=!0,Ea=null,on=!0,a=jh(t,null,s,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(si(),s===o){t=ta(e,t,a);break e}kt(e,t,s,a)}t=t.child}return t;case 26:return Vl(e,t),e===null?(a=Zm(t.type,null,t.pendingProps,null))?t.memoizedState=a:ke||(a=t.type,e=t.pendingProps,s=oo(me.current).createElement(a),s[Ve]=t,s[wt]=e,Et(s,a,e),qe(s),t.stateNode=s):t.memoizedState=Zm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return kn(t),e===null&&ke&&(s=t.stateNode=Xm(t.type,t.pendingProps,me.current),_t=t,on=!0,o=Pe,qa(t.type)?(Pu=o,Pe=un(s.firstChild)):Pe=o),kt(e,t,t.pendingProps.children,a),Vl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ke&&((o=s=Pe)&&(s=Rv(s,t.type,t.pendingProps,on),s!==null?(t.stateNode=s,_t=t,Pe=un(s.firstChild),on=!1,o=!0):o=!1),o||Aa(t)),kn(t),o=t.type,u=t.pendingProps,f=e!==null?e.memoizedProps:null,s=u.children,zu(o,u)?s=null:f!==null&&zu(o,f)&&(t.flags|=32),t.memoizedState!==null&&(o=Mc(e,t,Vy,null,null,a),ks._currentValue=o),Vl(e,t),kt(e,t,s,a),t.child;case 6:return e===null&&ke&&((e=a=Pe)&&(a=jv(a,t.pendingProps,on),a!==null?(t.stateNode=a,_t=t,Pe=null,e=!0):e=!1),e||Aa(t)),null;case 13:return Bf(e,t,a);case 4:return Je(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=hi(t,null,s,a):kt(e,t,s,a),t.child;case 11:return Of(e,t,t.type,t.pendingProps,a);case 7:return kt(e,t,t.pendingProps,a),t.child;case 8:return kt(e,t,t.pendingProps.children,a),t.child;case 12:return kt(e,t,t.pendingProps.children,a),t.child;case 10:return s=t.pendingProps,xa(t,t.type,s.value),kt(e,t,s.children,a),t.child;case 9:return o=t.type._context,s=t.pendingProps.children,oi(t),o=Tt(o),s=s(o),t.flags|=1,kt(e,t,s,a),t.child;case 14:return Rf(e,t,t.type,t.pendingProps,a);case 15:return jf(e,t,t.type,t.pendingProps,a);case 19:return qf(e,t,a);case 31:return Fy(e,t,a);case 22:return Nf(e,t,a,t.pendingProps);case 24:return oi(t),s=Tt(ct),e===null?(o=Ac(),o===null&&(o=Be,u=kc(),o.pooledCache=u,u.refCount++,u!==null&&(o.pooledCacheLanes|=a),o=u),t.memoizedState={parent:s,cache:o},Cc(t),xa(t,ct,o)):((e.lanes&a)!==0&&(Oc(e,t),is(t,null,null,a),as()),o=e.memoizedState,u=t.memoizedState,o.parent!==s?(o={parent:s,cache:s},t.memoizedState=o,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=o),xa(t,ct,s)):(s=u.cache,xa(t,ct,s),s!==o.cache&&Tc(t,[ct],a,!0))),kt(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(l(156,t.tag))}function na(e){e.flags|=4}function uu(e,t,a,s,o){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(o&335544128)===o)if(e.stateNode.complete)e.flags|=8192;else if(mm())e.flags|=8192;else throw di=Rl,xc}else e.flags&=-16777217}function Pf(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!ag(t))if(mm())e.flags|=8192;else throw di=Rl,xc}function Yl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?jr():536870912,e.lanes|=t,er|=t)}function us(e,t){if(!ke)switch(e.tailMode){case"hidden":t=e.tail;for(var a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var s=null;a!==null;)a.alternate!==null&&(s=a),a=a.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function Ie(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,s=0;if(t)for(var o=e.child;o!==null;)a|=o.lanes|o.childLanes,s|=o.subtreeFlags&65011712,s|=o.flags&65011712,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)a|=o.lanes|o.childLanes,s|=o.subtreeFlags,s|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=s,e.childLanes=a,t}function tv(e,t,a){var s=t.pendingProps;switch(vc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ie(t),null;case 1:return Ie(t),null;case 3:return a=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),Zn(ct),Xe(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&($i(t)?na(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Sc())),Ie(t),null;case 26:var o=t.type,u=t.memoizedState;return e===null?(na(t),u!==null?(Ie(t),Pf(t,u)):(Ie(t),uu(t,o,null,s,a))):u?u!==e.memoizedState?(na(t),Ie(t),Pf(t,u)):(Ie(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&na(t),Ie(t),uu(t,o,e,s,a)),null;case 27:if(mn(t),a=me.current,o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&na(t);else{if(!s){if(t.stateNode===null)throw Error(l(166));return Ie(t),null}e=Z.current,$i(t)?Sh(t):(e=Xm(o,s,a),t.stateNode=e,na(t))}return Ie(t),null;case 5:if(mn(t),o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&na(t);else{if(!s){if(t.stateNode===null)throw Error(l(166));return Ie(t),null}if(u=Z.current,$i(t))Sh(t);else{var f=oo(me.current);switch(u){case 1:u=f.createElementNS("http://www.w3.org/2000/svg",o);break;case 2:u=f.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;default:switch(o){case"svg":u=f.createElementNS("http://www.w3.org/2000/svg",o);break;case"math":u=f.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;case"script":u=f.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof s.is=="string"?f.createElement("select",{is:s.is}):f.createElement("select"),s.multiple?u.multiple=!0:s.size&&(u.size=s.size);break;default:u=typeof s.is=="string"?f.createElement(o,{is:s.is}):f.createElement(o)}}u[Ve]=t,u[wt]=s;e:for(f=t.child;f!==null;){if(f.tag===5||f.tag===6)u.appendChild(f.stateNode);else if(f.tag!==4&&f.tag!==27&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===t)break e;for(;f.sibling===null;){if(f.return===null||f.return===t)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}t.stateNode=u;e:switch(Et(u,o,s),o){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&na(t)}}return Ie(t),uu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&na(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(l(166));if(e=me.current,$i(t)){if(e=t.stateNode,a=t.memoizedProps,s=null,o=_t,o!==null)switch(o.tag){case 27:case 5:s=o.memoizedProps}e[Ve]=t,e=!!(e.nodeValue===a||s!==null&&s.suppressHydrationWarning===!0||Bm(e.nodeValue,a)),e||Aa(t,!0)}else e=oo(e).createTextNode(s),e[Ve]=t,t.stateNode=e}return Ie(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(s=$i(t),a!==null){if(e===null){if(!s)throw Error(l(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(557));e[Ve]=t}else si(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ie(t),e=!1}else a=Sc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(Qt(t),t):(Qt(t),null);if((t.flags&128)!==0)throw Error(l(558))}return Ie(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=$i(t),s!==null&&s.dehydrated!==null){if(e===null){if(!o)throw Error(l(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(l(317));o[Ve]=t}else si(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ie(t),o=!1}else o=Sc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(Qt(t),t):(Qt(t),null)}return Qt(t),(t.flags&128)!==0?(t.lanes=a,t):(a=s!==null,e=e!==null&&e.memoizedState!==null,a&&(s=t.child,o=null,s.alternate!==null&&s.alternate.memoizedState!==null&&s.alternate.memoizedState.cachePool!==null&&(o=s.alternate.memoizedState.cachePool.pool),u=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),u!==o&&(s.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),Yl(t,t.updateQueue),Ie(t),null);case 4:return Xe(),e===null&&Nu(t.stateNode.containerInfo),Ie(t),null;case 10:return Zn(t.type),Ie(t),null;case 19:if(M(at),s=t.memoizedState,s===null)return Ie(t),null;if(o=(t.flags&128)!==0,u=s.rendering,u===null)if(o)us(s,!1);else{if(Fe!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=Dl(e),u!==null){for(t.flags|=128,us(s,!1),e=u.updateQueue,t.updateQueue=e,Yl(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)gh(a,e),a=a.sibling;return J(at,at.current&1|2),ke&&Qn(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&Ot()>Zl&&(t.flags|=128,o=!0,us(s,!1),t.lanes=4194304)}else{if(!o)if(e=Dl(u),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,Yl(t,e),us(s,!0),s.tail===null&&s.tailMode==="hidden"&&!u.alternate&&!ke)return Ie(t),null}else 2*Ot()-s.renderingStartTime>Zl&&a!==536870912&&(t.flags|=128,o=!0,us(s,!1),t.lanes=4194304);s.isBackwards?(u.sibling=t.child,t.child=u):(e=s.last,e!==null?e.sibling=u:t.child=u,s.last=u)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Ot(),e.sibling=null,a=at.current,J(at,o?a&1|2:a&1),ke&&Qn(t,s.treeForkCount),e):(Ie(t),null);case 22:case 23:return Qt(t),Lc(),s=t.memoizedState!==null,e!==null?e.memoizedState!==null!==s&&(t.flags|=8192):s&&(t.flags|=8192),s?(a&536870912)!==0&&(t.flags&128)===0&&(Ie(t),t.subtreeFlags&6&&(t.flags|=8192)):Ie(t),a=t.updateQueue,a!==null&&Yl(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),s=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),s!==a&&(t.flags|=2048),e!==null&&M(ci),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Zn(ct),Ie(t),null;case 25:return null;case 30:return null}throw Error(l(156,t.tag))}function nv(e,t){switch(vc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Zn(ct),Xe(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return mn(t),null;case 31:if(t.memoizedState!==null){if(Qt(t),t.alternate===null)throw Error(l(340));si()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Qt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(l(340));si()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return M(at),null;case 4:return Xe(),null;case 10:return Zn(t.type),null;case 22:case 23:return Qt(t),Lc(),e!==null&&M(ci),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Zn(ct),null;case 25:return null;default:return null}}function If(e,t){switch(vc(t),t.tag){case 3:Zn(ct),Xe();break;case 26:case 27:case 5:mn(t);break;case 4:Xe();break;case 31:t.memoizedState!==null&&Qt(t);break;case 13:Qt(t);break;case 19:M(at);break;case 10:Zn(t.type);break;case 22:case 23:Qt(t),Lc(),e!==null&&M(ci);break;case 24:Zn(ct)}}function ds(e,t){try{var a=t.updateQueue,s=a!==null?a.lastEffect:null;if(s!==null){var o=s.next;a=o;do{if((a.tag&e)===e){s=void 0;var u=a.create,f=a.inst;s=u(),f.destroy=s}a=a.next}while(a!==o)}}catch(v){Ne(t,t.return,v)}}function La(e,t,a){try{var s=t.updateQueue,o=s!==null?s.lastEffect:null;if(o!==null){var u=o.next;s=u;do{if((s.tag&e)===e){var f=s.inst,v=f.destroy;if(v!==void 0){f.destroy=void 0,o=t;var _=a,R=v;try{R()}catch(z){Ne(o,_,z)}}}s=s.next}while(s!==u)}}catch(z){Ne(t,t.return,z)}}function Gf(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{Lh(t,a)}catch(s){Ne(e,e.return,s)}}}function Vf(e,t,a){a.props=mi(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(s){Ne(e,t,s)}}function hs(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var s=e.stateNode;break;case 30:s=e.stateNode;break;default:s=e.stateNode}typeof a=="function"?e.refCleanup=a(s):a.current=s}}catch(o){Ne(e,t,o)}}function Cn(e,t){var a=e.ref,s=e.refCleanup;if(a!==null)if(typeof s=="function")try{s()}catch(o){Ne(e,t,o)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(o){Ne(e,t,o)}else a.current=null}function Kf(e){var t=e.type,a=e.memoizedProps,s=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&s.focus();break e;case"img":a.src?s.src=a.src:a.srcSet&&(s.srcset=a.srcSet)}}catch(o){Ne(e,e.return,o)}}function du(e,t,a){try{var s=e.stateNode;kv(s,e.type,a,t),s[wt]=t}catch(o){Ne(e,e.return,o)}}function Yf(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&qa(e.type)||e.tag===4}function hu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Yf(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&&qa(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function fu(e,t,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=W));else if(s!==4&&(s===27&&qa(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(fu(e,t,a),e=e.sibling;e!==null;)fu(e,t,a),e=e.sibling}function Jl(e,t,a){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(s!==4&&(s===27&&qa(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Jl(e,t,a),e=e.sibling;e!==null;)Jl(e,t,a),e=e.sibling}function Jf(e){var t=e.stateNode,a=e.memoizedProps;try{for(var s=e.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);Et(t,s,a),t[Ve]=e,t[wt]=a}catch(u){Ne(e,e.return,u)}}var aa=!1,ht=!1,mu=!1,Xf=typeof WeakSet=="function"?WeakSet:Set,vt=null;function av(e,t){if(e=e.containerInfo,Uu=po,e=sh(e),lc(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var s=a.getSelection&&a.getSelection();if(s&&s.rangeCount!==0){a=s.anchorNode;var o=s.anchorOffset,u=s.focusNode;s=s.focusOffset;try{a.nodeType,u.nodeType}catch{a=null;break e}var f=0,v=-1,_=-1,R=0,z=0,H=e,j=null;t:for(;;){for(var L;H!==a||o!==0&&H.nodeType!==3||(v=f+o),H!==u||s!==0&&H.nodeType!==3||(_=f+s),H.nodeType===3&&(f+=H.nodeValue.length),(L=H.firstChild)!==null;)j=H,H=L;for(;;){if(H===e)break t;if(j===a&&++R===o&&(v=f),j===u&&++z===s&&(_=f),(L=H.nextSibling)!==null)break;H=j,j=H.parentNode}H=L}a=v===-1||_===-1?null:{start:v,end:_}}else a=null}a=a||{start:0,end:0}}else a=null;for(Mu={focusedElem:e,selectionRange:a},po=!1,vt=t;vt!==null;)if(t=vt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,vt=e;else for(;vt!==null;){switch(t=vt,u=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(a=0;a<e.length;a++)o=e[a],o.ref.impl=o.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,a=t,o=u.memoizedProps,u=u.memoizedState,s=a.stateNode;try{var F=mi(a.type,o);e=s.getSnapshotBeforeUpdate(F,u),s.__reactInternalSnapshotBeforeUpdate=e}catch(oe){Ne(a,a.return,oe)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)Hu(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Hu(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(l(163))}if(e=t.sibling,e!==null){e.return=t.return,vt=e;break}vt=t.return}}function Qf(e,t,a){var s=a.flags;switch(a.tag){case 0:case 11:case 15:ra(e,a),s&4&&ds(5,a);break;case 1:if(ra(e,a),s&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(f){Ne(a,a.return,f)}else{var o=mi(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(o,t,e.__reactInternalSnapshotBeforeUpdate)}catch(f){Ne(a,a.return,f)}}s&64&&Gf(a),s&512&&hs(a,a.return);break;case 3:if(ra(e,a),s&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{Lh(e,t)}catch(f){Ne(a,a.return,f)}}break;case 27:t===null&&s&4&&Jf(a);case 26:case 5:ra(e,a),t===null&&s&4&&Kf(a),s&512&&hs(a,a.return);break;case 12:ra(e,a);break;case 31:ra(e,a),s&4&&Ff(e,a);break;case 13:ra(e,a),s&4&&em(e,a),s&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=hv.bind(null,a),Nv(e,a))));break;case 22:if(s=a.memoizedState!==null||aa,!s){t=t!==null&&t.memoizedState!==null||ht,o=aa;var u=ht;aa=s,(ht=t)&&!u?sa(e,a,(a.subtreeFlags&8772)!==0):ra(e,a),aa=o,ht=u}break;case 30:break;default:ra(e,a)}}function Wf(e){var t=e.alternate;t!==null&&(e.alternate=null,Wf(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&zr(t)),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 Ye=null,Bt=!1;function ia(e,t,a){for(a=a.child;a!==null;)Zf(e,t,a),a=a.sibling}function Zf(e,t,a){if(St&&typeof St.onCommitFiberUnmount=="function")try{St.onCommitFiberUnmount(pa,a)}catch{}switch(a.tag){case 26:ht||Cn(a,t),ia(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:ht||Cn(a,t);var s=Ye,o=Bt;qa(a.type)&&(Ye=a.stateNode,Bt=!1),ia(e,t,a),ws(a.stateNode),Ye=s,Bt=o;break;case 5:ht||Cn(a,t);case 6:if(s=Ye,o=Bt,Ye=null,ia(e,t,a),Ye=s,Bt=o,Ye!==null)if(Bt)try{(Ye.nodeType===9?Ye.body:Ye.nodeName==="HTML"?Ye.ownerDocument.body:Ye).removeChild(a.stateNode)}catch(u){Ne(a,t,u)}else try{Ye.removeChild(a.stateNode)}catch(u){Ne(a,t,u)}break;case 18:Ye!==null&&(Bt?(e=Ye,Gm(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),or(e)):Gm(Ye,a.stateNode));break;case 4:s=Ye,o=Bt,Ye=a.stateNode.containerInfo,Bt=!0,ia(e,t,a),Ye=s,Bt=o;break;case 0:case 11:case 14:case 15:La(2,a,t),ht||La(4,a,t),ia(e,t,a);break;case 1:ht||(Cn(a,t),s=a.stateNode,typeof s.componentWillUnmount=="function"&&Vf(a,t,s)),ia(e,t,a);break;case 21:ia(e,t,a);break;case 22:ht=(s=ht)||a.memoizedState!==null,ia(e,t,a),ht=s;break;default:ia(e,t,a)}}function Ff(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{or(e)}catch(a){Ne(t,t.return,a)}}}function em(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{or(e)}catch(a){Ne(t,t.return,a)}}function iv(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Xf),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Xf),t;default:throw Error(l(435,e.tag))}}function Xl(e,t){var a=iv(e);t.forEach(function(s){if(!a.has(s)){a.add(s);var o=fv.bind(null,e,s);s.then(o,o)}})}function Ht(e,t){var a=t.deletions;if(a!==null)for(var s=0;s<a.length;s++){var o=a[s],u=e,f=t,v=f;e:for(;v!==null;){switch(v.tag){case 27:if(qa(v.type)){Ye=v.stateNode,Bt=!1;break e}break;case 5:Ye=v.stateNode,Bt=!1;break e;case 3:case 4:Ye=v.stateNode.containerInfo,Bt=!0;break e}v=v.return}if(Ye===null)throw Error(l(160));Zf(u,f,o),Ye=null,Bt=!1,u=o.alternate,u!==null&&(u.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)tm(t,e),t=t.sibling}var yn=null;function tm(e,t){var a=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ht(t,e),qt(e),s&4&&(La(3,e,e.return),ds(3,e),La(5,e,e.return));break;case 1:Ht(t,e),qt(e),s&512&&(ht||a===null||Cn(a,a.return)),s&64&&aa&&(e=e.updateQueue,e!==null&&(s=e.callbacks,s!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?s:a.concat(s))));break;case 26:var o=yn;if(Ht(t,e),qt(e),s&512&&(ht||a===null||Cn(a,a.return)),s&4){var u=a!==null?a.memoizedState:null;if(s=e.memoizedState,a===null)if(s===null)if(e.stateNode===null){e:{s=e.type,a=e.memoizedProps,o=o.ownerDocument||o;t:switch(s){case"title":u=o.getElementsByTagName("title")[0],(!u||u[Sa]||u[Ve]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=o.createElement(s),o.head.insertBefore(u,o.querySelector("head > title"))),Et(u,s,a),u[Ve]=e,qe(u),s=u;break e;case"link":var f=tg("link","href",o).get(s+(a.href||""));if(f){for(var v=0;v<f.length;v++)if(u=f[v],u.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&u.getAttribute("rel")===(a.rel==null?null:a.rel)&&u.getAttribute("title")===(a.title==null?null:a.title)&&u.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){f.splice(v,1);break t}}u=o.createElement(s),Et(u,s,a),o.head.appendChild(u);break;case"meta":if(f=tg("meta","content",o).get(s+(a.content||""))){for(v=0;v<f.length;v++)if(u=f[v],u.getAttribute("content")===(a.content==null?null:""+a.content)&&u.getAttribute("name")===(a.name==null?null:a.name)&&u.getAttribute("property")===(a.property==null?null:a.property)&&u.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&u.getAttribute("charset")===(a.charSet==null?null:a.charSet)){f.splice(v,1);break t}}u=o.createElement(s),Et(u,s,a),o.head.appendChild(u);break;default:throw Error(l(468,s))}u[Ve]=e,qe(u),s=u}e.stateNode=s}else ng(o,e.type,e.stateNode);else e.stateNode=eg(o,s,e.memoizedProps);else u!==s?(u===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):u.count--,s===null?ng(o,e.type,e.stateNode):eg(o,s,e.memoizedProps)):s===null&&e.stateNode!==null&&du(e,e.memoizedProps,a.memoizedProps)}break;case 27:Ht(t,e),qt(e),s&512&&(ht||a===null||Cn(a,a.return)),a!==null&&s&4&&du(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Ht(t,e),qt(e),s&512&&(ht||a===null||Cn(a,a.return)),e.flags&32){o=e.stateNode;try{_a(o,"")}catch(F){Ne(e,e.return,F)}}s&4&&e.stateNode!=null&&(o=e.memoizedProps,du(e,o,a!==null?a.memoizedProps:o)),s&1024&&(mu=!0);break;case 6:if(Ht(t,e),qt(e),s&4){if(e.stateNode===null)throw Error(l(162));s=e.memoizedProps,a=e.stateNode;try{a.nodeValue=s}catch(F){Ne(e,e.return,F)}}break;case 3:if(ho=null,o=yn,yn=co(t.containerInfo),Ht(t,e),yn=o,qt(e),s&4&&a!==null&&a.memoizedState.isDehydrated)try{or(t.containerInfo)}catch(F){Ne(e,e.return,F)}mu&&(mu=!1,nm(e));break;case 4:s=yn,yn=co(e.stateNode.containerInfo),Ht(t,e),qt(e),yn=s;break;case 12:Ht(t,e),qt(e);break;case 31:Ht(t,e),qt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Xl(e,s)));break;case 13:Ht(t,e),qt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Wl=Ot()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Xl(e,s)));break;case 22:o=e.memoizedState!==null;var _=a!==null&&a.memoizedState!==null,R=aa,z=ht;if(aa=R||o,ht=z||_,Ht(t,e),ht=z,aa=R,qt(e),s&8192)e:for(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,o&&(a===null||_||aa||ht||gi(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){_=a=t;try{if(u=_.stateNode,o)f=u.style,typeof f.setProperty=="function"?f.setProperty("display","none","important"):f.display="none";else{v=_.stateNode;var H=_.memoizedProps.style,j=H!=null&&H.hasOwnProperty("display")?H.display:null;v.style.display=j==null||typeof j=="boolean"?"":(""+j).trim()}}catch(F){Ne(_,_.return,F)}}}else if(t.tag===6){if(a===null){_=t;try{_.stateNode.nodeValue=o?"":_.memoizedProps}catch(F){Ne(_,_.return,F)}}}else if(t.tag===18){if(a===null){_=t;try{var L=_.stateNode;o?Vm(L,!0):Vm(_.stateNode,!1)}catch(F){Ne(_,_.return,F)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;a===t&&(a=null),t=t.return}a===t&&(a=null),t.sibling.return=t.return,t=t.sibling}s&4&&(s=e.updateQueue,s!==null&&(a=s.retryQueue,a!==null&&(s.retryQueue=null,Xl(e,a))));break;case 19:Ht(t,e),qt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,Xl(e,s)));break;case 30:break;case 21:break;default:Ht(t,e),qt(e)}}function qt(e){var t=e.flags;if(t&2){try{for(var a,s=e.return;s!==null;){if(Yf(s)){a=s;break}s=s.return}if(a==null)throw Error(l(160));switch(a.tag){case 27:var o=a.stateNode,u=hu(e);Jl(e,u,o);break;case 5:var f=a.stateNode;a.flags&32&&(_a(f,""),a.flags&=-33);var v=hu(e);Jl(e,v,f);break;case 3:case 4:var _=a.stateNode.containerInfo,R=hu(e);fu(e,R,_);break;default:throw Error(l(161))}}catch(z){Ne(e,e.return,z)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function nm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;nm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ra(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Qf(e,t.alternate,t),t=t.sibling}function gi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:La(4,t,t.return),gi(t);break;case 1:Cn(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&Vf(t,t.return,a),gi(t);break;case 27:ws(t.stateNode);case 26:case 5:Cn(t,t.return),gi(t);break;case 22:t.memoizedState===null&&gi(t);break;case 30:gi(t);break;default:gi(t)}e=e.sibling}}function sa(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var s=t.alternate,o=e,u=t,f=u.flags;switch(u.tag){case 0:case 11:case 15:sa(o,u,a),ds(4,u);break;case 1:if(sa(o,u,a),s=u,o=s.stateNode,typeof o.componentDidMount=="function")try{o.componentDidMount()}catch(R){Ne(s,s.return,R)}if(s=u,o=s.updateQueue,o!==null){var v=s.stateNode;try{var _=o.shared.hiddenCallbacks;if(_!==null)for(o.shared.hiddenCallbacks=null,o=0;o<_.length;o++)Nh(_[o],v)}catch(R){Ne(s,s.return,R)}}a&&f&64&&Gf(u),hs(u,u.return);break;case 27:Jf(u);case 26:case 5:sa(o,u,a),a&&s===null&&f&4&&Kf(u),hs(u,u.return);break;case 12:sa(o,u,a);break;case 31:sa(o,u,a),a&&f&4&&Ff(o,u);break;case 13:sa(o,u,a),a&&f&4&&em(o,u);break;case 22:u.memoizedState===null&&sa(o,u,a),hs(u,u.return);break;case 30:break;default:sa(o,u,a)}t=t.sibling}}function gu(e,t){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Zr(a))}function pu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Zr(e))}function vn(e,t,a,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)am(e,t,a,s),t=t.sibling}function am(e,t,a,s){var o=t.flags;switch(t.tag){case 0:case 11:case 15:vn(e,t,a,s),o&2048&&ds(9,t);break;case 1:vn(e,t,a,s);break;case 3:vn(e,t,a,s),o&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Zr(e)));break;case 12:if(o&2048){vn(e,t,a,s),e=t.stateNode;try{var u=t.memoizedProps,f=u.id,v=u.onPostCommit;typeof v=="function"&&v(f,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(_){Ne(t,t.return,_)}}else vn(e,t,a,s);break;case 31:vn(e,t,a,s);break;case 13:vn(e,t,a,s);break;case 23:break;case 22:u=t.stateNode,f=t.alternate,t.memoizedState!==null?u._visibility&2?vn(e,t,a,s):fs(e,t):u._visibility&2?vn(e,t,a,s):(u._visibility|=2,Wi(e,t,a,s,(t.subtreeFlags&10256)!==0||!1)),o&2048&&gu(f,t);break;case 24:vn(e,t,a,s),o&2048&&pu(t.alternate,t);break;default:vn(e,t,a,s)}}function Wi(e,t,a,s,o){for(o=o&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,f=t,v=a,_=s,R=f.flags;switch(f.tag){case 0:case 11:case 15:Wi(u,f,v,_,o),ds(8,f);break;case 23:break;case 22:var z=f.stateNode;f.memoizedState!==null?z._visibility&2?Wi(u,f,v,_,o):fs(u,f):(z._visibility|=2,Wi(u,f,v,_,o)),o&&R&2048&&gu(f.alternate,f);break;case 24:Wi(u,f,v,_,o),o&&R&2048&&pu(f.alternate,f);break;default:Wi(u,f,v,_,o)}t=t.sibling}}function fs(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,s=t,o=s.flags;switch(s.tag){case 22:fs(a,s),o&2048&&gu(s.alternate,s);break;case 24:fs(a,s),o&2048&&pu(s.alternate,s);break;default:fs(a,s)}t=t.sibling}}var ms=8192;function Zi(e,t,a){if(e.subtreeFlags&ms)for(e=e.child;e!==null;)im(e,t,a),e=e.sibling}function im(e,t,a){switch(e.tag){case 26:Zi(e,t,a),e.flags&ms&&e.memoizedState!==null&&Gv(a,yn,e.memoizedState,e.memoizedProps);break;case 5:Zi(e,t,a);break;case 3:case 4:var s=yn;yn=co(e.stateNode.containerInfo),Zi(e,t,a),yn=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=ms,ms=16777216,Zi(e,t,a),ms=s):Zi(e,t,a));break;default:Zi(e,t,a)}}function rm(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function gs(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var s=t[a];vt=s,lm(s,e)}rm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)sm(e),e=e.sibling}function sm(e){switch(e.tag){case 0:case 11:case 15:gs(e),e.flags&2048&&La(9,e,e.return);break;case 3:gs(e);break;case 12:gs(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ql(e)):gs(e);break;default:gs(e)}}function Ql(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var s=t[a];vt=s,lm(s,e)}rm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:La(8,t,t.return),Ql(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,Ql(t));break;default:Ql(t)}e=e.sibling}}function lm(e,t){for(;vt!==null;){var a=vt;switch(a.tag){case 0:case 11:case 15:La(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var s=a.memoizedState.cachePool.pool;s!=null&&s.refCount++}break;case 24:Zr(a.memoizedState.cache)}if(s=a.child,s!==null)s.return=a,vt=s;else e:for(a=e;vt!==null;){s=vt;var o=s.sibling,u=s.return;if(Wf(s),s===a){vt=null;break e}if(o!==null){o.return=u,vt=o;break e}vt=u}}}var rv={getCacheForType:function(e){var t=Tt(ct),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return Tt(ct).controller.signal}},sv=typeof WeakMap=="function"?WeakMap:Map,Re=0,Be=null,ve=null,_e=0,je=0,Wt=null,Da=!1,Fi=!1,yu=!1,la=0,Fe=0,Ua=0,pi=0,vu=0,Zt=0,er=0,ps=null,$t=null,bu=!1,Wl=0,om=0,Zl=1/0,Fl=null,Ma=null,gt=0,za=null,tr=null,oa=0,Su=0,wu=null,cm=null,ys=0,_u=null;function Ft(){return(Re&2)!==0&&_e!==0?_e&-_e:D.T!==null?Cu():Mr()}function um(){if(Zt===0)if((_e&536870912)===0||ke){var e=Xa;Xa<<=1,(Xa&3932160)===0&&(Xa=262144),Zt=e}else Zt=536870912;return e=Xt.current,e!==null&&(e.flags|=32),Zt}function Pt(e,t,a){(e===Be&&(je===2||je===9)||e.cancelPendingCommit!==null)&&(nr(e,0),Ba(e,_e,Zt,!1)),zn(e,a),((Re&2)===0||e!==Be)&&(e===Be&&((Re&2)===0&&(pi|=a),Fe===4&&Ba(e,_e,Zt,!1)),On(e))}function dm(e,t,a){if((Re&6)!==0)throw Error(l(327));var s=!a&&(t&127)===0&&(t&e.expiredLanes)===0||En(e,t),o=s?cv(e,t):ku(e,t,!0),u=s;do{if(o===0){Fi&&!s&&Ba(e,t,0,!1);break}else{if(a=e.current.alternate,u&&!lv(a)){o=ku(e,t,!1),u=!1;continue}if(o===2){if(u=t,e.errorRecoveryDisabledLanes&u)var f=0;else f=e.pendingLanes&-536870913,f=f!==0?f:f&536870912?536870912:0;if(f!==0){t=f;e:{var v=e;o=ps;var _=v.current.memoizedState.isDehydrated;if(_&&(nr(v,f).flags|=256),f=ku(v,f,!1),f!==2){if(yu&&!_){v.errorRecoveryDisabledLanes|=u,pi|=u,o=4;break e}u=$t,$t=o,u!==null&&($t===null?$t=u:$t.push.apply($t,u))}o=f}if(u=!1,o!==2)continue}}if(o===1){nr(e,0),Ba(e,t,0,!0);break}e:{switch(s=e,u=o,u){case 0:case 1:throw Error(l(345));case 4:if((t&4194048)!==t)break;case 6:Ba(s,t,Zt,!Da);break e;case 2:$t=null;break;case 3:case 5:break;default:throw Error(l(329))}if((t&62914560)===t&&(o=Wl+300-Ot(),10<o)){if(Ba(s,t,Zt,!Da),va(s,0,!0)!==0)break e;oa=t,s.timeoutHandle=Pm(hm.bind(null,s,a,$t,Fl,bu,t,Zt,pi,er,Da,u,"Throttled",-0,0),o);break e}hm(s,a,$t,Fl,bu,t,Zt,pi,er,Da,u,null,-0,0)}}break}while(!0);On(e)}function hm(e,t,a,s,o,u,f,v,_,R,z,H,j,L){if(e.timeoutHandle=-1,H=t.subtreeFlags,H&8192||(H&16785408)===16785408){H={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:W},im(t,u,H);var F=(u&62914560)===u?Wl-Ot():(u&4194048)===u?om-Ot():0;if(F=Vv(H,F),F!==null){oa=u,e.cancelPendingCommit=F(Sm.bind(null,e,t,u,a,s,o,f,v,_,z,H,null,j,L)),Ba(e,u,f,!R);return}}Sm(e,t,u,a,s,o,f,v,_)}function lv(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var s=0;s<a.length;s++){var o=a[s],u=o.getSnapshot;o=o.value;try{if(!Yt(u(),o))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ba(e,t,a,s){t&=~vu,t&=~pi,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var o=t;0<o;){var u=31-lt(o),f=1<<u;s[u]=-1,o&=~f}a!==0&&Lr(e,a,t)}function eo(){return(Re&6)===0?(vs(0),!1):!0}function Tu(){if(ve!==null){if(je===0)var e=ve.return;else e=ve,Wn=li=null,Hc(e),Ki=null,es=0,e=ve;for(;e!==null;)If(e.alternate,e),e=e.return;ve=null}}function nr(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,xv(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),oa=0,Tu(),Be=e,ve=a=Xn(e.current,null),_e=t,je=0,Wt=null,Da=!1,Fi=En(e,t),yu=!1,er=Zt=vu=pi=Ua=Fe=0,$t=ps=null,bu=!1,(t&8)!==0&&(t|=t&32);var s=e.entangledLanes;if(s!==0)for(e=e.entanglements,s&=t;0<s;){var o=31-lt(s),u=1<<o;t|=e[o],s&=~u}return la=t,wl(),a}function fm(e,t){ge=null,D.H=os,t===Vi||t===Ol?(t=Ch(),je=3):t===xc?(t=Ch(),je=4):je=t===tu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Wt=t,ve===null&&(Fe=1,Il(e,rn(t,e.current)))}function mm(){var e=Xt.current;return e===null?!0:(_e&4194048)===_e?cn===null:(_e&62914560)===_e||(_e&536870912)!==0?e===cn:!1}function gm(){var e=D.H;return D.H=os,e===null?os:e}function pm(){var e=D.A;return D.A=rv,e}function to(){Fe=4,Da||(_e&4194048)!==_e&&Xt.current!==null||(Fi=!0),(Ua&134217727)===0&&(pi&134217727)===0||Be===null||Ba(Be,_e,Zt,!1)}function ku(e,t,a){var s=Re;Re|=2;var o=gm(),u=pm();(Be!==e||_e!==t)&&(Fl=null,nr(e,t)),t=!1;var f=Fe;e:do try{if(je!==0&&ve!==null){var v=ve,_=Wt;switch(je){case 8:Tu(),f=6;break e;case 3:case 2:case 9:case 6:Xt.current===null&&(t=!0);var R=je;if(je=0,Wt=null,ar(e,v,_,R),a&&Fi){f=0;break e}break;default:R=je,je=0,Wt=null,ar(e,v,_,R)}}ov(),f=Fe;break}catch(z){fm(e,z)}while(!0);return t&&e.shellSuspendCounter++,Wn=li=null,Re=s,D.H=o,D.A=u,ve===null&&(Be=null,_e=0,wl()),f}function ov(){for(;ve!==null;)ym(ve)}function cv(e,t){var a=Re;Re|=2;var s=gm(),o=pm();Be!==e||_e!==t?(Fl=null,Zl=Ot()+500,nr(e,t)):Fi=En(e,t);e:do try{if(je!==0&&ve!==null){t=ve;var u=Wt;t:switch(je){case 1:je=0,Wt=null,ar(e,t,u,1);break;case 2:case 9:if(Ah(u)){je=0,Wt=null,vm(t);break}t=function(){je!==2&&je!==9||Be!==e||(je=7),On(e)},u.then(t,t);break e;case 3:je=7;break e;case 4:je=5;break e;case 7:Ah(u)?(je=0,Wt=null,vm(t)):(je=0,Wt=null,ar(e,t,u,7));break;case 5:var f=null;switch(ve.tag){case 26:f=ve.memoizedState;case 5:case 27:var v=ve;if(f?ag(f):v.stateNode.complete){je=0,Wt=null;var _=v.sibling;if(_!==null)ve=_;else{var R=v.return;R!==null?(ve=R,no(R)):ve=null}break t}}je=0,Wt=null,ar(e,t,u,5);break;case 6:je=0,Wt=null,ar(e,t,u,6);break;case 8:Tu(),Fe=6;break e;default:throw Error(l(462))}}uv();break}catch(z){fm(e,z)}while(!0);return Wn=li=null,D.H=s,D.A=o,Re=a,ve!==null?0:(Be=null,_e=0,wl(),Fe)}function uv(){for(;ve!==null&&!xi();)ym(ve)}function ym(e){var t=$f(e.alternate,e,la);e.memoizedProps=e.pendingProps,t===null?no(e):ve=t}function vm(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=Uf(a,t,t.pendingProps,t.type,void 0,_e);break;case 11:t=Uf(a,t,t.pendingProps,t.type.render,t.ref,_e);break;case 5:Hc(t);default:If(a,t),t=ve=gh(t,la),t=$f(a,t,la)}e.memoizedProps=e.pendingProps,t===null?no(e):ve=t}function ar(e,t,a,s){Wn=li=null,Hc(t),Ki=null,es=0;var o=t.return;try{if(Zy(e,o,t,a,_e)){Fe=1,Il(e,rn(a,e.current)),ve=null;return}}catch(u){if(o!==null)throw ve=o,u;Fe=1,Il(e,rn(a,e.current)),ve=null;return}t.flags&32768?(ke||s===1?e=!0:Fi||(_e&536870912)!==0?e=!1:(Da=e=!0,(s===2||s===9||s===3||s===6)&&(s=Xt.current,s!==null&&s.tag===13&&(s.flags|=16384))),bm(t,e)):no(t)}function no(e){var t=e;do{if((t.flags&32768)!==0){bm(t,Da);return}e=t.return;var a=tv(t.alternate,t,la);if(a!==null){ve=a;return}if(t=t.sibling,t!==null){ve=t;return}ve=t=e}while(t!==null);Fe===0&&(Fe=5)}function bm(e,t){do{var a=nv(e.alternate,e);if(a!==null){a.flags&=32767,ve=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){ve=e;return}ve=e=a}while(e!==null);Fe=6,ve=null}function Sm(e,t,a,s,o,u,f,v,_){e.cancelPendingCommit=null;do ao();while(gt!==0);if((Re&6)!==0)throw Error(l(327));if(t!==null){if(t===e.current)throw Error(l(177));if(u=t.lanes|t.childLanes,u|=hc,Qo(e,a,u,f,v,_),e===Be&&(ve=Be=null,_e=0),tr=t,za=e,oa=a,Su=u,wu=o,cm=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,mv(Ja,function(){return Em(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=D.T,D.T=null,o=K.p,K.p=2,f=Re,Re|=4;try{av(e,t,a)}finally{Re=f,K.p=o,D.T=s}}gt=1,wm(),_m(),Tm()}}function wm(){if(gt===1){gt=0;var e=za,t=tr,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=D.T,D.T=null;var s=K.p;K.p=2;var o=Re;Re|=4;try{tm(t,e);var u=Mu,f=sh(e.containerInfo),v=u.focusedElem,_=u.selectionRange;if(f!==v&&v&&v.ownerDocument&&rh(v.ownerDocument.documentElement,v)){if(_!==null&&lc(v)){var R=_.start,z=_.end;if(z===void 0&&(z=R),"selectionStart"in v)v.selectionStart=R,v.selectionEnd=Math.min(z,v.value.length);else{var H=v.ownerDocument||document,j=H&&H.defaultView||window;if(j.getSelection){var L=j.getSelection(),F=v.textContent.length,oe=Math.min(_.start,F),Me=_.end===void 0?oe:Math.min(_.end,F);!L.extend&&oe>Me&&(f=Me,Me=oe,oe=f);var x=ih(v,oe),k=ih(v,Me);if(x&&k&&(L.rangeCount!==1||L.anchorNode!==x.node||L.anchorOffset!==x.offset||L.focusNode!==k.node||L.focusOffset!==k.offset)){var O=H.createRange();O.setStart(x.node,x.offset),L.removeAllRanges(),oe>Me?(L.addRange(O),L.extend(k.node,k.offset)):(O.setEnd(k.node,k.offset),L.addRange(O))}}}}for(H=[],L=v;L=L.parentNode;)L.nodeType===1&&H.push({element:L,left:L.scrollLeft,top:L.scrollTop});for(typeof v.focus=="function"&&v.focus(),v=0;v<H.length;v++){var B=H[v];B.element.scrollLeft=B.left,B.element.scrollTop=B.top}}po=!!Uu,Mu=Uu=null}finally{Re=o,K.p=s,D.T=a}}e.current=t,gt=2}}function _m(){if(gt===2){gt=0;var e=za,t=tr,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=D.T,D.T=null;var s=K.p;K.p=2;var o=Re;Re|=4;try{Qf(e,t.alternate,t)}finally{Re=o,K.p=s,D.T=a}}gt=3}}function Tm(){if(gt===4||gt===3){gt=0,Mn();var e=za,t=tr,a=oa,s=cm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?gt=5:(gt=0,tr=za=null,km(e,e.pendingLanes));var o=e.pendingLanes;if(o===0&&(Ma=null),Qa(a),t=t.stateNode,St&&typeof St.onCommitFiberRoot=="function")try{St.onCommitFiberRoot(pa,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=D.T,o=K.p,K.p=2,D.T=null;try{for(var u=e.onRecoverableError,f=0;f<s.length;f++){var v=s[f];u(v.value,{componentStack:v.stack})}}finally{D.T=t,K.p=o}}(oa&3)!==0&&ao(),On(e),o=e.pendingLanes,(a&261930)!==0&&(o&42)!==0?e===_u?ys++:(ys=0,_u=e):ys=0,vs(0)}}function km(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Zr(t)))}function ao(){return wm(),_m(),Tm(),Em()}function Em(){if(gt!==5)return!1;var e=za,t=Su;Su=0;var a=Qa(oa),s=D.T,o=K.p;try{K.p=32>a?32:a,D.T=null,a=wu,wu=null;var u=za,f=oa;if(gt=0,tr=za=null,oa=0,(Re&6)!==0)throw Error(l(331));var v=Re;if(Re|=4,sm(u.current),am(u,u.current,f,a),Re=v,vs(0,!1),St&&typeof St.onPostCommitFiberRoot=="function")try{St.onPostCommitFiberRoot(pa,u)}catch{}return!0}finally{K.p=o,D.T=s,km(e,t)}}function Am(e,t,a){t=rn(a,t),t=eu(e.stateNode,t,2),e=Ra(e,t,2),e!==null&&(zn(e,2),On(e))}function Ne(e,t,a){if(e.tag===3)Am(e,e,a);else for(;t!==null;){if(t.tag===3){Am(t,e,a);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Ma===null||!Ma.has(s))){e=rn(a,e),a=xf(2),s=Ra(t,a,2),s!==null&&(Cf(a,s,t,e),zn(s,2),On(s));break}}t=t.return}}function Eu(e,t,a){var s=e.pingCache;if(s===null){s=e.pingCache=new sv;var o=new Set;s.set(t,o)}else o=s.get(t),o===void 0&&(o=new Set,s.set(t,o));o.has(a)||(yu=!0,o.add(a),e=dv.bind(null,e,t,a),t.then(e,e))}function dv(e,t,a){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Be===e&&(_e&a)===a&&(Fe===4||Fe===3&&(_e&62914560)===_e&&300>Ot()-Wl?(Re&2)===0&&nr(e,0):vu|=a,er===_e&&(er=0)),On(e)}function xm(e,t){t===0&&(t=jr()),e=ii(e,t),e!==null&&(zn(e,t),On(e))}function hv(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),xm(e,a)}function fv(e,t){var a=0;switch(e.tag){case 31:case 13:var s=e.stateNode,o=e.memoizedState;o!==null&&(a=o.retryLane);break;case 19:s=e.stateNode;break;case 22:s=e.stateNode._retryCache;break;default:throw Error(l(314))}s!==null&&s.delete(t),xm(e,a)}function mv(e,t){return Un(e,t)}var io=null,ir=null,Au=!1,ro=!1,xu=!1,Ha=0;function On(e){e!==ir&&e.next===null&&(ir===null?io=ir=e:ir=ir.next=e),ro=!0,Au||(Au=!0,pv())}function vs(e,t){if(!xu&&ro){xu=!0;do for(var a=!1,s=io;s!==null;){if(e!==0){var o=s.pendingLanes;if(o===0)var u=0;else{var f=s.suspendedLanes,v=s.pingedLanes;u=(1<<31-lt(42|e)+1)-1,u&=o&~(f&~v),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(a=!0,jm(s,u))}else u=_e,u=va(s,s===Be?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(u&3)===0||En(s,u)||(a=!0,jm(s,u));s=s.next}while(a);xu=!1}}function gv(){Cm()}function Cm(){ro=Au=!1;var e=0;Ha!==0&&Av()&&(e=Ha);for(var t=Ot(),a=null,s=io;s!==null;){var o=s.next,u=Om(s,t);u===0?(s.next=null,a===null?io=o:a.next=o,o===null&&(ir=a)):(a=s,(e!==0||(u&3)!==0)&&(ro=!0)),s=o}gt!==0&&gt!==5||vs(e),Ha!==0&&(Ha=0)}function Om(e,t){for(var a=e.suspendedLanes,s=e.pingedLanes,o=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var f=31-lt(u),v=1<<f,_=o[f];_===-1?((v&a)===0||(v&s)!==0)&&(o[f]=nl(v,t)):_<=t&&(e.expiredLanes|=v),u&=~v}if(t=Be,a=_e,a=va(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,a===0||e===t&&(je===2||je===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&Ai(s),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||En(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(s!==null&&Ai(s),Qa(a)){case 2:case 8:a=Ci;break;case 32:a=Ja;break;case 268435456:a=tl;break;default:a=Ja}return s=Rm.bind(null,e),a=Un(a,s),e.callbackPriority=t,e.callbackNode=a,t}return s!==null&&s!==null&&Ai(s),e.callbackPriority=2,e.callbackNode=null,2}function Rm(e,t){if(gt!==0&&gt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(ao()&&e.callbackNode!==a)return null;var s=_e;return s=va(e,e===Be?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(dm(e,s,t),Om(e,Ot()),e.callbackNode!=null&&e.callbackNode===a?Rm.bind(null,e):null)}function jm(e,t){if(ao())return null;dm(e,t,!0)}function pv(){Cv(function(){(Re&6)!==0?Un(Rr,gv):Cm()})}function Cu(){if(Ha===0){var e=Ii;e===0&&(e=ya,ya<<=1,(ya&261888)===0&&(ya=256)),Ha=e}return Ha}function Nm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ie(""+e)}function Lm(e,t){var a=t.ownerDocument.createElement("input");return a.name=t.name,a.value=t.value,e.id&&a.setAttribute("form",e.id),t.parentNode.insertBefore(a,t),e=new FormData(e),a.parentNode.removeChild(a),e}function yv(e,t,a,s,o){if(t==="submit"&&a&&a.stateNode===o){var u=Nm((o[wt]||null).action),f=s.submitter;f&&(t=(t=f[wt]||null)?Nm(t.formAction):f.getAttribute("formAction"),t!==null&&(u=t,f=null));var v=new yl("action","action",null,s,o);e.push({event:v,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Ha!==0){var _=f?Lm(o,f):new FormData(o);Jc(a,{pending:!0,data:_,method:o.method,action:u},null,_)}}else typeof u=="function"&&(v.preventDefault(),_=f?Lm(o,f):new FormData(o),Jc(a,{pending:!0,data:_,method:o.method,action:u},u,_))},currentTarget:o}]})}}for(var Ou=0;Ou<dc.length;Ou++){var Ru=dc[Ou],vv=Ru.toLowerCase(),bv=Ru[0].toUpperCase()+Ru.slice(1);pn(vv,"on"+bv)}pn(ch,"onAnimationEnd"),pn(uh,"onAnimationIteration"),pn(dh,"onAnimationStart"),pn("dblclick","onDoubleClick"),pn("focusin","onFocus"),pn("focusout","onBlur"),pn(Uy,"onTransitionRun"),pn(My,"onTransitionStart"),pn(zy,"onTransitionCancel"),pn(hh,"onTransitionEnd"),In("onMouseEnter",["mouseout","mouseover"]),In("onMouseLeave",["mouseout","mouseover"]),In("onPointerEnter",["pointerout","pointerover"]),In("onPointerLeave",["pointerout","pointerover"]),Pn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Pn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Pn("onBeforeInput",["compositionend","keypress","textInput","paste"]),Pn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Pn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Pn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var bs="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(" "),Sv=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(bs));function Dm(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var s=e[a],o=s.event;s=s.listeners;e:{var u=void 0;if(t)for(var f=s.length-1;0<=f;f--){var v=s[f],_=v.instance,R=v.currentTarget;if(v=v.listener,_!==u&&o.isPropagationStopped())break e;u=v,o.currentTarget=R;try{u(o)}catch(z){Sl(z)}o.currentTarget=null,u=_}else for(f=0;f<s.length;f++){if(v=s[f],_=v.instance,R=v.currentTarget,v=v.listener,_!==u&&o.isPropagationStopped())break e;u=v,o.currentTarget=R;try{u(o)}catch(z){Sl(z)}o.currentTarget=null,u=_}}}}function be(e,t){var a=t[Hn];a===void 0&&(a=t[Hn]=new Set);var s=e+"__bubble";a.has(s)||(Um(t,e,2,!1),a.add(s))}function ju(e,t,a){var s=0;t&&(s|=4),Um(a,e,s,t)}var so="_reactListening"+Math.random().toString(36).slice(2);function Nu(e){if(!e[so]){e[so]=!0,Br.forEach(function(a){a!=="selectionchange"&&(Sv.has(a)||ju(a,!1,e),ju(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[so]||(t[so]=!0,ju("selectionchange",!1,t))}}function Um(e,t,a,s){switch(ug(t)){case 2:var o=Jv;break;case 8:o=Xv;break;default:o=Yu}a=o.bind(null,t,a,e),o=void 0,!Li||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),s?o!==void 0?e.addEventListener(t,a,{capture:!0,passive:o}):e.addEventListener(t,a,!0):o!==void 0?e.addEventListener(t,a,{passive:o}):e.addEventListener(t,a,!1)}function Lu(e,t,a,s,o){var u=s;if((t&1)===0&&(t&2)===0&&s!==null)e:for(;;){if(s===null)return;var f=s.tag;if(f===3||f===4){var v=s.stateNode.containerInfo;if(v===o)break;if(f===4)for(f=s.return;f!==null;){var _=f.tag;if((_===3||_===4)&&f.stateNode.containerInfo===o)return;f=f.return}for(;v!==null;){if(f=qn(v),f===null)return;if(_=f.tag,_===5||_===6||_===26||_===27){s=u=f;continue e}v=v.parentNode}}s=s.return}fl(function(){var R=u,z=ce(a),H=[];e:{var j=fh.get(e);if(j!==void 0){var L=yl,F=e;switch(e){case"keypress":if(gl(a)===0)break e;case"keydown":case"keyup":L=fy;break;case"focusin":F="focus",L=nc;break;case"focusout":F="blur",L=nc;break;case"beforeblur":case"afterblur":L=nc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":L=Pd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":L=ty;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":L=py;break;case ch:case uh:case dh:L=iy;break;case hh:L=vy;break;case"scroll":case"scrollend":L=Fp;break;case"wheel":L=Sy;break;case"copy":case"cut":case"paste":L=sy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":L=Gd;break;case"toggle":case"beforetoggle":L=_y}var oe=(t&4)!==0,Me=!oe&&(e==="scroll"||e==="scrollend"),x=oe?j!==null?j+"Capture":null:j;oe=[];for(var k=R,O;k!==null;){var B=k;if(O=B.stateNode,B=B.tag,B!==5&&B!==26&&B!==27||O===null||x===null||(B=ei(k,x),B!=null&&oe.push(Ss(k,B,O))),Me)break;k=k.return}0<oe.length&&(j=new L(j,F,null,a,z),H.push({event:j,listeners:oe}))}}if((t&7)===0){e:{if(j=e==="mouseover"||e==="pointerover",L=e==="mouseout"||e==="pointerout",j&&a!==fe&&(F=a.relatedTarget||a.fromElement)&&(qn(F)||F[Bn]))break e;if((L||j)&&(j=z.window===z?z:(j=z.ownerDocument)?j.defaultView||j.parentWindow:window,L?(F=a.relatedTarget||a.toElement,L=R,F=F?qn(F):null,F!==null&&(Me=d(F),oe=F.tag,F!==Me||oe!==5&&oe!==27&&oe!==6)&&(F=null)):(L=null,F=R),L!==F)){if(oe=Pd,B="onMouseLeave",x="onMouseEnter",k="mouse",(e==="pointerout"||e==="pointerover")&&(oe=Gd,B="onPointerLeave",x="onPointerEnter",k="pointer"),Me=L==null?j:Wa(L),O=F==null?j:Wa(F),j=new oe(B,k+"leave",L,a,z),j.target=Me,j.relatedTarget=O,B=null,qn(z)===R&&(oe=new oe(x,k+"enter",F,a,z),oe.target=O,oe.relatedTarget=Me,B=oe),Me=B,L&&F)t:{for(oe=wv,x=L,k=F,O=0,B=x;B;B=oe(B))O++;B=0;for(var re=k;re;re=oe(re))B++;for(;0<O-B;)x=oe(x),O--;for(;0<B-O;)k=oe(k),B--;for(;O--;){if(x===k||k!==null&&x===k.alternate){oe=x;break t}x=oe(x),k=oe(k)}oe=null}else oe=null;L!==null&&Mm(H,j,L,oe,!1),F!==null&&Me!==null&&Mm(H,Me,F,oe,!0)}}e:{if(j=R?Wa(R):window,L=j.nodeName&&j.nodeName.toLowerCase(),L==="select"||L==="input"&&j.type==="file")var Ce=Zd;else if(Qd(j))if(Fd)Ce=Ny;else{Ce=Ry;var ne=Oy}else L=j.nodeName,!L||L.toLowerCase()!=="input"||j.type!=="checkbox"&&j.type!=="radio"?R&&Pr(R.elementType)&&(Ce=Zd):Ce=jy;if(Ce&&(Ce=Ce(e,R))){Wd(H,Ce,a,z);break e}ne&&ne(e,j,R),e==="focusout"&&R&&j.type==="number"&&R.memoizedProps.value!=null&&Vn(j,"number",j.value)}switch(ne=R?Wa(R):window,e){case"focusin":(Qd(ne)||ne.contentEditable==="true")&&(Ui=ne,oc=R,Xr=null);break;case"focusout":Xr=oc=Ui=null;break;case"mousedown":cc=!0;break;case"contextmenu":case"mouseup":case"dragend":cc=!1,lh(H,a,z);break;case"selectionchange":if(Dy)break;case"keydown":case"keyup":lh(H,a,z)}var pe;if(ic)e:{switch(e){case"compositionstart":var Te="onCompositionStart";break e;case"compositionend":Te="onCompositionEnd";break e;case"compositionupdate":Te="onCompositionUpdate";break e}Te=void 0}else Di?Jd(e,a)&&(Te="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Te="onCompositionStart");Te&&(Vd&&a.locale!=="ko"&&(Di||Te!=="onCompositionStart"?Te==="onCompositionEnd"&&Di&&(pe=qd()):(Ta=z,Fo="value"in Ta?Ta.value:Ta.textContent,Di=!0)),ne=lo(R,Te),0<ne.length&&(Te=new Id(Te,e,null,a,z),H.push({event:Te,listeners:ne}),pe?Te.data=pe:(pe=Xd(a),pe!==null&&(Te.data=pe)))),(pe=ky?Ey(e,a):Ay(e,a))&&(Te=lo(R,"onBeforeInput"),0<Te.length&&(ne=new Id("onBeforeInput","beforeinput",null,a,z),H.push({event:ne,listeners:Te}),ne.data=pe)),yv(H,e,R,a,z)}Dm(H,t)})}function Ss(e,t,a){return{instance:e,listener:t,currentTarget:a}}function lo(e,t){for(var a=t+"Capture",s=[];e!==null;){var o=e,u=o.stateNode;if(o=o.tag,o!==5&&o!==26&&o!==27||u===null||(o=ei(e,a),o!=null&&s.unshift(Ss(e,o,u)),o=ei(e,t),o!=null&&s.push(Ss(e,o,u))),e.tag===3)return s;e=e.return}return[]}function wv(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Mm(e,t,a,s,o){for(var u=t._reactName,f=[];a!==null&&a!==s;){var v=a,_=v.alternate,R=v.stateNode;if(v=v.tag,_!==null&&_===s)break;v!==5&&v!==26&&v!==27||R===null||(_=R,o?(R=ei(a,u),R!=null&&f.unshift(Ss(a,R,_))):o||(R=ei(a,u),R!=null&&f.push(Ss(a,R,_)))),a=a.return}f.length!==0&&e.push({event:t,listeners:f})}var _v=/\r\n?/g,Tv=/\u0000|\uFFFD/g;function zm(e){return(typeof e=="string"?e:""+e).replace(_v,`
9
+ `).replace(Tv,"")}function Bm(e,t){return t=zm(t),zm(e)===t}function Ue(e,t,a,s,o,u){switch(a){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||_a(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&_a(e,""+s);break;case"className":Gn(e,"class",s);break;case"tabIndex":Gn(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":Gn(e,a,s);break;case"style":hl(e,s,u);break;case"data":if(t!=="object"){Gn(e,"data",s);break}case"src":case"href":if(s===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(s==null||typeof s=="function"||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(a);break}s=ie(""+s),e.setAttribute(a,s);break;case"action":case"formAction":if(typeof s=="function"){e.setAttribute(a,"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 u=="function"&&(a==="formAction"?(t!=="input"&&Ue(e,t,"name",o.name,o,null),Ue(e,t,"formEncType",o.formEncType,o,null),Ue(e,t,"formMethod",o.formMethod,o,null),Ue(e,t,"formTarget",o.formTarget,o,null)):(Ue(e,t,"encType",o.encType,o,null),Ue(e,t,"method",o.method,o,null),Ue(e,t,"target",o.target,o,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(a);break}s=ie(""+s),e.setAttribute(a,s);break;case"onClick":s!=null&&(e.onclick=W);break;case"onScroll":s!=null&&be("scroll",e);break;case"onScrollEnd":s!=null&&be("scrollend",e);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(l(61));if(a=s.__html,a!=null){if(o.children!=null)throw Error(l(60));e.innerHTML=a}}break;case"multiple":e.multiple=s&&typeof s!="function"&&typeof s!="symbol";break;case"muted":e.muted=s&&typeof s!="function"&&typeof s!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(s==null||typeof s=="function"||typeof s=="boolean"||typeof s=="symbol"){e.removeAttribute("xlink:href");break}a=ie(""+s),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,""+s):e.removeAttribute(a);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":s&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":s===!0?e.setAttribute(a,""):s!==!1&&s!=null&&typeof s!="function"&&typeof s!="symbol"?e.setAttribute(a,s):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":s!=null&&typeof s!="function"&&typeof s!="symbol"&&!isNaN(s)&&1<=s?e.setAttribute(a,s):e.removeAttribute(a);break;case"rowSpan":case"start":s==null||typeof s=="function"||typeof s=="symbol"||isNaN(s)?e.removeAttribute(a):e.setAttribute(a,s);break;case"popover":be("beforetoggle",e),be("toggle",e),Ri(e,"popover",s);break;case"xlinkActuate":gn(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":gn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":gn(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":gn(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":gn(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":gn(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":gn(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":gn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":gn(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":Ri(e,"is",s);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=w.get(a)||a,Ri(e,a,s))}}function Du(e,t,a,s,o,u){switch(a){case"style":hl(e,s,u);break;case"dangerouslySetInnerHTML":if(s!=null){if(typeof s!="object"||!("__html"in s))throw Error(l(61));if(a=s.__html,a!=null){if(o.children!=null)throw Error(l(60));e.innerHTML=a}}break;case"children":typeof s=="string"?_a(e,s):(typeof s=="number"||typeof s=="bigint")&&_a(e,""+s);break;case"onScroll":s!=null&&be("scroll",e);break;case"onScrollEnd":s!=null&&be("scrollend",e);break;case"onClick":s!=null&&(e.onclick=W);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!sl.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(o=a.endsWith("Capture"),t=a.slice(2,o?a.length-7:void 0),u=e[wt]||null,u=u!=null?u[a]:null,typeof u=="function"&&e.removeEventListener(t,u,o),typeof s=="function")){typeof u!="function"&&u!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,s,o);break e}a in e?e[a]=s:s===!0?e.setAttribute(a,""):Ri(e,a,s)}}}function Et(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":be("error",e),be("load",e);var s=!1,o=!1,u;for(u in a)if(a.hasOwnProperty(u)){var f=a[u];if(f!=null)switch(u){case"src":s=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:Ue(e,t,u,f,a,null)}}o&&Ue(e,t,"srcSet",a.srcSet,a,null),s&&Ue(e,t,"src",a.src,a,null);return;case"input":be("invalid",e);var v=u=f=o=null,_=null,R=null;for(s in a)if(a.hasOwnProperty(s)){var z=a[s];if(z!=null)switch(s){case"name":o=z;break;case"type":f=z;break;case"checked":_=z;break;case"defaultChecked":R=z;break;case"value":u=z;break;case"defaultValue":v=z;break;case"children":case"dangerouslySetInnerHTML":if(z!=null)throw Error(l(137,t));break;default:Ue(e,t,s,z,a,null)}}Fa(e,u,v,_,R,f,o,!1);return;case"select":be("invalid",e),s=f=u=null;for(o in a)if(a.hasOwnProperty(o)&&(v=a[o],v!=null))switch(o){case"value":u=v;break;case"defaultValue":f=v;break;case"multiple":s=v;default:Ue(e,t,o,v,a,null)}t=u,a=f,e.multiple=!!s,t!=null?Kn(e,!!s,t,!1):a!=null&&Kn(e,!!s,a,!0);return;case"textarea":be("invalid",e),u=o=s=null;for(f in a)if(a.hasOwnProperty(f)&&(v=a[f],v!=null))switch(f){case"value":s=v;break;case"defaultValue":o=v;break;case"children":u=v;break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(l(91));break;default:Ue(e,t,f,v,a,null)}dl(e,s,o,u);return;case"option":for(_ in a)a.hasOwnProperty(_)&&(s=a[_],s!=null)&&(_==="selected"?e.selected=s&&typeof s!="function"&&typeof s!="symbol":Ue(e,t,_,s,a,null));return;case"dialog":be("beforetoggle",e),be("toggle",e),be("cancel",e),be("close",e);break;case"iframe":case"object":be("load",e);break;case"video":case"audio":for(s=0;s<bs.length;s++)be(bs[s],e);break;case"image":be("error",e),be("load",e);break;case"details":be("toggle",e);break;case"embed":case"source":case"link":be("error",e),be("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(R in a)if(a.hasOwnProperty(R)&&(s=a[R],s!=null))switch(R){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:Ue(e,t,R,s,a,null)}return;default:if(Pr(t)){for(z in a)a.hasOwnProperty(z)&&(s=a[z],s!==void 0&&Du(e,t,z,s,a,void 0));return}}for(v in a)a.hasOwnProperty(v)&&(s=a[v],s!=null&&Ue(e,t,v,s,a,null))}function kv(e,t,a,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var o=null,u=null,f=null,v=null,_=null,R=null,z=null;for(L in a){var H=a[L];if(a.hasOwnProperty(L)&&H!=null)switch(L){case"checked":break;case"value":break;case"defaultValue":_=H;default:s.hasOwnProperty(L)||Ue(e,t,L,null,s,H)}}for(var j in s){var L=s[j];if(H=a[j],s.hasOwnProperty(j)&&(L!=null||H!=null))switch(j){case"type":u=L;break;case"name":o=L;break;case"checked":R=L;break;case"defaultChecked":z=L;break;case"value":f=L;break;case"defaultValue":v=L;break;case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(l(137,t));break;default:L!==H&&Ue(e,t,j,L,s,H)}}Ni(e,f,v,_,R,z,u,o);return;case"select":L=f=v=j=null;for(u in a)if(_=a[u],a.hasOwnProperty(u)&&_!=null)switch(u){case"value":break;case"multiple":L=_;default:s.hasOwnProperty(u)||Ue(e,t,u,null,s,_)}for(o in s)if(u=s[o],_=a[o],s.hasOwnProperty(o)&&(u!=null||_!=null))switch(o){case"value":j=u;break;case"defaultValue":v=u;break;case"multiple":f=u;default:u!==_&&Ue(e,t,o,u,s,_)}t=v,a=f,s=L,j!=null?Kn(e,!!a,j,!1):!!s!=!!a&&(t!=null?Kn(e,!!a,t,!0):Kn(e,!!a,a?[]:"",!1));return;case"textarea":L=j=null;for(v in a)if(o=a[v],a.hasOwnProperty(v)&&o!=null&&!s.hasOwnProperty(v))switch(v){case"value":break;case"children":break;default:Ue(e,t,v,null,s,o)}for(f in s)if(o=s[f],u=a[f],s.hasOwnProperty(f)&&(o!=null||u!=null))switch(f){case"value":j=o;break;case"defaultValue":L=o;break;case"children":break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(l(91));break;default:o!==u&&Ue(e,t,f,o,s,u)}ul(e,j,L);return;case"option":for(var F in a)j=a[F],a.hasOwnProperty(F)&&j!=null&&!s.hasOwnProperty(F)&&(F==="selected"?e.selected=!1:Ue(e,t,F,null,s,j));for(_ in s)j=s[_],L=a[_],s.hasOwnProperty(_)&&j!==L&&(j!=null||L!=null)&&(_==="selected"?e.selected=j&&typeof j!="function"&&typeof j!="symbol":Ue(e,t,_,j,s,L));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 oe in a)j=a[oe],a.hasOwnProperty(oe)&&j!=null&&!s.hasOwnProperty(oe)&&Ue(e,t,oe,null,s,j);for(R in s)if(j=s[R],L=a[R],s.hasOwnProperty(R)&&j!==L&&(j!=null||L!=null))switch(R){case"children":case"dangerouslySetInnerHTML":if(j!=null)throw Error(l(137,t));break;default:Ue(e,t,R,j,s,L)}return;default:if(Pr(t)){for(var Me in a)j=a[Me],a.hasOwnProperty(Me)&&j!==void 0&&!s.hasOwnProperty(Me)&&Du(e,t,Me,void 0,s,j);for(z in s)j=s[z],L=a[z],!s.hasOwnProperty(z)||j===L||j===void 0&&L===void 0||Du(e,t,z,j,s,L);return}}for(var x in a)j=a[x],a.hasOwnProperty(x)&&j!=null&&!s.hasOwnProperty(x)&&Ue(e,t,x,null,s,j);for(H in s)j=s[H],L=a[H],!s.hasOwnProperty(H)||j===L||j==null&&L==null||Ue(e,t,H,j,s,L)}function Hm(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Ev(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),s=0;s<a.length;s++){var o=a[s],u=o.transferSize,f=o.initiatorType,v=o.duration;if(u&&v&&Hm(f)){for(f=0,v=o.responseEnd,s+=1;s<a.length;s++){var _=a[s],R=_.startTime;if(R>v)break;var z=_.transferSize,H=_.initiatorType;z&&Hm(H)&&(_=_.responseEnd,f+=z*(_<v?1:(v-R)/(_-R)))}if(--s,t+=8*(u+f)/(o.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Uu=null,Mu=null;function oo(e){return e.nodeType===9?e:e.ownerDocument}function qm(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 $m(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function zu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Bu=null;function Av(){var e=window.event;return e&&e.type==="popstate"?e===Bu?!1:(Bu=e,!0):(Bu=null,!1)}var Pm=typeof setTimeout=="function"?setTimeout:void 0,xv=typeof clearTimeout=="function"?clearTimeout:void 0,Im=typeof Promise=="function"?Promise:void 0,Cv=typeof queueMicrotask=="function"?queueMicrotask:typeof Im<"u"?function(e){return Im.resolve(null).then(e).catch(Ov)}:Pm;function Ov(e){setTimeout(function(){throw e})}function qa(e){return e==="head"}function Gm(e,t){var a=t,s=0;do{var o=a.nextSibling;if(e.removeChild(a),o&&o.nodeType===8)if(a=o.data,a==="/$"||a==="/&"){if(s===0){e.removeChild(o),or(t);return}s--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")s++;else if(a==="html")ws(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,ws(a);for(var u=a.firstChild;u;){var f=u.nextSibling,v=u.nodeName;u[Sa]||v==="SCRIPT"||v==="STYLE"||v==="LINK"&&u.rel.toLowerCase()==="stylesheet"||a.removeChild(u),u=f}}else a==="body"&&ws(e.ownerDocument.body);a=o}while(a);or(t)}function Vm(e,t){var a=e;e=0;do{var s=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),s&&s.nodeType===8)if(a=s.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=s}while(a)}function Hu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Hu(a),zr(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function Rv(e,t,a,s){for(;e.nodeType===1;){var o=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!s&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(s){if(!e[Sa])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==o.rel||e.getAttribute("href")!==(o.href==null||o.href===""?null:o.href)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin)||e.getAttribute("title")!==(o.title==null?null:o.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(o.src==null?null:o.src)||e.getAttribute("type")!==(o.type==null?null:o.type)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=o.name==null?null:""+o.name;if(o.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=un(e.nextSibling),e===null)break}return null}function jv(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=un(e.nextSibling),e===null))return null;return e}function Km(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=un(e.nextSibling),e===null))return null;return e}function qu(e){return e.data==="$?"||e.data==="$~"}function $u(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Nv(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var s=function(){t(),a.removeEventListener("DOMContentLoaded",s)};a.addEventListener("DOMContentLoaded",s),e._reactRetry=s}}function un(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Pu=null;function Ym(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return un(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function Jm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(t===0)return e;t--}else a!=="/$"&&a!=="/&"||t++}e=e.previousSibling}return null}function Xm(e,t,a){switch(t=oo(a),e){case"html":if(e=t.documentElement,!e)throw Error(l(452));return e;case"head":if(e=t.head,!e)throw Error(l(453));return e;case"body":if(e=t.body,!e)throw Error(l(454));return e;default:throw Error(l(451))}}function ws(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);zr(e)}var dn=new Map,Qm=new Set;function co(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ca=K.d;K.d={f:Lv,r:Dv,D:Uv,C:Mv,L:zv,m:Bv,X:qv,S:Hv,M:$v};function Lv(){var e=ca.f(),t=eo();return e||t}function Dv(e){var t=wa(e);t!==null&&t.tag===5&&t.type==="form"?ff(t):ca.r(e)}var rr=typeof document>"u"?null:document;function Wm(e,t,a){var s=rr;if(s&&typeof t=="string"&&t){var o=Mt(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof a=="string"&&(o+='[crossorigin="'+a+'"]'),Qm.has(o)||(Qm.add(o),e={rel:e,crossOrigin:a,href:t},s.querySelector(o)===null&&(t=s.createElement("link"),Et(t,"link",e),qe(t),s.head.appendChild(t)))}}function Uv(e){ca.D(e),Wm("dns-prefetch",e,null)}function Mv(e,t){ca.C(e,t),Wm("preconnect",e,t)}function zv(e,t,a){ca.L(e,t,a);var s=rr;if(s&&e&&t){var o='link[rel="preload"][as="'+Mt(t)+'"]';t==="image"&&a&&a.imageSrcSet?(o+='[imagesrcset="'+Mt(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(o+='[imagesizes="'+Mt(a.imageSizes)+'"]')):o+='[href="'+Mt(e)+'"]';var u=o;switch(t){case"style":u=sr(e);break;case"script":u=lr(e)}dn.has(u)||(e=b({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),dn.set(u,e),s.querySelector(o)!==null||t==="style"&&s.querySelector(_s(u))||t==="script"&&s.querySelector(Ts(u))||(t=s.createElement("link"),Et(t,"link",e),qe(t),s.head.appendChild(t)))}}function Bv(e,t){ca.m(e,t);var a=rr;if(a&&e){var s=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+Mt(s)+'"][href="'+Mt(e)+'"]',u=o;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=lr(e)}if(!dn.has(u)&&(e=b({rel:"modulepreload",href:e},t),dn.set(u,e),a.querySelector(o)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Ts(u)))return}s=a.createElement("link"),Et(s,"link",e),qe(s),a.head.appendChild(s)}}}function Hv(e,t,a){ca.S(e,t,a);var s=rr;if(s&&e){var o=$n(s).hoistableStyles,u=sr(e);t=t||"default";var f=o.get(u);if(!f){var v={loading:0,preload:null};if(f=s.querySelector(_s(u)))v.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":t},a),(a=dn.get(u))&&Iu(e,a);var _=f=s.createElement("link");qe(_),Et(_,"link",e),_._p=new Promise(function(R,z){_.onload=R,_.onerror=z}),_.addEventListener("load",function(){v.loading|=1}),_.addEventListener("error",function(){v.loading|=2}),v.loading|=4,uo(f,t,s)}f={type:"stylesheet",instance:f,count:1,state:v},o.set(u,f)}}}function qv(e,t){ca.X(e,t);var a=rr;if(a&&e){var s=$n(a).hoistableScripts,o=lr(e),u=s.get(o);u||(u=a.querySelector(Ts(o)),u||(e=b({src:e,async:!0},t),(t=dn.get(o))&&Gu(e,t),u=a.createElement("script"),qe(u),Et(u,"link",e),a.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(o,u))}}function $v(e,t){ca.M(e,t);var a=rr;if(a&&e){var s=$n(a).hoistableScripts,o=lr(e),u=s.get(o);u||(u=a.querySelector(Ts(o)),u||(e=b({src:e,async:!0,type:"module"},t),(t=dn.get(o))&&Gu(e,t),u=a.createElement("script"),qe(u),Et(u,"link",e),a.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(o,u))}}function Zm(e,t,a,s){var o=(o=me.current)?co(o):null;if(!o)throw Error(l(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=sr(a.href),a=$n(o).hoistableStyles,s=a.get(t),s||(s={type:"style",instance:null,count:0,state:null},a.set(t,s)),s):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=sr(a.href);var u=$n(o).hoistableStyles,f=u.get(e);if(f||(o=o.ownerDocument||o,f={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,f),(u=o.querySelector(_s(e)))&&!u._p&&(f.instance=u,f.state.loading=5),dn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},dn.set(e,a),u||Pv(o,e,a,f.state))),t&&s===null)throw Error(l(528,""));return f}if(t&&s!==null)throw Error(l(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=lr(a),a=$n(o).hoistableScripts,s=a.get(t),s||(s={type:"script",instance:null,count:0,state:null},a.set(t,s)),s):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,e))}}function sr(e){return'href="'+Mt(e)+'"'}function _s(e){return'link[rel="stylesheet"]['+e+"]"}function Fm(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function Pv(e,t,a,s){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?s.loading=1:(t=e.createElement("link"),s.preload=t,t.addEventListener("load",function(){return s.loading|=1}),t.addEventListener("error",function(){return s.loading|=2}),Et(t,"link",a),qe(t),e.head.appendChild(t))}function lr(e){return'[src="'+Mt(e)+'"]'}function Ts(e){return"script[async]"+e}function eg(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+Mt(a.href)+'"]');if(s)return t.instance=s,qe(s),s;var o=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return s=(e.ownerDocument||e).createElement("style"),qe(s),Et(s,"style",o),uo(s,a.precedence,e),t.instance=s;case"stylesheet":o=sr(a.href);var u=e.querySelector(_s(o));if(u)return t.state.loading|=4,t.instance=u,qe(u),u;s=Fm(a),(o=dn.get(o))&&Iu(s,o),u=(e.ownerDocument||e).createElement("link"),qe(u);var f=u;return f._p=new Promise(function(v,_){f.onload=v,f.onerror=_}),Et(u,"link",s),t.state.loading|=4,uo(u,a.precedence,e),t.instance=u;case"script":return u=lr(a.src),(o=e.querySelector(Ts(u)))?(t.instance=o,qe(o),o):(s=a,(o=dn.get(u))&&(s=b({},a),Gu(s,o)),e=e.ownerDocument||e,o=e.createElement("script"),qe(o),Et(o,"link",s),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(l(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(s=t.instance,t.state.loading|=4,uo(s,a.precedence,e));return t.instance}function uo(e,t,a){for(var s=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=s.length?s[s.length-1]:null,u=o,f=0;f<s.length;f++){var v=s[f];if(v.dataset.precedence===t)u=v;else if(u!==o)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function Iu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Gu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var ho=null;function tg(e,t,a){if(ho===null){var s=new Map,o=ho=new Map;o.set(a,s)}else o=ho,s=o.get(a),s||(s=new Map,o.set(a,s));if(s.has(e))return s;for(s.set(e,null),a=a.getElementsByTagName(e),o=0;o<a.length;o++){var u=a[o];if(!(u[Sa]||u[Ve]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var f=u.getAttribute(t)||"";f=e+f;var v=s.get(f);v?v.push(u):s.set(f,[u])}}return s}function ng(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function Iv(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function ag(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Gv(e,t,a,s){if(a.type==="stylesheet"&&(typeof s.media!="string"||matchMedia(s.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var o=sr(s.href),u=t.querySelector(_s(o));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=fo.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=u,qe(u);return}u=t.ownerDocument||t,s=Fm(s),(o=dn.get(o))&&Iu(s,o),u=u.createElement("link"),qe(u);var f=u;f._p=new Promise(function(v,_){f.onload=v,f.onerror=_}),Et(u,"link",s),a.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=fo.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var Vu=0;function Vv(e,t){return e.stylesheets&&e.count===0&&go(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var s=setTimeout(function(){if(e.stylesheets&&go(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Vu===0&&(Vu=62500*Ev());var o=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&go(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Vu?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(o)}}:null}function fo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)go(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var mo=null;function go(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,mo=new Map,t.forEach(Kv,e),mo=null,fo.call(e))}function Kv(e,t){if(!(t.state.loading&4)){var a=mo.get(e);if(a)var s=a.get(null);else{a=new Map,mo.set(e,a);for(var o=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<o.length;u++){var f=o[u];(f.nodeName==="LINK"||f.getAttribute("media")!=="not all")&&(a.set(f.dataset.precedence,f),s=f)}s&&a.set(null,s)}o=t.instance,f=o.getAttribute("data-precedence"),u=a.get(f)||s,u===s&&a.set(null,o),a.set(f,o),this.count++,s=fo.bind(this),o.addEventListener("load",s),o.addEventListener("error",s),u?u.parentNode.insertBefore(o,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(o,e.firstChild)),t.state.loading|=4}}var ks={$$typeof:N,Provider:null,Consumer:null,_currentValue:ae,_currentValue2:ae,_threadCount:0};function Yv(e,t,a,s,o,u,f,v,_){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=Nr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Nr(0),this.hiddenUpdates=Nr(null),this.identifierPrefix=s,this.onUncaughtError=o,this.onCaughtError=u,this.onRecoverableError=f,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=_,this.incompleteTransitions=new Map}function ig(e,t,a,s,o,u,f,v,_,R,z,H){return e=new Yv(e,t,a,f,_,R,z,H,v),t=1,u===!0&&(t|=24),u=Jt(3,null,null,t),e.current=u,u.stateNode=e,t=kc(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:s,isDehydrated:a,cache:t},Cc(u),e}function rg(e){return e?(e=Bi,e):Bi}function sg(e,t,a,s,o,u){o=rg(o),s.context===null?s.context=o:s.pendingContext=o,s=Oa(t),s.payload={element:a},u=u===void 0?null:u,u!==null&&(s.callback=u),a=Ra(e,s,t),a!==null&&(Pt(a,e,t),ns(a,e,t))}function lg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function Ku(e,t){lg(e,t),(e=e.alternate)&&lg(e,t)}function og(e){if(e.tag===13||e.tag===31){var t=ii(e,67108864);t!==null&&Pt(t,e,67108864),Ku(e,67108864)}}function cg(e){if(e.tag===13||e.tag===31){var t=Ft();t=Oi(t);var a=ii(e,t);a!==null&&Pt(a,e,t),Ku(e,t)}}var po=!0;function Jv(e,t,a,s){var o=D.T;D.T=null;var u=K.p;try{K.p=2,Yu(e,t,a,s)}finally{K.p=u,D.T=o}}function Xv(e,t,a,s){var o=D.T;D.T=null;var u=K.p;try{K.p=8,Yu(e,t,a,s)}finally{K.p=u,D.T=o}}function Yu(e,t,a,s){if(po){var o=Ju(s);if(o===null)Lu(e,t,s,yo,a),dg(e,s);else if(Wv(o,e,t,a,s))s.stopPropagation();else if(dg(e,s),t&4&&-1<Qv.indexOf(e)){for(;o!==null;){var u=wa(o);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var f=Dt(u.pendingLanes);if(f!==0){var v=u;for(v.pendingLanes|=2,v.entangledLanes|=2;f;){var _=1<<31-lt(f);v.entanglements[1]|=_,f&=~_}On(u),(Re&6)===0&&(Zl=Ot()+500,vs(0))}}break;case 31:case 13:v=ii(u,2),v!==null&&Pt(v,u,2),eo(),Ku(u,2)}if(u=Ju(s),u===null&&Lu(e,t,s,yo,a),u===o)break;o=u}o!==null&&s.stopPropagation()}else Lu(e,t,s,null,a)}}function Ju(e){return e=ce(e),Xu(e)}var yo=null;function Xu(e){if(yo=null,e=qn(e),e!==null){var t=d(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=h(t),e!==null)return e;e=null}else if(a===31){if(e=m(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return yo=e,null}function ug(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(Or()){case Rr:return 2;case Ci:return 8;case Ja:case He:return 32;case tl:return 268435456;default:return 32}default:return 32}}var Qu=!1,$a=null,Pa=null,Ia=null,Es=new Map,As=new Map,Ga=[],Qv="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 dg(e,t){switch(e){case"focusin":case"focusout":$a=null;break;case"dragenter":case"dragleave":Pa=null;break;case"mouseover":case"mouseout":Ia=null;break;case"pointerover":case"pointerout":Es.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":As.delete(t.pointerId)}}function xs(e,t,a,s,o,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:a,eventSystemFlags:s,nativeEvent:u,targetContainers:[o]},t!==null&&(t=wa(t),t!==null&&og(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function Wv(e,t,a,s,o){switch(t){case"focusin":return $a=xs($a,e,t,a,s,o),!0;case"dragenter":return Pa=xs(Pa,e,t,a,s,o),!0;case"mouseover":return Ia=xs(Ia,e,t,a,s,o),!0;case"pointerover":var u=o.pointerId;return Es.set(u,xs(Es.get(u)||null,e,t,a,s,o)),!0;case"gotpointercapture":return u=o.pointerId,As.set(u,xs(As.get(u)||null,e,t,a,s,o)),!0}return!1}function hg(e){var t=qn(e.target);if(t!==null){var a=d(t);if(a!==null){if(t=a.tag,t===13){if(t=h(a),t!==null){e.blockedOn=t,al(e.priority,function(){cg(a)});return}}else if(t===31){if(t=m(a),t!==null){e.blockedOn=t,al(e.priority,function(){cg(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function vo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=Ju(e.nativeEvent);if(a===null){a=e.nativeEvent;var s=new a.constructor(a.type,a);fe=s,a.target.dispatchEvent(s),fe=null}else return t=wa(a),t!==null&&og(t),e.blockedOn=a,!1;t.shift()}return!0}function fg(e,t,a){vo(e)&&a.delete(t)}function Zv(){Qu=!1,$a!==null&&vo($a)&&($a=null),Pa!==null&&vo(Pa)&&(Pa=null),Ia!==null&&vo(Ia)&&(Ia=null),Es.forEach(fg),As.forEach(fg)}function bo(e,t){e.blockedOn===t&&(e.blockedOn=null,Qu||(Qu=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,Zv)))}var So=null;function mg(e){So!==e&&(So=e,i.unstable_scheduleCallback(i.unstable_NormalPriority,function(){So===e&&(So=null);for(var t=0;t<e.length;t+=3){var a=e[t],s=e[t+1],o=e[t+2];if(typeof s!="function"){if(Xu(s||a)===null)continue;break}var u=wa(a);u!==null&&(e.splice(t,3),t-=3,Jc(u,{pending:!0,data:o,method:a.method,action:s},s,o))}}))}function or(e){function t(_){return bo(_,e)}$a!==null&&bo($a,e),Pa!==null&&bo(Pa,e),Ia!==null&&bo(Ia,e),Es.forEach(t),As.forEach(t);for(var a=0;a<Ga.length;a++){var s=Ga[a];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Ga.length&&(a=Ga[0],a.blockedOn===null);)hg(a),a.blockedOn===null&&Ga.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(s=0;s<a.length;s+=3){var o=a[s],u=a[s+1],f=o[wt]||null;if(typeof u=="function")f||mg(a);else if(f){var v=null;if(u&&u.hasAttribute("formAction")){if(o=u,f=u[wt]||null)v=f.formAction;else if(Xu(o)!==null)continue}else v=f.action;typeof v=="function"?a[s+1]=v:(a.splice(s,3),s-=3),mg(a)}}}function gg(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(f){return o=f})},focusReset:"manual",scroll:"manual"})}function t(){o!==null&&(o(),o=null),s||setTimeout(a,20)}function a(){if(!s&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var s=!1,o=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){s=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),o!==null&&(o(),o=null)}}}function Wu(e){this._internalRoot=e}wo.prototype.render=Wu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(l(409));var a=t.current,s=Ft();sg(a,s,e,t,null,null)},wo.prototype.unmount=Wu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;sg(e.current,2,null,e,null,null),eo(),t[Bn]=null}};function wo(e){this._internalRoot=e}wo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Mr();e={blockedOn:null,target:e,priority:t};for(var a=0;a<Ga.length&&t!==0&&t<Ga[a].priority;a++);Ga.splice(a,0,e),a===0&&hg(e)}};var pg=n.version;if(pg!=="19.2.7")throw Error(l(527,pg,"19.2.7"));K.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(l(188)):(e=Object.keys(e).join(","),Error(l(268,e)));return e=p(t),e=e!==null?S(e):null,e=e===null?null:e.stateNode,e};var Fv={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:D,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var _o=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!_o.isDisabled&&_o.supportsFiber)try{pa=_o.inject(Fv),St=_o}catch{}}return Os.createRoot=function(e,t){if(!c(e))throw Error(l(299));var a=!1,s="",o=Tf,u=kf,f=Ef;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(f=t.onRecoverableError)),t=ig(e,1,!1,null,null,a,s,null,o,u,f,gg),e[Bn]=t.current,Nu(e),new Wu(t)},Os.hydrateRoot=function(e,t,a){if(!c(e))throw Error(l(299));var s=!1,o="",u=Tf,f=kf,v=Ef,_=null;return a!=null&&(a.unstable_strictMode===!0&&(s=!0),a.identifierPrefix!==void 0&&(o=a.identifierPrefix),a.onUncaughtError!==void 0&&(u=a.onUncaughtError),a.onCaughtError!==void 0&&(f=a.onCaughtError),a.onRecoverableError!==void 0&&(v=a.onRecoverableError),a.formState!==void 0&&(_=a.formState)),t=ig(e,1,!0,t,a??null,s,o,_,u,f,v,gg),t.context=rg(null),a=t.current,s=Ft(),s=Oi(s),o=Oa(s),o.callback=null,Ra(a,o,s),a=s,t.current.lanes=a,zn(t,a),On(t),e[Bn]=t.current,Nu(e),new wo(t)},Os.version="19.2.7",Os}var Ag;function c0(){if(Ag)return ed.exports;Ag=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(n){console.error(n)}}return i(),ed.exports=o0(),ed.exports}var u0=c0();const d0=i=>i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),h0=i=>i.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,r,l)=>l?l.toUpperCase():r.toLowerCase()),xg=i=>{const n=h0(i);return n.charAt(0).toUpperCase()+n.slice(1)},Sp=(...i)=>i.filter((n,r,l)=>!!n&&n.trim()!==""&&l.indexOf(n)===r).join(" ").trim(),f0=i=>{for(const n in i)if(n.startsWith("aria-")||n==="role"||n==="title")return!0};var m0={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const g0=I.forwardRef(({color:i="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:l,className:c="",children:d,iconNode:h,...m},g)=>I.createElement("svg",{ref:g,...m0,width:n,height:n,stroke:i,strokeWidth:l?Number(r)*24/Number(n):r,className:Sp("lucide",c),...!d&&!f0(m)&&{"aria-hidden":"true"},...m},[...h.map(([p,S])=>I.createElement(p,S)),...Array.isArray(d)?d:[d]]));const ze=(i,n)=>{const r=I.forwardRef(({className:l,...c},d)=>I.createElement(g0,{ref:d,iconNode:n,className:Sp(`lucide-${d0(xg(i))}`,`lucide-${i}`,l),...c}));return r.displayName=xg(i),r};const p0=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Cg=ze("activity",p0);const y0=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],v0=ze("badge-check",y0);const b0=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],_d=ze("book-open",b0);const S0=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],wp=ze("chevron-left",S0);const w0=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],_p=ze("chevron-right",w0);const _0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],T0=ze("circle-check",_0);const k0=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],Rs=ze("clipboard",k0);const E0=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Td=ze("credit-card",E0);const A0=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],id=ze("database",A0);const x0=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],C0=ze("earth",x0);const O0=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],rd=ze("folder-open",O0);const R0=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],Tp=ze("layout-grid",R0);const j0=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],sd=ze("log-in",j0);const N0=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],L0=ze("log-out",N0);const D0=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],_r=ze("monitor",D0);const U0=[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]],kd=ze("mouse-pointer-2",U0);const M0=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],ld=ze("play",M0);const z0=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],B0=ze("power",z0);const H0=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],q0=ze("rotate-ccw",H0);const $0=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],od=ze("send",$0);const P0=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],cd=ze("server",P0);const I0=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],kp=ze("settings",I0);const G0=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Og=ze("shield-check",G0);const V0=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],K0=ze("star",V0);const Y0=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],yr=ze("terminal",Y0);const J0=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],Rg=ze("volume-2",J0);const X0=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],jg=ze("wifi",X0);const Q0=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ng=ze("x",Q0);function Po(i,n){var r={};for(var l in i)Object.prototype.hasOwnProperty.call(i,l)&&n.indexOf(l)<0&&(r[l]=i[l]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,l=Object.getOwnPropertySymbols(i);c<l.length;c++)n.indexOf(l[c])<0&&Object.prototype.propertyIsEnumerable.call(i,l[c])&&(r[l[c]]=i[l[c]]);return r}function W0(i,n,r,l){function c(d){return d instanceof r?d:new r(function(h){h(d)})}return new(r||(r=Promise))(function(d,h){function m(S){try{p(l.next(S))}catch(b){h(b)}}function g(S){try{p(l.throw(S))}catch(b){h(b)}}function p(S){S.done?d(S.value):c(S.value).then(m,g)}p((l=l.apply(i,n||[])).next())})}const Z0=i=>i?(...n)=>i(...n):(...n)=>fetch(...n);class Bd extends Error{constructor(n,r="FunctionsError",l){super(n),this.name=r,this.context=l}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class F0 extends Bd{constructor(n){super("Failed to send a request to the Edge Function","FunctionsFetchError",n)}}class Lg extends Bd{constructor(n){super("Relay Error invoking the Edge Function","FunctionsRelayError",n)}}class Dg extends Bd{constructor(n){super("Edge Function returned a non-2xx status code","FunctionsHttpError",n)}}var Ed;(function(i){i.Any="any",i.ApNortheast1="ap-northeast-1",i.ApNortheast2="ap-northeast-2",i.ApSouth1="ap-south-1",i.ApSoutheast1="ap-southeast-1",i.ApSoutheast2="ap-southeast-2",i.CaCentral1="ca-central-1",i.EuCentral1="eu-central-1",i.EuWest1="eu-west-1",i.EuWest2="eu-west-2",i.EuWest3="eu-west-3",i.SaEast1="sa-east-1",i.UsEast1="us-east-1",i.UsWest1="us-west-1",i.UsWest2="us-west-2"})(Ed||(Ed={}));class eb{constructor(n,{headers:r={},customFetch:l,region:c=Ed.Any}={}){this.url=n,this.headers=r,this.region=c,this.fetch=Z0(l)}setAuth(n){this.headers.Authorization=`Bearer ${n}`}invoke(n){return W0(this,arguments,void 0,function*(r,l={}){var c;let d,h;try{const{headers:m,method:g,body:p,signal:S,timeout:b}=l;let T={},{region:A}=l;A||(A=this.region);const C=new URL(`${this.url}/${r}`);A&&A!=="any"&&(T["x-region"]=A,C.searchParams.set("forceFunctionRegion",A));let U;const $=!!m&&Object.keys(m).some(G=>G.toLowerCase()==="content-type");p&&!$?typeof Blob<"u"&&p instanceof Blob||p instanceof ArrayBuffer?(T["Content-Type"]="application/octet-stream",U=p):typeof p=="string"?(T["Content-Type"]="text/plain",U=p):typeof FormData<"u"&&p instanceof FormData?U=p:(T["Content-Type"]="application/json",U=JSON.stringify(p)):p&&typeof p!="string"&&!(typeof Blob<"u"&&p instanceof Blob)&&!(p instanceof ArrayBuffer)&&!(typeof FormData<"u"&&p instanceof FormData)?U=JSON.stringify(p):U=p;let P=S;b&&(h=new AbortController,d=setTimeout(()=>h.abort(),b),S?(P=h.signal,S.addEventListener("abort",()=>h.abort())):P=h.signal);const q=yield this.fetch(C.toString(),{method:g||"POST",headers:Object.assign(Object.assign(Object.assign({},T),this.headers),m),body:U,signal:P}).catch(G=>{throw new F0(G)}),N=q.headers.get("x-relay-error");if(N&&N==="true")throw new Lg(q);if(!q.ok)throw new Dg(q);let Y=((c=q.headers.get("Content-Type"))!==null&&c!==void 0?c:"text/plain").split(";")[0].trim(),ue;return Y==="application/json"?ue=yield q.json():Y==="application/octet-stream"||Y==="application/pdf"?ue=yield q.blob():Y==="text/event-stream"?ue=q:Y==="multipart/form-data"?ue=yield q.formData():ue=yield q.text(),{data:ue,error:null,response:q}}catch(m){return{data:null,error:m,response:m instanceof Dg||m instanceof Lg?m.context:void 0}}finally{d&&clearTimeout(d)}})}}const Ep=3,Ug=i=>Math.min(1e3*2**i,3e4),tb=[520,503],Ap=["GET","HEAD","OPTIONS"];var Mg=class extends Error{constructor(i){super(i.message),this.name="PostgrestError",this.details=i.details,this.hint=i.hint,this.code=i.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function zg(i,n){return new Promise(r=>{if(n?.aborted){r();return}const l=setTimeout(()=>{n?.removeEventListener("abort",c),r()},i);function c(){clearTimeout(l),r()}n?.addEventListener("abort",c)})}function nb(i,n,r,l){return!(!l||r>=Ep||!Ap.includes(i)||!tb.includes(n))}var ab=class{constructor(i){var n,r,l,c,d;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=i.method,this.url=i.url,this.headers=new Headers(i.headers),this.schema=i.schema,this.body=i.body,this.shouldThrowOnError=(n=i.shouldThrowOnError)!==null&&n!==void 0?n:!1,this.signal=i.signal,this.isMaybeSingle=(r=i.isMaybeSingle)!==null&&r!==void 0?r:!1,this.shouldStripNulls=(l=i.shouldStripNulls)!==null&&l!==void 0?l:!1,this.urlLengthLimit=(c=i.urlLengthLimit)!==null&&c!==void 0?c:8e3,this.retryEnabled=(d=i.retry)!==null&&d!==void 0?d:!0,i.fetch?this.fetch=i.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(i,n){return this.headers=new Headers(this.headers),this.headers.set(i,n),this}retry(i){return this.retryEnabled=i,this}then(i,n){var r=this;if(this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const h=this.headers.get("Accept");h==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!h||h==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const l=this.fetch;let d=(async()=>{let h=0;for(;;){const p={};r.headers.forEach((b,T)=>{p[T]=b}),h>0&&(p["X-Retry-Count"]=String(h));let S;try{S=await l(r.url.toString(),{method:r.method,headers:p,body:JSON.stringify(r.body,(b,T)=>typeof T=="bigint"?T.toString():T),signal:r.signal})}catch(b){if(b?.name==="AbortError"||b?.code==="ABORT_ERR"||!Ap.includes(r.method))throw b;if(r.retryEnabled&&h<Ep){const T=Ug(h);h++,await zg(T,r.signal);continue}throw b}if(nb(r.method,S.status,h,r.retryEnabled)){var m,g;const b=(m=(g=S.headers)===null||g===void 0?void 0:g.get("Retry-After"))!==null&&m!==void 0?m:null,T=b!==null?Math.max(0,parseInt(b,10)||0)*1e3:Ug(h);await S.text(),h++,await zg(T,r.signal);continue}return await r.processResponse(S)}})();return this.shouldThrowOnError||(d=d.catch(h=>{var m;let g="",p="",S="";const b=h?.cause;if(b){var T,A,C,U;const q=(T=b?.message)!==null&&T!==void 0?T:"",N=(A=b?.code)!==null&&A!==void 0?A:"";g=`${(C=h?.name)!==null&&C!==void 0?C:"FetchError"}: ${h?.message}`,g+=`
10
10
 
11
11
  Caused by: ${(U=b?.name)!==null&&U!==void 0?U:"Error"}: ${q}`,N&&(g+=` (${N})`),b?.stack&&(g+=`
12
- ${b.stack}`)}else{var $;g=($=h?.stack)!==null&&$!==void 0?$:""}const P=this.url.toString().length;return h?.name==="AbortError"||h?.code==="ABORT_ERR"?(S="",p="Request was aborted (timeout or manual cancellation)",P>this.urlLengthLimit&&(p+=`. Note: Your request URL is ${P} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):(b?.name==="HeadersOverflowError"||b?.code==="UND_ERR_HEADERS_OVERFLOW")&&(S="",p="HTTP headers exceeded server limits (typically 16KB)",P>this.urlLengthLimit&&(p+=`. Your request URL is ${P} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(m=h?.name)!==null&&m!==void 0?m:"FetchError"}: ${h?.message}`,details:g,hint:p,code:S},data:null,count:null,status:0,statusText:""}})),d.then(i,n)}async processResponse(i){var n=this;let r=null,l=null,c=null,d=i.status,h=i.statusText;if(i.ok){var m,g;if(n.method!=="HEAD"){var p;const T=await i.text();if(T!=="")if(n.headers.get("Accept")==="text/csv")l=T;else if(n.headers.get("Accept")&&(!((p=n.headers.get("Accept"))===null||p===void 0)&&p.includes("application/vnd.pgrst.plan+text")))l=T;else try{l=JSON.parse(T)}catch{if(r={message:T},l=null,n.shouldThrowOnError)throw new Mg({message:T,details:"",hint:"",code:""})}}const S=(m=n.headers.get("Prefer"))===null||m===void 0?void 0:m.match(/count=(exact|planned|estimated)/),b=(g=i.headers.get("content-range"))===null||g===void 0?void 0:g.split("/");S&&b&&b.length>1&&(c=parseInt(b[1])),n.isMaybeSingle&&Array.isArray(l)&&(l.length>1?(r={code:"PGRST116",details:`Results contain ${l.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},l=null,c=null,d=406,h="Not Acceptable"):l.length===1?l=l[0]:l=null)}else{const S=await i.text();try{r=JSON.parse(S),Array.isArray(r)&&i.status===404&&(l=[],r=null,d=200,h="OK")}catch{i.status===404&&S===""?(d=204,h="No Content"):r={message:S}}if(r&&n.shouldThrowOnError)throw new Mg(r)}return{success:r===null,error:r,data:l,count:c,status:d,statusText:h}}returns(){return this}overrideTypes(){return this}},ab=class extends nb{throwOnError(){return super.throwOnError()}select(i){let n=!1;const r=(i??"*").split("").map(l=>/\s/.test(l)&&!n?"":(l==='"'&&(n=!n),l)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(i,{ascending:n=!0,nullsFirst:r,foreignTable:l,referencedTable:c=l}={}){const d=c?`${c}.order`:"order",h=this.url.searchParams.get(d);return this.url.searchParams.set(d,`${h?`${h},`:""}${i}.${n?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(i,{foreignTable:n,referencedTable:r=n}={}){const l=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(l,`${i}`),this}range(i,n,{foreignTable:r,referencedTable:l=r}={}){const c=typeof l>"u"?"offset":`${l}.offset`,d=typeof l>"u"?"limit":`${l}.limit`;return this.url.searchParams.set(c,`${i}`),this.url.searchParams.set(d,`${n-i+1}`),this}abortSignal(i){return this.signal=i,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:i=!1,verbose:n=!1,settings:r=!1,buffers:l=!1,wal:c=!1,format:d="text"}={}){var h;const m=[i?"analyze":null,n?"verbose":null,r?"settings":null,l?"buffers":null,c?"wal":null].filter(Boolean).join("|"),g=(h=this.headers.get("Accept"))!==null&&h!==void 0?h:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${d}; for="${g}"; options=${m};`),d==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(i){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${i}`),this}};const Bg=new RegExp("[,()]");var vr=class extends ab{throwOnError(){return super.throwOnError()}eq(i,n){return this.url.searchParams.append(i,`eq.${n}`),this}neq(i,n){return this.url.searchParams.append(i,`neq.${n}`),this}gt(i,n){return this.url.searchParams.append(i,`gt.${n}`),this}gte(i,n){return this.url.searchParams.append(i,`gte.${n}`),this}lt(i,n){return this.url.searchParams.append(i,`lt.${n}`),this}lte(i,n){return this.url.searchParams.append(i,`lte.${n}`),this}like(i,n){return this.url.searchParams.append(i,`like.${n}`),this}likeAllOf(i,n){return this.url.searchParams.append(i,`like(all).{${n.join(",")}}`),this}likeAnyOf(i,n){return this.url.searchParams.append(i,`like(any).{${n.join(",")}}`),this}ilike(i,n){return this.url.searchParams.append(i,`ilike.${n}`),this}ilikeAllOf(i,n){return this.url.searchParams.append(i,`ilike(all).{${n.join(",")}}`),this}ilikeAnyOf(i,n){return this.url.searchParams.append(i,`ilike(any).{${n.join(",")}}`),this}regexMatch(i,n){return this.url.searchParams.append(i,`match.${n}`),this}regexIMatch(i,n){return this.url.searchParams.append(i,`imatch.${n}`),this}is(i,n){return this.url.searchParams.append(i,`is.${n}`),this}isDistinct(i,n){return this.url.searchParams.append(i,`isdistinct.${n}`),this}in(i,n){const r=Array.from(new Set(n)).map(l=>typeof l=="string"&&Bg.test(l)?`"${l}"`:`${l}`).join(",");return this.url.searchParams.append(i,`in.(${r})`),this}notIn(i,n){const r=Array.from(new Set(n)).map(l=>typeof l=="string"&&Bg.test(l)?`"${l}"`:`${l}`).join(",");return this.url.searchParams.append(i,`not.in.(${r})`),this}contains(i,n){return typeof n=="string"?this.url.searchParams.append(i,`cs.${n}`):Array.isArray(n)?this.url.searchParams.append(i,`cs.{${n.join(",")}}`):this.url.searchParams.append(i,`cs.${JSON.stringify(n)}`),this}containedBy(i,n){return typeof n=="string"?this.url.searchParams.append(i,`cd.${n}`):Array.isArray(n)?this.url.searchParams.append(i,`cd.{${n.join(",")}}`):this.url.searchParams.append(i,`cd.${JSON.stringify(n)}`),this}rangeGt(i,n){return this.url.searchParams.append(i,`sr.${n}`),this}rangeGte(i,n){return this.url.searchParams.append(i,`nxl.${n}`),this}rangeLt(i,n){return this.url.searchParams.append(i,`sl.${n}`),this}rangeLte(i,n){return this.url.searchParams.append(i,`nxr.${n}`),this}rangeAdjacent(i,n){return this.url.searchParams.append(i,`adj.${n}`),this}overlaps(i,n){return typeof n=="string"?this.url.searchParams.append(i,`ov.${n}`):this.url.searchParams.append(i,`ov.{${n.join(",")}}`),this}textSearch(i,n,{config:r,type:l}={}){let c="";l==="plain"?c="pl":l==="phrase"?c="ph":l==="websearch"&&(c="w");const d=r===void 0?"":`(${r})`;return this.url.searchParams.append(i,`${c}fts${d}.${n}`),this}match(i){return Object.entries(i).filter(([n,r])=>r!==void 0).forEach(([n,r])=>{this.url.searchParams.append(n,`eq.${r}`)}),this}not(i,n,r){return this.url.searchParams.append(i,`not.${n}.${r}`),this}or(i,{foreignTable:n,referencedTable:r=n}={}){const l=r?`${r}.or`:"or";return this.url.searchParams.append(l,`(${i})`),this}filter(i,n,r){return this.url.searchParams.append(i,`${n}.${r}`),this}},ib=class{constructor(i,{headers:n={},schema:r,fetch:l,urlLengthLimit:c=8e3,retry:d}){this.url=i,this.headers=new Headers(n),this.schema=r,this.fetch=l,this.urlLengthLimit=c,this.retry=d}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(i,n){const{head:r=!1,count:l}=n??{},c=r?"HEAD":"GET";let d=!1;const h=(i??"*").split("").map(p=>/\s/.test(p)&&!d?"":(p==='"'&&(d=!d),p)).join(""),{url:m,headers:g}=this.cloneRequestState();return m.searchParams.set("select",h),l&&g.append("Prefer",`count=${l}`),new vr({method:c,url:m,headers:g,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(i,{count:n,defaultToNull:r=!0}={}){var l;const c="POST",{url:d,headers:h}=this.cloneRequestState();if(n&&h.append("Prefer",`count=${n}`),r||h.append("Prefer","missing=default"),Array.isArray(i)){const m=i.reduce((g,p)=>g.concat(Object.keys(p)),[]);if(m.length>0){const g=[...new Set(m)].map(p=>`"${p}"`);d.searchParams.set("columns",g.join(","))}}return new vr({method:c,url:d,headers:h,schema:this.schema,body:i,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(i,{onConflict:n,ignoreDuplicates:r=!1,count:l,defaultToNull:c=!0}={}){var d;const h="POST",{url:m,headers:g}=this.cloneRequestState();if(g.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),n!==void 0&&m.searchParams.set("on_conflict",n),l&&g.append("Prefer",`count=${l}`),c||g.append("Prefer","missing=default"),Array.isArray(i)){const p=i.reduce((S,b)=>S.concat(Object.keys(b)),[]);if(p.length>0){const S=[...new Set(p)].map(b=>`"${b}"`);m.searchParams.set("columns",S.join(","))}}return new vr({method:h,url:m,headers:g,schema:this.schema,body:i,fetch:(d=this.fetch)!==null&&d!==void 0?d:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(i,{count:n}={}){var r;const l="PATCH",{url:c,headers:d}=this.cloneRequestState();return n&&d.append("Prefer",`count=${n}`),new vr({method:l,url:c,headers:d,schema:this.schema,body:i,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:i}={}){var n;const r="DELETE",{url:l,headers:c}=this.cloneRequestState();return i&&c.append("Prefer",`count=${i}`),new vr({method:r,url:l,headers:c,schema:this.schema,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function Vs(i){"@babel/helpers - typeof";return Vs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Vs(i)}function rb(i,n){if(Vs(i)!="object"||!i)return i;var r=i[Symbol.toPrimitive];if(r!==void 0){var l=r.call(i,n);if(Vs(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(i)}function sb(i){var n=rb(i,"string");return Vs(n)=="symbol"?n:n+""}function lb(i,n,r){return(n=sb(n))in i?Object.defineProperty(i,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):i[n]=r,i}function Hg(i,n){var r=Object.keys(i);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(i);n&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(i,c).enumerable})),r.push.apply(r,l)}return r}function To(i){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?Hg(Object(r),!0).forEach(function(l){lb(i,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(r)):Hg(Object(r)).forEach(function(l){Object.defineProperty(i,l,Object.getOwnPropertyDescriptor(r,l))})}return i}var ob=class xp{constructor(n,{headers:r={},schema:l,fetch:c,timeout:d,urlLengthLimit:h=8e3,retry:m}={}){this.url=n,this.headers=new Headers(r),this.schemaName=l,this.urlLengthLimit=h;const g=c??globalThis.fetch;d!==void 0&&d>0?this.fetch=(p,S)=>{const b=new AbortController,T=setTimeout(()=>b.abort(),d),A=S?.signal;if(A){if(A.aborted)return clearTimeout(T),g(p,S);const C=()=>{clearTimeout(T),b.abort()};return A.addEventListener("abort",C,{once:!0}),g(p,To(To({},S),{},{signal:b.signal})).finally(()=>{clearTimeout(T),A.removeEventListener("abort",C)})}return g(p,To(To({},S),{},{signal:b.signal})).finally(()=>clearTimeout(T))}:this.fetch=g,this.retry=m}from(n){if(!n||typeof n!="string"||n.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new ib(new URL(`${this.url}/${n}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(n){return new xp(this.url,{headers:this.headers,schema:n,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(n,r={},{head:l=!1,get:c=!1,count:d}={}){var h;let m;const g=new URL(`${this.url}/rpc/${n}`);let p;const S=A=>A!==null&&typeof A=="object"&&(!Array.isArray(A)||A.some(S)),b=l&&Object.values(r).some(S);b?(m="POST",p=r):l||c?(m=l?"HEAD":"GET",Object.entries(r).filter(([A,C])=>C!==void 0).map(([A,C])=>[A,Array.isArray(C)?`{${C.join(",")}}`:`${C}`]).forEach(([A,C])=>{g.searchParams.append(A,C)})):(m="POST",p=r);const T=new Headers(this.headers);return b?T.set("Prefer",d?`count=${d},return=minimal`:"return=minimal"):d&&T.set("Prefer",`count=${d}`),new vr({method:m,url:g,headers:T,schema:this.schemaName,body:p,fetch:(h=this.fetch)!==null&&h!==void 0?h:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class cb{constructor(){}static detectEnvironment(){var n;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const r=globalThis;if(typeof globalThis<"u"&&typeof r.WebSocket<"u")return{type:"native",wsConstructor:r.WebSocket};const l=typeof global<"u"?global:void 0;if(l&&typeof l.WebSocket<"u")return{type:"native",wsConstructor:l.WebSocket};if(typeof globalThis<"u"&&typeof r.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&r.EdgeRuntime||typeof navigator<"u"&&(!((n=navigator.userAgent)===null||n===void 0)&&n.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const c=globalThis.process;if(c){const d=c.versions;if(d&&d.node)return{type:"unsupported",error:"Node.js detected but native WebSocket not found.",workaround:"Ensure you are running Node.js 22+ or provide a WebSocket implementation via the transport option."}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const n=this.detectEnvironment();if(n.wsConstructor)return n.wsConstructor;let r=n.error||"WebSocket not supported in this environment.";throw n.workaround&&(r+=`
12
+ ${b.stack}`)}else{var $;g=($=h?.stack)!==null&&$!==void 0?$:""}const P=this.url.toString().length;return h?.name==="AbortError"||h?.code==="ABORT_ERR"?(S="",p="Request was aborted (timeout or manual cancellation)",P>this.urlLengthLimit&&(p+=`. Note: Your request URL is ${P} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):(b?.name==="HeadersOverflowError"||b?.code==="UND_ERR_HEADERS_OVERFLOW")&&(S="",p="HTTP headers exceeded server limits (typically 16KB)",P>this.urlLengthLimit&&(p+=`. Your request URL is ${P} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(m=h?.name)!==null&&m!==void 0?m:"FetchError"}: ${h?.message}`,details:g,hint:p,code:S},data:null,count:null,status:0,statusText:""}})),d.then(i,n)}async processResponse(i){var n=this;let r=null,l=null,c=null,d=i.status,h=i.statusText;if(i.ok){var m,g;if(n.method!=="HEAD"){var p;const T=await i.text();if(T!=="")if(n.headers.get("Accept")==="text/csv")l=T;else if(n.headers.get("Accept")&&(!((p=n.headers.get("Accept"))===null||p===void 0)&&p.includes("application/vnd.pgrst.plan+text")))l=T;else try{l=JSON.parse(T)}catch{if(r={message:T},l=null,n.shouldThrowOnError)throw new Mg({message:T,details:"",hint:"",code:""})}}const S=(m=n.headers.get("Prefer"))===null||m===void 0?void 0:m.match(/count=(exact|planned|estimated)/),b=(g=i.headers.get("content-range"))===null||g===void 0?void 0:g.split("/");S&&b&&b.length>1&&(c=parseInt(b[1])),n.isMaybeSingle&&Array.isArray(l)&&(l.length>1?(r={code:"PGRST116",details:`Results contain ${l.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},l=null,c=null,d=406,h="Not Acceptable"):l.length===1?l=l[0]:l=null)}else{const S=await i.text();try{r=JSON.parse(S),Array.isArray(r)&&i.status===404&&(l=[],r=null,d=200,h="OK")}catch{i.status===404&&S===""?(d=204,h="No Content"):r={message:S}}if(r&&n.shouldThrowOnError)throw new Mg(r)}return{success:r===null,error:r,data:l,count:c,status:d,statusText:h}}returns(){return this}overrideTypes(){return this}},ib=class extends ab{throwOnError(){return super.throwOnError()}select(i){let n=!1;const r=(i??"*").split("").map(l=>/\s/.test(l)&&!n?"":(l==='"'&&(n=!n),l)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(i,{ascending:n=!0,nullsFirst:r,foreignTable:l,referencedTable:c=l}={}){const d=c?`${c}.order`:"order",h=this.url.searchParams.get(d);return this.url.searchParams.set(d,`${h?`${h},`:""}${i}.${n?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(i,{foreignTable:n,referencedTable:r=n}={}){const l=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(l,`${i}`),this}range(i,n,{foreignTable:r,referencedTable:l=r}={}){const c=typeof l>"u"?"offset":`${l}.offset`,d=typeof l>"u"?"limit":`${l}.limit`;return this.url.searchParams.set(c,`${i}`),this.url.searchParams.set(d,`${n-i+1}`),this}abortSignal(i){return this.signal=i,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:i=!1,verbose:n=!1,settings:r=!1,buffers:l=!1,wal:c=!1,format:d="text"}={}){var h;const m=[i?"analyze":null,n?"verbose":null,r?"settings":null,l?"buffers":null,c?"wal":null].filter(Boolean).join("|"),g=(h=this.headers.get("Accept"))!==null&&h!==void 0?h:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${d}; for="${g}"; options=${m};`),d==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(i){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${i}`),this}};const Bg=new RegExp("[,()]");var vr=class extends ib{throwOnError(){return super.throwOnError()}eq(i,n){return this.url.searchParams.append(i,`eq.${n}`),this}neq(i,n){return this.url.searchParams.append(i,`neq.${n}`),this}gt(i,n){return this.url.searchParams.append(i,`gt.${n}`),this}gte(i,n){return this.url.searchParams.append(i,`gte.${n}`),this}lt(i,n){return this.url.searchParams.append(i,`lt.${n}`),this}lte(i,n){return this.url.searchParams.append(i,`lte.${n}`),this}like(i,n){return this.url.searchParams.append(i,`like.${n}`),this}likeAllOf(i,n){return this.url.searchParams.append(i,`like(all).{${n.join(",")}}`),this}likeAnyOf(i,n){return this.url.searchParams.append(i,`like(any).{${n.join(",")}}`),this}ilike(i,n){return this.url.searchParams.append(i,`ilike.${n}`),this}ilikeAllOf(i,n){return this.url.searchParams.append(i,`ilike(all).{${n.join(",")}}`),this}ilikeAnyOf(i,n){return this.url.searchParams.append(i,`ilike(any).{${n.join(",")}}`),this}regexMatch(i,n){return this.url.searchParams.append(i,`match.${n}`),this}regexIMatch(i,n){return this.url.searchParams.append(i,`imatch.${n}`),this}is(i,n){return this.url.searchParams.append(i,`is.${n}`),this}isDistinct(i,n){return this.url.searchParams.append(i,`isdistinct.${n}`),this}in(i,n){const r=Array.from(new Set(n)).map(l=>typeof l=="string"&&Bg.test(l)?`"${l}"`:`${l}`).join(",");return this.url.searchParams.append(i,`in.(${r})`),this}notIn(i,n){const r=Array.from(new Set(n)).map(l=>typeof l=="string"&&Bg.test(l)?`"${l}"`:`${l}`).join(",");return this.url.searchParams.append(i,`not.in.(${r})`),this}contains(i,n){return typeof n=="string"?this.url.searchParams.append(i,`cs.${n}`):Array.isArray(n)?this.url.searchParams.append(i,`cs.{${n.join(",")}}`):this.url.searchParams.append(i,`cs.${JSON.stringify(n)}`),this}containedBy(i,n){return typeof n=="string"?this.url.searchParams.append(i,`cd.${n}`):Array.isArray(n)?this.url.searchParams.append(i,`cd.{${n.join(",")}}`):this.url.searchParams.append(i,`cd.${JSON.stringify(n)}`),this}rangeGt(i,n){return this.url.searchParams.append(i,`sr.${n}`),this}rangeGte(i,n){return this.url.searchParams.append(i,`nxl.${n}`),this}rangeLt(i,n){return this.url.searchParams.append(i,`sl.${n}`),this}rangeLte(i,n){return this.url.searchParams.append(i,`nxr.${n}`),this}rangeAdjacent(i,n){return this.url.searchParams.append(i,`adj.${n}`),this}overlaps(i,n){return typeof n=="string"?this.url.searchParams.append(i,`ov.${n}`):this.url.searchParams.append(i,`ov.{${n.join(",")}}`),this}textSearch(i,n,{config:r,type:l}={}){let c="";l==="plain"?c="pl":l==="phrase"?c="ph":l==="websearch"&&(c="w");const d=r===void 0?"":`(${r})`;return this.url.searchParams.append(i,`${c}fts${d}.${n}`),this}match(i){return Object.entries(i).filter(([n,r])=>r!==void 0).forEach(([n,r])=>{this.url.searchParams.append(n,`eq.${r}`)}),this}not(i,n,r){return this.url.searchParams.append(i,`not.${n}.${r}`),this}or(i,{foreignTable:n,referencedTable:r=n}={}){const l=r?`${r}.or`:"or";return this.url.searchParams.append(l,`(${i})`),this}filter(i,n,r){return this.url.searchParams.append(i,`${n}.${r}`),this}},rb=class{constructor(i,{headers:n={},schema:r,fetch:l,urlLengthLimit:c=8e3,retry:d}){this.url=i,this.headers=new Headers(n),this.schema=r,this.fetch=l,this.urlLengthLimit=c,this.retry=d}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(i,n){const{head:r=!1,count:l}=n??{},c=r?"HEAD":"GET";let d=!1;const h=(i??"*").split("").map(p=>/\s/.test(p)&&!d?"":(p==='"'&&(d=!d),p)).join(""),{url:m,headers:g}=this.cloneRequestState();return m.searchParams.set("select",h),l&&g.append("Prefer",`count=${l}`),new vr({method:c,url:m,headers:g,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(i,{count:n,defaultToNull:r=!0}={}){var l;const c="POST",{url:d,headers:h}=this.cloneRequestState();if(n&&h.append("Prefer",`count=${n}`),r||h.append("Prefer","missing=default"),Array.isArray(i)){const m=i.reduce((g,p)=>g.concat(Object.keys(p)),[]);if(m.length>0){const g=[...new Set(m)].map(p=>`"${p}"`);d.searchParams.set("columns",g.join(","))}}return new vr({method:c,url:d,headers:h,schema:this.schema,body:i,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(i,{onConflict:n,ignoreDuplicates:r=!1,count:l,defaultToNull:c=!0}={}){var d;const h="POST",{url:m,headers:g}=this.cloneRequestState();if(g.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),n!==void 0&&m.searchParams.set("on_conflict",n),l&&g.append("Prefer",`count=${l}`),c||g.append("Prefer","missing=default"),Array.isArray(i)){const p=i.reduce((S,b)=>S.concat(Object.keys(b)),[]);if(p.length>0){const S=[...new Set(p)].map(b=>`"${b}"`);m.searchParams.set("columns",S.join(","))}}return new vr({method:h,url:m,headers:g,schema:this.schema,body:i,fetch:(d=this.fetch)!==null&&d!==void 0?d:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(i,{count:n}={}){var r;const l="PATCH",{url:c,headers:d}=this.cloneRequestState();return n&&d.append("Prefer",`count=${n}`),new vr({method:l,url:c,headers:d,schema:this.schema,body:i,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:i}={}){var n;const r="DELETE",{url:l,headers:c}=this.cloneRequestState();return i&&c.append("Prefer",`count=${i}`),new vr({method:r,url:l,headers:c,schema:this.schema,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function Vs(i){"@babel/helpers - typeof";return Vs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Vs(i)}function sb(i,n){if(Vs(i)!="object"||!i)return i;var r=i[Symbol.toPrimitive];if(r!==void 0){var l=r.call(i,n);if(Vs(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(i)}function lb(i){var n=sb(i,"string");return Vs(n)=="symbol"?n:n+""}function ob(i,n,r){return(n=lb(n))in i?Object.defineProperty(i,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):i[n]=r,i}function Hg(i,n){var r=Object.keys(i);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(i);n&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(i,c).enumerable})),r.push.apply(r,l)}return r}function To(i){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?Hg(Object(r),!0).forEach(function(l){ob(i,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(r)):Hg(Object(r)).forEach(function(l){Object.defineProperty(i,l,Object.getOwnPropertyDescriptor(r,l))})}return i}var cb=class xp{constructor(n,{headers:r={},schema:l,fetch:c,timeout:d,urlLengthLimit:h=8e3,retry:m}={}){this.url=n,this.headers=new Headers(r),this.schemaName=l,this.urlLengthLimit=h;const g=c??globalThis.fetch;d!==void 0&&d>0?this.fetch=(p,S)=>{const b=new AbortController,T=setTimeout(()=>b.abort(),d),A=S?.signal;if(A){if(A.aborted)return clearTimeout(T),g(p,S);const C=()=>{clearTimeout(T),b.abort()};return A.addEventListener("abort",C,{once:!0}),g(p,To(To({},S),{},{signal:b.signal})).finally(()=>{clearTimeout(T),A.removeEventListener("abort",C)})}return g(p,To(To({},S),{},{signal:b.signal})).finally(()=>clearTimeout(T))}:this.fetch=g,this.retry=m}from(n){if(!n||typeof n!="string"||n.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new rb(new URL(`${this.url}/${n}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(n){return new xp(this.url,{headers:this.headers,schema:n,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(n,r={},{head:l=!1,get:c=!1,count:d}={}){var h;let m;const g=new URL(`${this.url}/rpc/${n}`);let p;const S=A=>A!==null&&typeof A=="object"&&(!Array.isArray(A)||A.some(S)),b=l&&Object.values(r).some(S);b?(m="POST",p=r):l||c?(m=l?"HEAD":"GET",Object.entries(r).filter(([A,C])=>C!==void 0).map(([A,C])=>[A,Array.isArray(C)?`{${C.join(",")}}`:`${C}`]).forEach(([A,C])=>{g.searchParams.append(A,C)})):(m="POST",p=r);const T=new Headers(this.headers);return b?T.set("Prefer",d?`count=${d},return=minimal`:"return=minimal"):d&&T.set("Prefer",`count=${d}`),new vr({method:m,url:g,headers:T,schema:this.schemaName,body:p,fetch:(h=this.fetch)!==null&&h!==void 0?h:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class ub{constructor(){}static detectEnvironment(){var n;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const r=globalThis;if(typeof globalThis<"u"&&typeof r.WebSocket<"u")return{type:"native",wsConstructor:r.WebSocket};const l=typeof global<"u"?global:void 0;if(l&&typeof l.WebSocket<"u")return{type:"native",wsConstructor:l.WebSocket};if(typeof globalThis<"u"&&typeof r.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&r.EdgeRuntime||typeof navigator<"u"&&(!((n=navigator.userAgent)===null||n===void 0)&&n.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const c=globalThis.process;if(c){const d=c.versions;if(d&&d.node)return{type:"unsupported",error:"Node.js detected but native WebSocket not found.",workaround:"Ensure you are running Node.js 22+ or provide a WebSocket implementation via the transport option."}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const n=this.detectEnvironment();if(n.wsConstructor)return n.wsConstructor;let r=n.error||"WebSocket not supported in this environment.";throw n.workaround&&(r+=`
13
13
 
14
- Suggested solution: ${n.workaround}`),new Error(r)}static isWebSocketSupported(){try{return this.detectEnvironment().type==="native"}catch{return!1}}}const ub="2.110.0",db=`realtime-js/${ub}`,hb="1.0.0",Cp="2.0.0",fb=Cp,mb=1e4,gb=100,Ka={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Op={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},Ad={connecting:"connecting",closing:"closing",closed:"closed"};class pb{constructor(n){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=n??[]}encode(n,r){if(n.event===this.BROADCAST_EVENT&&!(n.payload instanceof ArrayBuffer)&&typeof n.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(n));let l=[n.join_ref,n.ref,n.topic,n.event,n.payload];return r(JSON.stringify(l))}_binaryEncodeUserBroadcastPush(n){var r;return this._isArrayBuffer((r=n.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(n):this._encodeJsonUserBroadcastPush(n)}_encodeBinaryUserBroadcastPush(n){var r,l;const c=(l=(r=n.payload)===null||r===void 0?void 0:r.payload)!==null&&l!==void 0?l:new ArrayBuffer(0);return this._encodeUserBroadcastPush(n,this.BINARY_ENCODING,c)}_encodeJsonUserBroadcastPush(n){var r,l;const c=(l=(r=n.payload)===null||r===void 0?void 0:r.payload)!==null&&l!==void 0?l:{},h=new TextEncoder().encode(JSON.stringify(c)).buffer;return this._encodeUserBroadcastPush(n,this.JSON_ENCODING,h)}_encodeUserBroadcastPush(n,r,l){var c,d;const h=n.topic,m=(c=n.ref)!==null&&c!==void 0?c:"",g=(d=n.join_ref)!==null&&d!==void 0?d:"",p=n.payload.event,S=this.allowedMetadataKeys?this._pick(n.payload,this.allowedMetadataKeys):{},b=Object.keys(S).length===0?"":JSON.stringify(S);if(g.length>255)throw new Error(`joinRef length ${g.length} exceeds maximum of 255`);if(m.length>255)throw new Error(`ref length ${m.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`topic length ${h.length} exceeds maximum of 255`);if(p.length>255)throw new Error(`userEvent length ${p.length} exceeds maximum of 255`);if(b.length>255)throw new Error(`metadata length ${b.length} exceeds maximum of 255`);const T=this.USER_BROADCAST_PUSH_META_LENGTH+g.length+m.length+h.length+p.length+b.length,A=new ArrayBuffer(this.HEADER_LENGTH+T);let C=new DataView(A),U=0;C.setUint8(U++,this.KINDS.userBroadcastPush),C.setUint8(U++,g.length),C.setUint8(U++,m.length),C.setUint8(U++,h.length),C.setUint8(U++,p.length),C.setUint8(U++,b.length),C.setUint8(U++,r),Array.from(g,P=>C.setUint8(U++,P.charCodeAt(0))),Array.from(m,P=>C.setUint8(U++,P.charCodeAt(0))),Array.from(h,P=>C.setUint8(U++,P.charCodeAt(0))),Array.from(p,P=>C.setUint8(U++,P.charCodeAt(0))),Array.from(b,P=>C.setUint8(U++,P.charCodeAt(0)));var $=new Uint8Array(A.byteLength+l.byteLength);return $.set(new Uint8Array(A),0),$.set(new Uint8Array(l),A.byteLength),$.buffer}decode(n,r){if(this._isArrayBuffer(n)){let l=this._binaryDecode(n);return r(l)}if(typeof n=="string"){const l=JSON.parse(n),[c,d,h,m,g]=l;return r({join_ref:c,ref:d,topic:h,event:m,payload:g})}return r({})}_binaryDecode(n){const r=new DataView(n),l=r.getUint8(0),c=new TextDecoder;if(l===this.KINDS.userBroadcast)return this._decodeUserBroadcast(n,r,c)}_decodeUserBroadcast(n,r,l){const c=r.getUint8(1),d=r.getUint8(2),h=r.getUint8(3),m=r.getUint8(4);let g=this.HEADER_LENGTH+4;const p=l.decode(n.slice(g,g+c));g=g+c;const S=l.decode(n.slice(g,g+d));g=g+d;const b=l.decode(n.slice(g,g+h));g=g+h;const T=n.slice(g,n.byteLength),A=m===this.JSON_ENCODING?JSON.parse(l.decode(T)):T,C={type:this.BROADCAST_EVENT,event:S,payload:A};return h>0&&(C.meta=JSON.parse(b)),{join_ref:null,ref:null,topic:p,event:this.BROADCAST_EVENT,payload:C}}_isArrayBuffer(n){var r;return n instanceof ArrayBuffer||((r=n?.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}_pick(n,r){return!n||typeof n!="object"?{}:Object.fromEntries(Object.entries(n).filter(([l])=>r.includes(l)))}}var $e;(function(i){i.abstime="abstime",i.bool="bool",i.date="date",i.daterange="daterange",i.float4="float4",i.float8="float8",i.int2="int2",i.int4="int4",i.int4range="int4range",i.int8="int8",i.int8range="int8range",i.json="json",i.jsonb="jsonb",i.money="money",i.numeric="numeric",i.oid="oid",i.reltime="reltime",i.text="text",i.time="time",i.timestamp="timestamp",i.timestamptz="timestamptz",i.timetz="timetz",i.tsrange="tsrange",i.tstzrange="tstzrange"})($e||($e={}));const qg=(i,n,r={})=>{var l;const c=(l=r.skipTypes)!==null&&l!==void 0?l:[];return n?Object.keys(n).reduce((d,h)=>(d[h]=yb(h,i,n,c),d),{}):{}},yb=(i,n,r,l)=>{const c=n.find(m=>m.name===i),d=c?.type,h=r[i];return d&&!l.includes(d)?Rp(d,h):xd(h)},Rp=(i,n)=>{if(i.charAt(0)==="_"){const r=i.slice(1,i.length);return wb(n,r)}switch(i){case $e.bool:return vb(n);case $e.float4:case $e.float8:case $e.int2:case $e.int4:case $e.int8:case $e.numeric:case $e.oid:return bb(n);case $e.json:case $e.jsonb:return Sb(n);case $e.timestamp:return _b(n);case $e.abstime:case $e.date:case $e.daterange:case $e.int4range:case $e.int8range:case $e.money:case $e.reltime:case $e.text:case $e.time:case $e.timestamptz:case $e.timetz:case $e.tsrange:case $e.tstzrange:return xd(n);default:return xd(n)}},xd=i=>i,vb=i=>{switch(i){case"t":return!0;case"f":return!1;default:return i}},bb=i=>{if(typeof i=="string"){const n=parseFloat(i);if(!Number.isNaN(n))return n}return i},Sb=i=>{if(typeof i=="string")try{return JSON.parse(i)}catch{return i}return i},wb=(i,n)=>{if(typeof i!="string")return i;const r=i.length-1,l=i[r];if(i[0]==="{"&&l==="}"){let d;const h=i.slice(1,r);try{d=JSON.parse("["+h+"]")}catch{d=h?h.split(","):[]}return d.map(m=>Rp(n,m))}return i},_b=i=>typeof i=="string"?i.replace(" ","T"):i,jp=i=>{const n=new URL(i);return n.protocol=n.protocol.replace(/^ws/i,"http"),n.pathname=n.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),n.pathname===""||n.pathname==="/"?n.pathname="/api/broadcast":n.pathname=n.pathname+"/api/broadcast",n.href};var Bs=i=>typeof i=="function"?i:function(){return i},Tb=typeof self<"u"?self:null,br=typeof window<"u"?window:null,Rn=Tb||br||globalThis,kb="2.0.0",Eb=1e4,Ab=1e3,jn={connecting:0,open:1,closing:2,closed:3},It={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},ha={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Cd={longpoll:"longpoll",websocket:"websocket"},xb={complete:4},Od="base64url.bearer.phx.",ko=class{constructor(i,n,r,l){this.channel=i,this.event=n,this.payload=r||function(){return{}},this.receivedResp=null,this.timeout=l,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(i){this.timeout=i,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(i,n){return this.hasReceived(i)&&n(this.receivedResp.response),this.recHooks.push({status:i,callback:n}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:i,response:n,_ref:r}){this.recHooks.filter(l=>l.status===i).forEach(l=>l.callback(n))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,i=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=i,this.matchReceive(i)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(i){return this.receivedResp&&this.receivedResp.status===i}trigger(i,n){this.channel.trigger(this.refEvent,{status:i,response:n})}},Np=class{constructor(i,n){this.callback=i,this.timerCalc=n,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},Cb=class{constructor(i,n,r){this.state=It.closed,this.topic=i,this.params=Bs(n||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new ko(this,ha.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Np(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=It.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(l=>l.send()),this.pushBuffer=[]}),this.joinPush.receive("error",l=>{this.state=It.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,l),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=It.closed,this.socket.remove(this)}),this.onError(l=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,l),this.isJoining()&&this.joinPush.reset(),this.state=It.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new ko(this,ha.leave,Bs({}),this.timeout).send(),this.state=It.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(ha.reply,(l,c)=>{this.trigger(this.replyEventName(c),l)})}join(i=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=i,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(i=>i.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=It.closed,this.bindings=[]}onClose(i){this.on(ha.close,i)}onError(i){return this.on(ha.error,n=>i(n))}on(i,n){let r=this.bindingRef++;return this.bindings.push({event:i,ref:r,callback:n}),r}off(i,n){this.bindings=this.bindings.filter(r=>!(r.event===i&&(typeof n>"u"||n===r.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(i,n,r=this.timeout){if(n=n||{},!this.joinedOnce)throw new Error(`tried to push '${i}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let l=new ko(this,i,function(){return n},r);return this.canPush()?l.send():(l.startTimeout(),this.pushBuffer.push(l)),l}leave(i=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=It.leaving;let n=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(ha.close,"leave")},r=new ko(this,ha.leave,Bs({}),i);return r.receive("ok",()=>n()).receive("timeout",()=>n()),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(i,n,r){return n}filterBindings(i,n,r){return!0}isMember(i,n,r,l){return this.topic!==i?!1:l&&l!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:i,event:n,payload:r,joinRef:l}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(i=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=It.joining,this.joinPush.resend(i))}trigger(i,n,r,l){let c=this.onMessage(i,n,r,l);if(n&&!c)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let d=this.bindings.filter(h=>h.event===i&&this.filterBindings(h,n,r));for(let h=0;h<d.length;h++)d[h].callback(c,r,l||this.joinRef())}replyEventName(i){return`chan_reply_${i}`}isClosed(){return this.state===It.closed}isErrored(){return this.state===It.errored}isJoined(){return this.state===It.joined}isJoining(){return this.state===It.joining}isLeaving(){return this.state===It.leaving}},Do=class{static request(i,n,r,l,c,d,h){if(Rn.XDomainRequest){let m=new Rn.XDomainRequest;return this.xdomainRequest(m,i,n,l,c,d,h)}else if(Rn.XMLHttpRequest){let m=new Rn.XMLHttpRequest;return this.xhrRequest(m,i,n,r,l,c,d,h)}else{if(Rn.fetch&&Rn.AbortController)return this.fetchRequest(i,n,r,l,c,d,h);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(i,n,r,l,c,d,h){let m={method:i,headers:r,body:l},g=null;return c&&(g=new AbortController,setTimeout(()=>g.abort(),c),m.signal=g.signal),Rn.fetch(n,m).then(p=>p.text()).then(p=>this.parseJSON(p)).then(p=>h&&h(p)).catch(p=>{p.name==="AbortError"&&d?d():h&&h(null)}),g}static xdomainRequest(i,n,r,l,c,d,h){return i.timeout=c,i.open(n,r),i.onload=()=>{let m=this.parseJSON(i.responseText);h&&h(m)},d&&(i.ontimeout=d),i.onprogress=()=>{},i.send(l),i}static xhrRequest(i,n,r,l,c,d,h,m){i.open(n,r,!0),i.timeout=d;for(let[g,p]of Object.entries(l))i.setRequestHeader(g,p);return i.onerror=()=>m&&m(null),i.onreadystatechange=()=>{if(i.readyState===xb.complete&&m){let g=this.parseJSON(i.responseText);m(g)}},h&&(i.ontimeout=h),i.send(c),i}static parseJSON(i){if(!i||i==="")return null;try{return JSON.parse(i)}catch{return console&&console.log("failed to parse JSON response",i),null}}static serialize(i,n){let r=[];for(var l in i){if(!Object.prototype.hasOwnProperty.call(i,l))continue;let c=n?`${n}[${l}]`:l,d=i[l];typeof d=="object"?r.push(this.serialize(d,c)):r.push(encodeURIComponent(c)+"="+encodeURIComponent(d))}return r.join("&")}static appendParams(i,n){if(Object.keys(n).length===0)return i;let r=i.match(/\?/)?"&":"?";return`${i}${r}${this.serialize(n)}`}},Ob=i=>{let n="",r=new Uint8Array(i),l=r.byteLength;for(let c=0;c<l;c++)n+=String.fromCharCode(r[c]);return btoa(n)},cr=class{constructor(i,n){n&&n.length===2&&n[1].startsWith(Od)&&(this.authToken=atob(n[1].slice(Od.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(i),this.readyState=jn.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(i){return i.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Cd.websocket),"$1/"+Cd.longpoll)}endpointURL(){return Do.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(i,n,r){this.close(i,n,r),this.readyState=jn.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===jn.open||this.readyState===jn.connecting}poll(){const i={Accept:"application/json"};this.authToken&&(i["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",i,null,()=>this.ontimeout(),n=>{if(n){var{status:r,token:l,messages:c}=n;if(r===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=l}else r=0;switch(r){case 200:c.forEach(d=>{setTimeout(()=>this.onmessage({data:d}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=jn.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${r}`)}})}send(i){typeof i!="string"&&(i=Ob(i)),this.currentBatch?this.currentBatch.push(i):this.awaitingBatchAck?this.batchBuffer.push(i):(this.currentBatch=[i],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(i){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},i.join(`
15
- `),()=>this.onerror("timeout"),n=>{this.awaitingBatchAck=!1,!n||n.status!==200?(this.onerror(n&&n.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(i,n,r){for(let c of this.reqs)c.abort();this.readyState=jn.closed;let l=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:i,reason:n,wasClean:r});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",l)):this.onclose(l)}ajax(i,n,r,l,c){let d,h=()=>{this.reqs.delete(d),l()};d=Do.request(i,this.endpointURL(),n,r,this.timeout,h,m=>{this.reqs.delete(d),this.isActive()&&c(m)}),this.reqs.add(d)}},Rb=class Us{constructor(n,r={}){let l=r.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=n,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(l.state,c=>{let{onJoin:d,onLeave:h,onSync:m}=this.caller;this.joinRef=this.channel.joinRef(),this.state=Us.syncState(this.state,c,d,h),this.pendingDiffs.forEach(g=>{this.state=Us.syncDiff(this.state,g,d,h)}),this.pendingDiffs=[],m()}),this.channel.on(l.diff,c=>{let{onJoin:d,onLeave:h,onSync:m}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(c):(this.state=Us.syncDiff(this.state,c,d,h),m())})}onJoin(n){this.caller.onJoin=n}onLeave(n){this.caller.onLeave=n}onSync(n){this.caller.onSync=n}list(n){return Us.list(this.state,n)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(n,r,l,c){let d=this.clone(n),h={},m={};return this.map(d,(g,p)=>{r[g]||(m[g]=p)}),this.map(r,(g,p)=>{let S=d[g];if(S){let b=p.metas.map(U=>U.phx_ref),T=S.metas.map(U=>U.phx_ref),A=p.metas.filter(U=>T.indexOf(U.phx_ref)<0),C=S.metas.filter(U=>b.indexOf(U.phx_ref)<0);A.length>0&&(h[g]=p,h[g].metas=A),C.length>0&&(m[g]=this.clone(S),m[g].metas=C)}else h[g]=p}),this.syncDiff(d,{joins:h,leaves:m},l,c)}static syncDiff(n,r,l,c){let{joins:d,leaves:h}=this.clone(r);return l||(l=function(){}),c||(c=function(){}),this.map(d,(m,g)=>{let p=n[m];if(n[m]=this.clone(g),p){let S=n[m].metas.map(T=>T.phx_ref),b=p.metas.filter(T=>S.indexOf(T.phx_ref)<0);n[m].metas.unshift(...b)}l(m,p,g)}),this.map(h,(m,g)=>{let p=n[m];if(!p)return;let S=g.metas.map(b=>b.phx_ref);p.metas=p.metas.filter(b=>S.indexOf(b.phx_ref)<0),c(m,p,g),p.metas.length===0&&delete n[m]}),n}static list(n,r){return r||(r=function(l,c){return c}),this.map(n,(l,c)=>r(l,c))}static map(n,r){return Object.getOwnPropertyNames(n).map(l=>r(l,n[l]))}static clone(n){return JSON.parse(JSON.stringify(n))}},Eo={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(i,n){if(i.payload.constructor===ArrayBuffer)return n(this.binaryEncode(i));{let r=[i.join_ref,i.ref,i.topic,i.event,i.payload];return n(JSON.stringify(r))}},decode(i,n){if(i.constructor===ArrayBuffer)return n(this.binaryDecode(i));{let[r,l,c,d,h]=JSON.parse(i);return n({join_ref:r,ref:l,topic:c,event:d,payload:h})}},binaryEncode(i){let{join_ref:n,ref:r,event:l,topic:c,payload:d}=i,h=this.META_LENGTH+n.length+r.length+c.length+l.length,m=new ArrayBuffer(this.HEADER_LENGTH+h),g=new DataView(m),p=0;g.setUint8(p++,this.KINDS.push),g.setUint8(p++,n.length),g.setUint8(p++,r.length),g.setUint8(p++,c.length),g.setUint8(p++,l.length),Array.from(n,b=>g.setUint8(p++,b.charCodeAt(0))),Array.from(r,b=>g.setUint8(p++,b.charCodeAt(0))),Array.from(c,b=>g.setUint8(p++,b.charCodeAt(0))),Array.from(l,b=>g.setUint8(p++,b.charCodeAt(0)));var S=new Uint8Array(m.byteLength+d.byteLength);return S.set(new Uint8Array(m),0),S.set(new Uint8Array(d),m.byteLength),S.buffer},binaryDecode(i){let n=new DataView(i),r=n.getUint8(0),l=new TextDecoder;switch(r){case this.KINDS.push:return this.decodePush(i,n,l);case this.KINDS.reply:return this.decodeReply(i,n,l);case this.KINDS.broadcast:return this.decodeBroadcast(i,n,l)}},decodePush(i,n,r){let l=n.getUint8(1),c=n.getUint8(2),d=n.getUint8(3),h=this.HEADER_LENGTH+this.META_LENGTH-1,m=r.decode(i.slice(h,h+l));h=h+l;let g=r.decode(i.slice(h,h+c));h=h+c;let p=r.decode(i.slice(h,h+d));h=h+d;let S=i.slice(h,i.byteLength);return{join_ref:m,ref:null,topic:g,event:p,payload:S}},decodeReply(i,n,r){let l=n.getUint8(1),c=n.getUint8(2),d=n.getUint8(3),h=n.getUint8(4),m=this.HEADER_LENGTH+this.META_LENGTH,g=r.decode(i.slice(m,m+l));m=m+l;let p=r.decode(i.slice(m,m+c));m=m+c;let S=r.decode(i.slice(m,m+d));m=m+d;let b=r.decode(i.slice(m,m+h));m=m+h;let T=i.slice(m,i.byteLength),A={status:b,response:T};return{join_ref:g,ref:p,topic:S,event:ha.reply,payload:A}},decodeBroadcast(i,n,r){let l=n.getUint8(1),c=n.getUint8(2),d=this.HEADER_LENGTH+2,h=r.decode(i.slice(d,d+l));d=d+l;let m=r.decode(i.slice(d,d+c));d=d+c;let g=i.slice(d,i.byteLength);return{join_ref:null,ref:null,topic:h,event:m,payload:g}}},jb=class{constructor(i,n={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=n.timeout||Eb,this.transport=n.transport||Rn.WebSocket||cr,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=n.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=Rn&&Rn.sessionStorage}catch{}this.sessionStore=n.sessionStorage||r,this.establishedConnections=0,this.defaultEncoder=Eo.encode.bind(Eo),this.defaultDecoder=Eo.decode.bind(Eo),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=n.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==cr?(this.encode=n.encode||this.defaultEncoder,this.decode=n.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let l=null;br&&br.addEventListener&&(br.addEventListener("pagehide",c=>{this.conn&&(this.disconnect(),l=this.connectClock)}),br.addEventListener("pageshow",c=>{l===this.connectClock&&(l=null,this.connect())}),br.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=n.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=n.autoSendHeartbeat??!0,this.heartbeatCallback=n.heartbeatCallback??(()=>{}),this.rejoinAfterMs=c=>n.rejoinAfterMs?n.rejoinAfterMs(c):[1e3,2e3,5e3][c-1]||1e4,this.reconnectAfterMs=c=>n.reconnectAfterMs?n.reconnectAfterMs(c):[10,50,100,150,200,250,500,1e3,2e3][c-1]||5e3,this.logger=n.logger||null,!this.logger&&n.debug&&(this.logger=(c,d,h)=>{console.log(`${c}: ${d}`,h)}),this.longpollerTimeout=n.longpollerTimeout||2e4,this.params=Bs(n.params||{}),this.endPoint=`${i}/${Cd.websocket}`,this.vsn=n.vsn||kb,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Np(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{n.beforeReconnect&&await n.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=n.authToken}getLongPollTransport(){return cr}replaceTransport(i){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=i}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let i=Do.appendParams(Do.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return i.charAt(0)!=="/"?i:i.charAt(1)==="/"?`${this.protocol()}:${i}`:`${this.protocol()}://${location.host}${i}`}disconnect(i,n,r){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,i&&i()},n,r)}connect(i){i&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=Bs(i)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==cr?this.connectWithFallback(cr,this.longPollFallbackMs):this.transportConnect())}log(i,n,r){this.logger&&this.logger(i,n,r)}hasLogger(){return this.logger!==null}onOpen(i){let n=this.makeRef();return this.stateChangeCallbacks.open.push([n,i]),n}onClose(i){let n=this.makeRef();return this.stateChangeCallbacks.close.push([n,i]),n}onError(i){let n=this.makeRef();return this.stateChangeCallbacks.error.push([n,i]),n}onMessage(i){let n=this.makeRef();return this.stateChangeCallbacks.message.push([n,i]),n}onHeartbeat(i){this.heartbeatCallback=i}ping(i){if(!this.isConnected())return!1;let n=this.makeRef(),r=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:n});let l=this.onMessage(c=>{c.ref===n&&(this.off([l]),i(Date.now()-r))});return!0}transportName(i){return i===cr?"LongPoll":i.name}transportConnect(){this.connectClock++,this.closeWasClean=!1;let i;this.authToken&&(i=["phoenix",`${Od}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),i),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=n=>this.onConnError(n),this.conn.onmessage=n=>this.onConnMessage(n),this.conn.onclose=n=>this.onConnClose(n)}getSession(i){return this.sessionStore&&this.sessionStore.getItem(i)}storeSession(i,n){this.sessionStore&&this.sessionStore.setItem(i,n)}connectWithFallback(i,n=2500){clearTimeout(this.fallbackTimer);let r=!1,l=!0,c,d,h=this.transportName(i),m=g=>{this.log("transport",`falling back to ${h}...`,g),this.off([c,d]),l=!1,this.replaceTransport(i),this.transportConnect()};if(this.getSession(`phx:fallback:${h}`))return m("memorized");this.fallbackTimer=setTimeout(m,n),d=this.onError(g=>{this.log("transport","error",g),l&&!r&&(clearTimeout(this.fallbackTimer),m(g))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(r=!0,!l){let g=this.transportName(i);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${g}`,"true"),this.log("transport",`established ${g} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(m,n),this.ping(g=>{this.log("transport","connected to primary after",g),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(i){this.log("error","error in heartbeat callback",i)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),Ab,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(i,n,r){if(!this.conn)return i&&i();const l=this.conn;this.waitForBufferDone(l,()=>{n?l.close(n,r||""):l.close(),this.waitForSocketClosed(l,()=>{this.conn===l&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),i&&i()})})}waitForBufferDone(i,n,r=1){if(r===5||!i.bufferedAmount){n();return}setTimeout(()=>{this.waitForBufferDone(i,n,r+1)},150*r)}waitForSocketClosed(i,n,r=1){if(r===5||i.readyState===jn.closed){n();return}setTimeout(()=>{this.waitForSocketClosed(i,n,r+1)},150*r)}onConnClose(i){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",i),this.triggerChanError(i),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",i)}onConnError(i){this.hasLogger()&&this.log("transport","error",i);let n=this.transport,r=this.establishedConnections;this.triggerStateCallbacks("error",i,n,r),(n===this.transport||r>0)&&this.triggerChanError(i)}triggerChanError(i){this.channels.forEach(n=>{n.isErrored()||n.isLeaving()||n.isClosed()||n.trigger(ha.error,i)})}connectionState(){switch(this.conn&&this.conn.readyState){case jn.connecting:return"connecting";case jn.open:return"open";case jn.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(i){this.off(i.stateChangeRefs),this.channels=this.channels.filter(n=>n!==i)}off(i){for(let n in this.stateChangeCallbacks)this.stateChangeCallbacks[n]=this.stateChangeCallbacks[n].filter(([r])=>i.indexOf(r)===-1)}channel(i,n={}){let r=new Cb(i,n,this);return this.channels.push(r),r}push(i){if(this.hasLogger()){let{topic:n,event:r,payload:l,ref:c,join_ref:d}=i;this.log("push",`${n} ${r} (${d}, ${c})`,l)}this.isConnected()?this.encode(i,n=>this.conn.send(n)):this.sendBuffer.push(()=>this.encode(i,n=>this.conn.send(n)))}makeRef(){let i=this.ref+1;return i===this.ref?this.ref=0:this.ref=i,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(i){this.log("error","error in heartbeat callback",i)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(i){this.log("error","error in heartbeat callback",i)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(i=>i()),this.sendBuffer=[])}onConnMessage(i){this.decode(i.data,n=>{let{topic:r,event:l,payload:c,ref:d,join_ref:h}=n;if(d&&d===this.pendingHeartbeatRef){const m=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(c.status==="ok"?"ok":"error",m)}catch(g){this.log("error","error in heartbeat callback",g)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${c.status||""} ${r} ${l} ${d&&"("+d+")"||""}`.trim(),c);for(let m=0;m<this.channels.length;m++){const g=this.channels[m];g.isMember(r,l,c,h)&&g.trigger(l,c,d,h)}this.triggerStateCallbacks("message",n)})}triggerStateCallbacks(i,...n){try{this.stateChangeCallbacks[i].forEach(([r,l])=>{try{l(...n)}catch(c){this.log("error",`error in ${i} callback`,c)}})}catch(r){this.log("error",`error triggering ${i} callbacks`,r)}}leaveOpenTopic(i){let n=this.channels.find(r=>r.topic===i&&(r.isJoined()||r.isJoining()));n&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${i}"`),n.leave())}};class Hs{constructor(n,r){const l=Lb(r);this.presence=new Rb(n.getChannel(),l),this.presence.onJoin((c,d,h)=>{const m=Hs.onJoinPayload(c,d,h);n.getChannel().trigger("presence",m)}),this.presence.onLeave((c,d,h)=>{const m=Hs.onLeavePayload(c,d,h);n.getChannel().trigger("presence",m)}),this.presence.onSync(()=>{n.getChannel().trigger("presence",{event:"sync"})})}get state(){return Hs.transformState(this.presence.state)}static transformState(n){return n=Nb(n),Object.getOwnPropertyNames(n).reduce((r,l)=>{const c=n[l];return r[l]=No(c),r},{})}static onJoinPayload(n,r,l){const c=$g(r),d=No(l);return{event:"join",key:n,currentPresences:c,newPresences:d}}static onLeavePayload(n,r,l){const c=$g(r),d=No(l);return{event:"leave",key:n,currentPresences:c,leftPresences:d}}}function No(i){return i.metas.map(n=>(n.presence_ref=n.phx_ref,delete n.phx_ref,delete n.phx_ref_prev,n))}function Nb(i){return JSON.parse(JSON.stringify(i))}function Lb(i){return i?.events&&{events:i.events}}function $g(i){return i?.metas?No(i):[]}var Pg;(function(i){i.SYNC="sync",i.JOIN="join",i.LEAVE="leave"})(Pg||(Pg={}));class Db{get state(){return this.presenceAdapter.state}constructor(n,r){this.channel=n,this.presenceAdapter=new Hs(this.channel.channelAdapter,r)}}function Ub(i){if(i instanceof Error)return i;if(typeof i=="string")return new Error(i);if(i&&typeof i=="object"){const n=i;if(typeof n.code=="number"){const r=typeof n.reason=="string"&&n.reason?` (${n.reason})`:"";return new Error(`socket closed: ${n.code}${r}`,{cause:i})}return new Error("channel error: transport failure",{cause:i})}return new Error("channel error: connection lost")}class Mb{constructor(n,r,l){const c=zb(l);this.channel=n.getSocket().channel(r,c),this.socket=n}get state(){return this.channel.state}set state(n){this.channel.state=n}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(n,r){return this.channel.on(n,r)}off(n,r){this.channel.off(n,r)}subscribe(n){return this.channel.join(n)}unsubscribe(n){return this.channel.leave(n)}teardown(){this.channel.teardown()}onClose(n){this.channel.onClose(n)}onError(n){return this.channel.onError(n)}push(n,r,l){let c;try{c=this.channel.push(n,r,l)}catch{throw new Error(`tried to push '${n}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>gb){const d=this.channel.pushBuffer.shift();d.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${d.event}`,d.payload())}return c}updateJoinPayload(n){const r=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},r),n)}canPush(){return this.socket.isConnected()&&this.state===Ka.joined}isJoined(){return this.state===Ka.joined}isJoining(){return this.state===Ka.joining}isClosed(){return this.state===Ka.closed}isLeaving(){return this.state===Ka.leaving}updateFilterBindings(n){this.channel.filterBindings=n}updatePayloadTransform(n){this.channel.onMessage=n}getChannel(){return this.channel}}function zb(i){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},i.config)}}const Bb=/[,()"\\]/,Hb=i=>Bb.test(i)||i!==i.trim(),qb=i=>`"${i.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,Ig=i=>{const n=i===null?"null":String(i);return Hb(n)?qb(n):n},$b=i=>i===null?"null":String(i),Pb=(i,n)=>{if(i==="in"){const r=Array.isArray(n)?n:[n];if(r.length===0)throw new Error("Realtime `in` filter requires at least one value.");return`in.(${Array.from(new Set(r)).map(c=>Ig(c)).join(",")})`}return i==="is"?`is.${$b(n)}`:`${i}.${Ig(n)}`};class Ib{constructor(){this.filters=[]}add(n,r,l,c=!1){const d=c?"not.":"";return this.filters.push(`${n}=${d}${Pb(r,l)}`),this}eq(n,r){return this.add(n,"eq",r)}neq(n,r){return this.add(n,"neq",r)}gt(n,r){return this.add(n,"gt",r)}gte(n,r){return this.add(n,"gte",r)}lt(n,r){return this.add(n,"lt",r)}lte(n,r){return this.add(n,"lte",r)}in(n,r){return this.add(n,"in",r)}like(n,r){return this.add(n,"like",r)}ilike(n,r){return this.add(n,"ilike",r)}match(n,r){return this.add(n,"match",r)}imatch(n,r){return this.add(n,"imatch",r)}is(n,r){return this.add(n,"is",r)}isDistinct(n,r){return this.add(n,"isdistinct",r)}not(n,r,l){return this.add(n,r,l,!0)}build(){return this.filters.join(",")}toString(){return this.build()}}var Gg;(function(i){i.ALL="*",i.INSERT="INSERT",i.UPDATE="UPDATE",i.DELETE="DELETE"})(Gg||(Gg={}));var Tr;(function(i){i.BROADCAST="broadcast",i.PRESENCE="presence",i.POSTGRES_CHANGES="postgres_changes",i.SYSTEM="system"})(Tr||(Tr={}));var fa;(function(i){i.SUBSCRIBED="SUBSCRIBED",i.TIMED_OUT="TIMED_OUT",i.CLOSED="CLOSED",i.CHANNEL_ERROR="CHANNEL_ERROR"})(fa||(fa={}));class qs{get state(){return this.channelAdapter.state}set state(n){this.channelAdapter.state=n}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(n,r={config:{}},l){var c,d;if(this.topic=n,this.params=r,this.socket=l,this.bindings={},this.subTopic=n.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.channelAdapter=new Mb(this.socket.socketAdapter,n,this.params),this.presence=new Db(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=jp(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((d=(c=this.params.config)===null||c===void 0?void 0:c.broadcast)===null||d===void 0)&&d.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(n,r=this.timeout){var l,c,d;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:h,presence:m,private:g}}=this.params,p=(c=(l=this.bindings.postgres_changes)===null||l===void 0?void 0:l.map(A=>A.filter))!==null&&c!==void 0?c:[],S=!!this.bindings[Tr.PRESENCE]&&this.bindings[Tr.PRESENCE].length>0||((d=this.params.config.presence)===null||d===void 0?void 0:d.enabled)===!0,b={},T={broadcast:h,presence:Object.assign(Object.assign({},m),{enabled:S}),postgres_changes:p,private:g};this.socket.accessTokenValue&&(b.access_token=this.socket.accessTokenValue),this._onError(A=>{n?.(fa.CHANNEL_ERROR,Ub(A))}),this._onClose(()=>n?.(fa.CLOSED)),this.updateJoinPayload(Object.assign({config:T},b)),this._updateFilterMessage(),this.channelAdapter.subscribe(r).receive("ok",async({postgres_changes:A})=>{if(this.socket._isManualToken()||this.socket.setAuth(),A===void 0){n?.(fa.SUBSCRIBED);return}this._updatePostgresBindings(A,n)}).receive("error",A=>{this.state=Ka.errored;const C=Object.values(A).join(", ")||"error";n?.(fa.CHANNEL_ERROR,new Error(C,{cause:A}))}).receive("timeout",()=>{n?.(fa.TIMED_OUT)})}return this}_updatePostgresBindings(n,r){var l;const c=this.bindings.postgres_changes,d=(l=c?.length)!==null&&l!==void 0?l:0,h=[];for(let m=0;m<d;m++){const g=c[m],{filter:{event:p,schema:S,table:b,filter:T}}=g,A=n&&n[m];if(A&&A.event===p&&qs.isFilterValueEqual(A.schema,S)&&qs.isFilterValueEqual(A.table,b)&&qs.isFilterValueEqual(A.filter,T))h.push(Object.assign(Object.assign({},g),{id:A.id}));else{this.unsubscribe(),this.state=Ka.errored,r?.(fa.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=h,this.state!=Ka.errored&&r&&r(fa.SUBSCRIBED)}presenceState(){return this.presence.state}async track(n,r={}){return await this.send({type:"presence",event:"track",payload:n},r.timeout||this.timeout)}async untrack(n={}){return await this.send({type:"presence",event:"untrack"},n)}on(n,r,l){const c=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),d=n===Tr.PRESENCE||n===Tr.POSTGRES_CHANGES;if(c&&d)throw this.socket.log("channel",`cannot add \`${n}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${n}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(n,r,l)}async httpSend(n,r,l={}){var c;if(r==null)return Promise.reject(new Error("Payload is required for httpSend()"));const d=r instanceof ArrayBuffer||ArrayBuffer.isView(r),h={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":d?"application/octet-stream":"application/json"};this.socket.accessTokenValue&&(h.Authorization=`Bearer ${this.socket.accessTokenValue}`);const m=new URL(this.broadcastEndpointURL);m.pathname+=`/${encodeURIComponent(this.subTopic)}/events/${encodeURIComponent(n)}`,this.private&&m.searchParams.set("private","true");const g={method:"POST",headers:h,body:d?r:JSON.stringify(r)},p=await this._fetchWithTimeout(m.toString(),g,(c=l.timeout)!==null&&c!==void 0?c:this.timeout);if(p.status===202)return{success:!0};if(p.status===404)return Promise.reject(new Error("httpSend() requires Realtime server v2.97.0 or newer; the endpoint returned 404. Update your Supabase CLI to a recent version, or upgrade the Realtime server in your self-hosted setup. See https://github.com/supabase/supabase-js/blob/master/packages/core/realtime-js/migrations/httpsend-server-version.md"));let S=p.statusText;try{const b=await p.json();S=b.error||b.message||S}catch{}return Promise.reject(new Error(S))}async send(n,r={}){var l,c;if(!this.channelAdapter.canPush()&&n.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:d,payload:h}=n,m={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(m.Authorization=`Bearer ${this.socket.accessTokenValue}`);const g={method:"POST",headers:m,body:JSON.stringify({messages:[{topic:this.subTopic,event:d,payload:h,private:this.private}]})};try{const p=await this._fetchWithTimeout(this.broadcastEndpointURL,g,(l=r.timeout)!==null&&l!==void 0?l:this.timeout);return await((c=p.body)===null||c===void 0?void 0:c.cancel()),p.ok?"ok":"error"}catch(p){return p instanceof Error&&p.name==="AbortError"?"timed out":"error"}}else return new Promise(d=>{var h,m,g;const p=this.channelAdapter.push(n.type,n,r.timeout||this.timeout);n.type==="broadcast"&&!(!((g=(m=(h=this.params)===null||h===void 0?void 0:h.config)===null||m===void 0?void 0:m.broadcast)===null||g===void 0)&&g.ack)&&d("ok"),p.receive("ok",()=>d("ok")),p.receive("error",()=>d("error")),p.receive("timeout",()=>d("timed out"))})}updateJoinPayload(n){this.channelAdapter.updateJoinPayload(n)}async unsubscribe(n=this.timeout){return new Promise(r=>{this.channelAdapter.unsubscribe(n).receive("ok",()=>r("ok")).receive("timeout",()=>r("timed out")).receive("error",()=>r("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(n,r,l){const c=new AbortController,d=setTimeout(()=>c.abort(),l),h=await this.socket.fetch(n,Object.assign(Object.assign({},r),{signal:c.signal}));return clearTimeout(d),h}_on(n,r,l){const c=n.toLocaleLowerCase(),d=r?.filter;(d instanceof Ib||typeof d=="object"&&d!==null&&typeof d.build=="function")&&(r=Object.assign(Object.assign({},r),{filter:d.build()}));const h=this.channelAdapter.on(n,l),m={type:c,filter:r,callback:l,ref:h};return this.bindings[c]?this.bindings[c].push(m):this.bindings[c]=[m],this._updateFilterMessage(),this}_onClose(n){this.channelAdapter.onClose(n)}_onError(n){this.channelAdapter.onError(n)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((n,r,l)=>{var c,d,h,m,g,p,S;const b=n.event.toLocaleLowerCase();if(this._notThisChannelEvent(b,l))return!1;const T=(c=this.bindings[b])===null||c===void 0?void 0:c.find(A=>A.ref===n.ref);if(!T)return!0;if(["broadcast","presence","postgres_changes"].includes(b))if("id"in T){const A=T.id,C=(d=T.filter)===null||d===void 0?void 0:d.event;return A&&((h=r.ids)===null||h===void 0?void 0:h.includes(A))&&(C==="*"||C?.toLocaleLowerCase()===((m=r.data)===null||m===void 0?void 0:m.type.toLocaleLowerCase()))}else{const A=(p=(g=T?.filter)===null||g===void 0?void 0:g.event)===null||p===void 0?void 0:p.toLocaleLowerCase();return A==="*"||A===((S=r?.event)===null||S===void 0?void 0:S.toLocaleLowerCase())}else return T.type.toLocaleLowerCase()===b})}_notThisChannelEvent(n,r){const{close:l,error:c,leave:d,join:h}=Op;return r&&[l,c,d,h].includes(n)&&r!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((n,r,l)=>{if(typeof r=="object"&&"ids"in r){const c=r.data,{schema:d,table:h,commit_timestamp:m,type:g,errors:p}=c;return Object.assign(Object.assign({},{schema:d,table:h,commit_timestamp:m,eventType:g,new:{},old:{},errors:p}),this._getPayloadRecords(c))}return r})}copyBindings(n){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const r in n.bindings)for(const l of n.bindings[r])this._on(l.type,l.filter,l.callback)}static isFilterValueEqual(n,r){return(n??void 0)===(r??void 0)}_getPayloadRecords(n){const r={new:{},old:{}};return(n.type==="INSERT"||n.type==="UPDATE")&&(r.new=qg(n.columns,n.record)),(n.type==="UPDATE"||n.type==="DELETE")&&(r.old=qg(n.columns,n.old_record)),r}}class Gb{constructor(n,r){this.socket=new jb(n,r)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(n){this.socket.heartbeatCallback=n}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(n,r,l,c=1e4){return new Promise(d=>{setTimeout(()=>d("timeout"),c),this.socket.disconnect(()=>{n(),d("ok")},r,l)})}push(n){this.socket.push(n)}log(n,r,l){this.socket.log(n,r,l)}makeRef(){return this.socket.makeRef()}onOpen(n){this.socket.onOpen(n)}onClose(n){this.socket.onClose(n)}onError(n){this.socket.onError(n)}onMessage(n){this.socket.onMessage(n)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==Ad.connecting}isDisconnecting(){return this.socket.connectionState()==Ad.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const Vg={HEARTBEAT_INTERVAL:25e3},Vb=[1e3,2e3,5e3,1e4],Kb=1e4;function Yb(){const i=new Map;return{get length(){return i.size},clear(){i.clear()},getItem(n){return i.has(n)?i.get(n):null},key(n){var r;return(r=Array.from(i.keys())[n])!==null&&r!==void 0?r:null},removeItem(n){i.delete(n)},setItem(n,r){i.set(n,String(r))}}}function Jb(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return Yb()}const Xb=`
14
+ Suggested solution: ${n.workaround}`),new Error(r)}static isWebSocketSupported(){try{return this.detectEnvironment().type==="native"}catch{return!1}}}const db="2.110.0",hb=`realtime-js/${db}`,fb="1.0.0",Cp="2.0.0",mb=Cp,gb=1e4,pb=100,Ka={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Op={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},Ad={connecting:"connecting",closing:"closing",closed:"closed"};class yb{constructor(n){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=n??[]}encode(n,r){if(n.event===this.BROADCAST_EVENT&&!(n.payload instanceof ArrayBuffer)&&typeof n.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(n));let l=[n.join_ref,n.ref,n.topic,n.event,n.payload];return r(JSON.stringify(l))}_binaryEncodeUserBroadcastPush(n){var r;return this._isArrayBuffer((r=n.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(n):this._encodeJsonUserBroadcastPush(n)}_encodeBinaryUserBroadcastPush(n){var r,l;const c=(l=(r=n.payload)===null||r===void 0?void 0:r.payload)!==null&&l!==void 0?l:new ArrayBuffer(0);return this._encodeUserBroadcastPush(n,this.BINARY_ENCODING,c)}_encodeJsonUserBroadcastPush(n){var r,l;const c=(l=(r=n.payload)===null||r===void 0?void 0:r.payload)!==null&&l!==void 0?l:{},h=new TextEncoder().encode(JSON.stringify(c)).buffer;return this._encodeUserBroadcastPush(n,this.JSON_ENCODING,h)}_encodeUserBroadcastPush(n,r,l){var c,d;const h=n.topic,m=(c=n.ref)!==null&&c!==void 0?c:"",g=(d=n.join_ref)!==null&&d!==void 0?d:"",p=n.payload.event,S=this.allowedMetadataKeys?this._pick(n.payload,this.allowedMetadataKeys):{},b=Object.keys(S).length===0?"":JSON.stringify(S);if(g.length>255)throw new Error(`joinRef length ${g.length} exceeds maximum of 255`);if(m.length>255)throw new Error(`ref length ${m.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`topic length ${h.length} exceeds maximum of 255`);if(p.length>255)throw new Error(`userEvent length ${p.length} exceeds maximum of 255`);if(b.length>255)throw new Error(`metadata length ${b.length} exceeds maximum of 255`);const T=this.USER_BROADCAST_PUSH_META_LENGTH+g.length+m.length+h.length+p.length+b.length,A=new ArrayBuffer(this.HEADER_LENGTH+T);let C=new DataView(A),U=0;C.setUint8(U++,this.KINDS.userBroadcastPush),C.setUint8(U++,g.length),C.setUint8(U++,m.length),C.setUint8(U++,h.length),C.setUint8(U++,p.length),C.setUint8(U++,b.length),C.setUint8(U++,r),Array.from(g,P=>C.setUint8(U++,P.charCodeAt(0))),Array.from(m,P=>C.setUint8(U++,P.charCodeAt(0))),Array.from(h,P=>C.setUint8(U++,P.charCodeAt(0))),Array.from(p,P=>C.setUint8(U++,P.charCodeAt(0))),Array.from(b,P=>C.setUint8(U++,P.charCodeAt(0)));var $=new Uint8Array(A.byteLength+l.byteLength);return $.set(new Uint8Array(A),0),$.set(new Uint8Array(l),A.byteLength),$.buffer}decode(n,r){if(this._isArrayBuffer(n)){let l=this._binaryDecode(n);return r(l)}if(typeof n=="string"){const l=JSON.parse(n),[c,d,h,m,g]=l;return r({join_ref:c,ref:d,topic:h,event:m,payload:g})}return r({})}_binaryDecode(n){const r=new DataView(n),l=r.getUint8(0),c=new TextDecoder;if(l===this.KINDS.userBroadcast)return this._decodeUserBroadcast(n,r,c)}_decodeUserBroadcast(n,r,l){const c=r.getUint8(1),d=r.getUint8(2),h=r.getUint8(3),m=r.getUint8(4);let g=this.HEADER_LENGTH+4;const p=l.decode(n.slice(g,g+c));g=g+c;const S=l.decode(n.slice(g,g+d));g=g+d;const b=l.decode(n.slice(g,g+h));g=g+h;const T=n.slice(g,n.byteLength),A=m===this.JSON_ENCODING?JSON.parse(l.decode(T)):T,C={type:this.BROADCAST_EVENT,event:S,payload:A};return h>0&&(C.meta=JSON.parse(b)),{join_ref:null,ref:null,topic:p,event:this.BROADCAST_EVENT,payload:C}}_isArrayBuffer(n){var r;return n instanceof ArrayBuffer||((r=n?.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}_pick(n,r){return!n||typeof n!="object"?{}:Object.fromEntries(Object.entries(n).filter(([l])=>r.includes(l)))}}var $e;(function(i){i.abstime="abstime",i.bool="bool",i.date="date",i.daterange="daterange",i.float4="float4",i.float8="float8",i.int2="int2",i.int4="int4",i.int4range="int4range",i.int8="int8",i.int8range="int8range",i.json="json",i.jsonb="jsonb",i.money="money",i.numeric="numeric",i.oid="oid",i.reltime="reltime",i.text="text",i.time="time",i.timestamp="timestamp",i.timestamptz="timestamptz",i.timetz="timetz",i.tsrange="tsrange",i.tstzrange="tstzrange"})($e||($e={}));const qg=(i,n,r={})=>{var l;const c=(l=r.skipTypes)!==null&&l!==void 0?l:[];return n?Object.keys(n).reduce((d,h)=>(d[h]=vb(h,i,n,c),d),{}):{}},vb=(i,n,r,l)=>{const c=n.find(m=>m.name===i),d=c?.type,h=r[i];return d&&!l.includes(d)?Rp(d,h):xd(h)},Rp=(i,n)=>{if(i.charAt(0)==="_"){const r=i.slice(1,i.length);return _b(n,r)}switch(i){case $e.bool:return bb(n);case $e.float4:case $e.float8:case $e.int2:case $e.int4:case $e.int8:case $e.numeric:case $e.oid:return Sb(n);case $e.json:case $e.jsonb:return wb(n);case $e.timestamp:return Tb(n);case $e.abstime:case $e.date:case $e.daterange:case $e.int4range:case $e.int8range:case $e.money:case $e.reltime:case $e.text:case $e.time:case $e.timestamptz:case $e.timetz:case $e.tsrange:case $e.tstzrange:return xd(n);default:return xd(n)}},xd=i=>i,bb=i=>{switch(i){case"t":return!0;case"f":return!1;default:return i}},Sb=i=>{if(typeof i=="string"){const n=parseFloat(i);if(!Number.isNaN(n))return n}return i},wb=i=>{if(typeof i=="string")try{return JSON.parse(i)}catch{return i}return i},_b=(i,n)=>{if(typeof i!="string")return i;const r=i.length-1,l=i[r];if(i[0]==="{"&&l==="}"){let d;const h=i.slice(1,r);try{d=JSON.parse("["+h+"]")}catch{d=h?h.split(","):[]}return d.map(m=>Rp(n,m))}return i},Tb=i=>typeof i=="string"?i.replace(" ","T"):i,jp=i=>{const n=new URL(i);return n.protocol=n.protocol.replace(/^ws/i,"http"),n.pathname=n.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),n.pathname===""||n.pathname==="/"?n.pathname="/api/broadcast":n.pathname=n.pathname+"/api/broadcast",n.href};var Bs=i=>typeof i=="function"?i:function(){return i},kb=typeof self<"u"?self:null,br=typeof window<"u"?window:null,Rn=kb||br||globalThis,Eb="2.0.0",Ab=1e4,xb=1e3,jn={connecting:0,open:1,closing:2,closed:3},It={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},ha={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Cd={longpoll:"longpoll",websocket:"websocket"},Cb={complete:4},Od="base64url.bearer.phx.",ko=class{constructor(i,n,r,l){this.channel=i,this.event=n,this.payload=r||function(){return{}},this.receivedResp=null,this.timeout=l,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(i){this.timeout=i,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(i,n){return this.hasReceived(i)&&n(this.receivedResp.response),this.recHooks.push({status:i,callback:n}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:i,response:n,_ref:r}){this.recHooks.filter(l=>l.status===i).forEach(l=>l.callback(n))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,i=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=i,this.matchReceive(i)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(i){return this.receivedResp&&this.receivedResp.status===i}trigger(i,n){this.channel.trigger(this.refEvent,{status:i,response:n})}},Np=class{constructor(i,n){this.callback=i,this.timerCalc=n,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},Ob=class{constructor(i,n,r){this.state=It.closed,this.topic=i,this.params=Bs(n||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new ko(this,ha.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Np(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=It.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(l=>l.send()),this.pushBuffer=[]}),this.joinPush.receive("error",l=>{this.state=It.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,l),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=It.closed,this.socket.remove(this)}),this.onError(l=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,l),this.isJoining()&&this.joinPush.reset(),this.state=It.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new ko(this,ha.leave,Bs({}),this.timeout).send(),this.state=It.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(ha.reply,(l,c)=>{this.trigger(this.replyEventName(c),l)})}join(i=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=i,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(i=>i.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=It.closed,this.bindings=[]}onClose(i){this.on(ha.close,i)}onError(i){return this.on(ha.error,n=>i(n))}on(i,n){let r=this.bindingRef++;return this.bindings.push({event:i,ref:r,callback:n}),r}off(i,n){this.bindings=this.bindings.filter(r=>!(r.event===i&&(typeof n>"u"||n===r.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(i,n,r=this.timeout){if(n=n||{},!this.joinedOnce)throw new Error(`tried to push '${i}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let l=new ko(this,i,function(){return n},r);return this.canPush()?l.send():(l.startTimeout(),this.pushBuffer.push(l)),l}leave(i=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=It.leaving;let n=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(ha.close,"leave")},r=new ko(this,ha.leave,Bs({}),i);return r.receive("ok",()=>n()).receive("timeout",()=>n()),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(i,n,r){return n}filterBindings(i,n,r){return!0}isMember(i,n,r,l){return this.topic!==i?!1:l&&l!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:i,event:n,payload:r,joinRef:l}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(i=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=It.joining,this.joinPush.resend(i))}trigger(i,n,r,l){let c=this.onMessage(i,n,r,l);if(n&&!c)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let d=this.bindings.filter(h=>h.event===i&&this.filterBindings(h,n,r));for(let h=0;h<d.length;h++)d[h].callback(c,r,l||this.joinRef())}replyEventName(i){return`chan_reply_${i}`}isClosed(){return this.state===It.closed}isErrored(){return this.state===It.errored}isJoined(){return this.state===It.joined}isJoining(){return this.state===It.joining}isLeaving(){return this.state===It.leaving}},Do=class{static request(i,n,r,l,c,d,h){if(Rn.XDomainRequest){let m=new Rn.XDomainRequest;return this.xdomainRequest(m,i,n,l,c,d,h)}else if(Rn.XMLHttpRequest){let m=new Rn.XMLHttpRequest;return this.xhrRequest(m,i,n,r,l,c,d,h)}else{if(Rn.fetch&&Rn.AbortController)return this.fetchRequest(i,n,r,l,c,d,h);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(i,n,r,l,c,d,h){let m={method:i,headers:r,body:l},g=null;return c&&(g=new AbortController,setTimeout(()=>g.abort(),c),m.signal=g.signal),Rn.fetch(n,m).then(p=>p.text()).then(p=>this.parseJSON(p)).then(p=>h&&h(p)).catch(p=>{p.name==="AbortError"&&d?d():h&&h(null)}),g}static xdomainRequest(i,n,r,l,c,d,h){return i.timeout=c,i.open(n,r),i.onload=()=>{let m=this.parseJSON(i.responseText);h&&h(m)},d&&(i.ontimeout=d),i.onprogress=()=>{},i.send(l),i}static xhrRequest(i,n,r,l,c,d,h,m){i.open(n,r,!0),i.timeout=d;for(let[g,p]of Object.entries(l))i.setRequestHeader(g,p);return i.onerror=()=>m&&m(null),i.onreadystatechange=()=>{if(i.readyState===Cb.complete&&m){let g=this.parseJSON(i.responseText);m(g)}},h&&(i.ontimeout=h),i.send(c),i}static parseJSON(i){if(!i||i==="")return null;try{return JSON.parse(i)}catch{return console&&console.log("failed to parse JSON response",i),null}}static serialize(i,n){let r=[];for(var l in i){if(!Object.prototype.hasOwnProperty.call(i,l))continue;let c=n?`${n}[${l}]`:l,d=i[l];typeof d=="object"?r.push(this.serialize(d,c)):r.push(encodeURIComponent(c)+"="+encodeURIComponent(d))}return r.join("&")}static appendParams(i,n){if(Object.keys(n).length===0)return i;let r=i.match(/\?/)?"&":"?";return`${i}${r}${this.serialize(n)}`}},Rb=i=>{let n="",r=new Uint8Array(i),l=r.byteLength;for(let c=0;c<l;c++)n+=String.fromCharCode(r[c]);return btoa(n)},cr=class{constructor(i,n){n&&n.length===2&&n[1].startsWith(Od)&&(this.authToken=atob(n[1].slice(Od.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(i),this.readyState=jn.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(i){return i.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Cd.websocket),"$1/"+Cd.longpoll)}endpointURL(){return Do.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(i,n,r){this.close(i,n,r),this.readyState=jn.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===jn.open||this.readyState===jn.connecting}poll(){const i={Accept:"application/json"};this.authToken&&(i["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",i,null,()=>this.ontimeout(),n=>{if(n){var{status:r,token:l,messages:c}=n;if(r===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=l}else r=0;switch(r){case 200:c.forEach(d=>{setTimeout(()=>this.onmessage({data:d}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=jn.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${r}`)}})}send(i){typeof i!="string"&&(i=Rb(i)),this.currentBatch?this.currentBatch.push(i):this.awaitingBatchAck?this.batchBuffer.push(i):(this.currentBatch=[i],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(i){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},i.join(`
15
+ `),()=>this.onerror("timeout"),n=>{this.awaitingBatchAck=!1,!n||n.status!==200?(this.onerror(n&&n.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(i,n,r){for(let c of this.reqs)c.abort();this.readyState=jn.closed;let l=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:i,reason:n,wasClean:r});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",l)):this.onclose(l)}ajax(i,n,r,l,c){let d,h=()=>{this.reqs.delete(d),l()};d=Do.request(i,this.endpointURL(),n,r,this.timeout,h,m=>{this.reqs.delete(d),this.isActive()&&c(m)}),this.reqs.add(d)}},jb=class Us{constructor(n,r={}){let l=r.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=n,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(l.state,c=>{let{onJoin:d,onLeave:h,onSync:m}=this.caller;this.joinRef=this.channel.joinRef(),this.state=Us.syncState(this.state,c,d,h),this.pendingDiffs.forEach(g=>{this.state=Us.syncDiff(this.state,g,d,h)}),this.pendingDiffs=[],m()}),this.channel.on(l.diff,c=>{let{onJoin:d,onLeave:h,onSync:m}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(c):(this.state=Us.syncDiff(this.state,c,d,h),m())})}onJoin(n){this.caller.onJoin=n}onLeave(n){this.caller.onLeave=n}onSync(n){this.caller.onSync=n}list(n){return Us.list(this.state,n)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(n,r,l,c){let d=this.clone(n),h={},m={};return this.map(d,(g,p)=>{r[g]||(m[g]=p)}),this.map(r,(g,p)=>{let S=d[g];if(S){let b=p.metas.map(U=>U.phx_ref),T=S.metas.map(U=>U.phx_ref),A=p.metas.filter(U=>T.indexOf(U.phx_ref)<0),C=S.metas.filter(U=>b.indexOf(U.phx_ref)<0);A.length>0&&(h[g]=p,h[g].metas=A),C.length>0&&(m[g]=this.clone(S),m[g].metas=C)}else h[g]=p}),this.syncDiff(d,{joins:h,leaves:m},l,c)}static syncDiff(n,r,l,c){let{joins:d,leaves:h}=this.clone(r);return l||(l=function(){}),c||(c=function(){}),this.map(d,(m,g)=>{let p=n[m];if(n[m]=this.clone(g),p){let S=n[m].metas.map(T=>T.phx_ref),b=p.metas.filter(T=>S.indexOf(T.phx_ref)<0);n[m].metas.unshift(...b)}l(m,p,g)}),this.map(h,(m,g)=>{let p=n[m];if(!p)return;let S=g.metas.map(b=>b.phx_ref);p.metas=p.metas.filter(b=>S.indexOf(b.phx_ref)<0),c(m,p,g),p.metas.length===0&&delete n[m]}),n}static list(n,r){return r||(r=function(l,c){return c}),this.map(n,(l,c)=>r(l,c))}static map(n,r){return Object.getOwnPropertyNames(n).map(l=>r(l,n[l]))}static clone(n){return JSON.parse(JSON.stringify(n))}},Eo={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(i,n){if(i.payload.constructor===ArrayBuffer)return n(this.binaryEncode(i));{let r=[i.join_ref,i.ref,i.topic,i.event,i.payload];return n(JSON.stringify(r))}},decode(i,n){if(i.constructor===ArrayBuffer)return n(this.binaryDecode(i));{let[r,l,c,d,h]=JSON.parse(i);return n({join_ref:r,ref:l,topic:c,event:d,payload:h})}},binaryEncode(i){let{join_ref:n,ref:r,event:l,topic:c,payload:d}=i,h=this.META_LENGTH+n.length+r.length+c.length+l.length,m=new ArrayBuffer(this.HEADER_LENGTH+h),g=new DataView(m),p=0;g.setUint8(p++,this.KINDS.push),g.setUint8(p++,n.length),g.setUint8(p++,r.length),g.setUint8(p++,c.length),g.setUint8(p++,l.length),Array.from(n,b=>g.setUint8(p++,b.charCodeAt(0))),Array.from(r,b=>g.setUint8(p++,b.charCodeAt(0))),Array.from(c,b=>g.setUint8(p++,b.charCodeAt(0))),Array.from(l,b=>g.setUint8(p++,b.charCodeAt(0)));var S=new Uint8Array(m.byteLength+d.byteLength);return S.set(new Uint8Array(m),0),S.set(new Uint8Array(d),m.byteLength),S.buffer},binaryDecode(i){let n=new DataView(i),r=n.getUint8(0),l=new TextDecoder;switch(r){case this.KINDS.push:return this.decodePush(i,n,l);case this.KINDS.reply:return this.decodeReply(i,n,l);case this.KINDS.broadcast:return this.decodeBroadcast(i,n,l)}},decodePush(i,n,r){let l=n.getUint8(1),c=n.getUint8(2),d=n.getUint8(3),h=this.HEADER_LENGTH+this.META_LENGTH-1,m=r.decode(i.slice(h,h+l));h=h+l;let g=r.decode(i.slice(h,h+c));h=h+c;let p=r.decode(i.slice(h,h+d));h=h+d;let S=i.slice(h,i.byteLength);return{join_ref:m,ref:null,topic:g,event:p,payload:S}},decodeReply(i,n,r){let l=n.getUint8(1),c=n.getUint8(2),d=n.getUint8(3),h=n.getUint8(4),m=this.HEADER_LENGTH+this.META_LENGTH,g=r.decode(i.slice(m,m+l));m=m+l;let p=r.decode(i.slice(m,m+c));m=m+c;let S=r.decode(i.slice(m,m+d));m=m+d;let b=r.decode(i.slice(m,m+h));m=m+h;let T=i.slice(m,i.byteLength),A={status:b,response:T};return{join_ref:g,ref:p,topic:S,event:ha.reply,payload:A}},decodeBroadcast(i,n,r){let l=n.getUint8(1),c=n.getUint8(2),d=this.HEADER_LENGTH+2,h=r.decode(i.slice(d,d+l));d=d+l;let m=r.decode(i.slice(d,d+c));d=d+c;let g=i.slice(d,i.byteLength);return{join_ref:null,ref:null,topic:h,event:m,payload:g}}},Nb=class{constructor(i,n={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=n.timeout||Ab,this.transport=n.transport||Rn.WebSocket||cr,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=n.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=Rn&&Rn.sessionStorage}catch{}this.sessionStore=n.sessionStorage||r,this.establishedConnections=0,this.defaultEncoder=Eo.encode.bind(Eo),this.defaultDecoder=Eo.decode.bind(Eo),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=n.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==cr?(this.encode=n.encode||this.defaultEncoder,this.decode=n.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let l=null;br&&br.addEventListener&&(br.addEventListener("pagehide",c=>{this.conn&&(this.disconnect(),l=this.connectClock)}),br.addEventListener("pageshow",c=>{l===this.connectClock&&(l=null,this.connect())}),br.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=n.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=n.autoSendHeartbeat??!0,this.heartbeatCallback=n.heartbeatCallback??(()=>{}),this.rejoinAfterMs=c=>n.rejoinAfterMs?n.rejoinAfterMs(c):[1e3,2e3,5e3][c-1]||1e4,this.reconnectAfterMs=c=>n.reconnectAfterMs?n.reconnectAfterMs(c):[10,50,100,150,200,250,500,1e3,2e3][c-1]||5e3,this.logger=n.logger||null,!this.logger&&n.debug&&(this.logger=(c,d,h)=>{console.log(`${c}: ${d}`,h)}),this.longpollerTimeout=n.longpollerTimeout||2e4,this.params=Bs(n.params||{}),this.endPoint=`${i}/${Cd.websocket}`,this.vsn=n.vsn||Eb,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Np(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{n.beforeReconnect&&await n.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=n.authToken}getLongPollTransport(){return cr}replaceTransport(i){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=i}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let i=Do.appendParams(Do.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return i.charAt(0)!=="/"?i:i.charAt(1)==="/"?`${this.protocol()}:${i}`:`${this.protocol()}://${location.host}${i}`}disconnect(i,n,r){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,i&&i()},n,r)}connect(i){i&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=Bs(i)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==cr?this.connectWithFallback(cr,this.longPollFallbackMs):this.transportConnect())}log(i,n,r){this.logger&&this.logger(i,n,r)}hasLogger(){return this.logger!==null}onOpen(i){let n=this.makeRef();return this.stateChangeCallbacks.open.push([n,i]),n}onClose(i){let n=this.makeRef();return this.stateChangeCallbacks.close.push([n,i]),n}onError(i){let n=this.makeRef();return this.stateChangeCallbacks.error.push([n,i]),n}onMessage(i){let n=this.makeRef();return this.stateChangeCallbacks.message.push([n,i]),n}onHeartbeat(i){this.heartbeatCallback=i}ping(i){if(!this.isConnected())return!1;let n=this.makeRef(),r=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:n});let l=this.onMessage(c=>{c.ref===n&&(this.off([l]),i(Date.now()-r))});return!0}transportName(i){return i===cr?"LongPoll":i.name}transportConnect(){this.connectClock++,this.closeWasClean=!1;let i;this.authToken&&(i=["phoenix",`${Od}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),i),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=n=>this.onConnError(n),this.conn.onmessage=n=>this.onConnMessage(n),this.conn.onclose=n=>this.onConnClose(n)}getSession(i){return this.sessionStore&&this.sessionStore.getItem(i)}storeSession(i,n){this.sessionStore&&this.sessionStore.setItem(i,n)}connectWithFallback(i,n=2500){clearTimeout(this.fallbackTimer);let r=!1,l=!0,c,d,h=this.transportName(i),m=g=>{this.log("transport",`falling back to ${h}...`,g),this.off([c,d]),l=!1,this.replaceTransport(i),this.transportConnect()};if(this.getSession(`phx:fallback:${h}`))return m("memorized");this.fallbackTimer=setTimeout(m,n),d=this.onError(g=>{this.log("transport","error",g),l&&!r&&(clearTimeout(this.fallbackTimer),m(g))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(r=!0,!l){let g=this.transportName(i);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${g}`,"true"),this.log("transport",`established ${g} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(m,n),this.ping(g=>{this.log("transport","connected to primary after",g),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(i){this.log("error","error in heartbeat callback",i)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),xb,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(i,n,r){if(!this.conn)return i&&i();const l=this.conn;this.waitForBufferDone(l,()=>{n?l.close(n,r||""):l.close(),this.waitForSocketClosed(l,()=>{this.conn===l&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),i&&i()})})}waitForBufferDone(i,n,r=1){if(r===5||!i.bufferedAmount){n();return}setTimeout(()=>{this.waitForBufferDone(i,n,r+1)},150*r)}waitForSocketClosed(i,n,r=1){if(r===5||i.readyState===jn.closed){n();return}setTimeout(()=>{this.waitForSocketClosed(i,n,r+1)},150*r)}onConnClose(i){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",i),this.triggerChanError(i),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",i)}onConnError(i){this.hasLogger()&&this.log("transport","error",i);let n=this.transport,r=this.establishedConnections;this.triggerStateCallbacks("error",i,n,r),(n===this.transport||r>0)&&this.triggerChanError(i)}triggerChanError(i){this.channels.forEach(n=>{n.isErrored()||n.isLeaving()||n.isClosed()||n.trigger(ha.error,i)})}connectionState(){switch(this.conn&&this.conn.readyState){case jn.connecting:return"connecting";case jn.open:return"open";case jn.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(i){this.off(i.stateChangeRefs),this.channels=this.channels.filter(n=>n!==i)}off(i){for(let n in this.stateChangeCallbacks)this.stateChangeCallbacks[n]=this.stateChangeCallbacks[n].filter(([r])=>i.indexOf(r)===-1)}channel(i,n={}){let r=new Ob(i,n,this);return this.channels.push(r),r}push(i){if(this.hasLogger()){let{topic:n,event:r,payload:l,ref:c,join_ref:d}=i;this.log("push",`${n} ${r} (${d}, ${c})`,l)}this.isConnected()?this.encode(i,n=>this.conn.send(n)):this.sendBuffer.push(()=>this.encode(i,n=>this.conn.send(n)))}makeRef(){let i=this.ref+1;return i===this.ref?this.ref=0:this.ref=i,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(i){this.log("error","error in heartbeat callback",i)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(i){this.log("error","error in heartbeat callback",i)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(i=>i()),this.sendBuffer=[])}onConnMessage(i){this.decode(i.data,n=>{let{topic:r,event:l,payload:c,ref:d,join_ref:h}=n;if(d&&d===this.pendingHeartbeatRef){const m=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(c.status==="ok"?"ok":"error",m)}catch(g){this.log("error","error in heartbeat callback",g)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${c.status||""} ${r} ${l} ${d&&"("+d+")"||""}`.trim(),c);for(let m=0;m<this.channels.length;m++){const g=this.channels[m];g.isMember(r,l,c,h)&&g.trigger(l,c,d,h)}this.triggerStateCallbacks("message",n)})}triggerStateCallbacks(i,...n){try{this.stateChangeCallbacks[i].forEach(([r,l])=>{try{l(...n)}catch(c){this.log("error",`error in ${i} callback`,c)}})}catch(r){this.log("error",`error triggering ${i} callbacks`,r)}}leaveOpenTopic(i){let n=this.channels.find(r=>r.topic===i&&(r.isJoined()||r.isJoining()));n&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${i}"`),n.leave())}};class Hs{constructor(n,r){const l=Db(r);this.presence=new jb(n.getChannel(),l),this.presence.onJoin((c,d,h)=>{const m=Hs.onJoinPayload(c,d,h);n.getChannel().trigger("presence",m)}),this.presence.onLeave((c,d,h)=>{const m=Hs.onLeavePayload(c,d,h);n.getChannel().trigger("presence",m)}),this.presence.onSync(()=>{n.getChannel().trigger("presence",{event:"sync"})})}get state(){return Hs.transformState(this.presence.state)}static transformState(n){return n=Lb(n),Object.getOwnPropertyNames(n).reduce((r,l)=>{const c=n[l];return r[l]=No(c),r},{})}static onJoinPayload(n,r,l){const c=$g(r),d=No(l);return{event:"join",key:n,currentPresences:c,newPresences:d}}static onLeavePayload(n,r,l){const c=$g(r),d=No(l);return{event:"leave",key:n,currentPresences:c,leftPresences:d}}}function No(i){return i.metas.map(n=>(n.presence_ref=n.phx_ref,delete n.phx_ref,delete n.phx_ref_prev,n))}function Lb(i){return JSON.parse(JSON.stringify(i))}function Db(i){return i?.events&&{events:i.events}}function $g(i){return i?.metas?No(i):[]}var Pg;(function(i){i.SYNC="sync",i.JOIN="join",i.LEAVE="leave"})(Pg||(Pg={}));class Ub{get state(){return this.presenceAdapter.state}constructor(n,r){this.channel=n,this.presenceAdapter=new Hs(this.channel.channelAdapter,r)}}function Mb(i){if(i instanceof Error)return i;if(typeof i=="string")return new Error(i);if(i&&typeof i=="object"){const n=i;if(typeof n.code=="number"){const r=typeof n.reason=="string"&&n.reason?` (${n.reason})`:"";return new Error(`socket closed: ${n.code}${r}`,{cause:i})}return new Error("channel error: transport failure",{cause:i})}return new Error("channel error: connection lost")}class zb{constructor(n,r,l){const c=Bb(l);this.channel=n.getSocket().channel(r,c),this.socket=n}get state(){return this.channel.state}set state(n){this.channel.state=n}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(n,r){return this.channel.on(n,r)}off(n,r){this.channel.off(n,r)}subscribe(n){return this.channel.join(n)}unsubscribe(n){return this.channel.leave(n)}teardown(){this.channel.teardown()}onClose(n){this.channel.onClose(n)}onError(n){return this.channel.onError(n)}push(n,r,l){let c;try{c=this.channel.push(n,r,l)}catch{throw new Error(`tried to push '${n}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>pb){const d=this.channel.pushBuffer.shift();d.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${d.event}`,d.payload())}return c}updateJoinPayload(n){const r=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},r),n)}canPush(){return this.socket.isConnected()&&this.state===Ka.joined}isJoined(){return this.state===Ka.joined}isJoining(){return this.state===Ka.joining}isClosed(){return this.state===Ka.closed}isLeaving(){return this.state===Ka.leaving}updateFilterBindings(n){this.channel.filterBindings=n}updatePayloadTransform(n){this.channel.onMessage=n}getChannel(){return this.channel}}function Bb(i){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},i.config)}}const Hb=/[,()"\\]/,qb=i=>Hb.test(i)||i!==i.trim(),$b=i=>`"${i.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,Ig=i=>{const n=i===null?"null":String(i);return qb(n)?$b(n):n},Pb=i=>i===null?"null":String(i),Ib=(i,n)=>{if(i==="in"){const r=Array.isArray(n)?n:[n];if(r.length===0)throw new Error("Realtime `in` filter requires at least one value.");return`in.(${Array.from(new Set(r)).map(c=>Ig(c)).join(",")})`}return i==="is"?`is.${Pb(n)}`:`${i}.${Ig(n)}`};class Gb{constructor(){this.filters=[]}add(n,r,l,c=!1){const d=c?"not.":"";return this.filters.push(`${n}=${d}${Ib(r,l)}`),this}eq(n,r){return this.add(n,"eq",r)}neq(n,r){return this.add(n,"neq",r)}gt(n,r){return this.add(n,"gt",r)}gte(n,r){return this.add(n,"gte",r)}lt(n,r){return this.add(n,"lt",r)}lte(n,r){return this.add(n,"lte",r)}in(n,r){return this.add(n,"in",r)}like(n,r){return this.add(n,"like",r)}ilike(n,r){return this.add(n,"ilike",r)}match(n,r){return this.add(n,"match",r)}imatch(n,r){return this.add(n,"imatch",r)}is(n,r){return this.add(n,"is",r)}isDistinct(n,r){return this.add(n,"isdistinct",r)}not(n,r,l){return this.add(n,r,l,!0)}build(){return this.filters.join(",")}toString(){return this.build()}}var Gg;(function(i){i.ALL="*",i.INSERT="INSERT",i.UPDATE="UPDATE",i.DELETE="DELETE"})(Gg||(Gg={}));var Tr;(function(i){i.BROADCAST="broadcast",i.PRESENCE="presence",i.POSTGRES_CHANGES="postgres_changes",i.SYSTEM="system"})(Tr||(Tr={}));var fa;(function(i){i.SUBSCRIBED="SUBSCRIBED",i.TIMED_OUT="TIMED_OUT",i.CLOSED="CLOSED",i.CHANNEL_ERROR="CHANNEL_ERROR"})(fa||(fa={}));class qs{get state(){return this.channelAdapter.state}set state(n){this.channelAdapter.state=n}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(n,r={config:{}},l){var c,d;if(this.topic=n,this.params=r,this.socket=l,this.bindings={},this.subTopic=n.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.channelAdapter=new zb(this.socket.socketAdapter,n,this.params),this.presence=new Ub(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=jp(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((d=(c=this.params.config)===null||c===void 0?void 0:c.broadcast)===null||d===void 0)&&d.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(n,r=this.timeout){var l,c,d;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:h,presence:m,private:g}}=this.params,p=(c=(l=this.bindings.postgres_changes)===null||l===void 0?void 0:l.map(A=>A.filter))!==null&&c!==void 0?c:[],S=!!this.bindings[Tr.PRESENCE]&&this.bindings[Tr.PRESENCE].length>0||((d=this.params.config.presence)===null||d===void 0?void 0:d.enabled)===!0,b={},T={broadcast:h,presence:Object.assign(Object.assign({},m),{enabled:S}),postgres_changes:p,private:g};this.socket.accessTokenValue&&(b.access_token=this.socket.accessTokenValue),this._onError(A=>{n?.(fa.CHANNEL_ERROR,Mb(A))}),this._onClose(()=>n?.(fa.CLOSED)),this.updateJoinPayload(Object.assign({config:T},b)),this._updateFilterMessage(),this.channelAdapter.subscribe(r).receive("ok",async({postgres_changes:A})=>{if(this.socket._isManualToken()||this.socket.setAuth(),A===void 0){n?.(fa.SUBSCRIBED);return}this._updatePostgresBindings(A,n)}).receive("error",A=>{this.state=Ka.errored;const C=Object.values(A).join(", ")||"error";n?.(fa.CHANNEL_ERROR,new Error(C,{cause:A}))}).receive("timeout",()=>{n?.(fa.TIMED_OUT)})}return this}_updatePostgresBindings(n,r){var l;const c=this.bindings.postgres_changes,d=(l=c?.length)!==null&&l!==void 0?l:0,h=[];for(let m=0;m<d;m++){const g=c[m],{filter:{event:p,schema:S,table:b,filter:T}}=g,A=n&&n[m];if(A&&A.event===p&&qs.isFilterValueEqual(A.schema,S)&&qs.isFilterValueEqual(A.table,b)&&qs.isFilterValueEqual(A.filter,T))h.push(Object.assign(Object.assign({},g),{id:A.id}));else{this.unsubscribe(),this.state=Ka.errored,r?.(fa.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=h,this.state!=Ka.errored&&r&&r(fa.SUBSCRIBED)}presenceState(){return this.presence.state}async track(n,r={}){return await this.send({type:"presence",event:"track",payload:n},r.timeout||this.timeout)}async untrack(n={}){return await this.send({type:"presence",event:"untrack"},n)}on(n,r,l){const c=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),d=n===Tr.PRESENCE||n===Tr.POSTGRES_CHANGES;if(c&&d)throw this.socket.log("channel",`cannot add \`${n}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${n}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(n,r,l)}async httpSend(n,r,l={}){var c;if(r==null)return Promise.reject(new Error("Payload is required for httpSend()"));const d=r instanceof ArrayBuffer||ArrayBuffer.isView(r),h={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":d?"application/octet-stream":"application/json"};this.socket.accessTokenValue&&(h.Authorization=`Bearer ${this.socket.accessTokenValue}`);const m=new URL(this.broadcastEndpointURL);m.pathname+=`/${encodeURIComponent(this.subTopic)}/events/${encodeURIComponent(n)}`,this.private&&m.searchParams.set("private","true");const g={method:"POST",headers:h,body:d?r:JSON.stringify(r)},p=await this._fetchWithTimeout(m.toString(),g,(c=l.timeout)!==null&&c!==void 0?c:this.timeout);if(p.status===202)return{success:!0};if(p.status===404)return Promise.reject(new Error("httpSend() requires Realtime server v2.97.0 or newer; the endpoint returned 404. Update your Supabase CLI to a recent version, or upgrade the Realtime server in your self-hosted setup. See https://github.com/supabase/supabase-js/blob/master/packages/core/realtime-js/migrations/httpsend-server-version.md"));let S=p.statusText;try{const b=await p.json();S=b.error||b.message||S}catch{}return Promise.reject(new Error(S))}async send(n,r={}){var l,c;if(!this.channelAdapter.canPush()&&n.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:d,payload:h}=n,m={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(m.Authorization=`Bearer ${this.socket.accessTokenValue}`);const g={method:"POST",headers:m,body:JSON.stringify({messages:[{topic:this.subTopic,event:d,payload:h,private:this.private}]})};try{const p=await this._fetchWithTimeout(this.broadcastEndpointURL,g,(l=r.timeout)!==null&&l!==void 0?l:this.timeout);return await((c=p.body)===null||c===void 0?void 0:c.cancel()),p.ok?"ok":"error"}catch(p){return p instanceof Error&&p.name==="AbortError"?"timed out":"error"}}else return new Promise(d=>{var h,m,g;const p=this.channelAdapter.push(n.type,n,r.timeout||this.timeout);n.type==="broadcast"&&!(!((g=(m=(h=this.params)===null||h===void 0?void 0:h.config)===null||m===void 0?void 0:m.broadcast)===null||g===void 0)&&g.ack)&&d("ok"),p.receive("ok",()=>d("ok")),p.receive("error",()=>d("error")),p.receive("timeout",()=>d("timed out"))})}updateJoinPayload(n){this.channelAdapter.updateJoinPayload(n)}async unsubscribe(n=this.timeout){return new Promise(r=>{this.channelAdapter.unsubscribe(n).receive("ok",()=>r("ok")).receive("timeout",()=>r("timed out")).receive("error",()=>r("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(n,r,l){const c=new AbortController,d=setTimeout(()=>c.abort(),l),h=await this.socket.fetch(n,Object.assign(Object.assign({},r),{signal:c.signal}));return clearTimeout(d),h}_on(n,r,l){const c=n.toLocaleLowerCase(),d=r?.filter;(d instanceof Gb||typeof d=="object"&&d!==null&&typeof d.build=="function")&&(r=Object.assign(Object.assign({},r),{filter:d.build()}));const h=this.channelAdapter.on(n,l),m={type:c,filter:r,callback:l,ref:h};return this.bindings[c]?this.bindings[c].push(m):this.bindings[c]=[m],this._updateFilterMessage(),this}_onClose(n){this.channelAdapter.onClose(n)}_onError(n){this.channelAdapter.onError(n)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((n,r,l)=>{var c,d,h,m,g,p,S;const b=n.event.toLocaleLowerCase();if(this._notThisChannelEvent(b,l))return!1;const T=(c=this.bindings[b])===null||c===void 0?void 0:c.find(A=>A.ref===n.ref);if(!T)return!0;if(["broadcast","presence","postgres_changes"].includes(b))if("id"in T){const A=T.id,C=(d=T.filter)===null||d===void 0?void 0:d.event;return A&&((h=r.ids)===null||h===void 0?void 0:h.includes(A))&&(C==="*"||C?.toLocaleLowerCase()===((m=r.data)===null||m===void 0?void 0:m.type.toLocaleLowerCase()))}else{const A=(p=(g=T?.filter)===null||g===void 0?void 0:g.event)===null||p===void 0?void 0:p.toLocaleLowerCase();return A==="*"||A===((S=r?.event)===null||S===void 0?void 0:S.toLocaleLowerCase())}else return T.type.toLocaleLowerCase()===b})}_notThisChannelEvent(n,r){const{close:l,error:c,leave:d,join:h}=Op;return r&&[l,c,d,h].includes(n)&&r!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((n,r,l)=>{if(typeof r=="object"&&"ids"in r){const c=r.data,{schema:d,table:h,commit_timestamp:m,type:g,errors:p}=c;return Object.assign(Object.assign({},{schema:d,table:h,commit_timestamp:m,eventType:g,new:{},old:{},errors:p}),this._getPayloadRecords(c))}return r})}copyBindings(n){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const r in n.bindings)for(const l of n.bindings[r])this._on(l.type,l.filter,l.callback)}static isFilterValueEqual(n,r){return(n??void 0)===(r??void 0)}_getPayloadRecords(n){const r={new:{},old:{}};return(n.type==="INSERT"||n.type==="UPDATE")&&(r.new=qg(n.columns,n.record)),(n.type==="UPDATE"||n.type==="DELETE")&&(r.old=qg(n.columns,n.old_record)),r}}class Vb{constructor(n,r){this.socket=new Nb(n,r)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(n){this.socket.heartbeatCallback=n}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(n,r,l,c=1e4){return new Promise(d=>{setTimeout(()=>d("timeout"),c),this.socket.disconnect(()=>{n(),d("ok")},r,l)})}push(n){this.socket.push(n)}log(n,r,l){this.socket.log(n,r,l)}makeRef(){return this.socket.makeRef()}onOpen(n){this.socket.onOpen(n)}onClose(n){this.socket.onClose(n)}onError(n){this.socket.onError(n)}onMessage(n){this.socket.onMessage(n)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==Ad.connecting}isDisconnecting(){return this.socket.connectionState()==Ad.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const Vg={HEARTBEAT_INTERVAL:25e3},Kb=[1e3,2e3,5e3,1e4],Yb=1e4;function Jb(){const i=new Map;return{get length(){return i.size},clear(){i.clear()},getItem(n){return i.has(n)?i.get(n):null},key(n){var r;return(r=Array.from(i.keys())[n])!==null&&r!==void 0?r:null},removeItem(n){i.delete(n)},setItem(n,r){i.set(n,String(r))}}}function Xb(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return Jb()}const Qb=`
16
16
  addEventListener("message", (e) => {
17
17
  if (e.data.event === "start") {
18
18
  setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
19
19
  }
20
- });`;class Qb{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(n,r){var l;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={},this.ref=0,this.serializer=new pb,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=d=>d?(...h)=>d(...h):(...h)=>fetch(...h),!(!((l=r?.params)===null||l===void 0)&&l.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey;const c=this._initializeOptions(r);this.socketAdapter=new Gb(n,c),this.httpEndpoint=jp(n),this.fetch=this._resolveFetch(r?.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(n){const r=n.message;throw new Error(`WebSocket not available: ${r}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(n,r){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},n,r)}getChannels(){return this.channels}async removeChannel(n){const r=await n.unsubscribe();return r==="ok"&&n.teardown(),r}async removeAllChannels(){const n=this.channels.map(async l=>{const c=await l.unsubscribe();return l.teardown(),c}),r=await Promise.all(n);return await this.disconnect(),r}log(n,r,l){this.socketAdapter.log(n,r,l)}connectionState(){return this.socketAdapter.connectionState()||Ad.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(n,r={config:{}}){const l=`realtime:${n}`,c=this.getChannels().find(d=>d.topic===l);if(c)return c;{const d=new qs(`realtime:${n}`,r,this);return this._cancelPendingDisconnect(),this.channels.push(d),d}}push(n){this.socketAdapter.push(n)}async setAuth(n=null){this._authPromise=this._performAuth(n);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(n){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(n)}_makeRef(){return this.socketAdapter.makeRef()}_remove(n){this.channels=this.channels.filter(r=>r.topic!==n.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(n=null){let r,l=!1;if(n)r=n,l=!0;else if(this.accessToken)try{r=await this.accessToken()}catch(c){this.log("error","Error fetching access token from callback",c),r=this.accessTokenValue}else r=this.accessTokenValue;l?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(c=>{const d={access_token:r,version:db};r&&c.updateJoinPayload(d),c.joinedOnce&&c.channelAdapter.isJoined()&&c.channelAdapter.push(Op.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(n="general"){this._isManualToken()||this.setAuth().catch(r=>{this.log("error",`Error setting auth in ${n}`,r)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(r=>{this.log("error","error waiting for auth on connect",r)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(n=>{n.ref&&n.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(n){return(r,l)=>{r=="sent"&&this._setAuthSafely(),n&&n(r,l)}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const n=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(n),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(n){let r;if(n)r=n;else{const l=new Blob([Xb],{type:"application/javascript"});r=URL.createObjectURL(l)}return r}_initializeOptions(n){var r,l,c,d,h,m,g,p,S,b,T,A;this.worker=(r=n?.worker)!==null&&r!==void 0?r:!1,this.accessToken=(l=n?.accessToken)!==null&&l!==void 0?l:null;const C={};C.timeout=(c=n?.timeout)!==null&&c!==void 0?c:mb,C.heartbeatIntervalMs=(d=n?.heartbeatIntervalMs)!==null&&d!==void 0?d:Vg.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(h=n?.disconnectOnEmptyChannelsAfterMs)!==null&&h!==void 0?h:2*((m=n?.heartbeatIntervalMs)!==null&&m!==void 0?m:Vg.HEARTBEAT_INTERVAL),C.transport=(g=n?.transport)!==null&&g!==void 0?g:cb.getWebSocketConstructor(),C.params=n?.params,C.logger=n?.logger,C.heartbeatCallback=this._wrapHeartbeatCallback(n?.heartbeatCallback),C.sessionStorage=(p=n?.sessionStorage)!==null&&p!==void 0?p:Jb(),C.reconnectAfterMs=(S=n?.reconnectAfterMs)!==null&&S!==void 0?S:(q=>Vb[q-1]||Kb);let U,$;const P=(b=n?.vsn)!==null&&b!==void 0?b:fb;switch(P){case hb:U=(q,N)=>N(JSON.stringify(q)),$=(q,N)=>N(JSON.parse(q));break;case Cp:U=this.serializer.encode.bind(this.serializer),$=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${C.vsn}`)}if(C.vsn=P,C.encode=(T=n?.encode)!==null&&T!==void 0?T:U,C.decode=(A=n?.decode)!==null&&A!==void 0?A:$,C.beforeReconnect=this._reconnectAuth.bind(this),(n?.logLevel||n?.log_level)&&(this.logLevel=n.logLevel||n.log_level,C.params=Object.assign(Object.assign({},C.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=n?.workerUrl,C.autoSendHeartbeat=!this.worker}return C}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var Ks=class extends Error{constructor(i,n){super(i),this.name="IcebergError",this.status=n.status,this.icebergType=n.icebergType,this.icebergCode=n.icebergCode,this.details=n.details,this.isCommitStateUnknown=n.icebergType==="CommitStateUnknownException"||[500,502,504].includes(n.status)&&n.icebergType?.includes("CommitState")===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function Wb(i,n,r){const l=new URL(n,i);if(r)for(const[c,d]of Object.entries(r))d!==void 0&&l.searchParams.set(c,d);return l.toString()}async function Zb(i){return!i||i.type==="none"?{}:i.type==="bearer"?{Authorization:`Bearer ${i.token}`}:i.type==="header"?{[i.name]:i.value}:i.type==="custom"?await i.getHeaders():{}}function Fb(i){const n=i.fetchImpl??globalThis.fetch;return{async request({method:r,path:l,query:c,body:d,headers:h}){const m=Wb(i.baseUrl,l,c),g=await Zb(i.auth),p=await n(m,{method:r,headers:{...d?{"Content-Type":"application/json"}:{},...g,...h},body:d?JSON.stringify(d):void 0}),S=await p.text(),b=(p.headers.get("content-type")||"").includes("application/json"),T=b&&S?JSON.parse(S):S;if(!p.ok){const A=b?T:void 0,C=A?.error;throw new Ks(C?.message??`Request failed with status ${p.status}`,{status:p.status,icebergType:C?.type,icebergCode:C?.code,details:A})}return{status:p.status,headers:p.headers,data:T}}}}function Ao(i){return i.join("")}var eS=class{constructor(i,n=""){this.client=i,this.prefix=n}async listNamespaces(i){const n=i?{parent:Ao(i.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:n})).data.namespaces.map(l=>({namespace:l}))}async createNamespace(i,n){const r={namespace:i.namespace,properties:n?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(i){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Ao(i.namespace)}`})}async loadNamespaceMetadata(i){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Ao(i.namespace)}`})).data.properties}}async namespaceExists(i){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Ao(i.namespace)}`}),!0}catch(n){if(n instanceof Ks&&n.status===404)return!1;throw n}}async createNamespaceIfNotExists(i,n){try{return await this.createNamespace(i,n)}catch(r){if(r instanceof Ks&&r.status===409)return;throw r}}};function ur(i){return i.join("")}var tS=class{constructor(i,n="",r){this.client=i,this.prefix=n,this.accessDelegation=r}async listTables(i){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${ur(i.namespace)}/tables`})).data.identifiers}async createTable(i,n){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${ur(i.namespace)}/tables`,body:n,headers:r})).data.metadata}async updateTable(i,n){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${ur(i.namespace)}/tables/${i.name}`,body:n});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(i,n){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${ur(i.namespace)}/tables/${i.name}`,query:{purgeRequested:String(n?.purge??!1)}})}async loadTable(i){const n={};return this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${ur(i.namespace)}/tables/${i.name}`,headers:n})).data.metadata}async tableExists(i){const n={};this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${ur(i.namespace)}/tables/${i.name}`,headers:n}),!0}catch(r){if(r instanceof Ks&&r.status===404)return!1;throw r}}async createTableIfNotExists(i,n){try{return await this.createTable(i,n)}catch(r){if(r instanceof Ks&&r.status===409)return await this.loadTable({namespace:i.namespace,name:n.name});throw r}}},nS=class{constructor(i){let n="v1";i.catalogName&&(n+=`/${i.catalogName}`);const r=i.baseUrl.endsWith("/")?i.baseUrl:`${i.baseUrl}/`;this.client=Fb({baseUrl:r,auth:i.auth,fetchImpl:i.fetch}),this.accessDelegation=i.accessDelegation?.join(","),this.namespaceOps=new eS(this.client,n),this.tableOps=new tS(this.client,n,this.accessDelegation)}async listNamespaces(i){return this.namespaceOps.listNamespaces(i)}async createNamespace(i,n){return this.namespaceOps.createNamespace(i,n)}async dropNamespace(i){await this.namespaceOps.dropNamespace(i)}async loadNamespaceMetadata(i){return this.namespaceOps.loadNamespaceMetadata(i)}async listTables(i){return this.tableOps.listTables(i)}async createTable(i,n){return this.tableOps.createTable(i,n)}async updateTable(i,n){return this.tableOps.updateTable(i,n)}async dropTable(i,n){await this.tableOps.dropTable(i,n)}async loadTable(i){return this.tableOps.loadTable(i)}async namespaceExists(i){return this.namespaceOps.namespaceExists(i)}async tableExists(i){return this.tableOps.tableExists(i)}async createNamespaceIfNotExists(i,n){return this.namespaceOps.createNamespaceIfNotExists(i,n)}async createTableIfNotExists(i,n){return this.tableOps.createTableIfNotExists(i,n)}};function Ys(i){"@babel/helpers - typeof";return Ys=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Ys(i)}function aS(i,n){if(Ys(i)!="object"||!i)return i;var r=i[Symbol.toPrimitive];if(r!==void 0){var l=r.call(i,n);if(Ys(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(i)}function iS(i){var n=aS(i,"string");return Ys(n)=="symbol"?n:n+""}function rS(i,n,r){return(n=iS(n))in i?Object.defineProperty(i,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):i[n]=r,i}function Kg(i,n){var r=Object.keys(i);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(i);n&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(i,c).enumerable})),r.push.apply(r,l)}return r}function le(i){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?Kg(Object(r),!0).forEach(function(l){rS(i,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(r)):Kg(Object(r)).forEach(function(l){Object.defineProperty(i,l,Object.getOwnPropertyDescriptor(r,l))})}return i}var Io=class extends Error{constructor(i,n="storage",r,l){super(i),this.__isStorageError=!0,this.namespace=n,this.name=n==="vectors"?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=l}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function Go(i){return typeof i=="object"&&i!==null&&"__isStorageError"in i}var Rd=class extends Io{constructor(i,n,r,l="storage"){super(i,l,n,r),this.name=l==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=n,this.statusCode=r}toJSON(){return le({},super.toJSON())}},Lp=class extends Io{constructor(i,n,r="storage"){super(i,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=n}};function Uo(i,n,r){const l=le({},i),c=n.toLowerCase();for(const d of Object.keys(l))d.toLowerCase()===c&&delete l[d];return l[c]=r,l}function sS(i){const n={};for(const[r,l]of Object.entries(i))n[r.toLowerCase()]=l;return n}const lS=i=>i?(...n)=>i(...n):(...n)=>fetch(...n),oS=i=>{if(typeof i!="object"||i===null)return!1;const n=Object.getPrototypeOf(i);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in i)&&!(Symbol.iterator in i)},jd=i=>{if(Array.isArray(i))return i.map(r=>jd(r));if(typeof i=="function"||i!==Object(i))return i;const n={};return Object.entries(i).forEach(([r,l])=>{const c=r.replace(/([-_][a-z])/gi,d=>d.toUpperCase().replace(/[-_]/g,""));n[c]=jd(l)}),n},cS=i=>!i||typeof i!="string"||i.length===0||i.length>100||i.trim()!==i||i.includes("/")||i.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(i),Yg=i=>{if(typeof i=="object"&&i!==null){const n=i;if(typeof n.msg=="string")return n.msg;if(typeof n.message=="string")return n.message;if(typeof n.error_description=="string")return n.error_description;if(typeof n.error=="string")return n.error;if(typeof n.error=="object"&&n.error!==null){const r=n.error;if(typeof r.message=="string")return r.message}}return JSON.stringify(i)},uS=async(i,n,r,l)=>{if(i!==null&&typeof i=="object"&&"json"in i&&typeof i.json=="function"){const c=i;let d=parseInt(String(c.status),10);Number.isFinite(d)||(d=500),c.json().then(h=>{const m=h?.statusCode||h?.code||d+"";n(new Rd(Yg(h),d,m,l))}).catch(()=>{const h=d+"";n(new Rd(c.statusText||`HTTP ${d} error`,d,h,l))})}else n(new Lp(Yg(i),i,l))},dS=(i,n,r,l)=>{const c={method:i,headers:n?.headers||{}};if(i==="GET"||i==="HEAD"||!l)return le(le({},c),r);if(oS(l)){var d;const h=n?.headers||{};let m;for(const[g,p]of Object.entries(h))g.toLowerCase()==="content-type"&&(m=p);c.headers=Uo(h,"Content-Type",(d=m)!==null&&d!==void 0?d:"application/json"),c.body=JSON.stringify(l)}else c.body=l;return n?.duplex&&(c.duplex=n.duplex),le(le({},c),r)};async function js(i,n,r,l,c,d,h){return new Promise((m,g)=>{i(r,dS(n,l,c,d)).then(p=>{if(!p.ok)throw p;if(l?.noResolveJson)return p;if(h==="vectors"){const S=p.headers.get("content-type");if(p.headers.get("content-length")==="0"||p.status===204)return{};if(!S||!S.includes("application/json"))return{}}return p.json()}).then(p=>m(p)).catch(p=>uS(p,g,l,h))})}function Dp(i="storage"){return{get:async(n,r,l,c)=>js(n,"GET",r,l,c,void 0,i),post:async(n,r,l,c,d)=>js(n,"POST",r,c,d,l,i),put:async(n,r,l,c,d)=>js(n,"PUT",r,c,d,l,i),head:async(n,r,l,c)=>js(n,"HEAD",r,le(le({},l),{},{noResolveJson:!0}),c,void 0,i),remove:async(n,r,l,c,d)=>js(n,"DELETE",r,c,d,l,i)}}const hS=Dp("storage"),{get:Js,post:wn,put:Nd,head:fS,remove:Xs}=hS,en=Dp("vectors");var xr=class{constructor(i,n={},r,l="storage"){this.shouldThrowOnError=!1,this.url=i,this.headers=sS(n),this.fetch=lS(r),this.namespace=l}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(i,n){return this.headers=Uo(this.headers,i,n),this}async handleOperation(i){var n=this;try{return{data:await i(),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(Go(r))return{data:null,error:r};throw r}}};let Up;Up=Symbol.toStringTag;var mS=class{constructor(i,n){this.downloadFn=i,this.shouldThrowOnError=n,this[Up]="StreamDownloadBuilder",this.promise=null}then(i,n){return this.getPromise().then(i,n)}catch(i){return this.getPromise().catch(i)}finally(i){return this.getPromise().finally(i)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var i=this;try{return{data:(await i.downloadFn()).body,error:null}}catch(n){if(i.shouldThrowOnError)throw n;if(Go(n))return{data:null,error:n};throw n}}};let Mp;Mp=Symbol.toStringTag;var gS=class{constructor(i,n){this.downloadFn=i,this.shouldThrowOnError=n,this[Mp]="BlobDownloadBuilder",this.promise=null}asStream(){return new mS(this.downloadFn,this.shouldThrowOnError)}then(i,n){return this.getPromise().then(i,n)}catch(i){return this.getPromise().catch(i)}finally(i){return this.getPromise().finally(i)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var i=this;try{return{data:await(await i.downloadFn()).blob(),error:null}}catch(n){if(i.shouldThrowOnError)throw n;if(Go(n))return{data:null,error:n};throw n}}};const ud={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Jg={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var pS=class extends xr{constructor(i,n={},r,l){super(i,n,l,"storage"),this.bucketId=r}async uploadOrUpdate(i,n,r,l){var c=this;return c.handleOperation(async()=>{let d;const h=le(le({},Jg),l);let m=le(le({},c.headers),i==="POST"&&{"x-upsert":String(h.upsert)});const g=h.metadata;if(typeof Blob<"u"&&r instanceof Blob?(d=new FormData,d.append("cacheControl",h.cacheControl),g&&d.append("metadata",c.encodeMetadata(g)),d.append("",r)):typeof FormData<"u"&&r instanceof FormData?(d=r,d.has("cacheControl")||d.append("cacheControl",h.cacheControl),g&&!d.has("metadata")&&d.append("metadata",c.encodeMetadata(g))):(d=r,m["cache-control"]=`max-age=${h.cacheControl}`,m["content-type"]=h.contentType,g&&(m["x-metadata"]=c.toBase64(c.encodeMetadata(g))),(typeof ReadableStream<"u"&&d instanceof ReadableStream||d&&typeof d=="object"&&"pipe"in d&&typeof d.pipe=="function")&&!h.duplex&&(h.duplex="half")),l?.headers)for(const[T,A]of Object.entries(l.headers))m=Uo(m,T,A);const p=c._removeEmptyFolders(n),S=c._getFinalPath(p),b=await(i=="PUT"?Nd:wn)(c.fetch,`${c.url}/object/${S}`,d,le({headers:m},h?.duplex?{duplex:h.duplex}:{}));return{path:p,id:b.Id,fullPath:b.Key}})}async upload(i,n,r){return this.uploadOrUpdate("POST",i,n,r)}async uploadToSignedUrl(i,n,r,l){var c=this;const d=c._removeEmptyFolders(i),h=c._getFinalPath(d),m=new URL(c.url+`/object/upload/sign/${h}`);return m.searchParams.set("token",n),c.handleOperation(async()=>{let g;const p=le(le({},Jg),l);let S=le(le({},c.headers),{"x-upsert":String(p.upsert)});const b=p.metadata;if(typeof Blob<"u"&&r instanceof Blob?(g=new FormData,g.append("cacheControl",p.cacheControl),b&&g.append("metadata",c.encodeMetadata(b)),g.append("",r)):typeof FormData<"u"&&r instanceof FormData?(g=r,g.has("cacheControl")||g.append("cacheControl",p.cacheControl),b&&!g.has("metadata")&&g.append("metadata",c.encodeMetadata(b))):(g=r,S["cache-control"]=`max-age=${p.cacheControl}`,S["content-type"]=p.contentType,b&&(S["x-metadata"]=c.toBase64(c.encodeMetadata(b))),(typeof ReadableStream<"u"&&g instanceof ReadableStream||g&&typeof g=="object"&&"pipe"in g&&typeof g.pipe=="function")&&!p.duplex&&(p.duplex="half")),l?.headers)for(const[T,A]of Object.entries(l.headers))S=Uo(S,T,A);return{path:d,fullPath:(await Nd(c.fetch,m.toString(),g,le({headers:S},p?.duplex?{duplex:p.duplex}:{}))).Key}})}async createSignedUploadUrl(i,n){var r=this;return r.handleOperation(async()=>{let l=r._getFinalPath(i);const c=le({},r.headers);n?.upsert&&(c["x-upsert"]="true");const d=await wn(r.fetch,`${r.url}/object/upload/sign/${l}`,{},{headers:c}),h=new URL(r.url+d.url),m=h.searchParams.get("token");if(!m)throw new Io("No token returned by API");return{signedUrl:h.toString(),path:i,token:m}})}async update(i,n,r){return this.uploadOrUpdate("PUT",i,n,r)}async move(i,n,r){var l=this;return l.handleOperation(async()=>await wn(l.fetch,`${l.url}/object/move`,{bucketId:l.bucketId,sourceKey:i,destinationKey:n,destinationBucket:r?.destinationBucket},{headers:l.headers}))}async copy(i,n,r){var l=this;return l.handleOperation(async()=>({path:(await wn(l.fetch,`${l.url}/object/copy`,{bucketId:l.bucketId,sourceKey:i,destinationKey:n,destinationBucket:r?.destinationBucket},{headers:l.headers})).Key}))}async createSignedUrl(i,n,r){var l=this;return l.handleOperation(async()=>{let c=l._getFinalPath(i);const d=typeof r?.transform=="object"&&r.transform!==null&&Object.keys(r.transform).length>0;let h=await wn(l.fetch,`${l.url}/object/sign/${c}`,le({expiresIn:n},d?{transform:r.transform}:{}),{headers:l.headers});const m=new URLSearchParams;r?.download&&m.set("download",r.download===!0?"":r.download),r?.cacheNonce!=null&&m.set("cacheNonce",String(r.cacheNonce));const g=m.toString();return{signedUrl:encodeURI(`${l.url}${h.signedURL}${g?`&${g}`:""}`)}})}async createSignedUrls(i,n,r){var l=this;return l.handleOperation(async()=>{const c=await wn(l.fetch,`${l.url}/object/sign/${l.bucketId}`,{expiresIn:n,paths:i},{headers:l.headers}),d=new URLSearchParams;r?.download&&d.set("download",r.download===!0?"":r.download),r?.cacheNonce!=null&&d.set("cacheNonce",String(r.cacheNonce));const h=d.toString();return c.map(m=>le(le({},m),{},{signedUrl:m.signedURL?encodeURI(`${l.url}${m.signedURL}${h?`&${h}`:""}`):null}))})}download(i,n,r){const l=typeof n?.transform=="object"&&n.transform!==null&&Object.keys(n.transform).length>0?"render/image/authenticated":"object",c=new URLSearchParams;n?.transform&&this.applyTransformOptsToQuery(c,n.transform),n?.cacheNonce!=null&&c.set("cacheNonce",String(n.cacheNonce));const d=c.toString(),h=this._getFinalPath(i),m=()=>Js(this.fetch,`${this.url}/${l}/${h}${d?`?${d}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new gS(m,this.shouldThrowOnError)}async info(i){var n=this;const r=n._getFinalPath(i);return n.handleOperation(async()=>jd(await Js(n.fetch,`${n.url}/object/info/${r}`,{headers:n.headers})))}async exists(i){var n=this;const r=n._getFinalPath(i);try{return await fS(n.fetch,`${n.url}/object/${r}`,{headers:n.headers}),{data:!0,error:null}}catch(c){if(n.shouldThrowOnError)throw c;if(Go(c)){var l;const d=c instanceof Rd?c.status:c instanceof Lp?(l=c.originalError)===null||l===void 0?void 0:l.status:void 0;if(d!==void 0&&[400,404].includes(d))return{data:!1,error:c}}throw c}}getPublicUrl(i,n){const r=this._getFinalPath(i),l=new URLSearchParams;n?.download&&l.set("download",n.download===!0?"":n.download),n?.transform&&this.applyTransformOptsToQuery(l,n.transform),n?.cacheNonce!=null&&l.set("cacheNonce",String(n.cacheNonce));const c=l.toString(),d=typeof n?.transform=="object"&&n.transform!==null&&Object.keys(n.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${d}/public/${r}`)+(c?`?${c}`:"")}}}async remove(i){var n=this;return n.handleOperation(async()=>await Xs(n.fetch,`${n.url}/object/${n.bucketId}`,{prefixes:i},{headers:n.headers}))}async purgeCache(i,n,r){var l=this;return l.handleOperation(async()=>{const c=l._getFinalPath(i),d=new URLSearchParams;n?.transformations&&d.set("transformations","true");const h=d.toString();return await Xs(l.fetch,`${l.url}/cdn/${c}${h?`?${h}`:""}`,{},{headers:l.headers},r)})}async list(i,n,r){var l=this;return l.handleOperation(async()=>{const c=n?.sortBy?le(le({},ud.sortBy),n.sortBy):ud.sortBy,d=le(le(le({},ud),n),{},{sortBy:c,prefix:i||""});return await wn(l.fetch,`${l.url}/object/list/${l.bucketId}`,d,{headers:l.headers},r)})}async listV2(i,n){var r=this;return r.handleOperation(async()=>{const l=le({},i);return await wn(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,l,{headers:r.headers},n)})}encodeMetadata(i){return JSON.stringify(i)}toBase64(i){return typeof Buffer<"u"?Buffer.from(i).toString("base64"):btoa(i)}_getFinalPath(i){return`${this.bucketId}/${i.replace(/^\/+/,"")}`}_removeEmptyFolders(i){return i.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(i,n){return n.width&&i.set("width",n.width.toString()),n.height&&i.set("height",n.height.toString()),n.resize&&i.set("resize",n.resize),n.format&&i.set("format",n.format),n.quality&&i.set("quality",n.quality.toString()),i}};const yS="2.110.0",Fs={"X-Client-Info":`storage-js/${yS}`};var vS=class extends xr{constructor(i,n={},r,l){const c=new URL(i);l?.useNewHostname&&/supabase\.(co|in|red)$/.test(c.hostname)&&!c.hostname.includes("storage.supabase.")&&(c.hostname=c.hostname.replace("supabase.","storage.supabase."));const d=c.href.replace(/\/$/,""),h=le(le({},Fs),n);super(d,h,r,"storage")}async listBuckets(i){var n=this;return n.handleOperation(async()=>{const r=n.listBucketOptionsToQueryString(i);return await Js(n.fetch,`${n.url}/bucket${r}`,{headers:n.headers})})}async getBucket(i){var n=this;return n.handleOperation(async()=>await Js(n.fetch,`${n.url}/bucket/${i}`,{headers:n.headers}))}async createBucket(i,n={public:!1}){var r=this;return r.handleOperation(async()=>await wn(r.fetch,`${r.url}/bucket`,{id:i,name:i,type:n.type,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:r.headers}))}async updateBucket(i,n){var r=this;return r.handleOperation(async()=>await Nd(r.fetch,`${r.url}/bucket/${i}`,{id:i,name:i,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(i){var n=this;return n.handleOperation(async()=>await wn(n.fetch,`${n.url}/bucket/${i}/empty`,{},{headers:n.headers}))}async deleteBucket(i){var n=this;return n.handleOperation(async()=>await Xs(n.fetch,`${n.url}/bucket/${i}`,{},{headers:n.headers}))}async purgeBucketCache(i,n,r){var l=this;return l.handleOperation(async()=>{const c=new URLSearchParams;n?.transformations&&c.set("transformations","true");const d=c.toString();return await Xs(l.fetch,`${l.url}/cdn/${i}${d?`?${d}`:""}`,{},{headers:l.headers},r)})}listBucketOptionsToQueryString(i){const n={};return i&&("limit"in i&&(n.limit=String(i.limit)),"offset"in i&&(n.offset=String(i.offset)),i.search&&(n.search=i.search),i.sortColumn&&(n.sortColumn=i.sortColumn),i.sortOrder&&(n.sortOrder=i.sortOrder)),Object.keys(n).length>0?"?"+new URLSearchParams(n).toString():""}},bS=class extends xr{constructor(i,n={},r){const l=i.replace(/\/$/,""),c=le(le({},Fs),n);super(l,c,r,"storage")}async createBucket(i){var n=this;return n.handleOperation(async()=>await wn(n.fetch,`${n.url}/bucket`,{name:i},{headers:n.headers}))}async listBuckets(i){var n=this;return n.handleOperation(async()=>{const r=new URLSearchParams;i?.limit!==void 0&&r.set("limit",i.limit.toString()),i?.offset!==void 0&&r.set("offset",i.offset.toString()),i?.sortColumn&&r.set("sortColumn",i.sortColumn),i?.sortOrder&&r.set("sortOrder",i.sortOrder),i?.search&&r.set("search",i.search);const l=r.toString(),c=l?`${n.url}/bucket?${l}`:`${n.url}/bucket`;return await Js(n.fetch,c,{headers:n.headers})})}async deleteBucket(i){var n=this;return n.handleOperation(async()=>await Xs(n.fetch,`${n.url}/bucket/${i}`,{},{headers:n.headers}))}from(i){var n=this;if(!cS(i))throw new Io("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const r=new nS({baseUrl:this.url,catalogName:i,auth:{type:"custom",getHeaders:async()=>n.headers},fetch:this.fetch}),l=this.shouldThrowOnError;return new Proxy(r,{get(c,d){const h=c[d];return typeof h!="function"?h:async(...m)=>{try{return{data:await h.apply(c,m),error:null}}catch(g){if(l)throw g;return{data:null,error:g}}}}})}},SS=class extends xr{constructor(i,n={},r){const l=i.replace(/\/$/,""),c=le(le({},Fs),{},{"Content-Type":"application/json"},n);super(l,c,r,"vectors")}async createIndex(i){var n=this;return n.handleOperation(async()=>await en.post(n.fetch,`${n.url}/CreateIndex`,i,{headers:n.headers})||{})}async getIndex(i,n){var r=this;return r.handleOperation(async()=>await en.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:i,indexName:n},{headers:r.headers}))}async listIndexes(i){var n=this;return n.handleOperation(async()=>await en.post(n.fetch,`${n.url}/ListIndexes`,i,{headers:n.headers}))}async deleteIndex(i,n){var r=this;return r.handleOperation(async()=>await en.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:i,indexName:n},{headers:r.headers})||{})}},wS=class extends xr{constructor(i,n={},r){const l=i.replace(/\/$/,""),c=le(le({},Fs),{},{"Content-Type":"application/json"},n);super(l,c,r,"vectors")}async putVectors(i){var n=this;if(i.vectors.length<1||i.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return n.handleOperation(async()=>await en.post(n.fetch,`${n.url}/PutVectors`,i,{headers:n.headers})||{})}async getVectors(i){var n=this;return n.handleOperation(async()=>await en.post(n.fetch,`${n.url}/GetVectors`,i,{headers:n.headers}))}async listVectors(i){var n=this;if(i.segmentCount!==void 0){if(i.segmentCount<1||i.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(i.segmentIndex!==void 0&&(i.segmentIndex<0||i.segmentIndex>=i.segmentCount))throw new Error(`segmentIndex must be between 0 and ${i.segmentCount-1}`)}return n.handleOperation(async()=>await en.post(n.fetch,`${n.url}/ListVectors`,i,{headers:n.headers}))}async queryVectors(i){var n=this;return n.handleOperation(async()=>await en.post(n.fetch,`${n.url}/QueryVectors`,i,{headers:n.headers}))}async deleteVectors(i){var n=this;if(i.keys.length<1||i.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return n.handleOperation(async()=>await en.post(n.fetch,`${n.url}/DeleteVectors`,i,{headers:n.headers})||{})}},_S=class extends xr{constructor(i,n={},r){const l=i.replace(/\/$/,""),c=le(le({},Fs),{},{"Content-Type":"application/json"},n);super(l,c,r,"vectors")}async createBucket(i){var n=this;return n.handleOperation(async()=>await en.post(n.fetch,`${n.url}/CreateVectorBucket`,{vectorBucketName:i},{headers:n.headers})||{})}async getBucket(i){var n=this;return n.handleOperation(async()=>await en.post(n.fetch,`${n.url}/GetVectorBucket`,{vectorBucketName:i},{headers:n.headers}))}async listBuckets(i={}){var n=this;return n.handleOperation(async()=>await en.post(n.fetch,`${n.url}/ListVectorBuckets`,i,{headers:n.headers}))}async deleteBucket(i){var n=this;return n.handleOperation(async()=>await en.post(n.fetch,`${n.url}/DeleteVectorBucket`,{vectorBucketName:i},{headers:n.headers})||{})}},TS=class extends _S{constructor(i,n={}){super(i,n.headers||{},n.fetch)}from(i){return new kS(this.url,this.headers,i,this.fetch)}async createBucket(i){var n=()=>super.createBucket,r=this;return n().call(r,i)}async getBucket(i){var n=()=>super.getBucket,r=this;return n().call(r,i)}async listBuckets(i={}){var n=()=>super.listBuckets,r=this;return n().call(r,i)}async deleteBucket(i){var n=()=>super.deleteBucket,r=this;return n().call(r,i)}},kS=class extends SS{constructor(i,n,r,l){super(i,n,l),this.vectorBucketName=r}async createIndex(i){var n=()=>super.createIndex,r=this;return n().call(r,le(le({},i),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(i={}){var n=()=>super.listIndexes,r=this;return n().call(r,le(le({},i),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(i){var n=()=>super.getIndex,r=this;return n().call(r,r.vectorBucketName,i)}async deleteIndex(i){var n=()=>super.deleteIndex,r=this;return n().call(r,r.vectorBucketName,i)}index(i){return new ES(this.url,this.headers,this.vectorBucketName,i,this.fetch)}},ES=class extends wS{constructor(i,n,r,l,c){super(i,n,c),this.vectorBucketName=r,this.indexName=l}async putVectors(i){var n=()=>super.putVectors,r=this;return n().call(r,le(le({},i),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(i){var n=()=>super.getVectors,r=this;return n().call(r,le(le({},i),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(i={}){var n=()=>super.listVectors,r=this;return n().call(r,le(le({},i),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(i){var n=()=>super.queryVectors,r=this;return n().call(r,le(le({},i),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(i){var n=()=>super.deleteVectors,r=this;return n().call(r,le(le({},i),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},AS=class extends vS{constructor(i,n={},r,l){super(i,n,r,l)}from(i){return new pS(this.url,this.headers,i,this.fetch)}get vectors(){return new TS(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new bS(this.url+"/iceberg",this.headers,this.fetch)}};const zp="2.110.0",ma=30*1e3,Ms=3,dd=Ms*ma,xS=2*ma,CS="http://localhost:9999",OS="supabase.auth.token",RS={"X-Client-Info":`gotrue-js/${zp}`},Ld="X-Supabase-Api-Version",Bp={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},jS=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,NS=600*1e3;class Qs extends Error{constructor(n,r,l){super(n),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=l}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function X(i){return typeof i=="object"&&i!==null&&"__isAuthError"in i}class LS extends Qs{constructor(n,r,l){super(n,r,l),this.name="AuthApiError",this.status=r,this.code=l}}function DS(i){return X(i)&&i.name==="AuthApiError"}class Tn extends Qs{constructor(n,r){super(n),this.name="AuthUnknownError",this.originalError=r}}class Ln extends Qs{constructor(n,r,l,c){super(n,l,c),this.name=r,this.status=l}}class bt extends Ln{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function xo(i){return X(i)&&i.name==="AuthSessionMissingError"}class dr extends Ln{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Co extends Ln{constructor(n){super(n,"AuthInvalidCredentialsError",400,void 0)}}class Oo extends Ln{constructor(n,r=null){super(n,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function US(i){return X(i)&&i.name==="AuthImplicitGrantRedirectError"}class Xg extends Ln{constructor(n,r=null){super(n,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class MS extends Ln{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class Dd extends Ln{constructor(n,r){super(n,"AuthRetryableFetchError",r,void 0)}}function Qg(i){return X(i)&&i.name==="AuthRetryableFetchError"}class Wg extends Ln{constructor(n="Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)"){super(n,"AuthRefreshDiscardedError",409,void 0)}}function zS(i){return X(i)&&i.name==="AuthRefreshDiscardedError"}class Zg extends Ln{constructor(n,r,l){super(n,"AuthWeakPasswordError",r,"weak_password"),this.reasons=l}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class Mo extends Ln{constructor(n){super(n,"AuthInvalidJwtError",400,"invalid_jwt")}}const zo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Fg=`
21
- \r=`.split(""),BS=(()=>{const i=new Array(128);for(let n=0;n<i.length;n+=1)i[n]=-1;for(let n=0;n<Fg.length;n+=1)i[Fg[n].charCodeAt(0)]=-2;for(let n=0;n<zo.length;n+=1)i[zo[n].charCodeAt(0)]=n;return i})();function ep(i,n,r){if(i!==null)for(n.queue=n.queue<<8|i,n.queuedBits+=8;n.queuedBits>=6;){const l=n.queue>>n.queuedBits-6&63;r(zo[l]),n.queuedBits-=6}else if(n.queuedBits>0)for(n.queue=n.queue<<6-n.queuedBits,n.queuedBits=6;n.queuedBits>=6;){const l=n.queue>>n.queuedBits-6&63;r(zo[l]),n.queuedBits-=6}}function Hp(i,n,r){const l=BS[i];if(l>-1)for(n.queue=n.queue<<6|l,n.queuedBits+=6;n.queuedBits>=8;)r(n.queue>>n.queuedBits-8&255),n.queuedBits-=8;else{if(l===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(i)}"`)}}function tp(i){const n=[],r=h=>{n.push(String.fromCodePoint(h))},l={utf8seq:0,codepoint:0},c={queue:0,queuedBits:0},d=h=>{$S(h,l,r)};for(let h=0;h<i.length;h+=1)Hp(i.charCodeAt(h),c,d);return n.join("")}function HS(i,n){if(i<=127){n(i);return}else if(i<=2047){n(192|i>>6),n(128|i&63);return}else if(i<=65535){n(224|i>>12),n(128|i>>6&63),n(128|i&63);return}else if(i<=1114111){n(240|i>>18),n(128|i>>12&63),n(128|i>>6&63),n(128|i&63);return}throw new Error(`Unrecognized Unicode codepoint: ${i.toString(16)}`)}function qS(i,n){for(let r=0;r<i.length;r+=1){let l=i.charCodeAt(r);if(l>55295&&l<=56319){const c=(l-55296)*1024&65535;l=(i.charCodeAt(r+1)-56320&65535|c)+65536,r+=1}HS(l,n)}}function $S(i,n,r){if(n.utf8seq===0){if(i<=127){r(i);return}for(let l=1;l<6;l+=1)if((i>>7-l&1)===0){n.utf8seq=l;break}if(n.utf8seq===2)n.codepoint=i&31;else if(n.utf8seq===3)n.codepoint=i&15;else if(n.utf8seq===4)n.codepoint=i&7;else throw new Error("Invalid UTF-8 sequence");n.utf8seq-=1}else if(n.utf8seq>0){if(i<=127)throw new Error("Invalid UTF-8 sequence");n.codepoint=n.codepoint<<6|i&63,n.utf8seq-=1,n.utf8seq===0&&r(n.codepoint)}}function Er(i){const n=[],r={queue:0,queuedBits:0},l=c=>{n.push(c)};for(let c=0;c<i.length;c+=1)Hp(i.charCodeAt(c),r,l);return new Uint8Array(n)}function PS(i){const n=[];return qS(i,r=>n.push(r)),new Uint8Array(n)}function wi(i){const n=[],r={queue:0,queuedBits:0},l=c=>{n.push(c)};return i.forEach(c=>ep(c,r,l)),ep(null,r,l),n.join("")}function IS(i){return Math.round(Date.now()/1e3)+i}function GS(){return Symbol("auth-callback")}const Ct=()=>typeof window<"u"&&typeof document<"u",yi={tested:!1,writable:!1},qp=()=>{if(!Ct())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(yi.tested)return yi.writable;const i=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(i,i),globalThis.localStorage.removeItem(i),yi.tested=!0,yi.writable=!0}catch{yi.tested=!0,yi.writable=!1}return yi.writable};function VS(i){const n={},r=new URL(i);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((c,d)=>{n[d]=c})}catch{}return r.searchParams.forEach((l,c)=>{n[c]=l}),n}const $p=i=>i?(...n)=>i(...n):(...n)=>fetch(...n),KS=i=>typeof i=="object"&&i!==null&&"status"in i&&"ok"in i&&"json"in i&&typeof i.json=="function",Sr=async(i,n,r)=>{await i.setItem(n,JSON.stringify(r))},vn=async(i,n)=>{const r=await i.getItem(n);if(!r)return null;try{return JSON.parse(r)}catch{return null}},rt=async(i,n)=>{await i.removeItem(n)};class Vo{constructor(){this.promise=new Vo.promiseConstructor((n,r)=>{this.resolve=n,this.reject=r})}}Vo.promiseConstructor=Promise;function Ro(i){const n=i.split(".");if(n.length!==3)throw new Mo("Invalid JWT structure");for(let l=0;l<n.length;l++)if(!jS.test(n[l]))throw new Mo("JWT not in base64url format");return{header:JSON.parse(tp(n[0])),payload:JSON.parse(tp(n[1])),signature:Er(n[2]),raw:{header:n[0],payload:n[1]}}}async function YS(i){return await new Promise(n=>{setTimeout(()=>n(null),i)})}function JS(i,n){return new Promise((l,c)=>{(async()=>{for(let d=0;d<1/0;d++)try{const h=await i(d);if(!n(d,null,h)){l(h);return}}catch(h){if(!n(d,h)){c(h);return}}})()})}function XS(i){return("0"+i.toString(16)).substr(-2)}function QS(){const n=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",l=r.length;let c="";for(let d=0;d<56;d++)c+=r.charAt(Math.floor(Math.random()*l));return c}return crypto.getRandomValues(n),Array.from(n,XS).join("")}async function WS(i){const r=new TextEncoder().encode(i),l=await crypto.subtle.digest("SHA-256",r),c=new Uint8Array(l);return Array.from(c).map(d=>String.fromCharCode(d)).join("")}async function ZS(i){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),i;const r=await WS(i);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function vi(i,n,r=!1){const l=QS();let c=l;r&&(c+="/recovery"),await Sr(i,`${n}-code-verifier`,c);const d=await ZS(l);return[d,l===d?"plain":"s256"]}const FS=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function ew(i){const n=i.headers.get(Ld);if(!n||!n.match(FS))return null;try{return new Date(`${n}T00:00:00.0Z`)}catch{return null}}function tw(i){if(!i)throw new Error("Missing exp claim");const n=Math.floor(Date.now()/1e3);if(i<=n)throw new Error("JWT has expired")}function nw(i){switch(i){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const aw=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function ua(i){if(!aw.test(i))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function bn(i){if(!i.passkey)throw new Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function hd(){const i={};return new Proxy(i,{get:(n,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){const l=r.toString();if(l==="Symbol(Symbol.toPrimitive)"||l==="Symbol(Symbol.toStringTag)"||l==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(n,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(n,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function iw(i,n){return new Proxy(i,{get:(r,l,c)=>{if(l==="__isInsecureUserWarningProxy")return!0;if(typeof l=="symbol"){const d=l.toString();if(d==="Symbol(Symbol.toPrimitive)"||d==="Symbol(Symbol.toStringTag)"||d==="Symbol(util.inspect.custom)"||d==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,l,c)}return!n.value&&typeof l=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),n.value=!0),Reflect.get(r,l,c)}})}function np(i){return JSON.parse(JSON.stringify(i))}const Si=i=>{if(typeof i=="object"&&i!==null){const n=i;if(typeof n.msg=="string")return n.msg;if(typeof n.message=="string")return n.message;if(typeof n.error_description=="string")return n.error_description;if(typeof n.error=="string")return n.error}return JSON.stringify(i)},rw=[500,501,502,503,504,520,521,522,523,524,525,526,527,528,529,530];async function ap(i){var n;if(!KS(i))throw new Dd(Si(i),0);if(rw.includes(i.status))throw new Dd(Si(i),i.status);let r;try{r=await i.json()}catch(d){throw new Tn(Si(d),d)}let l;const c=ew(i);if(c&&c.getTime()>=Bp["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?l=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(l=r.error_code),l){if(l==="weak_password")throw new Zg(Si(r),i.status,((n=r.weak_password)===null||n===void 0?void 0:n.reasons)||[]);if(l==="session_not_found")throw new bt}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((d,h)=>d&&typeof h=="string",!0))throw new Zg(Si(r),i.status,r.weak_password.reasons);throw new LS(Si(r),i.status||500,l)}const sw=(i,n,r,l)=>{const c={method:i,headers:n?.headers||{}};return i==="GET"?c:(c.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},n?.headers),c.body=JSON.stringify(l),Object.assign(Object.assign({},c),r))};async function ee(i,n,r,l){var c;const d=Object.assign({},l?.headers);d[Ld]||(d[Ld]=Bp["2024-01-01"].name),l?.jwt&&(d.Authorization=`Bearer ${l.jwt}`);const h=(c=l?.query)!==null&&c!==void 0?c:{};l?.redirectTo&&(h.redirect_to=l.redirectTo);const m=Object.keys(h).length?"?"+new URLSearchParams(h).toString():"",g=await lw(i,n,r+m,{headers:d,noResolveJson:l?.noResolveJson},{},l?.body);return l?.xform?l?.xform(g):{data:Object.assign({},g),error:null}}async function lw(i,n,r,l,c,d){const h=sw(n,l,c,d);let m;try{m=await i(r,Object.assign({},h))}catch(g){throw console.error(g),new Dd(Si(g),0)}if(m.ok||await ap(m),l?.noResolveJson)return m;try{return await m.json()}catch(g){await ap(g)}}function hn(i){var n;let r=null;uw(i)&&(r=Object.assign({},i),i.expires_at||(r.expires_at=IS(i.expires_in)));const l=(n=i.user)!==null&&n!==void 0?n:typeof i?.id=="string"?i:null;return{data:{session:r,user:l},error:null}}function ip(i){const n=hn(i);return!n.error&&i.weak_password&&typeof i.weak_password=="object"&&Array.isArray(i.weak_password.reasons)&&i.weak_password.reasons.length&&i.weak_password.message&&typeof i.weak_password.message=="string"&&i.weak_password.reasons.reduce((r,l)=>r&&typeof l=="string",!0)&&(n.data.weak_password=i.weak_password),n}function Ya(i){var n;return{data:{user:(n=i.user)!==null&&n!==void 0?n:i},error:null}}function ow(i){return{data:i,error:null}}function cw(i){const{action_link:n,email_otp:r,hashed_token:l,redirect_to:c,verification_type:d}=i,h=Po(i,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),m={action_link:n,email_otp:r,hashed_token:l,redirect_to:c,verification_type:d},g=Object.assign({},h);return{data:{properties:m,user:g},error:null}}function rp(i){return i}function uw(i){return!!i.access_token&&!!i.refresh_token&&!!i.expires_in}const fd=["global","local","others"];class dw{constructor({url:n="",headers:r={},fetch:l,experimental:c}){this.url=n,this.headers=r,this.fetch=$p(l),this.experimental=c??{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(n,r=fd[0]){if(fd.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${fd.join(", ")}`);try{return await ee(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:n,noResolveJson:!0}),{data:null,error:null}}catch(l){if(X(l))return{data:null,error:l};throw l}}async inviteUserByEmail(n,r={}){try{return await ee(this.fetch,"POST",`${this.url}/invite`,{body:{email:n,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:Ya})}catch(l){if(X(l))return{data:{user:null},error:l};throw l}}async generateLink(n){try{const{options:r}=n,l=Po(n,["options"]),c=Object.assign(Object.assign({},l),r);return"newEmail"in l&&(c.new_email=l?.newEmail,delete c.newEmail),await ee(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:c,headers:this.headers,xform:cw,redirectTo:r?.redirectTo})}catch(r){if(X(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(n){try{return await ee(this.fetch,"POST",`${this.url}/admin/users`,{body:n,headers:this.headers,xform:Ya})}catch(r){if(X(r))return{data:{user:null},error:r};throw r}}async listUsers(n){var r,l,c,d,h,m,g;try{const p={nextPage:null,lastPage:0,total:0},S=await ee(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(l=(r=n?.page)===null||r===void 0?void 0:r.toString())!==null&&l!==void 0?l:"",per_page:(d=(c=n?.perPage)===null||c===void 0?void 0:c.toString())!==null&&d!==void 0?d:""},xform:rp});if(S.error)throw S.error;const b=await S.json(),T=(h=S.headers.get("x-total-count"))!==null&&h!==void 0?h:0,A=(g=(m=S.headers.get("link"))===null||m===void 0?void 0:m.split(","))!==null&&g!==void 0?g:[];return A.length>0&&(A.forEach(C=>{const U=parseInt(C.split(";")[0].split("=")[1].substring(0,1)),$=JSON.parse(C.split(";")[1].split("=")[1]);p[`${$}Page`]=U}),p.total=parseInt(T)),{data:Object.assign(Object.assign({},b),p),error:null}}catch(p){if(X(p))return{data:{users:[]},error:p};throw p}}async getUserById(n){ua(n);try{return await ee(this.fetch,"GET",`${this.url}/admin/users/${n}`,{headers:this.headers,xform:Ya})}catch(r){if(X(r))return{data:{user:null},error:r};throw r}}async updateUserById(n,r){ua(n);try{return await ee(this.fetch,"PUT",`${this.url}/admin/users/${n}`,{body:r,headers:this.headers,xform:Ya})}catch(l){if(X(l))return{data:{user:null},error:l};throw l}}async deleteUser(n,r=!1){ua(n);try{return await ee(this.fetch,"DELETE",`${this.url}/admin/users/${n}`,{headers:this.headers,body:{should_soft_delete:r},xform:Ya})}catch(l){if(X(l))return{data:{user:null},error:l};throw l}}async _listFactors(n){ua(n.userId);try{const{data:r,error:l}=await ee(this.fetch,"GET",`${this.url}/admin/users/${n.userId}/factors`,{headers:this.headers,xform:c=>({data:{factors:c},error:null})});return{data:r,error:l}}catch(r){if(X(r))return{data:null,error:r};throw r}}async _deleteFactor(n){ua(n.userId),ua(n.id);try{return{data:await ee(this.fetch,"DELETE",`${this.url}/admin/users/${n.userId}/factors/${n.id}`,{headers:this.headers}),error:null}}catch(r){if(X(r))return{data:null,error:r};throw r}}async _listOAuthClients(n){var r,l,c,d,h,m,g;try{const p={nextPage:null,lastPage:0,total:0},S=await ee(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(l=(r=n?.page)===null||r===void 0?void 0:r.toString())!==null&&l!==void 0?l:"",per_page:(d=(c=n?.perPage)===null||c===void 0?void 0:c.toString())!==null&&d!==void 0?d:""},xform:rp});if(S.error)throw S.error;const b=await S.json(),T=(h=S.headers.get("x-total-count"))!==null&&h!==void 0?h:0,A=(g=(m=S.headers.get("link"))===null||m===void 0?void 0:m.split(","))!==null&&g!==void 0?g:[];return A.length>0&&(A.forEach(C=>{const U=parseInt(C.split(";")[0].split("=")[1].substring(0,1)),$=JSON.parse(C.split(";")[1].split("=")[1]);p[`${$}Page`]=U}),p.total=parseInt(T)),{data:Object.assign(Object.assign({},b),p),error:null}}catch(p){if(X(p))return{data:{clients:[]},error:p};throw p}}async _createOAuthClient(n){try{return await ee(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(X(r))return{data:null,error:r};throw r}}async _getOAuthClient(n){try{return await ee(this.fetch,"GET",`${this.url}/admin/oauth/clients/${n}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(X(r))return{data:null,error:r};throw r}}async _updateOAuthClient(n,r){try{return await ee(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${n}`,{body:r,headers:this.headers,xform:l=>({data:l,error:null})})}catch(l){if(X(l))return{data:null,error:l};throw l}}async _deleteOAuthClient(n){try{return await ee(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${n}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(X(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(n){try{return await ee(this.fetch,"POST",`${this.url}/admin/oauth/clients/${n}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(X(r))return{data:null,error:r};throw r}}async _listCustomProviders(n){try{const r={};return n?.type&&(r.type=n.type),await ee(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:r,xform:l=>{var c;return{data:{providers:(c=l?.providers)!==null&&c!==void 0?c:[]},error:null}}})}catch(r){if(X(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(n){try{return await ee(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(X(r))return{data:null,error:r};throw r}}async _getCustomProvider(n){try{return await ee(this.fetch,"GET",`${this.url}/admin/custom-providers/${n}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(X(r))return{data:null,error:r};throw r}}async _updateCustomProvider(n,r){try{return await ee(this.fetch,"PUT",`${this.url}/admin/custom-providers/${n}`,{body:r,headers:this.headers,xform:l=>({data:l,error:null})})}catch(l){if(X(l))return{data:null,error:l};throw l}}async _deleteCustomProvider(n){try{return await ee(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${n}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(X(r))return{data:null,error:r};throw r}}async _adminListPasskeys(n){bn(this.experimental),ua(n.userId);try{return await ee(this.fetch,"GET",`${this.url}/admin/users/${n.userId}/passkeys`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(X(r))return{data:null,error:r};throw r}}async _adminDeletePasskey(n){bn(this.experimental),ua(n.userId),ua(n.passkeyId);try{return await ee(this.fetch,"DELETE",`${this.url}/admin/users/${n.userId}/passkeys/${n.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(X(r))return{data:null,error:r};throw r}}}function sp(i={}){return{getItem:n=>i[n]||null,setItem:(n,r)=>{i[n]=r},removeItem:n=>{delete i[n]}}}globalThis&&qp()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug");class hw extends Error{constructor(n){super(n),this.isAcquireTimeout=!0}}function fw(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function Pp(i){if(!/^0x[a-fA-F0-9]{40}$/.test(i))throw new Error(`@supabase/auth-js: Address "${i}" is invalid.`);return i.toLowerCase()}function mw(i){return parseInt(i,16)}function gw(i){const n=new TextEncoder().encode(i);return"0x"+Array.from(n,l=>l.toString(16).padStart(2,"0")).join("")}function pw(i){var n;const{chainId:r,domain:l,expirationTime:c,issuedAt:d=new Date,nonce:h,notBefore:m,requestId:g,resources:p,scheme:S,uri:b,version:T}=i;{if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!l)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(h&&h.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${h}`);if(!b)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(T!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${T}`);if(!((n=i.statement)===null||n===void 0)&&n.includes(`
20
+ });`;class Wb{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(n,r){var l;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={},this.ref=0,this.serializer=new yb,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=d=>d?(...h)=>d(...h):(...h)=>fetch(...h),!(!((l=r?.params)===null||l===void 0)&&l.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey;const c=this._initializeOptions(r);this.socketAdapter=new Vb(n,c),this.httpEndpoint=jp(n),this.fetch=this._resolveFetch(r?.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(n){const r=n.message;throw new Error(`WebSocket not available: ${r}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(n,r){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},n,r)}getChannels(){return this.channels}async removeChannel(n){const r=await n.unsubscribe();return r==="ok"&&n.teardown(),r}async removeAllChannels(){const n=this.channels.map(async l=>{const c=await l.unsubscribe();return l.teardown(),c}),r=await Promise.all(n);return await this.disconnect(),r}log(n,r,l){this.socketAdapter.log(n,r,l)}connectionState(){return this.socketAdapter.connectionState()||Ad.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(n,r={config:{}}){const l=`realtime:${n}`,c=this.getChannels().find(d=>d.topic===l);if(c)return c;{const d=new qs(`realtime:${n}`,r,this);return this._cancelPendingDisconnect(),this.channels.push(d),d}}push(n){this.socketAdapter.push(n)}async setAuth(n=null){this._authPromise=this._performAuth(n);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(n){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(n)}_makeRef(){return this.socketAdapter.makeRef()}_remove(n){this.channels=this.channels.filter(r=>r.topic!==n.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(n=null){let r,l=!1;if(n)r=n,l=!0;else if(this.accessToken)try{r=await this.accessToken()}catch(c){this.log("error","Error fetching access token from callback",c),r=this.accessTokenValue}else r=this.accessTokenValue;l?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(c=>{const d={access_token:r,version:hb};r&&c.updateJoinPayload(d),c.joinedOnce&&c.channelAdapter.isJoined()&&c.channelAdapter.push(Op.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(n="general"){this._isManualToken()||this.setAuth().catch(r=>{this.log("error",`Error setting auth in ${n}`,r)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(r=>{this.log("error","error waiting for auth on connect",r)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(n=>{n.ref&&n.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(n){return(r,l)=>{r=="sent"&&this._setAuthSafely(),n&&n(r,l)}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const n=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(n),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(n){let r;if(n)r=n;else{const l=new Blob([Qb],{type:"application/javascript"});r=URL.createObjectURL(l)}return r}_initializeOptions(n){var r,l,c,d,h,m,g,p,S,b,T,A;this.worker=(r=n?.worker)!==null&&r!==void 0?r:!1,this.accessToken=(l=n?.accessToken)!==null&&l!==void 0?l:null;const C={};C.timeout=(c=n?.timeout)!==null&&c!==void 0?c:gb,C.heartbeatIntervalMs=(d=n?.heartbeatIntervalMs)!==null&&d!==void 0?d:Vg.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(h=n?.disconnectOnEmptyChannelsAfterMs)!==null&&h!==void 0?h:2*((m=n?.heartbeatIntervalMs)!==null&&m!==void 0?m:Vg.HEARTBEAT_INTERVAL),C.transport=(g=n?.transport)!==null&&g!==void 0?g:ub.getWebSocketConstructor(),C.params=n?.params,C.logger=n?.logger,C.heartbeatCallback=this._wrapHeartbeatCallback(n?.heartbeatCallback),C.sessionStorage=(p=n?.sessionStorage)!==null&&p!==void 0?p:Xb(),C.reconnectAfterMs=(S=n?.reconnectAfterMs)!==null&&S!==void 0?S:(q=>Kb[q-1]||Yb);let U,$;const P=(b=n?.vsn)!==null&&b!==void 0?b:mb;switch(P){case fb:U=(q,N)=>N(JSON.stringify(q)),$=(q,N)=>N(JSON.parse(q));break;case Cp:U=this.serializer.encode.bind(this.serializer),$=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${C.vsn}`)}if(C.vsn=P,C.encode=(T=n?.encode)!==null&&T!==void 0?T:U,C.decode=(A=n?.decode)!==null&&A!==void 0?A:$,C.beforeReconnect=this._reconnectAuth.bind(this),(n?.logLevel||n?.log_level)&&(this.logLevel=n.logLevel||n.log_level,C.params=Object.assign(Object.assign({},C.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=n?.workerUrl,C.autoSendHeartbeat=!this.worker}return C}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var Ks=class extends Error{constructor(i,n){super(i),this.name="IcebergError",this.status=n.status,this.icebergType=n.icebergType,this.icebergCode=n.icebergCode,this.details=n.details,this.isCommitStateUnknown=n.icebergType==="CommitStateUnknownException"||[500,502,504].includes(n.status)&&n.icebergType?.includes("CommitState")===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function Zb(i,n,r){const l=new URL(n,i);if(r)for(const[c,d]of Object.entries(r))d!==void 0&&l.searchParams.set(c,d);return l.toString()}async function Fb(i){return!i||i.type==="none"?{}:i.type==="bearer"?{Authorization:`Bearer ${i.token}`}:i.type==="header"?{[i.name]:i.value}:i.type==="custom"?await i.getHeaders():{}}function eS(i){const n=i.fetchImpl??globalThis.fetch;return{async request({method:r,path:l,query:c,body:d,headers:h}){const m=Zb(i.baseUrl,l,c),g=await Fb(i.auth),p=await n(m,{method:r,headers:{...d?{"Content-Type":"application/json"}:{},...g,...h},body:d?JSON.stringify(d):void 0}),S=await p.text(),b=(p.headers.get("content-type")||"").includes("application/json"),T=b&&S?JSON.parse(S):S;if(!p.ok){const A=b?T:void 0,C=A?.error;throw new Ks(C?.message??`Request failed with status ${p.status}`,{status:p.status,icebergType:C?.type,icebergCode:C?.code,details:A})}return{status:p.status,headers:p.headers,data:T}}}}function Ao(i){return i.join("")}var tS=class{constructor(i,n=""){this.client=i,this.prefix=n}async listNamespaces(i){const n=i?{parent:Ao(i.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:n})).data.namespaces.map(l=>({namespace:l}))}async createNamespace(i,n){const r={namespace:i.namespace,properties:n?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(i){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Ao(i.namespace)}`})}async loadNamespaceMetadata(i){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Ao(i.namespace)}`})).data.properties}}async namespaceExists(i){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Ao(i.namespace)}`}),!0}catch(n){if(n instanceof Ks&&n.status===404)return!1;throw n}}async createNamespaceIfNotExists(i,n){try{return await this.createNamespace(i,n)}catch(r){if(r instanceof Ks&&r.status===409)return;throw r}}};function ur(i){return i.join("")}var nS=class{constructor(i,n="",r){this.client=i,this.prefix=n,this.accessDelegation=r}async listTables(i){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${ur(i.namespace)}/tables`})).data.identifiers}async createTable(i,n){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${ur(i.namespace)}/tables`,body:n,headers:r})).data.metadata}async updateTable(i,n){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${ur(i.namespace)}/tables/${i.name}`,body:n});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(i,n){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${ur(i.namespace)}/tables/${i.name}`,query:{purgeRequested:String(n?.purge??!1)}})}async loadTable(i){const n={};return this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${ur(i.namespace)}/tables/${i.name}`,headers:n})).data.metadata}async tableExists(i){const n={};this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${ur(i.namespace)}/tables/${i.name}`,headers:n}),!0}catch(r){if(r instanceof Ks&&r.status===404)return!1;throw r}}async createTableIfNotExists(i,n){try{return await this.createTable(i,n)}catch(r){if(r instanceof Ks&&r.status===409)return await this.loadTable({namespace:i.namespace,name:n.name});throw r}}},aS=class{constructor(i){let n="v1";i.catalogName&&(n+=`/${i.catalogName}`);const r=i.baseUrl.endsWith("/")?i.baseUrl:`${i.baseUrl}/`;this.client=eS({baseUrl:r,auth:i.auth,fetchImpl:i.fetch}),this.accessDelegation=i.accessDelegation?.join(","),this.namespaceOps=new tS(this.client,n),this.tableOps=new nS(this.client,n,this.accessDelegation)}async listNamespaces(i){return this.namespaceOps.listNamespaces(i)}async createNamespace(i,n){return this.namespaceOps.createNamespace(i,n)}async dropNamespace(i){await this.namespaceOps.dropNamespace(i)}async loadNamespaceMetadata(i){return this.namespaceOps.loadNamespaceMetadata(i)}async listTables(i){return this.tableOps.listTables(i)}async createTable(i,n){return this.tableOps.createTable(i,n)}async updateTable(i,n){return this.tableOps.updateTable(i,n)}async dropTable(i,n){await this.tableOps.dropTable(i,n)}async loadTable(i){return this.tableOps.loadTable(i)}async namespaceExists(i){return this.namespaceOps.namespaceExists(i)}async tableExists(i){return this.tableOps.tableExists(i)}async createNamespaceIfNotExists(i,n){return this.namespaceOps.createNamespaceIfNotExists(i,n)}async createTableIfNotExists(i,n){return this.tableOps.createTableIfNotExists(i,n)}};function Ys(i){"@babel/helpers - typeof";return Ys=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Ys(i)}function iS(i,n){if(Ys(i)!="object"||!i)return i;var r=i[Symbol.toPrimitive];if(r!==void 0){var l=r.call(i,n);if(Ys(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(i)}function rS(i){var n=iS(i,"string");return Ys(n)=="symbol"?n:n+""}function sS(i,n,r){return(n=rS(n))in i?Object.defineProperty(i,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):i[n]=r,i}function Kg(i,n){var r=Object.keys(i);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(i);n&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(i,c).enumerable})),r.push.apply(r,l)}return r}function le(i){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?Kg(Object(r),!0).forEach(function(l){sS(i,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(r)):Kg(Object(r)).forEach(function(l){Object.defineProperty(i,l,Object.getOwnPropertyDescriptor(r,l))})}return i}var Io=class extends Error{constructor(i,n="storage",r,l){super(i),this.__isStorageError=!0,this.namespace=n,this.name=n==="vectors"?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=l}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function Go(i){return typeof i=="object"&&i!==null&&"__isStorageError"in i}var Rd=class extends Io{constructor(i,n,r,l="storage"){super(i,l,n,r),this.name=l==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=n,this.statusCode=r}toJSON(){return le({},super.toJSON())}},Lp=class extends Io{constructor(i,n,r="storage"){super(i,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=n}};function Uo(i,n,r){const l=le({},i),c=n.toLowerCase();for(const d of Object.keys(l))d.toLowerCase()===c&&delete l[d];return l[c]=r,l}function lS(i){const n={};for(const[r,l]of Object.entries(i))n[r.toLowerCase()]=l;return n}const oS=i=>i?(...n)=>i(...n):(...n)=>fetch(...n),cS=i=>{if(typeof i!="object"||i===null)return!1;const n=Object.getPrototypeOf(i);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in i)&&!(Symbol.iterator in i)},jd=i=>{if(Array.isArray(i))return i.map(r=>jd(r));if(typeof i=="function"||i!==Object(i))return i;const n={};return Object.entries(i).forEach(([r,l])=>{const c=r.replace(/([-_][a-z])/gi,d=>d.toUpperCase().replace(/[-_]/g,""));n[c]=jd(l)}),n},uS=i=>!i||typeof i!="string"||i.length===0||i.length>100||i.trim()!==i||i.includes("/")||i.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(i),Yg=i=>{if(typeof i=="object"&&i!==null){const n=i;if(typeof n.msg=="string")return n.msg;if(typeof n.message=="string")return n.message;if(typeof n.error_description=="string")return n.error_description;if(typeof n.error=="string")return n.error;if(typeof n.error=="object"&&n.error!==null){const r=n.error;if(typeof r.message=="string")return r.message}}return JSON.stringify(i)},dS=async(i,n,r,l)=>{if(i!==null&&typeof i=="object"&&"json"in i&&typeof i.json=="function"){const c=i;let d=parseInt(String(c.status),10);Number.isFinite(d)||(d=500),c.json().then(h=>{const m=h?.statusCode||h?.code||d+"";n(new Rd(Yg(h),d,m,l))}).catch(()=>{const h=d+"";n(new Rd(c.statusText||`HTTP ${d} error`,d,h,l))})}else n(new Lp(Yg(i),i,l))},hS=(i,n,r,l)=>{const c={method:i,headers:n?.headers||{}};if(i==="GET"||i==="HEAD"||!l)return le(le({},c),r);if(cS(l)){var d;const h=n?.headers||{};let m;for(const[g,p]of Object.entries(h))g.toLowerCase()==="content-type"&&(m=p);c.headers=Uo(h,"Content-Type",(d=m)!==null&&d!==void 0?d:"application/json"),c.body=JSON.stringify(l)}else c.body=l;return n?.duplex&&(c.duplex=n.duplex),le(le({},c),r)};async function js(i,n,r,l,c,d,h){return new Promise((m,g)=>{i(r,hS(n,l,c,d)).then(p=>{if(!p.ok)throw p;if(l?.noResolveJson)return p;if(h==="vectors"){const S=p.headers.get("content-type");if(p.headers.get("content-length")==="0"||p.status===204)return{};if(!S||!S.includes("application/json"))return{}}return p.json()}).then(p=>m(p)).catch(p=>dS(p,g,l,h))})}function Dp(i="storage"){return{get:async(n,r,l,c)=>js(n,"GET",r,l,c,void 0,i),post:async(n,r,l,c,d)=>js(n,"POST",r,c,d,l,i),put:async(n,r,l,c,d)=>js(n,"PUT",r,c,d,l,i),head:async(n,r,l,c)=>js(n,"HEAD",r,le(le({},l),{},{noResolveJson:!0}),c,void 0,i),remove:async(n,r,l,c,d)=>js(n,"DELETE",r,c,d,l,i)}}const fS=Dp("storage"),{get:Js,post:_n,put:Nd,head:mS,remove:Xs}=fS,en=Dp("vectors");var xr=class{constructor(i,n={},r,l="storage"){this.shouldThrowOnError=!1,this.url=i,this.headers=lS(n),this.fetch=oS(r),this.namespace=l}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(i,n){return this.headers=Uo(this.headers,i,n),this}async handleOperation(i){var n=this;try{return{data:await i(),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(Go(r))return{data:null,error:r};throw r}}};let Up;Up=Symbol.toStringTag;var gS=class{constructor(i,n){this.downloadFn=i,this.shouldThrowOnError=n,this[Up]="StreamDownloadBuilder",this.promise=null}then(i,n){return this.getPromise().then(i,n)}catch(i){return this.getPromise().catch(i)}finally(i){return this.getPromise().finally(i)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var i=this;try{return{data:(await i.downloadFn()).body,error:null}}catch(n){if(i.shouldThrowOnError)throw n;if(Go(n))return{data:null,error:n};throw n}}};let Mp;Mp=Symbol.toStringTag;var pS=class{constructor(i,n){this.downloadFn=i,this.shouldThrowOnError=n,this[Mp]="BlobDownloadBuilder",this.promise=null}asStream(){return new gS(this.downloadFn,this.shouldThrowOnError)}then(i,n){return this.getPromise().then(i,n)}catch(i){return this.getPromise().catch(i)}finally(i){return this.getPromise().finally(i)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var i=this;try{return{data:await(await i.downloadFn()).blob(),error:null}}catch(n){if(i.shouldThrowOnError)throw n;if(Go(n))return{data:null,error:n};throw n}}};const ud={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Jg={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var yS=class extends xr{constructor(i,n={},r,l){super(i,n,l,"storage"),this.bucketId=r}async uploadOrUpdate(i,n,r,l){var c=this;return c.handleOperation(async()=>{let d;const h=le(le({},Jg),l);let m=le(le({},c.headers),i==="POST"&&{"x-upsert":String(h.upsert)});const g=h.metadata;if(typeof Blob<"u"&&r instanceof Blob?(d=new FormData,d.append("cacheControl",h.cacheControl),g&&d.append("metadata",c.encodeMetadata(g)),d.append("",r)):typeof FormData<"u"&&r instanceof FormData?(d=r,d.has("cacheControl")||d.append("cacheControl",h.cacheControl),g&&!d.has("metadata")&&d.append("metadata",c.encodeMetadata(g))):(d=r,m["cache-control"]=`max-age=${h.cacheControl}`,m["content-type"]=h.contentType,g&&(m["x-metadata"]=c.toBase64(c.encodeMetadata(g))),(typeof ReadableStream<"u"&&d instanceof ReadableStream||d&&typeof d=="object"&&"pipe"in d&&typeof d.pipe=="function")&&!h.duplex&&(h.duplex="half")),l?.headers)for(const[T,A]of Object.entries(l.headers))m=Uo(m,T,A);const p=c._removeEmptyFolders(n),S=c._getFinalPath(p),b=await(i=="PUT"?Nd:_n)(c.fetch,`${c.url}/object/${S}`,d,le({headers:m},h?.duplex?{duplex:h.duplex}:{}));return{path:p,id:b.Id,fullPath:b.Key}})}async upload(i,n,r){return this.uploadOrUpdate("POST",i,n,r)}async uploadToSignedUrl(i,n,r,l){var c=this;const d=c._removeEmptyFolders(i),h=c._getFinalPath(d),m=new URL(c.url+`/object/upload/sign/${h}`);return m.searchParams.set("token",n),c.handleOperation(async()=>{let g;const p=le(le({},Jg),l);let S=le(le({},c.headers),{"x-upsert":String(p.upsert)});const b=p.metadata;if(typeof Blob<"u"&&r instanceof Blob?(g=new FormData,g.append("cacheControl",p.cacheControl),b&&g.append("metadata",c.encodeMetadata(b)),g.append("",r)):typeof FormData<"u"&&r instanceof FormData?(g=r,g.has("cacheControl")||g.append("cacheControl",p.cacheControl),b&&!g.has("metadata")&&g.append("metadata",c.encodeMetadata(b))):(g=r,S["cache-control"]=`max-age=${p.cacheControl}`,S["content-type"]=p.contentType,b&&(S["x-metadata"]=c.toBase64(c.encodeMetadata(b))),(typeof ReadableStream<"u"&&g instanceof ReadableStream||g&&typeof g=="object"&&"pipe"in g&&typeof g.pipe=="function")&&!p.duplex&&(p.duplex="half")),l?.headers)for(const[T,A]of Object.entries(l.headers))S=Uo(S,T,A);return{path:d,fullPath:(await Nd(c.fetch,m.toString(),g,le({headers:S},p?.duplex?{duplex:p.duplex}:{}))).Key}})}async createSignedUploadUrl(i,n){var r=this;return r.handleOperation(async()=>{let l=r._getFinalPath(i);const c=le({},r.headers);n?.upsert&&(c["x-upsert"]="true");const d=await _n(r.fetch,`${r.url}/object/upload/sign/${l}`,{},{headers:c}),h=new URL(r.url+d.url),m=h.searchParams.get("token");if(!m)throw new Io("No token returned by API");return{signedUrl:h.toString(),path:i,token:m}})}async update(i,n,r){return this.uploadOrUpdate("PUT",i,n,r)}async move(i,n,r){var l=this;return l.handleOperation(async()=>await _n(l.fetch,`${l.url}/object/move`,{bucketId:l.bucketId,sourceKey:i,destinationKey:n,destinationBucket:r?.destinationBucket},{headers:l.headers}))}async copy(i,n,r){var l=this;return l.handleOperation(async()=>({path:(await _n(l.fetch,`${l.url}/object/copy`,{bucketId:l.bucketId,sourceKey:i,destinationKey:n,destinationBucket:r?.destinationBucket},{headers:l.headers})).Key}))}async createSignedUrl(i,n,r){var l=this;return l.handleOperation(async()=>{let c=l._getFinalPath(i);const d=typeof r?.transform=="object"&&r.transform!==null&&Object.keys(r.transform).length>0;let h=await _n(l.fetch,`${l.url}/object/sign/${c}`,le({expiresIn:n},d?{transform:r.transform}:{}),{headers:l.headers});const m=new URLSearchParams;r?.download&&m.set("download",r.download===!0?"":r.download),r?.cacheNonce!=null&&m.set("cacheNonce",String(r.cacheNonce));const g=m.toString();return{signedUrl:encodeURI(`${l.url}${h.signedURL}${g?`&${g}`:""}`)}})}async createSignedUrls(i,n,r){var l=this;return l.handleOperation(async()=>{const c=await _n(l.fetch,`${l.url}/object/sign/${l.bucketId}`,{expiresIn:n,paths:i},{headers:l.headers}),d=new URLSearchParams;r?.download&&d.set("download",r.download===!0?"":r.download),r?.cacheNonce!=null&&d.set("cacheNonce",String(r.cacheNonce));const h=d.toString();return c.map(m=>le(le({},m),{},{signedUrl:m.signedURL?encodeURI(`${l.url}${m.signedURL}${h?`&${h}`:""}`):null}))})}download(i,n,r){const l=typeof n?.transform=="object"&&n.transform!==null&&Object.keys(n.transform).length>0?"render/image/authenticated":"object",c=new URLSearchParams;n?.transform&&this.applyTransformOptsToQuery(c,n.transform),n?.cacheNonce!=null&&c.set("cacheNonce",String(n.cacheNonce));const d=c.toString(),h=this._getFinalPath(i),m=()=>Js(this.fetch,`${this.url}/${l}/${h}${d?`?${d}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new pS(m,this.shouldThrowOnError)}async info(i){var n=this;const r=n._getFinalPath(i);return n.handleOperation(async()=>jd(await Js(n.fetch,`${n.url}/object/info/${r}`,{headers:n.headers})))}async exists(i){var n=this;const r=n._getFinalPath(i);try{return await mS(n.fetch,`${n.url}/object/${r}`,{headers:n.headers}),{data:!0,error:null}}catch(c){if(n.shouldThrowOnError)throw c;if(Go(c)){var l;const d=c instanceof Rd?c.status:c instanceof Lp?(l=c.originalError)===null||l===void 0?void 0:l.status:void 0;if(d!==void 0&&[400,404].includes(d))return{data:!1,error:c}}throw c}}getPublicUrl(i,n){const r=this._getFinalPath(i),l=new URLSearchParams;n?.download&&l.set("download",n.download===!0?"":n.download),n?.transform&&this.applyTransformOptsToQuery(l,n.transform),n?.cacheNonce!=null&&l.set("cacheNonce",String(n.cacheNonce));const c=l.toString(),d=typeof n?.transform=="object"&&n.transform!==null&&Object.keys(n.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${d}/public/${r}`)+(c?`?${c}`:"")}}}async remove(i){var n=this;return n.handleOperation(async()=>await Xs(n.fetch,`${n.url}/object/${n.bucketId}`,{prefixes:i},{headers:n.headers}))}async purgeCache(i,n,r){var l=this;return l.handleOperation(async()=>{const c=l._getFinalPath(i),d=new URLSearchParams;n?.transformations&&d.set("transformations","true");const h=d.toString();return await Xs(l.fetch,`${l.url}/cdn/${c}${h?`?${h}`:""}`,{},{headers:l.headers},r)})}async list(i,n,r){var l=this;return l.handleOperation(async()=>{const c=n?.sortBy?le(le({},ud.sortBy),n.sortBy):ud.sortBy,d=le(le(le({},ud),n),{},{sortBy:c,prefix:i||""});return await _n(l.fetch,`${l.url}/object/list/${l.bucketId}`,d,{headers:l.headers},r)})}async listV2(i,n){var r=this;return r.handleOperation(async()=>{const l=le({},i);return await _n(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,l,{headers:r.headers},n)})}encodeMetadata(i){return JSON.stringify(i)}toBase64(i){return typeof Buffer<"u"?Buffer.from(i).toString("base64"):btoa(i)}_getFinalPath(i){return`${this.bucketId}/${i.replace(/^\/+/,"")}`}_removeEmptyFolders(i){return i.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(i,n){return n.width&&i.set("width",n.width.toString()),n.height&&i.set("height",n.height.toString()),n.resize&&i.set("resize",n.resize),n.format&&i.set("format",n.format),n.quality&&i.set("quality",n.quality.toString()),i}};const vS="2.110.0",Fs={"X-Client-Info":`storage-js/${vS}`};var bS=class extends xr{constructor(i,n={},r,l){const c=new URL(i);l?.useNewHostname&&/supabase\.(co|in|red)$/.test(c.hostname)&&!c.hostname.includes("storage.supabase.")&&(c.hostname=c.hostname.replace("supabase.","storage.supabase."));const d=c.href.replace(/\/$/,""),h=le(le({},Fs),n);super(d,h,r,"storage")}async listBuckets(i){var n=this;return n.handleOperation(async()=>{const r=n.listBucketOptionsToQueryString(i);return await Js(n.fetch,`${n.url}/bucket${r}`,{headers:n.headers})})}async getBucket(i){var n=this;return n.handleOperation(async()=>await Js(n.fetch,`${n.url}/bucket/${i}`,{headers:n.headers}))}async createBucket(i,n={public:!1}){var r=this;return r.handleOperation(async()=>await _n(r.fetch,`${r.url}/bucket`,{id:i,name:i,type:n.type,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:r.headers}))}async updateBucket(i,n){var r=this;return r.handleOperation(async()=>await Nd(r.fetch,`${r.url}/bucket/${i}`,{id:i,name:i,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(i){var n=this;return n.handleOperation(async()=>await _n(n.fetch,`${n.url}/bucket/${i}/empty`,{},{headers:n.headers}))}async deleteBucket(i){var n=this;return n.handleOperation(async()=>await Xs(n.fetch,`${n.url}/bucket/${i}`,{},{headers:n.headers}))}async purgeBucketCache(i,n,r){var l=this;return l.handleOperation(async()=>{const c=new URLSearchParams;n?.transformations&&c.set("transformations","true");const d=c.toString();return await Xs(l.fetch,`${l.url}/cdn/${i}${d?`?${d}`:""}`,{},{headers:l.headers},r)})}listBucketOptionsToQueryString(i){const n={};return i&&("limit"in i&&(n.limit=String(i.limit)),"offset"in i&&(n.offset=String(i.offset)),i.search&&(n.search=i.search),i.sortColumn&&(n.sortColumn=i.sortColumn),i.sortOrder&&(n.sortOrder=i.sortOrder)),Object.keys(n).length>0?"?"+new URLSearchParams(n).toString():""}},SS=class extends xr{constructor(i,n={},r){const l=i.replace(/\/$/,""),c=le(le({},Fs),n);super(l,c,r,"storage")}async createBucket(i){var n=this;return n.handleOperation(async()=>await _n(n.fetch,`${n.url}/bucket`,{name:i},{headers:n.headers}))}async listBuckets(i){var n=this;return n.handleOperation(async()=>{const r=new URLSearchParams;i?.limit!==void 0&&r.set("limit",i.limit.toString()),i?.offset!==void 0&&r.set("offset",i.offset.toString()),i?.sortColumn&&r.set("sortColumn",i.sortColumn),i?.sortOrder&&r.set("sortOrder",i.sortOrder),i?.search&&r.set("search",i.search);const l=r.toString(),c=l?`${n.url}/bucket?${l}`:`${n.url}/bucket`;return await Js(n.fetch,c,{headers:n.headers})})}async deleteBucket(i){var n=this;return n.handleOperation(async()=>await Xs(n.fetch,`${n.url}/bucket/${i}`,{},{headers:n.headers}))}from(i){var n=this;if(!uS(i))throw new Io("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const r=new aS({baseUrl:this.url,catalogName:i,auth:{type:"custom",getHeaders:async()=>n.headers},fetch:this.fetch}),l=this.shouldThrowOnError;return new Proxy(r,{get(c,d){const h=c[d];return typeof h!="function"?h:async(...m)=>{try{return{data:await h.apply(c,m),error:null}}catch(g){if(l)throw g;return{data:null,error:g}}}}})}},wS=class extends xr{constructor(i,n={},r){const l=i.replace(/\/$/,""),c=le(le({},Fs),{},{"Content-Type":"application/json"},n);super(l,c,r,"vectors")}async createIndex(i){var n=this;return n.handleOperation(async()=>await en.post(n.fetch,`${n.url}/CreateIndex`,i,{headers:n.headers})||{})}async getIndex(i,n){var r=this;return r.handleOperation(async()=>await en.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:i,indexName:n},{headers:r.headers}))}async listIndexes(i){var n=this;return n.handleOperation(async()=>await en.post(n.fetch,`${n.url}/ListIndexes`,i,{headers:n.headers}))}async deleteIndex(i,n){var r=this;return r.handleOperation(async()=>await en.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:i,indexName:n},{headers:r.headers})||{})}},_S=class extends xr{constructor(i,n={},r){const l=i.replace(/\/$/,""),c=le(le({},Fs),{},{"Content-Type":"application/json"},n);super(l,c,r,"vectors")}async putVectors(i){var n=this;if(i.vectors.length<1||i.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return n.handleOperation(async()=>await en.post(n.fetch,`${n.url}/PutVectors`,i,{headers:n.headers})||{})}async getVectors(i){var n=this;return n.handleOperation(async()=>await en.post(n.fetch,`${n.url}/GetVectors`,i,{headers:n.headers}))}async listVectors(i){var n=this;if(i.segmentCount!==void 0){if(i.segmentCount<1||i.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(i.segmentIndex!==void 0&&(i.segmentIndex<0||i.segmentIndex>=i.segmentCount))throw new Error(`segmentIndex must be between 0 and ${i.segmentCount-1}`)}return n.handleOperation(async()=>await en.post(n.fetch,`${n.url}/ListVectors`,i,{headers:n.headers}))}async queryVectors(i){var n=this;return n.handleOperation(async()=>await en.post(n.fetch,`${n.url}/QueryVectors`,i,{headers:n.headers}))}async deleteVectors(i){var n=this;if(i.keys.length<1||i.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return n.handleOperation(async()=>await en.post(n.fetch,`${n.url}/DeleteVectors`,i,{headers:n.headers})||{})}},TS=class extends xr{constructor(i,n={},r){const l=i.replace(/\/$/,""),c=le(le({},Fs),{},{"Content-Type":"application/json"},n);super(l,c,r,"vectors")}async createBucket(i){var n=this;return n.handleOperation(async()=>await en.post(n.fetch,`${n.url}/CreateVectorBucket`,{vectorBucketName:i},{headers:n.headers})||{})}async getBucket(i){var n=this;return n.handleOperation(async()=>await en.post(n.fetch,`${n.url}/GetVectorBucket`,{vectorBucketName:i},{headers:n.headers}))}async listBuckets(i={}){var n=this;return n.handleOperation(async()=>await en.post(n.fetch,`${n.url}/ListVectorBuckets`,i,{headers:n.headers}))}async deleteBucket(i){var n=this;return n.handleOperation(async()=>await en.post(n.fetch,`${n.url}/DeleteVectorBucket`,{vectorBucketName:i},{headers:n.headers})||{})}},kS=class extends TS{constructor(i,n={}){super(i,n.headers||{},n.fetch)}from(i){return new ES(this.url,this.headers,i,this.fetch)}async createBucket(i){var n=()=>super.createBucket,r=this;return n().call(r,i)}async getBucket(i){var n=()=>super.getBucket,r=this;return n().call(r,i)}async listBuckets(i={}){var n=()=>super.listBuckets,r=this;return n().call(r,i)}async deleteBucket(i){var n=()=>super.deleteBucket,r=this;return n().call(r,i)}},ES=class extends wS{constructor(i,n,r,l){super(i,n,l),this.vectorBucketName=r}async createIndex(i){var n=()=>super.createIndex,r=this;return n().call(r,le(le({},i),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(i={}){var n=()=>super.listIndexes,r=this;return n().call(r,le(le({},i),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(i){var n=()=>super.getIndex,r=this;return n().call(r,r.vectorBucketName,i)}async deleteIndex(i){var n=()=>super.deleteIndex,r=this;return n().call(r,r.vectorBucketName,i)}index(i){return new AS(this.url,this.headers,this.vectorBucketName,i,this.fetch)}},AS=class extends _S{constructor(i,n,r,l,c){super(i,n,c),this.vectorBucketName=r,this.indexName=l}async putVectors(i){var n=()=>super.putVectors,r=this;return n().call(r,le(le({},i),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(i){var n=()=>super.getVectors,r=this;return n().call(r,le(le({},i),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(i={}){var n=()=>super.listVectors,r=this;return n().call(r,le(le({},i),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(i){var n=()=>super.queryVectors,r=this;return n().call(r,le(le({},i),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(i){var n=()=>super.deleteVectors,r=this;return n().call(r,le(le({},i),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},xS=class extends bS{constructor(i,n={},r,l){super(i,n,r,l)}from(i){return new yS(this.url,this.headers,i,this.fetch)}get vectors(){return new kS(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new SS(this.url+"/iceberg",this.headers,this.fetch)}};const zp="2.110.0",ma=30*1e3,Ms=3,dd=Ms*ma,CS=2*ma,OS="http://localhost:9999",RS="supabase.auth.token",jS={"X-Client-Info":`gotrue-js/${zp}`},Ld="X-Supabase-Api-Version",Bp={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},NS=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,LS=600*1e3;class Qs extends Error{constructor(n,r,l){super(n),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=l}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function X(i){return typeof i=="object"&&i!==null&&"__isAuthError"in i}class DS extends Qs{constructor(n,r,l){super(n,r,l),this.name="AuthApiError",this.status=r,this.code=l}}function US(i){return X(i)&&i.name==="AuthApiError"}class Tn extends Qs{constructor(n,r){super(n),this.name="AuthUnknownError",this.originalError=r}}class Ln extends Qs{constructor(n,r,l,c){super(n,l,c),this.name=r,this.status=l}}class bt extends Ln{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function xo(i){return X(i)&&i.name==="AuthSessionMissingError"}class dr extends Ln{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Co extends Ln{constructor(n){super(n,"AuthInvalidCredentialsError",400,void 0)}}class Oo extends Ln{constructor(n,r=null){super(n,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function MS(i){return X(i)&&i.name==="AuthImplicitGrantRedirectError"}class Xg extends Ln{constructor(n,r=null){super(n,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class zS extends Ln{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class Dd extends Ln{constructor(n,r){super(n,"AuthRetryableFetchError",r,void 0)}}function Qg(i){return X(i)&&i.name==="AuthRetryableFetchError"}class Wg extends Ln{constructor(n="Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)"){super(n,"AuthRefreshDiscardedError",409,void 0)}}function BS(i){return X(i)&&i.name==="AuthRefreshDiscardedError"}class Zg extends Ln{constructor(n,r,l){super(n,"AuthWeakPasswordError",r,"weak_password"),this.reasons=l}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class Mo extends Ln{constructor(n){super(n,"AuthInvalidJwtError",400,"invalid_jwt")}}const zo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Fg=`
21
+ \r=`.split(""),HS=(()=>{const i=new Array(128);for(let n=0;n<i.length;n+=1)i[n]=-1;for(let n=0;n<Fg.length;n+=1)i[Fg[n].charCodeAt(0)]=-2;for(let n=0;n<zo.length;n+=1)i[zo[n].charCodeAt(0)]=n;return i})();function ep(i,n,r){if(i!==null)for(n.queue=n.queue<<8|i,n.queuedBits+=8;n.queuedBits>=6;){const l=n.queue>>n.queuedBits-6&63;r(zo[l]),n.queuedBits-=6}else if(n.queuedBits>0)for(n.queue=n.queue<<6-n.queuedBits,n.queuedBits=6;n.queuedBits>=6;){const l=n.queue>>n.queuedBits-6&63;r(zo[l]),n.queuedBits-=6}}function Hp(i,n,r){const l=HS[i];if(l>-1)for(n.queue=n.queue<<6|l,n.queuedBits+=6;n.queuedBits>=8;)r(n.queue>>n.queuedBits-8&255),n.queuedBits-=8;else{if(l===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(i)}"`)}}function tp(i){const n=[],r=h=>{n.push(String.fromCodePoint(h))},l={utf8seq:0,codepoint:0},c={queue:0,queuedBits:0},d=h=>{PS(h,l,r)};for(let h=0;h<i.length;h+=1)Hp(i.charCodeAt(h),c,d);return n.join("")}function qS(i,n){if(i<=127){n(i);return}else if(i<=2047){n(192|i>>6),n(128|i&63);return}else if(i<=65535){n(224|i>>12),n(128|i>>6&63),n(128|i&63);return}else if(i<=1114111){n(240|i>>18),n(128|i>>12&63),n(128|i>>6&63),n(128|i&63);return}throw new Error(`Unrecognized Unicode codepoint: ${i.toString(16)}`)}function $S(i,n){for(let r=0;r<i.length;r+=1){let l=i.charCodeAt(r);if(l>55295&&l<=56319){const c=(l-55296)*1024&65535;l=(i.charCodeAt(r+1)-56320&65535|c)+65536,r+=1}qS(l,n)}}function PS(i,n,r){if(n.utf8seq===0){if(i<=127){r(i);return}for(let l=1;l<6;l+=1)if((i>>7-l&1)===0){n.utf8seq=l;break}if(n.utf8seq===2)n.codepoint=i&31;else if(n.utf8seq===3)n.codepoint=i&15;else if(n.utf8seq===4)n.codepoint=i&7;else throw new Error("Invalid UTF-8 sequence");n.utf8seq-=1}else if(n.utf8seq>0){if(i<=127)throw new Error("Invalid UTF-8 sequence");n.codepoint=n.codepoint<<6|i&63,n.utf8seq-=1,n.utf8seq===0&&r(n.codepoint)}}function Er(i){const n=[],r={queue:0,queuedBits:0},l=c=>{n.push(c)};for(let c=0;c<i.length;c+=1)Hp(i.charCodeAt(c),r,l);return new Uint8Array(n)}function IS(i){const n=[];return $S(i,r=>n.push(r)),new Uint8Array(n)}function wi(i){const n=[],r={queue:0,queuedBits:0},l=c=>{n.push(c)};return i.forEach(c=>ep(c,r,l)),ep(null,r,l),n.join("")}function GS(i){return Math.round(Date.now()/1e3)+i}function VS(){return Symbol("auth-callback")}const Ct=()=>typeof window<"u"&&typeof document<"u",yi={tested:!1,writable:!1},qp=()=>{if(!Ct())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(yi.tested)return yi.writable;const i=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(i,i),globalThis.localStorage.removeItem(i),yi.tested=!0,yi.writable=!0}catch{yi.tested=!0,yi.writable=!1}return yi.writable};function KS(i){const n={},r=new URL(i);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((c,d)=>{n[d]=c})}catch{}return r.searchParams.forEach((l,c)=>{n[c]=l}),n}const $p=i=>i?(...n)=>i(...n):(...n)=>fetch(...n),YS=i=>typeof i=="object"&&i!==null&&"status"in i&&"ok"in i&&"json"in i&&typeof i.json=="function",Sr=async(i,n,r)=>{await i.setItem(n,JSON.stringify(r))},bn=async(i,n)=>{const r=await i.getItem(n);if(!r)return null;try{return JSON.parse(r)}catch{return null}},rt=async(i,n)=>{await i.removeItem(n)};class Vo{constructor(){this.promise=new Vo.promiseConstructor((n,r)=>{this.resolve=n,this.reject=r})}}Vo.promiseConstructor=Promise;function Ro(i){const n=i.split(".");if(n.length!==3)throw new Mo("Invalid JWT structure");for(let l=0;l<n.length;l++)if(!NS.test(n[l]))throw new Mo("JWT not in base64url format");return{header:JSON.parse(tp(n[0])),payload:JSON.parse(tp(n[1])),signature:Er(n[2]),raw:{header:n[0],payload:n[1]}}}async function JS(i){return await new Promise(n=>{setTimeout(()=>n(null),i)})}function XS(i,n){return new Promise((l,c)=>{(async()=>{for(let d=0;d<1/0;d++)try{const h=await i(d);if(!n(d,null,h)){l(h);return}}catch(h){if(!n(d,h)){c(h);return}}})()})}function QS(i){return("0"+i.toString(16)).substr(-2)}function WS(){const n=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",l=r.length;let c="";for(let d=0;d<56;d++)c+=r.charAt(Math.floor(Math.random()*l));return c}return crypto.getRandomValues(n),Array.from(n,QS).join("")}async function ZS(i){const r=new TextEncoder().encode(i),l=await crypto.subtle.digest("SHA-256",r),c=new Uint8Array(l);return Array.from(c).map(d=>String.fromCharCode(d)).join("")}async function FS(i){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),i;const r=await ZS(i);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function vi(i,n,r=!1){const l=WS();let c=l;r&&(c+="/recovery"),await Sr(i,`${n}-code-verifier`,c);const d=await FS(l);return[d,l===d?"plain":"s256"]}const ew=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function tw(i){const n=i.headers.get(Ld);if(!n||!n.match(ew))return null;try{return new Date(`${n}T00:00:00.0Z`)}catch{return null}}function nw(i){if(!i)throw new Error("Missing exp claim");const n=Math.floor(Date.now()/1e3);if(i<=n)throw new Error("JWT has expired")}function aw(i){switch(i){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const iw=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function ua(i){if(!iw.test(i))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Sn(i){if(!i.passkey)throw new Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function hd(){const i={};return new Proxy(i,{get:(n,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){const l=r.toString();if(l==="Symbol(Symbol.toPrimitive)"||l==="Symbol(Symbol.toStringTag)"||l==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(n,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(n,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function rw(i,n){return new Proxy(i,{get:(r,l,c)=>{if(l==="__isInsecureUserWarningProxy")return!0;if(typeof l=="symbol"){const d=l.toString();if(d==="Symbol(Symbol.toPrimitive)"||d==="Symbol(Symbol.toStringTag)"||d==="Symbol(util.inspect.custom)"||d==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,l,c)}return!n.value&&typeof l=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),n.value=!0),Reflect.get(r,l,c)}})}function np(i){return JSON.parse(JSON.stringify(i))}const Si=i=>{if(typeof i=="object"&&i!==null){const n=i;if(typeof n.msg=="string")return n.msg;if(typeof n.message=="string")return n.message;if(typeof n.error_description=="string")return n.error_description;if(typeof n.error=="string")return n.error}return JSON.stringify(i)},sw=[500,501,502,503,504,520,521,522,523,524,525,526,527,528,529,530];async function ap(i){var n;if(!YS(i))throw new Dd(Si(i),0);if(sw.includes(i.status))throw new Dd(Si(i),i.status);let r;try{r=await i.json()}catch(d){throw new Tn(Si(d),d)}let l;const c=tw(i);if(c&&c.getTime()>=Bp["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?l=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(l=r.error_code),l){if(l==="weak_password")throw new Zg(Si(r),i.status,((n=r.weak_password)===null||n===void 0?void 0:n.reasons)||[]);if(l==="session_not_found")throw new bt}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((d,h)=>d&&typeof h=="string",!0))throw new Zg(Si(r),i.status,r.weak_password.reasons);throw new DS(Si(r),i.status||500,l)}const lw=(i,n,r,l)=>{const c={method:i,headers:n?.headers||{}};return i==="GET"?c:(c.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},n?.headers),c.body=JSON.stringify(l),Object.assign(Object.assign({},c),r))};async function ee(i,n,r,l){var c;const d=Object.assign({},l?.headers);d[Ld]||(d[Ld]=Bp["2024-01-01"].name),l?.jwt&&(d.Authorization=`Bearer ${l.jwt}`);const h=(c=l?.query)!==null&&c!==void 0?c:{};l?.redirectTo&&(h.redirect_to=l.redirectTo);const m=Object.keys(h).length?"?"+new URLSearchParams(h).toString():"",g=await ow(i,n,r+m,{headers:d,noResolveJson:l?.noResolveJson},{},l?.body);return l?.xform?l?.xform(g):{data:Object.assign({},g),error:null}}async function ow(i,n,r,l,c,d){const h=lw(n,l,c,d);let m;try{m=await i(r,Object.assign({},h))}catch(g){throw console.error(g),new Dd(Si(g),0)}if(m.ok||await ap(m),l?.noResolveJson)return m;try{return await m.json()}catch(g){await ap(g)}}function hn(i){var n;let r=null;dw(i)&&(r=Object.assign({},i),i.expires_at||(r.expires_at=GS(i.expires_in)));const l=(n=i.user)!==null&&n!==void 0?n:typeof i?.id=="string"?i:null;return{data:{session:r,user:l},error:null}}function ip(i){const n=hn(i);return!n.error&&i.weak_password&&typeof i.weak_password=="object"&&Array.isArray(i.weak_password.reasons)&&i.weak_password.reasons.length&&i.weak_password.message&&typeof i.weak_password.message=="string"&&i.weak_password.reasons.reduce((r,l)=>r&&typeof l=="string",!0)&&(n.data.weak_password=i.weak_password),n}function Ya(i){var n;return{data:{user:(n=i.user)!==null&&n!==void 0?n:i},error:null}}function cw(i){return{data:i,error:null}}function uw(i){const{action_link:n,email_otp:r,hashed_token:l,redirect_to:c,verification_type:d}=i,h=Po(i,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),m={action_link:n,email_otp:r,hashed_token:l,redirect_to:c,verification_type:d},g=Object.assign({},h);return{data:{properties:m,user:g},error:null}}function rp(i){return i}function dw(i){return!!i.access_token&&!!i.refresh_token&&!!i.expires_in}const fd=["global","local","others"];class hw{constructor({url:n="",headers:r={},fetch:l,experimental:c}){this.url=n,this.headers=r,this.fetch=$p(l),this.experimental=c??{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(n,r=fd[0]){if(fd.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${fd.join(", ")}`);try{return await ee(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:n,noResolveJson:!0}),{data:null,error:null}}catch(l){if(X(l))return{data:null,error:l};throw l}}async inviteUserByEmail(n,r={}){try{return await ee(this.fetch,"POST",`${this.url}/invite`,{body:{email:n,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:Ya})}catch(l){if(X(l))return{data:{user:null},error:l};throw l}}async generateLink(n){try{const{options:r}=n,l=Po(n,["options"]),c=Object.assign(Object.assign({},l),r);return"newEmail"in l&&(c.new_email=l?.newEmail,delete c.newEmail),await ee(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:c,headers:this.headers,xform:uw,redirectTo:r?.redirectTo})}catch(r){if(X(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(n){try{return await ee(this.fetch,"POST",`${this.url}/admin/users`,{body:n,headers:this.headers,xform:Ya})}catch(r){if(X(r))return{data:{user:null},error:r};throw r}}async listUsers(n){var r,l,c,d,h,m,g;try{const p={nextPage:null,lastPage:0,total:0},S=await ee(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(l=(r=n?.page)===null||r===void 0?void 0:r.toString())!==null&&l!==void 0?l:"",per_page:(d=(c=n?.perPage)===null||c===void 0?void 0:c.toString())!==null&&d!==void 0?d:""},xform:rp});if(S.error)throw S.error;const b=await S.json(),T=(h=S.headers.get("x-total-count"))!==null&&h!==void 0?h:0,A=(g=(m=S.headers.get("link"))===null||m===void 0?void 0:m.split(","))!==null&&g!==void 0?g:[];return A.length>0&&(A.forEach(C=>{const U=parseInt(C.split(";")[0].split("=")[1].substring(0,1)),$=JSON.parse(C.split(";")[1].split("=")[1]);p[`${$}Page`]=U}),p.total=parseInt(T)),{data:Object.assign(Object.assign({},b),p),error:null}}catch(p){if(X(p))return{data:{users:[]},error:p};throw p}}async getUserById(n){ua(n);try{return await ee(this.fetch,"GET",`${this.url}/admin/users/${n}`,{headers:this.headers,xform:Ya})}catch(r){if(X(r))return{data:{user:null},error:r};throw r}}async updateUserById(n,r){ua(n);try{return await ee(this.fetch,"PUT",`${this.url}/admin/users/${n}`,{body:r,headers:this.headers,xform:Ya})}catch(l){if(X(l))return{data:{user:null},error:l};throw l}}async deleteUser(n,r=!1){ua(n);try{return await ee(this.fetch,"DELETE",`${this.url}/admin/users/${n}`,{headers:this.headers,body:{should_soft_delete:r},xform:Ya})}catch(l){if(X(l))return{data:{user:null},error:l};throw l}}async _listFactors(n){ua(n.userId);try{const{data:r,error:l}=await ee(this.fetch,"GET",`${this.url}/admin/users/${n.userId}/factors`,{headers:this.headers,xform:c=>({data:{factors:c},error:null})});return{data:r,error:l}}catch(r){if(X(r))return{data:null,error:r};throw r}}async _deleteFactor(n){ua(n.userId),ua(n.id);try{return{data:await ee(this.fetch,"DELETE",`${this.url}/admin/users/${n.userId}/factors/${n.id}`,{headers:this.headers}),error:null}}catch(r){if(X(r))return{data:null,error:r};throw r}}async _listOAuthClients(n){var r,l,c,d,h,m,g;try{const p={nextPage:null,lastPage:0,total:0},S=await ee(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(l=(r=n?.page)===null||r===void 0?void 0:r.toString())!==null&&l!==void 0?l:"",per_page:(d=(c=n?.perPage)===null||c===void 0?void 0:c.toString())!==null&&d!==void 0?d:""},xform:rp});if(S.error)throw S.error;const b=await S.json(),T=(h=S.headers.get("x-total-count"))!==null&&h!==void 0?h:0,A=(g=(m=S.headers.get("link"))===null||m===void 0?void 0:m.split(","))!==null&&g!==void 0?g:[];return A.length>0&&(A.forEach(C=>{const U=parseInt(C.split(";")[0].split("=")[1].substring(0,1)),$=JSON.parse(C.split(";")[1].split("=")[1]);p[`${$}Page`]=U}),p.total=parseInt(T)),{data:Object.assign(Object.assign({},b),p),error:null}}catch(p){if(X(p))return{data:{clients:[]},error:p};throw p}}async _createOAuthClient(n){try{return await ee(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(X(r))return{data:null,error:r};throw r}}async _getOAuthClient(n){try{return await ee(this.fetch,"GET",`${this.url}/admin/oauth/clients/${n}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(X(r))return{data:null,error:r};throw r}}async _updateOAuthClient(n,r){try{return await ee(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${n}`,{body:r,headers:this.headers,xform:l=>({data:l,error:null})})}catch(l){if(X(l))return{data:null,error:l};throw l}}async _deleteOAuthClient(n){try{return await ee(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${n}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(X(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(n){try{return await ee(this.fetch,"POST",`${this.url}/admin/oauth/clients/${n}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(X(r))return{data:null,error:r};throw r}}async _listCustomProviders(n){try{const r={};return n?.type&&(r.type=n.type),await ee(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:r,xform:l=>{var c;return{data:{providers:(c=l?.providers)!==null&&c!==void 0?c:[]},error:null}}})}catch(r){if(X(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(n){try{return await ee(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(X(r))return{data:null,error:r};throw r}}async _getCustomProvider(n){try{return await ee(this.fetch,"GET",`${this.url}/admin/custom-providers/${n}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(X(r))return{data:null,error:r};throw r}}async _updateCustomProvider(n,r){try{return await ee(this.fetch,"PUT",`${this.url}/admin/custom-providers/${n}`,{body:r,headers:this.headers,xform:l=>({data:l,error:null})})}catch(l){if(X(l))return{data:null,error:l};throw l}}async _deleteCustomProvider(n){try{return await ee(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${n}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(X(r))return{data:null,error:r};throw r}}async _adminListPasskeys(n){Sn(this.experimental),ua(n.userId);try{return await ee(this.fetch,"GET",`${this.url}/admin/users/${n.userId}/passkeys`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(X(r))return{data:null,error:r};throw r}}async _adminDeletePasskey(n){Sn(this.experimental),ua(n.userId),ua(n.passkeyId);try{return await ee(this.fetch,"DELETE",`${this.url}/admin/users/${n.userId}/passkeys/${n.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(X(r))return{data:null,error:r};throw r}}}function sp(i={}){return{getItem:n=>i[n]||null,setItem:(n,r)=>{i[n]=r},removeItem:n=>{delete i[n]}}}globalThis&&qp()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug");class fw extends Error{constructor(n){super(n),this.isAcquireTimeout=!0}}function mw(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function Pp(i){if(!/^0x[a-fA-F0-9]{40}$/.test(i))throw new Error(`@supabase/auth-js: Address "${i}" is invalid.`);return i.toLowerCase()}function gw(i){return parseInt(i,16)}function pw(i){const n=new TextEncoder().encode(i);return"0x"+Array.from(n,l=>l.toString(16).padStart(2,"0")).join("")}function yw(i){var n;const{chainId:r,domain:l,expirationTime:c,issuedAt:d=new Date,nonce:h,notBefore:m,requestId:g,resources:p,scheme:S,uri:b,version:T}=i;{if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!l)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(h&&h.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${h}`);if(!b)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(T!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${T}`);if(!((n=i.statement)===null||n===void 0)&&n.includes(`
22
22
  `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${i.statement}`)}const A=Pp(i.address),C=S?`${S}://${l}`:l,U=i.statement?`${i.statement}
23
23
  `:"",$=`${C} wants you to sign in with your Ethereum account:
24
24
  ${A}
@@ -33,6 +33,6 @@ Not Before: ${m.toISOString()}`),g&&(P+=`
33
33
  Request ID: ${g}`),p){let q=`
34
34
  Resources:`;for(const N of p){if(!N||typeof N!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${N}`);q+=`
35
35
  - ${N}`}P+=q}return`${$}
36
- ${P}`}class ft extends Error{constructor({message:n,code:r,cause:l,name:c}){var d;super(n,{cause:l}),this.__isWebAuthnError=!0,this.name=(d=c??(l instanceof Error?l.name:void 0))!==null&&d!==void 0?d:"Unknown Error",this.code=r}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class Bo extends ft{constructor(n,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:n}),this.name="WebAuthnUnknownError",this.originalError=r}}function yw({error:i,options:n}){var r,l,c;const{publicKey:d}=n;if(!d)throw Error("options was missing required publicKey property");if(i.name==="AbortError"){if(n.signal instanceof AbortSignal)return new ft({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:i})}else if(i.name==="ConstraintError"){if(((r=d.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new ft({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:i});if(n.mediation==="conditional"&&((l=d.authenticatorSelection)===null||l===void 0?void 0:l.userVerification)==="required")return new ft({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:i});if(((c=d.authenticatorSelection)===null||c===void 0?void 0:c.userVerification)==="required")return new ft({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:i})}else{if(i.name==="InvalidStateError")return new ft({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:i});if(i.name==="NotAllowedError")return new ft({message:i.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:i});if(i.name==="NotSupportedError")return d.pubKeyCredParams.filter(m=>m.type==="public-key").length===0?new ft({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:i}):new ft({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:i});if(i.name==="SecurityError"){const h=window.location.hostname;if(Ip(h)){if(d.rp.id!==h)return new ft({message:`The RP ID "${d.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:i})}else return new ft({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:i})}else if(i.name==="TypeError"){if(d.user.id.byteLength<1||d.user.id.byteLength>64)return new ft({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:i})}else if(i.name==="UnknownError")return new ft({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:i})}return new ft({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:i})}function vw({error:i,options:n}){const{publicKey:r}=n;if(!r)throw Error("options was missing required publicKey property");if(i.name==="AbortError"){if(n.signal instanceof AbortSignal)return new ft({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:i})}else{if(i.name==="NotAllowedError")return new ft({message:i.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:i});if(i.name==="SecurityError"){const l=window.location.hostname;if(Ip(l)){if(r.rpId!==l)return new ft({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:i})}else return new ft({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:i})}else if(i.name==="UnknownError")return new ft({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:i})}return new ft({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:i})}class bw{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const n=new AbortController;return this.controller=n,n.signal}cancelCeremony(){if(this.controller){const n=new Error("Manually cancelling existing WebAuthn API call");n.name="AbortError",this.controller.abort(n),this.controller=void 0}}}const Ud=new bw;function lp(i){if(!i)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(i);const{challenge:n,user:r,excludeCredentials:l}=i,c=Po(i,["challenge","user","excludeCredentials"]),d=Er(n).buffer,h=Object.assign(Object.assign({},r),{id:Er(r.id).buffer}),m=Object.assign(Object.assign({},c),{challenge:d,user:h});if(l&&l.length>0){m.excludeCredentials=new Array(l.length);for(let g=0;g<l.length;g++){const p=l[g];m.excludeCredentials[g]=Object.assign(Object.assign({},p),{id:Er(p.id).buffer,type:p.type||"public-key",transports:p.transports})}}return m}function op(i){if(!i)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(i);const{challenge:n,allowCredentials:r}=i,l=Po(i,["challenge","allowCredentials"]),c=Er(n).buffer,d=Object.assign(Object.assign({},l),{challenge:c});if(r&&r.length>0){d.allowCredentials=new Array(r.length);for(let h=0;h<r.length;h++){const m=r[h];d.allowCredentials[h]=Object.assign(Object.assign({},m),{id:Er(m.id).buffer,type:m.type||"public-key",transports:m.transports})}}return d}function cp(i){var n;if("toJSON"in i&&typeof i.toJSON=="function")return i.toJSON();const r=i;return{id:i.id,rawId:i.id,response:{attestationObject:wi(new Uint8Array(i.response.attestationObject)),clientDataJSON:wi(new Uint8Array(i.response.clientDataJSON))},type:"public-key",clientExtensionResults:i.getClientExtensionResults(),authenticatorAttachment:(n=r.authenticatorAttachment)!==null&&n!==void 0?n:void 0}}function up(i){var n;if("toJSON"in i&&typeof i.toJSON=="function")return i.toJSON();const r=i,l=i.getClientExtensionResults(),c=i.response;return{id:i.id,rawId:i.id,response:{authenticatorData:wi(new Uint8Array(c.authenticatorData)),clientDataJSON:wi(new Uint8Array(c.clientDataJSON)),signature:wi(new Uint8Array(c.signature)),userHandle:c.userHandle?wi(new Uint8Array(c.userHandle)):void 0},type:"public-key",clientExtensionResults:l,authenticatorAttachment:(n=r.authenticatorAttachment)!==null&&n!==void 0?n:void 0}}function Ip(i){return i==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(i)}function Ho(){var i,n;return!!(Ct()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((i=navigator?.credentials)===null||i===void 0?void 0:i.create)=="function"&&typeof((n=navigator?.credentials)===null||n===void 0?void 0:n.get)=="function")}async function Gp(i){try{const n=await navigator.credentials.create(i);return n?n instanceof PublicKeyCredential?{data:n,error:null}:{data:null,error:new Bo("Browser returned unexpected credential type",n)}:{data:null,error:new Bo("Empty credential response",n)}}catch(n){return{data:null,error:yw({error:n,options:i})}}}async function Vp(i){try{const n=await navigator.credentials.get(i);return n?n instanceof PublicKeyCredential?{data:n,error:null}:{data:null,error:new Bo("Browser returned unexpected credential type",n)}:{data:null,error:new Bo("Empty credential response",n)}}catch(n){return{data:null,error:vw({error:n,options:i})}}}const Sw={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},ww={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function qo(...i){const n=c=>c!==null&&typeof c=="object"&&!Array.isArray(c),r=c=>c instanceof ArrayBuffer||ArrayBuffer.isView(c),l={};for(const c of i)if(c)for(const d in c){const h=c[d];if(h!==void 0)if(Array.isArray(h))l[d]=h;else if(r(h))l[d]=h;else if(n(h)){const m=l[d];n(m)?l[d]=qo(m,h):l[d]=qo(h)}else l[d]=h}return l}function _w(i,n){return qo(Sw,i,n||{})}function Tw(i,n){return qo(ww,i,n||{})}class kw{constructor(n){this.client=n,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(n){return this.client.mfa.enroll(Object.assign(Object.assign({},n),{factorType:"webauthn"}))}async _challenge({factorId:n,webauthn:r,friendlyName:l,signal:c},d){var h;try{const{data:m,error:g}=await this.client.mfa.challenge({factorId:n,webauthn:r});if(!m)return{data:null,error:g};const p=c??Ud.createNewAbortSignal();if(m.webauthn.type==="create"){const{user:S}=m.webauthn.credential_options.publicKey;if(!S.name){const b=l;if(b)S.name=`${S.id}:${b}`;else{const A=(await this.client.getUser()).data.user,C=((h=A?.user_metadata)===null||h===void 0?void 0:h.name)||A?.email||A?.id||"User";S.name=`${S.id}:${C}`}}S.displayName||(S.displayName=S.name)}switch(m.webauthn.type){case"create":{const S=_w(m.webauthn.credential_options.publicKey,d?.create),{data:b,error:T}=await Gp({publicKey:S,signal:p});return b?{data:{factorId:n,challengeId:m.id,webauthn:{type:m.webauthn.type,credential_response:b}},error:null}:{data:null,error:T}}case"request":{const S=Tw(m.webauthn.credential_options.publicKey,d?.request),{data:b,error:T}=await Vp(Object.assign(Object.assign({},m.webauthn.credential_options),{publicKey:S,signal:p}));return b?{data:{factorId:n,challengeId:m.id,webauthn:{type:m.webauthn.type,credential_response:b}},error:null}:{data:null,error:T}}}}catch(m){return X(m)?{data:null,error:m}:{data:null,error:new Tn("Unexpected error in challenge",m)}}}async _verify({challengeId:n,factorId:r,webauthn:l}){return this.client.mfa.verify({factorId:r,challengeId:n,webauthn:l})}async _authenticate({factorId:n,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:l=typeof window<"u"?[window.location.origin]:void 0,signal:c}={}},d){if(!r)return{data:null,error:new Qs("rpId is required for WebAuthn authentication")};try{if(!Ho())return{data:null,error:new Tn("Browser does not support WebAuthn",null)};const{data:h,error:m}=await this.challenge({factorId:n,webauthn:{rpId:r,rpOrigins:l},signal:c},{request:d});if(!h)return{data:null,error:m};const{webauthn:g}=h;return this._verify({factorId:n,challengeId:h.challengeId,webauthn:{type:g.type,rpId:r,rpOrigins:l,credential_response:g.credential_response}})}catch(h){return X(h)?{data:null,error:h}:{data:null,error:new Tn("Unexpected error in authenticate",h)}}}async _register({friendlyName:n,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:l=typeof window<"u"?[window.location.origin]:void 0,signal:c}={}},d){if(!r)return{data:null,error:new Qs("rpId is required for WebAuthn registration")};try{if(!Ho())return{data:null,error:new Tn("Browser does not support WebAuthn",null)};const{data:h,error:m}=await this._enroll({friendlyName:n});if(!h)return await this.client.mfa.listFactors().then(S=>{var b;return(b=S.data)===null||b===void 0?void 0:b.all.find(T=>T.factor_type==="webauthn"&&T.friendly_name===n&&T.status!=="unverified")}).then(S=>S?this.client.mfa.unenroll({factorId:S?.id}):void 0),{data:null,error:m};const{data:g,error:p}=await this._challenge({factorId:h.id,friendlyName:h.friendly_name,webauthn:{rpId:r,rpOrigins:l},signal:c},{create:d});return g?this._verify({factorId:h.id,challengeId:g.challengeId,webauthn:{rpId:r,rpOrigins:l,type:g.webauthn.type,credential_response:g.webauthn.credential_response}}):{data:null,error:p}}catch(h){return X(h)?{data:null,error:h}:{data:null,error:new Tn("Unexpected error in register",h)}}}}fw();const Ew={url:CS,storageKey:OS,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:RS,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},hr={};class Ws{get jwks(){var n,r;return(r=(n=hr[this.storageKey])===null||n===void 0?void 0:n.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(n){hr[this.storageKey]=Object.assign(Object.assign({},hr[this.storageKey]),{jwks:n})}get jwks_cached_at(){var n,r;return(r=(n=hr[this.storageKey])===null||n===void 0?void 0:n.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(n){hr[this.storageKey]=Object.assign(Object.assign({},hr[this.storageKey]),{cachedAt:n})}constructor(n){var r,l,c;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.lastRefreshFailure=null,this._sessionRemovalEpoch=0,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lock=null,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const d=Object.assign(Object.assign({},Ew),n);if(this.storageKey=d.storageKey,this.instanceID=(r=Ws.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Ws.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!d.debug,typeof d.debug=="function"&&(this.logger=d.debug),this.instanceID>0&&Ct()){const h=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(h),this.logDebugMessages&&console.trace(h)}if(this.persistSession=d.persistSession,this.autoRefreshToken=d.autoRefreshToken,this.experimental=(l=d.experimental)!==null&&l!==void 0?l:{},this.admin=new dw({url:d.url,headers:d.headers,fetch:d.fetch,experimental:this.experimental}),this.url=d.url,this.headers=d.headers,this.fetch=$p(d.fetch),this.detectSessionInUrl=d.detectSessionInUrl,this.flowType=d.flowType,this.hasCustomAuthorizationHeader=d.hasCustomAuthorizationHeader,this.throwOnError=d.throwOnError,this.lockAcquireTimeout=d.lockAcquireTimeout,d.lock!=null&&(this.lock=d.lock),this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new kw(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(d.storage?this.storage=d.storage:qp()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=sp(this.memoryStorage)),d.userStorage&&(this.userStorage=d.userStorage)):(this.memoryStorage={},this.storage=sp(this.memoryStorage)),Ct()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(h){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",h)}(c=this.broadcastChannel)===null||c===void 0||c.addEventListener("message",async h=>{this._debug("received broadcast notification from other tab or client",h),(h.data.event==="TOKEN_REFRESHED"||h.data.event==="SIGNED_IN")&&(this.lastRefreshFailure=null);try{await this._notifyAllSubscribers(h.data.event,h.data.session,!1)}catch(m){this._debug("#broadcastChannel","error",m)}})}d.skipAutoInitialize||this.initialize().catch(h=>{this._debug("#initialize()","error",h)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(n){if(this.throwOnError&&n&&n.error)throw n.error;return n}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${zp}) ${new Date().toISOString()}`}_debug(...n){return this.logDebugMessages&&this.logger(this._logPrefix(),...n),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()):await this._initialize())(),await this.initializePromise)}async _initialize(){var n;try{let r={},l="none";if(Ct()&&(r=VS(window.location.href),this._isImplicitGrantCallback(r)?l="implicit":await this._isPKCECallback(r)&&(l="pkce")),Ct()&&this.detectSessionInUrl&&l!=="none"){const{data:c,error:d}=await this._getSessionFromURL(r,l);if(d){if(this._debug("#_initialize()","error detecting session from URL",d),US(d)){const g=(n=d.details)===null||n===void 0?void 0:n.code;if(g==="identity_already_exists"||g==="identity_not_found"||g==="single_identity_not_deletable")return{error:d}}return{error:d}}const{session:h,redirectType:m}=c;return this._debug("#_initialize()","detected session in URL",h,"redirect type",m),await this._saveSession(h),setTimeout(async()=>{m==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",h):await this._notifyAllSubscribers("SIGNED_IN",h)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return X(r)?this._returnResult({error:r}):this._returnResult({error:new Tn("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(n){var r,l,c;try{const d=await ee(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(l=(r=n?.options)===null||r===void 0?void 0:r.data)!==null&&l!==void 0?l:{},gotrue_meta_security:{captcha_token:(c=n?.options)===null||c===void 0?void 0:c.captchaToken}},xform:hn}),{data:h,error:m}=d;if(m||!h)return this._returnResult({data:{user:null,session:null},error:m});const g=h.session,p=h.user;return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",g)),this._returnResult({data:{user:p,session:g},error:null})}catch(d){if(X(d))return this._returnResult({data:{user:null,session:null},error:d});throw d}}async signUp(n){var r,l,c;try{let d;if("email"in n){const{email:S,password:b,options:T}=n;let A=null,C=null;this.flowType==="pkce"&&([A,C]=await vi(this.storage,this.storageKey)),d=await ee(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:T?.emailRedirectTo,body:{email:S,password:b,data:(r=T?.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:T?.captchaToken},code_challenge:A,code_challenge_method:C},xform:hn})}else if("phone"in n){const{phone:S,password:b,options:T}=n;d=await ee(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:S,password:b,data:(l=T?.data)!==null&&l!==void 0?l:{},channel:(c=T?.channel)!==null&&c!==void 0?c:"sms",gotrue_meta_security:{captcha_token:T?.captchaToken}},xform:hn})}else throw new Co("You must provide either an email or phone number and a password");const{data:h,error:m}=d;if(m||!h)return await rt(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:m});const g=h.session,p=h.user;return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",g)),this._returnResult({data:{user:p,session:g},error:null})}catch(d){if(await rt(this.storage,`${this.storageKey}-code-verifier`),X(d))return this._returnResult({data:{user:null,session:null},error:d});throw d}}async signInWithPassword(n){try{let r;if("email"in n){const{email:d,password:h,options:m}=n;r=await ee(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:d,password:h,gotrue_meta_security:{captcha_token:m?.captchaToken}},xform:ip})}else if("phone"in n){const{phone:d,password:h,options:m}=n;r=await ee(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:d,password:h,gotrue_meta_security:{captcha_token:m?.captchaToken}},xform:ip})}else throw new Co("You must provide either an email or phone number and a password");const{data:l,error:c}=r;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l||!l.session||!l.user){const d=new dr;return this._returnResult({data:{user:null,session:null},error:d})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:Object.assign({user:l.user,session:l.session},l.weak_password?{weakPassword:l.weak_password}:null),error:c})}catch(r){if(X(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(n){var r,l,c,d;return await this._handleProviderSignIn(n.provider,{redirectTo:(r=n.options)===null||r===void 0?void 0:r.redirectTo,scopes:(l=n.options)===null||l===void 0?void 0:l.scopes,queryParams:(c=n.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:(d=n.options)===null||d===void 0?void 0:d.skipBrowserRedirect})}async exchangeCodeForSession(n){return await this.initializePromise,this.lock!=null?this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(n)):this._exchangeCodeForSession(n)}async signInWithWeb3(n){const{chain:r}=n;switch(r){case"ethereum":return await this.signInWithEthereum(n);case"solana":return await this.signInWithSolana(n);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(n){var r,l,c,d,h,m,g,p,S,b,T;let A,C;if("message"in n)A=n.message,C=n.signature;else{const{chain:U,wallet:$,statement:P,options:q}=n;let N;if(Ct())if(typeof $=="object")N=$;else{const we=window;if("ethereum"in we&&typeof we.ethereum=="object"&&"request"in we.ethereum&&typeof we.ethereum.request=="function")N=we.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof $!="object"||!q?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");N=$}const Y=new URL((r=q?.url)!==null&&r!==void 0?r:window.location.href),ue=await N.request({method:"eth_requestAccounts"}).then(we=>we).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!ue||ue.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const G=Pp(ue[0]);let Q=(l=q?.signInWithEthereum)===null||l===void 0?void 0:l.chainId;if(!Q){const we=await N.request({method:"eth_chainId"});Q=mw(we)}const Se={domain:Y.host,address:G,statement:P,uri:Y.href,version:"1",chainId:Q,nonce:(c=q?.signInWithEthereum)===null||c===void 0?void 0:c.nonce,issuedAt:(h=(d=q?.signInWithEthereum)===null||d===void 0?void 0:d.issuedAt)!==null&&h!==void 0?h:new Date,expirationTime:(m=q?.signInWithEthereum)===null||m===void 0?void 0:m.expirationTime,notBefore:(g=q?.signInWithEthereum)===null||g===void 0?void 0:g.notBefore,requestId:(p=q?.signInWithEthereum)===null||p===void 0?void 0:p.requestId,resources:(S=q?.signInWithEthereum)===null||S===void 0?void 0:S.resources};A=pw(Se),C=await N.request({method:"personal_sign",params:[gw(A),G]})}try{const{data:U,error:$}=await ee(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:A,signature:C},!((b=n.options)===null||b===void 0)&&b.captchaToken?{gotrue_meta_security:{captcha_token:(T=n.options)===null||T===void 0?void 0:T.captchaToken}}:null),xform:hn});if($)throw $;if(!U||!U.session||!U.user){const P=new dr;return this._returnResult({data:{user:null,session:null},error:P})}return U.session&&(await this._saveSession(U.session),await this._notifyAllSubscribers("SIGNED_IN",U.session)),this._returnResult({data:Object.assign({},U),error:$})}catch(U){if(X(U))return this._returnResult({data:{user:null,session:null},error:U});throw U}}async signInWithSolana(n){var r,l,c,d,h,m,g,p,S,b,T,A;let C,U;if("message"in n)C=n.message,U=n.signature;else{const{chain:$,wallet:P,statement:q,options:N}=n;let Y;if(Ct())if(typeof P=="object")Y=P;else{const G=window;if("solana"in G&&typeof G.solana=="object"&&("signIn"in G.solana&&typeof G.solana.signIn=="function"||"signMessage"in G.solana&&typeof G.solana.signMessage=="function"))Y=G.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof P!="object"||!N?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");Y=P}const ue=new URL((r=N?.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in Y&&Y.signIn){const G=await Y.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},N?.signInWithSolana),{version:"1",domain:ue.host,uri:ue.href}),q?{statement:q}:null));let Q;if(Array.isArray(G)&&G[0]&&typeof G[0]=="object")Q=G[0];else if(G&&typeof G=="object"&&"signedMessage"in G&&"signature"in G)Q=G;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in Q&&"signature"in Q&&(typeof Q.signedMessage=="string"||Q.signedMessage instanceof Uint8Array)&&Q.signature instanceof Uint8Array)C=typeof Q.signedMessage=="string"?Q.signedMessage:new TextDecoder().decode(Q.signedMessage),U=Q.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in Y)||typeof Y.signMessage!="function"||!("publicKey"in Y)||typeof Y!="object"||!Y.publicKey||!("toBase58"in Y.publicKey)||typeof Y.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");C=[`${ue.host} wants you to sign in with your Solana account:`,Y.publicKey.toBase58(),...q?["",q,""]:[""],"Version: 1",`URI: ${ue.href}`,`Issued At: ${(c=(l=N?.signInWithSolana)===null||l===void 0?void 0:l.issuedAt)!==null&&c!==void 0?c:new Date().toISOString()}`,...!((d=N?.signInWithSolana)===null||d===void 0)&&d.notBefore?[`Not Before: ${N.signInWithSolana.notBefore}`]:[],...!((h=N?.signInWithSolana)===null||h===void 0)&&h.expirationTime?[`Expiration Time: ${N.signInWithSolana.expirationTime}`]:[],...!((m=N?.signInWithSolana)===null||m===void 0)&&m.chainId?[`Chain ID: ${N.signInWithSolana.chainId}`]:[],...!((g=N?.signInWithSolana)===null||g===void 0)&&g.nonce?[`Nonce: ${N.signInWithSolana.nonce}`]:[],...!((p=N?.signInWithSolana)===null||p===void 0)&&p.requestId?[`Request ID: ${N.signInWithSolana.requestId}`]:[],...!((b=(S=N?.signInWithSolana)===null||S===void 0?void 0:S.resources)===null||b===void 0)&&b.length?["Resources",...N.signInWithSolana.resources.map(Q=>`- ${Q}`)]:[]].join(`
37
- `);const G=await Y.signMessage(new TextEncoder().encode(C),"utf8");if(!G||!(G instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");U=G}}try{const{data:$,error:P}=await ee(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:C,signature:wi(U)},!((T=n.options)===null||T===void 0)&&T.captchaToken?{gotrue_meta_security:{captcha_token:(A=n.options)===null||A===void 0?void 0:A.captchaToken}}:null),xform:hn});if(P)throw P;if(!$||!$.session||!$.user){const q=new dr;return this._returnResult({data:{user:null,session:null},error:q})}return $.session&&(await this._saveSession($.session),await this._notifyAllSubscribers("SIGNED_IN",$.session)),this._returnResult({data:Object.assign({},$),error:P})}catch($){if(X($))return this._returnResult({data:{user:null,session:null},error:$});throw $}}async _exchangeCodeForSession(n){const r=await vn(this.storage,`${this.storageKey}-code-verifier`),[l,c]=(r??"").split("/");try{if(!l&&this.flowType==="pkce")throw new MS;const{data:d,error:h}=await ee(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:n,code_verifier:l},xform:hn});if(await rt(this.storage,`${this.storageKey}-code-verifier`),h)throw h;if(!d||!d.session||!d.user){const m=new dr;return this._returnResult({data:{user:null,session:null,redirectType:null},error:m})}return d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers(c==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",d.session)),this._returnResult({data:Object.assign(Object.assign({},d),{redirectType:c??null}),error:h})}catch(d){if(await rt(this.storage,`${this.storageKey}-code-verifier`),X(d))return this._returnResult({data:{user:null,session:null,redirectType:null},error:d});throw d}}async signInWithIdToken(n){try{const{options:r,provider:l,token:c,access_token:d,nonce:h}=n,m=await ee(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:l,id_token:c,access_token:d,nonce:h,gotrue_meta_security:{captcha_token:r?.captchaToken}},xform:hn}),{data:g,error:p}=m;if(p)return this._returnResult({data:{user:null,session:null},error:p});if(!g||!g.session||!g.user){const S=new dr;return this._returnResult({data:{user:null,session:null},error:S})}return g.session&&(await this._saveSession(g.session),await this._notifyAllSubscribers("SIGNED_IN",g.session)),this._returnResult({data:g,error:p})}catch(r){if(X(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(n){var r,l,c,d,h;try{if("email"in n){const{email:m,options:g}=n;let p=null,S=null;this.flowType==="pkce"&&([p,S]=await vi(this.storage,this.storageKey));const{error:b}=await ee(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:m,data:(r=g?.data)!==null&&r!==void 0?r:{},create_user:(l=g?.shouldCreateUser)!==null&&l!==void 0?l:!0,gotrue_meta_security:{captcha_token:g?.captchaToken},code_challenge:p,code_challenge_method:S},redirectTo:g?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:b})}if("phone"in n){const{phone:m,options:g}=n,{data:p,error:S}=await ee(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:m,data:(c=g?.data)!==null&&c!==void 0?c:{},create_user:(d=g?.shouldCreateUser)!==null&&d!==void 0?d:!0,gotrue_meta_security:{captcha_token:g?.captchaToken},channel:(h=g?.channel)!==null&&h!==void 0?h:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:p?.message_id},error:S})}throw new Co("You must provide either an email or phone number.")}catch(m){if(await rt(this.storage,`${this.storageKey}-code-verifier`),X(m))return this._returnResult({data:{user:null,session:null},error:m});throw m}}async verifyOtp(n){var r,l;try{let c,d;"options"in n&&(c=(r=n.options)===null||r===void 0?void 0:r.redirectTo,d=(l=n.options)===null||l===void 0?void 0:l.captchaToken);const{data:h,error:m}=await ee(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},n),{gotrue_meta_security:{captcha_token:d}}),redirectTo:c,xform:hn});if(m)throw m;if(!h)throw new Error("An error occurred on token verification.");const g=h.session,p=h.user;return g?.access_token&&(await this._saveSession(g),await this._notifyAllSubscribers(n.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",g)),this._returnResult({data:{user:p,session:g},error:null})}catch(c){if(X(c))return this._returnResult({data:{user:null,session:null},error:c});throw c}}async signInWithSSO(n){var r,l,c,d,h;try{let m=null,g=null;this.flowType==="pkce"&&([m,g]=await vi(this.storage,this.storageKey));const p=await ee(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in n?{provider_id:n.providerId}:null),"domain"in n?{domain:n.domain}:null),{redirect_to:(l=(r=n.options)===null||r===void 0?void 0:r.redirectTo)!==null&&l!==void 0?l:void 0}),!((c=n?.options)===null||c===void 0)&&c.captchaToken?{gotrue_meta_security:{captcha_token:n.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:m,code_challenge_method:g}),headers:this.headers,xform:ow});return!((d=p.data)===null||d===void 0)&&d.url&&Ct()&&!(!((h=n.options)===null||h===void 0)&&h.skipBrowserRedirect)&&window.location.assign(p.data.url),this._returnResult(p)}catch(m){if(await rt(this.storage,`${this.storageKey}-code-verifier`),X(m))return this._returnResult({data:null,error:m});throw m}}async reauthenticate(){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate()):await this._reauthenticate()}async _reauthenticate(){try{return await this._useSession(async n=>{const{data:{session:r},error:l}=n;if(l)throw l;if(!r)throw new bt;const{error:c}=await ee(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:c})})}catch(n){if(X(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async resend(n){try{const r=`${this.url}/resend`;if("email"in n){const{email:l,type:c,options:d}=n;let h=null,m=null;this.flowType==="pkce"&&([h,m]=await vi(this.storage,this.storageKey));const{error:g}=await ee(this.fetch,"POST",r,{headers:this.headers,body:{email:l,type:c,gotrue_meta_security:{captcha_token:d?.captchaToken},code_challenge:h,code_challenge_method:m},redirectTo:d?.emailRedirectTo});return g&&await rt(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:g})}else if("phone"in n){const{phone:l,type:c,options:d}=n,{data:h,error:m}=await ee(this.fetch,"POST",r,{headers:this.headers,body:{phone:l,type:c,gotrue_meta_security:{captcha_token:d?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:h?.message_id},error:m})}throw new Co("You must provide either an email or phone number and a type")}catch(r){if(await rt(this.storage,`${this.storageKey}-code-verifier`),X(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async n=>n)):await this._useSession(async n=>n)}async _acquireLock(n,r){this._debug("#_acquireLock","begin",n);try{if(this.lockAcquired){const l=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),c=(async()=>(await l,await r()))();return this.pendingInLock.push((async()=>{try{await c}catch{}})()),c}return await this.lock(`lock:${this.storageKey}`,n,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const l=r();for(this.pendingInLock.push((async()=>{try{await l}catch{}})()),await l;this.pendingInLock.length;){const c=[...this.pendingInLock];await Promise.all(c),this.pendingInLock.splice(0,c.length)}return await l}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(n){this._debug("#_useSession","begin");try{const r=await this.__loadSession();return await n(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lock!=null&&!this.lockAcquired&&this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let n=null;const r=await vn(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?n=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!n)return{data:{session:null},error:null};const l=n.expires_at?n.expires_at*1e3-Date.now()<dd:!1;if(this._debug("#__loadSession()",`session has${l?"":" not"} expired`,"expires_at",n.expires_at),!l){if(this.userStorage){const h=await vn(this.userStorage,this.storageKey+"-user");h?.user?n.user=h.user:n.user=hd()}if(this.storage.isServer&&n.user&&!n.user.__isUserNotAvailableProxy){const h={value:this.suppressGetSessionWarning};n.user=iw(n.user,h),h.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:n},error:null}}const{data:c,error:d}=await this._callRefreshToken(n.refresh_token);if(d){if(!!(n.expires_at&&n.expires_at*1e3>Date.now())){const m=await vn(this.storage,this.storageKey);if(m&&m.refresh_token===n.refresh_token)return this._returnResult({data:{session:n},error:null})}return this._returnResult({data:{session:null},error:d})}return this._returnResult({data:{session:c},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(n){if(n)return await this._getUser(n);await this.initializePromise;let r;return this.lock!=null?r=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser()):r=await this._getUser(),r.data.user&&(this.suppressGetSessionWarning=!0),r}async _getUser(n){try{return n?await ee(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:n,xform:Ya}):await this._useSession(async r=>{var l,c,d;const{data:h,error:m}=r;if(m)throw m;return!(!((l=h.session)===null||l===void 0)&&l.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new bt}:await ee(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(d=(c=h.session)===null||c===void 0?void 0:c.access_token)!==null&&d!==void 0?d:void 0,xform:Ya})})}catch(r){if(X(r))return xo(r)&&(await this._removeSession(),await rt(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(n,r={}){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(n,r)):await this._updateUser(n,r)}async _updateUser(n,r={}){try{return await this._useSession(async l=>{const{data:c,error:d}=l;if(d)throw d;if(!c.session)throw new bt;const h=c.session;let m=null,g=null;this.flowType==="pkce"&&n.email!=null&&([m,g]=await vi(this.storage,this.storageKey));const{data:p,error:S}=await ee(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r?.emailRedirectTo,body:Object.assign(Object.assign({},n),{code_challenge:m,code_challenge_method:g}),jwt:h.access_token,xform:Ya});if(S)throw S;return h.user=p.user,await this._saveSession(h),await this._notifyAllSubscribers("USER_UPDATED",h),this._returnResult({data:{user:h.user},error:null})})}catch(l){if(await rt(this.storage,`${this.storageKey}-code-verifier`),X(l))return this._returnResult({data:{user:null},error:l});throw l}}async setSession(n){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(n)):await this._setSession(n)}async _setSession(n){try{if(!n.access_token||!n.refresh_token)throw new bt;const r=Date.now()/1e3;let l=r,c=!0,d=null;const{payload:h}=Ro(n.access_token);if(h.exp&&(l=h.exp,c=l<=r),c){const{data:m,error:g}=await this._callRefreshToken(n.refresh_token);if(g)return this._returnResult({data:{user:null,session:null},error:g});if(!m)return{data:{user:null,session:null},error:null};d=m}else{const{data:m,error:g}=await this._getUser(n.access_token);if(g)return this._returnResult({data:{user:null,session:null},error:g});d={access_token:n.access_token,refresh_token:n.refresh_token,user:m.user,token_type:"bearer",expires_in:l-r,expires_at:l},await this._saveSession(d),await this._notifyAllSubscribers("SIGNED_IN",d)}return this._returnResult({data:{user:d.user,session:d},error:null})}catch(r){if(X(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(n){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(n)):await this._refreshSession(n)}async _refreshSession(n){try{return await this._useSession(async r=>{var l;if(!n){const{data:h,error:m}=r;if(m)throw m;n=(l=h.session)!==null&&l!==void 0?l:void 0}if(!n?.refresh_token)throw new bt;const{data:c,error:d}=await this._callRefreshToken(n.refresh_token);return d?this._returnResult({data:{user:null,session:null},error:d}):c?this._returnResult({data:{user:c.user,session:c},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if(X(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(n,r){var l;try{if(!Ct())throw new Oo("No browser detected.");if(n.error||n.error_description||n.error_code)throw new Oo(n.error_description||"Error in URL with unspecified error_description",{error:n.error||"unspecified_error",code:n.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new Xg("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Oo("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!n.code)throw new Xg("No code detected.");const{data:N,error:Y}=await this._exchangeCodeForSession(n.code);if(Y)throw Y;const ue=new URL(window.location.href);return ue.searchParams.delete("code"),window.history.replaceState(window.history.state,"",ue.toString()),{data:{session:N.session,redirectType:(l=N.redirectType)!==null&&l!==void 0?l:null},error:null}}const{provider_token:c,provider_refresh_token:d,access_token:h,refresh_token:m,expires_in:g,expires_at:p,token_type:S}=n;if(!h||!g||!m||!S)throw new Oo("No session defined in URL");const b=Math.round(Date.now()/1e3),T=parseInt(g);let A=b+T;p&&(A=parseInt(p));const C=A-b;C*1e3<=ma&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${C}s, should have been closer to ${T}s`);const U=A-T;b-U>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",U,A,b):b-U<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",U,A,b);const{data:$,error:P}=await this._getUser(h);if(P)throw P;const q={provider_token:c,provider_refresh_token:d,access_token:h,expires_in:T,expires_at:A,refresh_token:m,token_type:S,user:$.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:q,redirectType:n.type},error:null})}catch(c){if(X(c))return this._returnResult({data:{session:null,redirectType:null},error:c});throw c}}_isImplicitGrantCallback(n){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),n):!!(n.access_token||n.error||n.error_description||n.error_code)}async _isPKCECallback(n){const r=await vn(this.storage,`${this.storageKey}-code-verifier`);return!!(n.code&&r)}async signOut(n={scope:"global"}){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(n)):await this._signOut(n)}async _signOut({scope:n}={scope:"global"}){return await this._useSession(async r=>{var l;const{data:c,error:d}=r;if(d&&!xo(d))return this._returnResult({error:d});const h=(l=c.session)===null||l===void 0?void 0:l.access_token;if(h){const{error:m}=await this.admin.signOut(h,n);if(m&&!(DS(m)&&(m.status===404||m.status===401||m.status===403)||xo(m)))return this._returnResult({error:m})}return n!=="others"&&(await this._removeSession(),await rt(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(n){const r=GS(),l={id:r,callback:n,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,l),(async()=>(await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(r)}):await this._emitInitialSession(r)))(),{data:{subscription:l}}}async _emitInitialSession(n){return await this._useSession(async r=>{var l,c;try{const{data:{session:d},error:h}=r;if(h)throw h;await((l=this.stateChangeEmitters.get(n))===null||l===void 0?void 0:l.callback("INITIAL_SESSION",d)),this._debug("INITIAL_SESSION","callback id",n,"session",d)}catch(d){await((c=this.stateChangeEmitters.get(n))===null||c===void 0?void 0:c.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",n,"error",d),xo(d)?console.warn(d):console.error(d)}})}async resetPasswordForEmail(n,r={}){let l=null,c=null;this.flowType==="pkce"&&([l,c]=await vi(this.storage,this.storageKey,!0));try{return await ee(this.fetch,"POST",`${this.url}/recover`,{body:{email:n,code_challenge:l,code_challenge_method:c,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(d){if(await rt(this.storage,`${this.storageKey}-code-verifier`),X(d))return this._returnResult({data:null,error:d});throw d}}async getUserIdentities(){var n;try{const{data:r,error:l}=await this.getUser();if(l)throw l;return this._returnResult({data:{identities:(n=r.user.identities)!==null&&n!==void 0?n:[]},error:null})}catch(r){if(X(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(n){return"token"in n?this.linkIdentityIdToken(n):this.linkIdentityOAuth(n)}async linkIdentityOAuth(n){var r;try{const{data:l,error:c}=await this._useSession(async d=>{var h,m,g,p,S;const{data:b,error:T}=d;if(T)throw T;const A=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,n.provider,{redirectTo:(h=n.options)===null||h===void 0?void 0:h.redirectTo,scopes:(m=n.options)===null||m===void 0?void 0:m.scopes,queryParams:(g=n.options)===null||g===void 0?void 0:g.queryParams,skipBrowserRedirect:!0});return await ee(this.fetch,"GET",A,{headers:this.headers,jwt:(S=(p=b.session)===null||p===void 0?void 0:p.access_token)!==null&&S!==void 0?S:void 0})});if(c)throw c;return Ct()&&!(!((r=n.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(l?.url),this._returnResult({data:{provider:n.provider,url:l?.url},error:null})}catch(l){if(X(l))return this._returnResult({data:{provider:n.provider,url:null},error:l});throw l}}async linkIdentityIdToken(n){return await this._useSession(async r=>{var l;try{const{error:c,data:{session:d}}=r;if(c)throw c;const{options:h,provider:m,token:g,access_token:p,nonce:S}=n,b=await ee(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(l=d?.access_token)!==null&&l!==void 0?l:void 0,body:{provider:m,id_token:g,access_token:p,nonce:S,link_identity:!0,gotrue_meta_security:{captcha_token:h?.captchaToken}},xform:hn}),{data:T,error:A}=b;return A?this._returnResult({data:{user:null,session:null},error:A}):!T||!T.session||!T.user?this._returnResult({data:{user:null,session:null},error:new dr}):(T.session&&(await this._saveSession(T.session),await this._notifyAllSubscribers("USER_UPDATED",T.session)),this._returnResult({data:T,error:A}))}catch(c){if(await rt(this.storage,`${this.storageKey}-code-verifier`),X(c))return this._returnResult({data:{user:null,session:null},error:c});throw c}})}async unlinkIdentity(n){try{return await this._useSession(async r=>{var l,c;const{data:d,error:h}=r;if(h)throw h;return await ee(this.fetch,"DELETE",`${this.url}/user/identities/${n.identity_id}`,{headers:this.headers,jwt:(c=(l=d.session)===null||l===void 0?void 0:l.access_token)!==null&&c!==void 0?c:void 0})})}catch(r){if(X(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(n){const r="#_refreshAccessToken()";this._debug(r,"begin");try{const l=Date.now();return await JS(async c=>(c>0&&await YS(200*Math.pow(2,c-1)),this._debug(r,"refreshing attempt",c),await ee(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:n},headers:this.headers,xform:hn})),(c,d)=>{const h=200*Math.pow(2,c);return d&&Qg(d)&&Date.now()+h-l<ma})}catch(l){if(this._debug(r,"error",l),X(l))return this._returnResult({data:{session:null,user:null},error:l});throw l}finally{this._debug(r,"end")}}_isValidSession(n){return typeof n=="object"&&n!==null&&"access_token"in n&&"refresh_token"in n&&"expires_at"in n}async _handleProviderSignIn(n,r){const l=await this._getUrlForProvider(`${this.url}/authorize`,n,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",n,"options",r,"url",l),Ct()&&!r.skipBrowserRedirect&&window.location.assign(l),{data:{provider:n,url:l},error:null}}async _recoverAndRefresh(){var n,r;const l="#_recoverAndRefresh()";this._debug(l,"begin");try{const c=await vn(this.storage,this.storageKey);if(c&&this.userStorage){let h=await vn(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!h&&(h={user:c.user},await Sr(this.userStorage,this.storageKey+"-user",h)),c.user=(n=h?.user)!==null&&n!==void 0?n:hd()}else if(c&&!c.user&&!c.user){const h=await vn(this.storage,this.storageKey+"-user");h&&h?.user?(c.user=h.user,await rt(this.storage,this.storageKey+"-user"),await Sr(this.storage,this.storageKey,c)):c.user=hd()}if(this._debug(l,"session from storage",c),!this._isValidSession(c)){this._debug(l,"session is not valid"),c!==null&&await this._removeSession();return}const d=((r=c.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<dd;if(this._debug(l,`session has${d?"":" not"} expired with margin of ${dd}s`),d){if(this.autoRefreshToken&&c.refresh_token){const{error:h}=await this._callRefreshToken(c.refresh_token);h&&(zS(h)?this._debug(l,"refresh discarded by commit guard",h):this._debug(l,"refresh failed",h))}}else if(c.user&&c.user.__isUserNotAvailableProxy===!0)try{const{data:h,error:m}=await this._getUser(c.access_token);!m&&h?.user?(c.user=h.user,await this._saveSession(c),await this._notifyAllSubscribers("SIGNED_IN",c)):this._debug(l,"could not get user data, skipping SIGNED_IN notification")}catch(h){console.error("Error getting user data:",h),this._debug(l,"error getting user data, skipping SIGNED_IN notification",h)}else await this._notifyAllSubscribers("SIGNED_IN",c)}catch(c){this._debug(l,"error",c),console.error(c);return}finally{this._debug(l,"end")}}async _callRefreshToken(n){var r,l;if(!n)throw new bt;if(this.refreshingDeferred)return this.refreshingDeferred.promise;if(this.lastRefreshFailure&&this.lastRefreshFailure.refreshToken===n&&Date.now()<this.lastRefreshFailure.expiresAt)return this._debug("#_callRefreshToken()","returning cached failure (cooldown active)"),this.lastRefreshFailure.result;const c="#_callRefreshToken()";this._debug(c,"begin");try{this.refreshingDeferred=new Vo;const d=await vn(this.storage,this.storageKey),{data:h,error:m}=await this._refreshAccessToken(n);if(m)throw m;if(!h.session)throw new bt;const g=await vn(this.storage,this.storageKey);if(d!==null&&(g===null||g.refresh_token!==d.refresh_token)){this._debug(c,"commit guard: storage changed since refresh started, discarding rotated tokens",{startedWith:"present",nowHolds:g?"replaced":"cleared"});const T={data:null,error:new Wg};return this.refreshingDeferred.resolve(T),T}const S=this._sessionRemovalEpoch;if(await this._saveSession(h.session),this._sessionRemovalEpoch!==S){this._debug(c,"commit guard (post-save): _removeSession ran during _saveSession, undoing write"),await rt(this.storage,this.storageKey),this.userStorage&&await rt(this.userStorage,this.storageKey+"-user");const T={data:null,error:new Wg};return this.refreshingDeferred.resolve(T),T}await this._notifyAllSubscribers("TOKEN_REFRESHED",h.session);const b={data:h.session,error:null};return this.lastRefreshFailure=null,this.refreshingDeferred.resolve(b),b}catch(d){if(this._debug(c,"error",d),X(d)){const h={data:null,error:d};if(!Qg(d)){const m=await vn(this.storage,this.storageKey);!!(m?.expires_at&&m.expires_at*1e3>Date.now())?this._debug(c,"proactive refresh failed, access token still valid — preserving session"):await this._removeSession()}return this.lastRefreshFailure={refreshToken:n,result:h,expiresAt:Date.now()+xS},(r=this.refreshingDeferred)===null||r===void 0||r.resolve(h),h}throw(l=this.refreshingDeferred)===null||l===void 0||l.reject(d),d}finally{this.refreshingDeferred=null,this._debug(c,"end")}}async _notifyAllSubscribers(n,r,l=!0){const c=`#_notifyAllSubscribers(${n})`;this._debug(c,"begin",r,`broadcast = ${l}`);try{this.broadcastChannel&&l&&this.broadcastChannel.postMessage({event:n,session:r});const d=[],h=Array.from(this.stateChangeEmitters.values()).map(async m=>{try{await m.callback(n,r)}catch(g){d.push(g)}});if(await Promise.all(h),d.length>0){for(let m=0;m<d.length;m+=1)console.error(d[m]);throw d[0]}}finally{this._debug(c,"end")}}async _saveSession(n){this._debug("#_saveSession()",n),this.suppressGetSessionWarning=!0,await rt(this.storage,`${this.storageKey}-code-verifier`);const r=Object.assign({},n),l=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!l&&r.user&&await Sr(this.userStorage,this.storageKey+"-user",{user:r.user});const c=Object.assign({},r);delete c.user;const d=np(c);await Sr(this.storage,this.storageKey,d)}else{const c=np(r);await Sr(this.storage,this.storageKey,c)}}async _removeSession(){this._sessionRemovalEpoch+=1,this._debug("#_removeSession()"),this.lastRefreshFailure=null,this.suppressGetSessionWarning=!1,await rt(this.storage,this.storageKey),await rt(this.storage,this.storageKey+"-code-verifier"),await rt(this.storage,this.storageKey+"-user"),this.userStorage&&await rt(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const n=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{n&&Ct()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",n)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const n=setInterval(()=>this._autoRefreshTokenTick(),ma);this.autoRefreshTicker=n,n&&typeof n=="object"&&typeof n.unref=="function"?n.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(n);const r=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=r,r&&typeof r=="object"&&typeof r.unref=="function"?r.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(r)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const n=this.autoRefreshTicker;this.autoRefreshTicker=null,n&&clearInterval(n);const r=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,r&&clearTimeout(r)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async dispose(){var n;this._removeVisibilityChangedCallback(),await this._stopAutoRefresh(),(n=this.broadcastChannel)===null||n===void 0||n.close(),this.broadcastChannel=null,this.stateChangeEmitters.clear()}async _autoRefreshTokenTick(){if(this._debug("#_autoRefreshTokenTick()","begin"),this.lock!=null){try{await this._acquireLock(0,async()=>{try{const n=Date.now();try{return await this._useSession(async r=>{const{data:{session:l}}=r;if(!l||!l.refresh_token||!l.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const c=Math.floor((l.expires_at*1e3-n)/ma);this._debug("#_autoRefreshTokenTick()",`access token expires in ${c} ticks, a tick lasts ${ma}ms, refresh threshold is ${Ms} ticks`),c<=Ms&&await this._callRefreshToken(l.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(n){if(n instanceof hw)this._debug("auto refresh token tick lock not available");else throw n}return}if(this.refreshingDeferred!==null){this._debug("#_autoRefreshTokenTick()","refresh already in flight, skipping");return}try{const n=Date.now();try{await this._useSession(async r=>{const{data:{session:l}}=r;if(!l||!l.refresh_token||!l.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const c=Math.floor((l.expires_at*1e3-n)/ma);this._debug("#_autoRefreshTokenTick()",`access token expires in ${c} ticks, a tick lasts ${ma}ms, refresh threshold is ${Ms} ticks`),c<=Ms&&await this._callRefreshToken(l.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Ct()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(n){this._debug("#visibilityChangedCallback","error",n)}},window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(n){console.error("_handleVisibilityChange",n)}}async _onVisibilityChanged(n){const r=`#_onVisibilityChanged(${n})`;if(this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"){if(this.autoRefreshToken&&this._startAutoRefresh(),!n)if(await this.initializePromise,this.lock!=null)await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()});else{if(document.visibilityState!=="visible"){this._debug(r,"visibilityState is no longer visible, skipping recovery");return}await this._recoverAndRefresh()}}else document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(n,r,l){const c=[`provider=${encodeURIComponent(r)}`];if(l?.redirectTo&&c.push(`redirect_to=${encodeURIComponent(l.redirectTo)}`),l?.scopes&&c.push(`scopes=${encodeURIComponent(l.scopes)}`),this.flowType==="pkce"){const[d,h]=await vi(this.storage,this.storageKey),m=new URLSearchParams({code_challenge:`${encodeURIComponent(d)}`,code_challenge_method:`${encodeURIComponent(h)}`});c.push(m.toString())}if(l?.queryParams){const d=new URLSearchParams(l.queryParams);c.push(d.toString())}return l?.skipBrowserRedirect&&c.push(`skip_http_redirect=${l.skipBrowserRedirect}`),`${n}?${c.join("&")}`}async _unenroll(n){try{return await this._useSession(async r=>{var l;const{data:c,error:d}=r;return d?this._returnResult({data:null,error:d}):await ee(this.fetch,"DELETE",`${this.url}/factors/${n.factorId}`,{headers:this.headers,jwt:(l=c?.session)===null||l===void 0?void 0:l.access_token})})}catch(r){if(X(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(n){try{return await this._useSession(async r=>{var l,c;const{data:d,error:h}=r;if(h)return this._returnResult({data:null,error:h});const m=Object.assign({friendly_name:n.friendlyName,factor_type:n.factorType},n.factorType==="phone"?{phone:n.phone}:n.factorType==="totp"?{issuer:n.issuer}:{}),{data:g,error:p}=await ee(this.fetch,"POST",`${this.url}/factors`,{body:m,headers:this.headers,jwt:(l=d?.session)===null||l===void 0?void 0:l.access_token});return p?this._returnResult({data:null,error:p}):(n.factorType==="totp"&&g.type==="totp"&&(!((c=g?.totp)===null||c===void 0)&&c.qr_code)&&(g.totp.qr_code=`data:image/svg+xml;utf-8,${g.totp.qr_code}`),this._returnResult({data:g,error:null}))})}catch(r){if(X(r))return this._returnResult({data:null,error:r});throw r}}async _verify(n){const r=async()=>{try{return await this._useSession(async l=>{var c;const{data:d,error:h}=l;if(h)return this._returnResult({data:null,error:h});const m=Object.assign({challenge_id:n.challengeId},"webauthn"in n?{webauthn:Object.assign(Object.assign({},n.webauthn),{credential_response:n.webauthn.type==="create"?cp(n.webauthn.credential_response):up(n.webauthn.credential_response)})}:{code:n.code}),{data:g,error:p}=await ee(this.fetch,"POST",`${this.url}/factors/${n.factorId}/verify`,{body:m,headers:this.headers,jwt:(c=d?.session)===null||c===void 0?void 0:c.access_token});return p?this._returnResult({data:null,error:p}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+g.expires_in},g)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",g),this._returnResult({data:g,error:p}))})}catch(l){if(X(l))return this._returnResult({data:null,error:l});throw l}};return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,r):r()}async _challenge(n){const r=async()=>{try{return await this._useSession(async l=>{var c;const{data:d,error:h}=l;if(h)return this._returnResult({data:null,error:h});const m=await ee(this.fetch,"POST",`${this.url}/factors/${n.factorId}/challenge`,{body:n,headers:this.headers,jwt:(c=d?.session)===null||c===void 0?void 0:c.access_token});if(m.error)return m;const{data:g}=m;if(g.type!=="webauthn")return{data:g,error:null};switch(g.webauthn.type){case"create":return{data:Object.assign(Object.assign({},g),{webauthn:Object.assign(Object.assign({},g.webauthn),{credential_options:Object.assign(Object.assign({},g.webauthn.credential_options),{publicKey:lp(g.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},g),{webauthn:Object.assign(Object.assign({},g.webauthn),{credential_options:Object.assign(Object.assign({},g.webauthn.credential_options),{publicKey:op(g.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(l){if(X(l))return this._returnResult({data:null,error:l});throw l}};return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,r):r()}async _challengeAndVerify(n){const{data:r,error:l}=await this._challenge({factorId:n.factorId});return l?this._returnResult({data:null,error:l}):await this._verify({factorId:n.factorId,challengeId:r.id,code:n.code})}async _listFactors(){var n;const{data:{user:r},error:l}=await this.getUser();if(l)return{data:null,error:l};const c={all:[],phone:[],totp:[],webauthn:[]};for(const d of(n=r?.factors)!==null&&n!==void 0?n:[])c.all.push(d),d.status==="verified"&&c[d.factor_type].push(d);return{data:c,error:null}}async _getAuthenticatorAssuranceLevel(n){var r,l,c,d;if(n)try{const{payload:A}=Ro(n);let C=null;A.aal&&(C=A.aal);let U=C;const{data:{user:$},error:P}=await this.getUser(n);if(P)return this._returnResult({data:null,error:P});((l=(r=$?.factors)===null||r===void 0?void 0:r.filter(Y=>Y.status==="verified"))!==null&&l!==void 0?l:[]).length>0&&(U="aal2");const N=A.amr||[];return{data:{currentLevel:C,nextLevel:U,currentAuthenticationMethods:N},error:null}}catch(A){if(X(A))return this._returnResult({data:null,error:A});throw A}const{data:{session:h},error:m}=await this.getSession();if(m)return this._returnResult({data:null,error:m});if(!h)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:g}=Ro(h.access_token);let p=null;g.aal&&(p=g.aal);let S=p;((d=(c=h.user.factors)===null||c===void 0?void 0:c.filter(A=>A.status==="verified"))!==null&&d!==void 0?d:[]).length>0&&(S="aal2");const T=g.amr||[];return{data:{currentLevel:p,nextLevel:S,currentAuthenticationMethods:T},error:null}}async _getAuthorizationDetails(n){try{return await this._useSession(async r=>{const{data:{session:l},error:c}=r;return c?this._returnResult({data:null,error:c}):l?await ee(this.fetch,"GET",`${this.url}/oauth/authorizations/${n}`,{headers:this.headers,jwt:l.access_token,xform:d=>({data:d,error:null})}):this._returnResult({data:null,error:new bt})})}catch(r){if(X(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(n,r){try{return await this._useSession(async l=>{const{data:{session:c},error:d}=l;if(d)return this._returnResult({data:null,error:d});if(!c)return this._returnResult({data:null,error:new bt});const h=await ee(this.fetch,"POST",`${this.url}/oauth/authorizations/${n}/consent`,{headers:this.headers,jwt:c.access_token,body:{action:"approve"},xform:m=>({data:m,error:null})});return h.data&&h.data.redirect_url&&Ct()&&!r?.skipBrowserRedirect&&window.location.assign(h.data.redirect_url),h})}catch(l){if(X(l))return this._returnResult({data:null,error:l});throw l}}async _denyAuthorization(n,r){try{return await this._useSession(async l=>{const{data:{session:c},error:d}=l;if(d)return this._returnResult({data:null,error:d});if(!c)return this._returnResult({data:null,error:new bt});const h=await ee(this.fetch,"POST",`${this.url}/oauth/authorizations/${n}/consent`,{headers:this.headers,jwt:c.access_token,body:{action:"deny"},xform:m=>({data:m,error:null})});return h.data&&h.data.redirect_url&&Ct()&&!r?.skipBrowserRedirect&&window.location.assign(h.data.redirect_url),h})}catch(l){if(X(l))return this._returnResult({data:null,error:l});throw l}}async _listOAuthGrants(){try{return await this._useSession(async n=>{const{data:{session:r},error:l}=n;return l?this._returnResult({data:null,error:l}):r?await ee(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:c=>({data:c,error:null})}):this._returnResult({data:null,error:new bt})})}catch(n){if(X(n))return this._returnResult({data:null,error:n});throw n}}async _revokeOAuthGrant(n){try{return await this._useSession(async r=>{const{data:{session:l},error:c}=r;return c?this._returnResult({data:null,error:c}):l?(await ee(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:l.access_token,query:{client_id:n.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new bt})})}catch(r){if(X(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(n,r={keys:[]}){let l=r.keys.find(m=>m.kid===n);if(l)return l;const c=Date.now();if(l=this.jwks.keys.find(m=>m.kid===n),l&&this.jwks_cached_at+NS>c)return l;const{data:d,error:h}=await ee(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(h)throw h;return!d.keys||d.keys.length===0||(this.jwks=d,this.jwks_cached_at=c,l=d.keys.find(m=>m.kid===n),!l)?null:l}async getClaims(n,r={}){try{let l=n;if(!l){const{data:A,error:C}=await this.getSession();if(C||!A.session)return this._returnResult({data:null,error:C});l=A.session.access_token}const{header:c,payload:d,signature:h,raw:{header:m,payload:g}}=Ro(l);if(!r?.allowExpired)try{tw(d.exp)}catch(A){throw new Mo(A instanceof Error?A.message:"JWT validation failed")}const p=!c.alg||c.alg.startsWith("HS")||!c.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(c.kid,r?.keys?{keys:r.keys}:r?.jwks);if(!p){const{error:A}=await this.getUser(l);if(A)throw A;return{data:{claims:d,header:c,signature:h},error:null}}const S=nw(c.alg),b=await crypto.subtle.importKey("jwk",p,S,!0,["verify"]);if(!await crypto.subtle.verify(S,b,h,PS(`${m}.${g}`)))throw new Mo("Invalid JWT signature");return{data:{claims:d,header:c,signature:h},error:null}}catch(l){if(X(l))return this._returnResult({data:null,error:l});throw l}}async signInWithPasskey(n){var r,l,c;bn(this.experimental);try{if(!Ho())return this._returnResult({data:null,error:new Tn("Browser does not support WebAuthn",null)});const{data:d,error:h}=await this._startPasskeyAuthentication({options:{captchaToken:(r=n?.options)===null||r===void 0?void 0:r.captchaToken}});if(h||!d)return this._returnResult({data:null,error:h});const m=op(d.options),g=(c=(l=n?.options)===null||l===void 0?void 0:l.signal)!==null&&c!==void 0?c:Ud.createNewAbortSignal(),{data:p,error:S}=await Vp({publicKey:m,signal:g});if(S||!p)return this._returnResult({data:null,error:S??new Tn("WebAuthn ceremony failed",null)});const b=up(p);return this._verifyPasskeyAuthentication({challengeId:d.challenge_id,credential:b})}catch(d){if(X(d))return this._returnResult({data:null,error:d});throw d}}async registerPasskey(n){var r,l;bn(this.experimental);try{if(!Ho())return this._returnResult({data:null,error:new Tn("Browser does not support WebAuthn",null)});const{data:c,error:d}=await this._startPasskeyRegistration();if(d||!c)return this._returnResult({data:null,error:d});const h=lp(c.options),m=(l=(r=n?.options)===null||r===void 0?void 0:r.signal)!==null&&l!==void 0?l:Ud.createNewAbortSignal(),{data:g,error:p}=await Gp({publicKey:h,signal:m});if(p||!g)return this._returnResult({data:null,error:p??new Tn("WebAuthn ceremony failed",null)});const S=cp(g);return this._verifyPasskeyRegistration({challengeId:c.challenge_id,credential:S})}catch(c){if(X(c))return this._returnResult({data:null,error:c});throw c}}async _startPasskeyRegistration(){bn(this.experimental);try{return await this._useSession(async n=>{const{data:{session:r},error:l}=n;if(l)return this._returnResult({data:null,error:l});if(!r)return this._returnResult({data:null,error:new bt});const{data:c,error:d}=await ee(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:r.access_token,body:{}});return d?this._returnResult({data:null,error:d}):this._returnResult({data:c,error:null})})}catch(n){if(X(n))return this._returnResult({data:null,error:n});throw n}}async _verifyPasskeyRegistration(n){bn(this.experimental);try{return await this._useSession(async r=>{const{data:{session:l},error:c}=r;if(c)return this._returnResult({data:null,error:c});if(!l)return this._returnResult({data:null,error:new bt});const{data:d,error:h}=await ee(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:l.access_token,body:{challenge_id:n.challengeId,credential:n.credential}});return h?this._returnResult({data:null,error:h}):this._returnResult({data:d,error:null})})}catch(r){if(X(r))return this._returnResult({data:null,error:r});throw r}}async _startPasskeyAuthentication(n){var r;bn(this.experimental);try{const{data:l,error:c}=await ee(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(r=n?.options)===null||r===void 0?void 0:r.captchaToken}}});return c?this._returnResult({data:null,error:c}):this._returnResult({data:l,error:null})}catch(l){if(X(l))return this._returnResult({data:null,error:l});throw l}}async _verifyPasskeyAuthentication(n){bn(this.experimental);try{const{data:r,error:l}=await ee(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:n.challengeId,credential:n.credential},xform:hn});return l?this._returnResult({data:null,error:l}):(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:r,error:null}))}catch(r){if(X(r))return this._returnResult({data:null,error:r});throw r}}async _listPasskeys(){bn(this.experimental);try{return await this._useSession(async n=>{const{data:{session:r},error:l}=n;if(l)return this._returnResult({data:null,error:l});if(!r)return this._returnResult({data:null,error:new bt});const{data:c,error:d}=await ee(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:r.access_token,xform:h=>({data:h,error:null})});return d?this._returnResult({data:null,error:d}):this._returnResult({data:c,error:null})})}catch(n){if(X(n))return this._returnResult({data:null,error:n});throw n}}async _updatePasskey(n){bn(this.experimental);try{return await this._useSession(async r=>{const{data:{session:l},error:c}=r;if(c)return this._returnResult({data:null,error:c});if(!l)return this._returnResult({data:null,error:new bt});const{data:d,error:h}=await ee(this.fetch,"PATCH",`${this.url}/passkeys/${n.passkeyId}`,{headers:this.headers,jwt:l.access_token,body:{friendly_name:n.friendlyName}});return h?this._returnResult({data:null,error:h}):this._returnResult({data:d,error:null})})}catch(r){if(X(r))return this._returnResult({data:null,error:r});throw r}}async _deletePasskey(n){bn(this.experimental);try{return await this._useSession(async r=>{const{data:{session:l},error:c}=r;if(c)return this._returnResult({data:null,error:c});if(!l)return this._returnResult({data:null,error:new bt});const{error:d}=await ee(this.fetch,"DELETE",`${this.url}/passkeys/${n.passkeyId}`,{headers:this.headers,jwt:l.access_token,noResolveJson:!0});return d?this._returnResult({data:null,error:d}):this._returnResult({data:null,error:null})})}catch(r){if(X(r))return this._returnResult({data:null,error:r});throw r}}}Ws.nextInstanceID={};const Aw=Ws,xw="2.110.0";let zs="",$o;if(typeof Deno<"u"){var md;zs="deno",$o=(md=Deno.version)===null||md===void 0?void 0:md.deno}else if(typeof document<"u")zs="web";else if(typeof navigator<"u"&&navigator.product==="ReactNative")zs="react-native";else{var gd;zs="node",$o=typeof process<"u"?(gd=process.version)===null||gd===void 0?void 0:gd.replace(/^v/,""):void 0}const Kp=[`runtime=${zs}`];$o&&Kp.push(`runtime-version=${$o}`);const Cw={"X-Client-Info":`supabase-js/${xw}; ${Kp.join("; ")}`},Ow={headers:Cw},Rw={schema:"public"},jw={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Nw={},Lw={enabled:!1,respectSamplingDecision:!0};function Dw(i,n,r,l){function c(d){return d instanceof r?d:new r(function(h){h(d)})}return new(r||(r=Promise))(function(d,h){function m(S){try{p(l.next(S))}catch(b){h(b)}}function g(S){try{p(l.throw(S))}catch(b){h(b)}}function p(S){S.done?d(S.value):c(S.value).then(m,g)}p((l=l.apply(i,[])).next())})}let pd=null;const Uw="@opentelemetry/api";function Mw(){return pd===null&&(pd=import(Uw).catch(()=>null)),pd}function zw(){return Dw(this,void 0,void 0,function*(){try{const i=yield Mw();if(!i||!i.propagation||!i.context)return null;const n={};i.propagation.inject(i.context.active(),n);const r=n.traceparent;return r?{traceparent:r,tracestate:n.tracestate,baggage:n.baggage}:null}catch{return null}})}function Bw(i){if(!i||typeof i!="string")return null;const n=i.split("-");if(n.length!==4)return null;const[r,l,c,d]=n;if(r.length!==2||l.length!==32||c.length!==16||d.length!==2)return null;const h=/^[0-9a-f]+$/i;return!h.test(r)||!h.test(l)||!h.test(c)||!h.test(d)||l==="00000000000000000000000000000000"||c==="0000000000000000"?null:{version:r,traceId:l,parentId:c,traceFlags:d,isSampled:(parseInt(d,16)&1)===1}}function Hw(i,n){if(!i||!n||n.length===0)return!1;let r;if(i instanceof URL)r=i;else try{r=new URL(i)}catch{return!1}for(const l of n)try{if(typeof l=="string"){if(qw(r.hostname,l))return!0}else if(l instanceof RegExp){if(l.test(r.hostname))return!0}else if(typeof l=="function"&&l(r))return!0}catch{continue}return!1}function qw(i,n){if(n===i)return!0;if(n.startsWith("*.")){const r=n.slice(2);if(i.endsWith(r)&&(i===r||i.endsWith("."+r)))return!0}return!1}function $w(i){const n=[];try{const r=new URL(i);n.push(r.hostname)}catch{}return n.push("*.supabase.co","*.supabase.in"),n.push("localhost","127.0.0.1","[::1]"),n}function Zs(i){"@babel/helpers - typeof";return Zs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Zs(i)}function Pw(i,n){if(Zs(i)!="object"||!i)return i;var r=i[Symbol.toPrimitive];if(r!==void 0){var l=r.call(i,n);if(Zs(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(i)}function Iw(i){var n=Pw(i,"string");return Zs(n)=="symbol"?n:n+""}function Gw(i,n,r){return(n=Iw(n))in i?Object.defineProperty(i,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):i[n]=r,i}function dp(i,n){var r=Object.keys(i);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(i);n&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(i,c).enumerable})),r.push.apply(r,l)}return r}function et(i){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?dp(Object(r),!0).forEach(function(l){Gw(i,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(r)):dp(Object(r)).forEach(function(l){Object.defineProperty(i,l,Object.getOwnPropertyDescriptor(r,l))})}return i}const Vw=i=>i?(...n)=>i(...n):(...n)=>fetch(...n),Kw=()=>Headers,Yw=(i,n,r,l,c)=>{const d=Vw(l),h=Kw(),m=c?.enabled===!0,g=c?.respectSamplingDecision!==!1,p=m?$w(n):null;return async(S,b)=>{var T;const A=(T=await r())!==null&&T!==void 0?T:i;let C=new h(b?.headers);if(C.has("apikey")||C.set("apikey",i),C.has("Authorization")||C.set("Authorization",`Bearer ${A}`),p){const U=await Jw(S,p,g);U&&(U.traceparent&&!C.has("traceparent")&&C.set("traceparent",U.traceparent),U.tracestate&&!C.has("tracestate")&&C.set("tracestate",U.tracestate),U.baggage&&!C.has("baggage")&&C.set("baggage",U.baggage))}return d(S,et(et({},b),{},{headers:C}))}};async function Jw(i,n,r){if(!Hw(typeof i=="string"||i instanceof URL?i:i.url,n))return null;const l=await zw();if(!l||!l.traceparent)return null;if(r){const c=Bw(l.traceparent);if(c&&!c.isSampled)return null}return l}function hp(i){return typeof i=="boolean"?{enabled:i}:i}function Xw(i){return i.endsWith("/")?i:i+"/"}function Qw(i,n){var r,l,c,d,h,m;const{db:g,auth:p,realtime:S,global:b}=i,{db:T,auth:A,realtime:C,global:U}=n,$=hp(i.tracePropagation),P=hp(n.tracePropagation),q={db:et(et({},T),g),auth:et(et({},A),p),realtime:et(et({},C),S),storage:{},global:et(et(et({},U),b),{},{headers:et(et({},(r=U?.headers)!==null&&r!==void 0?r:{}),(l=b?.headers)!==null&&l!==void 0?l:{})}),tracePropagation:{enabled:(c=(d=$?.enabled)!==null&&d!==void 0?d:P?.enabled)!==null&&c!==void 0?c:!1,respectSamplingDecision:(h=(m=$?.respectSamplingDecision)!==null&&m!==void 0?m:P?.respectSamplingDecision)!==null&&h!==void 0?h:!0},accessToken:async()=>""};return i.accessToken?q.accessToken=i.accessToken:delete q.accessToken,q}function Ww(i){const n=i?.trim();if(!n)throw new Error("supabaseUrl is required.");if(!n.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(Xw(n))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var Zw=class extends Aw{constructor(i){super(i)}},Fw=class{constructor(i,n,r){var l,c;this.supabaseUrl=i,this.supabaseKey=n;const d=Ww(i);if(!n)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",d),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",d),this.storageUrl=new URL("storage/v1",d),this.functionsUrl=new URL("functions/v1",d);const h=`sb-${d.hostname.split(".")[0]}-auth-token`,m={db:Rw,realtime:Nw,auth:et(et({},jw),{},{storageKey:h}),global:Ow,tracePropagation:Lw},g=Qw(r??{},m);if(this.settings=g,this.storageKey=(l=g.auth.storageKey)!==null&&l!==void 0?l:"",this.headers=(c=g.global.headers)!==null&&c!==void 0?c:{},g.accessToken)this.accessToken=g.accessToken,this.auth=new Proxy({},{get:(S,b)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(b)} is not possible`)}});else{var p;this.auth=this._initSupabaseAuthClient((p=g.auth)!==null&&p!==void 0?p:{},this.headers,g.global.fetch)}this.fetch=Yw(n,i,this._getAccessToken.bind(this),g.global.fetch,g.tracePropagation),this.realtime=this._initRealtimeClient(et({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},g.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(S=>this.realtime.setAuth(S)).catch(S=>console.warn("Failed to set initial Realtime auth token:",S)),this.rest=new ob(new URL("rest/v1",d).href,{headers:this.headers,schema:g.db.schema,fetch:this.fetch,timeout:g.db.timeout,urlLengthLimit:g.db.urlLengthLimit}),this.storage=new AS(this.storageUrl.href,this.headers,this.fetch,r?.storage),g.accessToken||this._listenForAuthEvents()}get functions(){return new F0(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(i){return this.rest.from(i)}schema(i){return this.rest.schema(i)}rpc(i,n={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(i,n,r)}channel(i,n={config:{}}){return this.realtime.channel(i,n)}getChannels(){return this.realtime.getChannels()}removeChannel(i){return this.realtime.removeChannel(i)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var i=this,n,r;if(i.accessToken)return await i.accessToken();const{data:l}=await i.auth.getSession();return(n=(r=l.session)===null||r===void 0?void 0:r.access_token)!==null&&n!==void 0?n:i.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:i,persistSession:n,detectSessionInUrl:r,storage:l,userStorage:c,storageKey:d,flowType:h,lock:m,debug:g,throwOnError:p,experimental:S,lockAcquireTimeout:b,skipAutoInitialize:T},A,C){const U={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Zw({url:this.authUrl.href,headers:et(et({},U),A),storageKey:d,autoRefreshToken:i,persistSession:n,detectSessionInUrl:r,storage:l,userStorage:c,flowType:h,lock:m,debug:g,throwOnError:p,experimental:S,fetch:C,lockAcquireTimeout:b,skipAutoInitialize:T,hasCustomAuthorizationHeader:Object.keys(this.headers).some($=>$.toLowerCase()==="authorization")})}_initRealtimeClient(i){return new Qb(this.realtimeUrl.href,et(et({},i),{},{params:et(et({},{apikey:this.supabaseKey}),i?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((i,n)=>{this._handleTokenChanged(i,"CLIENT",n?.access_token)})}_handleTokenChanged(i,n,r){(i==="TOKEN_REFRESHED"||i==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):i==="SIGNED_OUT"&&(this.realtime.setAuth(),n=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const e_=(i,n,r)=>new Fw(i,n,r);function t_(){if(typeof window<"u")return!1;const i=globalThis.process;if(!i)return!1;const n=i.version;if(n==null)return!1;const r=n.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=20:!1}t_()&&console.warn("⚠️ Node.js 20 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 22 or later. For more information, visit: https://github.com/orgs/supabase/discussions/45715");const n_="https://otbyfkjxrkngvjziawki.supabase.co",a_="sb_publishable_NpUs0RDJH2YnllsqTKO6TQ_1jTdSsNQ",Nn=e_(n_,a_,{auth:{autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"pkce",storageKey:"livedesk.mindexec.supabase.auth"}}),yd=new WeakMap;function i_(i){return String(i.frameMode||i.mode||"").toLowerCase()==="mode2-lz4"||String(i.compression||"").toLowerCase()==="lz4"||String(i.mimeType||"").toLowerCase()==="application/vnd.livedesk.lz4-raw"}function r_(i){return String(i.frameMode||i.mode||"").toLowerCase()==="mode3-h264-hw"||String(i.codec||"").toLowerCase()==="h264"||String(i.mimeType||"").toLowerCase()==="video/h264"}function fp(i,n,r){let l=r,c=n;if(l===15){let d=255;for(;d===255;){if(c>=i.length)throw new Error("Invalid LZ4 block: length overrun.");d=i[c],c+=1,l+=d}}return{length:l,cursor:c}}function s_(i,n){const r=new Uint8Array(n);let l=0,c=0;for(;l<i.length;){const d=i[l];l+=1;const h=fp(i,l,d>>4);l=h.cursor;const m=h.length;if(l+m>i.length||c+m>r.length)throw new Error("Invalid LZ4 block: literal overrun.");if(r.set(i.subarray(l,l+m),c),l+=m,c+=m,l>=i.length)break;if(l+2>i.length)throw new Error("Invalid LZ4 block: missing offset.");const g=i[l]|i[l+1]<<8;if(l+=2,g<=0||g>c)throw new Error("Invalid LZ4 block: bad match offset.");const p=fp(i,l,d&15);l=p.cursor;const S=p.length+4;if(c+S>r.length)throw new Error("Invalid LZ4 block: match overrun.");let b=c-g;for(let T=0;T<S;T+=1)r[c]=r[b],c+=1,b+=1}if(c!==r.length)throw new Error("Invalid LZ4 block: incomplete output.");return r}function l_(i){const n=Math.max(1,Math.floor(i.width||0)),r=Math.max(1,Math.floor(i.height||0)),l=Math.max(1,Math.floor(i.bytesPerPixel||4)),c=Math.max(n*r*l,Math.floor(i.uncompressedByteLength||0)),d=s_(new Uint8Array(i.payload),c),h=String(i.pixelFormat||i.codec||"").toLowerCase();if(l!==4)throw new Error(`Unsupported mode2 pixel size: ${l}`);const m=new Uint8ClampedArray(n*r*4);if(h==="rgba32"||h==="rgba")m.set(d.subarray(0,m.length));else for(let g=0,p=0;p<m.length;g+=4,p+=4)m[p]=d[g+2],m[p+1]=d[g+1],m[p+2]=d[g],m[p+3]=d[g+3];return new ImageData(m,n,r)}function o_(i){const n=window.VideoDecoder;if(!n||!window.EncodedVideoChunk)throw new Error("WebCodecs H.264 decode is not supported in this browser.");const r=yd.get(i);if(r&&r.decoder.state!=="closed")return r;const c={decoder:new n({output:d=>{try{const h=d.displayWidth||d.codedWidth||i.width||960,m=d.displayHeight||d.codedHeight||i.height||540;(i.width!==h||i.height!==m)&&(i.width=h,i.height=m),i.getContext("2d")?.drawImage(d,0,0,h,m)}finally{d.close()}},error:()=>{yd.delete(i)}}),configured:!1,keyFrameSeen:!1};return yd.set(i,c),c}function c_(i,n){const r=o_(i);if(!r.configured){const d={codec:"avc1.42E01E",codedWidth:Math.max(1,Math.floor(n.width||960)),codedHeight:Math.max(1,Math.floor(n.height||540)),hardwareAcceleration:"prefer-hardware",optimizeForLatency:!0,avc:{format:String(n.h264Format||"").toLowerCase()==="avc"?"avc":"annexb"}};r.decoder.configure(d),r.configured=!0}const l=n.isKeyFrame===!0||String(n.chunkType||"").toLowerCase()==="key";if(!l&&!r.keyFrameSeen)return;l&&(r.keyFrameSeen=!0);const c=new EncodedVideoChunk({type:l?"key":"delta",timestamp:Math.max(0,Math.floor(n.timestampUs||n.frameSeq*1e3)),duration:Math.max(0,Math.floor(n.durationUs||0))||void 0,data:n.payload});r.decoder.decode(c)}async function u_(i,n,r){if(r_(n)){r()||c_(i,n);return}if(i_(n)){const g=l_(n);if(r())return;(i.width!==g.width||i.height!==g.height)&&(i.width=g.width,i.height=g.height),i.getContext("2d")?.putImageData(g,0,0);return}const l=new Blob([n.payload],{type:n.mimeType}),c=await createImageBitmap(l);if(r()){c.close();return}const d=n.width||c.width||960,h=n.height||c.height||540;(i.width!==d||i.height!==h)&&(i.width=d,i.height=h);const m=i.getContext("2d");m&&(m.clearRect(0,0,d,h),m.drawImage(c,0,0,d,h)),c.close()}const $s=5179,jt=el(`http://127.0.0.1:${$s}`);function d_(i){const n=i.split(".").map(r=>Number(r));return n.length===4&&n.every(r=>Number.isInteger(r)&&r>=0&&r<=255)?n:[]}function h_(i){const n=i.trim().toLowerCase();return n==="localhost"||n==="127.0.0.1"||n==="::1"||n==="[::1]"}function f_(i){const n=i.trim().toLowerCase();return!n||n==="0.0.0.0"||n==="::"||n==="[::]"}function m_(i){const n=d_(i);return n.length===0?!1:n[0]===10||n[0]===172&&n[1]>=16&&n[1]<=31||n[0]===192&&n[1]===168}function g_(i){return i.includes(":")&&!i.startsWith("[")?`[${i}]`:i}function p_(i){const n=String(i||"").trim();if(!n)return null;const r=/^[a-z][a-z\d+.-]*:\/\//i.test(n)?n:`tcp://${n}`;try{const l=new URL(r),c=l.hostname.replace(/^\[|\]$/g,""),d=Number(l.port);return!c||!Number.isInteger(d)||d<1||d>65535||f_(c)?null:{host:c,port:d}}catch{return null}}function el(i){const n=String(i||"").trim()||`http://127.0.0.1:${$s}`,r=/^[a-z][a-z\d+.-]*:\/\//i.test(n)?n:`http://${n}`;try{const l=new URL(r);return l.port||(l.port=String($s)),l.hash="",l.search="",l.toString().replace(/\/+$/,"")}catch{return`http://127.0.0.1:${$s}`}}function y_(i){const n=p_(i);return n?el(`http://${g_(n.host)}:${$s}`):""}function mp(i){const r=[i?.endpoint,...Array.isArray(i?.endpoint_candidates)?i.endpoint_candidates:[]].map(l=>y_(String(l||""))).filter(Boolean);return[...new Set(r)]}function Ps(i=jt){if(!(typeof window>"u"||window.location.protocol!=="https:"))try{const n=new URL(i);if(n.protocol!=="http:")return;if(h_(n.hostname))return"loopback";if(m_(n.hostname))return"local"}catch{return}}function Hd(i,n=jt){const r=new URL(i,el(n));return r.protocol=r.protocol==="https:"?"wss:":"ws:",r.toString()}async function Sn(i,n,r=jt){const l=el(r),c={...n,headers:{"Content-Type":"application/json",...n?.headers||{}},cache:"no-store"},d=Ps(l);d&&(c.targetAddressSpace=d);let h;try{h=await fetch(`${l}${i}`,c)}catch(m){throw d?new Error("LiveDesk Hub is not reachable at this local network address. If Chrome shows a local network prompt, allow it; otherwise restart the Hub so port 5179 is open on the network."):m}if(!h.ok)throw new Error(`${h.status} ${h.statusText}`);return await h.json()}function v_(i){if(!i)return"-";const n=Date.now()-Date.parse(i);return Number.isFinite(n)?n<1e3?"now":n<6e4?`${Math.round(n/1e3)}s`:n<36e5?`${Math.round(n/6e4)}m`:`${Math.round(n/36e5)}h`:"-"}async function Ns(i){await navigator.clipboard.writeText(i)}const gp="livedesk_remote_host_targets",b_="livedesk_entitlements";function S_(i){const r=(Array.isArray(i)?i:[i||jt]).map(l=>el(l||jt));return[...new Set(r.filter(Boolean))]}function w_(){const[i,n]=I.useState(null),[r,l]=I.useState(!0);return I.useEffect(()=>{let c=!0;Nn.auth.getSession().then(({data:h})=>{c&&(n(h.session??null),l(!1))});const{data:{subscription:d}}=Nn.auth.onAuthStateChange((h,m)=>{n(m),l(!1)});return()=>{c=!1,d.unsubscribe()}},[]),{session:i,loading:r}}function __(i,n=!0){const[r,l]=I.useState(null),[c,d]=I.useState([]),[h,m]=I.useState(""),[g,p]=I.useState(""),[S,b]=I.useState(0),T=Array.isArray(i)?i.join(`
38
- `):String(i||""),A=I.useMemo(()=>S_(i),[T]),C=I.useMemo(()=>A.find(P=>Ps(P)==="loopback")||A[0]||jt,[A]),U=I.useCallback(async()=>{if(!n){l(null),d([]),p(""),m("");return}let P=null;for(const q of A)try{const[N,Y]=await Promise.all([Sn("/api/remote/status",void 0,q),Sn("/api/remote/devices",void 0,q)]);l(N),d(Y.devices||[]),p(q),m("");return}catch(N){P=N}throw p(""),P||new Error("No LiveDesk Hub endpoint is reachable.")},[n,A]),$=I.useCallback(()=>{U().catch(P=>{m(P instanceof Error?P.message:String(P))}),b(P=>P+1)},[U]);return I.useEffect(()=>{if(!n){l(null),d([]),p(""),m("");return}let P=!0;const q=async()=>{try{await U()}catch(Y){P&&m(Y instanceof Error?Y.message:String(Y))}};q();const N=window.setInterval(q,2500);return()=>{P=!1,window.clearInterval(N)}},[n,U,S]),{status:r,devices:c,error:h,refresh:$,hubBaseUrl:g||C,hubCandidates:A}}function T_(i){const[n,r]=I.useState(null),[l,c]=I.useState(""),d=i?.user?.id||"",h=I.useCallback(async()=>{if(!d){r(null);return}const{data:m,error:g}=await Nn.from(gp).select("*").eq("user_id",d).maybeSingle();if(g){c(g.message);return}r(m),c("")},[d]);return I.useEffect(()=>{h()},[h]),I.useEffect(()=>{if(!d)return;const m=Nn.channel(`livedesk-remote-host-targets-${d.replace(/[^a-zA-Z0-9]/g,"")}`).on("postgres_changes",{event:"*",schema:"public",table:gp,filter:`user_id=eq.${d}`},g=>r(g.new)).subscribe();return()=>{Nn.removeChannel(m)}},[d]),{target:n,error:l,refresh:h}}function k_(i){const[n,r]=I.useState(null),[l,c]=I.useState(!1),[d,h]=I.useState(""),m=i?.user?.id||"",g=I.useCallback(async()=>{if(!m){r(null),h(""),c(!1);return}c(!0);const{data:S,error:b}=await Nn.from(b_).select("*").eq("user_id",m).eq("product_key","livedesk").maybeSingle();if(b){h(b.message),c(!1);return}r(S),h(""),c(!1)},[m]);I.useEffect(()=>{g()},[g]);const p=I.useMemo(()=>!n||n.status!=="active"?!1:n.expires_at?new Date(n.expires_at).getTime()>Date.now():!0,[n]);return{entitlement:n,licensed:p,loading:l,error:d,refresh:g}}function E_(i,n,r=jt,l={}){const[c,d]=I.useState(new Map),[h,m]=I.useState("idle"),g=I.useMemo(()=>[...i].sort().join(","),[i]),p=Number.isFinite(l.fps)?Number(l.fps):2,S=Number.isFinite(l.maxWidth)?Number(l.maxWidth):640,b=Number.isFinite(l.maxHeight)?Number(l.maxHeight):360,T=Number.isFinite(l.quality)?Number(l.quality):45,A=String(l.frameMode||l.mode||"mode3-h264-hw").trim()||"mode3-h264-hw",C=I.useMemo(()=>{const U=Object.entries(l.monitorSelections||{}).filter(([$])=>!!$).sort(([$],[P])=>$.localeCompare(P));return JSON.stringify(Object.fromEntries(U))},[l.monitorSelections]);return I.useEffect(()=>{const U=g?g.split(",").filter(Boolean):[];if(U.length===0){m("idle"),d(new Map);return}const $=new WebSocket(Hd(`/api/remote/frames/ws?devices=${encodeURIComponent(U.join(","))}`,r));return $.binaryType="arraybuffer",m("connecting"),$.addEventListener("open",()=>{m("open"),$.send(JSON.stringify({type:"subscribe",deviceIds:U,autoStartLive:n,fps:p,maxWidth:S,maxHeight:b,quality:T,mode:A,frameMode:A,monitorSelections:l.monitorSelections||{}}))}),$.addEventListener("message",P=>{if(typeof P.data=="string")return;const q=P.data instanceof ArrayBuffer?P.data:null;if(!q||q.byteLength<5)return;const Y=new DataView(q).getUint32(0,!1);if(Y<=0||Y+4>q.byteLength)return;const ue=new Uint8Array(q.slice(4,4+Y)),G=JSON.parse(new TextDecoder().decode(ue)),Q=q.slice(4+Y),Se={deviceId:String(G.deviceId||""),kind:G.kind==="thumbnail"?"thumbnail":"live",frameSeq:Number(G.frameSeq||0),streamId:String(G.streamId||""),width:Number(G.width||0),height:Number(G.height||0),mimeType:String(G.mimeType||"image/jpeg"),mode:G.mode?String(G.mode):void 0,frameMode:G.frameMode?String(G.frameMode):void 0,frameProfile:G.frameProfile?String(G.frameProfile):void 0,encoding:G.encoding?String(G.encoding):void 0,codec:G.codec?String(G.codec):void 0,compression:G.compression?String(G.compression):void 0,pixelFormat:G.pixelFormat?String(G.pixelFormat):void 0,bytesPerPixel:Number(G.bytesPerPixel||0)||0,uncompressedByteLength:Number(G.uncompressedByteLength||0)||0,h264Format:G.h264Format?String(G.h264Format):void 0,isKeyFrame:G.isKeyFrame===!0,chunkType:G.chunkType?String(G.chunkType):void 0,timestampUs:Number(G.timestampUs||0)||0,durationUs:Number(G.durationUs||0)||0,hardwareEncoder:G.hardwareEncoder?String(G.hardwareEncoder):void 0,platformProfile:G.platformProfile?String(G.platformProfile):void 0,monitorIndex:Number.isFinite(Number(G.monitorIndex))?Number(G.monitorIndex):void 0,monitorCount:Number.isFinite(Number(G.monitorCount))?Number(G.monitorCount):void 0,capturedAt:String(G.capturedAt||""),receivedAt:String(G.receivedAt||""),byteLength:Number(G.byteLength||Q.byteLength),contentHash:G.contentHash?String(G.contentHash):void 0,payload:Q};Se.deviceId&&d(we=>{const Nt=we.get(Se.deviceId);if(Nt&&Nt.frameSeq>Se.frameSeq)return we;const We=new Map(we);return We.set(Se.deviceId,Se),We})}),$.addEventListener("error",()=>m("error")),$.addEventListener("close",()=>m("closed")),()=>{$.close()}},[n,g,p,A,r,b,S,C,l.monitorSelections,T]),{frames:c,state:h}}function A_(i,n=jt){const r=I.useRef(null),[l,c]=I.useState("idle");I.useEffect(()=>{if(!i){r.current?.close(),r.current=null,c("idle");return}const h=new WebSocket(Hd("/api/remote/input/ws",n));return r.current=h,c("connecting"),h.addEventListener("open",()=>c("open")),h.addEventListener("close",()=>c("closed")),h.addEventListener("error",()=>c("error")),()=>{h.close(),r.current===h&&(r.current=null)}},[i,n]);const d=I.useCallback((h,m)=>{const g=r.current;return!g||g.readyState!==WebSocket.OPEN||!h?!1:(g.send(JSON.stringify({type:"input",requestId:crypto.randomUUID(),deviceId:h,input:{...m,issuedAt:new Date().toISOString()}})),!0)},[]);return{state:l,sendInput:d}}function x_(i){const n=String(i||"").toLowerCase();return n.includes("audio/pcm")||n.includes("audio/l16")||n.includes("f32le")||n.includes("s16le")}function C_(i,n,r){const l=Math.max(1,Math.min(8,Math.floor(n.channels||2))),c=Math.max(8e3,Math.min(192e3,Math.floor(n.sampleRate||48e3))),d=String(n.mimeType||"").toLowerCase(),h=d.includes("s16le")||d.includes("audio/l16"),m=h?2:4,g=Math.floor(r.byteLength/m),p=Math.floor(g/l),S=i.createBuffer(l,p,c),b=new DataView(r);for(let T=0;T<l;T+=1){const A=S.getChannelData(T);for(let C=0;C<p;C+=1){const $=(C*l+T)*m;A[C]=h?Math.max(-1,Math.min(1,b.getInt16($,!0)/32768)):Math.max(-1,Math.min(1,b.getFloat32($,!0)))}}return S}function O_(i,n,r=jt){const l=I.useRef(null),c=I.useRef(0),[d,h]=I.useState("idle"),[m,g]=I.useState(null),[p,S]=I.useState("");return I.useEffect(()=>{if(!n||!i){h("idle"),g(null),S("");return}const b=window.AudioContext||window.webkitAudioContext;if(!b){h("unsupported"),S("Audio playback is not supported in this browser.");return}const T=new b;l.current=T,c.current=T.currentTime;const A=new WebSocket(Hd(`/api/remote/audio/ws?devices=${encodeURIComponent(i)}`,r));A.binaryType="arraybuffer";let C=!1;return h("connecting"),S(""),A.addEventListener("open",()=>{C||(h("open"),A.send(JSON.stringify({type:"subscribe",deviceIds:[i]})),T.resume())}),A.addEventListener("message",U=>{if(typeof U.data=="string")return;const $=U.data instanceof ArrayBuffer?U.data:null;!$||$.byteLength<5||(async()=>{try{const q=new DataView($).getUint32(0,!1);if(q<=0||q+4>$.byteLength)return;const N=new Uint8Array($.slice(4,4+q)),Y=JSON.parse(new TextDecoder().decode(N)),ue=$.slice(4+q),G={deviceId:String(Y.deviceId||""),frameSeq:Number(Y.frameSeq||0),streamId:String(Y.streamId||""),mimeType:String(Y.mimeType||"audio/webm;codecs=opus"),sampleRate:Number(Y.sampleRate||48e3),channels:Number(Y.channels||2),capturedAt:String(Y.capturedAt||""),receivedAt:String(Y.receivedAt||""),byteLength:Number(Y.byteLength||ue.byteLength),payload:ue};if(!G.deviceId||C)return;const Q=x_(G.mimeType)?C_(T,G,ue):await T.decodeAudioData(ue.slice(0));if(C)return;const Se=T.createBufferSource();Se.buffer=Q,Se.connect(T.destination);const we=Math.max(T.currentTime+.02,c.current);Se.start(we),c.current=we+Q.duration,g(G),h("playing")}catch(P){C||(h("error"),S(P instanceof Error?P.message:String(P)))}})()}),A.addEventListener("error",()=>{C||h("error")}),A.addEventListener("close",()=>{C||h("closed")}),()=>{C=!0,A.close(),T.close().catch(()=>{}),l.current===T&&(l.current=null)}},[i,n,r]),{state:d,lastFrame:m,error:p}}const R_=120,j_=999,fr=4,Yp="livedesk.remoteDirectory",Md="livedesk.localHubAccessEnabled",Jp="livedesk.streamSettings",N_=24*1024*1024,_n={frameMode:"mode3-h264-hw",fps:12,maxWidth:960,maxHeight:540,quality:60,autoStartLive:!0,showScreenStatus:!0},Lo=[{id:"mode3-h264-hw",label:"Mode 3",detail:"H.264 hardware"},{id:"mode2-lz4",label:"Mode 2",detail:"LZ4 raw"},{id:"mode1-jpeg",label:"Mode 1",detail:"JPEG test"}],vd=[{id:"640x360",label:"Compact",width:640,height:360},{id:"960x540",label:"Standard",width:960,height:540},{id:"1280x720",label:"HD",width:1280,height:720}],L_=[2,5,8,12,20,24],D_=[45,60,75,90];function Is(i,n){const r=i.capabilities?.[n];return typeof r=="boolean"?r:/^(1|true|yes|on)$/i.test(String(r||"").trim())}function Gs(i){return i.deviceName||i.hostname||i.deviceId}function U_(){return"npx -y livedesk client"}function M_(){return"npx -y livedesk"}function z_(){try{return localStorage.getItem(Yp)||""}catch{return""}}function B_(){try{return localStorage.getItem(Md)==="1"}catch{return!1}}function mr(i){try{i?localStorage.setItem(Md,"1"):localStorage.removeItem(Md)}catch{}}function kr(i,n,r,l){const c=Number(i);return Number.isFinite(c)?Math.max(n,Math.min(r,Math.round(c))):l}function Xp(i){const n=String(i||"").trim();return Lo.some(r=>r.id===n)?n:_n.frameMode}function bd(i){return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}function bi(i){const n=bd(i.status),r=bd(n.screens),l=bd(i.capabilities),c=[n.monitorCount,n.screenCount,r.count,l.monitorCount,l.screenCount];for(const d of c){const h=Number(d);if(Number.isFinite(h)&&h>0)return Math.max(1,Math.min(64,Math.floor(h)))}return 1}function wr(i,n){const r=Math.max(1,Math.min(64,Math.floor(Number(n)||1))),l=Math.floor(Number(i));return Number.isFinite(l)?Math.max(0,Math.min(r-1,l)):0}function H_(){try{const i=JSON.parse(localStorage.getItem(Jp)||"{}"),n=kr(i.maxWidth,320,2560,_n.maxWidth),r=kr(i.maxHeight,180,1440,_n.maxHeight);return{frameMode:Xp(i.frameMode),fps:kr(i.fps,1,24,_n.fps),maxWidth:n,maxHeight:r,quality:kr(i.quality,20,95,_n.quality),autoStartLive:typeof i.autoStartLive=="boolean"?i.autoStartLive:_n.autoStartLive,showScreenStatus:typeof i.showScreenStatus=="boolean"?i.showScreenStatus:_n.showScreenStatus}}catch{return _n}}function q_(i){try{localStorage.setItem(Jp,JSON.stringify(i))}catch{}}function pp(i,n){return i.length!==n.length?!1:i.every((r,l)=>r===n[l])}function _i(i){if(!Number.isFinite(i)||i<=0)return"0 B";const n=["B","KB","MB","GB","TB"];let r=i,l=0;for(;r>=1024&&l<n.length-1;)r/=1024,l+=1;const c=l===0||r>=100?0:1;return`${r.toFixed(c)} ${n[l]}`}function $_(i){const n=new Uint8Array(i),r=32768;let l="";for(let c=0;c<n.length;c+=r){const d=n.subarray(c,c+r);l+=String.fromCharCode(...d)}return btoa(l)}function P_(i){return i===1?"middle":i===2?"right":"left"}function yp(i,...n){for(const r of n){const l=i?.[r];if(typeof l=="string"&&l.trim())return l.trim()}return""}function Ls(i){const n=Number(i);return Number.isInteger(n)&&n>=1&&n<=j_?n:0}const I_={cpu:"CPU",memory:"MEM",disk:"Disk",gpu:"GPU",npu:"NPU",temp:"Temp",network:"Net"};function G_(i,n,r){if(i==="online")return"Online";if(i==="busy")return"Busy";if(i==="stale")return"Stale";if(i==="offline")return"Offline";if(r==="failed")return"Task failed";const l=i==="critical"?"critical":"warn",c=n.find(h=>h.state===l)||n.find(h=>h.state==="critical"||h.state==="warn");if(!c)return i==="critical"?"Issue":"Check";const d=I_[c.id]||c.label;return c.value&&c.value!=="-"?`${d} ${c.value}`:d}function Ko(i,n){const r=n.split(".");let l=i;for(const c of r){if(l==null)return;if(Array.isArray(l)){const d=Number(c);l=Number.isInteger(d)?l[d]:void 0;continue}if(typeof l=="object"){l=l[c];continue}return}return l}function Qe(i,...n){for(const r of n){const l=Ko(i,r),c=Number(l);if(Number.isFinite(c))return c}}function Gt(i,...n){for(const r of n){const l=Ko(i,r);if(typeof l=="string"&&l.trim())return l.trim();if(typeof l=="number"&&Number.isFinite(l))return String(l)}return""}function V_(i,...n){for(const r of n){const l=Ko(i,r);if(typeof l=="boolean")return l;if(/^(1|true|yes|on|online|running|ready)$/i.test(String(l||"").trim()))return!0;if(/^(0|false|no|off|offline|stopped|missing)$/i.test(String(l||"").trim()))return!1}}function da(i){const n=Number(i);if(Number.isFinite(n))return Math.max(0,Math.min(1,n>1?n/100:n))}function Sd(i,n){if(!(typeof i!="number"||typeof n!="number"||!Number.isFinite(i)||!Number.isFinite(n)||i<=0))return da((i-Math.max(0,n))/i)}function Ds(i){return i===void 0?"-":`${Math.round(i*100)}%`}function wd(i){return i===void 0||!Number.isFinite(i)?"":i>=1e3?`${(i/1e3).toFixed(i>=1e4?0:1)}Gb/s`:`${Math.round(i)}Mb/s`}function gr(i,n=.92,r=.78){return i===void 0?"unknown":i>=n?"critical":i>=r?"warn":"good"}function Qp(i){return!Number.isFinite(i)||!i||i<=0?"-":i<3600?`${Math.round(i/60)}m`:i<86400?`${Math.round(i/3600)}h`:`${Math.round(i/86400)}d`}function jo(i,n,r){const l=Ko(i,`tools.${n}`),c=Gt(i,`tools.${n}.status`,`tooling.${n}.status`,`${n}.status`).toLowerCase(),d=V_(i,`tools.${n}.running`,`tooling.${n}.running`,`${n}.running`),h=Gt(i,`tools.${n}.version`,`tooling.${n}.version`,`${n}.version`),m=Gt(i,`tools.${n}.port`,`tooling.${n}.port`,`${n}.port`);let g="unknown";return c==="busy"?g="busy":["online","running","ready","active"].includes(c)||d===!0?g="online":(["offline","stopped","missing","not-found"].includes(c)||d===!1||l===!1)&&(g="offline"),{id:n,label:r,status:g,detail:g==="offline"?"offline":h||(m?`:${m}`:g==="unknown"?"not reported":g)}}function Wp(i){const n=i.status||{},r=Qe(n,"cpu.cores","cpuCores","processorCount"),l=Qe(n,"loadavg.0","cpu.load1"),c=da(Qe(n,"cpu.usedRatio","cpu.usageRatio","cpu.ratio","cpu.usedPct","cpu.usagePct","cpu.percent")??(r&&l!==void 0?l/Math.max(1,r):void 0)),d=Qe(n,"memory.totalBytes","totalMem"),h=Qe(n,"memory.freeBytes","freeMem"),m=da(Qe(n,"memory.usedRatio","memory.usedPct","usedMemRatio"))??Sd(d,h),g=Qe(n,"disk.totalBytes","rootDisk.totalBytes","storage.totalBytes"),p=Qe(n,"disk.freeBytes","rootDisk.freeBytes","storage.freeBytes"),S=da(Qe(n,"disk.usedRatio","disk.usedPct","rootDisk.usedRatio","storage.usedRatio"))??Sd(g,p),b=Qe(n,"thermal.cpuC","temperatureC","cpu.temperatureC","gpu.temperatureC"),T=da(Qe(n,"gpu.usedRatio","gpu.usageRatio","gpu.usedPct","gpu.usagePct","gpu.percent","accelerators.gpu.usageRatio")),A=Gt(n,"gpu.name","gpu.model","accelerators.gpu.name"),C=Qe(n,"gpu.memory.totalBytes","gpu.totalMemoryBytes","gpu.vramTotalBytes"),U=Qe(n,"gpu.memory.freeBytes","gpu.freeMemoryBytes","gpu.vramFreeBytes"),$=da(Qe(n,"gpu.memory.usedRatio","gpu.vramUsedRatio"))??Sd(C,U),P=Qe(n,"gpu.temperatureC","thermal.gpuC"),q=da(Qe(n,"npu.usedRatio","npu.usageRatio","npu.usedPct","npu.usagePct","npu.percent","accelerators.npu.usageRatio")),N=Gt(n,"npu.name","npu.model","accelerators.npu.name"),Y=Qe(n,"npu.tops","npu.topsInt8","accelerators.npu.tops"),ue=Qe(n,"network.rxMbps","network.receiveMbps","network.downMbps"),G=Qe(n,"network.txMbps","network.transmitMbps","network.upMbps"),Q=Qe(n,"network.latencyMs","network.rttMs"),Se=da(Qe(n,"network.usedRatio","network.usageRatio","network.saturationRatio")),we=Gt(n,"network.link","network.interface","network.name"),Nt=b===void 0?void 0:da((b-35)/60),We=Gt(n,"workload.role","role","lane")||(Is(i,"aiAssist")?"Agent worker":Is(i,"taskDispatch")?"Task worker":"Local machine"),Le=Gt(i.latestTask,"status")||Gt(n,"workload.status")||"idle",mt=Gt(i.latestTask,"title","instructionPreview")||Gt(n,"workload.title"),pt=Gt(i.latestTask,"resultSummary","error","instructionPreview")||Gt(n,"workload.summary"),Ge=[jo(n,"ollama","Ollama"),jo(n,"lmStudio","LM Studio"),jo(n,"comfyui","ComfyUI"),jo(n,"stableDiffusion","Stable Diffusion")],D=Ge.some(M=>M.status!=="unknown"),K=Date.parse(i.lastSeenAt||i.connectedAt||""),ae=Number.isFinite(K)?Date.now()-K:0;let te="online";i.connected?ae>5*6e4?te="stale":(b??0)>=86||(P??0)>=88||(c??0)>=.94||(T??0)>=.96||(q??0)>=.96||(m??0)>=.94||(S??0)>=.94||(Q??0)>=200||Le==="failed"?te="critical":(b??0)>=78||(P??0)>=80||(c??0)>=.82||(T??0)>=.86||(q??0)>=.86||(m??0)>=.82||(S??0)>=.86||(Q??0)>=80?te="warn":(["queued","running","targeted"].includes(Le)||Ge.some(M=>M.status==="busy"))&&(te="busy"):te="offline";const Ee=Ge.filter(M=>M.status==="online"||M.status==="busy").length,E=[{id:"cpu",label:"CPU",value:Ds(c),detail:r?`${r} cores`:l!==void 0?`load ${l.toFixed(1)}`:"not reported",ratio:c,state:gr(c,.92,.78)},{id:"memory",label:"RAM",value:Ds(m),detail:d?`${_i(d-(h||0))} / ${_i(d)}`:"not reported",ratio:m,state:gr(m,.92,.78)},{id:"disk",label:"DISK",value:Ds(S),detail:g&&p!==void 0?`${_i(p)} free`:"not reported",ratio:S,state:gr(S,.92,.82)},{id:"gpu",label:"GPU",value:Ds(T??$),detail:A||(C&&U!==void 0?`${_i(U)} VRAM free`:P!==void 0?`${Math.round(P)}C`:"not reported"),ratio:T??$,state:P!==void 0&&P>=88?"critical":P!==void 0&&P>=80?"warn":gr(T??$,.96,.86)},{id:"npu",label:"NPU",value:q!==void 0?Ds(q):Y!==void 0?`${Math.round(Y)} TOPS`:"-",detail:N||(Y!==void 0?"neural engine":"not reported"),ratio:q,state:gr(q,.96,.86)},{id:"temp",label:"TEMP",value:b===void 0?"-":`${Math.round(b)}C`,detail:Ee>0?`${Ee} local tools`:`uptime ${Qp(Qe(n,"uptimeSec"))}`,ratio:Nt,state:b===void 0?"unknown":b>=86?"critical":b>=78?"warn":"good"},{id:"network",label:"NET",value:wd(ue)||(Q!==void 0?`${Math.round(Q)}ms`:we||"-"),detail:wd(G)?`${wd(G)} up`:we||"not reported",ratio:Se,state:Q!==void 0&&Q>=200?"critical":Q!==void 0&&Q>=80?"warn":gr(Se,.9,.75)}];return{state:te,label:G_(te,E,Le),role:We,taskLabel:mt||(Le==="idle"?"idle":Le),taskStatus:Le,taskSummary:pt,tools:D?Ge:Ge.map(M=>({...M,detail:"not reported"})),metrics:E}}const K_=[{id:"small",label:"Small"},{id:"medium",label:"Medium"},{id:"large",label:"Large"}],Y_=[{id:"wall",label:"Wall",icon:Tp,accent:"blue"},{id:"control",label:"Control",icon:kd,accent:"red"},{id:"agents",label:"Agents",icon:yr,accent:"violet"},{id:"doc",label:"Doc",icon:_d,accent:"amber"},{id:"pricing",label:"Pricing",icon:Td,accent:"green"},{id:"settings",label:"Settings",icon:kp,accent:"gray"}];function st(i){return i.replace(/\bRemoteHub\b/g,"Hub client endpoint").replace(/\bManagers\b/g,"Hubs").replace(/\bManager\b/g,"Hub").replace(/\bmanager\b/g,"Hub").replace(/\bMANAGER\b/g,"HUB").replace(/매니저/g,"Hub")}function pr(i){return i.map(n=>st(n))}function xt(i){return{languageName:i.languageName,languageLabel:i.languageLabel,eyebrow:i.eyebrow,title:st(i.title),intro:st(i.intro),sections:[{title:st(i.managerTitle),body:st(i.managerBody),points:pr(i.managerPoints)},{title:st(i.clientTitle),body:st(i.clientBody),points:pr(i.clientPoints)},{title:st(i.syncTitle),body:st(i.syncBody),points:pr(i.syncPoints)},{title:st(i.platformTitle),body:st(i.platformBody),points:pr(i.platformPoints)}],sync:{title:st(i.syncTitle),body:st(i.syncBody),points:pr(i.syncPoints)},firewall:{title:st(i.firewallTitle),body:st(i.firewallBody),points:pr(i.firewallPoints)},commands:{title:st(i.commandsTitle),body:st(i.commandsBody),manager:st(i.managerCommandLabel),primary:st(i.clientCommandLabel),slot:st(i.slotCommandLabel),manual:st(i.manualCommandLabel)}}}const Ar={ko:xt({languageName:"한국어",languageLabel:"문서 언어",eyebrow:"LiveDesk Manual",title:"한 줄로 여는 로컬 Screen Wall",intro:"LiveDesk는 매니저 PC 한 대에서 여러 작업 PC, AI 박스, 맥미니, 개발 장비를 한 화면에 모니터링하고 필요한 제어를 실행하는 npm-first 원격 작업 데크입니다.",managerTitle:"1. 매니저 실행",managerBody:"화면을 모아 볼 컴퓨터에서 LiveDesk 매니저를 실행합니다. 매니저는 UI와 로컬 서버를 같이 열고 브라우저를 http://127.0.0.1:5179 로 띄웁니다.",managerPoints:["명령은 npx -y livedesk 입니다.","매니저는 Screen Wall/API 포트 5179와 클라이언트 접속 포트 5197을 사용합니다.","기존 LiveDesk 포트가 남아 있으면 기본적으로 정리하고 새로 시작합니다. 필요하면 --no-clean 을 붙입니다."],clientTitle:"2. 워크스테이션 연결",clientBody:"모니터링할 PC에서는 같은 Google 계정으로 로그인합니다. 매니저가 켜져 있지 않아도 클라이언트는 종료하지 않고 5초마다 계속 찾습니다.",clientPoints:["빈 자리에 자동 배치하려면 npx -y livedesk client 를 실행합니다.","자리 번호를 고정하려면 npx -y livedesk client 3 처럼 번호를 붙입니다.","컴퓨터가 많을 때도 다시 로그인하지 않도록 집요하게 재접속을 시도합니다."],syncTitle:"3. Sync Server와 자동 발견",syncBody:"Sync Server는 이 매니저를 현재 계정의 활성 Screen Wall로 Supabase에 등록합니다. 클라이언트는 같은 Google 계정으로 로그인한 뒤 그 기록을 읽고 접속 후보들을 순서대로 시도합니다.",syncPoints:["등록 정보에는 host instance, LAN/private 주소, public 후보 주소, pair token, 짧은 lease가 포함됩니다.","같은 LAN 후보를 먼저 쓰고, 필요하면 외부 주소 후보를 시도합니다.","매니저 위치, VPN, 방화벽, 공유기 설정이 바뀌었거나 개발 중 활성 매니저를 바꿀 때 Sync Server를 누릅니다.","이제 livedesk.pages.dev의 Chrome Local Network Access 허용은 기본 실행 경로가 아닙니다. npm 매니저 앱이 실제 서버입니다."],platformTitle:"4. 현재 플랫폼 상태",platformBody:"Windows는 실제 화면 전송까지 확인되었습니다. macOS와 Linux도 npm 구조로 같은 명령을 목표로 지원을 넓히고 있습니다.",platformPoints:["Windows: 현재 작동 확인.","macOS: manager/client 경로는 준비되어 있으며 화면 캡처와 제어에는 Screen Recording/Accessibility 권한이 필요합니다.","Linux: linux-x64 runtime, grim/gnome-screenshot/import/scrot 캡처, xdotool 입력 백엔드가 추가되었습니다. 오디오는 아직 비활성입니다."],firewallTitle:"방화벽과 외부 장소 연결",firewallBody:"같은 LAN 안에서는 보통 공유기 포트포워딩이 필요 없습니다. 다른 장소의 PC를 붙이려면 클라이언트가 매니저의 클라이언트 접속 포트에 도달할 수 있어야 합니다.",firewallPoints:["클라이언트 접속 포트는 TCP 5197입니다.","클라이언트 쪽은 나가는 연결이므로 보통 인바운드 포트 개방이 필요 없습니다.","다른 네트워크에서 붙일 때는 매니저 PC 방화벽에서 TCP 5197 인바운드를 허용하고, 공유기에서는 TCP 5197을 매니저 PC로 전달합니다.","Screen Wall/API 포트 5179는 매니저 UI용입니다. 외부 브라우저에서 Wall을 직접 열 필요가 있을 때만 별도로 노출을 검토합니다.","공개 인터넷에 바로 열기보다 VPN, Tailscale, ZeroTier, 고정 IP allowlist를 우선합니다."],commandsTitle:"현재 사용 명령",commandsBody:"웹사이트를 찾아가 설치 파일을 받는 방식보다 터미널 한 줄로 모든 운영체제에서 거의 같은 흐름을 쓰는 것이 LiveDesk의 기본 방향입니다.",managerCommandLabel:"매니저 시작",clientCommandLabel:"워크스테이션 연결",slotCommandLabel:"3번 슬롯에 고정",manualCommandLabel:"고급 수동 연결"}),en:xt({languageName:"English",languageLabel:"Document language",eyebrow:"LiveDesk Manual",title:"Open a local Screen Wall with one command",intro:"LiveDesk is an npm-first remote work deck for monitoring many workstations, AI boxes, Mac minis, and dev machines from one manager PC.",managerTitle:"1. Run the manager",managerBody:"Run LiveDesk on the computer that will watch the screens. The manager starts the UI and local server together, then opens http://127.0.0.1:5179.",managerPoints:["The command is npx -y livedesk.","The manager uses port 5179 for the Screen Wall/API and port 5197 for client connections.","If an old LiveDesk process still owns those ports, startup cleans it by default. Add --no-clean when you want to keep it."],clientTitle:"2. Connect a workstation",clientBody:"On each monitored computer, sign in with the same Google account. If no manager is online yet, the client keeps running and retries every 5 seconds.",clientPoints:["Run npx -y livedesk client for first available placement.","Run npx -y livedesk client 3 to pin the machine to slot 3.","Clients keep trying so large workstation stacks do not need repeated sign-in."],syncTitle:"3. Sync Server and discovery",syncBody:"Sync Server publishes this manager as the active Screen Wall for the signed-in account. Clients read that Supabase record after Google sign-in and try the endpoint candidates in order.",syncPoints:["The record includes host instance, LAN/private addresses, public endpoint candidates, pair token, and a short lease.","LAN candidates are preferred first, then public candidates if needed.","Press Sync Server after manager moves, VPN/firewall/router changes, or when this development machine should take over as active manager.","Chrome Local Network Access on livedesk.pages.dev is no longer the default runtime path. The npm manager app is the real server."],platformTitle:"4. Current platform state",platformBody:"Windows has been verified with live screen transfer. macOS and Linux follow the same npm command path as support expands.",platformPoints:["Windows: verified working.","macOS: manager/client paths are prepared; screen capture and control require Screen Recording/Accessibility permissions.","Linux: linux-x64 runtime, grim/gnome-screenshot/import/scrot capture, and xdotool input backend are added. Audio is still disabled."],firewallTitle:"Firewall and remote locations",firewallBody:"On the same LAN, router forwarding is usually unnecessary. For another office, building, or country, clients must be able to reach the manager client port.",firewallPoints:["Client connection port: TCP 5197.","Client machines normally only need outbound access.","For remote networks, allow inbound TCP 5197 on the manager firewall and forward TCP 5197 from the router to the manager PC.","Screen Wall/API port 5179 is for the manager UI. Expose it only if a remote browser must open the Wall directly.","Prefer VPN, Tailscale, ZeroTier, or fixed-IP allowlists over public internet exposure."],commandsTitle:"Current commands",commandsBody:"The product direction is one terminal command across operating systems instead of finding a website, downloading, and installing manually.",managerCommandLabel:"Start manager",clientCommandLabel:"Connect workstation",slotCommandLabel:"Pin to slot 3",manualCommandLabel:"Advanced manual connection"}),ja:xt({languageName:"日本語",languageLabel:"ドキュメント言語",eyebrow:"LiveDesk Manual",title:"1行でローカル Screen Wall を開く",intro:"LiveDesk は、複数の作業 PC、AI マシン、Mac mini、開発機を1台の manager PC から監視する npm-first のリモート作業デッキです。",managerTitle:"1. manager を実行",managerBody:"画面を集めて見るコンピューターで LiveDesk manager を実行します。UI とローカルサーバーが同時に起動し、http://127.0.0.1:5179 が開きます。",managerPoints:["コマンドは npx -y livedesk です。","Screen Wall/API は 5179、client 接続は 5197 を使います。","古い LiveDesk プロセスがポートを使っている場合は、基本的に自動で整理して起動します。"],clientTitle:"2. workstation を接続",clientBody:"監視される PC で同じ Google アカウントにログインします。manager がまだ無くても client は終了せず、5秒ごとに再試行します。",clientPoints:["空きスロットに入れるには npx -y livedesk client を実行します。","スロットを固定するには npx -y livedesk client 3 のように番号を付けます。","大量の PC でも再ログインなしで待ち続けます。"],syncTitle:"3. Sync Server と自動検出",syncBody:"Sync Server はこの manager を現在の Google アカウントの active Screen Wall として Supabase に登録します。",syncPoints:["host instance、LAN/private アドレス、public 候補、pair token、短い lease を登録します。","client は LAN 候補を優先し、必要なら public 候補も試します。","VPN、firewall、router、manager の場所が変わったら Sync Server を押します。","livedesk.pages.dev の Chrome Local Network Access は標準実行経路ではありません。npm manager アプリが実際のサーバーです。"],platformTitle:"4. 現在のプラットフォーム状態",platformBody:"Windows は live screen transfer まで確認済みです。macOS と Linux も同じ npm コマンド経路を目標に対応を広げています。",platformPoints:["Windows: 動作確認済み。","macOS: 画面取得と制御には Screen Recording/Accessibility 権限が必要です。","Linux: linux-x64 runtime、grim/gnome-screenshot/import/scrot capture、xdotool input backend を追加済み。audio は未対応です。"],firewallTitle:"Firewall と外部拠点",firewallBody:"同じ LAN なら通常 router forwarding は不要です。外部拠点では client が manager の接続ポートへ到達できる必要があります。",firewallPoints:["client 接続ポートは TCP 5197 です。","client 側は通常 outbound だけで足ります。","外部 network では manager PC の firewall で TCP 5197 inbound を許可し、router から manager PC へ forward します。","5179 は manager UI 用なので、外部ブラウザで Wall を開く必要がある時だけ公開を検討します。","公開 internet より VPN、Tailscale、ZeroTier、IP allowlist を優先してください。"],commandsTitle:"現在のコマンド",commandsBody:"Web サイトから installer を探すより、OS をまたいで terminal 1行で動かす方向です。",managerCommandLabel:"manager 起動",clientCommandLabel:"workstation 接続",slotCommandLabel:"slot 3 に固定",manualCommandLabel:"高度な手動接続"}),"zh-CN":xt({languageName:"简体中文",languageLabel:"文档语言",eyebrow:"LiveDesk Manual",title:"用一条命令打开本地 Screen Wall",intro:"LiveDesk 是 npm-first 的远程工作台,用一台 manager PC 监控多台工作站、AI 主机、Mac mini 和开发机器。",managerTitle:"1. 运行 manager",managerBody:"在负责查看屏幕的电脑上运行 LiveDesk manager。它会同时启动 UI 和本地服务器,并打开 http://127.0.0.1:5179。",managerPoints:["命令是 npx -y livedesk。","Screen Wall/API 使用 5179,client 连接使用 5197。","如果旧的 LiveDesk 进程占用端口,默认会清理后重新启动。"],clientTitle:"2. 连接 workstation",clientBody:"在被监控的电脑上使用同一个 Google 账号登录。即使 manager 还没在线,client 也会继续运行并每 5 秒重试。",clientPoints:["自动放入空位: npx -y livedesk client。","固定到 3 号位置: npx -y livedesk client 3。","大量电脑也可以持续等待,不需要反复登录。"],syncTitle:"3. Sync Server 和自动发现",syncBody:"Sync Server 会把当前 manager 作为该账号的 active Screen Wall 写入 Supabase。client 登录后读取记录并依次尝试连接候选地址。",syncPoints:["记录包括 host instance、LAN/private 地址、public 候选、pair token 和短 lease。","优先尝试同一 LAN 地址,需要时再尝试外部地址。","manager 位置、VPN、防火墙或路由变化后请点击 Sync Server。","livedesk.pages.dev 的 Chrome Local Network Access 不再是默认运行方式。npm manager app 才是真正服务器。"],platformTitle:"4. 当前平台状态",platformBody:"Windows 已确认可传输实时画面。macOS 和 Linux 正按同一 npm 命令路径扩展支持。",platformPoints:["Windows: 已确认可用。","macOS: 画面捕获和控制需要 Screen Recording/Accessibility 权限。","Linux: 已加入 linux-x64 runtime、grim/gnome-screenshot/import/scrot 捕获、xdotool 输入后端。音频尚未启用。"],firewallTitle:"防火墙和外部地点",firewallBody:"同一 LAN 通常不需要路由端口转发。不同地点连接时,client 必须能访问 manager 的 client 连接端口。",firewallPoints:["client 连接端口是 TCP 5197。","client 机器通常只需要出站访问。","跨网络时,在 manager 防火墙放行 TCP 5197 入站,并在路由器转发到 manager PC。","5179 是 manager UI 端口,仅在需要远程浏览器直接打开 Wall 时考虑暴露。","优先使用 VPN、Tailscale、ZeroTier 或固定 IP allowlist。"],commandsTitle:"当前命令",commandsBody:"产品方向是跨操作系统使用一条终端命令,而不是先找网站、下载、安装。",managerCommandLabel:"启动 manager",clientCommandLabel:"连接 workstation",slotCommandLabel:"固定到 slot 3",manualCommandLabel:"高级手动连接"}),"zh-TW":xt({languageName:"繁體中文",languageLabel:"文件語言",eyebrow:"LiveDesk Manual",title:"用一行指令開啟本機 Screen Wall",intro:"LiveDesk 是 npm-first 的遠端工作台,用一台 manager PC 監看多台工作站、AI 主機、Mac mini 與開發機。",managerTitle:"1. 執行 manager",managerBody:"在負責看畫面的電腦上執行 LiveDesk manager。它會同時啟動 UI 與本機伺服器,並開啟 http://127.0.0.1:5179。",managerPoints:["指令是 npx -y livedesk。","Screen Wall/API 使用 5179,client 連線使用 5197。","若舊的 LiveDesk 程序占用連接埠,預設會清理後重新啟動。"],clientTitle:"2. 連接 workstation",clientBody:"在被監看的電腦上使用同一個 Google 帳號登入。即使 manager 尚未上線,client 也會持續執行並每 5 秒重試。",clientPoints:["自動放入空位: npx -y livedesk client。","固定到 3 號位置: npx -y livedesk client 3。","大量電腦也能持續等待,不需要反覆登入。"],syncTitle:"3. Sync Server 與自動探索",syncBody:"Sync Server 會把目前 manager 登錄為此帳號的 active Screen Wall。client 登入後讀取 Supabase 記錄並依序嘗試連線候選地址。",syncPoints:["記錄包含 host instance、LAN/private 位址、public 候選、pair token 與短 lease。","優先嘗試 LAN 位址,需要時再嘗試外部位址。","manager 位置、VPN、防火牆或路由設定改變後請按 Sync Server。","livedesk.pages.dev 的 Chrome Local Network Access 不再是預設執行路徑。npm manager app 才是真正伺服器。"],platformTitle:"4. 目前平台狀態",platformBody:"Windows 已確認可傳輸即時畫面。macOS 與 Linux 也沿用相同 npm 指令路徑擴充支援。",platformPoints:["Windows: 已確認可用。","macOS: 畫面擷取與控制需要 Screen Recording/Accessibility 權限。","Linux: 已加入 linux-x64 runtime、grim/gnome-screenshot/import/scrot capture、xdotool input backend。音訊尚未啟用。"],firewallTitle:"防火牆與外部地點",firewallBody:"同一 LAN 通常不需要路由器轉發。不同地點連線時,client 必須能到達 manager 的 client 連線埠。",firewallPoints:["client 連線埠是 TCP 5197。","client 電腦通常只需要對外連線。","跨網路時,請在 manager 防火牆允許 TCP 5197 inbound,並從路由器轉發到 manager PC。","5179 是 manager UI 連接埠,只在需要遠端瀏覽器直接打開 Wall 時才考慮公開。","優先使用 VPN、Tailscale、ZeroTier 或固定 IP allowlist。"],commandsTitle:"目前指令",commandsBody:"產品方向是跨作業系統用一行 terminal 指令,而不是先找網站、下載、安裝。",managerCommandLabel:"啟動 manager",clientCommandLabel:"連接 workstation",slotCommandLabel:"固定到 slot 3",manualCommandLabel:"進階手動連線"}),es:xt({languageName:"Español",languageLabel:"Idioma del documento",eyebrow:"LiveDesk Manual",title:"Abre un Screen Wall local con un comando",intro:"LiveDesk es una consola npm-first para vigilar muchas estaciones, cajas de IA, Mac mini y equipos de desarrollo desde un PC manager.",managerTitle:"1. Ejecuta el manager",managerBody:"Ejecuta LiveDesk en el equipo que verá las pantallas. El manager inicia la UI y el servidor local juntos y abre http://127.0.0.1:5179.",managerPoints:["El comando es npx -y livedesk.","El manager usa 5179 para Screen Wall/API y 5197 para conexiones client.","Si un proceso antiguo ocupa los puertos, el arranque lo limpia por defecto."],clientTitle:"2. Conecta una workstation",clientBody:"En cada equipo monitoreado, inicia sesión con la misma cuenta Google. Si el manager aún no está activo, el client sigue intentando cada 5 segundos.",clientPoints:["Usa npx -y livedesk client para el primer slot libre.","Usa npx -y livedesk client 3 para fijar el equipo al slot 3.","Los clients siguen esperando para no repetir login en muchas máquinas."],syncTitle:"3. Sync Server y descubrimiento",syncBody:"Sync Server publica este manager como Screen Wall activo para la cuenta. Los clients leen el registro en Supabase y prueban los endpoints.",syncPoints:["Incluye host instance, direcciones LAN/private, candidatos public, pair token y lease corto.","Primero se prueban candidatos LAN, luego públicos si hace falta.","Pulsa Sync Server después de cambios de manager, VPN, firewall o router.","Chrome Local Network Access en livedesk.pages.dev ya no es el flujo principal. La app npm manager es el servidor real."],platformTitle:"4. Estado de plataformas",platformBody:"Windows ya fue verificado con transferencia de pantalla. macOS y Linux siguen el mismo camino npm.",platformPoints:["Windows: verificado.","macOS: captura y control requieren permisos Screen Recording/Accessibility.","Linux: agregado linux-x64 runtime, captura grim/gnome-screenshot/import/scrot y entrada xdotool. Audio aún desactivado."],firewallTitle:"Firewall y sedes remotas",firewallBody:"En la misma LAN normalmente no hace falta port forwarding. Para otra red, los clients deben llegar al puerto client del manager.",firewallPoints:["Puerto de conexión client: TCP 5197.","Los equipos client normalmente solo necesitan salida.","Para redes remotas, permite TCP 5197 inbound en el manager y reenvía TCP 5197 al PC manager.","El puerto 5179 es para la UI del manager; expónlo solo si un navegador remoto debe abrir el Wall.","Prefiere VPN, Tailscale, ZeroTier o allowlist de IP fijas."],commandsTitle:"Comandos actuales",commandsBody:"La dirección del producto es un comando de terminal común entre sistemas, no descargar e instalar desde una web.",managerCommandLabel:"Iniciar manager",clientCommandLabel:"Conectar workstation",slotCommandLabel:"Fijar al slot 3",manualCommandLabel:"Conexión manual avanzada"}),fr:xt({languageName:"Français",languageLabel:"Langue du document",eyebrow:"LiveDesk Manual",title:"Ouvrir un Screen Wall local en une commande",intro:"LiveDesk est un deck npm-first pour surveiller plusieurs postes, machines IA, Mac mini et machines dev depuis un PC manager.",managerTitle:"1. Lancer le manager",managerBody:"Lancez LiveDesk sur l’ordinateur qui observe les écrans. Le manager démarre l’UI et le serveur local, puis ouvre http://127.0.0.1:5179.",managerPoints:["La commande est npx -y livedesk.","Le manager utilise 5179 pour Screen Wall/API et 5197 pour les connexions client.","Si un ancien processus utilise les ports, le démarrage le nettoie par défaut."],clientTitle:"2. Connecter une workstation",clientBody:"Sur chaque ordinateur surveillé, connectez-vous avec le même compte Google. Si le manager n’est pas encore actif, le client réessaie toutes les 5 secondes.",clientPoints:["Utilisez npx -y livedesk client pour le premier slot libre.","Utilisez npx -y livedesk client 3 pour fixer la machine au slot 3.","Les clients continuent d’attendre pour éviter les reconnexions répétées."],syncTitle:"3. Sync Server et découverte",syncBody:"Sync Server publie ce manager comme Screen Wall actif du compte. Les clients lisent l’enregistrement Supabase et testent les endpoints.",syncPoints:["Il contient host instance, adresses LAN/private, candidats public, pair token et lease court.","Les candidats LAN sont essayés en premier, puis les candidats publics si besoin.","Cliquez Sync Server après un changement de manager, VPN, firewall ou routeur.","Chrome Local Network Access sur livedesk.pages.dev n’est plus le chemin par défaut. L’app npm manager est le vrai serveur."],platformTitle:"4. État des plateformes",platformBody:"Windows est vérifié avec transfert d’écran live. macOS et Linux suivent le même chemin npm.",platformPoints:["Windows: vérifié.","macOS: capture et contrôle nécessitent Screen Recording/Accessibility.","Linux: runtime linux-x64, capture grim/gnome-screenshot/import/scrot et entrée xdotool ajoutés. Audio désactivé."],firewallTitle:"Firewall et sites distants",firewallBody:"Sur le même LAN, le port forwarding est rarement nécessaire. Depuis un autre réseau, les clients doivent atteindre le port client du manager.",firewallPoints:["Port de connexion client: TCP 5197.","Les machines client ont normalement seulement besoin de sortie réseau.","Pour un réseau distant, autorisez TCP 5197 entrant sur le manager et redirigez TCP 5197 vers le PC manager.","Le port 5179 sert à l’UI manager; exposez-le seulement si un navigateur distant doit ouvrir le Wall.","Préférez VPN, Tailscale, ZeroTier ou allowlist IP fixes."],commandsTitle:"Commandes actuelles",commandsBody:"La direction produit est une commande terminal commune aux OS, plutôt qu’un téléchargement manuel depuis un site.",managerCommandLabel:"Démarrer manager",clientCommandLabel:"Connecter workstation",slotCommandLabel:"Fixer au slot 3",manualCommandLabel:"Connexion manuelle avancée"}),de:xt({languageName:"Deutsch",languageLabel:"Dokumentsprache",eyebrow:"LiveDesk Manual",title:"Lokale Screen Wall mit einem Befehl öffnen",intro:"LiveDesk ist ein npm-first Arbeitsdeck, um viele Workstations, AI-Boxen, Mac minis und Dev-Rechner von einem Manager-PC zu überwachen.",managerTitle:"1. Manager starten",managerBody:"Starte LiveDesk auf dem Computer, der die Screens sieht. Der Manager startet UI und lokalen Server zusammen und öffnet http://127.0.0.1:5179.",managerPoints:["Der Befehl ist npx -y livedesk.","Der Manager nutzt 5179 für Screen Wall/API und 5197 für Client-Verbindungen.","Wenn alte LiveDesk-Prozesse Ports belegen, werden sie beim Start standardmäßig bereinigt."],clientTitle:"2. Workstation verbinden",clientBody:"Melde dich auf jedem überwachten Computer mit demselben Google-Konto an. Wenn kein Manager online ist, versucht der Client alle 5 Sekunden weiter.",clientPoints:["npx -y livedesk client nutzt den ersten freien Slot.","npx -y livedesk client 3 fixiert den Rechner auf Slot 3.","Clients warten weiter, damit große Setups kein wiederholtes Login brauchen."],syncTitle:"3. Sync Server und Discovery",syncBody:"Sync Server veröffentlicht diesen Manager als aktive Screen Wall des Kontos. Clients lesen den Supabase-Eintrag und testen Endpoints der Reihe nach.",syncPoints:["Enthält host instance, LAN/private Adressen, public Kandidaten, pair token und kurze lease.","LAN-Kandidaten werden zuerst versucht, danach public Kandidaten.","Nach Änderungen an Manager, VPN, Firewall oder Router Sync Server drücken.","Chrome Local Network Access auf livedesk.pages.dev ist nicht mehr der Standardpfad. Die npm Manager App ist der echte Server."],platformTitle:"4. Plattformstatus",platformBody:"Windows wurde mit Live-Screen-Transfer geprüft. macOS und Linux folgen demselben npm-Pfad.",platformPoints:["Windows: verifiziert.","macOS: Capture und Control brauchen Screen Recording/Accessibility Rechte.","Linux: linux-x64 Runtime, grim/gnome-screenshot/import/scrot Capture und xdotool Input Backend sind ergänzt. Audio ist deaktiviert."],firewallTitle:"Firewall und entfernte Standorte",firewallBody:"Im gleichen LAN ist Router-Forwarding meist unnötig. Aus anderen Netzwerken müssen Clients den Client-Port des Managers erreichen.",firewallPoints:["Client-Verbindungsport: TCP 5197.","Client-Rechner brauchen normalerweise nur ausgehenden Zugriff.","Für entfernte Netzwerke TCP 5197 inbound am Manager erlauben und vom Router zum Manager-PC forwarden.","Port 5179 ist für die Manager-UI; nur öffnen, wenn ein Remote-Browser die Wall direkt öffnen muss.","VPN, Tailscale, ZeroTier oder feste IP-Allowlists bevorzugen."],commandsTitle:"Aktuelle Befehle",commandsBody:"Die Produktlinie ist ein Terminalbefehl über Betriebssysteme hinweg, statt Website suchen, herunterladen und installieren.",managerCommandLabel:"Manager starten",clientCommandLabel:"Workstation verbinden",slotCommandLabel:"An Slot 3 fixieren",manualCommandLabel:"Erweiterte manuelle Verbindung"}),"pt-BR":xt({languageName:"Português",languageLabel:"Idioma do documento",eyebrow:"LiveDesk Manual",title:"Abra um Screen Wall local com um comando",intro:"LiveDesk é um deck npm-first para monitorar várias estações, caixas de IA, Mac minis e máquinas dev a partir de um PC manager.",managerTitle:"1. Execute o manager",managerBody:"Rode LiveDesk no computador que verá as telas. O manager inicia a UI e o servidor local juntos e abre http://127.0.0.1:5179.",managerPoints:["O comando é npx -y livedesk.","O manager usa 5179 para Screen Wall/API e 5197 para conexões client.","Se um processo antigo ocupa as portas, a inicialização limpa por padrão."],clientTitle:"2. Conecte uma workstation",clientBody:"Em cada computador monitorado, entre com a mesma conta Google. Se o manager ainda não estiver online, o client tenta a cada 5 segundos.",clientPoints:["Use npx -y livedesk client para o primeiro slot livre.","Use npx -y livedesk client 3 para fixar no slot 3.","Clients continuam tentando para evitar login repetido em muitos PCs."],syncTitle:"3. Sync Server e descoberta",syncBody:"Sync Server publica este manager como Screen Wall ativo da conta. Clients leem o registro no Supabase e testam endpoints.",syncPoints:["Inclui host instance, endereços LAN/private, candidatos public, pair token e lease curto.","Candidatos LAN vêm primeiro; public depois se necessário.","Clique Sync Server após mudanças de manager, VPN, firewall ou roteador.","Chrome Local Network Access em livedesk.pages.dev não é mais o caminho padrão. O app npm manager é o servidor real."],platformTitle:"4. Estado das plataformas",platformBody:"Windows foi verificado com transferência de tela. macOS e Linux seguem o mesmo caminho npm.",platformPoints:["Windows: verificado.","macOS: captura e controle precisam de permissões Screen Recording/Accessibility.","Linux: runtime linux-x64, captura grim/gnome-screenshot/import/scrot e entrada xdotool adicionados. Áudio ainda desativado."],firewallTitle:"Firewall e locais remotos",firewallBody:"Na mesma LAN normalmente não é preciso port forwarding. Em outra rede, clients precisam alcançar a porta client do manager.",firewallPoints:["Porta client: TCP 5197.","Máquinas client normalmente só precisam de saída.","Para redes remotas, permita TCP 5197 inbound no manager e encaminhe TCP 5197 para o PC manager.","A porta 5179 é para a UI do manager; exponha apenas se um navegador remoto precisar abrir o Wall.","Prefira VPN, Tailscale, ZeroTier ou allowlist de IP fixo."],commandsTitle:"Comandos atuais",commandsBody:"A direção do produto é um comando de terminal comum entre sistemas, não baixar e instalar manualmente.",managerCommandLabel:"Iniciar manager",clientCommandLabel:"Conectar workstation",slotCommandLabel:"Fixar no slot 3",manualCommandLabel:"Conexão manual avançada"}),it:xt({languageName:"Italiano",languageLabel:"Lingua documento",eyebrow:"LiveDesk Manual",title:"Apri uno Screen Wall locale con un comando",intro:"LiveDesk è un deck npm-first per monitorare workstation, box AI, Mac mini e macchine dev da un solo PC manager.",managerTitle:"1. Avvia il manager",managerBody:"Esegui LiveDesk sul computer che guarderà gli schermi. Il manager avvia UI e server locale e apre http://127.0.0.1:5179.",managerPoints:["Il comando è npx -y livedesk.","Il manager usa 5179 per Screen Wall/API e 5197 per connessioni client.","Se vecchi processi occupano le porte, l’avvio le pulisce di default."],clientTitle:"2. Connetti una workstation",clientBody:"Su ogni computer monitorato, accedi con lo stesso account Google. Se il manager non è online, il client riprova ogni 5 secondi.",clientPoints:["npx -y livedesk client usa il primo slot libero.","npx -y livedesk client 3 fissa la macchina allo slot 3.","I client continuano a provare per evitare login ripetuti."],syncTitle:"3. Sync Server e discovery",syncBody:"Sync Server pubblica questo manager come Screen Wall attivo dell’account. I client leggono Supabase e provano gli endpoint.",syncPoints:["Include host instance, indirizzi LAN/private, candidati public, pair token e lease breve.","Prima LAN, poi public se necessario.","Premi Sync Server dopo cambi di manager, VPN, firewall o router.","Chrome Local Network Access su livedesk.pages.dev non è più il percorso principale. L’app npm manager è il server reale."],platformTitle:"4. Stato piattaforme",platformBody:"Windows è verificato con trasferimento schermo live. macOS e Linux seguono lo stesso percorso npm.",platformPoints:["Windows: verificato.","macOS: capture e control richiedono permessi Screen Recording/Accessibility.","Linux: aggiunti runtime linux-x64, capture grim/gnome-screenshot/import/scrot e input xdotool. Audio disattivato."],firewallTitle:"Firewall e sedi remote",firewallBody:"Nella stessa LAN di solito non serve port forwarding. Da altre reti, i client devono raggiungere la porta client del manager.",firewallPoints:["Porta client: TCP 5197.","I client normalmente richiedono solo uscita.","Per reti remote, abilita TCP 5197 inbound sul manager e inoltra TCP 5197 al PC manager.","La porta 5179 è per la UI manager; esponila solo se un browser remoto deve aprire il Wall.","Preferisci VPN, Tailscale, ZeroTier o IP allowlist."],commandsTitle:"Comandi attuali",commandsBody:"La direzione è un comando terminale comune tra sistemi operativi, invece di download e install manuale.",managerCommandLabel:"Avvia manager",clientCommandLabel:"Connetti workstation",slotCommandLabel:"Fissa allo slot 3",manualCommandLabel:"Connessione manuale avanzata"}),id:xt({languageName:"Bahasa Indonesia",languageLabel:"Bahasa dokumen",eyebrow:"LiveDesk Manual",title:"Buka Screen Wall lokal dengan satu perintah",intro:"LiveDesk adalah deck npm-first untuk memantau banyak workstation, AI box, Mac mini, dan mesin dev dari satu PC manager.",managerTitle:"1. Jalankan manager",managerBody:"Jalankan LiveDesk di komputer yang melihat layar. Manager membuka UI dan server lokal bersama, lalu membuka http://127.0.0.1:5179.",managerPoints:["Perintahnya npx -y livedesk.","Manager memakai 5179 untuk Screen Wall/API dan 5197 untuk koneksi client.","Jika proses lama memakai port itu, startup membersihkannya secara default."],clientTitle:"2. Hubungkan workstation",clientBody:"Di komputer yang dipantau, masuk dengan akun Google yang sama. Jika manager belum online, client tetap mencoba tiap 5 detik.",clientPoints:["npx -y livedesk client memakai slot kosong pertama.","npx -y livedesk client 3 mengunci mesin ke slot 3.","Client terus mencoba agar banyak PC tidak perlu login berulang."],syncTitle:"3. Sync Server dan discovery",syncBody:"Sync Server menerbitkan manager ini sebagai Screen Wall aktif untuk akun. Client membaca Supabase dan mencoba endpoint.",syncPoints:["Berisi host instance, alamat LAN/private, kandidat public, pair token, dan lease pendek.","Kandidat LAN dicoba lebih dulu, lalu public jika perlu.","Tekan Sync Server setelah perubahan manager, VPN, firewall, atau router.","Chrome Local Network Access di livedesk.pages.dev bukan jalur utama lagi. App npm manager adalah server sebenarnya."],platformTitle:"4. Status platform",platformBody:"Windows sudah diverifikasi dengan live screen transfer. macOS dan Linux mengikuti jalur npm yang sama.",platformPoints:["Windows: terverifikasi.","macOS: capture dan control perlu izin Screen Recording/Accessibility.","Linux: runtime linux-x64, capture grim/gnome-screenshot/import/scrot, dan input xdotool sudah ditambahkan. Audio belum aktif."],firewallTitle:"Firewall dan lokasi luar",firewallBody:"Di LAN yang sama biasanya tidak perlu port forwarding. Dari jaringan lain, client harus mencapai port client manager.",firewallPoints:["Port client: TCP 5197.","Mesin client biasanya hanya perlu akses keluar.","Untuk jaringan luar, izinkan TCP 5197 inbound di manager dan forward TCP 5197 ke PC manager.","Port 5179 untuk UI manager; buka hanya jika browser luar harus membuka Wall.","Utamakan VPN, Tailscale, ZeroTier, atau IP allowlist."],commandsTitle:"Perintah saat ini",commandsBody:"Arah produk adalah satu perintah terminal lintas OS, bukan download dan instal manual.",managerCommandLabel:"Mulai manager",clientCommandLabel:"Hubungkan workstation",slotCommandLabel:"Kunci ke slot 3",manualCommandLabel:"Koneksi manual lanjutan"}),vi:xt({languageName:"Tiếng Việt",languageLabel:"Ngôn ngữ tài liệu",eyebrow:"LiveDesk Manual",title:"Mở Screen Wall cục bộ bằng một lệnh",intro:"LiveDesk là deck npm-first để giám sát nhiều workstation, máy AI, Mac mini và máy dev từ một PC manager.",managerTitle:"1. Chạy manager",managerBody:"Chạy LiveDesk trên máy dùng để xem màn hình. Manager khởi động UI và server cục bộ cùng lúc, rồi mở http://127.0.0.1:5179.",managerPoints:["Lệnh là npx -y livedesk.","Manager dùng 5179 cho Screen Wall/API và 5197 cho kết nối client.","Nếu tiến trình cũ giữ port, startup mặc định sẽ dọn và khởi động lại."],clientTitle:"2. Kết nối workstation",clientBody:"Trên mỗi máy được giám sát, đăng nhập cùng tài khoản Google. Nếu manager chưa online, client tiếp tục thử mỗi 5 giây.",clientPoints:["npx -y livedesk client dùng slot trống đầu tiên.","npx -y livedesk client 3 ghim máy vào slot 3.","Client tiếp tục chờ để nhiều máy không cần đăng nhập lại."],syncTitle:"3. Sync Server và tự phát hiện",syncBody:"Sync Server đăng manager này là Screen Wall đang hoạt động của tài khoản. Client đọc Supabase và thử các endpoint.",syncPoints:["Bao gồm host instance, địa chỉ LAN/private, public candidate, pair token và lease ngắn.","Ưu tiên LAN trước, sau đó thử public nếu cần.","Bấm Sync Server sau thay đổi manager, VPN, firewall hoặc router.","Chrome Local Network Access trên livedesk.pages.dev không còn là đường chạy chính. App npm manager mới là server thật."],platformTitle:"4. Trạng thái nền tảng",platformBody:"Windows đã được kiểm chứng với truyền màn hình live. macOS và Linux đi theo cùng đường npm.",platformPoints:["Windows: đã kiểm chứng.","macOS: capture và control cần quyền Screen Recording/Accessibility.","Linux: đã thêm runtime linux-x64, capture grim/gnome-screenshot/import/scrot và input xdotool. Audio chưa bật."],firewallTitle:"Firewall và địa điểm ngoài",firewallBody:"Trong cùng LAN thường không cần port forwarding. Từ mạng khác, client phải truy cập được port client của manager.",firewallPoints:["Port client: TCP 5197.","Máy client thường chỉ cần kết nối outbound.","Với mạng ngoài, cho phép TCP 5197 inbound trên manager và forward TCP 5197 tới PC manager.","Port 5179 dành cho UI manager; chỉ mở nếu trình duyệt từ xa cần mở Wall trực tiếp.","Ưu tiên VPN, Tailscale, ZeroTier hoặc allowlist IP cố định."],commandsTitle:"Lệnh hiện tại",commandsBody:"Hướng sản phẩm là một lệnh terminal dùng chung giữa các OS, thay vì tải và cài thủ công.",managerCommandLabel:"Khởi động manager",clientCommandLabel:"Kết nối workstation",slotCommandLabel:"Ghim vào slot 3",manualCommandLabel:"Kết nối thủ công nâng cao"}),th:xt({languageName:"ไทย",languageLabel:"ภาษาของเอกสาร",eyebrow:"LiveDesk Manual",title:"เปิด Screen Wall ภายในด้วยคำสั่งเดียว",intro:"LiveDesk คือ deck แบบ npm-first สำหรับดู workstation, กล่อง AI, Mac mini และเครื่อง dev หลายเครื่องจาก manager PC เครื่องเดียว",managerTitle:"1. รัน manager",managerBody:"รัน LiveDesk บนเครื่องที่ใช้ดูหน้าจอ Manager จะเปิด UI และ local server พร้อมกัน แล้วเปิด http://127.0.0.1:5179",managerPoints:["คำสั่งคือ npx -y livedesk","Manager ใช้ 5179 สำหรับ Screen Wall/API และ 5197 สำหรับ client connection","ถ้า process เก่ายังใช้ port อยู่ startup จะล้างให้โดย default"],clientTitle:"2. เชื่อม workstation",clientBody:"บนเครื่องที่ต้อง monitor ให้ login ด้วย Google account เดียวกัน ถ้า manager ยังไม่ออนไลน์ client จะลองใหม่ทุก 5 วินาที",clientPoints:["npx -y livedesk client จะใช้ slot ว่างแรก","npx -y livedesk client 3 จะตรึงเครื่องไว้ที่ slot 3","Client จะรอต่อเนื่องเพื่อไม่ต้อง login ซ้ำเมื่อมีหลายเครื่อง"],syncTitle:"3. Sync Server และ discovery",syncBody:"Sync Server จะ publish manager นี้เป็น active Screen Wall ของ account แล้ว client อ่านข้อมูลจาก Supabase และลอง endpoint ต่างๆ",syncPoints:["มี host instance, LAN/private address, public candidate, pair token และ short lease","ลอง LAN ก่อน แล้วค่อยลอง public ถ้าจำเป็น","กด Sync Server หลังเปลี่ยน manager, VPN, firewall หรือ router","Chrome Local Network Access บน livedesk.pages.dev ไม่ใช่ runtime หลักแล้ว app npm manager คือ server จริง"],platformTitle:"4. สถานะ platform",platformBody:"Windows ตรวจสอบแล้วว่าส่งภาพ live ได้ macOS และ Linux ใช้เส้นทาง npm เดียวกัน",platformPoints:["Windows: verified","macOS: capture/control ต้องใช้สิทธิ์ Screen Recording/Accessibility","Linux: เพิ่ม linux-x64 runtime, grim/gnome-screenshot/import/scrot capture และ xdotool input แล้ว audio ยังปิดอยู่"],firewallTitle:"Firewall และเครื่องต่างสถานที่",firewallBody:"ใน LAN เดียวกันปกติไม่ต้อง port forwarding ถ้าอยู่คนละ network client ต้องเข้าถึง client port ของ manager ได้",firewallPoints:["Client port คือ TCP 5197","เครื่อง client ปกติต้องการ outbound เท่านั้น","ถ้าอยู่นอก network ให้เปิด TCP 5197 inbound ที่ manager และ forward TCP 5197 ไปยัง manager PC","Port 5179 เป็น UI ของ manager เปิดเฉพาะเมื่อ browser ระยะไกลต้องเปิด Wall โดยตรง","ควรใช้ VPN, Tailscale, ZeroTier หรือ IP allowlist ก่อนเปิดสู่ public internet"],commandsTitle:"คำสั่งปัจจุบัน",commandsBody:"ทิศทาง product คือคำสั่ง terminal เดียวข้าม OS ไม่ใช่ download/install จากเว็บไซต์",managerCommandLabel:"เริ่ม manager",clientCommandLabel:"เชื่อม workstation",slotCommandLabel:"ตรึง slot 3",manualCommandLabel:"manual connection ขั้นสูง"}),hi:xt({languageName:"हिन्दी",languageLabel:"दस्तावेज़ भाषा",eyebrow:"LiveDesk Manual",title:"एक कमांड से local Screen Wall खोलें",intro:"LiveDesk एक npm-first remote work deck है जिससे एक manager PC से कई workstation, AI box, Mac mini और dev machines देखे जा सकते हैं।",managerTitle:"1. manager चलाएं",managerBody:"जिस computer से screens देखनी हैं उस पर LiveDesk manager चलाएं। यह UI और local server साथ में शुरू करता है और http://127.0.0.1:5179 खोलता है।",managerPoints:["कमांड है npx -y livedesk।","Manager Screen Wall/API के लिए 5179 और client connections के लिए 5197 इस्तेमाल करता है।","अगर पुराने LiveDesk ports बचे हों तो startup default रूप से साफ करता है।"],clientTitle:"2. workstation जोड़ें",clientBody:"हर monitored computer पर उसी Google account से sign in करें। Manager online न हो तब भी client बंद नहीं होता और हर 5 सेकंड retry करता है।",clientPoints:["npx -y livedesk client पहला खाली slot लेता है।","npx -y livedesk client 3 machine को slot 3 पर pin करता है।","बहुत सी machines हों तब भी बार-बार login की जरूरत नहीं रहती।"],syncTitle:"3. Sync Server और discovery",syncBody:"Sync Server इस manager को account का active Screen Wall बनाकर Supabase में publish करता है। Clients record पढ़कर endpoints try करते हैं।",syncPoints:["इसमें host instance, LAN/private addresses, public candidates, pair token और short lease होता है।","LAN candidates पहले try होते हैं, जरूरत हो तो public candidates।","Manager, VPN, firewall या router बदलने के बाद Sync Server दबाएं।","livedesk.pages.dev का Chrome Local Network Access अब default runtime नहीं है। npm manager app ही real server है।"],platformTitle:"4. Platform status",platformBody:"Windows live screen transfer के साथ verified है। macOS और Linux भी इसी npm path पर आगे बढ़ रहे हैं।",platformPoints:["Windows: verified.","macOS: capture/control के लिए Screen Recording/Accessibility permissions चाहिए।","Linux: linux-x64 runtime, grim/gnome-screenshot/import/scrot capture और xdotool input backend जोड़े गए हैं। Audio अभी disabled है।"],firewallTitle:"Firewall और remote locations",firewallBody:"Same LAN में आम तौर पर router forwarding जरूरी नहीं। दूसरे network से clients को manager client port तक पहुंचना होगा।",firewallPoints:["Client connection port: TCP 5197.","Client machines को आम तौर पर सिर्फ outbound access चाहिए।","Remote network के लिए manager firewall में TCP 5197 inbound allow करें और router से TCP 5197 manager PC पर forward करें।","5179 manager UI port है; इसे तभी expose करें जब remote browser को Wall खोलना हो।","Public internet से पहले VPN, Tailscale, ZeroTier या fixed IP allowlist बेहतर है।"],commandsTitle:"Current commands",commandsBody:"Product direction है OS के बीच एक terminal command, website से download/install नहीं।",managerCommandLabel:"Start manager",clientCommandLabel:"Connect workstation",slotCommandLabel:"Pin to slot 3",manualCommandLabel:"Advanced manual connection"}),ar:xt({languageName:"العربية",languageLabel:"لغة المستند",eyebrow:"LiveDesk Manual",title:"افتح Screen Wall محلي بأمر واحد",intro:"LiveDesk هو deck بنمط npm-first لمراقبة عدة workstations وأجهزة AI وMac mini وأجهزة تطوير من كمبيوتر manager واحد.",managerTitle:"1. شغل manager",managerBody:"شغل LiveDesk على الكمبيوتر الذي سيعرض الشاشات. يبدأ manager الواجهة والخادم المحلي معا ويفتح http://127.0.0.1:5179.",managerPoints:["الأمر هو npx -y livedesk.","يستخدم manager المنفذ 5179 للواجهة/API والمنفذ 5197 لاتصالات client.","إذا بقيت عملية LiveDesk قديمة على المنافذ، يتم تنظيفها افتراضيا عند التشغيل."],clientTitle:"2. وصل workstation",clientBody:"على كل كمبيوتر تتم مراقبته، سجل الدخول بنفس حساب Google. إذا لم يكن manager متاحا، يبقى client يعمل ويحاول كل 5 ثوان.",clientPoints:["npx -y livedesk client يختار أول slot فارغ.","npx -y livedesk client 3 يثبت الجهاز في slot 3.","clients تستمر بالمحاولة لتجنب تكرار تسجيل الدخول عند كثرة الأجهزة."],syncTitle:"3. Sync Server والاكتشاف",syncBody:"Sync Server ينشر هذا manager كـ active Screen Wall للحساب. يقرأ clients سجل Supabase ويجربون endpoints بالترتيب.",syncPoints:["السجل يتضمن host instance وعناوين LAN/private وpublic candidates وpair token وlease قصير.","يتم تفضيل LAN أولا، ثم public عند الحاجة.","اضغط Sync Server بعد تغيير manager أو VPN أو firewall أو router.","Chrome Local Network Access على livedesk.pages.dev لم يعد مسار التشغيل الافتراضي. تطبيق npm manager هو الخادم الحقيقي."],platformTitle:"4. حالة المنصات",platformBody:"Windows تم التحقق منه مع نقل شاشة live. macOS وLinux يتبعان نفس مسار npm.",platformPoints:["Windows: تم التحقق.","macOS: capture/control يحتاجان أذونات Screen Recording/Accessibility.","Linux: تمت إضافة linux-x64 runtime وgrim/gnome-screenshot/import/scrot capture وxdotool input. الصوت ما زال معطلا."],firewallTitle:"Firewall والمواقع البعيدة",firewallBody:"داخل نفس LAN غالبا لا تحتاج port forwarding. من شبكة أخرى يجب أن يصل client إلى منفذ manager client.",firewallPoints:["منفذ client: TCP 5197.","أجهزة client تحتاج عادة اتصال outbound فقط.","للشبكات البعيدة، اسمح TCP 5197 inbound على manager ووجه TCP 5197 من router إلى manager PC.","المنفذ 5179 مخصص لواجهة manager؛ اكشفه فقط إذا كان متصفح بعيد يحتاج فتح Wall مباشرة.","يفضل VPN أو Tailscale أو ZeroTier أو fixed IP allowlist بدل التعريض العام."],commandsTitle:"الأوامر الحالية",commandsBody:"اتجاه المنتج هو أمر terminal واحد عبر الأنظمة، وليس تحميل وتثبيت يدوي من موقع.",managerCommandLabel:"Start manager",clientCommandLabel:"Connect workstation",slotCommandLabel:"Pin to slot 3",manualCommandLabel:"Advanced manual connection"}),tr:xt({languageName:"Türkçe",languageLabel:"Belge dili",eyebrow:"LiveDesk Manual",title:"Yerel Screen Wall tek komutla açılsın",intro:"LiveDesk, tek bir manager PC üzerinden birçok workstation, AI box, Mac mini ve dev machine izlemek için npm-first bir çalışma deckidir.",managerTitle:"1. Manager çalıştır",managerBody:"Ekranları izleyecek bilgisayarda LiveDesk manager çalıştır. Manager UI ve local server birlikte başlar ve http://127.0.0.1:5179 açılır.",managerPoints:["Komut: npx -y livedesk.","Manager Screen Wall/API için 5179, client bağlantıları için 5197 kullanır.","Eski LiveDesk process portları tutuyorsa başlangıç varsayılan olarak temizler."],clientTitle:"2. Workstation bağla",clientBody:"İzlenecek bilgisayarda aynı Google hesabıyla giriş yap. Manager henüz online değilse client kapanmaz ve her 5 saniyede tekrar dener.",clientPoints:["npx -y livedesk client ilk boş slota yerleşir.","npx -y livedesk client 3 makineyi slot 3’e sabitler.","Çok makinede tekrar tekrar login gerekmesin diye client beklemeye devam eder."],syncTitle:"3. Sync Server ve discovery",syncBody:"Sync Server bu managerı hesabın active Screen Wall kaydı olarak Supabase’e yazar. Clients bu kaydı okuyup endpoint adaylarını dener.",syncPoints:["Host instance, LAN/private adresler, public adaylar, pair token ve kısa lease içerir.","Önce LAN adayları, gerekirse public adaylar denenir.","Manager, VPN, firewall veya router değişince Sync Server’a bas.","livedesk.pages.dev üzerindeki Chrome Local Network Access artık default runtime yolu değil. Gerçek server npm manager app."],platformTitle:"4. Platform durumu",platformBody:"Windows live screen transfer ile doğrulandı. macOS ve Linux aynı npm yolunu takip ediyor.",platformPoints:["Windows: doğrulandı.","macOS: capture/control için Screen Recording/Accessibility izinleri gerekir.","Linux: linux-x64 runtime, grim/gnome-screenshot/import/scrot capture ve xdotool input backend eklendi. Audio kapalı."],firewallTitle:"Firewall ve uzak konumlar",firewallBody:"Aynı LAN içinde genelde router forwarding gerekmez. Başka ağdan clients manager client portuna ulaşabilmelidir.",firewallPoints:["Client port: TCP 5197.","Client makineler normalde sadece outbound erişim ister.","Uzak ağ için manager firewall üzerinde TCP 5197 inbound aç ve routerdan TCP 5197yi manager PCye forward et.","5179 manager UI portudur; sadece uzak browser Wall açacaksa expose et.","Public internet yerine VPN, Tailscale, ZeroTier veya sabit IP allowlist tercih et."],commandsTitle:"Güncel komutlar",commandsBody:"Ürün yönü, webden indirip kurmak yerine işletim sistemleri arasında ortak tek terminal komutu.",managerCommandLabel:"Manager başlat",clientCommandLabel:"Workstation bağla",slotCommandLabel:"Slot 3’e sabitle",manualCommandLabel:"Gelişmiş manuel bağlantı"})},J_=Object.entries(Ar).map(([i,n])=>({id:i,label:n.languageName}));function X_(){if(typeof navigator>"u")return"en";const i=navigator.languages?.length?navigator.languages:[navigator.language];for(const n of i){const r=n.toLowerCase();if(Ar[n])return n;if(r.startsWith("zh-tw")||r.startsWith("zh-hk"))return"zh-TW";if(r.startsWith("pt"))return"pt-BR";const l=r.split("-")[0];if(Ar[l])return l}return"en"}function vp({index:i,selected:n,onSelect:r}){const l=i+1;return y.jsx("article",{className:`device-tile placeholder-tile ${n?"selected":""}`,children:y.jsxs("button",{className:"tile-screen",onClick:r,"aria-pressed":n,title:`Select slot ${l}`,type:"button",children:[y.jsx("span",{className:"slot-grid","aria-hidden":"true"}),y.jsxs("span",{className:"empty-screen",children:[y.jsx(_r,{size:24}),y.jsxs("strong",{children:["Slot ",String(l).padStart(3,"0")]})]})]})})}function bp({device:i,frame:n,selected:r,controlEnabled:l,showStatus:c,monitorIndex:d,monitorCount:h,onSelect:m,onFocusDevice:g,onOpenControl:p,onCycleMonitor:S,sendInput:b}){const T=I.useRef(null),A=I.useRef(0),C=Wp(i),U=wr(d,h),$=h>1;I.useEffect(()=>{const N=T.current;if(!N||!n)return;let Y=!1;return u_(N,n,()=>Y).catch(()=>{}),()=>{Y=!0}},[n]);const P=N=>{const Y=N.currentTarget.getBoundingClientRect();return{normalizedX:Math.max(0,Math.min(1,(N.clientX-Y.left)/Math.max(1,Y.width))),normalizedY:Math.max(0,Math.min(1,(N.clientY-Y.top)/Math.max(1,Y.height)))}},q=(N,Y)=>{if(l){if(Y==="pointermove"){const ue=performance.now();if(ue-A.current<24)return;A.current=ue}b(i.deviceId,{type:Y,...P(N),button:P_(N.button)})}};return y.jsx("article",{className:`device-tile ${r?"selected":""} ${i.connected?"online":"offline"}`,children:y.jsxs("div",{className:"tile-screen",role:"button",tabIndex:l?-1:0,"aria-pressed":r,onClick:()=>{l||m()},onKeyDown:N=>{l||(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),m())},onDoubleClick:N=>{N.preventDefault(),p()},children:[y.jsx("canvas",{ref:T,className:"remote-canvas",tabIndex:l?0:-1,onPointerDown:N=>{l&&(g(),N.currentTarget.focus(),N.currentTarget.setPointerCapture(N.pointerId),q(N,"pointerdown"))},onPointerMove:N=>q(N,"pointermove"),onPointerUp:N=>q(N,"pointerup"),onWheel:N=>{l&&(N.preventDefault(),b(i.deviceId,{type:"wheel",deltaX:N.deltaX,deltaY:N.deltaY}))},onKeyDown:N=>{l&&b(i.deviceId,{type:"keydown",key:N.key,code:N.code,text:N.key.length===1?N.key:"",repeat:N.repeat})},onKeyUp:N=>{l&&b(i.deviceId,{type:"keyup",key:N.key,code:N.code,text:N.key.length===1?N.key:"",repeat:!1})},onContextMenu:N=>l&&N.preventDefault()}),!n&&y.jsx("span",{className:"empty-screen",children:y.jsx(_r,{size:26})}),c&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:`tile-health-pill state-${C.state}`,children:C.label}),y.jsx("span",{className:"tile-metrics","aria-label":`${Gs(i)} status`,children:C.metrics.slice(0,3).map(N=>y.jsxs("span",{className:`tile-metric state-${N.state}`,children:[y.jsx("b",{children:N.label}),y.jsx("em",{children:N.value}),N.ratio!==void 0&&y.jsx("i",{style:{width:`${Math.round(N.ratio*100)}%`}})]},N.id))})]}),$&&y.jsxs("span",{className:"monitor-cycle","aria-label":`${Gs(i)} display ${U+1} of ${h}`,children:[y.jsx("button",{className:"monitor-cycle-button previous",onClick:N=>{N.preventDefault(),N.stopPropagation(),S(-1)},title:"Previous display",type:"button",children:y.jsx(wp,{size:18})}),y.jsxs("span",{className:"monitor-cycle-count",children:["Screen ",U+1,"/",h]}),y.jsx("button",{className:"monitor-cycle-button next",onClick:N=>{N.preventDefault(),N.stopPropagation(),S(1)},title:"Next display",type:"button",children:y.jsx(_p,{size:18})})]})]})})}function Q_(){const{session:i,loading:n}=w_(),{target:r,error:l,refresh:c}=T_(i),d=I.useMemo(()=>{if(!r?.active)return null;const w=r.expires_at?Date.parse(r.expires_at):Number.POSITIVE_INFINITY;return Number.isFinite(w)&&w<=Date.now()?null:r},[r]),h=I.useMemo(()=>mp(d),[d]),m=I.useMemo(()=>h.length>0?[...new Set([...h,jt])]:[jt],[h]),[g,p]=I.useState(B_),S=I.useMemo(()=>m.some(w=>!!Ps(w)),[m]),b=!S||g,{status:T,devices:A,error:C,refresh:U,hubBaseUrl:$}=__(m,b),{entitlement:P,licensed:q,loading:N,error:Y,refresh:ue}=k_(i),[G,Q]=I.useState([]),[Se,we]=I.useState([]),[Nt,We]=I.useState(""),[Le,mt]=I.useState(!1),[pt,Ge]=I.useState(!1),[D,K]=I.useState(""),[ae,te]=I.useState(""),[Ee,E]=I.useState(""),[M,J]=I.useState("wall"),[Z,de]=I.useState("large"),[me,xe]=I.useState(X_),[Je,Xe]=I.useState(!1),[kn,fn]=I.useState(!1),[Ti,ki]=I.useState(!1),[Dn,Cr]=I.useState(!1),[ga,Yo]=I.useState(z_),[Ae,Ei]=I.useState(H_),[Un,Ai]=I.useState({}),[xi,Mn]=I.useState(null),[Ot,Or]=I.useState(!1),Rr=I.useRef(null),Ci=I.useRef(!1),Ja=I.useRef(0),He=I.useMemo(()=>A.filter(w=>w.connected),[A]),tl=I.useMemo(()=>He.reduce((w,V)=>Math.max(w,Ls(V.slotNumber)),0),[He]),tn=Math.max(R_,He.length,tl),Jo=I.useMemo(()=>{const w=Array(tn).fill(null),V=[];for(const ie of He){const W=Ls(ie.slotNumber);W>0&&W<=tn&&!w[W-1]?w[W-1]=ie:V.push(ie)}for(const ie of V){const W=w.findIndex(fe=>!fe);W<0?w.push(ie):w[W]=ie}return w},[He,tn]),pa=I.useMemo(()=>He.map(w=>w.deviceId),[He]),St=I.useMemo(()=>new Set(G),[G]),Lt=I.useMemo(()=>new Set(Se),[Se]),lt=I.useMemo(()=>He.filter(w=>St.has(w.deviceId)||Lt.has(Ls(w.slotNumber))),[He,St,Lt]),se=I.useMemo(()=>A.find(w=>w.deviceId===Nt)||lt[0]||null,[A,Nt,lt]),nn=I.useMemo(()=>se?Wp(se):null,[se]),Xo=se?Is(se,"control"):!1,ya=se?Is(se,"audio")||Is(se,"remoteAudio"):!1,Xa=He.length<=fr,ot=q||Xa,Dt=`Free plan includes up to ${fr} workstations. Upgrade to LTD for ${He.length} workstations.`,va=ot&&!!se,En=ot&&!!se&&Xo,nl=ot&&!!se&&ya,jr=ot?pa:[],Nr=I.useMemo(()=>({fps:Ae.fps,maxWidth:Ae.maxWidth,maxHeight:Ae.maxHeight,quality:Ae.quality,mode:Ae.frameMode,frameMode:Ae.frameMode,monitorSelections:Un}),[Un,Ae]),{frames:zn,state:Qo}=E_(jr,Ae.autoStartLive&&jr.length>0,$,Nr),{state:Lr,sendInput:Dr}=A_(En&&Le,$),{state:Ur,error:Oi}=O_(se?.deviceId||"",nl&&pt,$);I.useEffect(()=>{const w=new URLSearchParams(window.location.search).get("checkout");if(w==="success"){te("Checkout returned. Waiting for Dodo confirmation."),ue();const V=window.setInterval(()=>{ue()},4e3),ie=window.setTimeout(()=>{window.clearInterval(V)},45e3);return()=>{window.clearInterval(V),window.clearTimeout(ie)}}w==="cancelled"&&te("Checkout cancelled.")},[ue]),I.useEffect(()=>{!ot&&Le&&mt(!1),!ot&&pt&&Ge(!1)},[pt,Le,ot]),I.useEffect(()=>{Ge(!1)},[se?.deviceId]),I.useEffect(()=>{const w=He.map(W=>W.deviceId),V=new Set(w),ie=new Map(He.map(W=>[W.deviceId,W]));Q(W=>{const fe=W.filter(ce=>V.has(ce));return pp(W,fe)?W:fe}),We(W=>W&&V.has(W)?W:""),we(W=>{const fe=W.filter(ce=>ce>=1&&ce<=tn);return pp(W.map(String),fe.map(String))?W:fe}),Ai(W=>{let fe=!1;const ce={};for(const[ye,tt]of Object.entries(W)){if(!V.has(ye)){fe=!0;continue}const Ke=ie.get(ye),nt=wr(tt,Ke?bi(Ke):1);ce[ye]=nt,nt!==tt&&(fe=!0)}return fe?ce:W})},[He,tn]),I.useEffect(()=>{try{localStorage.setItem(Yp,ga)}catch{}},[ga]),I.useEffect(()=>{q_(Ae)},[Ae]);const Qa=I.useCallback(async()=>{const w=new Set(m);w.add(jt);try{const ce=await Sn("/api/remote/status",void 0,jt);mp({endpoint:ce.agentEndpoint,endpoint_candidates:[...ce.agentEndpointCandidates||[],...ce.hostTargetEndpointCandidates||[]]}).forEach(ye=>w.add(ye))}catch{}const V=[...w].sort((ce,ye)=>{const tt=Ke=>{const nt=Ps(Ke);return nt==="local"?0:nt==="loopback"?1:2};return tt(ce)-tt(ye)||ce.localeCompare(ye)});let ie=!1,W="",fe=!1;try{for(const ce of V){const ye=Ps(ce);try{if(await Sn("/api/health",void 0,ce),ye==="local")return p(!0),mr(!0),ce;ye==="loopback"&&(ie=!0,W=ce)}catch{ye==="local"&&(fe=!0)}}return ie?(fe&&te("LiveDesk Hub is reachable on this PC, but not through the LAN address yet. Restart LiveDesk Hub to bind 5179 on the network."),p(!0),mr(!0),W||jt):(p(!1),mr(!1),"")}catch{return p(!1),mr(!1),""}},[m]),Mr=async()=>{K("auth"),fn(!1),await Qa();const{error:w}=await Nn.auth.signInWithOAuth({provider:"google",options:{redirectTo:window.location.origin}});w&&(te(w.message),K(""))},al=async()=>{K("auth"),fn(!1),await Nn.auth.signOut(),K("")};I.useEffect(()=>{if(!kn)return;const w=ie=>{ie.target instanceof Element&&(ie.target.closest(".account-popover, .rail-account")||fn(!1))},V=ie=>{ie.key==="Escape"&&fn(!1)};return window.addEventListener("pointerdown",w),window.addEventListener("keydown",V),()=>{window.removeEventListener("pointerdown",w),window.removeEventListener("keydown",V)}},[kn]);const Vt=I.useCallback(async(w={})=>{const V=w.silent===!0,ie=w.takeover===!0,W=w.requestLocalAccess===!0,fe=W?await Qa():"";if(!i?.user){V||te("Sign in before publishing this host.");return}if(!Ci.current){Ci.current=!0,V||K("host");try{const ce=fe||$||jt,ye=T||await Sn("/api/remote/status",void 0,ce);if(!ye.started)throw new Error("Start LiveDesk on this computer before syncing the server.");const tt=`livedesk-${i.user.id}`,Ke=await Sn("/api/remote/host-target",{method:"POST",body:JSON.stringify({nodeId:tt,leaseMs:6e4,takeover:ie})},ce);if(!Ke.ok)throw new Error(Ke.error||"host-target-failed");const nt=await Sn("/api/remote/status",void 0,ce),fl=Ke.hostTarget||{},ei=nt.hostTargetEndpointCandidates||nt.agentEndpointCandidates||ye.agentEndpointCandidates||[nt.agentEndpoint||ye.agentEndpoint].filter(Boolean),{data:Kt,error:Li}=await Nn.rpc("set_livedesk_remote_host_target",{p_node_id:tt,p_lease_id:String(fl.leaseId||nt.hostTargetLeaseId||crypto.randomUUID()),p_host_instance_id:nt.hostInstanceId||tt,p_endpoint:nt.hostTargetEndpoint||nt.agentEndpoint||ye.agentEndpoint,p_pair_token:nt.pairToken||"",p_manager_package:"@livedesk/hub",p_manager_version:nt.managerVersion||"0.1.0",p_agent_package:"@livedesk/client",p_activated_at:new Date().toISOString(),p_expires_at:new Date(Date.now()+6e4).toISOString(),p_takeover:ie,p_endpoint_candidates:ei});if(Li)throw Li;const Jn=Array.isArray(Kt)?Kt[0]:Kt;if(Jn&&Jn.ok===!1)throw new Error(Jn.reason||"registry-rejected");V||(te("Host published."),(W||S)&&(p(!0),mr(!0)),U()),c()}catch(ce){if(!V){const ye=ce instanceof Error?ce.message:String(ce);ye.includes("local network access")&&(p(!1),mr(!1)),te(ye)}}finally{Ci.current=!1,V||K("")}}},[$,S,U,c,Qa,i,T]);I.useEffect(()=>{if(!i?.user||!T?.started||C)return;const w=r?.expires_at?Date.parse(r.expires_at):Number.POSITIVE_INFINITY,V=r?.active===!0&&(!r.expires_at||!Number.isFinite(w)||w>Date.now()),ie=!!r?.host_instance_id&&!!T.hostInstanceId&&r.host_instance_id===T.hostInstanceId;if(V&&!ie)return;let W=!1;const fe=()=>{if(W)return;const ye=Date.now();ye-Ja.current<25e3||(Ja.current=ye,Vt({silent:!0}))};fe();const ce=window.setInterval(fe,3e4);return()=>{W=!0,window.clearInterval(ce)}},[C,Vt,i?.user?.id,T?.agentEndpoint,T?.hostInstanceId,T?.started,r?.active,r?.expires_at,r?.host_instance_id]);const Ve=I.useCallback(w=>{w&&(We(w),Q(V=>V.includes(w)?V:[...V,w]))},[]),wt=I.useCallback(w=>{if(!w)return;const V=He.find(W=>W.deviceId===w),ie=Ls(V?.slotNumber);We(w),ie>0&&we(W=>W.filter(fe=>fe!==ie)),Q(W=>W.includes(w)?W:[...W,w])},[He]),Bn=I.useCallback(w=>{!Number.isInteger(w)||w<1||w>tn||(We(""),we(V=>V.includes(w)?V.filter(ie=>ie!==w):[...V,w].sort((ie,W)=>ie-W)))},[tn]),Hn=I.useCallback(()=>{Q([]),we([]),We(""),mt(!1),Ge(!1)},[]),il=I.useCallback(()=>{Q([]),We(""),mt(!1),Ge(!1),we(Array.from({length:tn},(w,V)=>V+1))},[tn]),rl=I.useCallback((w,V)=>{const ie=He.find(fe=>fe.deviceId===w);if(!ie)return;const W=bi(ie);W<=1||(Ai(fe=>{const ye=(wr(fe[w],W)+V+W)%W;return{...fe,[w]:ye}}),Ve(w))},[He,Ve]);I.useEffect(()=>{const w=V=>{const ie=V.target,W=ie?.tagName?.toLowerCase();ie?.isContentEditable||W==="input"||W==="textarea"||W==="select"||((V.ctrlKey||V.metaKey)&&V.key.toLowerCase()==="a"&&(V.preventDefault(),il()),V.key==="Escape"&&Hn())};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[Hn,il]);const ba=async w=>{if(!ot){te(Dt);return}Ve(w);try{const V=He.find(ie=>ie.deviceId===w);await Sn(`/api/remote/devices/${encodeURIComponent(w)}/live/start`,{method:"POST",body:JSON.stringify({fps:Ae.fps,maxWidth:Ae.maxWidth,maxHeight:Ae.maxHeight,quality:Ae.quality,mode:Ae.frameMode,frameMode:Ae.frameMode,monitorIndex:wr(Un[w],V?bi(V):1)})},$),te("Live stream requested."),U()}catch(V){te(V instanceof Error?V.message:String(V))}},Sa=async w=>{if(Ve(w),J("control"),!ot){mt(!1),te(Dt);return}mt(!0),await ba(w)},zr=async()=>{if(!se){te("Select a workstation before playing audio.");return}if(!ot){te(Dt);return}if(!ya){te("Selected workstation does not report remote audio support yet.");return}const w=!pt;Ge(w);try{await Sn(`/api/remote/devices/${encodeURIComponent(se.deviceId)}/audio/${w?"start":"stop"}`,{method:"POST",body:JSON.stringify({mimeType:"audio/webm;codecs=opus",sampleRate:48e3,channels:2})},$),te(w?"Remote audio requested.":"Remote audio stopped.")}catch(V){Ge(!1),te(V instanceof Error?V.message:String(V))}},qn=async w=>{const V=Array.from(w).filter(ce=>ce.size>=0);if(V.length===0)return;if(!ot){te(Dt);return}const ie=lt.length>0?lt.map(ce=>ce.deviceId):se?[se.deviceId]:[];if(ie.length===0){te("Select at least one workstation before dropping files.");return}const W=V.reduce((ce,ye)=>ce+ye.size,0),fe=crypto.randomUUID();if(W>N_){Mn({id:fe,status:"failed",progress:100,message:`Transfer is too large (${_i(W)}).`});return}Mn({id:fe,status:"reading",progress:2,message:`Preparing ${V.length} file${V.length===1?"":"s"}`});try{let ce=0;const ye=[];for(const Ke of V){const nt=await Ke.arrayBuffer();ce+=Ke.size,Mn({id:fe,status:"reading",progress:Math.max(4,Math.round(ce/Math.max(1,W)*58)),message:`Preparing ${_i(ce)} / ${_i(W)}`}),ye.push({name:Ke.name,relativePath:Ke.webkitRelativePath||Ke.name,size:Ke.size,type:Ke.type,lastModified:Ke.lastModified,dataBase64:$_(nt)})}Mn({id:fe,status:"sending",progress:72,message:`Sending to ${ie.length} workstation${ie.length===1?"":"s"}`});const tt=await Sn("/api/remote/files/transfer",{method:"POST",body:JSON.stringify({transferId:fe,deviceIds:ie,remoteDirectory:ga.trim(),files:ye})},$);if(!tt.ok)throw new Error(tt.error||"file-transfer-not-queued");Mn({id:fe,status:"queued",progress:100,message:`Queued ${V.length} file${V.length===1?"":"s"} to ${tt.queued}/${tt.total}`}),window.setTimeout(()=>{Mn(Ke=>Ke?.id===fe&&Ke.status==="queued"?null:Ke)},4500)}catch(ce){Mn({id:fe,status:"failed",progress:100,message:ce instanceof Error?ce.message:String(ce)})}},wa=w=>{w.preventDefault(),w.stopPropagation(),Or(!1),qn(w.dataTransfer.files)},Wa=async()=>{const w=Ee.trim();if(w){if(!ot){te(Dt);return}K("task");try{await Sn("/api/remote/tasks",{method:"POST",body:JSON.stringify({instruction:w,allConnected:!0,approvalLevel:"task-only"})},$),E(""),te("Task queued."),U()}catch(V){te(V instanceof Error?V.message:String(V))}finally{K("")}}},$n=async()=>{if(!i){te("Sign in with Google before checkout.");return}if(q){te("LiveDesk license is already active.");return}K("checkout");try{const{data:w,error:V}=await Nn.functions.invoke("dodo-checkout",{body:{plan:"ltd"}});if(V)throw V;if(!w?.checkout_url)throw new Error("Checkout function did not return a checkout URL.");window.location.assign(w.checkout_url)}catch(w){te(w instanceof Error?w.message:String(w)),K("")}},qe=U_(),Br=M_(),sl=He.length,Pn=pa.filter(w=>zn.has(w)).length,In=C?"offline":T?.started?"online":"starting",ll=M==="settings",Hr=M==="pricing",qr=M==="doc",ol=!Hr&&!qr,Ri=M==="control",Gn=lt.length+Se.filter(w=>!He.some(V=>Ls(V.slotNumber)===w)).length,mn=Se.length===1?`Slot ${String(Se[0]).padStart(3,"0")}`:`${Se.length} slots selected`,Ut=Gn===0?"No workstation":Gn>1?`${Gn} selected`:se?Gs(se):mn,yt=Ar[me]||Ar.en,ji=yt.sync||Ar.en.sync,Za=n||N?"checking":q?`${(P?.plan||"ltd").toUpperCase()} active`:Xa?`Free ${He.length}/${fr}`:`Upgrade ${He.length}/${fr}`,cl=q?"Licensed":D==="checkout"?"Opening":"$30 LTD",Wo=q?"License active":i?q?"Licensed":D==="checkout"?"Opening checkout":"Buy with Dodo":D==="auth"?"Opening Google":"Sign in to buy",Mt=q||D==="checkout"||D==="auth"||n||N,Ni=i?.user.user_metadata,Fa=yp(Ni,"avatar_url","picture"),Vn=yp(Ni,"full_name","name")||i?.user.email||"Google",Kn=Vn.slice(0,1).toUpperCase(),ul=T?.started?"Local app ready":"Start LiveDesk",dl=r?.active?"Published":i?"Not published":"Sign in required",_a=vd.find(w=>w.width===Ae.maxWidth&&w.height===Ae.maxHeight)?.id||`${Ae.maxWidth}x${Ae.maxHeight}`,Zo=Lo.find(w=>w.id===Ae.frameMode)||Lo[0],Yn=w=>{Ei(V=>({...V,...w}))},hl=w=>{const V=vd.find(ie=>ie.id===w);V&&Yn({maxWidth:V.width,maxHeight:V.height})},Pr=w=>{if(w==="control"){if(J(w),!ot){mt(!1),te(Dt);return}mt(!0),se&&ba(se.deviceId);return}J(w),mt(!1)};return y.jsxs("main",{className:"app-shell",children:[y.jsxs("aside",{className:"tool-rail","aria-label":"LiveDesk tools",children:[y.jsx("div",{className:"rail-brand",title:"LiveDesk",children:y.jsx(_r,{size:22})}),y.jsx("nav",{className:"rail-tools",children:Y_.map(w=>{const V=w.icon;return y.jsxs("button",{className:`rail-tool ${M===w.id?"active":""} accent-${w.accent}`,onClick:()=>Pr(w.id),title:w.label,type:"button",children:[y.jsx(V,{size:19}),y.jsx("span",{children:w.label})]},w.id)})}),y.jsxs("div",{className:"rail-footer",children:[y.jsxs("button",{className:"rail-tool compact sync-server",onClick:()=>Vt({takeover:!0,requestLocalAccess:!0}),title:"Sync Server",type:"button",children:[y.jsx(id,{size:18}),y.jsx("span",{children:"Sync Server"})]}),y.jsxs("button",{className:`rail-tool compact local-settings ${Ti?"active":""}`,onClick:()=>{ki(w=>!w),fn(!1)},title:"Local Settings",type:"button",children:[y.jsx(kp,{size:18}),y.jsx("span",{children:"Settings"})]}),Ti&&y.jsxs("section",{className:"local-settings-popover",role:"dialog","aria-label":"LiveDesk local settings",children:[y.jsxs("div",{className:"local-settings-head",children:[y.jsxs("div",{children:[y.jsx("strong",{children:"Local Settings"}),y.jsx("p",{children:"Saved on this browser"})]}),y.jsx("button",{className:"icon-button",onClick:()=>ki(!1),title:"Close settings",type:"button",children:y.jsx(Ng,{size:15})})]}),y.jsxs("label",{className:"local-setting-row",children:[y.jsx("span",{children:"Frame mode"}),y.jsx("select",{value:Ae.frameMode,onChange:w=>Yn({frameMode:Xp(w.target.value)}),children:Lo.map(w=>y.jsxs("option",{value:w.id,children:[w.label," - ",w.detail]},w.id))})]}),y.jsxs("div",{className:"local-setting-grid",children:[y.jsxs("label",{className:"local-setting-row",children:[y.jsx("span",{children:"FPS"}),y.jsx("select",{value:Ae.fps,onChange:w=>Yn({fps:kr(w.target.value,1,24,_n.fps)}),children:L_.map(w=>y.jsx("option",{value:w,children:w},w))})]}),y.jsxs("label",{className:"local-setting-row",children:[y.jsx("span",{children:"Size"}),y.jsx("select",{value:_a,onChange:w=>hl(w.target.value),children:vd.map(w=>y.jsx("option",{value:w.id,children:w.label},w.id))})]})]}),y.jsxs("label",{className:"local-setting-row",children:[y.jsx("span",{children:"Quality"}),y.jsx("select",{value:Ae.quality,onChange:w=>Yn({quality:kr(w.target.value,20,95,_n.quality)}),children:D_.map(w=>y.jsx("option",{value:w,children:w},w))})]}),y.jsxs("label",{className:"local-setting-toggle",children:[y.jsx("input",{type:"checkbox",checked:Ae.autoStartLive,onChange:w=>Yn({autoStartLive:w.target.checked})}),y.jsx("span",{children:"Auto live on connected screens"})]}),y.jsxs("label",{className:"local-setting-toggle",children:[y.jsx("input",{type:"checkbox",checked:Ae.showScreenStatus,onChange:w=>Yn({showScreenStatus:w.target.checked})}),y.jsx("span",{children:"Screen status overlay"})]}),y.jsxs("div",{className:"local-settings-summary",children:[y.jsx("span",{children:Zo.label}),y.jsxs("strong",{children:[Ae.maxWidth,"x",Ae.maxHeight," / ",Ae.fps,"fps"]})]}),y.jsx("button",{className:"local-settings-reset",onClick:()=>Ei(_n),type:"button",children:"Reset local settings"})]}),y.jsxs("button",{className:`rail-account ${i?"signed-in":""}`,onClick:()=>{fn(w=>!w),ki(!1)},disabled:n||D==="auth","aria-expanded":kn,title:i?`Account: ${i.user.email||Vn}`:"Sign in with Google",type:"button",children:[i?Fa?y.jsx("img",{src:Fa,alt:Vn,referrerPolicy:"no-referrer"}):y.jsx("span",{className:"avatar-fallback",children:Kn}):y.jsx(sd,{size:18}),y.jsx("span",{children:i?"Account":"Google"})]}),kn&&y.jsxs("section",{className:"account-popover",role:"dialog","aria-label":"LiveDesk account",children:[y.jsxs("div",{className:"account-popover-head",children:[y.jsx("div",{className:"account-popover-avatar",children:i&&Fa?y.jsx("img",{src:Fa,alt:Vn,referrerPolicy:"no-referrer"}):i?y.jsx("span",{children:Kn}):y.jsx(sd,{size:18})}),y.jsxs("div",{children:[y.jsx("strong",{children:i?Vn:"Account"}),y.jsx("p",{children:i?.user.email||"Not signed in"})]})]}),y.jsxs("dl",{className:"account-popover-facts",children:[y.jsx("dt",{children:"User"}),y.jsx("dd",{children:i?.user.email||"Not signed in"}),y.jsx("dt",{children:"Network"}),y.jsx("dd",{children:ul}),y.jsx("dt",{children:"Access"}),y.jsx("dd",{children:dl}),y.jsx("dt",{children:"Plan"}),y.jsx("dd",{children:Za})]}),i?y.jsxs("button",{className:"account-popover-action",onClick:al,disabled:D==="auth",type:"button",children:[y.jsx(N0,{size:16}),"Logout"]}):y.jsxs("button",{className:"account-popover-action primary",onClick:Mr,disabled:D==="auth",type:"button",children:[y.jsx(sd,{size:16}),"Sign in with Google"]})]})]})]}),y.jsxs("section",{className:`desk-stage ${ol&&!Je?"dock-open":""}`,children:[y.jsxs("header",{className:"topbar",children:[y.jsxs("div",{className:"brand",children:[y.jsx("span",{className:"brand-mark",children:y.jsx(Cg,{size:18})}),y.jsxs("div",{children:[y.jsx("h1",{children:"LiveDesk"}),y.jsx("p",{children:"Control wall for local machines"})]})]}),ol&&y.jsx("div",{className:"top-actions",children:y.jsx("div",{className:"segmented-control","aria-label":"Screen size",children:K_.map(w=>y.jsx("button",{className:Z===w.id?"active":"",onClick:()=>de(w.id),type:"button",children:w.label},w.id))})})]}),qr?y.jsxs("section",{className:"doc-page",lang:me,dir:me==="ar"?"rtl":"ltr",children:[y.jsxs("section",{className:"doc-hero",children:[y.jsxs("div",{className:"doc-hero-copy",children:[y.jsxs("span",{className:"pricing-eyebrow",children:[y.jsx(_d,{size:16}),yt.eyebrow]}),y.jsx("h2",{children:yt.title}),y.jsx("p",{children:yt.intro})]}),y.jsxs("label",{className:"doc-language-picker",children:[y.jsxs("span",{children:[y.jsx(x0,{size:17}),yt.languageLabel]}),y.jsx("select",{value:me,onChange:w=>xe(w.target.value),children:J_.map(w=>y.jsx("option",{value:w.id,children:w.label},w.id))})]})]}),y.jsx("section",{className:"doc-grid",children:yt.sections.map((w,V)=>{const W=[cd,yr,Tp,jg][V]||_d;return y.jsxs("article",{className:"doc-card",children:[y.jsx("div",{className:"doc-card-icon",children:y.jsx(W,{size:19})}),y.jsxs("div",{children:[y.jsx("h3",{children:w.title}),y.jsx("p",{children:w.body}),y.jsx("ul",{children:w.points.map(fe=>y.jsx("li",{children:fe},fe))})]})]},w.title)})}),ji&&y.jsxs("section",{className:"doc-sync",children:[y.jsxs("div",{className:"doc-sync-head",children:[y.jsx(id,{size:20}),y.jsxs("div",{children:[y.jsx("h3",{children:ji.title}),y.jsx("p",{children:ji.body})]})]}),y.jsx("ul",{children:ji.points.map(w=>y.jsx("li",{children:w},w))})]}),y.jsxs("section",{className:"doc-firewall",children:[y.jsxs("div",{className:"doc-firewall-head",children:[y.jsx(Og,{size:20}),y.jsxs("div",{children:[y.jsx("h3",{children:yt.firewall.title}),y.jsx("p",{children:yt.firewall.body})]})]}),y.jsx("ul",{children:yt.firewall.points.map(w=>y.jsx("li",{children:w},w))})]}),y.jsxs("section",{className:"doc-command-panel",children:[y.jsxs("div",{className:"doc-command-head",children:[y.jsx(yr,{size:20}),y.jsxs("div",{children:[y.jsx("h3",{children:yt.commands.title}),y.jsx("p",{children:yt.commands.body})]})]}),y.jsxs("div",{className:"doc-command-list",children:[yt.commands.manager&&y.jsxs("div",{className:"doc-command-row",children:[y.jsx("span",{children:yt.commands.manager}),y.jsx("code",{children:Br}),y.jsx("button",{className:"icon-button",onClick:()=>Ns(Br),title:"Copy command",type:"button",children:y.jsx(Rs,{size:16})})]}),y.jsxs("div",{className:"doc-command-row",children:[y.jsx("span",{children:yt.commands.primary}),y.jsx("code",{children:qe}),y.jsx("button",{className:"icon-button",onClick:()=>Ns(qe),title:"Copy command",type:"button",children:y.jsx(Rs,{size:16})})]}),y.jsxs("div",{className:"doc-command-row",children:[y.jsx("span",{children:yt.commands.slot}),y.jsx("code",{children:`${qe} 3`}),y.jsx("button",{className:"icon-button",onClick:()=>Ns(`${qe} 3`),title:"Copy command",type:"button",children:y.jsx(Rs,{size:16})})]})]})]})]}):Hr?y.jsxs("section",{className:"pricing-page",children:[(Y||ae)&&y.jsx("section",{className:"notice-band",children:Y||ae}),y.jsxs("section",{className:"pricing-offer",children:[y.jsx("button",{className:"pricing-close",onClick:()=>J("wall"),title:"Close pricing",type:"button",children:y.jsx(Ng,{size:18})}),y.jsxs("div",{className:"pricing-offer-head",children:[y.jsxs("span",{className:"pricing-eyebrow",children:[y.jsx(V0,{size:15}),"Founder launch"]}),y.jsxs("div",{className:"deal-price-line",children:[y.jsx("span",{className:"deal-original",children:"$59"}),y.jsx("span",{className:"deal-arrow",children:"→"}),y.jsx("strong",{children:"$30"}),y.jsxs("span",{className:"deal-badge",children:[y.jsx(y0,{size:15}),"Lifetime deal"]})]}),y.jsx("p",{children:"Monitor and control your local workstation wall. Free for 4 PCs, then unlock larger local setups with one payment."})]}),y.jsxs("div",{className:"deal-table",role:"table","aria-label":"LiveDesk launch pricing",children:[y.jsxs("div",{className:"deal-row deal-row-head",role:"row",children:[y.jsx("span",{role:"columnheader",children:"Plan"}),y.jsx("span",{role:"columnheader",children:"Launch benefit"}),y.jsx("span",{role:"columnheader",children:"Now"})]}),y.jsxs("div",{className:"deal-row deal-row-highlight",role:"row",children:[y.jsx("strong",{role:"cell",children:"Founder LTD"}),y.jsxs("span",{role:"cell",children:[y.jsx("s",{children:"$59"})," local lifetime unlock"]}),y.jsx("strong",{role:"cell",children:"$30"})]}),y.jsxs("div",{className:"deal-row",role:"row",children:[y.jsx("strong",{role:"cell",children:"Free"}),y.jsx("span",{role:"cell",children:"Live, control, audio, files, tasks"}),y.jsx("strong",{role:"cell",children:"$0"})]}),y.jsxs("div",{className:"deal-row",role:"row",children:[y.jsx("strong",{role:"cell",children:"Workstations"}),y.jsx("span",{role:"cell",children:"4 free, larger walls with LTD"}),y.jsxs("strong",{role:"cell",children:[He.length,"/",fr]})]}),y.jsxs("div",{className:"deal-row",role:"row",children:[y.jsx("strong",{role:"cell",children:"Future monthly"}),y.jsx("span",{role:"cell",children:"Cloud relay and team features later"}),y.jsx("strong",{role:"cell",children:"separate"})]})]}),y.jsxs("section",{className:"deal-module",children:[y.jsxs("div",{className:"deal-module-title",children:[y.jsx("strong",{children:"LiveDesk includes"}),y.jsx("span",{children:Za})]}),y.jsxs("ul",{className:"deal-feature-list",children:[y.jsxs("li",{children:[y.jsx(_r,{size:16}),y.jsx("span",{children:"Screen wall slots"}),y.jsx("b",{children:"120+"})]}),y.jsxs("li",{children:[y.jsx(kd,{size:16}),y.jsx("span",{children:"Focused control"}),y.jsx("b",{children:"Local"})]}),y.jsxs("li",{children:[y.jsx(Rg,{size:16}),y.jsx("span",{children:"Remote PC audio"}),y.jsx("b",{children:"PCM"})]}),y.jsxs("li",{children:[y.jsx(rd,{size:16}),y.jsx("span",{children:"File transfer"}),y.jsx("b",{children:"24MB"})]})]})]}),y.jsxs("section",{className:"deal-open-price",children:[y.jsx("span",{children:"Opening special price"}),y.jsx("strong",{children:"$30 LTD"}),y.jsx("small",{children:"Early buyers keep this local lifetime license after monthly plans arrive."})]}),y.jsxs("p",{className:"deal-note",children:[y.jsx(_0,{size:15}),"Free plan stays available for up to ",fr," local workstations."]}),y.jsxs("button",{className:"deal-cta",onClick:i?$n:Mr,disabled:Mt,type:"button",children:[y.jsx(Td,{size:18}),Wo]}),y.jsx("button",{className:"deal-later",onClick:()=>J("wall"),type:"button",children:"Later"})]})]}):y.jsx(y.Fragment,{children:y.jsxs("section",{className:`monitor-layout ${Je?"dock-collapsed":""}`,children:[y.jsx("section",{className:`screen-wall-panel ${Ot?"drop-active":""}`,onClick:w=>{w.currentTarget===w.target&&Hn()},onDragEnter:w=>{w.preventDefault(),Or(!0)},onDragOver:w=>{w.preventDefault(),w.dataTransfer.dropEffect="copy"},onDragLeave:w=>{w.currentTarget===w.target&&Or(!1)},onDrop:wa,children:Ri?y.jsxs("section",{className:"control-focus",children:[y.jsxs("div",{className:"control-focus-head",children:[y.jsxs("div",{children:[y.jsx("span",{children:"Focused control"}),y.jsx("strong",{children:se?Gs(se):"No workstation"})]}),y.jsxs("button",{className:"text-button",onClick:()=>se&&ba(se.deviceId),disabled:!va,type:"button",children:[y.jsx(ld,{size:16}),"Start live"]})]}),y.jsx("div",{className:"screen-wall control-wall",onClick:w=>{w.currentTarget===w.target&&Hn()},children:se?y.jsx(bp,{device:se,frame:zn.get(se.deviceId),selected:!0,controlEnabled:En&&Le,showStatus:Ae.showScreenStatus,monitorIndex:wr(Un[se.deviceId],bi(se)),monitorCount:bi(se),onSelect:()=>wt(se.deviceId),onFocusDevice:()=>Ve(se.deviceId),onOpenControl:()=>Sa(se.deviceId),onCycleMonitor:w=>rl(se.deviceId,w),sendInput:Dr},se.deviceId):y.jsx(vp,{index:0,selected:Lt.has(1),onSelect:()=>Bn(1)})})]}):y.jsx("div",{className:`screen-wall size-${Z}`,onClick:w=>{w.currentTarget===w.target&&Hn()},children:Jo.map((w,V)=>{const ie=V+1;return w?y.jsx(bp,{device:w,frame:zn.get(w.deviceId),selected:St.has(w.deviceId)||Lt.has(ie),controlEnabled:En&&Le&&se?.deviceId===w.deviceId,showStatus:Ae.showScreenStatus,monitorIndex:wr(Un[w.deviceId],bi(w)),monitorCount:bi(w),onSelect:()=>wt(w.deviceId),onFocusDevice:()=>Ve(w.deviceId),onOpenControl:()=>Sa(w.deviceId),onCycleMonitor:W=>rl(w.deviceId,W),sendInput:Dr},w.deviceId):y.jsx(vp,{index:V,selected:Lt.has(ie),onSelect:()=>Bn(ie)},`slot-${V}`)})})}),y.jsxs("aside",{className:`right-dock ${ll?"settings-mode":"actions-mode"} ${Je?"collapsed":""}`,"aria-label":"LiveDesk tools",children:[y.jsx("button",{className:"dock-toggle",onClick:()=>Xe(w=>!w),"aria-label":Je?"Show control panel":"Hide control panel",title:Je?"Show control panel":"Hide control panel",type:"button",children:Je?y.jsx(wp,{size:18}):y.jsx(_p,{size:18})}),!Je&&(ll?y.jsxs(y.Fragment,{children:[(C||l||Y||ae)&&y.jsx("section",{className:"notice-band",children:C||l||Y||ae}),y.jsxs("section",{className:"command-deck",children:[y.jsxs("div",{className:"setup-card",children:[y.jsxs("div",{className:"setup-head",children:[y.jsx("span",{className:"setup-icon",children:y.jsx(_r,{size:18})}),y.jsxs("div",{children:[y.jsx("strong",{children:"Add workstation"}),y.jsx("span",{children:"Connect another local PC to this wall."})]})]}),y.jsxs("button",{className:"text-button primary full",onClick:()=>Ns(qe),type:"button",children:[y.jsx(Rs,{size:16}),"Copy setup"]}),y.jsxs("button",{className:"setup-disclosure",onClick:()=>Cr(w=>!w),type:"button",children:[y.jsx(yr,{size:15}),"Advanced setup"]}),Dn&&y.jsxs("div",{className:"setup-code-row",children:[y.jsx("code",{children:qe}),y.jsx("button",{className:"icon-button",onClick:()=>Ns(qe),title:"Copy setup command",type:"button",children:y.jsx(Rs,{size:16})})]})]}),y.jsxs("div",{className:"settings-card",children:[y.jsxs("div",{className:"panel-title",children:[y.jsx(rd,{size:17}),y.jsx("h2",{children:"Files"})]}),y.jsxs("label",{className:"field-row",children:[y.jsx("span",{children:"Remote folder"}),y.jsx("input",{value:ga,onChange:w=>Yo(w.target.value),placeholder:"Desktop/LiveDeskFiles"})]}),y.jsx("p",{className:"muted",children:"Blank uses Desktop/LiveDeskFiles on each workstation."})]}),y.jsxs("div",{className:"deck-actions",children:[y.jsxs("button",{className:"text-button primary",onClick:()=>Vt({takeover:!0,requestLocalAccess:!0}),disabled:!i||D==="host",type:"button",children:[y.jsx(id,{size:16}),"Sync access"]}),y.jsxs("button",{className:"text-button buy",onClick:$n,disabled:D==="checkout"||q,type:"button",children:[y.jsx(Td,{size:16}),cl]})]})]}),y.jsxs("section",{className:"status-strip",children:[y.jsxs("div",{className:`status-item state-${In}`,children:[y.jsx(cd,{size:18}),y.jsx("span",{children:"Local app"}),y.jsx("strong",{children:In})]}),y.jsxs("div",{className:"status-item",children:[y.jsx(jg,{size:18}),y.jsx("span",{children:"Slots"}),y.jsxs("strong",{children:[sl,"/",tn]})]}),y.jsxs("div",{className:"status-item",children:[y.jsx(Cg,{size:18}),y.jsx("span",{children:"Frames"}),y.jsxs("strong",{children:[Pn," ",Qo]})]}),y.jsxs("div",{className:"status-item",children:[y.jsx(Og,{size:18}),y.jsx("span",{children:"Plan"}),y.jsx("strong",{children:Za})]})]})]}):y.jsxs(y.Fragment,{children:[y.jsxs("section",{className:"action-dock",children:[y.jsxs("div",{className:"action-context",children:[y.jsx("span",{children:Gn>0?"Selection":"No selection"}),y.jsx("strong",{children:Ut})]}),y.jsx("input",{ref:Rr,className:"hidden-file-input",type:"file",multiple:!0,onChange:w=>{w.currentTarget.files&&qn(w.currentTarget.files),w.currentTarget.value=""}}),(C||ae)&&y.jsx("div",{className:"notice-band compact",children:y.jsx("span",{children:C||ae})}),y.jsxs("div",{className:"action-grid",children:[y.jsxs("button",{className:"action-tile primary",onClick:()=>se&&ba(se.deviceId),disabled:!va,type:"button",children:[y.jsx(ld,{size:21}),y.jsx("span",{children:"Live"})]}),y.jsxs("button",{className:`action-tile ${Le?"active":""}`,onClick:()=>mt(w=>!w),disabled:!En,type:"button",children:[y.jsx(kd,{size:21}),y.jsx("span",{children:Lr!=="idle"?Lr:"Control"})]}),y.jsxs("button",{className:`action-tile ${pt?"active":""}`,onClick:zr,disabled:!nl,type:"button",title:ya?"Remote PC audio":"Remote audio is not supported by this workstation yet",children:[y.jsx(Rg,{size:21}),y.jsx("span",{children:pt&&Ur!=="idle"?Ur:"Audio"})]}),y.jsxs("button",{className:"action-tile",onClick:()=>Rr.current?.click(),disabled:!ot||lt.length===0,type:"button",title:"File transfer",children:[y.jsx(rd,{size:21}),y.jsx("span",{children:"Files"})]}),y.jsxs("button",{className:"action-tile",disabled:!0,type:"button",title:"Reboot",children:[y.jsx(H0,{size:21}),y.jsx("span",{children:"Reboot"})]}),y.jsxs("button",{className:"action-tile",disabled:!0,type:"button",title:"Power",children:[y.jsx(z0,{size:21}),y.jsx("span",{children:"Power"})]}),y.jsxs("button",{className:"action-tile",disabled:!0,type:"button",title:"Terminal",children:[y.jsx(yr,{size:21}),y.jsx("span",{children:"Shell"})]})]})]}),se&&nn&&y.jsxs("section",{className:"side-panel selected-panel",children:[y.jsxs("div",{className:"machine-detail-head",children:[y.jsxs("div",{className:"panel-title",children:[y.jsx(_r,{size:17}),y.jsx("h2",{children:"Machine detail"})]}),y.jsx("span",{className:`machine-health state-${nn.state}`,children:nn.label})]}),y.jsxs("div",{className:"machine-title",children:[y.jsx("strong",{children:Gs(se)}),y.jsx("span",{children:nn.role})]}),y.jsx("div",{className:"machine-metric-grid",children:nn.metrics.map(w=>y.jsxs("article",{className:`machine-metric state-${w.state}`,children:[y.jsx("span",{children:w.label}),y.jsx("strong",{children:w.value}),y.jsx("small",{children:w.detail}),w.ratio!==void 0&&y.jsx("i",{children:y.jsx("b",{style:{width:`${Math.round(w.ratio*100)}%`}})})]},w.id))}),y.jsxs("section",{className:"machine-section",children:[y.jsxs("div",{className:"machine-section-title",children:[y.jsx(yr,{size:15}),y.jsx("span",{children:"Local services"})]}),y.jsx("div",{className:"tool-probe-list",children:nn.tools.map(w=>y.jsxs("span",{className:`tool-probe state-${w.status}`,children:[y.jsx("b",{children:w.label}),y.jsx("em",{children:w.detail})]},w.id))})]}),y.jsxs("section",{className:"machine-section",children:[y.jsxs("div",{className:"machine-section-title",children:[y.jsx(od,{size:15}),y.jsx("span",{children:"Workload"})]}),y.jsxs("div",{className:"workload-card",children:[y.jsx("strong",{children:nn.taskLabel}),y.jsx("span",{children:nn.taskStatus}),nn.taskSummary&&y.jsx("p",{children:nn.taskSummary})]})]}),y.jsxs("div",{className:"machine-section",children:[y.jsxs("div",{className:"machine-section-title",children:[y.jsx(cd,{size:15}),y.jsx("span",{children:"System"})]}),y.jsxs("dl",{className:"facts compact",children:[y.jsx("dt",{children:"Platform"}),y.jsxs("dd",{children:[se.platform||"-"," ",se.arch||""]}),y.jsx("dt",{children:"Release"}),y.jsx("dd",{children:Gt(se.status,"release")||"-"}),y.jsx("dt",{children:"Uptime"}),y.jsx("dd",{children:Qp(Qe(se.status,"uptimeSec"))}),y.jsx("dt",{children:"Last seen"}),y.jsx("dd",{children:v_(se.lastSeenAt||se.connectedAt)}),y.jsx("dt",{children:"Agent"}),y.jsx("dd",{children:se.agentVersion||"-"}),y.jsx("dt",{children:"Address"}),y.jsx("dd",{children:se.remoteAddress||"-"})]})]}),Oi&&y.jsx("p",{className:"panel-warning",children:Oi}),y.jsxs("button",{className:"text-button full",onClick:()=>se&&ba(se.deviceId),disabled:!va,type:"button",children:[y.jsx(ld,{size:16}),"Start live"]})]}),y.jsxs("section",{className:"side-panel task-panel",children:[y.jsxs("div",{className:"panel-title",children:[y.jsx(od,{size:17}),y.jsx("h2",{children:"Task"})]}),y.jsx("textarea",{value:Ee,onChange:w=>E(w.target.value),placeholder:"Prepare a short status report.",rows:4}),y.jsxs("button",{className:"text-button full primary",onClick:Wa,disabled:D==="task"||!Ee.trim()||!ot,type:"button",children:[y.jsx(od,{size:16}),"Send to connected"]})]})]}))]})]})})]}),xi&&y.jsxs("aside",{className:`transfer-bar state-${xi.status}`,"aria-live":"polite",children:[y.jsx("div",{className:"transfer-bar-track",children:y.jsx("span",{style:{width:`${Math.max(0,Math.min(100,xi.progress))}%`}})}),y.jsx("p",{children:xi.message})]})]})}c0.createRoot(document.getElementById("root")).render(y.jsx(I.StrictMode,{children:y.jsx(Q_,{})}));
36
+ ${P}`}class ft extends Error{constructor({message:n,code:r,cause:l,name:c}){var d;super(n,{cause:l}),this.__isWebAuthnError=!0,this.name=(d=c??(l instanceof Error?l.name:void 0))!==null&&d!==void 0?d:"Unknown Error",this.code=r}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class Bo extends ft{constructor(n,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:n}),this.name="WebAuthnUnknownError",this.originalError=r}}function vw({error:i,options:n}){var r,l,c;const{publicKey:d}=n;if(!d)throw Error("options was missing required publicKey property");if(i.name==="AbortError"){if(n.signal instanceof AbortSignal)return new ft({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:i})}else if(i.name==="ConstraintError"){if(((r=d.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new ft({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:i});if(n.mediation==="conditional"&&((l=d.authenticatorSelection)===null||l===void 0?void 0:l.userVerification)==="required")return new ft({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:i});if(((c=d.authenticatorSelection)===null||c===void 0?void 0:c.userVerification)==="required")return new ft({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:i})}else{if(i.name==="InvalidStateError")return new ft({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:i});if(i.name==="NotAllowedError")return new ft({message:i.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:i});if(i.name==="NotSupportedError")return d.pubKeyCredParams.filter(m=>m.type==="public-key").length===0?new ft({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:i}):new ft({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:i});if(i.name==="SecurityError"){const h=window.location.hostname;if(Ip(h)){if(d.rp.id!==h)return new ft({message:`The RP ID "${d.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:i})}else return new ft({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:i})}else if(i.name==="TypeError"){if(d.user.id.byteLength<1||d.user.id.byteLength>64)return new ft({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:i})}else if(i.name==="UnknownError")return new ft({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:i})}return new ft({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:i})}function bw({error:i,options:n}){const{publicKey:r}=n;if(!r)throw Error("options was missing required publicKey property");if(i.name==="AbortError"){if(n.signal instanceof AbortSignal)return new ft({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:i})}else{if(i.name==="NotAllowedError")return new ft({message:i.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:i});if(i.name==="SecurityError"){const l=window.location.hostname;if(Ip(l)){if(r.rpId!==l)return new ft({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:i})}else return new ft({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:i})}else if(i.name==="UnknownError")return new ft({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:i})}return new ft({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:i})}class Sw{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const n=new AbortController;return this.controller=n,n.signal}cancelCeremony(){if(this.controller){const n=new Error("Manually cancelling existing WebAuthn API call");n.name="AbortError",this.controller.abort(n),this.controller=void 0}}}const Ud=new Sw;function lp(i){if(!i)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(i);const{challenge:n,user:r,excludeCredentials:l}=i,c=Po(i,["challenge","user","excludeCredentials"]),d=Er(n).buffer,h=Object.assign(Object.assign({},r),{id:Er(r.id).buffer}),m=Object.assign(Object.assign({},c),{challenge:d,user:h});if(l&&l.length>0){m.excludeCredentials=new Array(l.length);for(let g=0;g<l.length;g++){const p=l[g];m.excludeCredentials[g]=Object.assign(Object.assign({},p),{id:Er(p.id).buffer,type:p.type||"public-key",transports:p.transports})}}return m}function op(i){if(!i)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(i);const{challenge:n,allowCredentials:r}=i,l=Po(i,["challenge","allowCredentials"]),c=Er(n).buffer,d=Object.assign(Object.assign({},l),{challenge:c});if(r&&r.length>0){d.allowCredentials=new Array(r.length);for(let h=0;h<r.length;h++){const m=r[h];d.allowCredentials[h]=Object.assign(Object.assign({},m),{id:Er(m.id).buffer,type:m.type||"public-key",transports:m.transports})}}return d}function cp(i){var n;if("toJSON"in i&&typeof i.toJSON=="function")return i.toJSON();const r=i;return{id:i.id,rawId:i.id,response:{attestationObject:wi(new Uint8Array(i.response.attestationObject)),clientDataJSON:wi(new Uint8Array(i.response.clientDataJSON))},type:"public-key",clientExtensionResults:i.getClientExtensionResults(),authenticatorAttachment:(n=r.authenticatorAttachment)!==null&&n!==void 0?n:void 0}}function up(i){var n;if("toJSON"in i&&typeof i.toJSON=="function")return i.toJSON();const r=i,l=i.getClientExtensionResults(),c=i.response;return{id:i.id,rawId:i.id,response:{authenticatorData:wi(new Uint8Array(c.authenticatorData)),clientDataJSON:wi(new Uint8Array(c.clientDataJSON)),signature:wi(new Uint8Array(c.signature)),userHandle:c.userHandle?wi(new Uint8Array(c.userHandle)):void 0},type:"public-key",clientExtensionResults:l,authenticatorAttachment:(n=r.authenticatorAttachment)!==null&&n!==void 0?n:void 0}}function Ip(i){return i==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(i)}function Ho(){var i,n;return!!(Ct()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((i=navigator?.credentials)===null||i===void 0?void 0:i.create)=="function"&&typeof((n=navigator?.credentials)===null||n===void 0?void 0:n.get)=="function")}async function Gp(i){try{const n=await navigator.credentials.create(i);return n?n instanceof PublicKeyCredential?{data:n,error:null}:{data:null,error:new Bo("Browser returned unexpected credential type",n)}:{data:null,error:new Bo("Empty credential response",n)}}catch(n){return{data:null,error:vw({error:n,options:i})}}}async function Vp(i){try{const n=await navigator.credentials.get(i);return n?n instanceof PublicKeyCredential?{data:n,error:null}:{data:null,error:new Bo("Browser returned unexpected credential type",n)}:{data:null,error:new Bo("Empty credential response",n)}}catch(n){return{data:null,error:bw({error:n,options:i})}}}const ww={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},_w={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function qo(...i){const n=c=>c!==null&&typeof c=="object"&&!Array.isArray(c),r=c=>c instanceof ArrayBuffer||ArrayBuffer.isView(c),l={};for(const c of i)if(c)for(const d in c){const h=c[d];if(h!==void 0)if(Array.isArray(h))l[d]=h;else if(r(h))l[d]=h;else if(n(h)){const m=l[d];n(m)?l[d]=qo(m,h):l[d]=qo(h)}else l[d]=h}return l}function Tw(i,n){return qo(ww,i,n||{})}function kw(i,n){return qo(_w,i,n||{})}class Ew{constructor(n){this.client=n,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(n){return this.client.mfa.enroll(Object.assign(Object.assign({},n),{factorType:"webauthn"}))}async _challenge({factorId:n,webauthn:r,friendlyName:l,signal:c},d){var h;try{const{data:m,error:g}=await this.client.mfa.challenge({factorId:n,webauthn:r});if(!m)return{data:null,error:g};const p=c??Ud.createNewAbortSignal();if(m.webauthn.type==="create"){const{user:S}=m.webauthn.credential_options.publicKey;if(!S.name){const b=l;if(b)S.name=`${S.id}:${b}`;else{const A=(await this.client.getUser()).data.user,C=((h=A?.user_metadata)===null||h===void 0?void 0:h.name)||A?.email||A?.id||"User";S.name=`${S.id}:${C}`}}S.displayName||(S.displayName=S.name)}switch(m.webauthn.type){case"create":{const S=Tw(m.webauthn.credential_options.publicKey,d?.create),{data:b,error:T}=await Gp({publicKey:S,signal:p});return b?{data:{factorId:n,challengeId:m.id,webauthn:{type:m.webauthn.type,credential_response:b}},error:null}:{data:null,error:T}}case"request":{const S=kw(m.webauthn.credential_options.publicKey,d?.request),{data:b,error:T}=await Vp(Object.assign(Object.assign({},m.webauthn.credential_options),{publicKey:S,signal:p}));return b?{data:{factorId:n,challengeId:m.id,webauthn:{type:m.webauthn.type,credential_response:b}},error:null}:{data:null,error:T}}}}catch(m){return X(m)?{data:null,error:m}:{data:null,error:new Tn("Unexpected error in challenge",m)}}}async _verify({challengeId:n,factorId:r,webauthn:l}){return this.client.mfa.verify({factorId:r,challengeId:n,webauthn:l})}async _authenticate({factorId:n,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:l=typeof window<"u"?[window.location.origin]:void 0,signal:c}={}},d){if(!r)return{data:null,error:new Qs("rpId is required for WebAuthn authentication")};try{if(!Ho())return{data:null,error:new Tn("Browser does not support WebAuthn",null)};const{data:h,error:m}=await this.challenge({factorId:n,webauthn:{rpId:r,rpOrigins:l},signal:c},{request:d});if(!h)return{data:null,error:m};const{webauthn:g}=h;return this._verify({factorId:n,challengeId:h.challengeId,webauthn:{type:g.type,rpId:r,rpOrigins:l,credential_response:g.credential_response}})}catch(h){return X(h)?{data:null,error:h}:{data:null,error:new Tn("Unexpected error in authenticate",h)}}}async _register({friendlyName:n,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:l=typeof window<"u"?[window.location.origin]:void 0,signal:c}={}},d){if(!r)return{data:null,error:new Qs("rpId is required for WebAuthn registration")};try{if(!Ho())return{data:null,error:new Tn("Browser does not support WebAuthn",null)};const{data:h,error:m}=await this._enroll({friendlyName:n});if(!h)return await this.client.mfa.listFactors().then(S=>{var b;return(b=S.data)===null||b===void 0?void 0:b.all.find(T=>T.factor_type==="webauthn"&&T.friendly_name===n&&T.status!=="unverified")}).then(S=>S?this.client.mfa.unenroll({factorId:S?.id}):void 0),{data:null,error:m};const{data:g,error:p}=await this._challenge({factorId:h.id,friendlyName:h.friendly_name,webauthn:{rpId:r,rpOrigins:l},signal:c},{create:d});return g?this._verify({factorId:h.id,challengeId:g.challengeId,webauthn:{rpId:r,rpOrigins:l,type:g.webauthn.type,credential_response:g.webauthn.credential_response}}):{data:null,error:p}}catch(h){return X(h)?{data:null,error:h}:{data:null,error:new Tn("Unexpected error in register",h)}}}}mw();const Aw={url:OS,storageKey:RS,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:jS,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},hr={};class Ws{get jwks(){var n,r;return(r=(n=hr[this.storageKey])===null||n===void 0?void 0:n.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(n){hr[this.storageKey]=Object.assign(Object.assign({},hr[this.storageKey]),{jwks:n})}get jwks_cached_at(){var n,r;return(r=(n=hr[this.storageKey])===null||n===void 0?void 0:n.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(n){hr[this.storageKey]=Object.assign(Object.assign({},hr[this.storageKey]),{cachedAt:n})}constructor(n){var r,l,c;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.lastRefreshFailure=null,this._sessionRemovalEpoch=0,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lock=null,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const d=Object.assign(Object.assign({},Aw),n);if(this.storageKey=d.storageKey,this.instanceID=(r=Ws.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Ws.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!d.debug,typeof d.debug=="function"&&(this.logger=d.debug),this.instanceID>0&&Ct()){const h=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(h),this.logDebugMessages&&console.trace(h)}if(this.persistSession=d.persistSession,this.autoRefreshToken=d.autoRefreshToken,this.experimental=(l=d.experimental)!==null&&l!==void 0?l:{},this.admin=new hw({url:d.url,headers:d.headers,fetch:d.fetch,experimental:this.experimental}),this.url=d.url,this.headers=d.headers,this.fetch=$p(d.fetch),this.detectSessionInUrl=d.detectSessionInUrl,this.flowType=d.flowType,this.hasCustomAuthorizationHeader=d.hasCustomAuthorizationHeader,this.throwOnError=d.throwOnError,this.lockAcquireTimeout=d.lockAcquireTimeout,d.lock!=null&&(this.lock=d.lock),this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new Ew(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(d.storage?this.storage=d.storage:qp()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=sp(this.memoryStorage)),d.userStorage&&(this.userStorage=d.userStorage)):(this.memoryStorage={},this.storage=sp(this.memoryStorage)),Ct()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(h){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",h)}(c=this.broadcastChannel)===null||c===void 0||c.addEventListener("message",async h=>{this._debug("received broadcast notification from other tab or client",h),(h.data.event==="TOKEN_REFRESHED"||h.data.event==="SIGNED_IN")&&(this.lastRefreshFailure=null);try{await this._notifyAllSubscribers(h.data.event,h.data.session,!1)}catch(m){this._debug("#broadcastChannel","error",m)}})}d.skipAutoInitialize||this.initialize().catch(h=>{this._debug("#initialize()","error",h)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(n){if(this.throwOnError&&n&&n.error)throw n.error;return n}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${zp}) ${new Date().toISOString()}`}_debug(...n){return this.logDebugMessages&&this.logger(this._logPrefix(),...n),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()):await this._initialize())(),await this.initializePromise)}async _initialize(){var n;try{let r={},l="none";if(Ct()&&(r=KS(window.location.href),this._isImplicitGrantCallback(r)?l="implicit":await this._isPKCECallback(r)&&(l="pkce")),Ct()&&this.detectSessionInUrl&&l!=="none"){const{data:c,error:d}=await this._getSessionFromURL(r,l);if(d){if(this._debug("#_initialize()","error detecting session from URL",d),MS(d)){const g=(n=d.details)===null||n===void 0?void 0:n.code;if(g==="identity_already_exists"||g==="identity_not_found"||g==="single_identity_not_deletable")return{error:d}}return{error:d}}const{session:h,redirectType:m}=c;return this._debug("#_initialize()","detected session in URL",h,"redirect type",m),await this._saveSession(h),setTimeout(async()=>{m==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",h):await this._notifyAllSubscribers("SIGNED_IN",h)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return X(r)?this._returnResult({error:r}):this._returnResult({error:new Tn("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(n){var r,l,c;try{const d=await ee(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(l=(r=n?.options)===null||r===void 0?void 0:r.data)!==null&&l!==void 0?l:{},gotrue_meta_security:{captcha_token:(c=n?.options)===null||c===void 0?void 0:c.captchaToken}},xform:hn}),{data:h,error:m}=d;if(m||!h)return this._returnResult({data:{user:null,session:null},error:m});const g=h.session,p=h.user;return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",g)),this._returnResult({data:{user:p,session:g},error:null})}catch(d){if(X(d))return this._returnResult({data:{user:null,session:null},error:d});throw d}}async signUp(n){var r,l,c;try{let d;if("email"in n){const{email:S,password:b,options:T}=n;let A=null,C=null;this.flowType==="pkce"&&([A,C]=await vi(this.storage,this.storageKey)),d=await ee(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:T?.emailRedirectTo,body:{email:S,password:b,data:(r=T?.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:T?.captchaToken},code_challenge:A,code_challenge_method:C},xform:hn})}else if("phone"in n){const{phone:S,password:b,options:T}=n;d=await ee(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:S,password:b,data:(l=T?.data)!==null&&l!==void 0?l:{},channel:(c=T?.channel)!==null&&c!==void 0?c:"sms",gotrue_meta_security:{captcha_token:T?.captchaToken}},xform:hn})}else throw new Co("You must provide either an email or phone number and a password");const{data:h,error:m}=d;if(m||!h)return await rt(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:m});const g=h.session,p=h.user;return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",g)),this._returnResult({data:{user:p,session:g},error:null})}catch(d){if(await rt(this.storage,`${this.storageKey}-code-verifier`),X(d))return this._returnResult({data:{user:null,session:null},error:d});throw d}}async signInWithPassword(n){try{let r;if("email"in n){const{email:d,password:h,options:m}=n;r=await ee(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:d,password:h,gotrue_meta_security:{captcha_token:m?.captchaToken}},xform:ip})}else if("phone"in n){const{phone:d,password:h,options:m}=n;r=await ee(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:d,password:h,gotrue_meta_security:{captcha_token:m?.captchaToken}},xform:ip})}else throw new Co("You must provide either an email or phone number and a password");const{data:l,error:c}=r;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l||!l.session||!l.user){const d=new dr;return this._returnResult({data:{user:null,session:null},error:d})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:Object.assign({user:l.user,session:l.session},l.weak_password?{weakPassword:l.weak_password}:null),error:c})}catch(r){if(X(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(n){var r,l,c,d;return await this._handleProviderSignIn(n.provider,{redirectTo:(r=n.options)===null||r===void 0?void 0:r.redirectTo,scopes:(l=n.options)===null||l===void 0?void 0:l.scopes,queryParams:(c=n.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:(d=n.options)===null||d===void 0?void 0:d.skipBrowserRedirect})}async exchangeCodeForSession(n){return await this.initializePromise,this.lock!=null?this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(n)):this._exchangeCodeForSession(n)}async signInWithWeb3(n){const{chain:r}=n;switch(r){case"ethereum":return await this.signInWithEthereum(n);case"solana":return await this.signInWithSolana(n);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(n){var r,l,c,d,h,m,g,p,S,b,T;let A,C;if("message"in n)A=n.message,C=n.signature;else{const{chain:U,wallet:$,statement:P,options:q}=n;let N;if(Ct())if(typeof $=="object")N=$;else{const we=window;if("ethereum"in we&&typeof we.ethereum=="object"&&"request"in we.ethereum&&typeof we.ethereum.request=="function")N=we.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof $!="object"||!q?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");N=$}const Y=new URL((r=q?.url)!==null&&r!==void 0?r:window.location.href),ue=await N.request({method:"eth_requestAccounts"}).then(we=>we).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!ue||ue.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const G=Pp(ue[0]);let Q=(l=q?.signInWithEthereum)===null||l===void 0?void 0:l.chainId;if(!Q){const we=await N.request({method:"eth_chainId"});Q=gw(we)}const Se={domain:Y.host,address:G,statement:P,uri:Y.href,version:"1",chainId:Q,nonce:(c=q?.signInWithEthereum)===null||c===void 0?void 0:c.nonce,issuedAt:(h=(d=q?.signInWithEthereum)===null||d===void 0?void 0:d.issuedAt)!==null&&h!==void 0?h:new Date,expirationTime:(m=q?.signInWithEthereum)===null||m===void 0?void 0:m.expirationTime,notBefore:(g=q?.signInWithEthereum)===null||g===void 0?void 0:g.notBefore,requestId:(p=q?.signInWithEthereum)===null||p===void 0?void 0:p.requestId,resources:(S=q?.signInWithEthereum)===null||S===void 0?void 0:S.resources};A=yw(Se),C=await N.request({method:"personal_sign",params:[pw(A),G]})}try{const{data:U,error:$}=await ee(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:A,signature:C},!((b=n.options)===null||b===void 0)&&b.captchaToken?{gotrue_meta_security:{captcha_token:(T=n.options)===null||T===void 0?void 0:T.captchaToken}}:null),xform:hn});if($)throw $;if(!U||!U.session||!U.user){const P=new dr;return this._returnResult({data:{user:null,session:null},error:P})}return U.session&&(await this._saveSession(U.session),await this._notifyAllSubscribers("SIGNED_IN",U.session)),this._returnResult({data:Object.assign({},U),error:$})}catch(U){if(X(U))return this._returnResult({data:{user:null,session:null},error:U});throw U}}async signInWithSolana(n){var r,l,c,d,h,m,g,p,S,b,T,A;let C,U;if("message"in n)C=n.message,U=n.signature;else{const{chain:$,wallet:P,statement:q,options:N}=n;let Y;if(Ct())if(typeof P=="object")Y=P;else{const G=window;if("solana"in G&&typeof G.solana=="object"&&("signIn"in G.solana&&typeof G.solana.signIn=="function"||"signMessage"in G.solana&&typeof G.solana.signMessage=="function"))Y=G.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof P!="object"||!N?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");Y=P}const ue=new URL((r=N?.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in Y&&Y.signIn){const G=await Y.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},N?.signInWithSolana),{version:"1",domain:ue.host,uri:ue.href}),q?{statement:q}:null));let Q;if(Array.isArray(G)&&G[0]&&typeof G[0]=="object")Q=G[0];else if(G&&typeof G=="object"&&"signedMessage"in G&&"signature"in G)Q=G;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in Q&&"signature"in Q&&(typeof Q.signedMessage=="string"||Q.signedMessage instanceof Uint8Array)&&Q.signature instanceof Uint8Array)C=typeof Q.signedMessage=="string"?Q.signedMessage:new TextDecoder().decode(Q.signedMessage),U=Q.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in Y)||typeof Y.signMessage!="function"||!("publicKey"in Y)||typeof Y!="object"||!Y.publicKey||!("toBase58"in Y.publicKey)||typeof Y.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");C=[`${ue.host} wants you to sign in with your Solana account:`,Y.publicKey.toBase58(),...q?["",q,""]:[""],"Version: 1",`URI: ${ue.href}`,`Issued At: ${(c=(l=N?.signInWithSolana)===null||l===void 0?void 0:l.issuedAt)!==null&&c!==void 0?c:new Date().toISOString()}`,...!((d=N?.signInWithSolana)===null||d===void 0)&&d.notBefore?[`Not Before: ${N.signInWithSolana.notBefore}`]:[],...!((h=N?.signInWithSolana)===null||h===void 0)&&h.expirationTime?[`Expiration Time: ${N.signInWithSolana.expirationTime}`]:[],...!((m=N?.signInWithSolana)===null||m===void 0)&&m.chainId?[`Chain ID: ${N.signInWithSolana.chainId}`]:[],...!((g=N?.signInWithSolana)===null||g===void 0)&&g.nonce?[`Nonce: ${N.signInWithSolana.nonce}`]:[],...!((p=N?.signInWithSolana)===null||p===void 0)&&p.requestId?[`Request ID: ${N.signInWithSolana.requestId}`]:[],...!((b=(S=N?.signInWithSolana)===null||S===void 0?void 0:S.resources)===null||b===void 0)&&b.length?["Resources",...N.signInWithSolana.resources.map(Q=>`- ${Q}`)]:[]].join(`
37
+ `);const G=await Y.signMessage(new TextEncoder().encode(C),"utf8");if(!G||!(G instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");U=G}}try{const{data:$,error:P}=await ee(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:C,signature:wi(U)},!((T=n.options)===null||T===void 0)&&T.captchaToken?{gotrue_meta_security:{captcha_token:(A=n.options)===null||A===void 0?void 0:A.captchaToken}}:null),xform:hn});if(P)throw P;if(!$||!$.session||!$.user){const q=new dr;return this._returnResult({data:{user:null,session:null},error:q})}return $.session&&(await this._saveSession($.session),await this._notifyAllSubscribers("SIGNED_IN",$.session)),this._returnResult({data:Object.assign({},$),error:P})}catch($){if(X($))return this._returnResult({data:{user:null,session:null},error:$});throw $}}async _exchangeCodeForSession(n){const r=await bn(this.storage,`${this.storageKey}-code-verifier`),[l,c]=(r??"").split("/");try{if(!l&&this.flowType==="pkce")throw new zS;const{data:d,error:h}=await ee(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:n,code_verifier:l},xform:hn});if(await rt(this.storage,`${this.storageKey}-code-verifier`),h)throw h;if(!d||!d.session||!d.user){const m=new dr;return this._returnResult({data:{user:null,session:null,redirectType:null},error:m})}return d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers(c==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",d.session)),this._returnResult({data:Object.assign(Object.assign({},d),{redirectType:c??null}),error:h})}catch(d){if(await rt(this.storage,`${this.storageKey}-code-verifier`),X(d))return this._returnResult({data:{user:null,session:null,redirectType:null},error:d});throw d}}async signInWithIdToken(n){try{const{options:r,provider:l,token:c,access_token:d,nonce:h}=n,m=await ee(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:l,id_token:c,access_token:d,nonce:h,gotrue_meta_security:{captcha_token:r?.captchaToken}},xform:hn}),{data:g,error:p}=m;if(p)return this._returnResult({data:{user:null,session:null},error:p});if(!g||!g.session||!g.user){const S=new dr;return this._returnResult({data:{user:null,session:null},error:S})}return g.session&&(await this._saveSession(g.session),await this._notifyAllSubscribers("SIGNED_IN",g.session)),this._returnResult({data:g,error:p})}catch(r){if(X(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(n){var r,l,c,d,h;try{if("email"in n){const{email:m,options:g}=n;let p=null,S=null;this.flowType==="pkce"&&([p,S]=await vi(this.storage,this.storageKey));const{error:b}=await ee(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:m,data:(r=g?.data)!==null&&r!==void 0?r:{},create_user:(l=g?.shouldCreateUser)!==null&&l!==void 0?l:!0,gotrue_meta_security:{captcha_token:g?.captchaToken},code_challenge:p,code_challenge_method:S},redirectTo:g?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:b})}if("phone"in n){const{phone:m,options:g}=n,{data:p,error:S}=await ee(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:m,data:(c=g?.data)!==null&&c!==void 0?c:{},create_user:(d=g?.shouldCreateUser)!==null&&d!==void 0?d:!0,gotrue_meta_security:{captcha_token:g?.captchaToken},channel:(h=g?.channel)!==null&&h!==void 0?h:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:p?.message_id},error:S})}throw new Co("You must provide either an email or phone number.")}catch(m){if(await rt(this.storage,`${this.storageKey}-code-verifier`),X(m))return this._returnResult({data:{user:null,session:null},error:m});throw m}}async verifyOtp(n){var r,l;try{let c,d;"options"in n&&(c=(r=n.options)===null||r===void 0?void 0:r.redirectTo,d=(l=n.options)===null||l===void 0?void 0:l.captchaToken);const{data:h,error:m}=await ee(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},n),{gotrue_meta_security:{captcha_token:d}}),redirectTo:c,xform:hn});if(m)throw m;if(!h)throw new Error("An error occurred on token verification.");const g=h.session,p=h.user;return g?.access_token&&(await this._saveSession(g),await this._notifyAllSubscribers(n.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",g)),this._returnResult({data:{user:p,session:g},error:null})}catch(c){if(X(c))return this._returnResult({data:{user:null,session:null},error:c});throw c}}async signInWithSSO(n){var r,l,c,d,h;try{let m=null,g=null;this.flowType==="pkce"&&([m,g]=await vi(this.storage,this.storageKey));const p=await ee(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in n?{provider_id:n.providerId}:null),"domain"in n?{domain:n.domain}:null),{redirect_to:(l=(r=n.options)===null||r===void 0?void 0:r.redirectTo)!==null&&l!==void 0?l:void 0}),!((c=n?.options)===null||c===void 0)&&c.captchaToken?{gotrue_meta_security:{captcha_token:n.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:m,code_challenge_method:g}),headers:this.headers,xform:cw});return!((d=p.data)===null||d===void 0)&&d.url&&Ct()&&!(!((h=n.options)===null||h===void 0)&&h.skipBrowserRedirect)&&window.location.assign(p.data.url),this._returnResult(p)}catch(m){if(await rt(this.storage,`${this.storageKey}-code-verifier`),X(m))return this._returnResult({data:null,error:m});throw m}}async reauthenticate(){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate()):await this._reauthenticate()}async _reauthenticate(){try{return await this._useSession(async n=>{const{data:{session:r},error:l}=n;if(l)throw l;if(!r)throw new bt;const{error:c}=await ee(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:c})})}catch(n){if(X(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async resend(n){try{const r=`${this.url}/resend`;if("email"in n){const{email:l,type:c,options:d}=n;let h=null,m=null;this.flowType==="pkce"&&([h,m]=await vi(this.storage,this.storageKey));const{error:g}=await ee(this.fetch,"POST",r,{headers:this.headers,body:{email:l,type:c,gotrue_meta_security:{captcha_token:d?.captchaToken},code_challenge:h,code_challenge_method:m},redirectTo:d?.emailRedirectTo});return g&&await rt(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:g})}else if("phone"in n){const{phone:l,type:c,options:d}=n,{data:h,error:m}=await ee(this.fetch,"POST",r,{headers:this.headers,body:{phone:l,type:c,gotrue_meta_security:{captcha_token:d?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:h?.message_id},error:m})}throw new Co("You must provide either an email or phone number and a type")}catch(r){if(await rt(this.storage,`${this.storageKey}-code-verifier`),X(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async n=>n)):await this._useSession(async n=>n)}async _acquireLock(n,r){this._debug("#_acquireLock","begin",n);try{if(this.lockAcquired){const l=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),c=(async()=>(await l,await r()))();return this.pendingInLock.push((async()=>{try{await c}catch{}})()),c}return await this.lock(`lock:${this.storageKey}`,n,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const l=r();for(this.pendingInLock.push((async()=>{try{await l}catch{}})()),await l;this.pendingInLock.length;){const c=[...this.pendingInLock];await Promise.all(c),this.pendingInLock.splice(0,c.length)}return await l}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(n){this._debug("#_useSession","begin");try{const r=await this.__loadSession();return await n(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lock!=null&&!this.lockAcquired&&this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let n=null;const r=await bn(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?n=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!n)return{data:{session:null},error:null};const l=n.expires_at?n.expires_at*1e3-Date.now()<dd:!1;if(this._debug("#__loadSession()",`session has${l?"":" not"} expired`,"expires_at",n.expires_at),!l){if(this.userStorage){const h=await bn(this.userStorage,this.storageKey+"-user");h?.user?n.user=h.user:n.user=hd()}if(this.storage.isServer&&n.user&&!n.user.__isUserNotAvailableProxy){const h={value:this.suppressGetSessionWarning};n.user=rw(n.user,h),h.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:n},error:null}}const{data:c,error:d}=await this._callRefreshToken(n.refresh_token);if(d){if(!!(n.expires_at&&n.expires_at*1e3>Date.now())){const m=await bn(this.storage,this.storageKey);if(m&&m.refresh_token===n.refresh_token)return this._returnResult({data:{session:n},error:null})}return this._returnResult({data:{session:null},error:d})}return this._returnResult({data:{session:c},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(n){if(n)return await this._getUser(n);await this.initializePromise;let r;return this.lock!=null?r=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser()):r=await this._getUser(),r.data.user&&(this.suppressGetSessionWarning=!0),r}async _getUser(n){try{return n?await ee(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:n,xform:Ya}):await this._useSession(async r=>{var l,c,d;const{data:h,error:m}=r;if(m)throw m;return!(!((l=h.session)===null||l===void 0)&&l.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new bt}:await ee(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(d=(c=h.session)===null||c===void 0?void 0:c.access_token)!==null&&d!==void 0?d:void 0,xform:Ya})})}catch(r){if(X(r))return xo(r)&&(await this._removeSession(),await rt(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(n,r={}){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(n,r)):await this._updateUser(n,r)}async _updateUser(n,r={}){try{return await this._useSession(async l=>{const{data:c,error:d}=l;if(d)throw d;if(!c.session)throw new bt;const h=c.session;let m=null,g=null;this.flowType==="pkce"&&n.email!=null&&([m,g]=await vi(this.storage,this.storageKey));const{data:p,error:S}=await ee(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r?.emailRedirectTo,body:Object.assign(Object.assign({},n),{code_challenge:m,code_challenge_method:g}),jwt:h.access_token,xform:Ya});if(S)throw S;return h.user=p.user,await this._saveSession(h),await this._notifyAllSubscribers("USER_UPDATED",h),this._returnResult({data:{user:h.user},error:null})})}catch(l){if(await rt(this.storage,`${this.storageKey}-code-verifier`),X(l))return this._returnResult({data:{user:null},error:l});throw l}}async setSession(n){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(n)):await this._setSession(n)}async _setSession(n){try{if(!n.access_token||!n.refresh_token)throw new bt;const r=Date.now()/1e3;let l=r,c=!0,d=null;const{payload:h}=Ro(n.access_token);if(h.exp&&(l=h.exp,c=l<=r),c){const{data:m,error:g}=await this._callRefreshToken(n.refresh_token);if(g)return this._returnResult({data:{user:null,session:null},error:g});if(!m)return{data:{user:null,session:null},error:null};d=m}else{const{data:m,error:g}=await this._getUser(n.access_token);if(g)return this._returnResult({data:{user:null,session:null},error:g});d={access_token:n.access_token,refresh_token:n.refresh_token,user:m.user,token_type:"bearer",expires_in:l-r,expires_at:l},await this._saveSession(d),await this._notifyAllSubscribers("SIGNED_IN",d)}return this._returnResult({data:{user:d.user,session:d},error:null})}catch(r){if(X(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(n){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(n)):await this._refreshSession(n)}async _refreshSession(n){try{return await this._useSession(async r=>{var l;if(!n){const{data:h,error:m}=r;if(m)throw m;n=(l=h.session)!==null&&l!==void 0?l:void 0}if(!n?.refresh_token)throw new bt;const{data:c,error:d}=await this._callRefreshToken(n.refresh_token);return d?this._returnResult({data:{user:null,session:null},error:d}):c?this._returnResult({data:{user:c.user,session:c},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if(X(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(n,r){var l;try{if(!Ct())throw new Oo("No browser detected.");if(n.error||n.error_description||n.error_code)throw new Oo(n.error_description||"Error in URL with unspecified error_description",{error:n.error||"unspecified_error",code:n.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new Xg("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Oo("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!n.code)throw new Xg("No code detected.");const{data:N,error:Y}=await this._exchangeCodeForSession(n.code);if(Y)throw Y;const ue=new URL(window.location.href);return ue.searchParams.delete("code"),window.history.replaceState(window.history.state,"",ue.toString()),{data:{session:N.session,redirectType:(l=N.redirectType)!==null&&l!==void 0?l:null},error:null}}const{provider_token:c,provider_refresh_token:d,access_token:h,refresh_token:m,expires_in:g,expires_at:p,token_type:S}=n;if(!h||!g||!m||!S)throw new Oo("No session defined in URL");const b=Math.round(Date.now()/1e3),T=parseInt(g);let A=b+T;p&&(A=parseInt(p));const C=A-b;C*1e3<=ma&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${C}s, should have been closer to ${T}s`);const U=A-T;b-U>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",U,A,b):b-U<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",U,A,b);const{data:$,error:P}=await this._getUser(h);if(P)throw P;const q={provider_token:c,provider_refresh_token:d,access_token:h,expires_in:T,expires_at:A,refresh_token:m,token_type:S,user:$.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:q,redirectType:n.type},error:null})}catch(c){if(X(c))return this._returnResult({data:{session:null,redirectType:null},error:c});throw c}}_isImplicitGrantCallback(n){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),n):!!(n.access_token||n.error||n.error_description||n.error_code)}async _isPKCECallback(n){const r=await bn(this.storage,`${this.storageKey}-code-verifier`);return!!(n.code&&r)}async signOut(n={scope:"global"}){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(n)):await this._signOut(n)}async _signOut({scope:n}={scope:"global"}){return await this._useSession(async r=>{var l;const{data:c,error:d}=r;if(d&&!xo(d))return this._returnResult({error:d});const h=(l=c.session)===null||l===void 0?void 0:l.access_token;if(h){const{error:m}=await this.admin.signOut(h,n);if(m&&!(US(m)&&(m.status===404||m.status===401||m.status===403)||xo(m)))return this._returnResult({error:m})}return n!=="others"&&(await this._removeSession(),await rt(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(n){const r=VS(),l={id:r,callback:n,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,l),(async()=>(await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(r)}):await this._emitInitialSession(r)))(),{data:{subscription:l}}}async _emitInitialSession(n){return await this._useSession(async r=>{var l,c;try{const{data:{session:d},error:h}=r;if(h)throw h;await((l=this.stateChangeEmitters.get(n))===null||l===void 0?void 0:l.callback("INITIAL_SESSION",d)),this._debug("INITIAL_SESSION","callback id",n,"session",d)}catch(d){await((c=this.stateChangeEmitters.get(n))===null||c===void 0?void 0:c.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",n,"error",d),xo(d)?console.warn(d):console.error(d)}})}async resetPasswordForEmail(n,r={}){let l=null,c=null;this.flowType==="pkce"&&([l,c]=await vi(this.storage,this.storageKey,!0));try{return await ee(this.fetch,"POST",`${this.url}/recover`,{body:{email:n,code_challenge:l,code_challenge_method:c,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(d){if(await rt(this.storage,`${this.storageKey}-code-verifier`),X(d))return this._returnResult({data:null,error:d});throw d}}async getUserIdentities(){var n;try{const{data:r,error:l}=await this.getUser();if(l)throw l;return this._returnResult({data:{identities:(n=r.user.identities)!==null&&n!==void 0?n:[]},error:null})}catch(r){if(X(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(n){return"token"in n?this.linkIdentityIdToken(n):this.linkIdentityOAuth(n)}async linkIdentityOAuth(n){var r;try{const{data:l,error:c}=await this._useSession(async d=>{var h,m,g,p,S;const{data:b,error:T}=d;if(T)throw T;const A=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,n.provider,{redirectTo:(h=n.options)===null||h===void 0?void 0:h.redirectTo,scopes:(m=n.options)===null||m===void 0?void 0:m.scopes,queryParams:(g=n.options)===null||g===void 0?void 0:g.queryParams,skipBrowserRedirect:!0});return await ee(this.fetch,"GET",A,{headers:this.headers,jwt:(S=(p=b.session)===null||p===void 0?void 0:p.access_token)!==null&&S!==void 0?S:void 0})});if(c)throw c;return Ct()&&!(!((r=n.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(l?.url),this._returnResult({data:{provider:n.provider,url:l?.url},error:null})}catch(l){if(X(l))return this._returnResult({data:{provider:n.provider,url:null},error:l});throw l}}async linkIdentityIdToken(n){return await this._useSession(async r=>{var l;try{const{error:c,data:{session:d}}=r;if(c)throw c;const{options:h,provider:m,token:g,access_token:p,nonce:S}=n,b=await ee(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(l=d?.access_token)!==null&&l!==void 0?l:void 0,body:{provider:m,id_token:g,access_token:p,nonce:S,link_identity:!0,gotrue_meta_security:{captcha_token:h?.captchaToken}},xform:hn}),{data:T,error:A}=b;return A?this._returnResult({data:{user:null,session:null},error:A}):!T||!T.session||!T.user?this._returnResult({data:{user:null,session:null},error:new dr}):(T.session&&(await this._saveSession(T.session),await this._notifyAllSubscribers("USER_UPDATED",T.session)),this._returnResult({data:T,error:A}))}catch(c){if(await rt(this.storage,`${this.storageKey}-code-verifier`),X(c))return this._returnResult({data:{user:null,session:null},error:c});throw c}})}async unlinkIdentity(n){try{return await this._useSession(async r=>{var l,c;const{data:d,error:h}=r;if(h)throw h;return await ee(this.fetch,"DELETE",`${this.url}/user/identities/${n.identity_id}`,{headers:this.headers,jwt:(c=(l=d.session)===null||l===void 0?void 0:l.access_token)!==null&&c!==void 0?c:void 0})})}catch(r){if(X(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(n){const r="#_refreshAccessToken()";this._debug(r,"begin");try{const l=Date.now();return await XS(async c=>(c>0&&await JS(200*Math.pow(2,c-1)),this._debug(r,"refreshing attempt",c),await ee(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:n},headers:this.headers,xform:hn})),(c,d)=>{const h=200*Math.pow(2,c);return d&&Qg(d)&&Date.now()+h-l<ma})}catch(l){if(this._debug(r,"error",l),X(l))return this._returnResult({data:{session:null,user:null},error:l});throw l}finally{this._debug(r,"end")}}_isValidSession(n){return typeof n=="object"&&n!==null&&"access_token"in n&&"refresh_token"in n&&"expires_at"in n}async _handleProviderSignIn(n,r){const l=await this._getUrlForProvider(`${this.url}/authorize`,n,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",n,"options",r,"url",l),Ct()&&!r.skipBrowserRedirect&&window.location.assign(l),{data:{provider:n,url:l},error:null}}async _recoverAndRefresh(){var n,r;const l="#_recoverAndRefresh()";this._debug(l,"begin");try{const c=await bn(this.storage,this.storageKey);if(c&&this.userStorage){let h=await bn(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!h&&(h={user:c.user},await Sr(this.userStorage,this.storageKey+"-user",h)),c.user=(n=h?.user)!==null&&n!==void 0?n:hd()}else if(c&&!c.user&&!c.user){const h=await bn(this.storage,this.storageKey+"-user");h&&h?.user?(c.user=h.user,await rt(this.storage,this.storageKey+"-user"),await Sr(this.storage,this.storageKey,c)):c.user=hd()}if(this._debug(l,"session from storage",c),!this._isValidSession(c)){this._debug(l,"session is not valid"),c!==null&&await this._removeSession();return}const d=((r=c.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<dd;if(this._debug(l,`session has${d?"":" not"} expired with margin of ${dd}s`),d){if(this.autoRefreshToken&&c.refresh_token){const{error:h}=await this._callRefreshToken(c.refresh_token);h&&(BS(h)?this._debug(l,"refresh discarded by commit guard",h):this._debug(l,"refresh failed",h))}}else if(c.user&&c.user.__isUserNotAvailableProxy===!0)try{const{data:h,error:m}=await this._getUser(c.access_token);!m&&h?.user?(c.user=h.user,await this._saveSession(c),await this._notifyAllSubscribers("SIGNED_IN",c)):this._debug(l,"could not get user data, skipping SIGNED_IN notification")}catch(h){console.error("Error getting user data:",h),this._debug(l,"error getting user data, skipping SIGNED_IN notification",h)}else await this._notifyAllSubscribers("SIGNED_IN",c)}catch(c){this._debug(l,"error",c),console.error(c);return}finally{this._debug(l,"end")}}async _callRefreshToken(n){var r,l;if(!n)throw new bt;if(this.refreshingDeferred)return this.refreshingDeferred.promise;if(this.lastRefreshFailure&&this.lastRefreshFailure.refreshToken===n&&Date.now()<this.lastRefreshFailure.expiresAt)return this._debug("#_callRefreshToken()","returning cached failure (cooldown active)"),this.lastRefreshFailure.result;const c="#_callRefreshToken()";this._debug(c,"begin");try{this.refreshingDeferred=new Vo;const d=await bn(this.storage,this.storageKey),{data:h,error:m}=await this._refreshAccessToken(n);if(m)throw m;if(!h.session)throw new bt;const g=await bn(this.storage,this.storageKey);if(d!==null&&(g===null||g.refresh_token!==d.refresh_token)){this._debug(c,"commit guard: storage changed since refresh started, discarding rotated tokens",{startedWith:"present",nowHolds:g?"replaced":"cleared"});const T={data:null,error:new Wg};return this.refreshingDeferred.resolve(T),T}const S=this._sessionRemovalEpoch;if(await this._saveSession(h.session),this._sessionRemovalEpoch!==S){this._debug(c,"commit guard (post-save): _removeSession ran during _saveSession, undoing write"),await rt(this.storage,this.storageKey),this.userStorage&&await rt(this.userStorage,this.storageKey+"-user");const T={data:null,error:new Wg};return this.refreshingDeferred.resolve(T),T}await this._notifyAllSubscribers("TOKEN_REFRESHED",h.session);const b={data:h.session,error:null};return this.lastRefreshFailure=null,this.refreshingDeferred.resolve(b),b}catch(d){if(this._debug(c,"error",d),X(d)){const h={data:null,error:d};if(!Qg(d)){const m=await bn(this.storage,this.storageKey);!!(m?.expires_at&&m.expires_at*1e3>Date.now())?this._debug(c,"proactive refresh failed, access token still valid — preserving session"):await this._removeSession()}return this.lastRefreshFailure={refreshToken:n,result:h,expiresAt:Date.now()+CS},(r=this.refreshingDeferred)===null||r===void 0||r.resolve(h),h}throw(l=this.refreshingDeferred)===null||l===void 0||l.reject(d),d}finally{this.refreshingDeferred=null,this._debug(c,"end")}}async _notifyAllSubscribers(n,r,l=!0){const c=`#_notifyAllSubscribers(${n})`;this._debug(c,"begin",r,`broadcast = ${l}`);try{this.broadcastChannel&&l&&this.broadcastChannel.postMessage({event:n,session:r});const d=[],h=Array.from(this.stateChangeEmitters.values()).map(async m=>{try{await m.callback(n,r)}catch(g){d.push(g)}});if(await Promise.all(h),d.length>0){for(let m=0;m<d.length;m+=1)console.error(d[m]);throw d[0]}}finally{this._debug(c,"end")}}async _saveSession(n){this._debug("#_saveSession()",n),this.suppressGetSessionWarning=!0,await rt(this.storage,`${this.storageKey}-code-verifier`);const r=Object.assign({},n),l=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!l&&r.user&&await Sr(this.userStorage,this.storageKey+"-user",{user:r.user});const c=Object.assign({},r);delete c.user;const d=np(c);await Sr(this.storage,this.storageKey,d)}else{const c=np(r);await Sr(this.storage,this.storageKey,c)}}async _removeSession(){this._sessionRemovalEpoch+=1,this._debug("#_removeSession()"),this.lastRefreshFailure=null,this.suppressGetSessionWarning=!1,await rt(this.storage,this.storageKey),await rt(this.storage,this.storageKey+"-code-verifier"),await rt(this.storage,this.storageKey+"-user"),this.userStorage&&await rt(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const n=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{n&&Ct()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",n)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const n=setInterval(()=>this._autoRefreshTokenTick(),ma);this.autoRefreshTicker=n,n&&typeof n=="object"&&typeof n.unref=="function"?n.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(n);const r=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=r,r&&typeof r=="object"&&typeof r.unref=="function"?r.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(r)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const n=this.autoRefreshTicker;this.autoRefreshTicker=null,n&&clearInterval(n);const r=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,r&&clearTimeout(r)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async dispose(){var n;this._removeVisibilityChangedCallback(),await this._stopAutoRefresh(),(n=this.broadcastChannel)===null||n===void 0||n.close(),this.broadcastChannel=null,this.stateChangeEmitters.clear()}async _autoRefreshTokenTick(){if(this._debug("#_autoRefreshTokenTick()","begin"),this.lock!=null){try{await this._acquireLock(0,async()=>{try{const n=Date.now();try{return await this._useSession(async r=>{const{data:{session:l}}=r;if(!l||!l.refresh_token||!l.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const c=Math.floor((l.expires_at*1e3-n)/ma);this._debug("#_autoRefreshTokenTick()",`access token expires in ${c} ticks, a tick lasts ${ma}ms, refresh threshold is ${Ms} ticks`),c<=Ms&&await this._callRefreshToken(l.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(n){if(n instanceof fw)this._debug("auto refresh token tick lock not available");else throw n}return}if(this.refreshingDeferred!==null){this._debug("#_autoRefreshTokenTick()","refresh already in flight, skipping");return}try{const n=Date.now();try{await this._useSession(async r=>{const{data:{session:l}}=r;if(!l||!l.refresh_token||!l.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const c=Math.floor((l.expires_at*1e3-n)/ma);this._debug("#_autoRefreshTokenTick()",`access token expires in ${c} ticks, a tick lasts ${ma}ms, refresh threshold is ${Ms} ticks`),c<=Ms&&await this._callRefreshToken(l.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Ct()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(n){this._debug("#visibilityChangedCallback","error",n)}},window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(n){console.error("_handleVisibilityChange",n)}}async _onVisibilityChanged(n){const r=`#_onVisibilityChanged(${n})`;if(this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"){if(this.autoRefreshToken&&this._startAutoRefresh(),!n)if(await this.initializePromise,this.lock!=null)await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()});else{if(document.visibilityState!=="visible"){this._debug(r,"visibilityState is no longer visible, skipping recovery");return}await this._recoverAndRefresh()}}else document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(n,r,l){const c=[`provider=${encodeURIComponent(r)}`];if(l?.redirectTo&&c.push(`redirect_to=${encodeURIComponent(l.redirectTo)}`),l?.scopes&&c.push(`scopes=${encodeURIComponent(l.scopes)}`),this.flowType==="pkce"){const[d,h]=await vi(this.storage,this.storageKey),m=new URLSearchParams({code_challenge:`${encodeURIComponent(d)}`,code_challenge_method:`${encodeURIComponent(h)}`});c.push(m.toString())}if(l?.queryParams){const d=new URLSearchParams(l.queryParams);c.push(d.toString())}return l?.skipBrowserRedirect&&c.push(`skip_http_redirect=${l.skipBrowserRedirect}`),`${n}?${c.join("&")}`}async _unenroll(n){try{return await this._useSession(async r=>{var l;const{data:c,error:d}=r;return d?this._returnResult({data:null,error:d}):await ee(this.fetch,"DELETE",`${this.url}/factors/${n.factorId}`,{headers:this.headers,jwt:(l=c?.session)===null||l===void 0?void 0:l.access_token})})}catch(r){if(X(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(n){try{return await this._useSession(async r=>{var l,c;const{data:d,error:h}=r;if(h)return this._returnResult({data:null,error:h});const m=Object.assign({friendly_name:n.friendlyName,factor_type:n.factorType},n.factorType==="phone"?{phone:n.phone}:n.factorType==="totp"?{issuer:n.issuer}:{}),{data:g,error:p}=await ee(this.fetch,"POST",`${this.url}/factors`,{body:m,headers:this.headers,jwt:(l=d?.session)===null||l===void 0?void 0:l.access_token});return p?this._returnResult({data:null,error:p}):(n.factorType==="totp"&&g.type==="totp"&&(!((c=g?.totp)===null||c===void 0)&&c.qr_code)&&(g.totp.qr_code=`data:image/svg+xml;utf-8,${g.totp.qr_code}`),this._returnResult({data:g,error:null}))})}catch(r){if(X(r))return this._returnResult({data:null,error:r});throw r}}async _verify(n){const r=async()=>{try{return await this._useSession(async l=>{var c;const{data:d,error:h}=l;if(h)return this._returnResult({data:null,error:h});const m=Object.assign({challenge_id:n.challengeId},"webauthn"in n?{webauthn:Object.assign(Object.assign({},n.webauthn),{credential_response:n.webauthn.type==="create"?cp(n.webauthn.credential_response):up(n.webauthn.credential_response)})}:{code:n.code}),{data:g,error:p}=await ee(this.fetch,"POST",`${this.url}/factors/${n.factorId}/verify`,{body:m,headers:this.headers,jwt:(c=d?.session)===null||c===void 0?void 0:c.access_token});return p?this._returnResult({data:null,error:p}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+g.expires_in},g)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",g),this._returnResult({data:g,error:p}))})}catch(l){if(X(l))return this._returnResult({data:null,error:l});throw l}};return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,r):r()}async _challenge(n){const r=async()=>{try{return await this._useSession(async l=>{var c;const{data:d,error:h}=l;if(h)return this._returnResult({data:null,error:h});const m=await ee(this.fetch,"POST",`${this.url}/factors/${n.factorId}/challenge`,{body:n,headers:this.headers,jwt:(c=d?.session)===null||c===void 0?void 0:c.access_token});if(m.error)return m;const{data:g}=m;if(g.type!=="webauthn")return{data:g,error:null};switch(g.webauthn.type){case"create":return{data:Object.assign(Object.assign({},g),{webauthn:Object.assign(Object.assign({},g.webauthn),{credential_options:Object.assign(Object.assign({},g.webauthn.credential_options),{publicKey:lp(g.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},g),{webauthn:Object.assign(Object.assign({},g.webauthn),{credential_options:Object.assign(Object.assign({},g.webauthn.credential_options),{publicKey:op(g.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(l){if(X(l))return this._returnResult({data:null,error:l});throw l}};return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,r):r()}async _challengeAndVerify(n){const{data:r,error:l}=await this._challenge({factorId:n.factorId});return l?this._returnResult({data:null,error:l}):await this._verify({factorId:n.factorId,challengeId:r.id,code:n.code})}async _listFactors(){var n;const{data:{user:r},error:l}=await this.getUser();if(l)return{data:null,error:l};const c={all:[],phone:[],totp:[],webauthn:[]};for(const d of(n=r?.factors)!==null&&n!==void 0?n:[])c.all.push(d),d.status==="verified"&&c[d.factor_type].push(d);return{data:c,error:null}}async _getAuthenticatorAssuranceLevel(n){var r,l,c,d;if(n)try{const{payload:A}=Ro(n);let C=null;A.aal&&(C=A.aal);let U=C;const{data:{user:$},error:P}=await this.getUser(n);if(P)return this._returnResult({data:null,error:P});((l=(r=$?.factors)===null||r===void 0?void 0:r.filter(Y=>Y.status==="verified"))!==null&&l!==void 0?l:[]).length>0&&(U="aal2");const N=A.amr||[];return{data:{currentLevel:C,nextLevel:U,currentAuthenticationMethods:N},error:null}}catch(A){if(X(A))return this._returnResult({data:null,error:A});throw A}const{data:{session:h},error:m}=await this.getSession();if(m)return this._returnResult({data:null,error:m});if(!h)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:g}=Ro(h.access_token);let p=null;g.aal&&(p=g.aal);let S=p;((d=(c=h.user.factors)===null||c===void 0?void 0:c.filter(A=>A.status==="verified"))!==null&&d!==void 0?d:[]).length>0&&(S="aal2");const T=g.amr||[];return{data:{currentLevel:p,nextLevel:S,currentAuthenticationMethods:T},error:null}}async _getAuthorizationDetails(n){try{return await this._useSession(async r=>{const{data:{session:l},error:c}=r;return c?this._returnResult({data:null,error:c}):l?await ee(this.fetch,"GET",`${this.url}/oauth/authorizations/${n}`,{headers:this.headers,jwt:l.access_token,xform:d=>({data:d,error:null})}):this._returnResult({data:null,error:new bt})})}catch(r){if(X(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(n,r){try{return await this._useSession(async l=>{const{data:{session:c},error:d}=l;if(d)return this._returnResult({data:null,error:d});if(!c)return this._returnResult({data:null,error:new bt});const h=await ee(this.fetch,"POST",`${this.url}/oauth/authorizations/${n}/consent`,{headers:this.headers,jwt:c.access_token,body:{action:"approve"},xform:m=>({data:m,error:null})});return h.data&&h.data.redirect_url&&Ct()&&!r?.skipBrowserRedirect&&window.location.assign(h.data.redirect_url),h})}catch(l){if(X(l))return this._returnResult({data:null,error:l});throw l}}async _denyAuthorization(n,r){try{return await this._useSession(async l=>{const{data:{session:c},error:d}=l;if(d)return this._returnResult({data:null,error:d});if(!c)return this._returnResult({data:null,error:new bt});const h=await ee(this.fetch,"POST",`${this.url}/oauth/authorizations/${n}/consent`,{headers:this.headers,jwt:c.access_token,body:{action:"deny"},xform:m=>({data:m,error:null})});return h.data&&h.data.redirect_url&&Ct()&&!r?.skipBrowserRedirect&&window.location.assign(h.data.redirect_url),h})}catch(l){if(X(l))return this._returnResult({data:null,error:l});throw l}}async _listOAuthGrants(){try{return await this._useSession(async n=>{const{data:{session:r},error:l}=n;return l?this._returnResult({data:null,error:l}):r?await ee(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:c=>({data:c,error:null})}):this._returnResult({data:null,error:new bt})})}catch(n){if(X(n))return this._returnResult({data:null,error:n});throw n}}async _revokeOAuthGrant(n){try{return await this._useSession(async r=>{const{data:{session:l},error:c}=r;return c?this._returnResult({data:null,error:c}):l?(await ee(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:l.access_token,query:{client_id:n.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new bt})})}catch(r){if(X(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(n,r={keys:[]}){let l=r.keys.find(m=>m.kid===n);if(l)return l;const c=Date.now();if(l=this.jwks.keys.find(m=>m.kid===n),l&&this.jwks_cached_at+LS>c)return l;const{data:d,error:h}=await ee(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(h)throw h;return!d.keys||d.keys.length===0||(this.jwks=d,this.jwks_cached_at=c,l=d.keys.find(m=>m.kid===n),!l)?null:l}async getClaims(n,r={}){try{let l=n;if(!l){const{data:A,error:C}=await this.getSession();if(C||!A.session)return this._returnResult({data:null,error:C});l=A.session.access_token}const{header:c,payload:d,signature:h,raw:{header:m,payload:g}}=Ro(l);if(!r?.allowExpired)try{nw(d.exp)}catch(A){throw new Mo(A instanceof Error?A.message:"JWT validation failed")}const p=!c.alg||c.alg.startsWith("HS")||!c.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(c.kid,r?.keys?{keys:r.keys}:r?.jwks);if(!p){const{error:A}=await this.getUser(l);if(A)throw A;return{data:{claims:d,header:c,signature:h},error:null}}const S=aw(c.alg),b=await crypto.subtle.importKey("jwk",p,S,!0,["verify"]);if(!await crypto.subtle.verify(S,b,h,IS(`${m}.${g}`)))throw new Mo("Invalid JWT signature");return{data:{claims:d,header:c,signature:h},error:null}}catch(l){if(X(l))return this._returnResult({data:null,error:l});throw l}}async signInWithPasskey(n){var r,l,c;Sn(this.experimental);try{if(!Ho())return this._returnResult({data:null,error:new Tn("Browser does not support WebAuthn",null)});const{data:d,error:h}=await this._startPasskeyAuthentication({options:{captchaToken:(r=n?.options)===null||r===void 0?void 0:r.captchaToken}});if(h||!d)return this._returnResult({data:null,error:h});const m=op(d.options),g=(c=(l=n?.options)===null||l===void 0?void 0:l.signal)!==null&&c!==void 0?c:Ud.createNewAbortSignal(),{data:p,error:S}=await Vp({publicKey:m,signal:g});if(S||!p)return this._returnResult({data:null,error:S??new Tn("WebAuthn ceremony failed",null)});const b=up(p);return this._verifyPasskeyAuthentication({challengeId:d.challenge_id,credential:b})}catch(d){if(X(d))return this._returnResult({data:null,error:d});throw d}}async registerPasskey(n){var r,l;Sn(this.experimental);try{if(!Ho())return this._returnResult({data:null,error:new Tn("Browser does not support WebAuthn",null)});const{data:c,error:d}=await this._startPasskeyRegistration();if(d||!c)return this._returnResult({data:null,error:d});const h=lp(c.options),m=(l=(r=n?.options)===null||r===void 0?void 0:r.signal)!==null&&l!==void 0?l:Ud.createNewAbortSignal(),{data:g,error:p}=await Gp({publicKey:h,signal:m});if(p||!g)return this._returnResult({data:null,error:p??new Tn("WebAuthn ceremony failed",null)});const S=cp(g);return this._verifyPasskeyRegistration({challengeId:c.challenge_id,credential:S})}catch(c){if(X(c))return this._returnResult({data:null,error:c});throw c}}async _startPasskeyRegistration(){Sn(this.experimental);try{return await this._useSession(async n=>{const{data:{session:r},error:l}=n;if(l)return this._returnResult({data:null,error:l});if(!r)return this._returnResult({data:null,error:new bt});const{data:c,error:d}=await ee(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:r.access_token,body:{}});return d?this._returnResult({data:null,error:d}):this._returnResult({data:c,error:null})})}catch(n){if(X(n))return this._returnResult({data:null,error:n});throw n}}async _verifyPasskeyRegistration(n){Sn(this.experimental);try{return await this._useSession(async r=>{const{data:{session:l},error:c}=r;if(c)return this._returnResult({data:null,error:c});if(!l)return this._returnResult({data:null,error:new bt});const{data:d,error:h}=await ee(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:l.access_token,body:{challenge_id:n.challengeId,credential:n.credential}});return h?this._returnResult({data:null,error:h}):this._returnResult({data:d,error:null})})}catch(r){if(X(r))return this._returnResult({data:null,error:r});throw r}}async _startPasskeyAuthentication(n){var r;Sn(this.experimental);try{const{data:l,error:c}=await ee(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(r=n?.options)===null||r===void 0?void 0:r.captchaToken}}});return c?this._returnResult({data:null,error:c}):this._returnResult({data:l,error:null})}catch(l){if(X(l))return this._returnResult({data:null,error:l});throw l}}async _verifyPasskeyAuthentication(n){Sn(this.experimental);try{const{data:r,error:l}=await ee(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:n.challengeId,credential:n.credential},xform:hn});return l?this._returnResult({data:null,error:l}):(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:r,error:null}))}catch(r){if(X(r))return this._returnResult({data:null,error:r});throw r}}async _listPasskeys(){Sn(this.experimental);try{return await this._useSession(async n=>{const{data:{session:r},error:l}=n;if(l)return this._returnResult({data:null,error:l});if(!r)return this._returnResult({data:null,error:new bt});const{data:c,error:d}=await ee(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:r.access_token,xform:h=>({data:h,error:null})});return d?this._returnResult({data:null,error:d}):this._returnResult({data:c,error:null})})}catch(n){if(X(n))return this._returnResult({data:null,error:n});throw n}}async _updatePasskey(n){Sn(this.experimental);try{return await this._useSession(async r=>{const{data:{session:l},error:c}=r;if(c)return this._returnResult({data:null,error:c});if(!l)return this._returnResult({data:null,error:new bt});const{data:d,error:h}=await ee(this.fetch,"PATCH",`${this.url}/passkeys/${n.passkeyId}`,{headers:this.headers,jwt:l.access_token,body:{friendly_name:n.friendlyName}});return h?this._returnResult({data:null,error:h}):this._returnResult({data:d,error:null})})}catch(r){if(X(r))return this._returnResult({data:null,error:r});throw r}}async _deletePasskey(n){Sn(this.experimental);try{return await this._useSession(async r=>{const{data:{session:l},error:c}=r;if(c)return this._returnResult({data:null,error:c});if(!l)return this._returnResult({data:null,error:new bt});const{error:d}=await ee(this.fetch,"DELETE",`${this.url}/passkeys/${n.passkeyId}`,{headers:this.headers,jwt:l.access_token,noResolveJson:!0});return d?this._returnResult({data:null,error:d}):this._returnResult({data:null,error:null})})}catch(r){if(X(r))return this._returnResult({data:null,error:r});throw r}}}Ws.nextInstanceID={};const xw=Ws,Cw="2.110.0";let zs="",$o;if(typeof Deno<"u"){var md;zs="deno",$o=(md=Deno.version)===null||md===void 0?void 0:md.deno}else if(typeof document<"u")zs="web";else if(typeof navigator<"u"&&navigator.product==="ReactNative")zs="react-native";else{var gd;zs="node",$o=typeof process<"u"?(gd=process.version)===null||gd===void 0?void 0:gd.replace(/^v/,""):void 0}const Kp=[`runtime=${zs}`];$o&&Kp.push(`runtime-version=${$o}`);const Ow={"X-Client-Info":`supabase-js/${Cw}; ${Kp.join("; ")}`},Rw={headers:Ow},jw={schema:"public"},Nw={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Lw={},Dw={enabled:!1,respectSamplingDecision:!0};function Uw(i,n,r,l){function c(d){return d instanceof r?d:new r(function(h){h(d)})}return new(r||(r=Promise))(function(d,h){function m(S){try{p(l.next(S))}catch(b){h(b)}}function g(S){try{p(l.throw(S))}catch(b){h(b)}}function p(S){S.done?d(S.value):c(S.value).then(m,g)}p((l=l.apply(i,[])).next())})}let pd=null;const Mw="@opentelemetry/api";function zw(){return pd===null&&(pd=import(Mw).catch(()=>null)),pd}function Bw(){return Uw(this,void 0,void 0,function*(){try{const i=yield zw();if(!i||!i.propagation||!i.context)return null;const n={};i.propagation.inject(i.context.active(),n);const r=n.traceparent;return r?{traceparent:r,tracestate:n.tracestate,baggage:n.baggage}:null}catch{return null}})}function Hw(i){if(!i||typeof i!="string")return null;const n=i.split("-");if(n.length!==4)return null;const[r,l,c,d]=n;if(r.length!==2||l.length!==32||c.length!==16||d.length!==2)return null;const h=/^[0-9a-f]+$/i;return!h.test(r)||!h.test(l)||!h.test(c)||!h.test(d)||l==="00000000000000000000000000000000"||c==="0000000000000000"?null:{version:r,traceId:l,parentId:c,traceFlags:d,isSampled:(parseInt(d,16)&1)===1}}function qw(i,n){if(!i||!n||n.length===0)return!1;let r;if(i instanceof URL)r=i;else try{r=new URL(i)}catch{return!1}for(const l of n)try{if(typeof l=="string"){if($w(r.hostname,l))return!0}else if(l instanceof RegExp){if(l.test(r.hostname))return!0}else if(typeof l=="function"&&l(r))return!0}catch{continue}return!1}function $w(i,n){if(n===i)return!0;if(n.startsWith("*.")){const r=n.slice(2);if(i.endsWith(r)&&(i===r||i.endsWith("."+r)))return!0}return!1}function Pw(i){const n=[];try{const r=new URL(i);n.push(r.hostname)}catch{}return n.push("*.supabase.co","*.supabase.in"),n.push("localhost","127.0.0.1","[::1]"),n}function Zs(i){"@babel/helpers - typeof";return Zs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Zs(i)}function Iw(i,n){if(Zs(i)!="object"||!i)return i;var r=i[Symbol.toPrimitive];if(r!==void 0){var l=r.call(i,n);if(Zs(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(i)}function Gw(i){var n=Iw(i,"string");return Zs(n)=="symbol"?n:n+""}function Vw(i,n,r){return(n=Gw(n))in i?Object.defineProperty(i,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):i[n]=r,i}function dp(i,n){var r=Object.keys(i);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(i);n&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(i,c).enumerable})),r.push.apply(r,l)}return r}function et(i){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?dp(Object(r),!0).forEach(function(l){Vw(i,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(r)):dp(Object(r)).forEach(function(l){Object.defineProperty(i,l,Object.getOwnPropertyDescriptor(r,l))})}return i}const Kw=i=>i?(...n)=>i(...n):(...n)=>fetch(...n),Yw=()=>Headers,Jw=(i,n,r,l,c)=>{const d=Kw(l),h=Yw(),m=c?.enabled===!0,g=c?.respectSamplingDecision!==!1,p=m?Pw(n):null;return async(S,b)=>{var T;const A=(T=await r())!==null&&T!==void 0?T:i;let C=new h(b?.headers);if(C.has("apikey")||C.set("apikey",i),C.has("Authorization")||C.set("Authorization",`Bearer ${A}`),p){const U=await Xw(S,p,g);U&&(U.traceparent&&!C.has("traceparent")&&C.set("traceparent",U.traceparent),U.tracestate&&!C.has("tracestate")&&C.set("tracestate",U.tracestate),U.baggage&&!C.has("baggage")&&C.set("baggage",U.baggage))}return d(S,et(et({},b),{},{headers:C}))}};async function Xw(i,n,r){if(!qw(typeof i=="string"||i instanceof URL?i:i.url,n))return null;const l=await Bw();if(!l||!l.traceparent)return null;if(r){const c=Hw(l.traceparent);if(c&&!c.isSampled)return null}return l}function hp(i){return typeof i=="boolean"?{enabled:i}:i}function Qw(i){return i.endsWith("/")?i:i+"/"}function Ww(i,n){var r,l,c,d,h,m;const{db:g,auth:p,realtime:S,global:b}=i,{db:T,auth:A,realtime:C,global:U}=n,$=hp(i.tracePropagation),P=hp(n.tracePropagation),q={db:et(et({},T),g),auth:et(et({},A),p),realtime:et(et({},C),S),storage:{},global:et(et(et({},U),b),{},{headers:et(et({},(r=U?.headers)!==null&&r!==void 0?r:{}),(l=b?.headers)!==null&&l!==void 0?l:{})}),tracePropagation:{enabled:(c=(d=$?.enabled)!==null&&d!==void 0?d:P?.enabled)!==null&&c!==void 0?c:!1,respectSamplingDecision:(h=(m=$?.respectSamplingDecision)!==null&&m!==void 0?m:P?.respectSamplingDecision)!==null&&h!==void 0?h:!0},accessToken:async()=>""};return i.accessToken?q.accessToken=i.accessToken:delete q.accessToken,q}function Zw(i){const n=i?.trim();if(!n)throw new Error("supabaseUrl is required.");if(!n.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(Qw(n))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var Fw=class extends xw{constructor(i){super(i)}},e_=class{constructor(i,n,r){var l,c;this.supabaseUrl=i,this.supabaseKey=n;const d=Zw(i);if(!n)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",d),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",d),this.storageUrl=new URL("storage/v1",d),this.functionsUrl=new URL("functions/v1",d);const h=`sb-${d.hostname.split(".")[0]}-auth-token`,m={db:jw,realtime:Lw,auth:et(et({},Nw),{},{storageKey:h}),global:Rw,tracePropagation:Dw},g=Ww(r??{},m);if(this.settings=g,this.storageKey=(l=g.auth.storageKey)!==null&&l!==void 0?l:"",this.headers=(c=g.global.headers)!==null&&c!==void 0?c:{},g.accessToken)this.accessToken=g.accessToken,this.auth=new Proxy({},{get:(S,b)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(b)} is not possible`)}});else{var p;this.auth=this._initSupabaseAuthClient((p=g.auth)!==null&&p!==void 0?p:{},this.headers,g.global.fetch)}this.fetch=Jw(n,i,this._getAccessToken.bind(this),g.global.fetch,g.tracePropagation),this.realtime=this._initRealtimeClient(et({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},g.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(S=>this.realtime.setAuth(S)).catch(S=>console.warn("Failed to set initial Realtime auth token:",S)),this.rest=new cb(new URL("rest/v1",d).href,{headers:this.headers,schema:g.db.schema,fetch:this.fetch,timeout:g.db.timeout,urlLengthLimit:g.db.urlLengthLimit}),this.storage=new xS(this.storageUrl.href,this.headers,this.fetch,r?.storage),g.accessToken||this._listenForAuthEvents()}get functions(){return new eb(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(i){return this.rest.from(i)}schema(i){return this.rest.schema(i)}rpc(i,n={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(i,n,r)}channel(i,n={config:{}}){return this.realtime.channel(i,n)}getChannels(){return this.realtime.getChannels()}removeChannel(i){return this.realtime.removeChannel(i)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var i=this,n,r;if(i.accessToken)return await i.accessToken();const{data:l}=await i.auth.getSession();return(n=(r=l.session)===null||r===void 0?void 0:r.access_token)!==null&&n!==void 0?n:i.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:i,persistSession:n,detectSessionInUrl:r,storage:l,userStorage:c,storageKey:d,flowType:h,lock:m,debug:g,throwOnError:p,experimental:S,lockAcquireTimeout:b,skipAutoInitialize:T},A,C){const U={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Fw({url:this.authUrl.href,headers:et(et({},U),A),storageKey:d,autoRefreshToken:i,persistSession:n,detectSessionInUrl:r,storage:l,userStorage:c,flowType:h,lock:m,debug:g,throwOnError:p,experimental:S,fetch:C,lockAcquireTimeout:b,skipAutoInitialize:T,hasCustomAuthorizationHeader:Object.keys(this.headers).some($=>$.toLowerCase()==="authorization")})}_initRealtimeClient(i){return new Wb(this.realtimeUrl.href,et(et({},i),{},{params:et(et({},{apikey:this.supabaseKey}),i?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((i,n)=>{this._handleTokenChanged(i,"CLIENT",n?.access_token)})}_handleTokenChanged(i,n,r){(i==="TOKEN_REFRESHED"||i==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):i==="SIGNED_OUT"&&(this.realtime.setAuth(),n=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const t_=(i,n,r)=>new e_(i,n,r);function n_(){if(typeof window<"u")return!1;const i=globalThis.process;if(!i)return!1;const n=i.version;if(n==null)return!1;const r=n.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=20:!1}n_()&&console.warn("⚠️ Node.js 20 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 22 or later. For more information, visit: https://github.com/orgs/supabase/discussions/45715");const a_="https://otbyfkjxrkngvjziawki.supabase.co",i_="sb_publishable_NpUs0RDJH2YnllsqTKO6TQ_1jTdSsNQ",Nn=t_(a_,i_,{auth:{autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"pkce",storageKey:"livedesk.mindexec.supabase.auth"}}),yd=new WeakMap;function r_(i){return String(i.frameMode||i.mode||"").toLowerCase()==="mode2-lz4"||String(i.compression||"").toLowerCase()==="lz4"||String(i.mimeType||"").toLowerCase()==="application/vnd.livedesk.lz4-raw"}function s_(i){return String(i.frameMode||i.mode||"").toLowerCase()==="mode3-h264-hw"||String(i.codec||"").toLowerCase()==="h264"||String(i.mimeType||"").toLowerCase()==="video/h264"}function fp(i,n,r){let l=r,c=n;if(l===15){let d=255;for(;d===255;){if(c>=i.length)throw new Error("Invalid LZ4 block: length overrun.");d=i[c],c+=1,l+=d}}return{length:l,cursor:c}}function l_(i,n){const r=new Uint8Array(n);let l=0,c=0;for(;l<i.length;){const d=i[l];l+=1;const h=fp(i,l,d>>4);l=h.cursor;const m=h.length;if(l+m>i.length||c+m>r.length)throw new Error("Invalid LZ4 block: literal overrun.");if(r.set(i.subarray(l,l+m),c),l+=m,c+=m,l>=i.length)break;if(l+2>i.length)throw new Error("Invalid LZ4 block: missing offset.");const g=i[l]|i[l+1]<<8;if(l+=2,g<=0||g>c)throw new Error("Invalid LZ4 block: bad match offset.");const p=fp(i,l,d&15);l=p.cursor;const S=p.length+4;if(c+S>r.length)throw new Error("Invalid LZ4 block: match overrun.");let b=c-g;for(let T=0;T<S;T+=1)r[c]=r[b],c+=1,b+=1}if(c!==r.length)throw new Error("Invalid LZ4 block: incomplete output.");return r}function o_(i){const n=Math.max(1,Math.floor(i.width||0)),r=Math.max(1,Math.floor(i.height||0)),l=Math.max(1,Math.floor(i.bytesPerPixel||4)),c=Math.max(n*r*l,Math.floor(i.uncompressedByteLength||0)),d=l_(new Uint8Array(i.payload),c),h=String(i.pixelFormat||i.codec||"").toLowerCase();if(l!==4)throw new Error(`Unsupported mode2 pixel size: ${l}`);const m=new Uint8ClampedArray(n*r*4);if(h==="rgba32"||h==="rgba")m.set(d.subarray(0,m.length));else for(let g=0,p=0;p<m.length;g+=4,p+=4)m[p]=d[g+2],m[p+1]=d[g+1],m[p+2]=d[g],m[p+3]=d[g+3];return new ImageData(m,n,r)}function c_(i){const n=window.VideoDecoder;if(!n||!window.EncodedVideoChunk)throw new Error("WebCodecs H.264 decode is not supported in this browser.");const r=yd.get(i);if(r&&r.decoder.state!=="closed")return r;const c={decoder:new n({output:d=>{try{const h=d.displayWidth||d.codedWidth||i.width||960,m=d.displayHeight||d.codedHeight||i.height||540;(i.width!==h||i.height!==m)&&(i.width=h,i.height=m),i.getContext("2d")?.drawImage(d,0,0,h,m)}finally{d.close()}},error:()=>{yd.delete(i)}}),configured:!1,keyFrameSeen:!1};return yd.set(i,c),c}function u_(i,n){const r=c_(i);if(!r.configured){const d={codec:"avc1.42E01E",codedWidth:Math.max(1,Math.floor(n.width||960)),codedHeight:Math.max(1,Math.floor(n.height||540)),hardwareAcceleration:"prefer-hardware",optimizeForLatency:!0,avc:{format:String(n.h264Format||"").toLowerCase()==="avc"?"avc":"annexb"}};r.decoder.configure(d),r.configured=!0}const l=n.isKeyFrame===!0||String(n.chunkType||"").toLowerCase()==="key";if(!l&&!r.keyFrameSeen)return;l&&(r.keyFrameSeen=!0);const c=new EncodedVideoChunk({type:l?"key":"delta",timestamp:Math.max(0,Math.floor(n.timestampUs||n.frameSeq*1e3)),duration:Math.max(0,Math.floor(n.durationUs||0))||void 0,data:n.payload});r.decoder.decode(c)}async function d_(i,n,r){if(s_(n)){r()||u_(i,n);return}if(r_(n)){const g=o_(n);if(r())return;(i.width!==g.width||i.height!==g.height)&&(i.width=g.width,i.height=g.height),i.getContext("2d")?.putImageData(g,0,0);return}const l=new Blob([n.payload],{type:n.mimeType}),c=await createImageBitmap(l);if(r()){c.close();return}const d=n.width||c.width||960,h=n.height||c.height||540;(i.width!==d||i.height!==h)&&(i.width=d,i.height=h);const m=i.getContext("2d");m&&(m.clearRect(0,0,d,h),m.drawImage(c,0,0,d,h)),c.close()}const $s=5179,jt=el(`http://127.0.0.1:${$s}`);function h_(i){const n=i.split(".").map(r=>Number(r));return n.length===4&&n.every(r=>Number.isInteger(r)&&r>=0&&r<=255)?n:[]}function f_(i){const n=i.trim().toLowerCase();return n==="localhost"||n==="127.0.0.1"||n==="::1"||n==="[::1]"}function m_(i){const n=i.trim().toLowerCase();return!n||n==="0.0.0.0"||n==="::"||n==="[::]"}function g_(i){const n=h_(i);return n.length===0?!1:n[0]===10||n[0]===172&&n[1]>=16&&n[1]<=31||n[0]===192&&n[1]===168}function p_(i){return i.includes(":")&&!i.startsWith("[")?`[${i}]`:i}function y_(i){const n=String(i||"").trim();if(!n)return null;const r=/^[a-z][a-z\d+.-]*:\/\//i.test(n)?n:`tcp://${n}`;try{const l=new URL(r),c=l.hostname.replace(/^\[|\]$/g,""),d=Number(l.port);return!c||!Number.isInteger(d)||d<1||d>65535||m_(c)?null:{host:c,port:d}}catch{return null}}function el(i){const n=String(i||"").trim()||`http://127.0.0.1:${$s}`,r=/^[a-z][a-z\d+.-]*:\/\//i.test(n)?n:`http://${n}`;try{const l=new URL(r);return l.port||(l.port=String($s)),l.hash="",l.search="",l.toString().replace(/\/+$/,"")}catch{return`http://127.0.0.1:${$s}`}}function v_(i){const n=y_(i);return n?el(`http://${p_(n.host)}:${$s}`):""}function mp(i){const r=[i?.endpoint,...Array.isArray(i?.endpoint_candidates)?i.endpoint_candidates:[]].map(l=>v_(String(l||""))).filter(Boolean);return[...new Set(r)]}function Ps(i=jt){if(!(typeof window>"u"||window.location.protocol!=="https:"))try{const n=new URL(i);if(n.protocol!=="http:")return;if(f_(n.hostname))return"loopback";if(g_(n.hostname))return"local"}catch{return}}function Hd(i,n=jt){const r=new URL(i,el(n));return r.protocol=r.protocol==="https:"?"wss:":"ws:",r.toString()}async function wn(i,n,r=jt){const l=el(r),c={...n,headers:{"Content-Type":"application/json",...n?.headers||{}},cache:"no-store"},d=Ps(l);d&&(c.targetAddressSpace=d);let h;try{h=await fetch(`${l}${i}`,c)}catch(m){throw d?new Error("LiveDesk Hub is not reachable at this local network address. If Chrome shows a local network prompt, allow it; otherwise restart the Hub so port 5179 is open on the network."):m}if(!h.ok)throw new Error(`${h.status} ${h.statusText}`);return await h.json()}function b_(i){if(!i)return"-";const n=Date.now()-Date.parse(i);return Number.isFinite(n)?n<1e3?"now":n<6e4?`${Math.round(n/1e3)}s`:n<36e5?`${Math.round(n/6e4)}m`:`${Math.round(n/36e5)}h`:"-"}async function Ns(i){await navigator.clipboard.writeText(i)}const gp="livedesk_remote_host_targets",S_="livedesk_entitlements";function w_(i){const r=(Array.isArray(i)?i:[i||jt]).map(l=>el(l||jt));return[...new Set(r.filter(Boolean))]}function __(){const[i,n]=I.useState(null),[r,l]=I.useState(!0);return I.useEffect(()=>{let c=!0;Nn.auth.getSession().then(({data:h})=>{c&&(n(h.session??null),l(!1))});const{data:{subscription:d}}=Nn.auth.onAuthStateChange((h,m)=>{n(m),l(!1)});return()=>{c=!1,d.unsubscribe()}},[]),{session:i,loading:r}}function T_(i,n=!0){const[r,l]=I.useState(null),[c,d]=I.useState([]),[h,m]=I.useState(""),[g,p]=I.useState(""),[S,b]=I.useState(0),T=Array.isArray(i)?i.join(`
38
+ `):String(i||""),A=I.useMemo(()=>w_(i),[T]),C=I.useMemo(()=>A.find(P=>Ps(P)==="loopback")||A[0]||jt,[A]),U=I.useCallback(async()=>{if(!n){l(null),d([]),p(""),m("");return}let P=null;for(const q of A)try{const[N,Y]=await Promise.all([wn("/api/remote/status",void 0,q),wn("/api/remote/devices",void 0,q)]);l(N),d(Y.devices||[]),p(q),m("");return}catch(N){P=N}throw p(""),P||new Error("No LiveDesk Hub endpoint is reachable.")},[n,A]),$=I.useCallback(()=>{U().catch(P=>{m(P instanceof Error?P.message:String(P))}),b(P=>P+1)},[U]);return I.useEffect(()=>{if(!n){l(null),d([]),p(""),m("");return}let P=!0;const q=async()=>{try{await U()}catch(Y){P&&m(Y instanceof Error?Y.message:String(Y))}};q();const N=window.setInterval(q,2500);return()=>{P=!1,window.clearInterval(N)}},[n,U,S]),{status:r,devices:c,error:h,refresh:$,hubBaseUrl:g||C,hubCandidates:A}}function k_(i){const[n,r]=I.useState(null),[l,c]=I.useState(""),d=i?.user?.id||"",h=I.useCallback(async()=>{if(!d){r(null);return}const{data:m,error:g}=await Nn.from(gp).select("*").eq("user_id",d).maybeSingle();if(g){c(g.message);return}r(m),c("")},[d]);return I.useEffect(()=>{h()},[h]),I.useEffect(()=>{if(!d)return;const m=Nn.channel(`livedesk-remote-host-targets-${d.replace(/[^a-zA-Z0-9]/g,"")}`).on("postgres_changes",{event:"*",schema:"public",table:gp,filter:`user_id=eq.${d}`},g=>r(g.new)).subscribe();return()=>{Nn.removeChannel(m)}},[d]),{target:n,error:l,refresh:h}}function E_(i){const[n,r]=I.useState(null),[l,c]=I.useState(!1),[d,h]=I.useState(""),m=i?.user?.id||"",g=I.useCallback(async()=>{if(!m){r(null),h(""),c(!1);return}c(!0);const{data:S,error:b}=await Nn.from(S_).select("*").eq("user_id",m).eq("product_key","livedesk").maybeSingle();if(b){h(b.message),c(!1);return}r(S),h(""),c(!1)},[m]);I.useEffect(()=>{g()},[g]);const p=I.useMemo(()=>!n||n.status!=="active"?!1:n.expires_at?new Date(n.expires_at).getTime()>Date.now():!0,[n]);return{entitlement:n,licensed:p,loading:l,error:d,refresh:g}}function A_(i,n,r=jt,l={}){const[c,d]=I.useState(new Map),[h,m]=I.useState("idle"),g=I.useMemo(()=>[...i].sort().join(","),[i]),p=Number.isFinite(l.fps)?Number(l.fps):2,S=Number.isFinite(l.maxWidth)?Number(l.maxWidth):640,b=Number.isFinite(l.maxHeight)?Number(l.maxHeight):360,T=Number.isFinite(l.quality)?Number(l.quality):45,A=String(l.frameMode||l.mode||"mode3-h264-hw").trim()||"mode3-h264-hw",C=I.useMemo(()=>{const U=Object.entries(l.monitorSelections||{}).filter(([$])=>!!$).sort(([$],[P])=>$.localeCompare(P));return JSON.stringify(Object.fromEntries(U))},[l.monitorSelections]);return I.useEffect(()=>{const U=g?g.split(",").filter(Boolean):[];if(U.length===0){m("idle"),d(new Map);return}const $=new WebSocket(Hd(`/api/remote/frames/ws?devices=${encodeURIComponent(U.join(","))}`,r));return $.binaryType="arraybuffer",m("connecting"),$.addEventListener("open",()=>{m("open"),$.send(JSON.stringify({type:"subscribe",deviceIds:U,autoStartLive:n,fps:p,maxWidth:S,maxHeight:b,quality:T,mode:A,frameMode:A,monitorSelections:l.monitorSelections||{}}))}),$.addEventListener("message",P=>{if(typeof P.data=="string")return;const q=P.data instanceof ArrayBuffer?P.data:null;if(!q||q.byteLength<5)return;const Y=new DataView(q).getUint32(0,!1);if(Y<=0||Y+4>q.byteLength)return;const ue=new Uint8Array(q.slice(4,4+Y)),G=JSON.parse(new TextDecoder().decode(ue)),Q=q.slice(4+Y),Se={deviceId:String(G.deviceId||""),kind:G.kind==="thumbnail"?"thumbnail":"live",frameSeq:Number(G.frameSeq||0),streamId:String(G.streamId||""),width:Number(G.width||0),height:Number(G.height||0),mimeType:String(G.mimeType||"image/jpeg"),mode:G.mode?String(G.mode):void 0,frameMode:G.frameMode?String(G.frameMode):void 0,frameProfile:G.frameProfile?String(G.frameProfile):void 0,encoding:G.encoding?String(G.encoding):void 0,codec:G.codec?String(G.codec):void 0,compression:G.compression?String(G.compression):void 0,pixelFormat:G.pixelFormat?String(G.pixelFormat):void 0,bytesPerPixel:Number(G.bytesPerPixel||0)||0,uncompressedByteLength:Number(G.uncompressedByteLength||0)||0,h264Format:G.h264Format?String(G.h264Format):void 0,isKeyFrame:G.isKeyFrame===!0,chunkType:G.chunkType?String(G.chunkType):void 0,timestampUs:Number(G.timestampUs||0)||0,durationUs:Number(G.durationUs||0)||0,hardwareEncoder:G.hardwareEncoder?String(G.hardwareEncoder):void 0,platformProfile:G.platformProfile?String(G.platformProfile):void 0,monitorIndex:Number.isFinite(Number(G.monitorIndex))?Number(G.monitorIndex):void 0,monitorCount:Number.isFinite(Number(G.monitorCount))?Number(G.monitorCount):void 0,capturedAt:String(G.capturedAt||""),receivedAt:String(G.receivedAt||""),byteLength:Number(G.byteLength||Q.byteLength),contentHash:G.contentHash?String(G.contentHash):void 0,payload:Q};Se.deviceId&&d(we=>{const Nt=we.get(Se.deviceId);if(Nt&&Nt.frameSeq>Se.frameSeq)return we;const We=new Map(we);return We.set(Se.deviceId,Se),We})}),$.addEventListener("error",()=>m("error")),$.addEventListener("close",()=>m("closed")),()=>{$.close()}},[n,g,p,A,r,b,S,C,l.monitorSelections,T]),{frames:c,state:h}}function x_(i,n=jt){const r=I.useRef(null),[l,c]=I.useState("idle");I.useEffect(()=>{if(!i){r.current?.close(),r.current=null,c("idle");return}const h=new WebSocket(Hd("/api/remote/input/ws",n));return r.current=h,c("connecting"),h.addEventListener("open",()=>c("open")),h.addEventListener("close",()=>c("closed")),h.addEventListener("error",()=>c("error")),()=>{h.close(),r.current===h&&(r.current=null)}},[i,n]);const d=I.useCallback((h,m)=>{const g=r.current;return!g||g.readyState!==WebSocket.OPEN||!h?!1:(g.send(JSON.stringify({type:"input",requestId:crypto.randomUUID(),deviceId:h,input:{...m,issuedAt:new Date().toISOString()}})),!0)},[]);return{state:l,sendInput:d}}function C_(i){const n=String(i||"").toLowerCase();return n.includes("audio/pcm")||n.includes("audio/l16")||n.includes("f32le")||n.includes("s16le")}function O_(i,n,r){const l=Math.max(1,Math.min(8,Math.floor(n.channels||2))),c=Math.max(8e3,Math.min(192e3,Math.floor(n.sampleRate||48e3))),d=String(n.mimeType||"").toLowerCase(),h=d.includes("s16le")||d.includes("audio/l16"),m=h?2:4,g=Math.floor(r.byteLength/m),p=Math.floor(g/l),S=i.createBuffer(l,p,c),b=new DataView(r);for(let T=0;T<l;T+=1){const A=S.getChannelData(T);for(let C=0;C<p;C+=1){const $=(C*l+T)*m;A[C]=h?Math.max(-1,Math.min(1,b.getInt16($,!0)/32768)):Math.max(-1,Math.min(1,b.getFloat32($,!0)))}}return S}function R_(i,n,r=jt){const l=I.useRef(null),c=I.useRef(0),[d,h]=I.useState("idle"),[m,g]=I.useState(null),[p,S]=I.useState("");return I.useEffect(()=>{if(!n||!i){h("idle"),g(null),S("");return}const b=window.AudioContext||window.webkitAudioContext;if(!b){h("unsupported"),S("Audio playback is not supported in this browser.");return}const T=new b;l.current=T,c.current=T.currentTime;const A=new WebSocket(Hd(`/api/remote/audio/ws?devices=${encodeURIComponent(i)}`,r));A.binaryType="arraybuffer";let C=!1;return h("connecting"),S(""),A.addEventListener("open",()=>{C||(h("open"),A.send(JSON.stringify({type:"subscribe",deviceIds:[i]})),T.resume())}),A.addEventListener("message",U=>{if(typeof U.data=="string")return;const $=U.data instanceof ArrayBuffer?U.data:null;!$||$.byteLength<5||(async()=>{try{const q=new DataView($).getUint32(0,!1);if(q<=0||q+4>$.byteLength)return;const N=new Uint8Array($.slice(4,4+q)),Y=JSON.parse(new TextDecoder().decode(N)),ue=$.slice(4+q),G={deviceId:String(Y.deviceId||""),frameSeq:Number(Y.frameSeq||0),streamId:String(Y.streamId||""),mimeType:String(Y.mimeType||"audio/webm;codecs=opus"),sampleRate:Number(Y.sampleRate||48e3),channels:Number(Y.channels||2),capturedAt:String(Y.capturedAt||""),receivedAt:String(Y.receivedAt||""),byteLength:Number(Y.byteLength||ue.byteLength),payload:ue};if(!G.deviceId||C)return;const Q=C_(G.mimeType)?O_(T,G,ue):await T.decodeAudioData(ue.slice(0));if(C)return;const Se=T.createBufferSource();Se.buffer=Q,Se.connect(T.destination);const we=Math.max(T.currentTime+.02,c.current);Se.start(we),c.current=we+Q.duration,g(G),h("playing")}catch(P){C||(h("error"),S(P instanceof Error?P.message:String(P)))}})()}),A.addEventListener("error",()=>{C||h("error")}),A.addEventListener("close",()=>{C||h("closed")}),()=>{C=!0,A.close(),T.close().catch(()=>{}),l.current===T&&(l.current=null)}},[i,n,r]),{state:d,lastFrame:m,error:p}}const j_=120,N_=999,fr=4,Yp="livedesk.remoteDirectory",Md="livedesk.localHubAccessEnabled",Jp="livedesk.streamSettings",Xp=2,L_=24*1024*1024,fn={frameMode:"mode3-h264-hw",fps:1,maxWidth:960,maxHeight:540,quality:60,autoStartLive:!0,showScreenStatus:!0},Lo=[{id:"mode3-h264-hw",label:"Mode 3",detail:"H.264 hardware"},{id:"mode2-lz4",label:"Mode 2",detail:"LZ4 raw"},{id:"mode1-jpeg",label:"Mode 1",detail:"JPEG test"}],vd=[{id:"640x360",label:"Compact",width:640,height:360},{id:"960x540",label:"Standard",width:960,height:540},{id:"1280x720",label:"HD",width:1280,height:720}],D_=[1,2,5,8,12,20,24],U_=[45,60,75,90];function Is(i,n){const r=i.capabilities?.[n];return typeof r=="boolean"?r:/^(1|true|yes|on)$/i.test(String(r||"").trim())}function Gs(i){return i.deviceName||i.hostname||i.deviceId}function M_(){return"npx -y livedesk client"}function z_(){return"npx -y livedesk"}function B_(){try{return localStorage.getItem(Yp)||""}catch{return""}}function H_(){try{return localStorage.getItem(Md)==="1"}catch{return!1}}function mr(i){try{i?localStorage.setItem(Md,"1"):localStorage.removeItem(Md)}catch{}}function kr(i,n,r,l){const c=Number(i);return Number.isFinite(c)?Math.max(n,Math.min(r,Math.round(c))):l}function Qp(i){const n=String(i||"").trim();return Lo.some(r=>r.id===n)?n:fn.frameMode}function bd(i){return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}function bi(i){const n=bd(i.status),r=bd(n.screens),l=bd(i.capabilities),c=[n.monitorCount,n.screenCount,r.count,l.monitorCount,l.screenCount];for(const d of c){const h=Number(d);if(Number.isFinite(h)&&h>0)return Math.max(1,Math.min(64,Math.floor(h)))}return 1}function wr(i,n){const r=Math.max(1,Math.min(64,Math.floor(Number(n)||1))),l=Math.floor(Number(i));return Number.isFinite(l)?Math.max(0,Math.min(r-1,l)):0}function q_(){try{const i=JSON.parse(localStorage.getItem(Jp)||"{}");if(i.version!==Xp)return fn;const n=kr(i.maxWidth,320,2560,fn.maxWidth),r=kr(i.maxHeight,180,1440,fn.maxHeight);return{frameMode:Qp(i.frameMode),fps:kr(i.fps,1,24,fn.fps),maxWidth:n,maxHeight:r,quality:kr(i.quality,20,95,fn.quality),autoStartLive:typeof i.autoStartLive=="boolean"?i.autoStartLive:fn.autoStartLive,showScreenStatus:typeof i.showScreenStatus=="boolean"?i.showScreenStatus:fn.showScreenStatus}}catch{return fn}}function $_(i){try{localStorage.setItem(Jp,JSON.stringify({...i,version:Xp}))}catch{}}function pp(i,n){return i.length!==n.length?!1:i.every((r,l)=>r===n[l])}function _i(i){if(!Number.isFinite(i)||i<=0)return"0 B";const n=["B","KB","MB","GB","TB"];let r=i,l=0;for(;r>=1024&&l<n.length-1;)r/=1024,l+=1;const c=l===0||r>=100?0:1;return`${r.toFixed(c)} ${n[l]}`}function P_(i){const n=new Uint8Array(i),r=32768;let l="";for(let c=0;c<n.length;c+=r){const d=n.subarray(c,c+r);l+=String.fromCharCode(...d)}return btoa(l)}function I_(i){return i===1?"middle":i===2?"right":"left"}function yp(i,...n){for(const r of n){const l=i?.[r];if(typeof l=="string"&&l.trim())return l.trim()}return""}function Ls(i){const n=Number(i);return Number.isInteger(n)&&n>=1&&n<=N_?n:0}const G_={cpu:"CPU",memory:"MEM",disk:"Disk",gpu:"GPU",npu:"NPU",temp:"Temp",network:"Net"};function V_(i,n,r){if(i==="online")return"Online";if(i==="busy")return"Busy";if(i==="stale")return"Stale";if(i==="offline")return"Offline";if(r==="failed")return"Task failed";const l=i==="critical"?"critical":"warn",c=n.find(h=>h.state===l)||n.find(h=>h.state==="critical"||h.state==="warn");if(!c)return i==="critical"?"Issue":"Check";const d=G_[c.id]||c.label;return c.value&&c.value!=="-"?`${d} ${c.value}`:d}function Ko(i,n){const r=n.split(".");let l=i;for(const c of r){if(l==null)return;if(Array.isArray(l)){const d=Number(c);l=Number.isInteger(d)?l[d]:void 0;continue}if(typeof l=="object"){l=l[c];continue}return}return l}function Qe(i,...n){for(const r of n){const l=Ko(i,r),c=Number(l);if(Number.isFinite(c))return c}}function Gt(i,...n){for(const r of n){const l=Ko(i,r);if(typeof l=="string"&&l.trim())return l.trim();if(typeof l=="number"&&Number.isFinite(l))return String(l)}return""}function K_(i,...n){for(const r of n){const l=Ko(i,r);if(typeof l=="boolean")return l;if(/^(1|true|yes|on|online|running|ready)$/i.test(String(l||"").trim()))return!0;if(/^(0|false|no|off|offline|stopped|missing)$/i.test(String(l||"").trim()))return!1}}function da(i){const n=Number(i);if(Number.isFinite(n))return Math.max(0,Math.min(1,n>1?n/100:n))}function Sd(i,n){if(!(typeof i!="number"||typeof n!="number"||!Number.isFinite(i)||!Number.isFinite(n)||i<=0))return da((i-Math.max(0,n))/i)}function Ds(i){return i===void 0?"-":`${Math.round(i*100)}%`}function wd(i){return i===void 0||!Number.isFinite(i)?"":i>=1e3?`${(i/1e3).toFixed(i>=1e4?0:1)}Gb/s`:`${Math.round(i)}Mb/s`}function gr(i,n=.92,r=.78){return i===void 0?"unknown":i>=n?"critical":i>=r?"warn":"good"}function Wp(i){return!Number.isFinite(i)||!i||i<=0?"-":i<3600?`${Math.round(i/60)}m`:i<86400?`${Math.round(i/3600)}h`:`${Math.round(i/86400)}d`}function jo(i,n,r){const l=Ko(i,`tools.${n}`),c=Gt(i,`tools.${n}.status`,`tooling.${n}.status`,`${n}.status`).toLowerCase(),d=K_(i,`tools.${n}.running`,`tooling.${n}.running`,`${n}.running`),h=Gt(i,`tools.${n}.version`,`tooling.${n}.version`,`${n}.version`),m=Gt(i,`tools.${n}.port`,`tooling.${n}.port`,`${n}.port`);let g="unknown";return c==="busy"?g="busy":["online","running","ready","active"].includes(c)||d===!0?g="online":(["offline","stopped","missing","not-found"].includes(c)||d===!1||l===!1)&&(g="offline"),{id:n,label:r,status:g,detail:g==="offline"?"offline":h||(m?`:${m}`:g==="unknown"?"not reported":g)}}function Zp(i){const n=i.status||{},r=Qe(n,"cpu.cores","cpuCores","processorCount"),l=Qe(n,"loadavg.0","cpu.load1"),c=da(Qe(n,"cpu.usedRatio","cpu.usageRatio","cpu.ratio","cpu.usedPct","cpu.usagePct","cpu.percent")??(r&&l!==void 0?l/Math.max(1,r):void 0)),d=Qe(n,"memory.totalBytes","totalMem"),h=Qe(n,"memory.freeBytes","freeMem"),m=da(Qe(n,"memory.usedRatio","memory.usedPct","usedMemRatio"))??Sd(d,h),g=Qe(n,"disk.totalBytes","rootDisk.totalBytes","storage.totalBytes"),p=Qe(n,"disk.freeBytes","rootDisk.freeBytes","storage.freeBytes"),S=da(Qe(n,"disk.usedRatio","disk.usedPct","rootDisk.usedRatio","storage.usedRatio"))??Sd(g,p),b=Qe(n,"thermal.cpuC","temperatureC","cpu.temperatureC","gpu.temperatureC"),T=da(Qe(n,"gpu.usedRatio","gpu.usageRatio","gpu.usedPct","gpu.usagePct","gpu.percent","accelerators.gpu.usageRatio")),A=Gt(n,"gpu.name","gpu.model","accelerators.gpu.name"),C=Qe(n,"gpu.memory.totalBytes","gpu.totalMemoryBytes","gpu.vramTotalBytes"),U=Qe(n,"gpu.memory.freeBytes","gpu.freeMemoryBytes","gpu.vramFreeBytes"),$=da(Qe(n,"gpu.memory.usedRatio","gpu.vramUsedRatio"))??Sd(C,U),P=Qe(n,"gpu.temperatureC","thermal.gpuC"),q=da(Qe(n,"npu.usedRatio","npu.usageRatio","npu.usedPct","npu.usagePct","npu.percent","accelerators.npu.usageRatio")),N=Gt(n,"npu.name","npu.model","accelerators.npu.name"),Y=Qe(n,"npu.tops","npu.topsInt8","accelerators.npu.tops"),ue=Qe(n,"network.rxMbps","network.receiveMbps","network.downMbps"),G=Qe(n,"network.txMbps","network.transmitMbps","network.upMbps"),Q=Qe(n,"network.latencyMs","network.rttMs"),Se=da(Qe(n,"network.usedRatio","network.usageRatio","network.saturationRatio")),we=Gt(n,"network.link","network.interface","network.name"),Nt=b===void 0?void 0:da((b-35)/60),We=Gt(n,"workload.role","role","lane")||(Is(i,"aiAssist")?"Agent worker":Is(i,"taskDispatch")?"Task worker":"Local machine"),Le=Gt(i.latestTask,"status")||Gt(n,"workload.status")||"idle",mt=Gt(i.latestTask,"title","instructionPreview")||Gt(n,"workload.title"),pt=Gt(i.latestTask,"resultSummary","error","instructionPreview")||Gt(n,"workload.summary"),Ge=[jo(n,"ollama","Ollama"),jo(n,"lmStudio","LM Studio"),jo(n,"comfyui","ComfyUI"),jo(n,"stableDiffusion","Stable Diffusion")],D=Ge.some(M=>M.status!=="unknown"),K=Date.parse(i.lastSeenAt||i.connectedAt||""),ae=Number.isFinite(K)?Date.now()-K:0;let te="online";i.connected?ae>5*6e4?te="stale":(b??0)>=86||(P??0)>=88||(c??0)>=.94||(T??0)>=.96||(q??0)>=.96||(m??0)>=.94||(S??0)>=.94||(Q??0)>=200||Le==="failed"?te="critical":(b??0)>=78||(P??0)>=80||(c??0)>=.82||(T??0)>=.86||(q??0)>=.86||(m??0)>=.82||(S??0)>=.86||(Q??0)>=80?te="warn":(["queued","running","targeted"].includes(Le)||Ge.some(M=>M.status==="busy"))&&(te="busy"):te="offline";const Ee=Ge.filter(M=>M.status==="online"||M.status==="busy").length,E=[{id:"cpu",label:"CPU",value:Ds(c),detail:r?`${r} cores`:l!==void 0?`load ${l.toFixed(1)}`:"not reported",ratio:c,state:gr(c,.92,.78)},{id:"memory",label:"RAM",value:Ds(m),detail:d?`${_i(d-(h||0))} / ${_i(d)}`:"not reported",ratio:m,state:gr(m,.92,.78)},{id:"disk",label:"DISK",value:Ds(S),detail:g&&p!==void 0?`${_i(p)} free`:"not reported",ratio:S,state:gr(S,.92,.82)},{id:"gpu",label:"GPU",value:Ds(T??$),detail:A||(C&&U!==void 0?`${_i(U)} VRAM free`:P!==void 0?`${Math.round(P)}C`:"not reported"),ratio:T??$,state:P!==void 0&&P>=88?"critical":P!==void 0&&P>=80?"warn":gr(T??$,.96,.86)},{id:"npu",label:"NPU",value:q!==void 0?Ds(q):Y!==void 0?`${Math.round(Y)} TOPS`:"-",detail:N||(Y!==void 0?"neural engine":"not reported"),ratio:q,state:gr(q,.96,.86)},{id:"temp",label:"TEMP",value:b===void 0?"-":`${Math.round(b)}C`,detail:Ee>0?`${Ee} local tools`:`uptime ${Wp(Qe(n,"uptimeSec"))}`,ratio:Nt,state:b===void 0?"unknown":b>=86?"critical":b>=78?"warn":"good"},{id:"network",label:"NET",value:wd(ue)||(Q!==void 0?`${Math.round(Q)}ms`:we||"-"),detail:wd(G)?`${wd(G)} up`:we||"not reported",ratio:Se,state:Q!==void 0&&Q>=200?"critical":Q!==void 0&&Q>=80?"warn":gr(Se,.9,.75)}];return{state:te,label:V_(te,E,Le),role:We,taskLabel:mt||(Le==="idle"?"idle":Le),taskStatus:Le,taskSummary:pt,tools:D?Ge:Ge.map(M=>({...M,detail:"not reported"})),metrics:E}}const Y_=[{id:"small",label:"Small"},{id:"medium",label:"Medium"},{id:"large",label:"Large"}],J_=[{id:"wall",label:"Wall",icon:Tp,accent:"blue"},{id:"control",label:"Control",icon:kd,accent:"red"},{id:"agents",label:"Agents",icon:yr,accent:"violet"},{id:"doc",label:"Doc",icon:_d,accent:"amber"},{id:"pricing",label:"Pricing",icon:Td,accent:"green"},{id:"settings",label:"Settings",icon:kp,accent:"gray"}];function st(i){return i.replace(/\bRemoteHub\b/g,"Hub client endpoint").replace(/\bManagers\b/g,"Hubs").replace(/\bManager\b/g,"Hub").replace(/\bmanager\b/g,"Hub").replace(/\bMANAGER\b/g,"HUB").replace(/매니저/g,"Hub")}function pr(i){return i.map(n=>st(n))}function xt(i){return{languageName:i.languageName,languageLabel:i.languageLabel,eyebrow:i.eyebrow,title:st(i.title),intro:st(i.intro),sections:[{title:st(i.managerTitle),body:st(i.managerBody),points:pr(i.managerPoints)},{title:st(i.clientTitle),body:st(i.clientBody),points:pr(i.clientPoints)},{title:st(i.syncTitle),body:st(i.syncBody),points:pr(i.syncPoints)},{title:st(i.platformTitle),body:st(i.platformBody),points:pr(i.platformPoints)}],sync:{title:st(i.syncTitle),body:st(i.syncBody),points:pr(i.syncPoints)},firewall:{title:st(i.firewallTitle),body:st(i.firewallBody),points:pr(i.firewallPoints)},commands:{title:st(i.commandsTitle),body:st(i.commandsBody),manager:st(i.managerCommandLabel),primary:st(i.clientCommandLabel),slot:st(i.slotCommandLabel),manual:st(i.manualCommandLabel)}}}const Ar={ko:xt({languageName:"한국어",languageLabel:"문서 언어",eyebrow:"LiveDesk Manual",title:"한 줄로 여는 로컬 Screen Wall",intro:"LiveDesk는 매니저 PC 한 대에서 여러 작업 PC, AI 박스, 맥미니, 개발 장비를 한 화면에 모니터링하고 필요한 제어를 실행하는 npm-first 원격 작업 데크입니다.",managerTitle:"1. 매니저 실행",managerBody:"화면을 모아 볼 컴퓨터에서 LiveDesk 매니저를 실행합니다. 매니저는 UI와 로컬 서버를 같이 열고 브라우저를 http://127.0.0.1:5179 로 띄웁니다.",managerPoints:["명령은 npx -y livedesk 입니다.","매니저는 Screen Wall/API 포트 5179와 클라이언트 접속 포트 5197을 사용합니다.","기존 LiveDesk 포트가 남아 있으면 기본적으로 정리하고 새로 시작합니다. 필요하면 --no-clean 을 붙입니다."],clientTitle:"2. 워크스테이션 연결",clientBody:"모니터링할 PC에서는 같은 Google 계정으로 로그인합니다. 매니저가 켜져 있지 않아도 클라이언트는 종료하지 않고 5초마다 계속 찾습니다.",clientPoints:["빈 자리에 자동 배치하려면 npx -y livedesk client 를 실행합니다.","자리 번호를 고정하려면 npx -y livedesk client 3 처럼 번호를 붙입니다.","컴퓨터가 많을 때도 다시 로그인하지 않도록 집요하게 재접속을 시도합니다."],syncTitle:"3. Sync Server와 자동 발견",syncBody:"Sync Server는 이 매니저를 현재 계정의 활성 Screen Wall로 Supabase에 등록합니다. 클라이언트는 같은 Google 계정으로 로그인한 뒤 그 기록을 읽고 접속 후보들을 순서대로 시도합니다.",syncPoints:["등록 정보에는 host instance, LAN/private 주소, public 후보 주소, pair token, 짧은 lease가 포함됩니다.","같은 LAN 후보를 먼저 쓰고, 필요하면 외부 주소 후보를 시도합니다.","매니저 위치, VPN, 방화벽, 공유기 설정이 바뀌었거나 개발 중 활성 매니저를 바꿀 때 Sync Server를 누릅니다.","이제 livedesk.pages.dev의 Chrome Local Network Access 허용은 기본 실행 경로가 아닙니다. npm 매니저 앱이 실제 서버입니다."],platformTitle:"4. 현재 플랫폼 상태",platformBody:"Windows는 실제 화면 전송까지 확인되었습니다. macOS와 Linux도 npm 구조로 같은 명령을 목표로 지원을 넓히고 있습니다.",platformPoints:["Windows: 현재 작동 확인.","macOS: manager/client 경로는 준비되어 있으며 화면 캡처와 제어에는 Screen Recording/Accessibility 권한이 필요합니다.","Linux: linux-x64 runtime, grim/gnome-screenshot/import/scrot 캡처, xdotool 입력 백엔드가 추가되었습니다. 오디오는 아직 비활성입니다."],firewallTitle:"방화벽과 외부 장소 연결",firewallBody:"같은 LAN 안에서는 보통 공유기 포트포워딩이 필요 없습니다. 다른 장소의 PC를 붙이려면 클라이언트가 매니저의 클라이언트 접속 포트에 도달할 수 있어야 합니다.",firewallPoints:["클라이언트 접속 포트는 TCP 5197입니다.","클라이언트 쪽은 나가는 연결이므로 보통 인바운드 포트 개방이 필요 없습니다.","다른 네트워크에서 붙일 때는 매니저 PC 방화벽에서 TCP 5197 인바운드를 허용하고, 공유기에서는 TCP 5197을 매니저 PC로 전달합니다.","Screen Wall/API 포트 5179는 매니저 UI용입니다. 외부 브라우저에서 Wall을 직접 열 필요가 있을 때만 별도로 노출을 검토합니다.","공개 인터넷에 바로 열기보다 VPN, Tailscale, ZeroTier, 고정 IP allowlist를 우선합니다."],commandsTitle:"현재 사용 명령",commandsBody:"웹사이트를 찾아가 설치 파일을 받는 방식보다 터미널 한 줄로 모든 운영체제에서 거의 같은 흐름을 쓰는 것이 LiveDesk의 기본 방향입니다.",managerCommandLabel:"매니저 시작",clientCommandLabel:"워크스테이션 연결",slotCommandLabel:"3번 슬롯에 고정",manualCommandLabel:"고급 수동 연결"}),en:xt({languageName:"English",languageLabel:"Document language",eyebrow:"LiveDesk Manual",title:"Open a local Screen Wall with one command",intro:"LiveDesk is an npm-first remote work deck for monitoring many workstations, AI boxes, Mac minis, and dev machines from one manager PC.",managerTitle:"1. Run the manager",managerBody:"Run LiveDesk on the computer that will watch the screens. The manager starts the UI and local server together, then opens http://127.0.0.1:5179.",managerPoints:["The command is npx -y livedesk.","The manager uses port 5179 for the Screen Wall/API and port 5197 for client connections.","If an old LiveDesk process still owns those ports, startup cleans it by default. Add --no-clean when you want to keep it."],clientTitle:"2. Connect a workstation",clientBody:"On each monitored computer, sign in with the same Google account. If no manager is online yet, the client keeps running and retries every 5 seconds.",clientPoints:["Run npx -y livedesk client for first available placement.","Run npx -y livedesk client 3 to pin the machine to slot 3.","Clients keep trying so large workstation stacks do not need repeated sign-in."],syncTitle:"3. Sync Server and discovery",syncBody:"Sync Server publishes this manager as the active Screen Wall for the signed-in account. Clients read that Supabase record after Google sign-in and try the endpoint candidates in order.",syncPoints:["The record includes host instance, LAN/private addresses, public endpoint candidates, pair token, and a short lease.","LAN candidates are preferred first, then public candidates if needed.","Press Sync Server after manager moves, VPN/firewall/router changes, or when this development machine should take over as active manager.","Chrome Local Network Access on livedesk.pages.dev is no longer the default runtime path. The npm manager app is the real server."],platformTitle:"4. Current platform state",platformBody:"Windows has been verified with live screen transfer. macOS and Linux follow the same npm command path as support expands.",platformPoints:["Windows: verified working.","macOS: manager/client paths are prepared; screen capture and control require Screen Recording/Accessibility permissions.","Linux: linux-x64 runtime, grim/gnome-screenshot/import/scrot capture, and xdotool input backend are added. Audio is still disabled."],firewallTitle:"Firewall and remote locations",firewallBody:"On the same LAN, router forwarding is usually unnecessary. For another office, building, or country, clients must be able to reach the manager client port.",firewallPoints:["Client connection port: TCP 5197.","Client machines normally only need outbound access.","For remote networks, allow inbound TCP 5197 on the manager firewall and forward TCP 5197 from the router to the manager PC.","Screen Wall/API port 5179 is for the manager UI. Expose it only if a remote browser must open the Wall directly.","Prefer VPN, Tailscale, ZeroTier, or fixed-IP allowlists over public internet exposure."],commandsTitle:"Current commands",commandsBody:"The product direction is one terminal command across operating systems instead of finding a website, downloading, and installing manually.",managerCommandLabel:"Start manager",clientCommandLabel:"Connect workstation",slotCommandLabel:"Pin to slot 3",manualCommandLabel:"Advanced manual connection"}),ja:xt({languageName:"日本語",languageLabel:"ドキュメント言語",eyebrow:"LiveDesk Manual",title:"1行でローカル Screen Wall を開く",intro:"LiveDesk は、複数の作業 PC、AI マシン、Mac mini、開発機を1台の manager PC から監視する npm-first のリモート作業デッキです。",managerTitle:"1. manager を実行",managerBody:"画面を集めて見るコンピューターで LiveDesk manager を実行します。UI とローカルサーバーが同時に起動し、http://127.0.0.1:5179 が開きます。",managerPoints:["コマンドは npx -y livedesk です。","Screen Wall/API は 5179、client 接続は 5197 を使います。","古い LiveDesk プロセスがポートを使っている場合は、基本的に自動で整理して起動します。"],clientTitle:"2. workstation を接続",clientBody:"監視される PC で同じ Google アカウントにログインします。manager がまだ無くても client は終了せず、5秒ごとに再試行します。",clientPoints:["空きスロットに入れるには npx -y livedesk client を実行します。","スロットを固定するには npx -y livedesk client 3 のように番号を付けます。","大量の PC でも再ログインなしで待ち続けます。"],syncTitle:"3. Sync Server と自動検出",syncBody:"Sync Server はこの manager を現在の Google アカウントの active Screen Wall として Supabase に登録します。",syncPoints:["host instance、LAN/private アドレス、public 候補、pair token、短い lease を登録します。","client は LAN 候補を優先し、必要なら public 候補も試します。","VPN、firewall、router、manager の場所が変わったら Sync Server を押します。","livedesk.pages.dev の Chrome Local Network Access は標準実行経路ではありません。npm manager アプリが実際のサーバーです。"],platformTitle:"4. 現在のプラットフォーム状態",platformBody:"Windows は live screen transfer まで確認済みです。macOS と Linux も同じ npm コマンド経路を目標に対応を広げています。",platformPoints:["Windows: 動作確認済み。","macOS: 画面取得と制御には Screen Recording/Accessibility 権限が必要です。","Linux: linux-x64 runtime、grim/gnome-screenshot/import/scrot capture、xdotool input backend を追加済み。audio は未対応です。"],firewallTitle:"Firewall と外部拠点",firewallBody:"同じ LAN なら通常 router forwarding は不要です。外部拠点では client が manager の接続ポートへ到達できる必要があります。",firewallPoints:["client 接続ポートは TCP 5197 です。","client 側は通常 outbound だけで足ります。","外部 network では manager PC の firewall で TCP 5197 inbound を許可し、router から manager PC へ forward します。","5179 は manager UI 用なので、外部ブラウザで Wall を開く必要がある時だけ公開を検討します。","公開 internet より VPN、Tailscale、ZeroTier、IP allowlist を優先してください。"],commandsTitle:"現在のコマンド",commandsBody:"Web サイトから installer を探すより、OS をまたいで terminal 1行で動かす方向です。",managerCommandLabel:"manager 起動",clientCommandLabel:"workstation 接続",slotCommandLabel:"slot 3 に固定",manualCommandLabel:"高度な手動接続"}),"zh-CN":xt({languageName:"简体中文",languageLabel:"文档语言",eyebrow:"LiveDesk Manual",title:"用一条命令打开本地 Screen Wall",intro:"LiveDesk 是 npm-first 的远程工作台,用一台 manager PC 监控多台工作站、AI 主机、Mac mini 和开发机器。",managerTitle:"1. 运行 manager",managerBody:"在负责查看屏幕的电脑上运行 LiveDesk manager。它会同时启动 UI 和本地服务器,并打开 http://127.0.0.1:5179。",managerPoints:["命令是 npx -y livedesk。","Screen Wall/API 使用 5179,client 连接使用 5197。","如果旧的 LiveDesk 进程占用端口,默认会清理后重新启动。"],clientTitle:"2. 连接 workstation",clientBody:"在被监控的电脑上使用同一个 Google 账号登录。即使 manager 还没在线,client 也会继续运行并每 5 秒重试。",clientPoints:["自动放入空位: npx -y livedesk client。","固定到 3 号位置: npx -y livedesk client 3。","大量电脑也可以持续等待,不需要反复登录。"],syncTitle:"3. Sync Server 和自动发现",syncBody:"Sync Server 会把当前 manager 作为该账号的 active Screen Wall 写入 Supabase。client 登录后读取记录并依次尝试连接候选地址。",syncPoints:["记录包括 host instance、LAN/private 地址、public 候选、pair token 和短 lease。","优先尝试同一 LAN 地址,需要时再尝试外部地址。","manager 位置、VPN、防火墙或路由变化后请点击 Sync Server。","livedesk.pages.dev 的 Chrome Local Network Access 不再是默认运行方式。npm manager app 才是真正服务器。"],platformTitle:"4. 当前平台状态",platformBody:"Windows 已确认可传输实时画面。macOS 和 Linux 正按同一 npm 命令路径扩展支持。",platformPoints:["Windows: 已确认可用。","macOS: 画面捕获和控制需要 Screen Recording/Accessibility 权限。","Linux: 已加入 linux-x64 runtime、grim/gnome-screenshot/import/scrot 捕获、xdotool 输入后端。音频尚未启用。"],firewallTitle:"防火墙和外部地点",firewallBody:"同一 LAN 通常不需要路由端口转发。不同地点连接时,client 必须能访问 manager 的 client 连接端口。",firewallPoints:["client 连接端口是 TCP 5197。","client 机器通常只需要出站访问。","跨网络时,在 manager 防火墙放行 TCP 5197 入站,并在路由器转发到 manager PC。","5179 是 manager UI 端口,仅在需要远程浏览器直接打开 Wall 时考虑暴露。","优先使用 VPN、Tailscale、ZeroTier 或固定 IP allowlist。"],commandsTitle:"当前命令",commandsBody:"产品方向是跨操作系统使用一条终端命令,而不是先找网站、下载、安装。",managerCommandLabel:"启动 manager",clientCommandLabel:"连接 workstation",slotCommandLabel:"固定到 slot 3",manualCommandLabel:"高级手动连接"}),"zh-TW":xt({languageName:"繁體中文",languageLabel:"文件語言",eyebrow:"LiveDesk Manual",title:"用一行指令開啟本機 Screen Wall",intro:"LiveDesk 是 npm-first 的遠端工作台,用一台 manager PC 監看多台工作站、AI 主機、Mac mini 與開發機。",managerTitle:"1. 執行 manager",managerBody:"在負責看畫面的電腦上執行 LiveDesk manager。它會同時啟動 UI 與本機伺服器,並開啟 http://127.0.0.1:5179。",managerPoints:["指令是 npx -y livedesk。","Screen Wall/API 使用 5179,client 連線使用 5197。","若舊的 LiveDesk 程序占用連接埠,預設會清理後重新啟動。"],clientTitle:"2. 連接 workstation",clientBody:"在被監看的電腦上使用同一個 Google 帳號登入。即使 manager 尚未上線,client 也會持續執行並每 5 秒重試。",clientPoints:["自動放入空位: npx -y livedesk client。","固定到 3 號位置: npx -y livedesk client 3。","大量電腦也能持續等待,不需要反覆登入。"],syncTitle:"3. Sync Server 與自動探索",syncBody:"Sync Server 會把目前 manager 登錄為此帳號的 active Screen Wall。client 登入後讀取 Supabase 記錄並依序嘗試連線候選地址。",syncPoints:["記錄包含 host instance、LAN/private 位址、public 候選、pair token 與短 lease。","優先嘗試 LAN 位址,需要時再嘗試外部位址。","manager 位置、VPN、防火牆或路由設定改變後請按 Sync Server。","livedesk.pages.dev 的 Chrome Local Network Access 不再是預設執行路徑。npm manager app 才是真正伺服器。"],platformTitle:"4. 目前平台狀態",platformBody:"Windows 已確認可傳輸即時畫面。macOS 與 Linux 也沿用相同 npm 指令路徑擴充支援。",platformPoints:["Windows: 已確認可用。","macOS: 畫面擷取與控制需要 Screen Recording/Accessibility 權限。","Linux: 已加入 linux-x64 runtime、grim/gnome-screenshot/import/scrot capture、xdotool input backend。音訊尚未啟用。"],firewallTitle:"防火牆與外部地點",firewallBody:"同一 LAN 通常不需要路由器轉發。不同地點連線時,client 必須能到達 manager 的 client 連線埠。",firewallPoints:["client 連線埠是 TCP 5197。","client 電腦通常只需要對外連線。","跨網路時,請在 manager 防火牆允許 TCP 5197 inbound,並從路由器轉發到 manager PC。","5179 是 manager UI 連接埠,只在需要遠端瀏覽器直接打開 Wall 時才考慮公開。","優先使用 VPN、Tailscale、ZeroTier 或固定 IP allowlist。"],commandsTitle:"目前指令",commandsBody:"產品方向是跨作業系統用一行 terminal 指令,而不是先找網站、下載、安裝。",managerCommandLabel:"啟動 manager",clientCommandLabel:"連接 workstation",slotCommandLabel:"固定到 slot 3",manualCommandLabel:"進階手動連線"}),es:xt({languageName:"Español",languageLabel:"Idioma del documento",eyebrow:"LiveDesk Manual",title:"Abre un Screen Wall local con un comando",intro:"LiveDesk es una consola npm-first para vigilar muchas estaciones, cajas de IA, Mac mini y equipos de desarrollo desde un PC manager.",managerTitle:"1. Ejecuta el manager",managerBody:"Ejecuta LiveDesk en el equipo que verá las pantallas. El manager inicia la UI y el servidor local juntos y abre http://127.0.0.1:5179.",managerPoints:["El comando es npx -y livedesk.","El manager usa 5179 para Screen Wall/API y 5197 para conexiones client.","Si un proceso antiguo ocupa los puertos, el arranque lo limpia por defecto."],clientTitle:"2. Conecta una workstation",clientBody:"En cada equipo monitoreado, inicia sesión con la misma cuenta Google. Si el manager aún no está activo, el client sigue intentando cada 5 segundos.",clientPoints:["Usa npx -y livedesk client para el primer slot libre.","Usa npx -y livedesk client 3 para fijar el equipo al slot 3.","Los clients siguen esperando para no repetir login en muchas máquinas."],syncTitle:"3. Sync Server y descubrimiento",syncBody:"Sync Server publica este manager como Screen Wall activo para la cuenta. Los clients leen el registro en Supabase y prueban los endpoints.",syncPoints:["Incluye host instance, direcciones LAN/private, candidatos public, pair token y lease corto.","Primero se prueban candidatos LAN, luego públicos si hace falta.","Pulsa Sync Server después de cambios de manager, VPN, firewall o router.","Chrome Local Network Access en livedesk.pages.dev ya no es el flujo principal. La app npm manager es el servidor real."],platformTitle:"4. Estado de plataformas",platformBody:"Windows ya fue verificado con transferencia de pantalla. macOS y Linux siguen el mismo camino npm.",platformPoints:["Windows: verificado.","macOS: captura y control requieren permisos Screen Recording/Accessibility.","Linux: agregado linux-x64 runtime, captura grim/gnome-screenshot/import/scrot y entrada xdotool. Audio aún desactivado."],firewallTitle:"Firewall y sedes remotas",firewallBody:"En la misma LAN normalmente no hace falta port forwarding. Para otra red, los clients deben llegar al puerto client del manager.",firewallPoints:["Puerto de conexión client: TCP 5197.","Los equipos client normalmente solo necesitan salida.","Para redes remotas, permite TCP 5197 inbound en el manager y reenvía TCP 5197 al PC manager.","El puerto 5179 es para la UI del manager; expónlo solo si un navegador remoto debe abrir el Wall.","Prefiere VPN, Tailscale, ZeroTier o allowlist de IP fijas."],commandsTitle:"Comandos actuales",commandsBody:"La dirección del producto es un comando de terminal común entre sistemas, no descargar e instalar desde una web.",managerCommandLabel:"Iniciar manager",clientCommandLabel:"Conectar workstation",slotCommandLabel:"Fijar al slot 3",manualCommandLabel:"Conexión manual avanzada"}),fr:xt({languageName:"Français",languageLabel:"Langue du document",eyebrow:"LiveDesk Manual",title:"Ouvrir un Screen Wall local en une commande",intro:"LiveDesk est un deck npm-first pour surveiller plusieurs postes, machines IA, Mac mini et machines dev depuis un PC manager.",managerTitle:"1. Lancer le manager",managerBody:"Lancez LiveDesk sur l’ordinateur qui observe les écrans. Le manager démarre l’UI et le serveur local, puis ouvre http://127.0.0.1:5179.",managerPoints:["La commande est npx -y livedesk.","Le manager utilise 5179 pour Screen Wall/API et 5197 pour les connexions client.","Si un ancien processus utilise les ports, le démarrage le nettoie par défaut."],clientTitle:"2. Connecter une workstation",clientBody:"Sur chaque ordinateur surveillé, connectez-vous avec le même compte Google. Si le manager n’est pas encore actif, le client réessaie toutes les 5 secondes.",clientPoints:["Utilisez npx -y livedesk client pour le premier slot libre.","Utilisez npx -y livedesk client 3 pour fixer la machine au slot 3.","Les clients continuent d’attendre pour éviter les reconnexions répétées."],syncTitle:"3. Sync Server et découverte",syncBody:"Sync Server publie ce manager comme Screen Wall actif du compte. Les clients lisent l’enregistrement Supabase et testent les endpoints.",syncPoints:["Il contient host instance, adresses LAN/private, candidats public, pair token et lease court.","Les candidats LAN sont essayés en premier, puis les candidats publics si besoin.","Cliquez Sync Server après un changement de manager, VPN, firewall ou routeur.","Chrome Local Network Access sur livedesk.pages.dev n’est plus le chemin par défaut. L’app npm manager est le vrai serveur."],platformTitle:"4. État des plateformes",platformBody:"Windows est vérifié avec transfert d’écran live. macOS et Linux suivent le même chemin npm.",platformPoints:["Windows: vérifié.","macOS: capture et contrôle nécessitent Screen Recording/Accessibility.","Linux: runtime linux-x64, capture grim/gnome-screenshot/import/scrot et entrée xdotool ajoutés. Audio désactivé."],firewallTitle:"Firewall et sites distants",firewallBody:"Sur le même LAN, le port forwarding est rarement nécessaire. Depuis un autre réseau, les clients doivent atteindre le port client du manager.",firewallPoints:["Port de connexion client: TCP 5197.","Les machines client ont normalement seulement besoin de sortie réseau.","Pour un réseau distant, autorisez TCP 5197 entrant sur le manager et redirigez TCP 5197 vers le PC manager.","Le port 5179 sert à l’UI manager; exposez-le seulement si un navigateur distant doit ouvrir le Wall.","Préférez VPN, Tailscale, ZeroTier ou allowlist IP fixes."],commandsTitle:"Commandes actuelles",commandsBody:"La direction produit est une commande terminal commune aux OS, plutôt qu’un téléchargement manuel depuis un site.",managerCommandLabel:"Démarrer manager",clientCommandLabel:"Connecter workstation",slotCommandLabel:"Fixer au slot 3",manualCommandLabel:"Connexion manuelle avancée"}),de:xt({languageName:"Deutsch",languageLabel:"Dokumentsprache",eyebrow:"LiveDesk Manual",title:"Lokale Screen Wall mit einem Befehl öffnen",intro:"LiveDesk ist ein npm-first Arbeitsdeck, um viele Workstations, AI-Boxen, Mac minis und Dev-Rechner von einem Manager-PC zu überwachen.",managerTitle:"1. Manager starten",managerBody:"Starte LiveDesk auf dem Computer, der die Screens sieht. Der Manager startet UI und lokalen Server zusammen und öffnet http://127.0.0.1:5179.",managerPoints:["Der Befehl ist npx -y livedesk.","Der Manager nutzt 5179 für Screen Wall/API und 5197 für Client-Verbindungen.","Wenn alte LiveDesk-Prozesse Ports belegen, werden sie beim Start standardmäßig bereinigt."],clientTitle:"2. Workstation verbinden",clientBody:"Melde dich auf jedem überwachten Computer mit demselben Google-Konto an. Wenn kein Manager online ist, versucht der Client alle 5 Sekunden weiter.",clientPoints:["npx -y livedesk client nutzt den ersten freien Slot.","npx -y livedesk client 3 fixiert den Rechner auf Slot 3.","Clients warten weiter, damit große Setups kein wiederholtes Login brauchen."],syncTitle:"3. Sync Server und Discovery",syncBody:"Sync Server veröffentlicht diesen Manager als aktive Screen Wall des Kontos. Clients lesen den Supabase-Eintrag und testen Endpoints der Reihe nach.",syncPoints:["Enthält host instance, LAN/private Adressen, public Kandidaten, pair token und kurze lease.","LAN-Kandidaten werden zuerst versucht, danach public Kandidaten.","Nach Änderungen an Manager, VPN, Firewall oder Router Sync Server drücken.","Chrome Local Network Access auf livedesk.pages.dev ist nicht mehr der Standardpfad. Die npm Manager App ist der echte Server."],platformTitle:"4. Plattformstatus",platformBody:"Windows wurde mit Live-Screen-Transfer geprüft. macOS und Linux folgen demselben npm-Pfad.",platformPoints:["Windows: verifiziert.","macOS: Capture und Control brauchen Screen Recording/Accessibility Rechte.","Linux: linux-x64 Runtime, grim/gnome-screenshot/import/scrot Capture und xdotool Input Backend sind ergänzt. Audio ist deaktiviert."],firewallTitle:"Firewall und entfernte Standorte",firewallBody:"Im gleichen LAN ist Router-Forwarding meist unnötig. Aus anderen Netzwerken müssen Clients den Client-Port des Managers erreichen.",firewallPoints:["Client-Verbindungsport: TCP 5197.","Client-Rechner brauchen normalerweise nur ausgehenden Zugriff.","Für entfernte Netzwerke TCP 5197 inbound am Manager erlauben und vom Router zum Manager-PC forwarden.","Port 5179 ist für die Manager-UI; nur öffnen, wenn ein Remote-Browser die Wall direkt öffnen muss.","VPN, Tailscale, ZeroTier oder feste IP-Allowlists bevorzugen."],commandsTitle:"Aktuelle Befehle",commandsBody:"Die Produktlinie ist ein Terminalbefehl über Betriebssysteme hinweg, statt Website suchen, herunterladen und installieren.",managerCommandLabel:"Manager starten",clientCommandLabel:"Workstation verbinden",slotCommandLabel:"An Slot 3 fixieren",manualCommandLabel:"Erweiterte manuelle Verbindung"}),"pt-BR":xt({languageName:"Português",languageLabel:"Idioma do documento",eyebrow:"LiveDesk Manual",title:"Abra um Screen Wall local com um comando",intro:"LiveDesk é um deck npm-first para monitorar várias estações, caixas de IA, Mac minis e máquinas dev a partir de um PC manager.",managerTitle:"1. Execute o manager",managerBody:"Rode LiveDesk no computador que verá as telas. O manager inicia a UI e o servidor local juntos e abre http://127.0.0.1:5179.",managerPoints:["O comando é npx -y livedesk.","O manager usa 5179 para Screen Wall/API e 5197 para conexões client.","Se um processo antigo ocupa as portas, a inicialização limpa por padrão."],clientTitle:"2. Conecte uma workstation",clientBody:"Em cada computador monitorado, entre com a mesma conta Google. Se o manager ainda não estiver online, o client tenta a cada 5 segundos.",clientPoints:["Use npx -y livedesk client para o primeiro slot livre.","Use npx -y livedesk client 3 para fixar no slot 3.","Clients continuam tentando para evitar login repetido em muitos PCs."],syncTitle:"3. Sync Server e descoberta",syncBody:"Sync Server publica este manager como Screen Wall ativo da conta. Clients leem o registro no Supabase e testam endpoints.",syncPoints:["Inclui host instance, endereços LAN/private, candidatos public, pair token e lease curto.","Candidatos LAN vêm primeiro; public depois se necessário.","Clique Sync Server após mudanças de manager, VPN, firewall ou roteador.","Chrome Local Network Access em livedesk.pages.dev não é mais o caminho padrão. O app npm manager é o servidor real."],platformTitle:"4. Estado das plataformas",platformBody:"Windows foi verificado com transferência de tela. macOS e Linux seguem o mesmo caminho npm.",platformPoints:["Windows: verificado.","macOS: captura e controle precisam de permissões Screen Recording/Accessibility.","Linux: runtime linux-x64, captura grim/gnome-screenshot/import/scrot e entrada xdotool adicionados. Áudio ainda desativado."],firewallTitle:"Firewall e locais remotos",firewallBody:"Na mesma LAN normalmente não é preciso port forwarding. Em outra rede, clients precisam alcançar a porta client do manager.",firewallPoints:["Porta client: TCP 5197.","Máquinas client normalmente só precisam de saída.","Para redes remotas, permita TCP 5197 inbound no manager e encaminhe TCP 5197 para o PC manager.","A porta 5179 é para a UI do manager; exponha apenas se um navegador remoto precisar abrir o Wall.","Prefira VPN, Tailscale, ZeroTier ou allowlist de IP fixo."],commandsTitle:"Comandos atuais",commandsBody:"A direção do produto é um comando de terminal comum entre sistemas, não baixar e instalar manualmente.",managerCommandLabel:"Iniciar manager",clientCommandLabel:"Conectar workstation",slotCommandLabel:"Fixar no slot 3",manualCommandLabel:"Conexão manual avançada"}),it:xt({languageName:"Italiano",languageLabel:"Lingua documento",eyebrow:"LiveDesk Manual",title:"Apri uno Screen Wall locale con un comando",intro:"LiveDesk è un deck npm-first per monitorare workstation, box AI, Mac mini e macchine dev da un solo PC manager.",managerTitle:"1. Avvia il manager",managerBody:"Esegui LiveDesk sul computer che guarderà gli schermi. Il manager avvia UI e server locale e apre http://127.0.0.1:5179.",managerPoints:["Il comando è npx -y livedesk.","Il manager usa 5179 per Screen Wall/API e 5197 per connessioni client.","Se vecchi processi occupano le porte, l’avvio le pulisce di default."],clientTitle:"2. Connetti una workstation",clientBody:"Su ogni computer monitorato, accedi con lo stesso account Google. Se il manager non è online, il client riprova ogni 5 secondi.",clientPoints:["npx -y livedesk client usa il primo slot libero.","npx -y livedesk client 3 fissa la macchina allo slot 3.","I client continuano a provare per evitare login ripetuti."],syncTitle:"3. Sync Server e discovery",syncBody:"Sync Server pubblica questo manager come Screen Wall attivo dell’account. I client leggono Supabase e provano gli endpoint.",syncPoints:["Include host instance, indirizzi LAN/private, candidati public, pair token e lease breve.","Prima LAN, poi public se necessario.","Premi Sync Server dopo cambi di manager, VPN, firewall o router.","Chrome Local Network Access su livedesk.pages.dev non è più il percorso principale. L’app npm manager è il server reale."],platformTitle:"4. Stato piattaforme",platformBody:"Windows è verificato con trasferimento schermo live. macOS e Linux seguono lo stesso percorso npm.",platformPoints:["Windows: verificato.","macOS: capture e control richiedono permessi Screen Recording/Accessibility.","Linux: aggiunti runtime linux-x64, capture grim/gnome-screenshot/import/scrot e input xdotool. Audio disattivato."],firewallTitle:"Firewall e sedi remote",firewallBody:"Nella stessa LAN di solito non serve port forwarding. Da altre reti, i client devono raggiungere la porta client del manager.",firewallPoints:["Porta client: TCP 5197.","I client normalmente richiedono solo uscita.","Per reti remote, abilita TCP 5197 inbound sul manager e inoltra TCP 5197 al PC manager.","La porta 5179 è per la UI manager; esponila solo se un browser remoto deve aprire il Wall.","Preferisci VPN, Tailscale, ZeroTier o IP allowlist."],commandsTitle:"Comandi attuali",commandsBody:"La direzione è un comando terminale comune tra sistemi operativi, invece di download e install manuale.",managerCommandLabel:"Avvia manager",clientCommandLabel:"Connetti workstation",slotCommandLabel:"Fissa allo slot 3",manualCommandLabel:"Connessione manuale avanzata"}),id:xt({languageName:"Bahasa Indonesia",languageLabel:"Bahasa dokumen",eyebrow:"LiveDesk Manual",title:"Buka Screen Wall lokal dengan satu perintah",intro:"LiveDesk adalah deck npm-first untuk memantau banyak workstation, AI box, Mac mini, dan mesin dev dari satu PC manager.",managerTitle:"1. Jalankan manager",managerBody:"Jalankan LiveDesk di komputer yang melihat layar. Manager membuka UI dan server lokal bersama, lalu membuka http://127.0.0.1:5179.",managerPoints:["Perintahnya npx -y livedesk.","Manager memakai 5179 untuk Screen Wall/API dan 5197 untuk koneksi client.","Jika proses lama memakai port itu, startup membersihkannya secara default."],clientTitle:"2. Hubungkan workstation",clientBody:"Di komputer yang dipantau, masuk dengan akun Google yang sama. Jika manager belum online, client tetap mencoba tiap 5 detik.",clientPoints:["npx -y livedesk client memakai slot kosong pertama.","npx -y livedesk client 3 mengunci mesin ke slot 3.","Client terus mencoba agar banyak PC tidak perlu login berulang."],syncTitle:"3. Sync Server dan discovery",syncBody:"Sync Server menerbitkan manager ini sebagai Screen Wall aktif untuk akun. Client membaca Supabase dan mencoba endpoint.",syncPoints:["Berisi host instance, alamat LAN/private, kandidat public, pair token, dan lease pendek.","Kandidat LAN dicoba lebih dulu, lalu public jika perlu.","Tekan Sync Server setelah perubahan manager, VPN, firewall, atau router.","Chrome Local Network Access di livedesk.pages.dev bukan jalur utama lagi. App npm manager adalah server sebenarnya."],platformTitle:"4. Status platform",platformBody:"Windows sudah diverifikasi dengan live screen transfer. macOS dan Linux mengikuti jalur npm yang sama.",platformPoints:["Windows: terverifikasi.","macOS: capture dan control perlu izin Screen Recording/Accessibility.","Linux: runtime linux-x64, capture grim/gnome-screenshot/import/scrot, dan input xdotool sudah ditambahkan. Audio belum aktif."],firewallTitle:"Firewall dan lokasi luar",firewallBody:"Di LAN yang sama biasanya tidak perlu port forwarding. Dari jaringan lain, client harus mencapai port client manager.",firewallPoints:["Port client: TCP 5197.","Mesin client biasanya hanya perlu akses keluar.","Untuk jaringan luar, izinkan TCP 5197 inbound di manager dan forward TCP 5197 ke PC manager.","Port 5179 untuk UI manager; buka hanya jika browser luar harus membuka Wall.","Utamakan VPN, Tailscale, ZeroTier, atau IP allowlist."],commandsTitle:"Perintah saat ini",commandsBody:"Arah produk adalah satu perintah terminal lintas OS, bukan download dan instal manual.",managerCommandLabel:"Mulai manager",clientCommandLabel:"Hubungkan workstation",slotCommandLabel:"Kunci ke slot 3",manualCommandLabel:"Koneksi manual lanjutan"}),vi:xt({languageName:"Tiếng Việt",languageLabel:"Ngôn ngữ tài liệu",eyebrow:"LiveDesk Manual",title:"Mở Screen Wall cục bộ bằng một lệnh",intro:"LiveDesk là deck npm-first để giám sát nhiều workstation, máy AI, Mac mini và máy dev từ một PC manager.",managerTitle:"1. Chạy manager",managerBody:"Chạy LiveDesk trên máy dùng để xem màn hình. Manager khởi động UI và server cục bộ cùng lúc, rồi mở http://127.0.0.1:5179.",managerPoints:["Lệnh là npx -y livedesk.","Manager dùng 5179 cho Screen Wall/API và 5197 cho kết nối client.","Nếu tiến trình cũ giữ port, startup mặc định sẽ dọn và khởi động lại."],clientTitle:"2. Kết nối workstation",clientBody:"Trên mỗi máy được giám sát, đăng nhập cùng tài khoản Google. Nếu manager chưa online, client tiếp tục thử mỗi 5 giây.",clientPoints:["npx -y livedesk client dùng slot trống đầu tiên.","npx -y livedesk client 3 ghim máy vào slot 3.","Client tiếp tục chờ để nhiều máy không cần đăng nhập lại."],syncTitle:"3. Sync Server và tự phát hiện",syncBody:"Sync Server đăng manager này là Screen Wall đang hoạt động của tài khoản. Client đọc Supabase và thử các endpoint.",syncPoints:["Bao gồm host instance, địa chỉ LAN/private, public candidate, pair token và lease ngắn.","Ưu tiên LAN trước, sau đó thử public nếu cần.","Bấm Sync Server sau thay đổi manager, VPN, firewall hoặc router.","Chrome Local Network Access trên livedesk.pages.dev không còn là đường chạy chính. App npm manager mới là server thật."],platformTitle:"4. Trạng thái nền tảng",platformBody:"Windows đã được kiểm chứng với truyền màn hình live. macOS và Linux đi theo cùng đường npm.",platformPoints:["Windows: đã kiểm chứng.","macOS: capture và control cần quyền Screen Recording/Accessibility.","Linux: đã thêm runtime linux-x64, capture grim/gnome-screenshot/import/scrot và input xdotool. Audio chưa bật."],firewallTitle:"Firewall và địa điểm ngoài",firewallBody:"Trong cùng LAN thường không cần port forwarding. Từ mạng khác, client phải truy cập được port client của manager.",firewallPoints:["Port client: TCP 5197.","Máy client thường chỉ cần kết nối outbound.","Với mạng ngoài, cho phép TCP 5197 inbound trên manager và forward TCP 5197 tới PC manager.","Port 5179 dành cho UI manager; chỉ mở nếu trình duyệt từ xa cần mở Wall trực tiếp.","Ưu tiên VPN, Tailscale, ZeroTier hoặc allowlist IP cố định."],commandsTitle:"Lệnh hiện tại",commandsBody:"Hướng sản phẩm là một lệnh terminal dùng chung giữa các OS, thay vì tải và cài thủ công.",managerCommandLabel:"Khởi động manager",clientCommandLabel:"Kết nối workstation",slotCommandLabel:"Ghim vào slot 3",manualCommandLabel:"Kết nối thủ công nâng cao"}),th:xt({languageName:"ไทย",languageLabel:"ภาษาของเอกสาร",eyebrow:"LiveDesk Manual",title:"เปิด Screen Wall ภายในด้วยคำสั่งเดียว",intro:"LiveDesk คือ deck แบบ npm-first สำหรับดู workstation, กล่อง AI, Mac mini และเครื่อง dev หลายเครื่องจาก manager PC เครื่องเดียว",managerTitle:"1. รัน manager",managerBody:"รัน LiveDesk บนเครื่องที่ใช้ดูหน้าจอ Manager จะเปิด UI และ local server พร้อมกัน แล้วเปิด http://127.0.0.1:5179",managerPoints:["คำสั่งคือ npx -y livedesk","Manager ใช้ 5179 สำหรับ Screen Wall/API และ 5197 สำหรับ client connection","ถ้า process เก่ายังใช้ port อยู่ startup จะล้างให้โดย default"],clientTitle:"2. เชื่อม workstation",clientBody:"บนเครื่องที่ต้อง monitor ให้ login ด้วย Google account เดียวกัน ถ้า manager ยังไม่ออนไลน์ client จะลองใหม่ทุก 5 วินาที",clientPoints:["npx -y livedesk client จะใช้ slot ว่างแรก","npx -y livedesk client 3 จะตรึงเครื่องไว้ที่ slot 3","Client จะรอต่อเนื่องเพื่อไม่ต้อง login ซ้ำเมื่อมีหลายเครื่อง"],syncTitle:"3. Sync Server และ discovery",syncBody:"Sync Server จะ publish manager นี้เป็น active Screen Wall ของ account แล้ว client อ่านข้อมูลจาก Supabase และลอง endpoint ต่างๆ",syncPoints:["มี host instance, LAN/private address, public candidate, pair token และ short lease","ลอง LAN ก่อน แล้วค่อยลอง public ถ้าจำเป็น","กด Sync Server หลังเปลี่ยน manager, VPN, firewall หรือ router","Chrome Local Network Access บน livedesk.pages.dev ไม่ใช่ runtime หลักแล้ว app npm manager คือ server จริง"],platformTitle:"4. สถานะ platform",platformBody:"Windows ตรวจสอบแล้วว่าส่งภาพ live ได้ macOS และ Linux ใช้เส้นทาง npm เดียวกัน",platformPoints:["Windows: verified","macOS: capture/control ต้องใช้สิทธิ์ Screen Recording/Accessibility","Linux: เพิ่ม linux-x64 runtime, grim/gnome-screenshot/import/scrot capture และ xdotool input แล้ว audio ยังปิดอยู่"],firewallTitle:"Firewall และเครื่องต่างสถานที่",firewallBody:"ใน LAN เดียวกันปกติไม่ต้อง port forwarding ถ้าอยู่คนละ network client ต้องเข้าถึง client port ของ manager ได้",firewallPoints:["Client port คือ TCP 5197","เครื่อง client ปกติต้องการ outbound เท่านั้น","ถ้าอยู่นอก network ให้เปิด TCP 5197 inbound ที่ manager และ forward TCP 5197 ไปยัง manager PC","Port 5179 เป็น UI ของ manager เปิดเฉพาะเมื่อ browser ระยะไกลต้องเปิด Wall โดยตรง","ควรใช้ VPN, Tailscale, ZeroTier หรือ IP allowlist ก่อนเปิดสู่ public internet"],commandsTitle:"คำสั่งปัจจุบัน",commandsBody:"ทิศทาง product คือคำสั่ง terminal เดียวข้าม OS ไม่ใช่ download/install จากเว็บไซต์",managerCommandLabel:"เริ่ม manager",clientCommandLabel:"เชื่อม workstation",slotCommandLabel:"ตรึง slot 3",manualCommandLabel:"manual connection ขั้นสูง"}),hi:xt({languageName:"हिन्दी",languageLabel:"दस्तावेज़ भाषा",eyebrow:"LiveDesk Manual",title:"एक कमांड से local Screen Wall खोलें",intro:"LiveDesk एक npm-first remote work deck है जिससे एक manager PC से कई workstation, AI box, Mac mini और dev machines देखे जा सकते हैं।",managerTitle:"1. manager चलाएं",managerBody:"जिस computer से screens देखनी हैं उस पर LiveDesk manager चलाएं। यह UI और local server साथ में शुरू करता है और http://127.0.0.1:5179 खोलता है।",managerPoints:["कमांड है npx -y livedesk।","Manager Screen Wall/API के लिए 5179 और client connections के लिए 5197 इस्तेमाल करता है।","अगर पुराने LiveDesk ports बचे हों तो startup default रूप से साफ करता है।"],clientTitle:"2. workstation जोड़ें",clientBody:"हर monitored computer पर उसी Google account से sign in करें। Manager online न हो तब भी client बंद नहीं होता और हर 5 सेकंड retry करता है।",clientPoints:["npx -y livedesk client पहला खाली slot लेता है।","npx -y livedesk client 3 machine को slot 3 पर pin करता है।","बहुत सी machines हों तब भी बार-बार login की जरूरत नहीं रहती।"],syncTitle:"3. Sync Server और discovery",syncBody:"Sync Server इस manager को account का active Screen Wall बनाकर Supabase में publish करता है। Clients record पढ़कर endpoints try करते हैं।",syncPoints:["इसमें host instance, LAN/private addresses, public candidates, pair token और short lease होता है।","LAN candidates पहले try होते हैं, जरूरत हो तो public candidates।","Manager, VPN, firewall या router बदलने के बाद Sync Server दबाएं।","livedesk.pages.dev का Chrome Local Network Access अब default runtime नहीं है। npm manager app ही real server है।"],platformTitle:"4. Platform status",platformBody:"Windows live screen transfer के साथ verified है। macOS और Linux भी इसी npm path पर आगे बढ़ रहे हैं।",platformPoints:["Windows: verified.","macOS: capture/control के लिए Screen Recording/Accessibility permissions चाहिए।","Linux: linux-x64 runtime, grim/gnome-screenshot/import/scrot capture और xdotool input backend जोड़े गए हैं। Audio अभी disabled है।"],firewallTitle:"Firewall और remote locations",firewallBody:"Same LAN में आम तौर पर router forwarding जरूरी नहीं। दूसरे network से clients को manager client port तक पहुंचना होगा।",firewallPoints:["Client connection port: TCP 5197.","Client machines को आम तौर पर सिर्फ outbound access चाहिए।","Remote network के लिए manager firewall में TCP 5197 inbound allow करें और router से TCP 5197 manager PC पर forward करें।","5179 manager UI port है; इसे तभी expose करें जब remote browser को Wall खोलना हो।","Public internet से पहले VPN, Tailscale, ZeroTier या fixed IP allowlist बेहतर है।"],commandsTitle:"Current commands",commandsBody:"Product direction है OS के बीच एक terminal command, website से download/install नहीं।",managerCommandLabel:"Start manager",clientCommandLabel:"Connect workstation",slotCommandLabel:"Pin to slot 3",manualCommandLabel:"Advanced manual connection"}),ar:xt({languageName:"العربية",languageLabel:"لغة المستند",eyebrow:"LiveDesk Manual",title:"افتح Screen Wall محلي بأمر واحد",intro:"LiveDesk هو deck بنمط npm-first لمراقبة عدة workstations وأجهزة AI وMac mini وأجهزة تطوير من كمبيوتر manager واحد.",managerTitle:"1. شغل manager",managerBody:"شغل LiveDesk على الكمبيوتر الذي سيعرض الشاشات. يبدأ manager الواجهة والخادم المحلي معا ويفتح http://127.0.0.1:5179.",managerPoints:["الأمر هو npx -y livedesk.","يستخدم manager المنفذ 5179 للواجهة/API والمنفذ 5197 لاتصالات client.","إذا بقيت عملية LiveDesk قديمة على المنافذ، يتم تنظيفها افتراضيا عند التشغيل."],clientTitle:"2. وصل workstation",clientBody:"على كل كمبيوتر تتم مراقبته، سجل الدخول بنفس حساب Google. إذا لم يكن manager متاحا، يبقى client يعمل ويحاول كل 5 ثوان.",clientPoints:["npx -y livedesk client يختار أول slot فارغ.","npx -y livedesk client 3 يثبت الجهاز في slot 3.","clients تستمر بالمحاولة لتجنب تكرار تسجيل الدخول عند كثرة الأجهزة."],syncTitle:"3. Sync Server والاكتشاف",syncBody:"Sync Server ينشر هذا manager كـ active Screen Wall للحساب. يقرأ clients سجل Supabase ويجربون endpoints بالترتيب.",syncPoints:["السجل يتضمن host instance وعناوين LAN/private وpublic candidates وpair token وlease قصير.","يتم تفضيل LAN أولا، ثم public عند الحاجة.","اضغط Sync Server بعد تغيير manager أو VPN أو firewall أو router.","Chrome Local Network Access على livedesk.pages.dev لم يعد مسار التشغيل الافتراضي. تطبيق npm manager هو الخادم الحقيقي."],platformTitle:"4. حالة المنصات",platformBody:"Windows تم التحقق منه مع نقل شاشة live. macOS وLinux يتبعان نفس مسار npm.",platformPoints:["Windows: تم التحقق.","macOS: capture/control يحتاجان أذونات Screen Recording/Accessibility.","Linux: تمت إضافة linux-x64 runtime وgrim/gnome-screenshot/import/scrot capture وxdotool input. الصوت ما زال معطلا."],firewallTitle:"Firewall والمواقع البعيدة",firewallBody:"داخل نفس LAN غالبا لا تحتاج port forwarding. من شبكة أخرى يجب أن يصل client إلى منفذ manager client.",firewallPoints:["منفذ client: TCP 5197.","أجهزة client تحتاج عادة اتصال outbound فقط.","للشبكات البعيدة، اسمح TCP 5197 inbound على manager ووجه TCP 5197 من router إلى manager PC.","المنفذ 5179 مخصص لواجهة manager؛ اكشفه فقط إذا كان متصفح بعيد يحتاج فتح Wall مباشرة.","يفضل VPN أو Tailscale أو ZeroTier أو fixed IP allowlist بدل التعريض العام."],commandsTitle:"الأوامر الحالية",commandsBody:"اتجاه المنتج هو أمر terminal واحد عبر الأنظمة، وليس تحميل وتثبيت يدوي من موقع.",managerCommandLabel:"Start manager",clientCommandLabel:"Connect workstation",slotCommandLabel:"Pin to slot 3",manualCommandLabel:"Advanced manual connection"}),tr:xt({languageName:"Türkçe",languageLabel:"Belge dili",eyebrow:"LiveDesk Manual",title:"Yerel Screen Wall tek komutla açılsın",intro:"LiveDesk, tek bir manager PC üzerinden birçok workstation, AI box, Mac mini ve dev machine izlemek için npm-first bir çalışma deckidir.",managerTitle:"1. Manager çalıştır",managerBody:"Ekranları izleyecek bilgisayarda LiveDesk manager çalıştır. Manager UI ve local server birlikte başlar ve http://127.0.0.1:5179 açılır.",managerPoints:["Komut: npx -y livedesk.","Manager Screen Wall/API için 5179, client bağlantıları için 5197 kullanır.","Eski LiveDesk process portları tutuyorsa başlangıç varsayılan olarak temizler."],clientTitle:"2. Workstation bağla",clientBody:"İzlenecek bilgisayarda aynı Google hesabıyla giriş yap. Manager henüz online değilse client kapanmaz ve her 5 saniyede tekrar dener.",clientPoints:["npx -y livedesk client ilk boş slota yerleşir.","npx -y livedesk client 3 makineyi slot 3’e sabitler.","Çok makinede tekrar tekrar login gerekmesin diye client beklemeye devam eder."],syncTitle:"3. Sync Server ve discovery",syncBody:"Sync Server bu managerı hesabın active Screen Wall kaydı olarak Supabase’e yazar. Clients bu kaydı okuyup endpoint adaylarını dener.",syncPoints:["Host instance, LAN/private adresler, public adaylar, pair token ve kısa lease içerir.","Önce LAN adayları, gerekirse public adaylar denenir.","Manager, VPN, firewall veya router değişince Sync Server’a bas.","livedesk.pages.dev üzerindeki Chrome Local Network Access artık default runtime yolu değil. Gerçek server npm manager app."],platformTitle:"4. Platform durumu",platformBody:"Windows live screen transfer ile doğrulandı. macOS ve Linux aynı npm yolunu takip ediyor.",platformPoints:["Windows: doğrulandı.","macOS: capture/control için Screen Recording/Accessibility izinleri gerekir.","Linux: linux-x64 runtime, grim/gnome-screenshot/import/scrot capture ve xdotool input backend eklendi. Audio kapalı."],firewallTitle:"Firewall ve uzak konumlar",firewallBody:"Aynı LAN içinde genelde router forwarding gerekmez. Başka ağdan clients manager client portuna ulaşabilmelidir.",firewallPoints:["Client port: TCP 5197.","Client makineler normalde sadece outbound erişim ister.","Uzak ağ için manager firewall üzerinde TCP 5197 inbound aç ve routerdan TCP 5197yi manager PCye forward et.","5179 manager UI portudur; sadece uzak browser Wall açacaksa expose et.","Public internet yerine VPN, Tailscale, ZeroTier veya sabit IP allowlist tercih et."],commandsTitle:"Güncel komutlar",commandsBody:"Ürün yönü, webden indirip kurmak yerine işletim sistemleri arasında ortak tek terminal komutu.",managerCommandLabel:"Manager başlat",clientCommandLabel:"Workstation bağla",slotCommandLabel:"Slot 3’e sabitle",manualCommandLabel:"Gelişmiş manuel bağlantı"})},X_=Object.entries(Ar).map(([i,n])=>({id:i,label:n.languageName}));function Q_(){if(typeof navigator>"u")return"en";const i=navigator.languages?.length?navigator.languages:[navigator.language];for(const n of i){const r=n.toLowerCase();if(Ar[n])return n;if(r.startsWith("zh-tw")||r.startsWith("zh-hk"))return"zh-TW";if(r.startsWith("pt"))return"pt-BR";const l=r.split("-")[0];if(Ar[l])return l}return"en"}function vp({index:i,selected:n,onSelect:r}){const l=i+1;return y.jsx("article",{className:`device-tile placeholder-tile ${n?"selected":""}`,children:y.jsxs("button",{className:"tile-screen",onClick:r,"aria-pressed":n,title:`Select slot ${l}`,type:"button",children:[y.jsx("span",{className:"slot-grid","aria-hidden":"true"}),y.jsxs("span",{className:"empty-screen",children:[y.jsx(_r,{size:24}),y.jsxs("strong",{children:["Slot ",String(l).padStart(3,"0")]})]})]})})}function bp({device:i,frame:n,selected:r,controlEnabled:l,showStatus:c,monitorIndex:d,monitorCount:h,onSelect:m,onFocusDevice:g,onOpenControl:p,onCycleMonitor:S,sendInput:b}){const T=I.useRef(null),A=I.useRef(0),C=Zp(i),U=wr(d,h),$=h>1;I.useEffect(()=>{const N=T.current;if(!N||!n)return;let Y=!1;return d_(N,n,()=>Y).catch(()=>{}),()=>{Y=!0}},[n]);const P=N=>{const Y=N.currentTarget.getBoundingClientRect();return{normalizedX:Math.max(0,Math.min(1,(N.clientX-Y.left)/Math.max(1,Y.width))),normalizedY:Math.max(0,Math.min(1,(N.clientY-Y.top)/Math.max(1,Y.height)))}},q=(N,Y)=>{if(l){if(Y==="pointermove"){const ue=performance.now();if(ue-A.current<24)return;A.current=ue}b(i.deviceId,{type:Y,...P(N),button:I_(N.button)})}};return y.jsx("article",{className:`device-tile ${r?"selected":""} ${i.connected?"online":"offline"}`,children:y.jsxs("div",{className:"tile-screen",role:"button",tabIndex:l?-1:0,"aria-pressed":r,onClick:()=>{l||m()},onKeyDown:N=>{l||(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),m())},onDoubleClick:N=>{N.preventDefault(),p()},children:[y.jsx("canvas",{ref:T,className:"remote-canvas",tabIndex:l?0:-1,onPointerDown:N=>{l&&(g(),N.currentTarget.focus(),N.currentTarget.setPointerCapture(N.pointerId),q(N,"pointerdown"))},onPointerMove:N=>q(N,"pointermove"),onPointerUp:N=>q(N,"pointerup"),onWheel:N=>{l&&(N.preventDefault(),b(i.deviceId,{type:"wheel",deltaX:N.deltaX,deltaY:N.deltaY}))},onKeyDown:N=>{l&&b(i.deviceId,{type:"keydown",key:N.key,code:N.code,text:N.key.length===1?N.key:"",repeat:N.repeat})},onKeyUp:N=>{l&&b(i.deviceId,{type:"keyup",key:N.key,code:N.code,text:N.key.length===1?N.key:"",repeat:!1})},onContextMenu:N=>l&&N.preventDefault()}),!n&&y.jsx("span",{className:"empty-screen",children:y.jsx(_r,{size:26})}),c&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:`tile-health-pill state-${C.state}`,children:C.label}),y.jsx("span",{className:"tile-metrics","aria-label":`${Gs(i)} status`,children:C.metrics.slice(0,3).map(N=>y.jsxs("span",{className:`tile-metric state-${N.state}`,children:[y.jsx("b",{children:N.label}),y.jsx("em",{children:N.value}),N.ratio!==void 0&&y.jsx("i",{style:{width:`${Math.round(N.ratio*100)}%`}})]},N.id))})]}),$&&y.jsxs("span",{className:"monitor-cycle","aria-label":`${Gs(i)} display ${U+1} of ${h}`,children:[y.jsx("button",{className:"monitor-cycle-button previous",onClick:N=>{N.preventDefault(),N.stopPropagation(),S(-1)},title:"Previous display",type:"button",children:y.jsx(wp,{size:18})}),y.jsxs("span",{className:"monitor-cycle-count",children:["Screen ",U+1,"/",h]}),y.jsx("button",{className:"monitor-cycle-button next",onClick:N=>{N.preventDefault(),N.stopPropagation(),S(1)},title:"Next display",type:"button",children:y.jsx(_p,{size:18})})]})]})})}function W_(){const{session:i,loading:n}=__(),{target:r,error:l,refresh:c}=k_(i),d=I.useMemo(()=>{if(!r?.active)return null;const w=r.expires_at?Date.parse(r.expires_at):Number.POSITIVE_INFINITY;return Number.isFinite(w)&&w<=Date.now()?null:r},[r]),h=I.useMemo(()=>mp(d),[d]),m=I.useMemo(()=>h.length>0?[...new Set([...h,jt])]:[jt],[h]),[g,p]=I.useState(H_),S=I.useMemo(()=>m.some(w=>!!Ps(w)),[m]),b=!S||g,{status:T,devices:A,error:C,refresh:U,hubBaseUrl:$}=T_(m,b),{entitlement:P,licensed:q,loading:N,error:Y,refresh:ue}=E_(i),[G,Q]=I.useState([]),[Se,we]=I.useState([]),[Nt,We]=I.useState(""),[Le,mt]=I.useState(!1),[pt,Ge]=I.useState(!1),[D,K]=I.useState(""),[ae,te]=I.useState(""),[Ee,E]=I.useState(""),[M,J]=I.useState("wall"),[Z,de]=I.useState("large"),[me,xe]=I.useState(Q_),[Je,Xe]=I.useState(!1),[kn,mn]=I.useState(!1),[Ti,ki]=I.useState(!1),[Dn,Cr]=I.useState(!1),[ga,Yo]=I.useState(B_),[Ae,Ei]=I.useState(q_),[Un,Ai]=I.useState({}),[xi,Mn]=I.useState(null),[Ot,Or]=I.useState(!1),Rr=I.useRef(null),Ci=I.useRef(!1),Ja=I.useRef(0),He=I.useMemo(()=>A.filter(w=>w.connected),[A]),tl=I.useMemo(()=>He.reduce((w,V)=>Math.max(w,Ls(V.slotNumber)),0),[He]),tn=Math.max(j_,He.length,tl),Jo=I.useMemo(()=>{const w=Array(tn).fill(null),V=[];for(const ie of He){const W=Ls(ie.slotNumber);W>0&&W<=tn&&!w[W-1]?w[W-1]=ie:V.push(ie)}for(const ie of V){const W=w.findIndex(fe=>!fe);W<0?w.push(ie):w[W]=ie}return w},[He,tn]),pa=I.useMemo(()=>He.map(w=>w.deviceId),[He]),St=I.useMemo(()=>new Set(G),[G]),Lt=I.useMemo(()=>new Set(Se),[Se]),lt=I.useMemo(()=>He.filter(w=>St.has(w.deviceId)||Lt.has(Ls(w.slotNumber))),[He,St,Lt]),se=I.useMemo(()=>A.find(w=>w.deviceId===Nt)||lt[0]||null,[A,Nt,lt]),nn=I.useMemo(()=>se?Zp(se):null,[se]),Xo=se?Is(se,"control"):!1,ya=se?Is(se,"audio")||Is(se,"remoteAudio"):!1,Xa=He.length<=fr,ot=q||Xa,Dt=`Free plan includes up to ${fr} workstations. Upgrade to LTD for ${He.length} workstations.`,va=ot&&!!se,En=ot&&!!se&&Xo,nl=ot&&!!se&&ya,jr=ot?pa:[],Nr=I.useMemo(()=>({fps:Ae.fps,maxWidth:Ae.maxWidth,maxHeight:Ae.maxHeight,quality:Ae.quality,mode:Ae.frameMode,frameMode:Ae.frameMode,monitorSelections:Un}),[Un,Ae]),{frames:zn,state:Qo}=A_(jr,Ae.autoStartLive&&jr.length>0,$,Nr),{state:Lr,sendInput:Dr}=x_(En&&Le,$),{state:Ur,error:Oi}=R_(se?.deviceId||"",nl&&pt,$);I.useEffect(()=>{const w=new URLSearchParams(window.location.search).get("checkout");if(w==="success"){te("Checkout returned. Waiting for Dodo confirmation."),ue();const V=window.setInterval(()=>{ue()},4e3),ie=window.setTimeout(()=>{window.clearInterval(V)},45e3);return()=>{window.clearInterval(V),window.clearTimeout(ie)}}w==="cancelled"&&te("Checkout cancelled.")},[ue]),I.useEffect(()=>{!ot&&Le&&mt(!1),!ot&&pt&&Ge(!1)},[pt,Le,ot]),I.useEffect(()=>{Ge(!1)},[se?.deviceId]),I.useEffect(()=>{const w=He.map(W=>W.deviceId),V=new Set(w),ie=new Map(He.map(W=>[W.deviceId,W]));Q(W=>{const fe=W.filter(ce=>V.has(ce));return pp(W,fe)?W:fe}),We(W=>W&&V.has(W)?W:""),we(W=>{const fe=W.filter(ce=>ce>=1&&ce<=tn);return pp(W.map(String),fe.map(String))?W:fe}),Ai(W=>{let fe=!1;const ce={};for(const[ye,tt]of Object.entries(W)){if(!V.has(ye)){fe=!0;continue}const Ke=ie.get(ye),nt=wr(tt,Ke?bi(Ke):1);ce[ye]=nt,nt!==tt&&(fe=!0)}return fe?ce:W})},[He,tn]),I.useEffect(()=>{try{localStorage.setItem(Yp,ga)}catch{}},[ga]),I.useEffect(()=>{$_(Ae)},[Ae]);const Qa=I.useCallback(async()=>{const w=new Set(m);w.add(jt);try{const ce=await wn("/api/remote/status",void 0,jt);mp({endpoint:ce.agentEndpoint,endpoint_candidates:[...ce.agentEndpointCandidates||[],...ce.hostTargetEndpointCandidates||[]]}).forEach(ye=>w.add(ye))}catch{}const V=[...w].sort((ce,ye)=>{const tt=Ke=>{const nt=Ps(Ke);return nt==="local"?0:nt==="loopback"?1:2};return tt(ce)-tt(ye)||ce.localeCompare(ye)});let ie=!1,W="",fe=!1;try{for(const ce of V){const ye=Ps(ce);try{if(await wn("/api/health",void 0,ce),ye==="local")return p(!0),mr(!0),ce;ye==="loopback"&&(ie=!0,W=ce)}catch{ye==="local"&&(fe=!0)}}return ie?(fe&&te("LiveDesk Hub is reachable on this PC, but not through the LAN address yet. Restart LiveDesk Hub to bind 5179 on the network."),p(!0),mr(!0),W||jt):(p(!1),mr(!1),"")}catch{return p(!1),mr(!1),""}},[m]),Mr=async()=>{K("auth"),mn(!1),await Qa();const{error:w}=await Nn.auth.signInWithOAuth({provider:"google",options:{redirectTo:window.location.origin}});w&&(te(w.message),K(""))},al=async()=>{K("auth"),mn(!1),await Nn.auth.signOut(),K("")};I.useEffect(()=>{if(!kn)return;const w=ie=>{ie.target instanceof Element&&(ie.target.closest(".account-popover, .rail-account")||mn(!1))},V=ie=>{ie.key==="Escape"&&mn(!1)};return window.addEventListener("pointerdown",w),window.addEventListener("keydown",V),()=>{window.removeEventListener("pointerdown",w),window.removeEventListener("keydown",V)}},[kn]);const Vt=I.useCallback(async(w={})=>{const V=w.silent===!0,ie=w.takeover===!0,W=w.requestLocalAccess===!0,fe=W?await Qa():"";if(!i?.user){V||te("Sign in before publishing this host.");return}if(!Ci.current){Ci.current=!0,V||K("host");try{const ce=fe||$||jt,ye=T||await wn("/api/remote/status",void 0,ce);if(!ye.started)throw new Error("Start LiveDesk on this computer before syncing the server.");const tt=`livedesk-${i.user.id}`,Ke=await wn("/api/remote/host-target",{method:"POST",body:JSON.stringify({nodeId:tt,leaseMs:6e4,takeover:ie})},ce);if(!Ke.ok)throw new Error(Ke.error||"host-target-failed");const nt=await wn("/api/remote/status",void 0,ce),fl=Ke.hostTarget||{},ei=nt.hostTargetEndpointCandidates||nt.agentEndpointCandidates||ye.agentEndpointCandidates||[nt.agentEndpoint||ye.agentEndpoint].filter(Boolean),{data:Kt,error:Li}=await Nn.rpc("set_livedesk_remote_host_target",{p_node_id:tt,p_lease_id:String(fl.leaseId||nt.hostTargetLeaseId||crypto.randomUUID()),p_host_instance_id:nt.hostInstanceId||tt,p_endpoint:nt.hostTargetEndpoint||nt.agentEndpoint||ye.agentEndpoint,p_pair_token:nt.pairToken||"",p_manager_package:"@livedesk/hub",p_manager_version:nt.managerVersion||"0.1.0",p_agent_package:"@livedesk/client",p_activated_at:new Date().toISOString(),p_expires_at:new Date(Date.now()+6e4).toISOString(),p_takeover:ie,p_endpoint_candidates:ei});if(Li)throw Li;const Jn=Array.isArray(Kt)?Kt[0]:Kt;if(Jn&&Jn.ok===!1)throw new Error(Jn.reason||"registry-rejected");V||(te("Host published."),(W||S)&&(p(!0),mr(!0)),U()),c()}catch(ce){if(!V){const ye=ce instanceof Error?ce.message:String(ce);ye.includes("local network access")&&(p(!1),mr(!1)),te(ye)}}finally{Ci.current=!1,V||K("")}}},[$,S,U,c,Qa,i,T]);I.useEffect(()=>{if(!i?.user||!T?.started||C)return;const w=r?.expires_at?Date.parse(r.expires_at):Number.POSITIVE_INFINITY,V=r?.active===!0&&(!r.expires_at||!Number.isFinite(w)||w>Date.now()),ie=!!r?.host_instance_id&&!!T.hostInstanceId&&r.host_instance_id===T.hostInstanceId;if(V&&!ie)return;let W=!1;const fe=()=>{if(W)return;const ye=Date.now();ye-Ja.current<25e3||(Ja.current=ye,Vt({silent:!0}))};fe();const ce=window.setInterval(fe,3e4);return()=>{W=!0,window.clearInterval(ce)}},[C,Vt,i?.user?.id,T?.agentEndpoint,T?.hostInstanceId,T?.started,r?.active,r?.expires_at,r?.host_instance_id]);const Ve=I.useCallback(w=>{w&&(We(w),Q(V=>V.includes(w)?V:[...V,w]))},[]),wt=I.useCallback(w=>{if(!w)return;const V=He.find(W=>W.deviceId===w),ie=Ls(V?.slotNumber);We(w),ie>0&&we(W=>W.filter(fe=>fe!==ie)),Q(W=>W.includes(w)?W:[...W,w])},[He]),Bn=I.useCallback(w=>{!Number.isInteger(w)||w<1||w>tn||(We(""),we(V=>V.includes(w)?V.filter(ie=>ie!==w):[...V,w].sort((ie,W)=>ie-W)))},[tn]),Hn=I.useCallback(()=>{Q([]),we([]),We(""),mt(!1),Ge(!1)},[]),il=I.useCallback(()=>{Q([]),We(""),mt(!1),Ge(!1),we(Array.from({length:tn},(w,V)=>V+1))},[tn]),rl=I.useCallback((w,V)=>{const ie=He.find(fe=>fe.deviceId===w);if(!ie)return;const W=bi(ie);W<=1||(Ai(fe=>{const ye=(wr(fe[w],W)+V+W)%W;return{...fe,[w]:ye}}),Ve(w))},[He,Ve]);I.useEffect(()=>{const w=V=>{const ie=V.target,W=ie?.tagName?.toLowerCase();ie?.isContentEditable||W==="input"||W==="textarea"||W==="select"||((V.ctrlKey||V.metaKey)&&V.key.toLowerCase()==="a"&&(V.preventDefault(),il()),V.key==="Escape"&&Hn())};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[Hn,il]);const ba=async w=>{if(!ot){te(Dt);return}Ve(w);try{const V=He.find(ie=>ie.deviceId===w);await wn(`/api/remote/devices/${encodeURIComponent(w)}/live/start`,{method:"POST",body:JSON.stringify({fps:Ae.fps,maxWidth:Ae.maxWidth,maxHeight:Ae.maxHeight,quality:Ae.quality,mode:Ae.frameMode,frameMode:Ae.frameMode,monitorIndex:wr(Un[w],V?bi(V):1)})},$),te("Live stream requested."),U()}catch(V){te(V instanceof Error?V.message:String(V))}},Sa=async w=>{if(Ve(w),J("control"),!ot){mt(!1),te(Dt);return}mt(!0),await ba(w)},zr=async()=>{if(!se){te("Select a workstation before playing audio.");return}if(!ot){te(Dt);return}if(!ya){te("Selected workstation does not report remote audio support yet.");return}const w=!pt;Ge(w);try{await wn(`/api/remote/devices/${encodeURIComponent(se.deviceId)}/audio/${w?"start":"stop"}`,{method:"POST",body:JSON.stringify({mimeType:"audio/webm;codecs=opus",sampleRate:48e3,channels:2})},$),te(w?"Remote audio requested.":"Remote audio stopped.")}catch(V){Ge(!1),te(V instanceof Error?V.message:String(V))}},qn=async w=>{const V=Array.from(w).filter(ce=>ce.size>=0);if(V.length===0)return;if(!ot){te(Dt);return}const ie=lt.length>0?lt.map(ce=>ce.deviceId):se?[se.deviceId]:[];if(ie.length===0){te("Select at least one workstation before dropping files.");return}const W=V.reduce((ce,ye)=>ce+ye.size,0),fe=crypto.randomUUID();if(W>L_){Mn({id:fe,status:"failed",progress:100,message:`Transfer is too large (${_i(W)}).`});return}Mn({id:fe,status:"reading",progress:2,message:`Preparing ${V.length} file${V.length===1?"":"s"}`});try{let ce=0;const ye=[];for(const Ke of V){const nt=await Ke.arrayBuffer();ce+=Ke.size,Mn({id:fe,status:"reading",progress:Math.max(4,Math.round(ce/Math.max(1,W)*58)),message:`Preparing ${_i(ce)} / ${_i(W)}`}),ye.push({name:Ke.name,relativePath:Ke.webkitRelativePath||Ke.name,size:Ke.size,type:Ke.type,lastModified:Ke.lastModified,dataBase64:P_(nt)})}Mn({id:fe,status:"sending",progress:72,message:`Sending to ${ie.length} workstation${ie.length===1?"":"s"}`});const tt=await wn("/api/remote/files/transfer",{method:"POST",body:JSON.stringify({transferId:fe,deviceIds:ie,remoteDirectory:ga.trim(),files:ye})},$);if(!tt.ok)throw new Error(tt.error||"file-transfer-not-queued");Mn({id:fe,status:"queued",progress:100,message:`Queued ${V.length} file${V.length===1?"":"s"} to ${tt.queued}/${tt.total}`}),window.setTimeout(()=>{Mn(Ke=>Ke?.id===fe&&Ke.status==="queued"?null:Ke)},4500)}catch(ce){Mn({id:fe,status:"failed",progress:100,message:ce instanceof Error?ce.message:String(ce)})}},wa=w=>{w.preventDefault(),w.stopPropagation(),Or(!1),qn(w.dataTransfer.files)},Wa=async()=>{const w=Ee.trim();if(w){if(!ot){te(Dt);return}K("task");try{await wn("/api/remote/tasks",{method:"POST",body:JSON.stringify({instruction:w,allConnected:!0,approvalLevel:"task-only"})},$),E(""),te("Task queued."),U()}catch(V){te(V instanceof Error?V.message:String(V))}finally{K("")}}},$n=async()=>{if(!i){te("Sign in with Google before checkout.");return}if(q){te("LiveDesk license is already active.");return}K("checkout");try{const{data:w,error:V}=await Nn.functions.invoke("dodo-checkout",{body:{plan:"ltd"}});if(V)throw V;if(!w?.checkout_url)throw new Error("Checkout function did not return a checkout URL.");window.location.assign(w.checkout_url)}catch(w){te(w instanceof Error?w.message:String(w)),K("")}},qe=M_(),Br=z_(),sl=He.length,Pn=pa.filter(w=>zn.has(w)).length,In=C?"offline":T?.started?"online":"starting",ll=M==="settings",Hr=M==="pricing",qr=M==="doc",ol=!Hr&&!qr,Ri=M==="control",Gn=lt.length+Se.filter(w=>!He.some(V=>Ls(V.slotNumber)===w)).length,gn=Se.length===1?`Slot ${String(Se[0]).padStart(3,"0")}`:`${Se.length} slots selected`,Ut=Gn===0?"No workstation":Gn>1?`${Gn} selected`:se?Gs(se):gn,yt=Ar[me]||Ar.en,ji=yt.sync||Ar.en.sync,Za=n||N?"checking":q?`${(P?.plan||"ltd").toUpperCase()} active`:Xa?`Free ${He.length}/${fr}`:`Upgrade ${He.length}/${fr}`,cl=q?"Licensed":D==="checkout"?"Opening":"$30 LTD",Wo=q?"License active":i?q?"Licensed":D==="checkout"?"Opening checkout":"Buy with Dodo":D==="auth"?"Opening Google":"Sign in to buy",Mt=q||D==="checkout"||D==="auth"||n||N,Ni=i?.user.user_metadata,Fa=yp(Ni,"avatar_url","picture"),Vn=yp(Ni,"full_name","name")||i?.user.email||"Google",Kn=Vn.slice(0,1).toUpperCase(),ul=T?.started?"Local app ready":"Start LiveDesk",dl=r?.active?"Published":i?"Not published":"Sign in required",_a=vd.find(w=>w.width===Ae.maxWidth&&w.height===Ae.maxHeight)?.id||`${Ae.maxWidth}x${Ae.maxHeight}`,Zo=Lo.find(w=>w.id===Ae.frameMode)||Lo[0],Yn=w=>{Ei(V=>({...V,...w}))},hl=w=>{const V=vd.find(ie=>ie.id===w);V&&Yn({maxWidth:V.width,maxHeight:V.height})},Pr=w=>{if(w==="control"){if(J(w),!ot){mt(!1),te(Dt);return}mt(!0),se&&ba(se.deviceId);return}J(w),mt(!1)};return y.jsxs("main",{className:"app-shell",children:[y.jsxs("aside",{className:"tool-rail","aria-label":"LiveDesk tools",children:[y.jsx("div",{className:"rail-brand",title:"LiveDesk",children:y.jsx(_r,{size:22})}),y.jsx("nav",{className:"rail-tools",children:J_.map(w=>{const V=w.icon;return y.jsxs("button",{className:`rail-tool ${M===w.id?"active":""} accent-${w.accent}`,onClick:()=>Pr(w.id),title:w.label,type:"button",children:[y.jsx(V,{size:19}),y.jsx("span",{children:w.label})]},w.id)})}),y.jsxs("div",{className:"rail-footer",children:[y.jsxs("button",{className:"rail-tool compact sync-server",onClick:()=>Vt({takeover:!0,requestLocalAccess:!0}),title:"Sync Server",type:"button",children:[y.jsx(id,{size:18}),y.jsx("span",{children:"Sync Server"})]}),y.jsxs("button",{className:`rail-tool compact local-settings ${Ti?"active":""}`,onClick:()=>{ki(w=>!w),mn(!1)},title:"Local Settings",type:"button",children:[y.jsx(kp,{size:18}),y.jsx("span",{children:"Settings"})]}),Ti&&y.jsxs("section",{className:"local-settings-popover",role:"dialog","aria-label":"LiveDesk local settings",children:[y.jsxs("div",{className:"local-settings-head",children:[y.jsxs("div",{children:[y.jsx("strong",{children:"Local Settings"}),y.jsx("p",{children:"Saved on this browser"})]}),y.jsx("button",{className:"icon-button",onClick:()=>ki(!1),title:"Close settings",type:"button",children:y.jsx(Ng,{size:15})})]}),y.jsxs("label",{className:"local-setting-row",children:[y.jsx("span",{children:"Frame mode"}),y.jsx("select",{value:Ae.frameMode,onChange:w=>Yn({frameMode:Qp(w.target.value)}),children:Lo.map(w=>y.jsxs("option",{value:w.id,children:[w.label," - ",w.detail]},w.id))})]}),y.jsxs("div",{className:"local-setting-grid",children:[y.jsxs("label",{className:"local-setting-row",children:[y.jsx("span",{children:"FPS"}),y.jsx("select",{value:Ae.fps,onChange:w=>Yn({fps:kr(w.target.value,1,24,fn.fps)}),children:D_.map(w=>y.jsx("option",{value:w,children:w},w))})]}),y.jsxs("label",{className:"local-setting-row",children:[y.jsx("span",{children:"Size"}),y.jsx("select",{value:_a,onChange:w=>hl(w.target.value),children:vd.map(w=>y.jsx("option",{value:w.id,children:w.label},w.id))})]})]}),y.jsxs("label",{className:"local-setting-row",children:[y.jsx("span",{children:"Quality"}),y.jsx("select",{value:Ae.quality,onChange:w=>Yn({quality:kr(w.target.value,20,95,fn.quality)}),children:U_.map(w=>y.jsx("option",{value:w,children:w},w))})]}),y.jsxs("label",{className:"local-setting-toggle",children:[y.jsx("input",{type:"checkbox",checked:Ae.autoStartLive,onChange:w=>Yn({autoStartLive:w.target.checked})}),y.jsx("span",{children:"Auto live on connected screens"})]}),y.jsxs("label",{className:"local-setting-toggle",children:[y.jsx("input",{type:"checkbox",checked:Ae.showScreenStatus,onChange:w=>Yn({showScreenStatus:w.target.checked})}),y.jsx("span",{children:"Screen status overlay"})]}),y.jsxs("div",{className:"local-settings-summary",children:[y.jsx("span",{children:Zo.label}),y.jsxs("strong",{children:[Ae.maxWidth,"x",Ae.maxHeight," / ",Ae.fps,"fps"]})]}),y.jsx("button",{className:"local-settings-reset",onClick:()=>Ei(fn),type:"button",children:"Reset local settings"})]}),y.jsxs("button",{className:`rail-account ${i?"signed-in":""}`,onClick:()=>{mn(w=>!w),ki(!1)},disabled:n||D==="auth","aria-expanded":kn,title:i?`Account: ${i.user.email||Vn}`:"Sign in with Google",type:"button",children:[i?Fa?y.jsx("img",{src:Fa,alt:Vn,referrerPolicy:"no-referrer"}):y.jsx("span",{className:"avatar-fallback",children:Kn}):y.jsx(sd,{size:18}),y.jsx("span",{children:i?"Account":"Google"})]}),kn&&y.jsxs("section",{className:"account-popover",role:"dialog","aria-label":"LiveDesk account",children:[y.jsxs("div",{className:"account-popover-head",children:[y.jsx("div",{className:"account-popover-avatar",children:i&&Fa?y.jsx("img",{src:Fa,alt:Vn,referrerPolicy:"no-referrer"}):i?y.jsx("span",{children:Kn}):y.jsx(sd,{size:18})}),y.jsxs("div",{children:[y.jsx("strong",{children:i?Vn:"Account"}),y.jsx("p",{children:i?.user.email||"Not signed in"})]})]}),y.jsxs("dl",{className:"account-popover-facts",children:[y.jsx("dt",{children:"User"}),y.jsx("dd",{children:i?.user.email||"Not signed in"}),y.jsx("dt",{children:"Network"}),y.jsx("dd",{children:ul}),y.jsx("dt",{children:"Access"}),y.jsx("dd",{children:dl}),y.jsx("dt",{children:"Plan"}),y.jsx("dd",{children:Za})]}),i?y.jsxs("button",{className:"account-popover-action",onClick:al,disabled:D==="auth",type:"button",children:[y.jsx(L0,{size:16}),"Logout"]}):y.jsxs("button",{className:"account-popover-action primary",onClick:Mr,disabled:D==="auth",type:"button",children:[y.jsx(sd,{size:16}),"Sign in with Google"]})]})]})]}),y.jsxs("section",{className:`desk-stage ${ol&&!Je?"dock-open":""}`,children:[y.jsxs("header",{className:"topbar",children:[y.jsxs("div",{className:"brand",children:[y.jsx("span",{className:"brand-mark",children:y.jsx(Cg,{size:18})}),y.jsxs("div",{children:[y.jsx("h1",{children:"LiveDesk"}),y.jsx("p",{children:"Control wall for local machines"})]})]}),ol&&y.jsx("div",{className:"top-actions",children:y.jsx("div",{className:"segmented-control","aria-label":"Screen size",children:Y_.map(w=>y.jsx("button",{className:Z===w.id?"active":"",onClick:()=>de(w.id),type:"button",children:w.label},w.id))})})]}),qr?y.jsxs("section",{className:"doc-page",lang:me,dir:me==="ar"?"rtl":"ltr",children:[y.jsxs("section",{className:"doc-hero",children:[y.jsxs("div",{className:"doc-hero-copy",children:[y.jsxs("span",{className:"pricing-eyebrow",children:[y.jsx(_d,{size:16}),yt.eyebrow]}),y.jsx("h2",{children:yt.title}),y.jsx("p",{children:yt.intro})]}),y.jsxs("label",{className:"doc-language-picker",children:[y.jsxs("span",{children:[y.jsx(C0,{size:17}),yt.languageLabel]}),y.jsx("select",{value:me,onChange:w=>xe(w.target.value),children:X_.map(w=>y.jsx("option",{value:w.id,children:w.label},w.id))})]})]}),y.jsx("section",{className:"doc-grid",children:yt.sections.map((w,V)=>{const W=[cd,yr,Tp,jg][V]||_d;return y.jsxs("article",{className:"doc-card",children:[y.jsx("div",{className:"doc-card-icon",children:y.jsx(W,{size:19})}),y.jsxs("div",{children:[y.jsx("h3",{children:w.title}),y.jsx("p",{children:w.body}),y.jsx("ul",{children:w.points.map(fe=>y.jsx("li",{children:fe},fe))})]})]},w.title)})}),ji&&y.jsxs("section",{className:"doc-sync",children:[y.jsxs("div",{className:"doc-sync-head",children:[y.jsx(id,{size:20}),y.jsxs("div",{children:[y.jsx("h3",{children:ji.title}),y.jsx("p",{children:ji.body})]})]}),y.jsx("ul",{children:ji.points.map(w=>y.jsx("li",{children:w},w))})]}),y.jsxs("section",{className:"doc-firewall",children:[y.jsxs("div",{className:"doc-firewall-head",children:[y.jsx(Og,{size:20}),y.jsxs("div",{children:[y.jsx("h3",{children:yt.firewall.title}),y.jsx("p",{children:yt.firewall.body})]})]}),y.jsx("ul",{children:yt.firewall.points.map(w=>y.jsx("li",{children:w},w))})]}),y.jsxs("section",{className:"doc-command-panel",children:[y.jsxs("div",{className:"doc-command-head",children:[y.jsx(yr,{size:20}),y.jsxs("div",{children:[y.jsx("h3",{children:yt.commands.title}),y.jsx("p",{children:yt.commands.body})]})]}),y.jsxs("div",{className:"doc-command-list",children:[yt.commands.manager&&y.jsxs("div",{className:"doc-command-row",children:[y.jsx("span",{children:yt.commands.manager}),y.jsx("code",{children:Br}),y.jsx("button",{className:"icon-button",onClick:()=>Ns(Br),title:"Copy command",type:"button",children:y.jsx(Rs,{size:16})})]}),y.jsxs("div",{className:"doc-command-row",children:[y.jsx("span",{children:yt.commands.primary}),y.jsx("code",{children:qe}),y.jsx("button",{className:"icon-button",onClick:()=>Ns(qe),title:"Copy command",type:"button",children:y.jsx(Rs,{size:16})})]}),y.jsxs("div",{className:"doc-command-row",children:[y.jsx("span",{children:yt.commands.slot}),y.jsx("code",{children:`${qe} 3`}),y.jsx("button",{className:"icon-button",onClick:()=>Ns(`${qe} 3`),title:"Copy command",type:"button",children:y.jsx(Rs,{size:16})})]})]})]})]}):Hr?y.jsxs("section",{className:"pricing-page",children:[(Y||ae)&&y.jsx("section",{className:"notice-band",children:Y||ae}),y.jsxs("section",{className:"pricing-offer",children:[y.jsx("button",{className:"pricing-close",onClick:()=>J("wall"),title:"Close pricing",type:"button",children:y.jsx(Ng,{size:18})}),y.jsxs("div",{className:"pricing-offer-head",children:[y.jsxs("span",{className:"pricing-eyebrow",children:[y.jsx(K0,{size:15}),"Founder launch"]}),y.jsxs("div",{className:"deal-price-line",children:[y.jsx("span",{className:"deal-original",children:"$59"}),y.jsx("span",{className:"deal-arrow",children:"→"}),y.jsx("strong",{children:"$30"}),y.jsxs("span",{className:"deal-badge",children:[y.jsx(v0,{size:15}),"Lifetime deal"]})]}),y.jsx("p",{children:"Monitor and control your local workstation wall. Free for 4 PCs, then unlock larger local setups with one payment."})]}),y.jsxs("div",{className:"deal-table",role:"table","aria-label":"LiveDesk launch pricing",children:[y.jsxs("div",{className:"deal-row deal-row-head",role:"row",children:[y.jsx("span",{role:"columnheader",children:"Plan"}),y.jsx("span",{role:"columnheader",children:"Launch benefit"}),y.jsx("span",{role:"columnheader",children:"Now"})]}),y.jsxs("div",{className:"deal-row deal-row-highlight",role:"row",children:[y.jsx("strong",{role:"cell",children:"Founder LTD"}),y.jsxs("span",{role:"cell",children:[y.jsx("s",{children:"$59"})," local lifetime unlock"]}),y.jsx("strong",{role:"cell",children:"$30"})]}),y.jsxs("div",{className:"deal-row",role:"row",children:[y.jsx("strong",{role:"cell",children:"Free"}),y.jsx("span",{role:"cell",children:"Live, control, audio, files, tasks"}),y.jsx("strong",{role:"cell",children:"$0"})]}),y.jsxs("div",{className:"deal-row",role:"row",children:[y.jsx("strong",{role:"cell",children:"Workstations"}),y.jsx("span",{role:"cell",children:"4 free, larger walls with LTD"}),y.jsxs("strong",{role:"cell",children:[He.length,"/",fr]})]}),y.jsxs("div",{className:"deal-row",role:"row",children:[y.jsx("strong",{role:"cell",children:"Future monthly"}),y.jsx("span",{role:"cell",children:"Cloud relay and team features later"}),y.jsx("strong",{role:"cell",children:"separate"})]})]}),y.jsxs("section",{className:"deal-module",children:[y.jsxs("div",{className:"deal-module-title",children:[y.jsx("strong",{children:"LiveDesk includes"}),y.jsx("span",{children:Za})]}),y.jsxs("ul",{className:"deal-feature-list",children:[y.jsxs("li",{children:[y.jsx(_r,{size:16}),y.jsx("span",{children:"Screen wall slots"}),y.jsx("b",{children:"120+"})]}),y.jsxs("li",{children:[y.jsx(kd,{size:16}),y.jsx("span",{children:"Focused control"}),y.jsx("b",{children:"Local"})]}),y.jsxs("li",{children:[y.jsx(Rg,{size:16}),y.jsx("span",{children:"Remote PC audio"}),y.jsx("b",{children:"PCM"})]}),y.jsxs("li",{children:[y.jsx(rd,{size:16}),y.jsx("span",{children:"File transfer"}),y.jsx("b",{children:"24MB"})]})]})]}),y.jsxs("section",{className:"deal-open-price",children:[y.jsx("span",{children:"Opening special price"}),y.jsx("strong",{children:"$30 LTD"}),y.jsx("small",{children:"Early buyers keep this local lifetime license after monthly plans arrive."})]}),y.jsxs("p",{className:"deal-note",children:[y.jsx(T0,{size:15}),"Free plan stays available for up to ",fr," local workstations."]}),y.jsxs("button",{className:"deal-cta",onClick:i?$n:Mr,disabled:Mt,type:"button",children:[y.jsx(Td,{size:18}),Wo]}),y.jsx("button",{className:"deal-later",onClick:()=>J("wall"),type:"button",children:"Later"})]})]}):y.jsx(y.Fragment,{children:y.jsxs("section",{className:`monitor-layout ${Je?"dock-collapsed":""}`,children:[y.jsx("section",{className:`screen-wall-panel ${Ot?"drop-active":""}`,onClick:w=>{w.currentTarget===w.target&&Hn()},onDragEnter:w=>{w.preventDefault(),Or(!0)},onDragOver:w=>{w.preventDefault(),w.dataTransfer.dropEffect="copy"},onDragLeave:w=>{w.currentTarget===w.target&&Or(!1)},onDrop:wa,children:Ri?y.jsxs("section",{className:"control-focus",children:[y.jsxs("div",{className:"control-focus-head",children:[y.jsxs("div",{children:[y.jsx("span",{children:"Focused control"}),y.jsx("strong",{children:se?Gs(se):"No workstation"})]}),y.jsxs("button",{className:"text-button",onClick:()=>se&&ba(se.deviceId),disabled:!va,type:"button",children:[y.jsx(ld,{size:16}),"Start live"]})]}),y.jsx("div",{className:"screen-wall control-wall",onClick:w=>{w.currentTarget===w.target&&Hn()},children:se?y.jsx(bp,{device:se,frame:zn.get(se.deviceId),selected:!0,controlEnabled:En&&Le,showStatus:Ae.showScreenStatus,monitorIndex:wr(Un[se.deviceId],bi(se)),monitorCount:bi(se),onSelect:()=>wt(se.deviceId),onFocusDevice:()=>Ve(se.deviceId),onOpenControl:()=>Sa(se.deviceId),onCycleMonitor:w=>rl(se.deviceId,w),sendInput:Dr},se.deviceId):y.jsx(vp,{index:0,selected:Lt.has(1),onSelect:()=>Bn(1)})})]}):y.jsx("div",{className:`screen-wall size-${Z}`,onClick:w=>{w.currentTarget===w.target&&Hn()},children:Jo.map((w,V)=>{const ie=V+1;return w?y.jsx(bp,{device:w,frame:zn.get(w.deviceId),selected:St.has(w.deviceId)||Lt.has(ie),controlEnabled:En&&Le&&se?.deviceId===w.deviceId,showStatus:Ae.showScreenStatus,monitorIndex:wr(Un[w.deviceId],bi(w)),monitorCount:bi(w),onSelect:()=>wt(w.deviceId),onFocusDevice:()=>Ve(w.deviceId),onOpenControl:()=>Sa(w.deviceId),onCycleMonitor:W=>rl(w.deviceId,W),sendInput:Dr},w.deviceId):y.jsx(vp,{index:V,selected:Lt.has(ie),onSelect:()=>Bn(ie)},`slot-${V}`)})})}),y.jsxs("aside",{className:`right-dock ${ll?"settings-mode":"actions-mode"} ${Je?"collapsed":""}`,"aria-label":"LiveDesk tools",children:[y.jsx("button",{className:"dock-toggle",onClick:()=>Xe(w=>!w),"aria-label":Je?"Show control panel":"Hide control panel",title:Je?"Show control panel":"Hide control panel",type:"button",children:Je?y.jsx(wp,{size:18}):y.jsx(_p,{size:18})}),!Je&&(ll?y.jsxs(y.Fragment,{children:[(C||l||Y||ae)&&y.jsx("section",{className:"notice-band",children:C||l||Y||ae}),y.jsxs("section",{className:"command-deck",children:[y.jsxs("div",{className:"setup-card",children:[y.jsxs("div",{className:"setup-head",children:[y.jsx("span",{className:"setup-icon",children:y.jsx(_r,{size:18})}),y.jsxs("div",{children:[y.jsx("strong",{children:"Add workstation"}),y.jsx("span",{children:"Connect another local PC to this wall."})]})]}),y.jsxs("button",{className:"text-button primary full",onClick:()=>Ns(qe),type:"button",children:[y.jsx(Rs,{size:16}),"Copy setup"]}),y.jsxs("button",{className:"setup-disclosure",onClick:()=>Cr(w=>!w),type:"button",children:[y.jsx(yr,{size:15}),"Advanced setup"]}),Dn&&y.jsxs("div",{className:"setup-code-row",children:[y.jsx("code",{children:qe}),y.jsx("button",{className:"icon-button",onClick:()=>Ns(qe),title:"Copy setup command",type:"button",children:y.jsx(Rs,{size:16})})]})]}),y.jsxs("div",{className:"settings-card",children:[y.jsxs("div",{className:"panel-title",children:[y.jsx(rd,{size:17}),y.jsx("h2",{children:"Files"})]}),y.jsxs("label",{className:"field-row",children:[y.jsx("span",{children:"Remote folder"}),y.jsx("input",{value:ga,onChange:w=>Yo(w.target.value),placeholder:"Desktop/LiveDeskFiles"})]}),y.jsx("p",{className:"muted",children:"Blank uses Desktop/LiveDeskFiles on each workstation."})]}),y.jsxs("div",{className:"deck-actions",children:[y.jsxs("button",{className:"text-button primary",onClick:()=>Vt({takeover:!0,requestLocalAccess:!0}),disabled:!i||D==="host",type:"button",children:[y.jsx(id,{size:16}),"Sync access"]}),y.jsxs("button",{className:"text-button buy",onClick:$n,disabled:D==="checkout"||q,type:"button",children:[y.jsx(Td,{size:16}),cl]})]})]}),y.jsxs("section",{className:"status-strip",children:[y.jsxs("div",{className:`status-item state-${In}`,children:[y.jsx(cd,{size:18}),y.jsx("span",{children:"Local app"}),y.jsx("strong",{children:In})]}),y.jsxs("div",{className:"status-item",children:[y.jsx(jg,{size:18}),y.jsx("span",{children:"Slots"}),y.jsxs("strong",{children:[sl,"/",tn]})]}),y.jsxs("div",{className:"status-item",children:[y.jsx(Cg,{size:18}),y.jsx("span",{children:"Frames"}),y.jsxs("strong",{children:[Pn," ",Qo]})]}),y.jsxs("div",{className:"status-item",children:[y.jsx(Og,{size:18}),y.jsx("span",{children:"Plan"}),y.jsx("strong",{children:Za})]})]})]}):y.jsxs(y.Fragment,{children:[y.jsxs("section",{className:"action-dock",children:[y.jsxs("div",{className:"action-context",children:[y.jsx("span",{children:Gn>0?"Selection":"No selection"}),y.jsx("strong",{children:Ut})]}),y.jsx("input",{ref:Rr,className:"hidden-file-input",type:"file",multiple:!0,onChange:w=>{w.currentTarget.files&&qn(w.currentTarget.files),w.currentTarget.value=""}}),(C||ae)&&y.jsx("div",{className:"notice-band compact",children:y.jsx("span",{children:C||ae})}),y.jsxs("div",{className:"action-grid",children:[y.jsxs("button",{className:"action-tile primary",onClick:()=>se&&ba(se.deviceId),disabled:!va,type:"button",children:[y.jsx(ld,{size:21}),y.jsx("span",{children:"Live"})]}),y.jsxs("button",{className:`action-tile ${Le?"active":""}`,onClick:()=>mt(w=>!w),disabled:!En,type:"button",children:[y.jsx(kd,{size:21}),y.jsx("span",{children:Lr!=="idle"?Lr:"Control"})]}),y.jsxs("button",{className:`action-tile ${pt?"active":""}`,onClick:zr,disabled:!nl,type:"button",title:ya?"Remote PC audio":"Remote audio is not supported by this workstation yet",children:[y.jsx(Rg,{size:21}),y.jsx("span",{children:pt&&Ur!=="idle"?Ur:"Audio"})]}),y.jsxs("button",{className:"action-tile",onClick:()=>Rr.current?.click(),disabled:!ot||lt.length===0,type:"button",title:"File transfer",children:[y.jsx(rd,{size:21}),y.jsx("span",{children:"Files"})]}),y.jsxs("button",{className:"action-tile",disabled:!0,type:"button",title:"Reboot",children:[y.jsx(q0,{size:21}),y.jsx("span",{children:"Reboot"})]}),y.jsxs("button",{className:"action-tile",disabled:!0,type:"button",title:"Power",children:[y.jsx(B0,{size:21}),y.jsx("span",{children:"Power"})]}),y.jsxs("button",{className:"action-tile",disabled:!0,type:"button",title:"Terminal",children:[y.jsx(yr,{size:21}),y.jsx("span",{children:"Shell"})]})]})]}),se&&nn&&y.jsxs("section",{className:"side-panel selected-panel",children:[y.jsxs("div",{className:"machine-detail-head",children:[y.jsxs("div",{className:"panel-title",children:[y.jsx(_r,{size:17}),y.jsx("h2",{children:"Machine detail"})]}),y.jsx("span",{className:`machine-health state-${nn.state}`,children:nn.label})]}),y.jsxs("div",{className:"machine-title",children:[y.jsx("strong",{children:Gs(se)}),y.jsx("span",{children:nn.role})]}),y.jsx("div",{className:"machine-metric-grid",children:nn.metrics.map(w=>y.jsxs("article",{className:`machine-metric state-${w.state}`,children:[y.jsx("span",{children:w.label}),y.jsx("strong",{children:w.value}),y.jsx("small",{children:w.detail}),w.ratio!==void 0&&y.jsx("i",{children:y.jsx("b",{style:{width:`${Math.round(w.ratio*100)}%`}})})]},w.id))}),y.jsxs("section",{className:"machine-section",children:[y.jsxs("div",{className:"machine-section-title",children:[y.jsx(yr,{size:15}),y.jsx("span",{children:"Local services"})]}),y.jsx("div",{className:"tool-probe-list",children:nn.tools.map(w=>y.jsxs("span",{className:`tool-probe state-${w.status}`,children:[y.jsx("b",{children:w.label}),y.jsx("em",{children:w.detail})]},w.id))})]}),y.jsxs("section",{className:"machine-section",children:[y.jsxs("div",{className:"machine-section-title",children:[y.jsx(od,{size:15}),y.jsx("span",{children:"Workload"})]}),y.jsxs("div",{className:"workload-card",children:[y.jsx("strong",{children:nn.taskLabel}),y.jsx("span",{children:nn.taskStatus}),nn.taskSummary&&y.jsx("p",{children:nn.taskSummary})]})]}),y.jsxs("div",{className:"machine-section",children:[y.jsxs("div",{className:"machine-section-title",children:[y.jsx(cd,{size:15}),y.jsx("span",{children:"System"})]}),y.jsxs("dl",{className:"facts compact",children:[y.jsx("dt",{children:"Platform"}),y.jsxs("dd",{children:[se.platform||"-"," ",se.arch||""]}),y.jsx("dt",{children:"Release"}),y.jsx("dd",{children:Gt(se.status,"release")||"-"}),y.jsx("dt",{children:"Uptime"}),y.jsx("dd",{children:Wp(Qe(se.status,"uptimeSec"))}),y.jsx("dt",{children:"Last seen"}),y.jsx("dd",{children:b_(se.lastSeenAt||se.connectedAt)}),y.jsx("dt",{children:"Agent"}),y.jsx("dd",{children:se.agentVersion||"-"}),y.jsx("dt",{children:"Address"}),y.jsx("dd",{children:se.remoteAddress||"-"})]})]}),Oi&&y.jsx("p",{className:"panel-warning",children:Oi}),y.jsxs("button",{className:"text-button full",onClick:()=>se&&ba(se.deviceId),disabled:!va,type:"button",children:[y.jsx(ld,{size:16}),"Start live"]})]}),y.jsxs("section",{className:"side-panel task-panel",children:[y.jsxs("div",{className:"panel-title",children:[y.jsx(od,{size:17}),y.jsx("h2",{children:"Task"})]}),y.jsx("textarea",{value:Ee,onChange:w=>E(w.target.value),placeholder:"Prepare a short status report.",rows:4}),y.jsxs("button",{className:"text-button full primary",onClick:Wa,disabled:D==="task"||!Ee.trim()||!ot,type:"button",children:[y.jsx(od,{size:16}),"Send to connected"]})]})]}))]})]})})]}),xi&&y.jsxs("aside",{className:`transfer-bar state-${xi.status}`,"aria-live":"polite",children:[y.jsx("div",{className:"transfer-bar-track",children:y.jsx("span",{style:{width:`${Math.max(0,Math.min(100,xi.progress))}%`}})}),y.jsx("p",{children:xi.message})]})]})}u0.createRoot(document.getElementById("root")).render(y.jsx(I.StrictMode,{children:y.jsx(W_,{})}));