PageSourceSearch

https://apexmob.life/assets/index-DuapSmdQ.js

js apexmob.life collected 2026-09-24 15:05:07 UTC 771,414 bytes, 46 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vision-board-D03YaSUI.js","assets/org-ui-VEmIhZ_W.js","assets/team-progress-I1WOgsPJ.js","assets/OnboardingProgressDialog-CMNOTTro.js","assets/EappQuizDialog-Ci7_qzdx.js","assets/reset-password-Bnze0Oll.js","assets/recovery-log-Ikwe5lPr.js","assets/org-chart-CF54tUDW.js","assets/OrgWorkspace-5z9ahcsD.js","assets/hierarchy-audit-Dn96y_C7.js","assets/dashboard-CrW1C3-U.js","assets/impersonation-SYQvXYEf.js","assets/index-CTrg6LRM.js","assets/security-audit-Hy72aGjP.js","assets/EliteOnboardingPanel-CNiGxivx.js","assets/elite-onboarding-CsF2RymR.js","assets/use-elite-onboarding-CHks_EMP.js","assets/ProductKnowledgeQuiz-VvOiuu3X.js","assets/onboarding.index-B9vNxcdB.js","assets/onboarding.product-quiz-CBCO9GLq.js","assets/onboarding.eapp-quiz-CTlSl11j.js","assets/onboarding.ao-intel-CLHprjyX.js","assets/onboarding.admin-CHt6i4nF.js","assets/admin.index-CDmgYJC9.js"])))=>i.map(i=>d[i]);
2function iT(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&&!Array.isArray(a)){for(const o in a)if(o!=="default"&&!(o in e)){const l=Object.getOwnPropertyDescriptor(a,o);l&&Object.defineProperty(e,o,l.get?l:{enumerable:!0,get:()=>a[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var P3=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function k_(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var oh={exports:{}},Do={};var Gv;function oT(){if(Gv)return Do;Gv=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,o,l){var u=null;if(l!==void 0&&(u=""+l),o.key!==void 0&&(u=""+o.key),"key"in o){l={};for(var h in o)h!=="key"&&(l[h]=o[h])}else l=o;return o=l.ref,{$$typeof:e,type:a,key:u,ref:o!==void 0?o:null,props:l}}return Do.Fragment=t,Do.jsx=n,Do.jsxs=n,Do}var Vv;function lT(){return Vv||(Vv=1,oh.exports=oT()),oh.exports}var y=lT(),lh={exports:{}},ke={};var Yv;function cT(){if(Yv)return ke;Yv=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),b=Symbol.iterator;function _(N){return N===null||typeof N!="object"?null:(N=b&&N[b]||N["@@iterator"],typeof N=="function"?N:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},R=Object.assign,E={};function x(N,X,Z){this.props=N,this.context=X,this.refs=E,this.updater=Z||S}x.prototype.isReactComponent={},x.prototype.setState=function(N,X){if(typeof N!="object"&&typeof N!="function"&&N!=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,N,X,"setState")},x.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function k(){}k.prototype=x.prototype;function D(N,X,Z){this.props=N,this.context=X,this.refs=E,this.updater=Z||S}var j=D.prototype=new k;j.constructor=D,R(j,x.prototype),j.isPureReactComponent=!0;var H=Array.isArray;function U(){}var B={H:null,A:null,T:null,S:null},V=Object.prototype.hasOwnProperty;function W(N,X,Z){var re=Z.ref;return{$$typeof:e,type:N,key:X,ref:re!==void 0?re:null,props:Z}}function se(N,X){return W(N.type,X,N.props)}function le(N){return typeof N=="object"&&N!==null&&N.$$typeof===e}function ue(N){var X={"=":"=0",":":"=2"};return"$"+N.replace(/[=:]/g,function(Z){return X[Z]})}var Ce=/\/+/g;function Se(N,X){return typeof N=="object"&&N!==null&&N.key!=null?ue(""+N.key):X.toString(36)}function Le(N){switch(N.status){case"fulfilled":return N.value;case"rejected":throw N.reason;default:switch(typeof N.status=="string"?N.then(U,U):(N.status="pending",N.then(function(X){N.status==="pending"&&(N.status="fulfilled",N.value=X)},function(X){N.status==="pending"&&(N.status="rejected",N.reason=X)})),N.status){case"fulfilled":return N.value;case"rejected":throw N.reason}}throw N}function P(N,X,Z,re,Y){var Q=typeof N;(Q==="undefined"||Q==="boolean")&&(N=null);var ve=!1;if(N===null)ve=!0;else switch(Q){case"bigint":case"string":case"number":ve=!0;break;case"object":switch(N.$$typeof){case e:case t:ve=!0;break;case v:return ve=N._init,P(ve(N._payload),X,Z,re,Y)}}if(ve)return Y=Y(N),ve=re===""?"."+Se(N,0):re,H(Y)?(Z="",ve!=null&&(Z=ve.replace(Ce,"$&/")+"/"),P(Y,X,Z,"",function(it){return it})):Y!=null&&(le(Y)&&(Y=se(Y,Z+(Y.key==null||N&&N.key===Y.key?"":(""+Y.key).replace(Ce,"$&/")+"/")+ve)),X.push(Y)),1;ve=0;var ie=re===""?".":re+":";if(H(N))for(var Oe=0;Oe<N.length;Oe++)re=N[Oe],Q=ie+Se(re,Oe),ve+=P(re,X,Z,Q,Y);else if(Oe=_(N),typeof Oe=="function")for(N=Oe.call(N),Oe=0;!(re=N.next()).done;)re=re.value,Q=ie+Se(re,Oe++),ve+=P(re,X,Z,Q,Y);else if(Q==="object"){if(typeof N.then=="function")return P(Le(N),X,Z,re,Y);throw X=String(N),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(N).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return ve}function ne(N,X,Z){if(N==null)return N;var re=[],Y=0;return P(N,re,"","",function(Q){return X.call(Z,Q,Y++)}),re}function oe(N){if(N._status===-1){var X=N._result;X=X(),X.then(function(Z){(N._status===0||N._status===-1)&&(N._status=1,N._result=Z)},function(Z){(N._status===0||N._status===-1)&&(N._status=2,N._result=Z)}),N._status===-1&&(N._status=0,N._result=X)}if(N._status===1)return N._result.default;throw N._result}var Te=typeof reportError=="function"?reportError:function(N){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof N=="object"&&N!==null&&typeof N.message=="string"?String(N.message):String(N),error:N});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",N);return}console.error(N)},he={map:ne,forEach:function(N,X,Z){ne(N,function(){X.apply(this,arguments)},Z)},count:function(N){var X=0;return ne(N,function(){X++}),X},toArray:function(N){return ne(N,function(X){return X})||[]},only:function(N){if(!le(N))throw Error("React.Children.only expected to receive a single React element child.");return N}};return ke.Activity=p,ke.Children=he,ke.Component=x,ke.Fragment=n,ke.Profiler=o,ke.PureComponent=
2D,ke.StrictMode=a,ke.Suspense=d,ke.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=B,ke.__COMPILER_RUNTIME={__proto__:null,c:function(N){return B.H.useMemoCache(N)}},ke.cache=function(N){return function(){return N.apply(null,arguments)}},ke.cacheSignal=function(){return null},ke.cloneElement=function(N,X,Z){if(N==null)throw Error("The argument must be a React element, but you passed "+N+".");var re=R({},N.props),Y=N.key;if(X!=null)for(Q in X.key!==void 0&&(Y=""+X.key),X)!V.call(X,Q)||Q==="key"||Q==="__self"||Q==="__source"||Q==="ref"&&X.ref===void 0||(re[Q]=X[Q]);var Q=arguments.length-2;if(Q===1)re.children=Z;else if(1<Q){for(var ve=Array(Q),ie=0;ie<Q;ie++)ve[ie]=arguments[ie+2];re.children=ve}return W(N.type,Y,re)},ke.createContext=function(N){return N={$$typeof:u,_currentValue:N,_currentValue2:N,_threadCount:0,Provider:null,Consumer:null},N.Provider=N,N.Consumer={$$typeof:l,_context:N},N},ke.createElement=function(N,X,Z){var re,Y={},Q=null;if(X!=null)for(re in X.key!==void 0&&(Q=""+X.key),X)V.call(X,re)&&re!=="key"&&re!=="__self"&&re!=="__source"&&(Y[re]=X[re]);var ve=arguments.length-2;if(ve===1)Y.children=Z;else if(1<ve){for(var ie=Array(ve),Oe=0;Oe<ve;Oe++)ie[Oe]=arguments[Oe+2];Y.children=ie}if(N&&N.defaultProps)for(re in ve=N.defaultProps,ve)Y[re]===void 0&&(Y[re]=ve[re]);return W(N,Q,Y)},ke.createRef=function(){return{current:null}},ke.forwardRef=function(N){return{$$typeof:h,render:N}},ke.isValidElement=le,ke.lazy=function(N){return{$$typeof:v,_payload:{_status:-1,_result:N},_init:oe}},ke.memo=function(N,X){return{$$typeof:m,type:N,compare:X===void 0?null:X}},ke.startTransition=function(N){var X=B.T,Z={};B.T=Z;try{var re=N(),Y=B.S;Y!==null&&Y(Z,re),typeof re=="object"&&re!==null&&typeof re.then=="function"&&re.then(U,Te)}catch(Q){Te(Q)}finally{X!==null&&Z.types!==null&&(X.types=Z.types),B.T=X}},ke.unstable_useCacheRefresh=function(){return B.H.useCacheRefresh()},ke.use=function(N){return B.H.use(N)},ke.useActionState=function(N,X,Z){return B.H.useActionState(N,X,Z)},ke.useCallback=function(N,X){return B.H.useCallback(N,X)},ke.useContext=function(N){return B.H.useContext(N)},ke.useDebugValue=function(){},ke.useDeferredValue=function(N,X){return B.H.useDeferredValue(N,X)},ke.useEffect=function(N,X){return B.H.useEffect(N,X)},ke.useEffectEvent=function(N){return B.H.useEffectEvent(N)},ke.useId=function(){return B.H.useId()},ke.useImperativeHandle=function(N,X,Z){return B.H.useImperativeHandle(N,X,Z)},ke.useInsertionEffect=function(N,X){return B.H.useInsertionEffect(N,X)},ke.useLayoutEffect=function(N,X){return B.H.useLayoutEffect(N,X)},ke.useMemo=function(N,X){return B.H.useMemo(N,X)},ke.useOptimistic=function(N,X){return B.H.useOptimistic(N,X)},ke.useReducer=function(N,X,Z){return B.H.useReducer(N,X,Z)},ke.useRef=function(N){return B.H.useRef(N)},ke.useState=function(N){return B.H.useState(N)},ke.useSyncExternalStore=function(N,X,Z){return B.H.useSyncExternalStore(N,X,Z)},ke.useTransition=function(){return B.H.useTransition()},ke.version="19.2.5",ke}var Kv;function wl(){return Kv||(Kv=1,lh.exports=cT()),lh.exports}var O=wl();const ae=k_(O),U3=iT({__proto__:null,default:ae},[O]);var ch={exports:{}},Mo={},uh={exports:{}},dh={};var Wv;function uT(){return Wv||(Wv=1,(function(e){function t(P,ne){var oe=P.length;P.push(ne);e:for(;0<oe;){var Te=oe-1>>>1,he=P[Te];if(0<o(he,ne))P[Te]=ne,P[oe]=he,oe=Te;else break e}}function n(P){return P.length===0?null:P[0]}function a(P){if(P.length===0)return null;var ne=P[0],oe=P.pop();if(oe!==ne){P[0]=oe;e:for(var Te=0,he=P.length,N=he>>>1;Te<N;){var X=2*(Te+1)-1,Z=P[X],re=X+1,Y=P[re];if(0>o(Z,oe))re<he&&0>o(Y,Z)?(P[Te]=Y,P[re]=oe,Te=re):(P[Te]=Z,P[X]=oe,Te=X);else if(re<he&&0>o(Y,oe))P[Te]=Y,P[re]=oe,Te=re;else break e}}return ne}function o(P,ne){var oe=P.sortIndex-ne.sortIndex;return oe!==0?oe:P.id-ne.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,h=u.now();e.unstable_now=function(){return u.now()-h}}var d=[],m=[],v=1,p=null,b=3,_=!1,S=!1,R=!1,E=!1,x=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function j(P){for(var ne=n(m);ne!==null;){if(ne.callback===null)a(m);else if(ne.startTime<=P)a(m),ne.sortIndex=ne.expirationTime,t(d,ne);else break;ne=n(m)}}function H(P){if(R=!1,j(P),!S)if(n(d)!==null)S=!0,U||(U=!0,ue());else{var ne=n(m);ne!==null&&Le(H,ne.startTime-P)}}var U=!1,B=-1,V=5,W=-1;function se(){return E?!0:!(e.unstable_now()-W<V)}function le(){if(E=!1,U){var P=e.unstable_now();W=P;var ne=!0;
2try{e:{S=!1,R&&(R=!1,k(B),B=-1),_=!0;var oe=b;try{t:{for(j(P),p=n(d);p!==null&&!(p.expirationTime>P&&se());){var Te=p.callback;if(typeof Te=="function"){p.callback=null,b=p.priorityLevel;var he=Te(p.expirationTime<=P);if(P=e.unstable_now(),typeof he=="function"){p.callback=he,j(P),ne=!0;break t}p===n(d)&&a(d),j(P)}else a(d);p=n(d)}if(p!==null)ne=!0;else{var N=n(m);N!==null&&Le(H,N.startTime-P),ne=!1}}break e}finally{p=null,b=oe,_=!1}ne=void 0}}finally{ne?ue():U=!1}}}var ue;if(typeof D=="function")ue=function(){D(le)};else if(typeof MessageChannel<"u"){var Ce=new MessageChannel,Se=Ce.port2;Ce.port1.onmessage=le,ue=function(){Se.postMessage(null)}}else ue=function(){x(le,0)};function Le(P,ne){B=x(function(){P(e.unstable_now())},ne)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(P){P.callback=null},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(P){switch(b){case 1:case 2:case 3:var ne=3;break;default:ne=b}var oe=b;b=ne;try{return P()}finally{b=oe}},e.unstable_requestPaint=function(){E=!0},e.unstable_runWithPriority=function(P,ne){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var oe=b;b=P;try{return ne()}finally{b=oe}},e.unstable_scheduleCallback=function(P,ne,oe){var Te=e.unstable_now();switch(typeof oe=="object"&&oe!==null?(oe=oe.delay,oe=typeof oe=="number"&&0<oe?Te+oe:Te):oe=Te,P){case 1:var he=-1;break;case 2:he=250;break;case 5:he=1073741823;break;case 4:he=1e4;break;default:he=5e3}return he=oe+he,P={id:v++,callback:ne,priorityLevel:P,startTime:oe,expirationTime:he,sortIndex:-1},oe>Te?(P.sortIndex=oe,t(m,P),n(d)===null&&P===n(m)&&(R?(k(B),B=-1):R=!0,Le(H,oe-Te))):(P.sortIndex=he,t(d,P),S||_||(S=!0,U||(U=!0,ue()))),P},e.unstable_shouldYield=se,e.unstable_wrapCallback=function(P){var ne=b;return function(){var oe=b;b=ne;try{return P.apply(this,arguments)}finally{b=oe}}}})(dh)),dh}var Qv;function dT(){return Qv||(Qv=1,uh.exports=uT()),uh.exports}var fh={exports:{}},nn={};var Xv;function fT(){if(Xv)return nn;Xv=1;var e=wl();function t(d){var m="https://react.dev/errors/"+d;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)m+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+d+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var a={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function l(d,m,v){var p=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:p==null?null:""+p,children:d,containerInfo:m,implementation:v}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(d,m){if(d==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return nn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,nn.createPortal=function(d,m){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(t(299));return l(d,m,null,v)},nn.flushSync=function(d){var m=u.T,v=a.p;try{if(u.T=null,a.p=2,d)return d()}finally{u.T=m,a.p=v,a.d.f()}},nn.preconnect=function(d,m){typeof d=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,a.d.C(d,m))},nn.prefetchDNS=function(d){typeof d=="string"&&a.d.D(d)},nn.preinit=function(d,m){if(typeof d=="string"&&m&&typeof m.as=="string"){var v=m.as,p=h(v,m.crossOrigin),b=typeof m.integrity=="string"?m.integrity:void 0,_=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;v==="style"?a.d.S(d,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:p,integrity:b,fetchPriority:_}):v==="script"&&a.d.X(d,{crossOrigin:p,integrity:b,fetchPriority:_,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}
vendor: 144,728 bytes, lines 2-10
2,nn.preinitModule=function(d,m){if(typeof d=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var v=h(m.as,m.crossOrigin);a.d.M(d,{crossOrigin:v,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&a.d.M(d)},nn.preload=function(d,m){if(typeof d=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var v=m.as,p=h(v,m.crossOrigin);a.d.L(d,v,{crossOrigin:p,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},nn.preloadModule=function(d,m){if(typeof d=="string")if(m){var v=h(m.as,m.crossOrigin);a.d.m(d,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:v,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else a.d.m(d)},nn.requestFormReset=function(d){a.d.r(d)},nn.unstable_batchedUpdates=function(d,m){return d(m)},nn.useFormState=function(d,m,v){return u.H.useFormState(d,m,v)},nn.useFormStatus=function(){return u.H.useHostTransitionStatus()},nn.version="19.2.5",nn}var Jv;function C_(){if(Jv)return fh.exports;Jv=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),fh.exports=fT(),fh.exports}var Zv;function hT(){if(Zv)return Mo;Zv=1;var e=dT(),t=wl(),n=C_();function a(r){var s="https://react.dev/errors/"+r;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)s+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+r+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function l(r){var s=r,i=r;if(r.alternate)for(;s.return;)s=s.return;else{r=s;do s=r,(s.flags&4098)!==0&&(i=s.return),r=s.return;while(r)}return s.tag===3?i:null}function u(r){if(r.tag===13){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function h(r){if(r.tag===31){var s=r.memoizedState;if(s===null&&(r=r.alternate,r!==null&&(s=r.memoizedState)),s!==null)return s.dehydrated}return null}function d(r){if(l(r)!==r)throw Error(a(188))}function m(r){var s=r.alternate;if(!s){if(s=l(r),s===null)throw Error(a(188));return s!==r?null:r}for(var i=r,c=s;;){var f=i.return;if(f===null)break;var g=f.alternate;if(g===null){if(c=f.return,c!==null){i=c;continue}break}if(f.child===g.child){for(g=f.child;g;){if(g===i)return d(f),r;if(g===c)return d(f),s;g=g.sibling}throw Error(a(188))}if(i.return!==c.return)i=f,c=g;else{for(var w=!1,A=f.child;A;){if(A===i){w=!0,i=f,c=g;break}if(A===c){w=!0,c=f,i=g;break}A=A.sibling}if(!w){for(A=g.child;A;){if(A===i){w=!0,i=g,c=f;break}if(A===c){w=!0,c=g,i=f;break}A=A.sibling}if(!w)throw Error(a(189))}}if(i.alternate!==c)throw Error(a(190))}if(i.tag!==3)throw Error(a(188));return i.stateNode.current===i?r:s}function v(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r;for(r=r.child;r!==null;){if(s=v(r),s!==null)return s;r=r.sibling}return null}var p=Object.assign,b=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),k=Symbol.for("react.consumer"),D=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),W=Symbol.for("react.activity"),se=Symbol.for("react.memo_cache_sentinel"),le=Symbol.iterator;function ue(r){return r===null||typeof r!="object"?null:(r=le&&r[le]||r["@@iterator"],typeof r=="function"?r:null)}var Ce=Symbol.for("react.client.reference");function Se(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===Ce?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case R:return"Fragment";case x:return"Profiler";case E:return"StrictMode";case H:return"Suspense";case U:return"SuspenseList";case W:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case S:return"Portal";case D:return r.displayName||"Context";case k:return(r._context.displayName||"Context")+".Consumer";case j:var s=r.render;return r=r.displayName,r||(r=s.displayName||s.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case B:return s=r.displayName||null,s!==null?s:Se(r.type)||"Memo";case V:s=r._payload,r=r._init;try{return Se(r(s))}catch{}}return null}var Le=Array.isArray,P=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,oe={pending:!1,data:null,method:null,action:null},Te=[],he=-1;function N(r){return{current:r}}function X(r){0>he||(r.current=Te[he],Te[he]=null,he--)}function Z(r,s){he++,Te[he]=r.current,r.current=s}var re=N(null),Y=N(null),Q=N(null),ve=N(null);function ie(r,s){switch(Z(Q,s),Z(Y,r),Z(re,null),s.nodeType){case 9:case 11:r=(r=s.documentElement)&&(r=r.namespaceURI)?pv(r):0;break;default:if(r=s.tagName,s=s.namespaceURI)s=pv(s),r=mv(s,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}X(re),Z(re,r)}function Oe(){X(re),X(Y),X(Q)}function it(r){r.memoizedState!==null&&Z(ve,r);var s=re.current,i=mv(s,r.type);s!==i&&(Z(Y,r),Z(re,i))}function xe(r){Y.current===r&&(X(re),X(Y)),ve.current===r&&(X(ve),ko._currentValue=oe)}var we,Ne;function Me(r){if(we===void 0)try{throw Error()}catch(i){var s=i.stack.trim().match(/\n( *(at )?)/);we=s&&s[1]||"",Ne=-1<i.stack.indexOf(`
3    at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
4`+we+r+Ne}var Nn=!1;function Jt(r,s){if(!r||Nn)return"";Nn=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(s){var te=function(){throw Error()};if(Object.defineProperty(te.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(te,[])}catch(K){var G=K}Reflect.construct(r,[],te)}else{try{te.call()}catch(K){G=K}r.call(te.prototype)}}else{try{throw Error()}catch(K){G=K}(te=r())&&typeof te.catch=="function"&&te.catch(function(){})}}catch(K){if(K&&G&&typeof K.stack=="string")return[K.stack,G.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var g=c.DetermineComponentFrameRoot(),w=g[0],A=g[1];if(w&&A){var M=w.split(`
5`),F=A.split(`
6`);for(f=c=0;c<M.length&&!M[c].includes("DetermineComponentFrameRoot");)c++;for(;f<F.length&&!F[f].includes("DetermineComponentFrameRoot");)f++;if(c===M.length||f===F.length)for(c=M.length-1,f=F.length-1;1<=c&&0<=f&&M[c]!==F[f];)f--;for(;1<=c&&0<=f;c--,f--)if(M[c]!==F[f]){if(c!==1||f!==1)do if(c--,f--,0>f||M[c]!==F[f]){var J=`
7`+M[c].replace(" at new "," at ");return r.displayName&&J.includes("<anonymous>")&&(J=J.replace("<anonymous>",r.displayName)),J}while(1<=c&&0<=f);break}}}finally{Nn=!1,Error.prepareStackTrace=i}return(i=r?r.displayName||r.name:"")?Me(i):""}function Ve(r,s){switch(r.tag){case 26:case 27:case 5:return Me(r.type);case 16:return Me("Lazy");case 13:return r.child!==s&&s!==null?Me("Suspense Fallback"):Me("Suspense");case 19:return Me("SuspenseList");case 0:case 15:return Jt(r.type,!1);case 11:return Jt(r.type.render,!1);case 1:return Jt(r.type,!0);case 31:return Me("Activity");default:return""}}function Zt(r){try{var s="",i=null;do s+=Ve(r,i),i=r,r=r.return;while(r);return s}catch(c){return`
8Error generating stack: `+c.message+`
9`+c.stack}}var pt=Object.prototype.hasOwnProperty,en=e.unstable_scheduleCallback,ur=e.unstable_cancelCallback,yt=e.unstable_shouldYield,St=e.unstable_requestPaint,Rt=e.unstable_now,Be=e.unstable_getCurrentPriorityLevel,ut=e.unstable_ImmediatePriority,Ut=e.unstable_UserBlockingPriority,Ln=e.unstable_NormalPriority,ts=e.unstable_LowPriority,zn=e.unstable_IdlePriority,Fs=e.log,Xn=e.unstable_setDisableYieldValue,Pn=null,$t=null;function L(r){if(typeof Fs=="function"&&Xn(r),$t&&typeof $t.setStrictMode=="function")try{$t.setStrictMode(Pn,r)}catch{}}var I=Math.clz32?Math.clz32:ye,Ee=Math.log,me=Math.LN2;function ye(r){return r>>>=0,r===0?32:31-(Ee(r)/me|0)|0}var Nt=256,Tr=262144,Gs=4194304;function dr(r){var s=r&42;if(s!==0)return s;switch(r&-r){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 r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function Ae(r,s,i){var c=r.pendingLanes;if(c===0)return 0;var f=0,g=r.suspendedLanes,w=r.pingedLanes;r=r.warmLanes;var A=c&134217727;return A!==0?(c=A&~g,c!==0?f=dr(c):(w&=A,w!==0?f=dr(w):i||(i=A&~r,i!==0&&(f=dr(i))))):(A=c&~g,A!==0?f=dr(A):w!==0?f=dr(w):i||(i=c&~r,i!==0&&(f=dr(i)))),f===0?0:s!==0&&s!==f&&(s&g)===0&&(g=f&-f,i=s&-s,g>=i||g===32&&(i&4194048)!==0)?s:f}function dt(r,s){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&s)===0}function Bt(r,s){switch(r){case 1:case 2:case 4:case 8:case 64:return s+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 s+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 tn(){var r=Gs;return Gs<<=1,(Gs&62914560)===0&&(Gs=4194304),r}function ns(r){for(var s=[],i=0;31>i;i++)s.push(r);return s}function mt(r,s){r.pendingLanes|=s,s!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function dn(r,s,i,c,f,g){var w=r.pendingLanes;r.pendingLanes=i,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=i,r.entangledLanes&=i,r.errorRecoveryDisabledLanes&=i,r.shellSuspendCounter=0;var A=r.entanglements,M=r.expirationTimes,F=r.hiddenUpdates;for(i=w&~i;0<i;){var J=31-I(i),te=1<<J;A[J]=0,M[J]=-1;var G=F[J];if(G!==null)for(F[J]=null,J=0;J<G.length;J++){var K=G[J];K!==null&&(K.lane&=-536870913)}i&=~te}c!==0&&Vs(r,c,0),g!==0&&f===0&&r.tag!==0&&(r.suspendedLanes|=g&~(w&~s))}function Vs(r,s,i){r.pendingLanes|=s,r.suspendedLanes&=~s;var c=31-I(s);r.entangledLanes|=s,r.entanglements[c]=r.entanglements[c]|1073741824|i&261930}function fn(r,s){var i=r.entangledLanes|=s;for(r=r.entanglements;i;){var c=31-I(i),f=1<<c;f&s|r[c]&s&&(r[c]|=s),i&=~f}}function hn(r,s){var i=s&-s;return i=(i&42)!==0?1:ja(i),(i&(r.suspendedLanes|s))!==0?0:i}function ja(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=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:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function Jn(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function Qu(){var r=ne.p;return r!==0?r:(r=window.event,r===void 0?32:Uv(r.type))}function em(r,s){var i=ne.p;try{return ne.p=r,s()}finally{ne.p=i}}var rs=Math.random().toString(36).slice(2),Vt="__reactFiber$"+rs,pn="__reactProps$"+rs,Da="__reactContainer$"+rs,Xu="__reactEvents$"+rs,WS="__reactListeners$"+rs,QS="__reactHandles$"+rs,tm="__reactResources$"+rs,Hi="__reactMarker$"+rs;function Ju(r){delete r[Vt],delete r[pn],delete r[Xu],delete r[WS],delete r[QS]}function Ma(r){var s=r[Vt];if(s)return s;for(var i=r.parentNode;i;){if(s=i[Da]||i[Vt]){if(i=s.alternate,s.child!==null||i!==null&&i.child!==null)for(r=Sv(r);r!==null;){if(i=r[Vt])return i;r=Sv(r)}return s}r=i,i=r.parentNode}return null}function Na(r){if(r=r[Vt]||r[Da]){var s=r.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return r}return null}function qi(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r.stateNode;throw Error(a(33))}function La(r){var s=r[tm];return s||(s=r[tm]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function It(r){r[Hi]=!0}var nm=new Set,rm={};function Ys(r,s){za(r,s),za(r+"Capture",s)}function za(r,s){for(rm[r]=s,r=0;r<s.length;r++)nm.add(s[r])}var XS=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]*$"),sm={},am={};function JS(r){return pt.call(am,r)?!0:pt.call(sm,r)?!1:XS.test(r)?am[r]=!0:(sm[r]=!0,!1)}function Rl(r,s,i){if(JS(s))if(i===null)r.removeAttribute(s);else{switch(typeof i){case"undefined":case"function":case"symbol":r.removeAttribute(s);return;case"boolean":var c=s.toLowerCase().slice(0,5);if(c!=="data-"&&c!=="aria-"){r.removeAttribute(s);return}}r.setAttribute(s,""+i)}}function Al(r,s,i){if(i===null)r.removeAttribute(s);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(s);return}r.setAttribute(s,""+i)}}function Er(r,s,i,c){if(c===null)r.removeAttribute(i);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(i);return}r.setAttributeNS(s,i,""+c)}}function Un(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function im(r){var s=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function ZS(r,s,i){var c=Object.getOwnPropertyDescriptor(r.constructor.prototype,s);if(!r.hasOwnProperty(s)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var f=c.get,g=c.set;return Object.defineProperty(r,s,{configurable:!0,get:function(){return f.call(this)},set:function(w){i=""+w,g.call(this,w)}}),Object.defineProperty(r,s,{enumerable:c.enumerable}),{getValue:function(){return i},setValue:function(w){i=""+w},stopTracking:function(){r._valueTracker=null,delete r[s]}}}}function Zu(r){if(!r._valueTracker){var s=im(r)?"checked":"value";r._valueTracker=ZS(r,s,""+r[s])}}function om(r){if(!r)return!1;var s=r._valueTracker;if(!s)return!0;var i=s.getValue(),c="";return r&&(c=im(r)?r.checked?"true":"false":r.value),r=c,r!==i?(s.setValue(r),!0):!1}function kl(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var ex=/[\n"\\]/g;function $n(r){return r.replace(ex,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function ed(r,s,i,c,f,g,w,A){r.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?r.type=w:r.removeAttribute("type"),s!=null?w==="number"?(s===0&&r.value===""||r.value!=s)&&(r.value=""+Un(s)):r.value!==""+Un(s)&&(r.value=""+Un(s)):w!=="submit"&&w!=="reset"||r.removeAttribute("value"),s!=null?td(r,w,Un(s)):i!=null?td(r,w,Un(i)):c!=null&&r.removeAttribute("value"),f==null&&g!=null&&(r.defaultChecked=!!g),f!=null&&(r.checked=f&&typeof f!="function"&&typeof f!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?r.name=""+Un(A):r.removeAttribute("name")}function lm(r,s,i,c,f,g,w,A){if(g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(r.type=g),s!=null||i!=null){if(!(g!=="submit"&&g!=="reset"||s!=null)){Zu(r);return}i=i!=null?""+Un(i):"",s=s!=null?""+Un(s):i,A||s===r.value||(r.value=s),r.defaultValue=s}c=c??f,c=typeof c!="function"&&typeof c!="symbol"&&!!c,r.checked=A?r.checked:!!c,r.defaultChecked=!!c,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(r.name=w),Zu(r)}function td(r,s,i){s==="number"&&kl(r.ownerDocument)===r||r.defaultValue===""+i||(r.defaultValue=""+i)}function Pa(r,s,i,c){if(r=r.options,s){s={};for(var f=0;f<i.length;f++)s["$"+i[f]]=!0;for(i=0;i<r.length;i++)f=s.hasOwnProperty("$"+r[i].value),r[i].selected!==f&&(r[i].selected=f),f&&c&&(r[i].defaultSelected=!0)}else{for(i=""+Un(i),s=null,f=0;f<r.length;f++){if(r[f].value===i){r[f].selected=!0,c&&(r[f].defaultSelected=!0);return}s!==null||r[f].disabled||(s=r[f])}s!==null&&(s.selected=!0)}}function cm(r,s,i){if(s!=null&&(s=""+Un(s),s!==r.value&&(r.value=s),i==null)){r.defaultValue!==s&&(r.defaultValue=s);return}r.defaultValue=i!=null?""+Un(i):""}function um(r,s,i,c){if(s==null){if(c!=null){if(i!=null)throw Error(a(92));if(Le(c)){if(1<c.length)throw Error(a(93));c=c[0]}i=c}i==null&&(i=""),s=i}i=Un(s),r.defaultValue=i,c=r.textContent,c===i&&c!==""&&c!==null&&(r.value=c),Zu(r)}function Ua(r,s){if(s){var i=r.firstChild;if(i&&i===r.lastChild&&i.nodeType===3){i.nodeValue=s;return}}r.textContent=s}var tx=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 dm(r,s,i){var c=s.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?c?r.setProperty(s,""):s==="float"?r.cssFloat="":r[s]="":c?r.setProperty(s,i):typeof i!="number"||i===0||tx.has(s)?s==="float"?r.cssFloat=i:r[s]=(""+i).trim():r[s]=i+"px"}function fm(r,s,i){if(s!=null&&typeof s!="object")throw Error(a(62));if(r=r.style,i!=null){for(var c in i)!i.hasOwnProperty(c)||s!=null&&s.hasOwnProperty(c)||(c.indexOf("--")===0?r.setProperty(c,""):c==="float"?r.cssFloat="":r[c]="");for(var f in s)c=s[f],s.hasOwnProperty(f)&&i[f]!==c&&dm(r,f,c)}else for(var g in s)s.hasOwnProperty(g)&&dm(r,g,s[g])}function nd(r){if(r.indexOf("-")===-1)return!1;switch(r){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 nx=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"]]),rx=/^[\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(r){return rx.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function Rr(){}var rd=null;function sd(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var $a=null,Ba=null;function hm(r){var s=Na(r);if(s&&(r=s.stateNode)){var i=r[pn]||null;e:switch(r=s.stateNode,s.type){case"input":if(ed(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),s=i.name,i.type==="radio"&&s!=null){for(i=r;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+$n(""+s)+'"][type="radio"]'),s=0;s<i.length;s++){var c=i[s];if(c!==r&&c.form===r.form){var f=c[pn]||null;if(!f)throw Error(a(90));ed(c,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(s=0;s<i.length;s++)c=i[s],c.form===r.form&&om(c)}break e;case"textarea":cm(r,i.value,i.defaultValue);break e;case"select":s=i.value,s!=null&&Pa(r,!!i.multiple,s,!1)}}}var ad=!1;function pm(r,s,i){if(ad)return r(s,i);ad=!0;try{var c=r(s);return c}finally{if(ad=!1,($a!==null||Ba!==null)&&(gc(),$a&&(s=$a,r=Ba,Ba=$a=null,hm(s),r)))for(s=0;s<r.length;s++)hm(r[s])}}function Fi(r,s){var i=r.stateNode;if(i===null)return null;var c=i[pn]||null;if(c===null)return null;i=c[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(r=r.type,c=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!c;break e;default:r=!1}if(r)return null;if(i&&typeof i!="function")throw Error(a(231,s,typeof i));return i}var Ar=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),id=!1;if(Ar)try{var Gi={};Object.defineProperty(Gi,"passive",{get:function(){id=!0}}),window.addEventListener("test",Gi,Gi),window.removeEventListener("test",Gi,Gi)}catch{id=!1}var ss=null,od=null,Ol=null;function mm(){if(Ol)return Ol;var r,s=od,i=s.length,c,f="value"in ss?ss.value:ss.textContent,g=f.length;for(r=0;r<i&&s[r]===f[r];r++);var w=i-r;for(c=1;c<=w&&s[i-c]===f[g-c];c++);return Ol=f.slice(r,1<c?1-c:void 0)}function jl(r){var s=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&s===13&&(r=13)):r=s,r===10&&(r=13),32<=r||r===13?r:0}function Dl(){return!0}function gm(){return!1}function mn(r){function s(i,c,f,g,w){this._reactName=i,this._targetInst=f,this.type=c,this.nativeEvent=g,this.target=w,this.currentTarget=null;for(var A in r)r.hasOwnProperty(A)&&(i=r[A],this[A]=i?i(g):g[A]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?Dl:gm,this.isPropagationStopped=gm,this}return p(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Dl)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Dl)},persist:function(){},isPersistent:Dl}),s}var Ks={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ml=mn(Ks),Vi=p({},Ks,{view:0,detail:0}),sx=mn(Vi),ld,cd,Yi,Nl=p({},Vi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:dd,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Yi&&(Yi&&r.type==="mousemove"?(ld=r.screenX-Yi.screenX,cd=r.screenY-Yi.screenY):cd=ld=0,Yi=r),ld)},movementY:function(r){return"movementY"in r?r.movementY:cd}}),ym=mn(Nl),ax=p({},Nl,{dataTransfer:0}),ix=mn(ax),ox=p({},Vi,{relatedTarget:0}),ud=mn(ox),lx=p({},Ks,{animationName:0,elapsedTime:0,pseudoElement:0}),cx=mn(lx),ux=p({},Ks,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),dx=mn(ux),fx=p({},Ks,{data:0}),vm=mn(fx),hx={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},px={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"},mx={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function gx(r){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(r):(r=mx[r])?!!s[r]:!1}function dd(){return gx}var yx=p({},Vi,{key:function(r){if(r.key){var s=hx[r.key]||r.key;if(s!=="Unidentified")return s}return r.type==="keypress"?(r=jl(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?px[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:dd,charCode:function(r){return r.type==="keypress"?jl(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?jl(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),vx=mn(yx),bx=p({},Nl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),bm=mn(bx),_x=p({},Vi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:dd}),wx=mn(_x),Sx=p({},Ks,{propertyName:0,elapsedTime:0,pseudoElement:0}),xx=mn(Sx),Tx=p({},Nl,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),Ex=mn(Tx),Rx=p({},Ks,{newState:0,oldState:0}),Ax=mn(Rx),kx=[9,13,27,32],fd=Ar&&"CompositionEvent"in window,Ki=null;Ar&&"documentMode"in document&&(Ki=document.documentMode);var Cx=Ar&&"TextEvent"in window&&!Ki,_m=Ar&&(!fd||Ki&&8<Ki&&11>=Ki),wm=" ",Sm=!1;function xm(r,s){switch(r){case"keyup":return kx.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Tm(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Ia=!1;function Ox(r,s){switch(r){case"compositionend":return Tm(s);case"keypress":return s.which!==32?null:(Sm=!0,wm);case"textInput":return r=s.data,r===wm&&Sm?null:r;default:return null}}function jx(r,s){if(Ia)return r==="compositionend"||!fd&&xm(r,s)?(r=mm(),Ol=od=ss=null,Ia=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return _m&&s.locale!=="ko"?null:s.data;default:return null}}var Dx={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 Em(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s==="input"?!!Dx[r.type]:s==="textarea"}function Rm(r,s,i,c){$a?Ba?Ba.push(c):Ba=[c]:$a=c,s=xc(s,"onChange"),0<s.length&&(i=new Ml("onChange","change",null,i,c),r.push({event:i,listeners:s}))}var Wi=null,Qi=null;function Mx(r){lv(r,0)}function Ll(r){var s=qi(r);if(om(s))return r}function Am(r,s){if(r==="change")return s}var km=!1;if(Ar){var hd;if(Ar){var pd="oninput"in document;if(!pd){var Cm=document.createElement("div");Cm.setAttribute("oninput","return;"),pd=typeof Cm.oninput=="function"}hd=pd}else hd=!1;km=hd&&(!document.documentMode||9<document.documentMode)}function Om(){Wi&&(Wi.detachEvent("onpropertychange",jm),Qi=Wi=null)}function jm(r){if(r.propertyName==="value"&&Ll(Qi)){var s=[];Rm(s,Qi,r,sd(r)),pm(Mx,s)}}function Nx(r,s,i){r==="focusin"?(Om(),Wi=s,Qi=i,Wi.attachEvent("onpropertychange",jm)):r==="focusout"&&Om()}function Lx(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Ll(Qi)}function zx(r,s){if(r==="click")return Ll(s)}function Px(r,s){if(r==="input"||r==="change")return Ll(s)}function Ux(r,s){return r===s&&(r!==0||1/r===1/s)||r!==r&&s!==s}var En=typeof Object.is=="function"?Object.is:Ux;function Xi(r,s){if(En(r,s))return!0;if(typeof r!="object"||r===null||typeof s!="object"||s===null)return!1;var i=Object.keys(r),c=Object.keys(s);if(i.length!==c.length)return!1;for(c=0;c<i.length;c++){var f=i[c];if(!pt.call(s,f)||!En(r[f],s[f]))return!1}return!0}function Dm(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Mm(r,s){var i=Dm(r);r=0;for(var c;i;){if(i.nodeType===3){if(c=r+i.textContent.length,r<=s&&c>=s)return{node:i,offset:s-r};r=c}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Dm(i)}}function Nm(r,s){return r&&s?r===s?!0:r&&r.nodeType===3?!1:s&&s.nodeType===3?Nm(r,s.parentNode):"contains"in r?r.contains(s):r.compareDocumentPosition?!!(r.compareDocumentPosition(s)&16):!1:!1}function Lm(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var s=kl(r.document);s instanceof r.HTMLIFrameElement;){try{var i=typeof s.contentWindow.location.href=="string"}catch{i=!1}if(i)r=s.contentWindow;else break;s=kl(r.document)}return s}function md(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s&&(s==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||s==="textarea"||r.contentEditable==="true")}var $x=Ar&&"documentMode"in document&&11>=document.documentMode,Ha=null,gd=null,Ji=null,yd=!1;function zm(r,s,i){var c=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;yd||Ha==null||Ha!==kl(c)||(c=Ha,"selectionStart"in c&&md(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Ji&&Xi(Ji,c)||(Ji=c,c=xc(gd,"onSelect"),0<c.length&&(s=new Ml("onSelect","select",null,s,i),r.push({event:s,listeners:c}),s.target=Ha)))}function Ws(r,s){var i={};return i[r.toLowerCase()]=s.toLowerCase(),i["Webkit"+r]="webkit"+s,i["Moz"+r]="moz"+s,i}var qa={animationend:Ws("Animation","AnimationEnd"),animationiteration:Ws("Animation","AnimationIteration"),animationstart:Ws("Animation","AnimationStart"),transitionrun:Ws("Transition","TransitionRun"),transitionstart:Ws("Transition","TransitionStart"),transitioncancel:Ws("Transition","TransitionCancel"),transitionend:Ws("Transition","TransitionEnd")},vd={},Pm={};Ar&&(Pm=document.createElement("div").style,"AnimationEvent"in window||(delete qa.animationend.animation,delete qa.animationiteration.animation,delete qa.animationstart.animation),"TransitionEvent"in window||delete qa.transitionend.transition);function Qs(r){if(vd[r])return vd[r];if(!qa[r])return r;var s=qa[r],i;for(i in s)if(s.hasOwnProperty(i)&&i in Pm)return vd[r]=s[i];return r}var Um=Qs("animationend"),$m=Qs("animationiteration"),Bm=Qs("animationstart"),Bx=Qs("transitionrun"),Ix=Qs("transitionstart"),Hx=Qs("transitioncancel"),Im=Qs("transitionend"),Hm=new Map,bd="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(" ");bd.push("scrollEnd");function Zn(r,s){Hm.set(r,s),Ys(s,[r])}var zl=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},Bn=[],Fa=0,_d=0;function Pl(){for(var r=Fa,s=_d=Fa=0;s<r;){var i=Bn[s];Bn[s++]=null;var c=Bn[s];Bn[s++]=null;var f=Bn[s];Bn[s++]=null;var g=Bn[s];if(Bn[s++]=null,c!==null&&f!==null){var w=c.pending;w===null?f.next=f:(f.next=w.next,w.next=f),c.pending=f}g!==0&&qm(i,f,g)}}function Ul(r,s,i,c){Bn[Fa++]=r,Bn[Fa++]=s,Bn[Fa++]=i,Bn[Fa++]=c,_d|=c,r.lanes|=c,r=r.alternate,r!==null&&(r.lanes|=c)}function wd(r,s,i,c){return Ul(r,s,i,c),$l(r)}function Xs(r,s){return Ul(r,null,null,s),$l(r)}function qm(r,s,i){r.lanes|=i;var c=r.alternate;c!==null&&(c.lanes|=i);for(var f=!1,g=r.return;g!==null;)g.childLanes|=i,c=g.alternate,c!==null&&(c.childLanes|=i),g.tag===22&&(r=g.stateNode,r===null||r._visibility&1||(f=!0)),r=g,g=g.return;return r.tag===3?(g=r.stateNode,f&&s!==null&&(f=31-I(i),r=g.hiddenUpdates,c=r[f],c===null?r[f]=[s]:c.push(s),s.lane=i|536870912),g):null}function $l(r){if(50<wo)throw wo=0,jf=null,Error(a(185));for(var s=r.return;s!==null;)r=s,s=r.return;return r.tag===3?r.stateNode:null}var Ga={};function qx(r,s,i,c){this.tag=r,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Rn(r,s,i,c){return new qx(r,s,i,c)}function Sd(r){return r=r.prototype,!(!r||!r.isReactComponent)}function kr(r,s){var i=r.alternate;return i===null?(i=Rn(r.tag,s,r.key,r.mode),i.elementType=r.elementType,i.type=r.type,i.stateNode=r.stateNode,i.alternate=r,r.alternate=i):(i.pendingProps=s,i.type=r.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=r.flags&65011712,i.childLanes=r.childLanes,i.lanes=r.lanes,i.child=r.child,i.memoizedProps=r.memoizedProps,i.memoizedState=r.memoizedState,i.updateQueue=r.updateQueue,s=r.dependencies,i.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},i.sibling=r.sibling,i.index=r.index,i.ref=r.ref,i.refCleanup=r.refCleanup,i}function Fm(r,s){r.flags&=65011714;var i=r.alternate;return i===null?(r.childLanes=0,r.lanes=s,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=i.childLanes,r.lanes=i.lanes,r.child=i.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=i.memoizedProps,r.memoizedState=i.memoizedState,r.updateQueue=i.updateQueue,r.type=i.type,s=i.dependencies,r.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),r}function Bl(r,s,i,c,f,g){var w=0;if(c=r,typeof r=="function")Sd(r)&&(w=1);else if(typeof r=="string")w=K1(r,i,re.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case W:return r=Rn(31,i,s,f),r.elementType=W,r.lanes=g,r;case R:return Js(i.children,f,g,s);case E:w=8,f|=24;break;case x:return r=Rn(12,i,s,f|2),r.elementType=x,r.lanes=g,r;case H:return r=Rn(13,i,s,f),r.elementType=H,r.lanes=g,r;case U:return r=Rn(19,i,s,f),r.elementType=U,r.lanes=g,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case D:w=10;break e;case k:w=9;break e;case j:w=11;break e;case B:w=14;break e;case V:w=16,c=null;break e}w=29,i=Error(a(130,r===null?"null":typeof r,"")),c=null}return s=Rn(w,i,s,f),s.elementType=r,s.type=c,s.lanes=g,s}function Js(r,s,i,c){return r=Rn(7,r,c,s),r.lanes=i,r}function xd(r,s,i){return r=Rn(6,r,null,s),r.lanes=i,r}function Gm(r){var s=Rn(18,null,null,0);return s.stateNode=r,s}function Td(r,s,i){return s=Rn(4,r.children!==null?r.children:[],r.key,s),s.lanes=i,s.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},s}var Vm=new WeakMap;function In(r,s){if(typeof r=="object"&&r!==null){var i=Vm.get(r);return i!==void 0?i:(s={value:r,source:s,stack:Zt(s)},Vm.set(r,s),s)}return{value:r,source:s,stack:Zt(s)}}var Va=[],Ya=0,Il=null,Zi=0,Hn=[],qn=0,as=null,fr=1,hr="";function Cr(r,s){Va[Ya++]=Zi,Va[Ya++]=Il,Il=r,Zi=s}function Ym(r,s,i){Hn[qn++]=fr,Hn[qn++]=hr,Hn[qn++]=as,as=r;var c=fr;r=hr;var f=32-I(c)-1;c&=~(1<<f),i+=1;var g=32-I(s)+f;if(30<g){var w=f-f%5;g=(c&(1<<w)-1).toString(32),c>>=w,f-=w,fr=1<<32-I(s)+f|i<<f|c,hr=g+r}else fr=1<<g|i<<f|c,hr=r}function Ed(r){r.return!==null&&(Cr(r,1),Ym(r,1,0))}function Rd(r){for(;r===Il;)Il=Va[--Ya],Va[Ya]=null,Zi=Va[--Ya],Va[Ya]=null;for(;r===as;)as=Hn[--qn],Hn[qn]=null,hr=Hn[--qn],Hn[qn]=null,fr=Hn[--qn],Hn[qn]=null}function Km(r,s){Hn[qn++]=fr,Hn[qn++]=hr,Hn[qn++]=as,fr=s.id,hr=s.overflow,as=r}var Yt=null,ot=null,Ie=!1,is=null,Fn=!1,Ad=Error(a(519));function os(r){var s=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw eo(In(s,r)),Ad}function Wm(r){var s=r.stateNode,i=r.type,c=r.memoizedProps;switch(s[Vt]=r,s[pn]=c,i){case"dialog":Pe("cancel",s),Pe("close",s);break;case"iframe":case"object":case"embed":Pe("load",s);break;case"video":case"audio":for(i=0;i<xo.length;i++)Pe(xo[i],s);break;case"source":Pe("error",s);break;case"img":case"image":case"link":Pe("error",s),Pe("load",s);break;case"details":Pe("toggle",s);break;case"input":Pe("invalid",s),lm(s,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":Pe("invalid",s);break;case"textarea":Pe("invalid",s),um(s,c.value,c.defaultValue,c.children)}i=c.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||s.textContent===""+i||c.suppressHydrationWarning===!0||fv(s.textContent,i)?(c.popover!=null&&(Pe("beforetoggle",s),Pe("toggle",s)),c.onScroll!=null&&Pe("scroll",s),c.onScrollEnd!=null&&Pe("scrollend",s),c.onClick!=null&&(s.onclick=Rr),s=!0):s=!1,s||os(r,!0)}function Qm(r){for(Yt=r.return;Yt;)switch(Yt.tag){case 5:case 31:case 13:Fn=!1;return;case 27:case 3:Fn=!0;return;default:Yt=Yt.return}}function Ka(r){if(r!==Yt)return!1;if(!Ie)return Qm(r),Ie=!0,!1;var s=r.tag,i;if((i=s!==3&&s!==27)&&((i=s===5)&&(i=r.type,i=!(i!=="form"&&i!=="button")||Vf(r.type,r.memoizedProps)),i=!i),i&&ot&&os(r),Qm(r),s===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));ot=wv(r)}else if(s===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));ot=wv(r)}else s===27?(s=ot,ws(r.type)?(r=Xf,Xf=null,ot=r):ot=s):ot=Yt?Vn(r.stateNode.nextSibling):null;return!0}function Zs(){ot=Yt=null,Ie=!1}function kd(){var r=is;return r!==null&&(bn===null?bn=r:bn.push.apply(bn,r),is=null),r}function eo(r){is===null?is=[r]:is.push(r)}var Cd=N(null),ea=null,Or=null;function ls(r,s,i){Z(Cd,s._currentValue),s._currentValue=i}function jr(r){r._currentValue=Cd.current,X(Cd)}function Od(r,s,i){for(;r!==null;){var c=r.alternate;if((r.childLanes&s)!==s?(r.childLanes|=s,c!==null&&(c.childLanes|=s)):c!==null&&(c.childLanes&s)!==s&&(c.childLanes|=s),r===i)break;r=r.return}}function jd(r,s,i,c){var f=r.child;for(f!==null&&(f.return=r);f!==null;){var g=f.dependencies;if(g!==null){var w=f.child;g=g.firstContext;e:for(;g!==null;){var A=g;g=f;for(var M=0;M<s.length;M++)if(A.context===s[M]){g.lanes|=i,A=g.alternate,A!==null&&(A.lanes|=i),Od(g.return,i,r),c||(w=null);break e}g=A.next}}else if(f.tag===18){if(w=f.return,w===null)throw Error(a(341));w.lanes|=i,g=w.alternate,g!==null&&(g.lanes|=i),Od(w,i,r),w=null}else w=f.child;if(w!==null)w.return=f;else for(w=f;w!==null;){if(w===r){w=null;break}if(f=w.sibling,f!==null){f.return=w.return,w=f;break}w=w.return}f=w}}function Wa(r,s,i,c){r=null;for(var f=s,g=!1;f!==null;){if(!g){if((f.flags&524288)!==0)g=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var w=f.alternate;if(w===null)throw Error(a(387));if(w=w.memoizedProps,w!==null){var A=f.type;En(f.pendingProps.value,w.value)||(r!==null?r.push(A):r=[A])}}else if(f===ve.current){if(w=f.alternate,w===null)throw Error(a(387));w.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(r!==null?r.push(ko):r=[ko])}f=f.return}r!==null&&jd(s,r,i,c),s.flags|=262144}function Hl(r){for(r=r.firstContext;r!==null;){if(!En(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function ta(r){ea=r,Or=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function Kt(r){return Xm(ea,r)}function ql(r,s){return ea===null&&ta(r),Xm(r,s)}function Xm(r,s){var i=s._currentValue;if(s={context:s,memoizedValue:i,next:null},Or===null){if(r===null)throw Error(a(308));Or=s,r.dependencies={lanes:0,firstContext:s},r.flags|=524288}else Or=Or.next=s;return i}var Fx=typeof AbortController<"u"?AbortController:function(){var r=[],s=this.signal={aborted:!1,addEventListener:function(i,c){r.push(c)}};this.abort=function(){s.aborted=!0,r.forEach(function(i){return i()})}},Gx=e.unstable_scheduleCallback,Vx=e.unstable_NormalPriority,At={$$typeof:D,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Dd(){return{controller:new Fx,data:new Map,refCount:0}}function to(r){r.refCount--,r.refCount===0&&Gx(Vx,function(){r.controller.abort()})}var no=null,Md=0,Qa=0,Xa=null;function Yx(r,s){if(no===null){var i=no=[];Md=0,Qa=Pf(),Xa={status:"pending",value:void 0,then:function(c){i.push(c)}}}return Md++,s.then(Jm,Jm),s}function Jm(){if(--Md===0&&no!==null){Xa!==null&&(Xa.status="fulfilled");var r=no;no=null,Qa=0,Xa=null;for(var s=0;s<r.length;s++)(0,r[s])()}}function Kx(r,s){var i=[],c={status:"pending",value:null,reason:null,then:function(f){i.push(f)}};return r.then(function(){c.status="fulfilled",c.value=s;for(var f=0;f<i.length;f++)(0,i[f])(s)},function(f){for(c.status="rejected",c.reason=f,f=0;f<i.length;f++)(0,i[f])(void 0)}),c}var Zm=P.S;P.S=function(r,s){zy=Rt(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&Yx(r,s),Zm!==null&&Zm(r,s)};var na=N(null);function Nd(){var r=na.current;return r!==null?r:nt.pooledCache}function Fl(r,s){s===null?Z(na,na.current):Z(na,s.pool)}function eg(){var r=Nd();return r===null?null:{parent:At._currentValue,pool:r}}var Ja=Error(a(460)),Ld=Error(a(474)),Gl=Error(a(542)),Vl={then:function(){}};function tg(r){return r=r.status,r==="fulfilled"||r==="rejected"}function ng(r,s,i){switch(i=r[i],i===void 0?r.push(s):i!==s&&(s.then(Rr,Rr),s=i),s.status){case"fulfilled":return s.value;case"rejected":throw r=s.reason,sg(r),r;default:if(typeof s.status=="string")s.then(Rr,Rr);else{if(r=nt,r!==null&&100<r.shellSuspendCounter)throw Error(a(482));r=s,r.status="pending",r.then(function(c){if(s.status==="pending"){var f=s;f.status="fulfilled",f.value=c}},function(c){if(s.status==="pending"){var f=s;f.status="rejected",f.reason=c}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw r=s.reason,sg(r),r}throw sa=s,Ja}}function ra(r){try{var s=r._init;return s(r._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(sa=i,Ja):i}}var sa=null;function rg(){if(sa===null)throw Error(a(459));var r=sa;return sa=null,r}function sg(r){if(r===Ja||r===Gl)throw Error(a(483))}var Za=null,ro=0;function Yl(r){var s=ro;return ro+=1,Za===null&&(Za=[]),ng(Za,r,s)}function so(r,s){s=s.props.ref,r.ref=s!==void 0?s:null}function Kl(r,s){throw s.$$typeof===b?Error(a(525)):(r=Object.prototype.toString.call(s),Error(a(31,r==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":r)))}function ag(r){function s($,z){if(r){var q=$.deletions;q===null?($.deletions=[z],$.flags|=16):q.push(z)}}function i($,z){if(!r)return null;for(;z!==null;)s($,z),z=z.sibling;return null}function c($){for(var z=new Map;$!==null;)$.key!==null?z.set($.key,$):z.set($.index,$),$=$.sibling;return z}function f($,z){return $=kr($,z),$.index=0,$.sibling=null,$}function g($,z,q){return $.index=q,r?(q=$.alternate,q!==null?(q=q.index,q<z?($.flags|=67108866,z):q):($.flags|=67108866,z)):($.flags|=1048576,z)}function w($){return r&&$.alternate===null&&($.flags|=67108866),$}function A($,z,q,ee){return z===null||z.tag!==6?(z=xd(q,$.mode,ee),z.return=$,z):(z=f(z,q),z.return=$,z)}function M($,z,q,ee){var ge=q.type;return ge===R?J($,z,q.props.children,ee,q.key):z!==null&&(z.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===V&&ra(ge)===z.type)?(z=f(z,q.props),so(z,q),z.return=$,z):(z=Bl(q.type,q.key,q.props,null,$.mode,ee),so(z,q),z.return=$,z)}function F($,z,q,ee){return z===null||z.tag!==4||z.stateNode.containerInfo!==q.containerInfo||z.stateNode.implementation!==q.implementation?(z=Td(q,$.mode,ee),z.return=$,z):(z=f(z,q.children||[]),z.return=$,z)}function J($,z,q,ee,ge){return z===null||z.tag!==7?(z=Js(q,$.mode,ee,ge),z.return=$,z):(z=f(z,q),z.return=$,z)}function te($,z,q){if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return z=xd(""+z,$.mode,q),z.return=$,z;if(typeof z=="object"&&z!==null){switch(z.$$typeof){case _:return q=Bl(z.type,z.key,z.props,null,$.mode,q),so(q,z),q.return=$,q;case S:return z=Td(z,$.mode,q),z.return=$,z;case V:return z=ra(z),te($,z,q)}if(Le(z)||ue(z))return z=Js(z,$.mode,q,null),z.return=$,z;if(typeof z.then=="function")return te($,Yl(z),q);if(z.$$typeof===D)return te($,ql($,z),q);Kl($,z)}return null}function G($,z,q,ee){var ge=z!==null?z.key:null;if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return ge!==null?null:A($,z,""+q,ee);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case _:return q.key===ge?M($,z,q,ee):null;case S:return q.key===ge?F($,z,q,ee):null;case V:return q=ra(q),G($,z,q,ee)}if(Le(q)||ue(q))return ge!==null?null:J($,z,q,ee,null);if(typeof q.then=="function")return G($,z,Yl(q),ee);if(q.$$typeof===D)return G($,z,ql($,q),ee);Kl($,q)}return null}function K($,z,q,ee,ge){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return $=$.get(q)||null,A(z,$,""+ee,ge);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case _:return $=$.get(ee.key===null?q:ee.key)||null,M(z,$,ee,ge);case S:return $=$.get(ee.key===null?q:ee.key)||null,F(z,$,ee,ge);case V:return ee=ra(ee),K($,z,q,ee,ge)}if(Le(ee)||ue(ee))return $=$.get(q)||null,J(z,$,ee,ge,null);if(typeof ee.then=="function")return K($,z,q,Yl(ee),ge);if(ee.$$typeof===D)return K($,z,q,ql(z,ee),ge);Kl(z,ee)}return null}function de($,z,q,ee){for(var ge=null,qe=null,pe=z,De=z=0,$e=null;pe!==null&&De<q.length;De++){pe.index>De?($e=pe,pe=null):$e=pe.sibling;var Fe=G($,pe,q[De],ee);if(Fe===null){pe===null&&(pe=$e);break}r&&pe&&Fe.alternate===null&&s($,pe),z=g(Fe,z,De),qe===null?ge=Fe:qe.sibling=Fe,qe=Fe,pe=$e}if(De===q.length)return i($,pe),Ie&&Cr($,De),ge;if(pe===null){for(;De<q.length;De++)pe=te($,q[De],ee),pe!==null&&(z=g(pe,z,De),qe===null?ge=pe:qe.sibling=pe,qe=pe);return Ie&&Cr($,De),ge}for(pe=c(pe);De<q.length;De++)$e=K(pe,$,De,q[De],ee),$e!==null&&(r&&$e.alternate!==null&&pe.delete($e.key===null?De:$e.key),z=g($e,z,De),qe===null?ge=$e:qe.sibling=$e,qe=$e);return r&&pe.forEach(function(Rs){return s($,Rs)}),Ie&&Cr($,De),ge}function _e($,z,q,ee){if(q==null)throw Error(a(151));for(var ge=null,qe=null,pe=z,De=z=0,$e=null,Fe=q.next();pe!==null&&!Fe.done;De++,Fe=q.next()){pe.index>De?($e=pe,pe=null):$e=pe.sibling;var Rs=G($,pe,Fe.value,ee);if(Rs===null){pe===null&&(pe=$e);break}r&&pe&&Rs.alternate===null&&s($,pe),z=g(Rs,z,De),qe===null?ge=Rs:qe.sibling=Rs,qe=Rs,pe=$e}if(Fe.done)return i($,pe),Ie&&Cr($,De),ge;if(pe===null){for(;!Fe.done;De++,Fe=q.next())Fe=te($,Fe.value,ee),Fe!==null&&(z=g(Fe,z,De),qe===null?ge=Fe:qe.sibling=Fe,qe=Fe);return Ie&&Cr($,De),ge}for(pe=c(pe);!Fe.done;De++,Fe=q.next())Fe=K(pe,$,De,Fe.value,ee),Fe!==null&&(r&&Fe.alternate!==null&&pe.delete(Fe.key===null?De:Fe.key),z=g(Fe,z,De),qe===null?ge=Fe:qe.sibling=Fe,qe=Fe);return r&&pe.forEach(function(aT){return s($,aT)}),Ie&&Cr($,De),ge}function et($,z,q,ee){if(typeof q=="object"&&q!==null&&q.type===R&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case _:e:{for(var ge=q.key;z!==null;){if(z.key===ge){if(ge=q.type,ge===R){if(z.tag===7){i($,z.sibling),ee=f(z,q.props.children),ee.return=$,$=ee;break e}}else if(z.elementType===ge||typeof ge=="object"&&ge!==null&&ge.$$typeof===V&&ra(ge)===z.type){i($,z.sibling),ee=f(z,q.props),so(ee,q),ee.return=$,$=ee;break e}i($,z);break}else s($,z);z=z.sibling}q.type===R?(ee=Js(q.props.children,$.mode,ee,q.key),ee.return=$,$=ee):(ee=Bl(q.type,q.key,q.props,null,$.mode,ee),so(ee,q),ee.return=$,$=ee)}return w($);case S:e:{for(ge=q.key;z!==null;){if(z.key===ge)if(z.tag===4&&z.stateNode.containerInfo===q.containerInfo&&z.stateNode.implementation===q.implementation){i($,z.sibling),ee=f(z,q.children||[]),ee.return=$,$=ee;break e}else{i($,z);break}else s($,z);z=z.sibling}ee=Td(q,$.mode,ee),ee.return=$,$=ee}return w($);case V:return q=ra(q),et($,z,q,ee)}if(Le(q))return de($,z,q,ee);if(ue(q)){if(ge=ue(q),typeof ge!="function")throw Error(a(150));return q=ge.call(q),_e($,z,q,ee)}if(typeof q.then=="function")return et($,z,Yl(q),ee);if(q.$$typeof===D)return et($,z,ql($,q),ee);Kl($,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,z!==null&&z.tag===6?(i($,z.sibling),ee=f(z,q),ee.return=$,$=ee):(i($,z),ee=xd(q,$.mode,ee),ee.return=$,$=ee),w($)):i($,z)}return function($,z,q,ee){try{ro=0;var ge=et($,z,q,ee);return Za=null,ge}catch(pe){if(pe===Ja||pe===Gl)throw pe;var qe=Rn(29,pe,null,$.mode);return qe.lanes=ee,qe.return=$,qe}}}var aa=ag(!0),ig=ag(!1),cs=!1;function zd(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Pd(r,s){r=r.updateQueue,s.updateQueue===r&&(s.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function us(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function ds(r,s,i){var c=r.updateQueue;if(c===null)return null;if(c=c.shared,(Ye&2)!==0){var f=c.pending;return f===null?s.next=s:(s.next=f.next,f.next=s),c.pending=s,s=$l(r),qm(r,null,i),s}return Ul(r,c,s,i),$l(r)}function ao(r,s,i){if(s=s.updateQueue,s!==null&&(s=s.shared,(i&4194048)!==0)){var c=s.lanes;c&=r.pendingLanes,i|=c,s.lanes=i,fn(r,i)}}function Ud(r,s){var i=r.updateQueue,c=r.alternate;if(c!==null&&(c=c.updateQueue,i===c)){var f=null,g=null;if(i=i.firstBaseUpdate,i!==null){do{var w={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};g===null?f=g=w:g=g.next=w,i=i.next}while(i!==null);g===null?f=g=s:g=g.next=s}else f=g=s;i={baseState:c.baseState,firstBaseUpdate:f,lastBaseUpdate:g,shared:c.shared,callbacks:c.callbacks},r.updateQueue=i;return}r=i.lastBaseUpdate,r===null?i.firstBaseUpdate=s:r.next=s,i.lastBaseUpdate=s}var $d=!1;function io(){if($d){var r=Xa;if(r!==null)throw r}}function oo(r,s,i,c){$d=!1;var f=r.updateQueue;cs=!1;var g=f.firstBaseUpdate,w=f.lastBaseUpdate,A=f.shared.pending;if(A!==null){f.shared.pending=null;var M=A,F=M.next;M.next=null,w===null?g=F:w.next=F,w=M;var J=r.alternate;J!==null&&(J=J.updateQueue,A=J.lastBaseUpdate,A!==w&&(A===null?J.firstBaseUpdate=F:A.next=F,J.lastBaseUpdate=M))}if(g!==null){var te=f.baseState;w=0,J=F=M=null,A=g;do{var G=A.lane&-536870913,K=G!==A.lane;if(K?(Ue&G)===G:(c&G)===G){G!==0&&G===Qa&&($d=!0),J!==null&&(J=J.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var de=r,_e=A;G=s;var et=i;switch(_e.tag){case 1:if(de=_e.payload,typeof de=="function"){te=de.call(et,te,G);break e}te=de;break e;case 3:de.flags=de.flags&-65537|128;case 0:if(de=_e.payload,G=typeof de=="function"?de.call(et,te,G):de,G==null)break e;te=p({},te,G);break e;case 2:cs=!0}}G=A.callback,G!==null&&(r.flags|=64,K&&(r.flags|=8192),K=f.callbacks,K===null?f.callbacks=[G]:K.push(G))}else K={lane:G,tag:A.tag,payload:A.payload,callback:A.callback,next:null},J===null?(F=J=K,M=te):J=J.next=K,w|=G;if(A=A.next,A===null){if(A=f.shared.pending,A===null)break;K=A,A=K.next,K.next=null,f.lastBaseUpdate=K,f.shared.pending=null}}while(!0);J===null&&(M=te),f.baseState=M,f.firstBaseUpdate=F,f.lastBaseUpdate=J,g===null&&(f.shared.lanes=0),gs|=w,r.lanes=w,r.memoizedState=te}}function og(r,s){if(typeof r!="function")throw Error(a(191,r));r.call(s)}function lg(r,s){var i=r.callbacks;if(i!==null)for(r.callbacks=null,r=0;r<i.length;r++)og(i[r],s)}var ei=N(null),Wl=N(0);function cg(r,s){r=Br,Z(Wl,r),Z(ei,s),Br=r|s.baseLanes}function Bd(){Z(Wl,Br),Z(ei,ei.current)}function Id(){Br=Wl.current,X(ei),X(Wl)}var An=N(null),Gn=null;function fs(r){var s=r.alternate;Z(xt,xt.current&1),Z(An,r),Gn===null&&(s===null||ei.current!==null||s.memoizedState!==null)&&(Gn=r)}function Hd(r){Z(xt,xt.current),Z(An,r),Gn===null&&(Gn=r)}function ug(r){r.tag===22?(Z(xt,xt.current),Z(An,r),Gn===null&&(Gn=r)):hs()}function hs(){Z(xt,xt.current),Z(An,An.current)}function kn(r){X(An),Gn===r&&(Gn=null),X(xt)}var xt=N(0);function Ql(r){for(var s=r;s!==null;){if(s.tag===13){var i=s.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Wf(i)||Qf(i)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Dr=0,je=null,Je=null,kt=null,Xl=!1,ti=!1,ia=!1,Jl=0,lo=0,ni=null,Wx=0;function vt(){throw Error(a(321))}function qd(r,s){if(s===null)return!1;for(var i=0;i<s.length&&i<r.length;i++)if(!En(r[i],s[i]))return!1;return!0}function Fd(r,s,i,c,f,g){return Dr=g,je=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,P.H=r===null||r.memoizedState===null?Yg:af,ia=!1,g=i(c,f),ia=!1,ti&&(g=fg(s,i,c,f)),dg(r),g}function dg(r){P.H=fo;var s=Je!==null&&Je.next!==null;if(Dr=0,kt=Je=je=null,Xl=!1,lo=0,ni=null,s)throw Error(a(300));r===null||Ct||(r=r.dependencies,r!==null&&Hl(r)&&(Ct=!0))}function fg(r,s,i,c){je=r;var f=0;do{if(ti&&(ni=null),lo=0,ti=!1,25<=f)throw Error(a(301));if(f+=1,kt=Je=null,r.updateQueue!=null){var g=r.updateQueue;g.lastEffect=null,g.events=null,g.stores=null,g.memoCache!=null&&(g.memoCache.index=0)}P.H=Kg,g=s(i,c)}while(ti);return g}function Qx(){var r=P.H,s=r.useState()[0];return s=typeof s.then=="function"?co(s):s,r=r.useState()[0],(Je!==null?Je.memoizedState:null)!==r&&(je.flags|=1024),s}function Gd(){var r=Jl!==0;return Jl=0,r}function Vd(r,s,i){s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~i}function Yd(r){if(Xl){for(r=r.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}Xl=!1}Dr=0,kt=Je=je=null,ti=!1,lo=Jl=0,ni=null}function sn(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return kt===null?je.memoizedState=kt=r:kt=kt.next=r,kt}function Tt(){if(Je===null){var r=je.alternate;r=r!==null?r.memoizedState:null}else r=Je.next;var s=kt===null?je.memoizedState:kt.next;if(s!==null)kt=s,Je=r;else{if(r===null)throw je.alternate===null?Error(a(467)):Error(a(310));Je=r,r={memoizedState:Je.memoizedState,baseState:Je.baseState,baseQueue:Je.baseQueue,queue:Je.queue,next:null},kt===null?je.memoizedState=kt=r:kt=kt.next=r}return kt}function Zl(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function co(r){var s=lo;return lo+=1,ni===null&&(ni=[]),r=ng(ni,r,s),s=je,(kt===null?s.memoizedState:kt.next)===null&&(s=s.alternate,P.H=s===null||s.memoizedState===null?Yg:af),r}function ec(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return co(r);if(r.$$typeof===D)return Kt(r)}throw Error(a(438,String(r)))}function Kd(r){var s=null,i=je.updateQueue;if(i!==null&&(s=i.memoCache),s==null){var c=je.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(s={data:c.data.map(function(f){return f.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),i===null&&(i=Zl(),je.updateQueue=i),i.memoCache=s,i=s.data[s.index],i===void 0)for(i=s.data[s.index]=Array(r),c=0;c<r;c++)i[c]=se;return s.index++,i}function Mr(r,s){return typeof s=="function"?s(r):s}function tc(r){var s=Tt();return Wd(s,Je,r)}function Wd(r,s,i){var c=r.queue;if(c===null)throw Error(a(311));c.lastRenderedReducer=i;var f=r.baseQueue,g=c.pending;if(g!==null){if(f!==null){var w=f.next;f.next=g.next,g.next=w}s.baseQueue=f=g,c.pending=null}if(g=r.baseState,f===null)r.memoizedState=g;else{s=f.next;var A=w=null,M=null,F=s,J=!1;do{var te=F.lane&-536870913;if(te!==F.lane?(Ue&te)===te:(Dr&te)===te){var G=F.revertLane;if(G===0)M!==null&&(M=M.next={lane:0,revertLane:0,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null}),te===Qa&&(J=!0);else if((Dr&G)===G){F=F.next,G===Qa&&(J=!0);continue}else te={lane:0,revertLane:F.revertLane,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},M===null?(A=M=te,w=g):M=M.next=te,je.lanes|=G,gs|=G;te=F.action,ia&&i(g,te),g=F.hasEagerState?F.eagerState:i(g,te)}else G={lane:te,revertLane:F.revertLane,gesture:F.gesture,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},M===null?(A=M=G,w=g):M=M.next=G,je.lanes|=te,gs|=te;F=F.next}while(F!==null&&F!==s);if(M===null?w=g:M.next=A,!En(g,r.memoizedState)&&(Ct=!0,J&&(i=Xa,i!==null)))throw i;r.memoizedState=g,r.baseState=w,r.baseQueue=M,c.lastRenderedState=g}return f===null&&(c.lanes=0),[r.memoizedState,c.dispatch]}function Qd(r){var s=Tt(),i=s.queue;if(i===null)throw Error(a(311));i.lastRenderedReducer=r;var c=i.dispatch,f=i.pending,g=s.memoizedState;if(f!==null){i.pending=null;var w=f=f.next;do g=r(g,w.action),w=w.next;while(w!==f);En(g,s.memoizedState)||(Ct=!0),s.memoizedState=g,s.baseQueue===null&&(s.baseState=g),i.lastRenderedState=g}return[g,c]}function hg(r,s,i){var c=je,f=Tt(),g=Ie;if(g){if(i===void 0)throw Error(a(407));i=i()}else i=s();var w=!En((Je||f).memoizedState,i);if(w&&(f.memoizedState=i,Ct=!0),f=f.queue,Zd(gg.bind(null,c,f,r),[r]),f.getSnapshot!==s||w||kt!==null&&kt.memoizedState.tag&1){if(c.flags|=2048,ri(9,{destroy:void 0},mg.bind(null,c,f,i,s),null),nt===null)throw Error(a(349));g||(Dr&127)!==0||pg(c,s,i)}return i}function pg(r,s,i){r.flags|=16384,r={getSnapshot:s,value:i},s=je.updateQueue,s===null?(s=Zl(),je.updateQueue=s,s.stores=[r]):(i=s.stores,i===null?s.stores=[r]:i.push(r))}function mg(r,s,i,c){s.value=i,s.getSnapshot=c,yg(s)&&vg(r)}function gg(r,s,i){return i(function(){yg(s)&&vg(r)})}function yg(r){var s=r.getSnapshot;r=r.value;try{var i=s();return!En(r,i)}catch{return!0}}function vg(r){var s=Xs(r,2);s!==null&&_n(s,r,2)}function Xd(r){var s=sn();if(typeof r=="function"){var i=r;if(r=i(),ia){L(!0);try{i()}finally{L(!1)}}}return s.memoizedState=s.baseState=r,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mr,lastRenderedState:r},s}function bg(r,s,i,c){return r.baseState=i,Wd(r,Je,typeof c=="function"?c:Mr)}function Xx(r,s,i,c,f){if(sc(r))throw Error(a(485));if(r=s.action,r!==null){var g={payload:f,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){g.listeners.push(w)}};P.T!==null?i(!0):g.isTransition=!1,c(g),i=s.pending,i===null?(g.next=s.pending=g,_g(s,g)):(g.next=i.next,s.pending=i.next=g)}}function _g(r,s){var i=s.action,c=s.payload,f=r.state;if(s.isTransition){var g=P.T,w={};P.T=w;try{var A=i(f,c),M=P.S;M!==null&&M(w,A),wg(r,s,A)}catch(F){Jd(r,s,F)}finally{g!==null&&w.types!==null&&(g.types=w.types),P.T=g}}else try{g=i(f,c),wg(r,s,g)}catch(F){Jd(r,s,F)}}function wg(r,s,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(c){Sg(r,s,c)},function(c){return Jd(r,s,c)}):Sg(r,s,i)}function Sg(r,s,i){s.status="fulfilled",s.value=i,xg(s),r.state=i,s=r.pending,s!==null&&(i=s.next,i===s?r.pending=null:(i=i.next,s.next=i,_g(r,i)))}function Jd(r,s,i){var c=r.pending;if(r.pending=null,c!==null){c=c.next;do s.status="rejected",s.reason=i,xg(s),s=s.next;while(s!==c)}r.action=null}function xg(r){r=r.listeners;for(var s=0;s<r.length;s++)(0,r[s])()}function Tg(r,s){return s}function Eg(r,s){if(Ie){var i=nt.formState;if(i!==null){e:{var c=je;if(Ie){if(ot){t:{for(var f=ot,g=Fn;f.nodeType!==8;){if(!g){f=null;break t}if(f=Vn(f.nextSibling),f===null){f=null;break t}}g=f.data,f=g==="F!"||g==="F"?f:null}if(f){ot=Vn(f.nextSibling),c=f.data==="F!";break e}}os(c)}c=!1}c&&(s=i[0])}}return i=sn(),i.memoizedState=i.baseState=s,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Tg,lastRenderedState:s},i.queue=c,i=Fg.bind(null,je,c),c.dispatch=i,c=Xd(!1),g=sf.bind(null,je,!1,c.queue),c=sn(),f={state:s,dispatch:null,action:r,pending:null},c.queue=f,i=Xx.bind(null,je,f,g,i),f.dispatch=i,c.memoizedState=r,[s,i,!1]}function Rg(r){var s=Tt();return Ag(s,Je,r)}function Ag(r,s,i){if(s=Wd(r,s,Tg)[0],r=tc(Mr)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var c=co(s)}catch(w){throw w===Ja?Gl:w}else c=s;s=Tt();var f=s.queue,g=f.dispatch;return i!==s.memoizedState&&(je.flags|=2048,ri(9,{destroy:void 0},Jx.bind(null,f,i),null)),[c,g,r]}function Jx(r,s){r.action=s}function kg(r){var s=Tt(),i=Je;if(i!==null)return Ag(s,i,r);Tt(),s=s.memoizedState,i=Tt();var c=i.queue.dispatch;return i.memoizedState=r,[s,c,!1]}function ri(r,s,i,c){return r={tag:r,create:i,deps:c,inst:s,next:null},s=je.updateQueue,s===null&&(s=Zl(),je.updateQueue=s),i=s.lastEffect,i===null?s.lastEffect=r.next=r:(c=i.next,i.next=r,r.next=c,s.lastEffect=r),r}function Cg(){return Tt().memoizedState}function nc(r,s,i,c){var f=sn();je.flags|=r,f.memoizedState=ri(1|s,{destroy:void 0},i,c===void 0?null:c)}function rc(r,s,i,c){var f=Tt();c=c===void 0?null:c;var g=f.memoizedState.inst;Je!==null&&c!==null&&qd(c,Je.memoizedState.deps)?f.memoizedState=ri(s,g,i,c):(je.flags|=r,f.memoizedState=ri(1|s,g,i,c))}function Og(r,s){nc(8390656,8,r,s)}function Zd(r,s){rc(2048,8,r,s)}function Zx(r){je.flags|=4;var s=je.updateQueue;if(s===null)s=Zl(),je.updateQueue=s,s.events=[r];else{var i=s.events;i===null?s.events=[r]:i.push(r)}}function jg(r){var s=Tt().memoizedState;return Zx({ref:s,nextImpl:r}),function(){if((Ye&2)!==0)throw Error(a(440));return s.impl.apply(void 0,arguments)}}function Dg(r,s){return rc(4,2,r,s)}function Mg(r,s){return rc(4,4,r,s)}function Ng(r,s){if(typeof s=="function"){r=r();var i=s(r);return function(){typeof i=="function"?i():s(null)}}if(s!=null)return r=r(),s.current=r,function(){s.current=null}}function Lg(r,s,i){i=i!=null?i.concat([r]):null,rc(4,4,Ng.bind(null,s,r),i)}function ef(){}function zg(r,s){var i=Tt();s=s===void 0?null:s;var c=i.memoizedState;return s!==null&&qd(s,c[1])?c[0]:(i.memoizedState=[r,s],r)}function Pg(r,s){var i=Tt();s=s===void 0?null:s;var c=i.memoizedState;if(s!==null&&qd(s,c[1]))return c[0];if(c=r(),ia){L(!0);try{r()}finally{L(!1)}}return i.memoizedState=[c,s],c}function tf(r,s,i){return i===void 0||(Dr&1073741824)!==0&&(Ue&261930)===0?r.memoizedState=s:(r.memoizedState=i,r=Uy(),je.lanes|=r,gs|=r,i)}function Ug(r,s,i,c){return En(i,s)?i:ei.current!==null?(r=tf(r,i,c),En(r,s)||(Ct=!0),r):(Dr&42)===0||(Dr&1073741824)!==0&&(Ue&261930)===0?(Ct=!0,r.memoizedState=i):(r=Uy(),je.lanes|=r,gs|=r,s)}function $g(r,s,i,c,f){var g=ne.p;ne.p=g!==0&&8>g?g:8;var w=P.T,A={};P.T=A,sf(r,!1,s,i);try{var M=f(),F=P.S;if(F!==null&&F(A,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var J=Kx(M,c);uo(r,s,J,jn(r))}else uo(r,s,c,jn(r))}catch(te){uo(r,s,{then:function(){},status:"rejected",reason:te},jn())}finally{ne.p=g,w!==null&&A.types!==null&&(w.types=A.types),P.T=w}}function e1(){}function nf(r,s,i,c){if(r.tag!==5)throw Error(a(476));var f=Bg(r).queue;$g(r,f,s,oe,i===null?e1:function(){return Ig(r),i(c)})}function Bg(r){var s=r.memoizedState;if(s!==null)return s;s={memoizedState:oe,baseState:oe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mr,lastRenderedState:oe},next:null};var i={};return s.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mr,lastRenderedState:i},next:null},r.memoizedState=s,r=r.alternate,r!==null&&(r.memoizedState=s),s}function Ig(r){var s=Bg(r);s.next===null&&(s=r.alternate.memoizedState),uo(r,s.next.queue,{},jn())}function rf(){return Kt(ko)}function Hg(){return Tt().memoizedState}function qg(){return Tt().memoizedState}function t1(r){for(var s=r.return;s!==null;){switch(s.tag){case 24:case 3:var i=jn();r=us(i);var c=ds(s,r,i);c!==null&&(_n(c,s,i),ao(c,s,i)),s={cache:Dd()},r.payload=s;return}s=s.return}}function n1(r,s,i){var c=jn();i={lane:c,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},sc(r)?Gg(s,i):(i=wd(r,s,i,c),i!==null&&(_n(i,r,c),Vg(i,s,c)))}function Fg(r,s,i){var c=jn();uo(r,s,i,c)}function uo(r,s,i,c){var f={lane:c,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(sc(r))Gg(s,f);else{var g=r.alternate;if(r.lanes===0&&(g===null||g.lanes===0)&&(g=s.lastRenderedReducer,g!==null))try{var w=s.lastRenderedState,A=g(w,i);if(f.hasEagerState=!0,f.eagerState=A,En(A,w))return Ul(r,s,f,0),nt===null&&Pl(),!1}catch{}if(i=wd(r,s,f,c),i!==null)return _n(i,r,c),Vg(i,s,c),!0}return!1}function sf(r,s,i,c){if(c={lane:2,revertLane:Pf(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},sc(r)){if(s)throw Error(a(479))}else s=wd(r,i,c,2),s!==null&&_n(s,r,2)}function sc(r){var s=r.alternate;return r===je||s!==null&&s===je}function Gg(r,s){ti=Xl=!0;var i=r.pending;i===null?s.next=s:(s.next=i.next,i.next=s),r.pending=s}function Vg(r,s,i){if((i&4194048)!==0){var c=s.lanes;c&=r.pendingLanes,i|=c,s.lanes=i,fn(r,i)}}var fo={readContext:Kt,use:ec,useCallback:vt,useContext:vt,useEffect:vt,useImperativeHandle:vt,useLayoutEffect:vt,useInsertionEffect:vt,useMemo:vt,useReducer:vt,useRef:vt,useState:vt,useDebugValue:vt,useDeferredValue:vt,useTransition:vt,useSyncExternalStore:vt,useId:vt,useHostTransitionStatus:vt,useFormState:vt,useActionState:vt,useOptimistic:vt,useMemoCache:vt,useCacheRefresh:vt};fo.useEffectEvent=vt;var Yg={readContext:Kt,use:ec,useCallback:function(r,s){return sn().memoizedState=[r,s===void 0?null:s],r},useContext:Kt,useEffect:Og,useImperativeHandle:function(r,s,i){i=i!=null?i.concat([r]):null,nc(4194308,4,Ng.bind(null,s,r),i)},useLayoutEffect:function(r,s){return nc(4194308,4,r,s)},useInsertionEffect:function(r,s){nc(4,2,r,s)},useMemo:function(r,s){var i=sn();s=s===void 0?null:s;var c=r();if(ia){L(!0);try{r()}finally{L(!1)}}return i.memoizedState=[c,s],c},useReducer:function(r,s,i){var c=sn();if(i!==void 0){var f=i(s);if(ia){L(!0);try{i(s)}finally{L(!1)}}}else f=s;return c.memoizedState=c.baseState=f,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:f},c.queue=r,r=r.dispatch=n1.bind(null,je,r),[c.memoizedState,r]},useRef:function(r){var s=sn();return r={current:r},s.memoizedState=r},useState:function(r){r=Xd(r);var s=r.queue,i=Fg.bind(null,je,s);return s.dispatch=i,[r.memoizedState,i]},useDebugValue:ef,useDeferredValue:function(r,s){var i=sn();return tf(i,r,s)},useTransition:function(){var r=Xd(!1);return r=$g.bind(null,je,r.queue,!0,!1),sn().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,s,i){var c=je,f=sn();if(Ie){if(i===void 0)throw Error(a(407));i=i()}else{if(i=s(),nt===null)throw Error(a(349));(Ue&127)!==0||pg(c,s,i)}f.memoizedState=i;var g={value:i,getSnapshot:s};return f.queue=g,Og(gg.bind(null,c,g,r),[r]),c.flags|=2048,ri(9,{destroy:void 0},mg.bind(null,c,g,i,s),null),i},useId:function(){var r=sn(),s=nt.identifierPrefix;if(Ie){var i=hr,c=fr;i=(c&~(1<<32-I(c)-1)).toString(32)+i,s="_"+s+"R_"+i,i=Jl++,0<i&&(s+="H"+i.toString(32)),s+="_"}else i=Wx++,s="_"+s+"r_"+i.toString(32)+"_";return r.memoizedState=s},useHostTransitionStatus:rf,useFormState:Eg,useActionState:Eg,useOptimistic:function(r){var s=sn();s.memoizedState=s.baseState=r;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=i,s=sf.bind(null,je,!0,i),i.dispatch=s,[r,s]},useMemoCache:Kd,useCacheRefresh:function(){return sn().memoizedState=t1.bind(null,je)},useEffectEvent:function(r){var s=sn(),i={impl:r};return s.memoizedState=i,function(){if((Ye&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}},af={readContext:Kt,use:ec,useCallback:zg,useContext:Kt,useEffect:Zd,useImperativeHandle:Lg,useInsertionEffect:Dg,useLayoutEffect:Mg,useMemo:Pg,useReducer:tc,useRef:Cg,useState:function(){return tc(Mr)},useDebugValue:ef,useDeferredValue:function(r,s){var i=Tt();return Ug(i,Je.memoizedState,r,s)},useTransition:function(){var r=tc(Mr)[0],s=Tt().memoizedState;return[typeof r=="boolean"?r:co(r),s]},useSyncExternalStore:hg,useId:Hg,useHostTransitionStatus:rf,useFormState:Rg,useActionState:Rg,useOptimistic:function(r,s){var i=Tt();return bg(i,Je,r,s)},useMemoCache:Kd,useCacheRefresh:qg};af.useEffectEvent=jg;var Kg={readContext:Kt,use:ec,useCallback:zg,useContext:Kt,useEffect:Zd,useImperativeHandle:Lg,useInsertionEffect:Dg,useLayoutEffect:Mg,useMemo:Pg,useReducer:Qd,useRef:Cg,useState:function(){return Qd(Mr)},useDebugValue:ef,useDeferredValue:function(r,s){var i=Tt();return Je===null?tf(i,r,s):Ug(i,Je.memoizedState,r,s)},useTransition:function(){var r=Qd(Mr)[0],s=Tt().memoizedState;return[typeof r=="boolean"?r:co(r),s]},useSyncExternalStore:hg,useId:Hg,useHostTransitionStatus:rf,useFormState:kg,useActionState:kg,useOptimistic:function(r,s){var i=Tt();return Je!==null?bg(i,Je,r,s):(i.baseState=r,[r,i.queue.dispatch])},useMemoCache:Kd,useCacheRefresh:qg};Kg.useEffectEvent=jg;function of(r,s,i,c){s=r.memoizedState,i=i(c,s),i=i==null?s:p({},s,i),r.memoizedState=i,r.lanes===0&&(r.updateQueue.baseState=i)}var lf={enqueueSetState:function(r,s,i){r=r._reactInternals;var c=jn(),f=us(c);f.payload=s,i!=null&&(f.callback=i),s=ds(r,f,c),s!==null&&(_n(s,r,c),ao(s,r,c))},enqueueReplaceState:function(r,s,i){r=r._reactInternals;var c=jn(),f=us(c);f.tag=1,f.payload=s,i!=null&&(f.callback=i),s=ds(r,f,c),s!==null&&(_n(s,r,c),ao(s,r,c))},enqueueForceUpdate:function(r,s){r=r._reactInternals;var i=jn(),c=us(i);c.tag=2,s!=null&&(c.callback=s),s=ds(r,c,i),s!==null&&(_n(s,r,i),ao(s,r,i))}};function Wg(r,s,i,c,f,g,w){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(c,g,w):s.prototype&&s.prototype.isPureReactComponent?!Xi(i,c)||!Xi(f,g):!0}function Qg(r,s,i,c){r=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(i,c),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(i,c),s.state!==r&&lf.enqueueReplaceState(s,s.state,null)}function oa(r,s){var i=s;if("ref"in s){i={};for(var c in s)c!=="ref"&&(i[c]=s[c])}if(r=r.defaultProps){i===s&&(i=p({},i));for(var f in r)i[f]===void 0&&(i[f]=r[f])}return i}function Xg(r){zl(r)}function Jg(r){console.error(r)}function Zg(r){zl(r)}function ac(r,s){try{var i=r.onUncaughtError;i(s.value,{componentStack:s.stack})}catch(c){setTimeout(function(){throw c})}}function ey(r,s,i){try{var c=r.onCaughtError;c(i.value,{componentStack:i.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function cf(r,s,i){return i=us(i),i.tag=3,i.payload={element:null},i.callback=function(){ac(r,s)},i}function ty(r){return r=us(r),r.tag=3,r}function ny(r,s,i,c){var f=i.type.getDerivedStateFromError;if(typeof f=="function"){var g=c.value;r.payload=function(){return f(g)},r.callback=function(){ey(s,i,c)}}var w=i.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(r.callback=function(){ey(s,i,c),typeof f!="function"&&(ys===null?ys=new Set([this]):ys.add(this));var A=c.stack;this.componentDidCatch(c.value,{componentStack:A!==null?A:""})})}function r1(r,s,i,c,f){if(i.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(s=i.alternate,s!==null&&Wa(s,i,f,!0),i=An.current,i!==null){switch(i.tag){case 31:case 13:return Gn===null?yc():i.alternate===null&&bt===0&&(bt=3),i.flags&=-257,i.flags|=65536,i.lanes=f,c===Vl?i.flags|=16384:(s=i.updateQueue,s===null?i.updateQueue=new Set([c]):s.add(c),Nf(r,c,f)),!1;case 22:return i.flags|=65536,c===Vl?i.flags|=16384:(s=i.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([c])},i.updateQueue=s):(i=s.retryQueue,i===null?s.retryQueue=new Set([c]):i.add(c)),Nf(r,c,f)),!1}throw Error(a(435,i.tag))}return Nf(r,c,f),yc(),!1}if(Ie)return s=An.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=f,c!==Ad&&(r=Error(a(422),{cause:c}),eo(In(r,i)))):(c!==Ad&&(s=Error(a(423),{cause:c}),eo(In(s,i))),r=r.current.alternate,r.flags|=65536,f&=-f,r.lanes|=f,c=In(c,i),f=cf(r.stateNode,c,f),Ud(r,f),bt!==4&&(bt=2)),!1;var g=Error(a(520),{cause:c});if(g=In(g,i),_o===null?_o=[g]:_o.push(g),bt!==4&&(bt=2),s===null)return!0;c=In(c,i),i=s;do{switch(i.tag){case 3:return i.flags|=65536,r=f&-f,i.lanes|=r,r=cf(i.stateNode,c,r),Ud(i,r),!1;case 1:if(s=i.type,g=i.stateNode,(i.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(ys===null||!ys.has(g))))return i.flags|=65536,f&=-f,i.lanes|=f,f=ty(f),ny(f,r,i,c),Ud(i,f),!1}i=i.return}while(i!==null);return!1}var uf=Error(a(461)),Ct=!1;function Wt(r,s,i,c){s.child=r===null?ig(s,null,i,c):aa(s,r.child,i,c)}function ry(r,s,i,c,f){i=i.render;var g=s.ref;if("ref"in c){var w={};for(var A in c)A!=="ref"&&(w[A]=c[A])}else w=c;return ta(s),c=Fd(r,s,i,w,g,f),A=Gd(),r!==null&&!Ct?(Vd(r,s,f),Nr(r,s,f)):(Ie&&A&&Ed(s),s.flags|=1,Wt(r,s,c,f),s.child)}function sy(r,s,i,c,f){if(r===null){var g=i.type;return typeof g=="function"&&!Sd(g)&&g.defaultProps===void 0&&i.compare===null?(s.tag=15,s.type=g,ay(r,s,g,c,f)):(r=Bl(i.type,null,c,s,s.mode,f),r.ref=s.ref,r.return=s,s.child=r)}if(g=r.child,!vf(r,f)){var w=g.memoizedProps;if(i=i.compare,i=i!==null?i:Xi,i(w,c)&&r.ref===s.ref)return Nr(r,s,f)}return s.flags|=1,r=kr(g,c),r.ref=s.ref,r.return=s,s.child=r}function ay(r,s,i,c,f){if(r!==null){var g=r.memoizedProps;if(Xi(g,c)&&r.ref===s.ref)if(Ct=!1,s.pendingProps=c=g,vf(r,f))(r.flags&131072)!==0&&(Ct=!0);else return s.lanes=r.lanes,Nr(r,s,f)}return df(r,s,i,c,f)}function iy(r,s,i,c){var f=c.children,g=r!==null?r.memoizedState:null;if(r===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.mode==="hidden"){if((s.flags&128)!==0){if(g=g!==null?g.baseLanes|i:i,r!==null){for(c=s.child=r.child,f=0;c!==null;)f=f|c.lanes|c.childLanes,c=c.sibling;c=f&~g}else c=0,s.child=null;return oy(r,s,g,i,c)}if((i&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},r!==null&&Fl(s,g!==null?g.cachePool:null),g!==null?cg(s,g):Bd(),ug(s);else return c=s.lanes=536870912,oy(r,s,g!==null?g.baseLanes|i:i,i,c)}else g!==null?(Fl(s,g.cachePool),cg(s,g),hs(),s.memoizedState=null):(r!==null&&Fl(s,null),Bd(),hs());return Wt(r,s,f,i),s.child}function ho(r,s){return r!==null&&r.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function oy(r,s,i,c,f){var g=Nd();return g=g===null?null:{parent:At._currentValue,pool:g},s.memoizedState={baseLanes:i,cachePool:g},r!==null&&Fl(s,null),Bd(),ug(s),r!==null&&Wa(r,s,c,!0),s.childLanes=f,null}function ic(r,s){return s=lc({mode:s.mode,children:s.children},r.mode),s.ref=r.ref,r.child=s,s.return=r,s}function ly(r,s,i){return aa(s,r.child,null,i),r=ic(s,s.pendingProps),r.flags|=2,kn(s),s.memoizedState=null,r}function s1(r,s,i){var c=s.pendingProps,f=(s.flags&128)!==0;if(s.flags&=-129,r===null){if(Ie){if(c.mode==="hidden")return r=ic(s,c),s.lanes=536870912,ho(null,r);if(Hd(s),(r=ot)?(r=_v(r,Fn),r=r!==null&&r.data==="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:as!==null?{id:fr,overflow:hr}:null,retryLane:536870912,hydrationErrors:null},i=Gm(r),i.return=s,s.child=i,Yt=s,ot=null)):r=null,r===null)throw os(s);return s.lanes=536870912,null}return ic(s,c)}var g=r.memoizedState;if(g!==null){var w=g.dehydrated;if(Hd(s),f)if(s.flags&256)s.flags&=-257,s=ly(r,s,i);else if(s.memoizedState!==null)s.child=r.child,s.flags|=128,s=null;else throw Error(a(558));else if(Ct||Wa(r,s,i,!1),f=(i&r.childLanes)!==0,Ct||f){if(c=nt,c!==null&&(w=hn(c,i),w!==0&&w!==g.retryLane))throw g.retryLane=w,Xs(r,w),_n(c,r,w),uf;yc(),s=ly(r,s,i)}else r=g.treeContext,ot=Vn(w.nextSibling),Yt=s,Ie=!0,is=null,Fn=!1,r!==null&&Km(s,r),s=ic(s,c),s.flags|=4096;return s}return r=kr(r.child,{mode:c.mode,children:c.children}),r.ref=s.ref,s.child=r,r.return=s,r}function oc(r,s){var i=s.ref;if(i===null)r!==null&&r.ref!==null&&(s.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(a(284));(r===null||r.ref!==i)&&(s.flags|=4194816)}}function df(r,s,i,c,f){return ta(s),i=Fd(r,s,i,c,void 0,f),c=Gd(),r!==null&&!Ct?(Vd(r,s,f),Nr(r,s,f)):(Ie&&c&&Ed(s),s.flags|=1,Wt(r,s,i,f),s.child)}function cy(r,s,i,c,f,g){return ta(s),s.updateQueue=null,i=fg(s,c,i,f),dg(r),c=Gd(),r!==null&&!Ct?(Vd(r,s,g),Nr(r,s,g)):(Ie&&c&&Ed(s),s.flags|=1,Wt(r,s,i,g),s.child)}function uy(r,s,i,c,f){if(ta(s),s.stateNode===null){var g=Ga,w=i.contextType;typeof w=="object"&&w!==null&&(g=Kt(w)),g=new i(c,g),s.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,g.updater=lf,s.stateNode=g,g._reactInternals=s,g=s.stateNode,g.props=c,g.state=s.memoizedState,g.refs={},zd(s),w=i.contextType,g.context=typeof w=="object"&&w!==null?Kt(w):Ga,g.state=s.memoizedState,w=i.getDerivedStateFromProps,typeof w=="function"&&(of(s,i,w,c),g.state=s.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(w=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),w!==g.state&&lf.enqueueReplaceState(g,g.state,null),oo(s,c,g,f),io(),g.state=s.memoizedState),typeof g.componentDidMount=="function"&&(s.flags|=4194308),c=!0}else if(r===null){g=s.stateNode;var A=s.memoizedProps,M=oa(i,A);g.props=M;var F=g.context,J=i.contextType;w=Ga,typeof J=="object"&&J!==null&&(w=Kt(J));var te=i.getDerivedStateFromProps;J=typeof te=="function"||typeof g.getSnapshotBeforeUpdate=="function",A=s.pendingProps!==A,J||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(A||F!==w)&&Qg(s,g,c,w),cs=!1;var G=s.memoizedState;g.state=G,oo(s,c,g,f),io(),F=s.memoizedState,A||G!==F||cs?(typeof te=="function"&&(of(s,i,te,c),F=s.memoizedState),(M=cs||Wg(s,i,M,c,G,F,w))?(J||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount()),typeof g.componentDidMount=="function"&&(s.flags|=4194308)):(typeof g.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=c,s.memoizedState=F),g.props=c,g.state=F,g.context=w,c=M):(typeof g.componentDidMount=="function"&&(s.flags|=4194308),c=!1)}else{g=s.stateNode,Pd(r,s),w=s.memoizedProps,J=oa(i,w),g.props=J,te=s.pendingProps,G=g.context,F=i.contextType,M=Ga,typeof F=="object"&&F!==null&&(M=Kt(F)),A=i.getDerivedStateFromProps,(F=typeof A=="function"||typeof g.getSnapshotBeforeUpdate=="function")||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(w!==te||G!==M)&&Qg(s,g,c,M),cs=!1,G=s.memoizedState,g.state=G,oo(s,c,g,f),io();var K=s.memoizedState;w!==te||G!==K||cs||r!==null&&r.dependencies!==null&&Hl(r.dependencies)?(typeof A=="function"&&(of(s,i,A,c),K=s.memoizedState),(J=cs||Wg(s,i,J,c,G,K,M)||r!==null&&r.dependencies!==null&&Hl(r.dependencies))?(F||typeof g.UNSAFE_componentWillUpdate!="function"&&typeof g.componentWillUpdate!="function"||(typeof g.componentWillUpdate=="function"&&g.componentWillUpdate(c,K,M),typeof g.UNSAFE_componentWillUpdate=="function"&&g.UNSAFE_componentWillUpdate(c,K,M)),typeof g.componentDidUpdate=="function"&&(s.flags|=4),typeof g.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof g.componentDidUpdate!="function"||w===r.memoizedProps&&G===r.memoizedState||(s.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&G===r.memoizedState||(s.flags|=1024),s.memoizedProps=c,s.memoizedState=K),g.props=c,g.state=K,g.context=M,c=J):(typeof g.componentDidUpdate!="function"||w===r.memoizedProps&&G===r.memoizedState||(s.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&G===r.memoizedState||(s.flags|=1024),c=!1)}return g=c,oc(r,s),c=(s.flags&128)!==0,g||c?(g=s.stateNode,i=c&&typeof i.getDerivedStateFromError!="function"?null:g.render(),s.flags|=1,r!==null&&c?(s.child=aa(s,r.child,null,f),s.child=aa(s,null,i,f)):Wt(r,s,i,f),s.memoizedState=g.state,r=s.child):r=Nr(r,s,f),r}function dy(r,s,i,c){return Zs(),s.flags|=256,Wt(r,s,i,c),s.child}var ff={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function hf(r){return{baseLanes:r,cachePool:eg()}}function pf(r,s,i){return r=r!==null?r.childLanes&~i:0,s&&(r|=On),r}function fy(r,s,i){var c=s.pendingProps,f=!1,g=(s.flags&128)!==0,w;if((w=g)||(w=r!==null&&r.memoizedState===null?!1:(xt.current&2)!==0),w&&(f=!0,s.flags&=-129),w=(s.flags&32)!==0,s.flags&=-33,r===null){if(Ie){if(f?fs(s):hs(),(r=ot)?(r=_v(r,Fn),r=r!==null&&r.data!=="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:as!==null?{id:fr,overflow:hr}:null,retryLane:536870912,hydrationErrors:null},i=Gm(r),i.return=s,s.child=i,Yt=s,ot=null)):r=null,r===null)throw os(s);return Qf(r)?s.lanes=32:s.lanes=536870912,null}var A=c.children;return c=c.fallback,f?(hs(),f=s.mode,A=lc({mode:"hidden",children:A},f),c=Js(c,f,i,null),A.return=s,c.return=s,A.sibling=c,s.child=A,c=s.child,c.memoizedState=hf(i),c.childLanes=pf(r,w,i),s.memoizedState=ff,ho(null,c)):(fs(s),mf(s,A))}var M=r.memoizedState;if(M!==null&&(A=M.dehydrated,A!==null)){if(g)s.flags&256?(fs(s),s.flags&=-257,s=gf(r,s,i)):s.memoizedState!==null?(hs(),s.child=r.child,s.flags|=128,s=null):(hs(),A=c.fallback,f=s.mode,c=lc({mode:"visible",children:c.children},f),A=Js(A,f,i,null),A.flags|=2,c.return=s,A.return=s,c.sibling=A,s.child=c,aa(s,r.child,null,i),c=s.child,c.memoizedState=hf(i),c.childLanes=pf(r,w,i),s.memoizedState=ff,s=ho(null,c));else if(fs(s),Qf(A)){if(w=A.nextSibling&&A.nextSibling.dataset,w)var F=w.dgst;w=F,c=Error(a(419)),c.stack="",c.digest=w,eo({value:c,source:null,stack:null}),s=gf(r,s,i)}else if(Ct||Wa(r,s,i,!1),w=(i&r.childLanes)!==0,Ct||w){if(w=nt,w!==null&&(c=hn(w,i),c!==0&&c!==M.retryLane))throw M.retryLane=c,Xs(r,c),_n(w,r,c),uf;Wf(A)||yc(),s=gf(r,s,i)}else Wf(A)?(s.flags|=192,s.child=r.child,s=null):(r=M.treeContext,ot=Vn(A.nextSibling),Yt=s,Ie=!0,is=null,Fn=!1,r!==null&&Km(s,r),s=mf(s,c.children),s.flags|=4096);return s}return f?(hs(),A=c.fallback,f=s.mode,M=r.child,F=M.sibling,c=kr(M,{mode:"hidden",children:c.children}),c.subtreeFlags=M.subtreeFlags&65011712,F!==null?A=kr(F,A):(A=Js(A,f,i,null),A.flags|=2),A.return=s,c.return=s,c.sibling=A,s.child=c,ho(null,c),c=s.child,A=r.child.memoizedState,A===null?A=hf(i):(f=A.cachePool,f!==null?(M=At._currentValue,f=f.parent!==M?{parent:M,pool:M}:f):f=eg(),A={baseLanes:A.baseLanes|i,cachePool:f}),c.memoizedState=A,c.childLanes=pf(r,w,i),s.memoizedState=ff,ho(r.child,c)):(fs(s),i=r.child,r=i.sibling,i=kr(i,{mode:"visible",children:c.children}),i.return=s,i.sibling=null,r!==null&&(w=s.deletions,w===null?(s.deletions=[r],s.flags|=16):w.push(r)),s.child=i,s.memoizedState=null,i)}function mf(r,s){return s=lc({mode:"visible",children:s},r.mode),s.return=r,r.child=s}function lc(r,s){return r=Rn(22,r,null,s),r.lanes=0,r}function gf(r,s,i){return aa(s,r.child,null,i),r=mf(s,s.pendingProps.children),r.flags|=2,s.memoizedState=null,r}function hy(r,s,i){r.lanes|=s;var c=r.alternate;c!==null&&(c.lanes|=s),Od(r.return,s,i)}function yf(r,s,i,c,f,g){var w=r.memoizedState;w===null?r.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:c,tail:i,tailMode:f,treeForkCount:g}:(w.isBackwards=s,w.rendering=null,w.renderingStartTime=0,w.last=c,w.tail=i,w.tailMode=f,w.treeForkCount=g)}function py(r,s,i){var c=s.pendingProps,f=c.revealOrder,g=c.tail;c=c.children;var w=xt.current,A=(w&2)!==0;if(A?(w=w&1|2,s.flags|=128):w&=1,Z(xt,w),Wt(r,s,c,i),c=Ie?Zi:0,!A&&r!==null&&(r.flags&128)!==0)e:for(r=s.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&hy(r,i,s);else if(r.tag===19)hy(r,i,s);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break e;for(;r.sibling===null;){if(r.return===null||r.return===s)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(f){case"forwards":for(i=s.child,f=null;i!==null;)r=i.alternate,r!==null&&Ql(r)===null&&(f=i),i=i.sibling;i=f,i===null?(f=s.child,s.child=null):(f=i.sibling,i.sibling=null),yf(s,!1,f,i,g,c);break;case"backwards":case"unstable_legacy-backwards":for(i=null,f=s.child,s.child=null;f!==null;){if(r=f.alternate,r!==null&&Ql(r)===null){s.child=f;break}r=f.sibling,f.sibling=i,i=f,f=r}yf(s,!0,i,null,g,c);break;case"together":yf(s,!1,null,null,void 0,c);break;default:s.memoizedState=null}return s.child}function Nr(r,s,i){if(r!==null&&(s.dependencies=r.dependencies),gs|=s.lanes,(i&s.childLanes)===0)if(r!==null){if(Wa(r,s,i,!1),(i&s.childLanes)===0)return null}else return null;if(r!==null&&s.child!==r.child)throw Error(a(153));if(s.child!==null){for(r=s.child,i=kr(r,r.pendingProps),s.child=i,i.return=s;r.sibling!==null;)r=r.sibling,i=i.sibling=kr(r,r.pendingProps),i.return=s;i.sibling=null}return s.child}function vf(r,s){return(r.lanes&s)!==0?!0:(r=r.dependencies,!!(r!==null&&Hl(r)))}function a1(r,s,i){switch(s.tag){case 3:ie(s,s.stateNode.containerInfo),ls(s,At,r.memoizedState.cache),Zs();break;case 27:case 5:it(s);break;case 4:ie(s,s.stateNode.containerInfo);break;case 10:ls(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,Hd(s),null;break;case 13:var c=s.memoizedState;if(c!==null)return c.dehydrated!==null?(fs(s),s.flags|=128,null):(i&s.child.childLanes)!==0?fy(r,s,i):(fs(s),r=Nr(r,s,i),r!==null?r.sibling:null);fs(s);break;case 19:var f=(r.flags&128)!==0;if(c=(i&s.childLanes)!==0,c||(Wa(r,s,i,!1),c=(i&s.childLanes)!==0),f){if(c)return py(r,s,i);s.flags|=128}if(f=s.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),Z(xt,xt.current),c)break;return null;case 22:return s.lanes=0,iy(r,s,i,s.pendingProps);case 24:ls(s,At,r.memoizedState.cache)}return Nr(r,s,i)}function my(r,s,i){if(r!==null)if(r.memoizedProps!==s.pendingProps)Ct=!0;else{if(!vf(r,i)&&(s.flags&128)===0)return Ct=!1,a1(r,s,i);Ct=(r.flags&131072)!==0}else Ct=!1,Ie&&(s.flags&1048576)!==0&&Ym(s,Zi,s.index);switch(s.lanes=0,s.tag){case 16:e:{var c=s.pendingProps;if(r=ra(s.elementType),s.type=r,typeof r=="function")Sd(r)?(c=oa(r,c),s.tag=1,s=uy(null,s,r,c,i)):(s.tag=0,s=df(null,s,r,c,i));else{if(r!=null){var f=r.$$typeof;if(f===j){s.tag=11,s=ry(null,s,r,c,i);break e}else if(f===B){s.tag=14,s=sy(null,s,r,c,i);break e}}throw s=Se(r)||r,Error(a(306,s,""))}}return s;case 0:return df(r,s,s.type,s.pendingProps,i);case 1:return c=s.type,f=oa(c,s.pendingProps),uy(r,s,c,f,i);case 3:e:{if(ie(s,s.stateNode.containerInfo),r===null)throw Error(a(387));c=s.pendingProps;var g=s.memoizedState;f=g.element,Pd(r,s),oo(s,c,null,i);var w=s.memoizedState;if(c=w.cache,ls(s,At,c),c!==g.cache&&jd(s,[At],i,!0),io(),c=w.element,g.isDehydrated)if(g={element:c,isDehydrated:!1,cache:w.cache},s.updateQueue.baseState=g,s.memoizedState=g,s.flags&256){s=dy(r,s,c,i);break e}else if(c!==f){f=In(Error(a(424)),s),eo(f),s=dy(r,s,c,i);break e}else for(r=s.stateNode.containerInfo,r.nodeType===9?r=r.body:r=r.nodeName==="HTML"?r.ownerDocument.body:r,ot=Vn(r.firstChild),Yt=s,Ie=!0,is=null,Fn=!0,i=ig(s,null,c,i),s.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(Zs(),c===f){s=Nr(r,s,i);break e}Wt(r,s,c,i)}s=s.child}return s;case 26:return oc(r,s),r===null?(i=Rv(s.type,null,s.pendingProps,null))?s.memoizedState=i:Ie||(i=s.type,r=s.pendingProps,c=Tc(Q.current).createElement(i),c[Vt]=s,c[pn]=r,Qt(c,i,r),It(c),s.stateNode=c):s.memoizedState=Rv(s.type,r.memoizedProps,s.pendingProps,r.memoizedState),null;case 27:return it(s),r===null&&Ie&&(c=s.stateNode=xv(s.type,s.pendingProps,Q.current),Yt=s,Fn=!0,f=ot,ws(s.type)?(Xf=f,ot=Vn(c.firstChild)):ot=f),Wt(r,s,s.pendingProps.children,i),oc(r,s),r===null&&(s.flags|=4194304),s.child;case 5:return r===null&&Ie&&((f=c=ot)&&(c=L1(c,s.type,s.pendingProps,Fn),c!==null?(s.stateNode=c,Yt=s,ot=Vn(c.firstChild),Fn=!1,f=!0):f=!1),f||os(s)),it(s),f=s.type,g=s.pendingProps,w=r!==null?r.memoizedProps:null,c=g.children,Vf(f,g)?c=null:w!==null&&Vf(f,w)&&(s.flags|=32),s.memoizedState!==null&&(f=Fd(r,s,Qx,null,null,i),ko._currentValue=f),oc(r,s),Wt(r,s,c,i),s.child;case 6:return r===null&&Ie&&((r=i=ot)&&(i=z1(i,s.pendingProps,Fn),i!==null?(s.stateNode=i,Yt=s,ot=null,r=!0):r=!1),r||os(s)),null;case 13:return fy(r,s,i);case 4:return ie(s,s.stateNode.containerInfo),c=s.pendingProps,r===null?s.child=aa(s,null,c,i):Wt(r,s,c,i),s.child;case 11:return ry(r,s,s.type,s.pendingProps,i);case 7:return Wt(r,s,s.pendingProps,i),s.child;case 8:return Wt(r,s,s.pendingProps.children,i),s.child;case 12:return Wt(r,s,s.pendingProps.children,i),s.child;case 10:return c=s.pendingProps,ls(s,s.type,c.value),Wt(r,s,c.children,i),s.child;case 9:return f=s.type._context,c=s.pendingProps.children,ta(s),f=Kt(f),c=c(f),s.flags|=1,Wt(r,s,c,i),s.child;case 14:return sy(r,s,s.type,s.pendingProps,i);case 15:return ay(r,s,s.type,s.pendingProps,i);case 19:return py(r,s,i);case 31:return s1(r,s,i);case 22:return iy(r,s,i,s.pendingProps);case 24:return ta(s),c=Kt(At),r===null?(f=Nd(),f===null&&(f=nt,g=Dd(),f.pooledCache=g,g.refCount++,g!==null&&(f.pooledCacheLanes|=i),f=g),s.memoizedState={parent:c,cache:f},zd(s),ls(s,At,f)):((r.lanes&i)!==0&&(Pd(r,s),oo(s,null,null,i),io()),f=r.memoizedState,g=s.memoizedState,f.parent!==c?(f={parent:c,cache:c},s.memoizedState=f,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=f),ls(s,At,c)):(c=g.cache,ls(s,At,c),c!==f.cache&&jd(s,[At],i,!0))),Wt(r,s,s.pendingProps.children,i),s.child;case 29:throw s.pendingProps}throw Error(a(156,s.tag))}function Lr(r){r.flags|=4}function bf(r,s,i,c,f){if((s=(r.mode&32)!==0)&&(s=!1),s){if(r.flags|=16777216,(f&335544128)===f)if(r.stateNode.complete)r.flags|=8192;else if(Hy())r.flags|=8192;else throw sa=Vl,Ld}else r.flags&=-16777217}function gy(r,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!jv(s))if(Hy())r.flags|=8192;else throw sa=Vl,Ld}function cc(r,s){s!==null&&(r.flags|=4),r.flags&16384&&(s=r.tag!==22?tn():536870912,r.lanes|=s,oi|=s)}function po(r,s){if(!Ie)switch(r.tailMode){case"hidden":s=r.tail;for(var i=null;s!==null;)s.alternate!==null&&(i=s),s=s.sibling;i===null?r.tail=null:i.sibling=null;break;case"collapsed":i=r.tail;for(var c=null;i!==null;)i.alternate!==null&&(c=i),i=i.sibling;c===null?s||r.tail===null?r.tail=null:r.tail.sibling=null:c.sibling=null}}function lt(r){var s=r.alternate!==null&&r.alternate.child===r.child,i=0,c=0;if(s)for(var f=r.child;f!==null;)i|=f.lanes|f.childLanes,c|=f.subtreeFlags&65011712,c|=f.flags&65011712,f.return=r,f=f.sibling;else for(f=r.child;f!==null;)i|=f.lanes|f.childLanes,c|=f.subtreeFlags,c|=f.flags,f.return=r,f=f.sibling;return r.subtreeFlags|=c,r.childLanes=i,s}function i1(r,s,i){var c=s.pendingProps;switch(Rd(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return lt(s),null;case 1:return lt(s),null;case 3:return i=s.stateNode,c=null,r!==null&&(c=r.memoizedState.cache),s.memoizedState.cache!==c&&(s.flags|=2048),jr(At),Oe(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(r===null||r.child===null)&&(Ka(s)?Lr(s):r===null||r.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,kd())),lt(s),null;case 26:var f=s.type,g=s.memoizedState;return r===null?(Lr(s),g!==null?(lt(s),gy(s,g)):(lt(s),bf(s,f,null,c,i))):g?g!==r.memoizedState?(Lr(s),lt(s),gy(s,g)):(lt(s),s.flags&=-16777217):(r=r.memoizedProps,r!==c&&Lr(s),lt(s),bf(s,f,r,c,i)),null;case 27:if(xe(s),i=Q.current,f=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==c&&Lr(s);else{if(!c){if(s.stateNode===null)throw Error(a(166));return lt(s),null}r=re.current,Ka(s)?Wm(s):(r=xv(f,c,i),s.stateNode=r,Lr(s))}return lt(s),null;case 5:if(xe(s),f=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==c&&Lr(s);else{if(!c){if(s.stateNode===null)throw Error(a(166));return lt(s),null}if(g=re.current,Ka(s))Wm(s);else{var w=Tc(Q.current);switch(g){case 1:g=w.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:g=w.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":g=w.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":g=w.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":g=w.createElement("div"),g.innerHTML="<script><\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof c.is=="string"?w.createElement("select",{is:c.is}):w.createElement("select"),c.multiple?g.multiple=!0:c.size&&(g.size=c.size);break;default:g=typeof c.is=="string"?w.createElement(f,{is:c.is}):w.createElement(f)}}g[Vt]=s,g[pn]=c;e:for(w=s.child;w!==null;){if(w.tag===5||w.tag===6)g.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===s)break e;for(;w.sibling===null;){if(w.return===null||w.return===s)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}s.stateNode=g;e:switch(Qt(g,f,c),f){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&Lr(s)}}return lt(s),bf(s,s.type,r===null?null:r.memoizedProps,s.pendingProps,i),null;case 6:if(r&&s.stateNode!=null)r.memoizedProps!==c&&Lr(s);else{if(typeof c!="string"&&s.stateNode===null)throw Error(a(166));if(r=Q.current,Ka(s)){if(r=s.stateNode,i=s.memoizedProps,c=null,f=Yt,f!==null)switch(f.tag){case 27:case 5:c=f.memoizedProps}r[Vt]=s,r=!!(r.nodeValue===i||c!==null&&c.suppressHydrationWarning===!0||fv(r.nodeValue,i)),r||os(s,!0)}else r=Tc(r).createTextNode(c),r[Vt]=s,s.stateNode=r}return lt(s),null;case 31:if(i=s.memoizedState,r===null||r.memoizedState!==null){if(c=Ka(s),i!==null){if(r===null){if(!c)throw Error(a(318));if(r=s.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(557));r[Vt]=s}else Zs(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;lt(s),r=!1}else i=kd(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=i),r=!0;if(!r)return s.flags&256?(kn(s),s):(kn(s),null);if((s.flags&128)!==0)throw Error(a(558))}return lt(s),null;case 13:if(c=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(f=Ka(s),c!==null&&c.dehydrated!==null){if(r===null){if(!f)throw Error(a(318));if(f=s.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(a(317));f[Vt]=s}else Zs(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;lt(s),f=!1}else f=kd(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=f),f=!0;if(!f)return s.flags&256?(kn(s),s):(kn(s),null)}return kn(s),(s.flags&128)!==0?(s.lanes=i,s):(i=c!==null,r=r!==null&&r.memoizedState!==null,i&&(c=s.child,f=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(f=c.alternate.memoizedState.cachePool.pool),g=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(g=c.memoizedState.cachePool.pool),g!==f&&(c.flags|=2048)),i!==r&&i&&(s.child.flags|=8192),cc(s,s.updateQueue),lt(s),null);case 4:return Oe(),r===null&&If(s.stateNode.containerInfo),lt(s),null;case 10:return jr(s.type),lt(s),null;case 19:if(X(xt),c=s.memoizedState,c===null)return lt(s),null;if(f=(s.flags&128)!==0,g=c.rendering,g===null)if(f)po(c,!1);else{if(bt!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(g=Ql(r),g!==null){for(s.flags|=128,po(c,!1),r=g.updateQueue,s.updateQueue=r,cc(s,r),s.subtreeFlags=0,r=i,i=s.child;i!==null;)Fm(i,r),i=i.sibling;return Z(xt,xt.current&1|2),Ie&&Cr(s,c.treeForkCount),s.child}r=r.sibling}c.tail!==null&&Rt()>pc&&(s.flags|=128,f=!0,po(c,!1),s.lanes=4194304)}else{if(!f)if(r=Ql(g),r!==null){if(s.flags|=128,f=!0,r=r.updateQueue,s.updateQueue=r,cc(s,r),po(c,!0),c.tail===null&&c.tailMode==="hidden"&&!g.alternate&&!Ie)return lt(s),null}else 2*Rt()-c.renderingStartTime>pc&&i!==536870912&&(s.flags|=128,f=!0,po(c,!1),s.lanes=4194304);c.isBackwards?(g.sibling=s.child,s.child=g):(r=c.last,r!==null?r.sibling=g:s.child=g,c.last=g)}return c.tail!==null?(r=c.tail,c.rendering=r,c.tail=r.sibling,c.renderingStartTime=Rt(),r.sibling=null,i=xt.current,Z(xt,f?i&1|2:i&1),Ie&&Cr(s,c.treeForkCount),r):(lt(s),null);case 22:case 23:return kn(s),Id(),c=s.memoizedState!==null,r!==null?r.memoizedState!==null!==c&&(s.flags|=8192):c&&(s.flags|=8192),c?(i&536870912)!==0&&(s.flags&128)===0&&(lt(s),s.subtreeFlags&6&&(s.flags|=8192)):lt(s),i=s.updateQueue,i!==null&&cc(s,i.retryQueue),i=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(i=r.memoizedState.cachePool.pool),c=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),c!==i&&(s.flags|=2048),r!==null&&X(na),null;case 24:return i=null,r!==null&&(i=r.memoizedState.cache),s.memoizedState.cache!==i&&(s.flags|=2048),jr(At),lt(s),null;case 25:return null;case 30:return null}throw Error(a(156,s.tag))}function o1(r,s){switch(Rd(s),s.tag){case 1:return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return jr(At),Oe(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 26:case 27:case 5:return xe(s),null;case 31:if(s.memoizedState!==null){if(kn(s),s.alternate===null)throw Error(a(340));Zs()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 13:if(kn(s),r=s.memoizedState,r!==null&&r.dehydrated!==null){if(s.alternate===null)throw Error(a(340));Zs()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 19:return X(xt),null;case 4:return Oe(),null;case 10:return jr(s.type),null;case 22:case 23:return kn(s),Id(),r!==null&&X(na),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 24:return jr(At),null;case 25:return null;default:return null}}function yy(r,s){switch(Rd(s),s.tag){case 3:jr(At),Oe();break;case 26:case 27:case 5:xe(s);break;case 4:Oe();break;case 31:s.memoizedState!==null&&kn(s);break;case 13:kn(s);break;case 19:X(xt);break;case 10:jr(s.type);break;case 22:case 23:kn(s),Id(),r!==null&&X(na);break;case 24:jr(At)}}function mo(r,s){try{var i=s.updateQueue,c=i!==null?i.lastEffect:null;if(c!==null){var f=c.next;i=f;do{if((i.tag&r)===r){c=void 0;var g=i.create,w=i.inst;c=g(),w.destroy=c}i=i.next}while(i!==f)}}catch(A){Qe(s,s.return,A)}}function ps(r,s,i){try{var c=s.updateQueue,f=c!==null?c.lastEffect:null;if(f!==null){var g=f.next;c=g;do{if((c.tag&r)===r){var w=c.inst,A=w.destroy;if(A!==void 0){w.destroy=void 0,f=s;var M=i,F=A;try{F()}catch(J){Qe(f,M,J)}}}c=c.next}while(c!==g)}}catch(J){Qe(s,s.return,J)}}function vy(r){var s=r.updateQueue;if(s!==null){var i=r.stateNode;try{lg(s,i)}catch(c){Qe(r,r.return,c)}}}function by(r,s,i){i.props=oa(r.type,r.memoizedProps),i.state=r.memoizedState;try{i.componentWillUnmount()}catch(c){Qe(r,s,c)}}function go(r,s){try{var i=r.ref;if(i!==null){switch(r.tag){case 26:case 27:case 5:var c=r.stateNode;break;case 30:c=r.stateNode;break;default:c=r.stateNode}typeof i=="function"?r.refCleanup=i(c):i.current=c}}catch(f){Qe(r,s,f)}}function pr(r,s){var i=r.ref,c=r.refCleanup;if(i!==null)if(typeof c=="function")try{c()}catch(f){Qe(r,s,f)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(f){Qe(r,s,f)}else i.current=null}function _y(r){var s=r.type,i=r.memoizedProps,c=r.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":i.autoFocus&&c.focus();break e;case"img":i.src?c.src=i.src:i.srcSet&&(c.srcset=i.srcSet)}}catch(f){Qe(r,r.return,f)}}function _f(r,s,i){try{var c=r.stateNode;C1(c,r.type,i,s),c[pn]=s}catch(f){Qe(r,r.return,f)}}function wy(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&ws(r.type)||r.tag===4}function wf(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||wy(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&ws(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function Sf(r,s,i){var c=r.tag;if(c===5||c===6)r=r.stateNode,s?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(r,s):(s=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,s.appendChild(r),i=i._reactRootContainer,i!=null||s.onclick!==null||(s.onclick=Rr));else if(c!==4&&(c===27&&ws(r.type)&&(i=r.stateNode,s=null),r=r.child,r!==null))for(Sf(r,s,i),r=r.sibling;r!==null;)Sf(r,s,i),r=r.sibling}function uc(r,s,i){var c=r.tag;if(c===5||c===6)r=r.stateNode,s?i.insertBefore(r,s):i.appendChild(r);else if(c!==4&&(c===27&&ws(r.type)&&(i=r.stateNode),r=r.child,r!==null))for(uc(r,s,i),r=r.sibling;r!==null;)uc(r,s,i),r=r.sibling}function Sy(r){var s=r.stateNode,i=r.memoizedProps;try{for(var c=r.type,f=s.attributes;f.length;)s.removeAttributeNode(f[0]);Qt(s,c,i),s[Vt]=r,s[pn]=i}catch(g){Qe(r,r.return,g)}}var zr=!1,Ot=!1,xf=!1,xy=typeof WeakSet=="function"?WeakSet:Set,Ht=null;function l1(r,s){if(r=r.containerInfo,Ff=jc,r=Lm(r),md(r)){if("selectionStart"in r)var i={start:r.selectionStart,end:r.selectionEnd};else e:{i=(i=r.ownerDocument)&&i.defaultView||window;var c=i.getSelection&&i.getSelection();if(c&&c.rangeCount!==0){i=c.anchorNode;var f=c.anchorOffset,g=c.focusNode;c=c.focusOffset;try{i.nodeType,g.nodeType}catch{i=null;break e}var w=0,A=-1,M=-1,F=0,J=0,te=r,G=null;t:for(;;){for(var K;te!==i||f!==0&&te.nodeType!==3||(A=w+f),te!==g||c!==0&&te.nodeType!==3||(M=w+c),te.nodeType===3&&(w+=te.nodeValue.length),(K=te.firstChild)!==null;)G=te,te=K;for(;;){if(te===r)break t;if(G===i&&++F===f&&(A=w),G===g&&++J===c&&(M=w),(K=te.nextSibling)!==null)break;te=G,G=te.parentNode}te=K}i=A===-1||M===-1?null:{start:A,end:M}}else i=null}i=i||{start:0,end:0}}else i=null;for(Gf={focusedElem:r,selectionRange:i},jc=!1,Ht=s;Ht!==null;)if(s=Ht,r=s.child,(s.subtreeFlags&1028)!==0&&r!==null)r.return=s,Ht=r;else for(;Ht!==null;){switch(s=Ht,g=s.alternate,r=s.flags,s.tag){case 0:if((r&4)!==0&&(r=s.updateQueue,r=r!==null?r.events:null,r!==null))for(i=0;i<r.length;i++)f=r[i],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&g!==null){r=void 0,i=s,f=g.memoizedProps,g=g.memoizedState,c=i.stateNode;try{var de=oa(i.type,f);r=c.getSnapshotBeforeUpdate(de,g),c.__reactInternalSnapshotBeforeUpdate=r}catch(_e){Qe(i,i.return,_e)}}break;case 3:if((r&1024)!==0){if(r=s.stateNode.containerInfo,i=r.nodeType,i===9)Kf(r);else if(i===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":Kf(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(a(163))}if(r=s.sibling,r!==null){r.return=s.return,Ht=r;break}Ht=s.return}}function Ty(r,s,i){var c=i.flags;switch(i.tag){case 0:case 11:case 15:Ur(r,i),c&4&&mo(5,i);break;case 1:if(Ur(r,i),c&4)if(r=i.stateNode,s===null)try{r.componentDidMount()}catch(w){Qe(i,i.return,w)}else{var f=oa(i.type,s.memoizedProps);s=s.memoizedState;try{r.componentDidUpdate(f,s,r.__reactInternalSnapshotBeforeUpdate)}catch(w){Qe(i,i.return,w)}}c&64&&vy(i),c&512&&go(i,i.return);break;case 3:if(Ur(r,i),c&64&&(r=i.updateQueue,r!==null)){if(s=null,i.child!==null)switch(i.child.tag){case 27:case 5:s=i.child.stateNode;break;case 1:s=i.child.stateNode}try{lg(r,s)}catch(w){Qe(i,i.return,w)}}break;case 27:s===null&&c&4&&Sy(i);case 26:case 5:Ur(r,i),s===null&&c&4&&_y(i),c&512&&go(i,i.return);break;case 12:Ur(r,i);break;case 31:Ur(r,i),c&4&&Ay(r,i);break;case 13:Ur(r,i),c&4&&ky(r,i),c&64&&(r=i.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(i=y1.bind(null,i),P1(r,i))));break;case 22:if(c=i.memoizedState!==null||zr,!c){s=s!==null&&s.memoizedState!==null||Ot,f=zr;var g=Ot;zr=c,(Ot=s)&&!g?$r(r,i,(i.subtreeFlags&8772)!==0):Ur(r,i),zr=f,Ot=g}break;case 30:break;default:Ur(r,i)}}function Ey(r){var s=r.alternate;s!==null&&(r.alternate=null,Ey(s)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(s=r.stateNode,s!==null&&Ju(s)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var ft=null,gn=!1;function Pr(r,s,i){for(i=i.child;i!==null;)Ry(r,s,i),i=i.sibling}function Ry(r,s,i){if($t&&typeof $t.onCommitFiberUnmount=="function")try{$t.onCommitFiberUnmount(Pn,i)}catch{}switch(i.tag){case 26:Ot||pr(i,s),Pr(r,s,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:Ot||pr(i,s);var c=ft,f=gn;ws(i.type)&&(ft=i.stateNode,gn=!1),Pr(r,s,i),Eo(i.stateNode),ft=c,gn=f;break;case 5:Ot||pr(i,s);case 6:if(c=ft,f=gn,ft=null,Pr(r,s,i),ft=c,gn=f,ft!==null)if(gn)try{(ft.nodeType===9?ft.body:ft.nodeName==="HTML"?ft.ownerDocument.body:ft).removeChild(i.stateNode)}catch(g){Qe(i,s,g)}else try{ft.removeChild(i.stateNode)}catch(g){Qe(i,s,g)}break;case 18:ft!==null&&(gn?(r=ft,vv(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,i.stateNode),mi(r)):vv(ft,i.stateNode));break;case 4:c=ft,f=gn,ft=i.stateNode.containerInfo,gn=!0,Pr(r,s,i),ft=c,gn=f;break;case 0:case 11:case 14:case 15:ps(2,i,s),Ot||ps(4,i,s),Pr(r,s,i);break;case 1:Ot||(pr(i,s),c=i.stateNode,typeof c.componentWillUnmount=="function"&&by(i,s,c)),Pr(r,s,i);break;case 21:Pr(r,s,i);break;case 22:Ot=(c=Ot)||i.memoizedState!==null,Pr(r,s,i),Ot=c;break;default:Pr(r,s,i)}}function Ay(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{mi(r)}catch(i){Qe(s,s.return,i)}}}function ky(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{mi(r)}catch(i){Qe(s,s.return,i)}}function c1(r){switch(r.tag){case 31:case 13:case 19:var s=r.stateNode;return s===null&&(s=r.stateNode=new xy),s;case 22:return r=r.stateNode,s=r._retryCache,s===null&&(s=r._retryCache=new xy),s;default:throw Error(a(435,r.tag))}}function dc(r,s){var i=c1(r);s.forEach(function(c){if(!i.has(c)){i.add(c);var f=v1.bind(null,r,c);c.then(f,f)}})}function yn(r,s){var i=s.deletions;if(i!==null)for(var c=0;c<i.length;c++){var f=i[c],g=r,w=s,A=w;e:for(;A!==null;){switch(A.tag){case 27:if(ws(A.type)){ft=A.stateNode,gn=!1;break e}break;case 5:ft=A.stateNode,gn=!1;break e;case 3:case 4:ft=A.stateNode.containerInfo,gn=!0;break e}A=A.return}if(ft===null)throw Error(a(160));Ry(g,w,f),ft=null,gn=!1,g=f.alternate,g!==null&&(g.return=null),f.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)Cy(s,r),s=s.sibling}var er=null;function Cy(r,s){var i=r.alternate,c=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:yn(s,r),vn(r),c&4&&(ps(3,r,r.return),mo(3,r),ps(5,r,r.return));break;case 1:yn(s,r),vn(r),c&512&&(Ot||i===null||pr(i,i.return)),c&64&&zr&&(r=r.updateQueue,r!==null&&(c=r.callbacks,c!==null&&(i=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=i===null?c:i.concat(c))));break;case 26:var f=er;if(yn(s,r),vn(r),c&512&&(Ot||i===null||pr(i,i.return)),c&4){var g=i!==null?i.memoizedState:null;if(c=r.memoizedState,i===null)if(c===null)if(r.stateNode===null){e:{c=r.type,i=r.memoizedProps,f=f.ownerDocument||f;t:switch(c){case"title":g=f.getElementsByTagName("title")[0],(!g||g[Hi]||g[Vt]||g.namespaceURI==="http://www.w3.org/2000/svg"||g.hasAttribute("itemprop"))&&(g=f.createElement(c),f.head.insertBefore(g,f.querySelector("head > title"))),Qt(g,c,i),g[Vt]=r,It(g),c=g;break e;case"link":var w=Cv("link","href",f).get(c+(i.href||""));if(w){for(var A=0;A<w.length;A++)if(g=w[A],g.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&g.getAttribute("rel")===(i.rel==null?null:i.rel)&&g.getAttribute("title")===(i.title==null?null:i.title)&&g.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){w.splice(A,1);break t}}g=f.createElement(c),Qt(g,c,i),f.head.appendChild(g);break;case"meta":if(w=Cv("meta","content",f).get(c+(i.content||""))){for(A=0;A<w.length;A++)if(g=w[A],g.getAttribute("content")===(i.content==null?null:""+i.content)&&g.getAttribute("name")===(i.name==null?null:i.name)&&g.getAttribute("property")===(i.property==null?null:i.property)&&g.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&g.getAttribute("charset")===(i.charSet==null?null:i.charSet)){w.splice(A,1);break t}}g=f.createElement(c),Qt(g,c,i),f.head.appendChild(g);break;default:throw Error(a(468,c))}g[Vt]=r,It(g),c=g}r.stateNode=c}else Ov(f,r.type,r.stateNode);else r.stateNode=kv(f,c,r.memoizedProps);else g!==c?(g===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):g.count--,c===null?Ov(f,r.type,r.stateNode):kv(f,c,r.memoizedProps)):c===null&&r.stateNode!==null&&_f(r,r.memoizedProps,i.memoizedProps)}break;case 27:yn(s,r),vn(r),c&512&&(Ot||i===null||pr(i,i.return)),i!==null&&c&4&&_f(r,r.memoizedProps,i.memoizedProps);break;case 5:if(yn(s,r),vn(r),c&512&&(Ot||i===null||pr(i,i.return)),r.flags&32){f=r.stateNode;try{Ua(f,"")}catch(de){Qe(r,r.return,de)}}c&4&&r.stateNode!=null&&(f=r.memoizedProps,_f(r,f,i!==null?i.memoizedProps:f)),c&1024&&(xf=!0);break;case 6:if(yn(s,r),vn(r),c&4){if(r.stateNode===null)throw Error(a(162));c=r.memoizedProps,i=r.stateNode;try{i.nodeValue=c}catch(de){Qe(r,r.return,de)}}break;case 3:if(Ac=null,f=er,er=Ec(s.containerInfo),yn(s,r),er=f,vn(r),c&4&&i!==null&&i.memoizedState.isDehydrated)try{mi(s.containerInfo)}catch(de){Qe(r,r.return,de)}xf&&(xf=!1,Oy(r));break;case 4:c=er,er=Ec(r.stateNode.containerInfo),yn(s,r),vn(r),er=c;break;case 12:yn(s,r),vn(r);break;case 31:yn(s,r),vn(r),c&4&&(c=r.updateQueue,c!==null&&(r.updateQueue=null,dc(r,c)));break;case 13:yn(s,r),vn(r),r.child.flags&8192&&r.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(hc=Rt()),c&4&&(c=r.updateQueue,c!==null&&(r.updateQueue=null,dc(r,c)));break;case 22:f=r.memoizedState!==null;var M=i!==null&&i.memoizedState!==null,F=zr,J=Ot;if(zr=F||f,Ot=J||M,yn(s,r),Ot=J,zr=F,vn(r),c&8192)e:for(s=r.stateNode,s._visibility=f?s._visibility&-2:s._visibility|1,f&&(i===null||M||zr||Ot||la(r)),i=null,s=r;;){if(s.tag===5||s.tag===26){if(i===null){M=i=s;try{if(g=M.stateNode,f)w=g.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{A=M.stateNode;var te=M.memoizedProps.style,G=te!=null&&te.hasOwnProperty("display")?te.display:null;A.style.display=G==null||typeof G=="boolean"?"":(""+G).trim()}}catch(de){Qe(M,M.return,de)}}}else if(s.tag===6){if(i===null){M=s;try{M.stateNode.nodeValue=f?"":M.memoizedProps}catch(de){Qe(M,M.return,de)}}}else if(s.tag===18){if(i===null){M=s;try{var K=M.stateNode;f?bv(K,!0):bv(M.stateNode,!1)}catch(de){Qe(M,M.return,de)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===r)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break e;for(;s.sibling===null;){if(s.return===null||s.return===r)break e;i===s&&(i=null),s=s.return}i===s&&(i=null),s.sibling.return=s.return,s=s.sibling}c&4&&(c=r.updateQueue,c!==null&&(i=c.retryQueue,i!==null&&(c.retryQueue=null,dc(r,i))));break;case 19:yn(s,r),vn(r),c&4&&(c=r.updateQueue,c!==null&&(r.updateQueue=null,dc(r,c)));break;case 30:break;case 21:break;default:yn(s,r),vn(r)}}function vn(r){var s=r.flags;if(s&2){try{for(var i,c=r.return;c!==null;){if(wy(c)){i=c;break}c=c.return}if(i==null)throw Error(a(160));switch(i.tag){case 27:var f=i.stateNode,g=wf(r);uc(r,g,f);break;case 5:var w=i.stateNode;i.flags&32&&(Ua(w,""),i.flags&=-33);var A=wf(r);uc(r,A,w);break;case 3:case 4:var M=i.stateNode.containerInfo,F=wf(r);Sf(r,F,M);break;default:throw Error(a(161))}}catch(J){Qe(r,r.return,J)}r.flags&=-3}s&4096&&(r.flags&=-4097)}function Oy(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var s=r;Oy(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),r=r.sibling}}function Ur(r,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)Ty(r,s.alternate,s),s=s.sibling}function la(r){for(r=r.child;r!==null;){var s=r;switch(s.tag){case 0:case 11:case 14:case 15:ps(4,s,s.return),la(s);break;case 1:pr(s,s.return);var i=s.stateNode;typeof i.componentWillUnmount=="function"&&by(s,s.return,i),la(s);break;case 27:Eo(s.stateNode);case 26:case 5:pr(s,s.return),la(s);break;case 22:s.memoizedState===null&&la(s);break;case 30:la(s);break;default:la(s)}r=r.sibling}}function $r(r,s,i){for(i=i&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var c=s.alternate,f=r,g=s,w=g.flags;switch(g.tag){case 0:case 11:case 15:$r(f,g,i),mo(4,g);break;case 1:if($r(f,g,i),c=g,f=c.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(F){Qe(c,c.return,F)}if(c=g,f=c.updateQueue,f!==null){var A=c.stateNode;try{var M=f.shared.hiddenCallbacks;if(M!==null)for(f.shared.hiddenCallbacks=null,f=0;f<M.length;f++)og(M[f],A)}catch(F){Qe(c,c.return,F)}}i&&w&64&&vy(g),go(g,g.return);break;case 27:Sy(g);case 26:case 5:$r(f,g,i),i&&c===null&&w&4&&_y(g),go(g,g.return);break;case 12:$r(f,g,i);break;case 31:$r(f,g,i),i&&w&4&&Ay(f,g);break;case 13:$r(f,g,i),i&&w&4&&ky(f,g);break;case 22:g.memoizedState===null&&$r(f,g,i),go(g,g.return);break;case 30:break;default:$r(f,g,i)}s=s.sibling}}function Tf(r,s){var i=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(i=r.memoizedState.cachePool.pool),r=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(r=s.memoizedState.cachePool.pool),r!==i&&(r!=null&&r.refCount++,i!=null&&to(i))}function Ef(r,s){r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&to(r))}function tr(r,s,i,c){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)jy(r,s,i,c),s=s.sibling}function jy(r,s,i,c){var f=s.flags;switch(s.tag){case 0:case 11:case 15:tr(r,s,i,c),f&2048&&mo(9,s);break;case 1:tr(r,s,i,c);break;case 3:tr(r,s,i,c),f&2048&&(r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&to(r)));break;case 12:if(f&2048){tr(r,s,i,c),r=s.stateNode;try{var g=s.memoizedProps,w=g.id,A=g.onPostCommit;typeof A=="function"&&A(w,s.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(M){Qe(s,s.return,M)}}else tr(r,s,i,c);break;case 31:tr(r,s,i,c);break;case 13:tr(r,s,i,c);break;case 23:break;case 22:g=s.stateNode,w=s.alternate,s.memoizedState!==null?g._visibility&2?tr(r,s,i,c):yo(r,s):g._visibility&2?tr(r,s,i,c):(g._visibility|=2,si(r,s,i,c,(s.subtreeFlags&10256)!==0||!1)),f&2048&&Tf(w,s);break;case 24:tr(r,s,i,c),f&2048&&Ef(s.alternate,s);break;default:tr(r,s,i,c)}}function si(r,s,i,c,f){for(f=f&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var g=r,w=s,A=i,M=c,F=w.flags;switch(w.tag){case 0:case 11:case 15:si(g,w,A,M,f),mo(8,w);break;case 23:break;case 22:var J=w.stateNode;w.memoizedState!==null?J._visibility&2?si(g,w,A,M,f):yo(g,w):(J._visibility|=2,si(g,w,A,M,f)),f&&F&2048&&Tf(w.alternate,w);break;case 24:si(g,w,A,M,f),f&&F&2048&&Ef(w.alternate,w);break;default:si(g,w,A,M,f)}s=s.sibling}}function yo(r,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var i=r,c=s,f=c.flags;switch(c.tag){case 22:yo(i,c),f&2048&&Tf(c.alternate,c);break;case 24:yo(i,c),f&2048&&Ef(c.alternate,c);break;default:yo(i,c)}s=s.sibling}}var vo=8192;function ai(r,s,i){if(r.subtreeFlags&vo)for(r=r.child;r!==null;)Dy(r,s,i),r=r.sibling}function Dy(r,s,i){switch(r.tag){case 26:ai(r,s,i),r.flags&vo&&r.memoizedState!==null&&W1(i,er,r.memoizedState,r.memoizedProps);break;case 5:ai(r,s,i);break;case 3:case 4:var c=er;er=Ec(r.stateNode.containerInfo),ai(r,s,i),er=c;break;case 22:r.memoizedState===null&&(c=r.alternate,c!==null&&c.memoizedState!==null?(c=vo,vo=16777216,ai(r,s,i),vo=c):ai(r,s,i));break;default:ai(r,s,i)}}function My(r){var s=r.alternate;if(s!==null&&(r=s.child,r!==null)){s.child=null;do s=r.sibling,r.sibling=null,r=s;while(r!==null)}}function bo(r){var s=r.deletions;if((r.flags&16)!==0){if(s!==null)for(var i=0;i<s.length;i++){var c=s[i];Ht=c,Ly(c,r)}My(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)Ny(r),r=r.sibling}function Ny(r){switch(r.tag){case 0:case 11:case 15:bo(r),r.flags&2048&&ps(9,r,r.return);break;case 3:bo(r);break;case 12:bo(r);break;case 22:var s=r.stateNode;r.memoizedState!==null&&s._visibility&2&&(r.return===null||r.return.tag!==13)?(s._visibility&=-3,fc(r)):bo(r);break;default:bo(r)}}function fc(r){var s=r.deletions;if((r.flags&16)!==0){if(s!==null)for(var i=0;i<s.length;i++){var c=s[i];Ht=c,Ly(c,r)}My(r)}for(r=r.child;r!==null;){switch(s=r,s.tag){case 0:case 11:case 15:ps(8,s,s.return),fc(s);break;case 22:i=s.stateNode,i._visibility&2&&(i._visibility&=-3,fc(s));break;default:fc(s)}r=r.sibling}}function Ly(r,s){for(;Ht!==null;){var i=Ht;switch(i.tag){case 0:case 11:case 15:ps(8,i,s);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var c=i.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;case 24:to(i.memoizedState.cache)}if(c=i.child,c!==null)c.return=i,Ht=c;else e:for(i=r;Ht!==null;){c=Ht;var f=c.sibling,g=c.return;if(Ey(c),c===i){Ht=null;break e}if(f!==null){f.return=g,Ht=f;break e}Ht=g}}}var u1={getCacheForType:function(r){var s=Kt(At),i=s.data.get(r);return i===void 0&&(i=r(),s.data.set(r,i)),i},cacheSignal:function(){return Kt(At).controller.signal}},d1=typeof WeakMap=="function"?WeakMap:Map,Ye=0,nt=null,ze=null,Ue=0,We=0,Cn=null,ms=!1,ii=!1,Rf=!1,Br=0,bt=0,gs=0,ca=0,Af=0,On=0,oi=0,_o=null,bn=null,kf=!1,hc=0,zy=0,pc=1/0,mc=null,ys=null,Lt=0,vs=null,li=null,Ir=0,Cf=0,Of=null,Py=null,wo=0,jf=null;function jn(){return(Ye&2)!==0&&Ue!==0?Ue&-Ue:P.T!==null?Pf():Qu()}function Uy(){if(On===0)if((Ue&536870912)===0||Ie){var r=Tr;Tr<<=1,(Tr&3932160)===0&&(Tr=262144),On=r}else On=536870912;return r=An.current,r!==null&&(r.flags|=32),On}function _n(r,s,i){(r===nt&&(We===2||We===9)||r.cancelPendingCommit!==null)&&(ci(r,0),bs(r,Ue,On,!1)),mt(r,i),((Ye&2)===0||r!==nt)&&(r===nt&&((Ye&2)===0&&(ca|=i),bt===4&&bs(r,Ue,On,!1)),mr(r))}function $y(r,s,i){if((Ye&6)!==0)throw Error(a(327));var c=!i&&(s&127)===0&&(s&r.expiredLanes)===0||dt(r,s),f=c?p1(r,s):Mf(r,s,!0),g=c;do{if(f===0){ii&&!c&&bs(r,s,0,!1);break}else{if(i=r.current.alternate,g&&!f1(i)){f=Mf(r,s,!1),g=!1;continue}if(f===2){if(g=s,r.errorRecoveryDisabledLanes&g)var w=0;else w=r.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){s=w;e:{var A=r;f=_o;var M=A.current.memoizedState.isDehydrated;if(M&&(ci(A,w).flags|=256),w=Mf(A,w,!1),w!==2){if(Rf&&!M){A.errorRecoveryDisabledLanes|=g,ca|=g,f=4;break e}g=bn,bn=f,g!==null&&(bn===null?bn=g:bn.push.apply(bn,g))}f=w}if(g=!1,f!==2)continue}}if(f===1){ci(r,0),bs(r,s,0,!0);break}e:{switch(c=r,g=f,g){case 0:case 1:throw Error(a(345));case 4:if((s&4194048)!==s)break;case 6:bs(c,s,On,!ms);break e;case 2:bn=null;break;case 3:case 5:break;default:throw Error(a(329))}if((s&62914560)===s&&(f=hc+300-Rt(),10<f)){if(bs(c,s,On,!ms),Ae(c,0,!0)!==0)break e;Ir=s,c.timeoutHandle=gv(By.bind(null,c,i,bn,mc,kf,s,On,ca,oi,ms,g,"Throttled",-0,0),f);break e}By(c,i,bn,mc,kf,s,On,ca,oi,ms,g,null,-0,0)}}break}while(!0);mr(r)}function By(r,s,i,c,f,g,w,A,M,F,J,te,G,K){if(r.timeoutHandle=-1,te=s.subtreeFlags,te&8192||(te&16785408)===16785408){te={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Rr},Dy(s,g,te);var de=(g&62914560)===g?hc-Rt():(g&4194048)===g?zy-Rt():0;if(de=Q1(te,de),de!==null){Ir=g,r.cancelPendingCommit=de(Ky.bind(null,r,s,g,i,c,f,w,A,M,J,te,null,G,K)),bs(r,g,w,!F);return}}Ky(r,s,g,i,c,f,w,A,M)}function f1(r){for(var s=r;;){var i=s.tag;if((i===0||i===11||i===15)&&s.flags&16384&&(i=s.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var c=0;c<i.length;c++){var f=i[c],g=f.getSnapshot;f=f.value;try{if(!En(g(),f))return!1}catch{return!1}}if(i=s.child,s.subtreeFlags&16384&&i!==null)i.return=s,s=i;else{if(s===r)break;for(;s.sibling===null;){if(s.return===null||s.return===r)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function bs(r,s,i,c){s&=~Af,s&=~ca,r.suspendedLanes|=s,r.pingedLanes&=~s,c&&(r.warmLanes|=s),c=r.expirationTimes;for(var f=s;0<f;){var g=31-I(f),w=1<<g;c[g]=-1,f&=~w}i!==0&&Vs(r,i,s)}function gc(){return(Ye&6)===0?(So(0),!1):!0}function Df(){if(ze!==null){if(We===0)var r=ze.return;else r=ze,Or=ea=null,Yd(r),Za=null,ro=0,r=ze;for(;r!==null;)yy(r.alternate,r),r=r.return;ze=null}}function ci(r,s){var i=r.timeoutHandle;i!==-1&&(r.timeoutHandle=-1,D1(i)),i=r.cancelPendingCommit,i!==null&&(r.cancelPendingCommit=null,i()),Ir=0,Df(),nt=r,ze=i=kr(r.current,null),Ue=s,We=0,Cn=null,ms=!1,ii=dt(r,s),Rf=!1,oi=On=Af=ca=gs=bt=0,bn=_o=null,kf=!1,(s&8)!==0&&(s|=s&32);var c=r.entangledLanes;if(c!==0)for(r=r.entanglements,c&=s;0<c;){var f=31-I(c),g=1<<f;s|=r[f],c&=~g}return Br=s,Pl(),i}function Iy(r,s){je=null,P.H=fo,s===Ja||s===Gl?(s=rg(),We=3):s===Ld?(s=rg(),We=4):We=s===uf?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,Cn=s,ze===null&&(bt=1,ac(r,In(s,r.current)))}function Hy(){var r=An.current;return r===null?!0:(Ue&4194048)===Ue?Gn===null:(Ue&62914560)===Ue||(Ue&536870912)!==0?r===Gn:!1}function qy(){var r=P.H;return P.H=fo,r===null?fo:r}function Fy(){var r=P.A;return P.A=u1,r}function yc(){bt=4,ms||(Ue&4194048)!==Ue&&An.current!==null||(ii=!0),(gs&134217727)===0&&(ca&134217727)===0||nt===null||bs(nt,Ue,On,!1)}function Mf(r,s,i){var c=Ye;Ye|=2;var f=qy(),g=Fy();(nt!==r||Ue!==s)&&(mc=null,ci(r,s)),s=!1;var w=bt;e:do try{if(We!==0&&ze!==null){var A=ze,M=Cn;switch(We){case 8:Df(),w=6;break e;case 3:case 2:case 9:case 6:An.current===null&&(s=!0);var F=We;if(We=0,Cn=null,ui(r,A,M,F),i&&ii){w=0;break e}break;default:F=We,We=0,Cn=null,ui(r,A,M,F)}}h1(),w=bt;break}catch(J){Iy(r,J)}while(!0);return s&&r.shellSuspendCounter++,Or=ea=null,Ye=c,P.H=f,P.A=g,ze===null&&(nt=null,Ue=0,Pl()),w}function h1(){for(;ze!==null;)Gy(ze)}function p1(r,s){var i=Ye;Ye|=2;var c=qy(),f=Fy();nt!==r||Ue!==s?(mc=null,pc=Rt()+500,ci(r,s)):ii=dt(r,s);e:do try{if(We!==0&&ze!==null){s=ze;var g=Cn;t:switch(We){case 1:We=0,Cn=null,ui(r,s,g,1);break;case 2:case 9:if(tg(g)){We=0,Cn=null,Vy(s);break}s=function(){We!==2&&We!==9||nt!==r||(We=7),mr(r)},g.then(s,s);break e;case 3:We=7;break e;case 4:We=5;break e;case 7:tg(g)?(We=0,Cn=null,Vy(s)):(We=0,Cn=null,ui(r,s,g,7));break;case 5:var w=null;switch(ze.tag){case 26:w=ze.memoizedState;case 5:case 27:var A=ze;if(w?jv(w):A.stateNode.complete){We=0,Cn=null;var M=A.sibling;if(M!==null)ze=M;else{var F=A.return;F!==null?(ze=F,vc(F)):ze=null}break t}}We=0,Cn=null,ui(r,s,g,5);break;case 6:We=0,Cn=null,ui(r,s,g,6);break;case 8:Df(),bt=6;break e;default:throw Error(a(462))}}m1();break}catch(J){Iy(r,J)}while(!0);return Or=ea=null,P.H=c,P.A=f,Ye=i,ze!==null?0:(nt=null,Ue=0,Pl(),bt)}function m1(){for(;ze!==null&&!yt();)Gy(ze)}function Gy(r){var s=my(r.alternate,r,Br);r.memoizedProps=r.pendingProps,s===null?vc(r):ze=s}function Vy(r){var s=r,i=s.alternate;switch(s.tag){case 15:case 0:s=cy(i,s,s.pendingProps,s.type,void 0,Ue);break;case 11:s=cy(i,s,s.pendingProps,s.type.render,s.ref,Ue);break;case 5:Yd(s);default:yy(i,s),s=ze=Fm(s,Br),s=my(i,s,Br)}r.memoizedProps=r.pendingProps,s===null?vc(r):ze=s}function ui(r,s,i,c){Or=ea=null,Yd(s),Za=null,ro=0;var f=s.return;try{if(r1(r,f,s,i,Ue)){bt=1,ac(r,In(i,r.current)),ze=null;return}}catch(g){if(f!==null)throw ze=f,g;bt=1,ac(r,In(i,r.current)),ze=null;return}s.flags&32768?(Ie||c===1?r=!0:ii||(Ue&536870912)!==0?r=!1:(ms=r=!0,(c===2||c===9||c===3||c===6)&&(c=An.current,c!==null&&c.tag===13&&(c.flags|=16384))),Yy(s,r)):vc(s)}function vc(r){var s=r;do{if((s.flags&32768)!==0){Yy(s,ms);return}r=s.return;var i=i1(s.alternate,s,Br);if(i!==null){ze=i;return}if(s=s.sibling,s!==null){ze=s;return}ze=s=r}while(s!==null);bt===0&&(bt=5)}function Yy(r,s){do{var i=o1(r.alternate,r);if(i!==null){i.flags&=32767,ze=i;return}if(i=r.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!s&&(r=r.sibling,r!==null)){ze=r;return}ze=r=i}while(r!==null);bt=6,ze=null}function Ky(r,s,i,c,f,g,w,A,M){r.cancelPendingCommit=null;do bc();while(Lt!==0);if((Ye&6)!==0)throw Error(a(327));if(s!==null){if(s===r.current)throw Error(a(177));if(g=s.lanes|s.childLanes,g|=_d,dn(r,i,g,w,A,M),r===nt&&(ze=nt=null,Ue=0),li=s,vs=r,Ir=i,Cf=g,Of=f,Py=c,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,b1(Ln,function(){return Zy(),null})):(r.callbackNode=null,r.callbackPriority=0),c=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||c){c=P.T,P.T=null,f=ne.p,ne.p=2,w=Ye,Ye|=4;try{l1(r,s,i)}finally{Ye=w,ne.p=f,P.T=c}}Lt=1,Wy(),Qy(),Xy()}}function Wy(){if(Lt===1){Lt=0;var r=vs,s=li,i=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||i){i=P.T,P.T=null;var c=ne.p;ne.p=2;var f=Ye;Ye|=4;try{Cy(s,r);var g=Gf,w=Lm(r.containerInfo),A=g.focusedElem,M=g.selectionRange;if(w!==A&&A&&A.ownerDocument&&Nm(A.ownerDocument.documentElement,A)){if(M!==null&&md(A)){var F=M.start,J=M.end;if(J===void 0&&(J=F),"selectionStart"in A)A.selectionStart=F,A.selectionEnd=Math.min(J,A.value.length);else{var te=A.ownerDocument||document,G=te&&te.defaultView||window;if(G.getSelection){var K=G.getSelection(),de=A.textContent.length,_e=Math.min(M.start,de),et=M.end===void 0?_e:Math.min(M.end,de);!K.extend&&_e>et&&(w=et,et=_e,_e=w);var $=Mm(A,_e),z=Mm(A,et);if($&&z&&(K.rangeCount!==1||K.anchorNode!==$.node||K.anchorOffset!==$.offset||K.focusNode!==z.node||K.focusOffset!==z.offset)){var q=te.createRange();q.setStart($.node,$.offset),K.removeAllRanges(),_e>et?(K.addRange(q),K.extend(z.node,z.offset)):(q.setEnd(z.node,z.offset),K.addRange(q))}}}}for(te=[],K=A;K=K.parentNode;)K.nodeType===1&&te.push({element:K,left:K.scrollLeft,top:K.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<te.length;A++){var ee=te[A];ee.element.scrollLeft=ee.left,ee.element.scrollTop=ee.top}}jc=!!Ff,Gf=Ff=null}finally{Ye=f,ne.p=c,P.T=i}}r.current=s,Lt=2}}function Qy(){if(Lt===2){Lt=0;var r=vs,s=li,i=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||i){i=P.T,P.T=null;var c=ne.p;ne.p=2;var f=Ye;Ye|=4;try{Ty(r,s.alternate,s)}finally{Ye=f,ne.p=c,P.T=i}}Lt=3}}function Xy(){if(Lt===4||Lt===3){Lt=0,St();var r=vs,s=li,i=Ir,c=Py;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?Lt=5:(Lt=0,li=vs=null,Jy(r,r.pendingLanes));var f=r.pendingLanes;if(f===0&&(ys=null),Jn(i),s=s.stateNode,$t&&typeof $t.onCommitFiberRoot=="function")try{$t.onCommitFiberRoot(Pn,s,void 0,(s.current.flags&128)===128)}catch{}if(c!==null){s=P.T,f=ne.p,ne.p=2,P.T=null;try{for(var g=r.onRecoverableError,w=0;w<c.length;w++){var A=c[w];g(A.value,{componentStack:A.stack})}}finally{P.T=s,ne.p=f}}(Ir&3)!==0&&bc(),mr(r),f=r.pendingLanes,(i&261930)!==0&&(f&42)!==0?r===jf?wo++:(wo=0,jf=r):wo=0,So(0)}}function Jy(r,s){(r.pooledCacheLanes&=s)===0&&(s=r.pooledCache,s!=null&&(r.pooledCache=null,to(s)))}function bc(){return Wy(),Qy(),Xy(),Zy()}function Zy(){if(Lt!==5)return!1;var r=vs,s=Cf;Cf=0;var i=Jn(Ir),c=P.T,f=ne.p;try{ne.p=32>i?32:i,P.T=null,i=Of,Of=null;var g=vs,w=Ir;if(Lt=0,li=vs=null,Ir=0,(Ye&6)!==0)throw Error(a(331));var A=Ye;if(Ye|=4,Ny(g.current),jy(g,g.current,w,i),Ye=A,So(0,!1),$t&&typeof $t.onPostCommitFiberRoot=="function")try{$t.onPostCommitFiberRoot(Pn,g)}catch{}return!0}finally{ne.p=f,P.T=c,Jy(r,s)}}function ev(r,s,i){s=In(i,s),s=cf(r.stateNode,s,2),r=ds(r,s,2),r!==null&&(mt(r,2),mr(r))}function Qe(r,s,i){if(r.tag===3)ev(r,r,i);else for(;s!==null;){if(s.tag===3){ev(s,r,i);break}else if(s.tag===1){var c=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(ys===null||!ys.has(c))){r=In(i,r),i=ty(2),c=ds(s,i,2),c!==null&&(ny(i,c,s,r),mt(c,2),mr(c));break}}s=s.return}}function Nf(r,s,i){var c=r.pingCache;if(c===null){c=r.pingCache=new d1;var f=new Set;c.set(s,f)}else f=c.get(s),f===void 0&&(f=new Set,c.set(s,f));f.has(i)||(Rf=!0,f.add(i),r=g1.bind(null,r,s,i),s.then(r,r))}function g1(r,s,i){var c=r.pingCache;c!==null&&c.delete(s),r.pingedLanes|=r.suspendedLanes&i,r.warmLanes&=~i,nt===r&&(Ue&i)===i&&(bt===4||bt===3&&(Ue&62914560)===Ue&&300>Rt()-hc?(Ye&2)===0&&ci(r,0):Af|=i,oi===Ue&&(oi=0)),mr(r)}function tv(r,s){s===0&&(s=tn()),r=Xs(r,s),r!==null&&(mt(r,s),mr(r))}function y1(r){var s=r.memoizedState,i=0;s!==null&&(i=s.retryLane),tv(r,i)}function v1(r,s){var i=0;switch(r.tag){case 31:case 13:var c=r.stateNode,f=r.memoizedState;f!==null&&(i=f.retryLane);break;case 19:c=r.stateNode;break;case 22:c=r.stateNode._retryCache;break;default:throw Error(a(314))}c!==null&&c.delete(s),tv(r,i)}function b1(r,s){return en(r,s)}var _c=null,di=null,Lf=!1,wc=!1,zf=!1,_s=0;function mr(r){r!==di&&r.next===null&&(di===null?_c=di=r:di=di.next=r),wc=!0,Lf||(Lf=!0,w1())}function So(r,s){if(!zf&&wc){zf=!0;do for(var i=!1,c=_c;c!==null;){if(r!==0){var f=c.pendingLanes;if(f===0)var g=0;else{var w=c.suspendedLanes,A=c.pingedLanes;g=(1<<31-I(42|r)+1)-1,g&=f&~(w&~A),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(i=!0,av(c,g))}else g=Ue,g=Ae(c,c===nt?g:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(g&3)===0||dt(c,g)||(i=!0,av(c,g));c=c.next}while(i);zf=!1}}function _1(){nv()}function nv(){wc=Lf=!1;var r=0;_s!==0&&j1()&&(r=_s);for(var s=Rt(),i=null,c=_c;c!==null;){var f=c.next,g=rv(c,s);g===0?(c.next=null,i===null?_c=f:i.next=f,f===null&&(di=i)):(i=c,(r!==0||(g&3)!==0)&&(wc=!0)),c=f}Lt!==0&&Lt!==5||So(r),_s!==0&&(_s=0)}function rv(r,s){for(var i=r.suspendedLanes,c=r.pingedLanes,f=r.expirationTimes,g=r.pendingLanes&-62914561;0<g;){var w=31-I(g),A=1<<w,M=f[w];M===-1?((A&i)===0||(A&c)!==0)&&(f[w]=Bt(A,s)):M<=s&&(r.expiredLanes|=A),g&=~A}if(s=nt,i=Ue,i=Ae(r,r===s?i:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),c=r.callbackNode,i===0||r===s&&(We===2||We===9)||r.cancelPendingCommit!==null)return c!==null&&c!==null&&ur(c),r.callbackNode=null,r.callbackPriority=0;if((i&3)===0||dt(r,i)){if(s=i&-i,s===r.callbackPriority)return s;switch(c!==null&&ur(c),Jn(i)){case 2:case 8:i=Ut;break;case 32:i=Ln;break;case 268435456:i=zn;break;default:i=Ln}return c=sv.bind(null,r),i=en(i,c),r.callbackPriority=s,r.callbackNode=i,s}return c!==null&&c!==null&&ur(c),r.callbackPriority=2,r.callbackNode=null,2}function sv(r,s){if(Lt!==0&&Lt!==5)return r.callbackNode=null,r.callbackPriority=0,null;var i=r.callbackNode;if(bc()&&r.callbackNode!==i)return null;var c=Ue;return c=Ae(r,r===nt?c:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),c===0?null:($y(r,c,s),rv(r,Rt()),r.callbackNode!=null&&r.callbackNode===i?sv.bind(null,r):null)}function av(r,s){if(bc())return null;$y(r,s,!0)}function w1(){M1(function(){(Ye&6)!==0?en(ut,_1):nv()})}function Pf(){if(_s===0){var r=Qa;r===0&&(r=Nt,Nt<<=1,(Nt&261888)===0&&(Nt=256)),_s=r}return _s}function iv(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Cl(""+r)}function ov(r,s){var i=s.ownerDocument.createElement("input");return i.name=s.name,i.value=s.value,r.id&&i.setAttribute("form",r.id),s.parentNode.insertBefore(i,s),r=new FormData(r),i.parentNode.removeChild(i),r}function S1(r,s,i,c,f){if(s==="submit"&&i&&i.stateNode===f){var g=iv((f[pn]||null).action),w=c.submitter;w&&(s=(s=w[pn]||null)?iv(s.formAction):w.getAttribute("formAction"),s!==null&&(g=s,w=null));var A=new Ml("action","action",null,c,f);r.push({event:A,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(_s!==0){var M=w?ov(f,w):new FormData(f);nf(i,{pending:!0,data:M,method:f.method,action:g},null,M)}}else typeof g=="function"&&(A.preventDefault(),M=w?ov(f,w):new FormData(f),nf(i,{pending:!0,data:M,method:f.method,action:g},g,M))},currentTarget:f}]})}}for(var Uf=0;Uf<bd.length;Uf++){var $f=bd[Uf],x1=$f.toLowerCase(),T1=$f[0].toUpperCase()+$f.slice(1);Zn(x1,"on"+T1)}Zn(Um,"onAnimationEnd"),Zn($m,"onAnimationIteration"),Zn(Bm,"onAnimationStart"),Zn("dblclick","onDoubleClick"),Zn("focusin","onFocus"),Zn("focusout","onBlur"),Zn(Bx,"onTransitionRun"),Zn(Ix,"onTransitionStart"),Zn(Hx,"onTransitionCancel"),Zn(Im,"onTransitionEnd"),za("onMouseEnter",["mouseout","mouseover"]),za("onMouseLeave",["mouseout","mouseover"]),za("onPointerEnter",["pointerout","pointerover"]),za("onPointerLeave",["pointerout","pointerover"]),Ys("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ys("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ys("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ys("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ys("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ys("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var xo="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(" "),E1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(xo));function lv(r,s){s=(s&4)!==0;for(var i=0;i<r.length;i++){var c=r[i],f=c.event;c=c.listeners;e:{var g=void 0;if(s)for(var w=c.length-1;0<=w;w--){var A=c[w],M=A.instance,F=A.currentTarget;if(A=A.listener,M!==g&&f.isPropagationStopped())break e;g=A,f.currentTarget=F;try{g(f)}catch(J){zl(J)}f.currentTarget=null,g=M}else for(w=0;w<c.length;w++){if(A=c[w],M=A.instance,F=A.currentTarget,A=A.listener,M!==g&&f.isPropagationStopped())break e;g=A,f.currentTarget=F;try{g(f)}catch(J){zl(J)}f.currentTarget=null,g=M}}}}function Pe(r,s){var i=s[Xu];i===void 0&&(i=s[Xu]=new Set);var c=r+"__bubble";i.has(c)||(cv(s,r,2,!1),i.add(c))}function Bf(r,s,i){var c=0;s&&(c|=4),cv(i,r,c,s)}var Sc="_reactListening"+Math.random().toString(36).slice(2);function If(r){if(!r[Sc]){r[Sc]=!0,nm.forEach(function(i){i!=="selectionchange"&&(E1.has(i)||Bf(i,!1,r),Bf(i,!0,r))});var s=r.nodeType===9?r:r.ownerDocument;s===null||s[Sc]||(s[Sc]=!0,Bf("selectionchange",!1,s))}}function cv(r,s,i,c){switch(Uv(s)){case 2:var f=Z1;break;case 8:f=eT;break;default:f=nh}i=f.bind(null,s,i,r),f=void 0,!id||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(f=!0),c?f!==void 0?r.addEventListener(s,i,{capture:!0,passive:f}):r.addEventListener(s,i,!0):f!==void 0?r.addEventListener(s,i,{passive:f}):r.addEventListener(s,i,!1)}function Hf(r,s,i,c,f){var g=c;if((s&1)===0&&(s&2)===0&&c!==null)e:for(;;){if(c===null)return;var w=c.tag;if(w===3||w===4){var A=c.stateNode.containerInfo;if(A===f)break;if(w===4)for(w=c.return;w!==null;){var M=w.tag;if((M===3||M===4)&&w.stateNode.containerInfo===f)return;w=w.return}for(;A!==null;){if(w=Ma(A),w===null)return;if(M=w.tag,M===5||M===6||M===26||M===27){c=g=w;continue e}A=A.parentNode}}c=c.return}pm(function(){var F=g,J=sd(i),te=[];e:{var G=Hm.get(r);if(G!==void 0){var K=Ml,de=r;switch(r){case"keypress":if(jl(i)===0)break e;case"keydown":case"keyup":K=vx;break;case"focusin":de="focus",K=ud;break;case"focusout":de="blur",K=ud;break;case"beforeblur":case"afterblur":K=ud;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":K=ym;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":K=ix;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":K=wx;break;case Um:case $m:case Bm:K=cx;break;case Im:K=xx;break;case"scroll":case"scrollend":K=sx;break;case"wheel":K=Ex;break;case"copy":case"cut":case"paste":K=dx;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":K=bm;break;case"toggle":case"beforetoggle":K=Ax}var _e=(s&4)!==0,et=!_e&&(r==="scroll"||r==="scrollend"),$=_e?G!==null?G+"Capture":null:G;_e=[];for(var z=F,q;z!==null;){var ee=z;if(q=ee.stateNode,ee=ee.tag,ee!==5&&ee!==26&&ee!==27||q===null||$===null||(ee=Fi(z,$),ee!=null&&_e.push(To(z,ee,q))),et)break;z=z.return}0<_e.length&&(G=new K(G,de,null,i,J),te.push({event:G,listeners:_e}))}}if((s&7)===0){e:{if(G=r==="mouseover"||r==="pointerover",K=r==="mouseout"||r==="pointerout",G&&i!==rd&&(de=i.relatedTarget||i.fromElement)&&(Ma(de)||de[Da]))break e;if((K||G)&&(G=J.window===J?J:(G=J.ownerDocument)?G.defaultView||G.parentWindow:window,K?(de=i.relatedTarget||i.toElement,K=F,de=de?Ma(de):null,de!==null&&(et=l(de),_e=de.tag,de!==et||_e!==5&&_e!==27&&_e!==6)&&(de=null)):(K=null,de=F),K!==de)){if(_e=ym,ee="onMouseLeave",$="onMouseEnter",z="mouse",(r==="pointerout"||r==="pointerover")&&(_e=bm,ee="onPointerLeave",$="onPointerEnter",z="pointer"),et=K==null?G:qi(K),q=de==null?G:qi(de),G=new _e(ee,z+"leave",K,i,J),G.target=et,G.relatedTarget=q,ee=null,Ma(J)===F&&(_e=new _e($,z+"enter",de,i,J),_e.target=q,_e.relatedTarget=et,ee=_e),et=ee,K&&de)t:{for(_e=R1,$=K,z=de,q=0,ee=$;ee;ee=_e(ee))q++;ee=0;for(var ge=z;ge;ge=_e(ge))ee++;for(;0<q-ee;)$=_e($),q--;for(;0<ee-q;)z=_e(z),ee--;for(;q--;){if($===z||z!==null&&$===z.alternate){_e=$;break t}$=_e($),z=_e(z)}_e=null}else _e=null;K!==null&&uv(te,G,K,_e,!1),de!==null&&et!==null&&uv(te,et,de,_e,!0)}}e:{if(G=F?qi(F):window,K=G.nodeName&&G.nodeName.toLowerCase(),K==="select"||K==="input"&&G.type==="file")var qe=Am;else if(Em(G))if(km)qe=Px;else{qe=Lx;var pe=Nx}else K=G.nodeName,!K||K.toLowerCase()!=="input"||G.type!=="checkbox"&&G.type!=="radio"?F&&nd(F.elementType)&&(qe=Am):qe=zx;if(qe&&(qe=qe(r,F))){Rm(te,qe,i,J);break e}pe&&pe(r,G,F),r==="focusout"&&F&&G.type==="number"&&F.memoizedProps.value!=null&&td(G,"number",G.value)}switch(pe=F?qi(F):window,r){case"focusin":(Em(pe)||pe.contentEditable==="true")&&(Ha=pe,gd=F,Ji=null);break;case"focusout":Ji=gd=Ha=null;break;case"mousedown":yd=!0;break;case"contextmenu":case"mouseup":case"dragend":yd=!1,zm(te,i,J);break;case"selectionchange":if($x)break;case"keydown":case"keyup":zm(te,i,J)}var De;if(fd)e:{switch(r){case"compositionstart":var $e="onCompositionStart";break e;case"compositionend":$e="onCompositionEnd";break e;case"compositionupdate":$e="onCompositionUpdate";break e}$e=void 0}else Ia?xm(r,i)&&($e="onCompositionEnd"):r==="keydown"&&i.keyCode===229&&($e="onCompositionStart");$e&&(_m&&i.locale!=="ko"&&(Ia||$e!=="onCompositionStart"?$e==="onCompositionEnd"&&Ia&&(De=mm()):(ss=J,od="value"in ss?ss.value:ss.textContent,Ia=!0)),pe=xc(F,$e),0<pe.length&&($e=new vm($e,r,null,i,J),te.push({event:$e,listeners:pe}),De?$e.data=De:(De=Tm(i),De!==null&&($e.data=De)))),(De=Cx?Ox(r,i):jx(r,i))&&($e=xc(F,"onBeforeInput"),0<$e.length&&(pe=new vm("onBeforeInput","beforeinput",null,i,J),te.push({event:pe,listeners:$e}),pe.data=De)),S1(te,r,F,i,J)}lv(te,s)})}function To(r,s,i){return{instance:r,listener:s,currentTarget:i}}function xc(r,s){for(var i=s+"Capture",c=[];r!==null;){var f=r,g=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||g===null||(f=Fi(r,i),f!=null&&c.unshift(To(r,f,g)),f=Fi(r,s),f!=null&&c.push(To(r,f,g))),r.tag===3)return c;r=r.return}return[]}function R1(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function uv(r,s,i,c,f){for(var g=s._reactName,w=[];i!==null&&i!==c;){var A=i,M=A.alternate,F=A.stateNode;if(A=A.tag,M!==null&&M===c)break;A!==5&&A!==26&&A!==27||F===null||(M=F,f?(F=Fi(i,g),F!=null&&w.unshift(To(i,F,M))):f||(F=Fi(i,g),F!=null&&w.push(To(i,F,M)))),i=i.return}w.length!==0&&r.push({event:s,listeners:w})}var A1=/\r\n?/g,k1=/\u0000|\uFFFD/g;function dv(r){return(typeof r=="string"?r:""+r).replace(A1,`
10`).replace(k1,"")}function fv(r,s){return s=dv(s),dv(r)===s}function Ze(r,s,i,c,f,g){switch(i){case"children":typeof c=="string"?s==="body"||s==="textarea"&&c===""||Ua(r,c):(typeof c=="number"||typeof c=="bigint")&&s!=="body"&&Ua(r,""+c);break;case"className":Al(r,"class",c);break;case"tabIndex":Al(r,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":Al(r,i,c);break;case"style":fm(r,c,g);break;case"data":if(s!=="object"){Al(r,"data",c);break}case"src":case"href":if(c===""&&(s!=="a"||i!=="href")){r.removeAttribute(i);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){r.removeAttribute(i);break}c=Cl(""+c),r.setAttribute(i,c);break;case"action":case"formAction":if(typeof c=="function"){r.setAttribute(i,"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 g=="function"&&(i==="formAction"?(s!=="input"&&Ze(r,s,"name",f.name,f,null),Ze(r,s,"formEncType",f.formEncType,f,null),Ze(r,s,"formMethod",f.formMethod,f,null),Ze(r,s,"formTarget",f.formTarget,f,null)):(Ze(r,s,"encType",f.encType,f,null),Ze(r,s,"method",f.method,f,null),Ze(r,s,"target",f.target,f,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){r.removeAttribute(i);break}c=Cl(""+c),r.setAttribute(i,c);break;case"onClick":c!=null&&(r.onclick=Rr);break;case"onScroll":c!=null&&Pe("scroll",r);break;case"onScrollEnd":c!=null&&Pe("scrollend",r);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(a(61));if(i=c.__html,i!=null){if(f.children!=null)throw Error(a(60));r.innerHTML=i}}break;case"multiple":r.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":r.muted=c&&typeof c!="function"&&typeof c!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(c==null||typeof c=="function"||typeof c=="boolean"||typeof c=="symbol"){r.removeAttribute("xlink:href");break}i=Cl(""+c),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":c!=null&&typeof c!="function"&&typeof c!="symbol"?r.setAttribute(i,""+c):r.removeAttribute(i);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"playsInl
10ine":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":c&&typeof c!="function"&&typeof c!="symbol"?r.setAttribute(i,""):r.removeAttribute(i);break;case"capture":case"download":c===!0?r.setAttribute(i,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?r.setAttribute(i,c):r.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?r.setAttribute(i,c):r.removeAttribute(i);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?r.removeAttribute(i):r.setAttribute(i,c);break;case"popover":Pe("beforetoggle",r),Pe("toggle",r),Rl(r,"popover",c);break;case"xlinkActuate":Er(r,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":Er(r,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":Er(r,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":Er(r,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":Er(r,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":Er(r,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":Er(r,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":Er(r,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":Er(r,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":Rl(r,"is",c);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=nx.get(i)||i,Rl(r,i,c))}}function qf(r,s,i,c,f,g){switch(i){case"style":fm(r,c,g);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(a(61));if(i=c.__html,i!=null){if(f.children!=null)throw Error(a(60));r.innerHTML=i}}break;case"children":typeof c=="string"?Ua(r,c):(typeof c=="number"||typeof c=="bigint")&&Ua(r,""+c);break;case"onScroll":c!=null&&Pe("scroll",r);break;case"onScrollEnd":c!=null&&Pe("scrollend",r);break;case"onClick":c!=null&&(r.onclick=Rr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!rm.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(f=i.endsWith("Capture"),s=i.slice(2,f?i.length-7:void 0),g=r[pn]||null,g=g!=null?g[i]:null,typeof g=="function"&&r.removeEventListener(s,g,f),typeof c=="function")){typeof g!="function"&&g!==null&&(i in r?r[i]=null:r.hasAttribute(i)&&r.removeAttribute(i)),r.addEventListener(s,c,f);break e}i in r?r[i]=c:c===!0?r.setAttribute(i,""):Rl(r,i,c)}}}function Qt(r,s,i){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Pe("error",r),Pe("load",r);var c=!1,f=!1,g;for(g in i)if(i.hasOwnProperty(g)){var w=i[g];if(w!=null)switch(g){case"src":c=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:Ze(r,s,g,w,i,null)}}f&&Ze(r,s,"srcSet",i.srcSet,i,null),c&&Ze(r,s,"src",i.src,i,null);return;case"input":Pe("invalid",r);var A=g=w=f=null,M=null,F=null;for(c in i)if(i.hasOwnProperty(c)){var J=i[c];if(J!=null)switch(c){case"name":f=J;break;case"type":w=J;break;case"checked":M=J;break;case"defaultChecked":F=J;break;case"value":g=J;break;case"defaultValue":A=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(a(137,s));break;default:Ze(r,s,c,J,i,null)}}lm(r,g,A,M,F,w,f,!1);return;case"select":Pe("invalid",r),c=w=g=null;for(f in i)if(i.hasOwnProperty(f)&&(A=i[f],A!=null))switch(f){case"value":g=A;break;case"defaultValue":w=A;break;case"multiple":c=A;default:Ze(r,s,f,A,i,null)}s=g,i=w,r.multiple=!!c,s!=null?Pa(r,!!c,s,!1):i!=null&&Pa(r,!!c,i,!0);return;case"textarea":Pe("invalid",r),g=f=c=null;for(w in i)if(i.hasOwnProperty(w)&&(A=i[w],A!=null))switch(w){case"value":c=A;break;case"defaultValue":f=A;break;case"children":g=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(a(91));break;default:Ze(r,s,w,A,i,null)}um(r,c,f,g);return;case"option":for(M in i)i.hasOwnProperty(M)&&(c=i[M],c!=null)&&(M==="selected"?r.selected=c&&typeof c!="function"&&typeof c!="symbol":Ze(r,s,M,c,i,null));return;case"dialog":Pe("beforetoggle",r),Pe("toggle",r),Pe("cancel",r),Pe("close",r);break;case"iframe":case"object":Pe("load",r);break;case"video":case"audio":for(c=0;c<xo.length;c++)Pe(xo[c],r);break;case"image":Pe("error",r),Pe("load",r);break;case"details":Pe("toggle",r);break;case"embed":case"source":case"link":Pe("error",r),Pe("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(F in i)if(i.hasOwnProperty(F)&&(c=i[F],c!=null))switch(F){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,s));default:Ze(r,s,F,c,i,null)}return;default:if(nd(s)){for(J in i)i.hasOwnProperty(J)&&(c=i[J],c!==void 0&&qf(r,s,J,c,i,void 0));return}}for(A in i)i.hasOwnProperty(A)&&(c=i[A],c!=null&&Ze(r,s,A,c,i,null))}function C1(r,s,i,c){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,g=null,w=null,A=null,M=null,F=null,J=null;for(K in i){var te=i[K];if(i.hasOwnProperty(K)&&te!=null)switch(K){case"checked":break;case"value":break;case"defaultValue":M=te;default:c.hasOwnProperty(K)||Ze(r,s,K,null,c,te)}}for(var G in c){var K=c[G];if(te=i[G],c.hasOwnProperty(G)&&(K!=null||te!=null))switch(G){case"type":g=K;break;case"name":f=K;break;case"checked":F=K;break;case"defaultChecked":J=K;break;case"value":w=K;break;case"defaultValue":A=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(a(137,s));break;default:K!==te&&Ze(r,s,G,K,c,te)}}ed(r,w,A,M,F,J,g,f);return;case"select":K=w=A=G=null;for(g in i)if(M=i[g],i.hasOwnProperty(g)&&M!=null)switch(g){case"value":break;case"multiple":K=M;default:c.hasOwnProperty(g)||Ze(r,s,g,null,c,M)}for(f in c)if(g=c[f],M=i[f],c.hasOwnProperty(f)&&(g!=null||M!=null))switch(f){case"value":G=g;break;case"defaultValue":A=g;break;case"multiple":w=g;default:g!==M&&Ze(r,s,f,g,c,M)}s=A,i=w,c=K,G!=null?Pa(r,!!i,G,!1):!!c!=!!i&&(s!=null?Pa(r,!!i,s,!0):Pa(r,!!i,i?[]:"",!1));return;case"textarea":K=G=null;for(A in i)if(f=i[A],i.hasOwnProperty(A)&&f!=null&&!c.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:Ze(r,s,A,null,c,f)}for(w in c)if(f=c[w],g=i[w],c.hasOwnProperty(w)&&(f!=null||g!=null))switch(w){case"value":G=f;break;case"defaultValue":K=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(a(91));break;default:f!==g&&Ze(r,s,w,f,c,g)}cm(r,G,K);return;case"option":for(var de in i)G=i[de],i.hasOwnProperty(de)&&G!=null&&!c.hasOwnProperty(de)&&(de==="selected"?r.selected=!1:Ze(r,s,de,null,c,G));for(M in c)G=c[M],K=i[M],c.hasOwnProperty(M)&&G!==K&&(G!=null||K!=null)&&(M==="selected"?r.selected=G&&typeof G!="function"&&typeof G!="symbol":Ze(r,s,M,G,c,K));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var _e in i)G=i[_e],i.hasOwnProperty(_e)&&G!=null&&!c.hasOwnProperty(_e)&&Ze(r,s,_e,null,c,G);for(F in c)if(G=c[F],K=i[F],c.hasOwnProperty(F)&&G!==K&&(G!=null||K!=null))switch(F){case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(a(137,s));break;default:Ze(r,s,F,G,c,K)}return;default:if(nd(s)){for(var et in i)G=i[et],i.hasOwnProperty(et)&&G!==void 0&&!c.hasOwnProperty(et)&&qf(r,s,et,void 0,c,G);for(J in c)G=c[J],K=i[J],!c.hasOwnProperty(J)||G===K||G===void 0&&K===void 0||qf(r,s,J,G,c,K);return}}
vendor: 20,440 bytes, line 10
10for(var $ in i)G=i[$],i.hasOwnProperty($)&&G!=null&&!c.hasOwnProperty($)&&Ze(r,s,$,null,c,G);for(te in c)G=c[te],K=i[te],!c.hasOwnProperty(te)||G===K||G==null&&K==null||Ze(r,s,te,G,c,K)}function hv(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function O1(){if(typeof performance.getEntriesByType=="function"){for(var r=0,s=0,i=performance.getEntriesByType("resource"),c=0;c<i.length;c++){var f=i[c],g=f.transferSize,w=f.initiatorType,A=f.duration;if(g&&A&&hv(w)){for(w=0,A=f.responseEnd,c+=1;c<i.length;c++){var M=i[c],F=M.startTime;if(F>A)break;var J=M.transferSize,te=M.initiatorType;J&&hv(te)&&(M=M.responseEnd,w+=J*(M<A?1:(A-F)/(M-F)))}if(--c,s+=8*(g+w)/(f.duration/1e3),r++,10<r)break}}if(0<r)return s/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var Ff=null,Gf=null;function Tc(r){return r.nodeType===9?r:r.ownerDocument}function pv(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function mv(r,s){if(r===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&s==="foreignObject"?0:r}function Vf(r,s){return r==="textarea"||r==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Yf=null;function j1(){var r=window.event;return r&&r.type==="popstate"?r===Yf?!1:(Yf=r,!0):(Yf=null,!1)}var gv=typeof setTimeout=="function"?setTimeout:void 0,D1=typeof clearTimeout=="function"?clearTimeout:void 0,yv=typeof Promise=="function"?Promise:void 0,M1=typeof queueMicrotask=="function"?queueMicrotask:typeof yv<"u"?function(r){return yv.resolve(null).then(r).catch(N1)}:gv;function N1(r){setTimeout(function(){throw r})}function ws(r){return r==="head"}function vv(r,s){var i=s,c=0;do{var f=i.nextSibling;if(r.removeChild(i),f&&f.nodeType===8)if(i=f.data,i==="/$"||i==="/&"){if(c===0){r.removeChild(f),mi(s);return}c--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")c++;else if(i==="html")Eo(r.ownerDocument.documentElement);else if(i==="head"){i=r.ownerDocument.head,Eo(i);for(var g=i.firstChild;g;){var w=g.nextSibling,A=g.nodeName;g[Hi]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&g.rel.toLowerCase()==="stylesheet"||i.removeChild(g),g=w}}else i==="body"&&Eo(r.ownerDocument.body);i=f}while(i);mi(s)}function bv(r,s){var i=r;r=0;do{var c=i.nextSibling;if(i.nodeType===1?s?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(s?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),c&&c.nodeType===8)if(i=c.data,i==="/$"){if(r===0)break;r--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||r++;i=c}while(i)}function Kf(r){var s=r.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var i=s;switch(s=s.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Kf(i),Ju(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}r.removeChild(i)}}function L1(r,s,i,c){for(;r.nodeType===1;){var f=i;if(r.nodeName.toLowerCase()!==s.toLowerCase()){if(!c&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(c){if(!r[Hi])switch(s){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(g=r.getAttribute("rel"),g==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(g!==f.rel||r.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||r.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||r.getAttribute("title")!==(f.title==null?null:f.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(g=r.getAttribute("src"),(g!==(f.src==null?null:f.src)||r.getAttribute("type")!==(f.type==null?null:f.type)||r.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&g&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(s==="input"&&r.type==="hidden"){var g=f.name==null?null:""+f.name;if(f.type==="hidden"&&r.getAttribute("name")===g)return r}else return r;if(r=Vn(r.nextSibling),r===null)break}return null}function z1(r,s,i){if(s==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!i||(r=Vn(r.nextSibling),r===null))return null;return r}function _v(r,s){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!s||(r=Vn(r.nextSibling),r===null))return null;return r}function Wf(r){return r.data==="$?"||r.data==="$~"}function Qf(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function P1(r,s){var i=r.ownerDocument;if(r.data==="$~")r._reactRetry=s;else if(r.data!=="$?"||i.readyState!=="loading")s();else{var c=function(){s(),i.removeEventListener("DOMContentLoaded",c)};i.addEventListener("DOMContentLoaded",c),r._reactRetry=c}}function Vn(r){for(;r!=null;r=r.nextSibling){var s=r.nodeType;if(s===1||s===3)break;if(s===8){if(s=r.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return r}var Xf=null;function wv(r){r=r.nextSibling;for(var s=0;r;){if(r.nodeType===8){var i=r.data;if(i==="/$"||i==="/&"){if(s===0)return Vn(r.nextSibling);s--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||s++}r=r.nextSibling}return null}function Sv(r){r=r.previousSibling;for(var s=0;r;){if(r.nodeType===8){var i=r.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(s===0)return r;s--}else i!=="/$"&&i!=="/&"||s++}r=r.previousSibling}return null}function xv(r,s,i){switch(s=Tc(i),r){case"html":if(r=s.documentElement,!r)throw Error(a(452));return r;case"head":if(r=s.head,!r)throw Error(a(453));return r;case"body":if(r=s.body,!r)throw Error(a(454));return r;default:throw Error(a(451))}}function Eo(r){for(var s=r.attributes;s.length;)r.removeAttributeNode(s[0]);Ju(r)}var Yn=new Map,Tv=new Set;function Ec(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var Hr=ne.d;ne.d={f:U1,r:$1,D:B1,C:I1,L:H1,m:q1,X:G1,S:F1,M:V1};function U1(){var r=Hr.f(),s=gc();return r||s}function $1(r){var s=Na(r);s!==null&&s.tag===5&&s.type==="form"?Ig(s):Hr.r(r)}var fi=typeof document>"u"?null:document;function Ev(r,s,i){var c=fi;if(c&&typeof s=="string"&&s){var f=$n(s);f='link[rel="'+r+'"][href="'+f+'"]',typeof i=="string"&&(f+='[crossorigin="'+i+'"]'),Tv.has(f)||(Tv.add(f),r={rel:r,crossOrigin:i,href:s},c.querySelector(f)===null&&(s=c.createElement("link"),Qt(s,"link",r),It(s),c.head.appendChild(s)))}}function B1(r){Hr.D(r),Ev("dns-prefetch",r,null)}function I1(r,s){Hr.C(r,s),Ev("preconnect",r,s)}function H1(r,s,i){Hr.L(r,s,i);var c=fi;if(c&&r&&s){var f='link[rel="preload"][as="'+$n(s)+'"]';s==="image"&&i&&i.imageSrcSet?(f+='[imagesrcset="'+$n(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(f+='[imagesizes="'+$n(i.imageSizes)+'"]')):f+='[href="'+$n(r)+'"]';var g=f;switch(s){case"style":g=hi(r);break;case"script":g=pi(r)}Yn.has(g)||(r=p({rel:"preload",href:s==="image"&&i&&i.imageSrcSet?void 0:r,as:s},i),Yn.set(g,r),c.querySelector(f)!==null||s==="style"&&c.querySelector(Ro(g))||s==="script"&&c.querySelector(Ao(g))||(s=c.createElement("link"),Qt(s,"link",r),It(s),c.head.appendChild(s)))}}function q1(r,s){Hr.m(r,s);var i=fi;if(i&&r){var c=s&&typeof s.as=="string"?s.as:"script",f='link[rel="modulepreload"][as="'+$n(c)+'"][href="'+$n(r)+'"]',g=f;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=pi(r)}if(!Yn.has(g)&&(r=p({rel:"modulepreload",href:r},s),Yn.set(g,r),i.querySelector(f)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Ao(g)))return}c=i.createElement("link"),Qt(c,"link",r),It(c),i.head.appendChild(c)}}}function F1(r,s,i){Hr.S(r,s,i);var c=fi;if(c&&r){var f=La(c).hoistableStyles,g=hi(r);s=s||"default";var w=f.get(g);if(!w){var A={loading:0,preload:null};if(w=c.querySelector(Ro(g)))A.loading=5;else{r=p({rel:"stylesheet",href:r,"data-precedence":s},i),(i=Yn.get(g))&&Jf(r,i);var M=w=c.createElement("link");It(M),Qt(M,"link",r),M._p=new Promise(function(F,J){M.onload=F,M.onerror=J}),M.addEventListener("load",function(){A.loading|=1}),M.addEventListener("error",function(){A.loading|=2}),A.loading|=4,Rc(w,s,c)}w={type:"stylesheet",instance:w,count:1,state:A},f.set(g,w)}}}function G1(r,s){Hr.X(r,s);var i=fi;if(i&&r){var c=La(i).hoistableScripts,f=pi(r),g=c.get(f);g||(g=i.querySelector(Ao(f)),g||(r=p({src:r,async:!0},s),(s=Yn.get(f))&&Zf(r,s),g=i.createElement("script"),It(g),Qt(g,"link",r),i.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},c.set(f,g))}}function V1(r,s){Hr.M(r,s);var i=fi;if(i&&r){var c=La(i).hoistableScripts,f=pi(r),g=c.get(f);g||(g=i.querySelector(Ao(f)),g||(r=p({src:r,async:!0,type:"module"},s),(s=Yn.get(f))&&Zf(r,s),g=i.createElement("script"),It(g),Qt(g,"link",r),i.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},c.set(f,g))}}function Rv(r,s,i,c){var f=(f=Q.current)?Ec(f):null;if(!f)throw Error(a(446));switch(r){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(s=hi(i.href),i=La(f).hoistableStyles,c=i.get(s),c||(c={type:"style",instance:null,count:0,state:null},i.set(s,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){r=hi(i.href);var g=La(f).hoistableStyles,w=g.get(r);if(w||(f=f.ownerDocument||f,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(r,w),(g=f.querySelector(Ro(r)))&&!g._p&&(w.instance=g,w.state.loading=5),Yn.has(r)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},Yn.set(r,i),g||Y1(f,r,i,w.state))),s&&c===null)throw Error(a(528,""));return w}if(s&&c!==null)throw Error(a(529,""));return null;case"script":return s=i.async,i=i.src,typeof i=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=pi(i),i=La(f).hoistableScripts,c=i.get(s),c||(c={type:"script",instance:null,count:0,state:null},i.set(s,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,r))}}function hi(r){return'href="'+$n(r)+'"'}function Ro(r){return'link[rel="stylesheet"]['+r+"]"}function Av(r){return p({},r,{"data-precedence":r.precedence,precedence:null})}function Y1(r,s,i,c){r.querySelector('link[rel="preload"][as="style"]['+s+"]")?c.loading=1:(s=r.createElement("link"),c.preload=s,s.addEventListener("load",function(){return c.loading|=1}),s.addEventListener("error",function(){return c.loading|=2}),Qt(s,"link",i),It(s),r.head.appendChild(s))}function pi(r){return'[src="'+$n(r)+'"]'}function Ao(r){return"script[async]"+r}function kv(r,s,i){if(s.count++,s.instance===null)switch(s.type){case"style":var c=r.querySelector('style[data-href~="'+$n(i.href)+'"]');if(c)return s.instance=c,It(c),c;var f=p({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return c=(r.ownerDocument||r).createElement("style"),It(c),Qt(c,"style",f),Rc(c,i.precedence,r),s.instance=c;case"stylesheet":f=hi(i.href);var g=r.querySelector(Ro(f));if(g)return s.state.loading|=4,s.instance=g,It(g),g;c=Av(i),(f=Yn.get(f))&&Jf(c,f),g=(r.ownerDocument||r).createElement("link"),It(g);var w=g;return w._p=new Promise(function(A,M){w.onload=A,w.onerror=M}),Qt(g,"link",c),s.state.loading|=4,Rc(g,i.precedence,r),s.instance=g;case"script":return g=pi(i.src),(f=r.querySelector(Ao(g)))?(s.instance=f,It(f),f):(c=i,(f=Yn.get(g))&&(c=p({},i),Zf(c,f)),r=r.ownerDocument||r,f=r.createElement("script"),It(f),Qt(f,"link",c),r.head.appendChild(f),s.instance=f);case"void":return null;default:throw Error(a(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(c=s.instance,s.state.loading|=4,Rc(c,i.precedence,r));return s.instance}function Rc(r,s,i){for(var c=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=c.length?c[c.length-1]:null,g=f,w=0;w<c.length;w++){var A=c[w];if(A.dataset.precedence===s)g=A;else if(g!==f)break}g?g.parentNode.insertBefore(r,g.nextSibling):(s=i.nodeType===9?i.head:i,s.insertBefore(r,s.firstChild))}function Jf(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.title==null&&(r.title=s.title)}function Zf(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.integrity==null&&(r.integrity=s.integrity)}var Ac=null;function Cv(r,s,i){if(Ac===null){var c=new Map,f=Ac=new Map;f.set(i,c)}else f=Ac,c=f.get(i),c||(c=new Map,f.set(i,c));if(c.has(r))return c;for(c.set(r,null),i=i.getElementsByTagName(r),f=0;f<i.length;f++){var g=i[f];if(!(g[Hi]||g[Vt]||r==="link"&&g.getAttribute("rel")==="stylesheet")&&g.namespaceURI!=="http://www.w3.org/2000/svg"){var w=g.getAttribute(s)||"";w=r+w;var A=c.get(w);A?A.push(g):c.set(w,[g])}}return c}function Ov(r,s,i){r=r.ownerDocument||r,r.head.insertBefore(i,s==="title"?r.querySelector("head > title"):null)}function K1(r,s,i){if(i===1||s.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;return s.rel==="stylesheet"?(r=s.disabled,typeof s.precedence=="string"&&r==null):!0;case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function jv(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function W1(r,s,i,c){if(i.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var f=hi(c.href),g=s.querySelector(Ro(f));if(g){s=g._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(r.count++,r=kc.bind(r),s.then(r,r)),i.state.loading|=4,i.instance=g,It(g);return}g=s.ownerDocument||s,c=Av(c),(f=Yn.get(f))&&Jf(c,f),g=g.createElement("link"),It(g);var w=g;w._p=new Promise(function(A,M){w.onload=A,w.onerror=M}),Qt(g,"link",c),i.instance=g}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(i,s),(s=i.state.preload)&&(i.state.loading&3)===0&&(r.count++,i=kc.bind(r),s.addEventListener("load",i),s.addEventListener("error",i))}}var eh=0;function Q1(r,s){return r.stylesheets&&r.count===0&&Oc(r,r.stylesheets),0<r.count||0<r.imgCount?function(i){var c=setTimeout(function(){if(r.stylesheets&&Oc(r,r.stylesheets),r.unsuspend){var g=r.unsuspend;r.unsuspend=null,g()}},6e4+s);0<r.imgBytes&&eh===0&&(eh=62500*O1());var f=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&Oc(r,r.stylesheets),r.unsuspend)){var g=r.unsuspend;r.unsuspend=null,g()}},(r.imgBytes>eh?50:800)+s);return r.unsuspend=i,function(){r.unsuspend=null,clearTimeout(c),clearTimeout(f)}}:null}function kc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Oc(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var Cc=null;function Oc(r,s){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Cc=new Map,s.forEach(X1,r),Cc=null,kc.call(r))}function X1(r,s){if(!(s.state.loading&4)){var i=Cc.get(r);if(i)var c=i.get(null);else{i=new Map,Cc.set(r,i);for(var f=r.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g<f.length;g++){var w=f[g];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(i.set(w.dataset.precedence,w),c=w)}c&&i.set(null,c)}f=s.instance,w=f.getAttribute("data-precedence"),g=i.get(w)||c,g===c&&i.set(null,f),i.set(w,f),this.count++,c=kc.bind(this),f.addEventListener("load",c),f.addEventListener("error",c),g?g.parentNode.insertBefore(f,g.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(f,r.firstChild)),s.state.loading|=4}}var ko={$$typeof:D,Provider:null,Consumer:null,_currentValue:oe,_currentValue2:oe,_threadCount:0};function J1(r,s,i,c,f,g,w,A,M){this.tag=1,this.containerInfo=r,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=ns(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ns(0),this.hiddenUpdates=ns(null),this.identifierPrefix=c,this.onUncaughtError=f,this.onCaughtError=g,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=M,this.incompleteTransitions=new Map}function Dv(r,s,i,c,f,g,w,A,M,F,J,te){return r=new J1(r,s,i,w,M,F,J,te,A),s=1,g===!0&&(s|=24),g=Rn(3,null,null,s),r.current=g,g.stateNode=r,s=Dd(),s.refCount++,r.pooledCache=s,s.refCount++,g.memoizedState={element:c,isDehydrated:i,cache:s},zd(g),r}function Mv(r){return r?(r=Ga,r):Ga}function Nv(r,s,i,c,f,g){f=Mv(f),c.context===null?c.context=f:c.pendingContext=f,c=us(s),c.payload={element:i},g=g===void 0?null:g,g!==null&&(c.callback=g),i=ds(r,c,s),i!==null&&(_n(i,r,s),ao(i,r,s))}function Lv(r,s){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var i=r.retryLane;r.retryLane=i!==0&&i<s?i:s}}function th(r,s){Lv(r,s),(r=r.alternate)&&Lv(r,s)}function zv(r){if(r.tag===13||r.tag===31){var s=Xs(r,67108864);s!==null&&_n(s,r,67108864),th(r,67108864)}}function Pv(r){if(r.tag===13||r.tag===31){var s=jn();s=ja(s);var i=Xs(r,s);i!==null&&_n(i,r,s),th(r,s)}}var jc=!0;function Z1(r,s,i,c){var f=P.T;P.T=null;var g=ne.p;try{ne.p=2,nh(r,s,i,c)}finally{ne.p=g,P.T=f}}function eT(r,s,i,c){var f=P.T;P.T=null;var g=ne.p;try{ne.p=8,nh(r,s,i,c)}finally{ne.p=g,P.T=f}}function nh(r,s,i,c){if(jc){var f=rh(c);if(f===null)Hf(r,s,c,Dc,i),$v(r,c);else if(nT(f,r,s,i,c))c.stopPropagation();else if($v(r,c),s&4&&-1<tT.indexOf(r)){for(;f!==null;){var g=Na(f);if(g!==null)switch(g.tag){case 3:if(g=g.stateNode,g.current.memoizedState.isDehydrated){var w=dr(g.pendingLanes);if(w!==0){var A=g;for(A.pendingLanes|=2,A.entangledLanes|=2;w;){var M=1<<31-I(w);A.entanglements[1]|=M,w&=~M}mr(g),(Ye&6)===0&&(pc=Rt()+500,So(0))}}break;case 31:case 13:A=Xs(g,2),A!==null&&_n(A,g,2),gc(),th(g,2)}if(g=rh(c),g===null&&Hf(r,s,c,Dc,i),g===f)break;f=g}f!==null&&c.stopPropagation()}else Hf(r,s,c,null,i)}}function rh(r){return r=sd(r),sh(r)}var Dc=null;function sh(r){if(Dc=null,r=Ma(r),r!==null){var s=l(r);if(s===null)r=null;else{var i=s.tag;if(i===13){if(r=u(s),r!==null)return r;r=null}else if(i===31){if(r=h(s),r!==null)return r;r=null}else if(i===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;r=null}else s!==r&&(r=null)}}return Dc=r,null}function Uv(r){switch(r){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(Be()){case ut:return 2;case Ut:return 8;case Ln:case ts:return 32;case zn:return 268435456;default:return 32}default:return 32}}var ah=!1,Ss=null,xs=null,Ts=null,Co=new Map,Oo=new Map,Es=[],tT="mou
10sedown 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 $v(r,s){switch(r){case"focusin":case"focusout":Ss=null;break;case"dragenter":case"dragleave":xs=null;break;case"mouseover":case"mouseout":Ts=null;break;case"pointerover":case"pointerout":Co.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Oo.delete(s.pointerId)}}function jo(r,s,i,c,f,g){return r===null||r.nativeEvent!==g?(r={blockedOn:s,domEventName:i,eventSystemFlags:c,nativeEvent:g,targetContainers:[f]},s!==null&&(s=Na(s),s!==null&&zv(s)),r):(r.eventSystemFlags|=c,s=r.targetContainers,f!==null&&s.indexOf(f)===-1&&s.push(f),r)}function nT(r,s,i,c,f){switch(s){case"focusin":return Ss=jo(Ss,r,s,i,c,f),!0;case"dragenter":return xs=jo(xs,r,s,i,c,f),!0;case"mouseover":return Ts=jo(Ts,r,s,i,c,f),!0;case"pointerover":var g=f.pointerId;return Co.set(g,jo(Co.get(g)||null,r,s,i,c,f)),!0;case"gotpointercapture":return g=f.pointerId,Oo.set(g,jo(Oo.get(g)||null,r,s,i,c,f)),!0}return!1}function Bv(r){var s=Ma(r.target);if(s!==null){var i=l(s);if(i!==null){if(s=i.tag,s===13){if(s=u(i),s!==null){r.blockedOn=s,em(r.priority,function(){Pv(i)});return}}else if(s===31){if(s=h(i),s!==null){r.blockedOn=s,em(r.priority,function(){Pv(i)});return}}else if(s===3&&i.stateNode.current.memoizedState.isDehydrated){r.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Mc(r){if(r.blockedOn!==null)return!1;for(var s=r.targetContainers;0<s.length;){var i=rh(r.nativeEvent);if(i===null){i=r.nativeEvent;var c=new i.constructor(i.type,i);rd=c,i.target.dispatchEvent(c),rd=null}else return s=Na(i),s!==null&&zv(s),r.blockedOn=i,!1;s.shift()}return!0}function Iv(r,s,i){Mc(r)&&i.delete(s)}function rT(){ah=!1,Ss!==null&&Mc(Ss)&&(Ss=null),xs!==null&&Mc(xs)&&(xs=null),Ts!==null&&Mc(Ts)&&(Ts=null),Co.forEach(Iv),Oo.forEach(Iv)}function Nc(r,s){r.blockedOn===s&&(r.blockedOn=null,ah||(ah=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,rT)))}var Lc=null;function Hv(r){Lc!==r&&(Lc=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Lc===r&&(Lc=null);for(var s=0;s<r.length;s+=3){var i=r[s],c=r[s+1],f=r[s+2];if(typeof c!="function"){if(sh(c||i)===null)continue;break}var g=Na(i);g!==null&&(r.splice(s,3),s-=3,nf(g,{pending:!0,data:f,method:i.method,action:c},c,f))}}))}function mi(r){function s(M){return Nc(M,r)}Ss!==null&&Nc(Ss,r),xs!==null&&Nc(xs,r),Ts!==null&&Nc(Ts,r),Co.forEach(s),Oo.forEach(s);for(var i=0;i<Es.length;i++){var c=Es[i];c.blockedOn===r&&(c.blockedOn=null)}for(;0<Es.length&&(i=Es[0],i.blockedOn===null);)Bv(i),i.blockedOn===null&&Es.shift();if(i=(r.ownerDocument||r).$$reactFormReplay,i!=null)for(c=0;c<i.length;c+=3){var f=i[c],g=i[c+1],w=f[pn]||null;if(typeof g=="function")w||Hv(i);else if(w){var A=null;if(g&&g.hasAttribute("formAction")){if(f=g,w=g[pn]||null)A=w.formAction;else if(sh(f)!==null)continue}else A=w.action;typeof A=="function"?i[c+1]=A:(i.splice(c,3),c-=3),Hv(i)}}}function qv(){function r(g){g.canIntercept&&g.info==="react-transition"&&g.intercept({handler:function(){return new Promise(function(w){return f=w})},focusReset:"manual",scroll:"manual"})}function s(){f!==null&&(f(),f=null),c||setTimeout(i,20)}function i(){if(!c&&!navigation.transition){var g=navigation.currentEntry;g&&g.url!=null&&navigation.navigate(g.url,{state:g.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var c=!1,f=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(i,100),function(){c=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),f!==null&&(f(),f=null)}}}function ih(r){this._internalRoot=r}zc.prototype.render=ih.prototype.render=function(r){var s=this._internalRoot;if(s===null)throw Error(a(409));var i=s.current,c=jn();
10Nv(i,c,r,s,null,null)},zc.prototype.unmount=ih.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var s=r.containerInfo;Nv(r.current,2,null,r,null,null),gc(),s[Da]=null}};function zc(r){this._internalRoot=r}zc.prototype.unstable_scheduleHydration=function(r){if(r){var s=Qu();r={blockedOn:null,target:r,priority:s};for(var i=0;i<Es.length&&s!==0&&s<Es[i].priority;i++);Es.splice(i,0,r),i===0&&Bv(r)}};var Fv=t.version;if(Fv!=="19.2.5")throw Error(a(527,Fv,"19.2.5"));ne.findDOMNode=function(r){var s=r._reactInternals;if(s===void 0)throw typeof r.render=="function"?Error(a(188)):(r=Object.keys(r).join(","),Error(a(268,r)));return r=m(s),r=r!==null?v(r):null,r=r===null?null:r.stateNode,r};var sT={bundleType:0,version:"19.2.5",rendererPackageName:"react-dom",currentDispatcherRef:P,reconcilerVersion:"19.2.5"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Pc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Pc.isDisabled&&Pc.supportsFiber)try{Pn=Pc.inject(sT),$t=Pc}catch{}}return Mo.createRoot=function(r,s){if(!o(r))throw Error(a(299));var i=!1,c="",f=Xg,g=Jg,w=Zg;return s!=null&&(s.unstable_strictMode===!0&&(i=!0),s.identifierPrefix!==void 0&&(c=s.identifierPrefix),s.onUncaughtError!==void 0&&(f=s.onUncaughtError),s.onCaughtError!==void 0&&(g=s.onCaughtError),s.onRecoverableError!==void 0&&(w=s.onRecoverableError)),s=Dv(r,1,!1,null,null,i,c,null,f,g,w,qv),r[Da]=s.current,If(r),new ih(s)},Mo.hydrateRoot=function(r,s,i){if(!o(r))throw Error(a(299));var c=!1,f="",g=Xg,w=Jg,A=Zg,M=null;return i!=null&&(i.unstable_strictMode===!0&&(c=!0),i.identifierPrefix!==void 0&&(f=i.identifierPrefix),i.onUncaughtError!==void 0&&(g=i.onUncaughtError),i.onCaughtError!==void 0&&(w=i.onCaughtError),i.onRecoverableError!==void 0&&(A=i.onRecoverableError),i.formState!==void 0&&(M=i.formState)),s=Dv(r,1,!0,s,i??null,c,f,M,g,w,A,qv),s.context=Mv(null),i=s.current,c=jn(),c=ja(c),f=us(c),f.callback=null,ds(i,f,c),i=c,s.current.lanes=i,mt(s,i),mr(s),r[Da]=s.current,If(r),new zc(s)},Mo.version="19.2.5",Mo}var e0;function pT(){if(e0)return ch.exports;e0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),ch.exports=hT(),ch.exports}var mT=pT(),gT="__TSS_CONTEXT",Xh=Symbol.for("TSS_SERVER_FUNCTION"),t0=Symbol.for("TSS_SERVER_FUNCTION_FACTORY"),yT="application/x-tss-framed",qr={JSON:0,CHUNK:1,END:2,ERROR:3},vT=/;\s*v=(\d+)/;function bT(e){const t=e.match(vT);return t?parseInt(t[1],10):void 0}function _T(e){const t=bT(e);if(t!==void 0&&t!==1)throw new Error(`Incompatible framed protocol version: server=${t}, client=1. Please ensure client and server are using compatible versions.`)}var jp=()=>window.__TSS_START_OPTIONS__;const O_=!1;function rl(e){return e[e.length-1]}function wT(e){return typeof e=="function"}function va(e,t){return wT(e)?e(t):e}const j_=Object.prototype.hasOwnProperty,n0=Object.prototype.propertyIsEnumerable;function D_(e){for(const t in e)if(j_.call(e,t))return!0;return!1}const ST=()=>Object.create(null),ua=(e,t)=>ba(e,t,ST);function ba(e,t,n=()=>({}),a=0){if(e===t)return e;if(a>500)return t;const o=t,l=a0(e)&&a0(o);if(!l&&!(mu(e)&&mu(o)))return o;const u=l?e:r0(e);if(!u)return o;const h=l?o:r0(o);if(!h)return o;const d=u.length,m=h.length,v=l?new Array(m):n();let p=0;for(let b=0;b<m;b++){const _=l?b:h[b],S=e[_],R=o[_];if(S===R){v[_]=S,(l?b<d:j_.call(e,_))&&p++;continue}if(S===null||R===null||typeof S!="object"||typeof R!="object"){v[_]=R;continue}const E=ba(S,R,n,a+1);v[_]=E,E===S&&p++}return d===m&&p===d?e:v}function r0(e){const t=Object.getOwnPropertyNames(e);for(const o of t)if(!n0.call(e,o))return!1;const n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;const a=t;for(const o of n){if(!n0.call(e,o))return!1;a.push(o)}return a}function mu(e){if(!s0(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!s0(n)||!n.hasOwnProperty("isPrototypeOf"))}function s0(e){return Object.prototype.toString.call(e)==="[object Object]"}function a0(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function an(e,t,n){if(e===t)return!0;
10if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let a=0,o=e.length;a<o;a++)if(!an(e[a],t[a],n))return!1;return!0}if(mu(e)&&mu(t)){const a=n?.ignoreUndefined??!0;if(n?.partial){for(const u in t)if((!a||t[u]!==void 0)&&!an(e[u],t[u],n))return!1;return!0}let o=0;if(!a)o=Object.keys(e).length;else for(const u in e)e[u]!==void 0&&o++;let l=0;for(const u in t)if((!a||t[u]!==void 0)&&(l++,l>o||!an(e[u],t[u],n)))return!1;return o===l}return!1}function Ra(e){let t,n;const a=new Promise((o,l)=>{t=o,n=l});return a.status="pending",a.resolve=o=>{a.status="resolved",a.value=o,t(o),e?.(o)},a.reject=o=>{a.status="rejected",n(o)},a}function xT(e){return typeof e?.message!="string"?!1:e.message.startsWith("Failed to fetch dynamically imported module")||e.message.startsWith("error loading dynamically imported module")||e.message.startsWith("Importing a module script failed")}function sl(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function TT(e){return e.replace(/[\x00-\x1f\x7f]/g,"")}function i0(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,n=>{try{return decodeURI(n)}catch{return n}})}return TT(t)}
10const ET=["http:","https:","mailto:","tel:"];function gu(e,t){if(!e)return!1;try{const n=new URL(e);return!t.has(n.protocol)}catch{return!1}}const RT={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},AT=/[&><\u2028\u2029]/g;function kT(e){return e.replace(AT,t=>RT[t])}function No(e){if(!e)return{path:e,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return{path:e,handledProtocolRelativeURL:!1};const t=/%25|%5C/gi;let n=0,a="",o;for(;(o=t.exec(e))!==null;)a+=i0(e.slice(n,o.index))+o[0],n=t.lastIndex;a=a+i0(n?e.slice(n):e);let l=!1;return a.startsWith("//")&&(l=!0,a="/"+a.replace(/^\/+/,"")),{path:a,handledProtocolRelativeURL:l}}function CT(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function OT(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function xn(){throw new Error("Invariant failed")}function al(e){const t=new Map;let n,a;const o=l=>{l.next&&(l.prev?(l.prev.next=l.next,l.next.prev=l.prev,l.next=void 0,a&&(a.next=l,l.prev=a)):(l.next.prev=void 0,n=l.next,l.next=void 0,a&&(l.prev=a,a.next=l)),a=l)};return{get(l){const u=t.get(l);if(u)return o(u),u.value},set(l,u){if(t.size>=e&&n){const d=n;t.delete(d.key),d.next&&(n=d.next,d.next.prev=void 0),d===a&&(a=void 0)}const h=t.get(l);if(h)h.value=u,o(h);else{const d={key:l,value:u,prev:a};a&&(a.next=d),a=d,n||(n=d),t.set(l,d)}},clear(){t.clear(),n=void 0,a=void 0}}}const Ds=4,M_=5;function jT(e){const t=e.indexOf("{");if(t===-1)return null;const n=e.indexOf("}",t);return n===-1||t+1>=e.length?null:[t,n]}function N_(e,t,n=new Uint16Array(6)){const a=e.indexOf("/",t),o=a===-1?e.length:a,l=e.substring(t,o);if(!l||!l.includes("$"))return n[0]=0,n[1]=t,n[2]=t,n[3]=o,n[4]=o,n[5]=o,n;if(l==="$"){const h=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=h,n[4]=h,n[5]=h,n}if(l.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=o,n[4]=o,n[5]=o,n;const u=jT(l);if(u){const[h,d]=u,m=l.charCodeAt(h+1);if(m===45){if(h+2<l.length&&l.charCodeAt(h+2)===36){const v=h+3,p=d;if(v<p)return n[0]=3,n[1]=t+h,n[2]=t+v,n[3]=t+p,n[4]=t+d+1,n[5]=o,n}}else if(m===36){const v=h+1,p=h+2;return p===d?(n[0]=2,n[1]=t+h,n[2]=t+v,n[3]=t+p,n[4]=t+d+1,n[5]=e.length,n):(n[0]=1,n[1]=t+h,n[2]=t+p,n[3]=t+d,n[4]=t+d+1,n[5]=o,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=o,n[4]=o,n[5]=o,n}function zu(e,t,n,a,o,l,u){u?.(n);let h=a;{const d=n.fullPath??n.from,m=d.length,v=n.options?.caseSensitive??e,p=n.options?.params?.parse??n.options?.parseParams;for(;h<m;){const _=N_(d,h,t);let S;const R=h,E=_[5];switch(h=E+1,l++,_[0]){case 0:{const x=d.substring(_[2],_[3]);if(v){const k=o.static?.get(x);if(k)S=k;else{o.static??=new Map;const D=_a(n.fullPath??n.from);D.parent=o,D.depth=l,S=D,o.static.set(x,D)}}else{const k=x.toLowerCase(),D=o.staticInsensitive?.get(k);if(D)S=D;else{o.staticInsensitive??=new Map;const j=_a(n.fullPath??n.from);j.parent=o,j.depth=l,S=j,o.staticInsensitive.set(k,j)}}break}case 1:{const x=d.substring(R,_[1]),k=d.substring(_[4],E),D=v&&!!(x||k),j=x?D?x:x.toLowerCase():void 0,H=k?D?k:k.toLowerCase():void 0,U=!p&&o.dynamic?.find(B=>!B.parse&&B.caseSensitive===D&&B.prefix===j&&B.suffix===H);if(U)S=U;else{const B=ph(1,n.fullPath??n.from,D,j,H);S=B,B.depth=l,B.parent=o,o.dynamic??=[],o.dynamic.push(B)}break}case 3:{const x=d.substring(R,_[1]),k=d.substring(_[4],E),D=v&&!!(x||k),j=x?D?x:x.toLowerCase():void 0,H=k?D?k:k.toLowerCase():void 0,U=!p&&o.optional?.find(B=>!B.parse&&B.caseSensitive===D&&B.prefix===j&&B.suffix===H);if(U)S=U;else{const B=ph(3,n.fullPath??n.from,D,j,H);S=B,B.parent=o,B.depth=l,o.optional??=[],o.optional.push(B)}break}case 2:{const x=d.substring(R,_[1]),k=d.substring(_[4],E),D=v&&!!(x||k),j=x?D?x:x.toLowerCase():void 0,H=k?D?k:k.toLowerCase():void 0,U=ph(2,n.fullPath??n.from,D,j,H);S=U,U.parent=o,U.depth=l,o.wildcard??=[],o.wildcard.push(U)}}o=S}if(p&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf("/")+1)===95){const _=_a(n.fullPath??n.from);_.kind=M_,_.parent=o,l++,_.depth=l,o.pathless??=[],o.pathless.push(_),o=_}const b=(n.path||!n.children)&&!n.isRoot;if(b&&d.endsWith("/")){const _=_a(n.fullPath??n.from);_.kind=Ds,_.parent=o,l++,_.depth=l,o.index=_,o=_}o.parse=p??null,o.priority=n.options?.params?.priority??0,b&&!o.route&&(o.route=n,o.fullPath=n.fullPath??n.from)}if(n.children)for(const d of n.children)zu(e,t,d,h,o,l,u)}function hh(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function ks(e){if(e.pathless)for(const t of e.pathless)ks(t);if(e.static)for(const t of e.static.values())ks(t);if(e.staticInsensitive)for(const t of e.staticInsensitive.values())ks(t);if(e.dynamic?.length){e.dynamic.sort(hh);for(const t of e.dynamic)ks(t)}if(e.optional?.length){e.optional.sort(hh);for(const t of e.optional)ks(t)}if(e.wildcard?.length){e.wildcard.sort(hh);for(const t of e.wildcard)ks(t)}}function _a(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function ph(e,t,n,a,o){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:a,suffix:o}}function DT(e,t){const n=_a("/"),a=new Uint16Array(6);
10for(const o of e)zu(!1,a,o,1,n,0);ks(n),t.masksTree=n,t.flatCache=al(1e3)}function MT(e,t){e||="/";const n=t.flatCache.get(e);if(n)return n;const a=Dp(e,t.masksTree);return t.flatCache.set(e,a),a}function NT(e,t,n,a,o){e||="/",a||="/";const l=t?`case\0${e}`:e;let u=o.singleCache.get(l);return u||(u=_a("/"),zu(t,new Uint16Array(6),{from:e},1,u,0),o.singleCache.set(l,u)),Dp(a,u,n)}function LT(e,t,n=!1){const a=n?e:`nofuzz\0${e}`,o=t.matchCache.get(a);if(o!==void 0)return o;e||="/";let l;try{l=Dp(e,t.segmentTree,n)}catch(u){if(u instanceof URIError)l=null;else throw u}return l&&(l.branch=z_(l.route)),t.matchCache.set(a,l),l}function zT(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function PT(e,t=!1,n){const a=_a(e.fullPath),o=new Uint16Array(6),l={},u={};let h=0;return zu(t,o,e,1,a,0,d=>{if(n?.(d,h),d.id in l&&xn(),l[d.id]=d,h!==0&&d.path){const m=zT(d.fullPath);(!u[m]||d.fullPath.endsWith("/"))&&(u[m]=d)}h++}),ks(a),{processedTree:{segmentTree:a,singleCache:al(1e3),matchCache:al(1e3),flatCache:null,masksTree:null},routesById:l,routesByPath:u}}function Dp(e,t,n=!1){const a=e.split("/"),o=$T(e,a,t,n);if(!o)return null;const[l]=L_(e,a,o);return{route:o.node.route,rawParams:l}}function L_(e,t,n){const a=UT(n.node);let o=null;const l=Object.create(null);let u=n.extract?.part??0,h=n.extract?.node??0,d=n.extract?.path??0,m=n.extract?.segment??0;for(;h<a.length;u++,h++,d++,m++){const v=a[h];if(v.kind===Ds)break;if(v.kind===M_){m--,u--,d--;continue}const p=t[u],b=d;if(p&&(d+=p.length),v.kind===1){o??=n.node.fullPath.split("/");const _=o[m],S=v.prefix?.length??0;if(_.charCodeAt(S)===123){const R=v.suffix?.length??0,E=_.substring(S+2,_.length-R-1),x=p.substring(S,p.length-R);l[E]=decodeURIComponent(x)}else{const R=_.substring(1);l[R]=decodeURIComponent(p)}}else if(v.kind===3){if(n.skipped&1<<h){u--,d=b-1;continue}o??=n.node.fullPath.split("/");const _=o[m],S=v.prefix?.length??0,R=v.suffix?.length??0,E=_.substring(S+3,_.length-R-1),x=v.suffix||v.prefix?p.substring(S,p.length-R):p;x&&(l[E]=decodeURIComponent(x))}else if(v.kind===2){const _=v,S=e.substring(b+(_.prefix?.length??0),e.length-(_.suffix?.length??0)),R=decodeURIComponent(S);l["*"]=R,l._splat=R;break}}return n.rawParams&&Object.assign(l,n.rawParams),[l,{part:u,node:h,path:d,segment:m}]}function z_(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function UT(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function $T(e,t,n,a){if(e==="/"&&n.index)return{node:n.index,skipped:0};const o=!rl(t),l=o&&e!=="/",u=t.length-(o?1:0),h=[{node:n,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}];let d=null,m=null;for(;h.length;){const v=h.pop(),{node:p,index:b,skipped:_,depth:S,statics:R,dynamics:E,optionals:x}=v;let{extract:k,rawParams:D}=v;if(p.kind===2&&p.route&&!$c(m,v))continue;if(p.parse){if(!o0(e,t,v))continue;D=v.rawParams,k=v.extract}a&&p.route&&p.kind!==Ds&&$c(d,v)&&(d=v);const j=b===u;if(j&&(p.route&&(!l||p.kind===Ds||p.kind===2)&&$c(m,v)&&(m=v),!p.optional&&!p.wildcard&&!p.index&&!p.pathless))continue;const H=j?void 0:t[b];let U;if(j&&p.index){const B={node:p.index,index:b,skipped:_,depth:S+1,statics:R,dynamics:E,optionals:x,extract:k,rawParams:D};let V=!0;if(p.index.parse&&(o0(e,t,B)||(V=!1)),V){if(!E&&!x&&!_&&BT(R,u))return B;$c(m,B)&&(m=B)}}if(p.wildcard)for(let B=p.wildcard.length-1;B>=0;B--){const V=p.wildcard[B],{prefix:W,suffix:se}=V;if(!(W&&(j||!(V.caseSensitive?H:U??=H.toLowerCase()).startsWith(W)))){if(se){if(j)continue;const le=t.slice(b).join("/").slice(-se.length);if((V.caseSensitive?le:le.toLowerCase())!==se)continue}h.push({node:V,index:u,skipped:_,depth:S+1,statics:R,dynamics:E,optionals:x,extract:k,rawParams:D})}}if(p.optional){const B=_|1<<S,V=S+1;for(let W=p.optional.length-1;W>=0;W--){const se=p.optional[W];h.push({node:se,index:b,skipped:B,depth:V,statics:R,dynamics:E,optionals:x,extract:k,rawParams:D})}if(!j)for(let W=p.optional.length-1;W>=0;W--){const se=p.optional[W],{prefix:le,suffix:ue}=se;if(le||ue){const Ce=se.caseSensitive?H:U??=H.toLowerCase();if(le&&!Ce.startsWith(le)||ue&&!Ce.endsWith(ue))continue}h.push({node:se,index:b+1,skipped:_,depth:V,statics:R,dynamics:E,optionals:x+Uc(u,b),extract:k,rawParams:D})}}if(!j&&p.dynamic&&H)for(let B=p.dynamic.length-1;B>=0;B--){const V=p.dynamic[B],{prefix:W,suffix:se}=V;if(W||se){const le=V.caseSensitive?H:U??=H.toLowerCase();if(W&&!le.startsWith(W)||se&&!le.endsWith(se))continue}h.push({node:V,index:b+1,skipped:_,depth:S+1,statics:R,dynamics:E+Uc(u,b),optionals:x,extract:k,rawParams:D})}if(!j&&p.staticInsensitive){const B=p.staticInsensitive.get(U??=H.toLowerCase());B&&h.push({node:B,index:b+1,skipped:_,depth:S+1,statics:R+Uc(u,b),dynamics:E,optionals:x,extract:k,rawParams:D})}if(!j&&p.static){const B=p.static.get(H);B&&h.push({node:B,index:b+1,skipped:_,depth:S+1,statics:R+Uc(u,b),dynamics:E,optionals:x,extract:k,rawParams:D})}if(p.pathless){const B=S+1;for(let V=p.pathless.length-1;V>=0;V--){const W=p.pathless[V];h.push({node:W,index:b,skipped:_,depth:B,statics:R,dynamics:E,optionals:x,extract:k,rawParams:D})}}}if(m)return m;if(a&&d){let v=d.index;for(let b=0;b<d.index;b++)v+=t[b].length;const p=v===e.length?"/":e.slice(v);return d.rawParams??=Object.create(null),d.rawParams["**"]=decodeURIComponent(p),d}return null}function Uc(e,t){return 2**(e-t-1)}function BT(e,t){return e===2**(t-1)-1}function o0(e,t,n){let a,o;try{[a,o]=L_(e,t,n)}catch{return null}if(n.rawParams=a,n.extract=o,!n.node.parse)return!0;try{if(n.node.parse(a)===!1)return null}catch{}return!0}function $c(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===Ds)>(e.node.kind===Ds)||t.node.kind===Ds==(e.node.kind===Ds)&&t.depth>e.depth))):!0}function cu(e){return Mp(e.filter(t=>t!==void 0).join("/"))}function Mp(e){return e.replace(/\/{2,}/g,"/")}function P_(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function Kr(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function U_(e){return Kr(P_(e))}function yu(e,t){return e?.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function IT(e,t,n){return yu(e,n)===yu(t,n)}function HT({base:e,to:t,trailingSlash:n="never",cache:a}){const o=t.startsWith("/"),l=!o&&t===".";let u;if(a){u=o?t:l?e:e+"\0"+t;const m=a.get(u);if(m)return m}let h;
10if(l)h=e.split("/");else if(o)h=t.split("/");else{for(h=e.split("/");h.length>1&&rl(h)==="";)h.pop();const m=t.split("/");for(let v=0,p=m.length;v<p;v++){const b=m[v];b===""?v?v===p-1&&h.push(b):h=[b]:b===".."?h.pop():b==="."||h.push(b)}}h.length>1&&(rl(h)===""?n==="never"&&h.pop():n==="always"&&h.push(""));const d=Mp(h.join("/"))||"/";return u&&a&&a.set(u,d),d}function qT(e){const t=new Map(e.map(o=>[encodeURIComponent(o),o])),n=Array.from(t.keys()).map(o=>o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),a=new RegExp(n,"g");return o=>o.replace(a,l=>t.get(l)??l)}function mh(e,t,n){const a=t[e];return typeof a!="string"?a:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(a)?a:a.split("/").map(o=>c0(o,n)).join("/"):c0(a,n)}function l0({path:e,params:t,decoder:n,...a}){let o=!1;const l=Object.create(null);if(!e||e==="/")return{interpolatedPath:"/",usedParams:l,isMissingParams:o};if(!e.includes("$"))return{interpolatedPath:e,usedParams:l,isMissingParams:o};const u=e.length;let h=0,d,m="";for(;h<u;){const v=h;d=N_(e,v,d);const p=d[5];if(h=p+1,v===p)continue;const b=d[0];if(b===0){m+="/"+e.substring(v,p);continue}if(b===2){const _=t._splat;l._splat=_,l["*"]=_;const S=e.substring(v,d[1]),R=e.substring(d[4],p);if(!_){o=!0,(S||R)&&(m+="/"+S+R);continue}const E=mh("_splat",t,n);m+="/"+S+E+R;continue}if(b===1){const _=e.substring(d[2],d[3]);!o&&!(_ in t)&&(o=!0),l[_]=t[_];const S=e.substring(v,d[1]),R=e.substring(d[4],p),E=mh(_,t,n)??"undefined";m+="/"+S+E+R;continue}if(b===3){const _=e.substring(d[2],d[3]),S=t[_];if(S==null)continue;l[_]=S;const R=e.substring(v,d[1]),E=e.substring(d[4],p),x=mh(_,t,n)??"";m+="/"+R+x+E;continue}}return e.endsWith("/")&&(m+="/"),{usedParams:l,interpolatedPath:m||"/",isMissingParams:o}}function c0(e,t){const n=encodeURIComponent(e);return t?.(n)??n}function Ft(e){return e?.isNotFound===!0}function $_(e,t=String){const n=new URLSearchParams;for(const a in e){const o=e[a];o!==void 0&&n.set(a,t(o))}return n.toString()}function gh(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function FT(e){const t=new URLSearchParams(e),n=Object.create(null);for(const[a,o]of t.entries()){const l=n[a];l==null?n[a]=gh(o):Array.isArray(l)?l.push(gh(o)):n[a]=[l,gh(o)]}return n}const GT=YT(JSON.parse),VT=KT(JSON.stringify,JSON.parse);function YT(e){return t=>{t[0]==="?"&&(t=t.substring(1));const n=FT(t);for(const a in n){const o=n[a];if(typeof o=="string")try{n[a]=e(o)}catch{}}return n}}function KT(e,t){const n=typeof t=="function";function a(o){if(typeof o=="object"&&o!==null)try{return e(o)}catch{}else if(n&&typeof o=="string")try{return t(o),e(o)}catch{}return o}return o=>{const l=$_(o,a);return l?`?${l}`:""}}const Ta="__root__";function B_(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Xt(e){return e instanceof Response&&!!e.options}function I_(e){if(e!==null&&typeof e=="object"&&e.isSerializedRedirect)return B_(e)}const Jh=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},WT=e=>e.stores.matchesId.get().some(t=>e.stores.matchStores.get(t)?.get()._forcePending),Pu=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),Ea=(e,t,n=!0)=>{const a={...e.router.options.context??{}},o=n?t:t-1;for(let l=0;l<=o;l++){const u=e.matches[l];if(!u)continue;const h=e.router.getMatch(u.id);h&&Object.assign(a,h.__routeContext,h.__beforeLoadContext)}return a},u0=(e,t)=>{if(!e.matches.length)return;const n=t.routeId,a=e.matches.findIndex(u=>u.routeId===e.router.routeTree.id),o=a>=0?a:0;let l=n?e.matches.findIndex(u=>u.routeId===n):e.firstBadMatchIndex??e.matches.length-1;l<0&&(l=o);for(let u=l;u>=0;u--){const h=e.matches[u];if(e.router.looseRoutesById[h.routeId].options.notFoundComponent)return u}return n?l:o},Ms=(e,t,n)=>{if(!(!Xt(n)&&!Ft(n)))throw Xt(n)&&n.redirectHandled&&!n.options.reloadDocument||(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,a=>({...a,status:Xt(n)?"redirected":Ft(n)?"notFound":a.status==="pending"?"success":a.status,context:Ea(e,t.index),isFetching:!1,error:n})),Ft(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),Xt(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n))),n},H_=(e,t)=>{const n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},d0=(e,t,n)=>
10{const a=Ea(e,n);e.updateMatch(t,o=>({...o,context:a}))},Lo=(e,t,n)=>{const{id:a,routeId:o}=e.matches[t],l=e.router.looseRoutesById[o];if(n instanceof Promise)throw n;e.firstBadMatchIndex??=t,Ms(e,e.router.getMatch(a),n);try{l.options.onError?.(n)}catch(u){n=u,Ms(e,e.router.getMatch(a),n)}e.updateMatch(a,u=>(u._nonReactive.beforeLoadPromise?.resolve(),u._nonReactive.beforeLoadPromise=void 0,u._nonReactive.loadPromise?.resolve(),{...u,error:n,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!Xt(n)&&!Ft(n)&&(e.serialError??=n)},q_=(e,t,n,a)=>{if(a._nonReactive.pendingTimeout!==void 0)return;const o=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!Pu(e,t)&&(n.options.loader||n.options.beforeLoad||G_(n))&&typeof o=="number"&&o!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){const l=setTimeout(()=>{Jh(e)},o);a._nonReactive.pendingTimeout=l}},QT=(e,t,n)=>{const a=e.router.getMatch(t);if(!a._nonReactive.beforeLoadPromise&&!a._nonReactive.loaderPromise)return;q_(e,t,n,a);const o=()=>{const l=e.router.getMatch(t);l.preload&&(l.status==="redirected"||l.status==="notFound")&&Ms(e,l,l.error)};return a._nonReactive.beforeLoadPromise?a._nonReactive.beforeLoadPromise.then(o):o()},XT=(e,t,n,a)=>{const o=e.router.getMatch(t);let l=o._nonReactive.loadPromise;o._nonReactive.loadPromise=Ra(()=>{l?.resolve(),l=void 0});const{paramsError:u,searchError:h}=o;u&&Lo(e,n,u),h&&Lo(e,n,h),q_(e,t,a,o);const d=new AbortController;let m=!1;const v=()=>{m||(m=!0,e.updateMatch(t,j=>({...j,isFetching:"beforeLoad",fetchCount:j.fetchCount+1,abortController:d})))},p=()=>{o._nonReactive.beforeLoadPromise?.resolve(),o._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,j=>({...j,isFetching:!1}))};if(!a.options.beforeLoad){e.router.batch(()=>{v(),p()});return}o._nonReactive.beforeLoadPromise=Ra();const b={...Ea(e,n,!1),...o.__routeContext},{search:_,params:S,cause:R}=o,E=Pu(e,t),x={search:_,abortController:d,params:S,preload:E,context:b,location:e.location,navigate:j=>e.router.navigate({...j,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:E?"preload":R,matches:e.matches,routeId:a.id,...e.router.options.additionalContext},k=j=>{if(j===void 0){e.router.batch(()=>{v(),p()});return}(Xt(j)||Ft(j))&&(v(),Lo(e,n,j)),e.router.batch(()=>{v(),e.updateMatch(t,H=>({...H,__beforeLoadContext:j})),p()})};let D;try{if(D=a.options.beforeLoad(x),sl(D))return v(),D.catch(j=>{Lo(e,n,j)}).then(k)}catch(j){v(),Lo(e,n,j)}k(D)},JT=(e,t)=>{const{id:n,routeId:a}=e.matches[t],o=e.router.looseRoutesById[a],l=()=>h(),u=()=>XT(e,n,t,o),h=()=>{if(H_(e,n))return;const d=QT(e,n,o);return sl(d)?d.then(u):u()};return l()},ZT=(e,t,n)=>{const a=e.router.getMatch(t);if(!a||!n.options.head&&!n.options.scripts&&!n.options.headers)return;const o={ssr:e.router.options.ssr,matches:e.matches,match:a,params:a.params,loaderData:a.loaderData};return Promise.all([n.options.head?.(o),n.options.scripts?.(o),n.options.headers?.(o)]).then(([l,u,h])=>({meta:l?.meta,links:l?.links,headScripts:l?.scripts,headers:h,scripts:u,styles:l?.styles}))},F_=(e,t,n,a,o)=>{const l=t[a-1],{params:u,loaderDeps:h,abortController:d,cause:m}=e.router.getMatch(n),v=Ea(e,a),p=Pu(e,n);return{params:u,deps:h,preload:!!p,parentMatchPromise:l,abortController:d,context:v,location:e.location,navigate:b=>e.router.navigate({...b,_fromLocation:e.location}),cause:p?"preload":m,route:o,...e.router.options.additionalContext}},f0=async(e,t,n,a,o)=>{try{const l=e.router.getMatch(n);try{(!(O_??e.router.isServer)||l.ssr===!0)&&il(o);const u=o.options.loader,h=typeof u=="function"?u:u?.handler,d=h?.(F_(e,t,n,a,o)),m=!!h&&sl(d);if((m||o._lazyPromise||o._componentsPromise||o.options.head||o.options.scripts||o.options.headers||l._nonReactive.minPendingPromise)&&e.updateMatch(n,p=>({...p,isFetching:"loader"})),h){const p=m?await d:d;Ms(e,e.router.getMatch(n),p),p!==void 0&&e.updateMatch(n,b=>({...b,loaderData:p}))}o._lazyPromise&&await o._lazyPromise;const v=l._nonReactive.minPendingPromise;v&&await v,o._componentsPromise&&await o._componentsPromise,e.updateMatch(n,p=>({...p,error:void 0,context:Ea(e,a),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(u){let h=u;if(h?.name==="AbortError"){if(l.abortController.signal.aborted){l._nonReactive.loaderPromise?.resolve(),l._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,m=>({...m,status:m.status==="pending"?"success":m.status,isFetching:!1,context:Ea(e,a)}));return}const d=l._nonReactive.minPendingPromise;d&&await d,Ft(u)&&await o.options.notFoundComponent?.preload?.(),Ms(e,e.router.getMatch(n),u);try{o.options.onError?.(u)}catch(m){h=m,Ms(e,e.router.getMatch(n),m)}!Xt(h)&&!Ft(h)&&await il(o,["errorComponent"]),e.updateMatch(n,m=>({...m,error:h,context:Ea(e,a),status:"error",isFetching:!1}))}}catch(l){const u=e.router.getMatch(n);u&&(u._nonReactive.loaderPromise=void 0),Ms(e,u,l)}},eE=async(e,t,n)=>{async function a(_,S,R,E,x){const k=Date.now()-S.updatedAt,D=_?x.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:x.options.staleTime??e.router.options.defaultStaleTime??0,j=x.options.shouldReload,H=typeof j=="function"?j(F_(e,t,o,n,x)):j,{status:U,invalid:B}=E,V=k>=D&&(!!e.forceStaleReload||E.cause==="enter"||R!==void 0&&R!==E.id);u=U==="success"&&(B||(H??V)),_&&x.options.preload===!1||(u&&!e.sync&&v?(h=!0,(async()=>{try{await f0(e,t,o,n,x);const W=e.router.getMatch(o);W._nonReactive.loaderPromise?.resolve(),W._nonReactive.loadPromise?.resolve(),W._nonReactive.loaderPromise=void 0,W._nonReactive.loadPromise=void 0}catch(W){Xt(W)&&await e.router.navigate(W.options)}})()):U!=="success"||u?await f0(e,t,o,n,x):d0(e,o,n))}const{id:o,routeId:l}=e.matches[n];let u=!1,h=!1;const d=e.router.looseRoutesById[l],m=d.options.loader,v=((typeof m=="function"?void 0:m?.staleReloadMode)??e.router.options.defaultStaleReloadMode)!=="blocking";if(H_(e,o)){if(!e.router.getMatch(o))return e.matches[n];d0(e,o,n)}else{const _=e.router.getMatch(o),S=e.router.stores.matchesId.get()[n],R=(S&&e.router.stores.matchStores.get(S)||null)?.routeId===l?S:e.router.stores.matches.get().find(x=>x.routeId===l)?.id,E=Pu(e,o);if(_._nonReactive.loaderPromise){if(_.status==="success"&&!e.sync&&!_.preload&&v)return _;await _._nonReactive.loaderPromise;const x=e.router.getMatch(o),k=x._nonReactive.error||x.error;k&&Ms(e,x,k),x.status==="pending"&&await a(E,_,R,x,d)}else{const x=E&&!e.router.stores.matchStores.has(o),k=e.router.getMatch(o);
10k._nonReactive.loaderPromise=Ra(),x!==k.preload&&e.updateMatch(o,D=>({...D,preload:x})),await a(E,_,R,k,d)}}const p=e.router.getMatch(o);h||(p._nonReactive.loaderPromise?.resolve(),p._nonReactive.loadPromise?.resolve(),p._nonReactive.loadPromise=void 0),clearTimeout(p._nonReactive.pendingTimeout),p._nonReactive.pendingTimeout=void 0,h||(p._nonReactive.loaderPromise=void 0),p._nonReactive.dehydrated=void 0;const b=h?p.isFetching:!1;return b!==p.isFetching||p.invalid!==!1?(e.updateMatch(o,_=>({..._,isFetching:b,invalid:!1})),e.router.getMatch(o)):p};async function h0(e){const t=e,n=[];WT(t.router)&&Jh(t);let a;for(let b=0;b<t.matches.length;b++){try{const _=JT(t,b);sl(_)&&await _}catch(_){if(Xt(_))throw _;if(Ft(_))a=_;else if(!t.preload)throw _;break}if(t.serialError||t.firstBadMatchIndex!=null)break}const o=t.firstBadMatchIndex??t.matches.length,l=a&&!t.preload?u0(t,a):void 0,u=a&&t.preload?0:l!==void 0?Math.min(l+1,o):o;let h,d;for(let b=0;b<u;b++)n.push(eE(t,n,b));try{await Promise.all(n)}catch{const b=await Promise.allSettled(n);for(const _ of b){if(_.status!=="rejected")continue;const S=_.reason;if(Xt(S))throw S;Ft(S)?h??=S:d??=S}if(d!==void 0)throw d}const m=h??(a&&!t.preload?a:void 0);let v=t.firstBadMatchIndex!==void 0?t.firstBadMatchIndex:t.matches.length-1;if(!m&&a&&t.preload)return t.matches;if(m){const b=u0(t,m);b===void 0&&xn();const _=t.matches[b],S=t.router.looseRoutesById[_.routeId],R=t.router.options?.defaultNotFoundComponent;!S.options.notFoundComponent&&R&&(S.options.notFoundComponent=R),m.routeId=_.routeId;const E=_.routeId===t.router.routeTree.id;t.updateMatch(_.id,x=>({...x,...E?{status:"success",globalNotFound:!0,error:void 0}:{status:"notFound",error:m},isFetching:!1})),v=b,await il(S,["notFoundComponent"])}else if(!t.preload){const b=t.matches[0];b.globalNotFound||t.router.getMatch(b.id)?.globalNotFound&&t.updateMatch(b.id,_=>({..._,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){const b=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await il(b,["errorComponent"])}for(let b=0;b<=v;b++){const{id:_,routeId:S}=t.matches[b],R=t.router.looseRoutesById[S];try{const E=ZT(t,_,R);if(E){const x=await E;t.updateMatch(_,k=>({...k,...x}))}}catch(E){console.error(`Error executing head for route ${S}:`,E)}}const p=Jh(t);if(sl(p)&&await p,m)throw m;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function p0(e,t){const n=t.map(a=>e.options[a]?.preload?.()).filter(Boolean);if(n.length!==0)return Promise.all(n)}function il(e,t=uu){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(a=>{const{id:o,...l}=a.options;Object.assign(e.options,l),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);const n=()=>e._componentsLoaded?void 0:t===uu?(()=>{if(e._componentsPromise===void 0){const a=p0(e,uu);a?e._componentsPromise=a.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():p0(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function G_(e){for(const t of uu)if(e.options[t]?.preload)return!0;return!1}const uu=["component","errorComponent","pendingComponent","notFoundComponent"];function tE(e){return{input:({url:t})=>{for(const n of e)t=Zh(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=V_(e[n],t);return t}}}function nE(e){const t=U_(e.basepath),n=`/${t}`,a=e.caseSensitive?n:n.toLowerCase(),o=`${a}/`;return{input:({url:l})=>{const u=e.caseSensitive?l.pathname:l.pathname.toLowerCase();return u===a?l.pathname="/":u.startsWith(o)&&(l.pathname=l.pathname.slice(n.length)),l},output:({url:l})=>(l.pathname=cu(["/",t,l.pathname]),l)}}function Zh(e,t){const n=e?.input?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function V_(e,t){const n=e?.output?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function rE(e,t){const{createMutableStore:n,createReadonlyStore:a,batch:o,init:l}=t,u=new Map,h=new Map,d=new Map,m=n(e.status),v=n(e.loadedAt),p=n(e.isLoading),b=n(e.isTransitioning),_=n(e.location),S=n(e.resolvedLocation),R=n(e.statusCode),E=n(e.redirect),x=n([]),k=n([]),D=n([]),j=a(()=>yh(u,x.get())),H=a(()=>yh(h,k.get())),U=a(()=>yh(d,D.get())),B=a(()=>x.get()[0]),V=a(()=>x.get().some(ne=>u.get(ne)?.get().status==="pending")),W=a(()=>({locationHref:_.get().href,resolvedLocationHref:S.get()?.href,status:m.get()})),se=a(()=>({status:m.get(),loadedAt:v.get(),isLoading:p.get(),isTransitioning:b.get(),matches:j.get(),location:_.get(),resolvedLocation:S.get(),statusCode:R.get(),redirect:E.get()})),le=al(64);function ue(ne){let oe=le.get(ne);return oe||(oe=a(()=>{const Te=x.get();for(const he of Te){const N=u.get(he);if(N&&N.routeId===ne)return N.get()}}),le.set(ne,oe)),oe}const Ce={status:m,loadedAt:v,isLoading:p,isTransitioning:b,location:_,resolvedLocation:S,statusCode:R,redirect:E,matchesId:x,pendingIds:k,cachedIds:D,matches:j,pendingMatches:H,cachedMatches:U,firstId:B,hasPending:V,matchRouteDeps:W,matchStores:u,pendingMatchStores:h,cachedMatchStores:d,__store:se,getRouteMatchStore:ue,setMatches:Se,setPending:Le,setCached:P};Se(e.matches),l?.(Ce);function Se(ne){vh(ne,u,x,n,o)}function Le(ne){vh(ne,h,k,n,o)}function P(ne){vh(ne,d,D,n,o)}return Ce}function yh(e,t){const n=[];for(const a of t){const o=e.get(a);o&&n.push(o.get())}return n}function vh(e,t,n,a,o){const l=e.map(h=>h.id),u=new Set(l);o(()=>{for(const h of t.keys())u.has(h)||t.delete(h);for(const h of e){const d=t.get(h.id);if(!d){const m=a(h);m.routeId=h.routeId,t.set(h.id,m);continue}d.routeId=h.routeId,d.get()!==h&&d.set(h)}OT(n.get(),l)||n.set(l)})}var Ps="__TSR_index",m0="popstate",g0="beforeunload";function sE(e){let t=e.getLocation();const n=new Set,a=u=>
10{t=e.getLocation(),n.forEach(h=>h({location:t,action:u}))},o=u=>{e.notifyOnIndexChange??!0?a(u):t=e.getLocation()},l=async({task:u,navigateOpts:h,...d})=>{if(h?.ignoreBlocker??!1){u();return}const m=e.getBlockers?.()??[],v=d.type==="PUSH"||d.type==="REPLACE";if(typeof document<"u"&&m.length&&v)for(const p of m){const b=vu(d.path,d.state);if(await p.blockerFn({currentLocation:t,nextLocation:b,action:d.type})){e.onBlocked?.();return}}u()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:u=>(n.add(u),()=>{n.delete(u)}),push:(u,h,d)=>{const m=t.state[Ps];h=y0(m+1,h),l({task:()=>{e.pushState(u,h),a({type:"PUSH"})},navigateOpts:d,type:"PUSH",path:u,state:h})},replace:(u,h,d)=>{const m=t.state[Ps];h=y0(m,h),l({task:()=>{e.replaceState(u,h),a({type:"REPLACE"})},navigateOpts:d,type:"REPLACE",path:u,state:h})},go:(u,h)=>{l({task:()=>{e.go(u),o({type:"GO",index:u})},navigateOpts:h,type:"GO"})},back:u=>{l({task:()=>{e.back(u?.ignoreBlocker??!1),o({type:"BACK"})},navigateOpts:u,type:"BACK"})},forward:u=>{l({task:()=>{e.forward(u?.ignoreBlocker??!1),o({type:"FORWARD"})},navigateOpts:u,type:"FORWARD"})},canGoBack:()=>t.state[Ps]!==0,createHref:u=>e.createHref(u),block:u=>{if(!e.setBlockers)return()=>{};const h=e.getBlockers?.()??[];return e.setBlockers([...h,u]),()=>{const d=e.getBlockers?.()??[];e.setBlockers?.(d.filter(m=>m!==u))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:a}}function y0(e,t){t||(t={});const n=Np();return{...t,key:n,__TSR_key:n,[Ps]:e}}function aE(e){const t=typeof document<"u"?window:void 0,n=t.history.pushState,a=t.history.replaceState;let o=[];const l=()=>o,u=V=>o=V,h=(V=>V),d=(()=>vu(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){const V=Np();t.history.replaceState({[Ps]:0,key:V,__TSR_key:V},"")}let m=d(),v,p=!1,b=!1,_=!1,S=!1;const R=()=>m;let E,x;const k=()=>{E&&(B._ignoreSubscribers=!0,(E.isPush?t.history.pushState:t.history.replaceState)(E.state,"",E.href),B._ignoreSubscribers=!1,E=void 0,x=void 0,v=void 0)},D=(V,W,se)=>{const le=h(W);x||(v=m),m=vu(W,se),E={href:le,state:se,isPush:E?.isPush||V==="push"},x||(x=Promise.resolve().then(()=>k()))},j=V=>{m=d(),B.notify({type:V})},H=async()=>{if(b){b=!1;return}const V=d(),W=V.state[Ps]-m.state[Ps],se=W===1,le=W===-1,ue=!se&&!le||p;p=!1;const Ce=ue?"GO":le?"BACK":"FORWARD",Se=ue?{type:"GO",index:W}:{type:le?"BACK":"FORWARD"};if(_)_=!1;else{const Le=l();if(typeof document<"u"&&Le.length){for(const P of Le)if(await P.blockerFn({currentLocation:m,nextLocation:V,action:Ce})){b=!0,t.history.go(1),B.notify(Se);return}}}m=d(),B.notify(Se)},U=V=>{if(S){S=!1;return}let W=!1;const se=l();if(typeof document<"u"&&se.length)for(const le of se){const ue=le.enableBeforeUnload??!0;if(ue===!0){W=!0;break}if(typeof ue=="function"&&ue()===!0){W=!0;break}}if(W)return V.preventDefault(),V.returnValue=""},B=sE({getLocation:R,getLength:()=>t.history.length,pushState:(V,W)=>D("push",V,W),replaceState:(V,W)=>D("replace",V,W),back:V=>(V&&(_=!0),S=!0,t.history.back()),forward:V=>{V&&(_=!0),S=!0,t.history.forward()},go:V=>{p=!0,t.history.go(V)},createHref:V=>h(V),flush:k,destroy:()=>{t.history.pushState=n,t.history.replaceState=a,t.removeEventListener(g0,U,{capture:!0}),t.removeEventListener(m0,H)},onBlocked:()=>{v&&m!==v&&(m=v)},getBlockers:l,setBlockers:u,notifyOnIndexChange:!1});return t.addEventListener(g0,U,{capture:!0}),t.addEventListener(m0,H),t.history.pushState=function(...V){const W=n.apply(t.history,V);return B._ignoreSubscribers||j("PUSH"),W},t.history.replaceState=function(...V){const W=a.apply(t.history,V);return B._ignoreSubscribers||j("REPLACE"),W},B}function iE(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function vu(e,t){const n=iE(e),a=n.indexOf("#"),o=n.indexOf("?"),l=Np();return{href:n,pathname:n.substring(0,a>0?o>0?Math.min(a,o):a:o>0?o:n.length),hash:a>-1?n.substring(a):"",search:o>-1?n.slice(o,a===-1?void 0:a):"",state:t||{[Ps]:0,key:l,__TSR_key:l}}}function Np(){return(Math.random()+1).toString(36).substring(7)}function oE(e){return e instanceof Error?{name:e.name,message:e.message}:{data:e}}function Li(e,t){const n=t,a=e;return{fromLocation:n,toLocation:a,pathChanged:n?.pathname!==a.pathname,hrefChanged:n?.href!==a.href,hashChanged:n?.hash!==a.hash}}const ep=new WeakMap;var lE=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.routeBranchCache=new WeakMap,this.startTransition=n=>
10n(),this.update=n=>{const a=this.options,o=this.basepath??a?.basepath??"/",l=this.basepath===void 0,u=a?.rewrite;if(this.options={...a,...n},this.isServer=this.options.isServer??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=qT(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=aE()),this.origin=this.options.origin,this.origin||(window?.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let v;this.resolvePathCache=al(1e3),v=this.buildRouteTree(),this.setRoutes(v)}if(!this.stores&&this.latestLocation){const v=this.getStoreConfig(this);this.batch=v.batch,this.stores=rE(uE(this.latestLocation),v),wE(this)}let h=!1;const d=this.options.basepath??"/",m=this.options.rewrite;if(l||o!==d||u!==m){this.basepath=d;const v=[],p=U_(d);p&&p!=="/"&&v.push(nE({basepath:d})),m&&v.push(m),this.rewrite=v.length===0?void 0:v.length===1?v[0]:tE(v),this.history&&this.updateLatestLocation(),h=!0}h&&this.stores&&this.stores.location.set(this.latestLocation),typeof window<"u"&&"CSS"in window&&typeof window.CSS?.supports=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a))"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const n=PT(this.routeTree,this.options.caseSensitive,(a,o)=>{a.init({originalIndex:o})});return this.options.routeMasks&&DT(this.options.routeMasks,n.processedTree),n},this.subscribe=(n,a)=>{const o={eventType:n,fn:a};return this.subscribers.add(o),()=>{this.subscribers.delete(o)}},this.emit=n=>{this.subscribers.forEach(a=>{a.eventType===n.type&&a.fn(n)})},this.parseLocation=(n,a)=>{const o=({pathname:d,search:m,hash:v,href:p,state:b})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(d)){const x=this.options.parseSearch(m),k=this.options.stringifySearch(x);return{href:d+k+v,publicHref:d+k+v,pathname:No(d).path,external:!1,searchStr:k,search:ua(a?.search,x),hash:No(v.slice(1)).path,state:ba(a?.state,b)}}const _=new URL(p,this.origin),S=Zh(this.rewrite,_),R=this.options.parseSearch(S.search),E=this.options.stringifySearch(R);return S.search=E,{href:S.href.replace(S.origin,""),publicHref:p,pathname:No(S.pathname).path,external:!!this.rewrite&&S.origin!==this.origin,searchStr:E,search:ua(a?.search,R),hash:No(S.hash.slice(1)).path,state:ba(a?.state,b)}},l=o(n),{__tempLocation:u,__tempKey:h}=l.state;if(u&&(!h||h===this.tempLocationKey)){const d=o(u);return d.state.key=l.state.key,d.state.__TSR_key=l.state.__TSR_key,delete d.state.__tempLocation,{...d,maskedLocation:l}}return l},this.resolvePathWithBase=(n,a)=>HT({base:n,to:a.includes("//")?Mp(a):a,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(n,a,o)=>typeof n=="string"?this.matchRoutesInternal({pathname:n,search:a},o):this.matchRoutesInternal(n,a),this.getMatchedRoutes=n=>dE({pathname:n,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=n=>{const a=this.getMatch(n);a&&(a.abortController.abort(),clearTimeout(a._nonReactive.pendingTimeout),a._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(n=>{this.cancelMatch(n)}),this.stores.matchesId.get().forEach(n=>{if(this.stores.pendingMatchStores.has(n))return;const a=this.stores.matchStores.get(n)?.get();a&&(a.status==="pending"||a.isFetching==="loader")&&this.cancelMatch(n)})},this.buildLocation=n=>{const a=(l={})=>{const u=l._fromLocation||this.pendingBuiltLocation||this.latestLocation,h=this.matchRoutesLightweight(u);l.from;const d=l.unsafeRelative==="path"?u.pathname:l.from??h.fullPath,m=l.to?`${l.to}`:void 0,v=h.search,p=Object.assign(Object.create(null),h.params),b=m?.charCodeAt(0)===47?"/":this.resolvePathWithBase(d,"."),_=m?this.resolvePathWithBase(b,m):b,S=l.params===!1||l.params===null?Ob
10ject.create(null):(l.params??!0)===!0?p:Object.assign(p,va(l.params,p)),R=this.routesByPath[Kr(_)];let E;if(R)E=this.getRouteBranch(R);else if(_.includes("$"))E=[];else{const le=this.getMatchedRoutes(_);E=le.matchedRoutes,this.options.notFoundRoute&&(!le.foundRoute||le.foundRoute.path!=="/"&&le.routeParams["**"])&&(E=[...E,this.options.notFoundRoute])}if(E.length&&D_(S))for(const le of E){const ue=le.options.params?.stringify??le.options.stringifyParams;if(ue)try{Object.assign(S,ue(S))}catch{}}const x=n.leaveParams?_:No(l0({path:_,params:S,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;let k=v;if(n._includeValidateSearch&&this.options.search?.strict){const le={};E.forEach(ue=>{if(ue.options.validateSearch)try{Object.assign(le,du(ue.options.validateSearch,{...le,...k}))}catch{}}),k=le}k=fE({search:k,dest:l,destRoutes:E,_includeValidateSearch:n._includeValidateSearch}),k=ua(v,k);const D=this.options.stringifySearch(k),j=l.hash===!0?u.hash:l.hash?va(l.hash,u.hash):void 0,H=j?`#${j}`:"";let U=l.state===!0?u.state:l.state?va(l.state,u.state):{};U=ba(u.state,U);const B=`${x}${D}${H}`;let V,W,se=!1;if(this.rewrite){const le=new URL(B,this.origin),ue=V_(this.rewrite,le);V=le.href.replace(le.origin,""),ue.origin!==this.origin?(W=ue.href,se=!0):W=ue.pathname+ue.search+ue.hash}else V=CT(B),W=V;return{publicHref:W,href:V,pathname:x,search:k,searchStr:D,state:U,hash:j??"",external:se,unmaskOnReload:l.unmaskOnReload}},o=(l={},u)=>{const h=a(l);let d=u?a(u):void 0;if(!d){const m=Object.create(null);if(this.options.routeMasks){const v=MT(h.pathname,this.processedTree);if(v){Object.assign(m,v.rawParams);const{from:p,params:b,..._}=v.route,S=b===!1||b===null?Object.create(null):(b??!0)===!0?m:Object.assign(m,va(b,m));u={from:n.from,..._,params:S},d=a(u)}}}return d&&(h.maskedLocation=d),h};return n.mask?o(n,{from:n.from,...n.mask}):o(n)},this.commitLocation=async({viewTransition:n,ignoreBlocker:a,...o})=>{let l;const u=()=>{const m=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];m.forEach(p=>{o.state[p]=this.latestLocation.state[p]});const v=an(o.state,this.latestLocation.state);return m.forEach(p=>{delete o.state[p]}),v},h=Kr(this.latestLocation.href)===Kr(o.href);let d=this.commitLocationPromise;if(this.commitLocationPromise=Ra(()=>{d?.resolve(),d=void 0}),h&&u())this.load();else{let{maskedLocation:m,hashScrollIntoView:v,...p}=o;m&&(p={...m,state:{...m.state,__tempKey:void 0,__tempLocation:{...p,search:p.searchStr,state:{...p.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(p.unmaskOnReload??this.options.unmaskOnReload??!1)&&(p.state.__tempKey=this.tempLocationKey)),p.state.__hashScrollIntoViewOptions=v??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=n,l=o.replace?"REPLACE":"PUSH",this.history[l==="REPLACE"?"replace":"push"](p.publicHref,p.state,{ignoreBlocker:a})}return this._scroll.next=o.resetScroll??!0,this.history.subscribers.size||this.load(l?{action:{type:l}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:n,resetScroll:a,hashScrollIntoView:o,viewTransition:l,ignoreBlocker:u,href:h,...d}={})=>{if(h){const p=this.history.location.state.__TSR_index,b=vu(h,{__TSR_index:n?p:p+1}),_=new URL(b.pathname,this.origin);d.to=Zh(this.rewrite,_).pathname,d.search=this.options.parseSearch(b.search),d.hash=b.hash.slice(1)}const m=this.buildLocation({...d,_includeValidateSearch:!0});this.pendingBuiltLocation=m;const v=this.commitLocation({...m,viewTransition:l,replace:n,resetScroll:a,hashScrollIntoView:o,ignoreBlocker:u});return Promise.resolve().then(()=>{this.pendingBuiltLocation===m&&(this.pendingBuiltLocation=void 0)}),v},this.navigate=async({to:n,reloadDocument:a,href:o,publicHref:l,...u})=>{let h=!1;if(o)try{new URL(`${o}`),h=!0}catch{}if(h&&!a&&(a=!0),a){if(n!==void 0||!o){const m=this.buildLocation({to:n,...u});o=o??m.publicHref,l=l??m.publicHref}const d=!h&&l?l:o;if(gu(d,this.protocolAllowlist))return Promise.resolve();if(!u.ignoreBlocker){const m=this.history.getBlockers?.()??[];for(const v of m)if(v?.blockerFn&&await v.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return u.replace?window.location.replace(d):window.location.href=d,Promise.resolve()}return this.buildAndCommitLocation({...u,href:o,to:n,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const n=this.matchRoutes(this.latestLocation),a=this.stores.cachedMatches.get().filter(o=>!n.some(l=>l.id===o.id));this.batch(()=>{this.stores.status.set("pending"),this.stores.statusCode.set(200),this.stores.isLoading.set(!0),this.stores.location.set(this.latestLocation),this.stores.setPending(n),this.stores.setCached(a)})},this.load=async n=>{const a=n?.action?.type;let o,l,u;const h=this.stores.resolvedLocation.get()??this.stores.location.get();for(u=new Promise(m=>{this.startTransition(async()=>{try{this.beforeLoad(),a?ep.set(this.latestLocation,a):ep.delete(this.latestLocation);const v=this.latestLocation,p=Li(v,this.stores.resolvedLocation.get());
10this.stores.redirect.get()||this.emit({type:"onBeforeNavigate",...p}),this.emit({type:"onBeforeLoad",...p}),await h0({router:this,sync:n?.sync,forceStaleReload:h.href===v.href,matches:this.stores.pendingMatches.get(),location:v,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let b=null,_=null,S=null,R=null;this.batch(()=>{const E=this.stores.pendingMatches.get(),x=E.length,k=this.stores.matches.get();b=x?k.filter(H=>!this.stores.pendingMatchStores.has(H.id)):null;const D=new Set;for(const H of this.stores.pendingMatchStores.values())H.routeId&&D.add(H.routeId);const j=new Set;for(const H of this.stores.matchStores.values())H.routeId&&j.add(H.routeId);_=x?k.filter(H=>!D.has(H.routeId)):null,S=x?E.filter(H=>!j.has(H.routeId)):null,R=x?E.filter(H=>j.has(H.routeId)):k,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),x&&(this.stores.setMatches(E),this.stores.setPending([]),this.stores.setCached([...this.stores.cachedMatches.get(),...b.filter(H=>H.status!=="error"&&H.status!=="notFound"&&H.status!=="redirected")]),this.clearExpiredCache())});for(const[E,x]of[[_,"onLeave"],[S,"onEnter"],[R,"onStay"]])if(E)for(const k of E)this.looseRoutesById[k.routeId].options[x]?.(k)})})}})}catch(v){Xt(v)?(o=v,this.navigate({...o.options,replace:!0,ignoreBlocker:!0})):Ft(v)&&(l=v);const p=o?o.status:l?404:this.stores.matches.get().some(b=>b.status==="error")?500:200;this.batch(()=>{this.stores.statusCode.set(p),this.stores.redirect.set(o)})}this.latestLoadPromise===u&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),m()})}),this.latestLoadPromise=u,await u;this.latestLoadPromise&&u!==this.latestLoadPromise;)await this.latestLoadPromise;let d;this.hasNotFoundMatch()?d=404:this.stores.matches.get().some(m=>m.status==="error")&&(d=500),d!==void 0&&this.stores.statusCode.set(d)},this.startViewTransition=n=>
10{const a=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,a&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let o;if(typeof a=="object"&&this.isViewTransitionTypesSupported){const l=this.latestLocation,u=this.stores.resolvedLocation.get(),h=typeof a.types=="function"?a.types(Li(l,u)):a.types;if(h===!1){n();return}o={update:n,types:h}}else o=n;document.startViewTransition(o)}else n()},this.updateMatch=(n,a)=>{this.startTransition(()=>{const o=this.stores.pendingMatchStores.get(n);if(o){o.set(a);return}const l=this.stores.matchStores.get(n);if(l){l.set(a);return}const u=this.stores.cachedMatchStores.get(n);if(u){const h=a(u.get());h.status==="redirected"?this.stores.cachedMatchStores.delete(n)&&this.stores.cachedIds.set(d=>d.filter(m=>m!==n)):u.set(h)}})},this.getMatch=n=>this.stores.cachedMatchStores.get(n)?.get()??this.stores.pendingMatchStores.get(n)?.get()??this.stores.matchStores.get(n)?.get(),this.invalidate=n=>{const a=o=>n?.filter?.(o)??!0?{...o,invalid:!0,...n?.forcePending||o.status==="error"||o.status==="notFound"?{status:"pending",error:void 0}:void 0}:o;return this.batch(()=>{this.stores.setMatches(this.stores.matches.get().map(a)),this.stores.setCached(this.stores.cachedMatches.get().map(a)),this.stores.setPending(this.stores.pendingMatches.get().map(a))}),this.shouldViewTransition=!1,this.load({sync:n?.sync})},this.getParsedLocationHref=n=>n.publicHref||"/",this.resolveRedirect=n=>{const a=n.headers.get("Location");if(!n.options.href||n.options._builtLocation){const o=n.options._builtLocation??this.buildLocation(n.options),l=this.getParsedLocationHref(o);n.options.href=l,n.headers.set("Location",l)}else if(a)try{const o=new URL(a);if(this.origin&&o.origin===this.origin){const l=o.pathname+o.search+o.hash;n.options.href=l,n.headers.set("Location",l)}}catch{}if(n.options.href&&!n.options._builtLocation&&gu(n.options.href,this.protocolAllowlist))throw new Error("Redirect blocked: unsafe protocol");return n.headers.get("Location")||n.headers.set("Location",n.options.href),n},this.clearCache=n=>{const a=n?.filter;a!==void 0?this.stores.setCached(this.stores.cachedMatches.get().filter(o=>!a(o))):this.stores.setCached([])},this.clearExpiredCache=()=>{const n=Date.now(),a=o=>{const l=this.looseRoutesById[o.routeId];if(!l.options.loader)return!0;const u=(o.preload?l.options.preloadGcTime??this.options.defaultPreloadGcTime:l.options.gcTime??this.options.defaultGcTime)??300*1e3;return o.status==="error"?!0:n-o.updatedAt>=u};this.clearCache({filter:a})},this.loadRouteChunk=il,this.preloadRoute=async n=>{const a=n._builtLocation??this.buildLocation(n);let o=this.matchRoutes(a,{throwOnError:!0,preload:!0,dest:n});const l=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),u=new Set([...l,...this.stores.cachedIds.get()]),h=o.filter(d=>!u.has(d.id));if(h.length){const d=this.stores.cachedMatches.get();this.stores.setCached([...d,...h])}try{return o=await h0({router:this,matches:o,location:a,preload:!0,updateMatch:(d,m)=>{l.has(d)?o=o.map(v=>v.id===d?m(v):v):this.updateMatch(d,m)}}),o}catch(d){if(Xt(d))return d.options.reloadDocument?void 0:await this.preloadRoute({...d.options,_fromLocation:a});Ft(d)||console.error(d);return}},this.matchRoute=(n,a)=>{const o={...n,to:n.to?this.resolvePathWithBase(n.from||"",n.to):void 0,params:n.params||{},leaveParams:!0},l=this.buildLocation(o);if(a?.pending&&this.stores.status.get()!=="pending")return!1;const u=(a?.pending===void 0?!this.stores.isLoading.get():a.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),h=NT(l.pathname,a?.caseSensitive??!1,a?.fuzzy??!1,u.pathname,this.processedTree);return!h||n.params&&!an(h.rawParams,n.params,{partial:!0})?!1:a?.includeSearch??!0?an(u.search,l.search,{partial:!0})?h.rawParams:!1:h.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(n=>n.status==="notFound"||n.globalNotFound),this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??VT,parseSearch:e.parseSearch??GT,protocolAllowlist:e.protocolAllowlist??ET}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}
10isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;const a=this.options.notFoundRoute;a&&(a.init({originalIndex:99999999999}),this.routesById[a.id]=a)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=z_(e),this.routeBranchCache.set(e,t)),t}get looseRoutesById(){return this.routesById}getParentContext(e){return e?.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){const n=this.getMatchedRoutes(e.pathname),{foundRoute:a,routeParams:o}=n;let{matchedRoutes:l}=n,u=!1;(a?a.path!=="/"&&o["**"]:Kr(e.pathname))&&(this.options.notFoundRoute?l=[...l,this.options.notFoundRoute]:u=!0);const h=u?pE(this.options.notFoundMode,l):void 0,d=new Array(l.length),m=new Map;for(const v of this.stores.matchStores.values())v.routeId&&m.set(v.routeId,v.get());for(let v=0;v<l.length;v++){const p=l[v],b=d[v-1];let _,S,R;{const ue=b?.search??e.search,Ce=b?._strictSearch??void 0;try{const Se=du(p.options.validateSearch,{...ue})??void 0;_={...ue,...Se},S={...Ce,...Se},R=void 0}catch(Se){let Le=Se;if(Se instanceof bu||(Le=new bu(Se.message,{cause:Se})),t?.throwOnError)throw Le;_=ue,S={},R=Le}}const E=p.options.loaderDeps?.({search:_})??"",x=E?JSON.stringify(E):"",{interpolatedPath:k,usedParams:D}=l0({path:p.fullPath,params:o,decoder:this.pathParamsDecoder,server:this.isServer}),j=p.id+k+x,H=this.getMatch(j),U=m.get(p.id),B=H?._strictParams??D;let V;if(!H)try{v0(p,B)}catch(ue){if(Ft(ue)||Xt(ue)?V=ue:V=new cE(ue.message,{cause:ue}),t?.throwOnError)throw V}Object.assign(o,B);const W=U?"stay":"enter";let se;if(H)se={...H,cause:W,params:U?.params??o,_strictParams:B,search:ua(U?U.search:H.search,_),_strictSearch:S};else{const ue=p.options.loader||p.options.beforeLoad||p.lazyFn||G_(p)?"pending":"success";se={id:j,ssr:p.options.ssr,index:v,routeId:p.id,params:U?.params??o,_strictParams:B,pathname:k,updatedAt:Date.now(),search:U?ua(U.search,_):_,_strictSearch:S,searchError:void 0,status:ue,isFetching:!1,error:void 0,paramsError:V,__routeContext:void 0,_nonReactive:{loadPromise:Ra()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:W,loaderDeps:U?ba(U.loaderDeps,E):E,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:p.options.staticData||{},fullPath:p.fullPath}}t?.preload||(se.globalNotFound=h===p.id),se.searchError=R;const le=this.getParentContext(b);se.context={...le,...se.__routeContext,...se.__beforeLoadContext},d[v]=se}for(let v=0;v<d.length;v++){const p=d[v],b=this.looseRoutesById[p.routeId],_=this.getMatch(p.id),S=m.get(p.routeId);if(p.params=S?ua(S.params,o):o,!_){const R=d[v-1],E=this.getParentContext(R);if(b.options.context){const x={deps:p.loaderDeps,params:p.params,context:E??{},location:e,navigate:k=>this.navigate({...k,_fromLocation:e}),buildLocation:this.buildLocation,cause:p.cause,abortController:p.abortController,preload:!!p.preload,matches:d,routeId:b.id};p.__routeContext=b.options.context(x)??void 0}p.context={...E,...p.__routeContext,...p.__beforeLoadContext}}}return d}matchRoutesLightweight(e){const{matchedRoutes:t,routeParams:n}=this.getMatchedRoutes(e.pathname),a=rl(t),o={...e.search};for(const m of t)try{Object.assign(o,du(m.options.validateSearch,o))}catch{}const l=rl(this.stores.matchesId.get()),u=l&&this.stores.matchStores.get(l)?.get(),h=u&&u.routeId===a.id&&u.pathname===e.pathname;let d;if(h)d=u.params;else{const m=Object.assign(Object.create(null),n);for(const v of t)try{v0(v,m)}catch{}d=m}return{matchedRoutes:t,fullPath:a.fullPath,search:o,params:d}}},bu=class extends Error{},cE=class extends Error{};function uE(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function du(e,t){if(e==null)return{};if("~standard"in e){const n=e["~standard"].validate(t);if(n instanceof Promise)throw new bu("Async validation not supported");if(n.issues)throw new bu(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function dE({pathname:e,routesById:t,processedTree:n}){const a=Object.create(null),o=Kr(e);let l;const u=LT(o,n,!0);return u&&(l=u.route,Object.assign(a,u.rawParams)),{matchedRoutes:u?.branch||[t.__root__],routeParam
10s:a,foundRoute:l}}function fE({search:e,dest:t,destRoutes:n,_includeValidateSearch:a}){return hE(n)(e,t,a??!1)}function hE(e){let t,n;const a=[];for(const l of e){const u=l.options;if("search"in u)u.search?.middlewares&&a.push(...u.search.middlewares);else if(u.preSearchFilters||u.postSearchFilters){const d=({search:m,next:v})=>{const p=v(u.preSearchFilters?u.preSearchFilters.reduce((b,_)=>_(b),m):m);return u.postSearchFilters?u.postSearchFilters.reduce((b,_)=>_(b),p):p};a.push(d)}const h=u.validateSearch;if(h){const d=({search:m,next:v,meta:p})=>{const b=v(m);if(n)try{const _=du(h,b);if(p&&_)for(const S in _)S in b||(p.defaulted||=new Map).set(S,_[S]);return{...b,..._}}catch{}return b};a.push(d)}}const o=(l,u,h)=>{if(l>=a.length){if(!t.search)return{};if(t.search===!0)return u;const m=va(t.search,u);return h&&(h.explicit=m),m}const d=(m,v)=>{if(v){const p=h||{};return{search:o(l+1,m,p),meta:p}}return o(l+1,m,h)};return a[l]({search:u,next:d,meta:h})};return function(u,h,d){return t=h,n=d,o(0,u)}}function pE(e,t){if(e!=="root")for(let n=t.length-1;n>=0;n--){const a=t[n];if(a.children)return a.id}return Ta}function v0(e,t){const n=e.options.params?.parse??e.options.parseParams;if(n){const a=n(t);if(a===!1)throw new Error("Route params.parse returned false for a matched route");Object.assign(t,a)}}function mE(){try{return sessionStorage}catch{return}}const gE="tsr-scroll-restoration-v1_3",Y_=mE();function yE(){try{return JSON.parse(Y_?.getItem("tsr-scroll-restoration-v1_3")||"{}")}catch{return{}}}function vE(){try{Y_?.setItem(gE,JSON.stringify(xi))}catch{}}const xi=yE(),b0="data-scroll-restoration-id",bE=e=>e.state.__TSR_key||e.href;function _E(e){const t=e.getAttribute(b0);if(t)return`[${b0}="${t}"]`;let n="",a=e,o;for(;o=a.parentNode;){let l=1,u=a;for(;u=u.previousElementSibling;)l++;const h=`${a.localName}:nth-child(${l})`;n=n?`${h} > ${n}`:h,a=o}return n}let Bc=!1;const Ti="window";function tp(e){try{return typeof e=="function"?e():document.querySelector(e)}catch{}}function _0(e){const t=[];for(const n of e){if(n===Ti)continue;const a=tp(n);a&&t.push(a)}return t}function wE(e,t){const n=e.options.scrollRestoration,a=e._scroll;n&&(a.restoring=!0);const o=e.options.getScrollRestorationKey||bE,l=new Map,u=(m,v,p)=>{const b=l.get(m)||{};b.scrollX=v,b.scrollY=p,l.set(m,b)},h=m=>{if(!(Bc||!a.restoring))if(m.target===document)u(Ti,scrollX,scrollY);else{const v=m.target;u(v,v.scrollLeft,v.scrollTop)}},d=m=>{if(!a.restoring)return;const v=xi[m]||={};for(const[p,b]of l)p===Ti?v[Ti]=b:p.isConnected&&(v[_E(p)]=b)};n&&!a.restoration&&(a.restoration=!0,Bc=!1,history.scrollRestoration="manual",document.addEventListener("scroll",h,!0),e.subscribe("onBeforeLoad",m=>{m.fromLocation&&d(o(m.fromLocation)),l.clear()}),addEventListener("pagehide",()=>{d(o(e.stores.resolvedLocation.get()??e.stores.location.get())),vE()})),!a.reset&&(a.reset=!0,e.subscribe("onRendered",m=>{const v=e.options.scrollRestorationBehavior,p=e.options.scrollToTopSelectors,b=a.next;let _;if(l.clear(),b||(a.next=!0),typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation}))return;const S=o(m.toLocation),R=m.fromLocation&&o(m.fromLocation);if(a.restoring&&R&&R!==S){const E=xi[R];if(E){let x=xi[S];for(const k in E){if(k===Ti){if(b)continue}else{const D=tp(k);if(!D||b&&p&&(_??=_0(p),_.includes(D)))continue}x||(x=xi[S]={}),x[k]??=E[k]}}}Bc=!0;try{const E=m.toLocation.hash,x=m.toLocation.state.__hashScrollIntoViewOptions??!0;let k=!1;if(b){const D=ep.get(m.toLocation),j=E&&x&&(D==="PUSH"||D==="REPLACE"),H=a.restoring?xi[S]:void 0;if(H)for(const U in H){const{scrollX:B,scrollY:V}=H[U];if(U===Ti){if(j)continue;scrollTo({top:V,left:B,behavior:v}),k=!0}else{const W=tp(U);W&&(W.scrollLeft=B,W.scrollTop=V)}}if(!k&&!E){const U={top:0,left:0,behavior:v};if(scrollTo(U),p){_??=_0(p);for(const B of _)B.scrollTo(U)}}}!k&&E&&x&&document.getElementById(E)?.scrollIntoView(x)}finally{Bc=!1}}))}const br=Symbol.for("TSR_DEFERRED_PROMISE");function SE(e,t){const n=e;return n[br]||(n[br]={status:"pending"},n.then(a=>{n[br].status="success",n[br].data=a}).catch(a=>{n[br].status="error",n[br].error={data:oE(a),__isServerError:!0}})),n}const xE="Error preloading route! ☝️";function K_(e,t){if(e)return typeof e=="string"?e:e[t]}function TE(e){return e?.scriptFormat??"module"}function EE(e,t,n){const a=RE(t),o=K_(n,"script")??a.crossOrigin;return{...TE(e)==="iife"?{rel:"preload",as:"script"}:{rel:"modulepreload"},href:a.href,...o?{crossOrigin:o}:{}}}function RE(e){return typeof e=="string"?{href:e,crossOrigin:void 0}:e}function Ic(e,t){if(t.length===0)return;if(t.length===1){e.push(t[0]);return}const n=new Set;for(const a of t){const o=JSON.stringify(a);
10n.has(o)||(n.add(o),e.push(a))}}function AE(e){return typeof e=="string"?{href:e,crossOrigin:void 0}:e}var W_=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=t=>{this.originalIndex=t.originalIndex;const n=this.options,a=!n?.path&&!n?.id;this.parentRoute=this.options.getParentRoute?.(),a?this._path=Ta:this.parentRoute||xn();let o=a?Ta:n?.path;o&&o!=="/"&&(o=P_(o));const l=n?.id||o;let u=a?Ta:cu([this.parentRoute.id==="__root__"?"":this.parentRoute.id,l]);o==="__root__"&&(o="/"),u!=="__root__"&&(u=cu(["/",u]));const h=u==="__root__"?"/":cu([this.parentRoute.fullPath,o]);this._path=o,this._id=u,this._fullPath=h,this._to=Kr(h)},this.addChildren=t=>this._addFileChildren(t),this._addFileChildren=t=>(Array.isArray(t)&&(this.children=t),typeof t=="object"&&t!==null&&(this.children=Object.values(t)),this),this._addFileTypes=()=>this,this.updateLoader=t=>(Object.assign(this.options,t),this),this.update=t=>(Object.assign(this.options,t),this),this.lazy=t=>(this.lazyFn=t,this),this.redirect=t=>B_({from:this.fullPath,...t}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}},kE=class extends W_{constructor(e){super(e)}},CE=(e=>(e[e.AggregateError=1]="AggregateError",e[e.ArrowFunction=2]="ArrowFunction",e[e.ErrorPrototypeStack=4]="ErrorPrototypeStack",e[e.ObjectAssign=8]="ObjectAssign",e[e.BigIntTypedArray=16]="BigIntTypedArray",e[e.RegExp=32]="RegExp",e))(CE||{}),Qr=Symbol.asyncIterator,Q_=Symbol.hasInstance,zi=Symbol.isConcatSpreadable,Xr=Symbol.iterator,X_=Symbol.match,J_=Symbol.matchAll,Z_=Symbol.replace,ew=Symbol.search,tw=Symbol.species,nw=Symbol.split,rw=Symbol.toPrimitive,Pi=Symbol.toStringTag,sw=Symbol.unscopables,aw={[Qr]:0,[Q_]:1,[zi]:2,[Xr]:3,[X_]:4,[J_]:5,[Z_]:6,[ew]:7,[tw]:8,[nw]:9,[rw]:10,[Pi]:11,[sw]:12},OE={0:Qr,1:Q_,2:zi,3:Xr,4:X_,5:J_,6:Z_,7:ew,8:tw,9:nw,10:rw,11:Pi,12:sw},C=void 0,jE={2:!0,3:!1,1:C,0:null,4:-0,5:Number.POSITIVE_INFINITY,6:Number.NEGATIVE_INFINITY,7:Number.NaN},DE={0:"Error",1:"EvalError",2:"RangeError",3:"ReferenceError",4:"SyntaxError",5:"TypeError",6:"URIError"},ME={0:Error,1:EvalError,2:RangeError,3:ReferenceError,4:SyntaxError,5:TypeError,6:URIError};function Ge(e,t,n,a,o,l,u,h,d,m,v,p){return{t:e,i:t,s:n,c:a,m:o,p:l,e:u,a:h,f:d,b:m,o:v,l:p}}function Bs(e){return Ge(2,C,e,C,C,C,C,C,C,C,C,C)}var iw=Bs(2),ow=Bs(3),NE=Bs(1),LE=Bs(0),zE=Bs(4),PE=Bs(5),UE=Bs(6),$E=Bs(7);function BE(e){switch(e){case'"':return'\\"';case"\\":return"\\\\";case`
11`:return"\\n";case"\r":return"\\r";case"\b":return"\\b";case"	":return"\\t";case"\f":return"\\f";case"<":return"\\x3C";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:return C}}function Is(e){let t="",n=0,a;for(let o=0,l=e.length;o<l;o++)a=BE(e[o]),a&&(t+=e.slice(n,o)+a,n=o+1);return n===0?t=e:t+=e.slice(n),t}function IE(e){switch(e){case"\\\\":return"\\";case'\\"':return'"';case"\\n":return`
12`;case"\\r":return"\r";case"\\b":return"\b";case"\\t":return"	";case"\\f":return"\f";case"\\x3C":return"<";case"\\u2028":return"\u2028";case"\\u2029":return"\u2029";default:return e}}function Hs(e){return e.replace(/(\\\\|\\"|\\n|\\r|\\b|\\t|\\f|\\u2028|\\u2029|\\x3C)/g,IE)}var Hc="__SEROVAL_REFS__",lw=new Map,Mi=new Map;function cw(e){return lw.has(e)}function HE(e){return Mi.has(e)}function qE(e){if(cw(e))return lw.get(e);throw new _R(e)}function FE(e){if(HE(e))return Mi.get(e);throw new wR(e)}typeof globalThis<"u"?Object.defineProperty(globalThis,Hc,{value:Mi,configurable:!0,writable:!1,enumerable:!1}):typeof window<"u"?Object.defineProperty(window,Hc,{value:Mi,configurable:!0,writable:!1,enumerable:!1}):typeof self<"u"?Object.defineProperty(self,Hc,{value:Mi,configurable:!0,writable:!1,enumerable:!1}):typeof global<"u"&&Object.defineProperty(global,Hc,{value:Mi,configurable:!0,writable:!1,enumerable:!1});function Lp(e){return e instanceof EvalError?1:e instanceof RangeError?2:e instanceof ReferenceError?3:e instanceof SyntaxError?4:e instanceof TypeError?5:e instanceof URIError?6:0}function GE(e){let t=DE[Lp(e)];return e.name!==t?{name:e.name}:e.constructor.name!==t?{name:e.constructor.name}:{}}function uw(e,t){let n=GE(e),a=Object.getOwnPropertyNames(e);for(let o=0,l=a.length,u;o<l;o++)u=a[o],u!=="name"&&u!=="message"&&(u==="stack"?t&4&&(n=n||{},n[u]=e[u]):(n=n||{},n[u]=e[u]));return n}function dw(e){return Object.isFrozen(e)?3:Object.isSealed(e)?2:Object.isExtensible(e)?0:1}
12function VE(e){switch(e){case Number.POSITIVE_INFINITY:return PE;case Number.NEGATIVE_INFINITY:return UE}return e!==e?$E:Object.is(e,-0)?zE:Ge(0,C,e,C,C,C,C,C,C,C,C,C)}function fw(e){return Ge(1,C,Is(e),C,C,C,C,C,C,C,C,C)}function YE(e){return Ge(3,C,""+e,C,C,C,C,C,C,C,C,C)}function KE(e){return Ge(4,e,C,C,C,C,C,C,C,C,C,C)}function WE(e,t){let n=t.valueOf();return Ge(5,e,n!==n?"":t.toISOString(),C,C,C,C,C,C,C,C,C)}function QE(e,t){return Ge(6,e,C,Is(t.source),t.flags,C,C,C,C,C,C,C)}function XE(e,t){return Ge(17,e,aw[t],C,C,C,C,C,C,C,C,C)}function JE(e,t){return Ge(18,e,Is(qE(t)),C,C,C,C,C,C,C,C,C)}function ZE(e,t,n){return Ge(25,e,n,Is(t),C,C,C,C,C,C,C,C)}function eR(e,t,n){return Ge(9,e,C,C,C,C,C,n,C,C,dw(t),C)}function tR(e,t){return Ge(21,e,C,C,C,C,C,C,t,C,C,C)}function nR(e,t,n){return Ge(15,e,C,t.constructor.name,C,C,C,C,n,t.byteOffset,C,t.length)}function rR(e,t,n){return Ge(16,e,C,t.constructor.name,C,C,C,C,n,t.byteOffset,C,t.byteLength)}function sR(e,t,n){return Ge(20,e,C,C,C,C,C,C,n,t.byteOffset,C,t.byteLength)}function aR(e,t,n){return Ge(13,e,Lp(t),C,Is(t.message),n,C,C,C,C,C,C)}function iR(e,t,n){return Ge(14,e,Lp(t),C,Is(t.message),n,C,C,C,C,C,C)}function oR(e,t){return Ge(7,e,C,C,C,C,C,t,C,C,C,C)}function lR(e,t){return Ge(28,C,C,C,C,C,C,[e,t],C,C,C,C)}function cR(e,t){return Ge(30,C,C,C,C,C,C,[e,t],C,C,C,C)}function uR(e,t,n){return Ge(31,e,C,C,C,C,C,n,t,C,C,C)}function dR(e,t){return Ge(32,e,C,C,C,C,C,C,t,C,C,C)}function fR(e,t){return Ge(33,e,C,C,C,C,C,C,t,C,C,C)}function hR(e,t){return Ge(34,e,C,C,C,C,C,C,t,C,C,C)}function pR(e,t,n,a){return Ge(35,e,n,C,C,C,C,t,C,C,C,a)}var mR={parsing:1,serialization:2,deserialization:3};function gR(e){return`Seroval Error (step: ${mR[e]})`}var yR=(e,t)=>gR(e),hw=class extends Error{constructor(e,t){super(yR(e)),this.cause=t}},w0=class extends hw{constructor(e){super("parsing",e)}},vR=class extends hw{constructor(e){super("deserialization",e)}};function Jr(e){return`Seroval Error (specific: ${e})`}var Uu=class extends Error{constructor(t){super(Jr(1)),this.value=t}},pw=class extends Error{constructor(e){super(Jr(2))}},bR=class extends Error{constructor(e){super(Jr(3))}},Sl=class extends Error{constructor(e){super(Jr(4))}},_R=class extends Error{constructor(e){super(Jr(5)),this.value=e}},wR=class extends Error{constructor(e){super(Jr(6))}},SR=class extends Error{constructor(e){super(Jr(7))}},Zr=class extends Error{constructor(e){super(Jr(8))}},xR=class extends Error{constructor(e){super(Jr(9))}},TR=class{constructor(e,t){this.value=e,this.replacement=t}},$u=()=>{let e={p:0,s:0,f:0};return e.p=new Promise((t,n)=>{e.s=t,e.f=n}),e},ER=(e,t)=>{e.s(t),e.p.s=1,e.p.v=t},RR=(e,t)=>{e.f(t),e.p.s=2,e.p.v=t};$u.toString();ER.toString();RR.toString();var AR=()=>{let e=[],t=[],n=!0,a=!1,o=0,l=(d,m,v)=>{for(v=0;v<o;v++)t[v]&&t[v][m](d)},u=(d,m,v,p)=>{for(m=0,v=e.length;m<v;m++)p=e[m],!n&&m===v-1?d[a?"return":"throw"](p):d.next(p)},h=(d,m)=>(n&&(m=o++,t[m]=d),u(d),()=>{n&&(t[m]=t[o],t[o--]=void 0)});return{__SEROVAL_STREAM__:!0,on:d=>h(d),next:d=>{n&&(e.push(d),l(d,"next"))},throw:d=>{n&&(e.push(d),l(d,"throw"),n=!1,a=!1,t.length=0)},return:d=>{n&&(e.push(d),l(d,"return"),n=!1,a=!0,t.length=0)}}},kR=e=>t=>()=>{let n=0,a={[e]:()=>a,next:()=>{if(n>t.d)return{done:!0,value:void 0};let o=n++,l=t.v[o];if(o===t.t)throw l;return{done:o===t.d,value:l}}};return a},CR=(e,t)=>n=>()=>{let a=0,o=-1,l=!1,u=[],h=[],d=(v=0,p=h.length)=>{for(;v<p;v++)h[v].s({done:!0,value:void 0})};n.on({next:v=>{let p=h.shift();p&&p.s({done:!1,value:v}),u.push(v)},throw:v=>{let p=h.shift();p&&p.f(v),d(),o=u.length,l=!0,u.push(v)},return:v=>{let p=h.shift();p&&p.s({done:!0,value:v}),d(),o=u.length,u.push(v)}});let m={[e]:()=>m,next:()=>{if(o===-1){let b=a++;if(b>=u.length){let _=t();return h.push(_),_.p}return{done:!1,value:u[b]}}if(a>o)return{done:!0,value:void 0};let v=a++,p=u[v];if(v!==o)return{done:!1,value:p};if(l)throw p;return{done:!0,value:p}}};return m},mw=e=>{let t=atob(e),n=t.length,a=new Uint8Array(n);for(let o=0;o<n;o++)a[o]=t.charCodeAt(o);return a.buffer};mw.toString();
12function OR(e){return"__SEROVAL_SEQUENCE__"in e}function gw(e,t,n){return{__SEROVAL_SEQUENCE__:!0,v:e,t,d:n}}function jR(e){let t=[],n=-1,a=-1,o=e[Xr]();for(;;)try{let l=o.next();if(t.push(l.value),l.done){a=t.length-1;break}}catch(l){n=t.length,t.push(l)}return gw(t,n,a)}var DR=kR(Xr);function MR(e){return DR(e)}var NR={},LR={},zR={0:{},1:{},2:{},3:{},4:{},5:{}};function PR(e){return"__SEROVAL_STREAM__"in e}function ka(){return AR()}function UR(e){let t=ka(),n=e[Qr]();async function a(){try{let o=await n.next();o.done?t.return(o.value):(t.next(o.value),await a())}catch(o){t.throw(o)}}return a().catch(()=>{}),t}var $R=CR(Qr,$u);function BR(e){return $R(e)}async function IR(e){try{return[1,await e]}catch(t){return[0,t]}}function HR(e,t){return{plugins:t.plugins,mode:e,marked:new Set,features:63^(t.disabledFeatures||0),refs:t.refs||new Map,depthLimit:t.depthLimit||1e3}}function fu(e,t){e.marked.add(t)}function qR(e,t){let n=e.refs.size;return e.refs.set(t,n),n}function Bu(e,t){let n=e.refs.get(t);return n!=null?(fu(e,n),{type:1,value:KE(n)}):{type:0,value:qR(e,t)}}function zp(e,t){let n=Bu(e,t);return n.type===1?n:cw(t)?{type:2,value:JE(n.value,t)}:n}function wa(e,t){let n=zp(e,t);if(n.type!==0)return n.value;if(t in aw)return XE(n.value,t);throw new Uu(t)}function Iu(e,t){let n=Bu(e,zR[t]);return n.type===1?n.value:Ge(26,n.value,t,C,C,C,C,C,C,C,C,C)}function FR(e){let t=Bu(e,NR);return t.type===1?t.value:Ge(27,t.value,C,C,C,C,C,C,wa(e,Xr),C,C,C)}function GR(e){let t=Bu(e,LR);return t.type===1?t.value:Ge(29,t.value,C,C,C,C,C,[Iu(e,1),wa(e,Qr)],C,C,C,C)}
12function VR(e,t,n,a){return Ge(n?11:10,e,C,C,C,a,C,C,C,C,dw(t),C)}function YR(e,t,n,a){return Ge(8,t,C,C,C,C,{k:n,v:a},C,Iu(e,0),C,C,C)}function KR(e,t,n){let a=new Uint8Array(n),o="";for(let l=0,u=a.length;l<u;l++)o+=String.fromCharCode(a[l]);return Ge(19,t,Is(btoa(o)),C,C,C,C,C,Iu(e,5),C,C,C)}function WR(e,t){return{base:HR(e,t),child:void 0}}var QR=class{constructor(e,t){this._p=e,this.depth=t}parse(e){return zt(this._p,this.depth,e)}};async function XR(e,t,n){let a=[];for(let o=0,l=n.length;o<l;o++)o in n?a[o]=await zt(e,t,n[o]):a[o]=0;return a}async function JR(e,t,n,a){return eR(n,a,await XR(e,t,a))}async function Pp(e,t,n){let a=Object.entries(n),o=[],l=[];for(let u=0,h=a.length;u<h;u++)o.push(Is(a[u][0])),l.push(await zt(e,t,a[u][1]));return Xr in n&&(o.push(wa(e.base,Xr)),l.push(lR(FR(e.base),await zt(e,t,jR(n))))),Qr in n&&(o.push(wa(e.base,Qr)),l.push(cR(GR(e.base),await zt(e,t,UR(n))))),Pi in n&&(o.push(wa(e.base,Pi)),l.push(fw(n[Pi]))),zi in n&&(o.push(wa(e.base,zi)),l.push(n[zi]?iw:ow)),{k:o,v:l}}async function bh(e,t,n,a,o){return VR(n,a,o,await Pp(e,t,a))}async function ZR(e,t,n,a){return tR(n,await zt(e,t,a.valueOf()))}async function eA(e,t,n,a){return nR(n,a,await zt(e,t,a.buffer))}async function tA(e,t,n,a){return rR(n,a,await zt(e,t,a.buffer))}async function nA(e,t,n,a){return sR(n,a,await zt(e,t,a.buffer))}async function S0(e,t,n,a){let o=uw(a,e.base.features);return aR(n,a,o?await Pp(e,t,o):C)}async function rA(e,t,n,a){let o=uw(a,e.base.features);return iR(n,a,o?await Pp(e,t,o):C)}async function sA(e,t,n,a){let o=[],l=[];for(let[u,h]of a.entries())o.push(await zt(e,t,u)),l.push(await zt(e,t,h));return YR(e.base,n,o,l)}async function aA(e,t,n,a){let o=[];for(let l of a.keys())o.push(await zt(e,t,l));return oR(n,o)}async function yw(e,t,n,a){let o=e.base.plugins;if(o)for(let l=0,u=o.length;l<u;l++){let h=o[l];if(h.parse.async&&h.test(a))return ZE(n,h.tag,await h.parse.async(a,new QR(e,t),{id:n}))}return C}async function iA(e,t,n,a){let[o,l]=await IR(a);return Ge(12,n,o,C,C,C,C,C,await zt(e,t,l),C,C,C)}function oA(e,t,n,a,o){let l=[],u=n.on({next:h=>{fu(this.base,t),zt(this,e,h).then(d=>{l.push(dR(t,d))},d=>{o(d),u()})},throw:h=>{fu(this.base,t),zt(this,e,h).then(d=>{l.push(fR(t,d)),a(l),u()},d=>{o(d),u()})},return:h=>{fu(this.base,t),zt(this,e,h).then(d=>{l.push(hR(t,d)),a(l),u()},d=>{o(d),u()})}})}async function lA(e,t,n,a){return uR(n,Iu(e.base,4),await new Promise(oA.bind(e,t,n,a)))}async function cA(e,t,n,a){let o=[];for(let l=0,u=a.v.length;l<u;l++)o[l]=await zt(e,t,a.v[l]);return pR(n,o,a.t,a.d)}async function uA(e,t,n,a){if(Array.isArray(a))return JR(e,t,n,a);if(PR(a))return lA(e,t,n,a);if(OR(a))return cA(e,t,n,a);let o=a.constructor;if(o===TR)return zt(e,t,a.replacement);let l=await yw(e,t,n,a);if(l)return l;switch(o){case Object:return bh(e,t,n,a,!1);case C:return bh(e,t,n,a,!0);case Date:return WE(n,a);case Error:case EvalError:case RangeError:case ReferenceError:case SyntaxError:case TypeError:case URIError:return S0(e,t,n,a);case Number:case Boolean:case String:case BigInt:return ZR(e,t,n,a);case ArrayBuffer:return KR(e.base,n,a);case Int8Array:case Int16Array:case Int32Array:case Uint8Array:case Uint16Array:case Uint32Array:case Uint8ClampedArray:case Float32Array:case Float64Array:return eA(e,t,n,a);case DataView:return nA(e,t,n,a);case Map:return sA(e,t,n,a);case Set:return aA(e,t,n,a)}if(o===Promise||a instanceof Promise)return iA(e,t,n,a);let u=e.base.features;if(u&32&&o===RegExp)return QE(n,a);if(u&16)switch(o){case BigInt64Array:case BigUint64Array:return tA(e,t,n,a)}if(u&1&&typeof AggregateError<"u"&&(o===AggregateError||a instanceof AggregateError))return rA(e,t,n,a);if(a instanceof Error)return S0(e,t,n,a);if(Xr in a||Qr in a)return bh(e,t,n,a,!!o);throw new Uu(a)}async function dA(e,t,n){let a=zp(e.base,n);if(a.type!==0)return a.value;let o=await yw(e,t,a.value,n);if(o)return o;throw new Uu(n)}async function zt(e,t,n){switch(typeof n){case"boolean":return n?iw:ow;case"undefined":return NE;case"string":return fw(n);case"number":return VE(n);case"bigint":return YE(n);case"object":{if(n){let a=zp(e.base,n);
12return a.type===0?await uA(e,t+1,a.value,n):a.value}return LE}case"symbol":return wa(e.base,n);case"function":return dA(e,t,n);default:throw new Uu(n)}}async function fA(e,t){try{return await zt(e,0,t)}catch(n){throw n instanceof w0?n:new w0(n)}}var hA=(e=>(e[e.Vanilla=1]="Vanilla",e[e.Cross=2]="Cross",e))(hA||{});function vw(e,t){for(let n=0,a=t.length;n<a;n++){let o=t[n];e.has(o)||(e.add(o),o.extends&&vw(e,o.extends))}}function bw(e){if(e){let t=new Set;return vw(t,e),[...t]}}function pA(e){switch(e){case"Int8Array":return Int8Array;case"Int16Array":return Int16Array;case"Int32Array":return Int32Array;case"Uint8Array":return Uint8Array;case"Uint16Array":return Uint16Array;case"Uint32Array":return Uint32Array;case"Uint8ClampedArray":return Uint8ClampedArray;case"Float32Array":return Float32Array;case"Float64Array":return Float64Array;case"BigInt64Array":return BigInt64Array;case"BigUint64Array":return BigUint64Array;default:throw new SR(e)}}var mA=1e6,gA=1e4,yA=2e4;function _w(e,t){switch(t){case 3:return Object.freeze(e);case 1:return Object.preventExtensions(e);case 2:return Object.seal(e);default:return e}}var vA=1e3;function bA(e,t){var n;let a=t.refs||new Map;return"types"in a||Object.assign(a,{types:new Map}),{mode:e,plugins:t.plugins,refs:a,features:(n=t.features)!=null?n:63^(t.disabledFeatures||0),depthLimit:t.depthLimit||vA}}function _A(e){return{mode:2,base:bA(2,e),child:C}}var wA=class{constructor(e,t){this._p=e,this.depth=t}deserialize(e){return rt(this._p,this.depth,e)}};function ww(e,t){if(t<0||!Number.isFinite(t)||!Number.isInteger(t))throw new Zr({t:4,i:t});if(e.refs.has(t))throw new Error("Conflicted ref id: "+t)}function SA(e,t,n){return ww(e.base,t),e.state.marked.has(t)&&e.base.refs.set(t,n),n}function xA(e,t,n){return ww(e.base,t),e.base.refs.set(t,n),n}function Pt(e,t,n){return e.mode===1?SA(e,t,n):xA(e,t,n)}
12function np(e,t,n){if(Object.hasOwn(t,n))return t[n];throw new Zr(e)}function TA(e,t){return Pt(e,t.i,FE(Hs(t.s)))}function EA(e,t,n){let a=n.a,o=a.length,l=Pt(e,n.i,new Array(o));for(let u=0,h;u<o;u++)h=a[u],h&&(l[u]=rt(e,t,h));return _w(l,n.o),l}function RA(e){switch(e){case"constructor":case"__proto__":case"prototype":case"__defineGetter__":case"__defineSetter__":case"__lookupGetter__":case"__lookupSetter__":return!1;default:return!0}}function AA(e){switch(e){case Qr:case zi:case Pi:case Xr:return!0;default:return!1}}function x0(e,t,n){RA(t)?e[t]=n:Object.defineProperty(e,t,{value:n,configurable:!0,enumerable:!0,writable:!0})}function kA(e,t,n,a,o){if(typeof a=="string")x0(n,Hs(a),rt(e,t,o));else{let l=rt(e,t,a);switch(typeof l){case"string":x0(n,l,rt(e,t,o));break;case"symbol":AA(l)&&(n[l]=rt(e,t,o));break;default:throw new Zr(a)}}}function Sw(e,t,n){e.base.refs.types.set(t,n)}function xl(e,t,n,a){if(e.base.refs.types.get(n)!==a)throw new Zr(t)}function xw(e,t,n,a){let o=n.k;if(o.length>0)for(let l=0,u=n.v,h=o.length;l<h;l++)kA(e,t,a,o[l],u[l]);return a}function CA(e,t,n){let a=Pt(e,n.i,n.t===10?{}:Object.create(null));return xw(e,t,n.p,a),_w(a,n.o),a}function OA(e,t){return Pt(e,t.i,new Date(t.s))}function jA(e,t){if(e.base.features&32){let n=Hs(t.c);if(n.length>yA)throw new Zr(t);return Pt(e,t.i,new RegExp(n,t.m))}throw new pw(t)}function DA(e,t,n){let a=Pt(e,n.i,new Set);for(let o=0,l=n.a,u=l.length;o<u;o++)a.add(rt(e,t,l[o]));return a}function MA(e,t,n){let a=Pt(e,n.i,new Map);for(let o=0,l=n.e.k,u=n.e.v,h=l.length;o<h;o++)a.set(rt(e,t,l[o]),rt(e,t,u[o]));return a}function NA(e,t){if(t.s.length>mA)throw new Zr(t);return Pt(e,t.i,mw(Hs(t.s)))}function LA(e,t,n){var a;let o=pA(n.c),l=rt(e,t,n.f),u=(a=n.b)!=null?a:0;if(u<0||u>l.byteLength)throw new Zr(n);return Pt(e,n.i,new o(l,u,n.l))}function zA(e,t,n){var a;let o=rt(e,t,n.f),l=(a=n.b)!=null?a:0;if(l<0||l>o.byteLength)throw new Zr(n);return Pt(e,n.i,new DataView(o,l,n.l))}function Tw(e,t,n,a){if(n.p){let o=xw(e,t,n.p,{});Object.defineProperties(a,Object.getOwnPropertyDescriptors(o))}return a}function PA(e,t,n){let a=Pt(e,n.i,new AggregateError([],Hs(n.m)));return Tw(e,t,n,a)}function UA(e,t,n){let a=np(n,ME,n.s),o=Pt(e,n.i,new a(Hs(n.m)));return Tw(e,t,n,o)}function $A(e,t,n){let a=$u(),o=Pt(e,n.i,a.p),l=rt(e,t,n.f);return n.s?a.s(l):a.f(l),o}function BA(e,t,n){return Pt(e,n.i,Object(rt(e,t,n.f)))}function IA(e,t,n){let a=e.base.plugins;if(a){let o=Hs(n.c);for(let l=0,u=a.length;l<u;l++){let h=a[l];if(h.tag===o)return Pt(e,n.i,h.deserialize(n.s,new wA(e,t),{id:n.i}))}}throw new bR(n.c)}function HA(e,t){let n=Pt(e,t.i,Pt(e,t.s,$u()).p);return Sw(e,t.s,22),n}function qA(e,t,n){let a=e.base.refs.get(n.i);if(a)return xl(e,n,n.i,22),a.s(rt(e,t,n.a[1])),C;throw new Sl("Promise")}function FA(e,t,n){let a=e.base.refs.get(n.i);if(a)return xl(e,n,n.i,22),a.f(rt(e,t,n.a[1])),C;throw new Sl("Promise")}function GA(e,t,n){rt(e,t,n.a[0]);let a=rt(e,t,n.a[1]);return MR(a)}function VA(e,t,n){rt(e,t,n.a[0]);let a=rt(e,t,n.a[1]);return BR(a)}function YA(e,t,n){let a=Pt(e,n.i,ka());Sw(e,n.i,31);let o=n.a,l=o.length;if(l)for(let u=0;u<l;u++)rt(e,t,o[u]);return a}function KA(e,t,n){let a=e.base.refs.get(n.i);if(a)return xl(e,n,n.i,31),a.next(rt(e,t,n.f)),C;throw new Sl("Stream")}function WA(e,t,n){let a=e.base.refs.get(n.i);if(a)return xl(e,n,n.i,31),a.throw(rt(e,t,n.f)),C;throw new Sl("Stream")}function QA(e,t,n){let a=e.base.refs.get(n.i);if(a)return xl(e,n,n.i,31),a.return(rt(e,t,n.f)),C;throw new Sl("Stream")}function XA(e,t,n){return rt(e,t,n.f),C}function JA(e,t,n){return rt(e,t,n.a[1]),C}function ZA(e,t,n){let a=Pt(e,n.i,gw([],n.s,n.l));for(let o=0,l=n.a.length;o<l;o++)a.v[o]=rt(e,t,n.a[o]);return a}function rt(e,t,n){if(t>e.base.depthLimit)throw new xR(e.base.depthLimit);switch(t+=1,n.t){case 2:return np(n,jE,n.s);case 0:return Number(n.s);case 1:return Hs(String(n.s));case 3:if(String(n.s).length>gA)throw new Zr(n);return BigInt(n.s);case 4:return e.base.refs.get(n.i);case 18:return TA(e,n);case 9:return EA(e,t,n);case 10:case 11:return CA(e,t,n);case 5:return OA(e,n);case 6:return jA(e,n);case 7:return DA(e,t,n);case 8:return MA(e,t,n);case 19:return NA(e,n);case 16:case 15:return LA(e,t,n);case 20:return zA(e,t,n);case 14:return PA(e,t,n);case 13:return UA(e,t,n);case 12:return $A(e,t,n);case 17:return np(n,OE,n.s);case 21:return BA(e,t,n);case 25:return IA(e,t,n);case 22:return HA(e,n);case 23:return qA(e,t,n);case 24:return FA(e,t,n);case 28:return GA(e,t,n);case 30:return VA(e,t,n);case 31:return YA(e,t,n);case 32:return KA(e,t,n);case 33:return WA(e,t,n);case 34:return QA(e,t,n);case 27:return XA(e,t,n);case 29:return JA(e,t,n);case 35:return ZA(e,t,n);default:throw new pw(n)}}function ek(e,t){try{return rt(e,0,t)}catch(n){throw new vR(n)}}var tk=()=>T;tk.toString();function T0(e,t){let n=bw(t.plugins),a=_A({plugins:n,refs:t.refs,features:t.features,disabledFeatures:t.disabledFeatures,depthLimit:t.depthLimit});return ek(a,e)}async function nk(e,t={}){let n=bw(t.plugins),a=WR(1,{plugins:n,disabledFeatures:t.disabledFeatures});return{t:await fA(a,e),f:a.base.features,m:Array.from(a.base.marked)}}function rk(e){return{tag:"$TSR/t/"+e.key,test:e.test,parse:{sync(t,n,a){return{v:n.parse(e.toSerializable(t))}},async async(t,n,a){return{v:await n.parse(e.toSerializable(t))}},stream(t,n,a){return{v:n.parse(e.toSerializable(t))}}},serialize:void 0,deserialize(t,n,a){return e.fromSerializable(n.deserialize(t.v))}}}var sk=class{constructor(e,t){this.stream=e,this.hint=t?.hint??"binary"}};const _u=globalThis.Buffer,Ew=!!_u&&typeof _u.from=="function";function Rw(e){if(e.length===0)return"";if(Ew)return _u.from(e).toString("base64");const t=32768,n=[];for(let a=0;a<e.length;a+=t){const o=e.subarray(a,a+t);n.push(String.fromCharCode.apply(null,o))}return btoa(n.join(""))}function Aw(e){if(e.length===0)return new Uint8Array(0);if(Ew){const a=_u.from(e,"base64");return new Uint8Array(a.buffer,a.byteOffset,a.byteLength)}const t=atob(e),n=new Uint8Array(t.length);for(let a=0;a<t.length;a++)n[a]=t.charCodeAt(a);return n}const zo=Object.create(null),Po=Object.create(null),ak=e=>new ReadableStream({start(t){e.on({next(n){try{t.enqueue(Aw(n))}catch{}},throw(n){t.error(n)},return(){try{t.close()}catch{}}})}}),ik=new TextEncoder,ok=e=>new ReadableStream({start(t){e.on({next(n){try{typeof n=="string"?t.enqueue(ik.encode(n)):t.enqueue(Aw(n.$b64))}catch{}},throw(n){t.error(n)},return(){try{t.close()}catch{}}})}}),lk="(s=>new ReadableStream({start(c){s.on({next(b){try{const d=atob(b),a=new Uint8Array(d.length);for(let i=0;i<d.length;
12i++)a[i]=d.charCodeAt(i);c.enqueue(a)}catch(_){}},throw(e){c.error(e)},return(){try{c.close()}catch(_){}}})}}))",ck="(s=>{const e=new TextEncoder();return new ReadableStream({start(c){s.on({next(v){try{if(typeof v==='string'){c.enqueue(e.encode(v))}else{const d=atob(v.$b64),a=new Uint8Array(d.length);for(let i=0;i<d.length;i++)a[i]=d.charCodeAt(i);c.enqueue(a)}}catch(_){}},throw(x){c.error(x)},return(){try{c.close()}catch(_){}}})}})})";function E0(e){const t=ka(),n=e.getReader();return(async()=>{try{for(;;){const{done:a,value:o}=await n.read();if(a){t.return(void 0);break}t.next(Rw(o))}}catch(a){t.throw(a)}finally{n.releaseLock()}})(),t}function R0(e){const t=ka(),n=e.getReader(),a=new TextDecoder("utf-8",{fatal:!0});return(async()=>{try{for(;;){const{done:o,value:l}=await n.read();if(o){try{const u=a.decode();u.length>0&&t.next(u)}catch{}t.return(void 0);break}try{const u=a.decode(l,{stream:!0});u.length>0&&t.next(u)}catch{t.next({$b64:Rw(l)})}}}catch(o){t.throw(o)}finally{n.releaseLock()}})(),t}const uk={tag:"tss/RawStream",extends:[{tag:"tss/RawStreamFactory",test(e){return e===zo},parse:{sync(e,t,n){return{}},async async(e,t,n){return{}},stream(e,t,n){return{}}},serialize(e,t,n){return lk},deserialize(e,t,n){return zo}},{tag:"tss/RawStreamFactoryText",test(e){return e===Po},parse:{sync(e,t,n){return{}},async async(e,t,n){return{}},stream(e,t,n){return{}}},serialize(e,t,n){return ck},deserialize(e,t,n){return Po}}],test(e){return e instanceof sk},parse:{sync(e,t,n){const a=e.hint==="text"?Po:zo;return{hint:t.parse(e.hint),factory:t.parse(a),stream:t.parse(ka())}},async async(e,t,n){const a=e.hint==="text"?Po:zo,o=e.hint==="text"?R0(e.stream):E0(e.stream);return{hint:await t.parse(e.hint),factory:await t.parse(a),stream:await t.parse(o)}},stream(e,t,n){const a=e.hint==="text"?Po:zo,o=e.hint==="text"?R0(e.stream):E0(e.stream);return{hint:t.parse(e.hint),factory:t.parse(a),stream:t.parse(o)}}},serialize(e,t,n){return"("+t.serialize(e.factory)+")("+t.serialize(e.stream)+")"},deserialize(e,t,n){const a=t.deserialize(e.stream);return t.deserialize(e.hint)==="text"?ok(a):ak(a)}};function dk(e){return{tag:"tss/RawStream",test:()=>!1,parse:{},serialize(){throw new Error("RawStreamDeserializePlugin.serialize should not be called. Client only deserializes.")},deserialize(t,n,a){return e(typeof n?.deserialize=="function"?n.deserialize(t.streamId):t.streamId)}}}const fk={tag:"$TSR/Error",test(e){return e instanceof Error},parse:{sync(e,t){return{message:t.parse(e.message)}},async async(e,t){return{message:await t.parse(e.message)}},stream(e,t){return{message:t.parse(e.message)}}},serialize(e,t){return"new Error("+t.serialize(e.message)+")"},deserialize(e,t){return new Error(t.deserialize(e.message))}};var Cs={},kw=e=>new ReadableStream({start:t=>{e.on({next:n=>{try{t.enqueue(n)}catch{}},throw:n=>{t.error(n)},return:()=>{try{t.close()}catch{}}})}}),hk={tag:"seroval-plugins/web/ReadableStreamFactory",test(e){return e===Cs},parse:{sync(){return Cs},async async(){return await Promise.resolve(Cs)},stream(){return Cs}},serialize(){return kw.toString()},deserialize(){return Cs}};function A0(e){let t=ka(),n=e.getReader();async function a(){try{let o=await n.read();o.done?t.return(o.value):(t.next(o.value),await a())}catch(o){t.throw(o)}}return a().catch(()=>{}),t}var pk={tag:"seroval/plugins/web/ReadableStream",extends:[hk],test(e){return typeof ReadableStream>"u"?!1:e instanceof ReadableStream},parse:{sync(e,t){return{factory:t.parse(Cs),stream:t.parse(ka())}},async async(e,t){return{factory:await t.parse(Cs),stream:await t.parse(A0(e))}},stream(e,t){return{factory:t.parse(Cs),stream:t.parse(A0(e))}}},serialize(e,t){return"("+t.serialize(e.factory)+")("+t.serialize(e.stream)+")"},deserialize(e,t){let n=t.deserialize(e.stream);return kw(n)}},mk=pk;const gk=[fk,uk,mk];function yk(){return[...jp()?.serializationAdapters?.map(rk)??[],...gk]}var k0=new TextDecoder,vk=new Uint8Array(0),C0=16*1024*1024,O0=32*1024*1024,j0=1024,D0=1e5;function bk(e){const t=new Map,n=new Map,a=new Set;let o=!1,l=null,u=0,h;const d=new ReadableStream({start(p){h=p},cancel(){o=!0;try{l?.cancel()}catch{}t.forEach(p=>{try{p.error(new Error("Framed response cancelled"))}catch{}}),t.clear(),n.clear(),a.clear()}});function m(p){const b=n.get(p);if(b)return b;if(a.has(p))return new ReadableStream({start(S){S.close()}});if(n.size>
12=j0)throw new Error(`Too many raw streams in framed response (max ${j0})`);const _=new ReadableStream({start(S){t.set(p,S)},cancel(){a.add(p),t.delete(p),n.delete(p)}});return n.set(p,_),_}function v(p){return m(p),t.get(p)}return(async()=>{const p=e.getReader();l=p;const b=[];let _=0;function S(){if(_<9)return null;const E=b[0];if(E.length>=9)return{type:E[0],streamId:(E[1]<<24|E[2]<<16|E[3]<<8|E[4])>>>0,length:(E[5]<<24|E[6]<<16|E[7]<<8|E[8])>>>0};const x=new Uint8Array(9);let k=0,D=9;for(let j=0;j<b.length&&D>0;j++){const H=b[j],U=Math.min(H.length,D);x.set(H.subarray(0,U),k),k+=U,D-=U}return{type:x[0],streamId:(x[1]<<24|x[2]<<16|x[3]<<8|x[4])>>>0,length:(x[5]<<24|x[6]<<16|x[7]<<8|x[8])>>>0}}function R(E){if(E===0)return vk;const x=new Uint8Array(E);let k=0,D=E;for(;D>0&&b.length>0;){const j=b[0];if(!j)break;const H=Math.min(j.length,D);x.set(j.subarray(0,H),k),k+=H,D-=H,H===j.length?b.shift():b[0]=j.subarray(H)}return _-=E,x}try{for(;;){const{done:E,value:x}=await p.read();if(o||E)break;if(x){if(_+x.length>O0)throw new Error(`Framed response buffer exceeded ${O0} bytes`);for(b.push(x),_+=x.length;;){const k=S();if(!k)break;const{type:D,streamId:j,length:H}=k;if(D!==qr.JSON&&D!==qr.CHUNK&&D!==qr.END&&D!==qr.ERROR)throw new Error(`Unknown frame type: ${D}`);if(D===qr.JSON){if(j!==0)throw new Error("Invalid JSON frame streamId (expected 0)")}else if(j===0)throw new Error("Invalid raw frame streamId (expected non-zero)");if(H>C0)throw new Error(`Frame payload too large: ${H} bytes (max ${C0})`);const U=9+H;if(_<U)break;if(++u>D0)throw new Error(`Too many frames in framed response (max ${D0})`);R(9);const B=R(H);switch(D){case qr.JSON:try{h.enqueue(k0.decode(B))}catch{}break;case qr.CHUNK:{const V=v(j);V&&V.enqueue(B);break}case qr.END:{const V=v(j);if(a.add(j),V){try{V.close()}catch{}t.delete(j)}break}case qr.ERROR:{const V=v(j);if(a.add(j),V){const W=k0.decode(B);V.error(new Error(W)),t.delete(j)}break}}}}}if(_!==0)throw new Error("Incomplete frame at end of framed response");try{h.close()}catch{}t.forEach(E=>{try{E.close()}catch{}}),t.clear()}catch(E){try{h.error(E)}catch{}t.forEach(x=>{try{x.error(E)}catch{}}),t.clear()}finally{try{p.releaseLock()}catch{}l=null}})(),{getOrCreateStream:m,jsonChunks:d}}var ol=null;async function rp(e){e.length>0&&await Promise.allSettled(e)}var _k=Object.prototype.hasOwnProperty;function Cw(e){for(const t in e)if(_k.call(e,t))return!0;return!1}async function wk(e,t,n){ol||(ol=yk());const a=t[0],o=a.fetch??n,l=a.data instanceof FormData?"formData":"payload",u=a.headers?new Headers(a.headers):new Headers;if(u.set("x-tsr-serverFn","true"),l==="payload"&&u.set("accept",`${yT}, application/x-ndjson, application/json`),a.method==="GET"){if(l==="formData")throw new Error("FormData is not supported with GET requests");const d=await Ow(a);if(d!==void 0){const m=$_({payload:d});e.includes("?")?e+=`&${m}`:e+=`?${m}`}}let h;if(a.method==="POST"){const d=await Sk(a);d?.contentType&&u.set("content-type",d.contentType),h=d?.body}return await xk(async()=>o(e,{method:a.method,headers:u,signal:a.signal,body:h}))}async function Ow(e){let t=!1;const n={};if(e.data!==void 0&&(t=!0,n.data=e.data),e.context&&Cw(e.context)&&(t=!0,n.context=e.context),t)return jw(n)}async function jw(e){return JSON.stringify(await Promise.resolve(nk(e,{plugins:ol})))}async function Sk(e){if(e.data instanceof FormData){let n;return e.context&&Cw(e.context)&&(n=await jw(e.context)),n!==void 0&&e.data.set(gT,n),{body:e.data}}const t=await Ow(e);if(t)return{body:t,contentType:"application/json"}}async function xk(e){let t;try{t=await e()}catch(a){if(a instanceof Response)t=a;else throw console.log(a),a}if(t.headers.get("x-tss-raw")==="true")return t;const n=t.headers.get("content-type");if(n||xn(),t.headers.get("x-tss-serialized")){let a;if(n.includes("application/x-tss-framed")){if(_T(n),!t.body)throw new Error("No response body for framed response");const{getOrCreateStream:o,jsonChunks:l}=bk(t.body),u=[dk(o),...ol||[]],h=new Map;a=await Tk({jsonStream:l,onMessage:d=>T0(d,{refs:h,plugins:u}),onError(d,m){console.error(d,m)}})}else if(n.includes("application/json")){const o=await t.json(),l=[];a=T0(o,{plugins:ol}),await rp(l)}if(a||xn(),a instanceof Error)throw a;return a}if(n.includes("application/json")){const a=await t.json(),o=I_(a);if(o)throw o;if(Ft(a))throw a;return a}if(!t.ok)throw new Error(await t.text());return t}async function Tk({jsonStream:e,onMessage:t,onError:n}){const a=e.getReader(),{value:o,done:l}=await a.read();if(l||!o)throw new Error("Stream ended before first object");const u=JSON.parse(o);let h=!1;const d=(async()=>{try{for(;;){const{value:p,done:b}=await a.read();if(b)break;
12if(p)try{const _=[];try{t(JSON.parse(p))}finally{}await rp(_)}catch(_){n?.(`Invalid JSON: ${p}`,_)}}}catch(p){h||n?.("Stream processing error:",p)}})();let m;const v=[];try{m=t(u)}catch(p){throw h=!0,a.cancel().catch(()=>{}),p}return await rp(v),Promise.resolve(m).catch(()=>{h=!0,a.cancel().catch(()=>{})}),d.finally(()=>{try{a.releaseLock()}catch{}}),m}function qs(e){const t="/_serverFn/"+e;return Object.assign((...o)=>{const l=jp()?.serverFns?.fetch;return wk(t,o,l??fetch)},{url:t,serverFnMeta:{id:e},[Xh]:!0})}var Ek={key:"$TSS/serverfn",test:e=>typeof e!="function"||!(Xh in e)?!1:!!e[Xh],toSerializable:({serverFnMeta:e})=>({functionId:e.id}),fromSerializable:({functionId:e})=>qs(e)};function Dw(e){if(Array.isArray(e))return e.flatMap(v=>Dw(v));if(typeof e!="string")return[];const t=[];let n=0,a,o,l,u,h;const d=()=>{for(;n<e.length&&/\s/.test(e.charAt(n));)n+=1;return n<e.length},m=()=>(o=e.charAt(n),o!=="="&&o!==";"&&o!==",");for(;n<e.length;){for(a=n,h=!1;d();)if(o=e.charAt(n),o===","){for(l=n,n+=1,d(),u=n;n<e.length&&m();)n+=1;n<e.length&&e.charAt(n)==="="?(h=!0,n=u,t.push(e.slice(a,l)),a=n):n=l+1}else n+=1;(!h||n>=e.length)&&t.push(e.slice(a))}return t}function Rk(e){return e instanceof Headers?e:Array.isArray(e)?new Headers(e):typeof e=="object"?new Headers(e):null}function Ak(...e){return e.reduce((t,n)=>{const a=Rk(n);if(!a)return t;for(const[o,l]of a.entries())o==="set-cookie"?Dw(l).forEach(u=>t.append("set-cookie",u)):t.set(o,l);return t},new Headers)}function M0(e){return e.replaceAll("\0","/").replaceAll("�","/")}function kk(e,t){e.id=t.i,e.__beforeLoadContext=t.b,e.loaderData=t.l,e.status=t.s,e.ssr=t.ssr,e.updatedAt=t.u,e.error=t.e,t.g!==void 0&&(e.globalNotFound=t.g)}async function Ck(e){window.$_TSR||xn();const t=e.options.serializationAdapters;if(t?.length){const E=new Map;t.forEach(x=>{E.set(x.key,x.fromSerializable)}),window.$_TSR.t=E,window.$_TSR.buffer.forEach(x=>x())}window.$_TSR.initialized=!0,window.$_TSR.router||xn();const n=window.$_TSR.router;n.matches.forEach(E=>{E.i=M0(E.i)}),n.lastMatchId&&(n.lastMatchId=M0(n.lastMatchId));const{manifest:a,dehydratedData:o,lastMatchId:l}=n;e.ssr={manifest:a};const u=document.querySelector('meta[property="csp-nonce"]')?.content;e.options.ssr={nonce:u},await e.options.hydrate?.(o);const h=e.matchRoutes(e.stores.location.get()),d=Promise.all(h.map(E=>e.loadRouteChunk(e.looseRoutesById[E.routeId])));function m(E){const x=e.looseRoutesById[E.routeId].options.pendingMinMs??e.options.defaultPendingMinMs;if(x){const k=Ra();E._nonReactive.minPendingPromise=k,E._forcePending=!0,setTimeout(()=>{k.resolve(),e.updateMatch(E.id,D=>(D._nonReactive.minPendingPromise=void 0,{...D,_forcePending:void 0}))},x)}}function v(E){const x=e.looseRoutesById[E.routeId];x&&(x.options.ssr=E.ssr)}let p;h.forEach(E=>{const x=n.matches.find(k=>k.i===E.id);if(!x){E._nonReactive.dehydrated=!1,E.ssr=!1,v(E);return}kk(E,x),v(E),E._nonReactive.dehydrated=E.ssr!==!1,(E.ssr==="data-only"||E.ssr===!1)&&p===void 0&&(p=E.index,m(E))}),e.stores.setMatches(h);const b=e.stores.matches.get(),_=e.stores.location.get();await Promise.all(b.map(async E=>{try{const x=e.looseRoutesById[E.routeId],k=b[E.index-1]?.context??e.options.context;if(x.options.context){const U={deps:E.loaderDeps,params:E.params,context:k??{},location:_,navigate:B=>e.navigate({...B,_fromLocation:_}),buildLocation:e.buildLocation,cause:E.cause,abortController:E.abortController,preload:!1,matches:h,routeId:x.id};E.__routeContext=x.options.context(U)??void 0}E.context={...k,...E.__routeContext,...E.__beforeLoadContext};const D={ssr:e.options.ssr,matches:b,match:E,params:E.params,loaderData:E.loaderData},j=await x.options.head?.(D),H=await x.options.scripts?.(D);E.meta=j?.meta,E.links=j?.links,E.headScripts=j?.scripts,E.styles=j?.styles,E.scripts=H}catch(x){if(Ft(x))E.error={isNotFound:!0},console.error(`NotFound error during hydration for routeId: ${E.routeId}`,x);else throw E.error=x,console.error(`Error during hydration for route ${E.routeId}:`,x),x}}));const S=h[h.length-1].id!==l;if(!h.some(E=>E.ssr===!1)&&!S)return h.forEach(E=>{E._nonReactive.dehydrated=void 0}),e.stores.resolvedLocation.set(e.stores.location.get()),d;const R=Promise.resolve().then(()=>e.load()).catch(E=>{console.error("Error during router hydration:",E)});if(S){const E=h[1];E||xn(),m(E),E._displayPending=!0,E._nonReactive.displayPendingPromise=
12R,R.then(()=>{e.batch(()=>{e.stores.status.get()==="pending"&&(e.stores.status.set("idle"),e.stores.resolvedLocation.set(e.stores.location.get())),e.updateMatch(E.id,x=>({...x,_displayPending:void 0,displayPendingPromise:void 0}))})})}return d}var wu=O.use,Vo=typeof window<"u"?O.useLayoutEffect:O.useEffect;function _h(e){const t=O.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function Ok(e,t,n={},a={}){O.useEffect(()=>{if(!e.current||a.disabled||typeof IntersectionObserver!="function")return;const o=new IntersectionObserver(([l])=>{t(l)},n);return o.observe(e.current),()=>{o.disconnect()}},[t,n,a.disabled,e])}function jk(e){const t=O.useRef(null);return O.useImperativeHandle(e,()=>t.current,[]),t}function Dk({promise:e}){if(wu)return wu(e);const t=SE(e);if(t[br].status==="pending")throw t;if(t[br].status==="error")throw t[br].error;return t[br].data}function Mk(e){const t=y.jsx(Nk,{...e});return e.fallback?y.jsx(O.Suspense,{fallback:e.fallback,children:t}):t}function Nk(e){const t=Dk(e);return e.children(t)}function Up(e){const t=e.errorComponent??$p;return y.jsx(Lk,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:a})=>n?O.createElement(t,{error:n,reset:a}):e.children})}var Lk=class extends O.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){const n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function $p({error:e}){const[t,n]=O.useState(!1);return y.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[y.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),y.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(a=>!a),children:t?"Hide Error":"Show Error"})]}),y.jsx("div",{style:{height:".25rem"}}),t?y.jsx("div",{children:y.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?y.jsx("code",{children:e.message}):null})}):null]})}function zk({children:e,fallback:t=null}){return Bp()?y.jsx(ae.Fragment,{children:e}):y.jsx(ae.Fragment,{children:t})}function Bp(){return ae.useSyncExternalStore(Pk,()=>!0,()=>!1)}function Pk(){return()=>{}}var Mw=O.createContext(null);function Gt(e){return O.useContext(Mw)}var Hu=O.createContext(void 0),Uk=O.createContext(void 0),ht=(e=>(e[e.None=0]="None",e[e.Mutable=1]="Mutable",e[e.Watching=2]="Watching",e[e.RecursedCheck=4]="RecursedCheck",e[e.Recursed=8]="Recursed",e[e.Dirty=16]="Dirty",e[e.Pending=32]="Pending",e))(ht||{});function $k({update:e,notify:t,unwatched:n}){return{link:a,unlink:o,propagate:l,checkDirty:u,shallowPropagate:h};function a(m,v,p){const b=v.depsTail;if(b!==void 0&&b.dep===m)return;const _=b!==void 0?b.nextDep:v.deps;if(_!==void 0&&_.dep===m){_.version=p,v.depsTail=_;return}const S=m.subsTail;if(S!==void 0&&S.version===p&&S.sub===v)return;const R=v.depsTail=m.subsTail={version:p,dep:m,sub:v,prevDep:b,nextDep:_,prevSub:S,nextSub:void 0};_!==void 0&&(_.prevDep=R),b!==void 0?b.nextDep=R:v.deps=R,S!==void 0?S.nextSub=R:m.subs=R}function o(m,v=m.sub){const p=m.dep,b=m.prevDep,_=m.nextDep,S=m.nextSub,R=m.prevSub;return _!==void 0?_.prevDep=b:v.depsTail=b,b!==void 0?b.nextDep=_:v.deps=_,S!==void 0?S.prevSub=R:p.subsTail=R,R!==void 0?R.nextSub=S:(p.subs=S)===void 0&&n(p),_}function l(m){let v=m.nextSub,p;e:do{const b=m.sub;let _=b.flags;if(_&60?_&12?_&4?!(_&48)&&d(m,b)?(b.flags=_|40,_&=1):_=0:b.flags=_&-9|32:_=0:b.flags=_|32,_&2&&t(b),_&1){const S=b.subs;if(S!==void 0){const R=(m=S).nextSub;R!==void 0&&(p={value:v,prev:p},v=R);continue}}if((m=v)!==void 0){v=m.nextSub;continue}for(;p!==void 0;)if(m=p.value,p=p.prev,m!==void 0){v=m.nextSub;continue e}break}while(!0)}function u(m,v){let p,b=0,_=!1;e:do{const S=m.dep,R=S.flags;if(v.flags&16)_=!0;else if((R&17)===17){if(e(S)){const E=S.subs;E.nextSub!==void 0&&h(E),_=!0}}else if((R&33)===33){(m.nextSub!==void 0||m.prevSub!==void 0)&&(p={value:m,prev:p}),m=S.deps,v=S,++b;continue}if(!_){const E=m.nextDep;if(E!==void 0){m=E;continue}}for(;b--;){const E=v.subs,x=E.nextSub!==void 0;if(x?(m=p.value,p=p.prev):m=E,_){if(e(v)){x&&h(E),v=m.sub;continue}_=!1}else v.flags&=-33;v=m.sub;const k=m.nextDep;if(k!==void 0){m=k;continue e}}return _}while(!0)}function h(m){do{const v=m.sub,p=v.flags;(p&48)===32&&(v.flags=p|16,(p&6)===2&&t(v))}while((m=m.nextSub)!==void 0)}function d(m,v){let p=v.depsTail;for(;p!==void 0;){if(p===m)return!0;p=p.prevDep}return!1}}function Bk(e,t,n){const a=typeof e=="object",o=a?e:void 0;return{next:(a?e.next:e)?.bind(o),error:(a?e.error:t)?.bind(o),c
12omplete:(a?e.complete:n)?.bind(o)}}const sp=[];let hu=0;const{link:N0,unlink:Ik,propagate:Hk,checkDirty:Nw,shallowPropagate:L0}=$k({update(e){return e._update()},notify(e){sp[ap++]=e,e.flags&=~ht.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=ht.Mutable|ht.Dirty,Su(e))}});let qc=0,ap=0,yr,ip=0;function Lw(e){try{++ip,e()}finally{--ip||zw()}}function Su(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=Ik(n,e)}function zw(){if(!(ip>0)){for(;qc<ap;){const e=sp[qc];sp[qc++]=void 0,e.notify()}qc=0,ap=0}}function z0(e,t){const n=typeof e=="function",a=e,o={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?ht.None:ht.Mutable,get(){return yr!==void 0&&N0(o,yr,hu),o._snapshot},subscribe(l){const u=Bk(l),h={current:!1},d=qk(()=>{o.get(),h.current?u.next?.(o._snapshot):h.current=!0});return{unsubscribe:()=>{d.stop()}}},_update(l){const u=yr,h=t?.compare??Object.is;if(n)yr=o,++hu,o.depsTail=void 0;else if(l===void 0)return!1;n&&(o.flags=ht.Mutable|ht.RecursedCheck);try{const d=o._snapshot,m=typeof l=="function"?l(d):l===void 0&&n?a(d):l;return d===void 0||!h(d,m)?(o._snapshot=m,!0):!1}finally{yr=u,n&&(o.flags&=~ht.RecursedCheck),Su(o)}}};return n?(o.flags=ht.Mutable|ht.Dirty,o.get=function(){const l=o.flags;if(l&ht.Dirty||l&ht.Pending&&Nw(o.deps,o)){if(o._update()){const u=o.subs;u!==void 0&&L0(u)}}else l&ht.Pending&&(o.flags=l&~ht.Pending);return yr!==void 0&&N0(o,yr,hu),o._snapshot}):o.set=function(l){if(o._update(l)){const u=o.subs;u!==void 0&&(Hk(u),L0(u),zw())}},o}function qk(e){const t=()=>{const a=yr;yr=n,++hu,n.depsTail=void 0,n.flags=ht.Watching|ht.RecursedCheck;try{return e()}finally{yr=a,n.flags&=~ht.RecursedCheck,Su(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:ht.Watching|ht.RecursedCheck,notify(){const a=this.flags;a&ht.Dirty||a&ht.Pending&&Nw(this.deps,this)?t():this.flags=ht.Watching},stop(){this.flags=ht.None,this.depsTail=void 0,Su(this)}};return t(),n}var wh={exports:{}},Sh={},xh={exports:{}},Th={};var P0;function Fk(){if(P0)return Th;P0=1;var e=wl();function t(p,b){return p===b&&(p!==0||1/p===1/b)||p!==p&&b!==b}var n=typeof Object.is=="function"?Object.is:t,a=e.useState,o=e.useEffect,l=e.useLayoutEffect,u=e.useDebugValue;function h(p,b){var _=b(),S=a({inst:{value:_,getSnapshot:b}}),R=S[0].inst,E=S[1];return l(function(){R.value=_,R.getSnapshot=b,d(R)&&E({inst:R})},[p,_,b]),o(function(){return d(R)&&E({inst:R}),p(function(){d(R)&&E({inst:R})})},[p]),u(_),_}function d(p){var b=p.getSnapshot;p=p.value;try{var _=b();return!n(p,_)}catch{return!0}}function m(p,b){return b()}var v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m:h;return Th.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:v,Th}var U0;function Gk(){return U0||(U0=1,xh.exports=Fk()),xh.exports}var $0;function Vk(){if($0)return Sh;$0=1;var e=wl(),t=Gk();function n(m,v){return m===v&&(m!==0||1/m===1/v)||m!==m&&v!==v}var a=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,l=e.useRef,u=e.useEffect,h=e.useMemo,d=e.useDebugValue;return Sh.useSyncExternalStoreWithSelector=function(m,v,p,b,_){var S=l(null);if(S.current===null){var R={hasValue:!1,value:null};S.current=R}else R=S.current;S=h(function(){function x(U){if(!k){if(k=!0,D=U,U=b(U),_!==void 0&&R.hasValue){var B=R.value;if(_(B,U))return j=B}return j=U}if(B=j,a(D,U))return B;var V=b(U);return _!==void 0&&_(B,V)?(D=U,B):(D=U,j=V)}var k=!1,D,j,H=p===void 0?null:p;return[function(){return x(v())},H===null?void 0:function(){return x(H())}]},[v,p,b,_]);var E=o(m,S[0],S[1]);return u(function(){R.hasValue=!0,R.value=E},[E]),d(E),E},Sh}var B0;function Yk(){return B0||(B0=1,wh.exports=Vk()),wh.exports}var Kk=Yk();function Wk(e,t){return e===t}function wt(e,t,n=Wk){const a=O.useCallback(u=>{if(!e)return()=>{};const{unsubscribe:h}=e.subscribe(u);return h},[e]),o=O.useCallback(()=>e?.get(),[e]);return Kk.useSyncExternalStoreWithSelector(a,o,o,t,n)}var Eh={get(){},subscribe(){return{unsubscribe(){}}}};function Qk(e,t){const n=O.useRef();return a=>{const o=e?.select?e.select(a):a;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=ba(n.current,o):o}}function Ca(e){const t=Gt(),n=O.useContext(e.from?Uk:Hu),a=e.from?t.stores.getRouteMatchStore(e.from):t.stores.matchStores.get(n),o=Qk(e,t),l=wt(a??Eh,u=>u?o(u):Eh);if(l!==Eh)return l;(e.shouldThrow??!0)&&xn()}function Pw(e){return Ca({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Uw(e){const{select:t,...n}=e;return Ca({...n,select:a=>t?t(a.loaderDeps):a.loaderDeps})}function $w(e){return Ca({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Bw(e){return Ca({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Ip(e){const t=Gt();return O.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Iw(e){return Ca({...e,select:t=>e.select?e.select(t.context):t.context})}var Hw=C_();const Xk=k_(Hw);function Jk(e,t){const n=Gt(),a=jk(t),{activeProps:o,inactiveProps:l,activeOptions:u,to:h,preload:d,preloadDelay:m,preloadIntentProximity:v,hashScrollIntoView:p,replace:b,startTransition:_,resetScroll:S,viewTransition:R,children:E,target:x,disabled:k,style:D,className:j,onClick:H,onBlur:U,onFocus:B,onMouseEnter:V,onMouseLeave:W,onTouchStart:se,ignoreBlocker:le,params:ue,search:Ce,hash:Se,state:Le,mask:P,reloadDocument:ne,unsafeRelative:oe,from:Te,_fromLocation:he,...N}=e,X=Bp(),Z=O.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),re=wt(n.stores.location,Be=>Be,(Be,ut)=>Be.href===ut.href),Y=O.useMemo(()=>{const Be={_fromLocation:re,...Z};return n.buildLocation(Be)},[n,re,Z]),Q=Y.maskedLocation?Y.maskedLocation.publicHref:Y.publicHref,ve=Y.maskedLocation?Y.maskedLocation.external:Y.external,ie=O.useMemo(()=>sC(Q,ve,n.history,k),[k,ve,Q,n.history]),Oe=O.useMemo(()=>
12{if(ie?.external)return gu(ie.href,n.protocolAllowlist)?void 0:ie.href;if(!aC(h)&&!(typeof h!="string"||h.indexOf(":")===-1))try{return new URL(h),gu(h,n.protocolAllowlist)?void 0:h}catch{}},[h,ie,n.protocolAllowlist]),it=O.useMemo(()=>{if(Oe)return!1;if(u?.exact){if(!IT(re.pathname,Y.pathname,n.basepath))return!1}else{const Be=yu(re.pathname,n.basepath),ut=yu(Y.pathname,n.basepath);if(!(Be.startsWith(ut)&&(Be.length===ut.length||Be[ut.length]==="/")))return!1}return(u?.includeSearch??!0)&&!an(re.search,Y.search,{partial:!u?.exact,ignoreUndefined:!u?.explicitUndefined})?!1:u?.includeHash?X&&re.hash===Y.hash:!0},[u?.exact,u?.explicitUndefined,u?.includeHash,u?.includeSearch,re,Oe,X,Y.hash,Y.pathname,Y.search,n.basepath]),xe=it?va(o,{})??Zk:Rh,we=it?Rh:va(l,{})??Rh,Ne=[j,xe.className,we.className].filter(Boolean).join(" "),Me=(D||xe.style||we.style)&&{...D,...xe.style,...we.style},[Nn,Jt]=O.useState(!1),Ve=O.useRef(!1),Zt=e.reloadDocument||Oe?!1:d??n.options.defaultPreload,pt=m??n.options.defaultPreloadDelay??0,en=O.useCallback(()=>{n.preloadRoute({...Z,_builtLocation:Y}).catch(Be=>{console.warn(Be),console.warn(xE)})},[n,Z,Y]);Ok(a,O.useCallback(Be=>{Be?.isIntersecting&&en()},[en]),rC,{disabled:!!k||Zt!=="viewport"}),O.useEffect(()=>{Ve.current||!k&&Zt==="render"&&(en(),Ve.current=!0)},[k,en,Zt]);const ur=Be=>{const ut=Be.currentTarget.getAttribute("target"),Ut=x!==void 0?x:ut;if(!k&&!iC(Be)&&!Be.defaultPrevented&&(!Ut||Ut==="_self")&&Be.button===0){Be.preventDefault(),Hw.flushSync(()=>{Jt(!0)});const Ln=n.subscribe("onResolved",()=>{Ln(),Jt(!1)});n.navigate({...Z,replace:b,resetScroll:S,hashScrollIntoView:p,startTransition:_,viewTransition:R,ignoreBlocker:le})}};if(Oe)return{...N,ref:a,href:Oe,...E&&{children:E},...x&&{target:x},...k&&{disabled:k},...D&&{style:D},...j&&{className:j},...H&&{onClick:H},...U&&{onBlur:U},...B&&{onFocus:B},...V&&{onMouseEnter:V},...W&&{onMouseLeave:W},...se&&{onTouchStart:se}};const yt=Be=>{if(k||Zt!=="intent")return;if(!pt){en();return}const ut=Be.currentTarget;if(Uo.has(ut))return;const Ut=setTimeout(()=>{Uo.delete(ut),en()},pt);Uo.set(ut,Ut)},St=Be=>{k||Zt!=="intent"||en()},Rt=Be=>{if(k||!Zt||!pt)return;const ut=Be.currentTarget,Ut=Uo.get(ut);Ut&&(clearTimeout(Ut),Uo.delete(ut))};return{...N,...xe,...we,href:ie?.href,ref:a,onClick:gi([H,ur]),onBlur:gi([U,Rt]),onFocus:gi([B,yt]),onMouseEnter:gi([V,yt]),onMouseLeave:gi([W,Rt]),onTouchStart:gi([se,St]),disabled:!!k,target:x,...Me&&{style:Me},...Ne&&{className:Ne},...k&&eC,...it&&tC,...X&&Nn&&nC}}var Rh={},Zk={className:"active"},eC={role:"link","aria-disabled":!0},tC={"data-status":"active","aria-current":"page"},nC={"data-transitioning":"transitioning"},Uo=new WeakMap,rC={rootMargin:"100px"},gi=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}};function sC(e,t,n,a){if(!a)return t?{href:e,external:!0}:{href:n.createHref(e)||"/",external:!1}}function aC(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Hp=O.forwardRef((e,t)=>{const{_asChild:n,...a}=e,{type:o,...l}=Jk(a,t),u=typeof a.children=="function"?a.children({isActive:l["data-status"]==="active"}):a.children;if(!n){const{disabled:h,...d}=l;return O.createElement("a",d,u)}return O.createElement(n,l,u)});function iC(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var oC=class extends W_{constructor(t){super(t),this.useMatch=n=>Ca({select:n?.select,from:this.id,structuralSharing:n?.structuralSharing}),this.useRouteContext=n=>Iw({...n,from:this.id}),this.useSearch=n=>Bw({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useParams=n=>$w({select:n?.select,structuralSharing:n?.structuralSharing,from:this.id}),this.useLoaderDeps=n=>Uw({...n,from:this.id}),this.useLoaderData=n=>Pw({...n,from:this.id}),this.useNavigate=()=>Ip({from:this.fullPath}),this.Link=ae.forwardRef((n,a)=>y.jsx(Hp,{ref:a,from:this.fullPath,...n}))}};function lC(e){return new oC(e)}function cC(){return e=>dC(e)}var uC=class extends kE{constructor(e){super(e),this.useMatch=t=>Ca({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>Iw({...t,from:this.id}),this.useSearch=t=>Bw({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>$w({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Uw({...t,from:this.id}),this.useLoaderData=t=>Pw({...t,from:this.id}),this.useNavigate=()=>Ip({from:this.fullPath}
12),this.Link=ae.forwardRef((t,n)=>y.jsx(Hp,{ref:n,from:this.fullPath,...t}))}};function dC(e){return new uC(e)}function ct(e){return new fC(e,{silent:!0}).createRoute}var fC=class{constructor(e,t){this.path=e,this.createRoute=n=>{const a=lC(n);return a.isRoot=!1,a},this.silent=t?.silent}};function st(e,t){let n,a,o,l;const u=()=>(n||(n=e().then(d=>{n=void 0,a=d[t??"default"]}).catch(d=>{if(o=d,xT(o)&&o instanceof Error&&typeof window<"u"&&typeof sessionStorage<"u"){const m=`tanstack_router_reload:${o.message}`;sessionStorage.getItem(m)||(sessionStorage.setItem(m,"1"),l=!0)}})),n),h=function(m){if(l)throw window.location.reload(),new Promise(()=>{});if(o)throw o;if(!a)if(wu)wu(u());else throw u();return O.createElement(a,m)};return h.preload=u,h}function hC(e){const t=Gt(),n=`not-found-${wt(t.stores.location,a=>a.pathname)}-${wt(t.stores.status,a=>a)}`;return y.jsx(Up,{getResetKey:()=>n,onCatch:(a,o)=>{if(Ft(a))e.onCatch?.(a,o);else throw a},errorComponent:({error:a})=>{if(Ft(a))return e.fallback?.(a);throw a},children:e.children})}function pC(){return y.jsx("p",{children:"Not Found"})}function Ei(e){return y.jsx(y.Fragment,{children:e.children})}function qw(e,t,n){return t.options.notFoundComponent?y.jsx(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?y.jsx(e.options.defaultNotFoundComponent,{...n}):y.jsx(pC,{})}function mC(e){return null}function gC(){return mC(Gt()),null}var yC=(e,t)=>e.routeId===t.routeId&&e._displayPending===t._displayPending,vC=(e,t)=>e[0]===t[0]&&e[1]===t[1],Fw=O.memo(function({matchId:t}){const n=Gt(),a=n.stores.matchStores.get(t);a||xn();const o=wt(n.stores.loadedAt,u=>u),l=wt(a,u=>u,yC);return y.jsx(bC,{router:n,matchId:t,resetKey:o,matchState:O.useMemo(()=>{const u=l.routeId,h=n.routesById[u].parentRoute?.id;return{routeId:u,ssr:l.ssr,_displayPending:l._displayPending,parentRouteId:h}},[l._displayPending,l.routeId,l.ssr,n.routesById])})});function bC({router:e,matchId:t,resetKey:n,matchState:a}){const o=e.routesById[a.routeId],l=o.options.pendingComponent??e.options.defaultPendingComponent,u=l?y.jsx(l,{}):null,h=o.options.errorComponent??e.options.defaultErrorComponent,d=o.options.onCatch??e.options.defaultOnCatch,m=o.isRoot?o.options.notFoundComponent??e.options.notFoundRoute?.options.component:o.options.notFoundComponent,v=a.ssr===!1||a.ssr==="data-only",p=(!o.isRoot||o.options.wrapInSuspense||v)&&(o.options.wrapInSuspense??l??(o.options.errorComponent?.preload||v))?O.Suspense:Ei,b=h?Up:Ei,_=m?hC:Ei;return y.jsxs(o.isRoot?o.options.shellComponent??Ei:Ei,{children:[y.jsx(Hu.Provider,{value:t,children:y.jsx(p,{fallback:u,children:y.jsx(b,{getResetKey:()=>n,errorComponent:h||$p,onCatch:(S,R)=>{if(Ft(S))throw S.routeId??=a.routeId,S;d?.(S,R)},children:y.jsx(_,{fallback:S=>{if(S.routeId??=a.routeId,!m||S.routeId&&S.routeId!==a.routeId||!S.routeId&&
12!o.isRoot)throw S;return O.createElement(m,S)},children:v||a._displayPending?y.jsx(zk,{fallback:u,children:y.jsx(I0,{matchId:t})}):y.jsx(I0,{matchId:t})})})})}),a.parentRouteId===Ta?y.jsxs(y.Fragment,{children:[y.jsx(_C,{}),e.options.scrollRestoration&&O_?y.jsx(gC,{}):null]}):null]})}function _C(){const e=Gt(),t=O.useRef();return Vo(()=>{const n=e.stores.resolvedLocation.get(),a=t.current;n&&(!a||a.href!==n.href)&&e.emit({type:"onRendered",...Li(e.stores.location.get(),a??n)}),t.current=n},[wt(e.stores.resolvedLocation,n=>n?.state.__TSR_key),e]),null}var I0=O.memo(function({matchId:t}){const n=Gt(),a=(v,p)=>n.getMatch(v.id)?._nonReactive[p]??v._nonReactive[p],o=n.stores.matchStores.get(t);o||xn();const l=wt(o,v=>v),u=l.routeId,h=n.routesById[u],d=O.useMemo(()=>{const v=(n.routesById[u].options.remountDeps??n.options.defaultRemountDeps)?.({routeId:u,loaderDeps:l.loaderDeps,params:l._strictParams,search:l._strictSearch});return v?JSON.stringify(v):void 0},[u,l.loaderDeps,l._strictParams,l._strictSearch,n.options.defaultRemountDeps,n.routesById]),m=O.useMemo(()=>{const v=h.options.component??n.options.defaultComponent;return v?y.jsx(v,{},d):y.jsx(Gw,{})},[d,h.options.component,n.options.defaultComponent]);if(l._displayPending)throw a(l,"displayPendingPromise");if(l._forcePending)throw a(l,"minPendingPromise");if(l.status==="pending"){const v=h.options.pendingMinMs??n.options.defaultPendingMinMs;if(v){const p=n.getMatch(l.id);if(p&&!p._nonReactive.minPendingPromise){const b=Ra();p._nonReactive.minPendingPromise=b,setTimeout(()=>{b.resolve(),p._nonReactive.minPendingPromise=void 0},v)}}throw a(l,"loadPromise")}if(l.status==="notFound")return Ft(l.error)||xn(),qw(n,h,l.error);if(l.status==="redirected")throw Xt(l.error)||xn(),a(l,"loadPromise");if(l.status==="error")throw l.error;return m}),Gw=O.memo(function(){const t=Gt(),n=O.useContext(Hu);let a,o=!1,l;{const m=n?t.stores.matchStores.get(n):void 0;[a,o]=wt(m,v=>[v?.routeId,v?.globalNotFound??!1],vC),l=wt(t.stores.matchesId,v=>v[v.findIndex(p=>p===n)+1])}const u=a?t.routesById[a]:void 0,h=t.options.defaultPendingComponent?y.jsx(t.options.defaultPendingComponent,{}):null;if(o)return u||xn(),qw(t,u,void 0);if(!l)return null;const d=y.jsx(Fw,{matchId:l});return a===Ta?y.jsx(O.Suspense,{fallback:h,children:d}):d});function wC(){const e=Gt(),t=O.useRef({router:e,mounted:!1}),[n,a]=O.useState(!1),o=wt(e.stores.isLoading,p=>p),l=wt(e.stores.hasPending,p=>p),u=_h(o),h=o||n||l,d=_h(h),m=o||l,v=_h(m);return e.startTransition=p=>{a(!0),O.startTransition(()=>{p(),a(!1)})},O.useEffect(()=>{const p=e.history.subscribe(e.load),b=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Kr(e.latestLocation.publicHref)!==Kr(b.publicHref)&&e.commitLocation({...b,replace:!0}),()=>{p()}},[e,e.history]),Vo(()=>{if(typeof window<"u"&&e.ssr||t.current.router===e&&t.current.mounted)return;t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(b){console.error(b)}})()},[e]),Vo(()=>{u&&!o&&e.emit({type:"onLoad",...Li(e.stores.location.get(),e.stores.resolvedLocation.get())})},[u,e,o]),Vo(()=>{v&&!m&&e.emit({type:"onBeforeRouteMount",...Li(e.stores.location.get(),e.stores.resolvedLocation.get())})},[m,v,e]),Vo(()=>{if(d&&!h){const p=Li(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:"onResolved",...p}),Lw(()=>{e.stores.status.set("idle"),e.stores.resolvedLocation.set(e.stores.location.get())})}},[h,d,e]),null}function SC(){const e=Gt(),t=e.routesById[Ta].options.pendingComponent??e.options.defaultPendingComponent,n=t?y.jsx(t,{}):null,a=y.jsxs(typeof document<"u"&&e.ssr?Ei:O.Suspense,{fallback:n,children:[y.jsx(wC,{}),y.jsx(xC,{})]});return e.options.InnerWrap?y.jsx(e.options.InnerWrap,{children:a}):a}function xC(){const e=Gt(),t=wt(e.stores.firstId,o=>o),n=wt(e.stores.loadedAt,o=>o),a=t?y.jsx(Fw,{matchId:t}):null;return y.jsx(Hu.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?a:y.jsx(Up,{getResetKey:()=>n,errorComponent:$p,onCatch:void 0,children:a})})}var TC=e=>({createMutableStore:z0,createReadonlyStore:z0,batch:Lw}),EC=e=>new RC(e),RC=class extends lE{constructor(e){super(e,TC)}};function AC({router:e,children:t,...n}
12){D_(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const a=y.jsx(Mw.Provider,{value:e,children:t});return e.options.Wrap?y.jsx(e.options.Wrap,{children:a}):a}function kC({router:e,...t}){return y.jsx(AC,{router:e,...t,children:y.jsx(SC,{})})}function H0(e,t){if(t)for(const[n,a]of Object.entries(t))n!=="suppressHydrationWarning"&&a!==void 0&&a!==!1&&e.setAttribute(n,typeof a=="boolean"?"":String(a))}function Vw(e){const{attrs:t,children:n,nonce:a,preventScriptHoist:o}=e;switch(e.tag){case"title":return y.jsx("title",{...t,suppressHydrationWarning:!0,children:n});case"meta":return y.jsx("meta",{...t,suppressHydrationWarning:!0});case"link":return y.jsx("link",{...t,precedence:t?.precedence??(t?.rel==="stylesheet"?"default":void 0),nonce:a,suppressHydrationWarning:!0});case"style":return e.inlineCss,y.jsx("style",{...t,dangerouslySetInnerHTML:{__html:n},nonce:a});case"script":return y.jsx(CC,{attrs:t,preventScriptHoist:o,children:n});default:return null}}function CC({attrs:e,children:t,preventScriptHoist:n}){Gt();const a=Bp(),o=typeof e?.type=="string"&&e.type!==""&&e.type!=="text/javascript"&&e.type!=="module";if(O.useEffect(()=>{if(!o){if(e?.src){const l=(()=>{try{const h=document.baseURI||window.location.href;return new URL(e.src,h).href}catch{return e.src}})();for(const h of document.querySelectorAll("script[src]"))if(h.src===l)return;const u=document.createElement("script");return H0(u,e),document.head.appendChild(u),()=>u.remove()}if(typeof t=="string"){const l=typeof e?.type=="string"?e.type:"text/javascript",u=typeof e?.nonce=="string"?e.nonce:void 0;for(const d of document.querySelectorAll("script:not([src])")){if(!(d instanceof HTMLScriptElement))continue;const m=d.getAttribute("type")??"text/javascript",v=d.getAttribute("nonce")??void 0;if(d.textContent===t&&m===l&&v===u)return}const h=document.createElement("script");return h.textContent=t,H0(h,e),document.head.appendChild(h),()=>h.remove()}}},[e,t,o]),o&&typeof t=="string")return y.jsx("script",{...e,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:t}});if(!a){if(e?.src)return y.jsx("script",{...e,suppressHydrationWarning:!0});if(typeof t=="string")return y.jsx("script",{...e,dangerouslySetInnerHTML:{__html:t},suppressHydrationWarning:!0})}return null}var OC=e=>{const t=Gt(),n=t.options.ssr?.nonce,a=wt(t.stores.matches,p=>p.map(b=>b.meta).filter(b=>b!==void 0),an),o=O.useMemo(()=>{const p=[],b={};let _;for(let S=a.length-1;S>=0;S--){const R=a[S];for(let E=R.length-1;E>=0;E--){const x=R[E];if(x)if(x.title)_||(_={tag:"title",children:x.title});else if("script:ld+json"in x)try{const k=JSON.stringify(x["script:ld+json"]);p.push({tag:"script",attrs:{type:"application/ld+json"},children:kT(k)})}catch{}else{const k=x.name??x.property;if(k){if(b[k])continue;b[k]=!0}p.push({tag:"meta",attrs:{...x,nonce:n}})}}}return _&&p.push(_),n&&p.push({tag:"meta",attrs:{property:"csp-nonce",content:n}}),p.reverse(),p},[a,n]),l=wt(t.stores.matches,p=>p.flatMap(b=>b.links??[]).filter(b=>b!==void 0).map(b=>({tag:"link",attrs:{...b,nonce:n}})),an),u=wt(t.stores.matches,p=>{const b=t.ssr?.manifest,_=[];return b&&(p.forEach(S=>{b.routes[S.routeId]?.css?.forEach(R=>{const E=AE(R);_.push({tag:"link",attrs:{rel:"stylesheet",...E,crossOrigin:K_(e,"stylesheet")??E.crossOrigin,suppressHydrationWarning:!0,nonce:n}})})}),b.inlineStyle&&_.push({tag:"style",attrs:{...b.inlineStyle.attrs,nonce:n},children:b.inlineStyle.children,inlineCss:!0})),_},an),h=wt(t.stores.matches,p=>{const b=[],_=t.ssr?.manifest;return _&&p.forEach(S=>{_.routes[S.routeId]?.preloads?.forEach(R=>{b.push({tag:"link",attrs:{...EE(_,R,e),nonce:n}})})}),b},an),d=wt(t.stores.matches,p=>p.flatMap(b=>b.styles??[]).filter(b=>b!==void 0).map(({children:b,..._})=>({tag:"style",attrs:{..._,nonce:n},children:b})),an),m=wt(t.stores.matches,p=>p.flatMap(b=>b.headScripts??[]).filter(b=>b!==void 0).map(({children:b,..._})=>({tag:"script",attrs:{..._,nonce:n},children:b})),an),v=[];return Ic(v,o),v.push(...h),Ic(v,l),v.push(...u),Ic(v,d),Ic(v,m),v};function jC(e){const t=OC(e.assetCrossOrigin),n=Gt().options.ssr?.nonce;return y.jsx(y.Fragment,{children:t.map(a=>O.createElement(Vw,{...a,key:`tsr-meta-${JSON.stringify(a)}`,nonce:n}))})}var DC=()=>{const e=Gt(),t=e.options.ssr?.nonce,n=l=>{const u=[],h=e.ssr?.manifest;if(!h)return[];for(const d of l){const m=h.routes[d.routeId]?.scripts;if(m)for(const v of m)u.push({tag:"script",attrs:{...v.attrs,nonce:t},children:v.children,...typeof v.attrs?.src=="string"?{preventScriptHoist:!0}:{}})}return u},a=l=>l.map(u=>
12u.scripts).flat(1).filter(Boolean).map(({children:u,...h})=>({tag:"script",attrs:{...h,suppressHydrationWarning:!0,nonce:t},children:u})),o=wt(e.stores.matches,n,an);return MC(e,wt(e.stores.matches,a,an),o)};function MC(e,t,n){const a=[...t,...n];return y.jsx(y.Fragment,{children:a.map((o,l)=>O.createElement(Vw,{...o,key:`tsr-scripts-${o.tag}-${l}`}))})}function Ah(e){const t=Gt();return O.useCallback(async(...n)=>{try{const a=await e(...n);if(Xt(a))throw a;return a}catch(a){if(Xt(a))return a.options._fromLocation=t.stores.location.get(),t.navigate(t.resolveRedirect(a).options);throw a}},[t,e])}function q0(e){return e!=="__proto__"&&e!=="constructor"&&e!=="prototype"}function op(e,t){const n=Object.create(null);if(e)for(const a of Object.keys(e))q0(a)&&(n[a]=e[a]);if(t&&typeof t=="object")for(const a of Object.keys(t))q0(a)&&(n[a]=t[a]);return n}function Yw(e){return Object.create(null)}var Kw=()=>{throw new Error("createServerOnlyFn() functions can only be called on the server!")},Sr=(e,t)=>{const n=t||e||{};typeof n.method>"u"&&(n.method="GET");const a=u=>Sr(void 0,{...n,validator:u,inputValidator:u});return Object.assign(u=>Sr(void 0,{...n,...u}),{options:n,middleware:u=>{const h=[...n.middleware||[]];u.map(m=>{t0 in m?m.options.middleware&&h.push(...m.options.middleware):h.push(m)});const d=Sr(void 0,{...n,middleware:h});return d[t0]=!0,d},validator:a,inputValidator:a,handler:(...u)=>{const[h,d]=u,m={...n,extractedFn:h,serverFn:d},v=[...m.middleware||[],zC(m)];return h.method=n.method,Object.assign(async p=>{const b=await F0(v,"client",{...h,...m,data:p?.data,headers:p?.headers,signal:p?.signal,fetch:p?.fetch,context:Yw()}),_=I_(b.error);if(_)throw _;if(b.error)throw b.error;return b.result},{...h,method:n.method,__executeServer:async p=>{const b=Kw(),_=b.contextAfterGlobalMiddlewares;return await F0(v,"server",{...h,...p,serverFnMeta:h.serverFnMeta,context:op(p.context,_),request:b.request}).then(S=>({result:S.result,error:S.error,context:S.sendContext}))}})}})};async function F0(e,t,n){let a=NC([...jp()?.functionMiddleware||[],...e]);if(t==="server"){const l=Kw();l?.executedRequestMiddlewares&&(a=a.filter(u=>!l.executedRequestMiddlewares.has(u)))}const o=async l=>{const u=a.shift();if(!u)return l;try{let h="validator"in u.options?u.options.validator:void 0;!h&&"inputValidator"in u.options&&(h=u.options.inputValidator),h&&t==="server"&&(l.data=await LC(h,l.data));let d;if(t==="client"?"client"in u.options&&(d=u.options.client):"server"in u.options&&(d=u.options.server),d){const v=await d({...l,next:async(p={})=>{const b=await o({...l,...p,context:op(l.context,p.context),sendContext:op(l.sendContext,p.sendContext),headers:Ak(l.headers,p.headers),_callSiteFetch:l._callSiteFetch,fetch:l._callSiteFetch??p.fetch??l.fetch,result:p.result!==void 0?p.result:p instanceof Response?p:l.result,error:p.error??l.error});if(b.error)throw b.error;return b}});if(Xt(v))return{...l,error:v};if(v instanceof Response)return{...l,result:v};if(!v)throw new Error("User middleware returned undefined. You must call next() or return a result in your middlewares.");return v}return o(l)}catch(h){return{...l,error:h}}};return o({...n,headers:n.headers||{},sendContext:n.sendContext||{},context:n.context||Yw(),_callSiteFetch:n.fetch})}function NC(e,t=100){const n=new Set,a=[],o=(l,u)=>{if(u>t)throw new Error(`Middleware nesting depth exceeded maximum of ${t}. Check for circular references.`);l.forEach(h=>{h.options.middleware&&o(h.options.middleware,u+1),n.has(h)||(n.add(h),a.push(h))})};return o(e,0),a}async function LC(e,t){if(e==null)return{};if("~standard"in e){const n=await e["~standard"].validate(t);if(n.issues)throw new Error(JSON.stringify(n.issues,void 0,2));return n.value}if("parse"in e)return e.parse(t);if(typeof e=="function")return e(t);throw new Error("Invalid validator type!")}function zC(e){return{"~types":void 0,options:{inputValidator:e.validator??e.inputValidator,client:async({next:t,sendContext:n,fetch:a,...o})=>{const l={...o,context:n,fetch:a};return t(await e.extractedFn?.(l))},server:async({next:t,...n})=>{const a=await e.serverFn?.(n);return t({...n,result:a})}}}}var Ns=(e,t)=>{const n={type:"request",...t||e},a=o=>Ns({},Object.assign(n,{validator:o,inputValidator:o}));return{options:n,middleware:o=>Ns({},Object.assign(n,{middleware:o}
12)),validator:a,inputValidator:a,client:o=>Ns({},Object.assign(n,{client:o})),server:o=>Ns({},Object.assign(n,{server:o}))}};function Ww(e,t){for(let n=0,a=t.length;n<a;n++){const o=t[n];e.has(o)||(e.add(o),o.extends&&Ww(e,o.extends))}}var PC=e=>({getOptions:async()=>{const t=await e();if(t.serializationAdapters){const n=new Set;Ww(n,t.serializationAdapters),t.serializationAdapters=Array.from(n)}return t},createMiddleware:Ns}),G0=function(){return G0=Object.assign||function(t){for(var n,a=1,o=arguments.length;a<o;a++){n=arguments[a];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(t[l]=n[l])}return t},G0.apply(this,arguments)};function qu(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]]);return n}function UC(e,t,n,a){function o(l){return l instanceof n?l:new n(function(u){u(l)})}return new(n||(n=Promise))(function(l,u){function h(v){try{m(a.next(v))}catch(p){u(p)}}function d(v){try{m(a.throw(v))}catch(p){u(p)}}function m(v){v.done?l(v.value):o(v.value).then(h,d)}m((a=a.apply(e,t||[])).next())})}function I3(e,t,n){if(n||arguments.length===2)for(var a=0,o=t.length,l;a<o;a++)(l||!(a in t))&&(l||(l=Array.prototype.slice.call(t,0,a)),l[a]=t[a]);return e.concat(l||Array.prototype.slice.call(t))}const $C=e=>e?(...t)=>e(...t):(...t)=>fetch(...t);class qp extends Error{constructor(t,n="FunctionsError",a){super(t),this.name=n,this.context=a}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class BC extends qp{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class V0 extends qp{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class Y0 extends qp{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var lp;(function(e){e.Any="any",e.ApNortheast1="ap-northeast-1",e.ApNortheast2="ap-northeast-2",e.ApSouth1="ap-south-1",e.ApSoutheast1="ap-southeast-1",e.ApSoutheast2="ap-southeast-2",e.CaCentral1="ca-central-1",e.EuCentral1="eu-central-1",e.EuWest1="eu-west-1",e.EuWest2="eu-west-2",e.EuWest3="eu-west-3",e.SaEast1="sa-east-1",e.UsEast1="us-east-1",e.UsWest1="us-west-1",e.UsWest2="us-west-2"})(lp||(lp={}));class IC{constructor(t,{headers:n={},customFetch:a,region:o=lp.Any}={}){this.url=t,this.headers=n,this.region=o,this.fetch=$C(a)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return UC(this,arguments,void 0,function*(n,a={}){var o;let l,u;try{const{headers:h,method:d,body:m,signal:v,timeout:p}=a;let b={},{region:_}=a;_||(_=this.region);const S=new URL(`${this.url}/${n}`);_&&_!=="any"&&(b["x-region"]=_,S.searchParams.set("forceFunctionRegion",_));let R;const E=!!h&&Object.keys(h).some(U=>U.toLowerCase()==="content-type");m&&!E?typeof Blob<"u"&&m instanceof Blob||m instanceof ArrayBuffer?(b["Content-Type"]="application/octet-stream",R=m):typeof m=="string"?(b["Content-Type"]="text/plain",R=m):typeof FormData<"u"&&m instanceof FormData?R=m:(b["Content-Type"]="application/json",R=JSON.stringify(m)):m&&typeof m!="string"&&!(typeof Blob<"u"&&m instanceof Blob)&&!(m instanceof ArrayBuffer)&&!(typeof FormData<"u"&&m instanceof FormData)?R=JSON.stringify(m):R=m;let x=v;p&&(u=new AbortController,l=setTimeout(()=>u.abort(),p),v?(x=u.signal,v.addEventListener("abort",()=>u.abort())):x=u.signal);const k=yield this.fetch(S.toString(),{method:d||"POST",headers:Object.assign(Object.assign(Object.assign({},b),this.headers),h),body:R,signal:x}).catch(U=>{throw new BC(U)}),D=k.headers.get("x-relay-error");if(D&&D==="true")throw new V0(k);if(!k.ok)throw new Y0(k);let j=((o=k.headers.get("Content-Type"))!==null&&o!==void 0?o:"text/plain").split(";")[0].trim(),H;return j==="application/json"?H=yield k.json():j==="application/octet-stream"||j==="application/pdf"?H=yield k.blob():j==="text/event-stream"?H=k:j==="multipart/form-data"?H=yield k.formData():H=yield k.text(),{data:H,error:null,response:k}}catch(h){return{data:null,error:h,response:h instanceof Y0||h instanceof V0?h.context:void 0}}finally{l&&clearTimeout(l)}})}}const Qw=3,K0=e=>Math.min(1e3*2**e,3e4),HC=[520,503],Xw=["GET","HEAD","OPTIONS"];
12var W0=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function Q0(e,t){return new Promise(n=>{if(t?.aborted){n();return}const a=setTimeout(()=>{t?.removeEventListener("abort",o),n()},e);function o(){clearTimeout(a),n()}t?.addEventListener("abort",o)})}function qC(e,t,n,a){return!(!a||n>=Qw||!Xw.includes(e)||!HC.includes(t))}var FC=class{constructor(e){var t,n,a,o,l;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(n=e.isMaybeSingle)!==null&&n!==void 0?n:!1,this.shouldStripNulls=(a=e.shouldStripNulls)!==null&&a!==void 0?a:!1,this.urlLengthLimit=(o=e.urlLengthLimit)!==null&&o!==void 0?o:8e3,this.retryEnabled=(l=e.retry)!==null&&l!==void 0?l:!0,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(e,t){var n=this;if(this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const u=this.headers.get("Accept");u==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!u||u==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const a=this.fetch;let l=(async()=>{let u=0;for(;;){const m={};n.headers.forEach((p,b)=>{m[b]=p}),u>0&&(m["X-Retry-Count"]=String(u));let v;try{v=await a(n.url.toString(),{method:n.method,headers:m,body:JSON.stringify(n.body,(p,b)=>typeof b=="bigint"?b.toString():b),signal:n.signal})}catch(p){if(p?.name==="AbortError"||p?.code==="ABORT_ERR"||!Xw.includes(n.method))throw p;if(n.retryEnabled&&u<Qw){const b=K0(u);u++,await Q0(b,n.signal);continue}throw p}if(qC(n.method,v.status,u,n.retryEnabled)){var h,d;const p=(h=(d=v.headers)===null||d===void 0?void 0:d.get("Retry-After"))!==null&&h!==void 0?h:null,b=p!==null?Math.max(0,parseInt(p,10)||0)*1e3:K0(u);await v.text(),u++,await Q0(b,n.signal);continue}return await n.processResponse(v)}})();return this.shouldThrowOnError||(l=l.catch(u=>{var h;let d="",m="",v="";const p=u?.cause;if(p){var b,_,S,R;const k=(b=p?.message)!==null&&b!==void 0?b:"",D=(_=p?.code)!==null&&_!==void 0?_:"";d=`${(S=u?.name)!==null&&S!==void 0?S:"FetchError"}: ${u?.message}`,d+=`
13
14Caused by: ${(R=p?.name)!==null&&R!==void 0?R:"Error"}: ${k}`,D&&(d+=` (${D})`),p?.stack&&(d+=`
15${p.stack}`)}else{var E;d=(E=u?.stack)!==null&&E!==void 0?E:""}const x=this.url.toString().length;return u?.name==="AbortError"||u?.code==="ABORT_ERR"?(v="",m="Request was aborted (timeout or manual cancellation)",x>this.urlLengthLimit&&(m+=`. Note: Your request URL is ${x} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):(p?.name==="HeadersOverflowError"||p?.code==="UND_ERR_HEADERS_OVERFLOW")&&(v="",m="HTTP headers exceeded server limits (typically 16KB)",x>this.urlLengthLimit&&(m+=`. Your request URL is ${x} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(h=u?.name)!==null&&h!==void 0?h:"FetchError"}: ${u?.message}`,details:d,hint:m,code:v},data:null,count:null,status:0,statusText:""}}
15)),l.then(e,t)}async processResponse(e){var t=this;let n=null,a=null,o=null,l=e.status,u=e.statusText;if(e.ok){var h,d;if(t.method!=="HEAD"){var m;const b=await e.text();if(b!=="")if(t.headers.get("Accept")==="text/csv")a=b;else if(t.headers.get("Accept")&&(!((m=t.headers.get("Accept"))===null||m===void 0)&&m.includes("application/vnd.pgrst.plan+text")))a=b;else try{a=JSON.parse(b)}catch{if(n={message:b},a=null,t.shouldThrowOnError)throw new W0({message:b,details:"",hint:"",code:""})}}const v=(h=t.headers.get("Prefer"))===null||h===void 0?void 0:h.match(/count=(exact|planned|estimated)/),p=(d=e.headers.get("content-range"))===null||d===void 0?void 0:d.split("/");v&&p&&p.length>1&&(o=parseInt(p[1])),t.isMaybeSingle&&Array.isArray(a)&&(a.length>1?(n={code:"PGRST116",details:`Results contain ${a.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},a=null,o=null,l=406,u="Not Acceptable"):a.length===1?a=a[0]:a=null)}else{const v=await e.text();try{n=JSON.parse(v),Array.isArray(n)&&e.status===404&&(a=[],n=null,l=200,u="OK")}catch{e.status===404&&v===""?(l=204,u="No Content"):n={message:v}}if(n&&t.shouldThrowOnError)throw new W0(n)}return{success:n===null,error:n,data:a,count:o,status:l,statusText:u}}returns(){return this}overrideTypes(){return this}},GC=class extends FC{throwOnError(){return super.throwOnError()}select(e){let t=!1;const n=(e??"*").split("").map(a=>/\s/.test(a)&&!t?"":(a==='"'&&(t=!t),a)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:n,foreignTable:a,referencedTable:o=a}={}){const l=o?`${o}.order`:"order",u=this.url.searchParams.get(l);return this.url.searchParams.set(l,`${u?`${u},`:""}${e}.${t?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:n=t}={}){const a=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(a,`${e}`),this}range(e,t,{foreignTable:n,referencedTable:a=n}={}){const o=typeof a>"u"?"offset":`${a}.offset`,l=typeof a>"u"?"limit":`${a}.limit`;return this.url.searchParams.set(o,`${e}`),this.url.searchParams.set(l,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:n=!1,buffers:a=!1,wal:o=!1,format:l="text"}={}){var u;const h=[e?"analyze":null,t?"verbose":null,n?"settings":null,a?"buffers":null,o?"wal":null].filter(Boolean).join("|"),d=(u=this.headers.get("Accept"))!==null&&u!==void 0?u:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${l}; for="${d}"; options=${h};`),l==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const X0=new RegExp("[,()]");var Ri=class extends GC{throwOnError(){return super.throwOnError()}eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const n=Array.from(new Set(t)).map(a=>
15typeof a=="string"&&X0.test(a)?`"${a}"`:`${a}`).join(",");return this.url.searchParams.append(e,`in.(${n})`),this}notIn(e,t){const n=Array.from(new Set(t)).map(a=>typeof a=="string"&&X0.test(a)?`"${a}"`:`${a}`).join(",");return this.url.searchParams.append(e,`not.in.(${n})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:n,type:a}={}){let o="";a==="plain"?o="pl":a==="phrase"?o="ph":a==="websearch"&&(o="w");const l=n===void 0?"":`(${n})`;return this.url.searchParams.append(e,`${o}fts${l}.${t}`),this}match(e){return Object.entries(e).filter(([t,n])=>n!==void 0).forEach(([t,n])=>{this.url.searchParams.append(t,`eq.${n}`)}),this}not(e,t,n){return this.url.searchParams.append(e,`not.${t}.${n}`),this}or(e,{foreignTable:t,referencedTable:n=t}={}){const a=n?`${n}.or`:"or";return this.url.searchParams.append(a,`(${e})`),this}filter(e,t,n){return this.url.searchParams.append(e,`${t}.${n}`),this}},VC=class{constructor(e,{headers:t={},schema:n,fetch:a,urlLengthLimit:o=8e3,retry:l}){this.url=e,this.headers=new Headers(t),this.schema=n,this.fetch=a,this.urlLengthLimit=o,this.retry=l}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:n=!1,count:a}=t??{},o=n?"HEAD":"GET";let l=!1;const u=(e??"*").split("").map(m=>/\s/.test(m)&&!l?"":(m==='"'&&(l=!l),m)).join(""),{url:h,headers:d}=this.cloneRequestState();return h.searchParams.set("select",u),a&&d.append("Prefer",`count=${a}`),new Ri({method:o,url:h,headers:d,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:n=!0}={}){var a;const o="POST",{url:l,headers:u}=this.cloneRequestState();
15if(t&&u.append("Prefer",`count=${t}`),n||u.append("Prefer","missing=default"),Array.isArray(e)){const h=e.reduce((d,m)=>d.concat(Object.keys(m)),[]);if(h.length>0){const d=[...new Set(h)].map(m=>`"${m}"`);l.searchParams.set("columns",d.join(","))}}return new Ri({method:o,url:l,headers:u,schema:this.schema,body:e,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:n=!1,count:a,defaultToNull:o=!0}={}){var l;const u="POST",{url:h,headers:d}=this.cloneRequestState();if(d.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),t!==void 0&&h.searchParams.set("on_conflict",t),a&&d.append("Prefer",`count=${a}`),o||d.append("Prefer","missing=default"),Array.isArray(e)){const m=e.reduce((v,p)=>v.concat(Object.keys(p)),[]);if(m.length>0){const v=[...new Set(m)].map(p=>`"${p}"`);h.searchParams.set("columns",v.join(","))}}return new Ri({method:u,url:h,headers:d,schema:this.schema,body:e,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var n;const a="PATCH",{url:o,headers:l}=this.cloneRequestState();return t&&l.append("Prefer",`count=${t}`),new Ri({method:a,url:o,headers:l,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;const n="DELETE",{url:a,headers:o}=this.cloneRequestState();return e&&o.append("Prefer",`count=${e}`),new Ri({method:n,url:a,headers:o,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function ll(e){"@babel/helpers - typeof";return ll=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ll(e)}function YC(e,t){if(ll(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var a=n.call(e,t);if(ll(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function KC(e){var t=YC(e,"string");return ll(t)=="symbol"?t:t+""}function WC(e,t,n){return(t=KC(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function J0(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,a)}return n}function Fc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?J0(Object(n),!0).forEach(function(a){WC(e,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):J0(Object(n)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))})}return e}var QC=class Jw{constructor(t,{headers:n={},schema:a,fetch:o,timeout:l,urlLengthLimit:u=8e3,retry:h}={}){this.url=t,this.headers=new Headers(n),this.schemaName=a,this.urlLengthLimit=u;const d=o??globalThis.fetch;l!==void 0&&l>0?this.fetch=(m,v)=>{const p=new AbortController,b=setTimeout(()=>p.abort(),l),_=v?.signal;if(_){if(_.aborted)return clearTimeout(b),d(m,v);const S=()=>{clearTimeout(b),p.abort()};return _.addEventListener("abort",S,{once:!0}),d(m,Fc(Fc({},v),{},{signal:p.signal})).finally(()=>{clearTimeout(b),_.removeEventListener("abort",S)})}return d(m,Fc(Fc({},v),{},{signal:p.signal})).finally(()=>clearTimeout(b))}:this.fetch=d,this.retry=h}from(t){if(!t||typeof t!="string"||t.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new VC(new URL(`${this.url}/${t}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new Jw(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(t,n={},{head:a=!1,get:o=!1,count:l}={}){var u;let h;const d=new URL(`${this.url}/rpc/${t}`);let m;const v=_=>_!==null&&typeof _=="object"&&(!Array.isArray(_)||_.some(v)),p=a&&Object.values(n).some(v);p?(h="POST",m=n):a||o?(h=a?"HEAD":"GET",Object.entries(n).filter(([_,S])=>S!==void 0).map(([_,S])=>[_,Array.isArray(S)?`{${S.join(",")}}`:`${S}
15`]).forEach(([_,S])=>{d.searchParams.append(_,S)})):(h="POST",m=n);const b=new Headers(this.headers);return p?b.set("Prefer",l?`count=${l},return=minimal`:"return=minimal"):l&&b.set("Prefer",`count=${l}`),new Ri({method:h,url:d,headers:b,schema:this.schemaName,body:m,fetch:(u=this.fetch)!==null&&u!==void 0?u:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class XC{constructor(){}static detectEnvironment(){var t;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const n=globalThis;if(typeof globalThis<"u"&&typeof n.WebSocket<"u")return{type:"native",wsConstructor:n.WebSocket};const a=typeof global<"u"?global:void 0;if(a&&typeof a.WebSocket<"u")return{type:"native",wsConstructor:a.WebSocket};if(typeof globalThis<"u"&&typeof n.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"&&n.EdgeRuntime||typeof navigator<"u"&&(!((t=navigator.userAgent)===null||t===void 0)&&t.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 o=globalThis.process;if(o){const l=o.versions;if(l&&l.node)return{type:"unsupported",error:"Node.js detected but native WebSocket not found.",workaround:"Ensure you are running Node.js 22+ or provide a WebSocket implementation via the transport option."}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const t=this.detectEnvironment();if(t.wsConstructor)return t.wsConstructor;let n=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(n+=`
16
17Suggested solution: ${t.workaround}`),new Error(n)}static isWebSocketSupported(){try{return this.detectEnvironment().type==="native"}catch{return!1}}}const JC="2.110.2",ZC=`realtime-js/${JC}`,eO="1.0.0",Zw="2.0.0",tO=Zw,nO=1e4,rO=100,Os={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},eS={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},cp={connecting:"connecting",closing:"closing",closed:"closed"};class sO{constructor(t){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=t??[]}encode(t,n){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&typeof t.payload.event=="string")return n(this._binaryEncodeUserBroadcastPush(t));let a=[t.join_ref,t.ref,t.topic,t.event,t.payload];return n(JSON.stringify(a))}_binaryEncodeUserBroadcastPush(t){var n;return this._isArrayBuffer((n=t.payload)===null||n===void 0?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var n,a;const o=(a=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&a!==void 0?a:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,o)}_encodeJsonUserBroadcastPush(t){var n,a;const o=(a=(n=t.payload)===null||n===void 0?void 0:n.payload)!==null&&a!==void 0?a:{},u=new TextEncoder().encode(JSON.stringify(o)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,u)}_encodeUserBroadcastPush(t,n,a){var o,l;const u=t.topic,h=(o=t.ref)!==null&&o!==void 0?o:"",d=(l=t.join_ref)!==null&&l!==void 0?l:"",m=t.payload.event,v=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},p=Object.keys(v).length===0?"":JSON.stringify(v);if(d.length>255)throw new Error(`joinRef length ${d.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`ref length ${h.length} exceeds maximum of 255`);if(u.length>255)throw new Error(`topic length ${u.length} exceeds maximum of 255`);if(m.length>255)throw new Error(`userEvent length ${m.length} exceeds maximum of 255`);if(p.length>255)throw new Error(`metadata length ${p.length} exceeds maximum of 255`);const b=this.USER_BROADCAST_PUSH_META_LENGTH+d.length+h.length+u.length+m.length+p.length,_=new ArrayBuffer(this.HEADER_LENGTH+b);let S=new DataView(_),R=0;S.setUint8(R++,this.KINDS.userBroadcastPush),S.setUint8(R++,d.length),S.setUint8(R++,h.length),S.setUint8(R++,u.length),S.setUint8(R++,m.length),S.setUint8(R++,p.length),S.setUint8(R++,n),Array.from(d,x=>S.setUint8(R++,x.charCodeAt(0))),Array.from(h,x=>S.setUint8(R++,x.charCodeAt(0))),Array.from(u,x=>S.setUint8(R++,x.charCodeAt(0))),Array.from(m,x=>S.setUint8(R++,x.charCodeAt(0))),Array.from(p,x=>S.setUint8(R++,x.charCodeAt(0)));var E=new Uint8Array(_.byteLength+a.byteLength);return E.set(new Uint8Array(_),0),E.set(new Uint8Array(a),_.byteLength),E.buffer}decode(t,n){if(this._isArrayBuffer(t)){let a=this._binaryDecode(t);return n(a)}if(typeof t=="string"){const a=JSON.parse(t),[o,l,u,h,d]=a;
17return n({join_ref:o,ref:l,topic:u,event:h,payload:d})}return n({})}_binaryDecode(t){const n=new DataView(t),a=n.getUint8(0),o=new TextDecoder;if(a===this.KINDS.userBroadcast)return this._decodeUserBroadcast(t,n,o)}_decodeUserBroadcast(t,n,a){const o=n.getUint8(1),l=n.getUint8(2),u=n.getUint8(3),h=n.getUint8(4);let d=this.HEADER_LENGTH+4;const m=a.decode(t.slice(d,d+o));d=d+o;const v=a.decode(t.slice(d,d+l));d=d+l;const p=a.decode(t.slice(d,d+u));d=d+u;const b=t.slice(d,t.byteLength),_=h===this.JSON_ENCODING?JSON.parse(a.decode(b)):b,S={type:this.BROADCAST_EVENT,event:v,payload:_};return u>0&&(S.meta=JSON.parse(p)),{join_ref:null,ref:null,topic:m,event:this.BROADCAST_EVENT,payload:S}}_isArrayBuffer(t){var n;return t instanceof ArrayBuffer||((n=t?.constructor)===null||n===void 0?void 0:n.name)==="ArrayBuffer"}_pick(t,n){return!t||typeof t!="object"?{}:Object.fromEntries(Object.entries(t).filter(([a])=>n.includes(a)))}}var at;(function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"})(at||(at={}));const Z0=(e,t,n={})=>{var a;const o=(a=n.skipTypes)!==null&&a!==void 0?a:[];return t?Object.keys(t).reduce((l,u)=>(l[u]=aO(u,e,t,o),l),{}):{}},aO=(e,t,n,a)=>{const o=t.find(h=>h.name===e),l=o?.type,u=n[e];return l&&!a.includes(l)?tS(l,u):up(u)},tS=(e,t)=>{if(e.charAt(0)==="_"){const n=e.slice(1,e.length);return cO(t,n)}switch(e){case at.bool:return iO(t);case at.float4:case at.float8:case at.int2:case at.int4:case at.int8:case at.numeric:case at.oid:return oO(t);case at.json:case at.jsonb:return lO(t);case at.timestamp:return uO(t);case at.abstime:case at.date:case at.daterange:case at.int4range:case at.int8range:case at.money:case at.reltime:case at.text:case at.time:case at.timestamptz:case at.timetz:case at.tsrange:case at.tstzrange:return up(t);default:return up(t)}},up=e=>e,iO=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},oO=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},lO=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch{return e}return e},cO=(e,t)=>{if(typeof e!="string")return e;const n=e.length-1,a=e[n];if(e[0]==="{"&&a==="}"){let l;const u=e.slice(1,n);try{l=JSON.parse("["+u+"]")}catch{l=u?u.split(","):[]}return l.map(h=>tS(t,h))}return e},uO=e=>typeof e=="string"?e.replace(" ","T"):e,nS=e=>{const t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),t.pathname===""||t.pathname==="/"?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};var Xo=e=>typeof e=="function"?e:function(){return e},dO=typeof self<"u"?self:null,Ai=typeof window<"u"?window:null,vr=dO||Ai||globalThis,fO="2.0.0",hO=1e4,pO=1e3,_r={connecting:0,open:1,closing:2,closed:3},wn={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Gr={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},dp={longpoll:"longpoll",websocket:"websocket"},mO={complete:4},fp="base64url.bearer.phx.",Gc=class{constructor(e,t,n,a){this.channel=e,this.event=t,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=a,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}
vendor: 8,135 bytes, line 17
17matchReceive({status:e,response:t,_ref:n}){this.recHooks.filter(a=>a.status===e).forEach(a=>a.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},rS=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},gO=class{constructor(e,t,n){this.state=wn.closed,this.topic=e,this.params=Xo(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new Gc(this,Gr.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new rS(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=wn.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(a=>a.send()),this.pushBuffer=[]}),this.joinPush.receive("error",a=>{this.state=wn.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,a),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=wn.closed,this.socket.remove(this)}),this.onError(a=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,a),this.isJoining()&&this.joinPush.reset(),this.state=wn.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new Gc(this,Gr.leave,Xo({}),this.timeout).send(),this.state=wn.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(Gr.reply,(a,o)=>{this.trigger(this.replyEventName(o),a)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=wn.closed,this.bindings=[]}onClose(e){this.on(Gr.close,e)}onError(e){return this.on(Gr.error,t=>e(t))}on(e,t){let n=this.bindingRef++;return this.bindings.push({event:e,ref:n,callback:t}),n}off(e,t){this.bindings=this.bindings.filter(n=>!(n.event===e&&(typeof t>"u"||t===n.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,n=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let a=new Gc(this,e,function(){return t},n);return this.canPush()?a.send():(a.startTimeout(),this.pushBuffer.push(a)),a}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=wn.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(Gr.close,"leave")},n=new Gc(this,Gr.leave,Xo({}),e);return n.receive("ok",()=>t()).receive("timeout",()=>t()),n.send(),this.canPush()||n.trigger("ok",{}),n}onMessage(e,t,n){return t}filterBindings(e,t,n){return!0}isMember(e,t,n,a){return this.topic!==e?!1:a&&a!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:n,joinRef:a}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=wn.joining,this.joinPush.resend(e))}trigger(e,t,n,a){let o=this.onMessage(e,t,n,a);if(t&&!o)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let l=this.bindings.filter(u=>u.event===e&&this.filterBindings(u,t,n));for(let u=0;u<l.length;u++)l[u].callback(o,n,a||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===wn.closed}isErrored(){return this.state===wn.errored}isJoined(){return this.state===wn.joined}isJoining(){return this.state===wn.joining}isLeaving(){return this.state===wn.leaving}},xu=class{static request(e,t,n,a,o,l,u){if(vr.XDomainRequest){let h=new vr.XDomainRequest;return this.xdomainRequest(h,e,t,a,o,l,u)}else if(vr.XMLHttpRequest){let h=new vr.XMLHttpRequest;return this.xhrRequest(h,e,t,n,a,o,l,u)}else{if(vr.fetch&&vr.AbortController)return this.fetchRequest(e,t,n,a,o,l,u);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(e,t,n,a,o,l,u){let h={method:e,headers:n,body:a},d=null;return o&&(d=new AbortController,setTimeout(()=>d.abort(),o),h.signal=d.signal),vr.fetch(t,h).then(m=>m.text()).then(m=>this.parseJSON(m)).then(m=>u&&u(m)).catch(m=>{m.name==="AbortError"&&l?l():u&&u(null)}),d}static xdomainRequest(e,t,n,a,o,l,u){return e.timeout=o,e.open(t,n),e.onload=()=>{let h=this.parseJSON(e.responseText);u&&u(h)},l&&(e.ontimeout=l),e.onprogress=()=>{},e.send(a),e}static xhrRequest(e,t,n,a,o,l,u,h){e.open(t,n,!0),e.timeout=l;for(let[d,m]of Object.entries(a))e.setRequestHeader(d,m);return e.onerror=()=>h&&h(null),e.onreadystatechange=()=>{if(e.readyState===mO.complete&&h){let d=this.parseJSON(e.responseText);h(d)}},u&&(e.ontimeout=u),e.send(o),e}static parseJSON(e){if(!e||e==="")return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let n=[];for(var a in e){if(!Object.prototype.hasOwnProperty.call(e,a))continue;let o=t?`${t}[${a}]`:a,l=e[a];typeof l=="object"?n.push(this.serialize(l,o)):n.push(encodeURIComponent(o)+"="+encodeURIComponent(l))}return n.join("&")}static appendParams(e,t){if(Object.keys(t).length===0)return e;let n=e.match(/\?/)?"&":"?";return`${e}${n}${this.serialize(t)}`}},yO=e=>{let t="",n=new Uint8Array(e),a=n.byteLength;for(let o=0;o<a;o++)t+=String.fromCharCode(n[o]);return btoa(t)},yi=class{constructor(e,t){t&&t.length===2&&t[1].startsWith(fp)&&(this.authToken=atob(t[1].slice(fp.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=_r.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+dp.websocket),"$1/"+dp.longpoll)}endpointURL(){return xu.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,n){this.close(e,t,n),this.readyState=_r.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===_r.open||this.readyState===_r.connecting}poll(){const e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),t=>{if(t){var{status:n,token:a,messages:o}=t;if(n===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=a}else n=0;switch(n){case 200:o.forEach(l=>{setTimeout(()=>this.onmessage({data:l}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=_r.open,this.onopen({}),this.poll();break;
17case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${n}`)}})}send(e){typeof e!="string"&&(e=yO(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join(`
18`),()=>this.onerror("timeout"),t=>{this.awaitingBatchAck=!1,!t||t.status!==200?(this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(e,t,n){for(let o of this.reqs)o.abort();this.readyState=_r.closed;let a=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:n});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",a)):this.onclose(a)}ajax(e,t,n,a,o){let l,u=()=>{this.reqs.delete(l),a()};l=xu.request(e,this.endpointURL(),t,n,this.timeout,u,h=>{this.reqs.delete(l),this.isActive()&&o(h)}),this.reqs.add(l)}},vO=class Yo{constructor(t,n={}){let a=n.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(a.state,o=>{let{onJoin:l,onLeave:u,onSync:h}=this.caller;this.joinRef=this.channel.joinRef(),this.state=Yo.syncState(this.state,o,l,u),this.pendingDiffs.forEach(d=>{this.state=Yo.syncDiff(this.state,d,l,u)}),this.pendingDiffs=[],h()}),this.channel.on(a.diff,o=>{let{onJoin:l,onLeave:u,onSync:h}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(o):(this.state=Yo.syncDiff(this.state,o,l,u),h())})}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}list(t){return Yo.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(t,n,a,o){let l=this.clone(t),u={},h={};return this.map(l,(d,m)=>{n[d]||(h[d]=m)}),this.map(n,(d,m)=>{let v=l[d];if(v){let p=m.metas.map(R=>R.phx_ref),b=v.metas.map(R=>R.phx_ref),_=m.metas.filter(R=>b.indexOf(R.phx_ref)<0),S=v.metas.filter(R=>p.indexOf(R.phx_ref)<0);_.length>0&&(u[d]=m,u[d].metas=_),S.length>0&&(h[d]=this.clone(v),h[d].metas=S)}else u[d]=m}),this.syncDiff(l,{joins:u,leaves:h},a,o)}static syncDiff(t,n,a,o){let{joins:l,leaves:u}=this.clone(n);return a||(a=function(){}),o||(o=function(){}),this.map(l,(h,d)=>{let m=t[h];if(t[h]=this.clone(d),m){let v=t[h].metas.map(b=>b.phx_ref),p=m.metas.filter(b=>v.indexOf(b.phx_ref)<0);t[h].metas.unshift(...p)}a(h,m,d)}),this.map(u,(h,d)=>{let m=t[h];if(!m)return;let v=d.metas.map(p=>p.phx_ref);m.metas=m.metas.filter(p=>v.indexOf(p.phx_ref)<0),o(h,m,d),m.metas.length===0&&delete t[h]}),t}static list(t,n){return n||(n=function(a,o){return o}),this.map(t,(a,o)=>n(a,o))}static map(t,n){return Object.getOwnPropertyNames(t).map(a=>n(a,t[a]))}static clone(t){return JSON.parse(JSON.stringify(t))}},Vc={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(n))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[n,a,o,l,u]=JSON.parse(e);return t({join_ref:n,ref:a,topic:o,event:l,payload:u})}},binaryEncode(e){let{join_ref:t,ref:n,event:a,topic:o,payload:l}=e,u=this.META_LENGTH+t.length+n.length+o.length+a.length,h=new ArrayBuffer(this.HEADER_LENGTH+u),d=new DataView(h),m=0;d.setUint8(m++,this.KINDS.push),d.setUint8(m++,t.length),d.setUint8(m++,n.length),d.setUint8(m++,o.length),d.setUint8(m++,a.length),Array.from(t,p=>d.setUint8(m++,p.charCodeAt(0))),Array.from(n,p=>d.setUint8(m++,p.charCodeAt(0))),Array.from(o,p=>d.setUint8(m++,p.charCodeAt(0))),Array.from(a,p=>
18d.setUint8(m++,p.charCodeAt(0)));var v=new Uint8Array(h.byteLength+l.byteLength);return v.set(new Uint8Array(h),0),v.set(new Uint8Array(l),h.byteLength),v.buffer},binaryDecode(e){let t=new DataView(e),n=t.getUint8(0),a=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(e,t,a);case this.KINDS.reply:return this.decodeReply(e,t,a);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,a)}},decodePush(e,t,n){let a=t.getUint8(1),o=t.getUint8(2),l=t.getUint8(3),u=this.HEADER_LENGTH+this.META_LENGTH-1,h=n.decode(e.slice(u,u+a));u=u+a;let d=n.decode(e.slice(u,u+o));u=u+o;let m=n.decode(e.slice(u,u+l));u=u+l;let v=e.slice(u,e.byteLength);return{join_ref:h,ref:null,topic:d,event:m,payload:v}},decodeReply(e,t,n){let a=t.getUint8(1),o=t.getUint8(2),l=t.getUint8(3),u=t.getUint8(4),h=this.HEADER_LENGTH+this.META_LENGTH,d=n.decode(e.slice(h,h+a));h=h+a;let m=n.decode(e.slice(h,h+o));h=h+o;let v=n.decode(e.slice(h,h+l));h=h+l;let p=n.decode(e.slice(h,h+u));h=h+u;let b=e.slice(h,e.byteLength),_={status:p,response:b};return{join_ref:d,ref:m,topic:v,event:Gr.reply,payload:_}},decodeBroadcast(e,t,n){let a=t.getUint8(1),o=t.getUint8(2),l=this.HEADER_LENGTH+2,u=n.decode(e.slice(l,l+a));l=l+a;let h=n.decode(e.slice(l,l+o));l=l+o;let d=e.slice(l,e.byteLength);return{join_ref:null,ref:null,topic:u,event:h,payload:d}}},bO=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||hO,this.transport=t.transport||vr.WebSocket||yi,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null;let n=null;try{n=vr&&vr.sessionStorage}catch{}this.sessionStore=t.sessionStorage||n,this.establishedConnections=0,this.defaultEncoder=Vc.encode.bind(Vc),this.defaultDecoder=Vc.decode.bind(Vc),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==yi?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let a=null;Ai&&Ai.addEventListener&&(Ai.addEventListener("pagehide",o=>{this.conn&&(this.disconnect(),a=this.connectClock)}),Ai.addEventListener("pageshow",o=>{a===this.connectClock&&(a=null,this.connect())}),Ai.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=t.autoSendHeartbeat??!0,this.heartbeatCallback=t.heartbeatCallback??(()=>{}),this.rejoinAfterMs=o=>t.rejoinAfterMs?t.rejoinAfterMs(o):[1e3,2e3,5e3][o-1]||1e4,this.reconnectAfterMs=o=>t.reconnectAfterMs?t.reconnectAfterMs(o):[10,50,100,150,200,250,500,1e3,2e3][o-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(o,l,u)=>{console.log(`${o}: ${l}`,u)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=Xo(t.params||{}),this.endPoint=`${e}/${dp.websocket}`,this.vsn=t.vsn||fO,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new rS(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{t.beforeReconnect&&await t.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=t.authToken}getLongPollTransport(){return yi}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=xu.appendParams(xu.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return e.charAt(0)!=="/"?e:e.charAt(1)==="/"?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,n){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,n)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=Xo(e)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==yi?this.connectWithF
vendor: 4,353 bytes, line 18
18allback(yi,this.longPollFallbackMs):this.transportConnect())}log(e,t,n){this.logger&&this.logger(e,t,n)}hasLogger(){return this.logger!==null}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),n=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let a=this.onMessage(o=>{o.ref===t&&(this.off([a]),e(Date.now()-n))});return!0}transportName(e){return e===yi?"LongPoll":e.name}transportConnect(){this.connectClock++,this.closeWasClean=!1;let e;this.authToken&&(e=["phoenix",`${fp}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=t=>this.onConnError(t),this.conn.onmessage=t=>this.onConnMessage(t),this.conn.onclose=t=>this.onConnClose(t)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let n=!1,a=!0,o,l,u=this.transportName(e),h=d=>{this.log("transport",`falling back to ${u}...`,d),this.off([o,l]),a=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${u}`))return h("memorized");this.fallbackTimer=setTimeout(h,t),l=this.onError(d=>{this.log("transport","error",d),a&&!n&&(clearTimeout(this.fallbackTimer),h(d))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(n=!0,!a){let d=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${d}`,"true"),this.log("transport",`established ${d} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(h,t),this.ping(d=>{this.log("transport","connected to primary after",d),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),pO,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,n){if(!this.conn)return e&&e();const a=this.conn;this.waitForBufferDone(a,()=>{t?a.close(t,n||""):a.close(),this.waitForSocketClosed(a,()=>{this.conn===a&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,n=1){if(n===5||!e.bufferedAmount){t();return}setTimeout(()=>{this.waitForBufferDone(e,t,n+1)},150*n)}waitForSocketClosed(e,t,n=1){if(n===5||e.readyState===_r.closed){t();return}setTimeout(()=>{this.waitForSocketClosed(e,t,n+1)},150*n)}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(e),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",e)}onConnError(e){this.hasLogger()&&this.log("transport","error",e);let t=this.transport,n=this.establishedConnections;this.triggerStateCallbacks("error",e,t,n),(t===this.transport||n>0)&&this.triggerChanError(e)}
18triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(Gr.error,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case _r.connecting:return"connecting";case _r.open:return"open";case _r.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([n])=>e.indexOf(n)===-1)}channel(e,t={}){let n=new gO(e,t,this);return this.channels.push(n),n}push(e){if(this.hasLogger()){let{topic:t,event:n,payload:a,ref:o,join_ref:l}=e;this.log("push",`${t} ${n} (${l}, ${o})`,a)}this.isConnected()?this.encode(e,t=>this.conn.send(t)):this.sendBuffer.push(()=>this.encode(e,t=>this.conn.send(t)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,t=>{let{topic:n,event:a,payload:o,ref:l,join_ref:u}=t;if(l&&l===this.pendingHeartbeatRef){const h=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(o.status==="ok"?"ok":"error",h)}catch(d){this.log("error","error in heartbeat callback",d)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${o.status||""} ${n} ${a} ${l&&"("+l+")"||""}`.trim(),o);for(let h=0;h<this.channels.length;h++){const d=this.channels[h];d.isMember(n,a,o,u)&&d.trigger(a,o,l,u)}this.triggerStateCallbacks("message",t)})}triggerStateCallbacks(e,...t){try{this.stateChangeCallbacks[e].forEach(([n,a])=>{try{a(...t)}catch(o){this.log("error",`error in ${e} callback`,o)}})}catch(n){this.log("error",`error triggering ${e} callbacks`,n)}}leaveOpenTopic(e){let t=this.channels.find(n=>n.topic===e&&(n.isJoined()||n.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}};class Jo{constructor(t,n){const a=wO(n);this.presence=new vO(t.getChannel(),a),this.presence.onJoin((o,l,u)=>{const h=Jo.onJoinPayload(o,l,u);t.getChannel().trigger("presence",h)}),this.presence.onLeave((o,l,u)=>{const h=Jo.onLeavePayload(o,l,u);t.getChannel().trigger("presence",h)}),this.presence.onSync(()=>{t.getChannel().trigger("presence",{event:"sync"})})}get state(){return Jo.transformState(this.presence.state)}static transformState(t){return t=_O(t),Object.getOwnPropertyNames(t).reduce((n,a)=>{const o=t[a];return n[a]=pu(o),n},{})}static onJoinPayload(t,n,a){const o=eb(n),l=pu(a);return{event:"join",key:t,currentPresences:o,newPresences:l}}static onLeavePayload(t,n,a){const o=eb(n),l=pu(a);return{event:"leave",key:t,currentPresences:o,leftPresences:l}}}function pu(e){return e.metas.map(t=>(t.presence_ref=t.phx_ref,delete t.phx_ref,delete t.phx_ref_prev,t))}function _O(e){return JSON.parse(JSON.stringify(e))}function wO(e){return e?.events&&{events:e.events}}function eb(e){return e?.metas?pu(e):[]}var tb;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(tb||(tb={}));class SO{get state(){return this.presenceAdapter.state}constructor(t,n){this.channel=t,this.presenceAdapter=new Jo(this.channel.channelAdapter,n)}}function xO(e){if(e instanceof Error)return e;if(typeof e=="string")return new Error(e);
18if(e&&typeof e=="object"){const t=e;if(typeof t.code=="number"){const n=typeof t.reason=="string"&&t.reason?` (${t.reason})`:"";return new Error(`socket closed: ${t.code}${n}`,{cause:e})}return new Error("channel error: transport failure",{cause:e})}return new Error("channel error: connection lost")}class TO{constructor(t,n,a){const o=EO(a);this.channel=t.getSocket().channel(n,o),this.socket=t}get state(){return this.channel.state}set state(t){this.channel.state=t}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(t,n){return this.channel.on(t,n)}off(t,n){this.channel.off(t,n)}subscribe(t){return this.channel.join(t)}unsubscribe(t){return this.channel.leave(t)}teardown(){this.channel.teardown()}onClose(t){this.channel.onClose(t)}onError(t){return this.channel.onError(t)}push(t,n,a){let o;try{o=this.channel.push(t,n,a)}catch{throw new Error(`tried to push '${t}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>rO){const l=this.channel.pushBuffer.shift();l.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${l.event}`,l.payload())}return o}updateJoinPayload(t){const n=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},n),t)}canPush(){return this.socket.isConnected()&&this.state===Os.joined}isJoined(){return this.state===Os.joined}isJoining(){return this.state===Os.joining}isClosed(){return this.state===Os.closed}isLeaving(){return this.state===Os.leaving}updateFilterBindings(t){this.channel.filterBindings=t}updatePayloadTransform(t){this.channel.onMessage=t}getChannel(){return this.channel}}function EO(e){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},e.config)}}const RO=/[,()"\\]/,AO=e=>RO.test(e)||e!==e.trim(),kO=e=>`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,nb=e=>{const t=e===null?"null":String(e);return AO(t)?kO(t):t},CO=e=>e===null?"null":String(e),OO=(e,t)=>{if(e==="in"){const n=Array.isArray(t)?t:[t];if(n.length===0)throw new Error("Realtime `in` filter requires at least one value.");return`in.(${Array.from(new Set(n)).map(o=>nb(o)).join(",")})`}return e==="is"?`is.${CO(t)}`:`${e}.${nb(t)}`};class jO{constructor(){this.filters=[]}add(t,n,a,o=!1){const l=o?"not.":"";return this.filters.push(`${t}=${l}${OO(n,a)}`),this}eq(t,n){return this.add(t,"eq",n)}neq(t,n){return this.add(t,"neq",n)}gt(t,n){return this.add(t,"gt",n)}gte(t,n){return this.add(t,"gte",n)}lt(t,n){return this.add(t,"lt",n)}lte(t,n){return this.add(t,"lte",n)}in(t,n){return this.add(t,"in",n)}like(t,n){return this.add(t,"like",n)}ilike(t,n){return this.add(t,"ilike",n)}match(t,n){return this.add(t,"match",n)}imatch(t,n){return this.add(t,"imatch",n)}is(t,n){return this.add(t,"is",n)}isDistinct(t,n){return this.add(t,"isdistinct",n)}not(t,n,a){return this.add(t,n,a,!0)}build(){return this.filters.join(",")}toString(){return this.build()}}var rb;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(rb||(rb={}));var Ni;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(Ni||(Ni={}));var Vr;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(Vr||(Vr={}));class Zo{get state(){return this.channelAdapter.state}set state(t){this.channelAdapter.state=t}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(t,n={config:{}},a){var o,l;if(this.topic=t,this.params=n,this.socket=a,this.bindings={},this.subTopic=t.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.channelAdapter=new TO(this.socket.socketAdapter,t,this.params),this.presence=new SO(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=nS(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((l=(o=this.params.config)===null||o===void 0?void 0:o.broadcast)===null||l===void 0)&&l.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(t,n=this.timeout){var a,o,l;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:u,presence:h,private:d}}=this.params,m=(o=(a=this.bindings.postgres_changes)===null||a===void 0?void 0:a.map(_=>_.filter))!==null&&o!==void 0?o:[],v=!!this.bindings[Ni.PRESENCE]&&this.bindings[Ni.PRESENCE].length>0||((l=this.params.config.presence)===null||l===void 0?void 0:l.enabled)===!0,p={},b={broadcast:u,presence:Object.assign(Object.assign({},h),{enabled:v}),postgres_changes:m,private:d};this.socket.accessTokenValue&&(p.access_token=this.socket.accessTokenValue),this._onError(_=>{t?.(Vr.CHANNEL_ERROR,xO(_))}),this._onClose(()=>t?.(Vr.CLOSED)),this.updateJoinPayload(Object.assign({config:b},p)),this._updateFilterMessage(),this.channelAdapter.subscribe(n).receive("ok",async({postgres_changes:_})=>
18{if(this.socket._isManualToken()||this.socket.setAuth(),_===void 0){t?.(Vr.SUBSCRIBED);return}this._updatePostgresBindings(_,t)}).receive("error",_=>{this.state=Os.errored;const S=Object.values(_).join(", ")||"error";t?.(Vr.CHANNEL_ERROR,new Error(S,{cause:_}))}).receive("timeout",()=>{t?.(Vr.TIMED_OUT)})}return this}_updatePostgresBindings(t,n){var a;const o=this.bindings.postgres_changes,l=(a=o?.length)!==null&&a!==void 0?a:0,u=[];for(let h=0;h<l;h++){const d=o[h],{filter:{event:m,schema:v,table:p,filter:b}}=d,_=t&&t[h];if(_&&_.event===m&&Zo.isFilterValueEqual(_.schema,v)&&Zo.isFilterValueEqual(_.table,p)&&Zo.isFilterValueEqual(_.filter,b))u.push(Object.assign(Object.assign({},d),{id:_.id}));else{this.unsubscribe(),this.state=Os.errored,n?.(Vr.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=u,this.state!=Os.errored&&n&&n(Vr.SUBSCRIBED)}presenceState(){return this.presence.state}async track(t,n={}){return await this.send({type:"presence",event:"track",payload:t},n.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,n,a){const o=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),l=t===Ni.PRESENCE||t===Ni.POSTGRES_CHANGES;if(o&&l)throw this.socket.log("channel",`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${t}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(t,n,a)}async httpSend(t,n,a={}){var o;if(n==null)return Promise.reject(new Error("Payload is required for httpSend()"));const l=n instanceof ArrayBuffer||ArrayBuffer.isView(n),u={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":l?"application/octet-stream":"application/json"};this.socket.accessTokenValue&&(u.Authorization=`Bearer ${this.socket.accessTokenValue}`);const h=new URL(this.broadcastEndpointURL);h.pathname+=`/${encodeURIComponent(this.subTopic)}/events/${encodeURIComponent(t)}`,this.private&&h.searchParams.set("private","true");const d={method:"POST",headers:u,body:l?n:JSON.stringify(n)},m=await this._fetchWithTimeout(h.toString(),d,(o=a.timeout)!==null&&o!==void 0?o:this.timeout);if(m.status===202)return{success:!0};if(m.status===404)return Promise.reject(new Error("httpSend() requires Realtime server v2.97.0 or newer; the endpoint returned 404. Update your Supabase CLI to a recent version, or upgrade the Realtime server in your self-hosted setup. See https://github.com/supabase/supabase-js/blob/master/packages/core/realtime-js/migrations/httpsend-server-version.md"));let v=m.statusText;try{const p=await m.json();v=p.error||p.message||v}catch{}return Promise.reject(new Error(v))}async send(t,n={}){var a,o;if(!this.channelAdapter.canPush()&&t.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated 
18in the future. Please use httpSend() explicitly for REST delivery.");const{event:l,payload:u}=t,h={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(h.Authorization=`Bearer ${this.socket.accessTokenValue}`);const d={method:"POST",headers:h,body:JSON.stringify({messages:[{topic:this.subTopic,event:l,payload:u,private:this.private}]})};try{const m=await this._fetchWithTimeout(this.broadcastEndpointURL,d,(a=n.timeout)!==null&&a!==void 0?a:this.timeout);return await((o=m.body)===null||o===void 0?void 0:o.cancel()),m.ok?"ok":"error"}catch(m){return m instanceof Error&&m.name==="AbortError"?"timed out":"error"}}else return new Promise(l=>{var u,h,d;const m=this.channelAdapter.push(t.type,t,n.timeout||this.timeout);t.type==="broadcast"&&!(!((d=(h=(u=this.params)===null||u===void 0?void 0:u.config)===null||h===void 0?void 0:h.broadcast)===null||d===void 0)&&d.ack)&&l("ok"),m.receive("ok",()=>l("ok")),m.receive("error",()=>l("error")),m.receive("timeout",()=>l("timed out"))})}updateJoinPayload(t){this.channelAdapter.updateJoinPayload(t)}async unsubscribe(t=this.timeout){return new Promise(n=>{this.channelAdapter.unsubscribe(t).receive("ok",()=>n("ok")).receive("timeout",()=>n("timed out")).receive("error",()=>n("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(t,n,a){const o=new AbortController,l=setTimeout(()=>o.abort(),a),u=await this.socket.fetch(t,Object.assign(Object.assign({},n),{signal:o.signal}));return clearTimeout(l),u}_on(t,n,a){const o=t.toLocaleLowerCase(),l=n?.filter;(l instanceof jO||typeof l=="object"&&l!==null&&typeof l.build=="function")&&(n=Object.assign(Object.assign({},n),{filter:l.build()}));const u=this.channelAdapter.on(t,a),h={type:o,filter:n,callback:a,ref:u};return this.bindings[o]?this.bindings[o].push(h):this.bindings[o]=[h],this._updateFilterMessage(),this}_onClose(t){this.channelAdapter.onClose(t)}_onError(t){this.channelAdapter.onError(t)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((t,n,a)=>{var o,l,u,h,d,m,v;const p=t.event.toLocaleLowerCase();if(this._notThisChannelEvent(p,a))return!1;const b=(o=this.bindings[p])===null||o===void 0?void 0:o.find(_=>_.ref===t.ref);if(!b)return!0;if(["broadcast","presence","postgres_changes"].includes(p))if("id"in b){const _=b.id,S=(l=b.filter)===null||l===void 0?void 0:l.event;return _&&((u=n.ids)===null||u===void 0?void 0:u.includes(_))&&(S==="*"||S?.toLocaleLowerCase()===((h=n.data)===null||h===void 0?void 0:h.type.toLocaleLowerCase()))}else{const _=(m=(d=b?.filter)===null||d===void 0?void 0:d.event)===null||m===void 0?void 0:m.toLocaleLowerCase();return _==="*"||_===((v=n?.event)===null||v===void 0?void 0:v.toLocaleLowerCase())}else return b.type.toLocaleLowerCase()===p})}_notThisChannelEvent(t,n){const{close:a,error:o,leave:l,join:u}=eS;return n&&[a,o,l,u].includes(t)&&n!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((t,n,a)=>{if(typeof n=="object"&&"ids"in n){const o=n.data,{schema:l,table:u,commit_timestamp:h,type:d,errors:m}=o;return Object.assign(Object.assign({},{schema:l,table:u,commit_timestamp:h,eventType:d,new:{},old:{},errors:m}),this._getPayloadRecords(o))}return n})}copyBindings(t){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const n in t.bindings)for(const a of t.bindings[n])this._on(a.type,a.filter,a.callback)}static isFilterValueEqual(t,n){return(t??void 0)===(n??void 0)}_getPayloadRecords(t){const n={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(n.new=Z0(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(n.old=Z0(t.columns,t.old_record)),n}}class DO{constructor(t,n){this.socket=new bO(t,n)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(t){this.socket.heartbeatCallback=t}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(t,n,a,o=1e4){return new Promise(l=>{setTimeout(()=>l("timeout"),o),this.socket.disconnect(()=>{t(),l("ok")},n,a)})}push(t){this.socket.push(t)}log(t,n,a){this.socket.log(t,n,a)}makeRef(){return this.socket.makeRef()}onOpen(t){this.socket.onOpen(t)}onClose(t){this.socket.onClose(t)}onError(t){this.socket.onError(t)}onMessage(t){this.socket.onMessage(t)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==cp.connecting}isDisconnecting(){return this.socket.connectionState()==cp.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const sb={HEARTBEAT_INTERVAL:25e3},MO=[1e3,2e3,5e3,1e4],NO=1e4;function LO(){const e=new Map;return{get length(){return e.size},clear(){e.clear()},getItem(t){return e.has(t)?e.get(t):null},key(t){var n;return(n=Array.from(e.keys())[t])!==null&&n!==void 0?n:null},removeItem(t){e.delete(t)},setItem(t,n){e.set(t,String(n))}}}function zO(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return LO()}const PO=`
19  addEventListener("message", (e) => {
20    if (e.data.event === "start") {
21      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
22    }
23  });`;class UO{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(t,n){var a;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={}
23,this.ref=0,this.serializer=new sO,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=l=>l?(...u)=>l(...u):(...u)=>fetch(...u),!(!((a=n?.params)===null||a===void 0)&&a.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey;const o=this._initializeOptions(n);this.socketAdapter=new DO(t,o),this.httpEndpoint=nS(t),this.fetch=this._resolveFetch(n?.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(t){const n=t.message;throw new Error(`WebSocket not available: ${n}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(t,n){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},t,n)}getChannels(){return this.channels}async removeChannel(t){const n=await t.unsubscribe();return n==="ok"&&t.teardown(),n}async removeAllChannels(){const t=this.channels.map(async a=>{const o=await a.unsubscribe();return a.teardown(),o}),n=await Promise.all(t);return await this.disconnect(),n}log(t,n,a){this.socketAdapter.log(t,n,a)}connectionState(){return this.socketAdapter.connectionState()||cp.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(t,n={config:{}}){const a=`realtime:${t}`,o=this.getChannels().find(l=>l.topic===a);if(o)return o;{const l=new Zo(`realtime:${t}`,n,this);return this._cancelPendingDisconnect(),this.channels.push(l),l}}push(t){this.socketAdapter.push(t)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(t){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(t)}_makeRef(){return this.socketAdapter.makeRef()}_remove(t){this.channels=this.channels.filter(n=>n.topic!==t.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}
23this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(t=null){let n,a=!1;if(t)n=t,a=!0;else if(this.accessToken)try{n=await this.accessToken()}catch(o){this.log("error","Error fetching access token from callback",o),n=this.accessTokenValue}else n=this.accessTokenValue;a?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEach(o=>{const l={access_token:n,version:ZC};n&&o.updateJoinPayload(l),o.joinedOnce&&o.channelAdapter.isJoined()&&o.channelAdapter.push(eS.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this._isManualToken()||this.setAuth().catch(n=>{this.log("error",`Error setting auth in ${t}`,n)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(n=>{this.log("error","error waiting for auth on connect",n)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(t=>{t.ref&&t.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(t){return(n,a)=>{n!=="disconnected"&&(n=="sent"&&this._setAuthSafely(),t&&t(n,a))}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const t=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(t),this.workerRef.onerror=n=>{this.log("worker","worker error",n.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=n=>{n.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(t){let n;if(t)n=t;else{const a=new Blob([PO],{type:"application/javascript"});n=URL.createObjectURL(a)}return n}_initializeOptions(t){var n,a,o,l,u,h,d,m,v,p,b,_;this.worker=(n=t?.worker)!==null&&n!==void 0?n:!1,this.accessToken=(a=t?.accessToken)!==null&&a!==void 0?a:null;const S={};S.timeout=(o=t?.timeout)!==null&&o!==void 0?o:nO,S.heartbeatIntervalMs=(l=t?.heartbeatIntervalMs)!==null&&l!==void 0?l:sb.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(u=t?.disconnectOnEmptyChannelsAfterMs)!==null&&u!==void 0?u:2*((h=t?.heartbeatIntervalMs)!==null&&h!==void 0?h:sb.HEARTBEAT_INTERVAL),S.transport=(d=t?.transport)!==null&&d!==void 0?d:XC.getWebSocketConstructor(),S.params=t?.params,S.logger=t?.logger,S.heartbeatCallback=this._wrapHeartbeatCallback(t?.heartbeatCallback),S.sessionStorage=(m=t?.sessionStorage)!==null&&m!==void 0?m:zO(),S.reconnectAfterMs=(v=t?.reconnectAfterMs)!==null&&v!==void 0?v:(k=>MO[k-1]||NO);let R,E;const x=(p=t?.vsn)!==null&&p!==void 0?p:tO;switch(x){case eO:R=(k,D)=>D(JSON.stringify(k)),E=(k,D)=>D(JSON.parse(k));break;case Zw:R=this.serializer.encode.bind(this.serializer),E=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${S.vsn}`)}if(S.vsn=x,S.encode=(b=t?.encode)!==null&&b!==void 0?b:R,S.decode=(_=t?.decode)!==null&&_!==void 0?_:E,S.beforeReconnect=this._reconnectAuth.bind(this),(t?.logLevel||t?.log_level)&&(this.logLevel=t.logLevel||t.log_level,S.params=Object.assign(Object.assign({},S.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=t?.workerUrl,S.autoSendHeartbeat=!this.worker}return S}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}
23var cl=class extends Error{constructor(e,t){super(e),this.name="IcebergError",this.status=t.status,this.icebergType=t.icebergType,this.icebergCode=t.icebergCode,this.details=t.details,this.isCommitStateUnknown=t.icebergType==="CommitStateUnknownException"||[500,502,504].includes(t.status)&&t.icebergType?.includes("CommitState")===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function $O(e,t,n){const a=new URL(t,e);if(n)for(const[o,l]of Object.entries(n))l!==void 0&&a.searchParams.set(o,l);return a.toString()}async function BO(e){return!e||e.type==="none"?{}:e.type==="bearer"?{Authorization:`Bearer ${e.token}`}:e.type==="header"?{[e.name]:e.value}:e.type==="custom"?await e.getHeaders():{}}function IO(e){const t=e.fetchImpl??globalThis.fetch;return{async request({method:n,path:a,query:o,body:l,headers:u}){const h=$O(e.baseUrl,a,o),d=await BO(e.auth),m=await t(h,{method:n,headers:{...l?{"Content-Type":"application/json"}:{},...d,...u},body:l?JSON.stringify(l):void 0}),v=await m.text(),p=(m.headers.get("content-type")||"").includes("application/json"),b=p&&v?JSON.parse(v):v;if(!m.ok){const _=p?b:void 0,S=_?.error;throw new cl(S?.message??`Request failed with status ${m.status}`,{status:m.status,icebergType:S?.type,icebergCode:S?.code,details:_})}return{status:m.status,headers:m.headers,data:b}}}}function Yc(e){return e.join("�")}var HO=class{constructor(e,t=""){this.client=e,this.prefix=t}async listNamespaces(e){const t=e?{parent:Yc(e.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:t})).data.namespaces.map(a=>({namespace:a}))}async createNamespace(e,t){const n={namespace:e.namespace,properties:t?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Yc(e.namespace)}`})}async loadNamespaceMetadata(e){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Yc(e.namespace)}`})).data.properties}}async namespaceExists(e){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Yc(e.namespace)}`}),!0}catch(t){if(t instanceof cl&&t.status===404)return!1;throw t}}async createNamespaceIfNotExists(e,t){try{return await this.createNamespace(e,t)}catch(n){if(n instanceof cl&&n.status===409)return;throw n}}};function vi(e){return e.join("�")}var qO=class{constructor(e,t="",n){this.client=e,this.prefix=t,this.accessDelegation=n}async listTables(e){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${vi(e.namespace)}/tables`})).data.identifiers}async createTable(e,t){const n={};return this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${vi(e.namespace)}/tables`,body:t,headers:n})).data.metadata}async updateTable(e,t){const n=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${vi(e.namespace)}/tables/${e.name}`,body:t});return{"metadata-location":n.data["metadata-location"],metadata:n.data.metadata}}async dropTable(e,t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${vi(e.namespace)}/tables/${e.name}`,query:{purgeRequested:String(t?.purge??!1)}})}async loadTable(e){const t={};return this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${vi(e.namespace)}/tables/${e.name}`,headers:t})).data.metadata}async tableExists(e){const t={};this.accessDelegation&&(t["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${vi(e.namespace)}/tables/${e.name}`,headers:t}),!0}catch(n){if(n instanceof cl&&n.status===404)return!1;throw n}}async createTableIfNotExists(e,t){try{return await this.createTable(e,t)}catch(n){if(n instanceof cl&&n.status===409)return await this.loadTable({namespace:e.namespace,name:t.name});throw n}}},FO=class{constructor(e){let t="v1";e.catalogName&&(t+=`/${e.catalogName}`);const n=e.baseUrl.endsWith("/")?e.baseUrl:`${e.baseUrl}/`;this.client=IO({baseUrl:n,auth:e.auth,fetchImpl:e.fetch}),this.accessDelegation=e.accessDelegation?.join(","),this.namespaceOps=new HO(this.client,t),this.tableOps=new qO(this.client,t,this.accessDelegation)}async listNamespaces(e){return this.namespaceOps.listNamespaces(e)}async createNamespace(e,t){return this.namespaceOps.createNamespace(e,t)}async dropNamespace(e){await this.namespaceOps.dropNamespace(e)}async loadNamespaceMetadata(e){return this.namespaceOps.loadNamespaceMetadata(e)}async listTables(e){return this.tableOps.listTables(e)}
23async createTable(e,t){return this.tableOps.createTable(e,t)}async updateTable(e,t){return this.tableOps.updateTable(e,t)}async dropTable(e,t){await this.tableOps.dropTable(e,t)}async loadTable(e){return this.tableOps.loadTable(e)}async namespaceExists(e){return this.namespaceOps.namespaceExists(e)}async tableExists(e){return this.tableOps.tableExists(e)}async createNamespaceIfNotExists(e,t){return this.namespaceOps.createNamespaceIfNotExists(e,t)}async createTableIfNotExists(e,t){return this.tableOps.createTableIfNotExists(e,t)}};function ul(e){"@babel/helpers - typeof";return ul=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ul(e)}function GO(e,t){if(ul(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var a=n.call(e,t);if(ul(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function VO(e){var t=GO(e,"string");return ul(t)=="symbol"?t:t+""}function YO(e,t,n){return(t=VO(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ab(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,a)}return n}function be(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ab(Object(n),!0).forEach(function(a){YO(e,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ab(Object(n)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))})}return e}var Fu=class extends Error{constructor(e,t="storage",n,a){super(e),this.__isStorageError=!0,this.namespace=t,this.name=t==="vectors"?"StorageVectorsError":"StorageError",this.status=n,this.statusCode=a}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function Gu(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}var hp=class extends Fu{constructor(e,t,n,a="storage"){super(e,a,t,n),this.name=a==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=t,this.statusCode=n}toJSON(){return be({},super.toJSON())}},sS=class extends Fu{constructor(e,t,n="storage"){super(e,n),this.name=n==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=t}};function Tu(e,t,n){const a=be({},e),o=t.toLowerCase();for(const l of Object.keys(a))l.toLowerCase()===o&&delete a[l];return a[o]=n,a}function KO(e){const t={};for(const[n,a]of Object.entries(e))t[n.toLowerCase()]=a;return t}const WO=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),QO=e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},pp=e=>{if(Array.isArray(e))return e.map(n=>pp(n));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([n,a])=>{const o=n.replace(/([-_][a-z])/gi,l=>l.toUpperCase().replace(/[-_]/g,""));t[o]=pp(a)}),t},XO=e=>!e||typeof e!="string"||e.length===0||e.length>100||e.trim()!==e||e.includes("/")||e.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(e),ib=e=>{if(typeof e=="object"&&e!==null){const t=e;if(typeof t.msg=="string")return t.msg;if(typeof t.message=="string")return t.message;if(typeof t.error_description=="string")return t.error_description;if(typeof t.error=="string")return t.error;if(typeof t.error=="object"&&t.error!==null){const n=t.error;if(typeof n.message=="string")return n.message}}return JSON.stringify(e)},JO=async(e,t,n,a)=>{if(e!==null&&typeof e=="object"&&"json"in e&&typeof e.json=="function"){const o=e;let l=parseInt(String(o.status),10);Number.isFinite(l)||(l=500),o.json().then(u=>{const h=u?.statusCode||u?.code||l+"";t(new hp(ib(u),l,h,a))}).catch(()=>{const u=l+"";t(new hp(o.statusText||`HTTP ${l} error`,l,u,a))})}else t(new sS(ib(e),e,a))},ZO=(e,t,n,a)=>{const o={method:e,headers:t?.headers||{}};if(e==="GET"||e==="HEAD"||!a)return be(be({},o),n);if(QO(a)){var l;const u=t?.headers||{};let h;for(const[d,m]of Object.entries(u))d.toLowerCase()==="content-type"&&(h=m);o.headers=Tu(u,"Content-Type",(l=h)!==null&&l!==void 0?l:"application/json"),o.body=JSON.stringify(a)}else o.body=a;return t?.duplex&&(o.duplex=t.duplex),be(be({},o),n)};async function $o(e,t,n,a,o,l,u){return new Promise((h,d)=>{e(n,ZO(t,a,o,l)).then(m=>{if(!m.ok)throw m;if(a?.noResolveJson)return m;if(u==="vectors"){const v=m.headers.get("content-type");if(m.headers.get("content-length")==="0"||m.status===204)return{};if(!v||!v.includes("application/json"))return{}}return m.json()}).then(m=>h(m)).catch(m=>JO(m,d,a,u))})}function aS(e="storage"){return{get:async(t,n,a,o)=>$o(t,"GET",n,a,o,void 0,e),post:async(t,n,a,o,l)=>$o(t,"POST",n,o,l,a,e),put:async(t,n,a,o,l)=>$o(t,"PUT",n,o,l,a,e),head:async(t,n,a,o)=>$o(t,"HEAD",n,be(be({},a),{},{noResolveJson:!0}),o,void 0,e),remove:async(t,n,a,o,l)=>$o(t,"DELETE",n,o,l,a,e)}}const ej=aS("storage"),{get:dl,post:sr,put:mp,head:tj,remove:fl}=ej,Mn=aS("vectors");var $i=class{constructor(e,t={},n,a="storage"){this.shouldThrowOnError=!1,this.url=e,this.headers=KO(t),this.fetch=WO(n),this.namespace=a}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=Tu(this.headers,e,t),this}async handleOperation(e){var t=this;try{return{data:await e(),error:null}}catch(n){if(t.shouldThrowOnError)throw n;if(Gu(n))return{data:null,error:n};throw n}}};let iS;iS=Symbol.toStringTag;var nj=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[iS]="StreamDownloadBuilder",this.promise=null}
23then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var e=this;try{return{data:(await e.downloadFn()).body,error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(Gu(t))return{data:null,error:t};throw t}}};let oS;oS=Symbol.toStringTag;var rj=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[oS]="BlobDownloadBuilder",this.promise=null}asStream(){return new nj(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var e=this;try{return{data:await(await e.downloadFn()).blob(),error:null}}catch(t){if(e.shouldThrowOnError)throw t;if(Gu(t))return{data:null,error:t};throw t}}};const kh={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},ob={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var sj=class extends $i{constructor(e,t={},n,a){super(e,t,a,"storage"),this.bucketId=n}async uploadOrUpdate(e,t,n,a){var o=this;return o.handleOperation(async()=>{let l;const u=be(be({},ob),a);let h=be(be({},o.headers),e==="POST"&&{"x-upsert":String(u.upsert)});const d=u.metadata;if(typeof Blob<"u"&&n instanceof Blob?(l=new FormData,l.append("cacheControl",u.cacheControl),d&&l.append("metadata",o.encodeMetadata(d)),l.append("",n)):typeof FormData<"u"&&n instanceof FormData?(l=n,l.has("cacheControl")||l.append("cacheControl",u.cacheControl),d&&!l.has("metadata")&&l.append("metadata",o.encodeMetadata(d))):(l=n,h["cache-control"]=`max-age=${u.cacheControl}`,h["content-type"]=u.contentType,d&&(h["x-metadata"]=o.toBase64(o.encodeMetadata(d))),(typeof ReadableStream<"u"&&l instanceof ReadableStream||l&&typeof l=="object"&&"pipe"in l&&typeof l.pipe=="function")&&!u.duplex&&(u.duplex="half")),a?.headers)for(const[b,_]of Object.entries(a.headers))h=Tu(h,b,_);const m=o._removeEmptyFolders(t),v=o._getFinalPath(m),p=await(e=="PUT"?mp:sr)(o.fetch,`${o.url}/object/${v}`,l,be({headers:h},u?.duplex?{duplex:u.duplex}:{}));return{path:m,id:p.Id,fullPath:p.Key}})}async upload(e,t,n){return this.uploadOrUpdate("POST",e,t,n)}async uploadToSignedUrl(e,t,n,a){var o=this;const l=o._removeEmptyFolders(e),u=o._getFinalPath(l),h=new URL(o.url+`/object/upload/sign/${u}`);return h.searchParams.set("token",t),o.handleOperation(async()=>{let d;const m=be(be({},ob),a);let v=be(be({},o.headers),{"x-upsert":String(m.upsert)});const p=m.metadata;if(typeof Blob<"u"&&n instanceof Blob?(d=new FormData,d.append("cacheControl",m.cacheControl),p&&d.append("metadata",o.encodeMetadata(p)),d.append("",n)):typeof FormData<"u"&&n instanceof FormData?(d=n,d.has("cacheControl")||d.append("cacheControl",m.cacheControl),p&&!d.has("metadata")&&d.append("metadata",o.encodeMetadata(p))):(d=n,v["cache-control"]=`max-age=${m.cacheControl}`,v["content-type"]=m.contentType,p&&(v["x-metadata"]=o.toBase64(o.encodeMetadata(p))),(typeof ReadableStream<"u"&&d instanceof ReadableStream||d&&typeof d=="object"&&"pipe"in d&&typeof d.pipe=="function")&&!m.duplex&&(m.duplex="half")),a?.headers)for(const[b,_]of Object.entries(a.headers))v=Tu(v,b,_);return{path:l,fullPath:(await mp(o.fetch,h.toString(),d,be({headers:v},m?.duplex?{duplex:m.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var n=this;return n.handleOperation(async()=>{let a=n._getFinalPath(e);const o=be({},n.headers);t?.upsert&&(o["x-upsert"]="true");const l=await sr(n.fetch,`${n.url}/object/upload/sign/${a}`,{},{headers:o}),u=new URL(n.url+l.url),h=u.searchParams.get("token");if(!h)throw new Fu("No token returned by API");return{signedUrl:u.toString(),path:e,token:h}})}async update(e,t,n){return this.uploadOrUpdate("PUT",e,t,n)}async move(e,t,n){var a=this;return a.handleOperation(async()=>await sr(a.fetch,`${a.url}/object/move`,{bucketId:a.bucketId,sourceKey:e,destinationKey:t,de
23stinationBucket:n?.destinationBucket},{headers:a.headers}))}async copy(e,t,n){var a=this;return a.handleOperation(async()=>({path:(await sr(a.fetch,`${a.url}/object/copy`,{bucketId:a.bucketId,sourceKey:e,destinationKey:t,destinationBucket:n?.destinationBucket},{headers:a.headers})).Key}))}async createSignedUrl(e,t,n){var a=this;return a.handleOperation(async()=>{let o=a._getFinalPath(e);const l=typeof n?.transform=="object"&&n.transform!==null&&Object.keys(n.transform).length>0;let u=await sr(a.fetch,`${a.url}/object/sign/${o}`,be({expiresIn:t},l?{transform:n.transform}:{}),{headers:a.headers});const h=new URLSearchParams;n?.download&&h.set("download",n.download===!0?"":n.download),n?.cacheNonce!=null&&h.set("cacheNonce",String(n.cacheNonce));const d=h.toString();return{signedUrl:encodeURI(`${a.url}${u.signedURL}${d?`&${d}`:""}`)}})}async createSignedUrls(e,t,n){var a=this;return a.handleOperation(async()=>{const o=await sr(a.fetch,`${a.url}/object/sign/${a.bucketId}`,{expiresIn:t,paths:e},{headers:a.headers}),l=new URLSearchParams;n?.download&&l.set("download",n.download===!0?"":n.download),n?.cacheNonce!=null&&l.set("cacheNonce",String(n.cacheNonce));const u=l.toString();return o.map(h=>be(be({},h),{},{signedUrl:h.signedURL?encodeURI(`${a.url}${h.signedURL}${u?`&${u}`:""}`):null}))})}download(e,t,n){const a=typeof t?.transform=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",o=new URLSearchParams;t?.transform&&this.applyTransformOptsToQuery(o,t.transform),t?.cacheNonce!=null&&o.set("cacheNonce",String(t.cacheNonce));const l=o.toString(),u=this._getFinalPath(e),h=()=>dl(this.fetch,`${this.url}/${a}/${u}${l?`?${l}`:""}`,{headers:this.headers,noResolveJson:!0},n);return new rj(h,this.shouldThrowOnError)}async info(e){var t=this;const n=t._getFinalPath(e);return t.handleOperation(async()=>pp(await dl(t.fetch,`${t.url}/object/info/${n}`,{headers:t.headers})))}async exists(e){var t=this;const n=t._getFinalPath(e);try{return await tj(t.fetch,`${t.url}/object/${n}`,{headers:t.headers}),{data:!0,error:null}}catch(o){if(t.shouldThrowOnError)throw o;if(Gu(o)){var a;const l=o instanceof hp?o.status:o instanceof sS?(a=o.originalError)===null||a===void 0?void 0:a.status:void 0;if(l!==void 0&&[400,404].includes(l))return{data:!1,error:o}}throw o}}getPublicUrl(e,t){const n=this._getFinalPath(e),a=new URLSearchParams;t?.download&&a.set("download",t.download===!0?"":t.download),t?.transform&&this.applyTransformOptsToQuery(a,t.transform),t?.cacheNonce!=null&&a.set("cacheNonce",String(t.cacheNonce));const o=a.toString(),l=typeof t?.transform=="object"&&t.transform!==null&&Object.keys(t.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${l}/public/${n}`)+(o?`?${o}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await fl(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async purgeCache(e,t,n){var a=this;return a.handleOperation(async()=>{const o=a._getFinalPath(e),l=new URLSearchParams;t?.transformations&&l.set("transformations","true");const u=l.toString();return await fl(a.fetch,`${a.url}/cdn/${o}${u?`?${u}`:""}`,{},{headers:a.headers},n)})}async list(e,t,n){var a=this;return a.handleOperation(async()=>{const o=t?.sortBy?be(be({},kh.sortBy),t.sortBy):kh.sortBy,l=be(be(be({},kh),t),{},{sortBy:o,prefix:e||""});return await sr(a.fetch,`${a.url}/object/list/${a.bucketId}`,l,{headers:a.headers},n)})}async listV2(e,t){var n=this;return n.handleOperation(async()=>{const a=be({},e);return await sr(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,a,{headers:n.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return typeof Buffer<"u"?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(e,t){return t.width&&e.set("width",t.width.toString()),t.height&&e.set("height",t.height.toString()),t.resize&&e.set("resize",t.resize),t.format&&e.set("format",t.format),t.quality&&e.set("qual
23ity",t.quality.toString()),e}};const aj="2.110.2",Tl={"X-Client-Info":`storage-js/${aj}`};var ij=class extends $i{constructor(e,t={},n,a){const o=new URL(e);a?.useNewHostname&&/supabase\.(co|in|red)$/.test(o.hostname)&&!o.hostname.includes("storage.supabase.")&&(o.hostname=o.hostname.replace("supabase.","storage.supabase."));const l=o.href.replace(/\/$/,""),u=be(be({},Tl),t);super(l,u,n,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const n=t.listBucketOptionsToQueryString(e);return await dl(t.fetch,`${t.url}/bucket${n}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await dl(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var n=this;return n.handleOperation(async()=>await sr(n.fetch,`${n.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}))}async updateBucket(e,t){var n=this;return n.handleOperation(async()=>await mp(n.fetch,`${n.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:n.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await sr(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await fl(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}async purgeBucketCache(e,t,n){var a=this;return a.handleOperation(async()=>{const o=new URLSearchParams;t?.transformations&&o.set("transformations","true");const l=o.toString();return await fl(a.fetch,`${a.url}/cdn/${e}${l?`?${l}`:""}`,{},{headers:a.headers},n)})}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},oj=class extends $i{constructor(e,t={},n){const a=e.replace(/\/$/,""),o=be(be({},Tl),t);super(a,o,n,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await sr(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const n=new URLSearchParams;e?.limit!==void 0&&n.set("limit",e.limit.toString()),e?.offset!==void 0&&n.set("offset",e.offset.toString()),e?.sortColumn&&n.set("sortColumn",e.sortColumn),e?.sortOrder&&n.set("sortOrder",e.sortOrder),e?.search&&n.set("search",e.search);const a=n.toString(),o=a?`${t.url}/bucket?${a}`:`${t.url}/bucket`;return await dl(t.fetch,o,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await fl(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(e){var t=this;if(!XO(e))throw new Fu("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 n=new FO({baseUrl:this.url,catalogName:e,auth:{type:"custom",getHeaders:async()=>t.headers},fetch:this.fetch}),a=this.shouldThrowOnError;return new Proxy(n,{get(o,l){const u=o[l];return typeof u!="function"?u:async(...h)=>{try{return{data:await u.apply(o,h),error:null}}catch(d){if(a)throw d;return{data:null,error:d}}}}})}},lj=class extends $i{constructor(e,t={},n){const a=e.replace(/\/$/,""),o=be(be({},Tl),{},{"Content-Type":"application/json"},t);super(a,o,n,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await Mn.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var n=this;return n.handleOperation(async()=>await Mn.post(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await Mn.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var n=this;return n.handleOperation(async()=>await Mn.post(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:n.headers})||{})}},cj=class extends $i{constructor(e,t={},n){const a=e.replace(/\/$/,""),o=be(be({},Tl),{},{"Content-Type":"application/json"},t);super(a,o,n,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await Mn.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await Mn.post(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}))}async listVectors(e){var t=this;if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");
23if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return t.handleOperation(async()=>await Mn.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await Mn.post(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}))}async deleteVectors(e){var t=this;if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return t.handleOperation(async()=>await Mn.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},uj=class extends $i{constructor(e,t={},n){const a=e.replace(/\/$/,""),o=be(be({},Tl),{},{"Content-Type":"application/json"},t);super(a,o,n,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await Mn.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await Mn.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await Mn.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await Mn.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},dj=class extends uj{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new fj(this.url,this.headers,e,this.fetch)}async createBucket(e){var t=()=>super.createBucket,n=this;return t().call(n,e)}async getBucket(e){var t=()=>super.getBucket,n=this;return t().call(n,e)}async listBuckets(e={}){var t=()=>super.listBuckets,n=this;return t().call(n,e)}async deleteBucket(e){var t=()=>super.deleteBucket,n=this;return t().call(n,e)}},fj=class extends lj{constructor(e,t,n,a){super(e,t,a),this.vectorBucketName=n}async createIndex(e){var t=()=>super.createIndex,n=this;return t().call(n,be(be({},e),{},{vectorBucketName:n.vectorBucketName}))}async listIndexes(e={}){var t=()=>super.listIndexes,n=this;return t().call(n,be(be({},e),{},{vectorBucketName:n.vectorBucketName}))}async getIndex(e){var t=()=>super.getIndex,n=this;return t().call(n,n.vectorBucketName,e)}async deleteIndex(e){var t=()=>super.deleteIndex,n=this;return t().call(n,n.vectorBucketName,e)}index(e){return new hj(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},hj=class extends cj{constructor(e,t,n,a,o){super(e,t,o),this.vectorBucketName=n,this.indexName=a}async putVectors(e){var t=()=>super.putVectors,n=this;return t().call(n,be(be({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async getVectors(e){var t=()=>super.getVectors,n=this;return t().call(n,be(be({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async listVectors(e={}){var t=()=>super.listVectors,n=this;return t().call(n,be(be({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async queryVectors(e){var t=()=>super.queryVectors,n=this;return t().call(n,be(be({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async deleteVectors(e){var t=()=>super.deleteVectors,n=this;return t().call(n,be(be({},e),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}},pj=class extends ij{constructor(e,t={},n,a){super(e,t,n,a)}from(e){return new sj(this.url,this.headers,e,this.fetch)}get vectors(){return new dj(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new oj(this.url+"/iceberg",this.headers,this.fetch)}};const lS="2.110.2",Yr=30*1e3,Ko=3,Ch=Ko*Yr,mj=2*Yr,gj="http://localhost:9999",yj="supabase.auth.token",vj={"X-Client-Info":`gotrue-js/${lS}`},gp="X-Supabase-Api-Version",cS={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},bj=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,_j=600*1e3;class hl extends Error{constructor(t,n,a){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=a}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function ce(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class wj extends hl{constructor(t,n,a){super(t,n,a),this.name="AuthApiError",this.status=n,this.code=a}}function Sj(e){return ce(e)&&e.name==="AuthApiError"}class ir extends hl{constructor(t,n){super(t),this.name="AuthUnknownError",this.originalError=n}}class xr extends hl{constructor(t,n,a,o){super(t,a,o),this.name=n,this.status=a}}class qt extends xr{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Kc(e){return ce(e)&&e.name==="AuthSessionMissingError"}class bi extends xr{constructor(){super("Auth session or user missing","AuthInvalidToken
23ResponseError",500,void 0)}}class Wc extends xr{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class Qc extends xr{constructor(t,n=null){super(t,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function xj(e){return ce(e)&&e.name==="AuthImplicitGrantRedirectError"}class lb extends xr{constructor(t,n=null){super(t,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class Tj extends xr{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 yp extends xr{constructor(t,n){super(t,"AuthRetryableFetchError",n,void 0)}}function cb(e){return ce(e)&&e.name==="AuthRetryableFetchError"}class ub extends xr{constructor(t="Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)"){super(t,"AuthRefreshDiscardedError",409,void 0)}}function Ej(e){return ce(e)&&e.name==="AuthRefreshDiscardedError"}class db extends xr{constructor(t,n,a){super(t,"AuthWeakPasswordError",n,"weak_password"),this.reasons=a}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class Eu extends xr{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const Ru="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),fb=` 	
24\r=`.split(""),Rj=(()=>{const e=new Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<fb.length;t+=1)e[fb[t].charCodeAt(0)]=-2;for(let t=0;t<Ru.length;t+=1)e[Ru[t].charCodeAt(0)]=t;return e})();function hb(e,t,n){if(e!==null)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;){const a=t.queue>>t.queuedBits-6&63;n(Ru[a]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const a=t.queue>>t.queuedBits-6&63;n(Ru[a]),t.queuedBits-=6}}function uS(e,t,n){const a=Rj[e];if(a>-1)for(t.queue=t.queue<<6|a,t.queuedBits+=6;t.queuedBits>=8;)n(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(a===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function pb(e){const t=[],n=u=>{t.push(String.fromCodePoint(u))},a={utf8seq:0,codepoint:0},o={queue:0,queuedBits:0},l=u=>{Cj(u,a,n)};for(let u=0;u<e.length;u+=1)uS(e.charCodeAt(u),o,l);return t.join("")}function Aj(e,t){if(e<=127){t(e);return}else if(e<=2047){t(192|e>>6),t(128|e&63);return}else if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|e&63);return}else if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|e&63);return}throw new Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}function kj(e,t){for(let n=0;n<e.length;n+=1){let a=e.charCodeAt(n);if(a>55295&&a<=56319){const o=(a-55296)*1024&65535;a=(e.charCodeAt(n+1)-56320&65535|o)+65536,n+=1}Aj(a,t)}}function Cj(e,t,n){if(t.utf8seq===0){if(e<=127){n(e);return}for(let a=1;a<6;a+=1)if((e>>7-a&1)===0){t.utf8seq=a;break}if(t.utf8seq===2)t.codepoint=e&31;else if(t.utf8seq===3)t.codepoint=e&15;else if(t.utf8seq===4)t.codepoint=e&7;else throw new Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw new Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|e&63,t.utf8seq-=1,t.utf8seq===0&&n(t.codepoint)}}function Ui(e){const t=[],n={queue:0,queuedBits:0},a=o=>{t.push(o)};for(let o=0;o<e.length;o+=1)uS(e.charCodeAt(o),n,a);return new Uint8Array(t)}function Oj(e){const t=[];return kj(e,n=>t.push(n)),new Uint8Array(t)}function Sa(e){const t=[],n={queue:0,queuedBits:0},a=o=>{t.push(o)};return e.forEach(o=>hb(o,n,a)),hb(null,n,a),t.join("")}function jj(e){return Math.round(Date.now()/1e3)+e}function Dj(){return Symbol("auth-callback")}const rn=()=>typeof window<"u"&&typeof document<"u",da={tested:!1,writable:!1},dS=()=>
24{if(!rn())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(da.tested)return da.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),da.tested=!0,da.writable=!0}catch{da.tested=!0,da.writable=!1}return da.writable};function Mj(e){const t={},n=new URL(e);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((o,l)=>{t[l]=o})}catch{}return n.searchParams.forEach((a,o)=>{t[o]=a}),t}const fS=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),Nj=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",ki=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},nr=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch{return null}},Et=async(e,t)=>{await e.removeItem(t)};class Vu{constructor(){this.promise=new Vu.promiseConstructor((t,n)=>{this.resolve=t,this.reject=n})}}Vu.promiseConstructor=Promise;function Xc(e){const t=e.split(".");if(t.length!==3)throw new Eu("Invalid JWT structure");for(let a=0;a<t.length;a++)if(!bj.test(t[a]))throw new Eu("JWT not in base64url format");return{header:JSON.parse(pb(t[0])),payload:JSON.parse(pb(t[1])),signature:Ui(t[2]),raw:{header:t[0],payload:t[1]}}}async function Lj(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function zj(e,t){return new Promise((a,o)=>{(async()=>{for(let l=0;l<1/0;l++)try{const u=await e(l);if(!t(l,null,u)){a(u);return}}catch(u){if(!t(l,u)){o(u);return}}})()})}function Pj(e){return("0"+e.toString(16)).substr(-2)}function Uj(){const t=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",a=n.length;let o="";for(let l=0;l<56;l++)o+=n.charAt(Math.floor(Math.random()*a));return o}return crypto.getRandomValues(t),Array.from(t,Pj).join("")}async function $j(e){const n=new TextEncoder().encode(e),a=await crypto.subtle.digest("SHA-256",n),o=new Uint8Array(a);return Array.from(o).map(l=>String.fromCharCode(l)).join("")}async function Bj(e){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."),e;const n=await $j(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function fa(e,t,n=!1){const a=Uj();let o=a;n&&(o+="/recovery"),await ki(e,`${t}-code-verifier`,o);const l=await Bj(a);return[l,a===l?"plain":"s256"]}const Ij=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Hj(e){const t=e.headers.get(gp);if(!t||!t.match(Ij))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function qj(e){if(!e)throw new Error("Missing exp claim");const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error("JWT has expired")}function Fj(e){switch(e){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 Gj=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Fr(e){if(!Gj.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function rr(e){if(!e.passkey)throw new Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function Oh(){const e={};return new Proxy(e,{get:(t,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const a=n.toString();if(a==="Symbol(Symbol.toPrimitive)"||a==="Symbol(Symbol.toStringTag)"||a==="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 "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(t,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function Vj(e,t){return new Proxy(e,{get:(n,a,o)=>
24{if(a==="__isInsecureUserWarningProxy")return!0;if(typeof a=="symbol"){const l=a.toString();if(l==="Symbol(Symbol.toPrimitive)"||l==="Symbol(Symbol.toStringTag)"||l==="Symbol(util.inspect.custom)"||l==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,a,o)}return!t.value&&typeof a=="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."),t.value=!0),Reflect.get(n,a,o)}})}function mb(e){return JSON.parse(JSON.stringify(e))}const ma=e=>{if(typeof e=="object"&&e!==null){const t=e;if(typeof t.msg=="string")return t.msg;if(typeof t.message=="string")return t.message;if(typeof t.error_description=="string")return t.error_description;if(typeof t.error=="string")return t.error}return JSON.stringify(e)},Yj=[500,501,502,503,504,520,521,522,523,524,525,526,527,528,529,530];async function gb(e){var t;if(!Nj(e))throw new yp(ma(e),0);if(Yj.includes(e.status))throw new yp(ma(e),e.status);let n;try{n=await e.json()}catch(l){throw new ir(ma(l),l)}let a;const o=Hj(e);if(o&&o.getTime()>=cS["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?a=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(a=n.error_code),a){if(a==="weak_password")throw new db(ma(n),e.status,((t=n.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(a==="session_not_found")throw new qt}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((l,u)=>l&&typeof u=="string",!0))throw new db(ma(n),e.status,n.weak_password.reasons);throw new wj(ma(n),e.status||500,a)}const Kj=(e,t,n,a)=>{const o={method:e,headers:t?.headers||{}};return e==="GET"?o:(o.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t?.headers),o.body=JSON.stringify(a),Object.assign(Object.assign({},o),n))};async function fe(e,t,n,a){var o;const l=Object.assign({},a?.headers);l[gp]||(l[gp]=cS["2024-01-01"].name),a?.jwt&&(l.Authorization=`Bearer ${a.jwt}`);const u=(o=a?.query)!==null&&o!==void 0?o:{};a?.redirectTo&&(u.redirect_to=a.redirectTo);const h=Object.keys(u).length?"?"+new URLSearchParams(u).toString():"",d=await Wj(e,t,n+h,{headers:l,noResolveJson:a?.noResolveJson},{},a?.body);return a?.xform?a?.xform(d):{data:Object.assign({},d),error:null}}async function Wj(e,t,n,a,o,l){const u=Kj(t,a,o,l);let h;try{h=await e(n,Object.assign({},u))}catch(d){throw console.error(d),new yp(ma(d),0)}if(h.ok||await gb(h),a?.noResolveJson)return h;try{return await h.json()}catch(d){await gb(d)}}function Qn(e){var t;let n=null;Jj(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=jj(e.expires_in)));const a=(t=e.user)!==null&&t!==void 0?t:typeof e?.id=="string"?e:null;return{data:{session:n,user:a},error:null}}function yb(e){const t=Qn(e);return!t.error&&e.weak_password&&typeof e.weak_password=="object"&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message=="string"&&e.weak_password.reasons.reduce((n,a)=>n&&typeof a=="string",!0)&&(t.data.weak_password=e.weak_password),t}function js(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function Qj(e){return{data:e,error:null}}function Xj(e){const{action_link:t,email_otp:n,hashed_token:a,redirect_to:o,verification_type:l}=e,u=qu(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),h={action_link:t,email_otp:n,hashed_token:a,redirect_to:o,verification_type:l},d=Object.assign({},u);return{data:{properties:h,user:d},error:null}}function vb(e){return e}function Jj(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}const jh=["global","local","others"];class Zj{constructor({url:t="",headers:n={},fetch:a,experimental:o}){this.url=t,this.headers=n,this.fetch=fS(a),this.experimental=o??{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}
24async signOut(t,n=jh[0]){if(jh.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${jh.join(", ")}`);try{return await fe(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(a){if(ce(a))return{data:null,error:a};throw a}}async inviteUserByEmail(t,n={}){try{return await fe(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:js})}catch(a){if(ce(a))return{data:{user:null},error:a};throw a}}async generateLink(t){try{const{options:n}=t,a=qu(t,["options"]),o=Object.assign(Object.assign({},a),n);return"newEmail"in a&&(o.new_email=a?.newEmail,delete o.newEmail),await fe(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:o,headers:this.headers,xform:Xj,redirectTo:n?.redirectTo})}catch(n){if(ce(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(t){try{return await fe(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:js})}catch(n){if(ce(n))return{data:{user:null},error:n};throw n}}async listUsers(t){var n,a,o,l,u,h,d;try{const m={nextPage:null,lastPage:0,total:0},v=await fe(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(a=(n=t?.page)===null||n===void 0?void 0:n.toString())!==null&&a!==void 0?a:"",per_page:(l=(o=t?.perPage)===null||o===void 0?void 0:o.toString())!==null&&l!==void 0?l:""},xform:vb});if(v.error)throw v.error;const p=await v.json(),b=(u=v.headers.get("x-total-count"))!==null&&u!==void 0?u:0,_=(d=(h=v.headers.get("link"))===null||h===void 0?void 0:h.split(","))!==null&&d!==void 0?d:[];return _.length>0&&(_.forEach(S=>{const R=parseInt(S.split(";")[0].split("=")[1].substring(0,1)),E=JSON.parse(S.split(";")[1].split("=")[1]);m[`${E}Page`]=R}),m.total=parseInt(b)),{data:Object.assign(Object.assign({},p),m),error:null}}catch(m){if(ce(m))return{data:{users:[]},error:m};throw m}}async getUserById(t){Fr(t);try{return await fe(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:js})}catch(n){if(ce(n))return{data:{user:null},error:n};throw n}}async updateUserById(t,n){Fr(t);try{return await fe(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:n,headers:this.headers,xform:js})}catch(a){if(ce(a))return{data:{user:null},error:a};throw a}}async deleteUser(t,n=!1){Fr(t);try{return await fe(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:n},xform:js})}catch(a){if(ce(a))return{data:{user:null},error:a};throw a}}async _listFactors(t){Fr(t.userId);try{const{data:n,error:a}=await fe(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:o=>({data:{factors:o},error:null})});return{data:n,error:a}}catch(n){if(ce(n))return{data:null,error:n};throw n}}async _deleteFactor(t){Fr(t.userId),Fr(t.id);try{return{data:await fe(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(n){if(ce(n))return{data:null,error:n};throw n}}async _listOAuthClients(t){var n,a,o,l,u,h,d;try{const m={nextPage:null,lastPage:0,total:0},v=await fe(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(a=(n=t?.page)===null||n===void 0?void 0:n.toString())!==null&&a!==void 0?a:"",per_page:(l=(o=t?.perPage)===null||o===void 0?void 0:o.toString())!==null&&l!==void 0?l:""},xform:vb});if(v.error)throw v.error;const p=await v.json(),b=(u=v.headers.get("x-total-count"))!==null&&u!==void 0?u:0,_=(d=(h=v.headers.get("link"))===null||h===void 0?void 0:h.split(","))!==null&&d!==void 0?d:[];return _.length>0&&(_.forEach(S=>{const R=parseInt(S.split(";")[0].split("=")[1].substring(0,1)),E=JSON.parse(S.split(";")[1].split("=")[1]);m[`${E}Page`]=R}),m.total=parseInt(b)),{data:Object.assign(Object.assign({},p),m),error:null}}catch(m){if(ce(m))return{data:{clients:[]},error:m};throw m}}async _createOAuthClient(t){try{return await fe(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ce(n))return{data:null,error:n};throw n}}async _getOAuthClient(t){try{return await fe(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ce(n))return{data:null,error:n};throw n}}async _updateOAuthClient(t,n){try{return await fe(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:a=>({data:a,error:null})})}catch(a){if(ce(a))return{data:null,error:a};throw a}}async _deleteOAuthClient(t){try{return await fe(this.fetch,"DELET
24E",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(ce(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(t){try{return await fe(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ce(n))return{data:null,error:n};throw n}}async _listCustomProviders(t){try{const n={};return t?.type&&(n.type=t.type),await fe(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:n,xform:a=>{var o;return{data:{providers:(o=a?.providers)!==null&&o!==void 0?o:[]},error:null}}})}catch(n){if(ce(n))return{data:{providers:[]},error:n};throw n}}async _createCustomProvider(t){try{return await fe(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ce(n))return{data:null,error:n};throw n}}async _getCustomProvider(t){try{return await fe(this.fetch,"GET",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ce(n))return{data:null,error:n};throw n}}async _updateCustomProvider(t,n){try{return await fe(this.fetch,"PUT",`${this.url}/admin/custom-providers/${t}`,{body:n,headers:this.headers,xform:a=>({data:a,error:null})})}catch(a){if(ce(a))return{data:null,error:a};throw a}}async _deleteCustomProvider(t){try{return await fe(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(ce(n))return{data:null,error:n};throw n}}async _adminListPasskeys(t){rr(this.experimental),Fr(t.userId);try{return await fe(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(ce(n))return{data:null,error:n};throw n}}async _adminDeletePasskey(t){rr(this.experimental),Fr(t.userId),Fr(t.passkeyId);try{return await fe(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(ce(n))return{data:null,error:n};throw n}}}function bb(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}globalThis&&dS()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug");class e2 extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}function t2(){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 hS(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function n2(e){return parseInt(e,16)}function r2(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,a=>a.toString(16).padStart(2,"0")).join("")}function s2(e){var t;const{chainId:n,domain:a,expirationTime:o,issuedAt:l=new Date,nonce:u,notBefore:h,requestId:d,resources:m,scheme:v,uri:p,version:b}=e;{if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!a)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(u&&u.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${u}`);if(!p)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(b!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${b}`);if(!((t=e.statement)===null||t===void 0)&&t.includes(`
25`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const _=hS(e.address),S=v?`${v}://${a}`:a,R=e.statement?`${e.statement}
26`:"",E=`${S} wants you to sign in with your Ethereum account:
27${_}
28
29${R}`;let x=`URI: ${p}
30Version: ${b}
31Chain ID: ${n}${u?`
32Nonce: ${u}`:""}
33Issued At: ${l.toISOString()}`;
33if(o&&(x+=`
34Expiration Time: ${o.toISOString()}`),h&&(x+=`
35Not Before: ${h.toISOString()}`),d&&(x+=`
36Request ID: ${d}`),m){let k=`
37Resources:`;for(const D of m){if(!D||typeof D!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${D}`);k+=`
38- ${D}`}x+=k}return`${E}
39${x}`}class jt extends Error{constructor({message:t,code:n,cause:a,name:o}){var l;super(t,{cause:a}),this.__isWebAuthnError=!0,this.name=(l=o??(a instanceof Error?a.name:void 0))!==null&&l!==void 0?l:"Unknown Error",this.code=n}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class Au extends jt{constructor(t,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:t}),this.name="WebAuthnUnknownError",this.originalError=n}}function a2({error:e,options:t}){var n,a,o;const{publicKey:l}=t;if(!l)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new jt({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((n=l.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new jt({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((a=l.authenticatorSelection)===null||a===void 0?void 0:a.userVerification)==="required")return new jt({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((o=l.authenticatorSelection)===null||o===void 0?void 0:o.userVerification)==="required")return new jt({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if(e.name==="InvalidStateError")return new jt({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new jt({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return l.pubKeyCredParams.filter(h=>h.type==="public-key").length===0?new jt({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new jt({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){const u=window.location.hostname;if(pS(u)){if(l.rp.id!==u)return new jt({message:`The RP ID "${l.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new jt({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(l.user.id.byteLength<1||l.user.id.byteLength>64)return new jt({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if(e.name==="UnknownError")return new jt({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new jt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function i2({error:e,options:t}){const{publicKey:n}=t;if(!n)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new jt({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new jt({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const a=window.location.hostname;if(pS(a)){if(n.rpId!==a)return new jt({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new jt({message:`${window.location.hostname}
39 is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new jt({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new jt({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class o2{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}}const vp=new o2;function _b(e){if(!e)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(e);const{challenge:t,user:n,excludeCredentials:a}=e,o=qu(e,["challenge","user","excludeCredentials"]),l=Ui(t).buffer,u=Object.assign(Object.assign({},n),{id:Ui(n.id).buffer}),h=Object.assign(Object.assign({},o),{challenge:l,user:u});if(a&&a.length>0){h.excludeCredentials=new Array(a.length);for(let d=0;d<a.length;d++){const m=a[d];h.excludeCredentials[d]=Object.assign(Object.assign({},m),{id:Ui(m.id).buffer,type:m.type||"public-key",transports:m.transports})}}return h}function wb(e){if(!e)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(e);const{challenge:t,allowCredentials:n}=e,a=qu(e,["challenge","allowCredentials"]),o=Ui(t).buffer,l=Object.assign(Object.assign({},a),{challenge:o});if(n&&n.length>0){l.allowCredentials=new Array(n.length);for(let u=0;u<n.length;u++){const h=n[u];l.allowCredentials[u]=Object.assign(Object.assign({},h),{id:Ui(h.id).buffer,type:h.type||"public-key",transports:h.transports})}}return l}function Sb(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e;return{id:e.id,rawId:e.id,response:{attestationObject:Sa(new Uint8Array(e.response.attestationObject)),clientDataJSON:Sa(new Uint8Array(e.response.clientDataJSON))},type:"public-key",clientExtensionResults:e.getClientExtensionResults(),authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function xb(e){var t;if("toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();const n=e,a=e.getClientExtensionResults(),o=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:Sa(new Uint8Array(o.authenticatorData)),clientDataJSON:Sa(new Uint8Array(o.clientDataJSON)),signature:Sa(new Uint8Array(o.signature)),userHandle:o.userHandle?Sa(new Uint8Array(o.userHandle)):void 0},type:"public-key",clientExtensionResults:a,authenticatorAttachment:(t=n.authenticatorAttachment)!==null&&t!==void 0?t:void 0}}function pS(e){return e==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function ku(){var e,t;return!!(rn()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((e=navigator?.credentials)===null||e===void 0?void 0:e.create)=="function"&&typeof((t=navigator?.credentials)===null||t===void 0?void 0:t.get)=="function")}async function mS(e){try{const t=await navigator.credentials.create(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Au("Browser returned unexpected credential type",t)}:{data:null,error:new Au("Empty credential response",t)}}catch(t){return{data:null,error:a2({error:t,options:e})}}}async function gS(e){try{const t=await navigator.credentials.get(e);return t?t instanceof PublicKeyCredential?{data:t,error:null}:{data:null,error:new Au("Browser returned unexpected credential type",t)}:{data:null,error:new Au("Empty credential response",t)}}
39catch(t){return{data:null,error:i2({error:t,options:e})}}}const l2={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},c2={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Cu(...e){const t=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),n=o=>o instanceof ArrayBuffer||ArrayBuffer.isView(o),a={};for(const o of e)if(o)for(const l in o){const u=o[l];if(u!==void 0)if(Array.isArray(u))a[l]=u;else if(n(u))a[l]=u;else if(t(u)){const h=a[l];t(h)?a[l]=Cu(h,u):a[l]=Cu(u)}else a[l]=u}return a}function u2(e,t){return Cu(l2,e,t||{})}function d2(e,t){return Cu(c2,e,t||{})}class f2{constructor(t){this.client=t,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(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:"webauthn"}))}async _challenge({factorId:t,webauthn:n,friendlyName:a,signal:o},l){var u;try{const{data:h,error:d}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!h)return{data:null,error:d};const m=o??vp.createNewAbortSignal();if(h.webauthn.type==="create"){const{user:v}=h.webauthn.credential_options.publicKey;if(!v.name){const p=a;if(p)v.name=`${v.id}:${p}`;else{const _=(await this.client.getUser()).data.user,S=((u=_?.user_metadata)===null||u===void 0?void 0:u.name)||_?.email||_?.id||"User";v.name=`${v.id}:${S}`}}
39v.displayName||(v.displayName=v.name)}switch(h.webauthn.type){case"create":{const v=u2(h.webauthn.credential_options.publicKey,l?.create),{data:p,error:b}=await mS({publicKey:v,signal:m});return p?{data:{factorId:t,challengeId:h.id,webauthn:{type:h.webauthn.type,credential_response:p}},error:null}:{data:null,error:b}}case"request":{const v=d2(h.webauthn.credential_options.publicKey,l?.request),{data:p,error:b}=await gS(Object.assign(Object.assign({},h.webauthn.credential_options),{publicKey:v,signal:m}));return p?{data:{factorId:t,challengeId:h.id,webauthn:{type:h.webauthn.type,credential_response:p}},error:null}:{data:null,error:b}}}}catch(h){return ce(h)?{data:null,error:h}:{data:null,error:new ir("Unexpected error in challenge",h)}}}async _verify({challengeId:t,factorId:n,webauthn:a}){return this.client.mfa.verify({factorId:n,challengeId:t,webauthn:a})}async _authenticate({factorId:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:a=typeof window<"u"?[window.location.origin]:void 0,signal:o}={}},l){if(!n)return{data:null,error:new hl("rpId is required for WebAuthn authentication")};try{if(!ku())return{data:null,error:new ir("Browser does not support WebAuthn",null)};const{data:u,error:h}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:a},signal:o},{request:l});if(!u)return{data:null,error:h};const{webauthn:d}=u;return this._verify({factorId:t,challengeId:u.challengeId,webauthn:{type:d.type,rpId:n,rpOrigins:a,credential_response:d.credential_response}})}catch(u){return ce(u)?{data:null,error:u}:{data:null,error:new ir("Unexpected error in authenticate",u)}}}async _register({friendlyName:t,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:a=typeof window<"u"?[window.location.origin]:void 0,signal:o}={}},l){if(!n)return{data:null,error:new hl("rpId is required for WebAuthn registration")};try{if(!ku())return{data:null,error:new ir("Browser does not support WebAuthn",null)};const{data:u,error:h}=await this._enroll({friendlyName:t});if(!u)return await this.client.mfa.listFactors().then(v=>{var p;return(p=v.data)===null||p===void 0?void 0:p.all.find(b=>b.factor_type==="webauthn"&&b.friendly_name===t&&b.status!=="unverified")}).then(v=>v?this.client.mfa.unenroll({factorId:v?.id}):void 0),{data:null,error:h};const{data:d,error:m}=await this._challenge({factorId:u.id,friendlyName:u.friendly_name,webauthn:{rpId:n,rpOrigins:a},signal:o},{create:l});return d?this._verify({factorId:u.id,challengeId:d.challengeId,webauthn:{rpId:n,rpOrigins:a,type:d.webauthn.type,credential_response:d.webauthn.credential_response}}):{data:null,error:m}}catch(u){return ce(u)?{data:null,error:u}:{data:null,error:new ir("Unexpected error in register",u)}}}}t2();const h2={url:gj,storageKey:yj,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:vj,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},_i={};class pl{get jwks(){var t,n;return(n=(t=_i[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(t){_i[this.storageKey]=Object.assign(Object.assign({},_i[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,n;return(n=(t=_i[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){_i[this.storageKey]=Object.assign(Object.assign({},_i[this.storageKey]),{cachedAt:t})}constructor(t){var n,a,o;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.lastRefreshFailure=null,this._sessionRemovalEpoch=0,this.initializePromise=null,this._pendingInitNotifications=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lock=null,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const l=Object.assign(Object.assign({},h2),t);if(this.storageKey=l.storageKey,this.instanceID=(n=pl.nextInstanceID[this.storageKey])!==null&&n!==void 0?n:0,pl.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!l.debug,typeof l.debug=="function"&&(this.logger=l.debug),this.instanceID>0&&rn()){const u=`${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(u),this.logDebugMessages&&console.trace(u)}if(this.persistSession=l.persistSession,this.autoRefreshToken=l.autoRefreshToken,this.experimental=(a=l.experimental)!==null&&a!==void 0?a:{},this.admin=new Zj({url:l.url,headers:l.headers,fetch:l.fetch,experimental:this.experimental}),this.url=l.url,this.headers=l.headers,this.fetch=fS(l.fetch),this.detectSessionInUrl=l.detectSessionInUrl,this.flowType=l.flowType,this.hasCustomAuthorizationHeader=l.hasCu
39stomAuthorizationHeader,this.throwOnError=l.throwOnError,this.lockAcquireTimeout=l.lockAcquireTimeout,l.lock!=null&&(this.lock=l.lock),this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new f2(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(l.storage?this.storage=l.storage:dS()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=bb(this.memoryStorage)),l.userStorage&&(this.userStorage=l.userStorage)):(this.memoryStorage={},this.storage=bb(this.memoryStorage)),rn()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(u){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",u)}(o=this.broadcastChannel)===null||o===void 0||o.addEventListener("message",async u=>{this._debug("received broadcast notification from other tab or client",u),(u.data.event==="TOKEN_REFRESHED"||u.data.event==="SIGNED_IN")&&(this.lastRefreshFailure=null);try{await this._notifyAllSubscribers(u.data.event,u.data.session,!1)}catch(h){this._debug("#broadcastChannel","error",h)}})}l.skipAutoInitialize||this.initialize().catch(u=>{this._debug("#initialize()","error",u)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(t){if(this.throwOnError&&t&&t.error)throw t.error;return t}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${lS}) ${new Date().toISOString()}`}_debug(...t){return this.logDebugMessages&&this.logger(this._logPrefix(),...t),this}async initialize(){var t;if(this.initializePromise)return await this.initializePromise;this._pendingInitNotifications=[],this.initializePromise=(async()=>this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()):await this._initialize())();
39const n=await this.initializePromise,a=(t=this._pendingInitNotifications)!==null&&t!==void 0?t:[];this._pendingInitNotifications=null;for(const o of a)await this._notifyAllSubscribers(o.event,o.session,o.broadcast);return n}async _initialize(){var t;try{let n={},a="none";if(rn()&&(n=Mj(window.location.href),this._isImplicitGrantCallback(n)?a="implicit":await this._isPKCECallback(n)&&(a="pkce")),rn()&&this.detectSessionInUrl&&a!=="none"){const{data:o,error:l}=await this._getSessionFromURL(n,a);if(l){if(this._debug("#_initialize()","error detecting session from URL",l),xj(l)){const d=(t=l.details)===null||t===void 0?void 0:t.code;if(d==="identity_already_exists"||d==="identity_not_found"||d==="single_identity_not_deletable")return{error:l}}return{error:l}}const{session:u,redirectType:h}=o;return this._debug("#_initialize()","detected session in URL",u,"redirect type",h),await this._saveSession(u),setTimeout(async()=>{h==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",u):await this._notifyAllSubscribers("SIGNED_IN",u)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return ce(n)?this._returnResult({error:n}):this._returnResult({error:new ir("Unexpected error during initialization",n)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var n,a,o;try{const l=await fe(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(a=(n=t?.options)===null||n===void 0?void 0:n.data)!==null&&a!==void 0?a:{},gotrue_meta_security:{captcha_token:(o=t?.options)===null||o===void 0?void 0:o.captchaToken}},xform:Qn}),{data:u,error:h}=l;if(h||!u)return this._returnResult({data:{user:null,session:null},error:h});const d=u.session,m=u.user;return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",d)),this._returnResult({data:{user:m,session:d},error:null})}catch(l){if(ce(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async signUp(t){var n,a,o;try{let l;if("email"in t){const{email:v,password:p,options:b}=t;let _=null,S=null;this.flowType==="pkce"&&([_,S]=await fa(this.storage,this.storageKey)),l=await fe(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:b?.emailRedirectTo,body:{email:v,password:p,data:(n=b?.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:b?.captchaToken},code_challenge:_,code_challenge_method:S},xform:Qn})}else if("phone"in t){const{phone:v,password:p,options:b}=t;l=await fe(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:v,password:p,data:(a=b?.data)!==null&&a!==void 0?a:{},channel:(o=b?.channel)!==null&&o!==void 0?o:"sms",gotrue_meta_security:{captcha_token:b?.captchaToken}},xform:Qn})}else throw new Wc("You must provide either an email or phone number and a password");const{data:u,error:h}=l;if(h||!u)return await Et(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:h});const d=u.session,m=u.user;return u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",d)),this._returnResult({data:{user:m,session:d},error:null})}catch(l){if(await Et(this.storage,`${this.storageKey}-code-verifier`),ce(l))return this._returnResult({data:{user:null,session:null},error:l});throw l}}async signInWithPassword(t){try{let n;if("email"in t){const{email:l,password:u,options:h}=t;n=await fe(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:l,password:u,gotrue_meta_security:{captcha_token:h?.captchaToken}},xform:yb})}else if("phone"in t){const{phone:l,password:u,options:h}=t;n=await fe(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:l,password:u,gotrue_meta_security:{captcha_token:h?.captchaToken}},xform:yb})}else throw new Wc("You must provide either an email or phone number and a password");const{data:a,error:o}=n;if(o)return this._returnResult({data:{user:null,session:null},error:o});if(!a||!a.session||!a.user){const l=new bi;return this._returnResult({data:{user:null,session:null},error:l})}return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",a.session)),this._returnResult({data:Object.assign({user:a.user,session:a.session},a.weak_password?{weakPassword:a.weak_password}:null),error:o})}catch(n){if(ce(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOAuth(t){var n,a,o,l;return await this._handleProviderSignIn(t.provider,{redirectTo:(n=t.options)===null||n===void 0?void 0:n.redirectTo,scopes:(a=t.options)===null||a===void 0?void 0:a.scopes,queryParams:(o=t.options)===null||o===void 0?void 0:o.queryParams,skipBrowserRedirect:(l=t.options)===null||l===void 0?void 0:l.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this.lock!=null?this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(t)):this._exchangeCodeForSession(t)}async signInWithWeb3(t){const{chain:n}=t;switch(n){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(t){var n,a,o,l,u,h,d,m,v,p,b;let _,S;if("message"in t)_=t.message,S=t.signature;else{const{chain:R,wallet:E,statement:x,options:k}=t;let D;if(rn())if(typeof E=="object")D=E;else{const W=window;if("ethereum"in W&&typeof W.ethereum=="object"&&"request"in W.ethereum&&typeof W.ethereum.request=="function")D=W.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 E!="object"||!k?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");D=E}const j=new URL((n=k?.url)!==null&&n!==void 0?n:window.location.href),H=await D.request({method:"eth_requestAccounts"}).then(W=>W).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!H||H.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const U=hS(H[0]);let B=(a=k?.signInWithEthereum)===null||a===void 0?void 0:a.chainId;if(!B){const W=await D.request({method:"eth_chainId"});B=n2(W)}const V={domain:j.host,address:U,statement:x,uri:j.href,version:"1",chainId:B,nonce:(o=k?.signInWithEthereum)===null||o===void 0?void 0:o.nonce,issuedAt:(u=(l=k?.signInWithEthereum)===null||l===void 0?void 0:l.issuedAt)!==null&&u!==void 0?u:new Date,expirationTime:(h=k?.signInWithEthereum)===null||h===void 0?void 0:h.expirationTime,notBefore:(d=k?.signInWithEthereum)===null||d===void 0?void 0:d.notBefore,requestId:(m=k?.signInWithEthereum)===null||m===void 0?void 0:m.requestId,resources:(v=k?.signInWithEthereum)===null||v===void 0?void 0:v.resources};_=s2(V),S=await D.request({method:"personal_sign",params:[r2(_),U]})}try{const{data:R,error:E}=await fe(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:_,signature:S},!((p=t.options)===null||p===void 0)&&p.captchaToken?{gotrue_meta_security:{captcha_token:(b=t.options)===null||b===void 0?void 0:b.captchaToken}}:null),xform:Qn});if(E)throw E;if(!R||!R.session||!R.user){const x=new bi;return this._returnResult({data:{user:null,session:null},error:x})}return R.session&&(await this._saveSession(R.session),await this._notifyAllSubscribers("SIGNED_IN",R.session)),this._returnResult({data:Object.assign({},R),error:E})}catch(R){if(ce(R))return this._returnResult({data:{user:null,session:null},error:R});throw R}}async signInWithSolana(t){var n,a,o,l,u,h,d,m,v,p,b,_;let S,R;if("message"in t)S=t.message,R=t.signature;else{const{chain:E,wallet:x,statement:k,options:D}=t;let j;if(rn())if(typeof x=="object")j=x;else{const U=window;if("solana"in U&&typeof U.solana=="object"&&("signIn"in U.solana&&typeof U.solana.signIn=="function"||"signMessage"in U.solana&&typeof U.solana.signMessage=="function"))j=U.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 x!="object"||!D?.url)throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");j=x}const H=new URL((n=D?.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in j&&j.signIn){const U=await j.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},D?.signInWithSolana),{version:"1",domain:H.host,uri:H.href}),k?{statement:k}:null));let B;if(Array.isArray(U)&&U[0]&&typeof U[0]=="object")B=U[0];else if(U&&typeof U=="object"&&"signedMessage"in U&&"signature"in U)B=U;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in B&&"signature"in B&&(typeof B.signedMessage=="string"||B.signedMessage instanceof Uint8Array)&&B.signature instanceof Uint8Array)S=typeof B.signedMessage=="string"?B.signedMessage:new TextDecoder().decode(B.signedMessage),R=B.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in j)||typeof j.signMessage!="function"||!("publicKey"in j)||typeof j!="object"||!j.publicKey||!("toBase58"in j.publicKey)||typeof j.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");S=[`${H.host} wants you to sign in with your Solana account:`,j.publicKey.toBase58(),...k?["",k,""]:[""],"Version: 1",`URI: ${H.href}`,`Issued At: ${(o=(a=D?.signInWithSolana)===null||a===void 0?void 0:a.issuedAt)!==null&&o!==void 0?o:new Date().toISOString()}`,...!((l=D?.signInWithSolana)===null||l===void 0)&&l.notBefore?[`Not Before: ${D.signInWithSolana.notBefore}`]:[],...!((u=D?.signInWithSolana)===null||u===void 0)&&u.expirationTime?[`Expiration Time: ${D.signInWithSolana.expirationTime}
39`]:[],...!((h=D?.signInWithSolana)===null||h===void 0)&&h.chainId?[`Chain ID: ${D.signInWithSolana.chainId}`]:[],...!((d=D?.signInWithSolana)===null||d===void 0)&&d.nonce?[`Nonce: ${D.signInWithSolana.nonce}`]:[],...!((m=D?.signInWithSolana)===null||m===void 0)&&m.requestId?[`Request ID: ${D.signInWithSolana.requestId}`]:[],...!((p=(v=D?.signInWithSolana)===null||v===void 0?void 0:v.resources)===null||p===void 0)&&p.length?["Resources",...D.signInWithSolana.resources.map(B=>`- ${B}`)]:[]].join(`
40`);const U=await j.signMessage(new TextEncoder().encode(S),"utf8");if(!U||!(U instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");R=U}}try{const{data:E,error:x}=await fe(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:S,signature:Sa(R)},!((b=t.options)===null||b===void 0)&&b.captchaToken?{gotrue_meta_security:{captcha_token:(_=t.options)===null||_===void 0?void 0:_.captchaToken}}:null),xform:Qn});if(x)throw x;if(!E||!E.session||!E.user){const k=new bi;return this._returnResult({data:{user:null,session:null},error:k})}return E.session&&(await this._saveSession(E.session),await this._notifyAllSubscribers("SIGNED_IN",E.session)),this._returnResult({data:Object.assign({},E),error:x})}catch(E){if(ce(E))return this._returnResult({data:{user:null,session:null},error:E});throw E}}async _exchangeCodeForSession(t){const n=await nr(this.storage,`${this.storageKey}-code-verifier`),[a,o]=(n??"").split("/");try{if(!a&&this.flowType==="pkce")throw new Tj;const{data:l,error:u}=await fe(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:a},xform:Qn});if(await Et(this.storage,`${this.storageKey}-code-verifier`),u)throw u;if(!l||!l.session||!l.user){const h=new bi;return this._returnResult({data:{user:null,session:null,redirectType:null},error:h})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers(o==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l.session)),this._returnResult({data:Object.assign(Object.assign({},l),{redirectType:o??null}),error:u})}catch(l){if(await Et(this.storage,`${this.storageKey}-code-verifier`),ce(l))return this._returnResult({data:{user:null,session:null,redirectType:null},error:l});throw l}}async signInWithIdToken(t){try{const{options:n,provider:a,token:o,access_token:l,nonce:u}=t,h=await fe(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:a,id_token:o,access_token:l,nonce:u,gotrue_meta_security:{captcha_token:n?.captchaToken}},xform:Qn}),{data:d,error:m}=h;if(m)return this._returnResult({data:{user:null,session:null},error:m});if(!d||!d.session||!d.user){const v=new bi;return this._returnResult({data:{user:null,session:null},error:v})}return d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("SIGNED_IN",d.session)),this._returnResult({data:d,error:m})}catch(n){if(ce(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOtp(t){var n,a,o,l,u;try{if("email"in t){const{email:h,options:d}=t;let m=null,v=null;this.flowType==="pkce"&&([m,v]=await fa(this.storage,this.storageKey));const{error:p}=await fe(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:h,data:(n=d?.data)!==null&&n!==void 0?n:{},create_user:(a=d?.shouldCreateUser)!==null&&a!==void 0?a:!0,gotrue_meta_security:{captcha_token:d?.captchaToken},code_challenge:m,code_challenge_method:v},redirectTo:d?.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:p})}if("phone"in t){const{phone:h,options:d}=t,{data:m,error:v}=await fe(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:h,data:(o=d?.data)!==null&&o!==void 0?o:{},create_user:(l=d?.shouldCreateUser)!==null&&l!==void 0?l:!0,gotrue_meta_security:{captcha_token:d?.captchaToken},channel:(u=d?.channel)!==null&&u!==void 0?u:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:m?.message_id},error:v})}throw new Wc("You must provide either an email or phone number.")}catch(h){if(await Et(this.storage,`${this.storageKey}-code-verifier`),ce(h))return this._returnResult({data:{user:null,session:null},error:h});throw h}}async verifyOtp(t){var n,a;try{let o,l;"options"in t&&(o=(n=t.options)===null||n===void 0?void 0:n.redirectTo,l=(a=t.o
40ptions)===null||a===void 0?void 0:a.captchaToken);const{data:u,error:h}=await fe(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:l}}),redirectTo:o,xform:Qn});if(h)throw h;if(!u)throw new Error("An error occurred on token verification.");const d=u.session,m=u.user;return d?.access_token&&(await this._saveSession(d),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",d)),this._returnResult({data:{user:m,session:d},error:null})}catch(o){if(ce(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async signInWithSSO(t){var n,a,o,l,u;try{let h=null,d=null;this.flowType==="pkce"&&([h,d]=await fa(this.storage,this.storageKey));const m=await fe(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(a=(n=t.options)===null||n===void 0?void 0:n.redirectTo)!==null&&a!==void 0?a:void 0}),!((o=t?.options)===null||o===void 0)&&o.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:h,code_challenge_method:d}),headers:this.headers,xform:Qj});return!((l=m.data)===null||l===void 0)&&l.url&&rn()&&!(!((u=t.options)===null||u===void 0)&&u.skipBrowserRedirect)&&window.location.assign(m.data.url),this._returnResult(m)}catch(h){if(await Et(this.storage,`${this.storageKey}-code-verifier`),ce(h))return this._returnResult({data:null,error:h});throw h}}async reauthenticate(){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate()):await this._reauthenticate()}async _reauthenticate(){try{return await this._useSession(async t=>{const{data:{session:n},error:a}=t;if(a)throw a;if(!n)throw new qt;const{error:o}=await fe(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return this._returnResult({data:{user:null,session:null},error:o})})}catch(t){if(ce(t))return this._returnResult({data:{user:null,session:null},error:t});throw t}}async resend(t){try{const n=`${this.url}/resend`;if("email"in t){const{email:a,type:o,options:l}=t;let u=null,h=null;this.flowType==="pkce"&&([u,h]=await fa(this.storage,this.storageKey));const{error:d}=await fe(this.fetch,"POST",n,{headers:this.headers,body:{email:a,type:o,gotrue_meta_security:{captcha_token:l?.captchaToken},code_challenge:u,code_challenge_method:h},redirectTo:l?.emailRedirectTo});return d&&await Et(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:d})}else if("phone"in t){const{phone:a,type:o,options:l}=t,{data:u,error:h}=await fe(this.fetch,"POST",n,{headers:this.headers,body:{phone:a,type:o,gotrue_meta_security:{captcha_token:l?.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:u?.message_id},error:h})}throw new Wc("You must provide either an email or phone number and a type")}catch(n){if(await Et(this.storage,`${this.storageKey}-code-verifier`),ce(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async getSession(){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async t=>t)):await this._useSession(async t=>t)}async _acquireLock(t,n){this._debug("#_acquireLock","begin",t);try{if(this.lockAcquired){const a=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),o=(async()=>(await a,await n()))();return this.pendingInLock.push((async()=>{try{await o}catch{}})()),o}return await this.lock(`lock:${this.storageKey}`,t,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const a=n();for(this.pendingInLock.push((async()=>{try{await a}catch{}})()),await a;this.pendingInLock.length;){const o=[...this.pendingInLock];await Promise.all(o),this.pendingInLock.splice(0,o.length)}return await a}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(t){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await t(n)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lock!=null&&!this.lockAcquired&&this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let t=null;const n=await nr(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?t=n:(this._debug("#getSession()","session from storage is not val
40id"),await this._removeSession())),!t)return{data:{session:null},error:null};const a=t.expires_at?t.expires_at*1e3-Date.now()<Ch:!1;if(this._debug("#__loadSession()",`session has${a?"":" not"} expired`,"expires_at",t.expires_at),!a){if(this.userStorage){const u=await nr(this.userStorage,this.storageKey+"-user");u?.user?t.user=u.user:t.user=Oh()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){const u={value:this.suppressGetSessionWarning};t.user=Vj(t.user,u),u.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}const{data:o,error:l}=await this._callRefreshToken(t.refresh_token);if(l){if(!!(t.expires_at&&t.expires_at*1e3>Date.now())){const h=await nr(this.storage,this.storageKey);if(h&&h.refresh_token===t.refresh_token)return this._returnResult({data:{session:t},error:null})}return this._returnResult({data:{session:null},error:l})}return this._returnResult({data:{session:o},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(t){if(t)return await this._getUser(t);await this.initializePromise;let n;return this.lock!=null?n=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser()):n=await this._getUser(),n.data.user&&(this.suppressGetSessionWarning=!0),n}async _getUser(t){try{return t?await fe(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:js}):await this._useSession(async n=>{var a,o,l;const{data:u,error:h}=n;if(h)throw h;return!(!((a=u.session)===null||a===void 0)&&a.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new qt}:await fe(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(l=(o=u.session)===null||o===void 0?void 0:o.access_token)!==null&&l!==void 0?l:void 0,xform:js})})}catch(n){if(ce(n))return Kc(n)&&(await this._removeSession(),await Et(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:n});throw n}}async updateUser(t,n={}){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(t,n)):await this._updateUser(t,n)}async _updateUser(t,n={}){try{return await this._useSession(async a=>{const{data:o,error:l}=a;if(l)throw l;if(!o.session)throw new qt;const u=o.session;let h=null,d=null;this.flowType==="pkce"&&t.email!=null&&([h,d]=await fa(this.storage,this.storageKey));const{data:m,error:v}=await fe(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n?.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:h,code_challenge_method:d}),jwt:u.access_token,xform:js});if(v)throw v;return u.user=m.user,await this._saveSession(u),await this._notifyAllSubscribers("USER_UPDATED",u),this._returnResult({data:{user:u.user},error:null})})}catch(a){if(await Et(this.storage,`${this.storageKey}-code-verifier`),ce(a))return this._returnResult({data:{user:null},error:a});throw a}}async setSession(t){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(t)):await this._setSession(t)}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new qt;const n=Date.now()/1e3;let a=n,o=!0,l=null;const{payload:u}=Xc(t.access_token);if(u.exp&&(a=u.exp,o=a<=n),o){const{data:h,error:d}=await this._callRefreshToken(t.refresh_token);if(d)return this._returnResult({data:{user:null,session:null},error:d});if(!h)return{data:{user:null,session:null},error:null};l=h}else{const{data:h,error:d}=await this._getUser(t.access_token);if(d)return this._returnResult({data:{user:null,session:null},error:d});l={access_token:t.access_token,refresh_token:t.refresh_token,user:h.user,token_type:"bearer",expires_in:a-n,expires_at:a},await this._saveSession(l),await this._notifyAllSubscribers("SIGNED_IN",l)}return this._returnResult({data:{user:l.user,session:l},error:null})}catch(n){if(ce(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}}async refreshSession(t){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(t)):await this._refreshSession(t)}async _refreshSession(t){try{return await this._useSession(async n=>{var a;if(!t){const{data:u,error:h}=n;if(h)throw h;t=(a=u.session)!==null&&a!==void 0?a:void 0}if(!t?.refresh_token)throw new qt;const{data:o,error:l}=await this._callRefreshToken(t.refresh_token);return l?this._returnResult({data:{user:null,session:null},error:l}):o?this._returnResult({data:{user:o.user,session:o},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(n){if(ce(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async _getSessionFromURL(t,n){var a;try{if(!rn())throw new Qc("No browser detected.");
40if(t.error||t.error_description||t.error_code)throw new Qc(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new lb("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Qc("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new lb("No code detected.");const{data:D,error:j}=await this._exchangeCodeForSession(t.code);if(j)throw j;const H=new URL(window.location.href);return H.searchParams.delete("code"),window.history.replaceState(window.history.state,"",H.toString()),{data:{session:D.session,redirectType:(a=D.redirectType)!==null&&a!==void 0?a:null},error:null}}const{provider_token:o,provider_refresh_token:l,access_token:u,refresh_token:h,expires_in:d,expires_at:m,token_type:v}=t;if(!u||!d||!h||!v)throw new Qc("No session defined in URL");const p=Math.round(Date.now()/1e3),b=parseInt(d);let _=p+b;m&&(_=parseInt(m));const S=_-p;S*1e3<=Yr&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${S}s, should have been closer to ${b}s`);const R=_-b;p-R>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",R,_,p):p-R<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",R,_,p);const{data:E,error:x}=await this._getUser(u);if(x)throw x;const k={provider_token:o,provider_refresh_token:l,access_token:u,expires_in:b,expires_at:_,refresh_token:h,token_type:v,user:E.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:k,redirectType:t.type},error:null})}catch(o){if(ce(o))return this._returnResult({data:{session:null,redirectType:null},error:o});throw o}}_isImplicitGrantCallback(t){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),t):!!(t.access_token||t.error||t.error_description||t.error_code)}async _isPKCECallback(t){const n=await nr(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&n)}async signOut(t={scope:"global"}){return await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(t)):await this._signOut(t)}async _signOut({scope:t}={scope:"global"}){return await this._useSession(async n=>{var a;const o=async()=>{await this._removeSession(),await Et(this.storage,`${this.storageKey}-code-verifier`)},{data:l,error:u}=n;if(u&&!Kc(u))return this._returnResult({error:u});const h=(a=l.session)===null||a===void 0?void 0:a.access_token;if(h){const{error:d}=await this.admin.signOut(h,t);if(d&&!(Sj(d)&&(d.status===404||d.status===401||d.status===403)||Kc(d)))return t!=="others"&&await o(),this._returnResult({error:d})}return t!=="others"&&await o(),this._returnResult({error:null})})}onAuthStateChange(t){const n=Dj(),a={id:n,callback:t,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,a),(async()=>(await this.initializePromise,this.lock!=null?await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(n)}):await this._emitInitialSession(n)))(),{data:{subscription:a}}}async _emitInitialSession(t){return await this._useSession(async n=>{var a,o;try{const{data:{session:l},error:u}=n;if(u)throw u;await((a=this.stateChangeEmitters.get(t))===null||a===void 0?void 0:a.callback("INITIAL_SESSION",l)),this._debug("INITIAL_SESSION","callback id",t,"session",l)}catch(l){await((o=this.stateChangeEmitters.get(t))===null||o===void 0?void 0:o.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",l),Kc(l)?console.warn(l):console.error(l)}})}async resetPasswordForEmail(t,n={}){let a=null,o=null;this.flowType==="pkce"&&([a,o]=await fa(this.storage,this.storageKey,!0));try{return await fe(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:a,code_challenge_method:o,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(l){if(await Et(this.storage,`${this.storageKey}-code-verifier`),ce(l))return this._returnResult({data:null,error:l});throw l}}async getUserIdentities(){var t;try{const{data:n,error:a}=await this.getUser();if(a)throw a;return this._returnResult({data:{identities:(t=n.user.identities)!==null&&t!==void 0?t:[]},error:null})}catch(n){if(ce(n))return this._returnResult({data:null,error:n});throw n}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var n;try{const{data:a,error:o}=await this._useSession(async l=>{var u,h,d,m,v;const{data:p,error:b}=l;if(b)throw b;const _=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(u=t.options)===null||u===void 0?void 0:u.redirectTo,scopes:(h=t.options)===null||h===void 0?void 0:h.scopes,queryParams:(d=t.options)===null||d===void 0?void 0:d.queryParams,skipBrowserRedirect:!0});return await fe(this.fetch,"GET",_,{headers:this.headers,jwt:(v=(m=p.session)===null||m===void 0?void 0:m.access_token)!==null&&v!==void 0?v:void 0})});if(o)throw o;return rn()&&!(!((n=t.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(a?.url),this._returnResult({data:{provider:t.provider,url:a?.url},error:null})}catch(a){if(ce(a))return this._returnResult({data:{provider:t.provider,url:null},error:a});throw a}}async linkIdentityIdToken(t){return await this._useSession(async n=>{var a;try{const{error:o,data:{session:l}}=n;if(o)throw o;const{options:u,provider:h,token:d,access_token:m,nonce:v}=t,p=await fe(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(a=l?.access_token)!==null&&a!==void 0?a:void 0,body:{provider:h,id_token:d,access_token:m,nonce:v,link_identity:!0,gotrue_meta_security:{captcha_token:u?.captchaToken}},xform:Qn}),{data:b,error:_}=p;return _?this._returnResult({data:{user:null,session:null},error:_}
40):!b||!b.session||!b.user?this._returnResult({data:{user:null,session:null},error:new bi}):(b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("USER_UPDATED",b.session)),this._returnResult({data:b,error:_}))}catch(o){if(await Et(this.storage,`${this.storageKey}-code-verifier`),ce(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}})}async unlinkIdentity(t){try{return await this._useSession(async n=>{var a,o;const{data:l,error:u}=n;if(u)throw u;return await fe(this.fetch,"DELETE",`${this.url}/user/identities/${t.identity_id}`,{headers:this.headers,jwt:(o=(a=l.session)===null||a===void 0?void 0:a.access_token)!==null&&o!==void 0?o:void 0})})}catch(n){if(ce(n))return this._returnResult({data:null,error:n});throw n}}async _refreshAccessToken(t){const n="#_refreshAccessToken()";this._debug(n,"begin");try{const a=Date.now();return await zj(async o=>(o>0&&await Lj(200*Math.pow(2,o-1)),this._debug(n,"refreshing attempt",o),await fe(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:Qn})),(o,l)=>{const u=200*Math.pow(2,o);return l&&cb(l)&&Date.now()+u-a<Yr})}catch(a){if(this._debug(n,"error",a),ce(a))return this._returnResult({data:{session:null,user:null},error:a});throw a}finally{this._debug(n,"end")}}_isValidSession(t){return typeof t=="object"&&t!==null&&"access_token"in t&&"refresh_token"in t&&"expires_at"in t}async _handleProviderSignIn(t,n){const a=await this._getUrlForProvider(`${this.url}/authorize`,t,{redirectTo:n.redirectTo,scopes:n.scopes,queryParams:n.queryParams});return this._debug("#_handleProviderSignIn()","provider",t,"options",n,"url",a),rn()&&!n.skipBrowserRedirect&&window.location.assign(a),{data:{provider:t,url:a},error:null}}async _recoverAndRefresh(){var t,n;const a="#_recoverAndRefresh()";this._debug(a,"begin");try{const o=await nr(this.storage,this.storageKey);if(o&&this.userStorage){let u=await nr(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!u&&(u={user:o.user},await ki(this.userStorage,this.storageKey+"-user",u)),o.user=(t=u?.user)!==null&&t!==void 0?t:Oh()}else if(o&&!o.user&&!o.user){const u=await nr(this.storage,this.storageKey+"-user");u&&u?.user?(o.user=u.user,await Et(this.storage,this.storageKey+"-user"),await ki(this.storage,this.storageKey,o)):o.user=Oh()}if(this._debug(a,"session from storage",o),!this._isValidSession(o)){this._debug(a,"session is not valid"),o!==null&&await this._removeSession();return}const l=((n=o.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<Ch;if(this._debug(a,`session has${l?"":" not"} expired with margin of ${Ch}s`),l){if(this.autoRefreshToken&&o.refresh_token){const{error:u}=await this._callRefreshToken(o.refresh_token);u&&(Ej(u)?this._debug(a,"refresh discarded by commit guard",u):this._debug(a,"refresh failed",u))}}else if(o.user&&o.user.__isUserNotAvailableProxy===!0)try{const{data:u,error:h}=await this._getUser(o.access_token);!h&&u?.user?(o.user=u.user,await this._saveSession(o),await this._notifyAllSubscribers("SIGNED_IN",o)):this._debug(a,"could not get user data, skipping SIGNED_IN notification")}catch(u){console.error("Error getting user data:",u),this._debug(a,"error getting user data, skipping SIGNED_IN notification",u)}else await this._notifyAllSubscribers("SIGNED_IN",o)}catch(o){this._debug(a,"error",o),console.error(o);return}finally{this._debug(a,"end")}}async _callRefreshToken(t){var n,a;if(!t)throw new qt;if(this.refreshingDeferred)return this.refreshingDeferred.promise;if(this.lastRefreshFailure&&this.lastRefreshFailure.refreshToken===t&&Date.now()<this.lastRefreshFailure.expiresAt)return this._debug("#_callRefreshToken()","returning cached failure (cooldown active)"),this.lastRefreshFailure.result;const o="#_callRefreshToken()";this._debug(o,"begin");try{this.refreshingDeferred=new Vu;const l=await nr(this.storage,this.storageKey),{data:u,error:h}=await this._refreshAccessToken(t);if(h)throw h;if(!u.session)throw new qt;const d=await nr(this.storage,this.storageKey);if(l!==null&&(d===null||d.refresh_token!==l.refresh_token)){this._debug(o,"commit guard: storage changed since refresh started, discarding rotated tokens",{startedWith:"present",nowHolds:d?"replaced":"cleared"});const b={data:null,error:new ub};return this.refreshingDeferred.resolve(b),b}const v=this._sessionRemovalEpoch;if(await this._saveSession(u.session),this._sessionRemovalEpoch!==v){this._debug(o,"commit guard (post-save): _removeSession ran during _saveSession, und
40oing write"),await Et(this.storage,this.storageKey),this.userStorage&&await Et(this.userStorage,this.storageKey+"-user");const b={data:null,error:new ub};return this.refreshingDeferred.resolve(b),b}await this._notifyAllSubscribers("TOKEN_REFRESHED",u.session);const p={data:u.session,error:null};return this.lastRefreshFailure=null,this.refreshingDeferred.resolve(p),p}catch(l){if(this._debug(o,"error",l),ce(l)){const u={data:null,error:l};if(!cb(l)){const h=await nr(this.storage,this.storageKey);!!(h?.expires_at&&h.expires_at*1e3>Date.now())?this._debug(o,"proactive refresh failed, access token still valid — preserving session"):await this._removeSession()}return this.lastRefreshFailure={refreshToken:t,result:u,expiresAt:Date.now()+mj},(n=this.refreshingDeferred)===null||n===void 0||n.resolve(u),u}throw(a=this.refreshingDeferred)===null||a===void 0||a.reject(l),l}finally{this.refreshingDeferred=null,this._debug(o,"end")}}async _notifyAllSubscribers(t,n,a=!0){if(this._pendingInitNotifications!==null&&a){this._pendingInitNotifications.push({event:t,session:n,broadcast:a});return}const o=`#_notifyAllSubscribers(${t})`;this._debug(o,"begin",n,`broadcast = ${a}`);try{this.broadcastChannel&&a&&this.broadcastChannel.postMessage({event:t,session:n});const l=[],u=Array.from(this.stateChangeEmitters.values()).map(async h=>{try{await h.callback(t,n)}catch(d){l.push(d)}});if(await Promise.all(u),l.length>0){for(let h=0;h<l.length;h+=1)console.error(l[h]);throw l[0]}}finally{this._debug(o,"end")}}async _saveSession(t){this._debug("#_saveSession()",t),this.suppressGetSessionWarning=!0,await Et(this.storage,`${this.storageKey}-code-verifier`);const n=Object.assign({},t),a=n.user&&n.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!a&&n.user&&await ki(this.userStorage,this.storageKey+"-user",{user:n.user});const o=Object.assign({},n);delete o.user;const l=mb(o);await ki(this.storage,this.storageKey,l)}else{const o=mb(n);await ki(this.storage,this.storageKey,o)}}async _removeSession(){this._sessionRemovalEpoch+=1,this._debug("#_removeSession()"),this.lastRefreshFailure=null,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 t=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{t&&rn()&&window?.removeEventListener&&window.removeEventListener("visibilitychange",t)}catch(n){console.error("removing visibilitychange callback failed",n)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const t=setInterval(()=>this._autoRefreshTokenTick(),Yr);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t);const n=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=n,n&&typeof n=="object"&&typeof n.unref=="function"?n.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(n)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t);const n=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,n&&clearTimeout(n)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async dispose(){var t;this._removeVisibilityChangedCallback(),await this._stopAutoRefresh(),(t=this.broadcastChannel)===null||t===void 0||t.close(),this.broadcastChannel=null,this.stateChangeEmitters.clear()}async _autoRefreshTokenTick(){if(this._debug("#_autoRefreshTokenTick()","begin"),this.lock!=null){try{await this._acquireLock(0,async()=>{try{const t=Date.now();try{return await this._useSession(async n=>{const{data:{session:a}}=n;if(!a||!a.refresh_token||!a.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const o=Math.floor((a.expires_at*1e3-t)/Yr);this._debug("#_autoRefreshTokenTick()",`access token expires in ${o} ticks, a tick lasts ${Yr}ms, refresh threshold is ${Ko} ticks`),o<=Ko&&await this._callRefreshToken(a.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(t){if(t instanceof e2)this._debug("auto refresh token tick lock not available");else throw t}return}if(this.refreshingDeferred!==null){this._debug("#_autoRefreshTokenTick()","refresh already in flight, skipping");return}try{const t=Date.now();try{await this._useSession(async n=>{const{data:{session:a}}=n;if(!a||!a.refresh_token||!a.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const o=Math.floor((a.expires_at*1e3-t)/Yr);this._debug("#_autoRefreshTokenTick()",`access token expires in ${o} ticks, a tick lasts ${Yr}ms, refresh threshold is ${Ko} ticks`),o<=Ko&&await this._callRefreshToken(a.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!rn()||
40!window?.addEventListener)return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(t){this._debug("#visibilityChangedCallback","error",t)}},window?.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const n=`#_onVisibilityChanged(${t})`;if(this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"){if(this.autoRefreshToken&&this._startAutoRefresh(),!t)if(await this.initializePromise,this.lock!=null)await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()});else{if(document.visibilityState!=="visible"){this._debug(n,"visibilityState is no longer visible, skipping recovery");return}await this._recoverAndRefresh()}}else document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(t,n,a){const o=[`provider=${encodeURIComponent(n)}`];if(a?.redirectTo&&o.push(`redirect_to=${encodeURIComponent(a.redirectTo)}`),a?.scopes&&o.push(`scopes=${encodeURIComponent(a.scopes)}`),this.flowType==="pkce"){const[l,u]=await fa(this.storage,this.storageKey),h=new URLSearchParams({code_challenge:`${encodeURIComponent(l)}`,code_challenge_method:`${encodeURIComponent(u)}`});o.push(h.toString())}if(a?.queryParams){const l=new URLSearchParams(a.queryParams);o.push(l.toString())}return a?.skipBrowserRedirect&&o.push(`skip_http_redirect=${a.skipBrowserRedirect}`),`${t}?${o.join("&")}`}async _unenroll(t){try{return await this._useSession(async n=>{var a;const{data:o,error:l}=n;return l?this._returnResult({data:null,error:l}):await fe(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(a=o?.session)===null||a===void 0?void 0:a.access_token})})}catch(n){if(ce(n))return this._returnResult({data:null,error:n});throw n}}async _enroll(t){try{return await this._useSession(async n=>{var a,o;const{data:l,error:u}=n;if(u)return this._returnResult({data:null,error:u});const h=Object.assign({friendly_name:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:d,error:m}=await fe(this.fetch,"POST",`${this.url}/factors`,{body:h,headers:this.headers,jwt:(a=l?.session)===null||a===void 0?void 0:a.access_token});return m?this._returnResult({data:null,error:m}):(t.factorType==="totp"&&d.type==="totp"&&(!((o=d?.totp)===null||o===void 0)&&o.qr_code)&&(d.totp.qr_code=`data:image/svg+xml;utf-8,${d.totp.qr_code}`),this._returnResult({data:d,error:null}))})}catch(n){if(ce(n))return this._returnResult({data:null,error:n});throw n}}async _verify(t){const n=async()=>{try{return await this._useSession(async a=>{var o;const{data:l,error:u}=a;if(u)return this._returnResult({data:null,error:u});const h=Object.assign({challenge_id:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?Sb(t.webauthn.credential_response):xb(t.webauthn.credential_response)})}:{code:t.code}),{data:d,error:m}=await fe(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:h,headers:this.headers,jwt:(o=l?.session)===null||o===void 0?void 0:o.access_token});return m?this._returnResult({data:null,error:m}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+d.expires_in},d)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",d),this._returnResult({data:d,error:m}))})}catch(a){if(ce(a))return this._returnResult({data:null,error:a});throw a}};return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,n):n()}async _challenge(t){const n=async()=>{try{return await this._useSession(async a=>{var o;const{data:l,error:u}=a;if(u)return this._returnResult({data:null,error:u});const h=await fe(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,headers:this.headers,jwt:(o=l?.session)===null||o===void 0?void 0:o.access_token});if(h.error)return h;const{data:d}=h;if(d.type!=="webauthn")return{data:d,error:null};switch(d.webauthn.type){case"create":return{data:Object.assign(Object.assign({},d),{webauthn:Object.assign(Object.assign({},d.webauthn),{credential_options:Object.assign(Object.assign({},d.webauthn.credential_options),{publicKey:_b(d.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},d),{webauthn:Object.assign(Object.assign({},d.webauthn),{credential_options:Object.assign(Object.assign({},d.webauthn.credential_options),{publicKey:wb(d.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(a){if(ce(a))return this._returnResult({data:null,error:a});throw a}};return this.lock!=null?this._acquireLock(this.lockAcquireTimeout,n):n()}async _challengeAndVerify(t){const{data:n,error:a}=await this._challenge({factorId:t.factorId});return a?this._returnResult({data:null,error:a}):await this._verify({factorId:t.factorId,challengeId:n.id,code:t.code})}async _listFactors(){var t;const{data:{user:n},error:a}=await this.getUser();if(a)return{data:null,error:a};const o={all:[],phone:[],totp:[],webauthn:[]};for(const l of(t=n?.factors)!==null&&t!==void 0?t:[])o.all.push(l),l.status==="verified"&&o[l.factor_type].push(l);return{data:o,error:null}}async _getAuthenticatorAssuranceLevel(t){var n,a,o,l;if(t)try{const{payload:_}=Xc(t);let S=null;_.aal&&(S=_.aal);let R=S;const{data:{user:E},error:x}=await this.getUser(t);if(x)return this._returnResult({data:null,error:x});((a=(n=E?.factors)===null||n===void 0?void 0:n.filter(j=>j.status==="verified"))!==null&&a!==void 0?a:[]).length>0&&(R="aal2");const D=_.amr||[];return{data:{currentLevel:S,nextLevel:R,currentAuthenticationMethods:D},error:null}}catch(_){if(ce(_))return this._returnResult({data:null,error:_});throw _}const{data:{session:u},error:h}
40=await this.getSession();if(h)return this._returnResult({data:null,error:h});if(!u)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:d}=Xc(u.access_token);let m=null;d.aal&&(m=d.aal);let v=m;((l=(o=u.user.factors)===null||o===void 0?void 0:o.filter(_=>_.status==="verified"))!==null&&l!==void 0?l:[]).length>0&&(v="aal2");const b=d.amr||[];return{data:{currentLevel:m,nextLevel:v,currentAuthenticationMethods:b},error:null}}async _getAuthorizationDetails(t){try{return await this._useSession(async n=>{const{data:{session:a},error:o}=n;return o?this._returnResult({data:null,error:o}):a?await fe(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:a.access_token,xform:l=>({data:l,error:null})}):this._returnResult({data:null,error:new qt})})}catch(n){if(ce(n))return this._returnResult({data:null,error:n});throw n}}async _approveAuthorization(t,n){try{return await this._useSession(async a=>{const{data:{session:o},error:l}=a;if(l)return this._returnResult({data:null,error:l});if(!o)return this._returnResult({data:null,error:new qt});const u=await fe(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:o.access_token,body:{action:"approve"},xform:h=>({data:h,error:null})});
40return u.data&&u.data.redirect_url&&rn()&&!n?.skipBrowserRedirect&&window.location.assign(u.data.redirect_url),u})}catch(a){if(ce(a))return this._returnResult({data:null,error:a});throw a}}async _denyAuthorization(t,n){try{return await this._useSession(async a=>{const{data:{session:o},error:l}=a;if(l)return this._returnResult({data:null,error:l});if(!o)return this._returnResult({data:null,error:new qt});const u=await fe(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:o.access_token,body:{action:"deny"},xform:h=>({data:h,error:null})});return u.data&&u.data.redirect_url&&rn()&&!n?.skipBrowserRedirect&&window.location.assign(u.data.redirect_url),u})}catch(a){if(ce(a))return this._returnResult({data:null,error:a});throw a}}async _listOAuthGrants(){try{return await this._useSession(async t=>{const{data:{session:n},error:a}=t;return a?this._returnResult({data:null,error:a}):n?await fe(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,xform:o=>({data:o,error:null})}):this._returnResult({data:null,error:new qt})})}catch(t){if(ce(t))return this._returnResult({data:null,error:t});throw t}}async _revokeOAuthGrant(t){try{return await this._useSession(async n=>{const{data:{session:a},error:o}=n;return o?this._returnResult({data:null,error:o}):a?(await fe(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:a.access_token,query:{client_id:t.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new qt})})}catch(n){if(ce(n))return this._returnResult({data:null,error:n});throw n}}async fetchJwk(t,n={keys:[]}){let a=n.keys.find(h=>h.kid===t);if(a)return a;const o=Date.now();if(a=this.jwks.keys.find(h=>h.kid===t),a&&this.jwks_cached_at+_j>o)return a;const{data:l,error:u}=await fe(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(u)throw u;return!l.keys||l.keys.length===0||(this.jwks=l,this.jwks_cached_at=o,a=l.keys.find(h=>h.kid===t),!a)?null:a}async getClaims(t,n={}){try{let a=t;if(!a){const{data:_,error:S}
40=await this.getSession();if(S||!_.session)return this._returnResult({data:null,error:S});a=_.session.access_token}const{header:o,payload:l,signature:u,raw:{header:h,payload:d}}=Xc(a);if(!n?.allowExpired)try{qj(l.exp)}catch(_){throw new Eu(_ instanceof Error?_.message:"JWT validation failed")}const m=!o.alg||o.alg.startsWith("HS")||!o.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(o.kid,n?.keys?{keys:n.keys}:n?.jwks);if(!m){const{error:_}=await this.getUser(a);if(_)throw _;return{data:{claims:l,header:o,signature:u},error:null}}const v=Fj(o.alg),p=await crypto.subtle.importKey("jwk",m,v,!0,["verify"]);if(!await crypto.subtle.verify(v,p,u,Oj(`${h}.${d}`)))throw new Eu("Invalid JWT signature");return{data:{claims:l,header:o,signature:u},error:null}}catch(a){if(ce(a))return this._returnResult({data:null,error:a});throw a}}async signInWithPasskey(t){var n,a,o;rr(this.experimental);try{if(!ku())return this._returnResult({data:null,error:new ir("Browser does not support WebAuthn",null)});const{data:l,error:u}=await this._startPasskeyAuthentication({options:{captchaToken:(n=t?.options)===null||n===void 0?void 0:n.captchaToken}});if(u||!l)return this._returnResult({data:null,error:u});const h=wb(l.options),d=(o=(a=t?.options)===null||a===void 0?void 0:a.signal)!==null&&o!==void 0?o:vp.createNewAbortSignal(),{data:m,error:v}=await gS({publicKey:h,signal:d});if(v||!m)return this._returnResult({data:null,error:v??new ir("WebAuthn ceremony failed",null)});const p=xb(m);return this._verifyPasskeyAuthentication({challengeId:l.challenge_id,credential:p})}catch(l){if(ce(l))return this._returnResult({data:null,error:l});throw l}}async registerPasskey(t){var n,a;rr(this.experimental);try{if(!ku())return this._returnResult({data:null,error:new ir("Browser does not support WebAuthn",null)});const{data:o,error:l}=await this._startPasskeyRegistration();if(l||!o)return this._returnResult({data:null,error:l});const u=_b(o.options),h=(a=(n=t?.options)===null||n===void 0?void 0:n.signal)!==null&&a!==void 0?a:vp.createNewAbortSignal(),{data:d,error:m}=await mS({publicKey:u,signal:h});if(m||!d)return this._returnResult({data:null,error:m??new ir("WebAuthn ceremony failed",null)});const v=Sb(d);return this._verifyPasskeyRegistration({challengeId:o.challenge_id,credential:v})}catch(o){if(ce(o))return this._returnResult({data:null,error:o});throw o}}async _startPasskeyRegistration(){rr(this.experimental);try{return await this._useSession(async t=>{const{data:{session:n},error:a}=t;if(a)return this._returnResult({data:null,error:a});if(!n)return this._returnResult({data:null,error:new qt});const{data:o,error:l}=await fe(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:n.access_token,body:{}});return l?this._returnResult({data:null,error:l}):this._returnResult({data:o,error:null})})}catch(t){if(ce(t))return this._returnResult({data:null,error:t});throw t}}async _verifyPasskeyRegistration(t){rr(this.experimental);try{return await this._useSession(async n=>{const{data:{session:a},error:o}=n;if(o)return this._returnResult({data:null,error:o});if(!a)return this._returnResult({data:null,error:new qt});const{data:l,error:u}=await fe(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:a.access_token,body:{challenge_id:t.challengeId,credential:t.credential}});return u?this._returnResult({data:null,error:u}):this._returnResult({data:l,error:null})})}catch(n){if(ce(n))return this._returnResult({data:null,error:n});throw n}}async _startPasskeyAuthentication(t){var n;rr(this.experimental);try{const{data:a,error:o}=await fe(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(n=t?.options)===null||n===void 0?void 0:n.captchaToken}}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:a,error:null})}catch(a){if(ce(a))return this._returnResult({data:null,error:a});throw a}}async _verifyPasskeyAuthentication(t){rr(this.experimental);try{const{data:n,error:a}=await fe(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:t.challengeId,credential:t.credential},xform:Qn});return a?this._returnResult({data:null,error:a}):(n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:n,error:null}))}catch(n){if(ce(n))return this._returnResult({data:null,error:n});throw n}}async _listPasskeys(){rr(this.experimental);try{return await this._useSession(async t=>{const{data:{session:n},error:a}=t;if(a)return this._returnResult({data:null,error:a});if(!n)return this._returnResult({data:null,error:new qt});const{data:o,error:l}=await fe(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:n.access_token,xform:u=>({data:u,error:null})});return l?this._returnResult({data:null,error:l}):this._returnResult({data:o,error:null})})}catch(t){if(ce(t))return this._returnResult({data:null,error:t});throw t}}async _updatePasskey(t){rr(this.experimental);try{return await this._useSession(async n=>{const{data:{session:a},error:o}=n;
40if(o)return this._returnResult({data:null,error:o});if(!a)return this._returnResult({data:null,error:new qt});const{data:l,error:u}=await fe(this.fetch,"PATCH",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:a.access_token,body:{friendly_name:t.friendlyName}});return u?this._returnResult({data:null,error:u}):this._returnResult({data:l,error:null})})}catch(n){if(ce(n))return this._returnResult({data:null,error:n});throw n}}async _deletePasskey(t){rr(this.experimental);try{return await this._useSession(async n=>{const{data:{session:a},error:o}=n;if(o)return this._returnResult({data:null,error:o});if(!a)return this._returnResult({data:null,error:new qt});const{error:l}=await fe(this.fetch,"DELETE",`${this.url}/passkeys/${t.passkeyId}`,{headers:this.headers,jwt:a.access_token,noResolveJson:!0});return l?this._returnResult({data:null,error:l}):this._returnResult({data:null,error:null})})}catch(n){if(ce(n))return this._returnResult({data:null,error:n});throw n}}}pl.nextInstanceID={};const p2=pl,m2="2.110.2";let Wo="",Ou;if(typeof Deno<"u"){var Dh;Wo="deno",Ou=(Dh=Deno.version)===null||Dh===void 0?void 0:Dh.deno}else if(typeof document<"u")Wo="web";else if(typeof navigator<"u"&&navigator.product==="ReactNative")Wo="react-native";else{var Mh;Wo="node",Ou=typeof process<"u"?(Mh=process.version)===null||Mh===void 0?void 0:Mh.replace(/^v/,""):void 0}const yS=[`runtime=${Wo}`];Ou&&yS.push(`runtime-version=${Ou}`);const g2={"X-Client-Info":`supabase-js/${m2}; ${yS.join("; ")}`},y2={headers:g2},v2={schema:"public"},b2={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},_2={},w2={enabled:!1,respectSamplingDecision:!0};function S2(e,t,n,a){function o(l){return l instanceof n?l:new n(function(u){u(l)})}return new(n||(n=Promise))(function(l,u){function h(v){try{m(a.next(v))}catch(p){u(p)}}function d(v){try{m(a.throw(v))}catch(p){u(p)}}function m(v){v.done?l(v.value):o(v.value).then(h,d)}m((a=a.apply(e,[])).next())})}let Nh=null;const x2="@opentelemetry/api";function T2(){return Nh===null&&(Nh=import(x2).catch(()=>null)),Nh}function E2(){return S2(this,void 0,void 0,function*(){try{const e=yield T2();if(!e||!e.propagation||!e.context)return null;const t={};e.propagation.inject(e.context.active(),t);const n=t.traceparent;return n?{traceparent:n,tracestate:t.tracestate,baggage:t.baggage}:null}catch{return null}})}function R2(e){if(!e||typeof e!="string")return null;const t=e.split("-");if(t.length!==4)return null;const[n,a,o,l]=t;if(n.length!==2||a.length!==32||o.length!==16||l.length!==2)return null;const u=/^[0-9a-f]+$/i;return!u.test(n)||!u.test(a)||!u.test(o)||!u.test(l)||a==="00000000000000000000000000000000"||o==="0000000000000000"?null:{version:n,traceId:a,parentId:o,traceFlags:l,isSampled:(parseInt(l,16)&1)===1}}function A2(e,t){if(!e||!t||t.length===0)return!1;let n;if(e instanceof URL)n=e;else try{n=new URL(e)}catch{return!1}for(const a of t)try{if(typeof a=="string"){if(k2(n.hostname,a))return!0}else if(a instanceof RegExp){if(a.test(n.hostname))return!0}else if(typeof a=="function"&&a(n))return!0}catch{continue}return!1}function k2(e,t){if(t===e)return!0;if(t.startsWith("*.")){const n=t.slice(2);if(e.endsWith(n)&&(e===n||e.endsWith("."+n)))return!0}return!1}function C2(e){const t=[];try{const n=new URL(e);t.push(n.hostname)}catch{}return t.push("*.supabase.co","*.supabase.in"),t.push("localhost","127.0.0.1","[::1]"),t}function ml(e){"@babel/helpers - typeof";return ml=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ml(e)}function O2(e,t){if(ml(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var a=n.call(e,t);if(ml(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function j2(e){var t=O2(e,"string");return ml(t)=="symbol"?t:t+""}function D2(e,t,n){return(t=j2(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Tb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,a)}return n}function _t(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};
40t%2?Tb(Object(n),!0).forEach(function(a){D2(e,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Tb(Object(n)).forEach(function(a){Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(n,a))})}return e}const M2=e=>e?(...t)=>e(...t):(...t)=>fetch(...t),N2=()=>Headers,L2=(e,t,n,a,o)=>{const l=M2(a),u=N2(),h=o?.enabled===!0,d=o?.respectSamplingDecision!==!1,m=h?C2(t):null;return async(v,p)=>{var b;const _=(b=await n())!==null&&b!==void 0?b:e;let S=new u(p?.headers);if(S.has("apikey")||S.set("apikey",e),S.has("Authorization")||S.set("Authorization",`Bearer ${_}`),m){const R=await z2(v,m,d);R&&(R.traceparent&&!S.has("traceparent")&&S.set("traceparent",R.traceparent),R.tracestate&&!S.has("tracestate")&&S.set("tracestate",R.tracestate),R.baggage&&!S.has("baggage")&&S.set("baggage",R.baggage))}return l(v,_t(_t({},p),{},{headers:S}))}};async function z2(e,t,n){if(!A2(typeof e=="string"||e instanceof URL?e:e.url,t))return null;const a=await E2();if(!a||!a.traceparent)return null;if(n){const o=R2(a.traceparent);if(o&&!o.isSampled)return null}return a}function Eb(e){return typeof e=="boolean"?{enabled:e}:e}function P2(e){return e.endsWith("/")?e:e+"/"}function U2(e,t){var n,a,o,l,u,h;const{db:d,auth:m,realtime:v,global:p}=e,{db:b,auth:_,realtime:S,global:R}=t,E=Eb(e.tracePropagation),x=Eb(t.tracePropagation),k={db:_t(_t({},b),d),auth:_t(_t({},_),m),realtime:_t(_t({},S),v),storage:{},global:_t(_t(_t({},R),p),{},{headers:_t(_t({},(n=R?.headers)!==null&&n!==void 0?n:{}),(a=p?.headers)!==null&&a!==void 0?a:{})}),tracePropagation:{enabled:(o=(l=E?.enabled)!==null&&l!==void 0?l:x?.enabled)!==null&&o!==void 0?o:!1,respectSamplingDecision:(u=(h=E?.respectSamplingDecision)!==null&&h!==void 0?h:x?.respectSamplingDecision)!==null&&u!==void 0?u:!0},accessToken:async()=>""};return e.accessToken?k.accessToken=e.accessToken:delete k.accessToken,k}function $2(e){const t=e?.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(P2(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var B2=class extends p2{constructor(e){super(e)}},I2=class{constructor(e,t,n){var a,o;this.supabaseUrl=e,this.supabaseKey=t;const l=$2(e);if(!t)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",l),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",l),this.storageUrl=new URL("storage/v1",l),this.functionsUrl=new URL("functions/v1",l);const u=`sb-${l.hostname.split(".")[0]}-auth-token`,h={db:v2,realtime:_2,auth:_t(_t({},b2),{},{storageKey:u}),global:y2,tracePropagation:w2},d=U2(n??{},h);if(this.settings=d,this.storageKey=(a=d.auth.storageKey)!==null&&a!==void 0?a:"",this.headers=(o=d.global.headers)!==null&&o!==void 0?o:{},d.accessToken)this.accessToken=d.accessToken,this.auth=new Proxy({},{get:(v,p)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(p)} is not possible`)}});else{var m;this.auth=this._initSupabaseAuthClient((m=d.auth)!==null&&m!==void 0?m:{},this.headers,d.global.fetch)}this.fetch=L2(t,e,this._getAccessToken.bind(this),d.global.fetch,d.tracePropagation),this.realtime=this._initRealtimeClient(_t({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},d.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(v=>this.realtime.setAuth(v)).catch(v=>console.warn("Failed to set initial Realtime auth token:",v)),this.rest=new QC(new URL("rest/v1",l).href,{headers:this.headers,schema:d.db.schema,fetch:this.fetch,timeout:d.db.timeout,urlLengthLimit:d.db.urlLengthLimit}),this.storage=new pj(this.storageUrl.href,this.headers,this.fetch,n?.storage),d.accessToken||this._listenForAuthEvents()}get functions(){return new IC(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}
40channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e=this,t,n;if(e.accessToken)return await e.accessToken();const{data:a}=await e.auth.getSession();return(t=(n=a.session)===null||n===void 0?void 0:n.access_token)!==null&&t!==void 0?t:e.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:a,userStorage:o,storageKey:l,flowType:u,lock:h,debug:d,throwOnError:m,experimental:v,lockAcquireTimeout:p,skipAutoInitialize:b},_,S){const R={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new B2({url:this.authUrl.href,headers:_t(_t({},R),_),storageKey:l,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:a,userStorage:o,flowType:u,lock:h,debug:d,throwOnError:m,experimental:v,fetch:S,lockAcquireTimeout:p,skipAutoInitialize:b,hasCustomAuthorizationHeader:Object.keys(this.headers).some(E=>E.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new UO(this.realtimeUrl.href,_t(_t({},e),{},{params:_t(_t({},{apikey:this.supabaseKey}),e?.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",t?.access_token)})}_handleTokenChanged(e,t,n){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):e==="SIGNED_OUT"&&(this.realtime.setAuth(),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const H2=(e,t,n)=>new I2(e,t,n);function q2(){if(typeof window<"u")return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(t==null)return!1;const n=t.match(/^v(\d+)\./);return n?parseInt(n[1],10)<=20:!1}q2()&&console.warn("⚠️  Node.js 20 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 22 or later. For more information, visit: https://github.com/orgs/supabase/discussions/45715");function F2(){if(typeof window>"u")return;const e=location.hostname,n=["lovableproject.com","lovableproject-dev.com","lovable.app","gpt-eng.com","gptengineer.run"].some(E=>e===E||e.endsWith("."+E)),a="[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}",o=n?e.match(new RegExp("^(?:id-preview(?:-[a-z0-9]+)?|project)--("+a+")(?:-dev)?(?=\\.|$)","i"))?.[1]??e.match(new RegExp("^("+a+")(?=[.-])","i"))?.[1]:void 0,l=window.parent&&window.parent!==window;if(!o||!l)return localStorage;const u=e.endsWith(".lovableproject-dev.com")||e.endsWith(".gpt-eng.com"),h=u?/^https:\/\/([a-z0-9-]+\.)*(lovable\.dev|gptengineer\.app)$|^http:\/\/localhost:3000$/:/^https:\/\/([a-z0-9-]+\.)*(lovable\.dev|gptengineer\.app)$/,d=location.ancestorOrigins&&location.ancestorOrigins[0]||(document.referrer?new URL(document.referrer).origin:""),m=d&&h.test(d)?[d]:u?["https://lovable.dev","http://localhost:3000"]:["https://lovable.dev"],v="lovable-preview-auth:result",p=2e3,b=()=>Math.random().toString(36).slice(2)+Date.now().toString(36),_=(E,x,k)=>new Promise(D=>{const j=b();let H=!1,U;const B=se=>{H||(H=!0,clearTimeout(U),window.removeEventListener("message",V),D(se))},V=se=>{if(m.indexOf(se.origin)<0)return;const le=se.data;le&&le.type===v&&le.requestId===j&&B(le)};window.addEventListener("message",V);const W={type:E,requestId:j,projectId:o,key:x};k!==void 0&&(W.value=k);for(const se of m)window.parent.postMessage(W,se);U=setTimeout(()=>B(null),p)});let S=!0;const R=250;return{getItem:async E=>{let x=await _("lovable-preview-auth:get",E);return!x&&S&&(await new Promise(k=>setTimeout(k,R)),x=await _("lovable-preview-auth:get",E)),S=!1,x&&x.ok&&typeof x.value=="string"?x.value===""?(localStorage.removeItem(E),null):x.value:localStorage.getItem(E)},setItem:(E,x)=>(localStorage.setItem(E,x),_("lovable-preview-auth:set",E,x).then(()=>{})),removeItem:E=>(localStorage.removeItem(E),_("lovable-preview-auth:remove",E).then(()=>{}))}}function G2(e){return e.startsWith("sb_publishable_")||e.startsWith("sb_secret_")}function V2(e){return(t,n)=>{const a=new Headers(typeof Request<"u"&&t instanceof Request?t.headers:void 0);
40return n?.headers&&new Headers(n.headers).forEach((o,l)=>a.set(l,o)),G2(e)&&a.get("Authorization")===`Bearer ${e}`&&a.delete("Authorization"),a.set("apikey",e),fetch(t,{...n,headers:a})}}function Y2(){const e="https://jdifiunfwjxnwizltkce.supabase.co",t="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImpkaWZpdW5md2p4bndpemx0a2NlIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODIyMjA4MjgsImV4cCI6MjA5Nzc5NjgyOH0.ved-jzbzduemNO34MwVgKp97PTPKZqAGhYggMp4IApo";return H2(e,t,{global:{fetch:V2(t)},auth:{storage:F2(),persistSession:!0,autoRefreshToken:!0}})}let Lh;const Re=new Proxy({},{get(e,t,n){return Lh||(Lh=Y2()),Reflect.get(Lh,t,n)}}),H3=Object.freeze(Object.defineProperty({__proto__:null,supabase:Re},Symbol.toStringTag,{value:"Module"})),K2=Ns({type:"function"}).client(async({next:e})=>{const{data:t}=await Re.auth.getSession(),n=t.session?.access_token;return e({headers:n?{Authorization:`Bearer ${n}`}:{}})}),W2=Ns(),Rb=PC(()=>({functionMiddleware:[K2],requestMiddleware:[W2]}));var Yu=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Q2=class extends Yu{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},vS=new Q2,X2={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},J2=class{#e=X2;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},bp=new J2;function Z2(e){setTimeout(e,0)}var eD=typeof window>"u"||"Deno"in globalThis;function ar(){}function tD(e,t){return typeof e=="function"?e(t):e}function nD(e){return typeof e=="number"&&e>=0&&e!==1/0}function rD(e,t){return Math.max(e+(t||0)-Date.now(),0)}function _p(e,t){return typeof e=="function"?e(t):e}function sD(e,t){return typeof e=="function"?e(t):e}function Ab(e,t){const{type:n="all",exact:a,fetchStatus:o,predicate:l,queryKey:u,stale:h}=e;if(u){if(a){if(t.queryHash!==Fp(u,t.options))return!1}else if(!yl(t.queryKey,u))return!1}if(n!=="all"){const d=t.isActive();if(n==="active"&&!d||n==="inactive"&&d)return!1}return!(typeof h=="boolean"&&t.isStale()!==h||o&&o!==t.state.fetchStatus||l&&!l(t))}function kb(e,t){const{exact:n,status:a,predicate:o,mutationKey:l}=e;if(l){if(!t.options.mutationKey)return!1;if(n){if(gl(t.options.mutationKey)!==gl(l))return!1}else if(!yl(t.options.mutationKey,l))return!1}return!(a&&t.state.status!==a||o&&!o(t))}function Fp(e,t){return(t?.queryKeyHashFn||gl)(e)}function gl(e){return JSON.stringify(e,(t,n)=>wp(n)?Object.keys(n).sort().reduce((a,o)=>(a[o]=n[o],a),{}):n)}function yl(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>yl(e[n],t[n])):!1}var aD=Object.prototype.hasOwnProperty;function bS(e,t,n=0){if(e===t)return e;if(n>500)return t;const a=Cb(e)&&Cb(t);if(!a&&!(wp(e)&&wp(t)))return t;const l=(a?e:Object.keys(e)).length,u=a?t:Object.keys(t),h=u.length,d=a?new Array(h):{};let m=0;for(let v=0;v<h;v++){const p=a?v:u[v],b=e[p],_=t[p];if(b===_){d[p]=b,(a?v<l:aD.call(e,p))&&m++;continue}if(b===null||_===null||typeof b!="object"||typeof _!="object"){d[p]=_;continue}const S=bS(b,_,n+1);d[p]=S,S===b&&m++}return l===h&&m===l?e:d}function q3(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Cb(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function wp(e){if(!Ob(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Ob(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Ob(e){return Object.prototype.toString.call(e)==="[object Object]"}function iD(e){return new Promise(t=>{bp.setTimeout(t,e)})}
40function oD(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?bS(e,t):t}function lD(e,t,n=0){const a=[...e,t];return n&&a.length>n?a.slice(1):a}function cD(e,t,n=0){const a=[t,...e];return n&&a.length>n?a.slice(0,-1):a}var Gp=Symbol();function _S(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Gp?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function F3(e,t){return typeof e=="function"?e(...t):!!e}function uD(e,t,n){let a=!1,o;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(o??=t(),a||(a=!0,o.aborted?n():o.addEventListener("abort",n,{once:!0})),o)}),e}var wS=(()=>{let e=()=>eD;return{isServer(){return e()},setIsServer(t){e=t}}})();function dD(){let e,t;const n=new Promise((o,l)=>{e=o,t=l});n.status="pending",n.catch(()=>{});function a(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{a({status:"fulfilled",value:o}),e(o)},n.reject=o=>{a({status:"rejected",reason:o}),t(o)},n}var fD=Z2;function hD(){let e=[],t=0,n=h=>{h()},a=h=>{h()},o=fD;const l=h=>{t?e.push(h):o(()=>{n(h)})},u=()=>{const h=e;e=[],h.length&&o(()=>{a(()=>{h.forEach(d=>{n(d)})})})};return{batch:h=>{let d;t++;try{d=h()}finally{t--,t||u()}return d},batchCalls:h=>(...d)=>{l(()=>{h(...d)})},schedule:l,setNotifyFunction:h=>{n=h},setBatchNotifyFunction:h=>{a=h},setScheduler:h=>{o=h}}}var on=hD(),pD=class extends Yu{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},ju=new pD;function mD(e){return Math.min(1e3*2**e,3e4)}function SS(e){return(e??"online")==="online"?ju.isOnline():!0}var Sp=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function xS(e){let t=!1,n=0,a;const o=dD(),l=()=>o.status!=="pending",u=R=>{if(!l()){const E=new Sp(R);b(E),e.onCancel?.(E)}},h=()=>{t=!0},d=()=>{t=!1},m=()=>vS.isFocused()&&(e.networkMode==="always"||ju.isOnline())&&e.canRun(),v=()=>SS(e.networkMode)&&e.canRun(),p=R=>{l()||(a?.(),o.resolve(R))},b=R=>{l()||(a?.(),o.reject(R))},_=()=>new Promise(R=>{a=E=>{(l()||m())&&R(E)},e.onPause?.()}).then(()=>{a=void 0,l()||e.onContinue?.()}),S=()=>{if(l())return;let R;const E=n===0?e.initialPromise:void 0;try{R=E??e.fn()}catch(x){R=Promise.reject(x)}Promise.resolve(R).then(p).catch(x=>
40{if(l())return;const k=e.retry??(wS.isServer()?0:3),D=e.retryDelay??mD,j=typeof D=="function"?D(n,x):D,H=k===!0||typeof k=="number"&&n<k||typeof k=="function"&&k(n,x);if(t||!H){b(x);return}n++,e.onFail?.(n,x),iD(j).then(()=>m()?void 0:_()).then(()=>{t?b(x):S()})})};return{promise:o,status:()=>o.status,cancel:u,continue:()=>(a?.(),o),cancelRetry:h,continueRetry:d,canStart:v,start:()=>(v()?S():_().then(S),o)}}var TS=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),nD(this.gcTime)&&(this.#e=bp.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(wS.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(bp.clearTimeout(this.#e),this.#e=void 0)}};function gD(e){return{onFetch:(t,n)=>{const a=t.options,o=t.fetchOptions?.meta?.fetchMore?.direction,l=t.state.data?.pages||[],u=t.state.data?.pageParams||[];let h={pages:[],pageParams:[]},d=0;const m=async()=>{let v=!1;const p=S=>{uD(S,()=>t.signal,()=>v=!0)},b=_S(t.options,t.fetchOptions),_=async(S,R,E)=>{if(v)return Promise.reject(t.signal.reason);if(R==null&&S.pages.length)return Promise.resolve(S);const k=(()=>{const U={client:t.client,queryKey:t.queryKey,pageParam:R,direction:E?"backward":"forward",meta:t.options.meta};return p(U),U})(),D=await b(k),{maxPages:j}=t.options,H=E?cD:lD;return{pages:H(S.pages,D,j),pageParams:H(S.pageParams,R,j)}};if(o&&l.length){const S=o==="backward",R=S?yD:jb,E={pages:l,pageParams:u},x=R(a,E);h=await _(E,x,S)}else{const S=e??l.length;do{const R=d===0?u[0]??a.initialPageParam:jb(a,h);if(d>0&&R==null)break;h=await _(h,R),d++}while(d<S)}return h};t.options.persister?t.fetchFn=()=>t.options.persister?.(m,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=m}}}function jb(e,{pages:t,pageParams:n}){const a=t.length-1;return t.length>0?e.getNextPageParam(t[a],t,n[a],n):void 0}function yD(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var vD=class extends TS{#e;#t;#n;#s;#a;#r;#l;#i;constructor(e){super(),this.#i=!1,this.#l=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#a=e.client,this.#s=this.#a.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Mb(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#r?.promise}setOptions(e){if(this.options={...this.#l,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=Mb(this.options);t.data!==void 0&&(this.setState(Db(t.data,t.dataUpdatedAt)),this.#t=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#s.remove(this)}setData(e,t){const n=oD(this.state.data,e,this.options);return this.#o({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#o({type:"setState",state:e})}cancel(e){const t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(ar).catch(ar):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>sD(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Gp||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>_p(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!rD(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#s.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#r&&(this.#i||this.#c()?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#s.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#o({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){const d=this.observers.find(m=>m.options.queryFn);d&&this.setOptions(d.options)}const n=new AbortController,a=d=>{Object.defineProperty(d,"signal",{enumerable:!0,get:()=>(this.#i=!0,n.signal)}
40)},o=()=>{const d=_S(this.options,t),v=(()=>{const p={client:this.#a,queryKey:this.queryKey,meta:this.meta};return a(p),p})();return this.#i=!1,this.options.persister?this.options.persister(d,v,this):d(v)},u=(()=>{const d={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#a,state:this.state,fetchFn:o};return a(d),d})();(this.#e==="infinite"?gD(this.options.pages):this.options.behavior)?.onFetch(u,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==u.fetchOptions?.meta)&&this.#o({type:"fetch",meta:u.fetchOptions?.meta}),this.#r=xS({initialPromise:t?.initialPromise,fn:u.fetchFn,onCancel:d=>{d instanceof Sp&&d.revert&&this.setState({...this.#n,fetchStatus:"idle"}),n.abort()},onFail:(d,m)=>{this.#o({type:"failed",failureCount:d,error:m})},onPause:()=>{this.#o({type:"pause"})},onContinue:()=>{this.#o({type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0});try{const d=await this.#r.start();if(d===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(d),this.#s.config.onSuccess?.(d,this),this.#s.config.onSettled?.(d,this.state.error,this),d}catch(d){if(d instanceof Sp){if(d.silent)return this.#r.promise;if(d.revert){if(this.state.data===void 0)throw d;return this.state.data}}throw this.#o({type:"error",error:d}),this.#s.config.onError?.(d,this),this.#s.config.onSettled?.(this.state.data,d,this),d}finally{this.scheduleGc()}}#o(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...bD(n.data,this.options),fetchMeta:e.meta??null};case"success":const a={...n,...Db(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?a:void 0,a;case"error":const o=e.error;return{...n,error:o,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),on.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#s.notify({query:this,type:"updated",action:e})})}};function bD(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:SS(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Db(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Mb(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,a=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?a??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var _D=class extends TS{#e;#t;#n;#s;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||wD(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#s?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#a({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#s=xS({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(l,u)=>{this.#a({type:"failed",failureCount:l,error:u})},onPause:()=>{this.#a({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});
40const a=this.state.status==="pending",o=!this.#s.canStart();try{if(a)t();else{this.#a({type:"pending",variables:e,isPaused:o}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);const u=await this.options.onMutate?.(e,n);u!==this.state.context&&this.#a({type:"pending",context:u,variables:e,isPaused:o})}const l=await this.#s.start();return await this.#n.config.onSuccess?.(l,e,this.state.context,this,n),await this.options.onSuccess?.(l,e,this.state.context,n),await this.#n.config.onSettled?.(l,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(l,null,e,this.state.context,n),this.#a({type:"success",data:l}),l}catch(l){try{await this.#n.config.onError?.(l,e,this.state.context,this,n)}catch(u){Promise.reject(u)}try{await this.options.onError?.(l,e,this.state.context,n)}catch(u){Promise.reject(u)}try{await this.#n.config.onSettled?.(void 0,l,this.state.variables,this.state.context,this,n)}catch(u){Promise.reject(u)}try{await this.options.onSettled?.(void 0,l,e,this.state.context,n)}catch(u){Promise.reject(u)}throw this.#a({type:"error",error:l}),l}finally{this.#n.runNext(this)}}#a(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),on.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function wD(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var SD=class extends Yu{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){const a=new _D({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(a),a}add(e){this.#e.add(e);const t=Jc(e);if(typeof t=="string"){const n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=Jc(e);if(typeof t=="string"){const n=this.#t.get(t);if(n)if(n.length>1){const a=n.indexOf(e);a!==-1&&n.splice(a,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Jc(e);if(typeof t=="string"){const a=this.#t.get(t)?.find(o=>o.state.status==="pending");return!a||a===e}else return!0}runNext(e){const t=Jc(e);return typeof t=="string"?this.#t.get(t)?.find(a=>a!==e&&a.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){on.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>kb(t,n))}findAll(e={}){return this.getAll().filter(t=>kb(e,t))}notify(e){on.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>
40t.state.isPaused);return on.batch(()=>Promise.all(e.map(t=>t.continue().catch(ar))))}};function Jc(e){return e.options.scope?.id}var xD=class extends Yu{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const a=t.queryKey,o=t.queryHash??Fp(a,t);let l=this.get(o);return l||(l=new vD({client:e,queryKey:a,queryHash:o,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(a)}),this.add(l)),l}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){on.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>Ab(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>Ab(e,n)):t}notify(e){on.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){on.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){on.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},TD=class{#e;#t;#n;#s;#a;#r;#l;#i;constructor(e={}){this.#e=e.queryCache||new xD,this.#t=e.mutationCache||new SD,this.#n=e.defaultOptions||{},this.#s=new Map,this.#a=new Map,this.#r=0}mount(){this.#r++,this.#r===1&&(this.#l=vS.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#i=ju.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#r--,this.#r===0&&(this.#l?.(),this.#l=void 0,this.#i?.(),this.#i=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#e.build(this,t),a=n.state.data;return a===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(_p(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(a))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>{const a=n.data;return[t,a]})}setQueryData(e,t,n){const a=this.defaultQueryOptions({queryKey:e}),l=this.#e.get(a.queryHash)?.state.data,u=tD(t,l);if(u!==void 0)return this.#e.build(this,a).setData(u,{...n,manual:!0})}setQueriesData(e,t,n){return on.batch(()=>this.#e.findAll(e).map(({queryKey:a})=>[a,this.setQueryData(a,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;on.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return on.batch(()=>(n.findAll(e).forEach(a=>{a.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},a=on.batch(()=>this.#e.findAll(e).map(o=>o.cancel(n)));return Promise.all(a).then(ar).catch(ar)}invalidateQueries(e,t={}){return on.batch(()=>(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},a=on.batch(()=>this.#e.findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let l=o.fetch(void 0,n);return n.throwOnError||(l=l.catch(ar)),o.state.fetchStatus==="paused"?Promise.resolve():l}));return Promise.all(a).then(ar)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime(_p(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ar).catch(ar)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ar).catch(ar)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return ju.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#s.set(gl(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#s.values()],n={};return t.forEach(a=>{yl(e,a.queryKey)&&Object.assign(n,a.defaultOptions)}),n}setMutationDefaults(e,t){this.#a.set(gl(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#a.values()],n={};return t.forEach(a=>{yl(e,a.mutationKey)&&Object.assign(n,a.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Fp(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Gp&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},ES=O.createContext(void 0),G3=e=>{const t=O.useContext(ES);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},ED=({client:e,children:t})=>(O.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),y.jsx(ES.Provider,{value:e,children:t}));const RD="/assets/styles-BX6wO2Zs.css";function AD(e,t={}){typeof window>"u"||window.__lovableEvents?.captureException?.(e,{source:"react_error_boundary",route:window.location.pathname,...t},{mechanism:"react_error_boundary",handled:!1,severity:"error"})}const kD="/__l5e/assets-v1/1dd039e9-740a-44c6-a68c-652ba1943b24/apex-logo.png",RS={url:kD};function CD(){return null}const OD="modulepreload",jD=function(e){return"/"+e},Nb={}
40,tt=function(t,n,a){let o=Promise.resolve();if(n&&n.length>0){let d=function(m){return Promise.all(m.map(v=>Promise.resolve(v).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const u=document.querySelector("meta[property=csp-nonce]"),h=u?.nonce||u?.getAttribute("nonce");o=d(n.map(m=>{if(m=jD(m),m in Nb)return;Nb[m]=!0;const v=m.endsWith(".css"),p=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${p}`))return;const b=document.createElement("link");if(b.rel=v?"stylesheet":OD,v||(b.as="script"),b.crossOrigin="",b.href=m,h&&b.setAttribute("nonce",h),document.head.appendChild(b),v)return new Promise((_,S)=>{b.addEventListener("load",_),b.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${m}`)))})}))}function l(u){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=u,window.dispatchEvent(h),!h.defaultPrevented)throw u}return o.then(u=>{for(const h of u||[])h.status==="rejected"&&l(h.reason);return t().catch(l)})},AS=O.createContext({user:null,session:null,isAdmin:!1,adminLoading:!0,loading:!0,approved:!0,approvedLoading:!0,signOut:async()=>{}});function DD({children:e}){const[t,n]=O.useState(null),[a,o]=O.useState(!1),[l,u]=O.useState(!0),[h,d]=O.useState(!0),[m,v]=O.useState(!0),[p,b]=O.useState(!0);O.useEffect(()=>{let S=!0,R=!1;const{data:E}=Re.auth.onAuthStateChange((x,k)=>{S&&(x==="TOKEN_REFRESHED"&&!k||(n(k),R=!0,d(!1)))});return Re.auth.getSession().then(({data:x})=>{S&&(R||(n(x.session),R=!0,d(!1)))}),()=>{S=!1,E.subscription.unsubscribe()}},[]),O.useEffect(()=>{if(!t?.user){o(!1),u(!1);return}let S=!1;return u(!0),o(!1),(async()=>{try{const{data:R}=await Re.from("user_roles").select("role").eq("user_id",t.user.id).eq("role","admin").maybeSingle();if(S)return;o(!!R),u(!1)}catch{if(S)return;o(!1),u(!1)}})(),()=>{S=!0}},[t?.user?.id]),O.useEffect(()=>{const S=t?.user?.email;if(!S){v(!0),b(!1);return}let R=!1;return b(!0),(async()=>{try{const{data:E}=await Re.rpc("is_email_approved",{_email:S});R||v(!!E)}catch{R||v(!0)}finally{R||b(!1)}})(),()=>{R=!0}},[t?.user?.email]);const _={user:t?.user??null,session:t,isAdmin:a,adminLoading:l,loading:h,approved:m||a,approvedLoading:p,signOut:async()=>{const S=t?.user?.email??null;try{const{audit:R}=await tt(async()=>{const{audit:E}=await import("./security-audit-Hy72aGjP.js");return{audit:E}},[]);R({event_type:"sign_out",action:"sign_out",outcome:"success",actor_email:S})}catch{}await Re.auth.signOut()}};return y.jsx(AS.Provider,{value:_,children:e})}function kS(){return O.useContext(AS)}const xp="theme-preference",CS=O.createContext({theme:"dark",setTheme:()=>{},toggleTheme:()=>{}}),MD=`(function(){try{var t=localStorage.getItem("${xp}");document.documentElement.setAttribute("data-theme",t==="light"?"light":"dark");}catch(e){document.documentElement.setAttribute("data-theme","dark");}})();`;function ND({children:e}){const[t,n]=O.useState("dark");O.useEffect(()=>{let l=null;try{l=localStorage.getItem(xp)}catch{l=null}const u=l==="light"?"light":"dark";n(u),document.documentElement.setAttribute("data-theme",u)},[]);const a=O.useCallback(l=>{n(l),document.documentElement.setAttribute("data-theme",l);try{localStorage.setItem(xp,l)}catch{}},[]),o=O.useCallback(()=>{a(t==="dark"?"light":"dark")},[t,a]);return y.jsx(CS.Provider,{value:{theme:t,setTheme:a,toggleTheme:o},children:e})}function V3(){return O.useContext(CS)}function LD(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}const zD=e=>{switch(e){case"success":return $D;case"info":return ID;case"warning":return BD;case"error":return HD;default:return null}},PD=Array(12).fill(0),UD=({visible:e,className:t})=>ae.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},ae.createElement("div",{className:"sonner-spinner"},PD.map((n,a)=>ae.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${a}`})))),$D=ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ae.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),BD=ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"
40currentColor",height:"20",width:"20"},ae.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),ID=ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ae.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),HD=ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ae.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),qD=ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ae.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ae.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),FD=()=>{const[e,t]=ae.useState(document.hidden);return ae.useEffect(()=>{const n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e};let Tp=1;class GD{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const n=this.subscribers.indexOf(t);this.subscribers.splice(n,1)}),this.publish=t=>{this.subscribers.forEach(n=>n(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var n;const{message:a,...o}=t,l=typeof t?.id=="number"||((n=t.id)==null?void 0:n.length)>0?t.id:Tp++,u=this.toasts.find(d=>d.id===l),h=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(l)&&this.dismissedToasts.delete(l),u?this.toasts=this.toasts.map(d=>d.id===l?(this.publish({...d,...t,id:l,title:a}),{...d,...t,id:l,dismissible:h,title:a}):d):this.addToast({title:a,...o,dismissible:h,id:l}),l},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:t,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(a=>a({id:n.id,dismiss:!0}))}),t),this.message=(t,n)=>this.create({...n,message:t}),this.error=(t,n)=>this.create({...n,message:t,type:"error"}),this.success=(t,n)=>this.create({...n,type:"success",message:t}),this.info=(t,n)=>this.create({...n,type:"info",message:t}),this.warning=(t,n)=>this.create({...n,type:"warning",message:t}),this.loading=(t,n)=>this.create({...n,type:"loading",message:t}),this.promise=(t,n)=>{if(!n)return;let a;n.loading!==void 0&&(a=this.create({...n,promise:t,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const o=Promise.resolve(t instanceof Function?t():t);let l=a!==void 0,u;const h=o.then(async m=>{if(u=["resolve",m],ae.isValidElement(m))l=!1,this.create({id:a,type:"default",message:m});else if(YD(m)&&!m.ok){l=!1;const p=typeof n.error=="function"?await n.error(`HTTP error! status: ${m.status}`):n.error,b=typeof n.description=="function"?await n.description(`HTTP error! status: ${m.status}`):n.description,S=typeof p=="object"&&!ae.isValidElement(p)?p:{message:p};this.create({id:a,type:"error",description:b,...S})}else if(m instanceof Error){l=!1;const p=typeof n.error=="function"?await n.error(m):n.error,b=typeof n.description=="function"?await n.description(m):n.description,S=typeof p=="object"&&!ae.isValidElement(p)?p:{message:p};this.create({id:a,type:"error",description:b,...S})}else if(n.success!==void 0){l=!1;const p=typeof n.success=="function"?await n.success(m):n.success,b=typeof n.description=="function"?await n.description(m):n.description,S=typeof p=="object"&&!ae.isValidElement(p)?p:{message:p};this.create({id:a,type:"success",description:b,...S})}}).catch(async m=>{if(u=["reject",m],n.error!==void 0){l=!1;const v=typeof n.error=="function"?await n.error(m):n.error,p=typeof n.description=="function"?await n.description(m):n.description,_=typeof v=="object"&&!ae.isValidElement(v)?v:{message:v};this.create({id:a,type:"error",description:p,..._})}}).finally(()=>{l&&(this.dismiss(a),a=void 0),n.finally==null||n.finally.call(n)}),d=()=>new Promise((m,v)=>h.then(()=>u[0]==="reject"?v(u[1]):m(u[1])).catch(v));return typeof a!="string"&&typeof a!="number"?{unwrap:d}:Object.assign(a,{unwrap:d})},this.custom=(t,n)=>{const a=n?.id||Tp++;return this.create({jsx:t(a),id:a,...n}),a},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Sn=new GD,VD=(e,t)=>{const n=t?.id||Tp++;return Sn.addToast({title:e,...t,id:n}),n},YD=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",KD=VD,WD=()=>Sn.toasts,QD=()=>Sn.getActiveToasts(),He=Object.assign(KD,{success:Sn.success,info:Sn.info,warning:Sn.warning,error:Sn.error,custom:Sn.custom,message:Sn.message,promise:Sn.promise,dismiss:Sn.dismiss,loading:Sn.loading},{getHistory:WD,getToasts:QD});LD("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;
40--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;
40left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}
40[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);
40--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Zc(e){return e.label!==void 0}const XD=3,JD="24px",ZD="16px",Lb=4e3,eM=356,tM=14,nM=45,rM=200;function gr(...e){return e.filter(Boolean).join(" ")}function sM(e){const[t,n]=e.split("-"),a=[];return t&&a.push(t),n&&a.push(n),a}const aM=e=>{var t,n,a,o,l,u,h,d,m;const{invert:v,toast:p,unstyled:b,interacting:_,setHeights:S,visibleToasts:R,heights:E,index:x,toasts:k,expanded:D,removeToast:j,defaultRichColors:H,closeButton:U,style:B,cancelButtonStyle:V,actionButtonStyle:W,className:se="",descriptionClassName:le="",duration:ue,position:Ce,gap:Se,expandByDefault:Le,classNames:P,icons:ne,closeButtonAriaLabel:oe="Close toast"}=e,[Te,he]=ae.useState(null),[N,X]=ae.useState(null),[Z,re]=ae.useState(!1),[Y,Q]=ae.useState(!1),[ve,ie]=ae.useState(!1),[Oe,it]=ae.useState(!1),[xe,we]=ae.useState(!1),[Ne,Me]=ae.useState(0),[Nn,Jt]=ae.useState(0),Ve=ae.useRef(p.duration||ue||Lb),Zt=ae.useRef(null),pt=ae.useRef(null),en=x===0,ur=x+1<=R,yt=p.type,St=p.dismissible!==!1,Rt=p.className||"",Be=p.descriptionClassName||"",ut=ae.useMemo(()=>E.findIndex(Ae=>Ae.toastId===p.id)||0,[E,p.id]),Ut=ae.useMemo(()=>{var Ae;return(Ae=p.closeButton)!=null?Ae:U},[p.closeButton,U]),Ln=ae.useMemo(()=>p.duration||ue||Lb,[p.duration,ue]),ts=ae.useRef(0),zn=ae.useRef(0),Fs=ae.useRef(0),Xn=ae.useRef(null),[Pn,$t]=Ce.split("-"),L=ae.useMemo(()=>E.reduce((Ae,dt,Bt)=>Bt>=ut?Ae:Ae+dt.height,0),[E,ut]),I=FD(),Ee=p.invert||v,me=yt==="loading";zn.current=ae.useMemo(()=>ut*Se+L,[ut,L]),ae.useEffect(()=>{Ve.current=Ln},[Ln]),ae.useEffect(()=>{re(!0)},[]),ae.useEffect(()=>{const Ae=pt.current;if(Ae){const dt=Ae.getBoundingClientRect().height;return Jt(dt),S(Bt=>[{toastId:p.id,height:dt,position:p.position},...Bt]),()=>S(Bt=>Bt.filter(tn=>tn.toastId!==p.id))}},[S,p.id]),ae.useLayoutEffect(()=>{if(!Z)return;const Ae=pt.current,dt=Ae.style.height;Ae.style.height="auto";const Bt=Ae.getBoundingClientRect().height;Ae.style.height=dt,Jt(Bt),S(tn=>tn.find(mt=>mt.toastId===p.id)?tn.map(mt=>mt.toastId===p.id?{...mt,height:Bt}:mt):[{toastId:p.id,height:Bt,position:p.position},...tn])},[Z,p.title,p.description,S,p.id,p.jsx,p.action,p.cancel]);const ye=ae.useCallback(()=>{Q(!0),Me(zn.current),S(Ae=>Ae.filter(dt=>dt.toastId!==p.id)),setTimeout(()=>{j(p)},rM)},[p,j,S,zn]);ae.useEffect(()=>{if(p.promise&&yt==="loading"||p.duration===1/0||p.type==="loading")return;let Ae;return D||_||I?(()=>{if(Fs.current<ts.current){const tn=new Date().getTime()-ts.current;Ve.current=Ve.current-tn}
40Fs.current=new Date().getTime()})():Ve.current!==1/0&&(ts.current=new Date().getTime(),Ae=setTimeout(()=>{p.onAutoClose==null||p.onAutoClose.call(p,p),ye()},Ve.current)),()=>clearTimeout(Ae)},[D,_,p,yt,I,ye]),ae.useEffect(()=>{p.delete&&(ye(),p.onDismiss==null||p.onDismiss.call(p,p))},[ye,p.delete]);function Nt(){var Ae;if(ne?.loading){var dt;return ae.createElement("div",{className:gr(P?.loader,p==null||(dt=p.classNames)==null?void 0:dt.loader,"sonner-loader"),"data-visible":yt==="loading"},ne.loading)}return ae.createElement(UD,{className:gr(P?.loader,p==null||(Ae=p.classNames)==null?void 0:Ae.loader),visible:yt==="loading"})}const Tr=p.icon||ne?.[yt]||zD(yt);var Gs,dr;return ae.createElement("li",{tabIndex:0,ref:pt,className:gr(se,Rt,P?.toast,p==null||(t=p.classNames)==null?void 0:t.toast,P?.default,P?.[yt],p==null||(n=p.classNames)==null?void 0:n[yt]),"data-sonner-toast":"","data-rich-colors":(Gs=p.richColors)!=null?Gs:H,"data-styled":!(p.jsx||p.unstyled||b),"data-mounted":Z,"data-promise":!!p.promise,"data-swiped":xe,"data-removed":Y,"data-visible":ur,"data-y-position":Pn,"data-x-position":$t,"data-index":x,"data-front":en,"data-swiping":ve,"data-dismissible":St,"data-type":yt,"data-invert":Ee,"data-swipe-out":Oe,"data-swipe-direction":N,"data-expanded":!!(D||Le&&Z),"data-testid":p.testId,style:{"--index":x,"--toasts-before":x,"--z-index":k.length-x,"--offset":`${Y?Ne:zn.current}px`,"--initial-height":Le?"auto":`${Nn}px`,...B,...p.style},onDragEnd:()=>{ie(!1),he(null),Xn.current=null},onPointerDown:Ae=>{Ae.button!==2&&(me||!St||(Zt.current=new Date,Me(zn.current),Ae.target.setPointerCapture(Ae.pointerId),Ae.target.tagName!=="BUTTON"&&(ie(!0),Xn.current={x:Ae.clientX,y:Ae.clientY})))},onPointerUp:()=>{var Ae,dt,Bt;if(Oe||!St)return;Xn.current=null;const tn=Number(((Ae=pt.current)==null?void 0:Ae.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),ns=Number(((dt=pt.current)==null?void 0:dt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),mt=new Date().getTime()-((Bt=Zt.current)==null?void 0:Bt.getTime()),dn=Te==="x"?tn:ns,Vs=Math.abs(dn)/mt;if(Math.abs(dn)>=nM||Vs>.11){Me(zn.current),p.onDismiss==null||p.onDismiss.call(p,p),X(Te==="x"?tn>0?"right":"left":ns>0?"down":"up"),ye(),it(!0);return}else{var fn,hn;(fn=pt.current)==null||fn.style.setProperty("--swipe-amount-x","0px"),(hn=pt.current)==null||hn.style.setProperty("--swipe-amount-y","0px")}we(!1),ie(!1),he(null)},onPointerMove:Ae=>{var dt,Bt,tn;if(!Xn.current||!St||((dt=window.getSelection())==null?void 0:dt.toString().length)>0)return;const mt=Ae.clientY-Xn.current.y,dn=Ae.clientX-Xn.current.x;var Vs;const fn=(Vs=e.swipeDirections)!=null?Vs:sM(Ce);!Te&&(Math.abs(dn)>1||Math.abs(mt)>1)&&he(Math.abs(dn)>Math.abs(mt)?"x":"y");let hn={x:0,y:0};const ja=Jn=>1/(1.5+Math.abs(Jn)/20);if(Te==="y"){if(fn.includes("top")||fn.includes("bottom"))if(fn.includes("top")&&mt<0||fn.includes("bottom")&&mt>0)hn.y=mt;else{const Jn=mt*ja(mt);hn.y=Math.abs(Jn)<Math.abs(mt)?Jn:mt}}else if(Te==="x"&&(fn.includes("left")||fn.includes("right")))if(fn.includes("left")&&dn<0||fn.includes("right")&&dn>0)hn.x=dn;else{const Jn=dn*ja(dn);hn.x=Math.abs(Jn)<Math.abs(dn)?Jn:dn}(Math.abs(hn.x)>0||Math.abs(hn.y)>0)&&we(!0),(Bt=pt.current)==null||Bt.style.setProperty("--swipe-amount-x",`${hn.x}px`),(tn=pt.current)==null||tn.style.setProperty("--swipe-amount-y",`${hn.y}px`)}},Ut&&!p.jsx&&yt!=="loading"?ae.createElement("button",{"aria-label":oe,"data-disabled":me,"data-close-button":!0,onClick:me||!St?()=>{}:()=>{ye(),p.onDismiss==null||p.onDismiss.call(p,p)},className:gr(P?.closeButton,p==null||(a=p.classNames)==null?void 0:a.closeButton)},(dr=ne?.close)!=null?dr:qD):null,(yt||p.icon||p.promise)&&p.icon!==null&&(ne?.[yt]!==null||p.icon)?ae.createElement("div",{"data-icon":"",className:gr(P?.icon,p==null||(o=p.classNames)==null?void 0:o.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||Nt():null,p.type!=="loading"?Tr:null):null,ae.createElement("div",{"data-content":"",className:gr(P?.content,p==null||(l=p.classNames)==null?void 0:l.content)},ae.createElement("div",{"data-title":"",className:gr(P?.title,p==null||(u=p.classNames)==null?void 0:u.title)},p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title),p.description?ae.createElement("div",{"data-description":"",className:gr(le,Be,P?.description,p==null||(h=p.classNames)==null?void 0:h.description)},typeof p.description=="function"?p.description():p.description):null),ae.isValidElement(p.cancel)?p.cancel:p.cancel&&Zc(p.cancel)?ae.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||V,onClick:Ae=>{Zc(p.cancel)&&St&&(p.cancel.onClick==null||p.cancel.onClick.call(p.cancel,Ae),ye())},className:gr(P?.cancelButton,p==null||(d=p.classNames)==null?void 0:d.cancelButton)},p.cancel.label):null,ae.isValidElement(p.action)?p.action:p.action&&Zc(p.action)?ae.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||W,onClick:Ae=>{Zc(p.action)&&(p.action.onClick==null||p.action.onClick.call(p.action,Ae),!Ae.defaultPrevented&&ye())},className:gr(P?.actionButton,p==null||(m=p.classNames)==null?void 0:m.actionButton)},p.action.label):null)};function zb(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function iM(e,t){const n={};return[e,t].forEach((a,o)=>{const l=o===1,u=l?"--mobile-offset":"--offset",h=l?ZD:JD;function d(m){["top","right","bottom","left"].forEach(v=>{n[`${u}-${v}`]=typeof m=="number"?`${m}px`:m})}
40typeof a=="number"||typeof a=="string"?d(a):typeof a=="object"?["top","right","bottom","left"].forEach(m=>{a[m]===void 0?n[`${u}-${m}`]=h:n[`${u}-${m}`]=typeof a[m]=="number"?`${a[m]}px`:a[m]}):d(h)}),n}const oM=ae.forwardRef(function(t,n){const{id:a,invert:o,position:l="bottom-right",hotkey:u=["altKey","KeyT"],expand:h,closeButton:d,className:m,offset:v,mobileOffset:p,theme:b="light",richColors:_,duration:S,style:R,visibleToasts:E=XD,toastOptions:x,dir:k=zb(),gap:D=tM,icons:j,containerAriaLabel:H="Notifications"}=t,[U,B]=ae.useState([]),V=ae.useMemo(()=>a?U.filter(Z=>Z.toasterId===a):U.filter(Z=>!Z.toasterId),[U,a]),W=ae.useMemo(()=>Array.from(new Set([l].concat(V.filter(Z=>Z.position).map(Z=>Z.position)))),[V,l]),[se,le]=ae.useState([]),[ue,Ce]=ae.useState(!1),[Se,Le]=ae.useState(!1),[P,ne]=ae.useState(b!=="system"?b:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),oe=ae.useRef(null),Te=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),he=ae.useRef(null),N=ae.useRef(!1),X=ae.useCallback(Z=>{B(re=>{var Y;return(Y=re.find(Q=>Q.id===Z.id))!=null&&Y.delete||Sn.dismiss(Z.id),re.filter(({id:Q})=>Q!==Z.id)})},[]);return ae.useEffect(()=>Sn.subscribe(Z=>{if(Z.dismiss){requestAnimationFrame(()=>{B(re=>re.map(Y=>Y.id===Z.id?{...Y,delete:!0}:Y))});return}setTimeout(()=>{Xk.flushSync(()=>{B(re=>{const Y=re.findIndex(Q=>Q.id===Z.id);return Y!==-1?[...re.slice(0,Y),{...re[Y],...Z},...re.slice(Y+1)]:[Z,...re]})})})}),[U]),ae.useEffect(()=>{if(b!=="system"){ne(b);return}if(b==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?ne("dark"):ne("light")),typeof window>"u")return;const Z=window.matchMedia("(prefers-color-scheme: dark)");try{Z.addEventListener("change",({matches:re})=>{ne(re?"dark":"light")})}catch{Z.addListener(({matches:Y})=>{try{ne(Y?"dark":"light")}catch(Q){console.error(Q)}})}},[b]),ae.useEffect(()=>{U.length<=1&&Ce(!1)},[U]),ae.useEffect(()=>{const Z=re=>{var Y;if(u.every(ie=>re[ie]||re.code===ie)){var ve;Ce(!0),(ve=oe.current)==null||ve.focus()}re.code==="Escape"&&(document.activeElement===oe.current||(Y=oe.current)!=null&&Y.contains(document.activeElement))&&Ce(!1)};return document.addEventListener("keydown",Z),()=>document.removeEventListener("keydown",Z)},[u]),ae.useEffect(()=>{if(oe.current)return()=>{he.current&&(he.current.focus({preventScroll:!0}),he.current=null,N.current=!1)}},[oe.current]),ae.createElement("section",{ref:n,"aria-label":`${H} ${Te}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},W.map((Z,re)=>{var Y;const[Q,ve]=Z.split("-");return V.length?ae.createElement("ol",{key:Z,dir:k==="auto"?zb():k,tabIndex:-1,ref:oe,className:m,"data-sonner-toaster":!0,"data-sonner-theme":P,"data-y-position":Q,"data-x-position":ve,style:{"--front-toast-height":`${((Y=se[0])==null?void 0:Y.height)||0}px`,"--width":`${eM}px`,"--gap":`${D}px`,...R,...iM(v,p)},onBlur:ie=>{N.current&&!ie.currentTarget.contains(ie.relatedTarget)&&(N.current=!1,he.current&&(he.current.focus({preventScroll:!0}),he.current=null))},onFocus:ie=>{ie.target instanceof HTMLElement&&ie.target.dataset.dismissible==="false"||N.current||(N.current=!0,he.current=ie.relatedTarget)},onMouseEnter:()=>Ce(!0),onMouseMove:()=>Ce(!0),onMouseLeave:()=>{Se||Ce(!1)},onDragEnd:()=>Ce(!1),onPointerDown:ie=>{ie.target instanceof HTMLElement&&ie.target.dataset.dismissible==="false"||Le(!0)},onPointerUp:()=>Le(!1)},V.filter(ie=>!ie.position&&re===0||ie.position===Z).map((ie,Oe)=>{var it,xe;return ae.createElement(aM,{key:ie.id,icons:j,index:Oe,toast:ie,defaultRichColors:_,duration:(it=x?.duration)!=null?it:S,className:x?.className,descriptionClassName:x?.descriptionClassName,invert:o,visibleToasts:E,closeButton:(xe=x?.closeButton)!=null?xe:d,interacting:Se,position:Z,style:x?.style,unstyled:x?.unstyled,classNames:x?.classNames,cancelButtonStyle:x?.cancelButtonStyle,actionButtonStyle:x?.actionButtonStyle,closeButtonAriaLabel:x?.closeButtonAriaLabel,removeToast:X,toasts:V.filter(we=>we.position==ie.position),heights:se.filter(we=>we.position==ie.position),setHeights:le,expandByDefault:h,gap:D,expanded:ue,swipeDirections:t.swipeDirections})})):null}))});function lM(){return y.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background px-4",children:y.jsxs("div",{className:"max-w-md text-center",children:[y.jsx("h1",{className:"text-7xl font-bold text-foreground",children:"404"}),y.jsx("h2",{className:"mt-4 text-xl font-semibold text-foreground",children:"Page not found"}),y.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"The page you're looking for doesn't exist or has been moved."}),y.jsx("div",{className:"mt-6",children:y.jsx(Hp,{to:"/",className:"inline-flex items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90",children:"Go home"})})]})})}function cM({error:e,reset:t}){console.error(e);const n=Gt();return O.useEffect(()=>{AD(e,{boundary:"tanstack_root_error_component"})},[e]),y.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background px-4",children:y.jsxs("div",{className:"max-w-md text-center",children:[y.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground",children:"This page didn't load"}),y.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Something went wrong on our end. You can try refreshing or head back home."}),y.jsxs("div",{className:"mt-6 flex flex-wrap justify-center gap-2",children:[y.jsx("button",{onClick:()=>{n.invalidate(),t()},className:"inline-flex items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90",children:"Try again"}),y.jsx("a",{href:"/",className:"inline-flex items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:bg-accent",children:"Go home"})]})]})})}const Tn=cC()({head:()=>({meta:[{charSet:"utf-8"},{name:"viewport",content:"width=device-width, initial-scale=1"},{property:"og:type",content:"website"},{property:"og:site_name",content:"Mob Website"},{name:"twitter:card",content:"summary_large_image"}],scripts:[{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@graph":[{"@type":"Organization",name:"Mob Website",url:"https://apexmob.life",logo:`https://apexmob.life${RS.url}`},{"@type":"WebSite",name:"Mob Website Agent Portal",url:"https://apexmob.life"}]})}],links:[{rel:"stylesheet",href:RD},{rel:"icon",type:"image/png",href:"/favicon.png"},{rel:"apple-touch-icon",href:"/apple-touch-icon.png"},{rel:"manifest",href:"/manifest.webmanifest"}
40,{rel:"preconnect",href:"https://fonts.googleapis.com"},{rel:"preconnect",href:"https://fonts.gstatic.com",crossOrigin:"anonymous"},{rel:"stylesheet",href:"https://fonts.googleapis.com/css2?family=Cinzel:wght@500;600;700&family=Lato:wght@400;500;700&display=swap"}]}),shellComponent:uM,component:dM,notFoundComponent:lM,errorComponent:cM});function uM({children:e}){return y.jsxs("html",{lang:"en","data-theme":"dark",children:[y.jsxs("head",{children:[y.jsx(jC,{}),y.jsx("script",{dangerouslySetInnerHTML:{__html:MD}})]}),y.jsxs("body",{children:[e,y.jsx(DC,{})]})]})}function dM(){const{queryClient:e}=Tn.useRouteContext();return y.jsx(ED,{client:e,children:y.jsx(ND,{children:y.jsxs(DD,{children:[y.jsx(CD,{}),y.jsx(Gw,{}),y.jsx(oM,{position:"top-right",richColors:!0,closeButton:!0})]})})})}const fM=()=>tt(()=>import("./vision-board-D03YaSUI.js"),__vite__mapDeps([0,1])),hM=ct("/vision-board")({head:()=>({meta:[{title:"Team Vision Board — Apex Mob"},{name:"description",content:"Quarterly commitments, goals and vision for every direct report on your Apex Mob team."},{property:"og:title",content:"Team Vision Board — Apex Mob"},{property:"og:description",content:"Quarterly commitments, goals and vision for every direct report."},{property:"og:type",content:"website"},{name:"twitter:card",content:"summary"},{name:"robots",content:"noindex"}]}),component:st(fM,"component")}),pM=()=>tt(()=>import("./team-progress-I1WOgsPJ.js"),__vite__mapDeps([2,3,4])),mM=ct("/team-progress")({head:()=>({meta:[{title:"My Team · Onboarding · Mob Website"},{name:"robots",content:"noindex"}]}),component:st(pM,"component")}),gM=()=>tt(()=>import("./reset-password-Bnze0Oll.js"),__vite__mapDeps([5,6])),yM=ct("/reset-password")({head:()=>({meta:[{title:"Reset Password · Mob Website"},{name:"robots",content:"noindex"}]}),component:st(gM,"component")}),vM=()=>tt(()=>import("./org-chart-CF54tUDW.js"),__vite__mapDeps([7,8,1,3,4])),bM=ct("/org-chart")({head:()=>({meta:[{title:"Org Chart — Apex Mob"},{name:"description",content:"Admin-only organizational chart and roster for the Apex Mob team."},{property:"og:title",content:"Org Chart — Apex Mob"},{property:"og:description",content:"Admin-only organizational chart and roster."},{property:"og:type",content:"website"},{name:"twitter:card",content:"summary"},{name:"robots",content:"noindex"}]}),component:st(vM,"component")}),_M=()=>tt(()=>import("./onboarding-C6NDZiT2.js"),[]),wM=ct("/onboarding")({component:st(_M,"component")}),SM=Sr({method:"GET"}).handler(qs("a39764eb09f7173c4be23323158829fd0e52bae1f8c9bf3d7bf7898ba77f8486"));function xM(e,t){return{queryKey:["public-leaderboard",e??null,t??null],queryFn:()=>SM({data:{year:e,month:t}}),refetchInterval:3e4,staleTime:15e3}}function Y3({children:e}){return y.jsx("div",{style:{minHeight:"100vh",background:"radial-gradient(120% 90% at 50% 0%, #1b1e24 0%, #121418 60%, #0d0f12 100%)",display:"flex",alignItems:"center",justifyContent:"center",padding:"48px 16px"},children:y.jsx("div",{style:{width:"100%",maxWidth:560},children:e})})}const TM=()=>tt(()=>import("./leaderboard-DqYxPZ9J.js"),[]),EM=()=>tt(()=>import("./leaderboard-BPNYWltE.js"),[]),RM=()=>tt(()=>import("./leaderboard-BQIIqEGu.js"),[]),AM=ct("/leaderboard")({validateSearch:e=>({y:e.y?Number(e.y):void 0,m:e.m?Number(e.m):void 0}),loaderDeps:({search:{y:e,m:t}})=>({y:e,m:t}),loader:({context:e,deps:t})=>e.queryClient.ensureQueryData(xM(t.y,t.m)),head:()=>({meta:[{title:"Live Leaderboard · Apex MOB"},{name:"description",content:"Live Apex MOB monthly production leaderboard — ALP totals, deal counts and rankings, updated in real time and browsable month by month."},{property:"og:title",content:"Live Leaderboard · Apex MOB"},{property:"og:description",content:"Track Apex MOB agent production live — monthly ALP leaderboard with month-by-month history."},{property:"og:type",content:"website"},{name:"twitter:card",content:"summary_large_image"}]}),component:st(RM,"component"),errorComponent:st(EM,"errorComponent"),notFoundComponent:st(TM,"notFoundComponent")}),kM=()=>tt(()=>import("./hierarchy-audit-Dn96y_C7.js"),__vite__mapDeps([9,1])),CM=ct("/hierarchy-audit")({head:()=>({meta:[{title:"Hierarchy Audit · Mob Website"},{name:"robots",content:"noindex"}
40]}),component:st(kM,"component")});function eu({label:e,children:t}){return y.jsxs("label",{style:{display:"grid",gap:4},children:[y.jsx("span",{style:{...OS,fontSize:10,letterSpacing:"0.2em",textTransform:"uppercase"},children:e}),t]})}const OM={background:"var(--ax-card)",border:"1px solid var(--ax-line)",padding:14,borderRadius:2},OS={color:"var(--ax-muted)",fontSize:12},jM={background:"linear-gradient(135deg,var(--ax-gold-text),var(--ax-gold))",color:"#000",padding:"10px 18px",border:"none",fontFamily:"'Cinzel',serif",letterSpacing:"0.2em",fontSize:11,textTransform:"uppercase",fontWeight:700,cursor:"pointer",borderRadius:2},tu={...jM,padding:"6px 12px",fontSize:10},Bo={padding:"8px 10px",background:"var(--ax-page)",border:"1px solid rgba(217,173,92,0.3)",color:"var(--ax-text)",borderRadius:2,fontSize:13};function K3({lb:e,roster:t,managers:n,onDone:a}){const[o,l]=O.useState(""),[u,h]=O.useState(!1),[d,m]=O.useState("link"),v=e.canonical_name??e.display_name??"(unnamed)",[p,b]=O.useState(v),[_,S]=O.useState("Agent"),[R,E]=O.useState(""),[x,k]=O.useState("");async function D(){if(!o)return;h(!0);const{error:U}=await Re.from("lb_agents").update({hierarchy_agent_id:o}).eq("id",e.id);h(!1),a(U?`❌ ${U.message}`:`✅ Linked "${v}" to roster.`)}async function j(){if(!p.trim()){a("❌ Name is required.");return}if(!x.trim()&&_!=="MGA"&&_!=="SGA"&&_!=="RGA"){a("❌ Please pick a GA (or set a manager role).");return}h(!0);const U=p.trim().split(/\s+/)[0]??null,B=p.trim().split(/\s+/).slice(1).join(" ")||null,{data:V,error:W}=await Re.from("agents").insert({name:p.trim(),first_name:U,last_name:B,role:_,sa_name:R.trim()||x.trim()||null,ga_name:x.trim()||null,status:"Active",active:!0}).select("id").single();if(W||!V){h(!1),a(`❌ ${W?.message??"Could not create roster entry."}`);return}const{error:se}=await Re.from("lb_agents").update({hierarchy_agent_id:V.id}).eq("id",e.id);h(!1),a(se?`❌ Created but link failed: ${se.message}`:`✅ Added "${p}" to roster and linked.`)}async function H(){if(!confirm(`Mark "${v}" inactive on the leaderboard? (No roster match)`))return;h(!0);const{error:U}=await Re.from("lb_agents").update({active:!1}).eq("id",e.id);h(!1),a(U?`❌ ${U.message}`:`✅ "${v}" dismissed.`)}return y.jsxs("div",{style:{...OM,borderColor:"var(--ax-warn)"},children:[y.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12,flexWrap:"wrap",alignItems:"flex-end"},children:[y.jsxs("div",{children:[y.jsx("div",{style:{color:"var(--ax-gold-text)",fontFamily:"'Cinzel',serif",fontSize:"1rem"},children:v}),y.jsxs("div",{style:OS,children:["Leaderboard name with no roster match",e.groupme_user_id?` · GroupMe ${e.groupme_user_id}`:""]})]}),y.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",flexWrap:"wrap"},children:[y.jsx("button",{onClick:()=>m(d==="link"?"create":"link"),style:{...tu,background:"transparent",color:"var(--ax-gold-text)",border:"1px solid rgba(217,173,92,0.5)"},children:d==="link"?"+ Add to Roster":"↩ Link Existing"}),y.jsx("button",{onClick:H,disabled:u,style:{...tu,background:"transparent",color:"var(--ax-danger)",border:"1px solid var(--ax-danger)"},children:"Dismiss"})]})]}),d==="link"?y.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",flexWrap:"wrap",marginTop:10},children:[y.jsxs("select",{value:o,onChange:U=>l(U.target.value),style:{...Bo,minWidth:220},children:[y.jsx("option",{value:"",children:"— pick roster agent —"}),[...t].sort((U,B)=>(U.name??"").localeCompare(B.name??"",void 0,{sensitivity:"base"})).map(U=>y.jsxs("option",{value:U.id,children:[U.name,U.role?` · ${U.role}`:""]},U.id))]}),y.jsx("button",{onClick:D,disabled:u||!o,style:{...tu,opacity:u||!o?.5:1},children:u?"Linking…":"Link"})]}):y.jsxs("div",{style:{marginTop:10,display:"grid",gap:8},children:[y.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit,minmax(160px,1fr))",gap:8},children:[y.jsx(eu,{label:"Name",children:y.jsx("input",{value:p,onChange:U=>b(U.target.value),style:Bo})}),y.jsx(eu,{label:"Role",children:y.jsx("select",{value:_,onChange:U=>S(U.target.value),style:Bo,children:["Agent","SA","GA","MGA","SGA"].map(U=>y.jsx("option",{value:U,children:U},U))})}),y.jsxs(eu,{label:"SA (leave blank to roll up under GA)",children:[y.jsx("input",{list:`create-sas-${e.id}`,value:R,onChange:U=>E(U.target.value),style:Bo,placeholder:"SA name"}),y.jsx("datalist",{id:`create-sas-${e.id}`,children:n.sas.map(U=>y.jsx("option",{value:U},U))})]}),y.jsxs(eu,{label:"GA",children:[y.jsx("input",{list:`create-gas-${e.id}`,value:x,onChange:U=>k(U.target.value),style:Bo,placeholder:"GA name"}),y.jsx("datalist",{id:`create-gas-${e.id}`,children:n.gas.map(U=>y.jsx("option",{value:U},U))})]})]}),y.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:y.jsx("button",{onClick:j,disabled:u,style:{...tu,opacity:u?.5:1},children:u?"Adding…":"Add & Link"})})]})]})}const zh=1e3;async function DM(e,t=2e4){const n=[];for(let a=0;a<t;a+=zh){let o=Re.rpc("get_deals").order("deal_date",{ascending:!1});
40e&&(o=o.gte("deal_date",e));const{data:l,error:u}=await o.range(a,a+zh-1);if(u||!l||(n.push(...l),l.length<zh))break}return n}const MM={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},NM=(e,t,n)=>{let a;const o=MM[e];return typeof o=="string"?a=o:t===1?a=o.one:a=o.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+a:a+" ago":a};function Ph(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const LM={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},zM={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},PM={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},UM={date:Ph({formats:LM,defaultWidth:"full"}),time:Ph({formats:zM,defaultWidth:"full"}),dateTime:Ph({formats:PM,defaultWidth:"full"})},$M={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},BM=(e,t,n,a)=>$M[e];function Io(e){return(t,n)=>{const a=n?.context?String(n.context):"standalone";let o;if(a==="formatting"&&e.formattingValues){const u=e.defaultFormattingWidth||e.defaultWidth,h=n?.width?String(n.width):u;o=e.formattingValues[h]||e.formattingValues[u]}else{const u=e.defaultWidth,h=n?.width?String(n.width):e.defaultWidth;o=e.values[h]||e.values[u]}const l=e.argumentCallback?e.argumentCallback(t):t;return o[l]}}const IM={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},HM={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},qM={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},FM={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},GM={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},VM={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},YM=(e,t)=>{const n=Number(e),a=n%100;if(a>20||a<10)switch(a%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},KM={ordinalNumber:YM,era:Io({values:IM,defaultWidth:"wide"}),quarter:Io({values:HM,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Io({values:qM,defaultWidth:"wide"}),day:Io({values:FM,defaultWidth:"wide"}),dayPeriod:Io({values:GM,defaultWidth:"wide",formattingValues:VM,defaultFormattingWidth:"wide"})};function Ho(e){return(t,n={})=>{const a=n.width,o=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],l=t.match(o);if(!l)return null;const u=l[0],h=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth],d=Array.isArray(h)?QM(h,p=>p.test(u)):WM(h,p=>
40p.test(u));let m;m=e.valueCallback?e.valueCallback(d):d,m=n.valueCallback?n.valueCallback(m):m;const v=t.slice(u.length);return{value:m,rest:v}}}function WM(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function QM(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function XM(e){return(t,n={})=>{const a=t.match(e.matchPattern);if(!a)return null;const o=a[0],l=t.match(e.parsePattern);if(!l)return null;let u=e.valueCallback?e.valueCallback(l[0]):l[0];u=n.valueCallback?n.valueCallback(u):u;const h=t.slice(o.length);return{value:u,rest:h}}}const JM=/^(\d+)(th|st|nd|rd)?/i,ZM=/\d+/i,eN={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},tN={any:[/^b/i,/^(a|c)/i]},nN={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},rN={any:[/1/i,/2/i,/3/i,/4/i]},sN={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},aN={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},iN={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},oN={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},lN={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},cN={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},uN={ordinalNumber:XM({matchPattern:JM,parsePattern:ZM,valueCallback:e=>parseInt(e,10)}),era:Ho({matchPatterns:eN,defaultMatchWidth:"wide",parsePatterns:tN,defaultParseWidth:"any"}),quarter:Ho({matchPatterns:nN,defaultMatchWidth:"wide",parsePatterns:rN,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Ho({matchPatterns:sN,defaultMatchWidth:"wide",parsePatterns:aN,defaultParseWidth:"any"}),day:Ho({matchPatterns:iN,defaultMatchWidth:"wide",parsePatterns:oN,defaultParseWidth:"any"}),dayPeriod:Ho({matchPatterns:lN,defaultMatchWidth:"any",parsePatterns:cN,defaultParseWidth:"any"})},dN={code:"en-US",formatDistance:NM,formatLong:UM,formatRelative:BM,localize:KM,match:uN,options:{weekStartsOn:0,firstWeekContainsDate:1}};let fN={};function El(){return fN}const jS=6048e5,hN=864e5,Pb=Symbol.for("constructDateFrom");function $s(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&Pb in e?e[Pb](t):e instanceof Date?new e.constructor(t):new Date(t)}function cr(e,t){return $s(t||e,e)}function Ub(e){const t=cr(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function pN(e,...t){const n=$s.bind(null,t.find(a=>typeof a=="object"));return t.map(n)}function $b(e,t){const n=cr(e,t?.in);return n.setHours(0,0,0,0),n}function mN(e,t,n){const[a,o]=pN(n?.in,e,t),l=$b(a),u=$b(o),h=+l-Ub(l),d=+u-Ub(u);return Math.round((h-d)/hN)}function gN(e,t){const n=cr(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function yN(e,t){const n=cr(e,t?.in);return mN(n,gN(n))+1}function vl(e,t){const n=El(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,o=cr(e,t?.in),l=o.getDay(),u=(l<a?7:0)+l-a;return o.setDate(o.getDate()-u),o.setHours(0,0,0,0),o}function Du(e,t){return vl(e,{...t,weekStartsOn:1})}function DS(e,t){const n=cr(e,t?.in),a=n.getFullYear(),o=$s(n,0);o.setFullYear(a+1,0,4),o.setHours(0,0,0,0);const l=Du(o),u=$s(n,0);u.setFullYear(a,0,4),u.setHours(0,0,0,0);const h=Du(u);return n.getTime()>=l.getTime()?a+1:n.getTime()>=h.getTime()?a:a-1}function vN(e,t){const n=DS(e,t),a=$s(e,0);return a.setFullYear(n,0,4),a.setHours(0,0,0,0),Du(a)}function bN(e,t){const n=cr(e,t?.in),a=+Du(n)-+vN(n);return Math.round(a/jS)+1}function MS(e,t){const n=cr(e,t?.in),a=n.getFullYear(),o=El(),l=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,u=$s(t?.in||e,0);u.setFullYear(a+1,0,l),u.setHours(0,0,0,0);const h=vl(u,t),d=$s(t?.in||e,0);d.setFullYear(a,0,l),d.setHours(0,0,0,0);const m=vl(d,t);return+n>=+h?a+1:+n>=+m?a:a-1}function _N(e,t){const n=El(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,o=MS(e,t),l=$s(t?.in||e,0);return l.setFullYear(o,0,a),l.setHours(0,0,0,0),vl(l,t)}function wN(e,t){const n=cr(e,t?.in),a=+vl(n,t)-+_N(n,t);return Math.round(a/jS)+1}function Xe(e,t){const n=e<0?"-":"",a=Math.abs(e).toString().padStart(t,"0");return n+a}const As={y(e,t){const n=e.getFullYear(),a=n>0?n:1-n;return Xe(t==="yy"?a%100:a,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):Xe(n+1,2)},d(e,t){return Xe(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return n==="am"?"a.m.":"p.m."}},h(e,t){return Xe(e.getHours()%12||12,t.length)},H(e,t){return Xe(e.getHours(),t.length)},m(e,t){return Xe(e.getMinutes(),t.length)},s(e,t){return Xe(e.getSeconds(),t.length)},S(e,t){const n=t.length,a=e.getMilliseconds(),o=Math.trunc(a*Math.pow(10,n-3));return Xe(o,t.length)}},wi={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Bb={G:function(e,t,n){const a=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(a,{width:"abbreviated"});case"GGGGG":return n.era(a,{width:"narrow"});default:return n.era(a,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const a=e.getFullYear(),o=a>0?a:1-a;return n.ordinalNumber(o,{unit:"year"})}return As.y(e,t)},Y:function(e,t,n,a){const o=MS(e,a),l=o>0?o:1-o;if(t==="YY"){const u=l%100;return Xe(u,2)}return t==="Yo"?n.ordinalNumber(l,{unit:"year"}):Xe(l,t.length)},R:function(e,t){const n=DS(e);return Xe(n,t.length)},u:function(e,t){const n=e.getFullYear();return Xe(n,t.length)},Q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(a);case"QQ":return Xe(a,2);case"Qo":return n.ordinalNumber(a,{unit:"quarter"});case"QQQ":return n.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(a,{width:"narrow",context:"formatting"});default:return n.quarter(a,{width:"wide",context:"formatting"})}},q:function(e,t,n){const a=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(a);case"qq":return Xe(a,2);case"qo":return n.ordinalNumber(a,{unit:"quarter"});case"qqq":return n.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(a,{width:"narrow",context:"standalone"});default:return n.quarter(a,{width:"wide",context:"standalone"})}},M:function(e,t,n){const a=e.getMonth();switch(t){case"M":case"MM":return As.M(e,t);case"Mo":return n.ordinalNumber(a+1,{unit:"month"});case"MMM":return n.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(a,{width:"narrow",context:"formatting"});default:return n.month(a,{width:"wide",context:"formatting"})}},L:function(e,t,n){const a=e.getMonth();switch(t){case"L":return String(a+1);case"LL":return Xe(a+1,2);case"Lo":return n.ordinalNumber(a+1,{unit:"month"});case"LLL":return n.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(a,{width:"narrow",context:"standalone"});default:return n.month(a,{width:"wide",context:"standalone"})}},w:function(e,t,n,a){const o=wN(e,a);return t==="wo"?n.ordinalNumber(o,{unit:"week"}):Xe(o,t.length)},I:function(e,t,n){const a=bN(e);return t==="Io"?n.ordinalNumber(a,{unit:"week"}):Xe(a,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):As.d(e,t)},D:function(e,t,n){const a=yN(e);return t==="Do"?n.ordinalNumber(a,{unit:"dayOfYear"}):Xe(a,t.length)},E:function(e,t,n){const a=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},e:function(e,t,n,a){const o=e.getDay(),l=(o-a.weekStartsOn+8)%7||7;switch(t){case"e":return String(l);case"ee":return Xe(l,2);case"eo":return n.ordinalNumber(l,{unit:"day"});case"eee":return n.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(o,{width:"short",context:"formatting"});default:return n.day(o,{width:"wide",context:"formatting"})}},c:function(e,t,n,a){const o=e.getDay(),l=(o-a.weekStartsOn+8)%7||7;switch(t){case"c":return String(l);case"cc":return Xe(l,t.length);case"co":return n.ordinalNumber(l,{unit:"day"});case"ccc":return n.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(o,{width:"narrow",context:"standalone"});case"cccccc":return n.day(o,{width:"short",context:"standalone"});default:return n.day(o,{width:"wide",context:"standalone"})}},i:function(e,t,n){const a=e.getDay(),o=a===0?7:a;switch(t){case"i":return String(o);case"ii":return Xe(o,t.length);case"io":return n.ordinalNumber(o,{unit:"day"});case"iii":return n.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},a:function(e,t,n){const o=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(o,{width:"narrow",context:"formatting"});default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(e,t,n){const a=e.getHours();let o;switch(a===12?o=wi.noon:a===0?o=wi.midnight:o=a/12>
40=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(o,{width:"narrow",context:"formatting"});default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(e,t,n){const a=e.getHours();let o;switch(a>=17?o=wi.evening:a>=12?o=wi.afternoon:a>=4?o=wi.morning:o=wi.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(o,{width:"narrow",context:"formatting"});default:return n.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let a=e.getHours()%12;return a===0&&(a=12),n.ordinalNumber(a,{unit:"hour"})}return As.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):As.H(e,t)},K:function(e,t,n){const a=e.getHours()%12;return t==="Ko"?n.ordinalNumber(a,{unit:"hour"}):Xe(a,t.length)},k:function(e,t,n){let a=e.getHours();return a===0&&(a=24),t==="ko"?n.ordinalNumber(a,{unit:"hour"}):Xe(a,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):As.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):As.s(e,t)},S:function(e,t){return As.S(e,t)},X:function(e,t,n){const a=e.getTimezoneOffset();if(a===0)return"Z";switch(t){case"X":return Hb(a);case"XXXX":case"XX":return ga(a);default:return ga(a,":")}},x:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"x":return Hb(a);case"xxxx":case"xx":return ga(a);default:return ga(a,":")}},O:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Ib(a,":");default:return"GMT"+ga(a,":")}},z:function(e,t,n){const a=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Ib(a,":");default:return"GMT"+ga(a,":")}},t:function(e,t,n){const a=Math.trunc(+e/1e3);return Xe(a,t.length)},T:function(e,t,n){return Xe(+e,t.length)}};function Ib(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),o=Math.trunc(a/60),l=a%60;return l===0?n+String(o):n+String(o)+t+Xe(l,2)}function Hb(e,t){return e%60===0?(e>0?"-":"+")+Xe(Math.abs(e)/60,2):ga(e,t)}function ga(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),o=Xe(Math.trunc(a/60),2),l=Xe(a%60,2);return n+o+t+l}const qb=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},NS=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},SN=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],a=n[1],o=n[2];if(!o)return qb(e,t);let l;switch(a){case"P":l=t.dateTime({width:"short"});break;case"PP":l=t.dateTime({width:"medium"});break;case"PPP":l=t.dateTime({width:"long"});break;default:l=t.dateTime({width:"full"});break}return l.replace("{{date}}",qb(a,t)).replace("{{time}}",NS(o,t))},xN={p:NS,P:SN},TN=/^D+$/,EN=/^Y+$/,RN=["D","DD","YY","YYYY"];function AN(e){return TN.test(e)}function kN(e){return EN.test(e)}function CN(e,t,n){const a=ON(e,t,n);if(console.warn(a),RN.includes(e))throw new RangeError(a)}function ON(e,t,n){const a=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${a} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}function jN(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function DN(e){return!(!jN(e)&&typeof e!="number"||isNaN(+cr(e)))}const MN=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,NN=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,LN=/^'([^]*?)'?$/,zN=/''/g,PN=/[a-zA-Z]/;function UN(e,t,n){const a=El(),o=n?.locale??a.locale??dN,l=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,u=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,h=cr(e,n?.in);if(!DN(h))throw new RangeError("Invalid time value");let d=t.match(NN).map(v=>{const p=v[0];if(p==="p"||p==="P"){const b=xN[p];return b(v,o.formatLong)}return v}).join("").match(MN).map(v=>{if(v==="''")return{isToken:!1,value:"'"};const p=v[0];if(p==="'")return{isToken:!1,value:$N(v)};if(Bb[p])return{isToken:!0,value:v};
40if(p.match(PN))throw new RangeError("Format string contains an unescaped latin alphabet character `"+p+"`");return{isToken:!1,value:v}});o.localize.preprocessor&&(d=o.localize.preprocessor(h,d));const m={firstWeekContainsDate:l,weekStartsOn:u,locale:o};return d.map(v=>{if(!v.isToken)return v.value;const p=v.value;(!n?.useAdditionalWeekYearTokens&&kN(p)||!n?.useAdditionalDayOfYearTokens&&AN(p))&&CN(p,t,String(e));const b=Bb[p[0]];return b(h,p,o.localize,m)}).join("")}function $N(e){const t=e.match(LN);return t?t[1].replace(zN,"'"):e}function BN(){return Object.assign({},El())}function Fb(e,t,n){const a=BN(),o=qN(e,n.timeZone,n.locale??a.locale);return"formatToParts"in o?IN(o,t):HN(o,t)}function IN(e,t){const n=e.formatToParts(t);for(let a=n.length-1;a>=0;--a)if(n[a].type==="timeZoneName")return n[a].value}function HN(e,t){const n=e.format(t).replace(/\u200E/g,""),a=/ [\w-+ ]+$/.exec(n);return a?a[0].substr(1):""}function qN(e,t,n){return new Intl.DateTimeFormat(n?[n.code,"en-US"]:void 0,{timeZone:t,timeZoneName:e})}function FN(e,t){const n=WN(t);return"formatToParts"in n?VN(n,e):YN(n,e)}const GN={year:0,month:1,day:2,hour:3,minute:4,second:5};function VN(e,t){try{const n=e.formatToParts(t),a=[];for(let o=0;o<n.length;o++){const l=GN[n[o].type];l!==void 0&&(a[l]=parseInt(n[o].value,10))}return a}catch(n){if(n instanceof RangeError)return[NaN];throw n}}function YN(e,t){const n=e.format(t),a=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(n);return[parseInt(a[3],10),parseInt(a[1],10),parseInt(a[2],10),parseInt(a[4],10),parseInt(a[5],10),parseInt(a[6],10)]}const Uh={},Gb=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),KN=Gb==="06/25/2014, 00:00:00"||Gb==="‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00";function WN(e){return Uh[e]||(Uh[e]=KN?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),Uh[e]}function LS(e,t,n,a,o,l,u){const h=new Date(0);return h.setUTCFullYear(e,t,n),h.setUTCHours(a,o,l,u),h}const Vb=36e5,QN=6e4,$h={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function Vp(e,t,n){if(!e)return 0;let a=$h.timezoneZ.exec(e);if(a)return 0;let o,l;if(a=$h.timezoneHH.exec(e),a)return o=parseInt(a[1],10),Yb(o)?-(o*Vb):NaN;if(a=$h.timezoneHHMM.exec(e),a){o=parseInt(a[2],10);const u=parseInt(a[3],10);return Yb(o,u)?(l=Math.abs(o)*Vb+u*QN,a[1]==="+"?-l:l):NaN}if(ZN(e)){t=new Date(t||Date.now());const u=n?t:XN(t),h=Ep(u,e);return-(n?h:JN(t,h,e))}return NaN}function XN(e){return LS(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}function Ep(e,t){const n=FN(e,t),a=LS(n[0],n[1]-1,n[2],n[3]%24,n[4],n[5],0).getTime();let o=e.getTime();const l=o%1e3;return o-=l>=0?l:1e3+l,a-o}function JN(e,t,n){let o=e.getTime()-t;const l=Ep(new Date(o),n);if(t===l)return t;o-=l-t;const u=Ep(new Date(o),n);return l===u?l:Math.max(l,u)}function Yb(e,t){return-23<=e&&e<=23&&(t==null||0<=t&&t<=59)}const Kb={};function ZN(e){if(Kb[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),Kb[e]=!0,!0}catch{return!1}}const eL=60*1e3,tL={X:function(e,t,n){const a=Bh(n.timeZone,e);if(a===0)return"Z";switch(t){case"X":return Wb(a);case"XXXX":case"XX":return Ci(a);default:return Ci(a,":")}},x:function(e,t,n){const a=Bh(n.timeZone,e);switch(t){case"x":return Wb(a);case"xxxx":case"xx":return Ci(a);default:return Ci(a,":")}},O:function(e,t,n){const a=Bh(n.timeZone,e);switch(t){case"O":case"OO":case"OOO":return"GMT"+nL(a,":");default:return"GMT"+Ci(a,":")}},z:function(e,t,n){switch(t){case"z":case"zz":case"zzz":return Fb("short",e,n);default:return Fb("long",e,n)}}};function Bh(e,t){const n=e?Vp(e,t,!0)/eL:t?.getTimezoneOffset()??0;if(Number.isNaN(n))throw new RangeError("Invalid time zone specified: "+e);return n}function Mu(e,t){const n=e<0?"-":"";let a=Math.abs(e).toString();for(;a.length<t;
40)a="0"+a;return n+a}function Ci(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),o=Mu(Math.floor(a/60),2),l=Mu(Math.floor(a%60),2);return n+o+t+l}function Wb(e,t){return e%60===0?(e>0?"-":"+")+Mu(Math.abs(e)/60,2):Ci(e,t)}function nL(e,t=""){const n=e>0?"-":"+",a=Math.abs(e),o=Math.floor(a/60),l=a%60;return l===0?n+String(o):n+String(o)+t+Mu(l,2)}function Qb(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}const rL=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,Ih=36e5,Xb=6e4,sL=2,ln={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:rL};function zS(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(e===null)return new Date(NaN);const n=t.additionalDigits==null?sL:Number(t.additionalDigits);if(n!==2&&n!==1&&n!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]")return new Date(e.getTime());if(typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]")return new Date(e);if(Object.prototype.toString.call(e)!=="[object String]")return new Date(NaN);const a=aL(e),{year:o,restDateString:l}=iL(a.date,n),u=oL(l,o);if(u===null||isNaN(u.getTime()))return new Date(NaN);if(u){const h=u.getTime();let d=0,m;if(a.time&&(d=lL(a.time),d===null||isNaN(d)))return new Date(NaN);if(a.timeZone||t.timeZone){if(m=Vp(a.timeZone||t.timeZone,new Date(h+d)),isNaN(m))return new Date(NaN)}else m=Qb(new Date(h+d)),m=Qb(new Date(h+d+m));return new Date(h+d+m)}else return new Date(NaN)}function aL(e){const t={};let n=ln.dateTimePattern.exec(e),a;if(n?(t.date=n[1],a=n[3]):(n=ln.datePattern.exec(e),n?(t.date=n[1],a=n[2]):(t.date=null,a=e)),a){const o=ln.timeZone.exec(a);o?(t.time=a.replace(o[1],""),t.timeZone=o[1].trim()):t.time=a}return t}function iL(e,t){if(e){const n=ln.YYY[t],a=ln.YYYYY[t];let o=ln.YYYY.exec(e)||a.exec(e);if(o){const l=o[1];return{year:parseInt(l,10),restDateString:e.slice(l.length)}}if(o=ln.YY.exec(e)||n.exec(e),o){const l=o[1];return{year:parseInt(l,10)*100,restDateString:e.slice(l.length)}}}return{year:null}}function oL(e,t){if(t===null)return null;let n,a,o;if(!e||!e.length)return n=new Date(0),n.setUTCFullYear(t),n;let l=ln.MM.exec(e);if(l)return n=new Date(0),a=parseInt(l[1],10)-1,Zb(t,a)?(n.setUTCFullYear(t,a),n):new Date(NaN);if(l=ln.DDD.exec(e),l){n=new Date(0);const u=parseInt(l[1],10);return dL(t,u)?(n.setUTCFullYear(t,0,u),n):new Date(NaN)}if(l=ln.MMDD.exec(e),l){n=new Date(0),a=parseInt(l[1],10)-1;const u=parseInt(l[2],10);return Zb(t,a,u)?(n.setUTCFullYear(t,a,u),n):new Date(NaN)}if(l=ln.Www.exec(e),l)return o=parseInt(l[1],10)-1,e_(o)?Jb(t,o):new Date(NaN);if(l=ln.WwwD.exec(e),l){o=parseInt(l[1],10)-1;const u=parseInt(l[2],10)-1;return e_(o,u)?Jb(t,o,u):new Date(NaN)}return null}function lL(e){let t,n,a=ln.HH.exec(e);if(a)return t=parseFloat(a[1].replace(",",".")),Hh(t)?t%24*Ih:NaN;if(a=ln.HHMM.exec(e),a)return t=parseInt(a[1],10),n=parseFloat(a[2].replace(",",".")),Hh(t,n)?t%24*Ih+n*Xb:NaN;if(a=ln.HHMMSS.exec(e),a){t=parseInt(a[1],10),n=parseInt(a[2],10);const o=parseFloat(a[3].replace(",","."));return Hh(t,n,o)?t%24*Ih+n*Xb+o*1e3:NaN}return null}function Jb(e,t,n){t=t||0,n=n||0;const a=new Date(0);a.setUTCFullYear(e,0,4);const o=a.getUTCDay()||7,l=t*7+n+1-o;return a.setUTCDate(a.getUTCDate()+l),a}const cL=[31,28,31,30,31,30,31,31,30,31,30,31],uL=[31,29,31,30,31,30,31,31,30,31,30,31];function PS(e){return e%400===0||e%4===0&&e%100!==0}function Zb(e,t,n){if(t<0||t>11)return!1;if(n!=null){if(n<1)return!1;const a=PS(e);if(a&&n>uL[t]||!a&&n>cL[t])return!1}return!0}function dL(e,t){if(t<1)return!1;const n=PS(e);return!(n&&t>366||!n&&t>365)}function e_(e,t){return!(e<0||e>52||t!=null&&(t<0||t>6))}function Hh(e,t,n){return!(e<0||e>=25||t!=null&&(t<0||t>=60)||n!=null&&(n<0||n>=60))}const fL=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function hL(e,t,n={}){t=String(t);const a=t.match(fL);if(a){const o=zS(n.originalDate||e,n);t=a.reduce(function(l,u){if(u[0]==="'")return l;const h=l.indexOf(u),d=l[h-1]==="'",m=l.replace(u,"'"+tL[u[0]](o,u,n)+"'");return d?m.substring(0,h-1)+m.substring(h+1):m},t)}return UN(e,t,n)}function pL(e,t,n){e=zS(e,n);const a=Vp(t,e,!0),o=new Date(e.getTime()-a),l=new Date(0);return l.setFullYear(o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate()),l.setHours(o.getUTCHours(),o.getUTCMinutes(),o.getUTCSeconds(),o.getUTCMilliseconds()),l}function US(e,t,n,a){return a={...a,timeZone:t,originalDate:e},hL(pL(e,t,{timeZone:a.timeZone}),n,a)}
40const $S="America/New_York",or=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],t_=["January","February","March","April","May","June","July","August","September","October","November","December"];function Oa(){const e=US(new Date,$S,"yyyy-MM-dd-EEE"),[t,n,a,o]=e.split("-"),l=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].indexOf(o);return{y:Number(t),m:Number(n),d:Number(a),dow:l}}function Dt(e,t){const n=new Date(e+"T12:00:00Z");return n.setUTCDate(n.getUTCDate()+t),n.toISOString().slice(0,10)}function Nu(){const{y:e,m:t,d:n,dow:a}=Oa(),o=`${e}-${String(t).padStart(2,"0")}-${String(n).padStart(2,"0")}`;return Dt(o,-a)}function mL(){const{y:e,m:t}=Oa();return`${e}-${String(t).padStart(2,"0")}-01`}function Ku(e){const[t,n]=e.split("-").map(Number),a=n===12?{y:t+1,m:1}:{y:t,m:n+1},o=`${a.y}-${String(a.m).padStart(2,"0")}-01`;return Dt(o,-1)}function Yp(e,t){const n=new Date(e+"T12:00:00Z").getTime(),a=new Date(t+"T12:00:00Z").getTime();return Math.round((a-n)/864e5)+1}function gL(e){return US(e,$S,"yyyy-MM-dd")}function BS(){const e=Nu();return Array.from({length:6},(t,n)=>{const a=Dt(e,-n*7),o=Dt(a,6);return{start:a,end:o,label:yL(a,o,n===0),isCurrent:n===0}})}function IS(){const{y:e,m:t}=Oa();return Array.from({length:12},(n,a)=>{let o=t-a,l=e;for(;o<=0;)o+=12,l-=1;const u=`${l}-${String(o).padStart(2,"0")}-01`,h=Ku(u);return{start:u,end:h,label:vL(l,o),isCurrent:a===0}})}function yL(e,t,n){const[a,o,l]=e.split("-").map(Number),[u,h,d]=t.split("-").map(Number),m=a===u,v=Oa().y,p=m?`${or[o-1]} ${l} – ${or[h-1]} ${d}${a!==v?`, ${a}`:""}`:`${or[o-1]} ${l}, ${a} – ${or[h-1]} ${d}, ${u}`;return n?`This Week (${p})`:p}function vL(e,t){const n=Oa().y;return e===n?t_[t-1]:`${t_[t-1]} ${e}`}function bL(e){if(e.mode==="week"){const d=BS().find(m=>m.start===e.start);if(d)return d.label}if(e.mode==="month"){const d=IS().find(m=>m.start===e.start);if(d)return d.label}const[t,n,a]=e.start.split("-").map(Number),[o,l,u]=e.end.split("-").map(Number),h=Oa().y;return t===o?`${or[n-1]} ${a} – ${or[l-1]} ${u}${t!==h?`, ${t}`:""}`:`${or[n-1]} ${a}, ${t} – ${or[l-1]} ${u}, ${o}`}function Oi(e,t){if(!e)return!1;const n=e.length<=10?e:gL(e);return n>=t.start&&n<=t.end}function W3(e){if(e.mode==="day"){const o=Dt(e.start,-1);return{mode:"day",start:o,end:o}}if(e.mode==="week"){const o=Dt(e.start,-7);return{mode:"week",start:o,end:Dt(o,6)}}if(e.mode==="month"){const[o,l]=e.start.split("-").map(Number),u=l===1?o-1:o,h=l===1?12:l-1,d=`${u}-${String(h).padStart(2,"0")}-01`;return{mode:"month",start:d,end:Ku(d)}}const t=Yp(e.start,e.end),n=Dt(e.start,-1);return{mode:"custom",start:Dt(n,-(t-1)),end:n}}function _L(e){const t=Yp(e.start,e.end);return t<=31?"day":t<=180?"week":"month"}function Q3(e){const t=_L(e),n=[];if(t==="day"){let a=e.start;for(;a<=e.end;){const[o,l,u]=a.split("-");n.push({start:a,end:a,label:`${or[Number(l)-1]} ${Number(u)}`}),a=Dt(a,1)}}else if(t==="week"){const[a,o,l]=e.start.split("-").map(Number),u=`${a}-${String(o).padStart(2,"0")}-${String(l).padStart(2,"0")}`,h=new Date(u+"T12:00:00Z").getUTCDay();let d=Dt(u,-h);for(;d<=e.end;){const m=Dt(d,6),[v,p,b]=d.split("-");n.push({start:d<e.start?e.start:d,end:m>e.end?e.end:m,label:`${or[Number(p)-1]} ${Number(b)}`}),d=Dt(d,7)}}else{let[a,o]=e.start.split("-").slice(0,2).map(Number);for(;;){const l=`${a}-${String(o).padStart(2,"0")}-01`;if(l>e.end)break;const u=Ku(l);n.push({start:l<e.start?e.start:l,end:u>e.end?e.end:u,label:or[o-1]}),o+=1,o>12&&(o=1,a+=1)}}return n}function X3(e,t){for(let n=0;n<e.length;n++)if(t>=e[n].start&&t<=e[n].end)return n;return-1}function n_(){const{y:e,m:t,d:n}=Oa();return`${e}-${String(t).padStart(2,"0")}-${String(n).padStart(2,"0")}`}function r_(){const e=Nu();return{mode:"week",start:e,end:Dt(e,6)}}const Us="var(--ax-gold)",Wu="rgba(217,173,92,0.35)",ji={padding:"8px 14px",fontSize:11,letterSpacing:"0.18em",textTransform:"uppercase",fontFamily:"'Cinzel',serif",fontWeight:700,cursor:"pointer",borderRadius:2,background:"transparent",color:Us,border:`1px solid ${Wu}`,minHeight:36},qo={...ji,background:Us,color:"#000",borderColor:Us},s_={padding:"8px 12px",background:"var(--ax-card)",color:Us,border:`1px solid ${Wu}`,borderRadius:2,fontFamily:"'Cinzel',serif",fontSize:12,letterSpacing:"0.1em",minHeight:36,minWidth:220},qh={padding:"8px 12px",background:"var(--ax-card)",color:Us,border:`1px solid ${Wu}`,borderRadius:2,fontFamily:"monospace",fontSize:13,minHeight:36,colorScheme:"dark"};
40function a_({value:e,onChange:t}){const n=O.useMemo(()=>BS(),[]),a=O.useMemo(()=>IS(),[]),[o,l]=O.useState(!1),[u,h]=O.useState(e.start),[d,m]=O.useState(e.end),v=O.useRef(null);O.useEffect(()=>{e.mode==="custom"&&(h(e.start),m(e.end))},[e]),O.useEffect(()=>{if(!o)return;const k=D=>{v.current&&!v.current.contains(D.target)&&l(!1)};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[o]);const p=k=>{t({mode:"day",start:k,end:k}),l(!1)},b=k=>{t({mode:"week",start:k,end:Dt(k,6)}),l(!1)},_=k=>{t({mode:"month",start:k,end:Ku(k)}),l(!1)},S=()=>{u&&d&&u<=d&&(t({mode:"custom",start:u,end:d}),l(!1))},R=()=>{const k=Nu();t({mode:"week",start:k,end:Dt(k,6)}),l(!1)},E=n_(),x=!u||!d||u>d;return y.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:y.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8,position:"relative"},children:[y.jsx("button",{style:e.mode==="day"?qo:ji,onClick:()=>p(n_()),children:"Daily"}),y.jsx("button",{style:e.mode==="week"?qo:ji,onClick:()=>b(Nu()),children:"Weekly"}),y.jsx("button",{style:e.mode==="month"?qo:ji,onClick:()=>_(mL()),children:"Monthly"}),y.jsx("button",{style:e.mode==="custom"?qo:ji,onClick:()=>l(k=>!k),children:"Custom Range"}),e.mode==="day"&&y.jsx("input",{type:"date",value:e.start,max:E,onChange:k=>k.target.value&&p(k.target.value),style:qh}),e.mode==="week"&&y.jsx("select",{style:s_,value:e.start,onChange:k=>b(k.target.value),children:n.map(k=>y.jsx("option",{value:k.start,children:k.label},k.start))}),e.mode==="month"&&y.jsx("select",{style:s_,value:e.start,onChange:k=>_(k.target.value),children:a.map(k=>y.jsx("option",{value:k.start,children:k.label},k.start))}),e.mode==="custom"&&y.jsxs("span",{style:{color:Us,fontFamily:"'Cinzel',serif",fontSize:12,letterSpacing:"0.1em",padding:"8px 10px",border:`1px solid ${Wu}`,borderRadius:2},children:[bL(e)," · ",Yp(e.start,e.end),"d"]}),y.jsx("span",{style:{color:"var(--ax-muted)",fontSize:10,letterSpacing:"0.2em",textTransform:"uppercase",marginLeft:4},children:"All times ET"}),o&&y.jsxs("div",{ref:v,style:{position:"absolute",top:"100%",right:0,marginTop:6,background:"var(--ax-card)",border:`1px solid ${Us}`,borderRadius:4,padding:14,zIndex:50,display:"grid",gap:10,minWidth:280,boxSh
40adow:"0 8px 24px rgba(0,0,0,0.6)"},children:[y.jsx("div",{style:{color:Us,fontSize:11,letterSpacing:"0.2em",textTransform:"uppercase",fontFamily:"'Cinzel',serif"},children:"Custom Range (ET)"}),y.jsxs("label",{style:{display:"grid",gap:4},children:[y.jsx("span",{style:{color:"var(--ax-muted)",fontSize:10,letterSpacing:"0.15em",textTransform:"uppercase"},children:"From"}),y.jsx("input",{type:"date",value:u,max:E,onChange:k=>h(k.target.value),style:qh})]}),y.jsxs("label",{style:{display:"grid",gap:4},children:[y.jsx("span",{style:{color:"var(--ax-muted)",fontSize:10,letterSpacing:"0.15em",textTransform:"uppercase"},children:"To"}),y.jsx("input",{type:"date",value:d,min:u,max:E,onChange:k=>m(k.target.value),style:qh})]}),x&&y.jsx("div",{style:{color:"var(--ax-danger)",fontSize:11},children:"End date must be on or after start date."}),y.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",marginTop:4},children:[y.jsx("button",{onClick:R,style:{...ji,padding:"6px 12px"},children:"Reset"}),y.jsx("button",{onClick:S,disabled:x,style:{...qo,padding:"6px 12px",opacity:x?.5:1,cursor:x?"not-allowed":"pointer"},children:"Apply"})]})]})]})})}const nu=e=>(e??"").trim().toLowerCase();function Lu(e,t){const n=new Set,a=new Set,o=nu(t);if(!o)return n;const l=u=>{if(!a.has(u)){a.add(u);for(const h of e){const d=nu(h.name);!d||d===u||(nu(h.sa_name)===u||nu(h.ga_name)===u)&&(n.has(d)||(n.add(d),l(d)))}}};return l(o),n}const i_="var(--ax-gold)",wL="var(--ax-gold-text)",o_="var(--ax-muted)",SL="rgba(217,173,92,0.25)";function xL(e){if(!e)return[];const t=e.split(/\n\n---\n\n/g),n=[];for(const a of t){const o=a.match(/^\[([^—\-]+)\s*[—-]\s*([^·]+)·\s*([^\]]+)\]\n?([\s\S]*)$/);if(o){const l=o[1].trim();n.push({role:["Agent","SA","GA","Admin","Leadership"].includes(l)?l:"Unknown",author:o[2].trim(),when:o[3].trim(),text:(o[4]??"").trim()})}else n.push({role:"Unknown",author:"",when:"",text:a.trim()})}return n}function Kp({raw:e,agentName:t,emptyText:n}){const a=xL(e);return a.length===0?y.jsx("div",{style:{color:o_,fontSize:12,padding:10},children:n??"No feedback yet."}):y.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:a.map((o,l)=>{const u=o.role==="Agent",h=u?"rgba(217,173,92,0.14)":"var(--ax-card)",d=u?i_:SL,m=u?`${o.author||t||"Agent"} (Agent)`:`${o.author}${o.role!=="Unknown"?` (${o.role})`:""}`;return y.jsx("div",{style:{display:"flex",justifyContent:u?"flex-end":"flex-start"},children:y.jsxs("div",{style:{maxWidth:"85%",background:h,border:`1px solid ${d}`,borderRadius:6,padding:"8px 10px"},children:[y.jsx("div",{style:{color:u?wL:i_,fontSize:10,letterSpacing:"0.12em",textTransform:"uppercase",marginBottom:4,fontFamily:"'Cinzel',serif"},children:m}),y.jsx("div",{style:{color:"var(--ax-body2)",fontSize:13,whiteSpace:"pre-wrap",lineHeight:1.5},children:o.text}),o.when&&y.jsx("div",{style:{color:o_,fontSize:10,marginTop:4},children:o.when})]})},l)})})}const Bi=Ns({type:"function"}),HS=Sr({method:"POST"}).middleware([Bi]).handler(qs("adbcbe69aeec0acbba1e81e0112032f79898d95a155a89a3f7c3b86c5d52a43e")),qS="var(--ax-gold)",bl="#f0d060",Ls="var(--ax-muted)",lr="rgba(217,173,92,0.2)",Wp="var(--ax-card)";function TL({role:e,me:t,agents:n}){const a=e==="admin",o=e==="SA",l=e==="GA",u=e==="Agent",[h,d]=O.useState([]),[m,v]=O.useState([]),[p,b]=O.useState(!0),_=O.useCallback(async()=>{if(b(!0),u){const{data:R,error:E}=await Re.rpc("get_my_kpi_feedback");E&&He.error("Failed to load feedback"),v(R??[])}else{const{data:R,error:E}=await Re.from("kpi_performance_reviews").select("*").order("created_at",{ascending:!1}).limit(500);E&&He.error("Failed to load reviews"),d(R??[])}b(!1)},[u]);O.useEffect(()=>{_()},[_]);const S=O.useMemo(()=>{if(!o||!t)return[];const R=Lu(n,t.name);return n.filter(E=>E.sa_name===t.name||R.has((E.name??"").trim().toLowerCase()))},[n,t,o]);return u?y.jsxs("div",{style:{marginTop:24},children:[y.jsx(l_,{children:"Feedback for You"}),p?y.jsx("div",{style:{color:Ls,padding:16},children:"Loading…"}):m.length===0?y.jsx("div",{style:{color:Ls,padding:16,border:`1px solid ${lr}`,borderRadius:6},children:"No feedback yet."}):y.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:m.map(R=>y.jsx(AL,{row:R,meName:t?.name??null,onReplied:_},R.id))})]}):y.jsxs("div",{style:{marginTop:24},children:[y.jsx(l_,{children:"Performance Reviews"}),o&&t&&y.jsx(EL,{sa:t,team:S,agents:n,onCreated:_}),p?y.jsx("div",{style:{color:Ls,padding:16},children:"Loading…"}):h.length===0?y.jsx("div",{style:{color:Ls,padding:16,border:`1px solid ${lr}`,borderRadius:6},children:"No reviews yet."}):y.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:h.map(R=>
40y.jsx(RL,{review:R,me:t,isAdmin:a,isSA:o,isGA:l,onChanged:_},R.id))})]})}function l_({children:e}){return y.jsx("div",{style:{color:qS,fontFamily:"'Cinzel',serif",fontSize:16,marginBottom:12,letterSpacing:"0.15em",textTransform:"uppercase"},children:e})}function EL({sa:e,team:t,agents:n,onCreated:a}){const[o,l]=O.useState(""),[u,h]=O.useState(""),[d,m]=O.useState(""),[v,p]=O.useState(""),[b,_]=O.useState(!1),S=async()=>{if(!o||!d.trim()){He.error("Pick an agent and write your SA review.");return}_(!0);const R=t.find(j=>j.name===o)??n.find(j=>j.name===o),E=R?.ga_name??e.ga_name??null,x=E?n.find(j=>j.name===E&&(j.role==="GA"||j.role==="MGA")):null,k=new Date().toISOString(),{error:D}=await Re.from("kpi_performance_reviews").insert({agent_id:R?.id??null,agent_name:o,period_label:u||null,sa_agent_id:e.id,sa_name:e.name,sa_notes:d.trim(),sa_submitted_at:k,ga_agent_id:x?.id??null,ga_name:E,agent_feedback:v.trim()||null,agent_feedback_by:v.trim()?e.name:null,agent_feedback_at:v.trim()?k:null,status:"sa_submitted"});if(_(!1),D){He.error(D.message);return}He.success("Review submitted — GA notified"),l(""),h(""),m(""),p(""),a()};return y.jsxs("div",{style:{background:Wp,border:`1px solid ${lr}`,borderRadius:6,padding:14,marginBottom:16},children:[y.jsx("div",{style:{color:bl,fontSize:13,marginBottom:10,fontWeight:600},children:"Write a review on one of your agents"}),y.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10,marginBottom:10},children:[y.jsxs("select",{value:o,onChange:R=>l(R.target.value),style:wr,children:[y.jsx("option",{value:"",children:"Select agent…"}),t.map(R=>y.jsx("option",{value:R.name,children:R.name},R.id))]}),y.jsx("input",{value:u,onChange:R=>h(R.target.value),placeholder:"Period (optional, e.g. Week of 7/6)",style:wr})]}),y.jsx(xa,{children:"SA performance review (private — SA, GA, leadership only)"}),y.jsx("textarea",{value:d,onChange:R=>m(R.target.value),placeholder:"Your internal notes on this agent's performance…",rows:4,style:{...wr,resize:"vertical",width:"100%",marginBottom:12}}),y.jsx(xa,{children:"Feedback for the agent (visible to the agent)"}),y.jsx("textarea",{value:v,onChange:R=>p(R.target.value),placeholder:"Optional — what should the agent hear from you?",rows:3,style:{...wr,resize:"vertical",width:"100%",marginBottom:10}}),y.jsx("button",{onClick:S,disabled:b,style:el,children:b?"Submitting…":"Submit to GA"})]})}function RL({review:e,me:t,isAdmin:n,isSA:a,isGA:o,onChanged:l}){const[u,h]=O.useState(e.ga_notes??""),[d,m]=O.useState(""),[v,p]=O.useState(e.admin_notes??""),[b,_]=O.useState(e.admin_target??"Both"),[S,R]=O.useState(!1),E=t?.name?.toLowerCase()??"",x=a&&E&&e.sa_name&&E===e.sa_name.toLowerCase(),k=o&&E&&e.ga_name&&E===e.ga_name.toLowerCase(),D=k&&!e.ga_submitted_at,j=x||k||n,H=async()=>{if(!u.trim()){He.error("Write your GA review first.");return}R(!0);const W=new Date().toISOString(),se={ga_notes:u.trim(),ga_submitted_at:W,ga_agent_id:t?.id??e.ga_agent_id,status:"ga_submitted"};d.trim()&&(se.agent_feedback=d.trim(),se.agent_feedback_by=t?.name??e.ga_name??"GA",se.agent_feedback_at=W);const{error:le}=await Re.from("kpi_performance_reviews").update(se).eq("id",e.id);if(R(!1),le)return He.error(le.message);He.success("Sent to Spencer & Brandon"),m(""),l()},U=async()=>{if(!d.trim()){He.error("Write feedback first.");return}R(!0);const W=new Date().toISOString(),{error:se}=await Re.from("kpi_performance_reviews").update({agent_feedback:d.trim(),agent_feedback_by:t?.name??"Leader",agent_feedback_at:W}).eq("id",e.id);if(R(!1),se)return He.error(se.message);He.success("Feedback sent to agent"),m(""),l()},B=async()=>{if(!v.trim()){He.error("Write your note first.");return}R(!0);const{error:W}=await Re.from("kpi_performance_reviews").update({admin_notes:v.trim(),admin_target:b,admin_by:t?.name??"Leadership",admin_submitted_at:new Date().toISOString(),status:"admin_replied"}).eq("id",e.id);if(R(!1),W)return He.error(W.message);He.success(`Sent to ${b}`),l()},V=e.status==="admin_replied"?"#7ac97a":e.status==="ga_submitted"?bl:"#c9c890";return y.jsxs("div",{style:{background:Wp,border:`1px solid ${lr}`,borderRadius:6,padding:14},children:[y.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:10,flexWrap:"wrap",gap:6},children:[y.jsxs("div",{children:[y.jsx("span",{style:{color:bl,fontSize:14,fontWeight:600},children:e.agent_name}),e.period_label&&y.jsxs("span",{style:{color:Ls,fontSize:12,marginLeft:8},children:["· ",e.period_label]})]}),y.jsx("div",{style:{color:V,fontSize:10,letterSpacing:"0.15em",textTransform:"uppercase"},children:e.status.replace(/_/g," ")})]}),y.jsx(ru,{label:`SA Review — ${e.sa_name??""} · private`,value:e.sa_notes,when:e.sa_submitted_at}
40),y.jsx(ru,{label:`GA Review — ${e.ga_name??"(no GA)"} · private`,value:e.ga_notes,when:e.ga_submitted_at}),y.jsx(ru,{label:`Feedback to Agent — ${e.agent_feedback_by??""} · visible to ${e.agent_name}`,value:e.agent_feedback,when:e.agent_feedback_at,accent:!0}),e.admin_notes&&y.jsx(ru,{label:`Leadership → ${e.admin_target} — ${e.admin_by??""}`,value:e.admin_notes,when:e.admin_submitted_at}),D&&y.jsxs("div",{style:{marginTop:10,borderTop:`1px dashed ${lr}`,paddingTop:10},children:[y.jsx(xa,{children:"Add your GA review (private)"}),y.jsx("textarea",{value:u,onChange:W=>h(W.target.value),rows:3,placeholder:"Your internal notes on this agent…",style:{...wr,resize:"vertical",width:"100%",marginBottom:10}}),y.jsx(xa,{children:"Feedback for the agent (optional, agent will see this)"}),y.jsx("textarea",{value:d,onChange:W=>m(W.target.value),rows:3,placeholder:"Coaching or feedback the agent should hear…",style:{...wr,resize:"vertical",width:"100%",marginBottom:8}}),y.jsx("button",{onClick:H,disabled:S,style:el,children:S?"Sending…":"Submit to Spencer & Brandon"})]}),!D&&j&&y.jsxs("div",{style:{marginTop:10,borderTop:`1px dashed ${lr}`,paddingTop:10},children:[y.jsx(xa,{children:e.agent_feedback?"Add more feedback for the agent":"Add feedback for the agent"}),y.jsx("textarea",{value:d,onChange:W=>m(W.target.value),rows:3,placeholder:"Feedback the agent should hear…",style:{...wr,resize:"vertical",width:"100%",marginBottom:8}}),y.jsx("button",{onClick:U,disabled:S,style:el,children:S?"Sending…":"Send to Agent"})]}),n&&y.jsxs("div",{style:{marginTop:10,borderTop:`1px dashed ${lr}`,paddingTop:10},children:[y.jsx(xa,{children:"Add a note or question (to SA / GA)"}),y.jsx("textarea",{value:v,onChange:W=>p(W.target.value),rows:3,placeholder:"Question or feedback…",style:{...wr,resize:"vertical",width:"100%",marginBottom:8}}),y.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[y.jsx("label",{style:{color:Ls,fontSize:10,letterSpacing:"0.15em",textTransform:"uppercase"},children:"Send to:"}),y.jsxs("select",{value:b,onChange:W=>_(W.target.value),style:{...wr,minWidth:100},children:[y.jsx("option",{value:"SA",children:"SA"}),y.jsx("option",{value:"GA",children:"GA"}),y.jsx("option",{value:"Both",children:"Both"})]}),y.jsx("button",{onClick:B,disabled:S,style:el,children:S?"Sending…":"Send"})]})]})]})}function ru({label:e,value:t,when:n,accent:a}){return t?y.jsxs("div",{style:{marginBottom:8,padding:a?"8px 10px":0,border:a?`1px solid ${lr}`:"none",borderRadius:a?4:0,background:a?"rgba(217,173,92,0.05)":"transparent"},children:[y.jsxs("div",{style:{color:Ls,fontSize:10,letterSpacing:"0.15em",textTransform:"uppercase",marginBottom:3},children:[e,n&&y.jsx("span",{style:{marginLeft:8,color:"#5a5850"},children:new Date(n).toLocaleString()})]}),y.jsx("div",{style:{color:"var(--ax-body2)",fontSize:13,whiteSpace:"pre-wrap",lineHeight:1.5},children:t})]}):null}function xa({children:e}){return y.jsx("div",{style:{color:bl,fontSize:11,letterSpacing:"0.1em",textTransform:"uppercase",marginBottom:6},children:e})}const wr={background:"var(--ax-card)",color:"var(--ax-text)",border:`1px solid ${lr}`,borderRadius:6,padding:"8px 10px",fontSize:13,fontFamily:"inherit"},el={background:qS,color:"#1a1c20",border:"none",borderRadius:6,padding:"8px 16px",fontSize:12,fontWeight:600,letterSpacing:"0.1em",textTransform:"uppercase",cursor:"pointer"};function AL({row:e,meName:t,onReplied:n}){const[a,o]=O.useState(""),[l,u]=O.useState(!1),h=async()=>{const d=a.trim();if(d){u(!0);try{const m=await HS({data:{reviewId:e.id,reply:d}});if(!m?.ok){He.error(`Reply failed: ${m?.reason??"unknown"}`);return}He.success("Reply sent to your manager"),o(""),n()}catch(m){He.error(m instanceof Error?m.message:"Reply failed")}finally{u(!1)}}};return y.jsxs("div",{style:{background:Wp,border:`1px solid ${lr}`,borderRadius:6,padding:14},children:[y.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",marginBottom:10,flexWrap:"wrap",gap:6},children:[y.jsx("span",{style:{color:bl,fontSize:13,fontWeight:600},children:"Conversation with your leaders"}),y.jsx("span",{style:{color:Ls,fontSize:11},children:e.period_label?e.period_label:e.agent_feedback_at?new Date(e.agent_feedback_at).toLocaleStr
40ing():""})]}),y.jsx(Kp,{raw:e.agent_feedback,agentName:e.agent_name||t||void 0}),y.jsxs("div",{style:{marginTop:12,borderTop:`1px dashed ${lr}`,paddingTop:10},children:[y.jsx(xa,{children:"Reply to your manager"}),y.jsx("textarea",{value:a,onChange:d=>o(d.target.value),rows:3,placeholder:"Write your response…",style:{...wr,resize:"vertical",width:"100%",marginBottom:8}}),y.jsx("button",{onClick:h,disabled:l||!a.trim(),style:{...el,opacity:l||!a.trim()?.6:1},children:l?"Sending…":"Send reply"})]})]})}const kL=Sr({method:"POST"}).middleware([Bi]).handler(qs("9dbb7fb315b7df627c95b17c1b0b17bcf79d334d56369b8029e2d7bd5a449b78")),Rp="var(--ax-gold)",Ap="var(--ax-gold-text)",tl="var(--ax-muted)",nl="rgba(217,173,92,0.25)",CL="var(--ax-card)";function Qp({report:e,agents:t,me:n,role:a}){const o=t.find(xe=>xe.id===e.agent_id)??t.find(xe=>xe.name.toLowerCase()===(e.agent_name??"").toLowerCase())??null,l=o?.sa_name??null,u=o?.ga_name??null,h=l?t.find(xe=>xe.name===l):null,d=u?t.find(xe=>xe.name===u):null,m=a==="admin",v=a==="MGA"||a==="SGA"||a==="RGA",p=n?.name?.toLowerCase()??"",b=(o?.name??e.agent_name??"").toLowerCase(),_=n?.name?Lu(t,n.name):new Set,S=b?_.has(b):!1,R=a==="SA"&&(p&&l&&p===l.toLowerCase()||S),E=a==="GA"&&(p&&u&&p===u.toLowerCase()||S),x=!!(m||v||R),k=!!(m||v||E),D=!!(m||v||R||E),j=`daily:${e.report_date}:${e.id}`,[H,U]=O.useState(null),[B,V]=O.useState(""),[W,se]=O.useState(""),[le,ue]=O.useState(""),[Ce,Se]=O.useState(null),[Le,P]=O.useState(!1),[ne,oe]=O.useState(!1),[Te,he]=O.useState(!1),[N,X]=O.useState(!1),Z=O.useCallback(async()=>{const{data:xe}=await Re.from("kpi_performance_reviews").select("*").eq("period_label",j).maybeSingle(),we=xe??null;U(we),V(we?.sa_notes??""),se(we?.ga_notes??""),ue(""),oe(!we?.sa_notes),he(!we?.ga_notes),X(!we?.agent_feedback),P(!0)},[j]);O.useEffect(()=>{Z()},[Z]);async function re(){if(H)return H;const xe={agent_id:e.agent_id,agent_name:e.agent_name,period_label:j,sa_agent_id:h?.id??null,sa_name:l,ga_agent_id:d?.id??null,ga_name:u,status:"sa_submitted"},{data:we,error:Ne}=await Re.from("kpi_performance_reviews").insert(xe).select("*").single();if(Ne)return He.error(Ne.message),null;const Me=we;return U(Me),Me}async function Y(){if(!x)return;Se("sa");const xe=await re();if(!xe){Se(null);return}const{error:we}=await Re.from("kpi_performance_reviews").update({sa_notes:B.trim()||null,sa_submitted_at:B.trim()?new Date().toISOString():null,sa_agent_id:xe.sa_agent_id??n?.id??null}).eq("id",xe.id);if(Se(null),we)return He.error(we.message);He.success("SA notes saved"),oe(!1),Z()}async function Q(){if(!k)return;Se("ga");const xe=await re();if(!xe){Se(null);return}const{error:we}=await Re.from("kpi_performance_reviews").update({ga_notes:W.trim()||null,ga_submitted_at:W.trim()?new Date().toISOString():null,ga_agent_id:xe.ga_agent_id??n?.id??null}).eq("id",xe.id);if(Se(null),we)return He.error(we.message);He.success("Manager notes saved"),he(!1),Z()}async function ve(){if(!D)return;const xe=le.trim();if(!xe)return;Se("fb");const we=await re();if(!we){Se(null);return}const Ne=n?.name??"Leadership",Me=R?"SA":E?"GA":m?"Admin":"Leadership",Nn=new Date().toLocaleString(),Jt=`[${Me} — ${Ne} · ${Nn}]
41${xe}`,Ve=(we.agent_feedback??"").trim(),Zt=Ve?`${Ve}
42
43---
44
45${Jt}`:Jt,{error:pt}=await Re.from("kpi_performance_reviews").update({agent_feedback:Zt,agent_feedback_by:Ne,agent_feedback_at:new Date().toISOString()}).eq("id",we.id);if(Se(null),pt)return He.error(pt.message);He.success("Feedback sent to agent"),ue(""),X(!1),kL({data:{agentId:e.agent_id,agentName:e.agent_name,reportDate:e.report_date,feedback:xe,fromName:Ne,reviewId:we.id,reportId:e.id}}).catch(()=>{}),Z()}if(!Le)return y.jsx("div",{style:{color:tl,fontSize:12,padding:12},children:"Loading notes…"});const ie=!!H?.sa_notes,Oe=!!H?.ga_notes,it=!!H?.agent_feedback;return y.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, minmax(0, 1fr))",gap:10,marginTop:14},children:[y.jsx(su,{title:"Agent Notes",subtitle:`From ${e.agent_name} · ${e.report_date}`,children:y.jsx("div",{style:{minHeight:90,padding:10,background:"var(--ax-card)",border:`1px dashed ${nl}`,borderRadius:4,color:e.notes?"var(--ax-body2)":tl,fontSize:13,whiteSpace:"pre-wrap",lineHeight:1.5},children:e.notes||"No notes from agent on this submission."})}),y.jsx(su,{title:"SA Notes",subtitle:l?`SA: ${l}`:"No SA assigned",disabled:!x,children:ie&&!ne?y.jsxs(y.Fragment,{children:[y.jsx("div",{style:{minHeight:90,padding:10,background:"var(--ax-card)",border:`1px solid ${nl}`,borderRadius:4,color:"var(--ax-body2)",fontSize:13,whiteSpace:"pre-wrap",lineHeight:1.5},children:H?.sa_notes}),H?.sa_submitted_at&&y.jsx(c_,{when:H.sa_submitted_at,by:H.sa_name}),x&&y.jsx(ha,{onClick:()=>oe(!0),busy:!1,children:"Edit"})]}):y.jsxs(y.Fragment,{children:[y.jsx("textarea",{value:B,onChange:xe=>V(xe.target.value),placeholder:x?"SA — private review notes for this agent's day…":"Only this agent's SA or admin can edit.",rows:4,disabled:!x,style:Fh(!x)}),x&&y.jsxs("div",{style:{display:"flex",gap:6},children:[y.jsx(ha,{onClick:Y,busy:Ce==="sa",children:"Save notes"}),ie&&y.jsx(ha,{onClick:()=>{V(H?.sa_notes??""),oe(!1)},busy:!1,secondary:!0,children:"Cancel"})]})]})}),y.jsx(su,{title:"GA / MGA Notes",subtitle:u?`GA: ${u}`:"No GA assigned",disabled:!k,children:Oe&&!Te?y.jsxs(y.Fragment,{children:[y.jsx("div",{style:{minHeight:90,padding:10,background:"var(--ax-card)",border:`1px solid ${nl}`,borderRadius:4,color:"var(--ax-body2)",fontSize:13,whiteSpace:"pre-wrap",lineHeight:1.5},children:H?.ga_notes}
45),H?.ga_submitted_at&&y.jsx(c_,{when:H.ga_submitted_at,by:H.ga_name}),k&&y.jsx(ha,{onClick:()=>he(!0),busy:!1,children:"Edit"})]}):y.jsxs(y.Fragment,{children:[y.jsx("textarea",{value:W,onChange:xe=>se(xe.target.value),placeholder:k?"Manager — private review notes for this agent's day…":"Only this agent's manager or admin can edit.",rows:4,disabled:!k,style:Fh(!k)}),k&&y.jsxs("div",{style:{display:"flex",gap:6},children:[y.jsx(ha,{onClick:Q,busy:Ce==="ga",children:"Save notes"}),Oe&&y.jsx(ha,{onClick:()=>{se(H?.ga_notes??""),he(!1)},busy:!1,secondary:!0,children:"Cancel"})]})]})}),y.jsxs(su,{title:"Feedback to Agent",subtitle:`Visible to ${e.agent_name}`,disabled:!D,accent:!0,children:[it&&y.jsx("div",{style:{marginBottom:8},children:y.jsx(Kp,{raw:H?.agent_feedback??null,agentName:e.agent_name})}),D?y.jsxs(y.Fragment,{children:[y.jsx("textarea",{value:le,onChange:xe=>ue(xe.target.value),placeholder:it?"Add your reply — previous feedback will be preserved…":"What the agent should hear back on today's numbers…",rows:4,style:Fh(!1)}),y.jsx("div",{style:{display:"flex",gap:6},children:y.jsx(ha,{onClick:ve,busy:Ce==="fb",children:it?"Add reply":"Send to agent"})})]}):!it&&y.jsx("div",{style:{color:tl,fontSize:12,padding:10},children:"Only the agent's SA, GA, or admin can send feedback."})]})]})}function su({title:e,subtitle:t,children:n,disabled:a,accent:o}){return y.jsxs("div",{style:{background:CL,border:`1px solid ${o?Rp:nl}`,borderRadius:6,padding:12,opacity:a?.75:1},children:[y.jsx("div",{style:{color:o?Ap:Rp,fontFamily:"'Cinzel',serif",fontSize:11,letterSpacing:"0.2em",textTransform:"uppercase",marginBottom:2},children:e}),t&&y.jsx("div",{style:{color:tl,fontSize:10,letterSpacing:"0.1em",marginBottom:8},children:t}),n]})}function ha({onClick:e,busy:t,children:n,secondary:a}){return y.jsx("button",{onClick:e,disabled:t,style:{marginTop:8,padding:"6px 14px",background:a?"transparent":Ap,color:a?Ap:"#000",border:a?`1px solid ${Rp}`:"none",borderRadius:2,cursor:t?"wait":"pointer",fontFamily:"'Cinzel',serif",fontSize:10,letterSpacing:"0.2em",textTransform:"uppercase",fontWeight:700,opacity:t?.7:1},children:t?"Saving…":n})}function c_({when:e,by:t}){return y.jsxs("div",{style:{color:tl,fontSize:10,marginTop:6},children:[t?`${t} · `:"",new Date(e).toLocaleString()]})}function Fh(e){return{width:"100%",background:"var(--ax-card)",border:`1px solid ${nl}`,color:"var(--ax-body2)",padding:"8px 10px",borderRadius:4,fontSize:13,lineHeight:1.5,resize:"vertical",fontFamily:"inherit",cursor:e?"not-allowed":"text"}}const Xp={0:{label:"No leads",color:"var(--ax-danger)"},1:{label:"Needs SA approval for leads",color:"var(--ax-warn)"},2:{label:"Gets old leads",color:"var(--ax-warn)"},3:{label:"Left over new leads",color:"#84cc16"},4:{label:"Majority new leads",color:"var(--ax-success)"},5:{label:"Full New Leads (Priority)",color:"#15803d"}},Di="var(--ax-gold)",zs="var(--ax-gold-text)",Dn="var(--ax-muted)",ya="rgba(217,173,92,0.25)",FS="var(--ax-card)",u_=Object.fromEntries(Object.entries(Xp).map(([e,t])=>[Number(e),`${e} — ${t.label}`]));function Gh(e){return e==null?Dn:Xp[e]?.color??Dn}function d_(e){const t=Math.floor(e/3600),n=Math.floor(e%3600/60);return t>0?`${t}h ${n}m`:`${n}m`}function OL({reports:e,agents:t,me:n,role:a,range:o}){const l=O.useMemo(()=>{const h=new Map;for(const d of e){const m=(d.agent_id??d.agent_name).toLowerCase(),v=h.get(m);if(v)v.rows.push(d);else{const p=t.find(b=>b.id===d.agent_id)??t.find(b=>b.name.toLowerCase()===(d.agent_name??"").toLowerCase())??null;h.set(m,{agent:p,agent_name:d.agent_name,agent_id:d.agent_id,rows:[d]})}}return[...h.values()].sort((d,m)=>d.agent_name.localeCompare(m.agent_name))},[e,t]);if(l.length===0)return null;const u=l.length===1;return y.jsxs("div",{style:{marginTop:22,display:"flex",flexDirection:"column",gap:22},children:[y.jsxs("div",{style:{color:zs,fontFamily:"'Cinzel',serif",fontSize:13,letterSpacing:"0.2em",textTransform:"uppercase"},children:["Weekly Review · ",o.start," → ",o.end]}),l.map(h=>y.jsx(jL,{agent:h.agent,agentName:h.agent_name,agentId:h.agent_id,rows:h.rows,agents:t,me:n,role:a,range:o,defaultExpanded:u},h.agent_id??h.agent_name))]})}function jL({agent:e,agentName:t,agentId:n,rows:a,agents:o,me:l,role:u,range:h,defaultExpanded:d}){const m=u==="admin",v=u==="MGA"||u==="SGA"||u==="RGA",p=u==="SA"&&e?.sa_name&&e.sa_name.toLowerCase()===l.name.toLowerCase(),b=u==="GA"&&e?.ga_name&&e.ga_
45name.toLowerCase()===l.name.toLowerCase(),_=!!(m||v||p||b),S=!!(b||v),[R,E]=O.useState({}),[x,k]=O.useState({}),[D,j]=O.useState({}),[H,U]=O.useState({}),[B,V]=O.useState(null),W=`weekly:${h.start}:${n??t.toLowerCase()}`,[se,le]=O.useState(null),[ue,Ce]=O.useState(""),[Se,Le]=O.useState(!1),[P,ne]=O.useState(null),oe=O.useCallback(async()=>{const Q=[...a.map(Ne=>`daily:${Ne.report_date}:${Ne.id}`),W],{data:ve}=await Re.from("kpi_performance_reviews").select("id, agent_id, agent_name, period_label, sa_agent_id, sa_name, sa_notes, ga_agent_id, ga_name, ga_notes, agent_feedback").in("period_label",Q),ie={},Oe={},it={},xe={};let we=null;for(const Ne of ve??[])Ne.period_label===W?we=Ne:Ne.period_label&&(Oe[Ne.period_label]=Ne.sa_notes??"",it[Ne.period_label]=Ne.ga_notes??"",ie[Ne.period_label]=S?Ne.ga_notes??"":Ne.sa_notes??"",xe[Ne.period_label]=Ne.id);if(E(ie),k(Oe),j(it),U(xe),le(we),Ce(S?we?.ga_notes??"":we?.sa_notes??""),n){const{data:Ne}=await Re.from("priority_ranking_items").select("status, priority, sa_notes, ga_override_status, ga_override_priority, ga_override_notes, submission_id, priority_submissions!inner(sa_name, ga_name, submitted_at)").eq("agent_id",n).order("updated_at",{ascending:!1}).limit(1),Me=(Ne??[])[0];ne(Me?{status:Me.status,priority:Me.priority,sa_notes:Me.sa_notes,ga_override_status:Me.ga_override_status,ga_override_priority:Me.ga_override_priority,ga_override_notes:Me.ga_override_notes,sa_name:Me.priority_submissions?.sa_name??null,ga_name:Me.priority_submissions?.ga_name??null,submitted_at:Me.priority_submissions?.submitted_at??""}:null)}},[a,W,n,S]);O.useEffect(()=>{oe()},[oe]);async function Te(){if(!_)return;Le(!0);const Y=ue.trim(),Q=new Date().toISOString(),ve=S?{ga_notes:Y||null,ga_submitted_at:Y?Q:null}:{sa_notes:Y||null,sa_submitted_at:Y?Q:null};if(se){const{error:ie}=await Re.from("kpi_performance_reviews").update(ve).eq("id",se.id);if(Le(!1),ie)return He.error(ie.message)}else{const{error:ie}=await Re.from("kpi_performance_reviews").insert({agent_id:n,agent_name:t,period_label:W,sa_name:e?.sa_name??null,ga_name:e?.ga_name??null,status:"sa_submitted",...ve});if(Le(!1),ie)return He.error(ie.message)}He.success("Weekly performance note saved"),oe()}const he=P?.ga_override_priority??P?.priority??null,N=P?.ga_override_status??P?.status??null,[X,Z]=O.useState(!!d),re=O.useMemo(()=>a.reduce((Y,Q)=>(Y.talk_time_seconds+=Q.talk_time_seconds||0,Y.dials+=Q.dials||0,Y.pickups+=Q.pickups||0,Y.leads+=Q.leads||0,Y.sets+=Q.sets||0,Y.shows+=Q.shows||0,Y.on_spots+=Q.on_spots||0,Y.presentations+=Q.presentations||0,Y.closed_deals+=Q.closed_deals||0,Y.reschedules+=Q.reschedules||0,Y.referrals+=Q.referrals||0,Y.alp+=Number(Q.alp)||0,Y),{talk_time_seconds:0,dials:0,pickups:0,leads:0,sets:0,shows:0,on_spots:0,presentations:0,closed_deals:0,reschedules:0,referrals:0,alp:0}),[a]);return y.jsxs("div",{style:{background:FS,border:`1px solid ${ya}`,borderRadius:8,padding:16},children:[y.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",justifyContent:"space-between",gap:12,marginBottom:12},children:[y.jsxs("div",{children:[y.jsx("div",{style:{color:zs,fontFamily:"'Cinzel',serif",fontSize:16},children:t}),y.jsxs("div",{style:{color:Dn,fontSize:10,letterSpacing:"0.15em",textTransform:"uppercase",marginTop:2},children:[e?.sa_name?`SA · ${e.sa_name}`:"No SA"," "," · "," ",e?.ga_name?`GA · ${e.ga_name}`:"No GA"]})]}),y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,background:"var(--ax-card)",border:`1px solid ${Gh(he)}`,borderRadius:4,padding:"6px 10px"},children:[he!=null&&y.jsx("div",{style:{width:22,height:22,borderRadius:5,background:Gh(he),color:"#000",fontWeight:800,fontSize:12,display:"flex",alignItems:"center",justifyContent:"center"},children:he}),y.jsx("span",{style:{color:Dn,fontSize:9,letterSpacing:"0.2em",textTransform:"uppercase"},children:"Priority"}),y.jsx("span",{style:{color:Gh(he),fontFamily:"'Cinzel',serif",fontSize:13},children:he!=null?Xp[he]?.label??"Unranked":"Unranked"}),N&&y.jsxs("span",{style:{color:Dn,fontSize:10},children:["· ",N]})]})]}),y.jsxs("div",{style:{background:"var(--ax-card)",border:`1px solid ${Di}`,borderRadius:6,padding:12},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:8},children:[y.jsxs("div",{style:{color:zs,fontFamily:"'Cinzel',serif",fontSize:11,letterSpacing:"0.2em",textTransform:"uppercase"},children:["Week Totals · ",a.length," ",a.length===1?"day":"days"]}),y.jsx("button",{onClick:()=>Z(Y=>!Y),style:{background:"transparent",border:`1px solid ${Di}`,color:zs,padding:"4px 12px",borderRadius:3,cursor:"pointer",fontFamily:"'Cinzel',serif",fontSize:9,letterSpacing:"0.2em",textTransform:"uppercase"},children:X?"▲ Hide days":"▼ Show days & notes"})]}),y.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(58px, 1fr))",gap:8,color:"var(--ax-body2)",fontSize:12},children:[y.jsx(Kn,{label:"Talk",value:d_(re.talk_time_seconds)}),y.jsx(Kn,{label:"Dials",value:re.dials}),y.jsx(Kn,{label:"Pickups",value:re.pickups}),y.jsx(Kn,{label:"Leads",value:re.leads}),y.jsx(Kn,{label:"Sets",value:re.sets}),y.jsx(Kn,{label:"Shows",value:re.shows}),y.jsx(Kn,{label:"On Spot",value:re.on_spots}),y.jsx(Kn,{label:"Pres.",value:re.presentations}),y.jsx(Kn,{label:"Closed",value:re.closed_deals}),y.jsx(Kn,{label:"Resch.",value:re.reschedules}),y.jsx(Kn,{label:"Refs",value:re.referrals}
45),y.jsx(Kn,{label:"ALP",value:`$${re.alp.toLocaleString()}`,highlight:!0})]})]}),X&&y.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12,marginTop:12},children:a.slice().sort((Y,Q)=>Y.report_date.localeCompare(Q.report_date)).map((Y,Q,ve)=>{const ie=Q===0?null:ve[Q-1];return y.jsxs("div",{style:{background:"var(--ax-card)",border:`1px solid ${ya}`,borderRadius:6,padding:12},children:[y.jsx("div",{style:{color:Di,fontSize:11,letterSpacing:"0.15em",textTransform:"uppercase",marginBottom:8},children:zL(Y.report_date)}),y.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(58px, 1fr))",gap:8,color:"var(--ax-body2)",fontSize:12,marginBottom:4},children:[y.jsx(Wn,{label:"Talk",value:d_(Y.talk_time_seconds),cur:Y.talk_time_seconds,prev:ie?.talk_time_seconds??null,higherIsBetter:!0}),y.jsx(Wn,{label:"Dials",value:Y.dials,cur:Y.dials,prev:ie?.dials??null,higherIsBetter:!0}),y.jsx(Wn,{label:"Pickups",value:Y.pickups,cur:Y.pickups,prev:ie?.pickups??null,higherIsBetter:!0}),y.jsx(Wn,{label:"Leads",value:Y.leads,cur:Y.leads,prev:ie?.leads??null,higherIsBetter:!0}),y.jsx(Wn,{label:"Sets",value:Y.sets,cur:Y.sets,prev:ie?.sets??null,higherIsBetter:!0}),y.jsx(Wn,{label:"Shows",value:Y.shows,cur:Y.shows,prev:ie?.shows??null,higherIsBetter:!0}),y.jsx(Wn,{label:"On Spot",value:Y.on_spots,cur:Y.on_spots,prev:ie?.on_spots??null,higherIsBetter:!0}),y.jsx(Wn,{label:"Pres.",value:Y.presentations,cur:Y.presentations,prev:ie?.presentations??null,higherIsBetter:!0}),y.jsx(Wn,{label:"Closed",value:Y.closed_deals,cur:Y.closed_deals,prev:ie?.closed_deals??null,higherIsBetter:!0}),y.jsx(Wn,{label:"Resch.",value:Y.reschedules,cur:Y.reschedules,prev:ie?.reschedules??null,higherIsBetter:!1}),y.jsx(Wn,{label:"Refs",value:Y.referrals,cur:Y.referrals,prev:ie?.referrals??null,higherIsBetter:!0}),y.jsx(Wn,{label:"ALP",value:`$${Number(Y.alp).toLocaleString()}`,cur:Number(Y.alp),prev:ie?Number(ie.alp):null,higherIsBetter:!0,highlight:!0})]}),y.jsx(Qp,{report:{id:Y.id,agent_id:Y.agent_id,agent_name:Y.agent_name,report_date:Y.report_date,notes:Y.notes},agents:o,me:l,role:u})]},Y.id)})}),null,y.jsxs("div",{style:{marginTop:14,display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[y.jsxs("div",{style:{background:"var(--ax-card)",border:`1px solid ${Di}`,borderRadius:6,padding:12},children:[y.jsxs("div",{style:{color:zs,fontFamily:"'Cinzel',serif",fontSize:11,letterSpacing:"0.2em",textTransform:"uppercase",marginBottom:6},children:["Weekly Performance ",S?v?`(${u})`:"(GA)":"(SA)"]}),!S&&(se?.ga_notes||"").trim()&&y.jsxs("div",{style:{background:"var(--ax-card)",border:`1px dashed ${ya}`,borderRadius:4,padding:8,marginBottom:8},children:[y.jsx("div",{style:{color:Dn,fontSize:9,letterSpacing:"0.2em",textTransform:"uppercase",marginBottom:2},children:"GA / MGA / RGA notes"}),y.jsx("div",{style:{color:"var(--ax-body2)",fontSize:12,whiteSpace:"pre-wrap"},children:se?.ga_notes})]}),S&&(se?.sa_notes||"").trim()&&y.jsxs("div",{style:{background:"var(--ax-card)",border:`1px dashed ${ya}`,borderRadius:4,padding:8,marginBottom:8},children:[y.jsx("div",{style:{color:Dn,fontSize:9,letterSpacing:"0.2em",textTransform:"uppercase",marginBottom:2},children:"SA notes"}),y.jsx("div",{style:{color:"var(--ax-body2)",fontSize:12,whiteSpace:"pre-wrap"},children:se?.sa_notes})]}),y.jsx("textarea",{value:ue,onChange:Y=>Ce(Y.target.value),placeholder:_?"Overall for the week — trend, wins, coaching focus…":"Read-only",rows:5,disabled:!_,style:DL(!_)}),_&&y.jsx("button",{onClick:Te,disabled:Se,style:ML(Se),children:Se?"Saving…":"Save weekly note"})]}),y.jsxs("div",{style:{background:"var(--ax-card)",border:`1px solid ${ya}`,borderRadius:6,padding:12},children:[y.jsx("div",{style:{color:Di,fontFamily:"'Cinzel',serif",fontSize:11,letterSpacing:"0.2em",textTransform:"uppercase",marginBottom:6},children:"From Priority Sheet"}),!P&&y.jsx("div",{style:{color:Dn,fontSize:12},children:"No priority ranking submitted for this agent yet."}),P&&y.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,fontSize:12,color:"var(--ax-body2)"},children:[y.jsx(au,{label:"SA rating",value:P.priority?u_[P.priority]:"—"}),y.jsx(au,{label:"SA status",value:P.status}),P.ga_override_priority&&y.jsx(au,{label:"GA override",value:u_[P.ga_override_priority]??Str
45ing(P.ga_override_priority)}),P.ga_override_status&&y.jsx(au,{label:"GA status",value:P.ga_override_status}),P.sa_notes&&y.jsx(f_,{title:`${P.sa_name??"SA"} notes`,text:P.sa_notes}),P.ga_override_notes&&y.jsx(f_,{title:`${P.ga_name??"GA"} override notes`,text:P.ga_override_notes}),P.submitted_at&&y.jsxs("div",{style:{color:Dn,fontSize:10,marginTop:4},children:["Submitted ",new Date(P.submitted_at).toLocaleDateString()]})]})]})]})]})}function Kn({label:e,value:t,highlight:n}){return y.jsxs("div",{children:[y.jsx("div",{style:{color:Dn,fontSize:8,letterSpacing:"0.2em",textTransform:"uppercase"},children:e}),y.jsx("div",{style:{color:n?zs:"var(--ax-text)",fontSize:13,marginTop:2},children:t})]})}function au({label:e,value:t}){return y.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:8},children:[y.jsx("span",{style:{color:Dn,fontSize:10,letterSpacing:"0.15em",textTransform:"uppercase"},children:e}),y.jsx("span",{style:{color:"var(--ax-body2)"},children:t||"—"})]})}function f_({title:e,text:t}){return y.jsxs("div",{style:{marginTop:4,padding:8,background:FS,border:`1px dashed ${ya}`,borderRadius:4},children:[y.jsx("div",{style:{color:Di,fontSize:9,letterSpacing:"0.2em",textTransform:"uppercase",marginBottom:3},children:e}),y.jsx("div",{style:{color:"var(--ax-body2)",fontSize:12,whiteSpace:"pre-wrap",lineHeight:1.5},children:t})]})}function DL(e){return{width:"100%",background:"var(--ax-card)",border:`1px solid ${ya}`,color:"var(--ax-body2)",padding:"8px 10px",borderRadius:4,fontSize:13,resize:"vertical",fontFamily:"inherit",cursor:e?"not-allowed":"text"}}function ML(e){return{marginTop:6,padding:"5px 12px",background:zs,color:"#000",border:"none",borderRadius:2,cursor:e?"wait":"pointer",fontFamily:"'Cinzel',serif",fontSize:9,letterSpacing:"0.2em",textTransform:"uppercase",fontWeight:700,opacity:e?.7:1}}const NL="#7ee787",LL="#f47174";function Wn({label:e,value:t,cur:n,prev:a,higherIsBetter:o,highlight:l}){let u=Dn,h="";if(a!==null){const d=n-a;if(d===0)h="±0";else{const m=d>0;u=(o?m:!m)?NL:LL,h=`${m?"▲":"▼"} ${Math.abs(d).toLocaleString()}`}}return y.jsxs("div",{children:[y.jsx("div",{style:{color:Dn,fontSize:8,letterSpacing:"0.2em",textTransform:"uppercase"},children:e}),y.jsx("div",{style:{color:l?zs:"var(--ax-text)",fontSize:13,marginTop:2},children:t}),h&&y.jsx("div",{style:{color:u,fontSize:10,marginTop:1},children:h})]})}function zL(e){const t=new Date(e+"T12:00:00Z"),n=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][t.getUTCDay()],[,a,o]=e.split("-").map(Number);return`${n} · ${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][a-1]} ${o}`}const Vh="var(--ax-gold-text)",Fo="var(--ax-muted)",Go="rgba(217,173,92,0.25)",PL="var(--ax-card)";function UL({weekStart:e,gaContext:t,saContext:n,authorName:a}){const[o,l]=O.useState([]),[u,h]=O.useState(!0),[d,m]=O.useState(""),[v,p]=O.useState(!1),[b,_]=O.useState(null),S=O.useCallback(async()=>{h(!0);const{data:x,error:k}=await Re.from("kpi_manager_notes").select("id, week_start, ga_context, sa_context, body, author_user_id, author_name, created_at").eq("week_start",e).order("created_at",{ascending:!1});l(k?[]:x??[]),h(!1)},[e]);O.useEffect(()=>{Re.auth.getUser().then(({data:x})=>_(x.user?.id??null))},[]),O.useEffect(()=>{S()},[S]);async function R(){const x=d.trim();if(!x)return;p(!0);const{error:k}=await Re.from("kpi_manager_notes").insert({week_start:e,ga_context:t&&t!=="all"?t:null,sa_context:n&&n!=="all"?n:null,body:x,author_name:a??null});if(p(!1),k){He.error(k.message);return}m(""),He.success("Note added"),S()}async function E(x){const{error:k}=await Re.from("kpi_manager_notes").delete().eq("id",x);if(k){He.error(k.message);return}S()}return y.jsxs("aside",{style:{border:`1px solid ${Go}`,borderRadius:8,background:PL,padding:14,display:"flex",flexDirection:"column",gap:10},children:[y.jsx("div",{style:{color:Vh,fontFamily:"'Cinzel',serif",fontSize:12,letterSpacing:"0.2em",textTransform:"uppercase"},children:"Manager Notes"}),y.jsxs("div",{style:{color:Fo,fontSize:11},children:["Week of ",e," · visible to SA / GA / MGA only — agents never see these."]}),y.jsx("textarea",{value:d,onChange:x=>m(x.target.value),placeholder:"Add a team note for this week…",rows:3,style:{background:"var(--ax-bg)",color:"var(--ax-text)",border:`1px solid ${Go}`,borderRadius:6,padding:"8px 10px",fontSize:13,resize:"vertical"}}),y.jsx("button",{type:"button",onClick:()=>{R()},disabled:v||!d.trim(),style:{alignSelf:"flex-start",background:"transparent",color:Vh,border:`1px solid ${Go}`,borderRadius:6,padding:"6px 14px",fontSize:11,letterSpacing:"0.15em",textTransform:"uppercase",cursor:v||!d.trim()?"not-allowed":"pointer",opacity:v||!d.trim()?.5:1},children:v?"Saving…":"Add Note"}),y.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8,marginTop:4},children:u?y.jsx("div",{style:{color:Fo,fontSize:12},children:"Loading…"}):o.length===0?y.jsx("div",{style:{color:Fo,fontSize:12,padding:"10px 12px",border:`1px dashed ${Go}`,borderRadius:6},children:"No manager notes for this week yet."}):o.map(x=>y.jsxs("div",{style:{border:`1px solid ${Go}`,borderRadius:6,padding:"8px 10px"},children:[y.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:8,alignItems:"center"},children:[y.jsxs("span",{style:{color:Vh,fontSize:11,letterSpacing:"0.1em",textTransform:"uppercase"},children:[x.author_name||"Manager",x.sa_context?` · ${x.sa_context}`:x.ga_context?` · ${x.ga_context}`:""]}),b===x.author_user_id&&y.jsx("button",{type:"button",onClick:()=>{E(x.id)},style:{background:"transparent",border:"none",color:Fo,fontSize:11,cursor:"pointer"},children:"Delete"})]}),y.jsx("div",{style:{color:"var(--ax-text)",fontSize:13,whiteSpace:"pre-wrap",marginTop:4},children:x.body}),y.jsx("div",{style:{color:Fo,fontSize:10,marginTop:4}
45,children:new Date(x.created_at).toLocaleString()})]},x.id))})]})}const GS="var(--ax-gold)",VS="var(--ax-gold-text)",Aa="var(--ax-muted)",kp="rgba(217,173,92,0.25)",$L="var(--ax-card)",BL="#7ee787",Qo="#f47174",h_=[{key:"talk_time_seconds",label:"Talk",fmt:IL,higherIsBetter:!0},{key:"dials",label:"Dials",fmt:e=>String(e),higherIsBetter:!0},{key:"pickups",label:"Pickups",fmt:e=>String(e),higherIsBetter:!0},{key:"leads",label:"Leads",fmt:e=>String(e),higherIsBetter:!0},{key:"sets",label:"Sets",fmt:e=>String(e),higherIsBetter:!0},{key:"shows",label:"Shows",fmt:e=>String(e),higherIsBetter:!0},{key:"on_spots",label:"On Spot",fmt:e=>String(e),higherIsBetter:!0},{key:"presentations",label:"Pres.",fmt:e=>String(e),higherIsBetter:!0},{key:"closed_deals",label:"Closed",fmt:e=>String(e),higherIsBetter:!0},{key:"reschedules",label:"Resch.",fmt:e=>String(e),higherIsBetter:!1},{key:"referrals",label:"Refs",fmt:e=>String(e),higherIsBetter:!0},{key:"alp",label:"ALP",fmt:e=>`$${Number(e).toLocaleString()}`,higherIsBetter:!0}];function IL(e){const t=Math.floor(e/3600),n=Math.floor(e%3600/60);return t>0?`${t}h ${n}m`:`${n}m`}function HL(){return{talk_time_seconds:0,dials:0,pickups:0,leads:0,sets:0,shows:0,on_spots:0,presentations:0,closed_deals:0,reschedules:0,referrals:0,alp:0}}function YS(e){const t=HL();for(const n of e)t.talk_time_seconds+=n.talk_time_seconds||0,t.dials+=n.dials||0,t.pickups+=n.pickups||0,t.leads+=n.leads||0,t.sets+=n.sets||0,t.shows+=n.shows||0,t.on_spots+=n.on_spots||0,t.presentations+=n.presentations||0,t.closed_deals+=n.closed_deals||0,t.reschedules+=n.reschedules||0,t.referrals+=n.referrals||0,t.alp+=Number(n.alp)||0;return t}function qL(e,t,n){if(t===null||e===t)return Aa;const a=e>t;return(n?a:!a)?BL:Qo}function FL(e,t){if(t===null)return"";const n=e-t;return n===0?"±0":`${n>0?"▲":"▼"} ${Math.abs(n).toLocaleString()}`}function GL(e){const n=new Date(e.start+"T12:00:00Z").getUTCDay();let a=Dt(e.start,-n);const o=[];for(;a<=e.end;){const l=Dt(a,6);o.push({start:a,end:l}),a=Dt(a,7)}return o}function VL({reports:e,range:t,agents:n,me:a,role:o,vacations:l=[]}){const u=O.useMemo(()=>GL(t),[t]),h=O.useMemo(()=>u.map(v=>{const p=e.filter(_=>_.report_date>=v.start&&_.report_date<=v.end),b=l.filter(_=>_.start<=v.end&&_.end>=v.start);return{...v,rows:p,totals:YS(p),vacations:b}}),[u,e,l]),m=O.useMemo(()=>{const v=new Set;for(const p of e)v.add((p.agent_id??p.agent_name).toLowerCase());return v.size},[e])===1;return e.length===0?null:y.jsxs("div",{style:{marginTop:22,display:"flex",flexDirection:"column",gap:12},children:[y.jsxs("div",{style:{color:VS,fontFamily:"'Cinzel',serif",fontSize:13,letterSpacing:"0.2em",textTransform:"uppercase"},children:["Monthly Breakdown · ",t.start," → ",t.end]}),y.jsx("div",{style:{color:Aa,fontSize:10,letterSpacing:"0.15em",textTransform:"uppercase"},children:"Green = improvement vs previous · Red = decline vs previous"}),h.map((v,p)=>{const b=p<h.length-1?h[p+1].totals:null;return y.jsx(YL,{weekStart:v.start,weekEnd:v.end,totals:v.totals,prevTotals:b,rows:v.rows,defaultOpen:m,agents:n,me:a,role:o,vacations:v.vacations},v.start)})]})}function YL({weekStart:e,weekEnd:t,totals:n,prevTotals:a,rows:o,defaultOpen:l,agents:u,me:h,role:d,vacations:m=[]}){const[v,p]=O.useState(!!l),b=m.length>0,_=O.useMemo(()=>Array.from({length:7},(S,R)=>{const E=Dt(e,R),x=o.filter(k=>k.report_date===E);return{date:E,rows:x,totals:YS(x)}}),[e,o]);return y.jsxs("div",{style:{background:$L,border:`1px solid ${b?Qo:kp}`,borderRadius:8,opacity:b?.75:1},children:[y.jsxs("button",{onClick:()=>p(S=>!S),style:{width:"100%",textAlign:"left",background:"transparent",border:"none",padding:14,cursor:"pointer",color:"var(--ax-body2)"},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:10},children:[y.jsxs("div",{children:[y.jsxs("div",{style:{color:VS,fontFamily:"'Cinzel',serif",fontSize:14,display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[y.jsxs("span",{style:b?{textDecoration:"line-through",opacity:.7}:void 0,children:["Week of ",Cp(e)," – ",Cp(t)]}),b&&y.jsx("span",{style:{color:Qo,border:`1px solid ${Qo}`,borderRadius:999,padding:"2px 8px",fontFamily:"inherit",fontSize:10,letterSpacing:"0.18em",textTransform:"uppercase"},children:"Vacation"})]}),y.jsx("div",{style:{color:b?Qo:Aa,fontSize:10,letterSpacing:"0.15em",textTransform:"uppercase",marginTop:2},children:b?m.map(S=>`${S.name} ${S.start} → ${S.end}`).join(" · "):`${o.length} submission${o.length===1?"":"s"}`})]}),y.jsx("div",{style:{color:GS,fontSize:12},children:v?"▾":"▸"})]}),y.jsx(KS,{totals:n,prev:a})]}),v&&y.jsx("div",{style:{borderTop:`1px solid ${kp}`,padding:12,display:"flex",flexDirection:"column",gap:8},children:_.map((S,R)=>{const E=R===0?null:_[R-1].totals;return y.jsx(KL,{date:S.date,totals:S.totals,prev:E,rows:S.rows,agents:u,me:h,role:d},S.date)})})]})}function KS({totals:e,prev:t}){return y.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${h_.length}, minmax(70px, 1fr))`,gap:8},children:h_.map(n=>{const a=e[n.key],o=t?t[n.key]:null,l=qL(a,o,n.higherIsBetter);return y.jsxs("div",{children:[y.jsx("div",{style:{color:Aa,fontSize:8,letterSpacing:"0.2em",textTransform:"uppercase"},children:n.label}),y.jsx("div",{style:{color:"var(--ax-text)",fontSize:13,marginTop:2},children:n.fmt(a)}),o!==null&&y.jsx("div",{style:{color:l,fontSize:10,marginTop:1},children:FL(a,o)})]},n.key)})})}function KL({date:e,totals:t,prev:n,rows:a,agents:o,me:l,role:u}){const h=a.length>0,d=!!(o&&l&&u);return y.jsxs("div",{style:{background:"var(--ax-card)",border:`1px solid ${kp}`,borderRadius:6,padding:10,opacity:h?1:.5},children:[y.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:6},children:[y.jsx("div",{style:{color:GS,fontSize:11,letterSpacing:"0.15em",textTransform:"uppercase"},children:WL(e)}),y.jsx("div",{style:{color:Aa,fontSize:10},children:h?`${a.length} submission${a.length===1?"":"s"}`:"No submissions"})]}),y.jsx(KS,{totals:t,prev:n}),h&&d&&o&&l&&u&&y.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10,marginTop:10},children:a.map(m=>y.jsx(Qp,{report:{id:m.id,agent_id:m.agent_id,agent_name:m.agent_name,report_date:m.report_date,notes:m.notes},agents:o,me:l,role:u},m.id))}),!d&&a.some(m=>m.notes)&&y.jsx("div",{style:{marginTop:6,display:"flex",flexDirection:"column",gap:4},children:a.filter(m=>m.notes).map(m=>y.jsxs("div",{style:{color:Aa,fontSize:11,fontStyle:"italic"},children:[m.agent_name,": ",m.notes]},m.id))})]})}function Cp(e){const[,t,n]=e.split("-").map(Number);return`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t-1]} ${n}`}function WL(e){const t=new Date(e+"T12:00:00Z");return`${["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][t.getUTCDay()]} · ${Cp(e)}`}const QL=()=>tt(()=>import("./dashboard-CrW1C3-U.js"),__vite__mapDeps([10,11,8,1,3,4])),XL=ct("/dashboard")({head:()=>({meta:[{title:"Dashboard — Mob Website"},{name:"robots",content:"noindex"}
45]}),component:st(QL,"component")}),JL="var(--ax-gold)",cn="var(--ax-gold-text)",_l="var(--ax-card2)",Mt="rgba(217,173,92,0.35)",Ke="var(--ax-muted)";function ZL(e){const t=Math.floor(e/3600),n=Math.floor(e%3600/60);return t>0?`${t}h ${n}m`:`${n}m`}function ez({role:e,me:t,agents:n,deals:a,priorityStatus:o,rankings:l=[]}){const[u,h]=O.useState([]),[d,m]=O.useState(()=>r_()),[v,p]=O.useState("all"),[b,_]=O.useState("all"),[S,R]=O.useState(r_().mode==="week"?"select":"all"),[E,x]=O.useState("completed"),[k,D]=O.useState(""),[j,H]=O.useState(new Set);O.useEffect(()=>{(async()=>{const{data:L}=await Re.from("kpi_reports").select("id,agent_name,agent_id,report_date,submitted_at,dials,pickups,leads,sets,shows,on_spots,presentations,closed_deals,alp,reschedules,referrals,talk_time_seconds,states,notes").order("report_date",{ascending:!1}).limit(5e3);h(L??[])})(),(async()=>{const{data:L}=await Re.rpc("get_my_kpi_feedback"),I=new Set;for(const Ee of L??[])Ee.agent_name&&(Ee.agent_feedback??"").includes("[Agent ")&&I.add(Ee.agent_name.toLowerCase());H(I)})()},[]);const U=d.mode==="week"?"select":"all";O.useEffect(()=>{_("all"),R(U)},[v,U]),O.useEffect(()=>{R(U)},[b,U]),O.useEffect(()=>{R(U)},[d.mode,U]);const B=e==="admin",V=B||e==="MGA"||e==="SGA"||e==="RGA",W=O.useMemo(()=>{if(V)return n;if(!t)return[];if(e==="GA")return n.filter(L=>L.ga_name===t.name||L.name===t.name);if(e==="SA"){const L=Lu(n,t.name);return n.filter(I=>L.has(I.name.toLowerCase())||I.name===t.name)}return n.filter(L=>L.name===t.name)},[n,t,e,V]),se=O.useMemo(()=>{const L=new Set;for(const I of W)I.ga_name&&L.add(I.ga_name);return[...L].sort()},[W]),le=O.useMemo(()=>{const L=v==="all"?W:W.filter(me=>me.ga_name===v),I=new Set(n.filter(me=>me.role==="SA").map(me=>me.name.toLowerCase())),Ee=new Set;for(const me of L)me.role==="SA"&&Ee.add(me.name),me.sa_name&&(me.ga_name&&me.sa_name.trim().toLowerCase()===me.ga_name.trim().toLowerCase()||I.has(me.sa_name.toLowerCase())&&Ee.add(me.sa_name));return[...Ee].sort()},[W,v,n]);O.useMemo(()=>{const L=new Set;for(const I of u)I.agent_name&&L.add(I.agent_name.toLowerCase());return L},[u]);const ue=O.useMemo(()=>{const L=new Map,I=u.filter(me=>Oi(me.report_date,d)),Ee=new Map;for(const me of I){const ye=(me.agent_name??"").toLowerCase(),Nt=Ee.get(ye)??[];Nt.push(me),Ee.set(ye,Nt)}for(const me of W){const ye=me.name.toLowerCase();if((o.get(ye)??"").toLowerCase()==="inactive")continue;const Nt=Ee.get(ye);if(!Nt||Nt.length===0){L.set(ye,"not_filled");continue}j.has(ye)?L.set(ye,"responded"):L.set(ye,"completed")}return L},[d,u,W,o,j]),Ce=O.useMemo(()=>{if(b==="all"||b==="__none__")return null;const L=Lu(n,b);return L.add(b.toLowerCase()),L},[n,b]),Se=O.useMemo(()=>{let L=W;return v!=="all"&&(L=L.filter(I=>I.ga_name===v)),b==="__none__"?L=L.filter(I=>!I.sa_name||!!I.ga_name&&I.sa_name.trim().toLowerCase()===I.ga_name.trim().toLowerCase()):Ce&&(L=L.filter(I=>Ce.has(I.name.toLowerCase())&&I.name.toLowerCase()!==b.toLowerCase())),E!=="all"?(L=L.filter(I=>ue.get(I.name.toLowerCase())===E),L.map(I=>I.name).sort()):L.map(I=>I.name).sort()},[W,v,b,d.mode,E,ue]),Le=O.useMemo(()=>{let L=W;return v!=="all"&&(L=L.filter(I=>I.ga_name===v)),b==="__none__"?L=L.filter(I=>!I.sa_name||!!I.ga_name&&I.sa_name.trim().toLowerCase()===I.ga_name.trim().toLowerCase()):Ce&&(L=L.filter(I=>Ce.has(I.name.toLowerCase())&&I.name.toLowerCase()!==b.toLowerCase())),S!=="all"&&(L=L.filter(I=>I.name===S)),new Set(L.map(I=>I.name.toLowerCase()))},[W,v,b,Ce,S]),P=O.useMemo(()=>{const L=k.trim().toLowerCase();return u.filter(I=>!(!Oi(I.report_date,d)||!Le.has((I.agent_name??"").toLowerCase())||L&&!(I.agent_name??"").toLowerCase().includes(L)))},[u,d,Le,k]),ne=O.useMemo(()=>{const L=new Map;for(const I of u){if(!Oi(I.report_date,d))continue;const Ee=(I.agent_name??"").toLowerCase();L.set(Ee,(L.get(Ee)??0)+1)}return L},[u,d]),oe=O.useMemo(()=>{const L=new Map;for(const I of l){if(!I.travel)continue;const Ee=(I.agent_name??"").trim().toLowerCase();if(!Ee)continue;const me=I.depart_date??I.return_date,ye=I.return_date??I.depart_date;if(!me||!ye)continue;const Nt=L.get(Ee)??[];Nt.push({start:me<ye?me:ye,end:ye>me?ye:me}),L.set(Ee,Nt)}return L},[l]),Te=O.useMemo(()=>{const L=new Set;for(const[I,Ee]of oe)Ee.some(me=>me.start<=d.end&&me.end>=d.start)&&L.add(I);return L},[oe,d]),he=O.useMemo(()=>{const L=[];for(const[I,Ee]of oe){if(!Le.has(I))continue;const me=n.find(ye=>ye.name.toLowerCase()===I)?.name??I;for(const ye of Ee)ye.start<=d.end&&ye.end>=d.start&&L.push({name:me,start:ye.start,end:ye.end})}return L},[oe,Le,n,d]),N=O.useMemo(()=>{const L={};for(const I of Se){const Ee=I.toLowerCase(),me=ne.get(Ee)??0,ye=j.has(Ee),Nt=Te.has(Ee);L[I]=`${ye?"💬 ":""}${I} (${me})${Nt?" — VACATION":""}`}return L},[Se,ne,j,Te]),X=O.useMemo(()=>{const L={};for(const I of Se)Te.has(I.toLowerCase())&&(L[I]={color:"var(--ax-danger)"});return L},[Se,Te]),Z=O.useMemo(()=>{let L=W;return v!=="all"&&(L=L.filter(I=>I.ga_name===v)),b==="__none__"?L=L.filter(I=>!I.sa_name||!!I.ga_name&&I.sa_name.trim().toLowerCase()===I.ga_name.trim().toLowerCase()):b!=="all"&&(L=L.filter(I=>I.sa_name===b&&!(I.ga_name&&I.sa_name.trim().toLowerCase()===I.ga_name.trim().toLowerCase()))),new Set(L.map(I=>I.name.toLowerCase()))},[W,v,b]),re=O.useMemo(()=>u.filter(L=>Oi(L.report_date,d)?Z.has((L.agent_name??"").toLowerCase()):!1),[u,d,Z]),Y=O.useMemo(()=>{const L=new Map;for(const I of re){const Ee=I.agent_name||"Unknown",me=Ee.toLowerCase(),ye=L.get(me);ye?(ye.count+=1,ye.talkSec+=I.talk_time_seconds||0,ye.dials+=I.dials||0,ye.pickups+=I.pickups||0,ye.leads+=I.leads||0,ye.sets+=I.sets||0,ye.shows+=I.shows||0,ye.onSpots+=I.on_spots||0,ye.presentations+=I.presentations||0,ye.closedDeals+=I.closed_deals||0,ye.reschedules+=I.reschedules||0,ye.referrals+=I.referrals||0,ye.alp+=Number(I.alp)||0):L.set(me,{name:Ee,count:1,talkSec:I.talk_time_seconds||0,dials:I.dials||0,pickups:I.pickups||0,leads:I.leads||0,sets:I.sets||0,shows:I.shows||0,onSpots:I.on_spots||0,presentations:I.presentations||0,closedDeals:I.closed_deals||0,reschedules:I.reschedules||0,referrals:I.referrals||0,alp:Number(I.alp)||0})}return[...L.values()].sort((I,Ee)=>Ee.alp-I.alp)},[re]),Q=O.useMemo(()=>{const L={dials:0,pickups:0,leads:0,sets:0,shows:0,onSpots:0,presentations:0,closedDeals:0,alp:0,referrals:0,reschedules:0,talkSec:0,submissions:P.length};for(const I of P)L.dials+=I.dials||0,L.pickups+=I.pickups||0,L.leads+=I.leads||0,L.sets+=I.sets||0,L.shows+=I.shows||0,L.onSpots+=I.on_spots||0,L.presentations+=I.presentations||0,L.closedDeals+=I.closed_deals||0,L.alp+=Number(I.alp)||0,L.referrals+=I.referrals||0,L.reschedules+=I.reschedules||0,L.talkSec+=I.talk_time_seconds||0;return L},[P]),ve=L=>{const I=Math.floor(L/3600),Ee=Math.floor(L%3600/60);return I>0?`${I}h ${Ee}m`:`${Ee}m`},ie=d.mode==="day",Oe=O.useMemo(()=>
45{if(ie)return 1;if(d.mode==="week")return 6;try{let L=0;const I=new Date(`${d.start}T12:00:00Z`),Ee=new Date(`${d.end}T12:00:00Z`).getTime();for(let me=I;me.getTime()<=Ee;me.setUTCDate(me.getUTCDate()+1))me.getUTCDay()!==0&&(L+=1);return Math.max(1,L)}catch{return 1}},[ie,d.mode,d.start,d.end]),{agentDays:it,dialTargetTotal:xe,agentCount:we}=O.useMemo(()=>{const L=new Set,I=new Set;let Ee=0;for(const me of P){const ye=(me.agent_name??"").toLowerCase(),Nt=(me.report_date??me.date??"").toString().slice(0,10),Tr=`${ye}|${Nt}`;L.has(Tr)||(L.add(Tr),Ee+=(me.talk_time_seconds||0)>=7200?250:400),ye&&I.add(ye)}return{agentDays:L.size||1,dialTargetTotal:Ee||(Q.talkSec>=7200?250:400),agentCount:I.size||1}},[P,Q.talkSec]),Ne=d.mode==="month",Me=P.length>0,Nn=ie?1:Ne?it:Oe*we,Jt=Nn>0?Nn:1,Ve=L=>Me?L/Jt:0,Zt=Me?Q.talkSec/Jt:0,pt=ie?Q.talkSec>=7200?250:400:Zt>=7200?250:400,en=Me?it:0,ur=d.mode==="week"?"week (6-day work week)":Ne?`month (${en} submission${en===1?"":"s"})`:"",yt=ie?we>1?` (${we} agents)`:"":Ne?` · per submission across ${ur}${we>1?` · ${we} agents`:""}`:` · per agent / work day across ${ur}${we>1?` · ${we} agents`:""}`,St=L=>Me?ie?Math.round(L).toLocaleString():L.toFixed(1):"N/A",Rt=L=>Me?`$${Math.round(L).toLocaleString()}`:"N/A",Be=L=>Me?L?"pass":"fail":void 0,ut=Me?ie?we>1?`Target: ${xe} (${we} agents)`:Q.talkSec>=7200?"Target: 250 (2+ hrs talk time)":"Target: 400 (<2 hrs talk time)":`Target: ${pt} / ${Ne?"submission":"day"}${yt}`:"No submissions in this range",Ut=L=>Me?ie?`Target: ${L}${yt}`:`Target: ${L} / ${Ne?"submission":"day"}${yt}`:"No submissions in this range",Ln=[{label:"Talk Time",value:Me?ie?ve(Q.talkSec):`${ve(Math.round(Q.talkSec/Jt))} / ${Ne?"submission":"day"}`:"N/A"},{label:"Dials",value:St(Ve(Q.dials)),status:Be(Ve(Q.dials)>=pt),sub:ut},{label:"Pickups",value:St(Ve(Q.pickups)),status:Be(Ve(Q.pickups)>=8),sub:Ut(8)},{label:"Leads",value:St(Ve(Q.leads))},{label:"Sets",value:St(Ve(Q.sets)),status:Be(Ve(Q.sets)>=5),sub:Ut(5)},{label:"Shows",value:St(Ve(Q.shows))},{label:"On Spots",value:St(Ve(Q.onSpots))},{label:"Presentations",value:St(Ve(Q.presentations)),status:Be(Ve(Q.presentations)>=4),sub:Ut(4)},{label:"Closed Deals",value:St(Ve(Q.closedDeals)),status:Be(Ve(Q.closedDeals)>=1),sub:Ut(1)},{label:"Reschedules",value:St(Ve(Q.reschedules))},{label:"Referrals",value:St(Ve(Q.referrals))},{label:"ALP",value:Rt(Ve(Q.alp)),highlight:!0,status:Be(Ve(Q.alp)>=1e3),sub:Ut(1e3)}],ts=Q.closedDeals>0?Q.alp/Q.closedDeals:null,zn=Q.dials>0?Q.pickups/Q.dials*100:null,Fs=Q.pickups>0?Q.presentations/Q.pickups*100:null,Xn=Q.presentations>0?Q.closedDeals/Q.presentations*100:null,Pn=O.useMemo(()=>{const L=new Set(P.map(Ee=>(Ee.agent_name??"").trim().toLowerCase()).filter(Boolean));let I=0;for(const Ee of a){if(!Oi(Ee.deal_date,d))continue;const me=(Ee.agent_name??"").trim().toLowerCase();L.size>0&&!L.has(me)||(I+=1)}return I},[a,d,P]),$t=Pn>0?Q.referrals/Pn:null;return e==="Agent"&&!B?y.jsxs(b_,{children:[y.jsx("div",{style:{marginBottom:14},children:y.jsx(a_,{value:d,onChange:m})}),y.jsx(p_,{items:Ln}),y.jsx(g_,{hasReports:P.length>0,dials:Q.dials,pickups:Q.pickups,presentations:Q.presentations,closedDeals:Q.closedDeals}),y.jsx(m_,{hasReports:P.length>0,pickupRate:zn,onSpot:Q.sets,presRatio:Fs,closeRatio:Xn,avgAlp:ts,dials:Q.dials,pickups:Q.pickups,presentations:Q.presentations,closedDeals:Q.closedDeals,lbClosedDeals:Pn,referrals:Q.referrals,refPerDeal:$t}),y.jsx(rz,{range:d,reports:P}),y.jsx(v_,{rows:P,showFeedback:!0}),t&&y.jsx(TL,{role:"Agent",me:{id:t.id,name:t.name,role:t.role,ga_name:t.ga_name,sa_name:t.sa_name},agents:n.map(L=>({id:L.id,name:L.name,role:L.role,ga_name:L.ga_name,sa_name:L.sa_name}))})]}):y.jsxs(b_,{children:[y.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:12,marginBottom:14,alignItems:"center"},children:[y.jsx(a_,{value:d,onChange:m}),V&&y.jsx(Yh,{label:"GA Team",value:v,onChange:p,options:se}),(V||e==="GA")&&y.jsx(Yh,{label:"SA",value:b,onChange:_,options:le,extraOption:{value:"__none__",label:"No SA (direct to GA)"}}),(d.mode==="day"||d.mode==="week"||d.mode==="month")&&y.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:10,
45color:Ke,letterSpacing:"0.2em",textTransform:"uppercase"},children:["Status",y.jsxs("select",{value:E,onChange:L=>x(L.target.value),style:{background:"var(--ax-card)",color:"var(--ax-text)",border:`1px solid ${Mt}`,borderRadius:6,padding:"8px 10px",fontSize:13,minWidth:180},children:[y.jsx("option",{value:"all",children:"All"}),y.jsx("option",{value:"completed",children:"Agent Completed"}),y.jsx("option",{value:"responded",children:"💬 Agent Responded"}),y.jsx("option",{value:"not_filled",children:"Agent Not Filled Out"})]})]}),y.jsx(Yh,{label:"Agent",value:S,onChange:R,options:Se,optionLabels:N,optionStyles:X,placeholder:d.mode==="week"?"Select":"All",placeholderValue:d.mode==="week"?"select":"all",extraOption:d.mode==="week"?{value:"all",label:"All"}:void 0}),he.length>0&&y.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6,alignItems:"center"},children:he.slice(0,6).map(L=>y.jsxs("span",{style:{color:"var(--ax-danger)",border:"1px solid var(--ax-danger)",borderRadius:999,padding:"3px 9px",fontSize:10,letterSpacing:"0.15em",textTransform:"uppercase"},children:[L.name," · Vacation ",L.start," → ",L.end]},`${L.name}-${L.start}`))}),y.jsx("input",{value:k,onChange:L=>D(L.target.value),placeholder:"Search agent…",style:{flex:"1 1 180px",background:"var(--ax-card)",color:"var(--ax-text)",border:`1px solid ${Mt}`,borderRadius:6,padding:"8px 12px",fontSize:13}})]}),(d.mode==="week"||d.mode==="month")&&Y.length>0&&y.jsx(nz,{totals:Y,mode:d.mode,onSelectAgent:L=>R(L)}),y.jsxs("div",{style:{display:"flex",gap:16,alignItems:"flex-start",flexWrap:"wrap"},children:[y.jsxs("div",{style:{flex:"1 1 520px",minWidth:0},children:[!(d.mode==="week"&&S==="select")&&y.jsxs(y.Fragment,{children:[y.jsx(p_,{items:Ln}),y.jsx(g_,{hasReports:P.length>0,dials:Q.dials,pickups:Q.pickups,presentations:Q.presentations,closedDeals:Q.closedDeals}),y.jsx(m_,{hasReports:P.length>0,pickupRate:zn,onSpot:Q.sets,presRatio:Fs,closeRatio:Xn,avgAlp:ts,dials:Q.dials,pickups:Q.pickups,presentations:Q.presentations,closedDeals:Q.closedDeals,lbClosedDeals:Pn,referrals:Q.referrals,refPerDeal:$t})]}),d.mode==="week"&&S==="select"&&y.jsx("div",{style:{color:Ke,fontSize:12,padding:"12px 14px",border:`1px dashed ${Mt}`,borderRadius:6,marginTop:12},children:"Select an agent from the dropdown above to view the weekly breakdown and notes."})]}),d.mode==="week"&&(e==="SA"||e==="GA"||e==="MGA"||e==="SGA"||e==="RGA"||e==="admin")&&y.jsx("div",{style:{flex:"0 1 360px",minWidth:280},children:y.jsx(UL,{weekStart:d.start,gaContext:v,saContext:b,authorName:t?.name??null})})]}),!(d.mode==="week"&&S==="select")&&y.jsx(v_,{rows:P}),d.mode==="day"&&t&&(e==="SA"||e==="GA"||e==="admin"||e==="MGA"||e==="SGA"||e==="RGA"||e==="Agent")&&y.jsxs("div",{style:{marginTop:20,display:"flex",flexDirection:"column",gap:18},children:[y.jsx("div",{style:{color:cn,fontFamily:"'Cinzel',serif",fontSize:13,letterSpacing:"0.2em",textTransform:"uppercase"},children:"Daily Review Notes"}),S==="all"?y.jsx("div",{style:{color:Ke,fontSize:12,padding:"12px 14px",border:`1px dashed ${Mt}`,borderRadius:6},children:"Select an agent from the dropdown above to view or add their daily review notes."}):P.length===0?y.jsxs("div",{style:{color:Ke,fontSize:12,padding:"12px 14px",border:`1px dashed ${Mt}`,borderRadius:6},children:[S," has not filled out a KPI report for this day."]}):P.slice(0,1).map(L=>y.jsx(Qp,{report:{id:L.id,agent_id:L.agent_id,agent_name:L.agent_name,report_date:L.report_date,notes:L.notes},agents:n.map(I=>({id:I.id,name:I.name,role:I.role,ga_name:I.ga_name,sa_name:I.sa_name})),me:{id:t.id,name:t.name,role:t.role,ga_name:t.ga_name,sa_name:t.sa_name},role:e},L.id))]}),d.mode==="week"&&t&&P.length>0&&y.jsx(OL,{reports:P.map(L=>({id:L.id,agent_id:L.agent_id,agent_name:L.agent_name,report_date:L.report_date,talk_time_seconds:L.talk_time_seconds,dials:L.dials,pickups:L.pickups,leads:L.leads,sets:L.sets,shows:L.shows,on_spots:L.on_spots,presentations:L.presentations,closed_deals:L.closed_deals,reschedules:L.reschedules,referrals:L.referrals,alp:L.alp,notes:L.notes})),agents:n.map(L=>
45({id:L.id,name:L.name,role:L.role,ga_name:L.ga_name,sa_name:L.sa_name})),me:{id:t.id,name:t.name,role:t.role,ga_name:t.ga_name,sa_name:t.sa_name},role:e,range:d}),d.mode==="month"&&P.length>0&&y.jsx(VL,{reports:P.map(L=>({id:L.id,agent_id:L.agent_id,agent_name:L.agent_name,report_date:L.report_date,talk_time_seconds:L.talk_time_seconds,dials:L.dials,pickups:L.pickups,leads:L.leads,sets:L.sets,shows:L.shows,on_spots:L.on_spots,presentations:L.presentations,closed_deals:L.closed_deals,reschedules:L.reschedules,referrals:L.referrals,alp:L.alp,notes:L.notes})),range:d,agents:n.map(L=>({id:L.id,name:L.name,role:L.role,ga_name:L.ga_name,sa_name:L.sa_name})),me:t?{id:t.id,name:t.name,role:t.role,ga_name:t.ga_name,sa_name:t.sa_name}:null,role:e,vacations:he})]})}function J3(){const[e,t]=O.useState(null),[n,a]=O.useState([]),[o,l]=O.useState([]),[u,h]=O.useState([]),[d,m]=O.useState(new Map),[v,p]=O.useState(!1);return O.useEffect(()=>{(async()=>{const[b,_,S,R]=await Promise.all([Re.rpc("get_agents_directory"),DM(),Re.from("rankings").select("*").limit(500),Re.rpc("current_agent_self")]),E=(b.data??[]).map(D=>({...D,email:null}));a(E),l(_),h(S.data??[]);const x=new Map;for(const D of E){const j=String(D.status??"").trim().toLowerCase();D.name&&j&&x.set(D.name.trim().toLowerCase(),j)}m(x);const k=Array.isArray(R.data)?R.data[0]:R.data;t(k??null),p(!0)})()},[]),v?y.jsx(ez,{role:"admin",me:e,agents:n,deals:o,priorityStatus:d,rankings:u}):y.jsx("div",{style:{color:Ke},children:"Loading KPI dashboard…"})}const Jp="var(--ax-success)",Zp="var(--ax-danger)";function p_({items:e}){return y.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8,marginBottom:20,maxWidth:520},children:e.map(t=>{const n=t.status==="pass"?Jp:t.status==="fail"?Zp:null,a=n??Mt;return y.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",background:_l,border:`1px solid ${a}`,borderRadius:6,padding:"10px 16px"},children:[y.jsxs("div",{children:[y.jsx("div",{style:{color:Ke,fontSize:10,letterSpacing:"0.25em",textTransform:"uppercase"},children:t.label}),t.sub&&y.jsx("div",{style:{color:Ke,fontSize:9,marginTop:2,letterSpacing:"0.1em"},children:t.sub})]}),y.jsx("div",{style:{color:n??(t.highlight?cn:"var(--ax-text)"),fontFamily:"'Cinzel',serif",fontSize:18},children:t.value})]},t.label)})})}function m_({hasReports:e,pickupRate:t,onSpot:n,presRatio:a,closeRatio:o,avgAlp:l,dials:u,pickups:h,presentations:d,closedDeals:m,lbClosedDeals:v,referrals:p,refPerDeal:b}){const _=(R,E)=>E?void 0:`${R} = 0`,S=[{label:"Pickup Rate",value:t===null?"—":`${t.toFixed(1)}%`,status:t===null?void 0:t>=5?"pass":"fail",sub:"Pickups / Dials · target ≥ 5%",tip:"Formula: Pickups ÷ Dials, shown as a percentage. Green when ≥ 5%. Red when < 5%. If Dials = 0, shows '—'.",warn:e?_("Dials",u>0):"No KPI reports"},{label:"On Spot",value:e?String(n):"—",status:e?n>=5?"pass":"fail":void 0,sub:"From KPI form · target ≥ 5",tip:"This is the Sets / On Spots value from the KPI form. Green when ≥ 5. Red when < 5. Shows '—' when no KPI reports have been submitted.",warn:e?void 0:"No KPI reports"},{label:"Presentation Ratio",value:a===null?"—":`${a.toFixed(1)}%`,status:a===null?void 0:a>=30?"pass":"fail",sub:"Presentations / Pickups · target ≥ 30%",tip:"Formula: Presentations ÷ Pickups, shown as a percentage. Green when ≥ 30%. Red when < 30%. If Pickups = 0, shows '—'.",warn:e?_("Pickups",h>0):"No KPI reports"},{label:"Close Ratio",value:o===null?"—":`${o.toFixed(1)}%`,status:o===null?void 0:o>=33?"pass":"fail",sub:"Closed / Presentations · target ≥ 33%",tip:"Formula: Closed Deals ÷ Presentations, shown as a percentage. Green when ≥ 33%. Red when < 33%. If Presentations = 0, shows '—'.",warn:e?_("Presentations",d>0):"No KPI reports"},{label:"AVG ALP / Deal",value:l===null?"—":`$${Math.round(l).toLocaleString()}`,status:l===null?void 0:l>=1800?"pass":"fail",sub:"ALP / Closed Deals · target ≥ $1,800",tip:"Formula: ALP ÷ Closed Deals. Green when ≥ $1,800. Red when < $1,800. If Closed Deals = 0, shows '—'.",warn:e?_("Closed Deals",m>0):"No KPI reports"}
45,{label:"Total Closed Deals",value:v.toLocaleString(),sub:"Pulled from leaderboard · selected range",tip:"Total number of deals recorded on the leaderboard for the selected date range and the agents currently shown."},{label:"Referrals Gathered",value:p.toLocaleString(),sub:"From KPI form · selected range",tip:"Total referrals reported on KPI submissions for the selected date range and agents.",warn:e?void 0:"No KPI reports"},{label:"Referrals / Closed Deal",value:b===null?"—":b.toFixed(1),status:b===null?void 0:b>3?"pass":"fail",sub:"Referrals / leaderboard deals · target > 3",tip:"Formula: Referrals ÷ Total Closed Deals (leaderboard). Green when above 3. Red when 3 or below. If there are no leaderboard deals, shows '—'.",warn:v>0?void 0:"Leaderboard deals = 0"}];return y.jsxs("div",{style:{marginBottom:20},children:[y.jsx("div",{style:{color:cn,fontFamily:"'Cinzel',serif",fontSize:12,letterSpacing:"0.2em",textTransform:"uppercase",marginBottom:10},children:"Ratios"}),y.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:10},children:S.map(R=>{const E=R.status==="pass"?Jp:R.status==="fail"?Zp:null,x=E??Mt;return y.jsxs("div",{style:{background:_l,border:`1px solid ${x}`,borderRadius:6,padding:"12px 14px"},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[y.jsx("div",{style:{color:Ke,fontSize:9,letterSpacing:"0.25em",textTransform:"uppercase"},children:R.label}),y.jsx(tz,{text:R.tip})]}),y.jsx("div",{style:{color:E??"var(--ax-text)",fontFamily:"'Cinzel',serif",fontSize:22,marginTop:4},children:R.value}),R.sub&&y.jsx("div",{style:{color:Ke,fontSize:9,marginTop:4,letterSpacing:"0.05em"},children:R.sub}),R.warn&&y.jsxs("div",{style:{marginTop:6,color:"var(--ax-gold-text)",fontSize:10,display:"flex",alignItems:"center",gap:4,letterSpacing:"0.03em"},children:[y.jsx("span",{"aria-hidden":!0,children:"⚠"}),y.jsxs("span",{children:["Missing input: ",R.warn]})]})]},R.label)})})]})}function g_({hasReports:e,dials:t,pickups:n,presentations:a,closedDeals:o}){const l=[];return e&&(t===0&&l.push("Dials"),n===0&&l.push("Pickups"),a===0&&l.push("Presentations"),o===0&&l.push("Closed Deals")),e?l.length===0?null:y.jsxs("div",{role:"status",style:{marginBottom:14,padding:"10px 14px",borderRadius:6,background:"rgba(244,215,122,0.08)",border:"1px solid rgba(244,215,122,0.4)",color:"var(--ax-gold-text)",fontSize:12,display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[y.jsx("span",{"aria-hidden":!0,style:{fontSize:14},children:"⚠"}),y.jsxs("span",{children:["Missing required KPI input",l.length===1?"":"s",": ",y.jsx("strong",{children:l.join(", ")}),". Dependent ratios are shown as “—” instead of a pass/fail color to avoid misleading results."]})]}):y.jsxs("div",{role:"status",style:{marginBottom:14,padding:"10px 14px",borderRadius:6,background:"rgba(244,215,122,0.08)",border:"1px solid rgba(244,215,122,0.4)",color:"var(--ax-gold-text)",fontSize:12,display:"flex",alignItems:"center",gap:8},children:[y.jsx("span",{"aria-hidden":!0,style:{fontSize:14},children:"⚠"}),y.jsx("span",{children:"No KPI reports submitted for this range. Ratios cannot be calculated and are shown as “—”."})]})}function tz({text:e}){return y.jsx("span",{title:e,style:{color:Ke,fontSize:11,cursor:"help",border:`1px solid ${Mt}`,borderRadius:"50%",width:14,height:14,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:1},children:"ℹ"})}function nz({totals:e,mode:t,onSelectAgent:n}){const[a,o]=O.useState(!1),l=e.reduce((u,h)=>u+h.alp,0);return y.jsxs("div",{style:{marginTop:18,marginBottom:8,border:`1px solid ${Mt}`,borderRadius:6,overflow:"hidden"},children:[y.jsxs("button",{onClick:()=>o(u=>!u),style:{width:"100%",textAlign:"left",background:"var(--ax-card)",border:"none",padding:"12px 14px",cursor:"pointer",color:"var(--ax-body2)",display:"flex",alignItems:"center",gap:12,flexWrap:"wrap"},children:[y.jsx("span",{style:{display:"inline-block",transform:a?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.15s",color:Ke,fontSize:10,width:12},children:"▶"}),y.jsxs("span",{style:{color:cn,fontFamily:"'Cinzel',serif",fontSize:12,letterSpacing:"0.2em",textTransform:"uppercase"},children:["All Agents · ",t==="week"?"Week":"Month"," Summary"]}),y.jsxs("span",{style:{color:Ke,fontSize:11},children:[e.length," agent",e.length===1?"":"s"]}),y.jsx("span",{style:{color:Ke,fontSize:11},children:"·"}),y.jsxs("span",{style:{color:cn,fontSize:11}
45,children:["$",Math.round(l).toLocaleString()," ALP"]}),y.jsx("span",{style:{marginLeft:"auto",color:Ke,fontSize:11},children:a?"Collapse":"Expand"})]}),a&&y.jsxs(y.Fragment,{children:[y.jsxs("div",{style:{display:"grid",gridTemplateColumns:"180px 70px repeat(12, minmax(58px, 1fr))",gap:8,padding:"10px 12px",background:"var(--ax-card)",color:Ke,fontSize:9,letterSpacing:"0.15em",textTransform:"uppercase",borderTop:`1px solid ${Mt}`},children:[y.jsx("div",{children:"Agent"}),y.jsx("div",{children:"Days"}),y.jsx("div",{children:"Talk"}),y.jsx("div",{children:"Dials"}),y.jsx("div",{children:"Pickups"}),y.jsx("div",{children:"Leads"}),y.jsx("div",{children:"Sets"}),y.jsx("div",{children:"Shows"}),y.jsx("div",{children:"On Spot"}),y.jsx("div",{children:"Pres."}),y.jsx("div",{children:"Closed"}),y.jsx("div",{children:"Resch."}),y.jsx("div",{children:"Refs"}),y.jsx("div",{children:"ALP"})]}),y.jsx("div",{style:{maxHeight:360,overflow:"auto"},children:e.map(u=>y.jsxs("button",{onClick:()=>n(u.name),style:{display:"grid",gridTemplateColumns:"180px 70px repeat(12, minmax(58px, 1fr))",gap:8,width:"100%",textAlign:"left",padding:"10px 12px",background:"transparent",border:"none",borderBottom:`1px solid ${Mt}`,color:"var(--ax-body2)",fontSize:12,cursor:"pointer"},children:[y.jsx("div",{style:{color:cn,fontFamily:"'Cinzel',serif"},children:u.name}),y.jsx("div",{children:u.count}),y.jsx("div",{children:ZL(u.talkSec)}),y.jsx("div",{children:u.dials}),y.jsx("div",{children:u.pickups}),y.jsx("div",{children:u.leads}),y.jsx("div",{children:u.sets}),y.jsx("div",{children:u.shows}),y.jsx("div",{children:u.onSpots}),y.jsx("div",{children:u.presentations}),y.jsx("div",{children:u.closedDeals}),y.jsx("div",{children:u.reschedules}),y.jsx("div",{children:u.referrals}),y.jsxs("div",{style:{color:cn},children:["$",u.alp.toLocaleString()]})]},u.name))})]})]})}function Yh({label:e,value:t,onChange:n,options:a,optionLabels:o,optionStyles:l,placeholder:u="All",placeholderValue:h="all",extraOption:d}){return y.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:4,fontSize:10,color:Ke,letterSpacing:"0.2em",textTransform:"uppercase"},children:[e,y.jsxs("select",{value:t,onChange:m=>n(m.target.value),style:{background:"var(--ax-card)",color:l?.[t]?.color??"var(--ax-text)",border:`1px solid ${Mt}`,borderRadius:6,padding:"8px 10px",fontSize:13,minWidth:140},children:[y.jsx("option",{value:h,children:u}),d&&y.jsx("option",{value:d.value,children:d.label}),a.map(m=>y.jsx("option",{value:m,style:l?.[m],children:o?.[m]??m},m))]})]})}function y_(e,t){if(e){const n=e.split(":");if(n.length>=2&&/^\d{4}-\d{2}(-\d{2})?$/.test(n[1]))return n[1].length===7?`${n[1]}-01`:n[1]}return t?t.slice(0,10):null}function rz({range:e,reports:t}){const[n,a]=O.useState([]),[o,l]=O.useState(!0),[u,h]=O.useState({}),[d,m]=O.useState(null),v=async()=>{const{data:x}=await Re.rpc("get_my_kpi_feedback");a(x??[])};O.useEffect(()=>{(async()=>(l(!0),await v(),l(!1)))()},[]);async function p(x){const k=(u[x]??"").trim();if(k){m(x);try{const D=await HS({data:{reviewId:x,reply:k}});D?.ok?(He.success("Reply sent to your manager"),h(j=>({...j,[x]:""})),await v()):He.error(D?.reason==="forbidden"||D?.reason==="not_an_agent"?"You can only reply to feedback on your own KPI submissions.":`Could not send reply${D?.reason?`: ${D.reason}`:""}`)}catch{He.error("Could not send reply")}m(null)}}const b=O.useMemo(()=>n.filter(x=>(x.agent_feedback??"").trim().length>0),[n]),_=O.useMemo(()=>{const x=new Map;for(const k of t)x.set(k.id,k);return x},[t]),{inRange:S,outOfRange:R}=O.useMemo(()=>{const x=[],k=[];for(const D of b){const j=y_(D.period_label,D.agent_feedback_at);j&&Oi(j,e)?x.push(D):k.push(D)}return{inRange:x,outOfRange:k}},[b,e]);if(o)return null;if(b.length===0)return y.jsxs("div",{style:{marginTop:18,border:`1px solid ${Mt}`,borderRadius:6,padding:14,background:_l},children:[y.jsx("div",{style:{color:cn,fontFamily:"'Cinzel',serif",fontSize:12,letterSpacing:"0.2em",textTransform:"uppercase",marginBottom:6},children:"Feedback from your managers"}),y.jsx("div",{style:{color:Ke,fontSize:12},children:"No feedback yet — your SA/GA can leave notes tied to any KPI submission."})]});const E=(x,k)=>{const D=(x.period_label??"").split(":"),j=D[0]||"note",H=D.length>=3?D[D.length-1]:"",U=H?_.get(H):void 0,B=y_(x.period_label,x.agent_feedback_at)??"";return y.jsxs("div",{style:{background:"var(--ax-card)",border:`1px solid ${k?Mt:JL}`,borderRadius:6,padding:12,opacity:k?.72:1},children:[y.jsxs("div",{style:{display:"flex",justifyContent:"space-between",flexWrap:"wrap",gap:6,marginBottom:6},children:[y.jsxs("span",{style:{color:cn,fontSize:11,letterSpacing:"0.15em",textTransform:"uppercase"},children:[j==="daily"?"Daily":j==="weekly"?"Weekly":j==="monthly"?"Monthly":"Note",B?` · ${B}`:""]}),y.jsxs("span",{style:{color:Ke,fontSize:10},children:[x.agent_feedback_by?`From ${x.agent_feedback_by}`:"",x.agent_feedback_at?` · ${new Date(x.agent_feedback_at).toLocaleStr
45ing()}`:""]})]}),y.jsx(Kp,{raw:x.agent_feedback}),y.jsxs("div",{style:{marginTop:10,borderTop:`1px solid ${Mt}`,paddingTop:10},children:[y.jsx("textarea",{value:u[x.id]??"",onChange:V=>h(W=>({...W,[x.id]:V.target.value})),placeholder:"Reply to your manager…",rows:2,style:{width:"100%",background:"var(--ax-card)",border:`1px solid ${Mt}`,color:"var(--ax-body2)",padding:"8px 10px",borderRadius:4,fontSize:13,lineHeight:1.5,resize:"vertical",fontFamily:"inherit"}}),y.jsx("button",{onClick:()=>p(x.id),disabled:d===x.id||!(u[x.id]??"").trim(),style:{marginTop:6,padding:"6px 14px",background:cn,color:"#000",border:"none",borderRadius:2,cursor:d===x.id?"wait":"pointer",fontFamily:"'Cinzel',serif",fontSize:10,letterSpacing:"0.2em",textTransform:"uppercase",fontWeight:700,opacity:d===x.id||!(u[x.id]??"").trim()?.6:1},children:d===x.id?"Sending…":"Send reply"})]}),U&&y.jsxs("div",{style:{color:Ke,fontSize:10,marginTop:6},children:["On submission: ",U.dials," dials · ",U.pickups," pickups · ",U.presentations," pres · ",U.closed_deals," closed · $",Number(U.alp).toLocaleString()," ALP"]})]},x.id)};return y.jsxs("div",{style:{marginTop:18,border:`1px solid ${Mt}`,borderRadius:6,padding:14,background:_l},children:[y.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",flexWrap:"wrap",gap:6,marginBottom:10},children:[y.jsx("div",{style:{color:cn,fontFamily:"'Cinzel',serif",fontSize:12,letterSpacing:"0.2em",textTransform:"uppercase"},children:"Feedback from your managers"}),y.jsxs("div",{style:{color:Ke,fontSize:10},children:[S.length," in this ",e.mode==="week"?"week":e.mode==="month"?"month":"range"," · ",b.length," total"]})]}),y.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[S.length>0?S.map(x=>E(x,!1)):y.jsx("div",{style:{color:Ke,fontSize:12},children:"No feedback in the selected range."}),R.length>0&&y.jsxs(y.Fragment,{children:[y.jsx("div",{style:{color:Ke,fontSize:10,letterSpacing:"0.15em",textTransform:"uppercase",marginTop:6},children:"Earlier feedback"}),R.slice(0,20).map(x=>E(x,!0))]})]})]})}function v_({rows:e,showFeedback:t}){const n=typeof window>"u"?null:new URLSearchParams(window.location.search).get("kpi_report"),[a,o]=O.useState(!1),[l,u]=O.useState([]);O.useEffect(()=>{t&&(async()=>{const{data:p}=await Re.rpc("get_my_kpi_feedback");u(p??[])})()},[t]),O.useEffect(()=>{if(!n)return;o(!0);const p=setTimeout(()=>{const b=document.getElementById(`kpi-row-${n}`);b&&b.scrollIntoView({behavior:"smooth",block:"center"})},150);return()=>clearTimeout(p)},[n]);const h=O.useMemo(()=>{const p=new Map;for(const b of l){const S=(b.period_label??"").split(":"),R=S.length>=3?S[S.length-1]:"";R&&p.set(R,b)}return p},[l]);if(e.length===0)return y.jsx("div",{style:{color:Ke,textAlign:"center",padding:24,fontSize:13},children:"No KPI reports in this range."});const d=[...e].sort((p,b)=>(b.report_date??"").localeCompare(p.report_date??"")),m=d.reduce((p,b)=>p+Number(b.alp||0),0),v=["Date","Agent","Talk","Dials","Pickups","Leads","Sets","Shows","On Spot","Pres.","Closed","Resch.","Refs","ALP","Notes"];return t&&v.push("Manager Feedback"),y.jsxs("div",{style:{marginTop:16,border:`1px solid ${Mt}`,borderRadius:6,overflow:"hidden"},children:[y.jsxs("button",{onClick:()=>o(p=>!p),style:{width:"100%",textAlign:"left",background:"var(--ax-card)",border:"none",padding:"12px 14px",cursor:"pointer",color:"var(--ax-body2)",display:"flex",alignItems:"center",gap:12,flexWrap:"wrap"},children:[y.jsx("span",{style:{display:"inline-block",transform:a?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.15s",color:Ke,fontSize:10,width:12},children:"▶"}),y.jsx("span",{style:{color:cn,fontFamily:"'Cinzel',serif",fontSize:12,letterSpacing:"0.2em",textTransform:"uppercase"},children:"KPI Submissions"}),y.jsxs("span",{style:{color:Ke,fontSize:11},children:[d.length," submission",d.length===1?"":"s"]}),y.jsx("span",{style:{color:Ke,fontSize:11},children:"·"}),y.jsxs("span",{style:{color:cn,fontSize:11},children:["$",Math.round(m).toLocaleString()," ALP"]}),y.jsx("span",{style:{marginLeft:"auto",color:Ke,fontSize:11},children:a?"Collapse":"Expand"})]}),a&&y.jsx("div",{style:{overflowX:"auto"},children:y.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12,minWidth:900},children:[y.jsx("thead",{children:y.jsx("tr",{style:{background:"var(--ax-card)",color:Ke,textAlign:"left"},children:v.map(p=>y.jsx("th",{style:{padding:"8px 10px",borderBottom:`1px solid ${Mt}`,fontWeight:600,fontSize:10,letterSpacing:"0.15em",textTransform:"uppercase"},children:p},p))})}),y.jsx("tbody",{children:d.map(p=>{const b=t?h.get(p.id):null,_=p.talk_time_seconds||0,S=_>=7200?250:400,R=E=>E?Jp:Zp;return y.jsxs("tr",{id:`kpi-row-${p.id}`,style:{color:"var(--ax-body2)",borderBottom:"1px solid rgba(217,173,92,0.12)",verticalAlign:"top",background:n===p.id?"rgba(217,173,92,0.14)":void 0,boxShadow:n===p.id?`inset 3px 0 0 ${cn}`:void 0},children:[y.jsx("td",{style:{padding:"8px 10px"},children:p.report_date}),y.jsx("td",{style:{padding:"8px 10px",color:cn},children:p.agent_name}),y.jsxs("td",{style:{padding:"8px 10px"},children:[Math.round(_/60),"m"]}),y.jsx("td",{style:{padding:"8px 10px",color:R((p.dials||0)>=S)},title:`Target ${S}`,children:p.dials}),y.jsx("td",{style:{padding:"8px 10px",color:R((p.pickups||0)>=8)},children:p.pickups}),y.jsx("td",{style:{padding:"8px 10px"},children:p.leads}),y.jsx("td",{style:{padding:"8px 10px",color:R((p.sets||0)>=5)},children:p.sets}),y.jsx("td",{style:{padding:"8px 10px"},children:p.shows}),y.jsx("td",{style:{padding:"8px 10px"},children:p.on_spots}),y.jsx("td",{style:{padding:"8px 10px",color:R((p.presentations||0)>=4)},children:p.presentations}),y.jsx("td",{style:{padding:"8px 10px",color:R((p.closed_deals||0)>=1)},children:p.closed_deals}),y.jsx("td",{style:{padding:"8px 10px"},children:p.reschedules}),y.jsx("td",{style:{padding:"8px 10px"},children:p.referrals}),y.jsxs("td",{style:{padding:"8px 10px",color:R(Number(p.alp||0)>=1e3)}
45,children:["$",Number(p.alp).toLocaleString()]}),y.jsx("td",{style:{padding:"8px 10px",maxWidth:340,whiteSpace:"pre-wrap",color:p.notes?"var(--ax-body2)":Ke},children:p.notes||"—"}),t&&y.jsx("td",{style:{padding:"8px 10px",maxWidth:360,whiteSpace:"pre-wrap",color:b?.agent_feedback?"var(--ax-body2)":Ke},children:b?.agent_feedback?y.jsxs(y.Fragment,{children:[y.jsx("div",{children:b.agent_feedback}),y.jsxs("div",{style:{color:Ke,fontSize:10,marginTop:4},children:[b.agent_feedback_by?`— ${b.agent_feedback_by}`:"",b.agent_feedback_at?` · ${new Date(b.agent_feedback_at).toLocaleDateString()}`:""]})]}):"—"})]},p.id)})})]})})]})}function b_({children:e}){return y.jsx("div",{style:{background:_l,border:`1px solid ${Mt}`,borderRadius:4,padding:20},children:e})}const sz=()=>tt(()=>import("./course-Da-CzE6p.js"),[]),az=ct("/course")({head:()=>({meta:[{title:"Onboarding Course · Mob Website"},{name:"robots",content:"noindex"}]}),component:st(sz,"component")}),iz=Sr({method:"POST"}).middleware([Bi]).handler(qs("9003f54baa8eb5ef804c9fbdda92a6aead1277f96a24dae0dca50f0a11d2c9d7")),Z3=Object.freeze(Object.defineProperty({__proto__:null,approveAccessRequest:iz},Symbol.toStringTag,{value:"Module"})),oz=()=>tt(()=>import("./admin-pAdEHn0f.js"),[]),lz=ct("/admin")({head:()=>({meta:[{title:"Admin · Mob Website"},{name:"robots",content:"noindex"}]}),component:st(oz,"component")}),cz={marginTop:16,paddingTop:16,borderTop:"1px solid var(--ax-line)"},__={color:"var(--ax-muted)",fontSize:11,letterSpacing:"0.14em",textTransform:"uppercase",marginBottom:6},w_={width:"100%",background:"var(--ax-card2)",border:"1px solid var(--ax-line)",color:"var(--ax-text)",borderRadius:8,padding:"10px 12px",fontSize:14,resize:"vertical",fontFamily:"'Lato', sans-serif"},Op={background:"var(--ax-gold)",color:"#000",border:"none",padding:"9px 16px",borderRadius:8,fontSize:11,letterSpacing:"0.16em",textTransform:"uppercase",fontWeight:700,fontFamily:"'Cinzel', serif",cursor:"pointer"},uz={...Op,background:"transparent",color:"var(--ax-gold)",border:"1px solid var(--ax-line)"};function S_(e){const t=Math.max(0,Math.floor(e)),n=Math.floor(t/3600),a=Math.floor(t%3600/60),o=t%60,l=n>0?String(a).padStart(2,"0"):String(a);return`${n>0?`${n}:`:""}${l}:${String(o).padStart(2,"0")}`}function dz(e){const t=O.useRef(null),n=O.useRef(0),[a,o]=O.useState(!1);O.useEffect(()=>{let h=!1,d=null;const m=()=>{if(h)return;let b=e.current?.parentElement??null,_=null;for(;b&&!_;)_=b.querySelector('iframe[src*="youtube.com/embed"]'),b=b.parentElement;if(_){if(t.current=_,!/enablejsapi=1/.test(_.src)){const S=_.src.includes("?")?"&":"?";_.src=`${_.src}${S}enablejsapi=1`}o(!0),d=setInterval(()=>{t.current?.contentWindow?.postMessage(JSON.stringify({event:"listening",id:1,channel:"widget"}),"*")},1e3)}},v=b=>{if(!(!t.current||b.source!==t.current.contentWindow)&&typeof b.data=="string")try{const S=JSON.parse(b.data)?.info?.currentTime;typeof S=="number"&&(n.current=S)}catch{}};window.addEventListener("message",v);const p=setTimeout(m,300);return()=>{h=!0,clearTimeout(p),d&&clearInterval(d),window.removeEventListener("message",v)}},[e]);const l=O.useCallback(()=>Math.floor(n.current),[]),u=O.useCallback(h=>{const d=t.current?.contentWindow;d&&(d.postMessage(JSON.stringify({event:"command",func:"seekTo",args:[h,!0]}),"*"),d.postMessage(JSON.stringify({event:"command",func:"playVideo",args:[]}),"*"),t.current?.scrollIntoView({behavior:"smooth",block:"center"}))},[]);return{ready:a,getTime:l,seek:u}}function eP({videoKey:e}){const{user:t}=kS(),n=O.useRef(null),{getTime:a,seek:o}=dz(n),[l,u]=O.useState(""),[h,d]=O.useState(""),[m,v]=O.useState(!1),[p,b]=O.useState(!1),[_,S]=O.useState([]),[R,E]=O.useState(""),[x,k]=O.useState(null),[D,j]=O.useState(!1),H=O.useCallback(async()=>{if(!t)return;const{data:se}=await Re.from("video_timestamp_notes").select("id, seconds, text").eq("user_id",t.id).eq("video_key",e).order("seconds",{ascending:!0});S(se??[])},[t,e]),U=O.useCallback(async()=>{if(!t)return;const{data:se}=await Re.from("video_notes").select("text").eq("user_id",t.id).eq("video_key",e).maybeSingle(),le=se?.text??"";u(le),d(ue=>ue.trim()===""||ue===le?le:ue)},[t,e]);O.useEffect(()=>{let se=!1;if(d(""),u(""),S([]),E(""),k(null),!!t)return(async()=>se||(await U(),!se&&await H()))(),()=>{se=!0}},[t,e,U,H]),O.useEffect(()=>{if(!t)return;const se=Re.channel(`video-notes-${t.id}-${e}-${Math.random().toString(36).slice(2)}`).on("postgres_changes",{event:"*",schema:"public",table:"video_notes",filter:`user_id=eq.${t.id}`},()=>{U()}).on("postgres_changes",{event:"*",schema:"public",table:"video_timestamp_notes",filter:`user_id=eq.${t.id}`},()=>{H()}).subscribe();return()=>{Re.removeChannel(se)}},[t,e,U,H]);async function B(){if(!t)return;v(!0);const{error:se}=await Re.from("video_notes").upsert({user_id:t.id,video_key:e,text:h},{onConflict:"user_id,video_key"});v(!1),se||(u(h),b(!0),setTimeout(()=>b(!1),2e3))}async function V(){if(!t||!R.trim())return;j(!0);const se=x??a(),{error:le}=await Re.from("video_timestamp_notes").insert({user_id:t.id,video_key:e,seconds:se,text:R.trim()});j(!1),le||(E(""),k(null),await H())}async function W(se){t&&(await Re.from("video_timestamp_notes").delete().eq("id",se).eq("user_id",t.id),await H())}return y.jsxs("div",{style:cz,ref:n,children:[y.jsx("div",{style:__,children:"Timestamped notes (private)"}),y.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",style:{marginBottom:10},children:[y.jsxs("button",{type:"button",style:{...uz,whiteSpace:"nowrap"},onClick:()=>k(a()),disabled:!t,title:"Grab the current moment in the video",children:["⏱ Mark ",x!==null?S_(x):"current time"]}),y.jsx("input",{value:R,onChange:se=>E(se.target.value),onKeyDown:se=>{se.key==="Enter"&&V()},placeholder:"Note for this moment…",disabled:!t,style:{...w_,flex:1,resize:"none"}}),y.jsx("button",{style:Op,onClick:V,disabled:!t||D||!R.trim(),children:D?"Adding…":"Add"})]}),_.length>0&&y.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6,marginBottom:14},children:_.map(se=>
45y.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:10,background:"var(--ax-card2)",border:"1px solid var(--ax-line)",borderRadius:8,padding:"8px 10px"},children:[y.jsxs("button",{type:"button",onClick:()=>o(se.seconds),title:"Jump to this moment",style:{background:"transparent",border:"1px solid var(--ax-gold)",color:"var(--ax-gold)",borderRadius:6,padding:"2px 8px",fontSize:12,cursor:"pointer",fontVariantNumeric:"tabular-nums"},children:["▶ ",S_(se.seconds)]}),y.jsx("span",{style:{color:"var(--ax-text)",fontSize:14,flex:1,wordBreak:"break-word"},children:se.text}),y.jsx("button",{type:"button",onClick:()=>W(se.id),"aria-label":"Delete note",style:{background:"transparent",border:"none",color:"var(--ax-muted)",cursor:"pointer",fontSize:14},children:"✕"})]},se.id))}),y.jsx("div",{style:__,children:"My notes (private)"}),y.jsx("textarea",{value:h,onChange:se=>d(se.target.value),placeholder:"What stood out? Scripts, objections, next steps…",rows:4,style:w_,disabled:!t}),y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginTop:8},children:[y.jsx("button",{style:Op,onClick:B,disabled:m||!t||h===l,children:m?"Saving…":"Save note"}),p&&y.jsx("span",{style:{color:"var(--ax-success)",fontSize:12},children:"✓ Saved"}),!t&&y.jsx("span",{style:{color:"var(--ax-muted)",fontSize:13},children:"Sign in to save notes."})]})]})}const fz=()=>tt(()=>import("./index-CTrg6LRM.js"),__vite__mapDeps([12,13,14,15,16,17,3,4])),hz=ct("/")({head:()=>{const e="Mob Website agent portal — onboarding, daily KPI reporting, training vaults and team leaderboards for our life insurance agents.",t=`https://apexmob.life${RS.url}`;return{meta:[{title:"Mob Website — Agent Onboarding & KPI Portal"},{name:"description",content:e},{property:"og:title",content:"Mob Website — Agent Onboarding & KPI Portal"},{property:"og:description",content:e},{property:"og:url",content:"https://apexmob.life/"},{property:"og:type",content:"website"},{property:"og:image",content:t},{name:"twitter:title",content:"Mob Website — Agent Onboarding & KPI Portal"},{name:"twitter:description",content:e},{name:"twitter:image",content:t}],links:[{rel:"canonical",href:"https://apexmob.life/"}]}},component:st(fz,"component")}),pz=()=>tt(()=>import("./auth.confirm-Cgkhtp4z.js"),[]),mz=ct("/auth/confirm")({head:()=>({meta:[{title:"Confirm your email · Mob Website"},{name:"description",content:"Finish verifying your Mob Website account and sign in to your dashboard."},{name:"robots",content:"noindex"},{property:"og:title",content:"Confirm your email · Mob Website"},{property:"og:description",content:"Finish verifying your Mob Website account and sign in to your dashboard."},{property:"og:type",content:"website"},{name:"twitter:card",content:"summary"}]}),component:st(pz,"component")}),gz=()=>tt(()=>import("./onboarding.index-B9vNxcdB.js"),__vite__mapDeps([18,14,15,16,17])),yz=ct("/onboarding/")({head:()=>({meta:[{title:"Apex Mob Elite Onboarding"},{name:"description",content:"Track your Apex Mob onboarding progress, ramp milestones, licensed states and writing number in one place."},{property:"og:title",content:"Apex Mob Elite Onboarding"},{property:"og:description",content:"Track your onboarding progress and licensed states."},{property:"og:type",content:"website"},{name:"twitter:card",content:"summary"},{name:"robots",content:"noindex"}]}),component:st(gz,"component")}),vz=()=>tt(()=>import("./onboarding.product-quiz-CBCO9GLq.js"),__vite__mapDeps([19,17])),bz=ct("/onboarding/product-quiz")({head:()=>({meta:[{title:"AIL Product Knowledge Quiz — Apex Mob"},{name:"description",content:"72-question AIL product knowledge quiz covering products, underwriting and real-world scenarios."},{property:"og:title",content:"AIL Product Knowledge Quiz — Apex Mob"},{property:"og:description",content:"72 questions on products, underwriting and real-world scenarios."},{property:"og:type",content:"website"},{name:"twitter:card",content:"summary"},{name:"robots",content:"noindex"}]}),component:st(vz,"component")}),_z=()=>tt(()=>import("./onboarding.eapp-quiz-CTlSl11j.js"),__vite__mapDeps([20,4,16,15])),wz=ct("/onboarding/eapp-quiz")({head:()=>({meta:[{title:"eApp Mastery Quiz — Apex Mob Elite Onboarding"},{name:"description",content:"18-question eApp Mastery Quiz. 100% required to pass."},{property:"og:title",content:"eApp Mastery Quiz — Apex Mob"},{property:"og:description",content:"18-question eApp Mastery Quiz. 100% required to pass."},{property:"og:type",content:"website"},{name:"twitter:card",content:"summary"},{name:"robots",content:"noindex"}
45]}),component:st(_z,"component")}),Sz=()=>tt(()=>import("./onboarding.ao-intel-CLHprjyX.js"),__vite__mapDeps([21,15])),xz=ct("/onboarding/ao-intel")({head:()=>({meta:[{title:"Set up AO Intel — Apex Mob Elite Onboarding"},{name:"description",content:"Set up AO Intel so your Globe market leads flow in — access, login, profile and lead confirmation."},{property:"og:title",content:"Set up AO Intel — Apex Mob Elite Onboarding"},{property:"og:description",content:"Globe market setup steps for new Apex Mob agents."},{property:"og:type",content:"website"},{name:"twitter:card",content:"summary"},{name:"robots",content:"noindex"}]}),component:st(Sz,"component")}),Tz=()=>tt(()=>import("./onboarding.admin-CHt6i4nF.js"),__vite__mapDeps([22,15])),Ez=ct("/onboarding/admin")({head:()=>({meta:[{title:"Onboarding Team View — Apex Mob"},{name:"description",content:"Leadership view of every agent's Elite Onboarding progress."},{property:"og:title",content:"Onboarding Team View — Apex Mob"},{property:"og:description",content:"Leadership view of Elite Onboarding progress."},{property:"og:type",content:"website"},{name:"twitter:card",content:"summary"},{name:"robots",content:"noindex"}]}),component:st(Tz,"component")}),Rz=()=>tt(()=>import("./admin.index-CDmgYJC9.js"),__vite__mapDeps([23,11])),Az=ct("/admin/")({head:()=>({meta:[{title:"Admin · Mob Website"},{name:"robots",content:"noindex"}]}),component:st(Rz,"component")}),kz=()=>tt(()=>import("./admin.weekly-validation-_3TqhI5y.js"),[]),Cz=ct("/admin/weekly-validation")({head:()=>({meta:[{title:"Weekly Validation Report · Mob Website"},{name:"robots",content:"noindex"}]}),component:st(kz,"component")}),Oz=()=>tt(()=>import("./admin.roster-audit-0hAUkPAf.js"),[]),jz=ct("/admin/roster-audit")({head:()=>({meta:[{title:"Roster Audit Log · Mob Website"},{name:"robots",content:"noindex"}]}),component:st(Oz,"component")}),Dz=()=>tt(()=>import("./admin.recovery-log-B-8dFdnZ.js"),[]),Mz=ct("/admin/recovery-log")({head:()=>({meta:[{title:"Recovery Link Log · Mob Website"},{name:"robots",content:"noindex"}]}),component:st(Dz,"component")}),Nz=Sr({method:"POST"}).middleware([Bi]).handler(qs("fca449bbcc0c3f3e0ea1ffd9a0d28a1166c82268c2b271669a1502915f8575f3")),Lz=Sr({method:"POST"}).middleware([Bi]).handler(qs("afc846c3c651f6c51ee82961fdce53bdf71137ac3fedb2027399229d6d86c726")),zz=Sr({method:"POST"}).middleware([Bi]).handler(qs("f1048951f03b95162227ecaa4bd27e5cba2dc4f6288bea16a6336d963ce42cf1")),Pz=()=>tt(()=>import("./admin.questions-KcZpuV_E.js"),[]),Uz=()=>tt(()=>import("./admin.questions-BKmAE-5F.js"),[]),$z=ct("/admin/questions")({component:Bz,errorComponent:st(Uz,"errorComponent"),notFoundComponent:st(Pz,"notFoundComponent")}),gt="var(--ax-gold)",x_="var(--ax-card)",Wr="#141414",un="rgba(217,173,92,0.25)";function Bz(){const e=Ah(Nz),t=Ah(Lz),n=Ah(zz),[a,o]=O.useState(!0),[l,u]=O.useState(null),[h,d]=O.useState(null),m=O.useCallback(async()=>{o(!0),u(null);try{const _=await e({data:void 0});_.ok?d(_):(u(_.error),d(null))}catch(_){u(_ instanceof Error?_.message:"Failed to load.")}finally{o(!1)}},[e]);O.useEffect(()=>{m()},[m]);const v=m,p=async(_,S,R)=>{const E=await t({data:{question:_,answer:S,normalized:R}});return E.ok?(await v(),!0):(alert(E.error),!1)},b=async _=>{if(!confirm("Remove this correction? The AI will go back to answering from its built-in knowledge."))return;const S=await n({data:{normalized:_}});if(!S.ok){alert(S.error);return}await v()};return!h||!h.ok?y.jsx("div",{style:{minHeight:"100vh",background:x_,color:"var(--ax-text)",fontFamily:"'Inter', sans-serif",display:"flex",alignItems:"center",justifyContent:"center",padding:24},children:y.jsxs("div",{style:{background:Wr,border:`1px solid ${un}`,borderRadius:12,padding:32,width:"100%",maxWidth:420,textAlign:"center"},children:[y.jsx("h1",{style:{fontFamily:"'Cinzel', serif",color:gt,fontSize:22,margin:0,marginBottom:8,letterSpacing:"0.12em"},children:"APEX SUPPORT · ADMIN"}),y.jsx("p",{style:{color:"var(--ax-muted)",fontSize:13,margin:0},children:a?"Loading AI Bot Q&A…":l??"No data available."}),!a&&y.jsx("button",{onClick:()=>{m()},style:{marginTop:16,padding:"10px 18px",background:gt,color:"#000",border:"none",borderRadius:8,fontWeight:700,letterSpacing:"0.12em",fontSize:13,cursor:"pointer"},children:"RETRY"})]})}):y.jsx("div",{style:{minHeight:"100vh",background:x_,color:"var(--ax-text)",fontFamily:"'Inter', sans-serif",padding:"32px 24px 64px"},children:y.jsxs("div",{style:{maxWidth:1100,margin:"0 auto"},children:[y.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:24,flexWrap:"wrap",gap:12},children:[y.jsxs("div",{children:[y.jsx("h1",{style:{fontFamily:"'Cinzel', serif",color:gt,fontSize:26,margin:0,letterSpacing:"0.12em"},children:"CHAT QUESTIONS"}),y.jsx("p",{style:{color:"var(--ax-muted)",fontSize:13,margin:"6px 0 0"},children:"Review what agents are asking and correct how the AI answers any question. Corrected answers are used by the assistant immediately on the next message."})]}),y.jsx("button",{onClick:v,disabled:a,style:{padding:"10px 18px",background:"transparent",color:gt,border:`1px solid ${gt}`,borderRadius:8,fontSize:13,fontWeight:600,letterSpacing:"0.1em",curs
45or:a?"wait":"pointer"},children:a?"…":"REFRESH"})]}),y.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",gap:12,marginBottom:32},children:[y.jsx(iu,{label:"Total questions",value:h.total.toString()}),y.jsx(iu,{label:"Last 24 hours",value:h.last24h.toString()}),y.jsx(iu,{label:"Avg / active day",value:h.avgPerDay.toString()}),y.jsx(iu,{label:"Active corrections",value:h.overrides.length.toString()})]}),y.jsx(Si,{title:"Questions per day (last 30 days)",children:y.jsx(Gz,{perDay:h.perDay})}),y.jsx(Si,{title:"Top 10 askers",children:h.topAskers.length===0?y.jsx(ou,{children:"No identified askers yet — questions from signed-in agents will appear here."}):y.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:h.topAskers.map(_=>y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,background:Wr,border:`1px solid ${un}`,borderRadius:8,padding:"10px 14px"},children:[y.jsx("div",{style:{width:28,textAlign:"center",color:_.rank<=3?gt:"var(--ax-muted)",fontFamily:"'Cinzel', serif",fontSize:16},children:_.rank}),y.jsxs("div",{style:{flex:1,minWidth:0},children:[y.jsx("div",{style:{fontSize:14,color:"var(--ax-text)"},children:_.name}),y.jsxs("div",{style:{fontSize:11,color:"var(--ax-muted)"},children:[_.email??"—"," · last asked ",new Date(_.lastAsked).toLocaleDateString()]})]}),y.jsxs("div",{style:{textAlign:"right",whiteSpace:"nowrap"},children:[y.jsx("div",{style:{color:gt,fontFamily:"'Cinzel', serif",fontSize:18},children:_.count}),y.jsxs("div",{style:{fontSize:11,color:"var(--ax-muted)"},children:[_.last7," in 7d"]})]})]},_.email??_.name))})}),y.jsx(Si,{title:"Teach the AI a new answer",children:y.jsx(qz,{onSave:async(_,S)=>await p(_,S)})}),y.jsx(Si,{title:"Active corrections",children:h.overrides.length===0?y.jsx(ou,{children:"No corrections yet. Use the form above or edit a top question below."}):y.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:h.overrides.map(_=>y.jsx(Hz,{override:_,onSave:S=>p(_.question,S,_.normalized),onDelete:()=>b(_.normalized)},_.normalized))})}),y.jsx(Si,{title:"Top asked (all time)",children:h.top.length===0?y.jsx(ou,{children:"No questions logged yet."}):y.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:h.top.map(_=>y.jsx(Iz,{faq:_,onSave:S=>p(_.question,S,_.normalized),onDelete:()=>b(_.normalized)},_.normalized))})}),y.jsx(Si,{title:"Recent questions",children:h.recent.length===0?y.jsx(ou,{children:"Nothing yet."}):y.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:h.recent.map(_=>y.jsxs("details",{style:{background:Wr,border:`1px solid ${un}`,borderRadius:8,padding:"10px 14px"},children:[y.jsxs("summary",{style:{cursor:"pointer",display:"flex",justifyContent:"space-between",gap:12},children:[y.jsx("span",{style:{fontSize:14},children:_.question}),y.jsxs("span",{style:{color:"var(--ax-muted)",fontSize:11,whiteSpace:"nowrap"},children:[_.asker_name||_.asker_email?`${_.asker_name||_.asker_email} · `:"",new Date(_.created_at).toLocaleString()]})]}),_.answer&&y.jsx("div",{style:{marginTop:10,padding:12,background:"var(--ax-card)",borderRadius:6,color:"var(--ax-body)",fontSize:13,whiteSpace:"pre-wrap"},children:_.answer}),y.jsx("div",{style:{marginTop:10},children:y.jsx(Fz,{initialAnswer:_.answer??"",onSave:S=>p(_.question,S,_.normalized)})})]},_.id))})})]})})}function Iz({faq:e,onSave:t,onDelete:n}){const[a,o]=O.useState(!1),[l,u]=O.useState(e.override??e.lastAnswer??""),[h,d]=O.useState(!1),m=!!e.override;return y.jsxs("div",{style:{padding:"12px 14px",background:Wr,border:`1px solid ${m?gt:un}`,borderRadius:8},children:[y.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[y.jsxs("div",{style:{background:gt,color:"#000",fontWeight:700,borderRadius:6,padding:"4px 10px",fontSize:12,minWidth:36,textAlign:"center"},children:["×",e.count]}),y.jsxs("div",{style:{flex:1,fontSize:14},children:[e.question,m&&y.jsx("span",{style:{marginLeft:8,fontSize:10,background:gt,color:"#000",padding:"2px 6px",borderRadius:4,fontWeight:700,letterSpacing:"0.08em"},children:"CORRECTED"})]}),y.jsx("div",{style:{color:"var(--ax-muted)",fontSize:11}
45,children:new Date(e.lastAsked).toLocaleString()}),y.jsx("button",{onClick:()=>o(v=>!v),style:{background:"transparent",border:`1px solid ${gt}`,color:gt,borderRadius:6,padding:"6px 10px",fontSize:11,letterSpacing:"0.08em",fontWeight:600,cursor:"pointer"},children:a?"CLOSE":m?"EDIT":"CORRECT"})]}),a&&y.jsxs("div",{style:{marginTop:12},children:[y.jsx("textarea",{value:l,onChange:v=>u(v.target.value),placeholder:"Write exactly how the AI should answer this question…",rows:5,style:{width:"100%",padding:10,background:"var(--ax-card)",border:`1px solid ${un}`,borderRadius:6,color:"var(--ax-text)",fontSize:13,fontFamily:"inherit",resize:"vertical",outline:"none"}}),y.jsxs("div",{style:{display:"flex",gap:8,marginTop:8},children:[y.jsx("button",{disabled:h||!l.trim(),onClick:async()=>{d(!0);const v=await t(l.trim());d(!1),v&&o(!1)},style:{background:gt,color:"#000",border:"none",borderRadius:6,padding:"8px 14px",fontSize:12,fontWeight:700,letterSpacing:"0.1em",cursor:h||!l.trim()?"not-allowed":"pointer",opacity:h||!l.trim()?.6:1},children:h?"SAVING…":"SAVE CORRECTION"}),m&&y.jsx("button",{onClick:n,style:{background:"transparent",color:"var(--ax-danger-strong)",border:"1px solid var(--ax-danger)",borderRadius:6,padding:"8px 14px",fontSize:12,fontWeight:600,letterSpacing:"0.1em",cursor:"pointer"},children:"REMOVE CORRECTION"})]}),e.lastAnswer&&y.jsxs("details",{style:{marginTop:10},children:[y.jsx("summary",{style:{cursor:"pointer",fontSize:11,color:"var(--ax-muted)"},children:"Show last AI answer for reference"}),y.jsx("div",{style:{marginTop:8,padding:10,background:"var(--ax-card)",borderRadius:6,color:"var(--ax-body)",fontSize:12,whiteSpace:"pre-wrap"},children:e.lastAnswer})]})]})]})}function Hz({override:e,onSave:t,onDelete:n}){const[a,o]=O.useState(!1),[l,u]=O.useState(e.answer),[h,d]=O.useState(!1);return y.jsxs("div",{style:{padding:"12px 14px",background:Wr,border:`1px solid ${gt}`,borderRadius:8},children:[y.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:12},children:[y.jsxs("div",{style:{flex:1},children:[y.jsx("div",{style:{fontSize:14,marginBottom:6},children:e.question}),!a&&y.jsx("div",{style:{padding:10,background:"var(--ax-card)",borderRadius:6,color:"var(--ax-body)",fontSize:13,whiteSpace:"pre-wrap"},children:e.answer})]}),y.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[y.jsx("button",{onClick:()=>o(m=>!m),style:{background:"transparent",border:`1px solid ${gt}`,color:gt,borderRadius:6,padding:"6px 10px",fontSize:11,fontWeight:600,letterSpacing:"0.08em",cursor:"pointer"},children:a?"CLOSE":"EDIT"}),y.jsx("button",{onClick:n,style:{background:"transparent",color:"var(--ax-danger-strong)",border:"1px solid var(--ax-danger)",borderRadius:6,padding:"6px 10px",fontSize:11,fontWeight:600,letterSpacing:"0.08em",cursor:"pointer"},children:"REMOVE"})]})]}),a&&y.jsxs("div",{style:{marginTop:10},children:[y.jsx("textarea",{value:l,onChange:m=>u(m.target.value),rows:5,style:{width:"100%",padding:10,background:"var(--ax-card)",border:`1px solid ${un}`,borderRadius:6,color:"var(--ax-text)",fontSize:13,fontFamily:"inherit",resize:"vertical",outline:"none"}}),y.jsx("button",{disabled:h||!l.trim(),onClick:async()=>{d(!0);const m=await t(l.trim());d(!1),m&&o(!1)},style:{marginTop:8,background:gt,color:"#000",border:"none",borderRadius:6,padding:"8px 14px",fontSize:12,fontWeight:700,letterSpacing:"0.1em",cursor:h||!l.trim()?"not-allowed":"pointer",opacity:h||!l.trim()?.6:1},children:h?"SAVING…":"SAVE"})]}),y.jsxs("div",{style:{marginTop:8,fontSize:10,color:"var(--ax-muted)"},children:["Updated ",new Date(e.updated_at).toLocaleString()]})]})}function qz({onSave:e}){const[t,n]=O.useState(""),[a,o]=O.useState(""),[l,u]=O.useState(!1);return y.jsxs("div",{style:{padding:14,background:Wr,border:`1px solid ${un}`,borderRadius:8,display:"flex",flexDirection:"column",gap:10},children:[y.jsx("input",{value:t,onChange:h=>n(h.target.value),placeholder:"Question (how an agent would phrase it)",style:{padding:10,background:"var(--ax-card)",border:`1px solid ${un}`,borderRadius:6,color:"var(--ax-text)",fontSize:13,outline:"none"}}),y.jsx("textarea",{value:a,onChange:h=>o(h.target.value),placeholder:"The exact answer the AI should give…",rows:4,style:{padding:10,background:"var(--ax-card)",border:`1px solid ${un}`,borderRadius:6,color:"var(--ax-text)",fontSize:13,fontFamily:"inherit",resize:"vertical",outline:"none"}}),y.jsx("button",{disabled:l||!t.trim()||!a.trim(),onClick:async()=>{u(!0);const h=await e(t.trim(),a.trim());u(!1),h&&(n(""),o(""))},style:{alignSelf:"flex-start",background:gt,color:"#000",border:"none",borderRadius:6,padding:"10px 18px",fontSize:12,fontWeight:700,letterSpacing:"0.1em",curs
45or:l||!t.trim()||!a.trim()?"not-allowed":"pointer",opacity:l||!t.trim()||!a.trim()?.6:1},children:l?"SAVING…":"TEACH AI"})]})}function Fz({initialAnswer:e,onSave:t}){const[n,a]=O.useState(!1),[o,l]=O.useState(e),[u,h]=O.useState(!1);return n?y.jsxs("div",{children:[y.jsx("textarea",{value:o,onChange:d=>l(d.target.value),rows:4,style:{width:"100%",padding:10,background:"var(--ax-card)",border:`1px solid ${un}`,borderRadius:6,color:"var(--ax-text)",fontSize:13,fontFamily:"inherit",resize:"vertical",outline:"none"}}),y.jsxs("div",{style:{display:"flex",gap:8,marginTop:8},children:[y.jsx("button",{disabled:u||!o.trim(),onClick:async()=>{h(!0);const d=await t(o.trim());h(!1),d&&a(!1)},style:{background:gt,color:"#000",border:"none",borderRadius:6,padding:"8px 14px",fontSize:12,fontWeight:700,letterSpacing:"0.1em",cursor:u||!o.trim()?"not-allowed":"pointer",opacity:u||!o.trim()?.6:1},children:u?"SAVING…":"SAVE"}),y.jsx("button",{onClick:()=>a(!1),style:{background:"transparent",color:"var(--ax-muted)",border:`1px solid ${un}`,borderRadius:6,padding:"8px 14px",fontSize:12,fontWeight:600,letterSpacing:"0.1em",cursor:"pointer"},children:"CANCEL"})]})]}):y.jsx("button",{onClick:()=>a(!0),style:{background:"transparent",border:`1px solid ${gt}`,color:gt,borderRadius:6,padding:"6px 12px",fontSize:11,fontWeight:600,letterSpacing:"0.08em",cursor:"pointer"},children:"CORRECT THIS ANSWER"})}function Gz({perDay:e}){const t=Math.max(1,...e.map(n=>n.count));return y.jsxs("div",{style:{background:Wr,border:`1px solid ${un}`,borderRadius:10,padding:"16px 18px"},children:[y.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:4,height:130},children:e.map(n=>y.jsx("div",{title:`${n.date}: ${n.count} question${n.count===1?"":"s"}`,style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"flex-end",height:"100%"},children:y.jsx("div",{style:{height:`${Math.max(2,n.count/t*100)}%`,background:n.count?gt:un,opacity:n.count?.9:.5,borderRadius:2}})},n.date))}),y.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:8,fontSize:11,color:"var(--ax-muted)"},children:[y.jsx("span",{children:e[0]?.date}),y.jsxs("span",{children:["peak ",t,"/day"]}),y.jsx("span",{children:e[e.length-1]?.date})]})]})}function iu({label:e,value:t}){return y.jsxs("div",{style:{background:Wr,border:`1px solid ${un}`,borderRadius:10,padding:"16px 18px"},children:[y.jsx("div",{style:{color:"var(--ax-muted)",fontSize:11,letterSpacing:"0.12em",textTransform:"uppercase"},children:e}),y.jsx("div",{style:{color:gt,fontFamily:"'Cinzel', serif",fontSize:28,marginTop:4},children:t})]})}function Si({title:e,children:t}){return y.jsxs("section",{style:{marginBottom:32},children:[y.jsx("h2",{style:{fontFamily:"'Cinzel', serif",color:"var(--ax-text)",fontSize:15,letterSpacing:"0.14em",marginBottom:12,textTransform:"uppercase"},children:e}),t]})}function ou({children:e}){return y.jsx("div",{style:{padding:24,textAlign:"center",color:"var(--ax-muted)",background:Wr,border:`1px dashed ${un}`,borderRadius:8,fontSize:13},children:e})}const Kh={background:"var(--ax-page)",color:"var(--ax-text)",minHeight:"100vh",padding:"32px 24px",fontFamily:"'Lato',sans-serif"},Vz={maxWidth:1100,margin:"0 auto"},Yz={display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:30,borderBottom:"1px solid rgba(217,173,92,0.3)",paddingBottom:16,flexWrap:"wrap",gap:12},Kz={color:"var(--ax-muted)",fontSize:10,letterSpacing:"0.35em"},Wz={fontFamily:"'Cinzel',serif",color:"var(--ax-gold-text)",letterSpacing:"0.15em",fontSize:"1.6rem",margin:"6px 0 0"},tP={fontFamily:"'Cinzel',serif",color:"var(--ax-gold-text)",letterSpacing:"0.1em",fontSize:"1.15rem",marginBottom:14,display:"flex",alignItems:"center",gap:10},T_={marginBottom:40},E_={background:"var(--ax-card)",border:"1px solid var(--ax-line)",padding:14,borderRadius:2},pa={color:"var(--ax-muted)",fontSize:12},nP={background:"var(--ax-gold)",color:"#000",padding:"2px 8px",borderRadius:10,fontSize:11,fontWeight:700},R_={background:"var(--ax-gold)",color:"#000",border:"none",padding:"10px 18px",fontSize:11,letterSpacing:"0.2em",textTransform:"uppercase",cursor:"pointer",fontFamily:"'Cinzel',serif",fontWeight:700,borderRadius:2},Wh={background:"transparent",color:"var(--ax-gold)",border:"1px solid rgba(217,173,92,0.4)",padding:"8px 14px",fontSize:11,letterSpacing:"0.2em",textTransform:"uppercase",cursor:"pointer",borderRadius:2,fontFamily:"'Cinzel',serif"};function A_({percent:e}){const t=Math.max(0,Math.min(100,e));return y.jsx("div",{style:{background:"var(--ax-card2)",height:8,borderRadius:2,overflow:"hidden",border:"1px solid var(--ax-line)"},children:y.jsx("div",{style:{background:"var(--ax-gold)",width:`${t}%`,height:"100%",transition:"width 300ms ease"}})})}const Qz=ct("/admin/progress")({head:()=>({meta:[{title:"Course Progress · Admin · Mob Website"},{name:"robots",content:"noindex"}
45]}),component:Xz});function Xz(){const{user:e,isAdmin:t,loading:n,adminLoading:a,signOut:o}=kS(),l=Ip(),[u,h]=O.useState([]),[d,m]=O.useState("all"),[v,p]=O.useState(""),[b,_]=O.useState(null),[S,R]=O.useState([]);async function E(){const{data:j}=await Re.from("v_admin_progress").select("*");h(j??[])}O.useEffect(()=>{t&&E()},[t]),O.useEffect(()=>{b&&(async()=>{const{data:j}=await Re.from("help_questions").select("*").eq("user_id",b.user_id).order("created_at",{ascending:!1}).limit(200);R(j??[])})()},[b]);const x=O.useMemo(()=>u.filter(j=>{if(d!=="all"&&j.state!==d)return!1;if(v){const H=v.toLowerCase();if(!`${j.first_name??""} ${j.last_name??""} ${j.full_name??""} ${j.email}`.toLowerCase().includes(H))return!1}return!0}),[u,d,v]);function k(){const H=[["name","email","hiring_manager","state","percent","items","video_pct","minutes","questions","stuck_on","last_active"].join(",")].concat(x.map(V=>[lu(V.full_name??`${V.first_name??""} ${V.last_name??""}`.trim()),lu(V.email),lu(V.hiring_manager??""),V.state,V.percent,`${V.items_completed}/${V.items_total}`,V.video_pct,V.minutes_spent,V.help_questions,lu(V.stuck_on??""),V.last_active_at??""].join(","))),U=new Blob([H.join(`
46`)],{type:"text/csv"}),B=document.createElement("a");B.href=URL.createObjectURL(U),B.download=`course-progress-${new Date().toISOString().slice(0,10)}.csv`,B.click()}if(n||a)return y.jsx("div",{style:Kh,children:"Loading…"});if(!e||!t)return y.jsxs("div",{style:{...Kh,textAlign:"center"},children:[y.jsx("p",{children:"Not authorized."}),y.jsx("button",{onClick:()=>o().then(()=>l({to:"/"})),style:R_,children:"Sign Out"})]});const D={all:u.length,not_started:u.filter(j=>j.state==="not_started").length,in_progress:u.filter(j=>j.state==="in_progress").length,stalled:u.filter(j=>j.state==="stalled").length,completed:u.filter(j=>j.state==="completed").length};return y.jsx("div",{style:Kh,children:y.jsxs("div",{style:Vz,children:[y.jsxs("header",{style:Yz,children:[y.jsxs("div",{children:[y.jsx("div",{style:Kz,children:"APEX MOB · ADMIN"}),y.jsx("h1",{style:Wz,children:"Course Progress"})]}),y.jsxs("div",{style:{display:"flex",gap:12,flexWrap:"wrap"},children:[y.jsx("button",{onClick:k,style:R_,children:"⬇ CSV"}),y.jsx("button",{onClick:()=>l({to:"/admin"}),style:Wh,children:"← Admin"})]})]}),y.jsxs("section",{style:{...T_,display:"flex",gap:8,flexWrap:"wrap"},children:[["all","not_started","in_progress","stalled","completed"].map(j=>y.jsxs("button",{onClick:()=>m(j),style:{...Wh,background:d===j?"var(--ax-gold)":"transparent",color:d===j?"#000":"var(--ax-gold)"},children:[j.replace("_"," ")," (",D[j],")"]},j)),y.jsx("input",{value:v,onChange:j=>p(j.target.value),placeholder:"Search name or email…",style:{flex:1,minWidth:220,padding:"8px 12px",background:"var(--ax-card)",color:"var(--ax-text)",border:"1px solid rgba(217,173,92,0.3)",borderRadius:2}})]}),y.jsx("section",{style:T_,children:x.length===0?y.jsx("div",{style:{...E_,textAlign:"center",color:"var(--ax-muted)"},children:"No agents match."}):y.jsx("div",{style:{display:"grid",gap:8},children:x.map(j=>y.jsxs("button",{onClick:()=>_(j),style:{...E_,textAlign:"left",cursor:"pointer",color:"var(--ax-text)"},children:[y.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginBottom:8},children:[y.jsxs("div",{children:[y.jsx("div",{style:{color:"var(--ax-gold-text)",fontWeight:600},children:j.full_name??`${j.first_name??""} ${j.last_name??""}`.trim()??j.email}),y.jsxs("div",{style:pa,children:[j.email,j.hiring_manager?` · SA: ${j.hiring_manager}`:""]})]}),y.jsxs("div",{style:{textAlign:"right"},children:[y.jsxs("div",{style:{color:"var(--ax-gold-text)",fontWeight:700},children:[j.percent,"%"]}),y.jsx("div",{style:{...pa,fontSize:11},children:Jz(j.state)})]})]}),y.jsx(A_,{percent:j.percent}),y.jsxs("div",{style:{...pa,marginTop:6,display:"flex",gap:14,flexWrap:"wrap"},children:[y.jsxs("span",{children:[j.items_completed,"/",j.items_total," items"]}),y.jsxs("span",{children:["video ",j.video_pct,"%"]}),y.jsxs("span",{children:[j.minutes_spent," min"]}),y.jsxs("span",{children:[j.help_questions," questions"]}),j.stuck_on&&y.jsxs("span",{children:["stuck on: ",j.stuck_on]}),j.last_active_at&&y.jsxs("span",{children:["last active ",new Date(j.last_active_at).toLocaleDateString()]})]})]}
46,j.user_id))})}),b&&y.jsx("div",{onClick:()=>_(null),style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.85)",display:"flex",alignItems:"center",justifyContent:"center",padding:24,zIndex:50},children:y.jsxs("div",{onClick:j=>j.stopPropagation(),style:{background:"var(--ax-card)",border:"1px solid rgba(217,173,92,0.4)",padding:24,maxWidth:720,width:"100%",maxHeight:"85vh",overflowY:"auto",borderRadius:2},children:[y.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:16},children:[y.jsxs("div",{children:[y.jsx("div",{style:{color:"var(--ax-gold-text)",fontFamily:"'Cinzel',serif",fontSize:18},children:b.full_name??b.email}),y.jsx("div",{style:pa,children:b.email})]}),y.jsx("button",{onClick:()=>_(null),style:Wh,children:"✕"})]}),y.jsxs("div",{style:{marginBottom:16},children:[y.jsx(A_,{percent:b.percent}),y.jsxs("div",{style:{...pa,marginTop:8},children:[b.percent,"% · ",b.items_completed,"/",b.items_total," items · ",b.minutes_spent," min · video ",b.video_pct,"%"]})]}),y.jsxs("h3",{style:{color:"var(--ax-gold-text)",fontFamily:"'Cinzel',serif",fontSize:14,letterSpacing:"0.1em",marginBottom:10},children:["AI Bot Questions (",S.length,")"]}),S.length===0?y.jsx("div",{style:pa,children:"None yet."}):y.jsx("div",{style:{display:"grid",gap:8},children:S.map(j=>y.jsxs("div",{style:{background:"var(--ax-card)",padding:10,border:"1px solid var(--ax-line)",fontSize:13},children:[y.jsx("div",{style:{color:"var(--ax-body)"},children:j.question}),j.answer&&y.jsx("div",{style:{color:"var(--ax-muted)",marginTop:4,fontStyle:"italic"},children:j.answer}),y.jsx("div",{style:{...pa,marginTop:4,fontSize:11},children:new Date(j.created_at).toLocaleString()})]},j.id))})]})})]})})}function Jz(e){return e==="completed"?"✓ Completed":e==="stalled"?"⚠ Stalled":e==="in_progress"?"In progress":"Not started"}function lu(e){return/[",\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e}const Zz=()=>tt(()=>import("./admin.digest-DvMRQZay.js"),[]),e3=ct("/admin/digest")({head:()=>({meta:[{title:"Weekly Digest · Mob Website"},{name:"robots",content:"noindex"}]}),component:st(Zz,"component")}),t3=()=>tt(()=>import("./admin.bot-setup-C8YDTRTR.js"),[]),n3=ct("/admin/bot-setup")({head:()=>({meta:[{title:"Bot Setup — Mob Website"},{name:"robots",content:"noindex"}]}),component:st(t3,"component")}),r3=hM.update({id:"/vision-board",path:"/vision-board",getParentRoute:()=>Tn}),s3=mM.update({id:"/team-progress",path:"/team-progress",getParentRoute:()=>Tn}),a3=yM.update({id:"/reset-password",path:"/reset-password",getParentRoute:()=>Tn}),i3=bM.update({id:"/org-chart",path:"/org-chart",getParentRoute:()=>Tn}),Ii=wM.update({id:"/onboarding",path:"/onboarding",getParentRoute:()=>Tn}),o3=AM.update({id:"/leaderboard",path:"/leaderboard",getParentRoute:()=>Tn}),l3=CM.update({id:"/hierarchy-audit",path:"/hierarchy-audit",getParentRoute:()=>Tn}),c3=XL.update({id:"/dashboard",path:"/dashboard",getParentRoute:()=>Tn}),u3=az.update({id:"/course",path:"/course",getParentRoute:()=>Tn}),es=lz.update({id:"/admin",path:"/admin",getParentRoute:()=>Tn}),d3=hz.update({id:"/",path:"/",getParentRoute:()=>Tn}),f3=mz.update({id:"/auth/confirm",path:"/auth/confirm",getParentRoute:()=>Tn}),h3=yz.update({id:"/",path:"/",getParentRoute:()=>Ii}),p3=bz.update({id:"/product-quiz",path:"/product-quiz",getParentRoute:()=>Ii}),m3=wz.update({id:"/eapp-quiz",path:"/eapp-quiz",getParentRoute:()=>Ii}),g3=xz.update({id:"/ao-intel",path:"/ao-intel",getParentRoute:()=>Ii}),y3=Ez.update({id:"/admin",path:"/admin",getParentRoute:()=>Ii}),v3=Az.update({id:"/",path:"/",getParentRoute:()=>es}),b3=Cz.update({id:"/weekly-validation",path:"/weekly-validation",getParentRoute:()=>es}),_3=jz.update({id:"/roster-audit",path:"/roster-audit",getParentRoute:()=>es}),w3=Mz.update({id:"/recovery-log",path:"/recovery-log",getParentRoute:()=>es}),S3=$z.update({id:"/questions",path:"/questions",getParentRoute:()=>es}),x3=Qz.update({id:"/progress",path:"/progress",getParentRoute:()=>es}),T3=e3.update({id:"/digest",path:"/digest",getParentRoute:()=>es}),E3=n3.update({id:"/bot-setup",path:"/bot-setup",getParentRoute:()=>es}),R3={AdminBotSetupRoute:E3,AdminDigestRoute:T3,AdminProgressRoute:x3,AdminQuestionsRoute:S3,AdminRecoveryLogRoute:w3,AdminRosterAuditRoute:_3,AdminWeeklyValidationRoute:b3,AdminIndexRoute:v3},A3=es._addFileChildren(R3),k3={OnboardingAdminRoute:y3,OnboardingAoIntelRoute:g3,OnboardingEappQuizRoute:m3,OnboardingProductQuizRoute:p3,OnboardingIndexRoute:h3},C3=Ii._addFileChildren(k3),O3={IndexRoute:d3,AdminRoute:A3,CourseRoute:u3,DashboardRoute:c3,HierarchyAuditRoute:l3,LeaderboardRoute:o3,OnboardingRoute:C3,OrgChartRoute:i3,ResetPasswordRoute:a3,TeamProgressRoute:s3,VisionBoardRoute:r3,AuthConfirmRoute:f3},j3=Tn._addFileChildren(O3),D3=()=>{const e=new TD;return EC({routeTree:j3,context:{queryClient:e},scrollRestoration:!0,defaultPreloadStaleTime:0})};async function M3(){const e=await D3();let t;if(Rb){const n=await Rb.getOptions();n.serializationAdapters=n.serializationAdapters??[],window.__TSS_START_OPTIONS__=n,t=n.seri
46alizationAdapters,e.options.defaultSsr=n.defaultSsr}else t=[],window.__TSS_START_OPTIONS__={serializationAdapters:t};return t.push(Ek),e.options.serializationAdapters&&t.push(...e.options.serializationAdapters),e.update({basepath:"",serializationAdapters:t}),e.stores.matchesId.get().length||await Ck(e),e}var N3=M3;async function L3(){const e=await N3();return window.$_TSR?.h(),e}var Qh;function z3(){return Qh||(Qh=L3()),y.jsx(Mk,{promise:Qh,children:e=>y.jsx(kC,{router:e})})}O.startTransition(()=>{mT.hydrateRoot(document,y.jsx(O.StrictMode,{children:y.jsx(z3,{})}))});export{HS as $,vS as A,bD as B,oD as C,on as D,F3 as E,G3 as F,xM as G,He as H,Sr as I,Bi as J,qs as K,Hp as L,DM as M,r_ as N,Gw as O,A_ as P,Oi as Q,AM as R,Y3 as S,a_ as T,TL as U,Qp as V,UL as W,OL as X,VL as Y,Kp as Z,tt as _,Ip as a,IS as a0,n_ as a1,Ku as a2,bL as a3,mL as a4,tP as a5,nP as a6,Gt as a7,wt as a8,Qk as a9,P3 as aa,k_ as ab,ae as ac,Hw as ad,eP as ae,V3 as af,Ah as ag,Bw as ah,RS as ai,U3 as aj,Xk as ak,G0 as al,qu as am,I3 as an,xL as ao,Bz as ap,J3 as aq,K3 as ar,Q3 as as,W3 as at,X3 as au,gL as av,iz as aw,H3 as ax,Z3 as ay,R_ as b,Vz as c,Lu as d,Kz as e,Wz as f,Wh as g,Yz as h,E_ as i,y as j,T_ as k,Yu as l,pa as m,dD as n,sD as o,Kh as p,q3 as q,O as r,Re as s,_p as t,kS as u,ar as v,wS as w,nD as x,rD as y,bp as z};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.