livedesk 0.1.37 → 0.1.39

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.
@@ -0,0 +1,38 @@
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 nd={exports:{}},Us={};var Tg;function u0(){if(Tg)return Us;Tg=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 Us.Fragment=n,Us.jsx=r,Us.jsxs=r,Us}var kg;function d0(){return kg||(kg=1,nd.exports=u0()),nd.exports}var y=d0(),ad={exports:{}},pe={};var Eg;function h0(){if(Eg)return pe;Eg=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"),w=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(){}},z=Object.assign,G={};function I(E,M,W){this.props=E,this.context=M,this.refs=G,this.updater=W||C}I.prototype.isReactComponent={},I.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")},I.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function $(){}$.prototype=I.prototype;function O(E,M,W){this.props=E,this.context=M,this.refs=G,this.updater=W||C}var J=O.prototype=new $;J.constructor=O,z(J,I.prototype),J.isPureReactComponent=!0;var me=Array.isArray;function ae(){}var K={H:null,A:null,T:null,S:null},Ee=Object.prototype.hasOwnProperty;function Se(E,M,W){var Q=W.ref;return{$$typeof:i,type:E,key:M,ref:Q!==void 0?Q:null,props:W}}function Yt(E,M){return Se(E.type,M,E.props)}function F(E){return typeof E=="object"&&E!==null&&E.$$typeof===i}function Ce(E){var M={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function(W){return M[W]})}var Ye=/\/+/g;function Je(E,M){return typeof E=="object"&&E!==null&&E.key!=null?Ce(""+E.key):M.toString(36)}function ze(E){switch(E.status){case"fulfilled":return E.value;case"rejected":throw E.reason;default:switch(typeof E.status=="string"?E.then(ae,ae):(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,W,Q,ge){var ye=typeof E;(ye==="undefined"||ye==="boolean")&&(E=null);var Oe=!1;if(E===null)Oe=!0;else switch(ye){case"bigint":case"string":case"number":Oe=!0;break;case"object":switch(E.$$typeof){case i:case n:Oe=!0;break;case w:return Oe=E._init,D(Oe(E._payload),M,W,Q,ge)}}if(Oe)return ge=ge(E),Oe=Q===""?"."+Je(E,0):Q,me(ge)?(W="",Oe!=null&&(W=Oe.replace(Ye,"$&/")+"/"),D(ge,M,W,"",function(Rn){return Rn})):ge!=null&&(F(ge)&&(ge=Yt(ge,W+(ge.key==null||E&&E.key===ge.key?"":(""+ge.key).replace(Ye,"$&/")+"/")+Oe)),M.push(ge)),1;Oe=0;var Xe=Q===""?".":Q+":";if(me(E))for(var Qe=0;Qe<E.length;Qe++)Q=E[Qe],ye=Xe+Je(Q,Qe),Oe+=D(Q,M,W,ye,ge);else if(Qe=A(E),typeof Qe=="function")for(E=Qe.call(E),Qe=0;!(Q=E.next()).done;)Q=Q.value,ye=Xe+Je(Q,Qe++),Oe+=D(Q,M,W,ye,ge);else if(ye==="object"){if(typeof E.then=="function")return D(ze(E),M,W,Q,ge);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 Oe}function V(E,M,W){if(E==null)return E;var Q=[],ge=0;return D(E,Q,"","",function(ye){return M.call(W,ye,ge++)}),Q}function se(E){if(E._status===-1){var M=E._result;M=M(),M.then(function(W){(E._status===0||E._status===-1)&&(E._status=1,E._result=W)},function(W){(E._status===0||E._status===-1)&&(E._status=2,E._result=W)}),E._status===-1&&(E._status=0,E._result=M)}if(E._status===1)return E._result.default;throw E._result}var ne=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)},xe={map:V,forEach:function(E,M,W){V(E,function(){M.apply(this,arguments)},W)},count:function(E){var M=0;return V(E,function(){M++}),M},toArray:function(E){return V(E,function(M){return M})||[]},only:function(E){if(!F(E))throw Error("React.Children.only expected to receive a single React element child.");return E}};return pe.Activity=b,pe.Children=xe,pe.Component=I,pe.Fragment=r,pe.Profiler=c,pe.PureComponent=O,pe.StrictMode=l,pe.Suspense=g,pe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=K,pe.__COMPILER_RUNTIME={__proto__:null,c:function(E){return K.H.useMemoCache(E)}},pe.cache=function(E){return function(){return E.apply(null,arguments)}},pe.cacheSignal=function(){return null},pe.cloneElement=function(E,M,W){if(E==null)throw Error("The argument must be a React element, but you passed "+E+".");var Q=z({},E.props),ge=E.key;if(M!=null)for(ye in M.key!==void 0&&(ge=""+M.key),M)!Ee.call(M,ye)||ye==="key"||ye==="__self"||ye==="__source"||ye==="ref"&&M.ref===void 0||(Q[ye]=M[ye]);var ye=arguments.length-2;if(ye===1)Q.children=W;else if(1<ye){for(var Oe=Array(ye),Xe=0;Xe<ye;Xe++)Oe[Xe]=arguments[Xe+2];Q.children=Oe}return Se(E.type,ge,Q)},pe.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},pe.createElement=function(E,M,W){var Q,ge={},ye=null;if(M!=null)for(Q in M.key!==void 0&&(ye=""+M.key),M)Ee.call(M,Q)&&Q!=="key"&&Q!=="__self"&&Q!=="__source"&&(ge[Q]=M[Q]);var Oe=arguments.length-2;if(Oe===1)ge.children=W;else if(1<Oe){for(var Xe=Array(Oe),Qe=0;Qe<Oe;Qe++)Xe[Qe]=arguments[Qe+2];ge.children=Xe}if(E&&E.defaultProps)for(Q in Oe=E.defaultProps,Oe)ge[Q]===void 0&&(ge[Q]=Oe[Q]);return Se(E,ye,ge)},pe.createRef=function(){return{current:null}},pe.forwardRef=function(E){return{$$typeof:m,render:E}},pe.isValidElement=F,pe.lazy=function(E){return{$$typeof:w,_payload:{_status:-1,_result:E},_init:se}},pe.memo=function(E,M){return{$$typeof:p,type:E,compare:M===void 0?null:M}},pe.startTransition=function(E){var M=K.T,W={};K.T=W;try{var Q=E(),ge=K.S;ge!==null&&ge(W,Q),typeof Q=="object"&&Q!==null&&typeof Q.then=="function"&&Q.then(ae,ne)}catch(ye){ne(ye)}finally{M!==null&&W.types!==null&&(M.types=W.types),K.T=M}},pe.unstable_useCacheRefresh=function(){return K.H.useCacheRefresh()},pe.use=function(E){return K.H.use(E)},pe.useActionState=function(E,M,W){return K.H.useActionState(E,M,W)},pe.useCallback=function(E,M){return K.H.useCallback(E,M)},pe.useContext=function(E){return K.H.useContext(E)},pe.useDebugValue=function(){},pe.useDeferredValue=function(E,M){return K.H.useDeferredValue(E,M)},pe.useEffect=function(E,M){return K.H.useEffect(E,M)},pe.useEffectEvent=function(E){return K.H.useEffectEvent(E)},pe.useId=function(){return K.H.useId()},pe.useImperativeHandle=function(E,M,W){return K.H.useImperativeHandle(E,M,W)},pe.useInsertionEffect=function(E,M){return K.H.useInsertionEffect(E,M)},pe.useLayoutEffect=function(E,M){return K.H.useLayoutEffect(E,M)},pe.useMemo=function(E,M){return K.H.useMemo(E,M)},pe.useOptimistic=function(E,M){return K.H.useOptimistic(E,M)},pe.useReducer=function(E,M,W){return K.H.useReducer(E,M,W)},pe.useRef=function(E){return K.H.useRef(E)},pe.useState=function(E){return K.H.useState(E)},pe.useSyncExternalStore=function(E,M,W){return K.H.useSyncExternalStore(E,M,W)},pe.useTransition=function(){return K.H.useTransition()},pe.version="19.2.7",pe}var Ag;function Gd(){return Ag||(Ag=1,ad.exports=h0()),ad.exports}var H=Gd(),id={exports:{}},zs={},rd={exports:{}},sd={};var xg;function f0(){return xg||(xg=1,(function(i){function n(D,V){var se=D.length;D.push(V);e:for(;0<se;){var ne=se-1>>>1,xe=D[ne];if(0<c(xe,V))D[ne]=V,D[se]=xe,se=ne;else break e}}function r(D){return D.length===0?null:D[0]}function l(D){if(D.length===0)return null;var V=D[0],se=D.pop();if(se!==V){D[0]=se;e:for(var ne=0,xe=D.length,E=xe>>>1;ne<E;){var M=2*(ne+1)-1,W=D[M],Q=M+1,ge=D[Q];if(0>c(W,se))Q<xe&&0>c(ge,W)?(D[ne]=ge,D[Q]=se,ne=Q):(D[ne]=W,D[M]=se,ne=M);else if(Q<xe&&0>c(ge,se))D[ne]=ge,D[Q]=se,ne=Q;else break e}}return V}function c(D,V){var se=D.sortIndex-V.sortIndex;return se!==0?se:D.id-V.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=[],w=1,b=null,T=3,A=!1,C=!1,z=!1,G=!1,I=typeof setTimeout=="function"?setTimeout:null,$=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function J(D){for(var V=r(p);V!==null;){if(V.callback===null)l(p);else if(V.startTime<=D)l(p),V.sortIndex=V.expirationTime,n(g,V);else break;V=r(p)}}function me(D){if(z=!1,J(D),!C)if(r(g)!==null)C=!0,ae||(ae=!0,Ce());else{var V=r(p);V!==null&&ze(me,V.startTime-D)}}var ae=!1,K=-1,Ee=5,Se=-1;function Yt(){return G?!0:!(i.unstable_now()-Se<Ee)}function F(){if(G=!1,ae){var D=i.unstable_now();Se=D;var V=!0;try{e:{C=!1,z&&(z=!1,$(K),K=-1),A=!0;var se=T;try{t:{for(J(D),b=r(g);b!==null&&!(b.expirationTime>D&&Yt());){var ne=b.callback;if(typeof ne=="function"){b.callback=null,T=b.priorityLevel;var xe=ne(b.expirationTime<=D);if(D=i.unstable_now(),typeof xe=="function"){b.callback=xe,J(D),V=!0;break t}b===r(g)&&l(g),J(D)}else l(g);b=r(g)}if(b!==null)V=!0;else{var E=r(p);E!==null&&ze(me,E.startTime-D),V=!1}}break e}finally{b=null,T=se,A=!1}V=void 0}}finally{V?Ce():ae=!1}}}var Ce;if(typeof O=="function")Ce=function(){O(F)};else if(typeof MessageChannel<"u"){var Ye=new MessageChannel,Je=Ye.port2;Ye.port1.onmessage=F,Ce=function(){Je.postMessage(null)}}else Ce=function(){I(F,0)};function ze(D,V){K=I(function(){D(i.unstable_now())},V)}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"):Ee=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 V=3;break;default:V=T}var se=T;T=V;try{return D()}finally{T=se}},i.unstable_requestPaint=function(){G=!0},i.unstable_runWithPriority=function(D,V){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var se=T;T=D;try{return V()}finally{T=se}},i.unstable_scheduleCallback=function(D,V,se){var ne=i.unstable_now();switch(typeof se=="object"&&se!==null?(se=se.delay,se=typeof se=="number"&&0<se?ne+se:ne):se=ne,D){case 1:var xe=-1;break;case 2:xe=250;break;case 5:xe=1073741823;break;case 4:xe=1e4;break;default:xe=5e3}return xe=se+xe,D={id:w++,callback:V,priorityLevel:D,startTime:se,expirationTime:xe,sortIndex:-1},se>ne?(D.sortIndex=se,n(p,D),r(g)===null&&D===r(p)&&(z?($(K),K=-1):z=!0,ze(me,se-ne))):(D.sortIndex=xe,n(g,D),C||A||(C=!0,ae||(ae=!0,Ce()))),D},i.unstable_shouldYield=Yt,i.unstable_wrapCallback=function(D){var V=T;return function(){var se=T;T=V;try{return D.apply(this,arguments)}finally{T=se}}}})(sd)),sd}var Cg;function m0(){return Cg||(Cg=1,rd.exports=f0()),rd.exports}var ld={exports:{}},Rt={};var Og;function g0(){if(Og)return Rt;Og=1;var i=Gd();function n(g){var p="https://react.dev/errors/"+g;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var w=2;w<arguments.length;w++)p+="&args[]="+encodeURIComponent(arguments[w])}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,w){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:w}}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 Rt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,Rt.createPortal=function(g,p){var w=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,w)},Rt.flushSync=function(g){var p=h.T,w=l.p;try{if(h.T=null,l.p=2,g)return g()}finally{h.T=p,l.p=w,l.d.f()}},Rt.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))},Rt.prefetchDNS=function(g){typeof g=="string"&&l.d.D(g)},Rt.preinit=function(g,p){if(typeof g=="string"&&p&&typeof p.as=="string"){var w=p.as,b=m(w,p.crossOrigin),T=typeof p.integrity=="string"?p.integrity:void 0,A=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;w==="style"?l.d.S(g,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:b,integrity:T,fetchPriority:A}):w==="script"&&l.d.X(g,{crossOrigin:b,integrity:T,fetchPriority:A,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Rt.preinitModule=function(g,p){if(typeof g=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var w=m(p.as,p.crossOrigin);l.d.M(g,{crossOrigin:w,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)},Rt.preload=function(g,p){if(typeof g=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var w=p.as,b=m(w,p.crossOrigin);l.d.L(g,w,{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})}},Rt.preloadModule=function(g,p){if(typeof g=="string")if(p){var w=m(p.as,p.crossOrigin);l.d.m(g,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:w,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else l.d.m(g)},Rt.requestFormReset=function(g){l.d.r(g)},Rt.unstable_batchedUpdates=function(g,p){return g(p)},Rt.useFormState=function(g,p,w){return h.H.useFormState(g,p,w)},Rt.useFormStatus=function(){return h.H.useHostTransitionStatus()},Rt.version="19.2.7",Rt}var Rg;function p0(){if(Rg)return ld.exports;Rg=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(),ld.exports=g0(),ld.exports}var jg;function y0(){if(jg)return zs;jg=1;var i=m0(),n=Gd(),r=p0();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 w(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=w(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"),z=Symbol.for("react.fragment"),G=Symbol.for("react.strict_mode"),I=Symbol.for("react.profiler"),$=Symbol.for("react.consumer"),O=Symbol.for("react.context"),J=Symbol.for("react.forward_ref"),me=Symbol.for("react.suspense"),ae=Symbol.for("react.suspense_list"),K=Symbol.for("react.memo"),Ee=Symbol.for("react.lazy"),Se=Symbol.for("react.activity"),Yt=Symbol.for("react.memo_cache_sentinel"),F=Symbol.iterator;function Ce(e){return e===null||typeof e!="object"?null:(e=F&&e[F]||e["@@iterator"],typeof e=="function"?e:null)}var Ye=Symbol.for("react.client.reference");function Je(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ye?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case z:return"Fragment";case I:return"Profiler";case G:return"StrictMode";case me:return"Suspense";case ae:return"SuspenseList";case Se:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case C:return"Portal";case O:return e.displayName||"Context";case $:return(e._context.displayName||"Context")+".Consumer";case J:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case K:return t=e.displayName||null,t!==null?t:Je(e.type)||"Memo";case Ee:t=e._payload,e=e._init;try{return Je(e(t))}catch{}}return null}var ze=Array.isArray,D=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se={pending:!1,data:null,method:null,action:null},ne=[],xe=-1;function E(e){return{current:e}}function M(e){0>xe||(e.current=ne[xe],ne[xe]=null,xe--)}function W(e,t){xe++,ne[xe]=e.current,e.current=t}var Q=E(null),ge=E(null),ye=E(null),Oe=E(null);function Xe(e,t){switch(W(ye,t),W(ge,e),W(Q,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Km(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Km(t),e=Ym(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}M(Q),W(Q,e)}function Qe(){M(Q),M(ge),M(ye)}function Rn(e){e.memoizedState!==null&&W(Oe,e);var t=Q.current,a=Ym(t,e.type);t!==a&&(W(ge,e),W(Q,a))}function vn(e){ge.current===e&&(M(Q),M(ge)),Oe.current===e&&(M(Oe),Ns._currentValue=se)}var Oi,Ri;function Jn(e){if(Oi===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);Oi=t&&t[1]||"",Ri=-1<a.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+Oi+e+Ri}var zr=!1;function wa(e,t){if(!e||zr)return"";zr=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var s={DetermineComponentFrameRoot:function(){try{if(t){var q=function(){throw Error()};if(Object.defineProperty(q.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(q,[])}catch(L){var N=L}Reflect.construct(e,[],q)}else{try{q.call()}catch(L){N=L}e.call(q.prototype)}}else{try{throw Error()}catch(L){N=L}(q=e())&&typeof q.catch=="function"&&q.catch(function(){})}}catch(L){if(L&&N&&typeof L.stack=="string")return[L.stack,N.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
+ `),j=v.split(`
5
+ `);for(o=s=0;s<_.length&&!_[s].includes("DetermineComponentFrameRoot");)s++;for(;o<j.length&&!j[o].includes("DetermineComponentFrameRoot");)o++;if(s===_.length||o===j.length)for(s=_.length-1,o=j.length-1;1<=s&&0<=o&&_[s]!==j[o];)o--;for(;1<=s&&0<=o;s--,o--)if(_[s]!==j[o]){if(s!==1||o!==1)do if(s--,o--,0>o||_[s]!==j[o]){var U=`
6
+ `+_[s].replace(" at new "," at ");return e.displayName&&U.includes("<anonymous>")&&(U=U.replace("<anonymous>",e.displayName)),U}while(1<=s&&0<=o);break}}}finally{zr=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?Jn(a):""}function Zo(e,t){switch(e.tag){case 26:case 27:case 5:return Jn(e.type);case 16:return Jn("Lazy");case 13:return e.child!==t&&t!==null?Jn("Suspense Fallback"):Jn("Suspense");case 19:return Jn("SuspenseList");case 0:case 15:return wa(e.type,!1);case 11:return wa(e.type.render,!1);case 1:return wa(e.type,!0);case 31:return Jn("Activity");default:return""}}function he(e){try{var t="",a=null;do t+=Zo(e,a),a=e,e=e.return;while(e);return t}catch(s){return`
7
+ Error generating stack: `+s.message+`
8
+ `+s.stack}}var ji=Object.prototype.hasOwnProperty,Wn=i.unstable_scheduleCallback,Ni=i.unstable_cancelCallback,Br=i.unstable_shouldYield,Li=i.unstable_requestPaint,Ie=i.unstable_now,Hr=i.unstable_getCurrentPriorityLevel,ei=i.unstable_ImmediatePriority,jn=i.unstable_UserBlockingPriority,Di=i.unstable_NormalPriority,qr=i.unstable_LowPriority,$r=i.unstable_IdlePriority,ul=i.log,Pr=i.unstable_setDisableYieldValue,_a=null,yt=null;function xt(e){if(typeof ul=="function"&&Pr(e),yt&&typeof yt.setStrictMode=="function")try{yt.setStrictMode(_a,e)}catch{}}var Ct=Math.clz32?Math.clz32:fl,dl=Math.log,hl=Math.LN2;function fl(e){return e>>>=0,e===0?32:31-(dl(e)/hl|0)|0}var Jt=256,De=262144,Mi=4194304;function vt(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 Xn(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=vt(s):(f&=v,f!==0?o=vt(f):a||(a=v&~e,a!==0&&(o=vt(a))))):(v=s&~u,v!==0?o=vt(v):f!==0?o=vt(f):a||(a=s&~e,a!==0&&(o=vt(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 Ta(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ir(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 ka(){var e=Mi;return Mi<<=1,(Mi&62914560)===0&&(Mi=4194304),e}function Nn(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function re(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function sn(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,j=e.hiddenUpdates;for(a=f&~a;0<a;){var U=31-Ct(a),q=1<<U;v[U]=0,_[U]=-1;var N=j[U];if(N!==null)for(j[U]=null,U=0;U<N.length;U++){var L=N[U];L!==null&&(L.lane&=-536870913)}a&=~q}s!==0&&ml(e,s,0),u!==0&&o===0&&e.tag!==0&&(e.suspendedLanes|=u&~(f&~t))}function ml(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var s=31-Ct(t);e.entangledLanes|=t,e.entanglements[s]=e.entanglements[s]|1073741824|a&261930}function Ui(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var s=31-Ct(a),o=1<<s;o&t|e[s]&t&&(e[s]|=t),a&=~o}}function Gr(e,t){var a=t&-t;return a=(a&42)!==0?1:et(a),(a&(e.suspendedLanes|t))!==0?0:a}function et(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 Ln(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function zi(){var e=V.p;return e!==0?e:(e=window.event,e===void 0?32:pg(e.type))}function ti(e,t){var a=V.p;try{return V.p=e,t()}finally{V.p=a}}var bn=Math.random().toString(36).slice(2),tt="__reactFiber$"+bn,_t="__reactProps$"+bn,Wt="__reactContainer$"+bn,Dn="__reactEvents$"+bn,Fo="__reactListeners$"+bn,Vr="__reactHandles$"+bn,Bi="__reactResources$"+bn,Xt="__reactMarker$"+bn;function Hi(e){delete e[tt],delete e[_t],delete e[Dn],delete e[Fo],delete e[Vr]}function Qn(e){var t=e[tt];if(t)return t;for(var a=e.parentNode;a;){if(t=a[Wt]||a[tt]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=eg(e);e!==null;){if(a=e[tt])return a;e=eg(e)}return t}e=a,a=e.parentNode}return null}function Zn(e){if(e=e[tt]||e[Wt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Ea(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(l(33))}function Mn(e){var t=e[Bi];return t||(t=e[Bi]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function st(e){e[Xt]=!0}var gl=new Set,ni={};function Ut(e,t){Fn(e,t),Fn(e+"Capture",t)}function Fn(e,t){for(ni[e]=t,e=0;e<t.length;e++)gl.add(t[e])}var pl=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]*$"),Aa={},Kr={};function yl(e){return ji.call(Kr,e)?!0:ji.call(Aa,e)?!1:pl.test(e)?Kr[e]=!0:(Aa[e]=!0,!1)}function Un(e,t,a){if(yl(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 ai(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 Sn(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 Lt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function vl(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ec(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 qi(e){if(!e._valueTracker){var t=vl(e)?"checked":"value";e._valueTracker=ec(e,t,""+e[t])}}function zn(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),s="";return e&&(s=vl(e)?e.checked?"true":"false":e.value),e=s,e!==a?(t.setValue(e),!0):!1}function ii(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 tc=/[\n"\\]/g;function zt(e){return e.replace(tc,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function $i(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=""+Lt(t)):e.value!==""+Lt(t)&&(e.value=""+Lt(t)):f!=="submit"&&f!=="reset"||e.removeAttribute("value"),t!=null?Yr(e,f,Lt(t)):a!=null?Yr(e,f,Lt(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=""+Lt(v):e.removeAttribute("name")}function ri(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)){qi(e);return}a=a!=null?""+Lt(a):"",t=t!=null?""+Lt(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),qi(e)}function Yr(e,t,a){t==="number"&&ii(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function xa(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=""+Lt(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 bt(e,t,a){if(t!=null&&(t=""+Lt(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+Lt(a):""}function si(e,t,a,s){if(t==null){if(s!=null){if(a!=null)throw Error(l(92));if(ze(s)){if(1<s.length)throw Error(l(93));s=s[0]}a=s}a==null&&(a=""),t=a}a=Lt(t),e.defaultValue=a,s=e.textContent,s===a&&s!==""&&s!==null&&(e.value=s),qi(e)}function Bn(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var nc=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 ac(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||nc.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function bl(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&&ac(e,o,s)}else for(var u in t)t.hasOwnProperty(u)&&ac(e,u,t[u])}function Jr(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 Sl=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"]]),Pi=/^[\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 Hn(e){return Pi.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function ln(){}var Wr=null;function Xr(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ca=null,Oa=null;function on(e){var t=Zn(e);if(t&&(e=t.stateNode)){var a=e[_t]||null;e:switch(e=t.stateNode,t.type){case"input":if($i(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="'+zt(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var s=a[t];if(s!==e&&s.form===e.form){var o=s[_t]||null;if(!o)throw Error(l(90));$i(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&&zn(s)}break e;case"textarea":bt(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&xa(e,!!a.multiple,t,!1)}}}var Qr=!1;function wl(e,t,a){if(Qr)return e(t,a);Qr=!0;try{var s=e(t);return s}finally{if(Qr=!1,(Ca!==null||Oa!==null)&&(ro(),Ca&&(t=Ca,e=Oa,Oa=Ca=null,on(t),e)))for(t=0;t<e.length;t++)on(e[t])}}function S(e,t){var a=e.stateNode;if(a===null)return null;var s=a[_t]||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 P=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Z=!1;if(P)try{var Y={};Object.defineProperty(Y,"passive",{get:function(){Z=!0}}),window.addEventListener("test",Y,Y),window.removeEventListener("test",Y,Y)}catch{Z=!1}var oe=null,le=null,fe=null;function Ze(){if(fe)return fe;var e,t=le,a=t.length,s,o="value"in oe?oe.value:oe.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 fe=o.slice(e,1<s?1-s:void 0)}function Re(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 nt(){return!0}function _l(){return!1}function Ot(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)?nt:_l,this.isPropagationStopped=_l,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=nt)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=nt)},persist:function(){},isPersistent:nt}),t}var wn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},li=Ot(wn),ea=b({},wn,{view:0,detail:0}),oy=Ot(ea),ic,rc,Zr,Tl=b({},ea,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:lc,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!==Zr&&(Zr&&e.type==="mousemove"?(ic=e.screenX-Zr.screenX,rc=e.screenY-Zr.screenY):rc=ic=0,Zr=e),ic)},movementY:function(e){return"movementY"in e?e.movementY:rc}}),Jd=Ot(Tl),cy=b({},Tl,{dataTransfer:0}),uy=Ot(cy),dy=b({},ea,{relatedTarget:0}),sc=Ot(dy),hy=b({},wn,{animationName:0,elapsedTime:0,pseudoElement:0}),fy=Ot(hy),my=b({},wn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),gy=Ot(my),py=b({},wn,{data:0}),Wd=Ot(py),yy={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},vy={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"},by={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Sy(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=by[e])?!!t[e]:!1}function lc(){return Sy}var wy=b({},ea,{key:function(e){if(e.key){var t=yy[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Re(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?vy[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:lc,charCode:function(e){return e.type==="keypress"?Re(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Re(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),_y=Ot(wy),Ty=b({},Tl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Xd=Ot(Ty),ky=b({},ea,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:lc}),Ey=Ot(ky),Ay=b({},wn,{propertyName:0,elapsedTime:0,pseudoElement:0}),xy=Ot(Ay),Cy=b({},Tl,{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}),Oy=Ot(Cy),Ry=b({},wn,{newState:0,oldState:0}),jy=Ot(Ry),Ny=[9,13,27,32],oc=P&&"CompositionEvent"in window,Fr=null;P&&"documentMode"in document&&(Fr=document.documentMode);var Ly=P&&"TextEvent"in window&&!Fr,Qd=P&&(!oc||Fr&&8<Fr&&11>=Fr),Zd=" ",Fd=!1;function eh(e,t){switch(e){case"keyup":return Ny.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function th(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ii=!1;function Dy(e,t){switch(e){case"compositionend":return th(t);case"keypress":return t.which!==32?null:(Fd=!0,Zd);case"textInput":return e=t.data,e===Zd&&Fd?null:e;default:return null}}function My(e,t){if(Ii)return e==="compositionend"||!oc&&eh(e,t)?(e=Ze(),fe=le=oe=null,Ii=!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 Qd&&t.locale!=="ko"?null:t.data;default:return null}}var Uy={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 nh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Uy[e.type]:t==="textarea"}function ah(e,t,a,s){Ca?Oa?Oa.push(s):Oa=[s]:Ca=s,t=fo(t,"onChange"),0<t.length&&(a=new li("onChange","change",null,a,s),e.push({event:a,listeners:t}))}var es=null,ts=null;function zy(e){qm(e,0)}function kl(e){var t=Ea(e);if(zn(t))return e}function ih(e,t){if(e==="change")return t}var rh=!1;if(P){var cc;if(P){var uc="oninput"in document;if(!uc){var sh=document.createElement("div");sh.setAttribute("oninput","return;"),uc=typeof sh.oninput=="function"}cc=uc}else cc=!1;rh=cc&&(!document.documentMode||9<document.documentMode)}function lh(){es&&(es.detachEvent("onpropertychange",oh),ts=es=null)}function oh(e){if(e.propertyName==="value"&&kl(ts)){var t=[];ah(t,ts,e,Xr(e)),wl(zy,t)}}function By(e,t,a){e==="focusin"?(lh(),es=t,ts=a,es.attachEvent("onpropertychange",oh)):e==="focusout"&&lh()}function Hy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return kl(ts)}function qy(e,t){if(e==="click")return kl(t)}function $y(e,t){if(e==="input"||e==="change")return kl(t)}function Py(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Qt=typeof Object.is=="function"?Object.is:Py;function ns(e,t){if(Qt(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(!ji.call(t,o)||!Qt(e[o],t[o]))return!1}return!0}function ch(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function uh(e,t){var a=ch(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=ch(a)}}function dh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?dh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function hh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=ii(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=ii(e.document)}return t}function dc(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 Iy=P&&"documentMode"in document&&11>=document.documentMode,Gi=null,hc=null,as=null,fc=!1;function fh(e,t,a){var s=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;fc||Gi==null||Gi!==ii(s)||(s=Gi,"selectionStart"in s&&dc(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}),as&&ns(as,s)||(as=s,s=fo(hc,"onSelect"),0<s.length&&(t=new li("onSelect","select",null,t,a),e.push({event:t,listeners:s}),t.target=Gi)))}function oi(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var Vi={animationend:oi("Animation","AnimationEnd"),animationiteration:oi("Animation","AnimationIteration"),animationstart:oi("Animation","AnimationStart"),transitionrun:oi("Transition","TransitionRun"),transitionstart:oi("Transition","TransitionStart"),transitioncancel:oi("Transition","TransitionCancel"),transitionend:oi("Transition","TransitionEnd")},mc={},mh={};P&&(mh=document.createElement("div").style,"AnimationEvent"in window||(delete Vi.animationend.animation,delete Vi.animationiteration.animation,delete Vi.animationstart.animation),"TransitionEvent"in window||delete Vi.transitionend.transition);function ci(e){if(mc[e])return mc[e];if(!Vi[e])return e;var t=Vi[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in mh)return mc[e]=t[a];return e}var gh=ci("animationend"),ph=ci("animationiteration"),yh=ci("animationstart"),Gy=ci("transitionrun"),Vy=ci("transitionstart"),Ky=ci("transitioncancel"),vh=ci("transitionend"),bh=new Map,gc="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(" ");gc.push("scrollEnd");function _n(e,t){bh.set(e,t),Ut(t,[e])}var El=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)},cn=[],Ki=0,pc=0;function Al(){for(var e=Ki,t=pc=Ki=0;t<e;){var a=cn[t];cn[t++]=null;var s=cn[t];cn[t++]=null;var o=cn[t];cn[t++]=null;var u=cn[t];if(cn[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&&Sh(a,o,u)}}function xl(e,t,a,s){cn[Ki++]=e,cn[Ki++]=t,cn[Ki++]=a,cn[Ki++]=s,pc|=s,e.lanes|=s,e=e.alternate,e!==null&&(e.lanes|=s)}function yc(e,t,a,s){return xl(e,t,a,s),Cl(e)}function ui(e,t){return xl(e,null,null,t),Cl(e)}function Sh(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-Ct(a),e=u.hiddenUpdates,s=e[o],s===null?e[o]=[t]:s.push(t),t.lane=a|536870912),u):null}function Cl(e){if(50<Es)throw Es=0,Au=null,Error(l(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Yi={};function Yy(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 Zt(e,t,a,s){return new Yy(e,t,a,s)}function vc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ta(e,t){var a=e.alternate;return a===null?(a=Zt(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 wh(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 Ol(e,t,a,s,o,u){var f=0;if(s=e,typeof e=="function")vc(e)&&(f=1);else if(typeof e=="string")f=Zv(e,a,Q.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case Se:return e=Zt(31,a,t,o),e.elementType=Se,e.lanes=u,e;case z:return di(a.children,o,u,t);case G:f=8,o|=24;break;case I:return e=Zt(12,a,t,o|2),e.elementType=I,e.lanes=u,e;case me:return e=Zt(13,a,t,o),e.elementType=me,e.lanes=u,e;case ae:return e=Zt(19,a,t,o),e.elementType=ae,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case O:f=10;break e;case $:f=9;break e;case J:f=11;break e;case K:f=14;break e;case Ee:f=16,s=null;break e}f=29,a=Error(l(130,e===null?"null":typeof e,"")),s=null}return t=Zt(f,a,t,o),t.elementType=e,t.type=s,t.lanes=u,t}function di(e,t,a,s){return e=Zt(7,e,s,t),e.lanes=a,e}function bc(e,t,a){return e=Zt(6,e,null,t),e.lanes=a,e}function _h(e){var t=Zt(18,null,null,0);return t.stateNode=e,t}function Sc(e,t,a){return t=Zt(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Th=new WeakMap;function un(e,t){if(typeof e=="object"&&e!==null){var a=Th.get(e);return a!==void 0?a:(t={value:e,source:t,stack:he(t)},Th.set(e,t),t)}return{value:e,source:t,stack:he(t)}}var Ji=[],Wi=0,Rl=null,is=0,dn=[],hn=0,Ra=null,qn=1,$n="";function na(e,t){Ji[Wi++]=is,Ji[Wi++]=Rl,Rl=e,is=t}function kh(e,t,a){dn[hn++]=qn,dn[hn++]=$n,dn[hn++]=Ra,Ra=e;var s=qn;e=$n;var o=32-Ct(s)-1;s&=~(1<<o),a+=1;var u=32-Ct(t)+o;if(30<u){var f=o-o%5;u=(s&(1<<f)-1).toString(32),s>>=f,o-=f,qn=1<<32-Ct(t)+o|a<<o|s,$n=u+e}else qn=1<<u|a<<o|s,$n=e}function wc(e){e.return!==null&&(na(e,1),kh(e,1,0))}function _c(e){for(;e===Rl;)Rl=Ji[--Wi],Ji[Wi]=null,is=Ji[--Wi],Ji[Wi]=null;for(;e===Ra;)Ra=dn[--hn],dn[hn]=null,$n=dn[--hn],dn[hn]=null,qn=dn[--hn],dn[hn]=null}function Eh(e,t){dn[hn++]=qn,dn[hn++]=$n,dn[hn++]=Ra,qn=t.id,$n=t.overflow,Ra=e}var Tt=null,Ve=null,Ae=!1,ja=null,fn=!1,Tc=Error(l(519));function Na(e){var t=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw rs(un(t,e)),Tc}function Ah(e){var t=e.stateNode,a=e.type,s=e.memoizedProps;switch(t[tt]=e,t[_t]=s,a){case"dialog":_e("cancel",t),_e("close",t);break;case"iframe":case"object":case"embed":_e("load",t);break;case"video":case"audio":for(a=0;a<xs.length;a++)_e(xs[a],t);break;case"source":_e("error",t);break;case"img":case"image":case"link":_e("error",t),_e("load",t);break;case"details":_e("toggle",t);break;case"input":_e("invalid",t),ri(t,s.value,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name,!0);break;case"select":_e("invalid",t);break;case"textarea":_e("invalid",t),si(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||Gm(t.textContent,a)?(s.popover!=null&&(_e("beforetoggle",t),_e("toggle",t)),s.onScroll!=null&&_e("scroll",t),s.onScrollEnd!=null&&_e("scrollend",t),s.onClick!=null&&(t.onclick=ln),t=!0):t=!1,t||Na(e,!0)}function xh(e){for(Tt=e.return;Tt;)switch(Tt.tag){case 5:case 31:case 13:fn=!1;return;case 27:case 3:fn=!0;return;default:Tt=Tt.return}}function Xi(e){if(e!==Tt)return!1;if(!Ae)return xh(e),Ae=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||$u(e.type,e.memoizedProps)),a=!a),a&&Ve&&Na(e),xh(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ve=Fm(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ve=Fm(e)}else t===27?(t=Ve,Ka(e.type)?(e=Ku,Ku=null,Ve=e):Ve=t):Ve=Tt?gn(e.stateNode.nextSibling):null;return!0}function hi(){Ve=Tt=null,Ae=!1}function kc(){var e=ja;return e!==null&&($t===null?$t=e:$t.push.apply($t,e),ja=null),e}function rs(e){ja===null?ja=[e]:ja.push(e)}var Ec=E(null),fi=null,aa=null;function La(e,t,a){W(Ec,t._currentValue),t._currentValue=a}function ia(e){e._currentValue=Ec.current,M(Ec)}function Ac(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 xc(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),Ac(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),Ac(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 Qi(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;Qt(o.pendingProps.value,f.value)||(e!==null?e.push(v):e=[v])}}else if(o===Oe.current){if(f=o.alternate,f===null)throw Error(l(387));f.memoizedState.memoizedState!==o.memoizedState.memoizedState&&(e!==null?e.push(Ns):e=[Ns])}o=o.return}e!==null&&xc(t,e,a,s),t.flags|=262144}function jl(e){for(e=e.firstContext;e!==null;){if(!Qt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function mi(e){fi=e,aa=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function kt(e){return Ch(fi,e)}function Nl(e,t){return fi===null&&mi(e),Ch(e,t)}function Ch(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},aa===null){if(e===null)throw Error(l(308));aa=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else aa=aa.next=t;return a}var Jy=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()})}},Wy=i.unstable_scheduleCallback,Xy=i.unstable_NormalPriority,dt={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Cc(){return{controller:new Jy,data:new Map,refCount:0}}function ss(e){e.refCount--,e.refCount===0&&Wy(Xy,function(){e.controller.abort()})}var ls=null,Oc=0,Zi=0,Fi=null;function Qy(e,t){if(ls===null){var a=ls=[];Oc=0,Zi=Nu(),Fi={status:"pending",value:void 0,then:function(s){a.push(s)}}}return Oc++,t.then(Oh,Oh),t}function Oh(){if(--Oc===0&&ls!==null){Fi!==null&&(Fi.status="fulfilled");var e=ls;ls=null,Zi=0,Fi=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Zy(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 Rh=D.S;D.S=function(e,t){mm=Ie(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&Qy(e,t),Rh!==null&&Rh(e,t)};var gi=E(null);function Rc(){var e=gi.current;return e!==null?e:Pe.pooledCache}function Ll(e,t){t===null?W(gi,gi.current):W(gi,t.pool)}function jh(){var e=Rc();return e===null?null:{parent:dt._currentValue,pool:e}}var er=Error(l(460)),jc=Error(l(474)),Dl=Error(l(542)),Ml={then:function(){}};function Nh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Lh(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(ln,ln),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Mh(e),e;default:if(typeof t.status=="string")t.then(ln,ln);else{if(e=Pe,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,Mh(e),e}throw yi=t,er}}function pi(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(yi=a,er):a}}var yi=null;function Dh(){if(yi===null)throw Error(l(459));var e=yi;return yi=null,e}function Mh(e){if(e===er||e===Dl)throw Error(l(483))}var tr=null,os=0;function Ul(e){var t=os;return os+=1,tr===null&&(tr=[]),Lh(tr,e,t)}function cs(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function zl(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 Uh(e){function t(x,k){if(e){var R=x.deletions;R===null?(x.deletions=[k],x.flags|=16):R.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=ta(x,k),x.index=0,x.sibling=null,x}function u(x,k,R){return x.index=R,e?(R=x.alternate,R!==null?(R=R.index,R<k?(x.flags|=67108866,k):R):(x.flags|=67108866,k)):(x.flags|=1048576,k)}function f(x){return e&&x.alternate===null&&(x.flags|=67108866),x}function v(x,k,R,B){return k===null||k.tag!==6?(k=bc(R,x.mode,B),k.return=x,k):(k=o(k,R),k.return=x,k)}function _(x,k,R,B){var ce=R.type;return ce===z?U(x,k,R.props.children,B,R.key):k!==null&&(k.elementType===ce||typeof ce=="object"&&ce!==null&&ce.$$typeof===Ee&&pi(ce)===k.type)?(k=o(k,R.props),cs(k,R),k.return=x,k):(k=Ol(R.type,R.key,R.props,null,x.mode,B),cs(k,R),k.return=x,k)}function j(x,k,R,B){return k===null||k.tag!==4||k.stateNode.containerInfo!==R.containerInfo||k.stateNode.implementation!==R.implementation?(k=Sc(R,x.mode,B),k.return=x,k):(k=o(k,R.children||[]),k.return=x,k)}function U(x,k,R,B,ce){return k===null||k.tag!==7?(k=di(R,x.mode,B,ce),k.return=x,k):(k=o(k,R),k.return=x,k)}function q(x,k,R){if(typeof k=="string"&&k!==""||typeof k=="number"||typeof k=="bigint")return k=bc(""+k,x.mode,R),k.return=x,k;if(typeof k=="object"&&k!==null){switch(k.$$typeof){case A:return R=Ol(k.type,k.key,k.props,null,x.mode,R),cs(R,k),R.return=x,R;case C:return k=Sc(k,x.mode,R),k.return=x,k;case Ee:return k=pi(k),q(x,k,R)}if(ze(k)||Ce(k))return k=di(k,x.mode,R,null),k.return=x,k;if(typeof k.then=="function")return q(x,Ul(k),R);if(k.$$typeof===O)return q(x,Nl(x,k),R);zl(x,k)}return null}function N(x,k,R,B){var ce=k!==null?k.key:null;if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return ce!==null?null:v(x,k,""+R,B);if(typeof R=="object"&&R!==null){switch(R.$$typeof){case A:return R.key===ce?_(x,k,R,B):null;case C:return R.key===ce?j(x,k,R,B):null;case Ee:return R=pi(R),N(x,k,R,B)}if(ze(R)||Ce(R))return ce!==null?null:U(x,k,R,B,null);if(typeof R.then=="function")return N(x,k,Ul(R),B);if(R.$$typeof===O)return N(x,k,Nl(x,R),B);zl(x,R)}return null}function L(x,k,R,B,ce){if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return x=x.get(R)||null,v(k,x,""+B,ce);if(typeof B=="object"&&B!==null){switch(B.$$typeof){case A:return x=x.get(B.key===null?R:B.key)||null,_(k,x,B,ce);case C:return x=x.get(B.key===null?R:B.key)||null,j(k,x,B,ce);case Ee:return B=pi(B),L(x,k,R,B,ce)}if(ze(B)||Ce(B))return x=x.get(R)||null,U(k,x,B,ce,null);if(typeof B.then=="function")return L(x,k,R,Ul(B),ce);if(B.$$typeof===O)return L(x,k,R,Nl(k,B),ce);zl(k,B)}return null}function ee(x,k,R,B){for(var ce=null,je=null,ie=k,be=k=0,ke=null;ie!==null&&be<R.length;be++){ie.index>be?(ke=ie,ie=null):ke=ie.sibling;var Ne=N(x,ie,R[be],B);if(Ne===null){ie===null&&(ie=ke);break}e&&ie&&Ne.alternate===null&&t(x,ie),k=u(Ne,k,be),je===null?ce=Ne:je.sibling=Ne,je=Ne,ie=ke}if(be===R.length)return a(x,ie),Ae&&na(x,be),ce;if(ie===null){for(;be<R.length;be++)ie=q(x,R[be],B),ie!==null&&(k=u(ie,k,be),je===null?ce=ie:je.sibling=ie,je=ie);return Ae&&na(x,be),ce}for(ie=s(ie);be<R.length;be++)ke=L(ie,x,be,R[be],B),ke!==null&&(e&&ke.alternate!==null&&ie.delete(ke.key===null?be:ke.key),k=u(ke,k,be),je===null?ce=ke:je.sibling=ke,je=ke);return e&&ie.forEach(function(Qa){return t(x,Qa)}),Ae&&na(x,be),ce}function de(x,k,R,B){if(R==null)throw Error(l(151));for(var ce=null,je=null,ie=k,be=k=0,ke=null,Ne=R.next();ie!==null&&!Ne.done;be++,Ne=R.next()){ie.index>be?(ke=ie,ie=null):ke=ie.sibling;var Qa=N(x,ie,Ne.value,B);if(Qa===null){ie===null&&(ie=ke);break}e&&ie&&Qa.alternate===null&&t(x,ie),k=u(Qa,k,be),je===null?ce=Qa:je.sibling=Qa,je=Qa,ie=ke}if(Ne.done)return a(x,ie),Ae&&na(x,be),ce;if(ie===null){for(;!Ne.done;be++,Ne=R.next())Ne=q(x,Ne.value,B),Ne!==null&&(k=u(Ne,k,be),je===null?ce=Ne:je.sibling=Ne,je=Ne);return Ae&&na(x,be),ce}for(ie=s(ie);!Ne.done;be++,Ne=R.next())Ne=L(ie,x,be,Ne.value,B),Ne!==null&&(e&&Ne.alternate!==null&&ie.delete(Ne.key===null?be:Ne.key),k=u(Ne,k,be),je===null?ce=Ne:je.sibling=Ne,je=Ne);return e&&ie.forEach(function(c0){return t(x,c0)}),Ae&&na(x,be),ce}function qe(x,k,R,B){if(typeof R=="object"&&R!==null&&R.type===z&&R.key===null&&(R=R.props.children),typeof R=="object"&&R!==null){switch(R.$$typeof){case A:e:{for(var ce=R.key;k!==null;){if(k.key===ce){if(ce=R.type,ce===z){if(k.tag===7){a(x,k.sibling),B=o(k,R.props.children),B.return=x,x=B;break e}}else if(k.elementType===ce||typeof ce=="object"&&ce!==null&&ce.$$typeof===Ee&&pi(ce)===k.type){a(x,k.sibling),B=o(k,R.props),cs(B,R),B.return=x,x=B;break e}a(x,k);break}else t(x,k);k=k.sibling}R.type===z?(B=di(R.props.children,x.mode,B,R.key),B.return=x,x=B):(B=Ol(R.type,R.key,R.props,null,x.mode,B),cs(B,R),B.return=x,x=B)}return f(x);case C:e:{for(ce=R.key;k!==null;){if(k.key===ce)if(k.tag===4&&k.stateNode.containerInfo===R.containerInfo&&k.stateNode.implementation===R.implementation){a(x,k.sibling),B=o(k,R.children||[]),B.return=x,x=B;break e}else{a(x,k);break}else t(x,k);k=k.sibling}B=Sc(R,x.mode,B),B.return=x,x=B}return f(x);case Ee:return R=pi(R),qe(x,k,R,B)}if(ze(R))return ee(x,k,R,B);if(Ce(R)){if(ce=Ce(R),typeof ce!="function")throw Error(l(150));return R=ce.call(R),de(x,k,R,B)}if(typeof R.then=="function")return qe(x,k,Ul(R),B);if(R.$$typeof===O)return qe(x,k,Nl(x,R),B);zl(x,R)}return typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint"?(R=""+R,k!==null&&k.tag===6?(a(x,k.sibling),B=o(k,R),B.return=x,x=B):(a(x,k),B=bc(R,x.mode,B),B.return=x,x=B),f(x)):a(x,k)}return function(x,k,R,B){try{os=0;var ce=qe(x,k,R,B);return tr=null,ce}catch(ie){if(ie===er||ie===Dl)throw ie;var je=Zt(29,ie,null,x.mode);return je.lanes=B,je.return=x,je}}}var vi=Uh(!0),zh=Uh(!1),Da=!1;function Nc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Lc(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 Ma(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ua(e,t,a){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Le&2)!==0){var o=s.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),s.pending=t,t=Cl(e),Sh(e,null,a),t}return xl(e,s,t,a),Cl(e)}function us(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,Ui(e,a)}}function Dc(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 Mc=!1;function ds(){if(Mc){var e=Fi;if(e!==null)throw e}}function hs(e,t,a,s){Mc=!1;var o=e.updateQueue;Da=!1;var u=o.firstBaseUpdate,f=o.lastBaseUpdate,v=o.shared.pending;if(v!==null){o.shared.pending=null;var _=v,j=_.next;_.next=null,f===null?u=j:f.next=j,f=_;var U=e.alternate;U!==null&&(U=U.updateQueue,v=U.lastBaseUpdate,v!==f&&(v===null?U.firstBaseUpdate=j:v.next=j,U.lastBaseUpdate=_))}if(u!==null){var q=o.baseState;f=0,U=j=_=null,v=u;do{var N=v.lane&-536870913,L=N!==v.lane;if(L?(Te&N)===N:(s&N)===N){N!==0&&N===Zi&&(Mc=!0),U!==null&&(U=U.next={lane:0,tag:v.tag,payload:v.payload,callback:null,next:null});e:{var ee=e,de=v;N=t;var qe=a;switch(de.tag){case 1:if(ee=de.payload,typeof ee=="function"){q=ee.call(qe,q,N);break e}q=ee;break e;case 3:ee.flags=ee.flags&-65537|128;case 0:if(ee=de.payload,N=typeof ee=="function"?ee.call(qe,q,N):ee,N==null)break e;q=b({},q,N);break e;case 2:Da=!0}}N=v.callback,N!==null&&(e.flags|=64,L&&(e.flags|=8192),L=o.callbacks,L===null?o.callbacks=[N]:L.push(N))}else L={lane:N,tag:v.tag,payload:v.payload,callback:v.callback,next:null},U===null?(j=U=L,_=q):U=U.next=L,f|=N;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);U===null&&(_=q),o.baseState=_,o.firstBaseUpdate=j,o.lastBaseUpdate=U,u===null&&(o.shared.lanes=0),$a|=f,e.lanes=f,e.memoizedState=q}}function Bh(e,t){if(typeof e!="function")throw Error(l(191,e));e.call(t)}function Hh(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)Bh(a[e],t)}var nr=E(null),Bl=E(0);function qh(e,t){e=fa,W(Bl,e),W(nr,t),fa=e|t.baseLanes}function Uc(){W(Bl,fa),W(nr,nr.current)}function zc(){fa=Bl.current,M(nr),M(Bl)}var Ft=E(null),mn=null;function za(e){var t=e.alternate;W(lt,lt.current&1),W(Ft,e),mn===null&&(t===null||nr.current!==null||t.memoizedState!==null)&&(mn=e)}function Bc(e){W(lt,lt.current),W(Ft,e),mn===null&&(mn=e)}function $h(e){e.tag===22?(W(lt,lt.current),W(Ft,e),mn===null&&(mn=e)):Ba()}function Ba(){W(lt,lt.current),W(Ft,Ft.current)}function en(e){M(Ft),mn===e&&(mn=null),M(lt)}var lt=E(0);function Hl(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||Gu(a)||Vu(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 ra=0,ve=null,Be=null,ht=null,ql=!1,ar=!1,bi=!1,$l=0,fs=0,ir=null,Fy=0;function at(){throw Error(l(321))}function Hc(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!Qt(e[a],t[a]))return!1;return!0}function qc(e,t,a,s,o,u){return ra=u,ve=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,D.H=e===null||e.memoizedState===null?Ef:tu,bi=!1,u=a(s,o),bi=!1,ar&&(u=Ih(t,a,s,o)),Ph(e),u}function Ph(e){D.H=ps;var t=Be!==null&&Be.next!==null;if(ra=0,ht=Be=ve=null,ql=!1,fs=0,ir=null,t)throw Error(l(300));e===null||ft||(e=e.dependencies,e!==null&&jl(e)&&(ft=!0))}function Ih(e,t,a,s){ve=e;var o=0;do{if(ar&&(ir=null),fs=0,ar=!1,25<=o)throw Error(l(301));if(o+=1,ht=Be=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=Af,u=t(a,s)}while(ar);return u}function ev(){var e=D.H,t=e.useState()[0];return t=typeof t.then=="function"?ms(t):t,e=e.useState()[0],(Be!==null?Be.memoizedState:null)!==e&&(ve.flags|=1024),t}function $c(){var e=$l!==0;return $l=0,e}function Pc(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function Ic(e){if(ql){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ql=!1}ra=0,ht=Be=ve=null,ar=!1,fs=$l=0,ir=null}function Dt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ht===null?ve.memoizedState=ht=e:ht=ht.next=e,ht}function ot(){if(Be===null){var e=ve.alternate;e=e!==null?e.memoizedState:null}else e=Be.next;var t=ht===null?ve.memoizedState:ht.next;if(t!==null)ht=t,Be=e;else{if(e===null)throw ve.alternate===null?Error(l(467)):Error(l(310));Be=e,e={memoizedState:Be.memoizedState,baseState:Be.baseState,baseQueue:Be.baseQueue,queue:Be.queue,next:null},ht===null?ve.memoizedState=ht=e:ht=ht.next=e}return ht}function Pl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ms(e){var t=fs;return fs+=1,ir===null&&(ir=[]),e=Lh(ir,e,t),t=ve,(ht===null?t.memoizedState:ht.next)===null&&(t=t.alternate,D.H=t===null||t.memoizedState===null?Ef:tu),e}function Il(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ms(e);if(e.$$typeof===O)return kt(e)}throw Error(l(438,String(e)))}function Gc(e){var t=null,a=ve.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var s=ve.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=Pl(),ve.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]=Yt;return t.index++,a}function sa(e,t){return typeof t=="function"?t(e):t}function Gl(e){var t=ot();return Vc(t,Be,e)}function Vc(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,j=t,U=!1;do{var q=j.lane&-536870913;if(q!==j.lane?(Te&q)===q:(ra&q)===q){var N=j.revertLane;if(N===0)_!==null&&(_=_.next={lane:0,revertLane:0,gesture:null,action:j.action,hasEagerState:j.hasEagerState,eagerState:j.eagerState,next:null}),q===Zi&&(U=!0);else if((ra&N)===N){j=j.next,N===Zi&&(U=!0);continue}else q={lane:0,revertLane:j.revertLane,gesture:null,action:j.action,hasEagerState:j.hasEagerState,eagerState:j.eagerState,next:null},_===null?(v=_=q,f=u):_=_.next=q,ve.lanes|=N,$a|=N;q=j.action,bi&&a(u,q),u=j.hasEagerState?j.eagerState:a(u,q)}else N={lane:q,revertLane:j.revertLane,gesture:j.gesture,action:j.action,hasEagerState:j.hasEagerState,eagerState:j.eagerState,next:null},_===null?(v=_=N,f=u):_=_.next=N,ve.lanes|=q,$a|=q;j=j.next}while(j!==null&&j!==t);if(_===null?f=u:_.next=v,!Qt(u,e.memoizedState)&&(ft=!0,U&&(a=Fi,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 Kc(e){var t=ot(),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);Qt(u,t.memoizedState)||(ft=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),a.lastRenderedState=u}return[u,s]}function Gh(e,t,a){var s=ve,o=ot(),u=Ae;if(u){if(a===void 0)throw Error(l(407));a=a()}else a=t();var f=!Qt((Be||o).memoizedState,a);if(f&&(o.memoizedState=a,ft=!0),o=o.queue,Wc(Yh.bind(null,s,o,e),[e]),o.getSnapshot!==t||f||ht!==null&&ht.memoizedState.tag&1){if(s.flags|=2048,rr(9,{destroy:void 0},Kh.bind(null,s,o,a,t),null),Pe===null)throw Error(l(349));u||(ra&127)!==0||Vh(s,t,a)}return a}function Vh(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=ve.updateQueue,t===null?(t=Pl(),ve.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function Kh(e,t,a,s){t.value=a,t.getSnapshot=s,Jh(t)&&Wh(e)}function Yh(e,t,a){return a(function(){Jh(t)&&Wh(e)})}function Jh(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!Qt(e,a)}catch{return!0}}function Wh(e){var t=ui(e,2);t!==null&&Pt(t,e,2)}function Yc(e){var t=Dt();if(typeof e=="function"){var a=e;if(e=a(),bi){xt(!0);try{a()}finally{xt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:sa,lastRenderedState:e},t}function Xh(e,t,a,s){return e.baseState=a,Vc(e,Be,typeof s=="function"?s:sa)}function tv(e,t,a,s,o){if(Yl(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,Qh(t,u)):(u.next=a.next,t.pending=a.next=u)}}function Qh(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),Zh(e,t,v)}catch(j){Jc(e,t,j)}finally{u!==null&&f.types!==null&&(u.types=f.types),D.T=u}}else try{u=a(o,s),Zh(e,t,u)}catch(j){Jc(e,t,j)}}function Zh(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(s){Fh(e,t,s)},function(s){return Jc(e,t,s)}):Fh(e,t,a)}function Fh(e,t,a){t.status="fulfilled",t.value=a,ef(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,Qh(e,a)))}function Jc(e,t,a){var s=e.pending;if(e.pending=null,s!==null){s=s.next;do t.status="rejected",t.reason=a,ef(t),t=t.next;while(t!==s)}e.action=null}function ef(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function tf(e,t){return t}function nf(e,t){if(Ae){var a=Pe.formState;if(a!==null){e:{var s=ve;if(Ae){if(Ve){t:{for(var o=Ve,u=fn;o.nodeType!==8;){if(!u){o=null;break t}if(o=gn(o.nextSibling),o===null){o=null;break t}}u=o.data,o=u==="F!"||u==="F"?o:null}if(o){Ve=gn(o.nextSibling),s=o.data==="F!";break e}}Na(s)}s=!1}s&&(t=a[0])}}return a=Dt(),a.memoizedState=a.baseState=t,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:tf,lastRenderedState:t},a.queue=s,a=_f.bind(null,ve,s),s.dispatch=a,s=Yc(!1),u=eu.bind(null,ve,!1,s.queue),s=Dt(),o={state:t,dispatch:null,action:e,pending:null},s.queue=o,a=tv.bind(null,ve,o,u,a),o.dispatch=a,s.memoizedState=e,[t,a,!1]}function af(e){var t=ot();return rf(t,Be,e)}function rf(e,t,a){if(t=Vc(e,t,tf)[0],e=Gl(sa)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var s=ms(t)}catch(f){throw f===er?Dl:f}else s=t;t=ot();var o=t.queue,u=o.dispatch;return a!==t.memoizedState&&(ve.flags|=2048,rr(9,{destroy:void 0},nv.bind(null,o,a),null)),[s,u,e]}function nv(e,t){e.action=t}function sf(e){var t=ot(),a=Be;if(a!==null)return rf(t,a,e);ot(),t=t.memoizedState,a=ot();var s=a.queue.dispatch;return a.memoizedState=e,[t,s,!1]}function rr(e,t,a,s){return e={tag:e,create:a,deps:s,inst:t,next:null},t=ve.updateQueue,t===null&&(t=Pl(),ve.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 lf(){return ot().memoizedState}function Vl(e,t,a,s){var o=Dt();ve.flags|=e,o.memoizedState=rr(1|t,{destroy:void 0},a,s===void 0?null:s)}function Kl(e,t,a,s){var o=ot();s=s===void 0?null:s;var u=o.memoizedState.inst;Be!==null&&s!==null&&Hc(s,Be.memoizedState.deps)?o.memoizedState=rr(t,u,a,s):(ve.flags|=e,o.memoizedState=rr(1|t,u,a,s))}function of(e,t){Vl(8390656,8,e,t)}function Wc(e,t){Kl(2048,8,e,t)}function av(e){ve.flags|=4;var t=ve.updateQueue;if(t===null)t=Pl(),ve.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function cf(e){var t=ot().memoizedState;return av({ref:t,nextImpl:e}),function(){if((Le&2)!==0)throw Error(l(440));return t.impl.apply(void 0,arguments)}}function uf(e,t){return Kl(4,2,e,t)}function df(e,t){return Kl(4,4,e,t)}function hf(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 ff(e,t,a){a=a!=null?a.concat([e]):null,Kl(4,4,hf.bind(null,t,e),a)}function Xc(){}function mf(e,t){var a=ot();t=t===void 0?null:t;var s=a.memoizedState;return t!==null&&Hc(t,s[1])?s[0]:(a.memoizedState=[e,t],e)}function gf(e,t){var a=ot();t=t===void 0?null:t;var s=a.memoizedState;if(t!==null&&Hc(t,s[1]))return s[0];if(s=e(),bi){xt(!0);try{e()}finally{xt(!1)}}return a.memoizedState=[s,t],s}function Qc(e,t,a){return a===void 0||(ra&1073741824)!==0&&(Te&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=pm(),ve.lanes|=e,$a|=e,a)}function pf(e,t,a,s){return Qt(a,t)?a:nr.current!==null?(e=Qc(e,a,s),Qt(e,t)||(ft=!0),e):(ra&42)===0||(ra&1073741824)!==0&&(Te&261930)===0?(ft=!0,e.memoizedState=a):(e=pm(),ve.lanes|=e,$a|=e,t)}function yf(e,t,a,s,o){var u=V.p;V.p=u!==0&&8>u?u:8;var f=D.T,v={};D.T=v,eu(e,!1,t,a);try{var _=o(),j=D.S;if(j!==null&&j(v,_),_!==null&&typeof _=="object"&&typeof _.then=="function"){var U=Zy(_,s);gs(e,t,U,an(e))}else gs(e,t,s,an(e))}catch(q){gs(e,t,{then:function(){},status:"rejected",reason:q},an())}finally{V.p=u,f!==null&&v.types!==null&&(f.types=v.types),D.T=f}}function iv(){}function Zc(e,t,a,s){if(e.tag!==5)throw Error(l(476));var o=vf(e).queue;yf(e,o,t,se,a===null?iv:function(){return bf(e),a(s)})}function vf(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:se,baseState:se,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sa,lastRenderedState:se},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sa,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function bf(e){var t=vf(e);t.next===null&&(t=e.alternate.memoizedState),gs(e,t.next.queue,{},an())}function Fc(){return kt(Ns)}function Sf(){return ot().memoizedState}function wf(){return ot().memoizedState}function rv(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=an();e=Ma(a);var s=Ua(t,e,a);s!==null&&(Pt(s,t,a),us(s,t,a)),t={cache:Cc()},e.payload=t;return}t=t.return}}function sv(e,t,a){var s=an();a={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Yl(e)?Tf(t,a):(a=yc(e,t,a,s),a!==null&&(Pt(a,e,s),kf(a,t,s)))}function _f(e,t,a){var s=an();gs(e,t,a,s)}function gs(e,t,a,s){var o={lane:s,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Yl(e))Tf(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,Qt(v,f))return xl(e,t,o,0),Pe===null&&Al(),!1}catch{}if(a=yc(e,t,o,s),a!==null)return Pt(a,e,s),kf(a,t,s),!0}return!1}function eu(e,t,a,s){if(s={lane:2,revertLane:Nu(),gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Yl(e)){if(t)throw Error(l(479))}else t=yc(e,a,s,2),t!==null&&Pt(t,e,2)}function Yl(e){var t=e.alternate;return e===ve||t!==null&&t===ve}function Tf(e,t){ar=ql=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function kf(e,t,a){if((a&4194048)!==0){var s=t.lanes;s&=e.pendingLanes,a|=s,t.lanes=a,Ui(e,a)}}var ps={readContext:kt,use:Il,useCallback:at,useContext:at,useEffect:at,useImperativeHandle:at,useLayoutEffect:at,useInsertionEffect:at,useMemo:at,useReducer:at,useRef:at,useState:at,useDebugValue:at,useDeferredValue:at,useTransition:at,useSyncExternalStore:at,useId:at,useHostTransitionStatus:at,useFormState:at,useActionState:at,useOptimistic:at,useMemoCache:at,useCacheRefresh:at};ps.useEffectEvent=at;var Ef={readContext:kt,use:Il,useCallback:function(e,t){return Dt().memoizedState=[e,t===void 0?null:t],e},useContext:kt,useEffect:of,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Vl(4194308,4,hf.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Vl(4194308,4,e,t)},useInsertionEffect:function(e,t){Vl(4,2,e,t)},useMemo:function(e,t){var a=Dt();t=t===void 0?null:t;var s=e();if(bi){xt(!0);try{e()}finally{xt(!1)}}return a.memoizedState=[s,t],s},useReducer:function(e,t,a){var s=Dt();if(a!==void 0){var o=a(t);if(bi){xt(!0);try{a(t)}finally{xt(!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=sv.bind(null,ve,e),[s.memoizedState,e]},useRef:function(e){var t=Dt();return e={current:e},t.memoizedState=e},useState:function(e){e=Yc(e);var t=e.queue,a=_f.bind(null,ve,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:Xc,useDeferredValue:function(e,t){var a=Dt();return Qc(a,e,t)},useTransition:function(){var e=Yc(!1);return e=yf.bind(null,ve,e.queue,!0,!1),Dt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var s=ve,o=Dt();if(Ae){if(a===void 0)throw Error(l(407));a=a()}else{if(a=t(),Pe===null)throw Error(l(349));(Te&127)!==0||Vh(s,t,a)}o.memoizedState=a;var u={value:a,getSnapshot:t};return o.queue=u,of(Yh.bind(null,s,u,e),[e]),s.flags|=2048,rr(9,{destroy:void 0},Kh.bind(null,s,u,a,t),null),a},useId:function(){var e=Dt(),t=Pe.identifierPrefix;if(Ae){var a=$n,s=qn;a=(s&~(1<<32-Ct(s)-1)).toString(32)+a,t="_"+t+"R_"+a,a=$l++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=Fy++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Fc,useFormState:nf,useActionState:nf,useOptimistic:function(e){var t=Dt();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=eu.bind(null,ve,!0,a),a.dispatch=t,[e,t]},useMemoCache:Gc,useCacheRefresh:function(){return Dt().memoizedState=rv.bind(null,ve)},useEffectEvent:function(e){var t=Dt(),a={impl:e};return t.memoizedState=a,function(){if((Le&2)!==0)throw Error(l(440));return a.impl.apply(void 0,arguments)}}},tu={readContext:kt,use:Il,useCallback:mf,useContext:kt,useEffect:Wc,useImperativeHandle:ff,useInsertionEffect:uf,useLayoutEffect:df,useMemo:gf,useReducer:Gl,useRef:lf,useState:function(){return Gl(sa)},useDebugValue:Xc,useDeferredValue:function(e,t){var a=ot();return pf(a,Be.memoizedState,e,t)},useTransition:function(){var e=Gl(sa)[0],t=ot().memoizedState;return[typeof e=="boolean"?e:ms(e),t]},useSyncExternalStore:Gh,useId:Sf,useHostTransitionStatus:Fc,useFormState:af,useActionState:af,useOptimistic:function(e,t){var a=ot();return Xh(a,Be,e,t)},useMemoCache:Gc,useCacheRefresh:wf};tu.useEffectEvent=cf;var Af={readContext:kt,use:Il,useCallback:mf,useContext:kt,useEffect:Wc,useImperativeHandle:ff,useInsertionEffect:uf,useLayoutEffect:df,useMemo:gf,useReducer:Kc,useRef:lf,useState:function(){return Kc(sa)},useDebugValue:Xc,useDeferredValue:function(e,t){var a=ot();return Be===null?Qc(a,e,t):pf(a,Be.memoizedState,e,t)},useTransition:function(){var e=Kc(sa)[0],t=ot().memoizedState;return[typeof e=="boolean"?e:ms(e),t]},useSyncExternalStore:Gh,useId:Sf,useHostTransitionStatus:Fc,useFormState:sf,useActionState:sf,useOptimistic:function(e,t){var a=ot();return Be!==null?Xh(a,Be,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Gc,useCacheRefresh:wf};Af.useEffectEvent=cf;function nu(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 au={enqueueSetState:function(e,t,a){e=e._reactInternals;var s=an(),o=Ma(s);o.payload=t,a!=null&&(o.callback=a),t=Ua(e,o,s),t!==null&&(Pt(t,e,s),us(t,e,s))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var s=an(),o=Ma(s);o.tag=1,o.payload=t,a!=null&&(o.callback=a),t=Ua(e,o,s),t!==null&&(Pt(t,e,s),us(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=an(),s=Ma(a);s.tag=2,t!=null&&(s.callback=t),t=Ua(e,s,a),t!==null&&(Pt(t,e,a),us(t,e,a))}};function xf(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?!ns(a,s)||!ns(o,u):!0}function Cf(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&&au.enqueueReplaceState(t,t.state,null)}function Si(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 Of(e){El(e)}function Rf(e){console.error(e)}function jf(e){El(e)}function Jl(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(s){setTimeout(function(){throw s})}}function Nf(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 iu(e,t,a){return a=Ma(a),a.tag=3,a.payload={element:null},a.callback=function(){Jl(e,t)},a}function Lf(e){return e=Ma(e),e.tag=3,e}function Df(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(){Nf(t,a,s)}}var f=a.stateNode;f!==null&&typeof f.componentDidCatch=="function"&&(e.callback=function(){Nf(t,a,s),typeof o!="function"&&(Pa===null?Pa=new Set([this]):Pa.add(this));var v=s.stack;this.componentDidCatch(s.value,{componentStack:v!==null?v:""})})}function lv(e,t,a,s,o){if(a.flags|=32768,s!==null&&typeof s=="object"&&typeof s.then=="function"){if(t=a.alternate,t!==null&&Qi(t,a,o,!0),a=Ft.current,a!==null){switch(a.tag){case 31:case 13:return mn===null?so():a.alternate===null&&it===0&&(it=3),a.flags&=-257,a.flags|=65536,a.lanes=o,s===Ml?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([s]):t.add(s),Ou(e,s,o)),!1;case 22:return a.flags|=65536,s===Ml?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)),Ou(e,s,o)),!1}throw Error(l(435,a.tag))}return Ou(e,s,o),so(),!1}if(Ae)return t=Ft.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=o,s!==Tc&&(e=Error(l(422),{cause:s}),rs(un(e,a)))):(s!==Tc&&(t=Error(l(423),{cause:s}),rs(un(t,a))),e=e.current.alternate,e.flags|=65536,o&=-o,e.lanes|=o,s=un(s,a),o=iu(e.stateNode,s,o),Dc(e,o),it!==4&&(it=2)),!1;var u=Error(l(520),{cause:s});if(u=un(u,a),ks===null?ks=[u]:ks.push(u),it!==4&&(it=2),t===null)return!0;s=un(s,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=o&-o,a.lanes|=e,e=iu(a.stateNode,s,e),Dc(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"&&(Pa===null||!Pa.has(u))))return a.flags|=65536,o&=-o,a.lanes|=o,o=Lf(o),Df(o,e,a,s),Dc(a,o),!1}a=a.return}while(a!==null);return!1}var ru=Error(l(461)),ft=!1;function Et(e,t,a,s){t.child=e===null?zh(t,null,a,s):vi(t,e.child,a,s)}function Mf(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 mi(t),s=qc(e,t,a,f,u,o),v=$c(),e!==null&&!ft?(Pc(e,t,o),la(e,t,o)):(Ae&&v&&wc(t),t.flags|=1,Et(e,t,s,o),t.child)}function Uf(e,t,a,s,o){if(e===null){var u=a.type;return typeof u=="function"&&!vc(u)&&u.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=u,zf(e,t,u,s,o)):(e=Ol(a.type,null,s,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!fu(e,o)){var f=u.memoizedProps;if(a=a.compare,a=a!==null?a:ns,a(f,s)&&e.ref===t.ref)return la(e,t,o)}return t.flags|=1,e=ta(u,s),e.ref=t.ref,e.return=t,t.child=e}function zf(e,t,a,s,o){if(e!==null){var u=e.memoizedProps;if(ns(u,s)&&e.ref===t.ref)if(ft=!1,t.pendingProps=s=u,fu(e,o))(e.flags&131072)!==0&&(ft=!0);else return t.lanes=e.lanes,la(e,t,o)}return su(e,t,a,s,o)}function Bf(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 Hf(e,t,u,a,s)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ll(t,u!==null?u.cachePool:null),u!==null?qh(t,u):Uc(),$h(t);else return s=t.lanes=536870912,Hf(e,t,u!==null?u.baseLanes|a:a,a,s)}else u!==null?(Ll(t,u.cachePool),qh(t,u),Ba(),t.memoizedState=null):(e!==null&&Ll(t,null),Uc(),Ba());return Et(e,t,o,a),t.child}function ys(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Hf(e,t,a,s,o){var u=Rc();return u=u===null?null:{parent:dt._currentValue,pool:u},t.memoizedState={baseLanes:a,cachePool:u},e!==null&&Ll(t,null),Uc(),$h(t),e!==null&&Qi(e,t,s,!0),t.childLanes=o,null}function Wl(e,t){return t=Ql({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function qf(e,t,a){return vi(t,e.child,null,a),e=Wl(t,t.pendingProps),e.flags|=2,en(t),t.memoizedState=null,e}function ov(e,t,a){var s=t.pendingProps,o=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ae){if(s.mode==="hidden")return e=Wl(t,s),t.lanes=536870912,ys(null,e);if(Bc(t),(e=Ve)?(e=Zm(e,fn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ra!==null?{id:qn,overflow:$n}:null,retryLane:536870912,hydrationErrors:null},a=_h(e),a.return=t,t.child=a,Tt=t,Ve=null)):e=null,e===null)throw Na(t);return t.lanes=536870912,null}return Wl(t,s)}var u=e.memoizedState;if(u!==null){var f=u.dehydrated;if(Bc(t),o)if(t.flags&256)t.flags&=-257,t=qf(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(l(558));else if(ft||Qi(e,t,a,!1),o=(a&e.childLanes)!==0,ft||o){if(s=Pe,s!==null&&(f=Gr(s,a),f!==0&&f!==u.retryLane))throw u.retryLane=f,ui(e,f),Pt(s,e,f),ru;so(),t=qf(e,t,a)}else e=u.treeContext,Ve=gn(f.nextSibling),Tt=t,Ae=!0,ja=null,fn=!1,e!==null&&Eh(t,e),t=Wl(t,s),t.flags|=4096;return t}return e=ta(e.child,{mode:s.mode,children:s.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Xl(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 su(e,t,a,s,o){return mi(t),a=qc(e,t,a,s,void 0,o),s=$c(),e!==null&&!ft?(Pc(e,t,o),la(e,t,o)):(Ae&&s&&wc(t),t.flags|=1,Et(e,t,a,o),t.child)}function $f(e,t,a,s,o,u){return mi(t),t.updateQueue=null,a=Ih(t,s,a,o),Ph(e),s=$c(),e!==null&&!ft?(Pc(e,t,u),la(e,t,u)):(Ae&&s&&wc(t),t.flags|=1,Et(e,t,a,u),t.child)}function Pf(e,t,a,s,o){if(mi(t),t.stateNode===null){var u=Yi,f=a.contextType;typeof f=="object"&&f!==null&&(u=kt(f)),u=new a(s,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=au,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=s,u.state=t.memoizedState,u.refs={},Nc(t),f=a.contextType,u.context=typeof f=="object"&&f!==null?kt(f):Yi,u.state=t.memoizedState,f=a.getDerivedStateFromProps,typeof f=="function"&&(nu(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&&au.enqueueReplaceState(u,u.state,null),hs(t,s,u,o),ds(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!0}else if(e===null){u=t.stateNode;var v=t.memoizedProps,_=Si(a,v);u.props=_;var j=u.context,U=a.contextType;f=Yi,typeof U=="object"&&U!==null&&(f=kt(U));var q=a.getDerivedStateFromProps;U=typeof q=="function"||typeof u.getSnapshotBeforeUpdate=="function",v=t.pendingProps!==v,U||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(v||j!==f)&&Cf(t,u,s,f),Da=!1;var N=t.memoizedState;u.state=N,hs(t,s,u,o),ds(),j=t.memoizedState,v||N!==j||Da?(typeof q=="function"&&(nu(t,a,q,s),j=t.memoizedState),(_=Da||xf(t,a,_,s,N,j,f))?(U||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=j),u.props=s,u.state=j,u.context=f,s=_):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{u=t.stateNode,Lc(e,t),f=t.memoizedProps,U=Si(a,f),u.props=U,q=t.pendingProps,N=u.context,j=a.contextType,_=Yi,typeof j=="object"&&j!==null&&(_=kt(j)),v=a.getDerivedStateFromProps,(j=typeof v=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(f!==q||N!==_)&&Cf(t,u,s,_),Da=!1,N=t.memoizedState,u.state=N,hs(t,s,u,o),ds();var L=t.memoizedState;f!==q||N!==L||Da||e!==null&&e.dependencies!==null&&jl(e.dependencies)?(typeof v=="function"&&(nu(t,a,v,s),L=t.memoizedState),(U=Da||xf(t,a,U,s,N,L,_)||e!==null&&e.dependencies!==null&&jl(e.dependencies))?(j||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&&N===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&N===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=L),u.props=s,u.state=L,u.context=_,s=U):(typeof u.componentDidUpdate!="function"||f===e.memoizedProps&&N===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||f===e.memoizedProps&&N===e.memoizedState||(t.flags|=1024),s=!1)}return u=s,Xl(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=vi(t,e.child,null,o),t.child=vi(t,null,a,o)):Et(e,t,a,o),t.memoizedState=u.state,e=t.child):e=la(e,t,o),e}function If(e,t,a,s){return hi(),t.flags|=256,Et(e,t,a,s),t.child}var lu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ou(e){return{baseLanes:e,cachePool:jh()}}function cu(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=nn),e}function Gf(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:(lt.current&2)!==0),f&&(o=!0,t.flags&=-129),f=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ae){if(o?za(t):Ba(),(e=Ve)?(e=Zm(e,fn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ra!==null?{id:qn,overflow:$n}:null,retryLane:536870912,hydrationErrors:null},a=_h(e),a.return=t,t.child=a,Tt=t,Ve=null)):e=null,e===null)throw Na(t);return Vu(e)?t.lanes=32:t.lanes=536870912,null}var v=s.children;return s=s.fallback,o?(Ba(),o=t.mode,v=Ql({mode:"hidden",children:v},o),s=di(s,o,a,null),v.return=t,s.return=t,v.sibling=s,t.child=v,s=t.child,s.memoizedState=ou(a),s.childLanes=cu(e,f,a),t.memoizedState=lu,ys(null,s)):(za(t),uu(t,v))}var _=e.memoizedState;if(_!==null&&(v=_.dehydrated,v!==null)){if(u)t.flags&256?(za(t),t.flags&=-257,t=du(e,t,a)):t.memoizedState!==null?(Ba(),t.child=e.child,t.flags|=128,t=null):(Ba(),v=s.fallback,o=t.mode,s=Ql({mode:"visible",children:s.children},o),v=di(v,o,a,null),v.flags|=2,s.return=t,v.return=t,s.sibling=v,t.child=s,vi(t,e.child,null,a),s=t.child,s.memoizedState=ou(a),s.childLanes=cu(e,f,a),t.memoizedState=lu,t=ys(null,s));else if(za(t),Vu(v)){if(f=v.nextSibling&&v.nextSibling.dataset,f)var j=f.dgst;f=j,s=Error(l(419)),s.stack="",s.digest=f,rs({value:s,source:null,stack:null}),t=du(e,t,a)}else if(ft||Qi(e,t,a,!1),f=(a&e.childLanes)!==0,ft||f){if(f=Pe,f!==null&&(s=Gr(f,a),s!==0&&s!==_.retryLane))throw _.retryLane=s,ui(e,s),Pt(f,e,s),ru;Gu(v)||so(),t=du(e,t,a)}else Gu(v)?(t.flags|=192,t.child=e.child,t=null):(e=_.treeContext,Ve=gn(v.nextSibling),Tt=t,Ae=!0,ja=null,fn=!1,e!==null&&Eh(t,e),t=uu(t,s.children),t.flags|=4096);return t}return o?(Ba(),v=s.fallback,o=t.mode,_=e.child,j=_.sibling,s=ta(_,{mode:"hidden",children:s.children}),s.subtreeFlags=_.subtreeFlags&65011712,j!==null?v=ta(j,v):(v=di(v,o,a,null),v.flags|=2),v.return=t,s.return=t,s.sibling=v,t.child=s,ys(null,s),s=t.child,v=e.child.memoizedState,v===null?v=ou(a):(o=v.cachePool,o!==null?(_=dt._currentValue,o=o.parent!==_?{parent:_,pool:_}:o):o=jh(),v={baseLanes:v.baseLanes|a,cachePool:o}),s.memoizedState=v,s.childLanes=cu(e,f,a),t.memoizedState=lu,ys(e.child,s)):(za(t),a=e.child,e=a.sibling,a=ta(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 uu(e,t){return t=Ql({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Ql(e,t){return e=Zt(22,e,null,t),e.lanes=0,e}function du(e,t,a){return vi(t,e.child,null,a),e=uu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Vf(e,t,a){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),Ac(e.return,t,a)}function hu(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 Kf(e,t,a){var s=t.pendingProps,o=s.revealOrder,u=s.tail;s=s.children;var f=lt.current,v=(f&2)!==0;if(v?(f=f&1|2,t.flags|=128):f&=1,W(lt,f),Et(e,t,s,a),s=Ae?is:0,!v&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Vf(e,a,t);else if(e.tag===19)Vf(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&&Hl(e)===null&&(o=a),a=a.sibling;a=o,a===null?(o=t.child,t.child=null):(o=a.sibling,a.sibling=null),hu(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&&Hl(e)===null){t.child=o;break}e=o.sibling,o.sibling=a,a=o,o=e}hu(t,!0,a,null,u,s);break;case"together":hu(t,!1,null,null,void 0,s);break;default:t.memoizedState=null}return t.child}function la(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),$a|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(Qi(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=ta(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=ta(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function fu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&jl(e)))}function cv(e,t,a){switch(t.tag){case 3:Xe(t,t.stateNode.containerInfo),La(t,dt,e.memoizedState.cache),hi();break;case 27:case 5:Rn(t);break;case 4:Xe(t,t.stateNode.containerInfo);break;case 10:La(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Bc(t),null;break;case 13:var s=t.memoizedState;if(s!==null)return s.dehydrated!==null?(za(t),t.flags|=128,null):(a&t.child.childLanes)!==0?Gf(e,t,a):(za(t),e=la(e,t,a),e!==null?e.sibling:null);za(t);break;case 19:var o=(e.flags&128)!==0;if(s=(a&t.childLanes)!==0,s||(Qi(e,t,a,!1),s=(a&t.childLanes)!==0),o){if(s)return Kf(e,t,a);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),W(lt,lt.current),s)break;return null;case 22:return t.lanes=0,Bf(e,t,a,t.pendingProps);case 24:La(t,dt,e.memoizedState.cache)}return la(e,t,a)}function Yf(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)ft=!0;else{if(!fu(e,a)&&(t.flags&128)===0)return ft=!1,cv(e,t,a);ft=(e.flags&131072)!==0}else ft=!1,Ae&&(t.flags&1048576)!==0&&kh(t,is,t.index);switch(t.lanes=0,t.tag){case 16:e:{var s=t.pendingProps;if(e=pi(t.elementType),t.type=e,typeof e=="function")vc(e)?(s=Si(e,s),t.tag=1,t=Pf(null,t,e,s,a)):(t.tag=0,t=su(null,t,e,s,a));else{if(e!=null){var o=e.$$typeof;if(o===J){t.tag=11,t=Mf(null,t,e,s,a);break e}else if(o===K){t.tag=14,t=Uf(null,t,e,s,a);break e}}throw t=Je(e)||e,Error(l(306,t,""))}}return t;case 0:return su(e,t,t.type,t.pendingProps,a);case 1:return s=t.type,o=Si(s,t.pendingProps),Pf(e,t,s,o,a);case 3:e:{if(Xe(t,t.stateNode.containerInfo),e===null)throw Error(l(387));s=t.pendingProps;var u=t.memoizedState;o=u.element,Lc(e,t),hs(t,s,null,a);var f=t.memoizedState;if(s=f.cache,La(t,dt,s),s!==u.cache&&xc(t,[dt],a,!0),ds(),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=If(e,t,s,a);break e}else if(s!==o){o=un(Error(l(424)),t),rs(o),t=If(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,Ve=gn(e.firstChild),Tt=t,Ae=!0,ja=null,fn=!0,a=zh(t,null,s,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(hi(),s===o){t=la(e,t,a);break e}Et(e,t,s,a)}t=t.child}return t;case 26:return Xl(e,t),e===null?(a=ig(t.type,null,t.pendingProps,null))?t.memoizedState=a:Ae||(a=t.type,e=t.pendingProps,s=mo(ye.current).createElement(a),s[tt]=t,s[_t]=e,At(s,a,e),st(s),t.stateNode=s):t.memoizedState=ig(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Rn(t),e===null&&Ae&&(s=t.stateNode=tg(t.type,t.pendingProps,ye.current),Tt=t,fn=!0,o=Ve,Ka(t.type)?(Ku=o,Ve=gn(s.firstChild)):Ve=o),Et(e,t,t.pendingProps.children,a),Xl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ae&&((o=s=Ve)&&(s=Hv(s,t.type,t.pendingProps,fn),s!==null?(t.stateNode=s,Tt=t,Ve=gn(s.firstChild),fn=!1,o=!0):o=!1),o||Na(t)),Rn(t),o=t.type,u=t.pendingProps,f=e!==null?e.memoizedProps:null,s=u.children,$u(o,u)?s=null:f!==null&&$u(o,f)&&(t.flags|=32),t.memoizedState!==null&&(o=qc(e,t,ev,null,null,a),Ns._currentValue=o),Xl(e,t),Et(e,t,s,a),t.child;case 6:return e===null&&Ae&&((e=a=Ve)&&(a=qv(a,t.pendingProps,fn),a!==null?(t.stateNode=a,Tt=t,Ve=null,e=!0):e=!1),e||Na(t)),null;case 13:return Gf(e,t,a);case 4:return Xe(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=vi(t,null,s,a):Et(e,t,s,a),t.child;case 11:return Mf(e,t,t.type,t.pendingProps,a);case 7:return Et(e,t,t.pendingProps,a),t.child;case 8:return Et(e,t,t.pendingProps.children,a),t.child;case 12:return Et(e,t,t.pendingProps.children,a),t.child;case 10:return s=t.pendingProps,La(t,t.type,s.value),Et(e,t,s.children,a),t.child;case 9:return o=t.type._context,s=t.pendingProps.children,mi(t),o=kt(o),s=s(o),t.flags|=1,Et(e,t,s,a),t.child;case 14:return Uf(e,t,t.type,t.pendingProps,a);case 15:return zf(e,t,t.type,t.pendingProps,a);case 19:return Kf(e,t,a);case 31:return ov(e,t,a);case 22:return Bf(e,t,a,t.pendingProps);case 24:return mi(t),s=kt(dt),e===null?(o=Rc(),o===null&&(o=Pe,u=Cc(),o.pooledCache=u,u.refCount++,u!==null&&(o.pooledCacheLanes|=a),o=u),t.memoizedState={parent:s,cache:o},Nc(t),La(t,dt,o)):((e.lanes&a)!==0&&(Lc(e,t),hs(t,null,null,a),ds()),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),La(t,dt,s)):(s=u.cache,La(t,dt,s),s!==o.cache&&xc(t,[dt],a,!0))),Et(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(l(156,t.tag))}function oa(e){e.flags|=4}function mu(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(Sm())e.flags|=8192;else throw yi=Ml,jc}else e.flags&=-16777217}function Jf(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!cg(t))if(Sm())e.flags|=8192;else throw yi=Ml,jc}function Zl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?ka():536870912,e.lanes|=t,cr|=t)}function vs(e,t){if(!Ae)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 Ke(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 uv(e,t,a){var s=t.pendingProps;switch(_c(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ke(t),null;case 1:return Ke(t),null;case 3:return a=t.stateNode,s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),ia(dt),Qe(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Xi(t)?oa(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,kc())),Ke(t),null;case 26:var o=t.type,u=t.memoizedState;return e===null?(oa(t),u!==null?(Ke(t),Jf(t,u)):(Ke(t),mu(t,o,null,s,a))):u?u!==e.memoizedState?(oa(t),Ke(t),Jf(t,u)):(Ke(t),t.flags&=-16777217):(e=e.memoizedProps,e!==s&&oa(t),Ke(t),mu(t,o,e,s,a)),null;case 27:if(vn(t),a=ye.current,o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&oa(t);else{if(!s){if(t.stateNode===null)throw Error(l(166));return Ke(t),null}e=Q.current,Xi(t)?Ah(t):(e=tg(o,s,a),t.stateNode=e,oa(t))}return Ke(t),null;case 5:if(vn(t),o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==s&&oa(t);else{if(!s){if(t.stateNode===null)throw Error(l(166));return Ke(t),null}if(u=Q.current,Xi(t))Ah(t);else{var f=mo(ye.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[tt]=t,u[_t]=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(At(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&&oa(t)}}return Ke(t),mu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==s&&oa(t);else{if(typeof s!="string"&&t.stateNode===null)throw Error(l(166));if(e=ye.current,Xi(t)){if(e=t.stateNode,a=t.memoizedProps,s=null,o=Tt,o!==null)switch(o.tag){case 27:case 5:s=o.memoizedProps}e[tt]=t,e=!!(e.nodeValue===a||s!==null&&s.suppressHydrationWarning===!0||Gm(e.nodeValue,a)),e||Na(t,!0)}else e=mo(e).createTextNode(s),e[tt]=t,t.stateNode=e}return Ke(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(s=Xi(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[tt]=t}else hi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ke(t),e=!1}else a=kc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(en(t),t):(en(t),null);if((t.flags&128)!==0)throw Error(l(558))}return Ke(t),null;case 13:if(s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=Xi(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[tt]=t}else hi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ke(t),o=!1}else o=kc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(en(t),t):(en(t),null)}return en(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),Zl(t,t.updateQueue),Ke(t),null);case 4:return Qe(),e===null&&Uu(t.stateNode.containerInfo),Ke(t),null;case 10:return ia(t.type),Ke(t),null;case 19:if(M(lt),s=t.memoizedState,s===null)return Ke(t),null;if(o=(t.flags&128)!==0,u=s.rendering,u===null)if(o)vs(s,!1);else{if(it!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=Hl(e),u!==null){for(t.flags|=128,vs(s,!1),e=u.updateQueue,t.updateQueue=e,Zl(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)wh(a,e),a=a.sibling;return W(lt,lt.current&1|2),Ae&&na(t,s.treeForkCount),t.child}e=e.sibling}s.tail!==null&&Ie()>ao&&(t.flags|=128,o=!0,vs(s,!1),t.lanes=4194304)}else{if(!o)if(e=Hl(u),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,Zl(t,e),vs(s,!0),s.tail===null&&s.tailMode==="hidden"&&!u.alternate&&!Ae)return Ke(t),null}else 2*Ie()-s.renderingStartTime>ao&&a!==536870912&&(t.flags|=128,o=!0,vs(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=Ie(),e.sibling=null,a=lt.current,W(lt,o?a&1|2:a&1),Ae&&na(t,s.treeForkCount),e):(Ke(t),null);case 22:case 23:return en(t),zc(),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&&(Ke(t),t.subtreeFlags&6&&(t.flags|=8192)):Ke(t),a=t.updateQueue,a!==null&&Zl(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(gi),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),ia(dt),Ke(t),null;case 25:return null;case 30:return null}throw Error(l(156,t.tag))}function dv(e,t){switch(_c(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ia(dt),Qe(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return vn(t),null;case 31:if(t.memoizedState!==null){if(en(t),t.alternate===null)throw Error(l(340));hi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(en(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(l(340));hi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return M(lt),null;case 4:return Qe(),null;case 10:return ia(t.type),null;case 22:case 23:return en(t),zc(),e!==null&&M(gi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ia(dt),null;case 25:return null;default:return null}}function Wf(e,t){switch(_c(t),t.tag){case 3:ia(dt),Qe();break;case 26:case 27:case 5:vn(t);break;case 4:Qe();break;case 31:t.memoizedState!==null&&en(t);break;case 13:en(t);break;case 19:M(lt);break;case 10:ia(t.type);break;case 22:case 23:en(t),zc(),e!==null&&M(gi);break;case 24:ia(dt)}}function bs(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){Ue(t,t.return,v)}}function Ha(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,j=v;try{j()}catch(U){Ue(o,_,U)}}}s=s.next}while(s!==u)}}catch(U){Ue(t,t.return,U)}}function Xf(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{Hh(t,a)}catch(s){Ue(e,e.return,s)}}}function Qf(e,t,a){a.props=Si(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(s){Ue(e,t,s)}}function Ss(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){Ue(e,t,o)}}function Pn(e,t){var a=e.ref,s=e.refCleanup;if(a!==null)if(typeof s=="function")try{s()}catch(o){Ue(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){Ue(e,t,o)}else a.current=null}function Zf(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){Ue(e,e.return,o)}}function gu(e,t,a){try{var s=e.stateNode;Lv(s,e.type,a,t),s[_t]=t}catch(o){Ue(e,e.return,o)}}function Ff(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ka(e.type)||e.tag===4}function pu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ff(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&&Ka(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 yu(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=ln));else if(s!==4&&(s===27&&Ka(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(yu(e,t,a),e=e.sibling;e!==null;)yu(e,t,a),e=e.sibling}function Fl(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&&Ka(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Fl(e,t,a),e=e.sibling;e!==null;)Fl(e,t,a),e=e.sibling}function em(e){var t=e.stateNode,a=e.memoizedProps;try{for(var s=e.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);At(t,s,a),t[tt]=e,t[_t]=a}catch(u){Ue(e,e.return,u)}}var ca=!1,mt=!1,vu=!1,tm=typeof WeakSet=="function"?WeakSet:Set,St=null;function hv(e,t){if(e=e.containerInfo,Hu=wo,e=hh(e),dc(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,j=0,U=0,q=e,N=null;t:for(;;){for(var L;q!==a||o!==0&&q.nodeType!==3||(v=f+o),q!==u||s!==0&&q.nodeType!==3||(_=f+s),q.nodeType===3&&(f+=q.nodeValue.length),(L=q.firstChild)!==null;)N=q,q=L;for(;;){if(q===e)break t;if(N===a&&++j===o&&(v=f),N===u&&++U===s&&(_=f),(L=q.nextSibling)!==null)break;q=N,N=q.parentNode}q=L}a=v===-1||_===-1?null:{start:v,end:_}}else a=null}a=a||{start:0,end:0}}else a=null;for(qu={focusedElem:e,selectionRange:a},wo=!1,St=t;St!==null;)if(t=St,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,St=e;else for(;St!==null;){switch(t=St,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 ee=Si(a.type,o);e=s.getSnapshotBeforeUpdate(ee,u),s.__reactInternalSnapshotBeforeUpdate=e}catch(de){Ue(a,a.return,de)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)Iu(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Iu(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,St=e;break}St=t.return}}function nm(e,t,a){var s=a.flags;switch(a.tag){case 0:case 11:case 15:da(e,a),s&4&&bs(5,a);break;case 1:if(da(e,a),s&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(f){Ue(a,a.return,f)}else{var o=Si(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(o,t,e.__reactInternalSnapshotBeforeUpdate)}catch(f){Ue(a,a.return,f)}}s&64&&Xf(a),s&512&&Ss(a,a.return);break;case 3:if(da(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{Hh(e,t)}catch(f){Ue(a,a.return,f)}}break;case 27:t===null&&s&4&&em(a);case 26:case 5:da(e,a),t===null&&s&4&&Zf(a),s&512&&Ss(a,a.return);break;case 12:da(e,a);break;case 31:da(e,a),s&4&&rm(e,a);break;case 13:da(e,a),s&4&&sm(e,a),s&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=wv.bind(null,a),$v(e,a))));break;case 22:if(s=a.memoizedState!==null||ca,!s){t=t!==null&&t.memoizedState!==null||mt,o=ca;var u=mt;ca=s,(mt=t)&&!u?ha(e,a,(a.subtreeFlags&8772)!==0):da(e,a),ca=o,mt=u}break;case 30:break;default:da(e,a)}}function am(e){var t=e.alternate;t!==null&&(e.alternate=null,am(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Hi(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 We=null,Bt=!1;function ua(e,t,a){for(a=a.child;a!==null;)im(e,t,a),a=a.sibling}function im(e,t,a){if(yt&&typeof yt.onCommitFiberUnmount=="function")try{yt.onCommitFiberUnmount(_a,a)}catch{}switch(a.tag){case 26:mt||Pn(a,t),ua(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:mt||Pn(a,t);var s=We,o=Bt;Ka(a.type)&&(We=a.stateNode,Bt=!1),ua(e,t,a),Os(a.stateNode),We=s,Bt=o;break;case 5:mt||Pn(a,t);case 6:if(s=We,o=Bt,We=null,ua(e,t,a),We=s,Bt=o,We!==null)if(Bt)try{(We.nodeType===9?We.body:We.nodeName==="HTML"?We.ownerDocument.body:We).removeChild(a.stateNode)}catch(u){Ue(a,t,u)}else try{We.removeChild(a.stateNode)}catch(u){Ue(a,t,u)}break;case 18:We!==null&&(Bt?(e=We,Xm(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),yr(e)):Xm(We,a.stateNode));break;case 4:s=We,o=Bt,We=a.stateNode.containerInfo,Bt=!0,ua(e,t,a),We=s,Bt=o;break;case 0:case 11:case 14:case 15:Ha(2,a,t),mt||Ha(4,a,t),ua(e,t,a);break;case 1:mt||(Pn(a,t),s=a.stateNode,typeof s.componentWillUnmount=="function"&&Qf(a,t,s)),ua(e,t,a);break;case 21:ua(e,t,a);break;case 22:mt=(s=mt)||a.memoizedState!==null,ua(e,t,a),mt=s;break;default:ua(e,t,a)}}function rm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{yr(e)}catch(a){Ue(t,t.return,a)}}}function sm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{yr(e)}catch(a){Ue(t,t.return,a)}}function fv(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new tm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new tm),t;default:throw Error(l(435,e.tag))}}function eo(e,t){var a=fv(e);t.forEach(function(s){if(!a.has(s)){a.add(s);var o=_v.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(Ka(v.type)){We=v.stateNode,Bt=!1;break e}break;case 5:We=v.stateNode,Bt=!1;break e;case 3:case 4:We=v.stateNode.containerInfo,Bt=!0;break e}v=v.return}if(We===null)throw Error(l(160));im(u,f,o),We=null,Bt=!1,u=o.alternate,u!==null&&(u.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)lm(t,e),t=t.sibling}var Tn=null;function lm(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&&(Ha(3,e,e.return),bs(3,e),Ha(5,e,e.return));break;case 1:Ht(t,e),qt(e),s&512&&(mt||a===null||Pn(a,a.return)),s&64&&ca&&(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=Tn;if(Ht(t,e),qt(e),s&512&&(mt||a===null||Pn(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[Xt]||u[tt]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=o.createElement(s),o.head.insertBefore(u,o.querySelector("head > title"))),At(u,s,a),u[tt]=e,st(u),s=u;break e;case"link":var f=lg("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),At(u,s,a),o.head.appendChild(u);break;case"meta":if(f=lg("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),At(u,s,a),o.head.appendChild(u);break;default:throw Error(l(468,s))}u[tt]=e,st(u),s=u}e.stateNode=s}else og(o,e.type,e.stateNode);else e.stateNode=sg(o,s,e.memoizedProps);else u!==s?(u===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):u.count--,s===null?og(o,e.type,e.stateNode):sg(o,s,e.memoizedProps)):s===null&&e.stateNode!==null&&gu(e,e.memoizedProps,a.memoizedProps)}break;case 27:Ht(t,e),qt(e),s&512&&(mt||a===null||Pn(a,a.return)),a!==null&&s&4&&gu(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Ht(t,e),qt(e),s&512&&(mt||a===null||Pn(a,a.return)),e.flags&32){o=e.stateNode;try{Bn(o,"")}catch(ee){Ue(e,e.return,ee)}}s&4&&e.stateNode!=null&&(o=e.memoizedProps,gu(e,o,a!==null?a.memoizedProps:o)),s&1024&&(vu=!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(ee){Ue(e,e.return,ee)}}break;case 3:if(yo=null,o=Tn,Tn=go(t.containerInfo),Ht(t,e),Tn=o,qt(e),s&4&&a!==null&&a.memoizedState.isDehydrated)try{yr(t.containerInfo)}catch(ee){Ue(e,e.return,ee)}vu&&(vu=!1,om(e));break;case 4:s=Tn,Tn=go(e.stateNode.containerInfo),Ht(t,e),qt(e),Tn=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,eo(e,s)));break;case 13:Ht(t,e),qt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(no=Ie()),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,eo(e,s)));break;case 22:o=e.memoizedState!==null;var _=a!==null&&a.memoizedState!==null,j=ca,U=mt;if(ca=j||o,mt=U||_,Ht(t,e),mt=U,ca=j,qt(e),s&8192)e:for(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,o&&(a===null||_||ca||mt||wi(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 q=_.memoizedProps.style,N=q!=null&&q.hasOwnProperty("display")?q.display:null;v.style.display=N==null||typeof N=="boolean"?"":(""+N).trim()}}catch(ee){Ue(_,_.return,ee)}}}else if(t.tag===6){if(a===null){_=t;try{_.stateNode.nodeValue=o?"":_.memoizedProps}catch(ee){Ue(_,_.return,ee)}}}else if(t.tag===18){if(a===null){_=t;try{var L=_.stateNode;o?Qm(L,!0):Qm(_.stateNode,!1)}catch(ee){Ue(_,_.return,ee)}}}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,eo(e,a))));break;case 19:Ht(t,e),qt(e),s&4&&(s=e.updateQueue,s!==null&&(e.updateQueue=null,eo(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(Ff(s)){a=s;break}s=s.return}if(a==null)throw Error(l(160));switch(a.tag){case 27:var o=a.stateNode,u=pu(e);Fl(e,u,o);break;case 5:var f=a.stateNode;a.flags&32&&(Bn(f,""),a.flags&=-33);var v=pu(e);Fl(e,v,f);break;case 3:case 4:var _=a.stateNode.containerInfo,j=pu(e);yu(e,j,_);break;default:throw Error(l(161))}}catch(U){Ue(e,e.return,U)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function om(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;om(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function da(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)nm(e,t.alternate,t),t=t.sibling}function wi(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ha(4,t,t.return),wi(t);break;case 1:Pn(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&Qf(t,t.return,a),wi(t);break;case 27:Os(t.stateNode);case 26:case 5:Pn(t,t.return),wi(t);break;case 22:t.memoizedState===null&&wi(t);break;case 30:wi(t);break;default:wi(t)}e=e.sibling}}function ha(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:ha(o,u,a),bs(4,u);break;case 1:if(ha(o,u,a),s=u,o=s.stateNode,typeof o.componentDidMount=="function")try{o.componentDidMount()}catch(j){Ue(s,s.return,j)}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++)Bh(_[o],v)}catch(j){Ue(s,s.return,j)}}a&&f&64&&Xf(u),Ss(u,u.return);break;case 27:em(u);case 26:case 5:ha(o,u,a),a&&s===null&&f&4&&Zf(u),Ss(u,u.return);break;case 12:ha(o,u,a);break;case 31:ha(o,u,a),a&&f&4&&rm(o,u);break;case 13:ha(o,u,a),a&&f&4&&sm(o,u);break;case 22:u.memoizedState===null&&ha(o,u,a),Ss(u,u.return);break;case 30:break;default:ha(o,u,a)}t=t.sibling}}function bu(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&&ss(a))}function Su(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ss(e))}function kn(e,t,a,s){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)cm(e,t,a,s),t=t.sibling}function cm(e,t,a,s){var o=t.flags;switch(t.tag){case 0:case 11:case 15:kn(e,t,a,s),o&2048&&bs(9,t);break;case 1:kn(e,t,a,s);break;case 3:kn(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&&ss(e)));break;case 12:if(o&2048){kn(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(_){Ue(t,t.return,_)}}else kn(e,t,a,s);break;case 31:kn(e,t,a,s);break;case 13:kn(e,t,a,s);break;case 23:break;case 22:u=t.stateNode,f=t.alternate,t.memoizedState!==null?u._visibility&2?kn(e,t,a,s):ws(e,t):u._visibility&2?kn(e,t,a,s):(u._visibility|=2,sr(e,t,a,s,(t.subtreeFlags&10256)!==0||!1)),o&2048&&bu(f,t);break;case 24:kn(e,t,a,s),o&2048&&Su(t.alternate,t);break;default:kn(e,t,a,s)}}function sr(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,j=f.flags;switch(f.tag){case 0:case 11:case 15:sr(u,f,v,_,o),bs(8,f);break;case 23:break;case 22:var U=f.stateNode;f.memoizedState!==null?U._visibility&2?sr(u,f,v,_,o):ws(u,f):(U._visibility|=2,sr(u,f,v,_,o)),o&&j&2048&&bu(f.alternate,f);break;case 24:sr(u,f,v,_,o),o&&j&2048&&Su(f.alternate,f);break;default:sr(u,f,v,_,o)}t=t.sibling}}function ws(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:ws(a,s),o&2048&&bu(s.alternate,s);break;case 24:ws(a,s),o&2048&&Su(s.alternate,s);break;default:ws(a,s)}t=t.sibling}}var _s=8192;function lr(e,t,a){if(e.subtreeFlags&_s)for(e=e.child;e!==null;)um(e,t,a),e=e.sibling}function um(e,t,a){switch(e.tag){case 26:lr(e,t,a),e.flags&_s&&e.memoizedState!==null&&Fv(a,Tn,e.memoizedState,e.memoizedProps);break;case 5:lr(e,t,a);break;case 3:case 4:var s=Tn;Tn=go(e.stateNode.containerInfo),lr(e,t,a),Tn=s;break;case 22:e.memoizedState===null&&(s=e.alternate,s!==null&&s.memoizedState!==null?(s=_s,_s=16777216,lr(e,t,a),_s=s):lr(e,t,a));break;default:lr(e,t,a)}}function dm(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 Ts(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];St=s,fm(s,e)}dm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)hm(e),e=e.sibling}function hm(e){switch(e.tag){case 0:case 11:case 15:Ts(e),e.flags&2048&&Ha(9,e,e.return);break;case 3:Ts(e);break;case 12:Ts(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,to(e)):Ts(e);break;default:Ts(e)}}function to(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];St=s,fm(s,e)}dm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ha(8,t,t.return),to(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,to(t));break;default:to(t)}e=e.sibling}}function fm(e,t){for(;St!==null;){var a=St;switch(a.tag){case 0:case 11:case 15:Ha(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:ss(a.memoizedState.cache)}if(s=a.child,s!==null)s.return=a,St=s;else e:for(a=e;St!==null;){s=St;var o=s.sibling,u=s.return;if(am(s),s===a){St=null;break e}if(o!==null){o.return=u,St=o;break e}St=u}}}var mv={getCacheForType:function(e){var t=kt(dt),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return kt(dt).controller.signal}},gv=typeof WeakMap=="function"?WeakMap:Map,Le=0,Pe=null,we=null,Te=0,Me=0,tn=null,qa=!1,or=!1,wu=!1,fa=0,it=0,$a=0,_i=0,_u=0,nn=0,cr=0,ks=null,$t=null,Tu=!1,no=0,mm=0,ao=1/0,io=null,Pa=null,pt=0,Ia=null,ur=null,ma=0,ku=0,Eu=null,gm=null,Es=0,Au=null;function an(){return(Le&2)!==0&&Te!==0?Te&-Te:D.T!==null?Nu():zi()}function pm(){if(nn===0)if((Te&536870912)===0||Ae){var e=De;De<<=1,(De&3932160)===0&&(De=262144),nn=e}else nn=536870912;return e=Ft.current,e!==null&&(e.flags|=32),nn}function Pt(e,t,a){(e===Pe&&(Me===2||Me===9)||e.cancelPendingCommit!==null)&&(dr(e,0),Ga(e,Te,nn,!1)),re(e,a),((Le&2)===0||e!==Pe)&&(e===Pe&&((Le&2)===0&&(_i|=a),it===4&&Ga(e,Te,nn,!1)),In(e))}function ym(e,t,a){if((Le&6)!==0)throw Error(l(327));var s=!a&&(t&127)===0&&(t&e.expiredLanes)===0||Ta(e,t),o=s?vv(e,t):Cu(e,t,!0),u=s;do{if(o===0){or&&!s&&Ga(e,t,0,!1);break}else{if(a=e.current.alternate,u&&!pv(a)){o=Cu(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=ks;var _=v.current.memoizedState.isDehydrated;if(_&&(dr(v,f).flags|=256),f=Cu(v,f,!1),f!==2){if(wu&&!_){v.errorRecoveryDisabledLanes|=u,_i|=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){dr(e,0),Ga(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:Ga(s,t,nn,!qa);break e;case 2:$t=null;break;case 3:case 5:break;default:throw Error(l(329))}if((t&62914560)===t&&(o=no+300-Ie(),10<o)){if(Ga(s,t,nn,!qa),Xn(s,0,!0)!==0)break e;ma=t,s.timeoutHandle=Jm(vm.bind(null,s,a,$t,io,Tu,t,nn,_i,cr,qa,u,"Throttled",-0,0),o);break e}vm(s,a,$t,io,Tu,t,nn,_i,cr,qa,u,null,-0,0)}}break}while(!0);In(e)}function vm(e,t,a,s,o,u,f,v,_,j,U,q,N,L){if(e.timeoutHandle=-1,q=t.subtreeFlags,q&8192||(q&16785408)===16785408){q={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ln},um(t,u,q);var ee=(u&62914560)===u?no-Ie():(u&4194048)===u?mm-Ie():0;if(ee=e0(q,ee),ee!==null){ma=u,e.cancelPendingCommit=ee(Am.bind(null,e,t,u,a,s,o,f,v,_,U,q,null,N,L)),Ga(e,u,f,!j);return}}Am(e,t,u,a,s,o,f,v,_)}function pv(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(!Qt(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 Ga(e,t,a,s){t&=~_u,t&=~_i,e.suspendedLanes|=t,e.pingedLanes&=~t,s&&(e.warmLanes|=t),s=e.expirationTimes;for(var o=t;0<o;){var u=31-Ct(o),f=1<<u;s[u]=-1,o&=~f}a!==0&&ml(e,a,t)}function ro(){return(Le&6)===0?(As(0),!1):!0}function xu(){if(we!==null){if(Me===0)var e=we.return;else e=we,aa=fi=null,Ic(e),tr=null,os=0,e=we;for(;e!==null;)Wf(e.alternate,e),e=e.return;we=null}}function dr(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,Uv(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),ma=0,xu(),Pe=e,we=a=ta(e.current,null),Te=t,Me=0,tn=null,qa=!1,or=Ta(e,t),wu=!1,cr=nn=_u=_i=$a=it=0,$t=ks=null,Tu=!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-Ct(s),u=1<<o;t|=e[o],s&=~u}return fa=t,Al(),a}function bm(e,t){ve=null,D.H=ps,t===er||t===Dl?(t=Dh(),Me=3):t===jc?(t=Dh(),Me=4):Me=t===ru?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,tn=t,we===null&&(it=1,Jl(e,un(t,e.current)))}function Sm(){var e=Ft.current;return e===null?!0:(Te&4194048)===Te?mn===null:(Te&62914560)===Te||(Te&536870912)!==0?e===mn:!1}function wm(){var e=D.H;return D.H=ps,e===null?ps:e}function _m(){var e=D.A;return D.A=mv,e}function so(){it=4,qa||(Te&4194048)!==Te&&Ft.current!==null||(or=!0),($a&134217727)===0&&(_i&134217727)===0||Pe===null||Ga(Pe,Te,nn,!1)}function Cu(e,t,a){var s=Le;Le|=2;var o=wm(),u=_m();(Pe!==e||Te!==t)&&(io=null,dr(e,t)),t=!1;var f=it;e:do try{if(Me!==0&&we!==null){var v=we,_=tn;switch(Me){case 8:xu(),f=6;break e;case 3:case 2:case 9:case 6:Ft.current===null&&(t=!0);var j=Me;if(Me=0,tn=null,hr(e,v,_,j),a&&or){f=0;break e}break;default:j=Me,Me=0,tn=null,hr(e,v,_,j)}}yv(),f=it;break}catch(U){bm(e,U)}while(!0);return t&&e.shellSuspendCounter++,aa=fi=null,Le=s,D.H=o,D.A=u,we===null&&(Pe=null,Te=0,Al()),f}function yv(){for(;we!==null;)Tm(we)}function vv(e,t){var a=Le;Le|=2;var s=wm(),o=_m();Pe!==e||Te!==t?(io=null,ao=Ie()+500,dr(e,t)):or=Ta(e,t);e:do try{if(Me!==0&&we!==null){t=we;var u=tn;t:switch(Me){case 1:Me=0,tn=null,hr(e,t,u,1);break;case 2:case 9:if(Nh(u)){Me=0,tn=null,km(t);break}t=function(){Me!==2&&Me!==9||Pe!==e||(Me=7),In(e)},u.then(t,t);break e;case 3:Me=7;break e;case 4:Me=5;break e;case 7:Nh(u)?(Me=0,tn=null,km(t)):(Me=0,tn=null,hr(e,t,u,7));break;case 5:var f=null;switch(we.tag){case 26:f=we.memoizedState;case 5:case 27:var v=we;if(f?cg(f):v.stateNode.complete){Me=0,tn=null;var _=v.sibling;if(_!==null)we=_;else{var j=v.return;j!==null?(we=j,lo(j)):we=null}break t}}Me=0,tn=null,hr(e,t,u,5);break;case 6:Me=0,tn=null,hr(e,t,u,6);break;case 8:xu(),it=6;break e;default:throw Error(l(462))}}bv();break}catch(U){bm(e,U)}while(!0);return aa=fi=null,D.H=s,D.A=o,Le=a,we!==null?0:(Pe=null,Te=0,Al(),it)}function bv(){for(;we!==null&&!Br();)Tm(we)}function Tm(e){var t=Yf(e.alternate,e,fa);e.memoizedProps=e.pendingProps,t===null?lo(e):we=t}function km(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=$f(a,t,t.pendingProps,t.type,void 0,Te);break;case 11:t=$f(a,t,t.pendingProps,t.type.render,t.ref,Te);break;case 5:Ic(t);default:Wf(a,t),t=we=wh(t,fa),t=Yf(a,t,fa)}e.memoizedProps=e.pendingProps,t===null?lo(e):we=t}function hr(e,t,a,s){aa=fi=null,Ic(t),tr=null,os=0;var o=t.return;try{if(lv(e,o,t,a,Te)){it=1,Jl(e,un(a,e.current)),we=null;return}}catch(u){if(o!==null)throw we=o,u;it=1,Jl(e,un(a,e.current)),we=null;return}t.flags&32768?(Ae||s===1?e=!0:or||(Te&536870912)!==0?e=!1:(qa=e=!0,(s===2||s===9||s===3||s===6)&&(s=Ft.current,s!==null&&s.tag===13&&(s.flags|=16384))),Em(t,e)):lo(t)}function lo(e){var t=e;do{if((t.flags&32768)!==0){Em(t,qa);return}e=t.return;var a=uv(t.alternate,t,fa);if(a!==null){we=a;return}if(t=t.sibling,t!==null){we=t;return}we=t=e}while(t!==null);it===0&&(it=5)}function Em(e,t){do{var a=dv(e.alternate,e);if(a!==null){a.flags&=32767,we=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){we=e;return}we=e=a}while(e!==null);it=6,we=null}function Am(e,t,a,s,o,u,f,v,_){e.cancelPendingCommit=null;do oo();while(pt!==0);if((Le&6)!==0)throw Error(l(327));if(t!==null){if(t===e.current)throw Error(l(177));if(u=t.lanes|t.childLanes,u|=pc,sn(e,a,u,f,v,_),e===Pe&&(we=Pe=null,Te=0),ur=t,Ia=e,ma=a,ku=u,Eu=o,gm=s,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Tv(Di,function(){return jm(),null})):(e.callbackNode=null,e.callbackPriority=0),s=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||s){s=D.T,D.T=null,o=V.p,V.p=2,f=Le,Le|=4;try{hv(e,t,a)}finally{Le=f,V.p=o,D.T=s}}pt=1,xm(),Cm(),Om()}}function xm(){if(pt===1){pt=0;var e=Ia,t=ur,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=D.T,D.T=null;var s=V.p;V.p=2;var o=Le;Le|=4;try{lm(t,e);var u=qu,f=hh(e.containerInfo),v=u.focusedElem,_=u.selectionRange;if(f!==v&&v&&v.ownerDocument&&dh(v.ownerDocument.documentElement,v)){if(_!==null&&dc(v)){var j=_.start,U=_.end;if(U===void 0&&(U=j),"selectionStart"in v)v.selectionStart=j,v.selectionEnd=Math.min(U,v.value.length);else{var q=v.ownerDocument||document,N=q&&q.defaultView||window;if(N.getSelection){var L=N.getSelection(),ee=v.textContent.length,de=Math.min(_.start,ee),qe=_.end===void 0?de:Math.min(_.end,ee);!L.extend&&de>qe&&(f=qe,qe=de,de=f);var x=uh(v,de),k=uh(v,qe);if(x&&k&&(L.rangeCount!==1||L.anchorNode!==x.node||L.anchorOffset!==x.offset||L.focusNode!==k.node||L.focusOffset!==k.offset)){var R=q.createRange();R.setStart(x.node,x.offset),L.removeAllRanges(),de>qe?(L.addRange(R),L.extend(k.node,k.offset)):(R.setEnd(k.node,k.offset),L.addRange(R))}}}}for(q=[],L=v;L=L.parentNode;)L.nodeType===1&&q.push({element:L,left:L.scrollLeft,top:L.scrollTop});for(typeof v.focus=="function"&&v.focus(),v=0;v<q.length;v++){var B=q[v];B.element.scrollLeft=B.left,B.element.scrollTop=B.top}}wo=!!Hu,qu=Hu=null}finally{Le=o,V.p=s,D.T=a}}e.current=t,pt=2}}function Cm(){if(pt===2){pt=0;var e=Ia,t=ur,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=D.T,D.T=null;var s=V.p;V.p=2;var o=Le;Le|=4;try{nm(e,t.alternate,t)}finally{Le=o,V.p=s,D.T=a}}pt=3}}function Om(){if(pt===4||pt===3){pt=0,Li();var e=Ia,t=ur,a=ma,s=gm;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?pt=5:(pt=0,ur=Ia=null,Rm(e,e.pendingLanes));var o=e.pendingLanes;if(o===0&&(Pa=null),Ln(a),t=t.stateNode,yt&&typeof yt.onCommitFiberRoot=="function")try{yt.onCommitFiberRoot(_a,t,void 0,(t.current.flags&128)===128)}catch{}if(s!==null){t=D.T,o=V.p,V.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,V.p=o}}(ma&3)!==0&&oo(),In(e),o=e.pendingLanes,(a&261930)!==0&&(o&42)!==0?e===Au?Es++:(Es=0,Au=e):Es=0,As(0)}}function Rm(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ss(t)))}function oo(){return xm(),Cm(),Om(),jm()}function jm(){if(pt!==5)return!1;var e=Ia,t=ku;ku=0;var a=Ln(ma),s=D.T,o=V.p;try{V.p=32>a?32:a,D.T=null,a=Eu,Eu=null;var u=Ia,f=ma;if(pt=0,ur=Ia=null,ma=0,(Le&6)!==0)throw Error(l(331));var v=Le;if(Le|=4,hm(u.current),cm(u,u.current,f,a),Le=v,As(0,!1),yt&&typeof yt.onPostCommitFiberRoot=="function")try{yt.onPostCommitFiberRoot(_a,u)}catch{}return!0}finally{V.p=o,D.T=s,Rm(e,t)}}function Nm(e,t,a){t=un(a,t),t=iu(e.stateNode,t,2),e=Ua(e,t,2),e!==null&&(re(e,2),In(e))}function Ue(e,t,a){if(e.tag===3)Nm(e,e,a);else for(;t!==null;){if(t.tag===3){Nm(t,e,a);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Pa===null||!Pa.has(s))){e=un(a,e),a=Lf(2),s=Ua(t,a,2),s!==null&&(Df(a,s,t,e),re(s,2),In(s));break}}t=t.return}}function Ou(e,t,a){var s=e.pingCache;if(s===null){s=e.pingCache=new gv;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)||(wu=!0,o.add(a),e=Sv.bind(null,e,t,a),t.then(e,e))}function Sv(e,t,a){var s=e.pingCache;s!==null&&s.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Pe===e&&(Te&a)===a&&(it===4||it===3&&(Te&62914560)===Te&&300>Ie()-no?(Le&2)===0&&dr(e,0):_u|=a,cr===Te&&(cr=0)),In(e)}function Lm(e,t){t===0&&(t=ka()),e=ui(e,t),e!==null&&(re(e,t),In(e))}function wv(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),Lm(e,a)}function _v(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),Lm(e,a)}function Tv(e,t){return Wn(e,t)}var co=null,fr=null,Ru=!1,uo=!1,ju=!1,Va=0;function In(e){e!==fr&&e.next===null&&(fr===null?co=fr=e:fr=fr.next=e),uo=!0,Ru||(Ru=!0,Ev())}function As(e,t){if(!ju&&uo){ju=!0;do for(var a=!1,s=co;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-Ct(42|e)+1)-1,u&=o&~(f&~v),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(a=!0,zm(s,u))}else u=Te,u=Xn(s,s===Pe?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),(u&3)===0||Ta(s,u)||(a=!0,zm(s,u));s=s.next}while(a);ju=!1}}function kv(){Dm()}function Dm(){uo=Ru=!1;var e=0;Va!==0&&Mv()&&(e=Va);for(var t=Ie(),a=null,s=co;s!==null;){var o=s.next,u=Mm(s,t);u===0?(s.next=null,a===null?co=o:a.next=o,o===null&&(fr=a)):(a=s,(e!==0||(u&3)!==0)&&(uo=!0)),s=o}pt!==0&&pt!==5||As(e),Va!==0&&(Va=0)}function Mm(e,t){for(var a=e.suspendedLanes,s=e.pingedLanes,o=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var f=31-Ct(u),v=1<<f,_=o[f];_===-1?((v&a)===0||(v&s)!==0)&&(o[f]=Ir(v,t)):_<=t&&(e.expiredLanes|=v),u&=~v}if(t=Pe,a=Te,a=Xn(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s=e.callbackNode,a===0||e===t&&(Me===2||Me===9)||e.cancelPendingCommit!==null)return s!==null&&s!==null&&Ni(s),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Ta(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(s!==null&&Ni(s),Ln(a)){case 2:case 8:a=jn;break;case 32:a=Di;break;case 268435456:a=$r;break;default:a=Di}return s=Um.bind(null,e),a=Wn(a,s),e.callbackPriority=t,e.callbackNode=a,t}return s!==null&&s!==null&&Ni(s),e.callbackPriority=2,e.callbackNode=null,2}function Um(e,t){if(pt!==0&&pt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(oo()&&e.callbackNode!==a)return null;var s=Te;return s=Xn(e,e===Pe?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),s===0?null:(ym(e,s,t),Mm(e,Ie()),e.callbackNode!=null&&e.callbackNode===a?Um.bind(null,e):null)}function zm(e,t){if(oo())return null;ym(e,t,!0)}function Ev(){zv(function(){(Le&6)!==0?Wn(ei,kv):Dm()})}function Nu(){if(Va===0){var e=Zi;e===0&&(e=Jt,Jt<<=1,(Jt&261888)===0&&(Jt=256)),Va=e}return Va}function Bm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Hn(""+e)}function Hm(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 Av(e,t,a,s,o){if(t==="submit"&&a&&a.stateNode===o){var u=Bm((o[_t]||null).action),f=s.submitter;f&&(t=(t=f[_t]||null)?Bm(t.formAction):f.getAttribute("formAction"),t!==null&&(u=t,f=null));var v=new li("action","action",null,s,o);e.push({event:v,listeners:[{instance:null,listener:function(){if(s.defaultPrevented){if(Va!==0){var _=f?Hm(o,f):new FormData(o);Zc(a,{pending:!0,data:_,method:o.method,action:u},null,_)}}else typeof u=="function"&&(v.preventDefault(),_=f?Hm(o,f):new FormData(o),Zc(a,{pending:!0,data:_,method:o.method,action:u},u,_))},currentTarget:o}]})}}for(var Lu=0;Lu<gc.length;Lu++){var Du=gc[Lu],xv=Du.toLowerCase(),Cv=Du[0].toUpperCase()+Du.slice(1);_n(xv,"on"+Cv)}_n(gh,"onAnimationEnd"),_n(ph,"onAnimationIteration"),_n(yh,"onAnimationStart"),_n("dblclick","onDoubleClick"),_n("focusin","onFocus"),_n("focusout","onBlur"),_n(Gy,"onTransitionRun"),_n(Vy,"onTransitionStart"),_n(Ky,"onTransitionCancel"),_n(vh,"onTransitionEnd"),Fn("onMouseEnter",["mouseout","mouseover"]),Fn("onMouseLeave",["mouseout","mouseover"]),Fn("onPointerEnter",["pointerout","pointerover"]),Fn("onPointerLeave",["pointerout","pointerover"]),Ut("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ut("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ut("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ut("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ut("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ut("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var xs="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(" "),Ov=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(xs));function qm(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,j=v.currentTarget;if(v=v.listener,_!==u&&o.isPropagationStopped())break e;u=v,o.currentTarget=j;try{u(o)}catch(U){El(U)}o.currentTarget=null,u=_}else for(f=0;f<s.length;f++){if(v=s[f],_=v.instance,j=v.currentTarget,v=v.listener,_!==u&&o.isPropagationStopped())break e;u=v,o.currentTarget=j;try{u(o)}catch(U){El(U)}o.currentTarget=null,u=_}}}}function _e(e,t){var a=t[Dn];a===void 0&&(a=t[Dn]=new Set);var s=e+"__bubble";a.has(s)||($m(t,e,2,!1),a.add(s))}function Mu(e,t,a){var s=0;t&&(s|=4),$m(a,e,s,t)}var ho="_reactListening"+Math.random().toString(36).slice(2);function Uu(e){if(!e[ho]){e[ho]=!0,gl.forEach(function(a){a!=="selectionchange"&&(Ov.has(a)||Mu(a,!1,e),Mu(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ho]||(t[ho]=!0,Mu("selectionchange",!1,t))}}function $m(e,t,a,s){switch(pg(t)){case 2:var o=a0;break;case 8:o=i0;break;default:o=Qu}a=o.bind(null,t,a,e),o=void 0,!Z||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 zu(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}wl(function(){var j=u,U=Xr(a),q=[];e:{var N=bh.get(e);if(N!==void 0){var L=li,ee=e;switch(e){case"keypress":if(Re(a)===0)break e;case"keydown":case"keyup":L=_y;break;case"focusin":ee="focus",L=sc;break;case"focusout":ee="blur",L=sc;break;case"beforeblur":case"afterblur":L=sc;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=Jd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":L=uy;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":L=Ey;break;case gh:case ph:case yh:L=fy;break;case vh:L=xy;break;case"scroll":case"scrollend":L=oy;break;case"wheel":L=Oy;break;case"copy":case"cut":case"paste":L=gy;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":L=Xd;break;case"toggle":case"beforetoggle":L=jy}var de=(t&4)!==0,qe=!de&&(e==="scroll"||e==="scrollend"),x=de?N!==null?N+"Capture":null:N;de=[];for(var k=j,R;k!==null;){var B=k;if(R=B.stateNode,B=B.tag,B!==5&&B!==26&&B!==27||R===null||x===null||(B=S(k,x),B!=null&&de.push(Cs(k,B,R))),qe)break;k=k.return}0<de.length&&(N=new L(N,ee,null,a,U),q.push({event:N,listeners:de}))}}if((t&7)===0){e:{if(N=e==="mouseover"||e==="pointerover",L=e==="mouseout"||e==="pointerout",N&&a!==Wr&&(ee=a.relatedTarget||a.fromElement)&&(Qn(ee)||ee[Wt]))break e;if((L||N)&&(N=U.window===U?U:(N=U.ownerDocument)?N.defaultView||N.parentWindow:window,L?(ee=a.relatedTarget||a.toElement,L=j,ee=ee?Qn(ee):null,ee!==null&&(qe=d(ee),de=ee.tag,ee!==qe||de!==5&&de!==27&&de!==6)&&(ee=null)):(L=null,ee=j),L!==ee)){if(de=Jd,B="onMouseLeave",x="onMouseEnter",k="mouse",(e==="pointerout"||e==="pointerover")&&(de=Xd,B="onPointerLeave",x="onPointerEnter",k="pointer"),qe=L==null?N:Ea(L),R=ee==null?N:Ea(ee),N=new de(B,k+"leave",L,a,U),N.target=qe,N.relatedTarget=R,B=null,Qn(U)===j&&(de=new de(x,k+"enter",ee,a,U),de.target=R,de.relatedTarget=qe,B=de),qe=B,L&&ee)t:{for(de=Rv,x=L,k=ee,R=0,B=x;B;B=de(B))R++;B=0;for(var ce=k;ce;ce=de(ce))B++;for(;0<R-B;)x=de(x),R--;for(;0<B-R;)k=de(k),B--;for(;R--;){if(x===k||k!==null&&x===k.alternate){de=x;break t}x=de(x),k=de(k)}de=null}else de=null;L!==null&&Pm(q,N,L,de,!1),ee!==null&&qe!==null&&Pm(q,qe,ee,de,!0)}}e:{if(N=j?Ea(j):window,L=N.nodeName&&N.nodeName.toLowerCase(),L==="select"||L==="input"&&N.type==="file")var je=ih;else if(nh(N))if(rh)je=$y;else{je=Hy;var ie=By}else L=N.nodeName,!L||L.toLowerCase()!=="input"||N.type!=="checkbox"&&N.type!=="radio"?j&&Jr(j.elementType)&&(je=ih):je=qy;if(je&&(je=je(e,j))){ah(q,je,a,U);break e}ie&&ie(e,N,j),e==="focusout"&&j&&N.type==="number"&&j.memoizedProps.value!=null&&Yr(N,"number",N.value)}switch(ie=j?Ea(j):window,e){case"focusin":(nh(ie)||ie.contentEditable==="true")&&(Gi=ie,hc=j,as=null);break;case"focusout":as=hc=Gi=null;break;case"mousedown":fc=!0;break;case"contextmenu":case"mouseup":case"dragend":fc=!1,fh(q,a,U);break;case"selectionchange":if(Iy)break;case"keydown":case"keyup":fh(q,a,U)}var be;if(oc)e:{switch(e){case"compositionstart":var ke="onCompositionStart";break e;case"compositionend":ke="onCompositionEnd";break e;case"compositionupdate":ke="onCompositionUpdate";break e}ke=void 0}else Ii?eh(e,a)&&(ke="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(ke="onCompositionStart");ke&&(Qd&&a.locale!=="ko"&&(Ii||ke!=="onCompositionStart"?ke==="onCompositionEnd"&&Ii&&(be=Ze()):(oe=U,le="value"in oe?oe.value:oe.textContent,Ii=!0)),ie=fo(j,ke),0<ie.length&&(ke=new Wd(ke,e,null,a,U),q.push({event:ke,listeners:ie}),be?ke.data=be:(be=th(a),be!==null&&(ke.data=be)))),(be=Ly?Dy(e,a):My(e,a))&&(ke=fo(j,"onBeforeInput"),0<ke.length&&(ie=new Wd("onBeforeInput","beforeinput",null,a,U),q.push({event:ie,listeners:ke}),ie.data=be)),Av(q,e,j,a,U)}qm(q,t)})}function Cs(e,t,a){return{instance:e,listener:t,currentTarget:a}}function fo(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=S(e,a),o!=null&&s.unshift(Cs(e,o,u)),o=S(e,t),o!=null&&s.push(Cs(e,o,u))),e.tag===3)return s;e=e.return}return[]}function Rv(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Pm(e,t,a,s,o){for(var u=t._reactName,f=[];a!==null&&a!==s;){var v=a,_=v.alternate,j=v.stateNode;if(v=v.tag,_!==null&&_===s)break;v!==5&&v!==26&&v!==27||j===null||(_=j,o?(j=S(a,u),j!=null&&f.unshift(Cs(a,j,_))):o||(j=S(a,u),j!=null&&f.push(Cs(a,j,_)))),a=a.return}f.length!==0&&e.push({event:t,listeners:f})}var jv=/\r\n?/g,Nv=/\u0000|\uFFFD/g;function Im(e){return(typeof e=="string"?e:""+e).replace(jv,`
9
+ `).replace(Nv,"")}function Gm(e,t){return t=Im(t),Im(e)===t}function He(e,t,a,s,o,u){switch(a){case"children":typeof s=="string"?t==="body"||t==="textarea"&&s===""||Bn(e,s):(typeof s=="number"||typeof s=="bigint")&&t!=="body"&&Bn(e,""+s);break;case"className":ai(e,"class",s);break;case"tabIndex":ai(e,"tabindex",s);break;case"dir":case"role":case"viewBox":case"width":case"height":ai(e,a,s);break;case"style":bl(e,s,u);break;case"data":if(t!=="object"){ai(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=Hn(""+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"&&He(e,t,"name",o.name,o,null),He(e,t,"formEncType",o.formEncType,o,null),He(e,t,"formMethod",o.formMethod,o,null),He(e,t,"formTarget",o.formTarget,o,null)):(He(e,t,"encType",o.encType,o,null),He(e,t,"method",o.method,o,null),He(e,t,"target",o.target,o,null)));if(s==null||typeof s=="symbol"||typeof s=="boolean"){e.removeAttribute(a);break}s=Hn(""+s),e.setAttribute(a,s);break;case"onClick":s!=null&&(e.onclick=ln);break;case"onScroll":s!=null&&_e("scroll",e);break;case"onScrollEnd":s!=null&&_e("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=Hn(""+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":_e("beforetoggle",e),_e("toggle",e),Un(e,"popover",s);break;case"xlinkActuate":Sn(e,"http://www.w3.org/1999/xlink","xlink:actuate",s);break;case"xlinkArcrole":Sn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",s);break;case"xlinkRole":Sn(e,"http://www.w3.org/1999/xlink","xlink:role",s);break;case"xlinkShow":Sn(e,"http://www.w3.org/1999/xlink","xlink:show",s);break;case"xlinkTitle":Sn(e,"http://www.w3.org/1999/xlink","xlink:title",s);break;case"xlinkType":Sn(e,"http://www.w3.org/1999/xlink","xlink:type",s);break;case"xmlBase":Sn(e,"http://www.w3.org/XML/1998/namespace","xml:base",s);break;case"xmlLang":Sn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",s);break;case"xmlSpace":Sn(e,"http://www.w3.org/XML/1998/namespace","xml:space",s);break;case"is":Un(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=Sl.get(a)||a,Un(e,a,s))}}function Bu(e,t,a,s,o,u){switch(a){case"style":bl(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"?Bn(e,s):(typeof s=="number"||typeof s=="bigint")&&Bn(e,""+s);break;case"onScroll":s!=null&&_e("scroll",e);break;case"onScrollEnd":s!=null&&_e("scrollend",e);break;case"onClick":s!=null&&(e.onclick=ln);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ni.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[_t]||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,""):Un(e,a,s)}}}function At(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":_e("error",e),_e("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:He(e,t,u,f,a,null)}}o&&He(e,t,"srcSet",a.srcSet,a,null),s&&He(e,t,"src",a.src,a,null);return;case"input":_e("invalid",e);var v=u=f=o=null,_=null,j=null;for(s in a)if(a.hasOwnProperty(s)){var U=a[s];if(U!=null)switch(s){case"name":o=U;break;case"type":f=U;break;case"checked":_=U;break;case"defaultChecked":j=U;break;case"value":u=U;break;case"defaultValue":v=U;break;case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(l(137,t));break;default:He(e,t,s,U,a,null)}}ri(e,u,v,_,j,f,o,!1);return;case"select":_e("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:He(e,t,o,v,a,null)}t=u,a=f,e.multiple=!!s,t!=null?xa(e,!!s,t,!1):a!=null&&xa(e,!!s,a,!0);return;case"textarea":_e("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:He(e,t,f,v,a,null)}si(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":He(e,t,_,s,a,null));return;case"dialog":_e("beforetoggle",e),_e("toggle",e),_e("cancel",e),_e("close",e);break;case"iframe":case"object":_e("load",e);break;case"video":case"audio":for(s=0;s<xs.length;s++)_e(xs[s],e);break;case"image":_e("error",e),_e("load",e);break;case"details":_e("toggle",e);break;case"embed":case"source":case"link":_e("error",e),_e("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(j in a)if(a.hasOwnProperty(j)&&(s=a[j],s!=null))switch(j){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:He(e,t,j,s,a,null)}return;default:if(Jr(t)){for(U in a)a.hasOwnProperty(U)&&(s=a[U],s!==void 0&&Bu(e,t,U,s,a,void 0));return}}for(v in a)a.hasOwnProperty(v)&&(s=a[v],s!=null&&He(e,t,v,s,a,null))}function Lv(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,j=null,U=null;for(L in a){var q=a[L];if(a.hasOwnProperty(L)&&q!=null)switch(L){case"checked":break;case"value":break;case"defaultValue":_=q;default:s.hasOwnProperty(L)||He(e,t,L,null,s,q)}}for(var N in s){var L=s[N];if(q=a[N],s.hasOwnProperty(N)&&(L!=null||q!=null))switch(N){case"type":u=L;break;case"name":o=L;break;case"checked":j=L;break;case"defaultChecked":U=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!==q&&He(e,t,N,L,s,q)}}$i(e,f,v,_,j,U,u,o);return;case"select":L=f=v=N=null;for(u in a)if(_=a[u],a.hasOwnProperty(u)&&_!=null)switch(u){case"value":break;case"multiple":L=_;default:s.hasOwnProperty(u)||He(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":N=u;break;case"defaultValue":v=u;break;case"multiple":f=u;default:u!==_&&He(e,t,o,u,s,_)}t=v,a=f,s=L,N!=null?xa(e,!!a,N,!1):!!s!=!!a&&(t!=null?xa(e,!!a,t,!0):xa(e,!!a,a?[]:"",!1));return;case"textarea":L=N=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:He(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":N=o;break;case"defaultValue":L=o;break;case"children":break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(l(91));break;default:o!==u&&He(e,t,f,o,s,u)}bt(e,N,L);return;case"option":for(var ee in a)N=a[ee],a.hasOwnProperty(ee)&&N!=null&&!s.hasOwnProperty(ee)&&(ee==="selected"?e.selected=!1:He(e,t,ee,null,s,N));for(_ in s)N=s[_],L=a[_],s.hasOwnProperty(_)&&N!==L&&(N!=null||L!=null)&&(_==="selected"?e.selected=N&&typeof N!="function"&&typeof N!="symbol":He(e,t,_,N,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 de in a)N=a[de],a.hasOwnProperty(de)&&N!=null&&!s.hasOwnProperty(de)&&He(e,t,de,null,s,N);for(j in s)if(N=s[j],L=a[j],s.hasOwnProperty(j)&&N!==L&&(N!=null||L!=null))switch(j){case"children":case"dangerouslySetInnerHTML":if(N!=null)throw Error(l(137,t));break;default:He(e,t,j,N,s,L)}return;default:if(Jr(t)){for(var qe in a)N=a[qe],a.hasOwnProperty(qe)&&N!==void 0&&!s.hasOwnProperty(qe)&&Bu(e,t,qe,void 0,s,N);for(U in s)N=s[U],L=a[U],!s.hasOwnProperty(U)||N===L||N===void 0&&L===void 0||Bu(e,t,U,N,s,L);return}}for(var x in a)N=a[x],a.hasOwnProperty(x)&&N!=null&&!s.hasOwnProperty(x)&&He(e,t,x,null,s,N);for(q in s)N=s[q],L=a[q],!s.hasOwnProperty(q)||N===L||N==null&&L==null||He(e,t,q,N,s,L)}function Vm(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Dv(){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&&Vm(f)){for(f=0,v=o.responseEnd,s+=1;s<a.length;s++){var _=a[s],j=_.startTime;if(j>v)break;var U=_.transferSize,q=_.initiatorType;U&&Vm(q)&&(_=_.responseEnd,f+=U*(_<v?1:(v-j)/(_-j)))}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 Hu=null,qu=null;function mo(e){return e.nodeType===9?e:e.ownerDocument}function Km(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 Ym(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 $u(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 Pu=null;function Mv(){var e=window.event;return e&&e.type==="popstate"?e===Pu?!1:(Pu=e,!0):(Pu=null,!1)}var Jm=typeof setTimeout=="function"?setTimeout:void 0,Uv=typeof clearTimeout=="function"?clearTimeout:void 0,Wm=typeof Promise=="function"?Promise:void 0,zv=typeof queueMicrotask=="function"?queueMicrotask:typeof Wm<"u"?function(e){return Wm.resolve(null).then(e).catch(Bv)}:Jm;function Bv(e){setTimeout(function(){throw e})}function Ka(e){return e==="head"}function Xm(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),yr(t);return}s--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")s++;else if(a==="html")Os(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Os(a);for(var u=a.firstChild;u;){var f=u.nextSibling,v=u.nodeName;u[Xt]||v==="SCRIPT"||v==="STYLE"||v==="LINK"&&u.rel.toLowerCase()==="stylesheet"||a.removeChild(u),u=f}}else a==="body"&&Os(e.ownerDocument.body);a=o}while(a);yr(t)}function Qm(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 Iu(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":Iu(a),Hi(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function Hv(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[Xt])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=gn(e.nextSibling),e===null)break}return null}function qv(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=gn(e.nextSibling),e===null))return null;return e}function Zm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=gn(e.nextSibling),e===null))return null;return e}function Gu(e){return e.data==="$?"||e.data==="$~"}function Vu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function $v(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 gn(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 Ku=null;function Fm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return gn(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function eg(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 tg(e,t,a){switch(t=mo(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 Os(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Hi(e)}var pn=new Map,ng=new Set;function go(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var ga=V.d;V.d={f:Pv,r:Iv,D:Gv,C:Vv,L:Kv,m:Yv,X:Wv,S:Jv,M:Xv};function Pv(){var e=ga.f(),t=ro();return e||t}function Iv(e){var t=Zn(e);t!==null&&t.tag===5&&t.type==="form"?bf(t):ga.r(e)}var mr=typeof document>"u"?null:document;function ag(e,t,a){var s=mr;if(s&&typeof t=="string"&&t){var o=zt(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof a=="string"&&(o+='[crossorigin="'+a+'"]'),ng.has(o)||(ng.add(o),e={rel:e,crossOrigin:a,href:t},s.querySelector(o)===null&&(t=s.createElement("link"),At(t,"link",e),st(t),s.head.appendChild(t)))}}function Gv(e){ga.D(e),ag("dns-prefetch",e,null)}function Vv(e,t){ga.C(e,t),ag("preconnect",e,t)}function Kv(e,t,a){ga.L(e,t,a);var s=mr;if(s&&e&&t){var o='link[rel="preload"][as="'+zt(t)+'"]';t==="image"&&a&&a.imageSrcSet?(o+='[imagesrcset="'+zt(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(o+='[imagesizes="'+zt(a.imageSizes)+'"]')):o+='[href="'+zt(e)+'"]';var u=o;switch(t){case"style":u=gr(e);break;case"script":u=pr(e)}pn.has(u)||(e=b({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),pn.set(u,e),s.querySelector(o)!==null||t==="style"&&s.querySelector(Rs(u))||t==="script"&&s.querySelector(js(u))||(t=s.createElement("link"),At(t,"link",e),st(t),s.head.appendChild(t)))}}function Yv(e,t){ga.m(e,t);var a=mr;if(a&&e){var s=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+zt(s)+'"][href="'+zt(e)+'"]',u=o;switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=pr(e)}if(!pn.has(u)&&(e=b({rel:"modulepreload",href:e},t),pn.set(u,e),a.querySelector(o)===null)){switch(s){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(js(u)))return}s=a.createElement("link"),At(s,"link",e),st(s),a.head.appendChild(s)}}}function Jv(e,t,a){ga.S(e,t,a);var s=mr;if(s&&e){var o=Mn(s).hoistableStyles,u=gr(e);t=t||"default";var f=o.get(u);if(!f){var v={loading:0,preload:null};if(f=s.querySelector(Rs(u)))v.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":t},a),(a=pn.get(u))&&Yu(e,a);var _=f=s.createElement("link");st(_),At(_,"link",e),_._p=new Promise(function(j,U){_.onload=j,_.onerror=U}),_.addEventListener("load",function(){v.loading|=1}),_.addEventListener("error",function(){v.loading|=2}),v.loading|=4,po(f,t,s)}f={type:"stylesheet",instance:f,count:1,state:v},o.set(u,f)}}}function Wv(e,t){ga.X(e,t);var a=mr;if(a&&e){var s=Mn(a).hoistableScripts,o=pr(e),u=s.get(o);u||(u=a.querySelector(js(o)),u||(e=b({src:e,async:!0},t),(t=pn.get(o))&&Ju(e,t),u=a.createElement("script"),st(u),At(u,"link",e),a.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(o,u))}}function Xv(e,t){ga.M(e,t);var a=mr;if(a&&e){var s=Mn(a).hoistableScripts,o=pr(e),u=s.get(o);u||(u=a.querySelector(js(o)),u||(e=b({src:e,async:!0,type:"module"},t),(t=pn.get(o))&&Ju(e,t),u=a.createElement("script"),st(u),At(u,"link",e),a.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},s.set(o,u))}}function ig(e,t,a,s){var o=(o=ye.current)?go(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=gr(a.href),a=Mn(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=gr(a.href);var u=Mn(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(Rs(e)))&&!u._p&&(f.instance=u,f.state.loading=5),pn.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},pn.set(e,a),u||Qv(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=pr(a),a=Mn(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 gr(e){return'href="'+zt(e)+'"'}function Rs(e){return'link[rel="stylesheet"]['+e+"]"}function rg(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function Qv(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}),At(t,"link",a),st(t),e.head.appendChild(t))}function pr(e){return'[src="'+zt(e)+'"]'}function js(e){return"script[async]"+e}function sg(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var s=e.querySelector('style[data-href~="'+zt(a.href)+'"]');if(s)return t.instance=s,st(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"),st(s),At(s,"style",o),po(s,a.precedence,e),t.instance=s;case"stylesheet":o=gr(a.href);var u=e.querySelector(Rs(o));if(u)return t.state.loading|=4,t.instance=u,st(u),u;s=rg(a),(o=pn.get(o))&&Yu(s,o),u=(e.ownerDocument||e).createElement("link"),st(u);var f=u;return f._p=new Promise(function(v,_){f.onload=v,f.onerror=_}),At(u,"link",s),t.state.loading|=4,po(u,a.precedence,e),t.instance=u;case"script":return u=pr(a.src),(o=e.querySelector(js(u)))?(t.instance=o,st(o),o):(s=a,(o=pn.get(u))&&(s=b({},a),Ju(s,o)),e=e.ownerDocument||e,o=e.createElement("script"),st(o),At(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,po(s,a.precedence,e));return t.instance}function po(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 Yu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Ju(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var yo=null;function lg(e,t,a){if(yo===null){var s=new Map,o=yo=new Map;o.set(a,s)}else o=yo,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[Xt]||u[tt]||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 og(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function Zv(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 cg(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Fv(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=gr(s.href),u=t.querySelector(Rs(o));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=vo.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=u,st(u);return}u=t.ownerDocument||t,s=rg(s),(o=pn.get(o))&&Yu(s,o),u=u.createElement("link"),st(u);var f=u;f._p=new Promise(function(v,_){f.onload=v,f.onerror=_}),At(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=vo.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var Wu=0;function e0(e,t){return e.stylesheets&&e.count===0&&So(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var s=setTimeout(function(){if(e.stylesheets&&So(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&Wu===0&&(Wu=62500*Dv());var o=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&So(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>Wu?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(s),clearTimeout(o)}}:null}function vo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)So(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var bo=null;function So(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,bo=new Map,t.forEach(t0,e),bo=null,vo.call(e))}function t0(e,t){if(!(t.state.loading&4)){var a=bo.get(e);if(a)var s=a.get(null);else{a=new Map,bo.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=vo.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 Ns={$$typeof:O,Provider:null,Consumer:null,_currentValue:se,_currentValue2:se,_threadCount:0};function n0(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=Nn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Nn(0),this.hiddenUpdates=Nn(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 ug(e,t,a,s,o,u,f,v,_,j,U,q){return e=new n0(e,t,a,f,_,j,U,q,v),t=1,u===!0&&(t|=24),u=Zt(3,null,null,t),e.current=u,u.stateNode=e,t=Cc(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:s,isDehydrated:a,cache:t},Nc(u),e}function dg(e){return e?(e=Yi,e):Yi}function hg(e,t,a,s,o,u){o=dg(o),s.context===null?s.context=o:s.pendingContext=o,s=Ma(t),s.payload={element:a},u=u===void 0?null:u,u!==null&&(s.callback=u),a=Ua(e,s,t),a!==null&&(Pt(a,e,t),us(a,e,t))}function fg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function Xu(e,t){fg(e,t),(e=e.alternate)&&fg(e,t)}function mg(e){if(e.tag===13||e.tag===31){var t=ui(e,67108864);t!==null&&Pt(t,e,67108864),Xu(e,67108864)}}function gg(e){if(e.tag===13||e.tag===31){var t=an();t=et(t);var a=ui(e,t);a!==null&&Pt(a,e,t),Xu(e,t)}}var wo=!0;function a0(e,t,a,s){var o=D.T;D.T=null;var u=V.p;try{V.p=2,Qu(e,t,a,s)}finally{V.p=u,D.T=o}}function i0(e,t,a,s){var o=D.T;D.T=null;var u=V.p;try{V.p=8,Qu(e,t,a,s)}finally{V.p=u,D.T=o}}function Qu(e,t,a,s){if(wo){var o=Zu(s);if(o===null)zu(e,t,s,_o,a),yg(e,s);else if(s0(o,e,t,a,s))s.stopPropagation();else if(yg(e,s),t&4&&-1<r0.indexOf(e)){for(;o!==null;){var u=Zn(o);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var f=vt(u.pendingLanes);if(f!==0){var v=u;for(v.pendingLanes|=2,v.entangledLanes|=2;f;){var _=1<<31-Ct(f);v.entanglements[1]|=_,f&=~_}In(u),(Le&6)===0&&(ao=Ie()+500,As(0))}}break;case 31:case 13:v=ui(u,2),v!==null&&Pt(v,u,2),ro(),Xu(u,2)}if(u=Zu(s),u===null&&zu(e,t,s,_o,a),u===o)break;o=u}o!==null&&s.stopPropagation()}else zu(e,t,s,null,a)}}function Zu(e){return e=Xr(e),Fu(e)}var _o=null;function Fu(e){if(_o=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 _o=e,null}function pg(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(Hr()){case ei:return 2;case jn:return 8;case Di:case qr:return 32;case $r:return 268435456;default:return 32}default:return 32}}var ed=!1,Ya=null,Ja=null,Wa=null,Ls=new Map,Ds=new Map,Xa=[],r0="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 yg(e,t){switch(e){case"focusin":case"focusout":Ya=null;break;case"dragenter":case"dragleave":Ja=null;break;case"mouseover":case"mouseout":Wa=null;break;case"pointerover":case"pointerout":Ls.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ds.delete(t.pointerId)}}function Ms(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=Zn(t),t!==null&&mg(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function s0(e,t,a,s,o){switch(t){case"focusin":return Ya=Ms(Ya,e,t,a,s,o),!0;case"dragenter":return Ja=Ms(Ja,e,t,a,s,o),!0;case"mouseover":return Wa=Ms(Wa,e,t,a,s,o),!0;case"pointerover":var u=o.pointerId;return Ls.set(u,Ms(Ls.get(u)||null,e,t,a,s,o)),!0;case"gotpointercapture":return u=o.pointerId,Ds.set(u,Ms(Ds.get(u)||null,e,t,a,s,o)),!0}return!1}function vg(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,ti(e.priority,function(){gg(a)});return}}else if(t===31){if(t=m(a),t!==null){e.blockedOn=t,ti(e.priority,function(){gg(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 To(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=Zu(e.nativeEvent);if(a===null){a=e.nativeEvent;var s=new a.constructor(a.type,a);Wr=s,a.target.dispatchEvent(s),Wr=null}else return t=Zn(a),t!==null&&mg(t),e.blockedOn=a,!1;t.shift()}return!0}function bg(e,t,a){To(e)&&a.delete(t)}function l0(){ed=!1,Ya!==null&&To(Ya)&&(Ya=null),Ja!==null&&To(Ja)&&(Ja=null),Wa!==null&&To(Wa)&&(Wa=null),Ls.forEach(bg),Ds.forEach(bg)}function ko(e,t){e.blockedOn===t&&(e.blockedOn=null,ed||(ed=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,l0)))}var Eo=null;function Sg(e){Eo!==e&&(Eo=e,i.unstable_scheduleCallback(i.unstable_NormalPriority,function(){Eo===e&&(Eo=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(Fu(s||a)===null)continue;break}var u=Zn(a);u!==null&&(e.splice(t,3),t-=3,Zc(u,{pending:!0,data:o,method:a.method,action:s},s,o))}}))}function yr(e){function t(_){return ko(_,e)}Ya!==null&&ko(Ya,e),Ja!==null&&ko(Ja,e),Wa!==null&&ko(Wa,e),Ls.forEach(t),Ds.forEach(t);for(var a=0;a<Xa.length;a++){var s=Xa[a];s.blockedOn===e&&(s.blockedOn=null)}for(;0<Xa.length&&(a=Xa[0],a.blockedOn===null);)vg(a),a.blockedOn===null&&Xa.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[_t]||null;if(typeof u=="function")f||Sg(a);else if(f){var v=null;if(u&&u.hasAttribute("formAction")){if(o=u,f=u[_t]||null)v=f.formAction;else if(Fu(o)!==null)continue}else v=f.action;typeof v=="function"?a[s+1]=v:(a.splice(s,3),s-=3),Sg(a)}}}function wg(){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 td(e){this._internalRoot=e}Ao.prototype.render=td.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(l(409));var a=t.current,s=an();hg(a,s,e,t,null,null)},Ao.prototype.unmount=td.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;hg(e.current,2,null,e,null,null),ro(),t[Wt]=null}};function Ao(e){this._internalRoot=e}Ao.prototype.unstable_scheduleHydration=function(e){if(e){var t=zi();e={blockedOn:null,target:e,priority:t};for(var a=0;a<Xa.length&&t!==0&&t<Xa[a].priority;a++);Xa.splice(a,0,e),a===0&&vg(e)}};var _g=n.version;if(_g!=="19.2.7")throw Error(l(527,_g,"19.2.7"));V.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?w(e):null,e=e===null?null:e.stateNode,e};var o0={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:D,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var xo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!xo.isDisabled&&xo.supportsFiber)try{_a=xo.inject(o0),yt=xo}catch{}}return zs.createRoot=function(e,t){if(!c(e))throw Error(l(299));var a=!1,s="",o=Of,u=Rf,f=jf;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=ug(e,1,!1,null,null,a,s,null,o,u,f,wg),e[Wt]=t.current,Uu(e),new td(t)},zs.hydrateRoot=function(e,t,a){if(!c(e))throw Error(l(299));var s=!1,o="",u=Of,f=Rf,v=jf,_=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=ug(e,1,!0,t,a??null,s,o,_,u,f,v,wg),t.context=dg(null),a=t.current,s=an(),s=et(s),o=Ma(s),o.callback=null,Ua(a,o,s),a=s,t.current.lanes=a,re(t,a),In(t),e[Wt]=t.current,Uu(e),new Ao(t)},zs.version="19.2.7",zs}var Ng;function v0(){if(Ng)return id.exports;Ng=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(),id.exports=y0(),id.exports}var b0=v0();const S0=i=>i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),w0=i=>i.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,r,l)=>l?l.toUpperCase():r.toLowerCase()),Lg=i=>{const n=w0(i);return n.charAt(0).toUpperCase()+n.slice(1)},Cp=(...i)=>i.filter((n,r,l)=>!!n&&n.trim()!==""&&l.indexOf(n)===r).join(" ").trim(),_0=i=>{for(const n in i)if(n.startsWith("aria-")||n==="role"||n==="title")return!0};var T0={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 k0=H.forwardRef(({color:i="currentColor",size:n=24,strokeWidth:r=2,absoluteStrokeWidth:l,className:c="",children:d,iconNode:h,...m},g)=>H.createElement("svg",{ref:g,...T0,width:n,height:n,stroke:i,strokeWidth:l?Number(r)*24/Number(n):r,className:Cp("lucide",c),...!d&&!_0(m)&&{"aria-hidden":"true"},...m},[...h.map(([p,w])=>H.createElement(p,w)),...Array.isArray(d)?d:[d]]));const $e=(i,n)=>{const r=H.forwardRef(({className:l,...c},d)=>H.createElement(k0,{ref:d,iconNode:n,className:Cp(`lucide-${S0(Lg(i))}`,`lucide-${i}`,l),...c}));return r.displayName=Lg(i),r};const E0=[["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"}]],Dg=$e("activity",E0);const A0=[["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"}]],x0=$e("badge-check",A0);const C0=[["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"}]],xd=$e("book-open",C0);const O0=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Op=$e("chevron-left",O0);const R0=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Rp=$e("chevron-right",R0);const j0=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],N0=$e("circle-check",j0);const L0=[["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"}]],Bs=$e("clipboard",L0);const D0=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],Cd=$e("credit-card",D0);const M0=[["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"}]],od=$e("database",M0);const U0=[["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"}]],z0=$e("earth",U0);const B0=[["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"}]],cd=$e("folder-open",B0);const H0=[["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"}]],jp=$e("layout-grid",H0);const q0=[["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"}]],ud=$e("log-in",q0);const $0=[["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"}]],P0=$e("log-out",$0);const I0=[["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"}]],jr=$e("monitor",I0);const G0=[["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"}]],Od=$e("mouse-pointer-2",G0);const V0=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],dd=$e("play",V0);const K0=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],Y0=$e("power",K0);const J0=[["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"}]],W0=$e("rotate-ccw",J0);const X0=[["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"}]],hd=$e("send",X0);const Q0=[["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"}]],fd=$e("server",Q0);const Z0=[["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"}]],Np=$e("settings",Z0);const F0=[["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"}]],Mg=$e("shield-check",F0);const eb=[["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"}]],tb=$e("star",eb);const nb=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Ar=$e("terminal",nb);const ab=[["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"}]],Ug=$e("volume-2",ab);const ib=[["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"}]],zg=$e("wifi",ib);const rb=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Bg=$e("x",rb);function Yo(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 sb(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(w){try{p(l.next(w))}catch(b){h(b)}}function g(w){try{p(l.throw(w))}catch(b){h(b)}}function p(w){w.done?d(w.value):c(w.value).then(m,g)}p((l=l.apply(i,n||[])).next())})}const lb=i=>i?(...n)=>i(...n):(...n)=>fetch(...n);class Vd 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 ob extends Vd{constructor(n){super("Failed to send a request to the Edge Function","FunctionsFetchError",n)}}class Hg extends Vd{constructor(n){super("Relay Error invoking the Edge Function","FunctionsRelayError",n)}}class qg extends Vd{constructor(n){super("Edge Function returned a non-2xx status code","FunctionsHttpError",n)}}var Rd;(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"})(Rd||(Rd={}));class cb{constructor(n,{headers:r={},customFetch:l,region:c=Rd.Any}={}){this.url=n,this.headers=r,this.region=c,this.fetch=lb(l)}setAuth(n){this.headers.Authorization=`Bearer ${n}`}invoke(n){return sb(this,arguments,void 0,function*(r,l={}){var c;let d,h;try{const{headers:m,method:g,body:p,signal:w,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 z;const G=!!m&&Object.keys(m).some(ae=>ae.toLowerCase()==="content-type");p&&!G?typeof Blob<"u"&&p instanceof Blob||p instanceof ArrayBuffer?(T["Content-Type"]="application/octet-stream",z=p):typeof p=="string"?(T["Content-Type"]="text/plain",z=p):typeof FormData<"u"&&p instanceof FormData?z=p:(T["Content-Type"]="application/json",z=JSON.stringify(p)):p&&typeof p!="string"&&!(typeof Blob<"u"&&p instanceof Blob)&&!(p instanceof ArrayBuffer)&&!(typeof FormData<"u"&&p instanceof FormData)?z=JSON.stringify(p):z=p;let I=w;b&&(h=new AbortController,d=setTimeout(()=>h.abort(),b),w?(I=h.signal,w.addEventListener("abort",()=>h.abort())):I=h.signal);const $=yield this.fetch(C.toString(),{method:g||"POST",headers:Object.assign(Object.assign(Object.assign({},T),this.headers),m),body:z,signal:I}).catch(ae=>{throw new ob(ae)}),O=$.headers.get("x-relay-error");if(O&&O==="true")throw new Hg($);if(!$.ok)throw new qg($);let J=((c=$.headers.get("Content-Type"))!==null&&c!==void 0?c:"text/plain").split(";")[0].trim(),me;return J==="application/json"?me=yield $.json():J==="application/octet-stream"||J==="application/pdf"?me=yield $.blob():J==="text/event-stream"?me=$:J==="multipart/form-data"?me=yield $.formData():me=yield $.text(),{data:me,error:null,response:$}}catch(m){return{data:null,error:m,response:m instanceof qg||m instanceof Hg?m.context:void 0}}finally{d&&clearTimeout(d)}})}}const Lp=3,$g=i=>Math.min(1e3*2**i,3e4),ub=[520,503],Dp=["GET","HEAD","OPTIONS"];var Pg=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 Ig(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 db(i,n,r,l){return!(!l||r>=Lp||!Dp.includes(i)||!ub.includes(n))}var hb=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 w;try{w=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"||!Dp.includes(r.method))throw b;if(r.retryEnabled&&h<Lp){const T=$g(h);h++,await Ig(T,r.signal);continue}throw b}if(db(r.method,w.status,h,r.retryEnabled)){var m,g;const b=(m=(g=w.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:$g(h);await w.text(),h++,await Ig(T,r.signal);continue}return await r.processResponse(w)}})();return this.shouldThrowOnError||(d=d.catch(h=>{var m;let g="",p="",w="";const b=h?.cause;if(b){var T,A,C,z;const $=(T=b?.message)!==null&&T!==void 0?T:"",O=(A=b?.code)!==null&&A!==void 0?A:"";g=`${(C=h?.name)!==null&&C!==void 0?C:"FetchError"}: ${h?.message}`,g+=`
10
+
11
+ Caused by: ${(z=b?.name)!==null&&z!==void 0?z:"Error"}: ${$}`,O&&(g+=` (${O})`),b?.stack&&(g+=`
12
+ ${b.stack}`)}else{var G;g=(G=h?.stack)!==null&&G!==void 0?G:""}const I=this.url.toString().length;return h?.name==="AbortError"||h?.code==="ABORT_ERR"?(w="",p="Request was aborted (timeout or manual cancellation)",I>this.urlLengthLimit&&(p+=`. Note: Your request URL is ${I} 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")&&(w="",p="HTTP headers exceeded server limits (typically 16KB)",I>this.urlLengthLimit&&(p+=`. Your request URL is ${I} 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:w},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 Pg({message:T,details:"",hint:"",code:""})}}const w=(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("/");w&&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 w=await i.text();try{r=JSON.parse(w),Array.isArray(r)&&i.status===404&&(l=[],r=null,d=200,h="OK")}catch{i.status===404&&w===""?(d=204,h="No Content"):r={message:w}}if(r&&n.shouldThrowOnError)throw new Pg(r)}return{success:r===null,error:r,data:l,count:c,status:d,statusText:h}}returns(){return this}overrideTypes(){return this}},fb=class extends hb{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 Gg=new RegExp("[,()]");var xr=class extends fb{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"&&Gg.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"&&Gg.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}},mb=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 xr({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 xr({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((w,b)=>w.concat(Object.keys(b)),[]);if(p.length>0){const w=[...new Set(p)].map(b=>`"${b}"`);m.searchParams.set("columns",w.join(","))}}return new xr({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 xr({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 xr({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 el(i){"@babel/helpers - typeof";return el=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},el(i)}function gb(i,n){if(el(i)!="object"||!i)return i;var r=i[Symbol.toPrimitive];if(r!==void 0){var l=r.call(i,n);if(el(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(i)}function pb(i){var n=gb(i,"string");return el(n)=="symbol"?n:n+""}function yb(i,n,r){return(n=pb(n))in i?Object.defineProperty(i,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):i[n]=r,i}function Vg(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 Co(i){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?Vg(Object(r),!0).forEach(function(l){yb(i,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(r)):Vg(Object(r)).forEach(function(l){Object.defineProperty(i,l,Object.getOwnPropertyDescriptor(r,l))})}return i}var vb=class Mp{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,w)=>{const b=new AbortController,T=setTimeout(()=>b.abort(),d),A=w?.signal;if(A){if(A.aborted)return clearTimeout(T),g(p,w);const C=()=>{clearTimeout(T),b.abort()};return A.addEventListener("abort",C,{once:!0}),g(p,Co(Co({},w),{},{signal:b.signal})).finally(()=>{clearTimeout(T),A.removeEventListener("abort",C)})}return g(p,Co(Co({},w),{},{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 mb(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 Mp(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 w=A=>A!==null&&typeof A=="object"&&(!Array.isArray(A)||A.some(w)),b=l&&Object.values(r).some(w);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 xr({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 bb{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
+
14
+ Suggested solution: ${n.workaround}`),new Error(r)}static isWebSocketSupported(){try{return this.detectEnvironment().type==="native"}catch{return!1}}}const Sb="2.110.0",wb=`realtime-js/${Sb}`,_b="1.0.0",Up="2.0.0",Tb=Up,kb=1e4,Eb=100,Za={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},zp={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},jd={connecting:"connecting",closing:"closing",closed:"closed"};class Ab{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,w=this.allowedMetadataKeys?this._pick(n.payload,this.allowedMetadataKeys):{},b=Object.keys(w).length===0?"":JSON.stringify(w);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),z=0;C.setUint8(z++,this.KINDS.userBroadcastPush),C.setUint8(z++,g.length),C.setUint8(z++,m.length),C.setUint8(z++,h.length),C.setUint8(z++,p.length),C.setUint8(z++,b.length),C.setUint8(z++,r),Array.from(g,I=>C.setUint8(z++,I.charCodeAt(0))),Array.from(m,I=>C.setUint8(z++,I.charCodeAt(0))),Array.from(h,I=>C.setUint8(z++,I.charCodeAt(0))),Array.from(p,I=>C.setUint8(z++,I.charCodeAt(0))),Array.from(b,I=>C.setUint8(z++,I.charCodeAt(0)));var G=new Uint8Array(A.byteLength+l.byteLength);return G.set(new Uint8Array(A),0),G.set(new Uint8Array(l),A.byteLength),G.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 w=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:w,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 Ge;(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"})(Ge||(Ge={}));const Kg=(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]=xb(h,i,n,c),d),{}):{}},xb=(i,n,r,l)=>{const c=n.find(m=>m.name===i),d=c?.type,h=r[i];return d&&!l.includes(d)?Bp(d,h):Nd(h)},Bp=(i,n)=>{if(i.charAt(0)==="_"){const r=i.slice(1,i.length);return jb(n,r)}switch(i){case Ge.bool:return Cb(n);case Ge.float4:case Ge.float8:case Ge.int2:case Ge.int4:case Ge.int8:case Ge.numeric:case Ge.oid:return Ob(n);case Ge.json:case Ge.jsonb:return Rb(n);case Ge.timestamp:return Nb(n);case Ge.abstime:case Ge.date:case Ge.daterange:case Ge.int4range:case Ge.int8range:case Ge.money:case Ge.reltime:case Ge.text:case Ge.time:case Ge.timestamptz:case Ge.timetz:case Ge.tsrange:case Ge.tstzrange:return Nd(n);default:return Nd(n)}},Nd=i=>i,Cb=i=>{switch(i){case"t":return!0;case"f":return!1;default:return i}},Ob=i=>{if(typeof i=="string"){const n=parseFloat(i);if(!Number.isNaN(n))return n}return i},Rb=i=>{if(typeof i=="string")try{return JSON.parse(i)}catch{return i}return i},jb=(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=>Bp(n,m))}return i},Nb=i=>typeof i=="string"?i.replace(" ","T"):i,Hp=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 Ks=i=>typeof i=="function"?i:function(){return i},Lb=typeof self<"u"?self:null,Cr=typeof window<"u"?window:null,Gn=Lb||Cr||globalThis,Db="2.0.0",Mb=1e4,Ub=1e3,Vn={connecting:0,open:1,closing:2,closed:3},It={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},va={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Ld={longpoll:"longpoll",websocket:"websocket"},zb={complete:4},Dd="base64url.bearer.phx.",Oo=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})}},qp=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))}},Bb=class{constructor(i,n,r){this.state=It.closed,this.topic=i,this.params=Ks(n||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Oo(this,va.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new qp(()=>{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 Oo(this,va.leave,Ks({}),this.timeout).send(),this.state=It.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(va.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(va.close,i)}onError(i){return this.on(va.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 Oo(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(va.close,"leave")},r=new Oo(this,va.leave,Ks({}),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}},Ho=class{static request(i,n,r,l,c,d,h){if(Gn.XDomainRequest){let m=new Gn.XDomainRequest;return this.xdomainRequest(m,i,n,l,c,d,h)}else if(Gn.XMLHttpRequest){let m=new Gn.XMLHttpRequest;return this.xhrRequest(m,i,n,r,l,c,d,h)}else{if(Gn.fetch&&Gn.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),Gn.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===zb.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)}`}},Hb=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)},vr=class{constructor(i,n){n&&n.length===2&&n[1].startsWith(Dd)&&(this.authToken=atob(n[1].slice(Dd.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=Vn.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(i){return i.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Ld.websocket),"$1/"+Ld.longpoll)}endpointURL(){return Ho.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(i,n,r){this.close(i,n,r),this.readyState=Vn.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===Vn.open||this.readyState===Vn.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=Vn.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=Hb(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=Vn.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=Ho.request(i,this.endpointURL(),n,r,this.timeout,h,m=>{this.reqs.delete(d),this.isActive()&&c(m)}),this.reqs.add(d)}},qb=class Is{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=Is.syncState(this.state,c,d,h),this.pendingDiffs.forEach(g=>{this.state=Is.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=Is.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 Is.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 w=d[g];if(w){let b=p.metas.map(z=>z.phx_ref),T=w.metas.map(z=>z.phx_ref),A=p.metas.filter(z=>T.indexOf(z.phx_ref)<0),C=w.metas.filter(z=>b.indexOf(z.phx_ref)<0);A.length>0&&(h[g]=p,h[g].metas=A),C.length>0&&(m[g]=this.clone(w),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 w=n[m].metas.map(T=>T.phx_ref),b=p.metas.filter(T=>w.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 w=g.metas.map(b=>b.phx_ref);p.metas=p.metas.filter(b=>w.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))}},Ro={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 w=new Uint8Array(m.byteLength+d.byteLength);return w.set(new Uint8Array(m),0),w.set(new Uint8Array(d),m.byteLength),w.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 w=i.slice(h,i.byteLength);return{join_ref:m,ref:null,topic:g,event:p,payload:w}},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 w=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:w,event:va.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}}},$b=class{constructor(i,n={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=n.timeout||Mb,this.transport=n.transport||Gn.WebSocket||vr,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=n.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=Gn&&Gn.sessionStorage}catch{}this.sessionStore=n.sessionStorage||r,this.establishedConnections=0,this.defaultEncoder=Ro.encode.bind(Ro),this.defaultDecoder=Ro.decode.bind(Ro),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!==vr?(this.encode=n.encode||this.defaultEncoder,this.decode=n.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let l=null;Cr&&Cr.addEventListener&&(Cr.addEventListener("pagehide",c=>{this.conn&&(this.disconnect(),l=this.connectClock)}),Cr.addEventListener("pageshow",c=>{l===this.connectClock&&(l=null,this.connect())}),Cr.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=Ks(n.params||{}),this.endPoint=`${i}/${Ld.websocket}`,this.vsn=n.vsn||Db,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new qp(()=>{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 vr}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=Ho.appendParams(Ho.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=Ks(i)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==vr?this.connectWithFallback(vr,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===vr?"LongPoll":i.name}transportConnect(){this.connectClock++,this.closeWasClean=!1;let i;this.authToken&&(i=["phoenix",`${Dd}${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(),Ub,"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===Vn.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(va.error,i)})}connectionState(){switch(this.conn&&this.conn.readyState){case Vn.connecting:return"connecting";case Vn.open:return"open";case Vn.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 Bb(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 Ys{constructor(n,r){const l=Ib(r);this.presence=new qb(n.getChannel(),l),this.presence.onJoin((c,d,h)=>{const m=Ys.onJoinPayload(c,d,h);n.getChannel().trigger("presence",m)}),this.presence.onLeave((c,d,h)=>{const m=Ys.onLeavePayload(c,d,h);n.getChannel().trigger("presence",m)}),this.presence.onSync(()=>{n.getChannel().trigger("presence",{event:"sync"})})}get state(){return Ys.transformState(this.presence.state)}static transformState(n){return n=Pb(n),Object.getOwnPropertyNames(n).reduce((r,l)=>{const c=n[l];return r[l]=zo(c),r},{})}static onJoinPayload(n,r,l){const c=Yg(r),d=zo(l);return{event:"join",key:n,currentPresences:c,newPresences:d}}static onLeavePayload(n,r,l){const c=Yg(r),d=zo(l);return{event:"leave",key:n,currentPresences:c,leftPresences:d}}}function zo(i){return i.metas.map(n=>(n.presence_ref=n.phx_ref,delete n.phx_ref,delete n.phx_ref_prev,n))}function Pb(i){return JSON.parse(JSON.stringify(i))}function Ib(i){return i?.events&&{events:i.events}}function Yg(i){return i?.metas?zo(i):[]}var Jg;(function(i){i.SYNC="sync",i.JOIN="join",i.LEAVE="leave"})(Jg||(Jg={}));class Gb{get state(){return this.presenceAdapter.state}constructor(n,r){this.channel=n,this.presenceAdapter=new Ys(this.channel.channelAdapter,r)}}function Vb(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 Kb{constructor(n,r,l){const c=Yb(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>Eb){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===Za.joined}isJoined(){return this.state===Za.joined}isJoining(){return this.state===Za.joining}isClosed(){return this.state===Za.closed}isLeaving(){return this.state===Za.leaving}updateFilterBindings(n){this.channel.filterBindings=n}updatePayloadTransform(n){this.channel.onMessage=n}getChannel(){return this.channel}}function Yb(i){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},i.config)}}const Jb=/[,()"\\]/,Wb=i=>Jb.test(i)||i!==i.trim(),Xb=i=>`"${i.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,Wg=i=>{const n=i===null?"null":String(i);return Wb(n)?Xb(n):n},Qb=i=>i===null?"null":String(i),Zb=(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=>Wg(c)).join(",")})`}return i==="is"?`is.${Qb(n)}`:`${i}.${Wg(n)}`};class Fb{constructor(){this.filters=[]}add(n,r,l,c=!1){const d=c?"not.":"";return this.filters.push(`${n}=${d}${Zb(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 Xg;(function(i){i.ALL="*",i.INSERT="INSERT",i.UPDATE="UPDATE",i.DELETE="DELETE"})(Xg||(Xg={}));var Nr;(function(i){i.BROADCAST="broadcast",i.PRESENCE="presence",i.POSTGRES_CHANGES="postgres_changes",i.SYSTEM="system"})(Nr||(Nr={}));var ba;(function(i){i.SUBSCRIBED="SUBSCRIBED",i.TIMED_OUT="TIMED_OUT",i.CLOSED="CLOSED",i.CHANNEL_ERROR="CHANNEL_ERROR"})(ba||(ba={}));class Js{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 Kb(this.socket.socketAdapter,n,this.params),this.presence=new Gb(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=Hp(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:[],w=!!this.bindings[Nr.PRESENCE]&&this.bindings[Nr.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:w}),postgres_changes:p,private:g};this.socket.accessTokenValue&&(b.access_token=this.socket.accessTokenValue),this._onError(A=>{n?.(ba.CHANNEL_ERROR,Vb(A))}),this._onClose(()=>n?.(ba.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?.(ba.SUBSCRIBED);return}this._updatePostgresBindings(A,n)}).receive("error",A=>{this.state=Za.errored;const C=Object.values(A).join(", ")||"error";n?.(ba.CHANNEL_ERROR,new Error(C,{cause:A}))}).receive("timeout",()=>{n?.(ba.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:w,table:b,filter:T}}=g,A=n&&n[m];if(A&&A.event===p&&Js.isFilterValueEqual(A.schema,w)&&Js.isFilterValueEqual(A.table,b)&&Js.isFilterValueEqual(A.filter,T))h.push(Object.assign(Object.assign({},g),{id:A.id}));else{this.unsubscribe(),this.state=Za.errored,r?.(ba.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=h,this.state!=Za.errored&&r&&r(ba.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===Nr.PRESENCE||n===Nr.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 w=p.statusText;try{const b=await p.json();w=b.error||b.message||w}catch{}return Promise.reject(new Error(w))}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 Fb||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,w;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===((w=r?.event)===null||w===void 0?void 0:w.toLocaleLowerCase())}else return T.type.toLocaleLowerCase()===b})}_notThisChannelEvent(n,r){const{close:l,error:c,leave:d,join:h}=zp;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=Kg(n.columns,n.record)),(n.type==="UPDATE"||n.type==="DELETE")&&(r.old=Kg(n.columns,n.old_record)),r}}class eS{constructor(n,r){this.socket=new $b(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()==jd.connecting}isDisconnecting(){return this.socket.connectionState()==jd.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const Qg={HEARTBEAT_INTERVAL:25e3},tS=[1e3,2e3,5e3,1e4],nS=1e4;function aS(){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 iS(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return aS()}const rS=`
16
+ addEventListener("message", (e) => {
17
+ if (e.data.event === "start") {
18
+ setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
19
+ }
20
+ });`;class sS{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 Ab,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 eS(n,c),this.httpEndpoint=Hp(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()||jd.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 Js(`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:wb};r&&c.updateJoinPayload(d),c.joinedOnce&&c.channelAdapter.isJoined()&&c.channelAdapter.push(zp.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([rS],{type:"application/javascript"});r=URL.createObjectURL(l)}return r}_initializeOptions(n){var r,l,c,d,h,m,g,p,w,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:kb,C.heartbeatIntervalMs=(d=n?.heartbeatIntervalMs)!==null&&d!==void 0?d:Qg.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(h=n?.disconnectOnEmptyChannelsAfterMs)!==null&&h!==void 0?h:2*((m=n?.heartbeatIntervalMs)!==null&&m!==void 0?m:Qg.HEARTBEAT_INTERVAL),C.transport=(g=n?.transport)!==null&&g!==void 0?g:bb.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:iS(),C.reconnectAfterMs=(w=n?.reconnectAfterMs)!==null&&w!==void 0?w:($=>tS[$-1]||nS);let z,G;const I=(b=n?.vsn)!==null&&b!==void 0?b:Tb;switch(I){case _b:z=($,O)=>O(JSON.stringify($)),G=($,O)=>O(JSON.parse($));break;case Up:z=this.serializer.encode.bind(this.serializer),G=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${C.vsn}`)}if(C.vsn=I,C.encode=(T=n?.encode)!==null&&T!==void 0?T:z,C.decode=(A=n?.decode)!==null&&A!==void 0?A:G,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 tl=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 lS(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 oS(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 cS(i){const n=i.fetchImpl??globalThis.fetch;return{async request({method:r,path:l,query:c,body:d,headers:h}){const m=lS(i.baseUrl,l,c),g=await oS(i.auth),p=await n(m,{method:r,headers:{...d?{"Content-Type":"application/json"}:{},...g,...h},body:d?JSON.stringify(d):void 0}),w=await p.text(),b=(p.headers.get("content-type")||"").includes("application/json"),T=b&&w?JSON.parse(w):w;if(!p.ok){const A=b?T:void 0,C=A?.error;throw new tl(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 jo(i){return i.join("")}var uS=class{constructor(i,n=""){this.client=i,this.prefix=n}async listNamespaces(i){const n=i?{parent:jo(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/${jo(i.namespace)}`})}async loadNamespaceMetadata(i){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${jo(i.namespace)}`})).data.properties}}async namespaceExists(i){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${jo(i.namespace)}`}),!0}catch(n){if(n instanceof tl&&n.status===404)return!1;throw n}}async createNamespaceIfNotExists(i,n){try{return await this.createNamespace(i,n)}catch(r){if(r instanceof tl&&r.status===409)return;throw r}}};function br(i){return i.join("")}var dS=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/${br(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/${br(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/${br(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/${br(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/${br(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/${br(i.namespace)}/tables/${i.name}`,headers:n}),!0}catch(r){if(r instanceof tl&&r.status===404)return!1;throw r}}async createTableIfNotExists(i,n){try{return await this.createTable(i,n)}catch(r){if(r instanceof tl&&r.status===409)return await this.loadTable({namespace:i.namespace,name:n.name});throw r}}},hS=class{constructor(i){let n="v1";i.catalogName&&(n+=`/${i.catalogName}`);const r=i.baseUrl.endsWith("/")?i.baseUrl:`${i.baseUrl}/`;this.client=cS({baseUrl:r,auth:i.auth,fetchImpl:i.fetch}),this.accessDelegation=i.accessDelegation?.join(","),this.namespaceOps=new uS(this.client,n),this.tableOps=new dS(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 nl(i){"@babel/helpers - typeof";return nl=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},nl(i)}function fS(i,n){if(nl(i)!="object"||!i)return i;var r=i[Symbol.toPrimitive];if(r!==void 0){var l=r.call(i,n);if(nl(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(i)}function mS(i){var n=fS(i,"string");return nl(n)=="symbol"?n:n+""}function gS(i,n,r){return(n=mS(n))in i?Object.defineProperty(i,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):i[n]=r,i}function Zg(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 ue(i){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?Zg(Object(r),!0).forEach(function(l){gS(i,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(r)):Zg(Object(r)).forEach(function(l){Object.defineProperty(i,l,Object.getOwnPropertyDescriptor(r,l))})}return i}var Jo=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 Wo(i){return typeof i=="object"&&i!==null&&"__isStorageError"in i}var Md=class extends Jo{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 ue({},super.toJSON())}},$p=class extends Jo{constructor(i,n,r="storage"){super(i,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=n}};function qo(i,n,r){const l=ue({},i),c=n.toLowerCase();for(const d of Object.keys(l))d.toLowerCase()===c&&delete l[d];return l[c]=r,l}function pS(i){const n={};for(const[r,l]of Object.entries(i))n[r.toLowerCase()]=l;return n}const yS=i=>i?(...n)=>i(...n):(...n)=>fetch(...n),vS=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)},Ud=i=>{if(Array.isArray(i))return i.map(r=>Ud(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]=Ud(l)}),n},bS=i=>!i||typeof i!="string"||i.length===0||i.length>100||i.trim()!==i||i.includes("/")||i.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(i),Fg=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)},SS=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 Md(Fg(h),d,m,l))}).catch(()=>{const h=d+"";n(new Md(c.statusText||`HTTP ${d} error`,d,h,l))})}else n(new $p(Fg(i),i,l))},wS=(i,n,r,l)=>{const c={method:i,headers:n?.headers||{}};if(i==="GET"||i==="HEAD"||!l)return ue(ue({},c),r);if(vS(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=qo(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),ue(ue({},c),r)};async function Hs(i,n,r,l,c,d,h){return new Promise((m,g)=>{i(r,wS(n,l,c,d)).then(p=>{if(!p.ok)throw p;if(l?.noResolveJson)return p;if(h==="vectors"){const w=p.headers.get("content-type");if(p.headers.get("content-length")==="0"||p.status===204)return{};if(!w||!w.includes("application/json"))return{}}return p.json()}).then(p=>m(p)).catch(p=>SS(p,g,l,h))})}function Pp(i="storage"){return{get:async(n,r,l,c)=>Hs(n,"GET",r,l,c,void 0,i),post:async(n,r,l,c,d)=>Hs(n,"POST",r,c,d,l,i),put:async(n,r,l,c,d)=>Hs(n,"PUT",r,c,d,l,i),head:async(n,r,l,c)=>Hs(n,"HEAD",r,ue(ue({},l),{},{noResolveJson:!0}),c,void 0,i),remove:async(n,r,l,c,d)=>Hs(n,"DELETE",r,c,d,l,i)}}const _S=Pp("storage"),{get:al,post:Cn,put:zd,head:TS,remove:il}=_S,rn=Pp("vectors");var Ur=class{constructor(i,n={},r,l="storage"){this.shouldThrowOnError=!1,this.url=i,this.headers=pS(n),this.fetch=yS(r),this.namespace=l}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(i,n){return this.headers=qo(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(Wo(r))return{data:null,error:r};throw r}}};let Ip;Ip=Symbol.toStringTag;var kS=class{constructor(i,n){this.downloadFn=i,this.shouldThrowOnError=n,this[Ip]="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(Wo(n))return{data:null,error:n};throw n}}};let Gp;Gp=Symbol.toStringTag;var ES=class{constructor(i,n){this.downloadFn=i,this.shouldThrowOnError=n,this[Gp]="BlobDownloadBuilder",this.promise=null}asStream(){return new kS(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(Wo(n))return{data:null,error:n};throw n}}};const md={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},ep={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var AS=class extends Ur{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=ue(ue({},ep),l);let m=ue(ue({},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=qo(m,T,A);const p=c._removeEmptyFolders(n),w=c._getFinalPath(p),b=await(i=="PUT"?zd:Cn)(c.fetch,`${c.url}/object/${w}`,d,ue({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=ue(ue({},ep),l);let w=ue(ue({},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,w["cache-control"]=`max-age=${p.cacheControl}`,w["content-type"]=p.contentType,b&&(w["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))w=qo(w,T,A);return{path:d,fullPath:(await zd(c.fetch,m.toString(),g,ue({headers:w},p?.duplex?{duplex:p.duplex}:{}))).Key}})}async createSignedUploadUrl(i,n){var r=this;return r.handleOperation(async()=>{let l=r._getFinalPath(i);const c=ue({},r.headers);n?.upsert&&(c["x-upsert"]="true");const d=await Cn(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 Jo("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 Cn(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 Cn(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 Cn(l.fetch,`${l.url}/object/sign/${c}`,ue({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 Cn(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=>ue(ue({},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=()=>al(this.fetch,`${this.url}/${l}/${h}${d?`?${d}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new ES(m,this.shouldThrowOnError)}async info(i){var n=this;const r=n._getFinalPath(i);return n.handleOperation(async()=>Ud(await al(n.fetch,`${n.url}/object/info/${r}`,{headers:n.headers})))}async exists(i){var n=this;const r=n._getFinalPath(i);try{return await TS(n.fetch,`${n.url}/object/${r}`,{headers:n.headers}),{data:!0,error:null}}catch(c){if(n.shouldThrowOnError)throw c;if(Wo(c)){var l;const d=c instanceof Md?c.status:c instanceof $p?(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 il(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 il(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?ue(ue({},md.sortBy),n.sortBy):md.sortBy,d=ue(ue(ue({},md),n),{},{sortBy:c,prefix:i||""});return await Cn(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=ue({},i);return await Cn(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 xS="2.110.0",ol={"X-Client-Info":`storage-js/${xS}`};var CS=class extends Ur{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=ue(ue({},ol),n);super(d,h,r,"storage")}async listBuckets(i){var n=this;return n.handleOperation(async()=>{const r=n.listBucketOptionsToQueryString(i);return await al(n.fetch,`${n.url}/bucket${r}`,{headers:n.headers})})}async getBucket(i){var n=this;return n.handleOperation(async()=>await al(n.fetch,`${n.url}/bucket/${i}`,{headers:n.headers}))}async createBucket(i,n={public:!1}){var r=this;return r.handleOperation(async()=>await Cn(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 zd(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 Cn(n.fetch,`${n.url}/bucket/${i}/empty`,{},{headers:n.headers}))}async deleteBucket(i){var n=this;return n.handleOperation(async()=>await il(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 il(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():""}},OS=class extends Ur{constructor(i,n={},r){const l=i.replace(/\/$/,""),c=ue(ue({},ol),n);super(l,c,r,"storage")}async createBucket(i){var n=this;return n.handleOperation(async()=>await Cn(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 al(n.fetch,c,{headers:n.headers})})}async deleteBucket(i){var n=this;return n.handleOperation(async()=>await il(n.fetch,`${n.url}/bucket/${i}`,{},{headers:n.headers}))}from(i){var n=this;if(!bS(i))throw new Jo("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 hS({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}}}}})}},RS=class extends Ur{constructor(i,n={},r){const l=i.replace(/\/$/,""),c=ue(ue({},ol),{},{"Content-Type":"application/json"},n);super(l,c,r,"vectors")}async createIndex(i){var n=this;return n.handleOperation(async()=>await rn.post(n.fetch,`${n.url}/CreateIndex`,i,{headers:n.headers})||{})}async getIndex(i,n){var r=this;return r.handleOperation(async()=>await rn.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:i,indexName:n},{headers:r.headers}))}async listIndexes(i){var n=this;return n.handleOperation(async()=>await rn.post(n.fetch,`${n.url}/ListIndexes`,i,{headers:n.headers}))}async deleteIndex(i,n){var r=this;return r.handleOperation(async()=>await rn.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:i,indexName:n},{headers:r.headers})||{})}},jS=class extends Ur{constructor(i,n={},r){const l=i.replace(/\/$/,""),c=ue(ue({},ol),{},{"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 rn.post(n.fetch,`${n.url}/PutVectors`,i,{headers:n.headers})||{})}async getVectors(i){var n=this;return n.handleOperation(async()=>await rn.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 rn.post(n.fetch,`${n.url}/ListVectors`,i,{headers:n.headers}))}async queryVectors(i){var n=this;return n.handleOperation(async()=>await rn.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 rn.post(n.fetch,`${n.url}/DeleteVectors`,i,{headers:n.headers})||{})}},NS=class extends Ur{constructor(i,n={},r){const l=i.replace(/\/$/,""),c=ue(ue({},ol),{},{"Content-Type":"application/json"},n);super(l,c,r,"vectors")}async createBucket(i){var n=this;return n.handleOperation(async()=>await rn.post(n.fetch,`${n.url}/CreateVectorBucket`,{vectorBucketName:i},{headers:n.headers})||{})}async getBucket(i){var n=this;return n.handleOperation(async()=>await rn.post(n.fetch,`${n.url}/GetVectorBucket`,{vectorBucketName:i},{headers:n.headers}))}async listBuckets(i={}){var n=this;return n.handleOperation(async()=>await rn.post(n.fetch,`${n.url}/ListVectorBuckets`,i,{headers:n.headers}))}async deleteBucket(i){var n=this;return n.handleOperation(async()=>await rn.post(n.fetch,`${n.url}/DeleteVectorBucket`,{vectorBucketName:i},{headers:n.headers})||{})}},LS=class extends NS{constructor(i,n={}){super(i,n.headers||{},n.fetch)}from(i){return new DS(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)}},DS=class extends RS{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,ue(ue({},i),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(i={}){var n=()=>super.listIndexes,r=this;return n().call(r,ue(ue({},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 MS(this.url,this.headers,this.vectorBucketName,i,this.fetch)}},MS=class extends jS{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,ue(ue({},i),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(i){var n=()=>super.getVectors,r=this;return n().call(r,ue(ue({},i),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(i={}){var n=()=>super.listVectors,r=this;return n().call(r,ue(ue({},i),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(i){var n=()=>super.queryVectors,r=this;return n().call(r,ue(ue({},i),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(i){var n=()=>super.deleteVectors,r=this;return n().call(r,ue(ue({},i),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},US=class extends CS{constructor(i,n={},r,l){super(i,n,r,l)}from(i){return new AS(this.url,this.headers,i,this.fetch)}get vectors(){return new LS(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new OS(this.url+"/iceberg",this.headers,this.fetch)}};const Vp="2.110.0",Sa=30*1e3,Gs=3,gd=Gs*Sa,zS=2*Sa,BS="http://localhost:9999",HS="supabase.auth.token",qS={"X-Client-Info":`gotrue-js/${Vp}`},Bd="X-Supabase-Api-Version",Kp={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},$S=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,PS=600*1e3;class rl 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 IS extends rl{constructor(n,r,l){super(n,r,l),this.name="AuthApiError",this.status=r,this.code=l}}function GS(i){return X(i)&&i.name==="AuthApiError"}class On extends rl{constructor(n,r){super(n),this.name="AuthUnknownError",this.originalError=r}}class Yn extends rl{constructor(n,r,l,c){super(n,l,c),this.name=r,this.status=l}}class wt extends Yn{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function No(i){return X(i)&&i.name==="AuthSessionMissingError"}class Sr extends Yn{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Lo extends Yn{constructor(n){super(n,"AuthInvalidCredentialsError",400,void 0)}}class Do extends Yn{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 VS(i){return X(i)&&i.name==="AuthImplicitGrantRedirectError"}class tp extends Yn{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 KS extends Yn{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 Hd extends Yn{constructor(n,r){super(n,"AuthRetryableFetchError",r,void 0)}}function np(i){return X(i)&&i.name==="AuthRetryableFetchError"}class ap extends Yn{constructor(n="Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)"){super(n,"AuthRefreshDiscardedError",409,void 0)}}function YS(i){return X(i)&&i.name==="AuthRefreshDiscardedError"}class ip extends Yn{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 $o extends Yn{constructor(n){super(n,"AuthInvalidJwtError",400,"invalid_jwt")}}const Po="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),rp=`
21
+ \r=`.split(""),JS=(()=>{const i=new Array(128);for(let n=0;n<i.length;n+=1)i[n]=-1;for(let n=0;n<rp.length;n+=1)i[rp[n].charCodeAt(0)]=-2;for(let n=0;n<Po.length;n+=1)i[Po[n].charCodeAt(0)]=n;return i})();function sp(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(Po[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(Po[l]),n.queuedBits-=6}}function Yp(i,n,r){const l=JS[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 lp(i){const n=[],r=h=>{n.push(String.fromCodePoint(h))},l={utf8seq:0,codepoint:0},c={queue:0,queuedBits:0},d=h=>{QS(h,l,r)};for(let h=0;h<i.length;h+=1)Yp(i.charCodeAt(h),c,d);return n.join("")}function WS(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 XS(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}WS(l,n)}}function QS(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 Dr(i){const n=[],r={queue:0,queuedBits:0},l=c=>{n.push(c)};for(let c=0;c<i.length;c+=1)Yp(i.charCodeAt(c),r,l);return new Uint8Array(n)}function ZS(i){const n=[];return XS(i,r=>n.push(r)),new Uint8Array(n)}function xi(i){const n=[],r={queue:0,queuedBits:0},l=c=>{n.push(c)};return i.forEach(c=>sp(c,r,l)),sp(null,r,l),n.join("")}function FS(i){return Math.round(Date.now()/1e3)+i}function ew(){return Symbol("auth-callback")}const Nt=()=>typeof window<"u"&&typeof document<"u",Ti={tested:!1,writable:!1},Jp=()=>{if(!Nt())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Ti.tested)return Ti.writable;const i=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(i,i),globalThis.localStorage.removeItem(i),Ti.tested=!0,Ti.writable=!0}catch{Ti.tested=!0,Ti.writable=!1}return Ti.writable};function tw(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 Wp=i=>i?(...n)=>i(...n):(...n)=>fetch(...n),nw=i=>typeof i=="object"&&i!==null&&"status"in i&&"ok"in i&&"json"in i&&typeof i.json=="function",Or=async(i,n,r)=>{await i.setItem(n,JSON.stringify(r))},En=async(i,n)=>{const r=await i.getItem(n);if(!r)return null;try{return JSON.parse(r)}catch{return null}},ct=async(i,n)=>{await i.removeItem(n)};class Xo{constructor(){this.promise=new Xo.promiseConstructor((n,r)=>{this.resolve=n,this.reject=r})}}Xo.promiseConstructor=Promise;function Mo(i){const n=i.split(".");if(n.length!==3)throw new $o("Invalid JWT structure");for(let l=0;l<n.length;l++)if(!$S.test(n[l]))throw new $o("JWT not in base64url format");return{header:JSON.parse(lp(n[0])),payload:JSON.parse(lp(n[1])),signature:Dr(n[2]),raw:{header:n[0],payload:n[1]}}}async function aw(i){return await new Promise(n=>{setTimeout(()=>n(null),i)})}function iw(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 rw(i){return("0"+i.toString(16)).substr(-2)}function sw(){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,rw).join("")}async function lw(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 ow(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 lw(i);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function ki(i,n,r=!1){const l=sw();let c=l;r&&(c+="/recovery"),await Or(i,`${n}-code-verifier`,c);const d=await ow(l);return[d,l===d?"plain":"s256"]}const cw=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function uw(i){const n=i.headers.get(Bd);if(!n||!n.match(cw))return null;try{return new Date(`${n}T00:00:00.0Z`)}catch{return null}}function dw(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 hw(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 fw=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function pa(i){if(!fw.test(i))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function An(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 pd(){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 mw(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 op(i){return JSON.parse(JSON.stringify(i))}const Ai=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)},gw=[500,501,502,503,504,520,521,522,523,524,525,526,527,528,529,530];async function cp(i){var n;if(!nw(i))throw new Hd(Ai(i),0);if(gw.includes(i.status))throw new Hd(Ai(i),i.status);let r;try{r=await i.json()}catch(d){throw new On(Ai(d),d)}let l;const c=uw(i);if(c&&c.getTime()>=Kp["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 ip(Ai(r),i.status,((n=r.weak_password)===null||n===void 0?void 0:n.reasons)||[]);if(l==="session_not_found")throw new wt}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 ip(Ai(r),i.status,r.weak_password.reasons);throw new IS(Ai(r),i.status||500,l)}const pw=(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 te(i,n,r,l){var c;const d=Object.assign({},l?.headers);d[Bd]||(d[Bd]=Kp["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 yw(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 yw(i,n,r,l,c,d){const h=pw(n,l,c,d);let m;try{m=await i(r,Object.assign({},h))}catch(g){throw console.error(g),new Hd(Ai(g),0)}if(m.ok||await cp(m),l?.noResolveJson)return m;try{return await m.json()}catch(g){await cp(g)}}function yn(i){var n;let r=null;Sw(i)&&(r=Object.assign({},i),i.expires_at||(r.expires_at=FS(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 up(i){const n=yn(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 Fa(i){var n;return{data:{user:(n=i.user)!==null&&n!==void 0?n:i},error:null}}function vw(i){return{data:i,error:null}}function bw(i){const{action_link:n,email_otp:r,hashed_token:l,redirect_to:c,verification_type:d}=i,h=Yo(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 dp(i){return i}function Sw(i){return!!i.access_token&&!!i.refresh_token&&!!i.expires_in}const yd=["global","local","others"];class ww{constructor({url:n="",headers:r={},fetch:l,experimental:c}){this.url=n,this.headers=r,this.fetch=Wp(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=yd[0]){if(yd.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${yd.join(", ")}`);try{return await te(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 te(this.fetch,"POST",`${this.url}/invite`,{body:{email:n,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:Fa})}catch(l){if(X(l))return{data:{user:null},error:l};throw l}}async generateLink(n){try{const{options:r}=n,l=Yo(n,["options"]),c=Object.assign(Object.assign({},l),r);return"newEmail"in l&&(c.new_email=l?.newEmail,delete c.newEmail),await te(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:c,headers:this.headers,xform:bw,redirectTo:r?.redirectTo})}catch(r){if(X(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(n){try{return await te(this.fetch,"POST",`${this.url}/admin/users`,{body:n,headers:this.headers,xform:Fa})}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},w=await te(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:dp});if(w.error)throw w.error;const b=await w.json(),T=(h=w.headers.get("x-total-count"))!==null&&h!==void 0?h:0,A=(g=(m=w.headers.get("link"))===null||m===void 0?void 0:m.split(","))!==null&&g!==void 0?g:[];return A.length>0&&(A.forEach(C=>{const z=parseInt(C.split(";")[0].split("=")[1].substring(0,1)),G=JSON.parse(C.split(";")[1].split("=")[1]);p[`${G}Page`]=z}),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){pa(n);try{return await te(this.fetch,"GET",`${this.url}/admin/users/${n}`,{headers:this.headers,xform:Fa})}catch(r){if(X(r))return{data:{user:null},error:r};throw r}}async updateUserById(n,r){pa(n);try{return await te(this.fetch,"PUT",`${this.url}/admin/users/${n}`,{body:r,headers:this.headers,xform:Fa})}catch(l){if(X(l))return{data:{user:null},error:l};throw l}}async deleteUser(n,r=!1){pa(n);try{return await te(this.fetch,"DELETE",`${this.url}/admin/users/${n}`,{headers:this.headers,body:{should_soft_delete:r},xform:Fa})}catch(l){if(X(l))return{data:{user:null},error:l};throw l}}async _listFactors(n){pa(n.userId);try{const{data:r,error:l}=await te(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){pa(n.userId),pa(n.id);try{return{data:await te(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},w=await te(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:dp});if(w.error)throw w.error;const b=await w.json(),T=(h=w.headers.get("x-total-count"))!==null&&h!==void 0?h:0,A=(g=(m=w.headers.get("link"))===null||m===void 0?void 0:m.split(","))!==null&&g!==void 0?g:[];return A.length>0&&(A.forEach(C=>{const z=parseInt(C.split(";")[0].split("=")[1].substring(0,1)),G=JSON.parse(C.split(";")[1].split("=")[1]);p[`${G}Page`]=z}),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 te(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 te(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 te(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 te(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 te(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 te(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 te(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 te(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 te(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 te(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){An(this.experimental),pa(n.userId);try{return await te(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){An(this.experimental),pa(n.userId),pa(n.passkeyId);try{return await te(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 hp(i={}){return{getItem:n=>i[n]||null,setItem:(n,r)=>{i[n]=r},removeItem:n=>{delete i[n]}}}globalThis&&Jp()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug");class _w extends Error{constructor(n){super(n),this.isAcquireTimeout=!0}}function Tw(){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 Xp(i){if(!/^0x[a-fA-F0-9]{40}$/.test(i))throw new Error(`@supabase/auth-js: Address "${i}" is invalid.`);return i.toLowerCase()}function kw(i){return parseInt(i,16)}function Ew(i){const n=new TextEncoder().encode(i);return"0x"+Array.from(n,l=>l.toString(16).padStart(2,"0")).join("")}function Aw(i){var n;const{chainId:r,domain:l,expirationTime:c,issuedAt:d=new Date,nonce:h,notBefore:m,requestId:g,resources:p,scheme:w,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
+ `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${i.statement}`)}const A=Xp(i.address),C=w?`${w}://${l}`:l,z=i.statement?`${i.statement}
23
+ `:"",G=`${C} wants you to sign in with your Ethereum account:
24
+ ${A}
25
+
26
+ ${z}`;let I=`URI: ${b}
27
+ Version: ${T}
28
+ Chain ID: ${r}${h?`
29
+ Nonce: ${h}`:""}
30
+ Issued At: ${d.toISOString()}`;if(c&&(I+=`
31
+ Expiration Time: ${c.toISOString()}`),m&&(I+=`
32
+ Not Before: ${m.toISOString()}`),g&&(I+=`
33
+ Request ID: ${g}`),p){let $=`
34
+ Resources:`;for(const O of p){if(!O||typeof O!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${O}`);$+=`
35
+ - ${O}`}I+=$}return`${G}
36
+ ${I}`}class gt 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 Io extends gt{constructor(n,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:n}),this.name="WebAuthnUnknownError",this.originalError=r}}function xw({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 gt({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 gt({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 gt({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 gt({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 gt({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:i});if(i.name==="NotAllowedError")return new gt({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 gt({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:i}):new gt({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(Qp(h)){if(d.rp.id!==h)return new gt({message:`The RP ID "${d.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:i})}else return new gt({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 gt({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 gt({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 gt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:i})}function Cw({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 gt({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:i})}else{if(i.name==="NotAllowedError")return new gt({message:i.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:i});if(i.name==="SecurityError"){const l=window.location.hostname;if(Qp(l)){if(r.rpId!==l)return new gt({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:i})}else return new gt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:i})}else if(i.name==="UnknownError")return new gt({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 gt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:i})}class Ow{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 qd=new Ow;function fp(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=Yo(i,["challenge","user","excludeCredentials"]),d=Dr(n).buffer,h=Object.assign(Object.assign({},r),{id:Dr(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:Dr(p.id).buffer,type:p.type||"public-key",transports:p.transports})}}return m}function mp(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=Yo(i,["challenge","allowCredentials"]),c=Dr(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:Dr(m.id).buffer,type:m.type||"public-key",transports:m.transports})}}return d}function gp(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:xi(new Uint8Array(i.response.attestationObject)),clientDataJSON:xi(new Uint8Array(i.response.clientDataJSON))},type:"public-key",clientExtensionResults:i.getClientExtensionResults(),authenticatorAttachment:(n=r.authenticatorAttachment)!==null&&n!==void 0?n:void 0}}function pp(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:xi(new Uint8Array(c.authenticatorData)),clientDataJSON:xi(new Uint8Array(c.clientDataJSON)),signature:xi(new Uint8Array(c.signature)),userHandle:c.userHandle?xi(new Uint8Array(c.userHandle)):void 0},type:"public-key",clientExtensionResults:l,authenticatorAttachment:(n=r.authenticatorAttachment)!==null&&n!==void 0?n:void 0}}function Qp(i){return i==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(i)}function Go(){var i,n;return!!(Nt()&&"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 Zp(i){try{const n=await navigator.credentials.create(i);return n?n instanceof PublicKeyCredential?{data:n,error:null}:{data:null,error:new Io("Browser returned unexpected credential type",n)}:{data:null,error:new Io("Empty credential response",n)}}catch(n){return{data:null,error:xw({error:n,options:i})}}}async function Fp(i){try{const n=await navigator.credentials.get(i);return n?n instanceof PublicKeyCredential?{data:n,error:null}:{data:null,error:new Io("Browser returned unexpected credential type",n)}:{data:null,error:new Io("Empty credential response",n)}}catch(n){return{data:null,error:Cw({error:n,options:i})}}}const Rw={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},jw={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Vo(...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]=Vo(m,h):l[d]=Vo(h)}else l[d]=h}return l}function Nw(i,n){return Vo(Rw,i,n||{})}function Lw(i,n){return Vo(jw,i,n||{})}class Dw{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??qd.createNewAbortSignal();if(m.webauthn.type==="create"){const{user:w}=m.webauthn.credential_options.publicKey;if(!w.name){const b=l;if(b)w.name=`${w.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";w.name=`${w.id}:${C}`}}w.displayName||(w.displayName=w.name)}switch(m.webauthn.type){case"create":{const w=Nw(m.webauthn.credential_options.publicKey,d?.create),{data:b,error:T}=await Zp({publicKey:w,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 w=Lw(m.webauthn.credential_options.publicKey,d?.request),{data:b,error:T}=await Fp(Object.assign(Object.assign({},m.webauthn.credential_options),{publicKey:w,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 On("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 rl("rpId is required for WebAuthn authentication")};try{if(!Go())return{data:null,error:new On("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 On("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 rl("rpId is required for WebAuthn registration")};try{if(!Go())return{data:null,error:new On("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(w=>{var b;return(b=w.data)===null||b===void 0?void 0:b.all.find(T=>T.factor_type==="webauthn"&&T.friendly_name===n&&T.status!=="unverified")}).then(w=>w?this.client.mfa.unenroll({factorId:w?.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 On("Unexpected error in register",h)}}}}Tw();const Mw={url:BS,storageKey:HS,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:qS,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},wr={};class sl{get jwks(){var n,r;return(r=(n=wr[this.storageKey])===null||n===void 0?void 0:n.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(n){wr[this.storageKey]=Object.assign(Object.assign({},wr[this.storageKey]),{jwks:n})}get jwks_cached_at(){var n,r;return(r=(n=wr[this.storageKey])===null||n===void 0?void 0:n.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(n){wr[this.storageKey]=Object.assign(Object.assign({},wr[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({},Mw),n);if(this.storageKey=d.storageKey,this.instanceID=(r=sl.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,sl.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!d.debug,typeof d.debug=="function"&&(this.logger=d.debug),this.instanceID>0&&Nt()){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 ww({url:d.url,headers:d.headers,fetch:d.fetch,experimental:this.experimental}),this.url=d.url,this.headers=d.headers,this.fetch=Wp(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 Dw(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:Jp()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=hp(this.memoryStorage)),d.userStorage&&(this.userStorage=d.userStorage)):(this.memoryStorage={},this.storage=hp(this.memoryStorage)),Nt()&&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} (${Vp}) ${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(Nt()&&(r=tw(window.location.href),this._isImplicitGrantCallback(r)?l="implicit":await this._isPKCECallback(r)&&(l="pkce")),Nt()&&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),VS(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 On("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(n){var r,l,c;try{const d=await te(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:yn}),{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:w,password:b,options:T}=n;let A=null,C=null;this.flowType==="pkce"&&([A,C]=await ki(this.storage,this.storageKey)),d=await te(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:T?.emailRedirectTo,body:{email:w,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:yn})}else if("phone"in n){const{phone:w,password:b,options:T}=n;d=await te(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:w,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:yn})}else throw new Lo("You must provide either an email or phone number and a password");const{data:h,error:m}=d;if(m||!h)return await ct(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 ct(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 te(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:up})}else if("phone"in n){const{phone:d,password:h,options:m}=n;r=await te(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:up})}else throw new Lo("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 Sr;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,w,b,T;let A,C;if("message"in n)A=n.message,C=n.signature;else{const{chain:z,wallet:G,statement:I,options:$}=n;let O;if(Nt())if(typeof G=="object")O=G;else{const Se=window;if("ethereum"in Se&&typeof Se.ethereum=="object"&&"request"in Se.ethereum&&typeof Se.ethereum.request=="function")O=Se.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 G!="object"||!$?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");O=G}const J=new URL((r=$?.url)!==null&&r!==void 0?r:window.location.href),me=await O.request({method:"eth_requestAccounts"}).then(Se=>Se).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!me||me.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const ae=Xp(me[0]);let K=(l=$?.signInWithEthereum)===null||l===void 0?void 0:l.chainId;if(!K){const Se=await O.request({method:"eth_chainId"});K=kw(Se)}const Ee={domain:J.host,address:ae,statement:I,uri:J.href,version:"1",chainId:K,nonce:(c=$?.signInWithEthereum)===null||c===void 0?void 0:c.nonce,issuedAt:(h=(d=$?.signInWithEthereum)===null||d===void 0?void 0:d.issuedAt)!==null&&h!==void 0?h:new Date,expirationTime:(m=$?.signInWithEthereum)===null||m===void 0?void 0:m.expirationTime,notBefore:(g=$?.signInWithEthereum)===null||g===void 0?void 0:g.notBefore,requestId:(p=$?.signInWithEthereum)===null||p===void 0?void 0:p.requestId,resources:(w=$?.signInWithEthereum)===null||w===void 0?void 0:w.resources};A=Aw(Ee),C=await O.request({method:"personal_sign",params:[Ew(A),ae]})}try{const{data:z,error:G}=await te(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:yn});if(G)throw G;if(!z||!z.session||!z.user){const I=new Sr;return this._returnResult({data:{user:null,session:null},error:I})}return z.session&&(await this._saveSession(z.session),await this._notifyAllSubscribers("SIGNED_IN",z.session)),this._returnResult({data:Object.assign({},z),error:G})}catch(z){if(X(z))return this._returnResult({data:{user:null,session:null},error:z});throw z}}async signInWithSolana(n){var r,l,c,d,h,m,g,p,w,b,T,A;let C,z;if("message"in n)C=n.message,z=n.signature;else{const{chain:G,wallet:I,statement:$,options:O}=n;let J;if(Nt())if(typeof I=="object")J=I;else{const ae=window;if("solana"in ae&&typeof ae.solana=="object"&&("signIn"in ae.solana&&typeof ae.solana.signIn=="function"||"signMessage"in ae.solana&&typeof ae.solana.signMessage=="function"))J=ae.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 I!="object"||!O?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");J=I}const me=new URL((r=O?.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in J&&J.signIn){const ae=await J.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},O?.signInWithSolana),{version:"1",domain:me.host,uri:me.href}),$?{statement:$}:null));let K;if(Array.isArray(ae)&&ae[0]&&typeof ae[0]=="object")K=ae[0];else if(ae&&typeof ae=="object"&&"signedMessage"in ae&&"signature"in ae)K=ae;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in K&&"signature"in K&&(typeof K.signedMessage=="string"||K.signedMessage instanceof Uint8Array)&&K.signature instanceof Uint8Array)C=typeof K.signedMessage=="string"?K.signedMessage:new TextDecoder().decode(K.signedMessage),z=K.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in J)||typeof J.signMessage!="function"||!("publicKey"in J)||typeof J!="object"||!J.publicKey||!("toBase58"in J.publicKey)||typeof J.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");C=[`${me.host} wants you to sign in with your Solana account:`,J.publicKey.toBase58(),...$?["",$,""]:[""],"Version: 1",`URI: ${me.href}`,`Issued At: ${(c=(l=O?.signInWithSolana)===null||l===void 0?void 0:l.issuedAt)!==null&&c!==void 0?c:new Date().toISOString()}`,...!((d=O?.signInWithSolana)===null||d===void 0)&&d.notBefore?[`Not Before: ${O.signInWithSolana.notBefore}`]:[],...!((h=O?.signInWithSolana)===null||h===void 0)&&h.expirationTime?[`Expiration Time: ${O.signInWithSolana.expirationTime}`]:[],...!((m=O?.signInWithSolana)===null||m===void 0)&&m.chainId?[`Chain ID: ${O.signInWithSolana.chainId}`]:[],...!((g=O?.signInWithSolana)===null||g===void 0)&&g.nonce?[`Nonce: ${O.signInWithSolana.nonce}`]:[],...!((p=O?.signInWithSolana)===null||p===void 0)&&p.requestId?[`Request ID: ${O.signInWithSolana.requestId}`]:[],...!((b=(w=O?.signInWithSolana)===null||w===void 0?void 0:w.resources)===null||b===void 0)&&b.length?["Resources",...O.signInWithSolana.resources.map(K=>`- ${K}`)]:[]].join(`
37
+ `);const ae=await J.signMessage(new TextEncoder().encode(C),"utf8");if(!ae||!(ae instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");z=ae}}try{const{data:G,error:I}=await te(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:C,signature:xi(z)},!((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:yn});if(I)throw I;if(!G||!G.session||!G.user){const $=new Sr;return this._returnResult({data:{user:null,session:null},error:$})}return G.session&&(await this._saveSession(G.session),await this._notifyAllSubscribers("SIGNED_IN",G.session)),this._returnResult({data:Object.assign({},G),error:I})}catch(G){if(X(G))return this._returnResult({data:{user:null,session:null},error:G});throw G}}async _exchangeCodeForSession(n){const r=await En(this.storage,`${this.storageKey}-code-verifier`),[l,c]=(r??"").split("/");try{if(!l&&this.flowType==="pkce")throw new KS;const{data:d,error:h}=await te(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:n,code_verifier:l},xform:yn});if(await ct(this.storage,`${this.storageKey}-code-verifier`),h)throw h;if(!d||!d.session||!d.user){const m=new Sr;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 ct(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 te(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:yn}),{data:g,error:p}=m;if(p)return this._returnResult({data:{user:null,session:null},error:p});if(!g||!g.session||!g.user){const w=new Sr;return this._returnResult({data:{user:null,session:null},error:w})}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,w=null;this.flowType==="pkce"&&([p,w]=await ki(this.storage,this.storageKey));const{error:b}=await te(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:w},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:w}=await te(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:w})}throw new Lo("You must provide either an email or phone number.")}catch(m){if(await ct(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 te(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},n),{gotrue_meta_security:{captcha_token:d}}),redirectTo:c,xform:yn});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 ki(this.storage,this.storageKey));const p=await te(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:vw});return!((d=p.data)===null||d===void 0)&&d.url&&Nt()&&!(!((h=n.options)===null||h===void 0)&&h.skipBrowserRedirect)&&window.location.assign(p.data.url),this._returnResult(p)}catch(m){if(await ct(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 wt;const{error:c}=await te(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 ki(this.storage,this.storageKey));const{error:g}=await te(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 ct(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 te(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 Lo("You must provide either an email or phone number and a type")}catch(r){if(await ct(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 En(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()<gd:!1;if(this._debug("#__loadSession()",`session has${l?"":" not"} expired`,"expires_at",n.expires_at),!l){if(this.userStorage){const h=await En(this.userStorage,this.storageKey+"-user");h?.user?n.user=h.user:n.user=pd()}if(this.storage.isServer&&n.user&&!n.user.__isUserNotAvailableProxy){const h={value:this.suppressGetSessionWarning};n.user=mw(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 En(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 te(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:n,xform:Fa}):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 wt}:await te(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:Fa})})}catch(r){if(X(r))return No(r)&&(await this._removeSession(),await ct(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 wt;const h=c.session;let m=null,g=null;this.flowType==="pkce"&&n.email!=null&&([m,g]=await ki(this.storage,this.storageKey));const{data:p,error:w}=await te(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:Fa});if(w)throw w;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 ct(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 wt;const r=Date.now()/1e3;let l=r,c=!0,d=null;const{payload:h}=Mo(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 wt;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(!Nt())throw new Do("No browser detected.");if(n.error||n.error_description||n.error_code)throw new Do(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 tp("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Do("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 tp("No code detected.");const{data:O,error:J}=await this._exchangeCodeForSession(n.code);if(J)throw J;const me=new URL(window.location.href);return me.searchParams.delete("code"),window.history.replaceState(window.history.state,"",me.toString()),{data:{session:O.session,redirectType:(l=O.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:w}=n;if(!h||!g||!m||!w)throw new Do("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<=Sa&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${C}s, should have been closer to ${T}s`);const z=A-T;b-z>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",z,A,b):b-z<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",z,A,b);const{data:G,error:I}=await this._getUser(h);if(I)throw I;const $={provider_token:c,provider_refresh_token:d,access_token:h,expires_in:T,expires_at:A,refresh_token:m,token_type:w,user:G.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:$,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 En(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&&!No(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&&!(GS(m)&&(m.status===404||m.status===401||m.status===403)||No(m)))return this._returnResult({error:m})}return n!=="others"&&(await this._removeSession(),await ct(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(n){const r=ew(),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),No(d)?console.warn(d):console.error(d)}})}async resetPasswordForEmail(n,r={}){let l=null,c=null;this.flowType==="pkce"&&([l,c]=await ki(this.storage,this.storageKey,!0));try{return await te(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 ct(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,w;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 te(this.fetch,"GET",A,{headers:this.headers,jwt:(w=(p=b.session)===null||p===void 0?void 0:p.access_token)!==null&&w!==void 0?w:void 0})});if(c)throw c;return Nt()&&!(!((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:w}=n,b=await te(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:w,link_identity:!0,gotrue_meta_security:{captcha_token:h?.captchaToken}},xform:yn}),{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 Sr}):(T.session&&(await this._saveSession(T.session),await this._notifyAllSubscribers("USER_UPDATED",T.session)),this._returnResult({data:T,error:A}))}catch(c){if(await ct(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 te(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 iw(async c=>(c>0&&await aw(200*Math.pow(2,c-1)),this._debug(r,"refreshing attempt",c),await te(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:n},headers:this.headers,xform:yn})),(c,d)=>{const h=200*Math.pow(2,c);return d&&np(d)&&Date.now()+h-l<Sa})}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),Nt()&&!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 En(this.storage,this.storageKey);if(c&&this.userStorage){let h=await En(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!h&&(h={user:c.user},await Or(this.userStorage,this.storageKey+"-user",h)),c.user=(n=h?.user)!==null&&n!==void 0?n:pd()}else if(c&&!c.user&&!c.user){const h=await En(this.storage,this.storageKey+"-user");h&&h?.user?(c.user=h.user,await ct(this.storage,this.storageKey+"-user"),await Or(this.storage,this.storageKey,c)):c.user=pd()}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()<gd;if(this._debug(l,`session has${d?"":" not"} expired with margin of ${gd}s`),d){if(this.autoRefreshToken&&c.refresh_token){const{error:h}=await this._callRefreshToken(c.refresh_token);h&&(YS(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 wt;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 Xo;const d=await En(this.storage,this.storageKey),{data:h,error:m}=await this._refreshAccessToken(n);if(m)throw m;if(!h.session)throw new wt;const g=await En(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 ap};return this.refreshingDeferred.resolve(T),T}const w=this._sessionRemovalEpoch;if(await this._saveSession(h.session),this._sessionRemovalEpoch!==w){this._debug(c,"commit guard (post-save): _removeSession ran during _saveSession, undoing write"),await ct(this.storage,this.storageKey),this.userStorage&&await ct(this.userStorage,this.storageKey+"-user");const T={data:null,error:new ap};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(!np(d)){const m=await En(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()+zS},(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 ct(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 Or(this.userStorage,this.storageKey+"-user",{user:r.user});const c=Object.assign({},r);delete c.user;const d=op(c);await Or(this.storage,this.storageKey,d)}else{const c=op(r);await Or(this.storage,this.storageKey,c)}}async _removeSession(){this._sessionRemovalEpoch+=1,this._debug("#_removeSession()"),this.lastRefreshFailure=null,this.suppressGetSessionWarning=!1,await ct(this.storage,this.storageKey),await ct(this.storage,this.storageKey+"-code-verifier"),await ct(this.storage,this.storageKey+"-user"),this.userStorage&&await ct(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const n=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{n&&Nt()&&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(),Sa);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)/Sa);this._debug("#_autoRefreshTokenTick()",`access token expires in ${c} ticks, a tick lasts ${Sa}ms, refresh threshold is ${Gs} ticks`),c<=Gs&&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 _w)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)/Sa);this._debug("#_autoRefreshTokenTick()",`access token expires in ${c} ticks, a tick lasts ${Sa}ms, refresh threshold is ${Gs} ticks`),c<=Gs&&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()"),!Nt()||!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 ki(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 te(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 te(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"?gp(n.webauthn.credential_response):pp(n.webauthn.credential_response)})}:{code:n.code}),{data:g,error:p}=await te(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 te(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:fp(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:mp(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}=Mo(n);let C=null;A.aal&&(C=A.aal);let z=C;const{data:{user:G},error:I}=await this.getUser(n);if(I)return this._returnResult({data:null,error:I});((l=(r=G?.factors)===null||r===void 0?void 0:r.filter(J=>J.status==="verified"))!==null&&l!==void 0?l:[]).length>0&&(z="aal2");const O=A.amr||[];return{data:{currentLevel:C,nextLevel:z,currentAuthenticationMethods:O},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}=Mo(h.access_token);let p=null;g.aal&&(p=g.aal);let w=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&&(w="aal2");const T=g.amr||[];return{data:{currentLevel:p,nextLevel:w,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 te(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 wt})})}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 wt});const h=await te(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&&Nt()&&!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 wt});const h=await te(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&&Nt()&&!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 te(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 wt})})}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 te(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 wt})})}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+PS>c)return l;const{data:d,error:h}=await te(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}}=Mo(l);if(!r?.allowExpired)try{dw(d.exp)}catch(A){throw new $o(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 w=hw(c.alg),b=await crypto.subtle.importKey("jwk",p,w,!0,["verify"]);if(!await crypto.subtle.verify(w,b,h,ZS(`${m}.${g}`)))throw new $o("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;An(this.experimental);try{if(!Go())return this._returnResult({data:null,error:new On("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=mp(d.options),g=(c=(l=n?.options)===null||l===void 0?void 0:l.signal)!==null&&c!==void 0?c:qd.createNewAbortSignal(),{data:p,error:w}=await Fp({publicKey:m,signal:g});if(w||!p)return this._returnResult({data:null,error:w??new On("WebAuthn ceremony failed",null)});const b=pp(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;An(this.experimental);try{if(!Go())return this._returnResult({data:null,error:new On("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=fp(c.options),m=(l=(r=n?.options)===null||r===void 0?void 0:r.signal)!==null&&l!==void 0?l:qd.createNewAbortSignal(),{data:g,error:p}=await Zp({publicKey:h,signal:m});if(p||!g)return this._returnResult({data:null,error:p??new On("WebAuthn ceremony failed",null)});const w=gp(g);return this._verifyPasskeyRegistration({challengeId:c.challenge_id,credential:w})}catch(c){if(X(c))return this._returnResult({data:null,error:c});throw c}}async _startPasskeyRegistration(){An(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 wt});const{data:c,error:d}=await te(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){An(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 wt});const{data:d,error:h}=await te(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;An(this.experimental);try{const{data:l,error:c}=await te(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){An(this.experimental);try{const{data:r,error:l}=await te(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:n.challengeId,credential:n.credential},xform:yn});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(){An(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 wt});const{data:c,error:d}=await te(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){An(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 wt});const{data:d,error:h}=await te(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){An(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 wt});const{error:d}=await te(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}}}sl.nextInstanceID={};const Uw=sl,zw="2.110.0";let Vs="",Ko;if(typeof Deno<"u"){var vd;Vs="deno",Ko=(vd=Deno.version)===null||vd===void 0?void 0:vd.deno}else if(typeof document<"u")Vs="web";else if(typeof navigator<"u"&&navigator.product==="ReactNative")Vs="react-native";else{var bd;Vs="node",Ko=typeof process<"u"?(bd=process.version)===null||bd===void 0?void 0:bd.replace(/^v/,""):void 0}const ey=[`runtime=${Vs}`];Ko&&ey.push(`runtime-version=${Ko}`);const Bw={"X-Client-Info":`supabase-js/${zw}; ${ey.join("; ")}`},Hw={headers:Bw},qw={schema:"public"},$w={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Pw={},Iw={enabled:!1,respectSamplingDecision:!0};function Gw(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(w){try{p(l.next(w))}catch(b){h(b)}}function g(w){try{p(l.throw(w))}catch(b){h(b)}}function p(w){w.done?d(w.value):c(w.value).then(m,g)}p((l=l.apply(i,[])).next())})}let Sd=null;const Vw="@opentelemetry/api";function Kw(){return Sd===null&&(Sd=import(Vw).catch(()=>null)),Sd}function Yw(){return Gw(this,void 0,void 0,function*(){try{const i=yield Kw();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 Jw(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 Ww(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(Xw(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 Xw(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 Qw(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 ll(i){"@babel/helpers - typeof";return ll=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},ll(i)}function Zw(i,n){if(ll(i)!="object"||!i)return i;var r=i[Symbol.toPrimitive];if(r!==void 0){var l=r.call(i,n);if(ll(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(i)}function Fw(i){var n=Zw(i,"string");return ll(n)=="symbol"?n:n+""}function e_(i,n,r){return(n=Fw(n))in i?Object.defineProperty(i,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):i[n]=r,i}function yp(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 rt(i){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?yp(Object(r),!0).forEach(function(l){e_(i,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(r)):yp(Object(r)).forEach(function(l){Object.defineProperty(i,l,Object.getOwnPropertyDescriptor(r,l))})}return i}const t_=i=>i?(...n)=>i(...n):(...n)=>fetch(...n),n_=()=>Headers,a_=(i,n,r,l,c)=>{const d=t_(l),h=n_(),m=c?.enabled===!0,g=c?.respectSamplingDecision!==!1,p=m?Qw(n):null;return async(w,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 z=await i_(w,p,g);z&&(z.traceparent&&!C.has("traceparent")&&C.set("traceparent",z.traceparent),z.tracestate&&!C.has("tracestate")&&C.set("tracestate",z.tracestate),z.baggage&&!C.has("baggage")&&C.set("baggage",z.baggage))}return d(w,rt(rt({},b),{},{headers:C}))}};async function i_(i,n,r){if(!Ww(typeof i=="string"||i instanceof URL?i:i.url,n))return null;const l=await Yw();if(!l||!l.traceparent)return null;if(r){const c=Jw(l.traceparent);if(c&&!c.isSampled)return null}return l}function vp(i){return typeof i=="boolean"?{enabled:i}:i}function r_(i){return i.endsWith("/")?i:i+"/"}function s_(i,n){var r,l,c,d,h,m;const{db:g,auth:p,realtime:w,global:b}=i,{db:T,auth:A,realtime:C,global:z}=n,G=vp(i.tracePropagation),I=vp(n.tracePropagation),$={db:rt(rt({},T),g),auth:rt(rt({},A),p),realtime:rt(rt({},C),w),storage:{},global:rt(rt(rt({},z),b),{},{headers:rt(rt({},(r=z?.headers)!==null&&r!==void 0?r:{}),(l=b?.headers)!==null&&l!==void 0?l:{})}),tracePropagation:{enabled:(c=(d=G?.enabled)!==null&&d!==void 0?d:I?.enabled)!==null&&c!==void 0?c:!1,respectSamplingDecision:(h=(m=G?.respectSamplingDecision)!==null&&m!==void 0?m:I?.respectSamplingDecision)!==null&&h!==void 0?h:!0},accessToken:async()=>""};return i.accessToken?$.accessToken=i.accessToken:delete $.accessToken,$}function l_(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(r_(n))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var o_=class extends Uw{constructor(i){super(i)}},c_=class{constructor(i,n,r){var l,c;this.supabaseUrl=i,this.supabaseKey=n;const d=l_(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:qw,realtime:Pw,auth:rt(rt({},$w),{},{storageKey:h}),global:Hw,tracePropagation:Iw},g=s_(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:(w,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=a_(n,i,this._getAccessToken.bind(this),g.global.fetch,g.tracePropagation),this.realtime=this._initRealtimeClient(rt({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},g.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(w=>this.realtime.setAuth(w)).catch(w=>console.warn("Failed to set initial Realtime auth token:",w)),this.rest=new vb(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 US(this.storageUrl.href,this.headers,this.fetch,r?.storage),g.accessToken||this._listenForAuthEvents()}get functions(){return new cb(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:w,lockAcquireTimeout:b,skipAutoInitialize:T},A,C){const z={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new o_({url:this.authUrl.href,headers:rt(rt({},z),A),storageKey:d,autoRefreshToken:i,persistSession:n,detectSessionInUrl:r,storage:l,userStorage:c,flowType:h,lock:m,debug:g,throwOnError:p,experimental:w,fetch:C,lockAcquireTimeout:b,skipAutoInitialize:T,hasCustomAuthorizationHeader:Object.keys(this.headers).some(G=>G.toLowerCase()==="authorization")})}_initRealtimeClient(i){return new sS(this.realtimeUrl.href,rt(rt({},i),{},{params:rt(rt({},{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 u_=(i,n,r)=>new c_(i,n,r);function d_(){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}d_()&&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 h_="https://otbyfkjxrkngvjziawki.supabase.co",f_="sb_publishable_NpUs0RDJH2YnllsqTKO6TQ_1jTdSsNQ",Kn=u_(h_,f_,{auth:{autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"pkce",storageKey:"livedesk.mindexec.supabase.auth"}}),Ws=new WeakMap;function m_(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 g_(i){return String(i.frameMode||i.mode||"").toLowerCase()==="mode3-h264-hw"||String(i.codec||"").toLowerCase()==="h264"||String(i.mimeType||"").toLowerCase()==="video/h264"}function bp(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 p_(i,n){const r=new Uint8Array(n);let l=0,c=0;for(;l<i.length;){const d=i[l];l+=1;const h=bp(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=bp(i,l,d&15);l=p.cursor;const w=p.length+4;if(c+w>r.length)throw new Error("Invalid LZ4 block: match overrun.");let b=c-g;for(let T=0;T<w;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 y_(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=p_(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 Sp(i){const n=window.VideoDecoder;if(!n||!window.EncodedVideoChunk)throw new Error("WebCodecs H.264 decode is not supported in this browser.");const r=Ws.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:()=>{Ws.delete(i)}}),configured:!1,configKey:"",keyFrameSeen:!1};return Ws.set(i,c),c}function $d(i){const n=Ws.get(i);if(n){try{n.decoder.state!=="closed"&&n.decoder.close()}catch{}Ws.delete(i)}}function v_(i,n){const r=String(n.h264Format||"").toLowerCase()==="avc"?"avc":"annexb",l=Math.max(1,Math.floor(n.width||960)),c=Math.max(1,Math.floor(n.height||540)),d=[n.streamId||"",n.commandId||"",l,c,r].join("|");let h=Sp(i);if(h.configured&&h.configKey!==d&&($d(i),h=Sp(i)),!h.configured){const p={codec:"avc1.42E01E",codedWidth:l,codedHeight:c,hardwareAcceleration:"prefer-hardware",optimizeForLatency:!0,avc:{format:r}};h.decoder.configure(p),h.configured=!0,h.configKey=d,h.keyFrameSeen=!1}const m=n.isKeyFrame===!0||String(n.chunkType||"").toLowerCase()==="key";if(!m&&!h.keyFrameSeen)return;m&&(h.keyFrameSeen=!0);const g=new EncodedVideoChunk({type:m?"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});h.decoder.decode(g)}async function b_(i,n,r){if(g_(n)){r()||v_(i,n);return}if(m_(n)){$d(i);const g=y_(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}$d(i);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 Xs=5179,Mt=cl(`http://127.0.0.1:${Xs}`);function S_(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 w_(i){const n=i.trim().toLowerCase();return n==="localhost"||n==="127.0.0.1"||n==="::1"||n==="[::1]"}function __(i){const n=i.trim().toLowerCase();return!n||n==="0.0.0.0"||n==="::"||n==="[::]"}function T_(i){const n=S_(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 k_(i){return i.includes(":")&&!i.startsWith("[")?`[${i}]`:i}function E_(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||__(c)?null:{host:c,port:d}}catch{return null}}function cl(i){const n=String(i||"").trim()||`http://127.0.0.1:${Xs}`,r=/^[a-z][a-z\d+.-]*:\/\//i.test(n)?n:`http://${n}`;try{const l=new URL(r);return l.port||(l.port=String(Xs)),l.hash="",l.search="",l.toString().replace(/\/+$/,"")}catch{return`http://127.0.0.1:${Xs}`}}function A_(i){const n=E_(i);return n?cl(`http://${k_(n.host)}:${Xs}`):""}function wp(i){const r=[i?.endpoint,...Array.isArray(i?.endpoint_candidates)?i.endpoint_candidates:[]].map(l=>A_(String(l||""))).filter(Boolean);return[...new Set(r)]}function Qs(i=Mt){if(!(typeof window>"u"||window.location.protocol!=="https:"))try{const n=new URL(i);if(n.protocol!=="http:")return;if(w_(n.hostname))return"loopback";if(T_(n.hostname))return"local"}catch{return}}function Kd(i,n=Mt){const r=new URL(i,cl(n));return r.protocol=r.protocol==="https:"?"wss:":"ws:",r.toString()}async function xn(i,n,r=Mt){const l=cl(r),c={...n,headers:{"Content-Type":"application/json",...n?.headers||{}},cache:"no-store"},d=Qs(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 x_(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 qs(i){await navigator.clipboard.writeText(i)}const _p="livedesk_remote_host_targets",C_="livedesk_entitlements";function O_(i){const r=(Array.isArray(i)?i:[i||Mt]).map(l=>cl(l||Mt));return[...new Set(r.filter(Boolean))]}function R_(){const[i,n]=H.useState(null),[r,l]=H.useState(!0);return H.useEffect(()=>{let c=!0;Kn.auth.getSession().then(({data:h})=>{c&&(n(h.session??null),l(!1))});const{data:{subscription:d}}=Kn.auth.onAuthStateChange((h,m)=>{n(m),l(!1)});return()=>{c=!1,d.unsubscribe()}},[]),{session:i,loading:r}}function j_(i,n=!0){const[r,l]=H.useState(null),[c,d]=H.useState([]),[h,m]=H.useState(""),[g,p]=H.useState(""),[w,b]=H.useState(0),T=Array.isArray(i)?i.join(`
38
+ `):String(i||""),A=H.useMemo(()=>O_(i),[T]),C=H.useMemo(()=>A.find(I=>Qs(I)==="loopback")||A[0]||Mt,[A]),z=H.useCallback(async()=>{if(!n){l(null),d([]),p(""),m("");return}let I=null;for(const $ of A)try{const[O,J]=await Promise.all([xn("/api/remote/status",void 0,$),xn("/api/remote/devices",void 0,$)]);l(O),d(J.devices||[]),p($),m("");return}catch(O){I=O}throw p(""),I||new Error("No LiveDesk Hub endpoint is reachable.")},[n,A]),G=H.useCallback(()=>{z().catch(I=>{m(I instanceof Error?I.message:String(I))}),b(I=>I+1)},[z]);return H.useEffect(()=>{if(!n){l(null),d([]),p(""),m("");return}let I=!0;const $=async()=>{try{await z()}catch(J){I&&m(J instanceof Error?J.message:String(J))}};$();const O=window.setInterval($,2500);return()=>{I=!1,window.clearInterval(O)}},[n,z,w]),{status:r,devices:c,error:h,refresh:G,hubBaseUrl:g||C,hubCandidates:A}}function N_(i){const[n,r]=H.useState(null),[l,c]=H.useState(""),d=i?.user?.id||"",h=H.useCallback(async()=>{if(!d){r(null);return}const{data:m,error:g}=await Kn.from(_p).select("*").eq("user_id",d).maybeSingle();if(g){c(g.message);return}r(m),c("")},[d]);return H.useEffect(()=>{h()},[h]),H.useEffect(()=>{if(!d)return;const m=Kn.channel(`livedesk-remote-host-targets-${d.replace(/[^a-zA-Z0-9]/g,"")}`).on("postgres_changes",{event:"*",schema:"public",table:_p,filter:`user_id=eq.${d}`},g=>r(g.new)).subscribe();return()=>{Kn.removeChannel(m)}},[d]),{target:n,error:l,refresh:h}}function L_(i){const[n,r]=H.useState(null),[l,c]=H.useState(!1),[d,h]=H.useState(""),m=i?.user?.id||"",g=H.useCallback(async()=>{if(!m){r(null),h(""),c(!1);return}c(!0);const{data:w,error:b}=await Kn.from(C_).select("*").eq("user_id",m).eq("product_key","livedesk").maybeSingle();if(b){h(b.message),c(!1);return}r(w),h(""),c(!1)},[m]);H.useEffect(()=>{g()},[g]);const p=H.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}}const wd={totalFrames:0,totalBytes:0,framesPerSecond:0,bytesPerSecond:0,sampleMs:0,lastUpdatedAt:0};function D_(i,n,r=Mt,l={}){const[c,d]=H.useState(new Map),[h,m]=H.useState("idle"),[g,p]=H.useState(wd),w=H.useRef({totalFrames:0,totalBytes:0,sampleFrames:0,sampleBytes:0,sampleStartedAt:0}),b=H.useMemo(()=>[...i].sort().join(","),[i]),T=Number.isFinite(l.fps)?Number(l.fps):2,A=Number.isFinite(l.maxWidth)?Number(l.maxWidth):640,C=Number.isFinite(l.maxHeight)?Number(l.maxHeight):360,z=Number.isFinite(l.quality)?Number(l.quality):45,G=String(l.frameMode||l.mode||"mode3-h264-hw").trim()||"mode3-h264-hw",I=H.useMemo(()=>{const $=Object.entries(l.monitorSelections||{}).filter(([O])=>!!O).sort(([O],[J])=>O.localeCompare(J));return JSON.stringify(Object.fromEntries($))},[l.monitorSelections]);return H.useEffect(()=>{const $=b?b.split(",").filter(Boolean):[];if($.length===0){m("idle"),d(new Map),w.current={totalFrames:0,totalBytes:0,sampleFrames:0,sampleBytes:0,sampleStartedAt:0},p(wd);return}const O=new WebSocket(Kd(`/api/remote/frames/ws?devices=${encodeURIComponent($.join(","))}`,r));O.binaryType="arraybuffer",m("connecting");const J=performance.now();w.current={totalFrames:0,totalBytes:0,sampleFrames:0,sampleBytes:0,sampleStartedAt:J},p({...wd,lastUpdatedAt:Date.now()}),O.addEventListener("open",()=>{m("open"),O.send(JSON.stringify({type:"subscribe",deviceIds:$,autoStartLive:n,fps:T,maxWidth:A,maxHeight:C,quality:z,mode:G,frameMode:G,monitorSelections:l.monitorSelections||{}}))}),O.addEventListener("message",ae=>{if(typeof ae.data=="string")return;const K=ae.data instanceof ArrayBuffer?ae.data:null;if(!K||K.byteLength<5)return;const Se=new DataView(K).getUint32(0,!1);if(Se<=0||Se+4>K.byteLength)return;const Yt=new Uint8Array(K.slice(4,4+Se)),F=JSON.parse(new TextDecoder().decode(Yt)),Ce=K.slice(4+Se),Ye=w.current;Ye.totalFrames+=1,Ye.totalBytes+=Ce.byteLength,Ye.sampleFrames+=1,Ye.sampleBytes+=Ce.byteLength;const Je={deviceId:String(F.deviceId||""),kind:F.kind==="thumbnail"?"thumbnail":"live",frameSeq:Number(F.frameSeq||0),streamId:String(F.streamId||""),commandId:F.commandId?String(F.commandId):void 0,width:Number(F.width||0),height:Number(F.height||0),mimeType:String(F.mimeType||"image/jpeg"),mode:F.mode?String(F.mode):void 0,frameMode:F.frameMode?String(F.frameMode):void 0,frameProfile:F.frameProfile?String(F.frameProfile):void 0,encoding:F.encoding?String(F.encoding):void 0,codec:F.codec?String(F.codec):void 0,compression:F.compression?String(F.compression):void 0,pixelFormat:F.pixelFormat?String(F.pixelFormat):void 0,bytesPerPixel:Number(F.bytesPerPixel||0)||0,uncompressedByteLength:Number(F.uncompressedByteLength||0)||0,h264Format:F.h264Format?String(F.h264Format):void 0,isKeyFrame:F.isKeyFrame===!0,chunkType:F.chunkType?String(F.chunkType):void 0,timestampUs:Number(F.timestampUs||0)||0,durationUs:Number(F.durationUs||0)||0,hardwareEncoder:F.hardwareEncoder?String(F.hardwareEncoder):void 0,platformProfile:F.platformProfile?String(F.platformProfile):void 0,monitorIndex:Number.isFinite(Number(F.monitorIndex))?Number(F.monitorIndex):void 0,monitorCount:Number.isFinite(Number(F.monitorCount))?Number(F.monitorCount):void 0,capturedAt:String(F.capturedAt||""),receivedAt:String(F.receivedAt||""),byteLength:Number(F.byteLength||Ce.byteLength),contentHash:F.contentHash?String(F.contentHash):void 0,payload:Ce};Je.deviceId&&d(ze=>{const D=ze.get(Je.deviceId);if(D&&D.frameSeq>Je.frameSeq)return ze;const V=new Map(ze);return V.set(Je.deviceId,Je),V})}),O.addEventListener("error",()=>m("error")),O.addEventListener("close",()=>m("closed"));const me=window.setInterval(()=>{const ae=performance.now(),K=w.current,Ee=Math.max(1,ae-K.sampleStartedAt);p({totalFrames:K.totalFrames,totalBytes:K.totalBytes,framesPerSecond:K.sampleFrames*1e3/Ee,bytesPerSecond:K.sampleBytes*1e3/Ee,sampleMs:Ee,lastUpdatedAt:Date.now()}),K.sampleFrames=0,K.sampleBytes=0,K.sampleStartedAt=ae},2e3);return()=>{window.clearInterval(me),O.close()}},[n,b,T,G,r,C,A,I,l.monitorSelections,z]),{frames:c,state:h,stats:g}}function M_(i,n=Mt){const r=H.useRef(null),[l,c]=H.useState("idle");H.useEffect(()=>{if(!i){r.current?.close(),r.current=null,c("idle");return}const h=new WebSocket(Kd("/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=H.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 U_(i){const n=String(i||"").toLowerCase();return n.includes("audio/pcm")||n.includes("audio/l16")||n.includes("f32le")||n.includes("s16le")}function z_(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),w=i.createBuffer(l,p,c),b=new DataView(r);for(let T=0;T<l;T+=1){const A=w.getChannelData(T);for(let C=0;C<p;C+=1){const G=(C*l+T)*m;A[C]=h?Math.max(-1,Math.min(1,b.getInt16(G,!0)/32768)):Math.max(-1,Math.min(1,b.getFloat32(G,!0)))}}return w}function B_(i,n,r=Mt){const l=H.useRef(null),c=H.useRef(0),[d,h]=H.useState("idle"),[m,g]=H.useState(null),[p,w]=H.useState("");return H.useEffect(()=>{if(!n||!i){h("idle"),g(null),w("");return}const b=window.AudioContext||window.webkitAudioContext;if(!b){h("unsupported"),w("Audio playback is not supported in this browser.");return}const T=new b;l.current=T,c.current=T.currentTime;const A=new WebSocket(Kd(`/api/remote/audio/ws?devices=${encodeURIComponent(i)}`,r));A.binaryType="arraybuffer";let C=!1;return h("connecting"),w(""),A.addEventListener("open",()=>{C||(h("open"),A.send(JSON.stringify({type:"subscribe",deviceIds:[i]})),T.resume())}),A.addEventListener("message",z=>{if(typeof z.data=="string")return;const G=z.data instanceof ArrayBuffer?z.data:null;!G||G.byteLength<5||(async()=>{try{const $=new DataView(G).getUint32(0,!1);if($<=0||$+4>G.byteLength)return;const O=new Uint8Array(G.slice(4,4+$)),J=JSON.parse(new TextDecoder().decode(O)),me=G.slice(4+$),ae={deviceId:String(J.deviceId||""),frameSeq:Number(J.frameSeq||0),streamId:String(J.streamId||""),mimeType:String(J.mimeType||"audio/webm;codecs=opus"),sampleRate:Number(J.sampleRate||48e3),channels:Number(J.channels||2),capturedAt:String(J.capturedAt||""),receivedAt:String(J.receivedAt||""),byteLength:Number(J.byteLength||me.byteLength),payload:me};if(!ae.deviceId||C)return;const K=U_(ae.mimeType)?z_(T,ae,me):await T.decodeAudioData(me.slice(0));if(C)return;const Ee=T.createBufferSource();Ee.buffer=K,Ee.connect(T.destination);const Se=Math.max(T.currentTime+.02,c.current);Ee.start(Se),c.current=Se+K.duration,g(ae),h("playing")}catch(I){C||(h("error"),w(I instanceof Error?I.message:String(I)))}})()}),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 H_=120,q_=999,_r=4,ty="livedesk.remoteDirectory",Pd="livedesk.localHubAccessEnabled",ny="livedesk.streamSettings",ay=5,$_=24*1024*1024,iy={"mode1-jpeg":5,"mode2-lz4":5,"mode3-h264-hw":12},Vt={frameMode:"mode3-h264-hw",fps:iy["mode3-h264-hw"],maxWidth:960,maxHeight:540,quality:60,autoStartLive:!0,showScreenStatus:!0,visibleOnlyLive:!0,adaptiveLoadShedding:!0,adaptiveSizeByWall:!0},Bo=[{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"}],_d=[{id:"640x360",label:"Compact",width:640,height:360},{id:"960x540",label:"Standard",width:960,height:540},{id:"1280x720",label:"HD",width:1280,height:720}],Yd=[1,2,5,8,12,20,24],P_=[45,60,75,90],Tp={large:{maxWidth:1280,maxHeight:720},medium:{maxWidth:960,maxHeight:540},small:{maxWidth:640,maxHeight:360}},Gt={visibleRootMargin:"520px 0px 760px 0px",fallbackVisibleCounts:{large:10,medium:18,small:32},maxWallFramesPerSecond:1800,maxWallBytesPerSecond:80*1024*1024,lowLoadFrameRatio:.58,lowLoadByteRatio:.52,downshiftCooldownMs:4500,recoveryCooldownMs:14e3,minFps:1};function Zs(i,n){const r=i.capabilities?.[n];return typeof r=="boolean"?r:/^(1|true|yes|on)$/i.test(String(r||"").trim())}function Fs(i){return i.deviceName||i.hostname||i.deviceId}function I_(){return"npx -y livedesk client"}function G_(){return"npx -y livedesk"}function V_(){try{return localStorage.getItem(ty)||""}catch{return""}}function K_(){try{return localStorage.getItem(Pd)==="1"}catch{return!1}}function Tr(i){try{i?localStorage.setItem(Pd,"1"):localStorage.removeItem(Pd)}catch{}}function Lr(i,n,r,l){const c=Number(i);return Number.isFinite(c)?Math.max(n,Math.min(r,Math.round(c))):l}function Id(i){const n=String(i||"").trim();return Bo.some(r=>r.id===n)?n:Vt.frameMode}function ry(i){return iy[i]||12}function Td(i){return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}function Ei(i){const n=Td(i.status),r=Td(n.screens),l=Td(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 Rr(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 Y_(){try{const i=JSON.parse(localStorage.getItem(ny)||"{}");if(i.version!==ay)return Vt;const n=Id(i.frameMode),r=Lr(i.maxWidth,320,2560,Vt.maxWidth),l=Lr(i.maxHeight,180,1440,Vt.maxHeight);return{frameMode:n,fps:Lr(i.fps,1,24,ry(n)),maxWidth:r,maxHeight:l,quality:Lr(i.quality,20,95,Vt.quality),autoStartLive:typeof i.autoStartLive=="boolean"?i.autoStartLive:Vt.autoStartLive,showScreenStatus:typeof i.showScreenStatus=="boolean"?i.showScreenStatus:Vt.showScreenStatus,visibleOnlyLive:typeof i.visibleOnlyLive=="boolean"?i.visibleOnlyLive:Vt.visibleOnlyLive,adaptiveLoadShedding:typeof i.adaptiveLoadShedding=="boolean"?i.adaptiveLoadShedding:Vt.adaptiveLoadShedding,adaptiveSizeByWall:typeof i.adaptiveSizeByWall=="boolean"?i.adaptiveSizeByWall:Vt.adaptiveSizeByWall}}catch{return Vt}}function J_(i){try{localStorage.setItem(ny,JSON.stringify({...i,version:ay}))}catch{}}function kd(i,n){return i.length!==n.length?!1:i.every((r,l)=>r===n[l])}function kp(i){return[...new Set(i.filter(Boolean))].sort()}function W_(i){return Gt.fallbackVisibleCounts[i]||Gt.fallbackVisibleCounts.large}function X_(i,n,r){if(r||!i.adaptiveSizeByWall)return{maxWidth:i.maxWidth,maxHeight:i.maxHeight};const l=Tp[n]||Tp.large;return{maxWidth:Math.min(i.maxWidth,l.maxWidth),maxHeight:Math.min(i.maxHeight,l.maxHeight)}}function Q_(i){const n=[...Yd].sort((l,c)=>l-c),r=Math.max(Gt.minFps,Math.floor(i/2));return[...n].reverse().find(l=>l<i)||r}function Z_(i,n){return[...Yd].sort((l,c)=>l-c).find(l=>l>i&&l<=n)||n}function Ci(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 F_(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 e1(i){return i===1?"middle":i===2?"right":"left"}function Ep(i,...n){for(const r of n){const l=i?.[r];if(typeof l=="string"&&l.trim())return l.trim()}return""}function $s(i){const n=Number(i);return Number.isInteger(n)&&n>=1&&n<=q_?n:0}const t1={cpu:"CPU",memory:"MEM",disk:"Disk",gpu:"GPU",npu:"NPU",temp:"Temp",network:"Net"};function n1(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=t1[c.id]||c.label;return c.value&&c.value!=="-"?`${d} ${c.value}`:d}function Qo(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 Fe(i,...n){for(const r of n){const l=Qo(i,r),c=Number(l);if(Number.isFinite(c))return c}}function Kt(i,...n){for(const r of n){const l=Qo(i,r);if(typeof l=="string"&&l.trim())return l.trim();if(typeof l=="number"&&Number.isFinite(l))return String(l)}return""}function a1(i,...n){for(const r of n){const l=Qo(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 ya(i){const n=Number(i);if(Number.isFinite(n))return Math.max(0,Math.min(1,n>1?n/100:n))}function Ed(i,n){if(!(typeof i!="number"||typeof n!="number"||!Number.isFinite(i)||!Number.isFinite(n)||i<=0))return ya((i-Math.max(0,n))/i)}function Ps(i){return i===void 0?"-":`${Math.round(i*100)}%`}function Ad(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 kr(i,n=.92,r=.78){return i===void 0?"unknown":i>=n?"critical":i>=r?"warn":"good"}function sy(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 Uo(i,n,r){const l=Qo(i,`tools.${n}`),c=Kt(i,`tools.${n}.status`,`tooling.${n}.status`,`${n}.status`).toLowerCase(),d=a1(i,`tools.${n}.running`,`tooling.${n}.running`,`${n}.running`),h=Kt(i,`tools.${n}.version`,`tooling.${n}.version`,`${n}.version`),m=Kt(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 ly(i){const n=i.status||{},r=Fe(n,"cpu.cores","cpuCores","processorCount"),l=Fe(n,"loadavg.0","cpu.load1"),c=ya(Fe(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=Fe(n,"memory.totalBytes","totalMem"),h=Fe(n,"memory.freeBytes","freeMem"),m=ya(Fe(n,"memory.usedRatio","memory.usedPct","usedMemRatio"))??Ed(d,h),g=Fe(n,"disk.totalBytes","rootDisk.totalBytes","storage.totalBytes"),p=Fe(n,"disk.freeBytes","rootDisk.freeBytes","storage.freeBytes"),w=ya(Fe(n,"disk.usedRatio","disk.usedPct","rootDisk.usedRatio","storage.usedRatio"))??Ed(g,p),b=Fe(n,"thermal.cpuC","temperatureC","cpu.temperatureC","gpu.temperatureC"),T=ya(Fe(n,"gpu.usedRatio","gpu.usageRatio","gpu.usedPct","gpu.usagePct","gpu.percent","accelerators.gpu.usageRatio")),A=Kt(n,"gpu.name","gpu.model","accelerators.gpu.name"),C=Fe(n,"gpu.memory.totalBytes","gpu.totalMemoryBytes","gpu.vramTotalBytes"),z=Fe(n,"gpu.memory.freeBytes","gpu.freeMemoryBytes","gpu.vramFreeBytes"),G=ya(Fe(n,"gpu.memory.usedRatio","gpu.vramUsedRatio"))??Ed(C,z),I=Fe(n,"gpu.temperatureC","thermal.gpuC"),$=ya(Fe(n,"npu.usedRatio","npu.usageRatio","npu.usedPct","npu.usagePct","npu.percent","accelerators.npu.usageRatio")),O=Kt(n,"npu.name","npu.model","accelerators.npu.name"),J=Fe(n,"npu.tops","npu.topsInt8","accelerators.npu.tops"),me=Fe(n,"network.rxMbps","network.receiveMbps","network.downMbps"),ae=Fe(n,"network.txMbps","network.transmitMbps","network.upMbps"),K=Fe(n,"network.latencyMs","network.rttMs"),Ee=ya(Fe(n,"network.usedRatio","network.usageRatio","network.saturationRatio")),Se=Kt(n,"network.link","network.interface","network.name"),Yt=b===void 0?void 0:ya((b-35)/60),F=Kt(n,"workload.role","role","lane")||(Zs(i,"aiAssist")?"Agent worker":Zs(i,"taskDispatch")?"Task worker":"Local machine"),Ce=Kt(i.latestTask,"status")||Kt(n,"workload.status")||"idle",Ye=Kt(i.latestTask,"title","instructionPreview")||Kt(n,"workload.title"),Je=Kt(i.latestTask,"resultSummary","error","instructionPreview")||Kt(n,"workload.summary"),ze=[Uo(n,"ollama","Ollama"),Uo(n,"lmStudio","LM Studio"),Uo(n,"comfyui","ComfyUI"),Uo(n,"stableDiffusion","Stable Diffusion")],D=ze.some(M=>M.status!=="unknown"),V=Date.parse(i.lastSeenAt||i.connectedAt||""),se=Number.isFinite(V)?Date.now()-V:0;let ne="online";i.connected?se>5*6e4?ne="stale":(b??0)>=86||(I??0)>=88||(c??0)>=.94||(T??0)>=.96||($??0)>=.96||(m??0)>=.94||(w??0)>=.94||(K??0)>=200||Ce==="failed"?ne="critical":(b??0)>=78||(I??0)>=80||(c??0)>=.82||(T??0)>=.86||($??0)>=.86||(m??0)>=.82||(w??0)>=.86||(K??0)>=80?ne="warn":(["queued","running","targeted"].includes(Ce)||ze.some(M=>M.status==="busy"))&&(ne="busy"):ne="offline";const xe=ze.filter(M=>M.status==="online"||M.status==="busy").length,E=[{id:"cpu",label:"CPU",value:Ps(c),detail:r?`${r} cores`:l!==void 0?`load ${l.toFixed(1)}`:"not reported",ratio:c,state:kr(c,.92,.78)},{id:"memory",label:"RAM",value:Ps(m),detail:d?`${Ci(d-(h||0))} / ${Ci(d)}`:"not reported",ratio:m,state:kr(m,.92,.78)},{id:"disk",label:"DISK",value:Ps(w),detail:g&&p!==void 0?`${Ci(p)} free`:"not reported",ratio:w,state:kr(w,.92,.82)},{id:"gpu",label:"GPU",value:Ps(T??G),detail:A||(C&&z!==void 0?`${Ci(z)} VRAM free`:I!==void 0?`${Math.round(I)}C`:"not reported"),ratio:T??G,state:I!==void 0&&I>=88?"critical":I!==void 0&&I>=80?"warn":kr(T??G,.96,.86)},{id:"npu",label:"NPU",value:$!==void 0?Ps($):J!==void 0?`${Math.round(J)} TOPS`:"-",detail:O||(J!==void 0?"neural engine":"not reported"),ratio:$,state:kr($,.96,.86)},{id:"temp",label:"TEMP",value:b===void 0?"-":`${Math.round(b)}C`,detail:xe>0?`${xe} local tools`:`uptime ${sy(Fe(n,"uptimeSec"))}`,ratio:Yt,state:b===void 0?"unknown":b>=86?"critical":b>=78?"warn":"good"},{id:"network",label:"NET",value:Ad(me)||(K!==void 0?`${Math.round(K)}ms`:Se||"-"),detail:Ad(ae)?`${Ad(ae)} up`:Se||"not reported",ratio:Ee,state:K!==void 0&&K>=200?"critical":K!==void 0&&K>=80?"warn":kr(Ee,.9,.75)}];return{state:ne,label:n1(ne,E,Ce),role:F,taskLabel:Ye||(Ce==="idle"?"idle":Ce),taskStatus:Ce,taskSummary:Je,tools:D?ze:ze.map(M=>({...M,detail:"not reported"})),metrics:E}}const i1=[{id:"small",label:"Small"},{id:"medium",label:"Medium"},{id:"large",label:"Large"}],r1=[{id:"wall",label:"Wall",icon:jp,accent:"blue"},{id:"control",label:"Control",icon:Od,accent:"red"},{id:"agents",label:"Agents",icon:Ar,accent:"violet"},{id:"doc",label:"Doc",icon:xd,accent:"amber"},{id:"pricing",label:"Pricing",icon:Cd,accent:"green"},{id:"settings",label:"Settings",icon:Np,accent:"gray"}];function ut(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 Er(i){return i.map(n=>ut(n))}function jt(i){return{languageName:i.languageName,languageLabel:i.languageLabel,eyebrow:i.eyebrow,title:ut(i.title),intro:ut(i.intro),sections:[{title:ut(i.managerTitle),body:ut(i.managerBody),points:Er(i.managerPoints)},{title:ut(i.clientTitle),body:ut(i.clientBody),points:Er(i.clientPoints)},{title:ut(i.syncTitle),body:ut(i.syncBody),points:Er(i.syncPoints)},{title:ut(i.platformTitle),body:ut(i.platformBody),points:Er(i.platformPoints)}],sync:{title:ut(i.syncTitle),body:ut(i.syncBody),points:Er(i.syncPoints)},firewall:{title:ut(i.firewallTitle),body:ut(i.firewallBody),points:Er(i.firewallPoints)},commands:{title:ut(i.commandsTitle),body:ut(i.commandsBody),manager:ut(i.managerCommandLabel),primary:ut(i.clientCommandLabel),slot:ut(i.slotCommandLabel),manual:ut(i.manualCommandLabel)}}}const Mr={ko:jt({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:jt({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:jt({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":jt({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":jt({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:jt({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:jt({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:jt({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":jt({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:jt({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:jt({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:jt({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:jt({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:jt({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:jt({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:jt({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ı"})},s1=Object.entries(Mr).map(([i,n])=>({id:i,label:n.languageName}));function l1(){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(Mr[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(Mr[l])return l}return"en"}function Ap({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(jr,{size:24}),y.jsxs("strong",{children:["Slot ",String(l).padStart(3,"0")]})]})]})})}function xp({device:i,frame:n,selected:r,controlEnabled:l,showStatus:c,monitorIndex:d,monitorCount:h,onSelect:m,onFocusDevice:g,onOpenControl:p,onCycleMonitor:w,sendInput:b}){const T=H.useRef(null),A=H.useRef(0),C=ly(i),z=Rr(d,h),G=h>1;H.useEffect(()=>{const O=T.current;if(!O||!n)return;let J=!1;return b_(O,n,()=>J).catch(()=>{}),()=>{J=!0}},[n]);const I=O=>{const J=O.currentTarget.getBoundingClientRect();return{normalizedX:Math.max(0,Math.min(1,(O.clientX-J.left)/Math.max(1,J.width))),normalizedY:Math.max(0,Math.min(1,(O.clientY-J.top)/Math.max(1,J.height)))}},$=(O,J)=>{if(l){if(J==="pointermove"){const me=performance.now();if(me-A.current<24)return;A.current=me}b(i.deviceId,{type:J,...I(O),button:e1(O.button)})}};return y.jsx("article",{className:`device-tile ${r?"selected":""} ${i.connected?"online":"offline"}`,"data-live-device-id":i.deviceId,children:y.jsxs("div",{className:"tile-screen",role:"button",tabIndex:l?-1:0,"aria-pressed":r,onClick:()=>{l||m()},onKeyDown:O=>{l||(O.key==="Enter"||O.key===" ")&&(O.preventDefault(),m())},onDoubleClick:O=>{O.preventDefault(),p()},children:[y.jsx("canvas",{ref:T,className:"remote-canvas",tabIndex:l?0:-1,onPointerDown:O=>{l&&(g(),O.currentTarget.focus(),O.currentTarget.setPointerCapture(O.pointerId),$(O,"pointerdown"))},onPointerMove:O=>$(O,"pointermove"),onPointerUp:O=>$(O,"pointerup"),onWheel:O=>{l&&(O.preventDefault(),b(i.deviceId,{type:"wheel",deltaX:O.deltaX,deltaY:O.deltaY}))},onKeyDown:O=>{l&&b(i.deviceId,{type:"keydown",key:O.key,code:O.code,text:O.key.length===1?O.key:"",repeat:O.repeat})},onKeyUp:O=>{l&&b(i.deviceId,{type:"keyup",key:O.key,code:O.code,text:O.key.length===1?O.key:"",repeat:!1})},onContextMenu:O=>l&&O.preventDefault()}),!n&&y.jsx("span",{className:"empty-screen",children:y.jsx(jr,{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":`${Fs(i)} status`,children:C.metrics.slice(0,3).map(O=>y.jsxs("span",{className:`tile-metric state-${O.state}`,children:[y.jsx("b",{children:O.label}),y.jsx("em",{children:O.value}),O.ratio!==void 0&&y.jsx("i",{style:{width:`${Math.round(O.ratio*100)}%`}})]},O.id))})]}),G&&y.jsxs("span",{className:"monitor-cycle","aria-label":`${Fs(i)} display ${z+1} of ${h}`,children:[y.jsx("button",{className:"monitor-cycle-button previous",onClick:O=>{O.preventDefault(),O.stopPropagation(),w(-1)},title:"Previous display",type:"button",children:y.jsx(Op,{size:18})}),y.jsxs("span",{className:"monitor-cycle-count",children:["Screen ",z+1,"/",h]}),y.jsx("button",{className:"monitor-cycle-button next",onClick:O=>{O.preventDefault(),O.stopPropagation(),w(1)},title:"Next display",type:"button",children:y.jsx(Rp,{size:18})})]})]})})}function o1(){const{session:i,loading:n}=R_(),{target:r,error:l,refresh:c}=N_(i),d=H.useMemo(()=>{if(!r?.active)return null;const S=r.expires_at?Date.parse(r.expires_at):Number.POSITIVE_INFINITY;return Number.isFinite(S)&&S<=Date.now()?null:r},[r]),h=H.useMemo(()=>wp(d),[d]),m=H.useMemo(()=>h.length>0?[...new Set([...h,Mt])]:[Mt],[h]),[g,p]=H.useState(K_),w=H.useMemo(()=>m.some(S=>!!Qs(S)),[m]),b=!w||g,{status:T,devices:A,error:C,refresh:z,hubBaseUrl:G}=j_(m,b),{entitlement:I,licensed:$,loading:O,error:J,refresh:me}=L_(i),[ae,K]=H.useState([]),[Ee,Se]=H.useState([]),[Yt,F]=H.useState(""),[Ce,Ye]=H.useState(!1),[Je,ze]=H.useState(!1),[D,V]=H.useState(""),[se,ne]=H.useState(""),[xe,E]=H.useState(""),[M,W]=H.useState("wall"),[Q,ge]=H.useState("large"),[ye,Oe]=H.useState(l1),[Xe,Qe]=H.useState(!1),[Rn,vn]=H.useState(!1),[Oi,Ri]=H.useState(!1),[Jn,zr]=H.useState(!1),[wa,Zo]=H.useState(V_),[he,ji]=H.useState(Y_),[Wn,Ni]=H.useState({}),[Br,Li]=H.useState([]),[Ie,Hr]=H.useState(he.fps),[ei,jn]=H.useState(null),[Di,qr]=H.useState(!1),$r=H.useRef(null),ul=H.useRef(null),Pr=H.useRef(!1),_a=H.useRef(0),yt=H.useRef(0),xt=H.useRef(0),Ct=M==="settings",dl=M==="pricing",hl=M==="doc",fl=!dl&&!hl,Jt=M==="control",De=H.useMemo(()=>A.filter(S=>S.connected),[A]),Mi=H.useMemo(()=>De.reduce((S,P)=>Math.max(S,$s(P.slotNumber)),0),[De]),vt=Math.max(H_,De.length,Mi),Xn=H.useMemo(()=>{const S=Array(vt).fill(null),P=[];for(const Z of De){const Y=$s(Z.slotNumber);Y>0&&Y<=vt&&!S[Y-1]?S[Y-1]=Z:P.push(Z)}for(const Z of P){const Y=S.findIndex(oe=>!oe);Y<0?S.push(Z):S[Y]=Z}return S},[De,vt]),Ta=H.useMemo(()=>De.map(S=>S.deviceId),[De]),Ir=H.useMemo(()=>new Set(ae),[ae]),ka=H.useMemo(()=>new Set(Ee),[Ee]),Nn=H.useMemo(()=>De.filter(S=>Ir.has(S.deviceId)||ka.has($s(S.slotNumber))),[De,Ir,ka]),re=H.useMemo(()=>A.find(S=>S.deviceId===Yt)||Nn[0]||null,[A,Yt,Nn]),sn=H.useMemo(()=>re?ly(re):null,[re]),ml=re?Zs(re,"control"):!1,Ui=re?Zs(re,"audio")||Zs(re,"remoteAudio"):!1,Gr=De.length<=_r,et=$||Gr,Ln=`Free plan includes up to ${_r} workstations. Upgrade to LTD for ${De.length} workstations.`,zi=et&&!!re,ti=et&&!!re&&ml,bn=et&&!!re&&Ui,tt=H.useMemo(()=>Xn.filter(S=>!!S?.connected).slice(0,W_(Q)).map(S=>S.deviceId),[Xn,Q]),_t=H.useMemo(()=>he.visibleOnlyLive?Br.length>0?Br:tt:Ta,[tt,Br,he.visibleOnlyLive,Ta]),Wt=H.useMemo(()=>et?Jt&&re?[re.deviceId]:kp(_t):[],[et,re,Jt,_t]),Dn=H.useMemo(()=>X_(he,Q,Jt),[Jt,he,Q]),Fo=H.useMemo(()=>({fps:Ie,maxWidth:Dn.maxWidth,maxHeight:Dn.maxHeight,quality:he.quality,mode:he.frameMode,frameMode:he.frameMode,monitorSelections:Wn}),[Ie,Dn,Wn,he]),{frames:Vr,state:Bi,stats:Xt}=D_(Wt,he.autoStartLive&&Wt.length>0,G,Fo),{state:Hi,sendInput:Qn}=M_(ti&&Ce,G),{state:Zn,error:Ea}=B_(re?.deviceId||"",bn&&Je,G);H.useEffect(()=>{Hr(he.fps),yt.current=Date.now(),xt.current=0},[he.fps,he.frameMode,he.adaptiveLoadShedding]),H.useEffect(()=>{if(!et||Jt||!he.visibleOnlyLive){Li([]);return}const S=$r.current;if(!S||typeof IntersectionObserver>"u"){Li(tt);return}const P=Array.from(S.querySelectorAll("[data-live-device-id]"));if(P.length===0){Li([]);return}const Z=new Map,Y=()=>{const le=kp(P.map(fe=>String(fe.dataset.liveDeviceId||"")).filter(fe=>(Z.get(fe)||0)>0));Li(fe=>kd(fe,le)?fe:le)},oe=new IntersectionObserver(le=>{for(const fe of le){const Ze=String(fe.target.dataset.liveDeviceId||"");Ze&&Z.set(Ze,fe.isIntersecting?fe.intersectionRatio||.01:0)}Y()},{root:null,rootMargin:Gt.visibleRootMargin,threshold:[0,.01,.2,.6,1]});return P.forEach(le=>oe.observe(le)),Y(),()=>oe.disconnect()},[tt,et,Jt,Xn,he.visibleOnlyLive,Q]),H.useEffect(()=>{if(!he.adaptiveLoadShedding||!he.autoStartLive||Wt.length===0||Bi!=="open"||Xt.sampleMs<500)return;const S=Date.now(),P=he.fps,Z=Wt.length*Ie,Y=Xt.framesPerSecond,oe=Xt.bytesPerSecond,le=Z>8&&Y>0&&Y<Z*.72;if(Y>Gt.maxWallFramesPerSecond||oe>Gt.maxWallBytesPerSecond||le){if(xt.current=0,S-yt.current>=Gt.downshiftCooldownMs&&Ie>Gt.minFps){const Re=Math.max(Gt.minFps,Q_(Ie));Re<Ie&&(Hr(Re),yt.current=S)}return}const Ze=Y<Gt.maxWallFramesPerSecond*Gt.lowLoadFrameRatio&&oe<Gt.maxWallBytesPerSecond*Gt.lowLoadByteRatio;if(!Ze||Ie>=P){Ze||(xt.current=0);return}if(!xt.current){xt.current=S;return}if(S-xt.current>=Gt.recoveryCooldownMs){const Re=Math.min(P,Z_(Ie,P));Re>Ie&&(Hr(Re),yt.current=S,xt.current=0)}},[Ie,Wt.length,Bi,Xt.bytesPerSecond,Xt.framesPerSecond,Xt.lastUpdatedAt,Xt.sampleMs,he.adaptiveLoadShedding,he.autoStartLive,he.fps]),H.useEffect(()=>{const S=new URLSearchParams(window.location.search).get("checkout");if(S==="success"){ne("Checkout returned. Waiting for Dodo confirmation."),me();const P=window.setInterval(()=>{me()},4e3),Z=window.setTimeout(()=>{window.clearInterval(P)},45e3);return()=>{window.clearInterval(P),window.clearTimeout(Z)}}S==="cancelled"&&ne("Checkout cancelled.")},[me]),H.useEffect(()=>{!et&&Ce&&Ye(!1),!et&&Je&&ze(!1)},[Je,Ce,et]),H.useEffect(()=>{ze(!1)},[re?.deviceId]),H.useEffect(()=>{const S=De.map(Y=>Y.deviceId),P=new Set(S),Z=new Map(De.map(Y=>[Y.deviceId,Y]));K(Y=>{const oe=Y.filter(le=>P.has(le));return kd(Y,oe)?Y:oe}),F(Y=>Y&&P.has(Y)?Y:""),Se(Y=>{const oe=Y.filter(le=>le>=1&&le<=vt);return kd(Y.map(String),oe.map(String))?Y:oe}),Ni(Y=>{let oe=!1;const le={};for(const[fe,Ze]of Object.entries(Y)){if(!P.has(fe)){oe=!0;continue}const Re=Z.get(fe),nt=Rr(Ze,Re?Ei(Re):1);le[fe]=nt,nt!==Ze&&(oe=!0)}return oe?le:Y})},[De,vt]),H.useEffect(()=>{try{localStorage.setItem(ty,wa)}catch{}},[wa]),H.useEffect(()=>{J_(he)},[he]);const Mn=H.useCallback(async()=>{const S=new Set(m);S.add(Mt);try{const le=await xn("/api/remote/status",void 0,Mt);wp({endpoint:le.agentEndpoint,endpoint_candidates:[...le.agentEndpointCandidates||[],...le.hostTargetEndpointCandidates||[]]}).forEach(fe=>S.add(fe))}catch{}const P=[...S].sort((le,fe)=>{const Ze=Re=>{const nt=Qs(Re);return nt==="local"?0:nt==="loopback"?1:2};return Ze(le)-Ze(fe)||le.localeCompare(fe)});let Z=!1,Y="",oe=!1;try{for(const le of P){const fe=Qs(le);try{if(await xn("/api/health",void 0,le),fe==="local")return p(!0),Tr(!0),le;fe==="loopback"&&(Z=!0,Y=le)}catch{fe==="local"&&(oe=!0)}}return Z?(oe&&ne("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),Tr(!0),Y||Mt):(p(!1),Tr(!1),"")}catch{return p(!1),Tr(!1),""}},[m]),st=async()=>{V("auth"),vn(!1),await Mn();const{error:S}=await Kn.auth.signInWithOAuth({provider:"google",options:{redirectTo:window.location.origin}});S&&(ne(S.message),V(""))},gl=async()=>{V("auth"),vn(!1),await Kn.auth.signOut(),V("")};H.useEffect(()=>{if(!Rn)return;const S=Z=>{Z.target instanceof Element&&(Z.target.closest(".account-popover, .rail-account")||vn(!1))},P=Z=>{Z.key==="Escape"&&vn(!1)};return window.addEventListener("pointerdown",S),window.addEventListener("keydown",P),()=>{window.removeEventListener("pointerdown",S),window.removeEventListener("keydown",P)}},[Rn]);const ni=H.useCallback(async(S={})=>{const P=S.silent===!0,Z=S.takeover===!0,Y=S.requestLocalAccess===!0,oe=Y?await Mn():"";if(!i?.user){P||ne("Sign in before publishing this host.");return}if(!Pr.current){Pr.current=!0,P||V("host");try{const le=oe||G||Mt,fe=T||await xn("/api/remote/status",void 0,le);if(!fe.started)throw new Error("Start LiveDesk on this computer before syncing the server.");const Ze=`livedesk-${i.user.id}`,Re=await xn("/api/remote/host-target",{method:"POST",body:JSON.stringify({nodeId:Ze,leaseMs:6e4,takeover:Z})},le);if(!Re.ok)throw new Error(Re.error||"host-target-failed");const nt=await xn("/api/remote/status",void 0,le),_l=Re.hostTarget||{},Ot=nt.hostTargetEndpointCandidates||nt.agentEndpointCandidates||fe.agentEndpointCandidates||[nt.agentEndpoint||fe.agentEndpoint].filter(Boolean),{data:wn,error:li}=await Kn.rpc("set_livedesk_remote_host_target",{p_node_id:Ze,p_lease_id:String(_l.leaseId||nt.hostTargetLeaseId||crypto.randomUUID()),p_host_instance_id:nt.hostInstanceId||Ze,p_endpoint:nt.hostTargetEndpoint||nt.agentEndpoint||fe.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:Z,p_endpoint_candidates:Ot});if(li)throw li;const ea=Array.isArray(wn)?wn[0]:wn;if(ea&&ea.ok===!1)throw new Error(ea.reason||"registry-rejected");P||(ne("Host published."),(Y||w)&&(p(!0),Tr(!0)),z()),c()}catch(le){if(!P){const fe=le instanceof Error?le.message:String(le);fe.includes("local network access")&&(p(!1),Tr(!1)),ne(fe)}}finally{Pr.current=!1,P||V("")}}},[G,w,z,c,Mn,i,T]);H.useEffect(()=>{if(!i?.user||!T?.started||C)return;const S=r?.expires_at?Date.parse(r.expires_at):Number.POSITIVE_INFINITY,P=r?.active===!0&&(!r.expires_at||!Number.isFinite(S)||S>Date.now()),Z=!!r?.host_instance_id&&!!T.hostInstanceId&&r.host_instance_id===T.hostInstanceId;if(P&&!Z)return;let Y=!1;const oe=()=>{if(Y)return;const fe=Date.now();fe-_a.current<25e3||(_a.current=fe,ni({silent:!0}))};oe();const le=window.setInterval(oe,3e4);return()=>{Y=!0,window.clearInterval(le)}},[C,ni,i?.user?.id,T?.agentEndpoint,T?.hostInstanceId,T?.started,r?.active,r?.expires_at,r?.host_instance_id]);const Ut=H.useCallback(S=>{S&&(F(S),K(P=>P.includes(S)?P:[...P,S]))},[]),Fn=H.useCallback(S=>{if(!S)return;const P=De.find(Y=>Y.deviceId===S),Z=$s(P?.slotNumber);F(S),Z>0&&Se(Y=>Y.filter(oe=>oe!==Z)),K(Y=>Y.includes(S)?Y:[...Y,S])},[De]),pl=H.useCallback(S=>{!Number.isInteger(S)||S<1||S>vt||(F(""),Se(P=>P.includes(S)?P.filter(Z=>Z!==S):[...P,S].sort((Z,Y)=>Z-Y)))},[vt]),Aa=H.useCallback(()=>{K([]),Se([]),F(""),Ye(!1),ze(!1)},[]),Kr=H.useCallback(()=>{K([]),F(""),Ye(!1),ze(!1),Se(Array.from({length:vt},(S,P)=>P+1))},[vt]),yl=H.useCallback((S,P)=>{const Z=De.find(oe=>oe.deviceId===S);if(!Z)return;const Y=Ei(Z);Y<=1||(Ni(oe=>{const fe=(Rr(oe[S],Y)+P+Y)%Y;return{...oe,[S]:fe}}),Ut(S))},[De,Ut]);H.useEffect(()=>{const S=P=>{const Z=P.target,Y=Z?.tagName?.toLowerCase();Z?.isContentEditable||Y==="input"||Y==="textarea"||Y==="select"||((P.ctrlKey||P.metaKey)&&P.key.toLowerCase()==="a"&&(P.preventDefault(),Kr()),P.key==="Escape"&&Aa())};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[Aa,Kr]);const Un=async(S,P={})=>{if(!et){ne(Ln);return}Ut(S);try{const Z=De.find(oe=>oe.deviceId===S),Y=P.focused||Jt?{maxWidth:he.maxWidth,maxHeight:he.maxHeight}:Dn;await xn(`/api/remote/devices/${encodeURIComponent(S)}/live/start`,{method:"POST",body:JSON.stringify({fps:Ie,maxWidth:Y.maxWidth,maxHeight:Y.maxHeight,quality:he.quality,mode:he.frameMode,frameMode:he.frameMode,monitorIndex:Rr(Wn[S],Z?Ei(Z):1)})},G),ne("Live stream requested."),z()}catch(Z){ne(Z instanceof Error?Z.message:String(Z))}},ai=async S=>{if(Ut(S),W("control"),!et){Ye(!1),ne(Ln);return}Ye(!0),await Un(S,{focused:!0})},Sn=async()=>{if(!re){ne("Select a workstation before playing audio.");return}if(!et){ne(Ln);return}if(!Ui){ne("Selected workstation does not report remote audio support yet.");return}const S=!Je;ze(S);try{await xn(`/api/remote/devices/${encodeURIComponent(re.deviceId)}/audio/${S?"start":"stop"}`,{method:"POST",body:JSON.stringify({mimeType:"audio/webm;codecs=opus",sampleRate:48e3,channels:2})},G),ne(S?"Remote audio requested.":"Remote audio stopped.")}catch(P){ze(!1),ne(P instanceof Error?P.message:String(P))}},Lt=async S=>{const P=Array.from(S).filter(le=>le.size>=0);if(P.length===0)return;if(!et){ne(Ln);return}const Z=Nn.length>0?Nn.map(le=>le.deviceId):re?[re.deviceId]:[];if(Z.length===0){ne("Select at least one workstation before dropping files.");return}const Y=P.reduce((le,fe)=>le+fe.size,0),oe=crypto.randomUUID();if(Y>$_){jn({id:oe,status:"failed",progress:100,message:`Transfer is too large (${Ci(Y)}).`});return}jn({id:oe,status:"reading",progress:2,message:`Preparing ${P.length} file${P.length===1?"":"s"}`});try{let le=0;const fe=[];for(const Re of P){const nt=await Re.arrayBuffer();le+=Re.size,jn({id:oe,status:"reading",progress:Math.max(4,Math.round(le/Math.max(1,Y)*58)),message:`Preparing ${Ci(le)} / ${Ci(Y)}`}),fe.push({name:Re.name,relativePath:Re.webkitRelativePath||Re.name,size:Re.size,type:Re.type,lastModified:Re.lastModified,dataBase64:F_(nt)})}jn({id:oe,status:"sending",progress:72,message:`Sending to ${Z.length} workstation${Z.length===1?"":"s"}`});const Ze=await xn("/api/remote/files/transfer",{method:"POST",body:JSON.stringify({transferId:oe,deviceIds:Z,remoteDirectory:wa.trim(),files:fe})},G);if(!Ze.ok)throw new Error(Ze.error||"file-transfer-not-queued");jn({id:oe,status:"queued",progress:100,message:`Queued ${P.length} file${P.length===1?"":"s"} to ${Ze.queued}/${Ze.total}`}),window.setTimeout(()=>{jn(Re=>Re?.id===oe&&Re.status==="queued"?null:Re)},4500)}catch(le){jn({id:oe,status:"failed",progress:100,message:le instanceof Error?le.message:String(le)})}},vl=S=>{S.preventDefault(),S.stopPropagation(),qr(!1),Lt(S.dataTransfer.files)},ec=async()=>{const S=xe.trim();if(S){if(!et){ne(Ln);return}V("task");try{await xn("/api/remote/tasks",{method:"POST",body:JSON.stringify({instruction:S,allConnected:!0,approvalLevel:"task-only"})},G),E(""),ne("Task queued."),z()}catch(P){ne(P instanceof Error?P.message:String(P))}finally{V("")}}},qi=async()=>{if(!i){ne("Sign in with Google before checkout.");return}if($){ne("LiveDesk license is already active.");return}V("checkout");try{const{data:S,error:P}=await Kn.functions.invoke("dodo-checkout",{body:{plan:"ltd"}});if(P)throw P;if(!S?.checkout_url)throw new Error("Checkout function did not return a checkout URL.");window.location.assign(S.checkout_url)}catch(S){ne(S instanceof Error?S.message:String(S)),V("")}},zn=I_(),ii=G_(),tc=De.length,zt=Wt.filter(S=>Vr.has(S)).length,$i=C?"offline":T?.started?"online":"starting",ri=Nn.length+Ee.filter(S=>!De.some(P=>$s(P.slotNumber)===S)).length,Yr=Ee.length===1?`Slot ${String(Ee[0]).padStart(3,"0")}`:`${Ee.length} slots selected`,xa=ri===0?"No workstation":ri>1?`${ri} selected`:re?Fs(re):Yr,bt=Mr[ye]||Mr.en,si=bt.sync||Mr.en.sync,Bn=n||O?"checking":$?`${(I?.plan||"ltd").toUpperCase()} active`:Gr?`Free ${De.length}/${_r}`:`Upgrade ${De.length}/${_r}`,nc=$?"Licensed":D==="checkout"?"Opening":"$30 LTD",bl=$?"License active":i?$?"Licensed":D==="checkout"?"Opening checkout":"Buy with Dodo":D==="auth"?"Opening Google":"Sign in to buy",Jr=$||D==="checkout"||D==="auth"||n||O,Sl=i?.user.user_metadata,Pi=Ep(Sl,"avatar_url","picture"),Hn=Ep(Sl,"full_name","name")||i?.user.email||"Google",ln=Hn.slice(0,1).toUpperCase(),Wr=T?.started?"Local app ready":"Start LiveDesk",Xr=r?.active?"Published":i?"Not published":"Sign in required",Ca=_d.find(S=>S.width===he.maxWidth&&S.height===he.maxHeight)?.id||`${he.maxWidth}x${he.maxHeight}`,Oa=Bo.find(S=>S.id===he.frameMode)||Bo[0],on=S=>{ji(P=>{const Z=S.frameMode?Id(S.frameMode):P.frameMode,Y=S.frameMode!==void 0&&Z!==P.frameMode;return{...P,...S,frameMode:Z,fps:S.fps??(Y?ry(Z):P.fps)}})},Qr=S=>{const P=_d.find(Z=>Z.id===S);P&&on({maxWidth:P.width,maxHeight:P.height})},wl=S=>{if(S==="control"){if(W(S),!et){Ye(!1),ne(Ln);return}Ye(!0),re&&Un(re.deviceId,{focused:!0});return}W(S),Ye(!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(jr,{size:22})}),y.jsx("nav",{className:"rail-tools",children:r1.map(S=>{const P=S.icon;return y.jsxs("button",{className:`rail-tool ${M===S.id?"active":""} accent-${S.accent}`,onClick:()=>wl(S.id),title:S.label,type:"button",children:[y.jsx(P,{size:19}),y.jsx("span",{children:S.label})]},S.id)})}),y.jsxs("div",{className:"rail-footer",children:[y.jsxs("button",{className:"rail-tool compact sync-server",onClick:()=>ni({takeover:!0,requestLocalAccess:!0}),title:"Sync Server",type:"button",children:[y.jsx(od,{size:18}),y.jsx("span",{children:"Sync Server"})]}),y.jsxs("button",{className:`rail-tool compact local-settings ${Oi?"active":""}`,onClick:()=>{Ri(S=>!S),vn(!1)},title:"Local Settings",type:"button",children:[y.jsx(Np,{size:18}),y.jsx("span",{children:"Settings"})]}),Oi&&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:()=>Ri(!1),title:"Close settings",type:"button",children:y.jsx(Bg,{size:15})})]}),y.jsxs("label",{className:"local-setting-row",children:[y.jsx("span",{children:"Frame mode"}),y.jsx("select",{value:he.frameMode,onChange:S=>on({frameMode:Id(S.target.value)}),children:Bo.map(S=>y.jsxs("option",{value:S.id,children:[S.label," - ",S.detail]},S.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:he.fps,onChange:S=>on({fps:Lr(S.target.value,1,24,Vt.fps)}),children:Yd.map(S=>y.jsx("option",{value:S,children:S},S))})]}),y.jsxs("label",{className:"local-setting-row",children:[y.jsx("span",{children:"Size"}),y.jsx("select",{value:Ca,onChange:S=>Qr(S.target.value),children:_d.map(S=>y.jsx("option",{value:S.id,children:S.label},S.id))})]})]}),y.jsxs("label",{className:"local-setting-row",children:[y.jsx("span",{children:"Quality"}),y.jsx("select",{value:he.quality,onChange:S=>on({quality:Lr(S.target.value,20,95,Vt.quality)}),children:P_.map(S=>y.jsx("option",{value:S,children:S},S))})]}),y.jsxs("label",{className:"local-setting-toggle",children:[y.jsx("input",{type:"checkbox",checked:he.autoStartLive,onChange:S=>on({autoStartLive:S.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:he.visibleOnlyLive,onChange:S=>on({visibleOnlyLive:S.target.checked})}),y.jsx("span",{children:"Stream visible tiles first"})]}),y.jsxs("label",{className:"local-setting-toggle",children:[y.jsx("input",{type:"checkbox",checked:he.adaptiveSizeByWall,onChange:S=>on({adaptiveSizeByWall:S.target.checked})}),y.jsx("span",{children:"Fit stream size to wall"})]}),y.jsxs("label",{className:"local-setting-toggle",children:[y.jsx("input",{type:"checkbox",checked:he.adaptiveLoadShedding,onChange:S=>on({adaptiveLoadShedding:S.target.checked})}),y.jsx("span",{children:"Reduce FPS under load"})]}),y.jsxs("label",{className:"local-setting-toggle",children:[y.jsx("input",{type:"checkbox",checked:he.showScreenStatus,onChange:S=>on({showScreenStatus:S.target.checked})}),y.jsx("span",{children:"Screen status overlay"})]}),y.jsxs("div",{className:"local-settings-summary",children:[y.jsx("span",{children:Oa.label}),y.jsxs("strong",{children:[Dn.maxWidth,"x",Dn.maxHeight," / ",Ie,"fps"]})]}),y.jsx("button",{className:"local-settings-reset",onClick:()=>ji(Vt),type:"button",children:"Reset local settings"})]}),y.jsxs("button",{className:`rail-account ${i?"signed-in":""}`,onClick:()=>{vn(S=>!S),Ri(!1)},disabled:n||D==="auth","aria-expanded":Rn,title:i?`Account: ${i.user.email||Hn}`:"Sign in with Google",type:"button",children:[i?Pi?y.jsx("img",{src:Pi,alt:Hn,referrerPolicy:"no-referrer"}):y.jsx("span",{className:"avatar-fallback",children:ln}):y.jsx(ud,{size:18}),y.jsx("span",{children:i?"Account":"Google"})]}),Rn&&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&&Pi?y.jsx("img",{src:Pi,alt:Hn,referrerPolicy:"no-referrer"}):i?y.jsx("span",{children:ln}):y.jsx(ud,{size:18})}),y.jsxs("div",{children:[y.jsx("strong",{children:i?Hn:"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:Wr}),y.jsx("dt",{children:"Access"}),y.jsx("dd",{children:Xr}),y.jsx("dt",{children:"Plan"}),y.jsx("dd",{children:Bn})]}),i?y.jsxs("button",{className:"account-popover-action",onClick:gl,disabled:D==="auth",type:"button",children:[y.jsx(P0,{size:16}),"Logout"]}):y.jsxs("button",{className:"account-popover-action primary",onClick:st,disabled:D==="auth",type:"button",children:[y.jsx(ud,{size:16}),"Sign in with Google"]})]})]})]}),y.jsxs("section",{className:`desk-stage ${fl&&!Xe?"dock-open":""}`,children:[y.jsxs("header",{className:"topbar",children:[y.jsxs("div",{className:"brand",children:[y.jsx("span",{className:"brand-mark",children:y.jsx(Dg,{size:18})}),y.jsxs("div",{children:[y.jsx("h1",{children:"LiveDesk"}),y.jsx("p",{children:"Control wall for local machines"})]})]}),fl&&y.jsx("div",{className:"top-actions",children:y.jsx("div",{className:"segmented-control","aria-label":"Screen size",children:i1.map(S=>y.jsx("button",{className:Q===S.id?"active":"",onClick:()=>ge(S.id),type:"button",children:S.label},S.id))})})]}),hl?y.jsxs("section",{className:"doc-page",lang:ye,dir:ye==="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(xd,{size:16}),bt.eyebrow]}),y.jsx("h2",{children:bt.title}),y.jsx("p",{children:bt.intro})]}),y.jsxs("label",{className:"doc-language-picker",children:[y.jsxs("span",{children:[y.jsx(z0,{size:17}),bt.languageLabel]}),y.jsx("select",{value:ye,onChange:S=>Oe(S.target.value),children:s1.map(S=>y.jsx("option",{value:S.id,children:S.label},S.id))})]})]}),y.jsx("section",{className:"doc-grid",children:bt.sections.map((S,P)=>{const Y=[fd,Ar,jp,zg][P]||xd;return y.jsxs("article",{className:"doc-card",children:[y.jsx("div",{className:"doc-card-icon",children:y.jsx(Y,{size:19})}),y.jsxs("div",{children:[y.jsx("h3",{children:S.title}),y.jsx("p",{children:S.body}),y.jsx("ul",{children:S.points.map(oe=>y.jsx("li",{children:oe},oe))})]})]},S.title)})}),si&&y.jsxs("section",{className:"doc-sync",children:[y.jsxs("div",{className:"doc-sync-head",children:[y.jsx(od,{size:20}),y.jsxs("div",{children:[y.jsx("h3",{children:si.title}),y.jsx("p",{children:si.body})]})]}),y.jsx("ul",{children:si.points.map(S=>y.jsx("li",{children:S},S))})]}),y.jsxs("section",{className:"doc-firewall",children:[y.jsxs("div",{className:"doc-firewall-head",children:[y.jsx(Mg,{size:20}),y.jsxs("div",{children:[y.jsx("h3",{children:bt.firewall.title}),y.jsx("p",{children:bt.firewall.body})]})]}),y.jsx("ul",{children:bt.firewall.points.map(S=>y.jsx("li",{children:S},S))})]}),y.jsxs("section",{className:"doc-command-panel",children:[y.jsxs("div",{className:"doc-command-head",children:[y.jsx(Ar,{size:20}),y.jsxs("div",{children:[y.jsx("h3",{children:bt.commands.title}),y.jsx("p",{children:bt.commands.body})]})]}),y.jsxs("div",{className:"doc-command-list",children:[bt.commands.manager&&y.jsxs("div",{className:"doc-command-row",children:[y.jsx("span",{children:bt.commands.manager}),y.jsx("code",{children:ii}),y.jsx("button",{className:"icon-button",onClick:()=>qs(ii),title:"Copy command",type:"button",children:y.jsx(Bs,{size:16})})]}),y.jsxs("div",{className:"doc-command-row",children:[y.jsx("span",{children:bt.commands.primary}),y.jsx("code",{children:zn}),y.jsx("button",{className:"icon-button",onClick:()=>qs(zn),title:"Copy command",type:"button",children:y.jsx(Bs,{size:16})})]}),y.jsxs("div",{className:"doc-command-row",children:[y.jsx("span",{children:bt.commands.slot}),y.jsx("code",{children:`${zn} 3`}),y.jsx("button",{className:"icon-button",onClick:()=>qs(`${zn} 3`),title:"Copy command",type:"button",children:y.jsx(Bs,{size:16})})]})]})]})]}):dl?y.jsxs("section",{className:"pricing-page",children:[(J||se)&&y.jsx("section",{className:"notice-band",children:J||se}),y.jsxs("section",{className:"pricing-offer",children:[y.jsx("button",{className:"pricing-close",onClick:()=>W("wall"),title:"Close pricing",type:"button",children:y.jsx(Bg,{size:18})}),y.jsxs("div",{className:"pricing-offer-head",children:[y.jsxs("span",{className:"pricing-eyebrow",children:[y.jsx(tb,{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(x0,{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:[De.length,"/",_r]})]}),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:Bn})]}),y.jsxs("ul",{className:"deal-feature-list",children:[y.jsxs("li",{children:[y.jsx(jr,{size:16}),y.jsx("span",{children:"Screen wall slots"}),y.jsx("b",{children:"120+"})]}),y.jsxs("li",{children:[y.jsx(Od,{size:16}),y.jsx("span",{children:"Focused control"}),y.jsx("b",{children:"Local"})]}),y.jsxs("li",{children:[y.jsx(Ug,{size:16}),y.jsx("span",{children:"Remote PC audio"}),y.jsx("b",{children:"PCM"})]}),y.jsxs("li",{children:[y.jsx(cd,{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(N0,{size:15}),"Free plan stays available for up to ",_r," local workstations."]}),y.jsxs("button",{className:"deal-cta",onClick:i?qi:st,disabled:Jr,type:"button",children:[y.jsx(Cd,{size:18}),bl]}),y.jsx("button",{className:"deal-later",onClick:()=>W("wall"),type:"button",children:"Later"})]})]}):y.jsx(y.Fragment,{children:y.jsxs("section",{className:`monitor-layout ${Xe?"dock-collapsed":""}`,children:[y.jsx("section",{ref:$r,className:`screen-wall-panel ${Di?"drop-active":""}`,onClick:S=>{S.currentTarget===S.target&&Aa()},onDragEnter:S=>{S.preventDefault(),qr(!0)},onDragOver:S=>{S.preventDefault(),S.dataTransfer.dropEffect="copy"},onDragLeave:S=>{S.currentTarget===S.target&&qr(!1)},onDrop:vl,children:Jt?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:re?Fs(re):"No workstation"})]}),y.jsxs("button",{className:"text-button",onClick:()=>re&&Un(re.deviceId),disabled:!zi,type:"button",children:[y.jsx(dd,{size:16}),"Start live"]})]}),y.jsx("div",{className:"screen-wall control-wall",onClick:S=>{S.currentTarget===S.target&&Aa()},children:re?y.jsx(xp,{device:re,frame:Vr.get(re.deviceId),selected:!0,controlEnabled:ti&&Ce,showStatus:he.showScreenStatus,monitorIndex:Rr(Wn[re.deviceId],Ei(re)),monitorCount:Ei(re),onSelect:()=>Fn(re.deviceId),onFocusDevice:()=>Ut(re.deviceId),onOpenControl:()=>ai(re.deviceId),onCycleMonitor:S=>yl(re.deviceId,S),sendInput:Qn},re.deviceId):y.jsx(Ap,{index:0,selected:ka.has(1),onSelect:()=>pl(1)})})]}):y.jsx("div",{className:`screen-wall size-${Q}`,onClick:S=>{S.currentTarget===S.target&&Aa()},children:Xn.map((S,P)=>{const Z=P+1;return S?y.jsx(xp,{device:S,frame:Vr.get(S.deviceId),selected:Ir.has(S.deviceId)||ka.has(Z),controlEnabled:ti&&Ce&&re?.deviceId===S.deviceId,showStatus:he.showScreenStatus,monitorIndex:Rr(Wn[S.deviceId],Ei(S)),monitorCount:Ei(S),onSelect:()=>Fn(S.deviceId),onFocusDevice:()=>Ut(S.deviceId),onOpenControl:()=>ai(S.deviceId),onCycleMonitor:Y=>yl(S.deviceId,Y),sendInput:Qn},S.deviceId):y.jsx(Ap,{index:P,selected:ka.has(Z),onSelect:()=>pl(Z)},`slot-${P}`)})})}),y.jsxs("aside",{className:`right-dock ${Ct?"settings-mode":"actions-mode"} ${Xe?"collapsed":""}`,"aria-label":"LiveDesk tools",children:[y.jsx("button",{className:"dock-toggle",onClick:()=>Qe(S=>!S),"aria-label":Xe?"Show control panel":"Hide control panel",title:Xe?"Show control panel":"Hide control panel",type:"button",children:Xe?y.jsx(Op,{size:18}):y.jsx(Rp,{size:18})}),!Xe&&(Ct?y.jsxs(y.Fragment,{children:[(C||l||J||se)&&y.jsx("section",{className:"notice-band",children:C||l||J||se}),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(jr,{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:()=>qs(zn),type:"button",children:[y.jsx(Bs,{size:16}),"Copy setup"]}),y.jsxs("button",{className:"setup-disclosure",onClick:()=>zr(S=>!S),type:"button",children:[y.jsx(Ar,{size:15}),"Advanced setup"]}),Jn&&y.jsxs("div",{className:"setup-code-row",children:[y.jsx("code",{children:zn}),y.jsx("button",{className:"icon-button",onClick:()=>qs(zn),title:"Copy setup command",type:"button",children:y.jsx(Bs,{size:16})})]})]}),y.jsxs("div",{className:"settings-card",children:[y.jsxs("div",{className:"panel-title",children:[y.jsx(cd,{size:17}),y.jsx("h2",{children:"Files"})]}),y.jsxs("label",{className:"field-row",children:[y.jsx("span",{children:"Remote folder"}),y.jsx("input",{value:wa,onChange:S=>Zo(S.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:()=>ni({takeover:!0,requestLocalAccess:!0}),disabled:!i||D==="host",type:"button",children:[y.jsx(od,{size:16}),"Sync access"]}),y.jsxs("button",{className:"text-button buy",onClick:qi,disabled:D==="checkout"||$,type:"button",children:[y.jsx(Cd,{size:16}),nc]})]})]}),y.jsxs("section",{className:"status-strip",children:[y.jsxs("div",{className:`status-item state-${$i}`,children:[y.jsx(fd,{size:18}),y.jsx("span",{children:"Local app"}),y.jsx("strong",{children:$i})]}),y.jsxs("div",{className:"status-item",children:[y.jsx(zg,{size:18}),y.jsx("span",{children:"Slots"}),y.jsxs("strong",{children:[tc,"/",vt]})]}),y.jsxs("div",{className:"status-item",children:[y.jsx(Dg,{size:18}),y.jsx("span",{children:"Frames"}),y.jsxs("strong",{children:[zt," ",Bi]})]}),y.jsxs("div",{className:"status-item",children:[y.jsx(Mg,{size:18}),y.jsx("span",{children:"Plan"}),y.jsx("strong",{children:Bn})]})]})]}):y.jsxs(y.Fragment,{children:[y.jsxs("section",{className:"action-dock",children:[y.jsxs("div",{className:"action-context",children:[y.jsx("span",{children:ri>0?"Selection":"No selection"}),y.jsx("strong",{children:xa})]}),y.jsx("input",{ref:ul,className:"hidden-file-input",type:"file",multiple:!0,onChange:S=>{S.currentTarget.files&&Lt(S.currentTarget.files),S.currentTarget.value=""}}),(C||se)&&y.jsx("div",{className:"notice-band compact",children:y.jsx("span",{children:C||se})}),y.jsxs("div",{className:"action-grid",children:[y.jsxs("button",{className:"action-tile primary",onClick:()=>re&&Un(re.deviceId),disabled:!zi,type:"button",children:[y.jsx(dd,{size:21}),y.jsx("span",{children:"Live"})]}),y.jsxs("button",{className:`action-tile ${Ce?"active":""}`,onClick:()=>Ye(S=>!S),disabled:!ti,type:"button",children:[y.jsx(Od,{size:21}),y.jsx("span",{children:Hi!=="idle"?Hi:"Control"})]}),y.jsxs("button",{className:`action-tile ${Je?"active":""}`,onClick:Sn,disabled:!bn,type:"button",title:Ui?"Remote PC audio":"Remote audio is not supported by this workstation yet",children:[y.jsx(Ug,{size:21}),y.jsx("span",{children:Je&&Zn!=="idle"?Zn:"Audio"})]}),y.jsxs("button",{className:"action-tile",onClick:()=>ul.current?.click(),disabled:!et||Nn.length===0,type:"button",title:"File transfer",children:[y.jsx(cd,{size:21}),y.jsx("span",{children:"Files"})]}),y.jsxs("button",{className:"action-tile",disabled:!0,type:"button",title:"Reboot",children:[y.jsx(W0,{size:21}),y.jsx("span",{children:"Reboot"})]}),y.jsxs("button",{className:"action-tile",disabled:!0,type:"button",title:"Power",children:[y.jsx(Y0,{size:21}),y.jsx("span",{children:"Power"})]}),y.jsxs("button",{className:"action-tile",disabled:!0,type:"button",title:"Terminal",children:[y.jsx(Ar,{size:21}),y.jsx("span",{children:"Shell"})]})]})]}),re&&sn&&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(jr,{size:17}),y.jsx("h2",{children:"Machine detail"})]}),y.jsx("span",{className:`machine-health state-${sn.state}`,children:sn.label})]}),y.jsxs("div",{className:"machine-title",children:[y.jsx("strong",{children:Fs(re)}),y.jsx("span",{children:sn.role})]}),y.jsx("div",{className:"machine-metric-grid",children:sn.metrics.map(S=>y.jsxs("article",{className:`machine-metric state-${S.state}`,children:[y.jsx("span",{children:S.label}),y.jsx("strong",{children:S.value}),y.jsx("small",{children:S.detail}),S.ratio!==void 0&&y.jsx("i",{children:y.jsx("b",{style:{width:`${Math.round(S.ratio*100)}%`}})})]},S.id))}),y.jsxs("section",{className:"machine-section",children:[y.jsxs("div",{className:"machine-section-title",children:[y.jsx(Ar,{size:15}),y.jsx("span",{children:"Local services"})]}),y.jsx("div",{className:"tool-probe-list",children:sn.tools.map(S=>y.jsxs("span",{className:`tool-probe state-${S.status}`,children:[y.jsx("b",{children:S.label}),y.jsx("em",{children:S.detail})]},S.id))})]}),y.jsxs("section",{className:"machine-section",children:[y.jsxs("div",{className:"machine-section-title",children:[y.jsx(hd,{size:15}),y.jsx("span",{children:"Workload"})]}),y.jsxs("div",{className:"workload-card",children:[y.jsx("strong",{children:sn.taskLabel}),y.jsx("span",{children:sn.taskStatus}),sn.taskSummary&&y.jsx("p",{children:sn.taskSummary})]})]}),y.jsxs("div",{className:"machine-section",children:[y.jsxs("div",{className:"machine-section-title",children:[y.jsx(fd,{size:15}),y.jsx("span",{children:"System"})]}),y.jsxs("dl",{className:"facts compact",children:[y.jsx("dt",{children:"Platform"}),y.jsxs("dd",{children:[re.platform||"-"," ",re.arch||""]}),y.jsx("dt",{children:"Release"}),y.jsx("dd",{children:Kt(re.status,"release")||"-"}),y.jsx("dt",{children:"Uptime"}),y.jsx("dd",{children:sy(Fe(re.status,"uptimeSec"))}),y.jsx("dt",{children:"Last seen"}),y.jsx("dd",{children:x_(re.lastSeenAt||re.connectedAt)}),y.jsx("dt",{children:"Agent"}),y.jsx("dd",{children:re.agentVersion||"-"}),y.jsx("dt",{children:"Address"}),y.jsx("dd",{children:re.remoteAddress||"-"})]})]}),Ea&&y.jsx("p",{className:"panel-warning",children:Ea}),y.jsxs("button",{className:"text-button full",onClick:()=>re&&Un(re.deviceId),disabled:!zi,type:"button",children:[y.jsx(dd,{size:16}),"Start live"]})]}),y.jsxs("section",{className:"side-panel task-panel",children:[y.jsxs("div",{className:"panel-title",children:[y.jsx(hd,{size:17}),y.jsx("h2",{children:"Task"})]}),y.jsx("textarea",{value:xe,onChange:S=>E(S.target.value),placeholder:"Prepare a short status report.",rows:4}),y.jsxs("button",{className:"text-button full primary",onClick:ec,disabled:D==="task"||!xe.trim()||!et,type:"button",children:[y.jsx(hd,{size:16}),"Send to connected"]})]})]}))]})]})})]}),ei&&y.jsxs("aside",{className:`transfer-bar state-${ei.status}`,"aria-live":"polite",children:[y.jsx("div",{className:"transfer-bar-track",children:y.jsx("span",{style:{width:`${Math.max(0,Math.min(100,ei.progress))}%`}})}),y.jsx("p",{children:ei.message})]})]})}b0.createRoot(document.getElementById("root")).render(y.jsx(H.StrictMode,{children:y.jsx(o1,{})}));