@realtimex/email-automator 2.9.7 → 2.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,24 +1,24 @@
1
- function ax(s,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 s)){const d=Object.getOwnPropertyDescriptor(l,c);d&&Object.defineProperty(s,c,d.get?d:{enumerable:!0,get:()=>l[c]})}}}return Object.freeze(Object.defineProperty(s,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 nf(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var fd={exports:{}},Di={};var ug;function sx(){if(ug)return Di;ug=1;var s=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:s,type:l,key:h,ref:c!==void 0?c:null,props:d}}return Di.Fragment=a,Di.jsx=r,Di.jsxs=r,Di}var dg;function nx(){return dg||(dg=1,fd.exports=sx()),fd.exports}var o=nx(),hd={exports:{}},ve={};var fg;function rx(){if(fg)return ve;fg=1;var s=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"),y=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),w=Symbol.for("react.activity"),_=Symbol.iterator;function S(A){return A===null||typeof A!="object"?null:(A=_&&A[_]||A["@@iterator"],typeof A=="function"?A:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,R={};function D(A,V,Q){this.props=A,this.context=V,this.refs=R,this.updater=Q||E}D.prototype.isReactComponent={},D.prototype.setState=function(A,V){if(typeof A!="object"&&typeof A!="function"&&A!=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,A,V,"setState")},D.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function B(){}B.prototype=D.prototype;function q(A,V,Q){this.props=A,this.context=V,this.refs=R,this.updater=Q||E}var P=q.prototype=new B;P.constructor=q,j(P,D.prototype),P.isPureReactComponent=!0;var W=Array.isArray;function Y(){}var I={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function oe(A,V,Q){var F=Q.ref;return{$$typeof:s,type:A,key:V,ref:F!==void 0?F:null,props:Q}}function Ue(A,V){return oe(A.type,V,A.props)}function ge(A){return typeof A=="object"&&A!==null&&A.$$typeof===s}function pe(A){var V={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(Q){return V[Q]})}var Ke=/\/+/g;function Ge(A,V){return typeof A=="object"&&A!==null&&A.key!=null?pe(""+A.key):V.toString(36)}function je(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(Y,Y):(A.status="pending",A.then(function(V){A.status==="pending"&&(A.status="fulfilled",A.value=V)},function(V){A.status==="pending"&&(A.status="rejected",A.reason=V)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function C(A,V,Q,F,de){var ye=typeof A;(ye==="undefined"||ye==="boolean")&&(A=null);var ue=!1;if(A===null)ue=!0;else switch(ye){case"bigint":case"string":case"number":ue=!0;break;case"object":switch(A.$$typeof){case s:case a:ue=!0;break;case g:return ue=A._init,C(ue(A._payload),V,Q,F,de)}}if(ue)return de=de(A),ue=F===""?"."+Ge(A,0):F,W(de)?(Q="",ue!=null&&(Q=ue.replace(Ke,"$&/")+"/"),C(de,V,Q,"",function(Ct){return Ct})):de!=null&&(ge(de)&&(de=Ue(de,Q+(de.key==null||A&&A.key===de.key?"":(""+de.key).replace(Ke,"$&/")+"/")+ue)),V.push(de)),1;ue=0;var Ye=F===""?".":F+":";if(W(A))for(var Be=0;Be<A.length;Be++)F=A[Be],ye=Ye+Ge(F,Be),ue+=C(F,V,Q,ye,de);else if(Be=S(A),typeof Be=="function")for(A=Be.call(A),Be=0;!(F=A.next()).done;)F=F.value,ye=Ye+Ge(F,Be++),ue+=C(F,V,Q,ye,de);else if(ye==="object"){if(typeof A.then=="function")return C(je(A),V,Q,F,de);throw V=String(A),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return ue}function J(A,V,Q){if(A==null)return A;var F=[],de=0;return C(A,F,"","",function(ye){return V.call(Q,ye,de++)}),F}function K(A){if(A._status===-1){var V=A._result;V=V(),V.then(function(Q){(A._status===0||A._status===-1)&&(A._status=1,A._result=Q)},function(Q){(A._status===0||A._status===-1)&&(A._status=2,A._result=Q)}),A._status===-1&&(A._status=0,A._result=V)}if(A._status===1)return A._result.default;throw A._result}var _e=typeof reportError=="function"?reportError:function(A){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof A=="object"&&A!==null&&typeof A.message=="string"?String(A.message):String(A),error:A});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)},Ne={map:J,forEach:function(A,V,Q){J(A,function(){V.apply(this,arguments)},Q)},count:function(A){var V=0;return J(A,function(){V++}),V},toArray:function(A){return J(A,function(V){return V})||[]},only:function(A){if(!ge(A))throw Error("React.Children.only expected to receive a single React element child.");return A}};return ve.Activity=w,ve.Children=Ne,ve.Component=D,ve.Fragment=r,ve.Profiler=c,ve.PureComponent=q,ve.StrictMode=l,ve.Suspense=y,ve.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=I,ve.__COMPILER_RUNTIME={__proto__:null,c:function(A){return I.H.useMemoCache(A)}},ve.cache=function(A){return function(){return A.apply(null,arguments)}},ve.cacheSignal=function(){return null},ve.cloneElement=function(A,V,Q){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var F=j({},A.props),de=A.key;if(V!=null)for(ye in V.key!==void 0&&(de=""+V.key),V)!X.call(V,ye)||ye==="key"||ye==="__self"||ye==="__source"||ye==="ref"&&V.ref===void 0||(F[ye]=V[ye]);var ye=arguments.length-2;if(ye===1)F.children=Q;else if(1<ye){for(var ue=Array(ye),Ye=0;Ye<ye;Ye++)ue[Ye]=arguments[Ye+2];F.children=ue}return oe(A.type,de,F)},ve.createContext=function(A){return A={$$typeof:h,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:d,_context:A},A},ve.createElement=function(A,V,Q){var F,de={},ye=null;if(V!=null)for(F in V.key!==void 0&&(ye=""+V.key),V)X.call(V,F)&&F!=="key"&&F!=="__self"&&F!=="__source"&&(de[F]=V[F]);var ue=arguments.length-2;if(ue===1)de.children=Q;else if(1<ue){for(var Ye=Array(ue),Be=0;Be<ue;Be++)Ye[Be]=arguments[Be+2];de.children=Ye}if(A&&A.defaultProps)for(F in ue=A.defaultProps,ue)de[F]===void 0&&(de[F]=ue[F]);return oe(A,ye,de)},ve.createRef=function(){return{current:null}},ve.forwardRef=function(A){return{$$typeof:m,render:A}},ve.isValidElement=ge,ve.lazy=function(A){return{$$typeof:g,_payload:{_status:-1,_result:A},_init:K}},ve.memo=function(A,V){return{$$typeof:p,type:A,compare:V===void 0?null:V}},ve.startTransition=function(A){var V=I.T,Q={};I.T=Q;try{var F=A(),de=I.S;de!==null&&de(Q,F),typeof F=="object"&&F!==null&&typeof F.then=="function"&&F.then(Y,_e)}catch(ye){_e(ye)}finally{V!==null&&Q.types!==null&&(V.types=Q.types),I.T=V}},ve.unstable_useCacheRefresh=function(){return I.H.useCacheRefresh()},ve.use=function(A){return I.H.use(A)},ve.useActionState=function(A,V,Q){return I.H.useActionState(A,V,Q)},ve.useCallback=function(A,V){return I.H.useCallback(A,V)},ve.useContext=function(A){return I.H.useContext(A)},ve.useDebugValue=function(){},ve.useDeferredValue=function(A,V){return I.H.useDeferredValue(A,V)},ve.useEffect=function(A,V){return I.H.useEffect(A,V)},ve.useEffectEvent=function(A){return I.H.useEffectEvent(A)},ve.useId=function(){return I.H.useId()},ve.useImperativeHandle=function(A,V,Q){return I.H.useImperativeHandle(A,V,Q)},ve.useInsertionEffect=function(A,V){return I.H.useInsertionEffect(A,V)},ve.useLayoutEffect=function(A,V){return I.H.useLayoutEffect(A,V)},ve.useMemo=function(A,V){return I.H.useMemo(A,V)},ve.useOptimistic=function(A,V){return I.H.useOptimistic(A,V)},ve.useReducer=function(A,V,Q){return I.H.useReducer(A,V,Q)},ve.useRef=function(A){return I.H.useRef(A)},ve.useState=function(A){return I.H.useState(A)},ve.useSyncExternalStore=function(A,V,Q){return I.H.useSyncExternalStore(A,V,Q)},ve.useTransition=function(){return I.H.useTransition()},ve.version="19.2.3",ve}var hg;function rf(){return hg||(hg=1,hd.exports=rx()),hd.exports}var x=rf();const py=nf(x),lf=ax({__proto__:null,default:py},[x]);var md={exports:{}},Mi={},pd={exports:{}},gd={};var mg;function ix(){return mg||(mg=1,(function(s){function a(C,J){var K=C.length;C.push(J);e:for(;0<K;){var _e=K-1>>>1,Ne=C[_e];if(0<c(Ne,J))C[_e]=J,C[K]=Ne,K=_e;else break e}}function r(C){return C.length===0?null:C[0]}function l(C){if(C.length===0)return null;var J=C[0],K=C.pop();if(K!==J){C[0]=K;e:for(var _e=0,Ne=C.length,A=Ne>>>1;_e<A;){var V=2*(_e+1)-1,Q=C[V],F=V+1,de=C[F];if(0>c(Q,K))F<Ne&&0>c(de,Q)?(C[_e]=de,C[F]=K,_e=F):(C[_e]=Q,C[V]=K,_e=V);else if(F<Ne&&0>c(de,K))C[_e]=de,C[F]=K,_e=F;else break e}}return J}function c(C,J){var K=C.sortIndex-J.sortIndex;return K!==0?K:C.id-J.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;s.unstable_now=function(){return d.now()}}else{var h=Date,m=h.now();s.unstable_now=function(){return h.now()-m}}var y=[],p=[],g=1,w=null,_=3,S=!1,E=!1,j=!1,R=!1,D=typeof setTimeout=="function"?setTimeout:null,B=typeof clearTimeout=="function"?clearTimeout:null,q=typeof setImmediate<"u"?setImmediate:null;function P(C){for(var J=r(p);J!==null;){if(J.callback===null)l(p);else if(J.startTime<=C)l(p),J.sortIndex=J.expirationTime,a(y,J);else break;J=r(p)}}function W(C){if(j=!1,P(C),!E)if(r(y)!==null)E=!0,Y||(Y=!0,pe());else{var J=r(p);J!==null&&je(W,J.startTime-C)}}var Y=!1,I=-1,X=5,oe=-1;function Ue(){return R?!0:!(s.unstable_now()-oe<X)}function ge(){if(R=!1,Y){var C=s.unstable_now();oe=C;var J=!0;try{e:{E=!1,j&&(j=!1,B(I),I=-1),S=!0;var K=_;try{t:{for(P(C),w=r(y);w!==null&&!(w.expirationTime>C&&Ue());){var _e=w.callback;if(typeof _e=="function"){w.callback=null,_=w.priorityLevel;var Ne=_e(w.expirationTime<=C);if(C=s.unstable_now(),typeof Ne=="function"){w.callback=Ne,P(C),J=!0;break t}w===r(y)&&l(y),P(C)}else l(y);w=r(y)}if(w!==null)J=!0;else{var A=r(p);A!==null&&je(W,A.startTime-C),J=!1}}break e}finally{w=null,_=K,S=!1}J=void 0}}finally{J?pe():Y=!1}}}var pe;if(typeof q=="function")pe=function(){q(ge)};else if(typeof MessageChannel<"u"){var Ke=new MessageChannel,Ge=Ke.port2;Ke.port1.onmessage=ge,pe=function(){Ge.postMessage(null)}}else pe=function(){D(ge,0)};function je(C,J){I=D(function(){C(s.unstable_now())},J)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(C){C.callback=null},s.unstable_forceFrameRate=function(C){0>C||125<C?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<C?Math.floor(1e3/C):5},s.unstable_getCurrentPriorityLevel=function(){return _},s.unstable_next=function(C){switch(_){case 1:case 2:case 3:var J=3;break;default:J=_}var K=_;_=J;try{return C()}finally{_=K}},s.unstable_requestPaint=function(){R=!0},s.unstable_runWithPriority=function(C,J){switch(C){case 1:case 2:case 3:case 4:case 5:break;default:C=3}var K=_;_=C;try{return J()}finally{_=K}},s.unstable_scheduleCallback=function(C,J,K){var _e=s.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?_e+K:_e):K=_e,C){case 1:var Ne=-1;break;case 2:Ne=250;break;case 5:Ne=1073741823;break;case 4:Ne=1e4;break;default:Ne=5e3}return Ne=K+Ne,C={id:g++,callback:J,priorityLevel:C,startTime:K,expirationTime:Ne,sortIndex:-1},K>_e?(C.sortIndex=K,a(p,C),r(y)===null&&C===r(p)&&(j?(B(I),I=-1):j=!0,je(W,K-_e))):(C.sortIndex=Ne,a(y,C),E||S||(E=!0,Y||(Y=!0,pe()))),C},s.unstable_shouldYield=Ue,s.unstable_wrapCallback=function(C){var J=_;return function(){var K=_;_=J;try{return C.apply(this,arguments)}finally{_=K}}}})(gd)),gd}var pg;function lx(){return pg||(pg=1,pd.exports=ix()),pd.exports}var yd={exports:{}},kt={};var gg;function ox(){if(gg)return kt;gg=1;var s=rf();function a(y){var p="https://react.dev/errors/"+y;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)p+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+y+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var l={d:{f:r,r:function(){throw Error(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(y,p,g){var w=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:w==null?null:""+w,children:y,containerInfo:p,implementation:g}}var h=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(y,p){if(y==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return kt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,kt.createPortal=function(y,p){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(a(299));return d(y,p,null,g)},kt.flushSync=function(y){var p=h.T,g=l.p;try{if(h.T=null,l.p=2,y)return y()}finally{h.T=p,l.p=g,l.d.f()}},kt.preconnect=function(y,p){typeof y=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,l.d.C(y,p))},kt.prefetchDNS=function(y){typeof y=="string"&&l.d.D(y)},kt.preinit=function(y,p){if(typeof y=="string"&&p&&typeof p.as=="string"){var g=p.as,w=m(g,p.crossOrigin),_=typeof p.integrity=="string"?p.integrity:void 0,S=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;g==="style"?l.d.S(y,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:w,integrity:_,fetchPriority:S}):g==="script"&&l.d.X(y,{crossOrigin:w,integrity:_,fetchPriority:S,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},kt.preinitModule=function(y,p){if(typeof y=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var g=m(p.as,p.crossOrigin);l.d.M(y,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&l.d.M(y)},kt.preload=function(y,p){if(typeof y=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var g=p.as,w=m(g,p.crossOrigin);l.d.L(y,g,{crossOrigin:w,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},kt.preloadModule=function(y,p){if(typeof y=="string")if(p){var g=m(p.as,p.crossOrigin);l.d.m(y,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else l.d.m(y)},kt.requestFormReset=function(y){l.d.r(y)},kt.unstable_batchedUpdates=function(y,p){return y(p)},kt.useFormState=function(y,p,g){return h.H.useFormState(y,p,g)},kt.useFormStatus=function(){return h.H.useHostTransitionStatus()},kt.version="19.2.3",kt}var yg;function gy(){if(yg)return yd.exports;yg=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(a){console.error(a)}}return s(),yd.exports=ox(),yd.exports}var vg;function cx(){if(vg)return Mi;vg=1;var s=lx(),a=rf(),r=gy();function l(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}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,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n: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 y(e){if(d(e)!==e)throw Error(l(188))}function p(e){var t=e.alternate;if(!t){if(t=d(e),t===null)throw Error(l(188));return t!==e?null:e}for(var n=e,i=t;;){var u=n.return;if(u===null)break;var f=u.alternate;if(f===null){if(i=u.return,i!==null){n=i;continue}break}if(u.child===f.child){for(f=u.child;f;){if(f===n)return y(u),e;if(f===i)return y(u),t;f=f.sibling}throw Error(l(188))}if(n.return!==i.return)n=u,i=f;else{for(var v=!1,b=u.child;b;){if(b===n){v=!0,n=u,i=f;break}if(b===i){v=!0,i=u,n=f;break}b=b.sibling}if(!v){for(b=f.child;b;){if(b===n){v=!0,n=f,i=u;break}if(b===i){v=!0,i=f,n=u;break}b=b.sibling}if(!v)throw Error(l(189))}}if(n.alternate!==i)throw Error(l(190))}if(n.tag!==3)throw Error(l(188));return n.stateNode.current===n?e:t}function g(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=g(e),t!==null)return t;e=e.sibling}return null}var w=Object.assign,_=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),B=Symbol.for("react.consumer"),q=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),Y=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),oe=Symbol.for("react.activity"),Ue=Symbol.for("react.memo_cache_sentinel"),ge=Symbol.iterator;function pe(e){return e===null||typeof e!="object"?null:(e=ge&&e[ge]||e["@@iterator"],typeof e=="function"?e:null)}var Ke=Symbol.for("react.client.reference");function Ge(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ke?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case j:return"Fragment";case D:return"Profiler";case R:return"StrictMode";case W:return"Suspense";case Y:return"SuspenseList";case oe:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case E:return"Portal";case q:return e.displayName||"Context";case B:return(e._context.displayName||"Context")+".Consumer";case P:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case I:return t=e.displayName||null,t!==null?t:Ge(e.type)||"Memo";case X:t=e._payload,e=e._init;try{return Ge(e(t))}catch{}}return null}var je=Array.isArray,C=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},_e=[],Ne=-1;function A(e){return{current:e}}function V(e){0>Ne||(e.current=_e[Ne],_e[Ne]=null,Ne--)}function Q(e,t){Ne++,_e[Ne]=e.current,e.current=t}var F=A(null),de=A(null),ye=A(null),ue=A(null);function Ye(e,t){switch(Q(ye,t),Q(de,e),Q(F,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Dp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Dp(t),e=Mp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}V(F),Q(F,e)}function Be(){V(F),V(de),V(ye)}function Ct(e){e.memoizedState!==null&&Q(ue,e);var t=F.current,n=Mp(t,e.type);t!==n&&(Q(de,e),Q(F,n))}function pt(e){de.current===e&&(V(F),V(de)),ue.current===e&&(V(ue),Ci._currentValue=K)}var xt,rs;function la(e){if(xt===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);xt=t&&t[1]||"",rs=-1<n.stack.indexOf(`
1
+ function nx(s,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 s)){const d=Object.getOwnPropertyDescriptor(l,c);d&&Object.defineProperty(s,c,d.get?d:{enumerable:!0,get:()=>l[c]})}}}return Object.freeze(Object.defineProperty(s,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 lf(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var hd={exports:{}},Di={};var dg;function rx(){if(dg)return Di;dg=1;var s=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:s,type:l,key:h,ref:c!==void 0?c:null,props:d}}return Di.Fragment=a,Di.jsx=r,Di.jsxs=r,Di}var fg;function ix(){return fg||(fg=1,hd.exports=rx()),hd.exports}var o=ix(),md={exports:{}},ve={};var hg;function lx(){if(hg)return ve;hg=1;var s=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"),y=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),w=Symbol.for("react.activity"),_=Symbol.iterator;function S(A){return A===null||typeof A!="object"?null:(A=_&&A[_]||A["@@iterator"],typeof A=="function"?A:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,R={};function D(A,I,X){this.props=A,this.context=I,this.refs=R,this.updater=X||E}D.prototype.isReactComponent={},D.prototype.setState=function(A,I){if(typeof A!="object"&&typeof A!="function"&&A!=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,A,I,"setState")},D.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function B(){}B.prototype=D.prototype;function q(A,I,X){this.props=A,this.context=I,this.refs=R,this.updater=X||E}var P=q.prototype=new B;P.constructor=q,j(P,D.prototype),P.isPureReactComponent=!0;var W=Array.isArray;function Y(){}var H={H:null,A:null,T:null,S:null},Q=Object.prototype.hasOwnProperty;function le(A,I,X){var F=X.ref;return{$$typeof:s,type:A,key:I,ref:F!==void 0?F:null,props:X}}function qe(A,I){return le(A.type,I,A.props)}function he(A){return typeof A=="object"&&A!==null&&A.$$typeof===s}function ce(A){var I={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(X){return I[X]})}var Ze=/\/+/g;function st(A,I){return typeof A=="object"&&A!==null&&A.key!=null?ce(""+A.key):I.toString(36)}function $e(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(Y,Y):(A.status="pending",A.then(function(I){A.status==="pending"&&(A.status="fulfilled",A.value=I)},function(I){A.status==="pending"&&(A.status="rejected",A.reason=I)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function C(A,I,X,F,fe){var ye=typeof A;(ye==="undefined"||ye==="boolean")&&(A=null);var de=!1;if(A===null)de=!0;else switch(ye){case"bigint":case"string":case"number":de=!0;break;case"object":switch(A.$$typeof){case s:case a:de=!0;break;case g:return de=A._init,C(de(A._payload),I,X,F,fe)}}if(de)return fe=fe(A),de=F===""?"."+st(A,0):F,W(fe)?(X="",de!=null&&(X=de.replace(Ze,"$&/")+"/"),C(fe,I,X,"",function(Ct){return Ct})):fe!=null&&(he(fe)&&(fe=qe(fe,X+(fe.key==null||A&&A.key===fe.key?"":(""+fe.key).replace(Ze,"$&/")+"/")+de)),I.push(fe)),1;de=0;var Pe=F===""?".":F+":";if(W(A))for(var Ue=0;Ue<A.length;Ue++)F=A[Ue],ye=Pe+st(F,Ue),de+=C(F,I,X,ye,fe);else if(Ue=S(A),typeof Ue=="function")for(A=Ue.call(A),Ue=0;!(F=A.next()).done;)F=F.value,ye=Pe+st(F,Ue++),de+=C(F,I,X,ye,fe);else if(ye==="object"){if(typeof A.then=="function")return C($e(A),I,X,F,fe);throw I=String(A),Error("Objects are not valid as a React child (found: "+(I==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":I)+"). If you meant to render a collection of children, use an array instead.")}return de}function J(A,I,X){if(A==null)return A;var F=[],fe=0;return C(A,F,"","",function(ye){return I.call(X,ye,fe++)}),F}function K(A){if(A._status===-1){var I=A._result;I=I(),I.then(function(X){(A._status===0||A._status===-1)&&(A._status=1,A._result=X)},function(X){(A._status===0||A._status===-1)&&(A._status=2,A._result=X)}),A._status===-1&&(A._status=0,A._result=I)}if(A._status===1)return A._result.default;throw A._result}var _e=typeof reportError=="function"?reportError:function(A){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var I=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof A=="object"&&A!==null&&typeof A.message=="string"?String(A.message):String(A),error:A});if(!window.dispatchEvent(I))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)},je={map:J,forEach:function(A,I,X){J(A,function(){I.apply(this,arguments)},X)},count:function(A){var I=0;return J(A,function(){I++}),I},toArray:function(A){return J(A,function(I){return I})||[]},only:function(A){if(!he(A))throw Error("React.Children.only expected to receive a single React element child.");return A}};return ve.Activity=w,ve.Children=je,ve.Component=D,ve.Fragment=r,ve.Profiler=c,ve.PureComponent=q,ve.StrictMode=l,ve.Suspense=y,ve.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=H,ve.__COMPILER_RUNTIME={__proto__:null,c:function(A){return H.H.useMemoCache(A)}},ve.cache=function(A){return function(){return A.apply(null,arguments)}},ve.cacheSignal=function(){return null},ve.cloneElement=function(A,I,X){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var F=j({},A.props),fe=A.key;if(I!=null)for(ye in I.key!==void 0&&(fe=""+I.key),I)!Q.call(I,ye)||ye==="key"||ye==="__self"||ye==="__source"||ye==="ref"&&I.ref===void 0||(F[ye]=I[ye]);var ye=arguments.length-2;if(ye===1)F.children=X;else if(1<ye){for(var de=Array(ye),Pe=0;Pe<ye;Pe++)de[Pe]=arguments[Pe+2];F.children=de}return le(A.type,fe,F)},ve.createContext=function(A){return A={$$typeof:h,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:d,_context:A},A},ve.createElement=function(A,I,X){var F,fe={},ye=null;if(I!=null)for(F in I.key!==void 0&&(ye=""+I.key),I)Q.call(I,F)&&F!=="key"&&F!=="__self"&&F!=="__source"&&(fe[F]=I[F]);var de=arguments.length-2;if(de===1)fe.children=X;else if(1<de){for(var Pe=Array(de),Ue=0;Ue<de;Ue++)Pe[Ue]=arguments[Ue+2];fe.children=Pe}if(A&&A.defaultProps)for(F in de=A.defaultProps,de)fe[F]===void 0&&(fe[F]=de[F]);return le(A,ye,fe)},ve.createRef=function(){return{current:null}},ve.forwardRef=function(A){return{$$typeof:m,render:A}},ve.isValidElement=he,ve.lazy=function(A){return{$$typeof:g,_payload:{_status:-1,_result:A},_init:K}},ve.memo=function(A,I){return{$$typeof:p,type:A,compare:I===void 0?null:I}},ve.startTransition=function(A){var I=H.T,X={};H.T=X;try{var F=A(),fe=H.S;fe!==null&&fe(X,F),typeof F=="object"&&F!==null&&typeof F.then=="function"&&F.then(Y,_e)}catch(ye){_e(ye)}finally{I!==null&&X.types!==null&&(I.types=X.types),H.T=I}},ve.unstable_useCacheRefresh=function(){return H.H.useCacheRefresh()},ve.use=function(A){return H.H.use(A)},ve.useActionState=function(A,I,X){return H.H.useActionState(A,I,X)},ve.useCallback=function(A,I){return H.H.useCallback(A,I)},ve.useContext=function(A){return H.H.useContext(A)},ve.useDebugValue=function(){},ve.useDeferredValue=function(A,I){return H.H.useDeferredValue(A,I)},ve.useEffect=function(A,I){return H.H.useEffect(A,I)},ve.useEffectEvent=function(A){return H.H.useEffectEvent(A)},ve.useId=function(){return H.H.useId()},ve.useImperativeHandle=function(A,I,X){return H.H.useImperativeHandle(A,I,X)},ve.useInsertionEffect=function(A,I){return H.H.useInsertionEffect(A,I)},ve.useLayoutEffect=function(A,I){return H.H.useLayoutEffect(A,I)},ve.useMemo=function(A,I){return H.H.useMemo(A,I)},ve.useOptimistic=function(A,I){return H.H.useOptimistic(A,I)},ve.useReducer=function(A,I,X){return H.H.useReducer(A,I,X)},ve.useRef=function(A){return H.H.useRef(A)},ve.useState=function(A){return H.H.useState(A)},ve.useSyncExternalStore=function(A,I,X){return H.H.useSyncExternalStore(A,I,X)},ve.useTransition=function(){return H.H.useTransition()},ve.version="19.2.3",ve}var mg;function of(){return mg||(mg=1,md.exports=lx()),md.exports}var x=of();const vy=lf(x),cf=nx({__proto__:null,default:vy},[x]);var pd={exports:{}},Mi={},gd={exports:{}},yd={};var pg;function ox(){return pg||(pg=1,(function(s){function a(C,J){var K=C.length;C.push(J);e:for(;0<K;){var _e=K-1>>>1,je=C[_e];if(0<c(je,J))C[_e]=J,C[K]=je,K=_e;else break e}}function r(C){return C.length===0?null:C[0]}function l(C){if(C.length===0)return null;var J=C[0],K=C.pop();if(K!==J){C[0]=K;e:for(var _e=0,je=C.length,A=je>>>1;_e<A;){var I=2*(_e+1)-1,X=C[I],F=I+1,fe=C[F];if(0>c(X,K))F<je&&0>c(fe,X)?(C[_e]=fe,C[F]=K,_e=F):(C[_e]=X,C[I]=K,_e=I);else if(F<je&&0>c(fe,K))C[_e]=fe,C[F]=K,_e=F;else break e}}return J}function c(C,J){var K=C.sortIndex-J.sortIndex;return K!==0?K:C.id-J.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;s.unstable_now=function(){return d.now()}}else{var h=Date,m=h.now();s.unstable_now=function(){return h.now()-m}}var y=[],p=[],g=1,w=null,_=3,S=!1,E=!1,j=!1,R=!1,D=typeof setTimeout=="function"?setTimeout:null,B=typeof clearTimeout=="function"?clearTimeout:null,q=typeof setImmediate<"u"?setImmediate:null;function P(C){for(var J=r(p);J!==null;){if(J.callback===null)l(p);else if(J.startTime<=C)l(p),J.sortIndex=J.expirationTime,a(y,J);else break;J=r(p)}}function W(C){if(j=!1,P(C),!E)if(r(y)!==null)E=!0,Y||(Y=!0,ce());else{var J=r(p);J!==null&&$e(W,J.startTime-C)}}var Y=!1,H=-1,Q=5,le=-1;function qe(){return R?!0:!(s.unstable_now()-le<Q)}function he(){if(R=!1,Y){var C=s.unstable_now();le=C;var J=!0;try{e:{E=!1,j&&(j=!1,B(H),H=-1),S=!0;var K=_;try{t:{for(P(C),w=r(y);w!==null&&!(w.expirationTime>C&&qe());){var _e=w.callback;if(typeof _e=="function"){w.callback=null,_=w.priorityLevel;var je=_e(w.expirationTime<=C);if(C=s.unstable_now(),typeof je=="function"){w.callback=je,P(C),J=!0;break t}w===r(y)&&l(y),P(C)}else l(y);w=r(y)}if(w!==null)J=!0;else{var A=r(p);A!==null&&$e(W,A.startTime-C),J=!1}}break e}finally{w=null,_=K,S=!1}J=void 0}}finally{J?ce():Y=!1}}}var ce;if(typeof q=="function")ce=function(){q(he)};else if(typeof MessageChannel<"u"){var Ze=new MessageChannel,st=Ze.port2;Ze.port1.onmessage=he,ce=function(){st.postMessage(null)}}else ce=function(){D(he,0)};function $e(C,J){H=D(function(){C(s.unstable_now())},J)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(C){C.callback=null},s.unstable_forceFrameRate=function(C){0>C||125<C?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<C?Math.floor(1e3/C):5},s.unstable_getCurrentPriorityLevel=function(){return _},s.unstable_next=function(C){switch(_){case 1:case 2:case 3:var J=3;break;default:J=_}var K=_;_=J;try{return C()}finally{_=K}},s.unstable_requestPaint=function(){R=!0},s.unstable_runWithPriority=function(C,J){switch(C){case 1:case 2:case 3:case 4:case 5:break;default:C=3}var K=_;_=C;try{return J()}finally{_=K}},s.unstable_scheduleCallback=function(C,J,K){var _e=s.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?_e+K:_e):K=_e,C){case 1:var je=-1;break;case 2:je=250;break;case 5:je=1073741823;break;case 4:je=1e4;break;default:je=5e3}return je=K+je,C={id:g++,callback:J,priorityLevel:C,startTime:K,expirationTime:je,sortIndex:-1},K>_e?(C.sortIndex=K,a(p,C),r(y)===null&&C===r(p)&&(j?(B(H),H=-1):j=!0,$e(W,K-_e))):(C.sortIndex=je,a(y,C),E||S||(E=!0,Y||(Y=!0,ce()))),C},s.unstable_shouldYield=qe,s.unstable_wrapCallback=function(C){var J=_;return function(){var K=_;_=J;try{return C.apply(this,arguments)}finally{_=K}}}})(yd)),yd}var gg;function cx(){return gg||(gg=1,gd.exports=ox()),gd.exports}var vd={exports:{}},kt={};var yg;function ux(){if(yg)return kt;yg=1;var s=of();function a(y){var p="https://react.dev/errors/"+y;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)p+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+y+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var l={d:{f:r,r:function(){throw Error(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(y,p,g){var w=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:w==null?null:""+w,children:y,containerInfo:p,implementation:g}}var h=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(y,p){if(y==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return kt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,kt.createPortal=function(y,p){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(a(299));return d(y,p,null,g)},kt.flushSync=function(y){var p=h.T,g=l.p;try{if(h.T=null,l.p=2,y)return y()}finally{h.T=p,l.p=g,l.d.f()}},kt.preconnect=function(y,p){typeof y=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,l.d.C(y,p))},kt.prefetchDNS=function(y){typeof y=="string"&&l.d.D(y)},kt.preinit=function(y,p){if(typeof y=="string"&&p&&typeof p.as=="string"){var g=p.as,w=m(g,p.crossOrigin),_=typeof p.integrity=="string"?p.integrity:void 0,S=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;g==="style"?l.d.S(y,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:w,integrity:_,fetchPriority:S}):g==="script"&&l.d.X(y,{crossOrigin:w,integrity:_,fetchPriority:S,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},kt.preinitModule=function(y,p){if(typeof y=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var g=m(p.as,p.crossOrigin);l.d.M(y,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&l.d.M(y)},kt.preload=function(y,p){if(typeof y=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var g=p.as,w=m(g,p.crossOrigin);l.d.L(y,g,{crossOrigin:w,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},kt.preloadModule=function(y,p){if(typeof y=="string")if(p){var g=m(p.as,p.crossOrigin);l.d.m(y,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else l.d.m(y)},kt.requestFormReset=function(y){l.d.r(y)},kt.unstable_batchedUpdates=function(y,p){return y(p)},kt.useFormState=function(y,p,g){return h.H.useFormState(y,p,g)},kt.useFormStatus=function(){return h.H.useHostTransitionStatus()},kt.version="19.2.3",kt}var vg;function by(){if(vg)return vd.exports;vg=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(a){console.error(a)}}return s(),vd.exports=ux(),vd.exports}var bg;function dx(){if(bg)return Mi;bg=1;var s=cx(),a=of(),r=by();function l(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}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,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n: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 y(e){if(d(e)!==e)throw Error(l(188))}function p(e){var t=e.alternate;if(!t){if(t=d(e),t===null)throw Error(l(188));return t!==e?null:e}for(var n=e,i=t;;){var u=n.return;if(u===null)break;var f=u.alternate;if(f===null){if(i=u.return,i!==null){n=i;continue}break}if(u.child===f.child){for(f=u.child;f;){if(f===n)return y(u),e;if(f===i)return y(u),t;f=f.sibling}throw Error(l(188))}if(n.return!==i.return)n=u,i=f;else{for(var v=!1,b=u.child;b;){if(b===n){v=!0,n=u,i=f;break}if(b===i){v=!0,i=u,n=f;break}b=b.sibling}if(!v){for(b=f.child;b;){if(b===n){v=!0,n=f,i=u;break}if(b===i){v=!0,i=f,n=u;break}b=b.sibling}if(!v)throw Error(l(189))}}if(n.alternate!==i)throw Error(l(190))}if(n.tag!==3)throw Error(l(188));return n.stateNode.current===n?e:t}function g(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=g(e),t!==null)return t;e=e.sibling}return null}var w=Object.assign,_=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),R=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),B=Symbol.for("react.consumer"),q=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),Y=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),Q=Symbol.for("react.lazy"),le=Symbol.for("react.activity"),qe=Symbol.for("react.memo_cache_sentinel"),he=Symbol.iterator;function ce(e){return e===null||typeof e!="object"?null:(e=he&&e[he]||e["@@iterator"],typeof e=="function"?e:null)}var Ze=Symbol.for("react.client.reference");function st(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 D:return"Profiler";case R:return"StrictMode";case W:return"Suspense";case Y:return"SuspenseList";case le:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case E:return"Portal";case q:return e.displayName||"Context";case B:return(e._context.displayName||"Context")+".Consumer";case P:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case H:return t=e.displayName||null,t!==null?t:st(e.type)||"Memo";case Q:t=e._payload,e=e._init;try{return st(e(t))}catch{}}return null}var $e=Array.isArray,C=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},_e=[],je=-1;function A(e){return{current:e}}function I(e){0>je||(e.current=_e[je],_e[je]=null,je--)}function X(e,t){je++,_e[je]=e.current,e.current=t}var F=A(null),fe=A(null),ye=A(null),de=A(null);function Pe(e,t){switch(X(ye,t),X(fe,e),X(F,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Mp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Mp(t),e=zp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}I(F),X(F,e)}function Ue(){I(F),I(fe),I(ye)}function Ct(e){e.memoizedState!==null&&X(de,e);var t=F.current,n=zp(t,e.type);t!==n&&(X(fe,e),X(F,n))}function pt(e){fe.current===e&&(I(F),I(fe)),de.current===e&&(I(de),Ci._currentValue=K)}var xt,rs;function la(e){if(xt===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);xt=t&&t[1]||"",rs=-1<n.stack.indexOf(`
2
2
  at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+xt+e+rs}var is=!1;function wn(e,t){if(!e||is)return"";is=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var G=function(){throw Error()};if(Object.defineProperty(G.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(G,[])}catch(L){var U=L}Reflect.construct(e,[],G)}else{try{G.call()}catch(L){U=L}e.call(G.prototype)}}else{try{throw Error()}catch(L){U=L}(G=e())&&typeof G.catch=="function"&&G.catch(function(){})}}catch(L){if(L&&U&&typeof L.stack=="string")return[L.stack,U.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(),v=f[0],b=f[1];if(v&&b){var N=v.split(`
3
+ `+xt+e+rs}var is=!1;function _n(e,t){if(!e||is)return"";is=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var G=function(){throw Error()};if(Object.defineProperty(G.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(G,[])}catch(L){var U=L}Reflect.construct(e,[],G)}else{try{G.call()}catch(L){U=L}e.call(G.prototype)}}else{try{throw Error()}catch(L){U=L}(G=e())&&typeof G.catch=="function"&&G.catch(function(){})}}catch(L){if(L&&U&&typeof L.stack=="string")return[L.stack,U.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(),v=f[0],b=f[1];if(v&&b){var N=v.split(`
4
4
  `),z=b.split(`
5
5
  `);for(u=i=0;i<N.length&&!N[i].includes("DetermineComponentFrameRoot");)i++;for(;u<z.length&&!z[u].includes("DetermineComponentFrameRoot");)u++;if(i===N.length||u===z.length)for(i=N.length-1,u=z.length-1;1<=i&&0<=u&&N[i]!==z[u];)u--;for(;1<=i&&0<=u;i--,u--)if(N[i]!==z[u]){if(i!==1||u!==1)do if(i--,u--,0>u||N[i]!==z[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{is=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?la(n):""}function _n(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 wn(e.type,!1);case 11:return wn(e.type.render,!1);case 1:return wn(e.type,!0);case 31:return la("Activity");default:return""}}function $r(e){try{var t="",n=null;do t+=_n(e,n),n=e,e=e.return;while(e);return t}catch(i){return`
6
+ `+N[i].replace(" at new "," at ");return e.displayName&&$.includes("<anonymous>")&&($=$.replace("<anonymous>",e.displayName)),$}while(1<=i&&0<=u);break}}}finally{is=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?la(n):""}function Sn(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 _n(e.type,!1);case 11:return _n(e.type.render,!1);case 1:return _n(e.type,!0);case 31:return la("Activity");default:return""}}function $r(e){try{var t="",n=null;do t+=Sn(e,n),n=e,e=e.return;while(e);return t}catch(i){return`
7
7
  Error generating stack: `+i.message+`
8
- `+i.stack}}var ls=Object.prototype.hasOwnProperty,Sn=s.unstable_scheduleCallback,os=s.unstable_cancelCallback,sl=s.unstable_shouldYield,$s=s.unstable_requestPaint,gt=s.unstable_now,nl=s.unstable_getCurrentPriorityLevel,Hr=s.unstable_ImmediatePriority,Vr=s.unstable_UserBlockingPriority,Ma=s.unstable_NormalPriority,jn=s.unstable_LowPriority,ya=s.unstable_IdlePriority,Nn=s.log,Zo=s.unstable_setDisableYieldValue,Hs=null,wt=null;function va(e){if(typeof Nn=="function"&&Zo(e),wt&&typeof wt.setStrictMode=="function")try{wt.setStrictMode(Hs,e)}catch{}}var Ot=Math.clz32?Math.clz32:ec,Fo=Math.log,Wo=Math.LN2;function ec(e){return e>>>=0,e===0?32:31-(Fo(e)/Wo|0)|0}var En=256,Tn=262144,An=4194304;function za(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 Cn(e,t,n){var i=e.pendingLanes;if(i===0)return 0;var u=0,f=e.suspendedLanes,v=e.pingedLanes;e=e.warmLanes;var b=i&134217727;return b!==0?(i=b&~f,i!==0?u=za(i):(v&=b,v!==0?u=za(v):n||(n=b&~e,n!==0&&(u=za(n))))):(b=i&~f,b!==0?u=za(b):v!==0?u=za(v):n||(n=i&~e,n!==0&&(u=za(n)))),u===0?0:t!==0&&t!==u&&(t&f)===0&&(f=u&-u,n=t&-t,f>=n||f===32&&(n&4194048)!==0)?t:u}function cs(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function tc(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 rl(){var e=An;return An<<=1,(An&62914560)===0&&(An=4194304),e}function Ir(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Vs(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ac(e,t,n,i,u,f){var v=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var b=e.entanglements,N=e.expirationTimes,z=e.hiddenUpdates;for(n=v&~n;0<n;){var $=31-Ot(n),G=1<<$;b[$]=0,N[$]=-1;var U=z[$];if(U!==null)for(z[$]=null,$=0;$<U.length;$++){var L=U[$];L!==null&&(L.lane&=-536870913)}n&=~G}i!==0&&O(e,i,0),f!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=f&~(v&~t))}function O(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-Ot(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|n&261930}function ee(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var i=31-Ot(n),u=1<<i;u&t|e[i]&t&&(e[i]|=t),n&=~u}}function ke(e,t){var n=t&-t;return n=(n&42)!==0?1:yt(n),(n&(e.suspendedLanes|t))!==0?0:n}function yt(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 Is(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Gs(){var e=J.p;return e!==0?e:(e=window.event,e===void 0?32:sg(e.type))}function Ps(e,t){var n=J.p;try{return J.p=e,t()}finally{J.p=n}}var ba=Math.random().toString(36).slice(2),ut="__reactFiber$"+ba,Dt="__reactProps$"+ba,kn="__reactContainer$"+ba,sc="__reactEvents$"+ba,Pv="__reactListeners$"+ba,Kv="__reactHandles$"+ba,xf="__reactResources$"+ba,Gr="__reactMarker$"+ba;function nc(e){delete e[ut],delete e[Dt],delete e[sc],delete e[Pv],delete e[Kv]}function On(e){var t=e[ut];if(t)return t;for(var n=e.parentNode;n;){if(t=n[kn]||n[ut]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Hp(e);e!==null;){if(n=e[ut])return n;e=Hp(e)}return t}e=n,n=e.parentNode}return null}function Rn(e){if(e=e[ut]||e[kn]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Pr(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(l(33))}function Dn(e){var t=e[xf];return t||(t=e[xf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function vt(e){e[Gr]=!0}var wf=new Set,_f={};function Ks(e,t){Mn(e,t),Mn(e+"Capture",t)}function Mn(e,t){for(_f[e]=t,e=0;e<t.length;e++)wf.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]*$"),Sf={},jf={};function Jv(e){return ls.call(jf,e)?!0:ls.call(Sf,e)?!1:Yv.test(e)?jf[e]=!0:(Sf[e]=!0,!1)}function il(e,t,n){if(Jv(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){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,""+n)}}function ll(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function Ua(e,t,n,i){if(i===null)e.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+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 Nf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Xv(e,t,n){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(v){n=""+v,f.call(this,v)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return n},setValue:function(v){n=""+v},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function rc(e){if(!e._valueTracker){var t=Nf(e)?"checked":"value";e._valueTracker=Xv(e,t,""+e[t])}}function Ef(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),i="";return e&&(i=Nf(e)?e.checked?"true":"false":e.value),e=i,e!==n?(t.setValue(e),!0):!1}function ol(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 ic(e,t,n,i,u,f,v,b){e.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?e.type=v:e.removeAttribute("type"),t!=null?v==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Zt(t)):e.value!==""+Zt(t)&&(e.value=""+Zt(t)):v!=="submit"&&v!=="reset"||e.removeAttribute("value"),t!=null?lc(e,v,Zt(t)):n!=null?lc(e,v,Zt(n)):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 Tf(e,t,n,i,u,f,v,b){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.type=f),t!=null||n!=null){if(!(f!=="submit"&&f!=="reset"||t!=null)){rc(e);return}n=n!=null?""+Zt(n):"",t=t!=null?""+Zt(t):n,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,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(e.name=v),rc(e)}function lc(e,t,n){t==="number"&&ol(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function zn(e,t,n,i){if(e=e.options,t){t={};for(var u=0;u<n.length;u++)t["$"+n[u]]=!0;for(n=0;n<e.length;n++)u=t.hasOwnProperty("$"+e[n].value),e[n].selected!==u&&(e[n].selected=u),u&&i&&(e[n].defaultSelected=!0)}else{for(n=""+Zt(n),t=null,u=0;u<e.length;u++){if(e[u].value===n){e[u].selected=!0,i&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function Af(e,t,n){if(t!=null&&(t=""+Zt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Zt(n):""}function Cf(e,t,n,i){if(t==null){if(i!=null){if(n!=null)throw Error(l(92));if(je(i)){if(1<i.length)throw Error(l(93));i=i[0]}n=i}n==null&&(n=""),t=n}n=Zt(t),e.defaultValue=n,i=e.textContent,i===n&&i!==""&&i!==null&&(e.value=i),rc(e)}function Un(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.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 kf(e,t,n){var i=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?i?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":i?e.setProperty(t,n):typeof n!="number"||n===0||Zv.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function Of(e,t,n){if(t!=null&&typeof t!="object")throw Error(l(62));if(e=e.style,n!=null){for(var i in n)!n.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)&&n[u]!==i&&kf(e,u,i)}else for(var f in t)t.hasOwnProperty(f)&&kf(e,f,t[f])}function oc(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 cl(e){return Wv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function La(){}var cc=null;function uc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ln=null,Bn=null;function Rf(e){var t=Rn(e);if(t&&(e=t.stateNode)){var n=e[Dt]||null;e:switch(e=t.stateNode,t.type){case"input":if(ic(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Ft(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var u=i[Dt]||null;if(!u)throw Error(l(90));ic(i,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<n.length;t++)i=n[t],i.form===e.form&&Ef(i)}break e;case"textarea":Af(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&zn(e,!!n.multiple,t,!1)}}}var dc=!1;function Df(e,t,n){if(dc)return e(t,n);dc=!0;try{var i=e(t);return i}finally{if(dc=!1,(Ln!==null||Bn!==null)&&(Ql(),Ln&&(t=Ln,e=Bn,Bn=Ln=null,Rf(t),e)))for(t=0;t<e.length;t++)Rf(e[t])}}function Kr(e,t){var n=e.stateNode;if(n===null)return null;var i=n[Dt]||null;if(i===null)return null;n=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(n&&typeof n!="function")throw Error(l(231,t,typeof n));return n}var Ba=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fc=!1;if(Ba)try{var Yr={};Object.defineProperty(Yr,"passive",{get:function(){fc=!0}}),window.addEventListener("test",Yr,Yr),window.removeEventListener("test",Yr,Yr)}catch{fc=!1}var us=null,hc=null,ul=null;function Mf(){if(ul)return ul;var e,t=hc,n=t.length,i,u="value"in us?us.value:us.textContent,f=u.length;for(e=0;e<n&&t[e]===u[e];e++);var v=n-e;for(i=1;i<=v&&t[n-i]===u[f-i];i++);return ul=u.slice(e,1<i?1-i:void 0)}function dl(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 fl(){return!0}function zf(){return!1}function Mt(e){function t(n,i,u,f,v){this._reactName=n,this._targetInst=u,this.type=i,this.nativeEvent=f,this.target=v,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(n=e[b],this[b]=n?n(f):f[b]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?fl:zf,this.isPropagationStopped=zf,this}return w(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=fl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=fl)},persist:function(){},isPersistent:fl}),t}var Ys={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},hl=Mt(Ys),Jr=w({},Ys,{view:0,detail:0}),e0=Mt(Jr),mc,pc,Xr,ml=w({},Jr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:yc,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!==Xr&&(Xr&&e.type==="mousemove"?(mc=e.screenX-Xr.screenX,pc=e.screenY-Xr.screenY):pc=mc=0,Xr=e),mc)},movementY:function(e){return"movementY"in e?e.movementY:pc}}),Uf=Mt(ml),t0=w({},ml,{dataTransfer:0}),a0=Mt(t0),s0=w({},Jr,{relatedTarget:0}),gc=Mt(s0),n0=w({},Ys,{animationName:0,elapsedTime:0,pseudoElement:0}),r0=Mt(n0),i0=w({},Ys,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),l0=Mt(i0),o0=w({},Ys,{data:0}),Lf=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 yc(){return f0}var h0=w({},Jr,{key:function(e){if(e.key){var t=c0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=dl(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:yc,charCode:function(e){return e.type==="keypress"?dl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?dl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),m0=Mt(h0),p0=w({},ml,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Bf=Mt(p0),g0=w({},Jr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:yc}),y0=Mt(g0),v0=w({},Ys,{propertyName:0,elapsedTime:0,pseudoElement:0}),b0=Mt(v0),x0=w({},ml,{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=w({},Ys,{newState:0,oldState:0}),S0=Mt(_0),j0=[9,13,27,32],vc=Ba&&"CompositionEvent"in window,Qr=null;Ba&&"documentMode"in document&&(Qr=document.documentMode);var N0=Ba&&"TextEvent"in window&&!Qr,qf=Ba&&(!vc||Qr&&8<Qr&&11>=Qr),$f=" ",Hf=!1;function Vf(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 If(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var qn=!1;function E0(e,t){switch(e){case"compositionend":return If(t);case"keypress":return t.which!==32?null:(Hf=!0,$f);case"textInput":return e=t.data,e===$f&&Hf?null:e;default:return null}}function T0(e,t){if(qn)return e==="compositionend"||!vc&&Vf(e,t)?(e=Mf(),ul=hc=us=null,qn=!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 qf&&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 Gf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!A0[e.type]:t==="textarea"}function Pf(e,t,n,i){Ln?Bn?Bn.push(i):Bn=[i]:Ln=i,t=so(t,"onChange"),0<t.length&&(n=new hl("onChange","change",null,n,i),e.push({event:n,listeners:t}))}var Zr=null,Fr=null;function C0(e){Tp(e,0)}function pl(e){var t=Pr(e);if(Ef(t))return e}function Kf(e,t){if(e==="change")return t}var Yf=!1;if(Ba){var bc;if(Ba){var xc="oninput"in document;if(!xc){var Jf=document.createElement("div");Jf.setAttribute("oninput","return;"),xc=typeof Jf.oninput=="function"}bc=xc}else bc=!1;Yf=bc&&(!document.documentMode||9<document.documentMode)}function Xf(){Zr&&(Zr.detachEvent("onpropertychange",Qf),Fr=Zr=null)}function Qf(e){if(e.propertyName==="value"&&pl(Fr)){var t=[];Pf(t,Fr,e,uc(e)),Df(C0,t)}}function k0(e,t,n){e==="focusin"?(Xf(),Zr=t,Fr=n,Zr.attachEvent("onpropertychange",Qf)):e==="focusout"&&Xf()}function O0(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return pl(Fr)}function R0(e,t){if(e==="click")return pl(t)}function D0(e,t){if(e==="input"||e==="change")return pl(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 Wr(e,t){if(Ht(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(i=0;i<n.length;i++){var u=n[i];if(!ls.call(t,u)||!Ht(e[u],t[u]))return!1}return!0}function Zf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ff(e,t){var n=Zf(e);e=0;for(var i;n;){if(n.nodeType===3){if(i=e+n.textContent.length,e<=t&&i>=t)return{node:n,offset:t-e};e=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Zf(n)}}function Wf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Wf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function eh(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=ol(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ol(e.document)}return t}function wc(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=Ba&&"documentMode"in document&&11>=document.documentMode,$n=null,_c=null,ei=null,Sc=!1;function th(e,t,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Sc||$n==null||$n!==ol(i)||(i=$n,"selectionStart"in i&&wc(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}),ei&&Wr(ei,i)||(ei=i,i=so(_c,"onSelect"),0<i.length&&(t=new hl("onSelect","select",null,t,n),e.push({event:t,listeners:i}),t.target=$n)))}function Js(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Hn={animationend:Js("Animation","AnimationEnd"),animationiteration:Js("Animation","AnimationIteration"),animationstart:Js("Animation","AnimationStart"),transitionrun:Js("Transition","TransitionRun"),transitionstart:Js("Transition","TransitionStart"),transitioncancel:Js("Transition","TransitionCancel"),transitionend:Js("Transition","TransitionEnd")},jc={},ah={};Ba&&(ah=document.createElement("div").style,"AnimationEvent"in window||(delete Hn.animationend.animation,delete Hn.animationiteration.animation,delete Hn.animationstart.animation),"TransitionEvent"in window||delete Hn.transitionend.transition);function Xs(e){if(jc[e])return jc[e];if(!Hn[e])return e;var t=Hn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in ah)return jc[e]=t[n];return e}var sh=Xs("animationend"),nh=Xs("animationiteration"),rh=Xs("animationstart"),U0=Xs("transitionrun"),L0=Xs("transitionstart"),B0=Xs("transitioncancel"),ih=Xs("transitionend"),lh=new Map,Nc="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(" ");Nc.push("scrollEnd");function oa(e,t){lh.set(e,t),Ks(t,[e])}var gl=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=[],Vn=0,Ec=0;function yl(){for(var e=Vn,t=Ec=Vn=0;t<e;){var n=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 v=i.pending;v===null?u.next=u:(u.next=v.next,v.next=u),i.pending=u}f!==0&&oh(n,u,f)}}function vl(e,t,n,i){Wt[Vn++]=e,Wt[Vn++]=t,Wt[Vn++]=n,Wt[Vn++]=i,Ec|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function Tc(e,t,n,i){return vl(e,t,n,i),bl(e)}function Qs(e,t){return vl(e,null,null,t),bl(e)}function oh(e,t,n){e.lanes|=n;var i=e.alternate;i!==null&&(i.lanes|=n);for(var u=!1,f=e.return;f!==null;)f.childLanes|=n,i=f.alternate,i!==null&&(i.childLanes|=n),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(n),e=f.hiddenUpdates,i=e[u],i===null?e[u]=[t]:i.push(t),t.lane=n|536870912),f):null}function bl(e){if(50<_i)throw _i=0,Uu=null,Error(l(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var In={};function q0(e,t,n,i){this.tag=e,this.key=n,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,n,i){return new q0(e,t,n,i)}function Ac(e){return e=e.prototype,!(!e||!e.isReactComponent)}function qa(e,t){var n=e.alternate;return n===null?(n=Vt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ch(e,t){e.flags&=65011714;var n=e.alternate;return n===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=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function xl(e,t,n,i,u,f){var v=0;if(i=e,typeof e=="function")Ac(e)&&(v=1);else if(typeof e=="string")v=Gb(e,n,F.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case oe:return e=Vt(31,n,t,u),e.elementType=oe,e.lanes=f,e;case j:return Zs(n.children,u,f,t);case R:v=8,u|=24;break;case D:return e=Vt(12,n,t,u|2),e.elementType=D,e.lanes=f,e;case W:return e=Vt(13,n,t,u),e.elementType=W,e.lanes=f,e;case Y:return e=Vt(19,n,t,u),e.elementType=Y,e.lanes=f,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case q:v=10;break e;case B:v=9;break e;case P:v=11;break e;case I:v=14;break e;case X:v=16,i=null;break e}v=29,n=Error(l(130,e===null?"null":typeof e,"")),i=null}return t=Vt(v,n,t,u),t.elementType=e,t.type=i,t.lanes=f,t}function Zs(e,t,n,i){return e=Vt(7,e,i,t),e.lanes=n,e}function Cc(e,t,n){return e=Vt(6,e,null,t),e.lanes=n,e}function uh(e){var t=Vt(18,null,null,0);return t.stateNode=e,t}function kc(e,t,n){return t=Vt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var dh=new WeakMap;function ea(e,t){if(typeof e=="object"&&e!==null){var n=dh.get(e);return n!==void 0?n:(t={value:e,source:t,stack:$r(t)},dh.set(e,t),t)}return{value:e,source:t,stack:$r(t)}}var Gn=[],Pn=0,wl=null,ti=0,ta=[],aa=0,ds=null,xa=1,wa="";function $a(e,t){Gn[Pn++]=ti,Gn[Pn++]=wl,wl=e,ti=t}function fh(e,t,n){ta[aa++]=xa,ta[aa++]=wa,ta[aa++]=ds,ds=e;var i=xa;e=wa;var u=32-Ot(i)-1;i&=~(1<<u),n+=1;var f=32-Ot(t)+u;if(30<f){var v=u-u%5;f=(i&(1<<v)-1).toString(32),i>>=v,u-=v,xa=1<<32-Ot(t)+u|n<<u|i,wa=f+e}else xa=1<<f|n<<u|i,wa=e}function Oc(e){e.return!==null&&($a(e,1),fh(e,1,0))}function Rc(e){for(;e===wl;)wl=Gn[--Pn],Gn[Pn]=null,ti=Gn[--Pn],Gn[Pn]=null;for(;e===ds;)ds=ta[--aa],ta[aa]=null,wa=ta[--aa],ta[aa]=null,xa=ta[--aa],ta[aa]=null}function hh(e,t){ta[aa++]=xa,ta[aa++]=wa,ta[aa++]=ds,xa=t.id,wa=t.overflow,ds=e}var _t=null,Xe=null,Oe=!1,fs=null,sa=!1,Dc=Error(l(519));function hs(e){var t=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ai(ea(t,e)),Dc}function mh(e){var t=e.stateNode,n=e.type,i=e.memoizedProps;switch(t[ut]=e,t[Dt]=i,n){case"dialog":Te("cancel",t),Te("close",t);break;case"iframe":case"object":case"embed":Te("load",t);break;case"video":case"audio":for(n=0;n<ji.length;n++)Te(ji[n],t);break;case"source":Te("error",t);break;case"img":case"image":case"link":Te("error",t),Te("load",t);break;case"details":Te("toggle",t);break;case"input":Te("invalid",t),Tf(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":Te("invalid",t);break;case"textarea":Te("invalid",t),Cf(t,i.value,i.defaultValue,i.children)}n=i.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||i.suppressHydrationWarning===!0||Op(t.textContent,n)?(i.popover!=null&&(Te("beforetoggle",t),Te("toggle",t)),i.onScroll!=null&&Te("scroll",t),i.onScrollEnd!=null&&Te("scrollend",t),i.onClick!=null&&(t.onclick=La),t=!0):t=!1,t||hs(e,!0)}function ph(e){for(_t=e.return;_t;)switch(_t.tag){case 5:case 31:case 13:sa=!1;return;case 27:case 3:sa=!0;return;default:_t=_t.return}}function Kn(e){if(e!==_t)return!1;if(!Oe)return ph(e),Oe=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Zu(e.type,e.memoizedProps)),n=!n),n&&Xe&&hs(e),ph(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Xe=$p(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Xe=$p(e)}else t===27?(t=Xe,Ts(e.type)?(e=ad,ad=null,Xe=e):Xe=t):Xe=_t?ra(e.stateNode.nextSibling):null;return!0}function Fs(){Xe=_t=null,Oe=!1}function Mc(){var e=fs;return e!==null&&(Bt===null?Bt=e:Bt.push.apply(Bt,e),fs=null),e}function ai(e){fs===null?fs=[e]:fs.push(e)}var zc=A(null),Ws=null,Ha=null;function ms(e,t,n){Q(zc,t._currentValue),t._currentValue=n}function Va(e){e._currentValue=zc.current,V(zc)}function Uc(e,t,n){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===n)break;e=e.return}}function Lc(e,t,n,i){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var f=u.dependencies;if(f!==null){var v=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|=n,b=f.alternate,b!==null&&(b.lanes|=n),Uc(f.return,n,e),i||(v=null);break e}f=b.next}}else if(u.tag===18){if(v=u.return,v===null)throw Error(l(341));v.lanes|=n,f=v.alternate,f!==null&&(f.lanes|=n),Uc(v,n,e),v=null}else v=u.child;if(v!==null)v.return=u;else for(v=u;v!==null;){if(v===e){v=null;break}if(u=v.sibling,u!==null){u.return=v.return,v=u;break}v=v.return}u=v}}function Yn(e,t,n,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 v=u.alternate;if(v===null)throw Error(l(387));if(v=v.memoizedProps,v!==null){var b=u.type;Ht(u.pendingProps.value,v.value)||(e!==null?e.push(b):e=[b])}}else if(u===ue.current){if(v=u.alternate,v===null)throw Error(l(387));v.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(Ci):e=[Ci])}u=u.return}e!==null&&Lc(t,e,n,i),t.flags|=262144}function _l(e){for(e=e.firstContext;e!==null;){if(!Ht(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function en(e){Ws=e,Ha=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function St(e){return gh(Ws,e)}function Sl(e,t){return Ws===null&&en(e),gh(e,t)}function gh(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ha===null){if(e===null)throw Error(l(308));Ha=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ha=Ha.next=t;return n}var $0=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},H0=s.unstable_scheduleCallback,V0=s.unstable_NormalPriority,nt={$$typeof:q,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Bc(){return{controller:new $0,data:new Map,refCount:0}}function si(e){e.refCount--,e.refCount===0&&H0(V0,function(){e.controller.abort()})}var ni=null,qc=0,Jn=0,Xn=null;function I0(e,t){if(ni===null){var n=ni=[];qc=0,Jn=Vu(),Xn={status:"pending",value:void 0,then:function(i){n.push(i)}}}return qc++,t.then(yh,yh),t}function yh(){if(--qc===0&&ni!==null){Xn!==null&&(Xn.status="fulfilled");var e=ni;ni=null,Jn=0,Xn=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function G0(e,t){var n=[],i={status:"pending",value:null,reason:null,then:function(u){n.push(u)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var u=0;u<n.length;u++)(0,n[u])(t)},function(u){for(i.status="rejected",i.reason=u,u=0;u<n.length;u++)(0,n[u])(void 0)}),i}var vh=C.S;C.S=function(e,t){tp=gt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&I0(e,t),vh!==null&&vh(e,t)};var tn=A(null);function $c(){var e=tn.current;return e!==null?e:Pe.pooledCache}function jl(e,t){t===null?Q(tn,tn.current):Q(tn,t.pool)}function bh(){var e=$c();return e===null?null:{parent:nt._currentValue,pool:e}}var Qn=Error(l(460)),Hc=Error(l(474)),Nl=Error(l(542)),El={then:function(){}};function xh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function wh(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(La,La),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Sh(e),e;default:if(typeof t.status=="string")t.then(La,La);else{if(e=Pe,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,Sh(e),e}throw sn=t,Qn}}function an(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(sn=n,Qn):n}}var sn=null;function _h(){if(sn===null)throw Error(l(459));var e=sn;return sn=null,e}function Sh(e){if(e===Qn||e===Nl)throw Error(l(483))}var Zn=null,ri=0;function Tl(e){var t=ri;return ri+=1,Zn===null&&(Zn=[]),wh(Zn,e,t)}function ii(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Al(e,t){throw t.$$typeof===_?Error(l(525)):(e=Object.prototype.toString.call(t),Error(l(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function jh(e){function t(k,T){if(e){var M=k.deletions;M===null?(k.deletions=[T],k.flags|=16):M.push(T)}}function n(k,T){if(!e)return null;for(;T!==null;)t(k,T),T=T.sibling;return null}function i(k){for(var T=new Map;k!==null;)k.key!==null?T.set(k.key,k):T.set(k.index,k),k=k.sibling;return T}function u(k,T){return k=qa(k,T),k.index=0,k.sibling=null,k}function f(k,T,M){return k.index=M,e?(M=k.alternate,M!==null?(M=M.index,M<T?(k.flags|=67108866,T):M):(k.flags|=67108866,T)):(k.flags|=1048576,T)}function v(k){return e&&k.alternate===null&&(k.flags|=67108866),k}function b(k,T,M,H){return T===null||T.tag!==6?(T=Cc(M,k.mode,H),T.return=k,T):(T=u(T,M),T.return=k,T)}function N(k,T,M,H){var ce=M.type;return ce===j?$(k,T,M.props.children,H,M.key):T!==null&&(T.elementType===ce||typeof ce=="object"&&ce!==null&&ce.$$typeof===X&&an(ce)===T.type)?(T=u(T,M.props),ii(T,M),T.return=k,T):(T=xl(M.type,M.key,M.props,null,k.mode,H),ii(T,M),T.return=k,T)}function z(k,T,M,H){return T===null||T.tag!==4||T.stateNode.containerInfo!==M.containerInfo||T.stateNode.implementation!==M.implementation?(T=kc(M,k.mode,H),T.return=k,T):(T=u(T,M.children||[]),T.return=k,T)}function $(k,T,M,H,ce){return T===null||T.tag!==7?(T=Zs(M,k.mode,H,ce),T.return=k,T):(T=u(T,M),T.return=k,T)}function G(k,T,M){if(typeof T=="string"&&T!==""||typeof T=="number"||typeof T=="bigint")return T=Cc(""+T,k.mode,M),T.return=k,T;if(typeof T=="object"&&T!==null){switch(T.$$typeof){case S:return M=xl(T.type,T.key,T.props,null,k.mode,M),ii(M,T),M.return=k,M;case E:return T=kc(T,k.mode,M),T.return=k,T;case X:return T=an(T),G(k,T,M)}if(je(T)||pe(T))return T=Zs(T,k.mode,M,null),T.return=k,T;if(typeof T.then=="function")return G(k,Tl(T),M);if(T.$$typeof===q)return G(k,Sl(k,T),M);Al(k,T)}return null}function U(k,T,M,H){var ce=T!==null?T.key:null;if(typeof M=="string"&&M!==""||typeof M=="number"||typeof M=="bigint")return ce!==null?null:b(k,T,""+M,H);if(typeof M=="object"&&M!==null){switch(M.$$typeof){case S:return M.key===ce?N(k,T,M,H):null;case E:return M.key===ce?z(k,T,M,H):null;case X:return M=an(M),U(k,T,M,H)}if(je(M)||pe(M))return ce!==null?null:$(k,T,M,H,null);if(typeof M.then=="function")return U(k,T,Tl(M),H);if(M.$$typeof===q)return U(k,T,Sl(k,M),H);Al(k,M)}return null}function L(k,T,M,H,ce){if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return k=k.get(M)||null,b(T,k,""+H,ce);if(typeof H=="object"&&H!==null){switch(H.$$typeof){case S:return k=k.get(H.key===null?M:H.key)||null,N(T,k,H,ce);case E:return k=k.get(H.key===null?M:H.key)||null,z(T,k,H,ce);case X:return H=an(H),L(k,T,M,H,ce)}if(je(H)||pe(H))return k=k.get(M)||null,$(T,k,H,ce,null);if(typeof H.then=="function")return L(k,T,M,Tl(H),ce);if(H.$$typeof===q)return L(k,T,M,Sl(T,H),ce);Al(T,H)}return null}function ae(k,T,M,H){for(var ce=null,De=null,ie=T,xe=T=0,Ce=null;ie!==null&&xe<M.length;xe++){ie.index>xe?(Ce=ie,ie=null):Ce=ie.sibling;var Me=U(k,ie,M[xe],H);if(Me===null){ie===null&&(ie=Ce);break}e&&ie&&Me.alternate===null&&t(k,ie),T=f(Me,T,xe),De===null?ce=Me:De.sibling=Me,De=Me,ie=Ce}if(xe===M.length)return n(k,ie),Oe&&$a(k,xe),ce;if(ie===null){for(;xe<M.length;xe++)ie=G(k,M[xe],H),ie!==null&&(T=f(ie,T,xe),De===null?ce=ie:De.sibling=ie,De=ie);return Oe&&$a(k,xe),ce}for(ie=i(ie);xe<M.length;xe++)Ce=L(ie,k,xe,M[xe],H),Ce!==null&&(e&&Ce.alternate!==null&&ie.delete(Ce.key===null?xe:Ce.key),T=f(Ce,T,xe),De===null?ce=Ce:De.sibling=Ce,De=Ce);return e&&ie.forEach(function(Rs){return t(k,Rs)}),Oe&&$a(k,xe),ce}function fe(k,T,M,H){if(M==null)throw Error(l(151));for(var ce=null,De=null,ie=T,xe=T=0,Ce=null,Me=M.next();ie!==null&&!Me.done;xe++,Me=M.next()){ie.index>xe?(Ce=ie,ie=null):Ce=ie.sibling;var Rs=U(k,ie,Me.value,H);if(Rs===null){ie===null&&(ie=Ce);break}e&&ie&&Rs.alternate===null&&t(k,ie),T=f(Rs,T,xe),De===null?ce=Rs:De.sibling=Rs,De=Rs,ie=Ce}if(Me.done)return n(k,ie),Oe&&$a(k,xe),ce;if(ie===null){for(;!Me.done;xe++,Me=M.next())Me=G(k,Me.value,H),Me!==null&&(T=f(Me,T,xe),De===null?ce=Me:De.sibling=Me,De=Me);return Oe&&$a(k,xe),ce}for(ie=i(ie);!Me.done;xe++,Me=M.next())Me=L(ie,k,xe,Me.value,H),Me!==null&&(e&&Me.alternate!==null&&ie.delete(Me.key===null?xe:Me.key),T=f(Me,T,xe),De===null?ce=Me:De.sibling=Me,De=Me);return e&&ie.forEach(function(tx){return t(k,tx)}),Oe&&$a(k,xe),ce}function Ie(k,T,M,H){if(typeof M=="object"&&M!==null&&M.type===j&&M.key===null&&(M=M.props.children),typeof M=="object"&&M!==null){switch(M.$$typeof){case S:e:{for(var ce=M.key;T!==null;){if(T.key===ce){if(ce=M.type,ce===j){if(T.tag===7){n(k,T.sibling),H=u(T,M.props.children),H.return=k,k=H;break e}}else if(T.elementType===ce||typeof ce=="object"&&ce!==null&&ce.$$typeof===X&&an(ce)===T.type){n(k,T.sibling),H=u(T,M.props),ii(H,M),H.return=k,k=H;break e}n(k,T);break}else t(k,T);T=T.sibling}M.type===j?(H=Zs(M.props.children,k.mode,H,M.key),H.return=k,k=H):(H=xl(M.type,M.key,M.props,null,k.mode,H),ii(H,M),H.return=k,k=H)}return v(k);case E:e:{for(ce=M.key;T!==null;){if(T.key===ce)if(T.tag===4&&T.stateNode.containerInfo===M.containerInfo&&T.stateNode.implementation===M.implementation){n(k,T.sibling),H=u(T,M.children||[]),H.return=k,k=H;break e}else{n(k,T);break}else t(k,T);T=T.sibling}H=kc(M,k.mode,H),H.return=k,k=H}return v(k);case X:return M=an(M),Ie(k,T,M,H)}if(je(M))return ae(k,T,M,H);if(pe(M)){if(ce=pe(M),typeof ce!="function")throw Error(l(150));return M=ce.call(M),fe(k,T,M,H)}if(typeof M.then=="function")return Ie(k,T,Tl(M),H);if(M.$$typeof===q)return Ie(k,T,Sl(k,M),H);Al(k,M)}return typeof M=="string"&&M!==""||typeof M=="number"||typeof M=="bigint"?(M=""+M,T!==null&&T.tag===6?(n(k,T.sibling),H=u(T,M),H.return=k,k=H):(n(k,T),H=Cc(M,k.mode,H),H.return=k,k=H),v(k)):n(k,T)}return function(k,T,M,H){try{ri=0;var ce=Ie(k,T,M,H);return Zn=null,ce}catch(ie){if(ie===Qn||ie===Nl)throw ie;var De=Vt(29,ie,null,k.mode);return De.lanes=H,De.return=k,De}}}var nn=jh(!0),Nh=jh(!1),ps=!1;function Vc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ic(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 gs(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ys(e,t,n){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(Le&2)!==0){var u=i.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),i.pending=t,t=bl(e),oh(e,null,n),t}return vl(e,i,t,n),bl(e)}function li(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,ee(e,n)}}function Gc(e,t){var n=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var u=null,f=null;if(n=n.firstBaseUpdate,n!==null){do{var v={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};f===null?u=f=v:f=f.next=v,n=n.next}while(n!==null);f===null?u=f=t:f=f.next=t}else u=f=t;n={baseState:i.baseState,firstBaseUpdate:u,lastBaseUpdate:f,shared:i.shared,callbacks:i.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Pc=!1;function oi(){if(Pc){var e=Xn;if(e!==null)throw e}}function ci(e,t,n,i){Pc=!1;var u=e.updateQueue;ps=!1;var f=u.firstBaseUpdate,v=u.lastBaseUpdate,b=u.shared.pending;if(b!==null){u.shared.pending=null;var N=b,z=N.next;N.next=null,v===null?f=z:v.next=z,v=N;var $=e.alternate;$!==null&&($=$.updateQueue,b=$.lastBaseUpdate,b!==v&&(b===null?$.firstBaseUpdate=z:b.next=z,$.lastBaseUpdate=N))}if(f!==null){var G=u.baseState;v=0,$=z=N=null,b=f;do{var U=b.lane&-536870913,L=U!==b.lane;if(L?(Ae&U)===U:(i&U)===U){U!==0&&U===Jn&&(Pc=!0),$!==null&&($=$.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var ae=e,fe=b;U=t;var Ie=n;switch(fe.tag){case 1:if(ae=fe.payload,typeof ae=="function"){G=ae.call(Ie,G,U);break e}G=ae;break e;case 3:ae.flags=ae.flags&-65537|128;case 0:if(ae=fe.payload,U=typeof ae=="function"?ae.call(Ie,G,U):ae,U==null)break e;G=w({},G,U);break e;case 2:ps=!0}}U=b.callback,U!==null&&(e.flags|=64,L&&(e.flags|=8192),L=u.callbacks,L===null?u.callbacks=[U]:L.push(U))}else L={lane:U,tag:b.tag,payload:b.payload,callback:b.callback,next:null},$===null?(z=$=L,N=G):$=$.next=L,v|=U;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=G),u.baseState=N,u.firstBaseUpdate=z,u.lastBaseUpdate=$,f===null&&(u.shared.lanes=0),_s|=v,e.lanes=v,e.memoizedState=G}}function Eh(e,t){if(typeof e!="function")throw Error(l(191,e));e.call(t)}function Th(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Eh(n[e],t)}var Fn=A(null),Cl=A(0);function Ah(e,t){e=Za,Q(Cl,e),Q(Fn,t),Za=e|t.baseLanes}function Kc(){Q(Cl,Za),Q(Fn,Fn.current)}function Yc(){Za=Cl.current,V(Fn),V(Cl)}var It=A(null),na=null;function vs(e){var t=e.alternate;Q(at,at.current&1),Q(It,e),na===null&&(t===null||Fn.current!==null||t.memoizedState!==null)&&(na=e)}function Jc(e){Q(at,at.current),Q(It,e),na===null&&(na=e)}function Ch(e){e.tag===22?(Q(at,at.current),Q(It,e),na===null&&(na=e)):bs()}function bs(){Q(at,at.current),Q(It,It.current)}function Gt(e){V(It),na===e&&(na=null),V(at)}var at=A(0);function kl(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||ed(n)||td(n)))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 Ia=0,be=null,He=null,rt=null,Ol=!1,Wn=!1,rn=!1,Rl=0,ui=0,er=null,P0=0;function We(){throw Error(l(321))}function Xc(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ht(e[n],t[n]))return!1;return!0}function Qc(e,t,n,i,u,f){return Ia=f,be=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,C.H=e===null||e.memoizedState===null?fm:du,rn=!1,f=n(i,u),rn=!1,Wn&&(f=Oh(t,n,i,u)),kh(e),f}function kh(e){C.H=hi;var t=He!==null&&He.next!==null;if(Ia=0,rt=He=be=null,Ol=!1,ui=0,er=null,t)throw Error(l(300));e===null||it||(e=e.dependencies,e!==null&&_l(e)&&(it=!0))}function Oh(e,t,n,i){be=e;var u=0;do{if(Wn&&(er=null),ui=0,Wn=!1,25<=u)throw Error(l(301));if(u+=1,rt=He=null,e.updateQueue!=null){var f=e.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}C.H=hm,f=t(n,i)}while(Wn);return f}function K0(){var e=C.H,t=e.useState()[0];return t=typeof t.then=="function"?di(t):t,e=e.useState()[0],(He!==null?He.memoizedState:null)!==e&&(be.flags|=1024),t}function Zc(){var e=Rl!==0;return Rl=0,e}function Fc(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Wc(e){if(Ol){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ol=!1}Ia=0,rt=He=be=null,Wn=!1,ui=Rl=0,er=null}function Rt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return rt===null?be.memoizedState=rt=e:rt=rt.next=e,rt}function st(){if(He===null){var e=be.alternate;e=e!==null?e.memoizedState:null}else e=He.next;var t=rt===null?be.memoizedState:rt.next;if(t!==null)rt=t,He=e;else{if(e===null)throw be.alternate===null?Error(l(467)):Error(l(310));He=e,e={memoizedState:He.memoizedState,baseState:He.baseState,baseQueue:He.baseQueue,queue:He.queue,next:null},rt===null?be.memoizedState=rt=e:rt=rt.next=e}return rt}function Dl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function di(e){var t=ui;return ui+=1,er===null&&(er=[]),e=wh(er,e,t),t=be,(rt===null?t.memoizedState:rt.next)===null&&(t=t.alternate,C.H=t===null||t.memoizedState===null?fm:du),e}function Ml(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return di(e);if(e.$$typeof===q)return St(e)}throw Error(l(438,String(e)))}function eu(e){var t=null,n=be.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var i=be.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}),n===null&&(n=Dl(),be.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),i=0;i<e;i++)n[i]=Ue;return t.index++,n}function Ga(e,t){return typeof t=="function"?t(e):t}function zl(e){var t=st();return tu(t,He,e)}function tu(e,t,n){var i=e.queue;if(i===null)throw Error(l(311));i.lastRenderedReducer=n;var u=e.baseQueue,f=i.pending;if(f!==null){if(u!==null){var v=u.next;u.next=f.next,f.next=v}t.baseQueue=u=f,i.pending=null}if(f=e.baseState,u===null)e.memoizedState=f;else{t=u.next;var b=v=null,N=null,z=t,$=!1;do{var G=z.lane&-536870913;if(G!==z.lane?(Ae&G)===G:(Ia&G)===G){var U=z.revertLane;if(U===0)N!==null&&(N=N.next={lane:0,revertLane:0,gesture:null,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null}),G===Jn&&($=!0);else if((Ia&U)===U){z=z.next,U===Jn&&($=!0);continue}else G={lane:0,revertLane:z.revertLane,gesture:null,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null},N===null?(b=N=G,v=f):N=N.next=G,be.lanes|=U,_s|=U;G=z.action,rn&&n(f,G),f=z.hasEagerState?z.eagerState:n(f,G)}else U={lane:G,revertLane:z.revertLane,gesture:z.gesture,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null},N===null?(b=N=U,v=f):N=N.next=U,be.lanes|=G,_s|=G;z=z.next}while(z!==null&&z!==t);if(N===null?v=f:N.next=b,!Ht(f,e.memoizedState)&&(it=!0,$&&(n=Xn,n!==null)))throw n;e.memoizedState=f,e.baseState=v,e.baseQueue=N,i.lastRenderedState=f}return u===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function au(e){var t=st(),n=t.queue;if(n===null)throw Error(l(311));n.lastRenderedReducer=e;var i=n.dispatch,u=n.pending,f=t.memoizedState;if(u!==null){n.pending=null;var v=u=u.next;do f=e(f,v.action),v=v.next;while(v!==u);Ht(f,t.memoizedState)||(it=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),n.lastRenderedState=f}return[f,i]}function Rh(e,t,n){var i=be,u=st(),f=Oe;if(f){if(n===void 0)throw Error(l(407));n=n()}else n=t();var v=!Ht((He||u).memoizedState,n);if(v&&(u.memoizedState=n,it=!0),u=u.queue,ru(zh.bind(null,i,u,e),[e]),u.getSnapshot!==t||v||rt!==null&&rt.memoizedState.tag&1){if(i.flags|=2048,tr(9,{destroy:void 0},Mh.bind(null,i,u,n,t),null),Pe===null)throw Error(l(349));f||(Ia&127)!==0||Dh(i,t,n)}return n}function Dh(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=be.updateQueue,t===null?(t=Dl(),be.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Mh(e,t,n,i){t.value=n,t.getSnapshot=i,Uh(t)&&Lh(e)}function zh(e,t,n){return n(function(){Uh(t)&&Lh(e)})}function Uh(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ht(e,n)}catch{return!0}}function Lh(e){var t=Qs(e,2);t!==null&&qt(t,e,2)}function su(e){var t=Rt();if(typeof e=="function"){var n=e;if(e=n(),rn){va(!0);try{n()}finally{va(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ga,lastRenderedState:e},t}function Bh(e,t,n,i){return e.baseState=n,tu(e,He,typeof i=="function"?i:Ga)}function Y0(e,t,n,i,u){if(Bl(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(v){f.listeners.push(v)}};C.T!==null?n(!0):f.isTransition=!1,i(f),n=t.pending,n===null?(f.next=t.pending=f,qh(t,f)):(f.next=n.next,t.pending=n.next=f)}}function qh(e,t){var n=t.action,i=t.payload,u=e.state;if(t.isTransition){var f=C.T,v={};C.T=v;try{var b=n(u,i),N=C.S;N!==null&&N(v,b),$h(e,t,b)}catch(z){nu(e,t,z)}finally{f!==null&&v.types!==null&&(f.types=v.types),C.T=f}}else try{f=n(u,i),$h(e,t,f)}catch(z){nu(e,t,z)}}function $h(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(i){Hh(e,t,i)},function(i){return nu(e,t,i)}):Hh(e,t,n)}function Hh(e,t,n){t.status="fulfilled",t.value=n,Vh(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,qh(e,n)))}function nu(e,t,n){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=n,Vh(t),t=t.next;while(t!==i)}e.action=null}function Vh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ih(e,t){return t}function Gh(e,t){if(Oe){var n=Pe.formState;if(n!==null){e:{var i=be;if(Oe){if(Xe){t:{for(var u=Xe,f=sa;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){Xe=ra(u.nextSibling),i=u.data==="F!";break e}}hs(i)}i=!1}i&&(t=n[0])}}return n=Rt(),n.memoizedState=n.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ih,lastRenderedState:t},n.queue=i,n=cm.bind(null,be,i),i.dispatch=n,i=su(!1),f=uu.bind(null,be,!1,i.queue),i=Rt(),u={state:t,dispatch:null,action:e,pending:null},i.queue=u,n=Y0.bind(null,be,u,f,n),u.dispatch=n,i.memoizedState=e,[t,n,!1]}function Ph(e){var t=st();return Kh(t,He,e)}function Kh(e,t,n){if(t=tu(e,t,Ih)[0],e=zl(Ga)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=di(t)}catch(v){throw v===Qn?Nl:v}else i=t;t=st();var u=t.queue,f=u.dispatch;return n!==t.memoizedState&&(be.flags|=2048,tr(9,{destroy:void 0},J0.bind(null,u,n),null)),[i,f,e]}function J0(e,t){e.action=t}function Yh(e){var t=st(),n=He;if(n!==null)return Kh(t,n,e);st(),t=t.memoizedState,n=st();var i=n.queue.dispatch;return n.memoizedState=e,[t,i,!1]}function tr(e,t,n,i){return e={tag:e,create:n,deps:i,inst:t,next:null},t=be.updateQueue,t===null&&(t=Dl(),be.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(i=n.next,n.next=e,e.next=i,t.lastEffect=e),e}function Jh(){return st().memoizedState}function Ul(e,t,n,i){var u=Rt();be.flags|=e,u.memoizedState=tr(1|t,{destroy:void 0},n,i===void 0?null:i)}function Ll(e,t,n,i){var u=st();i=i===void 0?null:i;var f=u.memoizedState.inst;He!==null&&i!==null&&Xc(i,He.memoizedState.deps)?u.memoizedState=tr(t,f,n,i):(be.flags|=e,u.memoizedState=tr(1|t,f,n,i))}function Xh(e,t){Ul(8390656,8,e,t)}function ru(e,t){Ll(2048,8,e,t)}function X0(e){be.flags|=4;var t=be.updateQueue;if(t===null)t=Dl(),be.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Qh(e){var t=st().memoizedState;return X0({ref:t,nextImpl:e}),function(){if((Le&2)!==0)throw Error(l(440));return t.impl.apply(void 0,arguments)}}function Zh(e,t){return Ll(4,2,e,t)}function Fh(e,t){return Ll(4,4,e,t)}function Wh(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function em(e,t,n){n=n!=null?n.concat([e]):null,Ll(4,4,Wh.bind(null,t,e),n)}function iu(){}function tm(e,t){var n=st();t=t===void 0?null:t;var i=n.memoizedState;return t!==null&&Xc(t,i[1])?i[0]:(n.memoizedState=[e,t],e)}function am(e,t){var n=st();t=t===void 0?null:t;var i=n.memoizedState;if(t!==null&&Xc(t,i[1]))return i[0];if(i=e(),rn){va(!0);try{e()}finally{va(!1)}}return n.memoizedState=[i,t],i}function lu(e,t,n){return n===void 0||(Ia&1073741824)!==0&&(Ae&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=sp(),be.lanes|=e,_s|=e,n)}function sm(e,t,n,i){return Ht(n,t)?n:Fn.current!==null?(e=lu(e,n,i),Ht(e,t)||(it=!0),e):(Ia&42)===0||(Ia&1073741824)!==0&&(Ae&261930)===0?(it=!0,e.memoizedState=n):(e=sp(),be.lanes|=e,_s|=e,t)}function nm(e,t,n,i,u){var f=J.p;J.p=f!==0&&8>f?f:8;var v=C.T,b={};C.T=b,uu(e,!1,t,n);try{var N=u(),z=C.S;if(z!==null&&z(b,N),N!==null&&typeof N=="object"&&typeof N.then=="function"){var $=G0(N,i);fi(e,t,$,Yt(e))}else fi(e,t,i,Yt(e))}catch(G){fi(e,t,{then:function(){},status:"rejected",reason:G},Yt())}finally{J.p=f,v!==null&&b.types!==null&&(v.types=b.types),C.T=v}}function Q0(){}function ou(e,t,n,i){if(e.tag!==5)throw Error(l(476));var u=rm(e).queue;nm(e,u,t,K,n===null?Q0:function(){return im(e),n(i)})}function rm(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:Ga,lastRenderedState:K},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ga,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function im(e){var t=rm(e);t.next===null&&(t=e.alternate.memoizedState),fi(e,t.next.queue,{},Yt())}function cu(){return St(Ci)}function lm(){return st().memoizedState}function om(){return st().memoizedState}function Z0(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Yt();e=gs(n);var i=ys(t,e,n);i!==null&&(qt(i,t,n),li(i,t,n)),t={cache:Bc()},e.payload=t;return}t=t.return}}function F0(e,t,n){var i=Yt();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Bl(e)?um(t,n):(n=Tc(e,t,n,i),n!==null&&(qt(n,e,i),dm(n,t,i)))}function cm(e,t,n){var i=Yt();fi(e,t,n,i)}function fi(e,t,n,i){var u={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Bl(e))um(t,u);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=t.lastRenderedReducer,f!==null))try{var v=t.lastRenderedState,b=f(v,n);if(u.hasEagerState=!0,u.eagerState=b,Ht(b,v))return vl(e,t,u,0),Pe===null&&yl(),!1}catch{}if(n=Tc(e,t,u,i),n!==null)return qt(n,e,i),dm(n,t,i),!0}return!1}function uu(e,t,n,i){if(i={lane:2,revertLane:Vu(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Bl(e)){if(t)throw Error(l(479))}else t=Tc(e,n,i,2),t!==null&&qt(t,e,2)}function Bl(e){var t=e.alternate;return e===be||t!==null&&t===be}function um(e,t){Wn=Ol=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function dm(e,t,n){if((n&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,ee(e,n)}}var hi={readContext:St,use:Ml,useCallback:We,useContext:We,useEffect:We,useImperativeHandle:We,useLayoutEffect:We,useInsertionEffect:We,useMemo:We,useReducer:We,useRef:We,useState:We,useDebugValue:We,useDeferredValue:We,useTransition:We,useSyncExternalStore:We,useId:We,useHostTransitionStatus:We,useFormState:We,useActionState:We,useOptimistic:We,useMemoCache:We,useCacheRefresh:We};hi.useEffectEvent=We;var fm={readContext:St,use:Ml,useCallback:function(e,t){return Rt().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:Xh,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Ul(4194308,4,Wh.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ul(4194308,4,e,t)},useInsertionEffect:function(e,t){Ul(4,2,e,t)},useMemo:function(e,t){var n=Rt();t=t===void 0?null:t;var i=e();if(rn){va(!0);try{e()}finally{va(!1)}}return n.memoizedState=[i,t],i},useReducer:function(e,t,n){var i=Rt();if(n!==void 0){var u=n(t);if(rn){va(!0);try{n(t)}finally{va(!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,be,e),[i.memoizedState,e]},useRef:function(e){var t=Rt();return e={current:e},t.memoizedState=e},useState:function(e){e=su(e);var t=e.queue,n=cm.bind(null,be,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:iu,useDeferredValue:function(e,t){var n=Rt();return lu(n,e,t)},useTransition:function(){var e=su(!1);return e=nm.bind(null,be,e.queue,!0,!1),Rt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var i=be,u=Rt();if(Oe){if(n===void 0)throw Error(l(407));n=n()}else{if(n=t(),Pe===null)throw Error(l(349));(Ae&127)!==0||Dh(i,t,n)}u.memoizedState=n;var f={value:n,getSnapshot:t};return u.queue=f,Xh(zh.bind(null,i,f,e),[e]),i.flags|=2048,tr(9,{destroy:void 0},Mh.bind(null,i,f,n,t),null),n},useId:function(){var e=Rt(),t=Pe.identifierPrefix;if(Oe){var n=wa,i=xa;n=(i&~(1<<32-Ot(i)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Rl++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=P0++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:cu,useFormState:Gh,useActionState:Gh,useOptimistic:function(e){var t=Rt();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=uu.bind(null,be,!0,n),n.dispatch=t,[e,t]},useMemoCache:eu,useCacheRefresh:function(){return Rt().memoizedState=Z0.bind(null,be)},useEffectEvent:function(e){var t=Rt(),n={impl:e};return t.memoizedState=n,function(){if((Le&2)!==0)throw Error(l(440));return n.impl.apply(void 0,arguments)}}},du={readContext:St,use:Ml,useCallback:tm,useContext:St,useEffect:ru,useImperativeHandle:em,useInsertionEffect:Zh,useLayoutEffect:Fh,useMemo:am,useReducer:zl,useRef:Jh,useState:function(){return zl(Ga)},useDebugValue:iu,useDeferredValue:function(e,t){var n=st();return sm(n,He.memoizedState,e,t)},useTransition:function(){var e=zl(Ga)[0],t=st().memoizedState;return[typeof e=="boolean"?e:di(e),t]},useSyncExternalStore:Rh,useId:lm,useHostTransitionStatus:cu,useFormState:Ph,useActionState:Ph,useOptimistic:function(e,t){var n=st();return Bh(n,He,e,t)},useMemoCache:eu,useCacheRefresh:om};du.useEffectEvent=Qh;var hm={readContext:St,use:Ml,useCallback:tm,useContext:St,useEffect:ru,useImperativeHandle:em,useInsertionEffect:Zh,useLayoutEffect:Fh,useMemo:am,useReducer:au,useRef:Jh,useState:function(){return au(Ga)},useDebugValue:iu,useDeferredValue:function(e,t){var n=st();return He===null?lu(n,e,t):sm(n,He.memoizedState,e,t)},useTransition:function(){var e=au(Ga)[0],t=st().memoizedState;return[typeof e=="boolean"?e:di(e),t]},useSyncExternalStore:Rh,useId:lm,useHostTransitionStatus:cu,useFormState:Yh,useActionState:Yh,useOptimistic:function(e,t){var n=st();return He!==null?Bh(n,He,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:eu,useCacheRefresh:om};hm.useEffectEvent=Qh;function fu(e,t,n,i){t=e.memoizedState,n=n(i,t),n=n==null?t:w({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var hu={enqueueSetState:function(e,t,n){e=e._reactInternals;var i=Yt(),u=gs(i);u.payload=t,n!=null&&(u.callback=n),t=ys(e,u,i),t!==null&&(qt(t,e,i),li(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var i=Yt(),u=gs(i);u.tag=1,u.payload=t,n!=null&&(u.callback=n),t=ys(e,u,i),t!==null&&(qt(t,e,i),li(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Yt(),i=gs(n);i.tag=2,t!=null&&(i.callback=t),t=ys(e,i,n),t!==null&&(qt(t,e,n),li(t,e,n))}};function mm(e,t,n,i,u,f,v){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,f,v):t.prototype&&t.prototype.isPureReactComponent?!Wr(n,i)||!Wr(u,f):!0}function pm(e,t,n,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,i),t.state!==e&&hu.enqueueReplaceState(t,t.state,null)}function ln(e,t){var n=t;if("ref"in t){n={};for(var i in t)i!=="ref"&&(n[i]=t[i])}if(e=e.defaultProps){n===t&&(n=w({},n));for(var u in e)n[u]===void 0&&(n[u]=e[u])}return n}function gm(e){gl(e)}function ym(e){console.error(e)}function vm(e){gl(e)}function ql(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function bm(e,t,n){try{var i=e.onCaughtError;i(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function mu(e,t,n){return n=gs(n),n.tag=3,n.payload={element:null},n.callback=function(){ql(e,t)},n}function xm(e){return e=gs(e),e.tag=3,e}function wm(e,t,n,i){var u=n.type.getDerivedStateFromError;if(typeof u=="function"){var f=i.value;e.payload=function(){return u(f)},e.callback=function(){bm(t,n,i)}}var v=n.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(e.callback=function(){bm(t,n,i),typeof u!="function"&&(Ss===null?Ss=new Set([this]):Ss.add(this));var b=i.stack;this.componentDidCatch(i.value,{componentStack:b!==null?b:""})})}function W0(e,t,n,i,u){if(n.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(t=n.alternate,t!==null&&Yn(t,n,u,!0),n=It.current,n!==null){switch(n.tag){case 31:case 13:return na===null?Zl():n.alternate===null&&et===0&&(et=3),n.flags&=-257,n.flags|=65536,n.lanes=u,i===El?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([i]):t.add(i),qu(e,i,u)),!1;case 22:return n.flags|=65536,i===El?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([i]):n.add(i)),qu(e,i,u)),!1}throw Error(l(435,n.tag))}return qu(e,i,u),Zl(),!1}if(Oe)return t=It.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,i!==Dc&&(e=Error(l(422),{cause:i}),ai(ea(e,n)))):(i!==Dc&&(t=Error(l(423),{cause:i}),ai(ea(t,n))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,i=ea(i,n),u=mu(e.stateNode,i,u),Gc(e,u),et!==4&&(et=2)),!1;var f=Error(l(520),{cause:i});if(f=ea(f,n),wi===null?wi=[f]:wi.push(f),et!==4&&(et=2),t===null)return!0;i=ea(i,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=u&-u,n.lanes|=e,e=mu(n.stateNode,i,e),Gc(n,e),!1;case 1:if(t=n.type,f=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(Ss===null||!Ss.has(f))))return n.flags|=65536,u&=-u,n.lanes|=u,u=xm(u),wm(u,e,n,i),Gc(n,u),!1}n=n.return}while(n!==null);return!1}var pu=Error(l(461)),it=!1;function jt(e,t,n,i){t.child=e===null?Nh(t,null,n,i):nn(t,e.child,n,i)}function _m(e,t,n,i,u){n=n.render;var f=t.ref;if("ref"in i){var v={};for(var b in i)b!=="ref"&&(v[b]=i[b])}else v=i;return en(t),i=Qc(e,t,n,v,f,u),b=Zc(),e!==null&&!it?(Fc(e,t,u),Pa(e,t,u)):(Oe&&b&&Oc(t),t.flags|=1,jt(e,t,i,u),t.child)}function Sm(e,t,n,i,u){if(e===null){var f=n.type;return typeof f=="function"&&!Ac(f)&&f.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=f,jm(e,t,f,i,u)):(e=xl(n.type,null,i,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!Su(e,u)){var v=f.memoizedProps;if(n=n.compare,n=n!==null?n:Wr,n(v,i)&&e.ref===t.ref)return Pa(e,t,u)}return t.flags|=1,e=qa(f,i),e.ref=t.ref,e.return=t,t.child=e}function jm(e,t,n,i,u){if(e!==null){var f=e.memoizedProps;if(Wr(f,i)&&e.ref===t.ref)if(it=!1,t.pendingProps=i=f,Su(e,u))(e.flags&131072)!==0&&(it=!0);else return t.lanes=e.lanes,Pa(e,t,u)}return gu(e,t,n,i,u)}function Nm(e,t,n,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|n:n,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 Em(e,t,f,n,i)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&jl(t,f!==null?f.cachePool:null),f!==null?Ah(t,f):Kc(),Ch(t);else return i=t.lanes=536870912,Em(e,t,f!==null?f.baseLanes|n:n,n,i)}else f!==null?(jl(t,f.cachePool),Ah(t,f),bs(),t.memoizedState=null):(e!==null&&jl(t,null),Kc(),bs());return jt(e,t,u,n),t.child}function mi(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Em(e,t,n,i,u){var f=$c();return f=f===null?null:{parent:nt._currentValue,pool:f},t.memoizedState={baseLanes:n,cachePool:f},e!==null&&jl(t,null),Kc(),Ch(t),e!==null&&Yn(e,t,i,!0),t.childLanes=u,null}function $l(e,t){return t=Vl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Tm(e,t,n){return nn(t,e.child,null,n),e=$l(t,t.pendingProps),e.flags|=2,Gt(t),t.memoizedState=null,e}function eb(e,t,n){var i=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Oe){if(i.mode==="hidden")return e=$l(t,i),t.lanes=536870912,mi(null,e);if(Jc(t),(e=Xe)?(e=qp(e,sa),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ds!==null?{id:xa,overflow:wa}:null,retryLane:536870912,hydrationErrors:null},n=uh(e),n.return=t,t.child=n,_t=t,Xe=null)):e=null,e===null)throw hs(t);return t.lanes=536870912,null}return $l(t,i)}var f=e.memoizedState;if(f!==null){var v=f.dehydrated;if(Jc(t),u)if(t.flags&256)t.flags&=-257,t=Tm(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(l(558));else if(it||Yn(e,t,n,!1),u=(n&e.childLanes)!==0,it||u){if(i=Pe,i!==null&&(v=ke(i,n),v!==0&&v!==f.retryLane))throw f.retryLane=v,Qs(e,v),qt(i,e,v),pu;Zl(),t=Tm(e,t,n)}else e=f.treeContext,Xe=ra(v.nextSibling),_t=t,Oe=!0,fs=null,sa=!1,e!==null&&hh(t,e),t=$l(t,i),t.flags|=4096;return t}return e=qa(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Hl(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(l(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function gu(e,t,n,i,u){return en(t),n=Qc(e,t,n,i,void 0,u),i=Zc(),e!==null&&!it?(Fc(e,t,u),Pa(e,t,u)):(Oe&&i&&Oc(t),t.flags|=1,jt(e,t,n,u),t.child)}function Am(e,t,n,i,u,f){return en(t),t.updateQueue=null,n=Oh(t,i,n,u),kh(e),i=Zc(),e!==null&&!it?(Fc(e,t,f),Pa(e,t,f)):(Oe&&i&&Oc(t),t.flags|=1,jt(e,t,n,f),t.child)}function Cm(e,t,n,i,u){if(en(t),t.stateNode===null){var f=In,v=n.contextType;typeof v=="object"&&v!==null&&(f=St(v)),f=new n(i,f),t.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=hu,t.stateNode=f,f._reactInternals=t,f=t.stateNode,f.props=i,f.state=t.memoizedState,f.refs={},Vc(t),v=n.contextType,f.context=typeof v=="object"&&v!==null?St(v):In,f.state=t.memoizedState,v=n.getDerivedStateFromProps,typeof v=="function"&&(fu(t,n,v,i),f.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(v=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),v!==f.state&&hu.enqueueReplaceState(f,f.state,null),ci(t,i,f,u),oi(),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=ln(n,b);f.props=N;var z=f.context,$=n.contextType;v=In,typeof $=="object"&&$!==null&&(v=St($));var G=n.getDerivedStateFromProps;$=typeof G=="function"||typeof f.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,$||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(b||z!==v)&&pm(t,f,i,v),ps=!1;var U=t.memoizedState;f.state=U,ci(t,i,f,u),oi(),z=t.memoizedState,b||U!==z||ps?(typeof G=="function"&&(fu(t,n,G,i),z=t.memoizedState),(N=ps||mm(t,n,N,i,U,z,v))?($||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=z),f.props=i,f.state=z,f.context=v,i=N):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{f=t.stateNode,Ic(e,t),v=t.memoizedProps,$=ln(n,v),f.props=$,G=t.pendingProps,U=f.context,z=n.contextType,N=In,typeof z=="object"&&z!==null&&(N=St(z)),b=n.getDerivedStateFromProps,(z=typeof b=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(v!==G||U!==N)&&pm(t,f,i,N),ps=!1,U=t.memoizedState,f.state=U,ci(t,i,f,u),oi();var L=t.memoizedState;v!==G||U!==L||ps||e!==null&&e.dependencies!==null&&_l(e.dependencies)?(typeof b=="function"&&(fu(t,n,b,i),L=t.memoizedState),($=ps||mm(t,n,$,i,U,L,N)||e!==null&&e.dependencies!==null&&_l(e.dependencies))?(z||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"||v===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&U===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"||v===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&U===e.memoizedState||(t.flags|=1024),i=!1)}return f=i,Hl(e,t),i=(t.flags&128)!==0,f||i?(f=t.stateNode,n=i&&typeof n.getDerivedStateFromError!="function"?null:f.render(),t.flags|=1,e!==null&&i?(t.child=nn(t,e.child,null,u),t.child=nn(t,null,n,u)):jt(e,t,n,u),t.memoizedState=f.state,e=t.child):e=Pa(e,t,u),e}function km(e,t,n,i){return Fs(),t.flags|=256,jt(e,t,n,i),t.child}var yu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function vu(e){return{baseLanes:e,cachePool:bh()}}function bu(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Kt),e}function Om(e,t,n){var i=t.pendingProps,u=!1,f=(t.flags&128)!==0,v;if((v=f)||(v=e!==null&&e.memoizedState===null?!1:(at.current&2)!==0),v&&(u=!0,t.flags&=-129),v=(t.flags&32)!==0,t.flags&=-33,e===null){if(Oe){if(u?vs(t):bs(),(e=Xe)?(e=qp(e,sa),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ds!==null?{id:xa,overflow:wa}:null,retryLane:536870912,hydrationErrors:null},n=uh(e),n.return=t,t.child=n,_t=t,Xe=null)):e=null,e===null)throw hs(t);return td(e)?t.lanes=32:t.lanes=536870912,null}var b=i.children;return i=i.fallback,u?(bs(),u=t.mode,b=Vl({mode:"hidden",children:b},u),i=Zs(i,u,n,null),b.return=t,i.return=t,b.sibling=i,t.child=b,i=t.child,i.memoizedState=vu(n),i.childLanes=bu(e,v,n),t.memoizedState=yu,mi(null,i)):(vs(t),xu(t,b))}var N=e.memoizedState;if(N!==null&&(b=N.dehydrated,b!==null)){if(f)t.flags&256?(vs(t),t.flags&=-257,t=wu(e,t,n)):t.memoizedState!==null?(bs(),t.child=e.child,t.flags|=128,t=null):(bs(),b=i.fallback,u=t.mode,i=Vl({mode:"visible",children:i.children},u),b=Zs(b,u,n,null),b.flags|=2,i.return=t,b.return=t,i.sibling=b,t.child=i,nn(t,e.child,null,n),i=t.child,i.memoizedState=vu(n),i.childLanes=bu(e,v,n),t.memoizedState=yu,t=mi(null,i));else if(vs(t),td(b)){if(v=b.nextSibling&&b.nextSibling.dataset,v)var z=v.dgst;v=z,i=Error(l(419)),i.stack="",i.digest=v,ai({value:i,source:null,stack:null}),t=wu(e,t,n)}else if(it||Yn(e,t,n,!1),v=(n&e.childLanes)!==0,it||v){if(v=Pe,v!==null&&(i=ke(v,n),i!==0&&i!==N.retryLane))throw N.retryLane=i,Qs(e,i),qt(v,e,i),pu;ed(b)||Zl(),t=wu(e,t,n)}else ed(b)?(t.flags|=192,t.child=e.child,t=null):(e=N.treeContext,Xe=ra(b.nextSibling),_t=t,Oe=!0,fs=null,sa=!1,e!==null&&hh(t,e),t=xu(t,i.children),t.flags|=4096);return t}return u?(bs(),b=i.fallback,u=t.mode,N=e.child,z=N.sibling,i=qa(N,{mode:"hidden",children:i.children}),i.subtreeFlags=N.subtreeFlags&65011712,z!==null?b=qa(z,b):(b=Zs(b,u,n,null),b.flags|=2),b.return=t,i.return=t,i.sibling=b,t.child=i,mi(null,i),i=t.child,b=e.child.memoizedState,b===null?b=vu(n):(u=b.cachePool,u!==null?(N=nt._currentValue,u=u.parent!==N?{parent:N,pool:N}:u):u=bh(),b={baseLanes:b.baseLanes|n,cachePool:u}),i.memoizedState=b,i.childLanes=bu(e,v,n),t.memoizedState=yu,mi(e.child,i)):(vs(t),n=e.child,e=n.sibling,n=qa(n,{mode:"visible",children:i.children}),n.return=t,n.sibling=null,e!==null&&(v=t.deletions,v===null?(t.deletions=[e],t.flags|=16):v.push(e)),t.child=n,t.memoizedState=null,n)}function xu(e,t){return t=Vl({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Vl(e,t){return e=Vt(22,e,null,t),e.lanes=0,e}function wu(e,t,n){return nn(t,e.child,null,n),e=xu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Rm(e,t,n){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),Uc(e.return,t,n)}function _u(e,t,n,i,u,f){var v=e.memoizedState;v===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:n,tailMode:u,treeForkCount:f}:(v.isBackwards=t,v.rendering=null,v.renderingStartTime=0,v.last=i,v.tail=n,v.tailMode=u,v.treeForkCount=f)}function Dm(e,t,n){var i=t.pendingProps,u=i.revealOrder,f=i.tail;i=i.children;var v=at.current,b=(v&2)!==0;if(b?(v=v&1|2,t.flags|=128):v&=1,Q(at,v),jt(e,t,i,n),i=Oe?ti:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Rm(e,n,t);else if(e.tag===19)Rm(e,n,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(n=t.child,u=null;n!==null;)e=n.alternate,e!==null&&kl(e)===null&&(u=n),n=n.sibling;n=u,n===null?(u=t.child,t.child=null):(u=n.sibling,n.sibling=null),_u(t,!1,u,n,f,i);break;case"backwards":case"unstable_legacy-backwards":for(n=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&kl(e)===null){t.child=u;break}e=u.sibling,u.sibling=n,n=u,u=e}_u(t,!0,n,null,f,i);break;case"together":_u(t,!1,null,null,void 0,i);break;default:t.memoizedState=null}return t.child}function Pa(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),_s|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Yn(e,t,n,!1),(n&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,n=qa(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=qa(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Su(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&_l(e)))}function tb(e,t,n){switch(t.tag){case 3:Ye(t,t.stateNode.containerInfo),ms(t,nt,e.memoizedState.cache),Fs();break;case 27:case 5:Ct(t);break;case 4:Ye(t,t.stateNode.containerInfo);break;case 10:ms(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Jc(t),null;break;case 13:var i=t.memoizedState;if(i!==null)return i.dehydrated!==null?(vs(t),t.flags|=128,null):(n&t.child.childLanes)!==0?Om(e,t,n):(vs(t),e=Pa(e,t,n),e!==null?e.sibling:null);vs(t);break;case 19:var u=(e.flags&128)!==0;if(i=(n&t.childLanes)!==0,i||(Yn(e,t,n,!1),i=(n&t.childLanes)!==0),u){if(i)return Dm(e,t,n);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),Q(at,at.current),i)break;return null;case 22:return t.lanes=0,Nm(e,t,n,t.pendingProps);case 24:ms(t,nt,e.memoizedState.cache)}return Pa(e,t,n)}function Mm(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)it=!0;else{if(!Su(e,n)&&(t.flags&128)===0)return it=!1,tb(e,t,n);it=(e.flags&131072)!==0}else it=!1,Oe&&(t.flags&1048576)!==0&&fh(t,ti,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=an(t.elementType),t.type=e,typeof e=="function")Ac(e)?(i=ln(e,i),t.tag=1,t=Cm(null,t,e,i,n)):(t.tag=0,t=gu(null,t,e,i,n));else{if(e!=null){var u=e.$$typeof;if(u===P){t.tag=11,t=_m(null,t,e,i,n);break e}else if(u===I){t.tag=14,t=Sm(null,t,e,i,n);break e}}throw t=Ge(e)||e,Error(l(306,t,""))}}return t;case 0:return gu(e,t,t.type,t.pendingProps,n);case 1:return i=t.type,u=ln(i,t.pendingProps),Cm(e,t,i,u,n);case 3:e:{if(Ye(t,t.stateNode.containerInfo),e===null)throw Error(l(387));i=t.pendingProps;var f=t.memoizedState;u=f.element,Ic(e,t),ci(t,i,null,n);var v=t.memoizedState;if(i=v.cache,ms(t,nt,i),i!==f.cache&&Lc(t,[nt],n,!0),oi(),i=v.element,f.isDehydrated)if(f={element:i,isDehydrated:!1,cache:v.cache},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){t=km(e,t,i,n);break e}else if(i!==u){u=ea(Error(l(424)),t),ai(u),t=km(e,t,i,n);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Xe=ra(e.firstChild),_t=t,Oe=!0,fs=null,sa=!0,n=Nh(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Fs(),i===u){t=Pa(e,t,n);break e}jt(e,t,i,n)}t=t.child}return t;case 26:return Hl(e,t),e===null?(n=Pp(t.type,null,t.pendingProps,null))?t.memoizedState=n:Oe||(n=t.type,e=t.pendingProps,i=no(ye.current).createElement(n),i[ut]=t,i[Dt]=e,Nt(i,n,e),vt(i),t.stateNode=i):t.memoizedState=Pp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ct(t),e===null&&Oe&&(i=t.stateNode=Vp(t.type,t.pendingProps,ye.current),_t=t,sa=!0,u=Xe,Ts(t.type)?(ad=u,Xe=ra(i.firstChild)):Xe=u),jt(e,t,t.pendingProps.children,n),Hl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Oe&&((u=i=Xe)&&(i=Ob(i,t.type,t.pendingProps,sa),i!==null?(t.stateNode=i,_t=t,Xe=ra(i.firstChild),sa=!1,u=!0):u=!1),u||hs(t)),Ct(t),u=t.type,f=t.pendingProps,v=e!==null?e.memoizedProps:null,i=f.children,Zu(u,f)?i=null:v!==null&&Zu(u,v)&&(t.flags|=32),t.memoizedState!==null&&(u=Qc(e,t,K0,null,null,n),Ci._currentValue=u),Hl(e,t),jt(e,t,i,n),t.child;case 6:return e===null&&Oe&&((e=n=Xe)&&(n=Rb(n,t.pendingProps,sa),n!==null?(t.stateNode=n,_t=t,Xe=null,e=!0):e=!1),e||hs(t)),null;case 13:return Om(e,t,n);case 4:return Ye(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=nn(t,null,i,n):jt(e,t,i,n),t.child;case 11:return _m(e,t,t.type,t.pendingProps,n);case 7:return jt(e,t,t.pendingProps,n),t.child;case 8:return jt(e,t,t.pendingProps.children,n),t.child;case 12:return jt(e,t,t.pendingProps.children,n),t.child;case 10:return i=t.pendingProps,ms(t,t.type,i.value),jt(e,t,i.children,n),t.child;case 9:return u=t.type._context,i=t.pendingProps.children,en(t),u=St(u),i=i(u),t.flags|=1,jt(e,t,i,n),t.child;case 14:return Sm(e,t,t.type,t.pendingProps,n);case 15:return jm(e,t,t.type,t.pendingProps,n);case 19:return Dm(e,t,n);case 31:return eb(e,t,n);case 22:return Nm(e,t,n,t.pendingProps);case 24:return en(t),i=St(nt),e===null?(u=$c(),u===null&&(u=Pe,f=Bc(),u.pooledCache=f,f.refCount++,f!==null&&(u.pooledCacheLanes|=n),u=f),t.memoizedState={parent:i,cache:u},Vc(t),ms(t,nt,u)):((e.lanes&n)!==0&&(Ic(e,t),ci(t,null,null,n),oi()),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),ms(t,nt,i)):(i=f.cache,ms(t,nt,i),i!==u.cache&&Lc(t,[nt],n,!0))),jt(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(l(156,t.tag))}function Ka(e){e.flags|=4}function ju(e,t,n,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(lp())e.flags|=8192;else throw sn=El,Hc}else e.flags&=-16777217}function zm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Qp(t))if(lp())e.flags|=8192;else throw sn=El,Hc}function Il(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?rl():536870912,e.lanes|=t,rr|=t)}function pi(e,t){if(!Oe)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function Qe(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,i=0;if(t)for(var u=e.child;u!==null;)n|=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;)n|=u.lanes|u.childLanes,i|=u.subtreeFlags,i|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=i,e.childLanes=n,t}function ab(e,t,n){var i=t.pendingProps;switch(Rc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qe(t),null;case 1:return Qe(t),null;case 3:return n=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Va(nt),Be(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Kn(t)?Ka(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Mc())),Qe(t),null;case 26:var u=t.type,f=t.memoizedState;return e===null?(Ka(t),f!==null?(Qe(t),zm(t,f)):(Qe(t),ju(t,u,null,i,n))):f?f!==e.memoizedState?(Ka(t),Qe(t),zm(t,f)):(Qe(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&Ka(t),Qe(t),ju(t,u,e,i,n)),null;case 27:if(pt(t),n=ye.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&Ka(t);else{if(!i){if(t.stateNode===null)throw Error(l(166));return Qe(t),null}e=F.current,Kn(t)?mh(t):(e=Vp(u,i,n),t.stateNode=e,Ka(t))}return Qe(t),null;case 5:if(pt(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&Ka(t);else{if(!i){if(t.stateNode===null)throw Error(l(166));return Qe(t),null}if(f=F.current,Kn(t))mh(t);else{var v=no(ye.current);switch(f){case 1:f=v.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:f=v.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":f=v.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":f=v.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":f=v.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof i.is=="string"?v.createElement("select",{is:i.is}):v.createElement("select"),i.multiple?f.multiple=!0:i.size&&(f.size=i.size);break;default:f=typeof i.is=="string"?v.createElement(u,{is:i.is}):v.createElement(u)}}f[ut]=t,f[Dt]=i;e:for(v=t.child;v!==null;){if(v.tag===5||v.tag===6)f.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===t)break e;for(;v.sibling===null;){if(v.return===null||v.return===t)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}t.stateNode=f;e:switch(Nt(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&&Ka(t)}}return Qe(t),ju(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&Ka(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(l(166));if(e=ye.current,Kn(t)){if(e=t.stateNode,n=t.memoizedProps,i=null,u=_t,u!==null)switch(u.tag){case 27:case 5:i=u.memoizedProps}e[ut]=t,e=!!(e.nodeValue===n||i!==null&&i.suppressHydrationWarning===!0||Op(e.nodeValue,n)),e||hs(t,!0)}else e=no(e).createTextNode(i),e[ut]=t,t.stateNode=e}return Qe(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(i=Kn(t),n!==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[ut]=t}else Fs(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Qe(t),e=!1}else n=Mc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Gt(t),t):(Gt(t),null);if((t.flags&128)!==0)throw Error(l(558))}return Qe(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=Kn(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[ut]=t}else Fs(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Qe(t),u=!1}else u=Mc(),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=n,t):(n=i!==null,e=e!==null&&e.memoizedState!==null,n&&(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)),n!==e&&n&&(t.child.flags|=8192),Il(t,t.updateQueue),Qe(t),null);case 4:return Be(),e===null&&Ku(t.stateNode.containerInfo),Qe(t),null;case 10:return Va(t.type),Qe(t),null;case 19:if(V(at),i=t.memoizedState,i===null)return Qe(t),null;if(u=(t.flags&128)!==0,f=i.rendering,f===null)if(u)pi(i,!1);else{if(et!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(f=kl(e),f!==null){for(t.flags|=128,pi(i,!1),e=f.updateQueue,t.updateQueue=e,Il(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ch(n,e),n=n.sibling;return Q(at,at.current&1|2),Oe&&$a(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&gt()>Jl&&(t.flags|=128,u=!0,pi(i,!1),t.lanes=4194304)}else{if(!u)if(e=kl(f),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,Il(t,e),pi(i,!0),i.tail===null&&i.tailMode==="hidden"&&!f.alternate&&!Oe)return Qe(t),null}else 2*gt()-i.renderingStartTime>Jl&&n!==536870912&&(t.flags|=128,u=!0,pi(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=gt(),e.sibling=null,n=at.current,Q(at,u?n&1|2:n&1),Oe&&$a(t,i.treeForkCount),e):(Qe(t),null);case 22:case 23:return Gt(t),Yc(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(n&536870912)!==0&&(t.flags&128)===0&&(Qe(t),t.subtreeFlags&6&&(t.flags|=8192)):Qe(t),n=t.updateQueue,n!==null&&Il(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==n&&(t.flags|=2048),e!==null&&V(tn),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Va(nt),Qe(t),null;case 25:return null;case 30:return null}throw Error(l(156,t.tag))}function sb(e,t){switch(Rc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Va(nt),Be(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return pt(t),null;case 31:if(t.memoizedState!==null){if(Gt(t),t.alternate===null)throw Error(l(340));Fs()}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));Fs()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(at),null;case 4:return Be(),null;case 10:return Va(t.type),null;case 22:case 23:return Gt(t),Yc(),e!==null&&V(tn),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Va(nt),null;case 25:return null;default:return null}}function Um(e,t){switch(Rc(t),t.tag){case 3:Va(nt),Be();break;case 26:case 27:case 5:pt(t);break;case 4:Be();break;case 31:t.memoizedState!==null&&Gt(t);break;case 13:Gt(t);break;case 19:V(at);break;case 10:Va(t.type);break;case 22:case 23:Gt(t),Yc(),e!==null&&V(tn);break;case 24:Va(nt)}}function gi(e,t){try{var n=t.updateQueue,i=n!==null?n.lastEffect:null;if(i!==null){var u=i.next;n=u;do{if((n.tag&e)===e){i=void 0;var f=n.create,v=n.inst;i=f(),v.destroy=i}n=n.next}while(n!==u)}}catch(b){$e(t,t.return,b)}}function xs(e,t,n){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 v=i.inst,b=v.destroy;if(b!==void 0){v.destroy=void 0,u=t;var N=n,z=b;try{z()}catch($){$e(u,N,$)}}}i=i.next}while(i!==f)}}catch($){$e(t,t.return,$)}}function Lm(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Th(t,n)}catch(i){$e(e,e.return,i)}}}function Bm(e,t,n){n.props=ln(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(i){$e(e,t,i)}}function yi(e,t){try{var n=e.ref;if(n!==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 n=="function"?e.refCleanup=n(i):n.current=i}}catch(u){$e(e,t,u)}}function _a(e,t){var n=e.ref,i=e.refCleanup;if(n!==null)if(typeof i=="function")try{i()}catch(u){$e(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(u){$e(e,t,u)}else n.current=null}function qm(e){var t=e.type,n=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&i.focus();break e;case"img":n.src?i.src=n.src:n.srcSet&&(i.srcset=n.srcSet)}}catch(u){$e(e,e.return,u)}}function Nu(e,t,n){try{var i=e.stateNode;Nb(i,e.type,n,t),i[Dt]=t}catch(u){$e(e,e.return,u)}}function $m(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ts(e.type)||e.tag===4}function Eu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||$m(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Ts(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 Tu(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=La));else if(i!==4&&(i===27&&Ts(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Tu(e,t,n),e=e.sibling;e!==null;)Tu(e,t,n),e=e.sibling}function Gl(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(i!==4&&(i===27&&Ts(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Gl(e,t,n),e=e.sibling;e!==null;)Gl(e,t,n),e=e.sibling}function Hm(e){var t=e.stateNode,n=e.memoizedProps;try{for(var i=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);Nt(t,i,n),t[ut]=e,t[Dt]=n}catch(f){$e(e,e.return,f)}}var Ya=!1,lt=!1,Au=!1,Vm=typeof WeakSet=="function"?WeakSet:Set,bt=null;function nb(e,t){if(e=e.containerInfo,Xu=fo,e=eh(e),wc(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var u=i.anchorOffset,f=i.focusNode;i=i.focusOffset;try{n.nodeType,f.nodeType}catch{n=null;break e}var v=0,b=-1,N=-1,z=0,$=0,G=e,U=null;t:for(;;){for(var L;G!==n||u!==0&&G.nodeType!==3||(b=v+u),G!==f||i!==0&&G.nodeType!==3||(N=v+i),G.nodeType===3&&(v+=G.nodeValue.length),(L=G.firstChild)!==null;)U=G,G=L;for(;;){if(G===e)break t;if(U===n&&++z===u&&(b=v),U===f&&++$===i&&(N=v),(L=G.nextSibling)!==null)break;G=U,U=G.parentNode}G=L}n=b===-1||N===-1?null:{start:b,end:N}}else n=null}n=n||{start:0,end:0}}else n=null;for(Qu={focusedElem:e,selectionRange:n},fo=!1,bt=t;bt!==null;)if(t=bt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,bt=e;else for(;bt!==null;){switch(t=bt,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(n=0;n<e.length;n++)u=e[n],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&f!==null){e=void 0,n=t,u=f.memoizedProps,f=f.memoizedState,i=n.stateNode;try{var ae=ln(n.type,u);e=i.getSnapshotBeforeUpdate(ae,f),i.__reactInternalSnapshotBeforeUpdate=e}catch(fe){$e(n,n.return,fe)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Wu(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Wu(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,bt=e;break}bt=t.return}}function Im(e,t,n){var i=n.flags;switch(n.tag){case 0:case 11:case 15:Xa(e,n),i&4&&gi(5,n);break;case 1:if(Xa(e,n),i&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(v){$e(n,n.return,v)}else{var u=ln(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(v){$e(n,n.return,v)}}i&64&&Lm(n),i&512&&yi(n,n.return);break;case 3:if(Xa(e,n),i&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Th(e,t)}catch(v){$e(n,n.return,v)}}break;case 27:t===null&&i&4&&Hm(n);case 26:case 5:Xa(e,n),t===null&&i&4&&qm(n),i&512&&yi(n,n.return);break;case 12:Xa(e,n);break;case 31:Xa(e,n),i&4&&Km(e,n);break;case 13:Xa(e,n),i&4&&Ym(e,n),i&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=hb.bind(null,n),Db(e,n))));break;case 22:if(i=n.memoizedState!==null||Ya,!i){t=t!==null&&t.memoizedState!==null||lt,u=Ya;var f=lt;Ya=i,(lt=t)&&!f?Qa(e,n,(n.subtreeFlags&8772)!==0):Xa(e,n),Ya=u,lt=f}break;case 30:break;default:Xa(e,n)}}function Gm(e){var t=e.alternate;t!==null&&(e.alternate=null,Gm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&nc(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 Ze=null,zt=!1;function Ja(e,t,n){for(n=n.child;n!==null;)Pm(e,t,n),n=n.sibling}function Pm(e,t,n){if(wt&&typeof wt.onCommitFiberUnmount=="function")try{wt.onCommitFiberUnmount(Hs,n)}catch{}switch(n.tag){case 26:lt||_a(n,t),Ja(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:lt||_a(n,t);var i=Ze,u=zt;Ts(n.type)&&(Ze=n.stateNode,zt=!1),Ja(e,t,n),Ei(n.stateNode),Ze=i,zt=u;break;case 5:lt||_a(n,t);case 6:if(i=Ze,u=zt,Ze=null,Ja(e,t,n),Ze=i,zt=u,Ze!==null)if(zt)try{(Ze.nodeType===9?Ze.body:Ze.nodeName==="HTML"?Ze.ownerDocument.body:Ze).removeChild(n.stateNode)}catch(f){$e(n,t,f)}else try{Ze.removeChild(n.stateNode)}catch(f){$e(n,t,f)}break;case 18:Ze!==null&&(zt?(e=Ze,Lp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),hr(e)):Lp(Ze,n.stateNode));break;case 4:i=Ze,u=zt,Ze=n.stateNode.containerInfo,zt=!0,Ja(e,t,n),Ze=i,zt=u;break;case 0:case 11:case 14:case 15:xs(2,n,t),lt||xs(4,n,t),Ja(e,t,n);break;case 1:lt||(_a(n,t),i=n.stateNode,typeof i.componentWillUnmount=="function"&&Bm(n,t,i)),Ja(e,t,n);break;case 21:Ja(e,t,n);break;case 22:lt=(i=lt)||n.memoizedState!==null,Ja(e,t,n),lt=i;break;default:Ja(e,t,n)}}function Km(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{hr(e)}catch(n){$e(t,t.return,n)}}}function Ym(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{hr(e)}catch(n){$e(t,t.return,n)}}function rb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Vm),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Vm),t;default:throw Error(l(435,e.tag))}}function Pl(e,t){var n=rb(e);t.forEach(function(i){if(!n.has(i)){n.add(i);var u=mb.bind(null,e,i);i.then(u,u)}})}function Ut(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var u=n[i],f=e,v=t,b=v;e:for(;b!==null;){switch(b.tag){case 27:if(Ts(b.type)){Ze=b.stateNode,zt=!1;break e}break;case 5:Ze=b.stateNode,zt=!1;break e;case 3:case 4:Ze=b.stateNode.containerInfo,zt=!0;break e}b=b.return}if(Ze===null)throw Error(l(160));Pm(f,v,u),Ze=null,zt=!1,f=u.alternate,f!==null&&(f.return=null),u.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Jm(t,e),t=t.sibling}var ca=null;function Jm(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ut(t,e),Lt(e),i&4&&(xs(3,e,e.return),gi(3,e),xs(5,e,e.return));break;case 1:Ut(t,e),Lt(e),i&512&&(lt||n===null||_a(n,n.return)),i&64&&Ya&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?i:n.concat(i))));break;case 26:var u=ca;if(Ut(t,e),Lt(e),i&512&&(lt||n===null||_a(n,n.return)),i&4){var f=n!==null?n.memoizedState:null;if(i=e.memoizedState,n===null)if(i===null)if(e.stateNode===null){e:{i=e.type,n=e.memoizedProps,u=u.ownerDocument||u;t:switch(i){case"title":f=u.getElementsByTagName("title")[0],(!f||f[Gr]||f[ut]||f.namespaceURI==="http://www.w3.org/2000/svg"||f.hasAttribute("itemprop"))&&(f=u.createElement(i),u.head.insertBefore(f,u.querySelector("head > title"))),Nt(f,i,n),f[ut]=e,vt(f),i=f;break e;case"link":var v=Jp("link","href",u).get(i+(n.href||""));if(v){for(var b=0;b<v.length;b++)if(f=v[b],f.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&f.getAttribute("rel")===(n.rel==null?null:n.rel)&&f.getAttribute("title")===(n.title==null?null:n.title)&&f.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){v.splice(b,1);break t}}f=u.createElement(i),Nt(f,i,n),u.head.appendChild(f);break;case"meta":if(v=Jp("meta","content",u).get(i+(n.content||""))){for(b=0;b<v.length;b++)if(f=v[b],f.getAttribute("content")===(n.content==null?null:""+n.content)&&f.getAttribute("name")===(n.name==null?null:n.name)&&f.getAttribute("property")===(n.property==null?null:n.property)&&f.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&f.getAttribute("charset")===(n.charSet==null?null:n.charSet)){v.splice(b,1);break t}}f=u.createElement(i),Nt(f,i,n),u.head.appendChild(f);break;default:throw Error(l(468,i))}f[ut]=e,vt(f),i=f}e.stateNode=i}else Xp(u,e.type,e.stateNode);else e.stateNode=Yp(u,i,e.memoizedProps);else f!==i?(f===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):f.count--,i===null?Xp(u,e.type,e.stateNode):Yp(u,i,e.memoizedProps)):i===null&&e.stateNode!==null&&Nu(e,e.memoizedProps,n.memoizedProps)}break;case 27:Ut(t,e),Lt(e),i&512&&(lt||n===null||_a(n,n.return)),n!==null&&i&4&&Nu(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Ut(t,e),Lt(e),i&512&&(lt||n===null||_a(n,n.return)),e.flags&32){u=e.stateNode;try{Un(u,"")}catch(ae){$e(e,e.return,ae)}}i&4&&e.stateNode!=null&&(u=e.memoizedProps,Nu(e,u,n!==null?n.memoizedProps:u)),i&1024&&(Au=!0);break;case 6:if(Ut(t,e),Lt(e),i&4){if(e.stateNode===null)throw Error(l(162));i=e.memoizedProps,n=e.stateNode;try{n.nodeValue=i}catch(ae){$e(e,e.return,ae)}}break;case 3:if(lo=null,u=ca,ca=ro(t.containerInfo),Ut(t,e),ca=u,Lt(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{hr(t.containerInfo)}catch(ae){$e(e,e.return,ae)}Au&&(Au=!1,Xm(e));break;case 4:i=ca,ca=ro(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,Pl(e,i)));break;case 13:Ut(t,e),Lt(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Yl=gt()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Pl(e,i)));break;case 22:u=e.memoizedState!==null;var N=n!==null&&n.memoizedState!==null,z=Ya,$=lt;if(Ya=z||u,lt=$||N,Ut(t,e),lt=$,Ya=z,Lt(e),i&8192)e:for(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,u&&(n===null||N||Ya||lt||on(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){N=n=t;try{if(f=N.stateNode,u)v=f.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{b=N.stateNode;var G=N.memoizedProps.style,U=G!=null&&G.hasOwnProperty("display")?G.display:null;b.style.display=U==null||typeof U=="boolean"?"":(""+U).trim()}}catch(ae){$e(N,N.return,ae)}}}else if(t.tag===6){if(n===null){N=t;try{N.stateNode.nodeValue=u?"":N.memoizedProps}catch(ae){$e(N,N.return,ae)}}}else if(t.tag===18){if(n===null){N=t;try{var L=N.stateNode;u?Bp(L,!0):Bp(N.stateNode,!1)}catch(ae){$e(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;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}i&4&&(i=e.updateQueue,i!==null&&(n=i.retryQueue,n!==null&&(i.retryQueue=null,Pl(e,n))));break;case 19:Ut(t,e),Lt(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Pl(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 n,i=e.return;i!==null;){if($m(i)){n=i;break}i=i.return}if(n==null)throw Error(l(160));switch(n.tag){case 27:var u=n.stateNode,f=Eu(e);Gl(e,f,u);break;case 5:var v=n.stateNode;n.flags&32&&(Un(v,""),n.flags&=-33);var b=Eu(e);Gl(e,b,v);break;case 3:case 4:var N=n.stateNode.containerInfo,z=Eu(e);Tu(e,z,N);break;default:throw Error(l(161))}}catch($){$e(e,e.return,$)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Xm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Xm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Xa(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Im(e,t.alternate,t),t=t.sibling}function on(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:xs(4,t,t.return),on(t);break;case 1:_a(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&Bm(t,t.return,n),on(t);break;case 27:Ei(t.stateNode);case 26:case 5:_a(t,t.return),on(t);break;case 22:t.memoizedState===null&&on(t);break;case 30:on(t);break;default:on(t)}e=e.sibling}}function Qa(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var i=t.alternate,u=e,f=t,v=f.flags;switch(f.tag){case 0:case 11:case 15:Qa(u,f,n),gi(4,f);break;case 1:if(Qa(u,f,n),i=f,u=i.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(z){$e(i,i.return,z)}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++)Eh(N[u],b)}catch(z){$e(i,i.return,z)}}n&&v&64&&Lm(f),yi(f,f.return);break;case 27:Hm(f);case 26:case 5:Qa(u,f,n),n&&i===null&&v&4&&qm(f),yi(f,f.return);break;case 12:Qa(u,f,n);break;case 31:Qa(u,f,n),n&&v&4&&Km(u,f);break;case 13:Qa(u,f,n),n&&v&4&&Ym(u,f);break;case 22:f.memoizedState===null&&Qa(u,f,n),yi(f,f.return);break;case 30:break;default:Qa(u,f,n)}t=t.sibling}}function Cu(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&si(n))}function ku(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&si(e))}function ua(e,t,n,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Qm(e,t,n,i),t=t.sibling}function Qm(e,t,n,i){var u=t.flags;switch(t.tag){case 0:case 11:case 15:ua(e,t,n,i),u&2048&&gi(9,t);break;case 1:ua(e,t,n,i);break;case 3:ua(e,t,n,i),u&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&si(e)));break;case 12:if(u&2048){ua(e,t,n,i),e=t.stateNode;try{var f=t.memoizedProps,v=f.id,b=f.onPostCommit;typeof b=="function"&&b(v,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(N){$e(t,t.return,N)}}else ua(e,t,n,i);break;case 31:ua(e,t,n,i);break;case 13:ua(e,t,n,i);break;case 23:break;case 22:f=t.stateNode,v=t.alternate,t.memoizedState!==null?f._visibility&2?ua(e,t,n,i):vi(e,t):f._visibility&2?ua(e,t,n,i):(f._visibility|=2,ar(e,t,n,i,(t.subtreeFlags&10256)!==0||!1)),u&2048&&Cu(v,t);break;case 24:ua(e,t,n,i),u&2048&&ku(t.alternate,t);break;default:ua(e,t,n,i)}}function ar(e,t,n,i,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var f=e,v=t,b=n,N=i,z=v.flags;switch(v.tag){case 0:case 11:case 15:ar(f,v,b,N,u),gi(8,v);break;case 23:break;case 22:var $=v.stateNode;v.memoizedState!==null?$._visibility&2?ar(f,v,b,N,u):vi(f,v):($._visibility|=2,ar(f,v,b,N,u)),u&&z&2048&&Cu(v.alternate,v);break;case 24:ar(f,v,b,N,u),u&&z&2048&&ku(v.alternate,v);break;default:ar(f,v,b,N,u)}t=t.sibling}}function vi(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,i=t,u=i.flags;switch(i.tag){case 22:vi(n,i),u&2048&&Cu(i.alternate,i);break;case 24:vi(n,i),u&2048&&ku(i.alternate,i);break;default:vi(n,i)}t=t.sibling}}var bi=8192;function sr(e,t,n){if(e.subtreeFlags&bi)for(e=e.child;e!==null;)Zm(e,t,n),e=e.sibling}function Zm(e,t,n){switch(e.tag){case 26:sr(e,t,n),e.flags&bi&&e.memoizedState!==null&&Pb(n,ca,e.memoizedState,e.memoizedProps);break;case 5:sr(e,t,n);break;case 3:case 4:var i=ca;ca=ro(e.stateNode.containerInfo),sr(e,t,n),ca=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=bi,bi=16777216,sr(e,t,n),bi=i):sr(e,t,n));break;default:sr(e,t,n)}}function Fm(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 xi(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var i=t[n];bt=i,ep(i,e)}Fm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Wm(e),e=e.sibling}function Wm(e){switch(e.tag){case 0:case 11:case 15:xi(e),e.flags&2048&&xs(9,e,e.return);break;case 3:xi(e);break;case 12:xi(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Kl(e)):xi(e);break;default:xi(e)}}function Kl(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var i=t[n];bt=i,ep(i,e)}Fm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:xs(8,t,t.return),Kl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Kl(t));break;default:Kl(t)}e=e.sibling}}function ep(e,t){for(;bt!==null;){var n=bt;switch(n.tag){case 0:case 11:case 15:xs(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var i=n.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:si(n.memoizedState.cache)}if(i=n.child,i!==null)i.return=n,bt=i;else e:for(n=e;bt!==null;){i=bt;var u=i.sibling,f=i.return;if(Gm(i),i===n){bt=null;break e}if(u!==null){u.return=f,bt=u;break e}bt=f}}}var ib={getCacheForType:function(e){var t=St(nt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return St(nt).controller.signal}},lb=typeof WeakMap=="function"?WeakMap:Map,Le=0,Pe=null,Ee=null,Ae=0,qe=0,Pt=null,ws=!1,nr=!1,Ou=!1,Za=0,et=0,_s=0,cn=0,Ru=0,Kt=0,rr=0,wi=null,Bt=null,Du=!1,Yl=0,tp=0,Jl=1/0,Xl=null,Ss=null,dt=0,js=null,ir=null,Fa=0,Mu=0,zu=null,ap=null,_i=0,Uu=null;function Yt(){return(Le&2)!==0&&Ae!==0?Ae&-Ae:C.T!==null?Vu():Gs()}function sp(){if(Kt===0)if((Ae&536870912)===0||Oe){var e=Tn;Tn<<=1,(Tn&3932160)===0&&(Tn=262144),Kt=e}else Kt=536870912;return e=It.current,e!==null&&(e.flags|=32),Kt}function qt(e,t,n){(e===Pe&&(qe===2||qe===9)||e.cancelPendingCommit!==null)&&(lr(e,0),Ns(e,Ae,Kt,!1)),Vs(e,n),((Le&2)===0||e!==Pe)&&(e===Pe&&((Le&2)===0&&(cn|=n),et===4&&Ns(e,Ae,Kt,!1)),Sa(e))}function np(e,t,n){if((Le&6)!==0)throw Error(l(327));var i=!n&&(t&127)===0&&(t&e.expiredLanes)===0||cs(e,t),u=i?ub(e,t):Bu(e,t,!0),f=i;do{if(u===0){nr&&!i&&Ns(e,t,0,!1);break}else{if(n=e.current.alternate,f&&!ob(n)){u=Bu(e,t,!1),f=!1;continue}if(u===2){if(f=t,e.errorRecoveryDisabledLanes&f)var v=0;else v=e.pendingLanes&-536870913,v=v!==0?v:v&536870912?536870912:0;if(v!==0){t=v;e:{var b=e;u=wi;var N=b.current.memoizedState.isDehydrated;if(N&&(lr(b,v).flags|=256),v=Bu(b,v,!1),v!==2){if(Ou&&!N){b.errorRecoveryDisabledLanes|=f,cn|=f,u=4;break e}f=Bt,Bt=u,f!==null&&(Bt===null?Bt=f:Bt.push.apply(Bt,f))}u=v}if(f=!1,u!==2)continue}}if(u===1){lr(e,0),Ns(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:Ns(i,t,Kt,!ws);break e;case 2:Bt=null;break;case 3:case 5:break;default:throw Error(l(329))}if((t&62914560)===t&&(u=Yl+300-gt(),10<u)){if(Ns(i,t,Kt,!ws),Cn(i,0,!0)!==0)break e;Fa=t,i.timeoutHandle=zp(rp.bind(null,i,n,Bt,Xl,Du,t,Kt,cn,rr,ws,f,"Throttled",-0,0),u);break e}rp(i,n,Bt,Xl,Du,t,Kt,cn,rr,ws,f,null,-0,0)}}break}while(!0);Sa(e)}function rp(e,t,n,i,u,f,v,b,N,z,$,G,U,L){if(e.timeoutHandle=-1,G=t.subtreeFlags,G&8192||(G&16785408)===16785408){G={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:La},Zm(t,f,G);var ae=(f&62914560)===f?Yl-gt():(f&4194048)===f?tp-gt():0;if(ae=Kb(G,ae),ae!==null){Fa=f,e.cancelPendingCommit=ae(hp.bind(null,e,t,f,n,i,u,v,b,N,$,G,null,U,L)),Ns(e,f,v,!z);return}}hp(e,t,f,n,i,u,v,b,N)}function ob(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var i=0;i<n.length;i++){var u=n[i],f=u.getSnapshot;u=u.value;try{if(!Ht(f(),u))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;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 Ns(e,t,n,i){t&=~Ru,t&=~cn,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var u=t;0<u;){var f=31-Ot(u),v=1<<f;i[f]=-1,u&=~v}n!==0&&O(e,n,t)}function Ql(){return(Le&6)===0?(Si(0),!1):!0}function Lu(){if(Ee!==null){if(qe===0)var e=Ee.return;else e=Ee,Ha=Ws=null,Wc(e),Zn=null,ri=0,e=Ee;for(;e!==null;)Um(e.alternate,e),e=e.return;Ee=null}}function lr(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Ab(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Fa=0,Lu(),Pe=e,Ee=n=qa(e.current,null),Ae=t,qe=0,Pt=null,ws=!1,nr=cs(e,t),Ou=!1,rr=Kt=Ru=cn=_s=et=0,Bt=wi=null,Du=!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 Za=t,yl(),n}function ip(e,t){be=null,C.H=hi,t===Qn||t===Nl?(t=_h(),qe=3):t===Hc?(t=_h(),qe=4):qe=t===pu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Pt=t,Ee===null&&(et=1,ql(e,ea(t,e.current)))}function lp(){var e=It.current;return e===null?!0:(Ae&4194048)===Ae?na===null:(Ae&62914560)===Ae||(Ae&536870912)!==0?e===na:!1}function op(){var e=C.H;return C.H=hi,e===null?hi:e}function cp(){var e=C.A;return C.A=ib,e}function Zl(){et=4,ws||(Ae&4194048)!==Ae&&It.current!==null||(nr=!0),(_s&134217727)===0&&(cn&134217727)===0||Pe===null||Ns(Pe,Ae,Kt,!1)}function Bu(e,t,n){var i=Le;Le|=2;var u=op(),f=cp();(Pe!==e||Ae!==t)&&(Xl=null,lr(e,t)),t=!1;var v=et;e:do try{if(qe!==0&&Ee!==null){var b=Ee,N=Pt;switch(qe){case 8:Lu(),v=6;break e;case 3:case 2:case 9:case 6:It.current===null&&(t=!0);var z=qe;if(qe=0,Pt=null,or(e,b,N,z),n&&nr){v=0;break e}break;default:z=qe,qe=0,Pt=null,or(e,b,N,z)}}cb(),v=et;break}catch($){ip(e,$)}while(!0);return t&&e.shellSuspendCounter++,Ha=Ws=null,Le=i,C.H=u,C.A=f,Ee===null&&(Pe=null,Ae=0,yl()),v}function cb(){for(;Ee!==null;)up(Ee)}function ub(e,t){var n=Le;Le|=2;var i=op(),u=cp();Pe!==e||Ae!==t?(Xl=null,Jl=gt()+500,lr(e,t)):nr=cs(e,t);e:do try{if(qe!==0&&Ee!==null){t=Ee;var f=Pt;t:switch(qe){case 1:qe=0,Pt=null,or(e,t,f,1);break;case 2:case 9:if(xh(f)){qe=0,Pt=null,dp(t);break}t=function(){qe!==2&&qe!==9||Pe!==e||(qe=7),Sa(e)},f.then(t,t);break e;case 3:qe=7;break e;case 4:qe=5;break e;case 7:xh(f)?(qe=0,Pt=null,dp(t)):(qe=0,Pt=null,or(e,t,f,7));break;case 5:var v=null;switch(Ee.tag){case 26:v=Ee.memoizedState;case 5:case 27:var b=Ee;if(v?Qp(v):b.stateNode.complete){qe=0,Pt=null;var N=b.sibling;if(N!==null)Ee=N;else{var z=b.return;z!==null?(Ee=z,Fl(z)):Ee=null}break t}}qe=0,Pt=null,or(e,t,f,5);break;case 6:qe=0,Pt=null,or(e,t,f,6);break;case 8:Lu(),et=6;break e;default:throw Error(l(462))}}db();break}catch($){ip(e,$)}while(!0);return Ha=Ws=null,C.H=i,C.A=u,Le=n,Ee!==null?0:(Pe=null,Ae=0,yl(),et)}function db(){for(;Ee!==null&&!sl();)up(Ee)}function up(e){var t=Mm(e.alternate,e,Za);e.memoizedProps=e.pendingProps,t===null?Fl(e):Ee=t}function dp(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Am(n,t,t.pendingProps,t.type,void 0,Ae);break;case 11:t=Am(n,t,t.pendingProps,t.type.render,t.ref,Ae);break;case 5:Wc(t);default:Um(n,t),t=Ee=ch(t,Za),t=Mm(n,t,Za)}e.memoizedProps=e.pendingProps,t===null?Fl(e):Ee=t}function or(e,t,n,i){Ha=Ws=null,Wc(t),Zn=null,ri=0;var u=t.return;try{if(W0(e,u,t,n,Ae)){et=1,ql(e,ea(n,e.current)),Ee=null;return}}catch(f){if(u!==null)throw Ee=u,f;et=1,ql(e,ea(n,e.current)),Ee=null;return}t.flags&32768?(Oe||i===1?e=!0:nr||(Ae&536870912)!==0?e=!1:(ws=e=!0,(i===2||i===9||i===3||i===6)&&(i=It.current,i!==null&&i.tag===13&&(i.flags|=16384))),fp(t,e)):Fl(t)}function Fl(e){var t=e;do{if((t.flags&32768)!==0){fp(t,ws);return}e=t.return;var n=ab(t.alternate,t,Za);if(n!==null){Ee=n;return}if(t=t.sibling,t!==null){Ee=t;return}Ee=t=e}while(t!==null);et===0&&(et=5)}function fp(e,t){do{var n=sb(e.alternate,e);if(n!==null){n.flags&=32767,Ee=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ee=e;return}Ee=e=n}while(e!==null);et=6,Ee=null}function hp(e,t,n,i,u,f,v,b,N){e.cancelPendingCommit=null;do Wl();while(dt!==0);if((Le&6)!==0)throw Error(l(327));if(t!==null){if(t===e.current)throw Error(l(177));if(f=t.lanes|t.childLanes,f|=Ec,ac(e,n,f,v,b,N),e===Pe&&(Ee=Pe=null,Ae=0),ir=t,js=e,Fa=n,Mu=f,zu=u,ap=i,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,pb(Ma,function(){return vp(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=C.T,C.T=null,u=J.p,J.p=2,v=Le,Le|=4;try{nb(e,t,n)}finally{Le=v,J.p=u,C.T=i}}dt=1,mp(),pp(),gp()}}function mp(){if(dt===1){dt=0;var e=js,t=ir,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=C.T,C.T=null;var i=J.p;J.p=2;var u=Le;Le|=4;try{Jm(t,e);var f=Qu,v=eh(e.containerInfo),b=f.focusedElem,N=f.selectionRange;if(v!==b&&b&&b.ownerDocument&&Wf(b.ownerDocument.documentElement,b)){if(N!==null&&wc(b)){var z=N.start,$=N.end;if($===void 0&&($=z),"selectionStart"in b)b.selectionStart=z,b.selectionEnd=Math.min($,b.value.length);else{var G=b.ownerDocument||document,U=G&&G.defaultView||window;if(U.getSelection){var L=U.getSelection(),ae=b.textContent.length,fe=Math.min(N.start,ae),Ie=N.end===void 0?fe:Math.min(N.end,ae);!L.extend&&fe>Ie&&(v=Ie,Ie=fe,fe=v);var k=Ff(b,fe),T=Ff(b,Ie);if(k&&T&&(L.rangeCount!==1||L.anchorNode!==k.node||L.anchorOffset!==k.offset||L.focusNode!==T.node||L.focusOffset!==T.offset)){var M=G.createRange();M.setStart(k.node,k.offset),L.removeAllRanges(),fe>Ie?(L.addRange(M),L.extend(T.node,T.offset)):(M.setEnd(T.node,T.offset),L.addRange(M))}}}}for(G=[],L=b;L=L.parentNode;)L.nodeType===1&&G.push({element:L,left:L.scrollLeft,top:L.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<G.length;b++){var H=G[b];H.element.scrollLeft=H.left,H.element.scrollTop=H.top}}fo=!!Xu,Qu=Xu=null}finally{Le=u,J.p=i,C.T=n}}e.current=t,dt=2}}function pp(){if(dt===2){dt=0;var e=js,t=ir,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=C.T,C.T=null;var i=J.p;J.p=2;var u=Le;Le|=4;try{Im(e,t.alternate,t)}finally{Le=u,J.p=i,C.T=n}}dt=3}}function gp(){if(dt===4||dt===3){dt=0,$s();var e=js,t=ir,n=Fa,i=ap;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?dt=5:(dt=0,ir=js=null,yp(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(Ss=null),Is(n),t=t.stateNode,wt&&typeof wt.onCommitFiberRoot=="function")try{wt.onCommitFiberRoot(Hs,t,void 0,(t.current.flags&128)===128)}catch{}if(i!==null){t=C.T,u=J.p,J.p=2,C.T=null;try{for(var f=e.onRecoverableError,v=0;v<i.length;v++){var b=i[v];f(b.value,{componentStack:b.stack})}}finally{C.T=t,J.p=u}}(Fa&3)!==0&&Wl(),Sa(e),u=e.pendingLanes,(n&261930)!==0&&(u&42)!==0?e===Uu?_i++:(_i=0,Uu=e):_i=0,Si(0)}}function yp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,si(t)))}function Wl(){return mp(),pp(),gp(),vp()}function vp(){if(dt!==5)return!1;var e=js,t=Mu;Mu=0;var n=Is(Fa),i=C.T,u=J.p;try{J.p=32>n?32:n,C.T=null,n=zu,zu=null;var f=js,v=Fa;if(dt=0,ir=js=null,Fa=0,(Le&6)!==0)throw Error(l(331));var b=Le;if(Le|=4,Wm(f.current),Qm(f,f.current,v,n),Le=b,Si(0,!1),wt&&typeof wt.onPostCommitFiberRoot=="function")try{wt.onPostCommitFiberRoot(Hs,f)}catch{}return!0}finally{J.p=u,C.T=i,yp(e,t)}}function bp(e,t,n){t=ea(n,t),t=mu(e.stateNode,t,2),e=ys(e,t,2),e!==null&&(Vs(e,2),Sa(e))}function $e(e,t,n){if(e.tag===3)bp(e,e,n);else for(;t!==null;){if(t.tag===3){bp(t,e,n);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Ss===null||!Ss.has(i))){e=ea(n,e),n=xm(2),i=ys(t,n,2),i!==null&&(wm(n,i,t,e),Vs(i,2),Sa(i));break}}t=t.return}}function qu(e,t,n){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(n)||(Ou=!0,u.add(n),e=fb.bind(null,e,t,n),t.then(e,e))}function fb(e,t,n){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Pe===e&&(Ae&n)===n&&(et===4||et===3&&(Ae&62914560)===Ae&&300>gt()-Yl?(Le&2)===0&&lr(e,0):Ru|=n,rr===Ae&&(rr=0)),Sa(e)}function xp(e,t){t===0&&(t=rl()),e=Qs(e,t),e!==null&&(Vs(e,t),Sa(e))}function hb(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),xp(e,n)}function mb(e,t){var n=0;switch(e.tag){case 31:case 13:var i=e.stateNode,u=e.memoizedState;u!==null&&(n=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),xp(e,n)}function pb(e,t){return Sn(e,t)}var eo=null,cr=null,$u=!1,to=!1,Hu=!1,Es=0;function Sa(e){e!==cr&&e.next===null&&(cr===null?eo=cr=e:cr=cr.next=e),to=!0,$u||($u=!0,yb())}function Si(e,t){if(!Hu&&to){Hu=!0;do for(var n=!1,i=eo;i!==null;){if(e!==0){var u=i.pendingLanes;if(u===0)var f=0;else{var v=i.suspendedLanes,b=i.pingedLanes;f=(1<<31-Ot(42|e)+1)-1,f&=u&~(v&~b),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(n=!0,jp(i,f))}else f=Ae,f=Cn(i,i===Pe?f:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(f&3)===0||cs(i,f)||(n=!0,jp(i,f));i=i.next}while(n);Hu=!1}}function gb(){wp()}function wp(){to=$u=!1;var e=0;Es!==0&&Tb()&&(e=Es);for(var t=gt(),n=null,i=eo;i!==null;){var u=i.next,f=_p(i,t);f===0?(i.next=null,n===null?eo=u:n.next=u,u===null&&(cr=n)):(n=i,(e!==0||(f&3)!==0)&&(to=!0)),i=u}dt!==0&&dt!==5||Si(e),Es!==0&&(Es=0)}function _p(e,t){for(var n=e.suspendedLanes,i=e.pingedLanes,u=e.expirationTimes,f=e.pendingLanes&-62914561;0<f;){var v=31-Ot(f),b=1<<v,N=u[v];N===-1?((b&n)===0||(b&i)!==0)&&(u[v]=tc(b,t)):N<=t&&(e.expiredLanes|=b),f&=~b}if(t=Pe,n=Ae,n=Cn(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,n===0||e===t&&(qe===2||qe===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&os(i),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||cs(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(i!==null&&os(i),Is(n)){case 2:case 8:n=Vr;break;case 32:n=Ma;break;case 268435456:n=ya;break;default:n=Ma}return i=Sp.bind(null,e),n=Sn(n,i),e.callbackPriority=t,e.callbackNode=n,t}return i!==null&&i!==null&&os(i),e.callbackPriority=2,e.callbackNode=null,2}function Sp(e,t){if(dt!==0&&dt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Wl()&&e.callbackNode!==n)return null;var i=Ae;return i=Cn(e,e===Pe?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(np(e,i,t),_p(e,gt()),e.callbackNode!=null&&e.callbackNode===n?Sp.bind(null,e):null)}function jp(e,t){if(Wl())return null;np(e,t,!0)}function yb(){Cb(function(){(Le&6)!==0?Sn(Hr,gb):wp()})}function Vu(){if(Es===0){var e=Jn;e===0&&(e=En,En<<=1,(En&261888)===0&&(En=256)),Es=e}return Es}function Np(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:cl(""+e)}function Ep(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function vb(e,t,n,i,u){if(t==="submit"&&n&&n.stateNode===u){var f=Np((u[Dt]||null).action),v=i.submitter;v&&(t=(t=v[Dt]||null)?Np(t.formAction):v.getAttribute("formAction"),t!==null&&(f=t,v=null));var b=new hl("action","action",null,i,u);e.push({event:b,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(Es!==0){var N=v?Ep(u,v):new FormData(u);ou(n,{pending:!0,data:N,method:u.method,action:f},null,N)}}else typeof f=="function"&&(b.preventDefault(),N=v?Ep(u,v):new FormData(u),ou(n,{pending:!0,data:N,method:u.method,action:f},f,N))},currentTarget:u}]})}}for(var Iu=0;Iu<Nc.length;Iu++){var Gu=Nc[Iu],bb=Gu.toLowerCase(),xb=Gu[0].toUpperCase()+Gu.slice(1);oa(bb,"on"+xb)}oa(sh,"onAnimationEnd"),oa(nh,"onAnimationIteration"),oa(rh,"onAnimationStart"),oa("dblclick","onDoubleClick"),oa("focusin","onFocus"),oa("focusout","onBlur"),oa(U0,"onTransitionRun"),oa(L0,"onTransitionStart"),oa(B0,"onTransitionCancel"),oa(ih,"onTransitionEnd"),Mn("onMouseEnter",["mouseout","mouseover"]),Mn("onMouseLeave",["mouseout","mouseover"]),Mn("onPointerEnter",["pointerout","pointerover"]),Mn("onPointerLeave",["pointerout","pointerover"]),Ks("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ks("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ks("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ks("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ks("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ks("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ji="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(ji));function Tp(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var i=e[n],u=i.event;i=i.listeners;e:{var f=void 0;if(t)for(var v=i.length-1;0<=v;v--){var b=i[v],N=b.instance,z=b.currentTarget;if(b=b.listener,N!==f&&u.isPropagationStopped())break e;f=b,u.currentTarget=z;try{f(u)}catch($){gl($)}u.currentTarget=null,f=N}else for(v=0;v<i.length;v++){if(b=i[v],N=b.instance,z=b.currentTarget,b=b.listener,N!==f&&u.isPropagationStopped())break e;f=b,u.currentTarget=z;try{f(u)}catch($){gl($)}u.currentTarget=null,f=N}}}}function Te(e,t){var n=t[sc];n===void 0&&(n=t[sc]=new Set);var i=e+"__bubble";n.has(i)||(Ap(t,e,2,!1),n.add(i))}function Pu(e,t,n){var i=0;t&&(i|=4),Ap(n,e,i,t)}var ao="_reactListening"+Math.random().toString(36).slice(2);function Ku(e){if(!e[ao]){e[ao]=!0,wf.forEach(function(n){n!=="selectionchange"&&(wb.has(n)||Pu(n,!1,e),Pu(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ao]||(t[ao]=!0,Pu("selectionchange",!1,t))}}function Ap(e,t,n,i){switch(sg(t)){case 2:var u=Xb;break;case 8:u=Qb;break;default:u=ld}n=u.bind(null,t,n,e),u=void 0,!fc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),i?u!==void 0?e.addEventListener(t,n,{capture:!0,passive:u}):e.addEventListener(t,n,!0):u!==void 0?e.addEventListener(t,n,{passive:u}):e.addEventListener(t,n,!1)}function Yu(e,t,n,i,u){var f=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var v=i.tag;if(v===3||v===4){var b=i.stateNode.containerInfo;if(b===u)break;if(v===4)for(v=i.return;v!==null;){var N=v.tag;if((N===3||N===4)&&v.stateNode.containerInfo===u)return;v=v.return}for(;b!==null;){if(v=On(b),v===null)return;if(N=v.tag,N===5||N===6||N===26||N===27){i=f=v;continue e}b=b.parentNode}}i=i.return}Df(function(){var z=f,$=uc(n),G=[];e:{var U=lh.get(e);if(U!==void 0){var L=hl,ae=e;switch(e){case"keypress":if(dl(n)===0)break e;case"keydown":case"keyup":L=m0;break;case"focusin":ae="focus",L=gc;break;case"focusout":ae="blur",L=gc;break;case"beforeblur":case"afterblur":L=gc;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":L=Uf;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 sh:case nh:case rh:L=r0;break;case ih: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=Bf;break;case"toggle":case"beforetoggle":L=S0}var fe=(t&4)!==0,Ie=!fe&&(e==="scroll"||e==="scrollend"),k=fe?U!==null?U+"Capture":null:U;fe=[];for(var T=z,M;T!==null;){var H=T;if(M=H.stateNode,H=H.tag,H!==5&&H!==26&&H!==27||M===null||k===null||(H=Kr(T,k),H!=null&&fe.push(Ni(T,H,M))),Ie)break;T=T.return}0<fe.length&&(U=new L(U,ae,null,n,$),G.push({event:U,listeners:fe}))}}if((t&7)===0){e:{if(U=e==="mouseover"||e==="pointerover",L=e==="mouseout"||e==="pointerout",U&&n!==cc&&(ae=n.relatedTarget||n.fromElement)&&(On(ae)||ae[kn]))break e;if((L||U)&&(U=$.window===$?$:(U=$.ownerDocument)?U.defaultView||U.parentWindow:window,L?(ae=n.relatedTarget||n.toElement,L=z,ae=ae?On(ae):null,ae!==null&&(Ie=d(ae),fe=ae.tag,ae!==Ie||fe!==5&&fe!==27&&fe!==6)&&(ae=null)):(L=null,ae=z),L!==ae)){if(fe=Uf,H="onMouseLeave",k="onMouseEnter",T="mouse",(e==="pointerout"||e==="pointerover")&&(fe=Bf,H="onPointerLeave",k="onPointerEnter",T="pointer"),Ie=L==null?U:Pr(L),M=ae==null?U:Pr(ae),U=new fe(H,T+"leave",L,n,$),U.target=Ie,U.relatedTarget=M,H=null,On($)===z&&(fe=new fe(k,T+"enter",ae,n,$),fe.target=M,fe.relatedTarget=Ie,H=fe),Ie=H,L&&ae)t:{for(fe=_b,k=L,T=ae,M=0,H=k;H;H=fe(H))M++;H=0;for(var ce=T;ce;ce=fe(ce))H++;for(;0<M-H;)k=fe(k),M--;for(;0<H-M;)T=fe(T),H--;for(;M--;){if(k===T||T!==null&&k===T.alternate){fe=k;break t}k=fe(k),T=fe(T)}fe=null}else fe=null;L!==null&&Cp(G,U,L,fe,!1),ae!==null&&Ie!==null&&Cp(G,Ie,ae,fe,!0)}}e:{if(U=z?Pr(z):window,L=U.nodeName&&U.nodeName.toLowerCase(),L==="select"||L==="input"&&U.type==="file")var De=Kf;else if(Gf(U))if(Yf)De=D0;else{De=O0;var ie=k0}else L=U.nodeName,!L||L.toLowerCase()!=="input"||U.type!=="checkbox"&&U.type!=="radio"?z&&oc(z.elementType)&&(De=Kf):De=R0;if(De&&(De=De(e,z))){Pf(G,De,n,$);break e}ie&&ie(e,U,z),e==="focusout"&&z&&U.type==="number"&&z.memoizedProps.value!=null&&lc(U,"number",U.value)}switch(ie=z?Pr(z):window,e){case"focusin":(Gf(ie)||ie.contentEditable==="true")&&($n=ie,_c=z,ei=null);break;case"focusout":ei=_c=$n=null;break;case"mousedown":Sc=!0;break;case"contextmenu":case"mouseup":case"dragend":Sc=!1,th(G,n,$);break;case"selectionchange":if(z0)break;case"keydown":case"keyup":th(G,n,$)}var xe;if(vc)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 qn?Vf(e,n)&&(Ce="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Ce="onCompositionStart");Ce&&(qf&&n.locale!=="ko"&&(qn||Ce!=="onCompositionStart"?Ce==="onCompositionEnd"&&qn&&(xe=Mf()):(us=$,hc="value"in us?us.value:us.textContent,qn=!0)),ie=so(z,Ce),0<ie.length&&(Ce=new Lf(Ce,e,null,n,$),G.push({event:Ce,listeners:ie}),xe?Ce.data=xe:(xe=If(n),xe!==null&&(Ce.data=xe)))),(xe=N0?E0(e,n):T0(e,n))&&(Ce=so(z,"onBeforeInput"),0<Ce.length&&(ie=new Lf("onBeforeInput","beforeinput",null,n,$),G.push({event:ie,listeners:Ce}),ie.data=xe)),vb(G,e,z,n,$)}Tp(G,t)})}function Ni(e,t,n){return{instance:e,listener:t,currentTarget:n}}function so(e,t){for(var n=t+"Capture",i=[];e!==null;){var u=e,f=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||f===null||(u=Kr(e,n),u!=null&&i.unshift(Ni(e,u,f)),u=Kr(e,t),u!=null&&i.push(Ni(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 Cp(e,t,n,i,u){for(var f=t._reactName,v=[];n!==null&&n!==i;){var b=n,N=b.alternate,z=b.stateNode;if(b=b.tag,N!==null&&N===i)break;b!==5&&b!==26&&b!==27||z===null||(N=z,u?(z=Kr(n,f),z!=null&&v.unshift(Ni(n,z,N))):u||(z=Kr(n,f),z!=null&&v.push(Ni(n,z,N)))),n=n.return}v.length!==0&&e.push({event:t,listeners:v})}var Sb=/\r\n?/g,jb=/\u0000|\uFFFD/g;function kp(e){return(typeof e=="string"?e:""+e).replace(Sb,`
9
- `).replace(jb,"")}function Op(e,t){return t=kp(t),kp(e)===t}function Ve(e,t,n,i,u,f){switch(n){case"children":typeof i=="string"?t==="body"||t==="textarea"&&i===""||Un(e,i):(typeof i=="number"||typeof i=="bigint")&&t!=="body"&&Un(e,""+i);break;case"className":ll(e,"class",i);break;case"tabIndex":ll(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":ll(e,n,i);break;case"style":Of(e,i,f);break;case"data":if(t!=="object"){ll(e,"data",i);break}case"src":case"href":if(i===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(n);break}i=cl(""+i),e.setAttribute(n,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(n,"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"&&(n==="formAction"?(t!=="input"&&Ve(e,t,"name",u.name,u,null),Ve(e,t,"formEncType",u.formEncType,u,null),Ve(e,t,"formMethod",u.formMethod,u,null),Ve(e,t,"formTarget",u.formTarget,u,null)):(Ve(e,t,"encType",u.encType,u,null),Ve(e,t,"method",u.method,u,null),Ve(e,t,"target",u.target,u,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(n);break}i=cl(""+i),e.setAttribute(n,i);break;case"onClick":i!=null&&(e.onclick=La);break;case"onScroll":i!=null&&Te("scroll",e);break;case"onScrollEnd":i!=null&&Te("scrollend",e);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(l(61));if(n=i.__html,n!=null){if(u.children!=null)throw Error(l(60));e.innerHTML=n}}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}n=cl(""+i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);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(n,""+i):e.removeAttribute(n);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(n,""):e.removeAttribute(n);break;case"capture":case"download":i===!0?e.setAttribute(n,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(n,i):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(n,i):e.removeAttribute(n);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(n):e.setAttribute(n,i);break;case"popover":Te("beforetoggle",e),Te("toggle",e),il(e,"popover",i);break;case"xlinkActuate":Ua(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":Ua(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":Ua(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":Ua(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":Ua(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":Ua(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":Ua(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":Ua(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":Ua(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":il(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=Fv.get(n)||n,il(e,n,i))}}function Ju(e,t,n,i,u,f){switch(n){case"style":Of(e,i,f);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(l(61));if(n=i.__html,n!=null){if(u.children!=null)throw Error(l(60));e.innerHTML=n}}break;case"children":typeof i=="string"?Un(e,i):(typeof i=="number"||typeof i=="bigint")&&Un(e,""+i);break;case"onScroll":i!=null&&Te("scroll",e);break;case"onScrollEnd":i!=null&&Te("scrollend",e);break;case"onClick":i!=null&&(e.onclick=La);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!_f.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(u=n.endsWith("Capture"),t=n.slice(2,u?n.length-7:void 0),f=e[Dt]||null,f=f!=null?f[n]:null,typeof f=="function"&&e.removeEventListener(t,f,u),typeof i=="function")){typeof f!="function"&&f!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,i,u);break e}n in e?e[n]=i:i===!0?e.setAttribute(n,""):il(e,n,i)}}}function Nt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Te("error",e),Te("load",e);var i=!1,u=!1,f;for(f in n)if(n.hasOwnProperty(f)){var v=n[f];if(v!=null)switch(f){case"src":i=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:Ve(e,t,f,v,n,null)}}u&&Ve(e,t,"srcSet",n.srcSet,n,null),i&&Ve(e,t,"src",n.src,n,null);return;case"input":Te("invalid",e);var b=f=v=u=null,N=null,z=null;for(i in n)if(n.hasOwnProperty(i)){var $=n[i];if($!=null)switch(i){case"name":u=$;break;case"type":v=$;break;case"checked":N=$;break;case"defaultChecked":z=$;break;case"value":f=$;break;case"defaultValue":b=$;break;case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(l(137,t));break;default:Ve(e,t,i,$,n,null)}}Tf(e,f,b,N,z,v,u,!1);return;case"select":Te("invalid",e),i=v=f=null;for(u in n)if(n.hasOwnProperty(u)&&(b=n[u],b!=null))switch(u){case"value":f=b;break;case"defaultValue":v=b;break;case"multiple":i=b;default:Ve(e,t,u,b,n,null)}t=f,n=v,e.multiple=!!i,t!=null?zn(e,!!i,t,!1):n!=null&&zn(e,!!i,n,!0);return;case"textarea":Te("invalid",e),f=u=i=null;for(v in n)if(n.hasOwnProperty(v)&&(b=n[v],b!=null))switch(v){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:Ve(e,t,v,b,n,null)}Cf(e,i,u,f);return;case"option":for(N in n)n.hasOwnProperty(N)&&(i=n[N],i!=null)&&(N==="selected"?e.selected=i&&typeof i!="function"&&typeof i!="symbol":Ve(e,t,N,i,n,null));return;case"dialog":Te("beforetoggle",e),Te("toggle",e),Te("cancel",e),Te("close",e);break;case"iframe":case"object":Te("load",e);break;case"video":case"audio":for(i=0;i<ji.length;i++)Te(ji[i],e);break;case"image":Te("error",e),Te("load",e);break;case"details":Te("toggle",e);break;case"embed":case"source":case"link":Te("error",e),Te("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(z in n)if(n.hasOwnProperty(z)&&(i=n[z],i!=null))switch(z){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:Ve(e,t,z,i,n,null)}return;default:if(oc(t)){for($ in n)n.hasOwnProperty($)&&(i=n[$],i!==void 0&&Ju(e,t,$,i,n,void 0));return}}for(b in n)n.hasOwnProperty(b)&&(i=n[b],i!=null&&Ve(e,t,b,i,n,null))}function Nb(e,t,n,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,v=null,b=null,N=null,z=null,$=null;for(L in n){var G=n[L];if(n.hasOwnProperty(L)&&G!=null)switch(L){case"checked":break;case"value":break;case"defaultValue":N=G;default:i.hasOwnProperty(L)||Ve(e,t,L,null,i,G)}}for(var U in i){var L=i[U];if(G=n[U],i.hasOwnProperty(U)&&(L!=null||G!=null))switch(U){case"type":f=L;break;case"name":u=L;break;case"checked":z=L;break;case"defaultChecked":$=L;break;case"value":v=L;break;case"defaultValue":b=L;break;case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(l(137,t));break;default:L!==G&&Ve(e,t,U,L,i,G)}}ic(e,v,b,N,z,$,f,u);return;case"select":L=v=b=U=null;for(f in n)if(N=n[f],n.hasOwnProperty(f)&&N!=null)switch(f){case"value":break;case"multiple":L=N;default:i.hasOwnProperty(f)||Ve(e,t,f,null,i,N)}for(u in i)if(f=i[u],N=n[u],i.hasOwnProperty(u)&&(f!=null||N!=null))switch(u){case"value":U=f;break;case"defaultValue":b=f;break;case"multiple":v=f;default:f!==N&&Ve(e,t,u,f,i,N)}t=b,n=v,i=L,U!=null?zn(e,!!n,U,!1):!!i!=!!n&&(t!=null?zn(e,!!n,t,!0):zn(e,!!n,n?[]:"",!1));return;case"textarea":L=U=null;for(b in n)if(u=n[b],n.hasOwnProperty(b)&&u!=null&&!i.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:Ve(e,t,b,null,i,u)}for(v in i)if(u=i[v],f=n[v],i.hasOwnProperty(v)&&(u!=null||f!=null))switch(v){case"value":U=u;break;case"defaultValue":L=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(l(91));break;default:u!==f&&Ve(e,t,v,u,i,f)}Af(e,U,L);return;case"option":for(var ae in n)U=n[ae],n.hasOwnProperty(ae)&&U!=null&&!i.hasOwnProperty(ae)&&(ae==="selected"?e.selected=!1:Ve(e,t,ae,null,i,U));for(N in i)U=i[N],L=n[N],i.hasOwnProperty(N)&&U!==L&&(U!=null||L!=null)&&(N==="selected"?e.selected=U&&typeof U!="function"&&typeof U!="symbol":Ve(e,t,N,U,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 fe in n)U=n[fe],n.hasOwnProperty(fe)&&U!=null&&!i.hasOwnProperty(fe)&&Ve(e,t,fe,null,i,U);for(z in i)if(U=i[z],L=n[z],i.hasOwnProperty(z)&&U!==L&&(U!=null||L!=null))switch(z){case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(l(137,t));break;default:Ve(e,t,z,U,i,L)}return;default:if(oc(t)){for(var Ie in n)U=n[Ie],n.hasOwnProperty(Ie)&&U!==void 0&&!i.hasOwnProperty(Ie)&&Ju(e,t,Ie,void 0,i,U);for($ in i)U=i[$],L=n[$],!i.hasOwnProperty($)||U===L||U===void 0&&L===void 0||Ju(e,t,$,U,i,L);return}}for(var k in n)U=n[k],n.hasOwnProperty(k)&&U!=null&&!i.hasOwnProperty(k)&&Ve(e,t,k,null,i,U);for(G in i)U=i[G],L=n[G],!i.hasOwnProperty(G)||U===L||U==null&&L==null||Ve(e,t,G,U,i,L)}function Rp(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,n=performance.getEntriesByType("resource"),i=0;i<n.length;i++){var u=n[i],f=u.transferSize,v=u.initiatorType,b=u.duration;if(f&&b&&Rp(v)){for(v=0,b=u.responseEnd,i+=1;i<n.length;i++){var N=n[i],z=N.startTime;if(z>b)break;var $=N.transferSize,G=N.initiatorType;$&&Rp(G)&&(N=N.responseEnd,v+=$*(N<b?1:(b-z)/(N-z)))}if(--i,t+=8*(f+v)/(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 Xu=null,Qu=null;function no(e){return e.nodeType===9?e:e.ownerDocument}function Dp(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 Mp(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Zu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Fu=null;function Tb(){var e=window.event;return e&&e.type==="popstate"?e===Fu?!1:(Fu=e,!0):(Fu=null,!1)}var zp=typeof setTimeout=="function"?setTimeout:void 0,Ab=typeof clearTimeout=="function"?clearTimeout:void 0,Up=typeof Promise=="function"?Promise:void 0,Cb=typeof queueMicrotask=="function"?queueMicrotask:typeof Up<"u"?function(e){return Up.resolve(null).then(e).catch(kb)}:zp;function kb(e){setTimeout(function(){throw e})}function Ts(e){return e==="head"}function Lp(e,t){var n=t,i=0;do{var u=n.nextSibling;if(e.removeChild(n),u&&u.nodeType===8)if(n=u.data,n==="/$"||n==="/&"){if(i===0){e.removeChild(u),hr(t);return}i--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")i++;else if(n==="html")Ei(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,Ei(n);for(var f=n.firstChild;f;){var v=f.nextSibling,b=f.nodeName;f[Gr]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&f.rel.toLowerCase()==="stylesheet"||n.removeChild(f),f=v}}else n==="body"&&Ei(e.ownerDocument.body);n=u}while(n);hr(t)}function Bp(e,t){var n=e;e=0;do{var i=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=i}while(n)}function Wu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":Wu(n),nc(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function Ob(e,t,n,i){for(;e.nodeType===1;){var u=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[Gr])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,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=ra(e.nextSibling),e===null))return null;return e}function qp(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 ed(e){return e.data==="$?"||e.data==="$~"}function td(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Db(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var i=function(){t(),n.removeEventListener("DOMContentLoaded",i)};n.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 ad=null;function $p(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return ra(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function Hp(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function Vp(e,t,n){switch(t=no(n),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 Ei(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);nc(e)}var ia=new Map,Ip=new Set;function ro(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Wa=J.d;J.d={f:Mb,r:zb,D:Ub,C:Lb,L:Bb,m:qb,X:Hb,S:$b,M:Vb};function Mb(){var e=Wa.f(),t=Ql();return e||t}function zb(e){var t=Rn(e);t!==null&&t.tag===5&&t.type==="form"?im(t):Wa.r(e)}var ur=typeof document>"u"?null:document;function Gp(e,t,n){var i=ur;if(i&&typeof t=="string"&&t){var u=Ft(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof n=="string"&&(u+='[crossorigin="'+n+'"]'),Ip.has(u)||(Ip.add(u),e={rel:e,crossOrigin:n,href:t},i.querySelector(u)===null&&(t=i.createElement("link"),Nt(t,"link",e),vt(t),i.head.appendChild(t)))}}function Ub(e){Wa.D(e),Gp("dns-prefetch",e,null)}function Lb(e,t){Wa.C(e,t),Gp("preconnect",e,t)}function Bb(e,t,n){Wa.L(e,t,n);var i=ur;if(i&&e&&t){var u='link[rel="preload"][as="'+Ft(t)+'"]';t==="image"&&n&&n.imageSrcSet?(u+='[imagesrcset="'+Ft(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(u+='[imagesizes="'+Ft(n.imageSizes)+'"]')):u+='[href="'+Ft(e)+'"]';var f=u;switch(t){case"style":f=dr(e);break;case"script":f=fr(e)}ia.has(f)||(e=w({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),ia.set(f,e),i.querySelector(u)!==null||t==="style"&&i.querySelector(Ti(f))||t==="script"&&i.querySelector(Ai(f))||(t=i.createElement("link"),Nt(t,"link",e),vt(t),i.head.appendChild(t)))}}function qb(e,t){Wa.m(e,t);var n=ur;if(n&&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=fr(e)}if(!ia.has(f)&&(e=w({rel:"modulepreload",href:e},t),ia.set(f,e),n.querySelector(u)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Ai(f)))return}i=n.createElement("link"),Nt(i,"link",e),vt(i),n.head.appendChild(i)}}}function $b(e,t,n){Wa.S(e,t,n);var i=ur;if(i&&e){var u=Dn(i).hoistableStyles,f=dr(e);t=t||"default";var v=u.get(f);if(!v){var b={loading:0,preload:null};if(v=i.querySelector(Ti(f)))b.loading=5;else{e=w({rel:"stylesheet",href:e,"data-precedence":t},n),(n=ia.get(f))&&sd(e,n);var N=v=i.createElement("link");vt(N),Nt(N,"link",e),N._p=new Promise(function(z,$){N.onload=z,N.onerror=$}),N.addEventListener("load",function(){b.loading|=1}),N.addEventListener("error",function(){b.loading|=2}),b.loading|=4,io(v,t,i)}v={type:"stylesheet",instance:v,count:1,state:b},u.set(f,v)}}}function Hb(e,t){Wa.X(e,t);var n=ur;if(n&&e){var i=Dn(n).hoistableScripts,u=fr(e),f=i.get(u);f||(f=n.querySelector(Ai(u)),f||(e=w({src:e,async:!0},t),(t=ia.get(u))&&nd(e,t),f=n.createElement("script"),vt(f),Nt(f,"link",e),n.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(u,f))}}function Vb(e,t){Wa.M(e,t);var n=ur;if(n&&e){var i=Dn(n).hoistableScripts,u=fr(e),f=i.get(u);f||(f=n.querySelector(Ai(u)),f||(e=w({src:e,async:!0,type:"module"},t),(t=ia.get(u))&&nd(e,t),f=n.createElement("script"),vt(f),Nt(f,"link",e),n.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(u,f))}}function Pp(e,t,n,i){var u=(u=ye.current)?ro(u):null;if(!u)throw Error(l(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=dr(n.href),n=Dn(u).hoistableStyles,i=n.get(t),i||(i={type:"style",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=dr(n.href);var f=Dn(u).hoistableStyles,v=f.get(e);if(v||(u=u.ownerDocument||u,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(e,v),(f=u.querySelector(Ti(e)))&&!f._p&&(v.instance=f,v.state.loading=5),ia.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},ia.set(e,n),f||Ib(u,e,n,v.state))),t&&i===null)throw Error(l(528,""));return v}if(t&&i!==null)throw Error(l(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=fr(n),n=Dn(u).hoistableScripts,i=n.get(t),i||(i={type:"script",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,e))}}function dr(e){return'href="'+Ft(e)+'"'}function Ti(e){return'link[rel="stylesheet"]['+e+"]"}function Kp(e){return w({},e,{"data-precedence":e.precedence,precedence:null})}function Ib(e,t,n,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}),Nt(t,"link",n),vt(t),e.head.appendChild(t))}function fr(e){return'[src="'+Ft(e)+'"]'}function Ai(e){return"script[async]"+e}function Yp(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+Ft(n.href)+'"]');if(i)return t.instance=i,vt(i),i;var u=w({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),vt(i),Nt(i,"style",u),io(i,n.precedence,e),t.instance=i;case"stylesheet":u=dr(n.href);var f=e.querySelector(Ti(u));if(f)return t.state.loading|=4,t.instance=f,vt(f),f;i=Kp(n),(u=ia.get(u))&&sd(i,u),f=(e.ownerDocument||e).createElement("link"),vt(f);var v=f;return v._p=new Promise(function(b,N){v.onload=b,v.onerror=N}),Nt(f,"link",i),t.state.loading|=4,io(f,n.precedence,e),t.instance=f;case"script":return f=fr(n.src),(u=e.querySelector(Ai(f)))?(t.instance=u,vt(u),u):(i=n,(u=ia.get(f))&&(i=w({},n),nd(i,u)),e=e.ownerDocument||e,u=e.createElement("script"),vt(u),Nt(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,io(i,n.precedence,e));return t.instance}function io(e,t,n){for(var i=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=i.length?i[i.length-1]:null,f=u,v=0;v<i.length;v++){var b=i[v];if(b.dataset.precedence===t)f=b;else if(f!==u)break}f?f.parentNode.insertBefore(e,f.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function sd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function nd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var lo=null;function Jp(e,t,n){if(lo===null){var i=new Map,u=lo=new Map;u.set(n,i)}else u=lo,i=u.get(n),i||(i=new Map,u.set(n,i));if(i.has(e))return i;for(i.set(e,null),n=n.getElementsByTagName(e),u=0;u<n.length;u++){var f=n[u];if(!(f[Gr]||f[ut]||e==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var v=f.getAttribute(t)||"";v=e+v;var b=i.get(v);b?b.push(f):i.set(v,[f])}}return i}function Xp(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function Gb(e,t,n){if(n===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 Qp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Pb(e,t,n,i){if(n.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var u=dr(i.href),f=t.querySelector(Ti(u));if(f){t=f._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=oo.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=f,vt(f);return}f=t.ownerDocument||t,i=Kp(i),(u=ia.get(u))&&sd(i,u),f=f.createElement("link"),vt(f);var v=f;v._p=new Promise(function(b,N){v.onload=b,v.onerror=N}),Nt(f,"link",i),n.instance=f}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=oo.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var rd=0;function Kb(e,t){return e.stylesheets&&e.count===0&&uo(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var i=setTimeout(function(){if(e.stylesheets&&uo(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+t);0<e.imgBytes&&rd===0&&(rd=62500*Eb());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&uo(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>rd?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(u)}}:null}function oo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)uo(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var co=null;function uo(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,co=new Map,t.forEach(Yb,e),co=null,oo.call(e))}function Yb(e,t){if(!(t.state.loading&4)){var n=co.get(e);if(n)var i=n.get(null);else{n=new Map,co.set(e,n);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<u.length;f++){var v=u[f];(v.nodeName==="LINK"||v.getAttribute("media")!=="not all")&&(n.set(v.dataset.precedence,v),i=v)}i&&n.set(null,i)}u=t.instance,v=u.getAttribute("data-precedence"),f=n.get(v)||i,f===i&&n.set(null,u),n.set(v,u),this.count++,i=oo.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 Ci={$$typeof:q,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function Jb(e,t,n,i,u,f,v,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=Ir(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ir(0),this.hiddenUpdates=Ir(null),this.identifierPrefix=i,this.onUncaughtError=u,this.onCaughtError=f,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=N,this.incompleteTransitions=new Map}function Zp(e,t,n,i,u,f,v,b,N,z,$,G){return e=new Jb(e,t,n,v,N,z,$,G,b),t=1,f===!0&&(t|=24),f=Vt(3,null,null,t),e.current=f,f.stateNode=e,t=Bc(),t.refCount++,e.pooledCache=t,t.refCount++,f.memoizedState={element:i,isDehydrated:n,cache:t},Vc(f),e}function Fp(e){return e?(e=In,e):In}function Wp(e,t,n,i,u,f){u=Fp(u),i.context===null?i.context=u:i.pendingContext=u,i=gs(t),i.payload={element:n},f=f===void 0?null:f,f!==null&&(i.callback=f),n=ys(e,i,t),n!==null&&(qt(n,e,t),li(n,e,t))}function eg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function id(e,t){eg(e,t),(e=e.alternate)&&eg(e,t)}function tg(e){if(e.tag===13||e.tag===31){var t=Qs(e,67108864);t!==null&&qt(t,e,67108864),id(e,67108864)}}function ag(e){if(e.tag===13||e.tag===31){var t=Yt();t=yt(t);var n=Qs(e,t);n!==null&&qt(n,e,t),id(e,t)}}var fo=!0;function Xb(e,t,n,i){var u=C.T;C.T=null;var f=J.p;try{J.p=2,ld(e,t,n,i)}finally{J.p=f,C.T=u}}function Qb(e,t,n,i){var u=C.T;C.T=null;var f=J.p;try{J.p=8,ld(e,t,n,i)}finally{J.p=f,C.T=u}}function ld(e,t,n,i){if(fo){var u=od(i);if(u===null)Yu(e,t,i,ho,n),ng(e,i);else if(Fb(u,e,t,n,i))i.stopPropagation();else if(ng(e,i),t&4&&-1<Zb.indexOf(e)){for(;u!==null;){var f=Rn(u);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var v=za(f.pendingLanes);if(v!==0){var b=f;for(b.pendingLanes|=2,b.entangledLanes|=2;v;){var N=1<<31-Ot(v);b.entanglements[1]|=N,v&=~N}Sa(f),(Le&6)===0&&(Jl=gt()+500,Si(0))}}break;case 31:case 13:b=Qs(f,2),b!==null&&qt(b,f,2),Ql(),id(f,2)}if(f=od(i),f===null&&Yu(e,t,i,ho,n),f===u)break;u=f}u!==null&&i.stopPropagation()}else Yu(e,t,i,null,n)}}function od(e){return e=uc(e),cd(e)}var ho=null;function cd(e){if(ho=null,e=On(e),e!==null){var t=d(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=h(t),e!==null)return e;e=null}else if(n===31){if(e=m(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return ho=e,null}function sg(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(nl()){case Hr:return 2;case Vr:return 8;case Ma:case jn:return 32;case ya:return 268435456;default:return 32}default:return 32}}var ud=!1,As=null,Cs=null,ks=null,ki=new Map,Oi=new Map,Os=[],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":As=null;break;case"dragenter":case"dragleave":Cs=null;break;case"mouseover":case"mouseout":ks=null;break;case"pointerover":case"pointerout":ki.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Oi.delete(t.pointerId)}}function Ri(e,t,n,i,u,f){return e===null||e.nativeEvent!==f?(e={blockedOn:t,domEventName:n,eventSystemFlags:i,nativeEvent:f,targetContainers:[u]},t!==null&&(t=Rn(t),t!==null&&tg(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function Fb(e,t,n,i,u){switch(t){case"focusin":return As=Ri(As,e,t,n,i,u),!0;case"dragenter":return Cs=Ri(Cs,e,t,n,i,u),!0;case"mouseover":return ks=Ri(ks,e,t,n,i,u),!0;case"pointerover":var f=u.pointerId;return ki.set(f,Ri(ki.get(f)||null,e,t,n,i,u)),!0;case"gotpointercapture":return f=u.pointerId,Oi.set(f,Ri(Oi.get(f)||null,e,t,n,i,u)),!0}return!1}function rg(e){var t=On(e.target);if(t!==null){var n=d(t);if(n!==null){if(t=n.tag,t===13){if(t=h(n),t!==null){e.blockedOn=t,Ps(e.priority,function(){ag(n)});return}}else if(t===31){if(t=m(n),t!==null){e.blockedOn=t,Ps(e.priority,function(){ag(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function mo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=od(e.nativeEvent);if(n===null){n=e.nativeEvent;var i=new n.constructor(n.type,n);cc=i,n.target.dispatchEvent(i),cc=null}else return t=Rn(n),t!==null&&tg(t),e.blockedOn=n,!1;t.shift()}return!0}function ig(e,t,n){mo(e)&&n.delete(t)}function Wb(){ud=!1,As!==null&&mo(As)&&(As=null),Cs!==null&&mo(Cs)&&(Cs=null),ks!==null&&mo(ks)&&(ks=null),ki.forEach(ig),Oi.forEach(ig)}function po(e,t){e.blockedOn===t&&(e.blockedOn=null,ud||(ud=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,Wb)))}var go=null;function lg(e){go!==e&&(go=e,s.unstable_scheduleCallback(s.unstable_NormalPriority,function(){go===e&&(go=null);for(var t=0;t<e.length;t+=3){var n=e[t],i=e[t+1],u=e[t+2];if(typeof i!="function"){if(cd(i||n)===null)continue;break}var f=Rn(n);f!==null&&(e.splice(t,3),t-=3,ou(f,{pending:!0,data:u,method:n.method,action:i},i,u))}}))}function hr(e){function t(N){return po(N,e)}As!==null&&po(As,e),Cs!==null&&po(Cs,e),ks!==null&&po(ks,e),ki.forEach(t),Oi.forEach(t);for(var n=0;n<Os.length;n++){var i=Os[n];i.blockedOn===e&&(i.blockedOn=null)}for(;0<Os.length&&(n=Os[0],n.blockedOn===null);)rg(n),n.blockedOn===null&&Os.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(i=0;i<n.length;i+=3){var u=n[i],f=n[i+1],v=u[Dt]||null;if(typeof f=="function")v||lg(n);else if(v){var b=null;if(f&&f.hasAttribute("formAction")){if(u=f,v=f[Dt]||null)b=v.formAction;else if(cd(u)!==null)continue}else b=v.action;typeof b=="function"?n[i+1]=b:(n.splice(i,3),i-=3),lg(n)}}}function og(){function e(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(v){return u=v})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=null),i||setTimeout(n,20)}function n(){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(n,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function dd(e){this._internalRoot=e}yo.prototype.render=dd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(l(409));var n=t.current,i=Yt();Wp(n,i,e,t,null,null)},yo.prototype.unmount=dd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Wp(e.current,2,null,e,null,null),Ql(),t[kn]=null}};function yo(e){this._internalRoot=e}yo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Gs();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Os.length&&t!==0&&t<Os[n].priority;n++);Os.splice(n,0,e),n===0&&rg(e)}};var cg=a.version;if(cg!=="19.2.3")throw Error(l(527,cg,"19.2.3"));J.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(l(188)):(e=Object.keys(e).join(","),Error(l(268,e)));return e=p(t),e=e!==null?g(e):null,e=e===null?null:e.stateNode,e};var ex={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:C,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var vo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!vo.isDisabled&&vo.supportsFiber)try{Hs=vo.inject(ex),wt=vo}catch{}}return Mi.createRoot=function(e,t){if(!c(e))throw Error(l(299));var n=!1,i="",u=gm,f=ym,v=vm;return t!=null&&(t.unstable_strictMode===!0&&(n=!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&&(v=t.onRecoverableError)),t=Zp(e,1,!1,null,null,n,i,null,u,f,v,og),e[kn]=t.current,Ku(e),new dd(t)},Mi.hydrateRoot=function(e,t,n){if(!c(e))throw Error(l(299));var i=!1,u="",f=gm,v=ym,b=vm,N=null;return n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(u=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(v=n.onCaughtError),n.onRecoverableError!==void 0&&(b=n.onRecoverableError),n.formState!==void 0&&(N=n.formState)),t=Zp(e,1,!0,t,n??null,i,u,N,f,v,b,og),t.context=Fp(null),n=t.current,i=Yt(),i=yt(i),u=gs(i),u.callback=null,ys(n,u,i),n=i,t.current.lanes=n,Vs(t,n),Sa(t),e[kn]=t.current,Ku(e),new yo(t)},Mi.version="19.2.3",Mi}var bg;function ux(){if(bg)return md.exports;bg=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(a){console.error(a)}}return s(),md.exports=cx(),md.exports}var dx=ux();const fx=nf(dx);const hx=s=>s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),mx=s=>s.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,r,l)=>l?l.toUpperCase():r.toLowerCase()),xg=s=>{const a=mx(s);return a.charAt(0).toUpperCase()+a.slice(1)},yy=(...s)=>s.filter((a,r,l)=>!!a&&a.trim()!==""&&l.indexOf(a)===r).join(" ").trim(),px=s=>{for(const a in s)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=x.forwardRef(({color:s="currentColor",size:a=24,strokeWidth:r=2,absoluteStrokeWidth:l,className:c="",children:d,iconNode:h,...m},y)=>x.createElement("svg",{ref:y,...gx,width:a,height:a,stroke:s,strokeWidth:l?Number(r)*24/Number(a):r,className:yy("lucide",c),...!d&&!px(m)&&{"aria-hidden":"true"},...m},[...h.map(([p,g])=>x.createElement(p,g)),...Array.isArray(d)?d:[d]]));const re=(s,a)=>{const r=x.forwardRef(({className:l,...c},d)=>x.createElement(yx,{ref:d,iconNode:a,className:yy(`lucide-${hx(xg(s))}`,`lucide-${s}`,l),...c}));return r.displayName=xg(s),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=re("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=re("archive",xx);const _x=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Sx=re("arrow-down",_x);const jx=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Nx=re("arrow-left",jx);const Ex=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Tx=re("arrow-up",Ex);const Ax=[["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"}]],Hi=re("brain",Ax);const Cx=[["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"}]],kx=re("calendar",Cx);const Ox=[["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"}]],Rx=re("camera",Ox);const Dx=[["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"}]],vy=re("chart-column",Dx);const Mx=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Na=re("check",Mx);const zx=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Ux=re("chevron-down",zx);const Lx=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Bx=re("chevron-left",Lx);const qx=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],$x=re("chevron-right",qx);const Hx=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Vx=re("chevron-up",Hx);const Ix=[["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"}]],Mr=re("circle-alert",Ix);const Gx=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Vi=re("circle-check-big",Gx);const Px=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],of=re("circle-check",Px);const Kx=[["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"}]],Yx=re("circle-user",Kx);const Jx=[["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"}]],Xx=re("circle-x",Jx);const Qx=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Or=re("clock",Qx);const Zx=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],Ls=re("code",Zx);const Fx=[["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"}]],Wx=re("copy",Fx);const ew=[["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"}]],cf=re("cpu",ew);const tw=[["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"}]],Ii=re("database",tw);const aw=[["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"}]],Gi=re("external-link",aw);const sw=[["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"}]],nw=re("eye",sw);const rw=[["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"}]],iw=re("flag",rw);const lw=[["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"}]],ow=re("hash",lw);const cw=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Rr=re("info",cw);const uw=[["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"}]],dw=re("key-round",uw);const fw=[["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"}]],hw=re("key",fw);const mw=[["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"}]],pw=re("layout-dashboard",mw);const gw=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],$t=re("loader-circle",gw);const yw=[["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"}]],vw=re("log-in",yw);const bw=[["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"}]],xw=re("log-out",bw);const ww=[["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"}]],Bd=re("mail",ww);const _w=[["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"}]],Sw=re("minimize-2",_w);const jw=[["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"}]],Nw=re("moon",jw);const Ew=[["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"}]],wg=re("paperclip",Ew);const Tw=[["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"}]],vd=re("pen",Tw);const Aw=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],zi=re("plus",Aw);const Cw=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],bo=re("power",Cw);const kw=[["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"}]],qs=re("refresh-cw",kw);const Ow=[["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"}]],by=re("rotate-ccw",Ow);const Rw=[["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"}]],Dw=re("save",Rw);const Mw=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],zw=re("search",Mw);const Uw=[["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"}]],Lw=re("send",Uw);const Bw=[["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"}]],qd=re("settings",Bw);const qw=[["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"}]],$w=re("settings-2",qw);const Hw=[["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"}]],$d=re("shield-check",Hw);const Vw=[["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"}]],Iw=re("shield",Vw);const Gw=[["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"}]],Pw=re("sun",Gw);const Kw=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Hd=re("terminal",Kw);const Yw=[["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"}]],Uo=re("trash-2",Yw);const Jw=[["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"}]],Dr=re("triangle-alert",Jw);const Xw=[["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"}]],Qw=re("upload",Xw);const Zw=[["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"}]],Fw=re("user-plus",Zw);const Ww=[["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"}]],xy=re("user",Ww);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"}],["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"}]],t_=re("volume-2",e_);const a_=[["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"}]],s_=re("volume-x",a_);const n_=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],tl=re("x",n_);const r_=[["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"}]],Lo=re("zap",r_),i_={theme:"system",setTheme:()=>null},wy=x.createContext(i_);function l_({children:s,defaultTheme:a="system",storageKey:r="vite-ui-theme"}){const[l,c]=x.useState(()=>localStorage.getItem(r)||a);x.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(wy.Provider,{value:d,children:s})}const o_=()=>{const s=x.useContext(wy);if(s===void 0)throw new Error("useTheme must be used within a ThemeProvider");return s};function _g(s,a){if(typeof s=="function")return s(a);s!=null&&(s.current=a)}function Go(...s){return a=>{let r=!1;const l=s.map(c=>{const d=_g(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():_g(s[c],null)}}}}function xn(...s){return x.useCallback(Go(...s),s)}var c_=Symbol.for("react.lazy"),Bo=lf[" use ".trim().toString()];function u_(s){return typeof s=="object"&&s!==null&&"then"in s}function _y(s){return s!=null&&typeof s=="object"&&"$$typeof"in s&&s.$$typeof===c_&&"_payload"in s&&u_(s._payload)}function Sy(s){const a=f_(s),r=x.forwardRef((l,c)=>{let{children:d,...h}=l;_y(d)&&typeof Bo=="function"&&(d=Bo(d._payload));const m=x.Children.toArray(d),y=m.find(m_);if(y){const p=y.props.children,g=m.map(w=>w===y?x.Children.count(p)>1?x.Children.only(null):x.isValidElement(p)?p.props.children:null:w);return o.jsx(a,{...h,ref:c,children:x.isValidElement(p)?x.cloneElement(p,void 0,g):null})}return o.jsx(a,{...h,ref:c,children:d})});return r.displayName=`${s}.Slot`,r}var d_=Sy("Slot");function f_(s){const a=x.forwardRef((r,l)=>{let{children:c,...d}=r;if(_y(c)&&typeof Bo=="function"&&(c=Bo(c._payload)),x.isValidElement(c)){const h=g_(c),m=p_(d,c.props);return c.type!==x.Fragment&&(m.ref=l?Go(l,h):h),x.cloneElement(c,m)}return x.Children.count(c)>1?x.Children.only(null):null});return a.displayName=`${s}.SlotClone`,a}var h_=Symbol("radix.slottable");function m_(s){return x.isValidElement(s)&&typeof s.type=="function"&&"__radixId"in s.type&&s.type.__radixId===h_}function p_(s,a){const r={...a};for(const l in a){const c=s[l],d=a[l];/^on[A-Z]/.test(l)?c&&d?r[l]=(...m)=>{const y=d(...m);return c(...m),y}:c&&(r[l]=c):l==="style"?r[l]={...c,...d}:l==="className"&&(r[l]=[c,d].filter(Boolean).join(" "))}return{...s,...r}}function g_(s){let a=Object.getOwnPropertyDescriptor(s.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?s.ref:(a=Object.getOwnPropertyDescriptor(s,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?s.props.ref:s.props.ref||s.ref)}function jy(s){var a,r,l="";if(typeof s=="string"||typeof s=="number")l+=s;else if(typeof s=="object")if(Array.isArray(s)){var c=s.length;for(a=0;a<c;a++)s[a]&&(r=jy(s[a]))&&(l&&(l+=" "),l+=r)}else for(r in s)s[r]&&(l&&(l+=" "),l+=r);return l}function Ny(){for(var s,a,r=0,l="",c=arguments.length;r<c;r++)(s=arguments[r])&&(a=jy(s))&&(l&&(l+=" "),l+=a);return l}const Sg=s=>typeof s=="boolean"?`${s}`:s===0?"0":s,jg=Ny,Ey=(s,a)=>r=>{var l;if(a?.variants==null)return jg(s,r?.class,r?.className);const{variants:c,defaultVariants:d}=a,h=Object.keys(c).map(p=>{const g=r?.[p],w=d?.[p];if(g===null)return null;const _=Sg(g)||Sg(w);return c[p][_]}),m=r&&Object.entries(r).reduce((p,g)=>{let[w,_]=g;return _===void 0||(p[w]=_),p},{}),y=a==null||(l=a.compoundVariants)===null||l===void 0?void 0:l.reduce((p,g)=>{let{class:w,className:_,...S}=g;return Object.entries(S).every(E=>{let[j,R]=E;return Array.isArray(R)?R.includes({...d,...m}[j]):{...d,...m}[j]===R})?[...p,w,_]:p},[]);return jg(s,h,y,r?.class,r?.className)},y_=(s,a)=>{const r=new Array(s.length+a.length);for(let l=0;l<s.length;l++)r[l]=s[l];for(let l=0;l<a.length;l++)r[s.length+l]=a[l];return r},v_=(s,a)=>({classGroupId:s,validator:a}),Ty=(s=new Map,a=null,r)=>({nextPart:s,validators:a,classGroupId:r}),qo="-",Ng=[],b_="arbitrary..",x_=s=>{const a=__(s),{conflictingClassGroups:r,conflictingClassGroupModifiers:l}=s;return{getClassGroupId:h=>{if(h.startsWith("[")&&h.endsWith("]"))return w_(h);const m=h.split(qo),y=m[0]===""&&m.length>1?1:0;return Ay(m,y,a)},getConflictingClassGroupIds:(h,m)=>{if(m){const y=l[h],p=r[h];return y?p?y_(p,y):y:p||Ng}return r[h]||Ng}}},Ay=(s,a,r)=>{if(s.length-a===0)return r.classGroupId;const c=s[a],d=r.nextPart.get(c);if(d){const p=Ay(s,a+1,d);if(p)return p}const h=r.validators;if(h===null)return;const m=a===0?s.join(qo):s.slice(a).join(qo),y=h.length;for(let p=0;p<y;p++){const g=h[p];if(g.validator(m))return g.classGroupId}},w_=s=>s.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const a=s.slice(1,-1),r=a.indexOf(":"),l=a.slice(0,r);return l?b_+l:void 0})(),__=s=>{const{theme:a,classGroups:r}=s;return S_(r,a)},S_=(s,a)=>{const r=Ty();for(const l in s){const c=s[l];uf(c,r,l,a)}return r},uf=(s,a,r,l)=>{const c=s.length;for(let d=0;d<c;d++){const h=s[d];j_(h,a,r,l)}},j_=(s,a,r,l)=>{if(typeof s=="string"){N_(s,a,r);return}if(typeof s=="function"){E_(s,a,r,l);return}T_(s,a,r,l)},N_=(s,a,r)=>{const l=s===""?a:Cy(a,s);l.classGroupId=r},E_=(s,a,r,l)=>{if(A_(s)){uf(s(l),a,r,l);return}a.validators===null&&(a.validators=[]),a.validators.push(v_(r,s))},T_=(s,a,r,l)=>{const c=Object.entries(s),d=c.length;for(let h=0;h<d;h++){const[m,y]=c[h];uf(y,Cy(a,m),r,l)}},Cy=(s,a)=>{let r=s;const l=a.split(qo),c=l.length;for(let d=0;d<c;d++){const h=l[d];let m=r.nextPart.get(h);m||(m=Ty(),r.nextPart.set(h,m)),r=m}return r},A_=s=>"isThemeGetter"in s&&s.isThemeGetter===!0,C_=s=>{if(s<1)return{get:()=>{},set:()=>{}};let a=0,r=Object.create(null),l=Object.create(null);const c=(d,h)=>{r[d]=h,a++,a>s&&(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)}}},Vd="!",Eg=":",k_=[],Tg=(s,a,r,l,c)=>({modifiers:s,hasImportantModifier:a,baseClassName:r,maybePostfixModifierPosition:l,isExternal:c}),O_=s=>{const{prefix:a,experimentalParseClassName:r}=s;let l=c=>{const d=[];let h=0,m=0,y=0,p;const g=c.length;for(let j=0;j<g;j++){const R=c[j];if(h===0&&m===0){if(R===Eg){d.push(c.slice(y,j)),y=j+1;continue}if(R==="/"){p=j;continue}}R==="["?h++:R==="]"?h--:R==="("?m++:R===")"&&m--}const w=d.length===0?c:c.slice(y);let _=w,S=!1;w.endsWith(Vd)?(_=w.slice(0,-1),S=!0):w.startsWith(Vd)&&(_=w.slice(1),S=!0);const E=p&&p>y?p-y:void 0;return Tg(d,S,_,E)};if(a){const c=a+Eg,d=l;l=h=>h.startsWith(c)?d(h.slice(c.length)):Tg(k_,!1,h,void 0,!0)}if(r){const c=l;l=d=>r({className:d,parseClassName:c})}return l},R_=s=>{const a=new Map;return s.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]==="[",y=a.has(h);m||y?(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}},D_=s=>({cache:C_(s.cacheSize),parseClassName:O_(s),sortModifiers:R_(s),...x_(s)}),M_=/\s+/,z_=(s,a)=>{const{parseClassName:r,getClassGroupId:l,getConflictingClassGroupIds:c,sortModifiers:d}=a,h=[],m=s.trim().split(M_);let y="";for(let p=m.length-1;p>=0;p-=1){const g=m[p],{isExternal:w,modifiers:_,hasImportantModifier:S,baseClassName:E,maybePostfixModifierPosition:j}=r(g);if(w){y=g+(y.length>0?" "+y:y);continue}let R=!!j,D=l(R?E.substring(0,j):E);if(!D){if(!R){y=g+(y.length>0?" "+y:y);continue}if(D=l(E),!D){y=g+(y.length>0?" "+y:y);continue}R=!1}const B=_.length===0?"":_.length===1?_[0]:d(_).join(":"),q=S?B+Vd:B,P=q+D;if(h.indexOf(P)>-1)continue;h.push(P);const W=c(D,R);for(let Y=0;Y<W.length;++Y){const I=W[Y];h.push(q+I)}y=g+(y.length>0?" "+y:y)}return y},U_=(...s)=>{let a=0,r,l,c="";for(;a<s.length;)(r=s[a++])&&(l=ky(r))&&(c&&(c+=" "),c+=l);return c},ky=s=>{if(typeof s=="string")return s;let a,r="";for(let l=0;l<s.length;l++)s[l]&&(a=ky(s[l]))&&(r&&(r+=" "),r+=a);return r},L_=(s,...a)=>{let r,l,c,d;const h=y=>{const p=a.reduce((g,w)=>w(g),s());return r=D_(p),l=r.cache.get,c=r.cache.set,d=m,m(y)},m=y=>{const p=l(y);if(p)return p;const g=z_(y,r);return c(y,g),g};return d=h,(...y)=>d(U_(...y))},B_=[],ft=s=>{const a=r=>r[s]||B_;return a.isThemeGetter=!0,a},Oy=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Ry=/^\((?:(\w[\w-]*):)?(.+)\)$/i,q_=/^\d+\/\d+$/,$_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,H_=/\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$/,V_=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,I_=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,G_=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,mr=s=>q_.test(s),we=s=>!!s&&!Number.isNaN(Number(s)),Ds=s=>!!s&&Number.isInteger(Number(s)),bd=s=>s.endsWith("%")&&we(s.slice(0,-1)),es=s=>$_.test(s),P_=()=>!0,K_=s=>H_.test(s)&&!V_.test(s),Dy=()=>!1,Y_=s=>I_.test(s),J_=s=>G_.test(s),X_=s=>!se(s)&&!ne(s),Q_=s=>zr(s,Uy,Dy),se=s=>Oy.test(s),un=s=>zr(s,Ly,K_),xd=s=>zr(s,t1,we),Ag=s=>zr(s,My,Dy),Z_=s=>zr(s,zy,J_),xo=s=>zr(s,By,Y_),ne=s=>Ry.test(s),Ui=s=>Ur(s,Ly),F_=s=>Ur(s,a1),Cg=s=>Ur(s,My),W_=s=>Ur(s,Uy),e1=s=>Ur(s,zy),wo=s=>Ur(s,By,!0),zr=(s,a,r)=>{const l=Oy.exec(s);return l?l[1]?a(l[1]):r(l[2]):!1},Ur=(s,a,r=!1)=>{const l=Ry.exec(s);return l?l[1]?a(l[1]):r:!1},My=s=>s==="position"||s==="percentage",zy=s=>s==="image"||s==="url",Uy=s=>s==="length"||s==="size"||s==="bg-size",Ly=s=>s==="length",t1=s=>s==="number",a1=s=>s==="family-name",By=s=>s==="shadow",s1=()=>{const s=ft("color"),a=ft("font"),r=ft("text"),l=ft("font-weight"),c=ft("tracking"),d=ft("leading"),h=ft("breakpoint"),m=ft("container"),y=ft("spacing"),p=ft("radius"),g=ft("shadow"),w=ft("inset-shadow"),_=ft("text-shadow"),S=ft("drop-shadow"),E=ft("blur"),j=ft("perspective"),R=ft("aspect"),D=ft("ease"),B=ft("animate"),q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],P=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],W=()=>[...P(),ne,se],Y=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto","contain","none"],X=()=>[ne,se,y],oe=()=>[mr,"full","auto",...X()],Ue=()=>[Ds,"none","subgrid",ne,se],ge=()=>["auto",{span:["full",Ds,ne,se]},Ds,ne,se],pe=()=>[Ds,"auto",ne,se],Ke=()=>["auto","min","max","fr",ne,se],Ge=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],je=()=>["start","end","center","stretch","center-safe","end-safe"],C=()=>["auto",...X()],J=()=>[mr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...X()],K=()=>[s,ne,se],_e=()=>[...P(),Cg,Ag,{position:[ne,se]}],Ne=()=>["no-repeat",{repeat:["","x","y","space","round"]}],A=()=>["auto","cover","contain",W_,Q_,{size:[ne,se]}],V=()=>[bd,Ui,un],Q=()=>["","none","full",p,ne,se],F=()=>["",we,Ui,un],de=()=>["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"],ue=()=>[we,bd,Cg,Ag],Ye=()=>["","none",E,ne,se],Be=()=>["none",we,ne,se],Ct=()=>["none",we,ne,se],pt=()=>[we,ne,se],xt=()=>[mr,"full",...X()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[es],breakpoint:[es],color:[P_],container:[es],"drop-shadow":[es],ease:["in","out","in-out"],font:[X_],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[es],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[es],shadow:[es],spacing:["px",we],text:[es],"text-shadow":[es],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",mr,se,ne,R]}],container:["container"],columns:[{columns:[we,se,ne,m]}],"break-after":[{"break-after":q()}],"break-before":[{"break-before":q()}],"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:W()}],overflow:[{overflow:Y()}],"overflow-x":[{"overflow-x":Y()}],"overflow-y":[{"overflow-y":Y()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:oe()}],"inset-x":[{"inset-x":oe()}],"inset-y":[{"inset-y":oe()}],start:[{start:oe()}],end:[{end:oe()}],top:[{top:oe()}],right:[{right:oe()}],bottom:[{bottom:oe()}],left:[{left:oe()}],visibility:["visible","invisible","collapse"],z:[{z:[Ds,"auto",ne,se]}],basis:[{basis:[mr,"full","auto",m,...X()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[we,mr,"auto","initial","none",se]}],grow:[{grow:["",we,ne,se]}],shrink:[{shrink:["",we,ne,se]}],order:[{order:[Ds,"first","last","none",ne,se]}],"grid-cols":[{"grid-cols":Ue()}],"col-start-end":[{col:ge()}],"col-start":[{"col-start":pe()}],"col-end":[{"col-end":pe()}],"grid-rows":[{"grid-rows":Ue()}],"row-start-end":[{row:ge()}],"row-start":[{"row-start":pe()}],"row-end":[{"row-end":pe()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Ke()}],"auto-rows":[{"auto-rows":Ke()}],gap:[{gap:X()}],"gap-x":[{"gap-x":X()}],"gap-y":[{"gap-y":X()}],"justify-content":[{justify:[...Ge(),"normal"]}],"justify-items":[{"justify-items":[...je(),"normal"]}],"justify-self":[{"justify-self":["auto",...je()]}],"align-content":[{content:["normal",...Ge()]}],"align-items":[{items:[...je(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...je(),{baseline:["","last"]}]}],"place-content":[{"place-content":Ge()}],"place-items":[{"place-items":[...je(),"baseline"]}],"place-self":[{"place-self":["auto",...je()]}],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:C()}],mx:[{mx:C()}],my:[{my:C()}],ms:[{ms:C()}],me:[{me:C()}],mt:[{mt:C()}],mr:[{mr:C()}],mb:[{mb:C()}],ml:[{ml:C()}],"space-x":[{"space-x":X()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":X()}],"space-y-reverse":["space-y-reverse"],size:[{size:J()}],w:[{w:[m,"screen",...J()]}],"min-w":[{"min-w":[m,"screen","none",...J()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[h]},...J()]}],h:[{h:["screen","lh",...J()]}],"min-h":[{"min-h":["screen","lh","none",...J()]}],"max-h":[{"max-h":["screen","lh",...J()]}],"font-size":[{text:["base",r,Ui,un]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[l,ne,xd]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",bd,se]}],"font-family":[{font:[F_,se,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,ne,se]}],"line-clamp":[{"line-clamp":[we,"none",ne,xd]}],leading:[{leading:[d,...X()]}],"list-image":[{"list-image":["none",ne,se]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ne,se]}],"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:[...de(),"wavy"]}],"text-decoration-thickness":[{decoration:[we,"from-font","auto",ne,un]}],"text-decoration-color":[{decoration:K()}],"underline-offset":[{"underline-offset":[we,"auto",ne,se]}],"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",ne,se]}],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",ne,se]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:_e()}],"bg-repeat":[{bg:Ne()}],"bg-size":[{bg:A()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ds,ne,se],radial:["",ne,se],conic:[Ds,ne,se]},e1,Z_]}],"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:Q()}],"rounded-s":[{"rounded-s":Q()}],"rounded-e":[{"rounded-e":Q()}],"rounded-t":[{"rounded-t":Q()}],"rounded-r":[{"rounded-r":Q()}],"rounded-b":[{"rounded-b":Q()}],"rounded-l":[{"rounded-l":Q()}],"rounded-ss":[{"rounded-ss":Q()}],"rounded-se":[{"rounded-se":Q()}],"rounded-ee":[{"rounded-ee":Q()}],"rounded-es":[{"rounded-es":Q()}],"rounded-tl":[{"rounded-tl":Q()}],"rounded-tr":[{"rounded-tr":Q()}],"rounded-br":[{"rounded-br":Q()}],"rounded-bl":[{"rounded-bl":Q()}],"border-w":[{border:F()}],"border-w-x":[{"border-x":F()}],"border-w-y":[{"border-y":F()}],"border-w-s":[{"border-s":F()}],"border-w-e":[{"border-e":F()}],"border-w-t":[{"border-t":F()}],"border-w-r":[{"border-r":F()}],"border-w-b":[{"border-b":F()}],"border-w-l":[{"border-l":F()}],"divide-x":[{"divide-x":F()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":F()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...de(),"hidden","none"]}],"divide-style":[{divide:[...de(),"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:[...de(),"none","hidden"]}],"outline-offset":[{"outline-offset":[we,ne,se]}],"outline-w":[{outline:["",we,Ui,un]}],"outline-color":[{outline:K()}],shadow:[{shadow:["","none",g,wo,xo]}],"shadow-color":[{shadow:K()}],"inset-shadow":[{"inset-shadow":["none",w,wo,xo]}],"inset-shadow-color":[{"inset-shadow":K()}],"ring-w":[{ring:F()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:K()}],"ring-offset-w":[{"ring-offset":[we,un]}],"ring-offset-color":[{"ring-offset":K()}],"inset-ring-w":[{"inset-ring":F()}],"inset-ring-color":[{"inset-ring":K()}],"text-shadow":[{"text-shadow":["none",_,wo,xo]}],"text-shadow-color":[{"text-shadow":K()}],opacity:[{opacity:[we,ne,se]}],"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":[we]}],"mask-image-linear-from-pos":[{"mask-linear-from":ue()}],"mask-image-linear-to-pos":[{"mask-linear-to":ue()}],"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":ue()}],"mask-image-t-to-pos":[{"mask-t-to":ue()}],"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":ue()}],"mask-image-r-to-pos":[{"mask-r-to":ue()}],"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":ue()}],"mask-image-b-to-pos":[{"mask-b-to":ue()}],"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":ue()}],"mask-image-l-to-pos":[{"mask-l-to":ue()}],"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":ue()}],"mask-image-x-to-pos":[{"mask-x-to":ue()}],"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":ue()}],"mask-image-y-to-pos":[{"mask-y-to":ue()}],"mask-image-y-from-color":[{"mask-y-from":K()}],"mask-image-y-to-color":[{"mask-y-to":K()}],"mask-image-radial":[{"mask-radial":[ne,se]}],"mask-image-radial-from-pos":[{"mask-radial-from":ue()}],"mask-image-radial-to-pos":[{"mask-radial-to":ue()}],"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":P()}],"mask-image-conic-pos":[{"mask-conic":[we]}],"mask-image-conic-from-pos":[{"mask-conic-from":ue()}],"mask-image-conic-to-pos":[{"mask-conic-to":ue()}],"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:_e()}],"mask-repeat":[{mask:Ne()}],"mask-size":[{mask:A()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ne,se]}],filter:[{filter:["","none",ne,se]}],blur:[{blur:Ye()}],brightness:[{brightness:[we,ne,se]}],contrast:[{contrast:[we,ne,se]}],"drop-shadow":[{"drop-shadow":["","none",S,wo,xo]}],"drop-shadow-color":[{"drop-shadow":K()}],grayscale:[{grayscale:["",we,ne,se]}],"hue-rotate":[{"hue-rotate":[we,ne,se]}],invert:[{invert:["",we,ne,se]}],saturate:[{saturate:[we,ne,se]}],sepia:[{sepia:["",we,ne,se]}],"backdrop-filter":[{"backdrop-filter":["","none",ne,se]}],"backdrop-blur":[{"backdrop-blur":Ye()}],"backdrop-brightness":[{"backdrop-brightness":[we,ne,se]}],"backdrop-contrast":[{"backdrop-contrast":[we,ne,se]}],"backdrop-grayscale":[{"backdrop-grayscale":["",we,ne,se]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[we,ne,se]}],"backdrop-invert":[{"backdrop-invert":["",we,ne,se]}],"backdrop-opacity":[{"backdrop-opacity":[we,ne,se]}],"backdrop-saturate":[{"backdrop-saturate":[we,ne,se]}],"backdrop-sepia":[{"backdrop-sepia":["",we,ne,se]}],"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",ne,se]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[we,"initial",ne,se]}],ease:[{ease:["linear","initial",D,ne,se]}],delay:[{delay:[we,ne,se]}],animate:[{animate:["none",B,ne,se]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,ne,se]}],"perspective-origin":[{"perspective-origin":W()}],rotate:[{rotate:Be()}],"rotate-x":[{"rotate-x":Be()}],"rotate-y":[{"rotate-y":Be()}],"rotate-z":[{"rotate-z":Be()}],scale:[{scale:Ct()}],"scale-x":[{"scale-x":Ct()}],"scale-y":[{"scale-y":Ct()}],"scale-z":[{"scale-z":Ct()}],"scale-3d":["scale-3d"],skew:[{skew:pt()}],"skew-x":[{"skew-x":pt()}],"skew-y":[{"skew-y":pt()}],transform:[{transform:[ne,se,"","none","gpu","cpu"]}],"transform-origin":[{origin:W()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:xt()}],"translate-x":[{"translate-x":xt()}],"translate-y":[{"translate-y":xt()}],"translate-z":[{"translate-z":xt()}],"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",ne,se]}],"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",ne,se]}],fill:[{fill:["none",...K()]}],"stroke-w":[{stroke:[we,Ui,un,xd]}],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"]}},n1=L_(s1);function Re(...s){return n1(Ny(s))}const r1=Ey("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=x.forwardRef(({className:s,variant:a,size:r,asChild:l=!1,...c},d)=>{const h=l?d_:"button";return o.jsx(h,{className:Re(r1({variant:a,size:r,className:s})),ref:d,...c})});Z.displayName="Button";function qy(){const{setTheme:s,theme:a}=o_();return o.jsxs(Z,{variant:"ghost",size:"sm",onClick:()=>s(a==="dark"?"light":"dark"),className:"text-muted-foreground hover:text-foreground w-8 px-0",title:`Switch to ${a==="dark"?"light":"dark"} mode`,children:[a==="dark"?o.jsx(Pw,{className:"h-[1.2rem] w-[1.2rem]"}):o.jsx(Nw,{className:"h-[1.2rem] w-[1.2rem]"}),o.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}var Ea=function(){return Ea=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},Ea.apply(this,arguments)};function Lr(s,a){var r={};for(var l in s)Object.prototype.hasOwnProperty.call(s,l)&&a.indexOf(l)<0&&(r[l]=s[l]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,l=Object.getOwnPropertySymbols(s);c<l.length;c++)a.indexOf(l[c])<0&&Object.prototype.propertyIsEnumerable.call(s,l[c])&&(r[l[c]]=s[l[c]]);return r}function i1(s,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(g){try{p(l.next(g))}catch(w){h(w)}}function y(g){try{p(l.throw(g))}catch(w){h(w)}}function p(g){g.done?d(g.value):c(g.value).then(m,y)}p((l=l.apply(s,a||[])).next())})}function l1(s,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 s.concat(d||Array.prototype.slice.call(a))}const o1=s=>s?(...a)=>s(...a):(...a)=>fetch(...a);class df extends Error{constructor(a,r="FunctionsError",l){super(a),this.name=r,this.context=l}}class c1 extends df{constructor(a){super("Failed to send a request to the Edge Function","FunctionsFetchError",a)}}class kg extends df{constructor(a){super("Relay Error invoking the Edge Function","FunctionsRelayError",a)}}class Og extends df{constructor(a){super("Edge Function returned a non-2xx status code","FunctionsHttpError",a)}}var Id;(function(s){s.Any="any",s.ApNortheast1="ap-northeast-1",s.ApNortheast2="ap-northeast-2",s.ApSouth1="ap-south-1",s.ApSoutheast1="ap-southeast-1",s.ApSoutheast2="ap-southeast-2",s.CaCentral1="ca-central-1",s.EuCentral1="eu-central-1",s.EuWest1="eu-west-1",s.EuWest2="eu-west-2",s.EuWest3="eu-west-3",s.SaEast1="sa-east-1",s.UsEast1="us-east-1",s.UsWest1="us-west-1",s.UsWest2="us-west-2"})(Id||(Id={}));class u1{constructor(a,{headers:r={},customFetch:l,region:c=Id.Any}={}){this.url=a,this.headers=r,this.region=c,this.fetch=o1(l)}setAuth(a){this.headers.Authorization=`Bearer ${a}`}invoke(a){return i1(this,arguments,void 0,function*(r,l={}){var c;let d,h;try{const{headers:m,method:y,body:p,signal:g,timeout:w}=l;let _={},{region:S}=l;S||(S=this.region);const E=new URL(`${this.url}/${r}`);S&&S!=="any"&&(_["x-region"]=S,E.searchParams.set("forceFunctionRegion",S));let j;p&&(m&&!Object.prototype.hasOwnProperty.call(m,"Content-Type")||!m)?typeof Blob<"u"&&p instanceof Blob||p instanceof ArrayBuffer?(_["Content-Type"]="application/octet-stream",j=p):typeof p=="string"?(_["Content-Type"]="text/plain",j=p):typeof FormData<"u"&&p instanceof FormData?j=p:(_["Content-Type"]="application/json",j=JSON.stringify(p)):p&&typeof p!="string"&&!(typeof Blob<"u"&&p instanceof Blob)&&!(p instanceof ArrayBuffer)&&!(typeof FormData<"u"&&p instanceof FormData)?j=JSON.stringify(p):j=p;let R=g;w&&(h=new AbortController,d=setTimeout(()=>h.abort(),w),g?(R=h.signal,g.addEventListener("abort",()=>h.abort())):R=h.signal);const D=yield this.fetch(E.toString(),{method:y||"POST",headers:Object.assign(Object.assign(Object.assign({},_),this.headers),m),body:j,signal:R}).catch(W=>{throw new c1(W)}),B=D.headers.get("x-relay-error");if(B&&B==="true")throw new kg(D);if(!D.ok)throw new Og(D);let q=((c=D.headers.get("Content-Type"))!==null&&c!==void 0?c:"text/plain").split(";")[0].trim(),P;return q==="application/json"?P=yield D.json():q==="application/octet-stream"||q==="application/pdf"?P=yield D.blob():q==="text/event-stream"?P=D:q==="multipart/form-data"?P=yield D.formData():P=yield D.text(),{data:P,error:null,response:D}}catch(m){return{data:null,error:m,response:m instanceof Og||m instanceof kg?m.context:void 0}}finally{d&&clearTimeout(d)}})}}var d1=class extends Error{constructor(s){super(s.message),this.name="PostgrestError",this.details=s.details,this.hint=s.hint,this.code=s.code}},f1=class{constructor(s){var a,r;this.shouldThrowOnError=!1,this.method=s.method,this.url=s.url,this.headers=new Headers(s.headers),this.schema=s.schema,this.body=s.body,this.shouldThrowOnError=(a=s.shouldThrowOnError)!==null&&a!==void 0?a:!1,this.signal=s.signal,this.isMaybeSingle=(r=s.isMaybeSingle)!==null&&r!==void 0?r:!1,s.fetch?this.fetch=s.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(s,a){return this.headers=new Headers(this.headers),this.headers.set(s,a),this}then(s,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,y=null,p=d.status,g=d.statusText;if(d.ok){var w,_;if(r.method!=="HEAD"){var S;const D=await d.text();D===""||(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=D:m=JSON.parse(D))}const j=(w=r.headers.get("Prefer"))===null||w===void 0?void 0:w.match(/count=(exact|planned|estimated)/),R=(_=d.headers.get("content-range"))===null||_===void 0?void 0:_.split("/");j&&R&&R.length>1&&(y=parseInt(R[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,y=null,p=406,g="Not Acceptable"):m.length===1?m=m[0]:m=null)}else{var E;const j=await d.text();try{h=JSON.parse(j),Array.isArray(h)&&d.status===404&&(m=[],h=null,p=200,g="OK")}catch{d.status===404&&j===""?(p=204,g="No Content"):h={message:j}}if(h&&r.isMaybeSingle&&(!(h==null||(E=h.details)===null||E===void 0)&&E.includes("0 rows"))&&(h=null,p=200,g="OK"),h&&r.shouldThrowOnError)throw new d1(h)}return{error:h,data:m,count:y,status:p,statusText:g}});return this.shouldThrowOnError||(c=c.catch(d=>{var h;let m="";const y=d?.cause;if(y){var p,g,w,_;const E=(p=y?.message)!==null&&p!==void 0?p:"",j=(g=y?.code)!==null&&g!==void 0?g:"";m=`${(w=d?.name)!==null&&w!==void 0?w:"FetchError"}: ${d?.message}`,m+=`
8
+ `+i.stack}}var ls=Object.prototype.hasOwnProperty,jn=s.unstable_scheduleCallback,os=s.unstable_cancelCallback,nl=s.unstable_shouldYield,$s=s.unstable_requestPaint,gt=s.unstable_now,rl=s.unstable_getCurrentPriorityLevel,Hr=s.unstable_ImmediatePriority,Vr=s.unstable_UserBlockingPriority,Ma=s.unstable_NormalPriority,Nn=s.unstable_LowPriority,ya=s.unstable_IdlePriority,En=s.log,Fo=s.unstable_setDisableYieldValue,Hs=null,wt=null;function va(e){if(typeof En=="function"&&Fo(e),wt&&typeof wt.setStrictMode=="function")try{wt.setStrictMode(Hs,e)}catch{}}var Ot=Math.clz32?Math.clz32:tc,Wo=Math.log,ec=Math.LN2;function tc(e){return e>>>=0,e===0?32:31-(Wo(e)/ec|0)|0}var Tn=256,An=262144,Cn=4194304;function za(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 kn(e,t,n){var i=e.pendingLanes;if(i===0)return 0;var u=0,f=e.suspendedLanes,v=e.pingedLanes;e=e.warmLanes;var b=i&134217727;return b!==0?(i=b&~f,i!==0?u=za(i):(v&=b,v!==0?u=za(v):n||(n=b&~e,n!==0&&(u=za(n))))):(b=i&~f,b!==0?u=za(b):v!==0?u=za(v):n||(n=i&~e,n!==0&&(u=za(n)))),u===0?0:t!==0&&t!==u&&(t&f)===0&&(f=u&-u,n=t&-t,f>=n||f===32&&(n&4194048)!==0)?t:u}function cs(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function ac(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 il(){var e=Cn;return Cn<<=1,(Cn&62914560)===0&&(Cn=4194304),e}function Ir(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Vs(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function sc(e,t,n,i,u,f){var v=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var b=e.entanglements,N=e.expirationTimes,z=e.hiddenUpdates;for(n=v&~n;0<n;){var $=31-Ot(n),G=1<<$;b[$]=0,N[$]=-1;var U=z[$];if(U!==null)for(z[$]=null,$=0;$<U.length;$++){var L=U[$];L!==null&&(L.lane&=-536870913)}n&=~G}i!==0&&O(e,i,0),f!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=f&~(v&~t))}function O(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-Ot(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|n&261930}function ee(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var i=31-Ot(n),u=1<<i;u&t|e[i]&t&&(e[i]|=t),n&=~u}}function Ce(e,t){var n=t&-t;return n=(n&42)!==0?1:yt(n),(n&(e.suspendedLanes|t))!==0?0:n}function yt(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 Is(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Gs(){var e=J.p;return e!==0?e:(e=window.event,e===void 0?32:ng(e.type))}function Ps(e,t){var n=J.p;try{return J.p=e,t()}finally{J.p=n}}var ba=Math.random().toString(36).slice(2),ut="__reactFiber$"+ba,Dt="__reactProps$"+ba,On="__reactContainer$"+ba,nc="__reactEvents$"+ba,Yv="__reactListeners$"+ba,Jv="__reactHandles$"+ba,wf="__reactResources$"+ba,Gr="__reactMarker$"+ba;function rc(e){delete e[ut],delete e[Dt],delete e[nc],delete e[Yv],delete e[Jv]}function Rn(e){var t=e[ut];if(t)return t;for(var n=e.parentNode;n;){if(t=n[On]||n[ut]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Vp(e);e!==null;){if(n=e[ut])return n;e=Vp(e)}return t}e=n,n=e.parentNode}return null}function Dn(e){if(e=e[ut]||e[On]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Pr(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(l(33))}function Mn(e){var t=e[wf];return t||(t=e[wf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function vt(e){e[Gr]=!0}var _f=new Set,Sf={};function Ks(e,t){zn(e,t),zn(e+"Capture",t)}function zn(e,t){for(Sf[e]=t,e=0;e<t.length;e++)_f.add(t[e])}var Xv=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]*$"),jf={},Nf={};function Qv(e){return ls.call(Nf,e)?!0:ls.call(jf,e)?!1:Xv.test(e)?Nf[e]=!0:(jf[e]=!0,!1)}function ll(e,t,n){if(Qv(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){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,""+n)}}function ol(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function Ua(e,t,n,i){if(i===null)e.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+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 Ef(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Zv(e,t,n){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(v){n=""+v,f.call(this,v)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return n},setValue:function(v){n=""+v},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ic(e){if(!e._valueTracker){var t=Ef(e)?"checked":"value";e._valueTracker=Zv(e,t,""+e[t])}}function Tf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),i="";return e&&(i=Ef(e)?e.checked?"true":"false":e.value),e=i,e!==n?(t.setValue(e),!0):!1}function cl(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 Fv=/[\n"\\]/g;function Ft(e){return e.replace(Fv,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function lc(e,t,n,i,u,f,v,b){e.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?e.type=v:e.removeAttribute("type"),t!=null?v==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Zt(t)):e.value!==""+Zt(t)&&(e.value=""+Zt(t)):v!=="submit"&&v!=="reset"||e.removeAttribute("value"),t!=null?oc(e,v,Zt(t)):n!=null?oc(e,v,Zt(n)):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 Af(e,t,n,i,u,f,v,b){if(f!=null&&typeof f!="function"&&typeof f!="symbol"&&typeof f!="boolean"&&(e.type=f),t!=null||n!=null){if(!(f!=="submit"&&f!=="reset"||t!=null)){ic(e);return}n=n!=null?""+Zt(n):"",t=t!=null?""+Zt(t):n,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,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(e.name=v),ic(e)}function oc(e,t,n){t==="number"&&cl(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function Un(e,t,n,i){if(e=e.options,t){t={};for(var u=0;u<n.length;u++)t["$"+n[u]]=!0;for(n=0;n<e.length;n++)u=t.hasOwnProperty("$"+e[n].value),e[n].selected!==u&&(e[n].selected=u),u&&i&&(e[n].defaultSelected=!0)}else{for(n=""+Zt(n),t=null,u=0;u<e.length;u++){if(e[u].value===n){e[u].selected=!0,i&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function Cf(e,t,n){if(t!=null&&(t=""+Zt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Zt(n):""}function kf(e,t,n,i){if(t==null){if(i!=null){if(n!=null)throw Error(l(92));if($e(i)){if(1<i.length)throw Error(l(93));i=i[0]}n=i}n==null&&(n=""),t=n}n=Zt(t),e.defaultValue=n,i=e.textContent,i===n&&i!==""&&i!==null&&(e.value=i),ic(e)}function Ln(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Wv=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 Of(e,t,n){var i=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?i?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":i?e.setProperty(t,n):typeof n!="number"||n===0||Wv.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function Rf(e,t,n){if(t!=null&&typeof t!="object")throw Error(l(62));if(e=e.style,n!=null){for(var i in n)!n.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)&&n[u]!==i&&Of(e,u,i)}else for(var f in t)t.hasOwnProperty(f)&&Of(e,f,t[f])}function cc(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 e0=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"]]),t0=/^[\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 ul(e){return t0.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function La(){}var uc=null;function dc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Bn=null,qn=null;function Df(e){var t=Dn(e);if(t&&(e=t.stateNode)){var n=e[Dt]||null;e:switch(e=t.stateNode,t.type){case"input":if(lc(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Ft(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var u=i[Dt]||null;if(!u)throw Error(l(90));lc(i,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<n.length;t++)i=n[t],i.form===e.form&&Tf(i)}break e;case"textarea":Cf(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&Un(e,!!n.multiple,t,!1)}}}var fc=!1;function Mf(e,t,n){if(fc)return e(t,n);fc=!0;try{var i=e(t);return i}finally{if(fc=!1,(Bn!==null||qn!==null)&&(Zl(),Bn&&(t=Bn,e=qn,qn=Bn=null,Df(t),e)))for(t=0;t<e.length;t++)Df(e[t])}}function Kr(e,t){var n=e.stateNode;if(n===null)return null;var i=n[Dt]||null;if(i===null)return null;n=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(n&&typeof n!="function")throw Error(l(231,t,typeof n));return n}var Ba=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),hc=!1;if(Ba)try{var Yr={};Object.defineProperty(Yr,"passive",{get:function(){hc=!0}}),window.addEventListener("test",Yr,Yr),window.removeEventListener("test",Yr,Yr)}catch{hc=!1}var us=null,mc=null,dl=null;function zf(){if(dl)return dl;var e,t=mc,n=t.length,i,u="value"in us?us.value:us.textContent,f=u.length;for(e=0;e<n&&t[e]===u[e];e++);var v=n-e;for(i=1;i<=v&&t[n-i]===u[f-i];i++);return dl=u.slice(e,1<i?1-i:void 0)}function fl(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 hl(){return!0}function Uf(){return!1}function Mt(e){function t(n,i,u,f,v){this._reactName=n,this._targetInst=u,this.type=i,this.nativeEvent=f,this.target=v,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(n=e[b],this[b]=n?n(f):f[b]);return this.isDefaultPrevented=(f.defaultPrevented!=null?f.defaultPrevented:f.returnValue===!1)?hl:Uf,this.isPropagationStopped=Uf,this}return w(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=hl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=hl)},persist:function(){},isPersistent:hl}),t}var Ys={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ml=Mt(Ys),Jr=w({},Ys,{view:0,detail:0}),a0=Mt(Jr),pc,gc,Xr,pl=w({},Jr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vc,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!==Xr&&(Xr&&e.type==="mousemove"?(pc=e.screenX-Xr.screenX,gc=e.screenY-Xr.screenY):gc=pc=0,Xr=e),pc)},movementY:function(e){return"movementY"in e?e.movementY:gc}}),Lf=Mt(pl),s0=w({},pl,{dataTransfer:0}),n0=Mt(s0),r0=w({},Jr,{relatedTarget:0}),yc=Mt(r0),i0=w({},Ys,{animationName:0,elapsedTime:0,pseudoElement:0}),l0=Mt(i0),o0=w({},Ys,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),c0=Mt(o0),u0=w({},Ys,{data:0}),Bf=Mt(u0),d0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},f0={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"},h0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function m0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=h0[e])?!!t[e]:!1}function vc(){return m0}var p0=w({},Jr,{key:function(e){if(e.key){var t=d0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=fl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?f0[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vc,charCode:function(e){return e.type==="keypress"?fl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?fl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),g0=Mt(p0),y0=w({},pl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),qf=Mt(y0),v0=w({},Jr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vc}),b0=Mt(v0),x0=w({},Ys,{propertyName:0,elapsedTime:0,pseudoElement:0}),w0=Mt(x0),_0=w({},pl,{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}),S0=Mt(_0),j0=w({},Ys,{newState:0,oldState:0}),N0=Mt(j0),E0=[9,13,27,32],bc=Ba&&"CompositionEvent"in window,Qr=null;Ba&&"documentMode"in document&&(Qr=document.documentMode);var T0=Ba&&"TextEvent"in window&&!Qr,$f=Ba&&(!bc||Qr&&8<Qr&&11>=Qr),Hf=" ",Vf=!1;function If(e,t){switch(e){case"keyup":return E0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Gf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var $n=!1;function A0(e,t){switch(e){case"compositionend":return Gf(t);case"keypress":return t.which!==32?null:(Vf=!0,Hf);case"textInput":return e=t.data,e===Hf&&Vf?null:e;default:return null}}function C0(e,t){if($n)return e==="compositionend"||!bc&&If(e,t)?(e=zf(),dl=mc=us=null,$n=!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 $f&&t.locale!=="ko"?null:t.data;default:return null}}var k0={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 Pf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!k0[e.type]:t==="textarea"}function Kf(e,t,n,i){Bn?qn?qn.push(i):qn=[i]:Bn=i,t=no(t,"onChange"),0<t.length&&(n=new ml("onChange","change",null,n,i),e.push({event:n,listeners:t}))}var Zr=null,Fr=null;function O0(e){Ap(e,0)}function gl(e){var t=Pr(e);if(Tf(t))return e}function Yf(e,t){if(e==="change")return t}var Jf=!1;if(Ba){var xc;if(Ba){var wc="oninput"in document;if(!wc){var Xf=document.createElement("div");Xf.setAttribute("oninput","return;"),wc=typeof Xf.oninput=="function"}xc=wc}else xc=!1;Jf=xc&&(!document.documentMode||9<document.documentMode)}function Qf(){Zr&&(Zr.detachEvent("onpropertychange",Zf),Fr=Zr=null)}function Zf(e){if(e.propertyName==="value"&&gl(Fr)){var t=[];Kf(t,Fr,e,dc(e)),Mf(O0,t)}}function R0(e,t,n){e==="focusin"?(Qf(),Zr=t,Fr=n,Zr.attachEvent("onpropertychange",Zf)):e==="focusout"&&Qf()}function D0(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return gl(Fr)}function M0(e,t){if(e==="click")return gl(t)}function z0(e,t){if(e==="input"||e==="change")return gl(t)}function U0(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ht=typeof Object.is=="function"?Object.is:U0;function Wr(e,t){if(Ht(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(i=0;i<n.length;i++){var u=n[i];if(!ls.call(t,u)||!Ht(e[u],t[u]))return!1}return!0}function Ff(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Wf(e,t){var n=Ff(e);e=0;for(var i;n;){if(n.nodeType===3){if(i=e+n.textContent.length,e<=t&&i>=t)return{node:n,offset:t-e};e=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Ff(n)}}function eh(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?eh(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function th(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=cl(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=cl(e.document)}return t}function _c(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 L0=Ba&&"documentMode"in document&&11>=document.documentMode,Hn=null,Sc=null,ei=null,jc=!1;function ah(e,t,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;jc||Hn==null||Hn!==cl(i)||(i=Hn,"selectionStart"in i&&_c(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}),ei&&Wr(ei,i)||(ei=i,i=no(Sc,"onSelect"),0<i.length&&(t=new ml("onSelect","select",null,t,n),e.push({event:t,listeners:i}),t.target=Hn)))}function Js(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Vn={animationend:Js("Animation","AnimationEnd"),animationiteration:Js("Animation","AnimationIteration"),animationstart:Js("Animation","AnimationStart"),transitionrun:Js("Transition","TransitionRun"),transitionstart:Js("Transition","TransitionStart"),transitioncancel:Js("Transition","TransitionCancel"),transitionend:Js("Transition","TransitionEnd")},Nc={},sh={};Ba&&(sh=document.createElement("div").style,"AnimationEvent"in window||(delete Vn.animationend.animation,delete Vn.animationiteration.animation,delete Vn.animationstart.animation),"TransitionEvent"in window||delete Vn.transitionend.transition);function Xs(e){if(Nc[e])return Nc[e];if(!Vn[e])return e;var t=Vn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in sh)return Nc[e]=t[n];return e}var nh=Xs("animationend"),rh=Xs("animationiteration"),ih=Xs("animationstart"),B0=Xs("transitionrun"),q0=Xs("transitionstart"),$0=Xs("transitioncancel"),lh=Xs("transitionend"),oh=new Map,Ec="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(" ");Ec.push("scrollEnd");function oa(e,t){oh.set(e,t),Ks(t,[e])}var yl=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=[],In=0,Tc=0;function vl(){for(var e=In,t=Tc=In=0;t<e;){var n=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 v=i.pending;v===null?u.next=u:(u.next=v.next,v.next=u),i.pending=u}f!==0&&ch(n,u,f)}}function bl(e,t,n,i){Wt[In++]=e,Wt[In++]=t,Wt[In++]=n,Wt[In++]=i,Tc|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function Ac(e,t,n,i){return bl(e,t,n,i),xl(e)}function Qs(e,t){return bl(e,null,null,t),xl(e)}function ch(e,t,n){e.lanes|=n;var i=e.alternate;i!==null&&(i.lanes|=n);for(var u=!1,f=e.return;f!==null;)f.childLanes|=n,i=f.alternate,i!==null&&(i.childLanes|=n),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(n),e=f.hiddenUpdates,i=e[u],i===null?e[u]=[t]:i.push(t),t.lane=n|536870912),f):null}function xl(e){if(50<_i)throw _i=0,Lu=null,Error(l(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Gn={};function H0(e,t,n,i){this.tag=e,this.key=n,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,n,i){return new H0(e,t,n,i)}function Cc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function qa(e,t){var n=e.alternate;return n===null?(n=Vt(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function uh(e,t){e.flags&=65011714;var n=e.alternate;return n===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=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function wl(e,t,n,i,u,f){var v=0;if(i=e,typeof e=="function")Cc(e)&&(v=1);else if(typeof e=="string")v=Kb(e,n,F.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case le:return e=Vt(31,n,t,u),e.elementType=le,e.lanes=f,e;case j:return Zs(n.children,u,f,t);case R:v=8,u|=24;break;case D:return e=Vt(12,n,t,u|2),e.elementType=D,e.lanes=f,e;case W:return e=Vt(13,n,t,u),e.elementType=W,e.lanes=f,e;case Y:return e=Vt(19,n,t,u),e.elementType=Y,e.lanes=f,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case q:v=10;break e;case B:v=9;break e;case P:v=11;break e;case H:v=14;break e;case Q:v=16,i=null;break e}v=29,n=Error(l(130,e===null?"null":typeof e,"")),i=null}return t=Vt(v,n,t,u),t.elementType=e,t.type=i,t.lanes=f,t}function Zs(e,t,n,i){return e=Vt(7,e,i,t),e.lanes=n,e}function kc(e,t,n){return e=Vt(6,e,null,t),e.lanes=n,e}function dh(e){var t=Vt(18,null,null,0);return t.stateNode=e,t}function Oc(e,t,n){return t=Vt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var fh=new WeakMap;function ea(e,t){if(typeof e=="object"&&e!==null){var n=fh.get(e);return n!==void 0?n:(t={value:e,source:t,stack:$r(t)},fh.set(e,t),t)}return{value:e,source:t,stack:$r(t)}}var Pn=[],Kn=0,_l=null,ti=0,ta=[],aa=0,ds=null,xa=1,wa="";function $a(e,t){Pn[Kn++]=ti,Pn[Kn++]=_l,_l=e,ti=t}function hh(e,t,n){ta[aa++]=xa,ta[aa++]=wa,ta[aa++]=ds,ds=e;var i=xa;e=wa;var u=32-Ot(i)-1;i&=~(1<<u),n+=1;var f=32-Ot(t)+u;if(30<f){var v=u-u%5;f=(i&(1<<v)-1).toString(32),i>>=v,u-=v,xa=1<<32-Ot(t)+u|n<<u|i,wa=f+e}else xa=1<<f|n<<u|i,wa=e}function Rc(e){e.return!==null&&($a(e,1),hh(e,1,0))}function Dc(e){for(;e===_l;)_l=Pn[--Kn],Pn[Kn]=null,ti=Pn[--Kn],Pn[Kn]=null;for(;e===ds;)ds=ta[--aa],ta[aa]=null,wa=ta[--aa],ta[aa]=null,xa=ta[--aa],ta[aa]=null}function mh(e,t){ta[aa++]=xa,ta[aa++]=wa,ta[aa++]=ds,xa=t.id,wa=t.overflow,ds=e}var _t=null,Ye=null,ke=!1,fs=null,sa=!1,Mc=Error(l(519));function hs(e){var t=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ai(ea(t,e)),Mc}function ph(e){var t=e.stateNode,n=e.type,i=e.memoizedProps;switch(t[ut]=e,t[Dt]=i,n){case"dialog":Ee("cancel",t),Ee("close",t);break;case"iframe":case"object":case"embed":Ee("load",t);break;case"video":case"audio":for(n=0;n<ji.length;n++)Ee(ji[n],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),Af(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),kf(t,i.value,i.defaultValue,i.children)}n=i.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||i.suppressHydrationWarning===!0||Rp(t.textContent,n)?(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=La),t=!0):t=!1,t||hs(e,!0)}function gh(e){for(_t=e.return;_t;)switch(_t.tag){case 5:case 31:case 13:sa=!1;return;case 27:case 3:sa=!0;return;default:_t=_t.return}}function Yn(e){if(e!==_t)return!1;if(!ke)return gh(e),ke=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||Fu(e.type,e.memoizedProps)),n=!n),n&&Ye&&hs(e),gh(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ye=Hp(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ye=Hp(e)}else t===27?(t=Ye,Ts(e.type)?(e=sd,sd=null,Ye=e):Ye=t):Ye=_t?ra(e.stateNode.nextSibling):null;return!0}function Fs(){Ye=_t=null,ke=!1}function zc(){var e=fs;return e!==null&&(Bt===null?Bt=e:Bt.push.apply(Bt,e),fs=null),e}function ai(e){fs===null?fs=[e]:fs.push(e)}var Uc=A(null),Ws=null,Ha=null;function ms(e,t,n){X(Uc,t._currentValue),t._currentValue=n}function Va(e){e._currentValue=Uc.current,I(Uc)}function Lc(e,t,n){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===n)break;e=e.return}}function Bc(e,t,n,i){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var f=u.dependencies;if(f!==null){var v=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|=n,b=f.alternate,b!==null&&(b.lanes|=n),Lc(f.return,n,e),i||(v=null);break e}f=b.next}}else if(u.tag===18){if(v=u.return,v===null)throw Error(l(341));v.lanes|=n,f=v.alternate,f!==null&&(f.lanes|=n),Lc(v,n,e),v=null}else v=u.child;if(v!==null)v.return=u;else for(v=u;v!==null;){if(v===e){v=null;break}if(u=v.sibling,u!==null){u.return=v.return,v=u;break}v=v.return}u=v}}function Jn(e,t,n,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 v=u.alternate;if(v===null)throw Error(l(387));if(v=v.memoizedProps,v!==null){var b=u.type;Ht(u.pendingProps.value,v.value)||(e!==null?e.push(b):e=[b])}}else if(u===de.current){if(v=u.alternate,v===null)throw Error(l(387));v.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(Ci):e=[Ci])}u=u.return}e!==null&&Bc(t,e,n,i),t.flags|=262144}function Sl(e){for(e=e.firstContext;e!==null;){if(!Ht(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function en(e){Ws=e,Ha=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function St(e){return yh(Ws,e)}function jl(e,t){return Ws===null&&en(e),yh(e,t)}function yh(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Ha===null){if(e===null)throw Error(l(308));Ha=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Ha=Ha.next=t;return n}var V0=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},I0=s.unstable_scheduleCallback,G0=s.unstable_NormalPriority,nt={$$typeof:q,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function qc(){return{controller:new V0,data:new Map,refCount:0}}function si(e){e.refCount--,e.refCount===0&&I0(G0,function(){e.controller.abort()})}var ni=null,$c=0,Xn=0,Qn=null;function P0(e,t){if(ni===null){var n=ni=[];$c=0,Xn=Iu(),Qn={status:"pending",value:void 0,then:function(i){n.push(i)}}}return $c++,t.then(vh,vh),t}function vh(){if(--$c===0&&ni!==null){Qn!==null&&(Qn.status="fulfilled");var e=ni;ni=null,Xn=0,Qn=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function K0(e,t){var n=[],i={status:"pending",value:null,reason:null,then:function(u){n.push(u)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var u=0;u<n.length;u++)(0,n[u])(t)},function(u){for(i.status="rejected",i.reason=u,u=0;u<n.length;u++)(0,n[u])(void 0)}),i}var bh=C.S;C.S=function(e,t){ap=gt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&P0(e,t),bh!==null&&bh(e,t)};var tn=A(null);function Hc(){var e=tn.current;return e!==null?e:Ge.pooledCache}function Nl(e,t){t===null?X(tn,tn.current):X(tn,t.pool)}function xh(){var e=Hc();return e===null?null:{parent:nt._currentValue,pool:e}}var Zn=Error(l(460)),Vc=Error(l(474)),El=Error(l(542)),Tl={then:function(){}};function wh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function _h(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(La,La),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,jh(e),e;default:if(typeof t.status=="string")t.then(La,La);else{if(e=Ge,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,jh(e),e}throw sn=t,Zn}}function an(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(sn=n,Zn):n}}var sn=null;function Sh(){if(sn===null)throw Error(l(459));var e=sn;return sn=null,e}function jh(e){if(e===Zn||e===El)throw Error(l(483))}var Fn=null,ri=0;function Al(e){var t=ri;return ri+=1,Fn===null&&(Fn=[]),_h(Fn,e,t)}function ii(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Cl(e,t){throw t.$$typeof===_?Error(l(525)):(e=Object.prototype.toString.call(t),Error(l(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Nh(e){function t(k,T){if(e){var M=k.deletions;M===null?(k.deletions=[T],k.flags|=16):M.push(T)}}function n(k,T){if(!e)return null;for(;T!==null;)t(k,T),T=T.sibling;return null}function i(k){for(var T=new Map;k!==null;)k.key!==null?T.set(k.key,k):T.set(k.index,k),k=k.sibling;return T}function u(k,T){return k=qa(k,T),k.index=0,k.sibling=null,k}function f(k,T,M){return k.index=M,e?(M=k.alternate,M!==null?(M=M.index,M<T?(k.flags|=67108866,T):M):(k.flags|=67108866,T)):(k.flags|=1048576,T)}function v(k){return e&&k.alternate===null&&(k.flags|=67108866),k}function b(k,T,M,V){return T===null||T.tag!==6?(T=kc(M,k.mode,V),T.return=k,T):(T=u(T,M),T.return=k,T)}function N(k,T,M,V){var ue=M.type;return ue===j?$(k,T,M.props.children,V,M.key):T!==null&&(T.elementType===ue||typeof ue=="object"&&ue!==null&&ue.$$typeof===Q&&an(ue)===T.type)?(T=u(T,M.props),ii(T,M),T.return=k,T):(T=wl(M.type,M.key,M.props,null,k.mode,V),ii(T,M),T.return=k,T)}function z(k,T,M,V){return T===null||T.tag!==4||T.stateNode.containerInfo!==M.containerInfo||T.stateNode.implementation!==M.implementation?(T=Oc(M,k.mode,V),T.return=k,T):(T=u(T,M.children||[]),T.return=k,T)}function $(k,T,M,V,ue){return T===null||T.tag!==7?(T=Zs(M,k.mode,V,ue),T.return=k,T):(T=u(T,M),T.return=k,T)}function G(k,T,M){if(typeof T=="string"&&T!==""||typeof T=="number"||typeof T=="bigint")return T=kc(""+T,k.mode,M),T.return=k,T;if(typeof T=="object"&&T!==null){switch(T.$$typeof){case S:return M=wl(T.type,T.key,T.props,null,k.mode,M),ii(M,T),M.return=k,M;case E:return T=Oc(T,k.mode,M),T.return=k,T;case Q:return T=an(T),G(k,T,M)}if($e(T)||ce(T))return T=Zs(T,k.mode,M,null),T.return=k,T;if(typeof T.then=="function")return G(k,Al(T),M);if(T.$$typeof===q)return G(k,jl(k,T),M);Cl(k,T)}return null}function U(k,T,M,V){var ue=T!==null?T.key:null;if(typeof M=="string"&&M!==""||typeof M=="number"||typeof M=="bigint")return ue!==null?null:b(k,T,""+M,V);if(typeof M=="object"&&M!==null){switch(M.$$typeof){case S:return M.key===ue?N(k,T,M,V):null;case E:return M.key===ue?z(k,T,M,V):null;case Q:return M=an(M),U(k,T,M,V)}if($e(M)||ce(M))return ue!==null?null:$(k,T,M,V,null);if(typeof M.then=="function")return U(k,T,Al(M),V);if(M.$$typeof===q)return U(k,T,jl(k,M),V);Cl(k,M)}return null}function L(k,T,M,V,ue){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return k=k.get(M)||null,b(T,k,""+V,ue);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case S:return k=k.get(V.key===null?M:V.key)||null,N(T,k,V,ue);case E:return k=k.get(V.key===null?M:V.key)||null,z(T,k,V,ue);case Q:return V=an(V),L(k,T,M,V,ue)}if($e(V)||ce(V))return k=k.get(M)||null,$(T,k,V,ue,null);if(typeof V.then=="function")return L(k,T,M,Al(V),ue);if(V.$$typeof===q)return L(k,T,M,jl(T,V),ue);Cl(T,V)}return null}function ae(k,T,M,V){for(var ue=null,Re=null,ie=T,xe=T=0,Ae=null;ie!==null&&xe<M.length;xe++){ie.index>xe?(Ae=ie,ie=null):Ae=ie.sibling;var De=U(k,ie,M[xe],V);if(De===null){ie===null&&(ie=Ae);break}e&&ie&&De.alternate===null&&t(k,ie),T=f(De,T,xe),Re===null?ue=De:Re.sibling=De,Re=De,ie=Ae}if(xe===M.length)return n(k,ie),ke&&$a(k,xe),ue;if(ie===null){for(;xe<M.length;xe++)ie=G(k,M[xe],V),ie!==null&&(T=f(ie,T,xe),Re===null?ue=ie:Re.sibling=ie,Re=ie);return ke&&$a(k,xe),ue}for(ie=i(ie);xe<M.length;xe++)Ae=L(ie,k,xe,M[xe],V),Ae!==null&&(e&&Ae.alternate!==null&&ie.delete(Ae.key===null?xe:Ae.key),T=f(Ae,T,xe),Re===null?ue=Ae:Re.sibling=Ae,Re=Ae);return e&&ie.forEach(function(Rs){return t(k,Rs)}),ke&&$a(k,xe),ue}function me(k,T,M,V){if(M==null)throw Error(l(151));for(var ue=null,Re=null,ie=T,xe=T=0,Ae=null,De=M.next();ie!==null&&!De.done;xe++,De=M.next()){ie.index>xe?(Ae=ie,ie=null):Ae=ie.sibling;var Rs=U(k,ie,De.value,V);if(Rs===null){ie===null&&(ie=Ae);break}e&&ie&&Rs.alternate===null&&t(k,ie),T=f(Rs,T,xe),Re===null?ue=Rs:Re.sibling=Rs,Re=Rs,ie=Ae}if(De.done)return n(k,ie),ke&&$a(k,xe),ue;if(ie===null){for(;!De.done;xe++,De=M.next())De=G(k,De.value,V),De!==null&&(T=f(De,T,xe),Re===null?ue=De:Re.sibling=De,Re=De);return ke&&$a(k,xe),ue}for(ie=i(ie);!De.done;xe++,De=M.next())De=L(ie,k,xe,De.value,V),De!==null&&(e&&De.alternate!==null&&ie.delete(De.key===null?xe:De.key),T=f(De,T,xe),Re===null?ue=De:Re.sibling=De,Re=De);return e&&ie.forEach(function(sx){return t(k,sx)}),ke&&$a(k,xe),ue}function Ie(k,T,M,V){if(typeof M=="object"&&M!==null&&M.type===j&&M.key===null&&(M=M.props.children),typeof M=="object"&&M!==null){switch(M.$$typeof){case S:e:{for(var ue=M.key;T!==null;){if(T.key===ue){if(ue=M.type,ue===j){if(T.tag===7){n(k,T.sibling),V=u(T,M.props.children),V.return=k,k=V;break e}}else if(T.elementType===ue||typeof ue=="object"&&ue!==null&&ue.$$typeof===Q&&an(ue)===T.type){n(k,T.sibling),V=u(T,M.props),ii(V,M),V.return=k,k=V;break e}n(k,T);break}else t(k,T);T=T.sibling}M.type===j?(V=Zs(M.props.children,k.mode,V,M.key),V.return=k,k=V):(V=wl(M.type,M.key,M.props,null,k.mode,V),ii(V,M),V.return=k,k=V)}return v(k);case E:e:{for(ue=M.key;T!==null;){if(T.key===ue)if(T.tag===4&&T.stateNode.containerInfo===M.containerInfo&&T.stateNode.implementation===M.implementation){n(k,T.sibling),V=u(T,M.children||[]),V.return=k,k=V;break e}else{n(k,T);break}else t(k,T);T=T.sibling}V=Oc(M,k.mode,V),V.return=k,k=V}return v(k);case Q:return M=an(M),Ie(k,T,M,V)}if($e(M))return ae(k,T,M,V);if(ce(M)){if(ue=ce(M),typeof ue!="function")throw Error(l(150));return M=ue.call(M),me(k,T,M,V)}if(typeof M.then=="function")return Ie(k,T,Al(M),V);if(M.$$typeof===q)return Ie(k,T,jl(k,M),V);Cl(k,M)}return typeof M=="string"&&M!==""||typeof M=="number"||typeof M=="bigint"?(M=""+M,T!==null&&T.tag===6?(n(k,T.sibling),V=u(T,M),V.return=k,k=V):(n(k,T),V=kc(M,k.mode,V),V.return=k,k=V),v(k)):n(k,T)}return function(k,T,M,V){try{ri=0;var ue=Ie(k,T,M,V);return Fn=null,ue}catch(ie){if(ie===Zn||ie===El)throw ie;var Re=Vt(29,ie,null,k.mode);return Re.lanes=V,Re.return=k,Re}}}var nn=Nh(!0),Eh=Nh(!1),ps=!1;function Ic(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Gc(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 gs(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ys(e,t,n){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=xl(e),ch(e,null,n),t}return bl(e,i,t,n),xl(e)}function li(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,ee(e,n)}}function Pc(e,t){var n=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var u=null,f=null;if(n=n.firstBaseUpdate,n!==null){do{var v={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};f===null?u=f=v:f=f.next=v,n=n.next}while(n!==null);f===null?u=f=t:f=f.next=t}else u=f=t;n={baseState:i.baseState,firstBaseUpdate:u,lastBaseUpdate:f,shared:i.shared,callbacks:i.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Kc=!1;function oi(){if(Kc){var e=Qn;if(e!==null)throw e}}function ci(e,t,n,i){Kc=!1;var u=e.updateQueue;ps=!1;var f=u.firstBaseUpdate,v=u.lastBaseUpdate,b=u.shared.pending;if(b!==null){u.shared.pending=null;var N=b,z=N.next;N.next=null,v===null?f=z:v.next=z,v=N;var $=e.alternate;$!==null&&($=$.updateQueue,b=$.lastBaseUpdate,b!==v&&(b===null?$.firstBaseUpdate=z:b.next=z,$.lastBaseUpdate=N))}if(f!==null){var G=u.baseState;v=0,$=z=N=null,b=f;do{var U=b.lane&-536870913,L=U!==b.lane;if(L?(Te&U)===U:(i&U)===U){U!==0&&U===Xn&&(Kc=!0),$!==null&&($=$.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var ae=e,me=b;U=t;var Ie=n;switch(me.tag){case 1:if(ae=me.payload,typeof ae=="function"){G=ae.call(Ie,G,U);break e}G=ae;break e;case 3:ae.flags=ae.flags&-65537|128;case 0:if(ae=me.payload,U=typeof ae=="function"?ae.call(Ie,G,U):ae,U==null)break e;G=w({},G,U);break e;case 2:ps=!0}}U=b.callback,U!==null&&(e.flags|=64,L&&(e.flags|=8192),L=u.callbacks,L===null?u.callbacks=[U]:L.push(U))}else L={lane:U,tag:b.tag,payload:b.payload,callback:b.callback,next:null},$===null?(z=$=L,N=G):$=$.next=L,v|=U;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=G),u.baseState=N,u.firstBaseUpdate=z,u.lastBaseUpdate=$,f===null&&(u.shared.lanes=0),_s|=v,e.lanes=v,e.memoizedState=G}}function Th(e,t){if(typeof e!="function")throw Error(l(191,e));e.call(t)}function Ah(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Th(n[e],t)}var Wn=A(null),kl=A(0);function Ch(e,t){e=Za,X(kl,e),X(Wn,t),Za=e|t.baseLanes}function Yc(){X(kl,Za),X(Wn,Wn.current)}function Jc(){Za=kl.current,I(Wn),I(kl)}var It=A(null),na=null;function vs(e){var t=e.alternate;X(tt,tt.current&1),X(It,e),na===null&&(t===null||Wn.current!==null||t.memoizedState!==null)&&(na=e)}function Xc(e){X(tt,tt.current),X(It,e),na===null&&(na=e)}function kh(e){e.tag===22?(X(tt,tt.current),X(It,e),na===null&&(na=e)):bs()}function bs(){X(tt,tt.current),X(It,It.current)}function Gt(e){I(It),na===e&&(na=null),I(tt)}var tt=A(0);function Ol(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||td(n)||ad(n)))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 Ia=0,be=null,He=null,rt=null,Rl=!1,er=!1,rn=!1,Dl=0,ui=0,tr=null,Y0=0;function Fe(){throw Error(l(321))}function Qc(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ht(e[n],t[n]))return!1;return!0}function Zc(e,t,n,i,u,f){return Ia=f,be=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,C.H=e===null||e.memoizedState===null?hm:fu,rn=!1,f=n(i,u),rn=!1,er&&(f=Rh(t,n,i,u)),Oh(e),f}function Oh(e){C.H=hi;var t=He!==null&&He.next!==null;if(Ia=0,rt=He=be=null,Rl=!1,ui=0,tr=null,t)throw Error(l(300));e===null||it||(e=e.dependencies,e!==null&&Sl(e)&&(it=!0))}function Rh(e,t,n,i){be=e;var u=0;do{if(er&&(tr=null),ui=0,er=!1,25<=u)throw Error(l(301));if(u+=1,rt=He=null,e.updateQueue!=null){var f=e.updateQueue;f.lastEffect=null,f.events=null,f.stores=null,f.memoCache!=null&&(f.memoCache.index=0)}C.H=mm,f=t(n,i)}while(er);return f}function J0(){var e=C.H,t=e.useState()[0];return t=typeof t.then=="function"?di(t):t,e=e.useState()[0],(He!==null?He.memoizedState:null)!==e&&(be.flags|=1024),t}function Fc(){var e=Dl!==0;return Dl=0,e}function Wc(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function eu(e){if(Rl){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Rl=!1}Ia=0,rt=He=be=null,er=!1,ui=Dl=0,tr=null}function Rt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return rt===null?be.memoizedState=rt=e:rt=rt.next=e,rt}function at(){if(He===null){var e=be.alternate;e=e!==null?e.memoizedState:null}else e=He.next;var t=rt===null?be.memoizedState:rt.next;if(t!==null)rt=t,He=e;else{if(e===null)throw be.alternate===null?Error(l(467)):Error(l(310));He=e,e={memoizedState:He.memoizedState,baseState:He.baseState,baseQueue:He.baseQueue,queue:He.queue,next:null},rt===null?be.memoizedState=rt=e:rt=rt.next=e}return rt}function Ml(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function di(e){var t=ui;return ui+=1,tr===null&&(tr=[]),e=_h(tr,e,t),t=be,(rt===null?t.memoizedState:rt.next)===null&&(t=t.alternate,C.H=t===null||t.memoizedState===null?hm:fu),e}function zl(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return di(e);if(e.$$typeof===q)return St(e)}throw Error(l(438,String(e)))}function tu(e){var t=null,n=be.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var i=be.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}),n===null&&(n=Ml(),be.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),i=0;i<e;i++)n[i]=qe;return t.index++,n}function Ga(e,t){return typeof t=="function"?t(e):t}function Ul(e){var t=at();return au(t,He,e)}function au(e,t,n){var i=e.queue;if(i===null)throw Error(l(311));i.lastRenderedReducer=n;var u=e.baseQueue,f=i.pending;if(f!==null){if(u!==null){var v=u.next;u.next=f.next,f.next=v}t.baseQueue=u=f,i.pending=null}if(f=e.baseState,u===null)e.memoizedState=f;else{t=u.next;var b=v=null,N=null,z=t,$=!1;do{var G=z.lane&-536870913;if(G!==z.lane?(Te&G)===G:(Ia&G)===G){var U=z.revertLane;if(U===0)N!==null&&(N=N.next={lane:0,revertLane:0,gesture:null,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null}),G===Xn&&($=!0);else if((Ia&U)===U){z=z.next,U===Xn&&($=!0);continue}else G={lane:0,revertLane:z.revertLane,gesture:null,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null},N===null?(b=N=G,v=f):N=N.next=G,be.lanes|=U,_s|=U;G=z.action,rn&&n(f,G),f=z.hasEagerState?z.eagerState:n(f,G)}else U={lane:G,revertLane:z.revertLane,gesture:z.gesture,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null},N===null?(b=N=U,v=f):N=N.next=U,be.lanes|=G,_s|=G;z=z.next}while(z!==null&&z!==t);if(N===null?v=f:N.next=b,!Ht(f,e.memoizedState)&&(it=!0,$&&(n=Qn,n!==null)))throw n;e.memoizedState=f,e.baseState=v,e.baseQueue=N,i.lastRenderedState=f}return u===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function su(e){var t=at(),n=t.queue;if(n===null)throw Error(l(311));n.lastRenderedReducer=e;var i=n.dispatch,u=n.pending,f=t.memoizedState;if(u!==null){n.pending=null;var v=u=u.next;do f=e(f,v.action),v=v.next;while(v!==u);Ht(f,t.memoizedState)||(it=!0),t.memoizedState=f,t.baseQueue===null&&(t.baseState=f),n.lastRenderedState=f}return[f,i]}function Dh(e,t,n){var i=be,u=at(),f=ke;if(f){if(n===void 0)throw Error(l(407));n=n()}else n=t();var v=!Ht((He||u).memoizedState,n);if(v&&(u.memoizedState=n,it=!0),u=u.queue,iu(Uh.bind(null,i,u,e),[e]),u.getSnapshot!==t||v||rt!==null&&rt.memoizedState.tag&1){if(i.flags|=2048,ar(9,{destroy:void 0},zh.bind(null,i,u,n,t),null),Ge===null)throw Error(l(349));f||(Ia&127)!==0||Mh(i,t,n)}return n}function Mh(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=be.updateQueue,t===null?(t=Ml(),be.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function zh(e,t,n,i){t.value=n,t.getSnapshot=i,Lh(t)&&Bh(e)}function Uh(e,t,n){return n(function(){Lh(t)&&Bh(e)})}function Lh(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ht(e,n)}catch{return!0}}function Bh(e){var t=Qs(e,2);t!==null&&qt(t,e,2)}function nu(e){var t=Rt();if(typeof e=="function"){var n=e;if(e=n(),rn){va(!0);try{n()}finally{va(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ga,lastRenderedState:e},t}function qh(e,t,n,i){return e.baseState=n,au(e,He,typeof i=="function"?i:Ga)}function X0(e,t,n,i,u){if(ql(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(v){f.listeners.push(v)}};C.T!==null?n(!0):f.isTransition=!1,i(f),n=t.pending,n===null?(f.next=t.pending=f,$h(t,f)):(f.next=n.next,t.pending=n.next=f)}}function $h(e,t){var n=t.action,i=t.payload,u=e.state;if(t.isTransition){var f=C.T,v={};C.T=v;try{var b=n(u,i),N=C.S;N!==null&&N(v,b),Hh(e,t,b)}catch(z){ru(e,t,z)}finally{f!==null&&v.types!==null&&(f.types=v.types),C.T=f}}else try{f=n(u,i),Hh(e,t,f)}catch(z){ru(e,t,z)}}function Hh(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(i){Vh(e,t,i)},function(i){return ru(e,t,i)}):Vh(e,t,n)}function Vh(e,t,n){t.status="fulfilled",t.value=n,Ih(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,$h(e,n)))}function ru(e,t,n){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=n,Ih(t),t=t.next;while(t!==i)}e.action=null}function Ih(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Gh(e,t){return t}function Ph(e,t){if(ke){var n=Ge.formState;if(n!==null){e:{var i=be;if(ke){if(Ye){t:{for(var u=Ye,f=sa;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){Ye=ra(u.nextSibling),i=u.data==="F!";break e}}hs(i)}i=!1}i&&(t=n[0])}}return n=Rt(),n.memoizedState=n.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gh,lastRenderedState:t},n.queue=i,n=um.bind(null,be,i),i.dispatch=n,i=nu(!1),f=du.bind(null,be,!1,i.queue),i=Rt(),u={state:t,dispatch:null,action:e,pending:null},i.queue=u,n=X0.bind(null,be,u,f,n),u.dispatch=n,i.memoizedState=e,[t,n,!1]}function Kh(e){var t=at();return Yh(t,He,e)}function Yh(e,t,n){if(t=au(e,t,Gh)[0],e=Ul(Ga)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=di(t)}catch(v){throw v===Zn?El:v}else i=t;t=at();var u=t.queue,f=u.dispatch;return n!==t.memoizedState&&(be.flags|=2048,ar(9,{destroy:void 0},Q0.bind(null,u,n),null)),[i,f,e]}function Q0(e,t){e.action=t}function Jh(e){var t=at(),n=He;if(n!==null)return Yh(t,n,e);at(),t=t.memoizedState,n=at();var i=n.queue.dispatch;return n.memoizedState=e,[t,i,!1]}function ar(e,t,n,i){return e={tag:e,create:n,deps:i,inst:t,next:null},t=be.updateQueue,t===null&&(t=Ml(),be.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(i=n.next,n.next=e,e.next=i,t.lastEffect=e),e}function Xh(){return at().memoizedState}function Ll(e,t,n,i){var u=Rt();be.flags|=e,u.memoizedState=ar(1|t,{destroy:void 0},n,i===void 0?null:i)}function Bl(e,t,n,i){var u=at();i=i===void 0?null:i;var f=u.memoizedState.inst;He!==null&&i!==null&&Qc(i,He.memoizedState.deps)?u.memoizedState=ar(t,f,n,i):(be.flags|=e,u.memoizedState=ar(1|t,f,n,i))}function Qh(e,t){Ll(8390656,8,e,t)}function iu(e,t){Bl(2048,8,e,t)}function Z0(e){be.flags|=4;var t=be.updateQueue;if(t===null)t=Ml(),be.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Zh(e){var t=at().memoizedState;return Z0({ref:t,nextImpl:e}),function(){if((ze&2)!==0)throw Error(l(440));return t.impl.apply(void 0,arguments)}}function Fh(e,t){return Bl(4,2,e,t)}function Wh(e,t){return Bl(4,4,e,t)}function em(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function tm(e,t,n){n=n!=null?n.concat([e]):null,Bl(4,4,em.bind(null,t,e),n)}function lu(){}function am(e,t){var n=at();t=t===void 0?null:t;var i=n.memoizedState;return t!==null&&Qc(t,i[1])?i[0]:(n.memoizedState=[e,t],e)}function sm(e,t){var n=at();t=t===void 0?null:t;var i=n.memoizedState;if(t!==null&&Qc(t,i[1]))return i[0];if(i=e(),rn){va(!0);try{e()}finally{va(!1)}}return n.memoizedState=[i,t],i}function ou(e,t,n){return n===void 0||(Ia&1073741824)!==0&&(Te&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=np(),be.lanes|=e,_s|=e,n)}function nm(e,t,n,i){return Ht(n,t)?n:Wn.current!==null?(e=ou(e,n,i),Ht(e,t)||(it=!0),e):(Ia&42)===0||(Ia&1073741824)!==0&&(Te&261930)===0?(it=!0,e.memoizedState=n):(e=np(),be.lanes|=e,_s|=e,t)}function rm(e,t,n,i,u){var f=J.p;J.p=f!==0&&8>f?f:8;var v=C.T,b={};C.T=b,du(e,!1,t,n);try{var N=u(),z=C.S;if(z!==null&&z(b,N),N!==null&&typeof N=="object"&&typeof N.then=="function"){var $=K0(N,i);fi(e,t,$,Yt(e))}else fi(e,t,i,Yt(e))}catch(G){fi(e,t,{then:function(){},status:"rejected",reason:G},Yt())}finally{J.p=f,v!==null&&b.types!==null&&(v.types=b.types),C.T=v}}function F0(){}function cu(e,t,n,i){if(e.tag!==5)throw Error(l(476));var u=im(e).queue;rm(e,u,t,K,n===null?F0:function(){return lm(e),n(i)})}function im(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:Ga,lastRenderedState:K},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ga,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function lm(e){var t=im(e);t.next===null&&(t=e.alternate.memoizedState),fi(e,t.next.queue,{},Yt())}function uu(){return St(Ci)}function om(){return at().memoizedState}function cm(){return at().memoizedState}function W0(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Yt();e=gs(n);var i=ys(t,e,n);i!==null&&(qt(i,t,n),li(i,t,n)),t={cache:qc()},e.payload=t;return}t=t.return}}function eb(e,t,n){var i=Yt();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},ql(e)?dm(t,n):(n=Ac(e,t,n,i),n!==null&&(qt(n,e,i),fm(n,t,i)))}function um(e,t,n){var i=Yt();fi(e,t,n,i)}function fi(e,t,n,i){var u={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(ql(e))dm(t,u);else{var f=e.alternate;if(e.lanes===0&&(f===null||f.lanes===0)&&(f=t.lastRenderedReducer,f!==null))try{var v=t.lastRenderedState,b=f(v,n);if(u.hasEagerState=!0,u.eagerState=b,Ht(b,v))return bl(e,t,u,0),Ge===null&&vl(),!1}catch{}if(n=Ac(e,t,u,i),n!==null)return qt(n,e,i),fm(n,t,i),!0}return!1}function du(e,t,n,i){if(i={lane:2,revertLane:Iu(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},ql(e)){if(t)throw Error(l(479))}else t=Ac(e,n,i,2),t!==null&&qt(t,e,2)}function ql(e){var t=e.alternate;return e===be||t!==null&&t===be}function dm(e,t){er=Rl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function fm(e,t,n){if((n&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,n|=i,t.lanes=n,ee(e,n)}}var hi={readContext:St,use:zl,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};hi.useEffectEvent=Fe;var hm={readContext:St,use:zl,useCallback:function(e,t){return Rt().memoizedState=[e,t===void 0?null:t],e},useContext:St,useEffect:Qh,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,Ll(4194308,4,em.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ll(4194308,4,e,t)},useInsertionEffect:function(e,t){Ll(4,2,e,t)},useMemo:function(e,t){var n=Rt();t=t===void 0?null:t;var i=e();if(rn){va(!0);try{e()}finally{va(!1)}}return n.memoizedState=[i,t],i},useReducer:function(e,t,n){var i=Rt();if(n!==void 0){var u=n(t);if(rn){va(!0);try{n(t)}finally{va(!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=eb.bind(null,be,e),[i.memoizedState,e]},useRef:function(e){var t=Rt();return e={current:e},t.memoizedState=e},useState:function(e){e=nu(e);var t=e.queue,n=um.bind(null,be,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:lu,useDeferredValue:function(e,t){var n=Rt();return ou(n,e,t)},useTransition:function(){var e=nu(!1);return e=rm.bind(null,be,e.queue,!0,!1),Rt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var i=be,u=Rt();if(ke){if(n===void 0)throw Error(l(407));n=n()}else{if(n=t(),Ge===null)throw Error(l(349));(Te&127)!==0||Mh(i,t,n)}u.memoizedState=n;var f={value:n,getSnapshot:t};return u.queue=f,Qh(Uh.bind(null,i,f,e),[e]),i.flags|=2048,ar(9,{destroy:void 0},zh.bind(null,i,f,n,t),null),n},useId:function(){var e=Rt(),t=Ge.identifierPrefix;if(ke){var n=wa,i=xa;n=(i&~(1<<32-Ot(i)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Dl++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=Y0++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:uu,useFormState:Ph,useActionState:Ph,useOptimistic:function(e){var t=Rt();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=du.bind(null,be,!0,n),n.dispatch=t,[e,t]},useMemoCache:tu,useCacheRefresh:function(){return Rt().memoizedState=W0.bind(null,be)},useEffectEvent:function(e){var t=Rt(),n={impl:e};return t.memoizedState=n,function(){if((ze&2)!==0)throw Error(l(440));return n.impl.apply(void 0,arguments)}}},fu={readContext:St,use:zl,useCallback:am,useContext:St,useEffect:iu,useImperativeHandle:tm,useInsertionEffect:Fh,useLayoutEffect:Wh,useMemo:sm,useReducer:Ul,useRef:Xh,useState:function(){return Ul(Ga)},useDebugValue:lu,useDeferredValue:function(e,t){var n=at();return nm(n,He.memoizedState,e,t)},useTransition:function(){var e=Ul(Ga)[0],t=at().memoizedState;return[typeof e=="boolean"?e:di(e),t]},useSyncExternalStore:Dh,useId:om,useHostTransitionStatus:uu,useFormState:Kh,useActionState:Kh,useOptimistic:function(e,t){var n=at();return qh(n,He,e,t)},useMemoCache:tu,useCacheRefresh:cm};fu.useEffectEvent=Zh;var mm={readContext:St,use:zl,useCallback:am,useContext:St,useEffect:iu,useImperativeHandle:tm,useInsertionEffect:Fh,useLayoutEffect:Wh,useMemo:sm,useReducer:su,useRef:Xh,useState:function(){return su(Ga)},useDebugValue:lu,useDeferredValue:function(e,t){var n=at();return He===null?ou(n,e,t):nm(n,He.memoizedState,e,t)},useTransition:function(){var e=su(Ga)[0],t=at().memoizedState;return[typeof e=="boolean"?e:di(e),t]},useSyncExternalStore:Dh,useId:om,useHostTransitionStatus:uu,useFormState:Jh,useActionState:Jh,useOptimistic:function(e,t){var n=at();return He!==null?qh(n,He,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:tu,useCacheRefresh:cm};mm.useEffectEvent=Zh;function hu(e,t,n,i){t=e.memoizedState,n=n(i,t),n=n==null?t:w({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var mu={enqueueSetState:function(e,t,n){e=e._reactInternals;var i=Yt(),u=gs(i);u.payload=t,n!=null&&(u.callback=n),t=ys(e,u,i),t!==null&&(qt(t,e,i),li(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var i=Yt(),u=gs(i);u.tag=1,u.payload=t,n!=null&&(u.callback=n),t=ys(e,u,i),t!==null&&(qt(t,e,i),li(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Yt(),i=gs(n);i.tag=2,t!=null&&(i.callback=t),t=ys(e,i,n),t!==null&&(qt(t,e,n),li(t,e,n))}};function pm(e,t,n,i,u,f,v){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,f,v):t.prototype&&t.prototype.isPureReactComponent?!Wr(n,i)||!Wr(u,f):!0}function gm(e,t,n,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,i),t.state!==e&&mu.enqueueReplaceState(t,t.state,null)}function ln(e,t){var n=t;if("ref"in t){n={};for(var i in t)i!=="ref"&&(n[i]=t[i])}if(e=e.defaultProps){n===t&&(n=w({},n));for(var u in e)n[u]===void 0&&(n[u]=e[u])}return n}function ym(e){yl(e)}function vm(e){console.error(e)}function bm(e){yl(e)}function $l(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function xm(e,t,n){try{var i=e.onCaughtError;i(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function pu(e,t,n){return n=gs(n),n.tag=3,n.payload={element:null},n.callback=function(){$l(e,t)},n}function wm(e){return e=gs(e),e.tag=3,e}function _m(e,t,n,i){var u=n.type.getDerivedStateFromError;if(typeof u=="function"){var f=i.value;e.payload=function(){return u(f)},e.callback=function(){xm(t,n,i)}}var v=n.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(e.callback=function(){xm(t,n,i),typeof u!="function"&&(Ss===null?Ss=new Set([this]):Ss.add(this));var b=i.stack;this.componentDidCatch(i.value,{componentStack:b!==null?b:""})})}function tb(e,t,n,i,u){if(n.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(t=n.alternate,t!==null&&Jn(t,n,u,!0),n=It.current,n!==null){switch(n.tag){case 31:case 13:return na===null?Fl():n.alternate===null&&We===0&&(We=3),n.flags&=-257,n.flags|=65536,n.lanes=u,i===Tl?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([i]):t.add(i),$u(e,i,u)),!1;case 22:return n.flags|=65536,i===Tl?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([i]):n.add(i)),$u(e,i,u)),!1}throw Error(l(435,n.tag))}return $u(e,i,u),Fl(),!1}if(ke)return t=It.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,i!==Mc&&(e=Error(l(422),{cause:i}),ai(ea(e,n)))):(i!==Mc&&(t=Error(l(423),{cause:i}),ai(ea(t,n))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,i=ea(i,n),u=pu(e.stateNode,i,u),Pc(e,u),We!==4&&(We=2)),!1;var f=Error(l(520),{cause:i});if(f=ea(f,n),wi===null?wi=[f]:wi.push(f),We!==4&&(We=2),t===null)return!0;i=ea(i,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=u&-u,n.lanes|=e,e=pu(n.stateNode,i,e),Pc(n,e),!1;case 1:if(t=n.type,f=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||f!==null&&typeof f.componentDidCatch=="function"&&(Ss===null||!Ss.has(f))))return n.flags|=65536,u&=-u,n.lanes|=u,u=wm(u),_m(u,e,n,i),Pc(n,u),!1}n=n.return}while(n!==null);return!1}var gu=Error(l(461)),it=!1;function jt(e,t,n,i){t.child=e===null?Eh(t,null,n,i):nn(t,e.child,n,i)}function Sm(e,t,n,i,u){n=n.render;var f=t.ref;if("ref"in i){var v={};for(var b in i)b!=="ref"&&(v[b]=i[b])}else v=i;return en(t),i=Zc(e,t,n,v,f,u),b=Fc(),e!==null&&!it?(Wc(e,t,u),Pa(e,t,u)):(ke&&b&&Rc(t),t.flags|=1,jt(e,t,i,u),t.child)}function jm(e,t,n,i,u){if(e===null){var f=n.type;return typeof f=="function"&&!Cc(f)&&f.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=f,Nm(e,t,f,i,u)):(e=wl(n.type,null,i,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(f=e.child,!ju(e,u)){var v=f.memoizedProps;if(n=n.compare,n=n!==null?n:Wr,n(v,i)&&e.ref===t.ref)return Pa(e,t,u)}return t.flags|=1,e=qa(f,i),e.ref=t.ref,e.return=t,t.child=e}function Nm(e,t,n,i,u){if(e!==null){var f=e.memoizedProps;if(Wr(f,i)&&e.ref===t.ref)if(it=!1,t.pendingProps=i=f,ju(e,u))(e.flags&131072)!==0&&(it=!0);else return t.lanes=e.lanes,Pa(e,t,u)}return yu(e,t,n,i,u)}function Em(e,t,n,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|n:n,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 Tm(e,t,f,n,i)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Nl(t,f!==null?f.cachePool:null),f!==null?Ch(t,f):Yc(),kh(t);else return i=t.lanes=536870912,Tm(e,t,f!==null?f.baseLanes|n:n,n,i)}else f!==null?(Nl(t,f.cachePool),Ch(t,f),bs(),t.memoizedState=null):(e!==null&&Nl(t,null),Yc(),bs());return jt(e,t,u,n),t.child}function mi(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Tm(e,t,n,i,u){var f=Hc();return f=f===null?null:{parent:nt._currentValue,pool:f},t.memoizedState={baseLanes:n,cachePool:f},e!==null&&Nl(t,null),Yc(),kh(t),e!==null&&Jn(e,t,i,!0),t.childLanes=u,null}function Hl(e,t){return t=Il({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Am(e,t,n){return nn(t,e.child,null,n),e=Hl(t,t.pendingProps),e.flags|=2,Gt(t),t.memoizedState=null,e}function ab(e,t,n){var i=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(ke){if(i.mode==="hidden")return e=Hl(t,i),t.lanes=536870912,mi(null,e);if(Xc(t),(e=Ye)?(e=$p(e,sa),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ds!==null?{id:xa,overflow:wa}:null,retryLane:536870912,hydrationErrors:null},n=dh(e),n.return=t,t.child=n,_t=t,Ye=null)):e=null,e===null)throw hs(t);return t.lanes=536870912,null}return Hl(t,i)}var f=e.memoizedState;if(f!==null){var v=f.dehydrated;if(Xc(t),u)if(t.flags&256)t.flags&=-257,t=Am(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(l(558));else if(it||Jn(e,t,n,!1),u=(n&e.childLanes)!==0,it||u){if(i=Ge,i!==null&&(v=Ce(i,n),v!==0&&v!==f.retryLane))throw f.retryLane=v,Qs(e,v),qt(i,e,v),gu;Fl(),t=Am(e,t,n)}else e=f.treeContext,Ye=ra(v.nextSibling),_t=t,ke=!0,fs=null,sa=!1,e!==null&&mh(t,e),t=Hl(t,i),t.flags|=4096;return t}return e=qa(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Vl(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(l(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function yu(e,t,n,i,u){return en(t),n=Zc(e,t,n,i,void 0,u),i=Fc(),e!==null&&!it?(Wc(e,t,u),Pa(e,t,u)):(ke&&i&&Rc(t),t.flags|=1,jt(e,t,n,u),t.child)}function Cm(e,t,n,i,u,f){return en(t),t.updateQueue=null,n=Rh(t,i,n,u),Oh(e),i=Fc(),e!==null&&!it?(Wc(e,t,f),Pa(e,t,f)):(ke&&i&&Rc(t),t.flags|=1,jt(e,t,n,f),t.child)}function km(e,t,n,i,u){if(en(t),t.stateNode===null){var f=Gn,v=n.contextType;typeof v=="object"&&v!==null&&(f=St(v)),f=new n(i,f),t.memoizedState=f.state!==null&&f.state!==void 0?f.state:null,f.updater=mu,t.stateNode=f,f._reactInternals=t,f=t.stateNode,f.props=i,f.state=t.memoizedState,f.refs={},Ic(t),v=n.contextType,f.context=typeof v=="object"&&v!==null?St(v):Gn,f.state=t.memoizedState,v=n.getDerivedStateFromProps,typeof v=="function"&&(hu(t,n,v,i),f.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof f.getSnapshotBeforeUpdate=="function"||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(v=f.state,typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount(),v!==f.state&&mu.enqueueReplaceState(f,f.state,null),ci(t,i,f,u),oi(),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=ln(n,b);f.props=N;var z=f.context,$=n.contextType;v=Gn,typeof $=="object"&&$!==null&&(v=St($));var G=n.getDerivedStateFromProps;$=typeof G=="function"||typeof f.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,$||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(b||z!==v)&&gm(t,f,i,v),ps=!1;var U=t.memoizedState;f.state=U,ci(t,i,f,u),oi(),z=t.memoizedState,b||U!==z||ps?(typeof G=="function"&&(hu(t,n,G,i),z=t.memoizedState),(N=ps||pm(t,n,N,i,U,z,v))?($||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=z),f.props=i,f.state=z,f.context=v,i=N):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{f=t.stateNode,Gc(e,t),v=t.memoizedProps,$=ln(n,v),f.props=$,G=t.pendingProps,U=f.context,z=n.contextType,N=Gn,typeof z=="object"&&z!==null&&(N=St(z)),b=n.getDerivedStateFromProps,(z=typeof b=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(v!==G||U!==N)&&gm(t,f,i,N),ps=!1,U=t.memoizedState,f.state=U,ci(t,i,f,u),oi();var L=t.memoizedState;v!==G||U!==L||ps||e!==null&&e.dependencies!==null&&Sl(e.dependencies)?(typeof b=="function"&&(hu(t,n,b,i),L=t.memoizedState),($=ps||pm(t,n,$,i,U,L,N)||e!==null&&e.dependencies!==null&&Sl(e.dependencies))?(z||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"||v===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&U===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"||v===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||v===e.memoizedProps&&U===e.memoizedState||(t.flags|=1024),i=!1)}return f=i,Vl(e,t),i=(t.flags&128)!==0,f||i?(f=t.stateNode,n=i&&typeof n.getDerivedStateFromError!="function"?null:f.render(),t.flags|=1,e!==null&&i?(t.child=nn(t,e.child,null,u),t.child=nn(t,null,n,u)):jt(e,t,n,u),t.memoizedState=f.state,e=t.child):e=Pa(e,t,u),e}function Om(e,t,n,i){return Fs(),t.flags|=256,jt(e,t,n,i),t.child}var vu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function bu(e){return{baseLanes:e,cachePool:xh()}}function xu(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=Kt),e}function Rm(e,t,n){var i=t.pendingProps,u=!1,f=(t.flags&128)!==0,v;if((v=f)||(v=e!==null&&e.memoizedState===null?!1:(tt.current&2)!==0),v&&(u=!0,t.flags&=-129),v=(t.flags&32)!==0,t.flags&=-33,e===null){if(ke){if(u?vs(t):bs(),(e=Ye)?(e=$p(e,sa),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ds!==null?{id:xa,overflow:wa}:null,retryLane:536870912,hydrationErrors:null},n=dh(e),n.return=t,t.child=n,_t=t,Ye=null)):e=null,e===null)throw hs(t);return ad(e)?t.lanes=32:t.lanes=536870912,null}var b=i.children;return i=i.fallback,u?(bs(),u=t.mode,b=Il({mode:"hidden",children:b},u),i=Zs(i,u,n,null),b.return=t,i.return=t,b.sibling=i,t.child=b,i=t.child,i.memoizedState=bu(n),i.childLanes=xu(e,v,n),t.memoizedState=vu,mi(null,i)):(vs(t),wu(t,b))}var N=e.memoizedState;if(N!==null&&(b=N.dehydrated,b!==null)){if(f)t.flags&256?(vs(t),t.flags&=-257,t=_u(e,t,n)):t.memoizedState!==null?(bs(),t.child=e.child,t.flags|=128,t=null):(bs(),b=i.fallback,u=t.mode,i=Il({mode:"visible",children:i.children},u),b=Zs(b,u,n,null),b.flags|=2,i.return=t,b.return=t,i.sibling=b,t.child=i,nn(t,e.child,null,n),i=t.child,i.memoizedState=bu(n),i.childLanes=xu(e,v,n),t.memoizedState=vu,t=mi(null,i));else if(vs(t),ad(b)){if(v=b.nextSibling&&b.nextSibling.dataset,v)var z=v.dgst;v=z,i=Error(l(419)),i.stack="",i.digest=v,ai({value:i,source:null,stack:null}),t=_u(e,t,n)}else if(it||Jn(e,t,n,!1),v=(n&e.childLanes)!==0,it||v){if(v=Ge,v!==null&&(i=Ce(v,n),i!==0&&i!==N.retryLane))throw N.retryLane=i,Qs(e,i),qt(v,e,i),gu;td(b)||Fl(),t=_u(e,t,n)}else td(b)?(t.flags|=192,t.child=e.child,t=null):(e=N.treeContext,Ye=ra(b.nextSibling),_t=t,ke=!0,fs=null,sa=!1,e!==null&&mh(t,e),t=wu(t,i.children),t.flags|=4096);return t}return u?(bs(),b=i.fallback,u=t.mode,N=e.child,z=N.sibling,i=qa(N,{mode:"hidden",children:i.children}),i.subtreeFlags=N.subtreeFlags&65011712,z!==null?b=qa(z,b):(b=Zs(b,u,n,null),b.flags|=2),b.return=t,i.return=t,i.sibling=b,t.child=i,mi(null,i),i=t.child,b=e.child.memoizedState,b===null?b=bu(n):(u=b.cachePool,u!==null?(N=nt._currentValue,u=u.parent!==N?{parent:N,pool:N}:u):u=xh(),b={baseLanes:b.baseLanes|n,cachePool:u}),i.memoizedState=b,i.childLanes=xu(e,v,n),t.memoizedState=vu,mi(e.child,i)):(vs(t),n=e.child,e=n.sibling,n=qa(n,{mode:"visible",children:i.children}),n.return=t,n.sibling=null,e!==null&&(v=t.deletions,v===null?(t.deletions=[e],t.flags|=16):v.push(e)),t.child=n,t.memoizedState=null,n)}function wu(e,t){return t=Il({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Il(e,t){return e=Vt(22,e,null,t),e.lanes=0,e}function _u(e,t,n){return nn(t,e.child,null,n),e=wu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Dm(e,t,n){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),Lc(e.return,t,n)}function Su(e,t,n,i,u,f){var v=e.memoizedState;v===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:n,tailMode:u,treeForkCount:f}:(v.isBackwards=t,v.rendering=null,v.renderingStartTime=0,v.last=i,v.tail=n,v.tailMode=u,v.treeForkCount=f)}function Mm(e,t,n){var i=t.pendingProps,u=i.revealOrder,f=i.tail;i=i.children;var v=tt.current,b=(v&2)!==0;if(b?(v=v&1|2,t.flags|=128):v&=1,X(tt,v),jt(e,t,i,n),i=ke?ti:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Dm(e,n,t);else if(e.tag===19)Dm(e,n,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(n=t.child,u=null;n!==null;)e=n.alternate,e!==null&&Ol(e)===null&&(u=n),n=n.sibling;n=u,n===null?(u=t.child,t.child=null):(u=n.sibling,n.sibling=null),Su(t,!1,u,n,f,i);break;case"backwards":case"unstable_legacy-backwards":for(n=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&Ol(e)===null){t.child=u;break}e=u.sibling,u.sibling=n,n=u,u=e}Su(t,!0,n,null,f,i);break;case"together":Su(t,!1,null,null,void 0,i);break;default:t.memoizedState=null}return t.child}function Pa(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),_s|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Jn(e,t,n,!1),(n&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,n=qa(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=qa(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function ju(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Sl(e)))}function sb(e,t,n){switch(t.tag){case 3:Pe(t,t.stateNode.containerInfo),ms(t,nt,e.memoizedState.cache),Fs();break;case 27:case 5:Ct(t);break;case 4:Pe(t,t.stateNode.containerInfo);break;case 10:ms(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Xc(t),null;break;case 13:var i=t.memoizedState;if(i!==null)return i.dehydrated!==null?(vs(t),t.flags|=128,null):(n&t.child.childLanes)!==0?Rm(e,t,n):(vs(t),e=Pa(e,t,n),e!==null?e.sibling:null);vs(t);break;case 19:var u=(e.flags&128)!==0;if(i=(n&t.childLanes)!==0,i||(Jn(e,t,n,!1),i=(n&t.childLanes)!==0),u){if(i)return Mm(e,t,n);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),X(tt,tt.current),i)break;return null;case 22:return t.lanes=0,Em(e,t,n,t.pendingProps);case 24:ms(t,nt,e.memoizedState.cache)}return Pa(e,t,n)}function zm(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)it=!0;else{if(!ju(e,n)&&(t.flags&128)===0)return it=!1,sb(e,t,n);it=(e.flags&131072)!==0}else it=!1,ke&&(t.flags&1048576)!==0&&hh(t,ti,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=an(t.elementType),t.type=e,typeof e=="function")Cc(e)?(i=ln(e,i),t.tag=1,t=km(null,t,e,i,n)):(t.tag=0,t=yu(null,t,e,i,n));else{if(e!=null){var u=e.$$typeof;if(u===P){t.tag=11,t=Sm(null,t,e,i,n);break e}else if(u===H){t.tag=14,t=jm(null,t,e,i,n);break e}}throw t=st(e)||e,Error(l(306,t,""))}}return t;case 0:return yu(e,t,t.type,t.pendingProps,n);case 1:return i=t.type,u=ln(i,t.pendingProps),km(e,t,i,u,n);case 3:e:{if(Pe(t,t.stateNode.containerInfo),e===null)throw Error(l(387));i=t.pendingProps;var f=t.memoizedState;u=f.element,Gc(e,t),ci(t,i,null,n);var v=t.memoizedState;if(i=v.cache,ms(t,nt,i),i!==f.cache&&Bc(t,[nt],n,!0),oi(),i=v.element,f.isDehydrated)if(f={element:i,isDehydrated:!1,cache:v.cache},t.updateQueue.baseState=f,t.memoizedState=f,t.flags&256){t=Om(e,t,i,n);break e}else if(i!==u){u=ea(Error(l(424)),t),ai(u),t=Om(e,t,i,n);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Ye=ra(e.firstChild),_t=t,ke=!0,fs=null,sa=!0,n=Eh(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Fs(),i===u){t=Pa(e,t,n);break e}jt(e,t,i,n)}t=t.child}return t;case 26:return Vl(e,t),e===null?(n=Kp(t.type,null,t.pendingProps,null))?t.memoizedState=n:ke||(n=t.type,e=t.pendingProps,i=ro(ye.current).createElement(n),i[ut]=t,i[Dt]=e,Nt(i,n,e),vt(i),t.stateNode=i):t.memoizedState=Kp(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ct(t),e===null&&ke&&(i=t.stateNode=Ip(t.type,t.pendingProps,ye.current),_t=t,sa=!0,u=Ye,Ts(t.type)?(sd=u,Ye=ra(i.firstChild)):Ye=u),jt(e,t,t.pendingProps.children,n),Vl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ke&&((u=i=Ye)&&(i=Db(i,t.type,t.pendingProps,sa),i!==null?(t.stateNode=i,_t=t,Ye=ra(i.firstChild),sa=!1,u=!0):u=!1),u||hs(t)),Ct(t),u=t.type,f=t.pendingProps,v=e!==null?e.memoizedProps:null,i=f.children,Fu(u,f)?i=null:v!==null&&Fu(u,v)&&(t.flags|=32),t.memoizedState!==null&&(u=Zc(e,t,J0,null,null,n),Ci._currentValue=u),Vl(e,t),jt(e,t,i,n),t.child;case 6:return e===null&&ke&&((e=n=Ye)&&(n=Mb(n,t.pendingProps,sa),n!==null?(t.stateNode=n,_t=t,Ye=null,e=!0):e=!1),e||hs(t)),null;case 13:return Rm(e,t,n);case 4:return Pe(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=nn(t,null,i,n):jt(e,t,i,n),t.child;case 11:return Sm(e,t,t.type,t.pendingProps,n);case 7:return jt(e,t,t.pendingProps,n),t.child;case 8:return jt(e,t,t.pendingProps.children,n),t.child;case 12:return jt(e,t,t.pendingProps.children,n),t.child;case 10:return i=t.pendingProps,ms(t,t.type,i.value),jt(e,t,i.children,n),t.child;case 9:return u=t.type._context,i=t.pendingProps.children,en(t),u=St(u),i=i(u),t.flags|=1,jt(e,t,i,n),t.child;case 14:return jm(e,t,t.type,t.pendingProps,n);case 15:return Nm(e,t,t.type,t.pendingProps,n);case 19:return Mm(e,t,n);case 31:return ab(e,t,n);case 22:return Em(e,t,n,t.pendingProps);case 24:return en(t),i=St(nt),e===null?(u=Hc(),u===null&&(u=Ge,f=qc(),u.pooledCache=f,f.refCount++,f!==null&&(u.pooledCacheLanes|=n),u=f),t.memoizedState={parent:i,cache:u},Ic(t),ms(t,nt,u)):((e.lanes&n)!==0&&(Gc(e,t),ci(t,null,null,n),oi()),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),ms(t,nt,i)):(i=f.cache,ms(t,nt,i),i!==u.cache&&Bc(t,[nt],n,!0))),jt(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(l(156,t.tag))}function Ka(e){e.flags|=4}function Nu(e,t,n,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(op())e.flags|=8192;else throw sn=Tl,Vc}else e.flags&=-16777217}function Um(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Zp(t))if(op())e.flags|=8192;else throw sn=Tl,Vc}function Gl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?il():536870912,e.lanes|=t,ir|=t)}function pi(e,t){if(!ke)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function Je(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,i=0;if(t)for(var u=e.child;u!==null;)n|=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;)n|=u.lanes|u.childLanes,i|=u.subtreeFlags,i|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=i,e.childLanes=n,t}function nb(e,t,n){var i=t.pendingProps;switch(Dc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Je(t),null;case 1:return Je(t),null;case 3:return n=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),Va(nt),Ue(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Yn(t)?Ka(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,zc())),Je(t),null;case 26:var u=t.type,f=t.memoizedState;return e===null?(Ka(t),f!==null?(Je(t),Um(t,f)):(Je(t),Nu(t,u,null,i,n))):f?f!==e.memoizedState?(Ka(t),Je(t),Um(t,f)):(Je(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&Ka(t),Je(t),Nu(t,u,e,i,n)),null;case 27:if(pt(t),n=ye.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&Ka(t);else{if(!i){if(t.stateNode===null)throw Error(l(166));return Je(t),null}e=F.current,Yn(t)?ph(t):(e=Ip(u,i,n),t.stateNode=e,Ka(t))}return Je(t),null;case 5:if(pt(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&Ka(t);else{if(!i){if(t.stateNode===null)throw Error(l(166));return Je(t),null}if(f=F.current,Yn(t))ph(t);else{var v=ro(ye.current);switch(f){case 1:f=v.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:f=v.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":f=v.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":f=v.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":f=v.createElement("div"),f.innerHTML="<script><\/script>",f=f.removeChild(f.firstChild);break;case"select":f=typeof i.is=="string"?v.createElement("select",{is:i.is}):v.createElement("select"),i.multiple?f.multiple=!0:i.size&&(f.size=i.size);break;default:f=typeof i.is=="string"?v.createElement(u,{is:i.is}):v.createElement(u)}}f[ut]=t,f[Dt]=i;e:for(v=t.child;v!==null;){if(v.tag===5||v.tag===6)f.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===t)break e;for(;v.sibling===null;){if(v.return===null||v.return===t)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}t.stateNode=f;e:switch(Nt(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&&Ka(t)}}return Je(t),Nu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&Ka(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(l(166));if(e=ye.current,Yn(t)){if(e=t.stateNode,n=t.memoizedProps,i=null,u=_t,u!==null)switch(u.tag){case 27:case 5:i=u.memoizedProps}e[ut]=t,e=!!(e.nodeValue===n||i!==null&&i.suppressHydrationWarning===!0||Rp(e.nodeValue,n)),e||hs(t,!0)}else e=ro(e).createTextNode(i),e[ut]=t,t.stateNode=e}return Je(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(i=Yn(t),n!==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[ut]=t}else Fs(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Je(t),e=!1}else n=zc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Gt(t),t):(Gt(t),null);if((t.flags&128)!==0)throw Error(l(558))}return Je(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=Yn(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[ut]=t}else Fs(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Je(t),u=!1}else u=zc(),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=n,t):(n=i!==null,e=e!==null&&e.memoizedState!==null,n&&(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)),n!==e&&n&&(t.child.flags|=8192),Gl(t,t.updateQueue),Je(t),null);case 4:return Ue(),e===null&&Yu(t.stateNode.containerInfo),Je(t),null;case 10:return Va(t.type),Je(t),null;case 19:if(I(tt),i=t.memoizedState,i===null)return Je(t),null;if(u=(t.flags&128)!==0,f=i.rendering,f===null)if(u)pi(i,!1);else{if(We!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(f=Ol(e),f!==null){for(t.flags|=128,pi(i,!1),e=f.updateQueue,t.updateQueue=e,Gl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)uh(n,e),n=n.sibling;return X(tt,tt.current&1|2),ke&&$a(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&gt()>Xl&&(t.flags|=128,u=!0,pi(i,!1),t.lanes=4194304)}else{if(!u)if(e=Ol(f),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,Gl(t,e),pi(i,!0),i.tail===null&&i.tailMode==="hidden"&&!f.alternate&&!ke)return Je(t),null}else 2*gt()-i.renderingStartTime>Xl&&n!==536870912&&(t.flags|=128,u=!0,pi(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=gt(),e.sibling=null,n=tt.current,X(tt,u?n&1|2:n&1),ke&&$a(t,i.treeForkCount),e):(Je(t),null);case 22:case 23:return Gt(t),Jc(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(n&536870912)!==0&&(t.flags&128)===0&&(Je(t),t.subtreeFlags&6&&(t.flags|=8192)):Je(t),n=t.updateQueue,n!==null&&Gl(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==n&&(t.flags|=2048),e!==null&&I(tn),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Va(nt),Je(t),null;case 25:return null;case 30:return null}throw Error(l(156,t.tag))}function rb(e,t){switch(Dc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Va(nt),Ue(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return pt(t),null;case 31:if(t.memoizedState!==null){if(Gt(t),t.alternate===null)throw Error(l(340));Fs()}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));Fs()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return I(tt),null;case 4:return Ue(),null;case 10:return Va(t.type),null;case 22:case 23:return Gt(t),Jc(),e!==null&&I(tn),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Va(nt),null;case 25:return null;default:return null}}function Lm(e,t){switch(Dc(t),t.tag){case 3:Va(nt),Ue();break;case 26:case 27:case 5:pt(t);break;case 4:Ue();break;case 31:t.memoizedState!==null&&Gt(t);break;case 13:Gt(t);break;case 19:I(tt);break;case 10:Va(t.type);break;case 22:case 23:Gt(t),Jc(),e!==null&&I(tn);break;case 24:Va(nt)}}function gi(e,t){try{var n=t.updateQueue,i=n!==null?n.lastEffect:null;if(i!==null){var u=i.next;n=u;do{if((n.tag&e)===e){i=void 0;var f=n.create,v=n.inst;i=f(),v.destroy=i}n=n.next}while(n!==u)}}catch(b){Be(t,t.return,b)}}function xs(e,t,n){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 v=i.inst,b=v.destroy;if(b!==void 0){v.destroy=void 0,u=t;var N=n,z=b;try{z()}catch($){Be(u,N,$)}}}i=i.next}while(i!==f)}}catch($){Be(t,t.return,$)}}function Bm(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ah(t,n)}catch(i){Be(e,e.return,i)}}}function qm(e,t,n){n.props=ln(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(i){Be(e,t,i)}}function yi(e,t){try{var n=e.ref;if(n!==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 n=="function"?e.refCleanup=n(i):n.current=i}}catch(u){Be(e,t,u)}}function _a(e,t){var n=e.ref,i=e.refCleanup;if(n!==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 n=="function")try{n(null)}catch(u){Be(e,t,u)}else n.current=null}function $m(e){var t=e.type,n=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&i.focus();break e;case"img":n.src?i.src=n.src:n.srcSet&&(i.srcset=n.srcSet)}}catch(u){Be(e,e.return,u)}}function Eu(e,t,n){try{var i=e.stateNode;Tb(i,e.type,n,t),i[Dt]=t}catch(u){Be(e,e.return,u)}}function Hm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ts(e.type)||e.tag===4}function Tu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Hm(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&&Ts(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 Au(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=La));else if(i!==4&&(i===27&&Ts(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Au(e,t,n),e=e.sibling;e!==null;)Au(e,t,n),e=e.sibling}function Pl(e,t,n){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(i!==4&&(i===27&&Ts(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Pl(e,t,n),e=e.sibling;e!==null;)Pl(e,t,n),e=e.sibling}function Vm(e){var t=e.stateNode,n=e.memoizedProps;try{for(var i=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);Nt(t,i,n),t[ut]=e,t[Dt]=n}catch(f){Be(e,e.return,f)}}var Ya=!1,lt=!1,Cu=!1,Im=typeof WeakSet=="function"?WeakSet:Set,bt=null;function ib(e,t){if(e=e.containerInfo,Qu=ho,e=th(e),_c(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var u=i.anchorOffset,f=i.focusNode;i=i.focusOffset;try{n.nodeType,f.nodeType}catch{n=null;break e}var v=0,b=-1,N=-1,z=0,$=0,G=e,U=null;t:for(;;){for(var L;G!==n||u!==0&&G.nodeType!==3||(b=v+u),G!==f||i!==0&&G.nodeType!==3||(N=v+i),G.nodeType===3&&(v+=G.nodeValue.length),(L=G.firstChild)!==null;)U=G,G=L;for(;;){if(G===e)break t;if(U===n&&++z===u&&(b=v),U===f&&++$===i&&(N=v),(L=G.nextSibling)!==null)break;G=U,U=G.parentNode}G=L}n=b===-1||N===-1?null:{start:b,end:N}}else n=null}n=n||{start:0,end:0}}else n=null;for(Zu={focusedElem:e,selectionRange:n},ho=!1,bt=t;bt!==null;)if(t=bt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,bt=e;else for(;bt!==null;){switch(t=bt,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(n=0;n<e.length;n++)u=e[n],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&f!==null){e=void 0,n=t,u=f.memoizedProps,f=f.memoizedState,i=n.stateNode;try{var ae=ln(n.type,u);e=i.getSnapshotBeforeUpdate(ae,f),i.__reactInternalSnapshotBeforeUpdate=e}catch(me){Be(n,n.return,me)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)ed(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":ed(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,bt=e;break}bt=t.return}}function Gm(e,t,n){var i=n.flags;switch(n.tag){case 0:case 11:case 15:Xa(e,n),i&4&&gi(5,n);break;case 1:if(Xa(e,n),i&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(v){Be(n,n.return,v)}else{var u=ln(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(v){Be(n,n.return,v)}}i&64&&Bm(n),i&512&&yi(n,n.return);break;case 3:if(Xa(e,n),i&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Ah(e,t)}catch(v){Be(n,n.return,v)}}break;case 27:t===null&&i&4&&Vm(n);case 26:case 5:Xa(e,n),t===null&&i&4&&$m(n),i&512&&yi(n,n.return);break;case 12:Xa(e,n);break;case 31:Xa(e,n),i&4&&Ym(e,n);break;case 13:Xa(e,n),i&4&&Jm(e,n),i&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=pb.bind(null,n),zb(e,n))));break;case 22:if(i=n.memoizedState!==null||Ya,!i){t=t!==null&&t.memoizedState!==null||lt,u=Ya;var f=lt;Ya=i,(lt=t)&&!f?Qa(e,n,(n.subtreeFlags&8772)!==0):Xa(e,n),Ya=u,lt=f}break;case 30:break;default:Xa(e,n)}}function Pm(e){var t=e.alternate;t!==null&&(e.alternate=null,Pm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&rc(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 Ja(e,t,n){for(n=n.child;n!==null;)Km(e,t,n),n=n.sibling}function Km(e,t,n){if(wt&&typeof wt.onCommitFiberUnmount=="function")try{wt.onCommitFiberUnmount(Hs,n)}catch{}switch(n.tag){case 26:lt||_a(n,t),Ja(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:lt||_a(n,t);var i=Xe,u=zt;Ts(n.type)&&(Xe=n.stateNode,zt=!1),Ja(e,t,n),Ei(n.stateNode),Xe=i,zt=u;break;case 5:lt||_a(n,t);case 6:if(i=Xe,u=zt,Xe=null,Ja(e,t,n),Xe=i,zt=u,Xe!==null)if(zt)try{(Xe.nodeType===9?Xe.body:Xe.nodeName==="HTML"?Xe.ownerDocument.body:Xe).removeChild(n.stateNode)}catch(f){Be(n,t,f)}else try{Xe.removeChild(n.stateNode)}catch(f){Be(n,t,f)}break;case 18:Xe!==null&&(zt?(e=Xe,Bp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),mr(e)):Bp(Xe,n.stateNode));break;case 4:i=Xe,u=zt,Xe=n.stateNode.containerInfo,zt=!0,Ja(e,t,n),Xe=i,zt=u;break;case 0:case 11:case 14:case 15:xs(2,n,t),lt||xs(4,n,t),Ja(e,t,n);break;case 1:lt||(_a(n,t),i=n.stateNode,typeof i.componentWillUnmount=="function"&&qm(n,t,i)),Ja(e,t,n);break;case 21:Ja(e,t,n);break;case 22:lt=(i=lt)||n.memoizedState!==null,Ja(e,t,n),lt=i;break;default:Ja(e,t,n)}}function Ym(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{mr(e)}catch(n){Be(t,t.return,n)}}}function Jm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{mr(e)}catch(n){Be(t,t.return,n)}}function lb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Im),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Im),t;default:throw Error(l(435,e.tag))}}function Kl(e,t){var n=lb(e);t.forEach(function(i){if(!n.has(i)){n.add(i);var u=gb.bind(null,e,i);i.then(u,u)}})}function Ut(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var u=n[i],f=e,v=t,b=v;e:for(;b!==null;){switch(b.tag){case 27:if(Ts(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));Km(f,v,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;)Xm(t,e),t=t.sibling}var ca=null;function Xm(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ut(t,e),Lt(e),i&4&&(xs(3,e,e.return),gi(3,e),xs(5,e,e.return));break;case 1:Ut(t,e),Lt(e),i&512&&(lt||n===null||_a(n,n.return)),i&64&&Ya&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?i:n.concat(i))));break;case 26:var u=ca;if(Ut(t,e),Lt(e),i&512&&(lt||n===null||_a(n,n.return)),i&4){var f=n!==null?n.memoizedState:null;if(i=e.memoizedState,n===null)if(i===null)if(e.stateNode===null){e:{i=e.type,n=e.memoizedProps,u=u.ownerDocument||u;t:switch(i){case"title":f=u.getElementsByTagName("title")[0],(!f||f[Gr]||f[ut]||f.namespaceURI==="http://www.w3.org/2000/svg"||f.hasAttribute("itemprop"))&&(f=u.createElement(i),u.head.insertBefore(f,u.querySelector("head > title"))),Nt(f,i,n),f[ut]=e,vt(f),i=f;break e;case"link":var v=Xp("link","href",u).get(i+(n.href||""));if(v){for(var b=0;b<v.length;b++)if(f=v[b],f.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&f.getAttribute("rel")===(n.rel==null?null:n.rel)&&f.getAttribute("title")===(n.title==null?null:n.title)&&f.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){v.splice(b,1);break t}}f=u.createElement(i),Nt(f,i,n),u.head.appendChild(f);break;case"meta":if(v=Xp("meta","content",u).get(i+(n.content||""))){for(b=0;b<v.length;b++)if(f=v[b],f.getAttribute("content")===(n.content==null?null:""+n.content)&&f.getAttribute("name")===(n.name==null?null:n.name)&&f.getAttribute("property")===(n.property==null?null:n.property)&&f.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&f.getAttribute("charset")===(n.charSet==null?null:n.charSet)){v.splice(b,1);break t}}f=u.createElement(i),Nt(f,i,n),u.head.appendChild(f);break;default:throw Error(l(468,i))}f[ut]=e,vt(f),i=f}e.stateNode=i}else Qp(u,e.type,e.stateNode);else e.stateNode=Jp(u,i,e.memoizedProps);else f!==i?(f===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):f.count--,i===null?Qp(u,e.type,e.stateNode):Jp(u,i,e.memoizedProps)):i===null&&e.stateNode!==null&&Eu(e,e.memoizedProps,n.memoizedProps)}break;case 27:Ut(t,e),Lt(e),i&512&&(lt||n===null||_a(n,n.return)),n!==null&&i&4&&Eu(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Ut(t,e),Lt(e),i&512&&(lt||n===null||_a(n,n.return)),e.flags&32){u=e.stateNode;try{Ln(u,"")}catch(ae){Be(e,e.return,ae)}}i&4&&e.stateNode!=null&&(u=e.memoizedProps,Eu(e,u,n!==null?n.memoizedProps:u)),i&1024&&(Cu=!0);break;case 6:if(Ut(t,e),Lt(e),i&4){if(e.stateNode===null)throw Error(l(162));i=e.memoizedProps,n=e.stateNode;try{n.nodeValue=i}catch(ae){Be(e,e.return,ae)}}break;case 3:if(oo=null,u=ca,ca=io(t.containerInfo),Ut(t,e),ca=u,Lt(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{mr(t.containerInfo)}catch(ae){Be(e,e.return,ae)}Cu&&(Cu=!1,Qm(e));break;case 4:i=ca,ca=io(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,Kl(e,i)));break;case 13:Ut(t,e),Lt(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Jl=gt()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Kl(e,i)));break;case 22:u=e.memoizedState!==null;var N=n!==null&&n.memoizedState!==null,z=Ya,$=lt;if(Ya=z||u,lt=$||N,Ut(t,e),lt=$,Ya=z,Lt(e),i&8192)e:for(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,u&&(n===null||N||Ya||lt||on(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){N=n=t;try{if(f=N.stateNode,u)v=f.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{b=N.stateNode;var G=N.memoizedProps.style,U=G!=null&&G.hasOwnProperty("display")?G.display:null;b.style.display=U==null||typeof U=="boolean"?"":(""+U).trim()}}catch(ae){Be(N,N.return,ae)}}}else if(t.tag===6){if(n===null){N=t;try{N.stateNode.nodeValue=u?"":N.memoizedProps}catch(ae){Be(N,N.return,ae)}}}else if(t.tag===18){if(n===null){N=t;try{var L=N.stateNode;u?qp(L,!0):qp(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;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}i&4&&(i=e.updateQueue,i!==null&&(n=i.retryQueue,n!==null&&(i.retryQueue=null,Kl(e,n))));break;case 19:Ut(t,e),Lt(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Kl(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 n,i=e.return;i!==null;){if(Hm(i)){n=i;break}i=i.return}if(n==null)throw Error(l(160));switch(n.tag){case 27:var u=n.stateNode,f=Tu(e);Pl(e,f,u);break;case 5:var v=n.stateNode;n.flags&32&&(Ln(v,""),n.flags&=-33);var b=Tu(e);Pl(e,b,v);break;case 3:case 4:var N=n.stateNode.containerInfo,z=Tu(e);Au(e,z,N);break;default:throw Error(l(161))}}catch($){Be(e,e.return,$)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Qm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Qm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Xa(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Gm(e,t.alternate,t),t=t.sibling}function on(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:xs(4,t,t.return),on(t);break;case 1:_a(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&qm(t,t.return,n),on(t);break;case 27:Ei(t.stateNode);case 26:case 5:_a(t,t.return),on(t);break;case 22:t.memoizedState===null&&on(t);break;case 30:on(t);break;default:on(t)}e=e.sibling}}function Qa(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var i=t.alternate,u=e,f=t,v=f.flags;switch(f.tag){case 0:case 11:case 15:Qa(u,f,n),gi(4,f);break;case 1:if(Qa(u,f,n),i=f,u=i.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(z){Be(i,i.return,z)}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++)Th(N[u],b)}catch(z){Be(i,i.return,z)}}n&&v&64&&Bm(f),yi(f,f.return);break;case 27:Vm(f);case 26:case 5:Qa(u,f,n),n&&i===null&&v&4&&$m(f),yi(f,f.return);break;case 12:Qa(u,f,n);break;case 31:Qa(u,f,n),n&&v&4&&Ym(u,f);break;case 13:Qa(u,f,n),n&&v&4&&Jm(u,f);break;case 22:f.memoizedState===null&&Qa(u,f,n),yi(f,f.return);break;case 30:break;default:Qa(u,f,n)}t=t.sibling}}function ku(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&si(n))}function Ou(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&si(e))}function ua(e,t,n,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Zm(e,t,n,i),t=t.sibling}function Zm(e,t,n,i){var u=t.flags;switch(t.tag){case 0:case 11:case 15:ua(e,t,n,i),u&2048&&gi(9,t);break;case 1:ua(e,t,n,i);break;case 3:ua(e,t,n,i),u&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&si(e)));break;case 12:if(u&2048){ua(e,t,n,i),e=t.stateNode;try{var f=t.memoizedProps,v=f.id,b=f.onPostCommit;typeof b=="function"&&b(v,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(N){Be(t,t.return,N)}}else ua(e,t,n,i);break;case 31:ua(e,t,n,i);break;case 13:ua(e,t,n,i);break;case 23:break;case 22:f=t.stateNode,v=t.alternate,t.memoizedState!==null?f._visibility&2?ua(e,t,n,i):vi(e,t):f._visibility&2?ua(e,t,n,i):(f._visibility|=2,sr(e,t,n,i,(t.subtreeFlags&10256)!==0||!1)),u&2048&&ku(v,t);break;case 24:ua(e,t,n,i),u&2048&&Ou(t.alternate,t);break;default:ua(e,t,n,i)}}function sr(e,t,n,i,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var f=e,v=t,b=n,N=i,z=v.flags;switch(v.tag){case 0:case 11:case 15:sr(f,v,b,N,u),gi(8,v);break;case 23:break;case 22:var $=v.stateNode;v.memoizedState!==null?$._visibility&2?sr(f,v,b,N,u):vi(f,v):($._visibility|=2,sr(f,v,b,N,u)),u&&z&2048&&ku(v.alternate,v);break;case 24:sr(f,v,b,N,u),u&&z&2048&&Ou(v.alternate,v);break;default:sr(f,v,b,N,u)}t=t.sibling}}function vi(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,i=t,u=i.flags;switch(i.tag){case 22:vi(n,i),u&2048&&ku(i.alternate,i);break;case 24:vi(n,i),u&2048&&Ou(i.alternate,i);break;default:vi(n,i)}t=t.sibling}}var bi=8192;function nr(e,t,n){if(e.subtreeFlags&bi)for(e=e.child;e!==null;)Fm(e,t,n),e=e.sibling}function Fm(e,t,n){switch(e.tag){case 26:nr(e,t,n),e.flags&bi&&e.memoizedState!==null&&Yb(n,ca,e.memoizedState,e.memoizedProps);break;case 5:nr(e,t,n);break;case 3:case 4:var i=ca;ca=io(e.stateNode.containerInfo),nr(e,t,n),ca=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=bi,bi=16777216,nr(e,t,n),bi=i):nr(e,t,n));break;default:nr(e,t,n)}}function Wm(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 xi(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var i=t[n];bt=i,tp(i,e)}Wm(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)ep(e),e=e.sibling}function ep(e){switch(e.tag){case 0:case 11:case 15:xi(e),e.flags&2048&&xs(9,e,e.return);break;case 3:xi(e);break;case 12:xi(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Yl(e)):xi(e);break;default:xi(e)}}function Yl(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var i=t[n];bt=i,tp(i,e)}Wm(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:xs(8,t,t.return),Yl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Yl(t));break;default:Yl(t)}e=e.sibling}}function tp(e,t){for(;bt!==null;){var n=bt;switch(n.tag){case 0:case 11:case 15:xs(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var i=n.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:si(n.memoizedState.cache)}if(i=n.child,i!==null)i.return=n,bt=i;else e:for(n=e;bt!==null;){i=bt;var u=i.sibling,f=i.return;if(Pm(i),i===n){bt=null;break e}if(u!==null){u.return=f,bt=u;break e}bt=f}}}var ob={getCacheForType:function(e){var t=St(nt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return St(nt).controller.signal}},cb=typeof WeakMap=="function"?WeakMap:Map,ze=0,Ge=null,Ne=null,Te=0,Le=0,Pt=null,ws=!1,rr=!1,Ru=!1,Za=0,We=0,_s=0,cn=0,Du=0,Kt=0,ir=0,wi=null,Bt=null,Mu=!1,Jl=0,ap=0,Xl=1/0,Ql=null,Ss=null,dt=0,js=null,lr=null,Fa=0,zu=0,Uu=null,sp=null,_i=0,Lu=null;function Yt(){return(ze&2)!==0&&Te!==0?Te&-Te:C.T!==null?Iu():Gs()}function np(){if(Kt===0)if((Te&536870912)===0||ke){var e=An;An<<=1,(An&3932160)===0&&(An=262144),Kt=e}else Kt=536870912;return e=It.current,e!==null&&(e.flags|=32),Kt}function qt(e,t,n){(e===Ge&&(Le===2||Le===9)||e.cancelPendingCommit!==null)&&(or(e,0),Ns(e,Te,Kt,!1)),Vs(e,n),((ze&2)===0||e!==Ge)&&(e===Ge&&((ze&2)===0&&(cn|=n),We===4&&Ns(e,Te,Kt,!1)),Sa(e))}function rp(e,t,n){if((ze&6)!==0)throw Error(l(327));var i=!n&&(t&127)===0&&(t&e.expiredLanes)===0||cs(e,t),u=i?fb(e,t):qu(e,t,!0),f=i;do{if(u===0){rr&&!i&&Ns(e,t,0,!1);break}else{if(n=e.current.alternate,f&&!ub(n)){u=qu(e,t,!1),f=!1;continue}if(u===2){if(f=t,e.errorRecoveryDisabledLanes&f)var v=0;else v=e.pendingLanes&-536870913,v=v!==0?v:v&536870912?536870912:0;if(v!==0){t=v;e:{var b=e;u=wi;var N=b.current.memoizedState.isDehydrated;if(N&&(or(b,v).flags|=256),v=qu(b,v,!1),v!==2){if(Ru&&!N){b.errorRecoveryDisabledLanes|=f,cn|=f,u=4;break e}f=Bt,Bt=u,f!==null&&(Bt===null?Bt=f:Bt.push.apply(Bt,f))}u=v}if(f=!1,u!==2)continue}}if(u===1){or(e,0),Ns(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:Ns(i,t,Kt,!ws);break e;case 2:Bt=null;break;case 3:case 5:break;default:throw Error(l(329))}if((t&62914560)===t&&(u=Jl+300-gt(),10<u)){if(Ns(i,t,Kt,!ws),kn(i,0,!0)!==0)break e;Fa=t,i.timeoutHandle=Up(ip.bind(null,i,n,Bt,Ql,Mu,t,Kt,cn,ir,ws,f,"Throttled",-0,0),u);break e}ip(i,n,Bt,Ql,Mu,t,Kt,cn,ir,ws,f,null,-0,0)}}break}while(!0);Sa(e)}function ip(e,t,n,i,u,f,v,b,N,z,$,G,U,L){if(e.timeoutHandle=-1,G=t.subtreeFlags,G&8192||(G&16785408)===16785408){G={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:La},Fm(t,f,G);var ae=(f&62914560)===f?Jl-gt():(f&4194048)===f?ap-gt():0;if(ae=Jb(G,ae),ae!==null){Fa=f,e.cancelPendingCommit=ae(mp.bind(null,e,t,f,n,i,u,v,b,N,$,G,null,U,L)),Ns(e,f,v,!z);return}}mp(e,t,f,n,i,u,v,b,N)}function ub(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var i=0;i<n.length;i++){var u=n[i],f=u.getSnapshot;u=u.value;try{if(!Ht(f(),u))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;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 Ns(e,t,n,i){t&=~Du,t&=~cn,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var u=t;0<u;){var f=31-Ot(u),v=1<<f;i[f]=-1,u&=~v}n!==0&&O(e,n,t)}function Zl(){return(ze&6)===0?(Si(0),!1):!0}function Bu(){if(Ne!==null){if(Le===0)var e=Ne.return;else e=Ne,Ha=Ws=null,eu(e),Fn=null,ri=0,e=Ne;for(;e!==null;)Lm(e.alternate,e),e=e.return;Ne=null}}function or(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,kb(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Fa=0,Bu(),Ge=e,Ne=n=qa(e.current,null),Te=t,Le=0,Pt=null,ws=!1,rr=cs(e,t),Ru=!1,ir=Kt=Du=cn=_s=We=0,Bt=wi=null,Mu=!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 Za=t,vl(),n}function lp(e,t){be=null,C.H=hi,t===Zn||t===El?(t=Sh(),Le=3):t===Vc?(t=Sh(),Le=4):Le=t===gu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,Pt=t,Ne===null&&(We=1,$l(e,ea(t,e.current)))}function op(){var e=It.current;return e===null?!0:(Te&4194048)===Te?na===null:(Te&62914560)===Te||(Te&536870912)!==0?e===na:!1}function cp(){var e=C.H;return C.H=hi,e===null?hi:e}function up(){var e=C.A;return C.A=ob,e}function Fl(){We=4,ws||(Te&4194048)!==Te&&It.current!==null||(rr=!0),(_s&134217727)===0&&(cn&134217727)===0||Ge===null||Ns(Ge,Te,Kt,!1)}function qu(e,t,n){var i=ze;ze|=2;var u=cp(),f=up();(Ge!==e||Te!==t)&&(Ql=null,or(e,t)),t=!1;var v=We;e:do try{if(Le!==0&&Ne!==null){var b=Ne,N=Pt;switch(Le){case 8:Bu(),v=6;break e;case 3:case 2:case 9:case 6:It.current===null&&(t=!0);var z=Le;if(Le=0,Pt=null,cr(e,b,N,z),n&&rr){v=0;break e}break;default:z=Le,Le=0,Pt=null,cr(e,b,N,z)}}db(),v=We;break}catch($){lp(e,$)}while(!0);return t&&e.shellSuspendCounter++,Ha=Ws=null,ze=i,C.H=u,C.A=f,Ne===null&&(Ge=null,Te=0,vl()),v}function db(){for(;Ne!==null;)dp(Ne)}function fb(e,t){var n=ze;ze|=2;var i=cp(),u=up();Ge!==e||Te!==t?(Ql=null,Xl=gt()+500,or(e,t)):rr=cs(e,t);e:do try{if(Le!==0&&Ne!==null){t=Ne;var f=Pt;t:switch(Le){case 1:Le=0,Pt=null,cr(e,t,f,1);break;case 2:case 9:if(wh(f)){Le=0,Pt=null,fp(t);break}t=function(){Le!==2&&Le!==9||Ge!==e||(Le=7),Sa(e)},f.then(t,t);break e;case 3:Le=7;break e;case 4:Le=5;break e;case 7:wh(f)?(Le=0,Pt=null,fp(t)):(Le=0,Pt=null,cr(e,t,f,7));break;case 5:var v=null;switch(Ne.tag){case 26:v=Ne.memoizedState;case 5:case 27:var b=Ne;if(v?Zp(v):b.stateNode.complete){Le=0,Pt=null;var N=b.sibling;if(N!==null)Ne=N;else{var z=b.return;z!==null?(Ne=z,Wl(z)):Ne=null}break t}}Le=0,Pt=null,cr(e,t,f,5);break;case 6:Le=0,Pt=null,cr(e,t,f,6);break;case 8:Bu(),We=6;break e;default:throw Error(l(462))}}hb();break}catch($){lp(e,$)}while(!0);return Ha=Ws=null,C.H=i,C.A=u,ze=n,Ne!==null?0:(Ge=null,Te=0,vl(),We)}function hb(){for(;Ne!==null&&!nl();)dp(Ne)}function dp(e){var t=zm(e.alternate,e,Za);e.memoizedProps=e.pendingProps,t===null?Wl(e):Ne=t}function fp(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Cm(n,t,t.pendingProps,t.type,void 0,Te);break;case 11:t=Cm(n,t,t.pendingProps,t.type.render,t.ref,Te);break;case 5:eu(t);default:Lm(n,t),t=Ne=uh(t,Za),t=zm(n,t,Za)}e.memoizedProps=e.pendingProps,t===null?Wl(e):Ne=t}function cr(e,t,n,i){Ha=Ws=null,eu(t),Fn=null,ri=0;var u=t.return;try{if(tb(e,u,t,n,Te)){We=1,$l(e,ea(n,e.current)),Ne=null;return}}catch(f){if(u!==null)throw Ne=u,f;We=1,$l(e,ea(n,e.current)),Ne=null;return}t.flags&32768?(ke||i===1?e=!0:rr||(Te&536870912)!==0?e=!1:(ws=e=!0,(i===2||i===9||i===3||i===6)&&(i=It.current,i!==null&&i.tag===13&&(i.flags|=16384))),hp(t,e)):Wl(t)}function Wl(e){var t=e;do{if((t.flags&32768)!==0){hp(t,ws);return}e=t.return;var n=nb(t.alternate,t,Za);if(n!==null){Ne=n;return}if(t=t.sibling,t!==null){Ne=t;return}Ne=t=e}while(t!==null);We===0&&(We=5)}function hp(e,t){do{var n=rb(e.alternate,e);if(n!==null){n.flags&=32767,Ne=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ne=e;return}Ne=e=n}while(e!==null);We=6,Ne=null}function mp(e,t,n,i,u,f,v,b,N){e.cancelPendingCommit=null;do eo();while(dt!==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|=Tc,sc(e,n,f,v,b,N),e===Ge&&(Ne=Ge=null,Te=0),lr=t,js=e,Fa=n,zu=f,Uu=u,sp=i,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,yb(Ma,function(){return bp(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=C.T,C.T=null,u=J.p,J.p=2,v=ze,ze|=4;try{ib(e,t,n)}finally{ze=v,J.p=u,C.T=i}}dt=1,pp(),gp(),yp()}}function pp(){if(dt===1){dt=0;var e=js,t=lr,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=C.T,C.T=null;var i=J.p;J.p=2;var u=ze;ze|=4;try{Xm(t,e);var f=Zu,v=th(e.containerInfo),b=f.focusedElem,N=f.selectionRange;if(v!==b&&b&&b.ownerDocument&&eh(b.ownerDocument.documentElement,b)){if(N!==null&&_c(b)){var z=N.start,$=N.end;if($===void 0&&($=z),"selectionStart"in b)b.selectionStart=z,b.selectionEnd=Math.min($,b.value.length);else{var G=b.ownerDocument||document,U=G&&G.defaultView||window;if(U.getSelection){var L=U.getSelection(),ae=b.textContent.length,me=Math.min(N.start,ae),Ie=N.end===void 0?me:Math.min(N.end,ae);!L.extend&&me>Ie&&(v=Ie,Ie=me,me=v);var k=Wf(b,me),T=Wf(b,Ie);if(k&&T&&(L.rangeCount!==1||L.anchorNode!==k.node||L.anchorOffset!==k.offset||L.focusNode!==T.node||L.focusOffset!==T.offset)){var M=G.createRange();M.setStart(k.node,k.offset),L.removeAllRanges(),me>Ie?(L.addRange(M),L.extend(T.node,T.offset)):(M.setEnd(T.node,T.offset),L.addRange(M))}}}}for(G=[],L=b;L=L.parentNode;)L.nodeType===1&&G.push({element:L,left:L.scrollLeft,top:L.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<G.length;b++){var V=G[b];V.element.scrollLeft=V.left,V.element.scrollTop=V.top}}ho=!!Qu,Zu=Qu=null}finally{ze=u,J.p=i,C.T=n}}e.current=t,dt=2}}function gp(){if(dt===2){dt=0;var e=js,t=lr,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=C.T,C.T=null;var i=J.p;J.p=2;var u=ze;ze|=4;try{Gm(e,t.alternate,t)}finally{ze=u,J.p=i,C.T=n}}dt=3}}function yp(){if(dt===4||dt===3){dt=0,$s();var e=js,t=lr,n=Fa,i=sp;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?dt=5:(dt=0,lr=js=null,vp(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(Ss=null),Is(n),t=t.stateNode,wt&&typeof wt.onCommitFiberRoot=="function")try{wt.onCommitFiberRoot(Hs,t,void 0,(t.current.flags&128)===128)}catch{}if(i!==null){t=C.T,u=J.p,J.p=2,C.T=null;try{for(var f=e.onRecoverableError,v=0;v<i.length;v++){var b=i[v];f(b.value,{componentStack:b.stack})}}finally{C.T=t,J.p=u}}(Fa&3)!==0&&eo(),Sa(e),u=e.pendingLanes,(n&261930)!==0&&(u&42)!==0?e===Lu?_i++:(_i=0,Lu=e):_i=0,Si(0)}}function vp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,si(t)))}function eo(){return pp(),gp(),yp(),bp()}function bp(){if(dt!==5)return!1;var e=js,t=zu;zu=0;var n=Is(Fa),i=C.T,u=J.p;try{J.p=32>n?32:n,C.T=null,n=Uu,Uu=null;var f=js,v=Fa;if(dt=0,lr=js=null,Fa=0,(ze&6)!==0)throw Error(l(331));var b=ze;if(ze|=4,ep(f.current),Zm(f,f.current,v,n),ze=b,Si(0,!1),wt&&typeof wt.onPostCommitFiberRoot=="function")try{wt.onPostCommitFiberRoot(Hs,f)}catch{}return!0}finally{J.p=u,C.T=i,vp(e,t)}}function xp(e,t,n){t=ea(n,t),t=pu(e.stateNode,t,2),e=ys(e,t,2),e!==null&&(Vs(e,2),Sa(e))}function Be(e,t,n){if(e.tag===3)xp(e,e,n);else for(;t!==null;){if(t.tag===3){xp(t,e,n);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Ss===null||!Ss.has(i))){e=ea(n,e),n=wm(2),i=ys(t,n,2),i!==null&&(_m(n,i,t,e),Vs(i,2),Sa(i));break}}t=t.return}}function $u(e,t,n){var i=e.pingCache;if(i===null){i=e.pingCache=new cb;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(n)||(Ru=!0,u.add(n),e=mb.bind(null,e,t,n),t.then(e,e))}function mb(e,t,n){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ge===e&&(Te&n)===n&&(We===4||We===3&&(Te&62914560)===Te&&300>gt()-Jl?(ze&2)===0&&or(e,0):Du|=n,ir===Te&&(ir=0)),Sa(e)}function wp(e,t){t===0&&(t=il()),e=Qs(e,t),e!==null&&(Vs(e,t),Sa(e))}function pb(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),wp(e,n)}function gb(e,t){var n=0;switch(e.tag){case 31:case 13:var i=e.stateNode,u=e.memoizedState;u!==null&&(n=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),wp(e,n)}function yb(e,t){return jn(e,t)}var to=null,ur=null,Hu=!1,ao=!1,Vu=!1,Es=0;function Sa(e){e!==ur&&e.next===null&&(ur===null?to=ur=e:ur=ur.next=e),ao=!0,Hu||(Hu=!0,bb())}function Si(e,t){if(!Vu&&ao){Vu=!0;do for(var n=!1,i=to;i!==null;){if(e!==0){var u=i.pendingLanes;if(u===0)var f=0;else{var v=i.suspendedLanes,b=i.pingedLanes;f=(1<<31-Ot(42|e)+1)-1,f&=u&~(v&~b),f=f&201326741?f&201326741|1:f?f|2:0}f!==0&&(n=!0,Np(i,f))}else f=Te,f=kn(i,i===Ge?f:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(f&3)===0||cs(i,f)||(n=!0,Np(i,f));i=i.next}while(n);Vu=!1}}function vb(){_p()}function _p(){ao=Hu=!1;var e=0;Es!==0&&Cb()&&(e=Es);for(var t=gt(),n=null,i=to;i!==null;){var u=i.next,f=Sp(i,t);f===0?(i.next=null,n===null?to=u:n.next=u,u===null&&(ur=n)):(n=i,(e!==0||(f&3)!==0)&&(ao=!0)),i=u}dt!==0&&dt!==5||Si(e),Es!==0&&(Es=0)}function Sp(e,t){for(var n=e.suspendedLanes,i=e.pingedLanes,u=e.expirationTimes,f=e.pendingLanes&-62914561;0<f;){var v=31-Ot(f),b=1<<v,N=u[v];N===-1?((b&n)===0||(b&i)!==0)&&(u[v]=ac(b,t)):N<=t&&(e.expiredLanes|=b),f&=~b}if(t=Ge,n=Te,n=kn(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,n===0||e===t&&(Le===2||Le===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&os(i),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||cs(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(i!==null&&os(i),Is(n)){case 2:case 8:n=Vr;break;case 32:n=Ma;break;case 268435456:n=ya;break;default:n=Ma}return i=jp.bind(null,e),n=jn(n,i),e.callbackPriority=t,e.callbackNode=n,t}return i!==null&&i!==null&&os(i),e.callbackPriority=2,e.callbackNode=null,2}function jp(e,t){if(dt!==0&&dt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(eo()&&e.callbackNode!==n)return null;var i=Te;return i=kn(e,e===Ge?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(rp(e,i,t),Sp(e,gt()),e.callbackNode!=null&&e.callbackNode===n?jp.bind(null,e):null)}function Np(e,t){if(eo())return null;rp(e,t,!0)}function bb(){Ob(function(){(ze&6)!==0?jn(Hr,vb):_p()})}function Iu(){if(Es===0){var e=Xn;e===0&&(e=Tn,Tn<<=1,(Tn&261888)===0&&(Tn=256)),Es=e}return Es}function Ep(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ul(""+e)}function Tp(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function xb(e,t,n,i,u){if(t==="submit"&&n&&n.stateNode===u){var f=Ep((u[Dt]||null).action),v=i.submitter;v&&(t=(t=v[Dt]||null)?Ep(t.formAction):v.getAttribute("formAction"),t!==null&&(f=t,v=null));var b=new ml("action","action",null,i,u);e.push({event:b,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(Es!==0){var N=v?Tp(u,v):new FormData(u);cu(n,{pending:!0,data:N,method:u.method,action:f},null,N)}}else typeof f=="function"&&(b.preventDefault(),N=v?Tp(u,v):new FormData(u),cu(n,{pending:!0,data:N,method:u.method,action:f},f,N))},currentTarget:u}]})}}for(var Gu=0;Gu<Ec.length;Gu++){var Pu=Ec[Gu],wb=Pu.toLowerCase(),_b=Pu[0].toUpperCase()+Pu.slice(1);oa(wb,"on"+_b)}oa(nh,"onAnimationEnd"),oa(rh,"onAnimationIteration"),oa(ih,"onAnimationStart"),oa("dblclick","onDoubleClick"),oa("focusin","onFocus"),oa("focusout","onBlur"),oa(B0,"onTransitionRun"),oa(q0,"onTransitionStart"),oa($0,"onTransitionCancel"),oa(lh,"onTransitionEnd"),zn("onMouseEnter",["mouseout","mouseover"]),zn("onMouseLeave",["mouseout","mouseover"]),zn("onPointerEnter",["pointerout","pointerover"]),zn("onPointerLeave",["pointerout","pointerover"]),Ks("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ks("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ks("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ks("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ks("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ks("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ji="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(" "),Sb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ji));function Ap(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var i=e[n],u=i.event;i=i.listeners;e:{var f=void 0;if(t)for(var v=i.length-1;0<=v;v--){var b=i[v],N=b.instance,z=b.currentTarget;if(b=b.listener,N!==f&&u.isPropagationStopped())break e;f=b,u.currentTarget=z;try{f(u)}catch($){yl($)}u.currentTarget=null,f=N}else for(v=0;v<i.length;v++){if(b=i[v],N=b.instance,z=b.currentTarget,b=b.listener,N!==f&&u.isPropagationStopped())break e;f=b,u.currentTarget=z;try{f(u)}catch($){yl($)}u.currentTarget=null,f=N}}}}function Ee(e,t){var n=t[nc];n===void 0&&(n=t[nc]=new Set);var i=e+"__bubble";n.has(i)||(Cp(t,e,2,!1),n.add(i))}function Ku(e,t,n){var i=0;t&&(i|=4),Cp(n,e,i,t)}var so="_reactListening"+Math.random().toString(36).slice(2);function Yu(e){if(!e[so]){e[so]=!0,_f.forEach(function(n){n!=="selectionchange"&&(Sb.has(n)||Ku(n,!1,e),Ku(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[so]||(t[so]=!0,Ku("selectionchange",!1,t))}}function Cp(e,t,n,i){switch(ng(t)){case 2:var u=Zb;break;case 8:u=Fb;break;default:u=od}n=u.bind(null,t,n,e),u=void 0,!hc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),i?u!==void 0?e.addEventListener(t,n,{capture:!0,passive:u}):e.addEventListener(t,n,!0):u!==void 0?e.addEventListener(t,n,{passive:u}):e.addEventListener(t,n,!1)}function Ju(e,t,n,i,u){var f=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var v=i.tag;if(v===3||v===4){var b=i.stateNode.containerInfo;if(b===u)break;if(v===4)for(v=i.return;v!==null;){var N=v.tag;if((N===3||N===4)&&v.stateNode.containerInfo===u)return;v=v.return}for(;b!==null;){if(v=Rn(b),v===null)return;if(N=v.tag,N===5||N===6||N===26||N===27){i=f=v;continue e}b=b.parentNode}}i=i.return}Mf(function(){var z=f,$=dc(n),G=[];e:{var U=oh.get(e);if(U!==void 0){var L=ml,ae=e;switch(e){case"keypress":if(fl(n)===0)break e;case"keydown":case"keyup":L=g0;break;case"focusin":ae="focus",L=yc;break;case"focusout":ae="blur",L=yc;break;case"beforeblur":case"afterblur":L=yc;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":L=Lf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":L=n0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":L=b0;break;case nh:case rh:case ih:L=l0;break;case lh:L=w0;break;case"scroll":case"scrollend":L=a0;break;case"wheel":L=S0;break;case"copy":case"cut":case"paste":L=c0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":L=qf;break;case"toggle":case"beforetoggle":L=N0}var me=(t&4)!==0,Ie=!me&&(e==="scroll"||e==="scrollend"),k=me?U!==null?U+"Capture":null:U;me=[];for(var T=z,M;T!==null;){var V=T;if(M=V.stateNode,V=V.tag,V!==5&&V!==26&&V!==27||M===null||k===null||(V=Kr(T,k),V!=null&&me.push(Ni(T,V,M))),Ie)break;T=T.return}0<me.length&&(U=new L(U,ae,null,n,$),G.push({event:U,listeners:me}))}}if((t&7)===0){e:{if(U=e==="mouseover"||e==="pointerover",L=e==="mouseout"||e==="pointerout",U&&n!==uc&&(ae=n.relatedTarget||n.fromElement)&&(Rn(ae)||ae[On]))break e;if((L||U)&&(U=$.window===$?$:(U=$.ownerDocument)?U.defaultView||U.parentWindow:window,L?(ae=n.relatedTarget||n.toElement,L=z,ae=ae?Rn(ae):null,ae!==null&&(Ie=d(ae),me=ae.tag,ae!==Ie||me!==5&&me!==27&&me!==6)&&(ae=null)):(L=null,ae=z),L!==ae)){if(me=Lf,V="onMouseLeave",k="onMouseEnter",T="mouse",(e==="pointerout"||e==="pointerover")&&(me=qf,V="onPointerLeave",k="onPointerEnter",T="pointer"),Ie=L==null?U:Pr(L),M=ae==null?U:Pr(ae),U=new me(V,T+"leave",L,n,$),U.target=Ie,U.relatedTarget=M,V=null,Rn($)===z&&(me=new me(k,T+"enter",ae,n,$),me.target=M,me.relatedTarget=Ie,V=me),Ie=V,L&&ae)t:{for(me=jb,k=L,T=ae,M=0,V=k;V;V=me(V))M++;V=0;for(var ue=T;ue;ue=me(ue))V++;for(;0<M-V;)k=me(k),M--;for(;0<V-M;)T=me(T),V--;for(;M--;){if(k===T||T!==null&&k===T.alternate){me=k;break t}k=me(k),T=me(T)}me=null}else me=null;L!==null&&kp(G,U,L,me,!1),ae!==null&&Ie!==null&&kp(G,Ie,ae,me,!0)}}e:{if(U=z?Pr(z):window,L=U.nodeName&&U.nodeName.toLowerCase(),L==="select"||L==="input"&&U.type==="file")var Re=Yf;else if(Pf(U))if(Jf)Re=z0;else{Re=D0;var ie=R0}else L=U.nodeName,!L||L.toLowerCase()!=="input"||U.type!=="checkbox"&&U.type!=="radio"?z&&cc(z.elementType)&&(Re=Yf):Re=M0;if(Re&&(Re=Re(e,z))){Kf(G,Re,n,$);break e}ie&&ie(e,U,z),e==="focusout"&&z&&U.type==="number"&&z.memoizedProps.value!=null&&oc(U,"number",U.value)}switch(ie=z?Pr(z):window,e){case"focusin":(Pf(ie)||ie.contentEditable==="true")&&(Hn=ie,Sc=z,ei=null);break;case"focusout":ei=Sc=Hn=null;break;case"mousedown":jc=!0;break;case"contextmenu":case"mouseup":case"dragend":jc=!1,ah(G,n,$);break;case"selectionchange":if(L0)break;case"keydown":case"keyup":ah(G,n,$)}var xe;if(bc)e:{switch(e){case"compositionstart":var Ae="onCompositionStart";break e;case"compositionend":Ae="onCompositionEnd";break e;case"compositionupdate":Ae="onCompositionUpdate";break e}Ae=void 0}else $n?If(e,n)&&(Ae="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Ae="onCompositionStart");Ae&&($f&&n.locale!=="ko"&&($n||Ae!=="onCompositionStart"?Ae==="onCompositionEnd"&&$n&&(xe=zf()):(us=$,mc="value"in us?us.value:us.textContent,$n=!0)),ie=no(z,Ae),0<ie.length&&(Ae=new Bf(Ae,e,null,n,$),G.push({event:Ae,listeners:ie}),xe?Ae.data=xe:(xe=Gf(n),xe!==null&&(Ae.data=xe)))),(xe=T0?A0(e,n):C0(e,n))&&(Ae=no(z,"onBeforeInput"),0<Ae.length&&(ie=new Bf("onBeforeInput","beforeinput",null,n,$),G.push({event:ie,listeners:Ae}),ie.data=xe)),xb(G,e,z,n,$)}Ap(G,t)})}function Ni(e,t,n){return{instance:e,listener:t,currentTarget:n}}function no(e,t){for(var n=t+"Capture",i=[];e!==null;){var u=e,f=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||f===null||(u=Kr(e,n),u!=null&&i.unshift(Ni(e,u,f)),u=Kr(e,t),u!=null&&i.push(Ni(e,u,f))),e.tag===3)return i;e=e.return}return[]}function jb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function kp(e,t,n,i,u){for(var f=t._reactName,v=[];n!==null&&n!==i;){var b=n,N=b.alternate,z=b.stateNode;if(b=b.tag,N!==null&&N===i)break;b!==5&&b!==26&&b!==27||z===null||(N=z,u?(z=Kr(n,f),z!=null&&v.unshift(Ni(n,z,N))):u||(z=Kr(n,f),z!=null&&v.push(Ni(n,z,N)))),n=n.return}v.length!==0&&e.push({event:t,listeners:v})}var Nb=/\r\n?/g,Eb=/\u0000|\uFFFD/g;function Op(e){return(typeof e=="string"?e:""+e).replace(Nb,`
9
+ `).replace(Eb,"")}function Rp(e,t){return t=Op(t),Op(e)===t}function Ve(e,t,n,i,u,f){switch(n){case"children":typeof i=="string"?t==="body"||t==="textarea"&&i===""||Ln(e,i):(typeof i=="number"||typeof i=="bigint")&&t!=="body"&&Ln(e,""+i);break;case"className":ol(e,"class",i);break;case"tabIndex":ol(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":ol(e,n,i);break;case"style":Rf(e,i,f);break;case"data":if(t!=="object"){ol(e,"data",i);break}case"src":case"href":if(i===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(n);break}i=ul(""+i),e.setAttribute(n,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(n,"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"&&(n==="formAction"?(t!=="input"&&Ve(e,t,"name",u.name,u,null),Ve(e,t,"formEncType",u.formEncType,u,null),Ve(e,t,"formMethod",u.formMethod,u,null),Ve(e,t,"formTarget",u.formTarget,u,null)):(Ve(e,t,"encType",u.encType,u,null),Ve(e,t,"method",u.method,u,null),Ve(e,t,"target",u.target,u,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(n);break}i=ul(""+i),e.setAttribute(n,i);break;case"onClick":i!=null&&(e.onclick=La);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(n=i.__html,n!=null){if(u.children!=null)throw Error(l(60));e.innerHTML=n}}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}n=ul(""+i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);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(n,""+i):e.removeAttribute(n);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(n,""):e.removeAttribute(n);break;case"capture":case"download":i===!0?e.setAttribute(n,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(n,i):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(n,i):e.removeAttribute(n);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(n):e.setAttribute(n,i);break;case"popover":Ee("beforetoggle",e),Ee("toggle",e),ll(e,"popover",i);break;case"xlinkActuate":Ua(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":Ua(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":Ua(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":Ua(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":Ua(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":Ua(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":Ua(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":Ua(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":Ua(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":ll(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=e0.get(n)||n,ll(e,n,i))}}function Xu(e,t,n,i,u,f){switch(n){case"style":Rf(e,i,f);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(l(61));if(n=i.__html,n!=null){if(u.children!=null)throw Error(l(60));e.innerHTML=n}}break;case"children":typeof i=="string"?Ln(e,i):(typeof i=="number"||typeof i=="bigint")&&Ln(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=La);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Sf.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(u=n.endsWith("Capture"),t=n.slice(2,u?n.length-7:void 0),f=e[Dt]||null,f=f!=null?f[n]:null,typeof f=="function"&&e.removeEventListener(t,f,u),typeof i=="function")){typeof f!="function"&&f!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,i,u);break e}n in e?e[n]=i:i===!0?e.setAttribute(n,""):ll(e,n,i)}}}function Nt(e,t,n){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 n)if(n.hasOwnProperty(f)){var v=n[f];if(v!=null)switch(f){case"src":i=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:Ve(e,t,f,v,n,null)}}u&&Ve(e,t,"srcSet",n.srcSet,n,null),i&&Ve(e,t,"src",n.src,n,null);return;case"input":Ee("invalid",e);var b=f=v=u=null,N=null,z=null;for(i in n)if(n.hasOwnProperty(i)){var $=n[i];if($!=null)switch(i){case"name":u=$;break;case"type":v=$;break;case"checked":N=$;break;case"defaultChecked":z=$;break;case"value":f=$;break;case"defaultValue":b=$;break;case"children":case"dangerouslySetInnerHTML":if($!=null)throw Error(l(137,t));break;default:Ve(e,t,i,$,n,null)}}Af(e,f,b,N,z,v,u,!1);return;case"select":Ee("invalid",e),i=v=f=null;for(u in n)if(n.hasOwnProperty(u)&&(b=n[u],b!=null))switch(u){case"value":f=b;break;case"defaultValue":v=b;break;case"multiple":i=b;default:Ve(e,t,u,b,n,null)}t=f,n=v,e.multiple=!!i,t!=null?Un(e,!!i,t,!1):n!=null&&Un(e,!!i,n,!0);return;case"textarea":Ee("invalid",e),f=u=i=null;for(v in n)if(n.hasOwnProperty(v)&&(b=n[v],b!=null))switch(v){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:Ve(e,t,v,b,n,null)}kf(e,i,u,f);return;case"option":for(N in n)n.hasOwnProperty(N)&&(i=n[N],i!=null)&&(N==="selected"?e.selected=i&&typeof i!="function"&&typeof i!="symbol":Ve(e,t,N,i,n,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<ji.length;i++)Ee(ji[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(z in n)if(n.hasOwnProperty(z)&&(i=n[z],i!=null))switch(z){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:Ve(e,t,z,i,n,null)}return;default:if(cc(t)){for($ in n)n.hasOwnProperty($)&&(i=n[$],i!==void 0&&Xu(e,t,$,i,n,void 0));return}}for(b in n)n.hasOwnProperty(b)&&(i=n[b],i!=null&&Ve(e,t,b,i,n,null))}function Tb(e,t,n,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,v=null,b=null,N=null,z=null,$=null;for(L in n){var G=n[L];if(n.hasOwnProperty(L)&&G!=null)switch(L){case"checked":break;case"value":break;case"defaultValue":N=G;default:i.hasOwnProperty(L)||Ve(e,t,L,null,i,G)}}for(var U in i){var L=i[U];if(G=n[U],i.hasOwnProperty(U)&&(L!=null||G!=null))switch(U){case"type":f=L;break;case"name":u=L;break;case"checked":z=L;break;case"defaultChecked":$=L;break;case"value":v=L;break;case"defaultValue":b=L;break;case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(l(137,t));break;default:L!==G&&Ve(e,t,U,L,i,G)}}lc(e,v,b,N,z,$,f,u);return;case"select":L=v=b=U=null;for(f in n)if(N=n[f],n.hasOwnProperty(f)&&N!=null)switch(f){case"value":break;case"multiple":L=N;default:i.hasOwnProperty(f)||Ve(e,t,f,null,i,N)}for(u in i)if(f=i[u],N=n[u],i.hasOwnProperty(u)&&(f!=null||N!=null))switch(u){case"value":U=f;break;case"defaultValue":b=f;break;case"multiple":v=f;default:f!==N&&Ve(e,t,u,f,i,N)}t=b,n=v,i=L,U!=null?Un(e,!!n,U,!1):!!i!=!!n&&(t!=null?Un(e,!!n,t,!0):Un(e,!!n,n?[]:"",!1));return;case"textarea":L=U=null;for(b in n)if(u=n[b],n.hasOwnProperty(b)&&u!=null&&!i.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:Ve(e,t,b,null,i,u)}for(v in i)if(u=i[v],f=n[v],i.hasOwnProperty(v)&&(u!=null||f!=null))switch(v){case"value":U=u;break;case"defaultValue":L=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(l(91));break;default:u!==f&&Ve(e,t,v,u,i,f)}Cf(e,U,L);return;case"option":for(var ae in n)U=n[ae],n.hasOwnProperty(ae)&&U!=null&&!i.hasOwnProperty(ae)&&(ae==="selected"?e.selected=!1:Ve(e,t,ae,null,i,U));for(N in i)U=i[N],L=n[N],i.hasOwnProperty(N)&&U!==L&&(U!=null||L!=null)&&(N==="selected"?e.selected=U&&typeof U!="function"&&typeof U!="symbol":Ve(e,t,N,U,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 me in n)U=n[me],n.hasOwnProperty(me)&&U!=null&&!i.hasOwnProperty(me)&&Ve(e,t,me,null,i,U);for(z in i)if(U=i[z],L=n[z],i.hasOwnProperty(z)&&U!==L&&(U!=null||L!=null))switch(z){case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(l(137,t));break;default:Ve(e,t,z,U,i,L)}return;default:if(cc(t)){for(var Ie in n)U=n[Ie],n.hasOwnProperty(Ie)&&U!==void 0&&!i.hasOwnProperty(Ie)&&Xu(e,t,Ie,void 0,i,U);for($ in i)U=i[$],L=n[$],!i.hasOwnProperty($)||U===L||U===void 0&&L===void 0||Xu(e,t,$,U,i,L);return}}for(var k in n)U=n[k],n.hasOwnProperty(k)&&U!=null&&!i.hasOwnProperty(k)&&Ve(e,t,k,null,i,U);for(G in i)U=i[G],L=n[G],!i.hasOwnProperty(G)||U===L||U==null&&L==null||Ve(e,t,G,U,i,L)}function Dp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Ab(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),i=0;i<n.length;i++){var u=n[i],f=u.transferSize,v=u.initiatorType,b=u.duration;if(f&&b&&Dp(v)){for(v=0,b=u.responseEnd,i+=1;i<n.length;i++){var N=n[i],z=N.startTime;if(z>b)break;var $=N.transferSize,G=N.initiatorType;$&&Dp(G)&&(N=N.responseEnd,v+=$*(N<b?1:(b-z)/(N-z)))}if(--i,t+=8*(f+v)/(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 Qu=null,Zu=null;function ro(e){return e.nodeType===9?e:e.ownerDocument}function Mp(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 zp(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 Fu(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 Wu=null;function Cb(){var e=window.event;return e&&e.type==="popstate"?e===Wu?!1:(Wu=e,!0):(Wu=null,!1)}var Up=typeof setTimeout=="function"?setTimeout:void 0,kb=typeof clearTimeout=="function"?clearTimeout:void 0,Lp=typeof Promise=="function"?Promise:void 0,Ob=typeof queueMicrotask=="function"?queueMicrotask:typeof Lp<"u"?function(e){return Lp.resolve(null).then(e).catch(Rb)}:Up;function Rb(e){setTimeout(function(){throw e})}function Ts(e){return e==="head"}function Bp(e,t){var n=t,i=0;do{var u=n.nextSibling;if(e.removeChild(n),u&&u.nodeType===8)if(n=u.data,n==="/$"||n==="/&"){if(i===0){e.removeChild(u),mr(t);return}i--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")i++;else if(n==="html")Ei(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,Ei(n);for(var f=n.firstChild;f;){var v=f.nextSibling,b=f.nodeName;f[Gr]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&f.rel.toLowerCase()==="stylesheet"||n.removeChild(f),f=v}}else n==="body"&&Ei(e.ownerDocument.body);n=u}while(n);mr(t)}function qp(e,t){var n=e;e=0;do{var i=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=i}while(n)}function ed(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":ed(n),rc(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function Db(e,t,n,i){for(;e.nodeType===1;){var u=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[Gr])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 Mb(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=ra(e.nextSibling),e===null))return null;return e}function $p(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 td(e){return e.data==="$?"||e.data==="$~"}function ad(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function zb(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var i=function(){t(),n.removeEventListener("DOMContentLoaded",i)};n.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 sd=null;function Hp(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return ra(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function Vp(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function Ip(e,t,n){switch(t=ro(n),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 Ei(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);rc(e)}var ia=new Map,Gp=new Set;function io(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Wa=J.d;J.d={f:Ub,r:Lb,D:Bb,C:qb,L:$b,m:Hb,X:Ib,S:Vb,M:Gb};function Ub(){var e=Wa.f(),t=Zl();return e||t}function Lb(e){var t=Dn(e);t!==null&&t.tag===5&&t.type==="form"?lm(t):Wa.r(e)}var dr=typeof document>"u"?null:document;function Pp(e,t,n){var i=dr;if(i&&typeof t=="string"&&t){var u=Ft(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof n=="string"&&(u+='[crossorigin="'+n+'"]'),Gp.has(u)||(Gp.add(u),e={rel:e,crossOrigin:n,href:t},i.querySelector(u)===null&&(t=i.createElement("link"),Nt(t,"link",e),vt(t),i.head.appendChild(t)))}}function Bb(e){Wa.D(e),Pp("dns-prefetch",e,null)}function qb(e,t){Wa.C(e,t),Pp("preconnect",e,t)}function $b(e,t,n){Wa.L(e,t,n);var i=dr;if(i&&e&&t){var u='link[rel="preload"][as="'+Ft(t)+'"]';t==="image"&&n&&n.imageSrcSet?(u+='[imagesrcset="'+Ft(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(u+='[imagesizes="'+Ft(n.imageSizes)+'"]')):u+='[href="'+Ft(e)+'"]';var f=u;switch(t){case"style":f=fr(e);break;case"script":f=hr(e)}ia.has(f)||(e=w({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),ia.set(f,e),i.querySelector(u)!==null||t==="style"&&i.querySelector(Ti(f))||t==="script"&&i.querySelector(Ai(f))||(t=i.createElement("link"),Nt(t,"link",e),vt(t),i.head.appendChild(t)))}}function Hb(e,t){Wa.m(e,t);var n=dr;if(n&&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=hr(e)}if(!ia.has(f)&&(e=w({rel:"modulepreload",href:e},t),ia.set(f,e),n.querySelector(u)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Ai(f)))return}i=n.createElement("link"),Nt(i,"link",e),vt(i),n.head.appendChild(i)}}}function Vb(e,t,n){Wa.S(e,t,n);var i=dr;if(i&&e){var u=Mn(i).hoistableStyles,f=fr(e);t=t||"default";var v=u.get(f);if(!v){var b={loading:0,preload:null};if(v=i.querySelector(Ti(f)))b.loading=5;else{e=w({rel:"stylesheet",href:e,"data-precedence":t},n),(n=ia.get(f))&&nd(e,n);var N=v=i.createElement("link");vt(N),Nt(N,"link",e),N._p=new Promise(function(z,$){N.onload=z,N.onerror=$}),N.addEventListener("load",function(){b.loading|=1}),N.addEventListener("error",function(){b.loading|=2}),b.loading|=4,lo(v,t,i)}v={type:"stylesheet",instance:v,count:1,state:b},u.set(f,v)}}}function Ib(e,t){Wa.X(e,t);var n=dr;if(n&&e){var i=Mn(n).hoistableScripts,u=hr(e),f=i.get(u);f||(f=n.querySelector(Ai(u)),f||(e=w({src:e,async:!0},t),(t=ia.get(u))&&rd(e,t),f=n.createElement("script"),vt(f),Nt(f,"link",e),n.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(u,f))}}function Gb(e,t){Wa.M(e,t);var n=dr;if(n&&e){var i=Mn(n).hoistableScripts,u=hr(e),f=i.get(u);f||(f=n.querySelector(Ai(u)),f||(e=w({src:e,async:!0,type:"module"},t),(t=ia.get(u))&&rd(e,t),f=n.createElement("script"),vt(f),Nt(f,"link",e),n.head.appendChild(f)),f={type:"script",instance:f,count:1,state:null},i.set(u,f))}}function Kp(e,t,n,i){var u=(u=ye.current)?io(u):null;if(!u)throw Error(l(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=fr(n.href),n=Mn(u).hoistableStyles,i=n.get(t),i||(i={type:"style",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=fr(n.href);var f=Mn(u).hoistableStyles,v=f.get(e);if(v||(u=u.ownerDocument||u,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},f.set(e,v),(f=u.querySelector(Ti(e)))&&!f._p&&(v.instance=f,v.state.loading=5),ia.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},ia.set(e,n),f||Pb(u,e,n,v.state))),t&&i===null)throw Error(l(528,""));return v}if(t&&i!==null)throw Error(l(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=hr(n),n=Mn(u).hoistableScripts,i=n.get(t),i||(i={type:"script",instance:null,count:0,state:null},n.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,e))}}function fr(e){return'href="'+Ft(e)+'"'}function Ti(e){return'link[rel="stylesheet"]['+e+"]"}function Yp(e){return w({},e,{"data-precedence":e.precedence,precedence:null})}function Pb(e,t,n,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}),Nt(t,"link",n),vt(t),e.head.appendChild(t))}function hr(e){return'[src="'+Ft(e)+'"]'}function Ai(e){return"script[async]"+e}function Jp(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+Ft(n.href)+'"]');if(i)return t.instance=i,vt(i),i;var u=w({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),vt(i),Nt(i,"style",u),lo(i,n.precedence,e),t.instance=i;case"stylesheet":u=fr(n.href);var f=e.querySelector(Ti(u));if(f)return t.state.loading|=4,t.instance=f,vt(f),f;i=Yp(n),(u=ia.get(u))&&nd(i,u),f=(e.ownerDocument||e).createElement("link"),vt(f);var v=f;return v._p=new Promise(function(b,N){v.onload=b,v.onerror=N}),Nt(f,"link",i),t.state.loading|=4,lo(f,n.precedence,e),t.instance=f;case"script":return f=hr(n.src),(u=e.querySelector(Ai(f)))?(t.instance=u,vt(u),u):(i=n,(u=ia.get(f))&&(i=w({},n),rd(i,u)),e=e.ownerDocument||e,u=e.createElement("script"),vt(u),Nt(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,lo(i,n.precedence,e));return t.instance}function lo(e,t,n){for(var i=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=i.length?i[i.length-1]:null,f=u,v=0;v<i.length;v++){var b=i[v];if(b.dataset.precedence===t)f=b;else if(f!==u)break}f?f.parentNode.insertBefore(e,f.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function nd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function rd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var oo=null;function Xp(e,t,n){if(oo===null){var i=new Map,u=oo=new Map;u.set(n,i)}else u=oo,i=u.get(n),i||(i=new Map,u.set(n,i));if(i.has(e))return i;for(i.set(e,null),n=n.getElementsByTagName(e),u=0;u<n.length;u++){var f=n[u];if(!(f[Gr]||f[ut]||e==="link"&&f.getAttribute("rel")==="stylesheet")&&f.namespaceURI!=="http://www.w3.org/2000/svg"){var v=f.getAttribute(t)||"";v=e+v;var b=i.get(v);b?b.push(f):i.set(v,[f])}}return i}function Qp(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function Kb(e,t,n){if(n===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 Zp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function Yb(e,t,n,i){if(n.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var u=fr(i.href),f=t.querySelector(Ti(u));if(f){t=f._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=co.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=f,vt(f);return}f=t.ownerDocument||t,i=Yp(i),(u=ia.get(u))&&nd(i,u),f=f.createElement("link"),vt(f);var v=f;v._p=new Promise(function(b,N){v.onload=b,v.onerror=N}),Nt(f,"link",i),n.instance=f}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=co.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var id=0;function Jb(e,t){return e.stylesheets&&e.count===0&&fo(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var i=setTimeout(function(){if(e.stylesheets&&fo(e,e.stylesheets),e.unsuspend){var f=e.unsuspend;e.unsuspend=null,f()}},6e4+t);0<e.imgBytes&&id===0&&(id=62500*Ab());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&fo(e,e.stylesheets),e.unsuspend)){var f=e.unsuspend;e.unsuspend=null,f()}},(e.imgBytes>id?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(u)}}:null}function co(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)fo(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var uo=null;function fo(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,uo=new Map,t.forEach(Xb,e),uo=null,co.call(e))}function Xb(e,t){if(!(t.state.loading&4)){var n=uo.get(e);if(n)var i=n.get(null);else{n=new Map,uo.set(e,n);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),f=0;f<u.length;f++){var v=u[f];(v.nodeName==="LINK"||v.getAttribute("media")!=="not all")&&(n.set(v.dataset.precedence,v),i=v)}i&&n.set(null,i)}u=t.instance,v=u.getAttribute("data-precedence"),f=n.get(v)||i,f===i&&n.set(null,u),n.set(v,u),this.count++,i=co.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 Ci={$$typeof:q,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function Qb(e,t,n,i,u,f,v,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=Ir(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ir(0),this.hiddenUpdates=Ir(null),this.identifierPrefix=i,this.onUncaughtError=u,this.onCaughtError=f,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=N,this.incompleteTransitions=new Map}function Fp(e,t,n,i,u,f,v,b,N,z,$,G){return e=new Qb(e,t,n,v,N,z,$,G,b),t=1,f===!0&&(t|=24),f=Vt(3,null,null,t),e.current=f,f.stateNode=e,t=qc(),t.refCount++,e.pooledCache=t,t.refCount++,f.memoizedState={element:i,isDehydrated:n,cache:t},Ic(f),e}function Wp(e){return e?(e=Gn,e):Gn}function eg(e,t,n,i,u,f){u=Wp(u),i.context===null?i.context=u:i.pendingContext=u,i=gs(t),i.payload={element:n},f=f===void 0?null:f,f!==null&&(i.callback=f),n=ys(e,i,t),n!==null&&(qt(n,e,t),li(n,e,t))}function tg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ld(e,t){tg(e,t),(e=e.alternate)&&tg(e,t)}function ag(e){if(e.tag===13||e.tag===31){var t=Qs(e,67108864);t!==null&&qt(t,e,67108864),ld(e,67108864)}}function sg(e){if(e.tag===13||e.tag===31){var t=Yt();t=yt(t);var n=Qs(e,t);n!==null&&qt(n,e,t),ld(e,t)}}var ho=!0;function Zb(e,t,n,i){var u=C.T;C.T=null;var f=J.p;try{J.p=2,od(e,t,n,i)}finally{J.p=f,C.T=u}}function Fb(e,t,n,i){var u=C.T;C.T=null;var f=J.p;try{J.p=8,od(e,t,n,i)}finally{J.p=f,C.T=u}}function od(e,t,n,i){if(ho){var u=cd(i);if(u===null)Ju(e,t,i,mo,n),rg(e,i);else if(ex(u,e,t,n,i))i.stopPropagation();else if(rg(e,i),t&4&&-1<Wb.indexOf(e)){for(;u!==null;){var f=Dn(u);if(f!==null)switch(f.tag){case 3:if(f=f.stateNode,f.current.memoizedState.isDehydrated){var v=za(f.pendingLanes);if(v!==0){var b=f;for(b.pendingLanes|=2,b.entangledLanes|=2;v;){var N=1<<31-Ot(v);b.entanglements[1]|=N,v&=~N}Sa(f),(ze&6)===0&&(Xl=gt()+500,Si(0))}}break;case 31:case 13:b=Qs(f,2),b!==null&&qt(b,f,2),Zl(),ld(f,2)}if(f=cd(i),f===null&&Ju(e,t,i,mo,n),f===u)break;u=f}u!==null&&i.stopPropagation()}else Ju(e,t,i,null,n)}}function cd(e){return e=dc(e),ud(e)}var mo=null;function ud(e){if(mo=null,e=Rn(e),e!==null){var t=d(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=h(t),e!==null)return e;e=null}else if(n===31){if(e=m(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return mo=e,null}function ng(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(rl()){case Hr:return 2;case Vr:return 8;case Ma:case Nn:return 32;case ya:return 268435456;default:return 32}default:return 32}}var dd=!1,As=null,Cs=null,ks=null,ki=new Map,Oi=new Map,Os=[],Wb="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 rg(e,t){switch(e){case"focusin":case"focusout":As=null;break;case"dragenter":case"dragleave":Cs=null;break;case"mouseover":case"mouseout":ks=null;break;case"pointerover":case"pointerout":ki.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Oi.delete(t.pointerId)}}function Ri(e,t,n,i,u,f){return e===null||e.nativeEvent!==f?(e={blockedOn:t,domEventName:n,eventSystemFlags:i,nativeEvent:f,targetContainers:[u]},t!==null&&(t=Dn(t),t!==null&&ag(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function ex(e,t,n,i,u){switch(t){case"focusin":return As=Ri(As,e,t,n,i,u),!0;case"dragenter":return Cs=Ri(Cs,e,t,n,i,u),!0;case"mouseover":return ks=Ri(ks,e,t,n,i,u),!0;case"pointerover":var f=u.pointerId;return ki.set(f,Ri(ki.get(f)||null,e,t,n,i,u)),!0;case"gotpointercapture":return f=u.pointerId,Oi.set(f,Ri(Oi.get(f)||null,e,t,n,i,u)),!0}return!1}function ig(e){var t=Rn(e.target);if(t!==null){var n=d(t);if(n!==null){if(t=n.tag,t===13){if(t=h(n),t!==null){e.blockedOn=t,Ps(e.priority,function(){sg(n)});return}}else if(t===31){if(t=m(n),t!==null){e.blockedOn=t,Ps(e.priority,function(){sg(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function po(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=cd(e.nativeEvent);if(n===null){n=e.nativeEvent;var i=new n.constructor(n.type,n);uc=i,n.target.dispatchEvent(i),uc=null}else return t=Dn(n),t!==null&&ag(t),e.blockedOn=n,!1;t.shift()}return!0}function lg(e,t,n){po(e)&&n.delete(t)}function tx(){dd=!1,As!==null&&po(As)&&(As=null),Cs!==null&&po(Cs)&&(Cs=null),ks!==null&&po(ks)&&(ks=null),ki.forEach(lg),Oi.forEach(lg)}function go(e,t){e.blockedOn===t&&(e.blockedOn=null,dd||(dd=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,tx)))}var yo=null;function og(e){yo!==e&&(yo=e,s.unstable_scheduleCallback(s.unstable_NormalPriority,function(){yo===e&&(yo=null);for(var t=0;t<e.length;t+=3){var n=e[t],i=e[t+1],u=e[t+2];if(typeof i!="function"){if(ud(i||n)===null)continue;break}var f=Dn(n);f!==null&&(e.splice(t,3),t-=3,cu(f,{pending:!0,data:u,method:n.method,action:i},i,u))}}))}function mr(e){function t(N){return go(N,e)}As!==null&&go(As,e),Cs!==null&&go(Cs,e),ks!==null&&go(ks,e),ki.forEach(t),Oi.forEach(t);for(var n=0;n<Os.length;n++){var i=Os[n];i.blockedOn===e&&(i.blockedOn=null)}for(;0<Os.length&&(n=Os[0],n.blockedOn===null);)ig(n),n.blockedOn===null&&Os.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(i=0;i<n.length;i+=3){var u=n[i],f=n[i+1],v=u[Dt]||null;if(typeof f=="function")v||og(n);else if(v){var b=null;if(f&&f.hasAttribute("formAction")){if(u=f,v=f[Dt]||null)b=v.formAction;else if(ud(u)!==null)continue}else b=v.action;typeof b=="function"?n[i+1]=b:(n.splice(i,3),i-=3),og(n)}}}function cg(){function e(f){f.canIntercept&&f.info==="react-transition"&&f.intercept({handler:function(){return new Promise(function(v){return u=v})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=null),i||setTimeout(n,20)}function n(){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(n,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function fd(e){this._internalRoot=e}vo.prototype.render=fd.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(l(409));var n=t.current,i=Yt();eg(n,i,e,t,null,null)},vo.prototype.unmount=fd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;eg(e.current,2,null,e,null,null),Zl(),t[On]=null}};function vo(e){this._internalRoot=e}vo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Gs();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Os.length&&t!==0&&t<Os[n].priority;n++);Os.splice(n,0,e),n===0&&ig(e)}};var ug=a.version;if(ug!=="19.2.3")throw Error(l(527,ug,"19.2.3"));J.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(l(188)):(e=Object.keys(e).join(","),Error(l(268,e)));return e=p(t),e=e!==null?g(e):null,e=e===null?null:e.stateNode,e};var ax={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:C,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var bo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!bo.isDisabled&&bo.supportsFiber)try{Hs=bo.inject(ax),wt=bo}catch{}}return Mi.createRoot=function(e,t){if(!c(e))throw Error(l(299));var n=!1,i="",u=ym,f=vm,v=bm;return t!=null&&(t.unstable_strictMode===!0&&(n=!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&&(v=t.onRecoverableError)),t=Fp(e,1,!1,null,null,n,i,null,u,f,v,cg),e[On]=t.current,Yu(e),new fd(t)},Mi.hydrateRoot=function(e,t,n){if(!c(e))throw Error(l(299));var i=!1,u="",f=ym,v=vm,b=bm,N=null;return n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(u=n.identifierPrefix),n.onUncaughtError!==void 0&&(f=n.onUncaughtError),n.onCaughtError!==void 0&&(v=n.onCaughtError),n.onRecoverableError!==void 0&&(b=n.onRecoverableError),n.formState!==void 0&&(N=n.formState)),t=Fp(e,1,!0,t,n??null,i,u,N,f,v,b,cg),t.context=Wp(null),n=t.current,i=Yt(),i=yt(i),u=gs(i),u.callback=null,ys(n,u,i),n=i,t.current.lanes=n,Vs(t,n),Sa(t),e[On]=t.current,Yu(e),new vo(t)},Mi.version="19.2.3",Mi}var xg;function fx(){if(xg)return pd.exports;xg=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(a){console.error(a)}}return s(),pd.exports=dx(),pd.exports}var hx=fx();const mx=lf(hx);const px=s=>s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),gx=s=>s.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,r,l)=>l?l.toUpperCase():r.toLowerCase()),wg=s=>{const a=gx(s);return a.charAt(0).toUpperCase()+a.slice(1)},xy=(...s)=>s.filter((a,r,l)=>!!a&&a.trim()!==""&&l.indexOf(a)===r).join(" ").trim(),yx=s=>{for(const a in s)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var vx={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 bx=x.forwardRef(({color:s="currentColor",size:a=24,strokeWidth:r=2,absoluteStrokeWidth:l,className:c="",children:d,iconNode:h,...m},y)=>x.createElement("svg",{ref:y,...vx,width:a,height:a,stroke:s,strokeWidth:l?Number(r)*24/Number(a):r,className:xy("lucide",c),...!d&&!yx(m)&&{"aria-hidden":"true"},...m},[...h.map(([p,g])=>x.createElement(p,g)),...Array.isArray(d)?d:[d]]));const re=(s,a)=>{const r=x.forwardRef(({className:l,...c},d)=>x.createElement(bx,{ref:d,iconNode:a,className:xy(`lucide-${px(wg(s))}`,`lucide-${s}`,l),...c}));return r.displayName=wg(s),r};const xx=[["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"}]],wx=re("activity",xx);const _x=[["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"}]],Sx=re("archive",_x);const jx=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Nx=re("arrow-down",jx);const Ex=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Tx=re("arrow-left",Ex);const Ax=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Cx=re("arrow-up",Ax);const kx=[["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"}]],Vi=re("brain",kx);const Ox=[["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"}]],Rx=re("calendar",Ox);const Dx=[["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"}]],Mx=re("camera",Dx);const zx=[["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"}]],wy=re("chart-column",zx);const Ux=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Na=re("check",Ux);const Lx=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Bx=re("chevron-down",Lx);const qx=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],$x=re("chevron-left",qx);const Hx=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Vx=re("chevron-right",Hx);const Ix=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Gx=re("chevron-up",Ix);const Px=[["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"}]],zr=re("circle-alert",Px);const Kx=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Ii=re("circle-check-big",Kx);const Yx=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],uf=re("circle-check",Yx);const Jx=[["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"}]],Xx=re("circle-user",Jx);const Qx=[["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"}]],Zx=re("circle-x",Qx);const Fx=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Rr=re("clock",Fx);const Wx=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],Ls=re("code",Wx);const ew=[["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"}]],tw=re("copy",ew);const aw=[["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"}]],df=re("cpu",aw);const sw=[["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"}]],Gi=re("database",sw);const nw=[["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"}]],Pi=re("external-link",nw);const rw=[["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"}]],iw=re("eye",rw);const lw=[["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"}]],ow=re("flag",lw);const cw=[["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"}]],uw=re("hash",cw);const dw=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Dr=re("info",dw);const fw=[["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"}]],hw=re("key-round",fw);const mw=[["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"}]],pw=re("key",mw);const gw=[["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"}]],yw=re("layout-dashboard",gw);const vw=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],$t=re("loader-circle",vw);const bw=[["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"}]],xw=re("log-in",bw);const ww=[["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"}]],_w=re("log-out",ww);const Sw=[["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"}]],qd=re("mail",Sw);const jw=[["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"}]],Nw=re("minimize-2",jw);const Ew=[["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"}]],Tw=re("moon",Ew);const Aw=[["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"}]],_g=re("paperclip",Aw);const Cw=[["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"}]],bd=re("pen",Cw);const kw=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],zi=re("plus",kw);const Ow=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],xo=re("power",Ow);const Rw=[["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"}]],qs=re("refresh-cw",Rw);const Dw=[["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"}]],_y=re("rotate-ccw",Dw);const Mw=[["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"}]],zw=re("save",Mw);const Uw=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Lw=re("search",Uw);const Bw=[["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"}]],qw=re("send",Bw);const $w=[["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"}]],$d=re("settings",$w);const Hw=[["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"}]],Vw=re("settings-2",Hw);const Iw=[["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"}]],Hd=re("shield-check",Iw);const Gw=[["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"}]],Pw=re("shield",Gw);const Kw=[["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"}]],Yw=re("sun",Kw);const Jw=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Vd=re("terminal",Jw);const Xw=[["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"}]],Lo=re("trash-2",Xw);const Qw=[["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"}]],Mr=re("triangle-alert",Qw);const Zw=[["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"}]],Fw=re("upload",Zw);const Ww=[["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"}]],e_=re("user-plus",Ww);const t_=[["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"}]],Sy=re("user",t_);const a_=[["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"}]],s_=re("volume-2",a_);const n_=[["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"}]],r_=re("volume-x",n_);const i_=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],al=re("x",i_);const l_=[["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"}]],Bo=re("zap",l_),o_={theme:"system",setTheme:()=>null},jy=x.createContext(o_);function c_({children:s,defaultTheme:a="system",storageKey:r="vite-ui-theme"}){const[l,c]=x.useState(()=>localStorage.getItem(r)||a);x.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(jy.Provider,{value:d,children:s})}const u_=()=>{const s=x.useContext(jy);if(s===void 0)throw new Error("useTheme must be used within a ThemeProvider");return s};function Sg(s,a){if(typeof s=="function")return s(a);s!=null&&(s.current=a)}function Po(...s){return a=>{let r=!1;const l=s.map(c=>{const d=Sg(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():Sg(s[c],null)}}}}function wn(...s){return x.useCallback(Po(...s),s)}var d_=Symbol.for("react.lazy"),qo=cf[" use ".trim().toString()];function f_(s){return typeof s=="object"&&s!==null&&"then"in s}function Ny(s){return s!=null&&typeof s=="object"&&"$$typeof"in s&&s.$$typeof===d_&&"_payload"in s&&f_(s._payload)}function Ey(s){const a=m_(s),r=x.forwardRef((l,c)=>{let{children:d,...h}=l;Ny(d)&&typeof qo=="function"&&(d=qo(d._payload));const m=x.Children.toArray(d),y=m.find(g_);if(y){const p=y.props.children,g=m.map(w=>w===y?x.Children.count(p)>1?x.Children.only(null):x.isValidElement(p)?p.props.children:null:w);return o.jsx(a,{...h,ref:c,children:x.isValidElement(p)?x.cloneElement(p,void 0,g):null})}return o.jsx(a,{...h,ref:c,children:d})});return r.displayName=`${s}.Slot`,r}var h_=Ey("Slot");function m_(s){const a=x.forwardRef((r,l)=>{let{children:c,...d}=r;if(Ny(c)&&typeof qo=="function"&&(c=qo(c._payload)),x.isValidElement(c)){const h=v_(c),m=y_(d,c.props);return c.type!==x.Fragment&&(m.ref=l?Po(l,h):h),x.cloneElement(c,m)}return x.Children.count(c)>1?x.Children.only(null):null});return a.displayName=`${s}.SlotClone`,a}var p_=Symbol("radix.slottable");function g_(s){return x.isValidElement(s)&&typeof s.type=="function"&&"__radixId"in s.type&&s.type.__radixId===p_}function y_(s,a){const r={...a};for(const l in a){const c=s[l],d=a[l];/^on[A-Z]/.test(l)?c&&d?r[l]=(...m)=>{const y=d(...m);return c(...m),y}:c&&(r[l]=c):l==="style"?r[l]={...c,...d}:l==="className"&&(r[l]=[c,d].filter(Boolean).join(" "))}return{...s,...r}}function v_(s){let a=Object.getOwnPropertyDescriptor(s.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?s.ref:(a=Object.getOwnPropertyDescriptor(s,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?s.props.ref:s.props.ref||s.ref)}function Ty(s){var a,r,l="";if(typeof s=="string"||typeof s=="number")l+=s;else if(typeof s=="object")if(Array.isArray(s)){var c=s.length;for(a=0;a<c;a++)s[a]&&(r=Ty(s[a]))&&(l&&(l+=" "),l+=r)}else for(r in s)s[r]&&(l&&(l+=" "),l+=r);return l}function Ay(){for(var s,a,r=0,l="",c=arguments.length;r<c;r++)(s=arguments[r])&&(a=Ty(s))&&(l&&(l+=" "),l+=a);return l}const jg=s=>typeof s=="boolean"?`${s}`:s===0?"0":s,Ng=Ay,Cy=(s,a)=>r=>{var l;if(a?.variants==null)return Ng(s,r?.class,r?.className);const{variants:c,defaultVariants:d}=a,h=Object.keys(c).map(p=>{const g=r?.[p],w=d?.[p];if(g===null)return null;const _=jg(g)||jg(w);return c[p][_]}),m=r&&Object.entries(r).reduce((p,g)=>{let[w,_]=g;return _===void 0||(p[w]=_),p},{}),y=a==null||(l=a.compoundVariants)===null||l===void 0?void 0:l.reduce((p,g)=>{let{class:w,className:_,...S}=g;return Object.entries(S).every(E=>{let[j,R]=E;return Array.isArray(R)?R.includes({...d,...m}[j]):{...d,...m}[j]===R})?[...p,w,_]:p},[]);return Ng(s,h,y,r?.class,r?.className)},b_=(s,a)=>{const r=new Array(s.length+a.length);for(let l=0;l<s.length;l++)r[l]=s[l];for(let l=0;l<a.length;l++)r[s.length+l]=a[l];return r},x_=(s,a)=>({classGroupId:s,validator:a}),ky=(s=new Map,a=null,r)=>({nextPart:s,validators:a,classGroupId:r}),$o="-",Eg=[],w_="arbitrary..",__=s=>{const a=j_(s),{conflictingClassGroups:r,conflictingClassGroupModifiers:l}=s;return{getClassGroupId:h=>{if(h.startsWith("[")&&h.endsWith("]"))return S_(h);const m=h.split($o),y=m[0]===""&&m.length>1?1:0;return Oy(m,y,a)},getConflictingClassGroupIds:(h,m)=>{if(m){const y=l[h],p=r[h];return y?p?b_(p,y):y:p||Eg}return r[h]||Eg}}},Oy=(s,a,r)=>{if(s.length-a===0)return r.classGroupId;const c=s[a],d=r.nextPart.get(c);if(d){const p=Oy(s,a+1,d);if(p)return p}const h=r.validators;if(h===null)return;const m=a===0?s.join($o):s.slice(a).join($o),y=h.length;for(let p=0;p<y;p++){const g=h[p];if(g.validator(m))return g.classGroupId}},S_=s=>s.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const a=s.slice(1,-1),r=a.indexOf(":"),l=a.slice(0,r);return l?w_+l:void 0})(),j_=s=>{const{theme:a,classGroups:r}=s;return N_(r,a)},N_=(s,a)=>{const r=ky();for(const l in s){const c=s[l];ff(c,r,l,a)}return r},ff=(s,a,r,l)=>{const c=s.length;for(let d=0;d<c;d++){const h=s[d];E_(h,a,r,l)}},E_=(s,a,r,l)=>{if(typeof s=="string"){T_(s,a,r);return}if(typeof s=="function"){A_(s,a,r,l);return}C_(s,a,r,l)},T_=(s,a,r)=>{const l=s===""?a:Ry(a,s);l.classGroupId=r},A_=(s,a,r,l)=>{if(k_(s)){ff(s(l),a,r,l);return}a.validators===null&&(a.validators=[]),a.validators.push(x_(r,s))},C_=(s,a,r,l)=>{const c=Object.entries(s),d=c.length;for(let h=0;h<d;h++){const[m,y]=c[h];ff(y,Ry(a,m),r,l)}},Ry=(s,a)=>{let r=s;const l=a.split($o),c=l.length;for(let d=0;d<c;d++){const h=l[d];let m=r.nextPart.get(h);m||(m=ky(),r.nextPart.set(h,m)),r=m}return r},k_=s=>"isThemeGetter"in s&&s.isThemeGetter===!0,O_=s=>{if(s<1)return{get:()=>{},set:()=>{}};let a=0,r=Object.create(null),l=Object.create(null);const c=(d,h)=>{r[d]=h,a++,a>s&&(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)}}},Id="!",Tg=":",R_=[],Ag=(s,a,r,l,c)=>({modifiers:s,hasImportantModifier:a,baseClassName:r,maybePostfixModifierPosition:l,isExternal:c}),D_=s=>{const{prefix:a,experimentalParseClassName:r}=s;let l=c=>{const d=[];let h=0,m=0,y=0,p;const g=c.length;for(let j=0;j<g;j++){const R=c[j];if(h===0&&m===0){if(R===Tg){d.push(c.slice(y,j)),y=j+1;continue}if(R==="/"){p=j;continue}}R==="["?h++:R==="]"?h--:R==="("?m++:R===")"&&m--}const w=d.length===0?c:c.slice(y);let _=w,S=!1;w.endsWith(Id)?(_=w.slice(0,-1),S=!0):w.startsWith(Id)&&(_=w.slice(1),S=!0);const E=p&&p>y?p-y:void 0;return Ag(d,S,_,E)};if(a){const c=a+Tg,d=l;l=h=>h.startsWith(c)?d(h.slice(c.length)):Ag(R_,!1,h,void 0,!0)}if(r){const c=l;l=d=>r({className:d,parseClassName:c})}return l},M_=s=>{const a=new Map;return s.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]==="[",y=a.has(h);m||y?(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}},z_=s=>({cache:O_(s.cacheSize),parseClassName:D_(s),sortModifiers:M_(s),...__(s)}),U_=/\s+/,L_=(s,a)=>{const{parseClassName:r,getClassGroupId:l,getConflictingClassGroupIds:c,sortModifiers:d}=a,h=[],m=s.trim().split(U_);let y="";for(let p=m.length-1;p>=0;p-=1){const g=m[p],{isExternal:w,modifiers:_,hasImportantModifier:S,baseClassName:E,maybePostfixModifierPosition:j}=r(g);if(w){y=g+(y.length>0?" "+y:y);continue}let R=!!j,D=l(R?E.substring(0,j):E);if(!D){if(!R){y=g+(y.length>0?" "+y:y);continue}if(D=l(E),!D){y=g+(y.length>0?" "+y:y);continue}R=!1}const B=_.length===0?"":_.length===1?_[0]:d(_).join(":"),q=S?B+Id:B,P=q+D;if(h.indexOf(P)>-1)continue;h.push(P);const W=c(D,R);for(let Y=0;Y<W.length;++Y){const H=W[Y];h.push(q+H)}y=g+(y.length>0?" "+y:y)}return y},B_=(...s)=>{let a=0,r,l,c="";for(;a<s.length;)(r=s[a++])&&(l=Dy(r))&&(c&&(c+=" "),c+=l);return c},Dy=s=>{if(typeof s=="string")return s;let a,r="";for(let l=0;l<s.length;l++)s[l]&&(a=Dy(s[l]))&&(r&&(r+=" "),r+=a);return r},q_=(s,...a)=>{let r,l,c,d;const h=y=>{const p=a.reduce((g,w)=>w(g),s());return r=z_(p),l=r.cache.get,c=r.cache.set,d=m,m(y)},m=y=>{const p=l(y);if(p)return p;const g=L_(y,r);return c(y,g),g};return d=h,(...y)=>d(B_(...y))},$_=[],ft=s=>{const a=r=>r[s]||$_;return a.isThemeGetter=!0,a},My=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,zy=/^\((?:(\w[\w-]*):)?(.+)\)$/i,H_=/^\d+\/\d+$/,V_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,I_=/\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$/,G_=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,P_=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,K_=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,pr=s=>H_.test(s),we=s=>!!s&&!Number.isNaN(Number(s)),Ds=s=>!!s&&Number.isInteger(Number(s)),xd=s=>s.endsWith("%")&&we(s.slice(0,-1)),es=s=>V_.test(s),Y_=()=>!0,J_=s=>I_.test(s)&&!G_.test(s),Uy=()=>!1,X_=s=>P_.test(s),Q_=s=>K_.test(s),Z_=s=>!se(s)&&!ne(s),F_=s=>Ur(s,qy,Uy),se=s=>My.test(s),un=s=>Ur(s,$y,J_),wd=s=>Ur(s,s1,we),Cg=s=>Ur(s,Ly,Uy),W_=s=>Ur(s,By,Q_),wo=s=>Ur(s,Hy,X_),ne=s=>zy.test(s),Ui=s=>Lr(s,$y),e1=s=>Lr(s,n1),kg=s=>Lr(s,Ly),t1=s=>Lr(s,qy),a1=s=>Lr(s,By),_o=s=>Lr(s,Hy,!0),Ur=(s,a,r)=>{const l=My.exec(s);return l?l[1]?a(l[1]):r(l[2]):!1},Lr=(s,a,r=!1)=>{const l=zy.exec(s);return l?l[1]?a(l[1]):r:!1},Ly=s=>s==="position"||s==="percentage",By=s=>s==="image"||s==="url",qy=s=>s==="length"||s==="size"||s==="bg-size",$y=s=>s==="length",s1=s=>s==="number",n1=s=>s==="family-name",Hy=s=>s==="shadow",r1=()=>{const s=ft("color"),a=ft("font"),r=ft("text"),l=ft("font-weight"),c=ft("tracking"),d=ft("leading"),h=ft("breakpoint"),m=ft("container"),y=ft("spacing"),p=ft("radius"),g=ft("shadow"),w=ft("inset-shadow"),_=ft("text-shadow"),S=ft("drop-shadow"),E=ft("blur"),j=ft("perspective"),R=ft("aspect"),D=ft("ease"),B=ft("animate"),q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],P=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],W=()=>[...P(),ne,se],Y=()=>["auto","hidden","clip","visible","scroll"],H=()=>["auto","contain","none"],Q=()=>[ne,se,y],le=()=>[pr,"full","auto",...Q()],qe=()=>[Ds,"none","subgrid",ne,se],he=()=>["auto",{span:["full",Ds,ne,se]},Ds,ne,se],ce=()=>[Ds,"auto",ne,se],Ze=()=>["auto","min","max","fr",ne,se],st=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],$e=()=>["start","end","center","stretch","center-safe","end-safe"],C=()=>["auto",...Q()],J=()=>[pr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...Q()],K=()=>[s,ne,se],_e=()=>[...P(),kg,Cg,{position:[ne,se]}],je=()=>["no-repeat",{repeat:["","x","y","space","round"]}],A=()=>["auto","cover","contain",t1,F_,{size:[ne,se]}],I=()=>[xd,Ui,un],X=()=>["","none","full",p,ne,se],F=()=>["",we,Ui,un],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=()=>[we,xd,kg,Cg],Pe=()=>["","none",E,ne,se],Ue=()=>["none",we,ne,se],Ct=()=>["none",we,ne,se],pt=()=>[we,ne,se],xt=()=>[pr,"full",...Q()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[es],breakpoint:[es],color:[Y_],container:[es],"drop-shadow":[es],ease:["in","out","in-out"],font:[Z_],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[es],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[es],shadow:[es],spacing:["px",we],text:[es],"text-shadow":[es],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",pr,se,ne,R]}],container:["container"],columns:[{columns:[we,se,ne,m]}],"break-after":[{"break-after":q()}],"break-before":[{"break-before":q()}],"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:W()}],overflow:[{overflow:Y()}],"overflow-x":[{"overflow-x":Y()}],"overflow-y":[{"overflow-y":Y()}],overscroll:[{overscroll:H()}],"overscroll-x":[{"overscroll-x":H()}],"overscroll-y":[{"overscroll-y":H()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:le()}],"inset-x":[{"inset-x":le()}],"inset-y":[{"inset-y":le()}],start:[{start:le()}],end:[{end:le()}],top:[{top:le()}],right:[{right:le()}],bottom:[{bottom:le()}],left:[{left:le()}],visibility:["visible","invisible","collapse"],z:[{z:[Ds,"auto",ne,se]}],basis:[{basis:[pr,"full","auto",m,...Q()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[we,pr,"auto","initial","none",se]}],grow:[{grow:["",we,ne,se]}],shrink:[{shrink:["",we,ne,se]}],order:[{order:[Ds,"first","last","none",ne,se]}],"grid-cols":[{"grid-cols":qe()}],"col-start-end":[{col:he()}],"col-start":[{"col-start":ce()}],"col-end":[{"col-end":ce()}],"grid-rows":[{"grid-rows":qe()}],"row-start-end":[{row:he()}],"row-start":[{"row-start":ce()}],"row-end":[{"row-end":ce()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Ze()}],"auto-rows":[{"auto-rows":Ze()}],gap:[{gap:Q()}],"gap-x":[{"gap-x":Q()}],"gap-y":[{"gap-y":Q()}],"justify-content":[{justify:[...st(),"normal"]}],"justify-items":[{"justify-items":[...$e(),"normal"]}],"justify-self":[{"justify-self":["auto",...$e()]}],"align-content":[{content:["normal",...st()]}],"align-items":[{items:[...$e(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...$e(),{baseline:["","last"]}]}],"place-content":[{"place-content":st()}],"place-items":[{"place-items":[...$e(),"baseline"]}],"place-self":[{"place-self":["auto",...$e()]}],p:[{p:Q()}],px:[{px:Q()}],py:[{py:Q()}],ps:[{ps:Q()}],pe:[{pe:Q()}],pt:[{pt:Q()}],pr:[{pr:Q()}],pb:[{pb:Q()}],pl:[{pl:Q()}],m:[{m:C()}],mx:[{mx:C()}],my:[{my:C()}],ms:[{ms:C()}],me:[{me:C()}],mt:[{mt:C()}],mr:[{mr:C()}],mb:[{mb:C()}],ml:[{ml:C()}],"space-x":[{"space-x":Q()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":Q()}],"space-y-reverse":["space-y-reverse"],size:[{size:J()}],w:[{w:[m,"screen",...J()]}],"min-w":[{"min-w":[m,"screen","none",...J()]}],"max-w":[{"max-w":[m,"screen","none","prose",{screen:[h]},...J()]}],h:[{h:["screen","lh",...J()]}],"min-h":[{"min-h":["screen","lh","none",...J()]}],"max-h":[{"max-h":["screen","lh",...J()]}],"font-size":[{text:["base",r,Ui,un]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[l,ne,wd]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",xd,se]}],"font-family":[{font:[e1,se,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,ne,se]}],"line-clamp":[{"line-clamp":[we,"none",ne,wd]}],leading:[{leading:[d,...Q()]}],"list-image":[{"list-image":["none",ne,se]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ne,se]}],"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:[we,"from-font","auto",ne,un]}],"text-decoration-color":[{decoration:K()}],"underline-offset":[{"underline-offset":[we,"auto",ne,se]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:Q()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ne,se]}],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",ne,se]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:_e()}],"bg-repeat":[{bg:je()}],"bg-size":[{bg:A()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ds,ne,se],radial:["",ne,se],conic:[Ds,ne,se]},a1,W_]}],"bg-color":[{bg:K()}],"gradient-from-pos":[{from:I()}],"gradient-via-pos":[{via:I()}],"gradient-to-pos":[{to:I()}],"gradient-from":[{from:K()}],"gradient-via":[{via:K()}],"gradient-to":[{to:K()}],rounded:[{rounded:X()}],"rounded-s":[{"rounded-s":X()}],"rounded-e":[{"rounded-e":X()}],"rounded-t":[{"rounded-t":X()}],"rounded-r":[{"rounded-r":X()}],"rounded-b":[{"rounded-b":X()}],"rounded-l":[{"rounded-l":X()}],"rounded-ss":[{"rounded-ss":X()}],"rounded-se":[{"rounded-se":X()}],"rounded-ee":[{"rounded-ee":X()}],"rounded-es":[{"rounded-es":X()}],"rounded-tl":[{"rounded-tl":X()}],"rounded-tr":[{"rounded-tr":X()}],"rounded-br":[{"rounded-br":X()}],"rounded-bl":[{"rounded-bl":X()}],"border-w":[{border:F()}],"border-w-x":[{"border-x":F()}],"border-w-y":[{"border-y":F()}],"border-w-s":[{"border-s":F()}],"border-w-e":[{"border-e":F()}],"border-w-t":[{"border-t":F()}],"border-w-r":[{"border-r":F()}],"border-w-b":[{"border-b":F()}],"border-w-l":[{"border-l":F()}],"divide-x":[{"divide-x":F()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":F()}],"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":[we,ne,se]}],"outline-w":[{outline:["",we,Ui,un]}],"outline-color":[{outline:K()}],shadow:[{shadow:["","none",g,_o,wo]}],"shadow-color":[{shadow:K()}],"inset-shadow":[{"inset-shadow":["none",w,_o,wo]}],"inset-shadow-color":[{"inset-shadow":K()}],"ring-w":[{ring:F()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:K()}],"ring-offset-w":[{"ring-offset":[we,un]}],"ring-offset-color":[{"ring-offset":K()}],"inset-ring-w":[{"inset-ring":F()}],"inset-ring-color":[{"inset-ring":K()}],"text-shadow":[{"text-shadow":["none",_,_o,wo]}],"text-shadow-color":[{"text-shadow":K()}],opacity:[{opacity:[we,ne,se]}],"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":[we]}],"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":[ne,se]}],"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":P()}],"mask-image-conic-pos":[{"mask-conic":[we]}],"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:_e()}],"mask-repeat":[{mask:je()}],"mask-size":[{mask:A()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ne,se]}],filter:[{filter:["","none",ne,se]}],blur:[{blur:Pe()}],brightness:[{brightness:[we,ne,se]}],contrast:[{contrast:[we,ne,se]}],"drop-shadow":[{"drop-shadow":["","none",S,_o,wo]}],"drop-shadow-color":[{"drop-shadow":K()}],grayscale:[{grayscale:["",we,ne,se]}],"hue-rotate":[{"hue-rotate":[we,ne,se]}],invert:[{invert:["",we,ne,se]}],saturate:[{saturate:[we,ne,se]}],sepia:[{sepia:["",we,ne,se]}],"backdrop-filter":[{"backdrop-filter":["","none",ne,se]}],"backdrop-blur":[{"backdrop-blur":Pe()}],"backdrop-brightness":[{"backdrop-brightness":[we,ne,se]}],"backdrop-contrast":[{"backdrop-contrast":[we,ne,se]}],"backdrop-grayscale":[{"backdrop-grayscale":["",we,ne,se]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[we,ne,se]}],"backdrop-invert":[{"backdrop-invert":["",we,ne,se]}],"backdrop-opacity":[{"backdrop-opacity":[we,ne,se]}],"backdrop-saturate":[{"backdrop-saturate":[we,ne,se]}],"backdrop-sepia":[{"backdrop-sepia":["",we,ne,se]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":Q()}],"border-spacing-x":[{"border-spacing-x":Q()}],"border-spacing-y":[{"border-spacing-y":Q()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ne,se]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[we,"initial",ne,se]}],ease:[{ease:["linear","initial",D,ne,se]}],delay:[{delay:[we,ne,se]}],animate:[{animate:["none",B,ne,se]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[j,ne,se]}],"perspective-origin":[{"perspective-origin":W()}],rotate:[{rotate:Ue()}],"rotate-x":[{"rotate-x":Ue()}],"rotate-y":[{"rotate-y":Ue()}],"rotate-z":[{"rotate-z":Ue()}],scale:[{scale:Ct()}],"scale-x":[{"scale-x":Ct()}],"scale-y":[{"scale-y":Ct()}],"scale-z":[{"scale-z":Ct()}],"scale-3d":["scale-3d"],skew:[{skew:pt()}],"skew-x":[{"skew-x":pt()}],"skew-y":[{"skew-y":pt()}],transform:[{transform:[ne,se,"","none","gpu","cpu"]}],"transform-origin":[{origin:W()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:xt()}],"translate-x":[{"translate-x":xt()}],"translate-y":[{"translate-y":xt()}],"translate-z":[{"translate-z":xt()}],"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",ne,se]}],"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":Q()}],"scroll-mx":[{"scroll-mx":Q()}],"scroll-my":[{"scroll-my":Q()}],"scroll-ms":[{"scroll-ms":Q()}],"scroll-me":[{"scroll-me":Q()}],"scroll-mt":[{"scroll-mt":Q()}],"scroll-mr":[{"scroll-mr":Q()}],"scroll-mb":[{"scroll-mb":Q()}],"scroll-ml":[{"scroll-ml":Q()}],"scroll-p":[{"scroll-p":Q()}],"scroll-px":[{"scroll-px":Q()}],"scroll-py":[{"scroll-py":Q()}],"scroll-ps":[{"scroll-ps":Q()}],"scroll-pe":[{"scroll-pe":Q()}],"scroll-pt":[{"scroll-pt":Q()}],"scroll-pr":[{"scroll-pr":Q()}],"scroll-pb":[{"scroll-pb":Q()}],"scroll-pl":[{"scroll-pl":Q()}],"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",ne,se]}],fill:[{fill:["none",...K()]}],"stroke-w":[{stroke:[we,Ui,un,wd]}],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"]}},i1=q_(r1);function Oe(...s){return i1(Ay(s))}const l1=Cy("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=x.forwardRef(({className:s,variant:a,size:r,asChild:l=!1,...c},d)=>{const h=l?h_:"button";return o.jsx(h,{className:Oe(l1({variant:a,size:r,className:s})),ref:d,...c})});Z.displayName="Button";function Vy(){const{setTheme:s,theme:a}=u_();return o.jsxs(Z,{variant:"ghost",size:"sm",onClick:()=>s(a==="dark"?"light":"dark"),className:"text-muted-foreground hover:text-foreground w-8 px-0",title:`Switch to ${a==="dark"?"light":"dark"} mode`,children:[a==="dark"?o.jsx(Yw,{className:"h-[1.2rem] w-[1.2rem]"}):o.jsx(Tw,{className:"h-[1.2rem] w-[1.2rem]"}),o.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}var Ea=function(){return Ea=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},Ea.apply(this,arguments)};function Br(s,a){var r={};for(var l in s)Object.prototype.hasOwnProperty.call(s,l)&&a.indexOf(l)<0&&(r[l]=s[l]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,l=Object.getOwnPropertySymbols(s);c<l.length;c++)a.indexOf(l[c])<0&&Object.prototype.propertyIsEnumerable.call(s,l[c])&&(r[l[c]]=s[l[c]]);return r}function o1(s,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(g){try{p(l.next(g))}catch(w){h(w)}}function y(g){try{p(l.throw(g))}catch(w){h(w)}}function p(g){g.done?d(g.value):c(g.value).then(m,y)}p((l=l.apply(s,a||[])).next())})}function c1(s,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 s.concat(d||Array.prototype.slice.call(a))}const u1=s=>s?(...a)=>s(...a):(...a)=>fetch(...a);class hf extends Error{constructor(a,r="FunctionsError",l){super(a),this.name=r,this.context=l}}class d1 extends hf{constructor(a){super("Failed to send a request to the Edge Function","FunctionsFetchError",a)}}class Og extends hf{constructor(a){super("Relay Error invoking the Edge Function","FunctionsRelayError",a)}}class Rg extends hf{constructor(a){super("Edge Function returned a non-2xx status code","FunctionsHttpError",a)}}var Gd;(function(s){s.Any="any",s.ApNortheast1="ap-northeast-1",s.ApNortheast2="ap-northeast-2",s.ApSouth1="ap-south-1",s.ApSoutheast1="ap-southeast-1",s.ApSoutheast2="ap-southeast-2",s.CaCentral1="ca-central-1",s.EuCentral1="eu-central-1",s.EuWest1="eu-west-1",s.EuWest2="eu-west-2",s.EuWest3="eu-west-3",s.SaEast1="sa-east-1",s.UsEast1="us-east-1",s.UsWest1="us-west-1",s.UsWest2="us-west-2"})(Gd||(Gd={}));class f1{constructor(a,{headers:r={},customFetch:l,region:c=Gd.Any}={}){this.url=a,this.headers=r,this.region=c,this.fetch=u1(l)}setAuth(a){this.headers.Authorization=`Bearer ${a}`}invoke(a){return o1(this,arguments,void 0,function*(r,l={}){var c;let d,h;try{const{headers:m,method:y,body:p,signal:g,timeout:w}=l;let _={},{region:S}=l;S||(S=this.region);const E=new URL(`${this.url}/${r}`);S&&S!=="any"&&(_["x-region"]=S,E.searchParams.set("forceFunctionRegion",S));let j;p&&(m&&!Object.prototype.hasOwnProperty.call(m,"Content-Type")||!m)?typeof Blob<"u"&&p instanceof Blob||p instanceof ArrayBuffer?(_["Content-Type"]="application/octet-stream",j=p):typeof p=="string"?(_["Content-Type"]="text/plain",j=p):typeof FormData<"u"&&p instanceof FormData?j=p:(_["Content-Type"]="application/json",j=JSON.stringify(p)):p&&typeof p!="string"&&!(typeof Blob<"u"&&p instanceof Blob)&&!(p instanceof ArrayBuffer)&&!(typeof FormData<"u"&&p instanceof FormData)?j=JSON.stringify(p):j=p;let R=g;w&&(h=new AbortController,d=setTimeout(()=>h.abort(),w),g?(R=h.signal,g.addEventListener("abort",()=>h.abort())):R=h.signal);const D=yield this.fetch(E.toString(),{method:y||"POST",headers:Object.assign(Object.assign(Object.assign({},_),this.headers),m),body:j,signal:R}).catch(W=>{throw new d1(W)}),B=D.headers.get("x-relay-error");if(B&&B==="true")throw new Og(D);if(!D.ok)throw new Rg(D);let q=((c=D.headers.get("Content-Type"))!==null&&c!==void 0?c:"text/plain").split(";")[0].trim(),P;return q==="application/json"?P=yield D.json():q==="application/octet-stream"||q==="application/pdf"?P=yield D.blob():q==="text/event-stream"?P=D:q==="multipart/form-data"?P=yield D.formData():P=yield D.text(),{data:P,error:null,response:D}}catch(m){return{data:null,error:m,response:m instanceof Rg||m instanceof Og?m.context:void 0}}finally{d&&clearTimeout(d)}})}}var h1=class extends Error{constructor(s){super(s.message),this.name="PostgrestError",this.details=s.details,this.hint=s.hint,this.code=s.code}},m1=class{constructor(s){var a,r;this.shouldThrowOnError=!1,this.method=s.method,this.url=s.url,this.headers=new Headers(s.headers),this.schema=s.schema,this.body=s.body,this.shouldThrowOnError=(a=s.shouldThrowOnError)!==null&&a!==void 0?a:!1,this.signal=s.signal,this.isMaybeSingle=(r=s.isMaybeSingle)!==null&&r!==void 0?r:!1,s.fetch?this.fetch=s.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(s,a){return this.headers=new Headers(this.headers),this.headers.set(s,a),this}then(s,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,y=null,p=d.status,g=d.statusText;if(d.ok){var w,_;if(r.method!=="HEAD"){var S;const D=await d.text();D===""||(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=D:m=JSON.parse(D))}const j=(w=r.headers.get("Prefer"))===null||w===void 0?void 0:w.match(/count=(exact|planned|estimated)/),R=(_=d.headers.get("content-range"))===null||_===void 0?void 0:_.split("/");j&&R&&R.length>1&&(y=parseInt(R[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,y=null,p=406,g="Not Acceptable"):m.length===1?m=m[0]:m=null)}else{var E;const j=await d.text();try{h=JSON.parse(j),Array.isArray(h)&&d.status===404&&(m=[],h=null,p=200,g="OK")}catch{d.status===404&&j===""?(p=204,g="No Content"):h={message:j}}if(h&&r.isMaybeSingle&&(!(h==null||(E=h.details)===null||E===void 0)&&E.includes("0 rows"))&&(h=null,p=200,g="OK"),h&&r.shouldThrowOnError)throw new h1(h)}return{error:h,data:m,count:y,status:p,statusText:g}});return this.shouldThrowOnError||(c=c.catch(d=>{var h;let m="";const y=d?.cause;if(y){var p,g,w,_;const E=(p=y?.message)!==null&&p!==void 0?p:"",j=(g=y?.code)!==null&&g!==void 0?g:"";m=`${(w=d?.name)!==null&&w!==void 0?w:"FetchError"}: ${d?.message}`,m+=`
10
10
 
11
11
  Caused by: ${(_=y?.name)!==null&&_!==void 0?_:"Error"}: ${E}`,j&&(m+=` (${j})`),y?.stack&&(m+=`
12
- ${y.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(s,a)}returns(){return this}overrideTypes(){return this}},h1=class extends f1{select(s){let a=!1;const r=(s??"*").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(s,{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},`:""}${s}.${a?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(s,{foreignTable:a,referencedTable:r=a}={}){const l=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(l,`${s}`),this}range(s,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,`${s}`),this.url.searchParams.set(d,`${a-s+1}`),this}abortSignal(s){return this.signal=s,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:s=!1,verbose:a=!1,settings:r=!1,buffers:l=!1,wal:c=!1,format:d="text"}={}){var h;const m=[s?"analyze":null,a?"verbose":null,r?"settings":null,l?"buffers":null,c?"wal":null].filter(Boolean).join("|"),y=(h=this.headers.get("Accept"))!==null&&h!==void 0?h:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${d}; for="${y}"; options=${m};`),d==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(s){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${s}`),this}};const Rg=new RegExp("[,()]");var jr=class extends h1{eq(s,a){return this.url.searchParams.append(s,`eq.${a}`),this}neq(s,a){return this.url.searchParams.append(s,`neq.${a}`),this}gt(s,a){return this.url.searchParams.append(s,`gt.${a}`),this}gte(s,a){return this.url.searchParams.append(s,`gte.${a}`),this}lt(s,a){return this.url.searchParams.append(s,`lt.${a}`),this}lte(s,a){return this.url.searchParams.append(s,`lte.${a}`),this}like(s,a){return this.url.searchParams.append(s,`like.${a}`),this}likeAllOf(s,a){return this.url.searchParams.append(s,`like(all).{${a.join(",")}}`),this}likeAnyOf(s,a){return this.url.searchParams.append(s,`like(any).{${a.join(",")}}`),this}ilike(s,a){return this.url.searchParams.append(s,`ilike.${a}`),this}ilikeAllOf(s,a){return this.url.searchParams.append(s,`ilike(all).{${a.join(",")}}`),this}ilikeAnyOf(s,a){return this.url.searchParams.append(s,`ilike(any).{${a.join(",")}}`),this}regexMatch(s,a){return this.url.searchParams.append(s,`match.${a}`),this}regexIMatch(s,a){return this.url.searchParams.append(s,`imatch.${a}`),this}is(s,a){return this.url.searchParams.append(s,`is.${a}`),this}isDistinct(s,a){return this.url.searchParams.append(s,`isdistinct.${a}`),this}in(s,a){const r=Array.from(new Set(a)).map(l=>typeof l=="string"&&Rg.test(l)?`"${l}"`:`${l}`).join(",");return this.url.searchParams.append(s,`in.(${r})`),this}notIn(s,a){const r=Array.from(new Set(a)).map(l=>typeof l=="string"&&Rg.test(l)?`"${l}"`:`${l}`).join(",");return this.url.searchParams.append(s,`not.in.(${r})`),this}contains(s,a){return typeof a=="string"?this.url.searchParams.append(s,`cs.${a}`):Array.isArray(a)?this.url.searchParams.append(s,`cs.{${a.join(",")}}`):this.url.searchParams.append(s,`cs.${JSON.stringify(a)}`),this}containedBy(s,a){return typeof a=="string"?this.url.searchParams.append(s,`cd.${a}`):Array.isArray(a)?this.url.searchParams.append(s,`cd.{${a.join(",")}}`):this.url.searchParams.append(s,`cd.${JSON.stringify(a)}`),this}rangeGt(s,a){return this.url.searchParams.append(s,`sr.${a}`),this}rangeGte(s,a){return this.url.searchParams.append(s,`nxl.${a}`),this}rangeLt(s,a){return this.url.searchParams.append(s,`sl.${a}`),this}rangeLte(s,a){return this.url.searchParams.append(s,`nxr.${a}`),this}rangeAdjacent(s,a){return this.url.searchParams.append(s,`adj.${a}`),this}overlaps(s,a){return typeof a=="string"?this.url.searchParams.append(s,`ov.${a}`):this.url.searchParams.append(s,`ov.{${a.join(",")}}`),this}textSearch(s,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(s,`${c}fts${d}.${a}`),this}match(s){return Object.entries(s).forEach(([a,r])=>{this.url.searchParams.append(a,`eq.${r}`)}),this}not(s,a,r){return this.url.searchParams.append(s,`not.${a}.${r}`),this}or(s,{foreignTable:a,referencedTable:r=a}={}){const l=r?`${r}.or`:"or";return this.url.searchParams.append(l,`(${s})`),this}filter(s,a,r){return this.url.searchParams.append(s,`${a}.${r}`),this}},m1=class{constructor(s,{headers:a={},schema:r,fetch:l}){this.url=s,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(s,a){const{head:r=!1,count:l}=a??{},c=r?"HEAD":"GET";let d=!1;const h=(s??"*").split("").map(p=>/\s/.test(p)&&!d?"":(p==='"'&&(d=!d),p)).join(""),{url:m,headers:y}=this.cloneRequestState();return m.searchParams.set("select",h),l&&y.append("Prefer",`count=${l}`),new jr({method:c,url:m,headers:y,schema:this.schema,fetch:this.fetch})}insert(s,{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(s)){const m=s.reduce((y,p)=>y.concat(Object.keys(p)),[]);if(m.length>0){const y=[...new Set(m)].map(p=>`"${p}"`);d.searchParams.set("columns",y.join(","))}}return new jr({method:c,url:d,headers:h,schema:this.schema,body:s,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}upsert(s,{onConflict:a,ignoreDuplicates:r=!1,count:l,defaultToNull:c=!0}={}){var d;const h="POST",{url:m,headers:y}=this.cloneRequestState();if(y.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),a!==void 0&&m.searchParams.set("on_conflict",a),l&&y.append("Prefer",`count=${l}`),c||y.append("Prefer","missing=default"),Array.isArray(s)){const p=s.reduce((g,w)=>g.concat(Object.keys(w)),[]);if(p.length>0){const g=[...new Set(p)].map(w=>`"${w}"`);m.searchParams.set("columns",g.join(","))}}return new jr({method:h,url:m,headers:y,schema:this.schema,body:s,fetch:(d=this.fetch)!==null&&d!==void 0?d:fetch})}update(s,{count:a}={}){var r;const l="PATCH",{url:c,headers:d}=this.cloneRequestState();return a&&d.append("Prefer",`count=${a}`),new jr({method:l,url:c,headers:d,schema:this.schema,body:s,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}delete({count:s}={}){var a;const r="DELETE",{url:l,headers:c}=this.cloneRequestState();return s&&c.append("Prefer",`count=${s}`),new jr({method:r,url:l,headers:c,schema:this.schema,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}},p1=class $y{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 m1(new URL(`${this.url}/${a}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(a){return new $y(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 y=new URL(`${this.url}/rpc/${a}`);let p;const g=S=>S!==null&&typeof S=="object"&&(!Array.isArray(S)||S.some(g)),w=l&&Object.values(r).some(g);w?(m="POST",p=r):l||c?(m=l?"HEAD":"GET",Object.entries(r).filter(([S,E])=>E!==void 0).map(([S,E])=>[S,Array.isArray(E)?`{${E.join(",")}}`:`${E}`]).forEach(([S,E])=>{y.searchParams.append(S,E)})):(m="POST",p=r);const _=new Headers(this.headers);return w?_.set("Prefer",d?`count=${d},return=minimal`:"return=minimal"):d&&_.set("Prefer",`count=${d}`),new jr({method:m,url:y,headers:_,schema:this.schemaName,body:p,fetch:(h=this.fetch)!==null&&h!==void 0?h:fetch})}};class g1{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:
12
+ ${y.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(s,a)}returns(){return this}overrideTypes(){return this}},p1=class extends m1{select(s){let a=!1;const r=(s??"*").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(s,{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},`:""}${s}.${a?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(s,{foreignTable:a,referencedTable:r=a}={}){const l=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(l,`${s}`),this}range(s,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,`${s}`),this.url.searchParams.set(d,`${a-s+1}`),this}abortSignal(s){return this.signal=s,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:s=!1,verbose:a=!1,settings:r=!1,buffers:l=!1,wal:c=!1,format:d="text"}={}){var h;const m=[s?"analyze":null,a?"verbose":null,r?"settings":null,l?"buffers":null,c?"wal":null].filter(Boolean).join("|"),y=(h=this.headers.get("Accept"))!==null&&h!==void 0?h:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${d}; for="${y}"; options=${m};`),d==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(s){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${s}`),this}};const Dg=new RegExp("[,()]");var Nr=class extends p1{eq(s,a){return this.url.searchParams.append(s,`eq.${a}`),this}neq(s,a){return this.url.searchParams.append(s,`neq.${a}`),this}gt(s,a){return this.url.searchParams.append(s,`gt.${a}`),this}gte(s,a){return this.url.searchParams.append(s,`gte.${a}`),this}lt(s,a){return this.url.searchParams.append(s,`lt.${a}`),this}lte(s,a){return this.url.searchParams.append(s,`lte.${a}`),this}like(s,a){return this.url.searchParams.append(s,`like.${a}`),this}likeAllOf(s,a){return this.url.searchParams.append(s,`like(all).{${a.join(",")}}`),this}likeAnyOf(s,a){return this.url.searchParams.append(s,`like(any).{${a.join(",")}}`),this}ilike(s,a){return this.url.searchParams.append(s,`ilike.${a}`),this}ilikeAllOf(s,a){return this.url.searchParams.append(s,`ilike(all).{${a.join(",")}}`),this}ilikeAnyOf(s,a){return this.url.searchParams.append(s,`ilike(any).{${a.join(",")}}`),this}regexMatch(s,a){return this.url.searchParams.append(s,`match.${a}`),this}regexIMatch(s,a){return this.url.searchParams.append(s,`imatch.${a}`),this}is(s,a){return this.url.searchParams.append(s,`is.${a}`),this}isDistinct(s,a){return this.url.searchParams.append(s,`isdistinct.${a}`),this}in(s,a){const r=Array.from(new Set(a)).map(l=>typeof l=="string"&&Dg.test(l)?`"${l}"`:`${l}`).join(",");return this.url.searchParams.append(s,`in.(${r})`),this}notIn(s,a){const r=Array.from(new Set(a)).map(l=>typeof l=="string"&&Dg.test(l)?`"${l}"`:`${l}`).join(",");return this.url.searchParams.append(s,`not.in.(${r})`),this}contains(s,a){return typeof a=="string"?this.url.searchParams.append(s,`cs.${a}`):Array.isArray(a)?this.url.searchParams.append(s,`cs.{${a.join(",")}}`):this.url.searchParams.append(s,`cs.${JSON.stringify(a)}`),this}containedBy(s,a){return typeof a=="string"?this.url.searchParams.append(s,`cd.${a}`):Array.isArray(a)?this.url.searchParams.append(s,`cd.{${a.join(",")}}`):this.url.searchParams.append(s,`cd.${JSON.stringify(a)}`),this}rangeGt(s,a){return this.url.searchParams.append(s,`sr.${a}`),this}rangeGte(s,a){return this.url.searchParams.append(s,`nxl.${a}`),this}rangeLt(s,a){return this.url.searchParams.append(s,`sl.${a}`),this}rangeLte(s,a){return this.url.searchParams.append(s,`nxr.${a}`),this}rangeAdjacent(s,a){return this.url.searchParams.append(s,`adj.${a}`),this}overlaps(s,a){return typeof a=="string"?this.url.searchParams.append(s,`ov.${a}`):this.url.searchParams.append(s,`ov.{${a.join(",")}}`),this}textSearch(s,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(s,`${c}fts${d}.${a}`),this}match(s){return Object.entries(s).forEach(([a,r])=>{this.url.searchParams.append(a,`eq.${r}`)}),this}not(s,a,r){return this.url.searchParams.append(s,`not.${a}.${r}`),this}or(s,{foreignTable:a,referencedTable:r=a}={}){const l=r?`${r}.or`:"or";return this.url.searchParams.append(l,`(${s})`),this}filter(s,a,r){return this.url.searchParams.append(s,`${a}.${r}`),this}},g1=class{constructor(s,{headers:a={},schema:r,fetch:l}){this.url=s,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(s,a){const{head:r=!1,count:l}=a??{},c=r?"HEAD":"GET";let d=!1;const h=(s??"*").split("").map(p=>/\s/.test(p)&&!d?"":(p==='"'&&(d=!d),p)).join(""),{url:m,headers:y}=this.cloneRequestState();return m.searchParams.set("select",h),l&&y.append("Prefer",`count=${l}`),new Nr({method:c,url:m,headers:y,schema:this.schema,fetch:this.fetch})}insert(s,{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(s)){const m=s.reduce((y,p)=>y.concat(Object.keys(p)),[]);if(m.length>0){const y=[...new Set(m)].map(p=>`"${p}"`);d.searchParams.set("columns",y.join(","))}}return new Nr({method:c,url:d,headers:h,schema:this.schema,body:s,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}upsert(s,{onConflict:a,ignoreDuplicates:r=!1,count:l,defaultToNull:c=!0}={}){var d;const h="POST",{url:m,headers:y}=this.cloneRequestState();if(y.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),a!==void 0&&m.searchParams.set("on_conflict",a),l&&y.append("Prefer",`count=${l}`),c||y.append("Prefer","missing=default"),Array.isArray(s)){const p=s.reduce((g,w)=>g.concat(Object.keys(w)),[]);if(p.length>0){const g=[...new Set(p)].map(w=>`"${w}"`);m.searchParams.set("columns",g.join(","))}}return new Nr({method:h,url:m,headers:y,schema:this.schema,body:s,fetch:(d=this.fetch)!==null&&d!==void 0?d:fetch})}update(s,{count:a}={}){var r;const l="PATCH",{url:c,headers:d}=this.cloneRequestState();return a&&d.append("Prefer",`count=${a}`),new Nr({method:l,url:c,headers:d,schema:this.schema,body:s,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}delete({count:s}={}){var a;const r="DELETE",{url:l,headers:c}=this.cloneRequestState();return s&&c.append("Prefer",`count=${s}`),new Nr({method:r,url:l,headers:c,schema:this.schema,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}},y1=class Iy{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 g1(new URL(`${this.url}/${a}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(a){return new Iy(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 y=new URL(`${this.url}/rpc/${a}`);let p;const g=S=>S!==null&&typeof S=="object"&&(!Array.isArray(S)||S.some(g)),w=l&&Object.values(r).some(g);w?(m="POST",p=r):l||c?(m=l?"HEAD":"GET",Object.entries(r).filter(([S,E])=>E!==void 0).map(([S,E])=>[S,Array.isArray(E)?`{${E.join(",")}}`:`${E}`]).forEach(([S,E])=>{y.searchParams.append(S,E)})):(m="POST",p=r);const _=new Headers(this.headers);return w?_.set("Prefer",d?`count=${d},return=minimal`:"return=minimal"):d&&_.set("Prefer",`count=${d}`),new Nr({method:m,url:y,headers:_,schema:this.schemaName,body:p,fetch:(h=this.fetch)!==null&&h!==void 0?h:fetch})}};class v1{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
13
  import ws from "ws"
14
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
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 y1="2.90.1",v1=`realtime-js/${y1}`,Hy="1.0.0",b1="2.0.0",Dg=Hy,Gd=1e4,x1=1e3,w1=100;var zs;(function(s){s[s.connecting=0]="connecting",s[s.open=1]="open",s[s.closing=2]="closing",s[s.closed=3]="closed"})(zs||(zs={}));var ht;(function(s){s.closed="closed",s.errored="errored",s.joined="joined",s.joining="joining",s.leaving="leaving"})(ht||(ht={}));var ma;(function(s){s.close="phx_close",s.error="phx_error",s.join="phx_join",s.reply="phx_reply",s.leave="phx_leave",s.access_token="access_token"})(ma||(ma={}));var Pd;(function(s){s.websocket="websocket"})(Pd||(Pd={}));var mn;(function(s){s.Connecting="connecting",s.Open="open",s.Closing="closing",s.Closed="closed"})(mn||(mn={}));class _1{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:"",y=(d=a.join_ref)!==null&&d!==void 0?d:"",p=a.payload.event,g=this.allowedMetadataKeys?this._pick(a.payload,this.allowedMetadataKeys):{},w=Object.keys(g).length===0?"":JSON.stringify(g);if(y.length>255)throw new Error(`joinRef length ${y.length} exceeds maximum of 255`);if(m.length>255)throw new Error(`ref length ${m.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`topic length ${h.length} exceeds maximum of 255`);if(p.length>255)throw new Error(`userEvent length ${p.length} exceeds maximum of 255`);if(w.length>255)throw new Error(`metadata length ${w.length} exceeds maximum of 255`);const _=this.USER_BROADCAST_PUSH_META_LENGTH+y.length+m.length+h.length+p.length+w.length,S=new ArrayBuffer(this.HEADER_LENGTH+_);let E=new DataView(S),j=0;E.setUint8(j++,this.KINDS.userBroadcastPush),E.setUint8(j++,y.length),E.setUint8(j++,m.length),E.setUint8(j++,h.length),E.setUint8(j++,p.length),E.setUint8(j++,w.length),E.setUint8(j++,r),Array.from(y,D=>E.setUint8(j++,D.charCodeAt(0))),Array.from(m,D=>E.setUint8(j++,D.charCodeAt(0))),Array.from(h,D=>E.setUint8(j++,D.charCodeAt(0))),Array.from(p,D=>E.setUint8(j++,D.charCodeAt(0))),Array.from(w,D=>E.setUint8(j++,D.charCodeAt(0)));var R=new Uint8Array(S.byteLength+l.byteLength);return R.set(new Uint8Array(S),0),R.set(new Uint8Array(l),S.byteLength),R.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,y]=l;return r({join_ref:c,ref:d,topic:h,event:m,payload:y})}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 y=this.HEADER_LENGTH+4;const p=l.decode(a.slice(y,y+c));y=y+c;const g=l.decode(a.slice(y,y+d));y=y+d;const w=l.decode(a.slice(y,y+h));y=y+h;const _=a.slice(y,a.byteLength),S=m===this.JSON_ENCODING?JSON.parse(l.decode(_)):_,E={type:this.BROADCAST_EVENT,event:g,payload:S};return h>0&&(E.meta=JSON.parse(w)),{join_ref:null,ref:null,topic:p,event:this.BROADCAST_EVENT,payload:E}}_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 Vy{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 Je;(function(s){s.abstime="abstime",s.bool="bool",s.date="date",s.daterange="daterange",s.float4="float4",s.float8="float8",s.int2="int2",s.int4="int4",s.int4range="int4range",s.int8="int8",s.int8range="int8range",s.json="json",s.jsonb="jsonb",s.money="money",s.numeric="numeric",s.oid="oid",s.reltime="reltime",s.text="text",s.time="time",s.timestamp="timestamp",s.timestamptz="timestamptz",s.timetz="timetz",s.tsrange="tsrange",s.tstzrange="tstzrange"})(Je||(Je={}));const Mg=(s,a,r={})=>{var l;const c=(l=r.skipTypes)!==null&&l!==void 0?l:[];return a?Object.keys(a).reduce((d,h)=>(d[h]=S1(h,s,a,c),d),{}):{}},S1=(s,a,r,l)=>{const c=a.find(m=>m.name===s),d=c?.type,h=r[s];return d&&!l.includes(d)?Iy(d,h):Kd(h)},Iy=(s,a)=>{if(s.charAt(0)==="_"){const r=s.slice(1,s.length);return T1(a,r)}switch(s){case Je.bool:return j1(a);case Je.float4:case Je.float8:case Je.int2:case Je.int4:case Je.int8:case Je.numeric:case Je.oid:return N1(a);case Je.json:case Je.jsonb:return E1(a);case Je.timestamp:return A1(a);case Je.abstime:case Je.date:case Je.daterange:case Je.int4range:case Je.int8range:case Je.money:case Je.reltime:case Je.text:case Je.time:case Je.timestamptz:case Je.timetz:case Je.tsrange:case Je.tstzrange:return Kd(a);default:return Kd(a)}},Kd=s=>s,j1=s=>{switch(s){case"t":return!0;case"f":return!1;default:return s}},N1=s=>{if(typeof s=="string"){const a=parseFloat(s);if(!Number.isNaN(a))return a}return s},E1=s=>{if(typeof s=="string")try{return JSON.parse(s)}catch{return s}return s},T1=(s,a)=>{if(typeof s!="string")return s;const r=s.length-1,l=s[r];if(s[0]==="{"&&l==="}"){let d;const h=s.slice(1,r);try{d=JSON.parse("["+h+"]")}catch{d=h?h.split(","):[]}return d.map(m=>Iy(a,m))}return s},A1=s=>typeof s=="string"?s.replace(" ","T"):s,Gy=s=>{const a=new URL(s);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 wd{constructor(a,r,l={},c=Gd){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 zg;(function(s){s.SYNC="sync",s.JOIN="join",s.LEAVE="leave"})(zg||(zg={}));class Bi{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=Bi.syncState(this.state,c,d,h),this.pendingDiffs.forEach(y=>{this.state=Bi.syncDiff(this.state,y,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=Bi.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={},y={};return this.map(d,(p,g)=>{h[p]||(y[p]=g)}),this.map(h,(p,g)=>{const w=d[p];if(w){const _=g.map(R=>R.presence_ref),S=w.map(R=>R.presence_ref),E=g.filter(R=>S.indexOf(R.presence_ref)<0),j=w.filter(R=>_.indexOf(R.presence_ref)<0);E.length>0&&(m[p]=E),j.length>0&&(y[p]=j)}else m[p]=g}),this.syncDiff(d,{joins:m,leaves:y},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,y)=>{var p;const g=(p=a[m])!==null&&p!==void 0?p:[];if(a[m]=this.cloneDeep(y),g.length>0){const w=a[m].map(S=>S.presence_ref),_=g.filter(S=>w.indexOf(S.presence_ref)<0);a[m].unshift(..._)}l(m,g,y)}),this.map(h,(m,y)=>{let p=a[m];if(!p)return;const g=y.map(w=>w.presence_ref);p=p.filter(w=>g.indexOf(w.presence_ref)<0),a[m]=p,c(m,p,y),p.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 Ug;(function(s){s.ALL="*",s.INSERT="INSERT",s.UPDATE="UPDATE",s.DELETE="DELETE"})(Ug||(Ug={}));var qi;(function(s){s.BROADCAST="broadcast",s.PRESENCE="presence",s.POSTGRES_CHANGES="postgres_changes",s.SYSTEM="system"})(qi||(qi={}));var ts;(function(s){s.SUBSCRIBED="SUBSCRIBED",s.TIMED_OUT="TIMED_OUT",s.CLOSED="CLOSED",s.CHANNEL_ERROR="CHANNEL_ERROR"})(ts||(ts={}));class Ar{constructor(a,r={config:{}},l){var c,d;if(this.topic=a,this.params=r,this.socket=l,this.bindings={},this.state=ht.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 wd(this,ma.join,this.params,this.timeout),this.rejoinTimer=new Vy(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=ht.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=ht.closed,this.socket._remove(this)}),this._onError(h=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,h),this.state=ht.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=ht.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",h=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,h),this.state=ht.errored,this.rejoinTimer.scheduleTimeout())}),this._on(ma.reply,{},(h,m)=>{this._trigger(this._replyEventName(m),h)}),this.presence=new Bi(this),this.broadcastEndpointURL=Gy(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==ht.closed){const{config:{broadcast:h,presence:m,private:y}}=this.params,p=(c=(l=this.bindings.postgres_changes)===null||l===void 0?void 0:l.map(S=>S.filter))!==null&&c!==void 0?c:[],g=!!this.bindings[qi.PRESENCE]&&this.bindings[qi.PRESENCE].length>0||((d=this.params.config.presence)===null||d===void 0?void 0:d.enabled)===!0,w={},_={broadcast:h,presence:Object.assign(Object.assign({},m),{enabled:g}),postgres_changes:p,private:y};this.socket.accessTokenValue&&(w.access_token=this.socket.accessTokenValue),this._onError(S=>a?.(ts.CHANNEL_ERROR,S)),this._onClose(()=>a?.(ts.CLOSED)),this.updateJoinPayload(Object.assign({config:_},w)),this.joinedOnce=!0,this._rejoin(r),this.joinPush.receive("ok",async({postgres_changes:S})=>{var E;if(this.socket._isManualToken()||this.socket.setAuth(),S===void 0){a?.(ts.SUBSCRIBED);return}else{const j=this.bindings.postgres_changes,R=(E=j?.length)!==null&&E!==void 0?E:0,D=[];for(let B=0;B<R;B++){const q=j[B],{filter:{event:P,schema:W,table:Y,filter:I}}=q,X=S&&S[B];if(X&&X.event===P&&Ar.isFilterValueEqual(X.schema,W)&&Ar.isFilterValueEqual(X.table,Y)&&Ar.isFilterValueEqual(X.filter,I))D.push(Object.assign(Object.assign({},q),{id:X.id}));else{this.unsubscribe(),this.state=ht.errored,a?.(ts.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=D,a&&a(ts.SUBSCRIBED);return}}).receive("error",S=>{this.state=ht.errored,a?.(ts.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(S).join(", ")||"error")))}).receive("timeout",()=>{a?.(ts.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===ht.joined&&a===qi.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 y=m.statusText;try{const p=await m.json();y=p.error||p.message||y}catch{}return Promise.reject(new Error(y))}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 y={method:"POST",headers:m,body:JSON.stringify({messages:[{topic:this.subTopic,event:d,payload:h,private:this.private}]})};try{const p=await this._fetchWithTimeout(this.broadcastEndpointURL,y,(l=r.timeout)!==null&&l!==void 0?l:this.timeout);return await((c=p.body)===null||c===void 0?void 0:c.cancel()),p.ok?"ok":"error"}catch(p){return p.name==="AbortError"?"timed out":"error"}}else return new Promise(d=>{var h,m,y;const p=this._push(a.type,a,r.timeout||this.timeout);a.type==="broadcast"&&!(!((y=(m=(h=this.params)===null||h===void 0?void 0:h.config)===null||m===void 0?void 0:m.broadcast)===null||y===void 0)&&y.ack)&&d("ok"),p.receive("ok",()=>d("ok")),p.receive("error",()=>d("error")),p.receive("timeout",()=>d("timed out"))})}updateJoinPayload(a){this.joinPush.updatePayload(a)}unsubscribe(a=this.timeout){this.state=ht.leaving;const r=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(ma.close,"leave",this._joinRef())};this.joinPush.destroy();let l=null;return new Promise(c=>{l=new wd(this,ma.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=ht.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 wd(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>w1){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:y,leave:p,join:g}=ma;if(l&&[m,y,p,g].indexOf(h)>=0&&l!==this._joinRef())return;let _=this._onMessage(h,r,l);if(r&&!_)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 E,j,R;return((E=S.filter)===null||E===void 0?void 0:E.event)==="*"||((R=(j=S.filter)===null||j===void 0?void 0:j.event)===null||R===void 0?void 0:R.toLocaleLowerCase())===h}).map(S=>S.callback(_,l)):(d=this.bindings[h])===null||d===void 0||d.filter(S=>{var E,j,R,D,B,q,P,W;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in S){const Y=S.id,I=(E=S.filter)===null||E===void 0?void 0:E.event;return Y&&((j=r.ids)===null||j===void 0?void 0:j.includes(Y))&&(I==="*"||I?.toLocaleLowerCase()===((R=r.data)===null||R===void 0?void 0:R.type.toLocaleLowerCase()))&&(!(!((D=S.filter)===null||D===void 0)&&D.table)||S.filter.table===((B=r.data)===null||B===void 0?void 0:B.table))}else{const Y=(P=(q=S?.filter)===null||q===void 0?void 0:q.event)===null||P===void 0?void 0:P.toLocaleLowerCase();return Y==="*"||Y===((W=r?.event)===null||W===void 0?void 0:W.toLocaleLowerCase())}else return S.type.toLocaleLowerCase()===h}).map(S=>{if(typeof _=="object"&&"ids"in _){const E=_.data,{schema:j,table:R,commit_timestamp:D,type:B,errors:q}=E;_=Object.assign(Object.assign({},{schema:j,table:R,commit_timestamp:D,eventType:B,new:{},old:{},errors:q}),this._getPayloadRecords(E))}S.callback(_,l)})}_isClosed(){return this.state===ht.closed}_isJoined(){return this.state===ht.joined}_isJoining(){return this.state===ht.joining}_isLeaving(){return this.state===ht.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&&Ar.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(ma.close,{},a)}_onError(a){this._on(ma.error,{},r=>a(r))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(a=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=ht.joining,this.joinPush.resend(a))}_getPayloadRecords(a){const r={new:{},old:{}};return(a.type==="INSERT"||a.type==="UPDATE")&&(r.new=Mg(a.columns,a.record)),(a.type==="UPDATE"||a.type==="DELETE")&&(r.old=Mg(a.columns,a.old_record)),r}}const _d=()=>{},_o={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},C1=[1e3,2e3,5e3,1e4],k1=1e4,O1=`
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 b1="2.90.1",x1=`realtime-js/${b1}`,Gy="1.0.0",w1="2.0.0",Mg=Gy,Pd=1e4,_1=1e3,S1=100;var zs;(function(s){s[s.connecting=0]="connecting",s[s.open=1]="open",s[s.closing=2]="closing",s[s.closed=3]="closed"})(zs||(zs={}));var ht;(function(s){s.closed="closed",s.errored="errored",s.joined="joined",s.joining="joining",s.leaving="leaving"})(ht||(ht={}));var ma;(function(s){s.close="phx_close",s.error="phx_error",s.join="phx_join",s.reply="phx_reply",s.leave="phx_leave",s.access_token="access_token"})(ma||(ma={}));var Kd;(function(s){s.websocket="websocket"})(Kd||(Kd={}));var mn;(function(s){s.Connecting="connecting",s.Open="open",s.Closing="closing",s.Closed="closed"})(mn||(mn={}));class j1{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:"",y=(d=a.join_ref)!==null&&d!==void 0?d:"",p=a.payload.event,g=this.allowedMetadataKeys?this._pick(a.payload,this.allowedMetadataKeys):{},w=Object.keys(g).length===0?"":JSON.stringify(g);if(y.length>255)throw new Error(`joinRef length ${y.length} exceeds maximum of 255`);if(m.length>255)throw new Error(`ref length ${m.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`topic length ${h.length} exceeds maximum of 255`);if(p.length>255)throw new Error(`userEvent length ${p.length} exceeds maximum of 255`);if(w.length>255)throw new Error(`metadata length ${w.length} exceeds maximum of 255`);const _=this.USER_BROADCAST_PUSH_META_LENGTH+y.length+m.length+h.length+p.length+w.length,S=new ArrayBuffer(this.HEADER_LENGTH+_);let E=new DataView(S),j=0;E.setUint8(j++,this.KINDS.userBroadcastPush),E.setUint8(j++,y.length),E.setUint8(j++,m.length),E.setUint8(j++,h.length),E.setUint8(j++,p.length),E.setUint8(j++,w.length),E.setUint8(j++,r),Array.from(y,D=>E.setUint8(j++,D.charCodeAt(0))),Array.from(m,D=>E.setUint8(j++,D.charCodeAt(0))),Array.from(h,D=>E.setUint8(j++,D.charCodeAt(0))),Array.from(p,D=>E.setUint8(j++,D.charCodeAt(0))),Array.from(w,D=>E.setUint8(j++,D.charCodeAt(0)));var R=new Uint8Array(S.byteLength+l.byteLength);return R.set(new Uint8Array(S),0),R.set(new Uint8Array(l),S.byteLength),R.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,y]=l;return r({join_ref:c,ref:d,topic:h,event:m,payload:y})}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 y=this.HEADER_LENGTH+4;const p=l.decode(a.slice(y,y+c));y=y+c;const g=l.decode(a.slice(y,y+d));y=y+d;const w=l.decode(a.slice(y,y+h));y=y+h;const _=a.slice(y,a.byteLength),S=m===this.JSON_ENCODING?JSON.parse(l.decode(_)):_,E={type:this.BROADCAST_EVENT,event:g,payload:S};return h>0&&(E.meta=JSON.parse(w)),{join_ref:null,ref:null,topic:p,event:this.BROADCAST_EVENT,payload:E}}_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 Py{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 Ke;(function(s){s.abstime="abstime",s.bool="bool",s.date="date",s.daterange="daterange",s.float4="float4",s.float8="float8",s.int2="int2",s.int4="int4",s.int4range="int4range",s.int8="int8",s.int8range="int8range",s.json="json",s.jsonb="jsonb",s.money="money",s.numeric="numeric",s.oid="oid",s.reltime="reltime",s.text="text",s.time="time",s.timestamp="timestamp",s.timestamptz="timestamptz",s.timetz="timetz",s.tsrange="tsrange",s.tstzrange="tstzrange"})(Ke||(Ke={}));const zg=(s,a,r={})=>{var l;const c=(l=r.skipTypes)!==null&&l!==void 0?l:[];return a?Object.keys(a).reduce((d,h)=>(d[h]=N1(h,s,a,c),d),{}):{}},N1=(s,a,r,l)=>{const c=a.find(m=>m.name===s),d=c?.type,h=r[s];return d&&!l.includes(d)?Ky(d,h):Yd(h)},Ky=(s,a)=>{if(s.charAt(0)==="_"){const r=s.slice(1,s.length);return C1(a,r)}switch(s){case Ke.bool:return E1(a);case Ke.float4:case Ke.float8:case Ke.int2:case Ke.int4:case Ke.int8:case Ke.numeric:case Ke.oid:return T1(a);case Ke.json:case Ke.jsonb:return A1(a);case Ke.timestamp:return k1(a);case Ke.abstime:case Ke.date:case Ke.daterange:case Ke.int4range:case Ke.int8range:case Ke.money:case Ke.reltime:case Ke.text:case Ke.time:case Ke.timestamptz:case Ke.timetz:case Ke.tsrange:case Ke.tstzrange:return Yd(a);default:return Yd(a)}},Yd=s=>s,E1=s=>{switch(s){case"t":return!0;case"f":return!1;default:return s}},T1=s=>{if(typeof s=="string"){const a=parseFloat(s);if(!Number.isNaN(a))return a}return s},A1=s=>{if(typeof s=="string")try{return JSON.parse(s)}catch{return s}return s},C1=(s,a)=>{if(typeof s!="string")return s;const r=s.length-1,l=s[r];if(s[0]==="{"&&l==="}"){let d;const h=s.slice(1,r);try{d=JSON.parse("["+h+"]")}catch{d=h?h.split(","):[]}return d.map(m=>Ky(a,m))}return s},k1=s=>typeof s=="string"?s.replace(" ","T"):s,Yy=s=>{const a=new URL(s);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 _d{constructor(a,r,l={},c=Pd){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 Ug;(function(s){s.SYNC="sync",s.JOIN="join",s.LEAVE="leave"})(Ug||(Ug={}));class Bi{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=Bi.syncState(this.state,c,d,h),this.pendingDiffs.forEach(y=>{this.state=Bi.syncDiff(this.state,y,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=Bi.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={},y={};return this.map(d,(p,g)=>{h[p]||(y[p]=g)}),this.map(h,(p,g)=>{const w=d[p];if(w){const _=g.map(R=>R.presence_ref),S=w.map(R=>R.presence_ref),E=g.filter(R=>S.indexOf(R.presence_ref)<0),j=w.filter(R=>_.indexOf(R.presence_ref)<0);E.length>0&&(m[p]=E),j.length>0&&(y[p]=j)}else m[p]=g}),this.syncDiff(d,{joins:m,leaves:y},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,y)=>{var p;const g=(p=a[m])!==null&&p!==void 0?p:[];if(a[m]=this.cloneDeep(y),g.length>0){const w=a[m].map(S=>S.presence_ref),_=g.filter(S=>w.indexOf(S.presence_ref)<0);a[m].unshift(..._)}l(m,g,y)}),this.map(h,(m,y)=>{let p=a[m];if(!p)return;const g=y.map(w=>w.presence_ref);p=p.filter(w=>g.indexOf(w.presence_ref)<0),a[m]=p,c(m,p,y),p.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 Lg;(function(s){s.ALL="*",s.INSERT="INSERT",s.UPDATE="UPDATE",s.DELETE="DELETE"})(Lg||(Lg={}));var qi;(function(s){s.BROADCAST="broadcast",s.PRESENCE="presence",s.POSTGRES_CHANGES="postgres_changes",s.SYSTEM="system"})(qi||(qi={}));var ts;(function(s){s.SUBSCRIBED="SUBSCRIBED",s.TIMED_OUT="TIMED_OUT",s.CLOSED="CLOSED",s.CHANNEL_ERROR="CHANNEL_ERROR"})(ts||(ts={}));class Cr{constructor(a,r={config:{}},l){var c,d;if(this.topic=a,this.params=r,this.socket=l,this.bindings={},this.state=ht.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 _d(this,ma.join,this.params,this.timeout),this.rejoinTimer=new Py(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=ht.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=ht.closed,this.socket._remove(this)}),this._onError(h=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,h),this.state=ht.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=ht.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",h=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,h),this.state=ht.errored,this.rejoinTimer.scheduleTimeout())}),this._on(ma.reply,{},(h,m)=>{this._trigger(this._replyEventName(m),h)}),this.presence=new Bi(this),this.broadcastEndpointURL=Yy(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==ht.closed){const{config:{broadcast:h,presence:m,private:y}}=this.params,p=(c=(l=this.bindings.postgres_changes)===null||l===void 0?void 0:l.map(S=>S.filter))!==null&&c!==void 0?c:[],g=!!this.bindings[qi.PRESENCE]&&this.bindings[qi.PRESENCE].length>0||((d=this.params.config.presence)===null||d===void 0?void 0:d.enabled)===!0,w={},_={broadcast:h,presence:Object.assign(Object.assign({},m),{enabled:g}),postgres_changes:p,private:y};this.socket.accessTokenValue&&(w.access_token=this.socket.accessTokenValue),this._onError(S=>a?.(ts.CHANNEL_ERROR,S)),this._onClose(()=>a?.(ts.CLOSED)),this.updateJoinPayload(Object.assign({config:_},w)),this.joinedOnce=!0,this._rejoin(r),this.joinPush.receive("ok",async({postgres_changes:S})=>{var E;if(this.socket._isManualToken()||this.socket.setAuth(),S===void 0){a?.(ts.SUBSCRIBED);return}else{const j=this.bindings.postgres_changes,R=(E=j?.length)!==null&&E!==void 0?E:0,D=[];for(let B=0;B<R;B++){const q=j[B],{filter:{event:P,schema:W,table:Y,filter:H}}=q,Q=S&&S[B];if(Q&&Q.event===P&&Cr.isFilterValueEqual(Q.schema,W)&&Cr.isFilterValueEqual(Q.table,Y)&&Cr.isFilterValueEqual(Q.filter,H))D.push(Object.assign(Object.assign({},q),{id:Q.id}));else{this.unsubscribe(),this.state=ht.errored,a?.(ts.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=D,a&&a(ts.SUBSCRIBED);return}}).receive("error",S=>{this.state=ht.errored,a?.(ts.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(S).join(", ")||"error")))}).receive("timeout",()=>{a?.(ts.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===ht.joined&&a===qi.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 y=m.statusText;try{const p=await m.json();y=p.error||p.message||y}catch{}return Promise.reject(new Error(y))}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 y={method:"POST",headers:m,body:JSON.stringify({messages:[{topic:this.subTopic,event:d,payload:h,private:this.private}]})};try{const p=await this._fetchWithTimeout(this.broadcastEndpointURL,y,(l=r.timeout)!==null&&l!==void 0?l:this.timeout);return await((c=p.body)===null||c===void 0?void 0:c.cancel()),p.ok?"ok":"error"}catch(p){return p.name==="AbortError"?"timed out":"error"}}else return new Promise(d=>{var h,m,y;const p=this._push(a.type,a,r.timeout||this.timeout);a.type==="broadcast"&&!(!((y=(m=(h=this.params)===null||h===void 0?void 0:h.config)===null||m===void 0?void 0:m.broadcast)===null||y===void 0)&&y.ack)&&d("ok"),p.receive("ok",()=>d("ok")),p.receive("error",()=>d("error")),p.receive("timeout",()=>d("timed out"))})}updateJoinPayload(a){this.joinPush.updatePayload(a)}unsubscribe(a=this.timeout){this.state=ht.leaving;const r=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(ma.close,"leave",this._joinRef())};this.joinPush.destroy();let l=null;return new Promise(c=>{l=new _d(this,ma.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=ht.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 _d(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>S1){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:y,leave:p,join:g}=ma;if(l&&[m,y,p,g].indexOf(h)>=0&&l!==this._joinRef())return;let _=this._onMessage(h,r,l);if(r&&!_)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 E,j,R;return((E=S.filter)===null||E===void 0?void 0:E.event)==="*"||((R=(j=S.filter)===null||j===void 0?void 0:j.event)===null||R===void 0?void 0:R.toLocaleLowerCase())===h}).map(S=>S.callback(_,l)):(d=this.bindings[h])===null||d===void 0||d.filter(S=>{var E,j,R,D,B,q,P,W;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in S){const Y=S.id,H=(E=S.filter)===null||E===void 0?void 0:E.event;return Y&&((j=r.ids)===null||j===void 0?void 0:j.includes(Y))&&(H==="*"||H?.toLocaleLowerCase()===((R=r.data)===null||R===void 0?void 0:R.type.toLocaleLowerCase()))&&(!(!((D=S.filter)===null||D===void 0)&&D.table)||S.filter.table===((B=r.data)===null||B===void 0?void 0:B.table))}else{const Y=(P=(q=S?.filter)===null||q===void 0?void 0:q.event)===null||P===void 0?void 0:P.toLocaleLowerCase();return Y==="*"||Y===((W=r?.event)===null||W===void 0?void 0:W.toLocaleLowerCase())}else return S.type.toLocaleLowerCase()===h}).map(S=>{if(typeof _=="object"&&"ids"in _){const E=_.data,{schema:j,table:R,commit_timestamp:D,type:B,errors:q}=E;_=Object.assign(Object.assign({},{schema:j,table:R,commit_timestamp:D,eventType:B,new:{},old:{},errors:q}),this._getPayloadRecords(E))}S.callback(_,l)})}_isClosed(){return this.state===ht.closed}_isJoined(){return this.state===ht.joined}_isJoining(){return this.state===ht.joining}_isLeaving(){return this.state===ht.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&&Cr.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(ma.close,{},a)}_onError(a){this._on(ma.error,{},r=>a(r))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(a=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=ht.joining,this.joinPush.resend(a))}_getPayloadRecords(a){const r={new:{},old:{}};return(a.type==="INSERT"||a.type==="UPDATE")&&(r.new=zg(a.columns,a.record)),(a.type==="UPDATE"||a.type==="DELETE")&&(r.old=zg(a.columns,a.old_record)),r}}const Sd=()=>{},So={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},O1=[1e3,2e3,5e3,1e4],R1=1e4,D1=`
17
17
  addEventListener("message", (e) => {
18
18
  if (e.data.event === "start") {
19
19
  setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
20
20
  }
21
- });`;class R1{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=Gd,this.transport=null,this.heartbeatIntervalMs=_o.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=_d,this.ref=0,this.reconnectTimer=null,this.vsn=Dg,this.logger=_d,this.conn=null,this.sendBuffer=[],this.serializer=new _1,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}/${Pd.websocket}`,this.httpEndpoint=Gy(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=g1.createWebSocket(this.endpointURL())}catch(a){this._setConnectionState("disconnected");const r=a.message;throw r.includes("Node.js")?new Error(`${r}
21
+ });`;class M1{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=Pd,this.transport=null,this.heartbeatIntervalMs=So.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=Sd,this.ref=0,this.reconnectTimer=null,this.vsn=Mg,this.logger=Sd,this.conn=null,this.sendBuffer=[],this.serializer=new j1,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}/${Kd.websocket}`,this.httpEndpoint=Yy(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=v1.createWebSocket(this.endpointURL())}catch(a){this._setConnectionState("disconnected");const r=a.message;throw r.includes("Node.js")?new Error(`${r}
22
22
 
23
23
  To use Realtime in Node.js, you need to provide a WebSocket implementation:
24
24
 
@@ -31,9 +31,9 @@ Option 2: Install and provide the "ws" package:
31
31
  const client = new RealtimeClient(url, {
32
32
  ...options,
33
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 zs.connecting:return mn.Connecting;case zs.open:return mn.Open;case zs.closing:return mn.Closing;default:return mn.Closed}}isConnected(){return this.connectionState()===mn.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 Ar(`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 y;(y=this.conn)===null||y===void 0||y.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(x1,"heartbeat timeout"),setTimeout(()=>{var r;this.isConnected()||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout()},_o.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 p=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(r.payload.status==="ok"?"ok":"error",p)}catch(g){this.log("error","error in heartbeat callback",g)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}const{topic:l,event:c,payload:d,ref:h}=r,m=h?`(${h})`:"",y=d.status||"";this.log("receive",`${y} ${l} ${c} ${m}`.trim(),d),this.channels.filter(p=>p._isMember(l)).forEach(p=>p._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===zs.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===zs.open||this.conn.readyState===zs.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(ma.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([O1],{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:v1};r&&c.updateJoinPayload(d),c.joinedOnce&&c._isJoined()&&c._push(ma.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 Vy(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},_o.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(a){var r,l,c,d,h,m,y,p,g,w,_,S;switch(this.transport=(r=a?.transport)!==null&&r!==void 0?r:null,this.timeout=(l=a?.timeout)!==null&&l!==void 0?l:Gd,this.heartbeatIntervalMs=(c=a?.heartbeatIntervalMs)!==null&&c!==void 0?c:_o.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:_d,this.vsn=(y=a?.vsn)!==null&&y!==void 0?y:Dg,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=(p=a?.reconnectAfterMs)!==null&&p!==void 0?p:(E=>C1[E-1]||k1),this.vsn){case Hy:this.encode=(g=a?.encode)!==null&&g!==void 0?g:((E,j)=>j(JSON.stringify(E))),this.decode=(w=a?.decode)!==null&&w!==void 0?w:((E,j)=>j(JSON.parse(E)));break;case b1:this.encode=(_=a?.encode)!==null&&_!==void 0?_: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 Pi=class extends Error{constructor(s,a){super(s),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 D1(s,a,r){const l=new URL(a,s);if(r)for(const[c,d]of Object.entries(r))d!==void 0&&l.searchParams.set(c,d);return l.toString()}async function M1(s){return!s||s.type==="none"?{}:s.type==="bearer"?{Authorization:`Bearer ${s.token}`}:s.type==="header"?{[s.name]:s.value}:s.type==="custom"?await s.getHeaders():{}}function z1(s){const a=s.fetchImpl??globalThis.fetch;return{async request({method:r,path:l,query:c,body:d,headers:h}){const m=D1(s.baseUrl,l,c),y=await M1(s.auth),p=await a(m,{method:r,headers:{...d?{"Content-Type":"application/json"}:{},...y,...h},body:d?JSON.stringify(d):void 0}),g=await p.text(),w=(p.headers.get("content-type")||"").includes("application/json"),_=w&&g?JSON.parse(g):g;if(!p.ok){const S=w?_:void 0,E=S?.error;throw new Pi(E?.message??`Request failed with status ${p.status}`,{status:p.status,icebergType:E?.type,icebergCode:E?.code,details:S})}return{status:p.status,headers:p.headers,data:_}}}}function So(s){return s.join("")}var U1=class{constructor(s,a=""){this.client=s,this.prefix=a}async listNamespaces(s){const a=s?{parent:So(s.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:a})).data.namespaces.map(l=>({namespace:l}))}async createNamespace(s,a){const r={namespace:s.namespace,properties:a?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(s){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${So(s.namespace)}`})}async loadNamespaceMetadata(s){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${So(s.namespace)}`})).data.properties}}async namespaceExists(s){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${So(s.namespace)}`}),!0}catch(a){if(a instanceof Pi&&a.status===404)return!1;throw a}}async createNamespaceIfNotExists(s,a){try{return await this.createNamespace(s,a)}catch(r){if(r instanceof Pi&&r.status===409)return;throw r}}};function pr(s){return s.join("")}var L1=class{constructor(s,a="",r){this.client=s,this.prefix=a,this.accessDelegation=r}async listTables(s){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${pr(s.namespace)}/tables`})).data.identifiers}async createTable(s,a){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${pr(s.namespace)}/tables`,body:a,headers:r})).data.metadata}async updateTable(s,a){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${pr(s.namespace)}/tables/${s.name}`,body:a});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(s,a){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${pr(s.namespace)}/tables/${s.name}`,query:{purgeRequested:String(a?.purge??!1)}})}async loadTable(s){const a={};return this.accessDelegation&&(a["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${pr(s.namespace)}/tables/${s.name}`,headers:a})).data.metadata}async tableExists(s){const a={};this.accessDelegation&&(a["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${pr(s.namespace)}/tables/${s.name}`,headers:a}),!0}catch(r){if(r instanceof Pi&&r.status===404)return!1;throw r}}async createTableIfNotExists(s,a){try{return await this.createTable(s,a)}catch(r){if(r instanceof Pi&&r.status===409)return await this.loadTable({namespace:s.namespace,name:a.name});throw r}}},B1=class{constructor(s){let a="v1";s.catalogName&&(a+=`/${s.catalogName}`);const r=s.baseUrl.endsWith("/")?s.baseUrl:`${s.baseUrl}/`;this.client=z1({baseUrl:r,auth:s.auth,fetchImpl:s.fetch}),this.accessDelegation=s.accessDelegation?.join(","),this.namespaceOps=new U1(this.client,a),this.tableOps=new L1(this.client,a,this.accessDelegation)}async listNamespaces(s){return this.namespaceOps.listNamespaces(s)}async createNamespace(s,a){return this.namespaceOps.createNamespace(s,a)}async dropNamespace(s){await this.namespaceOps.dropNamespace(s)}async loadNamespaceMetadata(s){return this.namespaceOps.loadNamespaceMetadata(s)}async listTables(s){return this.tableOps.listTables(s)}async createTable(s,a){return this.tableOps.createTable(s,a)}async updateTable(s,a){return this.tableOps.updateTable(s,a)}async dropTable(s,a){await this.tableOps.dropTable(s,a)}async loadTable(s){return this.tableOps.loadTable(s)}async namespaceExists(s){return this.namespaceOps.namespaceExists(s)}async tableExists(s){return this.tableOps.tableExists(s)}async createNamespaceIfNotExists(s,a){return this.namespaceOps.createNamespaceIfNotExists(s,a)}async createTableIfNotExists(s,a){return this.tableOps.createTableIfNotExists(s,a)}},Po=class extends Error{constructor(s){super(s),this.__isStorageError=!0,this.name="StorageError"}};function Fe(s){return typeof s=="object"&&s!==null&&"__isStorageError"in s}var q1=class extends Po{constructor(s,a,r){super(s),this.name="StorageApiError",this.status=a,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Yd=class extends Po{constructor(s,a){super(s),this.name="StorageUnknownError",this.originalError=a}};const ff=s=>s?(...a)=>s(...a):(...a)=>fetch(...a),$1=()=>Response,Jd=s=>{if(Array.isArray(s))return s.map(r=>Jd(r));if(typeof s=="function"||s!==Object(s))return s;const a={};return Object.entries(s).forEach(([r,l])=>{const c=r.replace(/([-_][a-z])/gi,d=>d.toUpperCase().replace(/[-_]/g,""));a[c]=Jd(l)}),a},H1=s=>{if(typeof s!="object"||s===null)return!1;const a=Object.getPrototypeOf(s);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(Symbol.toStringTag in s)&&!(Symbol.iterator in s)},V1=s=>!s||typeof s!="string"||s.length===0||s.length>100||s.trim()!==s||s.includes("/")||s.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(s);function Ki(s){"@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(s)}function I1(s,a){if(Ki(s)!="object"||!s)return s;var r=s[Symbol.toPrimitive];if(r!==void 0){var l=r.call(s,a);if(Ki(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(s)}function G1(s){var a=I1(s,"string");return Ki(a)=="symbol"?a:a+""}function P1(s,a,r){return(a=G1(a))in s?Object.defineProperty(s,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):s[a]=r,s}function Lg(s,a){var r=Object.keys(s);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(s);a&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(s,c).enumerable})),r.push.apply(r,l)}return r}function me(s){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?Lg(Object(r),!0).forEach(function(l){P1(s,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(r)):Lg(Object(r)).forEach(function(l){Object.defineProperty(s,l,Object.getOwnPropertyDescriptor(r,l))})}return s}const Sd=s=>{var a;return s.msg||s.message||s.error_description||(typeof s.error=="string"?s.error:(a=s.error)===null||a===void 0?void 0:a.message)||JSON.stringify(s)},K1=async(s,a,r)=>{s instanceof await $1()&&!r?.noResolveJson?s.json().then(l=>{const c=s.status||500,d=l?.statusCode||c+"";a(new q1(Sd(l),c,d))}).catch(l=>{a(new Yd(Sd(l),l))}):a(new Yd(Sd(s),s))},Y1=(s,a,r,l)=>{const c={method:s,headers:a?.headers||{}};return s==="GET"||!l?c:(H1(l)?(c.headers=me({"Content-Type":"application/json"},a?.headers),c.body=JSON.stringify(l)):c.body=l,a?.duplex&&(c.duplex=a.duplex),me(me({},c),r))};async function al(s,a,r,l,c,d){return new Promise((h,m)=>{s(r,Y1(a,l,c,d)).then(y=>{if(!y.ok)throw y;return l?.noResolveJson?y:y.json()}).then(y=>h(y)).catch(y=>K1(y,m,l))})}async function Yi(s,a,r,l){return al(s,"GET",a,r,l)}async function ha(s,a,r,l,c){return al(s,"POST",a,l,c,r)}async function Xd(s,a,r,l,c){return al(s,"PUT",a,l,c,r)}async function J1(s,a,r,l){return al(s,"HEAD",a,me(me({},r),{},{noResolveJson:!0}),l)}async function hf(s,a,r,l,c){return al(s,"DELETE",a,l,c,r)}var X1=class{constructor(s,a){this.downloadFn=s,this.shouldThrowOnError=a}then(s,a){return this.execute().then(s,a)}async execute(){var s=this;try{return{data:(await s.downloadFn()).body,error:null}}catch(a){if(s.shouldThrowOnError)throw a;if(Fe(a))return{data:null,error:a};throw a}}};let Py;Py=Symbol.toStringTag;var Q1=class{constructor(s,a){this.downloadFn=s,this.shouldThrowOnError=a,this[Py]="BlobDownloadBuilder",this.promise=null}asStream(){return new X1(this.downloadFn,this.shouldThrowOnError)}then(s,a){return this.getPromise().then(s,a)}catch(s){return this.getPromise().catch(s)}finally(s){return this.getPromise().finally(s)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var s=this;try{return{data:await(await s.downloadFn()).blob(),error:null}}catch(a){if(s.shouldThrowOnError)throw a;if(Fe(a))return{data:null,error:a};throw a}}};const Z1={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Bg={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var F1=class{constructor(s,a={},r,l){this.shouldThrowOnError=!1,this.url=s,this.headers=a,this.bucketId=r,this.fetch=ff(l)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(s,a,r,l){var c=this;try{let d;const h=me(me({},Bg),l);let m=me(me({},c.headers),s==="POST"&&{"x-upsert":String(h.upsert)});const y=h.metadata;typeof Blob<"u"&&r instanceof Blob?(d=new FormData,d.append("cacheControl",h.cacheControl),y&&d.append("metadata",c.encodeMetadata(y)),d.append("",r)):typeof FormData<"u"&&r instanceof FormData?(d=r,d.has("cacheControl")||d.append("cacheControl",h.cacheControl),y&&!d.has("metadata")&&d.append("metadata",c.encodeMetadata(y))):(d=r,m["cache-control"]=`max-age=${h.cacheControl}`,m["content-type"]=h.contentType,y&&(m["x-metadata"]=c.toBase64(c.encodeMetadata(y))),(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=me(me({},m),l.headers));const p=c._removeEmptyFolders(a),g=c._getFinalPath(p),w=await(s=="PUT"?Xd:ha)(c.fetch,`${c.url}/object/${g}`,d,me({headers:m},h?.duplex?{duplex:h.duplex}:{}));return{data:{path:p,id:w.Id,fullPath:w.Key},error:null}}catch(d){if(c.shouldThrowOnError)throw d;if(Fe(d))return{data:null,error:d};throw d}}async upload(s,a,r){return this.uploadOrUpdate("POST",s,a,r)}async uploadToSignedUrl(s,a,r,l){var c=this;const d=c._removeEmptyFolders(s),h=c._getFinalPath(d),m=new URL(c.url+`/object/upload/sign/${h}`);m.searchParams.set("token",a);try{let y;const p=me({upsert:Bg.upsert},l),g=me(me({},c.headers),{"x-upsert":String(p.upsert)});return typeof Blob<"u"&&r instanceof Blob?(y=new FormData,y.append("cacheControl",p.cacheControl),y.append("",r)):typeof FormData<"u"&&r instanceof FormData?(y=r,y.append("cacheControl",p.cacheControl)):(y=r,g["cache-control"]=`max-age=${p.cacheControl}`,g["content-type"]=p.contentType),{data:{path:d,fullPath:(await Xd(c.fetch,m.toString(),y,{headers:g})).Key},error:null}}catch(y){if(c.shouldThrowOnError)throw y;if(Fe(y))return{data:null,error:y};throw y}}async createSignedUploadUrl(s,a){var r=this;try{let l=r._getFinalPath(s);const c=me({},r.headers);a?.upsert&&(c["x-upsert"]="true");const d=await ha(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 Po("No token returned by API");return{data:{signedUrl:h.toString(),path:s,token:m},error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Fe(l))return{data:null,error:l};throw l}}async update(s,a,r){return this.uploadOrUpdate("PUT",s,a,r)}async move(s,a,r){var l=this;try{return{data:await ha(l.fetch,`${l.url}/object/move`,{bucketId:l.bucketId,sourceKey:s,destinationKey:a,destinationBucket:r?.destinationBucket},{headers:l.headers}),error:null}}catch(c){if(l.shouldThrowOnError)throw c;if(Fe(c))return{data:null,error:c};throw c}}async copy(s,a,r){var l=this;try{return{data:{path:(await ha(l.fetch,`${l.url}/object/copy`,{bucketId:l.bucketId,sourceKey:s,destinationKey:a,destinationBucket:r?.destinationBucket},{headers:l.headers})).Key},error:null}}catch(c){if(l.shouldThrowOnError)throw c;if(Fe(c))return{data:null,error:c};throw c}}async createSignedUrl(s,a,r){var l=this;try{let c=l._getFinalPath(s),d=await ha(l.fetch,`${l.url}/object/sign/${c}`,me({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(Fe(c))return{data:null,error:c};throw c}}async createSignedUrls(s,a,r){var l=this;try{const c=await ha(l.fetch,`${l.url}/object/sign/${l.bucketId}`,{expiresIn:a,paths:s},{headers:l.headers}),d=r?.download?`&download=${r.download===!0?"":r.download}`:"";return{data:c.map(h=>me(me({},h),{},{signedUrl:h.signedURL?encodeURI(`${l.url}${h.signedURL}${d}`):null})),error:null}}catch(c){if(l.shouldThrowOnError)throw c;if(Fe(c))return{data:null,error:c};throw c}}download(s,a){const r=typeof a?.transform<"u"?"render/image/authenticated":"object",l=this.transformOptsToQueryString(a?.transform||{}),c=l?`?${l}`:"",d=this._getFinalPath(s),h=()=>Yi(this.fetch,`${this.url}/${r}/${d}${c}`,{headers:this.headers,noResolveJson:!0});return new Q1(h,this.shouldThrowOnError)}async info(s){var a=this;const r=a._getFinalPath(s);try{return{data:Jd(await Yi(a.fetch,`${a.url}/object/info/${r}`,{headers:a.headers})),error:null}}catch(l){if(a.shouldThrowOnError)throw l;if(Fe(l))return{data:null,error:l};throw l}}async exists(s){var a=this;const r=a._getFinalPath(s);try{return await J1(a.fetch,`${a.url}/object/${r}`,{headers:a.headers}),{data:!0,error:null}}catch(l){if(a.shouldThrowOnError)throw l;if(Fe(l)&&l instanceof Yd){const c=l.originalError;if([400,404].includes(c?.status))return{data:!1,error:l}}throw l}}getPublicUrl(s,a){const r=this._getFinalPath(s),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(s){var a=this;try{return{data:await hf(a.fetch,`${a.url}/object/${a.bucketId}`,{prefixes:s},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Fe(r))return{data:null,error:r};throw r}}async list(s,a,r){var l=this;try{const c=me(me(me({},Z1),a),{},{prefix:s||""});return{data:await ha(l.fetch,`${l.url}/object/list/${l.bucketId}`,c,{headers:l.headers},r),error:null}}catch(c){if(l.shouldThrowOnError)throw c;if(Fe(c))return{data:null,error:c};throw c}}async listV2(s,a){var r=this;try{const l=me({},s);return{data:await ha(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,l,{headers:r.headers},a),error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Fe(l))return{data:null,error:l};throw l}}encodeMetadata(s){return JSON.stringify(s)}toBase64(s){return typeof Buffer<"u"?Buffer.from(s).toString("base64"):btoa(s)}_getFinalPath(s){return`${this.bucketId}/${s.replace(/^\/+/,"")}`}_removeEmptyFolders(s){return s.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(s){const a=[];return s.width&&a.push(`width=${s.width}`),s.height&&a.push(`height=${s.height}`),s.resize&&a.push(`resize=${s.resize}`),s.format&&a.push(`format=${s.format}`),s.quality&&a.push(`quality=${s.quality}`),a.join("&")}};const Ky="2.90.1",Yy={"X-Client-Info":`storage-js/${Ky}`};var W1=class{constructor(s,a={},r,l){this.shouldThrowOnError=!1;const c=new URL(s);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=me(me({},Yy),a),this.fetch=ff(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(s){var a=this;try{const r=a.listBucketOptionsToQueryString(s);return{data:await Yi(a.fetch,`${a.url}/bucket${r}`,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Fe(r))return{data:null,error:r};throw r}}async getBucket(s){var a=this;try{return{data:await Yi(a.fetch,`${a.url}/bucket/${s}`,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Fe(r))return{data:null,error:r};throw r}}async createBucket(s,a={public:!1}){var r=this;try{return{data:await ha(r.fetch,`${r.url}/bucket`,{id:s,name:s,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(Fe(l))return{data:null,error:l};throw l}}async updateBucket(s,a){var r=this;try{return{data:await Xd(r.fetch,`${r.url}/bucket/${s}`,{id:s,name:s,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(Fe(l))return{data:null,error:l};throw l}}async emptyBucket(s){var a=this;try{return{data:await ha(a.fetch,`${a.url}/bucket/${s}/empty`,{},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Fe(r))return{data:null,error:r};throw r}}async deleteBucket(s){var a=this;try{return{data:await hf(a.fetch,`${a.url}/bucket/${s}`,{},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Fe(r))return{data:null,error:r};throw r}}listBucketOptionsToQueryString(s){const a={};return s&&("limit"in s&&(a.limit=String(s.limit)),"offset"in s&&(a.offset=String(s.offset)),s.search&&(a.search=s.search),s.sortColumn&&(a.sortColumn=s.sortColumn),s.sortOrder&&(a.sortOrder=s.sortOrder)),Object.keys(a).length>0?"?"+new URLSearchParams(a).toString():""}},eS=class{constructor(s,a={},r){this.shouldThrowOnError=!1,this.url=s.replace(/\/$/,""),this.headers=me(me({},Yy),a),this.fetch=ff(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(s){var a=this;try{return{data:await ha(a.fetch,`${a.url}/bucket`,{name:s},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Fe(r))return{data:null,error:r};throw r}}async listBuckets(s){var a=this;try{const r=new URLSearchParams;s?.limit!==void 0&&r.set("limit",s.limit.toString()),s?.offset!==void 0&&r.set("offset",s.offset.toString()),s?.sortColumn&&r.set("sortColumn",s.sortColumn),s?.sortOrder&&r.set("sortOrder",s.sortOrder),s?.search&&r.set("search",s.search);const l=r.toString(),c=l?`${a.url}/bucket?${l}`:`${a.url}/bucket`;return{data:await Yi(a.fetch,c,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Fe(r))return{data:null,error:r};throw r}}async deleteBucket(s){var a=this;try{return{data:await hf(a.fetch,`${a.url}/bucket/${s}`,{},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Fe(r))return{data:null,error:r};throw r}}from(s){var a=this;if(!V1(s))throw new Po("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 B1({baseUrl:this.url,catalogName:s,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(y){if(l)throw y;return{data:null,error:y}}}}})}};const mf={"X-Client-Info":`storage-js/${Ky}`,"Content-Type":"application/json"};var Jy=class extends Error{constructor(s){super(s),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function Xt(s){return typeof s=="object"&&s!==null&&"__isStorageVectorsError"in s}var jd=class extends Jy{constructor(s,a,r){super(s),this.name="StorageVectorsApiError",this.status=a,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},tS=class extends Jy{constructor(s,a){super(s),this.name="StorageVectorsUnknownError",this.originalError=a}};const pf=s=>s?(...a)=>s(...a):(...a)=>fetch(...a),aS=s=>{if(typeof s!="object"||s===null)return!1;const a=Object.getPrototypeOf(s);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(Symbol.toStringTag in s)&&!(Symbol.iterator in s)},qg=s=>s.msg||s.message||s.error_description||s.error||JSON.stringify(s),sS=async(s,a,r)=>{if(s&&typeof s=="object"&&"status"in s&&"ok"in s&&typeof s.status=="number"&&!r?.noResolveJson){const l=s.status||500,c=s;if(typeof c.json=="function")c.json().then(d=>{const h=d?.statusCode||d?.code||l+"";a(new jd(qg(d),l,h))}).catch(()=>{const d=l+"";a(new jd(c.statusText||`HTTP ${l} error`,l,d))});else{const d=l+"";a(new jd(c.statusText||`HTTP ${l} error`,l,d))}}else a(new tS(qg(s),s))},nS=(s,a,r,l)=>{const c={method:s,headers:a?.headers||{}};return l?(aS(l)?(c.headers=me({"Content-Type":"application/json"},a?.headers),c.body=JSON.stringify(l)):c.body=l,me(me({},c),r)):c};async function rS(s,a,r,l,c,d){return new Promise((h,m)=>{s(r,nS(a,l,c,d)).then(y=>{if(!y.ok)throw y;if(l?.noResolveJson)return y;const p=y.headers.get("content-type");return!p||!p.includes("application/json")?{}:y.json()}).then(y=>h(y)).catch(y=>sS(y,m,l))})}async function Qt(s,a,r,l,c){return rS(s,"POST",a,l,c,r)}var iS=class{constructor(s,a={},r){this.shouldThrowOnError=!1,this.url=s.replace(/\/$/,""),this.headers=me(me({},mf),a),this.fetch=pf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/CreateIndex`,s,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async getIndex(s,a){var r=this;try{return{data:await Qt(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:s,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(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/ListIndexes`,s,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async deleteIndex(s,a){var r=this;try{return{data:await Qt(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:s,indexName:a},{headers:r.headers})||{},error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Xt(l))return{data:null,error:l};throw l}}},lS=class{constructor(s,a={},r){this.shouldThrowOnError=!1,this.url=s.replace(/\/$/,""),this.headers=me(me({},mf),a),this.fetch=pf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(s){var a=this;try{if(s.vectors.length<1||s.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`,s,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async getVectors(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/GetVectors`,s,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async listVectors(s){var a=this;try{if(s.segmentCount!==void 0){if(s.segmentCount<1||s.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(s.segmentIndex!==void 0&&(s.segmentIndex<0||s.segmentIndex>=s.segmentCount))throw new Error(`segmentIndex must be between 0 and ${s.segmentCount-1}`)}return{data:await Qt(a.fetch,`${a.url}/ListVectors`,s,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async queryVectors(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/QueryVectors`,s,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async deleteVectors(s){var a=this;try{if(s.keys.length<1||s.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`,s,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}},oS=class{constructor(s,a={},r){this.shouldThrowOnError=!1,this.url=s.replace(/\/$/,""),this.headers=me(me({},mf),a),this.fetch=pf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/CreateVectorBucket`,{vectorBucketName:s},{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async getBucket(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/GetVectorBucket`,{vectorBucketName:s},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async listBuckets(s={}){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/ListVectorBuckets`,s,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async deleteBucket(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/DeleteVectorBucket`,{vectorBucketName:s},{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}},cS=class extends oS{constructor(s,a={}){super(s,a.headers||{},a.fetch)}from(s){return new uS(this.url,this.headers,s,this.fetch)}async createBucket(s){var a=()=>super.createBucket,r=this;return a().call(r,s)}async getBucket(s){var a=()=>super.getBucket,r=this;return a().call(r,s)}async listBuckets(s={}){var a=()=>super.listBuckets,r=this;return a().call(r,s)}async deleteBucket(s){var a=()=>super.deleteBucket,r=this;return a().call(r,s)}},uS=class extends iS{constructor(s,a,r,l){super(s,a,l),this.vectorBucketName=r}async createIndex(s){var a=()=>super.createIndex,r=this;return a().call(r,me(me({},s),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(s={}){var a=()=>super.listIndexes,r=this;return a().call(r,me(me({},s),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(s){var a=()=>super.getIndex,r=this;return a().call(r,r.vectorBucketName,s)}async deleteIndex(s){var a=()=>super.deleteIndex,r=this;return a().call(r,r.vectorBucketName,s)}index(s){return new dS(this.url,this.headers,this.vectorBucketName,s,this.fetch)}},dS=class extends lS{constructor(s,a,r,l,c){super(s,a,c),this.vectorBucketName=r,this.indexName=l}async putVectors(s){var a=()=>super.putVectors,r=this;return a().call(r,me(me({},s),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(s){var a=()=>super.getVectors,r=this;return a().call(r,me(me({},s),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(s={}){var a=()=>super.listVectors,r=this;return a().call(r,me(me({},s),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(s){var a=()=>super.queryVectors,r=this;return a().call(r,me(me({},s),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(s){var a=()=>super.deleteVectors,r=this;return a().call(r,me(me({},s),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},fS=class extends W1{constructor(s,a={},r,l){super(s,a,r,l)}from(s){return new F1(this.url,this.headers,s,this.fetch)}get vectors(){return new cS(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new eS(this.url+"/iceberg",this.headers,this.fetch)}};const Xy="2.90.1",Nr=30*1e3,Qd=3,Nd=Qd*Nr,hS="http://localhost:9999",mS="supabase.auth.token",pS={"X-Client-Info":`gotrue-js/${Xy}`},Zd="X-Supabase-Api-Version",Qy={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},gS=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,yS=600*1e3;class Ji extends Error{constructor(a,r,l){super(a),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=l}}function le(s){return typeof s=="object"&&s!==null&&"__isAuthError"in s}class vS extends Ji{constructor(a,r,l){super(a,r,l),this.name="AuthApiError",this.status=r,this.code=l}}function bS(s){return le(s)&&s.name==="AuthApiError"}class pn extends Ji{constructor(a,r){super(a),this.name="AuthUnknownError",this.originalError=r}}class ss extends Ji{constructor(a,r,l,c){super(a,l,c),this.name=r,this.status=l}}class Jt extends ss{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function xS(s){return le(s)&&s.name==="AuthSessionMissingError"}class gr extends ss{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class jo extends ss{constructor(a){super(a,"AuthInvalidCredentialsError",400,void 0)}}class No extends ss{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 wS(s){return le(s)&&s.name==="AuthImplicitGrantRedirectError"}class $g extends ss{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 _S extends ss{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 Fd extends ss{constructor(a,r){super(a,"AuthRetryableFetchError",r,void 0)}}function Ed(s){return le(s)&&s.name==="AuthRetryableFetchError"}class Hg extends ss{constructor(a,r,l){super(a,"AuthWeakPasswordError",r,"weak_password"),this.reasons=l}}class Wd extends ss{constructor(a){super(a,"AuthInvalidJwtError",400,"invalid_jwt")}}const $o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Vg=`
35
- \r=`.split(""),SS=(()=>{const s=new Array(128);for(let a=0;a<s.length;a+=1)s[a]=-1;for(let a=0;a<Vg.length;a+=1)s[Vg[a].charCodeAt(0)]=-2;for(let a=0;a<$o.length;a+=1)s[$o[a].charCodeAt(0)]=a;return s})();function Ig(s,a,r){if(s!==null)for(a.queue=a.queue<<8|s,a.queuedBits+=8;a.queuedBits>=6;){const l=a.queue>>a.queuedBits-6&63;r($o[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($o[l]),a.queuedBits-=6}}function Zy(s,a,r){const l=SS[s];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(s)}"`)}}function Gg(s){const a=[],r=h=>{a.push(String.fromCodePoint(h))},l={utf8seq:0,codepoint:0},c={queue:0,queuedBits:0},d=h=>{ES(h,l,r)};for(let h=0;h<s.length;h+=1)Zy(s.charCodeAt(h),c,d);return a.join("")}function jS(s,a){if(s<=127){a(s);return}else if(s<=2047){a(192|s>>6),a(128|s&63);return}else if(s<=65535){a(224|s>>12),a(128|s>>6&63),a(128|s&63);return}else if(s<=1114111){a(240|s>>18),a(128|s>>12&63),a(128|s>>6&63),a(128|s&63);return}throw new Error(`Unrecognized Unicode codepoint: ${s.toString(16)}`)}function NS(s,a){for(let r=0;r<s.length;r+=1){let l=s.charCodeAt(r);if(l>55295&&l<=56319){const c=(l-55296)*1024&65535;l=(s.charCodeAt(r+1)-56320&65535|c)+65536,r+=1}jS(l,a)}}function ES(s,a,r){if(a.utf8seq===0){if(s<=127){r(s);return}for(let l=1;l<6;l+=1)if((s>>7-l&1)===0){a.utf8seq=l;break}if(a.utf8seq===2)a.codepoint=s&31;else if(a.utf8seq===3)a.codepoint=s&15;else if(a.utf8seq===4)a.codepoint=s&7;else throw new Error("Invalid UTF-8 sequence");a.utf8seq-=1}else if(a.utf8seq>0){if(s<=127)throw new Error("Invalid UTF-8 sequence");a.codepoint=a.codepoint<<6|s&63,a.utf8seq-=1,a.utf8seq===0&&r(a.codepoint)}}function Cr(s){const a=[],r={queue:0,queuedBits:0},l=c=>{a.push(c)};for(let c=0;c<s.length;c+=1)Zy(s.charCodeAt(c),r,l);return new Uint8Array(a)}function TS(s){const a=[];return NS(s,r=>a.push(r)),new Uint8Array(a)}function gn(s){const a=[],r={queue:0,queuedBits:0},l=c=>{a.push(c)};return s.forEach(c=>Ig(c,r,l)),Ig(null,r,l),a.join("")}function AS(s){return Math.round(Date.now()/1e3)+s}function CS(){return Symbol("auth-callback")}const Tt=()=>typeof window<"u"&&typeof document<"u",dn={tested:!1,writable:!1},Fy=()=>{if(!Tt())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(dn.tested)return dn.writable;const s=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(s,s),globalThis.localStorage.removeItem(s),dn.tested=!0,dn.writable=!0}catch{dn.tested=!0,dn.writable=!1}return dn.writable};function kS(s){const a={},r=new URL(s);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 Wy=s=>s?(...a)=>s(...a):(...a)=>fetch(...a),OS=s=>typeof s=="object"&&s!==null&&"status"in s&&"ok"in s&&"json"in s&&typeof s.json=="function",Er=async(s,a,r)=>{await s.setItem(a,JSON.stringify(r))},fn=async(s,a)=>{const r=await s.getItem(a);if(!r)return null;try{return JSON.parse(r)}catch{return r}},Et=async(s,a)=>{await s.removeItem(a)};class Ko{constructor(){this.promise=new Ko.promiseConstructor((a,r)=>{this.resolve=a,this.reject=r})}}Ko.promiseConstructor=Promise;function Td(s){const a=s.split(".");if(a.length!==3)throw new Wd("Invalid JWT structure");for(let l=0;l<a.length;l++)if(!gS.test(a[l]))throw new Wd("JWT not in base64url format");return{header:JSON.parse(Gg(a[0])),payload:JSON.parse(Gg(a[1])),signature:Cr(a[2]),raw:{header:a[0],payload:a[1]}}}async function RS(s){return await new Promise(a=>{setTimeout(()=>a(null),s)})}function DS(s,a){return new Promise((l,c)=>{(async()=>{for(let d=0;d<1/0;d++)try{const h=await s(d);if(!a(d,null,h)){l(h);return}}catch(h){if(!a(d,h)){c(h);return}}})()})}function MS(s){return("0"+s.toString(16)).substr(-2)}function zS(){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,MS).join("")}async function US(s){const r=new TextEncoder().encode(s),l=await crypto.subtle.digest("SHA-256",r),c=new Uint8Array(l);return Array.from(c).map(d=>String.fromCharCode(d)).join("")}async function LS(s){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."),s;const r=await US(s);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function yr(s,a,r=!1){const l=zS();let c=l;r&&(c+="/PASSWORD_RECOVERY"),await Er(s,`${a}-code-verifier`,c);const d=await LS(l);return[d,l===d?"plain":"s256"]}const BS=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function qS(s){const a=s.headers.get(Zd);if(!a||!a.match(BS))return null;try{return new Date(`${a}T00:00:00.0Z`)}catch{return null}}function $S(s){if(!s)throw new Error("Missing exp claim");const a=Math.floor(Date.now()/1e3);if(s<=a)throw new Error("JWT has expired")}function HS(s){switch(s){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 VS=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function vr(s){if(!VS.test(s))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Ad(){const s={};return new Proxy(s,{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 IS(s,a){return new Proxy(s,{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 Pg(s){return JSON.parse(JSON.stringify(s))}const hn=s=>s.msg||s.message||s.error_description||s.error||JSON.stringify(s),GS=[502,503,504];async function Kg(s){var a;if(!OS(s))throw new Fd(hn(s),0);if(GS.includes(s.status))throw new Fd(hn(s),s.status);let r;try{r=await s.json()}catch(d){throw new pn(hn(d),d)}let l;const c=qS(s);if(c&&c.getTime()>=Qy["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 Hg(hn(r),s.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 Hg(hn(r),s.status,r.weak_password.reasons);throw new vS(hn(r),s.status||500,l)}const PS=(s,a,r,l)=>{const c={method:s,headers:a?.headers||{}};return s==="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 he(s,a,r,l){var c;const d=Object.assign({},l?.headers);d[Zd]||(d[Zd]=Qy["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():"",y=await KS(s,a,r+m,{headers:d,noResolveJson:l?.noResolveJson},{},l?.body);return l?.xform?l?.xform(y):{data:Object.assign({},y),error:null}}async function KS(s,a,r,l,c,d){const h=PS(a,l,c,d);let m;try{m=await s(r,Object.assign({},h))}catch(y){throw console.error(y),new Fd(hn(y),0)}if(m.ok||await Kg(m),l?.noResolveJson)return m;try{return await m.json()}catch(y){await Kg(y)}}function fa(s){var a;let r=null;XS(s)&&(r=Object.assign({},s),s.expires_at||(r.expires_at=AS(s.expires_in)));const l=(a=s.user)!==null&&a!==void 0?a:s;return{data:{session:r,user:l},error:null}}function Yg(s){const a=fa(s);return!a.error&&s.weak_password&&typeof s.weak_password=="object"&&Array.isArray(s.weak_password.reasons)&&s.weak_password.reasons.length&&s.weak_password.message&&typeof s.weak_password.message=="string"&&s.weak_password.reasons.reduce((r,l)=>r&&typeof l=="string",!0)&&(a.data.weak_password=s.weak_password),a}function Us(s){var a;return{data:{user:(a=s.user)!==null&&a!==void 0?a:s},error:null}}function YS(s){return{data:s,error:null}}function JS(s){const{action_link:a,email_otp:r,hashed_token:l,redirect_to:c,verification_type:d}=s,h=Lr(s,["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},y=Object.assign({},h);return{data:{properties:m,user:y},error:null}}function Jg(s){return s}function XS(s){return s.access_token&&s.refresh_token&&s.expires_in}const Cd=["global","local","others"];class QS{constructor({url:a="",headers:r={},fetch:l}){this.url=a,this.headers=r,this.fetch=Wy(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=Cd[0]){if(Cd.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Cd.join(", ")}`);try{return await he(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:a,noResolveJson:!0}),{data:null,error:null}}catch(l){if(le(l))return{data:null,error:l};throw l}}async inviteUserByEmail(a,r={}){try{return await he(this.fetch,"POST",`${this.url}/invite`,{body:{email:a,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:Us})}catch(l){if(le(l))return{data:{user:null},error:l};throw l}}async generateLink(a){try{const{options:r}=a,l=Lr(a,["options"]),c=Object.assign(Object.assign({},l),r);return"newEmail"in l&&(c.new_email=l?.newEmail,delete c.newEmail),await he(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:c,headers:this.headers,xform:JS,redirectTo:r?.redirectTo})}catch(r){if(le(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(a){try{return await he(this.fetch,"POST",`${this.url}/admin/users`,{body:a,headers:this.headers,xform:Us})}catch(r){if(le(r))return{data:{user:null},error:r};throw r}}async listUsers(a){var r,l,c,d,h,m,y;try{const p={nextPage:null,lastPage:0,total:0},g=await he(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:Jg});if(g.error)throw g.error;const w=await g.json(),_=(h=g.headers.get("x-total-count"))!==null&&h!==void 0?h:0,S=(y=(m=g.headers.get("link"))===null||m===void 0?void 0:m.split(","))!==null&&y!==void 0?y:[];return S.length>0&&(S.forEach(E=>{const j=parseInt(E.split(";")[0].split("=")[1].substring(0,1)),R=JSON.parse(E.split(";")[1].split("=")[1]);p[`${R}Page`]=j}),p.total=parseInt(_)),{data:Object.assign(Object.assign({},w),p),error:null}}catch(p){if(le(p))return{data:{users:[]},error:p};throw p}}async getUserById(a){vr(a);try{return await he(this.fetch,"GET",`${this.url}/admin/users/${a}`,{headers:this.headers,xform:Us})}catch(r){if(le(r))return{data:{user:null},error:r};throw r}}async updateUserById(a,r){vr(a);try{return await he(this.fetch,"PUT",`${this.url}/admin/users/${a}`,{body:r,headers:this.headers,xform:Us})}catch(l){if(le(l))return{data:{user:null},error:l};throw l}}async deleteUser(a,r=!1){vr(a);try{return await he(this.fetch,"DELETE",`${this.url}/admin/users/${a}`,{headers:this.headers,body:{should_soft_delete:r},xform:Us})}catch(l){if(le(l))return{data:{user:null},error:l};throw l}}async _listFactors(a){vr(a.userId);try{const{data:r,error:l}=await he(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(le(r))return{data:null,error:r};throw r}}async _deleteFactor(a){vr(a.userId),vr(a.id);try{return{data:await he(this.fetch,"DELETE",`${this.url}/admin/users/${a.userId}/factors/${a.id}`,{headers:this.headers}),error:null}}catch(r){if(le(r))return{data:null,error:r};throw r}}async _listOAuthClients(a){var r,l,c,d,h,m,y;try{const p={nextPage:null,lastPage:0,total:0},g=await he(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:Jg});if(g.error)throw g.error;const w=await g.json(),_=(h=g.headers.get("x-total-count"))!==null&&h!==void 0?h:0,S=(y=(m=g.headers.get("link"))===null||m===void 0?void 0:m.split(","))!==null&&y!==void 0?y:[];return S.length>0&&(S.forEach(E=>{const j=parseInt(E.split(";")[0].split("=")[1].substring(0,1)),R=JSON.parse(E.split(";")[1].split("=")[1]);p[`${R}Page`]=j}),p.total=parseInt(_)),{data:Object.assign(Object.assign({},w),p),error:null}}catch(p){if(le(p))return{data:{clients:[]},error:p};throw p}}async _createOAuthClient(a){try{return await he(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:a,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(le(r))return{data:null,error:r};throw r}}async _getOAuthClient(a){try{return await he(this.fetch,"GET",`${this.url}/admin/oauth/clients/${a}`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(le(r))return{data:null,error:r};throw r}}async _updateOAuthClient(a,r){try{return await he(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${a}`,{body:r,headers:this.headers,xform:l=>({data:l,error:null})})}catch(l){if(le(l))return{data:null,error:l};throw l}}async _deleteOAuthClient(a){try{return await he(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${a}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if(le(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(a){try{return await he(this.fetch,"POST",`${this.url}/admin/oauth/clients/${a}/regenerate_secret`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(le(r))return{data:null,error:r};throw r}}}function Xg(s={}){return{getItem:a=>s[a]||null,setItem:(a,r)=>{s[a]=r},removeItem:a=>{delete s[a]}}}const br={debug:!!(globalThis&&Fy()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class ev extends Error{constructor(a){super(a),this.isAcquireTimeout=!0}}class ZS extends ev{}async function FS(s,a,r){br.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",s,a);const l=new globalThis.AbortController;return a>0&&setTimeout(()=>{l.abort(),br.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",s)},a),await Promise.resolve().then(()=>globalThis.navigator.locks.request(s,a===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:l.signal},async c=>{if(c){br.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",s,c.name);try{return await r()}finally{br.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",s,c.name)}}else{if(a===0)throw br.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",s),new ZS(`Acquiring an exclusive Navigator LockManager lock "${s}" immediately failed`);if(br.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 WS(){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 tv(s){if(!/^0x[a-fA-F0-9]{40}$/.test(s))throw new Error(`@supabase/auth-js: Address "${s}" is invalid.`);return s.toLowerCase()}function ej(s){return parseInt(s,16)}function tj(s){const a=new TextEncoder().encode(s);return"0x"+Array.from(a,l=>l.toString(16).padStart(2,"0")).join("")}function aj(s){var a;const{chainId:r,domain:l,expirationTime:c,issuedAt:d=new Date,nonce:h,notBefore:m,requestId:y,resources:p,scheme:g,uri:w,version:_}=s;{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(!w)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(_!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${_}`);if(!((a=s.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: ${s.statement}`)}const S=tv(s.address),E=g?`${g}://${l}`:l,j=s.statement?`${s.statement}
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 zs.connecting:return mn.Connecting;case zs.open:return mn.Open;case zs.closing:return mn.Closing;default:return mn.Closed}}isConnected(){return this.connectionState()===mn.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 Cr(`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 y;(y=this.conn)===null||y===void 0||y.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(_1,"heartbeat timeout"),setTimeout(()=>{var r;this.isConnected()||(r=this.reconnectTimer)===null||r===void 0||r.scheduleTimeout()},So.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 p=this._heartbeatSentAt?Date.now()-this._heartbeatSentAt:void 0;try{this.heartbeatCallback(r.payload.status==="ok"?"ok":"error",p)}catch(g){this.log("error","error in heartbeat callback",g)}this._heartbeatSentAt=null,this.pendingHeartbeatRef=null}const{topic:l,event:c,payload:d,ref:h}=r,m=h?`(${h})`:"",y=d.status||"";this.log("receive",`${y} ${l} ${c} ${m}`.trim(),d),this.channels.filter(p=>p._isMember(l)).forEach(p=>p._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===zs.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===zs.open||this.conn.readyState===zs.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(ma.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([D1],{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:x1};r&&c.updateJoinPayload(d),c.joinedOnce&&c._isJoined()&&c._push(ma.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 Py(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},So.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(a){var r,l,c,d,h,m,y,p,g,w,_,S;switch(this.transport=(r=a?.transport)!==null&&r!==void 0?r:null,this.timeout=(l=a?.timeout)!==null&&l!==void 0?l:Pd,this.heartbeatIntervalMs=(c=a?.heartbeatIntervalMs)!==null&&c!==void 0?c:So.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:Sd,this.vsn=(y=a?.vsn)!==null&&y!==void 0?y:Mg,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=(p=a?.reconnectAfterMs)!==null&&p!==void 0?p:(E=>O1[E-1]||R1),this.vsn){case Gy:this.encode=(g=a?.encode)!==null&&g!==void 0?g:((E,j)=>j(JSON.stringify(E))),this.decode=(w=a?.decode)!==null&&w!==void 0?w:((E,j)=>j(JSON.parse(E)));break;case w1:this.encode=(_=a?.encode)!==null&&_!==void 0?_: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 Ki=class extends Error{constructor(s,a){super(s),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 z1(s,a,r){const l=new URL(a,s);if(r)for(const[c,d]of Object.entries(r))d!==void 0&&l.searchParams.set(c,d);return l.toString()}async function U1(s){return!s||s.type==="none"?{}:s.type==="bearer"?{Authorization:`Bearer ${s.token}`}:s.type==="header"?{[s.name]:s.value}:s.type==="custom"?await s.getHeaders():{}}function L1(s){const a=s.fetchImpl??globalThis.fetch;return{async request({method:r,path:l,query:c,body:d,headers:h}){const m=z1(s.baseUrl,l,c),y=await U1(s.auth),p=await a(m,{method:r,headers:{...d?{"Content-Type":"application/json"}:{},...y,...h},body:d?JSON.stringify(d):void 0}),g=await p.text(),w=(p.headers.get("content-type")||"").includes("application/json"),_=w&&g?JSON.parse(g):g;if(!p.ok){const S=w?_:void 0,E=S?.error;throw new Ki(E?.message??`Request failed with status ${p.status}`,{status:p.status,icebergType:E?.type,icebergCode:E?.code,details:S})}return{status:p.status,headers:p.headers,data:_}}}}function jo(s){return s.join("")}var B1=class{constructor(s,a=""){this.client=s,this.prefix=a}async listNamespaces(s){const a=s?{parent:jo(s.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:a})).data.namespaces.map(l=>({namespace:l}))}async createNamespace(s,a){const r={namespace:s.namespace,properties:a?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(s){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${jo(s.namespace)}`})}async loadNamespaceMetadata(s){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${jo(s.namespace)}`})).data.properties}}async namespaceExists(s){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${jo(s.namespace)}`}),!0}catch(a){if(a instanceof Ki&&a.status===404)return!1;throw a}}async createNamespaceIfNotExists(s,a){try{return await this.createNamespace(s,a)}catch(r){if(r instanceof Ki&&r.status===409)return;throw r}}};function gr(s){return s.join("")}var q1=class{constructor(s,a="",r){this.client=s,this.prefix=a,this.accessDelegation=r}async listTables(s){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${gr(s.namespace)}/tables`})).data.identifiers}async createTable(s,a){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${gr(s.namespace)}/tables`,body:a,headers:r})).data.metadata}async updateTable(s,a){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${gr(s.namespace)}/tables/${s.name}`,body:a});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(s,a){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${gr(s.namespace)}/tables/${s.name}`,query:{purgeRequested:String(a?.purge??!1)}})}async loadTable(s){const a={};return this.accessDelegation&&(a["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${gr(s.namespace)}/tables/${s.name}`,headers:a})).data.metadata}async tableExists(s){const a={};this.accessDelegation&&(a["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${gr(s.namespace)}/tables/${s.name}`,headers:a}),!0}catch(r){if(r instanceof Ki&&r.status===404)return!1;throw r}}async createTableIfNotExists(s,a){try{return await this.createTable(s,a)}catch(r){if(r instanceof Ki&&r.status===409)return await this.loadTable({namespace:s.namespace,name:a.name});throw r}}},$1=class{constructor(s){let a="v1";s.catalogName&&(a+=`/${s.catalogName}`);const r=s.baseUrl.endsWith("/")?s.baseUrl:`${s.baseUrl}/`;this.client=L1({baseUrl:r,auth:s.auth,fetchImpl:s.fetch}),this.accessDelegation=s.accessDelegation?.join(","),this.namespaceOps=new B1(this.client,a),this.tableOps=new q1(this.client,a,this.accessDelegation)}async listNamespaces(s){return this.namespaceOps.listNamespaces(s)}async createNamespace(s,a){return this.namespaceOps.createNamespace(s,a)}async dropNamespace(s){await this.namespaceOps.dropNamespace(s)}async loadNamespaceMetadata(s){return this.namespaceOps.loadNamespaceMetadata(s)}async listTables(s){return this.tableOps.listTables(s)}async createTable(s,a){return this.tableOps.createTable(s,a)}async updateTable(s,a){return this.tableOps.updateTable(s,a)}async dropTable(s,a){await this.tableOps.dropTable(s,a)}async loadTable(s){return this.tableOps.loadTable(s)}async namespaceExists(s){return this.namespaceOps.namespaceExists(s)}async tableExists(s){return this.tableOps.tableExists(s)}async createNamespaceIfNotExists(s,a){return this.namespaceOps.createNamespaceIfNotExists(s,a)}async createTableIfNotExists(s,a){return this.tableOps.createTableIfNotExists(s,a)}},Ko=class extends Error{constructor(s){super(s),this.__isStorageError=!0,this.name="StorageError"}};function Qe(s){return typeof s=="object"&&s!==null&&"__isStorageError"in s}var H1=class extends Ko{constructor(s,a,r){super(s),this.name="StorageApiError",this.status=a,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Jd=class extends Ko{constructor(s,a){super(s),this.name="StorageUnknownError",this.originalError=a}};const mf=s=>s?(...a)=>s(...a):(...a)=>fetch(...a),V1=()=>Response,Xd=s=>{if(Array.isArray(s))return s.map(r=>Xd(r));if(typeof s=="function"||s!==Object(s))return s;const a={};return Object.entries(s).forEach(([r,l])=>{const c=r.replace(/([-_][a-z])/gi,d=>d.toUpperCase().replace(/[-_]/g,""));a[c]=Xd(l)}),a},I1=s=>{if(typeof s!="object"||s===null)return!1;const a=Object.getPrototypeOf(s);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(Symbol.toStringTag in s)&&!(Symbol.iterator in s)},G1=s=>!s||typeof s!="string"||s.length===0||s.length>100||s.trim()!==s||s.includes("/")||s.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(s);function Yi(s){"@babel/helpers - typeof";return Yi=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},Yi(s)}function P1(s,a){if(Yi(s)!="object"||!s)return s;var r=s[Symbol.toPrimitive];if(r!==void 0){var l=r.call(s,a);if(Yi(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(s)}function K1(s){var a=P1(s,"string");return Yi(a)=="symbol"?a:a+""}function Y1(s,a,r){return(a=K1(a))in s?Object.defineProperty(s,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):s[a]=r,s}function Bg(s,a){var r=Object.keys(s);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(s);a&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(s,c).enumerable})),r.push.apply(r,l)}return r}function ge(s){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?Bg(Object(r),!0).forEach(function(l){Y1(s,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(r)):Bg(Object(r)).forEach(function(l){Object.defineProperty(s,l,Object.getOwnPropertyDescriptor(r,l))})}return s}const jd=s=>{var a;return s.msg||s.message||s.error_description||(typeof s.error=="string"?s.error:(a=s.error)===null||a===void 0?void 0:a.message)||JSON.stringify(s)},J1=async(s,a,r)=>{s instanceof await V1()&&!r?.noResolveJson?s.json().then(l=>{const c=s.status||500,d=l?.statusCode||c+"";a(new H1(jd(l),c,d))}).catch(l=>{a(new Jd(jd(l),l))}):a(new Jd(jd(s),s))},X1=(s,a,r,l)=>{const c={method:s,headers:a?.headers||{}};return s==="GET"||!l?c:(I1(l)?(c.headers=ge({"Content-Type":"application/json"},a?.headers),c.body=JSON.stringify(l)):c.body=l,a?.duplex&&(c.duplex=a.duplex),ge(ge({},c),r))};async function sl(s,a,r,l,c,d){return new Promise((h,m)=>{s(r,X1(a,l,c,d)).then(y=>{if(!y.ok)throw y;return l?.noResolveJson?y:y.json()}).then(y=>h(y)).catch(y=>J1(y,m,l))})}async function Ji(s,a,r,l){return sl(s,"GET",a,r,l)}async function ha(s,a,r,l,c){return sl(s,"POST",a,l,c,r)}async function Qd(s,a,r,l,c){return sl(s,"PUT",a,l,c,r)}async function Q1(s,a,r,l){return sl(s,"HEAD",a,ge(ge({},r),{},{noResolveJson:!0}),l)}async function pf(s,a,r,l,c){return sl(s,"DELETE",a,l,c,r)}var Z1=class{constructor(s,a){this.downloadFn=s,this.shouldThrowOnError=a}then(s,a){return this.execute().then(s,a)}async execute(){var s=this;try{return{data:(await s.downloadFn()).body,error:null}}catch(a){if(s.shouldThrowOnError)throw a;if(Qe(a))return{data:null,error:a};throw a}}};let Jy;Jy=Symbol.toStringTag;var F1=class{constructor(s,a){this.downloadFn=s,this.shouldThrowOnError=a,this[Jy]="BlobDownloadBuilder",this.promise=null}asStream(){return new Z1(this.downloadFn,this.shouldThrowOnError)}then(s,a){return this.getPromise().then(s,a)}catch(s){return this.getPromise().catch(s)}finally(s){return this.getPromise().finally(s)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var s=this;try{return{data:await(await s.downloadFn()).blob(),error:null}}catch(a){if(s.shouldThrowOnError)throw a;if(Qe(a))return{data:null,error:a};throw a}}};const W1={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},qg={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var eS=class{constructor(s,a={},r,l){this.shouldThrowOnError=!1,this.url=s,this.headers=a,this.bucketId=r,this.fetch=mf(l)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(s,a,r,l){var c=this;try{let d;const h=ge(ge({},qg),l);let m=ge(ge({},c.headers),s==="POST"&&{"x-upsert":String(h.upsert)});const y=h.metadata;typeof Blob<"u"&&r instanceof Blob?(d=new FormData,d.append("cacheControl",h.cacheControl),y&&d.append("metadata",c.encodeMetadata(y)),d.append("",r)):typeof FormData<"u"&&r instanceof FormData?(d=r,d.has("cacheControl")||d.append("cacheControl",h.cacheControl),y&&!d.has("metadata")&&d.append("metadata",c.encodeMetadata(y))):(d=r,m["cache-control"]=`max-age=${h.cacheControl}`,m["content-type"]=h.contentType,y&&(m["x-metadata"]=c.toBase64(c.encodeMetadata(y))),(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=ge(ge({},m),l.headers));const p=c._removeEmptyFolders(a),g=c._getFinalPath(p),w=await(s=="PUT"?Qd:ha)(c.fetch,`${c.url}/object/${g}`,d,ge({headers:m},h?.duplex?{duplex:h.duplex}:{}));return{data:{path:p,id:w.Id,fullPath:w.Key},error:null}}catch(d){if(c.shouldThrowOnError)throw d;if(Qe(d))return{data:null,error:d};throw d}}async upload(s,a,r){return this.uploadOrUpdate("POST",s,a,r)}async uploadToSignedUrl(s,a,r,l){var c=this;const d=c._removeEmptyFolders(s),h=c._getFinalPath(d),m=new URL(c.url+`/object/upload/sign/${h}`);m.searchParams.set("token",a);try{let y;const p=ge({upsert:qg.upsert},l),g=ge(ge({},c.headers),{"x-upsert":String(p.upsert)});return typeof Blob<"u"&&r instanceof Blob?(y=new FormData,y.append("cacheControl",p.cacheControl),y.append("",r)):typeof FormData<"u"&&r instanceof FormData?(y=r,y.append("cacheControl",p.cacheControl)):(y=r,g["cache-control"]=`max-age=${p.cacheControl}`,g["content-type"]=p.contentType),{data:{path:d,fullPath:(await Qd(c.fetch,m.toString(),y,{headers:g})).Key},error:null}}catch(y){if(c.shouldThrowOnError)throw y;if(Qe(y))return{data:null,error:y};throw y}}async createSignedUploadUrl(s,a){var r=this;try{let l=r._getFinalPath(s);const c=ge({},r.headers);a?.upsert&&(c["x-upsert"]="true");const d=await ha(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 Ko("No token returned by API");return{data:{signedUrl:h.toString(),path:s,token:m},error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Qe(l))return{data:null,error:l};throw l}}async update(s,a,r){return this.uploadOrUpdate("PUT",s,a,r)}async move(s,a,r){var l=this;try{return{data:await ha(l.fetch,`${l.url}/object/move`,{bucketId:l.bucketId,sourceKey:s,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(s,a,r){var l=this;try{return{data:{path:(await ha(l.fetch,`${l.url}/object/copy`,{bucketId:l.bucketId,sourceKey:s,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(s,a,r){var l=this;try{let c=l._getFinalPath(s),d=await ha(l.fetch,`${l.url}/object/sign/${c}`,ge({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(s,a,r){var l=this;try{const c=await ha(l.fetch,`${l.url}/object/sign/${l.bucketId}`,{expiresIn:a,paths:s},{headers:l.headers}),d=r?.download?`&download=${r.download===!0?"":r.download}`:"";return{data:c.map(h=>ge(ge({},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(s,a){const r=typeof a?.transform<"u"?"render/image/authenticated":"object",l=this.transformOptsToQueryString(a?.transform||{}),c=l?`?${l}`:"",d=this._getFinalPath(s),h=()=>Ji(this.fetch,`${this.url}/${r}/${d}${c}`,{headers:this.headers,noResolveJson:!0});return new F1(h,this.shouldThrowOnError)}async info(s){var a=this;const r=a._getFinalPath(s);try{return{data:Xd(await Ji(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(s){var a=this;const r=a._getFinalPath(s);try{return await Q1(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 Jd){const c=l.originalError;if([400,404].includes(c?.status))return{data:!1,error:l}}throw l}}getPublicUrl(s,a){const r=this._getFinalPath(s),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(s){var a=this;try{return{data:await pf(a.fetch,`${a.url}/object/${a.bucketId}`,{prefixes:s},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async list(s,a,r){var l=this;try{const c=ge(ge(ge({},W1),a),{},{prefix:s||""});return{data:await ha(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(s,a){var r=this;try{const l=ge({},s);return{data:await ha(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(s){return JSON.stringify(s)}toBase64(s){return typeof Buffer<"u"?Buffer.from(s).toString("base64"):btoa(s)}_getFinalPath(s){return`${this.bucketId}/${s.replace(/^\/+/,"")}`}_removeEmptyFolders(s){return s.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(s){const a=[];return s.width&&a.push(`width=${s.width}`),s.height&&a.push(`height=${s.height}`),s.resize&&a.push(`resize=${s.resize}`),s.format&&a.push(`format=${s.format}`),s.quality&&a.push(`quality=${s.quality}`),a.join("&")}};const Xy="2.90.1",Qy={"X-Client-Info":`storage-js/${Xy}`};var tS=class{constructor(s,a={},r,l){this.shouldThrowOnError=!1;const c=new URL(s);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=ge(ge({},Qy),a),this.fetch=mf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(s){var a=this;try{const r=a.listBucketOptionsToQueryString(s);return{data:await Ji(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(s){var a=this;try{return{data:await Ji(a.fetch,`${a.url}/bucket/${s}`,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async createBucket(s,a={public:!1}){var r=this;try{return{data:await ha(r.fetch,`${r.url}/bucket`,{id:s,name:s,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(s,a){var r=this;try{return{data:await Qd(r.fetch,`${r.url}/bucket/${s}`,{id:s,name:s,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(s){var a=this;try{return{data:await ha(a.fetch,`${a.url}/bucket/${s}/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(s){var a=this;try{return{data:await pf(a.fetch,`${a.url}/bucket/${s}`,{},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}listBucketOptionsToQueryString(s){const a={};return s&&("limit"in s&&(a.limit=String(s.limit)),"offset"in s&&(a.offset=String(s.offset)),s.search&&(a.search=s.search),s.sortColumn&&(a.sortColumn=s.sortColumn),s.sortOrder&&(a.sortOrder=s.sortOrder)),Object.keys(a).length>0?"?"+new URLSearchParams(a).toString():""}},aS=class{constructor(s,a={},r){this.shouldThrowOnError=!1,this.url=s.replace(/\/$/,""),this.headers=ge(ge({},Qy),a),this.fetch=mf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(s){var a=this;try{return{data:await ha(a.fetch,`${a.url}/bucket`,{name:s},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}async listBuckets(s){var a=this;try{const r=new URLSearchParams;s?.limit!==void 0&&r.set("limit",s.limit.toString()),s?.offset!==void 0&&r.set("offset",s.offset.toString()),s?.sortColumn&&r.set("sortColumn",s.sortColumn),s?.sortOrder&&r.set("sortOrder",s.sortOrder),s?.search&&r.set("search",s.search);const l=r.toString(),c=l?`${a.url}/bucket?${l}`:`${a.url}/bucket`;return{data:await Ji(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(s){var a=this;try{return{data:await pf(a.fetch,`${a.url}/bucket/${s}`,{},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Qe(r))return{data:null,error:r};throw r}}from(s){var a=this;if(!G1(s))throw new Ko("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 $1({baseUrl:this.url,catalogName:s,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(y){if(l)throw y;return{data:null,error:y}}}}})}};const gf={"X-Client-Info":`storage-js/${Xy}`,"Content-Type":"application/json"};var Zy=class extends Error{constructor(s){super(s),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function Xt(s){return typeof s=="object"&&s!==null&&"__isStorageVectorsError"in s}var Nd=class extends Zy{constructor(s,a,r){super(s),this.name="StorageVectorsApiError",this.status=a,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},sS=class extends Zy{constructor(s,a){super(s),this.name="StorageVectorsUnknownError",this.originalError=a}};const yf=s=>s?(...a)=>s(...a):(...a)=>fetch(...a),nS=s=>{if(typeof s!="object"||s===null)return!1;const a=Object.getPrototypeOf(s);return(a===null||a===Object.prototype||Object.getPrototypeOf(a)===null)&&!(Symbol.toStringTag in s)&&!(Symbol.iterator in s)},$g=s=>s.msg||s.message||s.error_description||s.error||JSON.stringify(s),rS=async(s,a,r)=>{if(s&&typeof s=="object"&&"status"in s&&"ok"in s&&typeof s.status=="number"&&!r?.noResolveJson){const l=s.status||500,c=s;if(typeof c.json=="function")c.json().then(d=>{const h=d?.statusCode||d?.code||l+"";a(new Nd($g(d),l,h))}).catch(()=>{const d=l+"";a(new Nd(c.statusText||`HTTP ${l} error`,l,d))});else{const d=l+"";a(new Nd(c.statusText||`HTTP ${l} error`,l,d))}}else a(new sS($g(s),s))},iS=(s,a,r,l)=>{const c={method:s,headers:a?.headers||{}};return l?(nS(l)?(c.headers=ge({"Content-Type":"application/json"},a?.headers),c.body=JSON.stringify(l)):c.body=l,ge(ge({},c),r)):c};async function lS(s,a,r,l,c,d){return new Promise((h,m)=>{s(r,iS(a,l,c,d)).then(y=>{if(!y.ok)throw y;if(l?.noResolveJson)return y;const p=y.headers.get("content-type");return!p||!p.includes("application/json")?{}:y.json()}).then(y=>h(y)).catch(y=>rS(y,m,l))})}async function Qt(s,a,r,l,c){return lS(s,"POST",a,l,c,r)}var oS=class{constructor(s,a={},r){this.shouldThrowOnError=!1,this.url=s.replace(/\/$/,""),this.headers=ge(ge({},gf),a),this.fetch=yf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/CreateIndex`,s,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async getIndex(s,a){var r=this;try{return{data:await Qt(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:s,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(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/ListIndexes`,s,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async deleteIndex(s,a){var r=this;try{return{data:await Qt(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:s,indexName:a},{headers:r.headers})||{},error:null}}catch(l){if(r.shouldThrowOnError)throw l;if(Xt(l))return{data:null,error:l};throw l}}},cS=class{constructor(s,a={},r){this.shouldThrowOnError=!1,this.url=s.replace(/\/$/,""),this.headers=ge(ge({},gf),a),this.fetch=yf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(s){var a=this;try{if(s.vectors.length<1||s.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`,s,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async getVectors(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/GetVectors`,s,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async listVectors(s){var a=this;try{if(s.segmentCount!==void 0){if(s.segmentCount<1||s.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(s.segmentIndex!==void 0&&(s.segmentIndex<0||s.segmentIndex>=s.segmentCount))throw new Error(`segmentIndex must be between 0 and ${s.segmentCount-1}`)}return{data:await Qt(a.fetch,`${a.url}/ListVectors`,s,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async queryVectors(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/QueryVectors`,s,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async deleteVectors(s){var a=this;try{if(s.keys.length<1||s.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`,s,{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}},uS=class{constructor(s,a={},r){this.shouldThrowOnError=!1,this.url=s.replace(/\/$/,""),this.headers=ge(ge({},gf),a),this.fetch=yf(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/CreateVectorBucket`,{vectorBucketName:s},{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async getBucket(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/GetVectorBucket`,{vectorBucketName:s},{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async listBuckets(s={}){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/ListVectorBuckets`,s,{headers:a.headers}),error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}async deleteBucket(s){var a=this;try{return{data:await Qt(a.fetch,`${a.url}/DeleteVectorBucket`,{vectorBucketName:s},{headers:a.headers})||{},error:null}}catch(r){if(a.shouldThrowOnError)throw r;if(Xt(r))return{data:null,error:r};throw r}}},dS=class extends uS{constructor(s,a={}){super(s,a.headers||{},a.fetch)}from(s){return new fS(this.url,this.headers,s,this.fetch)}async createBucket(s){var a=()=>super.createBucket,r=this;return a().call(r,s)}async getBucket(s){var a=()=>super.getBucket,r=this;return a().call(r,s)}async listBuckets(s={}){var a=()=>super.listBuckets,r=this;return a().call(r,s)}async deleteBucket(s){var a=()=>super.deleteBucket,r=this;return a().call(r,s)}},fS=class extends oS{constructor(s,a,r,l){super(s,a,l),this.vectorBucketName=r}async createIndex(s){var a=()=>super.createIndex,r=this;return a().call(r,ge(ge({},s),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(s={}){var a=()=>super.listIndexes,r=this;return a().call(r,ge(ge({},s),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(s){var a=()=>super.getIndex,r=this;return a().call(r,r.vectorBucketName,s)}async deleteIndex(s){var a=()=>super.deleteIndex,r=this;return a().call(r,r.vectorBucketName,s)}index(s){return new hS(this.url,this.headers,this.vectorBucketName,s,this.fetch)}},hS=class extends cS{constructor(s,a,r,l,c){super(s,a,c),this.vectorBucketName=r,this.indexName=l}async putVectors(s){var a=()=>super.putVectors,r=this;return a().call(r,ge(ge({},s),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(s){var a=()=>super.getVectors,r=this;return a().call(r,ge(ge({},s),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(s={}){var a=()=>super.listVectors,r=this;return a().call(r,ge(ge({},s),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(s){var a=()=>super.queryVectors,r=this;return a().call(r,ge(ge({},s),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(s){var a=()=>super.deleteVectors,r=this;return a().call(r,ge(ge({},s),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},mS=class extends tS{constructor(s,a={},r,l){super(s,a,r,l)}from(s){return new eS(this.url,this.headers,s,this.fetch)}get vectors(){return new dS(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new aS(this.url+"/iceberg",this.headers,this.fetch)}};const Fy="2.90.1",Er=30*1e3,Zd=3,Ed=Zd*Er,pS="http://localhost:9999",gS="supabase.auth.token",yS={"X-Client-Info":`gotrue-js/${Fy}`},Fd="X-Supabase-Api-Version",Wy={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},vS=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,bS=600*1e3;class Xi extends Error{constructor(a,r,l){super(a),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=l}}function oe(s){return typeof s=="object"&&s!==null&&"__isAuthError"in s}class xS extends Xi{constructor(a,r,l){super(a,r,l),this.name="AuthApiError",this.status=r,this.code=l}}function wS(s){return oe(s)&&s.name==="AuthApiError"}class pn extends Xi{constructor(a,r){super(a),this.name="AuthUnknownError",this.originalError=r}}class ss extends Xi{constructor(a,r,l,c){super(a,l,c),this.name=r,this.status=l}}class Jt extends ss{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function _S(s){return oe(s)&&s.name==="AuthSessionMissingError"}class yr extends ss{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class No extends ss{constructor(a){super(a,"AuthInvalidCredentialsError",400,void 0)}}class Eo extends ss{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 SS(s){return oe(s)&&s.name==="AuthImplicitGrantRedirectError"}class Hg extends ss{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 jS extends ss{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 Wd extends ss{constructor(a,r){super(a,"AuthRetryableFetchError",r,void 0)}}function Td(s){return oe(s)&&s.name==="AuthRetryableFetchError"}class Vg extends ss{constructor(a,r,l){super(a,"AuthWeakPasswordError",r,"weak_password"),this.reasons=l}}class ef extends ss{constructor(a){super(a,"AuthInvalidJwtError",400,"invalid_jwt")}}const Ho="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Ig=`
35
+ \r=`.split(""),NS=(()=>{const s=new Array(128);for(let a=0;a<s.length;a+=1)s[a]=-1;for(let a=0;a<Ig.length;a+=1)s[Ig[a].charCodeAt(0)]=-2;for(let a=0;a<Ho.length;a+=1)s[Ho[a].charCodeAt(0)]=a;return s})();function Gg(s,a,r){if(s!==null)for(a.queue=a.queue<<8|s,a.queuedBits+=8;a.queuedBits>=6;){const l=a.queue>>a.queuedBits-6&63;r(Ho[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(Ho[l]),a.queuedBits-=6}}function ev(s,a,r){const l=NS[s];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(s)}"`)}}function Pg(s){const a=[],r=h=>{a.push(String.fromCodePoint(h))},l={utf8seq:0,codepoint:0},c={queue:0,queuedBits:0},d=h=>{AS(h,l,r)};for(let h=0;h<s.length;h+=1)ev(s.charCodeAt(h),c,d);return a.join("")}function ES(s,a){if(s<=127){a(s);return}else if(s<=2047){a(192|s>>6),a(128|s&63);return}else if(s<=65535){a(224|s>>12),a(128|s>>6&63),a(128|s&63);return}else if(s<=1114111){a(240|s>>18),a(128|s>>12&63),a(128|s>>6&63),a(128|s&63);return}throw new Error(`Unrecognized Unicode codepoint: ${s.toString(16)}`)}function TS(s,a){for(let r=0;r<s.length;r+=1){let l=s.charCodeAt(r);if(l>55295&&l<=56319){const c=(l-55296)*1024&65535;l=(s.charCodeAt(r+1)-56320&65535|c)+65536,r+=1}ES(l,a)}}function AS(s,a,r){if(a.utf8seq===0){if(s<=127){r(s);return}for(let l=1;l<6;l+=1)if((s>>7-l&1)===0){a.utf8seq=l;break}if(a.utf8seq===2)a.codepoint=s&31;else if(a.utf8seq===3)a.codepoint=s&15;else if(a.utf8seq===4)a.codepoint=s&7;else throw new Error("Invalid UTF-8 sequence");a.utf8seq-=1}else if(a.utf8seq>0){if(s<=127)throw new Error("Invalid UTF-8 sequence");a.codepoint=a.codepoint<<6|s&63,a.utf8seq-=1,a.utf8seq===0&&r(a.codepoint)}}function kr(s){const a=[],r={queue:0,queuedBits:0},l=c=>{a.push(c)};for(let c=0;c<s.length;c+=1)ev(s.charCodeAt(c),r,l);return new Uint8Array(a)}function CS(s){const a=[];return TS(s,r=>a.push(r)),new Uint8Array(a)}function gn(s){const a=[],r={queue:0,queuedBits:0},l=c=>{a.push(c)};return s.forEach(c=>Gg(c,r,l)),Gg(null,r,l),a.join("")}function kS(s){return Math.round(Date.now()/1e3)+s}function OS(){return Symbol("auth-callback")}const Tt=()=>typeof window<"u"&&typeof document<"u",dn={tested:!1,writable:!1},tv=()=>{if(!Tt())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(dn.tested)return dn.writable;const s=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(s,s),globalThis.localStorage.removeItem(s),dn.tested=!0,dn.writable=!0}catch{dn.tested=!0,dn.writable=!1}return dn.writable};function RS(s){const a={},r=new URL(s);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 av=s=>s?(...a)=>s(...a):(...a)=>fetch(...a),DS=s=>typeof s=="object"&&s!==null&&"status"in s&&"ok"in s&&"json"in s&&typeof s.json=="function",Tr=async(s,a,r)=>{await s.setItem(a,JSON.stringify(r))},fn=async(s,a)=>{const r=await s.getItem(a);if(!r)return null;try{return JSON.parse(r)}catch{return r}},Et=async(s,a)=>{await s.removeItem(a)};class Yo{constructor(){this.promise=new Yo.promiseConstructor((a,r)=>{this.resolve=a,this.reject=r})}}Yo.promiseConstructor=Promise;function Ad(s){const a=s.split(".");if(a.length!==3)throw new ef("Invalid JWT structure");for(let l=0;l<a.length;l++)if(!vS.test(a[l]))throw new ef("JWT not in base64url format");return{header:JSON.parse(Pg(a[0])),payload:JSON.parse(Pg(a[1])),signature:kr(a[2]),raw:{header:a[0],payload:a[1]}}}async function MS(s){return await new Promise(a=>{setTimeout(()=>a(null),s)})}function zS(s,a){return new Promise((l,c)=>{(async()=>{for(let d=0;d<1/0;d++)try{const h=await s(d);if(!a(d,null,h)){l(h);return}}catch(h){if(!a(d,h)){c(h);return}}})()})}function US(s){return("0"+s.toString(16)).substr(-2)}function LS(){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,US).join("")}async function BS(s){const r=new TextEncoder().encode(s),l=await crypto.subtle.digest("SHA-256",r),c=new Uint8Array(l);return Array.from(c).map(d=>String.fromCharCode(d)).join("")}async function qS(s){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."),s;const r=await BS(s);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function vr(s,a,r=!1){const l=LS();let c=l;r&&(c+="/PASSWORD_RECOVERY"),await Tr(s,`${a}-code-verifier`,c);const d=await qS(l);return[d,l===d?"plain":"s256"]}const $S=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function HS(s){const a=s.headers.get(Fd);if(!a||!a.match($S))return null;try{return new Date(`${a}T00:00:00.0Z`)}catch{return null}}function VS(s){if(!s)throw new Error("Missing exp claim");const a=Math.floor(Date.now()/1e3);if(s<=a)throw new Error("JWT has expired")}function IS(s){switch(s){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 GS=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function br(s){if(!GS.test(s))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Cd(){const s={};return new Proxy(s,{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 PS(s,a){return new Proxy(s,{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 Kg(s){return JSON.parse(JSON.stringify(s))}const hn=s=>s.msg||s.message||s.error_description||s.error||JSON.stringify(s),KS=[502,503,504];async function Yg(s){var a;if(!DS(s))throw new Wd(hn(s),0);if(KS.includes(s.status))throw new Wd(hn(s),s.status);let r;try{r=await s.json()}catch(d){throw new pn(hn(d),d)}let l;const c=HS(s);if(c&&c.getTime()>=Wy["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 Vg(hn(r),s.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 Vg(hn(r),s.status,r.weak_password.reasons);throw new xS(hn(r),s.status||500,l)}const YS=(s,a,r,l)=>{const c={method:s,headers:a?.headers||{}};return s==="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 pe(s,a,r,l){var c;const d=Object.assign({},l?.headers);d[Fd]||(d[Fd]=Wy["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():"",y=await JS(s,a,r+m,{headers:d,noResolveJson:l?.noResolveJson},{},l?.body);return l?.xform?l?.xform(y):{data:Object.assign({},y),error:null}}async function JS(s,a,r,l,c,d){const h=YS(a,l,c,d);let m;try{m=await s(r,Object.assign({},h))}catch(y){throw console.error(y),new Wd(hn(y),0)}if(m.ok||await Yg(m),l?.noResolveJson)return m;try{return await m.json()}catch(y){await Yg(y)}}function fa(s){var a;let r=null;ZS(s)&&(r=Object.assign({},s),s.expires_at||(r.expires_at=kS(s.expires_in)));const l=(a=s.user)!==null&&a!==void 0?a:s;return{data:{session:r,user:l},error:null}}function Jg(s){const a=fa(s);return!a.error&&s.weak_password&&typeof s.weak_password=="object"&&Array.isArray(s.weak_password.reasons)&&s.weak_password.reasons.length&&s.weak_password.message&&typeof s.weak_password.message=="string"&&s.weak_password.reasons.reduce((r,l)=>r&&typeof l=="string",!0)&&(a.data.weak_password=s.weak_password),a}function Us(s){var a;return{data:{user:(a=s.user)!==null&&a!==void 0?a:s},error:null}}function XS(s){return{data:s,error:null}}function QS(s){const{action_link:a,email_otp:r,hashed_token:l,redirect_to:c,verification_type:d}=s,h=Br(s,["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},y=Object.assign({},h);return{data:{properties:m,user:y},error:null}}function Xg(s){return s}function ZS(s){return s.access_token&&s.refresh_token&&s.expires_in}const kd=["global","local","others"];class FS{constructor({url:a="",headers:r={},fetch:l}){this.url=a,this.headers=r,this.fetch=av(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=kd[0]){if(kd.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${kd.join(", ")}`);try{return await pe(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 pe(this.fetch,"POST",`${this.url}/invite`,{body:{email:a,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:Us})}catch(l){if(oe(l))return{data:{user:null},error:l};throw l}}async generateLink(a){try{const{options:r}=a,l=Br(a,["options"]),c=Object.assign(Object.assign({},l),r);return"newEmail"in l&&(c.new_email=l?.newEmail,delete c.newEmail),await pe(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:c,headers:this.headers,xform:QS,redirectTo:r?.redirectTo})}catch(r){if(oe(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(a){try{return await pe(this.fetch,"POST",`${this.url}/admin/users`,{body:a,headers:this.headers,xform:Us})}catch(r){if(oe(r))return{data:{user:null},error:r};throw r}}async listUsers(a){var r,l,c,d,h,m,y;try{const p={nextPage:null,lastPage:0,total:0},g=await pe(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:Xg});if(g.error)throw g.error;const w=await g.json(),_=(h=g.headers.get("x-total-count"))!==null&&h!==void 0?h:0,S=(y=(m=g.headers.get("link"))===null||m===void 0?void 0:m.split(","))!==null&&y!==void 0?y:[];return S.length>0&&(S.forEach(E=>{const j=parseInt(E.split(";")[0].split("=")[1].substring(0,1)),R=JSON.parse(E.split(";")[1].split("=")[1]);p[`${R}Page`]=j}),p.total=parseInt(_)),{data:Object.assign(Object.assign({},w),p),error:null}}catch(p){if(oe(p))return{data:{users:[]},error:p};throw p}}async getUserById(a){br(a);try{return await pe(this.fetch,"GET",`${this.url}/admin/users/${a}`,{headers:this.headers,xform:Us})}catch(r){if(oe(r))return{data:{user:null},error:r};throw r}}async updateUserById(a,r){br(a);try{return await pe(this.fetch,"PUT",`${this.url}/admin/users/${a}`,{body:r,headers:this.headers,xform:Us})}catch(l){if(oe(l))return{data:{user:null},error:l};throw l}}async deleteUser(a,r=!1){br(a);try{return await pe(this.fetch,"DELETE",`${this.url}/admin/users/${a}`,{headers:this.headers,body:{should_soft_delete:r},xform:Us})}catch(l){if(oe(l))return{data:{user:null},error:l};throw l}}async _listFactors(a){br(a.userId);try{const{data:r,error:l}=await pe(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){br(a.userId),br(a.id);try{return{data:await pe(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,y;try{const p={nextPage:null,lastPage:0,total:0},g=await pe(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:Xg});if(g.error)throw g.error;const w=await g.json(),_=(h=g.headers.get("x-total-count"))!==null&&h!==void 0?h:0,S=(y=(m=g.headers.get("link"))===null||m===void 0?void 0:m.split(","))!==null&&y!==void 0?y:[];return S.length>0&&(S.forEach(E=>{const j=parseInt(E.split(";")[0].split("=")[1].substring(0,1)),R=JSON.parse(E.split(";")[1].split("=")[1]);p[`${R}Page`]=j}),p.total=parseInt(_)),{data:Object.assign(Object.assign({},w),p),error:null}}catch(p){if(oe(p))return{data:{clients:[]},error:p};throw p}}async _createOAuthClient(a){try{return await pe(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 pe(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 pe(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 pe(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 pe(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 Qg(s={}){return{getItem:a=>s[a]||null,setItem:(a,r)=>{s[a]=r},removeItem:a=>{delete s[a]}}}const xr={debug:!!(globalThis&&tv()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class sv extends Error{constructor(a){super(a),this.isAcquireTimeout=!0}}class WS extends sv{}async function ej(s,a,r){xr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",s,a);const l=new globalThis.AbortController;return a>0&&setTimeout(()=>{l.abort(),xr.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",s)},a),await Promise.resolve().then(()=>globalThis.navigator.locks.request(s,a===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:l.signal},async c=>{if(c){xr.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",s,c.name);try{return await r()}finally{xr.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",s,c.name)}}else{if(a===0)throw xr.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",s),new WS(`Acquiring an exclusive Navigator LockManager lock "${s}" immediately failed`);if(xr.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 tj(){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 nv(s){if(!/^0x[a-fA-F0-9]{40}$/.test(s))throw new Error(`@supabase/auth-js: Address "${s}" is invalid.`);return s.toLowerCase()}function aj(s){return parseInt(s,16)}function sj(s){const a=new TextEncoder().encode(s);return"0x"+Array.from(a,l=>l.toString(16).padStart(2,"0")).join("")}function nj(s){var a;const{chainId:r,domain:l,expirationTime:c,issuedAt:d=new Date,nonce:h,notBefore:m,requestId:y,resources:p,scheme:g,uri:w,version:_}=s;{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(!w)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(_!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${_}`);if(!((a=s.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: ${s.statement}`)}const S=nv(s.address),E=g?`${g}://${l}`:l,j=s.statement?`${s.statement}
37
37
  `:"",R=`${E} wants you to sign in with your Ethereum account:
38
38
  ${S}
39
39
 
@@ -47,13 +47,13 @@ Not Before: ${m.toISOString()}`),y&&(D+=`
47
47
  Request ID: ${y}`),p){let B=`
48
48
  Resources:`;for(const q of p){if(!q||typeof q!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${q}`);B+=`
49
49
  - ${q}`}D+=B}return`${R}
50
- ${D}`}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 Ho extends ot{constructor(a,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:a}),this.name="WebAuthnUnknownError",this.originalError=r}}function sj({error:s,options:a}){var r,l,c;const{publicKey:d}=a;if(!d)throw Error("options was missing required publicKey property");if(s.name==="AbortError"){if(a.signal instanceof AbortSignal)return new ot({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:s})}else if(s.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:s});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:s});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:s})}else{if(s.name==="InvalidStateError")return new ot({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:s});if(s.name==="NotAllowedError")return new ot({message:s.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s});if(s.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:s}):new ot({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:s});if(s.name==="SecurityError"){const h=window.location.hostname;if(av(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:s})}else return new ot({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:s})}else if(s.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:s})}else if(s.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:s})}return new ot({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s})}function nj({error:s,options:a}){const{publicKey:r}=a;if(!r)throw Error("options was missing required publicKey property");if(s.name==="AbortError"){if(a.signal instanceof AbortSignal)return new ot({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:s})}else{if(s.name==="NotAllowedError")return new ot({message:s.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s});if(s.name==="SecurityError"){const l=window.location.hostname;if(av(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:s})}else return new ot({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:s})}else if(s.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:s})}return new ot({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s})}class rj{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 ij=new rj;function lj(s){if(!s)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(s);const{challenge:a,user:r,excludeCredentials:l}=s,c=Lr(s,["challenge","user","excludeCredentials"]),d=Cr(a).buffer,h=Object.assign(Object.assign({},r),{id:Cr(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 y=0;y<l.length;y++){const p=l[y];m.excludeCredentials[y]=Object.assign(Object.assign({},p),{id:Cr(p.id).buffer,type:p.type||"public-key",transports:p.transports})}}return m}function oj(s){if(!s)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(s);const{challenge:a,allowCredentials:r}=s,l=Lr(s,["challenge","allowCredentials"]),c=Cr(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:Cr(m.id).buffer,type:m.type||"public-key",transports:m.transports})}}return d}function cj(s){var a;if("toJSON"in s&&typeof s.toJSON=="function")return s.toJSON();const r=s;return{id:s.id,rawId:s.id,response:{attestationObject:gn(new Uint8Array(s.response.attestationObject)),clientDataJSON:gn(new Uint8Array(s.response.clientDataJSON))},type:"public-key",clientExtensionResults:s.getClientExtensionResults(),authenticatorAttachment:(a=r.authenticatorAttachment)!==null&&a!==void 0?a:void 0}}function uj(s){var a;if("toJSON"in s&&typeof s.toJSON=="function")return s.toJSON();const r=s,l=s.getClientExtensionResults(),c=s.response;return{id:s.id,rawId:s.id,response:{authenticatorData:gn(new Uint8Array(c.authenticatorData)),clientDataJSON:gn(new Uint8Array(c.clientDataJSON)),signature:gn(new Uint8Array(c.signature)),userHandle:c.userHandle?gn(new Uint8Array(c.userHandle)):void 0},type:"public-key",clientExtensionResults:l,authenticatorAttachment:(a=r.authenticatorAttachment)!==null&&a!==void 0?a:void 0}}function av(s){return s==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(s)}function Qg(){var s,a;return!!(Tt()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((s=navigator?.credentials)===null||s===void 0?void 0:s.create)=="function"&&typeof((a=navigator?.credentials)===null||a===void 0?void 0:a.get)=="function")}async function dj(s){try{const a=await navigator.credentials.create(s);return a?a instanceof PublicKeyCredential?{data:a,error:null}:{data:null,error:new Ho("Browser returned unexpected credential type",a)}:{data:null,error:new Ho("Empty credential response",a)}}catch(a){return{data:null,error:sj({error:a,options:s})}}}async function fj(s){try{const a=await navigator.credentials.get(s);return a?a instanceof PublicKeyCredential?{data:a,error:null}:{data:null,error:new Ho("Browser returned unexpected credential type",a)}:{data:null,error:new Ho("Empty credential response",a)}}catch(a){return{data:null,error:nj({error:a,options:s})}}}const hj={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},mj={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Vo(...s){const a=c=>c!==null&&typeof c=="object"&&!Array.isArray(c),r=c=>c instanceof ArrayBuffer||ArrayBuffer.isView(c),l={};for(const c of s)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]=Vo(m,h):l[d]=Vo(h)}else l[d]=h}return l}function pj(s,a){return Vo(hj,s,a||{})}function gj(s,a){return Vo(mj,s,a||{})}class yj{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 y=c??ij.createNewAbortSignal();if(h.webauthn.type==="create"){const{user:p}=h.webauthn.credential_options.publicKey;p.name||(p.name=`${p.id}:${l}`),p.displayName||(p.displayName=p.name)}switch(h.webauthn.type){case"create":{const p=pj(h.webauthn.credential_options.publicKey,d?.create),{data:g,error:w}=await dj({publicKey:p,signal:y});return g?{data:{factorId:a,challengeId:h.id,webauthn:{type:h.webauthn.type,credential_response:g}},error:null}:{data:null,error:w}}case"request":{const p=gj(h.webauthn.credential_options.publicKey,d?.request),{data:g,error:w}=await fj(Object.assign(Object.assign({},h.webauthn.credential_options),{publicKey:p,signal:y}));return g?{data:{factorId:a,challengeId:h.id,webauthn:{type:h.webauthn.type,credential_response:g}},error:null}:{data:null,error:w}}}}catch(h){return le(h)?{data:null,error:h}:{data:null,error:new pn("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 Ji("rpId is required for WebAuthn authentication")};try{if(!Qg())return{data:null,error:new pn("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:y}=h;return this._verify({factorId:a,challengeId:h.challengeId,webauthn:{type:y.type,rpId:r,rpOrigins:l,credential_response:y.credential_response}})}catch(h){return le(h)?{data:null,error:h}:{data:null,error:new pn("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 Ji("rpId is required for WebAuthn registration")};try{if(!Qg())return{data:null,error:new pn("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(g=>{var w;return(w=g.data)===null||w===void 0?void 0:w.all.find(_=>_.factor_type==="webauthn"&&_.friendly_name===a&&_.status!=="unverified")}).then(g=>g?this.client.mfa.unenroll({factorId:g?.id}):void 0),{data:null,error:m};const{data:y,error:p}=await this._challenge({factorId:h.id,friendlyName:h.friendly_name,webauthn:{rpId:r,rpOrigins:l},signal:c},{create:d});return y?this._verify({factorId:h.id,challengeId:y.challengeId,webauthn:{rpId:r,rpOrigins:l,type:y.webauthn.type,credential_response:y.webauthn.credential_response}}):{data:null,error:p}}catch(h){return le(h)?{data:null,error:h}:{data:null,error:new pn("Unexpected error in register",h)}}}}WS();const vj={url:hS,storageKey:mS,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:pS,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4};async function Zg(s,a,r){return await r()}const xr={};class Xi{get jwks(){var a,r;return(r=(a=xr[this.storageKey])===null||a===void 0?void 0:a.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(a){xr[this.storageKey]=Object.assign(Object.assign({},xr[this.storageKey]),{jwks:a})}get jwks_cached_at(){var a,r;return(r=(a=xr[this.storageKey])===null||a===void 0?void 0:a.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(a){xr[this.storageKey]=Object.assign(Object.assign({},xr[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({},vj),a);if(this.storageKey=d.storageKey,this.instanceID=(r=Xi.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Xi.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!d.debug,typeof d.debug=="function"&&(this.logger=d.debug),this.instanceID>0&&Tt()){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 QS({url:d.url,headers:d.headers,fetch:d.fetch}),this.url=d.url,this.headers=d.headers,this.fetch=Wy(d.fetch),this.lock=d.lock||Zg,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&&Tt()&&(!((l=globalThis?.navigator)===null||l===void 0)&&l.locks)?this.lock=FS:this.lock=Zg,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 yj(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:Fy()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Xg(this.memoryStorage)),d.userStorage&&(this.userStorage=d.userStorage)):(this.memoryStorage={},this.storage=Xg(this.memoryStorage)),Tt()&&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} (${Xy}) ${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(Tt()&&(r=kS(window.location.href),this._isImplicitGrantCallback(r)?l="implicit":await this._isPKCECallback(r)&&(l="pkce")),Tt()&&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),wS(d)){const y=(a=d.details)===null||a===void 0?void 0:a.code;if(y==="identity_already_exists"||y==="identity_not_found"||y==="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 le(r)?this._returnResult({error:r}):this._returnResult({error:new pn("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(a){var r,l,c;try{const d=await he(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:fa}),{data:h,error:m}=d;if(m||!h)return this._returnResult({data:{user:null,session:null},error:m});const y=h.session,p=h.user;return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",y)),this._returnResult({data:{user:p,session:y},error:null})}catch(d){if(le(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:g,password:w,options:_}=a;let S=null,E=null;this.flowType==="pkce"&&([S,E]=await yr(this.storage,this.storageKey)),d=await he(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:_?.emailRedirectTo,body:{email:g,password:w,data:(r=_?.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:_?.captchaToken},code_challenge:S,code_challenge_method:E},xform:fa})}else if("phone"in a){const{phone:g,password:w,options:_}=a;d=await he(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:g,password:w,data:(l=_?.data)!==null&&l!==void 0?l:{},channel:(c=_?.channel)!==null&&c!==void 0?c:"sms",gotrue_meta_security:{captcha_token:_?.captchaToken}},xform:fa})}else throw new jo("You must provide either an email or phone number and a password");const{data:h,error:m}=d;if(m||!h)return await Et(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:m});const y=h.session,p=h.user;return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",y)),this._returnResult({data:{user:p,session:y},error:null})}catch(d){if(await Et(this.storage,`${this.storageKey}-code-verifier`),le(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 he(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:Yg})}else if("phone"in a){const{phone:d,password:h,options:m}=a;r=await he(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:Yg})}else throw new jo("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 gr;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(le(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,y,p,g,w,_;let S,E;if("message"in a)S=a.message,E=a.signature;else{const{chain:j,wallet:R,statement:D,options:B}=a;let q;if(Tt())if(typeof R=="object")q=R;else{const oe=window;if("ethereum"in oe&&typeof oe.ethereum=="object"&&"request"in oe.ethereum&&typeof oe.ethereum.request=="function")q=oe.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 R!="object"||!B?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");q=R}const P=new URL((r=B?.url)!==null&&r!==void 0?r:window.location.href),W=await q.request({method:"eth_requestAccounts"}).then(oe=>oe).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!W||W.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const Y=tv(W[0]);let I=(l=B?.signInWithEthereum)===null||l===void 0?void 0:l.chainId;if(!I){const oe=await q.request({method:"eth_chainId"});I=ej(oe)}const X={domain:P.host,address:Y,statement:D,uri:P.href,version:"1",chainId:I,nonce:(c=B?.signInWithEthereum)===null||c===void 0?void 0:c.nonce,issuedAt:(h=(d=B?.signInWithEthereum)===null||d===void 0?void 0:d.issuedAt)!==null&&h!==void 0?h:new Date,expirationTime:(m=B?.signInWithEthereum)===null||m===void 0?void 0:m.expirationTime,notBefore:(y=B?.signInWithEthereum)===null||y===void 0?void 0:y.notBefore,requestId:(p=B?.signInWithEthereum)===null||p===void 0?void 0:p.requestId,resources:(g=B?.signInWithEthereum)===null||g===void 0?void 0:g.resources};S=aj(X),E=await q.request({method:"personal_sign",params:[tj(S),Y]})}try{const{data:j,error:R}=await he(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:S,signature:E},!((w=a.options)===null||w===void 0)&&w.captchaToken?{gotrue_meta_security:{captcha_token:(_=a.options)===null||_===void 0?void 0:_.captchaToken}}:null),xform:fa});if(R)throw R;if(!j||!j.session||!j.user){const D=new gr;return this._returnResult({data:{user:null,session:null},error:D})}return j.session&&(await this._saveSession(j.session),await this._notifyAllSubscribers("SIGNED_IN",j.session)),this._returnResult({data:Object.assign({},j),error:R})}catch(j){if(le(j))return this._returnResult({data:{user:null,session:null},error:j});throw j}}async signInWithSolana(a){var r,l,c,d,h,m,y,p,g,w,_,S;let E,j;if("message"in a)E=a.message,j=a.signature;else{const{chain:R,wallet:D,statement:B,options:q}=a;let P;if(Tt())if(typeof D=="object")P=D;else{const Y=window;if("solana"in Y&&typeof Y.solana=="object"&&("signIn"in Y.solana&&typeof Y.solana.signIn=="function"||"signMessage"in Y.solana&&typeof Y.solana.signMessage=="function"))P=Y.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 D!="object"||!q?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");P=D}const W=new URL((r=q?.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in P&&P.signIn){const Y=await P.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},q?.signInWithSolana),{version:"1",domain:W.host,uri:W.href}),B?{statement:B}:null));let I;if(Array.isArray(Y)&&Y[0]&&typeof Y[0]=="object")I=Y[0];else if(Y&&typeof Y=="object"&&"signedMessage"in Y&&"signature"in Y)I=Y;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in I&&"signature"in I&&(typeof I.signedMessage=="string"||I.signedMessage instanceof Uint8Array)&&I.signature instanceof Uint8Array)E=typeof I.signedMessage=="string"?I.signedMessage:new TextDecoder().decode(I.signedMessage),j=I.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in P)||typeof P.signMessage!="function"||!("publicKey"in P)||typeof P!="object"||!P.publicKey||!("toBase58"in P.publicKey)||typeof P.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");E=[`${W.host} wants you to sign in with your Solana account:`,P.publicKey.toBase58(),...B?["",B,""]:[""],"Version: 1",`URI: ${W.href}`,`Issued At: ${(c=(l=q?.signInWithSolana)===null||l===void 0?void 0:l.issuedAt)!==null&&c!==void 0?c:new Date().toISOString()}`,...!((d=q?.signInWithSolana)===null||d===void 0)&&d.notBefore?[`Not Before: ${q.signInWithSolana.notBefore}`]:[],...!((h=q?.signInWithSolana)===null||h===void 0)&&h.expirationTime?[`Expiration Time: ${q.signInWithSolana.expirationTime}`]:[],...!((m=q?.signInWithSolana)===null||m===void 0)&&m.chainId?[`Chain ID: ${q.signInWithSolana.chainId}`]:[],...!((y=q?.signInWithSolana)===null||y===void 0)&&y.nonce?[`Nonce: ${q.signInWithSolana.nonce}`]:[],...!((p=q?.signInWithSolana)===null||p===void 0)&&p.requestId?[`Request ID: ${q.signInWithSolana.requestId}`]:[],...!((w=(g=q?.signInWithSolana)===null||g===void 0?void 0:g.resources)===null||w===void 0)&&w.length?["Resources",...q.signInWithSolana.resources.map(I=>`- ${I}`)]:[]].join(`
51
- `);const Y=await P.signMessage(new TextEncoder().encode(E),"utf8");if(!Y||!(Y instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");j=Y}}try{const{data:R,error:D}=await he(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:E,signature:gn(j)},!((_=a.options)===null||_===void 0)&&_.captchaToken?{gotrue_meta_security:{captcha_token:(S=a.options)===null||S===void 0?void 0:S.captchaToken}}:null),xform:fa});if(D)throw D;if(!R||!R.session||!R.user){const B=new gr;return this._returnResult({data:{user:null,session:null},error:B})}return R.session&&(await this._saveSession(R.session),await this._notifyAllSubscribers("SIGNED_IN",R.session)),this._returnResult({data:Object.assign({},R),error:D})}catch(R){if(le(R))return this._returnResult({data:{user:null,session:null},error:R});throw R}}async _exchangeCodeForSession(a){const r=await fn(this.storage,`${this.storageKey}-code-verifier`),[l,c]=(r??"").split("/");try{if(!l&&this.flowType==="pkce")throw new _S;const{data:d,error:h}=await he(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:a,code_verifier:l},xform:fa});if(await Et(this.storage,`${this.storageKey}-code-verifier`),h)throw h;if(!d||!d.session||!d.user){const m=new gr;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 Et(this.storage,`${this.storageKey}-code-verifier`),le(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 he(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:fa}),{data:y,error:p}=m;if(p)return this._returnResult({data:{user:null,session:null},error:p});if(!y||!y.session||!y.user){const g=new gr;return this._returnResult({data:{user:null,session:null},error:g})}return y.session&&(await this._saveSession(y.session),await this._notifyAllSubscribers("SIGNED_IN",y.session)),this._returnResult({data:y,error:p})}catch(r){if(le(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:y}=a;let p=null,g=null;this.flowType==="pkce"&&([p,g]=await yr(this.storage,this.storageKey));const{error:w}=await he(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:m,data:(r=y?.data)!==null&&r!==void 0?r:{},create_user:(l=y?.shouldCreateUser)!==null&&l!==void 0?l:!0,gotrue_meta_security:{captcha_token:y?.captchaToken},code_challenge:p,code_challenge_method:g},redirectTo:y?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:w})}if("phone"in a){const{phone:m,options:y}=a,{data:p,error:g}=await he(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:m,data:(c=y?.data)!==null&&c!==void 0?c:{},create_user:(d=y?.shouldCreateUser)!==null&&d!==void 0?d:!0,gotrue_meta_security:{captcha_token:y?.captchaToken},channel:(h=y?.channel)!==null&&h!==void 0?h:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:p?.message_id},error:g})}throw new jo("You must provide either an email or phone number.")}catch(m){if(await Et(this.storage,`${this.storageKey}-code-verifier`),le(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 he(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},a),{gotrue_meta_security:{captcha_token:d}}),redirectTo:c,xform:fa});if(m)throw m;if(!h)throw new Error("An error occurred on token verification.");const y=h.session,p=h.user;return y?.access_token&&(await this._saveSession(y),await this._notifyAllSubscribers(a.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",y)),this._returnResult({data:{user:p,session:y},error:null})}catch(c){if(le(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,y=null;this.flowType==="pkce"&&([m,y]=await yr(this.storage,this.storageKey));const p=await he(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:y}),headers:this.headers,xform:YS});return!((d=p.data)===null||d===void 0)&&d.url&&Tt()&&!(!((h=a.options)===null||h===void 0)&&h.skipBrowserRedirect)&&window.location.assign(p.data.url),this._returnResult(p)}catch(m){if(await Et(this.storage,`${this.storageKey}-code-verifier`),le(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 he(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(le(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 he(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 he(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 jo("You must provide either an email or phone number and a type")}catch(r){if(le(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 fn(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()<Nd:!1;if(this._debug("#__loadSession()",`session has${l?"":" not"} expired`,"expires_at",a.expires_at),!l){if(this.userStorage){const h=await fn(this.userStorage,this.storageKey+"-user");h?.user?a.user=h.user:a.user=Ad()}if(this.storage.isServer&&a.user&&!a.user.__isUserNotAvailableProxy){const h={value:this.suppressGetSessionWarning};a.user=IS(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 he(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:a,xform:Us}):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 he(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:Us})})}catch(r){if(le(r))return xS(r)&&(await this._removeSession(),await Et(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,y=null;this.flowType==="pkce"&&a.email!=null&&([m,y]=await yr(this.storage,this.storageKey));const{data:p,error:g}=await he(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r?.emailRedirectTo,body:Object.assign(Object.assign({},a),{code_challenge:m,code_challenge_method:y}),jwt:h.access_token,xform:Us});if(g)throw g;return h.user=p.user,await this._saveSession(h),await this._notifyAllSubscribers("USER_UPDATED",h),this._returnResult({data:{user:h.user},error:null})})}catch(l){if(await Et(this.storage,`${this.storageKey}-code-verifier`),le(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}=Td(a.access_token);if(h.exp&&(l=h.exp,c=l<=r),c){const{data:m,error:y}=await this._callRefreshToken(a.refresh_token);if(y)return this._returnResult({data:{user:null,session:null},error:y});if(!m)return{data:{user:null,session:null},error:null};d=m}else{const{data:m,error:y}=await this._getUser(a.access_token);if(y)throw y;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(le(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(le(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(a,r){try{if(!Tt())throw new No("No browser detected.");if(a.error||a.error_description||a.error_code)throw new No(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 $g("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new No("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 $g("No code detected.");const{data:B,error:q}=await this._exchangeCodeForSession(a.code);if(q)throw q;const P=new URL(window.location.href);return P.searchParams.delete("code"),window.history.replaceState(window.history.state,"",P.toString()),{data:{session:B.session,redirectType:null},error:null}}const{provider_token:l,provider_refresh_token:c,access_token:d,refresh_token:h,expires_in:m,expires_at:y,token_type:p}=a;if(!d||!m||!h||!p)throw new No("No session defined in URL");const g=Math.round(Date.now()/1e3),w=parseInt(m);let _=g+w;y&&(_=parseInt(y));const S=_-g;S*1e3<=Nr&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${S}s, should have been closer to ${w}s`);const E=_-w;g-E>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",E,_,g):g-E<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",E,_,g);const{data:j,error:R}=await this._getUser(d);if(R)throw R;const D={provider_token:l,provider_refresh_token:c,access_token:d,expires_in:w,expires_at:_,refresh_token:h,token_type:p,user:j.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:D,redirectType:a.type},error:null})}catch(l){if(le(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 fn(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&&!(bS(m)&&(m.status===404||m.status===401||m.status===403)))return this._returnResult({error:m})}return a!=="others"&&(await this._removeSession(),await Et(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(a){const r=CS(),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 yr(this.storage,this.storageKey,!0));try{return await he(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 Et(this.storage,`${this.storageKey}-code-verifier`),le(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(le(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,y,p,g;const{data:w,error:_}=d;if(_)throw _;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:(y=a.options)===null||y===void 0?void 0:y.queryParams,skipBrowserRedirect:!0});return await he(this.fetch,"GET",S,{headers:this.headers,jwt:(g=(p=w.session)===null||p===void 0?void 0:p.access_token)!==null&&g!==void 0?g:void 0})});if(c)throw c;return Tt()&&!(!((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(le(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:y,access_token:p,nonce:g}=a,w=await he(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:y,access_token:p,nonce:g,link_identity:!0,gotrue_meta_security:{captcha_token:h?.captchaToken}},xform:fa}),{data:_,error:S}=w;return S?this._returnResult({data:{user:null,session:null},error:S}):!_||!_.session||!_.user?this._returnResult({data:{user:null,session:null},error:new gr}):(_.session&&(await this._saveSession(_.session),await this._notifyAllSubscribers("USER_UPDATED",_.session)),this._returnResult({data:_,error:S}))}catch(c){if(await Et(this.storage,`${this.storageKey}-code-verifier`),le(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 he(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(le(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 DS(async c=>(c>0&&await RS(200*Math.pow(2,c-1)),this._debug(r,"refreshing attempt",c),await he(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:a},headers:this.headers,xform:fa})),(c,d)=>{const h=200*Math.pow(2,c);return d&&Ed(d)&&Date.now()+h-l<Nr})}catch(l){if(this._debug(r,"error",l),le(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),Tt()&&!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 fn(this.storage,this.storageKey);if(c&&this.userStorage){let h=await fn(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!h&&(h={user:c.user},await Er(this.userStorage,this.storageKey+"-user",h)),c.user=(a=h?.user)!==null&&a!==void 0?a:Ad()}else if(c&&!c.user&&!c.user){const h=await fn(this.storage,this.storageKey+"-user");h&&h?.user?(c.user=h.user,await Et(this.storage,this.storageKey+"-user"),await Er(this.storage,this.storageKey,c)):c.user=Ad()}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()<Nd;if(this._debug(l,`session has${d?"":" not"} expired with margin of ${Nd}s`),d){if(this.autoRefreshToken&&c.refresh_token){const{error:h}=await this._callRefreshToken(c.refresh_token);h&&(console.error(h),Ed(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 Ko;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),le(d)){const h={data:null,error:d};return Ed(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(y){d.push(y)}});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 Et(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 Er(this.userStorage,this.storageKey+"-user",{user:r.user});const c=Object.assign({},r);delete c.user;const d=Pg(c);await Er(this.storage,this.storageKey,d)}else{const c=Pg(r);await Er(this.storage,this.storageKey,c)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Et(this.storage,this.storageKey),await Et(this.storage,this.storageKey+"-code-verifier"),await Et(this.storage,this.storageKey+"-user"),this.userStorage&&await Et(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const a=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{a&&Tt()&&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(),Nr);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)/Nr);this._debug("#_autoRefreshTokenTick()",`access token expires in ${c} ticks, a tick lasts ${Nr}ms, refresh threshold is ${Qd} ticks`),c<=Qd&&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 ev)this._debug("auto refresh token tick lock not available");else throw a}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Tt()||!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 yr(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 he(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(le(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:y,error:p}=await he(this.fetch,"POST",`${this.url}/factors`,{body:m,headers:this.headers,jwt:(l=d?.session)===null||l===void 0?void 0:l.access_token});return p?this._returnResult({data:null,error:p}):(a.factorType==="totp"&&y.type==="totp"&&(!((c=y?.totp)===null||c===void 0)&&c.qr_code)&&(y.totp.qr_code=`data:image/svg+xml;utf-8,${y.totp.qr_code}`),this._returnResult({data:y,error:null}))})}catch(r){if(le(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"?cj(a.webauthn.credential_response):uj(a.webauthn.credential_response)})}:{code:a.code}),{data:m,error:y}=await he(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 y?this._returnResult({data:null,error:y}):(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:y}))})}catch(r){if(le(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 he(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:lj(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:oj(m.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if(le(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}=Td(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(g=>g.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(m="aal2");const p=d.amr||[];return{data:{currentLevel:h,nextLevel:m,currentAuthenticationMethods:p},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 he(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(le(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 he(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&&Tt()&&!r?.skipBrowserRedirect&&window.location.assign(h.data.redirect_url),h})}catch(l){if(le(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 he(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&&Tt()&&!r?.skipBrowserRedirect&&window.location.assign(h.data.redirect_url),h})}catch(l){if(le(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 he(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(le(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 he(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(le(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+yS>c)return l;const{data:d,error:h}=await he(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:E}=await this.getSession();if(E||!S.session)return this._returnResult({data:null,error:E});l=S.session.access_token}const{header:c,payload:d,signature:h,raw:{header:m,payload:y}}=Td(l);r?.allowExpired||$S(d.exp);const p=!c.alg||c.alg.startsWith("HS")||!c.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(c.kid,r?.keys?{keys:r.keys}:r?.jwks);if(!p){const{error:S}=await this.getUser(l);if(S)throw S;return{data:{claims:d,header:c,signature:h},error:null}}const g=HS(c.alg),w=await crypto.subtle.importKey("jwk",p,g,!0,["verify"]);if(!await crypto.subtle.verify(g,w,h,TS(`${m}.${y}`)))throw new Wd("Invalid JWT signature");return{data:{claims:d,header:c,signature:h},error:null}}catch(l){if(le(l))return this._returnResult({data:null,error:l});throw l}}}Xi.nextInstanceID={};const bj=Xi,xj="2.90.1";let Li="";typeof Deno<"u"?Li="deno":typeof document<"u"?Li="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Li="react-native":Li="node";const wj={"X-Client-Info":`supabase-js-${Li}/${xj}`},_j={headers:wj},Sj={schema:"public"},jj={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Nj={};function Qi(s){"@babel/helpers - typeof";return Qi=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},Qi(s)}function Ej(s,a){if(Qi(s)!="object"||!s)return s;var r=s[Symbol.toPrimitive];if(r!==void 0){var l=r.call(s,a);if(Qi(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(s)}function Tj(s){var a=Ej(s,"string");return Qi(a)=="symbol"?a:a+""}function Aj(s,a,r){return(a=Tj(a))in s?Object.defineProperty(s,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):s[a]=r,s}function Fg(s,a){var r=Object.keys(s);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(s);a&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(s,c).enumerable})),r.push.apply(r,l)}return r}function tt(s){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?Fg(Object(r),!0).forEach(function(l){Aj(s,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(r)):Fg(Object(r)).forEach(function(l){Object.defineProperty(s,l,Object.getOwnPropertyDescriptor(r,l))})}return s}const Cj=s=>s?(...a)=>s(...a):(...a)=>fetch(...a),kj=()=>Headers,Oj=(s,a,r)=>{const l=Cj(r),c=kj();return async(d,h)=>{var m;const y=(m=await a())!==null&&m!==void 0?m:s;let p=new c(h?.headers);return p.has("apikey")||p.set("apikey",s),p.has("Authorization")||p.set("Authorization",`Bearer ${y}`),l(d,tt(tt({},h),{},{headers:p}))}};function Rj(s){return s.endsWith("/")?s:s+"/"}function Dj(s,a){var r,l;const{db:c,auth:d,realtime:h,global:m}=s,{db:y,auth:p,realtime:g,global:w}=a,_={db:tt(tt({},y),c),auth:tt(tt({},p),d),realtime:tt(tt({},g),h),storage:{},global:tt(tt(tt({},w),m),{},{headers:tt(tt({},(r=w?.headers)!==null&&r!==void 0?r:{}),(l=m?.headers)!==null&&l!==void 0?l:{})}),accessToken:async()=>""};return s.accessToken?_.accessToken=s.accessToken:delete _.accessToken,_}function Mj(s){const a=s?.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(Rj(a))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var zj=class extends bj{constructor(s){super(s)}},Uj=class{constructor(s,a,r){var l,c;this.supabaseUrl=s,this.supabaseKey=a;const d=Mj(s);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:Sj,realtime:Nj,auth:tt(tt({},jj),{},{storageKey:h}),global:_j},y=Dj(r??{},m);if(this.storageKey=(l=y.auth.storageKey)!==null&&l!==void 0?l:"",this.headers=(c=y.global.headers)!==null&&c!==void 0?c:{},y.accessToken)this.accessToken=y.accessToken,this.auth=new Proxy({},{get:(g,w)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(w)} is not possible`)}});else{var p;this.auth=this._initSupabaseAuthClient((p=y.auth)!==null&&p!==void 0?p:{},this.headers,y.global.fetch)}this.fetch=Oj(a,this._getAccessToken.bind(this),y.global.fetch),this.realtime=this._initRealtimeClient(tt({headers:this.headers,accessToken:this._getAccessToken.bind(this)},y.realtime)),this.accessToken&&this.accessToken().then(g=>this.realtime.setAuth(g)).catch(g=>console.warn("Failed to set initial Realtime auth token:",g)),this.rest=new p1(new URL("rest/v1",d).href,{headers:this.headers,schema:y.db.schema,fetch:this.fetch}),this.storage=new fS(this.storageUrl.href,this.headers,this.fetch,r?.storage),y.accessToken||this._listenForAuthEvents()}get functions(){return new u1(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(s){return this.rest.from(s)}schema(s){return this.rest.schema(s)}rpc(s,a={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(s,a,r)}channel(s,a={config:{}}){return this.realtime.channel(s,a)}getChannels(){return this.realtime.getChannels()}removeChannel(s){return this.realtime.removeChannel(s)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var s=this,a,r;if(s.accessToken)return await s.accessToken();const{data:l}=await s.auth.getSession();return(a=(r=l.session)===null||r===void 0?void 0:r.access_token)!==null&&a!==void 0?a:s.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:s,persistSession:a,detectSessionInUrl:r,storage:l,userStorage:c,storageKey:d,flowType:h,lock:m,debug:y,throwOnError:p},g,w){const _={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new zj({url:this.authUrl.href,headers:tt(tt({},_),g),storageKey:d,autoRefreshToken:s,persistSession:a,detectSessionInUrl:r,storage:l,userStorage:c,flowType:h,lock:m,debug:y,throwOnError:p,fetch:w,hasCustomAuthorizationHeader:Object.keys(this.headers).some(S=>S.toLowerCase()==="authorization")})}_initRealtimeClient(s){return new R1(this.realtimeUrl.href,tt(tt({},s),{},{params:tt(tt({},{apikey:this.supabaseKey}),s?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((s,a)=>{this._handleTokenChanged(s,"CLIENT",a?.access_token)})}_handleTokenChanged(s,a,r){(s==="TOKEN_REFRESHED"||s==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):s==="SIGNED_OUT"&&(this.realtime.setAuth(),a=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const Wg=(s,a,r)=>new Uj(s,a,r);function Lj(){if(typeof window<"u")return!1;const s=globalThis.process;if(!s)return!1;const a=s.version;if(a==null)return!1;const r=a.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=18:!1}Lj()&&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 Yo="email_automator_supabase_config";function Br(){try{const s=localStorage.getItem(Yo);if(s)return JSON.parse(s)}catch(s){console.error("Error reading Supabase config:",s)}return null}function Bj(s){try{localStorage.setItem(Yo,JSON.stringify(s))}catch(a){console.error("Error saving Supabase config:",a)}}function qj(){try{localStorage.removeItem(Yo)}catch(s){console.error("Error clearing Supabase config:",s)}}async function sv(s,a){try{if(!s.startsWith("http://")&&!s.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(`${s}/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 $j(){return localStorage.getItem(Yo)?"ui":"none"}function Hj(){const s=Br();return!s||!s.url?.startsWith("http")?(console.info("[Supabase] Setup required: Waiting for configuration..."),Wg("https://placeholder.supabase.co","placeholder-key")):Wg(s.url,s.anonKey,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}})}const ct=Hj();function ey(){const s=Br(),a=s?`${s.url}/functions/v1`:"",r=s?s.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 Vj{edgeFunctionsUrl;expressApiUrl;anonKey;token=null;supabaseClient=null;constructor(){const a=ey();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 p=await m.json().catch(()=>({})),g=typeof p.error=="string"?p.error:p.error?.message||`Request failed: ${m.status}`;return{error:{code:p.error?.code||"API_ERROR",message:g}}}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=ey(),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 retryEmail(a){return this.expressRequest(`/api/emails/${a}/retry`,{method:"POST"})}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 ze=new Vj;async function nv(s){ze.setSupabaseClient(s);const{data:{session:a}}=await s.auth.getSession();a?.access_token&&ze.setToken(a.access_token),s.auth.onAuthStateChange((r,l)=>{ze.setToken(l?.access_token||null)})}const Ij=Object.freeze(Object.defineProperty({__proto__:null,api:ze,initializeApi:nv},Symbol.toStringTag,{value:"Module"}));function Gj({userId:s,onInsert:a,onUpdate:r,onDelete:l,enabled:c=!0}){const[d,h]=x.useState(!1);return x.useEffect(()=>{if(!c||!s){h(!1);return}const m=ct.channel(`emails-realtime-${s}`).on("postgres_changes",{event:"*",schema:"public",table:"emails"},y=>{y.eventType==="INSERT"?a?.(y.new):y.eventType==="UPDATE"?r?.(y.new):y.eventType==="DELETE"&&l?.(y.old.id)}).subscribe(y=>{h(y==="SUBSCRIBED")});return()=>{ct.removeChannel(m)}},[s,c,a,r,l]),{isSubscribed:d}}class Pj{ctx=null;enabled=!1;constructor(){const a=localStorage.getItem("ea_sounds_enabled");this.enabled=a!=="false"}setEnabled(a){this.enabled=a,localStorage.setItem("ea_sounds_enabled",a?"true":"false")}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])}playStart(){if(!this.enabled)return;const a=this.initCtx(),r=a.createOscillator(),l=a.createGain();r.type="sine",r.frequency.setValueAtTime(440,a.currentTime),r.frequency.exponentialRampToValueAtTime(880,a.currentTime+.2),l.gain.setValueAtTime(0,a.currentTime),l.gain.linearRampToValueAtTime(.05,a.currentTime+.05),l.gain.exponentialRampToValueAtTime(.001,a.currentTime+.2),r.connect(l),l.connect(a.destination),r.start(),r.stop(a.currentTime+.2),this.haptic(10)}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 Ta=new Pj;let ja=[],ef=new Set;function tf(){ef.forEach(s=>s())}const te={success:(s,a)=>Eo("success",s,a),error:(s,a)=>Eo("error",s,a),info:(s,a)=>Eo("info",s,a),warning:(s,a)=>Eo("warning",s,a)};function Eo(s,a,r=5e3){const l=ja.findIndex(d=>d.message===a&&d.type===s);if(l!==-1){const d=ja[l];ja=[...ja],ja[l]={...d,count:(d.count||1)+1,lastUpdated:Date.now()},tf();return}const c=Math.random().toString(36).substr(2,9);ja=[...ja,{id:c,type:s,message:a,duration:r,count:1,lastUpdated:Date.now()}],tf(),r>0&&setTimeout(()=>rv(c),r)}function rv(s){ja=ja.filter(a=>a.id!==s),tf()}function Kj(){const[,s]=x.useState(0);return x.useEffect(()=>{const a=()=>s(r=>r+1);return ef.add(a),()=>{ef.delete(a)}},[]),ja}const Yj={success:Vi,error:Mr,info:Rr,warning:Dr},Jj={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 Xj({toast:s}){const a=Yj[s.type];return o.jsxs("div",{className:Re("flex items-start gap-3 p-4 rounded-lg border shadow-lg backdrop-blur-sm","animate-in slide-in-from-left-full duration-300",Jj[s.type]),children:[o.jsxs("div",{className:"relative",children:[o.jsx(a,{className:"w-5 h-5 flex-shrink-0 mt-0.5"}),s.count&&s.count>1&&o.jsx("span",{className:"absolute -top-2 -right-2 bg-primary text-primary-foreground text-[10px] font-bold px-1.5 rounded-full border border-background scale-90 animate-in zoom-in duration-200",children:s.count})]}),o.jsx("p",{className:"text-sm flex-1",children:s.message}),o.jsx("button",{onClick:()=>rv(s.id),className:"p-1 hover:bg-black/10 rounded transition-colors",children:o.jsx(tl,{className:"w-4 h-4"})})]})}function Qj(){const s=Kj();return s.length===0?null:o.jsx("div",{className:"fixed bottom-4 left-4 z-50 flex flex-col-reverse gap-2 max-w-sm w-full",children:s.map(a=>o.jsx(Xj,{toast:a},a.id))})}function da(s,a){return s?typeof s=="string"?s:s.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:"created_at",sortOrder:"desc",activeCategory:null,activeSearch:""};function Zj(s,a){switch(a.type){case"SET_USER":return{...s,user:a.payload,isAuthenticated:!!a.payload,isLoading:!1};case"SET_LOADING":return{...s,isLoading:a.payload};case"SET_INITIALIZED":return{...s,isInitialized:a.payload};case"SET_ERROR":return{...s,error:a.payload,isLoading:!1};case"SET_EMAILS":return{...s,emails:a.payload.emails,emailsTotal:a.payload.total,emailsOffset:a.payload.offset,activeCategory:a.payload.category!==void 0?a.payload.category:s.activeCategory,activeSearch:a.payload.search!==void 0?a.payload.search:s.activeSearch,sortBy:a.payload.sortBy||s.sortBy,sortOrder:a.payload.sortOrder||s.sortOrder};case"ADD_EMAIL":{const r=a.payload,l=!s.activeCategory||r.category===s.activeCategory,c=!s.activeSearch||r.subject?.toLowerCase().includes(s.activeSearch.toLowerCase())||r.sender?.toLowerCase().includes(s.activeSearch.toLowerCase());return!l||!c?{...s,emailsTotal:s.emailsTotal+1}:{...s,emails:[r,...s.emails],emailsTotal:s.emailsTotal+1}}case"UPDATE_EMAIL":{const r=a.payload;if(s.emails.findIndex(h=>h.id===r.id)!==-1)return{...s,emails:s.emails.map(h=>h.id===r.id?r:h)};const c=!s.activeCategory||r.category===s.activeCategory,d=!s.activeSearch||r.subject?.toLowerCase().includes(s.activeSearch.toLowerCase())||r.sender?.toLowerCase().includes(s.activeSearch.toLowerCase());return c&&d?{...s,emails:[r,...s.emails]}:s}case"REMOVE_EMAIL":return{...s,emails:s.emails.filter(r=>r.id!==a.payload),emailsTotal:Math.max(0,s.emailsTotal-1)};case"SET_PROFILE":return{...s,profile:a.payload};case"UPDATE_PROFILE":return{...s,profile:a.payload};case"SET_ACCOUNTS":return{...s,accounts:a.payload};case"ADD_ACCOUNT":return{...s,accounts:[a.payload,...s.accounts]};case"REMOVE_ACCOUNT":return{...s,accounts:s.accounts.filter(r=>r.id!==a.payload)};case"SET_RULES":return{...s,rules:a.payload};case"ADD_RULE":return{...s,rules:[a.payload,...s.rules]};case"UPDATE_RULE":return{...s,rules:s.rules.map(r=>r.id===a.payload.id?a.payload:r)};case"REMOVE_RULE":return{...s,rules:s.rules.filter(r=>r.id!==a.payload)};case"SET_SETTINGS":return{...s,settings:a.payload};case"SET_STATS":return{...s,stats:a.payload};case"SET_SELECTED_EMAIL":return{...s,selectedEmailId:a.payload};case"CLEAR_DATA":return{...iv,isLoading:!1,isInitialized:!0};default:return s}}const lv=x.createContext(null);function Fj({children:s}){const[a,r]=x.useReducer(Zj,iv),l=x.useCallback(async(p,g=3,w=500)=>{for(let _=1;_<=g;_++){const S=await ze.getEmail(p);if(S.data?.email)return S.data.email;_<g&&await new Promise(E=>setTimeout(E,w))}return null},[]),c=x.useCallback(async p=>{const g=await l(p.id);g&&(r({type:"ADD_EMAIL",payload:g}),g.processing_status==="completed"&&(g.ai_analysis?.priority==="High"?(Ta.playAlert(),te.success("High Priority Email Processed!")):(Ta.playNotify(),te.info("New email processed"))))},[r,l]),d=x.useCallback(async p=>{const g=await l(p.id);g&&(r({type:"UPDATE_EMAIL",payload:g}),g.processing_status==="completed"&&p.processing_status==="completed"&&(g.ai_analysis?.priority==="High"?(Ta.playAlert(),te.success("High Priority Email Processed!")):(Ta.playNotify(),te.info("Email analysis complete"))))},[r,l]),h=x.useCallback(p=>{r({type:"REMOVE_EMAIL",payload:p})},[r]),{isSubscribed:m}=Gj({userId:a.user?.id,onInsert:c,onUpdate:d,onDelete:h,enabled:a.isAuthenticated});x.useEffect(()=>{async function p(){if(!Br()){r({type:"SET_INITIALIZED",payload:!0});return}try{const{error:w}=await ct.from("init_state").select("count",{count:"exact",head:!0});if(w&&w.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:S}}=ct.auth.onAuthStateChange((E,j)=>{r({type:"SET_USER",payload:j?.user||null}),j||r({type:"CLEAR_DATA"})});return()=>S.unsubscribe()}catch(w){console.error("[AppContext] Init error:",w),r({type:"SET_ERROR",payload:"Failed to initialize"}),r({type:"SET_INITIALIZED",payload:!0})}}p()},[]);const y={fetchEmails:async(p={})=>{const g=await ze.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,category:p.category||null,search:p.search||"",sortBy:p.sortBy,sortOrder:p.sortOrder}})},fetchAccounts:async()=>{const p=await ze.getAccounts();p.data&&r({type:"SET_ACCOUNTS",payload:p.data.accounts})},fetchRules:async()=>{const p=await ze.getRules();p.data&&r({type:"SET_RULES",payload:p.data.rules})},fetchSettings:async()=>{const p=await ze.getSettings();p.data&&r({type:"SET_SETTINGS",payload:p.data.settings})},fetchProfile:async()=>{const p=await ze.getProfile();p.data&&r({type:"SET_PROFILE",payload:p.data})},fetchStats:async()=>{const p=await ze.getStats();p.data&&r({type:"SET_STATS",payload:p.data.stats})},executeAction:async(p,g,w)=>{const _=await ze.executeAction(p,g,w);if(_.data?.success){const S=a.emails.find(E=>E.id===p);return S&&r({type:"UPDATE_EMAIL",payload:{...S,action_taken:g}}),!0}return r({type:"SET_ERROR",payload:da(_.error,"Action failed")}),!1},triggerSync:async p=>{const g=p?await ze.triggerSync(p):await ze.syncAll();return await y.fetchAccounts(),g.error?(r({type:"SET_ERROR",payload:da(g.error,"Sync failed")}),!1):!0},disconnectAccount:async p=>{const g=await ze.disconnectAccount(p);return g.data?.success?(r({type:"REMOVE_ACCOUNT",payload:p}),!0):(r({type:"SET_ERROR",payload:da(g.error,"Failed to disconnect")}),!1)},updateSettings:async p=>{const g=await ze.updateSettings(p);return g.data?(r({type:"SET_SETTINGS",payload:g.data.settings}),!0):(r({type:"SET_ERROR",payload:da(g.error,"Failed to update settings")}),!1)},updateProfile:async p=>{const g=await ze.updateProfile(p);return g.data?(r({type:"UPDATE_PROFILE",payload:g.data}),!0):(r({type:"SET_ERROR",payload:da(g.error,"Failed to update profile")}),!1)},updateAccount:async(p,g)=>{const w=await ze.updateAccount(p,g);return w.data?(r({type:"SET_ACCOUNTS",payload:a.accounts.map(_=>_.id===p?{..._,...g}:_)}),!0):(r({type:"SET_ERROR",payload:da(w.error,"Failed to update account")}),!1)},retryProcessing:async p=>{const g=await ze.retryEmail(p);if(g.data?.success){const w=a.emails.find(_=>_.id===p);return w&&r({type:"UPDATE_EMAIL",payload:{...w,processing_status:"pending",processing_error:null}}),!0}return r({type:"SET_ERROR",payload:da(g.error,"Retry failed")}),!1},createRule:async p=>{const g=await ze.createRule(p);return g.data?(r({type:"ADD_RULE",payload:g.data.rule}),!0):(r({type:"SET_ERROR",payload:da(g.error,"Failed to create rule")}),!1)},updateRule:async(p,g)=>{const w=await ze.updateRule(p,g);return w.data?(r({type:"UPDATE_RULE",payload:w.data.rule}),!0):(r({type:"SET_ERROR",payload:da(w.error,"Failed to update rule")}),!1)},deleteRule:async p=>{const g=await ze.deleteRule(p);return g.data?.success?(r({type:"REMOVE_RULE",payload:p}),!0):(r({type:"SET_ERROR",payload:da(g.error,"Failed to delete rule")}),!1)},toggleRule:async p=>{const g=await ze.toggleRule(p);return g.data?(r({type:"UPDATE_RULE",payload:g.data.rule}),!0):(r({type:"SET_ERROR",payload:da(g.error,"Failed to toggle rule")}),!1)}};return o.jsx(lv.Provider,{value:{state:a,isSubscribed:m,dispatch:r,actions:y},children:s})}function qr(){const s=x.useContext(lv);if(!s)throw new Error("useApp must be used within AppProvider");return s}const Wj=x.createContext(void 0);function eN({children:s,value:a}){return o.jsx(Wj.Provider,{value:a,children:s})}const ov=x.createContext(null);function tN({children:s}){const[a,r]=x.useState(!1),l=()=>r(!0),c=()=>r(!1);return o.jsx(ov.Provider,{value:{isExpanded:a,setIsExpanded:r,openTerminal:l,closeTerminal:c},children:s})}function cv(){const s=x.useContext(ov);if(!s)throw new Error("useTerminal must be used within a TerminalProvider");return s}const At=x.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Re("rounded-xl border bg-card text-card-foreground shadow",s),...a}));At.displayName="Card";const Aa=x.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Re("flex flex-col space-y-1.5 p-6",s),...a}));Aa.displayName="CardHeader";const Ca=x.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Re("font-semibold leading-none tracking-tight",s),...a}));Ca.displayName="CardTitle";const as=x.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Re("text-sm text-muted-foreground",s),...a}));as.displayName="CardDescription";const ka=x.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Re("p-6 pt-0",s),...a}));ka.displayName="CardContent";const uv=x.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Re("flex items-center p-6 pt-0",s),...a}));uv.displayName="CardFooter";class aN extends x.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(At,{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(Dr,{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(qs,{className:"w-4 h-4 mr-2"}),"Try Again"]}),o.jsx(Z,{onClick:()=>window.location.reload(),children:"Refresh Page"})]})]})}):this.props.children}}function mt({size:s="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:Re("flex flex-col items-center justify-center gap-3",a),children:[o.jsx($t,{className:Re("animate-spin text-primary",l[s])}),r&&o.jsx("p",{className:"text-sm text-muted-foreground",children:r})]})}function $i({text:s="Loading..."}){return o.jsx("div",{className:"min-h-screen flex items-center justify-center",children:o.jsx(mt,{size:"lg",text:s})})}function sN(){return o.jsx("div",{className:"p-12 flex items-center justify-center",children:o.jsx(mt,{size:"md"})})}function Bs(s,a,{checkForDefaultPrevented:r=!0}={}){return function(c){if(s?.(c),r===!1||!c.defaultPrevented)return a?.(c)}}function nN(s,a){const r=x.createContext(a),l=d=>{const{children:h,...m}=d,y=x.useMemo(()=>m,Object.values(m));return o.jsx(r.Provider,{value:y,children:h})};l.displayName=s+"Provider";function c(d){const h=x.useContext(r);if(h)return h;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[l,c]}function rN(s,a=[]){let r=[];function l(d,h){const m=x.createContext(h),y=r.length;r=[...r,h];const p=w=>{const{scope:_,children:S,...E}=w,j=_?.[s]?.[y]||m,R=x.useMemo(()=>E,Object.values(E));return o.jsx(j.Provider,{value:R,children:S})};p.displayName=d+"Provider";function g(w,_){const S=_?.[s]?.[y]||m,E=x.useContext(S);if(E)return E;if(h!==void 0)return h;throw new Error(`\`${w}\` must be used within \`${d}\``)}return[p,g]}const c=()=>{const d=r.map(h=>x.createContext(h));return function(m){const y=m?.[s]||d;return x.useMemo(()=>({[`__scope${s}`]:{...m,[s]:y}}),[m,y])}};return c.scopeName=s,[l,iN(c,...a)]}function iN(...s){const a=s[0];if(s.length===1)return a;const r=()=>{const l=s.map(c=>({useScope:c(),scopeName:c.scopeName}));return function(d){const h=l.reduce((m,{useScope:y,scopeName:p})=>{const w=y(d)[`__scope${p}`];return{...m,...w}},{});return x.useMemo(()=>({[`__scope${a.scopeName}`]:h}),[h])}};return r.scopeName=a.scopeName,r}var Zi=globalThis?.document?x.useLayoutEffect:()=>{},lN=lf[" useId ".trim().toString()]||(()=>{}),oN=0;function kd(s){const[a,r]=x.useState(lN());return Zi(()=>{r(l=>l??String(oN++))},[s]),s||(a?`radix-${a}`:"")}var cN=lf[" useInsertionEffect ".trim().toString()]||Zi;function uN({prop:s,defaultProp:a,onChange:r=()=>{},caller:l}){const[c,d,h]=dN({defaultProp:a,onChange:r}),m=s!==void 0,y=m?s:c;{const g=x.useRef(s!==void 0);x.useEffect(()=>{const w=g.current;w!==m&&console.warn(`${l} is changing from ${w?"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.`),g.current=m},[m,l])}const p=x.useCallback(g=>{if(m){const w=fN(g)?g(s):g;w!==s&&h.current?.(w)}else d(g)},[m,s,d,h]);return[y,p]}function dN({defaultProp:s,onChange:a}){const[r,l]=x.useState(s),c=x.useRef(r),d=x.useRef(a);return cN(()=>{d.current=a},[a]),x.useEffect(()=>{c.current!==r&&(d.current?.(r),c.current=r)},[r,c]),[r,l,d]}function fN(s){return typeof s=="function"}var dv=gy();const hN=nf(dv);function mN(s){const a=pN(s),r=x.forwardRef((l,c)=>{const{children:d,...h}=l,m=x.Children.toArray(d),y=m.find(yN);if(y){const p=y.props.children,g=m.map(w=>w===y?x.Children.count(p)>1?x.Children.only(null):x.isValidElement(p)?p.props.children:null:w);return o.jsx(a,{...h,ref:c,children:x.isValidElement(p)?x.cloneElement(p,void 0,g):null})}return o.jsx(a,{...h,ref:c,children:d})});return r.displayName=`${s}.Slot`,r}function pN(s){const a=x.forwardRef((r,l)=>{const{children:c,...d}=r;if(x.isValidElement(c)){const h=bN(c),m=vN(d,c.props);return c.type!==x.Fragment&&(m.ref=l?Go(l,h):h),x.cloneElement(c,m)}return x.Children.count(c)>1?x.Children.only(null):null});return a.displayName=`${s}.SlotClone`,a}var gN=Symbol("radix.slottable");function yN(s){return x.isValidElement(s)&&typeof s.type=="function"&&"__radixId"in s.type&&s.type.__radixId===gN}function vN(s,a){const r={...a};for(const l in a){const c=s[l],d=a[l];/^on[A-Z]/.test(l)?c&&d?r[l]=(...m)=>{const y=d(...m);return c(...m),y}:c&&(r[l]=c):l==="style"?r[l]={...c,...d}:l==="className"&&(r[l]=[c,d].filter(Boolean).join(" "))}return{...s,...r}}function bN(s){let a=Object.getOwnPropertyDescriptor(s.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?s.ref:(a=Object.getOwnPropertyDescriptor(s,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?s.props.ref:s.props.ref||s.ref)}var xN=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ns=xN.reduce((s,a)=>{const r=mN(`Primitive.${a}`),l=x.forwardRef((c,d)=>{const{asChild:h,...m}=c,y=h?r:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(y,{...m,ref:d})});return l.displayName=`Primitive.${a}`,{...s,[a]:l}},{});function wN(s,a){s&&dv.flushSync(()=>s.dispatchEvent(a))}function Fi(s){const a=x.useRef(s);return x.useEffect(()=>{a.current=s}),x.useMemo(()=>(...r)=>a.current?.(...r),[])}function _N(s,a=globalThis?.document){const r=Fi(s);x.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 SN="DismissableLayer",af="dismissableLayer.update",jN="dismissableLayer.pointerDownOutside",NN="dismissableLayer.focusOutside",ty,fv=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),hv=x.forwardRef((s,a)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:h,onDismiss:m,...y}=s,p=x.useContext(fv),[g,w]=x.useState(null),_=g?.ownerDocument??globalThis?.document,[,S]=x.useState({}),E=xn(a,I=>w(I)),j=Array.from(p.layers),[R]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),D=j.indexOf(R),B=g?j.indexOf(g):-1,q=p.layersWithOutsidePointerEventsDisabled.size>0,P=B>=D,W=AN(I=>{const X=I.target,oe=[...p.branches].some(Ue=>Ue.contains(X));!P||oe||(c?.(I),h?.(I),I.defaultPrevented||m?.())},_),Y=CN(I=>{const X=I.target;[...p.branches].some(Ue=>Ue.contains(X))||(d?.(I),h?.(I),I.defaultPrevented||m?.())},_);return _N(I=>{B===p.layers.size-1&&(l?.(I),!I.defaultPrevented&&m&&(I.preventDefault(),m()))},_),x.useEffect(()=>{if(g)return r&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(ty=_.body.style.pointerEvents,_.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(g)),p.layers.add(g),ay(),()=>{r&&p.layersWithOutsidePointerEventsDisabled.size===1&&(_.body.style.pointerEvents=ty)}},[g,_,r,p]),x.useEffect(()=>()=>{g&&(p.layers.delete(g),p.layersWithOutsidePointerEventsDisabled.delete(g),ay())},[g,p]),x.useEffect(()=>{const I=()=>S({});return document.addEventListener(af,I),()=>document.removeEventListener(af,I)},[]),o.jsx(ns.div,{...y,ref:E,style:{pointerEvents:q?P?"auto":"none":void 0,...s.style},onFocusCapture:Bs(s.onFocusCapture,Y.onFocusCapture),onBlurCapture:Bs(s.onBlurCapture,Y.onBlurCapture),onPointerDownCapture:Bs(s.onPointerDownCapture,W.onPointerDownCapture)})});hv.displayName=SN;var EN="DismissableLayerBranch",TN=x.forwardRef((s,a)=>{const r=x.useContext(fv),l=x.useRef(null),c=xn(a,l);return x.useEffect(()=>{const d=l.current;if(d)return r.branches.add(d),()=>{r.branches.delete(d)}},[r.branches]),o.jsx(ns.div,{...s,ref:c})});TN.displayName=EN;function AN(s,a=globalThis?.document){const r=Fi(s),l=x.useRef(!1),c=x.useRef(()=>{});return x.useEffect(()=>{const d=m=>{if(m.target&&!l.current){let y=function(){mv(jN,r,p,{discrete:!0})};const p={originalEvent:m};m.pointerType==="touch"?(a.removeEventListener("click",c.current),c.current=y,a.addEventListener("click",c.current,{once:!0})):y()}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 CN(s,a=globalThis?.document){const r=Fi(s),l=x.useRef(!1);return x.useEffect(()=>{const c=d=>{d.target&&!l.current&&mv(NN,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 ay(){const s=new CustomEvent(af);document.dispatchEvent(s)}function mv(s,a,r,{discrete:l}){const c=r.originalEvent.target,d=new CustomEvent(s,{bubbles:!1,cancelable:!0,detail:r});a&&c.addEventListener(s,a,{once:!0}),l?wN(c,d):c.dispatchEvent(d)}var Od="focusScope.autoFocusOnMount",Rd="focusScope.autoFocusOnUnmount",sy={bubbles:!1,cancelable:!0},kN="FocusScope",pv=x.forwardRef((s,a)=>{const{loop:r=!1,trapped:l=!1,onMountAutoFocus:c,onUnmountAutoFocus:d,...h}=s,[m,y]=x.useState(null),p=Fi(c),g=Fi(d),w=x.useRef(null),_=xn(a,j=>y(j)),S=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(l){let j=function(q){if(S.paused||!m)return;const P=q.target;m.contains(P)?w.current=P:Ms(w.current,{select:!0})},R=function(q){if(S.paused||!m)return;const P=q.relatedTarget;P!==null&&(m.contains(P)||Ms(w.current,{select:!0}))},D=function(q){if(document.activeElement===document.body)for(const W of q)W.removedNodes.length>0&&Ms(m)};document.addEventListener("focusin",j),document.addEventListener("focusout",R);const B=new MutationObserver(D);return m&&B.observe(m,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",R),B.disconnect()}}},[l,m,S.paused]),x.useEffect(()=>{if(m){ry.add(S);const j=document.activeElement;if(!m.contains(j)){const D=new CustomEvent(Od,sy);m.addEventListener(Od,p),m.dispatchEvent(D),D.defaultPrevented||(ON(UN(gv(m)),{select:!0}),document.activeElement===j&&Ms(m))}return()=>{m.removeEventListener(Od,p),setTimeout(()=>{const D=new CustomEvent(Rd,sy);m.addEventListener(Rd,g),m.dispatchEvent(D),D.defaultPrevented||Ms(j??document.body,{select:!0}),m.removeEventListener(Rd,g),ry.remove(S)},0)}}},[m,p,g,S]);const E=x.useCallback(j=>{if(!r&&!l||S.paused)return;const R=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,D=document.activeElement;if(R&&D){const B=j.currentTarget,[q,P]=RN(B);q&&P?!j.shiftKey&&D===P?(j.preventDefault(),r&&Ms(q,{select:!0})):j.shiftKey&&D===q&&(j.preventDefault(),r&&Ms(P,{select:!0})):D===B&&j.preventDefault()}},[r,l,S.paused]);return o.jsx(ns.div,{tabIndex:-1,...h,ref:_,onKeyDown:E})});pv.displayName=kN;function ON(s,{select:a=!1}={}){const r=document.activeElement;for(const l of s)if(Ms(l,{select:a}),document.activeElement!==r)return}function RN(s){const a=gv(s),r=ny(a,s),l=ny(a.reverse(),s);return[r,l]}function gv(s){const a=[],r=document.createTreeWalker(s,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(s,a){for(const r of s)if(!DN(r,{upTo:a}))return r}function DN(s,{upTo:a}){if(getComputedStyle(s).visibility==="hidden")return!0;for(;s;){if(a!==void 0&&s===a)return!1;if(getComputedStyle(s).display==="none")return!0;s=s.parentElement}return!1}function MN(s){return s instanceof HTMLInputElement&&"select"in s}function Ms(s,{select:a=!1}={}){if(s&&s.focus){const r=document.activeElement;s.focus({preventScroll:!0}),s!==r&&MN(s)&&a&&s.select()}}var ry=zN();function zN(){let s=[];return{add(a){const r=s[0];a!==r&&r?.pause(),s=iy(s,a),s.unshift(a)},remove(a){s=iy(s,a),s[0]?.resume()}}}function iy(s,a){const r=[...s],l=r.indexOf(a);return l!==-1&&r.splice(l,1),r}function UN(s){return s.filter(a=>a.tagName!=="A")}var LN="Portal",yv=x.forwardRef((s,a)=>{const{container:r,...l}=s,[c,d]=x.useState(!1);Zi(()=>d(!0),[]);const h=r||c&&globalThis?.document?.body;return h?hN.createPortal(o.jsx(ns.div,{...l,ref:a}),h):null});yv.displayName=LN;function BN(s,a){return x.useReducer((r,l)=>a[r][l]??r,s)}var Jo=s=>{const{present:a,children:r}=s,l=qN(a),c=typeof r=="function"?r({present:l.isPresent}):x.Children.only(r),d=xn(l.ref,$N(c));return typeof r=="function"||l.isPresent?x.cloneElement(c,{ref:d}):null};Jo.displayName="Presence";function qN(s){const[a,r]=x.useState(),l=x.useRef(null),c=x.useRef(s),d=x.useRef("none"),h=s?"mounted":"unmounted",[m,y]=BN(h,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const p=To(l.current);d.current=m==="mounted"?p:"none"},[m]),Zi(()=>{const p=l.current,g=c.current;if(g!==s){const _=d.current,S=To(p);s?y("MOUNT"):S==="none"||p?.display==="none"?y("UNMOUNT"):y(g&&_!==S?"ANIMATION_OUT":"UNMOUNT"),c.current=s}},[s,y]),Zi(()=>{if(a){let p;const g=a.ownerDocument.defaultView??window,w=S=>{const j=To(l.current).includes(CSS.escape(S.animationName));if(S.target===a&&j&&(y("ANIMATION_END"),!c.current)){const R=a.style.animationFillMode;a.style.animationFillMode="forwards",p=g.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=R)})}},_=S=>{S.target===a&&(d.current=To(l.current))};return a.addEventListener("animationstart",_),a.addEventListener("animationcancel",w),a.addEventListener("animationend",w),()=>{g.clearTimeout(p),a.removeEventListener("animationstart",_),a.removeEventListener("animationcancel",w),a.removeEventListener("animationend",w)}}else y("ANIMATION_END")},[a,y]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:x.useCallback(p=>{l.current=p?getComputedStyle(p):null,r(p)},[])}}function To(s){return s?.animationName||"none"}function $N(s){let a=Object.getOwnPropertyDescriptor(s.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?s.ref:(a=Object.getOwnPropertyDescriptor(s,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?s.props.ref:s.props.ref||s.ref)}var Dd=0;function HN(){x.useEffect(()=>{const s=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",s[0]??ly()),document.body.insertAdjacentElement("beforeend",s[1]??ly()),Dd++,()=>{Dd===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(a=>a.remove()),Dd--}},[])}function ly(){const s=document.createElement("span");return s.setAttribute("data-radix-focus-guard",""),s.tabIndex=0,s.style.outline="none",s.style.opacity="0",s.style.position="fixed",s.style.pointerEvents="none",s}var Mo="right-scroll-bar-position",zo="width-before-scroll-bar",VN="with-scroll-bars-hidden",IN="--removed-body-scroll-bar-size";function Md(s,a){return typeof s=="function"?s(a):s&&(s.current=a),s}function GN(s,a){var r=x.useState(function(){return{value:s,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 PN=typeof window<"u"?x.useLayoutEffect:x.useEffect,oy=new WeakMap;function KN(s,a){var r=GN(null,function(l){return s.forEach(function(c){return Md(c,l)})});return PN(function(){var l=oy.get(r);if(l){var c=new Set(l),d=new Set(s),h=r.current;c.forEach(function(m){d.has(m)||Md(m,null)}),d.forEach(function(m){c.has(m)||Md(m,h)})}oy.set(r,s)},[s]),r}function YN(s){return s}function JN(s,a){a===void 0&&(a=YN);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]:s},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 y=function(){var g=h;h=[],g.forEach(d)},p=function(){return Promise.resolve().then(y)};p(),r={push:function(g){h.push(g),p()},filter:function(g){return h=h.filter(g),r}}}};return c}function XN(s){s===void 0&&(s={});var a=JN(null);return a.options=Ea({async:!0,ssr:!1},s),a}var vv=function(s){var a=s.sideCar,r=Lr(s,["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 x.createElement(l,Ea({},r))};vv.isSideCarExport=!0;function QN(s,a){return s.useMedium(a),vv}var bv=XN(),zd=function(){},Xo=x.forwardRef(function(s,a){var r=x.useRef(null),l=x.useState({onScrollCapture:zd,onWheelCapture:zd,onTouchMoveCapture:zd}),c=l[0],d=l[1],h=s.forwardProps,m=s.children,y=s.className,p=s.removeScrollBar,g=s.enabled,w=s.shards,_=s.sideCar,S=s.noRelative,E=s.noIsolation,j=s.inert,R=s.allowPinchZoom,D=s.as,B=D===void 0?"div":D,q=s.gapMode,P=Lr(s,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),W=_,Y=KN([r,a]),I=Ea(Ea({},P),c);return x.createElement(x.Fragment,null,g&&x.createElement(W,{sideCar:bv,removeScrollBar:p,shards:w,noRelative:S,noIsolation:E,inert:j,setCallbacks:d,allowPinchZoom:!!R,lockRef:r,gapMode:q}),h?x.cloneElement(x.Children.only(m),Ea(Ea({},I),{ref:Y})):x.createElement(B,Ea({},I,{className:y,ref:Y}),m))});Xo.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Xo.classNames={fullWidth:zo,zeroRight:Mo};var ZN=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function FN(){if(!document)return null;var s=document.createElement("style");s.type="text/css";var a=ZN();return a&&s.setAttribute("nonce",a),s}function WN(s,a){s.styleSheet?s.styleSheet.cssText=a:s.appendChild(document.createTextNode(a))}function eE(s){var a=document.head||document.getElementsByTagName("head")[0];a.appendChild(s)}var tE=function(){var s=0,a=null;return{add:function(r){s==0&&(a=FN())&&(WN(a,r),eE(a)),s++},remove:function(){s--,!s&&a&&(a.parentNode&&a.parentNode.removeChild(a),a=null)}}},aE=function(){var s=tE();return function(a,r){x.useEffect(function(){return s.add(a),function(){s.remove()}},[a&&r])}},xv=function(){var s=aE(),a=function(r){var l=r.styles,c=r.dynamic;return s(l,c),null};return a},sE={left:0,top:0,right:0,gap:0},Ud=function(s){return parseInt(s||"",10)||0},nE=function(s){var a=window.getComputedStyle(document.body),r=a[s==="padding"?"paddingLeft":"marginLeft"],l=a[s==="padding"?"paddingTop":"marginTop"],c=a[s==="padding"?"paddingRight":"marginRight"];return[Ud(r),Ud(l),Ud(c)]},rE=function(s){if(s===void 0&&(s="margin"),typeof window>"u")return sE;var a=nE(s),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])}},iE=xv(),kr="data-scroll-locked",lE=function(s,a,r,l){var c=s.left,d=s.top,h=s.right,m=s.gap;return r===void 0&&(r="margin"),`
52
- .`.concat(VN,` {
50
+ ${D}`}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 Vo extends ot{constructor(a,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:a}),this.name="WebAuthnUnknownError",this.originalError=r}}function rj({error:s,options:a}){var r,l,c;const{publicKey:d}=a;if(!d)throw Error("options was missing required publicKey property");if(s.name==="AbortError"){if(a.signal instanceof AbortSignal)return new ot({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:s})}else if(s.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:s});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:s});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:s})}else{if(s.name==="InvalidStateError")return new ot({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:s});if(s.name==="NotAllowedError")return new ot({message:s.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s});if(s.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:s}):new ot({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:s});if(s.name==="SecurityError"){const h=window.location.hostname;if(rv(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:s})}else return new ot({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:s})}else if(s.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:s})}else if(s.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:s})}return new ot({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s})}function ij({error:s,options:a}){const{publicKey:r}=a;if(!r)throw Error("options was missing required publicKey property");if(s.name==="AbortError"){if(a.signal instanceof AbortSignal)return new ot({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:s})}else{if(s.name==="NotAllowedError")return new ot({message:s.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s});if(s.name==="SecurityError"){const l=window.location.hostname;if(rv(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:s})}else return new ot({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:s})}else if(s.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:s})}return new ot({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:s})}class lj{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 oj=new lj;function cj(s){if(!s)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(s);const{challenge:a,user:r,excludeCredentials:l}=s,c=Br(s,["challenge","user","excludeCredentials"]),d=kr(a).buffer,h=Object.assign(Object.assign({},r),{id:kr(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 y=0;y<l.length;y++){const p=l[y];m.excludeCredentials[y]=Object.assign(Object.assign({},p),{id:kr(p.id).buffer,type:p.type||"public-key",transports:p.transports})}}return m}function uj(s){if(!s)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(s);const{challenge:a,allowCredentials:r}=s,l=Br(s,["challenge","allowCredentials"]),c=kr(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:kr(m.id).buffer,type:m.type||"public-key",transports:m.transports})}}return d}function dj(s){var a;if("toJSON"in s&&typeof s.toJSON=="function")return s.toJSON();const r=s;return{id:s.id,rawId:s.id,response:{attestationObject:gn(new Uint8Array(s.response.attestationObject)),clientDataJSON:gn(new Uint8Array(s.response.clientDataJSON))},type:"public-key",clientExtensionResults:s.getClientExtensionResults(),authenticatorAttachment:(a=r.authenticatorAttachment)!==null&&a!==void 0?a:void 0}}function fj(s){var a;if("toJSON"in s&&typeof s.toJSON=="function")return s.toJSON();const r=s,l=s.getClientExtensionResults(),c=s.response;return{id:s.id,rawId:s.id,response:{authenticatorData:gn(new Uint8Array(c.authenticatorData)),clientDataJSON:gn(new Uint8Array(c.clientDataJSON)),signature:gn(new Uint8Array(c.signature)),userHandle:c.userHandle?gn(new Uint8Array(c.userHandle)):void 0},type:"public-key",clientExtensionResults:l,authenticatorAttachment:(a=r.authenticatorAttachment)!==null&&a!==void 0?a:void 0}}function rv(s){return s==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(s)}function Zg(){var s,a;return!!(Tt()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((s=navigator?.credentials)===null||s===void 0?void 0:s.create)=="function"&&typeof((a=navigator?.credentials)===null||a===void 0?void 0:a.get)=="function")}async function hj(s){try{const a=await navigator.credentials.create(s);return a?a instanceof PublicKeyCredential?{data:a,error:null}:{data:null,error:new Vo("Browser returned unexpected credential type",a)}:{data:null,error:new Vo("Empty credential response",a)}}catch(a){return{data:null,error:rj({error:a,options:s})}}}async function mj(s){try{const a=await navigator.credentials.get(s);return a?a instanceof PublicKeyCredential?{data:a,error:null}:{data:null,error:new Vo("Browser returned unexpected credential type",a)}:{data:null,error:new Vo("Empty credential response",a)}}catch(a){return{data:null,error:ij({error:a,options:s})}}}const pj={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},gj={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Io(...s){const a=c=>c!==null&&typeof c=="object"&&!Array.isArray(c),r=c=>c instanceof ArrayBuffer||ArrayBuffer.isView(c),l={};for(const c of s)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]=Io(m,h):l[d]=Io(h)}else l[d]=h}return l}function yj(s,a){return Io(pj,s,a||{})}function vj(s,a){return Io(gj,s,a||{})}class bj{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 y=c??oj.createNewAbortSignal();if(h.webauthn.type==="create"){const{user:p}=h.webauthn.credential_options.publicKey;p.name||(p.name=`${p.id}:${l}`),p.displayName||(p.displayName=p.name)}switch(h.webauthn.type){case"create":{const p=yj(h.webauthn.credential_options.publicKey,d?.create),{data:g,error:w}=await hj({publicKey:p,signal:y});return g?{data:{factorId:a,challengeId:h.id,webauthn:{type:h.webauthn.type,credential_response:g}},error:null}:{data:null,error:w}}case"request":{const p=vj(h.webauthn.credential_options.publicKey,d?.request),{data:g,error:w}=await mj(Object.assign(Object.assign({},h.webauthn.credential_options),{publicKey:p,signal:y}));return g?{data:{factorId:a,challengeId:h.id,webauthn:{type:h.webauthn.type,credential_response:g}},error:null}:{data:null,error:w}}}}catch(h){return oe(h)?{data:null,error:h}:{data:null,error:new pn("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 Xi("rpId is required for WebAuthn authentication")};try{if(!Zg())return{data:null,error:new pn("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:y}=h;return this._verify({factorId:a,challengeId:h.challengeId,webauthn:{type:y.type,rpId:r,rpOrigins:l,credential_response:y.credential_response}})}catch(h){return oe(h)?{data:null,error:h}:{data:null,error:new pn("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 Xi("rpId is required for WebAuthn registration")};try{if(!Zg())return{data:null,error:new pn("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(g=>{var w;return(w=g.data)===null||w===void 0?void 0:w.all.find(_=>_.factor_type==="webauthn"&&_.friendly_name===a&&_.status!=="unverified")}).then(g=>g?this.client.mfa.unenroll({factorId:g?.id}):void 0),{data:null,error:m};const{data:y,error:p}=await this._challenge({factorId:h.id,friendlyName:h.friendly_name,webauthn:{rpId:r,rpOrigins:l},signal:c},{create:d});return y?this._verify({factorId:h.id,challengeId:y.challengeId,webauthn:{rpId:r,rpOrigins:l,type:y.webauthn.type,credential_response:y.webauthn.credential_response}}):{data:null,error:p}}catch(h){return oe(h)?{data:null,error:h}:{data:null,error:new pn("Unexpected error in register",h)}}}}tj();const xj={url:pS,storageKey:gS,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:yS,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:1e4};async function Fg(s,a,r){return await r()}const wr={};class Qi{get jwks(){var a,r;return(r=(a=wr[this.storageKey])===null||a===void 0?void 0:a.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(a){wr[this.storageKey]=Object.assign(Object.assign({},wr[this.storageKey]),{jwks:a})}get jwks_cached_at(){var a,r;return(r=(a=wr[this.storageKey])===null||a===void 0?void 0:a.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(a){wr[this.storageKey]=Object.assign(Object.assign({},wr[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({},xj),a);if(this.storageKey=d.storageKey,this.instanceID=(r=Qi.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Qi.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!d.debug,typeof d.debug=="function"&&(this.logger=d.debug),this.instanceID>0&&Tt()){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 FS({url:d.url,headers:d.headers,fetch:d.fetch}),this.url=d.url,this.headers=d.headers,this.fetch=av(d.fetch),this.lock=d.lock||Fg,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&&Tt()&&(!((l=globalThis?.navigator)===null||l===void 0)&&l.locks)?this.lock=ej:this.lock=Fg,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 bj(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:tv()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Qg(this.memoryStorage)),d.userStorage&&(this.userStorage=d.userStorage)):(this.memoryStorage={},this.storage=Qg(this.memoryStorage)),Tt()&&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} (${Fy}) ${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(Tt()&&(r=RS(window.location.href),this._isImplicitGrantCallback(r)?l="implicit":await this._isPKCECallback(r)&&(l="pkce")),Tt()&&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),SS(d)){const y=(a=d.details)===null||a===void 0?void 0:a.code;if(y==="identity_already_exists"||y==="identity_not_found"||y==="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 pn("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(a){var r,l,c;try{const d=await pe(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:fa}),{data:h,error:m}=d;if(m||!h)return this._returnResult({data:{user:null,session:null},error:m});const y=h.session,p=h.user;return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",y)),this._returnResult({data:{user:p,session:y},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:g,password:w,options:_}=a;let S=null,E=null;this.flowType==="pkce"&&([S,E]=await vr(this.storage,this.storageKey)),d=await pe(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:_?.emailRedirectTo,body:{email:g,password:w,data:(r=_?.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:_?.captchaToken},code_challenge:S,code_challenge_method:E},xform:fa})}else if("phone"in a){const{phone:g,password:w,options:_}=a;d=await pe(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:g,password:w,data:(l=_?.data)!==null&&l!==void 0?l:{},channel:(c=_?.channel)!==null&&c!==void 0?c:"sms",gotrue_meta_security:{captcha_token:_?.captchaToken}},xform:fa})}else throw new No("You must provide either an email or phone number and a password");const{data:h,error:m}=d;if(m||!h)return await Et(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:m});const y=h.session,p=h.user;return h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",y)),this._returnResult({data:{user:p,session:y},error:null})}catch(d){if(await Et(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 pe(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:Jg})}else if("phone"in a){const{phone:d,password:h,options:m}=a;r=await pe(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:Jg})}else throw new No("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 yr;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,y,p,g,w,_;let S,E;if("message"in a)S=a.message,E=a.signature;else{const{chain:j,wallet:R,statement:D,options:B}=a;let q;if(Tt())if(typeof R=="object")q=R;else{const le=window;if("ethereum"in le&&typeof le.ethereum=="object"&&"request"in le.ethereum&&typeof le.ethereum.request=="function")q=le.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 R!="object"||!B?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");q=R}const P=new URL((r=B?.url)!==null&&r!==void 0?r:window.location.href),W=await q.request({method:"eth_requestAccounts"}).then(le=>le).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!W||W.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const Y=nv(W[0]);let H=(l=B?.signInWithEthereum)===null||l===void 0?void 0:l.chainId;if(!H){const le=await q.request({method:"eth_chainId"});H=aj(le)}const Q={domain:P.host,address:Y,statement:D,uri:P.href,version:"1",chainId:H,nonce:(c=B?.signInWithEthereum)===null||c===void 0?void 0:c.nonce,issuedAt:(h=(d=B?.signInWithEthereum)===null||d===void 0?void 0:d.issuedAt)!==null&&h!==void 0?h:new Date,expirationTime:(m=B?.signInWithEthereum)===null||m===void 0?void 0:m.expirationTime,notBefore:(y=B?.signInWithEthereum)===null||y===void 0?void 0:y.notBefore,requestId:(p=B?.signInWithEthereum)===null||p===void 0?void 0:p.requestId,resources:(g=B?.signInWithEthereum)===null||g===void 0?void 0:g.resources};S=nj(Q),E=await q.request({method:"personal_sign",params:[sj(S),Y]})}try{const{data:j,error:R}=await pe(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:S,signature:E},!((w=a.options)===null||w===void 0)&&w.captchaToken?{gotrue_meta_security:{captcha_token:(_=a.options)===null||_===void 0?void 0:_.captchaToken}}:null),xform:fa});if(R)throw R;if(!j||!j.session||!j.user){const D=new yr;return this._returnResult({data:{user:null,session:null},error:D})}return j.session&&(await this._saveSession(j.session),await this._notifyAllSubscribers("SIGNED_IN",j.session)),this._returnResult({data:Object.assign({},j),error:R})}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,y,p,g,w,_,S;let E,j;if("message"in a)E=a.message,j=a.signature;else{const{chain:R,wallet:D,statement:B,options:q}=a;let P;if(Tt())if(typeof D=="object")P=D;else{const Y=window;if("solana"in Y&&typeof Y.solana=="object"&&("signIn"in Y.solana&&typeof Y.solana.signIn=="function"||"signMessage"in Y.solana&&typeof Y.solana.signMessage=="function"))P=Y.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 D!="object"||!q?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");P=D}const W=new URL((r=q?.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in P&&P.signIn){const Y=await P.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},q?.signInWithSolana),{version:"1",domain:W.host,uri:W.href}),B?{statement:B}:null));let H;if(Array.isArray(Y)&&Y[0]&&typeof Y[0]=="object")H=Y[0];else if(Y&&typeof Y=="object"&&"signedMessage"in Y&&"signature"in Y)H=Y;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in H&&"signature"in H&&(typeof H.signedMessage=="string"||H.signedMessage instanceof Uint8Array)&&H.signature instanceof Uint8Array)E=typeof H.signedMessage=="string"?H.signedMessage:new TextDecoder().decode(H.signedMessage),j=H.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in P)||typeof P.signMessage!="function"||!("publicKey"in P)||typeof P!="object"||!P.publicKey||!("toBase58"in P.publicKey)||typeof P.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");E=[`${W.host} wants you to sign in with your Solana account:`,P.publicKey.toBase58(),...B?["",B,""]:[""],"Version: 1",`URI: ${W.href}`,`Issued At: ${(c=(l=q?.signInWithSolana)===null||l===void 0?void 0:l.issuedAt)!==null&&c!==void 0?c:new Date().toISOString()}`,...!((d=q?.signInWithSolana)===null||d===void 0)&&d.notBefore?[`Not Before: ${q.signInWithSolana.notBefore}`]:[],...!((h=q?.signInWithSolana)===null||h===void 0)&&h.expirationTime?[`Expiration Time: ${q.signInWithSolana.expirationTime}`]:[],...!((m=q?.signInWithSolana)===null||m===void 0)&&m.chainId?[`Chain ID: ${q.signInWithSolana.chainId}`]:[],...!((y=q?.signInWithSolana)===null||y===void 0)&&y.nonce?[`Nonce: ${q.signInWithSolana.nonce}`]:[],...!((p=q?.signInWithSolana)===null||p===void 0)&&p.requestId?[`Request ID: ${q.signInWithSolana.requestId}`]:[],...!((w=(g=q?.signInWithSolana)===null||g===void 0?void 0:g.resources)===null||w===void 0)&&w.length?["Resources",...q.signInWithSolana.resources.map(H=>`- ${H}`)]:[]].join(`
51
+ `);const Y=await P.signMessage(new TextEncoder().encode(E),"utf8");if(!Y||!(Y instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");j=Y}}try{const{data:R,error:D}=await pe(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:E,signature:gn(j)},!((_=a.options)===null||_===void 0)&&_.captchaToken?{gotrue_meta_security:{captcha_token:(S=a.options)===null||S===void 0?void 0:S.captchaToken}}:null),xform:fa});if(D)throw D;if(!R||!R.session||!R.user){const B=new yr;return this._returnResult({data:{user:null,session:null},error:B})}return R.session&&(await this._saveSession(R.session),await this._notifyAllSubscribers("SIGNED_IN",R.session)),this._returnResult({data:Object.assign({},R),error:D})}catch(R){if(oe(R))return this._returnResult({data:{user:null,session:null},error:R});throw R}}async _exchangeCodeForSession(a){const r=await fn(this.storage,`${this.storageKey}-code-verifier`),[l,c]=(r??"").split("/");try{if(!l&&this.flowType==="pkce")throw new jS;const{data:d,error:h}=await pe(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:a,code_verifier:l},xform:fa});if(await Et(this.storage,`${this.storageKey}-code-verifier`),h)throw h;if(!d||!d.session||!d.user){const m=new yr;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 Et(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 pe(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:fa}),{data:y,error:p}=m;if(p)return this._returnResult({data:{user:null,session:null},error:p});if(!y||!y.session||!y.user){const g=new yr;return this._returnResult({data:{user:null,session:null},error:g})}return y.session&&(await this._saveSession(y.session),await this._notifyAllSubscribers("SIGNED_IN",y.session)),this._returnResult({data:y,error:p})}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:y}=a;let p=null,g=null;this.flowType==="pkce"&&([p,g]=await vr(this.storage,this.storageKey));const{error:w}=await pe(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:m,data:(r=y?.data)!==null&&r!==void 0?r:{},create_user:(l=y?.shouldCreateUser)!==null&&l!==void 0?l:!0,gotrue_meta_security:{captcha_token:y?.captchaToken},code_challenge:p,code_challenge_method:g},redirectTo:y?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:w})}if("phone"in a){const{phone:m,options:y}=a,{data:p,error:g}=await pe(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:m,data:(c=y?.data)!==null&&c!==void 0?c:{},create_user:(d=y?.shouldCreateUser)!==null&&d!==void 0?d:!0,gotrue_meta_security:{captcha_token:y?.captchaToken},channel:(h=y?.channel)!==null&&h!==void 0?h:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:p?.message_id},error:g})}throw new No("You must provide either an email or phone number.")}catch(m){if(await Et(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 pe(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},a),{gotrue_meta_security:{captcha_token:d}}),redirectTo:c,xform:fa});if(m)throw m;if(!h)throw new Error("An error occurred on token verification.");const y=h.session,p=h.user;return y?.access_token&&(await this._saveSession(y),await this._notifyAllSubscribers(a.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",y)),this._returnResult({data:{user:p,session:y},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,y=null;this.flowType==="pkce"&&([m,y]=await vr(this.storage,this.storageKey));const p=await pe(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:y}),headers:this.headers,xform:XS});return!((d=p.data)===null||d===void 0)&&d.url&&Tt()&&!(!((h=a.options)===null||h===void 0)&&h.skipBrowserRedirect)&&window.location.assign(p.data.url),this._returnResult(p)}catch(m){if(await Et(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 pe(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 pe(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 pe(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 No("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 fn(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()<Ed:!1;if(this._debug("#__loadSession()",`session has${l?"":" not"} expired`,"expires_at",a.expires_at),!l){if(this.userStorage){const h=await fn(this.userStorage,this.storageKey+"-user");h?.user?a.user=h.user:a.user=Cd()}if(this.storage.isServer&&a.user&&!a.user.__isUserNotAvailableProxy){const h={value:this.suppressGetSessionWarning};a.user=PS(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 pe(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:a,xform:Us}):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 pe(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:Us})})}catch(r){if(oe(r))return _S(r)&&(await this._removeSession(),await Et(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,y=null;this.flowType==="pkce"&&a.email!=null&&([m,y]=await vr(this.storage,this.storageKey));const{data:p,error:g}=await pe(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r?.emailRedirectTo,body:Object.assign(Object.assign({},a),{code_challenge:m,code_challenge_method:y}),jwt:h.access_token,xform:Us});if(g)throw g;return h.user=p.user,await this._saveSession(h),await this._notifyAllSubscribers("USER_UPDATED",h),this._returnResult({data:{user:h.user},error:null})})}catch(l){if(await Et(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}=Ad(a.access_token);if(h.exp&&(l=h.exp,c=l<=r),c){const{data:m,error:y}=await this._callRefreshToken(a.refresh_token);if(y)return this._returnResult({data:{user:null,session:null},error:y});if(!m)return{data:{user:null,session:null},error:null};d=m}else{const{data:m,error:y}=await this._getUser(a.access_token);if(y)throw y;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(!Tt())throw new Eo("No browser detected.");if(a.error||a.error_description||a.error_code)throw new Eo(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 Hg("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Eo("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 Hg("No code detected.");const{data:B,error:q}=await this._exchangeCodeForSession(a.code);if(q)throw q;const P=new URL(window.location.href);return P.searchParams.delete("code"),window.history.replaceState(window.history.state,"",P.toString()),{data:{session:B.session,redirectType:null},error:null}}const{provider_token:l,provider_refresh_token:c,access_token:d,refresh_token:h,expires_in:m,expires_at:y,token_type:p}=a;if(!d||!m||!h||!p)throw new Eo("No session defined in URL");const g=Math.round(Date.now()/1e3),w=parseInt(m);let _=g+w;y&&(_=parseInt(y));const S=_-g;S*1e3<=Er&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${S}s, should have been closer to ${w}s`);const E=_-w;g-E>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",E,_,g):g-E<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",E,_,g);const{data:j,error:R}=await this._getUser(d);if(R)throw R;const D={provider_token:l,provider_refresh_token:c,access_token:d,expires_in:w,expires_at:_,refresh_token:h,token_type:p,user:j.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:D,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 fn(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&&!(wS(m)&&(m.status===404||m.status===401||m.status===403)))return this._returnResult({error:m})}return a!=="others"&&(await this._removeSession(),await Et(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(a){const r=OS(),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 vr(this.storage,this.storageKey,!0));try{return await pe(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 Et(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,y,p,g;const{data:w,error:_}=d;if(_)throw _;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:(y=a.options)===null||y===void 0?void 0:y.queryParams,skipBrowserRedirect:!0});return await pe(this.fetch,"GET",S,{headers:this.headers,jwt:(g=(p=w.session)===null||p===void 0?void 0:p.access_token)!==null&&g!==void 0?g:void 0})});if(c)throw c;return Tt()&&!(!((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:y,access_token:p,nonce:g}=a,w=await pe(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:y,access_token:p,nonce:g,link_identity:!0,gotrue_meta_security:{captcha_token:h?.captchaToken}},xform:fa}),{data:_,error:S}=w;return S?this._returnResult({data:{user:null,session:null},error:S}):!_||!_.session||!_.user?this._returnResult({data:{user:null,session:null},error:new yr}):(_.session&&(await this._saveSession(_.session),await this._notifyAllSubscribers("USER_UPDATED",_.session)),this._returnResult({data:_,error:S}))}catch(c){if(await Et(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 pe(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 zS(async c=>(c>0&&await MS(200*Math.pow(2,c-1)),this._debug(r,"refreshing attempt",c),await pe(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:a},headers:this.headers,xform:fa})),(c,d)=>{const h=200*Math.pow(2,c);return d&&Td(d)&&Date.now()+h-l<Er})}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),Tt()&&!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 fn(this.storage,this.storageKey);if(c&&this.userStorage){let h=await fn(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!h&&(h={user:c.user},await Tr(this.userStorage,this.storageKey+"-user",h)),c.user=(a=h?.user)!==null&&a!==void 0?a:Cd()}else if(c&&!c.user&&!c.user){const h=await fn(this.storage,this.storageKey+"-user");h&&h?.user?(c.user=h.user,await Et(this.storage,this.storageKey+"-user"),await Tr(this.storage,this.storageKey,c)):c.user=Cd()}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()<Ed;if(this._debug(l,`session has${d?"":" not"} expired with margin of ${Ed}s`),d){if(this.autoRefreshToken&&c.refresh_token){const{error:h}=await this._callRefreshToken(c.refresh_token);h&&(console.error(h),Td(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 Yo;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 Td(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(y){d.push(y)}});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 Et(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 Tr(this.userStorage,this.storageKey+"-user",{user:r.user});const c=Object.assign({},r);delete c.user;const d=Kg(c);await Tr(this.storage,this.storageKey,d)}else{const c=Kg(r);await Tr(this.storage,this.storageKey,c)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Et(this.storage,this.storageKey),await Et(this.storage,this.storageKey+"-code-verifier"),await Et(this.storage,this.storageKey+"-user"),this.userStorage&&await Et(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const a=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{a&&Tt()&&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(),Er);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)/Er);this._debug("#_autoRefreshTokenTick()",`access token expires in ${c} ticks, a tick lasts ${Er}ms, refresh threshold is ${Zd} ticks`),c<=Zd&&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 sv)this._debug("auto refresh token tick lock not available");else throw a}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Tt()||!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 vr(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 pe(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:y,error:p}=await pe(this.fetch,"POST",`${this.url}/factors`,{body:m,headers:this.headers,jwt:(l=d?.session)===null||l===void 0?void 0:l.access_token});return p?this._returnResult({data:null,error:p}):(a.factorType==="totp"&&y.type==="totp"&&(!((c=y?.totp)===null||c===void 0)&&c.qr_code)&&(y.totp.qr_code=`data:image/svg+xml;utf-8,${y.totp.qr_code}`),this._returnResult({data:y,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"?dj(a.webauthn.credential_response):fj(a.webauthn.credential_response)})}:{code:a.code}),{data:m,error:y}=await pe(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 y?this._returnResult({data:null,error:y}):(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:y}))})}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 pe(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:cj(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:uj(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}=Ad(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(g=>g.status==="verified"))!==null&&r!==void 0?r:[]).length>0&&(m="aal2");const p=d.amr||[];return{data:{currentLevel:h,nextLevel:m,currentAuthenticationMethods:p},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 pe(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 pe(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&&Tt()&&!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 pe(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&&Tt()&&!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 pe(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 pe(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+bS>c)return l;const{data:d,error:h}=await pe(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:E}=await this.getSession();if(E||!S.session)return this._returnResult({data:null,error:E});l=S.session.access_token}const{header:c,payload:d,signature:h,raw:{header:m,payload:y}}=Ad(l);r?.allowExpired||VS(d.exp);const p=!c.alg||c.alg.startsWith("HS")||!c.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(c.kid,r?.keys?{keys:r.keys}:r?.jwks);if(!p){const{error:S}=await this.getUser(l);if(S)throw S;return{data:{claims:d,header:c,signature:h},error:null}}const g=IS(c.alg),w=await crypto.subtle.importKey("jwk",p,g,!0,["verify"]);if(!await crypto.subtle.verify(g,w,h,CS(`${m}.${y}`)))throw new ef("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}}}Qi.nextInstanceID={};const wj=Qi,_j="2.90.1";let Li="";typeof Deno<"u"?Li="deno":typeof document<"u"?Li="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Li="react-native":Li="node";const Sj={"X-Client-Info":`supabase-js-${Li}/${_j}`},jj={headers:Sj},Nj={schema:"public"},Ej={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},Tj={};function Zi(s){"@babel/helpers - typeof";return Zi=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},Zi(s)}function Aj(s,a){if(Zi(s)!="object"||!s)return s;var r=s[Symbol.toPrimitive];if(r!==void 0){var l=r.call(s,a);if(Zi(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(s)}function Cj(s){var a=Aj(s,"string");return Zi(a)=="symbol"?a:a+""}function kj(s,a,r){return(a=Cj(a))in s?Object.defineProperty(s,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):s[a]=r,s}function Wg(s,a){var r=Object.keys(s);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(s);a&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(s,c).enumerable})),r.push.apply(r,l)}return r}function et(s){for(var a=1;a<arguments.length;a++){var r=arguments[a]!=null?arguments[a]:{};a%2?Wg(Object(r),!0).forEach(function(l){kj(s,l,r[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(r)):Wg(Object(r)).forEach(function(l){Object.defineProperty(s,l,Object.getOwnPropertyDescriptor(r,l))})}return s}const Oj=s=>s?(...a)=>s(...a):(...a)=>fetch(...a),Rj=()=>Headers,Dj=(s,a,r)=>{const l=Oj(r),c=Rj();return async(d,h)=>{var m;const y=(m=await a())!==null&&m!==void 0?m:s;let p=new c(h?.headers);return p.has("apikey")||p.set("apikey",s),p.has("Authorization")||p.set("Authorization",`Bearer ${y}`),l(d,et(et({},h),{},{headers:p}))}};function Mj(s){return s.endsWith("/")?s:s+"/"}function zj(s,a){var r,l;const{db:c,auth:d,realtime:h,global:m}=s,{db:y,auth:p,realtime:g,global:w}=a,_={db:et(et({},y),c),auth:et(et({},p),d),realtime:et(et({},g),h),storage:{},global:et(et(et({},w),m),{},{headers:et(et({},(r=w?.headers)!==null&&r!==void 0?r:{}),(l=m?.headers)!==null&&l!==void 0?l:{})}),accessToken:async()=>""};return s.accessToken?_.accessToken=s.accessToken:delete _.accessToken,_}function Uj(s){const a=s?.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(Mj(a))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var Lj=class extends wj{constructor(s){super(s)}},Bj=class{constructor(s,a,r){var l,c;this.supabaseUrl=s,this.supabaseKey=a;const d=Uj(s);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:Nj,realtime:Tj,auth:et(et({},Ej),{},{storageKey:h}),global:jj},y=zj(r??{},m);if(this.storageKey=(l=y.auth.storageKey)!==null&&l!==void 0?l:"",this.headers=(c=y.global.headers)!==null&&c!==void 0?c:{},y.accessToken)this.accessToken=y.accessToken,this.auth=new Proxy({},{get:(g,w)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(w)} is not possible`)}});else{var p;this.auth=this._initSupabaseAuthClient((p=y.auth)!==null&&p!==void 0?p:{},this.headers,y.global.fetch)}this.fetch=Dj(a,this._getAccessToken.bind(this),y.global.fetch),this.realtime=this._initRealtimeClient(et({headers:this.headers,accessToken:this._getAccessToken.bind(this)},y.realtime)),this.accessToken&&this.accessToken().then(g=>this.realtime.setAuth(g)).catch(g=>console.warn("Failed to set initial Realtime auth token:",g)),this.rest=new y1(new URL("rest/v1",d).href,{headers:this.headers,schema:y.db.schema,fetch:this.fetch}),this.storage=new mS(this.storageUrl.href,this.headers,this.fetch,r?.storage),y.accessToken||this._listenForAuthEvents()}get functions(){return new f1(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(s){return this.rest.from(s)}schema(s){return this.rest.schema(s)}rpc(s,a={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(s,a,r)}channel(s,a={config:{}}){return this.realtime.channel(s,a)}getChannels(){return this.realtime.getChannels()}removeChannel(s){return this.realtime.removeChannel(s)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var s=this,a,r;if(s.accessToken)return await s.accessToken();const{data:l}=await s.auth.getSession();return(a=(r=l.session)===null||r===void 0?void 0:r.access_token)!==null&&a!==void 0?a:s.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:s,persistSession:a,detectSessionInUrl:r,storage:l,userStorage:c,storageKey:d,flowType:h,lock:m,debug:y,throwOnError:p},g,w){const _={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Lj({url:this.authUrl.href,headers:et(et({},_),g),storageKey:d,autoRefreshToken:s,persistSession:a,detectSessionInUrl:r,storage:l,userStorage:c,flowType:h,lock:m,debug:y,throwOnError:p,fetch:w,hasCustomAuthorizationHeader:Object.keys(this.headers).some(S=>S.toLowerCase()==="authorization")})}_initRealtimeClient(s){return new M1(this.realtimeUrl.href,et(et({},s),{},{params:et(et({},{apikey:this.supabaseKey}),s?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((s,a)=>{this._handleTokenChanged(s,"CLIENT",a?.access_token)})}_handleTokenChanged(s,a,r){(s==="TOKEN_REFRESHED"||s==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):s==="SIGNED_OUT"&&(this.realtime.setAuth(),a=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const ey=(s,a,r)=>new Bj(s,a,r);function qj(){if(typeof window<"u")return!1;const s=globalThis.process;if(!s)return!1;const a=s.version;if(a==null)return!1;const r=a.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=18:!1}qj()&&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 Jo="email_automator_supabase_config";function bn(){try{const s=localStorage.getItem(Jo);if(s)return JSON.parse(s)}catch(s){console.error("Error reading Supabase config:",s)}return null}function $j(s){try{localStorage.setItem(Jo,JSON.stringify(s))}catch(a){console.error("Error saving Supabase config:",a)}}function Hj(){try{localStorage.removeItem(Jo)}catch(s){console.error("Error clearing Supabase config:",s)}}async function iv(s,a){try{if(!s.startsWith("http://")&&!s.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(`${s}/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 Vj(){return localStorage.getItem(Jo)?"ui":"none"}function Ij(){const s=bn();return!s||!s.url?.startsWith("http")?(console.info("[Supabase] Setup required: Waiting for configuration..."),ey("https://placeholder.supabase.co","placeholder-key")):ey(s.url,s.anonKey,{auth:{persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!0}})}const ct=Ij();function ty(){const s=bn(),a=s?`${s.url}/functions/v1`:"",r=s?s.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 Gj{edgeFunctionsUrl;expressApiUrl;anonKey;token=null;supabaseClient=null;constructor(){const a=ty();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 p=await m.json().catch(()=>({})),g=typeof p.error=="string"?p.error:p.error?.message||`Request failed: ${m.status}`;return{error:{code:p.error?.code||"API_ERROR",message:g}}}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=ty(),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 retryEmail(a){return this.expressRequest(`/api/emails/${a}/retry`,{method:"POST"})}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 Me=new Gj;async function lv(s){Me.setSupabaseClient(s);const{data:{session:a}}=await s.auth.getSession();a?.access_token&&Me.setToken(a.access_token),s.auth.onAuthStateChange((r,l)=>{Me.setToken(l?.access_token||null)})}const Pj=Object.freeze(Object.defineProperty({__proto__:null,api:Me,initializeApi:lv},Symbol.toStringTag,{value:"Module"}));function Kj({userId:s,onInsert:a,onUpdate:r,onDelete:l,enabled:c=!0}){const[d,h]=x.useState(!1);return x.useEffect(()=>{if(!c||!s){h(!1);return}const m=ct.channel(`emails-realtime-${s}`).on("postgres_changes",{event:"*",schema:"public",table:"emails"},y=>{y.eventType==="INSERT"?a?.(y.new):y.eventType==="UPDATE"?r?.(y.new):y.eventType==="DELETE"&&l?.(y.old.id)}).subscribe(y=>{h(y==="SUBSCRIBED")});return()=>{ct.removeChannel(m)}},[s,c,a,r,l]),{isSubscribed:d}}class Yj{ctx=null;enabled=!1;constructor(){const a=localStorage.getItem("ea_sounds_enabled");this.enabled=a!=="false"}setEnabled(a){this.enabled=a,localStorage.setItem("ea_sounds_enabled",a?"true":"false")}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])}playStart(){if(!this.enabled)return;const a=this.initCtx(),r=a.createOscillator(),l=a.createGain();r.type="sine",r.frequency.setValueAtTime(440,a.currentTime),r.frequency.exponentialRampToValueAtTime(880,a.currentTime+.2),l.gain.setValueAtTime(0,a.currentTime),l.gain.linearRampToValueAtTime(.05,a.currentTime+.05),l.gain.exponentialRampToValueAtTime(.001,a.currentTime+.2),r.connect(l),l.connect(a.destination),r.start(),r.stop(a.currentTime+.2),this.haptic(10)}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 Ta=new Yj;let ja=[],tf=new Set;function af(){tf.forEach(s=>s())}const te={success:(s,a)=>To("success",s,a),error:(s,a)=>To("error",s,a),info:(s,a)=>To("info",s,a),warning:(s,a)=>To("warning",s,a)};function To(s,a,r=5e3){const l=ja.findIndex(d=>d.message===a&&d.type===s);if(l!==-1){const d=ja[l];ja=[...ja],ja[l]={...d,count:(d.count||1)+1,lastUpdated:Date.now()},af();return}const c=Math.random().toString(36).substr(2,9);ja=[...ja,{id:c,type:s,message:a,duration:r,count:1,lastUpdated:Date.now()}],af(),r>0&&setTimeout(()=>ov(c),r)}function ov(s){ja=ja.filter(a=>a.id!==s),af()}function Jj(){const[,s]=x.useState(0);return x.useEffect(()=>{const a=()=>s(r=>r+1);return tf.add(a),()=>{tf.delete(a)}},[]),ja}const Xj={success:Ii,error:zr,info:Dr,warning:Mr},Qj={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 Zj({toast:s}){const a=Xj[s.type];return o.jsxs("div",{className:Oe("flex items-start gap-3 p-4 rounded-lg border shadow-lg backdrop-blur-sm","animate-in slide-in-from-left-full duration-300",Qj[s.type]),children:[o.jsxs("div",{className:"relative",children:[o.jsx(a,{className:"w-5 h-5 flex-shrink-0 mt-0.5"}),s.count&&s.count>1&&o.jsx("span",{className:"absolute -top-2 -right-2 bg-primary text-primary-foreground text-[10px] font-bold px-1.5 rounded-full border border-background scale-90 animate-in zoom-in duration-200",children:s.count})]}),o.jsx("p",{className:"text-sm flex-1",children:s.message}),o.jsx("button",{onClick:()=>ov(s.id),className:"p-1 hover:bg-black/10 rounded transition-colors",children:o.jsx(al,{className:"w-4 h-4"})})]})}function Fj(){const s=Jj();return s.length===0?null:o.jsx("div",{className:"fixed bottom-4 left-4 z-50 flex flex-col-reverse gap-2 max-w-sm w-full",children:s.map(a=>o.jsx(Zj,{toast:a},a.id))})}function da(s,a){return s?typeof s=="string"?s:s.message||a:a}const cv={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:"created_at",sortOrder:"desc",activeCategory:null,activeSearch:""};function Wj(s,a){switch(a.type){case"SET_USER":return{...s,user:a.payload,isAuthenticated:!!a.payload,isLoading:!1};case"SET_LOADING":return{...s,isLoading:a.payload};case"SET_INITIALIZED":return{...s,isInitialized:a.payload};case"SET_ERROR":return{...s,error:a.payload,isLoading:!1};case"SET_EMAILS":return{...s,emails:a.payload.emails,emailsTotal:a.payload.total,emailsOffset:a.payload.offset,activeCategory:a.payload.category!==void 0?a.payload.category:s.activeCategory,activeSearch:a.payload.search!==void 0?a.payload.search:s.activeSearch,sortBy:a.payload.sortBy||s.sortBy,sortOrder:a.payload.sortOrder||s.sortOrder};case"ADD_EMAIL":{const r=a.payload,l=!s.activeCategory||r.category===s.activeCategory,c=!s.activeSearch||r.subject?.toLowerCase().includes(s.activeSearch.toLowerCase())||r.sender?.toLowerCase().includes(s.activeSearch.toLowerCase());return!l||!c?{...s,emailsTotal:s.emailsTotal+1}:{...s,emails:[r,...s.emails],emailsTotal:s.emailsTotal+1}}case"UPDATE_EMAIL":{const r=a.payload;if(s.emails.findIndex(h=>h.id===r.id)!==-1)return{...s,emails:s.emails.map(h=>h.id===r.id?r:h)};const c=!s.activeCategory||r.category===s.activeCategory,d=!s.activeSearch||r.subject?.toLowerCase().includes(s.activeSearch.toLowerCase())||r.sender?.toLowerCase().includes(s.activeSearch.toLowerCase());return c&&d?{...s,emails:[r,...s.emails]}:s}case"REMOVE_EMAIL":return{...s,emails:s.emails.filter(r=>r.id!==a.payload),emailsTotal:Math.max(0,s.emailsTotal-1)};case"SET_PROFILE":return{...s,profile:a.payload};case"UPDATE_PROFILE":return{...s,profile:a.payload};case"SET_ACCOUNTS":return{...s,accounts:a.payload};case"ADD_ACCOUNT":return{...s,accounts:[a.payload,...s.accounts]};case"REMOVE_ACCOUNT":return{...s,accounts:s.accounts.filter(r=>r.id!==a.payload)};case"SET_RULES":return{...s,rules:a.payload};case"ADD_RULE":return{...s,rules:[a.payload,...s.rules]};case"UPDATE_RULE":return{...s,rules:s.rules.map(r=>r.id===a.payload.id?a.payload:r)};case"REMOVE_RULE":return{...s,rules:s.rules.filter(r=>r.id!==a.payload)};case"SET_SETTINGS":return{...s,settings:a.payload};case"SET_STATS":return{...s,stats:a.payload};case"SET_SELECTED_EMAIL":return{...s,selectedEmailId:a.payload};case"CLEAR_DATA":return{...cv,isLoading:!1,isInitialized:!0};default:return s}}const uv=x.createContext(null);function eN({children:s}){const[a,r]=x.useReducer(Wj,cv),l=x.useCallback(async(p,g=3,w=500)=>{for(let _=1;_<=g;_++){const S=await Me.getEmail(p);if(S.data?.email)return S.data.email;_<g&&await new Promise(E=>setTimeout(E,w))}return null},[]),c=x.useCallback(async p=>{const g=await l(p.id);g&&(r({type:"ADD_EMAIL",payload:g}),g.processing_status==="completed"&&(g.ai_analysis?.priority==="High"?(Ta.playAlert(),te.success("High Priority Email Processed!")):(Ta.playNotify(),te.info("New email processed"))))},[r,l]),d=x.useCallback(async p=>{const g=await l(p.id);g&&(r({type:"UPDATE_EMAIL",payload:g}),g.processing_status==="completed"&&p.processing_status==="completed"&&(g.ai_analysis?.priority==="High"?(Ta.playAlert(),te.success("High Priority Email Processed!")):(Ta.playNotify(),te.info("Email analysis complete"))))},[r,l]),h=x.useCallback(p=>{r({type:"REMOVE_EMAIL",payload:p})},[r]),{isSubscribed:m}=Kj({userId:a.user?.id,onInsert:c,onUpdate:d,onDelete:h,enabled:a.isAuthenticated});x.useEffect(()=>{async function p(){if(!bn()){r({type:"SET_INITIALIZED",payload:!0});return}try{const{error:w}=await ct.from("init_state").select("count",{count:"exact",head:!0});if(w&&w.message==="Invalid API key"){console.error("[AppContext] Invalid API Key detected during init"),r({type:"SET_INITIALIZED",payload:!0});return}await lv(ct);const{data:{session:_}}=await ct.auth.getSession();r({type:"SET_USER",payload:_?.user||null}),r({type:"SET_INITIALIZED",payload:!0});const{data:{subscription:S}}=ct.auth.onAuthStateChange((E,j)=>{r({type:"SET_USER",payload:j?.user||null}),j||r({type:"CLEAR_DATA"})});return()=>S.unsubscribe()}catch(w){console.error("[AppContext] Init error:",w),r({type:"SET_ERROR",payload:"Failed to initialize"}),r({type:"SET_INITIALIZED",payload:!0})}}p()},[]);const y={fetchEmails:async(p={})=>{const g=await Me.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,category:p.category||null,search:p.search||"",sortBy:p.sortBy,sortOrder:p.sortOrder}})},fetchAccounts:async()=>{const p=await Me.getAccounts();p.data&&r({type:"SET_ACCOUNTS",payload:p.data.accounts})},fetchRules:async()=>{const p=await Me.getRules();p.data&&r({type:"SET_RULES",payload:p.data.rules})},fetchSettings:async()=>{const p=await Me.getSettings();p.data&&r({type:"SET_SETTINGS",payload:p.data.settings})},fetchProfile:async()=>{const p=await Me.getProfile();p.data&&r({type:"SET_PROFILE",payload:p.data})},fetchStats:async()=>{const p=await Me.getStats();p.data&&r({type:"SET_STATS",payload:p.data.stats})},executeAction:async(p,g,w)=>{const _=await Me.executeAction(p,g,w);if(_.data?.success){const S=a.emails.find(E=>E.id===p);return S&&r({type:"UPDATE_EMAIL",payload:{...S,action_taken:g}}),!0}return r({type:"SET_ERROR",payload:da(_.error,"Action failed")}),!1},triggerSync:async p=>{const g=p?await Me.triggerSync(p):await Me.syncAll();return await y.fetchAccounts(),g.error?(r({type:"SET_ERROR",payload:da(g.error,"Sync failed")}),!1):!0},disconnectAccount:async p=>{const g=await Me.disconnectAccount(p);return g.data?.success?(r({type:"REMOVE_ACCOUNT",payload:p}),!0):(r({type:"SET_ERROR",payload:da(g.error,"Failed to disconnect")}),!1)},updateSettings:async p=>{const g=await Me.updateSettings(p);return g.data?(r({type:"SET_SETTINGS",payload:g.data.settings}),!0):(r({type:"SET_ERROR",payload:da(g.error,"Failed to update settings")}),!1)},updateProfile:async p=>{const g=await Me.updateProfile(p);return g.data?(r({type:"UPDATE_PROFILE",payload:g.data}),!0):(r({type:"SET_ERROR",payload:da(g.error,"Failed to update profile")}),!1)},updateAccount:async(p,g)=>{const w=await Me.updateAccount(p,g);return w.data?(r({type:"SET_ACCOUNTS",payload:a.accounts.map(_=>_.id===p?{..._,...g}:_)}),!0):(r({type:"SET_ERROR",payload:da(w.error,"Failed to update account")}),!1)},retryProcessing:async p=>{const g=await Me.retryEmail(p);if(g.data?.success){const w=a.emails.find(_=>_.id===p);return w&&r({type:"UPDATE_EMAIL",payload:{...w,processing_status:"pending",processing_error:null}}),!0}return r({type:"SET_ERROR",payload:da(g.error,"Retry failed")}),!1},createRule:async p=>{const g=await Me.createRule(p);return g.data?(r({type:"ADD_RULE",payload:g.data.rule}),!0):(r({type:"SET_ERROR",payload:da(g.error,"Failed to create rule")}),!1)},updateRule:async(p,g)=>{const w=await Me.updateRule(p,g);return w.data?(r({type:"UPDATE_RULE",payload:w.data.rule}),!0):(r({type:"SET_ERROR",payload:da(w.error,"Failed to update rule")}),!1)},deleteRule:async p=>{const g=await Me.deleteRule(p);return g.data?.success?(r({type:"REMOVE_RULE",payload:p}),!0):(r({type:"SET_ERROR",payload:da(g.error,"Failed to delete rule")}),!1)},toggleRule:async p=>{const g=await Me.toggleRule(p);return g.data?(r({type:"UPDATE_RULE",payload:g.data.rule}),!0):(r({type:"SET_ERROR",payload:da(g.error,"Failed to toggle rule")}),!1)}};return o.jsx(uv.Provider,{value:{state:a,isSubscribed:m,dispatch:r,actions:y},children:s})}function qr(){const s=x.useContext(uv);if(!s)throw new Error("useApp must be used within AppProvider");return s}const tN=x.createContext(void 0);function ay({children:s,value:a}){return o.jsx(tN.Provider,{value:a,children:s})}const dv=x.createContext(null);function aN({children:s}){const[a,r]=x.useState(!1),l=()=>r(!0),c=()=>r(!1);return o.jsx(dv.Provider,{value:{isExpanded:a,setIsExpanded:r,openTerminal:l,closeTerminal:c},children:s})}function fv(){const s=x.useContext(dv);if(!s)throw new Error("useTerminal must be used within a TerminalProvider");return s}const At=x.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Oe("rounded-xl border bg-card text-card-foreground shadow",s),...a}));At.displayName="Card";const Aa=x.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Oe("flex flex-col space-y-1.5 p-6",s),...a}));Aa.displayName="CardHeader";const Ca=x.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Oe("font-semibold leading-none tracking-tight",s),...a}));Ca.displayName="CardTitle";const as=x.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Oe("text-sm text-muted-foreground",s),...a}));as.displayName="CardDescription";const ka=x.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Oe("p-6 pt-0",s),...a}));ka.displayName="CardContent";const hv=x.forwardRef(({className:s,...a},r)=>o.jsx("div",{ref:r,className:Oe("flex items-center p-6 pt-0",s),...a}));hv.displayName="CardFooter";class sN extends x.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(At,{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(Mr,{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(qs,{className:"w-4 h-4 mr-2"}),"Try Again"]}),o.jsx(Z,{onClick:()=>window.location.reload(),children:"Refresh Page"})]})]})}):this.props.children}}function mt({size:s="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:Oe("flex flex-col items-center justify-center gap-3",a),children:[o.jsx($t,{className:Oe("animate-spin text-primary",l[s])}),r&&o.jsx("p",{className:"text-sm text-muted-foreground",children:r})]})}function $i({text:s="Loading..."}){return o.jsx("div",{className:"min-h-screen flex items-center justify-center",children:o.jsx(mt,{size:"lg",text:s})})}function nN(){return o.jsx("div",{className:"p-12 flex items-center justify-center",children:o.jsx(mt,{size:"md"})})}function Bs(s,a,{checkForDefaultPrevented:r=!0}={}){return function(c){if(s?.(c),r===!1||!c.defaultPrevented)return a?.(c)}}function rN(s,a){const r=x.createContext(a),l=d=>{const{children:h,...m}=d,y=x.useMemo(()=>m,Object.values(m));return o.jsx(r.Provider,{value:y,children:h})};l.displayName=s+"Provider";function c(d){const h=x.useContext(r);if(h)return h;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${s}\``)}return[l,c]}function iN(s,a=[]){let r=[];function l(d,h){const m=x.createContext(h),y=r.length;r=[...r,h];const p=w=>{const{scope:_,children:S,...E}=w,j=_?.[s]?.[y]||m,R=x.useMemo(()=>E,Object.values(E));return o.jsx(j.Provider,{value:R,children:S})};p.displayName=d+"Provider";function g(w,_){const S=_?.[s]?.[y]||m,E=x.useContext(S);if(E)return E;if(h!==void 0)return h;throw new Error(`\`${w}\` must be used within \`${d}\``)}return[p,g]}const c=()=>{const d=r.map(h=>x.createContext(h));return function(m){const y=m?.[s]||d;return x.useMemo(()=>({[`__scope${s}`]:{...m,[s]:y}}),[m,y])}};return c.scopeName=s,[l,lN(c,...a)]}function lN(...s){const a=s[0];if(s.length===1)return a;const r=()=>{const l=s.map(c=>({useScope:c(),scopeName:c.scopeName}));return function(d){const h=l.reduce((m,{useScope:y,scopeName:p})=>{const w=y(d)[`__scope${p}`];return{...m,...w}},{});return x.useMemo(()=>({[`__scope${a.scopeName}`]:h}),[h])}};return r.scopeName=a.scopeName,r}var Fi=globalThis?.document?x.useLayoutEffect:()=>{},oN=cf[" useId ".trim().toString()]||(()=>{}),cN=0;function Od(s){const[a,r]=x.useState(oN());return Fi(()=>{r(l=>l??String(cN++))},[s]),s||(a?`radix-${a}`:"")}var uN=cf[" useInsertionEffect ".trim().toString()]||Fi;function dN({prop:s,defaultProp:a,onChange:r=()=>{},caller:l}){const[c,d,h]=fN({defaultProp:a,onChange:r}),m=s!==void 0,y=m?s:c;{const g=x.useRef(s!==void 0);x.useEffect(()=>{const w=g.current;w!==m&&console.warn(`${l} is changing from ${w?"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.`),g.current=m},[m,l])}const p=x.useCallback(g=>{if(m){const w=hN(g)?g(s):g;w!==s&&h.current?.(w)}else d(g)},[m,s,d,h]);return[y,p]}function fN({defaultProp:s,onChange:a}){const[r,l]=x.useState(s),c=x.useRef(r),d=x.useRef(a);return uN(()=>{d.current=a},[a]),x.useEffect(()=>{c.current!==r&&(d.current?.(r),c.current=r)},[r,c]),[r,l,d]}function hN(s){return typeof s=="function"}var mv=by();const mN=lf(mv);function pN(s){const a=gN(s),r=x.forwardRef((l,c)=>{const{children:d,...h}=l,m=x.Children.toArray(d),y=m.find(vN);if(y){const p=y.props.children,g=m.map(w=>w===y?x.Children.count(p)>1?x.Children.only(null):x.isValidElement(p)?p.props.children:null:w);return o.jsx(a,{...h,ref:c,children:x.isValidElement(p)?x.cloneElement(p,void 0,g):null})}return o.jsx(a,{...h,ref:c,children:d})});return r.displayName=`${s}.Slot`,r}function gN(s){const a=x.forwardRef((r,l)=>{const{children:c,...d}=r;if(x.isValidElement(c)){const h=xN(c),m=bN(d,c.props);return c.type!==x.Fragment&&(m.ref=l?Po(l,h):h),x.cloneElement(c,m)}return x.Children.count(c)>1?x.Children.only(null):null});return a.displayName=`${s}.SlotClone`,a}var yN=Symbol("radix.slottable");function vN(s){return x.isValidElement(s)&&typeof s.type=="function"&&"__radixId"in s.type&&s.type.__radixId===yN}function bN(s,a){const r={...a};for(const l in a){const c=s[l],d=a[l];/^on[A-Z]/.test(l)?c&&d?r[l]=(...m)=>{const y=d(...m);return c(...m),y}:c&&(r[l]=c):l==="style"?r[l]={...c,...d}:l==="className"&&(r[l]=[c,d].filter(Boolean).join(" "))}return{...s,...r}}function xN(s){let a=Object.getOwnPropertyDescriptor(s.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?s.ref:(a=Object.getOwnPropertyDescriptor(s,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?s.props.ref:s.props.ref||s.ref)}var wN=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ns=wN.reduce((s,a)=>{const r=pN(`Primitive.${a}`),l=x.forwardRef((c,d)=>{const{asChild:h,...m}=c,y=h?r:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(y,{...m,ref:d})});return l.displayName=`Primitive.${a}`,{...s,[a]:l}},{});function _N(s,a){s&&mv.flushSync(()=>s.dispatchEvent(a))}function Wi(s){const a=x.useRef(s);return x.useEffect(()=>{a.current=s}),x.useMemo(()=>(...r)=>a.current?.(...r),[])}function SN(s,a=globalThis?.document){const r=Wi(s);x.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 jN="DismissableLayer",sf="dismissableLayer.update",NN="dismissableLayer.pointerDownOutside",EN="dismissableLayer.focusOutside",sy,pv=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),gv=x.forwardRef((s,a)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:h,onDismiss:m,...y}=s,p=x.useContext(pv),[g,w]=x.useState(null),_=g?.ownerDocument??globalThis?.document,[,S]=x.useState({}),E=wn(a,H=>w(H)),j=Array.from(p.layers),[R]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),D=j.indexOf(R),B=g?j.indexOf(g):-1,q=p.layersWithOutsidePointerEventsDisabled.size>0,P=B>=D,W=CN(H=>{const Q=H.target,le=[...p.branches].some(qe=>qe.contains(Q));!P||le||(c?.(H),h?.(H),H.defaultPrevented||m?.())},_),Y=kN(H=>{const Q=H.target;[...p.branches].some(qe=>qe.contains(Q))||(d?.(H),h?.(H),H.defaultPrevented||m?.())},_);return SN(H=>{B===p.layers.size-1&&(l?.(H),!H.defaultPrevented&&m&&(H.preventDefault(),m()))},_),x.useEffect(()=>{if(g)return r&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(sy=_.body.style.pointerEvents,_.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(g)),p.layers.add(g),ny(),()=>{r&&p.layersWithOutsidePointerEventsDisabled.size===1&&(_.body.style.pointerEvents=sy)}},[g,_,r,p]),x.useEffect(()=>()=>{g&&(p.layers.delete(g),p.layersWithOutsidePointerEventsDisabled.delete(g),ny())},[g,p]),x.useEffect(()=>{const H=()=>S({});return document.addEventListener(sf,H),()=>document.removeEventListener(sf,H)},[]),o.jsx(ns.div,{...y,ref:E,style:{pointerEvents:q?P?"auto":"none":void 0,...s.style},onFocusCapture:Bs(s.onFocusCapture,Y.onFocusCapture),onBlurCapture:Bs(s.onBlurCapture,Y.onBlurCapture),onPointerDownCapture:Bs(s.onPointerDownCapture,W.onPointerDownCapture)})});gv.displayName=jN;var TN="DismissableLayerBranch",AN=x.forwardRef((s,a)=>{const r=x.useContext(pv),l=x.useRef(null),c=wn(a,l);return x.useEffect(()=>{const d=l.current;if(d)return r.branches.add(d),()=>{r.branches.delete(d)}},[r.branches]),o.jsx(ns.div,{...s,ref:c})});AN.displayName=TN;function CN(s,a=globalThis?.document){const r=Wi(s),l=x.useRef(!1),c=x.useRef(()=>{});return x.useEffect(()=>{const d=m=>{if(m.target&&!l.current){let y=function(){yv(NN,r,p,{discrete:!0})};const p={originalEvent:m};m.pointerType==="touch"?(a.removeEventListener("click",c.current),c.current=y,a.addEventListener("click",c.current,{once:!0})):y()}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 kN(s,a=globalThis?.document){const r=Wi(s),l=x.useRef(!1);return x.useEffect(()=>{const c=d=>{d.target&&!l.current&&yv(EN,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 ny(){const s=new CustomEvent(sf);document.dispatchEvent(s)}function yv(s,a,r,{discrete:l}){const c=r.originalEvent.target,d=new CustomEvent(s,{bubbles:!1,cancelable:!0,detail:r});a&&c.addEventListener(s,a,{once:!0}),l?_N(c,d):c.dispatchEvent(d)}var Rd="focusScope.autoFocusOnMount",Dd="focusScope.autoFocusOnUnmount",ry={bubbles:!1,cancelable:!0},ON="FocusScope",vv=x.forwardRef((s,a)=>{const{loop:r=!1,trapped:l=!1,onMountAutoFocus:c,onUnmountAutoFocus:d,...h}=s,[m,y]=x.useState(null),p=Wi(c),g=Wi(d),w=x.useRef(null),_=wn(a,j=>y(j)),S=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(l){let j=function(q){if(S.paused||!m)return;const P=q.target;m.contains(P)?w.current=P:Ms(w.current,{select:!0})},R=function(q){if(S.paused||!m)return;const P=q.relatedTarget;P!==null&&(m.contains(P)||Ms(w.current,{select:!0}))},D=function(q){if(document.activeElement===document.body)for(const W of q)W.removedNodes.length>0&&Ms(m)};document.addEventListener("focusin",j),document.addEventListener("focusout",R);const B=new MutationObserver(D);return m&&B.observe(m,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",j),document.removeEventListener("focusout",R),B.disconnect()}}},[l,m,S.paused]),x.useEffect(()=>{if(m){ly.add(S);const j=document.activeElement;if(!m.contains(j)){const D=new CustomEvent(Rd,ry);m.addEventListener(Rd,p),m.dispatchEvent(D),D.defaultPrevented||(RN(LN(bv(m)),{select:!0}),document.activeElement===j&&Ms(m))}return()=>{m.removeEventListener(Rd,p),setTimeout(()=>{const D=new CustomEvent(Dd,ry);m.addEventListener(Dd,g),m.dispatchEvent(D),D.defaultPrevented||Ms(j??document.body,{select:!0}),m.removeEventListener(Dd,g),ly.remove(S)},0)}}},[m,p,g,S]);const E=x.useCallback(j=>{if(!r&&!l||S.paused)return;const R=j.key==="Tab"&&!j.altKey&&!j.ctrlKey&&!j.metaKey,D=document.activeElement;if(R&&D){const B=j.currentTarget,[q,P]=DN(B);q&&P?!j.shiftKey&&D===P?(j.preventDefault(),r&&Ms(q,{select:!0})):j.shiftKey&&D===q&&(j.preventDefault(),r&&Ms(P,{select:!0})):D===B&&j.preventDefault()}},[r,l,S.paused]);return o.jsx(ns.div,{tabIndex:-1,...h,ref:_,onKeyDown:E})});vv.displayName=ON;function RN(s,{select:a=!1}={}){const r=document.activeElement;for(const l of s)if(Ms(l,{select:a}),document.activeElement!==r)return}function DN(s){const a=bv(s),r=iy(a,s),l=iy(a.reverse(),s);return[r,l]}function bv(s){const a=[],r=document.createTreeWalker(s,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 iy(s,a){for(const r of s)if(!MN(r,{upTo:a}))return r}function MN(s,{upTo:a}){if(getComputedStyle(s).visibility==="hidden")return!0;for(;s;){if(a!==void 0&&s===a)return!1;if(getComputedStyle(s).display==="none")return!0;s=s.parentElement}return!1}function zN(s){return s instanceof HTMLInputElement&&"select"in s}function Ms(s,{select:a=!1}={}){if(s&&s.focus){const r=document.activeElement;s.focus({preventScroll:!0}),s!==r&&zN(s)&&a&&s.select()}}var ly=UN();function UN(){let s=[];return{add(a){const r=s[0];a!==r&&r?.pause(),s=oy(s,a),s.unshift(a)},remove(a){s=oy(s,a),s[0]?.resume()}}}function oy(s,a){const r=[...s],l=r.indexOf(a);return l!==-1&&r.splice(l,1),r}function LN(s){return s.filter(a=>a.tagName!=="A")}var BN="Portal",xv=x.forwardRef((s,a)=>{const{container:r,...l}=s,[c,d]=x.useState(!1);Fi(()=>d(!0),[]);const h=r||c&&globalThis?.document?.body;return h?mN.createPortal(o.jsx(ns.div,{...l,ref:a}),h):null});xv.displayName=BN;function qN(s,a){return x.useReducer((r,l)=>a[r][l]??r,s)}var Xo=s=>{const{present:a,children:r}=s,l=$N(a),c=typeof r=="function"?r({present:l.isPresent}):x.Children.only(r),d=wn(l.ref,HN(c));return typeof r=="function"||l.isPresent?x.cloneElement(c,{ref:d}):null};Xo.displayName="Presence";function $N(s){const[a,r]=x.useState(),l=x.useRef(null),c=x.useRef(s),d=x.useRef("none"),h=s?"mounted":"unmounted",[m,y]=qN(h,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const p=Ao(l.current);d.current=m==="mounted"?p:"none"},[m]),Fi(()=>{const p=l.current,g=c.current;if(g!==s){const _=d.current,S=Ao(p);s?y("MOUNT"):S==="none"||p?.display==="none"?y("UNMOUNT"):y(g&&_!==S?"ANIMATION_OUT":"UNMOUNT"),c.current=s}},[s,y]),Fi(()=>{if(a){let p;const g=a.ownerDocument.defaultView??window,w=S=>{const j=Ao(l.current).includes(CSS.escape(S.animationName));if(S.target===a&&j&&(y("ANIMATION_END"),!c.current)){const R=a.style.animationFillMode;a.style.animationFillMode="forwards",p=g.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=R)})}},_=S=>{S.target===a&&(d.current=Ao(l.current))};return a.addEventListener("animationstart",_),a.addEventListener("animationcancel",w),a.addEventListener("animationend",w),()=>{g.clearTimeout(p),a.removeEventListener("animationstart",_),a.removeEventListener("animationcancel",w),a.removeEventListener("animationend",w)}}else y("ANIMATION_END")},[a,y]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:x.useCallback(p=>{l.current=p?getComputedStyle(p):null,r(p)},[])}}function Ao(s){return s?.animationName||"none"}function HN(s){let a=Object.getOwnPropertyDescriptor(s.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?s.ref:(a=Object.getOwnPropertyDescriptor(s,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?s.props.ref:s.props.ref||s.ref)}var Md=0;function VN(){x.useEffect(()=>{const s=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",s[0]??cy()),document.body.insertAdjacentElement("beforeend",s[1]??cy()),Md++,()=>{Md===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(a=>a.remove()),Md--}},[])}function cy(){const s=document.createElement("span");return s.setAttribute("data-radix-focus-guard",""),s.tabIndex=0,s.style.outline="none",s.style.opacity="0",s.style.position="fixed",s.style.pointerEvents="none",s}var zo="right-scroll-bar-position",Uo="width-before-scroll-bar",IN="with-scroll-bars-hidden",GN="--removed-body-scroll-bar-size";function zd(s,a){return typeof s=="function"?s(a):s&&(s.current=a),s}function PN(s,a){var r=x.useState(function(){return{value:s,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 KN=typeof window<"u"?x.useLayoutEffect:x.useEffect,uy=new WeakMap;function YN(s,a){var r=PN(null,function(l){return s.forEach(function(c){return zd(c,l)})});return KN(function(){var l=uy.get(r);if(l){var c=new Set(l),d=new Set(s),h=r.current;c.forEach(function(m){d.has(m)||zd(m,null)}),d.forEach(function(m){c.has(m)||zd(m,h)})}uy.set(r,s)},[s]),r}function JN(s){return s}function XN(s,a){a===void 0&&(a=JN);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]:s},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 y=function(){var g=h;h=[],g.forEach(d)},p=function(){return Promise.resolve().then(y)};p(),r={push:function(g){h.push(g),p()},filter:function(g){return h=h.filter(g),r}}}};return c}function QN(s){s===void 0&&(s={});var a=XN(null);return a.options=Ea({async:!0,ssr:!1},s),a}var wv=function(s){var a=s.sideCar,r=Br(s,["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 x.createElement(l,Ea({},r))};wv.isSideCarExport=!0;function ZN(s,a){return s.useMedium(a),wv}var _v=QN(),Ud=function(){},Qo=x.forwardRef(function(s,a){var r=x.useRef(null),l=x.useState({onScrollCapture:Ud,onWheelCapture:Ud,onTouchMoveCapture:Ud}),c=l[0],d=l[1],h=s.forwardProps,m=s.children,y=s.className,p=s.removeScrollBar,g=s.enabled,w=s.shards,_=s.sideCar,S=s.noRelative,E=s.noIsolation,j=s.inert,R=s.allowPinchZoom,D=s.as,B=D===void 0?"div":D,q=s.gapMode,P=Br(s,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),W=_,Y=YN([r,a]),H=Ea(Ea({},P),c);return x.createElement(x.Fragment,null,g&&x.createElement(W,{sideCar:_v,removeScrollBar:p,shards:w,noRelative:S,noIsolation:E,inert:j,setCallbacks:d,allowPinchZoom:!!R,lockRef:r,gapMode:q}),h?x.cloneElement(x.Children.only(m),Ea(Ea({},H),{ref:Y})):x.createElement(B,Ea({},H,{className:y,ref:Y}),m))});Qo.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Qo.classNames={fullWidth:Uo,zeroRight:zo};var FN=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function WN(){if(!document)return null;var s=document.createElement("style");s.type="text/css";var a=FN();return a&&s.setAttribute("nonce",a),s}function eE(s,a){s.styleSheet?s.styleSheet.cssText=a:s.appendChild(document.createTextNode(a))}function tE(s){var a=document.head||document.getElementsByTagName("head")[0];a.appendChild(s)}var aE=function(){var s=0,a=null;return{add:function(r){s==0&&(a=WN())&&(eE(a,r),tE(a)),s++},remove:function(){s--,!s&&a&&(a.parentNode&&a.parentNode.removeChild(a),a=null)}}},sE=function(){var s=aE();return function(a,r){x.useEffect(function(){return s.add(a),function(){s.remove()}},[a&&r])}},Sv=function(){var s=sE(),a=function(r){var l=r.styles,c=r.dynamic;return s(l,c),null};return a},nE={left:0,top:0,right:0,gap:0},Ld=function(s){return parseInt(s||"",10)||0},rE=function(s){var a=window.getComputedStyle(document.body),r=a[s==="padding"?"paddingLeft":"marginLeft"],l=a[s==="padding"?"paddingTop":"marginTop"],c=a[s==="padding"?"paddingRight":"marginRight"];return[Ld(r),Ld(l),Ld(c)]},iE=function(s){if(s===void 0&&(s="margin"),typeof window>"u")return nE;var a=rE(s),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])}},lE=Sv(),Or="data-scroll-locked",oE=function(s,a,r,l){var c=s.left,d=s.top,h=s.right,m=s.gap;return r===void 0&&(r="margin"),`
52
+ .`.concat(IN,` {
53
53
  overflow: hidden `).concat(l,`;
54
54
  padding-right: `).concat(m,"px ").concat(l,`;
55
55
  }
56
- body[`).concat(kr,`] {
56
+ body[`).concat(Or,`] {
57
57
  overflow: hidden `).concat(l,`;
58
58
  overscroll-behavior: contain;
59
59
  `).concat([a&&"position: relative ".concat(l,";"),r==="margin"&&`
@@ -66,32 +66,32 @@ ${D}`}class ot extends Error{constructor({message:a,code:r,cause:l,name:c}){var
66
66
  `),r==="padding"&&"padding-right: ".concat(m,"px ").concat(l,";")].filter(Boolean).join(""),`
67
67
  }
68
68
 
69
- .`).concat(Mo,` {
69
+ .`).concat(zo,` {
70
70
  right: `).concat(m,"px ").concat(l,`;
71
71
  }
72
72
 
73
- .`).concat(zo,` {
73
+ .`).concat(Uo,` {
74
74
  margin-right: `).concat(m,"px ").concat(l,`;
75
75
  }
76
76
 
77
- .`).concat(Mo," .").concat(Mo,` {
77
+ .`).concat(zo," .").concat(zo,` {
78
78
  right: 0 `).concat(l,`;
79
79
  }
80
80
 
81
- .`).concat(zo," .").concat(zo,` {
81
+ .`).concat(Uo," .").concat(Uo,` {
82
82
  margin-right: 0 `).concat(l,`;
83
83
  }
84
84
 
85
- body[`).concat(kr,`] {
86
- `).concat(IN,": ").concat(m,`px;
85
+ body[`).concat(Or,`] {
86
+ `).concat(GN,": ").concat(m,`px;
87
87
  }
88
- `)},cy=function(){var s=parseInt(document.body.getAttribute(kr)||"0",10);return isFinite(s)?s:0},oE=function(){x.useEffect(function(){return document.body.setAttribute(kr,(cy()+1).toString()),function(){var s=cy()-1;s<=0?document.body.removeAttribute(kr):document.body.setAttribute(kr,s.toString())}},[])},cE=function(s){var a=s.noRelative,r=s.noImportant,l=s.gapMode,c=l===void 0?"margin":l;oE();var d=x.useMemo(function(){return rE(c)},[c]);return x.createElement(iE,{styles:lE(d,!a,c,r?"":"!important")})},sf=!1;if(typeof window<"u")try{var Ao=Object.defineProperty({},"passive",{get:function(){return sf=!0,!0}});window.addEventListener("test",Ao,Ao),window.removeEventListener("test",Ao,Ao)}catch{sf=!1}var wr=sf?{passive:!1}:!1,uE=function(s){return s.tagName==="TEXTAREA"},wv=function(s,a){if(!(s instanceof Element))return!1;var r=window.getComputedStyle(s);return r[a]!=="hidden"&&!(r.overflowY===r.overflowX&&!uE(s)&&r[a]==="visible")},dE=function(s){return wv(s,"overflowY")},fE=function(s){return wv(s,"overflowX")},uy=function(s,a){var r=a.ownerDocument,l=a;do{typeof ShadowRoot<"u"&&l instanceof ShadowRoot&&(l=l.host);var c=_v(s,l);if(c){var d=Sv(s,l),h=d[1],m=d[2];if(h>m)return!0}l=l.parentNode}while(l&&l!==r.body);return!1},hE=function(s){var a=s.scrollTop,r=s.scrollHeight,l=s.clientHeight;return[a,r,l]},mE=function(s){var a=s.scrollLeft,r=s.scrollWidth,l=s.clientWidth;return[a,r,l]},_v=function(s,a){return s==="v"?dE(a):fE(a)},Sv=function(s,a){return s==="v"?hE(a):mE(a)},pE=function(s,a){return s==="h"&&a==="rtl"?-1:1},gE=function(s,a,r,l,c){var d=pE(s,window.getComputedStyle(a).direction),h=d*l,m=r.target,y=a.contains(m),p=!1,g=h>0,w=0,_=0;do{if(!m)break;var S=Sv(s,m),E=S[0],j=S[1],R=S[2],D=j-R-d*E;(E||D)&&_v(s,m)&&(w+=D,_+=E);var B=m.parentNode;m=B&&B.nodeType===Node.DOCUMENT_FRAGMENT_NODE?B.host:B}while(!y&&m!==document.body||y&&(a.contains(m)||a===m));return(g&&Math.abs(w)<1||!g&&Math.abs(_)<1)&&(p=!0),p},Co=function(s){return"changedTouches"in s?[s.changedTouches[0].clientX,s.changedTouches[0].clientY]:[0,0]},dy=function(s){return[s.deltaX,s.deltaY]},fy=function(s){return s&&"current"in s?s.current:s},yE=function(s,a){return s[0]===a[0]&&s[1]===a[1]},vE=function(s){return`
88
+ `)},dy=function(){var s=parseInt(document.body.getAttribute(Or)||"0",10);return isFinite(s)?s:0},cE=function(){x.useEffect(function(){return document.body.setAttribute(Or,(dy()+1).toString()),function(){var s=dy()-1;s<=0?document.body.removeAttribute(Or):document.body.setAttribute(Or,s.toString())}},[])},uE=function(s){var a=s.noRelative,r=s.noImportant,l=s.gapMode,c=l===void 0?"margin":l;cE();var d=x.useMemo(function(){return iE(c)},[c]);return x.createElement(lE,{styles:oE(d,!a,c,r?"":"!important")})},nf=!1;if(typeof window<"u")try{var Co=Object.defineProperty({},"passive",{get:function(){return nf=!0,!0}});window.addEventListener("test",Co,Co),window.removeEventListener("test",Co,Co)}catch{nf=!1}var _r=nf?{passive:!1}:!1,dE=function(s){return s.tagName==="TEXTAREA"},jv=function(s,a){if(!(s instanceof Element))return!1;var r=window.getComputedStyle(s);return r[a]!=="hidden"&&!(r.overflowY===r.overflowX&&!dE(s)&&r[a]==="visible")},fE=function(s){return jv(s,"overflowY")},hE=function(s){return jv(s,"overflowX")},fy=function(s,a){var r=a.ownerDocument,l=a;do{typeof ShadowRoot<"u"&&l instanceof ShadowRoot&&(l=l.host);var c=Nv(s,l);if(c){var d=Ev(s,l),h=d[1],m=d[2];if(h>m)return!0}l=l.parentNode}while(l&&l!==r.body);return!1},mE=function(s){var a=s.scrollTop,r=s.scrollHeight,l=s.clientHeight;return[a,r,l]},pE=function(s){var a=s.scrollLeft,r=s.scrollWidth,l=s.clientWidth;return[a,r,l]},Nv=function(s,a){return s==="v"?fE(a):hE(a)},Ev=function(s,a){return s==="v"?mE(a):pE(a)},gE=function(s,a){return s==="h"&&a==="rtl"?-1:1},yE=function(s,a,r,l,c){var d=gE(s,window.getComputedStyle(a).direction),h=d*l,m=r.target,y=a.contains(m),p=!1,g=h>0,w=0,_=0;do{if(!m)break;var S=Ev(s,m),E=S[0],j=S[1],R=S[2],D=j-R-d*E;(E||D)&&Nv(s,m)&&(w+=D,_+=E);var B=m.parentNode;m=B&&B.nodeType===Node.DOCUMENT_FRAGMENT_NODE?B.host:B}while(!y&&m!==document.body||y&&(a.contains(m)||a===m));return(g&&Math.abs(w)<1||!g&&Math.abs(_)<1)&&(p=!0),p},ko=function(s){return"changedTouches"in s?[s.changedTouches[0].clientX,s.changedTouches[0].clientY]:[0,0]},hy=function(s){return[s.deltaX,s.deltaY]},my=function(s){return s&&"current"in s?s.current:s},vE=function(s,a){return s[0]===a[0]&&s[1]===a[1]},bE=function(s){return`
89
89
  .block-interactivity-`.concat(s,` {pointer-events: none;}
90
90
  .allow-interactivity-`).concat(s,` {pointer-events: all;}
91
- `)},bE=0,_r=[];function xE(s){var a=x.useRef([]),r=x.useRef([0,0]),l=x.useRef(),c=x.useState(bE++)[0],d=x.useState(xv)[0],h=x.useRef(s);x.useEffect(function(){h.current=s},[s]),x.useEffect(function(){if(s.inert){document.body.classList.add("block-interactivity-".concat(c));var j=l1([s.lockRef.current],(s.shards||[]).map(fy),!0).filter(Boolean);return j.forEach(function(R){return R.classList.add("allow-interactivity-".concat(c))}),function(){document.body.classList.remove("block-interactivity-".concat(c)),j.forEach(function(R){return R.classList.remove("allow-interactivity-".concat(c))})}}},[s.inert,s.lockRef.current,s.shards]);var m=x.useCallback(function(j,R){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!h.current.allowPinchZoom;var D=Co(j),B=r.current,q="deltaX"in j?j.deltaX:B[0]-D[0],P="deltaY"in j?j.deltaY:B[1]-D[1],W,Y=j.target,I=Math.abs(q)>Math.abs(P)?"h":"v";if("touches"in j&&I==="h"&&Y.type==="range")return!1;var X=window.getSelection(),oe=X&&X.anchorNode,Ue=oe?oe===Y||oe.contains(Y):!1;if(Ue)return!1;var ge=uy(I,Y);if(!ge)return!0;if(ge?W=I:(W=I==="v"?"h":"v",ge=uy(I,Y)),!ge)return!1;if(!l.current&&"changedTouches"in j&&(q||P)&&(l.current=W),!W)return!0;var pe=l.current||W;return gE(pe,R,j,pe==="h"?q:P)},[]),y=x.useCallback(function(j){var R=j;if(!(!_r.length||_r[_r.length-1]!==d)){var D="deltaY"in R?dy(R):Co(R),B=a.current.filter(function(W){return W.name===R.type&&(W.target===R.target||R.target===W.shadowParent)&&yE(W.delta,D)})[0];if(B&&B.should){R.cancelable&&R.preventDefault();return}if(!B){var q=(h.current.shards||[]).map(fy).filter(Boolean).filter(function(W){return W.contains(R.target)}),P=q.length>0?m(R,q[0]):!h.current.noIsolation;P&&R.cancelable&&R.preventDefault()}}},[]),p=x.useCallback(function(j,R,D,B){var q={name:j,delta:R,target:D,should:B,shadowParent:wE(D)};a.current.push(q),setTimeout(function(){a.current=a.current.filter(function(P){return P!==q})},1)},[]),g=x.useCallback(function(j){r.current=Co(j),l.current=void 0},[]),w=x.useCallback(function(j){p(j.type,dy(j),j.target,m(j,s.lockRef.current))},[]),_=x.useCallback(function(j){p(j.type,Co(j),j.target,m(j,s.lockRef.current))},[]);x.useEffect(function(){return _r.push(d),s.setCallbacks({onScrollCapture:w,onWheelCapture:w,onTouchMoveCapture:_}),document.addEventListener("wheel",y,wr),document.addEventListener("touchmove",y,wr),document.addEventListener("touchstart",g,wr),function(){_r=_r.filter(function(j){return j!==d}),document.removeEventListener("wheel",y,wr),document.removeEventListener("touchmove",y,wr),document.removeEventListener("touchstart",g,wr)}},[]);var S=s.removeScrollBar,E=s.inert;return x.createElement(x.Fragment,null,E?x.createElement(d,{styles:vE(c)}):null,S?x.createElement(cE,{noRelative:s.noRelative,gapMode:s.gapMode}):null)}function wE(s){for(var a=null;s!==null;)s instanceof ShadowRoot&&(a=s.host,s=s.host),s=s.parentNode;return a}const _E=QN(bv,xE);var jv=x.forwardRef(function(s,a){return x.createElement(Xo,Ea({},s,{ref:a,sideCar:_E}))});jv.classNames=Xo.classNames;var SE=function(s){if(typeof document>"u")return null;var a=Array.isArray(s)?s[0]:s;return a.ownerDocument.body},Sr=new WeakMap,ko=new WeakMap,Oo={},Ld=0,Nv=function(s){return s&&(s.host||Nv(s.parentNode))},jE=function(s,a){return a.map(function(r){if(s.contains(r))return r;var l=Nv(r);return l&&s.contains(l)?l:(console.error("aria-hidden",r,"in not contained inside",s,". Doing nothing"),null)}).filter(function(r){return!!r})},NE=function(s,a,r,l){var c=jE(a,Array.isArray(s)?s:[s]);Oo[r]||(Oo[r]=new WeakMap);var d=Oo[r],h=[],m=new Set,y=new Set(c),p=function(w){!w||m.has(w)||(m.add(w),p(w.parentNode))};c.forEach(p);var g=function(w){!w||y.has(w)||Array.prototype.forEach.call(w.children,function(_){if(m.has(_))g(_);else try{var S=_.getAttribute(l),E=S!==null&&S!=="false",j=(Sr.get(_)||0)+1,R=(d.get(_)||0)+1;Sr.set(_,j),d.set(_,R),h.push(_),j===1&&E&&ko.set(_,!0),R===1&&_.setAttribute(r,"true"),E||_.setAttribute(l,"true")}catch(D){console.error("aria-hidden: cannot operate on ",_,D)}})};return g(a),m.clear(),Ld++,function(){h.forEach(function(w){var _=Sr.get(w)-1,S=d.get(w)-1;Sr.set(w,_),d.set(w,S),_||(ko.has(w)||w.removeAttribute(l),ko.delete(w)),S||w.removeAttribute(r)}),Ld--,Ld||(Sr=new WeakMap,Sr=new WeakMap,ko=new WeakMap,Oo={})}},EE=function(s,a,r){r===void 0&&(r="data-aria-hidden");var l=Array.from(Array.isArray(s)?s:[s]),c=SE(s);return c?(l.push.apply(l,Array.from(c.querySelectorAll("[aria-live], script"))),NE(l,c,r,"aria-hidden")):function(){return null}};function TE(s){const a=AE(s),r=x.forwardRef((l,c)=>{const{children:d,...h}=l,m=x.Children.toArray(d),y=m.find(kE);if(y){const p=y.props.children,g=m.map(w=>w===y?x.Children.count(p)>1?x.Children.only(null):x.isValidElement(p)?p.props.children:null:w);return o.jsx(a,{...h,ref:c,children:x.isValidElement(p)?x.cloneElement(p,void 0,g):null})}return o.jsx(a,{...h,ref:c,children:d})});return r.displayName=`${s}.Slot`,r}function AE(s){const a=x.forwardRef((r,l)=>{const{children:c,...d}=r;if(x.isValidElement(c)){const h=RE(c),m=OE(d,c.props);return c.type!==x.Fragment&&(m.ref=l?Go(l,h):h),x.cloneElement(c,m)}return x.Children.count(c)>1?x.Children.only(null):null});return a.displayName=`${s}.SlotClone`,a}var CE=Symbol("radix.slottable");function kE(s){return x.isValidElement(s)&&typeof s.type=="function"&&"__radixId"in s.type&&s.type.__radixId===CE}function OE(s,a){const r={...a};for(const l in a){const c=s[l],d=a[l];/^on[A-Z]/.test(l)?c&&d?r[l]=(...m)=>{const y=d(...m);return c(...m),y}:c&&(r[l]=c):l==="style"?r[l]={...c,...d}:l==="className"&&(r[l]=[c,d].filter(Boolean).join(" "))}return{...s,...r}}function RE(s){let a=Object.getOwnPropertyDescriptor(s.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?s.ref:(a=Object.getOwnPropertyDescriptor(s,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?s.props.ref:s.props.ref||s.ref)}var Qo="Dialog",[Ev]=rN(Qo),[DE,ga]=Ev(Qo),Tv=s=>{const{__scopeDialog:a,children:r,open:l,defaultOpen:c,onOpenChange:d,modal:h=!0}=s,m=x.useRef(null),y=x.useRef(null),[p,g]=uN({prop:l,defaultProp:c??!1,onChange:d,caller:Qo});return o.jsx(DE,{scope:a,triggerRef:m,contentRef:y,contentId:kd(),titleId:kd(),descriptionId:kd(),open:p,onOpenChange:g,onOpenToggle:x.useCallback(()=>g(w=>!w),[g]),modal:h,children:r})};Tv.displayName=Qo;var Av="DialogTrigger",ME=x.forwardRef((s,a)=>{const{__scopeDialog:r,...l}=s,c=ga(Av,r),d=xn(a,c.triggerRef);return o.jsx(ns.button,{type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.contentId,"data-state":vf(c.open),...l,ref:d,onClick:Bs(s.onClick,c.onOpenToggle)})});ME.displayName=Av;var gf="DialogPortal",[zE,Cv]=Ev(gf,{forceMount:void 0}),kv=s=>{const{__scopeDialog:a,forceMount:r,children:l,container:c}=s,d=ga(gf,a);return o.jsx(zE,{scope:a,forceMount:r,children:x.Children.map(l,h=>o.jsx(Jo,{present:r||d.open,children:o.jsx(yv,{asChild:!0,container:c,children:h})}))})};kv.displayName=gf;var Io="DialogOverlay",Ov=x.forwardRef((s,a)=>{const r=Cv(Io,s.__scopeDialog),{forceMount:l=r.forceMount,...c}=s,d=ga(Io,s.__scopeDialog);return d.modal?o.jsx(Jo,{present:l||d.open,children:o.jsx(LE,{...c,ref:a})}):null});Ov.displayName=Io;var UE=TE("DialogOverlay.RemoveScroll"),LE=x.forwardRef((s,a)=>{const{__scopeDialog:r,...l}=s,c=ga(Io,r);return o.jsx(jv,{as:UE,allowPinchZoom:!0,shards:[c.contentRef],children:o.jsx(ns.div,{"data-state":vf(c.open),...l,ref:a,style:{pointerEvents:"auto",...l.style}})})}),bn="DialogContent",Rv=x.forwardRef((s,a)=>{const r=Cv(bn,s.__scopeDialog),{forceMount:l=r.forceMount,...c}=s,d=ga(bn,s.__scopeDialog);return o.jsx(Jo,{present:l||d.open,children:d.modal?o.jsx(BE,{...c,ref:a}):o.jsx(qE,{...c,ref:a})})});Rv.displayName=bn;var BE=x.forwardRef((s,a)=>{const r=ga(bn,s.__scopeDialog),l=x.useRef(null),c=xn(a,r.contentRef,l);return x.useEffect(()=>{const d=l.current;if(d)return EE(d)},[]),o.jsx(Dv,{...s,ref:c,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Bs(s.onCloseAutoFocus,d=>{d.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Bs(s.onPointerDownOutside,d=>{const h=d.detail.originalEvent,m=h.button===0&&h.ctrlKey===!0;(h.button===2||m)&&d.preventDefault()}),onFocusOutside:Bs(s.onFocusOutside,d=>d.preventDefault())})}),qE=x.forwardRef((s,a)=>{const r=ga(bn,s.__scopeDialog),l=x.useRef(!1),c=x.useRef(!1);return o.jsx(Dv,{...s,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:d=>{s.onCloseAutoFocus?.(d),d.defaultPrevented||(l.current||r.triggerRef.current?.focus(),d.preventDefault()),l.current=!1,c.current=!1},onInteractOutside:d=>{s.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=x.forwardRef((s,a)=>{const{__scopeDialog:r,trapFocus:l,onOpenAutoFocus:c,onCloseAutoFocus:d,...h}=s,m=ga(bn,r),y=x.useRef(null),p=xn(a,y);return HN(),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":vf(m.open),...h,ref:p,onDismiss:()=>m.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx($E,{titleId:m.titleId}),o.jsx(VE,{contentRef:y,descriptionId:m.descriptionId})]})]})}),yf="DialogTitle",Mv=x.forwardRef((s,a)=>{const{__scopeDialog:r,...l}=s,c=ga(yf,r);return o.jsx(ns.h2,{id:c.titleId,...l,ref:a})});Mv.displayName=yf;var zv="DialogDescription",Uv=x.forwardRef((s,a)=>{const{__scopeDialog:r,...l}=s,c=ga(zv,r);return o.jsx(ns.p,{id:c.descriptionId,...l,ref:a})});Uv.displayName=zv;var Lv="DialogClose",Bv=x.forwardRef((s,a)=>{const{__scopeDialog:r,...l}=s,c=ga(Lv,r);return o.jsx(ns.button,{type:"button",...l,ref:a,onClick:Bs(s.onClick,()=>c.onOpenChange(!1))})});Bv.displayName=Lv;function vf(s){return s?"open":"closed"}var qv="DialogTitleWarning",[M2,$v]=nN(qv,{contentName:bn,titleName:yf,docsSlug:"dialog"}),$E=({titleId:s})=>{const a=$v(qv),r=`\`${a.contentName}\` requires a \`${a.titleName}\` for the component to be accessible for screen reader users.
91
+ `)},xE=0,Sr=[];function wE(s){var a=x.useRef([]),r=x.useRef([0,0]),l=x.useRef(),c=x.useState(xE++)[0],d=x.useState(Sv)[0],h=x.useRef(s);x.useEffect(function(){h.current=s},[s]),x.useEffect(function(){if(s.inert){document.body.classList.add("block-interactivity-".concat(c));var j=c1([s.lockRef.current],(s.shards||[]).map(my),!0).filter(Boolean);return j.forEach(function(R){return R.classList.add("allow-interactivity-".concat(c))}),function(){document.body.classList.remove("block-interactivity-".concat(c)),j.forEach(function(R){return R.classList.remove("allow-interactivity-".concat(c))})}}},[s.inert,s.lockRef.current,s.shards]);var m=x.useCallback(function(j,R){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!h.current.allowPinchZoom;var D=ko(j),B=r.current,q="deltaX"in j?j.deltaX:B[0]-D[0],P="deltaY"in j?j.deltaY:B[1]-D[1],W,Y=j.target,H=Math.abs(q)>Math.abs(P)?"h":"v";if("touches"in j&&H==="h"&&Y.type==="range")return!1;var Q=window.getSelection(),le=Q&&Q.anchorNode,qe=le?le===Y||le.contains(Y):!1;if(qe)return!1;var he=fy(H,Y);if(!he)return!0;if(he?W=H:(W=H==="v"?"h":"v",he=fy(H,Y)),!he)return!1;if(!l.current&&"changedTouches"in j&&(q||P)&&(l.current=W),!W)return!0;var ce=l.current||W;return yE(ce,R,j,ce==="h"?q:P)},[]),y=x.useCallback(function(j){var R=j;if(!(!Sr.length||Sr[Sr.length-1]!==d)){var D="deltaY"in R?hy(R):ko(R),B=a.current.filter(function(W){return W.name===R.type&&(W.target===R.target||R.target===W.shadowParent)&&vE(W.delta,D)})[0];if(B&&B.should){R.cancelable&&R.preventDefault();return}if(!B){var q=(h.current.shards||[]).map(my).filter(Boolean).filter(function(W){return W.contains(R.target)}),P=q.length>0?m(R,q[0]):!h.current.noIsolation;P&&R.cancelable&&R.preventDefault()}}},[]),p=x.useCallback(function(j,R,D,B){var q={name:j,delta:R,target:D,should:B,shadowParent:_E(D)};a.current.push(q),setTimeout(function(){a.current=a.current.filter(function(P){return P!==q})},1)},[]),g=x.useCallback(function(j){r.current=ko(j),l.current=void 0},[]),w=x.useCallback(function(j){p(j.type,hy(j),j.target,m(j,s.lockRef.current))},[]),_=x.useCallback(function(j){p(j.type,ko(j),j.target,m(j,s.lockRef.current))},[]);x.useEffect(function(){return Sr.push(d),s.setCallbacks({onScrollCapture:w,onWheelCapture:w,onTouchMoveCapture:_}),document.addEventListener("wheel",y,_r),document.addEventListener("touchmove",y,_r),document.addEventListener("touchstart",g,_r),function(){Sr=Sr.filter(function(j){return j!==d}),document.removeEventListener("wheel",y,_r),document.removeEventListener("touchmove",y,_r),document.removeEventListener("touchstart",g,_r)}},[]);var S=s.removeScrollBar,E=s.inert;return x.createElement(x.Fragment,null,E?x.createElement(d,{styles:bE(c)}):null,S?x.createElement(uE,{noRelative:s.noRelative,gapMode:s.gapMode}):null)}function _E(s){for(var a=null;s!==null;)s instanceof ShadowRoot&&(a=s.host,s=s.host),s=s.parentNode;return a}const SE=ZN(_v,wE);var Tv=x.forwardRef(function(s,a){return x.createElement(Qo,Ea({},s,{ref:a,sideCar:SE}))});Tv.classNames=Qo.classNames;var jE=function(s){if(typeof document>"u")return null;var a=Array.isArray(s)?s[0]:s;return a.ownerDocument.body},jr=new WeakMap,Oo=new WeakMap,Ro={},Bd=0,Av=function(s){return s&&(s.host||Av(s.parentNode))},NE=function(s,a){return a.map(function(r){if(s.contains(r))return r;var l=Av(r);return l&&s.contains(l)?l:(console.error("aria-hidden",r,"in not contained inside",s,". Doing nothing"),null)}).filter(function(r){return!!r})},EE=function(s,a,r,l){var c=NE(a,Array.isArray(s)?s:[s]);Ro[r]||(Ro[r]=new WeakMap);var d=Ro[r],h=[],m=new Set,y=new Set(c),p=function(w){!w||m.has(w)||(m.add(w),p(w.parentNode))};c.forEach(p);var g=function(w){!w||y.has(w)||Array.prototype.forEach.call(w.children,function(_){if(m.has(_))g(_);else try{var S=_.getAttribute(l),E=S!==null&&S!=="false",j=(jr.get(_)||0)+1,R=(d.get(_)||0)+1;jr.set(_,j),d.set(_,R),h.push(_),j===1&&E&&Oo.set(_,!0),R===1&&_.setAttribute(r,"true"),E||_.setAttribute(l,"true")}catch(D){console.error("aria-hidden: cannot operate on ",_,D)}})};return g(a),m.clear(),Bd++,function(){h.forEach(function(w){var _=jr.get(w)-1,S=d.get(w)-1;jr.set(w,_),d.set(w,S),_||(Oo.has(w)||w.removeAttribute(l),Oo.delete(w)),S||w.removeAttribute(r)}),Bd--,Bd||(jr=new WeakMap,jr=new WeakMap,Oo=new WeakMap,Ro={})}},TE=function(s,a,r){r===void 0&&(r="data-aria-hidden");var l=Array.from(Array.isArray(s)?s:[s]),c=jE(s);return c?(l.push.apply(l,Array.from(c.querySelectorAll("[aria-live], script"))),EE(l,c,r,"aria-hidden")):function(){return null}};function AE(s){const a=CE(s),r=x.forwardRef((l,c)=>{const{children:d,...h}=l,m=x.Children.toArray(d),y=m.find(OE);if(y){const p=y.props.children,g=m.map(w=>w===y?x.Children.count(p)>1?x.Children.only(null):x.isValidElement(p)?p.props.children:null:w);return o.jsx(a,{...h,ref:c,children:x.isValidElement(p)?x.cloneElement(p,void 0,g):null})}return o.jsx(a,{...h,ref:c,children:d})});return r.displayName=`${s}.Slot`,r}function CE(s){const a=x.forwardRef((r,l)=>{const{children:c,...d}=r;if(x.isValidElement(c)){const h=DE(c),m=RE(d,c.props);return c.type!==x.Fragment&&(m.ref=l?Po(l,h):h),x.cloneElement(c,m)}return x.Children.count(c)>1?x.Children.only(null):null});return a.displayName=`${s}.SlotClone`,a}var kE=Symbol("radix.slottable");function OE(s){return x.isValidElement(s)&&typeof s.type=="function"&&"__radixId"in s.type&&s.type.__radixId===kE}function RE(s,a){const r={...a};for(const l in a){const c=s[l],d=a[l];/^on[A-Z]/.test(l)?c&&d?r[l]=(...m)=>{const y=d(...m);return c(...m),y}:c&&(r[l]=c):l==="style"?r[l]={...c,...d}:l==="className"&&(r[l]=[c,d].filter(Boolean).join(" "))}return{...s,...r}}function DE(s){let a=Object.getOwnPropertyDescriptor(s.props,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning;return r?s.ref:(a=Object.getOwnPropertyDescriptor(s,"ref")?.get,r=a&&"isReactWarning"in a&&a.isReactWarning,r?s.props.ref:s.props.ref||s.ref)}var Zo="Dialog",[Cv]=iN(Zo),[ME,ga]=Cv(Zo),kv=s=>{const{__scopeDialog:a,children:r,open:l,defaultOpen:c,onOpenChange:d,modal:h=!0}=s,m=x.useRef(null),y=x.useRef(null),[p,g]=dN({prop:l,defaultProp:c??!1,onChange:d,caller:Zo});return o.jsx(ME,{scope:a,triggerRef:m,contentRef:y,contentId:Od(),titleId:Od(),descriptionId:Od(),open:p,onOpenChange:g,onOpenToggle:x.useCallback(()=>g(w=>!w),[g]),modal:h,children:r})};kv.displayName=Zo;var Ov="DialogTrigger",zE=x.forwardRef((s,a)=>{const{__scopeDialog:r,...l}=s,c=ga(Ov,r),d=wn(a,c.triggerRef);return o.jsx(ns.button,{type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.contentId,"data-state":xf(c.open),...l,ref:d,onClick:Bs(s.onClick,c.onOpenToggle)})});zE.displayName=Ov;var vf="DialogPortal",[UE,Rv]=Cv(vf,{forceMount:void 0}),Dv=s=>{const{__scopeDialog:a,forceMount:r,children:l,container:c}=s,d=ga(vf,a);return o.jsx(UE,{scope:a,forceMount:r,children:x.Children.map(l,h=>o.jsx(Xo,{present:r||d.open,children:o.jsx(xv,{asChild:!0,container:c,children:h})}))})};Dv.displayName=vf;var Go="DialogOverlay",Mv=x.forwardRef((s,a)=>{const r=Rv(Go,s.__scopeDialog),{forceMount:l=r.forceMount,...c}=s,d=ga(Go,s.__scopeDialog);return d.modal?o.jsx(Xo,{present:l||d.open,children:o.jsx(BE,{...c,ref:a})}):null});Mv.displayName=Go;var LE=AE("DialogOverlay.RemoveScroll"),BE=x.forwardRef((s,a)=>{const{__scopeDialog:r,...l}=s,c=ga(Go,r);return o.jsx(Tv,{as:LE,allowPinchZoom:!0,shards:[c.contentRef],children:o.jsx(ns.div,{"data-state":xf(c.open),...l,ref:a,style:{pointerEvents:"auto",...l.style}})})}),xn="DialogContent",zv=x.forwardRef((s,a)=>{const r=Rv(xn,s.__scopeDialog),{forceMount:l=r.forceMount,...c}=s,d=ga(xn,s.__scopeDialog);return o.jsx(Xo,{present:l||d.open,children:d.modal?o.jsx(qE,{...c,ref:a}):o.jsx($E,{...c,ref:a})})});zv.displayName=xn;var qE=x.forwardRef((s,a)=>{const r=ga(xn,s.__scopeDialog),l=x.useRef(null),c=wn(a,r.contentRef,l);return x.useEffect(()=>{const d=l.current;if(d)return TE(d)},[]),o.jsx(Uv,{...s,ref:c,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Bs(s.onCloseAutoFocus,d=>{d.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Bs(s.onPointerDownOutside,d=>{const h=d.detail.originalEvent,m=h.button===0&&h.ctrlKey===!0;(h.button===2||m)&&d.preventDefault()}),onFocusOutside:Bs(s.onFocusOutside,d=>d.preventDefault())})}),$E=x.forwardRef((s,a)=>{const r=ga(xn,s.__scopeDialog),l=x.useRef(!1),c=x.useRef(!1);return o.jsx(Uv,{...s,ref:a,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:d=>{s.onCloseAutoFocus?.(d),d.defaultPrevented||(l.current||r.triggerRef.current?.focus(),d.preventDefault()),l.current=!1,c.current=!1},onInteractOutside:d=>{s.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()}})}),Uv=x.forwardRef((s,a)=>{const{__scopeDialog:r,trapFocus:l,onOpenAutoFocus:c,onCloseAutoFocus:d,...h}=s,m=ga(xn,r),y=x.useRef(null),p=wn(a,y);return VN(),o.jsxs(o.Fragment,{children:[o.jsx(vv,{asChild:!0,loop:!0,trapped:l,onMountAutoFocus:c,onUnmountAutoFocus:d,children:o.jsx(gv,{role:"dialog",id:m.contentId,"aria-describedby":m.descriptionId,"aria-labelledby":m.titleId,"data-state":xf(m.open),...h,ref:p,onDismiss:()=>m.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(HE,{titleId:m.titleId}),o.jsx(IE,{contentRef:y,descriptionId:m.descriptionId})]})]})}),bf="DialogTitle",Lv=x.forwardRef((s,a)=>{const{__scopeDialog:r,...l}=s,c=ga(bf,r);return o.jsx(ns.h2,{id:c.titleId,...l,ref:a})});Lv.displayName=bf;var Bv="DialogDescription",qv=x.forwardRef((s,a)=>{const{__scopeDialog:r,...l}=s,c=ga(Bv,r);return o.jsx(ns.p,{id:c.descriptionId,...l,ref:a})});qv.displayName=Bv;var $v="DialogClose",Hv=x.forwardRef((s,a)=>{const{__scopeDialog:r,...l}=s,c=ga($v,r);return o.jsx(ns.button,{type:"button",...l,ref:a,onClick:Bs(s.onClick,()=>c.onOpenChange(!1))})});Hv.displayName=$v;function xf(s){return s?"open":"closed"}var Vv="DialogTitleWarning",[M2,Iv]=rN(Vv,{contentName:xn,titleName:bf,docsSlug:"dialog"}),HE=({titleId:s})=>{const a=Iv(Vv),r=`\`${a.contentName}\` requires a \`${a.titleName}\` for the component to be accessible for screen reader users.
92
92
 
93
93
  If you want to hide the \`${a.titleName}\`, you can wrap it with our VisuallyHidden component.
94
94
 
95
- For more information, see https://radix-ui.com/primitives/docs/components/${a.docsSlug}`;return x.useEffect(()=>{s&&(document.getElementById(s)||console.error(r))},[r,s]),null},HE="DialogDescriptionWarning",VE=({contentRef:s,descriptionId:a})=>{const l=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${$v(HE).contentName}}.`;return x.useEffect(()=>{const c=s.current?.getAttribute("aria-describedby");a&&c&&(document.getElementById(a)||console.warn(l))},[l,s,a]),null},IE=Tv,GE=kv,PE=Ov,KE=Rv,YE=Mv,JE=Uv,XE=Bv;function yn({...s}){return o.jsx(IE,{"data-slot":"dialog",...s})}function QE({...s}){return o.jsx(GE,{"data-slot":"dialog-portal",...s})}function ZE({className:s,...a}){return o.jsx(PE,{"data-slot":"dialog-overlay",className:Re("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",s),...a})}function vn({className:s,children:a,...r}){return o.jsxs(QE,{"data-slot":"dialog-portal",children:[o.jsx(ZE,{}),o.jsxs(KE,{"data-slot":"dialog-content",className:Re("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",s),...r,children:[a,o.jsxs(XE,{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(tl,{}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Oa({className:s,...a}){return o.jsx("div",{"data-slot":"dialog-header",className:Re("flex flex-col gap-2 text-center sm:text-left",s),...a})}function Tr({className:s,...a}){return o.jsx("div",{"data-slot":"dialog-footer",className:Re("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",s),...a})}function Ra({className:s,...a}){return o.jsx(YE,{"data-slot":"dialog-title",className:Re("text-lg leading-none font-semibold",s),...a})}function Da({className:s,...a}){return o.jsx(JE,{"data-slot":"dialog-description",className:Re("text-muted-foreground text-sm",s),...a})}const Se=x.forwardRef(({className:s,type:a,...r},l)=>o.jsx("input",{type:a,className:Re("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",s),ref:l,...r}));Se.displayName="Input";var FE=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],WE=FE.reduce((s,a)=>{const r=Sy(`Primitive.${a}`),l=x.forwardRef((c,d)=>{const{asChild:h,...m}=c,y=h?r:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(y,{...m,ref:d})});return l.displayName=`Primitive.${a}`,{...s,[a]:l}},{}),e2="Label",Hv=x.forwardRef((s,a)=>o.jsx(WE.label,{...s,ref:a,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(s.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Hv.displayName=e2;var t2=Hv;function pa({className:s,...a}){return o.jsx(t2,{"data-slot":"label",className:Re("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",s),...a})}const a2=Ey("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 Wi({className:s,variant:a,...r}){return o.jsx("div",{"data-slot":"alert",role:"alert",className:Re(a2({variant:a}),s),...r})}function el({className:s,...a}){return o.jsx("div",{"data-slot":"alert-description",className:Re("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",s),...a})}function bf({className:s}){return o.jsxs("svg",{width:"512",height:"512",viewBox:"0 0 512 512",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:Re("w-9 h-9",s),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 hy(s){const a=s.trim();return a?a.startsWith("http://")||a.startsWith("https://")?a:`https://${a}.supabase.co`:""}function s2(s){const a=s.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 n2(s){const a=s.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:s,open:a=!0,canClose:r=!1}){const[l,c]=x.useState("welcome"),[d,h]=x.useState(""),[m,y]=x.useState(""),[p,g]=x.useState(null),[w,_]=x.useState(!1),[S,E]=x.useState(!1),j=async()=>{g(null),c("validating");const P=hy(d),W=m.trim(),Y=await sv(P,W);Y.valid?(Bj({url:P,anonKey:W}),c("success"),setTimeout(()=>{window.location.reload()},1e3)):(g(Y.error||"Connection failed. Please check your credentials."),c("credentials"))},R=d?s2(d):{valid:!1},D=m?n2(m):{valid:!1},B=d?hy(d):"",q=d&&!d.startsWith("http")&&R.valid;return o.jsx(yn,{open:a,onOpenChange:P=>{!P&&r&&s()},children:o.jsxs(vn,{className:"sm:max-w-md",onPointerDownOutside:P=>{r||P.preventDefault()},onEscapeKeyDown:P=>{r||P.preventDefault()},children:[l==="welcome"&&o.jsxs(o.Fragment,{children:[o.jsxs(Oa,{children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(bf,{className:"w-9 h-9"}),o.jsx(Ra,{children:"Welcome to Email Automator"})]}),o.jsx(Da,{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(Wi,{children:o.jsxs(el,{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(Gi,{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:s,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(Oa,{children:[o.jsx(Ra,{children:"Connect to Supabase"}),o.jsx(Da,{children:"Enter your connection details below."})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[p&&o.jsxs(Wi,{variant:"destructive",children:[o.jsx(Mr,{className:"h-4 w-4"}),o.jsx(el,{children:p})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(pa,{htmlFor:"supabase-url",children:"Project URL or ID"}),o.jsxs("div",{className:"relative",children:[o.jsx(Se,{id:"supabase-url",placeholder:"https://xxx.supabase.co or project-id",value:d,onChange:P=>{h(P.target.value),_(!0)},onBlur:()=>_(!0),className:w&&d?R.valid?"pr-8 border-green-500":"pr-8 border-destructive":""}),w&&d&&R.valid&&o.jsx(Na,{className:"absolute right-2 top-1/2 -translate-y-1/2 h-4 w-4 text-green-500"})]}),q&&o.jsxs("div",{className:"flex items-start gap-1.5 text-xs text-green-600 dark:text-green-400",children:[o.jsx(Na,{className:"h-3 w-3 mt-0.5 flex-shrink-0"}),o.jsxs("span",{children:["Will use: ",B]})]}),w&&d&&R.message&&!R.valid&&o.jsx("p",{className:"text-xs text-destructive",children:R.message})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(pa,{htmlFor:"anon-key",children:"Anon Public Key"}),o.jsxs("div",{className:"relative",children:[o.jsx(Se,{id:"anon-key",type:"password",placeholder:"eyJ...",value:m,onChange:P=>{y(P.target.value),E(!0)},onBlur:()=>E(!0),className:S&&m?D.valid?"pr-8 border-green-500":"pr-8 border-destructive":""}),S&&m&&D.valid&&o.jsx(Na,{className:"absolute right-2 top-1/2 -translate-y-1/2 h-4 w-4 text-green-500"})]}),S&&m&&D.message&&o.jsx("p",{className:`text-xs ${D.valid?"text-green-600 dark:text-green-400":"text-destructive"}`,children:D.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:s,className:"flex-1",children:"Close"}),o.jsx(Z,{onClick:j,disabled:!R.valid||!D.valid,className:"flex-1",children:"Connect"})]})]})]}),l==="validating"&&o.jsxs(o.Fragment,{children:[o.jsxs(Oa,{children:[o.jsx(Ra,{children:"Validating Connection"}),o.jsx(Da,{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(Oa,{children:[o.jsx(Ra,{children:"Success!"}),o.jsx(Da,{children:"Your database is connected."})]}),o.jsxs("div",{className:"flex flex-col items-center justify-center py-8",children:[o.jsx(Vi,{className:"h-12 w-12 text-green-500 mb-4"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Restarting application..."})]})]})]})})}function r2({email:s,isOpen:a,onOpenChange:r,onRetry:l}){const[c,d]=x.useState([]),[h,m]=x.useState(!1);x.useEffect(()=>{a&&s&&y()},[a,s]);const y=async()=>{if(s){m(!0);try{const g=await ze.getEmailEvents(s.id);g.data&&d(g.data.events)}catch(g){console.error("Failed to fetch trace:",g)}finally{m(!1)}}},p=g=>{switch(g){case"analysis":return o.jsx(Hi,{className:"w-4 h-4 text-purple-500"});case"action":return o.jsx(Lo,{className:"w-4 h-4 text-emerald-500"});case"error":return o.jsx(Mr,{className:"w-4 h-4 text-red-500"});default:return o.jsx(Rr,{className:"w-4 h-4 text-blue-500"})}};return o.jsx(yn,{open:a,onOpenChange:r,children:o.jsxs(vn,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 overflow-hidden",children:[o.jsxs(Oa,{className:"p-6 border-b flex flex-row items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(cf,{className:"w-5 h-5 text-primary"}),o.jsx(Ra,{children:"AI Processing Trace"})]}),o.jsx(Da,{children:"Step-by-step log of how the AI analyzed and acted on this email."})]}),s?.processing_status==="failed"&&l&&o.jsxs(Z,{size:"sm",variant:"outline",onClick:()=>{l(s),r(!1)},className:"gap-2 text-destructive border-destructive/20 hover:bg-destructive/10",children:[o.jsx(qs,{className:"w-3.5 h-3.5"}),"Retry Job"]})]}),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(mt,{})}):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 email."}):c.map((g,w)=>o.jsxs("div",{className:"relative pl-8",children:[w!==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: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(Or,{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.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-sm text-foreground/90",children:g.details?.message}),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(Ls,{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-60 overflow-y-auto font-mono",children:g.details.system_prompt})]}),g.details?.content_preview&&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(Ls,{className:"w-3 h-3"})," Email Content (sent to LLM)"]}),o.jsx("pre",{className:"text-[10px] bg-blue-500/5 p-2 rounded border border-blue-500/10 overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto font-mono",children:g.details.content_preview})]})]}),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(Ls,{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(Ls,{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.details?.usage&&o.jsxs("div",{className:"flex gap-4 pt-2 border-t border-border/50",children:[o.jsxs("div",{className:"text-[10px]",children:[o.jsx("span",{className:"text-muted-foreground mr-1",children:"Prompt:"}),o.jsx("span",{className:"font-mono font-bold",children:g.details.usage.prompt_tokens})]}),o.jsxs("div",{className:"text-[10px]",children:[o.jsx("span",{className:"text-muted-foreground mr-1",children:"Completion:"}),o.jsx("span",{className:"font-mono font-bold",children:g.details.usage.completion_tokens})]}),o.jsxs("div",{className:"text-[10px]",children:[o.jsx("span",{className:"text-muted-foreground mr-1",children:"Total:"}),o.jsx("span",{className:"font-mono font-bold text-primary",children:g.details.usage.total_tokens})]})]})]}),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(of,{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 i2={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 l2(){const{state:s,actions:a,dispatch:r}=qr(),{openTerminal:l}=cv(),[c,d]=x.useState(!0),[h,m]=x.useState(!1),[y,p]=x.useState(""),[g,w]=x.useState(null),[_,S]=x.useState(null),[E,j]=x.useState({}),[R,D]=x.useState(null),[B,q]=x.useState(!1),[P,W]=x.useState(null);x.useEffect(()=>{s.isAuthenticated?(Y(),a.fetchStats()):d(!1)},[g,s.isAuthenticated]);const Y=async(C=0)=>{d(!0),await a.fetchEmails({category:g||void 0,search:y||void 0,offset:C,sortBy:s.sortBy,sortOrder:s.sortOrder}),d(!1)},I=C=>{a.fetchEmails({category:g||void 0,search:y||void 0,offset:0,sortBy:C,sortOrder:s.sortOrder})},X=()=>{a.fetchEmails({category:g||void 0,search:y||void 0,offset:0,sortBy:s.sortBy,sortOrder:s.sortOrder==="asc"?"desc":"asc"})},oe=async()=>{if(s.accounts.length===0){te.warning("Please connect an email account first");return}Ta.playStart(),l(),m(!0);const C=await a.triggerSync();m(!1),C?(Ta.playSuccess(),te.success("Sync completed! Check your emails.")):te.error("Sync failed. Check account status for details.")},Ue=async(C,J)=>{if(J==="delete"&&R!==C.id){D(C.id);return}D(null),j(_e=>({..._e,[C.id]:J}));const K=await a.executeAction(C.id,J);j(_e=>{const Ne={..._e};return delete Ne[C.id],Ne}),K&&(te.success(`Email ${J==="delete"?"deleted":J==="archive"?"archived":"updated"}`),J==="delete"&&Y(s.emailsOffset))},ge=()=>{D(null)},pe=C=>{C.preventDefault(),Y()},Ke=C=>{const J=C==="next"?s.emailsOffset+20:Math.max(0,s.emailsOffset-20);Y(J)},Ge=C=>{W(C),q(!0)},je=async C=>{await a.retryProcessing(C.id)&&te.success("Retrying email processing...")};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(Bd,{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:oe,size:"sm",variant:"default",className:"h-9 shadow-md px-4",disabled:h,children:[o.jsx(qs,{className:Re("w-3.5 h-3.5 mr-2",h&&"animate-spin")}),h?"Syncing...":"Sync Now"]}),o.jsxs("span",{className:"h-9 text-xs font-medium text-muted-foreground bg-secondary px-3 py-1 rounded-md border border-border flex items-center",children:[s.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(cf,{className:"w-3.5 h-3.5 mr-2"}),"View Logs"]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 items-center",children:[o.jsxs("form",{onSubmit:pe,className:"flex-1 flex gap-2 w-full",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx(zw,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),o.jsx(Se,{placeholder:"Search emails...",value:y,onChange:C=>p(C.target.value),className:"pl-9 h-9"})]}),o.jsx(Z,{type:"submit",size:"sm",className:"h-9 px-4",children:"Search"})]}),o.jsxs("div",{className:"flex items-center gap-1 bg-secondary/30 p-1 rounded-md border border-border/50 h-9",children:[o.jsxs("select",{className:"bg-transparent text-xs font-medium border-none focus:ring-0 cursor-pointer pl-2 pr-8 h-full",value:s.sortBy,onChange:C=>I(C.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 text-primary",onClick:X,title:s.sortOrder==="asc"?"Sorting: Oldest First":"Sorting: Newest First",children:s.sortOrder==="asc"?o.jsx(Tx,{className:"w-3.5 h-3.5"}):o.jsx(Sx,{className:"w-3.5 h-3.5"})})]})]}),o.jsxs("div",{className:"flex gap-1 flex-wrap",children:[o.jsx(Z,{size:"sm",variant:s.activeCategory===null?"secondary":"ghost",onClick:()=>w(null),children:"All"}),["spam","client","newsletter","support"].map(C=>o.jsx(Z,{size:"sm",variant:s.activeCategory===C?"secondary":"ghost",onClick:()=>w(C),className:"capitalize",children:C},C))]}),c?o.jsx(sN,{}):s.emails.length===0?o.jsxs(At,{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(Bd,{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:s.accounts.length===0?"Connect your email account to get started.":"Try syncing or adjusting your filters."}),s.accounts.length>0&&o.jsxs(Z,{onClick:()=>{l(),oe()},disabled:h,children:[o.jsx(qs,{className:Re("w-4 h-4 mr-2",h&&"animate-spin")}),"Sync Now"]})]}):o.jsxs(o.Fragment,{children:[s.emails.map(C=>o.jsx(u2,{email:C,onAction:Ue,onRetry:je,onViewTrace:Ge,onSelect:()=>S(C),isSelected:_?.id===C.id,loadingAction:E[C.id],isDeletePending:R===C.id,onCancelDelete:ge},C.id)),o.jsx(r2,{isOpen:B,onOpenChange:q,email:P,onRetry:je}),s.emailsTotal>20&&o.jsxs("div",{className:"flex items-center justify-between pt-4",children:[o.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>Ke("prev"),disabled:s.emailsOffset===0,children:[o.jsx(Bx,{className:"w-4 h-4 mr-1"}),"Previous"]}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[s.emailsOffset+1," - ",Math.min(s.emailsOffset+20,s.emailsTotal)," of ",s.emailsTotal]}),o.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>Ke("next"),disabled:s.emailsOffset+20>=s.emailsTotal,children:["Next",o.jsx($x,{className:"w-4 h-4 ml-1"})]})]})]})]}),o.jsxs("aside",{className:"space-y-6",children:[_&&o.jsxs(At,{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(tl,{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:_.sender})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Subject:"}),o.jsx("p",{className:"font-medium",children:_.subject})]}),_.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:_.ai_analysis.summary})]}),_.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:_.ai_analysis.key_points.map((C,J)=>o.jsx("li",{children:C},J))})]}),_.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(Lw,{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:_.ai_analysis.draft_response}),o.jsxs("p",{className:"mt-2 text-[9px] text-muted-foreground",children:["* This draft is already saved in your ",_.email_accounts?.provider==="gmail"?"Gmail":"Outlook"," Drafts folder."]})]})]})]})]}),o.jsx(o2,{accounts:s.accounts,onUpdate:a.updateAccount,onSync:a.triggerSync,settings:s.settings,onUpdateSettings:a.updateSettings,openTerminal:l}),o.jsxs(At,{className:"p-6",children:[o.jsxs("h3",{className:"font-semibold mb-4 flex items-center gap-2",children:[o.jsx(by,{className:"w-4 h-4 text-primary"}),"Sync History"]}),o.jsx("div",{className:"space-y-4",children:!s.stats?.recentSyncs||s.stats.recentSyncs.length===0?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No sync history available."}):s.stats.recentSyncs.slice(0,5).map(C=>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:Re("w-1.5 h-1.5 rounded-full",C.status==="success"?"bg-emerald-500":C.status==="running"?"bg-blue-500 animate-pulse":"bg-red-500")}),o.jsxs("p",{className:"font-medium text-xs",children:[new Date(C.started_at).toLocaleDateString()," ",new Date(C.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:C.emails_processed})," • Actioned: ",o.jsx("span",{className:"font-medium text-foreground",children:C.emails_deleted+C.emails_drafted})]}),C.error_message&&o.jsx("p",{className:"text-[10px] text-destructive pl-3.5 line-clamp-1",title:C.error_message,children:C.error_message})]}),o.jsx("div",{className:"text-[10px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded",children:C.status==="running"?"Running":C.completed_at?`${Math.round((new Date(C.completed_at).getTime()-new Date(C.started_at).getTime())/1e3)}s`:"..."})]},C.id))})]}),o.jsxs(At,{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:s.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:s.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:s.rules.filter(C=>C.is_enabled).length})]})]})]})]})]})}function o2({accounts:s,onUpdate:a,onSync:r,settings:l,onUpdateSettings:c,openTerminal:d}){return s.length===0?null:o.jsxs(At,{className:"p-6",children:[o.jsxs("h3",{className:"font-semibold mb-4 flex items-center gap-2",children:[o.jsx($w,{className:"w-4 h-4 text-primary"}),"Sync Scope"]}),o.jsx("div",{className:"space-y-6",children:s.map(h=>o.jsx(c2,{account:h,onUpdate:a,onSync:r,openTerminal:d},h.id))})]})}function c2({account:s,onUpdate:a,onSync:r,openTerminal:l}){const[c,d]=x.useState(!1),[h,m]=x.useState(""),[y,p]=x.useState(""),g=E=>{if(!E)return"";const j=typeof E=="string"&&/^\d+$/.test(E)?parseInt(E):E,R=new Date(j);if(isNaN(R.getTime()))return"";const D=B=>B<10?"0"+B:B;return R.getFullYear()+"-"+D(R.getMonth()+1)+"-"+D(R.getDate())+"T"+D(R.getHours())+":"+D(R.getMinutes())};x.useEffect(()=>{const E=s.sync_start_date||s.last_sync_checkpoint||s.last_sync_at;m(g(E)),p((s.sync_max_emails_per_run||50).toString())},[s.id,s.sync_start_date,s.last_sync_checkpoint,s.last_sync_at,s.sync_max_emails_per_run]);const w=async E=>{d(!0),await a(s.id,E),d(!1)},_=()=>{const E=s.sync_start_date?new Date(s.sync_start_date).toISOString():"",j=h?new Date(h).toISOString():"";j!==E&&w({sync_start_date:j||null})},S=()=>{const E=parseInt(y,10)||50;E!==s.sync_max_emails_per_run&&w({sync_max_emails_per_run:E})};return 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:s.email_address,children:s.email_address}),o.jsxs("div",{className:"flex items-center gap-1",children:[s.last_sync_status==="syncing"?o.jsx($t,{className:"w-3 h-3 text-primary animate-spin"}):s.last_sync_status==="success"?o.jsx(of,{className:"w-3 h-3 text-emerald-500"}):s.last_sync_status==="error"?o.jsx("span",{title:s.last_sync_error||"Error",children:o.jsx(Mr,{className:"w-3 h-3 text-destructive"})}):null,o.jsx(Z,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>{l(),r(s.id)},disabled:s.last_sync_status==="syncing",children:o.jsx(qs,{className:Re("w-3 h-3",s.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(s.id,{last_sync_checkpoint:null}),disabled:s.last_sync_status==="syncing",children:o.jsx(by,{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(kx,{className:"w-2.5 h-2.5"})," Sync From"]}),o.jsx(Se,{type:"datetime-local",className:"h-7 text-[10px] px-2 py-0 w-full",value:h,onChange:E=>m(E.target.value),onBlur:_,disabled:c||s.last_sync_status==="syncing"})]}),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(ow,{className:"w-2.5 h-2.5"})," Max Emails"]}),o.jsx(Se,{type:"number",className:"h-7 text-[10px] px-2 py-0",value:y,onChange:E=>p(E.target.value),onBlur:S,disabled:c||s.last_sync_status==="syncing"})]})]}),s.last_sync_at&&o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:["Last sync: ",new Date(s.last_sync_at).toLocaleString()]}),s.last_sync_error&&o.jsxs("p",{className:"text-[9px] text-destructive italic line-clamp-1",title:s.last_sync_error,children:["Error: ",s.last_sync_error]})]})}function u2({email:s,onAction:a,onRetry:r,onViewTrace:l,onSelect:c,isSelected:d,loadingAction:h,isDeletePending:m,onCancelDelete:y}){if(!s)return null;const p=i2[s.category||"other"],g=!!h,w=()=>{if(!s.email_accounts)return"#";const{provider:_,email_address:S}=s.email_accounts;return _==="gmail"?`https://mail.google.com/mail/u/${S}/#all/${s.external_id}`:`https://outlook.office.com/mail/deeplink/read/${encodeURIComponent(s.external_id)}`};return o.jsx(At,{className:Re("hover:shadow-md transition-shadow group cursor-pointer",d&&"ring-2 ring-primary"),onClick:c,children:o.jsxs("div",{className:"p-5",children:[o.jsxs("div",{className:"flex justify-between items-start mb-3 gap-4",children:[o.jsxs("div",{className:"flex gap-3 flex-1 min-w-0",children:[o.jsx("div",{className:Re("w-8 h-8 rounded-full flex-shrink-0 flex items-center justify-center font-bold text-white text-xs",s.category==="spam"?"bg-destructive":"bg-primary"),children:s.sender?.[0]?.toUpperCase()||"?"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("h3",{className:"font-semibold text-sm line-clamp-1 group-hover:text-primary transition-colors",children:s.subject||"No Subject"}),o.jsx("p",{className:"text-xs text-muted-foreground truncate",title:s.sender||"",children:s.sender})]})]}),o.jsxs("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[o.jsx("span",{className:Re("px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider",p),children:s.category||"unknown"}),o.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.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(Or,{className:"w-2.5 h-2.5"})," Queued"]}),s.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"]}),s.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(Hi,{className:"w-2.5 h-2.5"})," Analyzed"]}),s.processing_status==="failed"&&o.jsxs("div",{className:"flex items-center gap-1",children:[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:s.processing_error||"Unknown error",children:[o.jsx(Mr,{className:"w-2.5 h-2.5"})," Failed"]}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-5 w-5 text-red-600 hover:bg-red-500/10",onClick:_=>{_.stopPropagation(),r(s)},title:"Retry Processing",children:o.jsx(qs,{className:"w-2.5 h-2.5"})})]}),!s.processing_status&&!s.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"]}),!s.processing_status&&s.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(Hi,{className:"w-2.5 h-2.5"})," Analyzed"]})]}),o.jsxs("div",{className:"flex items-center justify-end gap-2 text-[10px] text-muted-foreground/80 leading-tight",children:[o.jsxs("span",{title:s.date?new Date(s.date).toLocaleString():"",className:"whitespace-nowrap",children:[o.jsx("span",{className:"opacity-70 text-[9px]",children:"REC:"})," ",s.date?new Date(s.date).toLocaleString([],{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-"]}),o.jsx("span",{className:"opacity-30",children:"•"}),o.jsxs("span",{title:new Date(s.created_at).toLocaleString(),className:"whitespace-nowrap",children:[o.jsx("span",{className:"opacity-70 text-[9px]",children:"PROC:"})," ",new Date(s.created_at).toLocaleString([],{year:"numeric",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:s.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($d,{className:"w-3.5 h-3.5 text-emerald-500"}),"Suggested:",s.suggested_actions&&s.suggested_actions.length>0?o.jsx("div",{className:"flex gap-1 flex-wrap",children:s.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:s.suggested_action||"none"}),s.actions_taken&&s.actions_taken.length>0?o.jsxs("span",{className:"text-muted-foreground ml-2 truncate max-w-[100px]",title:s.actions_taken.join(", "),children:["(Done: ",s.actions_taken.join(", "),")"]}):s.action_taken?o.jsxs("span",{className:"text-muted-foreground ml-2",children:["(Done: ",s.action_taken,")"]}):null]}),o.jsx("div",{className:"flex gap-1 items-center",onClick:_=>_.stopPropagation(),children:m?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(s,"delete"),disabled:g,children:h==="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:y,disabled:g,children:"No"})]}):o.jsxs(o.Fragment,{children:[o.jsx("a",{href:w(),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 ${s.email_accounts?.provider==="gmail"?"Gmail":"Outlook"}`,children:o.jsx(Gi,{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:()=>l(s),title:"View AI Trace (Prompt/Response)",children:o.jsx(nw,{className:"w-3.5 h-3.5"})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-destructive",onClick:()=>a(s,"delete"),disabled:g,title:"Delete",children:h==="delete"?o.jsx($t,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(Uo,{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(s,"archive"),disabled:g,title:"Archive",children:h==="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(s,"flag"),disabled:g,title:"Flag",children:h==="flag"?o.jsx($t,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(iw,{className:"w-3.5 h-3.5"})})]})})]})]})})}function d2(){const{state:s,actions:a}=qr(),[r,l]=x.useState(!1),[c,d]=x.useState(!1),[h,m]=x.useState(null),[y,p]=x.useState(!1),[g,w]=x.useState(!1),[_,S]=x.useState({}),[E,j]=x.useState(!1),[R,D]=x.useState("credentials"),[B,q]=x.useState(""),[P,W]=x.useState(""),[Y,I]=x.useState(""),[X,oe]=x.useState(""),[Ue,ge]=x.useState(!1),[pe,Ke]=x.useState(!1),[Ge,je]=x.useState(!1),[C,J]=x.useState("credentials"),[K,_e]=x.useState(""),[Ne,A]=x.useState(""),[V,Q]=x.useState(!1),[F,de]=x.useState(!1),[ye,ue]=x.useState(""),[Ye,Be]=x.useState("category"),[Ct,pt]=x.useState("newsletter"),[xt,rs]=x.useState(["archive"]),[la,is]=x.useState(""),[wn,_n]=x.useState(""),[$r,ls]=x.useState(""),[Sn,os]=x.useState(""),[sl,$s]=x.useState([]),[gt,nl]=x.useState(!1),[Hr,Vr]=x.useState(!1),[Ma,jn]=x.useState(null),[ya,Nn]=x.useState(null);x.useEffect(()=>{a.fetchAccounts(),a.fetchRules(),a.fetchSettings()},[]),x.useEffect(()=>{s.settings&&S(s.settings)},[s.settings]);const Zo=async()=>{const O=s.rules.find(ee=>ee.name==="Auto-Trash Spam");if(!O){te.error("System rule not found. Please sync your database.");return}jn("auto_trash_spam"),await a.toggleRule(O.id),jn(null)},Hs=async()=>{const O=s.rules.find(ee=>ee.name==="Smart Drafts");if(!O){te.error("System rule not found. Please sync your database.");return}jn("smart_drafts"),await a.toggleRule(O.id),jn(null)},wt=O=>{Nn(O),ue(O.name);const ee=O.condition,yt=Object.keys(ee).filter(Gs=>Gs!=="older_than_days")[0]||"category";Be(yt),pt(ee[yt]||""),is(ee.older_than_days?.toString()||"");const Is=O.actions&&O.actions.length>0?O.actions:O.action?[O.action]:["archive"];rs(Is),_n(O.instructions||""),ls(O.description||""),os(O.intent||""),$s(O.attachments||[]),de(!0)},va=x.useRef(null),Ot=()=>{D("credentials"),q(""),W(""),I(""),oe(""),j(!0)},Fo=O=>{q(O);try{const ee=JSON.parse(O),ke=ee.installed||ee.web||ee;ke.client_id&&W(ke.client_id),ke.client_secret&&I(ke.client_secret),ee.installed?te.success("Detected Desktop app credentials"):ee.web&&te.info("Detected Web app - make sure redirect URI is configured in Google Cloud Console")}catch{}},Wo=async()=>{if(!P||!Y){te.error("Please provide both Client ID and Client Secret");return}ge(!0);try{if(await a.updateSettings({..._,google_client_id:P,google_client_secret:Y})){S(ke=>({...ke,google_client_id:P,google_client_secret:Y}));const ee=await ze.getGmailAuthUrl();if(ee.data?.url)window.open(ee.data.url,"_blank"),D("code"),te.success("Please authorize in the opened tab, then paste the code here");else{const ke=typeof ee.error=="string"?ee.error:ee.error?.message;te.error(ke||"Failed to get OAuth URL")}}else te.error("Failed to save credentials")}catch{te.error("Failed to save credentials")}finally{ge(!1)}},ec=async()=>{if(!X.trim()){te.error("Please paste the authorization code");return}Ke(!0);try{const O=await ze.connectGmail(X.trim());if(O.data?.success)te.success("Gmail account connected successfully!"),j(!1),a.fetchAccounts();else{const ee=typeof O.error=="string"?O.error:O.error?.message;te.error(ee||"Failed to connect Gmail")}}catch{te.error("Failed to connect Gmail")}finally{Ke(!1)}},En=()=>{J("credentials"),_e(""),A(""),je(!0)},Tn=async()=>{if(!K){te.error("Please provide the Client ID");return}Q(!0);try{if(await a.updateSettings({..._,microsoft_client_id:K,microsoft_tenant_id:Ne||"common"})){S(ke=>({...ke,microsoft_client_id:K,microsoft_tenant_id:Ne||"common"}));const ee=await ze.startMicrosoftDeviceFlow();if(ee.data)m(ee.data),J("device-code"),An(ee.data.deviceCode,ee.data.interval);else{const ke=typeof ee.error=="string"?ee.error:ee.error?.message;te.error(ke||"Failed to start device flow")}}else te.error("Failed to save credentials")}catch{te.error("Failed to save credentials")}finally{Q(!1)}},An=async(O,ee)=>{const ke=setInterval(async()=>{try{const yt=await ze.pollMicrosoftDeviceCode(O);yt.data?.status==="completed"?(clearInterval(ke),m(null),d(!1),je(!1),te.success("Outlook account connected"),a.fetchAccounts()):yt.error&&typeof yt.error=="object"&&yt.error.code}catch{}},ee*1e3);setTimeout(()=>{clearInterval(ke),c&&(m(null),d(!1),je(!1),te.error("Connection timed out. Please try again."))},900*1e3)},za=async()=>{if(!ye){te.error("Please name your rule");return}if(xt.length===0){te.error("Please select at least one action");return}Vr(!0);try{const O={[Ye]:Ct};la&&(O.older_than_days=parseInt(la,10));const ee=xt.includes("draft"),ke={name:ye,description:$r||void 0,intent:Sn||void 0,condition:O,actions:xt,instructions:ee?wn:void 0,attachments:ee?sl:[],is_enabled:!0};let yt=!1;ya?yt=await a.updateRule(ya.id,ke):yt=await a.createRule(ke),yt?(te.success(ya?"Rule updated":"Rule created"),de(!1),Nn(null),ue(""),rs(["archive"]),is(""),_n(""),ls(""),os(""),$s([]),a.fetchRules()):te.error(`Failed to ${ya?"update":"create"} rule`)}catch{te.error("An error occurred while saving the rule")}finally{Vr(!1)}},Cn=async O=>{if(!confirm("Are you sure you want to disconnect this account?"))return;await a.disconnectAccount(O)&&te.success("Account disconnected")},cs=async()=>{p(!0);const O=await a.updateSettings(_);p(!1),O&&te.success("Settings saved")},tc=async()=>{w(!0);try{const O=await ze.testLlm({llm_model:_.llm_model||null,llm_base_url:_.llm_base_url||null,llm_api_key:_.llm_api_key||null});O.data?.success?te.success(O.data.message):te.error(O.data?.message||"Connection test failed")}catch{te.error("Failed to test connection")}finally{w(!1)}},rl=async O=>{await a.toggleRule(O)},Ir=async O=>{const ee=O.target.files;if(!ee||ee.length===0)return;nl(!0);const ke=ee[0],yt=ke.name.split(".").pop(),Is=`${Math.random().toString(36).substring(2)}.${yt}`,Gs=`${s.user.id}/${Is}`;try{const{error:Ps}=await ct.storage.from("rule-attachments").upload(Gs,ke);if(Ps)throw Ps;const ba={name:ke.name,path:Gs,type:ke.type,size:ke.size};$s(ut=>[...ut,ba]),te.success("File uploaded")}catch(Ps){console.error("Upload error:",Ps),te.error("Failed to upload file")}finally{nl(!1),O.target.value=""}},Vs=O=>{$s(ee=>ee.filter(ke=>ke.path!==O))},ac=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(yn,{open:E,onOpenChange:j,children:o.jsxs(vn,{className:"sm:max-w-lg",children:[o.jsxs(Oa,{children:[o.jsxs(Ra,{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(Da,{children:R==="credentials"?"Enter your Google OAuth credentials to connect your Gmail account.":"Paste the authorization code from Google to complete the connection."})]}),R==="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(Qw,{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:B,onChange:O=>Fo(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(Se,{placeholder:"xxx.apps.googleusercontent.com",value:P,onChange:O=>W(O.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client Secret"}),o.jsx(Se,{type:"password",placeholder:"GOCSPX-...",value:Y,onChange:O=>I(O.target.value)})]})]})]}),o.jsxs(Tr,{children:[o.jsx(Z,{variant:"outline",onClick:()=>j(!1),children:"Cancel"}),o.jsxs(Z,{onClick:Wo,disabled:Ue||!P||!Y,children:[Ue?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(Na,{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(Se,{placeholder:"4/0AQlEd8x...",value:X,onChange:O=>oe(O.target.value),className:"font-mono"})]})]}),o.jsxs(Tr,{children:[o.jsx(Z,{variant:"outline",onClick:()=>D("credentials"),children:"Back"}),o.jsxs(Z,{onClick:ec,disabled:pe||!X.trim(),children:[pe?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(Na,{className:"w-4 h-4 mr-2"}),"Connect"]})]})]})]})}),o.jsx(yn,{open:Ge,onOpenChange:je,children:o.jsxs(vn,{className:"sm:max-w-lg",children:[o.jsxs(Oa,{children:[o.jsxs(Ra,{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(Da,{children:C==="credentials"?"Enter your Microsoft Azure App credentials to connect your Outlook account.":"Follow the instructions to authorize the application."})]}),C==="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(Se,{placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",value:K,onChange:O=>_e(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(Se,{placeholder:"common",value:Ne,onChange:O=>A(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(Tr,{children:[o.jsx(Z,{variant:"outline",onClick:()=>je(!1),children:"Cancel"}),o.jsxs(Z,{onClick:Tn,disabled:V||!K,children:[V?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(Na,{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(Gi,{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(mt,{size:"sm"}),"Waiting for authorization..."]})})]}),o.jsx(Tr,{children:o.jsx(Z,{variant:"outline",onClick:()=>je(!1),children:"Cancel"})})]})]})}),o.jsx(yn,{open:F,onOpenChange:O=>{de(O),O||Nn(null)},children:o.jsxs(vn,{className:"sm:max-w-xl max-h-[90vh] flex flex-col p-0",children:[o.jsxs(Oa,{className:"p-6 border-b",children:[o.jsx(Ra,{children:ya?"Edit Auto-Pilot Rule":"Create Auto-Pilot Rule"}),o.jsx(Da,{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(Se,{placeholder:"e.g. Archive Newsletters",value:ye,onChange:O=>ue(O.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Description"}),o.jsx("textarea",{className:"w-full p-2 border rounded-md bg-background min-h-[60px] text-sm",placeholder:"e.g. Handle all marketing newsletters and promotional content from subscription services",value:$r,onChange:O=>ls(O.target.value)}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Describe what this rule is for. The AI uses this to semantically match emails."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Intent"}),o.jsx(Se,{placeholder:"e.g. Politely decline all sales pitches",value:Sn,onChange:O=>os(O.target.value)}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"The goal of this rule. Used to generate appropriate draft replies."})]}),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:Ye,onChange:O=>{Be(O.target.value),O.target.value==="category"?pt("newsletter"):O.target.value==="sentiment"?pt("Positive"):O.target.value==="priority"?pt("High"):pt("")},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"}),Ye==="category"?o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Ct,onChange:O=>pt(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"})]}):Ye==="sentiment"?o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Ct,onChange:O=>pt(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"})]}):Ye==="priority"?o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Ct,onChange:O=>pt(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(Se,{placeholder:Ye==="sender_domain"?"rta.vn":Ye==="sender_email"?"john@example.com":"Keywords...",value:Ct,onChange:O=>pt(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(Or,{className:"w-4 h-4"}),"Only if email is older than... (Optional)"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Se,{type:"number",min:"0",placeholder:"0",className:"w-24",value:la,onChange:O=>is(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 ${xt.includes(O.value)?"bg-primary/10 border-primary":"bg-background hover:bg-secondary/50"}`,children:[o.jsx("input",{type:"checkbox",checked:xt.includes(O.value),onChange:ee=>{ee.target.checked?rs([...xt,O.value]):rs(xt.filter(ke=>ke!==O.value))},className:"rounded border-gray-300"}),o.jsx("span",{className:"text-sm",children:O.label})]},O.value))})]}),xt.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:wn,onChange:O=>_n(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(wg,{className:"w-4 h-4"}),"Attachments (Optional)"]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[sl.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:()=>Vs(O.path),children:o.jsx(tl,{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:Ir,disabled:gt}),o.jsxs(Z,{variant:"outline",size:"sm",className:"w-full border-dashed",disabled:gt,children:[gt?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(zi,{className:"w-3 h-3 mr-2"}),gt?"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(Tr,{className:"p-6 border-t bg-secondary/5",children:[o.jsx(Z,{variant:"outline",onClick:()=>de(!1),children:"Cancel"}),o.jsxs(Z,{onClick:za,disabled:Hr,children:[Hr?o.jsx(mt,{size:"sm",className:"mr-2"}):ya?o.jsx(Na,{className:"w-4 h-4 mr-2"}):o.jsx(zi,{className:"w-4 h-4 mr-2"}),ya?"Save Changes":"Create Rule"]})]})]})}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[o.jsxs(At,{children:[o.jsxs(Aa,{children:[o.jsxs(Ca,{className:"flex items-center gap-2",children:[o.jsx(Ii,{className:"w-5 h-5 text-primary"}),"Connected Accounts"]}),o.jsx(as,{children:"Manage your email providers"})]}),o.jsxs(ka,{className:"space-y-4",children:[s.accounts.length===0?o.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No accounts connected yet"}):s.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:[ac(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:()=>Cn(O.id),children:o.jsx(Uo,{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:Ot,disabled:r||c,children:[r?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(zi,{className:"w-4 h-4 mr-2"}),"Connect Gmail Account"]}),o.jsxs(Z,{className:"w-full border-dashed",variant:"outline",onClick:En,disabled:r||c,children:[c&&!h?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(zi,{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(Gi,{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(At,{children:[o.jsxs(Aa,{children:[o.jsxs(Ca,{className:"flex items-center gap-2",children:[o.jsx($d,{className:"w-5 h-5 text-emerald-500"}),"Auto-Pilot Rules"]}),o.jsx(as,{children:"Configure AI automation behavior"})]}),o.jsxs(ka,{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=s.rules.find(ee=>ee.name==="Auto-Trash Spam");O&&wt(O)},title:"Edit Logic",children:o.jsx(vd,{className:"w-4 h-4 text-muted-foreground"})}),o.jsxs(Z,{variant:s.rules.find(O=>O.name==="Auto-Trash Spam")?.is_enabled?"default":"outline",size:"sm",onClick:Zo,disabled:Ma==="auto_trash_spam",children:[Ma==="auto_trash_spam"?o.jsx(mt,{size:"sm",className:"mr-1"}):o.jsx(bo,{className:"w-4 h-4 mr-1"}),s.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=s.rules.find(ee=>ee.name==="Smart Drafts");O&&wt(O)},title:"Edit Logic",children:o.jsx(vd,{className:"w-4 h-4 text-muted-foreground"})}),o.jsxs(Z,{variant:s.rules.find(O=>O.name==="Smart Drafts")?.is_enabled?"default":"outline",size:"sm",onClick:Hs,disabled:Ma==="smart_drafts",children:[Ma==="smart_drafts"?o.jsx(mt,{size:"sm",className:"mr-1"}):o.jsx(bo,{className:"w-4 h-4 mr-1"}),s.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:()=>{Nn(null),ue(""),ls(""),os(""),rs(["archive"]),is(""),_n(""),$s([]),de(!0)},children:[o.jsx(zi,{className:"w-4 h-4 mr-1"})," Add Rule"]})]}),s.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"}),s.rules.length>0&&s.rules.filter(O=>O.name!=="Auto-Trash Spam"&&O.name!=="Smart Drafts").map(O=>{const ee=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:["→ ",ee.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:()=>wt(O),title:"Edit Rule",children:o.jsx(vd,{className:"w-3.5 h-3.5 text-muted-foreground"})}),o.jsxs(Z,{variant:O.is_enabled?"default":"outline",size:"sm",onClick:()=>rl(O.id),className:"h-7 px-2",children:[o.jsx(bo,{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(Uo,{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(ke=>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(wg,{className:"w-2.5 h-2.5"}),ke.name]},ke.path))})]},O.id)})]})]})]})]}),o.jsxs(At,{children:[o.jsxs(Aa,{children:[o.jsxs(Ca,{className:"flex items-center gap-2",children:[o.jsx(qs,{className:"w-5 h-5 text-indigo-500"}),"Model Configuration"]}),o.jsx(as,{children:"Configure Local LLM or API settings"})]}),o.jsxs(ka,{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(Se,{placeholder:"gpt-4o-mini",value:_.llm_model||"",onChange:O=>S(ee=>({...ee,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(Se,{placeholder:"https://api.openai.com/v1",value:_.llm_base_url||"",onChange:O=>S(ee=>({...ee,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(Se,{type:"password",placeholder:"sk-...",value:_.llm_api_key||"",onChange:O=>S(ee=>({...ee,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(Ii,{className:"w-4 h-4"}),"Local Storage Path (.eml)"]}),o.jsx(Se,{placeholder:"e.g. ./data/emails or ~/.email-automator/emails",value:_.storage_path||"",onChange:O=>S(ee=>({...ee,storage_path:O.target.value}))}),o.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"Directory where raw emails (.eml) are saved. Default: ./data/emails (falls back to ~/.email-automator/emails if restricted)."})]}),o.jsxs("div",{className:"flex justify-between items-center py-3 border-t border-border/50",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium text-sm",children:"Intelligent Rename"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Use slugified-hyphenated filenames (e.g. 20240119-1430-subject-id.eml)"})]}),o.jsxs(Z,{variant:_.intelligent_rename?"default":"outline",size:"sm",onClick:()=>S(O=>({...O,intelligent_rename:!O.intelligent_rename})),children:[o.jsx(bo,{className:"w-4 h-4 mr-1"}),_.intelligent_rename?"On":"Off"]})]}),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(Or,{className:"w-4 h-4"}),"Background Sync Interval (minutes)"]}),o.jsx(Se,{type:"number",min:1,max:1440,value:_.sync_interval_minutes||5,onChange:O=>S(ee=>({...ee,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:tc,disabled:g,children:[g?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(qs,{className:"w-4 h-4 mr-2"}),"Check Connection"]}),o.jsxs(Z,{onClick:cs,disabled:y,children:[y?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(Na,{className:"w-4 h-4 mr-2"}),"Save Configuration"]})]})]})]}),o.jsx("div",{ref:va,children:o.jsxs(At,{children:[o.jsxs(Aa,{children:[o.jsxs(Ca,{className:"flex items-center gap-2",children:[o.jsx($d,{className:"w-5 h-5 text-orange-500"}),"Provider Credentials (Advanced)"]}),o.jsx(as,{children:"Bring Your Own Keys (BYOK). Configure your own OAuth credentials here. Leave empty to use system defaults."})]}),o.jsxs(ka,{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(Se,{type:"password",placeholder:"...apps.googleusercontent.com",value:_.google_client_id||"",onChange:O=>S(ee=>({...ee,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(Se,{type:"password",placeholder:"GOCSPX-...",value:_.google_client_secret||"",onChange:O=>S(ee=>({...ee,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(Se,{type:"password",value:_.microsoft_client_id||"",onChange:O=>S(ee=>({...ee,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(Se,{type:"password",value:_.microsoft_client_secret||"",onChange:O=>S(ee=>({...ee,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(Se,{placeholder:"common",value:_.microsoft_tenant_id||"",onChange:O=>S(ee=>({...ee,microsoft_tenant_id:O.target.value}))})]})]})]}),o.jsx("div",{className:"flex justify-end mt-4",children:o.jsxs(Z,{onClick:cs,disabled:y,variant:"secondary",children:[y?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(Na,{className:"w-4 h-4 mr-2"}),"Save Credentials"]})})]})]})})]})}const f2="modulepreload",h2=function(s){return"/"+s},my={},m2=function(a,r,l){let c=Promise.resolve();if(r&&r.length>0){let p=function(g){return Promise.all(g.map(w=>Promise.resolve(w).then(_=>({status:"fulfilled",value:_}),_=>({status:"rejected",reason:_}))))};var h=p;document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),y=m?.nonce||m?.getAttribute("nonce");c=p(r.map(g=>{if(g=h2(g),g in my)return;my[g]=!0;const w=g.endsWith(".css"),_=w?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${_}`))return;const S=document.createElement("link");if(S.rel=w?"stylesheet":f2,w||(S.as="script"),S.crossOrigin="",S.href=g,y&&S.setAttribute("nonce",y),document.head.appendChild(S),w)return new Promise((E,j)=>{S.addEventListener("load",E),S.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${g}`)))})}))}function d(m){const y=new Event("vite:preloadError",{cancelable:!0});if(y.payload=m,window.dispatchEvent(y),!y.defaultPrevented)throw m}return c.then(m=>{for(const y of m||[])y.status==="rejected"&&d(y.reason);return a().catch(d)})};function p2(){const[s,a]=x.useState("profile"),{state:r,actions:l}=qr();x.useEffect(()=>{l.fetchProfile()},[]);const c=[{id:"profile",label:"Profile",icon:xy},{id:"security",label:"Security",icon:Iw},{id:"database",label:"Supabase",icon:Ii}];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.jsxs("aside",{className:"w-full md:w-64 flex flex-col justify-between",children:[o.jsx("nav",{className:"space-y-1",children:c.map(d=>{const h=d.icon,m=s===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:"mt-8 px-4 py-4 border-t border-border/40 text-center md:text-left",children:[o.jsx("p",{className:"text-[10px] font-bold text-muted-foreground/50 uppercase tracking-widest mb-1",children:"Version"}),o.jsxs("p",{className:"text-xs font-mono text-muted-foreground/70",children:["v","2.9.7"]})]})]}),o.jsxs("div",{className:"flex-1 space-y-6",children:[s==="profile"&&o.jsx(g2,{}),s==="security"&&o.jsx(y2,{}),s==="database"&&o.jsx(v2,{})]})]})]})}function g2(){const{state:s,actions:a}=qr(),[r,l]=x.useState(""),[c,d]=x.useState(""),[h,m]=x.useState(!1),[y,p]=x.useState(!1),[g,w]=x.useState(Ta.isEnabled());x.useEffect(()=>{s.profile&&(l(s.profile.first_name||""),d(s.profile.last_name||""))},[s.profile]);const _=()=>{const j=!g;Ta.setEnabled(j),w(j),j?(Ta.playSuccess(),te.success("Sound effects enabled")):te.info("Sound effects disabled")},S=async()=>{m(!0);const j=await a.updateProfile({first_name:r,last_name:c});m(!1),j&&te.success("Profile updated")},E=async j=>{const R=j.target.files?.[0];if(!(!R||!s.user)){p(!0);try{const D=R.name.split(".").pop(),B=`${s.user.id}/avatar.${D}`,{data:q,error:P}=await ct.storage.from("avatars").upload(B,R,{upsert:!0});if(P)throw P;const{data:{publicUrl:W}}=ct.storage.from("avatars").getPublicUrl(B);await a.updateProfile({avatar_url:W}),te.success("Avatar updated")}catch(D){console.error("Avatar upload error:",D),te.error("Failed to upload avatar")}finally{p(!1)}}};return o.jsxs(At,{children:[o.jsxs(Aa,{children:[o.jsx(Ca,{children:"Profile Information"}),o.jsx(as,{children:"Update your personal details and avatar."})]}),o.jsxs(ka,{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:s.profile?.avatar_url?o.jsx("img",{src:s.profile.avatar_url,alt:"Avatar",className:"w-full h-full object-cover"}):o.jsx(xy,{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(Rx,{className:"w-6 h-6 text-white"}),o.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:E,disabled:y})]}),y&&o.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/60 rounded-full",children:o.jsx(mt,{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(pa,{htmlFor:"first-name",children:"First Name"}),o.jsx(Se,{id:"first-name",value:r,onChange:j=>l(j.target.value),placeholder:"John"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(pa,{htmlFor:"last-name",children:"Last Name"}),o.jsx(Se,{id:"last-name",value:c,onChange:j=>d(j.target.value),placeholder:"Doe"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(pa,{htmlFor:"email",children:"Email Address"}),o.jsx(Se,{id:"email",value:s.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:g?"default":"outline",size:"sm",onClick:_,className:"gap-2",children:[g?o.jsx(t_,{className:"w-4 h-4"}):o.jsx(s_,{className:"w-4 h-4"}),g?"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(mt,{size:"sm",className:"mr-2"}):o.jsx(Dw,{className:"w-4 h-4 mr-2"}),"Save Changes"]})})]})]})}function y2(){const[s,a]=x.useState(""),[r,l]=x.useState(""),[c,d]=x.useState(!1),h=async()=>{if(!s){te.error("Please enter a new password");return}if(s!==r){te.error("Passwords do not match");return}if(s.length<6){te.error("Password must be at least 6 characters");return}d(!0);try{const{api:m}=await m2(async()=>{const{api:p}=await Promise.resolve().then(()=>Ij);return{api:p}},void 0),y=await m.changePassword(s);y.success?(te.success("Password changed successfully"),a(""),l("")):te.error(y.error?.message||"Failed to change password")}catch{te.error("An error occurred")}finally{d(!1)}};return o.jsxs(At,{children:[o.jsxs(Aa,{children:[o.jsx(Ca,{children:"Security"}),o.jsx(as,{children:"Manage your password and account security."})]}),o.jsxs(ka,{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(pa,{htmlFor:"new-password",children:"New Password"}),o.jsx(Se,{id:"new-password",type:"password",value:s,onChange:m=>a(m.target.value),placeholder:"••••••••"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(pa,{htmlFor:"confirm-password",children:"Confirm New Password"}),o.jsx(Se,{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(mt,{size:"sm",className:"mr-2"}):o.jsx(hw,{className:"w-4 h-4 mr-2"}),"Update Password"]})})]})]})}function v2(){const[s,a]=x.useState(!1),r=Br(),l=$j(),c=()=>{confirm("Are you sure you want to disconnect from this Supabase project? This will log you out and clear local configuration.")&&(qj(),window.location.reload())};return o.jsxs(o.Fragment,{children:[o.jsxs(At,{children:[o.jsxs(Aa,{children:[o.jsxs(Ca,{className:"flex items-center gap-2",children:[o.jsx(Ii,{className:"w-5 h-5 text-primary"}),"Supabase Connection"]}),o.jsx(as,{children:"Manage your database configuration (BYOK - Bring Your Own Keys)."})]}),o.jsx(ka,{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(Vi,{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(Wi,{className:"bg-amber-500/5 border-amber-500/20",children:[o.jsx(qd,{className:"h-4 w-4 text-amber-500"}),o.jsx(el,{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(qd,{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(Uo,{className:"w-4 h-4 mr-2"}),"Clear Config"]})]}),o.jsxs("div",{className:"space-y-2 pt-4 border-t",children:[o.jsx(pa,{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(Xx,{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(Ii,{className:"w-4 h-4 mr-2"}),"Setup Supabase"]})]})})]}),o.jsx(Vv,{open:s,onComplete:()=>a(!1),canClose:!0})]})}function b2({length:s=6,value:a,onChange:r,onComplete:l,disabled:c=!1,error:d=!1}){const h=x.useRef([]),[m,y]=x.useState(null),p=(_,S)=>{const E=S.replace(/[^0-9]/g,"");if(E.length===0){const D=a.split("");D[_]=" ",a.split("");let B=a.split("");_<B.length&&B.splice(_,1);const q=B.join("");r(q),_>0&&h.current[_-1]?.focus();return}a.split("");const j=[...a];j[_]=E[0],r(j.join("")),_<s-1&&h.current[_+1]?.focus();const R=j.join("");R.length===s&&l&&l(R)},g=(_,S)=>{S.key==="Backspace"&&!a[_]&&_>0||S.key==="ArrowLeft"&&_>0?h.current[_-1]?.focus():S.key==="ArrowRight"&&_<s-1&&h.current[_+1]?.focus()},w=_=>{_.preventDefault();const E=_.clipboardData.getData("text/plain").replace(/[^0-9]/g,"").slice(0,s);r(E);const j=Math.min(E.length,s-1);h.current[j]?.focus(),E.length===s&&l&&l(E)};return o.jsx("div",{className:"flex gap-2 justify-center",children:Array.from({length:s}).map((_,S)=>o.jsx(Se,{ref:E=>{h.current[S]=E},type:"text",inputMode:"numeric",maxLength:1,value:a[S]||"",onChange:E=>p(S,E.target.value),onKeyDown:E=>g(S,E),onPaste:w,onFocus:()=>y(S),onBlur:()=>y(null),disabled:c,className:Re("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 x2({onSuccess:s,onConfigure:a}){const[r,l]=x.useState(""),[c,d]=x.useState(""),[h,m]=x.useState(""),[y,p]=x.useState(""),[g,w]=x.useState(!1),[_,S]=x.useState(!0),[E,j]=x.useState(!1),[R,D]=x.useState(""),[B,q]=x.useState("password"),[P,W]=x.useState("email"),[Y,I]=x.useState("");x.useEffect(()=>{X()},[]);const X=async()=>{try{const{data:ge,error:pe}=await ct.from("init_state").select("is_initialized");if(pe){console.warn("[Login] Init check failed, defaulting to initialized (Login):",pe),j(!0);return}const Ke=ge?.[0]?.is_initialized>0;j(Ke)}catch(ge){if(console.warn("[Login] Init check exception, defaulting to initialized:",ge),ge.message?.includes("Invalid API key")||ge.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)}},oe=async ge=>{ge.preventDefault(),w(!0),D("");try{if(E){if(B==="password"){const{error:pe}=await ct.auth.signInWithPassword({email:r,password:c});if(pe)throw pe;te.success("Logged in successfully"),s?.()}else if(P==="email"){const{error:pe}=await ct.auth.signInWithOtp({email:r,options:{shouldCreateUser:!1}});if(pe)throw pe;W("verify"),te.success("Validation code sent to your email")}}else{const{data:pe,error:Ke}=await ct.functions.invoke("setup",{body:{email:r,password:c,first_name:h,last_name:y}});if(Ke||!pe){if(Ke?.message?.includes("First user already exists")){te.info("System already initialized. Please log in."),j(!0);return}throw new Error(Ke?.message||"Failed to create admin account")}te.success("Admin account created! Signing you in...");const{error:Ge}=await ct.auth.signInWithPassword({email:r,password:c});if(Ge)throw Ge;j(!0),s?.()}}catch(pe){D(pe?.message||"Authentication failed"),console.error("[Login] Error:",pe)}finally{w(!1)}},Ue=async()=>{w(!0),D("");try{const{data:ge,error:pe}=await ct.auth.verifyOtp({email:r,token:Y,type:"magiclink"});if(pe)throw pe;if(!ge.session)throw new Error("Failed to create session");te.success("Logged in successfully"),s?.()}catch(ge){D(ge?.message||"Invalid code")}finally{w(!1)}};return _?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(qy,{})}),o.jsxs(At,{className:"w-full max-w-md shadow-2xl",children:[o.jsxs(Aa,{className:"text-center",children:[o.jsx("div",{className:"mx-auto bg-primary/10 p-4 rounded-full w-fit mb-4",children:o.jsx(bf,{className:"w-12 h-12"})}),o.jsx(Ca,{className:"text-2xl",children:E?"Welcome Back":"Welcome to Email Automator"}),o.jsx(as,{children:E?B==="password"?"Sign in to access your email automation":P==="email"?"Receive a login code via email":`Enter code sent to ${r}`:"Create the first admin account to get started"})]}),o.jsxs("form",{onSubmit:oe,children:[o.jsxs(ka,{className:"space-y-4",children:[!E&&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(Se,{value:h,onChange:ge=>m(ge.target.value),required:!E,placeholder:"John"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Last Name"}),o.jsx(Se,{value:y,onChange:ge=>p(ge.target.value),required:!E,placeholder:"Doe"})]})]}),B==="password"||P==="email"?o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Email"}),o.jsx(Se,{type:"email",placeholder:"admin@example.com",value:r,onChange:ge=>l(ge.target.value),required:!0,autoComplete:"email",disabled:P==="verify"})]}):null,B==="password"&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Password"}),o.jsx(Se,{type:"password",placeholder:"••••••••",value:c,onChange:ge=>d(ge.target.value),required:!0,minLength:6,autoComplete:E?"current-password":"new-password"})]}),B==="otp"&&P==="verify"&&o.jsxs("div",{className:"space-y-4 py-2",children:[o.jsx("div",{className:"flex justify-center",children:o.jsx(b2,{value:Y,onChange:I,length:6,onComplete:()=>{}})}),o.jsx(Z,{type:"button",variant:"link",className:"w-full text-xs text-muted-foreground",onClick:()=>W("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:R}),R.includes("configuration")||R.includes("Invalid API key")||R.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:[B==="otp"&&P==="verify"?o.jsx(Z,{type:"button",onClick:Ue,disabled:g||Y.length!==6,className:"w-full",children:g?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:g||!r||B==="password"&&!c,className:"w-full",children:g?o.jsxs(o.Fragment,{children:[o.jsx($t,{className:"w-4 h-4 mr-2 animate-spin"}),E?B==="otp"?"Send Code":"Signing in...":"Creating Account..."]}):o.jsxs(o.Fragment,{children:[E?B==="otp"?o.jsx(Bd,{className:"w-4 h-4 mr-2"}):o.jsx(vw,{className:"w-4 h-4 mr-2"}):o.jsx(Fw,{className:"w-4 h-4 mr-2"}),E?B==="otp"?"Send Login Code":"Sign In":"Create Admin Account"]})}),E&&o.jsx("div",{className:"flex flex-col gap-2 w-full",children:B==="password"?o.jsxs(Z,{type:"button",variant:"ghost",className:"w-full text-sm font-normal text-muted-foreground hover:text-primary",onClick:()=>{q("otp"),W("email"),D("")},children:[o.jsx(dw,{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:()=>{q("password"),D("")},children:[o.jsx(Nx,{className:"w-4 h-4 mr-2"}),"Sign in with Password"]})}),E&&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,w2=void 0;function _2(s,a){const r=s.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 S2(s){try{const{data:a,error:r}=await s.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 j2(s){const a=Iv,r=w2,l=await S2(s);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=_2(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 N2(s=24){try{const a=localStorage.getItem(Gv);if(!a)return!1;const r=new Date(a).getTime();return(Date.now()-r)/(1e3*60*60)<s}catch(a){return console.error("Error checking migration reminder:",a),!1}}function E2(){try{localStorage.setItem(Gv,new Date().toISOString())}catch(s){console.error("Error dismissing migration reminder:",s)}}function T2({status:s,onDismiss:a,onLearnMore:r}){const[l,c]=x.useState(!0);if(!l)return null;const d=()=>{E2(),c(!1),a?.()},h=()=>{r?r():(navigator.clipboard.writeText("npx email-automator migrate"),te.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(Dr,{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(tl,{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 (",s.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 Ro({code:s,label:a}){const[r,l]=x.useState(!1),c=typeof navigator<"u"&&!!navigator.clipboard?.writeText,d=async()=>{if(!c){te.error("Clipboard not supported");return}try{await navigator.clipboard.writeText(s),l(!0),window.setTimeout(()=>l(!1),2e3),te.success("Copied to clipboard")}catch(h){console.error("Failed to copy:",h),te.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:s})}),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(Na,{className:"h-4 w-4 text-green-600"}):o.jsx(Wx,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:r?"Copied":"Copy code"})]})]})]})}function A2({open:s,onOpenChange:a,status:r}){const l=Br(),[c,d]=x.useState(!0),[h,m]=x.useState(!1),[y,p]=x.useState([]),[g,w]=x.useState(""),[_,S]=x.useState(""),E=x.useRef(null),j=x.useMemo(()=>{const D=l?.url;if(!D)return"";try{return new URL(D).hostname.split(".")[0]||""}catch{return""}},[l?.url]);x.useEffect(()=>{E.current&&E.current.scrollIntoView({behavior:"smooth"})},[y]);const R=async()=>{if(!j){te.error("Missing Project ID");return}if(!_&&!g){te.error("Provide an access token or database password.");return}m(!0),p(["Initializing migration..."]);try{const D=async X=>{const oe=new TextDecoder;let Ue="",ge=null;const pe=Ke=>{const Ge=Ke.replace(/\r$/,"");if(Ge.trim()){if(Ge.startsWith("RESULT:")){const je=Ge.replace("RESULT:","").trim();(je==="success"||je==="failure")&&(ge=je);return}p(je=>[...je,Ge])}};for(;;){const{done:Ke,value:Ge}=await X.read();if(Ke)break;Ue+=oe.decode(Ge,{stream:!0});const je=Ue.split(`
96
- `);Ue=je.pop()||"",je.forEach(pe)}return Ue+=oe.decode(),Ue&&pe(Ue),ge};p(X=>[...X,"","📦 Step 1/2: Database Migration"]);const B=await fetch("/api/migrate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRef:j,dbPassword:g,accessToken:_})});if(!B.ok)throw new Error(`Migration failed: ${B.status} ${B.statusText}`);const q=B.body?.getReader();if(!q)throw new Error("No migration response stream received.");if(await D(q)!=="success")throw new Error("Migration did not complete successfully");p(X=>[...X,"","⚡ Step 2/2: Deploying Edge Functions"]);const W=await fetch("/api/deploy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRef:j,dbPassword:g,accessToken:_})});if(!W.ok)throw new Error(`Deployment failed: ${W.status} ${W.statusText}`);const Y=W.body?.getReader();if(!Y)throw new Error("No deployment response stream received.");if(await D(Y)!=="success")throw new Error("Edge Functions deployment did not complete successfully");p(X=>[...X,"","═".repeat(60),"✅ Setup Complete!","","✓ Database schema updated","✓ Edge Functions deployed","","🎉 Your Email Automator is ready to use!","📝 The application will reload automatically...","═".repeat(60)]),setTimeout(()=>{window.location.reload()},3e3)}catch(D){console.error(D),p(B=>[...B,"",`❌ Error: ${D instanceof Error?D.message:String(D)}`]),te.error("Setup failed. Check logs for details.")}finally{m(!1)}};return o.jsx(yn,{open:s,onOpenChange:D=>!h&&a(D),children:o.jsxs(vn,{className:"max-h-[90vh] sm:max-w-5xl overflow-y-auto",children:[o.jsxs(Oa,{children:[o.jsxs(Ra,{className:"flex items-center gap-2 text-xl",children:[o.jsx(Dr,{className:"h-6 w-6 text-red-700 dark:text-red-600"}),"Database Setup Required"]}),o.jsxs(Da,{children:["Your application version (",r.appVersion,") requires database migration and Edge Functions deployment to function correctly."]})]}),o.jsxs("div",{className:"space-y-6",children:[o.jsxs(Wi,{children:[o.jsx(Rr,{className:"h-4 w-4"}),o.jsxs(el,{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:"Deploys Edge Functions (API endpoints) to your Supabase project"}),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 Setup"}),o.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Run database migration and deploy Edge Functions directly from your browser. No CLI installation required - everything is bundled."}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(pa,{htmlFor:"project-id",children:"Supabase Project ID"}),o.jsx(Se,{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(pa,{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(Gi,{className:"h-3 w-3"})]})]}),o.jsx(Se,{id:"access-token",type:"password",placeholder:"sbp_...",value:_,onChange:D=>S(D.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(pa,{htmlFor:"db-password",children:"Database Password"}),o.jsx(Se,{id:"db-password",type:"password",placeholder:"Your database password",value:g,onChange:D=>w(D.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:R,disabled:h,className:"w-full",children:h?o.jsxs(o.Fragment,{children:[o.jsx($t,{className:"mr-2 h-4 w-4 animate-spin"}),"Running Setup..."]}):o.jsxs(o.Fragment,{children:[o.jsx(Hd,{className:"mr-2 h-4 w-4"}),"Start Setup"]})})]})]}),o.jsxs("div",{className:"rounded-lg border bg-black text-white font-mono text-xs p-4 h-64 overflow-y-auto",children:[y.length===0?o.jsx("div",{className:"text-gray-500 italic",children:"Waiting to start..."}):y.map((D,B)=>o.jsx("div",{className:"mb-1 whitespace-pre-wrap",children:D},B)),o.jsx("div",{ref:E})]})]}):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(Ro,{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(Ro,{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(Ro,{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(Ro,{code:"npx email-automator migrate"})]})]})]}),o.jsxs(Wi,{className:"border-red-200 bg-red-50 dark:border-red-900/40 dark:bg-red-950/20",children:[o.jsx(Dr,{className:"h-4 w-4 text-red-700 dark:text-red-600"}),o.jsxs(el,{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(Tr,{children:o.jsx(Z,{type:"button",variant:"outline",onClick:()=>a(!1),disabled:h,children:"Close"})})]})})}function C2(){const[s,a]=x.useState([]),{isExpanded:r,setIsExpanded:l}=cv(),[c,d]=x.useState({});x.useEffect(()=>{h();const g=ct.channel("processing_events_feed").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events"},w=>{const _=w.new;_.event_type==="error"&&d(S=>({...S,[_.id]:!0})),a(S=>{const E=[_,...S];return _.details?.is_completion&&r&&setTimeout(()=>{l(!1)},3e3),E.length>100?E.slice(0,100):E})}).subscribe();return()=>{ct.removeChannel(g)}},[r,l]);const h=async()=>{const{data:g}=await ct.from("processing_events").select("*").order("created_at",{ascending:!1}).limit(50);g&&a(g)},m=g=>{d(w=>({...w,[g]:!w[g]}))},y=g=>{if(g.details?.is_completion)return o.jsx(Vi,{className:"w-3 h-3 text-emerald-500"});switch(g.event_type){case"analysis":return o.jsx(Hi,{className:"w-3 h-3 text-purple-500"});case"action":return o.jsx(Lo,{className:"w-3 h-3 text-emerald-500"});case"error":return o.jsx(Dr,{className:"w-3 h-3 text-red-500"});default:return o.jsx(Rr,{className:"w-3 h-3 text-blue-500"})}},p=g=>new Date(g).toLocaleTimeString([],{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"});return r?o.jsxs(At,{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(Aa,{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(Hd,{className:"w-4 h-4 text-primary"}),o.jsx(Ca,{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(Sw,{className:"w-4 h-4"})})]})]}),o.jsxs(ka,{className:"flex-1 overflow-y-auto p-4 font-mono text-xs space-y-6 custom-scrollbar",children:[s.length===0&&o.jsx("div",{className:"text-center text-muted-foreground py-20 italic",children:"Waiting for agent activity..."}),s.map((g,w)=>o.jsxs("div",{className:"relative pl-8 animate-in fade-in slide-in-from-top-2 duration-300",children:[w!==s.length-1&&o.jsx("div",{className:"absolute left-[13px] top-7 bottom-[-24px] w-[1px] bg-border"}),o.jsx("div",{className:Re("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",g.event_type==="error"&&"border-red-500/50 bg-red-500/5",g.event_type==="analysis"&&"border-purple-500/50 bg-purple-500/5",g.event_type==="action"&&"border-emerald-500/50 bg-emerald-500/5",g.details?.is_completion&&"border-emerald-500/50 bg-emerald-500/5"),children:y(g)}),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:Re("font-bold uppercase tracking-tight text-[10px]",g.event_type==="info"&&"text-muted-foreground",g.event_type==="analysis"&&"text-purple-600 dark:text-purple-400",g.event_type==="action"&&"text-emerald-600 dark:text-emerald-400",g.event_type==="error"&&"text-red-600 dark:text-red-400"),children:g.agent_state}),o.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:p(g.created_at)})]}),(g.details?.system_prompt||g.details?._raw_response||g.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(g.id),children:[c[g.id]?o.jsx(Vx,{className:"w-3 h-3 mr-1"}):o.jsx(Ux,{className:"w-3 h-3 mr-1"}),"Details"]})]}),g.event_type==="analysis"&&g.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:Re("px-1.5 py-0.5 rounded text-[9px] font-bold border",g.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:g.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:g.details.category})]}),o.jsxs("p",{className:"text-foreground/90 italic leading-relaxed",children:['"',g.details.summary,'"']}),g.details.suggested_actions&&g.details.suggested_actions.length>0&&o.jsx("div",{className:"pt-1 flex items-center gap-2 flex-wrap",children:g.details.suggested_actions.map(_=>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(Lo,{className:"w-2.5 h-2.5"}),_]},_))}),g.details.usage&&o.jsx("div",{className:"pt-1.5 flex items-center gap-3 text-[9px] text-muted-foreground/70 border-t border-purple-500/10 mt-1",children:o.jsxs("span",{children:["Tokens: ",g.details.usage.prompt_tokens," (in) + ",g.details.usage.completion_tokens," (out) = ",o.jsx("span",{className:"text-purple-500 font-bold",children:g.details.usage.total_tokens})]})})]}):g.event_type==="action"&&g.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:[g.details.action==="delete"&&"Moved to Trash",g.details.action==="archive"&&"Archived Email",g.details.action==="draft"&&"Drafted Reply",g.details.action==="read"&&"Marked as Read",g.details.action==="star"&&"Starred Email",!["delete","archive","draft","read","star"].includes(g.details.action)&&g.details.action]}),g.details.reason&&o.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1.5 flex items-center gap-1",children:[o.jsx(Rr,{className:"w-3 h-3"}),g.details.reason]})]}):g.event_type==="error"&&g.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 g.details.error=="object"?g.details.error.message||JSON.stringify(g.details.error):g.details.error}):g.details?.is_completion?o.jsxs("div",{className:"bg-emerald-500/5 border border-emerald-500/20 rounded-lg p-3 space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2 text-emerald-600 dark:text-emerald-400 font-bold uppercase text-[9px] tracking-[0.2em]",children:[o.jsx(Vi,{className:"w-3.5 h-3.5"}),"Batch Sync Finished"]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-1",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("p",{className:"text-[10px] text-muted-foreground uppercase",children:"Processed"}),o.jsx("p",{className:"text-sm font-bold",children:g.details.total_processed||0})]}),o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("p",{className:"text-[10px] text-muted-foreground uppercase",children:"Actions"}),o.jsx("p",{className:"text-sm font-bold text-emerald-500",children:(g.details.deleted||0)+(g.details.drafted||0)})]})]}),g.details.errors>0&&o.jsxs("p",{className:"text-[10px] text-red-500 font-bold pt-1 border-t border-emerald-500/10",children:["⚠️ ",g.details.errors," items failed to process."]})]}):o.jsx("p",{className:"text-muted-foreground leading-relaxed",children:g.details?.message||JSON.stringify(g.details)}),c[g.id]&&o.jsxs("div",{className:"mt-2 space-y-3 animate-in fade-in zoom-in-95 duration-200",children:[g.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(Ls,{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:g.details.system_prompt})})]}),g.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(Ls,{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:g.details.content_preview})})]}),g.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(Ls,{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(g.details._raw_response),null,2)})})]}),g.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(Ls,{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 g.details.raw_response=="object"?JSON.stringify(g.details.raw_response,null,2):g.details.raw_response})})]})]})]})]},g.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(Hd,{className:"w-4 h-4 mr-2"}),"Live Activity",s.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 k2(){const{state:s,isSubscribed:a,actions:r}=qr(),[l,c]=x.useState(!1),[d,h]=x.useState("dashboard"),[m,y]=x.useState(!0),[p,g]=x.useState(!1);if(x.useEffect(()=>{const Y=()=>{if(Ta.isEnabled()){const I=new(window.AudioContext||window.webkitAudioContext);I.state==="suspended"&&I.resume()}window.removeEventListener("click",Y),window.removeEventListener("keydown",Y)};return window.addEventListener("click",Y),window.addEventListener("keydown",Y),()=>{window.removeEventListener("click",Y),window.removeEventListener("keydown",Y)}},[]),x.useEffect(()=>{const I=new URLSearchParams(window.location.search).get("code");I&&!p&&(async()=>{g(!0);try{const oe=await ze.connectGmail(I);if(oe.data?.success)te.success("Gmail connected successfully!"),window.opener?setTimeout(()=>window.close(),1500):(window.history.replaceState({},"",window.location.pathname),r.fetchAccounts());else{const Ue=typeof oe.error=="string"?oe.error:oe.error?.message;te.error(Ue||"Failed to connect Gmail")}}catch{te.error("Connection failed")}finally{g(!1)}})()},[]),p)return o.jsx($i,{text:"Connecting account..."});const[w,_]=x.useState(null),[S,E]=x.useState(!1),[j,R]=x.useState(!1),[D,B]=x.useState(!1);x.useEffect(()=>{(async()=>{const I=Br();if(!I){c(!0),y(!1);return}if((await sv(I.url,I.anonKey)).valid)s.isInitialized&&s.isAuthenticated&&(r.fetchAccounts(),r.fetchRules(),r.fetchSettings(),r.fetchProfile(),j2(ct).then(oe=>{_(oe),oe.needsMigration&&!N2()&&E(!0)}));else{c(!0),y(!1);return}y(!1)})()},[s.isInitialized,s.isAuthenticated]);const q=()=>{R(!0),E(!1)},P={migrationStatus:w,showMigrationBanner:S,showMigrationModal:j,openMigrationModal:q,suppressMigrationBanner:D,setSuppressMigrationBanner:B};if(m)return o.jsx($i,{text:"Checking configuration..."});if(l)return o.jsx(Vv,{onComplete:()=>{c(!1),window.location.reload()}});if(!s.isInitialized)return o.jsx($i,{text:"Initializing..."});if(!s.isAuthenticated)return o.jsx(x2,{onConfigure:()=>c(!0)});const W=async()=>{await ct.auth.signOut(),te.success("Logged out successfully")};return x.useEffect(()=>{const Y=async()=>{try{await ze.healthCheck()}catch{console.warn("[App] Keep-alive ping failed")}};Y();const I=setInterval(Y,3e4);return()=>clearInterval(I)},[]),o.jsx(eN,{value:P,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(bf,{className:"w-8 h-8"}),o.jsx("span",{className:"hidden sm:inline",children:"Email Automator"}),o.jsx("span",{className:"sm:hidden",children:"Email AI"})]}),o.jsxs("div",{className:Re("flex items-center gap-1.5 px-2 h-6 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.jsxs("div",{className:"relative flex items-center justify-center",children:[a&&o.jsx("span",{className:"absolute inline-flex h-3 w-3 rounded-full bg-emerald-500/40 animate-ping"}),o.jsx("div",{className:Re("relative w-2 h-2 rounded-full",a?"bg-emerald-500":"bg-yellow-500")})]}),o.jsx("span",{className:"hidden xs:inline leading-none",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(pw,{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(vy,{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(qd,{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(qy,{}),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:s.profile?.avatar_url?o.jsx("img",{src:s.profile.avatar_url,alt:"Profile",className:"w-full h-full object-cover"}):o.jsx(Yx,{className:"w-5 h-5"})}),o.jsx(Z,{variant:"ghost",size:"sm",onClick:W,className:"text-muted-foreground hover:text-foreground w-8 px-0",title:"Sign out",children:o.jsx(xw,{className:"w-4 h-4"})})]})]})}),o.jsxs("main",{className:"max-w-7xl mx-auto p-4 sm:p-8 mt-4 mb-12",children:[d==="dashboard"&&o.jsx(l2,{}),d==="config"&&o.jsx(d2,{}),d==="analytics"&&o.jsx(R2,{}),d==="account"&&o.jsx(p2,{})]}),o.jsx("footer",{className:"max-w-7xl mx-auto px-4 sm:px-8 pb-8 text-center sm:text-left",children:o.jsxs("p",{className:"text-[10px] font-medium text-muted-foreground/40 uppercase tracking-[0.2em]",children:["Email Automator ",o.jsx("span",{className:"mx-1",children:"•"})," v","2.9.7"]})}),s.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:s.error})})}),w&&S&&!D&&o.jsx(T2,{status:w,onDismiss:()=>E(!1),onLearnMore:q}),w&&o.jsx(A2,{open:j,onOpenChange:R,status:w}),o.jsx(C2,{})]})})}function O2({runId:s,accountEmail:a,isOpen:r,onOpenChange:l}){const[c,d]=x.useState([]),[h,m]=x.useState(!1);x.useEffect(()=>{r&&s&&y()},[r,s]);const y=async()=>{if(s){m(!0);try{const g=await ze.getRunEvents(s);g.data&&d(g.data.events)}catch(g){console.error("Failed to fetch run trace:",g)}finally{m(!1)}}},p=g=>{switch(g){case"analysis":return o.jsx(Hi,{className:"w-4 h-4 text-purple-500"});case"action":return o.jsx(Lo,{className:"w-4 h-4 text-emerald-500"});case"error":return o.jsx(Mr,{className:"w-4 h-4 text-red-500"});default:return o.jsx(Rr,{className:"w-4 h-4 text-blue-500"})}};return o.jsx(yn,{open:r,onOpenChange:l,children:o.jsxs(vn,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 overflow-hidden",children:[o.jsxs(Oa,{className:"p-6 border-b",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(cf,{className:"w-5 h-5 text-primary"}),o.jsx(Ra,{children:"Sync Run Trace"})]}),o.jsx(Da,{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($i,{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((g,w)=>o.jsxs("div",{className:"relative pl-8",children:[w!==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:p(g.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:g.agent_state}),g.emails?.subject&&o.jsxs("span",{className:"text-[10px] text-primary font-medium truncate max-w-[300px]",children:["Re: ",g.emails.subject]})]}),o.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(Or,{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-2",children:[o.jsxs("p",{className:"text-xs text-foreground italic leading-relaxed",children:['"',g.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:g.details?.category}),g.details?.suggested_actions?.map(_=>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:_},_))]}),g.details?.usage&&o.jsxs("div",{className:"flex gap-3 pt-1.5 mt-1 border-t border-border/50 text-[9px] text-muted-foreground",children:[o.jsxs("span",{children:["In: ",o.jsx("b",{children:g.details.usage.prompt_tokens})]}),o.jsxs("span",{children:["Out: ",o.jsx("b",{children:g.details.usage.completion_tokens})]}),o.jsxs("span",{children:["Total: ",o.jsx("span",{className:"text-primary font-bold",children:g.details.usage.total_tokens})]})]})]}),g.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: ",g.details?.action]}),o.jsx(of,{className:"w-4 h-4 text-emerald-500"})]}),g.event_type==="error"&&o.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 font-bold",children:g.details?.error})]})]})]},g.id))})]})})}function R2(){const{state:s,actions:a}=qr(),[r,l]=x.useState(null),[c,d]=x.useState(void 0),[h,m]=x.useState(!1);if(x.useEffect(()=>{a.fetchStats()},[]),!s.stats)return o.jsx($i,{text:"Loading analytics..."});const y=(g,w)=>{l(g),d(w),m(!0)},{stats:p}=s;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(vy,{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(Do,{title:"Total Emails",value:p.totalEmails,color:"primary"}),o.jsx(Do,{title:"Spam Caught",value:p.categoryCounts.spam||0,color:"destructive"}),o.jsx(Do,{title:"Actions Taken",value:Object.values(p.actionCounts).reduce((g,w)=>g+w,0)-(p.actionCounts.none||0),color:"emerald"}),o.jsx(Do,{title:"Accounts",value:p.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(p.categoryCounts).map(([g,w])=>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:g}),o.jsx("span",{className:"text-muted-foreground",children:w})]}),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:`${w/p.totalEmails*100}%`}})})]})},g))})]}),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(p.actionCounts).map(([g,w])=>o.jsxs("div",{className:"flex items-center justify-between py-2 border-b last:border-0",children:[o.jsx("span",{className:"capitalize",children:g}),o.jsx("span",{className:"font-medium",children:w})]},g))})]})]}),o.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[o.jsx("h3",{className:"font-semibold mb-4",children:"Recent Sync Activity"}),p.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:p.recentSyncs.map(g=>{const w=g.completed_at?Math.round((new Date(g.completed_at).getTime()-new Date(g.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:()=>y(g.id,g.email_accounts?.email_address),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:Re("w-2.5 h-2.5 rounded-full",g.status==="success"?"bg-emerald-500":g.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:g.email_accounts?.email_address||"System Sync"}),o.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(Or,{className:"w-3 h-3"}),new Date(g.started_at).toLocaleString(),w!==null&&o.jsxs("span",{className:"ml-2 px-1.5 py-0.5 bg-secondary rounded-full",children:[w,"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:[g.emails_processed," emails"]}),o.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[g.emails_deleted," deleted, ",g.emails_drafted," drafted"]})]})})]},g.id)})})]}),o.jsx(O2,{runId:r,accountEmail:c,isOpen:h,onOpenChange:m})]})}function Do({title:s,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:s}),o.jsx("p",{className:`text-3xl font-bold ${l[r]||""}`,children:a})]})}function D2(){return o.jsx(l_,{defaultTheme:"system",storageKey:"email-automator-theme",children:o.jsx(aN,{children:o.jsx(tN,{children:o.jsxs(Fj,{children:[o.jsx(k2,{}),o.jsx(Qj,{})]})})})})}fx.createRoot(document.getElementById("root")).render(o.jsx(py.StrictMode,{children:o.jsx(D2,{})}));
95
+ For more information, see https://radix-ui.com/primitives/docs/components/${a.docsSlug}`;return x.useEffect(()=>{s&&(document.getElementById(s)||console.error(r))},[r,s]),null},VE="DialogDescriptionWarning",IE=({contentRef:s,descriptionId:a})=>{const l=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Iv(VE).contentName}}.`;return x.useEffect(()=>{const c=s.current?.getAttribute("aria-describedby");a&&c&&(document.getElementById(a)||console.warn(l))},[l,s,a]),null},GE=kv,PE=Dv,KE=Mv,YE=zv,JE=Lv,XE=qv,QE=Hv;function yn({...s}){return o.jsx(GE,{"data-slot":"dialog",...s})}function ZE({...s}){return o.jsx(PE,{"data-slot":"dialog-portal",...s})}function FE({className:s,...a}){return o.jsx(KE,{"data-slot":"dialog-overlay",className:Oe("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",s),...a})}function vn({className:s,children:a,...r}){return o.jsxs(ZE,{"data-slot":"dialog-portal",children:[o.jsx(FE,{}),o.jsxs(YE,{"data-slot":"dialog-content",className:Oe("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",s),...r,children:[a,o.jsxs(QE,{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(al,{}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Oa({className:s,...a}){return o.jsx("div",{"data-slot":"dialog-header",className:Oe("flex flex-col gap-2 text-center sm:text-left",s),...a})}function Ar({className:s,...a}){return o.jsx("div",{"data-slot":"dialog-footer",className:Oe("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",s),...a})}function Ra({className:s,...a}){return o.jsx(JE,{"data-slot":"dialog-title",className:Oe("text-lg leading-none font-semibold",s),...a})}function Da({className:s,...a}){return o.jsx(XE,{"data-slot":"dialog-description",className:Oe("text-muted-foreground text-sm",s),...a})}const Se=x.forwardRef(({className:s,type:a,...r},l)=>o.jsx("input",{type:a,className:Oe("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",s),ref:l,...r}));Se.displayName="Input";var WE=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],e2=WE.reduce((s,a)=>{const r=Ey(`Primitive.${a}`),l=x.forwardRef((c,d)=>{const{asChild:h,...m}=c,y=h?r:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(y,{...m,ref:d})});return l.displayName=`Primitive.${a}`,{...s,[a]:l}},{}),t2="Label",Gv=x.forwardRef((s,a)=>o.jsx(e2.label,{...s,ref:a,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(s.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Gv.displayName=t2;var a2=Gv;function pa({className:s,...a}){return o.jsx(a2,{"data-slot":"label",className:Oe("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",s),...a})}const s2=Cy("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 el({className:s,variant:a,...r}){return o.jsx("div",{"data-slot":"alert",role:"alert",className:Oe(s2({variant:a}),s),...r})}function tl({className:s,...a}){return o.jsx("div",{"data-slot":"alert-description",className:Oe("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",s),...a})}function Hi({className:s}){return o.jsxs("svg",{width:"512",height:"512",viewBox:"0 0 512 512",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:Oe("w-9 h-9",s),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 py(s){const a=s.trim();return a?a.startsWith("http://")||a.startsWith("https://")?a:`https://${a}.supabase.co`:""}function n2(s){const a=s.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 r2(s){const a=s.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 rf({onComplete:s,open:a=!0,canClose:r=!1}){const[l,c]=x.useState("welcome"),[d,h]=x.useState(""),[m,y]=x.useState(""),[p,g]=x.useState(null),[w,_]=x.useState(!1),[S,E]=x.useState(!1),j=async()=>{g(null),c("validating");const P=py(d),W=m.trim(),Y=await iv(P,W);Y.valid?($j({url:P,anonKey:W}),c("success"),setTimeout(()=>{window.location.reload()},1e3)):(g(Y.error||"Connection failed. Please check your credentials."),c("credentials"))},R=d?n2(d):{valid:!1},D=m?r2(m):{valid:!1},B=d?py(d):"",q=d&&!d.startsWith("http")&&R.valid;return o.jsx(yn,{open:a,onOpenChange:P=>{!P&&r&&s()},children:o.jsxs(vn,{className:"sm:max-w-md",onPointerDownOutside:P=>{r||P.preventDefault()},onEscapeKeyDown:P=>{r||P.preventDefault()},children:[l==="welcome"&&o.jsxs(o.Fragment,{children:[o.jsxs(Oa,{children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[o.jsx(Hi,{className:"w-9 h-9"}),o.jsx(Ra,{children:"Welcome to Email Automator"})]}),o.jsx(Da,{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(el,{children:o.jsxs(tl,{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(Pi,{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:s,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(Oa,{children:[o.jsx(Ra,{children:"Connect to Supabase"}),o.jsx(Da,{children:"Enter your connection details below."})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[p&&o.jsxs(el,{variant:"destructive",children:[o.jsx(zr,{className:"h-4 w-4"}),o.jsx(tl,{children:p})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(pa,{htmlFor:"supabase-url",children:"Project URL or ID"}),o.jsxs("div",{className:"relative",children:[o.jsx(Se,{id:"supabase-url",placeholder:"https://xxx.supabase.co or project-id",value:d,onChange:P=>{h(P.target.value),_(!0)},onBlur:()=>_(!0),className:w&&d?R.valid?"pr-8 border-green-500":"pr-8 border-destructive":""}),w&&d&&R.valid&&o.jsx(Na,{className:"absolute right-2 top-1/2 -translate-y-1/2 h-4 w-4 text-green-500"})]}),q&&o.jsxs("div",{className:"flex items-start gap-1.5 text-xs text-green-600 dark:text-green-400",children:[o.jsx(Na,{className:"h-3 w-3 mt-0.5 flex-shrink-0"}),o.jsxs("span",{children:["Will use: ",B]})]}),w&&d&&R.message&&!R.valid&&o.jsx("p",{className:"text-xs text-destructive",children:R.message})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(pa,{htmlFor:"anon-key",children:"Anon Public Key"}),o.jsxs("div",{className:"relative",children:[o.jsx(Se,{id:"anon-key",type:"password",placeholder:"eyJ...",value:m,onChange:P=>{y(P.target.value),E(!0)},onBlur:()=>E(!0),className:S&&m?D.valid?"pr-8 border-green-500":"pr-8 border-destructive":""}),S&&m&&D.valid&&o.jsx(Na,{className:"absolute right-2 top-1/2 -translate-y-1/2 h-4 w-4 text-green-500"})]}),S&&m&&D.message&&o.jsx("p",{className:`text-xs ${D.valid?"text-green-600 dark:text-green-400":"text-destructive"}`,children:D.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:s,className:"flex-1",children:"Close"}),o.jsx(Z,{onClick:j,disabled:!R.valid||!D.valid,className:"flex-1",children:"Connect"})]})]})]}),l==="validating"&&o.jsxs(o.Fragment,{children:[o.jsxs(Oa,{children:[o.jsx(Ra,{children:"Validating Connection"}),o.jsx(Da,{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(Oa,{children:[o.jsx(Ra,{children:"Success!"}),o.jsx(Da,{children:"Your database is connected."})]}),o.jsxs("div",{className:"flex flex-col items-center justify-center py-8",children:[o.jsx(Ii,{className:"h-12 w-12 text-green-500 mb-4"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Restarting application..."})]})]})]})})}function i2({email:s,isOpen:a,onOpenChange:r,onRetry:l}){const[c,d]=x.useState([]),[h,m]=x.useState(!1);x.useEffect(()=>{a&&s&&y()},[a,s]);const y=async()=>{if(s){m(!0);try{const g=await Me.getEmailEvents(s.id);g.data&&d(g.data.events)}catch(g){console.error("Failed to fetch trace:",g)}finally{m(!1)}}},p=g=>{switch(g){case"analysis":return o.jsx(Vi,{className:"w-4 h-4 text-purple-500"});case"action":return o.jsx(Bo,{className:"w-4 h-4 text-emerald-500"});case"error":return o.jsx(zr,{className:"w-4 h-4 text-red-500"});default:return o.jsx(Dr,{className:"w-4 h-4 text-blue-500"})}};return o.jsx(yn,{open:a,onOpenChange:r,children:o.jsxs(vn,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 overflow-hidden",children:[o.jsxs(Oa,{className:"p-6 border-b flex flex-row items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(df,{className:"w-5 h-5 text-primary"}),o.jsx(Ra,{children:"AI Processing Trace"})]}),o.jsx(Da,{children:"Step-by-step log of how the AI analyzed and acted on this email."})]}),s?.processing_status==="failed"&&l&&o.jsxs(Z,{size:"sm",variant:"outline",onClick:()=>{l(s),r(!1)},className:"gap-2 text-destructive border-destructive/20 hover:bg-destructive/10",children:[o.jsx(qs,{className:"w-3.5 h-3.5"}),"Retry Job"]})]}),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(mt,{})}):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 email."}):c.map((g,w)=>o.jsxs("div",{className:"relative pl-8",children:[w!==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: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(Rr,{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.jsxs("div",{className:"space-y-3",children:[o.jsx("p",{className:"text-sm text-foreground/90",children:g.details?.message}),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(Ls,{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-60 overflow-y-auto font-mono",children:g.details.system_prompt})]}),g.details?.content_preview&&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(Ls,{className:"w-3 h-3"})," Email Content (sent to LLM)"]}),o.jsx("pre",{className:"text-[10px] bg-blue-500/5 p-2 rounded border border-blue-500/10 overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto font-mono",children:g.details.content_preview})]})]}),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(Ls,{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(Ls,{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.details?.usage&&o.jsxs("div",{className:"flex gap-4 pt-2 border-t border-border/50",children:[o.jsxs("div",{className:"text-[10px]",children:[o.jsx("span",{className:"text-muted-foreground mr-1",children:"Prompt:"}),o.jsx("span",{className:"font-mono font-bold",children:g.details.usage.prompt_tokens})]}),o.jsxs("div",{className:"text-[10px]",children:[o.jsx("span",{className:"text-muted-foreground mr-1",children:"Completion:"}),o.jsx("span",{className:"font-mono font-bold",children:g.details.usage.completion_tokens})]}),o.jsxs("div",{className:"text-[10px]",children:[o.jsx("span",{className:"text-muted-foreground mr-1",children:"Total:"}),o.jsx("span",{className:"font-mono font-bold text-primary",children:g.details.usage.total_tokens})]})]})]}),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(uf,{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 l2={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 o2(){const{state:s,actions:a,dispatch:r}=qr(),{openTerminal:l}=fv(),[c,d]=x.useState(!0),[h,m]=x.useState(!1),[y,p]=x.useState(""),[g,w]=x.useState(null),[_,S]=x.useState(null),[E,j]=x.useState({}),[R,D]=x.useState(null),[B,q]=x.useState(!1),[P,W]=x.useState(null);x.useEffect(()=>{s.isAuthenticated?(Y(),a.fetchStats()):d(!1)},[g,s.isAuthenticated]);const Y=async(C=0)=>{d(!0),await a.fetchEmails({category:g||void 0,search:y||void 0,offset:C,sortBy:s.sortBy,sortOrder:s.sortOrder}),d(!1)},H=C=>{a.fetchEmails({category:g||void 0,search:y||void 0,offset:0,sortBy:C,sortOrder:s.sortOrder})},Q=()=>{a.fetchEmails({category:g||void 0,search:y||void 0,offset:0,sortBy:s.sortBy,sortOrder:s.sortOrder==="asc"?"desc":"asc"})},le=async()=>{if(s.accounts.length===0){te.warning("Please connect an email account first");return}Ta.playStart(),l(),m(!0);const C=await a.triggerSync();m(!1),C?(Ta.playSuccess(),te.success("Sync completed! Check your emails.")):te.error("Sync failed. Check account status for details.")},qe=async(C,J)=>{if(J==="delete"&&R!==C.id){D(C.id);return}D(null),j(_e=>({..._e,[C.id]:J}));const K=await a.executeAction(C.id,J);j(_e=>{const je={..._e};return delete je[C.id],je}),K&&(te.success(`Email ${J==="delete"?"deleted":J==="archive"?"archived":"updated"}`),J==="delete"&&Y(s.emailsOffset))},he=()=>{D(null)},ce=C=>{C.preventDefault(),Y()},Ze=C=>{const J=C==="next"?s.emailsOffset+20:Math.max(0,s.emailsOffset-20);Y(J)},st=C=>{W(C),q(!0)},$e=async C=>{await a.retryProcessing(C.id)&&te.success("Retrying email processing...")};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(qd,{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:le,size:"sm",variant:"default",className:"h-9 shadow-md px-4",disabled:h,children:[o.jsx(qs,{className:Oe("w-3.5 h-3.5 mr-2",h&&"animate-spin")}),h?"Syncing...":"Sync Now"]}),o.jsxs("span",{className:"h-9 text-xs font-medium text-muted-foreground bg-secondary px-3 py-1 rounded-md border border-border flex items-center",children:[s.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(df,{className:"w-3.5 h-3.5 mr-2"}),"View Logs"]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 items-center",children:[o.jsxs("form",{onSubmit:ce,className:"flex-1 flex gap-2 w-full",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx(Lw,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),o.jsx(Se,{placeholder:"Search emails...",value:y,onChange:C=>p(C.target.value),className:"pl-9 h-9"})]}),o.jsx(Z,{type:"submit",size:"sm",className:"h-9 px-4",children:"Search"})]}),o.jsxs("div",{className:"flex items-center gap-1 bg-secondary/30 p-1 rounded-md border border-border/50 h-9",children:[o.jsxs("select",{className:"bg-transparent text-xs font-medium border-none focus:ring-0 cursor-pointer pl-2 pr-8 h-full",value:s.sortBy,onChange:C=>H(C.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 text-primary",onClick:Q,title:s.sortOrder==="asc"?"Sorting: Oldest First":"Sorting: Newest First",children:s.sortOrder==="asc"?o.jsx(Cx,{className:"w-3.5 h-3.5"}):o.jsx(Nx,{className:"w-3.5 h-3.5"})})]})]}),o.jsxs("div",{className:"flex gap-1 flex-wrap",children:[o.jsx(Z,{size:"sm",variant:s.activeCategory===null?"secondary":"ghost",onClick:()=>w(null),children:"All"}),["spam","client","newsletter","support"].map(C=>o.jsx(Z,{size:"sm",variant:s.activeCategory===C?"secondary":"ghost",onClick:()=>w(C),className:"capitalize",children:C},C))]}),c?o.jsx(nN,{}):s.emails.length===0?o.jsxs(At,{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(qd,{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:s.accounts.length===0?"Connect your email account to get started.":"Try syncing or adjusting your filters."}),s.accounts.length>0&&o.jsxs(Z,{onClick:()=>{l(),le()},disabled:h,children:[o.jsx(qs,{className:Oe("w-4 h-4 mr-2",h&&"animate-spin")}),"Sync Now"]})]}):o.jsxs(o.Fragment,{children:[s.emails.map(C=>o.jsx(d2,{email:C,onAction:qe,onRetry:$e,onViewTrace:st,onSelect:()=>S(C),isSelected:_?.id===C.id,loadingAction:E[C.id],isDeletePending:R===C.id,onCancelDelete:he},C.id)),o.jsx(i2,{isOpen:B,onOpenChange:q,email:P,onRetry:$e}),s.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:s.emailsOffset===0,children:[o.jsx($x,{className:"w-4 h-4 mr-1"}),"Previous"]}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[s.emailsOffset+1," - ",Math.min(s.emailsOffset+20,s.emailsTotal)," of ",s.emailsTotal]}),o.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>Ze("next"),disabled:s.emailsOffset+20>=s.emailsTotal,children:["Next",o.jsx(Vx,{className:"w-4 h-4 ml-1"})]})]})]})]}),o.jsxs("aside",{className:"space-y-6",children:[_&&o.jsxs(At,{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(al,{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:_.sender})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Subject:"}),o.jsx("p",{className:"font-medium",children:_.subject})]}),_.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:_.ai_analysis.summary})]}),_.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:_.ai_analysis.key_points.map((C,J)=>o.jsx("li",{children:C},J))})]}),_.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(qw,{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:_.ai_analysis.draft_response}),o.jsxs("p",{className:"mt-2 text-[9px] text-muted-foreground",children:["* This draft is already saved in your ",_.email_accounts?.provider==="gmail"?"Gmail":"Outlook"," Drafts folder."]})]})]})]})]}),o.jsx(c2,{accounts:s.accounts,onUpdate:a.updateAccount,onSync:a.triggerSync,settings:s.settings,onUpdateSettings:a.updateSettings,openTerminal:l}),o.jsxs(At,{className:"p-6",children:[o.jsxs("h3",{className:"font-semibold mb-4 flex items-center gap-2",children:[o.jsx(_y,{className:"w-4 h-4 text-primary"}),"Sync History"]}),o.jsx("div",{className:"space-y-4",children:!s.stats?.recentSyncs||s.stats.recentSyncs.length===0?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No sync history available."}):s.stats.recentSyncs.slice(0,5).map(C=>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:Oe("w-1.5 h-1.5 rounded-full",C.status==="success"?"bg-emerald-500":C.status==="running"?"bg-blue-500 animate-pulse":"bg-red-500")}),o.jsxs("p",{className:"font-medium text-xs",children:[new Date(C.started_at).toLocaleDateString()," ",new Date(C.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:C.emails_processed})," • Actioned: ",o.jsx("span",{className:"font-medium text-foreground",children:C.emails_deleted+C.emails_drafted})]}),C.error_message&&o.jsx("p",{className:"text-[10px] text-destructive pl-3.5 line-clamp-1",title:C.error_message,children:C.error_message})]}),o.jsx("div",{className:"text-[10px] text-muted-foreground bg-secondary px-1.5 py-0.5 rounded",children:C.status==="running"?"Running":C.completed_at?`${Math.round((new Date(C.completed_at).getTime()-new Date(C.started_at).getTime())/1e3)}s`:"..."})]},C.id))})]}),o.jsxs(At,{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:s.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:s.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:s.rules.filter(C=>C.is_enabled).length})]})]})]})]})]})}function c2({accounts:s,onUpdate:a,onSync:r,settings:l,onUpdateSettings:c,openTerminal:d}){return s.length===0?null:o.jsxs(At,{className:"p-6",children:[o.jsxs("h3",{className:"font-semibold mb-4 flex items-center gap-2",children:[o.jsx(Vw,{className:"w-4 h-4 text-primary"}),"Sync Scope"]}),o.jsx("div",{className:"space-y-6",children:s.map(h=>o.jsx(u2,{account:h,onUpdate:a,onSync:r,openTerminal:d},h.id))})]})}function u2({account:s,onUpdate:a,onSync:r,openTerminal:l}){const[c,d]=x.useState(!1),[h,m]=x.useState(""),[y,p]=x.useState(""),g=E=>{if(!E)return"";const j=typeof E=="string"&&/^\d+$/.test(E)?parseInt(E):E,R=new Date(j);if(isNaN(R.getTime()))return"";const D=B=>B<10?"0"+B:B;return R.getFullYear()+"-"+D(R.getMonth()+1)+"-"+D(R.getDate())+"T"+D(R.getHours())+":"+D(R.getMinutes())};x.useEffect(()=>{const E=s.sync_start_date||s.last_sync_checkpoint||s.last_sync_at;m(g(E)),p((s.sync_max_emails_per_run||50).toString())},[s.id,s.sync_start_date,s.last_sync_checkpoint,s.last_sync_at,s.sync_max_emails_per_run]);const w=async E=>{d(!0),await a(s.id,E),d(!1)},_=()=>{const E=s.sync_start_date?new Date(s.sync_start_date).toISOString():"",j=h?new Date(h).toISOString():"";j!==E&&w({sync_start_date:j||null})},S=()=>{const E=parseInt(y,10)||50;E!==s.sync_max_emails_per_run&&w({sync_max_emails_per_run:E})};return 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:s.email_address,children:s.email_address}),o.jsxs("div",{className:"flex items-center gap-1",children:[s.last_sync_status==="syncing"?o.jsx($t,{className:"w-3 h-3 text-primary animate-spin"}):s.last_sync_status==="success"?o.jsx(uf,{className:"w-3 h-3 text-emerald-500"}):s.last_sync_status==="error"?o.jsx("span",{title:s.last_sync_error||"Error",children:o.jsx(zr,{className:"w-3 h-3 text-destructive"})}):null,o.jsx(Z,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>{l(),r(s.id)},disabled:s.last_sync_status==="syncing",children:o.jsx(qs,{className:Oe("w-3 h-3",s.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(s.id,{last_sync_checkpoint:null}),disabled:s.last_sync_status==="syncing",children:o.jsx(_y,{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(Rx,{className:"w-2.5 h-2.5"})," Sync From"]}),o.jsx(Se,{type:"datetime-local",className:"h-7 text-[10px] px-2 py-0 w-full",value:h,onChange:E=>m(E.target.value),onBlur:_,disabled:c||s.last_sync_status==="syncing"})]}),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(uw,{className:"w-2.5 h-2.5"})," Max Emails"]}),o.jsx(Se,{type:"number",className:"h-7 text-[10px] px-2 py-0",value:y,onChange:E=>p(E.target.value),onBlur:S,disabled:c||s.last_sync_status==="syncing"})]})]}),s.last_sync_at&&o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:["Last sync: ",new Date(s.last_sync_at).toLocaleString()]}),s.last_sync_error&&o.jsxs("p",{className:"text-[9px] text-destructive italic line-clamp-1",title:s.last_sync_error,children:["Error: ",s.last_sync_error]})]})}function d2({email:s,onAction:a,onRetry:r,onViewTrace:l,onSelect:c,isSelected:d,loadingAction:h,isDeletePending:m,onCancelDelete:y}){if(!s)return null;const p=l2[s.category||"other"],g=!!h,w=()=>{if(!s.email_accounts)return"#";const{provider:_,email_address:S}=s.email_accounts;return _==="gmail"?`https://mail.google.com/mail/u/${S}/#all/${s.external_id}`:`https://outlook.office.com/mail/deeplink/read/${encodeURIComponent(s.external_id)}`};return o.jsx(At,{className:Oe("hover:shadow-md transition-shadow group cursor-pointer",d&&"ring-2 ring-primary"),onClick:c,children:o.jsxs("div",{className:"p-5",children:[o.jsxs("div",{className:"flex justify-between items-start mb-3 gap-4",children:[o.jsxs("div",{className:"flex gap-3 flex-1 min-w-0",children:[o.jsx("div",{className:Oe("w-8 h-8 rounded-full flex-shrink-0 flex items-center justify-center font-bold text-white text-xs",s.category==="spam"?"bg-destructive":"bg-primary"),children:s.sender?.[0]?.toUpperCase()||"?"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("h3",{className:"font-semibold text-sm line-clamp-1 group-hover:text-primary transition-colors",children:s.subject||"No Subject"}),o.jsx("p",{className:"text-xs text-muted-foreground truncate",title:s.sender||"",children:s.sender})]})]}),o.jsxs("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[o.jsx("span",{className:Oe("px-2 py-0.5 rounded-full text-[10px] font-bold uppercase tracking-wider",p),children:s.category||"unknown"}),o.jsxs("div",{className:"flex items-center justify-end gap-1",children:[s.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(Rr,{className:"w-2.5 h-2.5"})," Queued"]}),s.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"]}),s.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(Vi,{className:"w-2.5 h-2.5"})," Analyzed"]}),s.processing_status==="failed"&&o.jsxs("div",{className:"flex items-center gap-1",children:[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:s.processing_error||"Unknown error",children:[o.jsx(zr,{className:"w-2.5 h-2.5"})," Failed"]}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-5 w-5 text-red-600 hover:bg-red-500/10",onClick:_=>{_.stopPropagation(),r(s)},title:"Retry Processing",children:o.jsx(qs,{className:"w-2.5 h-2.5"})})]}),!s.processing_status&&!s.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"]}),!s.processing_status&&s.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(Vi,{className:"w-2.5 h-2.5"})," Analyzed"]})]}),o.jsxs("div",{className:"flex items-center justify-end gap-2 text-[10px] text-muted-foreground/80 leading-tight",children:[o.jsxs("span",{title:s.date?new Date(s.date).toLocaleString():"",className:"whitespace-nowrap",children:[o.jsx("span",{className:"opacity-70 text-[9px]",children:"REC:"})," ",s.date?new Date(s.date).toLocaleString([],{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"-"]}),o.jsx("span",{className:"opacity-30",children:"•"}),o.jsxs("span",{title:new Date(s.created_at).toLocaleString(),className:"whitespace-nowrap",children:[o.jsx("span",{className:"opacity-70 text-[9px]",children:"PROC:"})," ",new Date(s.created_at).toLocaleString([],{year:"numeric",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:s.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(Hd,{className:"w-3.5 h-3.5 text-emerald-500"}),"Suggested:",s.suggested_actions&&s.suggested_actions.length>0?o.jsx("div",{className:"flex gap-1 flex-wrap",children:s.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:s.suggested_action||"none"}),s.actions_taken&&s.actions_taken.length>0?o.jsxs("span",{className:"text-muted-foreground ml-2 truncate max-w-[100px]",title:s.actions_taken.join(", "),children:["(Done: ",s.actions_taken.join(", "),")"]}):s.action_taken?o.jsxs("span",{className:"text-muted-foreground ml-2",children:["(Done: ",s.action_taken,")"]}):null]}),o.jsx("div",{className:"flex gap-1 items-center",onClick:_=>_.stopPropagation(),children:m?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(s,"delete"),disabled:g,children:h==="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:y,disabled:g,children:"No"})]}):o.jsxs(o.Fragment,{children:[o.jsx("a",{href:w(),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 ${s.email_accounts?.provider==="gmail"?"Gmail":"Outlook"}`,children:o.jsx(Pi,{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:()=>l(s),title:"View AI Trace (Prompt/Response)",children:o.jsx(iw,{className:"w-3.5 h-3.5"})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-destructive",onClick:()=>a(s,"delete"),disabled:g,title:"Delete",children:h==="delete"?o.jsx($t,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(Lo,{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(s,"archive"),disabled:g,title:"Archive",children:h==="archive"?o.jsx($t,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(Sx,{className:"w-3.5 h-3.5"})}),o.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 hover:text-primary",onClick:()=>a(s,"flag"),disabled:g,title:"Flag",children:h==="flag"?o.jsx($t,{className:"w-3.5 h-3.5 animate-spin"}):o.jsx(ow,{className:"w-3.5 h-3.5"})})]})})]})]})})}function f2(){const{state:s,actions:a}=qr(),[r,l]=x.useState(!1),[c,d]=x.useState(!1),[h,m]=x.useState(null),[y,p]=x.useState(!1),[g,w]=x.useState(!1),[_,S]=x.useState({}),[E,j]=x.useState(!1),[R,D]=x.useState("credentials"),[B,q]=x.useState(""),[P,W]=x.useState(""),[Y,H]=x.useState(""),[Q,le]=x.useState(""),[qe,he]=x.useState(!1),[ce,Ze]=x.useState(!1),[st,$e]=x.useState(!1),[C,J]=x.useState("credentials"),[K,_e]=x.useState(""),[je,A]=x.useState(""),[I,X]=x.useState(!1),[F,fe]=x.useState(!1),[ye,de]=x.useState(""),[Pe,Ue]=x.useState("category"),[Ct,pt]=x.useState("newsletter"),[xt,rs]=x.useState(["archive"]),[la,is]=x.useState(""),[_n,Sn]=x.useState(""),[$r,ls]=x.useState(""),[jn,os]=x.useState(""),[nl,$s]=x.useState([]),[gt,rl]=x.useState(!1),[Hr,Vr]=x.useState(!1),[Ma,Nn]=x.useState(null),[ya,En]=x.useState(null);x.useEffect(()=>{a.fetchAccounts(),a.fetchRules(),a.fetchSettings()},[]),x.useEffect(()=>{s.settings&&S(s.settings)},[s.settings]);const Fo=async()=>{const O=s.rules.find(ee=>ee.name==="Auto-Trash Spam");if(!O){te.error("System rule not found. Please sync your database.");return}Nn("auto_trash_spam"),await a.toggleRule(O.id),Nn(null)},Hs=async()=>{const O=s.rules.find(ee=>ee.name==="Smart Drafts");if(!O){te.error("System rule not found. Please sync your database.");return}Nn("smart_drafts"),await a.toggleRule(O.id),Nn(null)},wt=O=>{En(O),de(O.name);const ee=O.condition,yt=Object.keys(ee).filter(Gs=>Gs!=="older_than_days")[0]||"category";Ue(yt),pt(ee[yt]||""),is(ee.older_than_days?.toString()||"");const Is=O.actions&&O.actions.length>0?O.actions:O.action?[O.action]:["archive"];rs(Is),Sn(O.instructions||""),ls(O.description||""),os(O.intent||""),$s(O.attachments||[]),fe(!0)},va=x.useRef(null),Ot=()=>{D("credentials"),q(""),W(""),H(""),le(""),j(!0)},Wo=O=>{q(O);try{const ee=JSON.parse(O),Ce=ee.installed||ee.web||ee;Ce.client_id&&W(Ce.client_id),Ce.client_secret&&H(Ce.client_secret),ee.installed?te.success("Detected Desktop app credentials"):ee.web&&te.info("Detected Web app - make sure redirect URI is configured in Google Cloud Console")}catch{}},ec=async()=>{if(!P||!Y){te.error("Please provide both Client ID and Client Secret");return}he(!0);try{if(await a.updateSettings({..._,google_client_id:P,google_client_secret:Y})){S(Ce=>({...Ce,google_client_id:P,google_client_secret:Y}));const ee=await Me.getGmailAuthUrl();if(ee.data?.url)window.open(ee.data.url,"_blank"),D("code"),te.success("Please authorize in the opened tab, then paste the code here");else{const Ce=typeof ee.error=="string"?ee.error:ee.error?.message;te.error(Ce||"Failed to get OAuth URL")}}else te.error("Failed to save credentials")}catch{te.error("Failed to save credentials")}finally{he(!1)}},tc=async()=>{if(!Q.trim()){te.error("Please paste the authorization code");return}Ze(!0);try{const O=await Me.connectGmail(Q.trim());if(O.data?.success)te.success("Gmail account connected successfully!"),j(!1),a.fetchAccounts();else{const ee=typeof O.error=="string"?O.error:O.error?.message;te.error(ee||"Failed to connect Gmail")}}catch{te.error("Failed to connect Gmail")}finally{Ze(!1)}},Tn=()=>{J("credentials"),_e(""),A(""),$e(!0)},An=async()=>{if(!K){te.error("Please provide the Client ID");return}X(!0);try{if(await a.updateSettings({..._,microsoft_client_id:K,microsoft_tenant_id:je||"common"})){S(Ce=>({...Ce,microsoft_client_id:K,microsoft_tenant_id:je||"common"}));const ee=await Me.startMicrosoftDeviceFlow();if(ee.data)m(ee.data),J("device-code"),Cn(ee.data.deviceCode,ee.data.interval);else{const Ce=typeof ee.error=="string"?ee.error:ee.error?.message;te.error(Ce||"Failed to start device flow")}}else te.error("Failed to save credentials")}catch{te.error("Failed to save credentials")}finally{X(!1)}},Cn=async(O,ee)=>{const Ce=setInterval(async()=>{try{const yt=await Me.pollMicrosoftDeviceCode(O);yt.data?.status==="completed"?(clearInterval(Ce),m(null),d(!1),$e(!1),te.success("Outlook account connected"),a.fetchAccounts()):yt.error&&typeof yt.error=="object"&&yt.error.code}catch{}},ee*1e3);setTimeout(()=>{clearInterval(Ce),c&&(m(null),d(!1),$e(!1),te.error("Connection timed out. Please try again."))},900*1e3)},za=async()=>{if(!ye){te.error("Please name your rule");return}if(xt.length===0){te.error("Please select at least one action");return}Vr(!0);try{const O={[Pe]:Ct};la&&(O.older_than_days=parseInt(la,10));const ee=xt.includes("draft"),Ce={name:ye,description:$r||void 0,intent:jn||void 0,condition:O,actions:xt,instructions:ee?_n:void 0,attachments:ee?nl:[],is_enabled:!0};let yt=!1;ya?yt=await a.updateRule(ya.id,Ce):yt=await a.createRule(Ce),yt?(te.success(ya?"Rule updated":"Rule created"),fe(!1),En(null),de(""),rs(["archive"]),is(""),Sn(""),ls(""),os(""),$s([]),a.fetchRules()):te.error(`Failed to ${ya?"update":"create"} rule`)}catch{te.error("An error occurred while saving the rule")}finally{Vr(!1)}},kn=async O=>{if(!confirm("Are you sure you want to disconnect this account?"))return;await a.disconnectAccount(O)&&te.success("Account disconnected")},cs=async()=>{p(!0);const O=await a.updateSettings(_);p(!1),O&&te.success("Settings saved")},ac=async()=>{w(!0);try{const O=await Me.testLlm({llm_model:_.llm_model||null,llm_base_url:_.llm_base_url||null,llm_api_key:_.llm_api_key||null});O.data?.success?te.success(O.data.message):te.error(O.data?.message||"Connection test failed")}catch{te.error("Failed to test connection")}finally{w(!1)}},il=async O=>{await a.toggleRule(O)},Ir=async O=>{const ee=O.target.files;if(!ee||ee.length===0)return;rl(!0);const Ce=ee[0],yt=Ce.name.split(".").pop(),Is=`${Math.random().toString(36).substring(2)}.${yt}`,Gs=`${s.user.id}/${Is}`;try{const{error:Ps}=await ct.storage.from("rule-attachments").upload(Gs,Ce);if(Ps)throw Ps;const ba={name:Ce.name,path:Gs,type:Ce.type,size:Ce.size};$s(ut=>[...ut,ba]),te.success("File uploaded")}catch(Ps){console.error("Upload error:",Ps),te.error("Failed to upload file")}finally{rl(!1),O.target.value=""}},Vs=O=>{$s(ee=>ee.filter(Ce=>Ce.path!==O))},sc=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(yn,{open:E,onOpenChange:j,children:o.jsxs(vn,{className:"sm:max-w-lg",children:[o.jsxs(Oa,{children:[o.jsxs(Ra,{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(Da,{children:R==="credentials"?"Enter your Google OAuth credentials to connect your Gmail account.":"Paste the authorization code from Google to complete the connection."})]}),R==="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(Fw,{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:B,onChange:O=>Wo(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(Se,{placeholder:"xxx.apps.googleusercontent.com",value:P,onChange:O=>W(O.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Client Secret"}),o.jsx(Se,{type:"password",placeholder:"GOCSPX-...",value:Y,onChange:O=>H(O.target.value)})]})]})]}),o.jsxs(Ar,{children:[o.jsx(Z,{variant:"outline",onClick:()=>j(!1),children:"Cancel"}),o.jsxs(Z,{onClick:ec,disabled:qe||!P||!Y,children:[qe?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(Na,{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(Se,{placeholder:"4/0AQlEd8x...",value:Q,onChange:O=>le(O.target.value),className:"font-mono"})]})]}),o.jsxs(Ar,{children:[o.jsx(Z,{variant:"outline",onClick:()=>D("credentials"),children:"Back"}),o.jsxs(Z,{onClick:tc,disabled:ce||!Q.trim(),children:[ce?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(Na,{className:"w-4 h-4 mr-2"}),"Connect"]})]})]})]})}),o.jsx(yn,{open:st,onOpenChange:$e,children:o.jsxs(vn,{className:"sm:max-w-lg",children:[o.jsxs(Oa,{children:[o.jsxs(Ra,{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(Da,{children:C==="credentials"?"Enter your Microsoft Azure App credentials to connect your Outlook account.":"Follow the instructions to authorize the application."})]}),C==="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(Se,{placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",value:K,onChange:O=>_e(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(Se,{placeholder:"common",value:je,onChange:O=>A(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(Ar,{children:[o.jsx(Z,{variant:"outline",onClick:()=>$e(!1),children:"Cancel"}),o.jsxs(Z,{onClick:An,disabled:I||!K,children:[I?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(Na,{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(Pi,{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(mt,{size:"sm"}),"Waiting for authorization..."]})})]}),o.jsx(Ar,{children:o.jsx(Z,{variant:"outline",onClick:()=>$e(!1),children:"Cancel"})})]})]})}),o.jsx(yn,{open:F,onOpenChange:O=>{fe(O),O||En(null)},children:o.jsxs(vn,{className:"sm:max-w-xl max-h-[90vh] flex flex-col p-0",children:[o.jsxs(Oa,{className:"p-6 border-b",children:[o.jsx(Ra,{children:ya?"Edit Auto-Pilot Rule":"Create Auto-Pilot Rule"}),o.jsx(Da,{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(Se,{placeholder:"e.g. Archive Newsletters",value:ye,onChange:O=>de(O.target.value)})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Description"}),o.jsx("textarea",{className:"w-full p-2 border rounded-md bg-background min-h-[60px] text-sm",placeholder:"e.g. Handle all marketing newsletters and promotional content from subscription services",value:$r,onChange:O=>ls(O.target.value)}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Describe what this rule is for. The AI uses this to semantically match emails."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Intent"}),o.jsx(Se,{placeholder:"e.g. Politely decline all sales pitches",value:jn,onChange:O=>os(O.target.value)}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"The goal of this rule. Used to generate appropriate draft replies."})]}),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:Pe,onChange:O=>{Ue(O.target.value),O.target.value==="category"?pt("newsletter"):O.target.value==="sentiment"?pt("Positive"):O.target.value==="priority"?pt("High"):pt("")},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"}),Pe==="category"?o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Ct,onChange:O=>pt(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"})]}):Pe==="sentiment"?o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Ct,onChange:O=>pt(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"})]}):Pe==="priority"?o.jsxs("select",{className:"w-full p-2 border rounded-md bg-background text-sm",value:Ct,onChange:O=>pt(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(Se,{placeholder:Pe==="sender_domain"?"rta.vn":Pe==="sender_email"?"john@example.com":"Keywords...",value:Ct,onChange:O=>pt(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(Rr,{className:"w-4 h-4"}),"Only if email is older than... (Optional)"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Se,{type:"number",min:"0",placeholder:"0",className:"w-24",value:la,onChange:O=>is(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 ${xt.includes(O.value)?"bg-primary/10 border-primary":"bg-background hover:bg-secondary/50"}`,children:[o.jsx("input",{type:"checkbox",checked:xt.includes(O.value),onChange:ee=>{ee.target.checked?rs([...xt,O.value]):rs(xt.filter(Ce=>Ce!==O.value))},className:"rounded border-gray-300"}),o.jsx("span",{className:"text-sm",children:O.label})]},O.value))})]}),xt.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:_n,onChange:O=>Sn(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(_g,{className:"w-4 h-4"}),"Attachments (Optional)"]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[nl.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:()=>Vs(O.path),children:o.jsx(al,{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:Ir,disabled:gt}),o.jsxs(Z,{variant:"outline",size:"sm",className:"w-full border-dashed",disabled:gt,children:[gt?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(zi,{className:"w-3 h-3 mr-2"}),gt?"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(Ar,{className:"p-6 border-t bg-secondary/5",children:[o.jsx(Z,{variant:"outline",onClick:()=>fe(!1),children:"Cancel"}),o.jsxs(Z,{onClick:za,disabled:Hr,children:[Hr?o.jsx(mt,{size:"sm",className:"mr-2"}):ya?o.jsx(Na,{className:"w-4 h-4 mr-2"}):o.jsx(zi,{className:"w-4 h-4 mr-2"}),ya?"Save Changes":"Create Rule"]})]})]})}),o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[o.jsxs(At,{children:[o.jsxs(Aa,{children:[o.jsxs(Ca,{className:"flex items-center gap-2",children:[o.jsx(Gi,{className:"w-5 h-5 text-primary"}),"Connected Accounts"]}),o.jsx(as,{children:"Manage your email providers"})]}),o.jsxs(ka,{className:"space-y-4",children:[s.accounts.length===0?o.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No accounts connected yet"}):s.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:[sc(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:()=>kn(O.id),children:o.jsx(Lo,{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:Ot,disabled:r||c,children:[r?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(zi,{className:"w-4 h-4 mr-2"}),"Connect Gmail Account"]}),o.jsxs(Z,{className:"w-full border-dashed",variant:"outline",onClick:Tn,disabled:r||c,children:[c&&!h?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(zi,{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(Pi,{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(At,{children:[o.jsxs(Aa,{children:[o.jsxs(Ca,{className:"flex items-center gap-2",children:[o.jsx(Hd,{className:"w-5 h-5 text-emerald-500"}),"Auto-Pilot Rules"]}),o.jsx(as,{children:"Configure AI automation behavior"})]}),o.jsxs(ka,{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=s.rules.find(ee=>ee.name==="Auto-Trash Spam");O&&wt(O)},title:"Edit Logic",children:o.jsx(bd,{className:"w-4 h-4 text-muted-foreground"})}),o.jsxs(Z,{variant:s.rules.find(O=>O.name==="Auto-Trash Spam")?.is_enabled?"default":"outline",size:"sm",onClick:Fo,disabled:Ma==="auto_trash_spam",children:[Ma==="auto_trash_spam"?o.jsx(mt,{size:"sm",className:"mr-1"}):o.jsx(xo,{className:"w-4 h-4 mr-1"}),s.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=s.rules.find(ee=>ee.name==="Smart Drafts");O&&wt(O)},title:"Edit Logic",children:o.jsx(bd,{className:"w-4 h-4 text-muted-foreground"})}),o.jsxs(Z,{variant:s.rules.find(O=>O.name==="Smart Drafts")?.is_enabled?"default":"outline",size:"sm",onClick:Hs,disabled:Ma==="smart_drafts",children:[Ma==="smart_drafts"?o.jsx(mt,{size:"sm",className:"mr-1"}):o.jsx(xo,{className:"w-4 h-4 mr-1"}),s.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:()=>{En(null),de(""),ls(""),os(""),rs(["archive"]),is(""),Sn(""),$s([]),fe(!0)},children:[o.jsx(zi,{className:"w-4 h-4 mr-1"})," Add Rule"]})]}),s.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"}),s.rules.length>0&&s.rules.filter(O=>O.name!=="Auto-Trash Spam"&&O.name!=="Smart Drafts").map(O=>{const ee=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:["→ ",ee.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:()=>wt(O),title:"Edit Rule",children:o.jsx(bd,{className:"w-3.5 h-3.5 text-muted-foreground"})}),o.jsxs(Z,{variant:O.is_enabled?"default":"outline",size:"sm",onClick:()=>il(O.id),className:"h-7 px-2",children:[o.jsx(xo,{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(Lo,{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(Ce=>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(_g,{className:"w-2.5 h-2.5"}),Ce.name]},Ce.path))})]},O.id)})]})]})]})]}),o.jsxs(At,{children:[o.jsxs(Aa,{children:[o.jsxs(Ca,{className:"flex items-center gap-2",children:[o.jsx(qs,{className:"w-5 h-5 text-indigo-500"}),"Model Configuration"]}),o.jsx(as,{children:"Configure Local LLM or API settings"})]}),o.jsxs(ka,{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(Se,{placeholder:"gpt-4o-mini",value:_.llm_model||"",onChange:O=>S(ee=>({...ee,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(Se,{placeholder:"https://api.openai.com/v1",value:_.llm_base_url||"",onChange:O=>S(ee=>({...ee,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(Se,{type:"password",placeholder:"sk-...",value:_.llm_api_key||"",onChange:O=>S(ee=>({...ee,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(Gi,{className:"w-4 h-4"}),"Local Storage Path (.eml)"]}),o.jsx(Se,{placeholder:"e.g. ./data/emails or ~/.email-automator/emails",value:_.storage_path||"",onChange:O=>S(ee=>({...ee,storage_path:O.target.value}))}),o.jsx("p",{className:"text-[10px] text-muted-foreground italic",children:"Directory where raw emails (.eml) are saved. Default: ./data/emails (falls back to ~/.email-automator/emails if restricted)."})]}),o.jsxs("div",{className:"flex justify-between items-center py-3 border-t border-border/50",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium text-sm",children:"Intelligent Rename"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Use slugified-hyphenated filenames (e.g. 20240119-1430-subject-id.eml)"})]}),o.jsxs(Z,{variant:_.intelligent_rename?"default":"outline",size:"sm",onClick:()=>S(O=>({...O,intelligent_rename:!O.intelligent_rename})),children:[o.jsx(xo,{className:"w-4 h-4 mr-1"}),_.intelligent_rename?"On":"Off"]})]}),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(Rr,{className:"w-4 h-4"}),"Background Sync Interval (minutes)"]}),o.jsx(Se,{type:"number",min:1,max:1440,value:_.sync_interval_minutes||5,onChange:O=>S(ee=>({...ee,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:ac,disabled:g,children:[g?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(qs,{className:"w-4 h-4 mr-2"}),"Check Connection"]}),o.jsxs(Z,{onClick:cs,disabled:y,children:[y?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(Na,{className:"w-4 h-4 mr-2"}),"Save Configuration"]})]})]})]}),o.jsx("div",{ref:va,children:o.jsxs(At,{children:[o.jsxs(Aa,{children:[o.jsxs(Ca,{className:"flex items-center gap-2",children:[o.jsx(Hd,{className:"w-5 h-5 text-orange-500"}),"Provider Credentials (Advanced)"]}),o.jsx(as,{children:"Bring Your Own Keys (BYOK). Configure your own OAuth credentials here. Leave empty to use system defaults."})]}),o.jsxs(ka,{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(Se,{type:"password",placeholder:"...apps.googleusercontent.com",value:_.google_client_id||"",onChange:O=>S(ee=>({...ee,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(Se,{type:"password",placeholder:"GOCSPX-...",value:_.google_client_secret||"",onChange:O=>S(ee=>({...ee,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(Se,{type:"password",value:_.microsoft_client_id||"",onChange:O=>S(ee=>({...ee,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(Se,{type:"password",value:_.microsoft_client_secret||"",onChange:O=>S(ee=>({...ee,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(Se,{placeholder:"common",value:_.microsoft_tenant_id||"",onChange:O=>S(ee=>({...ee,microsoft_tenant_id:O.target.value}))})]})]})]}),o.jsx("div",{className:"flex justify-end mt-4",children:o.jsxs(Z,{onClick:cs,disabled:y,variant:"secondary",children:[y?o.jsx(mt,{size:"sm",className:"mr-2"}):o.jsx(Na,{className:"w-4 h-4 mr-2"}),"Save Credentials"]})})]})]})})]})}const h2="modulepreload",m2=function(s){return"/"+s},gy={},p2=function(a,r,l){let c=Promise.resolve();if(r&&r.length>0){let p=function(g){return Promise.all(g.map(w=>Promise.resolve(w).then(_=>({status:"fulfilled",value:_}),_=>({status:"rejected",reason:_}))))};var h=p;document.getElementsByTagName("link");const m=document.querySelector("meta[property=csp-nonce]"),y=m?.nonce||m?.getAttribute("nonce");c=p(r.map(g=>{if(g=m2(g),g in gy)return;gy[g]=!0;const w=g.endsWith(".css"),_=w?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${_}`))return;const S=document.createElement("link");if(S.rel=w?"stylesheet":h2,w||(S.as="script"),S.crossOrigin="",S.href=g,y&&S.setAttribute("nonce",y),document.head.appendChild(S),w)return new Promise((E,j)=>{S.addEventListener("load",E),S.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${g}`)))})}))}function d(m){const y=new Event("vite:preloadError",{cancelable:!0});if(y.payload=m,window.dispatchEvent(y),!y.defaultPrevented)throw m}return c.then(m=>{for(const y of m||[])y.status==="rejected"&&d(y.reason);return a().catch(d)})};function g2(){const[s,a]=x.useState("profile"),{state:r,actions:l}=qr();x.useEffect(()=>{l.fetchProfile()},[]);const c=[{id:"profile",label:"Profile",icon:Sy},{id:"security",label:"Security",icon:Pw},{id:"database",label:"Supabase",icon:Gi}];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.jsxs("aside",{className:"w-full md:w-64 flex flex-col justify-between",children:[o.jsx("nav",{className:"space-y-1",children:c.map(d=>{const h=d.icon,m=s===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:"mt-8 px-4 py-4 border-t border-border/40 text-center md:text-left",children:[o.jsx("p",{className:"text-[10px] font-bold text-muted-foreground/50 uppercase tracking-widest mb-1",children:"Version"}),o.jsxs("p",{className:"text-xs font-mono text-muted-foreground/70",children:["v","2.10.2"]})]})]}),o.jsxs("div",{className:"flex-1 space-y-6",children:[s==="profile"&&o.jsx(y2,{}),s==="security"&&o.jsx(v2,{}),s==="database"&&o.jsx(b2,{})]})]})]})}function y2(){const{state:s,actions:a}=qr(),[r,l]=x.useState(""),[c,d]=x.useState(""),[h,m]=x.useState(!1),[y,p]=x.useState(!1),[g,w]=x.useState(Ta.isEnabled());x.useEffect(()=>{s.profile&&(l(s.profile.first_name||""),d(s.profile.last_name||""))},[s.profile]);const _=()=>{const j=!g;Ta.setEnabled(j),w(j),j?(Ta.playSuccess(),te.success("Sound effects enabled")):te.info("Sound effects disabled")},S=async()=>{m(!0);const j=await a.updateProfile({first_name:r,last_name:c});m(!1),j&&te.success("Profile updated")},E=async j=>{const R=j.target.files?.[0];if(!(!R||!s.user)){p(!0);try{const D=R.name.split(".").pop(),B=`${s.user.id}/avatar.${D}`,{data:q,error:P}=await ct.storage.from("avatars").upload(B,R,{upsert:!0});if(P)throw P;const{data:{publicUrl:W}}=ct.storage.from("avatars").getPublicUrl(B);await a.updateProfile({avatar_url:W}),te.success("Avatar updated")}catch(D){console.error("Avatar upload error:",D),te.error("Failed to upload avatar")}finally{p(!1)}}};return o.jsxs(At,{children:[o.jsxs(Aa,{children:[o.jsx(Ca,{children:"Profile Information"}),o.jsx(as,{children:"Update your personal details and avatar."})]}),o.jsxs(ka,{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:s.profile?.avatar_url?o.jsx("img",{src:s.profile.avatar_url,alt:"Avatar",className:"w-full h-full object-cover"}):o.jsx(Sy,{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(Mx,{className:"w-6 h-6 text-white"}),o.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:E,disabled:y})]}),y&&o.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/60 rounded-full",children:o.jsx(mt,{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(pa,{htmlFor:"first-name",children:"First Name"}),o.jsx(Se,{id:"first-name",value:r,onChange:j=>l(j.target.value),placeholder:"John"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(pa,{htmlFor:"last-name",children:"Last Name"}),o.jsx(Se,{id:"last-name",value:c,onChange:j=>d(j.target.value),placeholder:"Doe"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(pa,{htmlFor:"email",children:"Email Address"}),o.jsx(Se,{id:"email",value:s.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:g?"default":"outline",size:"sm",onClick:_,className:"gap-2",children:[g?o.jsx(s_,{className:"w-4 h-4"}):o.jsx(r_,{className:"w-4 h-4"}),g?"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(mt,{size:"sm",className:"mr-2"}):o.jsx(zw,{className:"w-4 h-4 mr-2"}),"Save Changes"]})})]})]})}function v2(){const[s,a]=x.useState(""),[r,l]=x.useState(""),[c,d]=x.useState(!1),h=async()=>{if(!s){te.error("Please enter a new password");return}if(s!==r){te.error("Passwords do not match");return}if(s.length<6){te.error("Password must be at least 6 characters");return}d(!0);try{const{api:m}=await p2(async()=>{const{api:p}=await Promise.resolve().then(()=>Pj);return{api:p}},void 0),y=await m.changePassword(s);y.success?(te.success("Password changed successfully"),a(""),l("")):te.error(y.error?.message||"Failed to change password")}catch{te.error("An error occurred")}finally{d(!1)}};return o.jsxs(At,{children:[o.jsxs(Aa,{children:[o.jsx(Ca,{children:"Security"}),o.jsx(as,{children:"Manage your password and account security."})]}),o.jsxs(ka,{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(pa,{htmlFor:"new-password",children:"New Password"}),o.jsx(Se,{id:"new-password",type:"password",value:s,onChange:m=>a(m.target.value),placeholder:"••••••••"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(pa,{htmlFor:"confirm-password",children:"Confirm New Password"}),o.jsx(Se,{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(mt,{size:"sm",className:"mr-2"}):o.jsx(pw,{className:"w-4 h-4 mr-2"}),"Update Password"]})})]})]})}function b2(){const[s,a]=x.useState(!1),r=bn(),l=Vj(),c=()=>{confirm("Are you sure you want to disconnect from this Supabase project? This will log you out and clear local configuration.")&&(Hj(),window.location.reload())};return o.jsxs(o.Fragment,{children:[o.jsxs(At,{children:[o.jsxs(Aa,{children:[o.jsxs(Ca,{className:"flex items-center gap-2",children:[o.jsx(Gi,{className:"w-5 h-5 text-primary"}),"Supabase Connection"]}),o.jsx(as,{children:"Manage your database configuration (BYOK - Bring Your Own Keys)."})]}),o.jsx(ka,{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(Ii,{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(el,{className:"bg-amber-500/5 border-amber-500/20",children:[o.jsx($d,{className:"h-4 w-4 text-amber-500"}),o.jsx(tl,{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($d,{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(Lo,{className:"w-4 h-4 mr-2"}),"Clear Config"]})]}),o.jsxs("div",{className:"space-y-2 pt-4 border-t",children:[o.jsx(pa,{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(Zx,{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(Gi,{className:"w-4 h-4 mr-2"}),"Setup Supabase"]})]})})]}),o.jsx(rf,{open:s,onComplete:()=>a(!1),canClose:!0})]})}function x2({length:s=6,value:a,onChange:r,onComplete:l,disabled:c=!1,error:d=!1}){const h=x.useRef([]),[m,y]=x.useState(null),p=(_,S)=>{const E=S.replace(/[^0-9]/g,"");if(E.length===0){const D=a.split("");D[_]=" ",a.split("");let B=a.split("");_<B.length&&B.splice(_,1);const q=B.join("");r(q),_>0&&h.current[_-1]?.focus();return}a.split("");const j=[...a];j[_]=E[0],r(j.join("")),_<s-1&&h.current[_+1]?.focus();const R=j.join("");R.length===s&&l&&l(R)},g=(_,S)=>{S.key==="Backspace"&&!a[_]&&_>0||S.key==="ArrowLeft"&&_>0?h.current[_-1]?.focus():S.key==="ArrowRight"&&_<s-1&&h.current[_+1]?.focus()},w=_=>{_.preventDefault();const E=_.clipboardData.getData("text/plain").replace(/[^0-9]/g,"").slice(0,s);r(E);const j=Math.min(E.length,s-1);h.current[j]?.focus(),E.length===s&&l&&l(E)};return o.jsx("div",{className:"flex gap-2 justify-center",children:Array.from({length:s}).map((_,S)=>o.jsx(Se,{ref:E=>{h.current[S]=E},type:"text",inputMode:"numeric",maxLength:1,value:a[S]||"",onChange:E=>p(S,E.target.value),onKeyDown:E=>g(S,E),onPaste:w,onFocus:()=>y(S),onBlur:()=>y(null),disabled:c,className:Oe("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 w2({onSuccess:s,onConfigure:a}){const[r,l]=x.useState(""),[c,d]=x.useState(""),[h,m]=x.useState(""),[y,p]=x.useState(""),[g,w]=x.useState(!1),[_,S]=x.useState(!0),[E,j]=x.useState(!1),[R,D]=x.useState(""),[B,q]=x.useState("password"),[P,W]=x.useState("email"),[Y,H]=x.useState("");x.useEffect(()=>{Q()},[]);const Q=async()=>{try{const{data:he,error:ce}=await ct.from("init_state").select("is_initialized");if(ce){if(ce.code==="42P01"){console.info("[Login] init_state relation missing - fresh database detected."),j(!1);return}console.warn("[Login] Init check error:",ce),j(!1),D(ce.message);return}const Ze=he&&he.length>0&&he[0].is_initialized>0;j(Ze)}catch(he){console.warn("[Login] Init check exception:",he),j(!1),D(he.message||"Connection failed")}finally{S(!1)}},le=async he=>{he.preventDefault(),w(!0),D("");try{if(E){if(B==="password"){const{error:ce}=await ct.auth.signInWithPassword({email:r,password:c});if(ce)throw ce;te.success("Logged in successfully"),s?.()}else if(P==="email"){const{error:ce}=await ct.auth.signInWithOtp({email:r,options:{shouldCreateUser:!1}});if(ce)throw ce;W("verify"),te.success("Validation code sent to your email")}}else{const{data:ce,error:Ze}=await ct.functions.invoke("setup",{body:{email:r,password:c,first_name:h,last_name:y}});if(Ze||!ce){if(Ze?.message?.includes("First user already exists")){te.info("System already initialized. Please log in."),j(!0);return}throw new Error(Ze?.message||"Failed to create admin account")}te.success("Admin account created! Signing you in...");const{error:st}=await ct.auth.signInWithPassword({email:r,password:c});if(st)throw st;j(!0),s?.()}}catch(ce){D(ce?.message||"Authentication failed"),console.error("[Login] Error:",ce)}finally{w(!1)}},qe=async()=>{w(!0),D("");try{const{data:he,error:ce}=await ct.auth.verifyOtp({email:r,token:Y,type:"magiclink"});if(ce)throw ce;if(!he.session)throw new Error("Failed to create session");te.success("Logged in successfully"),s?.()}catch(he){D(he?.message||"Invalid code")}finally{w(!1)}};return _?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(Vy,{})}),o.jsxs(At,{className:"w-full max-w-md shadow-2xl",children:[o.jsxs(Aa,{className:"text-center",children:[o.jsx("div",{className:"mx-auto bg-primary/10 p-4 rounded-full w-fit mb-4",children:o.jsx(Hi,{className:"w-12 h-12"})}),o.jsx(Ca,{className:"text-2xl",children:E?"Welcome Back":"Welcome to Email Automator"}),o.jsx(as,{children:E?B==="password"?"Sign in to access your email automation":P==="email"?"Receive a login code via email":`Enter code sent to ${r}`:"Create the first admin account to get started"})]}),o.jsxs("form",{onSubmit:le,children:[o.jsxs(ka,{className:"space-y-4",children:[!E&&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(Se,{value:h,onChange:he=>m(he.target.value),required:!E,placeholder:"John"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Last Name"}),o.jsx(Se,{value:y,onChange:he=>p(he.target.value),required:!E,placeholder:"Doe"})]})]}),B==="password"||P==="email"?o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Email"}),o.jsx(Se,{type:"email",placeholder:"admin@example.com",value:r,onChange:he=>l(he.target.value),required:!0,autoComplete:"email",disabled:P==="verify"})]}):null,B==="password"&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Password"}),o.jsx(Se,{type:"password",placeholder:"••••••••",value:c,onChange:he=>d(he.target.value),required:!0,minLength:6,autoComplete:E?"current-password":"new-password"})]}),B==="otp"&&P==="verify"&&o.jsxs("div",{className:"space-y-4 py-2",children:[o.jsx("div",{className:"flex justify-center",children:o.jsx(x2,{value:Y,onChange:H,length:6,onComplete:()=>{}})}),o.jsx(Z,{type:"button",variant:"link",className:"w-full text-xs text-muted-foreground",onClick:()=>W("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:R}),R.includes("configuration")||R.includes("Invalid API key")||R.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(hv,{className:"flex flex-col gap-3",children:[B==="otp"&&P==="verify"?o.jsx(Z,{type:"button",onClick:qe,disabled:g||Y.length!==6,className:"w-full",children:g?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:g||!r||B==="password"&&!c,className:"w-full",children:g?o.jsxs(o.Fragment,{children:[o.jsx($t,{className:"w-4 h-4 mr-2 animate-spin"}),E?B==="otp"?"Send Code":"Signing in...":"Creating Account..."]}):o.jsxs(o.Fragment,{children:[E?B==="otp"?o.jsx(qd,{className:"w-4 h-4 mr-2"}):o.jsx(xw,{className:"w-4 h-4 mr-2"}):o.jsx(e_,{className:"w-4 h-4 mr-2"}),E?B==="otp"?"Send Login Code":"Sign In":"Create Admin Account"]})}),E&&o.jsx("div",{className:"flex flex-col gap-2 w-full",children:B==="password"?o.jsxs(Z,{type:"button",variant:"ghost",className:"w-full text-sm font-normal text-muted-foreground hover:text-primary",onClick:()=>{q("otp"),W("email"),D("")},children:[o.jsx(hw,{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:()=>{q("password"),D("")},children:[o.jsx(Tx,{className:"w-4 h-4 mr-2"}),"Sign in with Password"]})}),E&&o.jsx("p",{className:"text-xs text-center text-muted-foreground mt-2",children:"New users must be invited by an admin."})]})]})]})]})}const Pv=void 0,_2=void 0;function S2(s,a){const r=s.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 j2(s){try{const{data:a,error:r}=await s.rpc("get_latest_migration_timestamp");return r?(console.warn("Could not get latest migration timestamp:",r.message),{version:null,latestMigrationTimestamp:null}):{version:Pv,latestMigrationTimestamp:a||null}}catch(a){return console.error("Error checking database migration info:",a),{version:null,latestMigrationTimestamp:null}}}async function N2(s){const a=Pv,r=_2,l=await j2(s);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=S2(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 Kv="email_automator_migration_reminder_dismissed_at";function E2(s=24){try{const a=localStorage.getItem(Kv);if(!a)return!1;const r=new Date(a).getTime();return(Date.now()-r)/(1e3*60*60)<s}catch(a){return console.error("Error checking migration reminder:",a),!1}}function T2(){try{localStorage.setItem(Kv,new Date().toISOString())}catch(s){console.error("Error dismissing migration reminder:",s)}}function A2({status:s,onDismiss:a,onLearnMore:r}){const[l,c]=x.useState(!0);if(!l)return null;const d=()=>{T2(),c(!1),a?.()},h=()=>{r?r():(navigator.clipboard.writeText("npx email-automator migrate"),te.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(Mr,{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(al,{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 (",s.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 Do({code:s,label:a}){const[r,l]=x.useState(!1),c=typeof navigator<"u"&&!!navigator.clipboard?.writeText,d=async()=>{if(!c){te.error("Clipboard not supported");return}try{await navigator.clipboard.writeText(s),l(!0),window.setTimeout(()=>l(!1),2e3),te.success("Copied to clipboard")}catch(h){console.error("Failed to copy:",h),te.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:s})}),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(Na,{className:"h-4 w-4 text-green-600"}):o.jsx(tw,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:r?"Copied":"Copy code"})]})]})]})}function yy({open:s,onOpenChange:a,status:r}){const l=bn(),[c,d]=x.useState(!0),[h,m]=x.useState(!1),[y,p]=x.useState([]),[g,w]=x.useState(""),[_,S]=x.useState(""),E=x.useRef(null),j=x.useMemo(()=>{const D=l?.url;if(!D)return"";try{return new URL(D).hostname.split(".")[0]||""}catch{return""}},[l?.url]);x.useEffect(()=>{E.current&&E.current.scrollIntoView({behavior:"smooth"})},[y]);const R=async()=>{if(!j){te.error("Missing Project ID");return}if(!_&&!g){te.error("Provide an access token or database password.");return}m(!0),p(["Initializing migration..."]);try{const D=async W=>{const Y=new TextDecoder;let H="",Q=null;const le=qe=>{const he=qe.replace(/\r$/,"");if(he.trim()){if(he.startsWith("RESULT:")){const ce=he.replace("RESULT:","").trim();(ce==="success"||ce==="failure")&&(Q=ce);return}p(ce=>[...ce,he])}};for(;;){const{done:qe,value:he}=await W.read();if(qe)break;H+=Y.decode(he,{stream:!0});const ce=H.split(`
96
+ `);H=ce.pop()||"",ce.forEach(le)}return H+=Y.decode(),H&&le(H),Q};p(W=>[...W,"","📦 Database Migration & Edge Functions Deployment"]);const B=await fetch("/api/migrate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectRef:j,dbPassword:g,accessToken:_})});if(!B.ok)throw new Error(`Migration failed: ${B.status} ${B.statusText}`);const q=B.body?.getReader();if(!q)throw new Error("No migration response stream received.");if(await D(q)!=="success")throw new Error("Migration did not complete successfully");p(W=>[...W,"","═".repeat(60),"✅ Setup Complete!","","✓ Database schema updated","✓ Edge Functions deployed","","🎉 Your Email Automator is ready to use!","📝 The application will reload automatically...","═".repeat(60)]),setTimeout(()=>{window.location.reload()},3e3)}catch(D){console.error(D),p(B=>[...B,"",`❌ Error: ${D instanceof Error?D.message:String(D)}`]),te.error("Setup failed. Check logs for details.")}finally{m(!1)}};return o.jsx(yn,{open:s,onOpenChange:D=>!h&&a(D),children:o.jsxs(vn,{className:"max-h-[90vh] sm:max-w-5xl overflow-y-auto",children:[o.jsxs(Oa,{children:[o.jsxs(Ra,{className:"flex items-center gap-2 text-xl",children:[o.jsx(Mr,{className:"h-6 w-6 text-red-700 dark:text-red-600"}),"Database Setup Required"]}),o.jsxs(Da,{children:["Your application version (",r.appVersion,") requires database migration and Edge Functions deployment to function correctly."]})]}),o.jsxs("div",{className:"space-y-6",children:[o.jsxs(el,{children:[o.jsx(Dr,{className:"h-4 w-4"}),o.jsxs(tl,{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:"Deploys Edge Functions (API endpoints) to your Supabase project"}),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 Setup"}),o.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Run database migration and deploy Edge Functions directly from your browser. No CLI installation required - everything is bundled."}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(pa,{htmlFor:"project-id",children:"Supabase Project ID"}),o.jsx(Se,{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(pa,{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(Pi,{className:"h-3 w-3"})]})]}),o.jsx(Se,{id:"access-token",type:"password",placeholder:"sbp_...",value:_,onChange:D=>S(D.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(pa,{htmlFor:"db-password",children:"Database Password"}),o.jsx(Se,{id:"db-password",type:"password",placeholder:"Your database password",value:g,onChange:D=>w(D.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:R,disabled:h,className:"w-full",children:h?o.jsxs(o.Fragment,{children:[o.jsx($t,{className:"mr-2 h-4 w-4 animate-spin"}),"Running Setup..."]}):o.jsxs(o.Fragment,{children:[o.jsx(Vd,{className:"mr-2 h-4 w-4"}),"Start Setup"]})})]})]}),o.jsxs("div",{className:"rounded-lg border bg-black text-white font-mono text-xs p-4 h-64 overflow-y-auto",children:[y.length===0?o.jsx("div",{className:"text-gray-500 italic",children:"Waiting to start..."}):y.map((D,B)=>o.jsx("div",{className:"mb-1 whitespace-pre-wrap",children:D},B)),o.jsx("div",{ref:E})]})]}):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(Do,{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(Do,{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(Do,{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(Do,{code:"npx email-automator migrate"})]})]})]}),o.jsxs(el,{className:"border-red-200 bg-red-50 dark:border-red-900/40 dark:bg-red-950/20",children:[o.jsx(Mr,{className:"h-4 w-4 text-red-700 dark:text-red-600"}),o.jsxs(tl,{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(Ar,{children:o.jsx(Z,{type:"button",variant:"outline",onClick:()=>a(!1),disabled:h,children:"Close"})})]})})}function C2(){const[s,a]=x.useState([]),{isExpanded:r,setIsExpanded:l}=fv(),[c,d]=x.useState({});x.useEffect(()=>{h();const g=ct.channel("processing_events_feed").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events"},w=>{const _=w.new;_.event_type==="error"&&d(S=>({...S,[_.id]:!0})),a(S=>{const E=[_,...S];return _.details?.is_completion&&r&&setTimeout(()=>{l(!1)},3e3),E.length>100?E.slice(0,100):E})}).subscribe();return()=>{ct.removeChannel(g)}},[r,l]);const h=async()=>{const{data:g}=await ct.from("processing_events").select("*").order("created_at",{ascending:!1}).limit(50);g&&a(g)},m=g=>{d(w=>({...w,[g]:!w[g]}))},y=g=>{if(g.details?.is_completion)return o.jsx(Ii,{className:"w-3 h-3 text-emerald-500"});switch(g.event_type){case"analysis":return o.jsx(Vi,{className:"w-3 h-3 text-purple-500"});case"action":return o.jsx(Bo,{className:"w-3 h-3 text-emerald-500"});case"error":return o.jsx(Mr,{className:"w-3 h-3 text-red-500"});default:return o.jsx(Dr,{className:"w-3 h-3 text-blue-500"})}},p=g=>new Date(g).toLocaleTimeString([],{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"});return r?o.jsxs(At,{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(Aa,{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(Vd,{className:"w-4 h-4 text-primary"}),o.jsx(Ca,{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(wx,{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(Nw,{className:"w-4 h-4"})})]})]}),o.jsxs(ka,{className:"flex-1 overflow-y-auto p-4 font-mono text-xs space-y-6 custom-scrollbar",children:[s.length===0&&o.jsx("div",{className:"text-center text-muted-foreground py-20 italic",children:"Waiting for agent activity..."}),s.map((g,w)=>o.jsxs("div",{className:"relative pl-8 animate-in fade-in slide-in-from-top-2 duration-300",children:[w!==s.length-1&&o.jsx("div",{className:"absolute left-[13px] top-7 bottom-[-24px] w-[1px] bg-border"}),o.jsx("div",{className:Oe("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",g.event_type==="error"&&"border-red-500/50 bg-red-500/5",g.event_type==="analysis"&&"border-purple-500/50 bg-purple-500/5",g.event_type==="action"&&"border-emerald-500/50 bg-emerald-500/5",g.details?.is_completion&&"border-emerald-500/50 bg-emerald-500/5"),children:y(g)}),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:Oe("font-bold uppercase tracking-tight text-[10px]",g.event_type==="info"&&"text-muted-foreground",g.event_type==="analysis"&&"text-purple-600 dark:text-purple-400",g.event_type==="action"&&"text-emerald-600 dark:text-emerald-400",g.event_type==="error"&&"text-red-600 dark:text-red-400"),children:g.agent_state}),o.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:p(g.created_at)})]}),(g.details?.system_prompt||g.details?._raw_response||g.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(g.id),children:[c[g.id]?o.jsx(Gx,{className:"w-3 h-3 mr-1"}):o.jsx(Bx,{className:"w-3 h-3 mr-1"}),"Details"]})]}),g.event_type==="analysis"&&g.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:Oe("px-1.5 py-0.5 rounded text-[9px] font-bold border",g.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:g.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:g.details.category})]}),o.jsxs("p",{className:"text-foreground/90 italic leading-relaxed",children:['"',g.details.summary,'"']}),g.details.suggested_actions&&g.details.suggested_actions.length>0&&o.jsx("div",{className:"pt-1 flex items-center gap-2 flex-wrap",children:g.details.suggested_actions.map(_=>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(Bo,{className:"w-2.5 h-2.5"}),_]},_))}),g.details.usage&&o.jsx("div",{className:"pt-1.5 flex items-center gap-3 text-[9px] text-muted-foreground/70 border-t border-purple-500/10 mt-1",children:o.jsxs("span",{children:["Tokens: ",g.details.usage.prompt_tokens," (in) + ",g.details.usage.completion_tokens," (out) = ",o.jsx("span",{className:"text-purple-500 font-bold",children:g.details.usage.total_tokens})]})})]}):g.event_type==="action"&&g.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:[g.details.action==="delete"&&"Moved to Trash",g.details.action==="archive"&&"Archived Email",g.details.action==="draft"&&"Drafted Reply",g.details.action==="read"&&"Marked as Read",g.details.action==="star"&&"Starred Email",!["delete","archive","draft","read","star"].includes(g.details.action)&&g.details.action]}),g.details.reason&&o.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1.5 flex items-center gap-1",children:[o.jsx(Dr,{className:"w-3 h-3"}),g.details.reason]})]}):g.event_type==="error"&&g.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 g.details.error=="object"?g.details.error.message||JSON.stringify(g.details.error):g.details.error}):g.details?.is_completion?o.jsxs("div",{className:"bg-emerald-500/5 border border-emerald-500/20 rounded-lg p-3 space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2 text-emerald-600 dark:text-emerald-400 font-bold uppercase text-[9px] tracking-[0.2em]",children:[o.jsx(Ii,{className:"w-3.5 h-3.5"}),"Batch Sync Finished"]}),o.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-1",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("p",{className:"text-[10px] text-muted-foreground uppercase",children:"Processed"}),o.jsx("p",{className:"text-sm font-bold",children:g.details.total_processed||0})]}),o.jsxs("div",{className:"space-y-0.5",children:[o.jsx("p",{className:"text-[10px] text-muted-foreground uppercase",children:"Actions"}),o.jsx("p",{className:"text-sm font-bold text-emerald-500",children:(g.details.deleted||0)+(g.details.drafted||0)})]})]}),g.details.errors>0&&o.jsxs("p",{className:"text-[10px] text-red-500 font-bold pt-1 border-t border-emerald-500/10",children:["⚠️ ",g.details.errors," items failed to process."]})]}):o.jsx("p",{className:"text-muted-foreground leading-relaxed",children:g.details?.message||JSON.stringify(g.details)}),c[g.id]&&o.jsxs("div",{className:"mt-2 space-y-3 animate-in fade-in zoom-in-95 duration-200",children:[g.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(Ls,{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:g.details.system_prompt})})]}),g.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(Ls,{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:g.details.content_preview})})]}),g.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(Ls,{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(g.details._raw_response),null,2)})})]}),g.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(Ls,{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 g.details.raw_response=="object"?JSON.stringify(g.details.raw_response,null,2):g.details.raw_response})})]})]})]})]},g.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(Vd,{className:"w-4 h-4 mr-2"}),"Live Activity",s.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 k2(){const{state:s,isSubscribed:a,actions:r}=qr(),[l,c]=x.useState(!1),[d,h]=x.useState("dashboard"),[m,y]=x.useState(!0),[p,g]=x.useState(!1);if(x.useEffect(()=>{const Y=()=>{if(Ta.isEnabled()){const H=new(window.AudioContext||window.webkitAudioContext);H.state==="suspended"&&H.resume()}window.removeEventListener("click",Y),window.removeEventListener("keydown",Y)};return window.addEventListener("click",Y),window.addEventListener("keydown",Y),()=>{window.removeEventListener("click",Y),window.removeEventListener("keydown",Y)}},[]),x.useEffect(()=>{const H=new URLSearchParams(window.location.search).get("code");H&&!p&&(async()=>{g(!0);try{const le=await Me.connectGmail(H);if(le.data?.success)te.success("Gmail connected successfully!"),window.opener?setTimeout(()=>window.close(),1500):(window.history.replaceState({},"",window.location.pathname),r.fetchAccounts());else{const qe=typeof le.error=="string"?le.error:le.error?.message;te.error(qe||"Failed to connect Gmail")}}catch{te.error("Connection failed")}finally{g(!1)}})()},[]),p)return o.jsx($i,{text:"Connecting account..."});const[w,_]=x.useState(null),[S,E]=x.useState(!1),[j,R]=x.useState(!1),[D,B]=x.useState(!1);x.useEffect(()=>{(async()=>{const H=bn();if(!H){c(!0),y(!1);return}if((await iv(H.url,H.anonKey)).valid){if(s.isInitialized){try{const le=await N2(ct);_(le),le.needsMigration&&s.isAuthenticated&&!E2()&&E(!0)}catch(le){console.error("[App] Migration check failed:",le)}s.isAuthenticated&&(r.fetchAccounts(),r.fetchRules(),r.fetchSettings(),r.fetchProfile())}}else{c(!0),y(!1);return}y(!1)})()},[s.isInitialized,s.isAuthenticated]),x.useEffect(()=>{const Y=async()=>{try{await Me.healthCheck()}catch{console.warn("[App] Keep-alive ping failed")}};Y();const H=setInterval(Y,3e4);return()=>clearInterval(H)},[]);const q=()=>{R(!0),E(!1)},P={migrationStatus:w,showMigrationBanner:S,showMigrationModal:j,openMigrationModal:q,suppressMigrationBanner:D,setSuppressMigrationBanner:B};if(m)return o.jsx($i,{text:"Checking configuration..."});if(l)return o.jsx(rf,{onComplete:()=>{c(!1),window.location.reload()}});if(!s.isInitialized)return o.jsx($i,{text:"Initializing..."});if(!s.isAuthenticated&&w?.needsMigration)return bn()?o.jsx(ay,{value:P,children:o.jsxs("div",{className:"min-h-screen bg-background flex flex-col items-center justify-center p-8 gap-8",children:[o.jsxs("div",{className:"text-center space-y-2",children:[o.jsx(Hi,{className:"w-16 h-16 mx-auto mb-4"}),o.jsx("h1",{className:"text-3xl font-bold",children:"System Setup Required"}),o.jsx("p",{className:"text-muted-foreground max-w-md",children:"Your database schema and Edge Functions need to be initialized before you can create an account."})]}),o.jsx(yy,{open:!0,onOpenChange:()=>{},status:w})]})}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"min-h-screen bg-background flex flex-col items-center justify-center p-8 gap-8",children:o.jsxs("div",{className:"text-center space-y-2",children:[o.jsx(Hi,{className:"w-16 h-16 mx-auto mb-4"}),o.jsx("h1",{className:"text-3xl font-bold",children:"Welcome to Email Automator"}),o.jsx("p",{className:"text-muted-foreground max-w-md",children:"Let's get you set up. First, connect to your Supabase database."})]})}),o.jsx(rf,{onComplete:()=>{window.location.reload()},canClose:!1})]});if(!s.isAuthenticated)return o.jsx(w2,{onConfigure:()=>c(!0)});const W=async()=>{await ct.auth.signOut(),te.success("Logged out successfully")};return o.jsx(ay,{value:P,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(Hi,{className:"w-8 h-8"}),o.jsx("span",{className:"hidden sm:inline",children:"Email Automator"}),o.jsx("span",{className:"sm:hidden",children:"Email AI"})]}),o.jsxs("div",{className:Oe("flex items-center gap-1.5 px-2 h-6 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.jsxs("div",{className:"relative flex items-center justify-center",children:[a&&o.jsx("span",{className:"absolute inline-flex h-3 w-3 rounded-full bg-emerald-500/40 animate-ping"}),o.jsx("div",{className:Oe("relative w-2 h-2 rounded-full",a?"bg-emerald-500":"bg-yellow-500")})]}),o.jsx("span",{className:"hidden xs:inline leading-none",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(yw,{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(wy,{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($d,{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(Vy,{}),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:s.profile?.avatar_url?o.jsx("img",{src:s.profile.avatar_url,alt:"Profile",className:"w-full h-full object-cover"}):o.jsx(Xx,{className:"w-5 h-5"})}),o.jsx(Z,{variant:"ghost",size:"sm",onClick:W,className:"text-muted-foreground hover:text-foreground w-8 px-0",title:"Sign out",children:o.jsx(_w,{className:"w-4 h-4"})})]})]})}),o.jsxs("main",{className:"max-w-7xl mx-auto p-4 sm:p-8 mt-4 mb-12",children:[d==="dashboard"&&o.jsx(o2,{}),d==="config"&&o.jsx(f2,{}),d==="analytics"&&o.jsx(R2,{}),d==="account"&&o.jsx(g2,{})]}),o.jsx("footer",{className:"max-w-7xl mx-auto px-4 sm:px-8 pb-8 text-center sm:text-left",children:o.jsxs("p",{className:"text-[10px] font-medium text-muted-foreground/40 uppercase tracking-[0.2em]",children:["Email Automator ",o.jsx("span",{className:"mx-1",children:"•"})," v","2.10.2"]})}),s.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:s.error})})}),w&&S&&!D&&o.jsx(A2,{status:w,onDismiss:()=>E(!1),onLearnMore:q}),w&&o.jsx(yy,{open:j,onOpenChange:R,status:w}),o.jsx(C2,{})]})})}function O2({runId:s,accountEmail:a,isOpen:r,onOpenChange:l}){const[c,d]=x.useState([]),[h,m]=x.useState(!1);x.useEffect(()=>{r&&s&&y()},[r,s]);const y=async()=>{if(s){m(!0);try{const g=await Me.getRunEvents(s);g.data&&d(g.data.events)}catch(g){console.error("Failed to fetch run trace:",g)}finally{m(!1)}}},p=g=>{switch(g){case"analysis":return o.jsx(Vi,{className:"w-4 h-4 text-purple-500"});case"action":return o.jsx(Bo,{className:"w-4 h-4 text-emerald-500"});case"error":return o.jsx(zr,{className:"w-4 h-4 text-red-500"});default:return o.jsx(Dr,{className:"w-4 h-4 text-blue-500"})}};return o.jsx(yn,{open:r,onOpenChange:l,children:o.jsxs(vn,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 overflow-hidden",children:[o.jsxs(Oa,{className:"p-6 border-b",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(df,{className:"w-5 h-5 text-primary"}),o.jsx(Ra,{children:"Sync Run Trace"})]}),o.jsx(Da,{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($i,{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((g,w)=>o.jsxs("div",{className:"relative pl-8",children:[w!==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:p(g.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:g.agent_state}),g.emails?.subject&&o.jsxs("span",{className:"text-[10px] text-primary font-medium truncate max-w-[300px]",children:["Re: ",g.emails.subject]})]}),o.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(Rr,{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-2",children:[o.jsxs("p",{className:"text-xs text-foreground italic leading-relaxed",children:['"',g.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:g.details?.category}),g.details?.suggested_actions?.map(_=>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:_},_))]}),g.details?.usage&&o.jsxs("div",{className:"flex gap-3 pt-1.5 mt-1 border-t border-border/50 text-[9px] text-muted-foreground",children:[o.jsxs("span",{children:["In: ",o.jsx("b",{children:g.details.usage.prompt_tokens})]}),o.jsxs("span",{children:["Out: ",o.jsx("b",{children:g.details.usage.completion_tokens})]}),o.jsxs("span",{children:["Total: ",o.jsx("span",{className:"text-primary font-bold",children:g.details.usage.total_tokens})]})]})]}),g.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: ",g.details?.action]}),o.jsx(uf,{className:"w-4 h-4 text-emerald-500"})]}),g.event_type==="error"&&o.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 font-bold",children:g.details?.error})]})]})]},g.id))})]})})}function R2(){const{state:s,actions:a}=qr(),[r,l]=x.useState(null),[c,d]=x.useState(void 0),[h,m]=x.useState(!1);if(x.useEffect(()=>{a.fetchStats()},[]),!s.stats)return o.jsx($i,{text:"Loading analytics..."});const y=(g,w)=>{l(g),d(w),m(!0)},{stats:p}=s;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(wy,{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(Mo,{title:"Total Emails",value:p.totalEmails,color:"primary"}),o.jsx(Mo,{title:"Spam Caught",value:p.categoryCounts.spam||0,color:"destructive"}),o.jsx(Mo,{title:"Actions Taken",value:Object.values(p.actionCounts).reduce((g,w)=>g+w,0)-(p.actionCounts.none||0),color:"emerald"}),o.jsx(Mo,{title:"Accounts",value:p.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(p.categoryCounts).map(([g,w])=>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:g}),o.jsx("span",{className:"text-muted-foreground",children:w})]}),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:`${w/p.totalEmails*100}%`}})})]})},g))})]}),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(p.actionCounts).map(([g,w])=>o.jsxs("div",{className:"flex items-center justify-between py-2 border-b last:border-0",children:[o.jsx("span",{className:"capitalize",children:g}),o.jsx("span",{className:"font-medium",children:w})]},g))})]})]}),o.jsxs("div",{className:"bg-card border rounded-xl p-6",children:[o.jsx("h3",{className:"font-semibold mb-4",children:"Recent Sync Activity"}),p.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:p.recentSyncs.map(g=>{const w=g.completed_at?Math.round((new Date(g.completed_at).getTime()-new Date(g.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:()=>y(g.id,g.email_accounts?.email_address),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:Oe("w-2.5 h-2.5 rounded-full",g.status==="success"?"bg-emerald-500":g.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:g.email_accounts?.email_address||"System Sync"}),o.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:[o.jsx(Rr,{className:"w-3 h-3"}),new Date(g.started_at).toLocaleString(),w!==null&&o.jsxs("span",{className:"ml-2 px-1.5 py-0.5 bg-secondary rounded-full",children:[w,"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:[g.emails_processed," emails"]}),o.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[g.emails_deleted," deleted, ",g.emails_drafted," drafted"]})]})})]},g.id)})})]}),o.jsx(O2,{runId:r,accountEmail:c,isOpen:h,onOpenChange:m})]})}function Mo({title:s,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:s}),o.jsx("p",{className:`text-3xl font-bold ${l[r]||""}`,children:a})]})}function D2(){return o.jsx(c_,{defaultTheme:"system",storageKey:"email-automator-theme",children:o.jsx(sN,{children:o.jsx(aN,{children:o.jsxs(eN,{children:[o.jsx(k2,{}),o.jsx(Fj,{})]})})})})}mx.createRoot(document.getElementById("root")).render(o.jsx(vy.StrictMode,{children:o.jsx(D2,{})}));