@realtimex/email-automator 2.4.5 → 2.6.4
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.
- package/api/src/routes/emails.ts +37 -1
- package/api/src/routes/rules.ts +7 -2
- package/api/src/services/gmail.ts +53 -166
- package/api/src/services/intelligence.ts +2 -1
- package/api/src/services/microsoft.ts +34 -29
- package/api/src/services/processor.ts +376 -106
- package/api/src/services/storage.ts +88 -0
- package/api/src/services/supabase.ts +6 -0
- package/api/src/utils/contentCleaner.ts +11 -6
- package/dist/api/src/routes/emails.js +27 -1
- package/dist/api/src/routes/rules.js +6 -2
- package/dist/api/src/services/gmail.js +49 -138
- package/dist/api/src/services/intelligence.js +2 -1
- package/dist/api/src/services/microsoft.js +28 -18
- package/dist/api/src/services/processor.js +335 -96
- package/dist/api/src/services/storage.js +81 -0
- package/dist/api/src/utils/contentCleaner.js +10 -6
- package/dist/assets/index-BSHZ3lFn.js +97 -0
- package/dist/assets/index-CRQKk5IW.css +1 -0
- package/dist/index.html +2 -2
- package/package.json +3 -1
- package/supabase/functions/api-v1-accounts/index.ts +28 -7
- package/supabase/migrations/20260118000001_async_etl_storage.sql +24 -0
- package/dist/assets/index-C3PlbplS.css +0 -1
- package/dist/assets/index-DfGa9R7j.js +0 -97
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
function ax(n,a){for(var r=0;r<a.length;r++){const l=a[r];if(typeof l!="string"&&!Array.isArray(l)){for(const c in l)if(c!=="default"&&!(c in n)){const d=Object.getOwnPropertyDescriptor(l,c);d&&Object.defineProperty(n,c,d.get?d:{enumerable:!0,get:()=>l[c]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.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)}})();function ef(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var od={exports:{}},ki={};var cg;function nx(){if(cg)return ki;cg=1;var n=Symbol.for("react.transitional.element"),a=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:n,type:l,key:h,ref:c!==void 0?c:null,props:d}}return ki.Fragment=a,ki.jsx=r,ki.jsxs=r,ki}var ug;function sx(){return ug||(ug=1,od.exports=nx()),od.exports}var o=sx(),cd={exports:{}},ve={};var dg;function rx(){if(dg)return ve;dg=1;var n=Symbol.for("react.transitional.element"),a=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"),p=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),x=Symbol.iterator;function S(T){return T===null||typeof T!="object"?null:(T=x&&T[x]||T["@@iterator"],typeof T=="function"?T:null)}var A={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,k={};function R(T,V,Y){this.props=T,this.context=V,this.refs=k,this.updater=Y||A}R.prototype.isReactComponent={},R.prototype.setState=function(T,V){if(typeof T!="object"&&typeof T!="function"&&T!=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,T,V,"setState")},R.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function q(){}q.prototype=R.prototype;function B(T,V,Y){this.props=T,this.context=V,this.refs=k,this.updater=Y||A}var G=B.prototype=new q;G.constructor=B,j(G,R.prototype),G.isPureReactComponent=!0;var ee=Array.isArray;function J(){}var P={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function ue(T,V,Y){var W=Y.ref;return{$$typeof:n,type:T,key:V,ref:W!==void 0?W:null,props:Y}}function Je(T,V){return ue(T.type,V,T.props)}function be(T){return typeof T=="object"&&T!==null&&T.$$typeof===n}function ge(T){var V={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(Y){return V[Y]})}var Ze=/\/+/g;function nt(T,V){return typeof T=="object"&&T!==null&&T.key!=null?ge(""+T.key):V.toString(36)}function F(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(J,J):(T.status="pending",T.then(function(V){T.status==="pending"&&(T.status="fulfilled",T.value=V)},function(V){T.status==="pending"&&(T.status="rejected",T.reason=V)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function U(T,V,Y,W,fe){var ye=typeof T;(ye==="undefined"||ye==="boolean")&&(T=null);var de=!1;if(T===null)de=!0;else switch(ye){case"bigint":case"string":case"number":de=!0;break;case"object":switch(T.$$typeof){case n:case a:de=!0;break;case v:return de=T._init,U(de(T._payload),V,Y,W,fe)}}if(de)return fe=fe(T),de=W===""?"."+nt(T,0):W,ee(fe)?(Y="",de!=null&&(Y=de.replace(Ze,"$&/")+"/"),U(fe,V,Y,"",function(Tt){return Tt})):fe!=null&&(be(fe)&&(fe=Je(fe,Y+(fe.key==null||T&&T.key===fe.key?"":(""+fe.key).replace(Ze,"$&/")+"/")+de)),V.push(fe)),1;de=0;var Ge=W===""?".":W+":";if(ee(T))for(var Ue=0;Ue<T.length;Ue++)W=T[Ue],ye=Ge+nt(W,Ue),de+=U(W,V,Y,ye,fe);else if(Ue=S(T),typeof Ue=="function")for(T=Ue.call(T),Ue=0;!(W=T.next()).done;)W=W.value,ye=Ge+nt(W,Ue++),de+=U(W,V,Y,ye,fe);else if(ye==="object"){if(typeof T.then=="function")return U(F(T),V,Y,W,fe);throw V=String(T),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return de}function Q(T,V,Y){if(T==null)return T;var W=[],fe=0;return U(T,W,"","",function(ye){return V.call(Y,ye,fe++)}),W}function K(T){if(T._status===-1){var V=T._result;V=V(),V.then(function(Y){(T._status===0||T._status===-1)&&(T._status=1,T._result=Y)},function(Y){(T._status===0||T._status===-1)&&(T._status=2,T._result=Y)}),T._status===-1&&(T._status=0,T._result=V)}if(T._status===1)return T._result.default;throw T._result}var je=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T=="object"&&T!==null&&typeof T.message=="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},Re={map:Q,forEach:function(T,V,Y){Q(T,function(){V.apply(this,arguments)},Y)},count:function(T){var V=0;return Q(T,function(){V++}),V},toArray:function(T){return Q(T,function(V){return V})||[]},only:function(T){if(!be(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return ve.Activity=_,ve.Children=Re,ve.Component=R,ve.Fragment=r,ve.Profiler=c,ve.PureComponent=B,ve.StrictMode=l,ve.Suspense=p,ve.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=P,ve.__COMPILER_RUNTIME={__proto__:null,c:function(T){return P.H.useMemoCache(T)}},ve.cache=function(T){return function(){return T.apply(null,arguments)}},ve.cacheSignal=function(){return null},ve.cloneElement=function(T,V,Y){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var W=j({},T.props),fe=T.key;if(V!=null)for(ye in V.key!==void 0&&(fe=""+V.key),V)!X.call(V,ye)||ye==="key"||ye==="__self"||ye==="__source"||ye==="ref"&&V.ref===void 0||(W[ye]=V[ye]);var ye=arguments.length-2;if(ye===1)W.children=Y;else if(1<ye){for(var de=Array(ye),Ge=0;Ge<ye;Ge++)de[Ge]=arguments[Ge+2];W.children=de}return ue(T.type,fe,W)},ve.createContext=function(T){return T={$$typeof:h,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:d,_context:T},T},ve.createElement=function(T,V,Y){var W,fe={},ye=null;if(V!=null)for(W in V.key!==void 0&&(ye=""+V.key),V)X.call(V,W)&&W!=="key"&&W!=="__self"&&W!=="__source"&&(fe[W]=V[W]);var de=arguments.length-2;if(de===1)fe.children=Y;else if(1<de){for(var Ge=Array(de),Ue=0;Ue<de;Ue++)Ge[Ue]=arguments[Ue+2];fe.children=Ge}if(T&&T.defaultProps)for(W in de=T.defaultProps,de)fe[W]===void 0&&(fe[W]=de[W]);return ue(T,ye,fe)},ve.createRef=function(){return{current:null}},ve.forwardRef=function(T){return{$$typeof:m,render:T}},ve.isValidElement=be,ve.lazy=function(T){return{$$typeof:v,_payload:{_status:-1,_result:T},_init:K}},ve.memo=function(T,V){return{$$typeof:g,type:T,compare:V===void 0?null:V}},ve.startTransition=function(T){var V=P.T,Y={};P.T=Y;try{var W=T(),fe=P.S;fe!==null&&fe(Y,W),typeof W=="object"&&W!==null&&typeof W.then=="function"&&W.then(J,je)}catch(ye){je(ye)}finally{V!==null&&Y.types!==null&&(V.types=Y.types),P.T=V}},ve.unstable_useCacheRefresh=function(){return P.H.useCacheRefresh()},ve.use=function(T){return P.H.use(T)},ve.useActionState=function(T,V,Y){return P.H.useActionState(T,V,Y)},ve.useCallback=function(T,V){return P.H.useCallback(T,V)},ve.useContext=function(T){return P.H.useContext(T)},ve.useDebugValue=function(){},ve.useDeferredValue=function(T,V){return P.H.useDeferredValue(T,V)},ve.useEffect=function(T,V){return P.H.useEffect(T,V)},ve.useEffectEvent=function(T){return P.H.useEffectEvent(T)},ve.useId=function(){return P.H.useId()},ve.useImperativeHandle=function(T,V,Y){return P.H.useImperativeHandle(T,V,Y)},ve.useInsertionEffect=function(T,V){return P.H.useInsertionEffect(T,V)},ve.useLayoutEffect=function(T,V){return P.H.useLayoutEffect(T,V)},ve.useMemo=function(T,V){return P.H.useMemo(T,V)},ve.useOptimistic=function(T,V){return P.H.useOptimistic(T,V)},ve.useReducer=function(T,V,Y){return P.H.useReducer(T,V,Y)},ve.useRef=function(T){return P.H.useRef(T)},ve.useState=function(T){return P.H.useState(T)},ve.useSyncExternalStore=function(T,V,Y){return P.H.useSyncExternalStore(T,V,Y)},ve.useTransition=function(){return P.H.useTransition()},ve.version="19.2.3",ve}var fg;function tf(){return fg||(fg=1,cd.exports=rx()),cd.exports}var w=tf();const my=ef(w),af=ax({__proto__:null,default:my},[w]);var ud={exports:{}},Oi={},dd={exports:{}},fd={};var hg;function ix(){return hg||(hg=1,(function(n){function a(U,Q){var K=U.length;U.push(Q);e:for(;0<K;){var je=K-1>>>1,Re=U[je];if(0<c(Re,Q))U[je]=Q,U[K]=Re,K=je;else break e}}function r(U){return U.length===0?null:U[0]}function l(U){if(U.length===0)return null;var Q=U[0],K=U.pop();if(K!==Q){U[0]=K;e:for(var je=0,Re=U.length,T=Re>>>1;je<T;){var V=2*(je+1)-1,Y=U[V],W=V+1,fe=U[W];if(0>c(Y,K))W<Re&&0>c(fe,Y)?(U[je]=fe,U[W]=K,je=W):(U[je]=Y,U[V]=K,je=V);else if(W<Re&&0>c(fe,K))U[je]=fe,U[W]=K,je=W;else break e}}return Q}function c(U,Q){var K=U.sortIndex-Q.sortIndex;return K!==0?K:U.id-Q.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;n.unstable_now=function(){return d.now()}}else{var h=Date,m=h.now();n.unstable_now=function(){return h.now()-m}}var p=[],g=[],v=1,_=null,x=3,S=!1,A=!1,j=!1,k=!1,R=typeof setTimeout=="function"?setTimeout:null,q=typeof clearTimeout=="function"?clearTimeout:null,B=typeof setImmediate<"u"?setImmediate:null;function G(U){for(var Q=r(g);Q!==null;){if(Q.callback===null)l(g);else if(Q.startTime<=U)l(g),Q.sortIndex=Q.expirationTime,a(p,Q);else break;Q=r(g)}}function ee(U){if(j=!1,G(U),!A)if(r(p)!==null)A=!0,J||(J=!0,ge());else{var Q=r(g);Q!==null&&F(ee,Q.startTime-U)}}var J=!1,P=-1,X=5,ue=-1;function Je(){return k?!0:!(n.unstable_now()-ue<X)}function be(){if(k=!1,J){var U=n.unstable_now();ue=U;var Q=!0;try{e:{A=!1,j&&(j=!1,q(P),P=-1),S=!0;var K=x;try{t:{for(G(U),_=r(p);_!==null&&!(_.expirationTime>U&&Je());){var je=_.callback;if(typeof je=="function"){_.callback=null,x=_.priorityLevel;var Re=je(_.expirationTime<=U);if(U=n.unstable_now(),typeof Re=="function"){_.callback=Re,G(U),Q=!0;break t}_===r(p)&&l(p),G(U)}else l(p);_=r(p)}if(_!==null)Q=!0;else{var T=r(g);T!==null&&F(ee,T.startTime-U),Q=!1}}break e}finally{_=null,x=K,S=!1}Q=void 0}}finally{Q?ge():J=!1}}}var ge;if(typeof B=="function")ge=function(){B(be)};else if(typeof MessageChannel<"u"){var Ze=new MessageChannel,nt=Ze.port2;Ze.port1.onmessage=be,ge=function(){nt.postMessage(null)}}else ge=function(){R(be,0)};function F(U,Q){P=R(function(){U(n.unstable_now())},Q)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(U){U.callback=null},n.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<U?Math.floor(1e3/U):5},n.unstable_getCurrentPriorityLevel=function(){return x},n.unstable_next=function(U){switch(x){case 1:case 2:case 3:var Q=3;break;default:Q=x}var K=x;x=Q;try{return U()}finally{x=K}},n.unstable_requestPaint=function(){k=!0},n.unstable_runWithPriority=function(U,Q){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var K=x;x=U;try{return Q()}finally{x=K}},n.unstable_scheduleCallback=function(U,Q,K){var je=n.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?je+K:je):K=je,U){case 1:var Re=-1;break;case 2:Re=250;break;case 5:Re=1073741823;break;case 4:Re=1e4;break;default:Re=5e3}return Re=K+Re,U={id:v++,callback:Q,priorityLevel:U,startTime:K,expirationTime:Re,sortIndex:-1},K>je?(U.sortIndex=K,a(g,U),r(p)===null&&U===r(g)&&(j?(q(P),P=-1):j=!0,F(ee,K-je))):(U.sortIndex=Re,a(p,U),A||S||(A=!0,J||(J=!0,ge()))),U},n.unstable_shouldYield=Je,n.unstable_wrapCallback=function(U){var Q=x;return function(){var K=x;x=Q;try{return U.apply(this,arguments)}finally{x=K}}}})(fd)),fd}var mg;function lx(){return mg||(mg=1,dd.exports=ix()),dd.exports}var hd={exports:{}},Ct={};var pg;function ox(){if(pg)return Ct;pg=1;var n=tf();function a(p){var g="https://react.dev/errors/"+p;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)g+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+p+"; visit "+g+" 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(a(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(p,g,v){var _=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:_==null?null:""+_,children:p,containerInfo:g,implementation:v}}var h=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(p,g){if(p==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return Ct.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,Ct.createPortal=function(p,g){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(a(299));return d(p,g,null,v)},Ct.flushSync=function(p){var g=h.T,v=l.p;try{if(h.T=null,l.p=2,p)return p()}finally{h.T=g,l.p=v,l.d.f()}},Ct.preconnect=function(p,g){typeof p=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,l.d.C(p,g))},Ct.prefetchDNS=function(p){typeof p=="string"&&l.d.D(p)},Ct.preinit=function(p,g){if(typeof p=="string"&&g&&typeof g.as=="string"){var v=g.as,_=m(v,g.crossOrigin),x=typeof g.integrity=="string"?g.integrity:void 0,S=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;v==="style"?l.d.S(p,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:_,integrity:x,fetchPriority:S}):v==="script"&&l.d.X(p,{crossOrigin:_,integrity:x,fetchPriority:S,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},Ct.preinitModule=function(p,g){if(typeof p=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var v=m(g.as,g.crossOrigin);l.d.M(p,{crossOrigin:v,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&l.d.M(p)},Ct.preload=function(p,g){if(typeof p=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var v=g.as,_=m(v,g.crossOrigin);l.d.L(p,v,{crossOrigin:_,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},Ct.preloadModule=function(p,g){if(typeof p=="string")if(g){var v=m(g.as,g.crossOrigin);l.d.m(p,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:v,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else l.d.m(p)},Ct.requestFormReset=function(p){l.d.r(p)},Ct.unstable_batchedUpdates=function(p,g){return p(g)},Ct.useFormState=function(p,g,v){return h.H.useFormState(p,g,v)},Ct.useFormStatus=function(){return h.H.useHostTransitionStatus()},Ct.version="19.2.3",Ct}var gg;function py(){if(gg)return hd.exports;gg=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(a){console.error(a)}}return n(),hd.exports=ox(),hd.exports}var yg;function cx(){if(yg)return Oi;yg=1;var n=lx(),a=tf(),r=py();function l(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)t+="&args[]="+encodeURIComponent(arguments[s])}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,s=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(s=t.return),e=t.return;while(e)}return t.tag===3?s: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 p(e){if(d(e)!==e)throw Error(l(188))}function g(e){var t=e.alternate;if(!t){if(t=d(e),t===null)throw Error(l(188));return t!==e?null:e}for(var s=e,i=t;;){var u=s.return;if(u===null)break;var f=u.alternate;if(f===null){if(i=u.return,i!==null){s=i;continue}break}if(u.child===f.child){for(f=u.child;f;){if(f===s)return p(u),e;if(f===i)return p(u),t;f=f.sibling}throw Error(l(188))}if(s.return!==i.return)s=u,i=f;else{for(var y=!1,b=u.child;b;){if(b===s){y=!0,s=u,i=f;break}if(b===i){y=!0,i=u,s=f;break}b=b.sibling}if(!y){for(b=f.child;b;){if(b===s){y=!0,s=f,i=u;break}if(b===i){y=!0,i=f,s=u;break}b=b.sibling}if(!y)throw Error(l(189))}}if(s.alternate!==i)throw Error(l(190))}if(s.tag!==3)throw Error(l(188));return s.stateNode.current===s?e:t}function v(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=v(e),t!==null)return t;e=e.sibling}return null}var _=Object.assign,x=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),A=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),q=Symbol.for("react.consumer"),B=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),ee=Symbol.for("react.suspense"),J=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),ue=Symbol.for("react.activity"),Je=Symbol.for("react.memo_cache_sentinel"),be=Symbol.iterator;function ge(e){return e===null||typeof e!="object"?null:(e=be&&e[be]||e["@@iterator"],typeof e=="function"?e:null)}var Ze=Symbol.for("react.client.reference");function nt(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ze?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case j:return"Fragment";case R:return"Profiler";case k:return"StrictMode";case ee:return"Suspense";case J:return"SuspenseList";case ue:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case A:return"Portal";case B:return e.displayName||"Context";case q:return(e._context.displayName||"Context")+".Consumer";case G:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case P:return t=e.displayName||null,t!==null?t:nt(e.type)||"Memo";case X:t=e._payload,e=e._init;try{return nt(e(t))}catch{}}return null}var F=Array.isArray,U=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},je=[],Re=-1;function T(e){return{current:e}}function V(e){0>Re||(e.current=je[Re],je[Re]=null,Re--)}function Y(e,t){Re++,je[Re]=e.current,e.current=t}var W=T(null),fe=T(null),ye=T(null),de=T(null);function Ge(e,t){switch(Y(ye,t),Y(fe,e),Y(W,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Rp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Rp(t),e=Dp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}V(W),Y(W,e)}function Ue(){V(W),V(fe),V(ye)}function Tt(e){e.memoizedState!==null&&Y(de,e);var t=W.current,s=Dp(t,e.type);t!==s&&(Y(fe,e),Y(W,s))}function mt(e){fe.current===e&&(V(W),V(fe)),de.current===e&&(V(de),Ei._currentValue=K)}var vt,an;function la(e){if(vt===void 0)try{throw Error()}catch(s){var t=s.stack.trim().match(/\n( *(at )?)/);vt=t&&t[1]||"",an=-1<s.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+vt+e+an}var nn=!1;function ps(e,t){if(!e||nn)return"";nn=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var I=function(){throw Error()};if(Object.defineProperty(I.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(I,[])}catch(L){var z=L}Reflect.construct(e,[],I)}else{try{I.call()}catch(L){z=L}e.call(I.prototype)}}else{try{throw Error()}catch(L){z=L}(I=e())&&typeof I.catch=="function"&&I.catch(function(){})}}catch(L){if(L&&z&&typeof L.stack=="string")return[L.stack,z.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=i.DetermineComponentFrameRoot(),y=f[0],b=f[1];if(y&&b){var N=y.split(`
|
|
4
|
+
`),M=b.split(`
|
|
5
|
+
`);for(u=i=0;i<N.length&&!N[i].includes("DetermineComponentFrameRoot");)i++;for(;u<M.length&&!M[u].includes("DetermineComponentFrameRoot");)u++;if(i===N.length||u===M.length)for(i=N.length-1,u=M.length-1;1<=i&&0<=u&&N[i]!==M[u];)u--;for(;1<=i&&0<=u;i--,u--)if(N[i]!==M[u]){if(i!==1||u!==1)do if(i--,u--,0>u||N[i]!==M[u]){var $=`
|
|
6
|
+
`+N[i].replace(" at new "," at ");return e.displayName&&$.includes("<anonymous>")&&($=$.replace("<anonymous>",e.displayName)),$}while(1<=i&&0<=u);break}}}finally{nn=!1,Error.prepareStackTrace=s}return(s=e?e.displayName||e.name:"")?la(s):""}function gs(e,t){switch(e.tag){case 26:case 27:case 5:return la(e.type);case 16:return la("Lazy");case 13:return e.child!==t&&t!==null?la("Suspense Fallback"):la("Suspense");case 19:return la("SuspenseList");case 0:case 15:return ps(e.type,!1);case 11:return ps(e.type.render,!1);case 1:return ps(e.type,!0);case 31:return la("Activity");default:return""}}function Br(e){try{var t="",s=null;do t+=gs(e,s),s=e,e=e.return;while(e);return t}catch(i){return`
|
|
7
|
+
Error generating stack: `+i.message+`
|
|
8
|
+
`+i.stack}}var Oa=Object.prototype.hasOwnProperty,sn=n.unstable_scheduleCallback,ys=n.unstable_cancelCallback,el=n.unstable_shouldYield,tl=n.unstable_requestPaint,pt=n.unstable_now,vs=n.unstable_getCurrentPriorityLevel,ga=n.unstable_ImmediatePriority,zn=n.unstable_UserBlockingPriority,bs=n.unstable_NormalPriority,Ko=n.unstable_LowPriority,xs=n.unstable_IdlePriority,Yo=n.log,Jo=n.unstable_setDisableYieldValue,Un=null,kt=null;function ya(e){if(typeof Yo=="function"&&Jo(e),kt&&typeof kt.setStrictMode=="function")try{kt.setStrictMode(Un,e)}catch{}}var Ot=Math.clz32?Math.clz32:Zo,Xo=Math.log,Qo=Math.LN2;function Zo(e){return e>>>=0,e===0?32:31-(Xo(e)/Qo|0)|0}var ws=256,Ln=262144,_s=4194304;function Ra(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 Ss(e,t,s){var i=e.pendingLanes;if(i===0)return 0;var u=0,f=e.suspendedLanes,y=e.pingedLanes;e=e.warmLanes;var b=i&134217727;return b!==0?(i=b&~f,i!==0?u=Ra(i):(y&=b,y!==0?u=Ra(y):s||(s=b&~e,s!==0&&(u=Ra(s))))):(b=i&~f,b!==0?u=Ra(b):y!==0?u=Ra(y):s||(s=i&~e,s!==0&&(u=Ra(s)))),u===0?0:t!==0&&t!==u&&(t&f)===0&&(f=u&-u,s=t&-t,f>=s||f===32&&(s&4194048)!==0)?t:u}function Bn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Fo(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 O(){var e=_s;return _s<<=1,(_s&62914560)===0&&(_s=4194304),e}function te(e){for(var t=[],s=0;31>s;s++)t.push(e);return t}function Se(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function At(e,t,s,i,u,f){var y=e.pendingLanes;e.pendingLanes=s,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=s,e.entangledLanes&=s,e.errorRecoveryDisabledLanes&=s,e.shellSuspendCounter=0;var b=e.entanglements,N=e.expirationTimes,M=e.hiddenUpdates;for(s=y&~s;0<s;){var $=31-Ot(s),I=1<<$;b[$]=0,N[$]=-1;var z=M[$];if(z!==null)for(M[$]=null,$=0;$<z.length;$++){var L=z[$];L!==null&&(L.lane&=-536870913)}s&=~I}i!==0&&js(e,i,0),f!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=f&~(y&~t))}function js(e,t,s){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-Ot(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|s&261930}function qn(e,t){var s=e.entangledLanes|=t;for(e=e.entanglements;s;){var i=31-Ot(s),u=1<<i;u&t|e[i]&t&&(e[i]|=t),s&=~u}}function $n(e,t){var s=t&-t;return s=(s&42)!==0?1:qr(s),(s&(e.suspendedLanes|t))!==0?0:s}function qr(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 $r(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function yf(){var e=Q.p;return e!==0?e:(e=window.event,e===void 0?32:ag(e.type))}function vf(e,t){var s=Q.p;try{return Q.p=e,t()}finally{Q.p=s}}var rn=Math.random().toString(36).slice(2),bt="__reactFiber$"+rn,Dt="__reactProps$"+rn,Ns="__reactContainer$"+rn,Wo="__reactEvents$"+rn,Pv="__reactListeners$"+rn,Kv="__reactHandles$"+rn,bf="__reactResources$"+rn,Hr="__reactMarker$"+rn;function ec(e){delete e[bt],delete e[Dt],delete e[Wo],delete e[Pv],delete e[Kv]}function Es(e){var t=e[bt];if(t)return t;for(var s=e.parentNode;s;){if(t=s[Ns]||s[bt]){if(s=t.alternate,t.child!==null||s!==null&&s.child!==null)for(e=$p(e);e!==null;){if(s=e[bt])return s;e=$p(e)}return t}e=s,s=e.parentNode}return null}function Ts(e){if(e=e[bt]||e[Ns]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Vr(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(l(33))}function As(e){var t=e[bf];return t||(t=e[bf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function gt(e){e[Hr]=!0}var xf=new Set,wf={};function Hn(e,t){Cs(e,t),Cs(e+"Capture",t)}function Cs(e,t){for(wf[e]=t,e=0;e<t.length;e++)xf.add(t[e])}var Yv=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]*$"),_f={},Sf={};function Jv(e){return Oa.call(Sf,e)?!0:Oa.call(_f,e)?!1:Yv.test(e)?Sf[e]=!0:(_f[e]=!0,!1)}function al(e,t,s){if(Jv(t))if(s===null)e.removeAttribute(t);else{switch(typeof s){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var i=t.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+s)}}function nl(e,t,s){if(s===null)e.removeAttribute(t);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+s)}}function Da(e,t,s,i){if(i===null)e.removeAttribute(s);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(s);return}e.setAttributeNS(t,s,""+i)}}function Zt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function jf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Xv(e,t,s){var i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var u=i.get,f=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return u.call(this)},set:function(y){s=""+y,f.call(this,y)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return s},setValue:function(y){s=""+y},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function tc(e){if(!e._valueTracker){var t=jf(e)?"checked":"value";e._valueTracker=Xv(e,t,""+e[t])}}function Nf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var s=t.getValue(),i="";return e&&(i=jf(e)?e.checked?"true":"false":e.value),e=i,e!==s?(t.setValue(e),!0):!1}function sl(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 Qv=/[\n"\\]/g;function Ft(e){return e.replace(Qv,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ac(e,t,s,i,u,f,y,b){e.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.type=y:e.removeAttribute("type"),t!=null?y==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Zt(t)):e.value!==""+Zt(t)&&(e.value=""+Zt(t)):y!=="submit"&&y!=="reset"||e.removeAttribute("value"),t!=null?nc(e,y,Zt(t)):s!=null?nc(e,y,Zt(s)):i!=null&&e.removeAttribute("value"),u==null&&f!=null&&(e.defaultChecked=!!f),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+Zt(b):e.removeAttribute("name")}function Ef(e,t,s,i,u,f,y,b){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.type=f),t!=null||s!=null){if(!(f!=="submit"&&f!=="reset"||t!=null)){tc(e);return}s=s!=null?""+Zt(s):"",t=t!=null?""+Zt(t):s,b||t===e.value||(e.value=t),e.defaultValue=t}i=i??u,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=b?e.checked:!!i,e.defaultChecked=!!i,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(e.name=y),tc(e)}function nc(e,t,s){t==="number"&&sl(e.ownerDocument)===e||e.defaultValue===""+s||(e.defaultValue=""+s)}function ks(e,t,s,i){if(e=e.options,t){t={};for(var u=0;u<s.length;u++)t["$"+s[u]]=!0;for(s=0;s<e.length;s++)u=t.hasOwnProperty("$"+e[s].value),e[s].selected!==u&&(e[s].selected=u),u&&i&&(e[s].defaultSelected=!0)}else{for(s=""+Zt(s),t=null,u=0;u<e.length;u++){if(e[u].value===s){e[u].selected=!0,i&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function Tf(e,t,s){if(t!=null&&(t=""+Zt(t),t!==e.value&&(e.value=t),s==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=s!=null?""+Zt(s):""}function Af(e,t,s,i){if(t==null){if(i!=null){if(s!=null)throw Error(l(92));if(F(i)){if(1<i.length)throw Error(l(93));i=i[0]}s=i}s==null&&(s=""),t=s}s=Zt(t),e.defaultValue=s,i=e.textContent,i===s&&i!==""&&i!==null&&(e.value=i),tc(e)}function Os(e,t){if(t){var s=e.firstChild;if(s&&s===e.lastChild&&s.nodeType===3){s.nodeValue=t;return}}e.textContent=t}var Zv=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 Cf(e,t,s){var i=t.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?i?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":i?e.setProperty(t,s):typeof s!="number"||s===0||Zv.has(t)?t==="float"?e.cssFloat=s:e[t]=(""+s).trim():e[t]=s+"px"}function kf(e,t,s){if(t!=null&&typeof t!="object")throw Error(l(62));if(e=e.style,s!=null){for(var i in s)!s.hasOwnProperty(i)||t!=null&&t.hasOwnProperty(i)||(i.indexOf("--")===0?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="");for(var u in t)i=t[u],t.hasOwnProperty(u)&&s[u]!==i&&Cf(e,u,i)}else for(var f in t)t.hasOwnProperty(f)&&Cf(e,f,t[f])}function sc(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 Fv=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"]]),Wv=/^[\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 rl(e){return Wv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Ma(){}var rc=null;function ic(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Rs=null,Ds=null;function Of(e){var t=Ts(e);if(t&&(e=t.stateNode)){var s=e[Dt]||null;e:switch(e=t.stateNode,t.type){case"input":if(ac(e,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),t=s.name,s.type==="radio"&&t!=null){for(s=e;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+Ft(""+t)+'"][type="radio"]'),t=0;t<s.length;t++){var i=s[t];if(i!==e&&i.form===e.form){var u=i[Dt]||null;if(!u)throw Error(l(90));ac(i,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<s.length;t++)i=s[t],i.form===e.form&&Nf(i)}break e;case"textarea":Tf(e,s.value,s.defaultValue);break e;case"select":t=s.value,t!=null&&ks(e,!!s.multiple,t,!1)}}}var lc=!1;function Rf(e,t,s){if(lc)return e(t,s);lc=!0;try{var i=e(t);return i}finally{if(lc=!1,(Rs!==null||Ds!==null)&&(Kl(),Rs&&(t=Rs,e=Ds,Ds=Rs=null,Of(t),e)))for(t=0;t<e.length;t++)Of(e[t])}}function Ir(e,t){var s=e.stateNode;if(s===null)return null;var i=s[Dt]||null;if(i===null)return null;s=i[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":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(s&&typeof s!="function")throw Error(l(231,t,typeof s));return s}var za=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),oc=!1;if(za)try{var Gr={};Object.defineProperty(Gr,"passive",{get:function(){oc=!0}}),window.addEventListener("test",Gr,Gr),window.removeEventListener("test",Gr,Gr)}catch{oc=!1}var ln=null,cc=null,il=null;function Df(){if(il)return il;var e,t=cc,s=t.length,i,u="value"in ln?ln.value:ln.textContent,f=u.length;for(e=0;e<s&&t[e]===u[e];e++);var y=s-e;for(i=1;i<=y&&t[s-i]===u[f-i];i++);return il=u.slice(e,1<i?1-i:void 0)}function ll(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 ol(){return!0}function Mf(){return!1}function Mt(e){function t(s,i,u,f,y){this._reactName=s,this._targetInst=u,this.type=i,this.nativeEvent=f,this.target=y,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(s=e[b],this[b]=s?s(f):f[b]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?ol:Mf,this.isPropagationStopped=Mf,this}return _(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=ol)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=ol)},persist:function(){},isPersistent:ol}),t}var Vn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},cl=Mt(Vn),Pr=_({},Vn,{view:0,detail:0}),e0=Mt(Pr),uc,dc,Kr,ul=_({},Pr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:hc,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!==Kr&&(Kr&&e.type==="mousemove"?(uc=e.screenX-Kr.screenX,dc=e.screenY-Kr.screenY):dc=uc=0,Kr=e),uc)},movementY:function(e){return"movementY"in e?e.movementY:dc}}),zf=Mt(ul),t0=_({},ul,{dataTransfer:0}),a0=Mt(t0),n0=_({},Pr,{relatedTarget:0}),fc=Mt(n0),s0=_({},Vn,{animationName:0,elapsedTime:0,pseudoElement:0}),r0=Mt(s0),i0=_({},Vn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),l0=Mt(i0),o0=_({},Vn,{data:0}),Uf=Mt(o0),c0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},u0={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"},d0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function f0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=d0[e])?!!t[e]:!1}function hc(){return f0}var h0=_({},Pr,{key:function(e){if(e.key){var t=c0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ll(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?u0[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:hc,charCode:function(e){return e.type==="keypress"?ll(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ll(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),m0=Mt(h0),p0=_({},ul,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Lf=Mt(p0),g0=_({},Pr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:hc}),y0=Mt(g0),v0=_({},Vn,{propertyName:0,elapsedTime:0,pseudoElement:0}),b0=Mt(v0),x0=_({},ul,{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}),w0=Mt(x0),_0=_({},Vn,{newState:0,oldState:0}),S0=Mt(_0),j0=[9,13,27,32],mc=za&&"CompositionEvent"in window,Yr=null;za&&"documentMode"in document&&(Yr=document.documentMode);var N0=za&&"TextEvent"in window&&!Yr,Bf=za&&(!mc||Yr&&8<Yr&&11>=Yr),qf=" ",$f=!1;function Hf(e,t){switch(e){case"keyup":return j0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Vf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ms=!1;function E0(e,t){switch(e){case"compositionend":return Vf(t);case"keypress":return t.which!==32?null:($f=!0,qf);case"textInput":return e=t.data,e===qf&&$f?null:e;default:return null}}function T0(e,t){if(Ms)return e==="compositionend"||!mc&&Hf(e,t)?(e=Df(),il=cc=ln=null,Ms=!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 Bf&&t.locale!=="ko"?null:t.data;default:return null}}var A0={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 If(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!A0[e.type]:t==="textarea"}function Gf(e,t,s,i){Rs?Ds?Ds.push(i):Ds=[i]:Rs=i,t=Wl(t,"onChange"),0<t.length&&(s=new cl("onChange","change",null,s,i),e.push({event:s,listeners:t}))}var Jr=null,Xr=null;function C0(e){Ep(e,0)}function dl(e){var t=Vr(e);if(Nf(t))return e}function Pf(e,t){if(e==="change")return t}var Kf=!1;if(za){var pc;if(za){var gc="oninput"in document;if(!gc){var Yf=document.createElement("div");Yf.setAttribute("oninput","return;"),gc=typeof Yf.oninput=="function"}pc=gc}else pc=!1;Kf=pc&&(!document.documentMode||9<document.documentMode)}function Jf(){Jr&&(Jr.detachEvent("onpropertychange",Xf),Xr=Jr=null)}function Xf(e){if(e.propertyName==="value"&&dl(Xr)){var t=[];Gf(t,Xr,e,ic(e)),Rf(C0,t)}}function k0(e,t,s){e==="focusin"?(Jf(),Jr=t,Xr=s,Jr.attachEvent("onpropertychange",Xf)):e==="focusout"&&Jf()}function O0(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return dl(Xr)}function R0(e,t){if(e==="click")return dl(t)}function D0(e,t){if(e==="input"||e==="change")return dl(t)}function M0(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ht=typeof Object.is=="function"?Object.is:M0;function Qr(e,t){if(Ht(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var s=Object.keys(e),i=Object.keys(t);if(s.length!==i.length)return!1;for(i=0;i<s.length;i++){var u=s[i];if(!Oa.call(t,u)||!Ht(e[u],t[u]))return!1}return!0}function Qf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Zf(e,t){var s=Qf(e);e=0;for(var i;s;){if(s.nodeType===3){if(i=e+s.textContent.length,e<=t&&i>=t)return{node:s,offset:t-e};e=i}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Qf(s)}}function Ff(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ff(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Wf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=sl(e.document);t instanceof e.HTMLIFrameElement;){try{var s=typeof t.contentWindow.location.href=="string"}catch{s=!1}if(s)e=t.contentWindow;else break;t=sl(e.document)}return t}function yc(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 z0=za&&"documentMode"in document&&11>=document.documentMode,zs=null,vc=null,Zr=null,bc=!1;function eh(e,t,s){var i=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;bc||zs==null||zs!==sl(i)||(i=zs,"selectionStart"in i&&yc(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Zr&&Qr(Zr,i)||(Zr=i,i=Wl(vc,"onSelect"),0<i.length&&(t=new cl("onSelect","select",null,t,s),e.push({event:t,listeners:i}),t.target=zs)))}function In(e,t){var s={};return s[e.toLowerCase()]=t.toLowerCase(),s["Webkit"+e]="webkit"+t,s["Moz"+e]="moz"+t,s}var Us={animationend:In("Animation","AnimationEnd"),animationiteration:In("Animation","AnimationIteration"),animationstart:In("Animation","AnimationStart"),transitionrun:In("Transition","TransitionRun"),transitionstart:In("Transition","TransitionStart"),transitioncancel:In("Transition","TransitionCancel"),transitionend:In("Transition","TransitionEnd")},xc={},th={};za&&(th=document.createElement("div").style,"AnimationEvent"in window||(delete Us.animationend.animation,delete Us.animationiteration.animation,delete Us.animationstart.animation),"TransitionEvent"in window||delete Us.transitionend.transition);function Gn(e){if(xc[e])return xc[e];if(!Us[e])return e;var t=Us[e],s;for(s in t)if(t.hasOwnProperty(s)&&s in th)return xc[e]=t[s];return e}var ah=Gn("animationend"),nh=Gn("animationiteration"),sh=Gn("animationstart"),U0=Gn("transitionrun"),L0=Gn("transitionstart"),B0=Gn("transitioncancel"),rh=Gn("transitionend"),ih=new Map,wc="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(" ");wc.push("scrollEnd");function oa(e,t){ih.set(e,t),Hn(t,[e])}var fl=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)},Wt=[],Ls=0,_c=0;function hl(){for(var e=Ls,t=_c=Ls=0;t<e;){var s=Wt[t];Wt[t++]=null;var i=Wt[t];Wt[t++]=null;var u=Wt[t];Wt[t++]=null;var f=Wt[t];if(Wt[t++]=null,i!==null&&u!==null){var y=i.pending;y===null?u.next=u:(u.next=y.next,y.next=u),i.pending=u}f!==0&&lh(s,u,f)}}function ml(e,t,s,i){Wt[Ls++]=e,Wt[Ls++]=t,Wt[Ls++]=s,Wt[Ls++]=i,_c|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function Sc(e,t,s,i){return ml(e,t,s,i),pl(e)}function Pn(e,t){return ml(e,null,null,t),pl(e)}function lh(e,t,s){e.lanes|=s;var i=e.alternate;i!==null&&(i.lanes|=s);for(var u=!1,f=e.return;f!==null;)f.childLanes|=s,i=f.alternate,i!==null&&(i.childLanes|=s),f.tag===22&&(e=f.stateNode,e===null||e._visibility&1||(u=!0)),e=f,f=f.return;return e.tag===3?(f=e.stateNode,u&&t!==null&&(u=31-Ot(s),e=f.hiddenUpdates,i=e[u],i===null?e[u]=[t]:i.push(t),t.lane=s|536870912),f):null}function pl(e){if(50<bi)throw bi=0,Ru=null,Error(l(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Bs={};function q0(e,t,s,i){this.tag=e,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Vt(e,t,s,i){return new q0(e,t,s,i)}function jc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ua(e,t){var s=e.alternate;return s===null?(s=Vt(e.tag,t,e.key,e.mode),s.elementType=e.elementType,s.type=e.type,s.stateNode=e.stateNode,s.alternate=e,e.alternate=s):(s.pendingProps=t,s.type=e.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=e.flags&65011712,s.childLanes=e.childLanes,s.lanes=e.lanes,s.child=e.child,s.memoizedProps=e.memoizedProps,s.memoizedState=e.memoizedState,s.updateQueue=e.updateQueue,t=e.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},s.sibling=e.sibling,s.index=e.index,s.ref=e.ref,s.refCleanup=e.refCleanup,s}function oh(e,t){e.flags&=65011714;var s=e.alternate;return s===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=s.childLanes,e.lanes=s.lanes,e.child=s.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=s.memoizedProps,e.memoizedState=s.memoizedState,e.updateQueue=s.updateQueue,e.type=s.type,t=s.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function gl(e,t,s,i,u,f){var y=0;if(i=e,typeof e=="function")jc(e)&&(y=1);else if(typeof e=="string")y=Gb(e,s,W.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case ue:return e=Vt(31,s,t,u),e.elementType=ue,e.lanes=f,e;case j:return Kn(s.children,u,f,t);case k:y=8,u|=24;break;case R:return e=Vt(12,s,t,u|2),e.elementType=R,e.lanes=f,e;case ee:return e=Vt(13,s,t,u),e.elementType=ee,e.lanes=f,e;case J:return e=Vt(19,s,t,u),e.elementType=J,e.lanes=f,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case B:y=10;break e;case q:y=9;break e;case G:y=11;break e;case P:y=14;break e;case X:y=16,i=null;break e}y=29,s=Error(l(130,e===null?"null":typeof e,"")),i=null}return t=Vt(y,s,t,u),t.elementType=e,t.type=i,t.lanes=f,t}function Kn(e,t,s,i){return e=Vt(7,e,i,t),e.lanes=s,e}function Nc(e,t,s){return e=Vt(6,e,null,t),e.lanes=s,e}function ch(e){var t=Vt(18,null,null,0);return t.stateNode=e,t}function Ec(e,t,s){return t=Vt(4,e.children!==null?e.children:[],e.key,t),t.lanes=s,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var uh=new WeakMap;function ea(e,t){if(typeof e=="object"&&e!==null){var s=uh.get(e);return s!==void 0?s:(t={value:e,source:t,stack:Br(t)},uh.set(e,t),t)}return{value:e,source:t,stack:Br(t)}}var qs=[],$s=0,yl=null,Fr=0,ta=[],aa=0,on=null,va=1,ba="";function La(e,t){qs[$s++]=Fr,qs[$s++]=yl,yl=e,Fr=t}function dh(e,t,s){ta[aa++]=va,ta[aa++]=ba,ta[aa++]=on,on=e;var i=va;e=ba;var u=32-Ot(i)-1;i&=~(1<<u),s+=1;var f=32-Ot(t)+u;if(30<f){var y=u-u%5;f=(i&(1<<y)-1).toString(32),i>>=y,u-=y,va=1<<32-Ot(t)+u|s<<u|i,ba=f+e}else va=1<<f|s<<u|i,ba=e}function Tc(e){e.return!==null&&(La(e,1),dh(e,1,0))}function Ac(e){for(;e===yl;)yl=qs[--$s],qs[$s]=null,Fr=qs[--$s],qs[$s]=null;for(;e===on;)on=ta[--aa],ta[aa]=null,ba=ta[--aa],ta[aa]=null,va=ta[--aa],ta[aa]=null}function fh(e,t){ta[aa++]=va,ta[aa++]=ba,ta[aa++]=on,va=t.id,ba=t.overflow,on=e}var xt=null,Ke=null,Oe=!1,cn=null,na=!1,Cc=Error(l(519));function un(e){var t=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Wr(ea(t,e)),Cc}function hh(e){var t=e.stateNode,s=e.type,i=e.memoizedProps;switch(t[bt]=e,t[Dt]=i,s){case"dialog":Ee("cancel",t),Ee("close",t);break;case"iframe":case"object":case"embed":Ee("load",t);break;case"video":case"audio":for(s=0;s<wi.length;s++)Ee(wi[s],t);break;case"source":Ee("error",t);break;case"img":case"image":case"link":Ee("error",t),Ee("load",t);break;case"details":Ee("toggle",t);break;case"input":Ee("invalid",t),Ef(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":Ee("invalid",t);break;case"textarea":Ee("invalid",t),Af(t,i.value,i.defaultValue,i.children)}s=i.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||t.textContent===""+s||i.suppressHydrationWarning===!0||kp(t.textContent,s)?(i.popover!=null&&(Ee("beforetoggle",t),Ee("toggle",t)),i.onScroll!=null&&Ee("scroll",t),i.onScrollEnd!=null&&Ee("scrollend",t),i.onClick!=null&&(t.onclick=Ma),t=!0):t=!1,t||un(e,!0)}function mh(e){for(xt=e.return;xt;)switch(xt.tag){case 5:case 31:case 13:na=!1;return;case 27:case 3:na=!0;return;default:xt=xt.return}}function Hs(e){if(e!==xt)return!1;if(!Oe)return mh(e),Oe=!0,!1;var t=e.tag,s;if((s=t!==3&&t!==27)&&((s=t===5)&&(s=e.type,s=!(s!=="form"&&s!=="button")||Yu(e.type,e.memoizedProps)),s=!s),s&&Ke&&un(e),mh(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ke=qp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ke=qp(e)}else t===27?(t=Ke,jn(e.type)?(e=Fu,Fu=null,Ke=e):Ke=t):Ke=xt?ra(e.stateNode.nextSibling):null;return!0}function Yn(){Ke=xt=null,Oe=!1}function kc(){var e=cn;return e!==null&&(Bt===null?Bt=e:Bt.push.apply(Bt,e),cn=null),e}function Wr(e){cn===null?cn=[e]:cn.push(e)}var Oc=T(null),Jn=null,Ba=null;function dn(e,t,s){Y(Oc,t._currentValue),t._currentValue=s}function qa(e){e._currentValue=Oc.current,V(Oc)}function Rc(e,t,s){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===s)break;e=e.return}}function Dc(e,t,s,i){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var f=u.dependencies;if(f!==null){var y=u.child;f=f.firstContext;e:for(;f!==null;){var b=f;f=u;for(var N=0;N<t.length;N++)if(b.context===t[N]){f.lanes|=s,b=f.alternate,b!==null&&(b.lanes|=s),Rc(f.return,s,e),i||(y=null);break e}f=b.next}}else if(u.tag===18){if(y=u.return,y===null)throw Error(l(341));y.lanes|=s,f=y.alternate,f!==null&&(f.lanes|=s),Rc(y,s,e),y=null}else y=u.child;if(y!==null)y.return=u;else for(y=u;y!==null;){if(y===e){y=null;break}if(u=y.sibling,u!==null){u.return=y.return,y=u;break}y=y.return}u=y}}function Vs(e,t,s,i){e=null;for(var u=t,f=!1;u!==null;){if(!f){if((u.flags&524288)!==0)f=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var y=u.alternate;if(y===null)throw Error(l(387));if(y=y.memoizedProps,y!==null){var b=u.type;Ht(u.pendingProps.value,y.value)||(e!==null?e.push(b):e=[b])}}else if(u===de.current){if(y=u.alternate,y===null)throw Error(l(387));y.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(Ei):e=[Ei])}u=u.return}e!==null&&Dc(t,e,s,i),t.flags|=262144}function vl(e){for(e=e.firstContext;e!==null;){if(!Ht(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Xn(e){Jn=e,Ba=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function wt(e){return ph(Jn,e)}function bl(e,t){return Jn===null&&Xn(e),ph(e,t)}function ph(e,t){var s=t._currentValue;if(t={context:t,memoizedValue:s,next:null},Ba===null){if(e===null)throw Error(l(308));Ba=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ba=Ba.next=t;return s}var $0=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(s,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(s){return s()})}},H0=n.unstable_scheduleCallback,V0=n.unstable_NormalPriority,st={$$typeof:B,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Mc(){return{controller:new $0,data:new Map,refCount:0}}function ei(e){e.refCount--,e.refCount===0&&H0(V0,function(){e.controller.abort()})}var ti=null,zc=0,Is=0,Gs=null;function I0(e,t){if(ti===null){var s=ti=[];zc=0,Is=Bu(),Gs={status:"pending",value:void 0,then:function(i){s.push(i)}}}return zc++,t.then(gh,gh),t}function gh(){if(--zc===0&&ti!==null){Gs!==null&&(Gs.status="fulfilled");var e=ti;ti=null,Is=0,Gs=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function G0(e,t){var s=[],i={status:"pending",value:null,reason:null,then:function(u){s.push(u)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var u=0;u<s.length;u++)(0,s[u])(t)},function(u){for(i.status="rejected",i.reason=u,u=0;u<s.length;u++)(0,s[u])(void 0)}),i}var yh=U.S;U.S=function(e,t){ep=pt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&I0(e,t),yh!==null&&yh(e,t)};var Qn=T(null);function Uc(){var e=Qn.current;return e!==null?e:Ie.pooledCache}function xl(e,t){t===null?Y(Qn,Qn.current):Y(Qn,t.pool)}function vh(){var e=Uc();return e===null?null:{parent:st._currentValue,pool:e}}var Ps=Error(l(460)),Lc=Error(l(474)),wl=Error(l(542)),_l={then:function(){}};function bh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function xh(e,t,s){switch(s=e[s],s===void 0?e.push(t):s!==t&&(t.then(Ma,Ma),t=s),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,_h(e),e;default:if(typeof t.status=="string")t.then(Ma,Ma);else{if(e=Ie,e!==null&&100<e.shellSuspendCounter)throw Error(l(482));e=t,e.status="pending",e.then(function(i){if(t.status==="pending"){var u=t;u.status="fulfilled",u.value=i}},function(i){if(t.status==="pending"){var u=t;u.status="rejected",u.reason=i}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,_h(e),e}throw Fn=t,Ps}}function Zn(e){try{var t=e._init;return t(e._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(Fn=s,Ps):s}}var Fn=null;function wh(){if(Fn===null)throw Error(l(459));var e=Fn;return Fn=null,e}function _h(e){if(e===Ps||e===wl)throw Error(l(483))}var Ks=null,ai=0;function Sl(e){var t=ai;return ai+=1,Ks===null&&(Ks=[]),xh(Ks,e,t)}function ni(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function jl(e,t){throw t.$$typeof===x?Error(l(525)):(e=Object.prototype.toString.call(t),Error(l(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Sh(e){function t(C,E){if(e){var D=C.deletions;D===null?(C.deletions=[E],C.flags|=16):D.push(E)}}function s(C,E){if(!e)return null;for(;E!==null;)t(C,E),E=E.sibling;return null}function i(C){for(var E=new Map;C!==null;)C.key!==null?E.set(C.key,C):E.set(C.index,C),C=C.sibling;return E}function u(C,E){return C=Ua(C,E),C.index=0,C.sibling=null,C}function f(C,E,D){return C.index=D,e?(D=C.alternate,D!==null?(D=D.index,D<E?(C.flags|=67108866,E):D):(C.flags|=67108866,E)):(C.flags|=1048576,E)}function y(C){return e&&C.alternate===null&&(C.flags|=67108866),C}function b(C,E,D,H){return E===null||E.tag!==6?(E=Nc(D,C.mode,H),E.return=C,E):(E=u(E,D),E.return=C,E)}function N(C,E,D,H){var ce=D.type;return ce===j?$(C,E,D.props.children,H,D.key):E!==null&&(E.elementType===ce||typeof ce=="object"&&ce!==null&&ce.$$typeof===X&&Zn(ce)===E.type)?(E=u(E,D.props),ni(E,D),E.return=C,E):(E=gl(D.type,D.key,D.props,null,C.mode,H),ni(E,D),E.return=C,E)}function M(C,E,D,H){return E===null||E.tag!==4||E.stateNode.containerInfo!==D.containerInfo||E.stateNode.implementation!==D.implementation?(E=Ec(D,C.mode,H),E.return=C,E):(E=u(E,D.children||[]),E.return=C,E)}function $(C,E,D,H,ce){return E===null||E.tag!==7?(E=Kn(D,C.mode,H,ce),E.return=C,E):(E=u(E,D),E.return=C,E)}function I(C,E,D){if(typeof E=="string"&&E!==""||typeof E=="number"||typeof E=="bigint")return E=Nc(""+E,C.mode,D),E.return=C,E;if(typeof E=="object"&&E!==null){switch(E.$$typeof){case S:return D=gl(E.type,E.key,E.props,null,C.mode,D),ni(D,E),D.return=C,D;case A:return E=Ec(E,C.mode,D),E.return=C,E;case X:return E=Zn(E),I(C,E,D)}if(F(E)||ge(E))return E=Kn(E,C.mode,D,null),E.return=C,E;if(typeof E.then=="function")return I(C,Sl(E),D);if(E.$$typeof===B)return I(C,bl(C,E),D);jl(C,E)}return null}function z(C,E,D,H){var ce=E!==null?E.key:null;if(typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint")return ce!==null?null:b(C,E,""+D,H);if(typeof D=="object"&&D!==null){switch(D.$$typeof){case S:return D.key===ce?N(C,E,D,H):null;case A:return D.key===ce?M(C,E,D,H):null;case X:return D=Zn(D),z(C,E,D,H)}if(F(D)||ge(D))return ce!==null?null:$(C,E,D,H,null);if(typeof D.then=="function")return z(C,E,Sl(D),H);if(D.$$typeof===B)return z(C,E,bl(C,D),H);jl(C,D)}return null}function L(C,E,D,H,ce){if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return C=C.get(D)||null,b(E,C,""+H,ce);if(typeof H=="object"&&H!==null){switch(H.$$typeof){case S:return C=C.get(H.key===null?D:H.key)||null,N(E,C,H,ce);case A:return C=C.get(H.key===null?D:H.key)||null,M(E,C,H,ce);case X:return H=Zn(H),L(C,E,D,H,ce)}if(F(H)||ge(H))return C=C.get(D)||null,$(E,C,H,ce,null);if(typeof H.then=="function")return L(C,E,D,Sl(H),ce);if(H.$$typeof===B)return L(C,E,D,bl(E,H),ce);jl(E,H)}return null}function ae(C,E,D,H){for(var ce=null,De=null,ie=E,we=E=0,Ce=null;ie!==null&&we<D.length;we++){ie.index>we?(Ce=ie,ie=null):Ce=ie.sibling;var Me=z(C,ie,D[we],H);if(Me===null){ie===null&&(ie=Ce);break}e&&ie&&Me.alternate===null&&t(C,ie),E=f(Me,E,we),De===null?ce=Me:De.sibling=Me,De=Me,ie=Ce}if(we===D.length)return s(C,ie),Oe&&La(C,we),ce;if(ie===null){for(;we<D.length;we++)ie=I(C,D[we],H),ie!==null&&(E=f(ie,E,we),De===null?ce=ie:De.sibling=ie,De=ie);return Oe&&La(C,we),ce}for(ie=i(ie);we<D.length;we++)Ce=L(ie,C,we,D[we],H),Ce!==null&&(e&&Ce.alternate!==null&&ie.delete(Ce.key===null?we:Ce.key),E=f(Ce,E,we),De===null?ce=Ce:De.sibling=Ce,De=Ce);return e&&ie.forEach(function(Cn){return t(C,Cn)}),Oe&&La(C,we),ce}function he(C,E,D,H){if(D==null)throw Error(l(151));for(var ce=null,De=null,ie=E,we=E=0,Ce=null,Me=D.next();ie!==null&&!Me.done;we++,Me=D.next()){ie.index>we?(Ce=ie,ie=null):Ce=ie.sibling;var Cn=z(C,ie,Me.value,H);if(Cn===null){ie===null&&(ie=Ce);break}e&&ie&&Cn.alternate===null&&t(C,ie),E=f(Cn,E,we),De===null?ce=Cn:De.sibling=Cn,De=Cn,ie=Ce}if(Me.done)return s(C,ie),Oe&&La(C,we),ce;if(ie===null){for(;!Me.done;we++,Me=D.next())Me=I(C,Me.value,H),Me!==null&&(E=f(Me,E,we),De===null?ce=Me:De.sibling=Me,De=Me);return Oe&&La(C,we),ce}for(ie=i(ie);!Me.done;we++,Me=D.next())Me=L(ie,C,we,Me.value,H),Me!==null&&(e&&Me.alternate!==null&&ie.delete(Me.key===null?we:Me.key),E=f(Me,E,we),De===null?ce=Me:De.sibling=Me,De=Me);return e&&ie.forEach(function(tx){return t(C,tx)}),Oe&&La(C,we),ce}function Ve(C,E,D,H){if(typeof D=="object"&&D!==null&&D.type===j&&D.key===null&&(D=D.props.children),typeof D=="object"&&D!==null){switch(D.$$typeof){case S:e:{for(var ce=D.key;E!==null;){if(E.key===ce){if(ce=D.type,ce===j){if(E.tag===7){s(C,E.sibling),H=u(E,D.props.children),H.return=C,C=H;break e}}else if(E.elementType===ce||typeof ce=="object"&&ce!==null&&ce.$$typeof===X&&Zn(ce)===E.type){s(C,E.sibling),H=u(E,D.props),ni(H,D),H.return=C,C=H;break e}s(C,E);break}else t(C,E);E=E.sibling}D.type===j?(H=Kn(D.props.children,C.mode,H,D.key),H.return=C,C=H):(H=gl(D.type,D.key,D.props,null,C.mode,H),ni(H,D),H.return=C,C=H)}return y(C);case A:e:{for(ce=D.key;E!==null;){if(E.key===ce)if(E.tag===4&&E.stateNode.containerInfo===D.containerInfo&&E.stateNode.implementation===D.implementation){s(C,E.sibling),H=u(E,D.children||[]),H.return=C,C=H;break e}else{s(C,E);break}else t(C,E);E=E.sibling}H=Ec(D,C.mode,H),H.return=C,C=H}return y(C);case X:return D=Zn(D),Ve(C,E,D,H)}if(F(D))return ae(C,E,D,H);if(ge(D)){if(ce=ge(D),typeof ce!="function")throw Error(l(150));return D=ce.call(D),he(C,E,D,H)}if(typeof D.then=="function")return Ve(C,E,Sl(D),H);if(D.$$typeof===B)return Ve(C,E,bl(C,D),H);jl(C,D)}return typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint"?(D=""+D,E!==null&&E.tag===6?(s(C,E.sibling),H=u(E,D),H.return=C,C=H):(s(C,E),H=Nc(D,C.mode,H),H.return=C,C=H),y(C)):s(C,E)}return function(C,E,D,H){try{ai=0;var ce=Ve(C,E,D,H);return Ks=null,ce}catch(ie){if(ie===Ps||ie===wl)throw ie;var De=Vt(29,ie,null,C.mode);return De.lanes=H,De.return=C,De}}}var Wn=Sh(!0),jh=Sh(!1),fn=!1;function Bc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qc(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 hn(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function mn(e,t,s){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(ze&2)!==0){var u=i.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),i.pending=t,t=pl(e),lh(e,null,s),t}return ml(e,i,t,s),pl(e)}function si(e,t,s){if(t=t.updateQueue,t!==null&&(t=t.shared,(s&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,s|=i,t.lanes=s,qn(e,s)}}function $c(e,t){var s=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,s===i)){var u=null,f=null;if(s=s.firstBaseUpdate,s!==null){do{var y={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};f===null?u=f=y:f=f.next=y,s=s.next}while(s!==null);f===null?u=f=t:f=f.next=t}else u=f=t;s={baseState:i.baseState,firstBaseUpdate:u,lastBaseUpdate:f,shared:i.shared,callbacks:i.callbacks},e.updateQueue=s;return}e=s.lastBaseUpdate,e===null?s.firstBaseUpdate=t:e.next=t,s.lastBaseUpdate=t}var Hc=!1;function ri(){if(Hc){var e=Gs;if(e!==null)throw e}}function ii(e,t,s,i){Hc=!1;var u=e.updateQueue;fn=!1;var f=u.firstBaseUpdate,y=u.lastBaseUpdate,b=u.shared.pending;if(b!==null){u.shared.pending=null;var N=b,M=N.next;N.next=null,y===null?f=M:y.next=M,y=N;var $=e.alternate;$!==null&&($=$.updateQueue,b=$.lastBaseUpdate,b!==y&&(b===null?$.firstBaseUpdate=M:b.next=M,$.lastBaseUpdate=N))}if(f!==null){var I=u.baseState;y=0,$=M=N=null,b=f;do{var z=b.lane&-536870913,L=z!==b.lane;if(L?(Ae&z)===z:(i&z)===z){z!==0&&z===Is&&(Hc=!0),$!==null&&($=$.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var ae=e,he=b;z=t;var Ve=s;switch(he.tag){case 1:if(ae=he.payload,typeof ae=="function"){I=ae.call(Ve,I,z);break e}I=ae;break e;case 3:ae.flags=ae.flags&-65537|128;case 0:if(ae=he.payload,z=typeof ae=="function"?ae.call(Ve,I,z):ae,z==null)break e;I=_({},I,z);break e;case 2:fn=!0}}z=b.callback,z!==null&&(e.flags|=64,L&&(e.flags|=8192),L=u.callbacks,L===null?u.callbacks=[z]:L.push(z))}else L={lane:z,tag:b.tag,payload:b.payload,callback:b.callback,next:null},$===null?(M=$=L,N=I):$=$.next=L,y|=z;if(b=b.next,b===null){if(b=u.shared.pending,b===null)break;L=b,b=L.next,L.next=null,u.lastBaseUpdate=L,u.shared.pending=null}}while(!0);$===null&&(N=I),u.baseState=N,u.firstBaseUpdate=M,u.lastBaseUpdate=$,f===null&&(u.shared.lanes=0),bn|=y,e.lanes=y,e.memoizedState=I}}function Nh(e,t){if(typeof e!="function")throw Error(l(191,e));e.call(t)}function Eh(e,t){var s=e.callbacks;if(s!==null)for(e.callbacks=null,e=0;e<s.length;e++)Nh(s[e],t)}var Ys=T(null),Nl=T(0);function Th(e,t){e=Ja,Y(Nl,e),Y(Ys,t),Ja=e|t.baseLanes}function Vc(){Y(Nl,Ja),Y(Ys,Ys.current)}function Ic(){Ja=Nl.current,V(Ys),V(Nl)}var It=T(null),sa=null;function pn(e){var t=e.alternate;Y(tt,tt.current&1),Y(It,e),sa===null&&(t===null||Ys.current!==null||t.memoizedState!==null)&&(sa=e)}function Gc(e){Y(tt,tt.current),Y(It,e),sa===null&&(sa=e)}function Ah(e){e.tag===22?(Y(tt,tt.current),Y(It,e),sa===null&&(sa=e)):gn()}function gn(){Y(tt,tt.current),Y(It,It.current)}function Gt(e){V(It),sa===e&&(sa=null),V(tt)}var tt=T(0);function El(e){for(var t=e;t!==null;){if(t.tag===13){var s=t.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||Qu(s)||Zu(s)))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 $a=0,xe=null,$e=null,rt=null,Tl=!1,Js=!1,es=!1,Al=0,li=0,Xs=null,P0=0;function Fe(){throw Error(l(321))}function Pc(e,t){if(t===null)return!1;for(var s=0;s<t.length&&s<e.length;s++)if(!Ht(e[s],t[s]))return!1;return!0}function Kc(e,t,s,i,u,f){return $a=f,xe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,U.H=e===null||e.memoizedState===null?dm:lu,es=!1,f=s(i,u),es=!1,Js&&(f=kh(t,s,i,u)),Ch(e),f}function Ch(e){U.H=ui;var t=$e!==null&&$e.next!==null;if($a=0,rt=$e=xe=null,Tl=!1,li=0,Xs=null,t)throw Error(l(300));e===null||it||(e=e.dependencies,e!==null&&vl(e)&&(it=!0))}function kh(e,t,s,i){xe=e;var u=0;do{if(Js&&(Xs=null),li=0,Js=!1,25<=u)throw Error(l(301));if(u+=1,rt=$e=null,e.updateQueue!=null){var f=e.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}U.H=fm,f=t(s,i)}while(Js);return f}function K0(){var e=U.H,t=e.useState()[0];return t=typeof t.then=="function"?oi(t):t,e=e.useState()[0],($e!==null?$e.memoizedState:null)!==e&&(xe.flags|=1024),t}function Yc(){var e=Al!==0;return Al=0,e}function Jc(e,t,s){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s}function Xc(e){if(Tl){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Tl=!1}$a=0,rt=$e=xe=null,Js=!1,li=Al=0,Xs=null}function Rt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return rt===null?xe.memoizedState=rt=e:rt=rt.next=e,rt}function at(){if($e===null){var e=xe.alternate;e=e!==null?e.memoizedState:null}else e=$e.next;var t=rt===null?xe.memoizedState:rt.next;if(t!==null)rt=t,$e=e;else{if(e===null)throw xe.alternate===null?Error(l(467)):Error(l(310));$e=e,e={memoizedState:$e.memoizedState,baseState:$e.baseState,baseQueue:$e.baseQueue,queue:$e.queue,next:null},rt===null?xe.memoizedState=rt=e:rt=rt.next=e}return rt}function Cl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function oi(e){var t=li;return li+=1,Xs===null&&(Xs=[]),e=xh(Xs,e,t),t=xe,(rt===null?t.memoizedState:rt.next)===null&&(t=t.alternate,U.H=t===null||t.memoizedState===null?dm:lu),e}function kl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return oi(e);if(e.$$typeof===B)return wt(e)}throw Error(l(438,String(e)))}function Qc(e){var t=null,s=xe.updateQueue;if(s!==null&&(t=s.memoCache),t==null){var i=xe.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(t={data:i.data.map(function(u){return u.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),s===null&&(s=Cl(),xe.updateQueue=s),s.memoCache=t,s=t.data[t.index],s===void 0)for(s=t.data[t.index]=Array(e),i=0;i<e;i++)s[i]=Je;return t.index++,s}function Ha(e,t){return typeof t=="function"?t(e):t}function Ol(e){var t=at();return Zc(t,$e,e)}function Zc(e,t,s){var i=e.queue;if(i===null)throw Error(l(311));i.lastRenderedReducer=s;var u=e.baseQueue,f=i.pending;if(f!==null){if(u!==null){var y=u.next;u.next=f.next,f.next=y}t.baseQueue=u=f,i.pending=null}if(f=e.baseState,u===null)e.memoizedState=f;else{t=u.next;var b=y=null,N=null,M=t,$=!1;do{var I=M.lane&-536870913;if(I!==M.lane?(Ae&I)===I:($a&I)===I){var z=M.revertLane;if(z===0)N!==null&&(N=N.next={lane:0,revertLane:0,gesture:null,action:M.action,hasEagerState:M.hasEagerState,eagerState:M.eagerState,next:null}),I===Is&&($=!0);else if(($a&z)===z){M=M.next,z===Is&&($=!0);continue}else I={lane:0,revertLane:M.revertLane,gesture:null,action:M.action,hasEagerState:M.hasEagerState,eagerState:M.eagerState,next:null},N===null?(b=N=I,y=f):N=N.next=I,xe.lanes|=z,bn|=z;I=M.action,es&&s(f,I),f=M.hasEagerState?M.eagerState:s(f,I)}else z={lane:I,revertLane:M.revertLane,gesture:M.gesture,action:M.action,hasEagerState:M.hasEagerState,eagerState:M.eagerState,next:null},N===null?(b=N=z,y=f):N=N.next=z,xe.lanes|=I,bn|=I;M=M.next}while(M!==null&&M!==t);if(N===null?y=f:N.next=b,!Ht(f,e.memoizedState)&&(it=!0,$&&(s=Gs,s!==null)))throw s;e.memoizedState=f,e.baseState=y,e.baseQueue=N,i.lastRenderedState=f}return u===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function Fc(e){var t=at(),s=t.queue;if(s===null)throw Error(l(311));s.lastRenderedReducer=e;var i=s.dispatch,u=s.pending,f=t.memoizedState;if(u!==null){s.pending=null;var y=u=u.next;do f=e(f,y.action),y=y.next;while(y!==u);Ht(f,t.memoizedState)||(it=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),s.lastRenderedState=f}return[f,i]}function Oh(e,t,s){var i=xe,u=at(),f=Oe;if(f){if(s===void 0)throw Error(l(407));s=s()}else s=t();var y=!Ht(($e||u).memoizedState,s);if(y&&(u.memoizedState=s,it=!0),u=u.queue,tu(Mh.bind(null,i,u,e),[e]),u.getSnapshot!==t||y||rt!==null&&rt.memoizedState.tag&1){if(i.flags|=2048,Qs(9,{destroy:void 0},Dh.bind(null,i,u,s,t),null),Ie===null)throw Error(l(349));f||($a&127)!==0||Rh(i,t,s)}return s}function Rh(e,t,s){e.flags|=16384,e={getSnapshot:t,value:s},t=xe.updateQueue,t===null?(t=Cl(),xe.updateQueue=t,t.stores=[e]):(s=t.stores,s===null?t.stores=[e]:s.push(e))}function Dh(e,t,s,i){t.value=s,t.getSnapshot=i,zh(t)&&Uh(e)}function Mh(e,t,s){return s(function(){zh(t)&&Uh(e)})}function zh(e){var t=e.getSnapshot;e=e.value;try{var s=t();return!Ht(e,s)}catch{return!0}}function Uh(e){var t=Pn(e,2);t!==null&&qt(t,e,2)}function Wc(e){var t=Rt();if(typeof e=="function"){var s=e;if(e=s(),es){ya(!0);try{s()}finally{ya(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ha,lastRenderedState:e},t}function Lh(e,t,s,i){return e.baseState=s,Zc(e,$e,typeof i=="function"?i:Ha)}function Y0(e,t,s,i,u){if(Ml(e))throw Error(l(485));if(e=t.action,e!==null){var f={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(y){f.listeners.push(y)}};U.T!==null?s(!0):f.isTransition=!1,i(f),s=t.pending,s===null?(f.next=t.pending=f,Bh(t,f)):(f.next=s.next,t.pending=s.next=f)}}function Bh(e,t){var s=t.action,i=t.payload,u=e.state;if(t.isTransition){var f=U.T,y={};U.T=y;try{var b=s(u,i),N=U.S;N!==null&&N(y,b),qh(e,t,b)}catch(M){eu(e,t,M)}finally{f!==null&&y.types!==null&&(f.types=y.types),U.T=f}}else try{f=s(u,i),qh(e,t,f)}catch(M){eu(e,t,M)}}function qh(e,t,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(i){$h(e,t,i)},function(i){return eu(e,t,i)}):$h(e,t,s)}function $h(e,t,s){t.status="fulfilled",t.value=s,Hh(t),e.state=s,t=e.pending,t!==null&&(s=t.next,s===t?e.pending=null:(s=s.next,t.next=s,Bh(e,s)))}function eu(e,t,s){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=s,Hh(t),t=t.next;while(t!==i)}e.action=null}function Hh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Vh(e,t){return t}function Ih(e,t){if(Oe){var s=Ie.formState;if(s!==null){e:{var i=xe;if(Oe){if(Ke){t:{for(var u=Ke,f=na;u.nodeType!==8;){if(!f){u=null;break t}if(u=ra(u.nextSibling),u===null){u=null;break t}}f=u.data,u=f==="F!"||f==="F"?u:null}if(u){Ke=ra(u.nextSibling),i=u.data==="F!";break e}}un(i)}i=!1}i&&(t=s[0])}}return s=Rt(),s.memoizedState=s.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Vh,lastRenderedState:t},s.queue=i,s=om.bind(null,xe,i),i.dispatch=s,i=Wc(!1),f=iu.bind(null,xe,!1,i.queue),i=Rt(),u={state:t,dispatch:null,action:e,pending:null},i.queue=u,s=Y0.bind(null,xe,u,f,s),u.dispatch=s,i.memoizedState=e,[t,s,!1]}function Gh(e){var t=at();return Ph(t,$e,e)}function Ph(e,t,s){if(t=Zc(e,t,Vh)[0],e=Ol(Ha)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=oi(t)}catch(y){throw y===Ps?wl:y}else i=t;t=at();var u=t.queue,f=u.dispatch;return s!==t.memoizedState&&(xe.flags|=2048,Qs(9,{destroy:void 0},J0.bind(null,u,s),null)),[i,f,e]}function J0(e,t){e.action=t}function Kh(e){var t=at(),s=$e;if(s!==null)return Ph(t,s,e);at(),t=t.memoizedState,s=at();var i=s.queue.dispatch;return s.memoizedState=e,[t,i,!1]}function Qs(e,t,s,i){return e={tag:e,create:s,deps:i,inst:t,next:null},t=xe.updateQueue,t===null&&(t=Cl(),xe.updateQueue=t),s=t.lastEffect,s===null?t.lastEffect=e.next=e:(i=s.next,s.next=e,e.next=i,t.lastEffect=e),e}function Yh(){return at().memoizedState}function Rl(e,t,s,i){var u=Rt();xe.flags|=e,u.memoizedState=Qs(1|t,{destroy:void 0},s,i===void 0?null:i)}function Dl(e,t,s,i){var u=at();i=i===void 0?null:i;var f=u.memoizedState.inst;$e!==null&&i!==null&&Pc(i,$e.memoizedState.deps)?u.memoizedState=Qs(t,f,s,i):(xe.flags|=e,u.memoizedState=Qs(1|t,f,s,i))}function Jh(e,t){Rl(8390656,8,e,t)}function tu(e,t){Dl(2048,8,e,t)}function X0(e){xe.flags|=4;var t=xe.updateQueue;if(t===null)t=Cl(),xe.updateQueue=t,t.events=[e];else{var s=t.events;s===null?t.events=[e]:s.push(e)}}function Xh(e){var t=at().memoizedState;return X0({ref:t,nextImpl:e}),function(){if((ze&2)!==0)throw Error(l(440));return t.impl.apply(void 0,arguments)}}function Qh(e,t){return Dl(4,2,e,t)}function Zh(e,t){return Dl(4,4,e,t)}function Fh(e,t){if(typeof t=="function"){e=e();var s=t(e);return function(){typeof s=="function"?s():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Wh(e,t,s){s=s!=null?s.concat([e]):null,Dl(4,4,Fh.bind(null,t,e),s)}function au(){}function em(e,t){var s=at();t=t===void 0?null:t;var i=s.memoizedState;return t!==null&&Pc(t,i[1])?i[0]:(s.memoizedState=[e,t],e)}function tm(e,t){var s=at();t=t===void 0?null:t;var i=s.memoizedState;if(t!==null&&Pc(t,i[1]))return i[0];if(i=e(),es){ya(!0);try{e()}finally{ya(!1)}}return s.memoizedState=[i,t],i}function nu(e,t,s){return s===void 0||($a&1073741824)!==0&&(Ae&261930)===0?e.memoizedState=t:(e.memoizedState=s,e=ap(),xe.lanes|=e,bn|=e,s)}function am(e,t,s,i){return Ht(s,t)?s:Ys.current!==null?(e=nu(e,s,i),Ht(e,t)||(it=!0),e):($a&42)===0||($a&1073741824)!==0&&(Ae&261930)===0?(it=!0,e.memoizedState=s):(e=ap(),xe.lanes|=e,bn|=e,t)}function nm(e,t,s,i,u){var f=Q.p;Q.p=f!==0&&8>f?f:8;var y=U.T,b={};U.T=b,iu(e,!1,t,s);try{var N=u(),M=U.S;if(M!==null&&M(b,N),N!==null&&typeof N=="object"&&typeof N.then=="function"){var $=G0(N,i);ci(e,t,$,Yt(e))}else ci(e,t,i,Yt(e))}catch(I){ci(e,t,{then:function(){},status:"rejected",reason:I},Yt())}finally{Q.p=f,y!==null&&b.types!==null&&(y.types=b.types),U.T=y}}function Q0(){}function su(e,t,s,i){if(e.tag!==5)throw Error(l(476));var u=sm(e).queue;nm(e,u,t,K,s===null?Q0:function(){return rm(e),s(i)})}function sm(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ha,lastRenderedState:K},next:null};var s={};return t.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ha,lastRenderedState:s},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function rm(e){var t=sm(e);t.next===null&&(t=e.alternate.memoizedState),ci(e,t.next.queue,{},Yt())}function ru(){return wt(Ei)}function im(){return at().memoizedState}function lm(){return at().memoizedState}function Z0(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var s=Yt();e=hn(s);var i=mn(t,e,s);i!==null&&(qt(i,t,s),si(i,t,s)),t={cache:Mc()},e.payload=t;return}t=t.return}}function F0(e,t,s){var i=Yt();s={lane:i,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Ml(e)?cm(t,s):(s=Sc(e,t,s,i),s!==null&&(qt(s,e,i),um(s,t,i)))}function om(e,t,s){var i=Yt();ci(e,t,s,i)}function ci(e,t,s,i){var u={lane:i,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(Ml(e))cm(t,u);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=t.lastRenderedReducer,f!==null))try{var y=t.lastRenderedState,b=f(y,s);if(u.hasEagerState=!0,u.eagerState=b,Ht(b,y))return ml(e,t,u,0),Ie===null&&hl(),!1}catch{}if(s=Sc(e,t,u,i),s!==null)return qt(s,e,i),um(s,t,i),!0}return!1}function iu(e,t,s,i){if(i={lane:2,revertLane:Bu(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Ml(e)){if(t)throw Error(l(479))}else t=Sc(e,s,i,2),t!==null&&qt(t,e,2)}function Ml(e){var t=e.alternate;return e===xe||t!==null&&t===xe}function cm(e,t){Js=Tl=!0;var s=e.pending;s===null?t.next=t:(t.next=s.next,s.next=t),e.pending=t}function um(e,t,s){if((s&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,s|=i,t.lanes=s,qn(e,s)}}var ui={readContext:wt,use:kl,useCallback:Fe,useContext:Fe,useEffect:Fe,useImperativeHandle:Fe,useLayoutEffect:Fe,useInsertionEffect:Fe,useMemo:Fe,useReducer:Fe,useRef:Fe,useState:Fe,useDebugValue:Fe,useDeferredValue:Fe,useTransition:Fe,useSyncExternalStore:Fe,useId:Fe,useHostTransitionStatus:Fe,useFormState:Fe,useActionState:Fe,useOptimistic:Fe,useMemoCache:Fe,useCacheRefresh:Fe};ui.useEffectEvent=Fe;var dm={readContext:wt,use:kl,useCallback:function(e,t){return Rt().memoizedState=[e,t===void 0?null:t],e},useContext:wt,useEffect:Jh,useImperativeHandle:function(e,t,s){s=s!=null?s.concat([e]):null,Rl(4194308,4,Fh.bind(null,t,e),s)},useLayoutEffect:function(e,t){return Rl(4194308,4,e,t)},useInsertionEffect:function(e,t){Rl(4,2,e,t)},useMemo:function(e,t){var s=Rt();t=t===void 0?null:t;var i=e();if(es){ya(!0);try{e()}finally{ya(!1)}}return s.memoizedState=[i,t],i},useReducer:function(e,t,s){var i=Rt();if(s!==void 0){var u=s(t);if(es){ya(!0);try{s(t)}finally{ya(!1)}}}else u=t;return i.memoizedState=i.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},i.queue=e,e=e.dispatch=F0.bind(null,xe,e),[i.memoizedState,e]},useRef:function(e){var t=Rt();return e={current:e},t.memoizedState=e},useState:function(e){e=Wc(e);var t=e.queue,s=om.bind(null,xe,t);return t.dispatch=s,[e.memoizedState,s]},useDebugValue:au,useDeferredValue:function(e,t){var s=Rt();return nu(s,e,t)},useTransition:function(){var e=Wc(!1);return e=nm.bind(null,xe,e.queue,!0,!1),Rt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,s){var i=xe,u=Rt();if(Oe){if(s===void 0)throw Error(l(407));s=s()}else{if(s=t(),Ie===null)throw Error(l(349));(Ae&127)!==0||Rh(i,t,s)}u.memoizedState=s;var f={value:s,getSnapshot:t};return u.queue=f,Jh(Mh.bind(null,i,f,e),[e]),i.flags|=2048,Qs(9,{destroy:void 0},Dh.bind(null,i,f,s,t),null),s},useId:function(){var e=Rt(),t=Ie.identifierPrefix;if(Oe){var s=ba,i=va;s=(i&~(1<<32-Ot(i)-1)).toString(32)+s,t="_"+t+"R_"+s,s=Al++,0<s&&(t+="H"+s.toString(32)),t+="_"}else s=P0++,t="_"+t+"r_"+s.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:ru,useFormState:Ih,useActionState:Ih,useOptimistic:function(e){var t=Rt();t.memoizedState=t.baseState=e;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=s,t=iu.bind(null,xe,!0,s),s.dispatch=t,[e,t]},useMemoCache:Qc,useCacheRefresh:function(){return Rt().memoizedState=Z0.bind(null,xe)},useEffectEvent:function(e){var t=Rt(),s={impl:e};return t.memoizedState=s,function(){if((ze&2)!==0)throw Error(l(440));return s.impl.apply(void 0,arguments)}}},lu={readContext:wt,use:kl,useCallback:em,useContext:wt,useEffect:tu,useImperativeHandle:Wh,useInsertionEffect:Qh,useLayoutEffect:Zh,useMemo:tm,useReducer:Ol,useRef:Yh,useState:function(){return Ol(Ha)},useDebugValue:au,useDeferredValue:function(e,t){var s=at();return am(s,$e.memoizedState,e,t)},useTransition:function(){var e=Ol(Ha)[0],t=at().memoizedState;return[typeof e=="boolean"?e:oi(e),t]},useSyncExternalStore:Oh,useId:im,useHostTransitionStatus:ru,useFormState:Gh,useActionState:Gh,useOptimistic:function(e,t){var s=at();return Lh(s,$e,e,t)},useMemoCache:Qc,useCacheRefresh:lm};lu.useEffectEvent=Xh;var fm={readContext:wt,use:kl,useCallback:em,useContext:wt,useEffect:tu,useImperativeHandle:Wh,useInsertionEffect:Qh,useLayoutEffect:Zh,useMemo:tm,useReducer:Fc,useRef:Yh,useState:function(){return Fc(Ha)},useDebugValue:au,useDeferredValue:function(e,t){var s=at();return $e===null?nu(s,e,t):am(s,$e.memoizedState,e,t)},useTransition:function(){var e=Fc(Ha)[0],t=at().memoizedState;return[typeof e=="boolean"?e:oi(e),t]},useSyncExternalStore:Oh,useId:im,useHostTransitionStatus:ru,useFormState:Kh,useActionState:Kh,useOptimistic:function(e,t){var s=at();return $e!==null?Lh(s,$e,e,t):(s.baseState=e,[e,s.queue.dispatch])},useMemoCache:Qc,useCacheRefresh:lm};fm.useEffectEvent=Xh;function ou(e,t,s,i){t=e.memoizedState,s=s(i,t),s=s==null?t:_({},t,s),e.memoizedState=s,e.lanes===0&&(e.updateQueue.baseState=s)}var cu={enqueueSetState:function(e,t,s){e=e._reactInternals;var i=Yt(),u=hn(i);u.payload=t,s!=null&&(u.callback=s),t=mn(e,u,i),t!==null&&(qt(t,e,i),si(t,e,i))},enqueueReplaceState:function(e,t,s){e=e._reactInternals;var i=Yt(),u=hn(i);u.tag=1,u.payload=t,s!=null&&(u.callback=s),t=mn(e,u,i),t!==null&&(qt(t,e,i),si(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var s=Yt(),i=hn(s);i.tag=2,t!=null&&(i.callback=t),t=mn(e,i,s),t!==null&&(qt(t,e,s),si(t,e,s))}};function hm(e,t,s,i,u,f,y){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,f,y):t.prototype&&t.prototype.isPureReactComponent?!Qr(s,i)||!Qr(u,f):!0}function mm(e,t,s,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(s,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(s,i),t.state!==e&&cu.enqueueReplaceState(t,t.state,null)}function ts(e,t){var s=t;if("ref"in t){s={};for(var i in t)i!=="ref"&&(s[i]=t[i])}if(e=e.defaultProps){s===t&&(s=_({},s));for(var u in e)s[u]===void 0&&(s[u]=e[u])}return s}function pm(e){fl(e)}function gm(e){console.error(e)}function ym(e){fl(e)}function zl(e,t){try{var s=e.onUncaughtError;s(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function vm(e,t,s){try{var i=e.onCaughtError;i(s.value,{componentStack:s.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function uu(e,t,s){return s=hn(s),s.tag=3,s.payload={element:null},s.callback=function(){zl(e,t)},s}function bm(e){return e=hn(e),e.tag=3,e}function xm(e,t,s,i){var u=s.type.getDerivedStateFromError;if(typeof u=="function"){var f=i.value;e.payload=function(){return u(f)},e.callback=function(){vm(t,s,i)}}var y=s.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(e.callback=function(){vm(t,s,i),typeof u!="function"&&(xn===null?xn=new Set([this]):xn.add(this));var b=i.stack;this.componentDidCatch(i.value,{componentStack:b!==null?b:""})})}function W0(e,t,s,i,u){if(s.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(t=s.alternate,t!==null&&Vs(t,s,u,!0),s=It.current,s!==null){switch(s.tag){case 31:case 13:return sa===null?Yl():s.alternate===null&&We===0&&(We=3),s.flags&=-257,s.flags|=65536,s.lanes=u,i===_l?s.flags|=16384:(t=s.updateQueue,t===null?s.updateQueue=new Set([i]):t.add(i),zu(e,i,u)),!1;case 22:return s.flags|=65536,i===_l?s.flags|=16384:(t=s.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},s.updateQueue=t):(s=t.retryQueue,s===null?t.retryQueue=new Set([i]):s.add(i)),zu(e,i,u)),!1}throw Error(l(435,s.tag))}return zu(e,i,u),Yl(),!1}if(Oe)return t=It.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,i!==Cc&&(e=Error(l(422),{cause:i}),Wr(ea(e,s)))):(i!==Cc&&(t=Error(l(423),{cause:i}),Wr(ea(t,s))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,i=ea(i,s),u=uu(e.stateNode,i,u),$c(e,u),We!==4&&(We=2)),!1;var f=Error(l(520),{cause:i});if(f=ea(f,s),vi===null?vi=[f]:vi.push(f),We!==4&&(We=2),t===null)return!0;i=ea(i,s),s=t;do{switch(s.tag){case 3:return s.flags|=65536,e=u&-u,s.lanes|=e,e=uu(s.stateNode,i,e),$c(s,e),!1;case 1:if(t=s.type,f=s.stateNode,(s.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(xn===null||!xn.has(f))))return s.flags|=65536,u&=-u,s.lanes|=u,u=bm(u),xm(u,e,s,i),$c(s,u),!1}s=s.return}while(s!==null);return!1}var du=Error(l(461)),it=!1;function _t(e,t,s,i){t.child=e===null?jh(t,null,s,i):Wn(t,e.child,s,i)}function wm(e,t,s,i,u){s=s.render;var f=t.ref;if("ref"in i){var y={};for(var b in i)b!=="ref"&&(y[b]=i[b])}else y=i;return Xn(t),i=Kc(e,t,s,y,f,u),b=Yc(),e!==null&&!it?(Jc(e,t,u),Va(e,t,u)):(Oe&&b&&Tc(t),t.flags|=1,_t(e,t,i,u),t.child)}function _m(e,t,s,i,u){if(e===null){var f=s.type;return typeof f=="function"&&!jc(f)&&f.defaultProps===void 0&&s.compare===null?(t.tag=15,t.type=f,Sm(e,t,f,i,u)):(e=gl(s.type,null,i,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!bu(e,u)){var y=f.memoizedProps;if(s=s.compare,s=s!==null?s:Qr,s(y,i)&&e.ref===t.ref)return Va(e,t,u)}return t.flags|=1,e=Ua(f,i),e.ref=t.ref,e.return=t,t.child=e}function Sm(e,t,s,i,u){if(e!==null){var f=e.memoizedProps;if(Qr(f,i)&&e.ref===t.ref)if(it=!1,t.pendingProps=i=f,bu(e,u))(e.flags&131072)!==0&&(it=!0);else return t.lanes=e.lanes,Va(e,t,u)}return fu(e,t,s,i,u)}function jm(e,t,s,i){var u=i.children,f=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((t.flags&128)!==0){if(f=f!==null?f.baseLanes|s:s,e!==null){for(i=t.child=e.child,u=0;i!==null;)u=u|i.lanes|i.childLanes,i=i.sibling;i=u&~f}else i=0,t.child=null;return Nm(e,t,f,s,i)}if((s&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&xl(t,f!==null?f.cachePool:null),f!==null?Th(t,f):Vc(),Ah(t);else return i=t.lanes=536870912,Nm(e,t,f!==null?f.baseLanes|s:s,s,i)}else f!==null?(xl(t,f.cachePool),Th(t,f),gn(),t.memoizedState=null):(e!==null&&xl(t,null),Vc(),gn());return _t(e,t,u,s),t.child}function di(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Nm(e,t,s,i,u){var f=Uc();return f=f===null?null:{parent:st._currentValue,pool:f},t.memoizedState={baseLanes:s,cachePool:f},e!==null&&xl(t,null),Vc(),Ah(t),e!==null&&Vs(e,t,i,!0),t.childLanes=u,null}function Ul(e,t){return t=Bl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Em(e,t,s){return Wn(t,e.child,null,s),e=Ul(t,t.pendingProps),e.flags|=2,Gt(t),t.memoizedState=null,e}function eb(e,t,s){var i=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Oe){if(i.mode==="hidden")return e=Ul(t,i),t.lanes=536870912,di(null,e);if(Gc(t),(e=Ke)?(e=Bp(e,na),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:on!==null?{id:va,overflow:ba}:null,retryLane:536870912,hydrationErrors:null},s=ch(e),s.return=t,t.child=s,xt=t,Ke=null)):e=null,e===null)throw un(t);return t.lanes=536870912,null}return Ul(t,i)}var f=e.memoizedState;if(f!==null){var y=f.dehydrated;if(Gc(t),u)if(t.flags&256)t.flags&=-257,t=Em(e,t,s);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(l(558));else if(it||Vs(e,t,s,!1),u=(s&e.childLanes)!==0,it||u){if(i=Ie,i!==null&&(y=$n(i,s),y!==0&&y!==f.retryLane))throw f.retryLane=y,Pn(e,y),qt(i,e,y),du;Yl(),t=Em(e,t,s)}else e=f.treeContext,Ke=ra(y.nextSibling),xt=t,Oe=!0,cn=null,na=!1,e!==null&&fh(t,e),t=Ul(t,i),t.flags|=4096;return t}return e=Ua(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Ll(e,t){var s=t.ref;if(s===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(l(284));(e===null||e.ref!==s)&&(t.flags|=4194816)}}function fu(e,t,s,i,u){return Xn(t),s=Kc(e,t,s,i,void 0,u),i=Yc(),e!==null&&!it?(Jc(e,t,u),Va(e,t,u)):(Oe&&i&&Tc(t),t.flags|=1,_t(e,t,s,u),t.child)}function Tm(e,t,s,i,u,f){return Xn(t),t.updateQueue=null,s=kh(t,i,s,u),Ch(e),i=Yc(),e!==null&&!it?(Jc(e,t,f),Va(e,t,f)):(Oe&&i&&Tc(t),t.flags|=1,_t(e,t,s,f),t.child)}function Am(e,t,s,i,u){if(Xn(t),t.stateNode===null){var f=Bs,y=s.contextType;typeof y=="object"&&y!==null&&(f=wt(y)),f=new s(i,f),t.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=cu,t.stateNode=f,f._reactInternals=t,f=t.stateNode,f.props=i,f.state=t.memoizedState,f.refs={},Bc(t),y=s.contextType,f.context=typeof y=="object"&&y!==null?wt(y):Bs,f.state=t.memoizedState,y=s.getDerivedStateFromProps,typeof y=="function"&&(ou(t,s,y,i),f.state=t.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(y=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),y!==f.state&&cu.enqueueReplaceState(f,f.state,null),ii(t,i,f,u),ri(),f.state=t.memoizedState),typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){f=t.stateNode;var b=t.memoizedProps,N=ts(s,b);f.props=N;var M=f.context,$=s.contextType;y=Bs,typeof $=="object"&&$!==null&&(y=wt($));var I=s.getDerivedStateFromProps;$=typeof I=="function"||typeof f.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,$||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(b||M!==y)&&mm(t,f,i,y),fn=!1;var z=t.memoizedState;f.state=z,ii(t,i,f,u),ri(),M=t.memoizedState,b||z!==M||fn?(typeof I=="function"&&(ou(t,s,I,i),M=t.memoizedState),(N=fn||hm(t,s,N,i,z,M,y))?($||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount()),typeof f.componentDidMount=="function"&&(t.flags|=4194308)):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=M),f.props=i,f.state=M,f.context=y,i=N):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{f=t.stateNode,qc(e,t),y=t.memoizedProps,$=ts(s,y),f.props=$,I=t.pendingProps,z=f.context,M=s.contextType,N=Bs,typeof M=="object"&&M!==null&&(N=wt(M)),b=s.getDerivedStateFromProps,(M=typeof b=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(y!==I||z!==N)&&mm(t,f,i,N),fn=!1,z=t.memoizedState,f.state=z,ii(t,i,f,u),ri();var L=t.memoizedState;y!==I||z!==L||fn||e!==null&&e.dependencies!==null&&vl(e.dependencies)?(typeof b=="function"&&(ou(t,s,b,i),L=t.memoizedState),($=fn||hm(t,s,$,i,z,L,N)||e!==null&&e.dependencies!==null&&vl(e.dependencies))?(M||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(i,L,N),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(i,L,N)),typeof f.componentDidUpdate=="function"&&(t.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof f.componentDidUpdate!="function"||y===e.memoizedProps&&z===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&z===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=L),f.props=i,f.state=L,f.context=N,i=$):(typeof f.componentDidUpdate!="function"||y===e.memoizedProps&&z===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&z===e.memoizedState||(t.flags|=1024),i=!1)}return f=i,Ll(e,t),i=(t.flags&128)!==0,f||i?(f=t.stateNode,s=i&&typeof s.getDerivedStateFromError!="function"?null:f.render(),t.flags|=1,e!==null&&i?(t.child=Wn(t,e.child,null,u),t.child=Wn(t,null,s,u)):_t(e,t,s,u),t.memoizedState=f.state,e=t.child):e=Va(e,t,u),e}function Cm(e,t,s,i){return Yn(),t.flags|=256,_t(e,t,s,i),t.child}var hu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function mu(e){return{baseLanes:e,cachePool:vh()}}function pu(e,t,s){return e=e!==null?e.childLanes&~s:0,t&&(e|=Kt),e}function km(e,t,s){var i=t.pendingProps,u=!1,f=(t.flags&128)!==0,y;if((y=f)||(y=e!==null&&e.memoizedState===null?!1:(tt.current&2)!==0),y&&(u=!0,t.flags&=-129),y=(t.flags&32)!==0,t.flags&=-33,e===null){if(Oe){if(u?pn(t):gn(),(e=Ke)?(e=Bp(e,na),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:on!==null?{id:va,overflow:ba}:null,retryLane:536870912,hydrationErrors:null},s=ch(e),s.return=t,t.child=s,xt=t,Ke=null)):e=null,e===null)throw un(t);return Zu(e)?t.lanes=32:t.lanes=536870912,null}var b=i.children;return i=i.fallback,u?(gn(),u=t.mode,b=Bl({mode:"hidden",children:b},u),i=Kn(i,u,s,null),b.return=t,i.return=t,b.sibling=i,t.child=b,i=t.child,i.memoizedState=mu(s),i.childLanes=pu(e,y,s),t.memoizedState=hu,di(null,i)):(pn(t),gu(t,b))}var N=e.memoizedState;if(N!==null&&(b=N.dehydrated,b!==null)){if(f)t.flags&256?(pn(t),t.flags&=-257,t=yu(e,t,s)):t.memoizedState!==null?(gn(),t.child=e.child,t.flags|=128,t=null):(gn(),b=i.fallback,u=t.mode,i=Bl({mode:"visible",children:i.children},u),b=Kn(b,u,s,null),b.flags|=2,i.return=t,b.return=t,i.sibling=b,t.child=i,Wn(t,e.child,null,s),i=t.child,i.memoizedState=mu(s),i.childLanes=pu(e,y,s),t.memoizedState=hu,t=di(null,i));else if(pn(t),Zu(b)){if(y=b.nextSibling&&b.nextSibling.dataset,y)var M=y.dgst;y=M,i=Error(l(419)),i.stack="",i.digest=y,Wr({value:i,source:null,stack:null}),t=yu(e,t,s)}else if(it||Vs(e,t,s,!1),y=(s&e.childLanes)!==0,it||y){if(y=Ie,y!==null&&(i=$n(y,s),i!==0&&i!==N.retryLane))throw N.retryLane=i,Pn(e,i),qt(y,e,i),du;Qu(b)||Yl(),t=yu(e,t,s)}else Qu(b)?(t.flags|=192,t.child=e.child,t=null):(e=N.treeContext,Ke=ra(b.nextSibling),xt=t,Oe=!0,cn=null,na=!1,e!==null&&fh(t,e),t=gu(t,i.children),t.flags|=4096);return t}return u?(gn(),b=i.fallback,u=t.mode,N=e.child,M=N.sibling,i=Ua(N,{mode:"hidden",children:i.children}),i.subtreeFlags=N.subtreeFlags&65011712,M!==null?b=Ua(M,b):(b=Kn(b,u,s,null),b.flags|=2),b.return=t,i.return=t,i.sibling=b,t.child=i,di(null,i),i=t.child,b=e.child.memoizedState,b===null?b=mu(s):(u=b.cachePool,u!==null?(N=st._currentValue,u=u.parent!==N?{parent:N,pool:N}:u):u=vh(),b={baseLanes:b.baseLanes|s,cachePool:u}),i.memoizedState=b,i.childLanes=pu(e,y,s),t.memoizedState=hu,di(e.child,i)):(pn(t),s=e.child,e=s.sibling,s=Ua(s,{mode:"visible",children:i.children}),s.return=t,s.sibling=null,e!==null&&(y=t.deletions,y===null?(t.deletions=[e],t.flags|=16):y.push(e)),t.child=s,t.memoizedState=null,s)}function gu(e,t){return t=Bl({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Bl(e,t){return e=Vt(22,e,null,t),e.lanes=0,e}function yu(e,t,s){return Wn(t,e.child,null,s),e=gu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Om(e,t,s){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),Rc(e.return,t,s)}function vu(e,t,s,i,u,f){var y=e.memoizedState;y===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:s,tailMode:u,treeForkCount:f}:(y.isBackwards=t,y.rendering=null,y.renderingStartTime=0,y.last=i,y.tail=s,y.tailMode=u,y.treeForkCount=f)}function Rm(e,t,s){var i=t.pendingProps,u=i.revealOrder,f=i.tail;i=i.children;var y=tt.current,b=(y&2)!==0;if(b?(y=y&1|2,t.flags|=128):y&=1,Y(tt,y),_t(e,t,i,s),i=Oe?Fr:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Om(e,s,t);else if(e.tag===19)Om(e,s,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(u){case"forwards":for(s=t.child,u=null;s!==null;)e=s.alternate,e!==null&&El(e)===null&&(u=s),s=s.sibling;s=u,s===null?(u=t.child,t.child=null):(u=s.sibling,s.sibling=null),vu(t,!1,u,s,f,i);break;case"backwards":case"unstable_legacy-backwards":for(s=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&El(e)===null){t.child=u;break}e=u.sibling,u.sibling=s,s=u,u=e}vu(t,!0,s,null,f,i);break;case"together":vu(t,!1,null,null,void 0,i);break;default:t.memoizedState=null}return t.child}function Va(e,t,s){if(e!==null&&(t.dependencies=e.dependencies),bn|=t.lanes,(s&t.childLanes)===0)if(e!==null){if(Vs(e,t,s,!1),(s&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,s=Ua(e,e.pendingProps),t.child=s,s.return=t;e.sibling!==null;)e=e.sibling,s=s.sibling=Ua(e,e.pendingProps),s.return=t;s.sibling=null}return t.child}function bu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&vl(e)))}function tb(e,t,s){switch(t.tag){case 3:Ge(t,t.stateNode.containerInfo),dn(t,st,e.memoizedState.cache),Yn();break;case 27:case 5:Tt(t);break;case 4:Ge(t,t.stateNode.containerInfo);break;case 10:dn(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Gc(t),null;break;case 13:var i=t.memoizedState;if(i!==null)return i.dehydrated!==null?(pn(t),t.flags|=128,null):(s&t.child.childLanes)!==0?km(e,t,s):(pn(t),e=Va(e,t,s),e!==null?e.sibling:null);pn(t);break;case 19:var u=(e.flags&128)!==0;if(i=(s&t.childLanes)!==0,i||(Vs(e,t,s,!1),i=(s&t.childLanes)!==0),u){if(i)return Rm(e,t,s);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),Y(tt,tt.current),i)break;return null;case 22:return t.lanes=0,jm(e,t,s,t.pendingProps);case 24:dn(t,st,e.memoizedState.cache)}return Va(e,t,s)}function Dm(e,t,s){if(e!==null)if(e.memoizedProps!==t.pendingProps)it=!0;else{if(!bu(e,s)&&(t.flags&128)===0)return it=!1,tb(e,t,s);it=(e.flags&131072)!==0}else it=!1,Oe&&(t.flags&1048576)!==0&&dh(t,Fr,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=Zn(t.elementType),t.type=e,typeof e=="function")jc(e)?(i=ts(e,i),t.tag=1,t=Am(null,t,e,i,s)):(t.tag=0,t=fu(null,t,e,i,s));else{if(e!=null){var u=e.$$typeof;if(u===G){t.tag=11,t=wm(null,t,e,i,s);break e}else if(u===P){t.tag=14,t=_m(null,t,e,i,s);break e}}throw t=nt(e)||e,Error(l(306,t,""))}}return t;case 0:return fu(e,t,t.type,t.pendingProps,s);case 1:return i=t.type,u=ts(i,t.pendingProps),Am(e,t,i,u,s);case 3:e:{if(Ge(t,t.stateNode.containerInfo),e===null)throw Error(l(387));i=t.pendingProps;var f=t.memoizedState;u=f.element,qc(e,t),ii(t,i,null,s);var y=t.memoizedState;if(i=y.cache,dn(t,st,i),i!==f.cache&&Dc(t,[st],s,!0),ri(),i=y.element,f.isDehydrated)if(f={element:i,isDehydrated:!1,cache:y.cache},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){t=Cm(e,t,i,s);break e}else if(i!==u){u=ea(Error(l(424)),t),Wr(u),t=Cm(e,t,i,s);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Ke=ra(e.firstChild),xt=t,Oe=!0,cn=null,na=!0,s=jh(t,null,i,s),t.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(Yn(),i===u){t=Va(e,t,s);break e}_t(e,t,i,s)}t=t.child}return t;case 26:return Ll(e,t),e===null?(s=Gp(t.type,null,t.pendingProps,null))?t.memoizedState=s:Oe||(s=t.type,e=t.pendingProps,i=eo(ye.current).createElement(s),i[bt]=t,i[Dt]=e,St(i,s,e),gt(i),t.stateNode=i):t.memoizedState=Gp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Tt(t),e===null&&Oe&&(i=t.stateNode=Hp(t.type,t.pendingProps,ye.current),xt=t,na=!0,u=Ke,jn(t.type)?(Fu=u,Ke=ra(i.firstChild)):Ke=u),_t(e,t,t.pendingProps.children,s),Ll(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Oe&&((u=i=Ke)&&(i=Ob(i,t.type,t.pendingProps,na),i!==null?(t.stateNode=i,xt=t,Ke=ra(i.firstChild),na=!1,u=!0):u=!1),u||un(t)),Tt(t),u=t.type,f=t.pendingProps,y=e!==null?e.memoizedProps:null,i=f.children,Yu(u,f)?i=null:y!==null&&Yu(u,y)&&(t.flags|=32),t.memoizedState!==null&&(u=Kc(e,t,K0,null,null,s),Ei._currentValue=u),Ll(e,t),_t(e,t,i,s),t.child;case 6:return e===null&&Oe&&((e=s=Ke)&&(s=Rb(s,t.pendingProps,na),s!==null?(t.stateNode=s,xt=t,Ke=null,e=!0):e=!1),e||un(t)),null;case 13:return km(e,t,s);case 4:return Ge(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Wn(t,null,i,s):_t(e,t,i,s),t.child;case 11:return wm(e,t,t.type,t.pendingProps,s);case 7:return _t(e,t,t.pendingProps,s),t.child;case 8:return _t(e,t,t.pendingProps.children,s),t.child;case 12:return _t(e,t,t.pendingProps.children,s),t.child;case 10:return i=t.pendingProps,dn(t,t.type,i.value),_t(e,t,i.children,s),t.child;case 9:return u=t.type._context,i=t.pendingProps.children,Xn(t),u=wt(u),i=i(u),t.flags|=1,_t(e,t,i,s),t.child;case 14:return _m(e,t,t.type,t.pendingProps,s);case 15:return Sm(e,t,t.type,t.pendingProps,s);case 19:return Rm(e,t,s);case 31:return eb(e,t,s);case 22:return jm(e,t,s,t.pendingProps);case 24:return Xn(t),i=wt(st),e===null?(u=Uc(),u===null&&(u=Ie,f=Mc(),u.pooledCache=f,f.refCount++,f!==null&&(u.pooledCacheLanes|=s),u=f),t.memoizedState={parent:i,cache:u},Bc(t),dn(t,st,u)):((e.lanes&s)!==0&&(qc(e,t),ii(t,null,null,s),ri()),u=e.memoizedState,f=t.memoizedState,u.parent!==i?(u={parent:i,cache:i},t.memoizedState=u,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=u),dn(t,st,i)):(i=f.cache,dn(t,st,i),i!==u.cache&&Dc(t,[st],s,!0))),_t(e,t,t.pendingProps.children,s),t.child;case 29:throw t.pendingProps}throw Error(l(156,t.tag))}function Ia(e){e.flags|=4}function xu(e,t,s,i,u){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(ip())e.flags|=8192;else throw Fn=_l,Lc}else e.flags&=-16777217}function Mm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Xp(t))if(ip())e.flags|=8192;else throw Fn=_l,Lc}function ql(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?O():536870912,e.lanes|=t,er|=t)}function fi(e,t){if(!Oe)switch(e.tailMode){case"hidden":t=e.tail;for(var s=null;t!==null;)t.alternate!==null&&(s=t),t=t.sibling;s===null?e.tail=null:s.sibling=null;break;case"collapsed":s=e.tail;for(var i=null;s!==null;)s.alternate!==null&&(i=s),s=s.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function Ye(e){var t=e.alternate!==null&&e.alternate.child===e.child,s=0,i=0;if(t)for(var u=e.child;u!==null;)s|=u.lanes|u.childLanes,i|=u.subtreeFlags&65011712,i|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)s|=u.lanes|u.childLanes,i|=u.subtreeFlags,i|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=i,e.childLanes=s,t}function ab(e,t,s){var i=t.pendingProps;switch(Ac(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ye(t),null;case 1:return Ye(t),null;case 3:return s=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),qa(st),Ue(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(Hs(t)?Ia(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,kc())),Ye(t),null;case 26:var u=t.type,f=t.memoizedState;return e===null?(Ia(t),f!==null?(Ye(t),Mm(t,f)):(Ye(t),xu(t,u,null,i,s))):f?f!==e.memoizedState?(Ia(t),Ye(t),Mm(t,f)):(Ye(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&Ia(t),Ye(t),xu(t,u,e,i,s)),null;case 27:if(mt(t),s=ye.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&Ia(t);else{if(!i){if(t.stateNode===null)throw Error(l(166));return Ye(t),null}e=W.current,Hs(t)?hh(t):(e=Hp(u,i,s),t.stateNode=e,Ia(t))}return Ye(t),null;case 5:if(mt(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&Ia(t);else{if(!i){if(t.stateNode===null)throw Error(l(166));return Ye(t),null}if(f=W.current,Hs(t))hh(t);else{var y=eo(ye.current);switch(f){case 1:f=y.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:f=y.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":f=y.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":f=y.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":f=y.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof i.is=="string"?y.createElement("select",{is:i.is}):y.createElement("select"),i.multiple?f.multiple=!0:i.size&&(f.size=i.size);break;default:f=typeof i.is=="string"?y.createElement(u,{is:i.is}):y.createElement(u)}}f[bt]=t,f[Dt]=i;e:for(y=t.child;y!==null;){if(y.tag===5||y.tag===6)f.appendChild(y.stateNode);else if(y.tag!==4&&y.tag!==27&&y.child!==null){y.child.return=y,y=y.child;continue}if(y===t)break e;for(;y.sibling===null;){if(y.return===null||y.return===t)break e;y=y.return}y.sibling.return=y.return,y=y.sibling}t.stateNode=f;e:switch(St(f,u,i),u){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&Ia(t)}}return Ye(t),xu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,s),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&Ia(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(l(166));if(e=ye.current,Hs(t)){if(e=t.stateNode,s=t.memoizedProps,i=null,u=xt,u!==null)switch(u.tag){case 27:case 5:i=u.memoizedProps}e[bt]=t,e=!!(e.nodeValue===s||i!==null&&i.suppressHydrationWarning===!0||kp(e.nodeValue,s)),e||un(t,!0)}else e=eo(e).createTextNode(i),e[bt]=t,t.stateNode=e}return Ye(t),null;case 31:if(s=t.memoizedState,e===null||e.memoizedState!==null){if(i=Hs(t),s!==null){if(e===null){if(!i)throw Error(l(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(557));e[bt]=t}else Yn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ye(t),e=!1}else s=kc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=s),e=!0;if(!e)return t.flags&256?(Gt(t),t):(Gt(t),null);if((t.flags&128)!==0)throw Error(l(558))}return Ye(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=Hs(t),i!==null&&i.dehydrated!==null){if(e===null){if(!u)throw Error(l(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(l(317));u[bt]=t}else Yn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Ye(t),u=!1}else u=kc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(Gt(t),t):(Gt(t),null)}return Gt(t),(t.flags&128)!==0?(t.lanes=s,t):(s=i!==null,e=e!==null&&e.memoizedState!==null,s&&(i=t.child,u=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(u=i.alternate.memoizedState.cachePool.pool),f=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(f=i.memoizedState.cachePool.pool),f!==u&&(i.flags|=2048)),s!==e&&s&&(t.child.flags|=8192),ql(t,t.updateQueue),Ye(t),null);case 4:return Ue(),e===null&&Vu(t.stateNode.containerInfo),Ye(t),null;case 10:return qa(t.type),Ye(t),null;case 19:if(V(tt),i=t.memoizedState,i===null)return Ye(t),null;if(u=(t.flags&128)!==0,f=i.rendering,f===null)if(u)fi(i,!1);else{if(We!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(f=El(e),f!==null){for(t.flags|=128,fi(i,!1),e=f.updateQueue,t.updateQueue=e,ql(t,e),t.subtreeFlags=0,e=s,s=t.child;s!==null;)oh(s,e),s=s.sibling;return Y(tt,tt.current&1|2),Oe&&La(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&pt()>Gl&&(t.flags|=128,u=!0,fi(i,!1),t.lanes=4194304)}else{if(!u)if(e=El(f),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,ql(t,e),fi(i,!0),i.tail===null&&i.tailMode==="hidden"&&!f.alternate&&!Oe)return Ye(t),null}else 2*pt()-i.renderingStartTime>Gl&&s!==536870912&&(t.flags|=128,u=!0,fi(i,!1),t.lanes=4194304);i.isBackwards?(f.sibling=t.child,t.child=f):(e=i.last,e!==null?e.sibling=f:t.child=f,i.last=f)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=pt(),e.sibling=null,s=tt.current,Y(tt,u?s&1|2:s&1),Oe&&La(t,i.treeForkCount),e):(Ye(t),null);case 22:case 23:return Gt(t),Ic(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(s&536870912)!==0&&(t.flags&128)===0&&(Ye(t),t.subtreeFlags&6&&(t.flags|=8192)):Ye(t),s=t.updateQueue,s!==null&&ql(t,s.retryQueue),s=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==s&&(t.flags|=2048),e!==null&&V(Qn),null;case 24:return s=null,e!==null&&(s=e.memoizedState.cache),t.memoizedState.cache!==s&&(t.flags|=2048),qa(st),Ye(t),null;case 25:return null;case 30:return null}throw Error(l(156,t.tag))}function nb(e,t){switch(Ac(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return qa(st),Ue(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return mt(t),null;case 31:if(t.memoizedState!==null){if(Gt(t),t.alternate===null)throw Error(l(340));Yn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Gt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(l(340));Yn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(tt),null;case 4:return Ue(),null;case 10:return qa(t.type),null;case 22:case 23:return Gt(t),Ic(),e!==null&&V(Qn),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return qa(st),null;case 25:return null;default:return null}}function zm(e,t){switch(Ac(t),t.tag){case 3:qa(st),Ue();break;case 26:case 27:case 5:mt(t);break;case 4:Ue();break;case 31:t.memoizedState!==null&&Gt(t);break;case 13:Gt(t);break;case 19:V(tt);break;case 10:qa(t.type);break;case 22:case 23:Gt(t),Ic(),e!==null&&V(Qn);break;case 24:qa(st)}}function hi(e,t){try{var s=t.updateQueue,i=s!==null?s.lastEffect:null;if(i!==null){var u=i.next;s=u;do{if((s.tag&e)===e){i=void 0;var f=s.create,y=s.inst;i=f(),y.destroy=i}s=s.next}while(s!==u)}}catch(b){Be(t,t.return,b)}}function yn(e,t,s){try{var i=t.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var f=u.next;i=f;do{if((i.tag&e)===e){var y=i.inst,b=y.destroy;if(b!==void 0){y.destroy=void 0,u=t;var N=s,M=b;try{M()}catch($){Be(u,N,$)}}}i=i.next}while(i!==f)}}catch($){Be(t,t.return,$)}}function Um(e){var t=e.updateQueue;if(t!==null){var s=e.stateNode;try{Eh(t,s)}catch(i){Be(e,e.return,i)}}}function Lm(e,t,s){s.props=ts(e.type,e.memoizedProps),s.state=e.memoizedState;try{s.componentWillUnmount()}catch(i){Be(e,t,i)}}function mi(e,t){try{var s=e.ref;if(s!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof s=="function"?e.refCleanup=s(i):s.current=i}}catch(u){Be(e,t,u)}}function xa(e,t){var s=e.ref,i=e.refCleanup;if(s!==null)if(typeof i=="function")try{i()}catch(u){Be(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(u){Be(e,t,u)}else s.current=null}function Bm(e){var t=e.type,s=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":s.autoFocus&&i.focus();break e;case"img":s.src?i.src=s.src:s.srcSet&&(i.srcset=s.srcSet)}}catch(u){Be(e,e.return,u)}}function wu(e,t,s){try{var i=e.stateNode;Nb(i,e.type,s,t),i[Dt]=t}catch(u){Be(e,e.return,u)}}function qm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&jn(e.type)||e.tag===4}function _u(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qm(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&&jn(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 Su(e,t,s){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(e,t):(t=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,t.appendChild(e),s=s._reactRootContainer,s!=null||t.onclick!==null||(t.onclick=Ma));else if(i!==4&&(i===27&&jn(e.type)&&(s=e.stateNode,t=null),e=e.child,e!==null))for(Su(e,t,s),e=e.sibling;e!==null;)Su(e,t,s),e=e.sibling}function $l(e,t,s){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?s.insertBefore(e,t):s.appendChild(e);else if(i!==4&&(i===27&&jn(e.type)&&(s=e.stateNode),e=e.child,e!==null))for($l(e,t,s),e=e.sibling;e!==null;)$l(e,t,s),e=e.sibling}function $m(e){var t=e.stateNode,s=e.memoizedProps;try{for(var i=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);St(t,i,s),t[bt]=e,t[Dt]=s}catch(f){Be(e,e.return,f)}}var Ga=!1,lt=!1,ju=!1,Hm=typeof WeakSet=="function"?WeakSet:Set,yt=null;function sb(e,t){if(e=e.containerInfo,Pu=lo,e=Wf(e),yc(e)){if("selectionStart"in e)var s={start:e.selectionStart,end:e.selectionEnd};else e:{s=(s=e.ownerDocument)&&s.defaultView||window;var i=s.getSelection&&s.getSelection();if(i&&i.rangeCount!==0){s=i.anchorNode;var u=i.anchorOffset,f=i.focusNode;i=i.focusOffset;try{s.nodeType,f.nodeType}catch{s=null;break e}var y=0,b=-1,N=-1,M=0,$=0,I=e,z=null;t:for(;;){for(var L;I!==s||u!==0&&I.nodeType!==3||(b=y+u),I!==f||i!==0&&I.nodeType!==3||(N=y+i),I.nodeType===3&&(y+=I.nodeValue.length),(L=I.firstChild)!==null;)z=I,I=L;for(;;){if(I===e)break t;if(z===s&&++M===u&&(b=y),z===f&&++$===i&&(N=y),(L=I.nextSibling)!==null)break;I=z,z=I.parentNode}I=L}s=b===-1||N===-1?null:{start:b,end:N}}else s=null}s=s||{start:0,end:0}}else s=null;for(Ku={focusedElem:e,selectionRange:s},lo=!1,yt=t;yt!==null;)if(t=yt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,yt=e;else for(;yt!==null;){switch(t=yt,f=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(s=0;s<e.length;s++)u=e[s],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&f!==null){e=void 0,s=t,u=f.memoizedProps,f=f.memoizedState,i=s.stateNode;try{var ae=ts(s.type,u);e=i.getSnapshotBeforeUpdate(ae,f),i.__reactInternalSnapshotBeforeUpdate=e}catch(he){Be(s,s.return,he)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,s=e.nodeType,s===9)Xu(e);else if(s===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Xu(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,yt=e;break}yt=t.return}}function Vm(e,t,s){var i=s.flags;switch(s.tag){case 0:case 11:case 15:Ka(e,s),i&4&&hi(5,s);break;case 1:if(Ka(e,s),i&4)if(e=s.stateNode,t===null)try{e.componentDidMount()}catch(y){Be(s,s.return,y)}else{var u=ts(s.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(y){Be(s,s.return,y)}}i&64&&Um(s),i&512&&mi(s,s.return);break;case 3:if(Ka(e,s),i&64&&(e=s.updateQueue,e!==null)){if(t=null,s.child!==null)switch(s.child.tag){case 27:case 5:t=s.child.stateNode;break;case 1:t=s.child.stateNode}try{Eh(e,t)}catch(y){Be(s,s.return,y)}}break;case 27:t===null&&i&4&&$m(s);case 26:case 5:Ka(e,s),t===null&&i&4&&Bm(s),i&512&&mi(s,s.return);break;case 12:Ka(e,s);break;case 31:Ka(e,s),i&4&&Pm(e,s);break;case 13:Ka(e,s),i&4&&Km(e,s),i&64&&(e=s.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(s=hb.bind(null,s),Db(e,s))));break;case 22:if(i=s.memoizedState!==null||Ga,!i){t=t!==null&&t.memoizedState!==null||lt,u=Ga;var f=lt;Ga=i,(lt=t)&&!f?Ya(e,s,(s.subtreeFlags&8772)!==0):Ka(e,s),Ga=u,lt=f}break;case 30:break;default:Ka(e,s)}}function Im(e){var t=e.alternate;t!==null&&(e.alternate=null,Im(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ec(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 Xe=null,zt=!1;function Pa(e,t,s){for(s=s.child;s!==null;)Gm(e,t,s),s=s.sibling}function Gm(e,t,s){if(kt&&typeof kt.onCommitFiberUnmount=="function")try{kt.onCommitFiberUnmount(Un,s)}catch{}switch(s.tag){case 26:lt||xa(s,t),Pa(e,t,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:lt||xa(s,t);var i=Xe,u=zt;jn(s.type)&&(Xe=s.stateNode,zt=!1),Pa(e,t,s),Si(s.stateNode),Xe=i,zt=u;break;case 5:lt||xa(s,t);case 6:if(i=Xe,u=zt,Xe=null,Pa(e,t,s),Xe=i,zt=u,Xe!==null)if(zt)try{(Xe.nodeType===9?Xe.body:Xe.nodeName==="HTML"?Xe.ownerDocument.body:Xe).removeChild(s.stateNode)}catch(f){Be(s,t,f)}else try{Xe.removeChild(s.stateNode)}catch(f){Be(s,t,f)}break;case 18:Xe!==null&&(zt?(e=Xe,Up(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,s.stateNode),or(e)):Up(Xe,s.stateNode));break;case 4:i=Xe,u=zt,Xe=s.stateNode.containerInfo,zt=!0,Pa(e,t,s),Xe=i,zt=u;break;case 0:case 11:case 14:case 15:yn(2,s,t),lt||yn(4,s,t),Pa(e,t,s);break;case 1:lt||(xa(s,t),i=s.stateNode,typeof i.componentWillUnmount=="function"&&Lm(s,t,i)),Pa(e,t,s);break;case 21:Pa(e,t,s);break;case 22:lt=(i=lt)||s.memoizedState!==null,Pa(e,t,s),lt=i;break;default:Pa(e,t,s)}}function Pm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{or(e)}catch(s){Be(t,t.return,s)}}}function Km(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{or(e)}catch(s){Be(t,t.return,s)}}function rb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Hm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Hm),t;default:throw Error(l(435,e.tag))}}function Hl(e,t){var s=rb(e);t.forEach(function(i){if(!s.has(i)){s.add(i);var u=mb.bind(null,e,i);i.then(u,u)}})}function Ut(e,t){var s=t.deletions;if(s!==null)for(var i=0;i<s.length;i++){var u=s[i],f=e,y=t,b=y;e:for(;b!==null;){switch(b.tag){case 27:if(jn(b.type)){Xe=b.stateNode,zt=!1;break e}break;case 5:Xe=b.stateNode,zt=!1;break e;case 3:case 4:Xe=b.stateNode.containerInfo,zt=!0;break e}b=b.return}if(Xe===null)throw Error(l(160));Gm(f,y,u),Xe=null,zt=!1,f=u.alternate,f!==null&&(f.return=null),u.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Ym(t,e),t=t.sibling}var ca=null;function Ym(e,t){var s=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ut(t,e),Lt(e),i&4&&(yn(3,e,e.return),hi(3,e),yn(5,e,e.return));break;case 1:Ut(t,e),Lt(e),i&512&&(lt||s===null||xa(s,s.return)),i&64&&Ga&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(s=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=s===null?i:s.concat(i))));break;case 26:var u=ca;if(Ut(t,e),Lt(e),i&512&&(lt||s===null||xa(s,s.return)),i&4){var f=s!==null?s.memoizedState:null;if(i=e.memoizedState,s===null)if(i===null)if(e.stateNode===null){e:{i=e.type,s=e.memoizedProps,u=u.ownerDocument||u;t:switch(i){case"title":f=u.getElementsByTagName("title")[0],(!f||f[Hr]||f[bt]||f.namespaceURI==="http://www.w3.org/2000/svg"||f.hasAttribute("itemprop"))&&(f=u.createElement(i),u.head.insertBefore(f,u.querySelector("head > title"))),St(f,i,s),f[bt]=e,gt(f),i=f;break e;case"link":var y=Yp("link","href",u).get(i+(s.href||""));if(y){for(var b=0;b<y.length;b++)if(f=y[b],f.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&f.getAttribute("rel")===(s.rel==null?null:s.rel)&&f.getAttribute("title")===(s.title==null?null:s.title)&&f.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){y.splice(b,1);break t}}f=u.createElement(i),St(f,i,s),u.head.appendChild(f);break;case"meta":if(y=Yp("meta","content",u).get(i+(s.content||""))){for(b=0;b<y.length;b++)if(f=y[b],f.getAttribute("content")===(s.content==null?null:""+s.content)&&f.getAttribute("name")===(s.name==null?null:s.name)&&f.getAttribute("property")===(s.property==null?null:s.property)&&f.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&f.getAttribute("charset")===(s.charSet==null?null:s.charSet)){y.splice(b,1);break t}}f=u.createElement(i),St(f,i,s),u.head.appendChild(f);break;default:throw Error(l(468,i))}f[bt]=e,gt(f),i=f}e.stateNode=i}else Jp(u,e.type,e.stateNode);else e.stateNode=Kp(u,i,e.memoizedProps);else f!==i?(f===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):f.count--,i===null?Jp(u,e.type,e.stateNode):Kp(u,i,e.memoizedProps)):i===null&&e.stateNode!==null&&wu(e,e.memoizedProps,s.memoizedProps)}break;case 27:Ut(t,e),Lt(e),i&512&&(lt||s===null||xa(s,s.return)),s!==null&&i&4&&wu(e,e.memoizedProps,s.memoizedProps);break;case 5:if(Ut(t,e),Lt(e),i&512&&(lt||s===null||xa(s,s.return)),e.flags&32){u=e.stateNode;try{Os(u,"")}catch(ae){Be(e,e.return,ae)}}i&4&&e.stateNode!=null&&(u=e.memoizedProps,wu(e,u,s!==null?s.memoizedProps:u)),i&1024&&(ju=!0);break;case 6:if(Ut(t,e),Lt(e),i&4){if(e.stateNode===null)throw Error(l(162));i=e.memoizedProps,s=e.stateNode;try{s.nodeValue=i}catch(ae){Be(e,e.return,ae)}}break;case 3:if(no=null,u=ca,ca=to(t.containerInfo),Ut(t,e),ca=u,Lt(e),i&4&&s!==null&&s.memoizedState.isDehydrated)try{or(t.containerInfo)}catch(ae){Be(e,e.return,ae)}ju&&(ju=!1,Jm(e));break;case 4:i=ca,ca=to(e.stateNode.containerInfo),Ut(t,e),Lt(e),ca=i;break;case 12:Ut(t,e),Lt(e);break;case 31:Ut(t,e),Lt(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Hl(e,i)));break;case 13:Ut(t,e),Lt(e),e.child.flags&8192&&e.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(Il=pt()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Hl(e,i)));break;case 22:u=e.memoizedState!==null;var N=s!==null&&s.memoizedState!==null,M=Ga,$=lt;if(Ga=M||u,lt=$||N,Ut(t,e),lt=$,Ga=M,Lt(e),i&8192)e:for(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,u&&(s===null||N||Ga||lt||as(e)),s=null,t=e;;){if(t.tag===5||t.tag===26){if(s===null){N=s=t;try{if(f=N.stateNode,u)y=f.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none";else{b=N.stateNode;var I=N.memoizedProps.style,z=I!=null&&I.hasOwnProperty("display")?I.display:null;b.style.display=z==null||typeof z=="boolean"?"":(""+z).trim()}}catch(ae){Be(N,N.return,ae)}}}else if(t.tag===6){if(s===null){N=t;try{N.stateNode.nodeValue=u?"":N.memoizedProps}catch(ae){Be(N,N.return,ae)}}}else if(t.tag===18){if(s===null){N=t;try{var L=N.stateNode;u?Lp(L,!0):Lp(N.stateNode,!1)}catch(ae){Be(N,N.return,ae)}}}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;s===t&&(s=null),t=t.return}s===t&&(s=null),t.sibling.return=t.return,t=t.sibling}i&4&&(i=e.updateQueue,i!==null&&(s=i.retryQueue,s!==null&&(i.retryQueue=null,Hl(e,s))));break;case 19:Ut(t,e),Lt(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Hl(e,i)));break;case 30:break;case 21:break;default:Ut(t,e),Lt(e)}}function Lt(e){var t=e.flags;if(t&2){try{for(var s,i=e.return;i!==null;){if(qm(i)){s=i;break}i=i.return}if(s==null)throw Error(l(160));switch(s.tag){case 27:var u=s.stateNode,f=_u(e);$l(e,f,u);break;case 5:var y=s.stateNode;s.flags&32&&(Os(y,""),s.flags&=-33);var b=_u(e);$l(e,b,y);break;case 3:case 4:var N=s.stateNode.containerInfo,M=_u(e);Su(e,M,N);break;default:throw Error(l(161))}}catch($){Be(e,e.return,$)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Jm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Jm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Ka(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Vm(e,t.alternate,t),t=t.sibling}function as(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:yn(4,t,t.return),as(t);break;case 1:xa(t,t.return);var s=t.stateNode;typeof s.componentWillUnmount=="function"&&Lm(t,t.return,s),as(t);break;case 27:Si(t.stateNode);case 26:case 5:xa(t,t.return),as(t);break;case 22:t.memoizedState===null&&as(t);break;case 30:as(t);break;default:as(t)}e=e.sibling}}function Ya(e,t,s){for(s=s&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var i=t.alternate,u=e,f=t,y=f.flags;switch(f.tag){case 0:case 11:case 15:Ya(u,f,s),hi(4,f);break;case 1:if(Ya(u,f,s),i=f,u=i.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(M){Be(i,i.return,M)}if(i=f,u=i.updateQueue,u!==null){var b=i.stateNode;try{var N=u.shared.hiddenCallbacks;if(N!==null)for(u.shared.hiddenCallbacks=null,u=0;u<N.length;u++)Nh(N[u],b)}catch(M){Be(i,i.return,M)}}s&&y&64&&Um(f),mi(f,f.return);break;case 27:$m(f);case 26:case 5:Ya(u,f,s),s&&i===null&&y&4&&Bm(f),mi(f,f.return);break;case 12:Ya(u,f,s);break;case 31:Ya(u,f,s),s&&y&4&&Pm(u,f);break;case 13:Ya(u,f,s),s&&y&4&&Km(u,f);break;case 22:f.memoizedState===null&&Ya(u,f,s),mi(f,f.return);break;case 30:break;default:Ya(u,f,s)}t=t.sibling}}function Nu(e,t){var s=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(s=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==s&&(e!=null&&e.refCount++,s!=null&&ei(s))}function Eu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ei(e))}function ua(e,t,s,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Xm(e,t,s,i),t=t.sibling}function Xm(e,t,s,i){var u=t.flags;switch(t.tag){case 0:case 11:case 15:ua(e,t,s,i),u&2048&&hi(9,t);break;case 1:ua(e,t,s,i);break;case 3:ua(e,t,s,i),u&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ei(e)));break;case 12:if(u&2048){ua(e,t,s,i),e=t.stateNode;try{var f=t.memoizedProps,y=f.id,b=f.onPostCommit;typeof b=="function"&&b(y,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(N){Be(t,t.return,N)}}else ua(e,t,s,i);break;case 31:ua(e,t,s,i);break;case 13:ua(e,t,s,i);break;case 23:break;case 22:f=t.stateNode,y=t.alternate,t.memoizedState!==null?f._visibility&2?ua(e,t,s,i):pi(e,t):f._visibility&2?ua(e,t,s,i):(f._visibility|=2,Zs(e,t,s,i,(t.subtreeFlags&10256)!==0||!1)),u&2048&&Nu(y,t);break;case 24:ua(e,t,s,i),u&2048&&Eu(t.alternate,t);break;default:ua(e,t,s,i)}}function Zs(e,t,s,i,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var f=e,y=t,b=s,N=i,M=y.flags;switch(y.tag){case 0:case 11:case 15:Zs(f,y,b,N,u),hi(8,y);break;case 23:break;case 22:var $=y.stateNode;y.memoizedState!==null?$._visibility&2?Zs(f,y,b,N,u):pi(f,y):($._visibility|=2,Zs(f,y,b,N,u)),u&&M&2048&&Nu(y.alternate,y);break;case 24:Zs(f,y,b,N,u),u&&M&2048&&Eu(y.alternate,y);break;default:Zs(f,y,b,N,u)}t=t.sibling}}function pi(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var s=e,i=t,u=i.flags;switch(i.tag){case 22:pi(s,i),u&2048&&Nu(i.alternate,i);break;case 24:pi(s,i),u&2048&&Eu(i.alternate,i);break;default:pi(s,i)}t=t.sibling}}var gi=8192;function Fs(e,t,s){if(e.subtreeFlags&gi)for(e=e.child;e!==null;)Qm(e,t,s),e=e.sibling}function Qm(e,t,s){switch(e.tag){case 26:Fs(e,t,s),e.flags&gi&&e.memoizedState!==null&&Pb(s,ca,e.memoizedState,e.memoizedProps);break;case 5:Fs(e,t,s);break;case 3:case 4:var i=ca;ca=to(e.stateNode.containerInfo),Fs(e,t,s),ca=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=gi,gi=16777216,Fs(e,t,s),gi=i):Fs(e,t,s));break;default:Fs(e,t,s)}}function Zm(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 yi(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var s=0;s<t.length;s++){var i=t[s];yt=i,Wm(i,e)}Zm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Fm(e),e=e.sibling}function Fm(e){switch(e.tag){case 0:case 11:case 15:yi(e),e.flags&2048&&yn(9,e,e.return);break;case 3:yi(e);break;case 12:yi(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Vl(e)):yi(e);break;default:yi(e)}}function Vl(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var s=0;s<t.length;s++){var i=t[s];yt=i,Wm(i,e)}Zm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:yn(8,t,t.return),Vl(t);break;case 22:s=t.stateNode,s._visibility&2&&(s._visibility&=-3,Vl(t));break;default:Vl(t)}e=e.sibling}}function Wm(e,t){for(;yt!==null;){var s=yt;switch(s.tag){case 0:case 11:case 15:yn(8,s,t);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var i=s.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:ei(s.memoizedState.cache)}if(i=s.child,i!==null)i.return=s,yt=i;else e:for(s=e;yt!==null;){i=yt;var u=i.sibling,f=i.return;if(Im(i),i===s){yt=null;break e}if(u!==null){u.return=f,yt=u;break e}yt=f}}}var ib={getCacheForType:function(e){var t=wt(st),s=t.data.get(e);return s===void 0&&(s=e(),t.data.set(e,s)),s},cacheSignal:function(){return wt(st).controller.signal}},lb=typeof WeakMap=="function"?WeakMap:Map,ze=0,Ie=null,Ne=null,Ae=0,Le=0,Pt=null,vn=!1,Ws=!1,Tu=!1,Ja=0,We=0,bn=0,ns=0,Au=0,Kt=0,er=0,vi=null,Bt=null,Cu=!1,Il=0,ep=0,Gl=1/0,Pl=null,xn=null,ut=0,wn=null,tr=null,Xa=0,ku=0,Ou=null,tp=null,bi=0,Ru=null;function Yt(){return(ze&2)!==0&&Ae!==0?Ae&-Ae:U.T!==null?Bu():yf()}function ap(){if(Kt===0)if((Ae&536870912)===0||Oe){var e=Ln;Ln<<=1,(Ln&3932160)===0&&(Ln=262144),Kt=e}else Kt=536870912;return e=It.current,e!==null&&(e.flags|=32),Kt}function qt(e,t,s){(e===Ie&&(Le===2||Le===9)||e.cancelPendingCommit!==null)&&(ar(e,0),_n(e,Ae,Kt,!1)),Se(e,s),((ze&2)===0||e!==Ie)&&(e===Ie&&((ze&2)===0&&(ns|=s),We===4&&_n(e,Ae,Kt,!1)),wa(e))}function np(e,t,s){if((ze&6)!==0)throw Error(l(327));var i=!s&&(t&127)===0&&(t&e.expiredLanes)===0||Bn(e,t),u=i?ub(e,t):Mu(e,t,!0),f=i;do{if(u===0){Ws&&!i&&_n(e,t,0,!1);break}else{if(s=e.current.alternate,f&&!ob(s)){u=Mu(e,t,!1),f=!1;continue}if(u===2){if(f=t,e.errorRecoveryDisabledLanes&f)var y=0;else y=e.pendingLanes&-536870913,y=y!==0?y:y&536870912?536870912:0;if(y!==0){t=y;e:{var b=e;u=vi;var N=b.current.memoizedState.isDehydrated;if(N&&(ar(b,y).flags|=256),y=Mu(b,y,!1),y!==2){if(Tu&&!N){b.errorRecoveryDisabledLanes|=f,ns|=f,u=4;break e}f=Bt,Bt=u,f!==null&&(Bt===null?Bt=f:Bt.push.apply(Bt,f))}u=y}if(f=!1,u!==2)continue}}if(u===1){ar(e,0),_n(e,t,0,!0);break}e:{switch(i=e,f=u,f){case 0:case 1:throw Error(l(345));case 4:if((t&4194048)!==t)break;case 6:_n(i,t,Kt,!vn);break e;case 2:Bt=null;break;case 3:case 5:break;default:throw Error(l(329))}if((t&62914560)===t&&(u=Il+300-pt(),10<u)){if(_n(i,t,Kt,!vn),Ss(i,0,!0)!==0)break e;Xa=t,i.timeoutHandle=Mp(sp.bind(null,i,s,Bt,Pl,Cu,t,Kt,ns,er,vn,f,"Throttled",-0,0),u);break e}sp(i,s,Bt,Pl,Cu,t,Kt,ns,er,vn,f,null,-0,0)}}break}while(!0);wa(e)}function sp(e,t,s,i,u,f,y,b,N,M,$,I,z,L){if(e.timeoutHandle=-1,I=t.subtreeFlags,I&8192||(I&16785408)===16785408){I={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ma},Qm(t,f,I);var ae=(f&62914560)===f?Il-pt():(f&4194048)===f?ep-pt():0;if(ae=Kb(I,ae),ae!==null){Xa=f,e.cancelPendingCommit=ae(fp.bind(null,e,t,f,s,i,u,y,b,N,$,I,null,z,L)),_n(e,f,y,!M);return}}fp(e,t,f,s,i,u,y,b,N)}function ob(e){for(var t=e;;){var s=t.tag;if((s===0||s===11||s===15)&&t.flags&16384&&(s=t.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var i=0;i<s.length;i++){var u=s[i],f=u.getSnapshot;u=u.value;try{if(!Ht(f(),u))return!1}catch{return!1}}if(s=t.child,t.subtreeFlags&16384&&s!==null)s.return=t,t=s;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 _n(e,t,s,i){t&=~Au,t&=~ns,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var u=t;0<u;){var f=31-Ot(u),y=1<<f;i[f]=-1,u&=~y}s!==0&&js(e,s,t)}function Kl(){return(ze&6)===0?(xi(0),!1):!0}function Du(){if(Ne!==null){if(Le===0)var e=Ne.return;else e=Ne,Ba=Jn=null,Xc(e),Ks=null,ai=0,e=Ne;for(;e!==null;)zm(e.alternate,e),e=e.return;Ne=null}}function ar(e,t){var s=e.timeoutHandle;s!==-1&&(e.timeoutHandle=-1,Ab(s)),s=e.cancelPendingCommit,s!==null&&(e.cancelPendingCommit=null,s()),Xa=0,Du(),Ie=e,Ne=s=Ua(e.current,null),Ae=t,Le=0,Pt=null,vn=!1,Ws=Bn(e,t),Tu=!1,er=Kt=Au=ns=bn=We=0,Bt=vi=null,Cu=!1,(t&8)!==0&&(t|=t&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=t;0<i;){var u=31-Ot(i),f=1<<u;t|=e[u],i&=~f}return Ja=t,hl(),s}function rp(e,t){xe=null,U.H=ui,t===Ps||t===wl?(t=wh(),Le=3):t===Lc?(t=wh(),Le=4):Le=t===du?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Pt=t,Ne===null&&(We=1,zl(e,ea(t,e.current)))}function ip(){var e=It.current;return e===null?!0:(Ae&4194048)===Ae?sa===null:(Ae&62914560)===Ae||(Ae&536870912)!==0?e===sa:!1}function lp(){var e=U.H;return U.H=ui,e===null?ui:e}function op(){var e=U.A;return U.A=ib,e}function Yl(){We=4,vn||(Ae&4194048)!==Ae&&It.current!==null||(Ws=!0),(bn&134217727)===0&&(ns&134217727)===0||Ie===null||_n(Ie,Ae,Kt,!1)}function Mu(e,t,s){var i=ze;ze|=2;var u=lp(),f=op();(Ie!==e||Ae!==t)&&(Pl=null,ar(e,t)),t=!1;var y=We;e:do try{if(Le!==0&&Ne!==null){var b=Ne,N=Pt;switch(Le){case 8:Du(),y=6;break e;case 3:case 2:case 9:case 6:It.current===null&&(t=!0);var M=Le;if(Le=0,Pt=null,nr(e,b,N,M),s&&Ws){y=0;break e}break;default:M=Le,Le=0,Pt=null,nr(e,b,N,M)}}cb(),y=We;break}catch($){rp(e,$)}while(!0);return t&&e.shellSuspendCounter++,Ba=Jn=null,ze=i,U.H=u,U.A=f,Ne===null&&(Ie=null,Ae=0,hl()),y}function cb(){for(;Ne!==null;)cp(Ne)}function ub(e,t){var s=ze;ze|=2;var i=lp(),u=op();Ie!==e||Ae!==t?(Pl=null,Gl=pt()+500,ar(e,t)):Ws=Bn(e,t);e:do try{if(Le!==0&&Ne!==null){t=Ne;var f=Pt;t:switch(Le){case 1:Le=0,Pt=null,nr(e,t,f,1);break;case 2:case 9:if(bh(f)){Le=0,Pt=null,up(t);break}t=function(){Le!==2&&Le!==9||Ie!==e||(Le=7),wa(e)},f.then(t,t);break e;case 3:Le=7;break e;case 4:Le=5;break e;case 7:bh(f)?(Le=0,Pt=null,up(t)):(Le=0,Pt=null,nr(e,t,f,7));break;case 5:var y=null;switch(Ne.tag){case 26:y=Ne.memoizedState;case 5:case 27:var b=Ne;if(y?Xp(y):b.stateNode.complete){Le=0,Pt=null;var N=b.sibling;if(N!==null)Ne=N;else{var M=b.return;M!==null?(Ne=M,Jl(M)):Ne=null}break t}}Le=0,Pt=null,nr(e,t,f,5);break;case 6:Le=0,Pt=null,nr(e,t,f,6);break;case 8:Du(),We=6;break e;default:throw Error(l(462))}}db();break}catch($){rp(e,$)}while(!0);return Ba=Jn=null,U.H=i,U.A=u,ze=s,Ne!==null?0:(Ie=null,Ae=0,hl(),We)}function db(){for(;Ne!==null&&!el();)cp(Ne)}function cp(e){var t=Dm(e.alternate,e,Ja);e.memoizedProps=e.pendingProps,t===null?Jl(e):Ne=t}function up(e){var t=e,s=t.alternate;switch(t.tag){case 15:case 0:t=Tm(s,t,t.pendingProps,t.type,void 0,Ae);break;case 11:t=Tm(s,t,t.pendingProps,t.type.render,t.ref,Ae);break;case 5:Xc(t);default:zm(s,t),t=Ne=oh(t,Ja),t=Dm(s,t,Ja)}e.memoizedProps=e.pendingProps,t===null?Jl(e):Ne=t}function nr(e,t,s,i){Ba=Jn=null,Xc(t),Ks=null,ai=0;var u=t.return;try{if(W0(e,u,t,s,Ae)){We=1,zl(e,ea(s,e.current)),Ne=null;return}}catch(f){if(u!==null)throw Ne=u,f;We=1,zl(e,ea(s,e.current)),Ne=null;return}t.flags&32768?(Oe||i===1?e=!0:Ws||(Ae&536870912)!==0?e=!1:(vn=e=!0,(i===2||i===9||i===3||i===6)&&(i=It.current,i!==null&&i.tag===13&&(i.flags|=16384))),dp(t,e)):Jl(t)}function Jl(e){var t=e;do{if((t.flags&32768)!==0){dp(t,vn);return}e=t.return;var s=ab(t.alternate,t,Ja);if(s!==null){Ne=s;return}if(t=t.sibling,t!==null){Ne=t;return}Ne=t=e}while(t!==null);We===0&&(We=5)}function dp(e,t){do{var s=nb(e.alternate,e);if(s!==null){s.flags&=32767,Ne=s;return}if(s=e.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!t&&(e=e.sibling,e!==null)){Ne=e;return}Ne=e=s}while(e!==null);We=6,Ne=null}function fp(e,t,s,i,u,f,y,b,N){e.cancelPendingCommit=null;do Xl();while(ut!==0);if((ze&6)!==0)throw Error(l(327));if(t!==null){if(t===e.current)throw Error(l(177));if(f=t.lanes|t.childLanes,f|=_c,At(e,s,f,y,b,N),e===Ie&&(Ne=Ie=null,Ae=0),tr=t,wn=e,Xa=s,ku=f,Ou=u,tp=i,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,pb(bs,function(){return yp(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=U.T,U.T=null,u=Q.p,Q.p=2,y=ze,ze|=4;try{sb(e,t,s)}finally{ze=y,Q.p=u,U.T=i}}ut=1,hp(),mp(),pp()}}function hp(){if(ut===1){ut=0;var e=wn,t=tr,s=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||s){s=U.T,U.T=null;var i=Q.p;Q.p=2;var u=ze;ze|=4;try{Ym(t,e);var f=Ku,y=Wf(e.containerInfo),b=f.focusedElem,N=f.selectionRange;if(y!==b&&b&&b.ownerDocument&&Ff(b.ownerDocument.documentElement,b)){if(N!==null&&yc(b)){var M=N.start,$=N.end;if($===void 0&&($=M),"selectionStart"in b)b.selectionStart=M,b.selectionEnd=Math.min($,b.value.length);else{var I=b.ownerDocument||document,z=I&&I.defaultView||window;if(z.getSelection){var L=z.getSelection(),ae=b.textContent.length,he=Math.min(N.start,ae),Ve=N.end===void 0?he:Math.min(N.end,ae);!L.extend&&he>Ve&&(y=Ve,Ve=he,he=y);var C=Zf(b,he),E=Zf(b,Ve);if(C&&E&&(L.rangeCount!==1||L.anchorNode!==C.node||L.anchorOffset!==C.offset||L.focusNode!==E.node||L.focusOffset!==E.offset)){var D=I.createRange();D.setStart(C.node,C.offset),L.removeAllRanges(),he>Ve?(L.addRange(D),L.extend(E.node,E.offset)):(D.setEnd(E.node,E.offset),L.addRange(D))}}}}for(I=[],L=b;L=L.parentNode;)L.nodeType===1&&I.push({element:L,left:L.scrollLeft,top:L.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<I.length;b++){var H=I[b];H.element.scrollLeft=H.left,H.element.scrollTop=H.top}}lo=!!Pu,Ku=Pu=null}finally{ze=u,Q.p=i,U.T=s}}e.current=t,ut=2}}function mp(){if(ut===2){ut=0;var e=wn,t=tr,s=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||s){s=U.T,U.T=null;var i=Q.p;Q.p=2;var u=ze;ze|=4;try{Vm(e,t.alternate,t)}finally{ze=u,Q.p=i,U.T=s}}ut=3}}function pp(){if(ut===4||ut===3){ut=0,tl();var e=wn,t=tr,s=Xa,i=tp;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?ut=5:(ut=0,tr=wn=null,gp(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(xn=null),$r(s),t=t.stateNode,kt&&typeof kt.onCommitFiberRoot=="function")try{kt.onCommitFiberRoot(Un,t,void 0,(t.current.flags&128)===128)}catch{}if(i!==null){t=U.T,u=Q.p,Q.p=2,U.T=null;try{for(var f=e.onRecoverableError,y=0;y<i.length;y++){var b=i[y];f(b.value,{componentStack:b.stack})}}finally{U.T=t,Q.p=u}}(Xa&3)!==0&&Xl(),wa(e),u=e.pendingLanes,(s&261930)!==0&&(u&42)!==0?e===Ru?bi++:(bi=0,Ru=e):bi=0,xi(0)}}function gp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ei(t)))}function Xl(){return hp(),mp(),pp(),yp()}function yp(){if(ut!==5)return!1;var e=wn,t=ku;ku=0;var s=$r(Xa),i=U.T,u=Q.p;try{Q.p=32>s?32:s,U.T=null,s=Ou,Ou=null;var f=wn,y=Xa;if(ut=0,tr=wn=null,Xa=0,(ze&6)!==0)throw Error(l(331));var b=ze;if(ze|=4,Fm(f.current),Xm(f,f.current,y,s),ze=b,xi(0,!1),kt&&typeof kt.onPostCommitFiberRoot=="function")try{kt.onPostCommitFiberRoot(Un,f)}catch{}return!0}finally{Q.p=u,U.T=i,gp(e,t)}}function vp(e,t,s){t=ea(s,t),t=uu(e.stateNode,t,2),e=mn(e,t,2),e!==null&&(Se(e,2),wa(e))}function Be(e,t,s){if(e.tag===3)vp(e,e,s);else for(;t!==null;){if(t.tag===3){vp(t,e,s);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(xn===null||!xn.has(i))){e=ea(s,e),s=bm(2),i=mn(t,s,2),i!==null&&(xm(s,i,t,e),Se(i,2),wa(i));break}}t=t.return}}function zu(e,t,s){var i=e.pingCache;if(i===null){i=e.pingCache=new lb;var u=new Set;i.set(t,u)}else u=i.get(t),u===void 0&&(u=new Set,i.set(t,u));u.has(s)||(Tu=!0,u.add(s),e=fb.bind(null,e,t,s),t.then(e,e))}function fb(e,t,s){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&s,e.warmLanes&=~s,Ie===e&&(Ae&s)===s&&(We===4||We===3&&(Ae&62914560)===Ae&&300>pt()-Il?(ze&2)===0&&ar(e,0):Au|=s,er===Ae&&(er=0)),wa(e)}function bp(e,t){t===0&&(t=O()),e=Pn(e,t),e!==null&&(Se(e,t),wa(e))}function hb(e){var t=e.memoizedState,s=0;t!==null&&(s=t.retryLane),bp(e,s)}function mb(e,t){var s=0;switch(e.tag){case 31:case 13:var i=e.stateNode,u=e.memoizedState;u!==null&&(s=u.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(l(314))}i!==null&&i.delete(t),bp(e,s)}function pb(e,t){return sn(e,t)}var Ql=null,sr=null,Uu=!1,Zl=!1,Lu=!1,Sn=0;function wa(e){e!==sr&&e.next===null&&(sr===null?Ql=sr=e:sr=sr.next=e),Zl=!0,Uu||(Uu=!0,yb())}function xi(e,t){if(!Lu&&Zl){Lu=!0;do for(var s=!1,i=Ql;i!==null;){if(e!==0){var u=i.pendingLanes;if(u===0)var f=0;else{var y=i.suspendedLanes,b=i.pingedLanes;f=(1<<31-Ot(42|e)+1)-1,f&=u&~(y&~b),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(s=!0,Sp(i,f))}else f=Ae,f=Ss(i,i===Ie?f:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(f&3)===0||Bn(i,f)||(s=!0,Sp(i,f));i=i.next}while(s);Lu=!1}}function gb(){xp()}function xp(){Zl=Uu=!1;var e=0;Sn!==0&&Tb()&&(e=Sn);for(var t=pt(),s=null,i=Ql;i!==null;){var u=i.next,f=wp(i,t);f===0?(i.next=null,s===null?Ql=u:s.next=u,u===null&&(sr=s)):(s=i,(e!==0||(f&3)!==0)&&(Zl=!0)),i=u}ut!==0&&ut!==5||xi(e),Sn!==0&&(Sn=0)}function wp(e,t){for(var s=e.suspendedLanes,i=e.pingedLanes,u=e.expirationTimes,f=e.pendingLanes&-62914561;0<f;){var y=31-Ot(f),b=1<<y,N=u[y];N===-1?((b&s)===0||(b&i)!==0)&&(u[y]=Fo(b,t)):N<=t&&(e.expiredLanes|=b),f&=~b}if(t=Ie,s=Ae,s=Ss(e,e===t?s:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,s===0||e===t&&(Le===2||Le===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&ys(i),e.callbackNode=null,e.callbackPriority=0;if((s&3)===0||Bn(e,s)){if(t=s&-s,t===e.callbackPriority)return t;switch(i!==null&&ys(i),$r(s)){case 2:case 8:s=zn;break;case 32:s=bs;break;case 268435456:s=xs;break;default:s=bs}return i=_p.bind(null,e),s=sn(s,i),e.callbackPriority=t,e.callbackNode=s,t}return i!==null&&i!==null&&ys(i),e.callbackPriority=2,e.callbackNode=null,2}function _p(e,t){if(ut!==0&&ut!==5)return e.callbackNode=null,e.callbackPriority=0,null;var s=e.callbackNode;if(Xl()&&e.callbackNode!==s)return null;var i=Ae;return i=Ss(e,e===Ie?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(np(e,i,t),wp(e,pt()),e.callbackNode!=null&&e.callbackNode===s?_p.bind(null,e):null)}function Sp(e,t){if(Xl())return null;np(e,t,!0)}function yb(){Cb(function(){(ze&6)!==0?sn(ga,gb):xp()})}function Bu(){if(Sn===0){var e=Is;e===0&&(e=ws,ws<<=1,(ws&261888)===0&&(ws=256)),Sn=e}return Sn}function jp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:rl(""+e)}function Np(e,t){var s=t.ownerDocument.createElement("input");return s.name=t.name,s.value=t.value,e.id&&s.setAttribute("form",e.id),t.parentNode.insertBefore(s,t),e=new FormData(e),s.parentNode.removeChild(s),e}function vb(e,t,s,i,u){if(t==="submit"&&s&&s.stateNode===u){var f=jp((u[Dt]||null).action),y=i.submitter;y&&(t=(t=y[Dt]||null)?jp(t.formAction):y.getAttribute("formAction"),t!==null&&(f=t,y=null));var b=new cl("action","action",null,i,u);e.push({event:b,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(Sn!==0){var N=y?Np(u,y):new FormData(u);su(s,{pending:!0,data:N,method:u.method,action:f},null,N)}}else typeof f=="function"&&(b.preventDefault(),N=y?Np(u,y):new FormData(u),su(s,{pending:!0,data:N,method:u.method,action:f},f,N))},currentTarget:u}]})}}for(var qu=0;qu<wc.length;qu++){var $u=wc[qu],bb=$u.toLowerCase(),xb=$u[0].toUpperCase()+$u.slice(1);oa(bb,"on"+xb)}oa(ah,"onAnimationEnd"),oa(nh,"onAnimationIteration"),oa(sh,"onAnimationStart"),oa("dblclick","onDoubleClick"),oa("focusin","onFocus"),oa("focusout","onBlur"),oa(U0,"onTransitionRun"),oa(L0,"onTransitionStart"),oa(B0,"onTransitionCancel"),oa(rh,"onTransitionEnd"),Cs("onMouseEnter",["mouseout","mouseover"]),Cs("onMouseLeave",["mouseout","mouseover"]),Cs("onPointerEnter",["pointerout","pointerover"]),Cs("onPointerLeave",["pointerout","pointerover"]),Hn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Hn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Hn("onBeforeInput",["compositionend","keypress","textInput","paste"]),Hn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Hn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Hn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var wi="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(" "),wb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(wi));function Ep(e,t){t=(t&4)!==0;for(var s=0;s<e.length;s++){var i=e[s],u=i.event;i=i.listeners;e:{var f=void 0;if(t)for(var y=i.length-1;0<=y;y--){var b=i[y],N=b.instance,M=b.currentTarget;if(b=b.listener,N!==f&&u.isPropagationStopped())break e;f=b,u.currentTarget=M;try{f(u)}catch($){fl($)}u.currentTarget=null,f=N}else for(y=0;y<i.length;y++){if(b=i[y],N=b.instance,M=b.currentTarget,b=b.listener,N!==f&&u.isPropagationStopped())break e;f=b,u.currentTarget=M;try{f(u)}catch($){fl($)}u.currentTarget=null,f=N}}}}function Ee(e,t){var s=t[Wo];s===void 0&&(s=t[Wo]=new Set);var i=e+"__bubble";s.has(i)||(Tp(t,e,2,!1),s.add(i))}function Hu(e,t,s){var i=0;t&&(i|=4),Tp(s,e,i,t)}var Fl="_reactListening"+Math.random().toString(36).slice(2);function Vu(e){if(!e[Fl]){e[Fl]=!0,xf.forEach(function(s){s!=="selectionchange"&&(wb.has(s)||Hu(s,!1,e),Hu(s,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Fl]||(t[Fl]=!0,Hu("selectionchange",!1,t))}}function Tp(e,t,s,i){switch(ag(t)){case 2:var u=Xb;break;case 8:u=Qb;break;default:u=nd}s=u.bind(null,t,s,e),u=void 0,!oc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),i?u!==void 0?e.addEventListener(t,s,{capture:!0,passive:u}):e.addEventListener(t,s,!0):u!==void 0?e.addEventListener(t,s,{passive:u}):e.addEventListener(t,s,!1)}function Iu(e,t,s,i,u){var f=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var y=i.tag;if(y===3||y===4){var b=i.stateNode.containerInfo;if(b===u)break;if(y===4)for(y=i.return;y!==null;){var N=y.tag;if((N===3||N===4)&&y.stateNode.containerInfo===u)return;y=y.return}for(;b!==null;){if(y=Es(b),y===null)return;if(N=y.tag,N===5||N===6||N===26||N===27){i=f=y;continue e}b=b.parentNode}}i=i.return}Rf(function(){var M=f,$=ic(s),I=[];e:{var z=ih.get(e);if(z!==void 0){var L=cl,ae=e;switch(e){case"keypress":if(ll(s)===0)break e;case"keydown":case"keyup":L=m0;break;case"focusin":ae="focus",L=fc;break;case"focusout":ae="blur",L=fc;break;case"beforeblur":case"afterblur":L=fc;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":L=zf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":L=a0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":L=y0;break;case ah:case nh:case sh:L=r0;break;case rh:L=b0;break;case"scroll":case"scrollend":L=e0;break;case"wheel":L=w0;break;case"copy":case"cut":case"paste":L=l0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":L=Lf;break;case"toggle":case"beforetoggle":L=S0}var he=(t&4)!==0,Ve=!he&&(e==="scroll"||e==="scrollend"),C=he?z!==null?z+"Capture":null:z;he=[];for(var E=M,D;E!==null;){var H=E;if(D=H.stateNode,H=H.tag,H!==5&&H!==26&&H!==27||D===null||C===null||(H=Ir(E,C),H!=null&&he.push(_i(E,H,D))),Ve)break;E=E.return}0<he.length&&(z=new L(z,ae,null,s,$),I.push({event:z,listeners:he}))}}if((t&7)===0){e:{if(z=e==="mouseover"||e==="pointerover",L=e==="mouseout"||e==="pointerout",z&&s!==rc&&(ae=s.relatedTarget||s.fromElement)&&(Es(ae)||ae[Ns]))break e;if((L||z)&&(z=$.window===$?$:(z=$.ownerDocument)?z.defaultView||z.parentWindow:window,L?(ae=s.relatedTarget||s.toElement,L=M,ae=ae?Es(ae):null,ae!==null&&(Ve=d(ae),he=ae.tag,ae!==Ve||he!==5&&he!==27&&he!==6)&&(ae=null)):(L=null,ae=M),L!==ae)){if(he=zf,H="onMouseLeave",C="onMouseEnter",E="mouse",(e==="pointerout"||e==="pointerover")&&(he=Lf,H="onPointerLeave",C="onPointerEnter",E="pointer"),Ve=L==null?z:Vr(L),D=ae==null?z:Vr(ae),z=new he(H,E+"leave",L,s,$),z.target=Ve,z.relatedTarget=D,H=null,Es($)===M&&(he=new he(C,E+"enter",ae,s,$),he.target=D,he.relatedTarget=Ve,H=he),Ve=H,L&&ae)t:{for(he=_b,C=L,E=ae,D=0,H=C;H;H=he(H))D++;H=0;for(var ce=E;ce;ce=he(ce))H++;for(;0<D-H;)C=he(C),D--;for(;0<H-D;)E=he(E),H--;for(;D--;){if(C===E||E!==null&&C===E.alternate){he=C;break t}C=he(C),E=he(E)}he=null}else he=null;L!==null&&Ap(I,z,L,he,!1),ae!==null&&Ve!==null&&Ap(I,Ve,ae,he,!0)}}e:{if(z=M?Vr(M):window,L=z.nodeName&&z.nodeName.toLowerCase(),L==="select"||L==="input"&&z.type==="file")var De=Pf;else if(If(z))if(Kf)De=D0;else{De=O0;var ie=k0}else L=z.nodeName,!L||L.toLowerCase()!=="input"||z.type!=="checkbox"&&z.type!=="radio"?M&&sc(M.elementType)&&(De=Pf):De=R0;if(De&&(De=De(e,M))){Gf(I,De,s,$);break e}ie&&ie(e,z,M),e==="focusout"&&M&&z.type==="number"&&M.memoizedProps.value!=null&&nc(z,"number",z.value)}switch(ie=M?Vr(M):window,e){case"focusin":(If(ie)||ie.contentEditable==="true")&&(zs=ie,vc=M,Zr=null);break;case"focusout":Zr=vc=zs=null;break;case"mousedown":bc=!0;break;case"contextmenu":case"mouseup":case"dragend":bc=!1,eh(I,s,$);break;case"selectionchange":if(z0)break;case"keydown":case"keyup":eh(I,s,$)}var we;if(mc)e:{switch(e){case"compositionstart":var Ce="onCompositionStart";break e;case"compositionend":Ce="onCompositionEnd";break e;case"compositionupdate":Ce="onCompositionUpdate";break e}Ce=void 0}else Ms?Hf(e,s)&&(Ce="onCompositionEnd"):e==="keydown"&&s.keyCode===229&&(Ce="onCompositionStart");Ce&&(Bf&&s.locale!=="ko"&&(Ms||Ce!=="onCompositionStart"?Ce==="onCompositionEnd"&&Ms&&(we=Df()):(ln=$,cc="value"in ln?ln.value:ln.textContent,Ms=!0)),ie=Wl(M,Ce),0<ie.length&&(Ce=new Uf(Ce,e,null,s,$),I.push({event:Ce,listeners:ie}),we?Ce.data=we:(we=Vf(s),we!==null&&(Ce.data=we)))),(we=N0?E0(e,s):T0(e,s))&&(Ce=Wl(M,"onBeforeInput"),0<Ce.length&&(ie=new Uf("onBeforeInput","beforeinput",null,s,$),I.push({event:ie,listeners:Ce}),ie.data=we)),vb(I,e,M,s,$)}Ep(I,t)})}function _i(e,t,s){return{instance:e,listener:t,currentTarget:s}}function Wl(e,t){for(var s=t+"Capture",i=[];e!==null;){var u=e,f=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||f===null||(u=Ir(e,s),u!=null&&i.unshift(_i(e,u,f)),u=Ir(e,t),u!=null&&i.push(_i(e,u,f))),e.tag===3)return i;e=e.return}return[]}function _b(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Ap(e,t,s,i,u){for(var f=t._reactName,y=[];s!==null&&s!==i;){var b=s,N=b.alternate,M=b.stateNode;if(b=b.tag,N!==null&&N===i)break;b!==5&&b!==26&&b!==27||M===null||(N=M,u?(M=Ir(s,f),M!=null&&y.unshift(_i(s,M,N))):u||(M=Ir(s,f),M!=null&&y.push(_i(s,M,N)))),s=s.return}y.length!==0&&e.push({event:t,listeners:y})}var Sb=/\r\n?/g,jb=/\u0000|\uFFFD/g;function Cp(e){return(typeof e=="string"?e:""+e).replace(Sb,`
|
|
9
|
+
`).replace(jb,"")}function kp(e,t){return t=Cp(t),Cp(e)===t}function He(e,t,s,i,u,f){switch(s){case"children":typeof i=="string"?t==="body"||t==="textarea"&&i===""||Os(e,i):(typeof i=="number"||typeof i=="bigint")&&t!=="body"&&Os(e,""+i);break;case"className":nl(e,"class",i);break;case"tabIndex":nl(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":nl(e,s,i);break;case"style":kf(e,i,f);break;case"data":if(t!=="object"){nl(e,"data",i);break}case"src":case"href":if(i===""&&(t!=="a"||s!=="href")){e.removeAttribute(s);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(s);break}i=rl(""+i),e.setAttribute(s,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(s,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof f=="function"&&(s==="formAction"?(t!=="input"&&He(e,t,"name",u.name,u,null),He(e,t,"formEncType",u.formEncType,u,null),He(e,t,"formMethod",u.formMethod,u,null),He(e,t,"formTarget",u.formTarget,u,null)):(He(e,t,"encType",u.encType,u,null),He(e,t,"method",u.method,u,null),He(e,t,"target",u.target,u,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(s);break}i=rl(""+i),e.setAttribute(s,i);break;case"onClick":i!=null&&(e.onclick=Ma);break;case"onScroll":i!=null&&Ee("scroll",e);break;case"onScrollEnd":i!=null&&Ee("scrollend",e);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(l(61));if(s=i.__html,s!=null){if(u.children!=null)throw Error(l(60));e.innerHTML=s}}break;case"multiple":e.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":e.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){e.removeAttribute("xlink:href");break}s=rl(""+i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(s,""+i):e.removeAttribute(s);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":i&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(s,""):e.removeAttribute(s);break;case"capture":case"download":i===!0?e.setAttribute(s,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(s,i):e.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(s,i):e.removeAttribute(s);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(s):e.setAttribute(s,i);break;case"popover":Ee("beforetoggle",e),Ee("toggle",e),al(e,"popover",i);break;case"xlinkActuate":Da(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":Da(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":Da(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":Da(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":Da(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":Da(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":Da(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":Da(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":Da(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":al(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(s=Fv.get(s)||s,al(e,s,i))}}function Gu(e,t,s,i,u,f){switch(s){case"style":kf(e,i,f);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(l(61));if(s=i.__html,s!=null){if(u.children!=null)throw Error(l(60));e.innerHTML=s}}break;case"children":typeof i=="string"?Os(e,i):(typeof i=="number"||typeof i=="bigint")&&Os(e,""+i);break;case"onScroll":i!=null&&Ee("scroll",e);break;case"onScrollEnd":i!=null&&Ee("scrollend",e);break;case"onClick":i!=null&&(e.onclick=Ma);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!wf.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(u=s.endsWith("Capture"),t=s.slice(2,u?s.length-7:void 0),f=e[Dt]||null,f=f!=null?f[s]:null,typeof f=="function"&&e.removeEventListener(t,f,u),typeof i=="function")){typeof f!="function"&&f!==null&&(s in e?e[s]=null:e.hasAttribute(s)&&e.removeAttribute(s)),e.addEventListener(t,i,u);break e}s in e?e[s]=i:i===!0?e.setAttribute(s,""):al(e,s,i)}}}function St(e,t,s){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ee("error",e),Ee("load",e);var i=!1,u=!1,f;for(f in s)if(s.hasOwnProperty(f)){var y=s[f];if(y!=null)switch(f){case"src":i=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:He(e,t,f,y,s,null)}}u&&He(e,t,"srcSet",s.srcSet,s,null),i&&He(e,t,"src",s.src,s,null);return;case"input":Ee("invalid",e);var b=f=y=u=null,N=null,M=null;for(i in s)if(s.hasOwnProperty(i)){var $=s[i];if($!=null)switch(i){case"name":u=$;break;case"type":y=$;break;case"checked":N=$;break;case"defaultChecked":M=$;break;case"value":f=$;break;case"defaultValue":b=$;break;case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(l(137,t));break;default:He(e,t,i,$,s,null)}}Ef(e,f,b,N,M,y,u,!1);return;case"select":Ee("invalid",e),i=y=f=null;for(u in s)if(s.hasOwnProperty(u)&&(b=s[u],b!=null))switch(u){case"value":f=b;break;case"defaultValue":y=b;break;case"multiple":i=b;default:He(e,t,u,b,s,null)}t=f,s=y,e.multiple=!!i,t!=null?ks(e,!!i,t,!1):s!=null&&ks(e,!!i,s,!0);return;case"textarea":Ee("invalid",e),f=u=i=null;for(y in s)if(s.hasOwnProperty(y)&&(b=s[y],b!=null))switch(y){case"value":i=b;break;case"defaultValue":u=b;break;case"children":f=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(l(91));break;default:He(e,t,y,b,s,null)}Af(e,i,u,f);return;case"option":for(N in s)s.hasOwnProperty(N)&&(i=s[N],i!=null)&&(N==="selected"?e.selected=i&&typeof i!="function"&&typeof i!="symbol":He(e,t,N,i,s,null));return;case"dialog":Ee("beforetoggle",e),Ee("toggle",e),Ee("cancel",e),Ee("close",e);break;case"iframe":case"object":Ee("load",e);break;case"video":case"audio":for(i=0;i<wi.length;i++)Ee(wi[i],e);break;case"image":Ee("error",e),Ee("load",e);break;case"details":Ee("toggle",e);break;case"embed":case"source":case"link":Ee("error",e),Ee("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(M in s)if(s.hasOwnProperty(M)&&(i=s[M],i!=null))switch(M){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:He(e,t,M,i,s,null)}return;default:if(sc(t)){for($ in s)s.hasOwnProperty($)&&(i=s[$],i!==void 0&&Gu(e,t,$,i,s,void 0));return}}for(b in s)s.hasOwnProperty(b)&&(i=s[b],i!=null&&He(e,t,b,i,s,null))}function Nb(e,t,s,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,f=null,y=null,b=null,N=null,M=null,$=null;for(L in s){var I=s[L];if(s.hasOwnProperty(L)&&I!=null)switch(L){case"checked":break;case"value":break;case"defaultValue":N=I;default:i.hasOwnProperty(L)||He(e,t,L,null,i,I)}}for(var z in i){var L=i[z];if(I=s[z],i.hasOwnProperty(z)&&(L!=null||I!=null))switch(z){case"type":f=L;break;case"name":u=L;break;case"checked":M=L;break;case"defaultChecked":$=L;break;case"value":y=L;break;case"defaultValue":b=L;break;case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(l(137,t));break;default:L!==I&&He(e,t,z,L,i,I)}}ac(e,y,b,N,M,$,f,u);return;case"select":L=y=b=z=null;for(f in s)if(N=s[f],s.hasOwnProperty(f)&&N!=null)switch(f){case"value":break;case"multiple":L=N;default:i.hasOwnProperty(f)||He(e,t,f,null,i,N)}for(u in i)if(f=i[u],N=s[u],i.hasOwnProperty(u)&&(f!=null||N!=null))switch(u){case"value":z=f;break;case"defaultValue":b=f;break;case"multiple":y=f;default:f!==N&&He(e,t,u,f,i,N)}t=b,s=y,i=L,z!=null?ks(e,!!s,z,!1):!!i!=!!s&&(t!=null?ks(e,!!s,t,!0):ks(e,!!s,s?[]:"",!1));return;case"textarea":L=z=null;for(b in s)if(u=s[b],s.hasOwnProperty(b)&&u!=null&&!i.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:He(e,t,b,null,i,u)}for(y in i)if(u=i[y],f=s[y],i.hasOwnProperty(y)&&(u!=null||f!=null))switch(y){case"value":z=u;break;case"defaultValue":L=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(l(91));break;default:u!==f&&He(e,t,y,u,i,f)}Tf(e,z,L);return;case"option":for(var ae in s)z=s[ae],s.hasOwnProperty(ae)&&z!=null&&!i.hasOwnProperty(ae)&&(ae==="selected"?e.selected=!1:He(e,t,ae,null,i,z));for(N in i)z=i[N],L=s[N],i.hasOwnProperty(N)&&z!==L&&(z!=null||L!=null)&&(N==="selected"?e.selected=z&&typeof z!="function"&&typeof z!="symbol":He(e,t,N,z,i,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 he in s)z=s[he],s.hasOwnProperty(he)&&z!=null&&!i.hasOwnProperty(he)&&He(e,t,he,null,i,z);for(M in i)if(z=i[M],L=s[M],i.hasOwnProperty(M)&&z!==L&&(z!=null||L!=null))switch(M){case"children":case"dangerouslySetInnerHTML":if(z!=null)throw Error(l(137,t));break;default:He(e,t,M,z,i,L)}return;default:if(sc(t)){for(var Ve in s)z=s[Ve],s.hasOwnProperty(Ve)&&z!==void 0&&!i.hasOwnProperty(Ve)&&Gu(e,t,Ve,void 0,i,z);for($ in i)z=i[$],L=s[$],!i.hasOwnProperty($)||z===L||z===void 0&&L===void 0||Gu(e,t,$,z,i,L);return}}for(var C in s)z=s[C],s.hasOwnProperty(C)&&z!=null&&!i.hasOwnProperty(C)&&He(e,t,C,null,i,z);for(I in i)z=i[I],L=s[I],!i.hasOwnProperty(I)||z===L||z==null&&L==null||He(e,t,I,z,i,L)}function Op(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Eb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,s=performance.getEntriesByType("resource"),i=0;i<s.length;i++){var u=s[i],f=u.transferSize,y=u.initiatorType,b=u.duration;if(f&&b&&Op(y)){for(y=0,b=u.responseEnd,i+=1;i<s.length;i++){var N=s[i],M=N.startTime;if(M>b)break;var $=N.transferSize,I=N.initiatorType;$&&Op(I)&&(N=N.responseEnd,y+=$*(N<b?1:(b-M)/(N-M)))}if(--i,t+=8*(f+y)/(u.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 Pu=null,Ku=null;function eo(e){return e.nodeType===9?e:e.ownerDocument}function Rp(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 Dp(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 Yu(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 Ju=null;function Tb(){var e=window.event;return e&&e.type==="popstate"?e===Ju?!1:(Ju=e,!0):(Ju=null,!1)}var Mp=typeof setTimeout=="function"?setTimeout:void 0,Ab=typeof clearTimeout=="function"?clearTimeout:void 0,zp=typeof Promise=="function"?Promise:void 0,Cb=typeof queueMicrotask=="function"?queueMicrotask:typeof zp<"u"?function(e){return zp.resolve(null).then(e).catch(kb)}:Mp;function kb(e){setTimeout(function(){throw e})}function jn(e){return e==="head"}function Up(e,t){var s=t,i=0;do{var u=s.nextSibling;if(e.removeChild(s),u&&u.nodeType===8)if(s=u.data,s==="/$"||s==="/&"){if(i===0){e.removeChild(u),or(t);return}i--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")i++;else if(s==="html")Si(e.ownerDocument.documentElement);else if(s==="head"){s=e.ownerDocument.head,Si(s);for(var f=s.firstChild;f;){var y=f.nextSibling,b=f.nodeName;f[Hr]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&f.rel.toLowerCase()==="stylesheet"||s.removeChild(f),f=y}}else s==="body"&&Si(e.ownerDocument.body);s=u}while(s);or(t)}function Lp(e,t){var s=e;e=0;do{var i=s.nextSibling;if(s.nodeType===1?t?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(t?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),i&&i.nodeType===8)if(s=i.data,s==="/$"){if(e===0)break;e--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||e++;s=i}while(s)}function Xu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var s=t;switch(t=t.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":Xu(s),ec(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}e.removeChild(s)}}function Ob(e,t,s,i){for(;e.nodeType===1;){var u=s;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[Hr])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(f=e.getAttribute("rel"),f==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(f!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(f=e.getAttribute("src"),(f!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&f&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var f=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===f)return e}else return e;if(e=ra(e.nextSibling),e===null)break}return null}function Rb(e,t,s){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!s||(e=ra(e.nextSibling),e===null))return null;return e}function Bp(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=ra(e.nextSibling),e===null))return null;return e}function Qu(e){return e.data==="$?"||e.data==="$~"}function Zu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Db(e,t){var s=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||s.readyState!=="loading")t();else{var i=function(){t(),s.removeEventListener("DOMContentLoaded",i)};s.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function ra(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 Fu=null;function qp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="/$"||s==="/&"){if(t===0)return ra(e.nextSibling);t--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||t++}e=e.nextSibling}return null}function $p(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var s=e.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(t===0)return e;t--}else s!=="/$"&&s!=="/&"||t++}e=e.previousSibling}return null}function Hp(e,t,s){switch(t=eo(s),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 Si(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ec(e)}var ia=new Map,Vp=new Set;function to(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Qa=Q.d;Q.d={f:Mb,r:zb,D:Ub,C:Lb,L:Bb,m:qb,X:Hb,S:$b,M:Vb};function Mb(){var e=Qa.f(),t=Kl();return e||t}function zb(e){var t=Ts(e);t!==null&&t.tag===5&&t.type==="form"?rm(t):Qa.r(e)}var rr=typeof document>"u"?null:document;function Ip(e,t,s){var i=rr;if(i&&typeof t=="string"&&t){var u=Ft(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof s=="string"&&(u+='[crossorigin="'+s+'"]'),Vp.has(u)||(Vp.add(u),e={rel:e,crossOrigin:s,href:t},i.querySelector(u)===null&&(t=i.createElement("link"),St(t,"link",e),gt(t),i.head.appendChild(t)))}}function Ub(e){Qa.D(e),Ip("dns-prefetch",e,null)}function Lb(e,t){Qa.C(e,t),Ip("preconnect",e,t)}function Bb(e,t,s){Qa.L(e,t,s);var i=rr;if(i&&e&&t){var u='link[rel="preload"][as="'+Ft(t)+'"]';t==="image"&&s&&s.imageSrcSet?(u+='[imagesrcset="'+Ft(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(u+='[imagesizes="'+Ft(s.imageSizes)+'"]')):u+='[href="'+Ft(e)+'"]';var f=u;switch(t){case"style":f=ir(e);break;case"script":f=lr(e)}ia.has(f)||(e=_({rel:"preload",href:t==="image"&&s&&s.imageSrcSet?void 0:e,as:t},s),ia.set(f,e),i.querySelector(u)!==null||t==="style"&&i.querySelector(ji(f))||t==="script"&&i.querySelector(Ni(f))||(t=i.createElement("link"),St(t,"link",e),gt(t),i.head.appendChild(t)))}}function qb(e,t){Qa.m(e,t);var s=rr;if(s&&e){var i=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+Ft(i)+'"][href="'+Ft(e)+'"]',f=u;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":f=lr(e)}if(!ia.has(f)&&(e=_({rel:"modulepreload",href:e},t),ia.set(f,e),s.querySelector(u)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(Ni(f)))return}i=s.createElement("link"),St(i,"link",e),gt(i),s.head.appendChild(i)}}}function $b(e,t,s){Qa.S(e,t,s);var i=rr;if(i&&e){var u=As(i).hoistableStyles,f=ir(e);t=t||"default";var y=u.get(f);if(!y){var b={loading:0,preload:null};if(y=i.querySelector(ji(f)))b.loading=5;else{e=_({rel:"stylesheet",href:e,"data-precedence":t},s),(s=ia.get(f))&&Wu(e,s);var N=y=i.createElement("link");gt(N),St(N,"link",e),N._p=new Promise(function(M,$){N.onload=M,N.onerror=$}),N.addEventListener("load",function(){b.loading|=1}),N.addEventListener("error",function(){b.loading|=2}),b.loading|=4,ao(y,t,i)}y={type:"stylesheet",instance:y,count:1,state:b},u.set(f,y)}}}function Hb(e,t){Qa.X(e,t);var s=rr;if(s&&e){var i=As(s).hoistableScripts,u=lr(e),f=i.get(u);f||(f=s.querySelector(Ni(u)),f||(e=_({src:e,async:!0},t),(t=ia.get(u))&&ed(e,t),f=s.createElement("script"),gt(f),St(f,"link",e),s.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(u,f))}}function Vb(e,t){Qa.M(e,t);var s=rr;if(s&&e){var i=As(s).hoistableScripts,u=lr(e),f=i.get(u);f||(f=s.querySelector(Ni(u)),f||(e=_({src:e,async:!0,type:"module"},t),(t=ia.get(u))&&ed(e,t),f=s.createElement("script"),gt(f),St(f,"link",e),s.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(u,f))}}function Gp(e,t,s,i){var u=(u=ye.current)?to(u):null;if(!u)throw Error(l(446));switch(e){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(t=ir(s.href),s=As(u).hoistableStyles,i=s.get(t),i||(i={type:"style",instance:null,count:0,state:null},s.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){e=ir(s.href);var f=As(u).hoistableStyles,y=f.get(e);if(y||(u=u.ownerDocument||u,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(e,y),(f=u.querySelector(ji(e)))&&!f._p&&(y.instance=f,y.state.loading=5),ia.has(e)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},ia.set(e,s),f||Ib(u,e,s,y.state))),t&&i===null)throw Error(l(528,""));return y}if(t&&i!==null)throw Error(l(529,""));return null;case"script":return t=s.async,s=s.src,typeof s=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=lr(s),s=As(u).hoistableScripts,i=s.get(t),i||(i={type:"script",instance:null,count:0,state:null},s.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,e))}}function ir(e){return'href="'+Ft(e)+'"'}function ji(e){return'link[rel="stylesheet"]['+e+"]"}function Pp(e){return _({},e,{"data-precedence":e.precedence,precedence:null})}function Ib(e,t,s,i){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=e.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),St(t,"link",s),gt(t),e.head.appendChild(t))}function lr(e){return'[src="'+Ft(e)+'"]'}function Ni(e){return"script[async]"+e}function Kp(e,t,s){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+Ft(s.href)+'"]');if(i)return t.instance=i,gt(i),i;var u=_({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),gt(i),St(i,"style",u),ao(i,s.precedence,e),t.instance=i;case"stylesheet":u=ir(s.href);var f=e.querySelector(ji(u));if(f)return t.state.loading|=4,t.instance=f,gt(f),f;i=Pp(s),(u=ia.get(u))&&Wu(i,u),f=(e.ownerDocument||e).createElement("link"),gt(f);var y=f;return y._p=new Promise(function(b,N){y.onload=b,y.onerror=N}),St(f,"link",i),t.state.loading|=4,ao(f,s.precedence,e),t.instance=f;case"script":return f=lr(s.src),(u=e.querySelector(Ni(f)))?(t.instance=u,gt(u),u):(i=s,(u=ia.get(f))&&(i=_({},s),ed(i,u)),e=e.ownerDocument||e,u=e.createElement("script"),gt(u),St(u,"link",i),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(l(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,ao(i,s.precedence,e));return t.instance}function ao(e,t,s){for(var i=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=i.length?i[i.length-1]:null,f=u,y=0;y<i.length;y++){var b=i[y];if(b.dataset.precedence===t)f=b;else if(f!==u)break}f?f.parentNode.insertBefore(e,f.nextSibling):(t=s.nodeType===9?s.head:s,t.insertBefore(e,t.firstChild))}function Wu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function ed(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var no=null;function Yp(e,t,s){if(no===null){var i=new Map,u=no=new Map;u.set(s,i)}else u=no,i=u.get(s),i||(i=new Map,u.set(s,i));if(i.has(e))return i;for(i.set(e,null),s=s.getElementsByTagName(e),u=0;u<s.length;u++){var f=s[u];if(!(f[Hr]||f[bt]||e==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var y=f.getAttribute(t)||"";y=e+y;var b=i.get(y);b?b.push(f):i.set(y,[f])}}return i}function Jp(e,t,s){e=e.ownerDocument||e,e.head.insertBefore(s,t==="title"?e.querySelector("head > title"):null)}function Gb(e,t,s){if(s===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 Xp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Pb(e,t,s,i){if(s.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var u=ir(i.href),f=t.querySelector(ji(u));if(f){t=f._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=so.bind(e),t.then(e,e)),s.state.loading|=4,s.instance=f,gt(f);return}f=t.ownerDocument||t,i=Pp(i),(u=ia.get(u))&&Wu(i,u),f=f.createElement("link"),gt(f);var y=f;y._p=new Promise(function(b,N){y.onload=b,y.onerror=N}),St(f,"link",i),s.instance=f}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(s,t),(t=s.state.preload)&&(s.state.loading&3)===0&&(e.count++,s=so.bind(e),t.addEventListener("load",s),t.addEventListener("error",s))}}var td=0;function Kb(e,t){return e.stylesheets&&e.count===0&&io(e,e.stylesheets),0<e.count||0<e.imgCount?function(s){var i=setTimeout(function(){if(e.stylesheets&&io(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+t);0<e.imgBytes&&td===0&&(td=62500*Eb());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&io(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>td?50:800)+t);return e.unsuspend=s,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(u)}}:null}function so(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)io(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var ro=null;function io(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ro=new Map,t.forEach(Yb,e),ro=null,so.call(e))}function Yb(e,t){if(!(t.state.loading&4)){var s=ro.get(e);if(s)var i=s.get(null);else{s=new Map,ro.set(e,s);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<u.length;f++){var y=u[f];(y.nodeName==="LINK"||y.getAttribute("media")!=="not all")&&(s.set(y.dataset.precedence,y),i=y)}i&&s.set(null,i)}u=t.instance,y=u.getAttribute("data-precedence"),f=s.get(y)||i,f===i&&s.set(null,u),s.set(y,u),this.count++,i=so.bind(this),u.addEventListener("load",i),u.addEventListener("error",i),f?f.parentNode.insertBefore(u,f.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),t.state.loading|=4}}var Ei={$$typeof:B,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function Jb(e,t,s,i,u,f,y,b,N){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=te(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=te(0),this.hiddenUpdates=te(null),this.identifierPrefix=i,this.onUncaughtError=u,this.onCaughtError=f,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=N,this.incompleteTransitions=new Map}function Qp(e,t,s,i,u,f,y,b,N,M,$,I){return e=new Jb(e,t,s,y,N,M,$,I,b),t=1,f===!0&&(t|=24),f=Vt(3,null,null,t),e.current=f,f.stateNode=e,t=Mc(),t.refCount++,e.pooledCache=t,t.refCount++,f.memoizedState={element:i,isDehydrated:s,cache:t},Bc(f),e}function Zp(e){return e?(e=Bs,e):Bs}function Fp(e,t,s,i,u,f){u=Zp(u),i.context===null?i.context=u:i.pendingContext=u,i=hn(t),i.payload={element:s},f=f===void 0?null:f,f!==null&&(i.callback=f),s=mn(e,i,t),s!==null&&(qt(s,e,t),si(s,e,t))}function Wp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var s=e.retryLane;e.retryLane=s!==0&&s<t?s:t}}function ad(e,t){Wp(e,t),(e=e.alternate)&&Wp(e,t)}function eg(e){if(e.tag===13||e.tag===31){var t=Pn(e,67108864);t!==null&&qt(t,e,67108864),ad(e,67108864)}}function tg(e){if(e.tag===13||e.tag===31){var t=Yt();t=qr(t);var s=Pn(e,t);s!==null&&qt(s,e,t),ad(e,t)}}var lo=!0;function Xb(e,t,s,i){var u=U.T;U.T=null;var f=Q.p;try{Q.p=2,nd(e,t,s,i)}finally{Q.p=f,U.T=u}}function Qb(e,t,s,i){var u=U.T;U.T=null;var f=Q.p;try{Q.p=8,nd(e,t,s,i)}finally{Q.p=f,U.T=u}}function nd(e,t,s,i){if(lo){var u=sd(i);if(u===null)Iu(e,t,i,oo,s),ng(e,i);else if(Fb(u,e,t,s,i))i.stopPropagation();else if(ng(e,i),t&4&&-1<Zb.indexOf(e)){for(;u!==null;){var f=Ts(u);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var y=Ra(f.pendingLanes);if(y!==0){var b=f;for(b.pendingLanes|=2,b.entangledLanes|=2;y;){var N=1<<31-Ot(y);b.entanglements[1]|=N,y&=~N}wa(f),(ze&6)===0&&(Gl=pt()+500,xi(0))}}break;case 31:case 13:b=Pn(f,2),b!==null&&qt(b,f,2),Kl(),ad(f,2)}if(f=sd(i),f===null&&Iu(e,t,i,oo,s),f===u)break;u=f}u!==null&&i.stopPropagation()}else Iu(e,t,i,null,s)}}function sd(e){return e=ic(e),rd(e)}var oo=null;function rd(e){if(oo=null,e=Es(e),e!==null){var t=d(e);if(t===null)e=null;else{var s=t.tag;if(s===13){if(e=h(t),e!==null)return e;e=null}else if(s===31){if(e=m(t),e!==null)return e;e=null}else if(s===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return oo=e,null}function ag(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(vs()){case ga:return 2;case zn:return 8;case bs:case Ko:return 32;case xs:return 268435456;default:return 32}default:return 32}}var id=!1,Nn=null,En=null,Tn=null,Ti=new Map,Ai=new Map,An=[],Zb="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 ng(e,t){switch(e){case"focusin":case"focusout":Nn=null;break;case"dragenter":case"dragleave":En=null;break;case"mouseover":case"mouseout":Tn=null;break;case"pointerover":case"pointerout":Ti.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ai.delete(t.pointerId)}}function Ci(e,t,s,i,u,f){return e===null||e.nativeEvent!==f?(e={blockedOn:t,domEventName:s,eventSystemFlags:i,nativeEvent:f,targetContainers:[u]},t!==null&&(t=Ts(t),t!==null&&eg(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function Fb(e,t,s,i,u){switch(t){case"focusin":return Nn=Ci(Nn,e,t,s,i,u),!0;case"dragenter":return En=Ci(En,e,t,s,i,u),!0;case"mouseover":return Tn=Ci(Tn,e,t,s,i,u),!0;case"pointerover":var f=u.pointerId;return Ti.set(f,Ci(Ti.get(f)||null,e,t,s,i,u)),!0;case"gotpointercapture":return f=u.pointerId,Ai.set(f,Ci(Ai.get(f)||null,e,t,s,i,u)),!0}return!1}function sg(e){var t=Es(e.target);if(t!==null){var s=d(t);if(s!==null){if(t=s.tag,t===13){if(t=h(s),t!==null){e.blockedOn=t,vf(e.priority,function(){tg(s)});return}}else if(t===31){if(t=m(s),t!==null){e.blockedOn=t,vf(e.priority,function(){tg(s)});return}}else if(t===3&&s.stateNode.current.memoizedState.isDehydrated){e.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}e.blockedOn=null}function co(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var s=sd(e.nativeEvent);if(s===null){s=e.nativeEvent;var i=new s.constructor(s.type,s);rc=i,s.target.dispatchEvent(i),rc=null}else return t=Ts(s),t!==null&&eg(t),e.blockedOn=s,!1;t.shift()}return!0}function rg(e,t,s){co(e)&&s.delete(t)}function Wb(){id=!1,Nn!==null&&co(Nn)&&(Nn=null),En!==null&&co(En)&&(En=null),Tn!==null&&co(Tn)&&(Tn=null),Ti.forEach(rg),Ai.forEach(rg)}function uo(e,t){e.blockedOn===t&&(e.blockedOn=null,id||(id=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,Wb)))}var fo=null;function ig(e){fo!==e&&(fo=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){fo===e&&(fo=null);for(var t=0;t<e.length;t+=3){var s=e[t],i=e[t+1],u=e[t+2];if(typeof i!="function"){if(rd(i||s)===null)continue;break}var f=Ts(s);f!==null&&(e.splice(t,3),t-=3,su(f,{pending:!0,data:u,method:s.method,action:i},i,u))}}))}function or(e){function t(N){return uo(N,e)}Nn!==null&&uo(Nn,e),En!==null&&uo(En,e),Tn!==null&&uo(Tn,e),Ti.forEach(t),Ai.forEach(t);for(var s=0;s<An.length;s++){var i=An[s];i.blockedOn===e&&(i.blockedOn=null)}for(;0<An.length&&(s=An[0],s.blockedOn===null);)sg(s),s.blockedOn===null&&An.shift();if(s=(e.ownerDocument||e).$$reactFormReplay,s!=null)for(i=0;i<s.length;i+=3){var u=s[i],f=s[i+1],y=u[Dt]||null;if(typeof f=="function")y||ig(s);else if(y){var b=null;if(f&&f.hasAttribute("formAction")){if(u=f,y=f[Dt]||null)b=y.formAction;else if(rd(u)!==null)continue}else b=y.action;typeof b=="function"?s[i+1]=b:(s.splice(i,3),i-=3),ig(s)}}}function lg(){function e(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(y){return u=y})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=null),i||setTimeout(s,20)}function s(){if(!i&&!navigation.transition){var f=navigation.currentEntry;f&&f.url!=null&&navigation.navigate(f.url,{state:f.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(s,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function ld(e){this._internalRoot=e}ho.prototype.render=ld.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(l(409));var s=t.current,i=Yt();Fp(s,i,e,t,null,null)},ho.prototype.unmount=ld.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Fp(e.current,2,null,e,null,null),Kl(),t[Ns]=null}};function ho(e){this._internalRoot=e}ho.prototype.unstable_scheduleHydration=function(e){if(e){var t=yf();e={blockedOn:null,target:e,priority:t};for(var s=0;s<An.length&&t!==0&&t<An[s].priority;s++);An.splice(s,0,e),s===0&&sg(e)}};var og=a.version;if(og!=="19.2.3")throw Error(l(527,og,"19.2.3"));Q.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=g(t),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var ex={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:U,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var mo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!mo.isDisabled&&mo.supportsFiber)try{Un=mo.inject(ex),kt=mo}catch{}}return Oi.createRoot=function(e,t){if(!c(e))throw Error(l(299));var s=!1,i="",u=pm,f=gm,y=ym;return t!=null&&(t.unstable_strictMode===!0&&(s=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onUncaughtError!==void 0&&(u=t.onUncaughtError),t.onCaughtError!==void 0&&(f=t.onCaughtError),t.onRecoverableError!==void 0&&(y=t.onRecoverableError)),t=Qp(e,1,!1,null,null,s,i,null,u,f,y,lg),e[Ns]=t.current,Vu(e),new ld(t)},Oi.hydrateRoot=function(e,t,s){if(!c(e))throw Error(l(299));var i=!1,u="",f=pm,y=gm,b=ym,N=null;return s!=null&&(s.unstable_strictMode===!0&&(i=!0),s.identifierPrefix!==void 0&&(u=s.identifierPrefix),s.onUncaughtError!==void 0&&(f=s.onUncaughtError),s.onCaughtError!==void 0&&(y=s.onCaughtError),s.onRecoverableError!==void 0&&(b=s.onRecoverableError),s.formState!==void 0&&(N=s.formState)),t=Qp(e,1,!0,t,s??null,i,u,N,f,y,b,lg),t.context=Zp(null),s=t.current,i=Yt(),i=qr(i),u=hn(i),u.callback=null,mn(s,u,i),s=i,t.current.lanes=s,Se(t,s),wa(t),e[Ns]=t.current,Vu(e),new ho(t)},Oi.version="19.2.3",Oi}var vg;function ux(){if(vg)return ud.exports;vg=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(a){console.error(a)}}return n(),ud.exports=cx(),ud.exports}var dx=ux();const fx=ef(dx);const hx=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),mx=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,r,l)=>l?l.toUpperCase():r.toLowerCase()),bg=n=>{const a=mx(n);return a.charAt(0).toUpperCase()+a.slice(1)},gy=(...n)=>n.filter((a,r,l)=>!!a&&a.trim()!==""&&l.indexOf(a)===r).join(" ").trim(),px=n=>{for(const a in n)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var gx={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 yx=w.forwardRef(({color:n="currentColor",size:a=24,strokeWidth:r=2,absoluteStrokeWidth:l,className:c="",children:d,iconNode:h,...m},p)=>w.createElement("svg",{ref:p,...gx,width:a,height:a,stroke:n,strokeWidth:l?Number(r)*24/Number(a):r,className:gy("lucide",c),...!d&&!px(m)&&{"aria-hidden":"true"},...m},[...h.map(([g,v])=>w.createElement(g,v)),...Array.isArray(d)?d:[d]]));const le=(n,a)=>{const r=w.forwardRef(({className:l,...c},d)=>w.createElement(yx,{ref:d,iconNode:a,className:gy(`lucide-${hx(bg(n))}`,`lucide-${n}`,l),...c}));return r.displayName=bg(n),r};const vx=[["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"}]],bx=le("activity",vx);const xx=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],wx=le("archive",xx);const _x=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Sx=le("arrow-left",_x);const jx=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],Nx=le("arrow-up-down",jx);const Ex=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],Bi=le("brain",Ex);const Tx=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Ax=le("calendar",Tx);const Cx=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],kx=le("camera",Cx);const Ox=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],yy=le("chart-column",Ox);const Rx=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Sa=le("check",Rx);const Dx=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Mx=le("chevron-down",Dx);const zx=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Ux=le("chevron-left",zx);const Lx=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Bx=le("chevron-right",Lx);const qx=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],$x=le("chevron-up",qx);const Hx=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Rr=le("circle-alert",Hx);const Vx=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],nf=le("circle-check-big",Vx);const Ix=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],sf=le("circle-check",Ix);const Gx=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],Px=le("circle-user",Gx);const Kx=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Yx=le("circle-x",Kx);const Jx=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ar=le("clock",Jx);const Xx=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],Sr=le("code",Xx);const Qx=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Zx=le("copy",Qx);const Fx=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],rf=le("cpu",Fx);const Wx=[["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"}]],qi=le("database",Wx);const ew=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],$i=le("external-link",ew);const tw=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],aw=le("eye",tw);const nw=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]],sw=le("flag",nw);const rw=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],iw=le("hash",rw);const lw=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Cr=le("info",lw);const ow=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],cw=le("key-round",ow);const uw=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],dw=le("key",uw);const fw=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],hw=le("layout-dashboard",fw);const mw=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],$t=le("loader-circle",mw);const pw=[["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"}]],gw=le("log-in",pw);const yw=[["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"}]],vw=le("log-out",yw);const bw=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],zd=le("mail",bw);const xw=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],ww=le("minimize-2",xw);const _w=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],Sw=le("moon",_w);const jw=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],xg=le("paperclip",jw);const Nw=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],md=le("pen",Nw);const Ew=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ri=le("plus",Ew);const Tw=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],pd=le("power",Tw);const Aw=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],kr=le("refresh-cw",Aw);const Cw=[["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"}]],vy=le("rotate-ccw",Cw);const kw=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Ow=le("save",kw);const Rw=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Dw=le("search",Rw);const Mw=[["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"}]],zw=le("send",Mw);const Uw=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Ud=le("settings",Uw);const Lw=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],Bw=le("settings-2",Lw);const qw=[["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"}]],Ld=le("shield-check",qw);const $w=[["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"}]],Hw=le("shield",$w);const Vw=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],Iw=le("sun",Vw);const Gw=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Bd=le("terminal",Gw);const Pw=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Oo=le("trash-2",Pw);const Kw=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Or=le("triangle-alert",Kw);const Yw=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Jw=le("upload",Yw);const Xw=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],Qw=le("user-plus",Xw);const Zw=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],by=le("user",Zw);const Fw=[["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"}]],Ww=le("volume-2",Fw);const e_=[["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"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],t_=le("volume-x",e_);const a_=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Fi=le("x",a_);const n_=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Ro=le("zap",n_),s_={theme:"system",setTheme:()=>null},xy=w.createContext(s_);function r_({children:n,defaultTheme:a="system",storageKey:r="vite-ui-theme"}){const[l,c]=w.useState(()=>localStorage.getItem(r)||a);w.useEffect(()=>{const h=window.document.documentElement;if(h.classList.remove("light","dark"),l==="system"){const m=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";h.classList.add(m);return}h.classList.add(l)},[l]);const d={theme:l,setTheme:h=>{localStorage.setItem(r,h),c(h)}};return o.jsx(xy.Provider,{value:d,children:n})}const i_=()=>{const n=w.useContext(xy);if(n===void 0)throw new Error("useTheme must be used within a ThemeProvider");return n};function wg(n,a){if(typeof n=="function")return n(a);n!=null&&(n.current=a)}function qo(...n){return a=>{let r=!1;const l=n.map(c=>{const d=wg(c,a);return!r&&typeof d=="function"&&(r=!0),d});if(r)return()=>{for(let c=0;c<l.length;c++){const d=l[c];typeof d=="function"?d():wg(n[c],null)}}}}function ms(...n){return w.useCallback(qo(...n),n)}var l_=Symbol.for("react.lazy"),Do=af[" use ".trim().toString()];function o_(n){return typeof n=="object"&&n!==null&&"then"in n}function wy(n){return n!=null&&typeof n=="object"&&"$$typeof"in n&&n.$$typeof===l_&&"_payload"in n&&o_(n._payload)}function _y(n){const a=u_(n),r=w.forwardRef((l,c)=>{let{children:d,...h}=l;wy(d)&&typeof Do=="function"&&(d=Do(d._payload));const m=w.Children.toArray(d),p=m.find(f_);if(p){const g=p.props.children,v=m.map(_=>_===p?w.Children.count(g)>1?w.Children.only(null):w.isValidElement(g)?g.props.children:null:_);return o.jsx(a,{...h,ref:c,children:w.isValidElement(g)?w.cloneElement(g,void 0,v):null})}return o.jsx(a,{...h,ref:c,children:d})});return r.displayName=`${n}.Slot`,r}var c_=_y("Slot");function u_(n){const a=w.forwardRef((r,l)=>{let{children:c,...d}=r;if(wy(c)&&typeof Do=="function"&&(c=Do(c._payload)),w.isValidElement(c)){const h=m_(c),m=h_(d,c.props);return c.type!==w.Fragment&&(m.ref=l?qo(l,h):h),w.cloneElement(c,m)}return w.Children.count(c)>1?w.Children.only(null):null});return a.displayName=`${n}.SlotClone`,a}var d_=Symbol("radix.slottable");function f_(n){return w.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===d_}function h_(n,a){const r={...a};for(const l in a){const c=n[l],d=a[l];/^on[A-Z]/.test(l)?c&&d?r[l]=(...m)=>{const p=d(...m);return c(...m),p}:c&&(r[l]=c):l==="style"?r[l]={...c,...d}:l==="className"&&(r[l]=[c,d].filter(Boolean).join(" "))}return{...n,...r}}function m_(n){let a=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?n.ref:(a=Object.getOwnPropertyDescriptor(n,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?n.props.ref:n.props.ref||n.ref)}function Sy(n){var a,r,l="";if(typeof n=="string"||typeof n=="number")l+=n;else if(typeof n=="object")if(Array.isArray(n)){var c=n.length;for(a=0;a<c;a++)n[a]&&(r=Sy(n[a]))&&(l&&(l+=" "),l+=r)}else for(r in n)n[r]&&(l&&(l+=" "),l+=r);return l}function jy(){for(var n,a,r=0,l="",c=arguments.length;r<c;r++)(n=arguments[r])&&(a=Sy(n))&&(l&&(l+=" "),l+=a);return l}const _g=n=>typeof n=="boolean"?`${n}`:n===0?"0":n,Sg=jy,Ny=(n,a)=>r=>{var l;if(a?.variants==null)return Sg(n,r?.class,r?.className);const{variants:c,defaultVariants:d}=a,h=Object.keys(c).map(g=>{const v=r?.[g],_=d?.[g];if(v===null)return null;const x=_g(v)||_g(_);return c[g][x]}),m=r&&Object.entries(r).reduce((g,v)=>{let[_,x]=v;return x===void 0||(g[_]=x),g},{}),p=a==null||(l=a.compoundVariants)===null||l===void 0?void 0:l.reduce((g,v)=>{let{class:_,className:x,...S}=v;return Object.entries(S).every(A=>{let[j,k]=A;return Array.isArray(k)?k.includes({...d,...m}[j]):{...d,...m}[j]===k})?[...g,_,x]:g},[]);return Sg(n,h,p,r?.class,r?.className)},p_=(n,a)=>{const r=new Array(n.length+a.length);for(let l=0;l<n.length;l++)r[l]=n[l];for(let l=0;l<a.length;l++)r[n.length+l]=a[l];return r},g_=(n,a)=>({classGroupId:n,validator:a}),Ey=(n=new Map,a=null,r)=>({nextPart:n,validators:a,classGroupId:r}),Mo="-",jg=[],y_="arbitrary..",v_=n=>{const a=x_(n),{conflictingClassGroups:r,conflictingClassGroupModifiers:l}=n;return{getClassGroupId:h=>{if(h.startsWith("[")&&h.endsWith("]"))return b_(h);const m=h.split(Mo),p=m[0]===""&&m.length>1?1:0;return Ty(m,p,a)},getConflictingClassGroupIds:(h,m)=>{if(m){const p=l[h],g=r[h];return p?g?p_(g,p):p:g||jg}return r[h]||jg}}},Ty=(n,a,r)=>{if(n.length-a===0)return r.classGroupId;const c=n[a],d=r.nextPart.get(c);if(d){const g=Ty(n,a+1,d);if(g)return g}const h=r.validators;if(h===null)return;const m=a===0?n.join(Mo):n.slice(a).join(Mo),p=h.length;for(let g=0;g<p;g++){const v=h[g];if(v.validator(m))return v.classGroupId}},b_=n=>n.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const a=n.slice(1,-1),r=a.indexOf(":"),l=a.slice(0,r);return l?y_+l:void 0})(),x_=n=>{const{theme:a,classGroups:r}=n;return w_(r,a)},w_=(n,a)=>{const r=Ey();for(const l in n){const c=n[l];lf(c,r,l,a)}return r},lf=(n,a,r,l)=>{const c=n.length;for(let d=0;d<c;d++){const h=n[d];__(h,a,r,l)}},__=(n,a,r,l)=>{if(typeof n=="string"){S_(n,a,r);return}if(typeof n=="function"){j_(n,a,r,l);return}N_(n,a,r,l)},S_=(n,a,r)=>{const l=n===""?a:Ay(a,n);l.classGroupId=r},j_=(n,a,r,l)=>{if(E_(n)){lf(n(l),a,r,l);return}a.validators===null&&(a.validators=[]),a.validators.push(g_(r,n))},N_=(n,a,r,l)=>{const c=Object.entries(n),d=c.length;for(let h=0;h<d;h++){const[m,p]=c[h];lf(p,Ay(a,m),r,l)}},Ay=(n,a)=>{let r=n;const l=a.split(Mo),c=l.length;for(let d=0;d<c;d++){const h=l[d];let m=r.nextPart.get(h);m||(m=Ey(),r.nextPart.set(h,m)),r=m}return r},E_=n=>"isThemeGetter"in n&&n.isThemeGetter===!0,T_=n=>{if(n<1)return{get:()=>{},set:()=>{}};let a=0,r=Object.create(null),l=Object.create(null);const c=(d,h)=>{r[d]=h,a++,a>n&&(a=0,l=r,r=Object.create(null))};return{get(d){let h=r[d];if(h!==void 0)return h;if((h=l[d])!==void 0)return c(d,h),h},set(d,h){d in r?r[d]=h:c(d,h)}}},qd="!",Ng=":",A_=[],Eg=(n,a,r,l,c)=>({modifiers:n,hasImportantModifier:a,baseClassName:r,maybePostfixModifierPosition:l,isExternal:c}),C_=n=>{const{prefix:a,experimentalParseClassName:r}=n;let l=c=>{const d=[];let h=0,m=0,p=0,g;const v=c.length;for(let j=0;j<v;j++){const k=c[j];if(h===0&&m===0){if(k===Ng){d.push(c.slice(p,j)),p=j+1;continue}if(k==="/"){g=j;continue}}k==="["?h++:k==="]"?h--:k==="("?m++:k===")"&&m--}const _=d.length===0?c:c.slice(p);let x=_,S=!1;_.endsWith(qd)?(x=_.slice(0,-1),S=!0):_.startsWith(qd)&&(x=_.slice(1),S=!0);const A=g&&g>p?g-p:void 0;return Eg(d,S,x,A)};if(a){const c=a+Ng,d=l;l=h=>h.startsWith(c)?d(h.slice(c.length)):Eg(A_,!1,h,void 0,!0)}if(r){const c=l;l=d=>r({className:d,parseClassName:c})}return l},k_=n=>{const a=new Map;return n.orderSensitiveModifiers.forEach((r,l)=>{a.set(r,1e6+l)}),r=>{const l=[];let c=[];for(let d=0;d<r.length;d++){const h=r[d],m=h[0]==="[",p=a.has(h);m||p?(c.length>0&&(c.sort(),l.push(...c),c=[]),l.push(h)):c.push(h)}return c.length>0&&(c.sort(),l.push(...c)),l}},O_=n=>({cache:T_(n.cacheSize),parseClassName:C_(n),sortModifiers:k_(n),...v_(n)}),R_=/\s+/,D_=(n,a)=>{const{parseClassName:r,getClassGroupId:l,getConflictingClassGroupIds:c,sortModifiers:d}=a,h=[],m=n.trim().split(R_);let p="";for(let g=m.length-1;g>=0;g-=1){const v=m[g],{isExternal:_,modifiers:x,hasImportantModifier:S,baseClassName:A,maybePostfixModifierPosition:j}=r(v);if(_){p=v+(p.length>0?" "+p:p);continue}let k=!!j,R=l(k?A.substring(0,j):A);if(!R){if(!k){p=v+(p.length>0?" "+p:p);continue}if(R=l(A),!R){p=v+(p.length>0?" "+p:p);continue}k=!1}const q=x.length===0?"":x.length===1?x[0]:d(x).join(":"),B=S?q+qd:q,G=B+R;if(h.indexOf(G)>-1)continue;h.push(G);const ee=c(R,k);for(let J=0;J<ee.length;++J){const P=ee[J];h.push(B+P)}p=v+(p.length>0?" "+p:p)}return p},M_=(...n)=>{let a=0,r,l,c="";for(;a<n.length;)(r=n[a++])&&(l=Cy(r))&&(c&&(c+=" "),c+=l);return c},Cy=n=>{if(typeof n=="string")return n;let a,r="";for(let l=0;l<n.length;l++)n[l]&&(a=Cy(n[l]))&&(r&&(r+=" "),r+=a);return r},z_=(n,...a)=>{let r,l,c,d;const h=p=>{const g=a.reduce((v,_)=>_(v),n());return r=O_(g),l=r.cache.get,c=r.cache.set,d=m,m(p)},m=p=>{const g=l(p);if(g)return g;const v=D_(p,r);return c(p,v),v};return d=h,(...p)=>d(M_(...p))},U_=[],dt=n=>{const a=r=>r[n]||U_;return a.isThemeGetter=!0,a},ky=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Oy=/^\((?:(\w[\w-]*):)?(.+)\)$/i,L_=/^\d+\/\d+$/,B_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,q_=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,$_=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,H_=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,V_=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,cr=n=>L_.test(n),_e=n=>!!n&&!Number.isNaN(Number(n)),kn=n=>!!n&&Number.isInteger(Number(n)),gd=n=>n.endsWith("%")&&_e(n.slice(0,-1)),Za=n=>B_.test(n),I_=()=>!0,G_=n=>q_.test(n)&&!$_.test(n),Ry=()=>!1,P_=n=>H_.test(n),K_=n=>V_.test(n),Y_=n=>!ne(n)&&!se(n),J_=n=>Dr(n,zy,Ry),ne=n=>ky.test(n),ss=n=>Dr(n,Uy,G_),yd=n=>Dr(n,W_,_e),Tg=n=>Dr(n,Dy,Ry),X_=n=>Dr(n,My,K_),po=n=>Dr(n,Ly,P_),se=n=>Oy.test(n),Di=n=>Mr(n,Uy),Q_=n=>Mr(n,e1),Ag=n=>Mr(n,Dy),Z_=n=>Mr(n,zy),F_=n=>Mr(n,My),go=n=>Mr(n,Ly,!0),Dr=(n,a,r)=>{const l=ky.exec(n);return l?l[1]?a(l[1]):r(l[2]):!1},Mr=(n,a,r=!1)=>{const l=Oy.exec(n);return l?l[1]?a(l[1]):r:!1},Dy=n=>n==="position"||n==="percentage",My=n=>n==="image"||n==="url",zy=n=>n==="length"||n==="size"||n==="bg-size",Uy=n=>n==="length",W_=n=>n==="number",e1=n=>n==="family-name",Ly=n=>n==="shadow",t1=()=>{const n=dt("color"),a=dt("font"),r=dt("text"),l=dt("font-weight"),c=dt("tracking"),d=dt("leading"),h=dt("breakpoint"),m=dt("container"),p=dt("spacing"),g=dt("radius"),v=dt("shadow"),_=dt("inset-shadow"),x=dt("text-shadow"),S=dt("drop-shadow"),A=dt("blur"),j=dt("perspective"),k=dt("aspect"),R=dt("ease"),q=dt("animate"),B=()=>["auto","avoid","all","avoid-page","page","left","right","column"],G=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],ee=()=>[...G(),se,ne],J=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto","contain","none"],X=()=>[se,ne,p],ue=()=>[cr,"full","auto",...X()],Je=()=>[kn,"none","subgrid",se,ne],be=()=>["auto",{span:["full",kn,se,ne]},kn,se,ne],ge=()=>[kn,"auto",se,ne],Ze=()=>["auto","min","max","fr",se,ne],nt=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],F=()=>["start","end","center","stretch","center-safe","end-safe"],U=()=>["auto",...X()],Q=()=>[cr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...X()],K=()=>[n,se,ne],je=()=>[...G(),Ag,Tg,{position:[se,ne]}],Re=()=>["no-repeat",{repeat:["","x","y","space","round"]}],T=()=>["auto","cover","contain",Z_,J_,{size:[se,ne]}],V=()=>[gd,Di,ss],Y=()=>["","none","full",g,se,ne],W=()=>["",_e,Di,ss],fe=()=>["solid","dashed","dotted","double"],ye=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>[_e,gd,Ag,Tg],Ge=()=>["","none",A,se,ne],Ue=()=>["none",_e,se,ne],Tt=()=>["none",_e,se,ne],mt=()=>[_e,se,ne],vt=()=>[cr,"full",...X()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Za],breakpoint:[Za],color:[I_],container:[Za],"drop-shadow":[Za],ease:["in","out","in-out"],font:[Y_],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Za],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Za],shadow:[Za],spacing:["px",_e],text:[Za],"text-shadow":[Za],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",cr,ne,se,k]}],container:["container"],columns:[{columns:[_e,ne,se,m]}],"break-after":[{"break-after":B()}],"break-before":[{"break-before":B()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:ee()}],overflow:[{overflow:J()}],"overflow-x":[{"overflow-x":J()}],"overflow-y":[{"overflow-y":J()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ue()}],"inset-x":[{"inset-x":ue()}],"inset-y":[{"inset-y":ue()}],start:[{start:ue()}],end:[{end:ue()}],top:[{top:ue()}],right:[{right:ue()}],bottom:[{bottom:ue()}],left:[{left:ue()}],visibility:["visible","invisible","collapse"],z:[{z:[kn,"auto",se,ne]}],basis:[{basis:[cr,"full","auto",m,...X()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[_e,cr,"auto","initial","none",ne]}],grow:[{grow:["",_e,se,ne]}],shrink:[{shrink:["",_e,se,ne]}],order:[{order:[kn,"first","last","none",se,ne]}],"grid-cols":[{"grid-cols":Je()}],"col-start-end":[{col:be()}],"col-start":[{"col-start":ge()}],"col-end":[{"col-end":ge()}],"grid-rows":[{"grid-rows":Je()}],"row-start-end":[{row:be()}],"row-start":[{"row-start":ge()}],"row-end":[{"row-end":ge()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Ze()}],"auto-rows":[{"auto-rows":Ze()}],gap:[{gap:X()}],"gap-x":[{"gap-x":X()}],"gap-y":[{"gap-y":X()}],"justify-content":[{justify:[...nt(),"normal"]}],"justify-items":[{"justify-items":[...F(),"normal"]}],"justify-self":[{"justify-self":["auto",...F()]}],"align-content":[{content:["normal",...nt()]}],"align-items":[{items:[...F(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...F(),{baseline:["","last"]}]}],"place-content":[{"place-content":nt()}],"place-items":[{"place-items":[...F(),"baseline"]}],"place-self":[{"place-self":["auto",...F()]}],p:[{p:X()}],px:[{px:X()}],py:[{py:X()}],ps:[{ps:X()}],pe:[{pe:X()}],pt:[{pt:X()}],pr:[{pr:X()}],pb:[{pb:X()}],pl:[{pl:X()}],m:[{m:U()}],mx:[{mx:U()}],my:[{my:U()}],ms:[{ms:U()}],me:[{me:U()}],mt:[{mt:U()}],mr:[{mr:U()}],mb:[{mb:U()}],ml:[{ml:U()}],"space-x":[{"space-x":X()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":X()}],"space-y-reverse":["space-y-reverse"],size:[{size:Q()}],w:[{w:[m,"screen",...Q()]}],"min-w":[{"min-w":[m,"screen","none",...Q()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[h]},...Q()]}],h:[{h:["screen","lh",...Q()]}],"min-h":[{"min-h":["screen","lh","none",...Q()]}],"max-h":[{"max-h":["screen","lh",...Q()]}],"font-size":[{text:["base",r,Di,ss]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[l,se,yd]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",gd,ne]}],"font-family":[{font:[Q_,ne,a]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[c,se,ne]}],"line-clamp":[{"line-clamp":[_e,"none",se,yd]}],leading:[{leading:[d,...X()]}],"list-image":[{"list-image":["none",se,ne]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",se,ne]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:K()}],"text-color":[{text:K()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...fe(),"wavy"]}],"text-decoration-thickness":[{decoration:[_e,"from-font","auto",se,ss]}],"text-decoration-color":[{decoration:K()}],"underline-offset":[{"underline-offset":[_e,"auto",se,ne]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:X()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",se,ne]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",se,ne]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:je()}],"bg-repeat":[{bg:Re()}],"bg-size":[{bg:T()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},kn,se,ne],radial:["",se,ne],conic:[kn,se,ne]},F_,X_]}],"bg-color":[{bg:K()}],"gradient-from-pos":[{from:V()}],"gradient-via-pos":[{via:V()}],"gradient-to-pos":[{to:V()}],"gradient-from":[{from:K()}],"gradient-via":[{via:K()}],"gradient-to":[{to:K()}],rounded:[{rounded:Y()}],"rounded-s":[{"rounded-s":Y()}],"rounded-e":[{"rounded-e":Y()}],"rounded-t":[{"rounded-t":Y()}],"rounded-r":[{"rounded-r":Y()}],"rounded-b":[{"rounded-b":Y()}],"rounded-l":[{"rounded-l":Y()}],"rounded-ss":[{"rounded-ss":Y()}],"rounded-se":[{"rounded-se":Y()}],"rounded-ee":[{"rounded-ee":Y()}],"rounded-es":[{"rounded-es":Y()}],"rounded-tl":[{"rounded-tl":Y()}],"rounded-tr":[{"rounded-tr":Y()}],"rounded-br":[{"rounded-br":Y()}],"rounded-bl":[{"rounded-bl":Y()}],"border-w":[{border:W()}],"border-w-x":[{"border-x":W()}],"border-w-y":[{"border-y":W()}],"border-w-s":[{"border-s":W()}],"border-w-e":[{"border-e":W()}],"border-w-t":[{"border-t":W()}],"border-w-r":[{"border-r":W()}],"border-w-b":[{"border-b":W()}],"border-w-l":[{"border-l":W()}],"divide-x":[{"divide-x":W()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":W()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...fe(),"hidden","none"]}],"divide-style":[{divide:[...fe(),"hidden","none"]}],"border-color":[{border:K()}],"border-color-x":[{"border-x":K()}],"border-color-y":[{"border-y":K()}],"border-color-s":[{"border-s":K()}],"border-color-e":[{"border-e":K()}],"border-color-t":[{"border-t":K()}],"border-color-r":[{"border-r":K()}],"border-color-b":[{"border-b":K()}],"border-color-l":[{"border-l":K()}],"divide-color":[{divide:K()}],"outline-style":[{outline:[...fe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[_e,se,ne]}],"outline-w":[{outline:["",_e,Di,ss]}],"outline-color":[{outline:K()}],shadow:[{shadow:["","none",v,go,po]}],"shadow-color":[{shadow:K()}],"inset-shadow":[{"inset-shadow":["none",_,go,po]}],"inset-shadow-color":[{"inset-shadow":K()}],"ring-w":[{ring:W()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:K()}],"ring-offset-w":[{"ring-offset":[_e,ss]}],"ring-offset-color":[{"ring-offset":K()}],"inset-ring-w":[{"inset-ring":W()}],"inset-ring-color":[{"inset-ring":K()}],"text-shadow":[{"text-shadow":["none",x,go,po]}],"text-shadow-color":[{"text-shadow":K()}],opacity:[{opacity:[_e,se,ne]}],"mix-blend":[{"mix-blend":[...ye(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ye()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[_e]}],"mask-image-linear-from-pos":[{"mask-linear-from":de()}],"mask-image-linear-to-pos":[{"mask-linear-to":de()}],"mask-image-linear-from-color":[{"mask-linear-from":K()}],"mask-image-linear-to-color":[{"mask-linear-to":K()}],"mask-image-t-from-pos":[{"mask-t-from":de()}],"mask-image-t-to-pos":[{"mask-t-to":de()}],"mask-image-t-from-color":[{"mask-t-from":K()}],"mask-image-t-to-color":[{"mask-t-to":K()}],"mask-image-r-from-pos":[{"mask-r-from":de()}],"mask-image-r-to-pos":[{"mask-r-to":de()}],"mask-image-r-from-color":[{"mask-r-from":K()}],"mask-image-r-to-color":[{"mask-r-to":K()}],"mask-image-b-from-pos":[{"mask-b-from":de()}],"mask-image-b-to-pos":[{"mask-b-to":de()}],"mask-image-b-from-color":[{"mask-b-from":K()}],"mask-image-b-to-color":[{"mask-b-to":K()}],"mask-image-l-from-pos":[{"mask-l-from":de()}],"mask-image-l-to-pos":[{"mask-l-to":de()}],"mask-image-l-from-color":[{"mask-l-from":K()}],"mask-image-l-to-color":[{"mask-l-to":K()}],"mask-image-x-from-pos":[{"mask-x-from":de()}],"mask-image-x-to-pos":[{"mask-x-to":de()}],"mask-image-x-from-color":[{"mask-x-from":K()}],"mask-image-x-to-color":[{"mask-x-to":K()}],"mask-image-y-from-pos":[{"mask-y-from":de()}],"mask-image-y-to-pos":[{"mask-y-to":de()}],"mask-image-y-from-color":[{"mask-y-from":K()}],"mask-image-y-to-color":[{"mask-y-to":K()}],"mask-image-radial":[{"mask-radial":[se,ne]}],"mask-image-radial-from-pos":[{"mask-radial-from":de()}],"mask-image-radial-to-pos":[{"mask-radial-to":de()}],"mask-image-radial-from-color":[{"mask-radial-from":K()}],"mask-image-radial-to-color":[{"mask-radial-to":K()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":G()}],"mask-image-conic-pos":[{"mask-conic":[_e]}],"mask-image-conic-from-pos":[{"mask-conic-from":de()}],"mask-image-conic-to-pos":[{"mask-conic-to":de()}],"mask-image-conic-from-color":[{"mask-conic-from":K()}],"mask-image-conic-to-color":[{"mask-conic-to":K()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:je()}],"mask-repeat":[{mask:Re()}],"mask-size":[{mask:T()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",se,ne]}],filter:[{filter:["","none",se,ne]}],blur:[{blur:Ge()}],brightness:[{brightness:[_e,se,ne]}],contrast:[{contrast:[_e,se,ne]}],"drop-shadow":[{"drop-shadow":["","none",S,go,po]}],"drop-shadow-color":[{"drop-shadow":K()}],grayscale:[{grayscale:["",_e,se,ne]}],"hue-rotate":[{"hue-rotate":[_e,se,ne]}],invert:[{invert:["",_e,se,ne]}],saturate:[{saturate:[_e,se,ne]}],sepia:[{sepia:["",_e,se,ne]}],"backdrop-filter":[{"backdrop-filter":["","none",se,ne]}],"backdrop-blur":[{"backdrop-blur":Ge()}],"backdrop-brightness":[{"backdrop-brightness":[_e,se,ne]}],"backdrop-contrast":[{"backdrop-contrast":[_e,se,ne]}],"backdrop-grayscale":[{"backdrop-grayscale":["",_e,se,ne]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[_e,se,ne]}],"backdrop-invert":[{"backdrop-invert":["",_e,se,ne]}],"backdrop-opacity":[{"backdrop-opacity":[_e,se,ne]}],"backdrop-saturate":[{"backdrop-saturate":[_e,se,ne]}],"backdrop-sepia":[{"backdrop-sepia":["",_e,se,ne]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":X()}],"border-spacing-x":[{"border-spacing-x":X()}],"border-spacing-y":[{"border-spacing-y":X()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",se,ne]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[_e,"initial",se,ne]}],ease:[{ease:["linear","initial",R,se,ne]}],delay:[{delay:[_e,se,ne]}],animate:[{animate:["none",q,se,ne]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,se,ne]}],"perspective-origin":[{"perspective-origin":ee()}],rotate:[{rotate:Ue()}],"rotate-x":[{"rotate-x":Ue()}],"rotate-y":[{"rotate-y":Ue()}],"rotate-z":[{"rotate-z":Ue()}],scale:[{scale:Tt()}],"scale-x":[{"scale-x":Tt()}],"scale-y":[{"scale-y":Tt()}],"scale-z":[{"scale-z":Tt()}],"scale-3d":["scale-3d"],skew:[{skew:mt()}],"skew-x":[{"skew-x":mt()}],"skew-y":[{"skew-y":mt()}],transform:[{transform:[se,ne,"","none","gpu","cpu"]}],"transform-origin":[{origin:ee()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:vt()}],"translate-x":[{"translate-x":vt()}],"translate-y":[{"translate-y":vt()}],"translate-z":[{"translate-z":vt()}],"translate-none":["translate-none"],accent:[{accent:K()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:K()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",se,ne]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":X()}],"scroll-mx":[{"scroll-mx":X()}],"scroll-my":[{"scroll-my":X()}],"scroll-ms":[{"scroll-ms":X()}],"scroll-me":[{"scroll-me":X()}],"scroll-mt":[{"scroll-mt":X()}],"scroll-mr":[{"scroll-mr":X()}],"scroll-mb":[{"scroll-mb":X()}],"scroll-ml":[{"scroll-ml":X()}],"scroll-p":[{"scroll-p":X()}],"scroll-px":[{"scroll-px":X()}],"scroll-py":[{"scroll-py":X()}],"scroll-ps":[{"scroll-ps":X()}],"scroll-pe":[{"scroll-pe":X()}],"scroll-pt":[{"scroll-pt":X()}],"scroll-pr":[{"scroll-pr":X()}],"scroll-pb":[{"scroll-pb":X()}],"scroll-pl":[{"scroll-pl":X()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",se,ne]}],fill:[{fill:["none",...K()]}],"stroke-w":[{stroke:[_e,Di,ss,yd]}],stroke:[{stroke:["none",...K()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},a1=z_(t1);function ke(...n){return a1(jy(n))}const n1=Ny("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 ring-ring/10 dark:ring-ring/20 dark:outline-ring/40 outline-ring/50 focus-visible:ring-4 focus-visible:outline-1 aria-invalid:focus-visible:ring-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90",outline:"border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Z=w.forwardRef(({className:n,variant:a,size:r,asChild:l=!1,...c},d)=>{const h=l?c_:"button";return o.jsx(h,{className:ke(n1({variant:a,size:r,className:n})),ref:d,...c})});Z.displayName="Button";function By(){const{setTheme:n,theme:a}=i_();return o.jsxs(Z,{variant:"ghost",size:"icon",onClick:()=>n(a==="dark"?"light":"dark"),className:"text-muted-foreground hover:text-foreground",title:`Switch to ${a==="dark"?"light":"dark"} mode`,children:[a==="dark"?o.jsx(Iw,{className:"h-[1.2rem] w-[1.2rem]"}):o.jsx(Sw,{className:"h-[1.2rem] w-[1.2rem]"}),o.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}var ja=function(){return ja=Object.assign||function(a){for(var r,l=1,c=arguments.length;l<c;l++){r=arguments[l];for(var d in r)Object.prototype.hasOwnProperty.call(r,d)&&(a[d]=r[d])}return a},ja.apply(this,arguments)};function zr(n,a){var r={};for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&a.indexOf(l)<0&&(r[l]=n[l]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,l=Object.getOwnPropertySymbols(n);c<l.length;c++)a.indexOf(l[c])<0&&Object.prototype.propertyIsEnumerable.call(n,l[c])&&(r[l[c]]=n[l[c]]);return r}function s1(n,a,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(v){try{g(l.next(v))}catch(_){h(_)}}function p(v){try{g(l.throw(v))}catch(_){h(_)}}function g(v){v.done?d(v.value):c(v.value).then(m,p)}g((l=l.apply(n,a||[])).next())})}function r1(n,a,r){if(r||arguments.length===2)for(var l=0,c=a.length,d;l<c;l++)(d||!(l in a))&&(d||(d=Array.prototype.slice.call(a,0,l)),d[l]=a[l]);return n.concat(d||Array.prototype.slice.call(a))}const i1=n=>n?(...a)=>n(...a):(...a)=>fetch(...a);class of extends Error{constructor(a,r="FunctionsError",l){super(a),this.name=r,this.context=l}}class l1 extends of{constructor(a){super("Failed to send a request to the Edge Function","FunctionsFetchError",a)}}class Cg extends of{constructor(a){super("Relay Error invoking the Edge Function","FunctionsRelayError",a)}}class kg extends of{constructor(a){super("Edge Function returned a non-2xx status code","FunctionsHttpError",a)}}var $d;(function(n){n.Any="any",n.ApNortheast1="ap-northeast-1",n.ApNortheast2="ap-northeast-2",n.ApSouth1="ap-south-1",n.ApSoutheast1="ap-southeast-1",n.ApSoutheast2="ap-southeast-2",n.CaCentral1="ca-central-1",n.EuCentral1="eu-central-1",n.EuWest1="eu-west-1",n.EuWest2="eu-west-2",n.EuWest3="eu-west-3",n.SaEast1="sa-east-1",n.UsEast1="us-east-1",n.UsWest1="us-west-1",n.UsWest2="us-west-2"})($d||($d={}));class o1{constructor(a,{headers:r={},customFetch:l,region:c=$d.Any}={}){this.url=a,this.headers=r,this.region=c,this.fetch=i1(l)}setAuth(a){this.headers.Authorization=`Bearer ${a}`}invoke(a){return s1(this,arguments,void 0,function*(r,l={}){var c;let d,h;try{const{headers:m,method:p,body:g,signal:v,timeout:_}=l;let x={},{region:S}=l;S||(S=this.region);const A=new URL(`${this.url}/${r}`);S&&S!=="any"&&(x["x-region"]=S,A.searchParams.set("forceFunctionRegion",S));let j;g&&(m&&!Object.prototype.hasOwnProperty.call(m,"Content-Type")||!m)?typeof Blob<"u"&&g instanceof Blob||g instanceof ArrayBuffer?(x["Content-Type"]="application/octet-stream",j=g):typeof g=="string"?(x["Content-Type"]="text/plain",j=g):typeof FormData<"u"&&g instanceof FormData?j=g:(x["Content-Type"]="application/json",j=JSON.stringify(g)):g&&typeof g!="string"&&!(typeof Blob<"u"&&g instanceof Blob)&&!(g instanceof ArrayBuffer)&&!(typeof FormData<"u"&&g instanceof FormData)?j=JSON.stringify(g):j=g;let k=v;_&&(h=new AbortController,d=setTimeout(()=>h.abort(),_),v?(k=h.signal,v.addEventListener("abort",()=>h.abort())):k=h.signal);const R=yield this.fetch(A.toString(),{method:p||"POST",headers:Object.assign(Object.assign(Object.assign({},x),this.headers),m),body:j,signal:k}).catch(ee=>{throw new l1(ee)}),q=R.headers.get("x-relay-error");if(q&&q==="true")throw new Cg(R);if(!R.ok)throw new kg(R);let B=((c=R.headers.get("Content-Type"))!==null&&c!==void 0?c:"text/plain").split(";")[0].trim(),G;return B==="application/json"?G=yield R.json():B==="application/octet-stream"||B==="application/pdf"?G=yield R.blob():B==="text/event-stream"?G=R:B==="multipart/form-data"?G=yield R.formData():G=yield R.text(),{data:G,error:null,response:R}}catch(m){return{data:null,error:m,response:m instanceof kg||m instanceof Cg?m.context:void 0}}finally{d&&clearTimeout(d)}})}}var c1=class extends Error{constructor(n){super(n.message),this.name="PostgrestError",this.details=n.details,this.hint=n.hint,this.code=n.code}},u1=class{constructor(n){var a,r;this.shouldThrowOnError=!1,this.method=n.method,this.url=n.url,this.headers=new Headers(n.headers),this.schema=n.schema,this.body=n.body,this.shouldThrowOnError=(a=n.shouldThrowOnError)!==null&&a!==void 0?a:!1,this.signal=n.signal,this.isMaybeSingle=(r=n.isMaybeSingle)!==null&&r!==void 0?r:!1,n.fetch?this.fetch=n.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(n,a){return this.headers=new Headers(this.headers),this.headers.set(n,a),this}then(n,a){var r=this;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");const l=this.fetch;let c=l(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async d=>{let h=null,m=null,p=null,g=d.status,v=d.statusText;if(d.ok){var _,x;if(r.method!=="HEAD"){var S;const R=await d.text();R===""||(r.headers.get("Accept")==="text/csv"||r.headers.get("Accept")&&(!((S=r.headers.get("Accept"))===null||S===void 0)&&S.includes("application/vnd.pgrst.plan+text"))?m=R:m=JSON.parse(R))}const j=(_=r.headers.get("Prefer"))===null||_===void 0?void 0:_.match(/count=(exact|planned|estimated)/),k=(x=d.headers.get("content-range"))===null||x===void 0?void 0:x.split("/");j&&k&&k.length>1&&(p=parseInt(k[1])),r.isMaybeSingle&&r.method==="GET"&&Array.isArray(m)&&(m.length>1?(h={code:"PGRST116",details:`Results contain ${m.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},m=null,p=null,g=406,v="Not Acceptable"):m.length===1?m=m[0]:m=null)}else{var A;const j=await d.text();try{h=JSON.parse(j),Array.isArray(h)&&d.status===404&&(m=[],h=null,g=200,v="OK")}catch{d.status===404&&j===""?(g=204,v="No Content"):h={message:j}}if(h&&r.isMaybeSingle&&(!(h==null||(A=h.details)===null||A===void 0)&&A.includes("0 rows"))&&(h=null,g=200,v="OK"),h&&r.shouldThrowOnError)throw new c1(h)}return{error:h,data:m,count:p,status:g,statusText:v}});return this.shouldThrowOnError||(c=c.catch(d=>{var h;let m="";const p=d?.cause;if(p){var g,v,_,x;const A=(g=p?.message)!==null&&g!==void 0?g:"",j=(v=p?.code)!==null&&v!==void 0?v:"";m=`${(_=d?.name)!==null&&_!==void 0?_:"FetchError"}: ${d?.message}`,m+=`
|
|
10
|
+
|
|
11
|
+
Caused by: ${(x=p?.name)!==null&&x!==void 0?x:"Error"}: ${A}`,j&&(m+=` (${j})`),p?.stack&&(m+=`
|
|
12
|
+
${p.stack}`)}else{var S;m=(S=d?.stack)!==null&&S!==void 0?S:""}return{error:{message:`${(h=d?.name)!==null&&h!==void 0?h:"FetchError"}: ${d?.message}`,details:m,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),c.then(n,a)}returns(){return this}overrideTypes(){return this}},d1=class extends u1{select(n){let a=!1;const r=(n??"*").split("").map(l=>/\s/.test(l)&&!a?"":(l==='"'&&(a=!a),l)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(n,{ascending:a=!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},`:""}${n}.${a?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(n,{foreignTable:a,referencedTable:r=a}={}){const l=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(l,`${n}`),this}range(n,a,{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,`${n}`),this.url.searchParams.set(d,`${a-n+1}`),this}abortSignal(n){return this.signal=n,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),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:n=!1,verbose:a=!1,settings:r=!1,buffers:l=!1,wal:c=!1,format:d="text"}={}){var h;const m=[n?"analyze":null,a?"verbose":null,r?"settings":null,l?"buffers":null,c?"wal":null].filter(Boolean).join("|"),p=(h=this.headers.get("Accept"))!==null&&h!==void 0?h:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${d}; for="${p}"; options=${m};`),d==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(n){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${n}`),this}};const Og=new RegExp("[,()]");var br=class extends d1{eq(n,a){return this.url.searchParams.append(n,`eq.${a}`),this}neq(n,a){return this.url.searchParams.append(n,`neq.${a}`),this}gt(n,a){return this.url.searchParams.append(n,`gt.${a}`),this}gte(n,a){return this.url.searchParams.append(n,`gte.${a}`),this}lt(n,a){return this.url.searchParams.append(n,`lt.${a}`),this}lte(n,a){return this.url.searchParams.append(n,`lte.${a}`),this}like(n,a){return this.url.searchParams.append(n,`like.${a}`),this}likeAllOf(n,a){return this.url.searchParams.append(n,`like(all).{${a.join(",")}}`),this}likeAnyOf(n,a){return this.url.searchParams.append(n,`like(any).{${a.join(",")}}`),this}ilike(n,a){return this.url.searchParams.append(n,`ilike.${a}`),this}ilikeAllOf(n,a){return this.url.searchParams.append(n,`ilike(all).{${a.join(",")}}`),this}ilikeAnyOf(n,a){return this.url.searchParams.append(n,`ilike(any).{${a.join(",")}}`),this}regexMatch(n,a){return this.url.searchParams.append(n,`match.${a}`),this}regexIMatch(n,a){return this.url.searchParams.append(n,`imatch.${a}`),this}is(n,a){return this.url.searchParams.append(n,`is.${a}`),this}isDistinct(n,a){return this.url.searchParams.append(n,`isdistinct.${a}`),this}in(n,a){const r=Array.from(new Set(a)).map(l=>typeof l=="string"&&Og.test(l)?`"${l}"`:`${l}`).join(",");return this.url.searchParams.append(n,`in.(${r})`),this}notIn(n,a){const r=Array.from(new Set(a)).map(l=>typeof l=="string"&&Og.test(l)?`"${l}"`:`${l}`).join(",");return this.url.searchParams.append(n,`not.in.(${r})`),this}contains(n,a){return typeof a=="string"?this.url.searchParams.append(n,`cs.${a}`):Array.isArray(a)?this.url.searchParams.append(n,`cs.{${a.join(",")}}`):this.url.searchParams.append(n,`cs.${JSON.stringify(a)}`),this}containedBy(n,a){return typeof a=="string"?this.url.searchParams.append(n,`cd.${a}`):Array.isArray(a)?this.url.searchParams.append(n,`cd.{${a.join(",")}}`):this.url.searchParams.append(n,`cd.${JSON.stringify(a)}`),this}rangeGt(n,a){return this.url.searchParams.append(n,`sr.${a}`),this}rangeGte(n,a){return this.url.searchParams.append(n,`nxl.${a}`),this}rangeLt(n,a){return this.url.searchParams.append(n,`sl.${a}`),this}rangeLte(n,a){return this.url.searchParams.append(n,`nxr.${a}`),this}rangeAdjacent(n,a){return this.url.searchParams.append(n,`adj.${a}`),this}overlaps(n,a){return typeof a=="string"?this.url.searchParams.append(n,`ov.${a}`):this.url.searchParams.append(n,`ov.{${a.join(",")}}`),this}textSearch(n,a,{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(n,`${c}fts${d}.${a}`),this}match(n){return Object.entries(n).forEach(([a,r])=>{this.url.searchParams.append(a,`eq.${r}`)}),this}not(n,a,r){return this.url.searchParams.append(n,`not.${a}.${r}`),this}or(n,{foreignTable:a,referencedTable:r=a}={}){const l=r?`${r}.or`:"or";return this.url.searchParams.append(l,`(${n})`),this}filter(n,a,r){return this.url.searchParams.append(n,`${a}.${r}`),this}},f1=class{constructor(n,{headers:a={},schema:r,fetch:l}){this.url=n,this.headers=new Headers(a),this.schema=r,this.fetch=l}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(n,a){const{head:r=!1,count:l}=a??{},c=r?"HEAD":"GET";let d=!1;const h=(n??"*").split("").map(g=>/\s/.test(g)&&!d?"":(g==='"'&&(d=!d),g)).join(""),{url:m,headers:p}=this.cloneRequestState();return m.searchParams.set("select",h),l&&p.append("Prefer",`count=${l}`),new br({method:c,url:m,headers:p,schema:this.schema,fetch:this.fetch})}insert(n,{count:a,defaultToNull:r=!0}={}){var l;const c="POST",{url:d,headers:h}=this.cloneRequestState();if(a&&h.append("Prefer",`count=${a}`),r||h.append("Prefer","missing=default"),Array.isArray(n)){const m=n.reduce((p,g)=>p.concat(Object.keys(g)),[]);if(m.length>0){const p=[...new Set(m)].map(g=>`"${g}"`);d.searchParams.set("columns",p.join(","))}}return new br({method:c,url:d,headers:h,schema:this.schema,body:n,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}upsert(n,{onConflict:a,ignoreDuplicates:r=!1,count:l,defaultToNull:c=!0}={}){var d;const h="POST",{url:m,headers:p}=this.cloneRequestState();if(p.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),a!==void 0&&m.searchParams.set("on_conflict",a),l&&p.append("Prefer",`count=${l}`),c||p.append("Prefer","missing=default"),Array.isArray(n)){const g=n.reduce((v,_)=>v.concat(Object.keys(_)),[]);if(g.length>0){const v=[...new Set(g)].map(_=>`"${_}"`);m.searchParams.set("columns",v.join(","))}}return new br({method:h,url:m,headers:p,schema:this.schema,body:n,fetch:(d=this.fetch)!==null&&d!==void 0?d:fetch})}update(n,{count:a}={}){var r;const l="PATCH",{url:c,headers:d}=this.cloneRequestState();return a&&d.append("Prefer",`count=${a}`),new br({method:l,url:c,headers:d,schema:this.schema,body:n,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}delete({count:n}={}){var a;const r="DELETE",{url:l,headers:c}=this.cloneRequestState();return n&&c.append("Prefer",`count=${n}`),new br({method:r,url:l,headers:c,schema:this.schema,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}},h1=class qy{constructor(a,{headers:r={},schema:l,fetch:c}={}){this.url=a,this.headers=new Headers(r),this.schemaName=l,this.fetch=c}from(a){if(!a||typeof a!="string"||a.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new f1(new URL(`${this.url}/${a}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(a){return new qy(this.url,{headers:this.headers,schema:a,fetch:this.fetch})}rpc(a,r={},{head:l=!1,get:c=!1,count:d}={}){var h;let m;const p=new URL(`${this.url}/rpc/${a}`);let g;const v=S=>S!==null&&typeof S=="object"&&(!Array.isArray(S)||S.some(v)),_=l&&Object.values(r).some(v);_?(m="POST",g=r):l||c?(m=l?"HEAD":"GET",Object.entries(r).filter(([S,A])=>A!==void 0).map(([S,A])=>[S,Array.isArray(A)?`{${A.join(",")}}`:`${A}`]).forEach(([S,A])=>{p.searchParams.append(S,A)})):(m="POST",g=r);const x=new Headers(this.headers);return _?x.set("Prefer",d?`count=${d},return=minimal`:"return=minimal"):d&&x.set("Prefer",`count=${d}`),new br({method:m,url:p,headers:x,schema:this.schemaName,body:g,fetch:(h=this.fetch)!==null&&h!==void 0?h:fetch})}};class m1{constructor(){}static detectEnvironment(){var a;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.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"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((a=navigator.userAgent)===null||a===void 0)&&a.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 r=globalThis.process;if(r){const l=r.versions;if(l&&l.node){const c=l.node,d=parseInt(c.replace(/^v/,"").split(".")[0]);return d>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${d} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${d} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
|
|
13
|
+
import ws from "ws"
|
|
14
|
+
new RealtimeClient(url, { transport: ws })`}}}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 a=this.detectEnvironment();if(a.constructor)return a.constructor;let r=a.error||"WebSocket not supported in this environment.";throw a.workaround&&(r+=`
|
|
15
|
+
|
|
16
|
+
Suggested solution: ${a.workaround}`),new Error(r)}static createWebSocket(a,r){const l=this.getWebSocketConstructor();return new l(a,r)}static isWebSocketSupported(){try{const a=this.detectEnvironment();return a.type==="native"||a.type==="ws"}catch{return!1}}}const p1="2.90.1",g1=`realtime-js/${p1}`,$y="1.0.0",y1="2.0.0",Rg=$y,Hd=1e4,v1=1e3,b1=100;var Rn;(function(n){n[n.connecting=0]="connecting",n[n.open=1]="open",n[n.closing=2]="closing",n[n.closed=3]="closed"})(Rn||(Rn={}));var ft;(function(n){n.closed="closed",n.errored="errored",n.joined="joined",n.joining="joining",n.leaving="leaving"})(ft||(ft={}));var ha;(function(n){n.close="phx_close",n.error="phx_error",n.join="phx_join",n.reply="phx_reply",n.leave="phx_leave",n.access_token="access_token"})(ha||(ha={}));var Vd;(function(n){n.websocket="websocket"})(Vd||(Vd={}));var os;(function(n){n.Connecting="connecting",n.Open="open",n.Closing="closing",n.Closed="closed"})(os||(os={}));class x1{constructor(a){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=a??[]}encode(a,r){if(a.event===this.BROADCAST_EVENT&&!(a.payload instanceof ArrayBuffer)&&typeof a.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(a));let l=[a.join_ref,a.ref,a.topic,a.event,a.payload];return r(JSON.stringify(l))}_binaryEncodeUserBroadcastPush(a){var r;return this._isArrayBuffer((r=a.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(a):this._encodeJsonUserBroadcastPush(a)}_encodeBinaryUserBroadcastPush(a){var r,l;const c=(l=(r=a.payload)===null||r===void 0?void 0:r.payload)!==null&&l!==void 0?l:new ArrayBuffer(0);return this._encodeUserBroadcastPush(a,this.BINARY_ENCODING,c)}_encodeJsonUserBroadcastPush(a){var r,l;const c=(l=(r=a.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(a,this.JSON_ENCODING,h)}_encodeUserBroadcastPush(a,r,l){var c,d;const h=a.topic,m=(c=a.ref)!==null&&c!==void 0?c:"",p=(d=a.join_ref)!==null&&d!==void 0?d:"",g=a.payload.event,v=this.allowedMetadataKeys?this._pick(a.payload,this.allowedMetadataKeys):{},_=Object.keys(v).length===0?"":JSON.stringify(v);if(p.length>255)throw new Error(`joinRef length ${p.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(g.length>255)throw new Error(`userEvent length ${g.length} exceeds maximum of 255`);if(_.length>255)throw new Error(`metadata length ${_.length} exceeds maximum of 255`);const x=this.USER_BROADCAST_PUSH_META_LENGTH+p.length+m.length+h.length+g.length+_.length,S=new ArrayBuffer(this.HEADER_LENGTH+x);let A=new DataView(S),j=0;A.setUint8(j++,this.KINDS.userBroadcastPush),A.setUint8(j++,p.length),A.setUint8(j++,m.length),A.setUint8(j++,h.length),A.setUint8(j++,g.length),A.setUint8(j++,_.length),A.setUint8(j++,r),Array.from(p,R=>A.setUint8(j++,R.charCodeAt(0))),Array.from(m,R=>A.setUint8(j++,R.charCodeAt(0))),Array.from(h,R=>A.setUint8(j++,R.charCodeAt(0))),Array.from(g,R=>A.setUint8(j++,R.charCodeAt(0))),Array.from(_,R=>A.setUint8(j++,R.charCodeAt(0)));var k=new Uint8Array(S.byteLength+l.byteLength);return k.set(new Uint8Array(S),0),k.set(new Uint8Array(l),S.byteLength),k.buffer}decode(a,r){if(this._isArrayBuffer(a)){let l=this._binaryDecode(a);return r(l)}if(typeof a=="string"){const l=JSON.parse(a),[c,d,h,m,p]=l;return r({join_ref:c,ref:d,topic:h,event:m,payload:p})}return r({})}_binaryDecode(a){const r=new DataView(a),l=r.getUint8(0),c=new TextDecoder;if(l===this.KINDS.userBroadcast)return this._decodeUserBroadcast(a,r,c)}_decodeUserBroadcast(a,r,l){const c=r.getUint8(1),d=r.getUint8(2),h=r.getUint8(3),m=r.getUint8(4);let p=this.HEADER_LENGTH+4;const g=l.decode(a.slice(p,p+c));p=p+c;const v=l.decode(a.slice(p,p+d));p=p+d;const _=l.decode(a.slice(p,p+h));p=p+h;const x=a.slice(p,a.byteLength),S=m===this.JSON_ENCODING?JSON.parse(l.decode(x)):x,A={type:this.BROADCAST_EVENT,event:v,payload:S};return h>0&&(A.meta=JSON.parse(_)),{join_ref:null,ref:null,topic:g,event:this.BROADCAST_EVENT,payload:A}}_isArrayBuffer(a){var r;return a instanceof ArrayBuffer||((r=a?.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}_pick(a,r){return!a||typeof a!="object"?{}:Object.fromEntries(Object.entries(a).filter(([l])=>r.includes(l)))}}class Hy{constructor(a,r){this.callback=a,this.timerCalc=r,this.timer=void 0,this.tries=0,this.callback=a,this.timerCalc=r}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var Pe;(function(n){n.abstime="abstime",n.bool="bool",n.date="date",n.daterange="daterange",n.float4="float4",n.float8="float8",n.int2="int2",n.int4="int4",n.int4range="int4range",n.int8="int8",n.int8range="int8range",n.json="json",n.jsonb="jsonb",n.money="money",n.numeric="numeric",n.oid="oid",n.reltime="reltime",n.text="text",n.time="time",n.timestamp="timestamp",n.timestamptz="timestamptz",n.timetz="timetz",n.tsrange="tsrange",n.tstzrange="tstzrange"})(Pe||(Pe={}));const Dg=(n,a,r={})=>{var l;const c=(l=r.skipTypes)!==null&&l!==void 0?l:[];return a?Object.keys(a).reduce((d,h)=>(d[h]=w1(h,n,a,c),d),{}):{}},w1=(n,a,r,l)=>{const c=a.find(m=>m.name===n),d=c?.type,h=r[n];return d&&!l.includes(d)?Vy(d,h):Id(h)},Vy=(n,a)=>{if(n.charAt(0)==="_"){const r=n.slice(1,n.length);return N1(a,r)}switch(n){case Pe.bool:return _1(a);case Pe.float4:case Pe.float8:case Pe.int2:case Pe.int4:case Pe.int8:case Pe.numeric:case Pe.oid:return S1(a);case Pe.json:case Pe.jsonb:return j1(a);case Pe.timestamp:return E1(a);case Pe.abstime:case Pe.date:case Pe.daterange:case Pe.int4range:case Pe.int8range:case Pe.money:case Pe.reltime:case Pe.text:case Pe.time:case Pe.timestamptz:case Pe.timetz:case Pe.tsrange:case Pe.tstzrange:return Id(a);default:return Id(a)}},Id=n=>n,_1=n=>{switch(n){case"t":return!0;case"f":return!1;default:return n}},S1=n=>{if(typeof n=="string"){const a=parseFloat(n);if(!Number.isNaN(a))return a}return n},j1=n=>{if(typeof n=="string")try{return JSON.parse(n)}catch{return n}return n},N1=(n,a)=>{if(typeof n!="string")return n;const r=n.length-1,l=n[r];if(n[0]==="{"&&l==="}"){let d;const h=n.slice(1,r);try{d=JSON.parse("["+h+"]")}catch{d=h?h.split(","):[]}return d.map(m=>Vy(a,m))}return n},E1=n=>typeof n=="string"?n.replace(" ","T"):n,Iy=n=>{const a=new URL(n);return a.protocol=a.protocol.replace(/^ws/i,"http"),a.pathname=a.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),a.pathname===""||a.pathname==="/"?a.pathname="/api/broadcast":a.pathname=a.pathname+"/api/broadcast",a.href};class vd{constructor(a,r,l={},c=Hd){this.channel=a,this.event=r,this.payload=l,this.timeout=c,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(a){this.timeout=a,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,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()}))}updatePayload(a){this.payload=Object.assign(Object.assign({},this.payload),a)}receive(a,r){var l;return this._hasReceived(a)&&r((l=this.receivedResp)===null||l===void 0?void 0:l.response),this.recHooks.push({status:a,callback:r}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const a=r=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=r,this._matchReceive(r)};this.channel._on(this.refEvent,{},a),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(a,r){this.refEvent&&this.channel._trigger(this.refEvent,{status:a,response:r})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:a,response:r}){this.recHooks.filter(l=>l.status===a).forEach(l=>l.callback(r))}_hasReceived(a){return this.receivedResp&&this.receivedResp.status===a}}var Mg;(function(n){n.SYNC="sync",n.JOIN="join",n.LEAVE="leave"})(Mg||(Mg={}));class zi{constructor(a,r){this.channel=a,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const l=r?.events||{state:"presence_state",diff:"presence_diff"};this.channel._on(l.state,{},c=>{const{onJoin:d,onLeave:h,onSync:m}=this.caller;this.joinRef=this.channel._joinRef(),this.state=zi.syncState(this.state,c,d,h),this.pendingDiffs.forEach(p=>{this.state=zi.syncDiff(this.state,p,d,h)}),this.pendingDiffs=[],m()}),this.channel._on(l.diff,{},c=>{const{onJoin:d,onLeave:h,onSync:m}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(c):(this.state=zi.syncDiff(this.state,c,d,h),m())}),this.onJoin((c,d,h)=>{this.channel._trigger("presence",{event:"join",key:c,currentPresences:d,newPresences:h})}),this.onLeave((c,d,h)=>{this.channel._trigger("presence",{event:"leave",key:c,currentPresences:d,leftPresences:h})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(a,r,l,c){const d=this.cloneDeep(a),h=this.transformState(r),m={},p={};return this.map(d,(g,v)=>{h[g]||(p[g]=v)}),this.map(h,(g,v)=>{const _=d[g];if(_){const x=v.map(k=>k.presence_ref),S=_.map(k=>k.presence_ref),A=v.filter(k=>S.indexOf(k.presence_ref)<0),j=_.filter(k=>x.indexOf(k.presence_ref)<0);A.length>0&&(m[g]=A),j.length>0&&(p[g]=j)}else m[g]=v}),this.syncDiff(d,{joins:m,leaves:p},l,c)}static syncDiff(a,r,l,c){const{joins:d,leaves:h}={joins:this.transformState(r.joins),leaves:this.transformState(r.leaves)};return l||(l=()=>{}),c||(c=()=>{}),this.map(d,(m,p)=>{var g;const v=(g=a[m])!==null&&g!==void 0?g:[];if(a[m]=this.cloneDeep(p),v.length>0){const _=a[m].map(S=>S.presence_ref),x=v.filter(S=>_.indexOf(S.presence_ref)<0);a[m].unshift(...x)}l(m,v,p)}),this.map(h,(m,p)=>{let g=a[m];if(!g)return;const v=p.map(_=>_.presence_ref);g=g.filter(_=>v.indexOf(_.presence_ref)<0),a[m]=g,c(m,g,p),g.length===0&&delete a[m]}),a}static map(a,r){return Object.getOwnPropertyNames(a).map(l=>r(l,a[l]))}static transformState(a){return a=this.cloneDeep(a),Object.getOwnPropertyNames(a).reduce((r,l)=>{const c=a[l];return"metas"in c?r[l]=c.metas.map(d=>(d.presence_ref=d.phx_ref,delete d.phx_ref,delete d.phx_ref_prev,d)):r[l]=c,r},{})}static cloneDeep(a){return JSON.parse(JSON.stringify(a))}onJoin(a){this.caller.onJoin=a}onLeave(a){this.caller.onLeave=a}onSync(a){this.caller.onSync=a}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var zg;(function(n){n.ALL="*",n.INSERT="INSERT",n.UPDATE="UPDATE",n.DELETE="DELETE"})(zg||(zg={}));var Ui;(function(n){n.BROADCAST="broadcast",n.PRESENCE="presence",n.POSTGRES_CHANGES="postgres_changes",n.SYSTEM="system"})(Ui||(Ui={}));var Fa;(function(n){n.SUBSCRIBED="SUBSCRIBED",n.TIMED_OUT="TIMED_OUT",n.CLOSED="CLOSED",n.CHANNEL_ERROR="CHANNEL_ERROR"})(Fa||(Fa={}));class jr{constructor(a,r={config:{}},l){var c,d;if(this.topic=a,this.params=r,this.socket=l,this.bindings={},this.state=ft.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=a.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.timeout=this.socket.timeout,this.joinPush=new vd(this,ha.join,this.params,this.timeout),this.rejoinTimer=new Hy(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=ft.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(h=>h.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=ft.closed,this.socket._remove(this)}),this._onError(h=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,h),this.state=ft.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=ft.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",h=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,h),this.state=ft.errored,this.rejoinTimer.scheduleTimeout())}),this._on(ha.reply,{},(h,m)=>{this._trigger(this._replyEventName(m),h)}),this.presence=new zi(this),this.broadcastEndpointURL=Iy(this.socket.endPoint),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`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(a,r=this.timeout){var l,c,d;if(this.socket.isConnected()||this.socket.connect(),this.state==ft.closed){const{config:{broadcast:h,presence:m,private:p}}=this.params,g=(c=(l=this.bindings.postgres_changes)===null||l===void 0?void 0:l.map(S=>S.filter))!==null&&c!==void 0?c:[],v=!!this.bindings[Ui.PRESENCE]&&this.bindings[Ui.PRESENCE].length>0||((d=this.params.config.presence)===null||d===void 0?void 0:d.enabled)===!0,_={},x={broadcast:h,presence:Object.assign(Object.assign({},m),{enabled:v}),postgres_changes:g,private:p};this.socket.accessTokenValue&&(_.access_token=this.socket.accessTokenValue),this._onError(S=>a?.(Fa.CHANNEL_ERROR,S)),this._onClose(()=>a?.(Fa.CLOSED)),this.updateJoinPayload(Object.assign({config:x},_)),this.joinedOnce=!0,this._rejoin(r),this.joinPush.receive("ok",async({postgres_changes:S})=>{var A;if(this.socket._isManualToken()||this.socket.setAuth(),S===void 0){a?.(Fa.SUBSCRIBED);return}else{const j=this.bindings.postgres_changes,k=(A=j?.length)!==null&&A!==void 0?A:0,R=[];for(let q=0;q<k;q++){const B=j[q],{filter:{event:G,schema:ee,table:J,filter:P}}=B,X=S&&S[q];if(X&&X.event===G&&jr.isFilterValueEqual(X.schema,ee)&&jr.isFilterValueEqual(X.table,J)&&jr.isFilterValueEqual(X.filter,P))R.push(Object.assign(Object.assign({},B),{id:X.id}));else{this.unsubscribe(),this.state=ft.errored,a?.(Fa.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=R,a&&a(Fa.SUBSCRIBED);return}}).receive("error",S=>{this.state=ft.errored,a?.(Fa.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(S).join(", ")||"error")))}).receive("timeout",()=>{a?.(Fa.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(a,r={}){return await this.send({type:"presence",event:"track",payload:a},r.timeout||this.timeout)}async untrack(a={}){return await this.send({type:"presence",event:"untrack"},a)}on(a,r,l){return this.state===ft.joined&&a===Ui.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(a,r,l)}async httpSend(a,r,l={}){var c;if(r==null)return Promise.reject("Payload is required for httpSend()");const d={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(d.Authorization=`Bearer ${this.socket.accessTokenValue}`);const h={method:"POST",headers:d,body:JSON.stringify({messages:[{topic:this.subTopic,event:a,payload:r,private:this.private}]})},m=await this._fetchWithTimeout(this.broadcastEndpointURL,h,(c=l.timeout)!==null&&c!==void 0?c:this.timeout);if(m.status===202)return{success:!0};let p=m.statusText;try{const g=await m.json();p=g.error||g.message||p}catch{}return Promise.reject(new Error(p))}async send(a,r={}){var l,c;if(!this._canPush()&&a.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}=a,m={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(m.Authorization=`Bearer ${this.socket.accessTokenValue}`);const p={method:"POST",headers:m,body:JSON.stringify({messages:[{topic:this.subTopic,event:d,payload:h,private:this.private}]})};try{const g=await this._fetchWithTimeout(this.broadcastEndpointURL,p,(l=r.timeout)!==null&&l!==void 0?l:this.timeout);return await((c=g.body)===null||c===void 0?void 0:c.cancel()),g.ok?"ok":"error"}catch(g){return g.name==="AbortError"?"timed out":"error"}}else return new Promise(d=>{var h,m,p;const g=this._push(a.type,a,r.timeout||this.timeout);a.type==="broadcast"&&!(!((p=(m=(h=this.params)===null||h===void 0?void 0:h.config)===null||m===void 0?void 0:m.broadcast)===null||p===void 0)&&p.ack)&&d("ok"),g.receive("ok",()=>d("ok")),g.receive("error",()=>d("error")),g.receive("timeout",()=>d("timed out"))})}updateJoinPayload(a){this.joinPush.updatePayload(a)}unsubscribe(a=this.timeout){this.state=ft.leaving;const r=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(ha.close,"leave",this._joinRef())};this.joinPush.destroy();let l=null;return new Promise(c=>{l=new vd(this,ha.leave,{},a),l.receive("ok",()=>{r(),c("ok")}).receive("timeout",()=>{r(),c("timed out")}).receive("error",()=>{c("error")}),l.send(),this._canPush()||l.trigger("ok",{})}).finally(()=>{l?.destroy()})}teardown(){this.pushBuffer.forEach(a=>a.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=ft.closed,this.bindings={}}async _fetchWithTimeout(a,r,l){const c=new AbortController,d=setTimeout(()=>c.abort(),l),h=await this.socket.fetch(a,Object.assign(Object.assign({},r),{signal:c.signal}));return clearTimeout(d),h}_push(a,r,l=this.timeout){if(!this.joinedOnce)throw`tried to push '${a}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let c=new vd(this,a,r,l);return this._canPush()?c.send():this._addToPushBuffer(c),c}_addToPushBuffer(a){if(a.startTimeout(),this.pushBuffer.push(a),this.pushBuffer.length>b1){const r=this.pushBuffer.shift();r&&(r.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${r.event}`,r.payload))}}_onMessage(a,r,l){return r}_isMember(a){return this.topic===a}_joinRef(){return this.joinPush.ref}_trigger(a,r,l){var c,d;const h=a.toLocaleLowerCase(),{close:m,error:p,leave:g,join:v}=ha;if(l&&[m,p,g,v].indexOf(h)>=0&&l!==this._joinRef())return;let x=this._onMessage(h,r,l);if(r&&!x)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(h)?(c=this.bindings.postgres_changes)===null||c===void 0||c.filter(S=>{var A,j,k;return((A=S.filter)===null||A===void 0?void 0:A.event)==="*"||((k=(j=S.filter)===null||j===void 0?void 0:j.event)===null||k===void 0?void 0:k.toLocaleLowerCase())===h}).map(S=>S.callback(x,l)):(d=this.bindings[h])===null||d===void 0||d.filter(S=>{var A,j,k,R,q,B,G,ee;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in S){const J=S.id,P=(A=S.filter)===null||A===void 0?void 0:A.event;return J&&((j=r.ids)===null||j===void 0?void 0:j.includes(J))&&(P==="*"||P?.toLocaleLowerCase()===((k=r.data)===null||k===void 0?void 0:k.type.toLocaleLowerCase()))&&(!(!((R=S.filter)===null||R===void 0)&&R.table)||S.filter.table===((q=r.data)===null||q===void 0?void 0:q.table))}else{const J=(G=(B=S?.filter)===null||B===void 0?void 0:B.event)===null||G===void 0?void 0:G.toLocaleLowerCase();return J==="*"||J===((ee=r?.event)===null||ee===void 0?void 0:ee.toLocaleLowerCase())}else return S.type.toLocaleLowerCase()===h}).map(S=>{if(typeof x=="object"&&"ids"in x){const A=x.data,{schema:j,table:k,commit_timestamp:R,type:q,errors:B}=A;x=Object.assign(Object.assign({},{schema:j,table:k,commit_timestamp:R,eventType:q,new:{},old:{},errors:B}),this._getPayloadRecords(A))}S.callback(x,l)})}_isClosed(){return this.state===ft.closed}_isJoined(){return this.state===ft.joined}_isJoining(){return this.state===ft.joining}_isLeaving(){return this.state===ft.leaving}_replyEventName(a){return`chan_reply_${a}`}_on(a,r,l){const c=a.toLocaleLowerCase(),d={type:c,filter:r,callback:l};return this.bindings[c]?this.bindings[c].push(d):this.bindings[c]=[d],this}_off(a,r){const l=a.toLocaleLowerCase();return this.bindings[l]&&(this.bindings[l]=this.bindings[l].filter(c=>{var d;return!(((d=c.type)===null||d===void 0?void 0:d.toLocaleLowerCase())===l&&jr.isEqual(c.filter,r))})),this}static isEqual(a,r){if(Object.keys(a).length!==Object.keys(r).length)return!1;for(const l in a)if(a[l]!==r[l])return!1;return!0}static isFilterValueEqual(a,r){return(a??void 0)===(r??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(a){this._on(ha.close,{},a)}_onError(a){this._on(ha.error,{},r=>a(r))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(a=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=ft.joining,this.joinPush.resend(a))}_getPayloadRecords(a){const r={new:{},old:{}};return(a.type==="INSERT"||a.type==="UPDATE")&&(r.new=Dg(a.columns,a.record)),(a.type==="UPDATE"||a.type==="DELETE")&&(r.old=Dg(a.columns,a.old_record)),r}}const bd=()=>{},yo={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},T1=[1e3,2e3,5e3,1e4],A1=1e4,C1=`
|
|
17
|
+
addEventListener("message", (e) => {
|
|
18
|
+
if (e.data.event === "start") {
|
|
19
|
+
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
|
|
20
|
+
}
|
|
21
|
+
});`;class k1{constructor(a,r){var l;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=Hd,this.transport=null,this.heartbeatIntervalMs=yo.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=bd,this.ref=0,this.reconnectTimer=null,this.vsn=Rg,this.logger=bd,this.conn=null,this.sendBuffer=[],this.serializer=new x1,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._heartbeatSentAt=null,this._resolveFetch=c=>c?(...d)=>c(...d):(...d)=>fetch(...d),!(!((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,this.endPoint=`${a}/${Vd.websocket}`,this.httpEndpoint=Iy(a),this._initializeOptions(r),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(r?.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=m1.createWebSocket(this.endpointURL())}catch(a){this._setConnectionState("disconnected");const r=a.message;throw r.includes("Node.js")?new Error(`${r}
|
|
22
|
+
|
|
23
|
+
To use Realtime in Node.js, you need to provide a WebSocket implementation:
|
|
24
|
+
|
|
25
|
+
Option 1: Use Node.js 22+ which has native WebSocket support
|
|
26
|
+
Option 2: Install and provide the "ws" package:
|
|
27
|
+
|
|
28
|
+
npm install ws
|
|
29
|
+
|
|
30
|
+
import ws from "ws"
|
|
31
|
+
const client = new RealtimeClient(url, {
|
|
32
|
+
...options,
|
|
33
|
+
transport: ws
|
|
34
|
+
})`):new Error(`WebSocket not available: ${r}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(a,r){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const l=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(l),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(a?this.conn.close(a,r??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(a){const r=await a.unsubscribe();return this.channels.length===0&&this.disconnect(),r}async removeAllChannels(){const a=await Promise.all(this.channels.map(r=>r.unsubscribe()));return this.channels=[],this.disconnect(),a}log(a,r,l){this.logger(a,r,l)}connectionState(){switch(this.conn&&this.conn.readyState){case Rn.connecting:return os.Connecting;case Rn.open:return os.Open;case Rn.closing:return os.Closing;default:return os.Closed}}isConnected(){return this.connectionState()===os.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(a,r={config:{}}){const l=`realtime:${a}`,c=this.getChannels().find(d=>d.topic===l);if(c)return c;{const d=new jr(`realtime:${a}`,r,this);return this.channels.push(d),d}}push(a){const{topic:r,event:l,payload:c,ref:d}=a,h=()=>{this.encode(a,m=>{var p;(p=this.conn)===null||p===void 0||p.send(m)})};this.log("push",`${r} ${l} (${d})`,c),this.isConnected()?h():this.sendBuffer.push(h)}async setAuth(a=null){this._authPromise=this._performAuth(a);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var a;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(r){this.log("error","error in heartbeat callback",r)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this._heartbeatSentAt=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(r){this.log("error","error in heartbeat callback",r)}this._wasManualDisconnect=!1,(a=this.conn)===null||a===void 0||a.close(v1,"heartbeat timeout"),setTimeout(()=>{var r;this.isConnected()||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout()},yo.HEARTBEAT_TIMEOUT_FALLBACK);return}this._heartbeatSentAt=Date.now(),this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(r){this.log("error","error in heartbeat callback",r)}this._setAuthSafely("heartbeat")}onHeartbeat(a){this.heartbeatCallback=a}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(a=>a()),this.sendBuffer=[])}_makeRef(){let a=this.ref+1;return a===this.ref?this.ref=0:this.ref=a,this.ref.toString()}_leaveOpenTopic(a){let r=this.channels.find(l=>l.topic===a&&(l._isJoined()||l._isJoining()));r&&(this.log("transport",`leaving duplicate topic "${a}"`),r.unsubscribe())}_remove(a){this.channels=this.channels.filter(r=>r.topic!==a.topic)}_onConnMessage(a){this.decode(a.data,r=>{if(r.topic==="phoenix"&&r.event==="phx_reply"&&r.ref&&r.ref===this.pendingHeartbeatRef){const g=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(r.payload.status==="ok"?"ok":"error",g)}catch(v){this.log("error","error in heartbeat callback",v)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}const{topic:l,event:c,payload:d,ref:h}=r,m=h?`(${h})`:"",p=d.status||"";this.log("receive",`${p} ${l} ${c} ${m}`.trim(),d),this.channels.filter(g=>g._isMember(l)).forEach(g=>g._trigger(c,d,h)),this._triggerStateCallbacks("message",r)})}_clearTimer(a){var r;a==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):a==="reconnect"&&((r=this.reconnectTimer)===null||r===void 0||r.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=a=>this._onConnError(a),this.conn.onmessage=a=>this._onConnMessage(a),this.conn.onclose=a=>this._onConnClose(a),this.conn.readyState===Rn.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===Rn.open||this.conn.readyState===Rn.connecting)try{this.conn.close()}catch(a){this.log("error","Error closing connection",a)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this._terminateWorker(),this.channels.forEach(a=>a.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.flushSendBuffer()}).catch(r=>{this.log("error","error waiting for auth on connect",r),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const a=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(a),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this._terminateWorker()},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)}_onConnClose(a){var r;this._setConnectionState("disconnected"),this.log("transport","close",a),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout(),this._triggerStateCallbacks("close",a)}_onConnError(a){this._setConnectionState("disconnected"),this.log("transport",`${a}`),this._triggerChanError(),this._triggerStateCallbacks("error",a)}_triggerChanError(){this.channels.forEach(a=>a._trigger(ha.error))}_appendParams(a,r){if(Object.keys(r).length===0)return a;const l=a.match(/\?/)?"&":"?",c=new URLSearchParams(r);return`${a}${l}${c}`}_workerObjectUrl(a){let r;if(a)r=a;else{const l=new Blob([C1],{type:"application/javascript"});r=URL.createObjectURL(l)}return r}_setConnectionState(a,r=!1){this._connectionState=a,a==="connecting"?this._wasManualDisconnect=!1:a==="disconnecting"&&(this._wasManualDisconnect=r)}async _performAuth(a=null){let r,l=!1;if(a)r=a,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:g1};r&&c.updateJoinPayload(d),c.joinedOnce&&c._isJoined()&&c._push(ha.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(a="general"){this._isManualToken()||this.setAuth().catch(r=>{this.log("error",`Error setting auth in ${a}`,r)})}_triggerStateCallbacks(a,r){try{this.stateChangeCallbacks[a].forEach(l=>{try{l(r)}catch(c){this.log("error",`error in ${a} callback`,c)}})}catch(l){this.log("error",`error triggering ${a} callbacks`,l)}}_setupReconnectionTimer(){this.reconnectTimer=new Hy(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},yo.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(a){var r,l,c,d,h,m,p,g,v,_,x,S;switch(this.transport=(r=a?.transport)!==null&&r!==void 0?r:null,this.timeout=(l=a?.timeout)!==null&&l!==void 0?l:Hd,this.heartbeatIntervalMs=(c=a?.heartbeatIntervalMs)!==null&&c!==void 0?c:yo.HEARTBEAT_INTERVAL,this.worker=(d=a?.worker)!==null&&d!==void 0?d:!1,this.accessToken=(h=a?.accessToken)!==null&&h!==void 0?h:null,this.heartbeatCallback=(m=a?.heartbeatCallback)!==null&&m!==void 0?m:bd,this.vsn=(p=a?.vsn)!==null&&p!==void 0?p:Rg,a?.params&&(this.params=a.params),a?.logger&&(this.logger=a.logger),(a?.logLevel||a?.log_level)&&(this.logLevel=a.logLevel||a.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(g=a?.reconnectAfterMs)!==null&&g!==void 0?g:(A=>T1[A-1]||A1),this.vsn){case $y:this.encode=(v=a?.encode)!==null&&v!==void 0?v:((A,j)=>j(JSON.stringify(A))),this.decode=(_=a?.decode)!==null&&_!==void 0?_:((A,j)=>j(JSON.parse(A)));break;case y1:this.encode=(x=a?.encode)!==null&&x!==void 0?x:this.serializer.encode.bind(this.serializer),this.decode=(S=a?.decode)!==null&&S!==void 0?S:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=a?.workerUrl}}}var Hi=class extends Error{constructor(n,a){super(n),this.name="IcebergError",this.status=a.status,this.icebergType=a.icebergType,this.icebergCode=a.icebergCode,this.details=a.details,this.isCommitStateUnknown=a.icebergType==="CommitStateUnknownException"||[500,502,504].includes(a.status)&&a.icebergType?.includes("CommitState")===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function O1(n,a,r){const l=new URL(a,n);if(r)for(const[c,d]of Object.entries(r))d!==void 0&&l.searchParams.set(c,d);return l.toString()}async function R1(n){return!n||n.type==="none"?{}:n.type==="bearer"?{Authorization:`Bearer ${n.token}`}:n.type==="header"?{[n.name]:n.value}:n.type==="custom"?await n.getHeaders():{}}function D1(n){const a=n.fetchImpl??globalThis.fetch;return{async request({method:r,path:l,query:c,body:d,headers:h}){const m=O1(n.baseUrl,l,c),p=await R1(n.auth),g=await a(m,{method:r,headers:{...d?{"Content-Type":"application/json"}:{},...p,...h},body:d?JSON.stringify(d):void 0}),v=await g.text(),_=(g.headers.get("content-type")||"").includes("application/json"),x=_&&v?JSON.parse(v):v;if(!g.ok){const S=_?x:void 0,A=S?.error;throw new Hi(A?.message??`Request failed with status ${g.status}`,{status:g.status,icebergType:A?.type,icebergCode:A?.code,details:S})}return{status:g.status,headers:g.headers,data:x}}}}function vo(n){return n.join("")}var M1=class{constructor(n,a=""){this.client=n,this.prefix=a}async listNamespaces(n){const a=n?{parent:vo(n.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:a})).data.namespaces.map(l=>({namespace:l}))}async createNamespace(n,a){const r={namespace:n.namespace,properties:a?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(n){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${vo(n.namespace)}`})}async loadNamespaceMetadata(n){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${vo(n.namespace)}`})).data.properties}}async namespaceExists(n){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${vo(n.namespace)}`}),!0}catch(a){if(a instanceof Hi&&a.status===404)return!1;throw a}}async createNamespaceIfNotExists(n,a){try{return await this.createNamespace(n,a)}catch(r){if(r instanceof Hi&&r.status===409)return;throw r}}};function ur(n){return n.join("")}var z1=class{constructor(n,a="",r){this.client=n,this.prefix=a,this.accessDelegation=r}async listTables(n){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${ur(n.namespace)}/tables`})).data.identifiers}async createTable(n,a){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${ur(n.namespace)}/tables`,body:a,headers:r})).data.metadata}async updateTable(n,a){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${ur(n.namespace)}/tables/${n.name}`,body:a});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(n,a){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${ur(n.namespace)}/tables/${n.name}`,query:{purgeRequested:String(a?.purge??!1)}})}async loadTable(n){const a={};return this.accessDelegation&&(a["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${ur(n.namespace)}/tables/${n.name}`,headers:a})).data.metadata}async tableExists(n){const a={};this.accessDelegation&&(a["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${ur(n.namespace)}/tables/${n.name}`,headers:a}),!0}catch(r){if(r instanceof Hi&&r.status===404)return!1;throw r}}async createTableIfNotExists(n,a){try{return await this.createTable(n,a)}catch(r){if(r instanceof Hi&&r.status===409)return await this.loadTable({namespace:n.namespace,name:a.name});throw r}}},U1=class{constructor(n){let a="v1";n.catalogName&&(a+=`/${n.catalogName}`);const r=n.baseUrl.endsWith("/")?n.baseUrl:`${n.baseUrl}/`;this.client=D1({baseUrl:r,auth:n.auth,fetchImpl:n.fetch}),this.accessDelegation=n.accessDelegation?.join(","),this.namespaceOps=new M1(this.client,a),this.tableOps=new z1(this.client,a,this.accessDelegation)}async listNamespaces(n){return this.namespaceOps.listNamespaces(n)}async createNamespace(n,a){return this.namespaceOps.createNamespace(n,a)}async dropNamespace(n){await this.namespaceOps.dropNamespace(n)}async loadNamespaceMetadata(n){return this.namespaceOps.loadNamespaceMetadata(n)}async listTables(n){return this.tableOps.listTables(n)}async createTable(n,a){return this.tableOps.createTable(n,a)}async updateTable(n,a){return this.tableOps.updateTable(n,a)}async dropTable(n,a){await this.tableOps.dropTable(n,a)}async loadTable(n){return this.tableOps.loadTable(n)}async namespaceExists(n){return this.namespaceOps.namespaceExists(n)}async tableExists(n){return this.tableOps.tableExists(n)}async createNamespaceIfNotExists(n,a){return this.namespaceOps.createNamespaceIfNotExists(n,a)}async createTableIfNotExists(n,a){return this.tableOps.createTableIfNotExists(n,a)}},$o=class extends Error{constructor(n){super(n),this.__isStorageError=!0,this.name="StorageError"}};function Qe(n){return typeof n=="object"&&n!==null&&"__isStorageError"in n}var L1=class extends $o{constructor(n,a,r){super(n),this.name="StorageApiError",this.status=a,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Gd=class extends $o{constructor(n,a){super(n),this.name="StorageUnknownError",this.originalError=a}};const cf=n=>n?(...a)=>n(...a):(...a)=>fetch(...a),B1=()=>Response,Pd=n=>{if(Array.isArray(n))return n.map(r=>Pd(r));if(typeof n=="function"||n!==Object(n))return n;const a={};return Object.entries(n).forEach(([r,l])=>{const c=r.replace(/([-_][a-z])/gi,d=>d.toUpperCase().replace(/[-_]/g,""));a[c]=Pd(l)}),a},q1=n=>{if(typeof n!="object"||n===null)return!1;const a=Object.getPrototypeOf(n);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},$1=n=>!n||typeof n!="string"||n.length===0||n.length>100||n.trim()!==n||n.includes("/")||n.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(n);function Vi(n){"@babel/helpers - typeof";return Vi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},Vi(n)}function H1(n,a){if(Vi(n)!="object"||!n)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var l=r.call(n,a);if(Vi(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(n)}function V1(n){var a=H1(n,"string");return Vi(a)=="symbol"?a:a+""}function I1(n,a,r){return(a=V1(a))in n?Object.defineProperty(n,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[a]=r,n}function Ug(n,a){var r=Object.keys(n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(n);a&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(n,c).enumerable})),r.push.apply(r,l)}return r}function pe(n){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?Ug(Object(r),!0).forEach(function(l){I1(n,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):Ug(Object(r)).forEach(function(l){Object.defineProperty(n,l,Object.getOwnPropertyDescriptor(r,l))})}return n}const xd=n=>{var a;return n.msg||n.message||n.error_description||(typeof n.error=="string"?n.error:(a=n.error)===null||a===void 0?void 0:a.message)||JSON.stringify(n)},G1=async(n,a,r)=>{n instanceof await B1()&&!r?.noResolveJson?n.json().then(l=>{const c=n.status||500,d=l?.statusCode||c+"";a(new L1(xd(l),c,d))}).catch(l=>{a(new Gd(xd(l),l))}):a(new Gd(xd(n),n))},P1=(n,a,r,l)=>{const c={method:n,headers:a?.headers||{}};return n==="GET"||!l?c:(q1(l)?(c.headers=pe({"Content-Type":"application/json"},a?.headers),c.body=JSON.stringify(l)):c.body=l,a?.duplex&&(c.duplex=a.duplex),pe(pe({},c),r))};async function Wi(n,a,r,l,c,d){return new Promise((h,m)=>{n(r,P1(a,l,c,d)).then(p=>{if(!p.ok)throw p;return l?.noResolveJson?p:p.json()}).then(p=>h(p)).catch(p=>G1(p,m,l))})}async function Ii(n,a,r,l){return Wi(n,"GET",a,r,l)}async function fa(n,a,r,l,c){return Wi(n,"POST",a,l,c,r)}async function Kd(n,a,r,l,c){return Wi(n,"PUT",a,l,c,r)}async function K1(n,a,r,l){return Wi(n,"HEAD",a,pe(pe({},r),{},{noResolveJson:!0}),l)}async function uf(n,a,r,l,c){return Wi(n,"DELETE",a,l,c,r)}var Y1=class{constructor(n,a){this.downloadFn=n,this.shouldThrowOnError=a}then(n,a){return this.execute().then(n,a)}async execute(){var n=this;try{return{data:(await n.downloadFn()).body,error:null}}catch(a){if(n.shouldThrowOnError)throw a;if(Qe(a))return{data:null,error:a};throw a}}};let Gy;Gy=Symbol.toStringTag;var J1=class{constructor(n,a){this.downloadFn=n,this.shouldThrowOnError=a,this[Gy]="BlobDownloadBuilder",this.promise=null}asStream(){return new Y1(this.downloadFn,this.shouldThrowOnError)}then(n,a){return this.getPromise().then(n,a)}catch(n){return this.getPromise().catch(n)}finally(n){return this.getPromise().finally(n)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var n=this;try{return{data:await(await n.downloadFn()).blob(),error:null}}catch(a){if(n.shouldThrowOnError)throw a;if(Qe(a))return{data:null,error:a};throw a}}};const X1={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Lg={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var Q1=class{constructor(n,a={},r,l){this.shouldThrowOnError=!1,this.url=n,this.headers=a,this.bucketId=r,this.fetch=cf(l)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(n,a,r,l){var c=this;try{let d;const h=pe(pe({},Lg),l);let m=pe(pe({},c.headers),n==="POST"&&{"x-upsert":String(h.upsert)});const p=h.metadata;typeof Blob<"u"&&r instanceof Blob?(d=new FormData,d.append("cacheControl",h.cacheControl),p&&d.append("metadata",c.encodeMetadata(p)),d.append("",r)):typeof FormData<"u"&&r instanceof FormData?(d=r,d.has("cacheControl")||d.append("cacheControl",h.cacheControl),p&&!d.has("metadata")&&d.append("metadata",c.encodeMetadata(p))):(d=r,m["cache-control"]=`max-age=${h.cacheControl}`,m["content-type"]=h.contentType,p&&(m["x-metadata"]=c.toBase64(c.encodeMetadata(p))),(typeof ReadableStream<"u"&&d instanceof ReadableStream||d&&typeof d=="object"&&"pipe"in d&&typeof d.pipe=="function")&&!h.duplex&&(h.duplex="half")),l?.headers&&(m=pe(pe({},m),l.headers));const g=c._removeEmptyFolders(a),v=c._getFinalPath(g),_=await(n=="PUT"?Kd:fa)(c.fetch,`${c.url}/object/${v}`,d,pe({headers:m},h?.duplex?{duplex:h.duplex}:{}));return{data:{path:g,id:_.Id,fullPath:_.Key},error:null}}catch(d){if(c.shouldThrowOnError)throw d;if(Qe(d))return{data:null,error:d};throw d}}async upload(n,a,r){return this.uploadOrUpdate("POST",n,a,r)}async uploadToSignedUrl(n,a,r,l){var c=this;const d=c._removeEmptyFolders(n),h=c._getFinalPath(d),m=new URL(c.url+`/object/upload/sign/${h}`);m.searchParams.set("token",a);try{let p;const g=pe({upsert:Lg.upsert},l),v=pe(pe({},c.headers),{"x-upsert":String(g.upsert)});return typeof Blob<"u"&&r instanceof Blob?(p=new FormData,p.append("cacheControl",g.cacheControl),p.append("",r)):typeof FormData<"u"&&r instanceof FormData?(p=r,p.append("cacheControl",g.cacheControl)):(p=r,v["cache-control"]=`max-age=${g.cacheControl}`,v["content-type"]=g.contentType),{data:{path:d,fullPath:(await Kd(c.fetch,m.toString(),p,{headers:v})).Key},error:null}}catch(p){if(c.shouldThrowOnError)throw p;if(Qe(p))return{data:null,error:p};throw p}}async createSignedUploadUrl(n,a){var r=this;try{let l=r._getFinalPath(n);const c=pe({},r.headers);a?.upsert&&(c["x-upsert"]="true");const d=await fa(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 $o("No token returned by API");return{data:{signedUrl:h.toString(),path:n,token:m},error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Qe(l))return{data:null,error:l};throw l}}async update(n,a,r){return this.uploadOrUpdate("PUT",n,a,r)}async move(n,a,r){var l=this;try{return{data:await fa(l.fetch,`${l.url}/object/move`,{bucketId:l.bucketId,sourceKey:n,destinationKey:a,destinationBucket:r?.destinationBucket},{headers:l.headers}),error:null}}catch(c){if(l.shouldThrowOnError)throw c;if(Qe(c))return{data:null,error:c};throw c}}async copy(n,a,r){var l=this;try{return{data:{path:(await fa(l.fetch,`${l.url}/object/copy`,{bucketId:l.bucketId,sourceKey:n,destinationKey:a,destinationBucket:r?.destinationBucket},{headers:l.headers})).Key},error:null}}catch(c){if(l.shouldThrowOnError)throw c;if(Qe(c))return{data:null,error:c};throw c}}async createSignedUrl(n,a,r){var l=this;try{let c=l._getFinalPath(n),d=await fa(l.fetch,`${l.url}/object/sign/${c}`,pe({expiresIn:a},r?.transform?{transform:r.transform}:{}),{headers:l.headers});const h=r?.download?`&download=${r.download===!0?"":r.download}`:"";return d={signedUrl:encodeURI(`${l.url}${d.signedURL}${h}`)},{data:d,error:null}}catch(c){if(l.shouldThrowOnError)throw c;if(Qe(c))return{data:null,error:c};throw c}}async createSignedUrls(n,a,r){var l=this;try{const c=await fa(l.fetch,`${l.url}/object/sign/${l.bucketId}`,{expiresIn:a,paths:n},{headers:l.headers}),d=r?.download?`&download=${r.download===!0?"":r.download}`:"";return{data:c.map(h=>pe(pe({},h),{},{signedUrl:h.signedURL?encodeURI(`${l.url}${h.signedURL}${d}`):null})),error:null}}catch(c){if(l.shouldThrowOnError)throw c;if(Qe(c))return{data:null,error:c};throw c}}download(n,a){const r=typeof a?.transform<"u"?"render/image/authenticated":"object",l=this.transformOptsToQueryString(a?.transform||{}),c=l?`?${l}`:"",d=this._getFinalPath(n),h=()=>Ii(this.fetch,`${this.url}/${r}/${d}${c}`,{headers:this.headers,noResolveJson:!0});return new J1(h,this.shouldThrowOnError)}async info(n){var a=this;const r=a._getFinalPath(n);try{return{data:Pd(await Ii(a.fetch,`${a.url}/object/info/${r}`,{headers:a.headers})),error:null}}catch(l){if(a.shouldThrowOnError)throw l;if(Qe(l))return{data:null,error:l};throw l}}async exists(n){var a=this;const r=a._getFinalPath(n);try{return await K1(a.fetch,`${a.url}/object/${r}`,{headers:a.headers}),{data:!0,error:null}}catch(l){if(a.shouldThrowOnError)throw l;if(Qe(l)&&l instanceof Gd){const c=l.originalError;if([400,404].includes(c?.status))return{data:!1,error:l}}throw l}}getPublicUrl(n,a){const r=this._getFinalPath(n),l=[],c=a?.download?`download=${a.download===!0?"":a.download}`:"";c!==""&&l.push(c);const d=typeof a?.transform<"u"?"render/image":"object",h=this.transformOptsToQueryString(a?.transform||{});h!==""&&l.push(h);let m=l.join("&");return m!==""&&(m=`?${m}`),{data:{publicUrl:encodeURI(`${this.url}/${d}/public/${r}${m}`)}}}async remove(n){var a=this;try{return{data:await uf(a.fetch,`${a.url}/object/${a.bucketId}`,{prefixes:n},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async list(n,a,r){var l=this;try{const c=pe(pe(pe({},X1),a),{},{prefix:n||""});return{data:await fa(l.fetch,`${l.url}/object/list/${l.bucketId}`,c,{headers:l.headers},r),error:null}}catch(c){if(l.shouldThrowOnError)throw c;if(Qe(c))return{data:null,error:c};throw c}}async listV2(n,a){var r=this;try{const l=pe({},n);return{data:await fa(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,l,{headers:r.headers},a),error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Qe(l))return{data:null,error:l};throw l}}encodeMetadata(n){return JSON.stringify(n)}toBase64(n){return typeof Buffer<"u"?Buffer.from(n).toString("base64"):btoa(n)}_getFinalPath(n){return`${this.bucketId}/${n.replace(/^\/+/,"")}`}_removeEmptyFolders(n){return n.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(n){const a=[];return n.width&&a.push(`width=${n.width}`),n.height&&a.push(`height=${n.height}`),n.resize&&a.push(`resize=${n.resize}`),n.format&&a.push(`format=${n.format}`),n.quality&&a.push(`quality=${n.quality}`),a.join("&")}};const Py="2.90.1",Ky={"X-Client-Info":`storage-js/${Py}`};var Z1=class{constructor(n,a={},r,l){this.shouldThrowOnError=!1;const c=new URL(n);l?.useNewHostname&&/supabase\.(co|in|red)$/.test(c.hostname)&&!c.hostname.includes("storage.supabase.")&&(c.hostname=c.hostname.replace("supabase.","storage.supabase.")),this.url=c.href.replace(/\/$/,""),this.headers=pe(pe({},Ky),a),this.fetch=cf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(n){var a=this;try{const r=a.listBucketOptionsToQueryString(n);return{data:await Ii(a.fetch,`${a.url}/bucket${r}`,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async getBucket(n){var a=this;try{return{data:await Ii(a.fetch,`${a.url}/bucket/${n}`,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async createBucket(n,a={public:!1}){var r=this;try{return{data:await fa(r.fetch,`${r.url}/bucket`,{id:n,name:n,type:a.type,public:a.public,file_size_limit:a.fileSizeLimit,allowed_mime_types:a.allowedMimeTypes},{headers:r.headers}),error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Qe(l))return{data:null,error:l};throw l}}async updateBucket(n,a){var r=this;try{return{data:await Kd(r.fetch,`${r.url}/bucket/${n}`,{id:n,name:n,public:a.public,file_size_limit:a.fileSizeLimit,allowed_mime_types:a.allowedMimeTypes},{headers:r.headers}),error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Qe(l))return{data:null,error:l};throw l}}async emptyBucket(n){var a=this;try{return{data:await fa(a.fetch,`${a.url}/bucket/${n}/empty`,{},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async deleteBucket(n){var a=this;try{return{data:await uf(a.fetch,`${a.url}/bucket/${n}`,{},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}listBucketOptionsToQueryString(n){const a={};return n&&("limit"in n&&(a.limit=String(n.limit)),"offset"in n&&(a.offset=String(n.offset)),n.search&&(a.search=n.search),n.sortColumn&&(a.sortColumn=n.sortColumn),n.sortOrder&&(a.sortOrder=n.sortOrder)),Object.keys(a).length>0?"?"+new URLSearchParams(a).toString():""}},F1=class{constructor(n,a={},r){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=pe(pe({},Ky),a),this.fetch=cf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(n){var a=this;try{return{data:await fa(a.fetch,`${a.url}/bucket`,{name:n},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async listBuckets(n){var a=this;try{const r=new URLSearchParams;n?.limit!==void 0&&r.set("limit",n.limit.toString()),n?.offset!==void 0&&r.set("offset",n.offset.toString()),n?.sortColumn&&r.set("sortColumn",n.sortColumn),n?.sortOrder&&r.set("sortOrder",n.sortOrder),n?.search&&r.set("search",n.search);const l=r.toString(),c=l?`${a.url}/bucket?${l}`:`${a.url}/bucket`;return{data:await Ii(a.fetch,c,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async deleteBucket(n){var a=this;try{return{data:await uf(a.fetch,`${a.url}/bucket/${n}`,{},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}from(n){var a=this;if(!$1(n))throw new $o("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 U1({baseUrl:this.url,catalogName:n,auth:{type:"custom",getHeaders:async()=>a.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(p){if(l)throw p;return{data:null,error:p}}}}})}};const df={"X-Client-Info":`storage-js/${Py}`,"Content-Type":"application/json"};var Yy=class extends Error{constructor(n){super(n),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function Xt(n){return typeof n=="object"&&n!==null&&"__isStorageVectorsError"in n}var wd=class extends Yy{constructor(n,a,r){super(n),this.name="StorageVectorsApiError",this.status=a,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},W1=class extends Yy{constructor(n,a){super(n),this.name="StorageVectorsUnknownError",this.originalError=a}};const ff=n=>n?(...a)=>n(...a):(...a)=>fetch(...a),eS=n=>{if(typeof n!="object"||n===null)return!1;const a=Object.getPrototypeOf(n);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},Bg=n=>n.msg||n.message||n.error_description||n.error||JSON.stringify(n),tS=async(n,a,r)=>{if(n&&typeof n=="object"&&"status"in n&&"ok"in n&&typeof n.status=="number"&&!r?.noResolveJson){const l=n.status||500,c=n;if(typeof c.json=="function")c.json().then(d=>{const h=d?.statusCode||d?.code||l+"";a(new wd(Bg(d),l,h))}).catch(()=>{const d=l+"";a(new wd(c.statusText||`HTTP ${l} error`,l,d))});else{const d=l+"";a(new wd(c.statusText||`HTTP ${l} error`,l,d))}}else a(new W1(Bg(n),n))},aS=(n,a,r,l)=>{const c={method:n,headers:a?.headers||{}};return l?(eS(l)?(c.headers=pe({"Content-Type":"application/json"},a?.headers),c.body=JSON.stringify(l)):c.body=l,pe(pe({},c),r)):c};async function nS(n,a,r,l,c,d){return new Promise((h,m)=>{n(r,aS(a,l,c,d)).then(p=>{if(!p.ok)throw p;if(l?.noResolveJson)return p;const g=p.headers.get("content-type");return!g||!g.includes("application/json")?{}:p.json()}).then(p=>h(p)).catch(p=>tS(p,m,l))})}async function Qt(n,a,r,l,c){return nS(n,"POST",a,l,c,r)}var sS=class{constructor(n,a={},r){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=pe(pe({},df),a),this.fetch=ff(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(n){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/CreateIndex`,n,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async getIndex(n,a){var r=this;try{return{data:await Qt(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:n,indexName:a},{headers:r.headers}),error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Xt(l))return{data:null,error:l};throw l}}async listIndexes(n){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/ListIndexes`,n,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async deleteIndex(n,a){var r=this;try{return{data:await Qt(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:n,indexName:a},{headers:r.headers})||{},error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Xt(l))return{data:null,error:l};throw l}}},rS=class{constructor(n,a={},r){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=pe(pe({},df),a),this.fetch=ff(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(n){var a=this;try{if(n.vectors.length<1||n.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:await Qt(a.fetch,`${a.url}/PutVectors`,n,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async getVectors(n){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/GetVectors`,n,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async listVectors(n){var a=this;try{if(n.segmentCount!==void 0){if(n.segmentCount<1||n.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(n.segmentIndex!==void 0&&(n.segmentIndex<0||n.segmentIndex>=n.segmentCount))throw new Error(`segmentIndex must be between 0 and ${n.segmentCount-1}`)}return{data:await Qt(a.fetch,`${a.url}/ListVectors`,n,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async queryVectors(n){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/QueryVectors`,n,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async deleteVectors(n){var a=this;try{if(n.keys.length<1||n.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:await Qt(a.fetch,`${a.url}/DeleteVectors`,n,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}},iS=class{constructor(n,a={},r){this.shouldThrowOnError=!1,this.url=n.replace(/\/$/,""),this.headers=pe(pe({},df),a),this.fetch=ff(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(n){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/CreateVectorBucket`,{vectorBucketName:n},{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async getBucket(n){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/GetVectorBucket`,{vectorBucketName:n},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async listBuckets(n={}){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/ListVectorBuckets`,n,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async deleteBucket(n){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/DeleteVectorBucket`,{vectorBucketName:n},{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}},lS=class extends iS{constructor(n,a={}){super(n,a.headers||{},a.fetch)}from(n){return new oS(this.url,this.headers,n,this.fetch)}async createBucket(n){var a=()=>super.createBucket,r=this;return a().call(r,n)}async getBucket(n){var a=()=>super.getBucket,r=this;return a().call(r,n)}async listBuckets(n={}){var a=()=>super.listBuckets,r=this;return a().call(r,n)}async deleteBucket(n){var a=()=>super.deleteBucket,r=this;return a().call(r,n)}},oS=class extends sS{constructor(n,a,r,l){super(n,a,l),this.vectorBucketName=r}async createIndex(n){var a=()=>super.createIndex,r=this;return a().call(r,pe(pe({},n),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(n={}){var a=()=>super.listIndexes,r=this;return a().call(r,pe(pe({},n),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(n){var a=()=>super.getIndex,r=this;return a().call(r,r.vectorBucketName,n)}async deleteIndex(n){var a=()=>super.deleteIndex,r=this;return a().call(r,r.vectorBucketName,n)}index(n){return new cS(this.url,this.headers,this.vectorBucketName,n,this.fetch)}},cS=class extends rS{constructor(n,a,r,l,c){super(n,a,c),this.vectorBucketName=r,this.indexName=l}async putVectors(n){var a=()=>super.putVectors,r=this;return a().call(r,pe(pe({},n),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(n){var a=()=>super.getVectors,r=this;return a().call(r,pe(pe({},n),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(n={}){var a=()=>super.listVectors,r=this;return a().call(r,pe(pe({},n),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(n){var a=()=>super.queryVectors,r=this;return a().call(r,pe(pe({},n),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(n){var a=()=>super.deleteVectors,r=this;return a().call(r,pe(pe({},n),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},uS=class extends Z1{constructor(n,a={},r,l){super(n,a,r,l)}from(n){return new Q1(this.url,this.headers,n,this.fetch)}get vectors(){return new lS(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new F1(this.url+"/iceberg",this.headers,this.fetch)}};const Jy="2.90.1",xr=30*1e3,Yd=3,_d=Yd*xr,dS="http://localhost:9999",fS="supabase.auth.token",hS={"X-Client-Info":`gotrue-js/${Jy}`},Jd="X-Supabase-Api-Version",Xy={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},mS=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,pS=600*1e3;class Gi extends Error{constructor(a,r,l){super(a),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=l}}function oe(n){return typeof n=="object"&&n!==null&&"__isAuthError"in n}class gS extends Gi{constructor(a,r,l){super(a,r,l),this.name="AuthApiError",this.status=r,this.code=l}}function yS(n){return oe(n)&&n.name==="AuthApiError"}class cs extends Gi{constructor(a,r){super(a),this.name="AuthUnknownError",this.originalError=r}}class en extends Gi{constructor(a,r,l,c){super(a,l,c),this.name=r,this.status=l}}class Jt extends en{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function vS(n){return oe(n)&&n.name==="AuthSessionMissingError"}class dr extends en{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class bo extends en{constructor(a){super(a,"AuthInvalidCredentialsError",400,void 0)}}class xo extends en{constructor(a,r=null){super(a,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function bS(n){return oe(n)&&n.name==="AuthImplicitGrantRedirectError"}class qg extends en{constructor(a,r=null){super(a,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class xS extends en{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 Xd extends en{constructor(a,r){super(a,"AuthRetryableFetchError",r,void 0)}}function Sd(n){return oe(n)&&n.name==="AuthRetryableFetchError"}class $g extends en{constructor(a,r,l){super(a,"AuthWeakPasswordError",r,"weak_password"),this.reasons=l}}class Qd extends en{constructor(a){super(a,"AuthInvalidJwtError",400,"invalid_jwt")}}const zo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Hg=`
|
|
35
|
+
\r=`.split(""),wS=(()=>{const n=new Array(128);for(let a=0;a<n.length;a+=1)n[a]=-1;for(let a=0;a<Hg.length;a+=1)n[Hg[a].charCodeAt(0)]=-2;for(let a=0;a<zo.length;a+=1)n[zo[a].charCodeAt(0)]=a;return n})();function Vg(n,a,r){if(n!==null)for(a.queue=a.queue<<8|n,a.queuedBits+=8;a.queuedBits>=6;){const l=a.queue>>a.queuedBits-6&63;r(zo[l]),a.queuedBits-=6}else if(a.queuedBits>0)for(a.queue=a.queue<<6-a.queuedBits,a.queuedBits=6;a.queuedBits>=6;){const l=a.queue>>a.queuedBits-6&63;r(zo[l]),a.queuedBits-=6}}function Qy(n,a,r){const l=wS[n];if(l>-1)for(a.queue=a.queue<<6|l,a.queuedBits+=6;a.queuedBits>=8;)r(a.queue>>a.queuedBits-8&255),a.queuedBits-=8;else{if(l===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(n)}"`)}}function Ig(n){const a=[],r=h=>{a.push(String.fromCodePoint(h))},l={utf8seq:0,codepoint:0},c={queue:0,queuedBits:0},d=h=>{jS(h,l,r)};for(let h=0;h<n.length;h+=1)Qy(n.charCodeAt(h),c,d);return a.join("")}function _S(n,a){if(n<=127){a(n);return}else if(n<=2047){a(192|n>>6),a(128|n&63);return}else if(n<=65535){a(224|n>>12),a(128|n>>6&63),a(128|n&63);return}else if(n<=1114111){a(240|n>>18),a(128|n>>12&63),a(128|n>>6&63),a(128|n&63);return}throw new Error(`Unrecognized Unicode codepoint: ${n.toString(16)}`)}function SS(n,a){for(let r=0;r<n.length;r+=1){let l=n.charCodeAt(r);if(l>55295&&l<=56319){const c=(l-55296)*1024&65535;l=(n.charCodeAt(r+1)-56320&65535|c)+65536,r+=1}_S(l,a)}}function jS(n,a,r){if(a.utf8seq===0){if(n<=127){r(n);return}for(let l=1;l<6;l+=1)if((n>>7-l&1)===0){a.utf8seq=l;break}if(a.utf8seq===2)a.codepoint=n&31;else if(a.utf8seq===3)a.codepoint=n&15;else if(a.utf8seq===4)a.codepoint=n&7;else throw new Error("Invalid UTF-8 sequence");a.utf8seq-=1}else if(a.utf8seq>0){if(n<=127)throw new Error("Invalid UTF-8 sequence");a.codepoint=a.codepoint<<6|n&63,a.utf8seq-=1,a.utf8seq===0&&r(a.codepoint)}}function Nr(n){const a=[],r={queue:0,queuedBits:0},l=c=>{a.push(c)};for(let c=0;c<n.length;c+=1)Qy(n.charCodeAt(c),r,l);return new Uint8Array(a)}function NS(n){const a=[];return SS(n,r=>a.push(r)),new Uint8Array(a)}function us(n){const a=[],r={queue:0,queuedBits:0},l=c=>{a.push(c)};return n.forEach(c=>Vg(c,r,l)),Vg(null,r,l),a.join("")}function ES(n){return Math.round(Date.now()/1e3)+n}function TS(){return Symbol("auth-callback")}const Nt=()=>typeof window<"u"&&typeof document<"u",rs={tested:!1,writable:!1},Zy=()=>{if(!Nt())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(rs.tested)return rs.writable;const n=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(n,n),globalThis.localStorage.removeItem(n),rs.tested=!0,rs.writable=!0}catch{rs.tested=!0,rs.writable=!1}return rs.writable};function AS(n){const a={},r=new URL(n);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((c,d)=>{a[d]=c})}catch{}return r.searchParams.forEach((l,c)=>{a[c]=l}),a}const Fy=n=>n?(...a)=>n(...a):(...a)=>fetch(...a),CS=n=>typeof n=="object"&&n!==null&&"status"in n&&"ok"in n&&"json"in n&&typeof n.json=="function",wr=async(n,a,r)=>{await n.setItem(a,JSON.stringify(r))},is=async(n,a)=>{const r=await n.getItem(a);if(!r)return null;try{return JSON.parse(r)}catch{return r}},jt=async(n,a)=>{await n.removeItem(a)};class Ho{constructor(){this.promise=new Ho.promiseConstructor((a,r)=>{this.resolve=a,this.reject=r})}}Ho.promiseConstructor=Promise;function jd(n){const a=n.split(".");if(a.length!==3)throw new Qd("Invalid JWT structure");for(let l=0;l<a.length;l++)if(!mS.test(a[l]))throw new Qd("JWT not in base64url format");return{header:JSON.parse(Ig(a[0])),payload:JSON.parse(Ig(a[1])),signature:Nr(a[2]),raw:{header:a[0],payload:a[1]}}}async function kS(n){return await new Promise(a=>{setTimeout(()=>a(null),n)})}function OS(n,a){return new Promise((l,c)=>{(async()=>{for(let d=0;d<1/0;d++)try{const h=await n(d);if(!a(d,null,h)){l(h);return}}catch(h){if(!a(d,h)){c(h);return}}})()})}function RS(n){return("0"+n.toString(16)).substr(-2)}function DS(){const a=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(a),Array.from(a,RS).join("")}async function MS(n){const r=new TextEncoder().encode(n),l=await crypto.subtle.digest("SHA-256",r),c=new Uint8Array(l);return Array.from(c).map(d=>String.fromCharCode(d)).join("")}async function zS(n){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."),n;const r=await MS(n);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function fr(n,a,r=!1){const l=DS();let c=l;r&&(c+="/PASSWORD_RECOVERY"),await wr(n,`${a}-code-verifier`,c);const d=await zS(l);return[d,l===d?"plain":"s256"]}const US=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function LS(n){const a=n.headers.get(Jd);if(!a||!a.match(US))return null;try{return new Date(`${a}T00:00:00.0Z`)}catch{return null}}function BS(n){if(!n)throw new Error("Missing exp claim");const a=Math.floor(Date.now()/1e3);if(n<=a)throw new Error("JWT has expired")}function qS(n){switch(n){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 $S=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function hr(n){if(!$S.test(n))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Nd(){const n={};return new Proxy(n,{get:(a,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:(a,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:(a,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 HS(n,a){return new Proxy(n,{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!a.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."),a.value=!0),Reflect.get(r,l,c)}})}function Gg(n){return JSON.parse(JSON.stringify(n))}const ls=n=>n.msg||n.message||n.error_description||n.error||JSON.stringify(n),VS=[502,503,504];async function Pg(n){var a;if(!CS(n))throw new Xd(ls(n),0);if(VS.includes(n.status))throw new Xd(ls(n),n.status);let r;try{r=await n.json()}catch(d){throw new cs(ls(d),d)}let l;const c=LS(n);if(c&&c.getTime()>=Xy["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 $g(ls(r),n.status,((a=r.weak_password)===null||a===void 0?void 0:a.reasons)||[]);if(l==="session_not_found")throw new Jt}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 $g(ls(r),n.status,r.weak_password.reasons);throw new gS(ls(r),n.status||500,l)}const IS=(n,a,r,l)=>{const c={method:n,headers:a?.headers||{}};return n==="GET"?c:(c.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},a?.headers),c.body=JSON.stringify(l),Object.assign(Object.assign({},c),r))};async function me(n,a,r,l){var c;const d=Object.assign({},l?.headers);d[Jd]||(d[Jd]=Xy["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():"",p=await GS(n,a,r+m,{headers:d,noResolveJson:l?.noResolveJson},{},l?.body);return l?.xform?l?.xform(p):{data:Object.assign({},p),error:null}}async function GS(n,a,r,l,c,d){const h=IS(a,l,c,d);let m;try{m=await n(r,Object.assign({},h))}catch(p){throw console.error(p),new Xd(ls(p),0)}if(m.ok||await Pg(m),l?.noResolveJson)return m;try{return await m.json()}catch(p){await Pg(p)}}function da(n){var a;let r=null;YS(n)&&(r=Object.assign({},n),n.expires_at||(r.expires_at=ES(n.expires_in)));const l=(a=n.user)!==null&&a!==void 0?a:n;return{data:{session:r,user:l},error:null}}function Kg(n){const a=da(n);return!a.error&&n.weak_password&&typeof n.weak_password=="object"&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.message&&typeof n.weak_password.message=="string"&&n.weak_password.reasons.reduce((r,l)=>r&&typeof l=="string",!0)&&(a.data.weak_password=n.weak_password),a}function Dn(n){var a;return{data:{user:(a=n.user)!==null&&a!==void 0?a:n},error:null}}function PS(n){return{data:n,error:null}}function KS(n){const{action_link:a,email_otp:r,hashed_token:l,redirect_to:c,verification_type:d}=n,h=zr(n,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),m={action_link:a,email_otp:r,hashed_token:l,redirect_to:c,verification_type:d},p=Object.assign({},h);return{data:{properties:m,user:p},error:null}}function Yg(n){return n}function YS(n){return n.access_token&&n.refresh_token&&n.expires_in}const Ed=["global","local","others"];class JS{constructor({url:a="",headers:r={},fetch:l}){this.url=a,this.headers=r,this.fetch=Fy(l),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)}}async signOut(a,r=Ed[0]){if(Ed.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Ed.join(", ")}`);try{return await me(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:a,noResolveJson:!0}),{data:null,error:null}}catch(l){if(oe(l))return{data:null,error:l};throw l}}async inviteUserByEmail(a,r={}){try{return await me(this.fetch,"POST",`${this.url}/invite`,{body:{email:a,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:Dn})}catch(l){if(oe(l))return{data:{user:null},error:l};throw l}}async generateLink(a){try{const{options:r}=a,l=zr(a,["options"]),c=Object.assign(Object.assign({},l),r);return"newEmail"in l&&(c.new_email=l?.newEmail,delete c.newEmail),await me(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:c,headers:this.headers,xform:KS,redirectTo:r?.redirectTo})}catch(r){if(oe(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(a){try{return await me(this.fetch,"POST",`${this.url}/admin/users`,{body:a,headers:this.headers,xform:Dn})}catch(r){if(oe(r))return{data:{user:null},error:r};throw r}}async listUsers(a){var r,l,c,d,h,m,p;try{const g={nextPage:null,lastPage:0,total:0},v=await me(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(l=(r=a?.page)===null||r===void 0?void 0:r.toString())!==null&&l!==void 0?l:"",per_page:(d=(c=a?.perPage)===null||c===void 0?void 0:c.toString())!==null&&d!==void 0?d:""},xform:Yg});if(v.error)throw v.error;const _=await v.json(),x=(h=v.headers.get("x-total-count"))!==null&&h!==void 0?h:0,S=(p=(m=v.headers.get("link"))===null||m===void 0?void 0:m.split(","))!==null&&p!==void 0?p:[];return S.length>0&&(S.forEach(A=>{const j=parseInt(A.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(A.split(";")[1].split("=")[1]);g[`${k}Page`]=j}),g.total=parseInt(x)),{data:Object.assign(Object.assign({},_),g),error:null}}catch(g){if(oe(g))return{data:{users:[]},error:g};throw g}}async getUserById(a){hr(a);try{return await me(this.fetch,"GET",`${this.url}/admin/users/${a}`,{headers:this.headers,xform:Dn})}catch(r){if(oe(r))return{data:{user:null},error:r};throw r}}async updateUserById(a,r){hr(a);try{return await me(this.fetch,"PUT",`${this.url}/admin/users/${a}`,{body:r,headers:this.headers,xform:Dn})}catch(l){if(oe(l))return{data:{user:null},error:l};throw l}}async deleteUser(a,r=!1){hr(a);try{return await me(this.fetch,"DELETE",`${this.url}/admin/users/${a}`,{headers:this.headers,body:{should_soft_delete:r},xform:Dn})}catch(l){if(oe(l))return{data:{user:null},error:l};throw l}}async _listFactors(a){hr(a.userId);try{const{data:r,error:l}=await me(this.fetch,"GET",`${this.url}/admin/users/${a.userId}/factors`,{headers:this.headers,xform:c=>({data:{factors:c},error:null})});return{data:r,error:l}}catch(r){if(oe(r))return{data:null,error:r};throw r}}async _deleteFactor(a){hr(a.userId),hr(a.id);try{return{data:await me(this.fetch,"DELETE",`${this.url}/admin/users/${a.userId}/factors/${a.id}`,{headers:this.headers}),error:null}}catch(r){if(oe(r))return{data:null,error:r};throw r}}async _listOAuthClients(a){var r,l,c,d,h,m,p;try{const g={nextPage:null,lastPage:0,total:0},v=await me(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(l=(r=a?.page)===null||r===void 0?void 0:r.toString())!==null&&l!==void 0?l:"",per_page:(d=(c=a?.perPage)===null||c===void 0?void 0:c.toString())!==null&&d!==void 0?d:""},xform:Yg});if(v.error)throw v.error;const _=await v.json(),x=(h=v.headers.get("x-total-count"))!==null&&h!==void 0?h:0,S=(p=(m=v.headers.get("link"))===null||m===void 0?void 0:m.split(","))!==null&&p!==void 0?p:[];return S.length>0&&(S.forEach(A=>{const j=parseInt(A.split(";")[0].split("=")[1].substring(0,1)),k=JSON.parse(A.split(";")[1].split("=")[1]);g[`${k}Page`]=j}),g.total=parseInt(x)),{data:Object.assign(Object.assign({},_),g),error:null}}catch(g){if(oe(g))return{data:{clients:[]},error:g};throw g}}async _createOAuthClient(a){try{return await me(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:a,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(oe(r))return{data:null,error:r};throw r}}async _getOAuthClient(a){try{return await me(this.fetch,"GET",`${this.url}/admin/oauth/clients/${a}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(oe(r))return{data:null,error:r};throw r}}async _updateOAuthClient(a,r){try{return await me(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${a}`,{body:r,headers:this.headers,xform:l=>({data:l,error:null})})}catch(l){if(oe(l))return{data:null,error:l};throw l}}async _deleteOAuthClient(a){try{return await me(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${a}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(oe(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(a){try{return await me(this.fetch,"POST",`${this.url}/admin/oauth/clients/${a}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(oe(r))return{data:null,error:r};throw r}}}function Jg(n={}){return{getItem:a=>n[a]||null,setItem:(a,r)=>{n[a]=r},removeItem:a=>{delete n[a]}}}const mr={debug:!!(globalThis&&Zy()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class Wy extends Error{constructor(a){super(a),this.isAcquireTimeout=!0}}class XS extends Wy{}async function QS(n,a,r){mr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",n,a);const l=new globalThis.AbortController;return a>0&&setTimeout(()=>{l.abort(),mr.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",n)},a),await Promise.resolve().then(()=>globalThis.navigator.locks.request(n,a===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:l.signal},async c=>{if(c){mr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",n,c.name);try{return await r()}finally{mr.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",n,c.name)}}else{if(a===0)throw mr.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",n),new XS(`Acquiring an exclusive Navigator LockManager lock "${n}" immediately failed`);if(mr.debug)try{const d=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(d,null," "))}catch(d){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",d)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await r()}}))}function ZS(){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 ev(n){if(!/^0x[a-fA-F0-9]{40}$/.test(n))throw new Error(`@supabase/auth-js: Address "${n}" is invalid.`);return n.toLowerCase()}function FS(n){return parseInt(n,16)}function WS(n){const a=new TextEncoder().encode(n);return"0x"+Array.from(a,l=>l.toString(16).padStart(2,"0")).join("")}function ej(n){var a;const{chainId:r,domain:l,expirationTime:c,issuedAt:d=new Date,nonce:h,notBefore:m,requestId:p,resources:g,scheme:v,uri:_,version:x}=n;{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(!_)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(x!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${x}`);if(!((a=n.statement)===null||a===void 0)&&a.includes(`
|
|
36
|
+
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${n.statement}`)}const S=ev(n.address),A=v?`${v}://${l}`:l,j=n.statement?`${n.statement}
|
|
37
|
+
`:"",k=`${A} wants you to sign in with your Ethereum account:
|
|
38
|
+
${S}
|
|
39
|
+
|
|
40
|
+
${j}`;let R=`URI: ${_}
|
|
41
|
+
Version: ${x}
|
|
42
|
+
Chain ID: ${r}${h?`
|
|
43
|
+
Nonce: ${h}`:""}
|
|
44
|
+
Issued At: ${d.toISOString()}`;if(c&&(R+=`
|
|
45
|
+
Expiration Time: ${c.toISOString()}`),m&&(R+=`
|
|
46
|
+
Not Before: ${m.toISOString()}`),p&&(R+=`
|
|
47
|
+
Request ID: ${p}`),g){let q=`
|
|
48
|
+
Resources:`;for(const B of g){if(!B||typeof B!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${B}`);q+=`
|
|
49
|
+
- ${B}`}R+=q}return`${k}
|
|
50
|
+
${R}`}class ot extends Error{constructor({message:a,code:r,cause:l,name:c}){var d;super(a,{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}}class Uo extends ot{constructor(a,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:a}),this.name="WebAuthnUnknownError",this.originalError=r}}function tj({error:n,options:a}){var r,l,c;const{publicKey:d}=a;if(!d)throw Error("options was missing required publicKey property");if(n.name==="AbortError"){if(a.signal instanceof AbortSignal)return new ot({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:n})}else if(n.name==="ConstraintError"){if(((r=d.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new ot({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:n});if(a.mediation==="conditional"&&((l=d.authenticatorSelection)===null||l===void 0?void 0:l.userVerification)==="required")return new ot({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:n});if(((c=d.authenticatorSelection)===null||c===void 0?void 0:c.userVerification)==="required")return new ot({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:n})}else{if(n.name==="InvalidStateError")return new ot({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:n});if(n.name==="NotAllowedError")return new ot({message:n.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n});if(n.name==="NotSupportedError")return d.pubKeyCredParams.filter(m=>m.type==="public-key").length===0?new ot({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:n}):new ot({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:n});if(n.name==="SecurityError"){const h=window.location.hostname;if(tv(h)){if(d.rp.id!==h)return new ot({message:`The RP ID "${d.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:n})}else return new ot({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:n})}else if(n.name==="TypeError"){if(d.user.id.byteLength<1||d.user.id.byteLength>64)return new ot({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:n})}else if(n.name==="UnknownError")return new ot({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:n})}return new ot({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n})}function aj({error:n,options:a}){const{publicKey:r}=a;if(!r)throw Error("options was missing required publicKey property");if(n.name==="AbortError"){if(a.signal instanceof AbortSignal)return new ot({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:n})}else{if(n.name==="NotAllowedError")return new ot({message:n.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n});if(n.name==="SecurityError"){const l=window.location.hostname;if(tv(l)){if(r.rpId!==l)return new ot({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:n})}else return new ot({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:n})}else if(n.name==="UnknownError")return new ot({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:n})}return new ot({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n})}class nj{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const a=new AbortController;return this.controller=a,a.signal}cancelCeremony(){if(this.controller){const a=new Error("Manually cancelling existing WebAuthn API call");a.name="AbortError",this.controller.abort(a),this.controller=void 0}}}const sj=new nj;function rj(n){if(!n)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(n);const{challenge:a,user:r,excludeCredentials:l}=n,c=zr(n,["challenge","user","excludeCredentials"]),d=Nr(a).buffer,h=Object.assign(Object.assign({},r),{id:Nr(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 p=0;p<l.length;p++){const g=l[p];m.excludeCredentials[p]=Object.assign(Object.assign({},g),{id:Nr(g.id).buffer,type:g.type||"public-key",transports:g.transports})}}return m}function ij(n){if(!n)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(n);const{challenge:a,allowCredentials:r}=n,l=zr(n,["challenge","allowCredentials"]),c=Nr(a).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:Nr(m.id).buffer,type:m.type||"public-key",transports:m.transports})}}return d}function lj(n){var a;if("toJSON"in n&&typeof n.toJSON=="function")return n.toJSON();const r=n;return{id:n.id,rawId:n.id,response:{attestationObject:us(new Uint8Array(n.response.attestationObject)),clientDataJSON:us(new Uint8Array(n.response.clientDataJSON))},type:"public-key",clientExtensionResults:n.getClientExtensionResults(),authenticatorAttachment:(a=r.authenticatorAttachment)!==null&&a!==void 0?a:void 0}}function oj(n){var a;if("toJSON"in n&&typeof n.toJSON=="function")return n.toJSON();const r=n,l=n.getClientExtensionResults(),c=n.response;return{id:n.id,rawId:n.id,response:{authenticatorData:us(new Uint8Array(c.authenticatorData)),clientDataJSON:us(new Uint8Array(c.clientDataJSON)),signature:us(new Uint8Array(c.signature)),userHandle:c.userHandle?us(new Uint8Array(c.userHandle)):void 0},type:"public-key",clientExtensionResults:l,authenticatorAttachment:(a=r.authenticatorAttachment)!==null&&a!==void 0?a:void 0}}function tv(n){return n==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(n)}function Xg(){var n,a;return!!(Nt()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((n=navigator?.credentials)===null||n===void 0?void 0:n.create)=="function"&&typeof((a=navigator?.credentials)===null||a===void 0?void 0:a.get)=="function")}async function cj(n){try{const a=await navigator.credentials.create(n);return a?a instanceof PublicKeyCredential?{data:a,error:null}:{data:null,error:new Uo("Browser returned unexpected credential type",a)}:{data:null,error:new Uo("Empty credential response",a)}}catch(a){return{data:null,error:tj({error:a,options:n})}}}async function uj(n){try{const a=await navigator.credentials.get(n);return a?a instanceof PublicKeyCredential?{data:a,error:null}:{data:null,error:new Uo("Browser returned unexpected credential type",a)}:{data:null,error:new Uo("Empty credential response",a)}}catch(a){return{data:null,error:aj({error:a,options:n})}}}const dj={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},fj={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Lo(...n){const a=c=>c!==null&&typeof c=="object"&&!Array.isArray(c),r=c=>c instanceof ArrayBuffer||ArrayBuffer.isView(c),l={};for(const c of n)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(a(h)){const m=l[d];a(m)?l[d]=Lo(m,h):l[d]=Lo(h)}else l[d]=h}return l}function hj(n,a){return Lo(dj,n,a||{})}function mj(n,a){return Lo(fj,n,a||{})}class pj{constructor(a){this.client=a,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(a){return this.client.mfa.enroll(Object.assign(Object.assign({},a),{factorType:"webauthn"}))}async _challenge({factorId:a,webauthn:r,friendlyName:l,signal:c},d){try{const{data:h,error:m}=await this.client.mfa.challenge({factorId:a,webauthn:r});if(!h)return{data:null,error:m};const p=c??sj.createNewAbortSignal();if(h.webauthn.type==="create"){const{user:g}=h.webauthn.credential_options.publicKey;g.name||(g.name=`${g.id}:${l}`),g.displayName||(g.displayName=g.name)}switch(h.webauthn.type){case"create":{const g=hj(h.webauthn.credential_options.publicKey,d?.create),{data:v,error:_}=await cj({publicKey:g,signal:p});return v?{data:{factorId:a,challengeId:h.id,webauthn:{type:h.webauthn.type,credential_response:v}},error:null}:{data:null,error:_}}case"request":{const g=mj(h.webauthn.credential_options.publicKey,d?.request),{data:v,error:_}=await uj(Object.assign(Object.assign({},h.webauthn.credential_options),{publicKey:g,signal:p}));return v?{data:{factorId:a,challengeId:h.id,webauthn:{type:h.webauthn.type,credential_response:v}},error:null}:{data:null,error:_}}}}catch(h){return oe(h)?{data:null,error:h}:{data:null,error:new cs("Unexpected error in challenge",h)}}}async _verify({challengeId:a,factorId:r,webauthn:l}){return this.client.mfa.verify({factorId:r,challengeId:a,webauthn:l})}async _authenticate({factorId:a,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 Gi("rpId is required for WebAuthn authentication")};try{if(!Xg())return{data:null,error:new cs("Browser does not support WebAuthn",null)};const{data:h,error:m}=await this.challenge({factorId:a,webauthn:{rpId:r,rpOrigins:l},signal:c},{request:d});if(!h)return{data:null,error:m};const{webauthn:p}=h;return this._verify({factorId:a,challengeId:h.challengeId,webauthn:{type:p.type,rpId:r,rpOrigins:l,credential_response:p.credential_response}})}catch(h){return oe(h)?{data:null,error:h}:{data:null,error:new cs("Unexpected error in authenticate",h)}}}async _register({friendlyName:a,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 Gi("rpId is required for WebAuthn registration")};try{if(!Xg())return{data:null,error:new cs("Browser does not support WebAuthn",null)};const{data:h,error:m}=await this._enroll({friendlyName:a});if(!h)return await this.client.mfa.listFactors().then(v=>{var _;return(_=v.data)===null||_===void 0?void 0:_.all.find(x=>x.factor_type==="webauthn"&&x.friendly_name===a&&x.status!=="unverified")}).then(v=>v?this.client.mfa.unenroll({factorId:v?.id}):void 0),{data:null,error:m};const{data:p,error:g}=await this._challenge({factorId:h.id,friendlyName:h.friendly_name,webauthn:{rpId:r,rpOrigins:l},signal:c},{create:d});return p?this._verify({factorId:h.id,challengeId:p.challengeId,webauthn:{rpId:r,rpOrigins:l,type:p.webauthn.type,credential_response:p.webauthn.credential_response}}):{data:null,error:g}}catch(h){return oe(h)?{data:null,error:h}:{data:null,error:new cs("Unexpected error in register",h)}}}}ZS();const gj={url:dS,storageKey:fS,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:hS,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4};async function Qg(n,a,r){return await r()}const pr={};class Pi{get jwks(){var a,r;return(r=(a=pr[this.storageKey])===null||a===void 0?void 0:a.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(a){pr[this.storageKey]=Object.assign(Object.assign({},pr[this.storageKey]),{jwks:a})}get jwks_cached_at(){var a,r;return(r=(a=pr[this.storageKey])===null||a===void 0?void 0:a.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(a){pr[this.storageKey]=Object.assign(Object.assign({},pr[this.storageKey]),{cachedAt:a})}constructor(a){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.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const d=Object.assign(Object.assign({},gj),a);if(this.storageKey=d.storageKey,this.instanceID=(r=Pi.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Pi.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.admin=new JS({url:d.url,headers:d.headers,fetch:d.fetch}),this.url=d.url,this.headers=d.headers,this.fetch=Fy(d.fetch),this.lock=d.lock||Qg,this.detectSessionInUrl=d.detectSessionInUrl,this.flowType=d.flowType,this.hasCustomAuthorizationHeader=d.hasCustomAuthorizationHeader,this.throwOnError=d.throwOnError,this.lockAcquireTimeout=d.lockAcquireTimeout,d.lock?this.lock=d.lock:this.persistSession&&Nt()&&(!((l=globalThis?.navigator)===null||l===void 0)&&l.locks)?this.lock=QS:this.lock=Qg,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 pj(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.persistSession?(d.storage?this.storage=d.storage:Zy()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Jg(this.memoryStorage)),d.userStorage&&(this.userStorage=d.userStorage)):(this.memoryStorage={},this.storage=Jg(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),await this._notifyAllSubscribers(h.data.event,h.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(a){if(this.throwOnError&&a&&a.error)throw a.error;return a}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Jy}) ${new Date().toISOString()}`}_debug(...a){return this.logDebugMessages&&this.logger(this._logPrefix(),...a),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var a;try{let r={},l="none";if(Nt()&&(r=AS(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),bS(d)){const p=(a=d.details)===null||a===void 0?void 0:a.code;if(p==="identity_already_exists"||p==="identity_not_found"||p==="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 oe(r)?this._returnResult({error:r}):this._returnResult({error:new cs("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(a){var r,l,c;try{const d=await me(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(l=(r=a?.options)===null||r===void 0?void 0:r.data)!==null&&l!==void 0?l:{},gotrue_meta_security:{captcha_token:(c=a?.options)===null||c===void 0?void 0:c.captchaToken}},xform:da}),{data:h,error:m}=d;if(m||!h)return this._returnResult({data:{user:null,session:null},error:m});const p=h.session,g=h.user;return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",p)),this._returnResult({data:{user:g,session:p},error:null})}catch(d){if(oe(d))return this._returnResult({data:{user:null,session:null},error:d});throw d}}async signUp(a){var r,l,c;try{let d;if("email"in a){const{email:v,password:_,options:x}=a;let S=null,A=null;this.flowType==="pkce"&&([S,A]=await fr(this.storage,this.storageKey)),d=await me(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:x?.emailRedirectTo,body:{email:v,password:_,data:(r=x?.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:x?.captchaToken},code_challenge:S,code_challenge_method:A},xform:da})}else if("phone"in a){const{phone:v,password:_,options:x}=a;d=await me(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:v,password:_,data:(l=x?.data)!==null&&l!==void 0?l:{},channel:(c=x?.channel)!==null&&c!==void 0?c:"sms",gotrue_meta_security:{captcha_token:x?.captchaToken}},xform:da})}else throw new bo("You must provide either an email or phone number and a password");const{data:h,error:m}=d;if(m||!h)return await jt(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:m});const p=h.session,g=h.user;return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",p)),this._returnResult({data:{user:g,session:p},error:null})}catch(d){if(await jt(this.storage,`${this.storageKey}-code-verifier`),oe(d))return this._returnResult({data:{user:null,session:null},error:d});throw d}}async signInWithPassword(a){try{let r;if("email"in a){const{email:d,password:h,options:m}=a;r=await me(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:Kg})}else if("phone"in a){const{phone:d,password:h,options:m}=a;r=await me(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:Kg})}else throw new bo("You must provide either an email or phone number and a password");const{data:l,error:c}=r;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l||!l.session||!l.user){const d=new dr;return this._returnResult({data:{user:null,session:null},error:d})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:Object.assign({user:l.user,session:l.session},l.weak_password?{weakPassword:l.weak_password}:null),error:c})}catch(r){if(oe(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(a){var r,l,c,d;return await this._handleProviderSignIn(a.provider,{redirectTo:(r=a.options)===null||r===void 0?void 0:r.redirectTo,scopes:(l=a.options)===null||l===void 0?void 0:l.scopes,queryParams:(c=a.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:(d=a.options)===null||d===void 0?void 0:d.skipBrowserRedirect})}async exchangeCodeForSession(a){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(a))}async signInWithWeb3(a){const{chain:r}=a;switch(r){case"ethereum":return await this.signInWithEthereum(a);case"solana":return await this.signInWithSolana(a);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(a){var r,l,c,d,h,m,p,g,v,_,x;let S,A;if("message"in a)S=a.message,A=a.signature;else{const{chain:j,wallet:k,statement:R,options:q}=a;let B;if(Nt())if(typeof k=="object")B=k;else{const ue=window;if("ethereum"in ue&&typeof ue.ethereum=="object"&&"request"in ue.ethereum&&typeof ue.ethereum.request=="function")B=ue.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 k!="object"||!q?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");B=k}const G=new URL((r=q?.url)!==null&&r!==void 0?r:window.location.href),ee=await B.request({method:"eth_requestAccounts"}).then(ue=>ue).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!ee||ee.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const J=ev(ee[0]);let P=(l=q?.signInWithEthereum)===null||l===void 0?void 0:l.chainId;if(!P){const ue=await B.request({method:"eth_chainId"});P=FS(ue)}const X={domain:G.host,address:J,statement:R,uri:G.href,version:"1",chainId:P,nonce:(c=q?.signInWithEthereum)===null||c===void 0?void 0:c.nonce,issuedAt:(h=(d=q?.signInWithEthereum)===null||d===void 0?void 0:d.issuedAt)!==null&&h!==void 0?h:new Date,expirationTime:(m=q?.signInWithEthereum)===null||m===void 0?void 0:m.expirationTime,notBefore:(p=q?.signInWithEthereum)===null||p===void 0?void 0:p.notBefore,requestId:(g=q?.signInWithEthereum)===null||g===void 0?void 0:g.requestId,resources:(v=q?.signInWithEthereum)===null||v===void 0?void 0:v.resources};S=ej(X),A=await B.request({method:"personal_sign",params:[WS(S),J]})}try{const{data:j,error:k}=await me(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:S,signature:A},!((_=a.options)===null||_===void 0)&&_.captchaToken?{gotrue_meta_security:{captcha_token:(x=a.options)===null||x===void 0?void 0:x.captchaToken}}:null),xform:da});if(k)throw k;if(!j||!j.session||!j.user){const R=new dr;return this._returnResult({data:{user:null,session:null},error:R})}return j.session&&(await this._saveSession(j.session),await this._notifyAllSubscribers("SIGNED_IN",j.session)),this._returnResult({data:Object.assign({},j),error:k})}catch(j){if(oe(j))return this._returnResult({data:{user:null,session:null},error:j});throw j}}async signInWithSolana(a){var r,l,c,d,h,m,p,g,v,_,x,S;let A,j;if("message"in a)A=a.message,j=a.signature;else{const{chain:k,wallet:R,statement:q,options:B}=a;let G;if(Nt())if(typeof R=="object")G=R;else{const J=window;if("solana"in J&&typeof J.solana=="object"&&("signIn"in J.solana&&typeof J.solana.signIn=="function"||"signMessage"in J.solana&&typeof J.solana.signMessage=="function"))G=J.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 R!="object"||!B?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");G=R}const ee=new URL((r=B?.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in G&&G.signIn){const J=await G.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},B?.signInWithSolana),{version:"1",domain:ee.host,uri:ee.href}),q?{statement:q}:null));let P;if(Array.isArray(J)&&J[0]&&typeof J[0]=="object")P=J[0];else if(J&&typeof J=="object"&&"signedMessage"in J&&"signature"in J)P=J;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in P&&"signature"in P&&(typeof P.signedMessage=="string"||P.signedMessage instanceof Uint8Array)&&P.signature instanceof Uint8Array)A=typeof P.signedMessage=="string"?P.signedMessage:new TextDecoder().decode(P.signedMessage),j=P.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in G)||typeof G.signMessage!="function"||!("publicKey"in G)||typeof G!="object"||!G.publicKey||!("toBase58"in G.publicKey)||typeof G.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");A=[`${ee.host} wants you to sign in with your Solana account:`,G.publicKey.toBase58(),...q?["",q,""]:[""],"Version: 1",`URI: ${ee.href}`,`Issued At: ${(c=(l=B?.signInWithSolana)===null||l===void 0?void 0:l.issuedAt)!==null&&c!==void 0?c:new Date().toISOString()}`,...!((d=B?.signInWithSolana)===null||d===void 0)&&d.notBefore?[`Not Before: ${B.signInWithSolana.notBefore}`]:[],...!((h=B?.signInWithSolana)===null||h===void 0)&&h.expirationTime?[`Expiration Time: ${B.signInWithSolana.expirationTime}`]:[],...!((m=B?.signInWithSolana)===null||m===void 0)&&m.chainId?[`Chain ID: ${B.signInWithSolana.chainId}`]:[],...!((p=B?.signInWithSolana)===null||p===void 0)&&p.nonce?[`Nonce: ${B.signInWithSolana.nonce}`]:[],...!((g=B?.signInWithSolana)===null||g===void 0)&&g.requestId?[`Request ID: ${B.signInWithSolana.requestId}`]:[],...!((_=(v=B?.signInWithSolana)===null||v===void 0?void 0:v.resources)===null||_===void 0)&&_.length?["Resources",...B.signInWithSolana.resources.map(P=>`- ${P}`)]:[]].join(`
|
|
51
|
+
`);const J=await G.signMessage(new TextEncoder().encode(A),"utf8");if(!J||!(J instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");j=J}}try{const{data:k,error:R}=await me(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:A,signature:us(j)},!((x=a.options)===null||x===void 0)&&x.captchaToken?{gotrue_meta_security:{captcha_token:(S=a.options)===null||S===void 0?void 0:S.captchaToken}}:null),xform:da});if(R)throw R;if(!k||!k.session||!k.user){const q=new dr;return this._returnResult({data:{user:null,session:null},error:q})}return k.session&&(await this._saveSession(k.session),await this._notifyAllSubscribers("SIGNED_IN",k.session)),this._returnResult({data:Object.assign({},k),error:R})}catch(k){if(oe(k))return this._returnResult({data:{user:null,session:null},error:k});throw k}}async _exchangeCodeForSession(a){const r=await is(this.storage,`${this.storageKey}-code-verifier`),[l,c]=(r??"").split("/");try{if(!l&&this.flowType==="pkce")throw new xS;const{data:d,error:h}=await me(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:a,code_verifier:l},xform:da});if(await jt(this.storage,`${this.storageKey}-code-verifier`),h)throw h;if(!d||!d.session||!d.user){const m=new dr;return this._returnResult({data:{user:null,session:null,redirectType:null},error:m})}return d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("SIGNED_IN",d.session)),this._returnResult({data:Object.assign(Object.assign({},d),{redirectType:c??null}),error:h})}catch(d){if(await jt(this.storage,`${this.storageKey}-code-verifier`),oe(d))return this._returnResult({data:{user:null,session:null,redirectType:null},error:d});throw d}}async signInWithIdToken(a){try{const{options:r,provider:l,token:c,access_token:d,nonce:h}=a,m=await me(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:da}),{data:p,error:g}=m;if(g)return this._returnResult({data:{user:null,session:null},error:g});if(!p||!p.session||!p.user){const v=new dr;return this._returnResult({data:{user:null,session:null},error:v})}return p.session&&(await this._saveSession(p.session),await this._notifyAllSubscribers("SIGNED_IN",p.session)),this._returnResult({data:p,error:g})}catch(r){if(oe(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(a){var r,l,c,d,h;try{if("email"in a){const{email:m,options:p}=a;let g=null,v=null;this.flowType==="pkce"&&([g,v]=await fr(this.storage,this.storageKey));const{error:_}=await me(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:m,data:(r=p?.data)!==null&&r!==void 0?r:{},create_user:(l=p?.shouldCreateUser)!==null&&l!==void 0?l:!0,gotrue_meta_security:{captcha_token:p?.captchaToken},code_challenge:g,code_challenge_method:v},redirectTo:p?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:_})}if("phone"in a){const{phone:m,options:p}=a,{data:g,error:v}=await me(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:m,data:(c=p?.data)!==null&&c!==void 0?c:{},create_user:(d=p?.shouldCreateUser)!==null&&d!==void 0?d:!0,gotrue_meta_security:{captcha_token:p?.captchaToken},channel:(h=p?.channel)!==null&&h!==void 0?h:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:g?.message_id},error:v})}throw new bo("You must provide either an email or phone number.")}catch(m){if(await jt(this.storage,`${this.storageKey}-code-verifier`),oe(m))return this._returnResult({data:{user:null,session:null},error:m});throw m}}async verifyOtp(a){var r,l;try{let c,d;"options"in a&&(c=(r=a.options)===null||r===void 0?void 0:r.redirectTo,d=(l=a.options)===null||l===void 0?void 0:l.captchaToken);const{data:h,error:m}=await me(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},a),{gotrue_meta_security:{captcha_token:d}}),redirectTo:c,xform:da});if(m)throw m;if(!h)throw new Error("An error occurred on token verification.");const p=h.session,g=h.user;return p?.access_token&&(await this._saveSession(p),await this._notifyAllSubscribers(a.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",p)),this._returnResult({data:{user:g,session:p},error:null})}catch(c){if(oe(c))return this._returnResult({data:{user:null,session:null},error:c});throw c}}async signInWithSSO(a){var r,l,c,d,h;try{let m=null,p=null;this.flowType==="pkce"&&([m,p]=await fr(this.storage,this.storageKey));const g=await me(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in a?{provider_id:a.providerId}:null),"domain"in a?{domain:a.domain}:null),{redirect_to:(l=(r=a.options)===null||r===void 0?void 0:r.redirectTo)!==null&&l!==void 0?l:void 0}),!((c=a?.options)===null||c===void 0)&&c.captchaToken?{gotrue_meta_security:{captcha_token:a.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:m,code_challenge_method:p}),headers:this.headers,xform:PS});return!((d=g.data)===null||d===void 0)&&d.url&&Nt()&&!(!((h=a.options)===null||h===void 0)&&h.skipBrowserRedirect)&&window.location.assign(g.data.url),this._returnResult(g)}catch(m){if(await jt(this.storage,`${this.storageKey}-code-verifier`),oe(m))return this._returnResult({data:null,error:m});throw m}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async a=>{const{data:{session:r},error:l}=a;if(l)throw l;if(!r)throw new Jt;const{error:c}=await me(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:c})})}catch(a){if(oe(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async resend(a){try{const r=`${this.url}/resend`;if("email"in a){const{email:l,type:c,options:d}=a,{error:h}=await me(this.fetch,"POST",r,{headers:this.headers,body:{email:l,type:c,gotrue_meta_security:{captcha_token:d?.captchaToken}},redirectTo:d?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}else if("phone"in a){const{phone:l,type:c,options:d}=a,{data:h,error:m}=await me(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 bo("You must provide either an email or phone number and a type")}catch(r){if(oe(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async r=>r))}async _acquireLock(a,r){this._debug("#_acquireLock","begin",a);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}`,a,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(a){this._debug("#_useSession","begin");try{const r=await this.__loadSession();return await a(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let a=null;const r=await is(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?a=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!a)return{data:{session:null},error:null};const l=a.expires_at?a.expires_at*1e3-Date.now()<_d:!1;if(this._debug("#__loadSession()",`session has${l?"":" not"} expired`,"expires_at",a.expires_at),!l){if(this.userStorage){const h=await is(this.userStorage,this.storageKey+"-user");h?.user?a.user=h.user:a.user=Nd()}if(this.storage.isServer&&a.user&&!a.user.__isUserNotAvailableProxy){const h={value:this.suppressGetSessionWarning};a.user=HS(a.user,h),h.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:a},error:null}}const{data:c,error:d}=await this._callRefreshToken(a.refresh_token);return d?this._returnResult({data:{session:null},error:d}):this._returnResult({data:{session:c},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(a){if(a)return await this._getUser(a);await this.initializePromise;const r=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return r.data.user&&(this.suppressGetSessionWarning=!0),r}async _getUser(a){try{return a?await me(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:a,xform:Dn}):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 Jt}:await me(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:Dn})})}catch(r){if(oe(r))return vS(r)&&(await this._removeSession(),await jt(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(a,r={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(a,r))}async _updateUser(a,r={}){try{return await this._useSession(async l=>{const{data:c,error:d}=l;if(d)throw d;if(!c.session)throw new Jt;const h=c.session;let m=null,p=null;this.flowType==="pkce"&&a.email!=null&&([m,p]=await fr(this.storage,this.storageKey));const{data:g,error:v}=await me(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r?.emailRedirectTo,body:Object.assign(Object.assign({},a),{code_challenge:m,code_challenge_method:p}),jwt:h.access_token,xform:Dn});if(v)throw v;return h.user=g.user,await this._saveSession(h),await this._notifyAllSubscribers("USER_UPDATED",h),this._returnResult({data:{user:h.user},error:null})})}catch(l){if(await jt(this.storage,`${this.storageKey}-code-verifier`),oe(l))return this._returnResult({data:{user:null},error:l});throw l}}async setSession(a){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(a))}async _setSession(a){try{if(!a.access_token||!a.refresh_token)throw new Jt;const r=Date.now()/1e3;let l=r,c=!0,d=null;const{payload:h}=jd(a.access_token);if(h.exp&&(l=h.exp,c=l<=r),c){const{data:m,error:p}=await this._callRefreshToken(a.refresh_token);if(p)return this._returnResult({data:{user:null,session:null},error:p});if(!m)return{data:{user:null,session:null},error:null};d=m}else{const{data:m,error:p}=await this._getUser(a.access_token);if(p)throw p;d={access_token:a.access_token,refresh_token:a.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(oe(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(a){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(a))}async _refreshSession(a){try{return await this._useSession(async r=>{var l;if(!a){const{data:h,error:m}=r;if(m)throw m;a=(l=h.session)!==null&&l!==void 0?l:void 0}if(!a?.refresh_token)throw new Jt;const{data:c,error:d}=await this._callRefreshToken(a.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(oe(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(a,r){try{if(!Nt())throw new xo("No browser detected.");if(a.error||a.error_description||a.error_code)throw new xo(a.error_description||"Error in URL with unspecified error_description",{error:a.error||"unspecified_error",code:a.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new qg("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new xo("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!a.code)throw new qg("No code detected.");const{data:q,error:B}=await this._exchangeCodeForSession(a.code);if(B)throw B;const G=new URL(window.location.href);return G.searchParams.delete("code"),window.history.replaceState(window.history.state,"",G.toString()),{data:{session:q.session,redirectType:null},error:null}}const{provider_token:l,provider_refresh_token:c,access_token:d,refresh_token:h,expires_in:m,expires_at:p,token_type:g}=a;if(!d||!m||!h||!g)throw new xo("No session defined in URL");const v=Math.round(Date.now()/1e3),_=parseInt(m);let x=v+_;p&&(x=parseInt(p));const S=x-v;S*1e3<=xr&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${S}s, should have been closer to ${_}s`);const A=x-_;v-A>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",A,x,v):v-A<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",A,x,v);const{data:j,error:k}=await this._getUser(d);if(k)throw k;const R={provider_token:l,provider_refresh_token:c,access_token:d,expires_in:_,expires_at:x,refresh_token:h,token_type:g,user:j.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:R,redirectType:a.type},error:null})}catch(l){if(oe(l))return this._returnResult({data:{session:null,redirectType:null},error:l});throw l}}_isImplicitGrantCallback(a){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),a):!!(a.access_token||a.error_description)}async _isPKCECallback(a){const r=await is(this.storage,`${this.storageKey}-code-verifier`);return!!(a.code&&r)}async signOut(a={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(a))}async _signOut({scope:a}={scope:"global"}){return await this._useSession(async r=>{var l;const{data:c,error:d}=r;if(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,a);if(m&&!(yS(m)&&(m.status===404||m.status===401||m.status===403)))return this._returnResult({error:m})}return a!=="others"&&(await this._removeSession(),await jt(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(a){const r=TS(),l={id:r,callback:a,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,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:l}}}async _emitInitialSession(a){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(a))===null||l===void 0?void 0:l.callback("INITIAL_SESSION",d)),this._debug("INITIAL_SESSION","callback id",a,"session",d)}catch(d){await((c=this.stateChangeEmitters.get(a))===null||c===void 0?void 0:c.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",a,"error",d),console.error(d)}})}async resetPasswordForEmail(a,r={}){let l=null,c=null;this.flowType==="pkce"&&([l,c]=await fr(this.storage,this.storageKey,!0));try{return await me(this.fetch,"POST",`${this.url}/recover`,{body:{email:a,code_challenge:l,code_challenge_method:c,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(d){if(await jt(this.storage,`${this.storageKey}-code-verifier`),oe(d))return this._returnResult({data:null,error:d});throw d}}async getUserIdentities(){var a;try{const{data:r,error:l}=await this.getUser();if(l)throw l;return this._returnResult({data:{identities:(a=r.user.identities)!==null&&a!==void 0?a:[]},error:null})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(a){return"token"in a?this.linkIdentityIdToken(a):this.linkIdentityOAuth(a)}async linkIdentityOAuth(a){var r;try{const{data:l,error:c}=await this._useSession(async d=>{var h,m,p,g,v;const{data:_,error:x}=d;if(x)throw x;const S=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,a.provider,{redirectTo:(h=a.options)===null||h===void 0?void 0:h.redirectTo,scopes:(m=a.options)===null||m===void 0?void 0:m.scopes,queryParams:(p=a.options)===null||p===void 0?void 0:p.queryParams,skipBrowserRedirect:!0});return await me(this.fetch,"GET",S,{headers:this.headers,jwt:(v=(g=_.session)===null||g===void 0?void 0:g.access_token)!==null&&v!==void 0?v:void 0})});if(c)throw c;return Nt()&&!(!((r=a.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(l?.url),this._returnResult({data:{provider:a.provider,url:l?.url},error:null})}catch(l){if(oe(l))return this._returnResult({data:{provider:a.provider,url:null},error:l});throw l}}async linkIdentityIdToken(a){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:p,access_token:g,nonce:v}=a,_=await me(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:p,access_token:g,nonce:v,link_identity:!0,gotrue_meta_security:{captcha_token:h?.captchaToken}},xform:da}),{data:x,error:S}=_;return S?this._returnResult({data:{user:null,session:null},error:S}):!x||!x.session||!x.user?this._returnResult({data:{user:null,session:null},error:new dr}):(x.session&&(await this._saveSession(x.session),await this._notifyAllSubscribers("USER_UPDATED",x.session)),this._returnResult({data:x,error:S}))}catch(c){if(await jt(this.storage,`${this.storageKey}-code-verifier`),oe(c))return this._returnResult({data:{user:null,session:null},error:c});throw c}})}async unlinkIdentity(a){try{return await this._useSession(async r=>{var l,c;const{data:d,error:h}=r;if(h)throw h;return await me(this.fetch,"DELETE",`${this.url}/user/identities/${a.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(oe(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(a){const r=`#_refreshAccessToken(${a.substring(0,5)}...)`;this._debug(r,"begin");try{const l=Date.now();return await OS(async c=>(c>0&&await kS(200*Math.pow(2,c-1)),this._debug(r,"refreshing attempt",c),await me(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:a},headers:this.headers,xform:da})),(c,d)=>{const h=200*Math.pow(2,c);return d&&Sd(d)&&Date.now()+h-l<xr})}catch(l){if(this._debug(r,"error",l),oe(l))return this._returnResult({data:{session:null,user:null},error:l});throw l}finally{this._debug(r,"end")}}_isValidSession(a){return typeof a=="object"&&a!==null&&"access_token"in a&&"refresh_token"in a&&"expires_at"in a}async _handleProviderSignIn(a,r){const l=await this._getUrlForProvider(`${this.url}/authorize`,a,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",a,"options",r,"url",l),Nt()&&!r.skipBrowserRedirect&&window.location.assign(l),{data:{provider:a,url:l},error:null}}async _recoverAndRefresh(){var a,r;const l="#_recoverAndRefresh()";this._debug(l,"begin");try{const c=await is(this.storage,this.storageKey);if(c&&this.userStorage){let h=await is(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!h&&(h={user:c.user},await wr(this.userStorage,this.storageKey+"-user",h)),c.user=(a=h?.user)!==null&&a!==void 0?a:Nd()}else if(c&&!c.user&&!c.user){const h=await is(this.storage,this.storageKey+"-user");h&&h?.user?(c.user=h.user,await jt(this.storage,this.storageKey+"-user"),await wr(this.storage,this.storageKey,c)):c.user=Nd()}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()<_d;if(this._debug(l,`session has${d?"":" not"} expired with margin of ${_d}s`),d){if(this.autoRefreshToken&&c.refresh_token){const{error:h}=await this._callRefreshToken(c.refresh_token);h&&(console.error(h),Sd(h)||(this._debug(l,"refresh failed with a non-retryable error, removing the session",h),await this._removeSession()))}}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(a){var r,l;if(!a)throw new Jt;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const c=`#_callRefreshToken(${a.substring(0,5)}...)`;this._debug(c,"begin");try{this.refreshingDeferred=new Ho;const{data:d,error:h}=await this._refreshAccessToken(a);if(h)throw h;if(!d.session)throw new Jt;await this._saveSession(d.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",d.session);const m={data:d.session,error:null};return this.refreshingDeferred.resolve(m),m}catch(d){if(this._debug(c,"error",d),oe(d)){const h={data:null,error:d};return Sd(d)||await this._removeSession(),(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(a,r,l=!0){const c=`#_notifyAllSubscribers(${a})`;this._debug(c,"begin",r,`broadcast = ${l}`);try{this.broadcastChannel&&l&&this.broadcastChannel.postMessage({event:a,session:r});const d=[],h=Array.from(this.stateChangeEmitters.values()).map(async m=>{try{await m.callback(a,r)}catch(p){d.push(p)}});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(a){this._debug("#_saveSession()",a),this.suppressGetSessionWarning=!0,await jt(this.storage,`${this.storageKey}-code-verifier`);const r=Object.assign({},a),l=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!l&&r.user&&await wr(this.userStorage,this.storageKey+"-user",{user:r.user});const c=Object.assign({},r);delete c.user;const d=Gg(c);await wr(this.storage,this.storageKey,d)}else{const c=Gg(r);await wr(this.storage,this.storageKey,c)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await jt(this.storage,this.storageKey),await jt(this.storage,this.storageKey+"-code-verifier"),await jt(this.storage,this.storageKey+"-user"),this.userStorage&&await jt(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const a=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{a&&Nt()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",a)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const a=setInterval(()=>this._autoRefreshTokenTick(),xr);this.autoRefreshTicker=a,a&&typeof a=="object"&&typeof a.unref=="function"?a.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(a);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 a=this.autoRefreshTicker;this.autoRefreshTicker=null,a&&clearInterval(a);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 _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const a=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-a)/xr);this._debug("#_autoRefreshTokenTick()",`access token expires in ${c} ticks, a tick lasts ${xr}ms, refresh threshold is ${Yd} ticks`),c<=Yd&&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(a){if(a.isAcquireTimeout||a instanceof Wy)this._debug("auto refresh token tick lock not available");else throw a}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Nt()||!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(a){console.error("_handleVisibilityChange",a)}}async _onVisibilityChanged(a){const r=`#_onVisibilityChanged(${a})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),a||(await this.initializePromise,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()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(a,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 fr(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}`),`${a}?${c.join("&")}`}async _unenroll(a){try{return await this._useSession(async r=>{var l;const{data:c,error:d}=r;return d?this._returnResult({data:null,error:d}):await me(this.fetch,"DELETE",`${this.url}/factors/${a.factorId}`,{headers:this.headers,jwt:(l=c?.session)===null||l===void 0?void 0:l.access_token})})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(a){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:a.friendlyName,factor_type:a.factorType},a.factorType==="phone"?{phone:a.phone}:a.factorType==="totp"?{issuer:a.issuer}:{}),{data:p,error:g}=await me(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 g?this._returnResult({data:null,error:g}):(a.factorType==="totp"&&p.type==="totp"&&(!((c=p?.totp)===null||c===void 0)&&c.qr_code)&&(p.totp.qr_code=`data:image/svg+xml;utf-8,${p.totp.qr_code}`),this._returnResult({data:p,error:null}))})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}}async _verify(a){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var l;const{data:c,error:d}=r;if(d)return this._returnResult({data:null,error:d});const h=Object.assign({challenge_id:a.challengeId},"webauthn"in a?{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_response:a.webauthn.type==="create"?lj(a.webauthn.credential_response):oj(a.webauthn.credential_response)})}:{code:a.code}),{data:m,error:p}=await me(this.fetch,"POST",`${this.url}/factors/${a.factorId}/verify`,{body:h,headers:this.headers,jwt:(l=c?.session)===null||l===void 0?void 0:l.access_token});return p?this._returnResult({data:null,error:p}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+m.expires_in},m)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",m),this._returnResult({data:m,error:p}))})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(a){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var l;const{data:c,error:d}=r;if(d)return this._returnResult({data:null,error:d});const h=await me(this.fetch,"POST",`${this.url}/factors/${a.factorId}/challenge`,{body:a,headers:this.headers,jwt:(l=c?.session)===null||l===void 0?void 0:l.access_token});if(h.error)return h;const{data:m}=h;if(m.type!=="webauthn")return{data:m,error:null};switch(m.webauthn.type){case"create":return{data:Object.assign(Object.assign({},m),{webauthn:Object.assign(Object.assign({},m.webauthn),{credential_options:Object.assign(Object.assign({},m.webauthn.credential_options),{publicKey:rj(m.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},m),{webauthn:Object.assign(Object.assign({},m.webauthn),{credential_options:Object.assign(Object.assign({},m.webauthn.credential_options),{publicKey:ij(m.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}})}async _challengeAndVerify(a){const{data:r,error:l}=await this._challenge({factorId:a.factorId});return l?this._returnResult({data:null,error:l}):await this._verify({factorId:a.factorId,challengeId:r.id,code:a.code})}async _listFactors(){var a;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(a=r?.factors)!==null&&a!==void 0?a:[])c.all.push(d),d.status==="verified"&&c[d.factor_type].push(d);return{data:c,error:null}}async _getAuthenticatorAssuranceLevel(){var a,r;const{data:{session:l},error:c}=await this.getSession();if(c)return this._returnResult({data:null,error:c});if(!l)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:d}=jd(l.access_token);let h=null;d.aal&&(h=d.aal);let m=h;((r=(a=l.user.factors)===null||a===void 0?void 0:a.filter(v=>v.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(m="aal2");const g=d.amr||[];return{data:{currentLevel:h,nextLevel:m,currentAuthenticationMethods:g},error:null}}async _getAuthorizationDetails(a){try{return await this._useSession(async r=>{const{data:{session:l},error:c}=r;return c?this._returnResult({data:null,error:c}):l?await me(this.fetch,"GET",`${this.url}/oauth/authorizations/${a}`,{headers:this.headers,jwt:l.access_token,xform:d=>({data:d,error:null})}):this._returnResult({data:null,error:new Jt})})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(a,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 Jt});const h=await me(this.fetch,"POST",`${this.url}/oauth/authorizations/${a}/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(oe(l))return this._returnResult({data:null,error:l});throw l}}async _denyAuthorization(a,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 Jt});const h=await me(this.fetch,"POST",`${this.url}/oauth/authorizations/${a}/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(oe(l))return this._returnResult({data:null,error:l});throw l}}async _listOAuthGrants(){try{return await this._useSession(async a=>{const{data:{session:r},error:l}=a;return l?this._returnResult({data:null,error:l}):r?await me(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 Jt})})}catch(a){if(oe(a))return this._returnResult({data:null,error:a});throw a}}async _revokeOAuthGrant(a){try{return await this._useSession(async r=>{const{data:{session:l},error:c}=r;return c?this._returnResult({data:null,error:c}):l?(await me(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:l.access_token,query:{client_id:a.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Jt})})}catch(r){if(oe(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(a,r={keys:[]}){let l=r.keys.find(m=>m.kid===a);if(l)return l;const c=Date.now();if(l=this.jwks.keys.find(m=>m.kid===a),l&&this.jwks_cached_at+pS>c)return l;const{data:d,error:h}=await me(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===a),!l)?null:l}async getClaims(a,r={}){try{let l=a;if(!l){const{data:S,error:A}=await this.getSession();if(A||!S.session)return this._returnResult({data:null,error:A});l=S.session.access_token}const{header:c,payload:d,signature:h,raw:{header:m,payload:p}}=jd(l);r?.allowExpired||BS(d.exp);const g=!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(!g){const{error:S}=await this.getUser(l);if(S)throw S;return{data:{claims:d,header:c,signature:h},error:null}}const v=qS(c.alg),_=await crypto.subtle.importKey("jwk",g,v,!0,["verify"]);if(!await crypto.subtle.verify(v,_,h,NS(`${m}.${p}`)))throw new Qd("Invalid JWT signature");return{data:{claims:d,header:c,signature:h},error:null}}catch(l){if(oe(l))return this._returnResult({data:null,error:l});throw l}}}Pi.nextInstanceID={};const yj=Pi,vj="2.90.1";let Mi="";typeof Deno<"u"?Mi="deno":typeof document<"u"?Mi="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Mi="react-native":Mi="node";const bj={"X-Client-Info":`supabase-js-${Mi}/${vj}`},xj={headers:bj},wj={schema:"public"},_j={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Sj={};function Ki(n){"@babel/helpers - typeof";return Ki=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},Ki(n)}function jj(n,a){if(Ki(n)!="object"||!n)return n;var r=n[Symbol.toPrimitive];if(r!==void 0){var l=r.call(n,a);if(Ki(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(n)}function Nj(n){var a=jj(n,"string");return Ki(a)=="symbol"?a:a+""}function Ej(n,a,r){return(a=Nj(a))in n?Object.defineProperty(n,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[a]=r,n}function Zg(n,a){var r=Object.keys(n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(n);a&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(n,c).enumerable})),r.push.apply(r,l)}return r}function et(n){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?Zg(Object(r),!0).forEach(function(l){Ej(n,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(r)):Zg(Object(r)).forEach(function(l){Object.defineProperty(n,l,Object.getOwnPropertyDescriptor(r,l))})}return n}const Tj=n=>n?(...a)=>n(...a):(...a)=>fetch(...a),Aj=()=>Headers,Cj=(n,a,r)=>{const l=Tj(r),c=Aj();return async(d,h)=>{var m;const p=(m=await a())!==null&&m!==void 0?m:n;let g=new c(h?.headers);return g.has("apikey")||g.set("apikey",n),g.has("Authorization")||g.set("Authorization",`Bearer ${p}`),l(d,et(et({},h),{},{headers:g}))}};function kj(n){return n.endsWith("/")?n:n+"/"}function Oj(n,a){var r,l;const{db:c,auth:d,realtime:h,global:m}=n,{db:p,auth:g,realtime:v,global:_}=a,x={db:et(et({},p),c),auth:et(et({},g),d),realtime:et(et({},v),h),storage:{},global:et(et(et({},_),m),{},{headers:et(et({},(r=_?.headers)!==null&&r!==void 0?r:{}),(l=m?.headers)!==null&&l!==void 0?l:{})}),accessToken:async()=>""};return n.accessToken?x.accessToken=n.accessToken:delete x.accessToken,x}function Rj(n){const a=n?.trim();if(!a)throw new Error("supabaseUrl is required.");if(!a.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(kj(a))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var Dj=class extends yj{constructor(n){super(n)}},Mj=class{constructor(n,a,r){var l,c;this.supabaseUrl=n,this.supabaseKey=a;const d=Rj(n);if(!a)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:wj,realtime:Sj,auth:et(et({},_j),{},{storageKey:h}),global:xj},p=Oj(r??{},m);if(this.storageKey=(l=p.auth.storageKey)!==null&&l!==void 0?l:"",this.headers=(c=p.global.headers)!==null&&c!==void 0?c:{},p.accessToken)this.accessToken=p.accessToken,this.auth=new Proxy({},{get:(v,_)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(_)} is not possible`)}});else{var g;this.auth=this._initSupabaseAuthClient((g=p.auth)!==null&&g!==void 0?g:{},this.headers,p.global.fetch)}this.fetch=Cj(a,this._getAccessToken.bind(this),p.global.fetch),this.realtime=this._initRealtimeClient(et({headers:this.headers,accessToken:this._getAccessToken.bind(this)},p.realtime)),this.accessToken&&this.accessToken().then(v=>this.realtime.setAuth(v)).catch(v=>console.warn("Failed to set initial Realtime auth token:",v)),this.rest=new h1(new URL("rest/v1",d).href,{headers:this.headers,schema:p.db.schema,fetch:this.fetch}),this.storage=new uS(this.storageUrl.href,this.headers,this.fetch,r?.storage),p.accessToken||this._listenForAuthEvents()}get functions(){return new o1(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(n){return this.rest.from(n)}schema(n){return this.rest.schema(n)}rpc(n,a={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(n,a,r)}channel(n,a={config:{}}){return this.realtime.channel(n,a)}getChannels(){return this.realtime.getChannels()}removeChannel(n){return this.realtime.removeChannel(n)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var n=this,a,r;if(n.accessToken)return await n.accessToken();const{data:l}=await n.auth.getSession();return(a=(r=l.session)===null||r===void 0?void 0:r.access_token)!==null&&a!==void 0?a:n.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:n,persistSession:a,detectSessionInUrl:r,storage:l,userStorage:c,storageKey:d,flowType:h,lock:m,debug:p,throwOnError:g},v,_){const x={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Dj({url:this.authUrl.href,headers:et(et({},x),v),storageKey:d,autoRefreshToken:n,persistSession:a,detectSessionInUrl:r,storage:l,userStorage:c,flowType:h,lock:m,debug:p,throwOnError:g,fetch:_,hasCustomAuthorizationHeader:Object.keys(this.headers).some(S=>S.toLowerCase()==="authorization")})}_initRealtimeClient(n){return new k1(this.realtimeUrl.href,et(et({},n),{},{params:et(et({},{apikey:this.supabaseKey}),n?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((n,a)=>{this._handleTokenChanged(n,"CLIENT",a?.access_token)})}_handleTokenChanged(n,a,r){(n==="TOKEN_REFRESHED"||n==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):n==="SIGNED_OUT"&&(this.realtime.setAuth(),a=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const Fg=(n,a,r)=>new Mj(n,a,r);function zj(){if(typeof window<"u")return!1;const n=globalThis.process;if(!n)return!1;const a=n.version;if(a==null)return!1;const r=a.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=18:!1}zj()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const Vo="email_automator_supabase_config";function Ur(){try{const n=localStorage.getItem(Vo);if(n)return JSON.parse(n)}catch(n){console.error("Error reading Supabase config:",n)}return null}function Uj(n){try{localStorage.setItem(Vo,JSON.stringify(n))}catch(a){console.error("Error saving Supabase config:",a)}}function Lj(){try{localStorage.removeItem(Vo)}catch(n){console.error("Error clearing Supabase config:",n)}}async function av(n,a){try{if(!n.startsWith("http://")&&!n.startsWith("https://"))return{valid:!1,error:"Invalid URL format"};const r=a.startsWith("eyJ"),l=a.startsWith("sb_publishable_");if(!r&&!l)return{valid:!1,error:"Invalid API key format (must be anon or publishable key)"};if(l)return{valid:!0};const c=await fetch(`${n}/rest/v1/`,{method:"GET",headers:{apikey:a,Authorization:`Bearer ${a}`}});return c.ok?{valid:!0}:c.status===401||c.status===403?{valid:!1,error:"Invalid API key"}:{valid:!1,error:`Connection failed: ${c.statusText}`}}catch(r){return{valid:!1,error:r instanceof Error?r.message:"Connection failed"}}}function Bj(){return localStorage.getItem(Vo)?"ui":"none"}function qj(){const n=Ur();return!n||!n.url?.startsWith("http")?(console.info("[Supabase] Setup required: Waiting for configuration..."),Fg("https://placeholder.supabase.co","placeholder-key")):Fg(n.url,n.anonKey,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}})}const ct=qj();function Wg(){const n=Ur(),a=n?`${n.url}/functions/v1`:"",r=n?n.anonKey:"",l=window.location.port==="5173";let c="";return l?c="http://localhost:3004":c=window.location.origin,{edgeFunctionsUrl:a,expressApiUrl:c,anonKey:r}}class $j{edgeFunctionsUrl;expressApiUrl;anonKey;token=null;supabaseClient=null;constructor(){const a=Wg();this.edgeFunctionsUrl=a.edgeFunctionsUrl,this.expressApiUrl=a.expressApiUrl,this.anonKey=a.anonKey}setSupabaseClient(a){this.supabaseClient=a}setToken(a){console.debug(a?"[HybridApiClient] Token updated":"[HybridApiClient] Token cleared"),this.token=a}async request(a,r,l={}){const{auth:c=!0,...d}=l,h={"Content-Type":"application/json",...l.headers||{}};if(c&&!this.token&&this.supabaseClient){const{data:{session:m}}=await this.supabaseClient.auth.getSession();m?.access_token&&(this.token=m.access_token,console.debug("[HybridApiClient] Recovered token from session"))}if(c&&!this.token)return console.warn(`[HybridApiClient] Attempted protected request to ${r} without token`),{error:{code:"AUTH_REQUIRED",message:"You must be logged in to perform this action"}};c&&this.token&&(h.Authorization=`Bearer ${this.token}`);try{console.debug(`[HybridApiClient] ${l.method||"GET"} ${a}${r}`);const m=await fetch(`${a}${r}`,{...d,headers:h});if(!m.ok){const g=await m.json().catch(()=>({})),v=typeof g.error=="string"?g.error:g.error?.message||`Request failed: ${m.status}`;return{error:{code:g.error?.code||"API_ERROR",message:v}}}return{data:await m.json()}}catch(m){return{error:{code:"NETWORK_ERROR",message:m instanceof Error?m.message:"Network error"}}}}edgeRequest(a,r){const l={...r?.headers||{},apikey:this.anonKey};return this.request(this.edgeFunctionsUrl,a,{...r,headers:l})}expressRequest(a,r){const l=Wg(),c={...r?.headers||{},"X-Supabase-Url":l.edgeFunctionsUrl.replace("/functions/v1",""),"X-Supabase-Anon-Key":l.anonKey};return this.request(this.expressApiUrl,a,{...r,headers:c})}async getGmailAuthUrl(){return this.edgeRequest("/auth-gmail?action=url",{method:"GET"})}async connectGmail(a){return this.edgeRequest("/auth-gmail",{method:"POST",body:JSON.stringify({code:a})})}async startMicrosoftDeviceFlow(){return this.edgeRequest("/auth-microsoft?action=device-flow",{method:"POST"})}async pollMicrosoftDeviceCode(a){return this.edgeRequest("/auth-microsoft?action=poll",{method:"POST",body:JSON.stringify({deviceCode:a})})}async getAccounts(){return this.edgeRequest("/api-v1-accounts")}async disconnectAccount(a){return this.edgeRequest(`/api-v1-accounts/${a}`,{method:"DELETE"})}async updateAccount(a,r){return this.edgeRequest(`/api-v1-accounts/${a}`,{method:"PATCH",body:JSON.stringify(r)})}async getEmails(a={}){const r=new URLSearchParams;return a.limit&&r.set("limit",a.limit.toString()),a.offset&&r.set("offset",a.offset.toString()),a.category&&r.set("category",a.category),a.search&&r.set("search",a.search),a.sort_by&&r.set("sort_by",a.sort_by),a.sort_order&&r.set("sort_order",a.sort_order),this.edgeRequest(`/api-v1-emails?${r}`)}async getEmail(a){return this.edgeRequest(`/api-v1-emails/${a}`)}async getEmailEvents(a){return this.edgeRequest(`/api-v1-emails/${a}/events`)}async deleteEmail(a){return this.edgeRequest(`/api-v1-emails/${a}`,{method:"DELETE"})}async getCategorySummary(){return this.edgeRequest("/api-v1-emails/summary/categories")}async getRules(){return this.expressRequest("/api/rules")}async createRule(a){return this.expressRequest("/api/rules",{method:"POST",body:JSON.stringify(a)})}async updateRule(a,r){return this.expressRequest(`/api/rules/${a}`,{method:"PATCH",body:JSON.stringify(r)})}async deleteRule(a){return this.expressRequest(`/api/rules/${a}`,{method:"DELETE"})}async toggleRule(a){return this.expressRequest(`/api/rules/${a}/toggle`,{method:"POST"})}async getSettings(){return this.edgeRequest("/api-v1-settings")}async getRunEvents(a){return this.edgeRequest(`/api-v1-settings/logs/${a}/events`)}async updateSettings(a){return this.edgeRequest("/api-v1-settings",{method:"PATCH",body:JSON.stringify(a)})}async getStats(){return this.edgeRequest("/api-v1-settings/stats")}async testLlm(a){return this.expressRequest("/api/settings/test-llm",{method:"POST",body:JSON.stringify(a)})}async triggerSync(a){return this.expressRequest("/api/sync",{method:"POST",body:JSON.stringify({accountId:a})})}async syncAll(){return this.expressRequest("/api/sync/all",{method:"POST"})}async getSyncLogs(a=10){return this.expressRequest(`/api/sync/logs?limit=${a}`)}async executeAction(a,r,l){return this.expressRequest("/api/actions/execute",{method:"POST",body:JSON.stringify({emailId:a,action:r,draftContent:l})})}async generateDraft(a,r){return this.expressRequest(`/api/actions/draft/${a}`,{method:"POST",body:JSON.stringify({instructions:r})})}async bulkAction(a,r){return this.expressRequest("/api/actions/bulk",{method:"POST",body:JSON.stringify({emailIds:a,action:r})})}async healthCheck(){return this.expressRequest("/api/health",{auth:!1})}async getProfile(){if(!this.supabaseClient)return{error:"Supabase client not initialized"};const{data:{user:a}}=await this.supabaseClient.auth.getUser();if(!a)return{error:"Not authenticated"};const{data:r,error:l}=await this.supabaseClient.from("profiles").select("*").eq("id",a.id).single();return{data:r,error:l}}async updateProfile(a){if(!this.supabaseClient)return{error:"Supabase client not initialized"};const{data:{user:r}}=await this.supabaseClient.auth.getUser();if(!r)return{error:"Not authenticated"};const{data:l,error:c}=await this.supabaseClient.from("profiles").update({...a,updated_at:new Date().toISOString()}).eq("id",r.id).select().single();return{data:l,error:c}}async changePassword(a){if(!this.supabaseClient)return{error:"Supabase client not initialized"};const{error:r}=await this.supabaseClient.auth.updateUser({password:a});return{success:!r,error:r}}}const qe=new $j;async function nv(n){qe.setSupabaseClient(n);const{data:{session:a}}=await n.auth.getSession();a?.access_token&&qe.setToken(a.access_token),n.auth.onAuthStateChange((r,l)=>{qe.setToken(l?.access_token||null)})}const Hj=Object.freeze(Object.defineProperty({__proto__:null,api:qe,initializeApi:nv},Symbol.toStringTag,{value:"Module"}));function Vj({userId:n,onInsert:a,onUpdate:r,onDelete:l,enabled:c=!0}){const d=w.useRef(null);return w.useEffect(()=>{if(!c||!n)return;const h=ct.channel("emails-realtime").on("postgres_changes",{event:"INSERT",schema:"public",table:"emails"},m=>{a?.(m.new)}).on("postgres_changes",{event:"UPDATE",schema:"public",table:"emails"},m=>{r?.(m.new)}).on("postgres_changes",{event:"DELETE",schema:"public",table:"emails"},m=>{l?.(m.old.id)}).subscribe();return d.current=h,()=>{d.current&&ct.removeChannel(d.current)}},[n,c,a,r,l]),{isSubscribed:!!d.current}}class Ij{ctx=null;enabled=!1;constructor(){this.enabled=localStorage.getItem("ea_sounds_enabled")==="true"}setEnabled(a){this.enabled=a,localStorage.setItem("ea_sounds_enabled",a?"true":"none")}isEnabled(){return this.enabled}initCtx(){return this.ctx||(this.ctx=new(window.AudioContext||window.webkitAudioContext)),this.ctx.state==="suspended"&&this.ctx.resume(),this.ctx}haptic(a=10){typeof navigator<"u"&&navigator.vibrate&&navigator.vibrate(a)}playNotify(){if(!this.enabled)return;const a=this.initCtx(),r=a.createOscillator(),l=a.createGain();r.type="sine",r.frequency.setValueAtTime(880,a.currentTime),r.frequency.exponentialRampToValueAtTime(440,a.currentTime+.1),l.gain.setValueAtTime(0,a.currentTime),l.gain.linearRampToValueAtTime(.1,a.currentTime+.01),l.gain.exponentialRampToValueAtTime(.001,a.currentTime+.3),r.connect(l),l.connect(a.destination),r.start(),r.stop(a.currentTime+.3),this.haptic(10)}playAlert(){if(!this.enabled)return;const a=this.initCtx(),r=(l,c)=>{const d=a.createOscillator(),h=a.createGain();d.type="sine",d.frequency.setValueAtTime(l,a.currentTime+c),h.gain.setValueAtTime(0,a.currentTime+c),h.gain.linearRampToValueAtTime(.1,a.currentTime+c+.05),h.gain.exponentialRampToValueAtTime(.001,a.currentTime+c+.4),d.connect(h),h.connect(a.destination),d.start(a.currentTime+c),d.stop(a.currentTime+c+.4)};r(660,0),r(880,.1),this.haptic([20,50,20])}playSuccess(){if(!this.enabled)return;const a=this.initCtx(),r=a.createOscillator(),l=a.createGain();r.type="triangle",r.frequency.setValueAtTime(523.25,a.currentTime),r.frequency.exponentialRampToValueAtTime(1046.5,a.currentTime+.1),l.gain.setValueAtTime(0,a.currentTime),l.gain.linearRampToValueAtTime(.05,a.currentTime+.02),l.gain.exponentialRampToValueAtTime(.001,a.currentTime+.2),r.connect(l),l.connect(a.destination),r.start(),r.stop(a.currentTime+.2),this.haptic(15)}}const Er=new Ij;let Yi=[],Zd=new Set;function sv(){Zd.forEach(n=>n())}const re={success:(n,a)=>wo("success",n,a),error:(n,a)=>wo("error",n,a),info:(n,a)=>wo("info",n,a),warning:(n,a)=>wo("warning",n,a)};function wo(n,a,r=5e3){const l=Math.random().toString(36).substr(2,9);Yi=[...Yi,{id:l,type:n,message:a,duration:r}],sv(),r>0&&setTimeout(()=>rv(l),r)}function rv(n){Yi=Yi.filter(a=>a.id!==n),sv()}function Gj(){const[,n]=w.useState(0);return w.useEffect(()=>{const a=()=>n(r=>r+1);return Zd.add(a),()=>{Zd.delete(a)}},[]),Yi}const Pj={success:nf,error:Rr,info:Cr,warning:Or},Kj={success:"bg-emerald-500/10 border-emerald-500/20 text-emerald-600 dark:text-emerald-400",error:"bg-destructive/10 border-destructive/20 text-destructive",info:"bg-blue-500/10 border-blue-500/20 text-blue-600 dark:text-blue-400",warning:"bg-yellow-500/10 border-yellow-500/20 text-yellow-600 dark:text-yellow-400"};function Yj({toast:n}){const a=Pj[n.type];return o.jsxs("div",{className:ke("flex items-start gap-3 p-4 rounded-lg border shadow-lg backdrop-blur-sm","animate-in slide-in-from-right-full duration-300",Kj[n.type]),children:[o.jsx(a,{className:"w-5 h-5 flex-shrink-0 mt-0.5"}),o.jsx("p",{className:"text-sm flex-1",children:n.message}),o.jsx("button",{onClick:()=>rv(n.id),className:"p-1 hover:bg-black/10 rounded transition-colors",children:o.jsx(Fi,{className:"w-4 h-4"})})]})}function Jj(){const n=Gj();return n.length===0?null:o.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2 max-w-sm w-full",children:n.map(a=>o.jsx(Yj,{toast:a},a.id))})}function _a(n,a){return n?typeof n=="string"?n:n.message||a:a}const iv={user:null,isAuthenticated:!1,profile:null,emails:[],accounts:[],rules:[],settings:null,stats:null,isLoading:!0,isInitialized:!1,error:null,selectedEmailId:null,emailsTotal:0,emailsOffset:0,sortBy:"date",sortOrder:"desc"};function Xj(n,a){switch(a.type){case"SET_USER":return{...n,user:a.payload,isAuthenticated:!!a.payload,isLoading:!1};case"SET_LOADING":return{...n,isLoading:a.payload};case"SET_INITIALIZED":return{...n,isInitialized:a.payload};case"SET_ERROR":return{...n,error:a.payload,isLoading:!1};case"SET_EMAILS":return{...n,emails:a.payload.emails,emailsTotal:a.payload.total,emailsOffset:a.payload.offset,sortBy:a.payload.sortBy||n.sortBy,sortOrder:a.payload.sortOrder||n.sortOrder};case"ADD_EMAIL":return{...n,emails:[a.payload,...n.emails],emailsTotal:n.emailsTotal+1};case"UPDATE_EMAIL":return{...n,emails:n.emails.map(r=>r.id===a.payload.id?a.payload:r)};case"SET_PROFILE":return{...n,profile:a.payload};case"UPDATE_PROFILE":return{...n,profile:a.payload};case"SET_ACCOUNTS":return{...n,accounts:a.payload};case"ADD_ACCOUNT":return{...n,accounts:[a.payload,...n.accounts]};case"REMOVE_ACCOUNT":return{...n,accounts:n.accounts.filter(r=>r.id!==a.payload)};case"SET_RULES":return{...n,rules:a.payload};case"ADD_RULE":return{...n,rules:[a.payload,...n.rules]};case"UPDATE_RULE":return{...n,rules:n.rules.map(r=>r.id===a.payload.id?a.payload:r)};case"REMOVE_RULE":return{...n,rules:n.rules.filter(r=>r.id!==a.payload)};case"SET_SETTINGS":return{...n,settings:a.payload};case"SET_STATS":return{...n,stats:a.payload};case"SET_SELECTED_EMAIL":return{...n,selectedEmailId:a.payload};case"CLEAR_DATA":return{...iv,isLoading:!1,isInitialized:!0};default:return n}}const lv=w.createContext(null);function Qj({children:n}){const[a,r]=w.useReducer(Xj,iv),l=w.useCallback(p=>{r({type:"ADD_EMAIL",payload:p}),p.ai_analysis?.priority==="High"?(Er.playAlert(),re.success("High Priority Email Processed!")):(Er.playNotify(),re.info("New email processed"))},[r]),c=w.useCallback(p=>{r({type:"UPDATE_EMAIL",payload:p})},[r]),d=w.useCallback(p=>{},[r]),{isSubscribed:h}=Vj({userId:a.user?.id,onInsert:l,onUpdate:c,onDelete:d,enabled:a.isAuthenticated});w.useEffect(()=>{async function p(){if(!Ur()){r({type:"SET_INITIALIZED",payload:!0});return}try{const{error:v}=await ct.from("init_state").select("count",{count:"exact",head:!0});if(v&&v.message==="Invalid API key"){console.error("[AppContext] Invalid API Key detected during init"),r({type:"SET_INITIALIZED",payload:!0});return}await nv(ct);const{data:{session:_}}=await ct.auth.getSession();r({type:"SET_USER",payload:_?.user||null}),r({type:"SET_INITIALIZED",payload:!0});const{data:{subscription:x}}=ct.auth.onAuthStateChange((S,A)=>{r({type:"SET_USER",payload:A?.user||null}),A||r({type:"CLEAR_DATA"})});return()=>x.unsubscribe()}catch(v){console.error("[AppContext] Init error:",v),r({type:"SET_ERROR",payload:"Failed to initialize"}),r({type:"SET_INITIALIZED",payload:!0})}}p()},[]);const m={fetchEmails:async(p={})=>{const g=await qe.getEmails({limit:20,offset:p.offset||0,category:p.category,search:p.search,sort_by:p.sortBy||a.sortBy,sort_order:p.sortOrder||a.sortOrder});g.data&&r({type:"SET_EMAILS",payload:{emails:g.data.emails,total:g.data.total,offset:p.offset||0,sortBy:p.sortBy,sortOrder:p.sortOrder}})},fetchAccounts:async()=>{const p=await qe.getAccounts();p.data&&r({type:"SET_ACCOUNTS",payload:p.data.accounts})},fetchRules:async()=>{const p=await qe.getRules();p.data&&r({type:"SET_RULES",payload:p.data.rules})},fetchSettings:async()=>{const p=await qe.getSettings();p.data&&r({type:"SET_SETTINGS",payload:p.data.settings})},fetchProfile:async()=>{const p=await qe.getProfile();p.data&&r({type:"SET_PROFILE",payload:p.data})},fetchStats:async()=>{const p=await qe.getStats();p.data&&r({type:"SET_STATS",payload:p.data.stats})},executeAction:async(p,g,v)=>{const _=await qe.executeAction(p,g,v);if(_.data?.success){const x=a.emails.find(S=>S.id===p);return x&&r({type:"UPDATE_EMAIL",payload:{...x,action_taken:g}}),!0}return r({type:"SET_ERROR",payload:_a(_.error,"Action failed")}),!1},triggerSync:async p=>{const g=p?await qe.triggerSync(p):await qe.syncAll();return await m.fetchAccounts(),g.error?(r({type:"SET_ERROR",payload:_a(g.error,"Sync failed")}),!1):!0},disconnectAccount:async p=>{const g=await qe.disconnectAccount(p);return g.data?.success?(r({type:"REMOVE_ACCOUNT",payload:p}),!0):(r({type:"SET_ERROR",payload:_a(g.error,"Failed to disconnect")}),!1)},updateSettings:async p=>{const g=await qe.updateSettings(p);return g.data?(r({type:"SET_SETTINGS",payload:g.data.settings}),!0):(r({type:"SET_ERROR",payload:_a(g.error,"Failed to update settings")}),!1)},updateProfile:async p=>{const g=await qe.updateProfile(p);return g.data?(r({type:"UPDATE_PROFILE",payload:g.data}),!0):(r({type:"SET_ERROR",payload:_a(g.error,"Failed to update profile")}),!1)},updateAccount:async(p,g)=>{const v=await qe.updateAccount(p,g);return v.data?(r({type:"SET_ACCOUNTS",payload:a.accounts.map(_=>_.id===p?{..._,...g}:_)}),!0):(r({type:"SET_ERROR",payload:_a(v.error,"Failed to update account")}),!1)},createRule:async p=>{const g=await qe.createRule(p);return g.data?(r({type:"ADD_RULE",payload:g.data.rule}),!0):(r({type:"SET_ERROR",payload:_a(g.error,"Failed to create rule")}),!1)},updateRule:async(p,g)=>{const v=await qe.updateRule(p,g);return v.data?(r({type:"UPDATE_RULE",payload:v.data.rule}),!0):(r({type:"SET_ERROR",payload:_a(v.error,"Failed to update rule")}),!1)},deleteRule:async p=>{const g=await qe.deleteRule(p);return g.data?.success?(r({type:"REMOVE_RULE",payload:p}),!0):(r({type:"SET_ERROR",payload:_a(g.error,"Failed to delete rule")}),!1)},toggleRule:async p=>{const g=await qe.toggleRule(p);return g.data?(r({type:"UPDATE_RULE",payload:g.data.rule}),!0):(r({type:"SET_ERROR",payload:_a(g.error,"Failed to toggle rule")}),!1)}};return o.jsx(lv.Provider,{value:{state:a,isSubscribed:h,dispatch:r,actions:m},children:n})}function Lr(){const n=w.useContext(lv);if(!n)throw new Error("useApp must be used within AppProvider");return n}const Zj=w.createContext(void 0);function Fj({children:n,value:a}){return o.jsx(Zj.Provider,{value:a,children:n})}const ov=w.createContext(null);function Wj({children:n}){const[a,r]=w.useState(!1),l=()=>r(!0),c=()=>r(!1);return o.jsx(ov.Provider,{value:{isExpanded:a,setIsExpanded:r,openTerminal:l,closeTerminal:c},children:n})}function cv(){const n=w.useContext(ov);if(!n)throw new Error("useTerminal must be used within a TerminalProvider");return n}const Et=w.forwardRef(({className:n,...a},r)=>o.jsx("div",{ref:r,className:ke("rounded-xl border bg-card text-card-foreground shadow",n),...a}));Et.displayName="Card";const Na=w.forwardRef(({className:n,...a},r)=>o.jsx("div",{ref:r,className:ke("flex flex-col space-y-1.5 p-6",n),...a}));Na.displayName="CardHeader";const Ea=w.forwardRef(({className:n,...a},r)=>o.jsx("div",{ref:r,className:ke("font-semibold leading-none tracking-tight",n),...a}));Ea.displayName="CardTitle";const Wa=w.forwardRef(({className:n,...a},r)=>o.jsx("div",{ref:r,className:ke("text-sm text-muted-foreground",n),...a}));Wa.displayName="CardDescription";const Ta=w.forwardRef(({className:n,...a},r)=>o.jsx("div",{ref:r,className:ke("p-6 pt-0",n),...a}));Ta.displayName="CardContent";const uv=w.forwardRef(({className:n,...a},r)=>o.jsx("div",{ref:r,className:ke("flex items-center p-6 pt-0",n),...a}));uv.displayName="CardFooter";class eN extends w.Component{constructor(a){super(a),this.state={hasError:!1,error:null}}static getDerivedStateFromError(a){return{hasError:!0,error:a}}componentDidCatch(a,r){console.error("ErrorBoundary caught an error:",a,r)}handleReset=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError?this.props.fallback?this.props.fallback:o.jsx("div",{className:"min-h-screen flex items-center justify-center p-8 bg-background",children:o.jsxs(Et,{className:"max-w-md w-full p-8 text-center",children:[o.jsx("div",{className:"w-16 h-16 bg-destructive/10 text-destructive rounded-full flex items-center justify-center mx-auto mb-6",children:o.jsx(Or,{className:"w-8 h-8"})}),o.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Something went wrong"}),o.jsx("p",{className:"text-muted-foreground mb-6",children:"An unexpected error occurred. Please try refreshing the page."}),this.state.error&&o.jsx("pre",{className:"text-xs text-left bg-secondary p-3 rounded-lg mb-6 overflow-auto max-h-32",children:this.state.error.message}),o.jsxs("div",{className:"flex gap-3 justify-center",children:[o.jsxs(Z,{onClick:this.handleReset,variant:"outline",children:[o.jsx(kr,{className:"w-4 h-4 mr-2"}),"Try Again"]}),o.jsx(Z,{onClick:()=>window.location.reload(),children:"Refresh Page"})]})]})}):this.props.children}}function ht({size:n="md",className:a,text:r}){const l={sm:"w-4 h-4",md:"w-8 h-8",lg:"w-12 h-12"};return o.jsxs("div",{className:ke("flex flex-col items-center justify-center gap-3",a),children:[o.jsx($t,{className:ke("animate-spin text-primary",l[n])}),r&&o.jsx("p",{className:"text-sm text-muted-foreground",children:r})]})}function Li({text:n="Loading..."}){return o.jsx("div",{className:"min-h-screen flex items-center justify-center",children:o.jsx(ht,{size:"lg",text:n})})}function tN(){return o.jsx("div",{className:"p-12 flex items-center justify-center",children:o.jsx(ht,{size:"md"})})}function Mn(n,a,{checkForDefaultPrevented:r=!0}={}){return function(c){if(n?.(c),r===!1||!c.defaultPrevented)return a?.(c)}}function aN(n,a){const r=w.createContext(a),l=d=>{const{children:h,...m}=d,p=w.useMemo(()=>m,Object.values(m));return o.jsx(r.Provider,{value:p,children:h})};l.displayName=n+"Provider";function c(d){const h=w.useContext(r);if(h)return h;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${n}\``)}return[l,c]}function nN(n,a=[]){let r=[];function l(d,h){const m=w.createContext(h),p=r.length;r=[...r,h];const g=_=>{const{scope:x,children:S,...A}=_,j=x?.[n]?.[p]||m,k=w.useMemo(()=>A,Object.values(A));return o.jsx(j.Provider,{value:k,children:S})};g.displayName=d+"Provider";function v(_,x){const S=x?.[n]?.[p]||m,A=w.useContext(S);if(A)return A;if(h!==void 0)return h;throw new Error(`\`${_}\` must be used within \`${d}\``)}return[g,v]}const c=()=>{const d=r.map(h=>w.createContext(h));return function(m){const p=m?.[n]||d;return w.useMemo(()=>({[`__scope${n}`]:{...m,[n]:p}}),[m,p])}};return c.scopeName=n,[l,sN(c,...a)]}function sN(...n){const a=n[0];if(n.length===1)return a;const r=()=>{const l=n.map(c=>({useScope:c(),scopeName:c.scopeName}));return function(d){const h=l.reduce((m,{useScope:p,scopeName:g})=>{const _=p(d)[`__scope${g}`];return{...m,..._}},{});return w.useMemo(()=>({[`__scope${a.scopeName}`]:h}),[h])}};return r.scopeName=a.scopeName,r}var Ji=globalThis?.document?w.useLayoutEffect:()=>{},rN=af[" useId ".trim().toString()]||(()=>{}),iN=0;function Td(n){const[a,r]=w.useState(rN());return Ji(()=>{r(l=>l??String(iN++))},[n]),n||(a?`radix-${a}`:"")}var lN=af[" useInsertionEffect ".trim().toString()]||Ji;function oN({prop:n,defaultProp:a,onChange:r=()=>{},caller:l}){const[c,d,h]=cN({defaultProp:a,onChange:r}),m=n!==void 0,p=m?n:c;{const v=w.useRef(n!==void 0);w.useEffect(()=>{const _=v.current;_!==m&&console.warn(`${l} is changing from ${_?"controlled":"uncontrolled"} to ${m?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),v.current=m},[m,l])}const g=w.useCallback(v=>{if(m){const _=uN(v)?v(n):v;_!==n&&h.current?.(_)}else d(v)},[m,n,d,h]);return[p,g]}function cN({defaultProp:n,onChange:a}){const[r,l]=w.useState(n),c=w.useRef(r),d=w.useRef(a);return lN(()=>{d.current=a},[a]),w.useEffect(()=>{c.current!==r&&(d.current?.(r),c.current=r)},[r,c]),[r,l,d]}function uN(n){return typeof n=="function"}var dv=py();const dN=ef(dv);function fN(n){const a=hN(n),r=w.forwardRef((l,c)=>{const{children:d,...h}=l,m=w.Children.toArray(d),p=m.find(pN);if(p){const g=p.props.children,v=m.map(_=>_===p?w.Children.count(g)>1?w.Children.only(null):w.isValidElement(g)?g.props.children:null:_);return o.jsx(a,{...h,ref:c,children:w.isValidElement(g)?w.cloneElement(g,void 0,v):null})}return o.jsx(a,{...h,ref:c,children:d})});return r.displayName=`${n}.Slot`,r}function hN(n){const a=w.forwardRef((r,l)=>{const{children:c,...d}=r;if(w.isValidElement(c)){const h=yN(c),m=gN(d,c.props);return c.type!==w.Fragment&&(m.ref=l?qo(l,h):h),w.cloneElement(c,m)}return w.Children.count(c)>1?w.Children.only(null):null});return a.displayName=`${n}.SlotClone`,a}var mN=Symbol("radix.slottable");function pN(n){return w.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===mN}function gN(n,a){const r={...a};for(const l in a){const c=n[l],d=a[l];/^on[A-Z]/.test(l)?c&&d?r[l]=(...m)=>{const p=d(...m);return c(...m),p}:c&&(r[l]=c):l==="style"?r[l]={...c,...d}:l==="className"&&(r[l]=[c,d].filter(Boolean).join(" "))}return{...n,...r}}function yN(n){let a=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?n.ref:(a=Object.getOwnPropertyDescriptor(n,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?n.props.ref:n.props.ref||n.ref)}var vN=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],tn=vN.reduce((n,a)=>{const r=fN(`Primitive.${a}`),l=w.forwardRef((c,d)=>{const{asChild:h,...m}=c,p=h?r:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(p,{...m,ref:d})});return l.displayName=`Primitive.${a}`,{...n,[a]:l}},{});function bN(n,a){n&&dv.flushSync(()=>n.dispatchEvent(a))}function Xi(n){const a=w.useRef(n);return w.useEffect(()=>{a.current=n}),w.useMemo(()=>(...r)=>a.current?.(...r),[])}function xN(n,a=globalThis?.document){const r=Xi(n);w.useEffect(()=>{const l=c=>{c.key==="Escape"&&r(c)};return a.addEventListener("keydown",l,{capture:!0}),()=>a.removeEventListener("keydown",l,{capture:!0})},[r,a])}var wN="DismissableLayer",Fd="dismissableLayer.update",_N="dismissableLayer.pointerDownOutside",SN="dismissableLayer.focusOutside",ey,fv=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),hv=w.forwardRef((n,a)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:h,onDismiss:m,...p}=n,g=w.useContext(fv),[v,_]=w.useState(null),x=v?.ownerDocument??globalThis?.document,[,S]=w.useState({}),A=ms(a,P=>_(P)),j=Array.from(g.layers),[k]=[...g.layersWithOutsidePointerEventsDisabled].slice(-1),R=j.indexOf(k),q=v?j.indexOf(v):-1,B=g.layersWithOutsidePointerEventsDisabled.size>0,G=q>=R,ee=EN(P=>{const X=P.target,ue=[...g.branches].some(Je=>Je.contains(X));!G||ue||(c?.(P),h?.(P),P.defaultPrevented||m?.())},x),J=TN(P=>{const X=P.target;[...g.branches].some(Je=>Je.contains(X))||(d?.(P),h?.(P),P.defaultPrevented||m?.())},x);return xN(P=>{q===g.layers.size-1&&(l?.(P),!P.defaultPrevented&&m&&(P.preventDefault(),m()))},x),w.useEffect(()=>{if(v)return r&&(g.layersWithOutsidePointerEventsDisabled.size===0&&(ey=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),g.layersWithOutsidePointerEventsDisabled.add(v)),g.layers.add(v),ty(),()=>{r&&g.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=ey)}},[v,x,r,g]),w.useEffect(()=>()=>{v&&(g.layers.delete(v),g.layersWithOutsidePointerEventsDisabled.delete(v),ty())},[v,g]),w.useEffect(()=>{const P=()=>S({});return document.addEventListener(Fd,P),()=>document.removeEventListener(Fd,P)},[]),o.jsx(tn.div,{...p,ref:A,style:{pointerEvents:B?G?"auto":"none":void 0,...n.style},onFocusCapture:Mn(n.onFocusCapture,J.onFocusCapture),onBlurCapture:Mn(n.onBlurCapture,J.onBlurCapture),onPointerDownCapture:Mn(n.onPointerDownCapture,ee.onPointerDownCapture)})});hv.displayName=wN;var jN="DismissableLayerBranch",NN=w.forwardRef((n,a)=>{const r=w.useContext(fv),l=w.useRef(null),c=ms(a,l);return w.useEffect(()=>{const d=l.current;if(d)return r.branches.add(d),()=>{r.branches.delete(d)}},[r.branches]),o.jsx(tn.div,{...n,ref:c})});NN.displayName=jN;function EN(n,a=globalThis?.document){const r=Xi(n),l=w.useRef(!1),c=w.useRef(()=>{});return w.useEffect(()=>{const d=m=>{if(m.target&&!l.current){let p=function(){mv(_N,r,g,{discrete:!0})};const g={originalEvent:m};m.pointerType==="touch"?(a.removeEventListener("click",c.current),c.current=p,a.addEventListener("click",c.current,{once:!0})):p()}else a.removeEventListener("click",c.current);l.current=!1},h=window.setTimeout(()=>{a.addEventListener("pointerdown",d)},0);return()=>{window.clearTimeout(h),a.removeEventListener("pointerdown",d),a.removeEventListener("click",c.current)}},[a,r]),{onPointerDownCapture:()=>l.current=!0}}function TN(n,a=globalThis?.document){const r=Xi(n),l=w.useRef(!1);return w.useEffect(()=>{const c=d=>{d.target&&!l.current&&mv(SN,r,{originalEvent:d},{discrete:!1})};return a.addEventListener("focusin",c),()=>a.removeEventListener("focusin",c)},[a,r]),{onFocusCapture:()=>l.current=!0,onBlurCapture:()=>l.current=!1}}function ty(){const n=new CustomEvent(Fd);document.dispatchEvent(n)}function mv(n,a,r,{discrete:l}){const c=r.originalEvent.target,d=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:r});a&&c.addEventListener(n,a,{once:!0}),l?bN(c,d):c.dispatchEvent(d)}var Ad="focusScope.autoFocusOnMount",Cd="focusScope.autoFocusOnUnmount",ay={bubbles:!1,cancelable:!0},AN="FocusScope",pv=w.forwardRef((n,a)=>{const{loop:r=!1,trapped:l=!1,onMountAutoFocus:c,onUnmountAutoFocus:d,...h}=n,[m,p]=w.useState(null),g=Xi(c),v=Xi(d),_=w.useRef(null),x=ms(a,j=>p(j)),S=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(l){let j=function(B){if(S.paused||!m)return;const G=B.target;m.contains(G)?_.current=G:On(_.current,{select:!0})},k=function(B){if(S.paused||!m)return;const G=B.relatedTarget;G!==null&&(m.contains(G)||On(_.current,{select:!0}))},R=function(B){if(document.activeElement===document.body)for(const ee of B)ee.removedNodes.length>0&&On(m)};document.addEventListener("focusin",j),document.addEventListener("focusout",k);const q=new MutationObserver(R);return m&&q.observe(m,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",k),q.disconnect()}}},[l,m,S.paused]),w.useEffect(()=>{if(m){sy.add(S);const j=document.activeElement;if(!m.contains(j)){const R=new CustomEvent(Ad,ay);m.addEventListener(Ad,g),m.dispatchEvent(R),R.defaultPrevented||(CN(MN(gv(m)),{select:!0}),document.activeElement===j&&On(m))}return()=>{m.removeEventListener(Ad,g),setTimeout(()=>{const R=new CustomEvent(Cd,ay);m.addEventListener(Cd,v),m.dispatchEvent(R),R.defaultPrevented||On(j??document.body,{select:!0}),m.removeEventListener(Cd,v),sy.remove(S)},0)}}},[m,g,v,S]);const A=w.useCallback(j=>{if(!r&&!l||S.paused)return;const k=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,R=document.activeElement;if(k&&R){const q=j.currentTarget,[B,G]=kN(q);B&&G?!j.shiftKey&&R===G?(j.preventDefault(),r&&On(B,{select:!0})):j.shiftKey&&R===B&&(j.preventDefault(),r&&On(G,{select:!0})):R===q&&j.preventDefault()}},[r,l,S.paused]);return o.jsx(tn.div,{tabIndex:-1,...h,ref:x,onKeyDown:A})});pv.displayName=AN;function CN(n,{select:a=!1}={}){const r=document.activeElement;for(const l of n)if(On(l,{select:a}),document.activeElement!==r)return}function kN(n){const a=gv(n),r=ny(a,n),l=ny(a.reverse(),n);return[r,l]}function gv(n){const a=[],r=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:l=>{const c=l.tagName==="INPUT"&&l.type==="hidden";return l.disabled||l.hidden||c?NodeFilter.FILTER_SKIP:l.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)a.push(r.currentNode);return a}function ny(n,a){for(const r of n)if(!ON(r,{upTo:a}))return r}function ON(n,{upTo:a}){if(getComputedStyle(n).visibility==="hidden")return!0;for(;n;){if(a!==void 0&&n===a)return!1;if(getComputedStyle(n).display==="none")return!0;n=n.parentElement}return!1}function RN(n){return n instanceof HTMLInputElement&&"select"in n}function On(n,{select:a=!1}={}){if(n&&n.focus){const r=document.activeElement;n.focus({preventScroll:!0}),n!==r&&RN(n)&&a&&n.select()}}var sy=DN();function DN(){let n=[];return{add(a){const r=n[0];a!==r&&r?.pause(),n=ry(n,a),n.unshift(a)},remove(a){n=ry(n,a),n[0]?.resume()}}}function ry(n,a){const r=[...n],l=r.indexOf(a);return l!==-1&&r.splice(l,1),r}function MN(n){return n.filter(a=>a.tagName!=="A")}var zN="Portal",yv=w.forwardRef((n,a)=>{const{container:r,...l}=n,[c,d]=w.useState(!1);Ji(()=>d(!0),[]);const h=r||c&&globalThis?.document?.body;return h?dN.createPortal(o.jsx(tn.div,{...l,ref:a}),h):null});yv.displayName=zN;function UN(n,a){return w.useReducer((r,l)=>a[r][l]??r,n)}var Io=n=>{const{present:a,children:r}=n,l=LN(a),c=typeof r=="function"?r({present:l.isPresent}):w.Children.only(r),d=ms(l.ref,BN(c));return typeof r=="function"||l.isPresent?w.cloneElement(c,{ref:d}):null};Io.displayName="Presence";function LN(n){const[a,r]=w.useState(),l=w.useRef(null),c=w.useRef(n),d=w.useRef("none"),h=n?"mounted":"unmounted",[m,p]=UN(h,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const g=_o(l.current);d.current=m==="mounted"?g:"none"},[m]),Ji(()=>{const g=l.current,v=c.current;if(v!==n){const x=d.current,S=_o(g);n?p("MOUNT"):S==="none"||g?.display==="none"?p("UNMOUNT"):p(v&&x!==S?"ANIMATION_OUT":"UNMOUNT"),c.current=n}},[n,p]),Ji(()=>{if(a){let g;const v=a.ownerDocument.defaultView??window,_=S=>{const j=_o(l.current).includes(CSS.escape(S.animationName));if(S.target===a&&j&&(p("ANIMATION_END"),!c.current)){const k=a.style.animationFillMode;a.style.animationFillMode="forwards",g=v.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=k)})}},x=S=>{S.target===a&&(d.current=_o(l.current))};return a.addEventListener("animationstart",x),a.addEventListener("animationcancel",_),a.addEventListener("animationend",_),()=>{v.clearTimeout(g),a.removeEventListener("animationstart",x),a.removeEventListener("animationcancel",_),a.removeEventListener("animationend",_)}}else p("ANIMATION_END")},[a,p]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:w.useCallback(g=>{l.current=g?getComputedStyle(g):null,r(g)},[])}}function _o(n){return n?.animationName||"none"}function BN(n){let a=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?n.ref:(a=Object.getOwnPropertyDescriptor(n,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?n.props.ref:n.props.ref||n.ref)}var kd=0;function qN(){w.useEffect(()=>{const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",n[0]??iy()),document.body.insertAdjacentElement("beforeend",n[1]??iy()),kd++,()=>{kd===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(a=>a.remove()),kd--}},[])}function iy(){const n=document.createElement("span");return n.setAttribute("data-radix-focus-guard",""),n.tabIndex=0,n.style.outline="none",n.style.opacity="0",n.style.position="fixed",n.style.pointerEvents="none",n}var Co="right-scroll-bar-position",ko="width-before-scroll-bar",$N="with-scroll-bars-hidden",HN="--removed-body-scroll-bar-size";function Od(n,a){return typeof n=="function"?n(a):n&&(n.current=a),n}function VN(n,a){var r=w.useState(function(){return{value:n,callback:a,facade:{get current(){return r.value},set current(l){var c=r.value;c!==l&&(r.value=l,r.callback(l,c))}}}})[0];return r.callback=a,r.facade}var IN=typeof window<"u"?w.useLayoutEffect:w.useEffect,ly=new WeakMap;function GN(n,a){var r=VN(null,function(l){return n.forEach(function(c){return Od(c,l)})});return IN(function(){var l=ly.get(r);if(l){var c=new Set(l),d=new Set(n),h=r.current;c.forEach(function(m){d.has(m)||Od(m,null)}),d.forEach(function(m){c.has(m)||Od(m,h)})}ly.set(r,n)},[n]),r}function PN(n){return n}function KN(n,a){a===void 0&&(a=PN);var r=[],l=!1,c={read:function(){if(l)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:n},useMedium:function(d){var h=a(d,l);return r.push(h),function(){r=r.filter(function(m){return m!==h})}},assignSyncMedium:function(d){for(l=!0;r.length;){var h=r;r=[],h.forEach(d)}r={push:function(m){return d(m)},filter:function(){return r}}},assignMedium:function(d){l=!0;var h=[];if(r.length){var m=r;r=[],m.forEach(d),h=r}var p=function(){var v=h;h=[],v.forEach(d)},g=function(){return Promise.resolve().then(p)};g(),r={push:function(v){h.push(v),g()},filter:function(v){return h=h.filter(v),r}}}};return c}function YN(n){n===void 0&&(n={});var a=KN(null);return a.options=ja({async:!0,ssr:!1},n),a}var vv=function(n){var a=n.sideCar,r=zr(n,["sideCar"]);if(!a)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var l=a.read();if(!l)throw new Error("Sidecar medium not found");return w.createElement(l,ja({},r))};vv.isSideCarExport=!0;function JN(n,a){return n.useMedium(a),vv}var bv=YN(),Rd=function(){},Go=w.forwardRef(function(n,a){var r=w.useRef(null),l=w.useState({onScrollCapture:Rd,onWheelCapture:Rd,onTouchMoveCapture:Rd}),c=l[0],d=l[1],h=n.forwardProps,m=n.children,p=n.className,g=n.removeScrollBar,v=n.enabled,_=n.shards,x=n.sideCar,S=n.noRelative,A=n.noIsolation,j=n.inert,k=n.allowPinchZoom,R=n.as,q=R===void 0?"div":R,B=n.gapMode,G=zr(n,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),ee=x,J=GN([r,a]),P=ja(ja({},G),c);return w.createElement(w.Fragment,null,v&&w.createElement(ee,{sideCar:bv,removeScrollBar:g,shards:_,noRelative:S,noIsolation:A,inert:j,setCallbacks:d,allowPinchZoom:!!k,lockRef:r,gapMode:B}),h?w.cloneElement(w.Children.only(m),ja(ja({},P),{ref:J})):w.createElement(q,ja({},P,{className:p,ref:J}),m))});Go.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Go.classNames={fullWidth:ko,zeroRight:Co};var XN=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function QN(){if(!document)return null;var n=document.createElement("style");n.type="text/css";var a=XN();return a&&n.setAttribute("nonce",a),n}function ZN(n,a){n.styleSheet?n.styleSheet.cssText=a:n.appendChild(document.createTextNode(a))}function FN(n){var a=document.head||document.getElementsByTagName("head")[0];a.appendChild(n)}var WN=function(){var n=0,a=null;return{add:function(r){n==0&&(a=QN())&&(ZN(a,r),FN(a)),n++},remove:function(){n--,!n&&a&&(a.parentNode&&a.parentNode.removeChild(a),a=null)}}},eE=function(){var n=WN();return function(a,r){w.useEffect(function(){return n.add(a),function(){n.remove()}},[a&&r])}},xv=function(){var n=eE(),a=function(r){var l=r.styles,c=r.dynamic;return n(l,c),null};return a},tE={left:0,top:0,right:0,gap:0},Dd=function(n){return parseInt(n||"",10)||0},aE=function(n){var a=window.getComputedStyle(document.body),r=a[n==="padding"?"paddingLeft":"marginLeft"],l=a[n==="padding"?"paddingTop":"marginTop"],c=a[n==="padding"?"paddingRight":"marginRight"];return[Dd(r),Dd(l),Dd(c)]},nE=function(n){if(n===void 0&&(n="margin"),typeof window>"u")return tE;var a=aE(n),r=document.documentElement.clientWidth,l=window.innerWidth;return{left:a[0],top:a[1],right:a[2],gap:Math.max(0,l-r+a[2]-a[0])}},sE=xv(),Tr="data-scroll-locked",rE=function(n,a,r,l){var c=n.left,d=n.top,h=n.right,m=n.gap;return r===void 0&&(r="margin"),`
|
|
52
|
+
.`.concat($N,` {
|
|
53
|
+
overflow: hidden `).concat(l,`;
|
|
54
|
+
padding-right: `).concat(m,"px ").concat(l,`;
|
|
55
|
+
}
|
|
56
|
+
body[`).concat(Tr,`] {
|
|
57
|
+
overflow: hidden `).concat(l,`;
|
|
58
|
+
overscroll-behavior: contain;
|
|
59
|
+
`).concat([a&&"position: relative ".concat(l,";"),r==="margin"&&`
|
|
60
|
+
padding-left: `.concat(c,`px;
|
|
61
|
+
padding-top: `).concat(d,`px;
|
|
62
|
+
padding-right: `).concat(h,`px;
|
|
63
|
+
margin-left:0;
|
|
64
|
+
margin-top:0;
|
|
65
|
+
margin-right: `).concat(m,"px ").concat(l,`;
|
|
66
|
+
`),r==="padding"&&"padding-right: ".concat(m,"px ").concat(l,";")].filter(Boolean).join(""),`
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.`).concat(Co,` {
|
|
70
|
+
right: `).concat(m,"px ").concat(l,`;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.`).concat(ko,` {
|
|
74
|
+
margin-right: `).concat(m,"px ").concat(l,`;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.`).concat(Co," .").concat(Co,` {
|
|
78
|
+
right: 0 `).concat(l,`;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.`).concat(ko," .").concat(ko,` {
|
|
82
|
+
margin-right: 0 `).concat(l,`;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
body[`).concat(Tr,`] {
|
|
86
|
+
`).concat(HN,": ").concat(m,`px;
|
|
87
|
+
}
|
|
88
|
+
`)},oy=function(){var n=parseInt(document.body.getAttribute(Tr)||"0",10);return isFinite(n)?n:0},iE=function(){w.useEffect(function(){return document.body.setAttribute(Tr,(oy()+1).toString()),function(){var n=oy()-1;n<=0?document.body.removeAttribute(Tr):document.body.setAttribute(Tr,n.toString())}},[])},lE=function(n){var a=n.noRelative,r=n.noImportant,l=n.gapMode,c=l===void 0?"margin":l;iE();var d=w.useMemo(function(){return nE(c)},[c]);return w.createElement(sE,{styles:rE(d,!a,c,r?"":"!important")})},Wd=!1;if(typeof window<"u")try{var So=Object.defineProperty({},"passive",{get:function(){return Wd=!0,!0}});window.addEventListener("test",So,So),window.removeEventListener("test",So,So)}catch{Wd=!1}var gr=Wd?{passive:!1}:!1,oE=function(n){return n.tagName==="TEXTAREA"},wv=function(n,a){if(!(n instanceof Element))return!1;var r=window.getComputedStyle(n);return r[a]!=="hidden"&&!(r.overflowY===r.overflowX&&!oE(n)&&r[a]==="visible")},cE=function(n){return wv(n,"overflowY")},uE=function(n){return wv(n,"overflowX")},cy=function(n,a){var r=a.ownerDocument,l=a;do{typeof ShadowRoot<"u"&&l instanceof ShadowRoot&&(l=l.host);var c=_v(n,l);if(c){var d=Sv(n,l),h=d[1],m=d[2];if(h>m)return!0}l=l.parentNode}while(l&&l!==r.body);return!1},dE=function(n){var a=n.scrollTop,r=n.scrollHeight,l=n.clientHeight;return[a,r,l]},fE=function(n){var a=n.scrollLeft,r=n.scrollWidth,l=n.clientWidth;return[a,r,l]},_v=function(n,a){return n==="v"?cE(a):uE(a)},Sv=function(n,a){return n==="v"?dE(a):fE(a)},hE=function(n,a){return n==="h"&&a==="rtl"?-1:1},mE=function(n,a,r,l,c){var d=hE(n,window.getComputedStyle(a).direction),h=d*l,m=r.target,p=a.contains(m),g=!1,v=h>0,_=0,x=0;do{if(!m)break;var S=Sv(n,m),A=S[0],j=S[1],k=S[2],R=j-k-d*A;(A||R)&&_v(n,m)&&(_+=R,x+=A);var q=m.parentNode;m=q&&q.nodeType===Node.DOCUMENT_FRAGMENT_NODE?q.host:q}while(!p&&m!==document.body||p&&(a.contains(m)||a===m));return(v&&Math.abs(_)<1||!v&&Math.abs(x)<1)&&(g=!0),g},jo=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},uy=function(n){return[n.deltaX,n.deltaY]},dy=function(n){return n&&"current"in n?n.current:n},pE=function(n,a){return n[0]===a[0]&&n[1]===a[1]},gE=function(n){return`
|
|
89
|
+
.block-interactivity-`.concat(n,` {pointer-events: none;}
|
|
90
|
+
.allow-interactivity-`).concat(n,` {pointer-events: all;}
|
|
91
|
+
`)},yE=0,yr=[];function vE(n){var a=w.useRef([]),r=w.useRef([0,0]),l=w.useRef(),c=w.useState(yE++)[0],d=w.useState(xv)[0],h=w.useRef(n);w.useEffect(function(){h.current=n},[n]),w.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(c));var j=r1([n.lockRef.current],(n.shards||[]).map(dy),!0).filter(Boolean);return j.forEach(function(k){return k.classList.add("allow-interactivity-".concat(c))}),function(){document.body.classList.remove("block-interactivity-".concat(c)),j.forEach(function(k){return k.classList.remove("allow-interactivity-".concat(c))})}}},[n.inert,n.lockRef.current,n.shards]);var m=w.useCallback(function(j,k){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!h.current.allowPinchZoom;var R=jo(j),q=r.current,B="deltaX"in j?j.deltaX:q[0]-R[0],G="deltaY"in j?j.deltaY:q[1]-R[1],ee,J=j.target,P=Math.abs(B)>Math.abs(G)?"h":"v";if("touches"in j&&P==="h"&&J.type==="range")return!1;var X=window.getSelection(),ue=X&&X.anchorNode,Je=ue?ue===J||ue.contains(J):!1;if(Je)return!1;var be=cy(P,J);if(!be)return!0;if(be?ee=P:(ee=P==="v"?"h":"v",be=cy(P,J)),!be)return!1;if(!l.current&&"changedTouches"in j&&(B||G)&&(l.current=ee),!ee)return!0;var ge=l.current||ee;return mE(ge,k,j,ge==="h"?B:G)},[]),p=w.useCallback(function(j){var k=j;if(!(!yr.length||yr[yr.length-1]!==d)){var R="deltaY"in k?uy(k):jo(k),q=a.current.filter(function(ee){return ee.name===k.type&&(ee.target===k.target||k.target===ee.shadowParent)&&pE(ee.delta,R)})[0];if(q&&q.should){k.cancelable&&k.preventDefault();return}if(!q){var B=(h.current.shards||[]).map(dy).filter(Boolean).filter(function(ee){return ee.contains(k.target)}),G=B.length>0?m(k,B[0]):!h.current.noIsolation;G&&k.cancelable&&k.preventDefault()}}},[]),g=w.useCallback(function(j,k,R,q){var B={name:j,delta:k,target:R,should:q,shadowParent:bE(R)};a.current.push(B),setTimeout(function(){a.current=a.current.filter(function(G){return G!==B})},1)},[]),v=w.useCallback(function(j){r.current=jo(j),l.current=void 0},[]),_=w.useCallback(function(j){g(j.type,uy(j),j.target,m(j,n.lockRef.current))},[]),x=w.useCallback(function(j){g(j.type,jo(j),j.target,m(j,n.lockRef.current))},[]);w.useEffect(function(){return yr.push(d),n.setCallbacks({onScrollCapture:_,onWheelCapture:_,onTouchMoveCapture:x}),document.addEventListener("wheel",p,gr),document.addEventListener("touchmove",p,gr),document.addEventListener("touchstart",v,gr),function(){yr=yr.filter(function(j){return j!==d}),document.removeEventListener("wheel",p,gr),document.removeEventListener("touchmove",p,gr),document.removeEventListener("touchstart",v,gr)}},[]);var S=n.removeScrollBar,A=n.inert;return w.createElement(w.Fragment,null,A?w.createElement(d,{styles:gE(c)}):null,S?w.createElement(lE,{noRelative:n.noRelative,gapMode:n.gapMode}):null)}function bE(n){for(var a=null;n!==null;)n instanceof ShadowRoot&&(a=n.host,n=n.host),n=n.parentNode;return a}const xE=JN(bv,vE);var jv=w.forwardRef(function(n,a){return w.createElement(Go,ja({},n,{ref:a,sideCar:xE}))});jv.classNames=Go.classNames;var wE=function(n){if(typeof document>"u")return null;var a=Array.isArray(n)?n[0]:n;return a.ownerDocument.body},vr=new WeakMap,No=new WeakMap,Eo={},Md=0,Nv=function(n){return n&&(n.host||Nv(n.parentNode))},_E=function(n,a){return a.map(function(r){if(n.contains(r))return r;var l=Nv(r);return l&&n.contains(l)?l:(console.error("aria-hidden",r,"in not contained inside",n,". Doing nothing"),null)}).filter(function(r){return!!r})},SE=function(n,a,r,l){var c=_E(a,Array.isArray(n)?n:[n]);Eo[r]||(Eo[r]=new WeakMap);var d=Eo[r],h=[],m=new Set,p=new Set(c),g=function(_){!_||m.has(_)||(m.add(_),g(_.parentNode))};c.forEach(g);var v=function(_){!_||p.has(_)||Array.prototype.forEach.call(_.children,function(x){if(m.has(x))v(x);else try{var S=x.getAttribute(l),A=S!==null&&S!=="false",j=(vr.get(x)||0)+1,k=(d.get(x)||0)+1;vr.set(x,j),d.set(x,k),h.push(x),j===1&&A&&No.set(x,!0),k===1&&x.setAttribute(r,"true"),A||x.setAttribute(l,"true")}catch(R){console.error("aria-hidden: cannot operate on ",x,R)}})};return v(a),m.clear(),Md++,function(){h.forEach(function(_){var x=vr.get(_)-1,S=d.get(_)-1;vr.set(_,x),d.set(_,S),x||(No.has(_)||_.removeAttribute(l),No.delete(_)),S||_.removeAttribute(r)}),Md--,Md||(vr=new WeakMap,vr=new WeakMap,No=new WeakMap,Eo={})}},jE=function(n,a,r){r===void 0&&(r="data-aria-hidden");var l=Array.from(Array.isArray(n)?n:[n]),c=wE(n);return c?(l.push.apply(l,Array.from(c.querySelectorAll("[aria-live], script"))),SE(l,c,r,"aria-hidden")):function(){return null}};function NE(n){const a=EE(n),r=w.forwardRef((l,c)=>{const{children:d,...h}=l,m=w.Children.toArray(d),p=m.find(AE);if(p){const g=p.props.children,v=m.map(_=>_===p?w.Children.count(g)>1?w.Children.only(null):w.isValidElement(g)?g.props.children:null:_);return o.jsx(a,{...h,ref:c,children:w.isValidElement(g)?w.cloneElement(g,void 0,v):null})}return o.jsx(a,{...h,ref:c,children:d})});return r.displayName=`${n}.Slot`,r}function EE(n){const a=w.forwardRef((r,l)=>{const{children:c,...d}=r;if(w.isValidElement(c)){const h=kE(c),m=CE(d,c.props);return c.type!==w.Fragment&&(m.ref=l?qo(l,h):h),w.cloneElement(c,m)}return w.Children.count(c)>1?w.Children.only(null):null});return a.displayName=`${n}.SlotClone`,a}var TE=Symbol("radix.slottable");function AE(n){return w.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===TE}function CE(n,a){const r={...a};for(const l in a){const c=n[l],d=a[l];/^on[A-Z]/.test(l)?c&&d?r[l]=(...m)=>{const p=d(...m);return c(...m),p}:c&&(r[l]=c):l==="style"?r[l]={...c,...d}:l==="className"&&(r[l]=[c,d].filter(Boolean).join(" "))}return{...n,...r}}function kE(n){let a=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?n.ref:(a=Object.getOwnPropertyDescriptor(n,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?n.props.ref:n.props.ref||n.ref)}var Po="Dialog",[Ev]=nN(Po),[OE,pa]=Ev(Po),Tv=n=>{const{__scopeDialog:a,children:r,open:l,defaultOpen:c,onOpenChange:d,modal:h=!0}=n,m=w.useRef(null),p=w.useRef(null),[g,v]=oN({prop:l,defaultProp:c??!1,onChange:d,caller:Po});return o.jsx(OE,{scope:a,triggerRef:m,contentRef:p,contentId:Td(),titleId:Td(),descriptionId:Td(),open:g,onOpenChange:v,onOpenToggle:w.useCallback(()=>v(_=>!_),[v]),modal:h,children:r})};Tv.displayName=Po;var Av="DialogTrigger",RE=w.forwardRef((n,a)=>{const{__scopeDialog:r,...l}=n,c=pa(Av,r),d=ms(a,c.triggerRef);return o.jsx(tn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.contentId,"data-state":pf(c.open),...l,ref:d,onClick:Mn(n.onClick,c.onOpenToggle)})});RE.displayName=Av;var hf="DialogPortal",[DE,Cv]=Ev(hf,{forceMount:void 0}),kv=n=>{const{__scopeDialog:a,forceMount:r,children:l,container:c}=n,d=pa(hf,a);return o.jsx(DE,{scope:a,forceMount:r,children:w.Children.map(l,h=>o.jsx(Io,{present:r||d.open,children:o.jsx(yv,{asChild:!0,container:c,children:h})}))})};kv.displayName=hf;var Bo="DialogOverlay",Ov=w.forwardRef((n,a)=>{const r=Cv(Bo,n.__scopeDialog),{forceMount:l=r.forceMount,...c}=n,d=pa(Bo,n.__scopeDialog);return d.modal?o.jsx(Io,{present:l||d.open,children:o.jsx(zE,{...c,ref:a})}):null});Ov.displayName=Bo;var ME=NE("DialogOverlay.RemoveScroll"),zE=w.forwardRef((n,a)=>{const{__scopeDialog:r,...l}=n,c=pa(Bo,r);return o.jsx(jv,{as:ME,allowPinchZoom:!0,shards:[c.contentRef],children:o.jsx(tn.div,{"data-state":pf(c.open),...l,ref:a,style:{pointerEvents:"auto",...l.style}})})}),hs="DialogContent",Rv=w.forwardRef((n,a)=>{const r=Cv(hs,n.__scopeDialog),{forceMount:l=r.forceMount,...c}=n,d=pa(hs,n.__scopeDialog);return o.jsx(Io,{present:l||d.open,children:d.modal?o.jsx(UE,{...c,ref:a}):o.jsx(LE,{...c,ref:a})})});Rv.displayName=hs;var UE=w.forwardRef((n,a)=>{const r=pa(hs,n.__scopeDialog),l=w.useRef(null),c=ms(a,r.contentRef,l);return w.useEffect(()=>{const d=l.current;if(d)return jE(d)},[]),o.jsx(Dv,{...n,ref:c,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Mn(n.onCloseAutoFocus,d=>{d.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Mn(n.onPointerDownOutside,d=>{const h=d.detail.originalEvent,m=h.button===0&&h.ctrlKey===!0;(h.button===2||m)&&d.preventDefault()}),onFocusOutside:Mn(n.onFocusOutside,d=>d.preventDefault())})}),LE=w.forwardRef((n,a)=>{const r=pa(hs,n.__scopeDialog),l=w.useRef(!1),c=w.useRef(!1);return o.jsx(Dv,{...n,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:d=>{n.onCloseAutoFocus?.(d),d.defaultPrevented||(l.current||r.triggerRef.current?.focus(),d.preventDefault()),l.current=!1,c.current=!1},onInteractOutside:d=>{n.onInteractOutside?.(d),d.defaultPrevented||(l.current=!0,d.detail.originalEvent.type==="pointerdown"&&(c.current=!0));const h=d.target;r.triggerRef.current?.contains(h)&&d.preventDefault(),d.detail.originalEvent.type==="focusin"&&c.current&&d.preventDefault()}})}),Dv=w.forwardRef((n,a)=>{const{__scopeDialog:r,trapFocus:l,onOpenAutoFocus:c,onCloseAutoFocus:d,...h}=n,m=pa(hs,r),p=w.useRef(null),g=ms(a,p);return qN(),o.jsxs(o.Fragment,{children:[o.jsx(pv,{asChild:!0,loop:!0,trapped:l,onMountAutoFocus:c,onUnmountAutoFocus:d,children:o.jsx(hv,{role:"dialog",id:m.contentId,"aria-describedby":m.descriptionId,"aria-labelledby":m.titleId,"data-state":pf(m.open),...h,ref:g,onDismiss:()=>m.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(BE,{titleId:m.titleId}),o.jsx($E,{contentRef:p,descriptionId:m.descriptionId})]})]})}),mf="DialogTitle",Mv=w.forwardRef((n,a)=>{const{__scopeDialog:r,...l}=n,c=pa(mf,r);return o.jsx(tn.h2,{id:c.titleId,...l,ref:a})});Mv.displayName=mf;var zv="DialogDescription",Uv=w.forwardRef((n,a)=>{const{__scopeDialog:r,...l}=n,c=pa(zv,r);return o.jsx(tn.p,{id:c.descriptionId,...l,ref:a})});Uv.displayName=zv;var Lv="DialogClose",Bv=w.forwardRef((n,a)=>{const{__scopeDialog:r,...l}=n,c=pa(Lv,r);return o.jsx(tn.button,{type:"button",...l,ref:a,onClick:Mn(n.onClick,()=>c.onOpenChange(!1))})});Bv.displayName=Lv;function pf(n){return n?"open":"closed"}var qv="DialogTitleWarning",[O2,$v]=aN(qv,{contentName:hs,titleName:mf,docsSlug:"dialog"}),BE=({titleId:n})=>{const a=$v(qv),r=`\`${a.contentName}\` requires a \`${a.titleName}\` for the component to be accessible for screen reader users.
|
|
92
|
+
|
|
93
|
+
If you want to hide the \`${a.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
94
|
+
|
|
95
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${a.docsSlug}`;return w.useEffect(()=>{n&&(document.getElementById(n)||console.error(r))},[r,n]),null},qE="DialogDescriptionWarning",$E=({contentRef:n,descriptionId:a})=>{const l=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${$v(qE).contentName}}.`;return w.useEffect(()=>{const c=n.current?.getAttribute("aria-describedby");a&&c&&(document.getElementById(a)||console.warn(l))},[l,n,a]),null},HE=Tv,VE=kv,IE=Ov,GE=Rv,PE=Mv,KE=Uv,YE=Bv;function ds({...n}){return o.jsx(HE,{"data-slot":"dialog",...n})}function JE({...n}){return o.jsx(VE,{"data-slot":"dialog-portal",...n})}function XE({className:n,...a}){return o.jsx(IE,{"data-slot":"dialog-overlay",className:ke("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",n),...a})}function fs({className:n,children:a,...r}){return o.jsxs(JE,{"data-slot":"dialog-portal",children:[o.jsx(XE,{}),o.jsxs(GE,{"data-slot":"dialog-content",className:ke("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",n),...r,children:[a,o.jsxs(YE,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[o.jsx(Fi,{}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Aa({className:n,...a}){return o.jsx("div",{"data-slot":"dialog-header",className:ke("flex flex-col gap-2 text-center sm:text-left",n),...a})}function _r({className:n,...a}){return o.jsx("div",{"data-slot":"dialog-footer",className:ke("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",n),...a})}function Ca({className:n,...a}){return o.jsx(PE,{"data-slot":"dialog-title",className:ke("text-lg leading-none font-semibold",n),...a})}function ka({className:n,...a}){return o.jsx(KE,{"data-slot":"dialog-description",className:ke("text-muted-foreground text-sm",n),...a})}const Te=w.forwardRef(({className:n,type:a,...r},l)=>o.jsx("input",{type:a,className:ke("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",n),ref:l,...r}));Te.displayName="Input";var QE=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ZE=QE.reduce((n,a)=>{const r=_y(`Primitive.${a}`),l=w.forwardRef((c,d)=>{const{asChild:h,...m}=c,p=h?r:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(p,{...m,ref:d})});return l.displayName=`Primitive.${a}`,{...n,[a]:l}},{}),FE="Label",Hv=w.forwardRef((n,a)=>o.jsx(ZE.label,{...n,ref:a,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(n.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Hv.displayName=FE;var WE=Hv;function ma({className:n,...a}){return o.jsx(WE,{"data-slot":"label",className:ke("flex items-center gap-2 text-sm leading-none font-medium select-none text-muted-foreground group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",n),...a})}const e2=Ny("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function Qi({className:n,variant:a,...r}){return o.jsx("div",{"data-slot":"alert",role:"alert",className:ke(e2({variant:a}),n),...r})}function Zi({className:n,...a}){return o.jsx("div",{"data-slot":"alert-description",className:ke("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",n),...a})}function gf({className:n}){return o.jsxs("svg",{width:"512",height:"512",viewBox:"0 0 512 512",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:ke("w-9 h-9",n),children:[o.jsx("path",{d:"M112 112H400C426.51 112 448 133.49 448 160V352C448 378.51 426.51 400 400 400H112C85.4903 400 64 378.51 64 352V160C64 133.49 85.4903 112 112 112Z",className:"stroke-foreground",strokeWidth:"32",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M64 160 L200 270",className:"stroke-foreground",strokeWidth:"32",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M448 160 L312 270",className:"stroke-foreground",strokeWidth:"32",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{d:"M256 128 C256 128 276 170 306 178 C276 186 256 228 256 228 C256 228 236 186 206 178 C236 170 256 128 256 128 Z",fill:"#9333ea",children:o.jsx("animateTransform",{attributeName:"transform",type:"translate",values:"0 0; 0 -10; 0 0",dur:"3s",repeatCount:"indefinite"})})]})}function fy(n){const a=n.trim();return a?a.startsWith("http://")||a.startsWith("https://")?a:`https://${a}.supabase.co`:""}function t2(n){const a=n.trim();if(!a)return{valid:!1};if(a.startsWith("http://")||a.startsWith("https://"))try{return new URL(a).hostname.endsWith(".supabase.co")?{valid:!0,message:"Valid Supabase URL"}:{valid:!1,message:"URL must be a supabase.co domain"}}catch{return{valid:!1,message:"Invalid URL format"}}return/^[a-z0-9]+$/.test(a)?{valid:!0,message:"Project ID detected"}:{valid:!1,message:"Enter a URL or Project ID"}}function a2(n){const a=n.trim();return a?a.startsWith("sb_publishable_")?a.length>25?{valid:!0,message:"Valid Publishable Key"}:{valid:!1,message:"Incomplete Publishable Key"}:a.startsWith("eyJ")?a.length>50?{valid:!0,message:"Valid Anon Key"}:{valid:!1,message:"Incomplete Anon Key"}:{valid:!1,message:"Invalid API Key format"}:{valid:!1}}function Vv({onComplete:n,open:a=!0,canClose:r=!1}){const[l,c]=w.useState("welcome"),[d,h]=w.useState(""),[m,p]=w.useState(""),[g,v]=w.useState(null),[_,x]=w.useState(!1),[S,A]=w.useState(!1),j=async()=>{v(null),c("validating");const G=fy(d),ee=m.trim(),J=await av(G,ee);J.valid?(Uj({url:G,anonKey:ee}),c("success"),setTimeout(()=>{window.location.reload()},1e3)):(v(J.error||"Connection failed. Please check your credentials."),c("credentials"))},k=d?t2(d):{valid:!1},R=m?a2(m):{valid:!1},q=d?fy(d):"",B=d&&!d.startsWith("http")&&k.valid;return o.jsx(ds,{open:a,onOpenChange:G=>{!G&&r&&n()},children:o.jsxs(fs,{className:"sm:max-w-md",onPointerDownOutside:G=>{r||G.preventDefault()},onEscapeKeyDown:G=>{r||G.preventDefault()},children:[l==="welcome"&&o.jsxs(o.Fragment,{children:[o.jsxs(Aa,{children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(gf,{className:"w-9 h-9"}),o.jsx(Ca,{children:"Welcome to Email Automator"})]}),o.jsx(ka,{children:"This application requires a Supabase database to store your emails and automation rules."})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsx(Qi,{children:o.jsxs(Zi,{children:[o.jsx("strong",{children:"No Supabase Setup Detected"}),o.jsx("br",{}),"You can create a free project at"," ",o.jsxs("a",{href:"https://supabase.com",target:"_blank",rel:"noopener noreferrer",className:"underline text-primary inline-flex items-center gap-1",children:["supabase.com",o.jsx($i,{className:"h-3 w-3"})]})]})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-medium text-sm",children:"You will need:"}),o.jsxs("ul",{className:"list-disc list-inside text-sm text-muted-foreground space-y-1",children:[o.jsx("li",{children:"Project URL"}),o.jsx("li",{children:"Anon Public Key"})]})]}),o.jsxs("div",{className:"flex gap-2",children:[r&&o.jsx(Z,{variant:"outline",onClick:n,className:"flex-1",children:"Close"}),o.jsx(Z,{onClick:()=>c("credentials"),className:"flex-1",children:"Continue Setup"})]})]})]}),l==="credentials"&&o.jsxs(o.Fragment,{children:[o.jsxs(Aa,{children:[o.jsx(Ca,{children:"Connect to Supabase"}),o.jsx(ka,{children:"Enter your connection details below."})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[g&&o.jsxs(Qi,{variant:"destructive",children:[o.jsx(Rr,{className:"h-4 w-4"}),o.jsx(Zi,{children:g})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ma,{htmlFor:"supabase-url",children:"Project URL or ID"}),o.jsxs("div",{className:"relative",children:[o.jsx(Te,{id:"supabase-url",placeholder:"https://xxx.supabase.co or project-id",value:d,onChange:G=>{h(G.target.value),x(!0)},onBlur:()=>x(!0),className:_&&d?k.valid?"pr-8 border-green-500":"pr-8 border-destructive":""}),_&&d&&k.valid&&o.jsx(Sa,{className:"absolute right-2 top-1/2 -translate-y-1/2 h-4 w-4 text-green-500"})]}),B&&o.jsxs("div",{className:"flex items-start gap-1.5 text-xs text-green-600 dark:text-green-400",children:[o.jsx(Sa,{className:"h-3 w-3 mt-0.5 flex-shrink-0"}),o.jsxs("span",{children:["Will use: ",q]})]}),_&&d&&k.message&&!k.valid&&o.jsx("p",{className:"text-xs text-destructive",children:k.message})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ma,{htmlFor:"anon-key",children:"Anon Public Key"}),o.jsxs("div",{className:"relative",children:[o.jsx(Te,{id:"anon-key",type:"password",placeholder:"eyJ...",value:m,onChange:G=>{p(G.target.value),A(!0)},onBlur:()=>A(!0),className:S&&m?R.valid?"pr-8 border-green-500":"pr-8 border-destructive":""}),S&&m&&R.valid&&o.jsx(Sa,{className:"absolute right-2 top-1/2 -translate-y-1/2 h-4 w-4 text-green-500"})]}),S&&m&&R.message&&o.jsx("p",{className:`text-xs ${R.valid?"text-green-600 dark:text-green-400":"text-destructive"}`,children:R.message})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Z,{variant:"outline",onClick:()=>c("welcome"),className:"flex-1",children:"Back"}),r&&o.jsx(Z,{variant:"outline",onClick:n,className:"flex-1",children:"Close"}),o.jsx(Z,{onClick:j,disabled:!k.valid||!R.valid,className:"flex-1",children:"Connect"})]})]})]}),l==="validating"&&o.jsxs(o.Fragment,{children:[o.jsxs(Aa,{children:[o.jsx(Ca,{children:"Validating Connection"}),o.jsx(ka,{children:"Verifying your credentials with Supabase..."})]}),o.jsxs("div",{className:"flex flex-col items-center justify-center py-8",children:[o.jsx($t,{className:"h-12 w-12 animate-spin text-primary mb-4"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Please wait..."})]})]}),l==="success"&&o.jsxs(o.Fragment,{children:[o.jsxs(Aa,{children:[o.jsx(Ca,{children:"Success!"}),o.jsx(ka,{children:"Your database is connected."})]}),o.jsxs("div",{className:"flex flex-col items-center justify-center py-8",children:[o.jsx(nf,{className:"h-12 w-12 text-green-500 mb-4"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Restarting application..."})]})]})]})})}function n2({email:n,isOpen:a,onOpenChange:r}){const[l,c]=w.useState([]),[d,h]=w.useState(!1);w.useEffect(()=>{a&&n&&m()},[a,n]);const m=async()=>{if(n){h(!0);try{const g=await qe.getEmailEvents(n.id);g.data&&c(g.data.events)}catch(g){console.error("Failed to fetch trace:",g)}finally{h(!1)}}},p=g=>{switch(g){case"analysis":return o.jsx(Bi,{className:"w-4 h-4 text-purple-500"});case"action":return o.jsx(Ro,{className:"w-4 h-4 text-emerald-500"});case"error":return o.jsx(Rr,{className:"w-4 h-4 text-red-500"});default:return o.jsx(Cr,{className:"w-4 h-4 text-blue-500"})}};return o.jsx(ds,{open:a,onOpenChange:r,children:o.jsxs(fs,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 overflow-hidden",children:[o.jsxs(Aa,{className:"p-6 border-b",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rf,{className:"w-5 h-5 text-primary"}),o.jsx(Ca,{children:"AI Processing Trace"})]}),o.jsx(ka,{children:"Step-by-step log of how the AI analyzed and acted on this email."})]}),o.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-6 custom-scrollbar bg-secondary/5",children:d?o.jsx("div",{className:"py-20 flex justify-center",children:o.jsx(ht,{})}):l.length===0?o.jsx("div",{className:"py-20 text-center text-muted-foreground italic font-mono text-sm",children:"No granular trace events found for this email."}):l.map((g,v)=>o.jsxs("div",{className:"relative pl-8",children:[v!==l.length-1&&o.jsx("div",{className:"absolute left-[15px] top-8 bottom-[-24px] w-px bg-border"}),o.jsx("div",{className:"absolute left-0 top-0 w-8 h-8 rounded-full border bg-background flex items-center justify-center z-10 shadow-sm",children:p(g.event_type)}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground/70",children:g.agent_state}),o.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(Ar,{className:"w-3 h-3"}),new Date(g.created_at).toLocaleTimeString()]})]}),o.jsxs("div",{className:"bg-card border rounded-lg p-4 shadow-sm",children:[g.event_type==="info"&&o.jsx("p",{className:"text-sm text-foreground/90",children:g.details?.message}),g.event_type==="analysis"&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"text-[10px] bg-secondary px-2 py-1 rounded",children:[o.jsx("span",{className:"text-muted-foreground mr-1",children:"Category:"}),o.jsx("span",{className:"font-bold uppercase",children:g.details?.category||"Analyzing..."})]}),o.jsxs("div",{className:"text-[10px] bg-secondary px-2 py-1 rounded",children:[o.jsx("span",{className:"text-muted-foreground mr-1",children:"Sentiment:"}),o.jsx("span",{className:"font-bold uppercase",children:g.details?.sentiment||"Analyzing..."})]})]}),g.details?.system_prompt&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"text-[9px] font-bold text-muted-foreground uppercase flex items-center gap-1",children:[o.jsx(Sr,{className:"w-3 h-3"})," System Prompt"]}),o.jsx("pre",{className:"text-[10px] bg-secondary/50 p-2 rounded border overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto font-mono",children:g.details?.system_prompt})]}),g.details?._raw_response&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"text-[9px] font-bold text-muted-foreground uppercase flex items-center gap-1",children:[o.jsx(Sr,{className:"w-3 h-3"})," Raw LLM Response"]}),o.jsx("pre",{className:"text-[10px] bg-emerald-500/5 p-2 rounded border border-emerald-500/10 overflow-x-auto font-mono",children:JSON.stringify(JSON.parse(g.details._raw_response),null,2)})]})]}),g.event_type==="action"&&o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsxs("p",{className:"text-sm font-bold text-emerald-600 dark:text-emerald-400 capitalize",children:["Executed: ",g.details?.action]}),o.jsxs("p",{className:"text-xs text-muted-foreground italic",children:['"',g.details?.reason,'"']})]}),o.jsx(sf,{className:"w-5 h-5 text-emerald-500"})]}),g.event_type==="error"&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 font-bold",children:typeof g.details?.error=="object"?g.details.error.message||JSON.stringify(g.details.error):g.details?.error}),g.details?.raw_response&&o.jsx("pre",{className:"text-[10px] bg-red-500/5 p-2 rounded border border-red-500/10 overflow-x-auto whitespace-pre-wrap font-mono",children:typeof g.details.raw_response=="object"?JSON.stringify(g.details.raw_response,null,2):g.details.raw_response})]})]})]})]},g.id))})]})})}const s2={spam:"bg-destructive/10 text-destructive",newsletter:"bg-blue-500/10 text-blue-600 dark:text-blue-400",support:"bg-orange-500/10 text-orange-600 dark:text-orange-400",client:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",internal:"bg-purple-500/10 text-purple-600 dark:text-purple-400",personal:"bg-pink-500/10 text-pink-600 dark:text-pink-400",other:"bg-gray-500/10 text-gray-600 dark:text-gray-400"};function r2(){const{state:n,actions:a,dispatch:r}=Lr(),{openTerminal:l}=cv(),[c,d]=w.useState(!0),[h,m]=w.useState(!1),[p,g]=w.useState(""),[v,_]=w.useState(null),[x,S]=w.useState(null),[A,j]=w.useState({}),[k,R]=w.useState(null),[q,B]=w.useState(!1),[G,ee]=w.useState(null);w.useEffect(()=>{n.isAuthenticated?(J(),a.fetchStats()):d(!1)},[v,n.isAuthenticated]);const J=async(F=0)=>{d(!0),await a.fetchEmails({category:v||void 0,search:p||void 0,offset:F,sortBy:n.sortBy,sortOrder:n.sortOrder}),d(!1)},P=F=>{a.fetchEmails({category:v||void 0,search:p||void 0,offset:0,sortBy:F,sortOrder:n.sortOrder})},X=()=>{a.fetchEmails({category:v||void 0,search:p||void 0,offset:0,sortBy:n.sortBy,sortOrder:n.sortOrder==="asc"?"desc":"asc"})},ue=async()=>{if(n.accounts.length===0){re.warning("Please connect an email account first");return}l(),m(!0);const F=await a.triggerSync();m(!1),F?(Er.playSuccess(),re.success("Sync completed! Check your emails.")):re.error("Sync failed. Check account status for details.")},Je=async(F,U)=>{if(U==="delete"&&k!==F.id){R(F.id);return}R(null),j(K=>({...K,[F.id]:U}));const Q=await a.executeAction(F.id,U);j(K=>{const je={...K};return delete je[F.id],je}),Q&&(re.success(`Email ${U==="delete"?"deleted":U==="archive"?"archived":"updated"}`),U==="delete"&&J(n.emailsOffset))},be=()=>{R(null)},ge=F=>{F.preventDefault(),J()},Ze=F=>{const U=F==="next"?n.emailsOffset+20:Math.max(0,n.emailsOffset-20);J(U)},nt=F=>{ee(F),B(!0)};return o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8 animate-in fade-in duration-500",children:[o.jsxs("section",{className:"lg:col-span-2 space-y-4",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 mb-4",children:[o.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[o.jsx(zd,{className:"w-5 h-5 text-primary"}),"Recent Analysis"]}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[o.jsxs(Z,{onClick:ue,size:"sm",variant:"outline",className:"shadow-sm",disabled:h,children:[o.jsx(kr,{className:ke("w-3.5 h-3.5 mr-2",h&&"animate-spin")}),h?"Syncing...":"Sync Now"]}),o.jsxs("span",{className:"text-xs font-medium text-muted-foreground bg-secondary px-2 py-1 rounded-md border border-border flex items-center",children:[n.emailsTotal," emails"]})]})]}),h&&o.jsxs("div",{className:"bg-primary/5 border border-primary/20 p-4 rounded-lg flex items-center justify-between animate-in fade-in slide-in-from-top-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:o.jsx($t,{className:"w-5 h-5 text-primary animate-spin"})}),o.jsxs("div",{children:[o.jsx("h4",{className:"font-semibold text-sm",children:"Sync in progress..."}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Fetching and analyzing emails. New emails will appear below automatically."})]})]}),o.jsxs(Z,{variant:"outline",size:"sm",onClick:l,className:"h-8 text-xs",children:[o.jsx(rf,{className:"w-3.5 h-3.5 mr-2"}),"View Logs"]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[o.jsxs("form",{onSubmit:ge,className:"flex-1 flex gap-2",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx(Dw,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),o.jsx(Te,{placeholder:"Search emails...",value:p,onChange:F=>g(F.target.value),className:"pl-9"})]}),o.jsx(Z,{type:"submit",size:"sm",children:"Search"})]}),o.jsxs("div",{className:"flex items-center gap-1 bg-secondary/30 p-1 rounded-md border border-border/50",children:[o.jsxs("select",{className:"bg-transparent text-xs font-medium border-none focus:ring-0 cursor-pointer pl-2 pr-8 h-7",value:n.sortBy,onChange:F=>P(F.target.value),children:[o.jsx("option",{value:"date",children:"Received Time"}),o.jsx("option",{value:"created_at",children:"Processed Time"})]}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:X,title:n.sortOrder==="asc"?"Oldest First":"Newest First",children:o.jsx(Nx,{className:ke("w-3.5 h-3.5",n.sortOrder==="asc"&&"rotate-180")})})]})]}),o.jsxs("div",{className:"flex gap-1 flex-wrap",children:[o.jsx(Z,{size:"sm",variant:v===null?"secondary":"ghost",onClick:()=>_(null),children:"All"}),["spam","client","newsletter","support"].map(F=>o.jsx(Z,{size:"sm",variant:v===F?"secondary":"ghost",onClick:()=>_(F),className:"capitalize",children:F},F))]}),c?o.jsx(tN,{}):n.emails.length===0?o.jsxs(Et,{className:"p-20 text-center shadow-sm",children:[o.jsx("div",{className:"w-16 h-16 bg-primary/10 text-primary rounded-full flex items-center justify-center mx-auto mb-6",children:o.jsx(zd,{className:"w-8 h-8"})}),o.jsx("h3",{className:"text-lg font-medium",children:"No emails found"}),o.jsx("p",{className:"text-muted-foreground mt-2 mb-6",children:n.accounts.length===0?"Connect your email account to get started.":"Try syncing or adjusting your filters."}),n.accounts.length>0&&o.jsxs(Z,{onClick:()=>{l(),ue()},disabled:h,children:[o.jsx(kr,{className:ke("w-4 h-4 mr-2",h&&"animate-spin")}),"Sync Now"]})]}):o.jsxs(o.Fragment,{children:[n.emails.map(F=>o.jsx(l2,{email:F,onAction:Je,onViewTrace:nt,onSelect:()=>S(F),isSelected:x?.id===F.id,loadingAction:A[F.id],isDeletePending:k===F.id,onCancelDelete:be},F.id)),o.jsx(n2,{isOpen:q,onOpenChange:B,email:G}),n.emailsTotal>20&&o.jsxs("div",{className:"flex items-center justify-between pt-4",children:[o.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>Ze("prev"),disabled:n.emailsOffset===0,children:[o.jsx(Ux,{className:"w-4 h-4 mr-1"}),"Previous"]}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[n.emailsOffset+1," - ",Math.min(n.emailsOffset+20,n.emailsTotal)," of ",n.emailsTotal]}),o.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>Ze("next"),disabled:n.emailsOffset+20>=n.emailsTotal,children:["Next",o.jsx(Bx,{className:"w-4 h-4 ml-1"})]})]})]})]}),o.jsxs("aside",{className:"space-y-6",children:[x&&o.jsxs(Et,{className:"p-6 border-primary/20 bg-primary/5 animate-in slide-in-from-right-5",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("h3",{className:"font-semibold",children:"Email Details"}),o.jsx(Z,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>S(null),children:o.jsx(Fi,{className:"w-4 h-4"})})]}),o.jsxs("div",{className:"space-y-3 text-sm",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"From:"}),o.jsx("p",{className:"font-medium truncate",children:x.sender})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Subject:"}),o.jsx("p",{className:"font-medium",children:x.subject})]}),x.ai_analysis&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Summary:"}),o.jsx("p",{className:"text-xs mt-1",children:x.ai_analysis.summary})]}),x.ai_analysis.key_points&&o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Key Points:"}),o.jsx("ul",{className:"text-xs mt-1 list-disc list-inside",children:x.ai_analysis.key_points.map((F,U)=>o.jsx("li",{children:F},U))})]}),x.ai_analysis.draft_response&&o.jsxs("div",{className:"mt-4 p-3 bg-emerald-500/5 border border-emerald-500/20 rounded-lg",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2 text-emerald-600 dark:text-emerald-400",children:[o.jsx(zw,{className:"w-3.5 h-3.5"}),o.jsx("span",{className:"text-xs font-bold uppercase",children:"AI Draft Reply"})]}),o.jsx("p",{className:"text-xs leading-relaxed whitespace-pre-wrap italic text-foreground/80",children:x.ai_analysis.draft_response}),o.jsxs("p",{className:"mt-2 text-[9px] text-muted-foreground",children:["* This draft is already saved in your ",x.email_accounts?.provider==="gmail"?"Gmail":"Outlook"," Drafts folder."]})]})]})]})]}),o.jsx(i2,{accounts:n.accounts,onUpdate:a.updateAccount,onSync:a.triggerSync,settings:n.settings,onUpdateSettings:a.updateSettings,openTerminal:l}),o.jsxs(Et,{className:"p-6",children:[o.jsxs("h3",{className:"font-semibold mb-4 flex items-center gap-2",children:[o.jsx(vy,{className:"w-4 h-4 text-primary"}),"Sync History"]}),o.jsx("div",{className:"space-y-4",children:!n.stats?.recentSyncs||n.stats.recentSyncs.length===0?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No sync history available."}):n.stats.recentSyncs.slice(0,5).map(F=>o.jsxs("div",{className:"flex justify-between items-start text-sm border-b last:border-0 pb-3 last:pb-0",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:ke("w-1.5 h-1.5 rounded-full",F.status==="success"?"bg-emerald-500":F.status==="running"?"bg-blue-500 animate-pulse":"bg-red-500")}),o.jsxs("p",{className:"font-medium text-xs",children:[new Date(F.started_at).toLocaleDateString()," ",new Date(F.started_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),o.jsxs("p",{className:"text-[10px] text-muted-foreground pl-3.5",children:["Processed: ",o.jsx("span",{className:"font-medium text-foreground",children:F.emails_processed})," • Actioned: ",o.jsx("span",{className:"font-medium text-foreground",children:F.emails_deleted+F.emails_drafted})]}),F.error_message&&o.jsx("p",{className:"text-[10px] text-destructive pl-3.5 line-clamp-1",title:F.error_message,children:F.error_message})]}),o.jsx("div",{className:"text-[10px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded",children:F.status==="running"?"Running":F.completed_at?`${Math.round((new Date(F.completed_at).getTime()-new Date(F.started_at).getTime())/1e3)}s`:"..."})]},F.id))})]}),o.jsxs(Et,{className:"p-6",children:[o.jsx("h3",{className:"font-semibold mb-4",children:"Quick Stats"}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Processed"}),o.jsx("span",{className:"font-medium",children:n.emailsTotal})]}),o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Connected Accounts"}),o.jsx("span",{className:"font-medium",children:n.accounts.length})]}),o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:"Active Rules"}),o.jsx("span",{className:"font-medium",children:n.rules.filter(F=>F.is_enabled).length})]})]})]})]})]})}function i2({accounts:n,onUpdate:a,onSync:r,settings:l,onUpdateSettings:c,openTerminal:d}){const[h,m]=w.useState(null),[p,g]=w.useState(!1),v=x=>{if(!x)return"";const S=typeof x=="string"&&/^\d+$/.test(x)?parseInt(x):x,A=new Date(S);if(isNaN(A.getTime()))return"";const j=k=>k<10?"0"+k:k;return A.getFullYear()+"-"+j(A.getMonth()+1)+"-"+j(A.getDate())+"T"+j(A.getHours())+":"+j(A.getMinutes())},_=async(x,S)=>{m(x),await a(x,S),m(null)};return n.length===0?null:o.jsxs(Et,{className:"p-6",children:[o.jsxs("h3",{className:"font-semibold mb-4 flex items-center gap-2",children:[o.jsx(Bw,{className:"w-4 h-4 text-primary"}),"Sync Scope"]}),o.jsx("div",{className:"space-y-6",children:n.map(x=>o.jsxs("div",{className:"space-y-3 pb-4 border-b last:border-0 last:pb-0",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx("span",{className:"text-xs font-medium truncate max-w-[150px]",title:x.email_address,children:x.email_address}),o.jsxs("div",{className:"flex items-center gap-1",children:[x.last_sync_status==="syncing"?o.jsx($t,{className:"w-3 h-3 text-primary animate-spin"}):x.last_sync_status==="success"?o.jsx(sf,{className:"w-3 h-3 text-emerald-500"}):x.last_sync_status==="error"?o.jsx("span",{title:x.last_sync_error||"Error",children:o.jsx(Rr,{className:"w-3 h-3 text-destructive"})}):null,o.jsx(Z,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>{d(),r(x.id)},disabled:x.last_sync_status==="syncing",children:o.jsx(kr,{className:ke("w-3 h-3",x.last_sync_status==="syncing"&&"animate-spin")})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-6 w-6 text-muted-foreground hover:text-orange-500",title:"Reset Checkpoint (Force Full Re-sync from Start Date)",onClick:()=>a(x.id,{last_sync_checkpoint:null}),disabled:x.last_sync_status==="syncing",children:o.jsx(vy,{className:"w-3 h-3"})})]})]}),o.jsxs("div",{className:"grid grid-cols-[1.5fr_1fr] gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(Ax,{className:"w-2.5 h-2.5"})," Sync From"]}),o.jsx(Te,{type:"datetime-local",className:"h-7 text-[10px] px-2 py-0 w-full",value:x.sync_start_date?v(x.sync_start_date):x.last_sync_checkpoint?v(x.last_sync_checkpoint):x.last_sync_at?v(x.last_sync_at):"",onChange:S=>_(x.id,{sync_start_date:S.target.value?new Date(S.target.value).toISOString():null}),disabled:h===x.id})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(iw,{className:"w-2.5 h-2.5"})," Max Emails"]}),o.jsx(Te,{type:"number",className:"h-7 text-[10px] px-2 py-0",value:x.sync_max_emails_per_run||50,onChange:S=>_(x.id,{sync_max_emails_per_run:parseInt(S.target.value,10)||50}),disabled:h===x.id})]})]}),x.last_sync_at&&o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:["Last sync: ",new Date(x.last_sync_at).toLocaleString()]}),x.last_sync_error&&o.jsxs("p",{className:"text-[9px] text-destructive italic line-clamp-1",title:x.last_sync_error,children:["Error: ",x.last_sync_error]})]},x.id))})]})}function l2({email:n,onAction:a,onViewTrace:r,onSelect:l,isSelected:c,loadingAction:d,isDeletePending:h,onCancelDelete:m}){if(!n)return null;const p=s2[n.category||"other"],g=!!d,v=()=>{if(!n.email_accounts)return"#";const{provider:_,email_address:x}=n.email_accounts;return _==="gmail"?`https://mail.google.com/mail/u/${x}/#all/${n.external_id}`:`https://outlook.office.com/mail/deeplink/read/${encodeURIComponent(n.external_id)}`};return o.jsx(Et,{className:ke("hover:shadow-md transition-shadow group cursor-pointer",c&&"ring-2 ring-primary"),onClick:l,children:o.jsxs("div",{className:"p-5",children:[o.jsxs("div",{className:"flex justify-between items-start mb-3",children:[o.jsxs("div",{className:"flex gap-3",children:[o.jsx("div",{className:ke("w-8 h-8 rounded-full flex items-center justify-center font-bold text-white text-xs",n.category==="spam"?"bg-destructive":"bg-primary"),children:n.sender?.[0]?.toUpperCase()||"?"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"font-semibold text-sm line-clamp-1 group-hover:text-primary transition-colors",children:n.subject||"No Subject"}),o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:n.sender})]})]}),o.jsxs("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[o.jsx("span",{className:ke("px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider",p),children:n.category||"unknown"}),o.jsxs("div",{className:"flex items-center justify-end gap-1",children:[n.processing_status==="pending"&&o.jsxs("span",{className:"text-[9px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx(Ar,{className:"w-2.5 h-2.5"})," Queued"]}),n.processing_status==="processing"&&o.jsxs("span",{className:"text-[9px] text-blue-600 dark:text-blue-400 bg-blue-500/10 border border-blue-500/20 px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx($t,{className:"w-2.5 h-2.5 animate-spin"})," Analyzing"]}),n.processing_status==="completed"&&o.jsxs("span",{className:"text-[9px] text-emerald-600 dark:text-emerald-400 bg-emerald-500/10 border border-emerald-500/20 px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx(Bi,{className:"w-2.5 h-2.5"})," Analyzed"]}),n.processing_status==="failed"&&o.jsxs("span",{className:"text-[9px] text-red-600 dark:text-red-400 bg-red-500/10 border border-red-500/20 px-1.5 py-0.5 rounded flex items-center gap-1",title:n.processing_error||"Unknown error",children:[o.jsx(Rr,{className:"w-2.5 h-2.5"})," Failed"]}),!n.processing_status&&!n.ai_analysis&&o.jsxs("span",{className:"text-[9px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx($t,{className:"w-2.5 h-2.5 animate-spin"})," Pending"]}),!n.processing_status&&n.ai_analysis&&o.jsxs("span",{className:"text-[9px] text-emerald-600 dark:text-emerald-400 bg-emerald-500/10 border border-emerald-500/20 px-1.5 py-0.5 rounded flex items-center gap-1",children:[o.jsx(Bi,{className:"w-2.5 h-2.5"})," Analyzed"]})]}),o.jsxs("div",{className:"flex flex-col items-end text-[10px] text-muted-foreground/80 leading-tight",children:[o.jsxs("span",{title:n.date?new Date(n.date).toLocaleString():"",children:[o.jsx("span",{className:"opacity-70",children:"Rec:"})," ",n.date?new Date(n.date).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-"]}),o.jsxs("span",{title:new Date(n.created_at).toLocaleString(),children:[o.jsx("span",{className:"opacity-70",children:"Proc:"})," ",new Date(n.created_at).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})]})]})]})]}),o.jsx("p",{className:"text-muted-foreground text-sm mb-4 line-clamp-2 leading-relaxed",children:n.body_snippet}),o.jsxs("div",{className:"bg-secondary/30 p-3 rounded-lg border border-border/50 flex justify-between items-center",children:[o.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium",children:[o.jsx(Ld,{className:"w-3.5 h-3.5 text-emerald-500"}),"Suggested:",n.suggested_actions&&n.suggested_actions.length>0?o.jsx("div",{className:"flex gap-1 flex-wrap",children:n.suggested_actions.map(_=>o.jsx("span",{className:"text-foreground border border-border/50 px-1.5 py-0.5 rounded capitalize bg-background/50",children:_},_))}):o.jsx("span",{className:"text-foreground",children:n.suggested_action||"none"}),n.actions_taken&&n.actions_taken.length>0?o.jsxs("span",{className:"text-muted-foreground ml-2 truncate max-w-[100px]",title:n.actions_taken.join(", "),children:["(Done: ",n.actions_taken.join(", "),")"]}):n.action_taken?o.jsxs("span",{className:"text-muted-foreground ml-2",children:["(Done: ",n.action_taken,")"]}):null]}),o.jsx("div",{className:"flex gap-1 items-center",onClick:_=>_.stopPropagation(),children:h?o.jsxs("div",{className:"flex items-center gap-1 animate-in fade-in duration-200",children:[o.jsx("span",{className:"text-xs text-destructive mr-1",children:"Delete?"}),o.jsx(Z,{variant:"destructive",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>a(n,"delete"),disabled:g,children:d==="delete"?o.jsx($t,{className:"w-3 h-3 animate-spin"}):"Yes"}),o.jsx(Z,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:m,disabled:g,children:"No"})]}):o.jsxs(o.Fragment,{children:[o.jsx("a",{href:v(),target:"_blank",rel:"noreferrer",className:"inline-flex items-center justify-center h-7 w-7 rounded-md text-muted-foreground hover:text-primary hover:bg-secondary/50 transition-colors",title:`Open in ${n.email_accounts?.provider==="gmail"?"Gmail":"Outlook"}`,children:o.jsx($i,{className:"w-3.5 h-3.5"})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-primary",onClick:()=>r(n),title:"View AI Trace (Prompt/Response)",children:o.jsx(aw,{className:"w-3.5 h-3.5"})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-destructive",onClick:()=>a(n,"delete"),disabled:g,title:"Delete",children:d==="delete"?o.jsx($t,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(Oo,{className:"w-3.5 h-3.5"})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-blue-500",onClick:()=>a(n,"archive"),disabled:g,title:"Archive",children:d==="archive"?o.jsx($t,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(wx,{className:"w-3.5 h-3.5"})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-primary",onClick:()=>a(n,"flag"),disabled:g,title:"Flag",children:d==="flag"?o.jsx($t,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(sw,{className:"w-3.5 h-3.5"})})]})})]})]})})}function o2(){const{state:n,actions:a}=Lr(),[r,l]=w.useState(!1),[c,d]=w.useState(!1),[h,m]=w.useState(null),[p,g]=w.useState(!1),[v,_]=w.useState(!1),[x,S]=w.useState({}),[A,j]=w.useState(!1),[k,R]=w.useState("credentials"),[q,B]=w.useState(""),[G,ee]=w.useState(""),[J,P]=w.useState(""),[X,ue]=w.useState(""),[Je,be]=w.useState(!1),[ge,Ze]=w.useState(!1),[nt,F]=w.useState(!1),[U,Q]=w.useState("credentials"),[K,je]=w.useState(""),[Re,T]=w.useState(""),[V,Y]=w.useState(!1),[W,fe]=w.useState(!1),[ye,de]=w.useState(""),[Ge,Ue]=w.useState("category"),[Tt,mt]=w.useState("newsletter"),[vt,an]=w.useState(["archive"]),[la,nn]=w.useState(""),[ps,gs]=w.useState(""),[Br,Oa]=w.useState([]),[sn,ys]=w.useState(!1),[el,tl]=w.useState(!1),[pt,vs]=w.useState(null),[ga,zn]=w.useState(null);w.useEffect(()=>{a.fetchAccounts(),a.fetchRules(),a.fetchSettings()},[]),w.useEffect(()=>{n.settings&&S(n.settings)},[n.settings]);const bs=async()=>{const O=n.rules.find(te=>te.name==="Auto-Trash Spam");if(!O){re.error("System rule not found. Please sync your database.");return}vs("auto_trash_spam"),await a.toggleRule(O.id),vs(null)},Ko=async()=>{const O=n.rules.find(te=>te.name==="Smart Drafts");if(!O){re.error("System rule not found. Please sync your database.");return}vs("smart_drafts"),await a.toggleRule(O.id),vs(null)},xs=O=>{zn(O),de(O.name);const te=O.condition,At=Object.keys(te).filter(qn=>qn!=="older_than_days")[0]||"category";Ue(At),mt(te[At]||""),nn(te.older_than_days?.toString()||"");const js=O.actions&&O.actions.length>0?O.actions:O.action?[O.action]:["archive"];an(js),gs(O.instructions||""),Oa(O.attachments||[]),fe(!0)},Yo=w.useRef(null),Jo=()=>{R("credentials"),B(""),ee(""),P(""),ue(""),j(!0)},Un=O=>{B(O);try{const te=JSON.parse(O),Se=te.installed||te.web||te;Se.client_id&&ee(Se.client_id),Se.client_secret&&P(Se.client_secret),te.installed?re.success("Detected Desktop app credentials"):te.web&&re.info("Detected Web app - make sure redirect URI is configured in Google Cloud Console")}catch{}},kt=async()=>{if(!G||!J){re.error("Please provide both Client ID and Client Secret");return}be(!0);try{if(await a.updateSettings({...x,google_client_id:G,google_client_secret:J})){S(Se=>({...Se,google_client_id:G,google_client_secret:J}));const te=await qe.getGmailAuthUrl();if(te.data?.url)window.open(te.data.url,"_blank"),R("code"),re.success("Please authorize in the opened tab, then paste the code here");else{const Se=typeof te.error=="string"?te.error:te.error?.message;re.error(Se||"Failed to get OAuth URL")}}else re.error("Failed to save credentials")}catch{re.error("Failed to save credentials")}finally{be(!1)}},ya=async()=>{if(!X.trim()){re.error("Please paste the authorization code");return}Ze(!0);try{const O=await qe.connectGmail(X.trim());if(O.data?.success)re.success("Gmail account connected successfully!"),j(!1),a.fetchAccounts();else{const te=typeof O.error=="string"?O.error:O.error?.message;re.error(te||"Failed to connect Gmail")}}catch{re.error("Failed to connect Gmail")}finally{Ze(!1)}},Ot=()=>{Q("credentials"),je(""),T(""),F(!0)},Xo=async()=>{if(!K){re.error("Please provide the Client ID");return}Y(!0);try{if(await a.updateSettings({...x,microsoft_client_id:K,microsoft_tenant_id:Re||"common"})){S(Se=>({...Se,microsoft_client_id:K,microsoft_tenant_id:Re||"common"}));const te=await qe.startMicrosoftDeviceFlow();if(te.data)m(te.data),Q("device-code"),Qo(te.data.deviceCode,te.data.interval);else{const Se=typeof te.error=="string"?te.error:te.error?.message;re.error(Se||"Failed to start device flow")}}else re.error("Failed to save credentials")}catch{re.error("Failed to save credentials")}finally{Y(!1)}},Qo=async(O,te)=>{const Se=setInterval(async()=>{try{const At=await qe.pollMicrosoftDeviceCode(O);At.data?.status==="completed"?(clearInterval(Se),m(null),d(!1),F(!1),re.success("Outlook account connected"),a.fetchAccounts()):At.error&&typeof At.error=="object"&&At.error.code}catch{}},te*1e3);setTimeout(()=>{clearInterval(Se),c&&(m(null),d(!1),F(!1),re.error("Connection timed out. Please try again."))},900*1e3)},Zo=async()=>{if(!ye){re.error("Please name your rule");return}if(vt.length===0){re.error("Please select at least one action");return}tl(!0);try{const O={[Ge]:Tt};la&&(O.older_than_days=parseInt(la,10));const te=vt.includes("draft"),Se={name:ye,condition:O,actions:vt,instructions:te?ps:void 0,attachments:te?Br:[],is_enabled:!0};let At=!1;ga?At=await a.updateRule(ga.id,Se):At=await a.createRule(Se),At?(re.success(ga?"Rule updated":"Rule created"),fe(!1),zn(null),de(""),an(["archive"]),nn(""),gs(""),Oa([]),a.fetchRules()):re.error(`Failed to ${ga?"update":"create"} rule`)}catch{re.error("An error occurred while saving the rule")}finally{tl(!1)}},ws=async O=>{if(!confirm("Are you sure you want to disconnect this account?"))return;await a.disconnectAccount(O)&&re.success("Account disconnected")},Ln=async()=>{g(!0);const O=await a.updateSettings(x);g(!1),O&&re.success("Settings saved")},_s=async()=>{_(!0);try{const O=await qe.testLlm({llm_model:x.llm_model||null,llm_base_url:x.llm_base_url||null,llm_api_key:x.llm_api_key||null});O.data?.success?re.success(O.data.message):re.error(O.data?.message||"Connection test failed")}catch{re.error("Failed to test connection")}finally{_(!1)}},Ra=async O=>{await a.toggleRule(O)},Ss=async O=>{const te=O.target.files;if(!te||te.length===0)return;ys(!0);const Se=te[0],At=Se.name.split(".").pop(),js=`${Math.random().toString(36).substring(2)}.${At}`,qn=`${n.user.id}/${js}`;try{const{error:$n}=await ct.storage.from("rule-attachments").upload(qn,Se);if($n)throw $n;const qr={name:Se.name,path:qn,type:Se.type,size:Se.size};Oa($r=>[...$r,qr]),re.success("File uploaded")}catch($n){console.error("Upload error:",$n),re.error("Failed to upload file")}finally{ys(!1),O.target.value=""}},Bn=O=>{Oa(te=>te.filter(Se=>Se.path!==O))},Fo=O=>O==="gmail"?o.jsx("div",{className:"w-10 h-10 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center text-red-600 dark:text-red-400 font-bold",children:"G"}):o.jsx("div",{className:"w-10 h-10 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center text-blue-600 dark:text-blue-400 font-bold",children:"O"});return o.jsxs("div",{className:"space-y-8 animate-in fade-in duration-500",children:[o.jsx(ds,{open:A,onOpenChange:j,children:o.jsxs(fs,{className:"sm:max-w-lg",children:[o.jsxs(Aa,{children:[o.jsxs(Ca,{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-8 h-8 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center text-red-600 dark:text-red-400 font-bold text-sm",children:"G"}),"Connect Gmail Account"]}),o.jsx(ka,{children:k==="credentials"?"Enter your Google OAuth credentials to connect your Gmail account.":"Paste the authorization code from Google to complete the connection."})]}),k==="credentials"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(Jw,{className:"w-4 h-4"}),"Paste credentials.json"]}),o.jsx("textarea",{className:"w-full h-24 p-3 text-xs font-mono border rounded-lg bg-secondary/30 resize-none focus:outline-none focus:ring-2 focus:ring-primary",placeholder:'{"installed":{"client_id":"...","client_secret":"..."}}',value:q,onChange:O=>Un(O.target.value)}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Download from Google Cloud Console → APIs & Services → Credentials"})]}),o.jsxs("div",{className:"relative",children:[o.jsx("div",{className:"absolute inset-0 flex items-center",children:o.jsx("span",{className:"w-full border-t"})}),o.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:o.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"or enter manually"})})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client ID"}),o.jsx(Te,{placeholder:"xxx.apps.googleusercontent.com",value:G,onChange:O=>ee(O.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client Secret"}),o.jsx(Te,{type:"password",placeholder:"GOCSPX-...",value:J,onChange:O=>P(O.target.value)})]})]})]}),o.jsxs(_r,{children:[o.jsx(Z,{variant:"outline",onClick:()=>j(!1),children:"Cancel"}),o.jsxs(Z,{onClick:kt,disabled:Je||!G||!J,children:[Je?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(Sa,{className:"w-4 h-4 mr-2"}),"Save & Connect"]})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsx("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:o.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["1. A new tab opened with Google Sign-In",o.jsx("br",{}),"2. Sign in and authorize the app",o.jsx("br",{}),"3. Copy the authorization code shown",o.jsx("br",{}),"4. Paste it below"]})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Authorization Code"}),o.jsx(Te,{placeholder:"4/0AQlEd8x...",value:X,onChange:O=>ue(O.target.value),className:"font-mono"})]})]}),o.jsxs(_r,{children:[o.jsx(Z,{variant:"outline",onClick:()=>R("credentials"),children:"Back"}),o.jsxs(Z,{onClick:ya,disabled:ge||!X.trim(),children:[ge?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(Sa,{className:"w-4 h-4 mr-2"}),"Connect"]})]})]})]})}),o.jsx(ds,{open:nt,onOpenChange:F,children:o.jsxs(fs,{className:"sm:max-w-lg",children:[o.jsxs(Aa,{children:[o.jsxs(Ca,{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-8 h-8 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center text-blue-600 dark:text-blue-400 font-bold text-sm",children:"O"}),"Connect Outlook Account"]}),o.jsx(ka,{children:U==="credentials"?"Enter your Microsoft Azure App credentials to connect your Outlook account.":"Follow the instructions to authorize the application."})]}),U==="credentials"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsx("div",{className:"p-4 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg",children:o.jsx("p",{className:"text-sm text-yellow-800 dark:text-yellow-200",children:"Note: You need an Azure App Registration for this to work."})}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client ID (Application ID)"}),o.jsx(Te,{placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",value:K,onChange:O=>je(O.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Tenant ID (Optional)"}),o.jsx(Te,{placeholder:"common",value:Re,onChange:O=>T(O.target.value)}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:'Default is "common". Use your specific Tenant ID for organization accounts.'})]})]})]}),o.jsxs(_r,{children:[o.jsx(Z,{variant:"outline",onClick:()=>F(!1),children:"Cancel"}),o.jsxs(Z,{onClick:Xo,disabled:V||!K,children:[V?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(Sa,{className:"w-4 h-4 mr-2"}),"Save & Connect"]})]})]}):o.jsxs(o.Fragment,{children:[h&&o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[o.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:"Action Required"}),o.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200 mb-4",children:h.message}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("div",{className:"flex items-center gap-2 bg-white dark:bg-black/20 p-2 rounded border border-blue-200 dark:border-blue-800",children:o.jsx("code",{className:"text-lg font-mono font-bold flex-1 text-center select-all",children:h.userCode})}),o.jsxs(Z,{variant:"default",className:"w-full bg-blue-600 hover:bg-blue-700",onClick:()=>window.open(h.verificationUri,"_blank"),children:["Open Microsoft Login",o.jsx($i,{className:"w-4 h-4 ml-2"})]})]})]}),o.jsx("div",{className:"flex justify-center",children:o.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[o.jsx(ht,{size:"sm"}),"Waiting for authorization..."]})})]}),o.jsx(_r,{children:o.jsx(Z,{variant:"outline",onClick:()=>F(!1),children:"Cancel"})})]})]})}),o.jsx(ds,{open:W,onOpenChange:O=>{fe(O),O||zn(null)},children:o.jsxs(fs,{className:"sm:max-w-xl max-h-[90vh] flex flex-col p-0",children:[o.jsxs(Aa,{className:"p-6 border-b",children:[o.jsx(Ca,{children:ga?"Edit Auto-Pilot Rule":"Create Auto-Pilot Rule"}),o.jsx(ka,{children:"Define a condition based on AI analysis to trigger an action."})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6 custom-scrollbar",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Rule Name"}),o.jsx(Te,{placeholder:"e.g. Archive Newsletters",value:ye,onChange:O=>de(O.target.value)})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"If Condition Field"}),o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Ge,onChange:O=>{Ue(O.target.value),O.target.value==="category"?mt("newsletter"):O.target.value==="sentiment"?mt("Positive"):O.target.value==="priority"?mt("High"):mt("")},children:[o.jsxs("optgroup",{label:"AI Analysis",children:[o.jsx("option",{value:"category",children:"Category"}),o.jsx("option",{value:"sentiment",children:"Sentiment"}),o.jsx("option",{value:"priority",children:"Priority"})]}),o.jsxs("optgroup",{label:"Metadata",children:[o.jsx("option",{value:"sender_email",children:"Specific Email (Exact)"}),o.jsx("option",{value:"sender_domain",children:"Email Domain (@...)"}),o.jsx("option",{value:"sender_contains",children:"Sender contains..."}),o.jsx("option",{value:"subject_contains",children:"Subject contains..."}),o.jsx("option",{value:"body_contains",children:"Body contains..."})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Equals Value"}),Ge==="category"?o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Tt,onChange:O=>mt(O.target.value),children:[o.jsx("option",{value:"newsletter",children:"Newsletter"}),o.jsx("option",{value:"spam",children:"Spam"}),o.jsx("option",{value:"promotional",children:"Promotional"}),o.jsx("option",{value:"transactional",children:"Transactional"}),o.jsx("option",{value:"social",children:"Social"}),o.jsx("option",{value:"support",children:"Support"}),o.jsx("option",{value:"client",children:"Client"}),o.jsx("option",{value:"internal",children:"Internal"}),o.jsx("option",{value:"personal",children:"Personal"}),o.jsx("option",{value:"other",children:"Other"})]}):Ge==="sentiment"?o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Tt,onChange:O=>mt(O.target.value),children:[o.jsx("option",{value:"Positive",children:"Positive"}),o.jsx("option",{value:"Neutral",children:"Neutral"}),o.jsx("option",{value:"Negative",children:"Negative"})]}):Ge==="priority"?o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Tt,onChange:O=>mt(O.target.value),children:[o.jsx("option",{value:"High",children:"High"}),o.jsx("option",{value:"Medium",children:"Medium"}),o.jsx("option",{value:"Low",children:"Low"})]}):o.jsx(Te,{placeholder:Ge==="sender_domain"?"rta.vn":Ge==="sender_email"?"john@example.com":"Keywords...",value:Tt,onChange:O=>mt(O.target.value)})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(Ar,{className:"w-4 h-4"}),"Only if email is older than... (Optional)"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Te,{type:"number",min:"0",placeholder:"0",className:"w-24",value:la,onChange:O=>nn(O.target.value)}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"days"})]}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Leave empty or 0 to apply rule immediately upon receipt."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Then Perform Action(s)"}),o.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Select one or more actions to execute when the rule matches"}),o.jsx("div",{className:"grid grid-cols-2 gap-2",children:[{value:"archive",label:"Archive Email"},{value:"delete",label:"Delete Email"},{value:"draft",label:"Draft Reply"},{value:"read",label:"Mark as Read"},{value:"star",label:"Star / Flag"}].map(O=>o.jsxs("label",{className:`flex items-center gap-2 p-2 border rounded-md cursor-pointer transition-colors ${vt.includes(O.value)?"bg-primary/10 border-primary":"bg-background hover:bg-secondary/50"}`,children:[o.jsx("input",{type:"checkbox",checked:vt.includes(O.value),onChange:te=>{te.target.checked?an([...vt,O.value]):an(vt.filter(Se=>Se!==O.value))},className:"rounded border-gray-300"}),o.jsx("span",{className:"text-sm",children:O.label})]},O.value))})]}),vt.includes("draft")&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-2 animate-in slide-in-from-top-2 duration-200",children:[o.jsx("label",{className:"text-sm font-medium",children:"Draft Instructions (Context)"}),o.jsx("textarea",{className:"w-full p-2 border rounded-md bg-background min-h-[80px] text-sm",placeholder:"e.g. Tell them I'm busy until Friday, but interested in the proposal.",value:ps,onChange:O=>gs(O.target.value)}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Specific context for the AI ghostwriter."})]}),o.jsxs("div",{className:"space-y-2 animate-in slide-in-from-top-2 duration-200",children:[o.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(xg,{className:"w-4 h-4"}),"Attachments (Optional)"]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[Br.map(O=>o.jsxs("div",{className:"flex items-center justify-between p-2 bg-secondary/50 rounded border text-xs",children:[o.jsx("span",{className:"truncate max-w-[200px]",children:O.name}),o.jsx(Z,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-destructive",onClick:()=>Bn(O.path),children:o.jsx(Fi,{className:"w-3 h-3"})})]},O.path)),o.jsxs("div",{className:"relative",children:[o.jsx("input",{type:"file",className:"absolute inset-0 opacity-0 cursor-pointer",onChange:Ss,disabled:sn}),o.jsxs(Z,{variant:"outline",size:"sm",className:"w-full border-dashed",disabled:sn,children:[sn?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(Ri,{className:"w-3 h-3 mr-2"}),sn?"Uploading...":"Add Attachment"]})]})]}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Files will be attached to every draft generated by this rule."})]})]})]}),o.jsxs(_r,{className:"p-6 border-t bg-secondary/5",children:[o.jsx(Z,{variant:"outline",onClick:()=>fe(!1),children:"Cancel"}),o.jsxs(Z,{onClick:Zo,disabled:el,children:[el?o.jsx(ht,{size:"sm",className:"mr-2"}):ga?o.jsx(Sa,{className:"w-4 h-4 mr-2"}):o.jsx(Ri,{className:"w-4 h-4 mr-2"}),ga?"Save Changes":"Create Rule"]})]})]})}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[o.jsxs(Et,{children:[o.jsxs(Na,{children:[o.jsxs(Ea,{className:"flex items-center gap-2",children:[o.jsx(qi,{className:"w-5 h-5 text-primary"}),"Connected Accounts"]}),o.jsx(Wa,{children:"Manage your email providers"})]}),o.jsxs(Ta,{className:"space-y-4",children:[n.accounts.length===0?o.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No accounts connected yet"}):n.accounts.map(O=>o.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg bg-card",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[Fo(O.provider),o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium capitalize",children:O.provider}),o.jsx("p",{className:"text-xs text-muted-foreground",children:O.email_address})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[O.is_active?o.jsx("span",{className:"text-xs text-emerald-600 bg-emerald-500/10 px-2 py-1 rounded-full",children:"Active"}):o.jsx("span",{className:"text-xs text-yellow-600 bg-yellow-500/10 px-2 py-1 rounded-full",children:"Inactive"}),o.jsx(Z,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>ws(O.id),children:o.jsx(Oo,{className:"w-4 h-4"})})]})]},O.id)),o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs(Z,{className:"w-full border-dashed",variant:"outline",onClick:Jo,disabled:r||c,children:[r?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(Ri,{className:"w-4 h-4 mr-2"}),"Connect Gmail Account"]}),o.jsxs(Z,{className:"w-full border-dashed",variant:"outline",onClick:Ot,disabled:r||c,children:[c&&!h?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(Ri,{className:"w-4 h-4 mr-2"}),"Connect Outlook Account"]})]}),h&&o.jsxs("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg animate-in slide-in-from-top-2",children:[o.jsx("h4",{className:"font-medium text-blue-900 dark:text-blue-100 mb-2",children:"Microsoft Sign-In Required"}),o.jsx("p",{className:"text-sm text-blue-800 dark:text-blue-200 mb-4",children:h.message}),o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("div",{className:"flex items-center gap-2 bg-white dark:bg-black/20 p-2 rounded border border-blue-200 dark:border-blue-800",children:o.jsx("code",{className:"text-lg font-mono font-bold flex-1 text-center select-all",children:h.userCode})}),o.jsxs(Z,{variant:"default",className:"w-full bg-blue-600 hover:bg-blue-700",onClick:()=>window.open(h.verificationUri,"_blank"),children:["Open Microsoft Login",o.jsx($i,{className:"w-4 h-4 ml-2"})]}),o.jsx("p",{className:"text-xs text-center text-muted-foreground mt-2",children:"Waiting for you to sign in..."})]})]})]})]}),o.jsxs(Et,{children:[o.jsxs(Na,{children:[o.jsxs(Ea,{className:"flex items-center gap-2",children:[o.jsx(Ld,{className:"w-5 h-5 text-emerald-500"}),"Auto-Pilot Rules"]}),o.jsx(Wa,{children:"Configure AI automation behavior"})]}),o.jsxs(Ta,{className:"space-y-4",children:[o.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-border",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium text-sm",children:"Auto-Trash Spam"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Automatically delete emails categorized as spam"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>{const O=n.rules.find(te=>te.name==="Auto-Trash Spam");O&&xs(O)},title:"Edit Logic",children:o.jsx(md,{className:"w-4 h-4 text-muted-foreground"})}),o.jsxs(Z,{variant:n.rules.find(O=>O.name==="Auto-Trash Spam")?.is_enabled?"default":"outline",size:"sm",onClick:bs,disabled:pt==="auto_trash_spam",children:[pt==="auto_trash_spam"?o.jsx(ht,{size:"sm",className:"mr-1"}):o.jsx(pd,{className:"w-4 h-4 mr-1"}),n.rules.find(O=>O.name==="Auto-Trash Spam")?.is_enabled?"On":"Off"]})]})]}),o.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-border",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium text-sm",children:"Smart Drafts"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Generate draft replies for important emails"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>{const O=n.rules.find(te=>te.name==="Smart Drafts");O&&xs(O)},title:"Edit Logic",children:o.jsx(md,{className:"w-4 h-4 text-muted-foreground"})}),o.jsxs(Z,{variant:n.rules.find(O=>O.name==="Smart Drafts")?.is_enabled?"default":"outline",size:"sm",onClick:Ko,disabled:pt==="smart_drafts",children:[pt==="smart_drafts"?o.jsx(ht,{size:"sm",className:"mr-1"}):o.jsx(pd,{className:"w-4 h-4 mr-1"}),n.rules.find(O=>O.name==="Smart Drafts")?.is_enabled?"On":"Off"]})]})]}),o.jsxs("div",{className:"pt-2",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("h4",{className:"text-sm font-medium",children:"Custom Rules"}),o.jsxs(Z,{variant:"ghost",size:"sm",onClick:()=>{zn(null),de(""),an(["archive"]),nn(""),gs(""),Oa([]),fe(!0)},children:[o.jsx(Ri,{className:"w-4 h-4 mr-1"})," Add Rule"]})]}),n.rules.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-2 border border-dashed rounded-lg",children:"No custom rules yet"}),n.rules.length>0&&n.rules.filter(O=>O.name!=="Auto-Trash Spam"&&O.name!=="Smart Drafts").map(O=>{const te=O.actions&&O.actions.length>0?O.actions:O.action?[O.action]:[];return o.jsxs("div",{className:"p-3 bg-secondary/30 rounded-lg mb-2",children:[o.jsxs("div",{className:"flex justify-between items-center mb-1",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-sm font-medium",children:O.name}),o.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:["→ ",te.join(" + ")]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Z,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>xs(O),title:"Edit Rule",children:o.jsx(md,{className:"w-3.5 h-3.5 text-muted-foreground"})}),o.jsxs(Z,{variant:O.is_enabled?"default":"outline",size:"sm",onClick:()=>Ra(O.id),className:"h-7 px-2",children:[o.jsx(pd,{className:"w-3.5 h-3.5 mr-1"}),O.is_enabled?"On":"Off"]}),o.jsx(Z,{variant:"ghost",size:"sm",className:"text-destructive",onClick:()=>a.deleteRule(O.id),children:o.jsx(Oo,{className:"w-3 h-3"})})]})]}),O.instructions&&o.jsxs("p",{className:"text-[10px] text-muted-foreground italic border-t border-border/50 pt-1 mt-1 truncate",children:['"',O.instructions,'"']}),O.attachments&&O.attachments.length>0&&o.jsx("div",{className:"flex gap-1 mt-1",children:O.attachments.map(Se=>o.jsxs("div",{className:"flex items-center gap-1 text-[9px] bg-blue-500/10 text-blue-400 px-1.5 py-0.5 rounded border border-blue-500/20",children:[o.jsx(xg,{className:"w-2.5 h-2.5"}),Se.name]},Se.path))})]},O.id)})]})]})]})]}),o.jsxs(Et,{children:[o.jsxs(Na,{children:[o.jsxs(Ea,{className:"flex items-center gap-2",children:[o.jsx(kr,{className:"w-5 h-5 text-indigo-500"}),"Model Configuration"]}),o.jsx(Wa,{children:"Configure Local LLM or API settings"})]}),o.jsxs(Ta,{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Model Name"}),o.jsx(Te,{placeholder:"gpt-4o-mini",value:x.llm_model||"",onChange:O=>S(te=>({...te,llm_model:O.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Base URL"}),o.jsx(Te,{placeholder:"https://api.openai.com/v1",value:x.llm_base_url||"",onChange:O=>S(te=>({...te,llm_base_url:O.target.value}))}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Use http://localhost:11434/v1 for Ollama"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"API Key"}),o.jsx(Te,{type:"password",placeholder:"sk-...",value:x.llm_api_key||"",onChange:O=>S(te=>({...te,llm_api_key:O.target.value}))})]})]}),o.jsxs("div",{className:"space-y-2 pt-2 border-t border-border/50",children:[o.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(qi,{className:"w-4 h-4"}),"Local Storage Path (.eml)"]}),o.jsx(Te,{placeholder:"./data/emails",value:x.storage_path||"",onChange:O=>S(te=>({...te,storage_path:O.target.value}))}),o.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"Absolute or relative path where raw emails will be saved before analysis. Default: ./data/emails"})]}),o.jsxs("div",{className:"space-y-2 pt-2 border-t border-border/50",children:[o.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[o.jsx(Ar,{className:"w-4 h-4"}),"Background Sync Interval (minutes)"]}),o.jsx(Te,{type:"number",min:1,max:1440,value:x.sync_interval_minutes||5,onChange:O=>S(te=>({...te,sync_interval_minutes:parseInt(O.target.value,10)||5}))}),o.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"How often the system checks for new emails in the background."})]}),o.jsxs("div",{className:"flex justify-end mt-4 gap-2",children:[o.jsxs(Z,{variant:"outline",onClick:_s,disabled:v,children:[v?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(kr,{className:"w-4 h-4 mr-2"}),"Check Connection"]}),o.jsxs(Z,{onClick:Ln,disabled:p,children:[p?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(Sa,{className:"w-4 h-4 mr-2"}),"Save Configuration"]})]})]})]}),o.jsx("div",{ref:Yo,children:o.jsxs(Et,{children:[o.jsxs(Na,{children:[o.jsxs(Ea,{className:"flex items-center gap-2",children:[o.jsx(Ld,{className:"w-5 h-5 text-orange-500"}),"Provider Credentials (Advanced)"]}),o.jsx(Wa,{children:"Bring Your Own Keys (BYOK). Configure your own OAuth credentials here. Leave empty to use system defaults."})]}),o.jsxs(Ta,{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-4 border-b pb-4",children:[o.jsxs("h4",{className:"font-medium flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full bg-red-500"})," Google / Gmail"]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client ID"}),o.jsx(Te,{type:"password",placeholder:"...apps.googleusercontent.com",value:x.google_client_id||"",onChange:O=>S(te=>({...te,google_client_id:O.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client Secret"}),o.jsx(Te,{type:"password",placeholder:"GOCSPX-...",value:x.google_client_secret||"",onChange:O=>S(te=>({...te,google_client_secret:O.target.value}))})]})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("h4",{className:"font-medium flex items-center gap-2",children:[o.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-500"})," Microsoft / Outlook"]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client ID"}),o.jsx(Te,{type:"password",value:x.microsoft_client_id||"",onChange:O=>S(te=>({...te,microsoft_client_id:O.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client Secret (Optional)"}),o.jsx(Te,{type:"password",value:x.microsoft_client_secret||"",onChange:O=>S(te=>({...te,microsoft_client_secret:O.target.value}))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Tenant ID"}),o.jsx(Te,{placeholder:"common",value:x.microsoft_tenant_id||"",onChange:O=>S(te=>({...te,microsoft_tenant_id:O.target.value}))})]})]})]}),o.jsx("div",{className:"flex justify-end mt-4",children:o.jsxs(Z,{onClick:Ln,disabled:p,variant:"secondary",children:[p?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(Sa,{className:"w-4 h-4 mr-2"}),"Save Credentials"]})})]})]})})]})}const c2="modulepreload",u2=function(n){return"/"+n},hy={},d2=function(a,r,l){let c=Promise.resolve();if(r&&r.length>0){let g=function(v){return Promise.all(v.map(_=>Promise.resolve(_).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};var h=g;document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),p=m?.nonce||m?.getAttribute("nonce");c=g(r.map(v=>{if(v=u2(v),v in hy)return;hy[v]=!0;const _=v.endsWith(".css"),x=_?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${v}"]${x}`))return;const S=document.createElement("link");if(S.rel=_?"stylesheet":c2,_||(S.as="script"),S.crossOrigin="",S.href=v,p&&S.setAttribute("nonce",p),document.head.appendChild(S),_)return new Promise((A,j)=>{S.addEventListener("load",A),S.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${v}`)))})}))}function d(m){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=m,window.dispatchEvent(p),!p.defaultPrevented)throw m}return c.then(m=>{for(const p of m||[])p.status==="rejected"&&d(p.reason);return a().catch(d)})};function f2(){const[n,a]=w.useState("profile"),{state:r,actions:l}=Lr();w.useEffect(()=>{l.fetchProfile()},[]);const c=[{id:"profile",label:"Profile",icon:by},{id:"security",label:"Security",icon:Hw},{id:"database",label:"Supabase",icon:qi}];return o.jsxs("div",{className:"max-w-4xl mx-auto space-y-6 animate-in fade-in duration-500",children:[o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Account Settings"}),o.jsx("p",{className:"text-muted-foreground",children:"Manage your profile, security, and connection preferences."})]}),o.jsxs("div",{className:"flex flex-col md:flex-row gap-8",children:[o.jsx("aside",{className:"w-full md:w-64 space-y-1",children:c.map(d=>{const h=d.icon,m=n===d.id;return o.jsxs("button",{onClick:()=>a(d.id),className:`w-full flex items-center gap-3 px-4 py-2 text-sm font-medium rounded-lg transition-colors ${m?"bg-primary text-primary-foreground":"hover:bg-secondary text-muted-foreground"}`,children:[o.jsx(h,{className:"w-4 h-4"}),d.label]},d.id)})}),o.jsxs("div",{className:"flex-1 space-y-6",children:[n==="profile"&&o.jsx(h2,{}),n==="security"&&o.jsx(m2,{}),n==="database"&&o.jsx(p2,{})]})]})]})}function h2(){const{state:n,actions:a}=Lr(),[r,l]=w.useState(""),[c,d]=w.useState(""),[h,m]=w.useState(!1),[p,g]=w.useState(!1),[v,_]=w.useState(Er.isEnabled());w.useEffect(()=>{n.profile&&(l(n.profile.first_name||""),d(n.profile.last_name||""))},[n.profile]);const x=()=>{const j=!v;Er.setEnabled(j),_(j),j?(Er.playSuccess(),re.success("Sound effects enabled")):re.info("Sound effects disabled")},S=async()=>{m(!0);const j=await a.updateProfile({first_name:r,last_name:c});m(!1),j&&re.success("Profile updated")},A=async j=>{const k=j.target.files?.[0];if(!(!k||!n.user)){g(!0);try{const R=k.name.split(".").pop(),q=`${n.user.id}/avatar.${R}`,{data:B,error:G}=await ct.storage.from("avatars").upload(q,k,{upsert:!0});if(G)throw G;const{data:{publicUrl:ee}}=ct.storage.from("avatars").getPublicUrl(q);await a.updateProfile({avatar_url:ee}),re.success("Avatar updated")}catch(R){console.error("Avatar upload error:",R),re.error("Failed to upload avatar")}finally{g(!1)}}};return o.jsxs(Et,{children:[o.jsxs(Na,{children:[o.jsx(Ea,{children:"Profile Information"}),o.jsx(Wa,{children:"Update your personal details and avatar."})]}),o.jsxs(Ta,{className:"space-y-6",children:[o.jsxs("div",{className:"flex flex-col items-center sm:flex-row sm:items-start gap-6",children:[o.jsxs("div",{className:"relative group",children:[o.jsx("div",{className:"w-24 h-24 rounded-full bg-secondary overflow-hidden border-2 border-border flex items-center justify-center",children:n.profile?.avatar_url?o.jsx("img",{src:n.profile.avatar_url,alt:"Avatar",className:"w-full h-full object-cover"}):o.jsx(by,{className:"w-12 h-12 text-muted-foreground"})}),o.jsxs("label",{className:"absolute inset-0 flex items-center justify-center bg-black/40 rounded-full opacity-0 group-hover:opacity-100 cursor-pointer transition-opacity",children:[o.jsx(kx,{className:"w-6 h-6 text-white"}),o.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:A,disabled:p})]}),p&&o.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/60 rounded-full",children:o.jsx(ht,{size:"sm"})})]}),o.jsxs("div",{className:"flex-1 space-y-4 w-full",children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ma,{htmlFor:"first-name",children:"First Name"}),o.jsx(Te,{id:"first-name",value:r,onChange:j=>l(j.target.value),placeholder:"John"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ma,{htmlFor:"last-name",children:"Last Name"}),o.jsx(Te,{id:"last-name",value:c,onChange:j=>d(j.target.value),placeholder:"Doe"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ma,{htmlFor:"email",children:"Email Address"}),o.jsx(Te,{id:"email",value:n.profile?.email||"",disabled:!0,className:"bg-secondary/50"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Email cannot be changed directly."})]})]})]}),o.jsxs("div",{className:"pt-6 border-t flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("label",{className:"text-sm font-medium",children:"Sound & Haptics"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Audio feedback when processing emails and completing tasks."})]}),o.jsxs(Z,{variant:v?"default":"outline",size:"sm",onClick:x,className:"gap-2",children:[v?o.jsx(Ww,{className:"w-4 h-4"}):o.jsx(t_,{className:"w-4 h-4"}),v?"Enabled":"Disabled"]})]}),o.jsx("div",{className:"flex justify-end pt-4 border-t",children:o.jsxs(Z,{onClick:S,disabled:h,children:[h?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(Ow,{className:"w-4 h-4 mr-2"}),"Save Changes"]})})]})]})}function m2(){const[n,a]=w.useState(""),[r,l]=w.useState(""),[c,d]=w.useState(!1),h=async()=>{if(!n){re.error("Please enter a new password");return}if(n!==r){re.error("Passwords do not match");return}if(n.length<6){re.error("Password must be at least 6 characters");return}d(!0);try{const{api:m}=await d2(async()=>{const{api:g}=await Promise.resolve().then(()=>Hj);return{api:g}},void 0),p=await m.changePassword(n);p.success?(re.success("Password changed successfully"),a(""),l("")):re.error(p.error?.message||"Failed to change password")}catch{re.error("An error occurred")}finally{d(!1)}};return o.jsxs(Et,{children:[o.jsxs(Na,{children:[o.jsx(Ea,{children:"Security"}),o.jsx(Wa,{children:"Manage your password and account security."})]}),o.jsxs(Ta,{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(ma,{htmlFor:"new-password",children:"New Password"}),o.jsx(Te,{id:"new-password",type:"password",value:n,onChange:m=>a(m.target.value),placeholder:"••••••••"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(ma,{htmlFor:"confirm-password",children:"Confirm New Password"}),o.jsx(Te,{id:"confirm-password",type:"password",value:r,onChange:m=>l(m.target.value),placeholder:"••••••••"})]}),o.jsx("div",{className:"flex justify-end pt-4 border-t",children:o.jsxs(Z,{onClick:h,disabled:c,children:[c?o.jsx(ht,{size:"sm",className:"mr-2"}):o.jsx(dw,{className:"w-4 h-4 mr-2"}),"Update Password"]})})]})]})}function p2(){const[n,a]=w.useState(!1),r=Ur(),l=Bj(),c=()=>{confirm("Are you sure you want to disconnect from this Supabase project? This will log you out and clear local configuration.")&&(Lj(),window.location.reload())};return o.jsxs(o.Fragment,{children:[o.jsxs(Et,{children:[o.jsxs(Na,{children:[o.jsxs(Ea,{className:"flex items-center gap-2",children:[o.jsx(qi,{className:"w-5 h-5 text-primary"}),"Supabase Connection"]}),o.jsx(Wa,{children:"Manage your database configuration (BYOK - Bring Your Own Keys)."})]}),o.jsx(Ta,{className:"space-y-6",children:r?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-start gap-4 p-4 border rounded-xl bg-emerald-500/5 border-emerald-500/20",children:[o.jsx(nf,{className:"w-6 h-6 text-emerald-500 mt-0.5"}),o.jsxs("div",{className:"flex-1 space-y-1",children:[o.jsx("p",{className:"font-semibold text-emerald-700 dark:text-emerald-400",children:"Connected"}),o.jsx("p",{className:"text-sm font-mono break-all opacity-80",children:r.url})]})]}),l==="env"&&o.jsxs(Qi,{className:"bg-amber-500/5 border-amber-500/20",children:[o.jsx(Ud,{className:"h-4 w-4 text-amber-500"}),o.jsx(Zi,{className:"text-amber-700 dark:text-amber-400 text-xs",children:"Configuration is loaded from environment variables. Use the UI to override them."})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[o.jsxs(Z,{variant:"outline",onClick:()=>a(!0),className:"w-full",children:[o.jsx(Ud,{className:"w-4 h-4 mr-2"}),"Change Connection"]}),l==="ui"&&o.jsxs(Z,{variant:"outline",onClick:c,className:"w-full text-destructive hover:bg-destructive/10",children:[o.jsx(Oo,{className:"w-4 h-4 mr-2"}),"Clear Config"]})]}),o.jsxs("div",{className:"space-y-2 pt-4 border-t",children:[o.jsx(ma,{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Anon Public Key"}),o.jsxs("div",{className:"p-2 bg-secondary/50 rounded-lg font-mono text-xs break-all",children:[r.anonKey.substring(0,20),"...",r.anonKey.substring(r.anonKey.length-10)]})]})]}):o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center space-y-4",children:[o.jsx(Yx,{className:"w-12 h-12 text-destructive opacity-20"}),o.jsxs("div",{children:[o.jsx("p",{className:"font-medium",children:"No Connection Detected"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure a Supabase project to get started."})]}),o.jsxs(Z,{onClick:()=>a(!0),children:[o.jsx(qi,{className:"w-4 h-4 mr-2"}),"Setup Supabase"]})]})})]}),o.jsx(Vv,{open:n,onComplete:()=>a(!1),canClose:!0})]})}function g2({length:n=6,value:a,onChange:r,onComplete:l,disabled:c=!1,error:d=!1}){const h=w.useRef([]),[m,p]=w.useState(null),g=(x,S)=>{const A=S.replace(/[^0-9]/g,"");if(A.length===0){const R=a.split("");R[x]=" ",a.split("");let q=a.split("");x<q.length&&q.splice(x,1);const B=q.join("");r(B),x>0&&h.current[x-1]?.focus();return}a.split("");const j=[...a];j[x]=A[0],r(j.join("")),x<n-1&&h.current[x+1]?.focus();const k=j.join("");k.length===n&&l&&l(k)},v=(x,S)=>{S.key==="Backspace"&&!a[x]&&x>0||S.key==="ArrowLeft"&&x>0?h.current[x-1]?.focus():S.key==="ArrowRight"&&x<n-1&&h.current[x+1]?.focus()},_=x=>{x.preventDefault();const A=x.clipboardData.getData("text/plain").replace(/[^0-9]/g,"").slice(0,n);r(A);const j=Math.min(A.length,n-1);h.current[j]?.focus(),A.length===n&&l&&l(A)};return o.jsx("div",{className:"flex gap-2 justify-center",children:Array.from({length:n}).map((x,S)=>o.jsx(Te,{ref:A=>{h.current[S]=A},type:"text",inputMode:"numeric",maxLength:1,value:a[S]||"",onChange:A=>g(S,A.target.value),onKeyDown:A=>v(S,A),onPaste:_,onFocus:()=>p(S),onBlur:()=>p(null),disabled:c,className:ke("w-10 h-10 sm:w-12 sm:h-12 text-center text-lg font-semibold px-0",d&&"border-destructive focus-visible:ring-destructive",m===S&&"ring-2 ring-ring"),"aria-label":`Digit ${S+1}`},S))})}function y2({onSuccess:n,onConfigure:a}){const[r,l]=w.useState(""),[c,d]=w.useState(""),[h,m]=w.useState(""),[p,g]=w.useState(""),[v,_]=w.useState(!1),[x,S]=w.useState(!0),[A,j]=w.useState(!1),[k,R]=w.useState(""),[q,B]=w.useState("password"),[G,ee]=w.useState("email"),[J,P]=w.useState("");w.useEffect(()=>{X()},[]);const X=async()=>{try{const{data:be,error:ge}=await ct.from("init_state").select("is_initialized");if(ge){console.warn("[Login] Init check failed, defaulting to initialized (Login):",ge),j(!0);return}const Ze=be?.[0]?.is_initialized>0;j(Ze)}catch(be){if(console.warn("[Login] Init check exception, defaulting to initialized:",be),be.message?.includes("Invalid API key")||be.status===401){console.warn("[Login] API Key invalid for REST check (likely Publishable Key). defaulting to Setup Mode (isInitialized=false)."),j(!1);return}j(!0)}finally{S(!1)}},ue=async be=>{be.preventDefault(),_(!0),R("");try{if(A){if(q==="password"){const{error:ge}=await ct.auth.signInWithPassword({email:r,password:c});if(ge)throw ge;re.success("Logged in successfully"),n?.()}else if(G==="email"){const{error:ge}=await ct.auth.signInWithOtp({email:r,options:{shouldCreateUser:!1}});if(ge)throw ge;ee("verify"),re.success("Validation code sent to your email")}}else{const{data:ge,error:Ze}=await ct.functions.invoke("setup",{body:{email:r,password:c,first_name:h,last_name:p}});if(Ze||!ge){if(Ze?.message?.includes("First user already exists")){re.info("System already initialized. Please log in."),j(!0);return}throw new Error(Ze?.message||"Failed to create admin account")}re.success("Admin account created! Signing you in...");const{error:nt}=await ct.auth.signInWithPassword({email:r,password:c});if(nt)throw nt;j(!0),n?.()}}catch(ge){R(ge?.message||"Authentication failed"),console.error("[Login] Error:",ge)}finally{_(!1)}},Je=async()=>{_(!0),R("");try{const{data:be,error:ge}=await ct.auth.verifyOtp({email:r,token:J,type:"magiclink"});if(ge)throw ge;if(!be.session)throw new Error("Failed to create session");re.success("Logged in successfully"),n?.()}catch(be){R(be?.message||"Invalid code")}finally{_(!1)}};return x?o.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:o.jsx($t,{className:"w-8 h-8 animate-spin text-primary"})}):o.jsxs("div",{className:"min-h-screen bg-background flex items-center justify-center p-8 relative",children:[o.jsx("div",{className:"absolute top-4 right-4",children:o.jsx(By,{})}),o.jsxs(Et,{className:"w-full max-w-md shadow-2xl",children:[o.jsxs(Na,{className:"text-center",children:[o.jsx("div",{className:"mx-auto bg-primary/10 p-4 rounded-full w-fit mb-4",children:o.jsx(gf,{className:"w-12 h-12"})}),o.jsx(Ea,{className:"text-2xl",children:A?"Welcome Back":"Welcome to Email Automator"}),o.jsx(Wa,{children:A?q==="password"?"Sign in to access your email automation":G==="email"?"Receive a login code via email":`Enter code sent to ${r}`:"Create the first admin account to get started"})]}),o.jsxs("form",{onSubmit:ue,children:[o.jsxs(Ta,{className:"space-y-4",children:[!A&&o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"First Name"}),o.jsx(Te,{value:h,onChange:be=>m(be.target.value),required:!A,placeholder:"John"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Last Name"}),o.jsx(Te,{value:p,onChange:be=>g(be.target.value),required:!A,placeholder:"Doe"})]})]}),q==="password"||G==="email"?o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Email"}),o.jsx(Te,{type:"email",placeholder:"admin@example.com",value:r,onChange:be=>l(be.target.value),required:!0,autoComplete:"email",disabled:G==="verify"})]}):null,q==="password"&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Password"}),o.jsx(Te,{type:"password",placeholder:"••••••••",value:c,onChange:be=>d(be.target.value),required:!0,minLength:6,autoComplete:A?"current-password":"new-password"})]}),q==="otp"&&G==="verify"&&o.jsxs("div",{className:"space-y-4 py-2",children:[o.jsx("div",{className:"flex justify-center",children:o.jsx(g2,{value:J,onChange:P,length:6,onComplete:()=>{}})}),o.jsx(Z,{type:"button",variant:"link",className:"w-full text-xs text-muted-foreground",onClick:()=>ee("email"),children:"Change email address"})]}),o.jsxs("div",{className:"bg-destructive/10 text-destructive text-sm p-3 rounded-md flex flex-col gap-2",children:[o.jsx("p",{children:k}),k.includes("configuration")||k.includes("Invalid API key")||k.includes("API key")&&a&&o.jsx(Z,{type:"button",variant:"outline",className:"w-full border-destructive/50 hover:bg-destructive/20 text-destructive",onClick:a,children:"Update Connection Settings"})]})]}),o.jsxs(uv,{className:"flex flex-col gap-3",children:[q==="otp"&&G==="verify"?o.jsx(Z,{type:"button",onClick:Je,disabled:v||J.length!==6,className:"w-full",children:v?o.jsxs(o.Fragment,{children:[o.jsx($t,{className:"w-4 h-4 mr-2 animate-spin"}),"Verifying..."]}):"Verify Code"}):o.jsx(Z,{type:"submit",disabled:v||!r||q==="password"&&!c,className:"w-full",children:v?o.jsxs(o.Fragment,{children:[o.jsx($t,{className:"w-4 h-4 mr-2 animate-spin"}),A?q==="otp"?"Send Code":"Signing in...":"Creating Account..."]}):o.jsxs(o.Fragment,{children:[A?q==="otp"?o.jsx(zd,{className:"w-4 h-4 mr-2"}):o.jsx(gw,{className:"w-4 h-4 mr-2"}):o.jsx(Qw,{className:"w-4 h-4 mr-2"}),A?q==="otp"?"Send Login Code":"Sign In":"Create Admin Account"]})}),A&&o.jsx("div",{className:"flex flex-col gap-2 w-full",children:q==="password"?o.jsxs(Z,{type:"button",variant:"ghost",className:"w-full text-sm font-normal text-muted-foreground hover:text-primary",onClick:()=>{B("otp"),ee("email"),R("")},children:[o.jsx(cw,{className:"w-4 h-4 mr-2"}),"Sign in with Code"]}):o.jsxs(Z,{type:"button",variant:"ghost",className:"w-full text-sm font-normal text-muted-foreground hover:text-primary",onClick:()=>{B("password"),R("")},children:[o.jsx(Sx,{className:"w-4 h-4 mr-2"}),"Sign in with Password"]})}),A&&o.jsx("p",{className:"text-xs text-center text-muted-foreground mt-2",children:"New users must be invited by an admin."})]})]})]})]})}const Iv=void 0,v2=void 0;function b2(n,a){const r=n.split(".").map(Number),l=a.split(".").map(Number);for(let c=0;c<Math.max(r.length,l.length);c++){const d=r[c]||0,h=l[c]||0;if(d>h)return 1;if(d<h)return-1}return 0}async function x2(n){try{const{data:a,error:r}=await n.rpc("get_latest_migration_timestamp");return r?(console.warn("Could not get latest migration timestamp:",r.message),{version:null,latestMigrationTimestamp:null}):{version:Iv,latestMigrationTimestamp:a||null}}catch(a){return console.error("Error checking database migration info:",a),{version:null,latestMigrationTimestamp:null}}}async function w2(n){const a=Iv,r=v2,l=await x2(n);if(console.log("[Migration Check]",{appVersion:a,appMigrationTimestamp:r,dbVersion:l.version,dbMigrationTimestamp:l.latestMigrationTimestamp}),l.latestMigrationTimestamp&&l.latestMigrationTimestamp.trim()!==""){const c=r,d=l.latestMigrationTimestamp;return c>d?{needsMigration:!0,appVersion:a,dbVersion:l.version,message:`New migrations available. Database is at ${d}, app has ${c}.`}:c<d?(console.warn("[Migration Check] DB is ahead of app - possible downgrade"),{needsMigration:!1,appVersion:a,dbVersion:l.version,message:`Database (${d}) is ahead of app (${c}).`}):(console.log("[Migration Check] Timestamps match - database is up-to-date"),{needsMigration:!1,appVersion:a,dbVersion:l.version,message:"Database schema is up-to-date."})}if(l.version){console.log("[Migration Check] Legacy DB detected (no timestamp). Falling back to SemVer.");const c=b2(a,l.version);return c>0?{needsMigration:!0,appVersion:a,dbVersion:l.version,message:`Database schema (v${l.version}) is outdated. Migration to v${a} required.`}:c===0?(console.warn("[Migration Check] Legacy DB with matching version - forcing migration to add timestamp tracking"),{needsMigration:!0,appVersion:a,dbVersion:l.version,message:`Database lacks timestamp tracking. Please run migration to upgrade to modern schema (v${a}).`}):{needsMigration:!1,appVersion:a,dbVersion:l.version,message:`Database version (v${l.version}) is ahead of app (v${a}).`}}return console.log("[Migration Check] No DB info found - assuming migration needed"),{needsMigration:!0,appVersion:a,dbVersion:null,message:`Database schema unknown. Migration required to v${a}.`}}const Gv="email_automator_migration_reminder_dismissed_at";function _2(n=24){try{const a=localStorage.getItem(Gv);if(!a)return!1;const r=new Date(a).getTime();return(Date.now()-r)/(1e3*60*60)<n}catch(a){return console.error("Error checking migration reminder:",a),!1}}function S2(){try{localStorage.setItem(Gv,new Date().toISOString())}catch(n){console.error("Error dismissing migration reminder:",n)}}function j2({status:n,onDismiss:a,onLearnMore:r}){const[l,c]=w.useState(!0);if(!l)return null;const d=()=>{S2(),c(!1),a?.()},h=()=>{r?r():(navigator.clipboard.writeText("npx email-automator migrate"),re.success("Command copied to clipboard"))};return o.jsx("div",{className:"fixed right-4 top-16 z-50 max-w-sm animate-in slide-in-from-top-5",children:o.jsx("div",{className:"rounded-lg border border-yellow-500 bg-yellow-50 p-4 shadow-lg dark:bg-yellow-950/90 dark:border-yellow-600",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(Or,{className:"h-5 w-5 flex-shrink-0 text-yellow-600 dark:text-yellow-500 mt-0.5"}),o.jsxs("div",{className:"flex-1 space-y-2",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsx("p",{className:"text-sm font-medium text-yellow-900 dark:text-yellow-100",children:"Database Update Required"}),o.jsxs(Z,{size:"icon",variant:"ghost",className:"h-5 w-5 -mr-1 -mt-1 text-yellow-900 hover:bg-yellow-100 dark:text-yellow-100 dark:hover:bg-yellow-900/30",onClick:d,children:[o.jsx(Fi,{className:"h-3 w-3"}),o.jsx("span",{className:"sr-only",children:"Dismiss"})]})]}),o.jsxs("p",{className:"text-xs text-yellow-800 dark:text-yellow-200",children:["Your app version (",n.appVersion,") requires a database schema update."]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Z,{size:"sm",variant:"default",className:"h-7 text-xs bg-yellow-600 hover:bg-yellow-700 dark:bg-yellow-500 dark:hover:bg-yellow-600",onClick:h,children:"Update Now"}),o.jsx(Z,{size:"sm",variant:"ghost",className:"h-7 text-xs text-yellow-900 hover:bg-yellow-100 dark:text-yellow-100 dark:hover:bg-yellow-900/30",onClick:d,children:"Remind Later"})]})]})]})})})}function To({code:n,label:a}){const[r,l]=w.useState(!1),c=typeof navigator<"u"&&!!navigator.clipboard?.writeText,d=async()=>{if(!c){re.error("Clipboard not supported");return}try{await navigator.clipboard.writeText(n),l(!0),window.setTimeout(()=>l(!1),2e3),re.success("Copied to clipboard")}catch(h){console.error("Failed to copy:",h),re.error("Failed to copy to clipboard")}};return o.jsxs("div",{className:"relative",children:[a&&o.jsx("div",{className:"mb-2 text-sm font-medium text-muted-foreground",children:a}),o.jsxs("div",{className:"group relative",children:[o.jsx("pre",{className:"overflow-hidden rounded-md bg-muted p-3 pr-12 text-sm",children:o.jsx("code",{className:"block whitespace-pre-wrap break-all",children:n})}),o.jsxs(Z,{type:"button",size:"icon",variant:"ghost",className:"absolute right-2 top-2 h-8 w-8",onClick:d,disabled:!c,children:[r?o.jsx(Sa,{className:"h-4 w-4 text-green-600"}):o.jsx(Zx,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:r?"Copied":"Copy code"})]})]})]})}function N2({open:n,onOpenChange:a,status:r}){const l=Ur(),[c,d]=w.useState(!0),[h,m]=w.useState(!1),[p,g]=w.useState([]),[v,_]=w.useState(""),[x,S]=w.useState(""),A=w.useRef(null),j=w.useMemo(()=>{const R=l?.url;if(!R)return"";try{return new URL(R).hostname.split(".")[0]||""}catch{return""}},[l?.url]);w.useEffect(()=>{A.current&&A.current.scrollIntoView({behavior:"smooth"})},[p]);const k=async()=>{if(!j){re.error("Missing Project ID");return}m(!0),g(["Initializing migration..."]);try{const R=await fetch("/api/migrate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRef:j,dbPassword:v,accessToken:x})});if(!R.ok)throw new Error(`Server returned ${R.status}: ${R.statusText}`);const q=R.body?.getReader();if(!q)throw new Error("No response stream received.");const B=new TextDecoder;for(;;){const{done:G,value:ee}=await q.read();if(G)break;const P=B.decode(ee).split(`
|
|
96
|
+
`).filter(Boolean);g(X=>[...X,...P])}}catch(R){console.error(R),g(q=>[...q,`Error: ${R instanceof Error?R.message:String(R)}`]),re.error("Migration failed. Check logs for details.")}finally{m(!1)}};return o.jsx(ds,{open:n,onOpenChange:R=>!h&&a(R),children:o.jsxs(fs,{className:"max-h-[90vh] sm:max-w-5xl overflow-y-auto",children:[o.jsxs(Aa,{children:[o.jsxs(Ca,{className:"flex items-center gap-2 text-xl",children:[o.jsx(Or,{className:"h-6 w-6 text-red-700 dark:text-red-600"}),"Database Migration Required"]}),o.jsxs(ka,{children:["Your application version (",r.appVersion,") requires a database schema update to function correctly."]})]}),o.jsxs("div",{className:"space-y-6",children:[o.jsxs(Qi,{children:[o.jsx(Cr,{className:"h-4 w-4"}),o.jsxs(Zi,{children:[o.jsx("strong",{children:"Why is this needed?"}),o.jsxs("ul",{className:"mt-2 list-inside list-disc space-y-1 text-sm",children:[o.jsxs("li",{children:["Updates your database schema to match version ",r.appVersion]}),o.jsx("li",{children:"Enables new features and performance improvements"}),o.jsx("li",{children:"Your existing data will be preserved (safe migration)"})]})]})]}),o.jsxs("div",{className:"flex border-b",children:[o.jsx("button",{className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${c?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,onClick:()=>d(!0),children:"Automatic (Recommended)"}),o.jsx("button",{className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${c?"border-transparent text-muted-foreground hover:text-foreground":"border-primary text-primary"}`,onClick:()=>d(!1),children:"Manual CLI"})]}),c?o.jsxs("div",{className:"space-y-4 py-2",children:[o.jsxs("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm p-6",children:[o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Automated Migration"}),o.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Run the migration directly from your browser. Requires your database password."}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(ma,{htmlFor:"project-id",children:"Supabase Project ID"}),o.jsx(Te,{id:"project-id",value:j,disabled:!0,readOnly:!0,className:"bg-muted"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex justify-between items-center",children:[o.jsx(ma,{htmlFor:"access-token",children:"Access Token (Optional)"}),o.jsxs("a",{href:"https://supabase.com/dashboard/account/tokens",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline flex items-center gap-1",children:["Generate Token ",o.jsx($i,{className:"h-3 w-3"})]})]}),o.jsx(Te,{id:"access-token",type:"password",placeholder:"sbp_...",value:x,onChange:R=>S(R.target.value),disabled:h}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Recommended for more reliable authentication."})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(ma,{htmlFor:"db-password",children:"Database Password"}),o.jsx(Te,{id:"db-password",type:"password",placeholder:"Your database password",value:v,onChange:R=>_(R.target.value),disabled:h}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Required if no access token is provided."})]}),o.jsx(Z,{onClick:k,disabled:h,className:"w-full",children:h?o.jsxs(o.Fragment,{children:[o.jsx($t,{className:"mr-2 h-4 w-4 animate-spin"}),"Migrating..."]}):o.jsxs(o.Fragment,{children:[o.jsx(Bd,{className:"mr-2 h-4 w-4"}),"Start Migration"]})})]})]}),o.jsxs("div",{className:"rounded-lg border bg-black text-white font-mono text-xs p-4 h-64 overflow-y-auto",children:[p.length===0?o.jsx("div",{className:"text-gray-500 italic",children:"Waiting to start..."}):p.map((R,q)=>o.jsx("div",{className:"mb-1 whitespace-pre-wrap",children:R},q)),o.jsx("div",{ref:A})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsxs("h4",{className:"mb-3 flex items-center gap-2 font-semibold",children:[o.jsx("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",children:"1"}),"Prerequisites"]}),o.jsxs("div",{className:"ml-8 space-y-3",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"You will need the following before proceeding:"}),o.jsxs("ul",{className:"list-inside list-disc space-y-1 text-sm",children:[o.jsx("li",{children:"Supabase CLI installed"}),o.jsxs("li",{children:["Project ID:"," ",o.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:j||"your-project-id"})]}),o.jsx("li",{children:"Database Password"})]})]})]}),o.jsxs("div",{children:[o.jsxs("h4",{className:"mb-3 flex items-center gap-2 font-semibold",children:[o.jsx("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",children:"2"}),"Install Supabase CLI"]}),o.jsxs("div",{className:"ml-8 space-y-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium",children:"MacOS (Brew)"}),o.jsx(To,{code:"brew install supabase/tap/supabase"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium",children:"Windows (Scoop)"}),o.jsx(To,{code:`scoop bucket add supabase https://github.com/supabase/scoop-bucket.git
|
|
97
|
+
scoop install supabase`})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium",children:"NPM (Universal)"}),o.jsx(To,{code:"npm install -g supabase"})]})]})]}),o.jsxs("div",{children:[o.jsxs("h4",{className:"mb-3 flex items-center gap-2 font-semibold",children:[o.jsx("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",children:"3"}),"Run Migration"]}),o.jsxs("div",{className:"ml-8 space-y-3",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"Run the built-in migration tool:"}),o.jsx(To,{code:"npx email-automator migrate"})]})]})]}),o.jsxs(Qi,{className:"border-red-200 bg-red-50 dark:border-red-900/40 dark:bg-red-950/20",children:[o.jsx(Or,{className:"h-4 w-4 text-red-700 dark:text-red-600"}),o.jsxs(Zi,{children:[o.jsx("strong",{children:"Troubleshooting"}),o.jsxs("ul",{className:"mt-2 list-inside list-disc space-y-1 text-sm",children:[o.jsxs("li",{children:["Try logging out: ",o.jsx("code",{children:"supabase logout"})]}),o.jsx("li",{children:"Verify your database password is correct"})]})]})]})]}),o.jsx(_r,{children:o.jsx(Z,{type:"button",variant:"outline",onClick:()=>a(!1),disabled:h,children:"Close"})})]})})}function E2(){const[n,a]=w.useState([]),{isExpanded:r,setIsExpanded:l}=cv(),[c,d]=w.useState({});w.useEffect(()=>{h();const v=ct.channel("processing_events_feed").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events"},_=>{const x=_.new;x.event_type==="error"&&d(S=>({...S,[x.id]:!0})),a(S=>{const A=[x,...S];return A.length>100?A.slice(0,100):A})}).subscribe();return()=>{ct.removeChannel(v)}},[]);const h=async()=>{const{data:v}=await ct.from("processing_events").select("*").order("created_at",{ascending:!1}).limit(50);v&&a(v)},m=v=>{d(_=>({..._,[v]:!_[v]}))},p=v=>{switch(v){case"analysis":return o.jsx(Bi,{className:"w-3 h-3 text-purple-500"});case"action":return o.jsx(Ro,{className:"w-3 h-3 text-emerald-500"});case"error":return o.jsx(Or,{className:"w-3 h-3 text-red-500"});default:return o.jsx(Cr,{className:"w-3 h-3 text-blue-500"})}},g=v=>new Date(v).toLocaleTimeString([],{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"});return r?o.jsxs(Et,{className:"fixed bottom-4 right-4 z-50 w-[550px] h-[650px] flex flex-col shadow-2xl border-border bg-background/95 text-foreground backdrop-blur-md animate-in slide-in-from-bottom-10",children:[o.jsxs(Na,{className:"py-3 px-4 border-b border-border flex flex-row items-center justify-between sticky top-0 bg-background/95 z-20",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Bd,{className:"w-4 h-4 text-primary"}),o.jsx(Ea,{className:"text-sm font-mono font-bold",children:"Agent Terminal"}),o.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-green-600 dark:text-green-400 bg-green-500/10 px-2 py-0.5 rounded-full border border-green-500/20 font-bold",children:[o.jsx(bx,{className:"w-3 h-3"}),"LIVE"]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Z,{variant:"ghost",size:"sm",className:"h-7 text-[10px] font-mono hover:bg-secondary",onClick:()=>a([]),children:"Clear"}),o.jsx(Z,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 hover:bg-secondary",onClick:()=>l(!1),children:o.jsx(ww,{className:"w-4 h-4"})})]})]}),o.jsxs(Ta,{className:"flex-1 overflow-y-auto p-4 font-mono text-xs space-y-6 custom-scrollbar",children:[n.length===0&&o.jsx("div",{className:"text-center text-muted-foreground py-20 italic",children:"Waiting for agent activity..."}),n.map((v,_)=>o.jsxs("div",{className:"relative pl-8 animate-in fade-in slide-in-from-top-2 duration-300",children:[_!==n.length-1&&o.jsx("div",{className:"absolute left-[13px] top-7 bottom-[-24px] w-[1px] bg-border"}),o.jsx("div",{className:ke("absolute left-0 top-0 w-7 h-7 rounded-full border border-border bg-card flex items-center justify-center z-10 shadow-sm",v.event_type==="error"&&"border-red-500/50 bg-red-500/5",v.event_type==="analysis"&&"border-purple-500/50 bg-purple-500/5",v.event_type==="action"&&"border-emerald-500/50 bg-emerald-500/5"),children:p(v.event_type)}),o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center justify-between group",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:ke("font-bold uppercase tracking-tight text-[10px]",v.event_type==="info"&&"text-muted-foreground",v.event_type==="analysis"&&"text-purple-600 dark:text-purple-400",v.event_type==="action"&&"text-emerald-600 dark:text-emerald-400",v.event_type==="error"&&"text-red-600 dark:text-red-400"),children:v.agent_state}),o.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:g(v.created_at)})]}),(v.details?.system_prompt||v.details?._raw_response||v.details?.raw_response)&&o.jsxs(Z,{variant:"ghost",size:"sm",className:"h-5 px-1.5 text-[9px] text-muted-foreground hover:text-primary opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>m(v.id),children:[c[v.id]?o.jsx($x,{className:"w-3 h-3 mr-1"}):o.jsx(Mx,{className:"w-3 h-3 mr-1"}),"Details"]})]}),v.event_type==="analysis"&&v.details?o.jsxs("div",{className:"bg-purple-500/5 border border-purple-500/10 rounded-lg p-3 space-y-2",children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx("span",{className:ke("px-1.5 py-0.5 rounded text-[9px] font-bold border",v.details.is_useless?"bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20":"bg-green-500/10 text-green-600 dark:text-green-400 border-green-500/20"),children:v.details.is_useless?"USELESS":"RELEVANT"}),o.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-bold border bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20 uppercase",children:v.details.category})]}),o.jsxs("p",{className:"text-foreground/90 italic leading-relaxed",children:['"',v.details.summary,'"']}),v.details.suggested_actions&&v.details.suggested_actions.length>0&&o.jsx("div",{className:"pt-1 flex items-center gap-2 flex-wrap",children:v.details.suggested_actions.map(x=>o.jsxs("div",{className:"flex items-center gap-1 text-[9px] text-emerald-600 dark:text-emerald-400 font-bold bg-emerald-500/10 px-1.5 py-0.5 rounded border border-emerald-500/20 uppercase",children:[o.jsx(Ro,{className:"w-2.5 h-2.5"}),x]},x))})]}):v.event_type==="action"&&v.details?o.jsxs("div",{className:"bg-emerald-500/5 border border-emerald-500/10 rounded-lg p-3",children:[o.jsx("p",{className:"text-emerald-600 dark:text-emerald-400 font-bold mb-1 uppercase text-[9px] tracking-widest",children:"Execution Complete"}),o.jsxs("p",{className:"text-foreground font-medium",children:[v.details.action==="delete"&&"Moved to Trash",v.details.action==="archive"&&"Archived Email",v.details.action==="draft"&&"Drafted Reply",v.details.action==="read"&&"Marked as Read",v.details.action==="star"&&"Starred Email",!["delete","archive","draft","read","star"].includes(v.details.action)&&v.details.action]}),v.details.reason&&o.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1.5 flex items-center gap-1",children:[o.jsx(Cr,{className:"w-3 h-3"}),v.details.reason]})]}):v.event_type==="error"&&v.details?o.jsx("div",{className:"bg-red-500/5 border border-red-500/10 rounded-lg p-2.5 text-red-600 dark:text-red-400 font-medium",children:typeof v.details.error=="object"?v.details.error.message||JSON.stringify(v.details.error):v.details.error}):o.jsx("p",{className:"text-muted-foreground leading-relaxed",children:v.details?.message||JSON.stringify(v.details)}),c[v.id]&&o.jsxs("div",{className:"mt-2 space-y-3 animate-in fade-in zoom-in-95 duration-200",children:[v.details?.system_prompt&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[o.jsx(Sr,{className:"w-3 h-3"})," System Prompt"]}),o.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border overflow-x-auto",children:o.jsx("pre",{className:"whitespace-pre-wrap break-words text-[10px] leading-normal text-muted-foreground select-all",children:v.details.system_prompt})})]}),v.details?.content_preview&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[o.jsx(Sr,{className:"w-3 h-3"})," Input Content (Cleaned)"]}),o.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border",children:o.jsx("p",{className:"whitespace-pre-wrap break-words text-[10px] text-muted-foreground",children:v.details.content_preview})})]}),v.details?._raw_response&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[o.jsx(Sr,{className:"w-3 h-3"})," Raw LLM JSON Output"]}),o.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border overflow-x-auto",children:o.jsx("pre",{className:"text-[10px] text-muted-foreground select-all",children:JSON.stringify(JSON.parse(v.details._raw_response),null,2)})})]}),v.details?.raw_response&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold text-muted-foreground uppercase tracking-widest px-1",children:[o.jsx(Sr,{className:"w-3 h-3"})," Raw Response (from Error)"]}),o.jsx("div",{className:"bg-secondary/50 rounded-md p-3 border border-border overflow-x-auto",children:o.jsx("pre",{className:"text-[10px] text-muted-foreground select-all whitespace-pre-wrap",children:typeof v.details.raw_response=="object"?JSON.stringify(v.details.raw_response,null,2):v.details.raw_response})})]})]})]})]},v.id))]})]}):o.jsx("div",{className:"fixed bottom-4 right-4 z-50",children:o.jsxs(Z,{onClick:()=>l(!0),className:"shadow-lg bg-primary text-primary-foreground hover:opacity-90 border border-border",children:[o.jsx(Bd,{className:"w-4 h-4 mr-2"}),"Live Activity",n.length>0&&o.jsxs("span",{className:"ml-2 flex h-2 w-2 relative",children:[o.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),o.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]})]})})}function T2(){const{state:n,isSubscribed:a,actions:r}=Lr(),[l,c]=w.useState(!1),[d,h]=w.useState("dashboard"),[m,p]=w.useState(!0),[g,v]=w.useState(!1);if(w.useEffect(()=>{const P=new URLSearchParams(window.location.search).get("code");P&&!g&&(async()=>{v(!0);try{const ue=await qe.connectGmail(P);if(ue.data?.success)re.success("Gmail connected successfully!"),window.opener?setTimeout(()=>window.close(),1500):(window.history.replaceState({},"",window.location.pathname),r.fetchAccounts());else{const Je=typeof ue.error=="string"?ue.error:ue.error?.message;re.error(Je||"Failed to connect Gmail")}}catch{re.error("Connection failed")}finally{v(!1)}})()},[]),g)return o.jsx(Li,{text:"Connecting account..."});const[_,x]=w.useState(null),[S,A]=w.useState(!1),[j,k]=w.useState(!1),[R,q]=w.useState(!1);w.useEffect(()=>{(async()=>{const P=Ur();if(!P){c(!0),p(!1);return}if((await av(P.url,P.anonKey)).valid)n.isInitialized&&n.isAuthenticated&&(r.fetchAccounts(),r.fetchRules(),r.fetchSettings(),r.fetchProfile(),w2(ct).then(ue=>{x(ue),ue.needsMigration&&!_2()&&A(!0)}));else{c(!0),p(!1);return}p(!1)})()},[n.isInitialized,n.isAuthenticated]);const B=()=>{k(!0),A(!1)},G={migrationStatus:_,showMigrationBanner:S,showMigrationModal:j,openMigrationModal:B,suppressMigrationBanner:R,setSuppressMigrationBanner:q};if(m)return o.jsx(Li,{text:"Checking configuration..."});if(l)return o.jsx(Vv,{onComplete:()=>{c(!1),window.location.reload()}});if(!n.isInitialized)return o.jsx(Li,{text:"Initializing..."});if(!n.isAuthenticated)return o.jsx(y2,{onConfigure:()=>c(!0)});const ee=async()=>{await ct.auth.signOut(),re.success("Logged out successfully")};return o.jsx(Fj,{value:G,children:o.jsxs("div",{className:"min-h-screen bg-background font-sans text-foreground transition-colors duration-300",children:[o.jsx("header",{className:"sticky top-0 z-50 w-full border-b border-border/40 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:o.jsxs("div",{className:"max-w-7xl mx-auto flex h-16 items-center justify-between px-4 sm:px-8",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("button",{onClick:()=>h("dashboard"),className:"text-xl font-bold flex items-center gap-2 hover:opacity-80 transition-opacity",children:[o.jsx(gf,{className:"w-9 h-9"}),o.jsx("span",{className:"hidden sm:inline",children:"Email Automator"}),o.jsx("span",{className:"sm:hidden",children:"Email AI"})]}),o.jsxs("div",{className:ke("flex items-center gap-1.5 px-2 py-1 rounded-full text-[10px] font-bold border transition-colors",a?"bg-emerald-500/10 text-emerald-600 border-emerald-500/20 dark:text-emerald-400":"bg-yellow-500/10 text-yellow-600 border-yellow-500/20 dark:text-yellow-400"),children:[o.jsx("div",{className:ke("w-1.5 h-1.5 rounded-full",a?"bg-emerald-500 animate-pulse":"bg-yellow-500")}),o.jsx("span",{className:"hidden xs:inline",children:a?"LIVE":"OFFLINE"})]})]}),o.jsxs("div",{className:"flex gap-4 items-center",children:[o.jsxs("nav",{className:"flex items-center gap-1 bg-secondary/50 p-1 rounded-lg",children:[o.jsxs(Z,{variant:d==="dashboard"?"secondary":"ghost",size:"sm",onClick:()=>h("dashboard"),className:"gap-2",children:[o.jsx(hw,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Dashboard"})]}),o.jsxs(Z,{variant:d==="analytics"?"secondary":"ghost",size:"sm",onClick:()=>h("analytics"),className:"gap-2",children:[o.jsx(yy,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Analytics"})]}),o.jsxs(Z,{variant:d==="config"?"secondary":"ghost",size:"sm",onClick:()=>h("config"),className:"gap-2",children:[o.jsx(Ud,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Configuration"})]})]}),o.jsx("div",{className:"h-6 w-px bg-border/50 mx-2 hidden sm:block"}),o.jsx(By,{}),o.jsx(Z,{variant:d==="account"?"secondary":"ghost",size:"sm",onClick:()=>h("account"),className:"text-muted-foreground hover:text-foreground p-0 w-8 h-8 rounded-full overflow-hidden border",title:"Account Settings",children:n.profile?.avatar_url?o.jsx("img",{src:n.profile.avatar_url,alt:"Profile",className:"w-full h-full object-cover"}):o.jsx(Px,{className:"w-5 h-5"})}),o.jsx(Z,{variant:"ghost",size:"sm",onClick:ee,className:"text-muted-foreground hover:text-foreground",title:"Sign out",children:o.jsx(vw,{className:"w-4 h-4"})})]})]})}),o.jsxs("main",{className:"max-w-7xl mx-auto p-4 sm:p-8 mt-4",children:[d==="dashboard"&&o.jsx(r2,{}),d==="config"&&o.jsx(o2,{}),d==="analytics"&&o.jsx(C2,{}),d==="account"&&o.jsx(f2,{})]}),n.error&&o.jsx("div",{className:"fixed bottom-20 left-4 right-4 sm:left-auto sm:right-4 sm:max-w-sm z-50",children:o.jsx("div",{className:"bg-destructive/10 border border-destructive/20 text-destructive p-4 rounded-lg",children:o.jsx("p",{className:"text-sm",children:n.error})})}),_&&S&&!R&&o.jsx(j2,{status:_,onDismiss:()=>A(!1),onLearnMore:B}),_&&o.jsx(N2,{open:j,onOpenChange:k,status:_}),o.jsx(E2,{})]})})}function A2({runId:n,accountEmail:a,isOpen:r,onOpenChange:l}){const[c,d]=w.useState([]),[h,m]=w.useState(!1);w.useEffect(()=>{r&&n&&p()},[r,n]);const p=async()=>{if(n){m(!0);try{const v=await qe.getRunEvents(n);v.data&&d(v.data.events)}catch(v){console.error("Failed to fetch run trace:",v)}finally{m(!1)}}},g=v=>{switch(v){case"analysis":return o.jsx(Bi,{className:"w-4 h-4 text-purple-500"});case"action":return o.jsx(Ro,{className:"w-4 h-4 text-emerald-500"});case"error":return o.jsx(Rr,{className:"w-4 h-4 text-red-500"});default:return o.jsx(Cr,{className:"w-4 h-4 text-blue-500"})}};return o.jsx(ds,{open:r,onOpenChange:l,children:o.jsxs(fs,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 overflow-hidden",children:[o.jsxs(Aa,{className:"p-6 border-b",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(rf,{className:"w-5 h-5 text-primary"}),o.jsx(Ca,{children:"Sync Run Trace"})]}),o.jsx(ka,{children:a?`Full log for account: ${a}`:"Historical log for this synchronization run."})]}),o.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-6 custom-scrollbar bg-secondary/5",children:h?o.jsx("div",{className:"py-20 flex justify-center",children:o.jsx(Li,{text:"Loading trace..."})}):c.length===0?o.jsx("div",{className:"py-20 text-center text-muted-foreground italic font-mono text-sm",children:"No granular trace events found for this run."}):c.map((v,_)=>o.jsxs("div",{className:"relative pl-8",children:[_!==c.length-1&&o.jsx("div",{className:"absolute left-[15px] top-8 bottom-[-24px] w-px bg-border"}),o.jsx("div",{className:"absolute left-0 top-0 w-8 h-8 rounded-full border bg-background flex items-center justify-center z-10 shadow-sm",children:g(v.event_type)}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-foreground/70",children:v.agent_state}),v.emails?.subject&&o.jsxs("span",{className:"text-[10px] text-primary font-medium truncate max-w-[300px]",children:["Re: ",v.emails.subject]})]}),o.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(Ar,{className:"w-3 h-3"}),new Date(v.created_at).toLocaleTimeString()]})]}),o.jsxs("div",{className:"bg-card border rounded-lg p-4 shadow-sm",children:[v.event_type==="info"&&o.jsx("p",{className:"text-sm text-foreground/90",children:v.details?.message}),v.event_type==="analysis"&&o.jsxs("div",{className:"space-y-2",children:[o.jsxs("p",{className:"text-xs text-foreground italic leading-relaxed",children:['"',v.details?.summary,'"']}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("span",{className:"text-[9px] bg-secondary px-1.5 py-0.5 rounded font-bold uppercase",children:v.details?.category}),v.details?.suggested_actions?.map(x=>o.jsx("span",{className:"text-[9px] bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 px-1.5 py-0.5 rounded border border-emerald-500/20 font-bold uppercase",children:x},x))]})]}),v.event_type==="action"&&o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("p",{className:"text-sm font-bold text-emerald-600 dark:text-emerald-400 capitalize",children:["Executed: ",v.details?.action]}),o.jsx(sf,{className:"w-4 h-4 text-emerald-500"})]}),v.event_type==="error"&&o.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 font-bold",children:v.details?.error})]})]})]},v.id))})]})})}function C2(){const{state:n,actions:a}=Lr(),[r,l]=w.useState(null),[c,d]=w.useState(void 0),[h,m]=w.useState(!1);if(w.useEffect(()=>{a.fetchStats()},[]),!n.stats)return o.jsx(Li,{text:"Loading analytics..."});const p=(v,_)=>{l(v),d(_),m(!0)},{stats:g}=n;return o.jsxs("div",{className:"space-y-8 animate-in fade-in duration-500",children:[o.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-2",children:[o.jsx(yy,{className:"w-6 h-6 text-primary"}),"Analytics Dashboard"]}),o.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[o.jsx(Ao,{title:"Total Emails",value:g.totalEmails,color:"primary"}),o.jsx(Ao,{title:"Spam Caught",value:g.categoryCounts.spam||0,color:"destructive"}),o.jsx(Ao,{title:"Actions Taken",value:Object.values(g.actionCounts).reduce((v,_)=>v+_,0)-(g.actionCounts.none||0),color:"emerald"}),o.jsx(Ao,{title:"Accounts",value:g.accountCount,color:"blue"})]}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[o.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[o.jsx("h3",{className:"font-semibold mb-4",children:"Email Categories"}),o.jsx("div",{className:"space-y-3",children:Object.entries(g.categoryCounts).map(([v,_])=>o.jsx("div",{className:"flex items-center gap-3",children:o.jsxs("div",{className:"flex-1",children:[o.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[o.jsx("span",{className:"capitalize",children:v}),o.jsx("span",{className:"text-muted-foreground",children:_})]}),o.jsx("div",{className:"h-2 bg-secondary rounded-full overflow-hidden",children:o.jsx("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${_/g.totalEmails*100}%`}})})]})},v))})]}),o.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[o.jsx("h3",{className:"font-semibold mb-4",children:"Actions Taken"}),o.jsx("div",{className:"space-y-3",children:Object.entries(g.actionCounts).map(([v,_])=>o.jsxs("div",{className:"flex items-center justify-between py-2 border-b last:border-0",children:[o.jsx("span",{className:"capitalize",children:v}),o.jsx("span",{className:"font-medium",children:_})]},v))})]})]}),o.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[o.jsx("h3",{className:"font-semibold mb-4",children:"Recent Sync Activity"}),g.recentSyncs.length===0?o.jsx("p",{className:"text-muted-foreground text-sm",children:"No sync activity yet"}):o.jsx("div",{className:"space-y-3",children:g.recentSyncs.map(v=>{const _=v.completed_at?Math.round((new Date(v.completed_at).getTime()-new Date(v.started_at).getTime())/1e3):null;return o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between p-3 border rounded-lg hover:bg-secondary/30 transition-colors gap-3 cursor-pointer group",onClick:()=>p(v.id,v.email_accounts?.email_address),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:ke("w-2.5 h-2.5 rounded-full",v.status==="success"?"bg-emerald-500":v.status==="failed"?"bg-destructive":"bg-yellow-500 shadow-[0_0_8px_rgba(234,179,8,0.5)] animate-pulse")}),o.jsxs("div",{className:"flex flex-col",children:[o.jsx("span",{className:"text-sm font-medium group-hover:text-primary transition-colors",children:v.email_accounts?.email_address||"System Sync"}),o.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(Ar,{className:"w-3 h-3"}),new Date(v.started_at).toLocaleString(),_!==null&&o.jsxs("span",{className:"ml-2 px-1.5 py-0.5 bg-secondary rounded-full",children:[_,"s"]})]})]})]}),o.jsx("div",{className:"flex items-center gap-4 text-xs",children:o.jsxs("div",{className:"flex flex-col items-end",children:[o.jsxs("span",{className:"font-bold text-primary",children:[v.emails_processed," emails"]}),o.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[v.emails_deleted," deleted, ",v.emails_drafted," drafted"]})]})})]},v.id)})})]}),o.jsx(A2,{runId:r,accountEmail:c,isOpen:h,onOpenChange:m})]})}function Ao({title:n,value:a,color:r}){const l={primary:"bg-primary/10 text-primary",destructive:"bg-destructive/10 text-destructive",emerald:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",blue:"bg-blue-500/10 text-blue-600 dark:text-blue-400"};return o.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[o.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:n}),o.jsx("p",{className:`text-3xl font-bold ${l[r]||""}`,children:a})]})}function k2(){return o.jsx(r_,{defaultTheme:"system",storageKey:"email-automator-theme",children:o.jsx(eN,{children:o.jsx(Wj,{children:o.jsxs(Qj,{children:[o.jsx(T2,{}),o.jsx(Jj,{})]})})})})}fx.createRoot(document.getElementById("root")).render(o.jsx(my.StrictMode,{children:o.jsx(k2,{})}));
|